diff --git a/README.md b/README.md index 1bb91ecae7..9f32bad4bb 100644 --- a/README.md +++ b/README.md @@ -532,12 +532,12 @@ telescope({ | option | description | defaults | | ----------------------------------------- | -------------------------------------------------------------- | ---------- | | `interfaces.enabled` | Enable converters between Any type and specific implemented interfaces | `true` | -| `interfaces.useGlobalDecoderRegistry` | Enable GlobalDecoderRegistry and related functions. Highly recommended when dealing with fields with 'accepted_interface' option. See 'packages/telescope/__tests__/impl-interfaces.test.ts' for usage. | `false` | +| `interfaces.useGlobalDecoderRegistry` | Enable GlobalDecoderRegistry and related functions. Highly recommended when dealing with fields with 'accepted_interface' option. See 'packages/telescope/__tests__/impl-interfaces.test.ts' for usage. | `true` | | `interfaces.registerAllDecodersToGlobal` | Automatically register all decoders to the global registry | `true` | | `interfaces.useUseInterfacesParams` | Add `useInterfaces` argument to `decode` and `toAmino` functions | `false` | | `interfaces.useByDefault` | Use interface decoders by default (default for `useInterfaces` argument to `decode` and `toAmino` functions) | `true` | | `interfaces.useByDefaultRpc` | Use interface decoders by default in RPC clients | `true` | -| `interfaces.useUnionTypes` | Generate Any type as union types (TextProposal \| RegisterIncentiveProposal) instead of intersection types (TextProposal & RegisterIncentiveProposal) | `false` | +| `interfaces.useUnionTypes` | Generate Any type as union types (TextProposal \| RegisterIncentiveProposal) instead of intersection types (TextProposal & RegisterIncentiveProposal) | `true` | ### Prototypes Options @@ -563,7 +563,7 @@ telescope({ | `prototypes.addTypeUrlToObjects` | Add typeUrl field to generated Decoders | `true` | | `prototypes.strictNullCheckForPrototypeMethods` | Enable strict null checks for prototype methods | `false` | | `prototypes.paginationDefaultFromPartial` | Set default values for pagination in fromPartial methods | `false` | -| `prototypes.enableRegistryLoader` | Generate Registry loader in *.registry.ts files | `true` | +| `prototypes.enableRegistryLoader` | Generate Registry loader in *.registry.ts files | `false` | | `prototypes.enableMessageComposer` | Generate MessageComposer in *.registry.ts files | `true` | | `prototypes.patch` | Object mapping filenames to an array of `Operation` to be applied as patches to proto files during generation. See [JSON Patch Protos](#json-patch-protos) | `undefined` | @@ -573,12 +573,16 @@ telescope({ | ---------------------------------- | ----------------------------------------------------------------- | ------- | | `prototypes.methods.encode` | Enable `encode` method on proto objects | `true` | | `prototypes.methods.decode` | Enable `decode` method on proto objects | `true` | -| `prototypes.methods.fromJSON` | Enable `fromJSON` method on proto objects | `true` | -| `prototypes.methods.toJSON` | Enable `toJSON` method on proto objects | `true` | +| `prototypes.methods.fromJSON` | Enable `fromJSON` method on proto objects | `false` | +| `prototypes.methods.toJSON` | Enable `toJSON` method on proto objects | `false` | | `prototypes.methods.fromPartial` | Enable `fromPartial` method on proto objects | `true` | | `prototypes.methods.fromSDK` | Enable `fromSDK` method on proto objects | `false` | | `prototypes.methods.toSDK` | Enable `toSDK` method on proto objects | `false` | - +| `prototypes.methods.fromSDKJSON` | boolean to enable `fromSDKJSON` method on proto objects | `false` | +| `prototypes.methods.toAmino` | boolean to enable `toAmino` method on proto objects | `true` | +| `prototypes.methods.fromAmino` | boolean to enable `fromAmino` method on proto objects | `true` | +| `prototypes.methods.toProto` | boolean to enable `toProto` method on proto objects | `true` | +| `prototypes.methods.fromProto` | boolean to enable `fromProto` method on proto objects | `true` | ### Enums Options | option | description | defaults | @@ -590,7 +594,7 @@ telescope({ | option | description | defaults | | ------------------------------ | -------------------------------------------------------------- | ---------- | -| `lcdClients.enabled` | Generate LCD clients that can query proto `Query` messages | `true` | +| `lcdClients.enabled` | Generate LCD clients that can query proto `Query` messages | `false` | | `lcdClients.bundle` | Generate factory bundle aggregate of all LCD Clients | `true` | | `lcdClients.scoped` | Generate factory of scoped LCD Clients | `undefined`| | `lcdClients.scopedIsExclusive` | Allow both scoped bundles and all RPC Clients | `true` | @@ -612,7 +616,7 @@ See [LCD Clients](#lcd-clients) for more info. | option | description | defaults | | ------------------------------ | ---------------------------------------------------------------------- | ----------------------------- | | `rpcClients.type` | Generate this type of RPC client (`tendermint`, `gRPC-web`, `gRPC`)| `tendermint` | -| `rpcClients.enabled` | Generate RPC clients that can interact with proto messages | `true` | +| `rpcClients.enabled` | Generate RPC clients that can interact with proto messages | `false` | | `rpcClients.bundle` | Generate factory bundle aggregate of all RPC Clients | `true` | | `rpcClients.inline` | Inline all RPC client methods into a single file | `false` | | `rpcClients.extensions` | Enable extensions for RPC clients | `true` | @@ -637,8 +641,8 @@ See [RPC Clients](#rpc-clients) for more info. | Option | Description | Defaults | | --------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------- | -| `helperFunctions.enabled` | Enable the generation of helper function files `.func.ts` | `false` | -| `helperFunctions.useGlobalDecoderRegistry` | Use global decoder registry in helper functions | `false` | +| `helperFunctions.enabled` | Enable the generation of helper function files `.func.ts` | `true` | +| `helperFunctions.useGlobalDecoderRegistry` | Use global decoder registry in helper functions | `true` | | `helperFunctions.hooks` | Generates hooks selected alongside helper functions | `{ react: false, vue: false }` | | `helperFunctions.include.serviceTypes`| Specifies which types of services to include (`Query`, `Msg`). `undefined` includes all types. | `undefined` | | `helperFunctions.include.patterns` | Array of glob patterns patterns (e.g., `"**"`, `"cosmos.bank.v1beta1.bala*"`, etc.) to match specific proto services. | `undefined` | @@ -656,8 +660,9 @@ See [Helper Functions Configuration](#helper-functions-configuration) for more i | option | description | defaults | | -------------------------------------------- | -------------------------------------------------------------- | ---------| -| `stargateClients.includeCosmosDefaultTypes` | Include the CosmJS defaults with stargate clients | `true` (except cosmos package) | -| `stargateClients.addGetTxRpc` | Add getSigningTxRpc to clients in namespaces | `false` | +| `stargateClients.enabled` | if true, will include the cosmjs defaults with stargate clients | `false` | +| `stargateClients.includeCosmosDefaultTypes` | if true, will include the cosmjs defaults with stargate clients | `true` (except cosmos package) | +| `stargateClients.addGetTxRpc` | if true, will add getSigningTxRpc to clients in namespaces | `false` | ### State Management @@ -706,10 +711,10 @@ See [Helper Functions Configuration](#helper-functions-configuration) for more i | `prototypes.typingsFormat.customTypes.useEnhancedDecimal` | Use patched decimal instead of decimal from @cosmjs/math | `false` | | `prototypes.typingsFormat.customTypes.base64Lib` | Use endo/base64 methods | `undefined` | | `prototypes.typingsFormat.num64` | 'long' or 'bigint', the way of generating int64 proto types. Set to 'bigint' to use more stable built-in type | `bigint` | -| `prototypes.typingsFormat.useTelescopeGeneratedType` | Discard GeneratedType from CosmJS, use TelescopeGeneratedType instead inside *.registry.ts files | `false` | +| `prototypes.typingsFormat.useTelescopeGeneratedType` | Discard GeneratedType from CosmJS, use TelescopeGeneratedType instead inside *.registry.ts files | `true` | | `prototypes.typingsFormat.useDeepPartial` | Use `DeepPartial` type instead of `Partial` TS type | `false` | | `prototypes.typingsFormat.useExact` | Use the `Exact` TS type | `false` | -| `prototypes.typingsFormat.toJsonUnknown` | Use `any` for `toJSON` methods instead of `JsonSafe` | `true` | +| `prototypes.typingsFormat.toJsonUnknown` | Use `any` for `toJSON` methods instead of `JsonSafe` | `false` | | `prototypes.typingsFormat.timestamp` | Use either `date` or `timestamp` for `Timestamp` proto type | "date" | | `prototypes.typingsFormat.duration` | Use either `duration` or `string` for `Duration` proto type | "duration"| | `prototypes.typingsFormat.updatedDuration` | temporary field to avoid breaking changes | `false` | @@ -721,6 +726,9 @@ See [Helper Functions Configuration](#helper-functions-configuration) for more i | option | description | defaults | | ----------------------------------------- | -------------------------------------------------------------- | --------- | +| `prototypes.parser.keepCase` | passes `keepCase` to protobuf `parse()` to keep original casing | `false` | +| `prototypes.parser.alternateCommentMode` | passes `alternateCommentMode` to protobuf `parse()` method | `true` | +| `prototypes.parser.preferTrailingComment` | passes `preferTrailingComment` to protobuf `parse()` method | `false` | | `prototypes.parser.keepCase` | Pass `keepCase` to protobuf `parse()` to keep original casing | `true` | | `prototypes.parser.alternateCommentMode` | Pass `alternateCommentMode` to protobuf `parse()` method | `true` | | `prototypes.parser.preferTrailingComment` | Pass `preferTrailingComment` to protobuf `parse()` method | `false` | @@ -766,6 +774,13 @@ See [MCP Integration](https://docs.hyperweb.io/telescope/developing/mcp-integrat | option | description | defaults | | ------------------------------ | ----------------------------------------------------------------- | ---------- | +| `env` | 'default' or 'v-next', set to 'v-next' to enable yet to release features | `v-next` | +| `useInterchainJs` | use interchain.js features | `true` | +| `removeUnusedImports` | removes unused imports | `true` | +| `classesUseArrowFunctions` | classes use arrow functions instead of `bind()`ing in constructors | `false` | +| `useSDKTypes` | use SDK types | `true` | +| `includeExternalHelpers` | exports a few helpers functions in `extern.ts` | `false` | +| `restoreImportExtension` | restore extensions of imported paths. e.g: '.js'. null means no ext | `null` | | `env` | 'default' or 'v-next', set to 'v-next' to enable yet-to-be-released features | `default` | | `removeUnusedImports` | Remove unused imports | `true` | | `classesUseArrowFunctions` | Classes use arrow functions instead of `bind()`ing in constructors | `false` | diff --git a/__fixtures__/misc/enforce-null-check-true/extern.ts b/__fixtures__/misc/enforce-null-check-true/extern.ts index c3e7cbcac8..83d6864ae2 100644 --- a/__fixtures__/misc/enforce-null-check-true/extern.ts +++ b/__fixtures__/misc/enforce-null-check-true/extern.ts @@ -4,30 +4,45 @@ * and run the transpile command or npm scripts command that is used to regenerate this bundle. */ -import { QueryClient, createProtobufRpcClient, ProtobufRpcClient } from '@cosmjs/stargate' -import { Tendermint34Client, HttpEndpoint } from "@cosmjs/tendermint-rpc"; -const _rpcClients: Record = {}; +import { HttpEndpoint } from "@interchainjs/types"; +import { Rpc } from "./helpers"; +import { ClientOptions, createCosmosQueryClient } from "@interchainjs/cosmos"; + +const _rpcClients: Record = {}; export const getRpcEndpointKey = (rpcEndpoint: string | HttpEndpoint) => { - if (typeof rpcEndpoint === 'string') { - return rpcEndpoint; - } else if (!!rpcEndpoint) { - //@ts-ignore - return rpcEndpoint.url; - } + if (typeof rpcEndpoint === 'string') { + return rpcEndpoint; + } else if (!!rpcEndpoint) { + //@ts-ignore + return rpcEndpoint.url; + } } export const getRpcClient = async (rpcEndpoint: string | HttpEndpoint) => { - const key = getRpcEndpointKey(rpcEndpoint); - if (!key) return; - if (_rpcClients.hasOwnProperty(key)) { - return _rpcClients[key]; - } - const tmClient = await Tendermint34Client.connect(rpcEndpoint); - //@ts-ignore - const client = new QueryClient(tmClient); - const rpc = createProtobufRpcClient(client); - _rpcClients[key] = rpc; - return rpc; + const key = getRpcEndpointKey(rpcEndpoint); + if (!key) return; + if (_rpcClients.hasOwnProperty(key)) { + return _rpcClients[key]; + } + const rpc = await createRpcClient(rpcEndpoint); + _rpcClients[key] = rpc; + return rpc; +} + +export const createRpcClient = async (rpcEndpoint: string | HttpEndpoint, + options?: ClientOptions +) => { + if (typeof rpcEndpoint === 'string') { + return createCosmosQueryClient(rpcEndpoint, options); + } else { + const endpointStr = rpcEndpoint.url; + const clientOptions = { + ...options, + headers: rpcEndpoint.headers + }; + + return createCosmosQueryClient(endpointStr, clientOptions); + } } diff --git a/__fixtures__/misc/enforce-null-check-true/gogoproto/bundle.ts b/__fixtures__/misc/enforce-null-check-true/gogoproto/bundle.ts index 33a6fc1b62..2c41b17a85 100644 --- a/__fixtures__/misc/enforce-null-check-true/gogoproto/bundle.ts +++ b/__fixtures__/misc/enforce-null-check-true/gogoproto/bundle.ts @@ -1,4 +1,4 @@ -import * as _100 from "./gogo"; +import * as _108 from "./gogo"; export const gogoproto = { - ..._100 + ..._108 }; \ No newline at end of file diff --git a/__fixtures__/misc/enforce-null-check-true/google/bundle.ts b/__fixtures__/misc/enforce-null-check-true/google/bundle.ts index ff2d148eb1..95ce4b173e 100644 --- a/__fixtures__/misc/enforce-null-check-true/google/bundle.ts +++ b/__fixtures__/misc/enforce-null-check-true/google/bundle.ts @@ -1,20 +1,20 @@ -import * as _101 from "./api/expr/v1alpha1/eval"; -import * as _102 from "./protobuf/any"; -import * as _103 from "./protobuf/descriptor"; -import * as _104 from "./protobuf/duration"; -import * as _105 from "./protobuf/timestamp"; +import * as _109 from "./api/expr/v1alpha1/eval"; +import * as _110 from "./protobuf/any"; +import * as _111 from "./protobuf/descriptor"; +import * as _112 from "./protobuf/duration"; +import * as _113 from "./protobuf/timestamp"; export namespace google { export namespace api { export namespace expr { export const v1alpha1 = { - ..._101 + ..._109 }; } } export const protobuf = { - ..._102, - ..._103, - ..._104, - ..._105 + ..._110, + ..._111, + ..._112, + ..._113 }; } \ No newline at end of file diff --git a/__fixtures__/misc/enforce-null-check-true/helper-func-types.ts b/__fixtures__/misc/enforce-null-check-true/helper-func-types.ts new file mode 100644 index 0000000000..5f9d7a87a0 --- /dev/null +++ b/__fixtures__/misc/enforce-null-check-true/helper-func-types.ts @@ -0,0 +1,92 @@ +/** +* This file and any referenced files were automatically generated by @hyperweb/telescope@latest +* DO NOT MODIFY BY HAND. Instead, download the latest proto files for your chain +* and run the transpile command or npm scripts command that is used to regenerate this bundle. +*/ + + +import { HttpEndpoint } from "@interchainjs/types"; +import { BinaryReader, BinaryWriter } from "./binary"; +import { getRpcClient } from "./extern"; +import { isRpc, Rpc } from "./helpers"; +import { TelescopeGeneratedCodec, DeliverTxResponse, Message, StdFee } from "./types"; +import { toConverters, toEncoders } from "@interchainjs/cosmos/utils"; +import { ISigningClient } from "@interchainjs/cosmos/types/signing-client"; + +export interface QueryBuilderOptions { + encode: (request: TReq, writer?: BinaryWriter) => BinaryWriter + decode: (input: BinaryReader | Uint8Array, length?: number) => TRes + service: string, + method: string, +} + +export function buildQuery(opts: QueryBuilderOptions) { + return async (client: EndpointOrRpc, request: TReq) => { + let rpc: Rpc | undefined; + + if(isRpc(client)) { + rpc = client; + } else { + rpc = client ? await getRpcClient(client) : undefined; + } + + if (!rpc) throw new Error("Query Rpc is not initialized"); + + const data = opts.encode(request).finish(); + const response = await rpc.request(opts.service, opts.method, data); + return opts.decode(response); + }; +} + +export interface ITxArgs { + signerAddress: string; + message: TMsg | TMsg[]; + fee: StdFee | 'auto'; + memo: string; +} + +export interface TxBuilderOptions { + msg: TelescopeGeneratedCodec +} + +export function buildTx(opts: TxBuilderOptions) { + return async ( + client: ISigningClient, + signerAddress: string, + message: TMsg | TMsg[], + fee: StdFee | 'auto', + memo: string + ): Promise => { + if (!client) throw new Error("SigningClient is not initialized"); + + //register all related encoders and converters + client.addEncoders?.(toEncoders(opts.msg)); + client.addConverters?.(toConverters(opts.msg)); + + const data = Array.isArray(message) + ? message.map(msg => ({ + typeUrl: opts.msg.typeUrl, + value: msg, + })) + : [{ + typeUrl: opts.msg.typeUrl, + value: message, + }]; + return client.signAndBroadcast!(signerAddress, data, fee, memo); + }; +} + +export interface Encoder { + typeUrl: string; + fromPartial: (data: any) => any; + encode: (data: any) => Uint8Array; +} + +export interface AminoConverter { + typeUrl: string; + aminoType: string; + fromAmino: (data: any) => any; + toAmino: (data: any) => any; +} + +export type EndpointOrRpc = string | HttpEndpoint | Rpc ; diff --git a/__fixtures__/misc/enforce-null-check-true/index.ts b/__fixtures__/misc/enforce-null-check-true/index.ts index d589dcd349..6b7006730a 100644 --- a/__fixtures__/misc/enforce-null-check-true/index.ts +++ b/__fixtures__/misc/enforce-null-check-true/index.ts @@ -8,10 +8,12 @@ export * from "./gogoproto/bundle"; export * from "./google/bundle"; export * from "./misc/bundle"; export * from "./extern"; +export * from "./helper-func-types"; export * from "./react-query"; export * from "./mobx"; export * from "./pinia-endpoint"; export * from "./json-safe"; export * from "./varint"; export * from "./utf8"; -export * from "./binary"; \ No newline at end of file +export * from "./binary"; +export * from "./types"; \ No newline at end of file diff --git a/__fixtures__/misc/enforce-null-check-true/misc/all_fields.ts b/__fixtures__/misc/enforce-null-check-true/misc/all_fields.ts index d5437c6d62..0dab38aa5d 100644 --- a/__fixtures__/misc/enforce-null-check-true/misc/all_fields.ts +++ b/__fixtures__/misc/enforce-null-check-true/misc/all_fields.ts @@ -4,7 +4,7 @@ import { Duration, DurationSDKType } from "../google/protobuf/duration"; import { Timestamp, TimestampSDKType } from "../google/protobuf/timestamp"; import { BinaryReader, BinaryWriter } from "../binary"; import { toTimestamp, fromTimestamp, isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../helpers"; -import { Decimal } from "@cosmjs/math"; +import { Decimal } from "@interchainjs/math"; import { JsonSafe } from "../json-safe"; export const protobufPackage = "misc"; /** diff --git a/__fixtures__/misc/enforce-null-check-true/misc/bundle.ts b/__fixtures__/misc/enforce-null-check-true/misc/bundle.ts index 403a3aaf01..8a3738b9fc 100644 --- a/__fixtures__/misc/enforce-null-check-true/misc/bundle.ts +++ b/__fixtures__/misc/enforce-null-check-true/misc/bundle.ts @@ -1,16 +1,18 @@ -import * as _106 from "./all_fields"; -import * as _107 from "./eval_request"; -import * as _108 from "./nest"; -import * as _109 from "./tx"; -import * as _110 from "./tx.rpc.msg"; -import * as _111 from "./rpc.tx"; +import * as _114 from "./all_fields"; +import * as _115 from "./eval_request"; +import * as _116 from "./nest"; +import * as _117 from "./tx"; +import * as _118 from "./tx.rpc.func"; +import * as _119 from "./tx.rpc.msg"; +import * as _120 from "./rpc.tx"; export const misc = { - ..._106, - ..._107, - ..._108, - ..._109, - ..._110, + ..._114, + ..._115, + ..._116, + ..._117, + ..._118, + ..._119, ClientFactory: { - ..._111 + ..._120 } }; \ No newline at end of file diff --git a/__fixtures__/misc/enforce-null-check-true/misc/tx.rpc.func.ts b/__fixtures__/misc/enforce-null-check-true/misc/tx.rpc.func.ts new file mode 100644 index 0000000000..e3a3906134 --- /dev/null +++ b/__fixtures__/misc/enforce-null-check-true/misc/tx.rpc.func.ts @@ -0,0 +1,12 @@ +import { EncodingTestForDontOmit, EncodingTestForDontOmitSDKType, EncodingTestForOmit, EncodingTestForOmitSDKType } from "./all_fields"; +import { buildTx } from "../helper-func-types"; +import { InputMsg, InputMsgSDKType, MsgResponse, MsgResponseSDKType } from "./tx"; +/** + * test tx + * @name sendMsg + * @package misc + * @see proto service: misc.SendMsg + */ +export const sendMsg = buildTx({ + msg: InputMsg +}); \ No newline at end of file diff --git a/__fixtures__/misc/enforce-null-check-true/misc/tx.rpc.msg.ts b/__fixtures__/misc/enforce-null-check-true/misc/tx.rpc.msg.ts index 6d03a2bcb5..c4e3a250fa 100644 --- a/__fixtures__/misc/enforce-null-check-true/misc/tx.rpc.msg.ts +++ b/__fixtures__/misc/enforce-null-check-true/misc/tx.rpc.msg.ts @@ -1,5 +1,5 @@ import { EncodingTestForDontOmit, EncodingTestForDontOmitSDKType, EncodingTestForOmit, EncodingTestForOmitSDKType } from "./all_fields"; -import { Rpc } from "../helpers"; +import { TxRpc } from "../types"; import { BinaryReader } from "../binary"; import { InputMsg, InputMsgSDKType, MsgResponse, MsgResponseSDKType } from "./tx"; export interface Msg { @@ -7,8 +7,8 @@ export interface Msg { sendMsg(request: InputMsg): Promise; } export class MsgClientImpl implements Msg { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.sendMsg = this.sendMsg.bind(this); } @@ -18,6 +18,6 @@ export class MsgClientImpl implements Msg { return promise.then(data => MsgResponse.decode(new BinaryReader(data))); } } -export const createClientImpl = (rpc: Rpc) => { +export const createClientImpl = (rpc: TxRpc) => { return new MsgClientImpl(rpc); }; \ No newline at end of file diff --git a/__fixtures__/misc/enforce-null-check-true/types.ts b/__fixtures__/misc/enforce-null-check-true/types.ts new file mode 100644 index 0000000000..1acee677e2 --- /dev/null +++ b/__fixtures__/misc/enforce-null-check-true/types.ts @@ -0,0 +1,109 @@ +/** +* This file and any referenced files were automatically generated by @hyperweb/telescope@latest +* DO NOT MODIFY BY HAND. Instead, download the latest proto files for your chain +* and run the transpile command or npm scripts command that is used to regenerate this bundle. +*/ + +import { IBinaryReader, IBinaryWriter } from "./binary"; +import { Any } from "./google/protobuf/any"; + +import { HttpEndpoint } from "@interchainjs/types"; + + +import { DeliverTxResponse, Event, Attribute } from "@interchainjs/types"; + +export { DeliverTxResponse } + + +export type ProtoMsg = Omit & { typeUrl: any }; + +export interface IAminoMsg { + type: any; + value: Amino; +} + +export interface IProtoType { + $typeUrl?: any; +} + +/** + * A type generated by Telescope 1.0. + */ +export interface TelescopeGeneratedCodec< + T = unknown, + SDK = unknown, + Amino = unknown +> { + readonly typeUrl: string; + readonly aminoType?: string; + is?(o: unknown): o is T; + isSDK?(o: unknown): o is SDK; + isAmino?(o: unknown): o is Amino; + encode: (message: T, writer?: IBinaryWriter | any) => IBinaryWriter | any; + decode: (input: IBinaryReader | Uint8Array | any, length?: number) => T; + fromPartial: (object: any) => T | any; + fromJSON?: (object: any) => T | any; + toJSON?: (message: T | any) => any; + fromSDK?: (sdk: SDK) => T; + fromSDKJSON?: (object: any) => SDK; + toSDK?: (message: T) => SDK; + fromAmino?: (amino: Amino) => T; + toAmino?: (message: T) => Amino; + fromAminoMsg?: (aminoMsg: IAminoMsg) => T; + toAminoMsg?: (message: T) => IAminoMsg; + toProto?: (message: T) => Uint8Array; + fromProtoMsg?: (message: ProtoMsg) => T; + toProtoMsg?: (message: T) => Any; + registerTypeUrl?: () => void; +} + +export type TelescopeGeneratedType< + T = unknown, + SDK = unknown, + Amino = unknown +> = TelescopeGeneratedCodec; + +export type GeneratedType = TelescopeGeneratedCodec; + +/** + * Coin defines a token with a denomination and an amount. + * + * NOTE: The amount field is an Int which implements the custom method + * signatures required by gogoproto. + */ +interface Coin { + denom: string; + amount: string; +} + +export type EncodeObject = Message; + +export interface Message { + typeUrl: string; + value: T; +} + +export interface StdFee { + amount: Coin[]; + gas: string; + /** The granter address that is used for paying with feegrants */ + granter?: string; + /** The fee payer address. The payer must have signed the transaction. */ + payer?: string; +} + + +export interface TxRpc { + request( + service: string, + method: string, + data: Uint8Array + ): Promise; + signAndBroadcast?( + signerAddress: string, + messages: EncodeObject[], + fee: StdFee | "auto" | number, + memo: string + ): Promise; +} + diff --git a/__fixtures__/misc/output-base64/extern.ts b/__fixtures__/misc/output-base64/extern.ts index c3e7cbcac8..83d6864ae2 100644 --- a/__fixtures__/misc/output-base64/extern.ts +++ b/__fixtures__/misc/output-base64/extern.ts @@ -4,30 +4,45 @@ * and run the transpile command or npm scripts command that is used to regenerate this bundle. */ -import { QueryClient, createProtobufRpcClient, ProtobufRpcClient } from '@cosmjs/stargate' -import { Tendermint34Client, HttpEndpoint } from "@cosmjs/tendermint-rpc"; -const _rpcClients: Record = {}; +import { HttpEndpoint } from "@interchainjs/types"; +import { Rpc } from "./helpers"; +import { ClientOptions, createCosmosQueryClient } from "@interchainjs/cosmos"; + +const _rpcClients: Record = {}; export const getRpcEndpointKey = (rpcEndpoint: string | HttpEndpoint) => { - if (typeof rpcEndpoint === 'string') { - return rpcEndpoint; - } else if (!!rpcEndpoint) { - //@ts-ignore - return rpcEndpoint.url; - } + if (typeof rpcEndpoint === 'string') { + return rpcEndpoint; + } else if (!!rpcEndpoint) { + //@ts-ignore + return rpcEndpoint.url; + } } export const getRpcClient = async (rpcEndpoint: string | HttpEndpoint) => { - const key = getRpcEndpointKey(rpcEndpoint); - if (!key) return; - if (_rpcClients.hasOwnProperty(key)) { - return _rpcClients[key]; - } - const tmClient = await Tendermint34Client.connect(rpcEndpoint); - //@ts-ignore - const client = new QueryClient(tmClient); - const rpc = createProtobufRpcClient(client); - _rpcClients[key] = rpc; - return rpc; + const key = getRpcEndpointKey(rpcEndpoint); + if (!key) return; + if (_rpcClients.hasOwnProperty(key)) { + return _rpcClients[key]; + } + const rpc = await createRpcClient(rpcEndpoint); + _rpcClients[key] = rpc; + return rpc; +} + +export const createRpcClient = async (rpcEndpoint: string | HttpEndpoint, + options?: ClientOptions +) => { + if (typeof rpcEndpoint === 'string') { + return createCosmosQueryClient(rpcEndpoint, options); + } else { + const endpointStr = rpcEndpoint.url; + const clientOptions = { + ...options, + headers: rpcEndpoint.headers + }; + + return createCosmosQueryClient(endpointStr, clientOptions); + } } diff --git a/__fixtures__/misc/output-base64/gogoproto/bundle.ts b/__fixtures__/misc/output-base64/gogoproto/bundle.ts index 3da5fd950f..037ba905a4 100644 --- a/__fixtures__/misc/output-base64/gogoproto/bundle.ts +++ b/__fixtures__/misc/output-base64/gogoproto/bundle.ts @@ -1,4 +1,4 @@ -import * as _208 from "./gogo"; +import * as _224 from "./gogo"; export const gogoproto = { - ..._208 + ..._224 }; \ No newline at end of file diff --git a/__fixtures__/misc/output-base64/google/bundle.ts b/__fixtures__/misc/output-base64/google/bundle.ts index 7aef09762c..1f23c764cd 100644 --- a/__fixtures__/misc/output-base64/google/bundle.ts +++ b/__fixtures__/misc/output-base64/google/bundle.ts @@ -1,20 +1,20 @@ -import * as _209 from "./api/expr/v1alpha1/eval"; -import * as _210 from "./protobuf/any"; -import * as _211 from "./protobuf/descriptor"; -import * as _212 from "./protobuf/duration"; -import * as _213 from "./protobuf/timestamp"; +import * as _225 from "./api/expr/v1alpha1/eval"; +import * as _226 from "./protobuf/any"; +import * as _227 from "./protobuf/descriptor"; +import * as _228 from "./protobuf/duration"; +import * as _229 from "./protobuf/timestamp"; export namespace google { export namespace api { export namespace expr { export const v1alpha1 = { - ..._209 + ..._225 }; } } export const protobuf = { - ..._210, - ..._211, - ..._212, - ..._213 + ..._226, + ..._227, + ..._228, + ..._229 }; } \ No newline at end of file diff --git a/__fixtures__/misc/output-base64/helper-func-types.ts b/__fixtures__/misc/output-base64/helper-func-types.ts new file mode 100644 index 0000000000..5f9d7a87a0 --- /dev/null +++ b/__fixtures__/misc/output-base64/helper-func-types.ts @@ -0,0 +1,92 @@ +/** +* This file and any referenced files were automatically generated by @hyperweb/telescope@latest +* DO NOT MODIFY BY HAND. Instead, download the latest proto files for your chain +* and run the transpile command or npm scripts command that is used to regenerate this bundle. +*/ + + +import { HttpEndpoint } from "@interchainjs/types"; +import { BinaryReader, BinaryWriter } from "./binary"; +import { getRpcClient } from "./extern"; +import { isRpc, Rpc } from "./helpers"; +import { TelescopeGeneratedCodec, DeliverTxResponse, Message, StdFee } from "./types"; +import { toConverters, toEncoders } from "@interchainjs/cosmos/utils"; +import { ISigningClient } from "@interchainjs/cosmos/types/signing-client"; + +export interface QueryBuilderOptions { + encode: (request: TReq, writer?: BinaryWriter) => BinaryWriter + decode: (input: BinaryReader | Uint8Array, length?: number) => TRes + service: string, + method: string, +} + +export function buildQuery(opts: QueryBuilderOptions) { + return async (client: EndpointOrRpc, request: TReq) => { + let rpc: Rpc | undefined; + + if(isRpc(client)) { + rpc = client; + } else { + rpc = client ? await getRpcClient(client) : undefined; + } + + if (!rpc) throw new Error("Query Rpc is not initialized"); + + const data = opts.encode(request).finish(); + const response = await rpc.request(opts.service, opts.method, data); + return opts.decode(response); + }; +} + +export interface ITxArgs { + signerAddress: string; + message: TMsg | TMsg[]; + fee: StdFee | 'auto'; + memo: string; +} + +export interface TxBuilderOptions { + msg: TelescopeGeneratedCodec +} + +export function buildTx(opts: TxBuilderOptions) { + return async ( + client: ISigningClient, + signerAddress: string, + message: TMsg | TMsg[], + fee: StdFee | 'auto', + memo: string + ): Promise => { + if (!client) throw new Error("SigningClient is not initialized"); + + //register all related encoders and converters + client.addEncoders?.(toEncoders(opts.msg)); + client.addConverters?.(toConverters(opts.msg)); + + const data = Array.isArray(message) + ? message.map(msg => ({ + typeUrl: opts.msg.typeUrl, + value: msg, + })) + : [{ + typeUrl: opts.msg.typeUrl, + value: message, + }]; + return client.signAndBroadcast!(signerAddress, data, fee, memo); + }; +} + +export interface Encoder { + typeUrl: string; + fromPartial: (data: any) => any; + encode: (data: any) => Uint8Array; +} + +export interface AminoConverter { + typeUrl: string; + aminoType: string; + fromAmino: (data: any) => any; + toAmino: (data: any) => any; +} + +export type EndpointOrRpc = string | HttpEndpoint | Rpc ; diff --git a/__fixtures__/misc/output-base64/index.ts b/__fixtures__/misc/output-base64/index.ts index 63239ebbce..f6bcc0cdc2 100644 --- a/__fixtures__/misc/output-base64/index.ts +++ b/__fixtures__/misc/output-base64/index.ts @@ -9,10 +9,12 @@ export * from "./google/bundle"; export * from "./misc/bundle"; export * from "./misc/client"; export * from "./extern"; +export * from "./helper-func-types"; export * from "./react-query"; export * from "./mobx"; export * from "./pinia-endpoint"; export * from "./json-safe"; export * from "./varint"; export * from "./utf8"; -export * from "./binary"; \ No newline at end of file +export * from "./binary"; +export * from "./types"; \ No newline at end of file diff --git a/__fixtures__/misc/output-base64/misc/all_fields.ts b/__fixtures__/misc/output-base64/misc/all_fields.ts index fc6de76cc5..e856336536 100644 --- a/__fixtures__/misc/output-base64/misc/all_fields.ts +++ b/__fixtures__/misc/output-base64/misc/all_fields.ts @@ -4,12 +4,12 @@ import { Duration, DurationAmino, DurationSDKType } from "../google/protobuf/dur import { Timestamp, TimestampAmino, TimestampSDKType } from "../google/protobuf/timestamp"; import { BinaryReader, BinaryWriter } from "../binary"; import { toTimestamp, fromTimestamp, isSet, DeepPartial } from "../helpers"; -import { Decimal } from "@cosmjs/math"; +import { Decimal } from "@interchainjs/math"; import { decodeBase64 as bytesFromBase64 } from "@endo/base64"; import { encodeBase64 as base64FromBytes } from "@endo/base64"; import { JsonSafe } from "../json-safe"; -import { toUtf8, fromBase64, fromUtf8, toBase64 } from "@cosmjs/encoding"; -import { encodePubkey, decodePubkey } from "@cosmjs/proto-signing"; +import { toUtf8, fromBase64, fromUtf8, toBase64 } from "@interchainjs/encoding"; +import { encodePubkey, decodePubkey } from "@interchainjs/pubkey"; export const protobufPackage = "misc"; /** * @name EncodingTestForDontOmit @@ -1757,15 +1757,15 @@ export const EncodingTestForDontOmit = { } else { obj.d_o_auths = message.dOAuths; } - obj.dec = message.dec === "" ? undefined : message.dec; - obj.d_o_dec = message.dODec ?? ""; + obj.dec = message.dec === "" ? undefined : Decimal.fromUserInput(message.dec, 18).atomics; + obj.d_o_dec = Decimal.fromUserInput(message.dODec, 18).atomics ?? ""; if (message.decs) { - obj.decs = message.decs.map(e => e); + obj.decs = message.decs.map(e => Decimal.fromUserInput(e, 18).atomics); } else { obj.decs = message.decs; } if (message.dODecs) { - obj.d_o_decs = message.dODecs.map(e => e); + obj.d_o_decs = message.dODecs.map(e => Decimal.fromUserInput(e, 18).atomics); } else { obj.d_o_decs = message.dODecs; } @@ -2923,15 +2923,15 @@ export const EncodingTestForOmit = { } else { obj.o_auths = message.oAuths; } - obj.dec = message.dec ?? ""; - obj.o_dec = message.oDec === "" ? undefined : message.oDec; + obj.dec = Decimal.fromUserInput(message.dec, 18).atomics ?? ""; + obj.o_dec = message.oDec === "" ? undefined : Decimal.fromUserInput(message.oDec, 18).atomics; if (message.decs) { - obj.decs = message.decs.map(e => e); + obj.decs = message.decs.map(e => Decimal.fromUserInput(e, 18).atomics); } else { obj.decs = message.decs; } if (message.oDecs) { - obj.o_decs = message.oDecs.map(e => e); + obj.o_decs = message.oDecs.map(e => Decimal.fromUserInput(e, 18).atomics); } else { obj.o_decs = message.oDecs; } diff --git a/__fixtures__/misc/output-base64/misc/bundle.ts b/__fixtures__/misc/output-base64/misc/bundle.ts index 9eb884b8a1..22c5f481e3 100644 --- a/__fixtures__/misc/output-base64/misc/bundle.ts +++ b/__fixtures__/misc/output-base64/misc/bundle.ts @@ -1,20 +1,22 @@ -import * as _214 from "./all_fields"; -import * as _215 from "./eval_request"; -import * as _216 from "./nest"; -import * as _217 from "./tx"; -import * as _218 from "./tx.amino"; -import * as _219 from "./tx.registry"; -import * as _220 from "./tx.rpc.msg"; -import * as _221 from "./rpc.tx"; +import * as _230 from "./all_fields"; +import * as _231 from "./eval_request"; +import * as _232 from "./nest"; +import * as _233 from "./tx"; +import * as _234 from "./tx.amino"; +import * as _235 from "./tx.registry"; +import * as _236 from "./tx.rpc.func"; +import * as _237 from "./tx.rpc.msg"; +import * as _238 from "./rpc.tx"; export const misc = { - ..._214, - ..._215, - ..._216, - ..._217, - ..._218, - ..._219, - ..._220, + ..._230, + ..._231, + ..._232, + ..._233, + ..._234, + ..._235, + ..._236, + ..._237, ClientFactory: { - ..._221 + ..._238 } }; \ No newline at end of file diff --git a/__fixtures__/misc/output-base64/misc/tx.registry.ts b/__fixtures__/misc/output-base64/misc/tx.registry.ts index 1d15c5745c..9ee2c16c01 100644 --- a/__fixtures__/misc/output-base64/misc/tx.registry.ts +++ b/__fixtures__/misc/output-base64/misc/tx.registry.ts @@ -1,12 +1,7 @@ import { EncodingTestForDontOmit, EncodingTestForDontOmitSDKType, EncodingTestForOmit, EncodingTestForOmitSDKType } from "./all_fields"; -import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { TelescopeGeneratedType } from "../types"; import { InputMsg, InputMsgSDKType } from "./tx"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/misc.InputMsg", InputMsg]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/misc.InputMsg", InputMsg]]; export const MessageComposer = { encoded: { sendMsg(value: InputMsg) { diff --git a/__fixtures__/misc/output-base64/misc/tx.rpc.func.ts b/__fixtures__/misc/output-base64/misc/tx.rpc.func.ts new file mode 100644 index 0000000000..e3a3906134 --- /dev/null +++ b/__fixtures__/misc/output-base64/misc/tx.rpc.func.ts @@ -0,0 +1,12 @@ +import { EncodingTestForDontOmit, EncodingTestForDontOmitSDKType, EncodingTestForOmit, EncodingTestForOmitSDKType } from "./all_fields"; +import { buildTx } from "../helper-func-types"; +import { InputMsg, InputMsgSDKType, MsgResponse, MsgResponseSDKType } from "./tx"; +/** + * test tx + * @name sendMsg + * @package misc + * @see proto service: misc.SendMsg + */ +export const sendMsg = buildTx({ + msg: InputMsg +}); \ No newline at end of file diff --git a/__fixtures__/misc/output-base64/misc/tx.rpc.msg.ts b/__fixtures__/misc/output-base64/misc/tx.rpc.msg.ts index 6d03a2bcb5..c4e3a250fa 100644 --- a/__fixtures__/misc/output-base64/misc/tx.rpc.msg.ts +++ b/__fixtures__/misc/output-base64/misc/tx.rpc.msg.ts @@ -1,5 +1,5 @@ import { EncodingTestForDontOmit, EncodingTestForDontOmitSDKType, EncodingTestForOmit, EncodingTestForOmitSDKType } from "./all_fields"; -import { Rpc } from "../helpers"; +import { TxRpc } from "../types"; import { BinaryReader } from "../binary"; import { InputMsg, InputMsgSDKType, MsgResponse, MsgResponseSDKType } from "./tx"; export interface Msg { @@ -7,8 +7,8 @@ export interface Msg { sendMsg(request: InputMsg): Promise; } export class MsgClientImpl implements Msg { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.sendMsg = this.sendMsg.bind(this); } @@ -18,6 +18,6 @@ export class MsgClientImpl implements Msg { return promise.then(data => MsgResponse.decode(new BinaryReader(data))); } } -export const createClientImpl = (rpc: Rpc) => { +export const createClientImpl = (rpc: TxRpc) => { return new MsgClientImpl(rpc); }; \ No newline at end of file diff --git a/__fixtures__/misc/output-base64/types.ts b/__fixtures__/misc/output-base64/types.ts new file mode 100644 index 0000000000..1acee677e2 --- /dev/null +++ b/__fixtures__/misc/output-base64/types.ts @@ -0,0 +1,109 @@ +/** +* This file and any referenced files were automatically generated by @hyperweb/telescope@latest +* DO NOT MODIFY BY HAND. Instead, download the latest proto files for your chain +* and run the transpile command or npm scripts command that is used to regenerate this bundle. +*/ + +import { IBinaryReader, IBinaryWriter } from "./binary"; +import { Any } from "./google/protobuf/any"; + +import { HttpEndpoint } from "@interchainjs/types"; + + +import { DeliverTxResponse, Event, Attribute } from "@interchainjs/types"; + +export { DeliverTxResponse } + + +export type ProtoMsg = Omit & { typeUrl: any }; + +export interface IAminoMsg { + type: any; + value: Amino; +} + +export interface IProtoType { + $typeUrl?: any; +} + +/** + * A type generated by Telescope 1.0. + */ +export interface TelescopeGeneratedCodec< + T = unknown, + SDK = unknown, + Amino = unknown +> { + readonly typeUrl: string; + readonly aminoType?: string; + is?(o: unknown): o is T; + isSDK?(o: unknown): o is SDK; + isAmino?(o: unknown): o is Amino; + encode: (message: T, writer?: IBinaryWriter | any) => IBinaryWriter | any; + decode: (input: IBinaryReader | Uint8Array | any, length?: number) => T; + fromPartial: (object: any) => T | any; + fromJSON?: (object: any) => T | any; + toJSON?: (message: T | any) => any; + fromSDK?: (sdk: SDK) => T; + fromSDKJSON?: (object: any) => SDK; + toSDK?: (message: T) => SDK; + fromAmino?: (amino: Amino) => T; + toAmino?: (message: T) => Amino; + fromAminoMsg?: (aminoMsg: IAminoMsg) => T; + toAminoMsg?: (message: T) => IAminoMsg; + toProto?: (message: T) => Uint8Array; + fromProtoMsg?: (message: ProtoMsg) => T; + toProtoMsg?: (message: T) => Any; + registerTypeUrl?: () => void; +} + +export type TelescopeGeneratedType< + T = unknown, + SDK = unknown, + Amino = unknown +> = TelescopeGeneratedCodec; + +export type GeneratedType = TelescopeGeneratedCodec; + +/** + * Coin defines a token with a denomination and an amount. + * + * NOTE: The amount field is an Int which implements the custom method + * signatures required by gogoproto. + */ +interface Coin { + denom: string; + amount: string; +} + +export type EncodeObject = Message; + +export interface Message { + typeUrl: string; + value: T; +} + +export interface StdFee { + amount: Coin[]; + gas: string; + /** The granter address that is used for paying with feegrants */ + granter?: string; + /** The fee payer address. The payer must have signed the transaction. */ + payer?: string; +} + + +export interface TxRpc { + request( + service: string, + method: string, + data: Uint8Array + ): Promise; + signAndBroadcast?( + signerAddress: string, + messages: EncodeObject[], + fee: StdFee | "auto" | number, + memo: string + ): Promise; +} + diff --git a/__fixtures__/misc/output-decimals/extern.ts b/__fixtures__/misc/output-decimals/extern.ts index c3e7cbcac8..83d6864ae2 100644 --- a/__fixtures__/misc/output-decimals/extern.ts +++ b/__fixtures__/misc/output-decimals/extern.ts @@ -4,30 +4,45 @@ * and run the transpile command or npm scripts command that is used to regenerate this bundle. */ -import { QueryClient, createProtobufRpcClient, ProtobufRpcClient } from '@cosmjs/stargate' -import { Tendermint34Client, HttpEndpoint } from "@cosmjs/tendermint-rpc"; -const _rpcClients: Record = {}; +import { HttpEndpoint } from "@interchainjs/types"; +import { Rpc } from "./helpers"; +import { ClientOptions, createCosmosQueryClient } from "@interchainjs/cosmos"; + +const _rpcClients: Record = {}; export const getRpcEndpointKey = (rpcEndpoint: string | HttpEndpoint) => { - if (typeof rpcEndpoint === 'string') { - return rpcEndpoint; - } else if (!!rpcEndpoint) { - //@ts-ignore - return rpcEndpoint.url; - } + if (typeof rpcEndpoint === 'string') { + return rpcEndpoint; + } else if (!!rpcEndpoint) { + //@ts-ignore + return rpcEndpoint.url; + } } export const getRpcClient = async (rpcEndpoint: string | HttpEndpoint) => { - const key = getRpcEndpointKey(rpcEndpoint); - if (!key) return; - if (_rpcClients.hasOwnProperty(key)) { - return _rpcClients[key]; - } - const tmClient = await Tendermint34Client.connect(rpcEndpoint); - //@ts-ignore - const client = new QueryClient(tmClient); - const rpc = createProtobufRpcClient(client); - _rpcClients[key] = rpc; - return rpc; + const key = getRpcEndpointKey(rpcEndpoint); + if (!key) return; + if (_rpcClients.hasOwnProperty(key)) { + return _rpcClients[key]; + } + const rpc = await createRpcClient(rpcEndpoint); + _rpcClients[key] = rpc; + return rpc; +} + +export const createRpcClient = async (rpcEndpoint: string | HttpEndpoint, + options?: ClientOptions +) => { + if (typeof rpcEndpoint === 'string') { + return createCosmosQueryClient(rpcEndpoint, options); + } else { + const endpointStr = rpcEndpoint.url; + const clientOptions = { + ...options, + headers: rpcEndpoint.headers + }; + + return createCosmosQueryClient(endpointStr, clientOptions); + } } diff --git a/__fixtures__/misc/output-decimals/gogoproto/bundle.ts b/__fixtures__/misc/output-decimals/gogoproto/bundle.ts index 1cc3f0ab5b..5816e5e613 100644 --- a/__fixtures__/misc/output-decimals/gogoproto/bundle.ts +++ b/__fixtures__/misc/output-decimals/gogoproto/bundle.ts @@ -1,4 +1,4 @@ -import * as _194 from "./gogo"; +import * as _209 from "./gogo"; export const gogoproto = { - ..._194 + ..._209 }; \ No newline at end of file diff --git a/__fixtures__/misc/output-decimals/google/bundle.ts b/__fixtures__/misc/output-decimals/google/bundle.ts index 697eb230d0..6f432219cf 100644 --- a/__fixtures__/misc/output-decimals/google/bundle.ts +++ b/__fixtures__/misc/output-decimals/google/bundle.ts @@ -1,20 +1,20 @@ -import * as _195 from "./api/expr/v1alpha1/eval"; -import * as _196 from "./protobuf/any"; -import * as _197 from "./protobuf/descriptor"; -import * as _198 from "./protobuf/duration"; -import * as _199 from "./protobuf/timestamp"; +import * as _210 from "./api/expr/v1alpha1/eval"; +import * as _211 from "./protobuf/any"; +import * as _212 from "./protobuf/descriptor"; +import * as _213 from "./protobuf/duration"; +import * as _214 from "./protobuf/timestamp"; export namespace google { export namespace api { export namespace expr { export const v1alpha1 = { - ..._195 + ..._210 }; } } export const protobuf = { - ..._196, - ..._197, - ..._198, - ..._199 + ..._211, + ..._212, + ..._213, + ..._214 }; } \ No newline at end of file diff --git a/__fixtures__/misc/output-decimals/helper-func-types.ts b/__fixtures__/misc/output-decimals/helper-func-types.ts new file mode 100644 index 0000000000..5f9d7a87a0 --- /dev/null +++ b/__fixtures__/misc/output-decimals/helper-func-types.ts @@ -0,0 +1,92 @@ +/** +* This file and any referenced files were automatically generated by @hyperweb/telescope@latest +* DO NOT MODIFY BY HAND. Instead, download the latest proto files for your chain +* and run the transpile command or npm scripts command that is used to regenerate this bundle. +*/ + + +import { HttpEndpoint } from "@interchainjs/types"; +import { BinaryReader, BinaryWriter } from "./binary"; +import { getRpcClient } from "./extern"; +import { isRpc, Rpc } from "./helpers"; +import { TelescopeGeneratedCodec, DeliverTxResponse, Message, StdFee } from "./types"; +import { toConverters, toEncoders } from "@interchainjs/cosmos/utils"; +import { ISigningClient } from "@interchainjs/cosmos/types/signing-client"; + +export interface QueryBuilderOptions { + encode: (request: TReq, writer?: BinaryWriter) => BinaryWriter + decode: (input: BinaryReader | Uint8Array, length?: number) => TRes + service: string, + method: string, +} + +export function buildQuery(opts: QueryBuilderOptions) { + return async (client: EndpointOrRpc, request: TReq) => { + let rpc: Rpc | undefined; + + if(isRpc(client)) { + rpc = client; + } else { + rpc = client ? await getRpcClient(client) : undefined; + } + + if (!rpc) throw new Error("Query Rpc is not initialized"); + + const data = opts.encode(request).finish(); + const response = await rpc.request(opts.service, opts.method, data); + return opts.decode(response); + }; +} + +export interface ITxArgs { + signerAddress: string; + message: TMsg | TMsg[]; + fee: StdFee | 'auto'; + memo: string; +} + +export interface TxBuilderOptions { + msg: TelescopeGeneratedCodec +} + +export function buildTx(opts: TxBuilderOptions) { + return async ( + client: ISigningClient, + signerAddress: string, + message: TMsg | TMsg[], + fee: StdFee | 'auto', + memo: string + ): Promise => { + if (!client) throw new Error("SigningClient is not initialized"); + + //register all related encoders and converters + client.addEncoders?.(toEncoders(opts.msg)); + client.addConverters?.(toConverters(opts.msg)); + + const data = Array.isArray(message) + ? message.map(msg => ({ + typeUrl: opts.msg.typeUrl, + value: msg, + })) + : [{ + typeUrl: opts.msg.typeUrl, + value: message, + }]; + return client.signAndBroadcast!(signerAddress, data, fee, memo); + }; +} + +export interface Encoder { + typeUrl: string; + fromPartial: (data: any) => any; + encode: (data: any) => Uint8Array; +} + +export interface AminoConverter { + typeUrl: string; + aminoType: string; + fromAmino: (data: any) => any; + toAmino: (data: any) => any; +} + +export type EndpointOrRpc = string | HttpEndpoint | Rpc ; diff --git a/__fixtures__/misc/output-decimals/index.ts b/__fixtures__/misc/output-decimals/index.ts index 9d7d44336e..f5f5f954f1 100644 --- a/__fixtures__/misc/output-decimals/index.ts +++ b/__fixtures__/misc/output-decimals/index.ts @@ -9,6 +9,7 @@ export * from "./google/bundle"; export * from "./misc/bundle"; export * from "./misc/client"; export * from "./extern"; +export * from "./helper-func-types"; export * from "./react-query"; export * from "./mobx"; export * from "./pinia-endpoint"; @@ -16,4 +17,5 @@ export * from "./decimals"; export * from "./json-safe"; export * from "./varint"; export * from "./utf8"; -export * from "./binary"; \ No newline at end of file +export * from "./binary"; +export * from "./types"; \ No newline at end of file diff --git a/__fixtures__/misc/output-decimals/misc/all_fields.ts b/__fixtures__/misc/output-decimals/misc/all_fields.ts index 5a5ff91d6b..5d245f2bca 100644 --- a/__fixtures__/misc/output-decimals/misc/all_fields.ts +++ b/__fixtures__/misc/output-decimals/misc/all_fields.ts @@ -6,8 +6,8 @@ import { BinaryReader, BinaryWriter } from "../binary"; import { toTimestamp, fromTimestamp, isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../helpers"; import { Decimal } from "../decimals"; import { JsonSafe } from "../json-safe"; -import { toUtf8, fromBase64, fromUtf8, toBase64 } from "@cosmjs/encoding"; -import { encodePubkey, decodePubkey } from "@cosmjs/proto-signing"; +import { toUtf8, fromBase64, fromUtf8, toBase64 } from "@interchainjs/encoding"; +import { encodePubkey, decodePubkey } from "@interchainjs/pubkey"; export const protobufPackage = "misc"; /** * @name EncodingTestForDontOmit @@ -1755,15 +1755,15 @@ export const EncodingTestForDontOmit = { } else { obj.d_o_auths = message.dOAuths; } - obj.dec = message.dec === "" ? undefined : message.dec; - obj.d_o_dec = message.dODec ?? ""; + obj.dec = message.dec === "" ? undefined : Decimal.fromUserInput(message.dec, 18).atomics; + obj.d_o_dec = Decimal.fromUserInput(message.dODec, 18).atomics ?? ""; if (message.decs) { - obj.decs = message.decs.map(e => e); + obj.decs = message.decs.map(e => Decimal.fromUserInput(e, 18).atomics); } else { obj.decs = message.decs; } if (message.dODecs) { - obj.d_o_decs = message.dODecs.map(e => e); + obj.d_o_decs = message.dODecs.map(e => Decimal.fromUserInput(e, 18).atomics); } else { obj.d_o_decs = message.dODecs; } @@ -2921,15 +2921,15 @@ export const EncodingTestForOmit = { } else { obj.o_auths = message.oAuths; } - obj.dec = message.dec ?? ""; - obj.o_dec = message.oDec === "" ? undefined : message.oDec; + obj.dec = Decimal.fromUserInput(message.dec, 18).atomics ?? ""; + obj.o_dec = message.oDec === "" ? undefined : Decimal.fromUserInput(message.oDec, 18).atomics; if (message.decs) { - obj.decs = message.decs.map(e => e); + obj.decs = message.decs.map(e => Decimal.fromUserInput(e, 18).atomics); } else { obj.decs = message.decs; } if (message.oDecs) { - obj.o_decs = message.oDecs.map(e => e); + obj.o_decs = message.oDecs.map(e => Decimal.fromUserInput(e, 18).atomics); } else { obj.o_decs = message.oDecs; } diff --git a/__fixtures__/misc/output-decimals/misc/bundle.ts b/__fixtures__/misc/output-decimals/misc/bundle.ts index 0e84d14738..7ff27151c2 100644 --- a/__fixtures__/misc/output-decimals/misc/bundle.ts +++ b/__fixtures__/misc/output-decimals/misc/bundle.ts @@ -1,20 +1,22 @@ -import * as _200 from "./all_fields"; -import * as _201 from "./eval_request"; -import * as _202 from "./nest"; -import * as _203 from "./tx"; -import * as _204 from "./tx.amino"; -import * as _205 from "./tx.registry"; -import * as _206 from "./tx.rpc.msg"; -import * as _207 from "./rpc.tx"; +import * as _215 from "./all_fields"; +import * as _216 from "./eval_request"; +import * as _217 from "./nest"; +import * as _218 from "./tx"; +import * as _219 from "./tx.amino"; +import * as _220 from "./tx.registry"; +import * as _221 from "./tx.rpc.func"; +import * as _222 from "./tx.rpc.msg"; +import * as _223 from "./rpc.tx"; export const misc = { - ..._200, - ..._201, - ..._202, - ..._203, - ..._204, - ..._205, - ..._206, + ..._215, + ..._216, + ..._217, + ..._218, + ..._219, + ..._220, + ..._221, + ..._222, ClientFactory: { - ..._207 + ..._223 } }; \ No newline at end of file diff --git a/__fixtures__/misc/output-decimals/misc/tx.registry.ts b/__fixtures__/misc/output-decimals/misc/tx.registry.ts index 1d15c5745c..9ee2c16c01 100644 --- a/__fixtures__/misc/output-decimals/misc/tx.registry.ts +++ b/__fixtures__/misc/output-decimals/misc/tx.registry.ts @@ -1,12 +1,7 @@ import { EncodingTestForDontOmit, EncodingTestForDontOmitSDKType, EncodingTestForOmit, EncodingTestForOmitSDKType } from "./all_fields"; -import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { TelescopeGeneratedType } from "../types"; import { InputMsg, InputMsgSDKType } from "./tx"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/misc.InputMsg", InputMsg]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/misc.InputMsg", InputMsg]]; export const MessageComposer = { encoded: { sendMsg(value: InputMsg) { diff --git a/__fixtures__/misc/output-decimals/misc/tx.rpc.func.ts b/__fixtures__/misc/output-decimals/misc/tx.rpc.func.ts new file mode 100644 index 0000000000..e3a3906134 --- /dev/null +++ b/__fixtures__/misc/output-decimals/misc/tx.rpc.func.ts @@ -0,0 +1,12 @@ +import { EncodingTestForDontOmit, EncodingTestForDontOmitSDKType, EncodingTestForOmit, EncodingTestForOmitSDKType } from "./all_fields"; +import { buildTx } from "../helper-func-types"; +import { InputMsg, InputMsgSDKType, MsgResponse, MsgResponseSDKType } from "./tx"; +/** + * test tx + * @name sendMsg + * @package misc + * @see proto service: misc.SendMsg + */ +export const sendMsg = buildTx({ + msg: InputMsg +}); \ No newline at end of file diff --git a/__fixtures__/misc/output-decimals/misc/tx.rpc.msg.ts b/__fixtures__/misc/output-decimals/misc/tx.rpc.msg.ts index 6d03a2bcb5..c4e3a250fa 100644 --- a/__fixtures__/misc/output-decimals/misc/tx.rpc.msg.ts +++ b/__fixtures__/misc/output-decimals/misc/tx.rpc.msg.ts @@ -1,5 +1,5 @@ import { EncodingTestForDontOmit, EncodingTestForDontOmitSDKType, EncodingTestForOmit, EncodingTestForOmitSDKType } from "./all_fields"; -import { Rpc } from "../helpers"; +import { TxRpc } from "../types"; import { BinaryReader } from "../binary"; import { InputMsg, InputMsgSDKType, MsgResponse, MsgResponseSDKType } from "./tx"; export interface Msg { @@ -7,8 +7,8 @@ export interface Msg { sendMsg(request: InputMsg): Promise; } export class MsgClientImpl implements Msg { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.sendMsg = this.sendMsg.bind(this); } @@ -18,6 +18,6 @@ export class MsgClientImpl implements Msg { return promise.then(data => MsgResponse.decode(new BinaryReader(data))); } } -export const createClientImpl = (rpc: Rpc) => { +export const createClientImpl = (rpc: TxRpc) => { return new MsgClientImpl(rpc); }; \ No newline at end of file diff --git a/__fixtures__/misc/output-decimals/types.ts b/__fixtures__/misc/output-decimals/types.ts new file mode 100644 index 0000000000..1acee677e2 --- /dev/null +++ b/__fixtures__/misc/output-decimals/types.ts @@ -0,0 +1,109 @@ +/** +* This file and any referenced files were automatically generated by @hyperweb/telescope@latest +* DO NOT MODIFY BY HAND. Instead, download the latest proto files for your chain +* and run the transpile command or npm scripts command that is used to regenerate this bundle. +*/ + +import { IBinaryReader, IBinaryWriter } from "./binary"; +import { Any } from "./google/protobuf/any"; + +import { HttpEndpoint } from "@interchainjs/types"; + + +import { DeliverTxResponse, Event, Attribute } from "@interchainjs/types"; + +export { DeliverTxResponse } + + +export type ProtoMsg = Omit & { typeUrl: any }; + +export interface IAminoMsg { + type: any; + value: Amino; +} + +export interface IProtoType { + $typeUrl?: any; +} + +/** + * A type generated by Telescope 1.0. + */ +export interface TelescopeGeneratedCodec< + T = unknown, + SDK = unknown, + Amino = unknown +> { + readonly typeUrl: string; + readonly aminoType?: string; + is?(o: unknown): o is T; + isSDK?(o: unknown): o is SDK; + isAmino?(o: unknown): o is Amino; + encode: (message: T, writer?: IBinaryWriter | any) => IBinaryWriter | any; + decode: (input: IBinaryReader | Uint8Array | any, length?: number) => T; + fromPartial: (object: any) => T | any; + fromJSON?: (object: any) => T | any; + toJSON?: (message: T | any) => any; + fromSDK?: (sdk: SDK) => T; + fromSDKJSON?: (object: any) => SDK; + toSDK?: (message: T) => SDK; + fromAmino?: (amino: Amino) => T; + toAmino?: (message: T) => Amino; + fromAminoMsg?: (aminoMsg: IAminoMsg) => T; + toAminoMsg?: (message: T) => IAminoMsg; + toProto?: (message: T) => Uint8Array; + fromProtoMsg?: (message: ProtoMsg) => T; + toProtoMsg?: (message: T) => Any; + registerTypeUrl?: () => void; +} + +export type TelescopeGeneratedType< + T = unknown, + SDK = unknown, + Amino = unknown +> = TelescopeGeneratedCodec; + +export type GeneratedType = TelescopeGeneratedCodec; + +/** + * Coin defines a token with a denomination and an amount. + * + * NOTE: The amount field is an Int which implements the custom method + * signatures required by gogoproto. + */ +interface Coin { + denom: string; + amount: string; +} + +export type EncodeObject = Message; + +export interface Message { + typeUrl: string; + value: T; +} + +export interface StdFee { + amount: Coin[]; + gas: string; + /** The granter address that is used for paying with feegrants */ + granter?: string; + /** The fee payer address. The payer must have signed the transaction. */ + payer?: string; +} + + +export interface TxRpc { + request( + service: string, + method: string, + data: Uint8Array + ): Promise; + signAndBroadcast?( + signerAddress: string, + messages: EncodeObject[], + fee: StdFee | "auto" | number, + memo: string + ): Promise; +} + diff --git a/__fixtures__/misc/output-impl-interfaces-gen/akash/deployment/v1beta1/authz.ts b/__fixtures__/misc/output-impl-interfaces-gen/akash/deployment/v1beta1/authz.ts index 580430028d..f293dc4e95 100644 --- a/__fixtures__/misc/output-impl-interfaces-gen/akash/deployment/v1beta1/authz.ts +++ b/__fixtures__/misc/output-impl-interfaces-gen/akash/deployment/v1beta1/authz.ts @@ -154,6 +154,12 @@ export const DepositDeploymentAuthorization = { typeUrl: "/akash.deployment.v1beta1.DepositDeploymentAuthorization", value: DepositDeploymentAuthorization.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(DepositDeploymentAuthorization.typeUrl)) { + return; + } + GlobalDecoderRegistry.register(DepositDeploymentAuthorization.typeUrl, DepositDeploymentAuthorization); + Coin.registerTypeUrl(); } -}; -GlobalDecoderRegistry.register(DepositDeploymentAuthorization.typeUrl, DepositDeploymentAuthorization); \ No newline at end of file +}; \ No newline at end of file diff --git a/__fixtures__/misc/output-impl-interfaces-gen/cosmos/authz/v1beta1/authz.ts b/__fixtures__/misc/output-impl-interfaces-gen/cosmos/authz/v1beta1/authz.ts index f8eb2804e0..c1bdcfe41e 100644 --- a/__fixtures__/misc/output-impl-interfaces-gen/cosmos/authz/v1beta1/authz.ts +++ b/__fixtures__/misc/output-impl-interfaces-gen/cosmos/authz/v1beta1/authz.ts @@ -408,10 +408,15 @@ export const GenericAuthorization = { typeUrl: "/cosmos.authz.v1beta1.GenericAuthorization", value: GenericAuthorization.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GenericAuthorization.typeUrl)) { + return; + } + GlobalDecoderRegistry.register(GenericAuthorization.typeUrl, GenericAuthorization); + GlobalDecoderRegistry.registerAminoProtoMapping(GenericAuthorization.aminoType, GenericAuthorization.typeUrl); } }; -GlobalDecoderRegistry.register(GenericAuthorization.typeUrl, GenericAuthorization); -GlobalDecoderRegistry.registerAminoProtoMapping(GenericAuthorization.aminoType, GenericAuthorization.typeUrl); function createBaseGrant(): Grant { return { authorization: Any.fromPartial({}), @@ -603,10 +608,9 @@ export const Grant = { typeUrl: "/cosmos.authz.v1beta1.Grant", value: Grant.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; -GlobalDecoderRegistry.register(Grant.typeUrl, Grant); -GlobalDecoderRegistry.registerAminoProtoMapping(Grant.aminoType, Grant.typeUrl); function createBaseGrantAuthorization(): GrantAuthorization { return { granter: "", @@ -769,10 +773,16 @@ export const GrantAuthorization = { typeUrl: "/cosmos.authz.v1beta1.GrantAuthorization", value: GrantAuthorization.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GrantAuthorization.typeUrl)) { + return; + } + GenericAuthorization.registerTypeUrl(); + DepositDeploymentAuthorization.registerTypeUrl(); + SendAuthorization.registerTypeUrl(); } }; -GlobalDecoderRegistry.register(GrantAuthorization.typeUrl, GrantAuthorization); -GlobalDecoderRegistry.registerAminoProtoMapping(GrantAuthorization.aminoType, GrantAuthorization.typeUrl); function createBaseGrantQueueItem(): GrantQueueItem { return { msgTypeUrls: [] @@ -891,10 +901,9 @@ export const GrantQueueItem = { typeUrl: "/cosmos.authz.v1beta1.GrantQueueItem", value: GrantQueueItem.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; -GlobalDecoderRegistry.register(GrantQueueItem.typeUrl, GrantQueueItem); -GlobalDecoderRegistry.registerAminoProtoMapping(GrantQueueItem.aminoType, GrantQueueItem.typeUrl); function createBaseGrants(): Grants { return { authorization: [] @@ -1013,7 +1022,13 @@ export const Grants = { typeUrl: "/cosmos.authz.v1beta1.Grants", value: Grants.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Grants.typeUrl)) { + return; + } + GenericAuthorization.registerTypeUrl(); + DepositDeploymentAuthorization.registerTypeUrl(); + SendAuthorization.registerTypeUrl(); } -}; -GlobalDecoderRegistry.register(Grants.typeUrl, Grants); -GlobalDecoderRegistry.registerAminoProtoMapping(Grants.aminoType, Grants.typeUrl); \ No newline at end of file +}; \ No newline at end of file diff --git a/__fixtures__/misc/output-impl-interfaces-gen/cosmos/authz/v1beta1/tx.registry.ts b/__fixtures__/misc/output-impl-interfaces-gen/cosmos/authz/v1beta1/tx.registry.ts index 92557e5cad..7a372371c6 100644 --- a/__fixtures__/misc/output-impl-interfaces-gen/cosmos/authz/v1beta1/tx.registry.ts +++ b/__fixtures__/misc/output-impl-interfaces-gen/cosmos/authz/v1beta1/tx.registry.ts @@ -1,13 +1,8 @@ import { Grant, GrantSDKType } from "./authz"; import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../google/protobuf/any"; -import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { TelescopeGeneratedType } from "../../../types"; import { MsgGrant, MsgGrantSDKType, MsgExec, MsgExecSDKType, MsgRevoke, MsgRevokeSDKType } from "./tx"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/cosmos.authz.v1beta1.MsgGrant", MsgGrant], ["/cosmos.authz.v1beta1.MsgExec", MsgExec], ["/cosmos.authz.v1beta1.MsgRevoke", MsgRevoke]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/cosmos.authz.v1beta1.MsgGrant", MsgGrant], ["/cosmos.authz.v1beta1.MsgExec", MsgExec], ["/cosmos.authz.v1beta1.MsgRevoke", MsgRevoke]]; export const MessageComposer = { encoded: { grant(value: MsgGrant) { diff --git a/__fixtures__/misc/output-impl-interfaces-gen/cosmos/authz/v1beta1/tx.rpc.func.ts b/__fixtures__/misc/output-impl-interfaces-gen/cosmos/authz/v1beta1/tx.rpc.func.ts new file mode 100644 index 0000000000..c4ddbc1be9 --- /dev/null +++ b/__fixtures__/misc/output-impl-interfaces-gen/cosmos/authz/v1beta1/tx.rpc.func.ts @@ -0,0 +1,37 @@ +import { Grant, GrantSDKType } from "./authz"; +import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../google/protobuf/any"; +import { buildTx } from "../../../helper-func-types"; +import { MsgGrant, MsgGrantSDKType, MsgGrantResponse, MsgGrantResponseSDKType, MsgExec, MsgExecSDKType, MsgExecResponse, MsgExecResponseSDKType, MsgRevoke, MsgRevokeSDKType, MsgRevokeResponse, MsgRevokeResponseSDKType } from "./tx"; +/** + * Grant grants the provided authorization to the grantee on the granter's + * account with the provided expiration time. If there is already a grant + * for the given (granter, grantee, Authorization) triple, then the grant + * will be overwritten. + * @name grant + * @package cosmos.authz.v1beta1 + * @see proto service: cosmos.authz.v1beta1.Grant + */ +export const grant = buildTx({ + msg: MsgGrant +}); +/** + * Exec attempts to execute the provided messages using + * authorizations granted to the grantee. Each message should have only + * one signer corresponding to the granter of the authorization. + * @name exec + * @package cosmos.authz.v1beta1 + * @see proto service: cosmos.authz.v1beta1.Exec + */ +export const exec = buildTx({ + msg: MsgExec +}); +/** + * Revoke revokes any authorization corresponding to the provided method name on the + * granter's account that has been granted to the grantee. + * @name revoke + * @package cosmos.authz.v1beta1 + * @see proto service: cosmos.authz.v1beta1.Revoke + */ +export const revoke = buildTx({ + msg: MsgRevoke +}); \ No newline at end of file diff --git a/__fixtures__/misc/output-impl-interfaces-gen/cosmos/authz/v1beta1/tx.rpc.msg.ts b/__fixtures__/misc/output-impl-interfaces-gen/cosmos/authz/v1beta1/tx.rpc.msg.ts index dc90606b47..12c2a0eb10 100644 --- a/__fixtures__/misc/output-impl-interfaces-gen/cosmos/authz/v1beta1/tx.rpc.msg.ts +++ b/__fixtures__/misc/output-impl-interfaces-gen/cosmos/authz/v1beta1/tx.rpc.msg.ts @@ -1,6 +1,6 @@ import { Grant, GrantSDKType } from "./authz"; import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../google/protobuf/any"; -import { Rpc } from "../../../helpers"; +import { TxRpc } from "../../../types"; import { BinaryReader } from "../../../binary"; import { MsgGrant, MsgGrantSDKType, MsgGrantResponse, MsgGrantResponseSDKType, MsgExec, MsgExecSDKType, MsgExecResponse, MsgExecResponseSDKType, MsgRevoke, MsgRevokeSDKType, MsgRevokeResponse, MsgRevokeResponseSDKType } from "./tx"; /** Msg defines the authz Msg service. */ @@ -25,8 +25,8 @@ export interface Msg { revoke(request: MsgRevoke): Promise; } export class MsgClientImpl implements Msg { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.grant = this.grant.bind(this); this.exec = this.exec.bind(this); @@ -48,6 +48,6 @@ export class MsgClientImpl implements Msg { return promise.then(data => MsgRevokeResponse.decode(new BinaryReader(data))); } } -export const createClientImpl = (rpc: Rpc) => { +export const createClientImpl = (rpc: TxRpc) => { return new MsgClientImpl(rpc); }; \ No newline at end of file diff --git a/__fixtures__/misc/output-impl-interfaces-gen/cosmos/authz/v1beta1/tx.ts b/__fixtures__/misc/output-impl-interfaces-gen/cosmos/authz/v1beta1/tx.ts index f23abfcfc4..6cf673a97c 100644 --- a/__fixtures__/misc/output-impl-interfaces-gen/cosmos/authz/v1beta1/tx.ts +++ b/__fixtures__/misc/output-impl-interfaces-gen/cosmos/authz/v1beta1/tx.ts @@ -393,10 +393,14 @@ export const MsgGrant = { typeUrl: "/cosmos.authz.v1beta1.MsgGrant", value: MsgGrant.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgGrant.typeUrl)) { + return; + } + Grant.registerTypeUrl(); } }; -GlobalDecoderRegistry.register(MsgGrant.typeUrl, MsgGrant); -GlobalDecoderRegistry.registerAminoProtoMapping(MsgGrant.aminoType, MsgGrant.typeUrl); function createBaseMsgExecResponse(): MsgExecResponse { return { results: [] @@ -515,10 +519,9 @@ export const MsgExecResponse = { typeUrl: "/cosmos.authz.v1beta1.MsgExecResponse", value: MsgExecResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; -GlobalDecoderRegistry.register(MsgExecResponse.typeUrl, MsgExecResponse); -GlobalDecoderRegistry.registerAminoProtoMapping(MsgExecResponse.aminoType, MsgExecResponse.typeUrl); function createBaseMsgExec(): MsgExec { return { grantee: "", @@ -656,10 +659,9 @@ export const MsgExec = { typeUrl: "/cosmos.authz.v1beta1.MsgExec", value: MsgExec.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; -GlobalDecoderRegistry.register(MsgExec.typeUrl, MsgExec); -GlobalDecoderRegistry.registerAminoProtoMapping(MsgExec.aminoType, MsgExec.typeUrl); function createBaseMsgGrantResponse(): MsgGrantResponse { return {}; } @@ -748,10 +750,9 @@ export const MsgGrantResponse = { typeUrl: "/cosmos.authz.v1beta1.MsgGrantResponse", value: MsgGrantResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; -GlobalDecoderRegistry.register(MsgGrantResponse.typeUrl, MsgGrantResponse); -GlobalDecoderRegistry.registerAminoProtoMapping(MsgGrantResponse.aminoType, MsgGrantResponse.typeUrl); function createBaseMsgRevoke(): MsgRevoke { return { granter: "", @@ -895,10 +896,9 @@ export const MsgRevoke = { typeUrl: "/cosmos.authz.v1beta1.MsgRevoke", value: MsgRevoke.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; -GlobalDecoderRegistry.register(MsgRevoke.typeUrl, MsgRevoke); -GlobalDecoderRegistry.registerAminoProtoMapping(MsgRevoke.aminoType, MsgRevoke.typeUrl); function createBaseMsgRevokeResponse(): MsgRevokeResponse { return {}; } @@ -987,7 +987,6 @@ export const MsgRevokeResponse = { typeUrl: "/cosmos.authz.v1beta1.MsgRevokeResponse", value: MsgRevokeResponse.encode(message).finish() }; - } -}; -GlobalDecoderRegistry.register(MsgRevokeResponse.typeUrl, MsgRevokeResponse); -GlobalDecoderRegistry.registerAminoProtoMapping(MsgRevokeResponse.aminoType, MsgRevokeResponse.typeUrl); \ No newline at end of file + }, + registerTypeUrl() {} +}; \ No newline at end of file diff --git a/__fixtures__/misc/output-impl-interfaces-gen/cosmos/bank/v1beta1/authz.ts b/__fixtures__/misc/output-impl-interfaces-gen/cosmos/bank/v1beta1/authz.ts index 0b1199eff6..9c80f862df 100644 --- a/__fixtures__/misc/output-impl-interfaces-gen/cosmos/bank/v1beta1/authz.ts +++ b/__fixtures__/misc/output-impl-interfaces-gen/cosmos/bank/v1beta1/authz.ts @@ -169,7 +169,13 @@ export const SendAuthorization = { typeUrl: "/cosmos.bank.v1beta1.SendAuthorization", value: SendAuthorization.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(SendAuthorization.typeUrl)) { + return; + } + GlobalDecoderRegistry.register(SendAuthorization.typeUrl, SendAuthorization); + GlobalDecoderRegistry.registerAminoProtoMapping(SendAuthorization.aminoType, SendAuthorization.typeUrl); + Coin.registerTypeUrl(); } -}; -GlobalDecoderRegistry.register(SendAuthorization.typeUrl, SendAuthorization); -GlobalDecoderRegistry.registerAminoProtoMapping(SendAuthorization.aminoType, SendAuthorization.typeUrl); \ No newline at end of file +}; \ No newline at end of file diff --git a/__fixtures__/misc/output-impl-interfaces-gen/cosmos/bank/v1beta1/tx.ts b/__fixtures__/misc/output-impl-interfaces-gen/cosmos/bank/v1beta1/tx.ts index 32f207881f..f8866ef71f 100644 --- a/__fixtures__/misc/output-impl-interfaces-gen/cosmos/bank/v1beta1/tx.ts +++ b/__fixtures__/misc/output-impl-interfaces-gen/cosmos/bank/v1beta1/tx.ts @@ -325,7 +325,11 @@ export const MsgInstantiateContract2 = { typeUrl: "/cosmos.bank.v1beta1.MsgInstantiateContract2", value: MsgInstantiateContract2.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgInstantiateContract2.typeUrl)) { + return; + } + Coin.registerTypeUrl(); } -}; -GlobalDecoderRegistry.register(MsgInstantiateContract2.typeUrl, MsgInstantiateContract2); -GlobalDecoderRegistry.registerAminoProtoMapping(MsgInstantiateContract2.aminoType, MsgInstantiateContract2.typeUrl); \ No newline at end of file +}; \ No newline at end of file diff --git a/__fixtures__/misc/output-impl-interfaces-gen/cosmos/base/v1beta1/coin.ts b/__fixtures__/misc/output-impl-interfaces-gen/cosmos/base/v1beta1/coin.ts index 13318bc98d..004fe0df7c 100644 --- a/__fixtures__/misc/output-impl-interfaces-gen/cosmos/base/v1beta1/coin.ts +++ b/__fixtures__/misc/output-impl-interfaces-gen/cosmos/base/v1beta1/coin.ts @@ -1,8 +1,7 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; import { isSet, DeepPartial } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; -import { GlobalDecoderRegistry } from "../../../registry"; -import { Decimal } from "@cosmjs/math"; +import { Decimal } from "@interchainjs/math"; export const protobufPackage = "cosmos.base.v1beta1"; /** * Coin defines a token with a denomination and an amount. @@ -296,10 +295,9 @@ export const Coin = { typeUrl: "/cosmos.base.v1beta1.Coin", value: Coin.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; -GlobalDecoderRegistry.register(Coin.typeUrl, Coin); -GlobalDecoderRegistry.registerAminoProtoMapping(Coin.aminoType, Coin.typeUrl); function createBaseDecCoin(): DecCoin { return { denom: "", @@ -405,7 +403,7 @@ export const DecCoin = { toAmino(message: DecCoin): DecCoinAmino { const obj: any = {}; obj.denom = message.denom === "" ? undefined : message.denom; - obj.amount = message.amount === "" ? undefined : message.amount; + obj.amount = message.amount === "" ? undefined : Decimal.fromUserInput(message.amount, 18).atomics; return obj; }, fromAminoMsg(object: DecCoinAminoMsg): DecCoin { @@ -428,10 +426,9 @@ export const DecCoin = { typeUrl: "/cosmos.base.v1beta1.DecCoin", value: DecCoin.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; -GlobalDecoderRegistry.register(DecCoin.typeUrl, DecCoin); -GlobalDecoderRegistry.registerAminoProtoMapping(DecCoin.aminoType, DecCoin.typeUrl); function createBaseIntProto(): IntProto { return { int: "" @@ -540,10 +537,9 @@ export const IntProto = { typeUrl: "/cosmos.base.v1beta1.IntProto", value: IntProto.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; -GlobalDecoderRegistry.register(IntProto.typeUrl, IntProto); -GlobalDecoderRegistry.registerAminoProtoMapping(IntProto.aminoType, IntProto.typeUrl); function createBaseDecProto(): DecProto { return { dec: "" @@ -629,7 +625,7 @@ export const DecProto = { }, toAmino(message: DecProto): DecProtoAmino { const obj: any = {}; - obj.dec = message.dec === "" ? undefined : message.dec; + obj.dec = message.dec === "" ? undefined : Decimal.fromUserInput(message.dec, 18).atomics; return obj; }, fromAminoMsg(object: DecProtoAminoMsg): DecProto { @@ -652,7 +648,6 @@ export const DecProto = { typeUrl: "/cosmos.base.v1beta1.DecProto", value: DecProto.encode(message).finish() }; - } -}; -GlobalDecoderRegistry.register(DecProto.typeUrl, DecProto); -GlobalDecoderRegistry.registerAminoProtoMapping(DecProto.aminoType, DecProto.typeUrl); \ No newline at end of file + }, + registerTypeUrl() {} +}; \ No newline at end of file diff --git a/__fixtures__/misc/output-impl-interfaces-gen/cosmos/bundle.ts b/__fixtures__/misc/output-impl-interfaces-gen/cosmos/bundle.ts index 7c4eb22122..d5655d1683 100644 --- a/__fixtures__/misc/output-impl-interfaces-gen/cosmos/bundle.ts +++ b/__fixtures__/misc/output-impl-interfaces-gen/cosmos/bundle.ts @@ -5,8 +5,9 @@ import * as _5 from "./bank/v1beta1/tx"; import * as _6 from "./base/v1beta1/coin"; import * as _11 from "./authz/v1beta1/tx.amino"; import * as _12 from "./authz/v1beta1/tx.registry"; -import * as _13 from "./authz/v1beta1/tx.rpc.msg"; -import * as _14 from "./rpc.tx"; +import * as _13 from "./authz/v1beta1/tx.rpc.func"; +import * as _14 from "./authz/v1beta1/tx.rpc.msg"; +import * as _15 from "./rpc.tx"; export namespace cosmos { export namespace authz { export const v1beta1 = { @@ -14,7 +15,8 @@ export namespace cosmos { ..._3, ..._11, ..._12, - ..._13 + ..._13, + ..._14 }; } export namespace bank { @@ -29,6 +31,6 @@ export namespace cosmos { }; } export const ClientFactory = { - ..._14 + ..._15 }; } \ No newline at end of file diff --git a/__fixtures__/misc/output-impl-interfaces-gen/cosmos_proto/cosmos.ts b/__fixtures__/misc/output-impl-interfaces-gen/cosmos_proto/cosmos.ts index c80a51c124..996a70239a 100644 --- a/__fixtures__/misc/output-impl-interfaces-gen/cosmos_proto/cosmos.ts +++ b/__fixtures__/misc/output-impl-interfaces-gen/cosmos_proto/cosmos.ts @@ -1,7 +1,6 @@ import { BinaryReader, BinaryWriter } from "../binary"; import { isSet, DeepPartial } from "../helpers"; import { JsonSafe } from "../json-safe"; -import { GlobalDecoderRegistry } from "../registry"; export const protobufPackage = "cosmos_proto"; export enum ScalarType { SCALAR_TYPE_UNSPECIFIED = 0, @@ -314,9 +313,9 @@ export const InterfaceDescriptor = { typeUrl: "/cosmos_proto.InterfaceDescriptor", value: InterfaceDescriptor.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; -GlobalDecoderRegistry.register(InterfaceDescriptor.typeUrl, InterfaceDescriptor); function createBaseScalarDescriptor(): ScalarDescriptor { return { name: "", @@ -477,6 +476,6 @@ export const ScalarDescriptor = { typeUrl: "/cosmos_proto.ScalarDescriptor", value: ScalarDescriptor.encode(message).finish() }; - } -}; -GlobalDecoderRegistry.register(ScalarDescriptor.typeUrl, ScalarDescriptor); \ No newline at end of file + }, + registerTypeUrl() {} +}; \ No newline at end of file diff --git a/__fixtures__/misc/output-impl-interfaces-gen/extern.ts b/__fixtures__/misc/output-impl-interfaces-gen/extern.ts index c3e7cbcac8..83d6864ae2 100644 --- a/__fixtures__/misc/output-impl-interfaces-gen/extern.ts +++ b/__fixtures__/misc/output-impl-interfaces-gen/extern.ts @@ -4,30 +4,45 @@ * and run the transpile command or npm scripts command that is used to regenerate this bundle. */ -import { QueryClient, createProtobufRpcClient, ProtobufRpcClient } from '@cosmjs/stargate' -import { Tendermint34Client, HttpEndpoint } from "@cosmjs/tendermint-rpc"; -const _rpcClients: Record = {}; +import { HttpEndpoint } from "@interchainjs/types"; +import { Rpc } from "./helpers"; +import { ClientOptions, createCosmosQueryClient } from "@interchainjs/cosmos"; + +const _rpcClients: Record = {}; export const getRpcEndpointKey = (rpcEndpoint: string | HttpEndpoint) => { - if (typeof rpcEndpoint === 'string') { - return rpcEndpoint; - } else if (!!rpcEndpoint) { - //@ts-ignore - return rpcEndpoint.url; - } + if (typeof rpcEndpoint === 'string') { + return rpcEndpoint; + } else if (!!rpcEndpoint) { + //@ts-ignore + return rpcEndpoint.url; + } } export const getRpcClient = async (rpcEndpoint: string | HttpEndpoint) => { - const key = getRpcEndpointKey(rpcEndpoint); - if (!key) return; - if (_rpcClients.hasOwnProperty(key)) { - return _rpcClients[key]; - } - const tmClient = await Tendermint34Client.connect(rpcEndpoint); - //@ts-ignore - const client = new QueryClient(tmClient); - const rpc = createProtobufRpcClient(client); - _rpcClients[key] = rpc; - return rpc; + const key = getRpcEndpointKey(rpcEndpoint); + if (!key) return; + if (_rpcClients.hasOwnProperty(key)) { + return _rpcClients[key]; + } + const rpc = await createRpcClient(rpcEndpoint); + _rpcClients[key] = rpc; + return rpc; +} + +export const createRpcClient = async (rpcEndpoint: string | HttpEndpoint, + options?: ClientOptions +) => { + if (typeof rpcEndpoint === 'string') { + return createCosmosQueryClient(rpcEndpoint, options); + } else { + const endpointStr = rpcEndpoint.url; + const clientOptions = { + ...options, + headers: rpcEndpoint.headers + }; + + return createCosmosQueryClient(endpointStr, clientOptions); + } } diff --git a/__fixtures__/misc/output-impl-interfaces-gen/google/protobuf/any.ts b/__fixtures__/misc/output-impl-interfaces-gen/google/protobuf/any.ts index c1b15ca41e..48b99cfbbb 100644 --- a/__fixtures__/misc/output-impl-interfaces-gen/google/protobuf/any.ts +++ b/__fixtures__/misc/output-impl-interfaces-gen/google/protobuf/any.ts @@ -530,5 +530,6 @@ export const Any = { typeUrl: "/google.protobuf.Any", value: Any.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/misc/output-impl-interfaces-gen/google/protobuf/descriptor.ts b/__fixtures__/misc/output-impl-interfaces-gen/google/protobuf/descriptor.ts index 13b8f6b143..9a4961fc27 100644 --- a/__fixtures__/misc/output-impl-interfaces-gen/google/protobuf/descriptor.ts +++ b/__fixtures__/misc/output-impl-interfaces-gen/google/protobuf/descriptor.ts @@ -2776,9 +2776,14 @@ export const FileDescriptorSet = { typeUrl: "/google.protobuf.FileDescriptorSet", value: FileDescriptorSet.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(FileDescriptorSet.typeUrl)) { + return; + } + FileDescriptorProto.registerTypeUrl(); } }; -GlobalDecoderRegistry.register(FileDescriptorSet.typeUrl, FileDescriptorSet); function createBaseFileDescriptorProto(): FileDescriptorProto { return { name: "", @@ -3159,9 +3164,19 @@ export const FileDescriptorProto = { typeUrl: "/google.protobuf.FileDescriptorProto", value: FileDescriptorProto.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(FileDescriptorProto.typeUrl)) { + return; + } + DescriptorProto.registerTypeUrl(); + EnumDescriptorProto.registerTypeUrl(); + ServiceDescriptorProto.registerTypeUrl(); + FieldDescriptorProto.registerTypeUrl(); + FileOptions.registerTypeUrl(); + SourceCodeInfo.registerTypeUrl(); } }; -GlobalDecoderRegistry.register(FileDescriptorProto.typeUrl, FileDescriptorProto); function createBaseDescriptorProto(): DescriptorProto { return { name: "", @@ -3498,9 +3513,20 @@ export const DescriptorProto = { typeUrl: "/google.protobuf.DescriptorProto", value: DescriptorProto.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(DescriptorProto.typeUrl)) { + return; + } + FieldDescriptorProto.registerTypeUrl(); + DescriptorProto.registerTypeUrl(); + EnumDescriptorProto.registerTypeUrl(); + DescriptorProto_ExtensionRange.registerTypeUrl(); + OneofDescriptorProto.registerTypeUrl(); + MessageOptions.registerTypeUrl(); + DescriptorProto_ReservedRange.registerTypeUrl(); } }; -GlobalDecoderRegistry.register(DescriptorProto.typeUrl, DescriptorProto); function createBaseDescriptorProto_ExtensionRange(): DescriptorProto_ExtensionRange { return { start: 0, @@ -3637,9 +3663,14 @@ export const DescriptorProto_ExtensionRange = { typeUrl: "/google.protobuf.ExtensionRange", value: DescriptorProto_ExtensionRange.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(DescriptorProto_ExtensionRange.typeUrl)) { + return; + } + ExtensionRangeOptions.registerTypeUrl(); } }; -GlobalDecoderRegistry.register(DescriptorProto_ExtensionRange.typeUrl, DescriptorProto_ExtensionRange); function createBaseDescriptorProto_ReservedRange(): DescriptorProto_ReservedRange { return { start: 0, @@ -3760,9 +3791,9 @@ export const DescriptorProto_ReservedRange = { typeUrl: "/google.protobuf.ReservedRange", value: DescriptorProto_ReservedRange.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; -GlobalDecoderRegistry.register(DescriptorProto_ReservedRange.typeUrl, DescriptorProto_ReservedRange); function createBaseExtensionRangeOptions(): ExtensionRangeOptions { return { uninterpretedOption: [] @@ -3873,9 +3904,14 @@ export const ExtensionRangeOptions = { typeUrl: "/google.protobuf.ExtensionRangeOptions", value: ExtensionRangeOptions.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ExtensionRangeOptions.typeUrl)) { + return; + } + UninterpretedOption.registerTypeUrl(); } }; -GlobalDecoderRegistry.register(ExtensionRangeOptions.typeUrl, ExtensionRangeOptions); function createBaseFieldDescriptorProto(): FieldDescriptorProto { return { name: "", @@ -4132,9 +4168,14 @@ export const FieldDescriptorProto = { typeUrl: "/google.protobuf.FieldDescriptorProto", value: FieldDescriptorProto.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(FieldDescriptorProto.typeUrl)) { + return; + } + FieldOptions.registerTypeUrl(); } }; -GlobalDecoderRegistry.register(FieldDescriptorProto.typeUrl, FieldDescriptorProto); function createBaseOneofDescriptorProto(): OneofDescriptorProto { return { name: "", @@ -4255,9 +4296,14 @@ export const OneofDescriptorProto = { typeUrl: "/google.protobuf.OneofDescriptorProto", value: OneofDescriptorProto.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(OneofDescriptorProto.typeUrl)) { + return; + } + OneofOptions.registerTypeUrl(); } }; -GlobalDecoderRegistry.register(OneofDescriptorProto.typeUrl, OneofDescriptorProto); function createBaseEnumDescriptorProto(): EnumDescriptorProto { return { name: "", @@ -4459,9 +4505,16 @@ export const EnumDescriptorProto = { typeUrl: "/google.protobuf.EnumDescriptorProto", value: EnumDescriptorProto.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(EnumDescriptorProto.typeUrl)) { + return; + } + EnumValueDescriptorProto.registerTypeUrl(); + EnumOptions.registerTypeUrl(); + EnumDescriptorProto_EnumReservedRange.registerTypeUrl(); } }; -GlobalDecoderRegistry.register(EnumDescriptorProto.typeUrl, EnumDescriptorProto); function createBaseEnumDescriptorProto_EnumReservedRange(): EnumDescriptorProto_EnumReservedRange { return { start: 0, @@ -4585,9 +4638,9 @@ export const EnumDescriptorProto_EnumReservedRange = { typeUrl: "/google.protobuf.EnumReservedRange", value: EnumDescriptorProto_EnumReservedRange.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; -GlobalDecoderRegistry.register(EnumDescriptorProto_EnumReservedRange.typeUrl, EnumDescriptorProto_EnumReservedRange); function createBaseEnumValueDescriptorProto(): EnumValueDescriptorProto { return { name: "", @@ -4725,9 +4778,14 @@ export const EnumValueDescriptorProto = { typeUrl: "/google.protobuf.EnumValueDescriptorProto", value: EnumValueDescriptorProto.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(EnumValueDescriptorProto.typeUrl)) { + return; + } + EnumValueOptions.registerTypeUrl(); } }; -GlobalDecoderRegistry.register(EnumValueDescriptorProto.typeUrl, EnumValueDescriptorProto); function createBaseServiceDescriptorProto(): ServiceDescriptorProto { return { name: "", @@ -4875,9 +4933,15 @@ export const ServiceDescriptorProto = { typeUrl: "/google.protobuf.ServiceDescriptorProto", value: ServiceDescriptorProto.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ServiceDescriptorProto.typeUrl)) { + return; + } + MethodDescriptorProto.registerTypeUrl(); + ServiceOptions.registerTypeUrl(); } }; -GlobalDecoderRegistry.register(ServiceDescriptorProto.typeUrl, ServiceDescriptorProto); function createBaseMethodDescriptorProto(): MethodDescriptorProto { return { name: "", @@ -5066,9 +5130,14 @@ export const MethodDescriptorProto = { typeUrl: "/google.protobuf.MethodDescriptorProto", value: MethodDescriptorProto.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MethodDescriptorProto.typeUrl)) { + return; + } + MethodOptions.registerTypeUrl(); } }; -GlobalDecoderRegistry.register(MethodDescriptorProto.typeUrl, MethodDescriptorProto); function createBaseFileOptions(): FileOptions { return { javaPackage: "", @@ -5519,9 +5588,14 @@ export const FileOptions = { typeUrl: "/google.protobuf.FileOptions", value: FileOptions.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(FileOptions.typeUrl)) { + return; + } + UninterpretedOption.registerTypeUrl(); } }; -GlobalDecoderRegistry.register(FileOptions.typeUrl, FileOptions); function createBaseMessageOptions(): MessageOptions { return { messageSetWireFormat: false, @@ -5700,9 +5774,14 @@ export const MessageOptions = { typeUrl: "/google.protobuf.MessageOptions", value: MessageOptions.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MessageOptions.typeUrl)) { + return; + } + UninterpretedOption.registerTypeUrl(); } }; -GlobalDecoderRegistry.register(MessageOptions.typeUrl, MessageOptions); function createBaseFieldOptions(): FieldOptions { return { ctype: 1, @@ -5915,9 +5994,14 @@ export const FieldOptions = { typeUrl: "/google.protobuf.FieldOptions", value: FieldOptions.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(FieldOptions.typeUrl)) { + return; + } + UninterpretedOption.registerTypeUrl(); } }; -GlobalDecoderRegistry.register(FieldOptions.typeUrl, FieldOptions); function createBaseOneofOptions(): OneofOptions { return { uninterpretedOption: [] @@ -6028,9 +6112,14 @@ export const OneofOptions = { typeUrl: "/google.protobuf.OneofOptions", value: OneofOptions.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(OneofOptions.typeUrl)) { + return; + } + UninterpretedOption.registerTypeUrl(); } }; -GlobalDecoderRegistry.register(OneofOptions.typeUrl, OneofOptions); function createBaseEnumOptions(): EnumOptions { return { allowAlias: false, @@ -6175,9 +6264,14 @@ export const EnumOptions = { typeUrl: "/google.protobuf.EnumOptions", value: EnumOptions.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(EnumOptions.typeUrl)) { + return; + } + UninterpretedOption.registerTypeUrl(); } }; -GlobalDecoderRegistry.register(EnumOptions.typeUrl, EnumOptions); function createBaseEnumValueOptions(): EnumValueOptions { return { deprecated: false, @@ -6305,9 +6399,14 @@ export const EnumValueOptions = { typeUrl: "/google.protobuf.EnumValueOptions", value: EnumValueOptions.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(EnumValueOptions.typeUrl)) { + return; + } + UninterpretedOption.registerTypeUrl(); } }; -GlobalDecoderRegistry.register(EnumValueOptions.typeUrl, EnumValueOptions); function createBaseServiceOptions(): ServiceOptions { return { deprecated: false, @@ -6435,9 +6534,14 @@ export const ServiceOptions = { typeUrl: "/google.protobuf.ServiceOptions", value: ServiceOptions.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ServiceOptions.typeUrl)) { + return; + } + UninterpretedOption.registerTypeUrl(); } }; -GlobalDecoderRegistry.register(ServiceOptions.typeUrl, ServiceOptions); function createBaseMethodOptions(): MethodOptions { return { deprecated: false, @@ -6582,9 +6686,14 @@ export const MethodOptions = { typeUrl: "/google.protobuf.MethodOptions", value: MethodOptions.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MethodOptions.typeUrl)) { + return; + } + UninterpretedOption.registerTypeUrl(); } }; -GlobalDecoderRegistry.register(MethodOptions.typeUrl, MethodOptions); function createBaseUninterpretedOption(): UninterpretedOption { return { name: [], @@ -6807,9 +6916,14 @@ export const UninterpretedOption = { typeUrl: "/google.protobuf.UninterpretedOption", value: UninterpretedOption.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(UninterpretedOption.typeUrl)) { + return; + } + UninterpretedOption_NamePart.registerTypeUrl(); } }; -GlobalDecoderRegistry.register(UninterpretedOption.typeUrl, UninterpretedOption); function createBaseUninterpretedOption_NamePart(): UninterpretedOption_NamePart { return { namePart: "", @@ -6932,9 +7046,9 @@ export const UninterpretedOption_NamePart = { typeUrl: "/google.protobuf.NamePart", value: UninterpretedOption_NamePart.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; -GlobalDecoderRegistry.register(UninterpretedOption_NamePart.typeUrl, UninterpretedOption_NamePart); function createBaseSourceCodeInfo(): SourceCodeInfo { return { location: [] @@ -7047,9 +7161,14 @@ export const SourceCodeInfo = { typeUrl: "/google.protobuf.SourceCodeInfo", value: SourceCodeInfo.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(SourceCodeInfo.typeUrl)) { + return; + } + SourceCodeInfo_Location.registerTypeUrl(); } }; -GlobalDecoderRegistry.register(SourceCodeInfo.typeUrl, SourceCodeInfo); function createBaseSourceCodeInfo_Location(): SourceCodeInfo_Location { return { path: [], @@ -7266,9 +7385,9 @@ export const SourceCodeInfo_Location = { typeUrl: "/google.protobuf.Location", value: SourceCodeInfo_Location.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; -GlobalDecoderRegistry.register(SourceCodeInfo_Location.typeUrl, SourceCodeInfo_Location); function createBaseGeneratedCodeInfo(): GeneratedCodeInfo { return { annotation: [] @@ -7382,9 +7501,14 @@ export const GeneratedCodeInfo = { typeUrl: "/google.protobuf.GeneratedCodeInfo", value: GeneratedCodeInfo.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GeneratedCodeInfo.typeUrl)) { + return; + } + GeneratedCodeInfo_Annotation.registerTypeUrl(); } }; -GlobalDecoderRegistry.register(GeneratedCodeInfo.typeUrl, GeneratedCodeInfo); function createBaseGeneratedCodeInfo_Annotation(): GeneratedCodeInfo_Annotation { return { path: [], @@ -7555,6 +7679,6 @@ export const GeneratedCodeInfo_Annotation = { typeUrl: "/google.protobuf.Annotation", value: GeneratedCodeInfo_Annotation.encode(message).finish() }; - } -}; -GlobalDecoderRegistry.register(GeneratedCodeInfo_Annotation.typeUrl, GeneratedCodeInfo_Annotation); \ No newline at end of file + }, + registerTypeUrl() {} +}; \ No newline at end of file diff --git a/__fixtures__/misc/output-impl-interfaces-gen/google/protobuf/timestamp.ts b/__fixtures__/misc/output-impl-interfaces-gen/google/protobuf/timestamp.ts index 7d74768022..bfe689766f 100644 --- a/__fixtures__/misc/output-impl-interfaces-gen/google/protobuf/timestamp.ts +++ b/__fixtures__/misc/output-impl-interfaces-gen/google/protobuf/timestamp.ts @@ -1,7 +1,6 @@ import { BinaryReader, BinaryWriter } from "../../binary"; import { isSet, DeepPartial, fromJsonTimestamp, fromTimestamp } from "../../helpers"; import { JsonSafe } from "../../json-safe"; -import { GlobalDecoderRegistry } from "../../registry"; export const protobufPackage = "google.protobuf"; /** * A Timestamp represents a point in time independent of any time zone or local @@ -483,6 +482,6 @@ export const Timestamp = { typeUrl: "/google.protobuf.Timestamp", value: Timestamp.encode(message).finish() }; - } -}; -GlobalDecoderRegistry.register(Timestamp.typeUrl, Timestamp); \ No newline at end of file + }, + registerTypeUrl() {} +}; \ No newline at end of file diff --git a/__fixtures__/misc/output-impl-interfaces-gen/helper-func-types.ts b/__fixtures__/misc/output-impl-interfaces-gen/helper-func-types.ts new file mode 100644 index 0000000000..3102611da1 --- /dev/null +++ b/__fixtures__/misc/output-impl-interfaces-gen/helper-func-types.ts @@ -0,0 +1,105 @@ +/** +* This file and any referenced files were automatically generated by @hyperweb/telescope@latest +* DO NOT MODIFY BY HAND. Instead, download the latest proto files for your chain +* and run the transpile command or npm scripts command that is used to regenerate this bundle. +*/ + + +import { HttpEndpoint } from "@interchainjs/types"; +import { BinaryReader, BinaryWriter } from "./binary"; +import { getRpcClient } from "./extern"; +import { isRpc, Rpc } from "./helpers"; +import { TelescopeGeneratedCodec, DeliverTxResponse, Message, StdFee } from "./types"; +import { toConverters, toEncoders } from "@interchainjs/cosmos/utils"; +import { ISigningClient } from "@interchainjs/cosmos/types/signing-client"; + +export interface QueryBuilderOptions { + encode: (request: TReq, writer?: BinaryWriter) => BinaryWriter + decode: (input: BinaryReader | Uint8Array, length?: number) => TRes + service: string, + method: string, + deps?: TelescopeGeneratedCodec[], +} + +export function buildQuery(opts: QueryBuilderOptions) { + registerDependencies(opts.deps ?? []); + + return async (client: EndpointOrRpc, request: TReq) => { + let rpc: Rpc | undefined; + + if(isRpc(client)) { + rpc = client; + } else { + rpc = client ? await getRpcClient(client) : undefined; + } + + if (!rpc) throw new Error("Query Rpc is not initialized"); + + const data = opts.encode(request).finish(); + const response = await rpc.request(opts.service, opts.method, data); + return opts.decode(response); + }; +} + +export interface ITxArgs { + signerAddress: string; + message: TMsg | TMsg[]; + fee: StdFee | 'auto'; + memo: string; +} + +export interface TxBuilderOptions { + msg: TelescopeGeneratedCodec +} + +export function buildTx(opts: TxBuilderOptions) { + if(opts.msg){ + registerDependencies([opts.msg]); + } + + return async ( + client: ISigningClient, + signerAddress: string, + message: TMsg | TMsg[], + fee: StdFee | 'auto', + memo: string + ): Promise => { + if (!client) throw new Error("SigningClient is not initialized"); + + //register all related encoders and converters + client.addEncoders?.(toEncoders(opts.msg)); + client.addConverters?.(toConverters(opts.msg)); + + const data = Array.isArray(message) + ? message.map(msg => ({ + typeUrl: opts.msg.typeUrl, + value: msg, + })) + : [{ + typeUrl: opts.msg.typeUrl, + value: message, + }]; + return client.signAndBroadcast!(signerAddress, data, fee, memo); + }; +} + +export interface Encoder { + typeUrl: string; + fromPartial: (data: any) => any; + encode: (data: any) => Uint8Array; +} + +export interface AminoConverter { + typeUrl: string; + aminoType: string; + fromAmino: (data: any) => any; + toAmino: (data: any) => any; +} + +export type EndpointOrRpc = string | HttpEndpoint | Rpc ; + +function registerDependencies(deps: TelescopeGeneratedCodec[]) { + for (const dep of deps) { + dep.registerTypeUrl?.(); + } +} diff --git a/__fixtures__/misc/output-impl-interfaces-gen/index.ts b/__fixtures__/misc/output-impl-interfaces-gen/index.ts index 7edda3bade..0b926acab2 100644 --- a/__fixtures__/misc/output-impl-interfaces-gen/index.ts +++ b/__fixtures__/misc/output-impl-interfaces-gen/index.ts @@ -11,6 +11,7 @@ export * from "./cosmos/client"; export * from "./gogoproto/bundle"; export * from "./google/bundle"; export * from "./extern"; +export * from "./helper-func-types"; export * from "./react-query"; export * from "./mobx"; export * from "./pinia-endpoint"; diff --git a/__fixtures__/misc/output-impl-interfaces-gen/types.ts b/__fixtures__/misc/output-impl-interfaces-gen/types.ts index b2016c1a9d..1acee677e2 100644 --- a/__fixtures__/misc/output-impl-interfaces-gen/types.ts +++ b/__fixtures__/misc/output-impl-interfaces-gen/types.ts @@ -6,8 +6,14 @@ import { IBinaryReader, IBinaryWriter } from "./binary"; import { Any } from "./google/protobuf/any"; -import { OfflineSigner } from "@cosmjs/proto-signing"; -import { HttpEndpoint } from "@cosmjs/tendermint-rpc"; + +import { HttpEndpoint } from "@interchainjs/types"; + + +import { DeliverTxResponse, Event, Attribute } from "@interchainjs/types"; + +export { DeliverTxResponse } + export type ProtoMsg = Omit & { typeUrl: any }; @@ -87,56 +93,6 @@ export interface StdFee { } -export interface MsgData { - msgType: string; - data: Uint8Array; -} -export interface Attribute { - key: string; - value: string; - index?: boolean; -} -export interface Event { - type: string; - attributes: readonly Attribute[]; -} - -/** - * The response after successfully broadcasting a transaction. - * Success or failure refer to the execution result. - */ -export interface DeliverTxResponse { - height: number; - /** The position of the transaction within the block. This is a 0-based index. */ - txIndex: number; - /** Error code. The transaction suceeded if and only if code is 0. */ - code: number; - transactionHash: string; - events: readonly Event[]; - /** - * A string-based log document. - * - * This currently seems to merge attributes of multiple events into one event per type - * (https://github.com/tendermint/tendermint/issues/9595). You might want to use the `events` - * field instead. - */ - rawLog?: string; - /** @deprecated Use `msgResponses` instead. */ - data?: readonly MsgData[]; - /** - * The message responses of the [TxMsgData](https://github.com/cosmos/cosmos-sdk/blob/v0.46.3/proto/cosmos/base/abci/v1beta1/abci.proto#L128-L140) - * as `Any`s. - * This field is an empty list for chains running Cosmos SDK < 0.46. - */ - msgResponses: Array<{ - typeUrl: string; - value: Uint8Array; - }>; - gasUsed: bigint; - gasWanted: bigint; - origin?: any; -} - export interface TxRpc { request( service: string, @@ -151,8 +107,3 @@ export interface TxRpc { ): Promise; } -export interface SigningClientParams { - rpcEndpoint: string | HttpEndpoint; - signer: OfflineSigner; -} - diff --git a/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/extern.ts b/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/extern.ts index c3e7cbcac8..83d6864ae2 100644 --- a/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/extern.ts +++ b/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/extern.ts @@ -4,30 +4,45 @@ * and run the transpile command or npm scripts command that is used to regenerate this bundle. */ -import { QueryClient, createProtobufRpcClient, ProtobufRpcClient } from '@cosmjs/stargate' -import { Tendermint34Client, HttpEndpoint } from "@cosmjs/tendermint-rpc"; -const _rpcClients: Record = {}; +import { HttpEndpoint } from "@interchainjs/types"; +import { Rpc } from "./helpers"; +import { ClientOptions, createCosmosQueryClient } from "@interchainjs/cosmos"; + +const _rpcClients: Record = {}; export const getRpcEndpointKey = (rpcEndpoint: string | HttpEndpoint) => { - if (typeof rpcEndpoint === 'string') { - return rpcEndpoint; - } else if (!!rpcEndpoint) { - //@ts-ignore - return rpcEndpoint.url; - } + if (typeof rpcEndpoint === 'string') { + return rpcEndpoint; + } else if (!!rpcEndpoint) { + //@ts-ignore + return rpcEndpoint.url; + } } export const getRpcClient = async (rpcEndpoint: string | HttpEndpoint) => { - const key = getRpcEndpointKey(rpcEndpoint); - if (!key) return; - if (_rpcClients.hasOwnProperty(key)) { - return _rpcClients[key]; - } - const tmClient = await Tendermint34Client.connect(rpcEndpoint); - //@ts-ignore - const client = new QueryClient(tmClient); - const rpc = createProtobufRpcClient(client); - _rpcClients[key] = rpc; - return rpc; + const key = getRpcEndpointKey(rpcEndpoint); + if (!key) return; + if (_rpcClients.hasOwnProperty(key)) { + return _rpcClients[key]; + } + const rpc = await createRpcClient(rpcEndpoint); + _rpcClients[key] = rpc; + return rpc; +} + +export const createRpcClient = async (rpcEndpoint: string | HttpEndpoint, + options?: ClientOptions +) => { + if (typeof rpcEndpoint === 'string') { + return createCosmosQueryClient(rpcEndpoint, options); + } else { + const endpointStr = rpcEndpoint.url; + const clientOptions = { + ...options, + headers: rpcEndpoint.headers + }; + + return createCosmosQueryClient(endpointStr, clientOptions); + } } diff --git a/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/gogoproto/bundle.ts b/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/gogoproto/bundle.ts index 088726b0af..1cc3f0ab5b 100644 --- a/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/gogoproto/bundle.ts +++ b/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/gogoproto/bundle.ts @@ -1,4 +1,4 @@ -import * as _180 from "./gogo"; +import * as _194 from "./gogo"; export const gogoproto = { - ..._180 + ..._194 }; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/google/api/expr/v1alpha1/eval.ts b/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/google/api/expr/v1alpha1/eval.ts index b12834dd20..cf56751258 100644 --- a/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/google/api/expr/v1alpha1/eval.ts +++ b/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/google/api/expr/v1alpha1/eval.ts @@ -189,9 +189,14 @@ export const ExprValue = { typeUrl: "/google.api.expr.v1alpha1.ExprValue", value: ExprValue.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ExprValue.typeUrl)) { + return; + } + IdRef.registerTypeUrl(); } }; -GlobalDecoderRegistry.register(ExprValue.typeUrl, ExprValue); function createBaseIdRef(): IdRef { return { id: 0 @@ -292,6 +297,6 @@ export const IdRef = { typeUrl: "/google.api.expr.v1alpha1.IdRef", value: IdRef.encode(message).finish() }; - } -}; -GlobalDecoderRegistry.register(IdRef.typeUrl, IdRef); \ No newline at end of file + }, + registerTypeUrl() {} +}; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/google/bundle.ts b/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/google/bundle.ts index 21ea355f54..697eb230d0 100644 --- a/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/google/bundle.ts +++ b/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/google/bundle.ts @@ -1,20 +1,20 @@ -import * as _181 from "./api/expr/v1alpha1/eval"; -import * as _182 from "./protobuf/any"; -import * as _183 from "./protobuf/descriptor"; -import * as _184 from "./protobuf/duration"; -import * as _185 from "./protobuf/timestamp"; +import * as _195 from "./api/expr/v1alpha1/eval"; +import * as _196 from "./protobuf/any"; +import * as _197 from "./protobuf/descriptor"; +import * as _198 from "./protobuf/duration"; +import * as _199 from "./protobuf/timestamp"; export namespace google { export namespace api { export namespace expr { export const v1alpha1 = { - ..._181 + ..._195 }; } } export const protobuf = { - ..._182, - ..._183, - ..._184, - ..._185 + ..._196, + ..._197, + ..._198, + ..._199 }; } \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/google/protobuf/any.ts b/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/google/protobuf/any.ts index 61a6453114..d547abe8d4 100644 --- a/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/google/protobuf/any.ts +++ b/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/google/protobuf/any.ts @@ -533,5 +533,6 @@ export const Any = { typeUrl: "/google.protobuf.Any", value: Any.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/google/protobuf/descriptor.ts b/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/google/protobuf/descriptor.ts index bc6bf50399..4a0a1fdfe8 100644 --- a/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/google/protobuf/descriptor.ts +++ b/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/google/protobuf/descriptor.ts @@ -2852,9 +2852,14 @@ export const FileDescriptorSet = { typeUrl: "/google.protobuf.FileDescriptorSet", value: FileDescriptorSet.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(FileDescriptorSet.typeUrl)) { + return; + } + FileDescriptorProto.registerTypeUrl(); } }; -GlobalDecoderRegistry.register(FileDescriptorSet.typeUrl, FileDescriptorSet); function createBaseFileDescriptorProto(): FileDescriptorProto { return { name: "", @@ -3235,9 +3240,19 @@ export const FileDescriptorProto = { typeUrl: "/google.protobuf.FileDescriptorProto", value: FileDescriptorProto.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(FileDescriptorProto.typeUrl)) { + return; + } + DescriptorProto.registerTypeUrl(); + EnumDescriptorProto.registerTypeUrl(); + ServiceDescriptorProto.registerTypeUrl(); + FieldDescriptorProto.registerTypeUrl(); + FileOptions.registerTypeUrl(); + SourceCodeInfo.registerTypeUrl(); } }; -GlobalDecoderRegistry.register(FileDescriptorProto.typeUrl, FileDescriptorProto); function createBaseDescriptorProto(): DescriptorProto { return { name: "", @@ -3574,9 +3589,20 @@ export const DescriptorProto = { typeUrl: "/google.protobuf.DescriptorProto", value: DescriptorProto.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(DescriptorProto.typeUrl)) { + return; + } + FieldDescriptorProto.registerTypeUrl(); + DescriptorProto.registerTypeUrl(); + EnumDescriptorProto.registerTypeUrl(); + DescriptorProto_ExtensionRange.registerTypeUrl(); + OneofDescriptorProto.registerTypeUrl(); + MessageOptions.registerTypeUrl(); + DescriptorProto_ReservedRange.registerTypeUrl(); } }; -GlobalDecoderRegistry.register(DescriptorProto.typeUrl, DescriptorProto); function createBaseDescriptorProto_ExtensionRange(): DescriptorProto_ExtensionRange { return { start: 0, @@ -3713,9 +3739,14 @@ export const DescriptorProto_ExtensionRange = { typeUrl: "/google.protobuf.ExtensionRange", value: DescriptorProto_ExtensionRange.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(DescriptorProto_ExtensionRange.typeUrl)) { + return; + } + ExtensionRangeOptions.registerTypeUrl(); } }; -GlobalDecoderRegistry.register(DescriptorProto_ExtensionRange.typeUrl, DescriptorProto_ExtensionRange); function createBaseDescriptorProto_ReservedRange(): DescriptorProto_ReservedRange { return { start: 0, @@ -3836,9 +3867,9 @@ export const DescriptorProto_ReservedRange = { typeUrl: "/google.protobuf.ReservedRange", value: DescriptorProto_ReservedRange.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; -GlobalDecoderRegistry.register(DescriptorProto_ReservedRange.typeUrl, DescriptorProto_ReservedRange); function createBaseExtensionRangeOptions(): ExtensionRangeOptions { return { uninterpretedOption: [] @@ -3949,9 +3980,14 @@ export const ExtensionRangeOptions = { typeUrl: "/google.protobuf.ExtensionRangeOptions", value: ExtensionRangeOptions.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ExtensionRangeOptions.typeUrl)) { + return; + } + UninterpretedOption.registerTypeUrl(); } }; -GlobalDecoderRegistry.register(ExtensionRangeOptions.typeUrl, ExtensionRangeOptions); function createBaseFieldDescriptorProto(): FieldDescriptorProto { return { name: "", @@ -4208,9 +4244,14 @@ export const FieldDescriptorProto = { typeUrl: "/google.protobuf.FieldDescriptorProto", value: FieldDescriptorProto.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(FieldDescriptorProto.typeUrl)) { + return; + } + FieldOptions.registerTypeUrl(); } }; -GlobalDecoderRegistry.register(FieldDescriptorProto.typeUrl, FieldDescriptorProto); function createBaseOneofDescriptorProto(): OneofDescriptorProto { return { name: "", @@ -4331,9 +4372,14 @@ export const OneofDescriptorProto = { typeUrl: "/google.protobuf.OneofDescriptorProto", value: OneofDescriptorProto.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(OneofDescriptorProto.typeUrl)) { + return; + } + OneofOptions.registerTypeUrl(); } }; -GlobalDecoderRegistry.register(OneofDescriptorProto.typeUrl, OneofDescriptorProto); function createBaseEnumDescriptorProto(): EnumDescriptorProto { return { name: "", @@ -4535,9 +4581,16 @@ export const EnumDescriptorProto = { typeUrl: "/google.protobuf.EnumDescriptorProto", value: EnumDescriptorProto.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(EnumDescriptorProto.typeUrl)) { + return; + } + EnumValueDescriptorProto.registerTypeUrl(); + EnumOptions.registerTypeUrl(); + EnumDescriptorProto_EnumReservedRange.registerTypeUrl(); } }; -GlobalDecoderRegistry.register(EnumDescriptorProto.typeUrl, EnumDescriptorProto); function createBaseEnumDescriptorProto_EnumReservedRange(): EnumDescriptorProto_EnumReservedRange { return { start: 0, @@ -4661,9 +4714,9 @@ export const EnumDescriptorProto_EnumReservedRange = { typeUrl: "/google.protobuf.EnumReservedRange", value: EnumDescriptorProto_EnumReservedRange.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; -GlobalDecoderRegistry.register(EnumDescriptorProto_EnumReservedRange.typeUrl, EnumDescriptorProto_EnumReservedRange); function createBaseEnumValueDescriptorProto(): EnumValueDescriptorProto { return { name: "", @@ -4801,9 +4854,14 @@ export const EnumValueDescriptorProto = { typeUrl: "/google.protobuf.EnumValueDescriptorProto", value: EnumValueDescriptorProto.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(EnumValueDescriptorProto.typeUrl)) { + return; + } + EnumValueOptions.registerTypeUrl(); } }; -GlobalDecoderRegistry.register(EnumValueDescriptorProto.typeUrl, EnumValueDescriptorProto); function createBaseServiceDescriptorProto(): ServiceDescriptorProto { return { name: "", @@ -4951,9 +5009,15 @@ export const ServiceDescriptorProto = { typeUrl: "/google.protobuf.ServiceDescriptorProto", value: ServiceDescriptorProto.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ServiceDescriptorProto.typeUrl)) { + return; + } + MethodDescriptorProto.registerTypeUrl(); + ServiceOptions.registerTypeUrl(); } }; -GlobalDecoderRegistry.register(ServiceDescriptorProto.typeUrl, ServiceDescriptorProto); function createBaseMethodDescriptorProto(): MethodDescriptorProto { return { name: "", @@ -5142,9 +5206,14 @@ export const MethodDescriptorProto = { typeUrl: "/google.protobuf.MethodDescriptorProto", value: MethodDescriptorProto.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MethodDescriptorProto.typeUrl)) { + return; + } + MethodOptions.registerTypeUrl(); } }; -GlobalDecoderRegistry.register(MethodDescriptorProto.typeUrl, MethodDescriptorProto); function createBaseFileOptions(): FileOptions { return { javaPackage: "", @@ -5595,9 +5664,14 @@ export const FileOptions = { typeUrl: "/google.protobuf.FileOptions", value: FileOptions.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(FileOptions.typeUrl)) { + return; + } + UninterpretedOption.registerTypeUrl(); } }; -GlobalDecoderRegistry.register(FileOptions.typeUrl, FileOptions); function createBaseMessageOptions(): MessageOptions { return { messageSetWireFormat: false, @@ -5776,9 +5850,14 @@ export const MessageOptions = { typeUrl: "/google.protobuf.MessageOptions", value: MessageOptions.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MessageOptions.typeUrl)) { + return; + } + UninterpretedOption.registerTypeUrl(); } }; -GlobalDecoderRegistry.register(MessageOptions.typeUrl, MessageOptions); function createBaseFieldOptions(): FieldOptions { return { ctype: 1, @@ -5991,9 +6070,14 @@ export const FieldOptions = { typeUrl: "/google.protobuf.FieldOptions", value: FieldOptions.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(FieldOptions.typeUrl)) { + return; + } + UninterpretedOption.registerTypeUrl(); } }; -GlobalDecoderRegistry.register(FieldOptions.typeUrl, FieldOptions); function createBaseOneofOptions(): OneofOptions { return { uninterpretedOption: [] @@ -6104,9 +6188,14 @@ export const OneofOptions = { typeUrl: "/google.protobuf.OneofOptions", value: OneofOptions.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(OneofOptions.typeUrl)) { + return; + } + UninterpretedOption.registerTypeUrl(); } }; -GlobalDecoderRegistry.register(OneofOptions.typeUrl, OneofOptions); function createBaseEnumOptions(): EnumOptions { return { allowAlias: false, @@ -6251,9 +6340,14 @@ export const EnumOptions = { typeUrl: "/google.protobuf.EnumOptions", value: EnumOptions.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(EnumOptions.typeUrl)) { + return; + } + UninterpretedOption.registerTypeUrl(); } }; -GlobalDecoderRegistry.register(EnumOptions.typeUrl, EnumOptions); function createBaseEnumValueOptions(): EnumValueOptions { return { deprecated: false, @@ -6381,9 +6475,14 @@ export const EnumValueOptions = { typeUrl: "/google.protobuf.EnumValueOptions", value: EnumValueOptions.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(EnumValueOptions.typeUrl)) { + return; + } + UninterpretedOption.registerTypeUrl(); } }; -GlobalDecoderRegistry.register(EnumValueOptions.typeUrl, EnumValueOptions); function createBaseServiceOptions(): ServiceOptions { return { deprecated: false, @@ -6511,9 +6610,14 @@ export const ServiceOptions = { typeUrl: "/google.protobuf.ServiceOptions", value: ServiceOptions.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ServiceOptions.typeUrl)) { + return; + } + UninterpretedOption.registerTypeUrl(); } }; -GlobalDecoderRegistry.register(ServiceOptions.typeUrl, ServiceOptions); function createBaseMethodOptions(): MethodOptions { return { deprecated: false, @@ -6658,9 +6762,14 @@ export const MethodOptions = { typeUrl: "/google.protobuf.MethodOptions", value: MethodOptions.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MethodOptions.typeUrl)) { + return; + } + UninterpretedOption.registerTypeUrl(); } }; -GlobalDecoderRegistry.register(MethodOptions.typeUrl, MethodOptions); function createBaseUninterpretedOption(): UninterpretedOption { return { name: [], @@ -6883,9 +6992,14 @@ export const UninterpretedOption = { typeUrl: "/google.protobuf.UninterpretedOption", value: UninterpretedOption.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(UninterpretedOption.typeUrl)) { + return; + } + UninterpretedOption_NamePart.registerTypeUrl(); } }; -GlobalDecoderRegistry.register(UninterpretedOption.typeUrl, UninterpretedOption); function createBaseUninterpretedOption_NamePart(): UninterpretedOption_NamePart { return { namePart: "", @@ -7008,9 +7122,9 @@ export const UninterpretedOption_NamePart = { typeUrl: "/google.protobuf.NamePart", value: UninterpretedOption_NamePart.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; -GlobalDecoderRegistry.register(UninterpretedOption_NamePart.typeUrl, UninterpretedOption_NamePart); function createBaseSourceCodeInfo(): SourceCodeInfo { return { location: [] @@ -7123,9 +7237,14 @@ export const SourceCodeInfo = { typeUrl: "/google.protobuf.SourceCodeInfo", value: SourceCodeInfo.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(SourceCodeInfo.typeUrl)) { + return; + } + SourceCodeInfo_Location.registerTypeUrl(); } }; -GlobalDecoderRegistry.register(SourceCodeInfo.typeUrl, SourceCodeInfo); function createBaseSourceCodeInfo_Location(): SourceCodeInfo_Location { return { path: [], @@ -7342,9 +7461,9 @@ export const SourceCodeInfo_Location = { typeUrl: "/google.protobuf.Location", value: SourceCodeInfo_Location.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; -GlobalDecoderRegistry.register(SourceCodeInfo_Location.typeUrl, SourceCodeInfo_Location); function createBaseGeneratedCodeInfo(): GeneratedCodeInfo { return { annotation: [] @@ -7458,9 +7577,14 @@ export const GeneratedCodeInfo = { typeUrl: "/google.protobuf.GeneratedCodeInfo", value: GeneratedCodeInfo.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GeneratedCodeInfo.typeUrl)) { + return; + } + GeneratedCodeInfo_Annotation.registerTypeUrl(); } }; -GlobalDecoderRegistry.register(GeneratedCodeInfo.typeUrl, GeneratedCodeInfo); function createBaseGeneratedCodeInfo_Annotation(): GeneratedCodeInfo_Annotation { return { path: [], @@ -7631,9 +7755,9 @@ export const GeneratedCodeInfo_Annotation = { typeUrl: "/google.protobuf.Annotation", value: GeneratedCodeInfo_Annotation.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; -GlobalDecoderRegistry.register(GeneratedCodeInfo_Annotation.typeUrl, GeneratedCodeInfo_Annotation); function createBaseFeatureSet(): FeatureSet { return { utf8Validation: 1 @@ -7734,6 +7858,6 @@ export const FeatureSet = { typeUrl: "/google.protobuf.FeatureSet", value: FeatureSet.encode(message).finish() }; - } -}; -GlobalDecoderRegistry.register(FeatureSet.typeUrl, FeatureSet); \ No newline at end of file + }, + registerTypeUrl() {} +}; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/google/protobuf/duration.ts b/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/google/protobuf/duration.ts index 626063d137..c36837ce68 100644 --- a/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/google/protobuf/duration.ts +++ b/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/google/protobuf/duration.ts @@ -1,7 +1,6 @@ import { BinaryReader, BinaryWriter } from "../../binary"; import { isSet, DeepPartial } from "../../helpers"; import { JsonSafe } from "../../json-safe"; -import { GlobalDecoderRegistry } from "../../registry"; export const protobufPackage = "google.protobuf"; /** * A Duration represents a signed, fixed-length span of time represented @@ -393,6 +392,6 @@ export const Duration = { typeUrl: "/google.protobuf.Duration", value: Duration.encode(message).finish() }; - } -}; -GlobalDecoderRegistry.register(Duration.typeUrl, Duration); \ No newline at end of file + }, + registerTypeUrl() {} +}; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/google/protobuf/timestamp.ts b/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/google/protobuf/timestamp.ts index 7d74768022..bfe689766f 100644 --- a/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/google/protobuf/timestamp.ts +++ b/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/google/protobuf/timestamp.ts @@ -1,7 +1,6 @@ import { BinaryReader, BinaryWriter } from "../../binary"; import { isSet, DeepPartial, fromJsonTimestamp, fromTimestamp } from "../../helpers"; import { JsonSafe } from "../../json-safe"; -import { GlobalDecoderRegistry } from "../../registry"; export const protobufPackage = "google.protobuf"; /** * A Timestamp represents a point in time independent of any time zone or local @@ -483,6 +482,6 @@ export const Timestamp = { typeUrl: "/google.protobuf.Timestamp", value: Timestamp.encode(message).finish() }; - } -}; -GlobalDecoderRegistry.register(Timestamp.typeUrl, Timestamp); \ No newline at end of file + }, + registerTypeUrl() {} +}; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/helper-func-types.ts b/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/helper-func-types.ts new file mode 100644 index 0000000000..3102611da1 --- /dev/null +++ b/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/helper-func-types.ts @@ -0,0 +1,105 @@ +/** +* This file and any referenced files were automatically generated by @hyperweb/telescope@latest +* DO NOT MODIFY BY HAND. Instead, download the latest proto files for your chain +* and run the transpile command or npm scripts command that is used to regenerate this bundle. +*/ + + +import { HttpEndpoint } from "@interchainjs/types"; +import { BinaryReader, BinaryWriter } from "./binary"; +import { getRpcClient } from "./extern"; +import { isRpc, Rpc } from "./helpers"; +import { TelescopeGeneratedCodec, DeliverTxResponse, Message, StdFee } from "./types"; +import { toConverters, toEncoders } from "@interchainjs/cosmos/utils"; +import { ISigningClient } from "@interchainjs/cosmos/types/signing-client"; + +export interface QueryBuilderOptions { + encode: (request: TReq, writer?: BinaryWriter) => BinaryWriter + decode: (input: BinaryReader | Uint8Array, length?: number) => TRes + service: string, + method: string, + deps?: TelescopeGeneratedCodec[], +} + +export function buildQuery(opts: QueryBuilderOptions) { + registerDependencies(opts.deps ?? []); + + return async (client: EndpointOrRpc, request: TReq) => { + let rpc: Rpc | undefined; + + if(isRpc(client)) { + rpc = client; + } else { + rpc = client ? await getRpcClient(client) : undefined; + } + + if (!rpc) throw new Error("Query Rpc is not initialized"); + + const data = opts.encode(request).finish(); + const response = await rpc.request(opts.service, opts.method, data); + return opts.decode(response); + }; +} + +export interface ITxArgs { + signerAddress: string; + message: TMsg | TMsg[]; + fee: StdFee | 'auto'; + memo: string; +} + +export interface TxBuilderOptions { + msg: TelescopeGeneratedCodec +} + +export function buildTx(opts: TxBuilderOptions) { + if(opts.msg){ + registerDependencies([opts.msg]); + } + + return async ( + client: ISigningClient, + signerAddress: string, + message: TMsg | TMsg[], + fee: StdFee | 'auto', + memo: string + ): Promise => { + if (!client) throw new Error("SigningClient is not initialized"); + + //register all related encoders and converters + client.addEncoders?.(toEncoders(opts.msg)); + client.addConverters?.(toConverters(opts.msg)); + + const data = Array.isArray(message) + ? message.map(msg => ({ + typeUrl: opts.msg.typeUrl, + value: msg, + })) + : [{ + typeUrl: opts.msg.typeUrl, + value: message, + }]; + return client.signAndBroadcast!(signerAddress, data, fee, memo); + }; +} + +export interface Encoder { + typeUrl: string; + fromPartial: (data: any) => any; + encode: (data: any) => Uint8Array; +} + +export interface AminoConverter { + typeUrl: string; + aminoType: string; + fromAmino: (data: any) => any; + toAmino: (data: any) => any; +} + +export type EndpointOrRpc = string | HttpEndpoint | Rpc ; + +function registerDependencies(deps: TelescopeGeneratedCodec[]) { + for (const dep of deps) { + dep.registerTypeUrl?.(); + } +} diff --git a/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/index.ts b/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/index.ts index 11c815b7ad..87d2f34263 100644 --- a/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/index.ts +++ b/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/index.ts @@ -9,6 +9,7 @@ export * from "./google/bundle"; export * from "./misc/bundle"; export * from "./misc/client"; export * from "./extern"; +export * from "./helper-func-types"; export * from "./react-query"; export * from "./mobx"; export * from "./pinia-endpoint"; diff --git a/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/misc/all_fields.ts b/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/misc/all_fields.ts index 75992ff6bd..9d9cac5c12 100644 --- a/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/misc/all_fields.ts +++ b/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/misc/all_fields.ts @@ -5,10 +5,10 @@ import { Timestamp, TimestampAmino, TimestampSDKType } from "../google/protobuf/ import { isSet, toTimestamp, fromTimestamp, bytesFromBase64, base64FromBytes, DeepPartial } from "../helpers"; import { BinaryReader, BinaryWriter } from "../binary"; import { GlobalDecoderRegistry } from "../registry"; -import { Decimal } from "@cosmjs/math"; +import { Decimal } from "@interchainjs/math"; import { JsonSafe } from "../json-safe"; -import { toUtf8, fromBase64, fromUtf8, toBase64 } from "@cosmjs/encoding"; -import { encodePubkey, decodePubkey } from "@cosmjs/proto-signing"; +import { toUtf8, fromBase64, fromUtf8, toBase64 } from "@interchainjs/encoding"; +import { encodePubkey, decodePubkey } from "@interchainjs/pubkey"; export const protobufPackage = "misc"; /** * @name EncodingTestForDontOmit @@ -1802,15 +1802,15 @@ export const EncodingTestForDontOmit = { } else { obj.d_o_auths = message.dOAuths; } - obj.dec = message.dec === "" ? undefined : message.dec; - obj.d_o_dec = message.dODec ?? ""; + obj.dec = message.dec === "" ? undefined : Decimal.fromUserInput(message.dec, 18).atomics; + obj.d_o_dec = Decimal.fromUserInput(message.dODec, 18).atomics ?? ""; if (message.decs) { - obj.decs = message.decs.map(e => e); + obj.decs = message.decs.map(e => Decimal.fromUserInput(e, 18).atomics); } else { obj.decs = message.decs; } if (message.dODecs) { - obj.d_o_decs = message.dODecs.map(e => e); + obj.d_o_decs = message.dODecs.map(e => Decimal.fromUserInput(e, 18).atomics); } else { obj.d_o_decs = message.dODecs; } @@ -1830,9 +1830,9 @@ export const EncodingTestForDontOmit = { typeUrl: "/misc.EncodingTestForDontOmit", value: EncodingTestForDontOmit.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; -GlobalDecoderRegistry.register(EncodingTestForDontOmit.typeUrl, EncodingTestForDontOmit); function createBaseEncodingTestForOmit(): EncodingTestForOmit { return { str: "", @@ -2981,15 +2981,15 @@ export const EncodingTestForOmit = { } else { obj.o_auths = message.oAuths; } - obj.dec = message.dec ?? ""; - obj.o_dec = message.oDec === "" ? undefined : message.oDec; + obj.dec = Decimal.fromUserInput(message.dec, 18).atomics ?? ""; + obj.o_dec = message.oDec === "" ? undefined : Decimal.fromUserInput(message.oDec, 18).atomics; if (message.decs) { - obj.decs = message.decs.map(e => e); + obj.decs = message.decs.map(e => Decimal.fromUserInput(e, 18).atomics); } else { obj.decs = message.decs; } if (message.oDecs) { - obj.o_decs = message.oDecs.map(e => e); + obj.o_decs = message.oDecs.map(e => Decimal.fromUserInput(e, 18).atomics); } else { obj.o_decs = message.oDecs; } @@ -3009,6 +3009,6 @@ export const EncodingTestForOmit = { typeUrl: "/misc.EncodingTestForOmit", value: EncodingTestForOmit.encode(message).finish() }; - } -}; -GlobalDecoderRegistry.register(EncodingTestForOmit.typeUrl, EncodingTestForOmit); \ No newline at end of file + }, + registerTypeUrl() {} +}; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/misc/bundle.ts b/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/misc/bundle.ts index 66f799ded4..0ba89ffd4e 100644 --- a/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/misc/bundle.ts +++ b/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/misc/bundle.ts @@ -1,20 +1,22 @@ -import * as _186 from "./all_fields"; -import * as _187 from "./eval_request"; -import * as _188 from "./nest"; -import * as _189 from "./tx"; -import * as _190 from "./tx.amino"; -import * as _191 from "./tx.registry"; -import * as _192 from "./tx.rpc.msg"; -import * as _193 from "./rpc.tx"; +import * as _200 from "./all_fields"; +import * as _201 from "./eval_request"; +import * as _202 from "./nest"; +import * as _203 from "./tx"; +import * as _204 from "./tx.amino"; +import * as _205 from "./tx.registry"; +import * as _206 from "./tx.rpc.func"; +import * as _207 from "./tx.rpc.msg"; +import * as _208 from "./rpc.tx"; export const misc = { - ..._186, - ..._187, - ..._188, - ..._189, - ..._190, - ..._191, - ..._192, + ..._200, + ..._201, + ..._202, + ..._203, + ..._204, + ..._205, + ..._206, + ..._207, ClientFactory: { - ..._193 + ..._208 } }; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/misc/eval_request.ts b/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/misc/eval_request.ts index 62effbaeb4..15e60322ac 100644 --- a/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/misc/eval_request.ts +++ b/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/misc/eval_request.ts @@ -407,6 +407,9 @@ export const EvalRequest_BindingsEntry = { }, toProto(message: EvalRequest_BindingsEntry): Uint8Array { return EvalRequest_BindingsEntry.encode(message).finish(); + }, + registerTypeUrl() { + ExprValue.registerTypeUrl(); } }; function createBaseEvalRequest_RefsEntry(): EvalRequest_RefsEntry { @@ -512,6 +515,9 @@ export const EvalRequest_RefsEntry = { }, toProto(message: EvalRequest_RefsEntry): Uint8Array { return EvalRequest_RefsEntry.encode(message).finish(); + }, + registerTypeUrl() { + IdRef.registerTypeUrl(); } }; function createBaseEvalRequest(): EvalRequest { @@ -928,9 +934,17 @@ export const EvalRequest = { typeUrl: "/misc.EvalRequest", value: EvalRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(EvalRequest.typeUrl)) { + return; + } + ExprValue.registerTypeUrl(); + IdRef.registerTypeUrl(); + AccessConfig.registerTypeUrl(); + TestNest_Graph.registerTypeUrl(); } }; -GlobalDecoderRegistry.register(EvalRequest.typeUrl, EvalRequest); function createBaseAccessConfig(): AccessConfig { return { sender: "" @@ -1031,9 +1045,9 @@ export const AccessConfig = { typeUrl: "/misc.AccessConfig", value: AccessConfig.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; -GlobalDecoderRegistry.register(AccessConfig.typeUrl, AccessConfig); function createBaseGenericAuthorization(): GenericAuthorization { return { $typeUrl: "/misc.GenericAuthorization", @@ -1135,6 +1149,11 @@ export const GenericAuthorization = { typeUrl: "/misc.GenericAuthorization", value: GenericAuthorization.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GenericAuthorization.typeUrl)) { + return; + } + GlobalDecoderRegistry.register(GenericAuthorization.typeUrl, GenericAuthorization); } -}; -GlobalDecoderRegistry.register(GenericAuthorization.typeUrl, GenericAuthorization); \ No newline at end of file +}; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/misc/nest.ts b/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/misc/nest.ts index 71ec850bf9..7cd686a036 100644 --- a/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/misc/nest.ts +++ b/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/misc/nest.ts @@ -1,7 +1,6 @@ import { BinaryReader, BinaryWriter } from "../binary"; import { isSet, DeepPartial } from "../helpers"; import { JsonSafe } from "../json-safe"; -import { GlobalDecoderRegistry } from "../registry"; export const protobufPackage = "misc"; /** * @name TestNest @@ -167,9 +166,9 @@ export const TestNest = { typeUrl: "/misc.TestNest", value: TestNest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; -GlobalDecoderRegistry.register(TestNest.typeUrl, TestNest); function createBaseTestNest_Graph(): TestNest_Graph { return { name: "" @@ -270,6 +269,6 @@ export const TestNest_Graph = { typeUrl: "/misc.Graph", value: TestNest_Graph.encode(message).finish() }; - } -}; -GlobalDecoderRegistry.register(TestNest_Graph.typeUrl, TestNest_Graph); \ No newline at end of file + }, + registerTypeUrl() {} +}; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/misc/tx.registry.ts b/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/misc/tx.registry.ts index 1d15c5745c..9ee2c16c01 100644 --- a/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/misc/tx.registry.ts +++ b/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/misc/tx.registry.ts @@ -1,12 +1,7 @@ import { EncodingTestForDontOmit, EncodingTestForDontOmitSDKType, EncodingTestForOmit, EncodingTestForOmitSDKType } from "./all_fields"; -import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { TelescopeGeneratedType } from "../types"; import { InputMsg, InputMsgSDKType } from "./tx"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/misc.InputMsg", InputMsg]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/misc.InputMsg", InputMsg]]; export const MessageComposer = { encoded: { sendMsg(value: InputMsg) { diff --git a/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/misc/tx.rpc.func.ts b/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/misc/tx.rpc.func.ts new file mode 100644 index 0000000000..e3a3906134 --- /dev/null +++ b/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/misc/tx.rpc.func.ts @@ -0,0 +1,12 @@ +import { EncodingTestForDontOmit, EncodingTestForDontOmitSDKType, EncodingTestForOmit, EncodingTestForOmitSDKType } from "./all_fields"; +import { buildTx } from "../helper-func-types"; +import { InputMsg, InputMsgSDKType, MsgResponse, MsgResponseSDKType } from "./tx"; +/** + * test tx + * @name sendMsg + * @package misc + * @see proto service: misc.SendMsg + */ +export const sendMsg = buildTx({ + msg: InputMsg +}); \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/misc/tx.rpc.msg.ts b/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/misc/tx.rpc.msg.ts index 6d03a2bcb5..c4e3a250fa 100644 --- a/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/misc/tx.rpc.msg.ts +++ b/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/misc/tx.rpc.msg.ts @@ -1,5 +1,5 @@ import { EncodingTestForDontOmit, EncodingTestForDontOmitSDKType, EncodingTestForOmit, EncodingTestForOmitSDKType } from "./all_fields"; -import { Rpc } from "../helpers"; +import { TxRpc } from "../types"; import { BinaryReader } from "../binary"; import { InputMsg, InputMsgSDKType, MsgResponse, MsgResponseSDKType } from "./tx"; export interface Msg { @@ -7,8 +7,8 @@ export interface Msg { sendMsg(request: InputMsg): Promise; } export class MsgClientImpl implements Msg { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.sendMsg = this.sendMsg.bind(this); } @@ -18,6 +18,6 @@ export class MsgClientImpl implements Msg { return promise.then(data => MsgResponse.decode(new BinaryReader(data))); } } -export const createClientImpl = (rpc: Rpc) => { +export const createClientImpl = (rpc: TxRpc) => { return new MsgClientImpl(rpc); }; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/misc/tx.ts b/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/misc/tx.ts index 4ce029593e..632b8943a3 100644 --- a/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/misc/tx.ts +++ b/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/misc/tx.ts @@ -197,9 +197,15 @@ export const InputMsg = { typeUrl: "/misc.InputMsg", value: InputMsg.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(InputMsg.typeUrl)) { + return; + } + EncodingTestForDontOmit.registerTypeUrl(); + EncodingTestForOmit.registerTypeUrl(); } }; -GlobalDecoderRegistry.register(InputMsg.typeUrl, InputMsg); function createBaseMsgResponse(): MsgResponse { return {}; } @@ -281,6 +287,6 @@ export const MsgResponse = { typeUrl: "/misc.MsgResponse", value: MsgResponse.encode(message).finish() }; - } -}; -GlobalDecoderRegistry.register(MsgResponse.typeUrl, MsgResponse); \ No newline at end of file + }, + registerTypeUrl() {} +}; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/types.ts b/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/types.ts index b2016c1a9d..1acee677e2 100644 --- a/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/types.ts +++ b/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/types.ts @@ -6,8 +6,14 @@ import { IBinaryReader, IBinaryWriter } from "./binary"; import { Any } from "./google/protobuf/any"; -import { OfflineSigner } from "@cosmjs/proto-signing"; -import { HttpEndpoint } from "@cosmjs/tendermint-rpc"; + +import { HttpEndpoint } from "@interchainjs/types"; + + +import { DeliverTxResponse, Event, Attribute } from "@interchainjs/types"; + +export { DeliverTxResponse } + export type ProtoMsg = Omit & { typeUrl: any }; @@ -87,56 +93,6 @@ export interface StdFee { } -export interface MsgData { - msgType: string; - data: Uint8Array; -} -export interface Attribute { - key: string; - value: string; - index?: boolean; -} -export interface Event { - type: string; - attributes: readonly Attribute[]; -} - -/** - * The response after successfully broadcasting a transaction. - * Success or failure refer to the execution result. - */ -export interface DeliverTxResponse { - height: number; - /** The position of the transaction within the block. This is a 0-based index. */ - txIndex: number; - /** Error code. The transaction suceeded if and only if code is 0. */ - code: number; - transactionHash: string; - events: readonly Event[]; - /** - * A string-based log document. - * - * This currently seems to merge attributes of multiple events into one event per type - * (https://github.com/tendermint/tendermint/issues/9595). You might want to use the `events` - * field instead. - */ - rawLog?: string; - /** @deprecated Use `msgResponses` instead. */ - data?: readonly MsgData[]; - /** - * The message responses of the [TxMsgData](https://github.com/cosmos/cosmos-sdk/blob/v0.46.3/proto/cosmos/base/abci/v1beta1/abci.proto#L128-L140) - * as `Any`s. - * This field is an empty list for chains running Cosmos SDK < 0.46. - */ - msgResponses: Array<{ - typeUrl: string; - value: Uint8Array; - }>; - gasUsed: bigint; - gasWanted: bigint; - origin?: any; -} - export interface TxRpc { request( service: string, @@ -151,8 +107,3 @@ export interface TxRpc { ): Promise; } -export interface SigningClientParams { - rpcEndpoint: string | HttpEndpoint; - signer: OfflineSigner; -} - diff --git a/__fixtures__/misc/output-proto-amino/amino-interface/extern.ts b/__fixtures__/misc/output-proto-amino/amino-interface/extern.ts index c3e7cbcac8..83d6864ae2 100644 --- a/__fixtures__/misc/output-proto-amino/amino-interface/extern.ts +++ b/__fixtures__/misc/output-proto-amino/amino-interface/extern.ts @@ -4,30 +4,45 @@ * and run the transpile command or npm scripts command that is used to regenerate this bundle. */ -import { QueryClient, createProtobufRpcClient, ProtobufRpcClient } from '@cosmjs/stargate' -import { Tendermint34Client, HttpEndpoint } from "@cosmjs/tendermint-rpc"; -const _rpcClients: Record = {}; +import { HttpEndpoint } from "@interchainjs/types"; +import { Rpc } from "./helpers"; +import { ClientOptions, createCosmosQueryClient } from "@interchainjs/cosmos"; + +const _rpcClients: Record = {}; export const getRpcEndpointKey = (rpcEndpoint: string | HttpEndpoint) => { - if (typeof rpcEndpoint === 'string') { - return rpcEndpoint; - } else if (!!rpcEndpoint) { - //@ts-ignore - return rpcEndpoint.url; - } + if (typeof rpcEndpoint === 'string') { + return rpcEndpoint; + } else if (!!rpcEndpoint) { + //@ts-ignore + return rpcEndpoint.url; + } } export const getRpcClient = async (rpcEndpoint: string | HttpEndpoint) => { - const key = getRpcEndpointKey(rpcEndpoint); - if (!key) return; - if (_rpcClients.hasOwnProperty(key)) { - return _rpcClients[key]; - } - const tmClient = await Tendermint34Client.connect(rpcEndpoint); - //@ts-ignore - const client = new QueryClient(tmClient); - const rpc = createProtobufRpcClient(client); - _rpcClients[key] = rpc; - return rpc; + const key = getRpcEndpointKey(rpcEndpoint); + if (!key) return; + if (_rpcClients.hasOwnProperty(key)) { + return _rpcClients[key]; + } + const rpc = await createRpcClient(rpcEndpoint); + _rpcClients[key] = rpc; + return rpc; +} + +export const createRpcClient = async (rpcEndpoint: string | HttpEndpoint, + options?: ClientOptions +) => { + if (typeof rpcEndpoint === 'string') { + return createCosmosQueryClient(rpcEndpoint, options); + } else { + const endpointStr = rpcEndpoint.url; + const clientOptions = { + ...options, + headers: rpcEndpoint.headers + }; + + return createCosmosQueryClient(endpointStr, clientOptions); + } } diff --git a/__fixtures__/misc/output-proto-amino/amino-interface/gogoproto/bundle.ts b/__fixtures__/misc/output-proto-amino/amino-interface/gogoproto/bundle.ts index 5e40d37e20..7d25be6a3f 100644 --- a/__fixtures__/misc/output-proto-amino/amino-interface/gogoproto/bundle.ts +++ b/__fixtures__/misc/output-proto-amino/amino-interface/gogoproto/bundle.ts @@ -1,4 +1,4 @@ -import * as _166 from "./gogo"; +import * as _179 from "./gogo"; export const gogoproto = { - ..._166 + ..._179 }; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/amino-interface/google/api/expr/v1alpha1/eval.ts b/__fixtures__/misc/output-proto-amino/amino-interface/google/api/expr/v1alpha1/eval.ts index c1134e55c5..ba132c84b4 100644 --- a/__fixtures__/misc/output-proto-amino/amino-interface/google/api/expr/v1alpha1/eval.ts +++ b/__fixtures__/misc/output-proto-amino/amino-interface/google/api/expr/v1alpha1/eval.ts @@ -189,9 +189,14 @@ export const ExprValue = { typeUrl: "/google.api.expr.v1alpha1.ExprValue", value: ExprValue.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ExprValue.typeUrl)) { + return; + } + IdRef.registerTypeUrl(); } }; -GlobalDecoderRegistry.register(ExprValue.typeUrl, ExprValue); function createBaseIdRef(): IdRef { return { id: 0 @@ -292,6 +297,6 @@ export const IdRef = { typeUrl: "/google.api.expr.v1alpha1.IdRef", value: IdRef.encode(message).finish() }; - } -}; -GlobalDecoderRegistry.register(IdRef.typeUrl, IdRef); \ No newline at end of file + }, + registerTypeUrl() {} +}; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/amino-interface/google/bundle.ts b/__fixtures__/misc/output-proto-amino/amino-interface/google/bundle.ts index 56d8238265..ac7bbc35b2 100644 --- a/__fixtures__/misc/output-proto-amino/amino-interface/google/bundle.ts +++ b/__fixtures__/misc/output-proto-amino/amino-interface/google/bundle.ts @@ -1,20 +1,20 @@ -import * as _167 from "./api/expr/v1alpha1/eval"; -import * as _168 from "./protobuf/any"; -import * as _169 from "./protobuf/descriptor"; -import * as _170 from "./protobuf/duration"; -import * as _171 from "./protobuf/timestamp"; +import * as _180 from "./api/expr/v1alpha1/eval"; +import * as _181 from "./protobuf/any"; +import * as _182 from "./protobuf/descriptor"; +import * as _183 from "./protobuf/duration"; +import * as _184 from "./protobuf/timestamp"; export namespace google { export namespace api { export namespace expr { export const v1alpha1 = { - ..._167 + ..._180 }; } } export const protobuf = { - ..._168, - ..._169, - ..._170, - ..._171 + ..._181, + ..._182, + ..._183, + ..._184 }; } \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/amino-interface/google/protobuf/any.ts b/__fixtures__/misc/output-proto-amino/amino-interface/google/protobuf/any.ts index 61a6453114..d547abe8d4 100644 --- a/__fixtures__/misc/output-proto-amino/amino-interface/google/protobuf/any.ts +++ b/__fixtures__/misc/output-proto-amino/amino-interface/google/protobuf/any.ts @@ -533,5 +533,6 @@ export const Any = { typeUrl: "/google.protobuf.Any", value: Any.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/amino-interface/google/protobuf/descriptor.ts b/__fixtures__/misc/output-proto-amino/amino-interface/google/protobuf/descriptor.ts index 9043e3ed91..67d9b3398c 100644 --- a/__fixtures__/misc/output-proto-amino/amino-interface/google/protobuf/descriptor.ts +++ b/__fixtures__/misc/output-proto-amino/amino-interface/google/protobuf/descriptor.ts @@ -2852,9 +2852,14 @@ export const FileDescriptorSet = { typeUrl: "/google.protobuf.FileDescriptorSet", value: FileDescriptorSet.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(FileDescriptorSet.typeUrl)) { + return; + } + FileDescriptorProto.registerTypeUrl(); } }; -GlobalDecoderRegistry.register(FileDescriptorSet.typeUrl, FileDescriptorSet); function createBaseFileDescriptorProto(): FileDescriptorProto { return { name: "", @@ -3235,9 +3240,19 @@ export const FileDescriptorProto = { typeUrl: "/google.protobuf.FileDescriptorProto", value: FileDescriptorProto.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(FileDescriptorProto.typeUrl)) { + return; + } + DescriptorProto.registerTypeUrl(); + EnumDescriptorProto.registerTypeUrl(); + ServiceDescriptorProto.registerTypeUrl(); + FieldDescriptorProto.registerTypeUrl(); + FileOptions.registerTypeUrl(); + SourceCodeInfo.registerTypeUrl(); } }; -GlobalDecoderRegistry.register(FileDescriptorProto.typeUrl, FileDescriptorProto); function createBaseDescriptorProto(): DescriptorProto { return { name: "", @@ -3574,9 +3589,20 @@ export const DescriptorProto = { typeUrl: "/google.protobuf.DescriptorProto", value: DescriptorProto.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(DescriptorProto.typeUrl)) { + return; + } + FieldDescriptorProto.registerTypeUrl(); + DescriptorProto.registerTypeUrl(); + EnumDescriptorProto.registerTypeUrl(); + DescriptorProto_ExtensionRange.registerTypeUrl(); + OneofDescriptorProto.registerTypeUrl(); + MessageOptions.registerTypeUrl(); + DescriptorProto_ReservedRange.registerTypeUrl(); } }; -GlobalDecoderRegistry.register(DescriptorProto.typeUrl, DescriptorProto); function createBaseDescriptorProto_ExtensionRange(): DescriptorProto_ExtensionRange { return { start: 0, @@ -3713,9 +3739,14 @@ export const DescriptorProto_ExtensionRange = { typeUrl: "/google.protobuf.ExtensionRange", value: DescriptorProto_ExtensionRange.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(DescriptorProto_ExtensionRange.typeUrl)) { + return; + } + ExtensionRangeOptions.registerTypeUrl(); } }; -GlobalDecoderRegistry.register(DescriptorProto_ExtensionRange.typeUrl, DescriptorProto_ExtensionRange); function createBaseDescriptorProto_ReservedRange(): DescriptorProto_ReservedRange { return { start: 0, @@ -3836,9 +3867,9 @@ export const DescriptorProto_ReservedRange = { typeUrl: "/google.protobuf.ReservedRange", value: DescriptorProto_ReservedRange.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; -GlobalDecoderRegistry.register(DescriptorProto_ReservedRange.typeUrl, DescriptorProto_ReservedRange); function createBaseExtensionRangeOptions(): ExtensionRangeOptions { return { uninterpretedOption: [] @@ -3949,9 +3980,14 @@ export const ExtensionRangeOptions = { typeUrl: "/google.protobuf.ExtensionRangeOptions", value: ExtensionRangeOptions.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ExtensionRangeOptions.typeUrl)) { + return; + } + UninterpretedOption.registerTypeUrl(); } }; -GlobalDecoderRegistry.register(ExtensionRangeOptions.typeUrl, ExtensionRangeOptions); function createBaseFieldDescriptorProto(): FieldDescriptorProto { return { name: "", @@ -4208,9 +4244,14 @@ export const FieldDescriptorProto = { typeUrl: "/google.protobuf.FieldDescriptorProto", value: FieldDescriptorProto.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(FieldDescriptorProto.typeUrl)) { + return; + } + FieldOptions.registerTypeUrl(); } }; -GlobalDecoderRegistry.register(FieldDescriptorProto.typeUrl, FieldDescriptorProto); function createBaseOneofDescriptorProto(): OneofDescriptorProto { return { name: "", @@ -4331,9 +4372,14 @@ export const OneofDescriptorProto = { typeUrl: "/google.protobuf.OneofDescriptorProto", value: OneofDescriptorProto.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(OneofDescriptorProto.typeUrl)) { + return; + } + OneofOptions.registerTypeUrl(); } }; -GlobalDecoderRegistry.register(OneofDescriptorProto.typeUrl, OneofDescriptorProto); function createBaseEnumDescriptorProto(): EnumDescriptorProto { return { name: "", @@ -4535,9 +4581,16 @@ export const EnumDescriptorProto = { typeUrl: "/google.protobuf.EnumDescriptorProto", value: EnumDescriptorProto.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(EnumDescriptorProto.typeUrl)) { + return; + } + EnumValueDescriptorProto.registerTypeUrl(); + EnumOptions.registerTypeUrl(); + EnumDescriptorProto_EnumReservedRange.registerTypeUrl(); } }; -GlobalDecoderRegistry.register(EnumDescriptorProto.typeUrl, EnumDescriptorProto); function createBaseEnumDescriptorProto_EnumReservedRange(): EnumDescriptorProto_EnumReservedRange { return { start: 0, @@ -4661,9 +4714,9 @@ export const EnumDescriptorProto_EnumReservedRange = { typeUrl: "/google.protobuf.EnumReservedRange", value: EnumDescriptorProto_EnumReservedRange.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; -GlobalDecoderRegistry.register(EnumDescriptorProto_EnumReservedRange.typeUrl, EnumDescriptorProto_EnumReservedRange); function createBaseEnumValueDescriptorProto(): EnumValueDescriptorProto { return { name: "", @@ -4801,9 +4854,14 @@ export const EnumValueDescriptorProto = { typeUrl: "/google.protobuf.EnumValueDescriptorProto", value: EnumValueDescriptorProto.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(EnumValueDescriptorProto.typeUrl)) { + return; + } + EnumValueOptions.registerTypeUrl(); } }; -GlobalDecoderRegistry.register(EnumValueDescriptorProto.typeUrl, EnumValueDescriptorProto); function createBaseServiceDescriptorProto(): ServiceDescriptorProto { return { name: "", @@ -4951,9 +5009,15 @@ export const ServiceDescriptorProto = { typeUrl: "/google.protobuf.ServiceDescriptorProto", value: ServiceDescriptorProto.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ServiceDescriptorProto.typeUrl)) { + return; + } + MethodDescriptorProto.registerTypeUrl(); + ServiceOptions.registerTypeUrl(); } }; -GlobalDecoderRegistry.register(ServiceDescriptorProto.typeUrl, ServiceDescriptorProto); function createBaseMethodDescriptorProto(): MethodDescriptorProto { return { name: "", @@ -5142,9 +5206,14 @@ export const MethodDescriptorProto = { typeUrl: "/google.protobuf.MethodDescriptorProto", value: MethodDescriptorProto.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MethodDescriptorProto.typeUrl)) { + return; + } + MethodOptions.registerTypeUrl(); } }; -GlobalDecoderRegistry.register(MethodDescriptorProto.typeUrl, MethodDescriptorProto); function createBaseFileOptions(): FileOptions { return { javaPackage: "", @@ -5595,9 +5664,14 @@ export const FileOptions = { typeUrl: "/google.protobuf.FileOptions", value: FileOptions.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(FileOptions.typeUrl)) { + return; + } + UninterpretedOption.registerTypeUrl(); } }; -GlobalDecoderRegistry.register(FileOptions.typeUrl, FileOptions); function createBaseMessageOptions(): MessageOptions { return { messageSetWireFormat: false, @@ -5776,9 +5850,14 @@ export const MessageOptions = { typeUrl: "/google.protobuf.MessageOptions", value: MessageOptions.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MessageOptions.typeUrl)) { + return; + } + UninterpretedOption.registerTypeUrl(); } }; -GlobalDecoderRegistry.register(MessageOptions.typeUrl, MessageOptions); function createBaseFieldOptions(): FieldOptions { return { ctype: 1, @@ -5991,9 +6070,14 @@ export const FieldOptions = { typeUrl: "/google.protobuf.FieldOptions", value: FieldOptions.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(FieldOptions.typeUrl)) { + return; + } + UninterpretedOption.registerTypeUrl(); } }; -GlobalDecoderRegistry.register(FieldOptions.typeUrl, FieldOptions); function createBaseOneofOptions(): OneofOptions { return { uninterpretedOption: [] @@ -6104,9 +6188,14 @@ export const OneofOptions = { typeUrl: "/google.protobuf.OneofOptions", value: OneofOptions.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(OneofOptions.typeUrl)) { + return; + } + UninterpretedOption.registerTypeUrl(); } }; -GlobalDecoderRegistry.register(OneofOptions.typeUrl, OneofOptions); function createBaseEnumOptions(): EnumOptions { return { allowAlias: false, @@ -6251,9 +6340,14 @@ export const EnumOptions = { typeUrl: "/google.protobuf.EnumOptions", value: EnumOptions.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(EnumOptions.typeUrl)) { + return; + } + UninterpretedOption.registerTypeUrl(); } }; -GlobalDecoderRegistry.register(EnumOptions.typeUrl, EnumOptions); function createBaseEnumValueOptions(): EnumValueOptions { return { deprecated: false, @@ -6381,9 +6475,14 @@ export const EnumValueOptions = { typeUrl: "/google.protobuf.EnumValueOptions", value: EnumValueOptions.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(EnumValueOptions.typeUrl)) { + return; + } + UninterpretedOption.registerTypeUrl(); } }; -GlobalDecoderRegistry.register(EnumValueOptions.typeUrl, EnumValueOptions); function createBaseServiceOptions(): ServiceOptions { return { deprecated: false, @@ -6511,9 +6610,14 @@ export const ServiceOptions = { typeUrl: "/google.protobuf.ServiceOptions", value: ServiceOptions.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ServiceOptions.typeUrl)) { + return; + } + UninterpretedOption.registerTypeUrl(); } }; -GlobalDecoderRegistry.register(ServiceOptions.typeUrl, ServiceOptions); function createBaseMethodOptions(): MethodOptions { return { deprecated: false, @@ -6658,9 +6762,14 @@ export const MethodOptions = { typeUrl: "/google.protobuf.MethodOptions", value: MethodOptions.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MethodOptions.typeUrl)) { + return; + } + UninterpretedOption.registerTypeUrl(); } }; -GlobalDecoderRegistry.register(MethodOptions.typeUrl, MethodOptions); function createBaseUninterpretedOption(): UninterpretedOption { return { name: [], @@ -6883,9 +6992,14 @@ export const UninterpretedOption = { typeUrl: "/google.protobuf.UninterpretedOption", value: UninterpretedOption.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(UninterpretedOption.typeUrl)) { + return; + } + UninterpretedOption_NamePart.registerTypeUrl(); } }; -GlobalDecoderRegistry.register(UninterpretedOption.typeUrl, UninterpretedOption); function createBaseUninterpretedOption_NamePart(): UninterpretedOption_NamePart { return { namePart: "", @@ -7008,9 +7122,9 @@ export const UninterpretedOption_NamePart = { typeUrl: "/google.protobuf.NamePart", value: UninterpretedOption_NamePart.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; -GlobalDecoderRegistry.register(UninterpretedOption_NamePart.typeUrl, UninterpretedOption_NamePart); function createBaseSourceCodeInfo(): SourceCodeInfo { return { location: [] @@ -7123,9 +7237,14 @@ export const SourceCodeInfo = { typeUrl: "/google.protobuf.SourceCodeInfo", value: SourceCodeInfo.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(SourceCodeInfo.typeUrl)) { + return; + } + SourceCodeInfo_Location.registerTypeUrl(); } }; -GlobalDecoderRegistry.register(SourceCodeInfo.typeUrl, SourceCodeInfo); function createBaseSourceCodeInfo_Location(): SourceCodeInfo_Location { return { path: [], @@ -7342,9 +7461,9 @@ export const SourceCodeInfo_Location = { typeUrl: "/google.protobuf.Location", value: SourceCodeInfo_Location.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; -GlobalDecoderRegistry.register(SourceCodeInfo_Location.typeUrl, SourceCodeInfo_Location); function createBaseGeneratedCodeInfo(): GeneratedCodeInfo { return { annotation: [] @@ -7458,9 +7577,14 @@ export const GeneratedCodeInfo = { typeUrl: "/google.protobuf.GeneratedCodeInfo", value: GeneratedCodeInfo.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GeneratedCodeInfo.typeUrl)) { + return; + } + GeneratedCodeInfo_Annotation.registerTypeUrl(); } }; -GlobalDecoderRegistry.register(GeneratedCodeInfo.typeUrl, GeneratedCodeInfo); function createBaseGeneratedCodeInfo_Annotation(): GeneratedCodeInfo_Annotation { return { path: [], @@ -7631,9 +7755,9 @@ export const GeneratedCodeInfo_Annotation = { typeUrl: "/google.protobuf.Annotation", value: GeneratedCodeInfo_Annotation.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; -GlobalDecoderRegistry.register(GeneratedCodeInfo_Annotation.typeUrl, GeneratedCodeInfo_Annotation); function createBaseFeatureSet(): FeatureSet { return { utf8Validation: 1 @@ -7734,6 +7858,6 @@ export const FeatureSet = { typeUrl: "/google.protobuf.FeatureSet", value: FeatureSet.encode(message).finish() }; - } -}; -GlobalDecoderRegistry.register(FeatureSet.typeUrl, FeatureSet); \ No newline at end of file + }, + registerTypeUrl() {} +}; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/amino-interface/google/protobuf/duration.ts b/__fixtures__/misc/output-proto-amino/amino-interface/google/protobuf/duration.ts index 626063d137..c36837ce68 100644 --- a/__fixtures__/misc/output-proto-amino/amino-interface/google/protobuf/duration.ts +++ b/__fixtures__/misc/output-proto-amino/amino-interface/google/protobuf/duration.ts @@ -1,7 +1,6 @@ import { BinaryReader, BinaryWriter } from "../../binary"; import { isSet, DeepPartial } from "../../helpers"; import { JsonSafe } from "../../json-safe"; -import { GlobalDecoderRegistry } from "../../registry"; export const protobufPackage = "google.protobuf"; /** * A Duration represents a signed, fixed-length span of time represented @@ -393,6 +392,6 @@ export const Duration = { typeUrl: "/google.protobuf.Duration", value: Duration.encode(message).finish() }; - } -}; -GlobalDecoderRegistry.register(Duration.typeUrl, Duration); \ No newline at end of file + }, + registerTypeUrl() {} +}; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/amino-interface/google/protobuf/timestamp.ts b/__fixtures__/misc/output-proto-amino/amino-interface/google/protobuf/timestamp.ts index 7d74768022..bfe689766f 100644 --- a/__fixtures__/misc/output-proto-amino/amino-interface/google/protobuf/timestamp.ts +++ b/__fixtures__/misc/output-proto-amino/amino-interface/google/protobuf/timestamp.ts @@ -1,7 +1,6 @@ import { BinaryReader, BinaryWriter } from "../../binary"; import { isSet, DeepPartial, fromJsonTimestamp, fromTimestamp } from "../../helpers"; import { JsonSafe } from "../../json-safe"; -import { GlobalDecoderRegistry } from "../../registry"; export const protobufPackage = "google.protobuf"; /** * A Timestamp represents a point in time independent of any time zone or local @@ -483,6 +482,6 @@ export const Timestamp = { typeUrl: "/google.protobuf.Timestamp", value: Timestamp.encode(message).finish() }; - } -}; -GlobalDecoderRegistry.register(Timestamp.typeUrl, Timestamp); \ No newline at end of file + }, + registerTypeUrl() {} +}; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/amino-interface/helper-func-types.ts b/__fixtures__/misc/output-proto-amino/amino-interface/helper-func-types.ts new file mode 100644 index 0000000000..3102611da1 --- /dev/null +++ b/__fixtures__/misc/output-proto-amino/amino-interface/helper-func-types.ts @@ -0,0 +1,105 @@ +/** +* This file and any referenced files were automatically generated by @hyperweb/telescope@latest +* DO NOT MODIFY BY HAND. Instead, download the latest proto files for your chain +* and run the transpile command or npm scripts command that is used to regenerate this bundle. +*/ + + +import { HttpEndpoint } from "@interchainjs/types"; +import { BinaryReader, BinaryWriter } from "./binary"; +import { getRpcClient } from "./extern"; +import { isRpc, Rpc } from "./helpers"; +import { TelescopeGeneratedCodec, DeliverTxResponse, Message, StdFee } from "./types"; +import { toConverters, toEncoders } from "@interchainjs/cosmos/utils"; +import { ISigningClient } from "@interchainjs/cosmos/types/signing-client"; + +export interface QueryBuilderOptions { + encode: (request: TReq, writer?: BinaryWriter) => BinaryWriter + decode: (input: BinaryReader | Uint8Array, length?: number) => TRes + service: string, + method: string, + deps?: TelescopeGeneratedCodec[], +} + +export function buildQuery(opts: QueryBuilderOptions) { + registerDependencies(opts.deps ?? []); + + return async (client: EndpointOrRpc, request: TReq) => { + let rpc: Rpc | undefined; + + if(isRpc(client)) { + rpc = client; + } else { + rpc = client ? await getRpcClient(client) : undefined; + } + + if (!rpc) throw new Error("Query Rpc is not initialized"); + + const data = opts.encode(request).finish(); + const response = await rpc.request(opts.service, opts.method, data); + return opts.decode(response); + }; +} + +export interface ITxArgs { + signerAddress: string; + message: TMsg | TMsg[]; + fee: StdFee | 'auto'; + memo: string; +} + +export interface TxBuilderOptions { + msg: TelescopeGeneratedCodec +} + +export function buildTx(opts: TxBuilderOptions) { + if(opts.msg){ + registerDependencies([opts.msg]); + } + + return async ( + client: ISigningClient, + signerAddress: string, + message: TMsg | TMsg[], + fee: StdFee | 'auto', + memo: string + ): Promise => { + if (!client) throw new Error("SigningClient is not initialized"); + + //register all related encoders and converters + client.addEncoders?.(toEncoders(opts.msg)); + client.addConverters?.(toConverters(opts.msg)); + + const data = Array.isArray(message) + ? message.map(msg => ({ + typeUrl: opts.msg.typeUrl, + value: msg, + })) + : [{ + typeUrl: opts.msg.typeUrl, + value: message, + }]; + return client.signAndBroadcast!(signerAddress, data, fee, memo); + }; +} + +export interface Encoder { + typeUrl: string; + fromPartial: (data: any) => any; + encode: (data: any) => Uint8Array; +} + +export interface AminoConverter { + typeUrl: string; + aminoType: string; + fromAmino: (data: any) => any; + toAmino: (data: any) => any; +} + +export type EndpointOrRpc = string | HttpEndpoint | Rpc ; + +function registerDependencies(deps: TelescopeGeneratedCodec[]) { + for (const dep of deps) { + dep.registerTypeUrl?.(); + } +} diff --git a/__fixtures__/misc/output-proto-amino/amino-interface/index.ts b/__fixtures__/misc/output-proto-amino/amino-interface/index.ts index 11c815b7ad..87d2f34263 100644 --- a/__fixtures__/misc/output-proto-amino/amino-interface/index.ts +++ b/__fixtures__/misc/output-proto-amino/amino-interface/index.ts @@ -9,6 +9,7 @@ export * from "./google/bundle"; export * from "./misc/bundle"; export * from "./misc/client"; export * from "./extern"; +export * from "./helper-func-types"; export * from "./react-query"; export * from "./mobx"; export * from "./pinia-endpoint"; diff --git a/__fixtures__/misc/output-proto-amino/amino-interface/misc/all_fields.ts b/__fixtures__/misc/output-proto-amino/amino-interface/misc/all_fields.ts index 51bffa125c..e1fb068546 100644 --- a/__fixtures__/misc/output-proto-amino/amino-interface/misc/all_fields.ts +++ b/__fixtures__/misc/output-proto-amino/amino-interface/misc/all_fields.ts @@ -5,10 +5,10 @@ import { Timestamp, TimestampAmino, TimestampSDKType } from "../google/protobuf/ import { isSet, toTimestamp, fromTimestamp, bytesFromBase64, base64FromBytes, DeepPartial } from "../helpers"; import { BinaryReader, BinaryWriter } from "../binary"; import { GlobalDecoderRegistry } from "../registry"; -import { Decimal } from "@cosmjs/math"; +import { Decimal } from "@interchainjs/math"; import { JsonSafe } from "../json-safe"; -import { toUtf8, fromBase64, fromUtf8, toBase64 } from "@cosmjs/encoding"; -import { encodePubkey, decodePubkey } from "@cosmjs/proto-signing"; +import { toUtf8, fromBase64, fromUtf8, toBase64 } from "@interchainjs/encoding"; +import { encodePubkey, decodePubkey } from "@interchainjs/pubkey"; export const protobufPackage = "misc"; /** * @name EncodingTestForDontOmit @@ -1802,15 +1802,15 @@ export const EncodingTestForDontOmit = { } else { obj.d_o_auths = message.dOAuths; } - obj.dec = message.dec === "" ? undefined : message.dec; - obj.d_o_dec = message.dODec ?? ""; + obj.dec = message.dec === "" ? undefined : Decimal.fromUserInput(message.dec, 18).atomics; + obj.d_o_dec = Decimal.fromUserInput(message.dODec, 18).atomics ?? ""; if (message.decs) { - obj.decs = message.decs.map(e => e); + obj.decs = message.decs.map(e => Decimal.fromUserInput(e, 18).atomics); } else { obj.decs = message.decs; } if (message.dODecs) { - obj.d_o_decs = message.dODecs.map(e => e); + obj.d_o_decs = message.dODecs.map(e => Decimal.fromUserInput(e, 18).atomics); } else { obj.d_o_decs = message.dODecs; } @@ -1830,9 +1830,9 @@ export const EncodingTestForDontOmit = { typeUrl: "/misc.EncodingTestForDontOmit", value: EncodingTestForDontOmit.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; -GlobalDecoderRegistry.register(EncodingTestForDontOmit.typeUrl, EncodingTestForDontOmit); function createBaseEncodingTestForOmit(): EncodingTestForOmit { return { str: "", @@ -2981,15 +2981,15 @@ export const EncodingTestForOmit = { } else { obj.o_auths = message.oAuths; } - obj.dec = message.dec ?? ""; - obj.o_dec = message.oDec === "" ? undefined : message.oDec; + obj.dec = Decimal.fromUserInput(message.dec, 18).atomics ?? ""; + obj.o_dec = message.oDec === "" ? undefined : Decimal.fromUserInput(message.oDec, 18).atomics; if (message.decs) { - obj.decs = message.decs.map(e => e); + obj.decs = message.decs.map(e => Decimal.fromUserInput(e, 18).atomics); } else { obj.decs = message.decs; } if (message.oDecs) { - obj.o_decs = message.oDecs.map(e => e); + obj.o_decs = message.oDecs.map(e => Decimal.fromUserInput(e, 18).atomics); } else { obj.o_decs = message.oDecs; } @@ -3009,6 +3009,6 @@ export const EncodingTestForOmit = { typeUrl: "/misc.EncodingTestForOmit", value: EncodingTestForOmit.encode(message).finish() }; - } -}; -GlobalDecoderRegistry.register(EncodingTestForOmit.typeUrl, EncodingTestForOmit); \ No newline at end of file + }, + registerTypeUrl() {} +}; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/amino-interface/misc/bundle.ts b/__fixtures__/misc/output-proto-amino/amino-interface/misc/bundle.ts index 8b607402e2..223ae954d9 100644 --- a/__fixtures__/misc/output-proto-amino/amino-interface/misc/bundle.ts +++ b/__fixtures__/misc/output-proto-amino/amino-interface/misc/bundle.ts @@ -1,20 +1,22 @@ -import * as _172 from "./all_fields"; -import * as _173 from "./eval_request"; -import * as _174 from "./nest"; -import * as _175 from "./tx"; -import * as _176 from "./tx.amino"; -import * as _177 from "./tx.registry"; -import * as _178 from "./tx.rpc.msg"; -import * as _179 from "./rpc.tx"; +import * as _185 from "./all_fields"; +import * as _186 from "./eval_request"; +import * as _187 from "./nest"; +import * as _188 from "./tx"; +import * as _189 from "./tx.amino"; +import * as _190 from "./tx.registry"; +import * as _191 from "./tx.rpc.func"; +import * as _192 from "./tx.rpc.msg"; +import * as _193 from "./rpc.tx"; export const misc = { - ..._172, - ..._173, - ..._174, - ..._175, - ..._176, - ..._177, - ..._178, + ..._185, + ..._186, + ..._187, + ..._188, + ..._189, + ..._190, + ..._191, + ..._192, ClientFactory: { - ..._179 + ..._193 } }; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/amino-interface/misc/eval_request.ts b/__fixtures__/misc/output-proto-amino/amino-interface/misc/eval_request.ts index 3c0f21f15c..d91f483aa4 100644 --- a/__fixtures__/misc/output-proto-amino/amino-interface/misc/eval_request.ts +++ b/__fixtures__/misc/output-proto-amino/amino-interface/misc/eval_request.ts @@ -407,6 +407,9 @@ export const EvalRequest_BindingsEntry = { }, toProto(message: EvalRequest_BindingsEntry): Uint8Array { return EvalRequest_BindingsEntry.encode(message).finish(); + }, + registerTypeUrl() { + ExprValue.registerTypeUrl(); } }; function createBaseEvalRequest_RefsEntry(): EvalRequest_RefsEntry { @@ -512,6 +515,9 @@ export const EvalRequest_RefsEntry = { }, toProto(message: EvalRequest_RefsEntry): Uint8Array { return EvalRequest_RefsEntry.encode(message).finish(); + }, + registerTypeUrl() { + IdRef.registerTypeUrl(); } }; function createBaseEvalRequest(): EvalRequest { @@ -928,9 +934,17 @@ export const EvalRequest = { typeUrl: "/misc.EvalRequest", value: EvalRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(EvalRequest.typeUrl)) { + return; + } + ExprValue.registerTypeUrl(); + IdRef.registerTypeUrl(); + AccessConfig.registerTypeUrl(); + TestNest_Graph.registerTypeUrl(); } }; -GlobalDecoderRegistry.register(EvalRequest.typeUrl, EvalRequest); function createBaseAccessConfig(): AccessConfig { return { sender: "" @@ -1031,9 +1045,9 @@ export const AccessConfig = { typeUrl: "/misc.AccessConfig", value: AccessConfig.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; -GlobalDecoderRegistry.register(AccessConfig.typeUrl, AccessConfig); function createBaseGenericAuthorization(): GenericAuthorization { return { $typeUrl: "/misc.GenericAuthorization", @@ -1135,6 +1149,11 @@ export const GenericAuthorization = { typeUrl: "/misc.GenericAuthorization", value: GenericAuthorization.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GenericAuthorization.typeUrl)) { + return; + } + GlobalDecoderRegistry.register(GenericAuthorization.typeUrl, GenericAuthorization); } -}; -GlobalDecoderRegistry.register(GenericAuthorization.typeUrl, GenericAuthorization); \ No newline at end of file +}; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/amino-interface/misc/nest.ts b/__fixtures__/misc/output-proto-amino/amino-interface/misc/nest.ts index 5ab99c2902..32063a6893 100644 --- a/__fixtures__/misc/output-proto-amino/amino-interface/misc/nest.ts +++ b/__fixtures__/misc/output-proto-amino/amino-interface/misc/nest.ts @@ -1,7 +1,6 @@ import { BinaryReader, BinaryWriter } from "../binary"; import { isSet, DeepPartial } from "../helpers"; import { JsonSafe } from "../json-safe"; -import { GlobalDecoderRegistry } from "../registry"; export const protobufPackage = "misc"; /** * @name TestNest @@ -167,9 +166,9 @@ export const TestNest = { typeUrl: "/misc.TestNest", value: TestNest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; -GlobalDecoderRegistry.register(TestNest.typeUrl, TestNest); function createBaseTestNest_Graph(): TestNest_Graph { return { name: "" @@ -270,6 +269,6 @@ export const TestNest_Graph = { typeUrl: "/misc.Graph", value: TestNest_Graph.encode(message).finish() }; - } -}; -GlobalDecoderRegistry.register(TestNest_Graph.typeUrl, TestNest_Graph); \ No newline at end of file + }, + registerTypeUrl() {} +}; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/amino-interface/misc/tx.registry.ts b/__fixtures__/misc/output-proto-amino/amino-interface/misc/tx.registry.ts index 1d15c5745c..9ee2c16c01 100644 --- a/__fixtures__/misc/output-proto-amino/amino-interface/misc/tx.registry.ts +++ b/__fixtures__/misc/output-proto-amino/amino-interface/misc/tx.registry.ts @@ -1,12 +1,7 @@ import { EncodingTestForDontOmit, EncodingTestForDontOmitSDKType, EncodingTestForOmit, EncodingTestForOmitSDKType } from "./all_fields"; -import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { TelescopeGeneratedType } from "../types"; import { InputMsg, InputMsgSDKType } from "./tx"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/misc.InputMsg", InputMsg]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/misc.InputMsg", InputMsg]]; export const MessageComposer = { encoded: { sendMsg(value: InputMsg) { diff --git a/__fixtures__/misc/output-proto-amino/amino-interface/misc/tx.rpc.func.ts b/__fixtures__/misc/output-proto-amino/amino-interface/misc/tx.rpc.func.ts new file mode 100644 index 0000000000..e3a3906134 --- /dev/null +++ b/__fixtures__/misc/output-proto-amino/amino-interface/misc/tx.rpc.func.ts @@ -0,0 +1,12 @@ +import { EncodingTestForDontOmit, EncodingTestForDontOmitSDKType, EncodingTestForOmit, EncodingTestForOmitSDKType } from "./all_fields"; +import { buildTx } from "../helper-func-types"; +import { InputMsg, InputMsgSDKType, MsgResponse, MsgResponseSDKType } from "./tx"; +/** + * test tx + * @name sendMsg + * @package misc + * @see proto service: misc.SendMsg + */ +export const sendMsg = buildTx({ + msg: InputMsg +}); \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/amino-interface/misc/tx.rpc.msg.ts b/__fixtures__/misc/output-proto-amino/amino-interface/misc/tx.rpc.msg.ts index 6d03a2bcb5..c4e3a250fa 100644 --- a/__fixtures__/misc/output-proto-amino/amino-interface/misc/tx.rpc.msg.ts +++ b/__fixtures__/misc/output-proto-amino/amino-interface/misc/tx.rpc.msg.ts @@ -1,5 +1,5 @@ import { EncodingTestForDontOmit, EncodingTestForDontOmitSDKType, EncodingTestForOmit, EncodingTestForOmitSDKType } from "./all_fields"; -import { Rpc } from "../helpers"; +import { TxRpc } from "../types"; import { BinaryReader } from "../binary"; import { InputMsg, InputMsgSDKType, MsgResponse, MsgResponseSDKType } from "./tx"; export interface Msg { @@ -7,8 +7,8 @@ export interface Msg { sendMsg(request: InputMsg): Promise; } export class MsgClientImpl implements Msg { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.sendMsg = this.sendMsg.bind(this); } @@ -18,6 +18,6 @@ export class MsgClientImpl implements Msg { return promise.then(data => MsgResponse.decode(new BinaryReader(data))); } } -export const createClientImpl = (rpc: Rpc) => { +export const createClientImpl = (rpc: TxRpc) => { return new MsgClientImpl(rpc); }; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/amino-interface/misc/tx.ts b/__fixtures__/misc/output-proto-amino/amino-interface/misc/tx.ts index 02f74545a6..5634c0bc14 100644 --- a/__fixtures__/misc/output-proto-amino/amino-interface/misc/tx.ts +++ b/__fixtures__/misc/output-proto-amino/amino-interface/misc/tx.ts @@ -197,9 +197,15 @@ export const InputMsg = { typeUrl: "/misc.InputMsg", value: InputMsg.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(InputMsg.typeUrl)) { + return; + } + EncodingTestForDontOmit.registerTypeUrl(); + EncodingTestForOmit.registerTypeUrl(); } }; -GlobalDecoderRegistry.register(InputMsg.typeUrl, InputMsg); function createBaseMsgResponse(): MsgResponse { return {}; } @@ -281,6 +287,6 @@ export const MsgResponse = { typeUrl: "/misc.MsgResponse", value: MsgResponse.encode(message).finish() }; - } -}; -GlobalDecoderRegistry.register(MsgResponse.typeUrl, MsgResponse); \ No newline at end of file + }, + registerTypeUrl() {} +}; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/amino-interface/types.ts b/__fixtures__/misc/output-proto-amino/amino-interface/types.ts index b2016c1a9d..1acee677e2 100644 --- a/__fixtures__/misc/output-proto-amino/amino-interface/types.ts +++ b/__fixtures__/misc/output-proto-amino/amino-interface/types.ts @@ -6,8 +6,14 @@ import { IBinaryReader, IBinaryWriter } from "./binary"; import { Any } from "./google/protobuf/any"; -import { OfflineSigner } from "@cosmjs/proto-signing"; -import { HttpEndpoint } from "@cosmjs/tendermint-rpc"; + +import { HttpEndpoint } from "@interchainjs/types"; + + +import { DeliverTxResponse, Event, Attribute } from "@interchainjs/types"; + +export { DeliverTxResponse } + export type ProtoMsg = Omit & { typeUrl: any }; @@ -87,56 +93,6 @@ export interface StdFee { } -export interface MsgData { - msgType: string; - data: Uint8Array; -} -export interface Attribute { - key: string; - value: string; - index?: boolean; -} -export interface Event { - type: string; - attributes: readonly Attribute[]; -} - -/** - * The response after successfully broadcasting a transaction. - * Success or failure refer to the execution result. - */ -export interface DeliverTxResponse { - height: number; - /** The position of the transaction within the block. This is a 0-based index. */ - txIndex: number; - /** Error code. The transaction suceeded if and only if code is 0. */ - code: number; - transactionHash: string; - events: readonly Event[]; - /** - * A string-based log document. - * - * This currently seems to merge attributes of multiple events into one event per type - * (https://github.com/tendermint/tendermint/issues/9595). You might want to use the `events` - * field instead. - */ - rawLog?: string; - /** @deprecated Use `msgResponses` instead. */ - data?: readonly MsgData[]; - /** - * The message responses of the [TxMsgData](https://github.com/cosmos/cosmos-sdk/blob/v0.46.3/proto/cosmos/base/abci/v1beta1/abci.proto#L128-L140) - * as `Any`s. - * This field is an empty list for chains running Cosmos SDK < 0.46. - */ - msgResponses: Array<{ - typeUrl: string; - value: Uint8Array; - }>; - gasUsed: bigint; - gasWanted: bigint; - origin?: any; -} - export interface TxRpc { request( service: string, @@ -151,8 +107,3 @@ export interface TxRpc { ): Promise; } -export interface SigningClientParams { - rpcEndpoint: string | HttpEndpoint; - signer: OfflineSigner; -} - diff --git a/__fixtures__/misc/output-proto-amino/amino-legacy/extern.ts b/__fixtures__/misc/output-proto-amino/amino-legacy/extern.ts index c3e7cbcac8..83d6864ae2 100644 --- a/__fixtures__/misc/output-proto-amino/amino-legacy/extern.ts +++ b/__fixtures__/misc/output-proto-amino/amino-legacy/extern.ts @@ -4,30 +4,45 @@ * and run the transpile command or npm scripts command that is used to regenerate this bundle. */ -import { QueryClient, createProtobufRpcClient, ProtobufRpcClient } from '@cosmjs/stargate' -import { Tendermint34Client, HttpEndpoint } from "@cosmjs/tendermint-rpc"; -const _rpcClients: Record = {}; +import { HttpEndpoint } from "@interchainjs/types"; +import { Rpc } from "./helpers"; +import { ClientOptions, createCosmosQueryClient } from "@interchainjs/cosmos"; + +const _rpcClients: Record = {}; export const getRpcEndpointKey = (rpcEndpoint: string | HttpEndpoint) => { - if (typeof rpcEndpoint === 'string') { - return rpcEndpoint; - } else if (!!rpcEndpoint) { - //@ts-ignore - return rpcEndpoint.url; - } + if (typeof rpcEndpoint === 'string') { + return rpcEndpoint; + } else if (!!rpcEndpoint) { + //@ts-ignore + return rpcEndpoint.url; + } } export const getRpcClient = async (rpcEndpoint: string | HttpEndpoint) => { - const key = getRpcEndpointKey(rpcEndpoint); - if (!key) return; - if (_rpcClients.hasOwnProperty(key)) { - return _rpcClients[key]; - } - const tmClient = await Tendermint34Client.connect(rpcEndpoint); - //@ts-ignore - const client = new QueryClient(tmClient); - const rpc = createProtobufRpcClient(client); - _rpcClients[key] = rpc; - return rpc; + const key = getRpcEndpointKey(rpcEndpoint); + if (!key) return; + if (_rpcClients.hasOwnProperty(key)) { + return _rpcClients[key]; + } + const rpc = await createRpcClient(rpcEndpoint); + _rpcClients[key] = rpc; + return rpc; +} + +export const createRpcClient = async (rpcEndpoint: string | HttpEndpoint, + options?: ClientOptions +) => { + if (typeof rpcEndpoint === 'string') { + return createCosmosQueryClient(rpcEndpoint, options); + } else { + const endpointStr = rpcEndpoint.url; + const clientOptions = { + ...options, + headers: rpcEndpoint.headers + }; + + return createCosmosQueryClient(endpointStr, clientOptions); + } } diff --git a/__fixtures__/misc/output-proto-amino/amino-legacy/gogoproto/bundle.ts b/__fixtures__/misc/output-proto-amino/amino-legacy/gogoproto/bundle.ts index 8a5681c38d..f544662853 100644 --- a/__fixtures__/misc/output-proto-amino/amino-legacy/gogoproto/bundle.ts +++ b/__fixtures__/misc/output-proto-amino/amino-legacy/gogoproto/bundle.ts @@ -1,4 +1,4 @@ -import * as _38 from "./gogo"; +import * as _41 from "./gogo"; export const gogoproto = { - ..._38 + ..._41 }; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/amino-legacy/google/bundle.ts b/__fixtures__/misc/output-proto-amino/amino-legacy/google/bundle.ts index 090f844a0c..26d9b2d329 100644 --- a/__fixtures__/misc/output-proto-amino/amino-legacy/google/bundle.ts +++ b/__fixtures__/misc/output-proto-amino/amino-legacy/google/bundle.ts @@ -1,20 +1,20 @@ -import * as _39 from "./api/expr/v1alpha1/eval"; -import * as _40 from "./protobuf/any"; -import * as _41 from "./protobuf/descriptor"; -import * as _42 from "./protobuf/duration"; -import * as _43 from "./protobuf/timestamp"; +import * as _42 from "./api/expr/v1alpha1/eval"; +import * as _43 from "./protobuf/any"; +import * as _44 from "./protobuf/descriptor"; +import * as _45 from "./protobuf/duration"; +import * as _46 from "./protobuf/timestamp"; export namespace google { export namespace api { export namespace expr { export const v1alpha1 = { - ..._39 + ..._42 }; } } export const protobuf = { - ..._40, - ..._41, - ..._42, - ..._43 + ..._43, + ..._44, + ..._45, + ..._46 }; } \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/amino-legacy/helper-func-types.ts b/__fixtures__/misc/output-proto-amino/amino-legacy/helper-func-types.ts new file mode 100644 index 0000000000..5f9d7a87a0 --- /dev/null +++ b/__fixtures__/misc/output-proto-amino/amino-legacy/helper-func-types.ts @@ -0,0 +1,92 @@ +/** +* This file and any referenced files were automatically generated by @hyperweb/telescope@latest +* DO NOT MODIFY BY HAND. Instead, download the latest proto files for your chain +* and run the transpile command or npm scripts command that is used to regenerate this bundle. +*/ + + +import { HttpEndpoint } from "@interchainjs/types"; +import { BinaryReader, BinaryWriter } from "./binary"; +import { getRpcClient } from "./extern"; +import { isRpc, Rpc } from "./helpers"; +import { TelescopeGeneratedCodec, DeliverTxResponse, Message, StdFee } from "./types"; +import { toConverters, toEncoders } from "@interchainjs/cosmos/utils"; +import { ISigningClient } from "@interchainjs/cosmos/types/signing-client"; + +export interface QueryBuilderOptions { + encode: (request: TReq, writer?: BinaryWriter) => BinaryWriter + decode: (input: BinaryReader | Uint8Array, length?: number) => TRes + service: string, + method: string, +} + +export function buildQuery(opts: QueryBuilderOptions) { + return async (client: EndpointOrRpc, request: TReq) => { + let rpc: Rpc | undefined; + + if(isRpc(client)) { + rpc = client; + } else { + rpc = client ? await getRpcClient(client) : undefined; + } + + if (!rpc) throw new Error("Query Rpc is not initialized"); + + const data = opts.encode(request).finish(); + const response = await rpc.request(opts.service, opts.method, data); + return opts.decode(response); + }; +} + +export interface ITxArgs { + signerAddress: string; + message: TMsg | TMsg[]; + fee: StdFee | 'auto'; + memo: string; +} + +export interface TxBuilderOptions { + msg: TelescopeGeneratedCodec +} + +export function buildTx(opts: TxBuilderOptions) { + return async ( + client: ISigningClient, + signerAddress: string, + message: TMsg | TMsg[], + fee: StdFee | 'auto', + memo: string + ): Promise => { + if (!client) throw new Error("SigningClient is not initialized"); + + //register all related encoders and converters + client.addEncoders?.(toEncoders(opts.msg)); + client.addConverters?.(toConverters(opts.msg)); + + const data = Array.isArray(message) + ? message.map(msg => ({ + typeUrl: opts.msg.typeUrl, + value: msg, + })) + : [{ + typeUrl: opts.msg.typeUrl, + value: message, + }]; + return client.signAndBroadcast!(signerAddress, data, fee, memo); + }; +} + +export interface Encoder { + typeUrl: string; + fromPartial: (data: any) => any; + encode: (data: any) => Uint8Array; +} + +export interface AminoConverter { + typeUrl: string; + aminoType: string; + fromAmino: (data: any) => any; + toAmino: (data: any) => any; +} + +export type EndpointOrRpc = string | HttpEndpoint | Rpc ; diff --git a/__fixtures__/misc/output-proto-amino/amino-legacy/index.ts b/__fixtures__/misc/output-proto-amino/amino-legacy/index.ts index 63239ebbce..f6bcc0cdc2 100644 --- a/__fixtures__/misc/output-proto-amino/amino-legacy/index.ts +++ b/__fixtures__/misc/output-proto-amino/amino-legacy/index.ts @@ -9,10 +9,12 @@ export * from "./google/bundle"; export * from "./misc/bundle"; export * from "./misc/client"; export * from "./extern"; +export * from "./helper-func-types"; export * from "./react-query"; export * from "./mobx"; export * from "./pinia-endpoint"; export * from "./json-safe"; export * from "./varint"; export * from "./utf8"; -export * from "./binary"; \ No newline at end of file +export * from "./binary"; +export * from "./types"; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/amino-legacy/misc/all_fields.ts b/__fixtures__/misc/output-proto-amino/amino-legacy/misc/all_fields.ts index b9ea52148f..1c2d132e7e 100644 --- a/__fixtures__/misc/output-proto-amino/amino-legacy/misc/all_fields.ts +++ b/__fixtures__/misc/output-proto-amino/amino-legacy/misc/all_fields.ts @@ -4,10 +4,10 @@ import { Duration, DurationSDKType } from "../google/protobuf/duration"; import { Timestamp, TimestampSDKType } from "../google/protobuf/timestamp"; import { BinaryReader, BinaryWriter } from "../binary"; import { toTimestamp, fromTimestamp, isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../helpers"; -import { Decimal } from "@cosmjs/math"; +import { Decimal } from "@interchainjs/math"; import { JsonSafe } from "../json-safe"; -import { toUtf8, fromBase64, fromUtf8, toBase64 } from "@cosmjs/encoding"; -import { encodePubkey, decodePubkey } from "@cosmjs/proto-signing"; +import { toUtf8, fromBase64, fromUtf8, toBase64 } from "@interchainjs/encoding"; +import { encodePubkey, decodePubkey } from "@interchainjs/pubkey"; export const protobufPackage = "misc"; /** * @name EncodingTestForDontOmit diff --git a/__fixtures__/misc/output-proto-amino/amino-legacy/misc/bundle.ts b/__fixtures__/misc/output-proto-amino/amino-legacy/misc/bundle.ts index 10b20fd1ab..b1bb6ad483 100644 --- a/__fixtures__/misc/output-proto-amino/amino-legacy/misc/bundle.ts +++ b/__fixtures__/misc/output-proto-amino/amino-legacy/misc/bundle.ts @@ -1,20 +1,22 @@ -import * as _44 from "./all_fields"; -import * as _45 from "./eval_request"; -import * as _46 from "./nest"; -import * as _47 from "./tx"; -import * as _48 from "./tx.amino"; -import * as _49 from "./tx.registry"; -import * as _50 from "./tx.rpc.msg"; -import * as _51 from "./rpc.tx"; +import * as _47 from "./all_fields"; +import * as _48 from "./eval_request"; +import * as _49 from "./nest"; +import * as _50 from "./tx"; +import * as _51 from "./tx.amino"; +import * as _52 from "./tx.registry"; +import * as _53 from "./tx.rpc.func"; +import * as _54 from "./tx.rpc.msg"; +import * as _55 from "./rpc.tx"; export const misc = { - ..._44, - ..._45, - ..._46, ..._47, ..._48, ..._49, ..._50, + ..._51, + ..._52, + ..._53, + ..._54, ClientFactory: { - ..._51 + ..._55 } }; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/amino-legacy/misc/tx.amino.ts b/__fixtures__/misc/output-proto-amino/amino-legacy/misc/tx.amino.ts index dc87e9a884..433a820f3b 100644 --- a/__fixtures__/misc/output-proto-amino/amino-legacy/misc/tx.amino.ts +++ b/__fixtures__/misc/output-proto-amino/amino-legacy/misc/tx.amino.ts @@ -1,8 +1,8 @@ import { EncodingTestForDontOmit, EncodingTestForDontOmitSDKType, EncodingTestForOmit, EncodingTestForOmitSDKType } from "./all_fields"; import { AminoMsg, Pubkey } from "@cosmjs/amino"; -import { fromUtf8, toBase64, toUtf8, fromBase64 } from "@cosmjs/encoding"; -import { decodePubkey, encodePubkey } from "@cosmjs/proto-signing"; -import { Decimal } from "@cosmjs/math"; +import { fromUtf8, toBase64, toUtf8, fromBase64 } from "@interchainjs/encoding"; +import { decodePubkey, encodePubkey } from "@interchainjs/pubkey"; +import { Decimal } from "@interchainjs/math"; import { AccessConfig, AccessConfigSDKType, voteOptionFromJSON } from "./eval_request"; import { Any, AnySDKType } from "../google/protobuf/any"; import { Duration, DurationSDKType } from "../google/protobuf/duration"; diff --git a/__fixtures__/misc/output-proto-amino/amino-legacy/misc/tx.registry.ts b/__fixtures__/misc/output-proto-amino/amino-legacy/misc/tx.registry.ts index 1d15c5745c..9ee2c16c01 100644 --- a/__fixtures__/misc/output-proto-amino/amino-legacy/misc/tx.registry.ts +++ b/__fixtures__/misc/output-proto-amino/amino-legacy/misc/tx.registry.ts @@ -1,12 +1,7 @@ import { EncodingTestForDontOmit, EncodingTestForDontOmitSDKType, EncodingTestForOmit, EncodingTestForOmitSDKType } from "./all_fields"; -import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { TelescopeGeneratedType } from "../types"; import { InputMsg, InputMsgSDKType } from "./tx"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/misc.InputMsg", InputMsg]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/misc.InputMsg", InputMsg]]; export const MessageComposer = { encoded: { sendMsg(value: InputMsg) { diff --git a/__fixtures__/misc/output-proto-amino/amino-legacy/misc/tx.rpc.func.ts b/__fixtures__/misc/output-proto-amino/amino-legacy/misc/tx.rpc.func.ts new file mode 100644 index 0000000000..e3a3906134 --- /dev/null +++ b/__fixtures__/misc/output-proto-amino/amino-legacy/misc/tx.rpc.func.ts @@ -0,0 +1,12 @@ +import { EncodingTestForDontOmit, EncodingTestForDontOmitSDKType, EncodingTestForOmit, EncodingTestForOmitSDKType } from "./all_fields"; +import { buildTx } from "../helper-func-types"; +import { InputMsg, InputMsgSDKType, MsgResponse, MsgResponseSDKType } from "./tx"; +/** + * test tx + * @name sendMsg + * @package misc + * @see proto service: misc.SendMsg + */ +export const sendMsg = buildTx({ + msg: InputMsg +}); \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/amino-legacy/misc/tx.rpc.msg.ts b/__fixtures__/misc/output-proto-amino/amino-legacy/misc/tx.rpc.msg.ts index 6d03a2bcb5..c4e3a250fa 100644 --- a/__fixtures__/misc/output-proto-amino/amino-legacy/misc/tx.rpc.msg.ts +++ b/__fixtures__/misc/output-proto-amino/amino-legacy/misc/tx.rpc.msg.ts @@ -1,5 +1,5 @@ import { EncodingTestForDontOmit, EncodingTestForDontOmitSDKType, EncodingTestForOmit, EncodingTestForOmitSDKType } from "./all_fields"; -import { Rpc } from "../helpers"; +import { TxRpc } from "../types"; import { BinaryReader } from "../binary"; import { InputMsg, InputMsgSDKType, MsgResponse, MsgResponseSDKType } from "./tx"; export interface Msg { @@ -7,8 +7,8 @@ export interface Msg { sendMsg(request: InputMsg): Promise; } export class MsgClientImpl implements Msg { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.sendMsg = this.sendMsg.bind(this); } @@ -18,6 +18,6 @@ export class MsgClientImpl implements Msg { return promise.then(data => MsgResponse.decode(new BinaryReader(data))); } } -export const createClientImpl = (rpc: Rpc) => { +export const createClientImpl = (rpc: TxRpc) => { return new MsgClientImpl(rpc); }; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/amino-legacy/types.ts b/__fixtures__/misc/output-proto-amino/amino-legacy/types.ts new file mode 100644 index 0000000000..1acee677e2 --- /dev/null +++ b/__fixtures__/misc/output-proto-amino/amino-legacy/types.ts @@ -0,0 +1,109 @@ +/** +* This file and any referenced files were automatically generated by @hyperweb/telescope@latest +* DO NOT MODIFY BY HAND. Instead, download the latest proto files for your chain +* and run the transpile command or npm scripts command that is used to regenerate this bundle. +*/ + +import { IBinaryReader, IBinaryWriter } from "./binary"; +import { Any } from "./google/protobuf/any"; + +import { HttpEndpoint } from "@interchainjs/types"; + + +import { DeliverTxResponse, Event, Attribute } from "@interchainjs/types"; + +export { DeliverTxResponse } + + +export type ProtoMsg = Omit & { typeUrl: any }; + +export interface IAminoMsg { + type: any; + value: Amino; +} + +export interface IProtoType { + $typeUrl?: any; +} + +/** + * A type generated by Telescope 1.0. + */ +export interface TelescopeGeneratedCodec< + T = unknown, + SDK = unknown, + Amino = unknown +> { + readonly typeUrl: string; + readonly aminoType?: string; + is?(o: unknown): o is T; + isSDK?(o: unknown): o is SDK; + isAmino?(o: unknown): o is Amino; + encode: (message: T, writer?: IBinaryWriter | any) => IBinaryWriter | any; + decode: (input: IBinaryReader | Uint8Array | any, length?: number) => T; + fromPartial: (object: any) => T | any; + fromJSON?: (object: any) => T | any; + toJSON?: (message: T | any) => any; + fromSDK?: (sdk: SDK) => T; + fromSDKJSON?: (object: any) => SDK; + toSDK?: (message: T) => SDK; + fromAmino?: (amino: Amino) => T; + toAmino?: (message: T) => Amino; + fromAminoMsg?: (aminoMsg: IAminoMsg) => T; + toAminoMsg?: (message: T) => IAminoMsg; + toProto?: (message: T) => Uint8Array; + fromProtoMsg?: (message: ProtoMsg) => T; + toProtoMsg?: (message: T) => Any; + registerTypeUrl?: () => void; +} + +export type TelescopeGeneratedType< + T = unknown, + SDK = unknown, + Amino = unknown +> = TelescopeGeneratedCodec; + +export type GeneratedType = TelescopeGeneratedCodec; + +/** + * Coin defines a token with a denomination and an amount. + * + * NOTE: The amount field is an Int which implements the custom method + * signatures required by gogoproto. + */ +interface Coin { + denom: string; + amount: string; +} + +export type EncodeObject = Message; + +export interface Message { + typeUrl: string; + value: T; +} + +export interface StdFee { + amount: Coin[]; + gas: string; + /** The granter address that is used for paying with feegrants */ + granter?: string; + /** The fee payer address. The payer must have signed the transaction. */ + payer?: string; +} + + +export interface TxRpc { + request( + service: string, + method: string, + data: Uint8Array + ): Promise; + signAndBroadcast?( + signerAddress: string, + messages: EncodeObject[], + fee: StdFee | "auto" | number, + memo: string + ): Promise; +} + diff --git a/__fixtures__/misc/output-proto-amino/amino-msg-no-func/extern.ts b/__fixtures__/misc/output-proto-amino/amino-msg-no-func/extern.ts index c3e7cbcac8..83d6864ae2 100644 --- a/__fixtures__/misc/output-proto-amino/amino-msg-no-func/extern.ts +++ b/__fixtures__/misc/output-proto-amino/amino-msg-no-func/extern.ts @@ -4,30 +4,45 @@ * and run the transpile command or npm scripts command that is used to regenerate this bundle. */ -import { QueryClient, createProtobufRpcClient, ProtobufRpcClient } from '@cosmjs/stargate' -import { Tendermint34Client, HttpEndpoint } from "@cosmjs/tendermint-rpc"; -const _rpcClients: Record = {}; +import { HttpEndpoint } from "@interchainjs/types"; +import { Rpc } from "./helpers"; +import { ClientOptions, createCosmosQueryClient } from "@interchainjs/cosmos"; + +const _rpcClients: Record = {}; export const getRpcEndpointKey = (rpcEndpoint: string | HttpEndpoint) => { - if (typeof rpcEndpoint === 'string') { - return rpcEndpoint; - } else if (!!rpcEndpoint) { - //@ts-ignore - return rpcEndpoint.url; - } + if (typeof rpcEndpoint === 'string') { + return rpcEndpoint; + } else if (!!rpcEndpoint) { + //@ts-ignore + return rpcEndpoint.url; + } } export const getRpcClient = async (rpcEndpoint: string | HttpEndpoint) => { - const key = getRpcEndpointKey(rpcEndpoint); - if (!key) return; - if (_rpcClients.hasOwnProperty(key)) { - return _rpcClients[key]; - } - const tmClient = await Tendermint34Client.connect(rpcEndpoint); - //@ts-ignore - const client = new QueryClient(tmClient); - const rpc = createProtobufRpcClient(client); - _rpcClients[key] = rpc; - return rpc; + const key = getRpcEndpointKey(rpcEndpoint); + if (!key) return; + if (_rpcClients.hasOwnProperty(key)) { + return _rpcClients[key]; + } + const rpc = await createRpcClient(rpcEndpoint); + _rpcClients[key] = rpc; + return rpc; +} + +export const createRpcClient = async (rpcEndpoint: string | HttpEndpoint, + options?: ClientOptions +) => { + if (typeof rpcEndpoint === 'string') { + return createCosmosQueryClient(rpcEndpoint, options); + } else { + const endpointStr = rpcEndpoint.url; + const clientOptions = { + ...options, + headers: rpcEndpoint.headers + }; + + return createCosmosQueryClient(endpointStr, clientOptions); + } } diff --git a/__fixtures__/misc/output-proto-amino/amino-msg-no-func/gogoproto/bundle.ts b/__fixtures__/misc/output-proto-amino/amino-msg-no-func/gogoproto/bundle.ts index ed4d507150..03c305f38c 100644 --- a/__fixtures__/misc/output-proto-amino/amino-msg-no-func/gogoproto/bundle.ts +++ b/__fixtures__/misc/output-proto-amino/amino-msg-no-func/gogoproto/bundle.ts @@ -1,4 +1,4 @@ -import * as _138 from "./gogo"; +import * as _149 from "./gogo"; export const gogoproto = { - ..._138 + ..._149 }; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/amino-msg-no-func/google/bundle.ts b/__fixtures__/misc/output-proto-amino/amino-msg-no-func/google/bundle.ts index e1565eb64c..a7c8a8b423 100644 --- a/__fixtures__/misc/output-proto-amino/amino-msg-no-func/google/bundle.ts +++ b/__fixtures__/misc/output-proto-amino/amino-msg-no-func/google/bundle.ts @@ -1,20 +1,20 @@ -import * as _139 from "./api/expr/v1alpha1/eval"; -import * as _140 from "./protobuf/any"; -import * as _141 from "./protobuf/descriptor"; -import * as _142 from "./protobuf/duration"; -import * as _143 from "./protobuf/timestamp"; +import * as _150 from "./api/expr/v1alpha1/eval"; +import * as _151 from "./protobuf/any"; +import * as _152 from "./protobuf/descriptor"; +import * as _153 from "./protobuf/duration"; +import * as _154 from "./protobuf/timestamp"; export namespace google { export namespace api { export namespace expr { export const v1alpha1 = { - ..._139 + ..._150 }; } } export const protobuf = { - ..._140, - ..._141, - ..._142, - ..._143 + ..._151, + ..._152, + ..._153, + ..._154 }; } \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/amino-msg-no-func/helper-func-types.ts b/__fixtures__/misc/output-proto-amino/amino-msg-no-func/helper-func-types.ts new file mode 100644 index 0000000000..5f9d7a87a0 --- /dev/null +++ b/__fixtures__/misc/output-proto-amino/amino-msg-no-func/helper-func-types.ts @@ -0,0 +1,92 @@ +/** +* This file and any referenced files were automatically generated by @hyperweb/telescope@latest +* DO NOT MODIFY BY HAND. Instead, download the latest proto files for your chain +* and run the transpile command or npm scripts command that is used to regenerate this bundle. +*/ + + +import { HttpEndpoint } from "@interchainjs/types"; +import { BinaryReader, BinaryWriter } from "./binary"; +import { getRpcClient } from "./extern"; +import { isRpc, Rpc } from "./helpers"; +import { TelescopeGeneratedCodec, DeliverTxResponse, Message, StdFee } from "./types"; +import { toConverters, toEncoders } from "@interchainjs/cosmos/utils"; +import { ISigningClient } from "@interchainjs/cosmos/types/signing-client"; + +export interface QueryBuilderOptions { + encode: (request: TReq, writer?: BinaryWriter) => BinaryWriter + decode: (input: BinaryReader | Uint8Array, length?: number) => TRes + service: string, + method: string, +} + +export function buildQuery(opts: QueryBuilderOptions) { + return async (client: EndpointOrRpc, request: TReq) => { + let rpc: Rpc | undefined; + + if(isRpc(client)) { + rpc = client; + } else { + rpc = client ? await getRpcClient(client) : undefined; + } + + if (!rpc) throw new Error("Query Rpc is not initialized"); + + const data = opts.encode(request).finish(); + const response = await rpc.request(opts.service, opts.method, data); + return opts.decode(response); + }; +} + +export interface ITxArgs { + signerAddress: string; + message: TMsg | TMsg[]; + fee: StdFee | 'auto'; + memo: string; +} + +export interface TxBuilderOptions { + msg: TelescopeGeneratedCodec +} + +export function buildTx(opts: TxBuilderOptions) { + return async ( + client: ISigningClient, + signerAddress: string, + message: TMsg | TMsg[], + fee: StdFee | 'auto', + memo: string + ): Promise => { + if (!client) throw new Error("SigningClient is not initialized"); + + //register all related encoders and converters + client.addEncoders?.(toEncoders(opts.msg)); + client.addConverters?.(toConverters(opts.msg)); + + const data = Array.isArray(message) + ? message.map(msg => ({ + typeUrl: opts.msg.typeUrl, + value: msg, + })) + : [{ + typeUrl: opts.msg.typeUrl, + value: message, + }]; + return client.signAndBroadcast!(signerAddress, data, fee, memo); + }; +} + +export interface Encoder { + typeUrl: string; + fromPartial: (data: any) => any; + encode: (data: any) => Uint8Array; +} + +export interface AminoConverter { + typeUrl: string; + aminoType: string; + fromAmino: (data: any) => any; + toAmino: (data: any) => any; +} + +export type EndpointOrRpc = string | HttpEndpoint | Rpc ; diff --git a/__fixtures__/misc/output-proto-amino/amino-msg-no-func/index.ts b/__fixtures__/misc/output-proto-amino/amino-msg-no-func/index.ts index 63239ebbce..f6bcc0cdc2 100644 --- a/__fixtures__/misc/output-proto-amino/amino-msg-no-func/index.ts +++ b/__fixtures__/misc/output-proto-amino/amino-msg-no-func/index.ts @@ -9,10 +9,12 @@ export * from "./google/bundle"; export * from "./misc/bundle"; export * from "./misc/client"; export * from "./extern"; +export * from "./helper-func-types"; export * from "./react-query"; export * from "./mobx"; export * from "./pinia-endpoint"; export * from "./json-safe"; export * from "./varint"; export * from "./utf8"; -export * from "./binary"; \ No newline at end of file +export * from "./binary"; +export * from "./types"; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/amino-msg-no-func/misc/all_fields.ts b/__fixtures__/misc/output-proto-amino/amino-msg-no-func/misc/all_fields.ts index 21df8862c3..fb2908c551 100644 --- a/__fixtures__/misc/output-proto-amino/amino-msg-no-func/misc/all_fields.ts +++ b/__fixtures__/misc/output-proto-amino/amino-msg-no-func/misc/all_fields.ts @@ -4,10 +4,10 @@ import { Duration, DurationAmino, DurationSDKType } from "../google/protobuf/dur import { Timestamp, TimestampAmino, TimestampSDKType } from "../google/protobuf/timestamp"; import { BinaryReader, BinaryWriter } from "../binary"; import { toTimestamp, fromTimestamp, isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../helpers"; -import { Decimal } from "@cosmjs/math"; +import { Decimal } from "@interchainjs/math"; import { JsonSafe } from "../json-safe"; -import { toUtf8, fromBase64, fromUtf8, toBase64 } from "@cosmjs/encoding"; -import { encodePubkey, decodePubkey } from "@cosmjs/proto-signing"; +import { toUtf8, fromBase64, fromUtf8, toBase64 } from "@interchainjs/encoding"; +import { encodePubkey, decodePubkey } from "@interchainjs/pubkey"; export const protobufPackage = "misc"; /** * @name EncodingTestForDontOmit @@ -1755,15 +1755,15 @@ export const EncodingTestForDontOmit = { } else { obj.d_o_auths = message.dOAuths; } - obj.dec = message.dec === "" ? undefined : message.dec; - obj.d_o_dec = message.dODec ?? ""; + obj.dec = message.dec === "" ? undefined : Decimal.fromUserInput(message.dec, 18).atomics; + obj.d_o_dec = Decimal.fromUserInput(message.dODec, 18).atomics ?? ""; if (message.decs) { - obj.decs = message.decs.map(e => e); + obj.decs = message.decs.map(e => Decimal.fromUserInput(e, 18).atomics); } else { obj.decs = message.decs; } if (message.dODecs) { - obj.d_o_decs = message.dODecs.map(e => e); + obj.d_o_decs = message.dODecs.map(e => Decimal.fromUserInput(e, 18).atomics); } else { obj.d_o_decs = message.dODecs; } @@ -2921,15 +2921,15 @@ export const EncodingTestForOmit = { } else { obj.o_auths = message.oAuths; } - obj.dec = message.dec ?? ""; - obj.o_dec = message.oDec === "" ? undefined : message.oDec; + obj.dec = Decimal.fromUserInput(message.dec, 18).atomics ?? ""; + obj.o_dec = message.oDec === "" ? undefined : Decimal.fromUserInput(message.oDec, 18).atomics; if (message.decs) { - obj.decs = message.decs.map(e => e); + obj.decs = message.decs.map(e => Decimal.fromUserInput(e, 18).atomics); } else { obj.decs = message.decs; } if (message.oDecs) { - obj.o_decs = message.oDecs.map(e => e); + obj.o_decs = message.oDecs.map(e => Decimal.fromUserInput(e, 18).atomics); } else { obj.o_decs = message.oDecs; } diff --git a/__fixtures__/misc/output-proto-amino/amino-msg-no-func/misc/bundle.ts b/__fixtures__/misc/output-proto-amino/amino-msg-no-func/misc/bundle.ts index 4902db93ff..ec5c892266 100644 --- a/__fixtures__/misc/output-proto-amino/amino-msg-no-func/misc/bundle.ts +++ b/__fixtures__/misc/output-proto-amino/amino-msg-no-func/misc/bundle.ts @@ -1,20 +1,22 @@ -import * as _144 from "./all_fields"; -import * as _145 from "./eval_request"; -import * as _146 from "./nest"; -import * as _147 from "./tx"; -import * as _148 from "./tx.amino"; -import * as _149 from "./tx.registry"; -import * as _150 from "./tx.rpc.msg"; -import * as _151 from "./rpc.tx"; +import * as _155 from "./all_fields"; +import * as _156 from "./eval_request"; +import * as _157 from "./nest"; +import * as _158 from "./tx"; +import * as _159 from "./tx.amino"; +import * as _160 from "./tx.registry"; +import * as _161 from "./tx.rpc.func"; +import * as _162 from "./tx.rpc.msg"; +import * as _163 from "./rpc.tx"; export const misc = { - ..._144, - ..._145, - ..._146, - ..._147, - ..._148, - ..._149, - ..._150, + ..._155, + ..._156, + ..._157, + ..._158, + ..._159, + ..._160, + ..._161, + ..._162, ClientFactory: { - ..._151 + ..._163 } }; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/amino-msg-no-func/misc/tx.registry.ts b/__fixtures__/misc/output-proto-amino/amino-msg-no-func/misc/tx.registry.ts index 1d15c5745c..9ee2c16c01 100644 --- a/__fixtures__/misc/output-proto-amino/amino-msg-no-func/misc/tx.registry.ts +++ b/__fixtures__/misc/output-proto-amino/amino-msg-no-func/misc/tx.registry.ts @@ -1,12 +1,7 @@ import { EncodingTestForDontOmit, EncodingTestForDontOmitSDKType, EncodingTestForOmit, EncodingTestForOmitSDKType } from "./all_fields"; -import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { TelescopeGeneratedType } from "../types"; import { InputMsg, InputMsgSDKType } from "./tx"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/misc.InputMsg", InputMsg]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/misc.InputMsg", InputMsg]]; export const MessageComposer = { encoded: { sendMsg(value: InputMsg) { diff --git a/__fixtures__/misc/output-proto-amino/amino-msg-no-func/misc/tx.rpc.func.ts b/__fixtures__/misc/output-proto-amino/amino-msg-no-func/misc/tx.rpc.func.ts new file mode 100644 index 0000000000..e3a3906134 --- /dev/null +++ b/__fixtures__/misc/output-proto-amino/amino-msg-no-func/misc/tx.rpc.func.ts @@ -0,0 +1,12 @@ +import { EncodingTestForDontOmit, EncodingTestForDontOmitSDKType, EncodingTestForOmit, EncodingTestForOmitSDKType } from "./all_fields"; +import { buildTx } from "../helper-func-types"; +import { InputMsg, InputMsgSDKType, MsgResponse, MsgResponseSDKType } from "./tx"; +/** + * test tx + * @name sendMsg + * @package misc + * @see proto service: misc.SendMsg + */ +export const sendMsg = buildTx({ + msg: InputMsg +}); \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/amino-msg-no-func/misc/tx.rpc.msg.ts b/__fixtures__/misc/output-proto-amino/amino-msg-no-func/misc/tx.rpc.msg.ts index 6d03a2bcb5..c4e3a250fa 100644 --- a/__fixtures__/misc/output-proto-amino/amino-msg-no-func/misc/tx.rpc.msg.ts +++ b/__fixtures__/misc/output-proto-amino/amino-msg-no-func/misc/tx.rpc.msg.ts @@ -1,5 +1,5 @@ import { EncodingTestForDontOmit, EncodingTestForDontOmitSDKType, EncodingTestForOmit, EncodingTestForOmitSDKType } from "./all_fields"; -import { Rpc } from "../helpers"; +import { TxRpc } from "../types"; import { BinaryReader } from "../binary"; import { InputMsg, InputMsgSDKType, MsgResponse, MsgResponseSDKType } from "./tx"; export interface Msg { @@ -7,8 +7,8 @@ export interface Msg { sendMsg(request: InputMsg): Promise; } export class MsgClientImpl implements Msg { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.sendMsg = this.sendMsg.bind(this); } @@ -18,6 +18,6 @@ export class MsgClientImpl implements Msg { return promise.then(data => MsgResponse.decode(new BinaryReader(data))); } } -export const createClientImpl = (rpc: Rpc) => { +export const createClientImpl = (rpc: TxRpc) => { return new MsgClientImpl(rpc); }; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/amino-msg-no-func/types.ts b/__fixtures__/misc/output-proto-amino/amino-msg-no-func/types.ts new file mode 100644 index 0000000000..1acee677e2 --- /dev/null +++ b/__fixtures__/misc/output-proto-amino/amino-msg-no-func/types.ts @@ -0,0 +1,109 @@ +/** +* This file and any referenced files were automatically generated by @hyperweb/telescope@latest +* DO NOT MODIFY BY HAND. Instead, download the latest proto files for your chain +* and run the transpile command or npm scripts command that is used to regenerate this bundle. +*/ + +import { IBinaryReader, IBinaryWriter } from "./binary"; +import { Any } from "./google/protobuf/any"; + +import { HttpEndpoint } from "@interchainjs/types"; + + +import { DeliverTxResponse, Event, Attribute } from "@interchainjs/types"; + +export { DeliverTxResponse } + + +export type ProtoMsg = Omit & { typeUrl: any }; + +export interface IAminoMsg { + type: any; + value: Amino; +} + +export interface IProtoType { + $typeUrl?: any; +} + +/** + * A type generated by Telescope 1.0. + */ +export interface TelescopeGeneratedCodec< + T = unknown, + SDK = unknown, + Amino = unknown +> { + readonly typeUrl: string; + readonly aminoType?: string; + is?(o: unknown): o is T; + isSDK?(o: unknown): o is SDK; + isAmino?(o: unknown): o is Amino; + encode: (message: T, writer?: IBinaryWriter | any) => IBinaryWriter | any; + decode: (input: IBinaryReader | Uint8Array | any, length?: number) => T; + fromPartial: (object: any) => T | any; + fromJSON?: (object: any) => T | any; + toJSON?: (message: T | any) => any; + fromSDK?: (sdk: SDK) => T; + fromSDKJSON?: (object: any) => SDK; + toSDK?: (message: T) => SDK; + fromAmino?: (amino: Amino) => T; + toAmino?: (message: T) => Amino; + fromAminoMsg?: (aminoMsg: IAminoMsg) => T; + toAminoMsg?: (message: T) => IAminoMsg; + toProto?: (message: T) => Uint8Array; + fromProtoMsg?: (message: ProtoMsg) => T; + toProtoMsg?: (message: T) => Any; + registerTypeUrl?: () => void; +} + +export type TelescopeGeneratedType< + T = unknown, + SDK = unknown, + Amino = unknown +> = TelescopeGeneratedCodec; + +export type GeneratedType = TelescopeGeneratedCodec; + +/** + * Coin defines a token with a denomination and an amount. + * + * NOTE: The amount field is an Int which implements the custom method + * signatures required by gogoproto. + */ +interface Coin { + denom: string; + amount: string; +} + +export type EncodeObject = Message; + +export interface Message { + typeUrl: string; + value: T; +} + +export interface StdFee { + amount: Coin[]; + gas: string; + /** The granter address that is used for paying with feegrants */ + granter?: string; + /** The fee payer address. The payer must have signed the transaction. */ + payer?: string; +} + + +export interface TxRpc { + request( + service: string, + method: string, + data: Uint8Array + ): Promise; + signAndBroadcast?( + signerAddress: string, + messages: EncodeObject[], + fee: StdFee | "auto" | number, + memo: string + ): Promise; +} + diff --git a/__fixtures__/misc/output-proto-amino/amino-msg-with-func/extern.ts b/__fixtures__/misc/output-proto-amino/amino-msg-with-func/extern.ts index c3e7cbcac8..83d6864ae2 100644 --- a/__fixtures__/misc/output-proto-amino/amino-msg-with-func/extern.ts +++ b/__fixtures__/misc/output-proto-amino/amino-msg-with-func/extern.ts @@ -4,30 +4,45 @@ * and run the transpile command or npm scripts command that is used to regenerate this bundle. */ -import { QueryClient, createProtobufRpcClient, ProtobufRpcClient } from '@cosmjs/stargate' -import { Tendermint34Client, HttpEndpoint } from "@cosmjs/tendermint-rpc"; -const _rpcClients: Record = {}; +import { HttpEndpoint } from "@interchainjs/types"; +import { Rpc } from "./helpers"; +import { ClientOptions, createCosmosQueryClient } from "@interchainjs/cosmos"; + +const _rpcClients: Record = {}; export const getRpcEndpointKey = (rpcEndpoint: string | HttpEndpoint) => { - if (typeof rpcEndpoint === 'string') { - return rpcEndpoint; - } else if (!!rpcEndpoint) { - //@ts-ignore - return rpcEndpoint.url; - } + if (typeof rpcEndpoint === 'string') { + return rpcEndpoint; + } else if (!!rpcEndpoint) { + //@ts-ignore + return rpcEndpoint.url; + } } export const getRpcClient = async (rpcEndpoint: string | HttpEndpoint) => { - const key = getRpcEndpointKey(rpcEndpoint); - if (!key) return; - if (_rpcClients.hasOwnProperty(key)) { - return _rpcClients[key]; - } - const tmClient = await Tendermint34Client.connect(rpcEndpoint); - //@ts-ignore - const client = new QueryClient(tmClient); - const rpc = createProtobufRpcClient(client); - _rpcClients[key] = rpc; - return rpc; + const key = getRpcEndpointKey(rpcEndpoint); + if (!key) return; + if (_rpcClients.hasOwnProperty(key)) { + return _rpcClients[key]; + } + const rpc = await createRpcClient(rpcEndpoint); + _rpcClients[key] = rpc; + return rpc; +} + +export const createRpcClient = async (rpcEndpoint: string | HttpEndpoint, + options?: ClientOptions +) => { + if (typeof rpcEndpoint === 'string') { + return createCosmosQueryClient(rpcEndpoint, options); + } else { + const endpointStr = rpcEndpoint.url; + const clientOptions = { + ...options, + headers: rpcEndpoint.headers + }; + + return createCosmosQueryClient(endpointStr, clientOptions); + } } diff --git a/__fixtures__/misc/output-proto-amino/amino-msg-with-func/gogoproto/bundle.ts b/__fixtures__/misc/output-proto-amino/amino-msg-with-func/gogoproto/bundle.ts index 77b0e9d5b0..4948fb3a79 100644 --- a/__fixtures__/misc/output-proto-amino/amino-msg-with-func/gogoproto/bundle.ts +++ b/__fixtures__/misc/output-proto-amino/amino-msg-with-func/gogoproto/bundle.ts @@ -1,4 +1,4 @@ -import * as _124 from "./gogo"; +import * as _134 from "./gogo"; export const gogoproto = { - ..._124 + ..._134 }; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/amino-msg-with-func/google/bundle.ts b/__fixtures__/misc/output-proto-amino/amino-msg-with-func/google/bundle.ts index d64f0c97cb..41173fd7bb 100644 --- a/__fixtures__/misc/output-proto-amino/amino-msg-with-func/google/bundle.ts +++ b/__fixtures__/misc/output-proto-amino/amino-msg-with-func/google/bundle.ts @@ -1,20 +1,20 @@ -import * as _125 from "./api/expr/v1alpha1/eval"; -import * as _126 from "./protobuf/any"; -import * as _127 from "./protobuf/descriptor"; -import * as _128 from "./protobuf/duration"; -import * as _129 from "./protobuf/timestamp"; +import * as _135 from "./api/expr/v1alpha1/eval"; +import * as _136 from "./protobuf/any"; +import * as _137 from "./protobuf/descriptor"; +import * as _138 from "./protobuf/duration"; +import * as _139 from "./protobuf/timestamp"; export namespace google { export namespace api { export namespace expr { export const v1alpha1 = { - ..._125 + ..._135 }; } } export const protobuf = { - ..._126, - ..._127, - ..._128, - ..._129 + ..._136, + ..._137, + ..._138, + ..._139 }; } \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/amino-msg-with-func/helper-func-types.ts b/__fixtures__/misc/output-proto-amino/amino-msg-with-func/helper-func-types.ts new file mode 100644 index 0000000000..5f9d7a87a0 --- /dev/null +++ b/__fixtures__/misc/output-proto-amino/amino-msg-with-func/helper-func-types.ts @@ -0,0 +1,92 @@ +/** +* This file and any referenced files were automatically generated by @hyperweb/telescope@latest +* DO NOT MODIFY BY HAND. Instead, download the latest proto files for your chain +* and run the transpile command or npm scripts command that is used to regenerate this bundle. +*/ + + +import { HttpEndpoint } from "@interchainjs/types"; +import { BinaryReader, BinaryWriter } from "./binary"; +import { getRpcClient } from "./extern"; +import { isRpc, Rpc } from "./helpers"; +import { TelescopeGeneratedCodec, DeliverTxResponse, Message, StdFee } from "./types"; +import { toConverters, toEncoders } from "@interchainjs/cosmos/utils"; +import { ISigningClient } from "@interchainjs/cosmos/types/signing-client"; + +export interface QueryBuilderOptions { + encode: (request: TReq, writer?: BinaryWriter) => BinaryWriter + decode: (input: BinaryReader | Uint8Array, length?: number) => TRes + service: string, + method: string, +} + +export function buildQuery(opts: QueryBuilderOptions) { + return async (client: EndpointOrRpc, request: TReq) => { + let rpc: Rpc | undefined; + + if(isRpc(client)) { + rpc = client; + } else { + rpc = client ? await getRpcClient(client) : undefined; + } + + if (!rpc) throw new Error("Query Rpc is not initialized"); + + const data = opts.encode(request).finish(); + const response = await rpc.request(opts.service, opts.method, data); + return opts.decode(response); + }; +} + +export interface ITxArgs { + signerAddress: string; + message: TMsg | TMsg[]; + fee: StdFee | 'auto'; + memo: string; +} + +export interface TxBuilderOptions { + msg: TelescopeGeneratedCodec +} + +export function buildTx(opts: TxBuilderOptions) { + return async ( + client: ISigningClient, + signerAddress: string, + message: TMsg | TMsg[], + fee: StdFee | 'auto', + memo: string + ): Promise => { + if (!client) throw new Error("SigningClient is not initialized"); + + //register all related encoders and converters + client.addEncoders?.(toEncoders(opts.msg)); + client.addConverters?.(toConverters(opts.msg)); + + const data = Array.isArray(message) + ? message.map(msg => ({ + typeUrl: opts.msg.typeUrl, + value: msg, + })) + : [{ + typeUrl: opts.msg.typeUrl, + value: message, + }]; + return client.signAndBroadcast!(signerAddress, data, fee, memo); + }; +} + +export interface Encoder { + typeUrl: string; + fromPartial: (data: any) => any; + encode: (data: any) => Uint8Array; +} + +export interface AminoConverter { + typeUrl: string; + aminoType: string; + fromAmino: (data: any) => any; + toAmino: (data: any) => any; +} + +export type EndpointOrRpc = string | HttpEndpoint | Rpc ; diff --git a/__fixtures__/misc/output-proto-amino/amino-msg-with-func/index.ts b/__fixtures__/misc/output-proto-amino/amino-msg-with-func/index.ts index 63239ebbce..f6bcc0cdc2 100644 --- a/__fixtures__/misc/output-proto-amino/amino-msg-with-func/index.ts +++ b/__fixtures__/misc/output-proto-amino/amino-msg-with-func/index.ts @@ -9,10 +9,12 @@ export * from "./google/bundle"; export * from "./misc/bundle"; export * from "./misc/client"; export * from "./extern"; +export * from "./helper-func-types"; export * from "./react-query"; export * from "./mobx"; export * from "./pinia-endpoint"; export * from "./json-safe"; export * from "./varint"; export * from "./utf8"; -export * from "./binary"; \ No newline at end of file +export * from "./binary"; +export * from "./types"; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/amino-msg-with-func/misc/all_fields.ts b/__fixtures__/misc/output-proto-amino/amino-msg-with-func/misc/all_fields.ts index 21df8862c3..fb2908c551 100644 --- a/__fixtures__/misc/output-proto-amino/amino-msg-with-func/misc/all_fields.ts +++ b/__fixtures__/misc/output-proto-amino/amino-msg-with-func/misc/all_fields.ts @@ -4,10 +4,10 @@ import { Duration, DurationAmino, DurationSDKType } from "../google/protobuf/dur import { Timestamp, TimestampAmino, TimestampSDKType } from "../google/protobuf/timestamp"; import { BinaryReader, BinaryWriter } from "../binary"; import { toTimestamp, fromTimestamp, isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../helpers"; -import { Decimal } from "@cosmjs/math"; +import { Decimal } from "@interchainjs/math"; import { JsonSafe } from "../json-safe"; -import { toUtf8, fromBase64, fromUtf8, toBase64 } from "@cosmjs/encoding"; -import { encodePubkey, decodePubkey } from "@cosmjs/proto-signing"; +import { toUtf8, fromBase64, fromUtf8, toBase64 } from "@interchainjs/encoding"; +import { encodePubkey, decodePubkey } from "@interchainjs/pubkey"; export const protobufPackage = "misc"; /** * @name EncodingTestForDontOmit @@ -1755,15 +1755,15 @@ export const EncodingTestForDontOmit = { } else { obj.d_o_auths = message.dOAuths; } - obj.dec = message.dec === "" ? undefined : message.dec; - obj.d_o_dec = message.dODec ?? ""; + obj.dec = message.dec === "" ? undefined : Decimal.fromUserInput(message.dec, 18).atomics; + obj.d_o_dec = Decimal.fromUserInput(message.dODec, 18).atomics ?? ""; if (message.decs) { - obj.decs = message.decs.map(e => e); + obj.decs = message.decs.map(e => Decimal.fromUserInput(e, 18).atomics); } else { obj.decs = message.decs; } if (message.dODecs) { - obj.d_o_decs = message.dODecs.map(e => e); + obj.d_o_decs = message.dODecs.map(e => Decimal.fromUserInput(e, 18).atomics); } else { obj.d_o_decs = message.dODecs; } @@ -2921,15 +2921,15 @@ export const EncodingTestForOmit = { } else { obj.o_auths = message.oAuths; } - obj.dec = message.dec ?? ""; - obj.o_dec = message.oDec === "" ? undefined : message.oDec; + obj.dec = Decimal.fromUserInput(message.dec, 18).atomics ?? ""; + obj.o_dec = message.oDec === "" ? undefined : Decimal.fromUserInput(message.oDec, 18).atomics; if (message.decs) { - obj.decs = message.decs.map(e => e); + obj.decs = message.decs.map(e => Decimal.fromUserInput(e, 18).atomics); } else { obj.decs = message.decs; } if (message.oDecs) { - obj.o_decs = message.oDecs.map(e => e); + obj.o_decs = message.oDecs.map(e => Decimal.fromUserInput(e, 18).atomics); } else { obj.o_decs = message.oDecs; } diff --git a/__fixtures__/misc/output-proto-amino/amino-msg-with-func/misc/bundle.ts b/__fixtures__/misc/output-proto-amino/amino-msg-with-func/misc/bundle.ts index 08d4010352..5b41f77095 100644 --- a/__fixtures__/misc/output-proto-amino/amino-msg-with-func/misc/bundle.ts +++ b/__fixtures__/misc/output-proto-amino/amino-msg-with-func/misc/bundle.ts @@ -1,20 +1,22 @@ -import * as _130 from "./all_fields"; -import * as _131 from "./eval_request"; -import * as _132 from "./nest"; -import * as _133 from "./tx"; -import * as _134 from "./tx.amino"; -import * as _135 from "./tx.registry"; -import * as _136 from "./tx.rpc.msg"; -import * as _137 from "./rpc.tx"; +import * as _140 from "./all_fields"; +import * as _141 from "./eval_request"; +import * as _142 from "./nest"; +import * as _143 from "./tx"; +import * as _144 from "./tx.amino"; +import * as _145 from "./tx.registry"; +import * as _146 from "./tx.rpc.func"; +import * as _147 from "./tx.rpc.msg"; +import * as _148 from "./rpc.tx"; export const misc = { - ..._130, - ..._131, - ..._132, - ..._133, - ..._134, - ..._135, - ..._136, + ..._140, + ..._141, + ..._142, + ..._143, + ..._144, + ..._145, + ..._146, + ..._147, ClientFactory: { - ..._137 + ..._148 } }; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/amino-msg-with-func/misc/tx.registry.ts b/__fixtures__/misc/output-proto-amino/amino-msg-with-func/misc/tx.registry.ts index 1d15c5745c..9ee2c16c01 100644 --- a/__fixtures__/misc/output-proto-amino/amino-msg-with-func/misc/tx.registry.ts +++ b/__fixtures__/misc/output-proto-amino/amino-msg-with-func/misc/tx.registry.ts @@ -1,12 +1,7 @@ import { EncodingTestForDontOmit, EncodingTestForDontOmitSDKType, EncodingTestForOmit, EncodingTestForOmitSDKType } from "./all_fields"; -import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { TelescopeGeneratedType } from "../types"; import { InputMsg, InputMsgSDKType } from "./tx"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/misc.InputMsg", InputMsg]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/misc.InputMsg", InputMsg]]; export const MessageComposer = { encoded: { sendMsg(value: InputMsg) { diff --git a/__fixtures__/misc/output-proto-amino/amino-msg-with-func/misc/tx.rpc.func.ts b/__fixtures__/misc/output-proto-amino/amino-msg-with-func/misc/tx.rpc.func.ts new file mode 100644 index 0000000000..e3a3906134 --- /dev/null +++ b/__fixtures__/misc/output-proto-amino/amino-msg-with-func/misc/tx.rpc.func.ts @@ -0,0 +1,12 @@ +import { EncodingTestForDontOmit, EncodingTestForDontOmitSDKType, EncodingTestForOmit, EncodingTestForOmitSDKType } from "./all_fields"; +import { buildTx } from "../helper-func-types"; +import { InputMsg, InputMsgSDKType, MsgResponse, MsgResponseSDKType } from "./tx"; +/** + * test tx + * @name sendMsg + * @package misc + * @see proto service: misc.SendMsg + */ +export const sendMsg = buildTx({ + msg: InputMsg +}); \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/amino-msg-with-func/misc/tx.rpc.msg.ts b/__fixtures__/misc/output-proto-amino/amino-msg-with-func/misc/tx.rpc.msg.ts index 6d03a2bcb5..c4e3a250fa 100644 --- a/__fixtures__/misc/output-proto-amino/amino-msg-with-func/misc/tx.rpc.msg.ts +++ b/__fixtures__/misc/output-proto-amino/amino-msg-with-func/misc/tx.rpc.msg.ts @@ -1,5 +1,5 @@ import { EncodingTestForDontOmit, EncodingTestForDontOmitSDKType, EncodingTestForOmit, EncodingTestForOmitSDKType } from "./all_fields"; -import { Rpc } from "../helpers"; +import { TxRpc } from "../types"; import { BinaryReader } from "../binary"; import { InputMsg, InputMsgSDKType, MsgResponse, MsgResponseSDKType } from "./tx"; export interface Msg { @@ -7,8 +7,8 @@ export interface Msg { sendMsg(request: InputMsg): Promise; } export class MsgClientImpl implements Msg { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.sendMsg = this.sendMsg.bind(this); } @@ -18,6 +18,6 @@ export class MsgClientImpl implements Msg { return promise.then(data => MsgResponse.decode(new BinaryReader(data))); } } -export const createClientImpl = (rpc: Rpc) => { +export const createClientImpl = (rpc: TxRpc) => { return new MsgClientImpl(rpc); }; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/amino-msg-with-func/types.ts b/__fixtures__/misc/output-proto-amino/amino-msg-with-func/types.ts new file mode 100644 index 0000000000..1acee677e2 --- /dev/null +++ b/__fixtures__/misc/output-proto-amino/amino-msg-with-func/types.ts @@ -0,0 +1,109 @@ +/** +* This file and any referenced files were automatically generated by @hyperweb/telescope@latest +* DO NOT MODIFY BY HAND. Instead, download the latest proto files for your chain +* and run the transpile command or npm scripts command that is used to regenerate this bundle. +*/ + +import { IBinaryReader, IBinaryWriter } from "./binary"; +import { Any } from "./google/protobuf/any"; + +import { HttpEndpoint } from "@interchainjs/types"; + + +import { DeliverTxResponse, Event, Attribute } from "@interchainjs/types"; + +export { DeliverTxResponse } + + +export type ProtoMsg = Omit & { typeUrl: any }; + +export interface IAminoMsg { + type: any; + value: Amino; +} + +export interface IProtoType { + $typeUrl?: any; +} + +/** + * A type generated by Telescope 1.0. + */ +export interface TelescopeGeneratedCodec< + T = unknown, + SDK = unknown, + Amino = unknown +> { + readonly typeUrl: string; + readonly aminoType?: string; + is?(o: unknown): o is T; + isSDK?(o: unknown): o is SDK; + isAmino?(o: unknown): o is Amino; + encode: (message: T, writer?: IBinaryWriter | any) => IBinaryWriter | any; + decode: (input: IBinaryReader | Uint8Array | any, length?: number) => T; + fromPartial: (object: any) => T | any; + fromJSON?: (object: any) => T | any; + toJSON?: (message: T | any) => any; + fromSDK?: (sdk: SDK) => T; + fromSDKJSON?: (object: any) => SDK; + toSDK?: (message: T) => SDK; + fromAmino?: (amino: Amino) => T; + toAmino?: (message: T) => Amino; + fromAminoMsg?: (aminoMsg: IAminoMsg) => T; + toAminoMsg?: (message: T) => IAminoMsg; + toProto?: (message: T) => Uint8Array; + fromProtoMsg?: (message: ProtoMsg) => T; + toProtoMsg?: (message: T) => Any; + registerTypeUrl?: () => void; +} + +export type TelescopeGeneratedType< + T = unknown, + SDK = unknown, + Amino = unknown +> = TelescopeGeneratedCodec; + +export type GeneratedType = TelescopeGeneratedCodec; + +/** + * Coin defines a token with a denomination and an amount. + * + * NOTE: The amount field is an Int which implements the custom method + * signatures required by gogoproto. + */ +interface Coin { + denom: string; + amount: string; +} + +export type EncodeObject = Message; + +export interface Message { + typeUrl: string; + value: T; +} + +export interface StdFee { + amount: Coin[]; + gas: string; + /** The granter address that is used for paying with feegrants */ + granter?: string; + /** The fee payer address. The payer must have signed the transaction. */ + payer?: string; +} + + +export interface TxRpc { + request( + service: string, + method: string, + data: Uint8Array + ): Promise; + signAndBroadcast?( + signerAddress: string, + messages: EncodeObject[], + fee: StdFee | "auto" | number, + memo: string + ): Promise; +} + diff --git a/__fixtures__/misc/output-proto-amino/amino-no-msg-with-func/extern.ts b/__fixtures__/misc/output-proto-amino/amino-no-msg-with-func/extern.ts index c3e7cbcac8..83d6864ae2 100644 --- a/__fixtures__/misc/output-proto-amino/amino-no-msg-with-func/extern.ts +++ b/__fixtures__/misc/output-proto-amino/amino-no-msg-with-func/extern.ts @@ -4,30 +4,45 @@ * and run the transpile command or npm scripts command that is used to regenerate this bundle. */ -import { QueryClient, createProtobufRpcClient, ProtobufRpcClient } from '@cosmjs/stargate' -import { Tendermint34Client, HttpEndpoint } from "@cosmjs/tendermint-rpc"; -const _rpcClients: Record = {}; +import { HttpEndpoint } from "@interchainjs/types"; +import { Rpc } from "./helpers"; +import { ClientOptions, createCosmosQueryClient } from "@interchainjs/cosmos"; + +const _rpcClients: Record = {}; export const getRpcEndpointKey = (rpcEndpoint: string | HttpEndpoint) => { - if (typeof rpcEndpoint === 'string') { - return rpcEndpoint; - } else if (!!rpcEndpoint) { - //@ts-ignore - return rpcEndpoint.url; - } + if (typeof rpcEndpoint === 'string') { + return rpcEndpoint; + } else if (!!rpcEndpoint) { + //@ts-ignore + return rpcEndpoint.url; + } } export const getRpcClient = async (rpcEndpoint: string | HttpEndpoint) => { - const key = getRpcEndpointKey(rpcEndpoint); - if (!key) return; - if (_rpcClients.hasOwnProperty(key)) { - return _rpcClients[key]; - } - const tmClient = await Tendermint34Client.connect(rpcEndpoint); - //@ts-ignore - const client = new QueryClient(tmClient); - const rpc = createProtobufRpcClient(client); - _rpcClients[key] = rpc; - return rpc; + const key = getRpcEndpointKey(rpcEndpoint); + if (!key) return; + if (_rpcClients.hasOwnProperty(key)) { + return _rpcClients[key]; + } + const rpc = await createRpcClient(rpcEndpoint); + _rpcClients[key] = rpc; + return rpc; +} + +export const createRpcClient = async (rpcEndpoint: string | HttpEndpoint, + options?: ClientOptions +) => { + if (typeof rpcEndpoint === 'string') { + return createCosmosQueryClient(rpcEndpoint, options); + } else { + const endpointStr = rpcEndpoint.url; + const clientOptions = { + ...options, + headers: rpcEndpoint.headers + }; + + return createCosmosQueryClient(endpointStr, clientOptions); + } } diff --git a/__fixtures__/misc/output-proto-amino/amino-no-msg-with-func/gogoproto/bundle.ts b/__fixtures__/misc/output-proto-amino/amino-no-msg-with-func/gogoproto/bundle.ts index c883f554e9..c97ad76ace 100644 --- a/__fixtures__/misc/output-proto-amino/amino-no-msg-with-func/gogoproto/bundle.ts +++ b/__fixtures__/misc/output-proto-amino/amino-no-msg-with-func/gogoproto/bundle.ts @@ -1,4 +1,4 @@ -import * as _152 from "./gogo"; +import * as _164 from "./gogo"; export const gogoproto = { - ..._152 + ..._164 }; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/amino-no-msg-with-func/google/bundle.ts b/__fixtures__/misc/output-proto-amino/amino-no-msg-with-func/google/bundle.ts index 6490ac1673..e02138a82e 100644 --- a/__fixtures__/misc/output-proto-amino/amino-no-msg-with-func/google/bundle.ts +++ b/__fixtures__/misc/output-proto-amino/amino-no-msg-with-func/google/bundle.ts @@ -1,20 +1,20 @@ -import * as _153 from "./api/expr/v1alpha1/eval"; -import * as _154 from "./protobuf/any"; -import * as _155 from "./protobuf/descriptor"; -import * as _156 from "./protobuf/duration"; -import * as _157 from "./protobuf/timestamp"; +import * as _165 from "./api/expr/v1alpha1/eval"; +import * as _166 from "./protobuf/any"; +import * as _167 from "./protobuf/descriptor"; +import * as _168 from "./protobuf/duration"; +import * as _169 from "./protobuf/timestamp"; export namespace google { export namespace api { export namespace expr { export const v1alpha1 = { - ..._153 + ..._165 }; } } export const protobuf = { - ..._154, - ..._155, - ..._156, - ..._157 + ..._166, + ..._167, + ..._168, + ..._169 }; } \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/amino-no-msg-with-func/helper-func-types.ts b/__fixtures__/misc/output-proto-amino/amino-no-msg-with-func/helper-func-types.ts new file mode 100644 index 0000000000..5f9d7a87a0 --- /dev/null +++ b/__fixtures__/misc/output-proto-amino/amino-no-msg-with-func/helper-func-types.ts @@ -0,0 +1,92 @@ +/** +* This file and any referenced files were automatically generated by @hyperweb/telescope@latest +* DO NOT MODIFY BY HAND. Instead, download the latest proto files for your chain +* and run the transpile command or npm scripts command that is used to regenerate this bundle. +*/ + + +import { HttpEndpoint } from "@interchainjs/types"; +import { BinaryReader, BinaryWriter } from "./binary"; +import { getRpcClient } from "./extern"; +import { isRpc, Rpc } from "./helpers"; +import { TelescopeGeneratedCodec, DeliverTxResponse, Message, StdFee } from "./types"; +import { toConverters, toEncoders } from "@interchainjs/cosmos/utils"; +import { ISigningClient } from "@interchainjs/cosmos/types/signing-client"; + +export interface QueryBuilderOptions { + encode: (request: TReq, writer?: BinaryWriter) => BinaryWriter + decode: (input: BinaryReader | Uint8Array, length?: number) => TRes + service: string, + method: string, +} + +export function buildQuery(opts: QueryBuilderOptions) { + return async (client: EndpointOrRpc, request: TReq) => { + let rpc: Rpc | undefined; + + if(isRpc(client)) { + rpc = client; + } else { + rpc = client ? await getRpcClient(client) : undefined; + } + + if (!rpc) throw new Error("Query Rpc is not initialized"); + + const data = opts.encode(request).finish(); + const response = await rpc.request(opts.service, opts.method, data); + return opts.decode(response); + }; +} + +export interface ITxArgs { + signerAddress: string; + message: TMsg | TMsg[]; + fee: StdFee | 'auto'; + memo: string; +} + +export interface TxBuilderOptions { + msg: TelescopeGeneratedCodec +} + +export function buildTx(opts: TxBuilderOptions) { + return async ( + client: ISigningClient, + signerAddress: string, + message: TMsg | TMsg[], + fee: StdFee | 'auto', + memo: string + ): Promise => { + if (!client) throw new Error("SigningClient is not initialized"); + + //register all related encoders and converters + client.addEncoders?.(toEncoders(opts.msg)); + client.addConverters?.(toConverters(opts.msg)); + + const data = Array.isArray(message) + ? message.map(msg => ({ + typeUrl: opts.msg.typeUrl, + value: msg, + })) + : [{ + typeUrl: opts.msg.typeUrl, + value: message, + }]; + return client.signAndBroadcast!(signerAddress, data, fee, memo); + }; +} + +export interface Encoder { + typeUrl: string; + fromPartial: (data: any) => any; + encode: (data: any) => Uint8Array; +} + +export interface AminoConverter { + typeUrl: string; + aminoType: string; + fromAmino: (data: any) => any; + toAmino: (data: any) => any; +} + +export type EndpointOrRpc = string | HttpEndpoint | Rpc ; diff --git a/__fixtures__/misc/output-proto-amino/amino-no-msg-with-func/index.ts b/__fixtures__/misc/output-proto-amino/amino-no-msg-with-func/index.ts index 63239ebbce..f6bcc0cdc2 100644 --- a/__fixtures__/misc/output-proto-amino/amino-no-msg-with-func/index.ts +++ b/__fixtures__/misc/output-proto-amino/amino-no-msg-with-func/index.ts @@ -9,10 +9,12 @@ export * from "./google/bundle"; export * from "./misc/bundle"; export * from "./misc/client"; export * from "./extern"; +export * from "./helper-func-types"; export * from "./react-query"; export * from "./mobx"; export * from "./pinia-endpoint"; export * from "./json-safe"; export * from "./varint"; export * from "./utf8"; -export * from "./binary"; \ No newline at end of file +export * from "./binary"; +export * from "./types"; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/amino-no-msg-with-func/misc/all_fields.ts b/__fixtures__/misc/output-proto-amino/amino-no-msg-with-func/misc/all_fields.ts index c86cb7c60f..35810f5925 100644 --- a/__fixtures__/misc/output-proto-amino/amino-no-msg-with-func/misc/all_fields.ts +++ b/__fixtures__/misc/output-proto-amino/amino-no-msg-with-func/misc/all_fields.ts @@ -4,10 +4,10 @@ import { Duration, DurationAmino, DurationSDKType } from "../google/protobuf/dur import { Timestamp, TimestampAmino, TimestampSDKType } from "../google/protobuf/timestamp"; import { BinaryReader, BinaryWriter } from "../binary"; import { toTimestamp, fromTimestamp, isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../helpers"; -import { Decimal } from "@cosmjs/math"; +import { Decimal } from "@interchainjs/math"; import { JsonSafe } from "../json-safe"; -import { toUtf8, fromBase64, fromUtf8, toBase64 } from "@cosmjs/encoding"; -import { encodePubkey, decodePubkey } from "@cosmjs/proto-signing"; +import { toUtf8, fromBase64, fromUtf8, toBase64 } from "@interchainjs/encoding"; +import { encodePubkey, decodePubkey } from "@interchainjs/pubkey"; export const protobufPackage = "misc"; /** * @name EncodingTestForDontOmit @@ -1747,15 +1747,15 @@ export const EncodingTestForDontOmit = { } else { obj.d_o_auths = message.dOAuths; } - obj.dec = message.dec === "" ? undefined : message.dec; - obj.d_o_dec = message.dODec ?? ""; + obj.dec = message.dec === "" ? undefined : Decimal.fromUserInput(message.dec, 18).atomics; + obj.d_o_dec = Decimal.fromUserInput(message.dODec, 18).atomics ?? ""; if (message.decs) { - obj.decs = message.decs.map(e => e); + obj.decs = message.decs.map(e => Decimal.fromUserInput(e, 18).atomics); } else { obj.decs = message.decs; } if (message.dODecs) { - obj.d_o_decs = message.dODecs.map(e => e); + obj.d_o_decs = message.dODecs.map(e => Decimal.fromUserInput(e, 18).atomics); } else { obj.d_o_decs = message.dODecs; } @@ -2910,15 +2910,15 @@ export const EncodingTestForOmit = { } else { obj.o_auths = message.oAuths; } - obj.dec = message.dec ?? ""; - obj.o_dec = message.oDec === "" ? undefined : message.oDec; + obj.dec = Decimal.fromUserInput(message.dec, 18).atomics ?? ""; + obj.o_dec = message.oDec === "" ? undefined : Decimal.fromUserInput(message.oDec, 18).atomics; if (message.decs) { - obj.decs = message.decs.map(e => e); + obj.decs = message.decs.map(e => Decimal.fromUserInput(e, 18).atomics); } else { obj.decs = message.decs; } if (message.oDecs) { - obj.o_decs = message.oDecs.map(e => e); + obj.o_decs = message.oDecs.map(e => Decimal.fromUserInput(e, 18).atomics); } else { obj.o_decs = message.oDecs; } diff --git a/__fixtures__/misc/output-proto-amino/amino-no-msg-with-func/misc/bundle.ts b/__fixtures__/misc/output-proto-amino/amino-no-msg-with-func/misc/bundle.ts index 7a19061de6..6512c286d7 100644 --- a/__fixtures__/misc/output-proto-amino/amino-no-msg-with-func/misc/bundle.ts +++ b/__fixtures__/misc/output-proto-amino/amino-no-msg-with-func/misc/bundle.ts @@ -1,20 +1,22 @@ -import * as _158 from "./all_fields"; -import * as _159 from "./eval_request"; -import * as _160 from "./nest"; -import * as _161 from "./tx"; -import * as _162 from "./tx.amino"; -import * as _163 from "./tx.registry"; -import * as _164 from "./tx.rpc.msg"; -import * as _165 from "./rpc.tx"; +import * as _170 from "./all_fields"; +import * as _171 from "./eval_request"; +import * as _172 from "./nest"; +import * as _173 from "./tx"; +import * as _174 from "./tx.amino"; +import * as _175 from "./tx.registry"; +import * as _176 from "./tx.rpc.func"; +import * as _177 from "./tx.rpc.msg"; +import * as _178 from "./rpc.tx"; export const misc = { - ..._158, - ..._159, - ..._160, - ..._161, - ..._162, - ..._163, - ..._164, + ..._170, + ..._171, + ..._172, + ..._173, + ..._174, + ..._175, + ..._176, + ..._177, ClientFactory: { - ..._165 + ..._178 } }; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/amino-no-msg-with-func/misc/tx.registry.ts b/__fixtures__/misc/output-proto-amino/amino-no-msg-with-func/misc/tx.registry.ts index 1d15c5745c..9ee2c16c01 100644 --- a/__fixtures__/misc/output-proto-amino/amino-no-msg-with-func/misc/tx.registry.ts +++ b/__fixtures__/misc/output-proto-amino/amino-no-msg-with-func/misc/tx.registry.ts @@ -1,12 +1,7 @@ import { EncodingTestForDontOmit, EncodingTestForDontOmitSDKType, EncodingTestForOmit, EncodingTestForOmitSDKType } from "./all_fields"; -import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { TelescopeGeneratedType } from "../types"; import { InputMsg, InputMsgSDKType } from "./tx"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/misc.InputMsg", InputMsg]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/misc.InputMsg", InputMsg]]; export const MessageComposer = { encoded: { sendMsg(value: InputMsg) { diff --git a/__fixtures__/misc/output-proto-amino/amino-no-msg-with-func/misc/tx.rpc.func.ts b/__fixtures__/misc/output-proto-amino/amino-no-msg-with-func/misc/tx.rpc.func.ts new file mode 100644 index 0000000000..e3a3906134 --- /dev/null +++ b/__fixtures__/misc/output-proto-amino/amino-no-msg-with-func/misc/tx.rpc.func.ts @@ -0,0 +1,12 @@ +import { EncodingTestForDontOmit, EncodingTestForDontOmitSDKType, EncodingTestForOmit, EncodingTestForOmitSDKType } from "./all_fields"; +import { buildTx } from "../helper-func-types"; +import { InputMsg, InputMsgSDKType, MsgResponse, MsgResponseSDKType } from "./tx"; +/** + * test tx + * @name sendMsg + * @package misc + * @see proto service: misc.SendMsg + */ +export const sendMsg = buildTx({ + msg: InputMsg +}); \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/amino-no-msg-with-func/misc/tx.rpc.msg.ts b/__fixtures__/misc/output-proto-amino/amino-no-msg-with-func/misc/tx.rpc.msg.ts index 6d03a2bcb5..c4e3a250fa 100644 --- a/__fixtures__/misc/output-proto-amino/amino-no-msg-with-func/misc/tx.rpc.msg.ts +++ b/__fixtures__/misc/output-proto-amino/amino-no-msg-with-func/misc/tx.rpc.msg.ts @@ -1,5 +1,5 @@ import { EncodingTestForDontOmit, EncodingTestForDontOmitSDKType, EncodingTestForOmit, EncodingTestForOmitSDKType } from "./all_fields"; -import { Rpc } from "../helpers"; +import { TxRpc } from "../types"; import { BinaryReader } from "../binary"; import { InputMsg, InputMsgSDKType, MsgResponse, MsgResponseSDKType } from "./tx"; export interface Msg { @@ -7,8 +7,8 @@ export interface Msg { sendMsg(request: InputMsg): Promise; } export class MsgClientImpl implements Msg { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.sendMsg = this.sendMsg.bind(this); } @@ -18,6 +18,6 @@ export class MsgClientImpl implements Msg { return promise.then(data => MsgResponse.decode(new BinaryReader(data))); } } -export const createClientImpl = (rpc: Rpc) => { +export const createClientImpl = (rpc: TxRpc) => { return new MsgClientImpl(rpc); }; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/amino-no-msg-with-func/types.ts b/__fixtures__/misc/output-proto-amino/amino-no-msg-with-func/types.ts new file mode 100644 index 0000000000..1acee677e2 --- /dev/null +++ b/__fixtures__/misc/output-proto-amino/amino-no-msg-with-func/types.ts @@ -0,0 +1,109 @@ +/** +* This file and any referenced files were automatically generated by @hyperweb/telescope@latest +* DO NOT MODIFY BY HAND. Instead, download the latest proto files for your chain +* and run the transpile command or npm scripts command that is used to regenerate this bundle. +*/ + +import { IBinaryReader, IBinaryWriter } from "./binary"; +import { Any } from "./google/protobuf/any"; + +import { HttpEndpoint } from "@interchainjs/types"; + + +import { DeliverTxResponse, Event, Attribute } from "@interchainjs/types"; + +export { DeliverTxResponse } + + +export type ProtoMsg = Omit & { typeUrl: any }; + +export interface IAminoMsg { + type: any; + value: Amino; +} + +export interface IProtoType { + $typeUrl?: any; +} + +/** + * A type generated by Telescope 1.0. + */ +export interface TelescopeGeneratedCodec< + T = unknown, + SDK = unknown, + Amino = unknown +> { + readonly typeUrl: string; + readonly aminoType?: string; + is?(o: unknown): o is T; + isSDK?(o: unknown): o is SDK; + isAmino?(o: unknown): o is Amino; + encode: (message: T, writer?: IBinaryWriter | any) => IBinaryWriter | any; + decode: (input: IBinaryReader | Uint8Array | any, length?: number) => T; + fromPartial: (object: any) => T | any; + fromJSON?: (object: any) => T | any; + toJSON?: (message: T | any) => any; + fromSDK?: (sdk: SDK) => T; + fromSDKJSON?: (object: any) => SDK; + toSDK?: (message: T) => SDK; + fromAmino?: (amino: Amino) => T; + toAmino?: (message: T) => Amino; + fromAminoMsg?: (aminoMsg: IAminoMsg) => T; + toAminoMsg?: (message: T) => IAminoMsg; + toProto?: (message: T) => Uint8Array; + fromProtoMsg?: (message: ProtoMsg) => T; + toProtoMsg?: (message: T) => Any; + registerTypeUrl?: () => void; +} + +export type TelescopeGeneratedType< + T = unknown, + SDK = unknown, + Amino = unknown +> = TelescopeGeneratedCodec; + +export type GeneratedType = TelescopeGeneratedCodec; + +/** + * Coin defines a token with a denomination and an amount. + * + * NOTE: The amount field is an Int which implements the custom method + * signatures required by gogoproto. + */ +interface Coin { + denom: string; + amount: string; +} + +export type EncodeObject = Message; + +export interface Message { + typeUrl: string; + value: T; +} + +export interface StdFee { + amount: Coin[]; + gas: string; + /** The granter address that is used for paying with feegrants */ + granter?: string; + /** The fee payer address. The payer must have signed the transaction. */ + payer?: string; +} + + +export interface TxRpc { + request( + service: string, + method: string, + data: Uint8Array + ): Promise; + signAndBroadcast?( + signerAddress: string, + messages: EncodeObject[], + fee: StdFee | "auto" | number, + memo: string + ): Promise; +} + diff --git a/__fixtures__/misc/output-proto-amino/no-amino-legacy-no-proto/extern.ts b/__fixtures__/misc/output-proto-amino/no-amino-legacy-no-proto/extern.ts index c3e7cbcac8..83d6864ae2 100644 --- a/__fixtures__/misc/output-proto-amino/no-amino-legacy-no-proto/extern.ts +++ b/__fixtures__/misc/output-proto-amino/no-amino-legacy-no-proto/extern.ts @@ -4,30 +4,45 @@ * and run the transpile command or npm scripts command that is used to regenerate this bundle. */ -import { QueryClient, createProtobufRpcClient, ProtobufRpcClient } from '@cosmjs/stargate' -import { Tendermint34Client, HttpEndpoint } from "@cosmjs/tendermint-rpc"; -const _rpcClients: Record = {}; +import { HttpEndpoint } from "@interchainjs/types"; +import { Rpc } from "./helpers"; +import { ClientOptions, createCosmosQueryClient } from "@interchainjs/cosmos"; + +const _rpcClients: Record = {}; export const getRpcEndpointKey = (rpcEndpoint: string | HttpEndpoint) => { - if (typeof rpcEndpoint === 'string') { - return rpcEndpoint; - } else if (!!rpcEndpoint) { - //@ts-ignore - return rpcEndpoint.url; - } + if (typeof rpcEndpoint === 'string') { + return rpcEndpoint; + } else if (!!rpcEndpoint) { + //@ts-ignore + return rpcEndpoint.url; + } } export const getRpcClient = async (rpcEndpoint: string | HttpEndpoint) => { - const key = getRpcEndpointKey(rpcEndpoint); - if (!key) return; - if (_rpcClients.hasOwnProperty(key)) { - return _rpcClients[key]; - } - const tmClient = await Tendermint34Client.connect(rpcEndpoint); - //@ts-ignore - const client = new QueryClient(tmClient); - const rpc = createProtobufRpcClient(client); - _rpcClients[key] = rpc; - return rpc; + const key = getRpcEndpointKey(rpcEndpoint); + if (!key) return; + if (_rpcClients.hasOwnProperty(key)) { + return _rpcClients[key]; + } + const rpc = await createRpcClient(rpcEndpoint); + _rpcClients[key] = rpc; + return rpc; +} + +export const createRpcClient = async (rpcEndpoint: string | HttpEndpoint, + options?: ClientOptions +) => { + if (typeof rpcEndpoint === 'string') { + return createCosmosQueryClient(rpcEndpoint, options); + } else { + const endpointStr = rpcEndpoint.url; + const clientOptions = { + ...options, + headers: rpcEndpoint.headers + }; + + return createCosmosQueryClient(endpointStr, clientOptions); + } } diff --git a/__fixtures__/misc/output-proto-amino/no-amino-legacy-no-proto/gogoproto/bundle.ts b/__fixtures__/misc/output-proto-amino/no-amino-legacy-no-proto/gogoproto/bundle.ts index 748cdf1f53..1f0efe763e 100644 --- a/__fixtures__/misc/output-proto-amino/no-amino-legacy-no-proto/gogoproto/bundle.ts +++ b/__fixtures__/misc/output-proto-amino/no-amino-legacy-no-proto/gogoproto/bundle.ts @@ -1,4 +1,4 @@ -import * as _64 from "./gogo"; +import * as _69 from "./gogo"; export const gogoproto = { - ..._64 + ..._69 }; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/no-amino-legacy-no-proto/google/bundle.ts b/__fixtures__/misc/output-proto-amino/no-amino-legacy-no-proto/google/bundle.ts index 4598eb32f4..a6ee65422f 100644 --- a/__fixtures__/misc/output-proto-amino/no-amino-legacy-no-proto/google/bundle.ts +++ b/__fixtures__/misc/output-proto-amino/no-amino-legacy-no-proto/google/bundle.ts @@ -1,20 +1,20 @@ -import * as _65 from "./api/expr/v1alpha1/eval"; -import * as _66 from "./protobuf/any"; -import * as _67 from "./protobuf/descriptor"; -import * as _68 from "./protobuf/duration"; -import * as _69 from "./protobuf/timestamp"; +import * as _70 from "./api/expr/v1alpha1/eval"; +import * as _71 from "./protobuf/any"; +import * as _72 from "./protobuf/descriptor"; +import * as _73 from "./protobuf/duration"; +import * as _74 from "./protobuf/timestamp"; export namespace google { export namespace api { export namespace expr { export const v1alpha1 = { - ..._65 + ..._70 }; } } export const protobuf = { - ..._66, - ..._67, - ..._68, - ..._69 + ..._71, + ..._72, + ..._73, + ..._74 }; } \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/no-amino-legacy-no-proto/helper-func-types.ts b/__fixtures__/misc/output-proto-amino/no-amino-legacy-no-proto/helper-func-types.ts new file mode 100644 index 0000000000..5f9d7a87a0 --- /dev/null +++ b/__fixtures__/misc/output-proto-amino/no-amino-legacy-no-proto/helper-func-types.ts @@ -0,0 +1,92 @@ +/** +* This file and any referenced files were automatically generated by @hyperweb/telescope@latest +* DO NOT MODIFY BY HAND. Instead, download the latest proto files for your chain +* and run the transpile command or npm scripts command that is used to regenerate this bundle. +*/ + + +import { HttpEndpoint } from "@interchainjs/types"; +import { BinaryReader, BinaryWriter } from "./binary"; +import { getRpcClient } from "./extern"; +import { isRpc, Rpc } from "./helpers"; +import { TelescopeGeneratedCodec, DeliverTxResponse, Message, StdFee } from "./types"; +import { toConverters, toEncoders } from "@interchainjs/cosmos/utils"; +import { ISigningClient } from "@interchainjs/cosmos/types/signing-client"; + +export interface QueryBuilderOptions { + encode: (request: TReq, writer?: BinaryWriter) => BinaryWriter + decode: (input: BinaryReader | Uint8Array, length?: number) => TRes + service: string, + method: string, +} + +export function buildQuery(opts: QueryBuilderOptions) { + return async (client: EndpointOrRpc, request: TReq) => { + let rpc: Rpc | undefined; + + if(isRpc(client)) { + rpc = client; + } else { + rpc = client ? await getRpcClient(client) : undefined; + } + + if (!rpc) throw new Error("Query Rpc is not initialized"); + + const data = opts.encode(request).finish(); + const response = await rpc.request(opts.service, opts.method, data); + return opts.decode(response); + }; +} + +export interface ITxArgs { + signerAddress: string; + message: TMsg | TMsg[]; + fee: StdFee | 'auto'; + memo: string; +} + +export interface TxBuilderOptions { + msg: TelescopeGeneratedCodec +} + +export function buildTx(opts: TxBuilderOptions) { + return async ( + client: ISigningClient, + signerAddress: string, + message: TMsg | TMsg[], + fee: StdFee | 'auto', + memo: string + ): Promise => { + if (!client) throw new Error("SigningClient is not initialized"); + + //register all related encoders and converters + client.addEncoders?.(toEncoders(opts.msg)); + client.addConverters?.(toConverters(opts.msg)); + + const data = Array.isArray(message) + ? message.map(msg => ({ + typeUrl: opts.msg.typeUrl, + value: msg, + })) + : [{ + typeUrl: opts.msg.typeUrl, + value: message, + }]; + return client.signAndBroadcast!(signerAddress, data, fee, memo); + }; +} + +export interface Encoder { + typeUrl: string; + fromPartial: (data: any) => any; + encode: (data: any) => Uint8Array; +} + +export interface AminoConverter { + typeUrl: string; + aminoType: string; + fromAmino: (data: any) => any; + toAmino: (data: any) => any; +} + +export type EndpointOrRpc = string | HttpEndpoint | Rpc ; diff --git a/__fixtures__/misc/output-proto-amino/no-amino-legacy-no-proto/index.ts b/__fixtures__/misc/output-proto-amino/no-amino-legacy-no-proto/index.ts index d589dcd349..6b7006730a 100644 --- a/__fixtures__/misc/output-proto-amino/no-amino-legacy-no-proto/index.ts +++ b/__fixtures__/misc/output-proto-amino/no-amino-legacy-no-proto/index.ts @@ -8,10 +8,12 @@ export * from "./gogoproto/bundle"; export * from "./google/bundle"; export * from "./misc/bundle"; export * from "./extern"; +export * from "./helper-func-types"; export * from "./react-query"; export * from "./mobx"; export * from "./pinia-endpoint"; export * from "./json-safe"; export * from "./varint"; export * from "./utf8"; -export * from "./binary"; \ No newline at end of file +export * from "./binary"; +export * from "./types"; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/no-amino-legacy-no-proto/misc/all_fields.ts b/__fixtures__/misc/output-proto-amino/no-amino-legacy-no-proto/misc/all_fields.ts index 5aa1afbe09..297dca6fa5 100644 --- a/__fixtures__/misc/output-proto-amino/no-amino-legacy-no-proto/misc/all_fields.ts +++ b/__fixtures__/misc/output-proto-amino/no-amino-legacy-no-proto/misc/all_fields.ts @@ -4,7 +4,7 @@ import { Duration, DurationSDKType } from "../google/protobuf/duration"; import { Timestamp, TimestampSDKType } from "../google/protobuf/timestamp"; import { BinaryReader, BinaryWriter } from "../binary"; import { toTimestamp, fromTimestamp, isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../helpers"; -import { Decimal } from "@cosmjs/math"; +import { Decimal } from "@interchainjs/math"; import { JsonSafe } from "../json-safe"; export const protobufPackage = "misc"; /** diff --git a/__fixtures__/misc/output-proto-amino/no-amino-legacy-no-proto/misc/bundle.ts b/__fixtures__/misc/output-proto-amino/no-amino-legacy-no-proto/misc/bundle.ts index ec23b6bbf0..8511a3177a 100644 --- a/__fixtures__/misc/output-proto-amino/no-amino-legacy-no-proto/misc/bundle.ts +++ b/__fixtures__/misc/output-proto-amino/no-amino-legacy-no-proto/misc/bundle.ts @@ -1,16 +1,18 @@ -import * as _70 from "./all_fields"; -import * as _71 from "./eval_request"; -import * as _72 from "./nest"; -import * as _73 from "./tx"; -import * as _74 from "./tx.rpc.msg"; -import * as _75 from "./rpc.tx"; +import * as _75 from "./all_fields"; +import * as _76 from "./eval_request"; +import * as _77 from "./nest"; +import * as _78 from "./tx"; +import * as _79 from "./tx.rpc.func"; +import * as _80 from "./tx.rpc.msg"; +import * as _81 from "./rpc.tx"; export const misc = { - ..._70, - ..._71, - ..._72, - ..._73, - ..._74, + ..._75, + ..._76, + ..._77, + ..._78, + ..._79, + ..._80, ClientFactory: { - ..._75 + ..._81 } }; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/no-amino-legacy-no-proto/misc/tx.rpc.func.ts b/__fixtures__/misc/output-proto-amino/no-amino-legacy-no-proto/misc/tx.rpc.func.ts new file mode 100644 index 0000000000..e3a3906134 --- /dev/null +++ b/__fixtures__/misc/output-proto-amino/no-amino-legacy-no-proto/misc/tx.rpc.func.ts @@ -0,0 +1,12 @@ +import { EncodingTestForDontOmit, EncodingTestForDontOmitSDKType, EncodingTestForOmit, EncodingTestForOmitSDKType } from "./all_fields"; +import { buildTx } from "../helper-func-types"; +import { InputMsg, InputMsgSDKType, MsgResponse, MsgResponseSDKType } from "./tx"; +/** + * test tx + * @name sendMsg + * @package misc + * @see proto service: misc.SendMsg + */ +export const sendMsg = buildTx({ + msg: InputMsg +}); \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/no-amino-legacy-no-proto/misc/tx.rpc.msg.ts b/__fixtures__/misc/output-proto-amino/no-amino-legacy-no-proto/misc/tx.rpc.msg.ts index 6d03a2bcb5..c4e3a250fa 100644 --- a/__fixtures__/misc/output-proto-amino/no-amino-legacy-no-proto/misc/tx.rpc.msg.ts +++ b/__fixtures__/misc/output-proto-amino/no-amino-legacy-no-proto/misc/tx.rpc.msg.ts @@ -1,5 +1,5 @@ import { EncodingTestForDontOmit, EncodingTestForDontOmitSDKType, EncodingTestForOmit, EncodingTestForOmitSDKType } from "./all_fields"; -import { Rpc } from "../helpers"; +import { TxRpc } from "../types"; import { BinaryReader } from "../binary"; import { InputMsg, InputMsgSDKType, MsgResponse, MsgResponseSDKType } from "./tx"; export interface Msg { @@ -7,8 +7,8 @@ export interface Msg { sendMsg(request: InputMsg): Promise; } export class MsgClientImpl implements Msg { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.sendMsg = this.sendMsg.bind(this); } @@ -18,6 +18,6 @@ export class MsgClientImpl implements Msg { return promise.then(data => MsgResponse.decode(new BinaryReader(data))); } } -export const createClientImpl = (rpc: Rpc) => { +export const createClientImpl = (rpc: TxRpc) => { return new MsgClientImpl(rpc); }; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/no-amino-legacy-no-proto/types.ts b/__fixtures__/misc/output-proto-amino/no-amino-legacy-no-proto/types.ts new file mode 100644 index 0000000000..1acee677e2 --- /dev/null +++ b/__fixtures__/misc/output-proto-amino/no-amino-legacy-no-proto/types.ts @@ -0,0 +1,109 @@ +/** +* This file and any referenced files were automatically generated by @hyperweb/telescope@latest +* DO NOT MODIFY BY HAND. Instead, download the latest proto files for your chain +* and run the transpile command or npm scripts command that is used to regenerate this bundle. +*/ + +import { IBinaryReader, IBinaryWriter } from "./binary"; +import { Any } from "./google/protobuf/any"; + +import { HttpEndpoint } from "@interchainjs/types"; + + +import { DeliverTxResponse, Event, Attribute } from "@interchainjs/types"; + +export { DeliverTxResponse } + + +export type ProtoMsg = Omit & { typeUrl: any }; + +export interface IAminoMsg { + type: any; + value: Amino; +} + +export interface IProtoType { + $typeUrl?: any; +} + +/** + * A type generated by Telescope 1.0. + */ +export interface TelescopeGeneratedCodec< + T = unknown, + SDK = unknown, + Amino = unknown +> { + readonly typeUrl: string; + readonly aminoType?: string; + is?(o: unknown): o is T; + isSDK?(o: unknown): o is SDK; + isAmino?(o: unknown): o is Amino; + encode: (message: T, writer?: IBinaryWriter | any) => IBinaryWriter | any; + decode: (input: IBinaryReader | Uint8Array | any, length?: number) => T; + fromPartial: (object: any) => T | any; + fromJSON?: (object: any) => T | any; + toJSON?: (message: T | any) => any; + fromSDK?: (sdk: SDK) => T; + fromSDKJSON?: (object: any) => SDK; + toSDK?: (message: T) => SDK; + fromAmino?: (amino: Amino) => T; + toAmino?: (message: T) => Amino; + fromAminoMsg?: (aminoMsg: IAminoMsg) => T; + toAminoMsg?: (message: T) => IAminoMsg; + toProto?: (message: T) => Uint8Array; + fromProtoMsg?: (message: ProtoMsg) => T; + toProtoMsg?: (message: T) => Any; + registerTypeUrl?: () => void; +} + +export type TelescopeGeneratedType< + T = unknown, + SDK = unknown, + Amino = unknown +> = TelescopeGeneratedCodec; + +export type GeneratedType = TelescopeGeneratedCodec; + +/** + * Coin defines a token with a denomination and an amount. + * + * NOTE: The amount field is an Int which implements the custom method + * signatures required by gogoproto. + */ +interface Coin { + denom: string; + amount: string; +} + +export type EncodeObject = Message; + +export interface Message { + typeUrl: string; + value: T; +} + +export interface StdFee { + amount: Coin[]; + gas: string; + /** The granter address that is used for paying with feegrants */ + granter?: string; + /** The fee payer address. The payer must have signed the transaction. */ + payer?: string; +} + + +export interface TxRpc { + request( + service: string, + method: string, + data: Uint8Array + ): Promise; + signAndBroadcast?( + signerAddress: string, + messages: EncodeObject[], + fee: StdFee | "auto" | number, + memo: string + ): Promise; +} + diff --git a/__fixtures__/misc/output-proto-amino/no-amino-legacy/extern.ts b/__fixtures__/misc/output-proto-amino/no-amino-legacy/extern.ts index c3e7cbcac8..83d6864ae2 100644 --- a/__fixtures__/misc/output-proto-amino/no-amino-legacy/extern.ts +++ b/__fixtures__/misc/output-proto-amino/no-amino-legacy/extern.ts @@ -4,30 +4,45 @@ * and run the transpile command or npm scripts command that is used to regenerate this bundle. */ -import { QueryClient, createProtobufRpcClient, ProtobufRpcClient } from '@cosmjs/stargate' -import { Tendermint34Client, HttpEndpoint } from "@cosmjs/tendermint-rpc"; -const _rpcClients: Record = {}; +import { HttpEndpoint } from "@interchainjs/types"; +import { Rpc } from "./helpers"; +import { ClientOptions, createCosmosQueryClient } from "@interchainjs/cosmos"; + +const _rpcClients: Record = {}; export const getRpcEndpointKey = (rpcEndpoint: string | HttpEndpoint) => { - if (typeof rpcEndpoint === 'string') { - return rpcEndpoint; - } else if (!!rpcEndpoint) { - //@ts-ignore - return rpcEndpoint.url; - } + if (typeof rpcEndpoint === 'string') { + return rpcEndpoint; + } else if (!!rpcEndpoint) { + //@ts-ignore + return rpcEndpoint.url; + } } export const getRpcClient = async (rpcEndpoint: string | HttpEndpoint) => { - const key = getRpcEndpointKey(rpcEndpoint); - if (!key) return; - if (_rpcClients.hasOwnProperty(key)) { - return _rpcClients[key]; - } - const tmClient = await Tendermint34Client.connect(rpcEndpoint); - //@ts-ignore - const client = new QueryClient(tmClient); - const rpc = createProtobufRpcClient(client); - _rpcClients[key] = rpc; - return rpc; + const key = getRpcEndpointKey(rpcEndpoint); + if (!key) return; + if (_rpcClients.hasOwnProperty(key)) { + return _rpcClients[key]; + } + const rpc = await createRpcClient(rpcEndpoint); + _rpcClients[key] = rpc; + return rpc; +} + +export const createRpcClient = async (rpcEndpoint: string | HttpEndpoint, + options?: ClientOptions +) => { + if (typeof rpcEndpoint === 'string') { + return createCosmosQueryClient(rpcEndpoint, options); + } else { + const endpointStr = rpcEndpoint.url; + const clientOptions = { + ...options, + headers: rpcEndpoint.headers + }; + + return createCosmosQueryClient(endpointStr, clientOptions); + } } diff --git a/__fixtures__/misc/output-proto-amino/no-amino-legacy/gogoproto/bundle.ts b/__fixtures__/misc/output-proto-amino/no-amino-legacy/gogoproto/bundle.ts index 9e7ff6dd71..cf51f6dcde 100644 --- a/__fixtures__/misc/output-proto-amino/no-amino-legacy/gogoproto/bundle.ts +++ b/__fixtures__/misc/output-proto-amino/no-amino-legacy/gogoproto/bundle.ts @@ -1,4 +1,4 @@ -import * as _52 from "./gogo"; +import * as _56 from "./gogo"; export const gogoproto = { - ..._52 + ..._56 }; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/no-amino-legacy/google/bundle.ts b/__fixtures__/misc/output-proto-amino/no-amino-legacy/google/bundle.ts index 9f3b17bc0f..b14aad4c88 100644 --- a/__fixtures__/misc/output-proto-amino/no-amino-legacy/google/bundle.ts +++ b/__fixtures__/misc/output-proto-amino/no-amino-legacy/google/bundle.ts @@ -1,20 +1,20 @@ -import * as _53 from "./api/expr/v1alpha1/eval"; -import * as _54 from "./protobuf/any"; -import * as _55 from "./protobuf/descriptor"; -import * as _56 from "./protobuf/duration"; -import * as _57 from "./protobuf/timestamp"; +import * as _57 from "./api/expr/v1alpha1/eval"; +import * as _58 from "./protobuf/any"; +import * as _59 from "./protobuf/descriptor"; +import * as _60 from "./protobuf/duration"; +import * as _61 from "./protobuf/timestamp"; export namespace google { export namespace api { export namespace expr { export const v1alpha1 = { - ..._53 + ..._57 }; } } export const protobuf = { - ..._54, - ..._55, - ..._56, - ..._57 + ..._58, + ..._59, + ..._60, + ..._61 }; } \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/no-amino-legacy/helper-func-types.ts b/__fixtures__/misc/output-proto-amino/no-amino-legacy/helper-func-types.ts new file mode 100644 index 0000000000..5f9d7a87a0 --- /dev/null +++ b/__fixtures__/misc/output-proto-amino/no-amino-legacy/helper-func-types.ts @@ -0,0 +1,92 @@ +/** +* This file and any referenced files were automatically generated by @hyperweb/telescope@latest +* DO NOT MODIFY BY HAND. Instead, download the latest proto files for your chain +* and run the transpile command or npm scripts command that is used to regenerate this bundle. +*/ + + +import { HttpEndpoint } from "@interchainjs/types"; +import { BinaryReader, BinaryWriter } from "./binary"; +import { getRpcClient } from "./extern"; +import { isRpc, Rpc } from "./helpers"; +import { TelescopeGeneratedCodec, DeliverTxResponse, Message, StdFee } from "./types"; +import { toConverters, toEncoders } from "@interchainjs/cosmos/utils"; +import { ISigningClient } from "@interchainjs/cosmos/types/signing-client"; + +export interface QueryBuilderOptions { + encode: (request: TReq, writer?: BinaryWriter) => BinaryWriter + decode: (input: BinaryReader | Uint8Array, length?: number) => TRes + service: string, + method: string, +} + +export function buildQuery(opts: QueryBuilderOptions) { + return async (client: EndpointOrRpc, request: TReq) => { + let rpc: Rpc | undefined; + + if(isRpc(client)) { + rpc = client; + } else { + rpc = client ? await getRpcClient(client) : undefined; + } + + if (!rpc) throw new Error("Query Rpc is not initialized"); + + const data = opts.encode(request).finish(); + const response = await rpc.request(opts.service, opts.method, data); + return opts.decode(response); + }; +} + +export interface ITxArgs { + signerAddress: string; + message: TMsg | TMsg[]; + fee: StdFee | 'auto'; + memo: string; +} + +export interface TxBuilderOptions { + msg: TelescopeGeneratedCodec +} + +export function buildTx(opts: TxBuilderOptions) { + return async ( + client: ISigningClient, + signerAddress: string, + message: TMsg | TMsg[], + fee: StdFee | 'auto', + memo: string + ): Promise => { + if (!client) throw new Error("SigningClient is not initialized"); + + //register all related encoders and converters + client.addEncoders?.(toEncoders(opts.msg)); + client.addConverters?.(toConverters(opts.msg)); + + const data = Array.isArray(message) + ? message.map(msg => ({ + typeUrl: opts.msg.typeUrl, + value: msg, + })) + : [{ + typeUrl: opts.msg.typeUrl, + value: message, + }]; + return client.signAndBroadcast!(signerAddress, data, fee, memo); + }; +} + +export interface Encoder { + typeUrl: string; + fromPartial: (data: any) => any; + encode: (data: any) => Uint8Array; +} + +export interface AminoConverter { + typeUrl: string; + aminoType: string; + fromAmino: (data: any) => any; + toAmino: (data: any) => any; +} + +export type EndpointOrRpc = string | HttpEndpoint | Rpc ; diff --git a/__fixtures__/misc/output-proto-amino/no-amino-legacy/index.ts b/__fixtures__/misc/output-proto-amino/no-amino-legacy/index.ts index d589dcd349..6b7006730a 100644 --- a/__fixtures__/misc/output-proto-amino/no-amino-legacy/index.ts +++ b/__fixtures__/misc/output-proto-amino/no-amino-legacy/index.ts @@ -8,10 +8,12 @@ export * from "./gogoproto/bundle"; export * from "./google/bundle"; export * from "./misc/bundle"; export * from "./extern"; +export * from "./helper-func-types"; export * from "./react-query"; export * from "./mobx"; export * from "./pinia-endpoint"; export * from "./json-safe"; export * from "./varint"; export * from "./utf8"; -export * from "./binary"; \ No newline at end of file +export * from "./binary"; +export * from "./types"; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/no-amino-legacy/misc/all_fields.ts b/__fixtures__/misc/output-proto-amino/no-amino-legacy/misc/all_fields.ts index 2211ec2356..1c2d132e7e 100644 --- a/__fixtures__/misc/output-proto-amino/no-amino-legacy/misc/all_fields.ts +++ b/__fixtures__/misc/output-proto-amino/no-amino-legacy/misc/all_fields.ts @@ -4,10 +4,10 @@ import { Duration, DurationSDKType } from "../google/protobuf/duration"; import { Timestamp, TimestampSDKType } from "../google/protobuf/timestamp"; import { BinaryReader, BinaryWriter } from "../binary"; import { toTimestamp, fromTimestamp, isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../helpers"; -import { Decimal } from "@cosmjs/math"; +import { Decimal } from "@interchainjs/math"; import { JsonSafe } from "../json-safe"; -import { toUtf8, fromBase64, fromUtf8, toBase64 } from "@cosmjs/encoding"; -import { encodePubkey, decodePubkey } from "@cosmjs/proto-signing"; +import { toUtf8, fromBase64, fromUtf8, toBase64 } from "@interchainjs/encoding"; +import { encodePubkey, decodePubkey } from "@interchainjs/pubkey"; export const protobufPackage = "misc"; /** * @name EncodingTestForDontOmit @@ -1505,15 +1505,15 @@ export const EncodingTestForDontOmit = { } else { obj.d_o_auths = message.dOAuths; } - obj.dec = message.dec === "" ? undefined : message.dec; - obj.d_o_dec = message.dODec ?? ""; + obj.dec = message.dec === "" ? undefined : Decimal.fromUserInput(message.dec, 18).atomics; + obj.d_o_dec = Decimal.fromUserInput(message.dODec, 18).atomics ?? ""; if (message.decs) { - obj.decs = message.decs.map(e => e); + obj.decs = message.decs.map(e => Decimal.fromUserInput(e, 18).atomics); } else { obj.decs = message.decs; } if (message.dODecs) { - obj.d_o_decs = message.dODecs.map(e => e); + obj.d_o_decs = message.dODecs.map(e => Decimal.fromUserInput(e, 18).atomics); } else { obj.d_o_decs = message.dODecs; } @@ -2671,15 +2671,15 @@ export const EncodingTestForOmit = { } else { obj.o_auths = message.oAuths; } - obj.dec = message.dec ?? ""; - obj.o_dec = message.oDec === "" ? undefined : message.oDec; + obj.dec = Decimal.fromUserInput(message.dec, 18).atomics ?? ""; + obj.o_dec = message.oDec === "" ? undefined : Decimal.fromUserInput(message.oDec, 18).atomics; if (message.decs) { - obj.decs = message.decs.map(e => e); + obj.decs = message.decs.map(e => Decimal.fromUserInput(e, 18).atomics); } else { obj.decs = message.decs; } if (message.oDecs) { - obj.o_decs = message.oDecs.map(e => e); + obj.o_decs = message.oDecs.map(e => Decimal.fromUserInput(e, 18).atomics); } else { obj.o_decs = message.oDecs; } diff --git a/__fixtures__/misc/output-proto-amino/no-amino-legacy/misc/bundle.ts b/__fixtures__/misc/output-proto-amino/no-amino-legacy/misc/bundle.ts index 7176793963..2752cfc843 100644 --- a/__fixtures__/misc/output-proto-amino/no-amino-legacy/misc/bundle.ts +++ b/__fixtures__/misc/output-proto-amino/no-amino-legacy/misc/bundle.ts @@ -1,16 +1,18 @@ -import * as _58 from "./all_fields"; -import * as _59 from "./eval_request"; -import * as _60 from "./nest"; -import * as _61 from "./tx"; -import * as _62 from "./tx.rpc.msg"; -import * as _63 from "./rpc.tx"; +import * as _62 from "./all_fields"; +import * as _63 from "./eval_request"; +import * as _64 from "./nest"; +import * as _65 from "./tx"; +import * as _66 from "./tx.rpc.func"; +import * as _67 from "./tx.rpc.msg"; +import * as _68 from "./rpc.tx"; export const misc = { - ..._58, - ..._59, - ..._60, - ..._61, ..._62, + ..._63, + ..._64, + ..._65, + ..._66, + ..._67, ClientFactory: { - ..._63 + ..._68 } }; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/no-amino-legacy/misc/tx.rpc.func.ts b/__fixtures__/misc/output-proto-amino/no-amino-legacy/misc/tx.rpc.func.ts new file mode 100644 index 0000000000..e3a3906134 --- /dev/null +++ b/__fixtures__/misc/output-proto-amino/no-amino-legacy/misc/tx.rpc.func.ts @@ -0,0 +1,12 @@ +import { EncodingTestForDontOmit, EncodingTestForDontOmitSDKType, EncodingTestForOmit, EncodingTestForOmitSDKType } from "./all_fields"; +import { buildTx } from "../helper-func-types"; +import { InputMsg, InputMsgSDKType, MsgResponse, MsgResponseSDKType } from "./tx"; +/** + * test tx + * @name sendMsg + * @package misc + * @see proto service: misc.SendMsg + */ +export const sendMsg = buildTx({ + msg: InputMsg +}); \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/no-amino-legacy/misc/tx.rpc.msg.ts b/__fixtures__/misc/output-proto-amino/no-amino-legacy/misc/tx.rpc.msg.ts index 6d03a2bcb5..c4e3a250fa 100644 --- a/__fixtures__/misc/output-proto-amino/no-amino-legacy/misc/tx.rpc.msg.ts +++ b/__fixtures__/misc/output-proto-amino/no-amino-legacy/misc/tx.rpc.msg.ts @@ -1,5 +1,5 @@ import { EncodingTestForDontOmit, EncodingTestForDontOmitSDKType, EncodingTestForOmit, EncodingTestForOmitSDKType } from "./all_fields"; -import { Rpc } from "../helpers"; +import { TxRpc } from "../types"; import { BinaryReader } from "../binary"; import { InputMsg, InputMsgSDKType, MsgResponse, MsgResponseSDKType } from "./tx"; export interface Msg { @@ -7,8 +7,8 @@ export interface Msg { sendMsg(request: InputMsg): Promise; } export class MsgClientImpl implements Msg { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.sendMsg = this.sendMsg.bind(this); } @@ -18,6 +18,6 @@ export class MsgClientImpl implements Msg { return promise.then(data => MsgResponse.decode(new BinaryReader(data))); } } -export const createClientImpl = (rpc: Rpc) => { +export const createClientImpl = (rpc: TxRpc) => { return new MsgClientImpl(rpc); }; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/no-amino-legacy/types.ts b/__fixtures__/misc/output-proto-amino/no-amino-legacy/types.ts new file mode 100644 index 0000000000..1acee677e2 --- /dev/null +++ b/__fixtures__/misc/output-proto-amino/no-amino-legacy/types.ts @@ -0,0 +1,109 @@ +/** +* This file and any referenced files were automatically generated by @hyperweb/telescope@latest +* DO NOT MODIFY BY HAND. Instead, download the latest proto files for your chain +* and run the transpile command or npm scripts command that is used to regenerate this bundle. +*/ + +import { IBinaryReader, IBinaryWriter } from "./binary"; +import { Any } from "./google/protobuf/any"; + +import { HttpEndpoint } from "@interchainjs/types"; + + +import { DeliverTxResponse, Event, Attribute } from "@interchainjs/types"; + +export { DeliverTxResponse } + + +export type ProtoMsg = Omit & { typeUrl: any }; + +export interface IAminoMsg { + type: any; + value: Amino; +} + +export interface IProtoType { + $typeUrl?: any; +} + +/** + * A type generated by Telescope 1.0. + */ +export interface TelescopeGeneratedCodec< + T = unknown, + SDK = unknown, + Amino = unknown +> { + readonly typeUrl: string; + readonly aminoType?: string; + is?(o: unknown): o is T; + isSDK?(o: unknown): o is SDK; + isAmino?(o: unknown): o is Amino; + encode: (message: T, writer?: IBinaryWriter | any) => IBinaryWriter | any; + decode: (input: IBinaryReader | Uint8Array | any, length?: number) => T; + fromPartial: (object: any) => T | any; + fromJSON?: (object: any) => T | any; + toJSON?: (message: T | any) => any; + fromSDK?: (sdk: SDK) => T; + fromSDKJSON?: (object: any) => SDK; + toSDK?: (message: T) => SDK; + fromAmino?: (amino: Amino) => T; + toAmino?: (message: T) => Amino; + fromAminoMsg?: (aminoMsg: IAminoMsg) => T; + toAminoMsg?: (message: T) => IAminoMsg; + toProto?: (message: T) => Uint8Array; + fromProtoMsg?: (message: ProtoMsg) => T; + toProtoMsg?: (message: T) => Any; + registerTypeUrl?: () => void; +} + +export type TelescopeGeneratedType< + T = unknown, + SDK = unknown, + Amino = unknown +> = TelescopeGeneratedCodec; + +export type GeneratedType = TelescopeGeneratedCodec; + +/** + * Coin defines a token with a denomination and an amount. + * + * NOTE: The amount field is an Int which implements the custom method + * signatures required by gogoproto. + */ +interface Coin { + denom: string; + amount: string; +} + +export type EncodeObject = Message; + +export interface Message { + typeUrl: string; + value: T; +} + +export interface StdFee { + amount: Coin[]; + gas: string; + /** The granter address that is used for paying with feegrants */ + granter?: string; + /** The fee payer address. The payer must have signed the transaction. */ + payer?: string; +} + + +export interface TxRpc { + request( + service: string, + method: string, + data: Uint8Array + ): Promise; + signAndBroadcast?( + signerAddress: string, + messages: EncodeObject[], + fee: StdFee | "auto" | number, + memo: string + ): Promise; +} + diff --git a/__fixtures__/misc/output-proto-amino/no-amino-no-proto/extern.ts b/__fixtures__/misc/output-proto-amino/no-amino-no-proto/extern.ts index c3e7cbcac8..83d6864ae2 100644 --- a/__fixtures__/misc/output-proto-amino/no-amino-no-proto/extern.ts +++ b/__fixtures__/misc/output-proto-amino/no-amino-no-proto/extern.ts @@ -4,30 +4,45 @@ * and run the transpile command or npm scripts command that is used to regenerate this bundle. */ -import { QueryClient, createProtobufRpcClient, ProtobufRpcClient } from '@cosmjs/stargate' -import { Tendermint34Client, HttpEndpoint } from "@cosmjs/tendermint-rpc"; -const _rpcClients: Record = {}; +import { HttpEndpoint } from "@interchainjs/types"; +import { Rpc } from "./helpers"; +import { ClientOptions, createCosmosQueryClient } from "@interchainjs/cosmos"; + +const _rpcClients: Record = {}; export const getRpcEndpointKey = (rpcEndpoint: string | HttpEndpoint) => { - if (typeof rpcEndpoint === 'string') { - return rpcEndpoint; - } else if (!!rpcEndpoint) { - //@ts-ignore - return rpcEndpoint.url; - } + if (typeof rpcEndpoint === 'string') { + return rpcEndpoint; + } else if (!!rpcEndpoint) { + //@ts-ignore + return rpcEndpoint.url; + } } export const getRpcClient = async (rpcEndpoint: string | HttpEndpoint) => { - const key = getRpcEndpointKey(rpcEndpoint); - if (!key) return; - if (_rpcClients.hasOwnProperty(key)) { - return _rpcClients[key]; - } - const tmClient = await Tendermint34Client.connect(rpcEndpoint); - //@ts-ignore - const client = new QueryClient(tmClient); - const rpc = createProtobufRpcClient(client); - _rpcClients[key] = rpc; - return rpc; + const key = getRpcEndpointKey(rpcEndpoint); + if (!key) return; + if (_rpcClients.hasOwnProperty(key)) { + return _rpcClients[key]; + } + const rpc = await createRpcClient(rpcEndpoint); + _rpcClients[key] = rpc; + return rpc; +} + +export const createRpcClient = async (rpcEndpoint: string | HttpEndpoint, + options?: ClientOptions +) => { + if (typeof rpcEndpoint === 'string') { + return createCosmosQueryClient(rpcEndpoint, options); + } else { + const endpointStr = rpcEndpoint.url; + const clientOptions = { + ...options, + headers: rpcEndpoint.headers + }; + + return createCosmosQueryClient(endpointStr, clientOptions); + } } diff --git a/__fixtures__/misc/output-proto-amino/no-amino-no-proto/gogoproto/bundle.ts b/__fixtures__/misc/output-proto-amino/no-amino-no-proto/gogoproto/bundle.ts index b39fc5162a..4b48ade873 100644 --- a/__fixtures__/misc/output-proto-amino/no-amino-no-proto/gogoproto/bundle.ts +++ b/__fixtures__/misc/output-proto-amino/no-amino-no-proto/gogoproto/bundle.ts @@ -1,4 +1,4 @@ -import * as _26 from "./gogo"; +import * as _28 from "./gogo"; export const gogoproto = { - ..._26 + ..._28 }; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/no-amino-no-proto/google/bundle.ts b/__fixtures__/misc/output-proto-amino/no-amino-no-proto/google/bundle.ts index 79f59c08d7..850c0c48a9 100644 --- a/__fixtures__/misc/output-proto-amino/no-amino-no-proto/google/bundle.ts +++ b/__fixtures__/misc/output-proto-amino/no-amino-no-proto/google/bundle.ts @@ -1,20 +1,20 @@ -import * as _27 from "./api/expr/v1alpha1/eval"; -import * as _28 from "./protobuf/any"; -import * as _29 from "./protobuf/descriptor"; -import * as _30 from "./protobuf/duration"; -import * as _31 from "./protobuf/timestamp"; +import * as _29 from "./api/expr/v1alpha1/eval"; +import * as _30 from "./protobuf/any"; +import * as _31 from "./protobuf/descriptor"; +import * as _32 from "./protobuf/duration"; +import * as _33 from "./protobuf/timestamp"; export namespace google { export namespace api { export namespace expr { export const v1alpha1 = { - ..._27 + ..._29 }; } } export const protobuf = { - ..._28, - ..._29, ..._30, - ..._31 + ..._31, + ..._32, + ..._33 }; } \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/no-amino-no-proto/helper-func-types.ts b/__fixtures__/misc/output-proto-amino/no-amino-no-proto/helper-func-types.ts new file mode 100644 index 0000000000..5f9d7a87a0 --- /dev/null +++ b/__fixtures__/misc/output-proto-amino/no-amino-no-proto/helper-func-types.ts @@ -0,0 +1,92 @@ +/** +* This file and any referenced files were automatically generated by @hyperweb/telescope@latest +* DO NOT MODIFY BY HAND. Instead, download the latest proto files for your chain +* and run the transpile command or npm scripts command that is used to regenerate this bundle. +*/ + + +import { HttpEndpoint } from "@interchainjs/types"; +import { BinaryReader, BinaryWriter } from "./binary"; +import { getRpcClient } from "./extern"; +import { isRpc, Rpc } from "./helpers"; +import { TelescopeGeneratedCodec, DeliverTxResponse, Message, StdFee } from "./types"; +import { toConverters, toEncoders } from "@interchainjs/cosmos/utils"; +import { ISigningClient } from "@interchainjs/cosmos/types/signing-client"; + +export interface QueryBuilderOptions { + encode: (request: TReq, writer?: BinaryWriter) => BinaryWriter + decode: (input: BinaryReader | Uint8Array, length?: number) => TRes + service: string, + method: string, +} + +export function buildQuery(opts: QueryBuilderOptions) { + return async (client: EndpointOrRpc, request: TReq) => { + let rpc: Rpc | undefined; + + if(isRpc(client)) { + rpc = client; + } else { + rpc = client ? await getRpcClient(client) : undefined; + } + + if (!rpc) throw new Error("Query Rpc is not initialized"); + + const data = opts.encode(request).finish(); + const response = await rpc.request(opts.service, opts.method, data); + return opts.decode(response); + }; +} + +export interface ITxArgs { + signerAddress: string; + message: TMsg | TMsg[]; + fee: StdFee | 'auto'; + memo: string; +} + +export interface TxBuilderOptions { + msg: TelescopeGeneratedCodec +} + +export function buildTx(opts: TxBuilderOptions) { + return async ( + client: ISigningClient, + signerAddress: string, + message: TMsg | TMsg[], + fee: StdFee | 'auto', + memo: string + ): Promise => { + if (!client) throw new Error("SigningClient is not initialized"); + + //register all related encoders and converters + client.addEncoders?.(toEncoders(opts.msg)); + client.addConverters?.(toConverters(opts.msg)); + + const data = Array.isArray(message) + ? message.map(msg => ({ + typeUrl: opts.msg.typeUrl, + value: msg, + })) + : [{ + typeUrl: opts.msg.typeUrl, + value: message, + }]; + return client.signAndBroadcast!(signerAddress, data, fee, memo); + }; +} + +export interface Encoder { + typeUrl: string; + fromPartial: (data: any) => any; + encode: (data: any) => Uint8Array; +} + +export interface AminoConverter { + typeUrl: string; + aminoType: string; + fromAmino: (data: any) => any; + toAmino: (data: any) => any; +} + +export type EndpointOrRpc = string | HttpEndpoint | Rpc ; diff --git a/__fixtures__/misc/output-proto-amino/no-amino-no-proto/index.ts b/__fixtures__/misc/output-proto-amino/no-amino-no-proto/index.ts index d589dcd349..6b7006730a 100644 --- a/__fixtures__/misc/output-proto-amino/no-amino-no-proto/index.ts +++ b/__fixtures__/misc/output-proto-amino/no-amino-no-proto/index.ts @@ -8,10 +8,12 @@ export * from "./gogoproto/bundle"; export * from "./google/bundle"; export * from "./misc/bundle"; export * from "./extern"; +export * from "./helper-func-types"; export * from "./react-query"; export * from "./mobx"; export * from "./pinia-endpoint"; export * from "./json-safe"; export * from "./varint"; export * from "./utf8"; -export * from "./binary"; \ No newline at end of file +export * from "./binary"; +export * from "./types"; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/no-amino-no-proto/misc/all_fields.ts b/__fixtures__/misc/output-proto-amino/no-amino-no-proto/misc/all_fields.ts index 5aa1afbe09..297dca6fa5 100644 --- a/__fixtures__/misc/output-proto-amino/no-amino-no-proto/misc/all_fields.ts +++ b/__fixtures__/misc/output-proto-amino/no-amino-no-proto/misc/all_fields.ts @@ -4,7 +4,7 @@ import { Duration, DurationSDKType } from "../google/protobuf/duration"; import { Timestamp, TimestampSDKType } from "../google/protobuf/timestamp"; import { BinaryReader, BinaryWriter } from "../binary"; import { toTimestamp, fromTimestamp, isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../helpers"; -import { Decimal } from "@cosmjs/math"; +import { Decimal } from "@interchainjs/math"; import { JsonSafe } from "../json-safe"; export const protobufPackage = "misc"; /** diff --git a/__fixtures__/misc/output-proto-amino/no-amino-no-proto/misc/bundle.ts b/__fixtures__/misc/output-proto-amino/no-amino-no-proto/misc/bundle.ts index 26f3485a14..53462dee65 100644 --- a/__fixtures__/misc/output-proto-amino/no-amino-no-proto/misc/bundle.ts +++ b/__fixtures__/misc/output-proto-amino/no-amino-no-proto/misc/bundle.ts @@ -1,16 +1,18 @@ -import * as _32 from "./all_fields"; -import * as _33 from "./eval_request"; -import * as _34 from "./nest"; -import * as _35 from "./tx"; -import * as _36 from "./tx.rpc.msg"; -import * as _37 from "./rpc.tx"; +import * as _34 from "./all_fields"; +import * as _35 from "./eval_request"; +import * as _36 from "./nest"; +import * as _37 from "./tx"; +import * as _38 from "./tx.rpc.func"; +import * as _39 from "./tx.rpc.msg"; +import * as _40 from "./rpc.tx"; export const misc = { - ..._32, - ..._33, ..._34, ..._35, ..._36, + ..._37, + ..._38, + ..._39, ClientFactory: { - ..._37 + ..._40 } }; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/no-amino-no-proto/misc/tx.rpc.func.ts b/__fixtures__/misc/output-proto-amino/no-amino-no-proto/misc/tx.rpc.func.ts new file mode 100644 index 0000000000..e3a3906134 --- /dev/null +++ b/__fixtures__/misc/output-proto-amino/no-amino-no-proto/misc/tx.rpc.func.ts @@ -0,0 +1,12 @@ +import { EncodingTestForDontOmit, EncodingTestForDontOmitSDKType, EncodingTestForOmit, EncodingTestForOmitSDKType } from "./all_fields"; +import { buildTx } from "../helper-func-types"; +import { InputMsg, InputMsgSDKType, MsgResponse, MsgResponseSDKType } from "./tx"; +/** + * test tx + * @name sendMsg + * @package misc + * @see proto service: misc.SendMsg + */ +export const sendMsg = buildTx({ + msg: InputMsg +}); \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/no-amino-no-proto/misc/tx.rpc.msg.ts b/__fixtures__/misc/output-proto-amino/no-amino-no-proto/misc/tx.rpc.msg.ts index 6d03a2bcb5..c4e3a250fa 100644 --- a/__fixtures__/misc/output-proto-amino/no-amino-no-proto/misc/tx.rpc.msg.ts +++ b/__fixtures__/misc/output-proto-amino/no-amino-no-proto/misc/tx.rpc.msg.ts @@ -1,5 +1,5 @@ import { EncodingTestForDontOmit, EncodingTestForDontOmitSDKType, EncodingTestForOmit, EncodingTestForOmitSDKType } from "./all_fields"; -import { Rpc } from "../helpers"; +import { TxRpc } from "../types"; import { BinaryReader } from "../binary"; import { InputMsg, InputMsgSDKType, MsgResponse, MsgResponseSDKType } from "./tx"; export interface Msg { @@ -7,8 +7,8 @@ export interface Msg { sendMsg(request: InputMsg): Promise; } export class MsgClientImpl implements Msg { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.sendMsg = this.sendMsg.bind(this); } @@ -18,6 +18,6 @@ export class MsgClientImpl implements Msg { return promise.then(data => MsgResponse.decode(new BinaryReader(data))); } } -export const createClientImpl = (rpc: Rpc) => { +export const createClientImpl = (rpc: TxRpc) => { return new MsgClientImpl(rpc); }; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/no-amino-no-proto/types.ts b/__fixtures__/misc/output-proto-amino/no-amino-no-proto/types.ts new file mode 100644 index 0000000000..1acee677e2 --- /dev/null +++ b/__fixtures__/misc/output-proto-amino/no-amino-no-proto/types.ts @@ -0,0 +1,109 @@ +/** +* This file and any referenced files were automatically generated by @hyperweb/telescope@latest +* DO NOT MODIFY BY HAND. Instead, download the latest proto files for your chain +* and run the transpile command or npm scripts command that is used to regenerate this bundle. +*/ + +import { IBinaryReader, IBinaryWriter } from "./binary"; +import { Any } from "./google/protobuf/any"; + +import { HttpEndpoint } from "@interchainjs/types"; + + +import { DeliverTxResponse, Event, Attribute } from "@interchainjs/types"; + +export { DeliverTxResponse } + + +export type ProtoMsg = Omit & { typeUrl: any }; + +export interface IAminoMsg { + type: any; + value: Amino; +} + +export interface IProtoType { + $typeUrl?: any; +} + +/** + * A type generated by Telescope 1.0. + */ +export interface TelescopeGeneratedCodec< + T = unknown, + SDK = unknown, + Amino = unknown +> { + readonly typeUrl: string; + readonly aminoType?: string; + is?(o: unknown): o is T; + isSDK?(o: unknown): o is SDK; + isAmino?(o: unknown): o is Amino; + encode: (message: T, writer?: IBinaryWriter | any) => IBinaryWriter | any; + decode: (input: IBinaryReader | Uint8Array | any, length?: number) => T; + fromPartial: (object: any) => T | any; + fromJSON?: (object: any) => T | any; + toJSON?: (message: T | any) => any; + fromSDK?: (sdk: SDK) => T; + fromSDKJSON?: (object: any) => SDK; + toSDK?: (message: T) => SDK; + fromAmino?: (amino: Amino) => T; + toAmino?: (message: T) => Amino; + fromAminoMsg?: (aminoMsg: IAminoMsg) => T; + toAminoMsg?: (message: T) => IAminoMsg; + toProto?: (message: T) => Uint8Array; + fromProtoMsg?: (message: ProtoMsg) => T; + toProtoMsg?: (message: T) => Any; + registerTypeUrl?: () => void; +} + +export type TelescopeGeneratedType< + T = unknown, + SDK = unknown, + Amino = unknown +> = TelescopeGeneratedCodec; + +export type GeneratedType = TelescopeGeneratedCodec; + +/** + * Coin defines a token with a denomination and an amount. + * + * NOTE: The amount field is an Int which implements the custom method + * signatures required by gogoproto. + */ +interface Coin { + denom: string; + amount: string; +} + +export type EncodeObject = Message; + +export interface Message { + typeUrl: string; + value: T; +} + +export interface StdFee { + amount: Coin[]; + gas: string; + /** The granter address that is used for paying with feegrants */ + granter?: string; + /** The fee payer address. The payer must have signed the transaction. */ + payer?: string; +} + + +export interface TxRpc { + request( + service: string, + method: string, + data: Uint8Array + ): Promise; + signAndBroadcast?( + signerAddress: string, + messages: EncodeObject[], + fee: StdFee | "auto" | number, + memo: string + ): Promise; +} + diff --git a/__fixtures__/misc/output-proto-amino/no-amino/extern.ts b/__fixtures__/misc/output-proto-amino/no-amino/extern.ts index c3e7cbcac8..83d6864ae2 100644 --- a/__fixtures__/misc/output-proto-amino/no-amino/extern.ts +++ b/__fixtures__/misc/output-proto-amino/no-amino/extern.ts @@ -4,30 +4,45 @@ * and run the transpile command or npm scripts command that is used to regenerate this bundle. */ -import { QueryClient, createProtobufRpcClient, ProtobufRpcClient } from '@cosmjs/stargate' -import { Tendermint34Client, HttpEndpoint } from "@cosmjs/tendermint-rpc"; -const _rpcClients: Record = {}; +import { HttpEndpoint } from "@interchainjs/types"; +import { Rpc } from "./helpers"; +import { ClientOptions, createCosmosQueryClient } from "@interchainjs/cosmos"; + +const _rpcClients: Record = {}; export const getRpcEndpointKey = (rpcEndpoint: string | HttpEndpoint) => { - if (typeof rpcEndpoint === 'string') { - return rpcEndpoint; - } else if (!!rpcEndpoint) { - //@ts-ignore - return rpcEndpoint.url; - } + if (typeof rpcEndpoint === 'string') { + return rpcEndpoint; + } else if (!!rpcEndpoint) { + //@ts-ignore + return rpcEndpoint.url; + } } export const getRpcClient = async (rpcEndpoint: string | HttpEndpoint) => { - const key = getRpcEndpointKey(rpcEndpoint); - if (!key) return; - if (_rpcClients.hasOwnProperty(key)) { - return _rpcClients[key]; - } - const tmClient = await Tendermint34Client.connect(rpcEndpoint); - //@ts-ignore - const client = new QueryClient(tmClient); - const rpc = createProtobufRpcClient(client); - _rpcClients[key] = rpc; - return rpc; + const key = getRpcEndpointKey(rpcEndpoint); + if (!key) return; + if (_rpcClients.hasOwnProperty(key)) { + return _rpcClients[key]; + } + const rpc = await createRpcClient(rpcEndpoint); + _rpcClients[key] = rpc; + return rpc; +} + +export const createRpcClient = async (rpcEndpoint: string | HttpEndpoint, + options?: ClientOptions +) => { + if (typeof rpcEndpoint === 'string') { + return createCosmosQueryClient(rpcEndpoint, options); + } else { + const endpointStr = rpcEndpoint.url; + const clientOptions = { + ...options, + headers: rpcEndpoint.headers + }; + + return createCosmosQueryClient(endpointStr, clientOptions); + } } diff --git a/__fixtures__/misc/output-proto-amino/no-amino/gogoproto/bundle.ts b/__fixtures__/misc/output-proto-amino/no-amino/gogoproto/bundle.ts index 35aacd21ad..633dc1cc68 100644 --- a/__fixtures__/misc/output-proto-amino/no-amino/gogoproto/bundle.ts +++ b/__fixtures__/misc/output-proto-amino/no-amino/gogoproto/bundle.ts @@ -1,4 +1,4 @@ -import * as _14 from "./gogo"; +import * as _15 from "./gogo"; export const gogoproto = { - ..._14 + ..._15 }; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/no-amino/google/bundle.ts b/__fixtures__/misc/output-proto-amino/no-amino/google/bundle.ts index 9f8566769c..c420be35ad 100644 --- a/__fixtures__/misc/output-proto-amino/no-amino/google/bundle.ts +++ b/__fixtures__/misc/output-proto-amino/no-amino/google/bundle.ts @@ -1,20 +1,20 @@ -import * as _15 from "./api/expr/v1alpha1/eval"; -import * as _16 from "./protobuf/any"; -import * as _17 from "./protobuf/descriptor"; -import * as _18 from "./protobuf/duration"; -import * as _19 from "./protobuf/timestamp"; +import * as _16 from "./api/expr/v1alpha1/eval"; +import * as _17 from "./protobuf/any"; +import * as _18 from "./protobuf/descriptor"; +import * as _19 from "./protobuf/duration"; +import * as _20 from "./protobuf/timestamp"; export namespace google { export namespace api { export namespace expr { export const v1alpha1 = { - ..._15 + ..._16 }; } } export const protobuf = { - ..._16, ..._17, ..._18, - ..._19 + ..._19, + ..._20 }; } \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/no-amino/helper-func-types.ts b/__fixtures__/misc/output-proto-amino/no-amino/helper-func-types.ts new file mode 100644 index 0000000000..5f9d7a87a0 --- /dev/null +++ b/__fixtures__/misc/output-proto-amino/no-amino/helper-func-types.ts @@ -0,0 +1,92 @@ +/** +* This file and any referenced files were automatically generated by @hyperweb/telescope@latest +* DO NOT MODIFY BY HAND. Instead, download the latest proto files for your chain +* and run the transpile command or npm scripts command that is used to regenerate this bundle. +*/ + + +import { HttpEndpoint } from "@interchainjs/types"; +import { BinaryReader, BinaryWriter } from "./binary"; +import { getRpcClient } from "./extern"; +import { isRpc, Rpc } from "./helpers"; +import { TelescopeGeneratedCodec, DeliverTxResponse, Message, StdFee } from "./types"; +import { toConverters, toEncoders } from "@interchainjs/cosmos/utils"; +import { ISigningClient } from "@interchainjs/cosmos/types/signing-client"; + +export interface QueryBuilderOptions { + encode: (request: TReq, writer?: BinaryWriter) => BinaryWriter + decode: (input: BinaryReader | Uint8Array, length?: number) => TRes + service: string, + method: string, +} + +export function buildQuery(opts: QueryBuilderOptions) { + return async (client: EndpointOrRpc, request: TReq) => { + let rpc: Rpc | undefined; + + if(isRpc(client)) { + rpc = client; + } else { + rpc = client ? await getRpcClient(client) : undefined; + } + + if (!rpc) throw new Error("Query Rpc is not initialized"); + + const data = opts.encode(request).finish(); + const response = await rpc.request(opts.service, opts.method, data); + return opts.decode(response); + }; +} + +export interface ITxArgs { + signerAddress: string; + message: TMsg | TMsg[]; + fee: StdFee | 'auto'; + memo: string; +} + +export interface TxBuilderOptions { + msg: TelescopeGeneratedCodec +} + +export function buildTx(opts: TxBuilderOptions) { + return async ( + client: ISigningClient, + signerAddress: string, + message: TMsg | TMsg[], + fee: StdFee | 'auto', + memo: string + ): Promise => { + if (!client) throw new Error("SigningClient is not initialized"); + + //register all related encoders and converters + client.addEncoders?.(toEncoders(opts.msg)); + client.addConverters?.(toConverters(opts.msg)); + + const data = Array.isArray(message) + ? message.map(msg => ({ + typeUrl: opts.msg.typeUrl, + value: msg, + })) + : [{ + typeUrl: opts.msg.typeUrl, + value: message, + }]; + return client.signAndBroadcast!(signerAddress, data, fee, memo); + }; +} + +export interface Encoder { + typeUrl: string; + fromPartial: (data: any) => any; + encode: (data: any) => Uint8Array; +} + +export interface AminoConverter { + typeUrl: string; + aminoType: string; + fromAmino: (data: any) => any; + toAmino: (data: any) => any; +} + +export type EndpointOrRpc = string | HttpEndpoint | Rpc ; diff --git a/__fixtures__/misc/output-proto-amino/no-amino/index.ts b/__fixtures__/misc/output-proto-amino/no-amino/index.ts index d589dcd349..6b7006730a 100644 --- a/__fixtures__/misc/output-proto-amino/no-amino/index.ts +++ b/__fixtures__/misc/output-proto-amino/no-amino/index.ts @@ -8,10 +8,12 @@ export * from "./gogoproto/bundle"; export * from "./google/bundle"; export * from "./misc/bundle"; export * from "./extern"; +export * from "./helper-func-types"; export * from "./react-query"; export * from "./mobx"; export * from "./pinia-endpoint"; export * from "./json-safe"; export * from "./varint"; export * from "./utf8"; -export * from "./binary"; \ No newline at end of file +export * from "./binary"; +export * from "./types"; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/no-amino/misc/all_fields.ts b/__fixtures__/misc/output-proto-amino/no-amino/misc/all_fields.ts index 2211ec2356..1c2d132e7e 100644 --- a/__fixtures__/misc/output-proto-amino/no-amino/misc/all_fields.ts +++ b/__fixtures__/misc/output-proto-amino/no-amino/misc/all_fields.ts @@ -4,10 +4,10 @@ import { Duration, DurationSDKType } from "../google/protobuf/duration"; import { Timestamp, TimestampSDKType } from "../google/protobuf/timestamp"; import { BinaryReader, BinaryWriter } from "../binary"; import { toTimestamp, fromTimestamp, isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../helpers"; -import { Decimal } from "@cosmjs/math"; +import { Decimal } from "@interchainjs/math"; import { JsonSafe } from "../json-safe"; -import { toUtf8, fromBase64, fromUtf8, toBase64 } from "@cosmjs/encoding"; -import { encodePubkey, decodePubkey } from "@cosmjs/proto-signing"; +import { toUtf8, fromBase64, fromUtf8, toBase64 } from "@interchainjs/encoding"; +import { encodePubkey, decodePubkey } from "@interchainjs/pubkey"; export const protobufPackage = "misc"; /** * @name EncodingTestForDontOmit @@ -1505,15 +1505,15 @@ export const EncodingTestForDontOmit = { } else { obj.d_o_auths = message.dOAuths; } - obj.dec = message.dec === "" ? undefined : message.dec; - obj.d_o_dec = message.dODec ?? ""; + obj.dec = message.dec === "" ? undefined : Decimal.fromUserInput(message.dec, 18).atomics; + obj.d_o_dec = Decimal.fromUserInput(message.dODec, 18).atomics ?? ""; if (message.decs) { - obj.decs = message.decs.map(e => e); + obj.decs = message.decs.map(e => Decimal.fromUserInput(e, 18).atomics); } else { obj.decs = message.decs; } if (message.dODecs) { - obj.d_o_decs = message.dODecs.map(e => e); + obj.d_o_decs = message.dODecs.map(e => Decimal.fromUserInput(e, 18).atomics); } else { obj.d_o_decs = message.dODecs; } @@ -2671,15 +2671,15 @@ export const EncodingTestForOmit = { } else { obj.o_auths = message.oAuths; } - obj.dec = message.dec ?? ""; - obj.o_dec = message.oDec === "" ? undefined : message.oDec; + obj.dec = Decimal.fromUserInput(message.dec, 18).atomics ?? ""; + obj.o_dec = message.oDec === "" ? undefined : Decimal.fromUserInput(message.oDec, 18).atomics; if (message.decs) { - obj.decs = message.decs.map(e => e); + obj.decs = message.decs.map(e => Decimal.fromUserInput(e, 18).atomics); } else { obj.decs = message.decs; } if (message.oDecs) { - obj.o_decs = message.oDecs.map(e => e); + obj.o_decs = message.oDecs.map(e => Decimal.fromUserInput(e, 18).atomics); } else { obj.o_decs = message.oDecs; } diff --git a/__fixtures__/misc/output-proto-amino/no-amino/misc/bundle.ts b/__fixtures__/misc/output-proto-amino/no-amino/misc/bundle.ts index 2d5b18e7de..e341461478 100644 --- a/__fixtures__/misc/output-proto-amino/no-amino/misc/bundle.ts +++ b/__fixtures__/misc/output-proto-amino/no-amino/misc/bundle.ts @@ -1,16 +1,18 @@ -import * as _20 from "./all_fields"; -import * as _21 from "./eval_request"; -import * as _22 from "./nest"; -import * as _23 from "./tx"; -import * as _24 from "./tx.rpc.msg"; -import * as _25 from "./rpc.tx"; +import * as _21 from "./all_fields"; +import * as _22 from "./eval_request"; +import * as _23 from "./nest"; +import * as _24 from "./tx"; +import * as _25 from "./tx.rpc.func"; +import * as _26 from "./tx.rpc.msg"; +import * as _27 from "./rpc.tx"; export const misc = { - ..._20, ..._21, ..._22, ..._23, ..._24, + ..._25, + ..._26, ClientFactory: { - ..._25 + ..._27 } }; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/no-amino/misc/tx.rpc.func.ts b/__fixtures__/misc/output-proto-amino/no-amino/misc/tx.rpc.func.ts new file mode 100644 index 0000000000..e3a3906134 --- /dev/null +++ b/__fixtures__/misc/output-proto-amino/no-amino/misc/tx.rpc.func.ts @@ -0,0 +1,12 @@ +import { EncodingTestForDontOmit, EncodingTestForDontOmitSDKType, EncodingTestForOmit, EncodingTestForOmitSDKType } from "./all_fields"; +import { buildTx } from "../helper-func-types"; +import { InputMsg, InputMsgSDKType, MsgResponse, MsgResponseSDKType } from "./tx"; +/** + * test tx + * @name sendMsg + * @package misc + * @see proto service: misc.SendMsg + */ +export const sendMsg = buildTx({ + msg: InputMsg +}); \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/no-amino/misc/tx.rpc.msg.ts b/__fixtures__/misc/output-proto-amino/no-amino/misc/tx.rpc.msg.ts index 6d03a2bcb5..c4e3a250fa 100644 --- a/__fixtures__/misc/output-proto-amino/no-amino/misc/tx.rpc.msg.ts +++ b/__fixtures__/misc/output-proto-amino/no-amino/misc/tx.rpc.msg.ts @@ -1,5 +1,5 @@ import { EncodingTestForDontOmit, EncodingTestForDontOmitSDKType, EncodingTestForOmit, EncodingTestForOmitSDKType } from "./all_fields"; -import { Rpc } from "../helpers"; +import { TxRpc } from "../types"; import { BinaryReader } from "../binary"; import { InputMsg, InputMsgSDKType, MsgResponse, MsgResponseSDKType } from "./tx"; export interface Msg { @@ -7,8 +7,8 @@ export interface Msg { sendMsg(request: InputMsg): Promise; } export class MsgClientImpl implements Msg { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.sendMsg = this.sendMsg.bind(this); } @@ -18,6 +18,6 @@ export class MsgClientImpl implements Msg { return promise.then(data => MsgResponse.decode(new BinaryReader(data))); } } -export const createClientImpl = (rpc: Rpc) => { +export const createClientImpl = (rpc: TxRpc) => { return new MsgClientImpl(rpc); }; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/no-amino/types.ts b/__fixtures__/misc/output-proto-amino/no-amino/types.ts new file mode 100644 index 0000000000..1acee677e2 --- /dev/null +++ b/__fixtures__/misc/output-proto-amino/no-amino/types.ts @@ -0,0 +1,109 @@ +/** +* This file and any referenced files were automatically generated by @hyperweb/telescope@latest +* DO NOT MODIFY BY HAND. Instead, download the latest proto files for your chain +* and run the transpile command or npm scripts command that is used to regenerate this bundle. +*/ + +import { IBinaryReader, IBinaryWriter } from "./binary"; +import { Any } from "./google/protobuf/any"; + +import { HttpEndpoint } from "@interchainjs/types"; + + +import { DeliverTxResponse, Event, Attribute } from "@interchainjs/types"; + +export { DeliverTxResponse } + + +export type ProtoMsg = Omit & { typeUrl: any }; + +export interface IAminoMsg { + type: any; + value: Amino; +} + +export interface IProtoType { + $typeUrl?: any; +} + +/** + * A type generated by Telescope 1.0. + */ +export interface TelescopeGeneratedCodec< + T = unknown, + SDK = unknown, + Amino = unknown +> { + readonly typeUrl: string; + readonly aminoType?: string; + is?(o: unknown): o is T; + isSDK?(o: unknown): o is SDK; + isAmino?(o: unknown): o is Amino; + encode: (message: T, writer?: IBinaryWriter | any) => IBinaryWriter | any; + decode: (input: IBinaryReader | Uint8Array | any, length?: number) => T; + fromPartial: (object: any) => T | any; + fromJSON?: (object: any) => T | any; + toJSON?: (message: T | any) => any; + fromSDK?: (sdk: SDK) => T; + fromSDKJSON?: (object: any) => SDK; + toSDK?: (message: T) => SDK; + fromAmino?: (amino: Amino) => T; + toAmino?: (message: T) => Amino; + fromAminoMsg?: (aminoMsg: IAminoMsg) => T; + toAminoMsg?: (message: T) => IAminoMsg; + toProto?: (message: T) => Uint8Array; + fromProtoMsg?: (message: ProtoMsg) => T; + toProtoMsg?: (message: T) => Any; + registerTypeUrl?: () => void; +} + +export type TelescopeGeneratedType< + T = unknown, + SDK = unknown, + Amino = unknown +> = TelescopeGeneratedCodec; + +export type GeneratedType = TelescopeGeneratedCodec; + +/** + * Coin defines a token with a denomination and an amount. + * + * NOTE: The amount field is an Int which implements the custom method + * signatures required by gogoproto. + */ +interface Coin { + denom: string; + amount: string; +} + +export type EncodeObject = Message; + +export interface Message { + typeUrl: string; + value: T; +} + +export interface StdFee { + amount: Coin[]; + gas: string; + /** The granter address that is used for paying with feegrants */ + granter?: string; + /** The fee payer address. The payer must have signed the transaction. */ + payer?: string; +} + + +export interface TxRpc { + request( + service: string, + method: string, + data: Uint8Array + ): Promise; + signAndBroadcast?( + signerAddress: string, + messages: EncodeObject[], + fee: StdFee | "auto" | number, + memo: string + ): Promise; +} + diff --git a/__fixtures__/misc/output-proto-amino/proto-only-legacy/extern.ts b/__fixtures__/misc/output-proto-amino/proto-only-legacy/extern.ts index c3e7cbcac8..83d6864ae2 100644 --- a/__fixtures__/misc/output-proto-amino/proto-only-legacy/extern.ts +++ b/__fixtures__/misc/output-proto-amino/proto-only-legacy/extern.ts @@ -4,30 +4,45 @@ * and run the transpile command or npm scripts command that is used to regenerate this bundle. */ -import { QueryClient, createProtobufRpcClient, ProtobufRpcClient } from '@cosmjs/stargate' -import { Tendermint34Client, HttpEndpoint } from "@cosmjs/tendermint-rpc"; -const _rpcClients: Record = {}; +import { HttpEndpoint } from "@interchainjs/types"; +import { Rpc } from "./helpers"; +import { ClientOptions, createCosmosQueryClient } from "@interchainjs/cosmos"; + +const _rpcClients: Record = {}; export const getRpcEndpointKey = (rpcEndpoint: string | HttpEndpoint) => { - if (typeof rpcEndpoint === 'string') { - return rpcEndpoint; - } else if (!!rpcEndpoint) { - //@ts-ignore - return rpcEndpoint.url; - } + if (typeof rpcEndpoint === 'string') { + return rpcEndpoint; + } else if (!!rpcEndpoint) { + //@ts-ignore + return rpcEndpoint.url; + } } export const getRpcClient = async (rpcEndpoint: string | HttpEndpoint) => { - const key = getRpcEndpointKey(rpcEndpoint); - if (!key) return; - if (_rpcClients.hasOwnProperty(key)) { - return _rpcClients[key]; - } - const tmClient = await Tendermint34Client.connect(rpcEndpoint); - //@ts-ignore - const client = new QueryClient(tmClient); - const rpc = createProtobufRpcClient(client); - _rpcClients[key] = rpc; - return rpc; + const key = getRpcEndpointKey(rpcEndpoint); + if (!key) return; + if (_rpcClients.hasOwnProperty(key)) { + return _rpcClients[key]; + } + const rpc = await createRpcClient(rpcEndpoint); + _rpcClients[key] = rpc; + return rpc; +} + +export const createRpcClient = async (rpcEndpoint: string | HttpEndpoint, + options?: ClientOptions +) => { + if (typeof rpcEndpoint === 'string') { + return createCosmosQueryClient(rpcEndpoint, options); + } else { + const endpointStr = rpcEndpoint.url; + const clientOptions = { + ...options, + headers: rpcEndpoint.headers + }; + + return createCosmosQueryClient(endpointStr, clientOptions); + } } diff --git a/__fixtures__/misc/output-proto-amino/proto-only-legacy/gogoproto/bundle.ts b/__fixtures__/misc/output-proto-amino/proto-only-legacy/gogoproto/bundle.ts index 01dc8250b2..47059aa456 100644 --- a/__fixtures__/misc/output-proto-amino/proto-only-legacy/gogoproto/bundle.ts +++ b/__fixtures__/misc/output-proto-amino/proto-only-legacy/gogoproto/bundle.ts @@ -1,4 +1,4 @@ -import * as _112 from "./gogo"; +import * as _121 from "./gogo"; export const gogoproto = { - ..._112 + ..._121 }; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/proto-only-legacy/google/bundle.ts b/__fixtures__/misc/output-proto-amino/proto-only-legacy/google/bundle.ts index b9b335619e..f6f7b2805d 100644 --- a/__fixtures__/misc/output-proto-amino/proto-only-legacy/google/bundle.ts +++ b/__fixtures__/misc/output-proto-amino/proto-only-legacy/google/bundle.ts @@ -1,20 +1,20 @@ -import * as _113 from "./api/expr/v1alpha1/eval"; -import * as _114 from "./protobuf/any"; -import * as _115 from "./protobuf/descriptor"; -import * as _116 from "./protobuf/duration"; -import * as _117 from "./protobuf/timestamp"; +import * as _122 from "./api/expr/v1alpha1/eval"; +import * as _123 from "./protobuf/any"; +import * as _124 from "./protobuf/descriptor"; +import * as _125 from "./protobuf/duration"; +import * as _126 from "./protobuf/timestamp"; export namespace google { export namespace api { export namespace expr { export const v1alpha1 = { - ..._113 + ..._122 }; } } export const protobuf = { - ..._114, - ..._115, - ..._116, - ..._117 + ..._123, + ..._124, + ..._125, + ..._126 }; } \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/proto-only-legacy/helper-func-types.ts b/__fixtures__/misc/output-proto-amino/proto-only-legacy/helper-func-types.ts new file mode 100644 index 0000000000..5f9d7a87a0 --- /dev/null +++ b/__fixtures__/misc/output-proto-amino/proto-only-legacy/helper-func-types.ts @@ -0,0 +1,92 @@ +/** +* This file and any referenced files were automatically generated by @hyperweb/telescope@latest +* DO NOT MODIFY BY HAND. Instead, download the latest proto files for your chain +* and run the transpile command or npm scripts command that is used to regenerate this bundle. +*/ + + +import { HttpEndpoint } from "@interchainjs/types"; +import { BinaryReader, BinaryWriter } from "./binary"; +import { getRpcClient } from "./extern"; +import { isRpc, Rpc } from "./helpers"; +import { TelescopeGeneratedCodec, DeliverTxResponse, Message, StdFee } from "./types"; +import { toConverters, toEncoders } from "@interchainjs/cosmos/utils"; +import { ISigningClient } from "@interchainjs/cosmos/types/signing-client"; + +export interface QueryBuilderOptions { + encode: (request: TReq, writer?: BinaryWriter) => BinaryWriter + decode: (input: BinaryReader | Uint8Array, length?: number) => TRes + service: string, + method: string, +} + +export function buildQuery(opts: QueryBuilderOptions) { + return async (client: EndpointOrRpc, request: TReq) => { + let rpc: Rpc | undefined; + + if(isRpc(client)) { + rpc = client; + } else { + rpc = client ? await getRpcClient(client) : undefined; + } + + if (!rpc) throw new Error("Query Rpc is not initialized"); + + const data = opts.encode(request).finish(); + const response = await rpc.request(opts.service, opts.method, data); + return opts.decode(response); + }; +} + +export interface ITxArgs { + signerAddress: string; + message: TMsg | TMsg[]; + fee: StdFee | 'auto'; + memo: string; +} + +export interface TxBuilderOptions { + msg: TelescopeGeneratedCodec +} + +export function buildTx(opts: TxBuilderOptions) { + return async ( + client: ISigningClient, + signerAddress: string, + message: TMsg | TMsg[], + fee: StdFee | 'auto', + memo: string + ): Promise => { + if (!client) throw new Error("SigningClient is not initialized"); + + //register all related encoders and converters + client.addEncoders?.(toEncoders(opts.msg)); + client.addConverters?.(toConverters(opts.msg)); + + const data = Array.isArray(message) + ? message.map(msg => ({ + typeUrl: opts.msg.typeUrl, + value: msg, + })) + : [{ + typeUrl: opts.msg.typeUrl, + value: message, + }]; + return client.signAndBroadcast!(signerAddress, data, fee, memo); + }; +} + +export interface Encoder { + typeUrl: string; + fromPartial: (data: any) => any; + encode: (data: any) => Uint8Array; +} + +export interface AminoConverter { + typeUrl: string; + aminoType: string; + fromAmino: (data: any) => any; + toAmino: (data: any) => any; +} + +export type EndpointOrRpc = string | HttpEndpoint | Rpc ; diff --git a/__fixtures__/misc/output-proto-amino/proto-only-legacy/index.ts b/__fixtures__/misc/output-proto-amino/proto-only-legacy/index.ts index d589dcd349..6b7006730a 100644 --- a/__fixtures__/misc/output-proto-amino/proto-only-legacy/index.ts +++ b/__fixtures__/misc/output-proto-amino/proto-only-legacy/index.ts @@ -8,10 +8,12 @@ export * from "./gogoproto/bundle"; export * from "./google/bundle"; export * from "./misc/bundle"; export * from "./extern"; +export * from "./helper-func-types"; export * from "./react-query"; export * from "./mobx"; export * from "./pinia-endpoint"; export * from "./json-safe"; export * from "./varint"; export * from "./utf8"; -export * from "./binary"; \ No newline at end of file +export * from "./binary"; +export * from "./types"; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/proto-only-legacy/misc/all_fields.ts b/__fixtures__/misc/output-proto-amino/proto-only-legacy/misc/all_fields.ts index 2d3b633949..1ebd05f6db 100644 --- a/__fixtures__/misc/output-proto-amino/proto-only-legacy/misc/all_fields.ts +++ b/__fixtures__/misc/output-proto-amino/proto-only-legacy/misc/all_fields.ts @@ -4,7 +4,7 @@ import { Duration, DurationSDKType } from "../google/protobuf/duration"; import { Timestamp, TimestampSDKType } from "../google/protobuf/timestamp"; import { BinaryReader, BinaryWriter } from "../binary"; import { toTimestamp, fromTimestamp, isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../helpers"; -import { Decimal } from "@cosmjs/math"; +import { Decimal } from "@interchainjs/math"; import { JsonSafe } from "../json-safe"; export const protobufPackage = "misc"; /** diff --git a/__fixtures__/misc/output-proto-amino/proto-only-legacy/misc/bundle.ts b/__fixtures__/misc/output-proto-amino/proto-only-legacy/misc/bundle.ts index eb80087626..fb91585483 100644 --- a/__fixtures__/misc/output-proto-amino/proto-only-legacy/misc/bundle.ts +++ b/__fixtures__/misc/output-proto-amino/proto-only-legacy/misc/bundle.ts @@ -1,16 +1,18 @@ -import * as _118 from "./all_fields"; -import * as _119 from "./eval_request"; -import * as _120 from "./nest"; -import * as _121 from "./tx"; -import * as _122 from "./tx.rpc.msg"; -import * as _123 from "./rpc.tx"; +import * as _127 from "./all_fields"; +import * as _128 from "./eval_request"; +import * as _129 from "./nest"; +import * as _130 from "./tx"; +import * as _131 from "./tx.rpc.func"; +import * as _132 from "./tx.rpc.msg"; +import * as _133 from "./rpc.tx"; export const misc = { - ..._118, - ..._119, - ..._120, - ..._121, - ..._122, + ..._127, + ..._128, + ..._129, + ..._130, + ..._131, + ..._132, ClientFactory: { - ..._123 + ..._133 } }; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/proto-only-legacy/misc/tx.rpc.func.ts b/__fixtures__/misc/output-proto-amino/proto-only-legacy/misc/tx.rpc.func.ts new file mode 100644 index 0000000000..e3a3906134 --- /dev/null +++ b/__fixtures__/misc/output-proto-amino/proto-only-legacy/misc/tx.rpc.func.ts @@ -0,0 +1,12 @@ +import { EncodingTestForDontOmit, EncodingTestForDontOmitSDKType, EncodingTestForOmit, EncodingTestForOmitSDKType } from "./all_fields"; +import { buildTx } from "../helper-func-types"; +import { InputMsg, InputMsgSDKType, MsgResponse, MsgResponseSDKType } from "./tx"; +/** + * test tx + * @name sendMsg + * @package misc + * @see proto service: misc.SendMsg + */ +export const sendMsg = buildTx({ + msg: InputMsg +}); \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/proto-only-legacy/misc/tx.rpc.msg.ts b/__fixtures__/misc/output-proto-amino/proto-only-legacy/misc/tx.rpc.msg.ts index 6d03a2bcb5..c4e3a250fa 100644 --- a/__fixtures__/misc/output-proto-amino/proto-only-legacy/misc/tx.rpc.msg.ts +++ b/__fixtures__/misc/output-proto-amino/proto-only-legacy/misc/tx.rpc.msg.ts @@ -1,5 +1,5 @@ import { EncodingTestForDontOmit, EncodingTestForDontOmitSDKType, EncodingTestForOmit, EncodingTestForOmitSDKType } from "./all_fields"; -import { Rpc } from "../helpers"; +import { TxRpc } from "../types"; import { BinaryReader } from "../binary"; import { InputMsg, InputMsgSDKType, MsgResponse, MsgResponseSDKType } from "./tx"; export interface Msg { @@ -7,8 +7,8 @@ export interface Msg { sendMsg(request: InputMsg): Promise; } export class MsgClientImpl implements Msg { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.sendMsg = this.sendMsg.bind(this); } @@ -18,6 +18,6 @@ export class MsgClientImpl implements Msg { return promise.then(data => MsgResponse.decode(new BinaryReader(data))); } } -export const createClientImpl = (rpc: Rpc) => { +export const createClientImpl = (rpc: TxRpc) => { return new MsgClientImpl(rpc); }; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/proto-only-legacy/types.ts b/__fixtures__/misc/output-proto-amino/proto-only-legacy/types.ts new file mode 100644 index 0000000000..1acee677e2 --- /dev/null +++ b/__fixtures__/misc/output-proto-amino/proto-only-legacy/types.ts @@ -0,0 +1,109 @@ +/** +* This file and any referenced files were automatically generated by @hyperweb/telescope@latest +* DO NOT MODIFY BY HAND. Instead, download the latest proto files for your chain +* and run the transpile command or npm scripts command that is used to regenerate this bundle. +*/ + +import { IBinaryReader, IBinaryWriter } from "./binary"; +import { Any } from "./google/protobuf/any"; + +import { HttpEndpoint } from "@interchainjs/types"; + + +import { DeliverTxResponse, Event, Attribute } from "@interchainjs/types"; + +export { DeliverTxResponse } + + +export type ProtoMsg = Omit & { typeUrl: any }; + +export interface IAminoMsg { + type: any; + value: Amino; +} + +export interface IProtoType { + $typeUrl?: any; +} + +/** + * A type generated by Telescope 1.0. + */ +export interface TelescopeGeneratedCodec< + T = unknown, + SDK = unknown, + Amino = unknown +> { + readonly typeUrl: string; + readonly aminoType?: string; + is?(o: unknown): o is T; + isSDK?(o: unknown): o is SDK; + isAmino?(o: unknown): o is Amino; + encode: (message: T, writer?: IBinaryWriter | any) => IBinaryWriter | any; + decode: (input: IBinaryReader | Uint8Array | any, length?: number) => T; + fromPartial: (object: any) => T | any; + fromJSON?: (object: any) => T | any; + toJSON?: (message: T | any) => any; + fromSDK?: (sdk: SDK) => T; + fromSDKJSON?: (object: any) => SDK; + toSDK?: (message: T) => SDK; + fromAmino?: (amino: Amino) => T; + toAmino?: (message: T) => Amino; + fromAminoMsg?: (aminoMsg: IAminoMsg) => T; + toAminoMsg?: (message: T) => IAminoMsg; + toProto?: (message: T) => Uint8Array; + fromProtoMsg?: (message: ProtoMsg) => T; + toProtoMsg?: (message: T) => Any; + registerTypeUrl?: () => void; +} + +export type TelescopeGeneratedType< + T = unknown, + SDK = unknown, + Amino = unknown +> = TelescopeGeneratedCodec; + +export type GeneratedType = TelescopeGeneratedCodec; + +/** + * Coin defines a token with a denomination and an amount. + * + * NOTE: The amount field is an Int which implements the custom method + * signatures required by gogoproto. + */ +interface Coin { + denom: string; + amount: string; +} + +export type EncodeObject = Message; + +export interface Message { + typeUrl: string; + value: T; +} + +export interface StdFee { + amount: Coin[]; + gas: string; + /** The granter address that is used for paying with feegrants */ + granter?: string; + /** The fee payer address. The payer must have signed the transaction. */ + payer?: string; +} + + +export interface TxRpc { + request( + service: string, + method: string, + data: Uint8Array + ): Promise; + signAndBroadcast?( + signerAddress: string, + messages: EncodeObject[], + fee: StdFee | "auto" | number, + memo: string + ): Promise; +} + diff --git a/__fixtures__/misc/output-proto-amino/proto-only/extern.ts b/__fixtures__/misc/output-proto-amino/proto-only/extern.ts index c3e7cbcac8..83d6864ae2 100644 --- a/__fixtures__/misc/output-proto-amino/proto-only/extern.ts +++ b/__fixtures__/misc/output-proto-amino/proto-only/extern.ts @@ -4,30 +4,45 @@ * and run the transpile command or npm scripts command that is used to regenerate this bundle. */ -import { QueryClient, createProtobufRpcClient, ProtobufRpcClient } from '@cosmjs/stargate' -import { Tendermint34Client, HttpEndpoint } from "@cosmjs/tendermint-rpc"; -const _rpcClients: Record = {}; +import { HttpEndpoint } from "@interchainjs/types"; +import { Rpc } from "./helpers"; +import { ClientOptions, createCosmosQueryClient } from "@interchainjs/cosmos"; + +const _rpcClients: Record = {}; export const getRpcEndpointKey = (rpcEndpoint: string | HttpEndpoint) => { - if (typeof rpcEndpoint === 'string') { - return rpcEndpoint; - } else if (!!rpcEndpoint) { - //@ts-ignore - return rpcEndpoint.url; - } + if (typeof rpcEndpoint === 'string') { + return rpcEndpoint; + } else if (!!rpcEndpoint) { + //@ts-ignore + return rpcEndpoint.url; + } } export const getRpcClient = async (rpcEndpoint: string | HttpEndpoint) => { - const key = getRpcEndpointKey(rpcEndpoint); - if (!key) return; - if (_rpcClients.hasOwnProperty(key)) { - return _rpcClients[key]; - } - const tmClient = await Tendermint34Client.connect(rpcEndpoint); - //@ts-ignore - const client = new QueryClient(tmClient); - const rpc = createProtobufRpcClient(client); - _rpcClients[key] = rpc; - return rpc; + const key = getRpcEndpointKey(rpcEndpoint); + if (!key) return; + if (_rpcClients.hasOwnProperty(key)) { + return _rpcClients[key]; + } + const rpc = await createRpcClient(rpcEndpoint); + _rpcClients[key] = rpc; + return rpc; +} + +export const createRpcClient = async (rpcEndpoint: string | HttpEndpoint, + options?: ClientOptions +) => { + if (typeof rpcEndpoint === 'string') { + return createCosmosQueryClient(rpcEndpoint, options); + } else { + const endpointStr = rpcEndpoint.url; + const clientOptions = { + ...options, + headers: rpcEndpoint.headers + }; + + return createCosmosQueryClient(endpointStr, clientOptions); + } } diff --git a/__fixtures__/misc/output-proto-amino/proto-only/gogoproto/bundle.ts b/__fixtures__/misc/output-proto-amino/proto-only/gogoproto/bundle.ts index 019169e797..acd56d0faa 100644 --- a/__fixtures__/misc/output-proto-amino/proto-only/gogoproto/bundle.ts +++ b/__fixtures__/misc/output-proto-amino/proto-only/gogoproto/bundle.ts @@ -1,4 +1,4 @@ -import * as _76 from "./gogo"; +import * as _82 from "./gogo"; export const gogoproto = { - ..._76 + ..._82 }; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/proto-only/google/bundle.ts b/__fixtures__/misc/output-proto-amino/proto-only/google/bundle.ts index b9054180c6..efe42f3fc1 100644 --- a/__fixtures__/misc/output-proto-amino/proto-only/google/bundle.ts +++ b/__fixtures__/misc/output-proto-amino/proto-only/google/bundle.ts @@ -1,20 +1,20 @@ -import * as _77 from "./api/expr/v1alpha1/eval"; -import * as _78 from "./protobuf/any"; -import * as _79 from "./protobuf/descriptor"; -import * as _80 from "./protobuf/duration"; -import * as _81 from "./protobuf/timestamp"; +import * as _83 from "./api/expr/v1alpha1/eval"; +import * as _84 from "./protobuf/any"; +import * as _85 from "./protobuf/descriptor"; +import * as _86 from "./protobuf/duration"; +import * as _87 from "./protobuf/timestamp"; export namespace google { export namespace api { export namespace expr { export const v1alpha1 = { - ..._77 + ..._83 }; } } export const protobuf = { - ..._78, - ..._79, - ..._80, - ..._81 + ..._84, + ..._85, + ..._86, + ..._87 }; } \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/proto-only/helper-func-types.ts b/__fixtures__/misc/output-proto-amino/proto-only/helper-func-types.ts new file mode 100644 index 0000000000..5f9d7a87a0 --- /dev/null +++ b/__fixtures__/misc/output-proto-amino/proto-only/helper-func-types.ts @@ -0,0 +1,92 @@ +/** +* This file and any referenced files were automatically generated by @hyperweb/telescope@latest +* DO NOT MODIFY BY HAND. Instead, download the latest proto files for your chain +* and run the transpile command or npm scripts command that is used to regenerate this bundle. +*/ + + +import { HttpEndpoint } from "@interchainjs/types"; +import { BinaryReader, BinaryWriter } from "./binary"; +import { getRpcClient } from "./extern"; +import { isRpc, Rpc } from "./helpers"; +import { TelescopeGeneratedCodec, DeliverTxResponse, Message, StdFee } from "./types"; +import { toConverters, toEncoders } from "@interchainjs/cosmos/utils"; +import { ISigningClient } from "@interchainjs/cosmos/types/signing-client"; + +export interface QueryBuilderOptions { + encode: (request: TReq, writer?: BinaryWriter) => BinaryWriter + decode: (input: BinaryReader | Uint8Array, length?: number) => TRes + service: string, + method: string, +} + +export function buildQuery(opts: QueryBuilderOptions) { + return async (client: EndpointOrRpc, request: TReq) => { + let rpc: Rpc | undefined; + + if(isRpc(client)) { + rpc = client; + } else { + rpc = client ? await getRpcClient(client) : undefined; + } + + if (!rpc) throw new Error("Query Rpc is not initialized"); + + const data = opts.encode(request).finish(); + const response = await rpc.request(opts.service, opts.method, data); + return opts.decode(response); + }; +} + +export interface ITxArgs { + signerAddress: string; + message: TMsg | TMsg[]; + fee: StdFee | 'auto'; + memo: string; +} + +export interface TxBuilderOptions { + msg: TelescopeGeneratedCodec +} + +export function buildTx(opts: TxBuilderOptions) { + return async ( + client: ISigningClient, + signerAddress: string, + message: TMsg | TMsg[], + fee: StdFee | 'auto', + memo: string + ): Promise => { + if (!client) throw new Error("SigningClient is not initialized"); + + //register all related encoders and converters + client.addEncoders?.(toEncoders(opts.msg)); + client.addConverters?.(toConverters(opts.msg)); + + const data = Array.isArray(message) + ? message.map(msg => ({ + typeUrl: opts.msg.typeUrl, + value: msg, + })) + : [{ + typeUrl: opts.msg.typeUrl, + value: message, + }]; + return client.signAndBroadcast!(signerAddress, data, fee, memo); + }; +} + +export interface Encoder { + typeUrl: string; + fromPartial: (data: any) => any; + encode: (data: any) => Uint8Array; +} + +export interface AminoConverter { + typeUrl: string; + aminoType: string; + fromAmino: (data: any) => any; + toAmino: (data: any) => any; +} + +export type EndpointOrRpc = string | HttpEndpoint | Rpc ; diff --git a/__fixtures__/misc/output-proto-amino/proto-only/index.ts b/__fixtures__/misc/output-proto-amino/proto-only/index.ts index d589dcd349..6b7006730a 100644 --- a/__fixtures__/misc/output-proto-amino/proto-only/index.ts +++ b/__fixtures__/misc/output-proto-amino/proto-only/index.ts @@ -8,10 +8,12 @@ export * from "./gogoproto/bundle"; export * from "./google/bundle"; export * from "./misc/bundle"; export * from "./extern"; +export * from "./helper-func-types"; export * from "./react-query"; export * from "./mobx"; export * from "./pinia-endpoint"; export * from "./json-safe"; export * from "./varint"; export * from "./utf8"; -export * from "./binary"; \ No newline at end of file +export * from "./binary"; +export * from "./types"; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/proto-only/misc/all_fields.ts b/__fixtures__/misc/output-proto-amino/proto-only/misc/all_fields.ts index 2d3b633949..1ebd05f6db 100644 --- a/__fixtures__/misc/output-proto-amino/proto-only/misc/all_fields.ts +++ b/__fixtures__/misc/output-proto-amino/proto-only/misc/all_fields.ts @@ -4,7 +4,7 @@ import { Duration, DurationSDKType } from "../google/protobuf/duration"; import { Timestamp, TimestampSDKType } from "../google/protobuf/timestamp"; import { BinaryReader, BinaryWriter } from "../binary"; import { toTimestamp, fromTimestamp, isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../helpers"; -import { Decimal } from "@cosmjs/math"; +import { Decimal } from "@interchainjs/math"; import { JsonSafe } from "../json-safe"; export const protobufPackage = "misc"; /** diff --git a/__fixtures__/misc/output-proto-amino/proto-only/misc/bundle.ts b/__fixtures__/misc/output-proto-amino/proto-only/misc/bundle.ts index 3ad1d56d4f..00e8fde258 100644 --- a/__fixtures__/misc/output-proto-amino/proto-only/misc/bundle.ts +++ b/__fixtures__/misc/output-proto-amino/proto-only/misc/bundle.ts @@ -1,16 +1,18 @@ -import * as _82 from "./all_fields"; -import * as _83 from "./eval_request"; -import * as _84 from "./nest"; -import * as _85 from "./tx"; -import * as _86 from "./tx.rpc.msg"; -import * as _87 from "./rpc.tx"; +import * as _88 from "./all_fields"; +import * as _89 from "./eval_request"; +import * as _90 from "./nest"; +import * as _91 from "./tx"; +import * as _92 from "./tx.rpc.func"; +import * as _93 from "./tx.rpc.msg"; +import * as _94 from "./rpc.tx"; export const misc = { - ..._82, - ..._83, - ..._84, - ..._85, - ..._86, + ..._88, + ..._89, + ..._90, + ..._91, + ..._92, + ..._93, ClientFactory: { - ..._87 + ..._94 } }; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/proto-only/misc/tx.rpc.func.ts b/__fixtures__/misc/output-proto-amino/proto-only/misc/tx.rpc.func.ts new file mode 100644 index 0000000000..e3a3906134 --- /dev/null +++ b/__fixtures__/misc/output-proto-amino/proto-only/misc/tx.rpc.func.ts @@ -0,0 +1,12 @@ +import { EncodingTestForDontOmit, EncodingTestForDontOmitSDKType, EncodingTestForOmit, EncodingTestForOmitSDKType } from "./all_fields"; +import { buildTx } from "../helper-func-types"; +import { InputMsg, InputMsgSDKType, MsgResponse, MsgResponseSDKType } from "./tx"; +/** + * test tx + * @name sendMsg + * @package misc + * @see proto service: misc.SendMsg + */ +export const sendMsg = buildTx({ + msg: InputMsg +}); \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/proto-only/misc/tx.rpc.msg.ts b/__fixtures__/misc/output-proto-amino/proto-only/misc/tx.rpc.msg.ts index 6d03a2bcb5..c4e3a250fa 100644 --- a/__fixtures__/misc/output-proto-amino/proto-only/misc/tx.rpc.msg.ts +++ b/__fixtures__/misc/output-proto-amino/proto-only/misc/tx.rpc.msg.ts @@ -1,5 +1,5 @@ import { EncodingTestForDontOmit, EncodingTestForDontOmitSDKType, EncodingTestForOmit, EncodingTestForOmitSDKType } from "./all_fields"; -import { Rpc } from "../helpers"; +import { TxRpc } from "../types"; import { BinaryReader } from "../binary"; import { InputMsg, InputMsgSDKType, MsgResponse, MsgResponseSDKType } from "./tx"; export interface Msg { @@ -7,8 +7,8 @@ export interface Msg { sendMsg(request: InputMsg): Promise; } export class MsgClientImpl implements Msg { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.sendMsg = this.sendMsg.bind(this); } @@ -18,6 +18,6 @@ export class MsgClientImpl implements Msg { return promise.then(data => MsgResponse.decode(new BinaryReader(data))); } } -export const createClientImpl = (rpc: Rpc) => { +export const createClientImpl = (rpc: TxRpc) => { return new MsgClientImpl(rpc); }; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/proto-only/types.ts b/__fixtures__/misc/output-proto-amino/proto-only/types.ts new file mode 100644 index 0000000000..1acee677e2 --- /dev/null +++ b/__fixtures__/misc/output-proto-amino/proto-only/types.ts @@ -0,0 +1,109 @@ +/** +* This file and any referenced files were automatically generated by @hyperweb/telescope@latest +* DO NOT MODIFY BY HAND. Instead, download the latest proto files for your chain +* and run the transpile command or npm scripts command that is used to regenerate this bundle. +*/ + +import { IBinaryReader, IBinaryWriter } from "./binary"; +import { Any } from "./google/protobuf/any"; + +import { HttpEndpoint } from "@interchainjs/types"; + + +import { DeliverTxResponse, Event, Attribute } from "@interchainjs/types"; + +export { DeliverTxResponse } + + +export type ProtoMsg = Omit & { typeUrl: any }; + +export interface IAminoMsg { + type: any; + value: Amino; +} + +export interface IProtoType { + $typeUrl?: any; +} + +/** + * A type generated by Telescope 1.0. + */ +export interface TelescopeGeneratedCodec< + T = unknown, + SDK = unknown, + Amino = unknown +> { + readonly typeUrl: string; + readonly aminoType?: string; + is?(o: unknown): o is T; + isSDK?(o: unknown): o is SDK; + isAmino?(o: unknown): o is Amino; + encode: (message: T, writer?: IBinaryWriter | any) => IBinaryWriter | any; + decode: (input: IBinaryReader | Uint8Array | any, length?: number) => T; + fromPartial: (object: any) => T | any; + fromJSON?: (object: any) => T | any; + toJSON?: (message: T | any) => any; + fromSDK?: (sdk: SDK) => T; + fromSDKJSON?: (object: any) => SDK; + toSDK?: (message: T) => SDK; + fromAmino?: (amino: Amino) => T; + toAmino?: (message: T) => Amino; + fromAminoMsg?: (aminoMsg: IAminoMsg) => T; + toAminoMsg?: (message: T) => IAminoMsg; + toProto?: (message: T) => Uint8Array; + fromProtoMsg?: (message: ProtoMsg) => T; + toProtoMsg?: (message: T) => Any; + registerTypeUrl?: () => void; +} + +export type TelescopeGeneratedType< + T = unknown, + SDK = unknown, + Amino = unknown +> = TelescopeGeneratedCodec; + +export type GeneratedType = TelescopeGeneratedCodec; + +/** + * Coin defines a token with a denomination and an amount. + * + * NOTE: The amount field is an Int which implements the custom method + * signatures required by gogoproto. + */ +interface Coin { + denom: string; + amount: string; +} + +export type EncodeObject = Message; + +export interface Message { + typeUrl: string; + value: T; +} + +export interface StdFee { + amount: Coin[]; + gas: string; + /** The granter address that is used for paying with feegrants */ + granter?: string; + /** The fee payer address. The payer must have signed the transaction. */ + payer?: string; +} + + +export interface TxRpc { + request( + service: string, + method: string, + data: Uint8Array + ): Promise; + signAndBroadcast?( + signerAddress: string, + messages: EncodeObject[], + fee: StdFee | "auto" | number, + memo: string + ): Promise; +} + diff --git a/__fixtures__/misc/output-scalar-default-nullable-true/extern.ts b/__fixtures__/misc/output-scalar-default-nullable-true/extern.ts index c3e7cbcac8..83d6864ae2 100644 --- a/__fixtures__/misc/output-scalar-default-nullable-true/extern.ts +++ b/__fixtures__/misc/output-scalar-default-nullable-true/extern.ts @@ -4,30 +4,45 @@ * and run the transpile command or npm scripts command that is used to regenerate this bundle. */ -import { QueryClient, createProtobufRpcClient, ProtobufRpcClient } from '@cosmjs/stargate' -import { Tendermint34Client, HttpEndpoint } from "@cosmjs/tendermint-rpc"; -const _rpcClients: Record = {}; +import { HttpEndpoint } from "@interchainjs/types"; +import { Rpc } from "./helpers"; +import { ClientOptions, createCosmosQueryClient } from "@interchainjs/cosmos"; + +const _rpcClients: Record = {}; export const getRpcEndpointKey = (rpcEndpoint: string | HttpEndpoint) => { - if (typeof rpcEndpoint === 'string') { - return rpcEndpoint; - } else if (!!rpcEndpoint) { - //@ts-ignore - return rpcEndpoint.url; - } + if (typeof rpcEndpoint === 'string') { + return rpcEndpoint; + } else if (!!rpcEndpoint) { + //@ts-ignore + return rpcEndpoint.url; + } } export const getRpcClient = async (rpcEndpoint: string | HttpEndpoint) => { - const key = getRpcEndpointKey(rpcEndpoint); - if (!key) return; - if (_rpcClients.hasOwnProperty(key)) { - return _rpcClients[key]; - } - const tmClient = await Tendermint34Client.connect(rpcEndpoint); - //@ts-ignore - const client = new QueryClient(tmClient); - const rpc = createProtobufRpcClient(client); - _rpcClients[key] = rpc; - return rpc; + const key = getRpcEndpointKey(rpcEndpoint); + if (!key) return; + if (_rpcClients.hasOwnProperty(key)) { + return _rpcClients[key]; + } + const rpc = await createRpcClient(rpcEndpoint); + _rpcClients[key] = rpc; + return rpc; +} + +export const createRpcClient = async (rpcEndpoint: string | HttpEndpoint, + options?: ClientOptions +) => { + if (typeof rpcEndpoint === 'string') { + return createCosmosQueryClient(rpcEndpoint, options); + } else { + const endpointStr = rpcEndpoint.url; + const clientOptions = { + ...options, + headers: rpcEndpoint.headers + }; + + return createCosmosQueryClient(endpointStr, clientOptions); + } } diff --git a/__fixtures__/misc/output-scalar-default-nullable-true/gogoproto/bundle.ts b/__fixtures__/misc/output-scalar-default-nullable-true/gogoproto/bundle.ts index 81c0534fa2..8f5723b7d0 100644 --- a/__fixtures__/misc/output-scalar-default-nullable-true/gogoproto/bundle.ts +++ b/__fixtures__/misc/output-scalar-default-nullable-true/gogoproto/bundle.ts @@ -1,4 +1,4 @@ -import * as _88 from "./gogo"; +import * as _95 from "./gogo"; export const gogoproto = { - ..._88 + ..._95 }; \ No newline at end of file diff --git a/__fixtures__/misc/output-scalar-default-nullable-true/google/bundle.ts b/__fixtures__/misc/output-scalar-default-nullable-true/google/bundle.ts index 38a63df02c..69af242ca0 100644 --- a/__fixtures__/misc/output-scalar-default-nullable-true/google/bundle.ts +++ b/__fixtures__/misc/output-scalar-default-nullable-true/google/bundle.ts @@ -1,20 +1,20 @@ -import * as _89 from "./api/expr/v1alpha1/eval"; -import * as _90 from "./protobuf/any"; -import * as _91 from "./protobuf/descriptor"; -import * as _92 from "./protobuf/duration"; -import * as _93 from "./protobuf/timestamp"; +import * as _96 from "./api/expr/v1alpha1/eval"; +import * as _97 from "./protobuf/any"; +import * as _98 from "./protobuf/descriptor"; +import * as _99 from "./protobuf/duration"; +import * as _100 from "./protobuf/timestamp"; export namespace google { export namespace api { export namespace expr { export const v1alpha1 = { - ..._89 + ..._96 }; } } export const protobuf = { - ..._90, - ..._91, - ..._92, - ..._93 + ..._97, + ..._98, + ..._99, + ..._100 }; } \ No newline at end of file diff --git a/__fixtures__/misc/output-scalar-default-nullable-true/helper-func-types.ts b/__fixtures__/misc/output-scalar-default-nullable-true/helper-func-types.ts new file mode 100644 index 0000000000..5f9d7a87a0 --- /dev/null +++ b/__fixtures__/misc/output-scalar-default-nullable-true/helper-func-types.ts @@ -0,0 +1,92 @@ +/** +* This file and any referenced files were automatically generated by @hyperweb/telescope@latest +* DO NOT MODIFY BY HAND. Instead, download the latest proto files for your chain +* and run the transpile command or npm scripts command that is used to regenerate this bundle. +*/ + + +import { HttpEndpoint } from "@interchainjs/types"; +import { BinaryReader, BinaryWriter } from "./binary"; +import { getRpcClient } from "./extern"; +import { isRpc, Rpc } from "./helpers"; +import { TelescopeGeneratedCodec, DeliverTxResponse, Message, StdFee } from "./types"; +import { toConverters, toEncoders } from "@interchainjs/cosmos/utils"; +import { ISigningClient } from "@interchainjs/cosmos/types/signing-client"; + +export interface QueryBuilderOptions { + encode: (request: TReq, writer?: BinaryWriter) => BinaryWriter + decode: (input: BinaryReader | Uint8Array, length?: number) => TRes + service: string, + method: string, +} + +export function buildQuery(opts: QueryBuilderOptions) { + return async (client: EndpointOrRpc, request: TReq) => { + let rpc: Rpc | undefined; + + if(isRpc(client)) { + rpc = client; + } else { + rpc = client ? await getRpcClient(client) : undefined; + } + + if (!rpc) throw new Error("Query Rpc is not initialized"); + + const data = opts.encode(request).finish(); + const response = await rpc.request(opts.service, opts.method, data); + return opts.decode(response); + }; +} + +export interface ITxArgs { + signerAddress: string; + message: TMsg | TMsg[]; + fee: StdFee | 'auto'; + memo: string; +} + +export interface TxBuilderOptions { + msg: TelescopeGeneratedCodec +} + +export function buildTx(opts: TxBuilderOptions) { + return async ( + client: ISigningClient, + signerAddress: string, + message: TMsg | TMsg[], + fee: StdFee | 'auto', + memo: string + ): Promise => { + if (!client) throw new Error("SigningClient is not initialized"); + + //register all related encoders and converters + client.addEncoders?.(toEncoders(opts.msg)); + client.addConverters?.(toConverters(opts.msg)); + + const data = Array.isArray(message) + ? message.map(msg => ({ + typeUrl: opts.msg.typeUrl, + value: msg, + })) + : [{ + typeUrl: opts.msg.typeUrl, + value: message, + }]; + return client.signAndBroadcast!(signerAddress, data, fee, memo); + }; +} + +export interface Encoder { + typeUrl: string; + fromPartial: (data: any) => any; + encode: (data: any) => Uint8Array; +} + +export interface AminoConverter { + typeUrl: string; + aminoType: string; + fromAmino: (data: any) => any; + toAmino: (data: any) => any; +} + +export type EndpointOrRpc = string | HttpEndpoint | Rpc ; diff --git a/__fixtures__/misc/output-scalar-default-nullable-true/index.ts b/__fixtures__/misc/output-scalar-default-nullable-true/index.ts index d589dcd349..6b7006730a 100644 --- a/__fixtures__/misc/output-scalar-default-nullable-true/index.ts +++ b/__fixtures__/misc/output-scalar-default-nullable-true/index.ts @@ -8,10 +8,12 @@ export * from "./gogoproto/bundle"; export * from "./google/bundle"; export * from "./misc/bundle"; export * from "./extern"; +export * from "./helper-func-types"; export * from "./react-query"; export * from "./mobx"; export * from "./pinia-endpoint"; export * from "./json-safe"; export * from "./varint"; export * from "./utf8"; -export * from "./binary"; \ No newline at end of file +export * from "./binary"; +export * from "./types"; \ No newline at end of file diff --git a/__fixtures__/misc/output-scalar-default-nullable-true/misc/all_fields.ts b/__fixtures__/misc/output-scalar-default-nullable-true/misc/all_fields.ts index 7ed2dc0b86..1f854bbcf7 100644 --- a/__fixtures__/misc/output-scalar-default-nullable-true/misc/all_fields.ts +++ b/__fixtures__/misc/output-scalar-default-nullable-true/misc/all_fields.ts @@ -4,7 +4,7 @@ import { Duration, DurationSDKType } from "../google/protobuf/duration"; import { Timestamp, TimestampSDKType } from "../google/protobuf/timestamp"; import { BinaryReader, BinaryWriter } from "../binary"; import { toTimestamp, fromTimestamp, isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../helpers"; -import { Decimal } from "@cosmjs/math"; +import { Decimal } from "@interchainjs/math"; import { JsonSafe } from "../json-safe"; export const protobufPackage = "misc"; /** diff --git a/__fixtures__/misc/output-scalar-default-nullable-true/misc/bundle.ts b/__fixtures__/misc/output-scalar-default-nullable-true/misc/bundle.ts index b9a3e5fb6c..2869b842b9 100644 --- a/__fixtures__/misc/output-scalar-default-nullable-true/misc/bundle.ts +++ b/__fixtures__/misc/output-scalar-default-nullable-true/misc/bundle.ts @@ -1,16 +1,18 @@ -import * as _94 from "./all_fields"; -import * as _95 from "./eval_request"; -import * as _96 from "./nest"; -import * as _97 from "./tx"; -import * as _98 from "./tx.rpc.msg"; -import * as _99 from "./rpc.tx"; +import * as _101 from "./all_fields"; +import * as _102 from "./eval_request"; +import * as _103 from "./nest"; +import * as _104 from "./tx"; +import * as _105 from "./tx.rpc.func"; +import * as _106 from "./tx.rpc.msg"; +import * as _107 from "./rpc.tx"; export const misc = { - ..._94, - ..._95, - ..._96, - ..._97, - ..._98, + ..._101, + ..._102, + ..._103, + ..._104, + ..._105, + ..._106, ClientFactory: { - ..._99 + ..._107 } }; \ No newline at end of file diff --git a/__fixtures__/misc/output-scalar-default-nullable-true/misc/tx.rpc.func.ts b/__fixtures__/misc/output-scalar-default-nullable-true/misc/tx.rpc.func.ts new file mode 100644 index 0000000000..e3a3906134 --- /dev/null +++ b/__fixtures__/misc/output-scalar-default-nullable-true/misc/tx.rpc.func.ts @@ -0,0 +1,12 @@ +import { EncodingTestForDontOmit, EncodingTestForDontOmitSDKType, EncodingTestForOmit, EncodingTestForOmitSDKType } from "./all_fields"; +import { buildTx } from "../helper-func-types"; +import { InputMsg, InputMsgSDKType, MsgResponse, MsgResponseSDKType } from "./tx"; +/** + * test tx + * @name sendMsg + * @package misc + * @see proto service: misc.SendMsg + */ +export const sendMsg = buildTx({ + msg: InputMsg +}); \ No newline at end of file diff --git a/__fixtures__/misc/output-scalar-default-nullable-true/misc/tx.rpc.msg.ts b/__fixtures__/misc/output-scalar-default-nullable-true/misc/tx.rpc.msg.ts index 6d03a2bcb5..c4e3a250fa 100644 --- a/__fixtures__/misc/output-scalar-default-nullable-true/misc/tx.rpc.msg.ts +++ b/__fixtures__/misc/output-scalar-default-nullable-true/misc/tx.rpc.msg.ts @@ -1,5 +1,5 @@ import { EncodingTestForDontOmit, EncodingTestForDontOmitSDKType, EncodingTestForOmit, EncodingTestForOmitSDKType } from "./all_fields"; -import { Rpc } from "../helpers"; +import { TxRpc } from "../types"; import { BinaryReader } from "../binary"; import { InputMsg, InputMsgSDKType, MsgResponse, MsgResponseSDKType } from "./tx"; export interface Msg { @@ -7,8 +7,8 @@ export interface Msg { sendMsg(request: InputMsg): Promise; } export class MsgClientImpl implements Msg { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.sendMsg = this.sendMsg.bind(this); } @@ -18,6 +18,6 @@ export class MsgClientImpl implements Msg { return promise.then(data => MsgResponse.decode(new BinaryReader(data))); } } -export const createClientImpl = (rpc: Rpc) => { +export const createClientImpl = (rpc: TxRpc) => { return new MsgClientImpl(rpc); }; \ No newline at end of file diff --git a/__fixtures__/misc/output-scalar-default-nullable-true/types.ts b/__fixtures__/misc/output-scalar-default-nullable-true/types.ts new file mode 100644 index 0000000000..1acee677e2 --- /dev/null +++ b/__fixtures__/misc/output-scalar-default-nullable-true/types.ts @@ -0,0 +1,109 @@ +/** +* This file and any referenced files were automatically generated by @hyperweb/telescope@latest +* DO NOT MODIFY BY HAND. Instead, download the latest proto files for your chain +* and run the transpile command or npm scripts command that is used to regenerate this bundle. +*/ + +import { IBinaryReader, IBinaryWriter } from "./binary"; +import { Any } from "./google/protobuf/any"; + +import { HttpEndpoint } from "@interchainjs/types"; + + +import { DeliverTxResponse, Event, Attribute } from "@interchainjs/types"; + +export { DeliverTxResponse } + + +export type ProtoMsg = Omit & { typeUrl: any }; + +export interface IAminoMsg { + type: any; + value: Amino; +} + +export interface IProtoType { + $typeUrl?: any; +} + +/** + * A type generated by Telescope 1.0. + */ +export interface TelescopeGeneratedCodec< + T = unknown, + SDK = unknown, + Amino = unknown +> { + readonly typeUrl: string; + readonly aminoType?: string; + is?(o: unknown): o is T; + isSDK?(o: unknown): o is SDK; + isAmino?(o: unknown): o is Amino; + encode: (message: T, writer?: IBinaryWriter | any) => IBinaryWriter | any; + decode: (input: IBinaryReader | Uint8Array | any, length?: number) => T; + fromPartial: (object: any) => T | any; + fromJSON?: (object: any) => T | any; + toJSON?: (message: T | any) => any; + fromSDK?: (sdk: SDK) => T; + fromSDKJSON?: (object: any) => SDK; + toSDK?: (message: T) => SDK; + fromAmino?: (amino: Amino) => T; + toAmino?: (message: T) => Amino; + fromAminoMsg?: (aminoMsg: IAminoMsg) => T; + toAminoMsg?: (message: T) => IAminoMsg; + toProto?: (message: T) => Uint8Array; + fromProtoMsg?: (message: ProtoMsg) => T; + toProtoMsg?: (message: T) => Any; + registerTypeUrl?: () => void; +} + +export type TelescopeGeneratedType< + T = unknown, + SDK = unknown, + Amino = unknown +> = TelescopeGeneratedCodec; + +export type GeneratedType = TelescopeGeneratedCodec; + +/** + * Coin defines a token with a denomination and an amount. + * + * NOTE: The amount field is an Int which implements the custom method + * signatures required by gogoproto. + */ +interface Coin { + denom: string; + amount: string; +} + +export type EncodeObject = Message; + +export interface Message { + typeUrl: string; + value: T; +} + +export interface StdFee { + amount: Coin[]; + gas: string; + /** The granter address that is used for paying with feegrants */ + granter?: string; + /** The fee payer address. The payer must have signed the transaction. */ + payer?: string; +} + + +export interface TxRpc { + request( + service: string, + method: string, + data: Uint8Array + ): Promise; + signAndBroadcast?( + signerAddress: string, + messages: EncodeObject[], + fee: StdFee | "auto" | number, + memo: string + ): Promise; +} + diff --git a/__fixtures__/misc/output/extern.ts b/__fixtures__/misc/output/extern.ts index c3e7cbcac8..83d6864ae2 100644 --- a/__fixtures__/misc/output/extern.ts +++ b/__fixtures__/misc/output/extern.ts @@ -4,30 +4,45 @@ * and run the transpile command or npm scripts command that is used to regenerate this bundle. */ -import { QueryClient, createProtobufRpcClient, ProtobufRpcClient } from '@cosmjs/stargate' -import { Tendermint34Client, HttpEndpoint } from "@cosmjs/tendermint-rpc"; -const _rpcClients: Record = {}; +import { HttpEndpoint } from "@interchainjs/types"; +import { Rpc } from "./helpers"; +import { ClientOptions, createCosmosQueryClient } from "@interchainjs/cosmos"; + +const _rpcClients: Record = {}; export const getRpcEndpointKey = (rpcEndpoint: string | HttpEndpoint) => { - if (typeof rpcEndpoint === 'string') { - return rpcEndpoint; - } else if (!!rpcEndpoint) { - //@ts-ignore - return rpcEndpoint.url; - } + if (typeof rpcEndpoint === 'string') { + return rpcEndpoint; + } else if (!!rpcEndpoint) { + //@ts-ignore + return rpcEndpoint.url; + } } export const getRpcClient = async (rpcEndpoint: string | HttpEndpoint) => { - const key = getRpcEndpointKey(rpcEndpoint); - if (!key) return; - if (_rpcClients.hasOwnProperty(key)) { - return _rpcClients[key]; - } - const tmClient = await Tendermint34Client.connect(rpcEndpoint); - //@ts-ignore - const client = new QueryClient(tmClient); - const rpc = createProtobufRpcClient(client); - _rpcClients[key] = rpc; - return rpc; + const key = getRpcEndpointKey(rpcEndpoint); + if (!key) return; + if (_rpcClients.hasOwnProperty(key)) { + return _rpcClients[key]; + } + const rpc = await createRpcClient(rpcEndpoint); + _rpcClients[key] = rpc; + return rpc; +} + +export const createRpcClient = async (rpcEndpoint: string | HttpEndpoint, + options?: ClientOptions +) => { + if (typeof rpcEndpoint === 'string') { + return createCosmosQueryClient(rpcEndpoint, options); + } else { + const endpointStr = rpcEndpoint.url; + const clientOptions = { + ...options, + headers: rpcEndpoint.headers + }; + + return createCosmosQueryClient(endpointStr, clientOptions); + } } diff --git a/__fixtures__/misc/output/helper-func-types.ts b/__fixtures__/misc/output/helper-func-types.ts new file mode 100644 index 0000000000..5f9d7a87a0 --- /dev/null +++ b/__fixtures__/misc/output/helper-func-types.ts @@ -0,0 +1,92 @@ +/** +* This file and any referenced files were automatically generated by @hyperweb/telescope@latest +* DO NOT MODIFY BY HAND. Instead, download the latest proto files for your chain +* and run the transpile command or npm scripts command that is used to regenerate this bundle. +*/ + + +import { HttpEndpoint } from "@interchainjs/types"; +import { BinaryReader, BinaryWriter } from "./binary"; +import { getRpcClient } from "./extern"; +import { isRpc, Rpc } from "./helpers"; +import { TelescopeGeneratedCodec, DeliverTxResponse, Message, StdFee } from "./types"; +import { toConverters, toEncoders } from "@interchainjs/cosmos/utils"; +import { ISigningClient } from "@interchainjs/cosmos/types/signing-client"; + +export interface QueryBuilderOptions { + encode: (request: TReq, writer?: BinaryWriter) => BinaryWriter + decode: (input: BinaryReader | Uint8Array, length?: number) => TRes + service: string, + method: string, +} + +export function buildQuery(opts: QueryBuilderOptions) { + return async (client: EndpointOrRpc, request: TReq) => { + let rpc: Rpc | undefined; + + if(isRpc(client)) { + rpc = client; + } else { + rpc = client ? await getRpcClient(client) : undefined; + } + + if (!rpc) throw new Error("Query Rpc is not initialized"); + + const data = opts.encode(request).finish(); + const response = await rpc.request(opts.service, opts.method, data); + return opts.decode(response); + }; +} + +export interface ITxArgs { + signerAddress: string; + message: TMsg | TMsg[]; + fee: StdFee | 'auto'; + memo: string; +} + +export interface TxBuilderOptions { + msg: TelescopeGeneratedCodec +} + +export function buildTx(opts: TxBuilderOptions) { + return async ( + client: ISigningClient, + signerAddress: string, + message: TMsg | TMsg[], + fee: StdFee | 'auto', + memo: string + ): Promise => { + if (!client) throw new Error("SigningClient is not initialized"); + + //register all related encoders and converters + client.addEncoders?.(toEncoders(opts.msg)); + client.addConverters?.(toConverters(opts.msg)); + + const data = Array.isArray(message) + ? message.map(msg => ({ + typeUrl: opts.msg.typeUrl, + value: msg, + })) + : [{ + typeUrl: opts.msg.typeUrl, + value: message, + }]; + return client.signAndBroadcast!(signerAddress, data, fee, memo); + }; +} + +export interface Encoder { + typeUrl: string; + fromPartial: (data: any) => any; + encode: (data: any) => Uint8Array; +} + +export interface AminoConverter { + typeUrl: string; + aminoType: string; + fromAmino: (data: any) => any; + toAmino: (data: any) => any; +} + +export type EndpointOrRpc = string | HttpEndpoint | Rpc ; diff --git a/__fixtures__/misc/output/index.ts b/__fixtures__/misc/output/index.ts index 6f955fe911..e498b0112f 100644 --- a/__fixtures__/misc/output/index.ts +++ b/__fixtures__/misc/output/index.ts @@ -8,10 +8,12 @@ export * from "./google/bundle"; export * from "./misc/bundle"; export * from "./misc/client"; export * from "./extern"; +export * from "./helper-func-types"; export * from "./react-query"; export * from "./mobx"; export * from "./pinia-endpoint"; export * from "./json-safe"; export * from "./varint"; export * from "./utf8"; -export * from "./binary"; \ No newline at end of file +export * from "./binary"; +export * from "./types"; \ No newline at end of file diff --git a/__fixtures__/misc/output/misc/all_fields.ts b/__fixtures__/misc/output/misc/all_fields.ts index 112aba7d2a..1d0cb181db 100644 --- a/__fixtures__/misc/output/misc/all_fields.ts +++ b/__fixtures__/misc/output/misc/all_fields.ts @@ -3,10 +3,10 @@ import { Duration, DurationAmino, DurationSDKType } from "../google/protobuf/dur import { Timestamp, TimestampAmino, TimestampSDKType } from "../google/protobuf/timestamp"; import { BinaryReader, BinaryWriter } from "../binary"; import { toTimestamp, fromTimestamp, isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../helpers"; -import { Decimal } from "@cosmjs/math"; +import { Decimal } from "@interchainjs/math"; import { JsonSafe } from "../json-safe"; -import { toUtf8, fromBase64, fromUtf8, toBase64 } from "@cosmjs/encoding"; -import { encodePubkey, decodePubkey } from "@cosmjs/proto-signing"; +import { toUtf8, fromBase64, fromUtf8, toBase64 } from "@interchainjs/encoding"; +import { encodePubkey, decodePubkey } from "@interchainjs/pubkey"; import { MiscAccessConfig, MiscAccessConfigAmino, MiscAccessConfigSDKType, MiscVoteOption, MiscVoteOptionSDKType, miscVoteOptionFromJSON, miscVoteOptionToJSON } from "./eval_request"; /** * @name EncodingTestForDontOmit @@ -1754,15 +1754,15 @@ export const EncodingTestForDontOmit = { } else { obj.d_o_auths = message.dOAuths; } - obj.dec = message.dec === "" ? undefined : message.dec; - obj.d_o_dec = message.dODec ?? ""; + obj.dec = message.dec === "" ? undefined : Decimal.fromUserInput(message.dec, 18).atomics; + obj.d_o_dec = Decimal.fromUserInput(message.dODec, 18).atomics ?? ""; if (message.decs) { - obj.decs = message.decs.map(e => e); + obj.decs = message.decs.map(e => Decimal.fromUserInput(e, 18).atomics); } else { obj.decs = message.decs; } if (message.dODecs) { - obj.d_o_decs = message.dODecs.map(e => e); + obj.d_o_decs = message.dODecs.map(e => Decimal.fromUserInput(e, 18).atomics); } else { obj.d_o_decs = message.dODecs; } @@ -2920,15 +2920,15 @@ export const MiscEncodingTestForOmit = { } else { obj.o_auths = message.oAuths; } - obj.dec = message.dec ?? ""; - obj.o_dec = message.oDec === "" ? undefined : message.oDec; + obj.dec = Decimal.fromUserInput(message.dec, 18).atomics ?? ""; + obj.o_dec = message.oDec === "" ? undefined : Decimal.fromUserInput(message.oDec, 18).atomics; if (message.decs) { - obj.decs = message.decs.map(e => e); + obj.decs = message.decs.map(e => Decimal.fromUserInput(e, 18).atomics); } else { obj.decs = message.decs; } if (message.oDecs) { - obj.o_decs = message.oDecs.map(e => e); + obj.o_decs = message.oDecs.map(e => Decimal.fromUserInput(e, 18).atomics); } else { obj.o_decs = message.oDecs; } diff --git a/__fixtures__/misc/output/misc/bundle.ts b/__fixtures__/misc/output/misc/bundle.ts index 115a08853a..4670e53556 100644 --- a/__fixtures__/misc/output/misc/bundle.ts +++ b/__fixtures__/misc/output/misc/bundle.ts @@ -2,4 +2,5 @@ export * from "./all_fields"; export * from "./eval_request"; export * from "./nest"; export * from "./tx"; -export * from "./tx.registry"; \ No newline at end of file +export * from "./tx.registry"; +export * from "./tx.rpc.func"; \ No newline at end of file diff --git a/__fixtures__/misc/output/misc/tx.registry.ts b/__fixtures__/misc/output/misc/tx.registry.ts index 5e460f4631..c8bbbbed96 100644 --- a/__fixtures__/misc/output/misc/tx.registry.ts +++ b/__fixtures__/misc/output/misc/tx.registry.ts @@ -1,12 +1,7 @@ import { EncodingTestForDontOmit, EncodingTestForDontOmitSDKType } from "./all_fields"; -import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { TelescopeGeneratedType } from "../types"; import { InputMsg, InputMsgSDKType } from "./tx"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/misc.InputMsg", InputMsg]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/misc.InputMsg", InputMsg]]; export const MessageComposer = { encoded: { sendMsg(value: InputMsg) { diff --git a/__fixtures__/misc/output/misc/tx.rpc.func.ts b/__fixtures__/misc/output/misc/tx.rpc.func.ts new file mode 100644 index 0000000000..2445e20346 --- /dev/null +++ b/__fixtures__/misc/output/misc/tx.rpc.func.ts @@ -0,0 +1,12 @@ +import { EncodingTestForDontOmit, EncodingTestForDontOmitSDKType } from "./all_fields"; +import { buildTx } from "../helper-func-types"; +import { InputMsg, InputMsgSDKType, MsgResponse, MsgResponseSDKType } from "./tx"; +/** + * test tx + * @name sendMsg + * @package misc + * @see proto service: misc.SendMsg + */ +export const sendMsg = buildTx({ + msg: InputMsg +}); \ No newline at end of file diff --git a/__fixtures__/misc/output/misc/tx.rpc.msg.ts b/__fixtures__/misc/output/misc/tx.rpc.msg.ts index aa6206e356..a29291bd6e 100644 --- a/__fixtures__/misc/output/misc/tx.rpc.msg.ts +++ b/__fixtures__/misc/output/misc/tx.rpc.msg.ts @@ -1,5 +1,5 @@ import { EncodingTestForDontOmit, EncodingTestForDontOmitSDKType } from "./all_fields"; -import { Rpc } from "../helpers"; +import { TxRpc } from "../types"; import { BinaryReader } from "../binary"; import { InputMsg, InputMsgSDKType, MsgResponse, MsgResponseSDKType } from "./tx"; export interface Msg { @@ -7,8 +7,8 @@ export interface Msg { sendMsg(request: InputMsg): Promise; } export class MsgClientImpl implements Msg { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.sendMsg = this.sendMsg.bind(this); } @@ -18,6 +18,6 @@ export class MsgClientImpl implements Msg { return promise.then(data => MsgResponse.decode(new BinaryReader(data))); } } -export const createClientImpl = (rpc: Rpc) => { +export const createClientImpl = (rpc: TxRpc) => { return new MsgClientImpl(rpc); }; \ No newline at end of file diff --git a/__fixtures__/misc/output/types.ts b/__fixtures__/misc/output/types.ts new file mode 100644 index 0000000000..1acee677e2 --- /dev/null +++ b/__fixtures__/misc/output/types.ts @@ -0,0 +1,109 @@ +/** +* This file and any referenced files were automatically generated by @hyperweb/telescope@latest +* DO NOT MODIFY BY HAND. Instead, download the latest proto files for your chain +* and run the transpile command or npm scripts command that is used to regenerate this bundle. +*/ + +import { IBinaryReader, IBinaryWriter } from "./binary"; +import { Any } from "./google/protobuf/any"; + +import { HttpEndpoint } from "@interchainjs/types"; + + +import { DeliverTxResponse, Event, Attribute } from "@interchainjs/types"; + +export { DeliverTxResponse } + + +export type ProtoMsg = Omit & { typeUrl: any }; + +export interface IAminoMsg { + type: any; + value: Amino; +} + +export interface IProtoType { + $typeUrl?: any; +} + +/** + * A type generated by Telescope 1.0. + */ +export interface TelescopeGeneratedCodec< + T = unknown, + SDK = unknown, + Amino = unknown +> { + readonly typeUrl: string; + readonly aminoType?: string; + is?(o: unknown): o is T; + isSDK?(o: unknown): o is SDK; + isAmino?(o: unknown): o is Amino; + encode: (message: T, writer?: IBinaryWriter | any) => IBinaryWriter | any; + decode: (input: IBinaryReader | Uint8Array | any, length?: number) => T; + fromPartial: (object: any) => T | any; + fromJSON?: (object: any) => T | any; + toJSON?: (message: T | any) => any; + fromSDK?: (sdk: SDK) => T; + fromSDKJSON?: (object: any) => SDK; + toSDK?: (message: T) => SDK; + fromAmino?: (amino: Amino) => T; + toAmino?: (message: T) => Amino; + fromAminoMsg?: (aminoMsg: IAminoMsg) => T; + toAminoMsg?: (message: T) => IAminoMsg; + toProto?: (message: T) => Uint8Array; + fromProtoMsg?: (message: ProtoMsg) => T; + toProtoMsg?: (message: T) => Any; + registerTypeUrl?: () => void; +} + +export type TelescopeGeneratedType< + T = unknown, + SDK = unknown, + Amino = unknown +> = TelescopeGeneratedCodec; + +export type GeneratedType = TelescopeGeneratedCodec; + +/** + * Coin defines a token with a denomination and an amount. + * + * NOTE: The amount field is an Int which implements the custom method + * signatures required by gogoproto. + */ +interface Coin { + denom: string; + amount: string; +} + +export type EncodeObject = Message; + +export interface Message { + typeUrl: string; + value: T; +} + +export interface StdFee { + amount: Coin[]; + gas: string; + /** The granter address that is used for paying with feegrants */ + granter?: string; + /** The fee payer address. The payer must have signed the transaction. */ + payer?: string; +} + + +export interface TxRpc { + request( + service: string, + method: string, + data: Uint8Array + ): Promise; + signAndBroadcast?( + signerAddress: string, + messages: EncodeObject[], + fee: StdFee | "auto" | number, + memo: string + ): Promise; +} + diff --git a/__fixtures__/v-next/customchain-js/akash/inflation/v1beta2/params.ts b/__fixtures__/v-next/customchain-js/akash/inflation/v1beta2/params.ts index 07ee391110..636f4205fb 100644 --- a/__fixtures__/v-next/customchain-js/akash/inflation/v1beta2/params.ts +++ b/__fixtures__/v-next/customchain-js/akash/inflation/v1beta2/params.ts @@ -125,9 +125,9 @@ export const AkashInflationV1beta2Params = { }, toAmino(message: AkashInflationV1beta2Params): AkashInflationV1beta2ParamsAmino { const obj: any = {}; - obj.inflation_decay_factor = message.inflationDecayFactor ?? ""; - obj.initial_inflation = message.initialInflation ?? ""; - obj.variance = message.variance ?? ""; + obj.inflation_decay_factor = Decimal.fromUserInput(message.inflationDecayFactor, 18).atomics ?? ""; + obj.initial_inflation = Decimal.fromUserInput(message.initialInflation, 18).atomics ?? ""; + obj.variance = Decimal.fromUserInput(message.variance, 18).atomics ?? ""; return obj; }, fromAminoMsg(object: AkashInflationV1beta2ParamsAminoMsg): AkashInflationV1beta2Params { diff --git a/__fixtures__/v-next/customchain-js/cosmos/base/v1beta1/coin.ts b/__fixtures__/v-next/customchain-js/cosmos/base/v1beta1/coin.ts index 7ca7a7c345..c016c0ef95 100644 --- a/__fixtures__/v-next/customchain-js/cosmos/base/v1beta1/coin.ts +++ b/__fixtures__/v-next/customchain-js/cosmos/base/v1beta1/coin.ts @@ -278,7 +278,7 @@ export const DecCoin = { toAmino(message: DecCoin): DecCoinAmino { const obj: any = {}; obj.denom = message.denom === "" ? undefined : message.denom; - obj.amount = message.amount === "" ? undefined : message.amount; + obj.amount = message.amount === "" ? undefined : Decimal.fromUserInput(message.amount, 18).atomics; return obj; }, fromAminoMsg(object: DecCoinAminoMsg): DecCoin { @@ -430,7 +430,7 @@ export const DecProto = { }, toAmino(message: DecProto): DecProtoAmino { const obj: any = {}; - obj.dec = message.dec === "" ? undefined : message.dec; + obj.dec = message.dec === "" ? undefined : Decimal.fromUserInput(message.dec, 18).atomics; return obj; }, fromAminoMsg(object: DecProtoAminoMsg): DecProto { diff --git a/__fixtures__/v-next/customchain-js/cosmos/distribution/v1beta1/distribution.ts b/__fixtures__/v-next/customchain-js/cosmos/distribution/v1beta1/distribution.ts index 711f742b69..0f673b86dd 100644 --- a/__fixtures__/v-next/customchain-js/cosmos/distribution/v1beta1/distribution.ts +++ b/__fixtures__/v-next/customchain-js/cosmos/distribution/v1beta1/distribution.ts @@ -484,9 +484,9 @@ export const CosmosDistributionV1beta1Params = { }, toAmino(message: CosmosDistributionV1beta1Params): CosmosDistributionV1beta1ParamsAmino { const obj: any = {}; - obj.community_tax = message.communityTax === "" ? undefined : message.communityTax; - obj.base_proposer_reward = message.baseProposerReward === "" ? undefined : message.baseProposerReward; - obj.bonus_proposer_reward = message.bonusProposerReward === "" ? undefined : message.bonusProposerReward; + obj.community_tax = message.communityTax === "" ? undefined : Decimal.fromUserInput(message.communityTax, 18).atomics; + obj.base_proposer_reward = message.baseProposerReward === "" ? undefined : Decimal.fromUserInput(message.baseProposerReward, 18).atomics; + obj.bonus_proposer_reward = message.bonusProposerReward === "" ? undefined : Decimal.fromUserInput(message.bonusProposerReward, 18).atomics; obj.withdraw_addr_enabled = message.withdrawAddrEnabled === false ? undefined : message.withdrawAddrEnabled; return obj; }, @@ -929,7 +929,7 @@ export const ValidatorSlashEvent = { toAmino(message: ValidatorSlashEvent): ValidatorSlashEventAmino { const obj: any = {}; obj.validator_period = message.validatorPeriod !== BigInt(0) ? message.validatorPeriod?.toString() : undefined; - obj.fraction = message.fraction === "" ? undefined : message.fraction; + obj.fraction = message.fraction === "" ? undefined : Decimal.fromUserInput(message.fraction, 18).atomics; return obj; }, fromAminoMsg(object: ValidatorSlashEventAminoMsg): ValidatorSlashEvent { @@ -1305,7 +1305,7 @@ export const DelegatorStartingInfo = { toAmino(message: DelegatorStartingInfo): DelegatorStartingInfoAmino { const obj: any = {}; obj.previous_period = message.previousPeriod !== BigInt(0) ? message.previousPeriod?.toString() : undefined; - obj.stake = message.stake === "" ? undefined : message.stake; + obj.stake = message.stake === "" ? undefined : Decimal.fromUserInput(message.stake, 18).atomics; obj.height = message.height ? message.height?.toString() : "0"; return obj; }, diff --git a/__fixtures__/v-next/customchain-js/cosmos/gov/v1beta1/gov.ts b/__fixtures__/v-next/customchain-js/cosmos/gov/v1beta1/gov.ts index 31dd8d7ce7..fa0f227af5 100644 --- a/__fixtures__/v-next/customchain-js/cosmos/gov/v1beta1/gov.ts +++ b/__fixtures__/v-next/customchain-js/cosmos/gov/v1beta1/gov.ts @@ -566,7 +566,7 @@ export const WeightedVoteOption = { toAmino(message: WeightedVoteOption): WeightedVoteOptionAmino { const obj: any = {}; obj.option = message.option === 0 ? undefined : message.option; - obj.weight = message.weight === "" ? undefined : message.weight; + obj.weight = message.weight === "" ? undefined : Decimal.fromUserInput(message.weight, 18).atomics; return obj; }, fromAminoMsg(object: WeightedVoteOptionAminoMsg): WeightedVoteOption { diff --git a/__fixtures__/v-next/customchain-js/cosmos/mint/v1beta1/mint.ts b/__fixtures__/v-next/customchain-js/cosmos/mint/v1beta1/mint.ts index 9f02991e67..5ec0c09af1 100644 --- a/__fixtures__/v-next/customchain-js/cosmos/mint/v1beta1/mint.ts +++ b/__fixtures__/v-next/customchain-js/cosmos/mint/v1beta1/mint.ts @@ -175,8 +175,8 @@ export const Minter = { }, toAmino(message: Minter): MinterAmino { const obj: any = {}; - obj.inflation = message.inflation === "" ? undefined : message.inflation; - obj.annual_provisions = message.annualProvisions === "" ? undefined : message.annualProvisions; + obj.inflation = message.inflation === "" ? undefined : Decimal.fromUserInput(message.inflation, 18).atomics; + obj.annual_provisions = message.annualProvisions === "" ? undefined : Decimal.fromUserInput(message.annualProvisions, 18).atomics; return obj; }, fromAminoMsg(object: MinterAminoMsg): Minter { @@ -308,10 +308,10 @@ export const CosmosMintV1beta1Params = { toAmino(message: CosmosMintV1beta1Params): CosmosMintV1beta1ParamsAmino { const obj: any = {}; obj.mint_denom = message.mintDenom === "" ? undefined : message.mintDenom; - obj.inflation_rate_change = message.inflationRateChange === "" ? undefined : message.inflationRateChange; - obj.inflation_max = message.inflationMax === "" ? undefined : message.inflationMax; - obj.inflation_min = message.inflationMin === "" ? undefined : message.inflationMin; - obj.goal_bonded = message.goalBonded === "" ? undefined : message.goalBonded; + obj.inflation_rate_change = message.inflationRateChange === "" ? undefined : Decimal.fromUserInput(message.inflationRateChange, 18).atomics; + obj.inflation_max = message.inflationMax === "" ? undefined : Decimal.fromUserInput(message.inflationMax, 18).atomics; + obj.inflation_min = message.inflationMin === "" ? undefined : Decimal.fromUserInput(message.inflationMin, 18).atomics; + obj.goal_bonded = message.goalBonded === "" ? undefined : Decimal.fromUserInput(message.goalBonded, 18).atomics; obj.blocks_per_year = message.blocksPerYear !== BigInt(0) ? message.blocksPerYear?.toString() : undefined; return obj; }, diff --git a/__fixtures__/v-next/customchain-js/cosmos/staking/v1beta1/staking.ts b/__fixtures__/v-next/customchain-js/cosmos/staking/v1beta1/staking.ts index dd42c6cf74..e1d25ec5e9 100644 --- a/__fixtures__/v-next/customchain-js/cosmos/staking/v1beta1/staking.ts +++ b/__fixtures__/v-next/customchain-js/cosmos/staking/v1beta1/staking.ts @@ -1157,9 +1157,9 @@ export const CommissionRates = { }, toAmino(message: CommissionRates): CommissionRatesAmino { const obj: any = {}; - obj.rate = message.rate === "" ? undefined : message.rate; - obj.max_rate = message.maxRate === "" ? undefined : message.maxRate; - obj.max_change_rate = message.maxChangeRate === "" ? undefined : message.maxChangeRate; + obj.rate = message.rate === "" ? undefined : Decimal.fromUserInput(message.rate, 18).atomics; + obj.max_rate = message.maxRate === "" ? undefined : Decimal.fromUserInput(message.maxRate, 18).atomics; + obj.max_change_rate = message.maxChangeRate === "" ? undefined : Decimal.fromUserInput(message.maxChangeRate, 18).atomics; return obj; }, fromAminoMsg(object: CommissionRatesAminoMsg): CommissionRates { @@ -1569,7 +1569,7 @@ export const Validator = { obj.jailed = message.jailed === false ? undefined : message.jailed; obj.status = message.status === 0 ? undefined : message.status; obj.tokens = message.tokens === "" ? undefined : message.tokens; - obj.delegator_shares = message.delegatorShares === "" ? undefined : message.delegatorShares; + obj.delegator_shares = message.delegatorShares === "" ? undefined : Decimal.fromUserInput(message.delegatorShares, 18).atomics; obj.description = message.description ? Description.toAmino(message.description) : undefined; obj.unbonding_height = message.unbondingHeight !== BigInt(0) ? message.unbondingHeight?.toString() : undefined; obj.unbonding_time = message.unbondingTime ? Timestamp.toAmino(toTimestamp(message.unbondingTime)) : undefined; @@ -2103,7 +2103,7 @@ export const Delegation = { const obj: any = {}; obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; - obj.shares = message.shares === "" ? undefined : message.shares; + obj.shares = message.shares === "" ? undefined : Decimal.fromUserInput(message.shares, 18).atomics; return obj; }, fromAminoMsg(object: DelegationAminoMsg): Delegation { @@ -2430,7 +2430,7 @@ export const RedelegationEntry = { obj.creation_height = message.creationHeight !== BigInt(0) ? message.creationHeight?.toString() : undefined; obj.completion_time = message.completionTime ? Timestamp.toAmino(toTimestamp(message.completionTime)) : undefined; obj.initial_balance = message.initialBalance === "" ? undefined : message.initialBalance; - obj.shares_dst = message.sharesDst === "" ? undefined : message.sharesDst; + obj.shares_dst = message.sharesDst === "" ? undefined : Decimal.fromUserInput(message.sharesDst, 18).atomics; return obj; }, fromAminoMsg(object: RedelegationEntryAminoMsg): RedelegationEntry { @@ -2681,7 +2681,7 @@ export const CosmosStakingV1beta1Params = { obj.max_entries = message.maxEntries === 0 ? undefined : message.maxEntries; obj.historical_entries = message.historicalEntries === 0 ? undefined : message.historicalEntries; obj.bond_denom = message.bondDenom === "" ? undefined : message.bondDenom; - obj.min_commission_rate = message.minCommissionRate === "" ? undefined : message.minCommissionRate; + obj.min_commission_rate = message.minCommissionRate === "" ? undefined : Decimal.fromUserInput(message.minCommissionRate, 18).atomics; return obj; }, fromAminoMsg(object: CosmosStakingV1beta1ParamsAminoMsg): CosmosStakingV1beta1Params { diff --git a/__fixtures__/v-next/customchain-js/cosmos/staking/v1beta1/tx.ts b/__fixtures__/v-next/customchain-js/cosmos/staking/v1beta1/tx.ts index bd3929632f..253bde74fc 100644 --- a/__fixtures__/v-next/customchain-js/cosmos/staking/v1beta1/tx.ts +++ b/__fixtures__/v-next/customchain-js/cosmos/staking/v1beta1/tx.ts @@ -605,7 +605,7 @@ export const MsgEditValidator = { const obj: any = {}; obj.description = message.description ? Description.toAmino(message.description) : undefined; obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; - obj.commission_rate = message.commissionRate === "" ? undefined : message.commissionRate; + obj.commission_rate = message.commissionRate === "" ? undefined : Decimal.fromUserInput(message.commissionRate, 18).atomics; obj.min_self_delegation = message.minSelfDelegation === "" ? undefined : message.minSelfDelegation; return obj; }, diff --git a/__fixtures__/v-next/customchain-js/evmos/fees/v1/genesis.ts b/__fixtures__/v-next/customchain-js/evmos/fees/v1/genesis.ts index 0f59b3735d..054f1eb875 100644 --- a/__fixtures__/v-next/customchain-js/evmos/fees/v1/genesis.ts +++ b/__fixtures__/v-next/customchain-js/evmos/fees/v1/genesis.ts @@ -290,10 +290,10 @@ export const EvmosFeesV1Params = { toAmino(message: EvmosFeesV1Params): EvmosFeesV1ParamsAmino { const obj: any = {}; obj.enable_fees = message.enableFees === false ? undefined : message.enableFees; - obj.developer_shares = message.developerShares === "" ? undefined : message.developerShares; - obj.validator_shares = message.validatorShares === "" ? undefined : message.validatorShares; + obj.developer_shares = message.developerShares === "" ? undefined : Decimal.fromUserInput(message.developerShares, 18).atomics; + obj.validator_shares = message.validatorShares === "" ? undefined : Decimal.fromUserInput(message.validatorShares, 18).atomics; obj.addr_derivation_cost_create = message.addrDerivationCostCreate !== BigInt(0) ? message.addrDerivationCostCreate?.toString() : undefined; - obj.min_gas_price = message.minGasPrice === "" ? undefined : message.minGasPrice; + obj.min_gas_price = message.minGasPrice === "" ? undefined : Decimal.fromUserInput(message.minGasPrice, 18).atomics; return obj; }, fromAminoMsg(object: EvmosFeesV1ParamsAminoMsg): EvmosFeesV1Params { diff --git a/__fixtures__/v-next/customchain-js/evmos/incentives/v1/genesis.ts b/__fixtures__/v-next/customchain-js/evmos/incentives/v1/genesis.ts index 7cdba44c15..c5eb1092ae 100644 --- a/__fixtures__/v-next/customchain-js/evmos/incentives/v1/genesis.ts +++ b/__fixtures__/v-next/customchain-js/evmos/incentives/v1/genesis.ts @@ -287,9 +287,9 @@ export const EvmosIncentivesV1Params = { toAmino(message: EvmosIncentivesV1Params): EvmosIncentivesV1ParamsAmino { const obj: any = {}; obj.enable_incentives = message.enableIncentives === false ? undefined : message.enableIncentives; - obj.allocation_limit = message.allocationLimit === "" ? undefined : message.allocationLimit; + obj.allocation_limit = message.allocationLimit === "" ? undefined : Decimal.fromUserInput(message.allocationLimit, 18).atomics; obj.incentives_epoch_identifier = message.incentivesEpochIdentifier === "" ? undefined : message.incentivesEpochIdentifier; - obj.reward_scaler = message.rewardScaler === "" ? undefined : message.rewardScaler; + obj.reward_scaler = message.rewardScaler === "" ? undefined : Decimal.fromUserInput(message.rewardScaler, 18).atomics; return obj; }, fromAminoMsg(object: EvmosIncentivesV1ParamsAminoMsg): EvmosIncentivesV1Params { diff --git a/__fixtures__/v-next/customchain-js/evmos/inflation/v1/inflation.ts b/__fixtures__/v-next/customchain-js/evmos/inflation/v1/inflation.ts index f4f2a2ecb9..f4b74f70c5 100644 --- a/__fixtures__/v-next/customchain-js/evmos/inflation/v1/inflation.ts +++ b/__fixtures__/v-next/customchain-js/evmos/inflation/v1/inflation.ts @@ -217,9 +217,9 @@ export const InflationDistribution = { }, toAmino(message: InflationDistribution): InflationDistributionAmino { const obj: any = {}; - obj.staking_rewards = message.stakingRewards === "" ? undefined : message.stakingRewards; - obj.usage_incentives = message.usageIncentives === "" ? undefined : message.usageIncentives; - obj.community_pool = message.communityPool === "" ? undefined : message.communityPool; + obj.staking_rewards = message.stakingRewards === "" ? undefined : Decimal.fromUserInput(message.stakingRewards, 18).atomics; + obj.usage_incentives = message.usageIncentives === "" ? undefined : Decimal.fromUserInput(message.usageIncentives, 18).atomics; + obj.community_pool = message.communityPool === "" ? undefined : Decimal.fromUserInput(message.communityPool, 18).atomics; return obj; }, fromAminoMsg(object: InflationDistributionAminoMsg): InflationDistribution { @@ -336,11 +336,11 @@ export const ExponentialCalculation = { }, toAmino(message: ExponentialCalculation): ExponentialCalculationAmino { const obj: any = {}; - obj.a = message.a === "" ? undefined : message.a; - obj.r = message.r === "" ? undefined : message.r; - obj.c = message.c === "" ? undefined : message.c; - obj.bonding_target = message.bondingTarget === "" ? undefined : message.bondingTarget; - obj.max_variance = message.maxVariance === "" ? undefined : message.maxVariance; + obj.a = message.a === "" ? undefined : Decimal.fromUserInput(message.a, 18).atomics; + obj.r = message.r === "" ? undefined : Decimal.fromUserInput(message.r, 18).atomics; + obj.c = message.c === "" ? undefined : Decimal.fromUserInput(message.c, 18).atomics; + obj.bonding_target = message.bondingTarget === "" ? undefined : Decimal.fromUserInput(message.bondingTarget, 18).atomics; + obj.max_variance = message.maxVariance === "" ? undefined : Decimal.fromUserInput(message.maxVariance, 18).atomics; return obj; }, fromAminoMsg(object: ExponentialCalculationAminoMsg): ExponentialCalculation { diff --git a/__fixtures__/v-next/customchain-js/evmos/inflation/v1/query.ts b/__fixtures__/v-next/customchain-js/evmos/inflation/v1/query.ts index b96f88829b..09a9768d71 100644 --- a/__fixtures__/v-next/customchain-js/evmos/inflation/v1/query.ts +++ b/__fixtures__/v-next/customchain-js/evmos/inflation/v1/query.ts @@ -957,7 +957,7 @@ export const QueryInflationRateResponse = { }, toAmino(message: QueryInflationRateResponse): QueryInflationRateResponseAmino { const obj: any = {}; - obj.inflation_rate = message.inflationRate === "" ? undefined : message.inflationRate; + obj.inflation_rate = message.inflationRate === "" ? undefined : Decimal.fromUserInput(message.inflationRate, 18).atomics; return obj; }, fromAminoMsg(object: QueryInflationRateResponseAminoMsg): QueryInflationRateResponse { diff --git a/__fixtures__/v-next/customchain-js/helper-func-types.ts b/__fixtures__/v-next/customchain-js/helper-func-types.ts index 5f9d7a87a0..3102611da1 100644 --- a/__fixtures__/v-next/customchain-js/helper-func-types.ts +++ b/__fixtures__/v-next/customchain-js/helper-func-types.ts @@ -18,9 +18,12 @@ export interface QueryBuilderOptions { decode: (input: BinaryReader | Uint8Array, length?: number) => TRes service: string, method: string, + deps?: TelescopeGeneratedCodec[], } export function buildQuery(opts: QueryBuilderOptions) { + registerDependencies(opts.deps ?? []); + return async (client: EndpointOrRpc, request: TReq) => { let rpc: Rpc | undefined; @@ -50,6 +53,10 @@ export interface TxBuilderOptions { } export function buildTx(opts: TxBuilderOptions) { + if(opts.msg){ + registerDependencies([opts.msg]); + } + return async ( client: ISigningClient, signerAddress: string, @@ -90,3 +97,9 @@ export interface AminoConverter { } export type EndpointOrRpc = string | HttpEndpoint | Rpc ; + +function registerDependencies(deps: TelescopeGeneratedCodec[]) { + for (const dep of deps) { + dep.registerTypeUrl?.(); + } +} diff --git a/__fixtures__/v-next/customchain-js/index.ts b/__fixtures__/v-next/customchain-js/index.ts index d60cf51db7..0c8ee1ef3a 100644 --- a/__fixtures__/v-next/customchain-js/index.ts +++ b/__fixtures__/v-next/customchain-js/index.ts @@ -20,4 +20,5 @@ export * from "./react-query"; export * from "./varint"; export * from "./utf8"; export * from "./binary"; -export * from "./types"; \ No newline at end of file +export * from "./types"; +export * from "./registry"; \ No newline at end of file diff --git a/__fixtures__/v-next/customchain-js/osmosis/gamm/pool-models/balancer/balancerPool.ts b/__fixtures__/v-next/customchain-js/osmosis/gamm/pool-models/balancer/balancerPool.ts index bb74a36900..87a0effaf2 100644 --- a/__fixtures__/v-next/customchain-js/osmosis/gamm/pool-models/balancer/balancerPool.ts +++ b/__fixtures__/v-next/customchain-js/osmosis/gamm/pool-models/balancer/balancerPool.ts @@ -462,8 +462,8 @@ export const PoolParams = { }, toAmino(message: PoolParams): PoolParamsAmino { const obj: any = {}; - obj.swap_fee = message.swapFee === "" ? undefined : message.swapFee; - obj.exit_fee = message.exitFee === "" ? undefined : message.exitFee; + obj.swap_fee = message.swapFee === "" ? undefined : Decimal.fromUserInput(message.swapFee, 18).atomics; + obj.exit_fee = message.exitFee === "" ? undefined : Decimal.fromUserInput(message.exitFee, 18).atomics; obj.smooth_weight_change_params = message.smoothWeightChangeParams ? SmoothWeightChangeParams.toAmino(message.smoothWeightChangeParams) : undefined; return obj; }, diff --git a/__fixtures__/v-next/customchain-js/osmosis/gamm/pool-models/stableswap/stableswap_pool.ts b/__fixtures__/v-next/customchain-js/osmosis/gamm/pool-models/stableswap/stableswap_pool.ts index c340ef8ba0..750d2a3ac7 100644 --- a/__fixtures__/v-next/customchain-js/osmosis/gamm/pool-models/stableswap/stableswap_pool.ts +++ b/__fixtures__/v-next/customchain-js/osmosis/gamm/pool-models/stableswap/stableswap_pool.ts @@ -185,8 +185,8 @@ export const PoolParams = { }, toAmino(message: PoolParams): PoolParamsAmino { const obj: any = {}; - obj.swap_fee = message.swapFee === "" ? undefined : message.swapFee; - obj.exit_fee = message.exitFee === "" ? undefined : message.exitFee; + obj.swap_fee = message.swapFee === "" ? undefined : Decimal.fromUserInput(message.swapFee, 18).atomics; + obj.exit_fee = message.exitFee === "" ? undefined : Decimal.fromUserInput(message.exitFee, 18).atomics; return obj; }, fromAminoMsg(object: PoolParamsAminoMsg): PoolParams { diff --git a/__fixtures__/v-next/customchain-js/osmosis/mint/v1beta1/mint.ts b/__fixtures__/v-next/customchain-js/osmosis/mint/v1beta1/mint.ts index 88b8077d18..8997bd024d 100644 --- a/__fixtures__/v-next/customchain-js/osmosis/mint/v1beta1/mint.ts +++ b/__fixtures__/v-next/customchain-js/osmosis/mint/v1beta1/mint.ts @@ -288,7 +288,7 @@ export const Minter = { }, toAmino(message: Minter): MinterAmino { const obj: any = {}; - obj.epoch_provisions = message.epochProvisions === "" ? undefined : message.epochProvisions; + obj.epoch_provisions = message.epochProvisions === "" ? undefined : Decimal.fromUserInput(message.epochProvisions, 18).atomics; return obj; }, fromAminoMsg(object: MinterAminoMsg): Minter { @@ -378,7 +378,7 @@ export const WeightedAddress = { toAmino(message: WeightedAddress): WeightedAddressAmino { const obj: any = {}; obj.address = message.address === "" ? undefined : message.address; - obj.weight = message.weight === "" ? undefined : message.weight; + obj.weight = message.weight === "" ? undefined : Decimal.fromUserInput(message.weight, 18).atomics; return obj; }, fromAminoMsg(object: WeightedAddressAminoMsg): WeightedAddress { @@ -489,10 +489,10 @@ export const DistributionProportions = { }, toAmino(message: DistributionProportions): DistributionProportionsAmino { const obj: any = {}; - obj.staking = message.staking === "" ? undefined : message.staking; - obj.pool_incentives = message.poolIncentives === "" ? undefined : message.poolIncentives; - obj.developer_rewards = message.developerRewards === "" ? undefined : message.developerRewards; - obj.community_pool = message.communityPool === "" ? undefined : message.communityPool; + obj.staking = message.staking === "" ? undefined : Decimal.fromUserInput(message.staking, 18).atomics; + obj.pool_incentives = message.poolIncentives === "" ? undefined : Decimal.fromUserInput(message.poolIncentives, 18).atomics; + obj.developer_rewards = message.developerRewards === "" ? undefined : Decimal.fromUserInput(message.developerRewards, 18).atomics; + obj.community_pool = message.communityPool === "" ? undefined : Decimal.fromUserInput(message.communityPool, 18).atomics; return obj; }, fromAminoMsg(object: DistributionProportionsAminoMsg): DistributionProportions { @@ -644,10 +644,10 @@ export const OsmosisMintV1beta1Params = { toAmino(message: OsmosisMintV1beta1Params): OsmosisMintV1beta1ParamsAmino { const obj: any = {}; obj.mint_denom = message.mintDenom === "" ? undefined : message.mintDenom; - obj.genesis_epoch_provisions = message.genesisEpochProvisions === "" ? undefined : message.genesisEpochProvisions; + obj.genesis_epoch_provisions = message.genesisEpochProvisions === "" ? undefined : Decimal.fromUserInput(message.genesisEpochProvisions, 18).atomics; obj.epoch_identifier = message.epochIdentifier === "" ? undefined : message.epochIdentifier; obj.reduction_period_in_epochs = message.reductionPeriodInEpochs !== BigInt(0) ? message.reductionPeriodInEpochs?.toString() : undefined; - obj.reduction_factor = message.reductionFactor === "" ? undefined : message.reductionFactor; + obj.reduction_factor = message.reductionFactor === "" ? undefined : Decimal.fromUserInput(message.reductionFactor, 18).atomics; obj.distribution_proportions = message.distributionProportions ? DistributionProportions.toAmino(message.distributionProportions) : undefined; if (message.weightedDeveloperRewardsReceivers) { obj.weighted_developer_rewards_receivers = message.weightedDeveloperRewardsReceivers.map(e => e ? WeightedAddress.toAmino(e) : undefined); diff --git a/__fixtures__/v-next/customchain-js/osmosis/superfluid/params.ts b/__fixtures__/v-next/customchain-js/osmosis/superfluid/params.ts index 7835b726e2..23c95cd47d 100644 --- a/__fixtures__/v-next/customchain-js/osmosis/superfluid/params.ts +++ b/__fixtures__/v-next/customchain-js/osmosis/superfluid/params.ts @@ -90,7 +90,7 @@ export const OsmosisSuperfluidParams = { }, toAmino(message: OsmosisSuperfluidParams): OsmosisSuperfluidParamsAmino { const obj: any = {}; - obj.minimum_risk_factor = message.minimumRiskFactor === "" ? undefined : message.minimumRiskFactor; + obj.minimum_risk_factor = message.minimumRiskFactor === "" ? undefined : Decimal.fromUserInput(message.minimumRiskFactor, 18).atomics; return obj; }, fromAminoMsg(object: OsmosisSuperfluidParamsAminoMsg): OsmosisSuperfluidParams { diff --git a/__fixtures__/v-next/customchain-js/osmosis/superfluid/superfluid.ts b/__fixtures__/v-next/customchain-js/osmosis/superfluid/superfluid.ts index efe352d7d4..9437aa1290 100644 --- a/__fixtures__/v-next/customchain-js/osmosis/superfluid/superfluid.ts +++ b/__fixtures__/v-next/customchain-js/osmosis/superfluid/superfluid.ts @@ -528,7 +528,7 @@ export const OsmoEquivalentMultiplierRecord = { const obj: any = {}; obj.epoch_number = message.epochNumber !== BigInt(0) ? message.epochNumber?.toString() : undefined; obj.denom = message.denom === "" ? undefined : message.denom; - obj.multiplier = message.multiplier === "" ? undefined : message.multiplier; + obj.multiplier = message.multiplier === "" ? undefined : Decimal.fromUserInput(message.multiplier, 18).atomics; return obj; }, fromAminoMsg(object: OsmoEquivalentMultiplierRecordAminoMsg): OsmoEquivalentMultiplierRecord { diff --git a/__fixtures__/v-next/customchain-js/osmosis/twap/v1beta1/query.ts b/__fixtures__/v-next/customchain-js/osmosis/twap/v1beta1/query.ts index 3c0b25ed07..1cbfac1c59 100644 --- a/__fixtures__/v-next/customchain-js/osmosis/twap/v1beta1/query.ts +++ b/__fixtures__/v-next/customchain-js/osmosis/twap/v1beta1/query.ts @@ -330,7 +330,7 @@ export const ArithmeticTwapResponse = { }, toAmino(message: ArithmeticTwapResponse): ArithmeticTwapResponseAmino { const obj: any = {}; - obj.arithmetic_twap = message.arithmeticTwap === "" ? undefined : message.arithmeticTwap; + obj.arithmetic_twap = message.arithmeticTwap === "" ? undefined : Decimal.fromUserInput(message.arithmeticTwap, 18).atomics; return obj; }, fromAminoMsg(object: ArithmeticTwapResponseAminoMsg): ArithmeticTwapResponse { @@ -516,7 +516,7 @@ export const ArithmeticTwapToNowResponse = { }, toAmino(message: ArithmeticTwapToNowResponse): ArithmeticTwapToNowResponseAmino { const obj: any = {}; - obj.arithmetic_twap = message.arithmeticTwap === "" ? undefined : message.arithmeticTwap; + obj.arithmetic_twap = message.arithmeticTwap === "" ? undefined : Decimal.fromUserInput(message.arithmeticTwap, 18).atomics; return obj; }, fromAminoMsg(object: ArithmeticTwapToNowResponseAminoMsg): ArithmeticTwapToNowResponse { diff --git a/__fixtures__/v-next/customchain-js/osmosis/twap/v1beta1/twap_record.ts b/__fixtures__/v-next/customchain-js/osmosis/twap/v1beta1/twap_record.ts index 2cc3e75a96..da2a6151cb 100644 --- a/__fixtures__/v-next/customchain-js/osmosis/twap/v1beta1/twap_record.ts +++ b/__fixtures__/v-next/customchain-js/osmosis/twap/v1beta1/twap_record.ts @@ -263,10 +263,10 @@ export const TwapRecord = { obj.asset1_denom = message.asset1Denom === "" ? undefined : message.asset1Denom; obj.height = message.height ? message.height?.toString() : "0"; obj.time = message.time ? Timestamp.toAmino(toTimestamp(message.time)) : undefined; - obj.p0_last_spot_price = message.p0LastSpotPrice === "" ? undefined : message.p0LastSpotPrice; - obj.p1_last_spot_price = message.p1LastSpotPrice === "" ? undefined : message.p1LastSpotPrice; - obj.p0_arithmetic_twap_accumulator = message.p0ArithmeticTwapAccumulator === "" ? undefined : message.p0ArithmeticTwapAccumulator; - obj.p1_arithmetic_twap_accumulator = message.p1ArithmeticTwapAccumulator === "" ? undefined : message.p1ArithmeticTwapAccumulator; + obj.p0_last_spot_price = message.p0LastSpotPrice === "" ? undefined : Decimal.fromUserInput(message.p0LastSpotPrice, 18).atomics; + obj.p1_last_spot_price = message.p1LastSpotPrice === "" ? undefined : Decimal.fromUserInput(message.p1LastSpotPrice, 18).atomics; + obj.p0_arithmetic_twap_accumulator = message.p0ArithmeticTwapAccumulator === "" ? undefined : Decimal.fromUserInput(message.p0ArithmeticTwapAccumulator, 18).atomics; + obj.p1_arithmetic_twap_accumulator = message.p1ArithmeticTwapAccumulator === "" ? undefined : Decimal.fromUserInput(message.p1ArithmeticTwapAccumulator, 18).atomics; obj.last_error_time = message.lastErrorTime ? Timestamp.toAmino(toTimestamp(message.lastErrorTime)) : undefined; return obj; }, diff --git a/__fixtures__/v-next/customchain-js/osmosis/txfees/v1beta1/query.ts b/__fixtures__/v-next/customchain-js/osmosis/txfees/v1beta1/query.ts index 08368b7bad..d35117c66f 100644 --- a/__fixtures__/v-next/customchain-js/osmosis/txfees/v1beta1/query.ts +++ b/__fixtures__/v-next/customchain-js/osmosis/txfees/v1beta1/query.ts @@ -476,7 +476,7 @@ export const QueryDenomSpotPriceResponse = { toAmino(message: QueryDenomSpotPriceResponse): QueryDenomSpotPriceResponseAmino { const obj: any = {}; obj.poolID = message.poolID !== BigInt(0) ? message.poolID?.toString() : undefined; - obj.spot_price = message.spotPrice === "" ? undefined : message.spotPrice; + obj.spot_price = message.spotPrice === "" ? undefined : Decimal.fromUserInput(message.spotPrice, 18).atomics; return obj; }, fromAminoMsg(object: QueryDenomSpotPriceResponseAminoMsg): QueryDenomSpotPriceResponse { diff --git a/__fixtures__/v-next/customchain-js/registry.ts b/__fixtures__/v-next/customchain-js/registry.ts new file mode 100644 index 0000000000..181b82b40e --- /dev/null +++ b/__fixtures__/v-next/customchain-js/registry.ts @@ -0,0 +1,228 @@ +/** +* This file and any referenced files were automatically generated by @hyperweb/telescope@latest +* DO NOT MODIFY BY HAND. Instead, download the latest proto files for your chain +* and run the transpile command or npm scripts command that is used to regenerate this bundle. +*/ + +import { BinaryReader } from "./binary"; +import { Any, AnyAmino } from "./google/protobuf/any"; +import { IProtoType, TelescopeGeneratedCodec } from "./types"; + +export class GlobalDecoderRegistry { + static registry: { + [key: string]: TelescopeGeneratedCodec; + } = {}; + + static aminoProtoMapping: { + [key: string]: string; + } = {}; + + static existingTypeUrls: string[] = []; + + static registerExistingTypeUrl(typeUrl: string): boolean { + if (GlobalDecoderRegistry.existingTypeUrls.includes(typeUrl)) { + return false; + } + GlobalDecoderRegistry.existingTypeUrls.push(typeUrl); + return true; + } + + static registerAminoProtoMapping(aminoType: string, typeUrl: string) { + GlobalDecoderRegistry.aminoProtoMapping[aminoType] = typeUrl; + } + + static register( + key: string, + decoder: TelescopeGeneratedCodec + ) { + GlobalDecoderRegistry.registry[key] = decoder; + } + static getDecoder( + key: string + ): TelescopeGeneratedCodec { + return GlobalDecoderRegistry.registry[key]; + } + static getDecoderByInstance( + obj: unknown + ): TelescopeGeneratedCodec | null { + if (obj === undefined || obj === null) { + return null; + } + const protoType = obj as IProtoType; + + if (protoType.$typeUrl) { + return GlobalDecoderRegistry.getDecoder( + protoType.$typeUrl + ); + } + + for (const key in GlobalDecoderRegistry.registry) { + if ( + Object.prototype.hasOwnProperty.call( + GlobalDecoderRegistry.registry, + key + ) + ) { + const element = GlobalDecoderRegistry.registry[key]; + + if (element.is!(obj)) { + return element; + } + + if (element.isSDK && element.isSDK(obj)) { + return element; + } + + if (element.isAmino && element.isAmino(obj)) { + return element; + } + } + } + + return null; + } + static getDecoderByAminoType( + type: string + ): TelescopeGeneratedCodec | null { + if (type === undefined || type === null) { + return null; + } + + const typeUrl = GlobalDecoderRegistry.aminoProtoMapping[type]; + + if (!typeUrl) { + return null; + } + + return GlobalDecoderRegistry.getDecoder(typeUrl); + } + static wrapAny(obj: unknown): Any { + if(Any.is(obj)){ + return obj; + } + + const decoder = getDecoderByInstance(obj); + + return { + typeUrl: decoder.typeUrl, + value: decoder.encode(obj).finish(), + }; + } + static unwrapAny(input: BinaryReader | Uint8Array | Any) { + let data; + + if (Any.is(input)) { + data = input; + } else { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + + data = Any.decode(reader, reader.uint32()); + } + + const decoder = GlobalDecoderRegistry.getDecoder( + data.typeUrl + ); + + if (!decoder) { + return data; + } + + return decoder.decode(data.value); + } + static fromJSON(object: any): T { + const decoder = getDecoderByInstance(object); + return decoder.fromJSON!(object); + } + static toJSON(message: T): any { + const decoder = getDecoderByInstance(message); + return decoder.toJSON!(message); + } + static fromPartial(object: unknown): T { + const decoder = getDecoderByInstance(object); + return decoder ? decoder.fromPartial(object) : (object as T); + } + static fromSDK(object: SDK): T { + const decoder = getDecoderByInstance(object); + return decoder.fromSDK!(object); + } + static fromSDKJSON(object: any): SDK { + const decoder = getDecoderByInstance(object); + return decoder.fromSDKJSON!(object); + } + static toSDK(object: T): SDK { + const decoder = getDecoderByInstance(object); + return decoder.toSDK!(object); + } + static fromAmino(object: Amino): T { + const decoder = getDecoderByInstance(object); + return decoder.fromAmino!(object); + } + static fromAminoMsg(object: AnyAmino): T { + const decoder = GlobalDecoderRegistry.getDecoderByAminoType< + T, + unknown, + Amino + >(object.type); + + if (!decoder) { + throw new Error(`There's no decoder for the amino type ${object.type}`); + } + + return decoder.fromAminoMsg!(object); + } + static toAmino(object: T): Amino { + let data: any; + let decoder: TelescopeGeneratedCodec; + if (Any.is(object)) { + data = GlobalDecoderRegistry.unwrapAny(object); + + decoder = GlobalDecoderRegistry.getDecoder(object.typeUrl); + + if (!decoder) { + decoder = Any; + } + } else { + data = object; + decoder = getDecoderByInstance(object); + } + + return decoder.toAmino!(data); + } + static toAminoMsg(object: T): AnyAmino { + let data: any; + let decoder: TelescopeGeneratedCodec; + if (Any.is(object)) { + data = GlobalDecoderRegistry.unwrapAny(object); + + decoder = GlobalDecoderRegistry.getDecoder(object.typeUrl); + + if (!decoder) { + decoder = Any; + } + } else { + data = object; + decoder = getDecoderByInstance(object); + } + + return decoder.toAminoMsg!(data); + } +} + +function getDecoderByInstance( + obj: unknown +): TelescopeGeneratedCodec { + const decoder = GlobalDecoderRegistry.getDecoderByInstance( + obj + ); + + if (!decoder) { + throw new Error( + `There's no decoder for the instance ${JSON.stringify(obj)}` + ); + } + + return decoder; +} + +GlobalDecoderRegistry.register(Any.typeUrl, Any); diff --git a/__fixtures__/v-next/outputhelperfunc/akash/audit/v1beta1/audit.registry.ts b/__fixtures__/v-next/outputhelperfunc/akash/audit/v1beta1/audit.registry.ts index 2c23f4b474..102ab96d50 100644 --- a/__fixtures__/v-next/outputhelperfunc/akash/audit/v1beta1/audit.registry.ts +++ b/__fixtures__/v-next/outputhelperfunc/akash/audit/v1beta1/audit.registry.ts @@ -1,13 +1,7 @@ import { Attribute, AttributeSDKType } from "../../base/v1beta1/attribute"; import { TelescopeGeneratedType } from "../../../types"; -import { Registry } from "@cosmjs/proto-signing"; import { MsgSignProviderAttributes, MsgSignProviderAttributesSDKType, MsgDeleteProviderAttributes, MsgDeleteProviderAttributesSDKType } from "./audit"; export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/akash.audit.v1beta1.MsgSignProviderAttributes", MsgSignProviderAttributes], ["/akash.audit.v1beta1.MsgDeleteProviderAttributes", MsgDeleteProviderAttributes]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; export const MessageComposer = { encoded: { signProviderAttributes(value: MsgSignProviderAttributes) { diff --git a/__fixtures__/v-next/outputhelperfunc/akash/audit/v1beta1/audit.rpc.msg.ts b/__fixtures__/v-next/outputhelperfunc/akash/audit/v1beta1/audit.rpc.msg.ts index 9e6270bd25..f628d3a9e1 100644 --- a/__fixtures__/v-next/outputhelperfunc/akash/audit/v1beta1/audit.rpc.msg.ts +++ b/__fixtures__/v-next/outputhelperfunc/akash/audit/v1beta1/audit.rpc.msg.ts @@ -1,5 +1,6 @@ import { Attribute, AttributeSDKType } from "../../base/v1beta1/attribute"; -import { DeliverTxResponse, StdFee, TxRpc } from "../../../types"; +import { DeliverTxResponse } from "@interchainjs/types"; +import { StdFee, TxRpc } from "../../../types"; import { BinaryReader } from "../../../binary"; import { MsgSignProviderAttributes, MsgSignProviderAttributesSDKType, MsgSignProviderAttributesResponse, MsgSignProviderAttributesResponseSDKType, MsgDeleteProviderAttributes, MsgDeleteProviderAttributesSDKType, MsgDeleteProviderAttributesResponse, MsgDeleteProviderAttributesResponseSDKType } from "./audit"; /** Msg defines the provider Msg service */ diff --git a/__fixtures__/v-next/outputhelperfunc/akash/audit/v1beta2/audit.registry.ts b/__fixtures__/v-next/outputhelperfunc/akash/audit/v1beta2/audit.registry.ts index 42ef1cc6d8..11f0e7bbda 100644 --- a/__fixtures__/v-next/outputhelperfunc/akash/audit/v1beta2/audit.registry.ts +++ b/__fixtures__/v-next/outputhelperfunc/akash/audit/v1beta2/audit.registry.ts @@ -1,13 +1,7 @@ import { Attribute, AttributeSDKType } from "../../base/v1beta2/attribute"; import { TelescopeGeneratedType } from "../../../types"; -import { Registry } from "@cosmjs/proto-signing"; import { MsgSignProviderAttributes, MsgSignProviderAttributesSDKType, MsgDeleteProviderAttributes, MsgDeleteProviderAttributesSDKType } from "./audit"; export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/akash.audit.v1beta2.MsgSignProviderAttributes", MsgSignProviderAttributes], ["/akash.audit.v1beta2.MsgDeleteProviderAttributes", MsgDeleteProviderAttributes]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; export const MessageComposer = { encoded: { signProviderAttributes(value: MsgSignProviderAttributes) { diff --git a/__fixtures__/v-next/outputhelperfunc/akash/audit/v1beta2/audit.rpc.msg.ts b/__fixtures__/v-next/outputhelperfunc/akash/audit/v1beta2/audit.rpc.msg.ts index dd5a6ae973..9495525462 100644 --- a/__fixtures__/v-next/outputhelperfunc/akash/audit/v1beta2/audit.rpc.msg.ts +++ b/__fixtures__/v-next/outputhelperfunc/akash/audit/v1beta2/audit.rpc.msg.ts @@ -1,5 +1,6 @@ import { Attribute, AttributeSDKType } from "../../base/v1beta2/attribute"; -import { DeliverTxResponse, StdFee, TxRpc } from "../../../types"; +import { DeliverTxResponse } from "@interchainjs/types"; +import { StdFee, TxRpc } from "../../../types"; import { BinaryReader } from "../../../binary"; import { MsgSignProviderAttributes, MsgSignProviderAttributesSDKType, MsgSignProviderAttributesResponse, MsgSignProviderAttributesResponseSDKType, MsgDeleteProviderAttributes, MsgDeleteProviderAttributesSDKType, MsgDeleteProviderAttributesResponse, MsgDeleteProviderAttributesResponseSDKType } from "./audit"; /** Msg defines the provider Msg service */ diff --git a/__fixtures__/v-next/outputhelperfunc/akash/cert/v1beta2/cert.registry.ts b/__fixtures__/v-next/outputhelperfunc/akash/cert/v1beta2/cert.registry.ts index 76c3148a40..b2dbebb1de 100644 --- a/__fixtures__/v-next/outputhelperfunc/akash/cert/v1beta2/cert.registry.ts +++ b/__fixtures__/v-next/outputhelperfunc/akash/cert/v1beta2/cert.registry.ts @@ -1,12 +1,6 @@ import { TelescopeGeneratedType } from "../../../types"; -import { Registry } from "@cosmjs/proto-signing"; import { MsgCreateCertificate, MsgCreateCertificateSDKType, MsgRevokeCertificate, MsgRevokeCertificateSDKType } from "./cert"; export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/akash.cert.v1beta2.MsgCreateCertificate", MsgCreateCertificate], ["/akash.cert.v1beta2.MsgRevokeCertificate", MsgRevokeCertificate]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; export const MessageComposer = { encoded: { createCertificate(value: MsgCreateCertificate) { diff --git a/__fixtures__/v-next/outputhelperfunc/akash/cert/v1beta2/cert.rpc.msg.ts b/__fixtures__/v-next/outputhelperfunc/akash/cert/v1beta2/cert.rpc.msg.ts index 09d1423e56..74fbf352cd 100644 --- a/__fixtures__/v-next/outputhelperfunc/akash/cert/v1beta2/cert.rpc.msg.ts +++ b/__fixtures__/v-next/outputhelperfunc/akash/cert/v1beta2/cert.rpc.msg.ts @@ -1,4 +1,5 @@ -import { DeliverTxResponse, StdFee, TxRpc } from "../../../types"; +import { DeliverTxResponse } from "@interchainjs/types"; +import { StdFee, TxRpc } from "../../../types"; import { BinaryReader } from "../../../binary"; import { MsgCreateCertificate, MsgCreateCertificateSDKType, MsgCreateCertificateResponse, MsgCreateCertificateResponseSDKType, MsgRevokeCertificate, MsgRevokeCertificateSDKType, MsgRevokeCertificateResponse, MsgRevokeCertificateResponseSDKType } from "./cert"; /** Msg defines the provider Msg service */ diff --git a/__fixtures__/v-next/outputhelperfunc/akash/client.ts b/__fixtures__/v-next/outputhelperfunc/akash/client.ts index 90e29187f3..70752c17b5 100644 --- a/__fixtures__/v-next/outputhelperfunc/akash/client.ts +++ b/__fixtures__/v-next/outputhelperfunc/akash/client.ts @@ -2,7 +2,8 @@ import { GeneratedType, Registry, OfflineSigner } from "@cosmjs/proto-signing"; import { defaultRegistryTypes, AminoTypes, SigningStargateClient } from "@cosmjs/stargate"; import { HttpEndpoint } from "@cosmjs/tendermint-rpc"; import { createRpcClient } from "../extern"; -import { DeliverTxResponse, EncodeObject, StdFee, TxRpc, SigningClientParams } from "../types"; +import { DeliverTxResponse } from "@interchainjs/types"; +import { EncodeObject, StdFee, TxRpc, SigningClientParams } from "../types"; import * as akashAuditV1beta1AuditRegistry from "./audit/v1beta1/audit.registry"; import * as akashAuditV1beta2AuditRegistry from "./audit/v1beta2/audit.registry"; import * as akashCertV1beta2CertRegistry from "./cert/v1beta2/cert.registry"; diff --git a/__fixtures__/v-next/outputhelperfunc/akash/deployment/v1beta1/deployment.ts b/__fixtures__/v-next/outputhelperfunc/akash/deployment/v1beta1/deployment.ts index 03aff50eb4..a7bb6f79bf 100644 --- a/__fixtures__/v-next/outputhelperfunc/akash/deployment/v1beta1/deployment.ts +++ b/__fixtures__/v-next/outputhelperfunc/akash/deployment/v1beta1/deployment.ts @@ -6,7 +6,8 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; import { GlobalDecoderRegistry } from "../../../registry"; import { isSet, bytesFromBase64, base64FromBytes, Exact } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; -import { DeliverTxResponse, StdFee, TxRpc } from "../../../types"; +import { DeliverTxResponse } from "@interchainjs/types"; +import { StdFee, TxRpc } from "../../../types"; export const protobufPackage = "akash.deployment.v1beta1"; /** State is an enum which refers to state of deployment */ export enum Deployment_State { diff --git a/__fixtures__/v-next/outputhelperfunc/akash/deployment/v1beta2/service.registry.ts b/__fixtures__/v-next/outputhelperfunc/akash/deployment/v1beta2/service.registry.ts index 1a4247443e..ffa9b2b188 100644 --- a/__fixtures__/v-next/outputhelperfunc/akash/deployment/v1beta2/service.registry.ts +++ b/__fixtures__/v-next/outputhelperfunc/akash/deployment/v1beta2/service.registry.ts @@ -3,15 +3,9 @@ import { GroupSpec, GroupSpecSDKType } from "./groupspec"; import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { GroupID, GroupIDSDKType } from "./groupid"; import { TelescopeGeneratedType } from "../../../types"; -import { Registry } from "@cosmjs/proto-signing"; import { MsgCreateDeployment, MsgCreateDeploymentSDKType, MsgDepositDeployment, MsgDepositDeploymentSDKType, MsgUpdateDeployment, MsgUpdateDeploymentSDKType, MsgCloseDeployment, MsgCloseDeploymentSDKType } from "./deploymentmsg"; import { MsgCloseGroup, MsgCloseGroupSDKType, MsgPauseGroup, MsgPauseGroupSDKType, MsgStartGroup, MsgStartGroupSDKType } from "./groupmsg"; export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/akash.deployment.v1beta2.MsgCreateDeployment", MsgCreateDeployment], ["/akash.deployment.v1beta2.MsgDepositDeployment", MsgDepositDeployment], ["/akash.deployment.v1beta2.MsgUpdateDeployment", MsgUpdateDeployment], ["/akash.deployment.v1beta2.MsgCloseDeployment", MsgCloseDeployment], ["/akash.deployment.v1beta2.MsgCloseGroup", MsgCloseGroup], ["/akash.deployment.v1beta2.MsgPauseGroup", MsgPauseGroup], ["/akash.deployment.v1beta2.MsgStartGroup", MsgStartGroup]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; export const MessageComposer = { encoded: { createDeployment(value: MsgCreateDeployment) { diff --git a/__fixtures__/v-next/outputhelperfunc/akash/deployment/v1beta2/service.rpc.msg.ts b/__fixtures__/v-next/outputhelperfunc/akash/deployment/v1beta2/service.rpc.msg.ts index bfb507fe05..462e35c7d0 100644 --- a/__fixtures__/v-next/outputhelperfunc/akash/deployment/v1beta2/service.rpc.msg.ts +++ b/__fixtures__/v-next/outputhelperfunc/akash/deployment/v1beta2/service.rpc.msg.ts @@ -2,7 +2,8 @@ import { DeploymentID, DeploymentIDSDKType } from "./deployment"; import { GroupSpec, GroupSpecSDKType } from "./groupspec"; import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { GroupID, GroupIDSDKType } from "./groupid"; -import { DeliverTxResponse, StdFee, TxRpc } from "../../../types"; +import { DeliverTxResponse } from "@interchainjs/types"; +import { StdFee, TxRpc } from "../../../types"; import { BinaryReader } from "../../../binary"; import { MsgCreateDeployment, MsgCreateDeploymentSDKType, MsgCreateDeploymentResponse, MsgCreateDeploymentResponseSDKType, MsgDepositDeployment, MsgDepositDeploymentSDKType, MsgDepositDeploymentResponse, MsgDepositDeploymentResponseSDKType, MsgUpdateDeployment, MsgUpdateDeploymentSDKType, MsgUpdateDeploymentResponse, MsgUpdateDeploymentResponseSDKType, MsgCloseDeployment, MsgCloseDeploymentSDKType, MsgCloseDeploymentResponse, MsgCloseDeploymentResponseSDKType } from "./deploymentmsg"; import { MsgCloseGroup, MsgCloseGroupSDKType, MsgCloseGroupResponse, MsgCloseGroupResponseSDKType, MsgPauseGroup, MsgPauseGroupSDKType, MsgPauseGroupResponse, MsgPauseGroupResponseSDKType, MsgStartGroup, MsgStartGroupSDKType, MsgStartGroupResponse, MsgStartGroupResponseSDKType } from "./groupmsg"; diff --git a/__fixtures__/v-next/outputhelperfunc/akash/inflation/v1beta2/params.ts b/__fixtures__/v-next/outputhelperfunc/akash/inflation/v1beta2/params.ts index c410cb0fb5..604ac7f15a 100644 --- a/__fixtures__/v-next/outputhelperfunc/akash/inflation/v1beta2/params.ts +++ b/__fixtures__/v-next/outputhelperfunc/akash/inflation/v1beta2/params.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { Decimal } from "@cosmjs/math"; +import { Decimal } from "@interchainjs/math"; import { isSet, DeepPartial, Exact } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "akash.inflation.v1beta2"; @@ -183,9 +183,9 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.inflation_decay_factor = message.inflationDecayFactor ?? ""; - obj.initial_inflation = message.initialInflation ?? ""; - obj.variance = message.variance ?? ""; + obj.inflation_decay_factor = Decimal.fromUserInput(message.inflationDecayFactor, 18).atomics ?? ""; + obj.initial_inflation = Decimal.fromUserInput(message.initialInflation, 18).atomics ?? ""; + obj.variance = Decimal.fromUserInput(message.variance, 18).atomics ?? ""; return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputhelperfunc/akash/market/v1beta2/service.registry.ts b/__fixtures__/v-next/outputhelperfunc/akash/market/v1beta2/service.registry.ts index 3f5bcbdf07..a9c57a78fb 100644 --- a/__fixtures__/v-next/outputhelperfunc/akash/market/v1beta2/service.registry.ts +++ b/__fixtures__/v-next/outputhelperfunc/akash/market/v1beta2/service.registry.ts @@ -3,13 +3,7 @@ import { DecCoin, DecCoinSDKType, Coin, CoinSDKType } from "../../../cosmos/base import { BidID, BidIDSDKType, MsgCreateBid, MsgCreateBidSDKType, MsgCloseBid, MsgCloseBidSDKType } from "./bid"; import { LeaseID, LeaseIDSDKType, MsgWithdrawLease, MsgWithdrawLeaseSDKType, MsgCreateLease, MsgCreateLeaseSDKType, MsgCloseLease, MsgCloseLeaseSDKType } from "./lease"; import { TelescopeGeneratedType } from "../../../types"; -import { Registry } from "@cosmjs/proto-signing"; export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/akash.market.v1beta2.MsgCreateBid", MsgCreateBid], ["/akash.market.v1beta2.MsgCloseBid", MsgCloseBid], ["/akash.market.v1beta2.MsgWithdrawLease", MsgWithdrawLease], ["/akash.market.v1beta2.MsgCreateLease", MsgCreateLease], ["/akash.market.v1beta2.MsgCloseLease", MsgCloseLease]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; export const MessageComposer = { encoded: { createBid(value: MsgCreateBid) { diff --git a/__fixtures__/v-next/outputhelperfunc/akash/market/v1beta2/service.rpc.msg.ts b/__fixtures__/v-next/outputhelperfunc/akash/market/v1beta2/service.rpc.msg.ts index e3e3e133a9..997ceed795 100644 --- a/__fixtures__/v-next/outputhelperfunc/akash/market/v1beta2/service.rpc.msg.ts +++ b/__fixtures__/v-next/outputhelperfunc/akash/market/v1beta2/service.rpc.msg.ts @@ -2,7 +2,8 @@ import { OrderID, OrderIDSDKType } from "./order"; import { DecCoin, DecCoinSDKType, Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { BidID, BidIDSDKType, MsgCreateBid, MsgCreateBidSDKType, MsgCreateBidResponse, MsgCreateBidResponseSDKType, MsgCloseBid, MsgCloseBidSDKType, MsgCloseBidResponse, MsgCloseBidResponseSDKType } from "./bid"; import { LeaseID, LeaseIDSDKType, MsgWithdrawLease, MsgWithdrawLeaseSDKType, MsgWithdrawLeaseResponse, MsgWithdrawLeaseResponseSDKType, MsgCreateLease, MsgCreateLeaseSDKType, MsgCreateLeaseResponse, MsgCreateLeaseResponseSDKType, MsgCloseLease, MsgCloseLeaseSDKType, MsgCloseLeaseResponse, MsgCloseLeaseResponseSDKType } from "./lease"; -import { DeliverTxResponse, StdFee, TxRpc } from "../../../types"; +import { DeliverTxResponse } from "@interchainjs/types"; +import { StdFee, TxRpc } from "../../../types"; import { BinaryReader } from "../../../binary"; /** Msg defines the market Msg service */ export interface Msg { diff --git a/__fixtures__/v-next/outputhelperfunc/akash/provider/v1beta1/provider.registry.ts b/__fixtures__/v-next/outputhelperfunc/akash/provider/v1beta1/provider.registry.ts index 7b1fde7cf4..7682a6571c 100644 --- a/__fixtures__/v-next/outputhelperfunc/akash/provider/v1beta1/provider.registry.ts +++ b/__fixtures__/v-next/outputhelperfunc/akash/provider/v1beta1/provider.registry.ts @@ -1,13 +1,7 @@ import { Attribute, AttributeSDKType } from "../../base/v1beta1/attribute"; import { TelescopeGeneratedType } from "../../../types"; -import { Registry } from "@cosmjs/proto-signing"; import { MsgCreateProvider, MsgCreateProviderSDKType, MsgUpdateProvider, MsgUpdateProviderSDKType, MsgDeleteProvider, MsgDeleteProviderSDKType } from "./provider"; export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/akash.provider.v1beta1.MsgCreateProvider", MsgCreateProvider], ["/akash.provider.v1beta1.MsgUpdateProvider", MsgUpdateProvider], ["/akash.provider.v1beta1.MsgDeleteProvider", MsgDeleteProvider]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; export const MessageComposer = { encoded: { createProvider(value: MsgCreateProvider) { diff --git a/__fixtures__/v-next/outputhelperfunc/akash/provider/v1beta1/provider.rpc.msg.ts b/__fixtures__/v-next/outputhelperfunc/akash/provider/v1beta1/provider.rpc.msg.ts index 59f6826528..7b24d99686 100644 --- a/__fixtures__/v-next/outputhelperfunc/akash/provider/v1beta1/provider.rpc.msg.ts +++ b/__fixtures__/v-next/outputhelperfunc/akash/provider/v1beta1/provider.rpc.msg.ts @@ -1,5 +1,6 @@ import { Attribute, AttributeSDKType } from "../../base/v1beta1/attribute"; -import { DeliverTxResponse, StdFee, TxRpc } from "../../../types"; +import { DeliverTxResponse } from "@interchainjs/types"; +import { StdFee, TxRpc } from "../../../types"; import { BinaryReader } from "../../../binary"; import { MsgCreateProvider, MsgCreateProviderSDKType, MsgCreateProviderResponse, MsgCreateProviderResponseSDKType, MsgUpdateProvider, MsgUpdateProviderSDKType, MsgUpdateProviderResponse, MsgUpdateProviderResponseSDKType, MsgDeleteProvider, MsgDeleteProviderSDKType, MsgDeleteProviderResponse, MsgDeleteProviderResponseSDKType } from "./provider"; /** Msg defines the provider Msg service */ diff --git a/__fixtures__/v-next/outputhelperfunc/akash/provider/v1beta2/provider.registry.ts b/__fixtures__/v-next/outputhelperfunc/akash/provider/v1beta2/provider.registry.ts index ed7f23b480..386647f173 100644 --- a/__fixtures__/v-next/outputhelperfunc/akash/provider/v1beta2/provider.registry.ts +++ b/__fixtures__/v-next/outputhelperfunc/akash/provider/v1beta2/provider.registry.ts @@ -1,13 +1,7 @@ import { Attribute, AttributeSDKType } from "../../base/v1beta2/attribute"; import { TelescopeGeneratedType } from "../../../types"; -import { Registry } from "@cosmjs/proto-signing"; import { MsgCreateProvider, MsgCreateProviderSDKType, MsgUpdateProvider, MsgUpdateProviderSDKType, MsgDeleteProvider, MsgDeleteProviderSDKType } from "./provider"; export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/akash.provider.v1beta2.MsgCreateProvider", MsgCreateProvider], ["/akash.provider.v1beta2.MsgUpdateProvider", MsgUpdateProvider], ["/akash.provider.v1beta2.MsgDeleteProvider", MsgDeleteProvider]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; export const MessageComposer = { encoded: { createProvider(value: MsgCreateProvider) { diff --git a/__fixtures__/v-next/outputhelperfunc/akash/provider/v1beta2/provider.rpc.msg.ts b/__fixtures__/v-next/outputhelperfunc/akash/provider/v1beta2/provider.rpc.msg.ts index c20996bfa5..50352faeb8 100644 --- a/__fixtures__/v-next/outputhelperfunc/akash/provider/v1beta2/provider.rpc.msg.ts +++ b/__fixtures__/v-next/outputhelperfunc/akash/provider/v1beta2/provider.rpc.msg.ts @@ -1,5 +1,6 @@ import { Attribute, AttributeSDKType } from "../../base/v1beta2/attribute"; -import { DeliverTxResponse, StdFee, TxRpc } from "../../../types"; +import { DeliverTxResponse } from "@interchainjs/types"; +import { StdFee, TxRpc } from "../../../types"; import { BinaryReader } from "../../../binary"; import { MsgCreateProvider, MsgCreateProviderSDKType, MsgCreateProviderResponse, MsgCreateProviderResponseSDKType, MsgUpdateProvider, MsgUpdateProviderSDKType, MsgUpdateProviderResponse, MsgUpdateProviderResponseSDKType, MsgDeleteProvider, MsgDeleteProviderSDKType, MsgDeleteProviderResponse, MsgDeleteProviderResponseSDKType } from "./provider"; /** Msg defines the provider Msg service */ diff --git a/__fixtures__/v-next/outputhelperfunc/cosmos/authz/v1beta1/tx.registry.ts b/__fixtures__/v-next/outputhelperfunc/cosmos/authz/v1beta1/tx.registry.ts index f69b573e63..7a372371c6 100644 --- a/__fixtures__/v-next/outputhelperfunc/cosmos/authz/v1beta1/tx.registry.ts +++ b/__fixtures__/v-next/outputhelperfunc/cosmos/authz/v1beta1/tx.registry.ts @@ -1,14 +1,8 @@ import { Grant, GrantSDKType } from "./authz"; import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../google/protobuf/any"; import { TelescopeGeneratedType } from "../../../types"; -import { Registry } from "@cosmjs/proto-signing"; import { MsgGrant, MsgGrantSDKType, MsgExec, MsgExecSDKType, MsgRevoke, MsgRevokeSDKType } from "./tx"; export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/cosmos.authz.v1beta1.MsgGrant", MsgGrant], ["/cosmos.authz.v1beta1.MsgExec", MsgExec], ["/cosmos.authz.v1beta1.MsgRevoke", MsgRevoke]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; export const MessageComposer = { encoded: { grant(value: MsgGrant) { diff --git a/__fixtures__/v-next/outputhelperfunc/cosmos/authz/v1beta1/tx.rpc.msg.ts b/__fixtures__/v-next/outputhelperfunc/cosmos/authz/v1beta1/tx.rpc.msg.ts index b403eaced7..e9178e52c0 100644 --- a/__fixtures__/v-next/outputhelperfunc/cosmos/authz/v1beta1/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputhelperfunc/cosmos/authz/v1beta1/tx.rpc.msg.ts @@ -1,6 +1,7 @@ import { Grant, GrantSDKType } from "./authz"; import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../google/protobuf/any"; -import { DeliverTxResponse, StdFee, TxRpc } from "../../../types"; +import { DeliverTxResponse } from "@interchainjs/types"; +import { StdFee, TxRpc } from "../../../types"; import { BinaryReader } from "../../../binary"; import { MsgGrant, MsgGrantSDKType, MsgGrantResponse, MsgGrantResponseSDKType, MsgExec, MsgExecSDKType, MsgExecResponse, MsgExecResponseSDKType, MsgRevoke, MsgRevokeSDKType, MsgRevokeResponse, MsgRevokeResponseSDKType } from "./tx"; /** Msg defines the authz Msg service. */ diff --git a/__fixtures__/v-next/outputhelperfunc/cosmos/bank/v1beta1/tx.registry.ts b/__fixtures__/v-next/outputhelperfunc/cosmos/bank/v1beta1/tx.registry.ts index ead40b153d..3bd1884e0d 100644 --- a/__fixtures__/v-next/outputhelperfunc/cosmos/bank/v1beta1/tx.registry.ts +++ b/__fixtures__/v-next/outputhelperfunc/cosmos/bank/v1beta1/tx.registry.ts @@ -1,14 +1,8 @@ import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; import { Input, InputSDKType, Output, OutputSDKType } from "./bank"; import { TelescopeGeneratedType } from "../../../types"; -import { Registry } from "@cosmjs/proto-signing"; import { MsgSend, MsgSendSDKType, MsgMultiSend, MsgMultiSendSDKType } from "./tx"; export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/cosmos.bank.v1beta1.MsgSend", MsgSend], ["/cosmos.bank.v1beta1.MsgMultiSend", MsgMultiSend]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; export const MessageComposer = { encoded: { send(value: MsgSend) { diff --git a/__fixtures__/v-next/outputhelperfunc/cosmos/bank/v1beta1/tx.rpc.msg.ts b/__fixtures__/v-next/outputhelperfunc/cosmos/bank/v1beta1/tx.rpc.msg.ts index 0581a53366..8d155dd487 100644 --- a/__fixtures__/v-next/outputhelperfunc/cosmos/bank/v1beta1/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputhelperfunc/cosmos/bank/v1beta1/tx.rpc.msg.ts @@ -1,6 +1,7 @@ import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; import { Input, InputSDKType, Output, OutputSDKType } from "./bank"; -import { DeliverTxResponse, StdFee, TxRpc } from "../../../types"; +import { DeliverTxResponse } from "@interchainjs/types"; +import { StdFee, TxRpc } from "../../../types"; import { BinaryReader } from "../../../binary"; import { MsgSend, MsgSendSDKType, MsgSendResponse, MsgSendResponseSDKType, MsgMultiSend, MsgMultiSendSDKType, MsgMultiSendResponse, MsgMultiSendResponseSDKType } from "./tx"; /** Msg defines the bank Msg service. */ diff --git a/__fixtures__/v-next/outputhelperfunc/cosmos/base/v1beta1/coin.ts b/__fixtures__/v-next/outputhelperfunc/cosmos/base/v1beta1/coin.ts index 4cda157b6e..7251d9a3b4 100644 --- a/__fixtures__/v-next/outputhelperfunc/cosmos/base/v1beta1/coin.ts +++ b/__fixtures__/v-next/outputhelperfunc/cosmos/base/v1beta1/coin.ts @@ -1,7 +1,7 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; import { isSet, DeepPartial } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; -import { Decimal } from "@cosmjs/math"; +import { Decimal } from "@interchainjs/math"; export const protobufPackage = "cosmos.base.v1beta1"; /** * Coin defines a token with a denomination and an amount. @@ -403,7 +403,7 @@ export const DecCoin = { toAmino(message: DecCoin): DecCoinAmino { const obj: any = {}; obj.denom = message.denom === "" ? undefined : message.denom; - obj.amount = message.amount === "" ? undefined : message.amount; + obj.amount = message.amount === "" ? undefined : Decimal.fromUserInput(message.amount, 18).atomics; return obj; }, fromAminoMsg(object: DecCoinAminoMsg): DecCoin { @@ -625,7 +625,7 @@ export const DecProto = { }, toAmino(message: DecProto): DecProtoAmino { const obj: any = {}; - obj.dec = message.dec === "" ? undefined : message.dec; + obj.dec = message.dec === "" ? undefined : Decimal.fromUserInput(message.dec, 18).atomics; return obj; }, fromAminoMsg(object: DecProtoAminoMsg): DecProto { diff --git a/__fixtures__/v-next/outputhelperfunc/cosmos/client.ts b/__fixtures__/v-next/outputhelperfunc/cosmos/client.ts index ea22095329..2e9251aaac 100644 --- a/__fixtures__/v-next/outputhelperfunc/cosmos/client.ts +++ b/__fixtures__/v-next/outputhelperfunc/cosmos/client.ts @@ -2,7 +2,8 @@ import { GeneratedType, Registry, OfflineSigner } from "@cosmjs/proto-signing"; import { AminoTypes, SigningStargateClient } from "@cosmjs/stargate"; import { HttpEndpoint } from "@cosmjs/tendermint-rpc"; import { createRpcClient } from "../extern"; -import { DeliverTxResponse, EncodeObject, StdFee, TxRpc, SigningClientParams } from "../types"; +import { DeliverTxResponse } from "@interchainjs/types"; +import { EncodeObject, StdFee, TxRpc, SigningClientParams } from "../types"; import * as cosmosAuthzV1beta1TxRegistry from "./authz/v1beta1/tx.registry"; import * as cosmosBankV1beta1TxRegistry from "./bank/v1beta1/tx.registry"; import * as cosmosCrisisV1beta1TxRegistry from "./crisis/v1beta1/tx.registry"; diff --git a/__fixtures__/v-next/outputhelperfunc/cosmos/crisis/v1beta1/tx.registry.ts b/__fixtures__/v-next/outputhelperfunc/cosmos/crisis/v1beta1/tx.registry.ts index 94d4a2c1c4..58c31ab80e 100644 --- a/__fixtures__/v-next/outputhelperfunc/cosmos/crisis/v1beta1/tx.registry.ts +++ b/__fixtures__/v-next/outputhelperfunc/cosmos/crisis/v1beta1/tx.registry.ts @@ -1,12 +1,6 @@ import { TelescopeGeneratedType } from "../../../types"; -import { Registry } from "@cosmjs/proto-signing"; import { MsgVerifyInvariant, MsgVerifyInvariantSDKType } from "./tx"; export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/cosmos.crisis.v1beta1.MsgVerifyInvariant", MsgVerifyInvariant]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; export const MessageComposer = { encoded: { verifyInvariant(value: MsgVerifyInvariant) { diff --git a/__fixtures__/v-next/outputhelperfunc/cosmos/crisis/v1beta1/tx.rpc.msg.ts b/__fixtures__/v-next/outputhelperfunc/cosmos/crisis/v1beta1/tx.rpc.msg.ts index ebfe1dc331..4b61b91444 100644 --- a/__fixtures__/v-next/outputhelperfunc/cosmos/crisis/v1beta1/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputhelperfunc/cosmos/crisis/v1beta1/tx.rpc.msg.ts @@ -1,4 +1,5 @@ -import { DeliverTxResponse, StdFee, TxRpc } from "../../../types"; +import { DeliverTxResponse } from "@interchainjs/types"; +import { StdFee, TxRpc } from "../../../types"; import { BinaryReader } from "../../../binary"; import { MsgVerifyInvariant, MsgVerifyInvariantSDKType, MsgVerifyInvariantResponse, MsgVerifyInvariantResponseSDKType } from "./tx"; /** Msg defines the bank Msg service. */ diff --git a/__fixtures__/v-next/outputhelperfunc/cosmos/distribution/v1beta1/distribution.ts b/__fixtures__/v-next/outputhelperfunc/cosmos/distribution/v1beta1/distribution.ts index 7abb9df33c..e633ee5b2d 100644 --- a/__fixtures__/v-next/outputhelperfunc/cosmos/distribution/v1beta1/distribution.ts +++ b/__fixtures__/v-next/outputhelperfunc/cosmos/distribution/v1beta1/distribution.ts @@ -1,6 +1,6 @@ import { DecCoin, DecCoinAmino, DecCoinSDKType, Coin, CoinAmino, CoinSDKType } from "../../base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { Decimal } from "@cosmjs/math"; +import { Decimal } from "@interchainjs/math"; import { isSet, DeepPartial } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; import { GlobalDecoderRegistry } from "../../../registry"; @@ -687,9 +687,9 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.community_tax = message.communityTax === "" ? undefined : message.communityTax; - obj.base_proposer_reward = message.baseProposerReward === "" ? undefined : message.baseProposerReward; - obj.bonus_proposer_reward = message.bonusProposerReward === "" ? undefined : message.bonusProposerReward; + obj.community_tax = message.communityTax === "" ? undefined : Decimal.fromUserInput(message.communityTax, 18).atomics; + obj.base_proposer_reward = message.baseProposerReward === "" ? undefined : Decimal.fromUserInput(message.baseProposerReward, 18).atomics; + obj.bonus_proposer_reward = message.bonusProposerReward === "" ? undefined : Decimal.fromUserInput(message.bonusProposerReward, 18).atomics; obj.withdraw_addr_enabled = message.withdrawAddrEnabled === false ? undefined : message.withdrawAddrEnabled; return obj; }, @@ -1378,7 +1378,7 @@ export const ValidatorSlashEvent = { toAmino(message: ValidatorSlashEvent): ValidatorSlashEventAmino { const obj: any = {}; obj.validator_period = message.validatorPeriod !== BigInt(0) ? message.validatorPeriod?.toString() : undefined; - obj.fraction = message.fraction === "" ? undefined : message.fraction; + obj.fraction = message.fraction === "" ? undefined : Decimal.fromUserInput(message.fraction, 18).atomics; return obj; }, fromAminoMsg(object: ValidatorSlashEventAminoMsg): ValidatorSlashEvent { @@ -1962,7 +1962,7 @@ export const DelegatorStartingInfo = { toAmino(message: DelegatorStartingInfo): DelegatorStartingInfoAmino { const obj: any = {}; obj.previous_period = message.previousPeriod !== BigInt(0) ? message.previousPeriod?.toString() : undefined; - obj.stake = message.stake === "" ? undefined : message.stake; + obj.stake = message.stake === "" ? undefined : Decimal.fromUserInput(message.stake, 18).atomics; obj.height = message.height ? message.height?.toString() : "0"; return obj; }, diff --git a/__fixtures__/v-next/outputhelperfunc/cosmos/distribution/v1beta1/tx.registry.ts b/__fixtures__/v-next/outputhelperfunc/cosmos/distribution/v1beta1/tx.registry.ts index 87f63ed6a3..b332aef187 100644 --- a/__fixtures__/v-next/outputhelperfunc/cosmos/distribution/v1beta1/tx.registry.ts +++ b/__fixtures__/v-next/outputhelperfunc/cosmos/distribution/v1beta1/tx.registry.ts @@ -1,13 +1,7 @@ import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; import { TelescopeGeneratedType } from "../../../types"; -import { Registry } from "@cosmjs/proto-signing"; import { MsgSetWithdrawAddress, MsgSetWithdrawAddressSDKType, MsgWithdrawDelegatorReward, MsgWithdrawDelegatorRewardSDKType, MsgWithdrawValidatorCommission, MsgWithdrawValidatorCommissionSDKType, MsgFundCommunityPool, MsgFundCommunityPoolSDKType } from "./tx"; export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/cosmos.distribution.v1beta1.MsgSetWithdrawAddress", MsgSetWithdrawAddress], ["/cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward", MsgWithdrawDelegatorReward], ["/cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission", MsgWithdrawValidatorCommission], ["/cosmos.distribution.v1beta1.MsgFundCommunityPool", MsgFundCommunityPool]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; export const MessageComposer = { encoded: { setWithdrawAddress(value: MsgSetWithdrawAddress) { diff --git a/__fixtures__/v-next/outputhelperfunc/cosmos/distribution/v1beta1/tx.rpc.msg.ts b/__fixtures__/v-next/outputhelperfunc/cosmos/distribution/v1beta1/tx.rpc.msg.ts index dd04785c14..568ad47671 100644 --- a/__fixtures__/v-next/outputhelperfunc/cosmos/distribution/v1beta1/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputhelperfunc/cosmos/distribution/v1beta1/tx.rpc.msg.ts @@ -1,5 +1,6 @@ import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; -import { DeliverTxResponse, StdFee, TxRpc } from "../../../types"; +import { DeliverTxResponse } from "@interchainjs/types"; +import { StdFee, TxRpc } from "../../../types"; import { BinaryReader } from "../../../binary"; import { MsgSetWithdrawAddress, MsgSetWithdrawAddressSDKType, MsgSetWithdrawAddressResponse, MsgSetWithdrawAddressResponseSDKType, MsgWithdrawDelegatorReward, MsgWithdrawDelegatorRewardSDKType, MsgWithdrawDelegatorRewardResponse, MsgWithdrawDelegatorRewardResponseSDKType, MsgWithdrawValidatorCommission, MsgWithdrawValidatorCommissionSDKType, MsgWithdrawValidatorCommissionResponse, MsgWithdrawValidatorCommissionResponseSDKType, MsgFundCommunityPool, MsgFundCommunityPoolSDKType, MsgFundCommunityPoolResponse, MsgFundCommunityPoolResponseSDKType } from "./tx"; /** Msg defines the distribution Msg service. */ diff --git a/__fixtures__/v-next/outputhelperfunc/cosmos/evidence/v1beta1/tx.registry.ts b/__fixtures__/v-next/outputhelperfunc/cosmos/evidence/v1beta1/tx.registry.ts index 25559ad153..b58ed28a48 100644 --- a/__fixtures__/v-next/outputhelperfunc/cosmos/evidence/v1beta1/tx.registry.ts +++ b/__fixtures__/v-next/outputhelperfunc/cosmos/evidence/v1beta1/tx.registry.ts @@ -1,13 +1,7 @@ import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../google/protobuf/any"; import { TelescopeGeneratedType } from "../../../types"; -import { Registry } from "@cosmjs/proto-signing"; import { MsgSubmitEvidence, MsgSubmitEvidenceSDKType } from "./tx"; export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/cosmos.evidence.v1beta1.MsgSubmitEvidence", MsgSubmitEvidence]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; export const MessageComposer = { encoded: { submitEvidence(value: MsgSubmitEvidence) { diff --git a/__fixtures__/v-next/outputhelperfunc/cosmos/evidence/v1beta1/tx.rpc.msg.ts b/__fixtures__/v-next/outputhelperfunc/cosmos/evidence/v1beta1/tx.rpc.msg.ts index f4ee485eb0..412c38e1a8 100644 --- a/__fixtures__/v-next/outputhelperfunc/cosmos/evidence/v1beta1/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputhelperfunc/cosmos/evidence/v1beta1/tx.rpc.msg.ts @@ -1,5 +1,6 @@ import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../google/protobuf/any"; -import { DeliverTxResponse, StdFee, TxRpc } from "../../../types"; +import { DeliverTxResponse } from "@interchainjs/types"; +import { StdFee, TxRpc } from "../../../types"; import { BinaryReader } from "../../../binary"; import { MsgSubmitEvidence, MsgSubmitEvidenceSDKType, MsgSubmitEvidenceResponse, MsgSubmitEvidenceResponseSDKType } from "./tx"; /** Msg defines the evidence Msg service. */ diff --git a/__fixtures__/v-next/outputhelperfunc/cosmos/feegrant/v1beta1/tx.registry.ts b/__fixtures__/v-next/outputhelperfunc/cosmos/feegrant/v1beta1/tx.registry.ts index 2b277e6889..f2e73f4222 100644 --- a/__fixtures__/v-next/outputhelperfunc/cosmos/feegrant/v1beta1/tx.registry.ts +++ b/__fixtures__/v-next/outputhelperfunc/cosmos/feegrant/v1beta1/tx.registry.ts @@ -1,14 +1,8 @@ import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../google/protobuf/any"; import { BasicAllowance, BasicAllowanceSDKType, PeriodicAllowance, PeriodicAllowanceSDKType, AllowedMsgAllowance, AllowedMsgAllowanceSDKType } from "./feegrant"; import { TelescopeGeneratedType } from "../../../types"; -import { Registry } from "@cosmjs/proto-signing"; import { MsgGrantAllowance, MsgGrantAllowanceSDKType, MsgRevokeAllowance, MsgRevokeAllowanceSDKType } from "./tx"; export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/cosmos.feegrant.v1beta1.MsgGrantAllowance", MsgGrantAllowance], ["/cosmos.feegrant.v1beta1.MsgRevokeAllowance", MsgRevokeAllowance]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; export const MessageComposer = { encoded: { grantAllowance(value: MsgGrantAllowance) { diff --git a/__fixtures__/v-next/outputhelperfunc/cosmos/feegrant/v1beta1/tx.rpc.msg.ts b/__fixtures__/v-next/outputhelperfunc/cosmos/feegrant/v1beta1/tx.rpc.msg.ts index 3ffa9cad18..017a2e9fd1 100644 --- a/__fixtures__/v-next/outputhelperfunc/cosmos/feegrant/v1beta1/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputhelperfunc/cosmos/feegrant/v1beta1/tx.rpc.msg.ts @@ -1,6 +1,7 @@ import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../google/protobuf/any"; import { BasicAllowance, BasicAllowanceSDKType, PeriodicAllowance, PeriodicAllowanceSDKType, AllowedMsgAllowance, AllowedMsgAllowanceSDKType } from "./feegrant"; -import { DeliverTxResponse, StdFee, TxRpc } from "../../../types"; +import { DeliverTxResponse } from "@interchainjs/types"; +import { StdFee, TxRpc } from "../../../types"; import { BinaryReader } from "../../../binary"; import { MsgGrantAllowance, MsgGrantAllowanceSDKType, MsgGrantAllowanceResponse, MsgGrantAllowanceResponseSDKType, MsgRevokeAllowance, MsgRevokeAllowanceSDKType, MsgRevokeAllowanceResponse, MsgRevokeAllowanceResponseSDKType } from "./tx"; /** Msg defines the feegrant msg service. */ diff --git a/__fixtures__/v-next/outputhelperfunc/cosmos/gov/v1/tx.registry.ts b/__fixtures__/v-next/outputhelperfunc/cosmos/gov/v1/tx.registry.ts index 1274103a2a..9331d2d142 100644 --- a/__fixtures__/v-next/outputhelperfunc/cosmos/gov/v1/tx.registry.ts +++ b/__fixtures__/v-next/outputhelperfunc/cosmos/gov/v1/tx.registry.ts @@ -8,14 +8,8 @@ import { ReplacePoolIncentivesProposal, ReplacePoolIncentivesProposalSDKType, Up import { SetSuperfluidAssetsProposal, SetSuperfluidAssetsProposalSDKType, RemoveSuperfluidAssetsProposal, RemoveSuperfluidAssetsProposalSDKType, UpdateUnpoolWhiteListProposal, UpdateUnpoolWhiteListProposalSDKType } from "../../../osmosis/superfluid/v1beta1/gov"; import { UpdateFeeTokenProposal, UpdateFeeTokenProposalSDKType } from "../../../osmosis/txfees/v1beta1/gov"; import { TelescopeGeneratedType } from "../../../types"; -import { Registry } from "@cosmjs/proto-signing"; import { MsgSubmitProposal, MsgSubmitProposalSDKType, MsgExecLegacyContent, MsgExecLegacyContentSDKType, MsgVote, MsgVoteSDKType, MsgVoteWeighted, MsgVoteWeightedSDKType, MsgDeposit, MsgDepositSDKType } from "./tx"; export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/cosmos.gov.v1.MsgSubmitProposal", MsgSubmitProposal], ["/cosmos.gov.v1.MsgExecLegacyContent", MsgExecLegacyContent], ["/cosmos.gov.v1.MsgVote", MsgVote], ["/cosmos.gov.v1.MsgVoteWeighted", MsgVoteWeighted], ["/cosmos.gov.v1.MsgDeposit", MsgDeposit]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; export const MessageComposer = { encoded: { submitProposal(value: MsgSubmitProposal) { diff --git a/__fixtures__/v-next/outputhelperfunc/cosmos/gov/v1/tx.rpc.msg.ts b/__fixtures__/v-next/outputhelperfunc/cosmos/gov/v1/tx.rpc.msg.ts index 8312b2d9e7..d0acb84075 100644 --- a/__fixtures__/v-next/outputhelperfunc/cosmos/gov/v1/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputhelperfunc/cosmos/gov/v1/tx.rpc.msg.ts @@ -7,7 +7,8 @@ import { ClientUpdateProposal, ClientUpdateProposalSDKType, UpgradeProposal, Upg import { ReplacePoolIncentivesProposal, ReplacePoolIncentivesProposalSDKType, UpdatePoolIncentivesProposal, UpdatePoolIncentivesProposalSDKType } from "../../../osmosis/pool-incentives/v1beta1/gov"; import { SetSuperfluidAssetsProposal, SetSuperfluidAssetsProposalSDKType, RemoveSuperfluidAssetsProposal, RemoveSuperfluidAssetsProposalSDKType, UpdateUnpoolWhiteListProposal, UpdateUnpoolWhiteListProposalSDKType } from "../../../osmosis/superfluid/v1beta1/gov"; import { UpdateFeeTokenProposal, UpdateFeeTokenProposalSDKType } from "../../../osmosis/txfees/v1beta1/gov"; -import { DeliverTxResponse, StdFee, TxRpc } from "../../../types"; +import { DeliverTxResponse } from "@interchainjs/types"; +import { StdFee, TxRpc } from "../../../types"; import { BinaryReader } from "../../../binary"; import { MsgSubmitProposal, MsgSubmitProposalSDKType, MsgSubmitProposalResponse, MsgSubmitProposalResponseSDKType, MsgExecLegacyContent, MsgExecLegacyContentSDKType, MsgExecLegacyContentResponse, MsgExecLegacyContentResponseSDKType, MsgVote, MsgVoteSDKType, MsgVoteResponse, MsgVoteResponseSDKType, MsgVoteWeighted, MsgVoteWeightedSDKType, MsgVoteWeightedResponse, MsgVoteWeightedResponseSDKType, MsgDeposit, MsgDepositSDKType, MsgDepositResponse, MsgDepositResponseSDKType } from "./tx"; /** Msg defines the gov Msg service. */ diff --git a/__fixtures__/v-next/outputhelperfunc/cosmos/gov/v1beta1/gov.ts b/__fixtures__/v-next/outputhelperfunc/cosmos/gov/v1beta1/gov.ts index 20adc283b1..e861f6dae8 100644 --- a/__fixtures__/v-next/outputhelperfunc/cosmos/gov/v1beta1/gov.ts +++ b/__fixtures__/v-next/outputhelperfunc/cosmos/gov/v1beta1/gov.ts @@ -9,7 +9,7 @@ import { SetSuperfluidAssetsProposal, SetSuperfluidAssetsProposalProtoMsg, SetSu import { UpdateFeeTokenProposal, UpdateFeeTokenProposalProtoMsg, UpdateFeeTokenProposalSDKType } from "../../../osmosis/txfees/v1beta1/gov"; import { isSet, DeepPartial, toTimestamp, fromTimestamp, bytesFromBase64, base64FromBytes } from "../../../helpers"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { Decimal } from "@cosmjs/math"; +import { Decimal } from "@interchainjs/math"; import { JsonSafe } from "../../../json-safe"; import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "cosmos.gov.v1beta1"; @@ -722,7 +722,7 @@ export const WeightedVoteOption = { toAmino(message: WeightedVoteOption): WeightedVoteOptionAmino { const obj: any = {}; obj.option = message.option === 0 ? undefined : message.option; - obj.weight = message.weight === "" ? undefined : message.weight; + obj.weight = message.weight === "" ? undefined : Decimal.fromUserInput(message.weight, 18).atomics; return obj; }, fromAminoMsg(object: WeightedVoteOptionAminoMsg): WeightedVoteOption { diff --git a/__fixtures__/v-next/outputhelperfunc/cosmos/gov/v1beta1/tx.registry.ts b/__fixtures__/v-next/outputhelperfunc/cosmos/gov/v1beta1/tx.registry.ts index 4960a2cac0..a81195016e 100644 --- a/__fixtures__/v-next/outputhelperfunc/cosmos/gov/v1beta1/tx.registry.ts +++ b/__fixtures__/v-next/outputhelperfunc/cosmos/gov/v1beta1/tx.registry.ts @@ -7,14 +7,8 @@ import { ReplacePoolIncentivesProposal, ReplacePoolIncentivesProposalSDKType, Up import { SetSuperfluidAssetsProposal, SetSuperfluidAssetsProposalSDKType, RemoveSuperfluidAssetsProposal, RemoveSuperfluidAssetsProposalSDKType, UpdateUnpoolWhiteListProposal, UpdateUnpoolWhiteListProposalSDKType } from "../../../osmosis/superfluid/v1beta1/gov"; import { UpdateFeeTokenProposal, UpdateFeeTokenProposalSDKType } from "../../../osmosis/txfees/v1beta1/gov"; import { TelescopeGeneratedType } from "../../../types"; -import { Registry } from "@cosmjs/proto-signing"; import { MsgSubmitProposal, MsgSubmitProposalSDKType, MsgVote, MsgVoteSDKType, MsgVoteWeighted, MsgVoteWeightedSDKType, MsgDeposit, MsgDepositSDKType } from "./tx"; export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/cosmos.gov.v1beta1.MsgSubmitProposal", MsgSubmitProposal], ["/cosmos.gov.v1beta1.MsgVote", MsgVote], ["/cosmos.gov.v1beta1.MsgVoteWeighted", MsgVoteWeighted], ["/cosmos.gov.v1beta1.MsgDeposit", MsgDeposit]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; export const MessageComposer = { encoded: { submitProposal(value: MsgSubmitProposal) { diff --git a/__fixtures__/v-next/outputhelperfunc/cosmos/gov/v1beta1/tx.rpc.msg.ts b/__fixtures__/v-next/outputhelperfunc/cosmos/gov/v1beta1/tx.rpc.msg.ts index a70cc1447b..659273ae40 100644 --- a/__fixtures__/v-next/outputhelperfunc/cosmos/gov/v1beta1/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputhelperfunc/cosmos/gov/v1beta1/tx.rpc.msg.ts @@ -6,7 +6,8 @@ import { ClientUpdateProposal, ClientUpdateProposalSDKType, UpgradeProposal, Upg import { ReplacePoolIncentivesProposal, ReplacePoolIncentivesProposalSDKType, UpdatePoolIncentivesProposal, UpdatePoolIncentivesProposalSDKType } from "../../../osmosis/pool-incentives/v1beta1/gov"; import { SetSuperfluidAssetsProposal, SetSuperfluidAssetsProposalSDKType, RemoveSuperfluidAssetsProposal, RemoveSuperfluidAssetsProposalSDKType, UpdateUnpoolWhiteListProposal, UpdateUnpoolWhiteListProposalSDKType } from "../../../osmosis/superfluid/v1beta1/gov"; import { UpdateFeeTokenProposal, UpdateFeeTokenProposalSDKType } from "../../../osmosis/txfees/v1beta1/gov"; -import { DeliverTxResponse, StdFee, TxRpc } from "../../../types"; +import { DeliverTxResponse } from "@interchainjs/types"; +import { StdFee, TxRpc } from "../../../types"; import { BinaryReader } from "../../../binary"; import { MsgSubmitProposal, MsgSubmitProposalSDKType, MsgSubmitProposalResponse, MsgSubmitProposalResponseSDKType, MsgVote, MsgVoteSDKType, MsgVoteResponse, MsgVoteResponseSDKType, MsgVoteWeighted, MsgVoteWeightedSDKType, MsgVoteWeightedResponse, MsgVoteWeightedResponseSDKType, MsgDeposit, MsgDepositSDKType, MsgDepositResponse, MsgDepositResponseSDKType } from "./tx"; /** Msg defines the bank Msg service. */ diff --git a/__fixtures__/v-next/outputhelperfunc/cosmos/group/v1/tx.registry.ts b/__fixtures__/v-next/outputhelperfunc/cosmos/group/v1/tx.registry.ts index a5f16e30c2..451d90b71a 100644 --- a/__fixtures__/v-next/outputhelperfunc/cosmos/group/v1/tx.registry.ts +++ b/__fixtures__/v-next/outputhelperfunc/cosmos/group/v1/tx.registry.ts @@ -1,14 +1,8 @@ import { Member, MemberSDKType, VoteOption, VoteOptionSDKType, ThresholdDecisionPolicy, ThresholdDecisionPolicySDKType, PercentageDecisionPolicy, PercentageDecisionPolicySDKType } from "./types"; import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../google/protobuf/any"; import { TelescopeGeneratedType } from "../../../types"; -import { Registry } from "@cosmjs/proto-signing"; import { MsgCreateGroup, MsgCreateGroupSDKType, MsgUpdateGroupMembers, MsgUpdateGroupMembersSDKType, MsgUpdateGroupAdmin, MsgUpdateGroupAdminSDKType, MsgUpdateGroupMetadata, MsgUpdateGroupMetadataSDKType, MsgCreateGroupPolicy, MsgCreateGroupPolicySDKType, MsgCreateGroupWithPolicy, MsgCreateGroupWithPolicySDKType, MsgUpdateGroupPolicyAdmin, MsgUpdateGroupPolicyAdminSDKType, MsgUpdateGroupPolicyDecisionPolicy, MsgUpdateGroupPolicyDecisionPolicySDKType, MsgUpdateGroupPolicyMetadata, MsgUpdateGroupPolicyMetadataSDKType, MsgSubmitProposal, MsgSubmitProposalSDKType, MsgWithdrawProposal, MsgWithdrawProposalSDKType, MsgVote, MsgVoteSDKType, MsgExec, MsgExecSDKType, MsgLeaveGroup, MsgLeaveGroupSDKType } from "./tx"; export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/cosmos.group.v1.MsgCreateGroup", MsgCreateGroup], ["/cosmos.group.v1.MsgUpdateGroupMembers", MsgUpdateGroupMembers], ["/cosmos.group.v1.MsgUpdateGroupAdmin", MsgUpdateGroupAdmin], ["/cosmos.group.v1.MsgUpdateGroupMetadata", MsgUpdateGroupMetadata], ["/cosmos.group.v1.MsgCreateGroupPolicy", MsgCreateGroupPolicy], ["/cosmos.group.v1.MsgCreateGroupWithPolicy", MsgCreateGroupWithPolicy], ["/cosmos.group.v1.MsgUpdateGroupPolicyAdmin", MsgUpdateGroupPolicyAdmin], ["/cosmos.group.v1.MsgUpdateGroupPolicyDecisionPolicy", MsgUpdateGroupPolicyDecisionPolicy], ["/cosmos.group.v1.MsgUpdateGroupPolicyMetadata", MsgUpdateGroupPolicyMetadata], ["/cosmos.group.v1.MsgSubmitProposal", MsgSubmitProposal], ["/cosmos.group.v1.MsgWithdrawProposal", MsgWithdrawProposal], ["/cosmos.group.v1.MsgVote", MsgVote], ["/cosmos.group.v1.MsgExec", MsgExec], ["/cosmos.group.v1.MsgLeaveGroup", MsgLeaveGroup]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; export const MessageComposer = { encoded: { createGroup(value: MsgCreateGroup) { diff --git a/__fixtures__/v-next/outputhelperfunc/cosmos/group/v1/tx.rpc.msg.ts b/__fixtures__/v-next/outputhelperfunc/cosmos/group/v1/tx.rpc.msg.ts index e2bf50c362..ca9108d932 100644 --- a/__fixtures__/v-next/outputhelperfunc/cosmos/group/v1/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputhelperfunc/cosmos/group/v1/tx.rpc.msg.ts @@ -1,6 +1,7 @@ import { Member, MemberSDKType, VoteOption, VoteOptionSDKType, ThresholdDecisionPolicy, ThresholdDecisionPolicySDKType, PercentageDecisionPolicy, PercentageDecisionPolicySDKType } from "./types"; import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../google/protobuf/any"; -import { DeliverTxResponse, StdFee, TxRpc } from "../../../types"; +import { DeliverTxResponse } from "@interchainjs/types"; +import { StdFee, TxRpc } from "../../../types"; import { BinaryReader } from "../../../binary"; import { MsgCreateGroup, MsgCreateGroupSDKType, MsgCreateGroupResponse, MsgCreateGroupResponseSDKType, MsgUpdateGroupMembers, MsgUpdateGroupMembersSDKType, MsgUpdateGroupMembersResponse, MsgUpdateGroupMembersResponseSDKType, MsgUpdateGroupAdmin, MsgUpdateGroupAdminSDKType, MsgUpdateGroupAdminResponse, MsgUpdateGroupAdminResponseSDKType, MsgUpdateGroupMetadata, MsgUpdateGroupMetadataSDKType, MsgUpdateGroupMetadataResponse, MsgUpdateGroupMetadataResponseSDKType, MsgCreateGroupPolicy, MsgCreateGroupPolicySDKType, MsgCreateGroupPolicyResponse, MsgCreateGroupPolicyResponseSDKType, MsgCreateGroupWithPolicy, MsgCreateGroupWithPolicySDKType, MsgCreateGroupWithPolicyResponse, MsgCreateGroupWithPolicyResponseSDKType, MsgUpdateGroupPolicyAdmin, MsgUpdateGroupPolicyAdminSDKType, MsgUpdateGroupPolicyAdminResponse, MsgUpdateGroupPolicyAdminResponseSDKType, MsgUpdateGroupPolicyDecisionPolicy, MsgUpdateGroupPolicyDecisionPolicySDKType, MsgUpdateGroupPolicyDecisionPolicyResponse, MsgUpdateGroupPolicyDecisionPolicyResponseSDKType, MsgUpdateGroupPolicyMetadata, MsgUpdateGroupPolicyMetadataSDKType, MsgUpdateGroupPolicyMetadataResponse, MsgUpdateGroupPolicyMetadataResponseSDKType, MsgSubmitProposal, MsgSubmitProposalSDKType, MsgSubmitProposalResponse, MsgSubmitProposalResponseSDKType, MsgWithdrawProposal, MsgWithdrawProposalSDKType, MsgWithdrawProposalResponse, MsgWithdrawProposalResponseSDKType, MsgVote, MsgVoteSDKType, MsgVoteResponse, MsgVoteResponseSDKType, MsgExec, MsgExecSDKType, MsgExecResponse, MsgExecResponseSDKType, MsgLeaveGroup, MsgLeaveGroupSDKType, MsgLeaveGroupResponse, MsgLeaveGroupResponseSDKType } from "./tx"; /** Msg is the cosmos.group.v1 Msg service. */ diff --git a/__fixtures__/v-next/outputhelperfunc/cosmos/mint/v1beta1/mint.ts b/__fixtures__/v-next/outputhelperfunc/cosmos/mint/v1beta1/mint.ts index 770e3d7383..db87880d2f 100644 --- a/__fixtures__/v-next/outputhelperfunc/cosmos/mint/v1beta1/mint.ts +++ b/__fixtures__/v-next/outputhelperfunc/cosmos/mint/v1beta1/mint.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { Decimal } from "@cosmjs/math"; +import { Decimal } from "@interchainjs/math"; import { isSet, DeepPartial } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "cosmos.mint.v1beta1"; @@ -240,8 +240,8 @@ export const Minter = { }, toAmino(message: Minter): MinterAmino { const obj: any = {}; - obj.inflation = message.inflation === "" ? undefined : message.inflation; - obj.annual_provisions = message.annualProvisions === "" ? undefined : message.annualProvisions; + obj.inflation = message.inflation === "" ? undefined : Decimal.fromUserInput(message.inflation, 18).atomics; + obj.annual_provisions = message.annualProvisions === "" ? undefined : Decimal.fromUserInput(message.annualProvisions, 18).atomics; return obj; }, fromAminoMsg(object: MinterAminoMsg): Minter { @@ -435,10 +435,10 @@ export const Params = { toAmino(message: Params): ParamsAmino { const obj: any = {}; obj.mint_denom = message.mintDenom === "" ? undefined : message.mintDenom; - obj.inflation_rate_change = message.inflationRateChange === "" ? undefined : message.inflationRateChange; - obj.inflation_max = message.inflationMax === "" ? undefined : message.inflationMax; - obj.inflation_min = message.inflationMin === "" ? undefined : message.inflationMin; - obj.goal_bonded = message.goalBonded === "" ? undefined : message.goalBonded; + obj.inflation_rate_change = message.inflationRateChange === "" ? undefined : Decimal.fromUserInput(message.inflationRateChange, 18).atomics; + obj.inflation_max = message.inflationMax === "" ? undefined : Decimal.fromUserInput(message.inflationMax, 18).atomics; + obj.inflation_min = message.inflationMin === "" ? undefined : Decimal.fromUserInput(message.inflationMin, 18).atomics; + obj.goal_bonded = message.goalBonded === "" ? undefined : Decimal.fromUserInput(message.goalBonded, 18).atomics; obj.blocks_per_year = message.blocksPerYear !== BigInt(0) ? message.blocksPerYear?.toString() : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputhelperfunc/cosmos/nft/v1beta1/tx.registry.ts b/__fixtures__/v-next/outputhelperfunc/cosmos/nft/v1beta1/tx.registry.ts index d32073e6d4..8c30af2dc8 100644 --- a/__fixtures__/v-next/outputhelperfunc/cosmos/nft/v1beta1/tx.registry.ts +++ b/__fixtures__/v-next/outputhelperfunc/cosmos/nft/v1beta1/tx.registry.ts @@ -1,12 +1,6 @@ import { TelescopeGeneratedType } from "../../../types"; -import { Registry } from "@cosmjs/proto-signing"; import { MsgSend, MsgSendSDKType } from "./tx"; export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/cosmos.nft.v1beta1.MsgSend", MsgSend]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; export const MessageComposer = { encoded: { send(value: MsgSend) { diff --git a/__fixtures__/v-next/outputhelperfunc/cosmos/nft/v1beta1/tx.rpc.msg.ts b/__fixtures__/v-next/outputhelperfunc/cosmos/nft/v1beta1/tx.rpc.msg.ts index 0b5fa23c02..6ffc23d98f 100644 --- a/__fixtures__/v-next/outputhelperfunc/cosmos/nft/v1beta1/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputhelperfunc/cosmos/nft/v1beta1/tx.rpc.msg.ts @@ -1,4 +1,5 @@ -import { DeliverTxResponse, StdFee, TxRpc } from "../../../types"; +import { DeliverTxResponse } from "@interchainjs/types"; +import { StdFee, TxRpc } from "../../../types"; import { BinaryReader } from "../../../binary"; import { MsgSend, MsgSendSDKType, MsgSendResponse, MsgSendResponseSDKType } from "./tx"; /** Msg defines the nft Msg service. */ diff --git a/__fixtures__/v-next/outputhelperfunc/cosmos/slashing/v1beta1/tx.registry.ts b/__fixtures__/v-next/outputhelperfunc/cosmos/slashing/v1beta1/tx.registry.ts index de16827766..114c70c136 100644 --- a/__fixtures__/v-next/outputhelperfunc/cosmos/slashing/v1beta1/tx.registry.ts +++ b/__fixtures__/v-next/outputhelperfunc/cosmos/slashing/v1beta1/tx.registry.ts @@ -1,12 +1,6 @@ import { TelescopeGeneratedType } from "../../../types"; -import { Registry } from "@cosmjs/proto-signing"; import { MsgUnjail, MsgUnjailSDKType } from "./tx"; export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/cosmos.slashing.v1beta1.MsgUnjail", MsgUnjail]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; export const MessageComposer = { encoded: { unjail(value: MsgUnjail) { diff --git a/__fixtures__/v-next/outputhelperfunc/cosmos/slashing/v1beta1/tx.rpc.msg.ts b/__fixtures__/v-next/outputhelperfunc/cosmos/slashing/v1beta1/tx.rpc.msg.ts index 6903d5d8bf..abd1dfb5cc 100644 --- a/__fixtures__/v-next/outputhelperfunc/cosmos/slashing/v1beta1/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputhelperfunc/cosmos/slashing/v1beta1/tx.rpc.msg.ts @@ -1,4 +1,5 @@ -import { DeliverTxResponse, StdFee, TxRpc } from "../../../types"; +import { DeliverTxResponse } from "@interchainjs/types"; +import { StdFee, TxRpc } from "../../../types"; import { BinaryReader } from "../../../binary"; import { MsgUnjail, MsgUnjailSDKType, MsgUnjailResponse, MsgUnjailResponseSDKType } from "./tx"; /** Msg defines the slashing Msg service. */ diff --git a/__fixtures__/v-next/outputhelperfunc/cosmos/staking/v1beta1/staking.ts b/__fixtures__/v-next/outputhelperfunc/cosmos/staking/v1beta1/staking.ts index 193237c7dd..72b71e31dd 100644 --- a/__fixtures__/v-next/outputhelperfunc/cosmos/staking/v1beta1/staking.ts +++ b/__fixtures__/v-next/outputhelperfunc/cosmos/staking/v1beta1/staking.ts @@ -7,8 +7,8 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; import { GlobalDecoderRegistry } from "../../../registry"; import { isSet, DeepPartial, toTimestamp, fromTimestamp } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; -import { Decimal } from "@cosmjs/math"; -import { encodePubkey, decodePubkey } from "@cosmjs/proto-signing"; +import { Decimal } from "@interchainjs/math"; +import { encodePubkey, decodePubkey } from "@interchainjs/pubkey"; export const protobufPackage = "cosmos.staking.v1beta1"; /** BondStatus is the status of a validator. */ export enum BondStatus { @@ -1509,9 +1509,9 @@ export const CommissionRates = { }, toAmino(message: CommissionRates): CommissionRatesAmino { const obj: any = {}; - obj.rate = message.rate === "" ? undefined : message.rate; - obj.max_rate = message.maxRate === "" ? undefined : message.maxRate; - obj.max_change_rate = message.maxChangeRate === "" ? undefined : message.maxChangeRate; + obj.rate = message.rate === "" ? undefined : Decimal.fromUserInput(message.rate, 18).atomics; + obj.max_rate = message.maxRate === "" ? undefined : Decimal.fromUserInput(message.maxRate, 18).atomics; + obj.max_change_rate = message.maxChangeRate === "" ? undefined : Decimal.fromUserInput(message.maxChangeRate, 18).atomics; return obj; }, fromAminoMsg(object: CommissionRatesAminoMsg): CommissionRates { @@ -2116,7 +2116,7 @@ export const Validator = { obj.jailed = message.jailed === false ? undefined : message.jailed; obj.status = message.status === 0 ? undefined : message.status; obj.tokens = message.tokens === "" ? undefined : message.tokens; - obj.delegator_shares = message.delegatorShares === "" ? undefined : message.delegatorShares; + obj.delegator_shares = message.delegatorShares === "" ? undefined : Decimal.fromUserInput(message.delegatorShares, 18).atomics; obj.description = message.description ? Description.toAmino(message.description) : undefined; obj.unbonding_height = message.unbondingHeight !== BigInt(0) ? message.unbondingHeight?.toString() : undefined; obj.unbonding_time = message.unbondingTime ? Timestamp.toAmino(toTimestamp(message.unbondingTime)) : undefined; @@ -2925,7 +2925,7 @@ export const Delegation = { const obj: any = {}; obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; - obj.shares = message.shares === "" ? undefined : message.shares; + obj.shares = message.shares === "" ? undefined : Decimal.fromUserInput(message.shares, 18).atomics; return obj; }, fromAminoMsg(object: DelegationAminoMsg): Delegation { @@ -3414,7 +3414,7 @@ export const RedelegationEntry = { obj.creation_height = message.creationHeight !== BigInt(0) ? message.creationHeight?.toString() : undefined; obj.completion_time = message.completionTime ? Timestamp.toAmino(toTimestamp(message.completionTime)) : undefined; obj.initial_balance = message.initialBalance === "" ? undefined : message.initialBalance; - obj.shares_dst = message.sharesDst === "" ? undefined : message.sharesDst; + obj.shares_dst = message.sharesDst === "" ? undefined : Decimal.fromUserInput(message.sharesDst, 18).atomics; return obj; }, fromAminoMsg(object: RedelegationEntryAminoMsg): RedelegationEntry { @@ -3790,7 +3790,7 @@ export const Params = { obj.max_entries = message.maxEntries === 0 ? undefined : message.maxEntries; obj.historical_entries = message.historicalEntries === 0 ? undefined : message.historicalEntries; obj.bond_denom = message.bondDenom === "" ? undefined : message.bondDenom; - obj.min_commission_rate = message.minCommissionRate === "" ? undefined : message.minCommissionRate; + obj.min_commission_rate = message.minCommissionRate === "" ? undefined : Decimal.fromUserInput(message.minCommissionRate, 18).atomics; return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputhelperfunc/cosmos/staking/v1beta1/tx.registry.ts b/__fixtures__/v-next/outputhelperfunc/cosmos/staking/v1beta1/tx.registry.ts index df08cc90a8..c6e13903d2 100644 --- a/__fixtures__/v-next/outputhelperfunc/cosmos/staking/v1beta1/tx.registry.ts +++ b/__fixtures__/v-next/outputhelperfunc/cosmos/staking/v1beta1/tx.registry.ts @@ -3,14 +3,8 @@ import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../google/protobuf import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; import { Timestamp, TimestampSDKType } from "../../../google/protobuf/timestamp"; import { TelescopeGeneratedType } from "../../../types"; -import { Registry } from "@cosmjs/proto-signing"; import { MsgCreateValidator, MsgCreateValidatorSDKType, MsgEditValidator, MsgEditValidatorSDKType, MsgDelegate, MsgDelegateSDKType, MsgBeginRedelegate, MsgBeginRedelegateSDKType, MsgUndelegate, MsgUndelegateSDKType } from "./tx"; export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/cosmos.staking.v1beta1.MsgCreateValidator", MsgCreateValidator], ["/cosmos.staking.v1beta1.MsgEditValidator", MsgEditValidator], ["/cosmos.staking.v1beta1.MsgDelegate", MsgDelegate], ["/cosmos.staking.v1beta1.MsgBeginRedelegate", MsgBeginRedelegate], ["/cosmos.staking.v1beta1.MsgUndelegate", MsgUndelegate]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; export const MessageComposer = { encoded: { createValidator(value: MsgCreateValidator) { diff --git a/__fixtures__/v-next/outputhelperfunc/cosmos/staking/v1beta1/tx.rpc.msg.ts b/__fixtures__/v-next/outputhelperfunc/cosmos/staking/v1beta1/tx.rpc.msg.ts index a665cb6ddc..9776c83140 100644 --- a/__fixtures__/v-next/outputhelperfunc/cosmos/staking/v1beta1/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputhelperfunc/cosmos/staking/v1beta1/tx.rpc.msg.ts @@ -2,7 +2,8 @@ import { Description, DescriptionSDKType, CommissionRates, CommissionRatesSDKTyp import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../google/protobuf/any"; import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; import { Timestamp, TimestampSDKType } from "../../../google/protobuf/timestamp"; -import { DeliverTxResponse, StdFee, TxRpc } from "../../../types"; +import { DeliverTxResponse } from "@interchainjs/types"; +import { StdFee, TxRpc } from "../../../types"; import { BinaryReader } from "../../../binary"; import { MsgCreateValidator, MsgCreateValidatorSDKType, MsgCreateValidatorResponse, MsgCreateValidatorResponseSDKType, MsgEditValidator, MsgEditValidatorSDKType, MsgEditValidatorResponse, MsgEditValidatorResponseSDKType, MsgDelegate, MsgDelegateSDKType, MsgDelegateResponse, MsgDelegateResponseSDKType, MsgBeginRedelegate, MsgBeginRedelegateSDKType, MsgBeginRedelegateResponse, MsgBeginRedelegateResponseSDKType, MsgUndelegate, MsgUndelegateSDKType, MsgUndelegateResponse, MsgUndelegateResponseSDKType } from "./tx"; /** Msg defines the staking Msg service. */ diff --git a/__fixtures__/v-next/outputhelperfunc/cosmos/staking/v1beta1/tx.ts b/__fixtures__/v-next/outputhelperfunc/cosmos/staking/v1beta1/tx.ts index 5519df2b58..33fbbd9c22 100644 --- a/__fixtures__/v-next/outputhelperfunc/cosmos/staking/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputhelperfunc/cosmos/staking/v1beta1/tx.ts @@ -6,8 +6,8 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; import { GlobalDecoderRegistry } from "../../../registry"; import { isSet, DeepPartial, toTimestamp, fromTimestamp } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; -import { encodePubkey, decodePubkey } from "@cosmjs/proto-signing"; -import { Decimal } from "@cosmjs/math"; +import { encodePubkey, decodePubkey } from "@interchainjs/pubkey"; +import { Decimal } from "@interchainjs/math"; export const protobufPackage = "cosmos.staking.v1beta1"; /** * MsgCreateValidator defines a SDK message for creating a new validator. @@ -867,7 +867,7 @@ export const MsgEditValidator = { const obj: any = {}; obj.description = message.description ? Description.toAmino(message.description) : undefined; obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; - obj.commission_rate = message.commissionRate === "" ? undefined : message.commissionRate; + obj.commission_rate = message.commissionRate === "" ? undefined : Decimal.fromUserInput(message.commissionRate, 18).atomics; obj.min_self_delegation = message.minSelfDelegation === "" ? undefined : message.minSelfDelegation; return obj; }, diff --git a/__fixtures__/v-next/outputhelperfunc/cosmos/upgrade/v1beta1/tx.registry.ts b/__fixtures__/v-next/outputhelperfunc/cosmos/upgrade/v1beta1/tx.registry.ts index a938035698..2ed5f7f5bb 100644 --- a/__fixtures__/v-next/outputhelperfunc/cosmos/upgrade/v1beta1/tx.registry.ts +++ b/__fixtures__/v-next/outputhelperfunc/cosmos/upgrade/v1beta1/tx.registry.ts @@ -1,13 +1,7 @@ import { Plan, PlanSDKType } from "./upgrade"; import { TelescopeGeneratedType } from "../../../types"; -import { Registry } from "@cosmjs/proto-signing"; import { MsgSoftwareUpgrade, MsgSoftwareUpgradeSDKType, MsgCancelUpgrade, MsgCancelUpgradeSDKType } from "./tx"; export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/cosmos.upgrade.v1beta1.MsgSoftwareUpgrade", MsgSoftwareUpgrade], ["/cosmos.upgrade.v1beta1.MsgCancelUpgrade", MsgCancelUpgrade]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; export const MessageComposer = { encoded: { softwareUpgrade(value: MsgSoftwareUpgrade) { diff --git a/__fixtures__/v-next/outputhelperfunc/cosmos/upgrade/v1beta1/tx.rpc.msg.ts b/__fixtures__/v-next/outputhelperfunc/cosmos/upgrade/v1beta1/tx.rpc.msg.ts index 23bf8c8fe7..745ae894e7 100644 --- a/__fixtures__/v-next/outputhelperfunc/cosmos/upgrade/v1beta1/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputhelperfunc/cosmos/upgrade/v1beta1/tx.rpc.msg.ts @@ -1,5 +1,6 @@ import { Plan, PlanSDKType } from "./upgrade"; -import { DeliverTxResponse, StdFee, TxRpc } from "../../../types"; +import { DeliverTxResponse } from "@interchainjs/types"; +import { StdFee, TxRpc } from "../../../types"; import { BinaryReader } from "../../../binary"; import { MsgSoftwareUpgrade, MsgSoftwareUpgradeSDKType, MsgSoftwareUpgradeResponse, MsgSoftwareUpgradeResponseSDKType, MsgCancelUpgrade, MsgCancelUpgradeSDKType, MsgCancelUpgradeResponse, MsgCancelUpgradeResponseSDKType } from "./tx"; /** Msg defines the upgrade Msg service. */ diff --git a/__fixtures__/v-next/outputhelperfunc/cosmos/vesting/v1beta1/tx.registry.ts b/__fixtures__/v-next/outputhelperfunc/cosmos/vesting/v1beta1/tx.registry.ts index 74a9eb09c5..f3c470a160 100644 --- a/__fixtures__/v-next/outputhelperfunc/cosmos/vesting/v1beta1/tx.registry.ts +++ b/__fixtures__/v-next/outputhelperfunc/cosmos/vesting/v1beta1/tx.registry.ts @@ -1,14 +1,8 @@ import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; import { Period, PeriodSDKType } from "./vesting"; import { TelescopeGeneratedType } from "../../../types"; -import { Registry } from "@cosmjs/proto-signing"; import { MsgCreateVestingAccount, MsgCreateVestingAccountSDKType, MsgCreatePermanentLockedAccount, MsgCreatePermanentLockedAccountSDKType, MsgCreatePeriodicVestingAccount, MsgCreatePeriodicVestingAccountSDKType } from "./tx"; export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/cosmos.vesting.v1beta1.MsgCreateVestingAccount", MsgCreateVestingAccount], ["/cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccount", MsgCreatePermanentLockedAccount], ["/cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccount", MsgCreatePeriodicVestingAccount]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; export const MessageComposer = { encoded: { createVestingAccount(value: MsgCreateVestingAccount) { diff --git a/__fixtures__/v-next/outputhelperfunc/cosmos/vesting/v1beta1/tx.rpc.msg.ts b/__fixtures__/v-next/outputhelperfunc/cosmos/vesting/v1beta1/tx.rpc.msg.ts index 0596363411..ed65641bda 100644 --- a/__fixtures__/v-next/outputhelperfunc/cosmos/vesting/v1beta1/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputhelperfunc/cosmos/vesting/v1beta1/tx.rpc.msg.ts @@ -1,6 +1,7 @@ import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; import { Period, PeriodSDKType } from "./vesting"; -import { DeliverTxResponse, StdFee, TxRpc } from "../../../types"; +import { DeliverTxResponse } from "@interchainjs/types"; +import { StdFee, TxRpc } from "../../../types"; import { BinaryReader } from "../../../binary"; import { MsgCreateVestingAccount, MsgCreateVestingAccountSDKType, MsgCreateVestingAccountResponse, MsgCreateVestingAccountResponseSDKType, MsgCreatePermanentLockedAccount, MsgCreatePermanentLockedAccountSDKType, MsgCreatePermanentLockedAccountResponse, MsgCreatePermanentLockedAccountResponseSDKType, MsgCreatePeriodicVestingAccount, MsgCreatePeriodicVestingAccountSDKType, MsgCreatePeriodicVestingAccountResponse, MsgCreatePeriodicVestingAccountResponseSDKType } from "./tx"; /** Msg defines the bank Msg service. */ diff --git a/__fixtures__/v-next/outputhelperfunc/cosmwasm/client.ts b/__fixtures__/v-next/outputhelperfunc/cosmwasm/client.ts index 2bdbfaa2d1..9ebcddd429 100644 --- a/__fixtures__/v-next/outputhelperfunc/cosmwasm/client.ts +++ b/__fixtures__/v-next/outputhelperfunc/cosmwasm/client.ts @@ -2,7 +2,8 @@ import { GeneratedType, Registry, OfflineSigner } from "@cosmjs/proto-signing"; import { defaultRegistryTypes, AminoTypes, SigningStargateClient } from "@cosmjs/stargate"; import { HttpEndpoint } from "@cosmjs/tendermint-rpc"; import { createRpcClient } from "../extern"; -import { DeliverTxResponse, EncodeObject, StdFee, TxRpc, SigningClientParams } from "../types"; +import { DeliverTxResponse } from "@interchainjs/types"; +import { EncodeObject, StdFee, TxRpc, SigningClientParams } from "../types"; import * as cosmwasmWasmV1TxRegistry from "./wasm/v1/tx.registry"; import * as cosmwasmWasmV1TxAmino from "./wasm/v1/tx.amino"; export const cosmwasmAminoConverters = { diff --git a/__fixtures__/v-next/outputhelperfunc/cosmwasm/wasm/v1/proposal.ts b/__fixtures__/v-next/outputhelperfunc/cosmwasm/wasm/v1/proposal.ts index 4209dde33d..7e121ef82d 100644 --- a/__fixtures__/v-next/outputhelperfunc/cosmwasm/wasm/v1/proposal.ts +++ b/__fixtures__/v-next/outputhelperfunc/cosmwasm/wasm/v1/proposal.ts @@ -4,7 +4,7 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; import { GlobalDecoderRegistry } from "../../../registry"; import { isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; -import { fromBase64, toBase64, toUtf8, fromUtf8 } from "@cosmjs/encoding"; +import { fromBase64, toBase64, toUtf8, fromUtf8 } from "@interchainjs/encoding"; export const protobufPackage = "cosmwasm.wasm.v1"; /** * StoreCodeProposal gov proposal content type to submit WASM code to the system diff --git a/__fixtures__/v-next/outputhelperfunc/cosmwasm/wasm/v1/query.ts b/__fixtures__/v-next/outputhelperfunc/cosmwasm/wasm/v1/query.ts index b11c8c8a16..ab59a357b7 100644 --- a/__fixtures__/v-next/outputhelperfunc/cosmwasm/wasm/v1/query.ts +++ b/__fixtures__/v-next/outputhelperfunc/cosmwasm/wasm/v1/query.ts @@ -4,7 +4,7 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; import { GlobalDecoderRegistry } from "../../../registry"; -import { toUtf8, fromUtf8 } from "@cosmjs/encoding"; +import { toUtf8, fromUtf8 } from "@interchainjs/encoding"; export const protobufPackage = "cosmwasm.wasm.v1"; /** * QueryContractInfoRequest is the request type for the Query/ContractInfo RPC diff --git a/__fixtures__/v-next/outputhelperfunc/cosmwasm/wasm/v1/tx.registry.ts b/__fixtures__/v-next/outputhelperfunc/cosmwasm/wasm/v1/tx.registry.ts index ef35709ada..d007f7e50d 100644 --- a/__fixtures__/v-next/outputhelperfunc/cosmwasm/wasm/v1/tx.registry.ts +++ b/__fixtures__/v-next/outputhelperfunc/cosmwasm/wasm/v1/tx.registry.ts @@ -1,14 +1,8 @@ import { AccessConfig, AccessConfigSDKType } from "./types"; import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { TelescopeGeneratedType } from "../../../types"; -import { Registry } from "@cosmjs/proto-signing"; import { MsgStoreCode, MsgStoreCodeSDKType, MsgInstantiateContract, MsgInstantiateContractSDKType, MsgExecuteContract, MsgExecuteContractSDKType, MsgMigrateContract, MsgMigrateContractSDKType, MsgUpdateAdmin, MsgUpdateAdminSDKType, MsgClearAdmin, MsgClearAdminSDKType } from "./tx"; export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/cosmwasm.wasm.v1.MsgStoreCode", MsgStoreCode], ["/cosmwasm.wasm.v1.MsgInstantiateContract", MsgInstantiateContract], ["/cosmwasm.wasm.v1.MsgExecuteContract", MsgExecuteContract], ["/cosmwasm.wasm.v1.MsgMigrateContract", MsgMigrateContract], ["/cosmwasm.wasm.v1.MsgUpdateAdmin", MsgUpdateAdmin], ["/cosmwasm.wasm.v1.MsgClearAdmin", MsgClearAdmin]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; export const MessageComposer = { encoded: { storeCode(value: MsgStoreCode) { diff --git a/__fixtures__/v-next/outputhelperfunc/cosmwasm/wasm/v1/tx.rpc.msg.ts b/__fixtures__/v-next/outputhelperfunc/cosmwasm/wasm/v1/tx.rpc.msg.ts index cbe39ed8e0..08fae77d18 100644 --- a/__fixtures__/v-next/outputhelperfunc/cosmwasm/wasm/v1/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputhelperfunc/cosmwasm/wasm/v1/tx.rpc.msg.ts @@ -1,6 +1,7 @@ import { AccessConfig, AccessConfigSDKType } from "./types"; import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; -import { DeliverTxResponse, StdFee, TxRpc } from "../../../types"; +import { DeliverTxResponse } from "@interchainjs/types"; +import { StdFee, TxRpc } from "../../../types"; import { BinaryReader } from "../../../binary"; import { MsgStoreCode, MsgStoreCodeSDKType, MsgStoreCodeResponse, MsgStoreCodeResponseSDKType, MsgInstantiateContract, MsgInstantiateContractSDKType, MsgInstantiateContractResponse, MsgInstantiateContractResponseSDKType, MsgExecuteContract, MsgExecuteContractSDKType, MsgExecuteContractResponse, MsgExecuteContractResponseSDKType, MsgMigrateContract, MsgMigrateContractSDKType, MsgMigrateContractResponse, MsgMigrateContractResponseSDKType, MsgUpdateAdmin, MsgUpdateAdminSDKType, MsgUpdateAdminResponse, MsgUpdateAdminResponseSDKType, MsgClearAdmin, MsgClearAdminSDKType, MsgClearAdminResponse, MsgClearAdminResponseSDKType } from "./tx"; /** Msg defines the wasm Msg service. */ diff --git a/__fixtures__/v-next/outputhelperfunc/cosmwasm/wasm/v1/tx.ts b/__fixtures__/v-next/outputhelperfunc/cosmwasm/wasm/v1/tx.ts index e1a78f3786..621b92bc11 100644 --- a/__fixtures__/v-next/outputhelperfunc/cosmwasm/wasm/v1/tx.ts +++ b/__fixtures__/v-next/outputhelperfunc/cosmwasm/wasm/v1/tx.ts @@ -4,7 +4,7 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; import { GlobalDecoderRegistry } from "../../../registry"; import { isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; -import { fromBase64, toBase64, toUtf8, fromUtf8 } from "@cosmjs/encoding"; +import { fromBase64, toBase64, toUtf8, fromUtf8 } from "@interchainjs/encoding"; export const protobufPackage = "cosmwasm.wasm.v1"; /** * MsgStoreCode submit Wasm code to the system diff --git a/__fixtures__/v-next/outputhelperfunc/cosmwasm/wasm/v1/types.ts b/__fixtures__/v-next/outputhelperfunc/cosmwasm/wasm/v1/types.ts index e2f19b7508..dc2a6e4dbc 100644 --- a/__fixtures__/v-next/outputhelperfunc/cosmwasm/wasm/v1/types.ts +++ b/__fixtures__/v-next/outputhelperfunc/cosmwasm/wasm/v1/types.ts @@ -3,7 +3,7 @@ import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../h import { BinaryReader, BinaryWriter } from "../../../binary"; import { JsonSafe } from "../../../json-safe"; import { GlobalDecoderRegistry } from "../../../registry"; -import { toUtf8, fromUtf8 } from "@cosmjs/encoding"; +import { toUtf8, fromUtf8 } from "@interchainjs/encoding"; export const protobufPackage = "cosmwasm.wasm.v1"; /** AccessType permission types */ export enum AccessType { diff --git a/__fixtures__/v-next/outputhelperfunc/evmos/client.ts b/__fixtures__/v-next/outputhelperfunc/evmos/client.ts index 5ca97be87a..00939937ce 100644 --- a/__fixtures__/v-next/outputhelperfunc/evmos/client.ts +++ b/__fixtures__/v-next/outputhelperfunc/evmos/client.ts @@ -2,7 +2,8 @@ import { GeneratedType, Registry, OfflineSigner } from "@cosmjs/proto-signing"; import { defaultRegistryTypes, AminoTypes, SigningStargateClient } from "@cosmjs/stargate"; import { HttpEndpoint } from "@cosmjs/tendermint-rpc"; import { createRpcClient } from "../extern"; -import { DeliverTxResponse, EncodeObject, StdFee, TxRpc, SigningClientParams } from "../types"; +import { DeliverTxResponse } from "@interchainjs/types"; +import { EncodeObject, StdFee, TxRpc, SigningClientParams } from "../types"; import * as evmosErc20V1TxRegistry from "./erc20/v1/tx.registry"; import * as evmosFeesV1TxRegistry from "./fees/v1/tx.registry"; import * as evmosVestingV1TxRegistry from "./vesting/v1/tx.registry"; diff --git a/__fixtures__/v-next/outputhelperfunc/evmos/erc20/v1/tx.registry.ts b/__fixtures__/v-next/outputhelperfunc/evmos/erc20/v1/tx.registry.ts index 5ce0bbbb1a..ee32b10c6c 100644 --- a/__fixtures__/v-next/outputhelperfunc/evmos/erc20/v1/tx.registry.ts +++ b/__fixtures__/v-next/outputhelperfunc/evmos/erc20/v1/tx.registry.ts @@ -1,13 +1,7 @@ import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { TelescopeGeneratedType } from "../../../types"; -import { Registry } from "@cosmjs/proto-signing"; import { MsgConvertCoin, MsgConvertCoinSDKType, MsgConvertERC20, MsgConvertERC20SDKType } from "./tx"; export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/evmos.erc20.v1.MsgConvertCoin", MsgConvertCoin], ["/evmos.erc20.v1.MsgConvertERC20", MsgConvertERC20]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; export const MessageComposer = { encoded: { convertCoin(value: MsgConvertCoin) { diff --git a/__fixtures__/v-next/outputhelperfunc/evmos/erc20/v1/tx.rpc.msg.ts b/__fixtures__/v-next/outputhelperfunc/evmos/erc20/v1/tx.rpc.msg.ts index 2e2b18fe29..fa861d72f1 100644 --- a/__fixtures__/v-next/outputhelperfunc/evmos/erc20/v1/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputhelperfunc/evmos/erc20/v1/tx.rpc.msg.ts @@ -1,5 +1,6 @@ import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; -import { DeliverTxResponse, StdFee, TxRpc } from "../../../types"; +import { DeliverTxResponse } from "@interchainjs/types"; +import { StdFee, TxRpc } from "../../../types"; import { BinaryReader } from "../../../binary"; import { MsgConvertCoin, MsgConvertCoinSDKType, MsgConvertCoinResponse, MsgConvertCoinResponseSDKType, MsgConvertERC20, MsgConvertERC20SDKType, MsgConvertERC20Response, MsgConvertERC20ResponseSDKType } from "./tx"; /** Msg defines the erc20 Msg service. */ diff --git a/__fixtures__/v-next/outputhelperfunc/evmos/fees/v1/genesis.ts b/__fixtures__/v-next/outputhelperfunc/evmos/fees/v1/genesis.ts index a5fb70c4c4..5dafee410b 100644 --- a/__fixtures__/v-next/outputhelperfunc/evmos/fees/v1/genesis.ts +++ b/__fixtures__/v-next/outputhelperfunc/evmos/fees/v1/genesis.ts @@ -3,7 +3,7 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; import { GlobalDecoderRegistry } from "../../../registry"; import { isSet, DeepPartial } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; -import { Decimal } from "@cosmjs/math"; +import { Decimal } from "@interchainjs/math"; export const protobufPackage = "evmos.fees.v1"; /** * GenesisState defines the module's genesis state. @@ -428,10 +428,10 @@ export const Params = { toAmino(message: Params): ParamsAmino { const obj: any = {}; obj.enable_fees = message.enableFees === false ? undefined : message.enableFees; - obj.developer_shares = message.developerShares === "" ? undefined : message.developerShares; - obj.validator_shares = message.validatorShares === "" ? undefined : message.validatorShares; + obj.developer_shares = message.developerShares === "" ? undefined : Decimal.fromUserInput(message.developerShares, 18).atomics; + obj.validator_shares = message.validatorShares === "" ? undefined : Decimal.fromUserInput(message.validatorShares, 18).atomics; obj.addr_derivation_cost_create = message.addrDerivationCostCreate !== BigInt(0) ? message.addrDerivationCostCreate?.toString() : undefined; - obj.min_gas_price = message.minGasPrice === "" ? undefined : message.minGasPrice; + obj.min_gas_price = message.minGasPrice === "" ? undefined : Decimal.fromUserInput(message.minGasPrice, 18).atomics; return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputhelperfunc/evmos/fees/v1/tx.registry.ts b/__fixtures__/v-next/outputhelperfunc/evmos/fees/v1/tx.registry.ts index 693d612f87..92fecb8eb3 100644 --- a/__fixtures__/v-next/outputhelperfunc/evmos/fees/v1/tx.registry.ts +++ b/__fixtures__/v-next/outputhelperfunc/evmos/fees/v1/tx.registry.ts @@ -1,12 +1,6 @@ import { TelescopeGeneratedType } from "../../../types"; -import { Registry } from "@cosmjs/proto-signing"; import { MsgRegisterDevFeeInfo, MsgRegisterDevFeeInfoSDKType, MsgCancelDevFeeInfo, MsgCancelDevFeeInfoSDKType, MsgUpdateDevFeeInfo, MsgUpdateDevFeeInfoSDKType } from "./tx"; export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/evmos.fees.v1.MsgRegisterDevFeeInfo", MsgRegisterDevFeeInfo], ["/evmos.fees.v1.MsgCancelDevFeeInfo", MsgCancelDevFeeInfo], ["/evmos.fees.v1.MsgUpdateDevFeeInfo", MsgUpdateDevFeeInfo]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; export const MessageComposer = { encoded: { registerDevFeeInfo(value: MsgRegisterDevFeeInfo) { diff --git a/__fixtures__/v-next/outputhelperfunc/evmos/fees/v1/tx.rpc.msg.ts b/__fixtures__/v-next/outputhelperfunc/evmos/fees/v1/tx.rpc.msg.ts index 6212638218..111e56f1f7 100644 --- a/__fixtures__/v-next/outputhelperfunc/evmos/fees/v1/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputhelperfunc/evmos/fees/v1/tx.rpc.msg.ts @@ -1,4 +1,5 @@ -import { DeliverTxResponse, StdFee, TxRpc } from "../../../types"; +import { DeliverTxResponse } from "@interchainjs/types"; +import { StdFee, TxRpc } from "../../../types"; import { BinaryReader } from "../../../binary"; import { MsgRegisterDevFeeInfo, MsgRegisterDevFeeInfoSDKType, MsgRegisterDevFeeInfoResponse, MsgRegisterDevFeeInfoResponseSDKType, MsgCancelDevFeeInfo, MsgCancelDevFeeInfoSDKType, MsgCancelDevFeeInfoResponse, MsgCancelDevFeeInfoResponseSDKType, MsgUpdateDevFeeInfo, MsgUpdateDevFeeInfoSDKType, MsgUpdateDevFeeInfoResponse, MsgUpdateDevFeeInfoResponseSDKType } from "./tx"; /** Msg defines the fees Msg service. */ diff --git a/__fixtures__/v-next/outputhelperfunc/evmos/incentives/v1/genesis.ts b/__fixtures__/v-next/outputhelperfunc/evmos/incentives/v1/genesis.ts index e626669e7b..a17d8d4fa8 100644 --- a/__fixtures__/v-next/outputhelperfunc/evmos/incentives/v1/genesis.ts +++ b/__fixtures__/v-next/outputhelperfunc/evmos/incentives/v1/genesis.ts @@ -3,7 +3,7 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; import { GlobalDecoderRegistry } from "../../../registry"; import { isSet, DeepPartial } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; -import { Decimal } from "@cosmjs/math"; +import { Decimal } from "@interchainjs/math"; export const protobufPackage = "evmos.incentives.v1"; /** * GenesisState defines the module's genesis state. @@ -432,9 +432,9 @@ export const Params = { toAmino(message: Params): ParamsAmino { const obj: any = {}; obj.enable_incentives = message.enableIncentives === false ? undefined : message.enableIncentives; - obj.allocation_limit = message.allocationLimit === "" ? undefined : message.allocationLimit; + obj.allocation_limit = message.allocationLimit === "" ? undefined : Decimal.fromUserInput(message.allocationLimit, 18).atomics; obj.incentives_epoch_identifier = message.incentivesEpochIdentifier === "" ? undefined : message.incentivesEpochIdentifier; - obj.reward_scaler = message.rewardScaler === "" ? undefined : message.rewardScaler; + obj.reward_scaler = message.rewardScaler === "" ? undefined : Decimal.fromUserInput(message.rewardScaler, 18).atomics; return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputhelperfunc/evmos/inflation/v1/inflation.ts b/__fixtures__/v-next/outputhelperfunc/evmos/inflation/v1/inflation.ts index e9b076422d..c175eae4fe 100644 --- a/__fixtures__/v-next/outputhelperfunc/evmos/inflation/v1/inflation.ts +++ b/__fixtures__/v-next/outputhelperfunc/evmos/inflation/v1/inflation.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { Decimal } from "@cosmjs/math"; +import { Decimal } from "@interchainjs/math"; import { isSet, DeepPartial } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "evmos.inflation.v1"; @@ -297,9 +297,9 @@ export const InflationDistribution = { }, toAmino(message: InflationDistribution): InflationDistributionAmino { const obj: any = {}; - obj.staking_rewards = message.stakingRewards === "" ? undefined : message.stakingRewards; - obj.usage_incentives = message.usageIncentives === "" ? undefined : message.usageIncentives; - obj.community_pool = message.communityPool === "" ? undefined : message.communityPool; + obj.staking_rewards = message.stakingRewards === "" ? undefined : Decimal.fromUserInput(message.stakingRewards, 18).atomics; + obj.usage_incentives = message.usageIncentives === "" ? undefined : Decimal.fromUserInput(message.usageIncentives, 18).atomics; + obj.community_pool = message.communityPool === "" ? undefined : Decimal.fromUserInput(message.communityPool, 18).atomics; return obj; }, fromAminoMsg(object: InflationDistributionAminoMsg): InflationDistribution { @@ -471,11 +471,11 @@ export const ExponentialCalculation = { }, toAmino(message: ExponentialCalculation): ExponentialCalculationAmino { const obj: any = {}; - obj.a = message.a === "" ? undefined : message.a; - obj.r = message.r === "" ? undefined : message.r; - obj.c = message.c === "" ? undefined : message.c; - obj.bonding_target = message.bondingTarget === "" ? undefined : message.bondingTarget; - obj.max_variance = message.maxVariance === "" ? undefined : message.maxVariance; + obj.a = message.a === "" ? undefined : Decimal.fromUserInput(message.a, 18).atomics; + obj.r = message.r === "" ? undefined : Decimal.fromUserInput(message.r, 18).atomics; + obj.c = message.c === "" ? undefined : Decimal.fromUserInput(message.c, 18).atomics; + obj.bonding_target = message.bondingTarget === "" ? undefined : Decimal.fromUserInput(message.bondingTarget, 18).atomics; + obj.max_variance = message.maxVariance === "" ? undefined : Decimal.fromUserInput(message.maxVariance, 18).atomics; return obj; }, fromAminoMsg(object: ExponentialCalculationAminoMsg): ExponentialCalculation { diff --git a/__fixtures__/v-next/outputhelperfunc/evmos/inflation/v1/query.ts b/__fixtures__/v-next/outputhelperfunc/evmos/inflation/v1/query.ts index 91d2db0212..795cf0fb88 100644 --- a/__fixtures__/v-next/outputhelperfunc/evmos/inflation/v1/query.ts +++ b/__fixtures__/v-next/outputhelperfunc/evmos/inflation/v1/query.ts @@ -4,7 +4,7 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; import { JsonSafe } from "../../../json-safe"; import { DeepPartial, isSet } from "../../../helpers"; import { GlobalDecoderRegistry } from "../../../registry"; -import { Decimal } from "@cosmjs/math"; +import { Decimal } from "@interchainjs/math"; export const protobufPackage = "evmos.inflation.v1"; /** * QueryPeriodRequest is the request type for the Query/Period RPC method. @@ -1396,7 +1396,7 @@ export const QueryInflationRateResponse = { }, toAmino(message: QueryInflationRateResponse): QueryInflationRateResponseAmino { const obj: any = {}; - obj.inflation_rate = message.inflationRate === "" ? undefined : message.inflationRate; + obj.inflation_rate = message.inflationRate === "" ? undefined : Decimal.fromUserInput(message.inflationRate, 18).atomics; return obj; }, fromAminoMsg(object: QueryInflationRateResponseAminoMsg): QueryInflationRateResponse { diff --git a/__fixtures__/v-next/outputhelperfunc/evmos/vesting/v1/tx.registry.ts b/__fixtures__/v-next/outputhelperfunc/evmos/vesting/v1/tx.registry.ts index c492681590..72ee678911 100644 --- a/__fixtures__/v-next/outputhelperfunc/evmos/vesting/v1/tx.registry.ts +++ b/__fixtures__/v-next/outputhelperfunc/evmos/vesting/v1/tx.registry.ts @@ -1,14 +1,8 @@ import { Timestamp, TimestampSDKType } from "../../../google/protobuf/timestamp"; import { Period, PeriodSDKType } from "../../../cosmos/vesting/v1beta1/vesting"; import { TelescopeGeneratedType } from "../../../types"; -import { Registry } from "@cosmjs/proto-signing"; import { MsgCreateClawbackVestingAccount, MsgCreateClawbackVestingAccountSDKType, MsgClawback, MsgClawbackSDKType } from "./tx"; export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/evmos.vesting.v1.MsgCreateClawbackVestingAccount", MsgCreateClawbackVestingAccount], ["/evmos.vesting.v1.MsgClawback", MsgClawback]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; export const MessageComposer = { encoded: { createClawbackVestingAccount(value: MsgCreateClawbackVestingAccount) { diff --git a/__fixtures__/v-next/outputhelperfunc/evmos/vesting/v1/tx.rpc.msg.ts b/__fixtures__/v-next/outputhelperfunc/evmos/vesting/v1/tx.rpc.msg.ts index ca743c1b22..ba7798f0a1 100644 --- a/__fixtures__/v-next/outputhelperfunc/evmos/vesting/v1/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputhelperfunc/evmos/vesting/v1/tx.rpc.msg.ts @@ -1,6 +1,7 @@ import { Timestamp, TimestampSDKType } from "../../../google/protobuf/timestamp"; import { Period, PeriodSDKType } from "../../../cosmos/vesting/v1beta1/vesting"; -import { DeliverTxResponse, StdFee, TxRpc } from "../../../types"; +import { DeliverTxResponse } from "@interchainjs/types"; +import { StdFee, TxRpc } from "../../../types"; import { BinaryReader } from "../../../binary"; import { MsgCreateClawbackVestingAccount, MsgCreateClawbackVestingAccountSDKType, MsgCreateClawbackVestingAccountResponse, MsgCreateClawbackVestingAccountResponseSDKType, MsgClawback, MsgClawbackSDKType, MsgClawbackResponse, MsgClawbackResponseSDKType } from "./tx"; /** Msg defines the vesting Msg service. */ diff --git a/__fixtures__/v-next/outputhelperfunc/ibc/applications/transfer/v1/tx.registry.ts b/__fixtures__/v-next/outputhelperfunc/ibc/applications/transfer/v1/tx.registry.ts index db06123510..416cef2847 100644 --- a/__fixtures__/v-next/outputhelperfunc/ibc/applications/transfer/v1/tx.registry.ts +++ b/__fixtures__/v-next/outputhelperfunc/ibc/applications/transfer/v1/tx.registry.ts @@ -1,14 +1,8 @@ import { Coin, CoinSDKType } from "../../../../cosmos/base/v1beta1/coin"; import { Height, HeightSDKType } from "../../../core/client/v1/client"; import { TelescopeGeneratedType } from "../../../../types"; -import { Registry } from "@cosmjs/proto-signing"; import { MsgTransfer, MsgTransferSDKType } from "./tx"; export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/ibc.applications.transfer.v1.MsgTransfer", MsgTransfer]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; export const MessageComposer = { encoded: { transfer(value: MsgTransfer) { diff --git a/__fixtures__/v-next/outputhelperfunc/ibc/applications/transfer/v1/tx.rpc.msg.ts b/__fixtures__/v-next/outputhelperfunc/ibc/applications/transfer/v1/tx.rpc.msg.ts index e99560ccc3..ef9b059c8d 100644 --- a/__fixtures__/v-next/outputhelperfunc/ibc/applications/transfer/v1/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputhelperfunc/ibc/applications/transfer/v1/tx.rpc.msg.ts @@ -1,6 +1,7 @@ import { Coin, CoinSDKType } from "../../../../cosmos/base/v1beta1/coin"; import { Height, HeightSDKType } from "../../../core/client/v1/client"; -import { DeliverTxResponse, StdFee, TxRpc } from "../../../../types"; +import { DeliverTxResponse } from "@interchainjs/types"; +import { StdFee, TxRpc } from "../../../../types"; import { BinaryReader } from "../../../../binary"; import { MsgTransfer, MsgTransferSDKType, MsgTransferResponse, MsgTransferResponseSDKType } from "./tx"; /** Msg defines the ibc/transfer Msg service. */ diff --git a/__fixtures__/v-next/outputhelperfunc/ibc/client.ts b/__fixtures__/v-next/outputhelperfunc/ibc/client.ts index ee1ad35bd7..e2216eb1ea 100644 --- a/__fixtures__/v-next/outputhelperfunc/ibc/client.ts +++ b/__fixtures__/v-next/outputhelperfunc/ibc/client.ts @@ -2,7 +2,8 @@ import { GeneratedType, Registry, OfflineSigner } from "@cosmjs/proto-signing"; import { defaultRegistryTypes, AminoTypes, SigningStargateClient } from "@cosmjs/stargate"; import { HttpEndpoint } from "@cosmjs/tendermint-rpc"; import { createRpcClient } from "../extern"; -import { DeliverTxResponse, EncodeObject, StdFee, TxRpc, SigningClientParams } from "../types"; +import { DeliverTxResponse } from "@interchainjs/types"; +import { EncodeObject, StdFee, TxRpc, SigningClientParams } from "../types"; import * as ibcApplicationsTransferV1TxRegistry from "./applications/transfer/v1/tx.registry"; import * as ibcCoreChannelV1TxRegistry from "./core/channel/v1/tx.registry"; import * as ibcCoreClientV1TxRegistry from "./core/client/v1/tx.registry"; diff --git a/__fixtures__/v-next/outputhelperfunc/ibc/core/channel/v1/tx.registry.ts b/__fixtures__/v-next/outputhelperfunc/ibc/core/channel/v1/tx.registry.ts index 7bafeaddee..e3505d4f12 100644 --- a/__fixtures__/v-next/outputhelperfunc/ibc/core/channel/v1/tx.registry.ts +++ b/__fixtures__/v-next/outputhelperfunc/ibc/core/channel/v1/tx.registry.ts @@ -1,14 +1,8 @@ import { Channel, ChannelSDKType, Packet, PacketSDKType } from "./channel"; import { Height, HeightSDKType } from "../../client/v1/client"; import { TelescopeGeneratedType } from "../../../../types"; -import { Registry } from "@cosmjs/proto-signing"; import { MsgChannelOpenInit, MsgChannelOpenInitSDKType, MsgChannelOpenTry, MsgChannelOpenTrySDKType, MsgChannelOpenAck, MsgChannelOpenAckSDKType, MsgChannelOpenConfirm, MsgChannelOpenConfirmSDKType, MsgChannelCloseInit, MsgChannelCloseInitSDKType, MsgChannelCloseConfirm, MsgChannelCloseConfirmSDKType, MsgRecvPacket, MsgRecvPacketSDKType, MsgTimeout, MsgTimeoutSDKType, MsgTimeoutOnClose, MsgTimeoutOnCloseSDKType, MsgAcknowledgement, MsgAcknowledgementSDKType } from "./tx"; export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/ibc.core.channel.v1.MsgChannelOpenInit", MsgChannelOpenInit], ["/ibc.core.channel.v1.MsgChannelOpenTry", MsgChannelOpenTry], ["/ibc.core.channel.v1.MsgChannelOpenAck", MsgChannelOpenAck], ["/ibc.core.channel.v1.MsgChannelOpenConfirm", MsgChannelOpenConfirm], ["/ibc.core.channel.v1.MsgChannelCloseInit", MsgChannelCloseInit], ["/ibc.core.channel.v1.MsgChannelCloseConfirm", MsgChannelCloseConfirm], ["/ibc.core.channel.v1.MsgRecvPacket", MsgRecvPacket], ["/ibc.core.channel.v1.MsgTimeout", MsgTimeout], ["/ibc.core.channel.v1.MsgTimeoutOnClose", MsgTimeoutOnClose], ["/ibc.core.channel.v1.MsgAcknowledgement", MsgAcknowledgement]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; export const MessageComposer = { encoded: { channelOpenInit(value: MsgChannelOpenInit) { diff --git a/__fixtures__/v-next/outputhelperfunc/ibc/core/channel/v1/tx.rpc.msg.ts b/__fixtures__/v-next/outputhelperfunc/ibc/core/channel/v1/tx.rpc.msg.ts index 7a259165cd..a364e8d37b 100644 --- a/__fixtures__/v-next/outputhelperfunc/ibc/core/channel/v1/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputhelperfunc/ibc/core/channel/v1/tx.rpc.msg.ts @@ -1,6 +1,7 @@ import { Channel, ChannelSDKType, Packet, PacketSDKType } from "./channel"; import { Height, HeightSDKType } from "../../client/v1/client"; -import { DeliverTxResponse, StdFee, TxRpc } from "../../../../types"; +import { DeliverTxResponse } from "@interchainjs/types"; +import { StdFee, TxRpc } from "../../../../types"; import { BinaryReader } from "../../../../binary"; import { MsgChannelOpenInit, MsgChannelOpenInitSDKType, MsgChannelOpenInitResponse, MsgChannelOpenInitResponseSDKType, MsgChannelOpenTry, MsgChannelOpenTrySDKType, MsgChannelOpenTryResponse, MsgChannelOpenTryResponseSDKType, MsgChannelOpenAck, MsgChannelOpenAckSDKType, MsgChannelOpenAckResponse, MsgChannelOpenAckResponseSDKType, MsgChannelOpenConfirm, MsgChannelOpenConfirmSDKType, MsgChannelOpenConfirmResponse, MsgChannelOpenConfirmResponseSDKType, MsgChannelCloseInit, MsgChannelCloseInitSDKType, MsgChannelCloseInitResponse, MsgChannelCloseInitResponseSDKType, MsgChannelCloseConfirm, MsgChannelCloseConfirmSDKType, MsgChannelCloseConfirmResponse, MsgChannelCloseConfirmResponseSDKType, MsgRecvPacket, MsgRecvPacketSDKType, MsgRecvPacketResponse, MsgRecvPacketResponseSDKType, MsgTimeout, MsgTimeoutSDKType, MsgTimeoutResponse, MsgTimeoutResponseSDKType, MsgTimeoutOnClose, MsgTimeoutOnCloseSDKType, MsgTimeoutOnCloseResponse, MsgTimeoutOnCloseResponseSDKType, MsgAcknowledgement, MsgAcknowledgementSDKType, MsgAcknowledgementResponse, MsgAcknowledgementResponseSDKType } from "./tx"; /** Msg defines the ibc/channel Msg service. */ diff --git a/__fixtures__/v-next/outputhelperfunc/ibc/core/client/v1/tx.registry.ts b/__fixtures__/v-next/outputhelperfunc/ibc/core/client/v1/tx.registry.ts index 46819c2c07..a054177d5d 100644 --- a/__fixtures__/v-next/outputhelperfunc/ibc/core/client/v1/tx.registry.ts +++ b/__fixtures__/v-next/outputhelperfunc/ibc/core/client/v1/tx.registry.ts @@ -1,13 +1,7 @@ import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../../google/protobuf/any"; import { TelescopeGeneratedType } from "../../../../types"; -import { Registry } from "@cosmjs/proto-signing"; import { MsgCreateClient, MsgCreateClientSDKType, MsgUpdateClient, MsgUpdateClientSDKType, MsgUpgradeClient, MsgUpgradeClientSDKType, MsgSubmitMisbehaviour, MsgSubmitMisbehaviourSDKType } from "./tx"; export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/ibc.core.client.v1.MsgCreateClient", MsgCreateClient], ["/ibc.core.client.v1.MsgUpdateClient", MsgUpdateClient], ["/ibc.core.client.v1.MsgUpgradeClient", MsgUpgradeClient], ["/ibc.core.client.v1.MsgSubmitMisbehaviour", MsgSubmitMisbehaviour]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; export const MessageComposer = { encoded: { createClient(value: MsgCreateClient) { diff --git a/__fixtures__/v-next/outputhelperfunc/ibc/core/client/v1/tx.rpc.msg.ts b/__fixtures__/v-next/outputhelperfunc/ibc/core/client/v1/tx.rpc.msg.ts index 7a8fa11af5..9ae17c2235 100644 --- a/__fixtures__/v-next/outputhelperfunc/ibc/core/client/v1/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputhelperfunc/ibc/core/client/v1/tx.rpc.msg.ts @@ -1,5 +1,6 @@ import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../../google/protobuf/any"; -import { DeliverTxResponse, StdFee, TxRpc } from "../../../../types"; +import { DeliverTxResponse } from "@interchainjs/types"; +import { StdFee, TxRpc } from "../../../../types"; import { BinaryReader } from "../../../../binary"; import { MsgCreateClient, MsgCreateClientSDKType, MsgCreateClientResponse, MsgCreateClientResponseSDKType, MsgUpdateClient, MsgUpdateClientSDKType, MsgUpdateClientResponse, MsgUpdateClientResponseSDKType, MsgUpgradeClient, MsgUpgradeClientSDKType, MsgUpgradeClientResponse, MsgUpgradeClientResponseSDKType, MsgSubmitMisbehaviour, MsgSubmitMisbehaviourSDKType, MsgSubmitMisbehaviourResponse, MsgSubmitMisbehaviourResponseSDKType } from "./tx"; /** Msg defines the ibc/client Msg service. */ diff --git a/__fixtures__/v-next/outputhelperfunc/ibc/core/connection/v1/tx.registry.ts b/__fixtures__/v-next/outputhelperfunc/ibc/core/connection/v1/tx.registry.ts index 77b5071211..1fba4f04ae 100644 --- a/__fixtures__/v-next/outputhelperfunc/ibc/core/connection/v1/tx.registry.ts +++ b/__fixtures__/v-next/outputhelperfunc/ibc/core/connection/v1/tx.registry.ts @@ -2,14 +2,8 @@ import { Counterparty, CounterpartySDKType, Version, VersionSDKType } from "./co import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../../google/protobuf/any"; import { Height, HeightSDKType } from "../../client/v1/client"; import { TelescopeGeneratedType } from "../../../../types"; -import { Registry } from "@cosmjs/proto-signing"; import { MsgConnectionOpenInit, MsgConnectionOpenInitSDKType, MsgConnectionOpenTry, MsgConnectionOpenTrySDKType, MsgConnectionOpenAck, MsgConnectionOpenAckSDKType, MsgConnectionOpenConfirm, MsgConnectionOpenConfirmSDKType } from "./tx"; export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/ibc.core.connection.v1.MsgConnectionOpenInit", MsgConnectionOpenInit], ["/ibc.core.connection.v1.MsgConnectionOpenTry", MsgConnectionOpenTry], ["/ibc.core.connection.v1.MsgConnectionOpenAck", MsgConnectionOpenAck], ["/ibc.core.connection.v1.MsgConnectionOpenConfirm", MsgConnectionOpenConfirm]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; export const MessageComposer = { encoded: { connectionOpenInit(value: MsgConnectionOpenInit) { diff --git a/__fixtures__/v-next/outputhelperfunc/ibc/core/connection/v1/tx.rpc.msg.ts b/__fixtures__/v-next/outputhelperfunc/ibc/core/connection/v1/tx.rpc.msg.ts index 523237355a..495d7a292c 100644 --- a/__fixtures__/v-next/outputhelperfunc/ibc/core/connection/v1/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputhelperfunc/ibc/core/connection/v1/tx.rpc.msg.ts @@ -1,7 +1,8 @@ import { Counterparty, CounterpartySDKType, Version, VersionSDKType } from "./connection"; import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../../google/protobuf/any"; import { Height, HeightSDKType } from "../../client/v1/client"; -import { DeliverTxResponse, StdFee, TxRpc } from "../../../../types"; +import { DeliverTxResponse } from "@interchainjs/types"; +import { StdFee, TxRpc } from "../../../../types"; import { BinaryReader } from "../../../../binary"; import { MsgConnectionOpenInit, MsgConnectionOpenInitSDKType, MsgConnectionOpenInitResponse, MsgConnectionOpenInitResponseSDKType, MsgConnectionOpenTry, MsgConnectionOpenTrySDKType, MsgConnectionOpenTryResponse, MsgConnectionOpenTryResponseSDKType, MsgConnectionOpenAck, MsgConnectionOpenAckSDKType, MsgConnectionOpenAckResponse, MsgConnectionOpenAckResponseSDKType, MsgConnectionOpenConfirm, MsgConnectionOpenConfirmSDKType, MsgConnectionOpenConfirmResponse, MsgConnectionOpenConfirmResponseSDKType } from "./tx"; /** Msg defines the ibc/connection Msg service. */ diff --git a/__fixtures__/v-next/outputhelperfunc/osmosis/client.ts b/__fixtures__/v-next/outputhelperfunc/osmosis/client.ts index 6a197c6618..c22e553a02 100644 --- a/__fixtures__/v-next/outputhelperfunc/osmosis/client.ts +++ b/__fixtures__/v-next/outputhelperfunc/osmosis/client.ts @@ -2,7 +2,8 @@ import { GeneratedType, Registry, OfflineSigner } from "@cosmjs/proto-signing"; import { defaultRegistryTypes, AminoTypes, SigningStargateClient } from "@cosmjs/stargate"; import { HttpEndpoint } from "@cosmjs/tendermint-rpc"; import { createRpcClient } from "../extern"; -import { DeliverTxResponse, EncodeObject, StdFee, TxRpc, SigningClientParams } from "../types"; +import { DeliverTxResponse } from "@interchainjs/types"; +import { EncodeObject, StdFee, TxRpc, SigningClientParams } from "../types"; import * as osmosisGammPoolmodelsBalancerTxTxRegistry from "./gamm/pool-models/balancer/tx/tx.registry"; import * as osmosisGammPoolmodelsStableswapTxRegistry from "./gamm/pool-models/stableswap/tx.registry"; import * as osmosisGammV1beta1TxRegistry from "./gamm/v1beta1/tx.registry"; diff --git a/__fixtures__/v-next/outputhelperfunc/osmosis/gamm/pool-models/balancer/balancerPool.ts b/__fixtures__/v-next/outputhelperfunc/osmosis/gamm/pool-models/balancer/balancerPool.ts index 3cc3603730..80322ed397 100644 --- a/__fixtures__/v-next/outputhelperfunc/osmosis/gamm/pool-models/balancer/balancerPool.ts +++ b/__fixtures__/v-next/outputhelperfunc/osmosis/gamm/pool-models/balancer/balancerPool.ts @@ -5,7 +5,7 @@ import { BinaryReader, BinaryWriter } from "../../../../binary"; import { toTimestamp, fromTimestamp, isSet, DeepPartial } from "../../../../helpers"; import { GlobalDecoderRegistry } from "../../../../registry"; import { JsonSafe } from "../../../../json-safe"; -import { Decimal } from "@cosmjs/math"; +import { Decimal } from "@interchainjs/math"; export const protobufPackage = "osmosis.gamm.v1beta1"; /** * Parameters for changing the weights in a balancer pool smoothly from @@ -649,8 +649,8 @@ export const PoolParams = { }, toAmino(message: PoolParams): PoolParamsAmino { const obj: any = {}; - obj.swap_fee = message.swapFee === "" ? undefined : message.swapFee; - obj.exit_fee = message.exitFee === "" ? undefined : message.exitFee; + obj.swap_fee = message.swapFee === "" ? undefined : Decimal.fromUserInput(message.swapFee, 18).atomics; + obj.exit_fee = message.exitFee === "" ? undefined : Decimal.fromUserInput(message.exitFee, 18).atomics; obj.smooth_weight_change_params = message.smoothWeightChangeParams ? SmoothWeightChangeParams.toAmino(message.smoothWeightChangeParams) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputhelperfunc/osmosis/gamm/pool-models/balancer/tx/tx.registry.ts b/__fixtures__/v-next/outputhelperfunc/osmosis/gamm/pool-models/balancer/tx/tx.registry.ts index 9e9fd33533..65088d4d18 100644 --- a/__fixtures__/v-next/outputhelperfunc/osmosis/gamm/pool-models/balancer/tx/tx.registry.ts +++ b/__fixtures__/v-next/outputhelperfunc/osmosis/gamm/pool-models/balancer/tx/tx.registry.ts @@ -1,13 +1,7 @@ import { PoolParams, PoolParamsSDKType, PoolAsset, PoolAssetSDKType } from "../balancerPool"; import { TelescopeGeneratedType } from "../../../../../types"; -import { Registry } from "@cosmjs/proto-signing"; import { MsgCreateBalancerPool, MsgCreateBalancerPoolSDKType } from "./tx"; export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/osmosis.gamm.poolmodels.balancer.v1beta1.MsgCreateBalancerPool", MsgCreateBalancerPool]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; export const MessageComposer = { encoded: { createBalancerPool(value: MsgCreateBalancerPool) { diff --git a/__fixtures__/v-next/outputhelperfunc/osmosis/gamm/pool-models/balancer/tx/tx.rpc.msg.ts b/__fixtures__/v-next/outputhelperfunc/osmosis/gamm/pool-models/balancer/tx/tx.rpc.msg.ts index ae3c79f6d8..fd89bb059e 100644 --- a/__fixtures__/v-next/outputhelperfunc/osmosis/gamm/pool-models/balancer/tx/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputhelperfunc/osmosis/gamm/pool-models/balancer/tx/tx.rpc.msg.ts @@ -1,5 +1,6 @@ import { PoolParams, PoolParamsSDKType, PoolAsset, PoolAssetSDKType } from "../balancerPool"; -import { DeliverTxResponse, StdFee, TxRpc } from "../../../../../types"; +import { DeliverTxResponse } from "@interchainjs/types"; +import { StdFee, TxRpc } from "../../../../../types"; import { BinaryReader } from "../../../../../binary"; import { MsgCreateBalancerPool, MsgCreateBalancerPoolSDKType, MsgCreateBalancerPoolResponse, MsgCreateBalancerPoolResponseSDKType } from "./tx"; export interface Msg { diff --git a/__fixtures__/v-next/outputhelperfunc/osmosis/gamm/pool-models/stableswap/stableswap_pool.ts b/__fixtures__/v-next/outputhelperfunc/osmosis/gamm/pool-models/stableswap/stableswap_pool.ts index 3b4cf10f1e..0720952197 100644 --- a/__fixtures__/v-next/outputhelperfunc/osmosis/gamm/pool-models/stableswap/stableswap_pool.ts +++ b/__fixtures__/v-next/outputhelperfunc/osmosis/gamm/pool-models/stableswap/stableswap_pool.ts @@ -1,6 +1,6 @@ import { Coin, CoinAmino, CoinSDKType } from "../../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { Decimal } from "@cosmjs/math"; +import { Decimal } from "@interchainjs/math"; import { isSet, DeepPartial } from "../../../../helpers"; import { JsonSafe } from "../../../../json-safe"; import { GlobalDecoderRegistry } from "../../../../registry"; @@ -258,8 +258,8 @@ export const PoolParams = { }, toAmino(message: PoolParams): PoolParamsAmino { const obj: any = {}; - obj.swap_fee = message.swapFee === "" ? undefined : message.swapFee; - obj.exit_fee = message.exitFee === "" ? undefined : message.exitFee; + obj.swap_fee = message.swapFee === "" ? undefined : Decimal.fromUserInput(message.swapFee, 18).atomics; + obj.exit_fee = message.exitFee === "" ? undefined : Decimal.fromUserInput(message.exitFee, 18).atomics; return obj; }, fromAminoMsg(object: PoolParamsAminoMsg): PoolParams { diff --git a/__fixtures__/v-next/outputhelperfunc/osmosis/gamm/pool-models/stableswap/tx.registry.ts b/__fixtures__/v-next/outputhelperfunc/osmosis/gamm/pool-models/stableswap/tx.registry.ts index b1431a4360..8543c53439 100644 --- a/__fixtures__/v-next/outputhelperfunc/osmosis/gamm/pool-models/stableswap/tx.registry.ts +++ b/__fixtures__/v-next/outputhelperfunc/osmosis/gamm/pool-models/stableswap/tx.registry.ts @@ -1,14 +1,8 @@ import { PoolParams, PoolParamsSDKType } from "./stableswap_pool"; import { Coin, CoinSDKType } from "../../../../cosmos/base/v1beta1/coin"; import { TelescopeGeneratedType } from "../../../../types"; -import { Registry } from "@cosmjs/proto-signing"; import { MsgCreateStableswapPool, MsgCreateStableswapPoolSDKType, MsgStableSwapAdjustScalingFactors, MsgStableSwapAdjustScalingFactorsSDKType } from "./tx"; export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/osmosis.gamm.poolmodels.stableswap.v1beta1.MsgCreateStableswapPool", MsgCreateStableswapPool], ["/osmosis.gamm.poolmodels.stableswap.v1beta1.MsgStableSwapAdjustScalingFactors", MsgStableSwapAdjustScalingFactors]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; export const MessageComposer = { encoded: { createStableswapPool(value: MsgCreateStableswapPool) { diff --git a/__fixtures__/v-next/outputhelperfunc/osmosis/gamm/pool-models/stableswap/tx.rpc.msg.ts b/__fixtures__/v-next/outputhelperfunc/osmosis/gamm/pool-models/stableswap/tx.rpc.msg.ts index 576692a9d9..da67ba3d6f 100644 --- a/__fixtures__/v-next/outputhelperfunc/osmosis/gamm/pool-models/stableswap/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputhelperfunc/osmosis/gamm/pool-models/stableswap/tx.rpc.msg.ts @@ -1,6 +1,7 @@ import { PoolParams, PoolParamsSDKType } from "./stableswap_pool"; import { Coin, CoinSDKType } from "../../../../cosmos/base/v1beta1/coin"; -import { DeliverTxResponse, StdFee, TxRpc } from "../../../../types"; +import { DeliverTxResponse } from "@interchainjs/types"; +import { StdFee, TxRpc } from "../../../../types"; import { BinaryReader } from "../../../../binary"; import { MsgCreateStableswapPool, MsgCreateStableswapPoolSDKType, MsgCreateStableswapPoolResponse, MsgCreateStableswapPoolResponseSDKType, MsgStableSwapAdjustScalingFactors, MsgStableSwapAdjustScalingFactorsSDKType, MsgStableSwapAdjustScalingFactorsResponse, MsgStableSwapAdjustScalingFactorsResponseSDKType } from "./tx"; export interface Msg { diff --git a/__fixtures__/v-next/outputhelperfunc/osmosis/gamm/v1beta1/tx.registry.ts b/__fixtures__/v-next/outputhelperfunc/osmosis/gamm/v1beta1/tx.registry.ts index d02c573e99..195d3096de 100644 --- a/__fixtures__/v-next/outputhelperfunc/osmosis/gamm/v1beta1/tx.registry.ts +++ b/__fixtures__/v-next/outputhelperfunc/osmosis/gamm/v1beta1/tx.registry.ts @@ -1,13 +1,7 @@ import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { TelescopeGeneratedType } from "../../../types"; -import { Registry } from "@cosmjs/proto-signing"; import { MsgJoinPool, MsgJoinPoolSDKType, MsgExitPool, MsgExitPoolSDKType, MsgSwapExactAmountIn, MsgSwapExactAmountInSDKType, MsgSwapExactAmountOut, MsgSwapExactAmountOutSDKType, MsgJoinSwapExternAmountIn, MsgJoinSwapExternAmountInSDKType, MsgJoinSwapShareAmountOut, MsgJoinSwapShareAmountOutSDKType, MsgExitSwapExternAmountOut, MsgExitSwapExternAmountOutSDKType, MsgExitSwapShareAmountIn, MsgExitSwapShareAmountInSDKType } from "./tx"; export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/osmosis.gamm.v1beta1.MsgJoinPool", MsgJoinPool], ["/osmosis.gamm.v1beta1.MsgExitPool", MsgExitPool], ["/osmosis.gamm.v1beta1.MsgSwapExactAmountIn", MsgSwapExactAmountIn], ["/osmosis.gamm.v1beta1.MsgSwapExactAmountOut", MsgSwapExactAmountOut], ["/osmosis.gamm.v1beta1.MsgJoinSwapExternAmountIn", MsgJoinSwapExternAmountIn], ["/osmosis.gamm.v1beta1.MsgJoinSwapShareAmountOut", MsgJoinSwapShareAmountOut], ["/osmosis.gamm.v1beta1.MsgExitSwapExternAmountOut", MsgExitSwapExternAmountOut], ["/osmosis.gamm.v1beta1.MsgExitSwapShareAmountIn", MsgExitSwapShareAmountIn]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; export const MessageComposer = { encoded: { joinPool(value: MsgJoinPool) { diff --git a/__fixtures__/v-next/outputhelperfunc/osmosis/gamm/v1beta1/tx.rpc.msg.ts b/__fixtures__/v-next/outputhelperfunc/osmosis/gamm/v1beta1/tx.rpc.msg.ts index b448deef11..d0ee4701a6 100644 --- a/__fixtures__/v-next/outputhelperfunc/osmosis/gamm/v1beta1/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputhelperfunc/osmosis/gamm/v1beta1/tx.rpc.msg.ts @@ -1,5 +1,6 @@ import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; -import { DeliverTxResponse, StdFee, TxRpc } from "../../../types"; +import { DeliverTxResponse } from "@interchainjs/types"; +import { StdFee, TxRpc } from "../../../types"; import { BinaryReader } from "../../../binary"; import { MsgJoinPool, MsgJoinPoolSDKType, MsgJoinPoolResponse, MsgJoinPoolResponseSDKType, MsgExitPool, MsgExitPoolSDKType, MsgExitPoolResponse, MsgExitPoolResponseSDKType, MsgSwapExactAmountIn, MsgSwapExactAmountInSDKType, MsgSwapExactAmountInResponse, MsgSwapExactAmountInResponseSDKType, MsgSwapExactAmountOut, MsgSwapExactAmountOutSDKType, MsgSwapExactAmountOutResponse, MsgSwapExactAmountOutResponseSDKType, MsgJoinSwapExternAmountIn, MsgJoinSwapExternAmountInSDKType, MsgJoinSwapExternAmountInResponse, MsgJoinSwapExternAmountInResponseSDKType, MsgJoinSwapShareAmountOut, MsgJoinSwapShareAmountOutSDKType, MsgJoinSwapShareAmountOutResponse, MsgJoinSwapShareAmountOutResponseSDKType, MsgExitSwapExternAmountOut, MsgExitSwapExternAmountOutSDKType, MsgExitSwapExternAmountOutResponse, MsgExitSwapExternAmountOutResponseSDKType, MsgExitSwapShareAmountIn, MsgExitSwapShareAmountInSDKType, MsgExitSwapShareAmountInResponse, MsgExitSwapShareAmountInResponseSDKType } from "./tx"; export interface Msg { diff --git a/__fixtures__/v-next/outputhelperfunc/osmosis/incentives/tx.registry.ts b/__fixtures__/v-next/outputhelperfunc/osmosis/incentives/tx.registry.ts index b8e6dccb0c..a96c6bbf24 100644 --- a/__fixtures__/v-next/outputhelperfunc/osmosis/incentives/tx.registry.ts +++ b/__fixtures__/v-next/outputhelperfunc/osmosis/incentives/tx.registry.ts @@ -2,14 +2,8 @@ import { QueryCondition, QueryConditionSDKType } from "../lockup/lock"; import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; import { Timestamp, TimestampSDKType } from "../../google/protobuf/timestamp"; import { TelescopeGeneratedType } from "../../types"; -import { Registry } from "@cosmjs/proto-signing"; import { MsgCreateGauge, MsgCreateGaugeSDKType, MsgAddToGauge, MsgAddToGaugeSDKType } from "./tx"; export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/osmosis.incentives.MsgCreateGauge", MsgCreateGauge], ["/osmosis.incentives.MsgAddToGauge", MsgAddToGauge]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; export const MessageComposer = { encoded: { createGauge(value: MsgCreateGauge) { diff --git a/__fixtures__/v-next/outputhelperfunc/osmosis/incentives/tx.rpc.msg.ts b/__fixtures__/v-next/outputhelperfunc/osmosis/incentives/tx.rpc.msg.ts index f068728075..2cf68d87dd 100644 --- a/__fixtures__/v-next/outputhelperfunc/osmosis/incentives/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputhelperfunc/osmosis/incentives/tx.rpc.msg.ts @@ -1,7 +1,8 @@ import { QueryCondition, QueryConditionSDKType } from "../lockup/lock"; import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; import { Timestamp, TimestampSDKType } from "../../google/protobuf/timestamp"; -import { DeliverTxResponse, StdFee, TxRpc } from "../../types"; +import { DeliverTxResponse } from "@interchainjs/types"; +import { StdFee, TxRpc } from "../../types"; import { BinaryReader } from "../../binary"; import { MsgCreateGauge, MsgCreateGaugeSDKType, MsgCreateGaugeResponse, MsgCreateGaugeResponseSDKType, MsgAddToGauge, MsgAddToGaugeSDKType, MsgAddToGaugeResponse, MsgAddToGaugeResponseSDKType } from "./tx"; export interface Msg { diff --git a/__fixtures__/v-next/outputhelperfunc/osmosis/lockup/tx.registry.ts b/__fixtures__/v-next/outputhelperfunc/osmosis/lockup/tx.registry.ts index e50a79800e..a4a8fde8f7 100644 --- a/__fixtures__/v-next/outputhelperfunc/osmosis/lockup/tx.registry.ts +++ b/__fixtures__/v-next/outputhelperfunc/osmosis/lockup/tx.registry.ts @@ -2,14 +2,8 @@ import { Duration, DurationSDKType } from "../../google/protobuf/duration"; import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; import { PeriodLock, PeriodLockSDKType } from "./lock"; import { TelescopeGeneratedType } from "../../types"; -import { Registry } from "@cosmjs/proto-signing"; import { MsgLockTokens, MsgLockTokensSDKType, MsgBeginUnlockingAll, MsgBeginUnlockingAllSDKType, MsgBeginUnlocking, MsgBeginUnlockingSDKType, MsgExtendLockup, MsgExtendLockupSDKType, MsgForceUnlock, MsgForceUnlockSDKType } from "./tx"; export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/osmosis.lockup.MsgLockTokens", MsgLockTokens], ["/osmosis.lockup.MsgBeginUnlockingAll", MsgBeginUnlockingAll], ["/osmosis.lockup.MsgBeginUnlocking", MsgBeginUnlocking], ["/osmosis.lockup.MsgExtendLockup", MsgExtendLockup], ["/osmosis.lockup.MsgForceUnlock", MsgForceUnlock]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; export const MessageComposer = { encoded: { lockTokens(value: MsgLockTokens) { diff --git a/__fixtures__/v-next/outputhelperfunc/osmosis/lockup/tx.rpc.msg.ts b/__fixtures__/v-next/outputhelperfunc/osmosis/lockup/tx.rpc.msg.ts index a083e7f65d..37550310f4 100644 --- a/__fixtures__/v-next/outputhelperfunc/osmosis/lockup/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputhelperfunc/osmosis/lockup/tx.rpc.msg.ts @@ -1,7 +1,8 @@ import { Duration, DurationSDKType } from "../../google/protobuf/duration"; import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; import { PeriodLock, PeriodLockSDKType } from "./lock"; -import { DeliverTxResponse, StdFee, TxRpc } from "../../types"; +import { DeliverTxResponse } from "@interchainjs/types"; +import { StdFee, TxRpc } from "../../types"; import { BinaryReader } from "../../binary"; import { MsgLockTokens, MsgLockTokensSDKType, MsgLockTokensResponse, MsgLockTokensResponseSDKType, MsgBeginUnlockingAll, MsgBeginUnlockingAllSDKType, MsgBeginUnlockingAllResponse, MsgBeginUnlockingAllResponseSDKType, MsgBeginUnlocking, MsgBeginUnlockingSDKType, MsgBeginUnlockingResponse, MsgBeginUnlockingResponseSDKType, MsgExtendLockup, MsgExtendLockupSDKType, MsgExtendLockupResponse, MsgExtendLockupResponseSDKType, MsgForceUnlock, MsgForceUnlockSDKType, MsgForceUnlockResponse, MsgForceUnlockResponseSDKType } from "./tx"; /** Msg defines the Msg service. */ diff --git a/__fixtures__/v-next/outputhelperfunc/osmosis/mint/v1beta1/mint.ts b/__fixtures__/v-next/outputhelperfunc/osmosis/mint/v1beta1/mint.ts index f1e2b6f459..2f2a56b0ff 100644 --- a/__fixtures__/v-next/outputhelperfunc/osmosis/mint/v1beta1/mint.ts +++ b/__fixtures__/v-next/outputhelperfunc/osmosis/mint/v1beta1/mint.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { Decimal } from "@cosmjs/math"; +import { Decimal } from "@interchainjs/math"; import { isSet, DeepPartial } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; import { GlobalDecoderRegistry } from "../../../registry"; @@ -376,7 +376,7 @@ export const Minter = { }, toAmino(message: Minter): MinterAmino { const obj: any = {}; - obj.epoch_provisions = message.epochProvisions === "" ? undefined : message.epochProvisions; + obj.epoch_provisions = message.epochProvisions === "" ? undefined : Decimal.fromUserInput(message.epochProvisions, 18).atomics; return obj; }, fromAminoMsg(object: MinterAminoMsg): Minter { @@ -506,7 +506,7 @@ export const WeightedAddress = { toAmino(message: WeightedAddress): WeightedAddressAmino { const obj: any = {}; obj.address = message.address === "" ? undefined : message.address; - obj.weight = message.weight === "" ? undefined : message.weight; + obj.weight = message.weight === "" ? undefined : Decimal.fromUserInput(message.weight, 18).atomics; return obj; }, fromAminoMsg(object: WeightedAddressAminoMsg): WeightedAddress { @@ -667,10 +667,10 @@ export const DistributionProportions = { }, toAmino(message: DistributionProportions): DistributionProportionsAmino { const obj: any = {}; - obj.staking = message.staking === "" ? undefined : message.staking; - obj.pool_incentives = message.poolIncentives === "" ? undefined : message.poolIncentives; - obj.developer_rewards = message.developerRewards === "" ? undefined : message.developerRewards; - obj.community_pool = message.communityPool === "" ? undefined : message.communityPool; + obj.staking = message.staking === "" ? undefined : Decimal.fromUserInput(message.staking, 18).atomics; + obj.pool_incentives = message.poolIncentives === "" ? undefined : Decimal.fromUserInput(message.poolIncentives, 18).atomics; + obj.developer_rewards = message.developerRewards === "" ? undefined : Decimal.fromUserInput(message.developerRewards, 18).atomics; + obj.community_pool = message.communityPool === "" ? undefined : Decimal.fromUserInput(message.communityPool, 18).atomics; return obj; }, fromAminoMsg(object: DistributionProportionsAminoMsg): DistributionProportions { @@ -906,10 +906,10 @@ export const Params = { toAmino(message: Params): ParamsAmino { const obj: any = {}; obj.mint_denom = message.mintDenom === "" ? undefined : message.mintDenom; - obj.genesis_epoch_provisions = message.genesisEpochProvisions === "" ? undefined : message.genesisEpochProvisions; + obj.genesis_epoch_provisions = message.genesisEpochProvisions === "" ? undefined : Decimal.fromUserInput(message.genesisEpochProvisions, 18).atomics; obj.epoch_identifier = message.epochIdentifier === "" ? undefined : message.epochIdentifier; obj.reduction_period_in_epochs = message.reductionPeriodInEpochs !== BigInt(0) ? message.reductionPeriodInEpochs?.toString() : undefined; - obj.reduction_factor = message.reductionFactor === "" ? undefined : message.reductionFactor; + obj.reduction_factor = message.reductionFactor === "" ? undefined : Decimal.fromUserInput(message.reductionFactor, 18).atomics; obj.distribution_proportions = message.distributionProportions ? DistributionProportions.toAmino(message.distributionProportions) : undefined; if (message.weightedDeveloperRewardsReceivers) { obj.weighted_developer_rewards_receivers = message.weightedDeveloperRewardsReceivers.map(e => e ? WeightedAddress.toAmino(e) : undefined); diff --git a/__fixtures__/v-next/outputhelperfunc/osmosis/superfluid/params.ts b/__fixtures__/v-next/outputhelperfunc/osmosis/superfluid/params.ts index 9400bbb49b..515a572fc8 100644 --- a/__fixtures__/v-next/outputhelperfunc/osmosis/superfluid/params.ts +++ b/__fixtures__/v-next/outputhelperfunc/osmosis/superfluid/params.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { Decimal } from "@cosmjs/math"; +import { Decimal } from "@interchainjs/math"; import { isSet, DeepPartial } from "../../helpers"; import { JsonSafe } from "../../json-safe"; export const protobufPackage = "osmosis.superfluid"; @@ -135,7 +135,7 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.minimum_risk_factor = message.minimumRiskFactor === "" ? undefined : message.minimumRiskFactor; + obj.minimum_risk_factor = message.minimumRiskFactor === "" ? undefined : Decimal.fromUserInput(message.minimumRiskFactor, 18).atomics; return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputhelperfunc/osmosis/superfluid/superfluid.ts b/__fixtures__/v-next/outputhelperfunc/osmosis/superfluid/superfluid.ts index 949908f392..4426cc39e6 100644 --- a/__fixtures__/v-next/outputhelperfunc/osmosis/superfluid/superfluid.ts +++ b/__fixtures__/v-next/outputhelperfunc/osmosis/superfluid/superfluid.ts @@ -2,7 +2,7 @@ import { Coin, CoinAmino, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; import { isSet, DeepPartial } from "../../helpers"; import { BinaryReader, BinaryWriter } from "../../binary"; import { JsonSafe } from "../../json-safe"; -import { Decimal } from "@cosmjs/math"; +import { Decimal } from "@interchainjs/math"; import { GlobalDecoderRegistry } from "../../registry"; export const protobufPackage = "osmosis.superfluid"; /** @@ -738,7 +738,7 @@ export const OsmoEquivalentMultiplierRecord = { const obj: any = {}; obj.epoch_number = message.epochNumber !== BigInt(0) ? message.epochNumber?.toString() : undefined; obj.denom = message.denom === "" ? undefined : message.denom; - obj.multiplier = message.multiplier === "" ? undefined : message.multiplier; + obj.multiplier = message.multiplier === "" ? undefined : Decimal.fromUserInput(message.multiplier, 18).atomics; return obj; }, fromAminoMsg(object: OsmoEquivalentMultiplierRecordAminoMsg): OsmoEquivalentMultiplierRecord { diff --git a/__fixtures__/v-next/outputhelperfunc/osmosis/superfluid/tx.registry.ts b/__fixtures__/v-next/outputhelperfunc/osmosis/superfluid/tx.registry.ts index 84fb34a557..c4015fa902 100644 --- a/__fixtures__/v-next/outputhelperfunc/osmosis/superfluid/tx.registry.ts +++ b/__fixtures__/v-next/outputhelperfunc/osmosis/superfluid/tx.registry.ts @@ -1,13 +1,7 @@ import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; import { TelescopeGeneratedType } from "../../types"; -import { Registry } from "@cosmjs/proto-signing"; import { MsgSuperfluidDelegate, MsgSuperfluidDelegateSDKType, MsgSuperfluidUndelegate, MsgSuperfluidUndelegateSDKType, MsgSuperfluidUnbondLock, MsgSuperfluidUnbondLockSDKType, MsgLockAndSuperfluidDelegate, MsgLockAndSuperfluidDelegateSDKType, MsgUnPoolWhitelistedPool, MsgUnPoolWhitelistedPoolSDKType } from "./tx"; export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/osmosis.superfluid.MsgSuperfluidDelegate", MsgSuperfluidDelegate], ["/osmosis.superfluid.MsgSuperfluidUndelegate", MsgSuperfluidUndelegate], ["/osmosis.superfluid.MsgSuperfluidUnbondLock", MsgSuperfluidUnbondLock], ["/osmosis.superfluid.MsgLockAndSuperfluidDelegate", MsgLockAndSuperfluidDelegate], ["/osmosis.superfluid.MsgUnPoolWhitelistedPool", MsgUnPoolWhitelistedPool]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; export const MessageComposer = { encoded: { superfluidDelegate(value: MsgSuperfluidDelegate) { diff --git a/__fixtures__/v-next/outputhelperfunc/osmosis/superfluid/tx.rpc.msg.ts b/__fixtures__/v-next/outputhelperfunc/osmosis/superfluid/tx.rpc.msg.ts index 6fe92949cd..0eb5cd63fa 100644 --- a/__fixtures__/v-next/outputhelperfunc/osmosis/superfluid/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputhelperfunc/osmosis/superfluid/tx.rpc.msg.ts @@ -1,5 +1,6 @@ import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; -import { DeliverTxResponse, StdFee, TxRpc } from "../../types"; +import { DeliverTxResponse } from "@interchainjs/types"; +import { StdFee, TxRpc } from "../../types"; import { BinaryReader } from "../../binary"; import { MsgSuperfluidDelegate, MsgSuperfluidDelegateSDKType, MsgSuperfluidDelegateResponse, MsgSuperfluidDelegateResponseSDKType, MsgSuperfluidUndelegate, MsgSuperfluidUndelegateSDKType, MsgSuperfluidUndelegateResponse, MsgSuperfluidUndelegateResponseSDKType, MsgSuperfluidUnbondLock, MsgSuperfluidUnbondLockSDKType, MsgSuperfluidUnbondLockResponse, MsgSuperfluidUnbondLockResponseSDKType, MsgLockAndSuperfluidDelegate, MsgLockAndSuperfluidDelegateSDKType, MsgLockAndSuperfluidDelegateResponse, MsgLockAndSuperfluidDelegateResponseSDKType, MsgUnPoolWhitelistedPool, MsgUnPoolWhitelistedPoolSDKType, MsgUnPoolWhitelistedPoolResponse, MsgUnPoolWhitelistedPoolResponseSDKType } from "./tx"; /** Msg defines the Msg service. */ diff --git a/__fixtures__/v-next/outputhelperfunc/osmosis/tokenfactory/v1beta1/tx.registry.ts b/__fixtures__/v-next/outputhelperfunc/osmosis/tokenfactory/v1beta1/tx.registry.ts index 05d351e3c4..15491bcdc3 100644 --- a/__fixtures__/v-next/outputhelperfunc/osmosis/tokenfactory/v1beta1/tx.registry.ts +++ b/__fixtures__/v-next/outputhelperfunc/osmosis/tokenfactory/v1beta1/tx.registry.ts @@ -1,14 +1,8 @@ import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { Metadata, MetadataSDKType } from "../../../cosmos/bank/v1beta1/bank"; import { TelescopeGeneratedType } from "../../../types"; -import { Registry } from "@cosmjs/proto-signing"; import { MsgCreateDenom, MsgCreateDenomSDKType, MsgMint, MsgMintSDKType, MsgBurn, MsgBurnSDKType, MsgChangeAdmin, MsgChangeAdminSDKType, MsgSetDenomMetadata, MsgSetDenomMetadataSDKType } from "./tx"; export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/osmosis.tokenfactory.v1beta1.MsgCreateDenom", MsgCreateDenom], ["/osmosis.tokenfactory.v1beta1.MsgMint", MsgMint], ["/osmosis.tokenfactory.v1beta1.MsgBurn", MsgBurn], ["/osmosis.tokenfactory.v1beta1.MsgChangeAdmin", MsgChangeAdmin], ["/osmosis.tokenfactory.v1beta1.MsgSetDenomMetadata", MsgSetDenomMetadata]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; export const MessageComposer = { encoded: { createDenom(value: MsgCreateDenom) { diff --git a/__fixtures__/v-next/outputhelperfunc/osmosis/tokenfactory/v1beta1/tx.rpc.msg.ts b/__fixtures__/v-next/outputhelperfunc/osmosis/tokenfactory/v1beta1/tx.rpc.msg.ts index 700a3fbc45..7a0042297c 100644 --- a/__fixtures__/v-next/outputhelperfunc/osmosis/tokenfactory/v1beta1/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputhelperfunc/osmosis/tokenfactory/v1beta1/tx.rpc.msg.ts @@ -1,6 +1,7 @@ import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { Metadata, MetadataSDKType } from "../../../cosmos/bank/v1beta1/bank"; -import { DeliverTxResponse, StdFee, TxRpc } from "../../../types"; +import { DeliverTxResponse } from "@interchainjs/types"; +import { StdFee, TxRpc } from "../../../types"; import { BinaryReader } from "../../../binary"; import { MsgCreateDenom, MsgCreateDenomSDKType, MsgCreateDenomResponse, MsgCreateDenomResponseSDKType, MsgMint, MsgMintSDKType, MsgMintResponse, MsgMintResponseSDKType, MsgBurn, MsgBurnSDKType, MsgBurnResponse, MsgBurnResponseSDKType, MsgChangeAdmin, MsgChangeAdminSDKType, MsgChangeAdminResponse, MsgChangeAdminResponseSDKType, MsgSetDenomMetadata, MsgSetDenomMetadataSDKType, MsgSetDenomMetadataResponse, MsgSetDenomMetadataResponseSDKType } from "./tx"; /** Msg defines the tokefactory module's gRPC message service. */ diff --git a/__fixtures__/v-next/outputhelperfunc/osmosis/twap/v1beta1/query.ts b/__fixtures__/v-next/outputhelperfunc/osmosis/twap/v1beta1/query.ts index 5c1cbdeef0..1cddc15d17 100644 --- a/__fixtures__/v-next/outputhelperfunc/osmosis/twap/v1beta1/query.ts +++ b/__fixtures__/v-next/outputhelperfunc/osmosis/twap/v1beta1/query.ts @@ -3,7 +3,7 @@ import { Params, ParamsAmino, ParamsSDKType } from "./genesis"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { toTimestamp, fromTimestamp, isSet, DeepPartial } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; -import { Decimal } from "@cosmjs/math"; +import { Decimal } from "@interchainjs/math"; import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "osmosis.twap.v1beta1"; /** @@ -477,7 +477,7 @@ export const ArithmeticTwapResponse = { }, toAmino(message: ArithmeticTwapResponse): ArithmeticTwapResponseAmino { const obj: any = {}; - obj.arithmetic_twap = message.arithmeticTwap === "" ? undefined : message.arithmeticTwap; + obj.arithmetic_twap = message.arithmeticTwap === "" ? undefined : Decimal.fromUserInput(message.arithmeticTwap, 18).atomics; return obj; }, fromAminoMsg(object: ArithmeticTwapResponseAminoMsg): ArithmeticTwapResponse { @@ -750,7 +750,7 @@ export const ArithmeticTwapToNowResponse = { }, toAmino(message: ArithmeticTwapToNowResponse): ArithmeticTwapToNowResponseAmino { const obj: any = {}; - obj.arithmetic_twap = message.arithmeticTwap === "" ? undefined : message.arithmeticTwap; + obj.arithmetic_twap = message.arithmeticTwap === "" ? undefined : Decimal.fromUserInput(message.arithmeticTwap, 18).atomics; return obj; }, fromAminoMsg(object: ArithmeticTwapToNowResponseAminoMsg): ArithmeticTwapToNowResponse { diff --git a/__fixtures__/v-next/outputhelperfunc/osmosis/twap/v1beta1/twap_record.ts b/__fixtures__/v-next/outputhelperfunc/osmosis/twap/v1beta1/twap_record.ts index 1acb411578..866aa4b7d3 100644 --- a/__fixtures__/v-next/outputhelperfunc/osmosis/twap/v1beta1/twap_record.ts +++ b/__fixtures__/v-next/outputhelperfunc/osmosis/twap/v1beta1/twap_record.ts @@ -1,7 +1,7 @@ import { Timestamp, TimestampAmino, TimestampSDKType } from "../../../google/protobuf/timestamp"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { toTimestamp, fromTimestamp, isSet, DeepPartial } from "../../../helpers"; -import { Decimal } from "@cosmjs/math"; +import { Decimal } from "@interchainjs/math"; import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "osmosis.twap.v1beta1"; /** @@ -372,10 +372,10 @@ export const TwapRecord = { obj.asset1_denom = message.asset1Denom === "" ? undefined : message.asset1Denom; obj.height = message.height ? message.height?.toString() : "0"; obj.time = message.time ? Timestamp.toAmino(toTimestamp(message.time)) : undefined; - obj.p0_last_spot_price = message.p0LastSpotPrice === "" ? undefined : message.p0LastSpotPrice; - obj.p1_last_spot_price = message.p1LastSpotPrice === "" ? undefined : message.p1LastSpotPrice; - obj.p0_arithmetic_twap_accumulator = message.p0ArithmeticTwapAccumulator === "" ? undefined : message.p0ArithmeticTwapAccumulator; - obj.p1_arithmetic_twap_accumulator = message.p1ArithmeticTwapAccumulator === "" ? undefined : message.p1ArithmeticTwapAccumulator; + obj.p0_last_spot_price = message.p0LastSpotPrice === "" ? undefined : Decimal.fromUserInput(message.p0LastSpotPrice, 18).atomics; + obj.p1_last_spot_price = message.p1LastSpotPrice === "" ? undefined : Decimal.fromUserInput(message.p1LastSpotPrice, 18).atomics; + obj.p0_arithmetic_twap_accumulator = message.p0ArithmeticTwapAccumulator === "" ? undefined : Decimal.fromUserInput(message.p0ArithmeticTwapAccumulator, 18).atomics; + obj.p1_arithmetic_twap_accumulator = message.p1ArithmeticTwapAccumulator === "" ? undefined : Decimal.fromUserInput(message.p1ArithmeticTwapAccumulator, 18).atomics; obj.last_error_time = message.lastErrorTime ? Timestamp.toAmino(toTimestamp(message.lastErrorTime)) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputhelperfunc/osmosis/txfees/v1beta1/query.ts b/__fixtures__/v-next/outputhelperfunc/osmosis/txfees/v1beta1/query.ts index d8170db950..ffa19efce6 100644 --- a/__fixtures__/v-next/outputhelperfunc/osmosis/txfees/v1beta1/query.ts +++ b/__fixtures__/v-next/outputhelperfunc/osmosis/txfees/v1beta1/query.ts @@ -3,7 +3,7 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; import { JsonSafe } from "../../../json-safe"; import { DeepPartial, isSet } from "../../../helpers"; import { GlobalDecoderRegistry } from "../../../registry"; -import { Decimal } from "@cosmjs/math"; +import { Decimal } from "@interchainjs/math"; export const protobufPackage = "osmosis.txfees.v1beta1"; /** * @name QueryFeeTokensRequest @@ -696,7 +696,7 @@ export const QueryDenomSpotPriceResponse = { toAmino(message: QueryDenomSpotPriceResponse): QueryDenomSpotPriceResponseAmino { const obj: any = {}; obj.poolID = message.poolID !== BigInt(0) ? message.poolID?.toString() : undefined; - obj.spot_price = message.spotPrice === "" ? undefined : message.spotPrice; + obj.spot_price = message.spotPrice === "" ? undefined : Decimal.fromUserInput(message.spotPrice, 18).atomics; return obj; }, fromAminoMsg(object: QueryDenomSpotPriceResponseAminoMsg): QueryDenomSpotPriceResponse { diff --git a/__fixtures__/v-next/outputhelperfunc/react-query.ts b/__fixtures__/v-next/outputhelperfunc/react-query.ts index b37187d253..a4b147432e 100644 --- a/__fixtures__/v-next/outputhelperfunc/react-query.ts +++ b/__fixtures__/v-next/outputhelperfunc/react-query.ts @@ -5,22 +5,20 @@ */ - - -import { getRpcClient } from './extern' + import { getRpcClient } from './extern' import { isRpc, Rpc, } from './helpers' - import { - StdFee, - DeliverTxResponse, -} from './types' import { ITxArgs, EndpointOrRpc, } from './helper-func-types' import { ISigningClient, isISigningClient } from "@interchainjs/cosmos/types/signing-client"; +import { + StdFee, + DeliverTxResponse, +} from './types' import { useQuery, useQueryClient, @@ -30,8 +28,8 @@ import { QueryKey, } from '@tanstack/react-query'; -import { HttpEndpoint, ProtobufRpcClient } from '@cosmjs/stargate'; -import { CometClient, connectComet, Tendermint34Client, Tendermint37Client } from '@cosmjs/tendermint-rpc'; +import { HttpEndpoint } from "@interchainjs/types"; +import { Rpc as ProtobufRpcClient } from "./helpers"; export const DEFAULT_RPC_CLIENT_QUERY_KEY = 'rpcClient'; export const DEFAULT_RPC_ENDPOINT_QUERY_KEY = 'rpcEndPoint'; @@ -54,6 +52,7 @@ export interface UseRpcClientQuery extends ReactQueryParams extends ReactQueryParams { getter: () => Promise; rpcEndPointKey?: string; @@ -97,36 +96,6 @@ export const useRpcClient = ({ }, options); }; -interface UseTendermintClient extends ReactQueryParams { - rpcEndpoint: string | HttpEndpoint; -} - -/** - * Hook that uses react-query to cache a connected tendermint client. - */ -export const useTendermintClient = ({ - rpcEndpoint, - options, -}: UseTendermintClient) => { - const { data: client } = useQuery( - ['client', 'tendermint', rpcEndpoint], - () => connectComet(rpcEndpoint), - { - // allow overriding - onError: (e) => { - throw new Error(`Failed to connect to ${rpcEndpoint}` + '\n' + e) - }, - ...options, - } - ) - return { client } -}; - -export interface UseQueryBuilderOptions { - builderQueryFn: (clientResolver?: EndpointOrRpc) => (request: TReq) => Promise, - queryKeyPrefix: string, -} - const getRpcClientFromCache = ( queryClient: ReturnType, key: string, @@ -136,6 +105,12 @@ const getRpcClientFromCache = ( return queryClient.getQueryData(queryKey); }; +export interface UseQueryBuilderOptions { + builderQueryFn: (client: EndpointOrRpc, request: TReq) => Promise, + queryKeyPrefix: string, +} + + export function buildUseQuery(opts: UseQueryBuilderOptions) { return ({ request, @@ -164,8 +139,7 @@ export function buildUseQuery(opts: UseQueryBuilderOptions(customizedQueryKey || [opts.queryKeyPrefix, request], () => queryFn(request), options); + return useQuery(customizedQueryKey || [opts.queryKeyPrefix, request], () => opts.builderQueryFn(rpcResolver!, request), options); }; } @@ -182,7 +156,8 @@ export interface ReactMutationParams { - builderMutationFn: (clientResolver?: ISigningClient) => ( + builderMutationFn: ( + client: ISigningClient, signerAddress: string, message: TMsg | TMsg[], fee: StdFee | 'auto', @@ -223,10 +198,8 @@ export function buildUseMutation(opts: UseMutationBuilderOptions>( - (reqData: ITxArgs) => mutationFn(reqData.signerAddress, reqData.message, reqData.fee, reqData.memo), + (reqData: ITxArgs) => opts.builderMutationFn(signingClientResolver!, reqData.signerAddress, reqData.message, reqData.fee, reqData.memo), options as Omit, unknown>, "mutationFn"> ); }; diff --git a/__fixtures__/v-next/outputhelperfunc/types.ts b/__fixtures__/v-next/outputhelperfunc/types.ts index b2016c1a9d..1acee677e2 100644 --- a/__fixtures__/v-next/outputhelperfunc/types.ts +++ b/__fixtures__/v-next/outputhelperfunc/types.ts @@ -6,8 +6,14 @@ import { IBinaryReader, IBinaryWriter } from "./binary"; import { Any } from "./google/protobuf/any"; -import { OfflineSigner } from "@cosmjs/proto-signing"; -import { HttpEndpoint } from "@cosmjs/tendermint-rpc"; + +import { HttpEndpoint } from "@interchainjs/types"; + + +import { DeliverTxResponse, Event, Attribute } from "@interchainjs/types"; + +export { DeliverTxResponse } + export type ProtoMsg = Omit & { typeUrl: any }; @@ -87,56 +93,6 @@ export interface StdFee { } -export interface MsgData { - msgType: string; - data: Uint8Array; -} -export interface Attribute { - key: string; - value: string; - index?: boolean; -} -export interface Event { - type: string; - attributes: readonly Attribute[]; -} - -/** - * The response after successfully broadcasting a transaction. - * Success or failure refer to the execution result. - */ -export interface DeliverTxResponse { - height: number; - /** The position of the transaction within the block. This is a 0-based index. */ - txIndex: number; - /** Error code. The transaction suceeded if and only if code is 0. */ - code: number; - transactionHash: string; - events: readonly Event[]; - /** - * A string-based log document. - * - * This currently seems to merge attributes of multiple events into one event per type - * (https://github.com/tendermint/tendermint/issues/9595). You might want to use the `events` - * field instead. - */ - rawLog?: string; - /** @deprecated Use `msgResponses` instead. */ - data?: readonly MsgData[]; - /** - * The message responses of the [TxMsgData](https://github.com/cosmos/cosmos-sdk/blob/v0.46.3/proto/cosmos/base/abci/v1beta1/abci.proto#L128-L140) - * as `Any`s. - * This field is an empty list for chains running Cosmos SDK < 0.46. - */ - msgResponses: Array<{ - typeUrl: string; - value: Uint8Array; - }>; - gasUsed: bigint; - gasWanted: bigint; - origin?: any; -} - export interface TxRpc { request( service: string, @@ -151,8 +107,3 @@ export interface TxRpc { ): Promise; } -export interface SigningClientParams { - rpcEndpoint: string | HttpEndpoint; - signer: OfflineSigner; -} - diff --git a/__fixtures__/v-next/outputinstantrpc/akash-sdk-module-client.ts b/__fixtures__/v-next/outputinstantrpc/akash-sdk-module-client.ts index 503b57a67f..e76195235b 100644 --- a/__fixtures__/v-next/outputinstantrpc/akash-sdk-module-client.ts +++ b/__fixtures__/v-next/outputinstantrpc/akash-sdk-module-client.ts @@ -2,7 +2,8 @@ import { GeneratedType, Registry, OfflineSigner } from "@cosmjs/proto-signing"; import { defaultRegistryTypes, AminoTypes, SigningStargateClient } from "@cosmjs/stargate"; import { HttpEndpoint } from "@cosmjs/tendermint-rpc"; import { createRpcClient } from "./extern"; -import { DeliverTxResponse, EncodeObject, StdFee, TxRpc, SigningClientParams } from "./types"; +import { DeliverTxResponse } from "@interchainjs/types"; +import { EncodeObject, StdFee, TxRpc, SigningClientParams } from "./types"; import * as akashAuditV1beta1AuditRegistry from "./akash/audit/v1beta1/audit.registry"; import * as akashAuditV1beta2AuditRegistry from "./akash/audit/v1beta2/audit.registry"; import * as akashCertV1beta2CertRegistry from "./akash/cert/v1beta2/cert.registry"; diff --git a/__fixtures__/v-next/outputinstantrpc/akash/audit/v1beta1/audit.registry.ts b/__fixtures__/v-next/outputinstantrpc/akash/audit/v1beta1/audit.registry.ts index 2c23f4b474..102ab96d50 100644 --- a/__fixtures__/v-next/outputinstantrpc/akash/audit/v1beta1/audit.registry.ts +++ b/__fixtures__/v-next/outputinstantrpc/akash/audit/v1beta1/audit.registry.ts @@ -1,13 +1,7 @@ import { Attribute, AttributeSDKType } from "../../base/v1beta1/attribute"; import { TelescopeGeneratedType } from "../../../types"; -import { Registry } from "@cosmjs/proto-signing"; import { MsgSignProviderAttributes, MsgSignProviderAttributesSDKType, MsgDeleteProviderAttributes, MsgDeleteProviderAttributesSDKType } from "./audit"; export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/akash.audit.v1beta1.MsgSignProviderAttributes", MsgSignProviderAttributes], ["/akash.audit.v1beta1.MsgDeleteProviderAttributes", MsgDeleteProviderAttributes]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; export const MessageComposer = { encoded: { signProviderAttributes(value: MsgSignProviderAttributes) { diff --git a/__fixtures__/v-next/outputinstantrpc/akash/audit/v1beta1/audit.rpc.func.ts b/__fixtures__/v-next/outputinstantrpc/akash/audit/v1beta1/audit.rpc.func.ts new file mode 100644 index 0000000000..2c7f66ceab --- /dev/null +++ b/__fixtures__/v-next/outputinstantrpc/akash/audit/v1beta1/audit.rpc.func.ts @@ -0,0 +1,21 @@ +import { Attribute, AttributeSDKType } from "../../base/v1beta1/attribute"; +import { buildTx } from "../../../helper-func-types"; +import { MsgSignProviderAttributes, MsgSignProviderAttributesSDKType, MsgSignProviderAttributesResponse, MsgSignProviderAttributesResponseSDKType, MsgDeleteProviderAttributes, MsgDeleteProviderAttributesSDKType, MsgDeleteProviderAttributesResponse, MsgDeleteProviderAttributesResponseSDKType } from "./audit"; +/** + * SignProviderAttributes defines a method that signs provider attributes + * @name signProviderAttributes + * @package akash.audit.v1beta1 + * @see proto service: akash.audit.v1beta1.SignProviderAttributes + */ +export const signProviderAttributes = buildTx({ + msg: MsgSignProviderAttributes +}); +/** + * DeleteProviderAttributes defines a method that deletes provider attributes + * @name deleteProviderAttributes + * @package akash.audit.v1beta1 + * @see proto service: akash.audit.v1beta1.DeleteProviderAttributes + */ +export const deleteProviderAttributes = buildTx({ + msg: MsgDeleteProviderAttributes +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputinstantrpc/akash/audit/v1beta1/audit.rpc.msg.ts b/__fixtures__/v-next/outputinstantrpc/akash/audit/v1beta1/audit.rpc.msg.ts index 9e6270bd25..f628d3a9e1 100644 --- a/__fixtures__/v-next/outputinstantrpc/akash/audit/v1beta1/audit.rpc.msg.ts +++ b/__fixtures__/v-next/outputinstantrpc/akash/audit/v1beta1/audit.rpc.msg.ts @@ -1,5 +1,6 @@ import { Attribute, AttributeSDKType } from "../../base/v1beta1/attribute"; -import { DeliverTxResponse, StdFee, TxRpc } from "../../../types"; +import { DeliverTxResponse } from "@interchainjs/types"; +import { StdFee, TxRpc } from "../../../types"; import { BinaryReader } from "../../../binary"; import { MsgSignProviderAttributes, MsgSignProviderAttributesSDKType, MsgSignProviderAttributesResponse, MsgSignProviderAttributesResponseSDKType, MsgDeleteProviderAttributes, MsgDeleteProviderAttributesSDKType, MsgDeleteProviderAttributesResponse, MsgDeleteProviderAttributesResponseSDKType } from "./audit"; /** Msg defines the provider Msg service */ diff --git a/__fixtures__/v-next/outputinstantrpc/akash/audit/v1beta2/audit.registry.ts b/__fixtures__/v-next/outputinstantrpc/akash/audit/v1beta2/audit.registry.ts index 42ef1cc6d8..11f0e7bbda 100644 --- a/__fixtures__/v-next/outputinstantrpc/akash/audit/v1beta2/audit.registry.ts +++ b/__fixtures__/v-next/outputinstantrpc/akash/audit/v1beta2/audit.registry.ts @@ -1,13 +1,7 @@ import { Attribute, AttributeSDKType } from "../../base/v1beta2/attribute"; import { TelescopeGeneratedType } from "../../../types"; -import { Registry } from "@cosmjs/proto-signing"; import { MsgSignProviderAttributes, MsgSignProviderAttributesSDKType, MsgDeleteProviderAttributes, MsgDeleteProviderAttributesSDKType } from "./audit"; export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/akash.audit.v1beta2.MsgSignProviderAttributes", MsgSignProviderAttributes], ["/akash.audit.v1beta2.MsgDeleteProviderAttributes", MsgDeleteProviderAttributes]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; export const MessageComposer = { encoded: { signProviderAttributes(value: MsgSignProviderAttributes) { diff --git a/__fixtures__/v-next/outputinstantrpc/akash/audit/v1beta2/audit.rpc.func.ts b/__fixtures__/v-next/outputinstantrpc/akash/audit/v1beta2/audit.rpc.func.ts new file mode 100644 index 0000000000..3e6236d47c --- /dev/null +++ b/__fixtures__/v-next/outputinstantrpc/akash/audit/v1beta2/audit.rpc.func.ts @@ -0,0 +1,21 @@ +import { Attribute, AttributeSDKType } from "../../base/v1beta2/attribute"; +import { buildTx } from "../../../helper-func-types"; +import { MsgSignProviderAttributes, MsgSignProviderAttributesSDKType, MsgSignProviderAttributesResponse, MsgSignProviderAttributesResponseSDKType, MsgDeleteProviderAttributes, MsgDeleteProviderAttributesSDKType, MsgDeleteProviderAttributesResponse, MsgDeleteProviderAttributesResponseSDKType } from "./audit"; +/** + * SignProviderAttributes defines a method that signs provider attributes + * @name signProviderAttributes + * @package akash.audit.v1beta2 + * @see proto service: akash.audit.v1beta2.SignProviderAttributes + */ +export const signProviderAttributes = buildTx({ + msg: MsgSignProviderAttributes +}); +/** + * DeleteProviderAttributes defines a method that deletes provider attributes + * @name deleteProviderAttributes + * @package akash.audit.v1beta2 + * @see proto service: akash.audit.v1beta2.DeleteProviderAttributes + */ +export const deleteProviderAttributes = buildTx({ + msg: MsgDeleteProviderAttributes +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputinstantrpc/akash/audit/v1beta2/audit.rpc.msg.ts b/__fixtures__/v-next/outputinstantrpc/akash/audit/v1beta2/audit.rpc.msg.ts index dd5a6ae973..9495525462 100644 --- a/__fixtures__/v-next/outputinstantrpc/akash/audit/v1beta2/audit.rpc.msg.ts +++ b/__fixtures__/v-next/outputinstantrpc/akash/audit/v1beta2/audit.rpc.msg.ts @@ -1,5 +1,6 @@ import { Attribute, AttributeSDKType } from "../../base/v1beta2/attribute"; -import { DeliverTxResponse, StdFee, TxRpc } from "../../../types"; +import { DeliverTxResponse } from "@interchainjs/types"; +import { StdFee, TxRpc } from "../../../types"; import { BinaryReader } from "../../../binary"; import { MsgSignProviderAttributes, MsgSignProviderAttributesSDKType, MsgSignProviderAttributesResponse, MsgSignProviderAttributesResponseSDKType, MsgDeleteProviderAttributes, MsgDeleteProviderAttributesSDKType, MsgDeleteProviderAttributesResponse, MsgDeleteProviderAttributesResponseSDKType } from "./audit"; /** Msg defines the provider Msg service */ diff --git a/__fixtures__/v-next/outputinstantrpc/akash/audit/v1beta2/query.rpc.func.ts b/__fixtures__/v-next/outputinstantrpc/akash/audit/v1beta2/query.rpc.func.ts new file mode 100644 index 0000000000..37305420f7 --- /dev/null +++ b/__fixtures__/v-next/outputinstantrpc/akash/audit/v1beta2/query.rpc.func.ts @@ -0,0 +1,60 @@ +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination"; +import { Provider, ProviderSDKType } from "./audit"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { QueryAllProvidersAttributesRequest, QueryAllProvidersAttributesRequestSDKType, QueryProvidersResponse, QueryProvidersResponseSDKType, QueryProviderAttributesRequest, QueryProviderAttributesRequestSDKType, QueryProviderAuditorRequest, QueryProviderAuditorRequestSDKType, QueryAuditorAttributesRequest, QueryAuditorAttributesRequestSDKType } from "./query"; +/** + * AllProvidersAttributes queries all providers + * buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE + * buf:lint:ignore RPC_RESPONSE_STANDARD_NAME + * @name getAllProvidersAttributes + * @package akash.audit.v1beta2 + * @see proto service: akash.audit.v1beta2.AllProvidersAttributes + */ +export const getAllProvidersAttributes = buildQuery({ + encode: QueryAllProvidersAttributesRequest.encode, + decode: QueryProvidersResponse.decode, + service: "akash.audit.v1beta2.Query", + method: "AllProvidersAttributes" +}); +/** + * ProviderAttributes queries all provider signed attributes + * buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE + * buf:lint:ignore RPC_RESPONSE_STANDARD_NAME + * @name getProviderAttributes + * @package akash.audit.v1beta2 + * @see proto service: akash.audit.v1beta2.ProviderAttributes + */ +export const getProviderAttributes = buildQuery({ + encode: QueryProviderAttributesRequest.encode, + decode: QueryProvidersResponse.decode, + service: "akash.audit.v1beta2.Query", + method: "ProviderAttributes" +}); +/** + * ProviderAuditorAttributes queries provider signed attributes by specific auditor + * buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE + * buf:lint:ignore RPC_RESPONSE_STANDARD_NAME + * @name getProviderAuditorAttributes + * @package akash.audit.v1beta2 + * @see proto service: akash.audit.v1beta2.ProviderAuditorAttributes + */ +export const getProviderAuditorAttributes = buildQuery({ + encode: QueryProviderAuditorRequest.encode, + decode: QueryProvidersResponse.decode, + service: "akash.audit.v1beta2.Query", + method: "ProviderAuditorAttributes" +}); +/** + * AuditorAttributes queries all providers signed by this auditor + * buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE + * buf:lint:ignore RPC_RESPONSE_STANDARD_NAME + * @name getAuditorAttributes + * @package akash.audit.v1beta2 + * @see proto service: akash.audit.v1beta2.AuditorAttributes + */ +export const getAuditorAttributes = buildQuery({ + encode: QueryAuditorAttributesRequest.encode, + decode: QueryProvidersResponse.decode, + service: "akash.audit.v1beta2.Query", + method: "AuditorAttributes" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputinstantrpc/akash/bundle.ts b/__fixtures__/v-next/outputinstantrpc/akash/bundle.ts index 6de3114418..a669ea6030 100644 --- a/__fixtures__/v-next/outputinstantrpc/akash/bundle.ts +++ b/__fixtures__/v-next/outputinstantrpc/akash/bundle.ts @@ -73,31 +73,48 @@ import * as _334 from "./escrow/v1beta1/query.lcd"; import * as _335 from "./escrow/v1beta2/query.lcd"; import * as _336 from "./market/v1beta2/query.lcd"; import * as _337 from "./provider/v1beta2/query.lcd"; -import * as _338 from "./audit/v1beta2/query.rpc.Query"; -import * as _339 from "./cert/v1beta2/query.rpc.Query"; -import * as _340 from "./deployment/v1beta2/query.rpc.Query"; -import * as _341 from "./escrow/v1beta1/query.rpc.Query"; -import * as _342 from "./escrow/v1beta2/query.rpc.Query"; -import * as _343 from "./market/v1beta2/query.rpc.Query"; -import * as _344 from "./provider/v1beta2/query.rpc.Query"; -import * as _345 from "./audit/v1beta1/audit.rpc.msg"; -import * as _346 from "./audit/v1beta2/audit.rpc.msg"; -import * as _347 from "./cert/v1beta2/cert.rpc.msg"; -import * as _348 from "./deployment/v1beta2/service.rpc.msg"; -import * as _349 from "./market/v1beta2/service.rpc.msg"; -import * as _350 from "./provider/v1beta1/provider.rpc.msg"; -import * as _351 from "./provider/v1beta2/provider.rpc.msg"; -import * as _352 from "./cert/v1beta2/query.pinia.store"; -import * as _536 from "./lcd"; -import * as _537 from "./rpc.query"; -import * as _538 from "./rpc.tx"; +import * as _338 from "./audit/v1beta2/query.rpc.func"; +import * as _339 from "./cert/v1beta2/query.rpc.func"; +import * as _340 from "./deployment/v1beta1/query.rpc.func"; +import * as _341 from "./deployment/v1beta2/query.rpc.func"; +import * as _342 from "./escrow/v1beta1/query.rpc.func"; +import * as _343 from "./escrow/v1beta2/query.rpc.func"; +import * as _344 from "./market/v1beta2/query.rpc.func"; +import * as _345 from "./provider/v1beta2/query.rpc.func"; +import * as _346 from "./audit/v1beta2/query.rpc.Query"; +import * as _347 from "./cert/v1beta2/query.rpc.Query"; +import * as _348 from "./deployment/v1beta2/query.rpc.Query"; +import * as _349 from "./escrow/v1beta1/query.rpc.Query"; +import * as _350 from "./escrow/v1beta2/query.rpc.Query"; +import * as _351 from "./market/v1beta2/query.rpc.Query"; +import * as _352 from "./provider/v1beta2/query.rpc.Query"; +import * as _353 from "./audit/v1beta1/audit.rpc.func"; +import * as _354 from "./audit/v1beta2/audit.rpc.func"; +import * as _355 from "./cert/v1beta2/cert.rpc.func"; +import * as _356 from "./deployment/v1beta1/deployment.rpc.func"; +import * as _357 from "./deployment/v1beta2/service.rpc.func"; +import * as _358 from "./market/v1beta2/service.rpc.func"; +import * as _359 from "./provider/v1beta1/provider.rpc.func"; +import * as _360 from "./provider/v1beta2/provider.rpc.func"; +import * as _361 from "./audit/v1beta1/audit.rpc.msg"; +import * as _362 from "./audit/v1beta2/audit.rpc.msg"; +import * as _363 from "./cert/v1beta2/cert.rpc.msg"; +import * as _364 from "./deployment/v1beta2/service.rpc.msg"; +import * as _365 from "./market/v1beta2/service.rpc.msg"; +import * as _366 from "./provider/v1beta1/provider.rpc.msg"; +import * as _367 from "./provider/v1beta2/provider.rpc.msg"; +import * as _368 from "./cert/v1beta2/query.pinia.store"; +import * as _629 from "./lcd"; +import * as _630 from "./rpc.query"; +import * as _631 from "./rpc.tx"; export namespace akash { export namespace audit { export const v1beta1 = { ..._0, ..._316, ..._323, - ..._345 + ..._353, + ..._361 }; export const v1beta2 = { ..._1, @@ -107,7 +124,9 @@ export namespace akash { ..._324, ..._330, ..._338, - ..._346 + ..._346, + ..._354, + ..._362 }; } export namespace base { @@ -135,7 +154,9 @@ export namespace akash { ..._331, ..._339, ..._347, - ..._352 + ..._355, + ..._363, + ..._368 }; } export namespace deployment { @@ -146,7 +167,9 @@ export namespace akash { ..._19, ..._20, ..._21, - ..._332 + ..._332, + ..._340, + ..._356 }; export const v1beta2 = { ..._22, @@ -164,8 +187,10 @@ export namespace akash { ..._319, ..._326, ..._333, - ..._340, - ..._348 + ..._341, + ..._348, + ..._357, + ..._364 }; } export namespace escrow { @@ -174,14 +199,16 @@ export namespace akash { ..._35, ..._36, ..._334, - ..._341 + ..._342, + ..._349 }; export const v1beta2 = { ..._37, ..._38, ..._39, ..._335, - ..._342 + ..._343, + ..._350 }; } export namespace inflation { @@ -202,8 +229,10 @@ export namespace akash { ..._320, ..._327, ..._336, - ..._343, - ..._349 + ..._344, + ..._351, + ..._358, + ..._365 }; } export namespace provider { @@ -211,7 +240,8 @@ export namespace akash { ..._49, ..._321, ..._328, - ..._350 + ..._359, + ..._366 }; export const v1beta2 = { ..._50, @@ -220,13 +250,15 @@ export namespace akash { ..._322, ..._329, ..._337, - ..._344, - ..._351 + ..._345, + ..._352, + ..._360, + ..._367 }; } export const ClientFactory = { - ..._536, - ..._537, - ..._538 + ..._629, + ..._630, + ..._631 }; } \ No newline at end of file diff --git a/__fixtures__/v-next/outputinstantrpc/akash/cert/v1beta2/cert.registry.ts b/__fixtures__/v-next/outputinstantrpc/akash/cert/v1beta2/cert.registry.ts index 76c3148a40..b2dbebb1de 100644 --- a/__fixtures__/v-next/outputinstantrpc/akash/cert/v1beta2/cert.registry.ts +++ b/__fixtures__/v-next/outputinstantrpc/akash/cert/v1beta2/cert.registry.ts @@ -1,12 +1,6 @@ import { TelescopeGeneratedType } from "../../../types"; -import { Registry } from "@cosmjs/proto-signing"; import { MsgCreateCertificate, MsgCreateCertificateSDKType, MsgRevokeCertificate, MsgRevokeCertificateSDKType } from "./cert"; export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/akash.cert.v1beta2.MsgCreateCertificate", MsgCreateCertificate], ["/akash.cert.v1beta2.MsgRevokeCertificate", MsgRevokeCertificate]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; export const MessageComposer = { encoded: { createCertificate(value: MsgCreateCertificate) { diff --git a/__fixtures__/v-next/outputinstantrpc/akash/cert/v1beta2/cert.rpc.func.ts b/__fixtures__/v-next/outputinstantrpc/akash/cert/v1beta2/cert.rpc.func.ts new file mode 100644 index 0000000000..bd7aec965f --- /dev/null +++ b/__fixtures__/v-next/outputinstantrpc/akash/cert/v1beta2/cert.rpc.func.ts @@ -0,0 +1,20 @@ +import { buildTx } from "../../../helper-func-types"; +import { MsgCreateCertificate, MsgCreateCertificateSDKType, MsgCreateCertificateResponse, MsgCreateCertificateResponseSDKType, MsgRevokeCertificate, MsgRevokeCertificateSDKType, MsgRevokeCertificateResponse, MsgRevokeCertificateResponseSDKType } from "./cert"; +/** + * CreateCertificate defines a method to create new certificate given proper inputs. + * @name createCertificate + * @package akash.cert.v1beta2 + * @see proto service: akash.cert.v1beta2.CreateCertificate + */ +export const createCertificate = buildTx({ + msg: MsgCreateCertificate +}); +/** + * RevokeCertificate defines a method to revoke the certificate + * @name revokeCertificate + * @package akash.cert.v1beta2 + * @see proto service: akash.cert.v1beta2.RevokeCertificate + */ +export const revokeCertificate = buildTx({ + msg: MsgRevokeCertificate +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputinstantrpc/akash/cert/v1beta2/cert.rpc.msg.ts b/__fixtures__/v-next/outputinstantrpc/akash/cert/v1beta2/cert.rpc.msg.ts index 09d1423e56..74fbf352cd 100644 --- a/__fixtures__/v-next/outputinstantrpc/akash/cert/v1beta2/cert.rpc.msg.ts +++ b/__fixtures__/v-next/outputinstantrpc/akash/cert/v1beta2/cert.rpc.msg.ts @@ -1,4 +1,5 @@ -import { DeliverTxResponse, StdFee, TxRpc } from "../../../types"; +import { DeliverTxResponse } from "@interchainjs/types"; +import { StdFee, TxRpc } from "../../../types"; import { BinaryReader } from "../../../binary"; import { MsgCreateCertificate, MsgCreateCertificateSDKType, MsgCreateCertificateResponse, MsgCreateCertificateResponseSDKType, MsgRevokeCertificate, MsgRevokeCertificateSDKType, MsgRevokeCertificateResponse, MsgRevokeCertificateResponseSDKType } from "./cert"; /** Msg defines the provider Msg service */ diff --git a/__fixtures__/v-next/outputinstantrpc/akash/cert/v1beta2/query.rpc.func.ts b/__fixtures__/v-next/outputinstantrpc/akash/cert/v1beta2/query.rpc.func.ts new file mode 100644 index 0000000000..adca22be83 --- /dev/null +++ b/__fixtures__/v-next/outputinstantrpc/akash/cert/v1beta2/query.rpc.func.ts @@ -0,0 +1,16 @@ +import { CertificateFilter, CertificateFilterSDKType, Certificate, CertificateSDKType } from "./cert"; +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { QueryCertificatesRequest, QueryCertificatesRequestSDKType, QueryCertificatesResponse, QueryCertificatesResponseSDKType } from "./query"; +/** + * Certificates queries certificates + * @name getCertificates + * @package akash.cert.v1beta2 + * @see proto service: akash.cert.v1beta2.Certificates + */ +export const getCertificates = buildQuery({ + encode: QueryCertificatesRequest.encode, + decode: QueryCertificatesResponse.decode, + service: "akash.cert.v1beta2.Query", + method: "Certificates" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta1/deployment.rpc.func.ts b/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta1/deployment.rpc.func.ts new file mode 100644 index 0000000000..74f7d60ba4 --- /dev/null +++ b/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta1/deployment.rpc.func.ts @@ -0,0 +1,67 @@ +import { GroupSpec, GroupSpecSDKType, GroupID, GroupIDSDKType, MsgCloseGroup, MsgCloseGroupSDKType, MsgCloseGroupResponse, MsgCloseGroupResponseSDKType, MsgPauseGroup, MsgPauseGroupSDKType, MsgPauseGroupResponse, MsgPauseGroupResponseSDKType, MsgStartGroup, MsgStartGroupSDKType, MsgStartGroupResponse, MsgStartGroupResponseSDKType } from "./group"; +import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; +import { buildTx } from "../../../helper-func-types"; +import { MsgCreateDeployment, MsgCreateDeploymentSDKType, MsgCreateDeploymentResponse, MsgCreateDeploymentResponseSDKType, MsgDepositDeployment, MsgDepositDeploymentSDKType, MsgDepositDeploymentResponse, MsgDepositDeploymentResponseSDKType, MsgUpdateDeployment, MsgUpdateDeploymentSDKType, MsgUpdateDeploymentResponse, MsgUpdateDeploymentResponseSDKType, MsgCloseDeployment, MsgCloseDeploymentSDKType, MsgCloseDeploymentResponse, MsgCloseDeploymentResponseSDKType } from "./deployment"; +/** + * CreateDeployment defines a method to create new deployment given proper inputs. + * @name createDeployment + * @package akash.deployment.v1beta1 + * @see proto service: akash.deployment.v1beta1.CreateDeployment + */ +export const createDeployment = buildTx({ + msg: MsgCreateDeployment +}); +/** + * DepositDeployment deposits more funds into the deployment account + * @name depositDeployment + * @package akash.deployment.v1beta1 + * @see proto service: akash.deployment.v1beta1.DepositDeployment + */ +export const depositDeployment = buildTx({ + msg: MsgDepositDeployment +}); +/** + * UpdateDeployment defines a method to update a deployment given proper inputs. + * @name updateDeployment + * @package akash.deployment.v1beta1 + * @see proto service: akash.deployment.v1beta1.UpdateDeployment + */ +export const updateDeployment = buildTx({ + msg: MsgUpdateDeployment +}); +/** + * CloseDeployment defines a method to close a deployment given proper inputs. + * @name closeDeployment + * @package akash.deployment.v1beta1 + * @see proto service: akash.deployment.v1beta1.CloseDeployment + */ +export const closeDeployment = buildTx({ + msg: MsgCloseDeployment +}); +/** + * CloseGroup defines a method to close a group of a deployment given proper inputs. + * @name closeGroup + * @package akash.deployment.v1beta1 + * @see proto service: akash.deployment.v1beta1.CloseGroup + */ +export const closeGroup = buildTx({ + msg: MsgCloseGroup +}); +/** + * PauseGroup defines a method to close a group of a deployment given proper inputs. + * @name pauseGroup + * @package akash.deployment.v1beta1 + * @see proto service: akash.deployment.v1beta1.PauseGroup + */ +export const pauseGroup = buildTx({ + msg: MsgPauseGroup +}); +/** + * StartGroup defines a method to close a group of a deployment given proper inputs. + * @name startGroup + * @package akash.deployment.v1beta1 + * @see proto service: akash.deployment.v1beta1.StartGroup + */ +export const startGroup = buildTx({ + msg: MsgStartGroup +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta1/deployment.ts b/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta1/deployment.ts index 63c8c7a851..8f1a4b1b78 100644 --- a/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta1/deployment.ts +++ b/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta1/deployment.ts @@ -5,7 +5,8 @@ import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { isSet, bytesFromBase64, base64FromBytes, Exact } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; -import { DeliverTxResponse, StdFee, TxRpc } from "../../../types"; +import { DeliverTxResponse } from "@interchainjs/types"; +import { StdFee, TxRpc } from "../../../types"; export const protobufPackage = "akash.deployment.v1beta1"; /** State is an enum which refers to state of deployment */ export enum Deployment_State { diff --git a/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta1/query.rpc.func.ts new file mode 100644 index 0000000000..77a812c186 --- /dev/null +++ b/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta1/query.rpc.func.ts @@ -0,0 +1,42 @@ +import { DeploymentFilters, DeploymentFiltersSDKType, DeploymentID, DeploymentIDSDKType, Deployment, DeploymentSDKType } from "./deployment"; +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination"; +import { GroupID, GroupIDSDKType, Group, GroupSDKType } from "./group"; +import { Account, AccountSDKType } from "../../escrow/v1beta1/types"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { QueryDeploymentsRequest, QueryDeploymentsRequestSDKType, QueryDeploymentsResponse, QueryDeploymentsResponseSDKType, QueryDeploymentRequest, QueryDeploymentRequestSDKType, QueryDeploymentResponse, QueryDeploymentResponseSDKType, QueryGroupRequest, QueryGroupRequestSDKType, QueryGroupResponse, QueryGroupResponseSDKType } from "./query"; +/** + * Deployments queries deployments + * @name getDeployments + * @package akash.deployment.v1beta1 + * @see proto service: akash.deployment.v1beta1.Deployments + */ +export const getDeployments = buildQuery({ + encode: QueryDeploymentsRequest.encode, + decode: QueryDeploymentsResponse.decode, + service: "akash.deployment.v1beta1.Query", + method: "Deployments" +}); +/** + * Deployment queries deployment details + * @name getDeployment + * @package akash.deployment.v1beta1 + * @see proto service: akash.deployment.v1beta1.Deployment + */ +export const getDeployment = buildQuery({ + encode: QueryDeploymentRequest.encode, + decode: QueryDeploymentResponse.decode, + service: "akash.deployment.v1beta1.Query", + method: "Deployment" +}); +/** + * Group queries group details + * @name getGroup + * @package akash.deployment.v1beta1 + * @see proto service: akash.deployment.v1beta1.Group + */ +export const getGroup = buildQuery({ + encode: QueryGroupRequest.encode, + decode: QueryGroupResponse.decode, + service: "akash.deployment.v1beta1.Query", + method: "Group" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta2/query.rpc.func.ts b/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta2/query.rpc.func.ts new file mode 100644 index 0000000000..8de064dc44 --- /dev/null +++ b/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta2/query.rpc.func.ts @@ -0,0 +1,43 @@ +import { DeploymentFilters, DeploymentFiltersSDKType, DeploymentID, DeploymentIDSDKType, Deployment, DeploymentSDKType } from "./deployment"; +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination"; +import { GroupID, GroupIDSDKType } from "./groupid"; +import { Group, GroupSDKType } from "./group"; +import { Account, AccountSDKType } from "../../escrow/v1beta2/types"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { QueryDeploymentsRequest, QueryDeploymentsRequestSDKType, QueryDeploymentsResponse, QueryDeploymentsResponseSDKType, QueryDeploymentRequest, QueryDeploymentRequestSDKType, QueryDeploymentResponse, QueryDeploymentResponseSDKType, QueryGroupRequest, QueryGroupRequestSDKType, QueryGroupResponse, QueryGroupResponseSDKType } from "./query"; +/** + * Deployments queries deployments + * @name getDeployments + * @package akash.deployment.v1beta2 + * @see proto service: akash.deployment.v1beta2.Deployments + */ +export const getDeployments = buildQuery({ + encode: QueryDeploymentsRequest.encode, + decode: QueryDeploymentsResponse.decode, + service: "akash.deployment.v1beta2.Query", + method: "Deployments" +}); +/** + * Deployment queries deployment details + * @name getDeployment + * @package akash.deployment.v1beta2 + * @see proto service: akash.deployment.v1beta2.Deployment + */ +export const getDeployment = buildQuery({ + encode: QueryDeploymentRequest.encode, + decode: QueryDeploymentResponse.decode, + service: "akash.deployment.v1beta2.Query", + method: "Deployment" +}); +/** + * Group queries group details + * @name getGroup + * @package akash.deployment.v1beta2 + * @see proto service: akash.deployment.v1beta2.Group + */ +export const getGroup = buildQuery({ + encode: QueryGroupRequest.encode, + decode: QueryGroupResponse.decode, + service: "akash.deployment.v1beta2.Query", + method: "Group" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta2/service.registry.ts b/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta2/service.registry.ts index 1a4247443e..ffa9b2b188 100644 --- a/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta2/service.registry.ts +++ b/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta2/service.registry.ts @@ -3,15 +3,9 @@ import { GroupSpec, GroupSpecSDKType } from "./groupspec"; import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { GroupID, GroupIDSDKType } from "./groupid"; import { TelescopeGeneratedType } from "../../../types"; -import { Registry } from "@cosmjs/proto-signing"; import { MsgCreateDeployment, MsgCreateDeploymentSDKType, MsgDepositDeployment, MsgDepositDeploymentSDKType, MsgUpdateDeployment, MsgUpdateDeploymentSDKType, MsgCloseDeployment, MsgCloseDeploymentSDKType } from "./deploymentmsg"; import { MsgCloseGroup, MsgCloseGroupSDKType, MsgPauseGroup, MsgPauseGroupSDKType, MsgStartGroup, MsgStartGroupSDKType } from "./groupmsg"; export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/akash.deployment.v1beta2.MsgCreateDeployment", MsgCreateDeployment], ["/akash.deployment.v1beta2.MsgDepositDeployment", MsgDepositDeployment], ["/akash.deployment.v1beta2.MsgUpdateDeployment", MsgUpdateDeployment], ["/akash.deployment.v1beta2.MsgCloseDeployment", MsgCloseDeployment], ["/akash.deployment.v1beta2.MsgCloseGroup", MsgCloseGroup], ["/akash.deployment.v1beta2.MsgPauseGroup", MsgPauseGroup], ["/akash.deployment.v1beta2.MsgStartGroup", MsgStartGroup]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; export const MessageComposer = { encoded: { createDeployment(value: MsgCreateDeployment) { diff --git a/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta2/service.rpc.func.ts b/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta2/service.rpc.func.ts new file mode 100644 index 0000000000..bd99b0050f --- /dev/null +++ b/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta2/service.rpc.func.ts @@ -0,0 +1,70 @@ +import { DeploymentID, DeploymentIDSDKType } from "./deployment"; +import { GroupSpec, GroupSpecSDKType } from "./groupspec"; +import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; +import { GroupID, GroupIDSDKType } from "./groupid"; +import { buildTx } from "../../../helper-func-types"; +import { MsgCreateDeployment, MsgCreateDeploymentSDKType, MsgCreateDeploymentResponse, MsgCreateDeploymentResponseSDKType, MsgDepositDeployment, MsgDepositDeploymentSDKType, MsgDepositDeploymentResponse, MsgDepositDeploymentResponseSDKType, MsgUpdateDeployment, MsgUpdateDeploymentSDKType, MsgUpdateDeploymentResponse, MsgUpdateDeploymentResponseSDKType, MsgCloseDeployment, MsgCloseDeploymentSDKType, MsgCloseDeploymentResponse, MsgCloseDeploymentResponseSDKType } from "./deploymentmsg"; +import { MsgCloseGroup, MsgCloseGroupSDKType, MsgCloseGroupResponse, MsgCloseGroupResponseSDKType, MsgPauseGroup, MsgPauseGroupSDKType, MsgPauseGroupResponse, MsgPauseGroupResponseSDKType, MsgStartGroup, MsgStartGroupSDKType, MsgStartGroupResponse, MsgStartGroupResponseSDKType } from "./groupmsg"; +/** + * CreateDeployment defines a method to create new deployment given proper inputs. + * @name createDeployment + * @package akash.deployment.v1beta2 + * @see proto service: akash.deployment.v1beta2.CreateDeployment + */ +export const createDeployment = buildTx({ + msg: MsgCreateDeployment +}); +/** + * DepositDeployment deposits more funds into the deployment account + * @name depositDeployment + * @package akash.deployment.v1beta2 + * @see proto service: akash.deployment.v1beta2.DepositDeployment + */ +export const depositDeployment = buildTx({ + msg: MsgDepositDeployment +}); +/** + * UpdateDeployment defines a method to update a deployment given proper inputs. + * @name updateDeployment + * @package akash.deployment.v1beta2 + * @see proto service: akash.deployment.v1beta2.UpdateDeployment + */ +export const updateDeployment = buildTx({ + msg: MsgUpdateDeployment +}); +/** + * CloseDeployment defines a method to close a deployment given proper inputs. + * @name closeDeployment + * @package akash.deployment.v1beta2 + * @see proto service: akash.deployment.v1beta2.CloseDeployment + */ +export const closeDeployment = buildTx({ + msg: MsgCloseDeployment +}); +/** + * CloseGroup defines a method to close a group of a deployment given proper inputs. + * @name closeGroup + * @package akash.deployment.v1beta2 + * @see proto service: akash.deployment.v1beta2.CloseGroup + */ +export const closeGroup = buildTx({ + msg: MsgCloseGroup +}); +/** + * PauseGroup defines a method to close a group of a deployment given proper inputs. + * @name pauseGroup + * @package akash.deployment.v1beta2 + * @see proto service: akash.deployment.v1beta2.PauseGroup + */ +export const pauseGroup = buildTx({ + msg: MsgPauseGroup +}); +/** + * StartGroup defines a method to close a group of a deployment given proper inputs. + * @name startGroup + * @package akash.deployment.v1beta2 + * @see proto service: akash.deployment.v1beta2.StartGroup + */ +export const startGroup = buildTx({ + msg: MsgStartGroup +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta2/service.rpc.msg.ts b/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta2/service.rpc.msg.ts index bfb507fe05..462e35c7d0 100644 --- a/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta2/service.rpc.msg.ts +++ b/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta2/service.rpc.msg.ts @@ -2,7 +2,8 @@ import { DeploymentID, DeploymentIDSDKType } from "./deployment"; import { GroupSpec, GroupSpecSDKType } from "./groupspec"; import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { GroupID, GroupIDSDKType } from "./groupid"; -import { DeliverTxResponse, StdFee, TxRpc } from "../../../types"; +import { DeliverTxResponse } from "@interchainjs/types"; +import { StdFee, TxRpc } from "../../../types"; import { BinaryReader } from "../../../binary"; import { MsgCreateDeployment, MsgCreateDeploymentSDKType, MsgCreateDeploymentResponse, MsgCreateDeploymentResponseSDKType, MsgDepositDeployment, MsgDepositDeploymentSDKType, MsgDepositDeploymentResponse, MsgDepositDeploymentResponseSDKType, MsgUpdateDeployment, MsgUpdateDeploymentSDKType, MsgUpdateDeploymentResponse, MsgUpdateDeploymentResponseSDKType, MsgCloseDeployment, MsgCloseDeploymentSDKType, MsgCloseDeploymentResponse, MsgCloseDeploymentResponseSDKType } from "./deploymentmsg"; import { MsgCloseGroup, MsgCloseGroupSDKType, MsgCloseGroupResponse, MsgCloseGroupResponseSDKType, MsgPauseGroup, MsgPauseGroupSDKType, MsgPauseGroupResponse, MsgPauseGroupResponseSDKType, MsgStartGroup, MsgStartGroupSDKType, MsgStartGroupResponse, MsgStartGroupResponseSDKType } from "./groupmsg"; diff --git a/__fixtures__/v-next/outputinstantrpc/akash/escrow/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputinstantrpc/akash/escrow/v1beta1/query.rpc.func.ts new file mode 100644 index 0000000000..dfbdf297d1 --- /dev/null +++ b/__fixtures__/v-next/outputinstantrpc/akash/escrow/v1beta1/query.rpc.func.ts @@ -0,0 +1,32 @@ +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination"; +import { Account, AccountSDKType, Payment, PaymentSDKType } from "./types"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { QueryAccountsRequest, QueryAccountsRequestSDKType, QueryAccountsResponse, QueryAccountsResponseSDKType, QueryPaymentsRequest, QueryPaymentsRequestSDKType, QueryPaymentsResponse, QueryPaymentsResponseSDKType } from "./query"; +/** + * buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE + * buf:lint:ignore RPC_RESPONSE_STANDARD_NAME + * Accounts queries all accounts + * @name getAccounts + * @package akash.escrow.v1beta1 + * @see proto service: akash.escrow.v1beta1.Accounts + */ +export const getAccounts = buildQuery({ + encode: QueryAccountsRequest.encode, + decode: QueryAccountsResponse.decode, + service: "akash.escrow.v1beta1.Query", + method: "Accounts" +}); +/** + * buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE + * buf:lint:ignore RPC_RESPONSE_STANDARD_NAME + * Payments queries all payments + * @name getPayments + * @package akash.escrow.v1beta1 + * @see proto service: akash.escrow.v1beta1.Payments + */ +export const getPayments = buildQuery({ + encode: QueryPaymentsRequest.encode, + decode: QueryPaymentsResponse.decode, + service: "akash.escrow.v1beta1.Query", + method: "Payments" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputinstantrpc/akash/escrow/v1beta2/query.rpc.func.ts b/__fixtures__/v-next/outputinstantrpc/akash/escrow/v1beta2/query.rpc.func.ts new file mode 100644 index 0000000000..6d929b5658 --- /dev/null +++ b/__fixtures__/v-next/outputinstantrpc/akash/escrow/v1beta2/query.rpc.func.ts @@ -0,0 +1,32 @@ +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination"; +import { Account, AccountSDKType, FractionalPayment, FractionalPaymentSDKType } from "./types"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { QueryAccountsRequest, QueryAccountsRequestSDKType, QueryAccountsResponse, QueryAccountsResponseSDKType, QueryPaymentsRequest, QueryPaymentsRequestSDKType, QueryPaymentsResponse, QueryPaymentsResponseSDKType } from "./query"; +/** + * buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE + * buf:lint:ignore RPC_RESPONSE_STANDARD_NAME + * Accounts queries all accounts + * @name getAccounts + * @package akash.escrow.v1beta2 + * @see proto service: akash.escrow.v1beta2.Accounts + */ +export const getAccounts = buildQuery({ + encode: QueryAccountsRequest.encode, + decode: QueryAccountsResponse.decode, + service: "akash.escrow.v1beta2.Query", + method: "Accounts" +}); +/** + * buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE + * buf:lint:ignore RPC_RESPONSE_STANDARD_NAME + * Payments queries all payments + * @name getPayments + * @package akash.escrow.v1beta2 + * @see proto service: akash.escrow.v1beta2.Payments + */ +export const getPayments = buildQuery({ + encode: QueryPaymentsRequest.encode, + decode: QueryPaymentsResponse.decode, + service: "akash.escrow.v1beta2.Query", + method: "Payments" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputinstantrpc/akash/inflation/v1beta2/params.ts b/__fixtures__/v-next/outputinstantrpc/akash/inflation/v1beta2/params.ts index b996831fd5..94bcc85e04 100644 --- a/__fixtures__/v-next/outputinstantrpc/akash/inflation/v1beta2/params.ts +++ b/__fixtures__/v-next/outputinstantrpc/akash/inflation/v1beta2/params.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { Decimal } from "@cosmjs/math"; +import { Decimal } from "@interchainjs/math"; import { isSet, DeepPartial, Exact } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "akash.inflation.v1beta2"; @@ -147,9 +147,9 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.inflation_decay_factor = message.inflationDecayFactor ?? ""; - obj.initial_inflation = message.initialInflation ?? ""; - obj.variance = message.variance ?? ""; + obj.inflation_decay_factor = Decimal.fromUserInput(message.inflationDecayFactor, 18).atomics ?? ""; + obj.initial_inflation = Decimal.fromUserInput(message.initialInflation, 18).atomics ?? ""; + obj.variance = Decimal.fromUserInput(message.variance, 18).atomics ?? ""; return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputinstantrpc/akash/market/v1beta2/query.rpc.func.ts b/__fixtures__/v-next/outputinstantrpc/akash/market/v1beta2/query.rpc.func.ts new file mode 100644 index 0000000000..3f82015da6 --- /dev/null +++ b/__fixtures__/v-next/outputinstantrpc/akash/market/v1beta2/query.rpc.func.ts @@ -0,0 +1,79 @@ +import { OrderFilters, OrderFiltersSDKType, OrderID, OrderIDSDKType, Order, OrderSDKType } from "./order"; +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination"; +import { BidFilters, BidFiltersSDKType, BidID, BidIDSDKType, Bid, BidSDKType } from "./bid"; +import { LeaseFilters, LeaseFiltersSDKType, LeaseID, LeaseIDSDKType, Lease, LeaseSDKType } from "./lease"; +import { Account, AccountSDKType, FractionalPayment, FractionalPaymentSDKType } from "../../escrow/v1beta2/types"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { QueryOrdersRequest, QueryOrdersRequestSDKType, QueryOrdersResponse, QueryOrdersResponseSDKType, QueryOrderRequest, QueryOrderRequestSDKType, QueryOrderResponse, QueryOrderResponseSDKType, QueryBidsRequest, QueryBidsRequestSDKType, QueryBidsResponse, QueryBidsResponseSDKType, QueryBidRequest, QueryBidRequestSDKType, QueryBidResponse, QueryBidResponseSDKType, QueryLeasesRequest, QueryLeasesRequestSDKType, QueryLeasesResponse, QueryLeasesResponseSDKType, QueryLeaseRequest, QueryLeaseRequestSDKType, QueryLeaseResponse, QueryLeaseResponseSDKType } from "./query"; +/** + * Orders queries orders with filters + * @name getOrders + * @package akash.market.v1beta2 + * @see proto service: akash.market.v1beta2.Orders + */ +export const getOrders = buildQuery({ + encode: QueryOrdersRequest.encode, + decode: QueryOrdersResponse.decode, + service: "akash.market.v1beta2.Query", + method: "Orders" +}); +/** + * Order queries order details + * @name getOrder + * @package akash.market.v1beta2 + * @see proto service: akash.market.v1beta2.Order + */ +export const getOrder = buildQuery({ + encode: QueryOrderRequest.encode, + decode: QueryOrderResponse.decode, + service: "akash.market.v1beta2.Query", + method: "Order" +}); +/** + * Bids queries bids with filters + * @name getBids + * @package akash.market.v1beta2 + * @see proto service: akash.market.v1beta2.Bids + */ +export const getBids = buildQuery({ + encode: QueryBidsRequest.encode, + decode: QueryBidsResponse.decode, + service: "akash.market.v1beta2.Query", + method: "Bids" +}); +/** + * Bid queries bid details + * @name getBid + * @package akash.market.v1beta2 + * @see proto service: akash.market.v1beta2.Bid + */ +export const getBid = buildQuery({ + encode: QueryBidRequest.encode, + decode: QueryBidResponse.decode, + service: "akash.market.v1beta2.Query", + method: "Bid" +}); +/** + * Leases queries leases with filters + * @name getLeases + * @package akash.market.v1beta2 + * @see proto service: akash.market.v1beta2.Leases + */ +export const getLeases = buildQuery({ + encode: QueryLeasesRequest.encode, + decode: QueryLeasesResponse.decode, + service: "akash.market.v1beta2.Query", + method: "Leases" +}); +/** + * Lease queries lease details + * @name getLease + * @package akash.market.v1beta2 + * @see proto service: akash.market.v1beta2.Lease + */ +export const getLease = buildQuery({ + encode: QueryLeaseRequest.encode, + decode: QueryLeaseResponse.decode, + service: "akash.market.v1beta2.Query", + method: "Lease" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputinstantrpc/akash/market/v1beta2/service.registry.ts b/__fixtures__/v-next/outputinstantrpc/akash/market/v1beta2/service.registry.ts index 3f5bcbdf07..a9c57a78fb 100644 --- a/__fixtures__/v-next/outputinstantrpc/akash/market/v1beta2/service.registry.ts +++ b/__fixtures__/v-next/outputinstantrpc/akash/market/v1beta2/service.registry.ts @@ -3,13 +3,7 @@ import { DecCoin, DecCoinSDKType, Coin, CoinSDKType } from "../../../cosmos/base import { BidID, BidIDSDKType, MsgCreateBid, MsgCreateBidSDKType, MsgCloseBid, MsgCloseBidSDKType } from "./bid"; import { LeaseID, LeaseIDSDKType, MsgWithdrawLease, MsgWithdrawLeaseSDKType, MsgCreateLease, MsgCreateLeaseSDKType, MsgCloseLease, MsgCloseLeaseSDKType } from "./lease"; import { TelescopeGeneratedType } from "../../../types"; -import { Registry } from "@cosmjs/proto-signing"; export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/akash.market.v1beta2.MsgCreateBid", MsgCreateBid], ["/akash.market.v1beta2.MsgCloseBid", MsgCloseBid], ["/akash.market.v1beta2.MsgWithdrawLease", MsgWithdrawLease], ["/akash.market.v1beta2.MsgCreateLease", MsgCreateLease], ["/akash.market.v1beta2.MsgCloseLease", MsgCloseLease]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; export const MessageComposer = { encoded: { createBid(value: MsgCreateBid) { diff --git a/__fixtures__/v-next/outputinstantrpc/akash/market/v1beta2/service.rpc.func.ts b/__fixtures__/v-next/outputinstantrpc/akash/market/v1beta2/service.rpc.func.ts new file mode 100644 index 0000000000..778aff6790 --- /dev/null +++ b/__fixtures__/v-next/outputinstantrpc/akash/market/v1beta2/service.rpc.func.ts @@ -0,0 +1,50 @@ +import { OrderID, OrderIDSDKType } from "./order"; +import { DecCoin, DecCoinSDKType, Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; +import { BidID, BidIDSDKType, MsgCreateBid, MsgCreateBidSDKType, MsgCreateBidResponse, MsgCreateBidResponseSDKType, MsgCloseBid, MsgCloseBidSDKType, MsgCloseBidResponse, MsgCloseBidResponseSDKType } from "./bid"; +import { LeaseID, LeaseIDSDKType, MsgWithdrawLease, MsgWithdrawLeaseSDKType, MsgWithdrawLeaseResponse, MsgWithdrawLeaseResponseSDKType, MsgCreateLease, MsgCreateLeaseSDKType, MsgCreateLeaseResponse, MsgCreateLeaseResponseSDKType, MsgCloseLease, MsgCloseLeaseSDKType, MsgCloseLeaseResponse, MsgCloseLeaseResponseSDKType } from "./lease"; +import { buildTx } from "../../../helper-func-types"; +/** + * CreateBid defines a method to create a bid given proper inputs. + * @name createBid + * @package akash.market.v1beta2 + * @see proto service: akash.market.v1beta2.CreateBid + */ +export const createBid = buildTx({ + msg: MsgCreateBid +}); +/** + * CloseBid defines a method to close a bid given proper inputs. + * @name closeBid + * @package akash.market.v1beta2 + * @see proto service: akash.market.v1beta2.CloseBid + */ +export const closeBid = buildTx({ + msg: MsgCloseBid +}); +/** + * WithdrawLease withdraws accrued funds from the lease payment + * @name withdrawLease + * @package akash.market.v1beta2 + * @see proto service: akash.market.v1beta2.WithdrawLease + */ +export const withdrawLease = buildTx({ + msg: MsgWithdrawLease +}); +/** + * CreateLease creates a new lease + * @name createLease + * @package akash.market.v1beta2 + * @see proto service: akash.market.v1beta2.CreateLease + */ +export const createLease = buildTx({ + msg: MsgCreateLease +}); +/** + * CloseLease defines a method to close an order given proper inputs. + * @name closeLease + * @package akash.market.v1beta2 + * @see proto service: akash.market.v1beta2.CloseLease + */ +export const closeLease = buildTx({ + msg: MsgCloseLease +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputinstantrpc/akash/market/v1beta2/service.rpc.msg.ts b/__fixtures__/v-next/outputinstantrpc/akash/market/v1beta2/service.rpc.msg.ts index e3e3e133a9..997ceed795 100644 --- a/__fixtures__/v-next/outputinstantrpc/akash/market/v1beta2/service.rpc.msg.ts +++ b/__fixtures__/v-next/outputinstantrpc/akash/market/v1beta2/service.rpc.msg.ts @@ -2,7 +2,8 @@ import { OrderID, OrderIDSDKType } from "./order"; import { DecCoin, DecCoinSDKType, Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { BidID, BidIDSDKType, MsgCreateBid, MsgCreateBidSDKType, MsgCreateBidResponse, MsgCreateBidResponseSDKType, MsgCloseBid, MsgCloseBidSDKType, MsgCloseBidResponse, MsgCloseBidResponseSDKType } from "./bid"; import { LeaseID, LeaseIDSDKType, MsgWithdrawLease, MsgWithdrawLeaseSDKType, MsgWithdrawLeaseResponse, MsgWithdrawLeaseResponseSDKType, MsgCreateLease, MsgCreateLeaseSDKType, MsgCreateLeaseResponse, MsgCreateLeaseResponseSDKType, MsgCloseLease, MsgCloseLeaseSDKType, MsgCloseLeaseResponse, MsgCloseLeaseResponseSDKType } from "./lease"; -import { DeliverTxResponse, StdFee, TxRpc } from "../../../types"; +import { DeliverTxResponse } from "@interchainjs/types"; +import { StdFee, TxRpc } from "../../../types"; import { BinaryReader } from "../../../binary"; /** Msg defines the market Msg service */ export interface Msg { diff --git a/__fixtures__/v-next/outputinstantrpc/akash/provider/v1beta1/provider.registry.ts b/__fixtures__/v-next/outputinstantrpc/akash/provider/v1beta1/provider.registry.ts index 7b1fde7cf4..7682a6571c 100644 --- a/__fixtures__/v-next/outputinstantrpc/akash/provider/v1beta1/provider.registry.ts +++ b/__fixtures__/v-next/outputinstantrpc/akash/provider/v1beta1/provider.registry.ts @@ -1,13 +1,7 @@ import { Attribute, AttributeSDKType } from "../../base/v1beta1/attribute"; import { TelescopeGeneratedType } from "../../../types"; -import { Registry } from "@cosmjs/proto-signing"; import { MsgCreateProvider, MsgCreateProviderSDKType, MsgUpdateProvider, MsgUpdateProviderSDKType, MsgDeleteProvider, MsgDeleteProviderSDKType } from "./provider"; export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/akash.provider.v1beta1.MsgCreateProvider", MsgCreateProvider], ["/akash.provider.v1beta1.MsgUpdateProvider", MsgUpdateProvider], ["/akash.provider.v1beta1.MsgDeleteProvider", MsgDeleteProvider]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; export const MessageComposer = { encoded: { createProvider(value: MsgCreateProvider) { diff --git a/__fixtures__/v-next/outputinstantrpc/akash/provider/v1beta1/provider.rpc.func.ts b/__fixtures__/v-next/outputinstantrpc/akash/provider/v1beta1/provider.rpc.func.ts new file mode 100644 index 0000000000..7f012148ff --- /dev/null +++ b/__fixtures__/v-next/outputinstantrpc/akash/provider/v1beta1/provider.rpc.func.ts @@ -0,0 +1,30 @@ +import { Attribute, AttributeSDKType } from "../../base/v1beta1/attribute"; +import { buildTx } from "../../../helper-func-types"; +import { MsgCreateProvider, MsgCreateProviderSDKType, MsgCreateProviderResponse, MsgCreateProviderResponseSDKType, MsgUpdateProvider, MsgUpdateProviderSDKType, MsgUpdateProviderResponse, MsgUpdateProviderResponseSDKType, MsgDeleteProvider, MsgDeleteProviderSDKType, MsgDeleteProviderResponse, MsgDeleteProviderResponseSDKType } from "./provider"; +/** + * CreateProvider defines a method that creates a provider given the proper inputs + * @name createProvider + * @package akash.provider.v1beta1 + * @see proto service: akash.provider.v1beta1.CreateProvider + */ +export const createProvider = buildTx({ + msg: MsgCreateProvider +}); +/** + * UpdateProvider defines a method that updates a provider given the proper inputs + * @name updateProvider + * @package akash.provider.v1beta1 + * @see proto service: akash.provider.v1beta1.UpdateProvider + */ +export const updateProvider = buildTx({ + msg: MsgUpdateProvider +}); +/** + * DeleteProvider defines a method that deletes a provider given the proper inputs + * @name deleteProvider + * @package akash.provider.v1beta1 + * @see proto service: akash.provider.v1beta1.DeleteProvider + */ +export const deleteProvider = buildTx({ + msg: MsgDeleteProvider +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputinstantrpc/akash/provider/v1beta1/provider.rpc.msg.ts b/__fixtures__/v-next/outputinstantrpc/akash/provider/v1beta1/provider.rpc.msg.ts index 59f6826528..7b24d99686 100644 --- a/__fixtures__/v-next/outputinstantrpc/akash/provider/v1beta1/provider.rpc.msg.ts +++ b/__fixtures__/v-next/outputinstantrpc/akash/provider/v1beta1/provider.rpc.msg.ts @@ -1,5 +1,6 @@ import { Attribute, AttributeSDKType } from "../../base/v1beta1/attribute"; -import { DeliverTxResponse, StdFee, TxRpc } from "../../../types"; +import { DeliverTxResponse } from "@interchainjs/types"; +import { StdFee, TxRpc } from "../../../types"; import { BinaryReader } from "../../../binary"; import { MsgCreateProvider, MsgCreateProviderSDKType, MsgCreateProviderResponse, MsgCreateProviderResponseSDKType, MsgUpdateProvider, MsgUpdateProviderSDKType, MsgUpdateProviderResponse, MsgUpdateProviderResponseSDKType, MsgDeleteProvider, MsgDeleteProviderSDKType, MsgDeleteProviderResponse, MsgDeleteProviderResponseSDKType } from "./provider"; /** Msg defines the provider Msg service */ diff --git a/__fixtures__/v-next/outputinstantrpc/akash/provider/v1beta2/provider.registry.ts b/__fixtures__/v-next/outputinstantrpc/akash/provider/v1beta2/provider.registry.ts index ed7f23b480..386647f173 100644 --- a/__fixtures__/v-next/outputinstantrpc/akash/provider/v1beta2/provider.registry.ts +++ b/__fixtures__/v-next/outputinstantrpc/akash/provider/v1beta2/provider.registry.ts @@ -1,13 +1,7 @@ import { Attribute, AttributeSDKType } from "../../base/v1beta2/attribute"; import { TelescopeGeneratedType } from "../../../types"; -import { Registry } from "@cosmjs/proto-signing"; import { MsgCreateProvider, MsgCreateProviderSDKType, MsgUpdateProvider, MsgUpdateProviderSDKType, MsgDeleteProvider, MsgDeleteProviderSDKType } from "./provider"; export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/akash.provider.v1beta2.MsgCreateProvider", MsgCreateProvider], ["/akash.provider.v1beta2.MsgUpdateProvider", MsgUpdateProvider], ["/akash.provider.v1beta2.MsgDeleteProvider", MsgDeleteProvider]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; export const MessageComposer = { encoded: { createProvider(value: MsgCreateProvider) { diff --git a/__fixtures__/v-next/outputinstantrpc/akash/provider/v1beta2/provider.rpc.func.ts b/__fixtures__/v-next/outputinstantrpc/akash/provider/v1beta2/provider.rpc.func.ts new file mode 100644 index 0000000000..2bf0b72d01 --- /dev/null +++ b/__fixtures__/v-next/outputinstantrpc/akash/provider/v1beta2/provider.rpc.func.ts @@ -0,0 +1,30 @@ +import { Attribute, AttributeSDKType } from "../../base/v1beta2/attribute"; +import { buildTx } from "../../../helper-func-types"; +import { MsgCreateProvider, MsgCreateProviderSDKType, MsgCreateProviderResponse, MsgCreateProviderResponseSDKType, MsgUpdateProvider, MsgUpdateProviderSDKType, MsgUpdateProviderResponse, MsgUpdateProviderResponseSDKType, MsgDeleteProvider, MsgDeleteProviderSDKType, MsgDeleteProviderResponse, MsgDeleteProviderResponseSDKType } from "./provider"; +/** + * CreateProvider defines a method that creates a provider given the proper inputs + * @name createProvider + * @package akash.provider.v1beta2 + * @see proto service: akash.provider.v1beta2.CreateProvider + */ +export const createProvider = buildTx({ + msg: MsgCreateProvider +}); +/** + * UpdateProvider defines a method that updates a provider given the proper inputs + * @name updateProvider + * @package akash.provider.v1beta2 + * @see proto service: akash.provider.v1beta2.UpdateProvider + */ +export const updateProvider = buildTx({ + msg: MsgUpdateProvider +}); +/** + * DeleteProvider defines a method that deletes a provider given the proper inputs + * @name deleteProvider + * @package akash.provider.v1beta2 + * @see proto service: akash.provider.v1beta2.DeleteProvider + */ +export const deleteProvider = buildTx({ + msg: MsgDeleteProvider +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputinstantrpc/akash/provider/v1beta2/provider.rpc.msg.ts b/__fixtures__/v-next/outputinstantrpc/akash/provider/v1beta2/provider.rpc.msg.ts index c20996bfa5..50352faeb8 100644 --- a/__fixtures__/v-next/outputinstantrpc/akash/provider/v1beta2/provider.rpc.msg.ts +++ b/__fixtures__/v-next/outputinstantrpc/akash/provider/v1beta2/provider.rpc.msg.ts @@ -1,5 +1,6 @@ import { Attribute, AttributeSDKType } from "../../base/v1beta2/attribute"; -import { DeliverTxResponse, StdFee, TxRpc } from "../../../types"; +import { DeliverTxResponse } from "@interchainjs/types"; +import { StdFee, TxRpc } from "../../../types"; import { BinaryReader } from "../../../binary"; import { MsgCreateProvider, MsgCreateProviderSDKType, MsgCreateProviderResponse, MsgCreateProviderResponseSDKType, MsgUpdateProvider, MsgUpdateProviderSDKType, MsgUpdateProviderResponse, MsgUpdateProviderResponseSDKType, MsgDeleteProvider, MsgDeleteProviderSDKType, MsgDeleteProviderResponse, MsgDeleteProviderResponseSDKType } from "./provider"; /** Msg defines the provider Msg service */ diff --git a/__fixtures__/v-next/outputinstantrpc/akash/provider/v1beta2/query.rpc.func.ts b/__fixtures__/v-next/outputinstantrpc/akash/provider/v1beta2/query.rpc.func.ts new file mode 100644 index 0000000000..56006aca31 --- /dev/null +++ b/__fixtures__/v-next/outputinstantrpc/akash/provider/v1beta2/query.rpc.func.ts @@ -0,0 +1,28 @@ +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination"; +import { Provider, ProviderSDKType } from "./provider"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { QueryProvidersRequest, QueryProvidersRequestSDKType, QueryProvidersResponse, QueryProvidersResponseSDKType, QueryProviderRequest, QueryProviderRequestSDKType, QueryProviderResponse, QueryProviderResponseSDKType } from "./query"; +/** + * Providers queries providers + * @name getProviders + * @package akash.provider.v1beta2 + * @see proto service: akash.provider.v1beta2.Providers + */ +export const getProviders = buildQuery({ + encode: QueryProvidersRequest.encode, + decode: QueryProvidersResponse.decode, + service: "akash.provider.v1beta2.Query", + method: "Providers" +}); +/** + * Provider queries provider details + * @name getProvider + * @package akash.provider.v1beta2 + * @see proto service: akash.provider.v1beta2.Provider + */ +export const getProvider = buildQuery({ + encode: QueryProviderRequest.encode, + decode: QueryProviderResponse.decode, + service: "akash.provider.v1beta2.Query", + method: "Provider" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputinstantrpc/all-module-client.ts b/__fixtures__/v-next/outputinstantrpc/all-module-client.ts index f30b417031..bdedf1ec44 100644 --- a/__fixtures__/v-next/outputinstantrpc/all-module-client.ts +++ b/__fixtures__/v-next/outputinstantrpc/all-module-client.ts @@ -2,7 +2,8 @@ import { GeneratedType, Registry, OfflineSigner } from "@cosmjs/proto-signing"; import { defaultRegistryTypes, AminoTypes, SigningStargateClient } from "@cosmjs/stargate"; import { HttpEndpoint } from "@cosmjs/tendermint-rpc"; import { createRpcClient } from "./extern"; -import { DeliverTxResponse, EncodeObject, StdFee, TxRpc, SigningClientParams } from "./types"; +import { DeliverTxResponse } from "@interchainjs/types"; +import { EncodeObject, StdFee, TxRpc, SigningClientParams } from "./types"; import * as akashAuditV1beta1AuditRegistry from "./akash/audit/v1beta1/audit.registry"; import * as akashAuditV1beta2AuditRegistry from "./akash/audit/v1beta2/audit.registry"; import * as akashCertV1beta2CertRegistry from "./akash/cert/v1beta2/cert.registry"; diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos-sdk-module-client.ts b/__fixtures__/v-next/outputinstantrpc/cosmos-sdk-module-client.ts index 3711879440..98dc6b6e64 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos-sdk-module-client.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos-sdk-module-client.ts @@ -2,7 +2,8 @@ import { GeneratedType, Registry, OfflineSigner } from "@cosmjs/proto-signing"; import { AminoTypes, SigningStargateClient } from "@cosmjs/stargate"; import { HttpEndpoint } from "@cosmjs/tendermint-rpc"; import { createRpcClient } from "./extern"; -import { DeliverTxResponse, EncodeObject, StdFee, TxRpc, SigningClientParams } from "./types"; +import { DeliverTxResponse } from "@interchainjs/types"; +import { EncodeObject, StdFee, TxRpc, SigningClientParams } from "./types"; import * as cosmosAuthzV1beta1TxRegistry from "./cosmos/authz/v1beta1/tx.registry"; import * as cosmosBankV1beta1TxRegistry from "./cosmos/bank/v1beta1/tx.registry"; import * as cosmosCrisisV1beta1TxRegistry from "./cosmos/crisis/v1beta1/tx.registry"; diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/app/v1alpha1/query.rpc.func.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/app/v1alpha1/query.rpc.func.ts new file mode 100644 index 0000000000..1503803062 --- /dev/null +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/app/v1alpha1/query.rpc.func.ts @@ -0,0 +1,15 @@ +import { Config, ConfigSDKType } from "./config"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { QueryConfigRequest, QueryConfigRequestSDKType, QueryConfigResponse, QueryConfigResponseSDKType } from "./query"; +/** + * Config returns the current app config. + * @name getConfig + * @package cosmos.app.v1alpha1 + * @see proto service: cosmos.app.v1alpha1.Config + */ +export const getConfig = buildQuery({ + encode: QueryConfigRequest.encode, + decode: QueryConfigResponse.decode, + service: "cosmos.app.v1alpha1.Query", + method: "Config" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/auth/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/auth/v1beta1/query.rpc.func.ts new file mode 100644 index 0000000000..cface65b7b --- /dev/null +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/auth/v1beta1/query.rpc.func.ts @@ -0,0 +1,91 @@ +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; +import { Any, AnySDKType } from "../../../google/protobuf/any"; +import { Params, ParamsSDKType } from "./auth"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { QueryAccountsRequest, QueryAccountsRequestSDKType, QueryAccountsResponse, QueryAccountsResponseSDKType, QueryAccountRequest, QueryAccountRequestSDKType, QueryAccountResponse, QueryAccountResponseSDKType, QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, QueryModuleAccountsRequest, QueryModuleAccountsRequestSDKType, QueryModuleAccountsResponse, QueryModuleAccountsResponseSDKType, Bech32PrefixRequest, Bech32PrefixRequestSDKType, Bech32PrefixResponse, Bech32PrefixResponseSDKType, AddressBytesToStringRequest, AddressBytesToStringRequestSDKType, AddressBytesToStringResponse, AddressBytesToStringResponseSDKType, AddressStringToBytesRequest, AddressStringToBytesRequestSDKType, AddressStringToBytesResponse, AddressStringToBytesResponseSDKType } from "./query"; +/** + * Accounts returns all the existing accounts + * + * Since: cosmos-sdk 0.43 + * @name getAccounts + * @package cosmos.auth.v1beta1 + * @see proto service: cosmos.auth.v1beta1.Accounts + */ +export const getAccounts = buildQuery({ + encode: QueryAccountsRequest.encode, + decode: QueryAccountsResponse.decode, + service: "cosmos.auth.v1beta1.Query", + method: "Accounts" +}); +/** + * Account returns account details based on address. + * @name getAccount + * @package cosmos.auth.v1beta1 + * @see proto service: cosmos.auth.v1beta1.Account + */ +export const getAccount = buildQuery({ + encode: QueryAccountRequest.encode, + decode: QueryAccountResponse.decode, + service: "cosmos.auth.v1beta1.Query", + method: "Account" +}); +/** + * Params queries all parameters. + * @name getParams + * @package cosmos.auth.v1beta1 + * @see proto service: cosmos.auth.v1beta1.Params + */ +export const getParams = buildQuery({ + encode: QueryParamsRequest.encode, + decode: QueryParamsResponse.decode, + service: "cosmos.auth.v1beta1.Query", + method: "Params" +}); +/** + * ModuleAccounts returns all the existing module accounts. + * @name getModuleAccounts + * @package cosmos.auth.v1beta1 + * @see proto service: cosmos.auth.v1beta1.ModuleAccounts + */ +export const getModuleAccounts = buildQuery({ + encode: QueryModuleAccountsRequest.encode, + decode: QueryModuleAccountsResponse.decode, + service: "cosmos.auth.v1beta1.Query", + method: "ModuleAccounts" +}); +/** + * Bech32 queries bech32Prefix + * @name getBech32Prefix + * @package cosmos.auth.v1beta1 + * @see proto service: cosmos.auth.v1beta1.Bech32Prefix + */ +export const getBech32Prefix = buildQuery({ + encode: Bech32PrefixRequest.encode, + decode: Bech32PrefixResponse.decode, + service: "cosmos.auth.v1beta1.Query", + method: "Bech32Prefix" +}); +/** + * AddressBytesToString converts Account Address bytes to string + * @name getAddressBytesToString + * @package cosmos.auth.v1beta1 + * @see proto service: cosmos.auth.v1beta1.AddressBytesToString + */ +export const getAddressBytesToString = buildQuery({ + encode: AddressBytesToStringRequest.encode, + decode: AddressBytesToStringResponse.decode, + service: "cosmos.auth.v1beta1.Query", + method: "AddressBytesToString" +}); +/** + * AddressStringToBytes converts Address string to bytes + * @name getAddressStringToBytes + * @package cosmos.auth.v1beta1 + * @see proto service: cosmos.auth.v1beta1.AddressStringToBytes + */ +export const getAddressStringToBytes = buildQuery({ + encode: AddressStringToBytesRequest.encode, + decode: AddressStringToBytesResponse.decode, + service: "cosmos.auth.v1beta1.Query", + method: "AddressStringToBytes" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/authz/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/authz/v1beta1/query.rpc.func.ts new file mode 100644 index 0000000000..1088892b72 --- /dev/null +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/authz/v1beta1/query.rpc.func.ts @@ -0,0 +1,44 @@ +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; +import { Grant, GrantSDKType, GrantAuthorization, GrantAuthorizationSDKType } from "./authz"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { QueryGrantsRequest, QueryGrantsRequestSDKType, QueryGrantsResponse, QueryGrantsResponseSDKType, QueryGranterGrantsRequest, QueryGranterGrantsRequestSDKType, QueryGranterGrantsResponse, QueryGranterGrantsResponseSDKType, QueryGranteeGrantsRequest, QueryGranteeGrantsRequestSDKType, QueryGranteeGrantsResponse, QueryGranteeGrantsResponseSDKType } from "./query"; +/** + * Returns list of `Authorization`, granted to the grantee by the granter. + * @name getGrants + * @package cosmos.authz.v1beta1 + * @see proto service: cosmos.authz.v1beta1.Grants + */ +export const getGrants = buildQuery({ + encode: QueryGrantsRequest.encode, + decode: QueryGrantsResponse.decode, + service: "cosmos.authz.v1beta1.Query", + method: "Grants" +}); +/** + * GranterGrants returns list of `GrantAuthorization`, granted by granter. + * + * Since: cosmos-sdk 0.46 + * @name getGranterGrants + * @package cosmos.authz.v1beta1 + * @see proto service: cosmos.authz.v1beta1.GranterGrants + */ +export const getGranterGrants = buildQuery({ + encode: QueryGranterGrantsRequest.encode, + decode: QueryGranterGrantsResponse.decode, + service: "cosmos.authz.v1beta1.Query", + method: "GranterGrants" +}); +/** + * GranteeGrants returns a list of `GrantAuthorization` by grantee. + * + * Since: cosmos-sdk 0.46 + * @name getGranteeGrants + * @package cosmos.authz.v1beta1 + * @see proto service: cosmos.authz.v1beta1.GranteeGrants + */ +export const getGranteeGrants = buildQuery({ + encode: QueryGranteeGrantsRequest.encode, + decode: QueryGranteeGrantsResponse.decode, + service: "cosmos.authz.v1beta1.Query", + method: "GranteeGrants" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/authz/v1beta1/tx.registry.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/authz/v1beta1/tx.registry.ts index 62d4f09012..4fed700d50 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/authz/v1beta1/tx.registry.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/authz/v1beta1/tx.registry.ts @@ -1,14 +1,8 @@ import { Grant, GrantSDKType } from "./authz"; import { Any, AnySDKType } from "../../../google/protobuf/any"; import { TelescopeGeneratedType } from "../../../types"; -import { Registry } from "@cosmjs/proto-signing"; import { MsgGrant, MsgGrantSDKType, MsgExec, MsgExecSDKType, MsgRevoke, MsgRevokeSDKType } from "./tx"; export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/cosmos.authz.v1beta1.MsgGrant", MsgGrant], ["/cosmos.authz.v1beta1.MsgExec", MsgExec], ["/cosmos.authz.v1beta1.MsgRevoke", MsgRevoke]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; export const MessageComposer = { encoded: { grant(value: MsgGrant) { diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/authz/v1beta1/tx.rpc.func.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/authz/v1beta1/tx.rpc.func.ts new file mode 100644 index 0000000000..7f9d1ce40c --- /dev/null +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/authz/v1beta1/tx.rpc.func.ts @@ -0,0 +1,37 @@ +import { Grant, GrantSDKType } from "./authz"; +import { Any, AnySDKType } from "../../../google/protobuf/any"; +import { buildTx } from "../../../helper-func-types"; +import { MsgGrant, MsgGrantSDKType, MsgGrantResponse, MsgGrantResponseSDKType, MsgExec, MsgExecSDKType, MsgExecResponse, MsgExecResponseSDKType, MsgRevoke, MsgRevokeSDKType, MsgRevokeResponse, MsgRevokeResponseSDKType } from "./tx"; +/** + * Grant grants the provided authorization to the grantee on the granter's + * account with the provided expiration time. If there is already a grant + * for the given (granter, grantee, Authorization) triple, then the grant + * will be overwritten. + * @name grant + * @package cosmos.authz.v1beta1 + * @see proto service: cosmos.authz.v1beta1.Grant + */ +export const grant = buildTx({ + msg: MsgGrant +}); +/** + * Exec attempts to execute the provided messages using + * authorizations granted to the grantee. Each message should have only + * one signer corresponding to the granter of the authorization. + * @name exec + * @package cosmos.authz.v1beta1 + * @see proto service: cosmos.authz.v1beta1.Exec + */ +export const exec = buildTx({ + msg: MsgExec +}); +/** + * Revoke revokes any authorization corresponding to the provided method name on the + * granter's account that has been granted to the grantee. + * @name revoke + * @package cosmos.authz.v1beta1 + * @see proto service: cosmos.authz.v1beta1.Revoke + */ +export const revoke = buildTx({ + msg: MsgRevoke +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/authz/v1beta1/tx.rpc.msg.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/authz/v1beta1/tx.rpc.msg.ts index f994c6ffbf..faa2ffaa02 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/authz/v1beta1/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/authz/v1beta1/tx.rpc.msg.ts @@ -1,6 +1,7 @@ import { Grant, GrantSDKType } from "./authz"; import { Any, AnySDKType } from "../../../google/protobuf/any"; -import { DeliverTxResponse, StdFee, TxRpc } from "../../../types"; +import { DeliverTxResponse } from "@interchainjs/types"; +import { StdFee, TxRpc } from "../../../types"; import { BinaryReader } from "../../../binary"; import { MsgGrant, MsgGrantSDKType, MsgGrantResponse, MsgGrantResponseSDKType, MsgExec, MsgExecSDKType, MsgExecResponse, MsgExecResponseSDKType, MsgRevoke, MsgRevokeSDKType, MsgRevokeResponse, MsgRevokeResponseSDKType } from "./tx"; /** Msg defines the authz Msg service. */ diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/bank/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/bank/v1beta1/query.rpc.func.ts new file mode 100644 index 0000000000..82263d9de8 --- /dev/null +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/bank/v1beta1/query.rpc.func.ts @@ -0,0 +1,116 @@ +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; +import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; +import { Params, ParamsSDKType, Metadata, MetadataSDKType } from "./bank"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { QueryBalanceRequest, QueryBalanceRequestSDKType, QueryBalanceResponse, QueryBalanceResponseSDKType, QueryAllBalancesRequest, QueryAllBalancesRequestSDKType, QueryAllBalancesResponse, QueryAllBalancesResponseSDKType, QuerySpendableBalancesRequest, QuerySpendableBalancesRequestSDKType, QuerySpendableBalancesResponse, QuerySpendableBalancesResponseSDKType, QueryTotalSupplyRequest, QueryTotalSupplyRequestSDKType, QueryTotalSupplyResponse, QueryTotalSupplyResponseSDKType, QuerySupplyOfRequest, QuerySupplyOfRequestSDKType, QuerySupplyOfResponse, QuerySupplyOfResponseSDKType, QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, QueryDenomMetadataRequest, QueryDenomMetadataRequestSDKType, QueryDenomMetadataResponse, QueryDenomMetadataResponseSDKType, QueryDenomsMetadataRequest, QueryDenomsMetadataRequestSDKType, QueryDenomsMetadataResponse, QueryDenomsMetadataResponseSDKType, QueryDenomOwnersRequest, QueryDenomOwnersRequestSDKType, QueryDenomOwnersResponse, QueryDenomOwnersResponseSDKType } from "./query"; +/** + * Balance queries the balance of a single coin for a single account. + * @name getBalance + * @package cosmos.bank.v1beta1 + * @see proto service: cosmos.bank.v1beta1.Balance + */ +export const getBalance = buildQuery({ + encode: QueryBalanceRequest.encode, + decode: QueryBalanceResponse.decode, + service: "cosmos.bank.v1beta1.Query", + method: "Balance" +}); +/** + * AllBalances queries the balance of all coins for a single account. + * @name getAllBalances + * @package cosmos.bank.v1beta1 + * @see proto service: cosmos.bank.v1beta1.AllBalances + */ +export const getAllBalances = buildQuery({ + encode: QueryAllBalancesRequest.encode, + decode: QueryAllBalancesResponse.decode, + service: "cosmos.bank.v1beta1.Query", + method: "AllBalances" +}); +/** + * SpendableBalances queries the spenable balance of all coins for a single + * account. + * @name getSpendableBalances + * @package cosmos.bank.v1beta1 + * @see proto service: cosmos.bank.v1beta1.SpendableBalances + */ +export const getSpendableBalances = buildQuery({ + encode: QuerySpendableBalancesRequest.encode, + decode: QuerySpendableBalancesResponse.decode, + service: "cosmos.bank.v1beta1.Query", + method: "SpendableBalances" +}); +/** + * TotalSupply queries the total supply of all coins. + * @name getTotalSupply + * @package cosmos.bank.v1beta1 + * @see proto service: cosmos.bank.v1beta1.TotalSupply + */ +export const getTotalSupply = buildQuery({ + encode: QueryTotalSupplyRequest.encode, + decode: QueryTotalSupplyResponse.decode, + service: "cosmos.bank.v1beta1.Query", + method: "TotalSupply" +}); +/** + * SupplyOf queries the supply of a single coin. + * @name getSupplyOf + * @package cosmos.bank.v1beta1 + * @see proto service: cosmos.bank.v1beta1.SupplyOf + */ +export const getSupplyOf = buildQuery({ + encode: QuerySupplyOfRequest.encode, + decode: QuerySupplyOfResponse.decode, + service: "cosmos.bank.v1beta1.Query", + method: "SupplyOf" +}); +/** + * Params queries the parameters of x/bank module. + * @name getParams + * @package cosmos.bank.v1beta1 + * @see proto service: cosmos.bank.v1beta1.Params + */ +export const getParams = buildQuery({ + encode: QueryParamsRequest.encode, + decode: QueryParamsResponse.decode, + service: "cosmos.bank.v1beta1.Query", + method: "Params" +}); +/** + * DenomsMetadata queries the client metadata of a given coin denomination. + * @name getDenomMetadata + * @package cosmos.bank.v1beta1 + * @see proto service: cosmos.bank.v1beta1.DenomMetadata + */ +export const getDenomMetadata = buildQuery({ + encode: QueryDenomMetadataRequest.encode, + decode: QueryDenomMetadataResponse.decode, + service: "cosmos.bank.v1beta1.Query", + method: "DenomMetadata" +}); +/** + * DenomsMetadata queries the client metadata for all registered coin + * denominations. + * @name getDenomsMetadata + * @package cosmos.bank.v1beta1 + * @see proto service: cosmos.bank.v1beta1.DenomsMetadata + */ +export const getDenomsMetadata = buildQuery({ + encode: QueryDenomsMetadataRequest.encode, + decode: QueryDenomsMetadataResponse.decode, + service: "cosmos.bank.v1beta1.Query", + method: "DenomsMetadata" +}); +/** + * DenomOwners queries for all account addresses that own a particular token + * denomination. + * @name getDenomOwners + * @package cosmos.bank.v1beta1 + * @see proto service: cosmos.bank.v1beta1.DenomOwners + */ +export const getDenomOwners = buildQuery({ + encode: QueryDenomOwnersRequest.encode, + decode: QueryDenomOwnersResponse.decode, + service: "cosmos.bank.v1beta1.Query", + method: "DenomOwners" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/bank/v1beta1/tx.registry.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/bank/v1beta1/tx.registry.ts index ead40b153d..3bd1884e0d 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/bank/v1beta1/tx.registry.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/bank/v1beta1/tx.registry.ts @@ -1,14 +1,8 @@ import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; import { Input, InputSDKType, Output, OutputSDKType } from "./bank"; import { TelescopeGeneratedType } from "../../../types"; -import { Registry } from "@cosmjs/proto-signing"; import { MsgSend, MsgSendSDKType, MsgMultiSend, MsgMultiSendSDKType } from "./tx"; export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/cosmos.bank.v1beta1.MsgSend", MsgSend], ["/cosmos.bank.v1beta1.MsgMultiSend", MsgMultiSend]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; export const MessageComposer = { encoded: { send(value: MsgSend) { diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/bank/v1beta1/tx.rpc.func.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/bank/v1beta1/tx.rpc.func.ts new file mode 100644 index 0000000000..3c274e156d --- /dev/null +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/bank/v1beta1/tx.rpc.func.ts @@ -0,0 +1,22 @@ +import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; +import { Input, InputSDKType, Output, OutputSDKType } from "./bank"; +import { buildTx } from "../../../helper-func-types"; +import { MsgSend, MsgSendSDKType, MsgSendResponse, MsgSendResponseSDKType, MsgMultiSend, MsgMultiSendSDKType, MsgMultiSendResponse, MsgMultiSendResponseSDKType } from "./tx"; +/** + * Send defines a method for sending coins from one account to another account. + * @name send + * @package cosmos.bank.v1beta1 + * @see proto service: cosmos.bank.v1beta1.Send + */ +export const send = buildTx({ + msg: MsgSend +}); +/** + * MultiSend defines a method for sending coins from some accounts to other accounts. + * @name multiSend + * @package cosmos.bank.v1beta1 + * @see proto service: cosmos.bank.v1beta1.MultiSend + */ +export const multiSend = buildTx({ + msg: MsgMultiSend +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/bank/v1beta1/tx.rpc.msg.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/bank/v1beta1/tx.rpc.msg.ts index 0581a53366..8d155dd487 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/bank/v1beta1/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/bank/v1beta1/tx.rpc.msg.ts @@ -1,6 +1,7 @@ import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; import { Input, InputSDKType, Output, OutputSDKType } from "./bank"; -import { DeliverTxResponse, StdFee, TxRpc } from "../../../types"; +import { DeliverTxResponse } from "@interchainjs/types"; +import { StdFee, TxRpc } from "../../../types"; import { BinaryReader } from "../../../binary"; import { MsgSend, MsgSendSDKType, MsgSendResponse, MsgSendResponseSDKType, MsgMultiSend, MsgMultiSendSDKType, MsgMultiSendResponse, MsgMultiSendResponseSDKType } from "./tx"; /** Msg defines the bank Msg service. */ diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/base/reflection/v1beta1/reflection.rpc.func.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/base/reflection/v1beta1/reflection.rpc.func.ts new file mode 100644 index 0000000000..457419f04b --- /dev/null +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/base/reflection/v1beta1/reflection.rpc.func.ts @@ -0,0 +1,28 @@ +import { EndpointOrRpc, buildQuery } from "../../../../helper-func-types"; +import { ListAllInterfacesRequest, ListAllInterfacesRequestSDKType, ListAllInterfacesResponse, ListAllInterfacesResponseSDKType, ListImplementationsRequest, ListImplementationsRequestSDKType, ListImplementationsResponse, ListImplementationsResponseSDKType } from "./reflection"; +/** + * ListAllInterfaces lists all the interfaces registered in the interface + * registry. + * @name getListAllInterfaces + * @package cosmos.base.reflection.v1beta1 + * @see proto service: cosmos.base.reflection.v1beta1.ListAllInterfaces + */ +export const getListAllInterfaces = buildQuery({ + encode: ListAllInterfacesRequest.encode, + decode: ListAllInterfacesResponse.decode, + service: "cosmos.base.reflection.v1beta1.ReflectionService", + method: "ListAllInterfaces" +}); +/** + * ListImplementations list all the concrete types that implement a given + * interface. + * @name getListImplementations + * @package cosmos.base.reflection.v1beta1 + * @see proto service: cosmos.base.reflection.v1beta1.ListImplementations + */ +export const getListImplementations = buildQuery({ + encode: ListImplementationsRequest.encode, + decode: ListImplementationsResponse.decode, + service: "cosmos.base.reflection.v1beta1.ReflectionService", + method: "ListImplementations" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/base/reflection/v2alpha1/reflection.rpc.func.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/base/reflection/v2alpha1/reflection.rpc.func.ts new file mode 100644 index 0000000000..98ce9c04a0 --- /dev/null +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/base/reflection/v2alpha1/reflection.rpc.func.ts @@ -0,0 +1,76 @@ +import { EndpointOrRpc, buildQuery } from "../../../../helper-func-types"; +import { GetAuthnDescriptorRequest, GetAuthnDescriptorRequestSDKType, GetAuthnDescriptorResponse, GetAuthnDescriptorResponseSDKType, GetChainDescriptorRequest, GetChainDescriptorRequestSDKType, GetChainDescriptorResponse, GetChainDescriptorResponseSDKType, GetCodecDescriptorRequest, GetCodecDescriptorRequestSDKType, GetCodecDescriptorResponse, GetCodecDescriptorResponseSDKType, GetConfigurationDescriptorRequest, GetConfigurationDescriptorRequestSDKType, GetConfigurationDescriptorResponse, GetConfigurationDescriptorResponseSDKType, GetQueryServicesDescriptorRequest, GetQueryServicesDescriptorRequestSDKType, GetQueryServicesDescriptorResponse, GetQueryServicesDescriptorResponseSDKType, GetTxDescriptorRequest, GetTxDescriptorRequestSDKType, GetTxDescriptorResponse, GetTxDescriptorResponseSDKType } from "./reflection"; +/** + * GetAuthnDescriptor returns information on how to authenticate transactions in the application + * NOTE: this RPC is still experimental and might be subject to breaking changes or removal in + * future releases of the cosmos-sdk. + * @name getGetAuthnDescriptor + * @package cosmos.base.reflection.v2alpha1 + * @see proto service: cosmos.base.reflection.v2alpha1.GetAuthnDescriptor + */ +export const getGetAuthnDescriptor = buildQuery({ + encode: GetAuthnDescriptorRequest.encode, + decode: GetAuthnDescriptorResponse.decode, + service: "cosmos.base.reflection.v2alpha1.ReflectionService", + method: "GetAuthnDescriptor" +}); +/** + * GetChainDescriptor returns the description of the chain + * @name getGetChainDescriptor + * @package cosmos.base.reflection.v2alpha1 + * @see proto service: cosmos.base.reflection.v2alpha1.GetChainDescriptor + */ +export const getGetChainDescriptor = buildQuery({ + encode: GetChainDescriptorRequest.encode, + decode: GetChainDescriptorResponse.decode, + service: "cosmos.base.reflection.v2alpha1.ReflectionService", + method: "GetChainDescriptor" +}); +/** + * GetCodecDescriptor returns the descriptor of the codec of the application + * @name getGetCodecDescriptor + * @package cosmos.base.reflection.v2alpha1 + * @see proto service: cosmos.base.reflection.v2alpha1.GetCodecDescriptor + */ +export const getGetCodecDescriptor = buildQuery({ + encode: GetCodecDescriptorRequest.encode, + decode: GetCodecDescriptorResponse.decode, + service: "cosmos.base.reflection.v2alpha1.ReflectionService", + method: "GetCodecDescriptor" +}); +/** + * GetConfigurationDescriptor returns the descriptor for the sdk.Config of the application + * @name getGetConfigurationDescriptor + * @package cosmos.base.reflection.v2alpha1 + * @see proto service: cosmos.base.reflection.v2alpha1.GetConfigurationDescriptor + */ +export const getGetConfigurationDescriptor = buildQuery({ + encode: GetConfigurationDescriptorRequest.encode, + decode: GetConfigurationDescriptorResponse.decode, + service: "cosmos.base.reflection.v2alpha1.ReflectionService", + method: "GetConfigurationDescriptor" +}); +/** + * GetQueryServicesDescriptor returns the available gRPC queryable services of the application + * @name getGetQueryServicesDescriptor + * @package cosmos.base.reflection.v2alpha1 + * @see proto service: cosmos.base.reflection.v2alpha1.GetQueryServicesDescriptor + */ +export const getGetQueryServicesDescriptor = buildQuery({ + encode: GetQueryServicesDescriptorRequest.encode, + decode: GetQueryServicesDescriptorResponse.decode, + service: "cosmos.base.reflection.v2alpha1.ReflectionService", + method: "GetQueryServicesDescriptor" +}); +/** + * GetTxDescriptor returns information on the used transaction object and available msgs that can be used + * @name getGetTxDescriptor + * @package cosmos.base.reflection.v2alpha1 + * @see proto service: cosmos.base.reflection.v2alpha1.GetTxDescriptor + */ +export const getGetTxDescriptor = buildQuery({ + encode: GetTxDescriptorRequest.encode, + decode: GetTxDescriptorResponse.decode, + service: "cosmos.base.reflection.v2alpha1.ReflectionService", + method: "GetTxDescriptor" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/base/tendermint/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/base/tendermint/v1beta1/query.rpc.func.ts new file mode 100644 index 0000000000..4710fdb42e --- /dev/null +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/base/tendermint/v1beta1/query.rpc.func.ts @@ -0,0 +1,79 @@ +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../query/v1beta1/pagination"; +import { Any, AnySDKType } from "../../../../google/protobuf/any"; +import { BlockID, BlockIDSDKType } from "../../../../tendermint/types/types"; +import { Block, BlockSDKType } from "../../../../tendermint/types/block"; +import { NodeInfo, NodeInfoSDKType } from "../../../../tendermint/p2p/types"; +import { EndpointOrRpc, buildQuery } from "../../../../helper-func-types"; +import { GetNodeInfoRequest, GetNodeInfoRequestSDKType, GetNodeInfoResponse, GetNodeInfoResponseSDKType, GetSyncingRequest, GetSyncingRequestSDKType, GetSyncingResponse, GetSyncingResponseSDKType, GetLatestBlockRequest, GetLatestBlockRequestSDKType, GetLatestBlockResponse, GetLatestBlockResponseSDKType, GetBlockByHeightRequest, GetBlockByHeightRequestSDKType, GetBlockByHeightResponse, GetBlockByHeightResponseSDKType, GetLatestValidatorSetRequest, GetLatestValidatorSetRequestSDKType, GetLatestValidatorSetResponse, GetLatestValidatorSetResponseSDKType, GetValidatorSetByHeightRequest, GetValidatorSetByHeightRequestSDKType, GetValidatorSetByHeightResponse, GetValidatorSetByHeightResponseSDKType } from "./query"; +/** + * GetNodeInfo queries the current node info. + * @name getGetNodeInfo + * @package cosmos.base.tendermint.v1beta1 + * @see proto service: cosmos.base.tendermint.v1beta1.GetNodeInfo + */ +export const getGetNodeInfo = buildQuery({ + encode: GetNodeInfoRequest.encode, + decode: GetNodeInfoResponse.decode, + service: "cosmos.base.tendermint.v1beta1.Service", + method: "GetNodeInfo" +}); +/** + * GetSyncing queries node syncing. + * @name getGetSyncing + * @package cosmos.base.tendermint.v1beta1 + * @see proto service: cosmos.base.tendermint.v1beta1.GetSyncing + */ +export const getGetSyncing = buildQuery({ + encode: GetSyncingRequest.encode, + decode: GetSyncingResponse.decode, + service: "cosmos.base.tendermint.v1beta1.Service", + method: "GetSyncing" +}); +/** + * GetLatestBlock returns the latest block. + * @name getGetLatestBlock + * @package cosmos.base.tendermint.v1beta1 + * @see proto service: cosmos.base.tendermint.v1beta1.GetLatestBlock + */ +export const getGetLatestBlock = buildQuery({ + encode: GetLatestBlockRequest.encode, + decode: GetLatestBlockResponse.decode, + service: "cosmos.base.tendermint.v1beta1.Service", + method: "GetLatestBlock" +}); +/** + * GetBlockByHeight queries block for given height. + * @name getGetBlockByHeight + * @package cosmos.base.tendermint.v1beta1 + * @see proto service: cosmos.base.tendermint.v1beta1.GetBlockByHeight + */ +export const getGetBlockByHeight = buildQuery({ + encode: GetBlockByHeightRequest.encode, + decode: GetBlockByHeightResponse.decode, + service: "cosmos.base.tendermint.v1beta1.Service", + method: "GetBlockByHeight" +}); +/** + * GetLatestValidatorSet queries latest validator-set. + * @name getGetLatestValidatorSet + * @package cosmos.base.tendermint.v1beta1 + * @see proto service: cosmos.base.tendermint.v1beta1.GetLatestValidatorSet + */ +export const getGetLatestValidatorSet = buildQuery({ + encode: GetLatestValidatorSetRequest.encode, + decode: GetLatestValidatorSetResponse.decode, + service: "cosmos.base.tendermint.v1beta1.Service", + method: "GetLatestValidatorSet" +}); +/** + * GetValidatorSetByHeight queries validator-set at a given height. + * @name getGetValidatorSetByHeight + * @package cosmos.base.tendermint.v1beta1 + * @see proto service: cosmos.base.tendermint.v1beta1.GetValidatorSetByHeight + */ +export const getGetValidatorSetByHeight = buildQuery({ + encode: GetValidatorSetByHeightRequest.encode, + decode: GetValidatorSetByHeightResponse.decode, + service: "cosmos.base.tendermint.v1beta1.Service", + method: "GetValidatorSetByHeight" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/base/v1beta1/coin.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/base/v1beta1/coin.ts index 73026f63d9..d1f6042f9a 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/base/v1beta1/coin.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/base/v1beta1/coin.ts @@ -1,7 +1,7 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; import { isSet, DeepPartial } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; -import { Decimal } from "@cosmjs/math"; +import { Decimal } from "@interchainjs/math"; export const protobufPackage = "cosmos.base.v1beta1"; /** * Coin defines a token with a denomination and an amount. @@ -322,7 +322,7 @@ export const DecCoin = { toAmino(message: DecCoin): DecCoinAmino { const obj: any = {}; obj.denom = message.denom === "" ? undefined : message.denom; - obj.amount = message.amount === "" ? undefined : message.amount; + obj.amount = message.amount === "" ? undefined : Decimal.fromUserInput(message.amount, 18).atomics; return obj; }, fromAminoMsg(object: DecCoinAminoMsg): DecCoin { @@ -522,7 +522,7 @@ export const DecProto = { }, toAmino(message: DecProto): DecProtoAmino { const obj: any = {}; - obj.dec = message.dec === "" ? undefined : message.dec; + obj.dec = message.dec === "" ? undefined : Decimal.fromUserInput(message.dec, 18).atomics; return obj; }, fromAminoMsg(object: DecProtoAminoMsg): DecProto { diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/bundle.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/bundle.ts index 43fd69eb5c..da6ada7a28 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/bundle.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/bundle.ts @@ -90,99 +90,134 @@ import * as _143 from "./upgrade/v1beta1/tx"; import * as _144 from "./upgrade/v1beta1/upgrade"; import * as _145 from "./vesting/v1beta1/tx"; import * as _146 from "./vesting/v1beta1/vesting"; -import * as _353 from "./authz/v1beta1/tx.amino"; -import * as _354 from "./bank/v1beta1/tx.amino"; -import * as _355 from "./crisis/v1beta1/tx.amino"; -import * as _356 from "./distribution/v1beta1/tx.amino"; -import * as _357 from "./evidence/v1beta1/tx.amino"; -import * as _358 from "./feegrant/v1beta1/tx.amino"; -import * as _359 from "./gov/v1/tx.amino"; -import * as _360 from "./gov/v1beta1/tx.amino"; -import * as _361 from "./group/v1/tx.amino"; -import * as _362 from "./nft/v1beta1/tx.amino"; -import * as _363 from "./slashing/v1beta1/tx.amino"; -import * as _364 from "./staking/v1beta1/tx.amino"; -import * as _365 from "./upgrade/v1beta1/tx.amino"; -import * as _366 from "./vesting/v1beta1/tx.amino"; -import * as _367 from "./authz/v1beta1/tx.registry"; -import * as _368 from "./bank/v1beta1/tx.registry"; -import * as _369 from "./crisis/v1beta1/tx.registry"; -import * as _370 from "./distribution/v1beta1/tx.registry"; -import * as _371 from "./evidence/v1beta1/tx.registry"; -import * as _372 from "./feegrant/v1beta1/tx.registry"; -import * as _373 from "./gov/v1/tx.registry"; -import * as _374 from "./gov/v1beta1/tx.registry"; -import * as _375 from "./group/v1/tx.registry"; -import * as _376 from "./nft/v1beta1/tx.registry"; -import * as _377 from "./slashing/v1beta1/tx.registry"; -import * as _378 from "./staking/v1beta1/tx.registry"; -import * as _379 from "./upgrade/v1beta1/tx.registry"; -import * as _380 from "./vesting/v1beta1/tx.registry"; -import * as _381 from "./auth/v1beta1/query.lcd"; -import * as _382 from "./authz/v1beta1/query.lcd"; -import * as _383 from "./bank/v1beta1/query.lcd"; -import * as _384 from "./base/reflection/v1beta1/reflection.lcd"; -import * as _385 from "./base/reflection/v2alpha1/reflection.lcd"; -import * as _386 from "./base/tendermint/v1beta1/query.lcd"; -import * as _387 from "./distribution/v1beta1/query.lcd"; -import * as _388 from "./evidence/v1beta1/query.lcd"; -import * as _389 from "./feegrant/v1beta1/query.lcd"; -import * as _390 from "./gov/v1/query.lcd"; -import * as _391 from "./gov/v1beta1/query.lcd"; -import * as _392 from "./group/v1/query.lcd"; -import * as _393 from "./mint/v1beta1/query.lcd"; -import * as _394 from "./nft/v1beta1/query.lcd"; -import * as _395 from "./params/v1beta1/query.lcd"; -import * as _396 from "./slashing/v1beta1/query.lcd"; -import * as _397 from "./staking/v1beta1/query.lcd"; -import * as _398 from "./tx/v1beta1/service.lcd"; -import * as _399 from "./upgrade/v1beta1/query.lcd"; -import * as _400 from "./app/v1alpha1/query.rpc.Query"; -import * as _401 from "./auth/v1beta1/query.rpc.Query"; -import * as _402 from "./authz/v1beta1/query.rpc.Query"; -import * as _403 from "./bank/v1beta1/query.rpc.Query"; -import * as _404 from "./base/reflection/v1beta1/reflection.rpc.ReflectionService"; -import * as _405 from "./base/reflection/v2alpha1/reflection.rpc.ReflectionService"; -import * as _406 from "./base/tendermint/v1beta1/query.rpc.Service"; -import * as _407 from "./distribution/v1beta1/query.rpc.Query"; -import * as _408 from "./evidence/v1beta1/query.rpc.Query"; -import * as _409 from "./feegrant/v1beta1/query.rpc.Query"; -import * as _410 from "./gov/v1/query.rpc.Query"; -import * as _411 from "./gov/v1beta1/query.rpc.Query"; -import * as _412 from "./group/v1/query.rpc.Query"; -import * as _413 from "./mint/v1beta1/query.rpc.Query"; -import * as _414 from "./nft/v1beta1/query.rpc.Query"; -import * as _415 from "./params/v1beta1/query.rpc.Query"; -import * as _416 from "./slashing/v1beta1/query.rpc.Query"; -import * as _417 from "./staking/v1beta1/query.rpc.Query"; -import * as _418 from "./tx/v1beta1/service.rpc.Service"; -import * as _419 from "./upgrade/v1beta1/query.rpc.Query"; -import * as _420 from "./authz/v1beta1/tx.rpc.msg"; -import * as _421 from "./bank/v1beta1/tx.rpc.msg"; -import * as _422 from "./crisis/v1beta1/tx.rpc.msg"; -import * as _423 from "./distribution/v1beta1/tx.rpc.msg"; -import * as _424 from "./evidence/v1beta1/tx.rpc.msg"; -import * as _425 from "./feegrant/v1beta1/tx.rpc.msg"; -import * as _426 from "./gov/v1/tx.rpc.msg"; -import * as _427 from "./gov/v1beta1/tx.rpc.msg"; -import * as _428 from "./group/v1/tx.rpc.msg"; -import * as _429 from "./nft/v1beta1/tx.rpc.msg"; -import * as _430 from "./slashing/v1beta1/tx.rpc.msg"; -import * as _431 from "./staking/v1beta1/tx.rpc.msg"; -import * as _432 from "./upgrade/v1beta1/tx.rpc.msg"; -import * as _433 from "./vesting/v1beta1/tx.rpc.msg"; -import * as _539 from "./lcd"; -import * as _540 from "./rpc.query"; -import * as _541 from "./cosmos-rpc-client.query"; -import * as _542 from "./rpc.tx"; -import * as _543 from "./cosmos-rpc-client.tx"; +import * as _369 from "./authz/v1beta1/tx.amino"; +import * as _370 from "./bank/v1beta1/tx.amino"; +import * as _371 from "./crisis/v1beta1/tx.amino"; +import * as _372 from "./distribution/v1beta1/tx.amino"; +import * as _373 from "./evidence/v1beta1/tx.amino"; +import * as _374 from "./feegrant/v1beta1/tx.amino"; +import * as _375 from "./gov/v1/tx.amino"; +import * as _376 from "./gov/v1beta1/tx.amino"; +import * as _377 from "./group/v1/tx.amino"; +import * as _378 from "./nft/v1beta1/tx.amino"; +import * as _379 from "./slashing/v1beta1/tx.amino"; +import * as _380 from "./staking/v1beta1/tx.amino"; +import * as _381 from "./upgrade/v1beta1/tx.amino"; +import * as _382 from "./vesting/v1beta1/tx.amino"; +import * as _383 from "./authz/v1beta1/tx.registry"; +import * as _384 from "./bank/v1beta1/tx.registry"; +import * as _385 from "./crisis/v1beta1/tx.registry"; +import * as _386 from "./distribution/v1beta1/tx.registry"; +import * as _387 from "./evidence/v1beta1/tx.registry"; +import * as _388 from "./feegrant/v1beta1/tx.registry"; +import * as _389 from "./gov/v1/tx.registry"; +import * as _390 from "./gov/v1beta1/tx.registry"; +import * as _391 from "./group/v1/tx.registry"; +import * as _392 from "./nft/v1beta1/tx.registry"; +import * as _393 from "./slashing/v1beta1/tx.registry"; +import * as _394 from "./staking/v1beta1/tx.registry"; +import * as _395 from "./upgrade/v1beta1/tx.registry"; +import * as _396 from "./vesting/v1beta1/tx.registry"; +import * as _397 from "./auth/v1beta1/query.lcd"; +import * as _398 from "./authz/v1beta1/query.lcd"; +import * as _399 from "./bank/v1beta1/query.lcd"; +import * as _400 from "./base/reflection/v1beta1/reflection.lcd"; +import * as _401 from "./base/reflection/v2alpha1/reflection.lcd"; +import * as _402 from "./base/tendermint/v1beta1/query.lcd"; +import * as _403 from "./distribution/v1beta1/query.lcd"; +import * as _404 from "./evidence/v1beta1/query.lcd"; +import * as _405 from "./feegrant/v1beta1/query.lcd"; +import * as _406 from "./gov/v1/query.lcd"; +import * as _407 from "./gov/v1beta1/query.lcd"; +import * as _408 from "./group/v1/query.lcd"; +import * as _409 from "./mint/v1beta1/query.lcd"; +import * as _410 from "./nft/v1beta1/query.lcd"; +import * as _411 from "./params/v1beta1/query.lcd"; +import * as _412 from "./slashing/v1beta1/query.lcd"; +import * as _413 from "./staking/v1beta1/query.lcd"; +import * as _414 from "./tx/v1beta1/service.lcd"; +import * as _415 from "./upgrade/v1beta1/query.lcd"; +import * as _416 from "./app/v1alpha1/query.rpc.func"; +import * as _417 from "./auth/v1beta1/query.rpc.func"; +import * as _418 from "./authz/v1beta1/query.rpc.func"; +import * as _419 from "./bank/v1beta1/query.rpc.func"; +import * as _420 from "./base/reflection/v1beta1/reflection.rpc.func"; +import * as _421 from "./base/reflection/v2alpha1/reflection.rpc.func"; +import * as _422 from "./base/tendermint/v1beta1/query.rpc.func"; +import * as _423 from "./distribution/v1beta1/query.rpc.func"; +import * as _424 from "./evidence/v1beta1/query.rpc.func"; +import * as _425 from "./feegrant/v1beta1/query.rpc.func"; +import * as _426 from "./gov/v1/query.rpc.func"; +import * as _427 from "./gov/v1beta1/query.rpc.func"; +import * as _428 from "./group/v1/query.rpc.func"; +import * as _429 from "./mint/v1beta1/query.rpc.func"; +import * as _430 from "./nft/v1beta1/query.rpc.func"; +import * as _431 from "./params/v1beta1/query.rpc.func"; +import * as _432 from "./slashing/v1beta1/query.rpc.func"; +import * as _433 from "./staking/v1beta1/query.rpc.func"; +import * as _434 from "./tx/v1beta1/service.rpc.func"; +import * as _435 from "./upgrade/v1beta1/query.rpc.func"; +import * as _436 from "./app/v1alpha1/query.rpc.Query"; +import * as _437 from "./auth/v1beta1/query.rpc.Query"; +import * as _438 from "./authz/v1beta1/query.rpc.Query"; +import * as _439 from "./bank/v1beta1/query.rpc.Query"; +import * as _440 from "./base/reflection/v1beta1/reflection.rpc.ReflectionService"; +import * as _441 from "./base/reflection/v2alpha1/reflection.rpc.ReflectionService"; +import * as _442 from "./base/tendermint/v1beta1/query.rpc.Service"; +import * as _443 from "./distribution/v1beta1/query.rpc.Query"; +import * as _444 from "./evidence/v1beta1/query.rpc.Query"; +import * as _445 from "./feegrant/v1beta1/query.rpc.Query"; +import * as _446 from "./gov/v1/query.rpc.Query"; +import * as _447 from "./gov/v1beta1/query.rpc.Query"; +import * as _448 from "./group/v1/query.rpc.Query"; +import * as _449 from "./mint/v1beta1/query.rpc.Query"; +import * as _450 from "./nft/v1beta1/query.rpc.Query"; +import * as _451 from "./params/v1beta1/query.rpc.Query"; +import * as _452 from "./slashing/v1beta1/query.rpc.Query"; +import * as _453 from "./staking/v1beta1/query.rpc.Query"; +import * as _454 from "./tx/v1beta1/service.rpc.Service"; +import * as _455 from "./upgrade/v1beta1/query.rpc.Query"; +import * as _456 from "./authz/v1beta1/tx.rpc.func"; +import * as _457 from "./bank/v1beta1/tx.rpc.func"; +import * as _458 from "./crisis/v1beta1/tx.rpc.func"; +import * as _459 from "./distribution/v1beta1/tx.rpc.func"; +import * as _460 from "./evidence/v1beta1/tx.rpc.func"; +import * as _461 from "./feegrant/v1beta1/tx.rpc.func"; +import * as _462 from "./gov/v1/tx.rpc.func"; +import * as _463 from "./gov/v1beta1/tx.rpc.func"; +import * as _464 from "./group/v1/tx.rpc.func"; +import * as _465 from "./nft/v1beta1/tx.rpc.func"; +import * as _466 from "./slashing/v1beta1/tx.rpc.func"; +import * as _467 from "./staking/v1beta1/tx.rpc.func"; +import * as _468 from "./upgrade/v1beta1/tx.rpc.func"; +import * as _469 from "./vesting/v1beta1/tx.rpc.func"; +import * as _470 from "./authz/v1beta1/tx.rpc.msg"; +import * as _471 from "./bank/v1beta1/tx.rpc.msg"; +import * as _472 from "./crisis/v1beta1/tx.rpc.msg"; +import * as _473 from "./distribution/v1beta1/tx.rpc.msg"; +import * as _474 from "./evidence/v1beta1/tx.rpc.msg"; +import * as _475 from "./feegrant/v1beta1/tx.rpc.msg"; +import * as _476 from "./gov/v1/tx.rpc.msg"; +import * as _477 from "./gov/v1beta1/tx.rpc.msg"; +import * as _478 from "./group/v1/tx.rpc.msg"; +import * as _479 from "./nft/v1beta1/tx.rpc.msg"; +import * as _480 from "./slashing/v1beta1/tx.rpc.msg"; +import * as _481 from "./staking/v1beta1/tx.rpc.msg"; +import * as _482 from "./upgrade/v1beta1/tx.rpc.msg"; +import * as _483 from "./vesting/v1beta1/tx.rpc.msg"; +import * as _632 from "./lcd"; +import * as _633 from "./rpc.query"; +import * as _634 from "./cosmos-rpc-client.query"; +import * as _635 from "./rpc.tx"; +import * as _636 from "./cosmos-rpc-client.tx"; export namespace cosmos { export namespace app { export const v1alpha1 = { ..._55, ..._56, ..._57, - ..._400 + ..._416, + ..._436 }; } export namespace auth { @@ -190,8 +225,9 @@ export namespace cosmos { ..._58, ..._59, ..._60, - ..._381, - ..._401 + ..._397, + ..._417, + ..._437 }; } export namespace authz { @@ -200,11 +236,13 @@ export namespace cosmos { ..._62, ..._63, ..._64, - ..._353, - ..._367, - ..._382, - ..._402, - ..._420 + ..._369, + ..._383, + ..._398, + ..._418, + ..._438, + ..._456, + ..._470 }; } export namespace bank { @@ -214,11 +252,13 @@ export namespace cosmos { ..._67, ..._68, ..._69, - ..._354, - ..._368, - ..._383, - ..._403, - ..._421 + ..._370, + ..._384, + ..._399, + ..._419, + ..._439, + ..._457, + ..._471 }; } export namespace base { @@ -240,13 +280,15 @@ export namespace cosmos { export namespace reflection { export const v1beta1 = { ..._73, - ..._384, - ..._404 + ..._400, + ..._420, + ..._440 }; export const v2alpha1 = { ..._74, - ..._385, - ..._405 + ..._401, + ..._421, + ..._441 }; } export namespace snapshots { @@ -263,8 +305,9 @@ export namespace cosmos { export namespace tendermint { export const v1beta1 = { ..._78, - ..._386, - ..._406 + ..._402, + ..._422, + ..._442 }; } export const v1beta1 = { @@ -281,9 +324,10 @@ export namespace cosmos { export const v1beta1 = { ..._82, ..._83, - ..._355, - ..._369, - ..._422 + ..._371, + ..._385, + ..._458, + ..._472 }; } export namespace crypto { @@ -316,11 +360,13 @@ export namespace cosmos { ..._91, ..._92, ..._93, - ..._356, - ..._370, - ..._387, - ..._407, - ..._423 + ..._372, + ..._386, + ..._403, + ..._423, + ..._443, + ..._459, + ..._473 }; } export namespace evidence { @@ -329,11 +375,13 @@ export namespace cosmos { ..._95, ..._96, ..._97, - ..._357, - ..._371, - ..._388, - ..._408, - ..._424 + ..._373, + ..._387, + ..._404, + ..._424, + ..._444, + ..._460, + ..._474 }; } export namespace feegrant { @@ -342,11 +390,13 @@ export namespace cosmos { ..._99, ..._100, ..._101, - ..._358, - ..._372, - ..._389, - ..._409, - ..._425 + ..._374, + ..._388, + ..._405, + ..._425, + ..._445, + ..._461, + ..._475 }; } export namespace genutil { @@ -360,22 +410,26 @@ export namespace cosmos { ..._104, ..._105, ..._106, - ..._359, - ..._373, - ..._390, - ..._410, - ..._426 + ..._375, + ..._389, + ..._406, + ..._426, + ..._446, + ..._462, + ..._476 }; export const v1beta1 = { ..._107, ..._108, ..._109, ..._110, - ..._360, - ..._374, - ..._391, - ..._411, - ..._427 + ..._376, + ..._390, + ..._407, + ..._427, + ..._447, + ..._463, + ..._477 }; } export namespace group { @@ -385,11 +439,13 @@ export namespace cosmos { ..._113, ..._114, ..._115, - ..._361, - ..._375, - ..._392, - ..._412, - ..._428 + ..._377, + ..._391, + ..._408, + ..._428, + ..._448, + ..._464, + ..._478 }; } export namespace mint { @@ -397,8 +453,9 @@ export namespace cosmos { ..._116, ..._117, ..._118, - ..._393, - ..._413 + ..._409, + ..._429, + ..._449 }; } export namespace msg { @@ -413,11 +470,13 @@ export namespace cosmos { ..._122, ..._123, ..._124, - ..._362, - ..._376, - ..._394, - ..._414, - ..._429 + ..._378, + ..._392, + ..._410, + ..._430, + ..._450, + ..._465, + ..._479 }; } export namespace orm { @@ -437,8 +496,9 @@ export namespace cosmos { export const v1beta1 = { ..._128, ..._129, - ..._395, - ..._415 + ..._411, + ..._431, + ..._451 }; } export namespace slashing { @@ -447,11 +507,13 @@ export namespace cosmos { ..._131, ..._132, ..._133, - ..._363, - ..._377, - ..._396, - ..._416, - ..._430 + ..._379, + ..._393, + ..._412, + ..._432, + ..._452, + ..._466, + ..._480 }; } export namespace staking { @@ -461,11 +523,13 @@ export namespace cosmos { ..._136, ..._137, ..._138, - ..._364, - ..._378, - ..._397, - ..._417, - ..._431 + ..._380, + ..._394, + ..._413, + ..._433, + ..._453, + ..._467, + ..._481 }; } export namespace tx { @@ -477,8 +541,9 @@ export namespace cosmos { export const v1beta1 = { ..._140, ..._141, - ..._398, - ..._418 + ..._414, + ..._434, + ..._454 }; } export namespace upgrade { @@ -486,27 +551,30 @@ export namespace cosmos { ..._142, ..._143, ..._144, - ..._365, - ..._379, - ..._399, - ..._419, - ..._432 + ..._381, + ..._395, + ..._415, + ..._435, + ..._455, + ..._468, + ..._482 }; } export namespace vesting { export const v1beta1 = { ..._145, ..._146, - ..._366, - ..._380, - ..._433 + ..._382, + ..._396, + ..._469, + ..._483 }; } export const ClientFactory = { - ..._539, - ..._540, - ..._541, - ..._542, - ..._543 + ..._632, + ..._633, + ..._634, + ..._635, + ..._636 }; } \ No newline at end of file diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/crisis/v1beta1/tx.registry.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/crisis/v1beta1/tx.registry.ts index 94d4a2c1c4..58c31ab80e 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/crisis/v1beta1/tx.registry.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/crisis/v1beta1/tx.registry.ts @@ -1,12 +1,6 @@ import { TelescopeGeneratedType } from "../../../types"; -import { Registry } from "@cosmjs/proto-signing"; import { MsgVerifyInvariant, MsgVerifyInvariantSDKType } from "./tx"; export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/cosmos.crisis.v1beta1.MsgVerifyInvariant", MsgVerifyInvariant]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; export const MessageComposer = { encoded: { verifyInvariant(value: MsgVerifyInvariant) { diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/crisis/v1beta1/tx.rpc.func.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/crisis/v1beta1/tx.rpc.func.ts new file mode 100644 index 0000000000..da292c9a67 --- /dev/null +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/crisis/v1beta1/tx.rpc.func.ts @@ -0,0 +1,11 @@ +import { buildTx } from "../../../helper-func-types"; +import { MsgVerifyInvariant, MsgVerifyInvariantSDKType, MsgVerifyInvariantResponse, MsgVerifyInvariantResponseSDKType } from "./tx"; +/** + * VerifyInvariant defines a method to verify a particular invariance. + * @name verifyInvariant + * @package cosmos.crisis.v1beta1 + * @see proto service: cosmos.crisis.v1beta1.VerifyInvariant + */ +export const verifyInvariant = buildTx({ + msg: MsgVerifyInvariant +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/crisis/v1beta1/tx.rpc.msg.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/crisis/v1beta1/tx.rpc.msg.ts index ebfe1dc331..4b61b91444 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/crisis/v1beta1/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/crisis/v1beta1/tx.rpc.msg.ts @@ -1,4 +1,5 @@ -import { DeliverTxResponse, StdFee, TxRpc } from "../../../types"; +import { DeliverTxResponse } from "@interchainjs/types"; +import { StdFee, TxRpc } from "../../../types"; import { BinaryReader } from "../../../binary"; import { MsgVerifyInvariant, MsgVerifyInvariantSDKType, MsgVerifyInvariantResponse, MsgVerifyInvariantResponseSDKType } from "./tx"; /** Msg defines the bank Msg service. */ diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/distribution/v1beta1/distribution.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/distribution/v1beta1/distribution.ts index 18ce6caeae..32000ebc0b 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/distribution/v1beta1/distribution.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/distribution/v1beta1/distribution.ts @@ -1,6 +1,6 @@ import { DecCoin, DecCoinSDKType, Coin, CoinSDKType } from "../../base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { Decimal } from "@cosmjs/math"; +import { Decimal } from "@interchainjs/math"; import { isSet, DeepPartial } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "cosmos.distribution.v1beta1"; @@ -477,9 +477,9 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.community_tax = message.communityTax === "" ? undefined : message.communityTax; - obj.base_proposer_reward = message.baseProposerReward === "" ? undefined : message.baseProposerReward; - obj.bonus_proposer_reward = message.bonusProposerReward === "" ? undefined : message.bonusProposerReward; + obj.community_tax = message.communityTax === "" ? undefined : Decimal.fromUserInput(message.communityTax, 18).atomics; + obj.base_proposer_reward = message.baseProposerReward === "" ? undefined : Decimal.fromUserInput(message.baseProposerReward, 18).atomics; + obj.bonus_proposer_reward = message.bonusProposerReward === "" ? undefined : Decimal.fromUserInput(message.bonusProposerReward, 18).atomics; obj.withdraw_addr_enabled = message.withdrawAddrEnabled === false ? undefined : message.withdrawAddrEnabled; return obj; }, @@ -1093,7 +1093,7 @@ export const ValidatorSlashEvent = { toAmino(message: ValidatorSlashEvent): ValidatorSlashEventAmino { const obj: any = {}; obj.validator_period = message.validatorPeriod !== BigInt(0) ? message.validatorPeriod?.toString() : undefined; - obj.fraction = message.fraction === "" ? undefined : message.fraction; + obj.fraction = message.fraction === "" ? undefined : Decimal.fromUserInput(message.fraction, 18).atomics; return obj; }, fromAminoMsg(object: ValidatorSlashEventAminoMsg): ValidatorSlashEvent { @@ -1618,7 +1618,7 @@ export const DelegatorStartingInfo = { toAmino(message: DelegatorStartingInfo): DelegatorStartingInfoAmino { const obj: any = {}; obj.previous_period = message.previousPeriod !== BigInt(0) ? message.previousPeriod?.toString() : undefined; - obj.stake = message.stake === "" ? undefined : message.stake; + obj.stake = message.stake === "" ? undefined : Decimal.fromUserInput(message.stake, 18).atomics; obj.height = message.height ? message.height?.toString() : "0"; return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/distribution/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/distribution/v1beta1/query.rpc.func.ts new file mode 100644 index 0000000000..7283b1ff84 --- /dev/null +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/distribution/v1beta1/query.rpc.func.ts @@ -0,0 +1,114 @@ +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; +import { Params, ParamsSDKType, ValidatorOutstandingRewards, ValidatorOutstandingRewardsSDKType, ValidatorAccumulatedCommission, ValidatorAccumulatedCommissionSDKType, ValidatorSlashEvent, ValidatorSlashEventSDKType, DelegationDelegatorReward, DelegationDelegatorRewardSDKType } from "./distribution"; +import { DecCoin, DecCoinSDKType } from "../../base/v1beta1/coin"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, QueryValidatorOutstandingRewardsRequest, QueryValidatorOutstandingRewardsRequestSDKType, QueryValidatorOutstandingRewardsResponse, QueryValidatorOutstandingRewardsResponseSDKType, QueryValidatorCommissionRequest, QueryValidatorCommissionRequestSDKType, QueryValidatorCommissionResponse, QueryValidatorCommissionResponseSDKType, QueryValidatorSlashesRequest, QueryValidatorSlashesRequestSDKType, QueryValidatorSlashesResponse, QueryValidatorSlashesResponseSDKType, QueryDelegationRewardsRequest, QueryDelegationRewardsRequestSDKType, QueryDelegationRewardsResponse, QueryDelegationRewardsResponseSDKType, QueryDelegationTotalRewardsRequest, QueryDelegationTotalRewardsRequestSDKType, QueryDelegationTotalRewardsResponse, QueryDelegationTotalRewardsResponseSDKType, QueryDelegatorValidatorsRequest, QueryDelegatorValidatorsRequestSDKType, QueryDelegatorValidatorsResponse, QueryDelegatorValidatorsResponseSDKType, QueryDelegatorWithdrawAddressRequest, QueryDelegatorWithdrawAddressRequestSDKType, QueryDelegatorWithdrawAddressResponse, QueryDelegatorWithdrawAddressResponseSDKType, QueryCommunityPoolRequest, QueryCommunityPoolRequestSDKType, QueryCommunityPoolResponse, QueryCommunityPoolResponseSDKType } from "./query"; +/** + * Params queries params of the distribution module. + * @name getParams + * @package cosmos.distribution.v1beta1 + * @see proto service: cosmos.distribution.v1beta1.Params + */ +export const getParams = buildQuery({ + encode: QueryParamsRequest.encode, + decode: QueryParamsResponse.decode, + service: "cosmos.distribution.v1beta1.Query", + method: "Params" +}); +/** + * ValidatorOutstandingRewards queries rewards of a validator address. + * @name getValidatorOutstandingRewards + * @package cosmos.distribution.v1beta1 + * @see proto service: cosmos.distribution.v1beta1.ValidatorOutstandingRewards + */ +export const getValidatorOutstandingRewards = buildQuery({ + encode: QueryValidatorOutstandingRewardsRequest.encode, + decode: QueryValidatorOutstandingRewardsResponse.decode, + service: "cosmos.distribution.v1beta1.Query", + method: "ValidatorOutstandingRewards" +}); +/** + * ValidatorCommission queries accumulated commission for a validator. + * @name getValidatorCommission + * @package cosmos.distribution.v1beta1 + * @see proto service: cosmos.distribution.v1beta1.ValidatorCommission + */ +export const getValidatorCommission = buildQuery({ + encode: QueryValidatorCommissionRequest.encode, + decode: QueryValidatorCommissionResponse.decode, + service: "cosmos.distribution.v1beta1.Query", + method: "ValidatorCommission" +}); +/** + * ValidatorSlashes queries slash events of a validator. + * @name getValidatorSlashes + * @package cosmos.distribution.v1beta1 + * @see proto service: cosmos.distribution.v1beta1.ValidatorSlashes + */ +export const getValidatorSlashes = buildQuery({ + encode: QueryValidatorSlashesRequest.encode, + decode: QueryValidatorSlashesResponse.decode, + service: "cosmos.distribution.v1beta1.Query", + method: "ValidatorSlashes" +}); +/** + * DelegationRewards queries the total rewards accrued by a delegation. + * @name getDelegationRewards + * @package cosmos.distribution.v1beta1 + * @see proto service: cosmos.distribution.v1beta1.DelegationRewards + */ +export const getDelegationRewards = buildQuery({ + encode: QueryDelegationRewardsRequest.encode, + decode: QueryDelegationRewardsResponse.decode, + service: "cosmos.distribution.v1beta1.Query", + method: "DelegationRewards" +}); +/** + * DelegationTotalRewards queries the total rewards accrued by a each + * validator. + * @name getDelegationTotalRewards + * @package cosmos.distribution.v1beta1 + * @see proto service: cosmos.distribution.v1beta1.DelegationTotalRewards + */ +export const getDelegationTotalRewards = buildQuery({ + encode: QueryDelegationTotalRewardsRequest.encode, + decode: QueryDelegationTotalRewardsResponse.decode, + service: "cosmos.distribution.v1beta1.Query", + method: "DelegationTotalRewards" +}); +/** + * DelegatorValidators queries the validators of a delegator. + * @name getDelegatorValidators + * @package cosmos.distribution.v1beta1 + * @see proto service: cosmos.distribution.v1beta1.DelegatorValidators + */ +export const getDelegatorValidators = buildQuery({ + encode: QueryDelegatorValidatorsRequest.encode, + decode: QueryDelegatorValidatorsResponse.decode, + service: "cosmos.distribution.v1beta1.Query", + method: "DelegatorValidators" +}); +/** + * DelegatorWithdrawAddress queries withdraw address of a delegator. + * @name getDelegatorWithdrawAddress + * @package cosmos.distribution.v1beta1 + * @see proto service: cosmos.distribution.v1beta1.DelegatorWithdrawAddress + */ +export const getDelegatorWithdrawAddress = buildQuery({ + encode: QueryDelegatorWithdrawAddressRequest.encode, + decode: QueryDelegatorWithdrawAddressResponse.decode, + service: "cosmos.distribution.v1beta1.Query", + method: "DelegatorWithdrawAddress" +}); +/** + * CommunityPool queries the community pool coins. + * @name getCommunityPool + * @package cosmos.distribution.v1beta1 + * @see proto service: cosmos.distribution.v1beta1.CommunityPool + */ +export const getCommunityPool = buildQuery({ + encode: QueryCommunityPoolRequest.encode, + decode: QueryCommunityPoolResponse.decode, + service: "cosmos.distribution.v1beta1.Query", + method: "CommunityPool" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/distribution/v1beta1/tx.registry.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/distribution/v1beta1/tx.registry.ts index 87f63ed6a3..b332aef187 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/distribution/v1beta1/tx.registry.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/distribution/v1beta1/tx.registry.ts @@ -1,13 +1,7 @@ import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; import { TelescopeGeneratedType } from "../../../types"; -import { Registry } from "@cosmjs/proto-signing"; import { MsgSetWithdrawAddress, MsgSetWithdrawAddressSDKType, MsgWithdrawDelegatorReward, MsgWithdrawDelegatorRewardSDKType, MsgWithdrawValidatorCommission, MsgWithdrawValidatorCommissionSDKType, MsgFundCommunityPool, MsgFundCommunityPoolSDKType } from "./tx"; export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/cosmos.distribution.v1beta1.MsgSetWithdrawAddress", MsgSetWithdrawAddress], ["/cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward", MsgWithdrawDelegatorReward], ["/cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission", MsgWithdrawValidatorCommission], ["/cosmos.distribution.v1beta1.MsgFundCommunityPool", MsgFundCommunityPool]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; export const MessageComposer = { encoded: { setWithdrawAddress(value: MsgSetWithdrawAddress) { diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/distribution/v1beta1/tx.rpc.func.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/distribution/v1beta1/tx.rpc.func.ts new file mode 100644 index 0000000000..27ee8a8714 --- /dev/null +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/distribution/v1beta1/tx.rpc.func.ts @@ -0,0 +1,43 @@ +import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; +import { buildTx } from "../../../helper-func-types"; +import { MsgSetWithdrawAddress, MsgSetWithdrawAddressSDKType, MsgSetWithdrawAddressResponse, MsgSetWithdrawAddressResponseSDKType, MsgWithdrawDelegatorReward, MsgWithdrawDelegatorRewardSDKType, MsgWithdrawDelegatorRewardResponse, MsgWithdrawDelegatorRewardResponseSDKType, MsgWithdrawValidatorCommission, MsgWithdrawValidatorCommissionSDKType, MsgWithdrawValidatorCommissionResponse, MsgWithdrawValidatorCommissionResponseSDKType, MsgFundCommunityPool, MsgFundCommunityPoolSDKType, MsgFundCommunityPoolResponse, MsgFundCommunityPoolResponseSDKType } from "./tx"; +/** + * SetWithdrawAddress defines a method to change the withdraw address + * for a delegator (or validator self-delegation). + * @name setWithdrawAddress + * @package cosmos.distribution.v1beta1 + * @see proto service: cosmos.distribution.v1beta1.SetWithdrawAddress + */ +export const setWithdrawAddress = buildTx({ + msg: MsgSetWithdrawAddress +}); +/** + * WithdrawDelegatorReward defines a method to withdraw rewards of delegator + * from a single validator. + * @name withdrawDelegatorReward + * @package cosmos.distribution.v1beta1 + * @see proto service: cosmos.distribution.v1beta1.WithdrawDelegatorReward + */ +export const withdrawDelegatorReward = buildTx({ + msg: MsgWithdrawDelegatorReward +}); +/** + * WithdrawValidatorCommission defines a method to withdraw the + * full commission to the validator address. + * @name withdrawValidatorCommission + * @package cosmos.distribution.v1beta1 + * @see proto service: cosmos.distribution.v1beta1.WithdrawValidatorCommission + */ +export const withdrawValidatorCommission = buildTx({ + msg: MsgWithdrawValidatorCommission +}); +/** + * FundCommunityPool defines a method to allow an account to directly + * fund the community pool. + * @name fundCommunityPool + * @package cosmos.distribution.v1beta1 + * @see proto service: cosmos.distribution.v1beta1.FundCommunityPool + */ +export const fundCommunityPool = buildTx({ + msg: MsgFundCommunityPool +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/distribution/v1beta1/tx.rpc.msg.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/distribution/v1beta1/tx.rpc.msg.ts index dd04785c14..568ad47671 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/distribution/v1beta1/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/distribution/v1beta1/tx.rpc.msg.ts @@ -1,5 +1,6 @@ import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; -import { DeliverTxResponse, StdFee, TxRpc } from "../../../types"; +import { DeliverTxResponse } from "@interchainjs/types"; +import { StdFee, TxRpc } from "../../../types"; import { BinaryReader } from "../../../binary"; import { MsgSetWithdrawAddress, MsgSetWithdrawAddressSDKType, MsgSetWithdrawAddressResponse, MsgSetWithdrawAddressResponseSDKType, MsgWithdrawDelegatorReward, MsgWithdrawDelegatorRewardSDKType, MsgWithdrawDelegatorRewardResponse, MsgWithdrawDelegatorRewardResponseSDKType, MsgWithdrawValidatorCommission, MsgWithdrawValidatorCommissionSDKType, MsgWithdrawValidatorCommissionResponse, MsgWithdrawValidatorCommissionResponseSDKType, MsgFundCommunityPool, MsgFundCommunityPoolSDKType, MsgFundCommunityPoolResponse, MsgFundCommunityPoolResponseSDKType } from "./tx"; /** Msg defines the distribution Msg service. */ diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/evidence/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/evidence/v1beta1/query.rpc.func.ts new file mode 100644 index 0000000000..57423e9da7 --- /dev/null +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/evidence/v1beta1/query.rpc.func.ts @@ -0,0 +1,28 @@ +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; +import { Any, AnySDKType } from "../../../google/protobuf/any"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { QueryEvidenceRequest, QueryEvidenceRequestSDKType, QueryEvidenceResponse, QueryEvidenceResponseSDKType, QueryAllEvidenceRequest, QueryAllEvidenceRequestSDKType, QueryAllEvidenceResponse, QueryAllEvidenceResponseSDKType } from "./query"; +/** + * Evidence queries evidence based on evidence hash. + * @name getEvidence + * @package cosmos.evidence.v1beta1 + * @see proto service: cosmos.evidence.v1beta1.Evidence + */ +export const getEvidence = buildQuery({ + encode: QueryEvidenceRequest.encode, + decode: QueryEvidenceResponse.decode, + service: "cosmos.evidence.v1beta1.Query", + method: "Evidence" +}); +/** + * AllEvidence queries all evidence. + * @name getAllEvidence + * @package cosmos.evidence.v1beta1 + * @see proto service: cosmos.evidence.v1beta1.AllEvidence + */ +export const getAllEvidence = buildQuery({ + encode: QueryAllEvidenceRequest.encode, + decode: QueryAllEvidenceResponse.decode, + service: "cosmos.evidence.v1beta1.Query", + method: "AllEvidence" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/evidence/v1beta1/tx.registry.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/evidence/v1beta1/tx.registry.ts index f44772afdf..160f7f990a 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/evidence/v1beta1/tx.registry.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/evidence/v1beta1/tx.registry.ts @@ -1,13 +1,7 @@ import { Any, AnySDKType } from "../../../google/protobuf/any"; import { TelescopeGeneratedType } from "../../../types"; -import { Registry } from "@cosmjs/proto-signing"; import { MsgSubmitEvidence, MsgSubmitEvidenceSDKType } from "./tx"; export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/cosmos.evidence.v1beta1.MsgSubmitEvidence", MsgSubmitEvidence]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; export const MessageComposer = { encoded: { submitEvidence(value: MsgSubmitEvidence) { diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/evidence/v1beta1/tx.rpc.func.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/evidence/v1beta1/tx.rpc.func.ts new file mode 100644 index 0000000000..53a16e4bcd --- /dev/null +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/evidence/v1beta1/tx.rpc.func.ts @@ -0,0 +1,13 @@ +import { Any, AnySDKType } from "../../../google/protobuf/any"; +import { buildTx } from "../../../helper-func-types"; +import { MsgSubmitEvidence, MsgSubmitEvidenceSDKType, MsgSubmitEvidenceResponse, MsgSubmitEvidenceResponseSDKType } from "./tx"; +/** + * SubmitEvidence submits an arbitrary Evidence of misbehavior such as equivocation or + * counterfactual signing. + * @name submitEvidence + * @package cosmos.evidence.v1beta1 + * @see proto service: cosmos.evidence.v1beta1.SubmitEvidence + */ +export const submitEvidence = buildTx({ + msg: MsgSubmitEvidence +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/evidence/v1beta1/tx.rpc.msg.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/evidence/v1beta1/tx.rpc.msg.ts index 891bd8ce7c..238e7561a8 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/evidence/v1beta1/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/evidence/v1beta1/tx.rpc.msg.ts @@ -1,5 +1,6 @@ import { Any, AnySDKType } from "../../../google/protobuf/any"; -import { DeliverTxResponse, StdFee, TxRpc } from "../../../types"; +import { DeliverTxResponse } from "@interchainjs/types"; +import { StdFee, TxRpc } from "../../../types"; import { BinaryReader } from "../../../binary"; import { MsgSubmitEvidence, MsgSubmitEvidenceSDKType, MsgSubmitEvidenceResponse, MsgSubmitEvidenceResponseSDKType } from "./tx"; /** Msg defines the evidence Msg service. */ diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/feegrant/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/feegrant/v1beta1/query.rpc.func.ts new file mode 100644 index 0000000000..3f0bea649a --- /dev/null +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/feegrant/v1beta1/query.rpc.func.ts @@ -0,0 +1,41 @@ +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; +import { Grant, GrantSDKType } from "./feegrant"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { QueryAllowanceRequest, QueryAllowanceRequestSDKType, QueryAllowanceResponse, QueryAllowanceResponseSDKType, QueryAllowancesRequest, QueryAllowancesRequestSDKType, QueryAllowancesResponse, QueryAllowancesResponseSDKType, QueryAllowancesByGranterRequest, QueryAllowancesByGranterRequestSDKType, QueryAllowancesByGranterResponse, QueryAllowancesByGranterResponseSDKType } from "./query"; +/** + * Allowance returns fee granted to the grantee by the granter. + * @name getAllowance + * @package cosmos.feegrant.v1beta1 + * @see proto service: cosmos.feegrant.v1beta1.Allowance + */ +export const getAllowance = buildQuery({ + encode: QueryAllowanceRequest.encode, + decode: QueryAllowanceResponse.decode, + service: "cosmos.feegrant.v1beta1.Query", + method: "Allowance" +}); +/** + * Allowances returns all the grants for address. + * @name getAllowances + * @package cosmos.feegrant.v1beta1 + * @see proto service: cosmos.feegrant.v1beta1.Allowances + */ +export const getAllowances = buildQuery({ + encode: QueryAllowancesRequest.encode, + decode: QueryAllowancesResponse.decode, + service: "cosmos.feegrant.v1beta1.Query", + method: "Allowances" +}); +/** + * AllowancesByGranter returns all the grants given by an address + * Since v0.46 + * @name getAllowancesByGranter + * @package cosmos.feegrant.v1beta1 + * @see proto service: cosmos.feegrant.v1beta1.AllowancesByGranter + */ +export const getAllowancesByGranter = buildQuery({ + encode: QueryAllowancesByGranterRequest.encode, + decode: QueryAllowancesByGranterResponse.decode, + service: "cosmos.feegrant.v1beta1.Query", + method: "AllowancesByGranter" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/feegrant/v1beta1/tx.registry.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/feegrant/v1beta1/tx.registry.ts index 9192b73524..e850beebad 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/feegrant/v1beta1/tx.registry.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/feegrant/v1beta1/tx.registry.ts @@ -1,13 +1,7 @@ import { Any, AnySDKType } from "../../../google/protobuf/any"; import { TelescopeGeneratedType } from "../../../types"; -import { Registry } from "@cosmjs/proto-signing"; import { MsgGrantAllowance, MsgGrantAllowanceSDKType, MsgRevokeAllowance, MsgRevokeAllowanceSDKType } from "./tx"; export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/cosmos.feegrant.v1beta1.MsgGrantAllowance", MsgGrantAllowance], ["/cosmos.feegrant.v1beta1.MsgRevokeAllowance", MsgRevokeAllowance]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; export const MessageComposer = { encoded: { grantAllowance(value: MsgGrantAllowance) { diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/feegrant/v1beta1/tx.rpc.func.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/feegrant/v1beta1/tx.rpc.func.ts new file mode 100644 index 0000000000..fdeebec5ab --- /dev/null +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/feegrant/v1beta1/tx.rpc.func.ts @@ -0,0 +1,23 @@ +import { Any, AnySDKType } from "../../../google/protobuf/any"; +import { buildTx } from "../../../helper-func-types"; +import { MsgGrantAllowance, MsgGrantAllowanceSDKType, MsgGrantAllowanceResponse, MsgGrantAllowanceResponseSDKType, MsgRevokeAllowance, MsgRevokeAllowanceSDKType, MsgRevokeAllowanceResponse, MsgRevokeAllowanceResponseSDKType } from "./tx"; +/** + * GrantAllowance grants fee allowance to the grantee on the granter's + * account with the provided expiration time. + * @name grantAllowance + * @package cosmos.feegrant.v1beta1 + * @see proto service: cosmos.feegrant.v1beta1.GrantAllowance + */ +export const grantAllowance = buildTx({ + msg: MsgGrantAllowance +}); +/** + * RevokeAllowance revokes any fee allowance of granter's account that + * has been granted to the grantee. + * @name revokeAllowance + * @package cosmos.feegrant.v1beta1 + * @see proto service: cosmos.feegrant.v1beta1.RevokeAllowance + */ +export const revokeAllowance = buildTx({ + msg: MsgRevokeAllowance +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/feegrant/v1beta1/tx.rpc.msg.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/feegrant/v1beta1/tx.rpc.msg.ts index 3d8fadd55e..eaf851c508 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/feegrant/v1beta1/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/feegrant/v1beta1/tx.rpc.msg.ts @@ -1,5 +1,6 @@ import { Any, AnySDKType } from "../../../google/protobuf/any"; -import { DeliverTxResponse, StdFee, TxRpc } from "../../../types"; +import { DeliverTxResponse } from "@interchainjs/types"; +import { StdFee, TxRpc } from "../../../types"; import { BinaryReader } from "../../../binary"; import { MsgGrantAllowance, MsgGrantAllowanceSDKType, MsgGrantAllowanceResponse, MsgGrantAllowanceResponseSDKType, MsgRevokeAllowance, MsgRevokeAllowanceSDKType, MsgRevokeAllowanceResponse, MsgRevokeAllowanceResponseSDKType } from "./tx"; /** Msg defines the feegrant msg service. */ diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/gov/v1/query.rpc.func.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/gov/v1/query.rpc.func.ts new file mode 100644 index 0000000000..72ca1d7f03 --- /dev/null +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/gov/v1/query.rpc.func.ts @@ -0,0 +1,100 @@ +import { ProposalStatus, ProposalStatusSDKType, Proposal, ProposalSDKType, Vote, VoteSDKType, VotingParams, VotingParamsSDKType, DepositParams, DepositParamsSDKType, TallyParams, TallyParamsSDKType, Deposit, DepositSDKType, TallyResult, TallyResultSDKType } from "./gov"; +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +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"; +/** + * Proposal queries proposal details based on ProposalID. + * @name getProposal + * @package cosmos.gov.v1 + * @see proto service: cosmos.gov.v1.Proposal + */ +export const getProposal = buildQuery({ + encode: QueryProposalRequest.encode, + decode: QueryProposalResponse.decode, + service: "cosmos.gov.v1.Query", + method: "Proposal" +}); +/** + * Proposals queries all proposals based on given status. + * @name getProposals + * @package cosmos.gov.v1 + * @see proto service: cosmos.gov.v1.Proposals + */ +export const getProposals = buildQuery({ + encode: QueryProposalsRequest.encode, + decode: QueryProposalsResponse.decode, + service: "cosmos.gov.v1.Query", + method: "Proposals" +}); +/** + * Vote queries voted information based on proposalID, voterAddr. + * @name getVote + * @package cosmos.gov.v1 + * @see proto service: cosmos.gov.v1.Vote + */ +export const getVote = buildQuery({ + encode: QueryVoteRequest.encode, + decode: QueryVoteResponse.decode, + service: "cosmos.gov.v1.Query", + method: "Vote" +}); +/** + * Votes queries votes of a given proposal. + * @name getVotes + * @package cosmos.gov.v1 + * @see proto service: cosmos.gov.v1.Votes + */ +export const getVotes = buildQuery({ + encode: QueryVotesRequest.encode, + decode: QueryVotesResponse.decode, + service: "cosmos.gov.v1.Query", + method: "Votes" +}); +/** + * Params queries all parameters of the gov module. + * @name getParams + * @package cosmos.gov.v1 + * @see proto service: cosmos.gov.v1.Params + */ +export const getParams = buildQuery({ + encode: QueryParamsRequest.encode, + decode: QueryParamsResponse.decode, + service: "cosmos.gov.v1.Query", + method: "Params" +}); +/** + * Deposit queries single deposit information based proposalID, depositAddr. + * @name getDeposit + * @package cosmos.gov.v1 + * @see proto service: cosmos.gov.v1.Deposit + */ +export const getDeposit = buildQuery({ + encode: QueryDepositRequest.encode, + decode: QueryDepositResponse.decode, + service: "cosmos.gov.v1.Query", + method: "Deposit" +}); +/** + * Deposits queries all deposits of a single proposal. + * @name getDeposits + * @package cosmos.gov.v1 + * @see proto service: cosmos.gov.v1.Deposits + */ +export const getDeposits = buildQuery({ + encode: QueryDepositsRequest.encode, + decode: QueryDepositsResponse.decode, + service: "cosmos.gov.v1.Query", + method: "Deposits" +}); +/** + * TallyResult queries the tally of a proposal vote. + * @name getTallyResult + * @package cosmos.gov.v1 + * @see proto service: cosmos.gov.v1.TallyResult + */ +export const getTallyResult = buildQuery({ + encode: QueryTallyResultRequest.encode, + decode: QueryTallyResultResponse.decode, + service: "cosmos.gov.v1.Query", + method: "TallyResult" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/gov/v1/tx.registry.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/gov/v1/tx.registry.ts index ff2fa9f8ec..da38566e53 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/gov/v1/tx.registry.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/gov/v1/tx.registry.ts @@ -2,14 +2,8 @@ import { Any, AnySDKType } from "../../../google/protobuf/any"; import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; import { VoteOption, VoteOptionSDKType, WeightedVoteOption, WeightedVoteOptionSDKType } from "./gov"; import { TelescopeGeneratedType } from "../../../types"; -import { Registry } from "@cosmjs/proto-signing"; import { MsgSubmitProposal, MsgSubmitProposalSDKType, MsgExecLegacyContent, MsgExecLegacyContentSDKType, MsgVote, MsgVoteSDKType, MsgVoteWeighted, MsgVoteWeightedSDKType, MsgDeposit, MsgDepositSDKType } from "./tx"; export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/cosmos.gov.v1.MsgSubmitProposal", MsgSubmitProposal], ["/cosmos.gov.v1.MsgExecLegacyContent", MsgExecLegacyContent], ["/cosmos.gov.v1.MsgVote", MsgVote], ["/cosmos.gov.v1.MsgVoteWeighted", MsgVoteWeighted], ["/cosmos.gov.v1.MsgDeposit", MsgDeposit]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; export const MessageComposer = { encoded: { submitProposal(value: MsgSubmitProposal) { diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/gov/v1/tx.rpc.func.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/gov/v1/tx.rpc.func.ts new file mode 100644 index 0000000000..3e94b91fbe --- /dev/null +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/gov/v1/tx.rpc.func.ts @@ -0,0 +1,51 @@ +import { Any, AnySDKType } from "../../../google/protobuf/any"; +import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; +import { VoteOption, VoteOptionSDKType, WeightedVoteOption, WeightedVoteOptionSDKType } from "./gov"; +import { buildTx } from "../../../helper-func-types"; +import { MsgSubmitProposal, MsgSubmitProposalSDKType, MsgSubmitProposalResponse, MsgSubmitProposalResponseSDKType, MsgExecLegacyContent, MsgExecLegacyContentSDKType, MsgExecLegacyContentResponse, MsgExecLegacyContentResponseSDKType, MsgVote, MsgVoteSDKType, MsgVoteResponse, MsgVoteResponseSDKType, MsgVoteWeighted, MsgVoteWeightedSDKType, MsgVoteWeightedResponse, MsgVoteWeightedResponseSDKType, MsgDeposit, MsgDepositSDKType, MsgDepositResponse, MsgDepositResponseSDKType } from "./tx"; +/** + * SubmitProposal defines a method to create new proposal given a content. + * @name submitProposal + * @package cosmos.gov.v1 + * @see proto service: cosmos.gov.v1.SubmitProposal + */ +export const submitProposal = buildTx({ + msg: MsgSubmitProposal +}); +/** + * ExecLegacyContent defines a Msg to be in included in a MsgSubmitProposal + * to execute a legacy content-based proposal. + * @name execLegacyContent + * @package cosmos.gov.v1 + * @see proto service: cosmos.gov.v1.ExecLegacyContent + */ +export const execLegacyContent = buildTx({ + msg: MsgExecLegacyContent +}); +/** + * Vote defines a method to add a vote on a specific proposal. + * @name vote + * @package cosmos.gov.v1 + * @see proto service: cosmos.gov.v1.Vote + */ +export const vote = buildTx({ + msg: MsgVote +}); +/** + * VoteWeighted defines a method to add a weighted vote on a specific proposal. + * @name voteWeighted + * @package cosmos.gov.v1 + * @see proto service: cosmos.gov.v1.VoteWeighted + */ +export const voteWeighted = buildTx({ + msg: MsgVoteWeighted +}); +/** + * Deposit defines a method to add deposit on a specific proposal. + * @name deposit + * @package cosmos.gov.v1 + * @see proto service: cosmos.gov.v1.Deposit + */ +export const deposit = buildTx({ + msg: MsgDeposit +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/gov/v1/tx.rpc.msg.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/gov/v1/tx.rpc.msg.ts index e62be60cfc..1df57e425b 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/gov/v1/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/gov/v1/tx.rpc.msg.ts @@ -1,7 +1,8 @@ import { Any, AnySDKType } from "../../../google/protobuf/any"; import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; import { VoteOption, VoteOptionSDKType, WeightedVoteOption, WeightedVoteOptionSDKType } from "./gov"; -import { DeliverTxResponse, StdFee, TxRpc } from "../../../types"; +import { DeliverTxResponse } from "@interchainjs/types"; +import { StdFee, TxRpc } from "../../../types"; import { BinaryReader } from "../../../binary"; import { MsgSubmitProposal, MsgSubmitProposalSDKType, MsgSubmitProposalResponse, MsgSubmitProposalResponseSDKType, MsgExecLegacyContent, MsgExecLegacyContentSDKType, MsgExecLegacyContentResponse, MsgExecLegacyContentResponseSDKType, MsgVote, MsgVoteSDKType, MsgVoteResponse, MsgVoteResponseSDKType, MsgVoteWeighted, MsgVoteWeightedSDKType, MsgVoteWeightedResponse, MsgVoteWeightedResponseSDKType, MsgDeposit, MsgDepositSDKType, MsgDepositResponse, MsgDepositResponseSDKType } from "./tx"; /** Msg defines the gov Msg service. */ diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/gov/v1beta1/gov.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/gov/v1beta1/gov.ts index ffb3896b40..cd9e4d4ee2 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/gov/v1beta1/gov.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/gov/v1beta1/gov.ts @@ -3,7 +3,7 @@ import { Any, AnySDKType } from "../../../google/protobuf/any"; import { Timestamp, TimestampSDKType } from "../../../google/protobuf/timestamp"; import { Duration, DurationSDKType } from "../../../google/protobuf/duration"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { Decimal } from "@cosmjs/math"; +import { Decimal } from "@interchainjs/math"; import { isSet, DeepPartial, toTimestamp, fromTimestamp, bytesFromBase64, base64FromBytes } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "cosmos.gov.v1beta1"; @@ -521,7 +521,7 @@ export const WeightedVoteOption = { toAmino(message: WeightedVoteOption): WeightedVoteOptionAmino { const obj: any = {}; obj.option = message.option === 0 ? undefined : message.option; - obj.weight = message.weight === "" ? undefined : message.weight; + obj.weight = message.weight === "" ? undefined : Decimal.fromUserInput(message.weight, 18).atomics; return obj; }, fromAminoMsg(object: WeightedVoteOptionAminoMsg): WeightedVoteOption { diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/gov/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/gov/v1beta1/query.rpc.func.ts new file mode 100644 index 0000000000..8a24300a35 --- /dev/null +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/gov/v1beta1/query.rpc.func.ts @@ -0,0 +1,100 @@ +import { ProposalStatus, ProposalStatusSDKType, Proposal, ProposalSDKType, Vote, VoteSDKType, VotingParams, VotingParamsSDKType, DepositParams, DepositParamsSDKType, TallyParams, TallyParamsSDKType, Deposit, DepositSDKType, TallyResult, TallyResultSDKType } from "./gov"; +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +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"; +/** + * Proposal queries proposal details based on ProposalID. + * @name getProposal + * @package cosmos.gov.v1beta1 + * @see proto service: cosmos.gov.v1beta1.Proposal + */ +export const getProposal = buildQuery({ + encode: QueryProposalRequest.encode, + decode: QueryProposalResponse.decode, + service: "cosmos.gov.v1beta1.Query", + method: "Proposal" +}); +/** + * Proposals queries all proposals based on given status. + * @name getProposals + * @package cosmos.gov.v1beta1 + * @see proto service: cosmos.gov.v1beta1.Proposals + */ +export const getProposals = buildQuery({ + encode: QueryProposalsRequest.encode, + decode: QueryProposalsResponse.decode, + service: "cosmos.gov.v1beta1.Query", + method: "Proposals" +}); +/** + * Vote queries voted information based on proposalID, voterAddr. + * @name getVote + * @package cosmos.gov.v1beta1 + * @see proto service: cosmos.gov.v1beta1.Vote + */ +export const getVote = buildQuery({ + encode: QueryVoteRequest.encode, + decode: QueryVoteResponse.decode, + service: "cosmos.gov.v1beta1.Query", + method: "Vote" +}); +/** + * Votes queries votes of a given proposal. + * @name getVotes + * @package cosmos.gov.v1beta1 + * @see proto service: cosmos.gov.v1beta1.Votes + */ +export const getVotes = buildQuery({ + encode: QueryVotesRequest.encode, + decode: QueryVotesResponse.decode, + service: "cosmos.gov.v1beta1.Query", + method: "Votes" +}); +/** + * Params queries all parameters of the gov module. + * @name getParams + * @package cosmos.gov.v1beta1 + * @see proto service: cosmos.gov.v1beta1.Params + */ +export const getParams = buildQuery({ + encode: QueryParamsRequest.encode, + decode: QueryParamsResponse.decode, + service: "cosmos.gov.v1beta1.Query", + method: "Params" +}); +/** + * Deposit queries single deposit information based proposalID, depositAddr. + * @name getDeposit + * @package cosmos.gov.v1beta1 + * @see proto service: cosmos.gov.v1beta1.Deposit + */ +export const getDeposit = buildQuery({ + encode: QueryDepositRequest.encode, + decode: QueryDepositResponse.decode, + service: "cosmos.gov.v1beta1.Query", + method: "Deposit" +}); +/** + * Deposits queries all deposits of a single proposal. + * @name getDeposits + * @package cosmos.gov.v1beta1 + * @see proto service: cosmos.gov.v1beta1.Deposits + */ +export const getDeposits = buildQuery({ + encode: QueryDepositsRequest.encode, + decode: QueryDepositsResponse.decode, + service: "cosmos.gov.v1beta1.Query", + method: "Deposits" +}); +/** + * TallyResult queries the tally of a proposal vote. + * @name getTallyResult + * @package cosmos.gov.v1beta1 + * @see proto service: cosmos.gov.v1beta1.TallyResult + */ +export const getTallyResult = buildQuery({ + encode: QueryTallyResultRequest.encode, + decode: QueryTallyResultResponse.decode, + service: "cosmos.gov.v1beta1.Query", + method: "TallyResult" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/gov/v1beta1/tx.amino.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/gov/v1beta1/tx.amino.ts index 18cd029953..baea9051c4 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/gov/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/gov/v1beta1/tx.amino.ts @@ -3,6 +3,7 @@ import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; import { VoteOption, VoteOptionSDKType, WeightedVoteOption, WeightedVoteOptionSDKType, voteOptionFromJSON } from "./gov"; import { AminoMsg } from "@cosmjs/amino"; import { omitDefault } from "../../../helpers"; +import { Decimal } from "@interchainjs/math"; import { MsgSubmitProposal, MsgSubmitProposalSDKType, MsgVote, MsgVoteSDKType, MsgVoteWeighted, MsgVoteWeightedSDKType, MsgDeposit, MsgDepositSDKType } from "./tx"; export interface MsgSubmitProposalAminoType extends AminoMsg { type: "cosmos-sdk/MsgSubmitProposal"; @@ -123,7 +124,7 @@ export const AminoConverter = { voter, options: options.map(el0 => ({ option: el0.option, - weight: el0.weight + weight: Decimal.fromUserInput(el0.weight, 18).atomics })) }; }, diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/gov/v1beta1/tx.registry.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/gov/v1beta1/tx.registry.ts index 414c68f899..e199dcdad2 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/gov/v1beta1/tx.registry.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/gov/v1beta1/tx.registry.ts @@ -2,14 +2,8 @@ import { Any, AnySDKType } from "../../../google/protobuf/any"; import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; import { VoteOption, VoteOptionSDKType, WeightedVoteOption, WeightedVoteOptionSDKType } from "./gov"; import { TelescopeGeneratedType } from "../../../types"; -import { Registry } from "@cosmjs/proto-signing"; import { MsgSubmitProposal, MsgSubmitProposalSDKType, MsgVote, MsgVoteSDKType, MsgVoteWeighted, MsgVoteWeightedSDKType, MsgDeposit, MsgDepositSDKType } from "./tx"; export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/cosmos.gov.v1beta1.MsgSubmitProposal", MsgSubmitProposal], ["/cosmos.gov.v1beta1.MsgVote", MsgVote], ["/cosmos.gov.v1beta1.MsgVoteWeighted", MsgVoteWeighted], ["/cosmos.gov.v1beta1.MsgDeposit", MsgDeposit]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; export const MessageComposer = { encoded: { submitProposal(value: MsgSubmitProposal) { diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/gov/v1beta1/tx.rpc.func.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/gov/v1beta1/tx.rpc.func.ts new file mode 100644 index 0000000000..27f5d2f876 --- /dev/null +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/gov/v1beta1/tx.rpc.func.ts @@ -0,0 +1,43 @@ +import { Any, AnySDKType } from "../../../google/protobuf/any"; +import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; +import { VoteOption, VoteOptionSDKType, WeightedVoteOption, WeightedVoteOptionSDKType } from "./gov"; +import { buildTx } from "../../../helper-func-types"; +import { MsgSubmitProposal, MsgSubmitProposalSDKType, MsgSubmitProposalResponse, MsgSubmitProposalResponseSDKType, MsgVote, MsgVoteSDKType, MsgVoteResponse, MsgVoteResponseSDKType, MsgVoteWeighted, MsgVoteWeightedSDKType, MsgVoteWeightedResponse, MsgVoteWeightedResponseSDKType, MsgDeposit, MsgDepositSDKType, MsgDepositResponse, MsgDepositResponseSDKType } from "./tx"; +/** + * SubmitProposal defines a method to create new proposal given a content. + * @name submitProposal + * @package cosmos.gov.v1beta1 + * @see proto service: cosmos.gov.v1beta1.SubmitProposal + */ +export const submitProposal = buildTx({ + msg: MsgSubmitProposal +}); +/** + * Vote defines a method to add a vote on a specific proposal. + * @name vote + * @package cosmos.gov.v1beta1 + * @see proto service: cosmos.gov.v1beta1.Vote + */ +export const vote = buildTx({ + msg: MsgVote +}); +/** + * VoteWeighted defines a method to add a weighted vote on a specific proposal. + * + * Since: cosmos-sdk 0.43 + * @name voteWeighted + * @package cosmos.gov.v1beta1 + * @see proto service: cosmos.gov.v1beta1.VoteWeighted + */ +export const voteWeighted = buildTx({ + msg: MsgVoteWeighted +}); +/** + * Deposit defines a method to add deposit on a specific proposal. + * @name deposit + * @package cosmos.gov.v1beta1 + * @see proto service: cosmos.gov.v1beta1.Deposit + */ +export const deposit = buildTx({ + msg: MsgDeposit +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/gov/v1beta1/tx.rpc.msg.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/gov/v1beta1/tx.rpc.msg.ts index 70c6fce496..f126077638 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/gov/v1beta1/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/gov/v1beta1/tx.rpc.msg.ts @@ -1,7 +1,8 @@ import { Any, AnySDKType } from "../../../google/protobuf/any"; import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; import { VoteOption, VoteOptionSDKType, WeightedVoteOption, WeightedVoteOptionSDKType } from "./gov"; -import { DeliverTxResponse, StdFee, TxRpc } from "../../../types"; +import { DeliverTxResponse } from "@interchainjs/types"; +import { StdFee, TxRpc } from "../../../types"; import { BinaryReader } from "../../../binary"; import { MsgSubmitProposal, MsgSubmitProposalSDKType, MsgSubmitProposalResponse, MsgSubmitProposalResponseSDKType, MsgVote, MsgVoteSDKType, MsgVoteResponse, MsgVoteResponseSDKType, MsgVoteWeighted, MsgVoteWeightedSDKType, MsgVoteWeightedResponse, MsgVoteWeightedResponseSDKType, MsgDeposit, MsgDepositSDKType, MsgDepositResponse, MsgDepositResponseSDKType } from "./tx"; /** Msg defines the bank Msg service. */ diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/group/v1/query.rpc.func.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/group/v1/query.rpc.func.ts new file mode 100644 index 0000000000..6172c0378f --- /dev/null +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/group/v1/query.rpc.func.ts @@ -0,0 +1,160 @@ +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; +import { GroupInfo, GroupInfoSDKType, GroupPolicyInfo, GroupPolicyInfoSDKType, GroupMember, GroupMemberSDKType, Proposal, ProposalSDKType, Vote, VoteSDKType, TallyResult, TallyResultSDKType } from "./types"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { QueryGroupInfoRequest, QueryGroupInfoRequestSDKType, QueryGroupInfoResponse, QueryGroupInfoResponseSDKType, QueryGroupPolicyInfoRequest, QueryGroupPolicyInfoRequestSDKType, QueryGroupPolicyInfoResponse, QueryGroupPolicyInfoResponseSDKType, QueryGroupMembersRequest, QueryGroupMembersRequestSDKType, QueryGroupMembersResponse, QueryGroupMembersResponseSDKType, QueryGroupsByAdminRequest, QueryGroupsByAdminRequestSDKType, QueryGroupsByAdminResponse, QueryGroupsByAdminResponseSDKType, QueryGroupPoliciesByGroupRequest, QueryGroupPoliciesByGroupRequestSDKType, QueryGroupPoliciesByGroupResponse, QueryGroupPoliciesByGroupResponseSDKType, QueryGroupPoliciesByAdminRequest, QueryGroupPoliciesByAdminRequestSDKType, QueryGroupPoliciesByAdminResponse, QueryGroupPoliciesByAdminResponseSDKType, QueryProposalRequest, QueryProposalRequestSDKType, QueryProposalResponse, QueryProposalResponseSDKType, QueryProposalsByGroupPolicyRequest, QueryProposalsByGroupPolicyRequestSDKType, QueryProposalsByGroupPolicyResponse, QueryProposalsByGroupPolicyResponseSDKType, QueryVoteByProposalVoterRequest, QueryVoteByProposalVoterRequestSDKType, QueryVoteByProposalVoterResponse, QueryVoteByProposalVoterResponseSDKType, QueryVotesByProposalRequest, QueryVotesByProposalRequestSDKType, QueryVotesByProposalResponse, QueryVotesByProposalResponseSDKType, QueryVotesByVoterRequest, QueryVotesByVoterRequestSDKType, QueryVotesByVoterResponse, QueryVotesByVoterResponseSDKType, QueryGroupsByMemberRequest, QueryGroupsByMemberRequestSDKType, QueryGroupsByMemberResponse, QueryGroupsByMemberResponseSDKType, QueryTallyResultRequest, QueryTallyResultRequestSDKType, QueryTallyResultResponse, QueryTallyResultResponseSDKType } from "./query"; +/** + * GroupInfo queries group info based on group id. + * @name getGroupInfo + * @package cosmos.group.v1 + * @see proto service: cosmos.group.v1.GroupInfo + */ +export const getGroupInfo = buildQuery({ + encode: QueryGroupInfoRequest.encode, + decode: QueryGroupInfoResponse.decode, + service: "cosmos.group.v1.Query", + method: "GroupInfo" +}); +/** + * GroupPolicyInfo queries group policy info based on account address of group policy. + * @name getGroupPolicyInfo + * @package cosmos.group.v1 + * @see proto service: cosmos.group.v1.GroupPolicyInfo + */ +export const getGroupPolicyInfo = buildQuery({ + encode: QueryGroupPolicyInfoRequest.encode, + decode: QueryGroupPolicyInfoResponse.decode, + service: "cosmos.group.v1.Query", + method: "GroupPolicyInfo" +}); +/** + * GroupMembers queries members of a group + * @name getGroupMembers + * @package cosmos.group.v1 + * @see proto service: cosmos.group.v1.GroupMembers + */ +export const getGroupMembers = buildQuery({ + encode: QueryGroupMembersRequest.encode, + decode: QueryGroupMembersResponse.decode, + service: "cosmos.group.v1.Query", + method: "GroupMembers" +}); +/** + * GroupsByAdmin queries groups by admin address. + * @name getGroupsByAdmin + * @package cosmos.group.v1 + * @see proto service: cosmos.group.v1.GroupsByAdmin + */ +export const getGroupsByAdmin = buildQuery({ + encode: QueryGroupsByAdminRequest.encode, + decode: QueryGroupsByAdminResponse.decode, + service: "cosmos.group.v1.Query", + method: "GroupsByAdmin" +}); +/** + * GroupPoliciesByGroup queries group policies by group id. + * @name getGroupPoliciesByGroup + * @package cosmos.group.v1 + * @see proto service: cosmos.group.v1.GroupPoliciesByGroup + */ +export const getGroupPoliciesByGroup = buildQuery({ + encode: QueryGroupPoliciesByGroupRequest.encode, + decode: QueryGroupPoliciesByGroupResponse.decode, + service: "cosmos.group.v1.Query", + method: "GroupPoliciesByGroup" +}); +/** + * GroupsByAdmin queries group policies by admin address. + * @name getGroupPoliciesByAdmin + * @package cosmos.group.v1 + * @see proto service: cosmos.group.v1.GroupPoliciesByAdmin + */ +export const getGroupPoliciesByAdmin = buildQuery({ + encode: QueryGroupPoliciesByAdminRequest.encode, + decode: QueryGroupPoliciesByAdminResponse.decode, + service: "cosmos.group.v1.Query", + method: "GroupPoliciesByAdmin" +}); +/** + * Proposal queries a proposal based on proposal id. + * @name getProposal + * @package cosmos.group.v1 + * @see proto service: cosmos.group.v1.Proposal + */ +export const getProposal = buildQuery({ + encode: QueryProposalRequest.encode, + decode: QueryProposalResponse.decode, + service: "cosmos.group.v1.Query", + method: "Proposal" +}); +/** + * ProposalsByGroupPolicy queries proposals based on account address of group policy. + * @name getProposalsByGroupPolicy + * @package cosmos.group.v1 + * @see proto service: cosmos.group.v1.ProposalsByGroupPolicy + */ +export const getProposalsByGroupPolicy = buildQuery({ + encode: QueryProposalsByGroupPolicyRequest.encode, + decode: QueryProposalsByGroupPolicyResponse.decode, + service: "cosmos.group.v1.Query", + method: "ProposalsByGroupPolicy" +}); +/** + * VoteByProposalVoter queries a vote by proposal id and voter. + * @name getVoteByProposalVoter + * @package cosmos.group.v1 + * @see proto service: cosmos.group.v1.VoteByProposalVoter + */ +export const getVoteByProposalVoter = buildQuery({ + encode: QueryVoteByProposalVoterRequest.encode, + decode: QueryVoteByProposalVoterResponse.decode, + service: "cosmos.group.v1.Query", + method: "VoteByProposalVoter" +}); +/** + * VotesByProposal queries a vote by proposal. + * @name getVotesByProposal + * @package cosmos.group.v1 + * @see proto service: cosmos.group.v1.VotesByProposal + */ +export const getVotesByProposal = buildQuery({ + encode: QueryVotesByProposalRequest.encode, + decode: QueryVotesByProposalResponse.decode, + service: "cosmos.group.v1.Query", + method: "VotesByProposal" +}); +/** + * VotesByVoter queries a vote by voter. + * @name getVotesByVoter + * @package cosmos.group.v1 + * @see proto service: cosmos.group.v1.VotesByVoter + */ +export const getVotesByVoter = buildQuery({ + encode: QueryVotesByVoterRequest.encode, + decode: QueryVotesByVoterResponse.decode, + service: "cosmos.group.v1.Query", + method: "VotesByVoter" +}); +/** + * GroupsByMember queries groups by member address. + * @name getGroupsByMember + * @package cosmos.group.v1 + * @see proto service: cosmos.group.v1.GroupsByMember + */ +export const getGroupsByMember = buildQuery({ + encode: QueryGroupsByMemberRequest.encode, + decode: QueryGroupsByMemberResponse.decode, + service: "cosmos.group.v1.Query", + method: "GroupsByMember" +}); +/** + * TallyResult queries the tally of a proposal votes. + * @name getTallyResult + * @package cosmos.group.v1 + * @see proto service: cosmos.group.v1.TallyResult + */ +export const getTallyResult = buildQuery({ + encode: QueryTallyResultRequest.encode, + decode: QueryTallyResultResponse.decode, + service: "cosmos.group.v1.Query", + method: "TallyResult" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/group/v1/tx.registry.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/group/v1/tx.registry.ts index f54dc0c64c..a39bff7e74 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/group/v1/tx.registry.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/group/v1/tx.registry.ts @@ -1,14 +1,8 @@ import { Member, MemberSDKType, VoteOption, VoteOptionSDKType } from "./types"; import { Any, AnySDKType } from "../../../google/protobuf/any"; import { TelescopeGeneratedType } from "../../../types"; -import { Registry } from "@cosmjs/proto-signing"; import { MsgCreateGroup, MsgCreateGroupSDKType, MsgUpdateGroupMembers, MsgUpdateGroupMembersSDKType, MsgUpdateGroupAdmin, MsgUpdateGroupAdminSDKType, MsgUpdateGroupMetadata, MsgUpdateGroupMetadataSDKType, MsgCreateGroupPolicy, MsgCreateGroupPolicySDKType, MsgCreateGroupWithPolicy, MsgCreateGroupWithPolicySDKType, MsgUpdateGroupPolicyAdmin, MsgUpdateGroupPolicyAdminSDKType, MsgUpdateGroupPolicyDecisionPolicy, MsgUpdateGroupPolicyDecisionPolicySDKType, MsgUpdateGroupPolicyMetadata, MsgUpdateGroupPolicyMetadataSDKType, MsgSubmitProposal, MsgSubmitProposalSDKType, MsgWithdrawProposal, MsgWithdrawProposalSDKType, MsgVote, MsgVoteSDKType, MsgExec, MsgExecSDKType, MsgLeaveGroup, MsgLeaveGroupSDKType } from "./tx"; export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/cosmos.group.v1.MsgCreateGroup", MsgCreateGroup], ["/cosmos.group.v1.MsgUpdateGroupMembers", MsgUpdateGroupMembers], ["/cosmos.group.v1.MsgUpdateGroupAdmin", MsgUpdateGroupAdmin], ["/cosmos.group.v1.MsgUpdateGroupMetadata", MsgUpdateGroupMetadata], ["/cosmos.group.v1.MsgCreateGroupPolicy", MsgCreateGroupPolicy], ["/cosmos.group.v1.MsgCreateGroupWithPolicy", MsgCreateGroupWithPolicy], ["/cosmos.group.v1.MsgUpdateGroupPolicyAdmin", MsgUpdateGroupPolicyAdmin], ["/cosmos.group.v1.MsgUpdateGroupPolicyDecisionPolicy", MsgUpdateGroupPolicyDecisionPolicy], ["/cosmos.group.v1.MsgUpdateGroupPolicyMetadata", MsgUpdateGroupPolicyMetadata], ["/cosmos.group.v1.MsgSubmitProposal", MsgSubmitProposal], ["/cosmos.group.v1.MsgWithdrawProposal", MsgWithdrawProposal], ["/cosmos.group.v1.MsgVote", MsgVote], ["/cosmos.group.v1.MsgExec", MsgExec], ["/cosmos.group.v1.MsgLeaveGroup", MsgLeaveGroup]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; export const MessageComposer = { encoded: { createGroup(value: MsgCreateGroup) { diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/group/v1/tx.rpc.func.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/group/v1/tx.rpc.func.ts new file mode 100644 index 0000000000..4efd31c9e6 --- /dev/null +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/group/v1/tx.rpc.func.ts @@ -0,0 +1,130 @@ +import { Member, MemberSDKType, VoteOption, VoteOptionSDKType } from "./types"; +import { Any, AnySDKType } from "../../../google/protobuf/any"; +import { buildTx } from "../../../helper-func-types"; +import { MsgCreateGroup, MsgCreateGroupSDKType, MsgCreateGroupResponse, MsgCreateGroupResponseSDKType, MsgUpdateGroupMembers, MsgUpdateGroupMembersSDKType, MsgUpdateGroupMembersResponse, MsgUpdateGroupMembersResponseSDKType, MsgUpdateGroupAdmin, MsgUpdateGroupAdminSDKType, MsgUpdateGroupAdminResponse, MsgUpdateGroupAdminResponseSDKType, MsgUpdateGroupMetadata, MsgUpdateGroupMetadataSDKType, MsgUpdateGroupMetadataResponse, MsgUpdateGroupMetadataResponseSDKType, MsgCreateGroupPolicy, MsgCreateGroupPolicySDKType, MsgCreateGroupPolicyResponse, MsgCreateGroupPolicyResponseSDKType, MsgCreateGroupWithPolicy, MsgCreateGroupWithPolicySDKType, MsgCreateGroupWithPolicyResponse, MsgCreateGroupWithPolicyResponseSDKType, MsgUpdateGroupPolicyAdmin, MsgUpdateGroupPolicyAdminSDKType, MsgUpdateGroupPolicyAdminResponse, MsgUpdateGroupPolicyAdminResponseSDKType, MsgUpdateGroupPolicyDecisionPolicy, MsgUpdateGroupPolicyDecisionPolicySDKType, MsgUpdateGroupPolicyDecisionPolicyResponse, MsgUpdateGroupPolicyDecisionPolicyResponseSDKType, MsgUpdateGroupPolicyMetadata, MsgUpdateGroupPolicyMetadataSDKType, MsgUpdateGroupPolicyMetadataResponse, MsgUpdateGroupPolicyMetadataResponseSDKType, MsgSubmitProposal, MsgSubmitProposalSDKType, MsgSubmitProposalResponse, MsgSubmitProposalResponseSDKType, MsgWithdrawProposal, MsgWithdrawProposalSDKType, MsgWithdrawProposalResponse, MsgWithdrawProposalResponseSDKType, MsgVote, MsgVoteSDKType, MsgVoteResponse, MsgVoteResponseSDKType, MsgExec, MsgExecSDKType, MsgExecResponse, MsgExecResponseSDKType, MsgLeaveGroup, MsgLeaveGroupSDKType, MsgLeaveGroupResponse, MsgLeaveGroupResponseSDKType } from "./tx"; +/** + * CreateGroup creates a new group with an admin account address, a list of members and some optional metadata. + * @name createGroup + * @package cosmos.group.v1 + * @see proto service: cosmos.group.v1.CreateGroup + */ +export const createGroup = buildTx({ + msg: MsgCreateGroup +}); +/** + * UpdateGroupMembers updates the group members with given group id and admin address. + * @name updateGroupMembers + * @package cosmos.group.v1 + * @see proto service: cosmos.group.v1.UpdateGroupMembers + */ +export const updateGroupMembers = buildTx({ + msg: MsgUpdateGroupMembers +}); +/** + * UpdateGroupAdmin updates the group admin with given group id and previous admin address. + * @name updateGroupAdmin + * @package cosmos.group.v1 + * @see proto service: cosmos.group.v1.UpdateGroupAdmin + */ +export const updateGroupAdmin = buildTx({ + msg: MsgUpdateGroupAdmin +}); +/** + * UpdateGroupMetadata updates the group metadata with given group id and admin address. + * @name updateGroupMetadata + * @package cosmos.group.v1 + * @see proto service: cosmos.group.v1.UpdateGroupMetadata + */ +export const updateGroupMetadata = buildTx({ + msg: MsgUpdateGroupMetadata +}); +/** + * CreateGroupPolicy creates a new group policy using given DecisionPolicy. + * @name createGroupPolicy + * @package cosmos.group.v1 + * @see proto service: cosmos.group.v1.CreateGroupPolicy + */ +export const createGroupPolicy = buildTx({ + msg: MsgCreateGroupPolicy +}); +/** + * CreateGroupWithPolicy creates a new group with policy. + * @name createGroupWithPolicy + * @package cosmos.group.v1 + * @see proto service: cosmos.group.v1.CreateGroupWithPolicy + */ +export const createGroupWithPolicy = buildTx({ + msg: MsgCreateGroupWithPolicy +}); +/** + * UpdateGroupPolicyAdmin updates a group policy admin. + * @name updateGroupPolicyAdmin + * @package cosmos.group.v1 + * @see proto service: cosmos.group.v1.UpdateGroupPolicyAdmin + */ +export const updateGroupPolicyAdmin = buildTx({ + msg: MsgUpdateGroupPolicyAdmin +}); +/** + * UpdateGroupPolicyDecisionPolicy allows a group policy's decision policy to be updated. + * @name updateGroupPolicyDecisionPolicy + * @package cosmos.group.v1 + * @see proto service: cosmos.group.v1.UpdateGroupPolicyDecisionPolicy + */ +export const updateGroupPolicyDecisionPolicy = buildTx({ + msg: MsgUpdateGroupPolicyDecisionPolicy +}); +/** + * UpdateGroupPolicyMetadata updates a group policy metadata. + * @name updateGroupPolicyMetadata + * @package cosmos.group.v1 + * @see proto service: cosmos.group.v1.UpdateGroupPolicyMetadata + */ +export const updateGroupPolicyMetadata = buildTx({ + msg: MsgUpdateGroupPolicyMetadata +}); +/** + * SubmitProposal submits a new proposal. + * @name submitProposal + * @package cosmos.group.v1 + * @see proto service: cosmos.group.v1.SubmitProposal + */ +export const submitProposal = buildTx({ + msg: MsgSubmitProposal +}); +/** + * WithdrawProposal aborts a proposal. + * @name withdrawProposal + * @package cosmos.group.v1 + * @see proto service: cosmos.group.v1.WithdrawProposal + */ +export const withdrawProposal = buildTx({ + msg: MsgWithdrawProposal +}); +/** + * Vote allows a voter to vote on a proposal. + * @name vote + * @package cosmos.group.v1 + * @see proto service: cosmos.group.v1.Vote + */ +export const vote = buildTx({ + msg: MsgVote +}); +/** + * Exec executes a proposal. + * @name exec + * @package cosmos.group.v1 + * @see proto service: cosmos.group.v1.Exec + */ +export const exec = buildTx({ + msg: MsgExec +}); +/** + * LeaveGroup allows a group member to leave the group. + * @name leaveGroup + * @package cosmos.group.v1 + * @see proto service: cosmos.group.v1.LeaveGroup + */ +export const leaveGroup = buildTx({ + msg: MsgLeaveGroup +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/group/v1/tx.rpc.msg.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/group/v1/tx.rpc.msg.ts index 352d72e742..e6278ca725 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/group/v1/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/group/v1/tx.rpc.msg.ts @@ -1,6 +1,7 @@ import { Member, MemberSDKType, VoteOption, VoteOptionSDKType } from "./types"; import { Any, AnySDKType } from "../../../google/protobuf/any"; -import { DeliverTxResponse, StdFee, TxRpc } from "../../../types"; +import { DeliverTxResponse } from "@interchainjs/types"; +import { StdFee, TxRpc } from "../../../types"; import { BinaryReader } from "../../../binary"; import { MsgCreateGroup, MsgCreateGroupSDKType, MsgCreateGroupResponse, MsgCreateGroupResponseSDKType, MsgUpdateGroupMembers, MsgUpdateGroupMembersSDKType, MsgUpdateGroupMembersResponse, MsgUpdateGroupMembersResponseSDKType, MsgUpdateGroupAdmin, MsgUpdateGroupAdminSDKType, MsgUpdateGroupAdminResponse, MsgUpdateGroupAdminResponseSDKType, MsgUpdateGroupMetadata, MsgUpdateGroupMetadataSDKType, MsgUpdateGroupMetadataResponse, MsgUpdateGroupMetadataResponseSDKType, MsgCreateGroupPolicy, MsgCreateGroupPolicySDKType, MsgCreateGroupPolicyResponse, MsgCreateGroupPolicyResponseSDKType, MsgCreateGroupWithPolicy, MsgCreateGroupWithPolicySDKType, MsgCreateGroupWithPolicyResponse, MsgCreateGroupWithPolicyResponseSDKType, MsgUpdateGroupPolicyAdmin, MsgUpdateGroupPolicyAdminSDKType, MsgUpdateGroupPolicyAdminResponse, MsgUpdateGroupPolicyAdminResponseSDKType, MsgUpdateGroupPolicyDecisionPolicy, MsgUpdateGroupPolicyDecisionPolicySDKType, MsgUpdateGroupPolicyDecisionPolicyResponse, MsgUpdateGroupPolicyDecisionPolicyResponseSDKType, MsgUpdateGroupPolicyMetadata, MsgUpdateGroupPolicyMetadataSDKType, MsgUpdateGroupPolicyMetadataResponse, MsgUpdateGroupPolicyMetadataResponseSDKType, MsgSubmitProposal, MsgSubmitProposalSDKType, MsgSubmitProposalResponse, MsgSubmitProposalResponseSDKType, MsgWithdrawProposal, MsgWithdrawProposalSDKType, MsgWithdrawProposalResponse, MsgWithdrawProposalResponseSDKType, MsgVote, MsgVoteSDKType, MsgVoteResponse, MsgVoteResponseSDKType, MsgExec, MsgExecSDKType, MsgExecResponse, MsgExecResponseSDKType, MsgLeaveGroup, MsgLeaveGroupSDKType, MsgLeaveGroupResponse, MsgLeaveGroupResponseSDKType } from "./tx"; /** Msg is the cosmos.group.v1 Msg service. */ diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/mint/v1beta1/mint.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/mint/v1beta1/mint.ts index 2bdb6ec32f..720537b959 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/mint/v1beta1/mint.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/mint/v1beta1/mint.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { Decimal } from "@cosmjs/math"; +import { Decimal } from "@interchainjs/math"; import { isSet, DeepPartial } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "cosmos.mint.v1beta1"; @@ -174,8 +174,8 @@ export const Minter = { }, toAmino(message: Minter): MinterAmino { const obj: any = {}; - obj.inflation = message.inflation === "" ? undefined : message.inflation; - obj.annual_provisions = message.annualProvisions === "" ? undefined : message.annualProvisions; + obj.inflation = message.inflation === "" ? undefined : Decimal.fromUserInput(message.inflation, 18).atomics; + obj.annual_provisions = message.annualProvisions === "" ? undefined : Decimal.fromUserInput(message.annualProvisions, 18).atomics; return obj; }, fromAminoMsg(object: MinterAminoMsg): Minter { @@ -358,10 +358,10 @@ export const Params = { toAmino(message: Params): ParamsAmino { const obj: any = {}; obj.mint_denom = message.mintDenom === "" ? undefined : message.mintDenom; - obj.inflation_rate_change = message.inflationRateChange === "" ? undefined : message.inflationRateChange; - obj.inflation_max = message.inflationMax === "" ? undefined : message.inflationMax; - obj.inflation_min = message.inflationMin === "" ? undefined : message.inflationMin; - obj.goal_bonded = message.goalBonded === "" ? undefined : message.goalBonded; + obj.inflation_rate_change = message.inflationRateChange === "" ? undefined : Decimal.fromUserInput(message.inflationRateChange, 18).atomics; + obj.inflation_max = message.inflationMax === "" ? undefined : Decimal.fromUserInput(message.inflationMax, 18).atomics; + obj.inflation_min = message.inflationMin === "" ? undefined : Decimal.fromUserInput(message.inflationMin, 18).atomics; + obj.goal_bonded = message.goalBonded === "" ? undefined : Decimal.fromUserInput(message.goalBonded, 18).atomics; obj.blocks_per_year = message.blocksPerYear !== BigInt(0) ? message.blocksPerYear?.toString() : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/mint/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/mint/v1beta1/query.rpc.func.ts new file mode 100644 index 0000000000..68f23adc68 --- /dev/null +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/mint/v1beta1/query.rpc.func.ts @@ -0,0 +1,39 @@ +import { Params, ParamsSDKType } from "./mint"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, QueryInflationRequest, QueryInflationRequestSDKType, QueryInflationResponse, QueryInflationResponseSDKType, QueryAnnualProvisionsRequest, QueryAnnualProvisionsRequestSDKType, QueryAnnualProvisionsResponse, QueryAnnualProvisionsResponseSDKType } from "./query"; +/** + * Params returns the total set of minting parameters. + * @name getParams + * @package cosmos.mint.v1beta1 + * @see proto service: cosmos.mint.v1beta1.Params + */ +export const getParams = buildQuery({ + encode: QueryParamsRequest.encode, + decode: QueryParamsResponse.decode, + service: "cosmos.mint.v1beta1.Query", + method: "Params" +}); +/** + * Inflation returns the current minting inflation value. + * @name getInflation + * @package cosmos.mint.v1beta1 + * @see proto service: cosmos.mint.v1beta1.Inflation + */ +export const getInflation = buildQuery({ + encode: QueryInflationRequest.encode, + decode: QueryInflationResponse.decode, + service: "cosmos.mint.v1beta1.Query", + method: "Inflation" +}); +/** + * AnnualProvisions current minting annual provisions value. + * @name getAnnualProvisions + * @package cosmos.mint.v1beta1 + * @see proto service: cosmos.mint.v1beta1.AnnualProvisions + */ +export const getAnnualProvisions = buildQuery({ + encode: QueryAnnualProvisionsRequest.encode, + decode: QueryAnnualProvisionsResponse.decode, + service: "cosmos.mint.v1beta1.Query", + method: "AnnualProvisions" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/nft/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/nft/v1beta1/query.rpc.func.ts new file mode 100644 index 0000000000..ef9577f449 --- /dev/null +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/nft/v1beta1/query.rpc.func.ts @@ -0,0 +1,89 @@ +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; +import { NFT, NFTSDKType, Class, ClassSDKType } from "./nft"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { QueryBalanceRequest, QueryBalanceRequestSDKType, QueryBalanceResponse, QueryBalanceResponseSDKType, QueryOwnerRequest, QueryOwnerRequestSDKType, QueryOwnerResponse, QueryOwnerResponseSDKType, QuerySupplyRequest, QuerySupplyRequestSDKType, QuerySupplyResponse, QuerySupplyResponseSDKType, QueryNFTsRequest, QueryNFTsRequestSDKType, QueryNFTsResponse, QueryNFTsResponseSDKType, QueryNFTRequest, QueryNFTRequestSDKType, QueryNFTResponse, QueryNFTResponseSDKType, QueryClassRequest, QueryClassRequestSDKType, QueryClassResponse, QueryClassResponseSDKType, QueryClassesRequest, QueryClassesRequestSDKType, QueryClassesResponse, QueryClassesResponseSDKType } from "./query"; +/** + * Balance queries the number of NFTs of a given class owned by the owner, same as balanceOf in ERC721 + * @name getBalance + * @package cosmos.nft.v1beta1 + * @see proto service: cosmos.nft.v1beta1.Balance + */ +export const getBalance = buildQuery({ + encode: QueryBalanceRequest.encode, + decode: QueryBalanceResponse.decode, + service: "cosmos.nft.v1beta1.Query", + method: "Balance" +}); +/** + * Owner queries the owner of the NFT based on its class and id, same as ownerOf in ERC721 + * @name getOwner + * @package cosmos.nft.v1beta1 + * @see proto service: cosmos.nft.v1beta1.Owner + */ +export const getOwner = buildQuery({ + encode: QueryOwnerRequest.encode, + decode: QueryOwnerResponse.decode, + service: "cosmos.nft.v1beta1.Query", + method: "Owner" +}); +/** + * Supply queries the number of NFTs from the given class, same as totalSupply of ERC721. + * @name getSupply + * @package cosmos.nft.v1beta1 + * @see proto service: cosmos.nft.v1beta1.Supply + */ +export const getSupply = buildQuery({ + encode: QuerySupplyRequest.encode, + decode: QuerySupplyResponse.decode, + service: "cosmos.nft.v1beta1.Query", + method: "Supply" +}); +/** + * NFTs queries all NFTs of a given class or owner,choose at least one of the two, similar to tokenByIndex in + * ERC721Enumerable + * @name getNFTs + * @package cosmos.nft.v1beta1 + * @see proto service: cosmos.nft.v1beta1.NFTs + */ +export const getNFTs = buildQuery({ + encode: QueryNFTsRequest.encode, + decode: QueryNFTsResponse.decode, + service: "cosmos.nft.v1beta1.Query", + method: "NFTs" +}); +/** + * NFT queries an NFT based on its class and id. + * @name getNFT + * @package cosmos.nft.v1beta1 + * @see proto service: cosmos.nft.v1beta1.NFT + */ +export const getNFT = buildQuery({ + encode: QueryNFTRequest.encode, + decode: QueryNFTResponse.decode, + service: "cosmos.nft.v1beta1.Query", + method: "NFT" +}); +/** + * Class queries an NFT class based on its id + * @name getClass + * @package cosmos.nft.v1beta1 + * @see proto service: cosmos.nft.v1beta1.Class + */ +export const getClass = buildQuery({ + encode: QueryClassRequest.encode, + decode: QueryClassResponse.decode, + service: "cosmos.nft.v1beta1.Query", + method: "Class" +}); +/** + * Classes queries all NFT classes + * @name getClasses + * @package cosmos.nft.v1beta1 + * @see proto service: cosmos.nft.v1beta1.Classes + */ +export const getClasses = buildQuery({ + encode: QueryClassesRequest.encode, + decode: QueryClassesResponse.decode, + service: "cosmos.nft.v1beta1.Query", + method: "Classes" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/nft/v1beta1/tx.registry.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/nft/v1beta1/tx.registry.ts index d32073e6d4..8c30af2dc8 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/nft/v1beta1/tx.registry.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/nft/v1beta1/tx.registry.ts @@ -1,12 +1,6 @@ import { TelescopeGeneratedType } from "../../../types"; -import { Registry } from "@cosmjs/proto-signing"; import { MsgSend, MsgSendSDKType } from "./tx"; export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/cosmos.nft.v1beta1.MsgSend", MsgSend]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; export const MessageComposer = { encoded: { send(value: MsgSend) { diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/nft/v1beta1/tx.rpc.func.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/nft/v1beta1/tx.rpc.func.ts new file mode 100644 index 0000000000..770b6c79e4 --- /dev/null +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/nft/v1beta1/tx.rpc.func.ts @@ -0,0 +1,11 @@ +import { buildTx } from "../../../helper-func-types"; +import { MsgSend, MsgSendSDKType, MsgSendResponse, MsgSendResponseSDKType } from "./tx"; +/** + * Send defines a method to send a nft from one account to another account. + * @name send + * @package cosmos.nft.v1beta1 + * @see proto service: cosmos.nft.v1beta1.Send + */ +export const send = buildTx({ + msg: MsgSend +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/nft/v1beta1/tx.rpc.msg.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/nft/v1beta1/tx.rpc.msg.ts index 0b5fa23c02..6ffc23d98f 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/nft/v1beta1/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/nft/v1beta1/tx.rpc.msg.ts @@ -1,4 +1,5 @@ -import { DeliverTxResponse, StdFee, TxRpc } from "../../../types"; +import { DeliverTxResponse } from "@interchainjs/types"; +import { StdFee, TxRpc } from "../../../types"; import { BinaryReader } from "../../../binary"; import { MsgSend, MsgSendSDKType, MsgSendResponse, MsgSendResponseSDKType } from "./tx"; /** Msg defines the nft Msg service. */ diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/params/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/params/v1beta1/query.rpc.func.ts new file mode 100644 index 0000000000..8caaba803d --- /dev/null +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/params/v1beta1/query.rpc.func.ts @@ -0,0 +1,28 @@ +import { ParamChange, ParamChangeSDKType } from "./params"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, QuerySubspacesRequest, QuerySubspacesRequestSDKType, QuerySubspacesResponse, QuerySubspacesResponseSDKType } from "./query"; +/** + * Params queries a specific parameter of a module, given its subspace and + * key. + * @name getParams + * @package cosmos.params.v1beta1 + * @see proto service: cosmos.params.v1beta1.Params + */ +export const getParams = buildQuery({ + encode: QueryParamsRequest.encode, + decode: QueryParamsResponse.decode, + service: "cosmos.params.v1beta1.Query", + method: "Params" +}); +/** + * Subspaces queries for all registered subspaces and all keys for a subspace. + * @name getSubspaces + * @package cosmos.params.v1beta1 + * @see proto service: cosmos.params.v1beta1.Subspaces + */ +export const getSubspaces = buildQuery({ + encode: QuerySubspacesRequest.encode, + decode: QuerySubspacesResponse.decode, + service: "cosmos.params.v1beta1.Query", + method: "Subspaces" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/slashing/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/slashing/v1beta1/query.rpc.func.ts new file mode 100644 index 0000000000..fb8415e520 --- /dev/null +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/slashing/v1beta1/query.rpc.func.ts @@ -0,0 +1,40 @@ +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; +import { Params, ParamsSDKType, ValidatorSigningInfo, ValidatorSigningInfoSDKType } from "./slashing"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, QuerySigningInfoRequest, QuerySigningInfoRequestSDKType, QuerySigningInfoResponse, QuerySigningInfoResponseSDKType, QuerySigningInfosRequest, QuerySigningInfosRequestSDKType, QuerySigningInfosResponse, QuerySigningInfosResponseSDKType } from "./query"; +/** + * Params queries the parameters of slashing module + * @name getParams + * @package cosmos.slashing.v1beta1 + * @see proto service: cosmos.slashing.v1beta1.Params + */ +export const getParams = buildQuery({ + encode: QueryParamsRequest.encode, + decode: QueryParamsResponse.decode, + service: "cosmos.slashing.v1beta1.Query", + method: "Params" +}); +/** + * SigningInfo queries the signing info of given cons address + * @name getSigningInfo + * @package cosmos.slashing.v1beta1 + * @see proto service: cosmos.slashing.v1beta1.SigningInfo + */ +export const getSigningInfo = buildQuery({ + encode: QuerySigningInfoRequest.encode, + decode: QuerySigningInfoResponse.decode, + service: "cosmos.slashing.v1beta1.Query", + method: "SigningInfo" +}); +/** + * SigningInfos queries signing info of all validators + * @name getSigningInfos + * @package cosmos.slashing.v1beta1 + * @see proto service: cosmos.slashing.v1beta1.SigningInfos + */ +export const getSigningInfos = buildQuery({ + encode: QuerySigningInfosRequest.encode, + decode: QuerySigningInfosResponse.decode, + service: "cosmos.slashing.v1beta1.Query", + method: "SigningInfos" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/slashing/v1beta1/tx.registry.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/slashing/v1beta1/tx.registry.ts index de16827766..114c70c136 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/slashing/v1beta1/tx.registry.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/slashing/v1beta1/tx.registry.ts @@ -1,12 +1,6 @@ import { TelescopeGeneratedType } from "../../../types"; -import { Registry } from "@cosmjs/proto-signing"; import { MsgUnjail, MsgUnjailSDKType } from "./tx"; export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/cosmos.slashing.v1beta1.MsgUnjail", MsgUnjail]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; export const MessageComposer = { encoded: { unjail(value: MsgUnjail) { diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/slashing/v1beta1/tx.rpc.func.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/slashing/v1beta1/tx.rpc.func.ts new file mode 100644 index 0000000000..175d9272fa --- /dev/null +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/slashing/v1beta1/tx.rpc.func.ts @@ -0,0 +1,13 @@ +import { buildTx } from "../../../helper-func-types"; +import { MsgUnjail, MsgUnjailSDKType, MsgUnjailResponse, MsgUnjailResponseSDKType } from "./tx"; +/** + * Unjail defines a method for unjailing a jailed validator, thus returning + * them into the bonded validator set, so they can begin receiving provisions + * and rewards again. + * @name unjail + * @package cosmos.slashing.v1beta1 + * @see proto service: cosmos.slashing.v1beta1.Unjail + */ +export const unjail = buildTx({ + msg: MsgUnjail +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/slashing/v1beta1/tx.rpc.msg.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/slashing/v1beta1/tx.rpc.msg.ts index 6903d5d8bf..abd1dfb5cc 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/slashing/v1beta1/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/slashing/v1beta1/tx.rpc.msg.ts @@ -1,4 +1,5 @@ -import { DeliverTxResponse, StdFee, TxRpc } from "../../../types"; +import { DeliverTxResponse } from "@interchainjs/types"; +import { StdFee, TxRpc } from "../../../types"; import { BinaryReader } from "../../../binary"; import { MsgUnjail, MsgUnjailSDKType, MsgUnjailResponse, MsgUnjailResponseSDKType } from "./tx"; /** Msg defines the slashing Msg service. */ diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/staking/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/staking/v1beta1/query.rpc.func.ts new file mode 100644 index 0000000000..71abf29eb2 --- /dev/null +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/staking/v1beta1/query.rpc.func.ts @@ -0,0 +1,176 @@ +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; +import { Validator, ValidatorSDKType, DelegationResponse, DelegationResponseSDKType, UnbondingDelegation, UnbondingDelegationSDKType, RedelegationResponse, RedelegationResponseSDKType, HistoricalInfo, HistoricalInfoSDKType, Pool, PoolSDKType, Params, ParamsSDKType } from "./staking"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { QueryValidatorsRequest, QueryValidatorsRequestSDKType, QueryValidatorsResponse, QueryValidatorsResponseSDKType, QueryValidatorRequest, QueryValidatorRequestSDKType, QueryValidatorResponse, QueryValidatorResponseSDKType, QueryValidatorDelegationsRequest, QueryValidatorDelegationsRequestSDKType, QueryValidatorDelegationsResponse, QueryValidatorDelegationsResponseSDKType, QueryValidatorUnbondingDelegationsRequest, QueryValidatorUnbondingDelegationsRequestSDKType, QueryValidatorUnbondingDelegationsResponse, QueryValidatorUnbondingDelegationsResponseSDKType, QueryDelegationRequest, QueryDelegationRequestSDKType, QueryDelegationResponse, QueryDelegationResponseSDKType, QueryUnbondingDelegationRequest, QueryUnbondingDelegationRequestSDKType, QueryUnbondingDelegationResponse, QueryUnbondingDelegationResponseSDKType, QueryDelegatorDelegationsRequest, QueryDelegatorDelegationsRequestSDKType, QueryDelegatorDelegationsResponse, QueryDelegatorDelegationsResponseSDKType, QueryDelegatorUnbondingDelegationsRequest, QueryDelegatorUnbondingDelegationsRequestSDKType, QueryDelegatorUnbondingDelegationsResponse, QueryDelegatorUnbondingDelegationsResponseSDKType, QueryRedelegationsRequest, QueryRedelegationsRequestSDKType, QueryRedelegationsResponse, QueryRedelegationsResponseSDKType, QueryDelegatorValidatorsRequest, QueryDelegatorValidatorsRequestSDKType, QueryDelegatorValidatorsResponse, QueryDelegatorValidatorsResponseSDKType, QueryDelegatorValidatorRequest, QueryDelegatorValidatorRequestSDKType, QueryDelegatorValidatorResponse, QueryDelegatorValidatorResponseSDKType, QueryHistoricalInfoRequest, QueryHistoricalInfoRequestSDKType, QueryHistoricalInfoResponse, QueryHistoricalInfoResponseSDKType, QueryPoolRequest, QueryPoolRequestSDKType, QueryPoolResponse, QueryPoolResponseSDKType, QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType } from "./query"; +/** + * Validators queries all validators that match the given status. + * @name getValidators + * @package cosmos.staking.v1beta1 + * @see proto service: cosmos.staking.v1beta1.Validators + */ +export const getValidators = buildQuery({ + encode: QueryValidatorsRequest.encode, + decode: QueryValidatorsResponse.decode, + service: "cosmos.staking.v1beta1.Query", + method: "Validators" +}); +/** + * Validator queries validator info for given validator address. + * @name getValidator + * @package cosmos.staking.v1beta1 + * @see proto service: cosmos.staking.v1beta1.Validator + */ +export const getValidator = buildQuery({ + encode: QueryValidatorRequest.encode, + decode: QueryValidatorResponse.decode, + service: "cosmos.staking.v1beta1.Query", + method: "Validator" +}); +/** + * ValidatorDelegations queries delegate info for given validator. + * @name getValidatorDelegations + * @package cosmos.staking.v1beta1 + * @see proto service: cosmos.staking.v1beta1.ValidatorDelegations + */ +export const getValidatorDelegations = buildQuery({ + encode: QueryValidatorDelegationsRequest.encode, + decode: QueryValidatorDelegationsResponse.decode, + service: "cosmos.staking.v1beta1.Query", + method: "ValidatorDelegations" +}); +/** + * ValidatorUnbondingDelegations queries unbonding delegations of a validator. + * @name getValidatorUnbondingDelegations + * @package cosmos.staking.v1beta1 + * @see proto service: cosmos.staking.v1beta1.ValidatorUnbondingDelegations + */ +export const getValidatorUnbondingDelegations = buildQuery({ + encode: QueryValidatorUnbondingDelegationsRequest.encode, + decode: QueryValidatorUnbondingDelegationsResponse.decode, + service: "cosmos.staking.v1beta1.Query", + method: "ValidatorUnbondingDelegations" +}); +/** + * Delegation queries delegate info for given validator delegator pair. + * @name getDelegation + * @package cosmos.staking.v1beta1 + * @see proto service: cosmos.staking.v1beta1.Delegation + */ +export const getDelegation = buildQuery({ + encode: QueryDelegationRequest.encode, + decode: QueryDelegationResponse.decode, + service: "cosmos.staking.v1beta1.Query", + method: "Delegation" +}); +/** + * UnbondingDelegation queries unbonding info for given validator delegator + * pair. + * @name getUnbondingDelegation + * @package cosmos.staking.v1beta1 + * @see proto service: cosmos.staking.v1beta1.UnbondingDelegation + */ +export const getUnbondingDelegation = buildQuery({ + encode: QueryUnbondingDelegationRequest.encode, + decode: QueryUnbondingDelegationResponse.decode, + service: "cosmos.staking.v1beta1.Query", + method: "UnbondingDelegation" +}); +/** + * DelegatorDelegations queries all delegations of a given delegator address. + * @name getDelegatorDelegations + * @package cosmos.staking.v1beta1 + * @see proto service: cosmos.staking.v1beta1.DelegatorDelegations + */ +export const getDelegatorDelegations = buildQuery({ + encode: QueryDelegatorDelegationsRequest.encode, + decode: QueryDelegatorDelegationsResponse.decode, + service: "cosmos.staking.v1beta1.Query", + method: "DelegatorDelegations" +}); +/** + * DelegatorUnbondingDelegations queries all unbonding delegations of a given + * delegator address. + * @name getDelegatorUnbondingDelegations + * @package cosmos.staking.v1beta1 + * @see proto service: cosmos.staking.v1beta1.DelegatorUnbondingDelegations + */ +export const getDelegatorUnbondingDelegations = buildQuery({ + encode: QueryDelegatorUnbondingDelegationsRequest.encode, + decode: QueryDelegatorUnbondingDelegationsResponse.decode, + service: "cosmos.staking.v1beta1.Query", + method: "DelegatorUnbondingDelegations" +}); +/** + * Redelegations queries redelegations of given address. + * @name getRedelegations + * @package cosmos.staking.v1beta1 + * @see proto service: cosmos.staking.v1beta1.Redelegations + */ +export const getRedelegations = buildQuery({ + encode: QueryRedelegationsRequest.encode, + decode: QueryRedelegationsResponse.decode, + service: "cosmos.staking.v1beta1.Query", + method: "Redelegations" +}); +/** + * DelegatorValidators queries all validators info for given delegator + * address. + * @name getDelegatorValidators + * @package cosmos.staking.v1beta1 + * @see proto service: cosmos.staking.v1beta1.DelegatorValidators + */ +export const getDelegatorValidators = buildQuery({ + encode: QueryDelegatorValidatorsRequest.encode, + decode: QueryDelegatorValidatorsResponse.decode, + service: "cosmos.staking.v1beta1.Query", + method: "DelegatorValidators" +}); +/** + * DelegatorValidator queries validator info for given delegator validator + * pair. + * @name getDelegatorValidator + * @package cosmos.staking.v1beta1 + * @see proto service: cosmos.staking.v1beta1.DelegatorValidator + */ +export const getDelegatorValidator = buildQuery({ + encode: QueryDelegatorValidatorRequest.encode, + decode: QueryDelegatorValidatorResponse.decode, + service: "cosmos.staking.v1beta1.Query", + method: "DelegatorValidator" +}); +/** + * HistoricalInfo queries the historical info for given height. + * @name getHistoricalInfo + * @package cosmos.staking.v1beta1 + * @see proto service: cosmos.staking.v1beta1.HistoricalInfo + */ +export const getHistoricalInfo = buildQuery({ + encode: QueryHistoricalInfoRequest.encode, + decode: QueryHistoricalInfoResponse.decode, + service: "cosmos.staking.v1beta1.Query", + method: "HistoricalInfo" +}); +/** + * Pool queries the pool info. + * @name getPool + * @package cosmos.staking.v1beta1 + * @see proto service: cosmos.staking.v1beta1.Pool + */ +export const getPool = buildQuery({ + encode: QueryPoolRequest.encode, + decode: QueryPoolResponse.decode, + service: "cosmos.staking.v1beta1.Query", + method: "Pool" +}); +/** + * Parameters queries the staking parameters. + * @name getParams + * @package cosmos.staking.v1beta1 + * @see proto service: cosmos.staking.v1beta1.Params + */ +export const getParams = buildQuery({ + encode: QueryParamsRequest.encode, + decode: QueryParamsResponse.decode, + service: "cosmos.staking.v1beta1.Query", + method: "Params" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/staking/v1beta1/staking.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/staking/v1beta1/staking.ts index 0877513cec..c7e76a0742 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/staking/v1beta1/staking.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/staking/v1beta1/staking.ts @@ -6,8 +6,8 @@ import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { isSet, DeepPartial, toTimestamp, fromTimestamp } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; -import { Decimal } from "@cosmjs/math"; -import { encodePubkey, decodePubkey } from "@cosmjs/proto-signing"; +import { Decimal } from "@interchainjs/math"; +import { encodePubkey, decodePubkey } from "@interchainjs/pubkey"; export const protobufPackage = "cosmos.staking.v1beta1"; /** BondStatus is the status of a validator. */ export enum BondStatus { @@ -1010,9 +1010,9 @@ export const CommissionRates = { }, toAmino(message: CommissionRates): CommissionRatesAmino { const obj: any = {}; - obj.rate = message.rate === "" ? undefined : message.rate; - obj.max_rate = message.maxRate === "" ? undefined : message.maxRate; - obj.max_change_rate = message.maxChangeRate === "" ? undefined : message.maxChangeRate; + obj.rate = message.rate === "" ? undefined : Decimal.fromUserInput(message.rate, 18).atomics; + obj.max_rate = message.maxRate === "" ? undefined : Decimal.fromUserInput(message.maxRate, 18).atomics; + obj.max_change_rate = message.maxChangeRate === "" ? undefined : Decimal.fromUserInput(message.maxChangeRate, 18).atomics; return obj; }, fromAminoMsg(object: CommissionRatesAminoMsg): CommissionRates { @@ -1579,7 +1579,7 @@ export const Validator = { obj.jailed = message.jailed === false ? undefined : message.jailed; obj.status = message.status === 0 ? undefined : message.status; obj.tokens = message.tokens === "" ? undefined : message.tokens; - obj.delegator_shares = message.delegatorShares === "" ? undefined : message.delegatorShares; + obj.delegator_shares = message.delegatorShares === "" ? undefined : Decimal.fromUserInput(message.delegatorShares, 18).atomics; obj.description = message.description ? Description.toAmino(message.description) : undefined; obj.unbonding_height = message.unbondingHeight !== BigInt(0) ? message.unbondingHeight?.toString() : undefined; obj.unbonding_time = message.unbondingTime ? Timestamp.toAmino(toTimestamp(message.unbondingTime)) : undefined; @@ -2306,7 +2306,7 @@ export const Delegation = { const obj: any = {}; obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; - obj.shares = message.shares === "" ? undefined : message.shares; + obj.shares = message.shares === "" ? undefined : Decimal.fromUserInput(message.shares, 18).atomics; return obj; }, fromAminoMsg(object: DelegationAminoMsg): Delegation { @@ -2757,7 +2757,7 @@ export const RedelegationEntry = { obj.creation_height = message.creationHeight !== BigInt(0) ? message.creationHeight?.toString() : undefined; obj.completion_time = message.completionTime ? Timestamp.toAmino(toTimestamp(message.completionTime)) : undefined; obj.initial_balance = message.initialBalance === "" ? undefined : message.initialBalance; - obj.shares_dst = message.sharesDst === "" ? undefined : message.sharesDst; + obj.shares_dst = message.sharesDst === "" ? undefined : Decimal.fromUserInput(message.sharesDst, 18).atomics; return obj; }, fromAminoMsg(object: RedelegationEntryAminoMsg): RedelegationEntry { @@ -3106,7 +3106,7 @@ export const Params = { obj.max_entries = message.maxEntries === 0 ? undefined : message.maxEntries; obj.historical_entries = message.historicalEntries === 0 ? undefined : message.historicalEntries; obj.bond_denom = message.bondDenom === "" ? undefined : message.bondDenom; - obj.min_commission_rate = message.minCommissionRate === "" ? undefined : message.minCommissionRate; + obj.min_commission_rate = message.minCommissionRate === "" ? undefined : Decimal.fromUserInput(message.minCommissionRate, 18).atomics; return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/staking/v1beta1/tx.amino.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/staking/v1beta1/tx.amino.ts index ba1c07aecb..a841898404 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/staking/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/staking/v1beta1/tx.amino.ts @@ -3,7 +3,8 @@ import { Any, AnySDKType } from "../../../google/protobuf/any"; import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; import { Timestamp, TimestampSDKType } from "../../../google/protobuf/timestamp"; import { AminoMsg, Pubkey } from "@cosmjs/amino"; -import { decodePubkey, encodePubkey } from "@cosmjs/proto-signing"; +import { Decimal } from "@interchainjs/math"; +import { decodePubkey, encodePubkey } from "@interchainjs/pubkey"; import { MsgCreateValidator, MsgCreateValidatorSDKType, MsgEditValidator, MsgEditValidatorSDKType, MsgDelegate, MsgDelegateSDKType, MsgBeginRedelegate, MsgBeginRedelegateSDKType, MsgUndelegate, MsgUndelegateSDKType } from "./tx"; export interface MsgCreateValidatorAminoType extends AminoMsg { type: "cosmos-sdk/MsgCreateValidator"; @@ -100,9 +101,9 @@ export const AminoConverter = { details: description.details }, commission: { - rate: commission.rate, - max_rate: commission.maxRate, - max_change_rate: commission.maxChangeRate + rate: Decimal.fromUserInput(commission.rate, 18).atomics, + max_rate: Decimal.fromUserInput(commission.maxRate, 18).atomics, + max_change_rate: Decimal.fromUserInput(commission.maxChangeRate, 18).atomics }, min_self_delegation: minSelfDelegation, delegator_address: delegatorAddress, @@ -164,7 +165,7 @@ export const AminoConverter = { details: description.details }, validator_address: validatorAddress, - commission_rate: commissionRate, + commission_rate: Decimal.fromUserInput(commissionRate, 18).atomics, min_self_delegation: minSelfDelegation }; }, diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/staking/v1beta1/tx.registry.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/staking/v1beta1/tx.registry.ts index c831de03e2..b220546f20 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/staking/v1beta1/tx.registry.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/staking/v1beta1/tx.registry.ts @@ -3,14 +3,8 @@ import { Any, AnySDKType } from "../../../google/protobuf/any"; import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; import { Timestamp, TimestampSDKType } from "../../../google/protobuf/timestamp"; import { TelescopeGeneratedType } from "../../../types"; -import { Registry } from "@cosmjs/proto-signing"; import { MsgCreateValidator, MsgCreateValidatorSDKType, MsgEditValidator, MsgEditValidatorSDKType, MsgDelegate, MsgDelegateSDKType, MsgBeginRedelegate, MsgBeginRedelegateSDKType, MsgUndelegate, MsgUndelegateSDKType } from "./tx"; export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/cosmos.staking.v1beta1.MsgCreateValidator", MsgCreateValidator], ["/cosmos.staking.v1beta1.MsgEditValidator", MsgEditValidator], ["/cosmos.staking.v1beta1.MsgDelegate", MsgDelegate], ["/cosmos.staking.v1beta1.MsgBeginRedelegate", MsgBeginRedelegate], ["/cosmos.staking.v1beta1.MsgUndelegate", MsgUndelegate]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; export const MessageComposer = { encoded: { createValidator(value: MsgCreateValidator) { diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/staking/v1beta1/tx.rpc.func.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/staking/v1beta1/tx.rpc.func.ts new file mode 100644 index 0000000000..9609629ce1 --- /dev/null +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/staking/v1beta1/tx.rpc.func.ts @@ -0,0 +1,54 @@ +import { Description, DescriptionSDKType, CommissionRates, CommissionRatesSDKType } from "./staking"; +import { Any, AnySDKType } from "../../../google/protobuf/any"; +import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; +import { Timestamp, TimestampSDKType } from "../../../google/protobuf/timestamp"; +import { buildTx } from "../../../helper-func-types"; +import { MsgCreateValidator, MsgCreateValidatorSDKType, MsgCreateValidatorResponse, MsgCreateValidatorResponseSDKType, MsgEditValidator, MsgEditValidatorSDKType, MsgEditValidatorResponse, MsgEditValidatorResponseSDKType, MsgDelegate, MsgDelegateSDKType, MsgDelegateResponse, MsgDelegateResponseSDKType, MsgBeginRedelegate, MsgBeginRedelegateSDKType, MsgBeginRedelegateResponse, MsgBeginRedelegateResponseSDKType, MsgUndelegate, MsgUndelegateSDKType, MsgUndelegateResponse, MsgUndelegateResponseSDKType } from "./tx"; +/** + * CreateValidator defines a method for creating a new validator. + * @name createValidator + * @package cosmos.staking.v1beta1 + * @see proto service: cosmos.staking.v1beta1.CreateValidator + */ +export const createValidator = buildTx({ + msg: MsgCreateValidator +}); +/** + * EditValidator defines a method for editing an existing validator. + * @name editValidator + * @package cosmos.staking.v1beta1 + * @see proto service: cosmos.staking.v1beta1.EditValidator + */ +export const editValidator = buildTx({ + msg: MsgEditValidator +}); +/** + * Delegate defines a method for performing a delegation of coins + * from a delegator to a validator. + * @name delegate + * @package cosmos.staking.v1beta1 + * @see proto service: cosmos.staking.v1beta1.Delegate + */ +export const delegate = buildTx({ + msg: MsgDelegate +}); +/** + * BeginRedelegate defines a method for performing a redelegation + * of coins from a delegator and source validator to a destination validator. + * @name beginRedelegate + * @package cosmos.staking.v1beta1 + * @see proto service: cosmos.staking.v1beta1.BeginRedelegate + */ +export const beginRedelegate = buildTx({ + msg: MsgBeginRedelegate +}); +/** + * Undelegate defines a method for performing an undelegation from a + * delegate and a validator. + * @name undelegate + * @package cosmos.staking.v1beta1 + * @see proto service: cosmos.staking.v1beta1.Undelegate + */ +export const undelegate = buildTx({ + msg: MsgUndelegate +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/staking/v1beta1/tx.rpc.msg.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/staking/v1beta1/tx.rpc.msg.ts index 24cef33de1..d177cfcce2 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/staking/v1beta1/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/staking/v1beta1/tx.rpc.msg.ts @@ -2,7 +2,8 @@ import { Description, DescriptionSDKType, CommissionRates, CommissionRatesSDKTyp import { Any, AnySDKType } from "../../../google/protobuf/any"; import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; import { Timestamp, TimestampSDKType } from "../../../google/protobuf/timestamp"; -import { DeliverTxResponse, StdFee, TxRpc } from "../../../types"; +import { DeliverTxResponse } from "@interchainjs/types"; +import { StdFee, TxRpc } from "../../../types"; import { BinaryReader } from "../../../binary"; import { MsgCreateValidator, MsgCreateValidatorSDKType, MsgCreateValidatorResponse, MsgCreateValidatorResponseSDKType, MsgEditValidator, MsgEditValidatorSDKType, MsgEditValidatorResponse, MsgEditValidatorResponseSDKType, MsgDelegate, MsgDelegateSDKType, MsgDelegateResponse, MsgDelegateResponseSDKType, MsgBeginRedelegate, MsgBeginRedelegateSDKType, MsgBeginRedelegateResponse, MsgBeginRedelegateResponseSDKType, MsgUndelegate, MsgUndelegateSDKType, MsgUndelegateResponse, MsgUndelegateResponseSDKType } from "./tx"; /** Msg defines the staking Msg service. */ diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/staking/v1beta1/tx.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/staking/v1beta1/tx.ts index 4691aed2f4..63e7f7f840 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/staking/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/staking/v1beta1/tx.ts @@ -5,8 +5,8 @@ import { Timestamp, TimestampSDKType } from "../../../google/protobuf/timestamp" import { BinaryReader, BinaryWriter } from "../../../binary"; import { isSet, DeepPartial, toTimestamp, fromTimestamp } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; -import { encodePubkey, decodePubkey } from "@cosmjs/proto-signing"; -import { Decimal } from "@cosmjs/math"; +import { encodePubkey, decodePubkey } from "@interchainjs/pubkey"; +import { Decimal } from "@interchainjs/math"; export const protobufPackage = "cosmos.staking.v1beta1"; /** * MsgCreateValidator defines a SDK message for creating a new validator. @@ -677,7 +677,7 @@ export const MsgEditValidator = { const obj: any = {}; obj.description = message.description ? Description.toAmino(message.description) : undefined; obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; - obj.commission_rate = message.commissionRate === "" ? undefined : message.commissionRate; + obj.commission_rate = message.commissionRate === "" ? undefined : Decimal.fromUserInput(message.commissionRate, 18).atomics; obj.min_self_delegation = message.minSelfDelegation === "" ? undefined : message.minSelfDelegation; return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/tx/v1beta1/service.rpc.func.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/tx/v1beta1/service.rpc.func.ts new file mode 100644 index 0000000000..92ccd67aa3 --- /dev/null +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/tx/v1beta1/service.rpc.func.ts @@ -0,0 +1,69 @@ +import { Tx, TxSDKType } from "./tx"; +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; +import { TxResponse, TxResponseSDKType, GasInfo, GasInfoSDKType, Result, ResultSDKType } from "../../base/abci/v1beta1/abci"; +import { BlockID, BlockIDSDKType } from "../../../tendermint/types/types"; +import { Block, BlockSDKType } from "../../../tendermint/types/block"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { SimulateRequest, SimulateRequestSDKType, SimulateResponse, SimulateResponseSDKType, GetTxRequest, GetTxRequestSDKType, GetTxResponse, GetTxResponseSDKType, BroadcastTxRequest, BroadcastTxRequestSDKType, BroadcastTxResponse, BroadcastTxResponseSDKType, GetTxsEventRequest, GetTxsEventRequestSDKType, GetTxsEventResponse, GetTxsEventResponseSDKType, GetBlockWithTxsRequest, GetBlockWithTxsRequestSDKType, GetBlockWithTxsResponse, GetBlockWithTxsResponseSDKType } from "./service"; +/** + * Simulate simulates executing a transaction for estimating gas usage. + * @name getSimulate + * @package cosmos.tx.v1beta1 + * @see proto service: cosmos.tx.v1beta1.Simulate + */ +export const getSimulate = buildQuery({ + encode: SimulateRequest.encode, + decode: SimulateResponse.decode, + service: "cosmos.tx.v1beta1.Service", + method: "Simulate" +}); +/** + * GetTx fetches a tx by hash. + * @name getGetTx + * @package cosmos.tx.v1beta1 + * @see proto service: cosmos.tx.v1beta1.GetTx + */ +export const getGetTx = buildQuery({ + encode: GetTxRequest.encode, + decode: GetTxResponse.decode, + service: "cosmos.tx.v1beta1.Service", + method: "GetTx" +}); +/** + * BroadcastTx broadcast transaction. + * @name getBroadcastTx + * @package cosmos.tx.v1beta1 + * @see proto service: cosmos.tx.v1beta1.BroadcastTx + */ +export const getBroadcastTx = buildQuery({ + encode: BroadcastTxRequest.encode, + decode: BroadcastTxResponse.decode, + service: "cosmos.tx.v1beta1.Service", + method: "BroadcastTx" +}); +/** + * GetTxsEvent fetches txs by event. + * @name getGetTxsEvent + * @package cosmos.tx.v1beta1 + * @see proto service: cosmos.tx.v1beta1.GetTxsEvent + */ +export const getGetTxsEvent = buildQuery({ + encode: GetTxsEventRequest.encode, + decode: GetTxsEventResponse.decode, + service: "cosmos.tx.v1beta1.Service", + method: "GetTxsEvent" +}); +/** + * GetBlockWithTxs fetches a block with decoded txs. + * + * Since: cosmos-sdk 0.45.2 + * @name getGetBlockWithTxs + * @package cosmos.tx.v1beta1 + * @see proto service: cosmos.tx.v1beta1.GetBlockWithTxs + */ +export const getGetBlockWithTxs = buildQuery({ + encode: GetBlockWithTxsRequest.encode, + decode: GetBlockWithTxsResponse.decode, + service: "cosmos.tx.v1beta1.Service", + method: "GetBlockWithTxs" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/upgrade/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/upgrade/v1beta1/query.rpc.func.ts new file mode 100644 index 0000000000..e3cbd36065 --- /dev/null +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/upgrade/v1beta1/query.rpc.func.ts @@ -0,0 +1,71 @@ +import { Plan, PlanSDKType, ModuleVersion, ModuleVersionSDKType } from "./upgrade"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { QueryCurrentPlanRequest, QueryCurrentPlanRequestSDKType, QueryCurrentPlanResponse, QueryCurrentPlanResponseSDKType, QueryAppliedPlanRequest, QueryAppliedPlanRequestSDKType, QueryAppliedPlanResponse, QueryAppliedPlanResponseSDKType, QueryUpgradedConsensusStateRequest, QueryUpgradedConsensusStateRequestSDKType, QueryUpgradedConsensusStateResponse, QueryUpgradedConsensusStateResponseSDKType, QueryModuleVersionsRequest, QueryModuleVersionsRequestSDKType, QueryModuleVersionsResponse, QueryModuleVersionsResponseSDKType, QueryAuthorityRequest, QueryAuthorityRequestSDKType, QueryAuthorityResponse, QueryAuthorityResponseSDKType } from "./query"; +/** + * CurrentPlan queries the current upgrade plan. + * @name getCurrentPlan + * @package cosmos.upgrade.v1beta1 + * @see proto service: cosmos.upgrade.v1beta1.CurrentPlan + */ +export const getCurrentPlan = buildQuery({ + encode: QueryCurrentPlanRequest.encode, + decode: QueryCurrentPlanResponse.decode, + service: "cosmos.upgrade.v1beta1.Query", + method: "CurrentPlan" +}); +/** + * AppliedPlan queries a previously applied upgrade plan by its name. + * @name getAppliedPlan + * @package cosmos.upgrade.v1beta1 + * @see proto service: cosmos.upgrade.v1beta1.AppliedPlan + */ +export const getAppliedPlan = buildQuery({ + encode: QueryAppliedPlanRequest.encode, + decode: QueryAppliedPlanResponse.decode, + service: "cosmos.upgrade.v1beta1.Query", + method: "AppliedPlan" +}); +/** + * UpgradedConsensusState queries the consensus state that will serve + * as a trusted kernel for the next version of this chain. It will only be + * stored at the last height of this chain. + * UpgradedConsensusState RPC not supported with legacy querier + * This rpc is deprecated now that IBC has its own replacement + * (https://github.com/cosmos/ibc-go/blob/2c880a22e9f9cc75f62b527ca94aa75ce1106001/proto/ibc/core/client/v1/query.proto#L54) + * @name getUpgradedConsensusState + * @package cosmos.upgrade.v1beta1 + * @see proto service: cosmos.upgrade.v1beta1.UpgradedConsensusState + * @deprecated + */ +export const getUpgradedConsensusState = buildQuery({ + encode: QueryUpgradedConsensusStateRequest.encode, + decode: QueryUpgradedConsensusStateResponse.decode, + service: "cosmos.upgrade.v1beta1.Query", + method: "UpgradedConsensusState" +}); +/** + * ModuleVersions queries the list of module versions from state. + * + * Since: cosmos-sdk 0.43 + * @name getModuleVersions + * @package cosmos.upgrade.v1beta1 + * @see proto service: cosmos.upgrade.v1beta1.ModuleVersions + */ +export const getModuleVersions = buildQuery({ + encode: QueryModuleVersionsRequest.encode, + decode: QueryModuleVersionsResponse.decode, + service: "cosmos.upgrade.v1beta1.Query", + method: "ModuleVersions" +}); +/** + * Returns the account with authority to conduct upgrades + * @name getAuthority + * @package cosmos.upgrade.v1beta1 + * @see proto service: cosmos.upgrade.v1beta1.Authority + */ +export const getAuthority = buildQuery({ + encode: QueryAuthorityRequest.encode, + decode: QueryAuthorityResponse.decode, + service: "cosmos.upgrade.v1beta1.Query", + method: "Authority" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/upgrade/v1beta1/tx.registry.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/upgrade/v1beta1/tx.registry.ts index a938035698..2ed5f7f5bb 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/upgrade/v1beta1/tx.registry.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/upgrade/v1beta1/tx.registry.ts @@ -1,13 +1,7 @@ import { Plan, PlanSDKType } from "./upgrade"; import { TelescopeGeneratedType } from "../../../types"; -import { Registry } from "@cosmjs/proto-signing"; import { MsgSoftwareUpgrade, MsgSoftwareUpgradeSDKType, MsgCancelUpgrade, MsgCancelUpgradeSDKType } from "./tx"; export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/cosmos.upgrade.v1beta1.MsgSoftwareUpgrade", MsgSoftwareUpgrade], ["/cosmos.upgrade.v1beta1.MsgCancelUpgrade", MsgCancelUpgrade]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; export const MessageComposer = { encoded: { softwareUpgrade(value: MsgSoftwareUpgrade) { diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/upgrade/v1beta1/tx.rpc.func.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/upgrade/v1beta1/tx.rpc.func.ts new file mode 100644 index 0000000000..ad84eeefb9 --- /dev/null +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/upgrade/v1beta1/tx.rpc.func.ts @@ -0,0 +1,26 @@ +import { Plan, PlanSDKType } from "./upgrade"; +import { buildTx } from "../../../helper-func-types"; +import { MsgSoftwareUpgrade, MsgSoftwareUpgradeSDKType, MsgSoftwareUpgradeResponse, MsgSoftwareUpgradeResponseSDKType, MsgCancelUpgrade, MsgCancelUpgradeSDKType, MsgCancelUpgradeResponse, MsgCancelUpgradeResponseSDKType } from "./tx"; +/** + * SoftwareUpgrade is a governance operation for initiating a software upgrade. + * + * Since: cosmos-sdk 0.46 + * @name softwareUpgrade + * @package cosmos.upgrade.v1beta1 + * @see proto service: cosmos.upgrade.v1beta1.SoftwareUpgrade + */ +export const softwareUpgrade = buildTx({ + msg: MsgSoftwareUpgrade +}); +/** + * CancelUpgrade is a governance operation for cancelling a previously + * approvid software upgrade. + * + * Since: cosmos-sdk 0.46 + * @name cancelUpgrade + * @package cosmos.upgrade.v1beta1 + * @see proto service: cosmos.upgrade.v1beta1.CancelUpgrade + */ +export const cancelUpgrade = buildTx({ + msg: MsgCancelUpgrade +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/upgrade/v1beta1/tx.rpc.msg.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/upgrade/v1beta1/tx.rpc.msg.ts index 23bf8c8fe7..745ae894e7 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/upgrade/v1beta1/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/upgrade/v1beta1/tx.rpc.msg.ts @@ -1,5 +1,6 @@ import { Plan, PlanSDKType } from "./upgrade"; -import { DeliverTxResponse, StdFee, TxRpc } from "../../../types"; +import { DeliverTxResponse } from "@interchainjs/types"; +import { StdFee, TxRpc } from "../../../types"; import { BinaryReader } from "../../../binary"; import { MsgSoftwareUpgrade, MsgSoftwareUpgradeSDKType, MsgSoftwareUpgradeResponse, MsgSoftwareUpgradeResponseSDKType, MsgCancelUpgrade, MsgCancelUpgradeSDKType, MsgCancelUpgradeResponse, MsgCancelUpgradeResponseSDKType } from "./tx"; /** Msg defines the upgrade Msg service. */ diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/vesting/v1beta1/tx.registry.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/vesting/v1beta1/tx.registry.ts index 74a9eb09c5..f3c470a160 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/vesting/v1beta1/tx.registry.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/vesting/v1beta1/tx.registry.ts @@ -1,14 +1,8 @@ import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; import { Period, PeriodSDKType } from "./vesting"; import { TelescopeGeneratedType } from "../../../types"; -import { Registry } from "@cosmjs/proto-signing"; import { MsgCreateVestingAccount, MsgCreateVestingAccountSDKType, MsgCreatePermanentLockedAccount, MsgCreatePermanentLockedAccountSDKType, MsgCreatePeriodicVestingAccount, MsgCreatePeriodicVestingAccountSDKType } from "./tx"; export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/cosmos.vesting.v1beta1.MsgCreateVestingAccount", MsgCreateVestingAccount], ["/cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccount", MsgCreatePermanentLockedAccount], ["/cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccount", MsgCreatePeriodicVestingAccount]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; export const MessageComposer = { encoded: { createVestingAccount(value: MsgCreateVestingAccount) { diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/vesting/v1beta1/tx.rpc.func.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/vesting/v1beta1/tx.rpc.func.ts new file mode 100644 index 0000000000..1e5c552640 --- /dev/null +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/vesting/v1beta1/tx.rpc.func.ts @@ -0,0 +1,34 @@ +import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; +import { Period, PeriodSDKType } from "./vesting"; +import { buildTx } from "../../../helper-func-types"; +import { MsgCreateVestingAccount, MsgCreateVestingAccountSDKType, MsgCreateVestingAccountResponse, MsgCreateVestingAccountResponseSDKType, MsgCreatePermanentLockedAccount, MsgCreatePermanentLockedAccountSDKType, MsgCreatePermanentLockedAccountResponse, MsgCreatePermanentLockedAccountResponseSDKType, MsgCreatePeriodicVestingAccount, MsgCreatePeriodicVestingAccountSDKType, MsgCreatePeriodicVestingAccountResponse, MsgCreatePeriodicVestingAccountResponseSDKType } from "./tx"; +/** + * CreateVestingAccount defines a method that enables creating a vesting + * account. + * @name createVestingAccount + * @package cosmos.vesting.v1beta1 + * @see proto service: cosmos.vesting.v1beta1.CreateVestingAccount + */ +export const createVestingAccount = buildTx({ + msg: MsgCreateVestingAccount +}); +/** + * CreatePermanentLockedAccount defines a method that enables creating a permanent + * locked account. + * @name createPermanentLockedAccount + * @package cosmos.vesting.v1beta1 + * @see proto service: cosmos.vesting.v1beta1.CreatePermanentLockedAccount + */ +export const createPermanentLockedAccount = buildTx({ + msg: MsgCreatePermanentLockedAccount +}); +/** + * CreatePeriodicVestingAccount defines a method that enables creating a + * periodic vesting account. + * @name createPeriodicVestingAccount + * @package cosmos.vesting.v1beta1 + * @see proto service: cosmos.vesting.v1beta1.CreatePeriodicVestingAccount + */ +export const createPeriodicVestingAccount = buildTx({ + msg: MsgCreatePeriodicVestingAccount +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/vesting/v1beta1/tx.rpc.msg.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/vesting/v1beta1/tx.rpc.msg.ts index 0596363411..ed65641bda 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/vesting/v1beta1/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/vesting/v1beta1/tx.rpc.msg.ts @@ -1,6 +1,7 @@ import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; import { Period, PeriodSDKType } from "./vesting"; -import { DeliverTxResponse, StdFee, TxRpc } from "../../../types"; +import { DeliverTxResponse } from "@interchainjs/types"; +import { StdFee, TxRpc } from "../../../types"; import { BinaryReader } from "../../../binary"; import { MsgCreateVestingAccount, MsgCreateVestingAccountSDKType, MsgCreateVestingAccountResponse, MsgCreateVestingAccountResponseSDKType, MsgCreatePermanentLockedAccount, MsgCreatePermanentLockedAccountSDKType, MsgCreatePermanentLockedAccountResponse, MsgCreatePermanentLockedAccountResponseSDKType, MsgCreatePeriodicVestingAccount, MsgCreatePeriodicVestingAccountSDKType, MsgCreatePeriodicVestingAccountResponse, MsgCreatePeriodicVestingAccountResponseSDKType } from "./tx"; /** Msg defines the bank Msg service. */ diff --git a/__fixtures__/v-next/outputinstantrpc/cosmwasm/bundle.ts b/__fixtures__/v-next/outputinstantrpc/cosmwasm/bundle.ts index 3cc96d9e49..5ce93aff23 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmwasm/bundle.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmwasm/bundle.ts @@ -4,14 +4,16 @@ import * as _149 from "./wasm/v1/proposal"; import * as _150 from "./wasm/v1/query"; import * as _151 from "./wasm/v1/tx"; import * as _152 from "./wasm/v1/types"; -import * as _434 from "./wasm/v1/tx.amino"; -import * as _435 from "./wasm/v1/tx.registry"; -import * as _436 from "./wasm/v1/query.lcd"; -import * as _437 from "./wasm/v1/query.rpc.Query"; -import * as _438 from "./wasm/v1/tx.rpc.msg"; -import * as _544 from "./lcd"; -import * as _545 from "./rpc.query"; -import * as _546 from "./rpc.tx"; +import * as _484 from "./wasm/v1/tx.amino"; +import * as _485 from "./wasm/v1/tx.registry"; +import * as _486 from "./wasm/v1/query.lcd"; +import * as _487 from "./wasm/v1/query.rpc.func"; +import * as _488 from "./wasm/v1/query.rpc.Query"; +import * as _489 from "./wasm/v1/tx.rpc.func"; +import * as _490 from "./wasm/v1/tx.rpc.msg"; +import * as _637 from "./lcd"; +import * as _638 from "./rpc.query"; +import * as _639 from "./rpc.tx"; export namespace cosmwasm { export namespace wasm { export const v1 = { @@ -21,16 +23,18 @@ export namespace cosmwasm { ..._150, ..._151, ..._152, - ..._434, - ..._435, - ..._436, - ..._437, - ..._438 + ..._484, + ..._485, + ..._486, + ..._487, + ..._488, + ..._489, + ..._490 }; } export const ClientFactory = { - ..._544, - ..._545, - ..._546 + ..._637, + ..._638, + ..._639 }; } \ No newline at end of file diff --git a/__fixtures__/v-next/outputinstantrpc/cosmwasm/wasm/v1/proposal.ts b/__fixtures__/v-next/outputinstantrpc/cosmwasm/wasm/v1/proposal.ts index 88c68c54d5..df353172b1 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmwasm/wasm/v1/proposal.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmwasm/wasm/v1/proposal.ts @@ -3,7 +3,7 @@ import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; -import { fromBase64, toBase64, toUtf8, fromUtf8 } from "@cosmjs/encoding"; +import { fromBase64, toBase64, toUtf8, fromUtf8 } from "@interchainjs/encoding"; export const protobufPackage = "cosmwasm.wasm.v1"; /** * StoreCodeProposal gov proposal content type to submit WASM code to the system diff --git a/__fixtures__/v-next/outputinstantrpc/cosmwasm/wasm/v1/query.rpc.func.ts b/__fixtures__/v-next/outputinstantrpc/cosmwasm/wasm/v1/query.rpc.func.ts new file mode 100644 index 0000000000..80787742a4 --- /dev/null +++ b/__fixtures__/v-next/outputinstantrpc/cosmwasm/wasm/v1/query.rpc.func.ts @@ -0,0 +1,112 @@ +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination"; +import { ContractInfo, ContractInfoSDKType, ContractCodeHistoryEntry, ContractCodeHistoryEntrySDKType, Model, ModelSDKType } from "./types"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { QueryContractInfoRequest, QueryContractInfoRequestSDKType, QueryContractInfoResponse, QueryContractInfoResponseSDKType, QueryContractHistoryRequest, QueryContractHistoryRequestSDKType, QueryContractHistoryResponse, QueryContractHistoryResponseSDKType, QueryContractsByCodeRequest, QueryContractsByCodeRequestSDKType, QueryContractsByCodeResponse, QueryContractsByCodeResponseSDKType, QueryAllContractStateRequest, QueryAllContractStateRequestSDKType, QueryAllContractStateResponse, QueryAllContractStateResponseSDKType, QueryRawContractStateRequest, QueryRawContractStateRequestSDKType, QueryRawContractStateResponse, QueryRawContractStateResponseSDKType, QuerySmartContractStateRequest, QuerySmartContractStateRequestSDKType, QuerySmartContractStateResponse, QuerySmartContractStateResponseSDKType, QueryCodeRequest, QueryCodeRequestSDKType, QueryCodeResponse, QueryCodeResponseSDKType, QueryCodesRequest, QueryCodesRequestSDKType, QueryCodesResponse, QueryCodesResponseSDKType, QueryPinnedCodesRequest, QueryPinnedCodesRequestSDKType, QueryPinnedCodesResponse, QueryPinnedCodesResponseSDKType } from "./query"; +/** + * ContractInfo gets the contract meta data + * @name getContractInfo + * @package cosmwasm.wasm.v1 + * @see proto service: cosmwasm.wasm.v1.ContractInfo + */ +export const getContractInfo = buildQuery({ + encode: QueryContractInfoRequest.encode, + decode: QueryContractInfoResponse.decode, + service: "cosmwasm.wasm.v1.Query", + method: "ContractInfo" +}); +/** + * ContractHistory gets the contract code history + * @name getContractHistory + * @package cosmwasm.wasm.v1 + * @see proto service: cosmwasm.wasm.v1.ContractHistory + */ +export const getContractHistory = buildQuery({ + encode: QueryContractHistoryRequest.encode, + decode: QueryContractHistoryResponse.decode, + service: "cosmwasm.wasm.v1.Query", + method: "ContractHistory" +}); +/** + * ContractsByCode lists all smart contracts for a code id + * @name getContractsByCode + * @package cosmwasm.wasm.v1 + * @see proto service: cosmwasm.wasm.v1.ContractsByCode + */ +export const getContractsByCode = buildQuery({ + encode: QueryContractsByCodeRequest.encode, + decode: QueryContractsByCodeResponse.decode, + service: "cosmwasm.wasm.v1.Query", + method: "ContractsByCode" +}); +/** + * AllContractState gets all raw store data for a single contract + * @name getAllContractState + * @package cosmwasm.wasm.v1 + * @see proto service: cosmwasm.wasm.v1.AllContractState + */ +export const getAllContractState = buildQuery({ + encode: QueryAllContractStateRequest.encode, + decode: QueryAllContractStateResponse.decode, + service: "cosmwasm.wasm.v1.Query", + method: "AllContractState" +}); +/** + * RawContractState gets single key from the raw store data of a contract + * @name getRawContractState + * @package cosmwasm.wasm.v1 + * @see proto service: cosmwasm.wasm.v1.RawContractState + */ +export const getRawContractState = buildQuery({ + encode: QueryRawContractStateRequest.encode, + decode: QueryRawContractStateResponse.decode, + service: "cosmwasm.wasm.v1.Query", + method: "RawContractState" +}); +/** + * SmartContractState get smart query result from the contract + * @name getSmartContractState + * @package cosmwasm.wasm.v1 + * @see proto service: cosmwasm.wasm.v1.SmartContractState + */ +export const getSmartContractState = buildQuery({ + encode: QuerySmartContractStateRequest.encode, + decode: QuerySmartContractStateResponse.decode, + service: "cosmwasm.wasm.v1.Query", + method: "SmartContractState" +}); +/** + * Code gets the binary code and metadata for a singe wasm code + * @name getCode + * @package cosmwasm.wasm.v1 + * @see proto service: cosmwasm.wasm.v1.Code + */ +export const getCode = buildQuery({ + encode: QueryCodeRequest.encode, + decode: QueryCodeResponse.decode, + service: "cosmwasm.wasm.v1.Query", + method: "Code" +}); +/** + * Codes gets the metadata for all stored wasm codes + * @name getCodes + * @package cosmwasm.wasm.v1 + * @see proto service: cosmwasm.wasm.v1.Codes + */ +export const getCodes = buildQuery({ + encode: QueryCodesRequest.encode, + decode: QueryCodesResponse.decode, + service: "cosmwasm.wasm.v1.Query", + method: "Codes" +}); +/** + * PinnedCodes gets the pinned code ids + * @name getPinnedCodes + * @package cosmwasm.wasm.v1 + * @see proto service: cosmwasm.wasm.v1.PinnedCodes + */ +export const getPinnedCodes = buildQuery({ + encode: QueryPinnedCodesRequest.encode, + decode: QueryPinnedCodesResponse.decode, + service: "cosmwasm.wasm.v1.Query", + method: "PinnedCodes" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputinstantrpc/cosmwasm/wasm/v1/query.ts b/__fixtures__/v-next/outputinstantrpc/cosmwasm/wasm/v1/query.ts index d16a5f49fd..8ae586511d 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmwasm/wasm/v1/query.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmwasm/wasm/v1/query.ts @@ -3,7 +3,7 @@ import { ContractInfo, ContractInfoSDKType, ContractCodeHistoryEntry, ContractCo import { BinaryReader, BinaryWriter } from "../../../binary"; import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; -import { toUtf8, fromUtf8 } from "@cosmjs/encoding"; +import { toUtf8, fromUtf8 } from "@interchainjs/encoding"; export const protobufPackage = "cosmwasm.wasm.v1"; /** * QueryContractInfoRequest is the request type for the Query/ContractInfo RPC diff --git a/__fixtures__/v-next/outputinstantrpc/cosmwasm/wasm/v1/tx.amino.ts b/__fixtures__/v-next/outputinstantrpc/cosmwasm/wasm/v1/tx.amino.ts index c466d644d8..9b033e4a5b 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmwasm/wasm/v1/tx.amino.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmwasm/wasm/v1/tx.amino.ts @@ -1,7 +1,7 @@ import { AccessConfig, AccessConfigSDKType, accessTypeFromJSON } from "./types"; import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { AminoMsg } from "@cosmjs/amino"; -import { toBase64, fromBase64, fromUtf8, toUtf8 } from "@cosmjs/encoding"; +import { toBase64, fromBase64, fromUtf8, toUtf8 } from "@interchainjs/encoding"; import { omitDefault } from "../../../helpers"; import { MsgStoreCode, MsgStoreCodeSDKType, MsgInstantiateContract, MsgInstantiateContractSDKType, MsgExecuteContract, MsgExecuteContractSDKType, MsgMigrateContract, MsgMigrateContractSDKType, MsgUpdateAdmin, MsgUpdateAdminSDKType, MsgClearAdmin, MsgClearAdminSDKType } from "./tx"; export interface MsgStoreCodeAminoType extends AminoMsg { diff --git a/__fixtures__/v-next/outputinstantrpc/cosmwasm/wasm/v1/tx.registry.ts b/__fixtures__/v-next/outputinstantrpc/cosmwasm/wasm/v1/tx.registry.ts index ef35709ada..d007f7e50d 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmwasm/wasm/v1/tx.registry.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmwasm/wasm/v1/tx.registry.ts @@ -1,14 +1,8 @@ import { AccessConfig, AccessConfigSDKType } from "./types"; import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { TelescopeGeneratedType } from "../../../types"; -import { Registry } from "@cosmjs/proto-signing"; import { MsgStoreCode, MsgStoreCodeSDKType, MsgInstantiateContract, MsgInstantiateContractSDKType, MsgExecuteContract, MsgExecuteContractSDKType, MsgMigrateContract, MsgMigrateContractSDKType, MsgUpdateAdmin, MsgUpdateAdminSDKType, MsgClearAdmin, MsgClearAdminSDKType } from "./tx"; export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/cosmwasm.wasm.v1.MsgStoreCode", MsgStoreCode], ["/cosmwasm.wasm.v1.MsgInstantiateContract", MsgInstantiateContract], ["/cosmwasm.wasm.v1.MsgExecuteContract", MsgExecuteContract], ["/cosmwasm.wasm.v1.MsgMigrateContract", MsgMigrateContract], ["/cosmwasm.wasm.v1.MsgUpdateAdmin", MsgUpdateAdmin], ["/cosmwasm.wasm.v1.MsgClearAdmin", MsgClearAdmin]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; export const MessageComposer = { encoded: { storeCode(value: MsgStoreCode) { diff --git a/__fixtures__/v-next/outputinstantrpc/cosmwasm/wasm/v1/tx.rpc.func.ts b/__fixtures__/v-next/outputinstantrpc/cosmwasm/wasm/v1/tx.rpc.func.ts new file mode 100644 index 0000000000..1faf1de1bf --- /dev/null +++ b/__fixtures__/v-next/outputinstantrpc/cosmwasm/wasm/v1/tx.rpc.func.ts @@ -0,0 +1,58 @@ +import { AccessConfig, AccessConfigSDKType } from "./types"; +import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; +import { buildTx } from "../../../helper-func-types"; +import { MsgStoreCode, MsgStoreCodeSDKType, MsgStoreCodeResponse, MsgStoreCodeResponseSDKType, MsgInstantiateContract, MsgInstantiateContractSDKType, MsgInstantiateContractResponse, MsgInstantiateContractResponseSDKType, MsgExecuteContract, MsgExecuteContractSDKType, MsgExecuteContractResponse, MsgExecuteContractResponseSDKType, MsgMigrateContract, MsgMigrateContractSDKType, MsgMigrateContractResponse, MsgMigrateContractResponseSDKType, MsgUpdateAdmin, MsgUpdateAdminSDKType, MsgUpdateAdminResponse, MsgUpdateAdminResponseSDKType, MsgClearAdmin, MsgClearAdminSDKType, MsgClearAdminResponse, MsgClearAdminResponseSDKType } from "./tx"; +/** + * StoreCode to submit Wasm code to the system + * @name storeCode + * @package cosmwasm.wasm.v1 + * @see proto service: cosmwasm.wasm.v1.StoreCode + */ +export const storeCode = buildTx({ + msg: MsgStoreCode +}); +/** + * Instantiate creates a new smart contract instance for the given code id. + * @name instantiateContract + * @package cosmwasm.wasm.v1 + * @see proto service: cosmwasm.wasm.v1.InstantiateContract + */ +export const instantiateContract = buildTx({ + msg: MsgInstantiateContract +}); +/** + * Execute submits the given message data to a smart contract + * @name executeContract + * @package cosmwasm.wasm.v1 + * @see proto service: cosmwasm.wasm.v1.ExecuteContract + */ +export const executeContract = buildTx({ + msg: MsgExecuteContract +}); +/** + * Migrate runs a code upgrade/ downgrade for a smart contract + * @name migrateContract + * @package cosmwasm.wasm.v1 + * @see proto service: cosmwasm.wasm.v1.MigrateContract + */ +export const migrateContract = buildTx({ + msg: MsgMigrateContract +}); +/** + * UpdateAdmin sets a new admin for a smart contract + * @name updateAdmin + * @package cosmwasm.wasm.v1 + * @see proto service: cosmwasm.wasm.v1.UpdateAdmin + */ +export const updateAdmin = buildTx({ + msg: MsgUpdateAdmin +}); +/** + * ClearAdmin removes any admin stored for a smart contract + * @name clearAdmin + * @package cosmwasm.wasm.v1 + * @see proto service: cosmwasm.wasm.v1.ClearAdmin + */ +export const clearAdmin = buildTx({ + msg: MsgClearAdmin +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputinstantrpc/cosmwasm/wasm/v1/tx.rpc.msg.ts b/__fixtures__/v-next/outputinstantrpc/cosmwasm/wasm/v1/tx.rpc.msg.ts index cbe39ed8e0..08fae77d18 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmwasm/wasm/v1/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmwasm/wasm/v1/tx.rpc.msg.ts @@ -1,6 +1,7 @@ import { AccessConfig, AccessConfigSDKType } from "./types"; import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; -import { DeliverTxResponse, StdFee, TxRpc } from "../../../types"; +import { DeliverTxResponse } from "@interchainjs/types"; +import { StdFee, TxRpc } from "../../../types"; import { BinaryReader } from "../../../binary"; import { MsgStoreCode, MsgStoreCodeSDKType, MsgStoreCodeResponse, MsgStoreCodeResponseSDKType, MsgInstantiateContract, MsgInstantiateContractSDKType, MsgInstantiateContractResponse, MsgInstantiateContractResponseSDKType, MsgExecuteContract, MsgExecuteContractSDKType, MsgExecuteContractResponse, MsgExecuteContractResponseSDKType, MsgMigrateContract, MsgMigrateContractSDKType, MsgMigrateContractResponse, MsgMigrateContractResponseSDKType, MsgUpdateAdmin, MsgUpdateAdminSDKType, MsgUpdateAdminResponse, MsgUpdateAdminResponseSDKType, MsgClearAdmin, MsgClearAdminSDKType, MsgClearAdminResponse, MsgClearAdminResponseSDKType } from "./tx"; /** Msg defines the wasm Msg service. */ diff --git a/__fixtures__/v-next/outputinstantrpc/cosmwasm/wasm/v1/tx.ts b/__fixtures__/v-next/outputinstantrpc/cosmwasm/wasm/v1/tx.ts index e81a9a9110..2a4f537bd6 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmwasm/wasm/v1/tx.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmwasm/wasm/v1/tx.ts @@ -3,7 +3,7 @@ import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; -import { fromBase64, toBase64, toUtf8, fromUtf8 } from "@cosmjs/encoding"; +import { fromBase64, toBase64, toUtf8, fromUtf8 } from "@interchainjs/encoding"; export const protobufPackage = "cosmwasm.wasm.v1"; /** * MsgStoreCode submit Wasm code to the system diff --git a/__fixtures__/v-next/outputinstantrpc/cosmwasm/wasm/v1/types.ts b/__fixtures__/v-next/outputinstantrpc/cosmwasm/wasm/v1/types.ts index bd17eec70b..7aa19b579f 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmwasm/wasm/v1/types.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmwasm/wasm/v1/types.ts @@ -2,7 +2,7 @@ import { Any, AnySDKType } from "../../../google/protobuf/any"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; -import { toUtf8, fromUtf8 } from "@cosmjs/encoding"; +import { toUtf8, fromUtf8 } from "@interchainjs/encoding"; export const protobufPackage = "cosmwasm.wasm.v1"; /** AccessType permission types */ export enum AccessType { diff --git a/__fixtures__/v-next/outputinstantrpc/custom-client.ts b/__fixtures__/v-next/outputinstantrpc/custom-client.ts index 825cd91f8a..573ed82c45 100644 --- a/__fixtures__/v-next/outputinstantrpc/custom-client.ts +++ b/__fixtures__/v-next/outputinstantrpc/custom-client.ts @@ -2,7 +2,8 @@ import { GeneratedType, Registry, OfflineSigner } from "@cosmjs/proto-signing"; import { defaultRegistryTypes, AminoTypes, SigningStargateClient } from "@cosmjs/stargate"; import { HttpEndpoint } from "@cosmjs/tendermint-rpc"; import { createRpcClient } from "./extern"; -import { DeliverTxResponse, EncodeObject, StdFee, TxRpc, SigningClientParams } from "./types"; +import { DeliverTxResponse } from "@interchainjs/types"; +import { EncodeObject, StdFee, TxRpc, SigningClientParams } from "./types"; import * as cosmosGovV1TxRegistry from "./cosmos/gov/v1/tx.registry"; import * as cosmosGovV1beta1TxRegistry from "./cosmos/gov/v1beta1/tx.registry"; import * as ibcCoreChannelV1TxRegistry from "./ibc/core/channel/v1/tx.registry"; diff --git a/__fixtures__/v-next/outputinstantrpc/evmos/bundle.ts b/__fixtures__/v-next/outputinstantrpc/evmos/bundle.ts index afa209d271..f52b9e400a 100644 --- a/__fixtures__/v-next/outputinstantrpc/evmos/bundle.ts +++ b/__fixtures__/v-next/outputinstantrpc/evmos/bundle.ts @@ -22,54 +22,67 @@ import * as _173 from "./recovery/v1/query"; import * as _174 from "./vesting/v1/query"; import * as _175 from "./vesting/v1/tx"; import * as _176 from "./vesting/v1/vesting"; -import * as _439 from "./erc20/v1/tx.amino"; -import * as _440 from "./fees/v1/tx.amino"; -import * as _441 from "./vesting/v1/tx.amino"; -import * as _442 from "./erc20/v1/tx.registry"; -import * as _443 from "./fees/v1/tx.registry"; -import * as _444 from "./vesting/v1/tx.registry"; -import * as _445 from "./claims/v1/query.lcd"; -import * as _446 from "./epochs/v1/query.lcd"; -import * as _447 from "./erc20/v1/query.lcd"; -import * as _448 from "./fees/v1/query.lcd"; -import * as _449 from "./incentives/v1/query.lcd"; -import * as _450 from "./inflation/v1/query.lcd"; -import * as _451 from "./recovery/v1/query.lcd"; -import * as _452 from "./vesting/v1/query.lcd"; -import * as _453 from "./claims/v1/query.rpc.Query"; -import * as _454 from "./epochs/v1/query.rpc.Query"; -import * as _455 from "./erc20/v1/query.rpc.Query"; -import * as _456 from "./fees/v1/query.rpc.Query"; -import * as _457 from "./incentives/v1/query.rpc.Query"; -import * as _458 from "./inflation/v1/query.rpc.Query"; -import * as _459 from "./recovery/v1/query.rpc.Query"; -import * as _460 from "./vesting/v1/query.rpc.Query"; -import * as _461 from "./erc20/v1/tx.rpc.msg"; -import * as _462 from "./fees/v1/tx.rpc.msg"; -import * as _463 from "./vesting/v1/tx.rpc.msg"; -import * as _464 from "./erc20/v1/query.pinia.store"; -import * as _547 from "./lcd"; -import * as _548 from "./custom-lcd-client"; -import * as _549 from "./rpc.query"; -import * as _550 from "./evmos-rpc-client.query"; -import * as _551 from "./rpc.tx"; -import * as _552 from "./evmos-rpc-client.tx"; +import * as _491 from "./erc20/v1/tx.amino"; +import * as _492 from "./fees/v1/tx.amino"; +import * as _493 from "./vesting/v1/tx.amino"; +import * as _494 from "./erc20/v1/tx.registry"; +import * as _495 from "./fees/v1/tx.registry"; +import * as _496 from "./vesting/v1/tx.registry"; +import * as _497 from "./claims/v1/query.lcd"; +import * as _498 from "./epochs/v1/query.lcd"; +import * as _499 from "./erc20/v1/query.lcd"; +import * as _500 from "./fees/v1/query.lcd"; +import * as _501 from "./incentives/v1/query.lcd"; +import * as _502 from "./inflation/v1/query.lcd"; +import * as _503 from "./recovery/v1/query.lcd"; +import * as _504 from "./vesting/v1/query.lcd"; +import * as _505 from "./claims/v1/query.rpc.func"; +import * as _506 from "./epochs/v1/query.rpc.func"; +import * as _507 from "./erc20/v1/query.rpc.func"; +import * as _508 from "./fees/v1/query.rpc.func"; +import * as _509 from "./incentives/v1/query.rpc.func"; +import * as _510 from "./inflation/v1/query.rpc.func"; +import * as _511 from "./recovery/v1/query.rpc.func"; +import * as _512 from "./vesting/v1/query.rpc.func"; +import * as _513 from "./claims/v1/query.rpc.Query"; +import * as _514 from "./epochs/v1/query.rpc.Query"; +import * as _515 from "./erc20/v1/query.rpc.Query"; +import * as _516 from "./fees/v1/query.rpc.Query"; +import * as _517 from "./incentives/v1/query.rpc.Query"; +import * as _518 from "./inflation/v1/query.rpc.Query"; +import * as _519 from "./recovery/v1/query.rpc.Query"; +import * as _520 from "./vesting/v1/query.rpc.Query"; +import * as _521 from "./erc20/v1/tx.rpc.func"; +import * as _522 from "./fees/v1/tx.rpc.func"; +import * as _523 from "./vesting/v1/tx.rpc.func"; +import * as _524 from "./erc20/v1/tx.rpc.msg"; +import * as _525 from "./fees/v1/tx.rpc.msg"; +import * as _526 from "./vesting/v1/tx.rpc.msg"; +import * as _527 from "./erc20/v1/query.pinia.store"; +import * as _640 from "./lcd"; +import * as _641 from "./custom-lcd-client"; +import * as _642 from "./rpc.query"; +import * as _643 from "./evmos-rpc-client.query"; +import * as _644 from "./rpc.tx"; +import * as _645 from "./evmos-rpc-client.tx"; export namespace evmos { export namespace claims { export const v1 = { ..._153, ..._154, ..._155, - ..._445, - ..._453 + ..._497, + ..._505, + ..._513 }; } export namespace epochs { export const v1 = { ..._156, ..._157, - ..._446, - ..._454 + ..._498, + ..._506, + ..._514 }; } export namespace erc20 { @@ -78,12 +91,14 @@ export namespace evmos { ..._159, ..._160, ..._161, - ..._439, - ..._442, - ..._447, - ..._455, - ..._461, - ..._464 + ..._491, + ..._494, + ..._499, + ..._507, + ..._515, + ..._521, + ..._524, + ..._527 }; } export namespace fees { @@ -92,11 +107,13 @@ export namespace evmos { ..._163, ..._164, ..._165, - ..._440, - ..._443, - ..._448, - ..._456, - ..._462 + ..._492, + ..._495, + ..._500, + ..._508, + ..._516, + ..._522, + ..._525 }; } export namespace incentives { @@ -104,8 +121,9 @@ export namespace evmos { ..._166, ..._167, ..._168, - ..._449, - ..._457 + ..._501, + ..._509, + ..._517 }; } export namespace inflation { @@ -113,16 +131,18 @@ export namespace evmos { ..._169, ..._170, ..._171, - ..._450, - ..._458 + ..._502, + ..._510, + ..._518 }; } export namespace recovery { export const v1 = { ..._172, ..._173, - ..._451, - ..._459 + ..._503, + ..._511, + ..._519 }; } export namespace vesting { @@ -130,19 +150,21 @@ export namespace evmos { ..._174, ..._175, ..._176, - ..._441, - ..._444, - ..._452, - ..._460, - ..._463 + ..._493, + ..._496, + ..._504, + ..._512, + ..._520, + ..._523, + ..._526 }; } export const ClientFactory = { - ..._547, - ..._548, - ..._549, - ..._550, - ..._551, - ..._552 + ..._640, + ..._641, + ..._642, + ..._643, + ..._644, + ..._645 }; } \ No newline at end of file diff --git a/__fixtures__/v-next/outputinstantrpc/evmos/claims/v1/query.rpc.func.ts b/__fixtures__/v-next/outputinstantrpc/evmos/claims/v1/query.rpc.func.ts new file mode 100644 index 0000000000..f4add38251 --- /dev/null +++ b/__fixtures__/v-next/outputinstantrpc/evmos/claims/v1/query.rpc.func.ts @@ -0,0 +1,54 @@ +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination"; +import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; +import { Params, ParamsSDKType } from "./genesis"; +import { ClaimsRecordAddress, ClaimsRecordAddressSDKType, Claim, ClaimSDKType } from "./claims"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { QueryTotalUnclaimedRequest, QueryTotalUnclaimedRequestSDKType, QueryTotalUnclaimedResponse, QueryTotalUnclaimedResponseSDKType, QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, QueryClaimsRecordsRequest, QueryClaimsRecordsRequestSDKType, QueryClaimsRecordsResponse, QueryClaimsRecordsResponseSDKType, QueryClaimsRecordRequest, QueryClaimsRecordRequestSDKType, QueryClaimsRecordResponse, QueryClaimsRecordResponseSDKType } from "./query"; +/** + * TotalUnclaimed queries the total unclaimed tokens from the airdrop + * @name getTotalUnclaimed + * @package evmos.claims.v1 + * @see proto service: evmos.claims.v1.TotalUnclaimed + */ +export const getTotalUnclaimed = buildQuery({ + encode: QueryTotalUnclaimedRequest.encode, + decode: QueryTotalUnclaimedResponse.decode, + service: "evmos.claims.v1.Query", + method: "TotalUnclaimed" +}); +/** + * Params returns the claims module parameters + * @name getParams + * @package evmos.claims.v1 + * @see proto service: evmos.claims.v1.Params + */ +export const getParams = buildQuery({ + encode: QueryParamsRequest.encode, + decode: QueryParamsResponse.decode, + service: "evmos.claims.v1.Query", + method: "Params" +}); +/** + * ClaimsRecords returns all claims records + * @name getClaimsRecords + * @package evmos.claims.v1 + * @see proto service: evmos.claims.v1.ClaimsRecords + */ +export const getClaimsRecords = buildQuery({ + encode: QueryClaimsRecordsRequest.encode, + decode: QueryClaimsRecordsResponse.decode, + service: "evmos.claims.v1.Query", + method: "ClaimsRecords" +}); +/** + * ClaimsRecord returns the claims record for a given address + * @name getClaimsRecord + * @package evmos.claims.v1 + * @see proto service: evmos.claims.v1.ClaimsRecord + */ +export const getClaimsRecord = buildQuery({ + encode: QueryClaimsRecordRequest.encode, + decode: QueryClaimsRecordResponse.decode, + service: "evmos.claims.v1.Query", + method: "ClaimsRecord" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputinstantrpc/evmos/epochs/v1/query.rpc.func.ts b/__fixtures__/v-next/outputinstantrpc/evmos/epochs/v1/query.rpc.func.ts new file mode 100644 index 0000000000..feef14872a --- /dev/null +++ b/__fixtures__/v-next/outputinstantrpc/evmos/epochs/v1/query.rpc.func.ts @@ -0,0 +1,28 @@ +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination"; +import { EpochInfo, EpochInfoSDKType } from "./genesis"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { QueryEpochsInfoRequest, QueryEpochsInfoRequestSDKType, QueryEpochsInfoResponse, QueryEpochsInfoResponseSDKType, QueryCurrentEpochRequest, QueryCurrentEpochRequestSDKType, QueryCurrentEpochResponse, QueryCurrentEpochResponseSDKType } from "./query"; +/** + * EpochInfos provide running epochInfos + * @name getEpochInfos + * @package evmos.epochs.v1 + * @see proto service: evmos.epochs.v1.EpochInfos + */ +export const getEpochInfos = buildQuery({ + encode: QueryEpochsInfoRequest.encode, + decode: QueryEpochsInfoResponse.decode, + service: "evmos.epochs.v1.Query", + method: "EpochInfos" +}); +/** + * CurrentEpoch provide current epoch of specified identifier + * @name getCurrentEpoch + * @package evmos.epochs.v1 + * @see proto service: evmos.epochs.v1.CurrentEpoch + */ +export const getCurrentEpoch = buildQuery({ + encode: QueryCurrentEpochRequest.encode, + decode: QueryCurrentEpochResponse.decode, + service: "evmos.epochs.v1.Query", + method: "CurrentEpoch" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputinstantrpc/evmos/erc20/v1/query.rpc.func.ts b/__fixtures__/v-next/outputinstantrpc/evmos/erc20/v1/query.rpc.func.ts new file mode 100644 index 0000000000..e2c4310faa --- /dev/null +++ b/__fixtures__/v-next/outputinstantrpc/evmos/erc20/v1/query.rpc.func.ts @@ -0,0 +1,41 @@ +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination"; +import { TokenPair, TokenPairSDKType } from "./erc20"; +import { Params, ParamsSDKType } from "./genesis"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { QueryTokenPairsRequest, QueryTokenPairsRequestSDKType, QueryTokenPairsResponse, QueryTokenPairsResponseSDKType, QueryTokenPairRequest, QueryTokenPairRequestSDKType, QueryTokenPairResponse, QueryTokenPairResponseSDKType, QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType } from "./query"; +/** + * TokenPairs retrieves registered token pairs + * @name getTokenPairs + * @package evmos.erc20.v1 + * @see proto service: evmos.erc20.v1.TokenPairs + */ +export const getTokenPairs = buildQuery({ + encode: QueryTokenPairsRequest.encode, + decode: QueryTokenPairsResponse.decode, + service: "evmos.erc20.v1.Query", + method: "TokenPairs" +}); +/** + * TokenPair retrieves a registered token pair + * @name getTokenPair + * @package evmos.erc20.v1 + * @see proto service: evmos.erc20.v1.TokenPair + */ +export const getTokenPair = buildQuery({ + encode: QueryTokenPairRequest.encode, + decode: QueryTokenPairResponse.decode, + service: "evmos.erc20.v1.Query", + method: "TokenPair" +}); +/** + * Params retrieves the erc20 module params + * @name getParams + * @package evmos.erc20.v1 + * @see proto service: evmos.erc20.v1.Params + */ +export const getParams = buildQuery({ + encode: QueryParamsRequest.encode, + decode: QueryParamsResponse.decode, + service: "evmos.erc20.v1.Query", + method: "Params" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputinstantrpc/evmos/erc20/v1/tx.registry.ts b/__fixtures__/v-next/outputinstantrpc/evmos/erc20/v1/tx.registry.ts index 5ce0bbbb1a..ee32b10c6c 100644 --- a/__fixtures__/v-next/outputinstantrpc/evmos/erc20/v1/tx.registry.ts +++ b/__fixtures__/v-next/outputinstantrpc/evmos/erc20/v1/tx.registry.ts @@ -1,13 +1,7 @@ import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { TelescopeGeneratedType } from "../../../types"; -import { Registry } from "@cosmjs/proto-signing"; import { MsgConvertCoin, MsgConvertCoinSDKType, MsgConvertERC20, MsgConvertERC20SDKType } from "./tx"; export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/evmos.erc20.v1.MsgConvertCoin", MsgConvertCoin], ["/evmos.erc20.v1.MsgConvertERC20", MsgConvertERC20]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; export const MessageComposer = { encoded: { convertCoin(value: MsgConvertCoin) { diff --git a/__fixtures__/v-next/outputinstantrpc/evmos/erc20/v1/tx.rpc.func.ts b/__fixtures__/v-next/outputinstantrpc/evmos/erc20/v1/tx.rpc.func.ts new file mode 100644 index 0000000000..98c71c793d --- /dev/null +++ b/__fixtures__/v-next/outputinstantrpc/evmos/erc20/v1/tx.rpc.func.ts @@ -0,0 +1,23 @@ +import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; +import { buildTx } from "../../../helper-func-types"; +import { MsgConvertCoin, MsgConvertCoinSDKType, MsgConvertCoinResponse, MsgConvertCoinResponseSDKType, MsgConvertERC20, MsgConvertERC20SDKType, MsgConvertERC20Response, MsgConvertERC20ResponseSDKType } from "./tx"; +/** + * ConvertCoin mints a ERC20 representation of the native Cosmos coin denom + * that is registered on the token mapping. + * @name convertCoin + * @package evmos.erc20.v1 + * @see proto service: evmos.erc20.v1.ConvertCoin + */ +export const convertCoin = buildTx({ + msg: MsgConvertCoin +}); +/** + * ConvertERC20 mints a native Cosmos coin representation of the ERC20 token + * contract that is registered on the token mapping. + * @name convertERC20 + * @package evmos.erc20.v1 + * @see proto service: evmos.erc20.v1.ConvertERC20 + */ +export const convertERC20 = buildTx({ + msg: MsgConvertERC20 +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputinstantrpc/evmos/erc20/v1/tx.rpc.msg.ts b/__fixtures__/v-next/outputinstantrpc/evmos/erc20/v1/tx.rpc.msg.ts index 2e2b18fe29..fa861d72f1 100644 --- a/__fixtures__/v-next/outputinstantrpc/evmos/erc20/v1/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputinstantrpc/evmos/erc20/v1/tx.rpc.msg.ts @@ -1,5 +1,6 @@ import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; -import { DeliverTxResponse, StdFee, TxRpc } from "../../../types"; +import { DeliverTxResponse } from "@interchainjs/types"; +import { StdFee, TxRpc } from "../../../types"; import { BinaryReader } from "../../../binary"; import { MsgConvertCoin, MsgConvertCoinSDKType, MsgConvertCoinResponse, MsgConvertCoinResponseSDKType, MsgConvertERC20, MsgConvertERC20SDKType, MsgConvertERC20Response, MsgConvertERC20ResponseSDKType } from "./tx"; /** Msg defines the erc20 Msg service. */ diff --git a/__fixtures__/v-next/outputinstantrpc/evmos/fees/v1/genesis.ts b/__fixtures__/v-next/outputinstantrpc/evmos/fees/v1/genesis.ts index 1a19f27d40..a86f920427 100644 --- a/__fixtures__/v-next/outputinstantrpc/evmos/fees/v1/genesis.ts +++ b/__fixtures__/v-next/outputinstantrpc/evmos/fees/v1/genesis.ts @@ -2,7 +2,7 @@ import { DevFeeInfo, DevFeeInfoSDKType } from "./fees"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { isSet, DeepPartial } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; -import { Decimal } from "@cosmjs/math"; +import { Decimal } from "@interchainjs/math"; export const protobufPackage = "evmos.fees.v1"; /** * GenesisState defines the module's genesis state. @@ -347,10 +347,10 @@ export const Params = { toAmino(message: Params): ParamsAmino { const obj: any = {}; obj.enable_fees = message.enableFees === false ? undefined : message.enableFees; - obj.developer_shares = message.developerShares === "" ? undefined : message.developerShares; - obj.validator_shares = message.validatorShares === "" ? undefined : message.validatorShares; + obj.developer_shares = message.developerShares === "" ? undefined : Decimal.fromUserInput(message.developerShares, 18).atomics; + obj.validator_shares = message.validatorShares === "" ? undefined : Decimal.fromUserInput(message.validatorShares, 18).atomics; obj.addr_derivation_cost_create = message.addrDerivationCostCreate !== BigInt(0) ? message.addrDerivationCostCreate?.toString() : undefined; - obj.min_gas_price = message.minGasPrice === "" ? undefined : message.minGasPrice; + obj.min_gas_price = message.minGasPrice === "" ? undefined : Decimal.fromUserInput(message.minGasPrice, 18).atomics; return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputinstantrpc/evmos/fees/v1/query.rpc.func.ts b/__fixtures__/v-next/outputinstantrpc/evmos/fees/v1/query.rpc.func.ts new file mode 100644 index 0000000000..bfa56fcc9d --- /dev/null +++ b/__fixtures__/v-next/outputinstantrpc/evmos/fees/v1/query.rpc.func.ts @@ -0,0 +1,54 @@ +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination"; +import { DevFeeInfo, DevFeeInfoSDKType } from "./fees"; +import { Params, ParamsSDKType } from "./genesis"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { QueryDevFeeInfosRequest, QueryDevFeeInfosRequestSDKType, QueryDevFeeInfosResponse, QueryDevFeeInfosResponseSDKType, QueryDevFeeInfoRequest, QueryDevFeeInfoRequestSDKType, QueryDevFeeInfoResponse, QueryDevFeeInfoResponseSDKType, QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, QueryDevFeeInfosPerDeployerRequest, QueryDevFeeInfosPerDeployerRequestSDKType, QueryDevFeeInfosPerDeployerResponse, QueryDevFeeInfosPerDeployerResponseSDKType } from "./query"; +/** + * DevFeeInfos retrieves all registered contracts for fee distribution + * @name getDevFeeInfos + * @package evmos.fees.v1 + * @see proto service: evmos.fees.v1.DevFeeInfos + */ +export const getDevFeeInfos = buildQuery({ + encode: QueryDevFeeInfosRequest.encode, + decode: QueryDevFeeInfosResponse.decode, + service: "evmos.fees.v1.Query", + method: "DevFeeInfos" +}); +/** + * DevFeeInfo retrieves a registered contract for fee distribution + * @name getDevFeeInfo + * @package evmos.fees.v1 + * @see proto service: evmos.fees.v1.DevFeeInfo + */ +export const getDevFeeInfo = buildQuery({ + encode: QueryDevFeeInfoRequest.encode, + decode: QueryDevFeeInfoResponse.decode, + service: "evmos.fees.v1.Query", + method: "DevFeeInfo" +}); +/** + * Params retrieves the fees module params + * @name getParams + * @package evmos.fees.v1 + * @see proto service: evmos.fees.v1.Params + */ +export const getParams = buildQuery({ + encode: QueryParamsRequest.encode, + decode: QueryParamsResponse.decode, + service: "evmos.fees.v1.Query", + method: "Params" +}); +/** + * DevFeeInfosPerDeployer retrieves all contracts that a deployer has + * registered for fee distribution + * @name getDevFeeInfosPerDeployer + * @package evmos.fees.v1 + * @see proto service: evmos.fees.v1.DevFeeInfosPerDeployer + */ +export const getDevFeeInfosPerDeployer = buildQuery({ + encode: QueryDevFeeInfosPerDeployerRequest.encode, + decode: QueryDevFeeInfosPerDeployerResponse.decode, + service: "evmos.fees.v1.Query", + method: "DevFeeInfosPerDeployer" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputinstantrpc/evmos/fees/v1/tx.registry.ts b/__fixtures__/v-next/outputinstantrpc/evmos/fees/v1/tx.registry.ts index 693d612f87..92fecb8eb3 100644 --- a/__fixtures__/v-next/outputinstantrpc/evmos/fees/v1/tx.registry.ts +++ b/__fixtures__/v-next/outputinstantrpc/evmos/fees/v1/tx.registry.ts @@ -1,12 +1,6 @@ import { TelescopeGeneratedType } from "../../../types"; -import { Registry } from "@cosmjs/proto-signing"; import { MsgRegisterDevFeeInfo, MsgRegisterDevFeeInfoSDKType, MsgCancelDevFeeInfo, MsgCancelDevFeeInfoSDKType, MsgUpdateDevFeeInfo, MsgUpdateDevFeeInfoSDKType } from "./tx"; export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/evmos.fees.v1.MsgRegisterDevFeeInfo", MsgRegisterDevFeeInfo], ["/evmos.fees.v1.MsgCancelDevFeeInfo", MsgCancelDevFeeInfo], ["/evmos.fees.v1.MsgUpdateDevFeeInfo", MsgUpdateDevFeeInfo]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; export const MessageComposer = { encoded: { registerDevFeeInfo(value: MsgRegisterDevFeeInfo) { diff --git a/__fixtures__/v-next/outputinstantrpc/evmos/fees/v1/tx.rpc.func.ts b/__fixtures__/v-next/outputinstantrpc/evmos/fees/v1/tx.rpc.func.ts new file mode 100644 index 0000000000..150928bee9 --- /dev/null +++ b/__fixtures__/v-next/outputinstantrpc/evmos/fees/v1/tx.rpc.func.ts @@ -0,0 +1,31 @@ +import { buildTx } from "../../../helper-func-types"; +import { MsgRegisterDevFeeInfo, MsgRegisterDevFeeInfoSDKType, MsgRegisterDevFeeInfoResponse, MsgRegisterDevFeeInfoResponseSDKType, MsgCancelDevFeeInfo, MsgCancelDevFeeInfoSDKType, MsgCancelDevFeeInfoResponse, MsgCancelDevFeeInfoResponseSDKType, MsgUpdateDevFeeInfo, MsgUpdateDevFeeInfoSDKType, MsgUpdateDevFeeInfoResponse, MsgUpdateDevFeeInfoResponseSDKType } from "./tx"; +/** + * RegisterDevFeeInfo is used by a deployer to register a new contract for + * receiving transaction fees + * @name registerDevFeeInfo + * @package evmos.fees.v1 + * @see proto service: evmos.fees.v1.RegisterDevFeeInfo + */ +export const registerDevFeeInfo = buildTx({ + msg: MsgRegisterDevFeeInfo +}); +/** + * CancelDevFeeInfo is used by a deployer to cancel a registered contract + * and stop receiving transaction fees + * @name cancelDevFeeInfo + * @package evmos.fees.v1 + * @see proto service: evmos.fees.v1.CancelDevFeeInfo + */ +export const cancelDevFeeInfo = buildTx({ + msg: MsgCancelDevFeeInfo +}); +/** + * UpdateDevFeeInfo is used by a deployer to update the withdraw address + * @name updateDevFeeInfo + * @package evmos.fees.v1 + * @see proto service: evmos.fees.v1.UpdateDevFeeInfo + */ +export const updateDevFeeInfo = buildTx({ + msg: MsgUpdateDevFeeInfo +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputinstantrpc/evmos/fees/v1/tx.rpc.msg.ts b/__fixtures__/v-next/outputinstantrpc/evmos/fees/v1/tx.rpc.msg.ts index 6212638218..111e56f1f7 100644 --- a/__fixtures__/v-next/outputinstantrpc/evmos/fees/v1/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputinstantrpc/evmos/fees/v1/tx.rpc.msg.ts @@ -1,4 +1,5 @@ -import { DeliverTxResponse, StdFee, TxRpc } from "../../../types"; +import { DeliverTxResponse } from "@interchainjs/types"; +import { StdFee, TxRpc } from "../../../types"; import { BinaryReader } from "../../../binary"; import { MsgRegisterDevFeeInfo, MsgRegisterDevFeeInfoSDKType, MsgRegisterDevFeeInfoResponse, MsgRegisterDevFeeInfoResponseSDKType, MsgCancelDevFeeInfo, MsgCancelDevFeeInfoSDKType, MsgCancelDevFeeInfoResponse, MsgCancelDevFeeInfoResponseSDKType, MsgUpdateDevFeeInfo, MsgUpdateDevFeeInfoSDKType, MsgUpdateDevFeeInfoResponse, MsgUpdateDevFeeInfoResponseSDKType } from "./tx"; /** Msg defines the fees Msg service. */ diff --git a/__fixtures__/v-next/outputinstantrpc/evmos/incentives/v1/genesis.ts b/__fixtures__/v-next/outputinstantrpc/evmos/incentives/v1/genesis.ts index 40a7d86c0f..c6fa083276 100644 --- a/__fixtures__/v-next/outputinstantrpc/evmos/incentives/v1/genesis.ts +++ b/__fixtures__/v-next/outputinstantrpc/evmos/incentives/v1/genesis.ts @@ -2,7 +2,7 @@ import { Incentive, IncentiveSDKType, GasMeter, GasMeterSDKType } from "./incent import { BinaryReader, BinaryWriter } from "../../../binary"; import { isSet, DeepPartial } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; -import { Decimal } from "@cosmjs/math"; +import { Decimal } from "@interchainjs/math"; export const protobufPackage = "evmos.incentives.v1"; /** * GenesisState defines the module's genesis state. @@ -353,9 +353,9 @@ export const Params = { toAmino(message: Params): ParamsAmino { const obj: any = {}; obj.enable_incentives = message.enableIncentives === false ? undefined : message.enableIncentives; - obj.allocation_limit = message.allocationLimit === "" ? undefined : message.allocationLimit; + obj.allocation_limit = message.allocationLimit === "" ? undefined : Decimal.fromUserInput(message.allocationLimit, 18).atomics; obj.incentives_epoch_identifier = message.incentivesEpochIdentifier === "" ? undefined : message.incentivesEpochIdentifier; - obj.reward_scaler = message.rewardScaler === "" ? undefined : message.rewardScaler; + obj.reward_scaler = message.rewardScaler === "" ? undefined : Decimal.fromUserInput(message.rewardScaler, 18).atomics; return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputinstantrpc/evmos/incentives/v1/query.rpc.func.ts b/__fixtures__/v-next/outputinstantrpc/evmos/incentives/v1/query.rpc.func.ts new file mode 100644 index 0000000000..1321096062 --- /dev/null +++ b/__fixtures__/v-next/outputinstantrpc/evmos/incentives/v1/query.rpc.func.ts @@ -0,0 +1,91 @@ +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination"; +import { Incentive, IncentiveSDKType, GasMeter, GasMeterSDKType } from "./incentives"; +import { DecCoin, DecCoinSDKType } from "../../../cosmos/base/v1beta1/coin"; +import { Params, ParamsSDKType } from "./genesis"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { QueryIncentivesRequest, QueryIncentivesRequestSDKType, QueryIncentivesResponse, QueryIncentivesResponseSDKType, QueryIncentiveRequest, QueryIncentiveRequestSDKType, QueryIncentiveResponse, QueryIncentiveResponseSDKType, QueryGasMetersRequest, QueryGasMetersRequestSDKType, QueryGasMetersResponse, QueryGasMetersResponseSDKType, QueryGasMeterRequest, QueryGasMeterRequestSDKType, QueryGasMeterResponse, QueryGasMeterResponseSDKType, QueryAllocationMetersRequest, QueryAllocationMetersRequestSDKType, QueryAllocationMetersResponse, QueryAllocationMetersResponseSDKType, QueryAllocationMeterRequest, QueryAllocationMeterRequestSDKType, QueryAllocationMeterResponse, QueryAllocationMeterResponseSDKType, QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType } from "./query"; +/** + * Incentives retrieves registered incentives + * @name getIncentives + * @package evmos.incentives.v1 + * @see proto service: evmos.incentives.v1.Incentives + */ +export const getIncentives = buildQuery({ + encode: QueryIncentivesRequest.encode, + decode: QueryIncentivesResponse.decode, + service: "evmos.incentives.v1.Query", + method: "Incentives" +}); +/** + * Incentive retrieves a registered incentive + * @name getIncentive + * @package evmos.incentives.v1 + * @see proto service: evmos.incentives.v1.Incentive + */ +export const getIncentive = buildQuery({ + encode: QueryIncentiveRequest.encode, + decode: QueryIncentiveResponse.decode, + service: "evmos.incentives.v1.Query", + method: "Incentive" +}); +/** + * GasMeters retrieves active gas meters for a given contract + * @name getGasMeters + * @package evmos.incentives.v1 + * @see proto service: evmos.incentives.v1.GasMeters + */ +export const getGasMeters = buildQuery({ + encode: QueryGasMetersRequest.encode, + decode: QueryGasMetersResponse.decode, + service: "evmos.incentives.v1.Query", + method: "GasMeters" +}); +/** + * GasMeter Retrieves a active gas meter + * @name getGasMeter + * @package evmos.incentives.v1 + * @see proto service: evmos.incentives.v1.GasMeter + */ +export const getGasMeter = buildQuery({ + encode: QueryGasMeterRequest.encode, + decode: QueryGasMeterResponse.decode, + service: "evmos.incentives.v1.Query", + method: "GasMeter" +}); +/** + * AllocationMeters retrieves active allocation meters for a given + * denomination + * @name getAllocationMeters + * @package evmos.incentives.v1 + * @see proto service: evmos.incentives.v1.AllocationMeters + */ +export const getAllocationMeters = buildQuery({ + encode: QueryAllocationMetersRequest.encode, + decode: QueryAllocationMetersResponse.decode, + service: "evmos.incentives.v1.Query", + method: "AllocationMeters" +}); +/** + * AllocationMeter Retrieves a active gas meter + * @name getAllocationMeter + * @package evmos.incentives.v1 + * @see proto service: evmos.incentives.v1.AllocationMeter + */ +export const getAllocationMeter = buildQuery({ + encode: QueryAllocationMeterRequest.encode, + decode: QueryAllocationMeterResponse.decode, + service: "evmos.incentives.v1.Query", + method: "AllocationMeter" +}); +/** + * Params retrieves the incentives module params + * @name getParams + * @package evmos.incentives.v1 + * @see proto service: evmos.incentives.v1.Params + */ +export const getParams = buildQuery({ + encode: QueryParamsRequest.encode, + decode: QueryParamsResponse.decode, + service: "evmos.incentives.v1.Query", + method: "Params" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputinstantrpc/evmos/inflation/v1/inflation.ts b/__fixtures__/v-next/outputinstantrpc/evmos/inflation/v1/inflation.ts index d87d281358..fc98ca8506 100644 --- a/__fixtures__/v-next/outputinstantrpc/evmos/inflation/v1/inflation.ts +++ b/__fixtures__/v-next/outputinstantrpc/evmos/inflation/v1/inflation.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { Decimal } from "@cosmjs/math"; +import { Decimal } from "@interchainjs/math"; import { isSet, DeepPartial } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "evmos.inflation.v1"; @@ -219,9 +219,9 @@ export const InflationDistribution = { }, toAmino(message: InflationDistribution): InflationDistributionAmino { const obj: any = {}; - obj.staking_rewards = message.stakingRewards === "" ? undefined : message.stakingRewards; - obj.usage_incentives = message.usageIncentives === "" ? undefined : message.usageIncentives; - obj.community_pool = message.communityPool === "" ? undefined : message.communityPool; + obj.staking_rewards = message.stakingRewards === "" ? undefined : Decimal.fromUserInput(message.stakingRewards, 18).atomics; + obj.usage_incentives = message.usageIncentives === "" ? undefined : Decimal.fromUserInput(message.usageIncentives, 18).atomics; + obj.community_pool = message.communityPool === "" ? undefined : Decimal.fromUserInput(message.communityPool, 18).atomics; return obj; }, fromAminoMsg(object: InflationDistributionAminoMsg): InflationDistribution { @@ -383,11 +383,11 @@ export const ExponentialCalculation = { }, toAmino(message: ExponentialCalculation): ExponentialCalculationAmino { const obj: any = {}; - obj.a = message.a === "" ? undefined : message.a; - obj.r = message.r === "" ? undefined : message.r; - obj.c = message.c === "" ? undefined : message.c; - obj.bonding_target = message.bondingTarget === "" ? undefined : message.bondingTarget; - obj.max_variance = message.maxVariance === "" ? undefined : message.maxVariance; + obj.a = message.a === "" ? undefined : Decimal.fromUserInput(message.a, 18).atomics; + obj.r = message.r === "" ? undefined : Decimal.fromUserInput(message.r, 18).atomics; + obj.c = message.c === "" ? undefined : Decimal.fromUserInput(message.c, 18).atomics; + obj.bonding_target = message.bondingTarget === "" ? undefined : Decimal.fromUserInput(message.bondingTarget, 18).atomics; + obj.max_variance = message.maxVariance === "" ? undefined : Decimal.fromUserInput(message.maxVariance, 18).atomics; return obj; }, fromAminoMsg(object: ExponentialCalculationAminoMsg): ExponentialCalculation { diff --git a/__fixtures__/v-next/outputinstantrpc/evmos/inflation/v1/query.rpc.func.ts b/__fixtures__/v-next/outputinstantrpc/evmos/inflation/v1/query.rpc.func.ts new file mode 100644 index 0000000000..151eefa68d --- /dev/null +++ b/__fixtures__/v-next/outputinstantrpc/evmos/inflation/v1/query.rpc.func.ts @@ -0,0 +1,77 @@ +import { DecCoin, DecCoinSDKType } from "../../../cosmos/base/v1beta1/coin"; +import { Params, ParamsSDKType } from "./genesis"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { QueryPeriodRequest, QueryPeriodRequestSDKType, QueryPeriodResponse, QueryPeriodResponseSDKType, QueryEpochMintProvisionRequest, QueryEpochMintProvisionRequestSDKType, QueryEpochMintProvisionResponse, QueryEpochMintProvisionResponseSDKType, QuerySkippedEpochsRequest, QuerySkippedEpochsRequestSDKType, QuerySkippedEpochsResponse, QuerySkippedEpochsResponseSDKType, QueryCirculatingSupplyRequest, QueryCirculatingSupplyRequestSDKType, QueryCirculatingSupplyResponse, QueryCirculatingSupplyResponseSDKType, QueryInflationRateRequest, QueryInflationRateRequestSDKType, QueryInflationRateResponse, QueryInflationRateResponseSDKType, QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType } from "./query"; +/** + * Period retrieves current period. + * @name getPeriod + * @package evmos.inflation.v1 + * @see proto service: evmos.inflation.v1.Period + */ +export const getPeriod = buildQuery({ + encode: QueryPeriodRequest.encode, + decode: QueryPeriodResponse.decode, + service: "evmos.inflation.v1.Query", + method: "Period" +}); +/** + * EpochMintProvision retrieves current minting epoch provision value. + * @name getEpochMintProvision + * @package evmos.inflation.v1 + * @see proto service: evmos.inflation.v1.EpochMintProvision + */ +export const getEpochMintProvision = buildQuery({ + encode: QueryEpochMintProvisionRequest.encode, + decode: QueryEpochMintProvisionResponse.decode, + service: "evmos.inflation.v1.Query", + method: "EpochMintProvision" +}); +/** + * SkippedEpochs retrieves the total number of skipped epochs. + * @name getSkippedEpochs + * @package evmos.inflation.v1 + * @see proto service: evmos.inflation.v1.SkippedEpochs + */ +export const getSkippedEpochs = buildQuery({ + encode: QuerySkippedEpochsRequest.encode, + decode: QuerySkippedEpochsResponse.decode, + service: "evmos.inflation.v1.Query", + method: "SkippedEpochs" +}); +/** + * CirculatingSupply retrieves the total number of tokens that are in + * circulation (i.e. excluding unvested tokens). + * @name getCirculatingSupply + * @package evmos.inflation.v1 + * @see proto service: evmos.inflation.v1.CirculatingSupply + */ +export const getCirculatingSupply = buildQuery({ + encode: QueryCirculatingSupplyRequest.encode, + decode: QueryCirculatingSupplyResponse.decode, + service: "evmos.inflation.v1.Query", + method: "CirculatingSupply" +}); +/** + * InflationRate retrieves the inflation rate of the current period. + * @name getInflationRate + * @package evmos.inflation.v1 + * @see proto service: evmos.inflation.v1.InflationRate + */ +export const getInflationRate = buildQuery({ + encode: QueryInflationRateRequest.encode, + decode: QueryInflationRateResponse.decode, + service: "evmos.inflation.v1.Query", + method: "InflationRate" +}); +/** + * Params retrieves the total set of minting parameters. + * @name getParams + * @package evmos.inflation.v1 + * @see proto service: evmos.inflation.v1.Params + */ +export const getParams = buildQuery({ + encode: QueryParamsRequest.encode, + decode: QueryParamsResponse.decode, + service: "evmos.inflation.v1.Query", + method: "Params" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputinstantrpc/evmos/inflation/v1/query.ts b/__fixtures__/v-next/outputinstantrpc/evmos/inflation/v1/query.ts index ba54c2acf3..1c0ff62974 100644 --- a/__fixtures__/v-next/outputinstantrpc/evmos/inflation/v1/query.ts +++ b/__fixtures__/v-next/outputinstantrpc/evmos/inflation/v1/query.ts @@ -3,7 +3,7 @@ import { Params, ParamsSDKType } from "./genesis"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { JsonSafe } from "../../../json-safe"; import { DeepPartial, isSet } from "../../../helpers"; -import { Decimal } from "@cosmjs/math"; +import { Decimal } from "@interchainjs/math"; export const protobufPackage = "evmos.inflation.v1"; /** * QueryPeriodRequest is the request type for the Query/Period RPC method. @@ -1116,7 +1116,7 @@ export const QueryInflationRateResponse = { }, toAmino(message: QueryInflationRateResponse): QueryInflationRateResponseAmino { const obj: any = {}; - obj.inflation_rate = message.inflationRate === "" ? undefined : message.inflationRate; + obj.inflation_rate = message.inflationRate === "" ? undefined : Decimal.fromUserInput(message.inflationRate, 18).atomics; return obj; }, fromAminoMsg(object: QueryInflationRateResponseAminoMsg): QueryInflationRateResponse { diff --git a/__fixtures__/v-next/outputinstantrpc/evmos/recovery/v1/query.rpc.func.ts b/__fixtures__/v-next/outputinstantrpc/evmos/recovery/v1/query.rpc.func.ts new file mode 100644 index 0000000000..5403b6c737 --- /dev/null +++ b/__fixtures__/v-next/outputinstantrpc/evmos/recovery/v1/query.rpc.func.ts @@ -0,0 +1,15 @@ +import { Params, ParamsSDKType } from "./genesis"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType } from "./query"; +/** + * Params retrieves the total set of recovery parameters. + * @name getParams + * @package evmos.recovery.v1 + * @see proto service: evmos.recovery.v1.Params + */ +export const getParams = buildQuery({ + encode: QueryParamsRequest.encode, + decode: QueryParamsResponse.decode, + service: "evmos.recovery.v1.Query", + method: "Params" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputinstantrpc/evmos/vesting/v1/query.rpc.func.ts b/__fixtures__/v-next/outputinstantrpc/evmos/vesting/v1/query.rpc.func.ts new file mode 100644 index 0000000000..e60916d404 --- /dev/null +++ b/__fixtures__/v-next/outputinstantrpc/evmos/vesting/v1/query.rpc.func.ts @@ -0,0 +1,15 @@ +import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { QueryBalancesRequest, QueryBalancesRequestSDKType, QueryBalancesResponse, QueryBalancesResponseSDKType } from "./query"; +/** + * Retrieves the unvested, vested and locked tokens for a vesting account + * @name getBalances + * @package evmos.vesting.v1 + * @see proto service: evmos.vesting.v1.Balances + */ +export const getBalances = buildQuery({ + encode: QueryBalancesRequest.encode, + decode: QueryBalancesResponse.decode, + service: "evmos.vesting.v1.Query", + method: "Balances" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputinstantrpc/evmos/vesting/v1/tx.registry.ts b/__fixtures__/v-next/outputinstantrpc/evmos/vesting/v1/tx.registry.ts index c492681590..72ee678911 100644 --- a/__fixtures__/v-next/outputinstantrpc/evmos/vesting/v1/tx.registry.ts +++ b/__fixtures__/v-next/outputinstantrpc/evmos/vesting/v1/tx.registry.ts @@ -1,14 +1,8 @@ import { Timestamp, TimestampSDKType } from "../../../google/protobuf/timestamp"; import { Period, PeriodSDKType } from "../../../cosmos/vesting/v1beta1/vesting"; import { TelescopeGeneratedType } from "../../../types"; -import { Registry } from "@cosmjs/proto-signing"; import { MsgCreateClawbackVestingAccount, MsgCreateClawbackVestingAccountSDKType, MsgClawback, MsgClawbackSDKType } from "./tx"; export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/evmos.vesting.v1.MsgCreateClawbackVestingAccount", MsgCreateClawbackVestingAccount], ["/evmos.vesting.v1.MsgClawback", MsgClawback]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; export const MessageComposer = { encoded: { createClawbackVestingAccount(value: MsgCreateClawbackVestingAccount) { diff --git a/__fixtures__/v-next/outputinstantrpc/evmos/vesting/v1/tx.rpc.func.ts b/__fixtures__/v-next/outputinstantrpc/evmos/vesting/v1/tx.rpc.func.ts new file mode 100644 index 0000000000..a00219b97b --- /dev/null +++ b/__fixtures__/v-next/outputinstantrpc/evmos/vesting/v1/tx.rpc.func.ts @@ -0,0 +1,23 @@ +import { Timestamp, TimestampSDKType } from "../../../google/protobuf/timestamp"; +import { Period, PeriodSDKType } from "../../../cosmos/vesting/v1beta1/vesting"; +import { buildTx } from "../../../helper-func-types"; +import { MsgCreateClawbackVestingAccount, MsgCreateClawbackVestingAccountSDKType, MsgCreateClawbackVestingAccountResponse, MsgCreateClawbackVestingAccountResponseSDKType, MsgClawback, MsgClawbackSDKType, MsgClawbackResponse, MsgClawbackResponseSDKType } from "./tx"; +/** + * CreateClawbackVestingAccount creats a vesting account that is subject to + * clawback and the configuration of vesting and lockup schedules. + * @name createClawbackVestingAccount + * @package evmos.vesting.v1 + * @see proto service: evmos.vesting.v1.CreateClawbackVestingAccount + */ +export const createClawbackVestingAccount = buildTx({ + msg: MsgCreateClawbackVestingAccount +}); +/** + * Clawback removes the unvested tokens from a ClawbackVestingAccount. + * @name clawback + * @package evmos.vesting.v1 + * @see proto service: evmos.vesting.v1.Clawback + */ +export const clawback = buildTx({ + msg: MsgClawback +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputinstantrpc/evmos/vesting/v1/tx.rpc.msg.ts b/__fixtures__/v-next/outputinstantrpc/evmos/vesting/v1/tx.rpc.msg.ts index ca743c1b22..ba7798f0a1 100644 --- a/__fixtures__/v-next/outputinstantrpc/evmos/vesting/v1/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputinstantrpc/evmos/vesting/v1/tx.rpc.msg.ts @@ -1,6 +1,7 @@ import { Timestamp, TimestampSDKType } from "../../../google/protobuf/timestamp"; import { Period, PeriodSDKType } from "../../../cosmos/vesting/v1beta1/vesting"; -import { DeliverTxResponse, StdFee, TxRpc } from "../../../types"; +import { DeliverTxResponse } from "@interchainjs/types"; +import { StdFee, TxRpc } from "../../../types"; import { BinaryReader } from "../../../binary"; import { MsgCreateClawbackVestingAccount, MsgCreateClawbackVestingAccountSDKType, MsgCreateClawbackVestingAccountResponse, MsgCreateClawbackVestingAccountResponseSDKType, MsgClawback, MsgClawbackSDKType, MsgClawbackResponse, MsgClawbackResponseSDKType } from "./tx"; /** Msg defines the vesting Msg service. */ diff --git a/__fixtures__/v-next/outputinstantrpc/extern.ts b/__fixtures__/v-next/outputinstantrpc/extern.ts index 55c458deb4..83d6864ae2 100644 --- a/__fixtures__/v-next/outputinstantrpc/extern.ts +++ b/__fixtures__/v-next/outputinstantrpc/extern.ts @@ -4,51 +4,45 @@ * and run the transpile command or npm scripts command that is used to regenerate this bundle. */ -import { QueryClient, createProtobufRpcClient, ProtobufRpcClient } from '@cosmjs/stargate' -import { connectComet, Tendermint34Client, HttpEndpoint } from "@cosmjs/tendermint-rpc"; -const _rpcClients: Record = {}; +import { HttpEndpoint } from "@interchainjs/types"; +import { Rpc } from "./helpers"; +import { ClientOptions, createCosmosQueryClient } from "@interchainjs/cosmos"; -export const getRpcEndpointKey = (rpcEndpoint: string | HttpEndpoint) => { - if (typeof rpcEndpoint === 'string') { - return rpcEndpoint; - } else if (!!rpcEndpoint) { - //@ts-ignore - return rpcEndpoint.url; - } -} +const _rpcClients: Record = {}; -export const getRpcClient = async (rpcEndpoint: string | HttpEndpoint) => { - const key = getRpcEndpointKey(rpcEndpoint); - if (!key) return; - if (_rpcClients.hasOwnProperty(key)) { - return _rpcClients[key]; - } - const cometClient = await connectComet(rpcEndpoint); +export const getRpcEndpointKey = (rpcEndpoint: string | HttpEndpoint) => { + if (typeof rpcEndpoint === 'string') { + return rpcEndpoint; + } else if (!!rpcEndpoint) { //@ts-ignore - const client = new QueryClient(cometClient); - const rpc = createProtobufRpcClient(client); - _rpcClients[key] = rpc; - return rpc; + return rpcEndpoint.url; + } } -export const createRpcClient = async (rpcEndpoint: string | HttpEndpoint) => { - const cometClient = await connectComet(rpcEndpoint); - //@ts-ignore - const client = new QueryClient(cometClient); - const rpc = createProtobufRpcClient(client); - +export const getRpcClient = async (rpcEndpoint: string | HttpEndpoint) => { + const key = getRpcEndpointKey(rpcEndpoint); + if (!key) return; + if (_rpcClients.hasOwnProperty(key)) { + return _rpcClients[key]; + } + const rpc = await createRpcClient(rpcEndpoint); + _rpcClients[key] = rpc; return rpc; } -export const createTm34QueryClient = async (rpcEndpoint: string | HttpEndpoint) => { - const tmClient = await Tendermint34Client.connect(rpcEndpoint); - //@ts-ignore - return new QueryClient(tmClient); -} - -export const createConnectCometQueryClient = async (rpcEndpoint: string | HttpEndpoint) => { - const cometClient = await connectComet(rpcEndpoint); - //@ts-ignore - return new QueryClient(cometClient); +export const createRpcClient = async (rpcEndpoint: string | HttpEndpoint, + options?: ClientOptions +) => { + if (typeof rpcEndpoint === 'string') { + return createCosmosQueryClient(rpcEndpoint, options); + } else { + const endpointStr = rpcEndpoint.url; + const clientOptions = { + ...options, + headers: rpcEndpoint.headers + }; + + return createCosmosQueryClient(endpointStr, clientOptions); + } } diff --git a/__fixtures__/v-next/outputinstantrpc/helper-func-types.ts b/__fixtures__/v-next/outputinstantrpc/helper-func-types.ts new file mode 100644 index 0000000000..5f9d7a87a0 --- /dev/null +++ b/__fixtures__/v-next/outputinstantrpc/helper-func-types.ts @@ -0,0 +1,92 @@ +/** +* This file and any referenced files were automatically generated by @hyperweb/telescope@latest +* DO NOT MODIFY BY HAND. Instead, download the latest proto files for your chain +* and run the transpile command or npm scripts command that is used to regenerate this bundle. +*/ + + +import { HttpEndpoint } from "@interchainjs/types"; +import { BinaryReader, BinaryWriter } from "./binary"; +import { getRpcClient } from "./extern"; +import { isRpc, Rpc } from "./helpers"; +import { TelescopeGeneratedCodec, DeliverTxResponse, Message, StdFee } from "./types"; +import { toConverters, toEncoders } from "@interchainjs/cosmos/utils"; +import { ISigningClient } from "@interchainjs/cosmos/types/signing-client"; + +export interface QueryBuilderOptions { + encode: (request: TReq, writer?: BinaryWriter) => BinaryWriter + decode: (input: BinaryReader | Uint8Array, length?: number) => TRes + service: string, + method: string, +} + +export function buildQuery(opts: QueryBuilderOptions) { + return async (client: EndpointOrRpc, request: TReq) => { + let rpc: Rpc | undefined; + + if(isRpc(client)) { + rpc = client; + } else { + rpc = client ? await getRpcClient(client) : undefined; + } + + if (!rpc) throw new Error("Query Rpc is not initialized"); + + const data = opts.encode(request).finish(); + const response = await rpc.request(opts.service, opts.method, data); + return opts.decode(response); + }; +} + +export interface ITxArgs { + signerAddress: string; + message: TMsg | TMsg[]; + fee: StdFee | 'auto'; + memo: string; +} + +export interface TxBuilderOptions { + msg: TelescopeGeneratedCodec +} + +export function buildTx(opts: TxBuilderOptions) { + return async ( + client: ISigningClient, + signerAddress: string, + message: TMsg | TMsg[], + fee: StdFee | 'auto', + memo: string + ): Promise => { + if (!client) throw new Error("SigningClient is not initialized"); + + //register all related encoders and converters + client.addEncoders?.(toEncoders(opts.msg)); + client.addConverters?.(toConverters(opts.msg)); + + const data = Array.isArray(message) + ? message.map(msg => ({ + typeUrl: opts.msg.typeUrl, + value: msg, + })) + : [{ + typeUrl: opts.msg.typeUrl, + value: message, + }]; + return client.signAndBroadcast!(signerAddress, data, fee, memo); + }; +} + +export interface Encoder { + typeUrl: string; + fromPartial: (data: any) => any; + encode: (data: any) => Uint8Array; +} + +export interface AminoConverter { + typeUrl: string; + aminoType: string; + fromAmino: (data: any) => any; + toAmino: (data: any) => any; +} + +export type EndpointOrRpc = string | HttpEndpoint | Rpc ; diff --git a/__fixtures__/v-next/outputinstantrpc/ibc/applications/transfer/v1/query.rpc.func.ts b/__fixtures__/v-next/outputinstantrpc/ibc/applications/transfer/v1/query.rpc.func.ts new file mode 100644 index 0000000000..b0991df88a --- /dev/null +++ b/__fixtures__/v-next/outputinstantrpc/ibc/applications/transfer/v1/query.rpc.func.ts @@ -0,0 +1,40 @@ +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../../cosmos/base/query/v1beta1/pagination"; +import { DenomTrace, DenomTraceSDKType, Params, ParamsSDKType } from "./transfer"; +import { EndpointOrRpc, buildQuery } from "../../../../helper-func-types"; +import { QueryDenomTraceRequest, QueryDenomTraceRequestSDKType, QueryDenomTraceResponse, QueryDenomTraceResponseSDKType, QueryDenomTracesRequest, QueryDenomTracesRequestSDKType, QueryDenomTracesResponse, QueryDenomTracesResponseSDKType, QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType } from "./query"; +/** + * DenomTrace queries a denomination trace information. + * @name getDenomTrace + * @package ibc.applications.transfer.v1 + * @see proto service: ibc.applications.transfer.v1.DenomTrace + */ +export const getDenomTrace = buildQuery({ + encode: QueryDenomTraceRequest.encode, + decode: QueryDenomTraceResponse.decode, + service: "ibc.applications.transfer.v1.Query", + method: "DenomTrace" +}); +/** + * DenomTraces queries all denomination traces. + * @name getDenomTraces + * @package ibc.applications.transfer.v1 + * @see proto service: ibc.applications.transfer.v1.DenomTraces + */ +export const getDenomTraces = buildQuery({ + encode: QueryDenomTracesRequest.encode, + decode: QueryDenomTracesResponse.decode, + service: "ibc.applications.transfer.v1.Query", + method: "DenomTraces" +}); +/** + * Params queries all parameters of the ibc-transfer module. + * @name getParams + * @package ibc.applications.transfer.v1 + * @see proto service: ibc.applications.transfer.v1.Params + */ +export const getParams = buildQuery({ + encode: QueryParamsRequest.encode, + decode: QueryParamsResponse.decode, + service: "ibc.applications.transfer.v1.Query", + method: "Params" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputinstantrpc/ibc/applications/transfer/v1/tx.registry.ts b/__fixtures__/v-next/outputinstantrpc/ibc/applications/transfer/v1/tx.registry.ts index db06123510..416cef2847 100644 --- a/__fixtures__/v-next/outputinstantrpc/ibc/applications/transfer/v1/tx.registry.ts +++ b/__fixtures__/v-next/outputinstantrpc/ibc/applications/transfer/v1/tx.registry.ts @@ -1,14 +1,8 @@ import { Coin, CoinSDKType } from "../../../../cosmos/base/v1beta1/coin"; import { Height, HeightSDKType } from "../../../core/client/v1/client"; import { TelescopeGeneratedType } from "../../../../types"; -import { Registry } from "@cosmjs/proto-signing"; import { MsgTransfer, MsgTransferSDKType } from "./tx"; export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/ibc.applications.transfer.v1.MsgTransfer", MsgTransfer]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; export const MessageComposer = { encoded: { transfer(value: MsgTransfer) { diff --git a/__fixtures__/v-next/outputinstantrpc/ibc/applications/transfer/v1/tx.rpc.func.ts b/__fixtures__/v-next/outputinstantrpc/ibc/applications/transfer/v1/tx.rpc.func.ts new file mode 100644 index 0000000000..9f352ae025 --- /dev/null +++ b/__fixtures__/v-next/outputinstantrpc/ibc/applications/transfer/v1/tx.rpc.func.ts @@ -0,0 +1,13 @@ +import { Coin, CoinSDKType } from "../../../../cosmos/base/v1beta1/coin"; +import { Height, HeightSDKType } from "../../../core/client/v1/client"; +import { buildTx } from "../../../../helper-func-types"; +import { MsgTransfer, MsgTransferSDKType, MsgTransferResponse, MsgTransferResponseSDKType } from "./tx"; +/** + * Transfer defines a rpc handler method for MsgTransfer. + * @name transfer + * @package ibc.applications.transfer.v1 + * @see proto service: ibc.applications.transfer.v1.Transfer + */ +export const transfer = buildTx({ + msg: MsgTransfer +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputinstantrpc/ibc/applications/transfer/v1/tx.rpc.msg.ts b/__fixtures__/v-next/outputinstantrpc/ibc/applications/transfer/v1/tx.rpc.msg.ts index e99560ccc3..ef9b059c8d 100644 --- a/__fixtures__/v-next/outputinstantrpc/ibc/applications/transfer/v1/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputinstantrpc/ibc/applications/transfer/v1/tx.rpc.msg.ts @@ -1,6 +1,7 @@ import { Coin, CoinSDKType } from "../../../../cosmos/base/v1beta1/coin"; import { Height, HeightSDKType } from "../../../core/client/v1/client"; -import { DeliverTxResponse, StdFee, TxRpc } from "../../../../types"; +import { DeliverTxResponse } from "@interchainjs/types"; +import { StdFee, TxRpc } from "../../../../types"; import { BinaryReader } from "../../../../binary"; import { MsgTransfer, MsgTransferSDKType, MsgTransferResponse, MsgTransferResponseSDKType } from "./tx"; /** Msg defines the ibc/transfer Msg service. */ diff --git a/__fixtures__/v-next/outputinstantrpc/ibc/bundle.ts b/__fixtures__/v-next/outputinstantrpc/ibc/bundle.ts index aced34b163..92ca4087cb 100644 --- a/__fixtures__/v-next/outputinstantrpc/ibc/bundle.ts +++ b/__fixtures__/v-next/outputinstantrpc/ibc/bundle.ts @@ -22,30 +22,39 @@ import * as _250 from "./lightclients/localhost/v1/localhost"; import * as _251 from "./lightclients/solomachine/v1/solomachine"; import * as _252 from "./lightclients/solomachine/v2/solomachine"; import * as _253 from "./lightclients/tendermint/v1/tendermint"; -import * as _465 from "./applications/transfer/v1/tx.amino"; -import * as _466 from "./core/channel/v1/tx.amino"; -import * as _467 from "./core/client/v1/tx.amino"; -import * as _468 from "./core/connection/v1/tx.amino"; -import * as _469 from "./applications/transfer/v1/tx.registry"; -import * as _470 from "./core/channel/v1/tx.registry"; -import * as _471 from "./core/client/v1/tx.registry"; -import * as _472 from "./core/connection/v1/tx.registry"; -import * as _473 from "./applications/transfer/v1/query.lcd"; -import * as _474 from "./core/channel/v1/query.lcd"; -import * as _475 from "./core/client/v1/query.lcd"; -import * as _476 from "./core/connection/v1/query.lcd"; -import * as _477 from "./applications/transfer/v1/query.rpc.Query"; -import * as _478 from "./core/channel/v1/query.rpc.Query"; -import * as _479 from "./core/client/v1/query.rpc.Query"; -import * as _480 from "./core/connection/v1/query.rpc.Query"; -import * as _481 from "./core/port/v1/query.rpc.Query"; -import * as _482 from "./applications/transfer/v1/tx.rpc.msg"; -import * as _483 from "./core/channel/v1/tx.rpc.msg"; -import * as _484 from "./core/client/v1/tx.rpc.msg"; -import * as _485 from "./core/connection/v1/tx.rpc.msg"; -import * as _553 from "./lcd"; -import * as _554 from "./rpc.query"; -import * as _555 from "./rpc.tx"; +import * as _528 from "./applications/transfer/v1/tx.amino"; +import * as _529 from "./core/channel/v1/tx.amino"; +import * as _530 from "./core/client/v1/tx.amino"; +import * as _531 from "./core/connection/v1/tx.amino"; +import * as _532 from "./applications/transfer/v1/tx.registry"; +import * as _533 from "./core/channel/v1/tx.registry"; +import * as _534 from "./core/client/v1/tx.registry"; +import * as _535 from "./core/connection/v1/tx.registry"; +import * as _536 from "./applications/transfer/v1/query.lcd"; +import * as _537 from "./core/channel/v1/query.lcd"; +import * as _538 from "./core/client/v1/query.lcd"; +import * as _539 from "./core/connection/v1/query.lcd"; +import * as _540 from "./applications/transfer/v1/query.rpc.func"; +import * as _541 from "./core/channel/v1/query.rpc.func"; +import * as _542 from "./core/client/v1/query.rpc.func"; +import * as _543 from "./core/connection/v1/query.rpc.func"; +import * as _544 from "./core/port/v1/query.rpc.func"; +import * as _545 from "./applications/transfer/v1/query.rpc.Query"; +import * as _546 from "./core/channel/v1/query.rpc.Query"; +import * as _547 from "./core/client/v1/query.rpc.Query"; +import * as _548 from "./core/connection/v1/query.rpc.Query"; +import * as _549 from "./core/port/v1/query.rpc.Query"; +import * as _550 from "./applications/transfer/v1/tx.rpc.func"; +import * as _551 from "./core/channel/v1/tx.rpc.func"; +import * as _552 from "./core/client/v1/tx.rpc.func"; +import * as _553 from "./core/connection/v1/tx.rpc.func"; +import * as _554 from "./applications/transfer/v1/tx.rpc.msg"; +import * as _555 from "./core/channel/v1/tx.rpc.msg"; +import * as _556 from "./core/client/v1/tx.rpc.msg"; +import * as _557 from "./core/connection/v1/tx.rpc.msg"; +import * as _646 from "./lcd"; +import * as _647 from "./rpc.query"; +import * as _648 from "./rpc.tx"; export namespace ibc { export namespace applications { export namespace transfer { @@ -54,11 +63,13 @@ export namespace ibc { ..._231, ..._232, ..._233, - ..._465, - ..._469, - ..._473, - ..._477, - ..._482 + ..._528, + ..._532, + ..._536, + ..._540, + ..._545, + ..._550, + ..._554 }; export const v2 = { ..._234 @@ -72,11 +83,13 @@ export namespace ibc { ..._236, ..._237, ..._238, - ..._466, - ..._470, - ..._474, - ..._478, - ..._483 + ..._529, + ..._533, + ..._537, + ..._541, + ..._546, + ..._551, + ..._555 }; } export namespace client { @@ -85,11 +98,13 @@ export namespace ibc { ..._240, ..._241, ..._242, - ..._467, - ..._471, - ..._475, - ..._479, - ..._484 + ..._530, + ..._534, + ..._538, + ..._542, + ..._547, + ..._552, + ..._556 }; } export namespace commitment { @@ -103,17 +118,20 @@ export namespace ibc { ..._245, ..._246, ..._247, - ..._468, - ..._472, - ..._476, - ..._480, - ..._485 + ..._531, + ..._535, + ..._539, + ..._543, + ..._548, + ..._553, + ..._557 }; } export namespace port { export const v1 = { ..._248, - ..._481 + ..._544, + ..._549 }; } export namespace types { @@ -143,8 +161,8 @@ export namespace ibc { } } export const ClientFactory = { - ..._553, - ..._554, - ..._555 + ..._646, + ..._647, + ..._648 }; } \ No newline at end of file diff --git a/__fixtures__/v-next/outputinstantrpc/ibc/core/channel/v1/query.rpc.func.ts b/__fixtures__/v-next/outputinstantrpc/ibc/core/channel/v1/query.rpc.func.ts new file mode 100644 index 0000000000..66f63bfd32 --- /dev/null +++ b/__fixtures__/v-next/outputinstantrpc/ibc/core/channel/v1/query.rpc.func.ts @@ -0,0 +1,170 @@ +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../../cosmos/base/query/v1beta1/pagination"; +import { Channel, ChannelSDKType, IdentifiedChannel, IdentifiedChannelSDKType, PacketState, PacketStateSDKType } from "./channel"; +import { Height, HeightSDKType, IdentifiedClientState, IdentifiedClientStateSDKType } from "../../client/v1/client"; +import { Any, AnySDKType } from "../../../../google/protobuf/any"; +import { EndpointOrRpc, buildQuery } from "../../../../helper-func-types"; +import { QueryChannelRequest, QueryChannelRequestSDKType, QueryChannelResponse, QueryChannelResponseSDKType, QueryChannelsRequest, QueryChannelsRequestSDKType, QueryChannelsResponse, QueryChannelsResponseSDKType, QueryConnectionChannelsRequest, QueryConnectionChannelsRequestSDKType, QueryConnectionChannelsResponse, QueryConnectionChannelsResponseSDKType, QueryChannelClientStateRequest, QueryChannelClientStateRequestSDKType, QueryChannelClientStateResponse, QueryChannelClientStateResponseSDKType, QueryChannelConsensusStateRequest, QueryChannelConsensusStateRequestSDKType, QueryChannelConsensusStateResponse, QueryChannelConsensusStateResponseSDKType, QueryPacketCommitmentRequest, QueryPacketCommitmentRequestSDKType, QueryPacketCommitmentResponse, QueryPacketCommitmentResponseSDKType, QueryPacketCommitmentsRequest, QueryPacketCommitmentsRequestSDKType, QueryPacketCommitmentsResponse, QueryPacketCommitmentsResponseSDKType, QueryPacketReceiptRequest, QueryPacketReceiptRequestSDKType, QueryPacketReceiptResponse, QueryPacketReceiptResponseSDKType, QueryPacketAcknowledgementRequest, QueryPacketAcknowledgementRequestSDKType, QueryPacketAcknowledgementResponse, QueryPacketAcknowledgementResponseSDKType, QueryPacketAcknowledgementsRequest, QueryPacketAcknowledgementsRequestSDKType, QueryPacketAcknowledgementsResponse, QueryPacketAcknowledgementsResponseSDKType, QueryUnreceivedPacketsRequest, QueryUnreceivedPacketsRequestSDKType, QueryUnreceivedPacketsResponse, QueryUnreceivedPacketsResponseSDKType, QueryUnreceivedAcksRequest, QueryUnreceivedAcksRequestSDKType, QueryUnreceivedAcksResponse, QueryUnreceivedAcksResponseSDKType, QueryNextSequenceReceiveRequest, QueryNextSequenceReceiveRequestSDKType, QueryNextSequenceReceiveResponse, QueryNextSequenceReceiveResponseSDKType } from "./query"; +/** + * Channel queries an IBC Channel. + * @name getChannel + * @package ibc.core.channel.v1 + * @see proto service: ibc.core.channel.v1.Channel + */ +export const getChannel = buildQuery({ + encode: QueryChannelRequest.encode, + decode: QueryChannelResponse.decode, + service: "ibc.core.channel.v1.Query", + method: "Channel" +}); +/** + * Channels queries all the IBC channels of a chain. + * @name getChannels + * @package ibc.core.channel.v1 + * @see proto service: ibc.core.channel.v1.Channels + */ +export const getChannels = buildQuery({ + encode: QueryChannelsRequest.encode, + decode: QueryChannelsResponse.decode, + service: "ibc.core.channel.v1.Query", + method: "Channels" +}); +/** + * ConnectionChannels queries all the channels associated with a connection + * end. + * @name getConnectionChannels + * @package ibc.core.channel.v1 + * @see proto service: ibc.core.channel.v1.ConnectionChannels + */ +export const getConnectionChannels = buildQuery({ + encode: QueryConnectionChannelsRequest.encode, + decode: QueryConnectionChannelsResponse.decode, + service: "ibc.core.channel.v1.Query", + method: "ConnectionChannels" +}); +/** + * ChannelClientState queries for the client state for the channel associated + * with the provided channel identifiers. + * @name getChannelClientState + * @package ibc.core.channel.v1 + * @see proto service: ibc.core.channel.v1.ChannelClientState + */ +export const getChannelClientState = buildQuery({ + encode: QueryChannelClientStateRequest.encode, + decode: QueryChannelClientStateResponse.decode, + service: "ibc.core.channel.v1.Query", + method: "ChannelClientState" +}); +/** + * ChannelConsensusState queries for the consensus state for the channel + * associated with the provided channel identifiers. + * @name getChannelConsensusState + * @package ibc.core.channel.v1 + * @see proto service: ibc.core.channel.v1.ChannelConsensusState + */ +export const getChannelConsensusState = buildQuery({ + encode: QueryChannelConsensusStateRequest.encode, + decode: QueryChannelConsensusStateResponse.decode, + service: "ibc.core.channel.v1.Query", + method: "ChannelConsensusState" +}); +/** + * PacketCommitment queries a stored packet commitment hash. + * @name getPacketCommitment + * @package ibc.core.channel.v1 + * @see proto service: ibc.core.channel.v1.PacketCommitment + */ +export const getPacketCommitment = buildQuery({ + encode: QueryPacketCommitmentRequest.encode, + decode: QueryPacketCommitmentResponse.decode, + service: "ibc.core.channel.v1.Query", + method: "PacketCommitment" +}); +/** + * PacketCommitments returns all the packet commitments hashes associated + * with a channel. + * @name getPacketCommitments + * @package ibc.core.channel.v1 + * @see proto service: ibc.core.channel.v1.PacketCommitments + */ +export const getPacketCommitments = buildQuery({ + encode: QueryPacketCommitmentsRequest.encode, + decode: QueryPacketCommitmentsResponse.decode, + service: "ibc.core.channel.v1.Query", + method: "PacketCommitments" +}); +/** + * PacketReceipt queries if a given packet sequence has been received on the + * queried chain + * @name getPacketReceipt + * @package ibc.core.channel.v1 + * @see proto service: ibc.core.channel.v1.PacketReceipt + */ +export const getPacketReceipt = buildQuery({ + encode: QueryPacketReceiptRequest.encode, + decode: QueryPacketReceiptResponse.decode, + service: "ibc.core.channel.v1.Query", + method: "PacketReceipt" +}); +/** + * PacketAcknowledgement queries a stored packet acknowledgement hash. + * @name getPacketAcknowledgement + * @package ibc.core.channel.v1 + * @see proto service: ibc.core.channel.v1.PacketAcknowledgement + */ +export const getPacketAcknowledgement = buildQuery({ + encode: QueryPacketAcknowledgementRequest.encode, + decode: QueryPacketAcknowledgementResponse.decode, + service: "ibc.core.channel.v1.Query", + method: "PacketAcknowledgement" +}); +/** + * PacketAcknowledgements returns all the packet acknowledgements associated + * with a channel. + * @name getPacketAcknowledgements + * @package ibc.core.channel.v1 + * @see proto service: ibc.core.channel.v1.PacketAcknowledgements + */ +export const getPacketAcknowledgements = buildQuery({ + encode: QueryPacketAcknowledgementsRequest.encode, + decode: QueryPacketAcknowledgementsResponse.decode, + service: "ibc.core.channel.v1.Query", + method: "PacketAcknowledgements" +}); +/** + * UnreceivedPackets returns all the unreceived IBC packets associated with a + * channel and sequences. + * @name getUnreceivedPackets + * @package ibc.core.channel.v1 + * @see proto service: ibc.core.channel.v1.UnreceivedPackets + */ +export const getUnreceivedPackets = buildQuery({ + encode: QueryUnreceivedPacketsRequest.encode, + decode: QueryUnreceivedPacketsResponse.decode, + service: "ibc.core.channel.v1.Query", + method: "UnreceivedPackets" +}); +/** + * UnreceivedAcks returns all the unreceived IBC acknowledgements associated + * with a channel and sequences. + * @name getUnreceivedAcks + * @package ibc.core.channel.v1 + * @see proto service: ibc.core.channel.v1.UnreceivedAcks + */ +export const getUnreceivedAcks = buildQuery({ + encode: QueryUnreceivedAcksRequest.encode, + decode: QueryUnreceivedAcksResponse.decode, + service: "ibc.core.channel.v1.Query", + method: "UnreceivedAcks" +}); +/** + * NextSequenceReceive returns the next receive sequence for a given channel. + * @name getNextSequenceReceive + * @package ibc.core.channel.v1 + * @see proto service: ibc.core.channel.v1.NextSequenceReceive + */ +export const getNextSequenceReceive = buildQuery({ + encode: QueryNextSequenceReceiveRequest.encode, + decode: QueryNextSequenceReceiveResponse.decode, + service: "ibc.core.channel.v1.Query", + method: "NextSequenceReceive" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputinstantrpc/ibc/core/channel/v1/tx.registry.ts b/__fixtures__/v-next/outputinstantrpc/ibc/core/channel/v1/tx.registry.ts index 7bafeaddee..e3505d4f12 100644 --- a/__fixtures__/v-next/outputinstantrpc/ibc/core/channel/v1/tx.registry.ts +++ b/__fixtures__/v-next/outputinstantrpc/ibc/core/channel/v1/tx.registry.ts @@ -1,14 +1,8 @@ import { Channel, ChannelSDKType, Packet, PacketSDKType } from "./channel"; import { Height, HeightSDKType } from "../../client/v1/client"; import { TelescopeGeneratedType } from "../../../../types"; -import { Registry } from "@cosmjs/proto-signing"; import { MsgChannelOpenInit, MsgChannelOpenInitSDKType, MsgChannelOpenTry, MsgChannelOpenTrySDKType, MsgChannelOpenAck, MsgChannelOpenAckSDKType, MsgChannelOpenConfirm, MsgChannelOpenConfirmSDKType, MsgChannelCloseInit, MsgChannelCloseInitSDKType, MsgChannelCloseConfirm, MsgChannelCloseConfirmSDKType, MsgRecvPacket, MsgRecvPacketSDKType, MsgTimeout, MsgTimeoutSDKType, MsgTimeoutOnClose, MsgTimeoutOnCloseSDKType, MsgAcknowledgement, MsgAcknowledgementSDKType } from "./tx"; export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/ibc.core.channel.v1.MsgChannelOpenInit", MsgChannelOpenInit], ["/ibc.core.channel.v1.MsgChannelOpenTry", MsgChannelOpenTry], ["/ibc.core.channel.v1.MsgChannelOpenAck", MsgChannelOpenAck], ["/ibc.core.channel.v1.MsgChannelOpenConfirm", MsgChannelOpenConfirm], ["/ibc.core.channel.v1.MsgChannelCloseInit", MsgChannelCloseInit], ["/ibc.core.channel.v1.MsgChannelCloseConfirm", MsgChannelCloseConfirm], ["/ibc.core.channel.v1.MsgRecvPacket", MsgRecvPacket], ["/ibc.core.channel.v1.MsgTimeout", MsgTimeout], ["/ibc.core.channel.v1.MsgTimeoutOnClose", MsgTimeoutOnClose], ["/ibc.core.channel.v1.MsgAcknowledgement", MsgAcknowledgement]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; export const MessageComposer = { encoded: { channelOpenInit(value: MsgChannelOpenInit) { diff --git a/__fixtures__/v-next/outputinstantrpc/ibc/core/channel/v1/tx.rpc.func.ts b/__fixtures__/v-next/outputinstantrpc/ibc/core/channel/v1/tx.rpc.func.ts new file mode 100644 index 0000000000..98c04fd664 --- /dev/null +++ b/__fixtures__/v-next/outputinstantrpc/ibc/core/channel/v1/tx.rpc.func.ts @@ -0,0 +1,95 @@ +import { Channel, ChannelSDKType, Packet, PacketSDKType } from "./channel"; +import { Height, HeightSDKType } from "../../client/v1/client"; +import { buildTx } from "../../../../helper-func-types"; +import { MsgChannelOpenInit, MsgChannelOpenInitSDKType, MsgChannelOpenInitResponse, MsgChannelOpenInitResponseSDKType, MsgChannelOpenTry, MsgChannelOpenTrySDKType, MsgChannelOpenTryResponse, MsgChannelOpenTryResponseSDKType, MsgChannelOpenAck, MsgChannelOpenAckSDKType, MsgChannelOpenAckResponse, MsgChannelOpenAckResponseSDKType, MsgChannelOpenConfirm, MsgChannelOpenConfirmSDKType, MsgChannelOpenConfirmResponse, MsgChannelOpenConfirmResponseSDKType, MsgChannelCloseInit, MsgChannelCloseInitSDKType, MsgChannelCloseInitResponse, MsgChannelCloseInitResponseSDKType, MsgChannelCloseConfirm, MsgChannelCloseConfirmSDKType, MsgChannelCloseConfirmResponse, MsgChannelCloseConfirmResponseSDKType, MsgRecvPacket, MsgRecvPacketSDKType, MsgRecvPacketResponse, MsgRecvPacketResponseSDKType, MsgTimeout, MsgTimeoutSDKType, MsgTimeoutResponse, MsgTimeoutResponseSDKType, MsgTimeoutOnClose, MsgTimeoutOnCloseSDKType, MsgTimeoutOnCloseResponse, MsgTimeoutOnCloseResponseSDKType, MsgAcknowledgement, MsgAcknowledgementSDKType, MsgAcknowledgementResponse, MsgAcknowledgementResponseSDKType } from "./tx"; +/** + * ChannelOpenInit defines a rpc handler method for MsgChannelOpenInit. + * @name channelOpenInit + * @package ibc.core.channel.v1 + * @see proto service: ibc.core.channel.v1.ChannelOpenInit + */ +export const channelOpenInit = buildTx({ + msg: MsgChannelOpenInit +}); +/** + * ChannelOpenTry defines a rpc handler method for MsgChannelOpenTry. + * @name channelOpenTry + * @package ibc.core.channel.v1 + * @see proto service: ibc.core.channel.v1.ChannelOpenTry + */ +export const channelOpenTry = buildTx({ + msg: MsgChannelOpenTry +}); +/** + * ChannelOpenAck defines a rpc handler method for MsgChannelOpenAck. + * @name channelOpenAck + * @package ibc.core.channel.v1 + * @see proto service: ibc.core.channel.v1.ChannelOpenAck + */ +export const channelOpenAck = buildTx({ + msg: MsgChannelOpenAck +}); +/** + * ChannelOpenConfirm defines a rpc handler method for MsgChannelOpenConfirm. + * @name channelOpenConfirm + * @package ibc.core.channel.v1 + * @see proto service: ibc.core.channel.v1.ChannelOpenConfirm + */ +export const channelOpenConfirm = buildTx({ + msg: MsgChannelOpenConfirm +}); +/** + * ChannelCloseInit defines a rpc handler method for MsgChannelCloseInit. + * @name channelCloseInit + * @package ibc.core.channel.v1 + * @see proto service: ibc.core.channel.v1.ChannelCloseInit + */ +export const channelCloseInit = buildTx({ + msg: MsgChannelCloseInit +}); +/** + * ChannelCloseConfirm defines a rpc handler method for + * MsgChannelCloseConfirm. + * @name channelCloseConfirm + * @package ibc.core.channel.v1 + * @see proto service: ibc.core.channel.v1.ChannelCloseConfirm + */ +export const channelCloseConfirm = buildTx({ + msg: MsgChannelCloseConfirm +}); +/** + * RecvPacket defines a rpc handler method for MsgRecvPacket. + * @name recvPacket + * @package ibc.core.channel.v1 + * @see proto service: ibc.core.channel.v1.RecvPacket + */ +export const recvPacket = buildTx({ + msg: MsgRecvPacket +}); +/** + * Timeout defines a rpc handler method for MsgTimeout. + * @name timeout + * @package ibc.core.channel.v1 + * @see proto service: ibc.core.channel.v1.Timeout + */ +export const timeout = buildTx({ + msg: MsgTimeout +}); +/** + * TimeoutOnClose defines a rpc handler method for MsgTimeoutOnClose. + * @name timeoutOnClose + * @package ibc.core.channel.v1 + * @see proto service: ibc.core.channel.v1.TimeoutOnClose + */ +export const timeoutOnClose = buildTx({ + msg: MsgTimeoutOnClose +}); +/** + * Acknowledgement defines a rpc handler method for MsgAcknowledgement. + * @name acknowledgement + * @package ibc.core.channel.v1 + * @see proto service: ibc.core.channel.v1.Acknowledgement + */ +export const acknowledgement = buildTx({ + msg: MsgAcknowledgement +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputinstantrpc/ibc/core/channel/v1/tx.rpc.msg.ts b/__fixtures__/v-next/outputinstantrpc/ibc/core/channel/v1/tx.rpc.msg.ts index 7a259165cd..a364e8d37b 100644 --- a/__fixtures__/v-next/outputinstantrpc/ibc/core/channel/v1/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputinstantrpc/ibc/core/channel/v1/tx.rpc.msg.ts @@ -1,6 +1,7 @@ import { Channel, ChannelSDKType, Packet, PacketSDKType } from "./channel"; import { Height, HeightSDKType } from "../../client/v1/client"; -import { DeliverTxResponse, StdFee, TxRpc } from "../../../../types"; +import { DeliverTxResponse } from "@interchainjs/types"; +import { StdFee, TxRpc } from "../../../../types"; import { BinaryReader } from "../../../../binary"; import { MsgChannelOpenInit, MsgChannelOpenInitSDKType, MsgChannelOpenInitResponse, MsgChannelOpenInitResponseSDKType, MsgChannelOpenTry, MsgChannelOpenTrySDKType, MsgChannelOpenTryResponse, MsgChannelOpenTryResponseSDKType, MsgChannelOpenAck, MsgChannelOpenAckSDKType, MsgChannelOpenAckResponse, MsgChannelOpenAckResponseSDKType, MsgChannelOpenConfirm, MsgChannelOpenConfirmSDKType, MsgChannelOpenConfirmResponse, MsgChannelOpenConfirmResponseSDKType, MsgChannelCloseInit, MsgChannelCloseInitSDKType, MsgChannelCloseInitResponse, MsgChannelCloseInitResponseSDKType, MsgChannelCloseConfirm, MsgChannelCloseConfirmSDKType, MsgChannelCloseConfirmResponse, MsgChannelCloseConfirmResponseSDKType, MsgRecvPacket, MsgRecvPacketSDKType, MsgRecvPacketResponse, MsgRecvPacketResponseSDKType, MsgTimeout, MsgTimeoutSDKType, MsgTimeoutResponse, MsgTimeoutResponseSDKType, MsgTimeoutOnClose, MsgTimeoutOnCloseSDKType, MsgTimeoutOnCloseResponse, MsgTimeoutOnCloseResponseSDKType, MsgAcknowledgement, MsgAcknowledgementSDKType, MsgAcknowledgementResponse, MsgAcknowledgementResponseSDKType } from "./tx"; /** Msg defines the ibc/channel Msg service. */ diff --git a/__fixtures__/v-next/outputinstantrpc/ibc/core/client/v1/query.rpc.func.ts b/__fixtures__/v-next/outputinstantrpc/ibc/core/client/v1/query.rpc.func.ts new file mode 100644 index 0000000000..3c120e7419 --- /dev/null +++ b/__fixtures__/v-next/outputinstantrpc/ibc/core/client/v1/query.rpc.func.ts @@ -0,0 +1,103 @@ +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../../cosmos/base/query/v1beta1/pagination"; +import { Any, AnySDKType } from "../../../../google/protobuf/any"; +import { Height, HeightSDKType, IdentifiedClientState, IdentifiedClientStateSDKType, ConsensusStateWithHeight, ConsensusStateWithHeightSDKType, Params, ParamsSDKType } from "./client"; +import { EndpointOrRpc, buildQuery } from "../../../../helper-func-types"; +import { QueryClientStateRequest, QueryClientStateRequestSDKType, QueryClientStateResponse, QueryClientStateResponseSDKType, QueryClientStatesRequest, QueryClientStatesRequestSDKType, QueryClientStatesResponse, QueryClientStatesResponseSDKType, QueryConsensusStateRequest, QueryConsensusStateRequestSDKType, QueryConsensusStateResponse, QueryConsensusStateResponseSDKType, QueryConsensusStatesRequest, QueryConsensusStatesRequestSDKType, QueryConsensusStatesResponse, QueryConsensusStatesResponseSDKType, QueryClientStatusRequest, QueryClientStatusRequestSDKType, QueryClientStatusResponse, QueryClientStatusResponseSDKType, QueryClientParamsRequest, QueryClientParamsRequestSDKType, QueryClientParamsResponse, QueryClientParamsResponseSDKType, QueryUpgradedClientStateRequest, QueryUpgradedClientStateRequestSDKType, QueryUpgradedClientStateResponse, QueryUpgradedClientStateResponseSDKType, QueryUpgradedConsensusStateRequest, QueryUpgradedConsensusStateRequestSDKType, QueryUpgradedConsensusStateResponse, QueryUpgradedConsensusStateResponseSDKType } from "./query"; +/** + * ClientState queries an IBC light client. + * @name getClientState + * @package ibc.core.client.v1 + * @see proto service: ibc.core.client.v1.ClientState + */ +export const getClientState = buildQuery({ + encode: QueryClientStateRequest.encode, + decode: QueryClientStateResponse.decode, + service: "ibc.core.client.v1.Query", + method: "ClientState" +}); +/** + * ClientStates queries all the IBC light clients of a chain. + * @name getClientStates + * @package ibc.core.client.v1 + * @see proto service: ibc.core.client.v1.ClientStates + */ +export const getClientStates = buildQuery({ + encode: QueryClientStatesRequest.encode, + decode: QueryClientStatesResponse.decode, + service: "ibc.core.client.v1.Query", + method: "ClientStates" +}); +/** + * ConsensusState queries a consensus state associated with a client state at + * a given height. + * @name getConsensusState + * @package ibc.core.client.v1 + * @see proto service: ibc.core.client.v1.ConsensusState + */ +export const getConsensusState = buildQuery({ + encode: QueryConsensusStateRequest.encode, + decode: QueryConsensusStateResponse.decode, + service: "ibc.core.client.v1.Query", + method: "ConsensusState" +}); +/** + * ConsensusStates queries all the consensus state associated with a given + * client. + * @name getConsensusStates + * @package ibc.core.client.v1 + * @see proto service: ibc.core.client.v1.ConsensusStates + */ +export const getConsensusStates = buildQuery({ + encode: QueryConsensusStatesRequest.encode, + decode: QueryConsensusStatesResponse.decode, + service: "ibc.core.client.v1.Query", + method: "ConsensusStates" +}); +/** + * Status queries the status of an IBC client. + * @name getClientStatus + * @package ibc.core.client.v1 + * @see proto service: ibc.core.client.v1.ClientStatus + */ +export const getClientStatus = buildQuery({ + encode: QueryClientStatusRequest.encode, + decode: QueryClientStatusResponse.decode, + service: "ibc.core.client.v1.Query", + method: "ClientStatus" +}); +/** + * ClientParams queries all parameters of the ibc client. + * @name getClientParams + * @package ibc.core.client.v1 + * @see proto service: ibc.core.client.v1.ClientParams + */ +export const getClientParams = buildQuery({ + encode: QueryClientParamsRequest.encode, + decode: QueryClientParamsResponse.decode, + service: "ibc.core.client.v1.Query", + method: "ClientParams" +}); +/** + * UpgradedClientState queries an Upgraded IBC light client. + * @name getUpgradedClientState + * @package ibc.core.client.v1 + * @see proto service: ibc.core.client.v1.UpgradedClientState + */ +export const getUpgradedClientState = buildQuery({ + encode: QueryUpgradedClientStateRequest.encode, + decode: QueryUpgradedClientStateResponse.decode, + service: "ibc.core.client.v1.Query", + method: "UpgradedClientState" +}); +/** + * UpgradedConsensusState queries an Upgraded IBC consensus state. + * @name getUpgradedConsensusState + * @package ibc.core.client.v1 + * @see proto service: ibc.core.client.v1.UpgradedConsensusState + */ +export const getUpgradedConsensusState = buildQuery({ + encode: QueryUpgradedConsensusStateRequest.encode, + decode: QueryUpgradedConsensusStateResponse.decode, + service: "ibc.core.client.v1.Query", + method: "UpgradedConsensusState" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputinstantrpc/ibc/core/client/v1/tx.registry.ts b/__fixtures__/v-next/outputinstantrpc/ibc/core/client/v1/tx.registry.ts index bccc31cb93..6bb8746b2b 100644 --- a/__fixtures__/v-next/outputinstantrpc/ibc/core/client/v1/tx.registry.ts +++ b/__fixtures__/v-next/outputinstantrpc/ibc/core/client/v1/tx.registry.ts @@ -1,13 +1,7 @@ import { Any, AnySDKType } from "../../../../google/protobuf/any"; import { TelescopeGeneratedType } from "../../../../types"; -import { Registry } from "@cosmjs/proto-signing"; import { MsgCreateClient, MsgCreateClientSDKType, MsgUpdateClient, MsgUpdateClientSDKType, MsgUpgradeClient, MsgUpgradeClientSDKType, MsgSubmitMisbehaviour, MsgSubmitMisbehaviourSDKType } from "./tx"; export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/ibc.core.client.v1.MsgCreateClient", MsgCreateClient], ["/ibc.core.client.v1.MsgUpdateClient", MsgUpdateClient], ["/ibc.core.client.v1.MsgUpgradeClient", MsgUpgradeClient], ["/ibc.core.client.v1.MsgSubmitMisbehaviour", MsgSubmitMisbehaviour]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; export const MessageComposer = { encoded: { createClient(value: MsgCreateClient) { diff --git a/__fixtures__/v-next/outputinstantrpc/ibc/core/client/v1/tx.rpc.func.ts b/__fixtures__/v-next/outputinstantrpc/ibc/core/client/v1/tx.rpc.func.ts new file mode 100644 index 0000000000..2a84b5b7f2 --- /dev/null +++ b/__fixtures__/v-next/outputinstantrpc/ibc/core/client/v1/tx.rpc.func.ts @@ -0,0 +1,39 @@ +import { Any, AnySDKType } from "../../../../google/protobuf/any"; +import { buildTx } from "../../../../helper-func-types"; +import { MsgCreateClient, MsgCreateClientSDKType, MsgCreateClientResponse, MsgCreateClientResponseSDKType, MsgUpdateClient, MsgUpdateClientSDKType, MsgUpdateClientResponse, MsgUpdateClientResponseSDKType, MsgUpgradeClient, MsgUpgradeClientSDKType, MsgUpgradeClientResponse, MsgUpgradeClientResponseSDKType, MsgSubmitMisbehaviour, MsgSubmitMisbehaviourSDKType, MsgSubmitMisbehaviourResponse, MsgSubmitMisbehaviourResponseSDKType } from "./tx"; +/** + * CreateClient defines a rpc handler method for MsgCreateClient. + * @name createClient + * @package ibc.core.client.v1 + * @see proto service: ibc.core.client.v1.CreateClient + */ +export const createClient = buildTx({ + msg: MsgCreateClient +}); +/** + * UpdateClient defines a rpc handler method for MsgUpdateClient. + * @name updateClient + * @package ibc.core.client.v1 + * @see proto service: ibc.core.client.v1.UpdateClient + */ +export const updateClient = buildTx({ + msg: MsgUpdateClient +}); +/** + * UpgradeClient defines a rpc handler method for MsgUpgradeClient. + * @name upgradeClient + * @package ibc.core.client.v1 + * @see proto service: ibc.core.client.v1.UpgradeClient + */ +export const upgradeClient = buildTx({ + msg: MsgUpgradeClient +}); +/** + * SubmitMisbehaviour defines a rpc handler method for MsgSubmitMisbehaviour. + * @name submitMisbehaviour + * @package ibc.core.client.v1 + * @see proto service: ibc.core.client.v1.SubmitMisbehaviour + */ +export const submitMisbehaviour = buildTx({ + msg: MsgSubmitMisbehaviour +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputinstantrpc/ibc/core/client/v1/tx.rpc.msg.ts b/__fixtures__/v-next/outputinstantrpc/ibc/core/client/v1/tx.rpc.msg.ts index f2df5a53e9..2251408680 100644 --- a/__fixtures__/v-next/outputinstantrpc/ibc/core/client/v1/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputinstantrpc/ibc/core/client/v1/tx.rpc.msg.ts @@ -1,5 +1,6 @@ import { Any, AnySDKType } from "../../../../google/protobuf/any"; -import { DeliverTxResponse, StdFee, TxRpc } from "../../../../types"; +import { DeliverTxResponse } from "@interchainjs/types"; +import { StdFee, TxRpc } from "../../../../types"; import { BinaryReader } from "../../../../binary"; import { MsgCreateClient, MsgCreateClientSDKType, MsgCreateClientResponse, MsgCreateClientResponseSDKType, MsgUpdateClient, MsgUpdateClientSDKType, MsgUpdateClientResponse, MsgUpdateClientResponseSDKType, MsgUpgradeClient, MsgUpgradeClientSDKType, MsgUpgradeClientResponse, MsgUpgradeClientResponseSDKType, MsgSubmitMisbehaviour, MsgSubmitMisbehaviourSDKType, MsgSubmitMisbehaviourResponse, MsgSubmitMisbehaviourResponseSDKType } from "./tx"; /** Msg defines the ibc/client Msg service. */ diff --git a/__fixtures__/v-next/outputinstantrpc/ibc/core/connection/v1/query.rpc.func.ts b/__fixtures__/v-next/outputinstantrpc/ibc/core/connection/v1/query.rpc.func.ts new file mode 100644 index 0000000000..e1536fe9cf --- /dev/null +++ b/__fixtures__/v-next/outputinstantrpc/ibc/core/connection/v1/query.rpc.func.ts @@ -0,0 +1,69 @@ +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../../cosmos/base/query/v1beta1/pagination"; +import { ConnectionEnd, ConnectionEndSDKType, IdentifiedConnection, IdentifiedConnectionSDKType } from "./connection"; +import { Height, HeightSDKType, IdentifiedClientState, IdentifiedClientStateSDKType } from "../../client/v1/client"; +import { Any, AnySDKType } from "../../../../google/protobuf/any"; +import { EndpointOrRpc, buildQuery } from "../../../../helper-func-types"; +import { QueryConnectionRequest, QueryConnectionRequestSDKType, QueryConnectionResponse, QueryConnectionResponseSDKType, QueryConnectionsRequest, QueryConnectionsRequestSDKType, QueryConnectionsResponse, QueryConnectionsResponseSDKType, QueryClientConnectionsRequest, QueryClientConnectionsRequestSDKType, QueryClientConnectionsResponse, QueryClientConnectionsResponseSDKType, QueryConnectionClientStateRequest, QueryConnectionClientStateRequestSDKType, QueryConnectionClientStateResponse, QueryConnectionClientStateResponseSDKType, QueryConnectionConsensusStateRequest, QueryConnectionConsensusStateRequestSDKType, QueryConnectionConsensusStateResponse, QueryConnectionConsensusStateResponseSDKType } from "./query"; +/** + * Connection queries an IBC connection end. + * @name getConnection + * @package ibc.core.connection.v1 + * @see proto service: ibc.core.connection.v1.Connection + */ +export const getConnection = buildQuery({ + encode: QueryConnectionRequest.encode, + decode: QueryConnectionResponse.decode, + service: "ibc.core.connection.v1.Query", + method: "Connection" +}); +/** + * Connections queries all the IBC connections of a chain. + * @name getConnections + * @package ibc.core.connection.v1 + * @see proto service: ibc.core.connection.v1.Connections + */ +export const getConnections = buildQuery({ + encode: QueryConnectionsRequest.encode, + decode: QueryConnectionsResponse.decode, + service: "ibc.core.connection.v1.Query", + method: "Connections" +}); +/** + * ClientConnections queries the connection paths associated with a client + * state. + * @name getClientConnections + * @package ibc.core.connection.v1 + * @see proto service: ibc.core.connection.v1.ClientConnections + */ +export const getClientConnections = buildQuery({ + encode: QueryClientConnectionsRequest.encode, + decode: QueryClientConnectionsResponse.decode, + service: "ibc.core.connection.v1.Query", + method: "ClientConnections" +}); +/** + * ConnectionClientState queries the client state associated with the + * connection. + * @name getConnectionClientState + * @package ibc.core.connection.v1 + * @see proto service: ibc.core.connection.v1.ConnectionClientState + */ +export const getConnectionClientState = buildQuery({ + encode: QueryConnectionClientStateRequest.encode, + decode: QueryConnectionClientStateResponse.decode, + service: "ibc.core.connection.v1.Query", + method: "ConnectionClientState" +}); +/** + * ConnectionConsensusState queries the consensus state associated with the + * connection. + * @name getConnectionConsensusState + * @package ibc.core.connection.v1 + * @see proto service: ibc.core.connection.v1.ConnectionConsensusState + */ +export const getConnectionConsensusState = buildQuery({ + encode: QueryConnectionConsensusStateRequest.encode, + decode: QueryConnectionConsensusStateResponse.decode, + service: "ibc.core.connection.v1.Query", + method: "ConnectionConsensusState" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputinstantrpc/ibc/core/connection/v1/tx.registry.ts b/__fixtures__/v-next/outputinstantrpc/ibc/core/connection/v1/tx.registry.ts index 08e717028c..098219db92 100644 --- a/__fixtures__/v-next/outputinstantrpc/ibc/core/connection/v1/tx.registry.ts +++ b/__fixtures__/v-next/outputinstantrpc/ibc/core/connection/v1/tx.registry.ts @@ -2,14 +2,8 @@ import { Counterparty, CounterpartySDKType, Version, VersionSDKType } from "./co import { Any, AnySDKType } from "../../../../google/protobuf/any"; import { Height, HeightSDKType } from "../../client/v1/client"; import { TelescopeGeneratedType } from "../../../../types"; -import { Registry } from "@cosmjs/proto-signing"; import { MsgConnectionOpenInit, MsgConnectionOpenInitSDKType, MsgConnectionOpenTry, MsgConnectionOpenTrySDKType, MsgConnectionOpenAck, MsgConnectionOpenAckSDKType, MsgConnectionOpenConfirm, MsgConnectionOpenConfirmSDKType } from "./tx"; export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/ibc.core.connection.v1.MsgConnectionOpenInit", MsgConnectionOpenInit], ["/ibc.core.connection.v1.MsgConnectionOpenTry", MsgConnectionOpenTry], ["/ibc.core.connection.v1.MsgConnectionOpenAck", MsgConnectionOpenAck], ["/ibc.core.connection.v1.MsgConnectionOpenConfirm", MsgConnectionOpenConfirm]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; export const MessageComposer = { encoded: { connectionOpenInit(value: MsgConnectionOpenInit) { diff --git a/__fixtures__/v-next/outputinstantrpc/ibc/core/connection/v1/tx.rpc.func.ts b/__fixtures__/v-next/outputinstantrpc/ibc/core/connection/v1/tx.rpc.func.ts new file mode 100644 index 0000000000..ea5f1a0814 --- /dev/null +++ b/__fixtures__/v-next/outputinstantrpc/ibc/core/connection/v1/tx.rpc.func.ts @@ -0,0 +1,42 @@ +import { Counterparty, CounterpartySDKType, Version, VersionSDKType } from "./connection"; +import { Any, AnySDKType } from "../../../../google/protobuf/any"; +import { Height, HeightSDKType } from "../../client/v1/client"; +import { buildTx } from "../../../../helper-func-types"; +import { MsgConnectionOpenInit, MsgConnectionOpenInitSDKType, MsgConnectionOpenInitResponse, MsgConnectionOpenInitResponseSDKType, MsgConnectionOpenTry, MsgConnectionOpenTrySDKType, MsgConnectionOpenTryResponse, MsgConnectionOpenTryResponseSDKType, MsgConnectionOpenAck, MsgConnectionOpenAckSDKType, MsgConnectionOpenAckResponse, MsgConnectionOpenAckResponseSDKType, MsgConnectionOpenConfirm, MsgConnectionOpenConfirmSDKType, MsgConnectionOpenConfirmResponse, MsgConnectionOpenConfirmResponseSDKType } from "./tx"; +/** + * ConnectionOpenInit defines a rpc handler method for MsgConnectionOpenInit. + * @name connectionOpenInit + * @package ibc.core.connection.v1 + * @see proto service: ibc.core.connection.v1.ConnectionOpenInit + */ +export const connectionOpenInit = buildTx({ + msg: MsgConnectionOpenInit +}); +/** + * ConnectionOpenTry defines a rpc handler method for MsgConnectionOpenTry. + * @name connectionOpenTry + * @package ibc.core.connection.v1 + * @see proto service: ibc.core.connection.v1.ConnectionOpenTry + */ +export const connectionOpenTry = buildTx({ + msg: MsgConnectionOpenTry +}); +/** + * ConnectionOpenAck defines a rpc handler method for MsgConnectionOpenAck. + * @name connectionOpenAck + * @package ibc.core.connection.v1 + * @see proto service: ibc.core.connection.v1.ConnectionOpenAck + */ +export const connectionOpenAck = buildTx({ + msg: MsgConnectionOpenAck +}); +/** + * ConnectionOpenConfirm defines a rpc handler method for + * MsgConnectionOpenConfirm. + * @name connectionOpenConfirm + * @package ibc.core.connection.v1 + * @see proto service: ibc.core.connection.v1.ConnectionOpenConfirm + */ +export const connectionOpenConfirm = buildTx({ + msg: MsgConnectionOpenConfirm +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputinstantrpc/ibc/core/connection/v1/tx.rpc.msg.ts b/__fixtures__/v-next/outputinstantrpc/ibc/core/connection/v1/tx.rpc.msg.ts index 4ce9495af7..fdf3d52d0b 100644 --- a/__fixtures__/v-next/outputinstantrpc/ibc/core/connection/v1/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputinstantrpc/ibc/core/connection/v1/tx.rpc.msg.ts @@ -1,7 +1,8 @@ import { Counterparty, CounterpartySDKType, Version, VersionSDKType } from "./connection"; import { Any, AnySDKType } from "../../../../google/protobuf/any"; import { Height, HeightSDKType } from "../../client/v1/client"; -import { DeliverTxResponse, StdFee, TxRpc } from "../../../../types"; +import { DeliverTxResponse } from "@interchainjs/types"; +import { StdFee, TxRpc } from "../../../../types"; import { BinaryReader } from "../../../../binary"; import { MsgConnectionOpenInit, MsgConnectionOpenInitSDKType, MsgConnectionOpenInitResponse, MsgConnectionOpenInitResponseSDKType, MsgConnectionOpenTry, MsgConnectionOpenTrySDKType, MsgConnectionOpenTryResponse, MsgConnectionOpenTryResponseSDKType, MsgConnectionOpenAck, MsgConnectionOpenAckSDKType, MsgConnectionOpenAckResponse, MsgConnectionOpenAckResponseSDKType, MsgConnectionOpenConfirm, MsgConnectionOpenConfirmSDKType, MsgConnectionOpenConfirmResponse, MsgConnectionOpenConfirmResponseSDKType } from "./tx"; /** Msg defines the ibc/connection Msg service. */ diff --git a/__fixtures__/v-next/outputinstantrpc/ibc/core/port/v1/query.rpc.func.ts b/__fixtures__/v-next/outputinstantrpc/ibc/core/port/v1/query.rpc.func.ts new file mode 100644 index 0000000000..51096ee97c --- /dev/null +++ b/__fixtures__/v-next/outputinstantrpc/ibc/core/port/v1/query.rpc.func.ts @@ -0,0 +1,15 @@ +import { Order, OrderSDKType, Counterparty, CounterpartySDKType } from "../../channel/v1/channel"; +import { EndpointOrRpc, buildQuery } from "../../../../helper-func-types"; +import { QueryAppVersionRequest, QueryAppVersionRequestSDKType, QueryAppVersionResponse, QueryAppVersionResponseSDKType } from "./query"; +/** + * AppVersion queries an IBC Port and determines the appropriate application version to be used + * @name getAppVersion + * @package ibc.core.port.v1 + * @see proto service: ibc.core.port.v1.AppVersion + */ +export const getAppVersion = buildQuery({ + encode: QueryAppVersionRequest.encode, + decode: QueryAppVersionResponse.decode, + service: "ibc.core.port.v1.Query", + method: "AppVersion" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputinstantrpc/index.ts b/__fixtures__/v-next/outputinstantrpc/index.ts index 98a631227c..7ba24d5b89 100644 --- a/__fixtures__/v-next/outputinstantrpc/index.ts +++ b/__fixtures__/v-next/outputinstantrpc/index.ts @@ -24,6 +24,7 @@ export * from "./service-ops"; export * from "./hooks"; export * from "./mobx.stores"; export * from "./extern"; +export * from "./helper-func-types"; export * from "./react-query"; export * from "./mobx"; export * from "./pinia-endpoint"; diff --git a/__fixtures__/v-next/outputinstantrpc/osmosis-sdk-module-client.ts b/__fixtures__/v-next/outputinstantrpc/osmosis-sdk-module-client.ts index 7ed3e3f0cd..915648d82a 100644 --- a/__fixtures__/v-next/outputinstantrpc/osmosis-sdk-module-client.ts +++ b/__fixtures__/v-next/outputinstantrpc/osmosis-sdk-module-client.ts @@ -2,7 +2,8 @@ import { GeneratedType, Registry, OfflineSigner } from "@cosmjs/proto-signing"; import { defaultRegistryTypes, AminoTypes, SigningStargateClient } from "@cosmjs/stargate"; import { HttpEndpoint } from "@cosmjs/tendermint-rpc"; import { createRpcClient } from "./extern"; -import { DeliverTxResponse, EncodeObject, StdFee, TxRpc, SigningClientParams } from "./types"; +import { DeliverTxResponse } from "@interchainjs/types"; +import { EncodeObject, StdFee, TxRpc, SigningClientParams } from "./types"; import * as osmosisGammPoolmodelsBalancerTxTxRegistry from "./osmosis/gamm/pool-models/balancer/tx/tx.registry"; import * as osmosisGammPoolmodelsStableswapTxRegistry from "./osmosis/gamm/pool-models/stableswap/tx.registry"; import * as osmosisGammV1beta1TxRegistry from "./osmosis/gamm/v1beta1/tx.registry"; diff --git a/__fixtures__/v-next/outputinstantrpc/osmosis/bundle.ts b/__fixtures__/v-next/outputinstantrpc/osmosis/bundle.ts index 34b563b82f..6ac2c6dfed 100644 --- a/__fixtures__/v-next/outputinstantrpc/osmosis/bundle.ts +++ b/__fixtures__/v-next/outputinstantrpc/osmosis/bundle.ts @@ -49,59 +49,79 @@ import * as _301 from "./txfees/v1beta1/feetoken"; import * as _302 from "./txfees/v1beta1/genesis"; import * as _303 from "./txfees/v1beta1/gov"; import * as _304 from "./txfees/v1beta1/query"; -import * as _486 from "./gamm/pool-models/balancer/tx/tx.amino"; -import * as _487 from "./gamm/pool-models/stableswap/tx.amino"; -import * as _488 from "./gamm/v1beta1/tx.amino"; -import * as _489 from "./incentives/tx.amino"; -import * as _490 from "./lockup/tx.amino"; -import * as _491 from "./superfluid/tx.amino"; -import * as _492 from "./tokenfactory/v1beta1/tx.amino"; -import * as _493 from "./gamm/pool-models/balancer/tx/tx.registry"; -import * as _494 from "./gamm/pool-models/stableswap/tx.registry"; -import * as _495 from "./gamm/v1beta1/tx.registry"; -import * as _496 from "./incentives/tx.registry"; -import * as _497 from "./lockup/tx.registry"; -import * as _498 from "./superfluid/tx.registry"; -import * as _499 from "./tokenfactory/v1beta1/tx.registry"; -import * as _500 from "./claim/v1beta1/query.lcd"; -import * as _501 from "./epochs/query.lcd"; -import * as _502 from "./gamm/v1beta1/query.lcd"; -import * as _503 from "./gamm/v2/query.lcd"; -import * as _504 from "./ibc-rate-limit/v1beta1/query.lcd"; -import * as _505 from "./incentives/query.lcd"; -import * as _506 from "./lockup/query.lcd"; -import * as _507 from "./mint/v1beta1/query.lcd"; -import * as _508 from "./pool-incentives/v1beta1/query.lcd"; -import * as _509 from "./superfluid/query.lcd"; -import * as _510 from "./tokenfactory/v1beta1/query.lcd"; -import * as _511 from "./twap/v1beta1/query.lcd"; -import * as _512 from "./txfees/v1beta1/query.lcd"; -import * as _513 from "./claim/v1beta1/query.rpc.Query"; -import * as _514 from "./epochs/query.rpc.Query"; -import * as _515 from "./gamm/v1beta1/query.rpc.Query"; -import * as _516 from "./gamm/v2/query.rpc.Query"; -import * as _517 from "./ibc-rate-limit/v1beta1/query.rpc.Query"; -import * as _518 from "./incentives/query.rpc.Query"; -import * as _519 from "./lockup/query.rpc.Query"; -import * as _520 from "./mint/v1beta1/query.rpc.Query"; -import * as _521 from "./pool-incentives/v1beta1/query.rpc.Query"; -import * as _522 from "./superfluid/query.rpc.Query"; -import * as _523 from "./tokenfactory/v1beta1/query.rpc.Query"; -import * as _524 from "./twap/v1beta1/query.rpc.Query"; -import * as _525 from "./txfees/v1beta1/query.rpc.Query"; -import * as _526 from "./gamm/pool-models/balancer/tx/tx.rpc.msg"; -import * as _527 from "./gamm/pool-models/stableswap/tx.rpc.msg"; -import * as _528 from "./gamm/v1beta1/tx.rpc.msg"; -import * as _529 from "./incentives/tx.rpc.msg"; -import * as _530 from "./lockup/tx.rpc.msg"; -import * as _531 from "./superfluid/tx.rpc.msg"; -import * as _532 from "./tokenfactory/v1beta1/tx.rpc.msg"; -import * as _533 from "./gamm/v1beta1/query.pinia.store"; -import * as _534 from "./gamm/v2/query.pinia.store"; -import * as _556 from "./lcd"; -import * as _557 from "./custom-lcd-client"; -import * as _558 from "./rpc.query"; -import * as _559 from "./rpc.tx"; +import * as _558 from "./gamm/pool-models/balancer/tx/tx.amino"; +import * as _559 from "./gamm/pool-models/stableswap/tx.amino"; +import * as _560 from "./gamm/v1beta1/tx.amino"; +import * as _561 from "./incentives/tx.amino"; +import * as _562 from "./lockup/tx.amino"; +import * as _563 from "./superfluid/tx.amino"; +import * as _564 from "./tokenfactory/v1beta1/tx.amino"; +import * as _565 from "./gamm/pool-models/balancer/tx/tx.registry"; +import * as _566 from "./gamm/pool-models/stableswap/tx.registry"; +import * as _567 from "./gamm/v1beta1/tx.registry"; +import * as _568 from "./incentives/tx.registry"; +import * as _569 from "./lockup/tx.registry"; +import * as _570 from "./superfluid/tx.registry"; +import * as _571 from "./tokenfactory/v1beta1/tx.registry"; +import * as _572 from "./claim/v1beta1/query.lcd"; +import * as _573 from "./epochs/query.lcd"; +import * as _574 from "./gamm/v1beta1/query.lcd"; +import * as _575 from "./gamm/v2/query.lcd"; +import * as _576 from "./ibc-rate-limit/v1beta1/query.lcd"; +import * as _577 from "./incentives/query.lcd"; +import * as _578 from "./lockup/query.lcd"; +import * as _579 from "./mint/v1beta1/query.lcd"; +import * as _580 from "./pool-incentives/v1beta1/query.lcd"; +import * as _581 from "./superfluid/query.lcd"; +import * as _582 from "./tokenfactory/v1beta1/query.lcd"; +import * as _583 from "./twap/v1beta1/query.lcd"; +import * as _584 from "./txfees/v1beta1/query.lcd"; +import * as _585 from "./claim/v1beta1/query.rpc.func"; +import * as _586 from "./epochs/query.rpc.func"; +import * as _587 from "./gamm/v1beta1/query.rpc.func"; +import * as _588 from "./gamm/v2/query.rpc.func"; +import * as _589 from "./ibc-rate-limit/v1beta1/query.rpc.func"; +import * as _590 from "./incentives/query.rpc.func"; +import * as _591 from "./lockup/query.rpc.func"; +import * as _592 from "./mint/v1beta1/query.rpc.func"; +import * as _593 from "./pool-incentives/v1beta1/query.rpc.func"; +import * as _594 from "./superfluid/query.rpc.func"; +import * as _595 from "./tokenfactory/v1beta1/query.rpc.func"; +import * as _596 from "./twap/v1beta1/query.rpc.func"; +import * as _597 from "./txfees/v1beta1/query.rpc.func"; +import * as _598 from "./claim/v1beta1/query.rpc.Query"; +import * as _599 from "./epochs/query.rpc.Query"; +import * as _600 from "./gamm/v1beta1/query.rpc.Query"; +import * as _601 from "./gamm/v2/query.rpc.Query"; +import * as _602 from "./ibc-rate-limit/v1beta1/query.rpc.Query"; +import * as _603 from "./incentives/query.rpc.Query"; +import * as _604 from "./lockup/query.rpc.Query"; +import * as _605 from "./mint/v1beta1/query.rpc.Query"; +import * as _606 from "./pool-incentives/v1beta1/query.rpc.Query"; +import * as _607 from "./superfluid/query.rpc.Query"; +import * as _608 from "./tokenfactory/v1beta1/query.rpc.Query"; +import * as _609 from "./twap/v1beta1/query.rpc.Query"; +import * as _610 from "./txfees/v1beta1/query.rpc.Query"; +import * as _611 from "./gamm/pool-models/balancer/tx/tx.rpc.func"; +import * as _612 from "./gamm/pool-models/stableswap/tx.rpc.func"; +import * as _613 from "./gamm/v1beta1/tx.rpc.func"; +import * as _614 from "./incentives/tx.rpc.func"; +import * as _615 from "./lockup/tx.rpc.func"; +import * as _616 from "./superfluid/tx.rpc.func"; +import * as _617 from "./tokenfactory/v1beta1/tx.rpc.func"; +import * as _618 from "./gamm/pool-models/balancer/tx/tx.rpc.msg"; +import * as _619 from "./gamm/pool-models/stableswap/tx.rpc.msg"; +import * as _620 from "./gamm/v1beta1/tx.rpc.msg"; +import * as _621 from "./incentives/tx.rpc.msg"; +import * as _622 from "./lockup/tx.rpc.msg"; +import * as _623 from "./superfluid/tx.rpc.msg"; +import * as _624 from "./tokenfactory/v1beta1/tx.rpc.msg"; +import * as _625 from "./gamm/v1beta1/query.pinia.store"; +import * as _626 from "./gamm/v2/query.pinia.store"; +import * as _649 from "./lcd"; +import * as _650 from "./custom-lcd-client"; +import * as _651 from "./rpc.query"; +import * as _652 from "./rpc.tx"; export namespace osmosis { export namespace claim { export const v1beta1 = { @@ -109,16 +129,18 @@ export namespace osmosis { ..._255, ..._256, ..._257, - ..._500, - ..._513 + ..._572, + ..._585, + ..._598 }; } export namespace epochs { export const v1beta1 = { ..._258, ..._259, - ..._501, - ..._514 + ..._573, + ..._586, + ..._599 }; } export namespace gamm { @@ -127,45 +149,51 @@ export namespace osmosis { ..._261, ..._262, ..._263, - ..._488, - ..._495, - ..._502, - ..._515, - ..._528, - ..._533 + ..._560, + ..._567, + ..._574, + ..._587, + ..._600, + ..._613, + ..._620, + ..._625 }; export namespace poolmodels { export namespace balancer { export const v1beta1 = { ..._264, - ..._486, - ..._493, - ..._526 + ..._558, + ..._565, + ..._611, + ..._618 }; } export namespace stableswap { export const v1beta1 = { ..._265, ..._266, - ..._487, - ..._494, - ..._527 + ..._559, + ..._566, + ..._612, + ..._619 }; } } export const v2 = { ..._267, - ..._503, - ..._516, - ..._534 + ..._575, + ..._588, + ..._601, + ..._626 }; } export namespace ibcratelimit { export const v1beta1 = { ..._268, ..._269, - ..._504, - ..._517 + ..._576, + ..._589, + ..._602 }; } export const incentives = { @@ -174,11 +202,13 @@ export namespace osmosis { ..._272, ..._273, ..._274, - ..._489, - ..._496, - ..._505, - ..._518, - ..._529 + ..._561, + ..._568, + ..._577, + ..._590, + ..._603, + ..._614, + ..._621 }; export const lockup = { ..._275, @@ -186,19 +216,22 @@ export namespace osmosis { ..._277, ..._278, ..._279, - ..._490, - ..._497, - ..._506, - ..._519, - ..._530 + ..._562, + ..._569, + ..._578, + ..._591, + ..._604, + ..._615, + ..._622 }; export namespace mint { export const v1beta1 = { ..._280, ..._281, ..._282, - ..._507, - ..._520 + ..._579, + ..._592, + ..._605 }; } export namespace poolincentives { @@ -207,8 +240,9 @@ export namespace osmosis { ..._284, ..._285, ..._286, - ..._508, - ..._521 + ..._580, + ..._593, + ..._606 }; } export namespace store { @@ -222,11 +256,13 @@ export namespace osmosis { ..._290, ..._291, ..._292, - ..._491, - ..._498, - ..._509, - ..._522, - ..._531 + ..._563, + ..._570, + ..._581, + ..._594, + ..._607, + ..._616, + ..._623 }; export namespace tokenfactory { export const v1beta1 = { @@ -235,11 +271,13 @@ export namespace osmosis { ..._295, ..._296, ..._297, - ..._492, - ..._499, - ..._510, - ..._523, - ..._532 + ..._564, + ..._571, + ..._582, + ..._595, + ..._608, + ..._617, + ..._624 }; } export namespace twap { @@ -247,8 +285,9 @@ export namespace osmosis { ..._298, ..._299, ..._300, - ..._511, - ..._524 + ..._583, + ..._596, + ..._609 }; } export namespace txfees { @@ -257,14 +296,15 @@ export namespace osmosis { ..._302, ..._303, ..._304, - ..._512, - ..._525 + ..._584, + ..._597, + ..._610 }; } export const ClientFactory = { - ..._556, - ..._557, - ..._558, - ..._559 + ..._649, + ..._650, + ..._651, + ..._652 }; } \ No newline at end of file diff --git a/__fixtures__/v-next/outputinstantrpc/osmosis/claim/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputinstantrpc/osmosis/claim/v1beta1/query.rpc.func.ts new file mode 100644 index 0000000000..533eec15e2 --- /dev/null +++ b/__fixtures__/v-next/outputinstantrpc/osmosis/claim/v1beta1/query.rpc.func.ts @@ -0,0 +1,60 @@ +import { Action, ActionSDKType, ClaimRecord, ClaimRecordSDKType } from "./claim"; +import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; +import { Params, ParamsSDKType } from "./params"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { QueryModuleAccountBalanceRequest, QueryModuleAccountBalanceRequestSDKType, QueryModuleAccountBalanceResponse, QueryModuleAccountBalanceResponseSDKType, QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, QueryClaimRecordRequest, QueryClaimRecordRequestSDKType, QueryClaimRecordResponse, QueryClaimRecordResponseSDKType, QueryClaimableForActionRequest, QueryClaimableForActionRequestSDKType, QueryClaimableForActionResponse, QueryClaimableForActionResponseSDKType, QueryTotalClaimableRequest, QueryTotalClaimableRequestSDKType, QueryTotalClaimableResponse, QueryTotalClaimableResponseSDKType } from "./query"; +/** + * @name getModuleAccountBalance + * @package osmosis.claim.v1beta1 + * @see proto service: osmosis.claim.v1beta1.ModuleAccountBalance + */ +export const getModuleAccountBalance = buildQuery({ + encode: QueryModuleAccountBalanceRequest.encode, + decode: QueryModuleAccountBalanceResponse.decode, + service: "osmosis.claim.v1beta1.Query", + method: "ModuleAccountBalance" +}); +/** + * @name getParams + * @package osmosis.claim.v1beta1 + * @see proto service: osmosis.claim.v1beta1.Params + */ +export const getParams = buildQuery({ + encode: QueryParamsRequest.encode, + decode: QueryParamsResponse.decode, + service: "osmosis.claim.v1beta1.Query", + method: "Params" +}); +/** + * @name getClaimRecord + * @package osmosis.claim.v1beta1 + * @see proto service: osmosis.claim.v1beta1.ClaimRecord + */ +export const getClaimRecord = buildQuery({ + encode: QueryClaimRecordRequest.encode, + decode: QueryClaimRecordResponse.decode, + service: "osmosis.claim.v1beta1.Query", + method: "ClaimRecord" +}); +/** + * @name getClaimableForAction + * @package osmosis.claim.v1beta1 + * @see proto service: osmosis.claim.v1beta1.ClaimableForAction + */ +export const getClaimableForAction = buildQuery({ + encode: QueryClaimableForActionRequest.encode, + decode: QueryClaimableForActionResponse.decode, + service: "osmosis.claim.v1beta1.Query", + method: "ClaimableForAction" +}); +/** + * @name getTotalClaimable + * @package osmosis.claim.v1beta1 + * @see proto service: osmosis.claim.v1beta1.TotalClaimable + */ +export const getTotalClaimable = buildQuery({ + encode: QueryTotalClaimableRequest.encode, + decode: QueryTotalClaimableResponse.decode, + service: "osmosis.claim.v1beta1.Query", + method: "TotalClaimable" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputinstantrpc/osmosis/epochs/query.rpc.func.ts b/__fixtures__/v-next/outputinstantrpc/osmosis/epochs/query.rpc.func.ts new file mode 100644 index 0000000000..30e6281677 --- /dev/null +++ b/__fixtures__/v-next/outputinstantrpc/osmosis/epochs/query.rpc.func.ts @@ -0,0 +1,27 @@ +import { EpochInfo, EpochInfoSDKType } from "./genesis"; +import { EndpointOrRpc, buildQuery } from "../../helper-func-types"; +import { QueryEpochsInfoRequest, QueryEpochsInfoRequestSDKType, QueryEpochsInfoResponse, QueryEpochsInfoResponseSDKType, QueryCurrentEpochRequest, QueryCurrentEpochRequestSDKType, QueryCurrentEpochResponse, QueryCurrentEpochResponseSDKType } from "./query"; +/** + * EpochInfos provide running epochInfos + * @name getEpochInfos + * @package osmosis.epochs.v1beta1 + * @see proto service: osmosis.epochs.v1beta1.EpochInfos + */ +export const getEpochInfos = buildQuery({ + encode: QueryEpochsInfoRequest.encode, + decode: QueryEpochsInfoResponse.decode, + service: "osmosis.epochs.v1beta1.Query", + method: "EpochInfos" +}); +/** + * CurrentEpoch provide current epoch of specified identifier + * @name getCurrentEpoch + * @package osmosis.epochs.v1beta1 + * @see proto service: osmosis.epochs.v1beta1.CurrentEpoch + */ +export const getCurrentEpoch = buildQuery({ + encode: QueryCurrentEpochRequest.encode, + decode: QueryCurrentEpochResponse.decode, + service: "osmosis.epochs.v1beta1.Query", + method: "CurrentEpoch" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputinstantrpc/osmosis/gamm/pool-models/balancer/balancerPool.ts b/__fixtures__/v-next/outputinstantrpc/osmosis/gamm/pool-models/balancer/balancerPool.ts index 96db2edf91..8307c1623b 100644 --- a/__fixtures__/v-next/outputinstantrpc/osmosis/gamm/pool-models/balancer/balancerPool.ts +++ b/__fixtures__/v-next/outputinstantrpc/osmosis/gamm/pool-models/balancer/balancerPool.ts @@ -4,7 +4,7 @@ import { Coin, CoinSDKType } from "../../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../../binary"; import { toTimestamp, fromTimestamp, isSet, DeepPartial } from "../../../../helpers"; import { JsonSafe } from "../../../../json-safe"; -import { Decimal } from "@cosmjs/math"; +import { Decimal } from "@interchainjs/math"; export const protobufPackage = "osmosis.gamm.v1beta1"; /** * Parameters for changing the weights in a balancer pool smoothly from @@ -492,8 +492,8 @@ export const PoolParams = { }, toAmino(message: PoolParams): PoolParamsAmino { const obj: any = {}; - obj.swap_fee = message.swapFee === "" ? undefined : message.swapFee; - obj.exit_fee = message.exitFee === "" ? undefined : message.exitFee; + obj.swap_fee = message.swapFee === "" ? undefined : Decimal.fromUserInput(message.swapFee, 18).atomics; + obj.exit_fee = message.exitFee === "" ? undefined : Decimal.fromUserInput(message.exitFee, 18).atomics; obj.smooth_weight_change_params = message.smoothWeightChangeParams ? SmoothWeightChangeParams.toAmino(message.smoothWeightChangeParams) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/osmosis/gamm/pool-models/balancer/tx/tx.amino.ts b/__fixtures__/v-next/outputinstantrpc/osmosis/gamm/pool-models/balancer/tx/tx.amino.ts index e028c4b738..afced4a637 100644 --- a/__fixtures__/v-next/outputinstantrpc/osmosis/gamm/pool-models/balancer/tx/tx.amino.ts +++ b/__fixtures__/v-next/outputinstantrpc/osmosis/gamm/pool-models/balancer/tx/tx.amino.ts @@ -1,6 +1,7 @@ //@ts-nocheck import { PoolParams, PoolParamsSDKType, PoolAsset, PoolAssetSDKType, SmoothWeightChangeParams, SmoothWeightChangeParamsSDKType } from "../balancerPool"; import { AminoMsg } from "@cosmjs/amino"; +import { Decimal } from "@interchainjs/math"; import { Duration, DurationSDKType } from "../../../../../google/protobuf/duration"; import { Coin, CoinSDKType } from "../../../../../cosmos/base/v1beta1/coin"; import { MsgCreateBalancerPool, MsgCreateBalancerPoolSDKType } from "./tx"; @@ -55,8 +56,8 @@ export const AminoConverter = { return { sender, pool_params: { - swap_fee: poolParams.swapFee, - exit_fee: poolParams.exitFee, + swap_fee: Decimal.fromUserInput(poolParams.swapFee, 18).atomics, + exit_fee: Decimal.fromUserInput(poolParams.exitFee, 18).atomics, smooth_weight_change_params: { start_time: poolParams.smoothWeightChangeParams.startTime, duration: (poolParams.smoothWeightChangeParams.duration * 1_000_000_000).toString(), diff --git a/__fixtures__/v-next/outputinstantrpc/osmosis/gamm/pool-models/balancer/tx/tx.registry.ts b/__fixtures__/v-next/outputinstantrpc/osmosis/gamm/pool-models/balancer/tx/tx.registry.ts index 9e9fd33533..65088d4d18 100644 --- a/__fixtures__/v-next/outputinstantrpc/osmosis/gamm/pool-models/balancer/tx/tx.registry.ts +++ b/__fixtures__/v-next/outputinstantrpc/osmosis/gamm/pool-models/balancer/tx/tx.registry.ts @@ -1,13 +1,7 @@ import { PoolParams, PoolParamsSDKType, PoolAsset, PoolAssetSDKType } from "../balancerPool"; import { TelescopeGeneratedType } from "../../../../../types"; -import { Registry } from "@cosmjs/proto-signing"; import { MsgCreateBalancerPool, MsgCreateBalancerPoolSDKType } from "./tx"; export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/osmosis.gamm.poolmodels.balancer.v1beta1.MsgCreateBalancerPool", MsgCreateBalancerPool]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; export const MessageComposer = { encoded: { createBalancerPool(value: MsgCreateBalancerPool) { diff --git a/__fixtures__/v-next/outputinstantrpc/osmosis/gamm/pool-models/balancer/tx/tx.rpc.func.ts b/__fixtures__/v-next/outputinstantrpc/osmosis/gamm/pool-models/balancer/tx/tx.rpc.func.ts new file mode 100644 index 0000000000..d5b603efb5 --- /dev/null +++ b/__fixtures__/v-next/outputinstantrpc/osmosis/gamm/pool-models/balancer/tx/tx.rpc.func.ts @@ -0,0 +1,11 @@ +import { PoolParams, PoolParamsSDKType, PoolAsset, PoolAssetSDKType } from "../balancerPool"; +import { buildTx } from "../../../../../helper-func-types"; +import { MsgCreateBalancerPool, MsgCreateBalancerPoolSDKType, MsgCreateBalancerPoolResponse, MsgCreateBalancerPoolResponseSDKType } from "./tx"; +/** + * @name createBalancerPool + * @package osmosis.gamm.poolmodels.balancer.v1beta1 + * @see proto service: osmosis.gamm.poolmodels.balancer.v1beta1.CreateBalancerPool + */ +export const createBalancerPool = buildTx({ + msg: MsgCreateBalancerPool +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputinstantrpc/osmosis/gamm/pool-models/balancer/tx/tx.rpc.msg.ts b/__fixtures__/v-next/outputinstantrpc/osmosis/gamm/pool-models/balancer/tx/tx.rpc.msg.ts index ae3c79f6d8..fd89bb059e 100644 --- a/__fixtures__/v-next/outputinstantrpc/osmosis/gamm/pool-models/balancer/tx/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputinstantrpc/osmosis/gamm/pool-models/balancer/tx/tx.rpc.msg.ts @@ -1,5 +1,6 @@ import { PoolParams, PoolParamsSDKType, PoolAsset, PoolAssetSDKType } from "../balancerPool"; -import { DeliverTxResponse, StdFee, TxRpc } from "../../../../../types"; +import { DeliverTxResponse } from "@interchainjs/types"; +import { StdFee, TxRpc } from "../../../../../types"; import { BinaryReader } from "../../../../../binary"; import { MsgCreateBalancerPool, MsgCreateBalancerPoolSDKType, MsgCreateBalancerPoolResponse, MsgCreateBalancerPoolResponseSDKType } from "./tx"; export interface Msg { diff --git a/__fixtures__/v-next/outputinstantrpc/osmosis/gamm/pool-models/stableswap/stableswap_pool.ts b/__fixtures__/v-next/outputinstantrpc/osmosis/gamm/pool-models/stableswap/stableswap_pool.ts index 256ff8bacd..604f47dcb8 100644 --- a/__fixtures__/v-next/outputinstantrpc/osmosis/gamm/pool-models/stableswap/stableswap_pool.ts +++ b/__fixtures__/v-next/outputinstantrpc/osmosis/gamm/pool-models/stableswap/stableswap_pool.ts @@ -1,6 +1,6 @@ import { Coin, CoinSDKType } from "../../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { Decimal } from "@cosmjs/math"; +import { Decimal } from "@interchainjs/math"; import { isSet, DeepPartial } from "../../../../helpers"; import { JsonSafe } from "../../../../json-safe"; export const protobufPackage = "osmosis.gamm.poolmodels.stableswap.v1beta1"; @@ -186,8 +186,8 @@ export const PoolParams = { }, toAmino(message: PoolParams): PoolParamsAmino { const obj: any = {}; - obj.swap_fee = message.swapFee === "" ? undefined : message.swapFee; - obj.exit_fee = message.exitFee === "" ? undefined : message.exitFee; + obj.swap_fee = message.swapFee === "" ? undefined : Decimal.fromUserInput(message.swapFee, 18).atomics; + obj.exit_fee = message.exitFee === "" ? undefined : Decimal.fromUserInput(message.exitFee, 18).atomics; return obj; }, fromAminoMsg(object: PoolParamsAminoMsg): PoolParams { diff --git a/__fixtures__/v-next/outputinstantrpc/osmosis/gamm/pool-models/stableswap/tx.amino.ts b/__fixtures__/v-next/outputinstantrpc/osmosis/gamm/pool-models/stableswap/tx.amino.ts index 165f81a64a..a61ea336f8 100644 --- a/__fixtures__/v-next/outputinstantrpc/osmosis/gamm/pool-models/stableswap/tx.amino.ts +++ b/__fixtures__/v-next/outputinstantrpc/osmosis/gamm/pool-models/stableswap/tx.amino.ts @@ -2,6 +2,7 @@ import { PoolParams, PoolParamsSDKType } from "./stableswap_pool"; import { Coin, CoinSDKType } from "../../../../cosmos/base/v1beta1/coin"; import { AminoMsg } from "@cosmjs/amino"; +import { Decimal } from "@interchainjs/math"; import { omitDefault } from "../../../../helpers"; import { MsgCreateStableswapPool, MsgCreateStableswapPoolSDKType, MsgStableSwapAdjustScalingFactors, MsgStableSwapAdjustScalingFactorsSDKType } from "./tx"; export interface MsgCreateStableswapPoolAminoType extends AminoMsg { @@ -43,8 +44,8 @@ export const AminoConverter = { return { sender, pool_params: { - swap_fee: poolParams.swapFee, - exit_fee: poolParams.exitFee + swap_fee: Decimal.fromUserInput(poolParams.swapFee, 18).atomics, + exit_fee: Decimal.fromUserInput(poolParams.exitFee, 18).atomics }, initial_pool_liquidity: initialPoolLiquidity.map(el0 => ({ denom: el0.denom, diff --git a/__fixtures__/v-next/outputinstantrpc/osmosis/gamm/pool-models/stableswap/tx.registry.ts b/__fixtures__/v-next/outputinstantrpc/osmosis/gamm/pool-models/stableswap/tx.registry.ts index b1431a4360..8543c53439 100644 --- a/__fixtures__/v-next/outputinstantrpc/osmosis/gamm/pool-models/stableswap/tx.registry.ts +++ b/__fixtures__/v-next/outputinstantrpc/osmosis/gamm/pool-models/stableswap/tx.registry.ts @@ -1,14 +1,8 @@ import { PoolParams, PoolParamsSDKType } from "./stableswap_pool"; import { Coin, CoinSDKType } from "../../../../cosmos/base/v1beta1/coin"; import { TelescopeGeneratedType } from "../../../../types"; -import { Registry } from "@cosmjs/proto-signing"; import { MsgCreateStableswapPool, MsgCreateStableswapPoolSDKType, MsgStableSwapAdjustScalingFactors, MsgStableSwapAdjustScalingFactorsSDKType } from "./tx"; export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/osmosis.gamm.poolmodels.stableswap.v1beta1.MsgCreateStableswapPool", MsgCreateStableswapPool], ["/osmosis.gamm.poolmodels.stableswap.v1beta1.MsgStableSwapAdjustScalingFactors", MsgStableSwapAdjustScalingFactors]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; export const MessageComposer = { encoded: { createStableswapPool(value: MsgCreateStableswapPool) { diff --git a/__fixtures__/v-next/outputinstantrpc/osmosis/gamm/pool-models/stableswap/tx.rpc.func.ts b/__fixtures__/v-next/outputinstantrpc/osmosis/gamm/pool-models/stableswap/tx.rpc.func.ts new file mode 100644 index 0000000000..6e46af505b --- /dev/null +++ b/__fixtures__/v-next/outputinstantrpc/osmosis/gamm/pool-models/stableswap/tx.rpc.func.ts @@ -0,0 +1,20 @@ +import { PoolParams, PoolParamsSDKType } from "./stableswap_pool"; +import { Coin, CoinSDKType } from "../../../../cosmos/base/v1beta1/coin"; +import { buildTx } from "../../../../helper-func-types"; +import { MsgCreateStableswapPool, MsgCreateStableswapPoolSDKType, MsgCreateStableswapPoolResponse, MsgCreateStableswapPoolResponseSDKType, MsgStableSwapAdjustScalingFactors, MsgStableSwapAdjustScalingFactorsSDKType, MsgStableSwapAdjustScalingFactorsResponse, MsgStableSwapAdjustScalingFactorsResponseSDKType } from "./tx"; +/** + * @name createStableswapPool + * @package osmosis.gamm.poolmodels.stableswap.v1beta1 + * @see proto service: osmosis.gamm.poolmodels.stableswap.v1beta1.CreateStableswapPool + */ +export const createStableswapPool = buildTx({ + msg: MsgCreateStableswapPool +}); +/** + * @name stableSwapAdjustScalingFactors + * @package osmosis.gamm.poolmodels.stableswap.v1beta1 + * @see proto service: osmosis.gamm.poolmodels.stableswap.v1beta1.StableSwapAdjustScalingFactors + */ +export const stableSwapAdjustScalingFactors = buildTx({ + msg: MsgStableSwapAdjustScalingFactors +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputinstantrpc/osmosis/gamm/pool-models/stableswap/tx.rpc.msg.ts b/__fixtures__/v-next/outputinstantrpc/osmosis/gamm/pool-models/stableswap/tx.rpc.msg.ts index 576692a9d9..da67ba3d6f 100644 --- a/__fixtures__/v-next/outputinstantrpc/osmosis/gamm/pool-models/stableswap/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputinstantrpc/osmosis/gamm/pool-models/stableswap/tx.rpc.msg.ts @@ -1,6 +1,7 @@ import { PoolParams, PoolParamsSDKType } from "./stableswap_pool"; import { Coin, CoinSDKType } from "../../../../cosmos/base/v1beta1/coin"; -import { DeliverTxResponse, StdFee, TxRpc } from "../../../../types"; +import { DeliverTxResponse } from "@interchainjs/types"; +import { StdFee, TxRpc } from "../../../../types"; import { BinaryReader } from "../../../../binary"; import { MsgCreateStableswapPool, MsgCreateStableswapPoolSDKType, MsgCreateStableswapPoolResponse, MsgCreateStableswapPoolResponseSDKType, MsgStableSwapAdjustScalingFactors, MsgStableSwapAdjustScalingFactorsSDKType, MsgStableSwapAdjustScalingFactorsResponse, MsgStableSwapAdjustScalingFactorsResponseSDKType } from "./tx"; export interface Msg { diff --git a/__fixtures__/v-next/outputinstantrpc/osmosis/gamm/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputinstantrpc/osmosis/gamm/v1beta1/query.rpc.func.ts new file mode 100644 index 0000000000..394a6d6e65 --- /dev/null +++ b/__fixtures__/v-next/outputinstantrpc/osmosis/gamm/v1beta1/query.rpc.func.ts @@ -0,0 +1,183 @@ +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination"; +import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; +import { SwapAmountInRoute, SwapAmountInRouteSDKType, SwapAmountOutRoute, SwapAmountOutRouteSDKType } from "./tx"; +import { Any, AnySDKType } from "../../../google/protobuf/any"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { QueryPoolsRequest, QueryPoolsRequestSDKType, QueryPoolsResponse, QueryPoolsResponseSDKType, QueryNumPoolsRequest, QueryNumPoolsRequestSDKType, QueryNumPoolsResponse, QueryNumPoolsResponseSDKType, QueryTotalLiquidityRequest, QueryTotalLiquidityRequestSDKType, QueryTotalLiquidityResponse, QueryTotalLiquidityResponseSDKType, QueryPoolsWithFilterRequest, QueryPoolsWithFilterRequestSDKType, QueryPoolsWithFilterResponse, QueryPoolsWithFilterResponseSDKType, QueryPoolRequest, QueryPoolRequestSDKType, QueryPoolResponse, QueryPoolResponseSDKType, QueryPoolTypeRequest, QueryPoolTypeRequestSDKType, QueryPoolTypeResponse, QueryPoolTypeResponseSDKType, QueryCalcJoinPoolNoSwapSharesRequest, QueryCalcJoinPoolNoSwapSharesRequestSDKType, QueryCalcJoinPoolNoSwapSharesResponse, QueryCalcJoinPoolNoSwapSharesResponseSDKType, QueryCalcJoinPoolSharesRequest, QueryCalcJoinPoolSharesRequestSDKType, QueryCalcJoinPoolSharesResponse, QueryCalcJoinPoolSharesResponseSDKType, QueryCalcExitPoolCoinsFromSharesRequest, QueryCalcExitPoolCoinsFromSharesRequestSDKType, QueryCalcExitPoolCoinsFromSharesResponse, QueryCalcExitPoolCoinsFromSharesResponseSDKType, QueryPoolParamsRequest, QueryPoolParamsRequestSDKType, QueryPoolParamsResponse, QueryPoolParamsResponseSDKType, QueryTotalPoolLiquidityRequest, QueryTotalPoolLiquidityRequestSDKType, QueryTotalPoolLiquidityResponse, QueryTotalPoolLiquidityResponseSDKType, QueryTotalSharesRequest, QueryTotalSharesRequestSDKType, QueryTotalSharesResponse, QueryTotalSharesResponseSDKType, QuerySpotPriceRequest, QuerySpotPriceRequestSDKType, QuerySpotPriceResponse, QuerySpotPriceResponseSDKType, QuerySwapExactAmountInRequest, QuerySwapExactAmountInRequestSDKType, QuerySwapExactAmountInResponse, QuerySwapExactAmountInResponseSDKType, QuerySwapExactAmountOutRequest, QuerySwapExactAmountOutRequestSDKType, QuerySwapExactAmountOutResponse, QuerySwapExactAmountOutResponseSDKType } from "./query"; +/** + * @name getPools + * @package osmosis.gamm.v1beta1 + * @see proto service: osmosis.gamm.v1beta1.Pools + */ +export const getPools = buildQuery({ + encode: QueryPoolsRequest.encode, + decode: QueryPoolsResponse.decode, + service: "osmosis.gamm.v1beta1.Query", + method: "Pools" +}); +/** + * @name getNumPools + * @package osmosis.gamm.v1beta1 + * @see proto service: osmosis.gamm.v1beta1.NumPools + */ +export const getNumPools = buildQuery({ + encode: QueryNumPoolsRequest.encode, + decode: QueryNumPoolsResponse.decode, + service: "osmosis.gamm.v1beta1.Query", + method: "NumPools" +}); +/** + * @name getTotalLiquidity + * @package osmosis.gamm.v1beta1 + * @see proto service: osmosis.gamm.v1beta1.TotalLiquidity + */ +export const getTotalLiquidity = buildQuery({ + encode: QueryTotalLiquidityRequest.encode, + decode: QueryTotalLiquidityResponse.decode, + service: "osmosis.gamm.v1beta1.Query", + method: "TotalLiquidity" +}); +/** + * PoolsWithFilter allows you to query specific pools with requested + * parameters + * @name getPoolsWithFilter + * @package osmosis.gamm.v1beta1 + * @see proto service: osmosis.gamm.v1beta1.PoolsWithFilter + */ +export const getPoolsWithFilter = buildQuery({ + encode: QueryPoolsWithFilterRequest.encode, + decode: QueryPoolsWithFilterResponse.decode, + service: "osmosis.gamm.v1beta1.Query", + method: "PoolsWithFilter" +}); +/** + * Per Pool gRPC Endpoints + * @name getPool + * @package osmosis.gamm.v1beta1 + * @see proto service: osmosis.gamm.v1beta1.Pool + */ +export const getPool = buildQuery({ + encode: QueryPoolRequest.encode, + decode: QueryPoolResponse.decode, + service: "osmosis.gamm.v1beta1.Query", + method: "Pool" +}); +/** + * PoolType returns the type of the pool. + * Returns "Balancer" as a string literal when the pool is a balancer pool. + * Errors if the pool is failed to be type caseted. + * @name getPoolType + * @package osmosis.gamm.v1beta1 + * @see proto service: osmosis.gamm.v1beta1.PoolType + */ +export const getPoolType = buildQuery({ + encode: QueryPoolTypeRequest.encode, + decode: QueryPoolTypeResponse.decode, + service: "osmosis.gamm.v1beta1.Query", + method: "PoolType" +}); +/** + * Simulates joining pool without a swap. Returns the amount of shares you'd + * get and tokens needed to provide + * @name getCalcJoinPoolNoSwapShares + * @package osmosis.gamm.v1beta1 + * @see proto service: osmosis.gamm.v1beta1.CalcJoinPoolNoSwapShares + */ +export const getCalcJoinPoolNoSwapShares = buildQuery({ + encode: QueryCalcJoinPoolNoSwapSharesRequest.encode, + decode: QueryCalcJoinPoolNoSwapSharesResponse.decode, + service: "osmosis.gamm.v1beta1.Query", + method: "CalcJoinPoolNoSwapShares" +}); +/** + * @name getCalcJoinPoolShares + * @package osmosis.gamm.v1beta1 + * @see proto service: osmosis.gamm.v1beta1.CalcJoinPoolShares + */ +export const getCalcJoinPoolShares = buildQuery({ + encode: QueryCalcJoinPoolSharesRequest.encode, + decode: QueryCalcJoinPoolSharesResponse.decode, + service: "osmosis.gamm.v1beta1.Query", + method: "CalcJoinPoolShares" +}); +/** + * @name getCalcExitPoolCoinsFromShares + * @package osmosis.gamm.v1beta1 + * @see proto service: osmosis.gamm.v1beta1.CalcExitPoolCoinsFromShares + */ +export const getCalcExitPoolCoinsFromShares = buildQuery({ + encode: QueryCalcExitPoolCoinsFromSharesRequest.encode, + decode: QueryCalcExitPoolCoinsFromSharesResponse.decode, + service: "osmosis.gamm.v1beta1.Query", + method: "CalcExitPoolCoinsFromShares" +}); +/** + * @name getPoolParams + * @package osmosis.gamm.v1beta1 + * @see proto service: osmosis.gamm.v1beta1.PoolParams + */ +export const getPoolParams = buildQuery({ + encode: QueryPoolParamsRequest.encode, + decode: QueryPoolParamsResponse.decode, + service: "osmosis.gamm.v1beta1.Query", + method: "PoolParams" +}); +/** + * @name getTotalPoolLiquidity + * @package osmosis.gamm.v1beta1 + * @see proto service: osmosis.gamm.v1beta1.TotalPoolLiquidity + */ +export const getTotalPoolLiquidity = buildQuery({ + encode: QueryTotalPoolLiquidityRequest.encode, + decode: QueryTotalPoolLiquidityResponse.decode, + service: "osmosis.gamm.v1beta1.Query", + method: "TotalPoolLiquidity" +}); +/** + * @name getTotalShares + * @package osmosis.gamm.v1beta1 + * @see proto service: osmosis.gamm.v1beta1.TotalShares + */ +export const getTotalShares = buildQuery({ + encode: QueryTotalSharesRequest.encode, + decode: QueryTotalSharesResponse.decode, + service: "osmosis.gamm.v1beta1.Query", + method: "TotalShares" +}); +/** + * SpotPrice defines a gRPC query handler that returns the spot price given + * a base denomination and a quote denomination. + * @name getSpotPrice + * @package osmosis.gamm.v1beta1 + * @see proto service: osmosis.gamm.v1beta1.SpotPrice + * @deprecated + */ +export const getSpotPrice = buildQuery({ + encode: QuerySpotPriceRequest.encode, + decode: QuerySpotPriceResponse.decode, + service: "osmosis.gamm.v1beta1.Query", + method: "SpotPrice" +}); +/** + * Estimate the swap. + * @name getEstimateSwapExactAmountIn + * @package osmosis.gamm.v1beta1 + * @see proto service: osmosis.gamm.v1beta1.EstimateSwapExactAmountIn + */ +export const getEstimateSwapExactAmountIn = buildQuery({ + encode: QuerySwapExactAmountInRequest.encode, + decode: QuerySwapExactAmountInResponse.decode, + service: "osmosis.gamm.v1beta1.Query", + method: "EstimateSwapExactAmountIn" +}); +/** + * @name getEstimateSwapExactAmountOut + * @package osmosis.gamm.v1beta1 + * @see proto service: osmosis.gamm.v1beta1.EstimateSwapExactAmountOut + */ +export const getEstimateSwapExactAmountOut = buildQuery({ + encode: QuerySwapExactAmountOutRequest.encode, + decode: QuerySwapExactAmountOutResponse.decode, + service: "osmosis.gamm.v1beta1.Query", + method: "EstimateSwapExactAmountOut" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputinstantrpc/osmosis/gamm/v1beta1/tx.registry.ts b/__fixtures__/v-next/outputinstantrpc/osmosis/gamm/v1beta1/tx.registry.ts index d02c573e99..195d3096de 100644 --- a/__fixtures__/v-next/outputinstantrpc/osmosis/gamm/v1beta1/tx.registry.ts +++ b/__fixtures__/v-next/outputinstantrpc/osmosis/gamm/v1beta1/tx.registry.ts @@ -1,13 +1,7 @@ import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { TelescopeGeneratedType } from "../../../types"; -import { Registry } from "@cosmjs/proto-signing"; import { MsgJoinPool, MsgJoinPoolSDKType, MsgExitPool, MsgExitPoolSDKType, MsgSwapExactAmountIn, MsgSwapExactAmountInSDKType, MsgSwapExactAmountOut, MsgSwapExactAmountOutSDKType, MsgJoinSwapExternAmountIn, MsgJoinSwapExternAmountInSDKType, MsgJoinSwapShareAmountOut, MsgJoinSwapShareAmountOutSDKType, MsgExitSwapExternAmountOut, MsgExitSwapExternAmountOutSDKType, MsgExitSwapShareAmountIn, MsgExitSwapShareAmountInSDKType } from "./tx"; export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/osmosis.gamm.v1beta1.MsgJoinPool", MsgJoinPool], ["/osmosis.gamm.v1beta1.MsgExitPool", MsgExitPool], ["/osmosis.gamm.v1beta1.MsgSwapExactAmountIn", MsgSwapExactAmountIn], ["/osmosis.gamm.v1beta1.MsgSwapExactAmountOut", MsgSwapExactAmountOut], ["/osmosis.gamm.v1beta1.MsgJoinSwapExternAmountIn", MsgJoinSwapExternAmountIn], ["/osmosis.gamm.v1beta1.MsgJoinSwapShareAmountOut", MsgJoinSwapShareAmountOut], ["/osmosis.gamm.v1beta1.MsgExitSwapExternAmountOut", MsgExitSwapExternAmountOut], ["/osmosis.gamm.v1beta1.MsgExitSwapShareAmountIn", MsgExitSwapShareAmountIn]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; export const MessageComposer = { encoded: { joinPool(value: MsgJoinPool) { diff --git a/__fixtures__/v-next/outputinstantrpc/osmosis/gamm/v1beta1/tx.rpc.func.ts b/__fixtures__/v-next/outputinstantrpc/osmosis/gamm/v1beta1/tx.rpc.func.ts new file mode 100644 index 0000000000..005459cc78 --- /dev/null +++ b/__fixtures__/v-next/outputinstantrpc/osmosis/gamm/v1beta1/tx.rpc.func.ts @@ -0,0 +1,67 @@ +import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; +import { buildTx } from "../../../helper-func-types"; +import { MsgJoinPool, MsgJoinPoolSDKType, MsgJoinPoolResponse, MsgJoinPoolResponseSDKType, MsgExitPool, MsgExitPoolSDKType, MsgExitPoolResponse, MsgExitPoolResponseSDKType, MsgSwapExactAmountIn, MsgSwapExactAmountInSDKType, MsgSwapExactAmountInResponse, MsgSwapExactAmountInResponseSDKType, MsgSwapExactAmountOut, MsgSwapExactAmountOutSDKType, MsgSwapExactAmountOutResponse, MsgSwapExactAmountOutResponseSDKType, MsgJoinSwapExternAmountIn, MsgJoinSwapExternAmountInSDKType, MsgJoinSwapExternAmountInResponse, MsgJoinSwapExternAmountInResponseSDKType, MsgJoinSwapShareAmountOut, MsgJoinSwapShareAmountOutSDKType, MsgJoinSwapShareAmountOutResponse, MsgJoinSwapShareAmountOutResponseSDKType, MsgExitSwapExternAmountOut, MsgExitSwapExternAmountOutSDKType, MsgExitSwapExternAmountOutResponse, MsgExitSwapExternAmountOutResponseSDKType, MsgExitSwapShareAmountIn, MsgExitSwapShareAmountInSDKType, MsgExitSwapShareAmountInResponse, MsgExitSwapShareAmountInResponseSDKType } from "./tx"; +/** + * @name joinPool + * @package osmosis.gamm.v1beta1 + * @see proto service: osmosis.gamm.v1beta1.JoinPool + */ +export const joinPool = buildTx({ + msg: MsgJoinPool +}); +/** + * @name exitPool + * @package osmosis.gamm.v1beta1 + * @see proto service: osmosis.gamm.v1beta1.ExitPool + */ +export const exitPool = buildTx({ + msg: MsgExitPool +}); +/** + * @name swapExactAmountIn + * @package osmosis.gamm.v1beta1 + * @see proto service: osmosis.gamm.v1beta1.SwapExactAmountIn + */ +export const swapExactAmountIn = buildTx({ + msg: MsgSwapExactAmountIn +}); +/** + * @name swapExactAmountOut + * @package osmosis.gamm.v1beta1 + * @see proto service: osmosis.gamm.v1beta1.SwapExactAmountOut + */ +export const swapExactAmountOut = buildTx({ + msg: MsgSwapExactAmountOut +}); +/** + * @name joinSwapExternAmountIn + * @package osmosis.gamm.v1beta1 + * @see proto service: osmosis.gamm.v1beta1.JoinSwapExternAmountIn + */ +export const joinSwapExternAmountIn = buildTx({ + msg: MsgJoinSwapExternAmountIn +}); +/** + * @name joinSwapShareAmountOut + * @package osmosis.gamm.v1beta1 + * @see proto service: osmosis.gamm.v1beta1.JoinSwapShareAmountOut + */ +export const joinSwapShareAmountOut = buildTx({ + msg: MsgJoinSwapShareAmountOut +}); +/** + * @name exitSwapExternAmountOut + * @package osmosis.gamm.v1beta1 + * @see proto service: osmosis.gamm.v1beta1.ExitSwapExternAmountOut + */ +export const exitSwapExternAmountOut = buildTx({ + msg: MsgExitSwapExternAmountOut +}); +/** + * @name exitSwapShareAmountIn + * @package osmosis.gamm.v1beta1 + * @see proto service: osmosis.gamm.v1beta1.ExitSwapShareAmountIn + */ +export const exitSwapShareAmountIn = buildTx({ + msg: MsgExitSwapShareAmountIn +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputinstantrpc/osmosis/gamm/v1beta1/tx.rpc.msg.ts b/__fixtures__/v-next/outputinstantrpc/osmosis/gamm/v1beta1/tx.rpc.msg.ts index b448deef11..d0ee4701a6 100644 --- a/__fixtures__/v-next/outputinstantrpc/osmosis/gamm/v1beta1/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputinstantrpc/osmosis/gamm/v1beta1/tx.rpc.msg.ts @@ -1,5 +1,6 @@ import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; -import { DeliverTxResponse, StdFee, TxRpc } from "../../../types"; +import { DeliverTxResponse } from "@interchainjs/types"; +import { StdFee, TxRpc } from "../../../types"; import { BinaryReader } from "../../../binary"; import { MsgJoinPool, MsgJoinPoolSDKType, MsgJoinPoolResponse, MsgJoinPoolResponseSDKType, MsgExitPool, MsgExitPoolSDKType, MsgExitPoolResponse, MsgExitPoolResponseSDKType, MsgSwapExactAmountIn, MsgSwapExactAmountInSDKType, MsgSwapExactAmountInResponse, MsgSwapExactAmountInResponseSDKType, MsgSwapExactAmountOut, MsgSwapExactAmountOutSDKType, MsgSwapExactAmountOutResponse, MsgSwapExactAmountOutResponseSDKType, MsgJoinSwapExternAmountIn, MsgJoinSwapExternAmountInSDKType, MsgJoinSwapExternAmountInResponse, MsgJoinSwapExternAmountInResponseSDKType, MsgJoinSwapShareAmountOut, MsgJoinSwapShareAmountOutSDKType, MsgJoinSwapShareAmountOutResponse, MsgJoinSwapShareAmountOutResponseSDKType, MsgExitSwapExternAmountOut, MsgExitSwapExternAmountOutSDKType, MsgExitSwapExternAmountOutResponse, MsgExitSwapExternAmountOutResponseSDKType, MsgExitSwapShareAmountIn, MsgExitSwapShareAmountInSDKType, MsgExitSwapShareAmountInResponse, MsgExitSwapShareAmountInResponseSDKType } from "./tx"; export interface Msg { diff --git a/__fixtures__/v-next/outputinstantrpc/osmosis/gamm/v2/query.rpc.func.ts b/__fixtures__/v-next/outputinstantrpc/osmosis/gamm/v2/query.rpc.func.ts new file mode 100644 index 0000000000..7e1cbf5290 --- /dev/null +++ b/__fixtures__/v-next/outputinstantrpc/osmosis/gamm/v2/query.rpc.func.ts @@ -0,0 +1,15 @@ +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { QuerySpotPriceRequest, QuerySpotPriceRequestSDKType, QuerySpotPriceResponse, QuerySpotPriceResponseSDKType } from "./query"; +/** + * SpotPrice defines a gRPC query handler that returns the spot price given + * a base denomination and a quote denomination. + * @name getSpotPrice + * @package osmosis.gamm.v2 + * @see proto service: osmosis.gamm.v2.SpotPrice + */ +export const getSpotPrice = buildQuery({ + encode: QuerySpotPriceRequest.encode, + decode: QuerySpotPriceResponse.decode, + service: "osmosis.gamm.v2.Query", + method: "SpotPrice" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputinstantrpc/osmosis/ibc-rate-limit/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputinstantrpc/osmosis/ibc-rate-limit/v1beta1/query.rpc.func.ts new file mode 100644 index 0000000000..ce47a9f6ce --- /dev/null +++ b/__fixtures__/v-next/outputinstantrpc/osmosis/ibc-rate-limit/v1beta1/query.rpc.func.ts @@ -0,0 +1,16 @@ +import { Params, ParamsSDKType } from "./params"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType } from "./query"; +/** + * Params defines a gRPC query method that returns the ibc-rate-limit module's + * parameters. + * @name getParams + * @package osmosis.ibcratelimit.v1beta1 + * @see proto service: osmosis.ibcratelimit.v1beta1.Params + */ +export const getParams = buildQuery({ + encode: QueryParamsRequest.encode, + decode: QueryParamsResponse.decode, + service: "osmosis.ibcratelimit.v1beta1.Query", + method: "Params" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputinstantrpc/osmosis/incentives/query.rpc.func.ts b/__fixtures__/v-next/outputinstantrpc/osmosis/incentives/query.rpc.func.ts new file mode 100644 index 0000000000..38b91c63ed --- /dev/null +++ b/__fixtures__/v-next/outputinstantrpc/osmosis/incentives/query.rpc.func.ts @@ -0,0 +1,118 @@ +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../cosmos/base/query/v1beta1/pagination"; +import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; +import { Gauge, GaugeSDKType } from "./gauge"; +import { Duration, DurationSDKType } from "../../google/protobuf/duration"; +import { EndpointOrRpc, buildQuery } from "../../helper-func-types"; +import { ModuleToDistributeCoinsRequest, ModuleToDistributeCoinsRequestSDKType, ModuleToDistributeCoinsResponse, ModuleToDistributeCoinsResponseSDKType, GaugeByIDRequest, GaugeByIDRequestSDKType, GaugeByIDResponse, GaugeByIDResponseSDKType, GaugesRequest, GaugesRequestSDKType, GaugesResponse, GaugesResponseSDKType, ActiveGaugesRequest, ActiveGaugesRequestSDKType, ActiveGaugesResponse, ActiveGaugesResponseSDKType, ActiveGaugesPerDenomRequest, ActiveGaugesPerDenomRequestSDKType, ActiveGaugesPerDenomResponse, ActiveGaugesPerDenomResponseSDKType, UpcomingGaugesRequest, UpcomingGaugesRequestSDKType, UpcomingGaugesResponse, UpcomingGaugesResponseSDKType, UpcomingGaugesPerDenomRequest, UpcomingGaugesPerDenomRequestSDKType, UpcomingGaugesPerDenomResponse, UpcomingGaugesPerDenomResponseSDKType, RewardsEstRequest, RewardsEstRequestSDKType, RewardsEstResponse, RewardsEstResponseSDKType, QueryLockableDurationsRequest, QueryLockableDurationsRequestSDKType, QueryLockableDurationsResponse, QueryLockableDurationsResponseSDKType } from "./query"; +/** + * ModuleToDistributeCoins returns coins that are going to be distributed + * @name getModuleToDistributeCoins + * @package osmosis.incentives + * @see proto service: osmosis.incentives.ModuleToDistributeCoins + */ +export const getModuleToDistributeCoins = buildQuery({ + encode: ModuleToDistributeCoinsRequest.encode, + decode: ModuleToDistributeCoinsResponse.decode, + service: "osmosis.incentives.Query", + method: "ModuleToDistributeCoins" +}); +/** + * GaugeByID returns gauges by their respective ID + * @name getGaugeByID + * @package osmosis.incentives + * @see proto service: osmosis.incentives.GaugeByID + */ +export const getGaugeByID = buildQuery({ + encode: GaugeByIDRequest.encode, + decode: GaugeByIDResponse.decode, + service: "osmosis.incentives.Query", + method: "GaugeByID" +}); +/** + * Gauges returns both upcoming and active gauges + * @name getGauges + * @package osmosis.incentives + * @see proto service: osmosis.incentives.Gauges + */ +export const getGauges = buildQuery({ + encode: GaugesRequest.encode, + decode: GaugesResponse.decode, + service: "osmosis.incentives.Query", + method: "Gauges" +}); +/** + * ActiveGauges returns active gauges + * @name getActiveGauges + * @package osmosis.incentives + * @see proto service: osmosis.incentives.ActiveGauges + */ +export const getActiveGauges = buildQuery({ + encode: ActiveGaugesRequest.encode, + decode: ActiveGaugesResponse.decode, + service: "osmosis.incentives.Query", + method: "ActiveGauges" +}); +/** + * ActiveGaugesPerDenom returns active gauges by denom + * @name getActiveGaugesPerDenom + * @package osmosis.incentives + * @see proto service: osmosis.incentives.ActiveGaugesPerDenom + */ +export const getActiveGaugesPerDenom = buildQuery({ + encode: ActiveGaugesPerDenomRequest.encode, + decode: ActiveGaugesPerDenomResponse.decode, + service: "osmosis.incentives.Query", + method: "ActiveGaugesPerDenom" +}); +/** + * Returns scheduled gauges that have not yet occured + * @name getUpcomingGauges + * @package osmosis.incentives + * @see proto service: osmosis.incentives.UpcomingGauges + */ +export const getUpcomingGauges = buildQuery({ + encode: UpcomingGaugesRequest.encode, + decode: UpcomingGaugesResponse.decode, + service: "osmosis.incentives.Query", + method: "UpcomingGauges" +}); +/** + * UpcomingGaugesPerDenom returns scheduled gauges that have not yet occured + * by denom + * @name getUpcomingGaugesPerDenom + * @package osmosis.incentives + * @see proto service: osmosis.incentives.UpcomingGaugesPerDenom + */ +export const getUpcomingGaugesPerDenom = buildQuery({ + encode: UpcomingGaugesPerDenomRequest.encode, + decode: UpcomingGaugesPerDenomResponse.decode, + service: "osmosis.incentives.Query", + method: "UpcomingGaugesPerDenom" +}); +/** + * RewardsEst returns an estimate of the rewards from now until a specified + * time in the future The querier either provides an address or a set of locks + * for which they want to find the associated rewards + * @name getRewardsEst + * @package osmosis.incentives + * @see proto service: osmosis.incentives.RewardsEst + */ +export const getRewardsEst = buildQuery({ + encode: RewardsEstRequest.encode, + decode: RewardsEstResponse.decode, + service: "osmosis.incentives.Query", + method: "RewardsEst" +}); +/** + * LockableDurations returns lockable durations that are valid to distribute + * incentives for + * @name getLockableDurations + * @package osmosis.incentives + * @see proto service: osmosis.incentives.LockableDurations + */ +export const getLockableDurations = buildQuery({ + encode: QueryLockableDurationsRequest.encode, + decode: QueryLockableDurationsResponse.decode, + service: "osmosis.incentives.Query", + method: "LockableDurations" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputinstantrpc/osmosis/incentives/tx.registry.ts b/__fixtures__/v-next/outputinstantrpc/osmosis/incentives/tx.registry.ts index b8e6dccb0c..a96c6bbf24 100644 --- a/__fixtures__/v-next/outputinstantrpc/osmosis/incentives/tx.registry.ts +++ b/__fixtures__/v-next/outputinstantrpc/osmosis/incentives/tx.registry.ts @@ -2,14 +2,8 @@ import { QueryCondition, QueryConditionSDKType } from "../lockup/lock"; import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; import { Timestamp, TimestampSDKType } from "../../google/protobuf/timestamp"; import { TelescopeGeneratedType } from "../../types"; -import { Registry } from "@cosmjs/proto-signing"; import { MsgCreateGauge, MsgCreateGaugeSDKType, MsgAddToGauge, MsgAddToGaugeSDKType } from "./tx"; export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/osmosis.incentives.MsgCreateGauge", MsgCreateGauge], ["/osmosis.incentives.MsgAddToGauge", MsgAddToGauge]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; export const MessageComposer = { encoded: { createGauge(value: MsgCreateGauge) { diff --git a/__fixtures__/v-next/outputinstantrpc/osmosis/incentives/tx.rpc.func.ts b/__fixtures__/v-next/outputinstantrpc/osmosis/incentives/tx.rpc.func.ts new file mode 100644 index 0000000000..6c5516e08b --- /dev/null +++ b/__fixtures__/v-next/outputinstantrpc/osmosis/incentives/tx.rpc.func.ts @@ -0,0 +1,21 @@ +import { QueryCondition, QueryConditionSDKType } from "../lockup/lock"; +import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; +import { Timestamp, TimestampSDKType } from "../../google/protobuf/timestamp"; +import { buildTx } from "../../helper-func-types"; +import { MsgCreateGauge, MsgCreateGaugeSDKType, MsgCreateGaugeResponse, MsgCreateGaugeResponseSDKType, MsgAddToGauge, MsgAddToGaugeSDKType, MsgAddToGaugeResponse, MsgAddToGaugeResponseSDKType } from "./tx"; +/** + * @name createGauge + * @package osmosis.incentives + * @see proto service: osmosis.incentives.CreateGauge + */ +export const createGauge = buildTx({ + msg: MsgCreateGauge +}); +/** + * @name addToGauge + * @package osmosis.incentives + * @see proto service: osmosis.incentives.AddToGauge + */ +export const addToGauge = buildTx({ + msg: MsgAddToGauge +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputinstantrpc/osmosis/incentives/tx.rpc.msg.ts b/__fixtures__/v-next/outputinstantrpc/osmosis/incentives/tx.rpc.msg.ts index f068728075..2cf68d87dd 100644 --- a/__fixtures__/v-next/outputinstantrpc/osmosis/incentives/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputinstantrpc/osmosis/incentives/tx.rpc.msg.ts @@ -1,7 +1,8 @@ import { QueryCondition, QueryConditionSDKType } from "../lockup/lock"; import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; import { Timestamp, TimestampSDKType } from "../../google/protobuf/timestamp"; -import { DeliverTxResponse, StdFee, TxRpc } from "../../types"; +import { DeliverTxResponse } from "@interchainjs/types"; +import { StdFee, TxRpc } from "../../types"; import { BinaryReader } from "../../binary"; import { MsgCreateGauge, MsgCreateGaugeSDKType, MsgCreateGaugeResponse, MsgCreateGaugeResponseSDKType, MsgAddToGauge, MsgAddToGaugeSDKType, MsgAddToGaugeResponse, MsgAddToGaugeResponseSDKType } from "./tx"; export interface Msg { diff --git a/__fixtures__/v-next/outputinstantrpc/osmosis/lockup/query.rpc.func.ts b/__fixtures__/v-next/outputinstantrpc/osmosis/lockup/query.rpc.func.ts new file mode 100644 index 0000000000..a126fbdd36 --- /dev/null +++ b/__fixtures__/v-next/outputinstantrpc/osmosis/lockup/query.rpc.func.ts @@ -0,0 +1,213 @@ +import { Timestamp, TimestampSDKType } from "../../google/protobuf/timestamp"; +import { Duration, DurationSDKType } from "../../google/protobuf/duration"; +import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; +import { PeriodLock, PeriodLockSDKType, SyntheticLock, SyntheticLockSDKType } from "./lock"; +import { Params, ParamsSDKType } from "./params"; +import { EndpointOrRpc, buildQuery } from "../../helper-func-types"; +import { ModuleBalanceRequest, ModuleBalanceRequestSDKType, ModuleBalanceResponse, ModuleBalanceResponseSDKType, ModuleLockedAmountRequest, ModuleLockedAmountRequestSDKType, ModuleLockedAmountResponse, ModuleLockedAmountResponseSDKType, AccountUnlockableCoinsRequest, AccountUnlockableCoinsRequestSDKType, AccountUnlockableCoinsResponse, AccountUnlockableCoinsResponseSDKType, AccountUnlockingCoinsRequest, AccountUnlockingCoinsRequestSDKType, AccountUnlockingCoinsResponse, AccountUnlockingCoinsResponseSDKType, AccountLockedCoinsRequest, AccountLockedCoinsRequestSDKType, AccountLockedCoinsResponse, AccountLockedCoinsResponseSDKType, AccountLockedPastTimeRequest, AccountLockedPastTimeRequestSDKType, AccountLockedPastTimeResponse, AccountLockedPastTimeResponseSDKType, AccountLockedPastTimeNotUnlockingOnlyRequest, AccountLockedPastTimeNotUnlockingOnlyRequestSDKType, AccountLockedPastTimeNotUnlockingOnlyResponse, AccountLockedPastTimeNotUnlockingOnlyResponseSDKType, AccountUnlockedBeforeTimeRequest, AccountUnlockedBeforeTimeRequestSDKType, AccountUnlockedBeforeTimeResponse, AccountUnlockedBeforeTimeResponseSDKType, AccountLockedPastTimeDenomRequest, AccountLockedPastTimeDenomRequestSDKType, AccountLockedPastTimeDenomResponse, AccountLockedPastTimeDenomResponseSDKType, LockedDenomRequest, LockedDenomRequestSDKType, LockedDenomResponse, LockedDenomResponseSDKType, LockedRequest, LockedRequestSDKType, LockedResponse, LockedResponseSDKType, SyntheticLockupsByLockupIDRequest, SyntheticLockupsByLockupIDRequestSDKType, SyntheticLockupsByLockupIDResponse, SyntheticLockupsByLockupIDResponseSDKType, AccountLockedLongerDurationRequest, AccountLockedLongerDurationRequestSDKType, AccountLockedLongerDurationResponse, AccountLockedLongerDurationResponseSDKType, AccountLockedDurationRequest, AccountLockedDurationRequestSDKType, AccountLockedDurationResponse, AccountLockedDurationResponseSDKType, AccountLockedLongerDurationNotUnlockingOnlyRequest, AccountLockedLongerDurationNotUnlockingOnlyRequestSDKType, AccountLockedLongerDurationNotUnlockingOnlyResponse, AccountLockedLongerDurationNotUnlockingOnlyResponseSDKType, AccountLockedLongerDurationDenomRequest, AccountLockedLongerDurationDenomRequestSDKType, AccountLockedLongerDurationDenomResponse, AccountLockedLongerDurationDenomResponseSDKType, QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType } from "./query"; +/** + * Return full balance of the module + * @name getModuleBalance + * @package osmosis.lockup + * @see proto service: osmosis.lockup.ModuleBalance + */ +export const getModuleBalance = buildQuery({ + encode: ModuleBalanceRequest.encode, + decode: ModuleBalanceResponse.decode, + service: "osmosis.lockup.Query", + method: "ModuleBalance" +}); +/** + * Return locked balance of the module + * @name getModuleLockedAmount + * @package osmosis.lockup + * @see proto service: osmosis.lockup.ModuleLockedAmount + */ +export const getModuleLockedAmount = buildQuery({ + encode: ModuleLockedAmountRequest.encode, + decode: ModuleLockedAmountResponse.decode, + service: "osmosis.lockup.Query", + method: "ModuleLockedAmount" +}); +/** + * Returns unlockable coins which are not withdrawn yet + * @name getAccountUnlockableCoins + * @package osmosis.lockup + * @see proto service: osmosis.lockup.AccountUnlockableCoins + */ +export const getAccountUnlockableCoins = buildQuery({ + encode: AccountUnlockableCoinsRequest.encode, + decode: AccountUnlockableCoinsResponse.decode, + service: "osmosis.lockup.Query", + method: "AccountUnlockableCoins" +}); +/** + * Returns unlocking coins + * @name getAccountUnlockingCoins + * @package osmosis.lockup + * @see proto service: osmosis.lockup.AccountUnlockingCoins + */ +export const getAccountUnlockingCoins = buildQuery({ + encode: AccountUnlockingCoinsRequest.encode, + decode: AccountUnlockingCoinsResponse.decode, + service: "osmosis.lockup.Query", + method: "AccountUnlockingCoins" +}); +/** + * Return a locked coins that can't be withdrawn + * @name getAccountLockedCoins + * @package osmosis.lockup + * @see proto service: osmosis.lockup.AccountLockedCoins + */ +export const getAccountLockedCoins = buildQuery({ + encode: AccountLockedCoinsRequest.encode, + decode: AccountLockedCoinsResponse.decode, + service: "osmosis.lockup.Query", + method: "AccountLockedCoins" +}); +/** + * Returns locked records of an account with unlock time beyond timestamp + * @name getAccountLockedPastTime + * @package osmosis.lockup + * @see proto service: osmosis.lockup.AccountLockedPastTime + */ +export const getAccountLockedPastTime = buildQuery({ + encode: AccountLockedPastTimeRequest.encode, + decode: AccountLockedPastTimeResponse.decode, + service: "osmosis.lockup.Query", + method: "AccountLockedPastTime" +}); +/** + * Returns locked records of an account with unlock time beyond timestamp + * excluding tokens started unlocking + * @name getAccountLockedPastTimeNotUnlockingOnly + * @package osmosis.lockup + * @see proto service: osmosis.lockup.AccountLockedPastTimeNotUnlockingOnly + */ +export const getAccountLockedPastTimeNotUnlockingOnly = buildQuery({ + encode: AccountLockedPastTimeNotUnlockingOnlyRequest.encode, + decode: AccountLockedPastTimeNotUnlockingOnlyResponse.decode, + service: "osmosis.lockup.Query", + method: "AccountLockedPastTimeNotUnlockingOnly" +}); +/** + * Returns unlocked records with unlock time before timestamp + * @name getAccountUnlockedBeforeTime + * @package osmosis.lockup + * @see proto service: osmosis.lockup.AccountUnlockedBeforeTime + */ +export const getAccountUnlockedBeforeTime = buildQuery({ + encode: AccountUnlockedBeforeTimeRequest.encode, + decode: AccountUnlockedBeforeTimeResponse.decode, + service: "osmosis.lockup.Query", + method: "AccountUnlockedBeforeTime" +}); +/** + * Returns lock records by address, timestamp, denom + * @name getAccountLockedPastTimeDenom + * @package osmosis.lockup + * @see proto service: osmosis.lockup.AccountLockedPastTimeDenom + */ +export const getAccountLockedPastTimeDenom = buildQuery({ + encode: AccountLockedPastTimeDenomRequest.encode, + decode: AccountLockedPastTimeDenomResponse.decode, + service: "osmosis.lockup.Query", + method: "AccountLockedPastTimeDenom" +}); +/** + * Returns total locked per denom with longer past given time + * @name getLockedDenom + * @package osmosis.lockup + * @see proto service: osmosis.lockup.LockedDenom + */ +export const getLockedDenom = buildQuery({ + encode: LockedDenomRequest.encode, + decode: LockedDenomResponse.decode, + service: "osmosis.lockup.Query", + method: "LockedDenom" +}); +/** + * Returns lock record by id + * @name getLockedByID + * @package osmosis.lockup + * @see proto service: osmosis.lockup.LockedByID + */ +export const getLockedByID = buildQuery({ + encode: LockedRequest.encode, + decode: LockedResponse.decode, + service: "osmosis.lockup.Query", + method: "LockedByID" +}); +/** + * Returns synthetic lockups by native lockup id + * @name getSyntheticLockupsByLockupID + * @package osmosis.lockup + * @see proto service: osmosis.lockup.SyntheticLockupsByLockupID + */ +export const getSyntheticLockupsByLockupID = buildQuery({ + encode: SyntheticLockupsByLockupIDRequest.encode, + decode: SyntheticLockupsByLockupIDResponse.decode, + service: "osmosis.lockup.Query", + method: "SyntheticLockupsByLockupID" +}); +/** + * Returns account locked records with longer duration + * @name getAccountLockedLongerDuration + * @package osmosis.lockup + * @see proto service: osmosis.lockup.AccountLockedLongerDuration + */ +export const getAccountLockedLongerDuration = buildQuery({ + encode: AccountLockedLongerDurationRequest.encode, + decode: AccountLockedLongerDurationResponse.decode, + service: "osmosis.lockup.Query", + method: "AccountLockedLongerDuration" +}); +/** + * Returns account locked records with a specific duration + * @name getAccountLockedDuration + * @package osmosis.lockup + * @see proto service: osmosis.lockup.AccountLockedDuration + */ +export const getAccountLockedDuration = buildQuery({ + encode: AccountLockedDurationRequest.encode, + decode: AccountLockedDurationResponse.decode, + service: "osmosis.lockup.Query", + method: "AccountLockedDuration" +}); +/** + * Returns account locked records with longer duration excluding tokens + * started unlocking + * @name getAccountLockedLongerDurationNotUnlockingOnly + * @package osmosis.lockup + * @see proto service: osmosis.lockup.AccountLockedLongerDurationNotUnlockingOnly + */ +export const getAccountLockedLongerDurationNotUnlockingOnly = buildQuery({ + encode: AccountLockedLongerDurationNotUnlockingOnlyRequest.encode, + decode: AccountLockedLongerDurationNotUnlockingOnlyResponse.decode, + service: "osmosis.lockup.Query", + method: "AccountLockedLongerDurationNotUnlockingOnly" +}); +/** + * Returns account's locked records for a denom with longer duration + * @name getAccountLockedLongerDurationDenom + * @package osmosis.lockup + * @see proto service: osmosis.lockup.AccountLockedLongerDurationDenom + */ +export const getAccountLockedLongerDurationDenom = buildQuery({ + encode: AccountLockedLongerDurationDenomRequest.encode, + decode: AccountLockedLongerDurationDenomResponse.decode, + service: "osmosis.lockup.Query", + method: "AccountLockedLongerDurationDenom" +}); +/** + * Params returns lockup params. + * @name getParams + * @package osmosis.lockup + * @see proto service: osmosis.lockup.Params + */ +export const getParams = buildQuery({ + encode: QueryParamsRequest.encode, + decode: QueryParamsResponse.decode, + service: "osmosis.lockup.Query", + method: "Params" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputinstantrpc/osmosis/lockup/tx.registry.ts b/__fixtures__/v-next/outputinstantrpc/osmosis/lockup/tx.registry.ts index e50a79800e..a4a8fde8f7 100644 --- a/__fixtures__/v-next/outputinstantrpc/osmosis/lockup/tx.registry.ts +++ b/__fixtures__/v-next/outputinstantrpc/osmosis/lockup/tx.registry.ts @@ -2,14 +2,8 @@ import { Duration, DurationSDKType } from "../../google/protobuf/duration"; import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; import { PeriodLock, PeriodLockSDKType } from "./lock"; import { TelescopeGeneratedType } from "../../types"; -import { Registry } from "@cosmjs/proto-signing"; import { MsgLockTokens, MsgLockTokensSDKType, MsgBeginUnlockingAll, MsgBeginUnlockingAllSDKType, MsgBeginUnlocking, MsgBeginUnlockingSDKType, MsgExtendLockup, MsgExtendLockupSDKType, MsgForceUnlock, MsgForceUnlockSDKType } from "./tx"; export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/osmosis.lockup.MsgLockTokens", MsgLockTokens], ["/osmosis.lockup.MsgBeginUnlockingAll", MsgBeginUnlockingAll], ["/osmosis.lockup.MsgBeginUnlocking", MsgBeginUnlocking], ["/osmosis.lockup.MsgExtendLockup", MsgExtendLockup], ["/osmosis.lockup.MsgForceUnlock", MsgForceUnlock]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; export const MessageComposer = { encoded: { lockTokens(value: MsgLockTokens) { diff --git a/__fixtures__/v-next/outputinstantrpc/osmosis/lockup/tx.rpc.func.ts b/__fixtures__/v-next/outputinstantrpc/osmosis/lockup/tx.rpc.func.ts new file mode 100644 index 0000000000..f9b47db3d7 --- /dev/null +++ b/__fixtures__/v-next/outputinstantrpc/osmosis/lockup/tx.rpc.func.ts @@ -0,0 +1,49 @@ +import { Duration, DurationSDKType } from "../../google/protobuf/duration"; +import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; +import { PeriodLock, PeriodLockSDKType } from "./lock"; +import { buildTx } from "../../helper-func-types"; +import { MsgLockTokens, MsgLockTokensSDKType, MsgLockTokensResponse, MsgLockTokensResponseSDKType, MsgBeginUnlockingAll, MsgBeginUnlockingAllSDKType, MsgBeginUnlockingAllResponse, MsgBeginUnlockingAllResponseSDKType, MsgBeginUnlocking, MsgBeginUnlockingSDKType, MsgBeginUnlockingResponse, MsgBeginUnlockingResponseSDKType, MsgExtendLockup, MsgExtendLockupSDKType, MsgExtendLockupResponse, MsgExtendLockupResponseSDKType, MsgForceUnlock, MsgForceUnlockSDKType, MsgForceUnlockResponse, MsgForceUnlockResponseSDKType } from "./tx"; +/** + * LockTokens lock tokens + * @name lockTokens + * @package osmosis.lockup + * @see proto service: osmosis.lockup.LockTokens + */ +export const lockTokens = buildTx({ + msg: MsgLockTokens +}); +/** + * BeginUnlockingAll begin unlocking all tokens + * @name beginUnlockingAll + * @package osmosis.lockup + * @see proto service: osmosis.lockup.BeginUnlockingAll + */ +export const beginUnlockingAll = buildTx({ + msg: MsgBeginUnlockingAll +}); +/** + * MsgBeginUnlocking begins unlocking tokens by lock ID + * @name beginUnlocking + * @package osmosis.lockup + * @see proto service: osmosis.lockup.BeginUnlocking + */ +export const beginUnlocking = buildTx({ + msg: MsgBeginUnlocking +}); +/** + * MsgEditLockup edits the existing lockups by lock ID + * @name extendLockup + * @package osmosis.lockup + * @see proto service: osmosis.lockup.ExtendLockup + */ +export const extendLockup = buildTx({ + msg: MsgExtendLockup +}); +/** + * @name forceUnlock + * @package osmosis.lockup + * @see proto service: osmosis.lockup.ForceUnlock + */ +export const forceUnlock = buildTx({ + msg: MsgForceUnlock +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputinstantrpc/osmosis/lockup/tx.rpc.msg.ts b/__fixtures__/v-next/outputinstantrpc/osmosis/lockup/tx.rpc.msg.ts index a083e7f65d..37550310f4 100644 --- a/__fixtures__/v-next/outputinstantrpc/osmosis/lockup/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputinstantrpc/osmosis/lockup/tx.rpc.msg.ts @@ -1,7 +1,8 @@ import { Duration, DurationSDKType } from "../../google/protobuf/duration"; import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; import { PeriodLock, PeriodLockSDKType } from "./lock"; -import { DeliverTxResponse, StdFee, TxRpc } from "../../types"; +import { DeliverTxResponse } from "@interchainjs/types"; +import { StdFee, TxRpc } from "../../types"; import { BinaryReader } from "../../binary"; import { MsgLockTokens, MsgLockTokensSDKType, MsgLockTokensResponse, MsgLockTokensResponseSDKType, MsgBeginUnlockingAll, MsgBeginUnlockingAllSDKType, MsgBeginUnlockingAllResponse, MsgBeginUnlockingAllResponseSDKType, MsgBeginUnlocking, MsgBeginUnlockingSDKType, MsgBeginUnlockingResponse, MsgBeginUnlockingResponseSDKType, MsgExtendLockup, MsgExtendLockupSDKType, MsgExtendLockupResponse, MsgExtendLockupResponseSDKType, MsgForceUnlock, MsgForceUnlockSDKType, MsgForceUnlockResponse, MsgForceUnlockResponseSDKType } from "./tx"; /** Msg defines the Msg service. */ diff --git a/__fixtures__/v-next/outputinstantrpc/osmosis/mint/v1beta1/mint.ts b/__fixtures__/v-next/outputinstantrpc/osmosis/mint/v1beta1/mint.ts index 6909f8db83..08f5d0078e 100644 --- a/__fixtures__/v-next/outputinstantrpc/osmosis/mint/v1beta1/mint.ts +++ b/__fixtures__/v-next/outputinstantrpc/osmosis/mint/v1beta1/mint.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { Decimal } from "@cosmjs/math"; +import { Decimal } from "@interchainjs/math"; import { isSet, DeepPartial } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "osmosis.mint.v1beta1"; @@ -247,7 +247,7 @@ export const Minter = { }, toAmino(message: Minter): MinterAmino { const obj: any = {}; - obj.epoch_provisions = message.epochProvisions === "" ? undefined : message.epochProvisions; + obj.epoch_provisions = message.epochProvisions === "" ? undefined : Decimal.fromUserInput(message.epochProvisions, 18).atomics; return obj; }, fromAminoMsg(object: MinterAminoMsg): Minter { @@ -366,7 +366,7 @@ export const WeightedAddress = { toAmino(message: WeightedAddress): WeightedAddressAmino { const obj: any = {}; obj.address = message.address === "" ? undefined : message.address; - obj.weight = message.weight === "" ? undefined : message.weight; + obj.weight = message.weight === "" ? undefined : Decimal.fromUserInput(message.weight, 18).atomics; return obj; }, fromAminoMsg(object: WeightedAddressAminoMsg): WeightedAddress { @@ -516,10 +516,10 @@ export const DistributionProportions = { }, toAmino(message: DistributionProportions): DistributionProportionsAmino { const obj: any = {}; - obj.staking = message.staking === "" ? undefined : message.staking; - obj.pool_incentives = message.poolIncentives === "" ? undefined : message.poolIncentives; - obj.developer_rewards = message.developerRewards === "" ? undefined : message.developerRewards; - obj.community_pool = message.communityPool === "" ? undefined : message.communityPool; + obj.staking = message.staking === "" ? undefined : Decimal.fromUserInput(message.staking, 18).atomics; + obj.pool_incentives = message.poolIncentives === "" ? undefined : Decimal.fromUserInput(message.poolIncentives, 18).atomics; + obj.developer_rewards = message.developerRewards === "" ? undefined : Decimal.fromUserInput(message.developerRewards, 18).atomics; + obj.community_pool = message.communityPool === "" ? undefined : Decimal.fromUserInput(message.communityPool, 18).atomics; return obj; }, fromAminoMsg(object: DistributionProportionsAminoMsg): DistributionProportions { @@ -744,10 +744,10 @@ export const Params = { toAmino(message: Params): ParamsAmino { const obj: any = {}; obj.mint_denom = message.mintDenom === "" ? undefined : message.mintDenom; - obj.genesis_epoch_provisions = message.genesisEpochProvisions === "" ? undefined : message.genesisEpochProvisions; + obj.genesis_epoch_provisions = message.genesisEpochProvisions === "" ? undefined : Decimal.fromUserInput(message.genesisEpochProvisions, 18).atomics; obj.epoch_identifier = message.epochIdentifier === "" ? undefined : message.epochIdentifier; obj.reduction_period_in_epochs = message.reductionPeriodInEpochs !== BigInt(0) ? message.reductionPeriodInEpochs?.toString() : undefined; - obj.reduction_factor = message.reductionFactor === "" ? undefined : message.reductionFactor; + obj.reduction_factor = message.reductionFactor === "" ? undefined : Decimal.fromUserInput(message.reductionFactor, 18).atomics; obj.distribution_proportions = message.distributionProportions ? DistributionProportions.toAmino(message.distributionProportions) : undefined; if (message.weightedDeveloperRewardsReceivers) { obj.weighted_developer_rewards_receivers = message.weightedDeveloperRewardsReceivers.map(e => e ? WeightedAddress.toAmino(e) : undefined); diff --git a/__fixtures__/v-next/outputinstantrpc/osmosis/mint/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputinstantrpc/osmosis/mint/v1beta1/query.rpc.func.ts new file mode 100644 index 0000000000..46ed6c8ec6 --- /dev/null +++ b/__fixtures__/v-next/outputinstantrpc/osmosis/mint/v1beta1/query.rpc.func.ts @@ -0,0 +1,27 @@ +import { Params, ParamsSDKType } from "./mint"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, QueryEpochProvisionsRequest, QueryEpochProvisionsRequestSDKType, QueryEpochProvisionsResponse, QueryEpochProvisionsResponseSDKType } from "./query"; +/** + * Params returns the total set of minting parameters. + * @name getParams + * @package osmosis.mint.v1beta1 + * @see proto service: osmosis.mint.v1beta1.Params + */ +export const getParams = buildQuery({ + encode: QueryParamsRequest.encode, + decode: QueryParamsResponse.decode, + service: "osmosis.mint.v1beta1.Query", + method: "Params" +}); +/** + * EpochProvisions returns the current minting epoch provisions value. + * @name getEpochProvisions + * @package osmosis.mint.v1beta1 + * @see proto service: osmosis.mint.v1beta1.EpochProvisions + */ +export const getEpochProvisions = buildQuery({ + encode: QueryEpochProvisionsRequest.encode, + decode: QueryEpochProvisionsResponse.decode, + service: "osmosis.mint.v1beta1.Query", + method: "EpochProvisions" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputinstantrpc/osmosis/pool-incentives/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputinstantrpc/osmosis/pool-incentives/v1beta1/query.rpc.func.ts new file mode 100644 index 0000000000..468816faa5 --- /dev/null +++ b/__fixtures__/v-next/outputinstantrpc/osmosis/pool-incentives/v1beta1/query.rpc.func.ts @@ -0,0 +1,77 @@ +import { Duration, DurationSDKType } from "../../../google/protobuf/duration"; +import { DistrInfo, DistrInfoSDKType, Params, ParamsSDKType } from "./incentives"; +import { Gauge, GaugeSDKType } from "../../incentives/gauge"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { QueryGaugeIdsRequest, QueryGaugeIdsRequestSDKType, QueryGaugeIdsResponse, QueryGaugeIdsResponseSDKType, QueryDistrInfoRequest, QueryDistrInfoRequestSDKType, QueryDistrInfoResponse, QueryDistrInfoResponseSDKType, QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, QueryLockableDurationsRequest, QueryLockableDurationsRequestSDKType, QueryLockableDurationsResponse, QueryLockableDurationsResponseSDKType, QueryIncentivizedPoolsRequest, QueryIncentivizedPoolsRequestSDKType, QueryIncentivizedPoolsResponse, QueryIncentivizedPoolsResponseSDKType, QueryExternalIncentiveGaugesRequest, QueryExternalIncentiveGaugesRequestSDKType, QueryExternalIncentiveGaugesResponse, QueryExternalIncentiveGaugesResponseSDKType } from "./query"; +/** + * GaugeIds takes the pool id and returns the matching gauge ids and durations + * @name getGaugeIds + * @package osmosis.poolincentives.v1beta1 + * @see proto service: osmosis.poolincentives.v1beta1.GaugeIds + */ +export const getGaugeIds = buildQuery({ + encode: QueryGaugeIdsRequest.encode, + decode: QueryGaugeIdsResponse.decode, + service: "osmosis.poolincentives.v1beta1.Query", + method: "GaugeIds" +}); +/** + * DistrInfo returns the pool's matching gauge ids and weights. + * @name getDistrInfo + * @package osmosis.poolincentives.v1beta1 + * @see proto service: osmosis.poolincentives.v1beta1.DistrInfo + */ +export const getDistrInfo = buildQuery({ + encode: QueryDistrInfoRequest.encode, + decode: QueryDistrInfoResponse.decode, + service: "osmosis.poolincentives.v1beta1.Query", + method: "DistrInfo" +}); +/** + * Params returns pool incentives params. + * @name getParams + * @package osmosis.poolincentives.v1beta1 + * @see proto service: osmosis.poolincentives.v1beta1.Params + */ +export const getParams = buildQuery({ + encode: QueryParamsRequest.encode, + decode: QueryParamsResponse.decode, + service: "osmosis.poolincentives.v1beta1.Query", + method: "Params" +}); +/** + * LockableDurations returns lock durations for pools. + * @name getLockableDurations + * @package osmosis.poolincentives.v1beta1 + * @see proto service: osmosis.poolincentives.v1beta1.LockableDurations + */ +export const getLockableDurations = buildQuery({ + encode: QueryLockableDurationsRequest.encode, + decode: QueryLockableDurationsResponse.decode, + service: "osmosis.poolincentives.v1beta1.Query", + method: "LockableDurations" +}); +/** + * IncentivizedPools returns currently incentivized pools + * @name getIncentivizedPools + * @package osmosis.poolincentives.v1beta1 + * @see proto service: osmosis.poolincentives.v1beta1.IncentivizedPools + */ +export const getIncentivizedPools = buildQuery({ + encode: QueryIncentivizedPoolsRequest.encode, + decode: QueryIncentivizedPoolsResponse.decode, + service: "osmosis.poolincentives.v1beta1.Query", + method: "IncentivizedPools" +}); +/** + * ExternalIncentiveGauges returns external incentive gauges. + * @name getExternalIncentiveGauges + * @package osmosis.poolincentives.v1beta1 + * @see proto service: osmosis.poolincentives.v1beta1.ExternalIncentiveGauges + */ +export const getExternalIncentiveGauges = buildQuery({ + encode: QueryExternalIncentiveGaugesRequest.encode, + decode: QueryExternalIncentiveGaugesResponse.decode, + service: "osmosis.poolincentives.v1beta1.Query", + method: "ExternalIncentiveGauges" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputinstantrpc/osmosis/superfluid/params.ts b/__fixtures__/v-next/outputinstantrpc/osmosis/superfluid/params.ts index 999860b208..887350b915 100644 --- a/__fixtures__/v-next/outputinstantrpc/osmosis/superfluid/params.ts +++ b/__fixtures__/v-next/outputinstantrpc/osmosis/superfluid/params.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { Decimal } from "@cosmjs/math"; +import { Decimal } from "@interchainjs/math"; import { isSet, DeepPartial } from "../../helpers"; import { JsonSafe } from "../../json-safe"; export const protobufPackage = "osmosis.superfluid"; @@ -106,7 +106,7 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.minimum_risk_factor = message.minimumRiskFactor === "" ? undefined : message.minimumRiskFactor; + obj.minimum_risk_factor = message.minimumRiskFactor === "" ? undefined : Decimal.fromUserInput(message.minimumRiskFactor, 18).atomics; return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputinstantrpc/osmosis/superfluid/query.rpc.func.ts b/__fixtures__/v-next/outputinstantrpc/osmosis/superfluid/query.rpc.func.ts new file mode 100644 index 0000000000..366d548135 --- /dev/null +++ b/__fixtures__/v-next/outputinstantrpc/osmosis/superfluid/query.rpc.func.ts @@ -0,0 +1,194 @@ +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../cosmos/base/query/v1beta1/pagination"; +import { Params, ParamsSDKType } from "./params"; +import { SuperfluidAssetType, SuperfluidAssetTypeSDKType, SuperfluidAsset, SuperfluidAssetSDKType, OsmoEquivalentMultiplierRecord, OsmoEquivalentMultiplierRecordSDKType, SuperfluidDelegationRecord, SuperfluidDelegationRecordSDKType } from "./superfluid"; +import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; +import { SyntheticLock, SyntheticLockSDKType } from "../lockup/lock"; +import { DelegationResponse, DelegationResponseSDKType } from "../../cosmos/staking/v1beta1/staking"; +import { EndpointOrRpc, buildQuery } from "../../helper-func-types"; +import { QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, AssetTypeRequest, AssetTypeRequestSDKType, AssetTypeResponse, AssetTypeResponseSDKType, AllAssetsRequest, AllAssetsRequestSDKType, AllAssetsResponse, AllAssetsResponseSDKType, AssetMultiplierRequest, AssetMultiplierRequestSDKType, AssetMultiplierResponse, AssetMultiplierResponseSDKType, AllIntermediaryAccountsRequest, AllIntermediaryAccountsRequestSDKType, AllIntermediaryAccountsResponse, AllIntermediaryAccountsResponseSDKType, ConnectedIntermediaryAccountRequest, ConnectedIntermediaryAccountRequestSDKType, ConnectedIntermediaryAccountResponse, ConnectedIntermediaryAccountResponseSDKType, QueryTotalDelegationByValidatorForDenomRequest, QueryTotalDelegationByValidatorForDenomRequestSDKType, QueryTotalDelegationByValidatorForDenomResponse, QueryTotalDelegationByValidatorForDenomResponseSDKType, TotalSuperfluidDelegationsRequest, TotalSuperfluidDelegationsRequestSDKType, TotalSuperfluidDelegationsResponse, TotalSuperfluidDelegationsResponseSDKType, SuperfluidDelegationAmountRequest, SuperfluidDelegationAmountRequestSDKType, SuperfluidDelegationAmountResponse, SuperfluidDelegationAmountResponseSDKType, SuperfluidDelegationsByDelegatorRequest, SuperfluidDelegationsByDelegatorRequestSDKType, SuperfluidDelegationsByDelegatorResponse, SuperfluidDelegationsByDelegatorResponseSDKType, SuperfluidUndelegationsByDelegatorRequest, SuperfluidUndelegationsByDelegatorRequestSDKType, SuperfluidUndelegationsByDelegatorResponse, SuperfluidUndelegationsByDelegatorResponseSDKType, SuperfluidDelegationsByValidatorDenomRequest, SuperfluidDelegationsByValidatorDenomRequestSDKType, SuperfluidDelegationsByValidatorDenomResponse, SuperfluidDelegationsByValidatorDenomResponseSDKType, EstimateSuperfluidDelegatedAmountByValidatorDenomRequest, EstimateSuperfluidDelegatedAmountByValidatorDenomRequestSDKType, EstimateSuperfluidDelegatedAmountByValidatorDenomResponse, EstimateSuperfluidDelegatedAmountByValidatorDenomResponseSDKType, QueryTotalDelegationByDelegatorRequest, QueryTotalDelegationByDelegatorRequestSDKType, QueryTotalDelegationByDelegatorResponse, QueryTotalDelegationByDelegatorResponseSDKType, QueryUnpoolWhitelistRequest, QueryUnpoolWhitelistRequestSDKType, QueryUnpoolWhitelistResponse, QueryUnpoolWhitelistResponseSDKType } from "./query"; +/** + * Params returns the total set of superfluid parameters. + * @name getParams + * @package osmosis.superfluid + * @see proto service: osmosis.superfluid.Params + */ +export const getParams = buildQuery({ + encode: QueryParamsRequest.encode, + decode: QueryParamsResponse.decode, + service: "osmosis.superfluid.Query", + method: "Params" +}); +/** + * Returns superfluid asset type, whether if it's a native asset or an lp + * share. + * @name getAssetType + * @package osmosis.superfluid + * @see proto service: osmosis.superfluid.AssetType + */ +export const getAssetType = buildQuery({ + encode: AssetTypeRequest.encode, + decode: AssetTypeResponse.decode, + service: "osmosis.superfluid.Query", + method: "AssetType" +}); +/** + * Returns all registered superfluid assets. + * @name getAllAssets + * @package osmosis.superfluid + * @see proto service: osmosis.superfluid.AllAssets + */ +export const getAllAssets = buildQuery({ + encode: AllAssetsRequest.encode, + decode: AllAssetsResponse.decode, + service: "osmosis.superfluid.Query", + method: "AllAssets" +}); +/** + * Returns the osmo equivalent multiplier used in the most recent epoch. + * @name getAssetMultiplier + * @package osmosis.superfluid + * @see proto service: osmosis.superfluid.AssetMultiplier + */ +export const getAssetMultiplier = buildQuery({ + encode: AssetMultiplierRequest.encode, + decode: AssetMultiplierResponse.decode, + service: "osmosis.superfluid.Query", + method: "AssetMultiplier" +}); +/** + * Returns all superfluid intermediary accounts. + * @name getAllIntermediaryAccounts + * @package osmosis.superfluid + * @see proto service: osmosis.superfluid.AllIntermediaryAccounts + */ +export const getAllIntermediaryAccounts = buildQuery({ + encode: AllIntermediaryAccountsRequest.encode, + decode: AllIntermediaryAccountsResponse.decode, + service: "osmosis.superfluid.Query", + method: "AllIntermediaryAccounts" +}); +/** + * Returns intermediary account connected to a superfluid staked lock by id + * @name getConnectedIntermediaryAccount + * @package osmosis.superfluid + * @see proto service: osmosis.superfluid.ConnectedIntermediaryAccount + */ +export const getConnectedIntermediaryAccount = buildQuery({ + encode: ConnectedIntermediaryAccountRequest.encode, + decode: ConnectedIntermediaryAccountResponse.decode, + service: "osmosis.superfluid.Query", + method: "ConnectedIntermediaryAccount" +}); +/** + * Returns the amount of delegations of specific denom for all validators + * @name getTotalDelegationByValidatorForDenom + * @package osmosis.superfluid + * @see proto service: osmosis.superfluid.TotalDelegationByValidatorForDenom + */ +export const getTotalDelegationByValidatorForDenom = buildQuery({ + encode: QueryTotalDelegationByValidatorForDenomRequest.encode, + decode: QueryTotalDelegationByValidatorForDenomResponse.decode, + service: "osmosis.superfluid.Query", + method: "TotalDelegationByValidatorForDenom" +}); +/** + * Returns the total amount of osmo superfluidly staked. + * Response is denominated in uosmo. + * @name getTotalSuperfluidDelegations + * @package osmosis.superfluid + * @see proto service: osmosis.superfluid.TotalSuperfluidDelegations + */ +export const getTotalSuperfluidDelegations = buildQuery({ + encode: TotalSuperfluidDelegationsRequest.encode, + decode: TotalSuperfluidDelegationsResponse.decode, + service: "osmosis.superfluid.Query", + method: "TotalSuperfluidDelegations" +}); +/** + * Returns the coins superfluid delegated for the delegator, validator, denom + * triplet + * @name getSuperfluidDelegationAmount + * @package osmosis.superfluid + * @see proto service: osmosis.superfluid.SuperfluidDelegationAmount + */ +export const getSuperfluidDelegationAmount = buildQuery({ + encode: SuperfluidDelegationAmountRequest.encode, + decode: SuperfluidDelegationAmountResponse.decode, + service: "osmosis.superfluid.Query", + method: "SuperfluidDelegationAmount" +}); +/** + * Returns all the delegated superfluid poistions for a specific delegator. + * @name getSuperfluidDelegationsByDelegator + * @package osmosis.superfluid + * @see proto service: osmosis.superfluid.SuperfluidDelegationsByDelegator + */ +export const getSuperfluidDelegationsByDelegator = buildQuery({ + encode: SuperfluidDelegationsByDelegatorRequest.encode, + decode: SuperfluidDelegationsByDelegatorResponse.decode, + service: "osmosis.superfluid.Query", + method: "SuperfluidDelegationsByDelegator" +}); +/** + * Returns all the undelegating superfluid poistions for a specific delegator. + * @name getSuperfluidUndelegationsByDelegator + * @package osmosis.superfluid + * @see proto service: osmosis.superfluid.SuperfluidUndelegationsByDelegator + */ +export const getSuperfluidUndelegationsByDelegator = buildQuery({ + encode: SuperfluidUndelegationsByDelegatorRequest.encode, + decode: SuperfluidUndelegationsByDelegatorResponse.decode, + service: "osmosis.superfluid.Query", + method: "SuperfluidUndelegationsByDelegator" +}); +/** + * Returns all the superfluid positions of a specific denom delegated to one + * validator + * @name getSuperfluidDelegationsByValidatorDenom + * @package osmosis.superfluid + * @see proto service: osmosis.superfluid.SuperfluidDelegationsByValidatorDenom + */ +export const getSuperfluidDelegationsByValidatorDenom = buildQuery({ + encode: SuperfluidDelegationsByValidatorDenomRequest.encode, + decode: SuperfluidDelegationsByValidatorDenomResponse.decode, + service: "osmosis.superfluid.Query", + method: "SuperfluidDelegationsByValidatorDenom" +}); +/** + * Returns the amount of a specific denom delegated to a specific validator + * This is labeled an estimate, because the way it calculates the amount can + * lead rounding errors from the true delegated amount + * @name getEstimateSuperfluidDelegatedAmountByValidatorDenom + * @package osmosis.superfluid + * @see proto service: osmosis.superfluid.EstimateSuperfluidDelegatedAmountByValidatorDenom + */ +export const getEstimateSuperfluidDelegatedAmountByValidatorDenom = buildQuery({ + encode: EstimateSuperfluidDelegatedAmountByValidatorDenomRequest.encode, + decode: EstimateSuperfluidDelegatedAmountByValidatorDenomResponse.decode, + service: "osmosis.superfluid.Query", + method: "EstimateSuperfluidDelegatedAmountByValidatorDenom" +}); +/** + * Returns the specified delegations for a specific delegator + * @name getTotalDelegationByDelegator + * @package osmosis.superfluid + * @see proto service: osmosis.superfluid.TotalDelegationByDelegator + */ +export const getTotalDelegationByDelegator = buildQuery({ + encode: QueryTotalDelegationByDelegatorRequest.encode, + decode: QueryTotalDelegationByDelegatorResponse.decode, + service: "osmosis.superfluid.Query", + method: "TotalDelegationByDelegator" +}); +/** + * Returns a list of whitelisted pool ids to unpool. + * @name getUnpoolWhitelist + * @package osmosis.superfluid + * @see proto service: osmosis.superfluid.UnpoolWhitelist + */ +export const getUnpoolWhitelist = buildQuery({ + encode: QueryUnpoolWhitelistRequest.encode, + decode: QueryUnpoolWhitelistResponse.decode, + service: "osmosis.superfluid.Query", + method: "UnpoolWhitelist" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputinstantrpc/osmosis/superfluid/superfluid.ts b/__fixtures__/v-next/outputinstantrpc/osmosis/superfluid/superfluid.ts index 2b6a247390..081858dccf 100644 --- a/__fixtures__/v-next/outputinstantrpc/osmosis/superfluid/superfluid.ts +++ b/__fixtures__/v-next/outputinstantrpc/osmosis/superfluid/superfluid.ts @@ -2,7 +2,7 @@ import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../binary"; import { isSet, DeepPartial } from "../../helpers"; import { JsonSafe } from "../../json-safe"; -import { Decimal } from "@cosmjs/math"; +import { Decimal } from "@interchainjs/math"; export const protobufPackage = "osmosis.superfluid"; /** * SuperfluidAssetType indicates whether the superfluid asset is @@ -594,7 +594,7 @@ export const OsmoEquivalentMultiplierRecord = { const obj: any = {}; obj.epoch_number = message.epochNumber !== BigInt(0) ? message.epochNumber?.toString() : undefined; obj.denom = message.denom === "" ? undefined : message.denom; - obj.multiplier = message.multiplier === "" ? undefined : message.multiplier; + obj.multiplier = message.multiplier === "" ? undefined : Decimal.fromUserInput(message.multiplier, 18).atomics; return obj; }, fromAminoMsg(object: OsmoEquivalentMultiplierRecordAminoMsg): OsmoEquivalentMultiplierRecord { diff --git a/__fixtures__/v-next/outputinstantrpc/osmosis/superfluid/tx.registry.ts b/__fixtures__/v-next/outputinstantrpc/osmosis/superfluid/tx.registry.ts index 84fb34a557..c4015fa902 100644 --- a/__fixtures__/v-next/outputinstantrpc/osmosis/superfluid/tx.registry.ts +++ b/__fixtures__/v-next/outputinstantrpc/osmosis/superfluid/tx.registry.ts @@ -1,13 +1,7 @@ import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; import { TelescopeGeneratedType } from "../../types"; -import { Registry } from "@cosmjs/proto-signing"; import { MsgSuperfluidDelegate, MsgSuperfluidDelegateSDKType, MsgSuperfluidUndelegate, MsgSuperfluidUndelegateSDKType, MsgSuperfluidUnbondLock, MsgSuperfluidUnbondLockSDKType, MsgLockAndSuperfluidDelegate, MsgLockAndSuperfluidDelegateSDKType, MsgUnPoolWhitelistedPool, MsgUnPoolWhitelistedPoolSDKType } from "./tx"; export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/osmosis.superfluid.MsgSuperfluidDelegate", MsgSuperfluidDelegate], ["/osmosis.superfluid.MsgSuperfluidUndelegate", MsgSuperfluidUndelegate], ["/osmosis.superfluid.MsgSuperfluidUnbondLock", MsgSuperfluidUnbondLock], ["/osmosis.superfluid.MsgLockAndSuperfluidDelegate", MsgLockAndSuperfluidDelegate], ["/osmosis.superfluid.MsgUnPoolWhitelistedPool", MsgUnPoolWhitelistedPool]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; export const MessageComposer = { encoded: { superfluidDelegate(value: MsgSuperfluidDelegate) { diff --git a/__fixtures__/v-next/outputinstantrpc/osmosis/superfluid/tx.rpc.func.ts b/__fixtures__/v-next/outputinstantrpc/osmosis/superfluid/tx.rpc.func.ts new file mode 100644 index 0000000000..85a48aab1b --- /dev/null +++ b/__fixtures__/v-next/outputinstantrpc/osmosis/superfluid/tx.rpc.func.ts @@ -0,0 +1,48 @@ +import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; +import { buildTx } from "../../helper-func-types"; +import { MsgSuperfluidDelegate, MsgSuperfluidDelegateSDKType, MsgSuperfluidDelegateResponse, MsgSuperfluidDelegateResponseSDKType, MsgSuperfluidUndelegate, MsgSuperfluidUndelegateSDKType, MsgSuperfluidUndelegateResponse, MsgSuperfluidUndelegateResponseSDKType, MsgSuperfluidUnbondLock, MsgSuperfluidUnbondLockSDKType, MsgSuperfluidUnbondLockResponse, MsgSuperfluidUnbondLockResponseSDKType, MsgLockAndSuperfluidDelegate, MsgLockAndSuperfluidDelegateSDKType, MsgLockAndSuperfluidDelegateResponse, MsgLockAndSuperfluidDelegateResponseSDKType, MsgUnPoolWhitelistedPool, MsgUnPoolWhitelistedPoolSDKType, MsgUnPoolWhitelistedPoolResponse, MsgUnPoolWhitelistedPoolResponseSDKType } from "./tx"; +/** + * Execute superfluid delegation for a lockup + * @name superfluidDelegate + * @package osmosis.superfluid + * @see proto service: osmosis.superfluid.SuperfluidDelegate + */ +export const superfluidDelegate = buildTx({ + msg: MsgSuperfluidDelegate +}); +/** + * Execute superfluid undelegation for a lockup + * @name superfluidUndelegate + * @package osmosis.superfluid + * @see proto service: osmosis.superfluid.SuperfluidUndelegate + */ +export const superfluidUndelegate = buildTx({ + msg: MsgSuperfluidUndelegate +}); +/** + * For a given lock that is being superfluidly undelegated, + * also unbond the underlying lock. + * @name superfluidUnbondLock + * @package osmosis.superfluid + * @see proto service: osmosis.superfluid.SuperfluidUnbondLock + */ +export const superfluidUnbondLock = buildTx({ + msg: MsgSuperfluidUnbondLock +}); +/** + * Execute lockup lock and superfluid delegation in a single msg + * @name lockAndSuperfluidDelegate + * @package osmosis.superfluid + * @see proto service: osmosis.superfluid.LockAndSuperfluidDelegate + */ +export const lockAndSuperfluidDelegate = buildTx({ + msg: MsgLockAndSuperfluidDelegate +}); +/** + * @name unPoolWhitelistedPool + * @package osmosis.superfluid + * @see proto service: osmosis.superfluid.UnPoolWhitelistedPool + */ +export const unPoolWhitelistedPool = buildTx({ + msg: MsgUnPoolWhitelistedPool +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputinstantrpc/osmosis/superfluid/tx.rpc.msg.ts b/__fixtures__/v-next/outputinstantrpc/osmosis/superfluid/tx.rpc.msg.ts index 6fe92949cd..0eb5cd63fa 100644 --- a/__fixtures__/v-next/outputinstantrpc/osmosis/superfluid/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputinstantrpc/osmosis/superfluid/tx.rpc.msg.ts @@ -1,5 +1,6 @@ import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; -import { DeliverTxResponse, StdFee, TxRpc } from "../../types"; +import { DeliverTxResponse } from "@interchainjs/types"; +import { StdFee, TxRpc } from "../../types"; import { BinaryReader } from "../../binary"; import { MsgSuperfluidDelegate, MsgSuperfluidDelegateSDKType, MsgSuperfluidDelegateResponse, MsgSuperfluidDelegateResponseSDKType, MsgSuperfluidUndelegate, MsgSuperfluidUndelegateSDKType, MsgSuperfluidUndelegateResponse, MsgSuperfluidUndelegateResponseSDKType, MsgSuperfluidUnbondLock, MsgSuperfluidUnbondLockSDKType, MsgSuperfluidUnbondLockResponse, MsgSuperfluidUnbondLockResponseSDKType, MsgLockAndSuperfluidDelegate, MsgLockAndSuperfluidDelegateSDKType, MsgLockAndSuperfluidDelegateResponse, MsgLockAndSuperfluidDelegateResponseSDKType, MsgUnPoolWhitelistedPool, MsgUnPoolWhitelistedPoolSDKType, MsgUnPoolWhitelistedPoolResponse, MsgUnPoolWhitelistedPoolResponseSDKType } from "./tx"; /** Msg defines the Msg service. */ diff --git a/__fixtures__/v-next/outputinstantrpc/osmosis/tokenfactory/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputinstantrpc/osmosis/tokenfactory/v1beta1/query.rpc.func.ts new file mode 100644 index 0000000000..d816826644 --- /dev/null +++ b/__fixtures__/v-next/outputinstantrpc/osmosis/tokenfactory/v1beta1/query.rpc.func.ts @@ -0,0 +1,43 @@ +import { Params, ParamsSDKType } from "./params"; +import { DenomAuthorityMetadata, DenomAuthorityMetadataSDKType } from "./authorityMetadata"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, QueryDenomAuthorityMetadataRequest, QueryDenomAuthorityMetadataRequestSDKType, QueryDenomAuthorityMetadataResponse, QueryDenomAuthorityMetadataResponseSDKType, QueryDenomsFromCreatorRequest, QueryDenomsFromCreatorRequestSDKType, QueryDenomsFromCreatorResponse, QueryDenomsFromCreatorResponseSDKType } from "./query"; +/** + * Params defines a gRPC query method that returns the tokenfactory module's + * parameters. + * @name getParams + * @package osmosis.tokenfactory.v1beta1 + * @see proto service: osmosis.tokenfactory.v1beta1.Params + */ +export const getParams = buildQuery({ + encode: QueryParamsRequest.encode, + decode: QueryParamsResponse.decode, + service: "osmosis.tokenfactory.v1beta1.Query", + method: "Params" +}); +/** + * DenomAuthorityMetadata defines a gRPC query method for fetching + * DenomAuthorityMetadata for a particular denom. + * @name getDenomAuthorityMetadata + * @package osmosis.tokenfactory.v1beta1 + * @see proto service: osmosis.tokenfactory.v1beta1.DenomAuthorityMetadata + */ +export const getDenomAuthorityMetadata = buildQuery({ + encode: QueryDenomAuthorityMetadataRequest.encode, + decode: QueryDenomAuthorityMetadataResponse.decode, + service: "osmosis.tokenfactory.v1beta1.Query", + method: "DenomAuthorityMetadata" +}); +/** + * DenomsFromCreator defines a gRPC query method for fetching all + * denominations created by a specific admin/creator. + * @name getDenomsFromCreator + * @package osmosis.tokenfactory.v1beta1 + * @see proto service: osmosis.tokenfactory.v1beta1.DenomsFromCreator + */ +export const getDenomsFromCreator = buildQuery({ + encode: QueryDenomsFromCreatorRequest.encode, + decode: QueryDenomsFromCreatorResponse.decode, + service: "osmosis.tokenfactory.v1beta1.Query", + method: "DenomsFromCreator" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputinstantrpc/osmosis/tokenfactory/v1beta1/tx.registry.ts b/__fixtures__/v-next/outputinstantrpc/osmosis/tokenfactory/v1beta1/tx.registry.ts index 05d351e3c4..15491bcdc3 100644 --- a/__fixtures__/v-next/outputinstantrpc/osmosis/tokenfactory/v1beta1/tx.registry.ts +++ b/__fixtures__/v-next/outputinstantrpc/osmosis/tokenfactory/v1beta1/tx.registry.ts @@ -1,14 +1,8 @@ import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { Metadata, MetadataSDKType } from "../../../cosmos/bank/v1beta1/bank"; import { TelescopeGeneratedType } from "../../../types"; -import { Registry } from "@cosmjs/proto-signing"; import { MsgCreateDenom, MsgCreateDenomSDKType, MsgMint, MsgMintSDKType, MsgBurn, MsgBurnSDKType, MsgChangeAdmin, MsgChangeAdminSDKType, MsgSetDenomMetadata, MsgSetDenomMetadataSDKType } from "./tx"; export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/osmosis.tokenfactory.v1beta1.MsgCreateDenom", MsgCreateDenom], ["/osmosis.tokenfactory.v1beta1.MsgMint", MsgMint], ["/osmosis.tokenfactory.v1beta1.MsgBurn", MsgBurn], ["/osmosis.tokenfactory.v1beta1.MsgChangeAdmin", MsgChangeAdmin], ["/osmosis.tokenfactory.v1beta1.MsgSetDenomMetadata", MsgSetDenomMetadata]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; export const MessageComposer = { encoded: { createDenom(value: MsgCreateDenom) { diff --git a/__fixtures__/v-next/outputinstantrpc/osmosis/tokenfactory/v1beta1/tx.rpc.func.ts b/__fixtures__/v-next/outputinstantrpc/osmosis/tokenfactory/v1beta1/tx.rpc.func.ts new file mode 100644 index 0000000000..4f68bf3691 --- /dev/null +++ b/__fixtures__/v-next/outputinstantrpc/osmosis/tokenfactory/v1beta1/tx.rpc.func.ts @@ -0,0 +1,44 @@ +import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; +import { Metadata, MetadataSDKType } from "../../../cosmos/bank/v1beta1/bank"; +import { buildTx } from "../../../helper-func-types"; +import { MsgCreateDenom, MsgCreateDenomSDKType, MsgCreateDenomResponse, MsgCreateDenomResponseSDKType, MsgMint, MsgMintSDKType, MsgMintResponse, MsgMintResponseSDKType, MsgBurn, MsgBurnSDKType, MsgBurnResponse, MsgBurnResponseSDKType, MsgChangeAdmin, MsgChangeAdminSDKType, MsgChangeAdminResponse, MsgChangeAdminResponseSDKType, MsgSetDenomMetadata, MsgSetDenomMetadataSDKType, MsgSetDenomMetadataResponse, MsgSetDenomMetadataResponseSDKType } from "./tx"; +/** + * @name createDenom + * @package osmosis.tokenfactory.v1beta1 + * @see proto service: osmosis.tokenfactory.v1beta1.CreateDenom + */ +export const createDenom = buildTx({ + msg: MsgCreateDenom +}); +/** + * @name mint + * @package osmosis.tokenfactory.v1beta1 + * @see proto service: osmosis.tokenfactory.v1beta1.Mint + */ +export const mint = buildTx({ + msg: MsgMint +}); +/** + * @name burn + * @package osmosis.tokenfactory.v1beta1 + * @see proto service: osmosis.tokenfactory.v1beta1.Burn + */ +export const burn = buildTx({ + msg: MsgBurn +}); +/** + * @name changeAdmin + * @package osmosis.tokenfactory.v1beta1 + * @see proto service: osmosis.tokenfactory.v1beta1.ChangeAdmin + */ +export const changeAdmin = buildTx({ + msg: MsgChangeAdmin +}); +/** + * @name setDenomMetadata + * @package osmosis.tokenfactory.v1beta1 + * @see proto service: osmosis.tokenfactory.v1beta1.SetDenomMetadata + */ +export const setDenomMetadata = buildTx({ + msg: MsgSetDenomMetadata +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputinstantrpc/osmosis/tokenfactory/v1beta1/tx.rpc.msg.ts b/__fixtures__/v-next/outputinstantrpc/osmosis/tokenfactory/v1beta1/tx.rpc.msg.ts index 700a3fbc45..7a0042297c 100644 --- a/__fixtures__/v-next/outputinstantrpc/osmosis/tokenfactory/v1beta1/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputinstantrpc/osmosis/tokenfactory/v1beta1/tx.rpc.msg.ts @@ -1,6 +1,7 @@ import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { Metadata, MetadataSDKType } from "../../../cosmos/bank/v1beta1/bank"; -import { DeliverTxResponse, StdFee, TxRpc } from "../../../types"; +import { DeliverTxResponse } from "@interchainjs/types"; +import { StdFee, TxRpc } from "../../../types"; import { BinaryReader } from "../../../binary"; import { MsgCreateDenom, MsgCreateDenomSDKType, MsgCreateDenomResponse, MsgCreateDenomResponseSDKType, MsgMint, MsgMintSDKType, MsgMintResponse, MsgMintResponseSDKType, MsgBurn, MsgBurnSDKType, MsgBurnResponse, MsgBurnResponseSDKType, MsgChangeAdmin, MsgChangeAdminSDKType, MsgChangeAdminResponse, MsgChangeAdminResponseSDKType, MsgSetDenomMetadata, MsgSetDenomMetadataSDKType, MsgSetDenomMetadataResponse, MsgSetDenomMetadataResponseSDKType } from "./tx"; /** Msg defines the tokefactory module's gRPC message service. */ diff --git a/__fixtures__/v-next/outputinstantrpc/osmosis/twap/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputinstantrpc/osmosis/twap/v1beta1/query.rpc.func.ts new file mode 100644 index 0000000000..e076baed66 --- /dev/null +++ b/__fixtures__/v-next/outputinstantrpc/osmosis/twap/v1beta1/query.rpc.func.ts @@ -0,0 +1,38 @@ +import { Timestamp, TimestampSDKType } from "../../../google/protobuf/timestamp"; +import { Params, ParamsSDKType } from "./genesis"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { ParamsRequest, ParamsRequestSDKType, ParamsResponse, ParamsResponseSDKType, ArithmeticTwapRequest, ArithmeticTwapRequestSDKType, ArithmeticTwapResponse, ArithmeticTwapResponseSDKType, ArithmeticTwapToNowRequest, ArithmeticTwapToNowRequestSDKType, ArithmeticTwapToNowResponse, ArithmeticTwapToNowResponseSDKType } from "./query"; +/** + * @name getParams + * @package osmosis.twap.v1beta1 + * @see proto service: osmosis.twap.v1beta1.Params + */ +export const getParams = buildQuery({ + encode: ParamsRequest.encode, + decode: ParamsResponse.decode, + service: "osmosis.twap.v1beta1.Query", + method: "Params" +}); +/** + * @name getArithmeticTwap + * @package osmosis.twap.v1beta1 + * @see proto service: osmosis.twap.v1beta1.ArithmeticTwap + */ +export const getArithmeticTwap = buildQuery({ + encode: ArithmeticTwapRequest.encode, + decode: ArithmeticTwapResponse.decode, + service: "osmosis.twap.v1beta1.Query", + method: "ArithmeticTwap" +}); +/** + * @name getArithmeticTwapToNow + * @package osmosis.twap.v1beta1 + * @see proto service: osmosis.twap.v1beta1.ArithmeticTwapToNow + * @deprecated + */ +export const getArithmeticTwapToNow = buildQuery({ + encode: ArithmeticTwapToNowRequest.encode, + decode: ArithmeticTwapToNowResponse.decode, + service: "osmosis.twap.v1beta1.Query", + method: "ArithmeticTwapToNow" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputinstantrpc/osmosis/twap/v1beta1/query.ts b/__fixtures__/v-next/outputinstantrpc/osmosis/twap/v1beta1/query.ts index 83634d0dd8..09fdab027b 100644 --- a/__fixtures__/v-next/outputinstantrpc/osmosis/twap/v1beta1/query.ts +++ b/__fixtures__/v-next/outputinstantrpc/osmosis/twap/v1beta1/query.ts @@ -3,7 +3,7 @@ import { Params, ParamsSDKType } from "./genesis"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { toTimestamp, fromTimestamp, isSet, DeepPartial } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; -import { Decimal } from "@cosmjs/math"; +import { Decimal } from "@interchainjs/math"; export const protobufPackage = "osmosis.twap.v1beta1"; /** * @name ArithmeticTwapRequest @@ -378,7 +378,7 @@ export const ArithmeticTwapResponse = { }, toAmino(message: ArithmeticTwapResponse): ArithmeticTwapResponseAmino { const obj: any = {}; - obj.arithmetic_twap = message.arithmeticTwap === "" ? undefined : message.arithmeticTwap; + obj.arithmetic_twap = message.arithmeticTwap === "" ? undefined : Decimal.fromUserInput(message.arithmeticTwap, 18).atomics; return obj; }, fromAminoMsg(object: ArithmeticTwapResponseAminoMsg): ArithmeticTwapResponse { @@ -629,7 +629,7 @@ export const ArithmeticTwapToNowResponse = { }, toAmino(message: ArithmeticTwapToNowResponse): ArithmeticTwapToNowResponseAmino { const obj: any = {}; - obj.arithmetic_twap = message.arithmeticTwap === "" ? undefined : message.arithmeticTwap; + obj.arithmetic_twap = message.arithmeticTwap === "" ? undefined : Decimal.fromUserInput(message.arithmeticTwap, 18).atomics; return obj; }, fromAminoMsg(object: ArithmeticTwapToNowResponseAminoMsg): ArithmeticTwapToNowResponse { diff --git a/__fixtures__/v-next/outputinstantrpc/osmosis/twap/v1beta1/twap_record.ts b/__fixtures__/v-next/outputinstantrpc/osmosis/twap/v1beta1/twap_record.ts index 0189d8da4e..8587ef04a8 100644 --- a/__fixtures__/v-next/outputinstantrpc/osmosis/twap/v1beta1/twap_record.ts +++ b/__fixtures__/v-next/outputinstantrpc/osmosis/twap/v1beta1/twap_record.ts @@ -1,7 +1,7 @@ import { Timestamp, TimestampSDKType } from "../../../google/protobuf/timestamp"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { toTimestamp, fromTimestamp, isSet, DeepPartial } from "../../../helpers"; -import { Decimal } from "@cosmjs/math"; +import { Decimal } from "@interchainjs/math"; import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "osmosis.twap.v1beta1"; /** @@ -312,10 +312,10 @@ export const TwapRecord = { obj.asset1_denom = message.asset1Denom === "" ? undefined : message.asset1Denom; obj.height = message.height ? message.height?.toString() : "0"; obj.time = message.time ? Timestamp.toAmino(toTimestamp(message.time)) : undefined; - obj.p0_last_spot_price = message.p0LastSpotPrice === "" ? undefined : message.p0LastSpotPrice; - obj.p1_last_spot_price = message.p1LastSpotPrice === "" ? undefined : message.p1LastSpotPrice; - obj.p0_arithmetic_twap_accumulator = message.p0ArithmeticTwapAccumulator === "" ? undefined : message.p0ArithmeticTwapAccumulator; - obj.p1_arithmetic_twap_accumulator = message.p1ArithmeticTwapAccumulator === "" ? undefined : message.p1ArithmeticTwapAccumulator; + obj.p0_last_spot_price = message.p0LastSpotPrice === "" ? undefined : Decimal.fromUserInput(message.p0LastSpotPrice, 18).atomics; + obj.p1_last_spot_price = message.p1LastSpotPrice === "" ? undefined : Decimal.fromUserInput(message.p1LastSpotPrice, 18).atomics; + obj.p0_arithmetic_twap_accumulator = message.p0ArithmeticTwapAccumulator === "" ? undefined : Decimal.fromUserInput(message.p0ArithmeticTwapAccumulator, 18).atomics; + obj.p1_arithmetic_twap_accumulator = message.p1ArithmeticTwapAccumulator === "" ? undefined : Decimal.fromUserInput(message.p1ArithmeticTwapAccumulator, 18).atomics; obj.last_error_time = message.lastErrorTime ? Timestamp.toAmino(toTimestamp(message.lastErrorTime)) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/osmosis/txfees/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputinstantrpc/osmosis/txfees/v1beta1/query.rpc.func.ts new file mode 100644 index 0000000000..a461827fa5 --- /dev/null +++ b/__fixtures__/v-next/outputinstantrpc/osmosis/txfees/v1beta1/query.rpc.func.ts @@ -0,0 +1,53 @@ +import { FeeToken, FeeTokenSDKType } from "./feetoken"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { QueryFeeTokensRequest, QueryFeeTokensRequestSDKType, QueryFeeTokensResponse, QueryFeeTokensResponseSDKType, QueryDenomSpotPriceRequest, QueryDenomSpotPriceRequestSDKType, QueryDenomSpotPriceResponse, QueryDenomSpotPriceResponseSDKType, QueryDenomPoolIdRequest, QueryDenomPoolIdRequestSDKType, QueryDenomPoolIdResponse, QueryDenomPoolIdResponseSDKType, QueryBaseDenomRequest, QueryBaseDenomRequestSDKType, QueryBaseDenomResponse, QueryBaseDenomResponseSDKType } from "./query"; +/** + * FeeTokens returns a list of all the whitelisted fee tokens and their + * corresponding pools. It does not include the BaseDenom, which has its own + * query endpoint + * @name getFeeTokens + * @package osmosis.txfees.v1beta1 + * @see proto service: osmosis.txfees.v1beta1.FeeTokens + */ +export const getFeeTokens = buildQuery({ + encode: QueryFeeTokensRequest.encode, + decode: QueryFeeTokensResponse.decode, + service: "osmosis.txfees.v1beta1.Query", + method: "FeeTokens" +}); +/** + * DenomSpotPrice returns all spot prices by each registered token denom. + * @name getDenomSpotPrice + * @package osmosis.txfees.v1beta1 + * @see proto service: osmosis.txfees.v1beta1.DenomSpotPrice + */ +export const getDenomSpotPrice = buildQuery({ + encode: QueryDenomSpotPriceRequest.encode, + decode: QueryDenomSpotPriceResponse.decode, + service: "osmosis.txfees.v1beta1.Query", + method: "DenomSpotPrice" +}); +/** + * Returns the poolID for a specified denom input. + * @name getDenomPoolId + * @package osmosis.txfees.v1beta1 + * @see proto service: osmosis.txfees.v1beta1.DenomPoolId + */ +export const getDenomPoolId = buildQuery({ + encode: QueryDenomPoolIdRequest.encode, + decode: QueryDenomPoolIdResponse.decode, + service: "osmosis.txfees.v1beta1.Query", + method: "DenomPoolId" +}); +/** + * Returns a list of all base denom tokens and their corresponding pools. + * @name getBaseDenom + * @package osmosis.txfees.v1beta1 + * @see proto service: osmosis.txfees.v1beta1.BaseDenom + */ +export const getBaseDenom = buildQuery({ + encode: QueryBaseDenomRequest.encode, + decode: QueryBaseDenomResponse.decode, + service: "osmosis.txfees.v1beta1.Query", + method: "BaseDenom" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputinstantrpc/osmosis/txfees/v1beta1/query.ts b/__fixtures__/v-next/outputinstantrpc/osmosis/txfees/v1beta1/query.ts index 7268483bb4..dc8a029a7a 100644 --- a/__fixtures__/v-next/outputinstantrpc/osmosis/txfees/v1beta1/query.ts +++ b/__fixtures__/v-next/outputinstantrpc/osmosis/txfees/v1beta1/query.ts @@ -2,7 +2,7 @@ import { FeeToken, FeeTokenSDKType } from "./feetoken"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { JsonSafe } from "../../../json-safe"; import { DeepPartial, isSet } from "../../../helpers"; -import { Decimal } from "@cosmjs/math"; +import { Decimal } from "@interchainjs/math"; export const protobufPackage = "osmosis.txfees.v1beta1"; /** * @name QueryFeeTokensRequest @@ -550,7 +550,7 @@ export const QueryDenomSpotPriceResponse = { toAmino(message: QueryDenomSpotPriceResponse): QueryDenomSpotPriceResponseAmino { const obj: any = {}; obj.poolID = message.poolID !== BigInt(0) ? message.poolID?.toString() : undefined; - obj.spot_price = message.spotPrice === "" ? undefined : message.spotPrice; + obj.spot_price = message.spotPrice === "" ? undefined : Decimal.fromUserInput(message.spotPrice, 18).atomics; return obj; }, fromAminoMsg(object: QueryDenomSpotPriceResponseAminoMsg): QueryDenomSpotPriceResponse { diff --git a/__fixtures__/v-next/outputinstantrpc/tendermint/abci/types.rpc.func.ts b/__fixtures__/v-next/outputinstantrpc/tendermint/abci/types.rpc.func.ts new file mode 100644 index 0000000000..dee086cb02 --- /dev/null +++ b/__fixtures__/v-next/outputinstantrpc/tendermint/abci/types.rpc.func.ts @@ -0,0 +1,172 @@ +import { Timestamp, TimestampSDKType } from "../../google/protobuf/timestamp"; +import { Header, HeaderSDKType } from "../types/types"; +import { ProofOps, ProofOpsSDKType } from "../crypto/proof"; +import { EvidenceParams, EvidenceParamsSDKType, ValidatorParams, ValidatorParamsSDKType, VersionParams, VersionParamsSDKType } from "../types/params"; +import { PublicKey, PublicKeySDKType } from "../crypto/keys"; +import { EndpointOrRpc, buildQuery } from "../../helper-func-types"; +import { RequestEcho, RequestEchoSDKType, ResponseEcho, ResponseEchoSDKType, RequestFlush, RequestFlushSDKType, ResponseFlush, ResponseFlushSDKType, RequestInfo, RequestInfoSDKType, ResponseInfo, ResponseInfoSDKType, RequestSetOption, RequestSetOptionSDKType, ResponseSetOption, ResponseSetOptionSDKType, RequestDeliverTx, RequestDeliverTxSDKType, ResponseDeliverTx, ResponseDeliverTxSDKType, RequestCheckTx, RequestCheckTxSDKType, ResponseCheckTx, ResponseCheckTxSDKType, RequestQuery, RequestQuerySDKType, ResponseQuery, ResponseQuerySDKType, RequestCommit, RequestCommitSDKType, ResponseCommit, ResponseCommitSDKType, RequestInitChain, RequestInitChainSDKType, ResponseInitChain, ResponseInitChainSDKType, RequestBeginBlock, RequestBeginBlockSDKType, ResponseBeginBlock, ResponseBeginBlockSDKType, RequestEndBlock, RequestEndBlockSDKType, ResponseEndBlock, ResponseEndBlockSDKType, RequestListSnapshots, RequestListSnapshotsSDKType, ResponseListSnapshots, ResponseListSnapshotsSDKType, RequestOfferSnapshot, RequestOfferSnapshotSDKType, ResponseOfferSnapshot, ResponseOfferSnapshotSDKType, RequestLoadSnapshotChunk, RequestLoadSnapshotChunkSDKType, ResponseLoadSnapshotChunk, ResponseLoadSnapshotChunkSDKType, RequestApplySnapshotChunk, RequestApplySnapshotChunkSDKType, ResponseApplySnapshotChunk, ResponseApplySnapshotChunkSDKType } from "./types"; +/** + * @name getEcho + * @package tendermint.abci + * @see proto service: tendermint.abci.Echo + */ +export const getEcho = buildQuery({ + encode: RequestEcho.encode, + decode: ResponseEcho.decode, + service: "tendermint.abci.ABCIApplication", + method: "Echo" +}); +/** + * @name getFlush + * @package tendermint.abci + * @see proto service: tendermint.abci.Flush + */ +export const getFlush = buildQuery({ + encode: RequestFlush.encode, + decode: ResponseFlush.decode, + service: "tendermint.abci.ABCIApplication", + method: "Flush" +}); +/** + * @name getInfo + * @package tendermint.abci + * @see proto service: tendermint.abci.Info + */ +export const getInfo = buildQuery({ + encode: RequestInfo.encode, + decode: ResponseInfo.decode, + service: "tendermint.abci.ABCIApplication", + method: "Info" +}); +/** + * @name getSetOption + * @package tendermint.abci + * @see proto service: tendermint.abci.SetOption + */ +export const getSetOption = buildQuery({ + encode: RequestSetOption.encode, + decode: ResponseSetOption.decode, + service: "tendermint.abci.ABCIApplication", + method: "SetOption" +}); +/** + * @name getDeliverTx + * @package tendermint.abci + * @see proto service: tendermint.abci.DeliverTx + */ +export const getDeliverTx = buildQuery({ + encode: RequestDeliverTx.encode, + decode: ResponseDeliverTx.decode, + service: "tendermint.abci.ABCIApplication", + method: "DeliverTx" +}); +/** + * @name getCheckTx + * @package tendermint.abci + * @see proto service: tendermint.abci.CheckTx + */ +export const getCheckTx = buildQuery({ + encode: RequestCheckTx.encode, + decode: ResponseCheckTx.decode, + service: "tendermint.abci.ABCIApplication", + method: "CheckTx" +}); +/** + * @name getQuery + * @package tendermint.abci + * @see proto service: tendermint.abci.Query + */ +export const getQuery = buildQuery({ + encode: RequestQuery.encode, + decode: ResponseQuery.decode, + service: "tendermint.abci.ABCIApplication", + method: "Query" +}); +/** + * @name getCommit + * @package tendermint.abci + * @see proto service: tendermint.abci.Commit + */ +export const getCommit = buildQuery({ + encode: RequestCommit.encode, + decode: ResponseCommit.decode, + service: "tendermint.abci.ABCIApplication", + method: "Commit" +}); +/** + * @name getInitChain + * @package tendermint.abci + * @see proto service: tendermint.abci.InitChain + */ +export const getInitChain = buildQuery({ + encode: RequestInitChain.encode, + decode: ResponseInitChain.decode, + service: "tendermint.abci.ABCIApplication", + method: "InitChain" +}); +/** + * @name getBeginBlock + * @package tendermint.abci + * @see proto service: tendermint.abci.BeginBlock + */ +export const getBeginBlock = buildQuery({ + encode: RequestBeginBlock.encode, + decode: ResponseBeginBlock.decode, + service: "tendermint.abci.ABCIApplication", + method: "BeginBlock" +}); +/** + * @name getEndBlock + * @package tendermint.abci + * @see proto service: tendermint.abci.EndBlock + */ +export const getEndBlock = buildQuery({ + encode: RequestEndBlock.encode, + decode: ResponseEndBlock.decode, + service: "tendermint.abci.ABCIApplication", + method: "EndBlock" +}); +/** + * @name getListSnapshots + * @package tendermint.abci + * @see proto service: tendermint.abci.ListSnapshots + */ +export const getListSnapshots = buildQuery({ + encode: RequestListSnapshots.encode, + decode: ResponseListSnapshots.decode, + service: "tendermint.abci.ABCIApplication", + method: "ListSnapshots" +}); +/** + * @name getOfferSnapshot + * @package tendermint.abci + * @see proto service: tendermint.abci.OfferSnapshot + */ +export const getOfferSnapshot = buildQuery({ + encode: RequestOfferSnapshot.encode, + decode: ResponseOfferSnapshot.decode, + service: "tendermint.abci.ABCIApplication", + method: "OfferSnapshot" +}); +/** + * @name getLoadSnapshotChunk + * @package tendermint.abci + * @see proto service: tendermint.abci.LoadSnapshotChunk + */ +export const getLoadSnapshotChunk = buildQuery({ + encode: RequestLoadSnapshotChunk.encode, + decode: ResponseLoadSnapshotChunk.decode, + service: "tendermint.abci.ABCIApplication", + method: "LoadSnapshotChunk" +}); +/** + * @name getApplySnapshotChunk + * @package tendermint.abci + * @see proto service: tendermint.abci.ApplySnapshotChunk + */ +export const getApplySnapshotChunk = buildQuery({ + encode: RequestApplySnapshotChunk.encode, + decode: ResponseApplySnapshotChunk.decode, + service: "tendermint.abci.ABCIApplication", + method: "ApplySnapshotChunk" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputinstantrpc/tendermint/bundle.ts b/__fixtures__/v-next/outputinstantrpc/tendermint/bundle.ts index 65380eb031..bbc829adb0 100644 --- a/__fixtures__/v-next/outputinstantrpc/tendermint/bundle.ts +++ b/__fixtures__/v-next/outputinstantrpc/tendermint/bundle.ts @@ -9,13 +9,15 @@ import * as _312 from "./types/params"; import * as _313 from "./types/types"; import * as _314 from "./types/validator"; import * as _315 from "./version/types"; -import * as _535 from "./abci/types.rpc.ABCIApplication"; -import * as _560 from "./lcd"; -import * as _561 from "./rpc.query"; +import * as _627 from "./abci/types.rpc.func"; +import * as _628 from "./abci/types.rpc.ABCIApplication"; +import * as _653 from "./lcd"; +import * as _654 from "./rpc.query"; export namespace tendermint { export const abci = { ..._305, - ..._535 + ..._627, + ..._628 }; export const crypto = { ..._306, @@ -40,7 +42,7 @@ export namespace tendermint { ..._315 }; export const ClientFactory = { - ..._560, - ..._561 + ..._653, + ..._654 }; } \ No newline at end of file diff --git a/__fixtures__/v-next/outputinstantrpc/types.ts b/__fixtures__/v-next/outputinstantrpc/types.ts index b2016c1a9d..1acee677e2 100644 --- a/__fixtures__/v-next/outputinstantrpc/types.ts +++ b/__fixtures__/v-next/outputinstantrpc/types.ts @@ -6,8 +6,14 @@ import { IBinaryReader, IBinaryWriter } from "./binary"; import { Any } from "./google/protobuf/any"; -import { OfflineSigner } from "@cosmjs/proto-signing"; -import { HttpEndpoint } from "@cosmjs/tendermint-rpc"; + +import { HttpEndpoint } from "@interchainjs/types"; + + +import { DeliverTxResponse, Event, Attribute } from "@interchainjs/types"; + +export { DeliverTxResponse } + export type ProtoMsg = Omit & { typeUrl: any }; @@ -87,56 +93,6 @@ export interface StdFee { } -export interface MsgData { - msgType: string; - data: Uint8Array; -} -export interface Attribute { - key: string; - value: string; - index?: boolean; -} -export interface Event { - type: string; - attributes: readonly Attribute[]; -} - -/** - * The response after successfully broadcasting a transaction. - * Success or failure refer to the execution result. - */ -export interface DeliverTxResponse { - height: number; - /** The position of the transaction within the block. This is a 0-based index. */ - txIndex: number; - /** Error code. The transaction suceeded if and only if code is 0. */ - code: number; - transactionHash: string; - events: readonly Event[]; - /** - * A string-based log document. - * - * This currently seems to merge attributes of multiple events into one event per type - * (https://github.com/tendermint/tendermint/issues/9595). You might want to use the `events` - * field instead. - */ - rawLog?: string; - /** @deprecated Use `msgResponses` instead. */ - data?: readonly MsgData[]; - /** - * The message responses of the [TxMsgData](https://github.com/cosmos/cosmos-sdk/blob/v0.46.3/proto/cosmos/base/abci/v1beta1/abci.proto#L128-L140) - * as `Any`s. - * This field is an empty list for chains running Cosmos SDK < 0.46. - */ - msgResponses: Array<{ - typeUrl: string; - value: Uint8Array; - }>; - gasUsed: bigint; - gasWanted: bigint; - origin?: any; -} - export interface TxRpc { request( service: string, @@ -151,8 +107,3 @@ export interface TxRpc { ): Promise; } -export interface SigningClientParams { - rpcEndpoint: string | HttpEndpoint; - signer: OfflineSigner; -} - diff --git a/__fixtures__/v-next/outputosmojs/akash/audit/v1beta1/audit.registry.ts b/__fixtures__/v-next/outputosmojs/akash/audit/v1beta1/audit.registry.ts index 4fe7fd3731..102ab96d50 100644 --- a/__fixtures__/v-next/outputosmojs/akash/audit/v1beta1/audit.registry.ts +++ b/__fixtures__/v-next/outputosmojs/akash/audit/v1beta1/audit.registry.ts @@ -1,12 +1,7 @@ import { Attribute, AttributeSDKType } from "../../base/v1beta1/attribute"; -import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { TelescopeGeneratedType } from "../../../types"; import { MsgSignProviderAttributes, MsgSignProviderAttributesSDKType, MsgDeleteProviderAttributes, MsgDeleteProviderAttributesSDKType } from "./audit"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/akash.audit.v1beta1.MsgSignProviderAttributes", MsgSignProviderAttributes], ["/akash.audit.v1beta1.MsgDeleteProviderAttributes", MsgDeleteProviderAttributes]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/akash.audit.v1beta1.MsgSignProviderAttributes", MsgSignProviderAttributes], ["/akash.audit.v1beta1.MsgDeleteProviderAttributes", MsgDeleteProviderAttributes]]; export const MessageComposer = { encoded: { signProviderAttributes(value: MsgSignProviderAttributes) { diff --git a/__fixtures__/v-next/outputosmojs/akash/audit/v1beta1/audit.rpc.func.ts b/__fixtures__/v-next/outputosmojs/akash/audit/v1beta1/audit.rpc.func.ts new file mode 100644 index 0000000000..2c7f66ceab --- /dev/null +++ b/__fixtures__/v-next/outputosmojs/akash/audit/v1beta1/audit.rpc.func.ts @@ -0,0 +1,21 @@ +import { Attribute, AttributeSDKType } from "../../base/v1beta1/attribute"; +import { buildTx } from "../../../helper-func-types"; +import { MsgSignProviderAttributes, MsgSignProviderAttributesSDKType, MsgSignProviderAttributesResponse, MsgSignProviderAttributesResponseSDKType, MsgDeleteProviderAttributes, MsgDeleteProviderAttributesSDKType, MsgDeleteProviderAttributesResponse, MsgDeleteProviderAttributesResponseSDKType } from "./audit"; +/** + * SignProviderAttributes defines a method that signs provider attributes + * @name signProviderAttributes + * @package akash.audit.v1beta1 + * @see proto service: akash.audit.v1beta1.SignProviderAttributes + */ +export const signProviderAttributes = buildTx({ + msg: MsgSignProviderAttributes +}); +/** + * DeleteProviderAttributes defines a method that deletes provider attributes + * @name deleteProviderAttributes + * @package akash.audit.v1beta1 + * @see proto service: akash.audit.v1beta1.DeleteProviderAttributes + */ +export const deleteProviderAttributes = buildTx({ + msg: MsgDeleteProviderAttributes +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputosmojs/akash/audit/v1beta1/audit.rpc.msg.ts b/__fixtures__/v-next/outputosmojs/akash/audit/v1beta1/audit.rpc.msg.ts index 44ae67f105..59143fe27f 100644 --- a/__fixtures__/v-next/outputosmojs/akash/audit/v1beta1/audit.rpc.msg.ts +++ b/__fixtures__/v-next/outputosmojs/akash/audit/v1beta1/audit.rpc.msg.ts @@ -1,5 +1,5 @@ import { Attribute, AttributeSDKType } from "../../base/v1beta1/attribute"; -import { Rpc } from "../../../helpers"; +import { TxRpc } from "../../../types"; import { BinaryReader } from "../../../binary"; import { MsgSignProviderAttributes, MsgSignProviderAttributesSDKType, MsgSignProviderAttributesResponse, MsgSignProviderAttributesResponseSDKType, MsgDeleteProviderAttributes, MsgDeleteProviderAttributesSDKType, MsgDeleteProviderAttributesResponse, MsgDeleteProviderAttributesResponseSDKType } from "./audit"; /** Msg defines the provider Msg service */ @@ -10,8 +10,8 @@ export interface Msg { deleteProviderAttributes(request: MsgDeleteProviderAttributes): Promise; } export class MsgClientImpl implements Msg { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; } /* SignProviderAttributes defines a method that signs provider attributes */ @@ -27,6 +27,6 @@ export class MsgClientImpl implements Msg { return promise.then(data => MsgDeleteProviderAttributesResponse.decode(new BinaryReader(data))); }; } -export const createClientImpl = (rpc: Rpc) => { +export const createClientImpl = (rpc: TxRpc) => { return new MsgClientImpl(rpc); }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputosmojs/akash/audit/v1beta2/audit.registry.ts b/__fixtures__/v-next/outputosmojs/akash/audit/v1beta2/audit.registry.ts index 3da0733226..11f0e7bbda 100644 --- a/__fixtures__/v-next/outputosmojs/akash/audit/v1beta2/audit.registry.ts +++ b/__fixtures__/v-next/outputosmojs/akash/audit/v1beta2/audit.registry.ts @@ -1,12 +1,7 @@ import { Attribute, AttributeSDKType } from "../../base/v1beta2/attribute"; -import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { TelescopeGeneratedType } from "../../../types"; import { MsgSignProviderAttributes, MsgSignProviderAttributesSDKType, MsgDeleteProviderAttributes, MsgDeleteProviderAttributesSDKType } from "./audit"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/akash.audit.v1beta2.MsgSignProviderAttributes", MsgSignProviderAttributes], ["/akash.audit.v1beta2.MsgDeleteProviderAttributes", MsgDeleteProviderAttributes]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/akash.audit.v1beta2.MsgSignProviderAttributes", MsgSignProviderAttributes], ["/akash.audit.v1beta2.MsgDeleteProviderAttributes", MsgDeleteProviderAttributes]]; export const MessageComposer = { encoded: { signProviderAttributes(value: MsgSignProviderAttributes) { diff --git a/__fixtures__/v-next/outputosmojs/akash/audit/v1beta2/audit.rpc.func.ts b/__fixtures__/v-next/outputosmojs/akash/audit/v1beta2/audit.rpc.func.ts new file mode 100644 index 0000000000..3e6236d47c --- /dev/null +++ b/__fixtures__/v-next/outputosmojs/akash/audit/v1beta2/audit.rpc.func.ts @@ -0,0 +1,21 @@ +import { Attribute, AttributeSDKType } from "../../base/v1beta2/attribute"; +import { buildTx } from "../../../helper-func-types"; +import { MsgSignProviderAttributes, MsgSignProviderAttributesSDKType, MsgSignProviderAttributesResponse, MsgSignProviderAttributesResponseSDKType, MsgDeleteProviderAttributes, MsgDeleteProviderAttributesSDKType, MsgDeleteProviderAttributesResponse, MsgDeleteProviderAttributesResponseSDKType } from "./audit"; +/** + * SignProviderAttributes defines a method that signs provider attributes + * @name signProviderAttributes + * @package akash.audit.v1beta2 + * @see proto service: akash.audit.v1beta2.SignProviderAttributes + */ +export const signProviderAttributes = buildTx({ + msg: MsgSignProviderAttributes +}); +/** + * DeleteProviderAttributes defines a method that deletes provider attributes + * @name deleteProviderAttributes + * @package akash.audit.v1beta2 + * @see proto service: akash.audit.v1beta2.DeleteProviderAttributes + */ +export const deleteProviderAttributes = buildTx({ + msg: MsgDeleteProviderAttributes +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputosmojs/akash/audit/v1beta2/audit.rpc.msg.ts b/__fixtures__/v-next/outputosmojs/akash/audit/v1beta2/audit.rpc.msg.ts index 74a9504a12..072f7340c8 100644 --- a/__fixtures__/v-next/outputosmojs/akash/audit/v1beta2/audit.rpc.msg.ts +++ b/__fixtures__/v-next/outputosmojs/akash/audit/v1beta2/audit.rpc.msg.ts @@ -1,5 +1,5 @@ import { Attribute, AttributeSDKType } from "../../base/v1beta2/attribute"; -import { Rpc } from "../../../helpers"; +import { TxRpc } from "../../../types"; import { BinaryReader } from "../../../binary"; import { MsgSignProviderAttributes, MsgSignProviderAttributesSDKType, MsgSignProviderAttributesResponse, MsgSignProviderAttributesResponseSDKType, MsgDeleteProviderAttributes, MsgDeleteProviderAttributesSDKType, MsgDeleteProviderAttributesResponse, MsgDeleteProviderAttributesResponseSDKType } from "./audit"; /** Msg defines the provider Msg service */ @@ -10,8 +10,8 @@ export interface Msg { deleteProviderAttributes(request: MsgDeleteProviderAttributes): Promise; } export class MsgClientImpl implements Msg { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; } /* SignProviderAttributes defines a method that signs provider attributes */ @@ -27,6 +27,6 @@ export class MsgClientImpl implements Msg { return promise.then(data => MsgDeleteProviderAttributesResponse.decode(new BinaryReader(data))); }; } -export const createClientImpl = (rpc: Rpc) => { +export const createClientImpl = (rpc: TxRpc) => { return new MsgClientImpl(rpc); }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputosmojs/akash/audit/v1beta2/query.rpc.Query.ts b/__fixtures__/v-next/outputosmojs/akash/audit/v1beta2/query.rpc.Query.ts index 82ebf931f7..d3de6d6294 100644 --- a/__fixtures__/v-next/outputosmojs/akash/audit/v1beta2/query.rpc.Query.ts +++ b/__fixtures__/v-next/outputosmojs/akash/audit/v1beta2/query.rpc.Query.ts @@ -1,6 +1,6 @@ import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination"; import { Provider, ProviderSDKType } from "./audit"; -import { Rpc } from "../../../helpers"; +import { TxRpc } from "../../../types"; import { BinaryReader } from "../../../binary"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; import { QueryAllProvidersAttributesRequest, QueryAllProvidersAttributesRequestSDKType, QueryProvidersResponse, QueryProvidersResponseSDKType, QueryProviderAttributesRequest, QueryProviderAttributesRequestSDKType, QueryProviderAuditorRequest, QueryProviderAuditorRequestSDKType, QueryAuditorAttributesRequest, QueryAuditorAttributesRequestSDKType } from "./query"; @@ -32,8 +32,8 @@ export interface Query { auditorAttributes(request: QueryAuditorAttributesRequest): Promise; } export class QueryClientImpl implements Query { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; } /* AllProvidersAttributes queries all providers diff --git a/__fixtures__/v-next/outputosmojs/akash/audit/v1beta2/query.rpc.func.ts b/__fixtures__/v-next/outputosmojs/akash/audit/v1beta2/query.rpc.func.ts new file mode 100644 index 0000000000..37305420f7 --- /dev/null +++ b/__fixtures__/v-next/outputosmojs/akash/audit/v1beta2/query.rpc.func.ts @@ -0,0 +1,60 @@ +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination"; +import { Provider, ProviderSDKType } from "./audit"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { QueryAllProvidersAttributesRequest, QueryAllProvidersAttributesRequestSDKType, QueryProvidersResponse, QueryProvidersResponseSDKType, QueryProviderAttributesRequest, QueryProviderAttributesRequestSDKType, QueryProviderAuditorRequest, QueryProviderAuditorRequestSDKType, QueryAuditorAttributesRequest, QueryAuditorAttributesRequestSDKType } from "./query"; +/** + * AllProvidersAttributes queries all providers + * buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE + * buf:lint:ignore RPC_RESPONSE_STANDARD_NAME + * @name getAllProvidersAttributes + * @package akash.audit.v1beta2 + * @see proto service: akash.audit.v1beta2.AllProvidersAttributes + */ +export const getAllProvidersAttributes = buildQuery({ + encode: QueryAllProvidersAttributesRequest.encode, + decode: QueryProvidersResponse.decode, + service: "akash.audit.v1beta2.Query", + method: "AllProvidersAttributes" +}); +/** + * ProviderAttributes queries all provider signed attributes + * buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE + * buf:lint:ignore RPC_RESPONSE_STANDARD_NAME + * @name getProviderAttributes + * @package akash.audit.v1beta2 + * @see proto service: akash.audit.v1beta2.ProviderAttributes + */ +export const getProviderAttributes = buildQuery({ + encode: QueryProviderAttributesRequest.encode, + decode: QueryProvidersResponse.decode, + service: "akash.audit.v1beta2.Query", + method: "ProviderAttributes" +}); +/** + * ProviderAuditorAttributes queries provider signed attributes by specific auditor + * buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE + * buf:lint:ignore RPC_RESPONSE_STANDARD_NAME + * @name getProviderAuditorAttributes + * @package akash.audit.v1beta2 + * @see proto service: akash.audit.v1beta2.ProviderAuditorAttributes + */ +export const getProviderAuditorAttributes = buildQuery({ + encode: QueryProviderAuditorRequest.encode, + decode: QueryProvidersResponse.decode, + service: "akash.audit.v1beta2.Query", + method: "ProviderAuditorAttributes" +}); +/** + * AuditorAttributes queries all providers signed by this auditor + * buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE + * buf:lint:ignore RPC_RESPONSE_STANDARD_NAME + * @name getAuditorAttributes + * @package akash.audit.v1beta2 + * @see proto service: akash.audit.v1beta2.AuditorAttributes + */ +export const getAuditorAttributes = buildQuery({ + encode: QueryAuditorAttributesRequest.encode, + decode: QueryProvidersResponse.decode, + service: "akash.audit.v1beta2.Query", + method: "AuditorAttributes" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputosmojs/akash/bundle.ts b/__fixtures__/v-next/outputosmojs/akash/bundle.ts index 70f494e14c..e992720ecc 100644 --- a/__fixtures__/v-next/outputosmojs/akash/bundle.ts +++ b/__fixtures__/v-next/outputosmojs/akash/bundle.ts @@ -73,31 +73,48 @@ import * as _384 from "./escrow/v1beta1/query.lcd"; import * as _385 from "./escrow/v1beta2/query.lcd"; import * as _386 from "./market/v1beta2/query.lcd"; import * as _387 from "./provider/v1beta2/query.lcd"; -import * as _388 from "./audit/v1beta2/query.rpc.Query"; -import * as _389 from "./cert/v1beta2/query.rpc.Query"; -import * as _390 from "./deployment/v1beta2/query.rpc.Query"; -import * as _391 from "./escrow/v1beta1/query.rpc.Query"; -import * as _392 from "./escrow/v1beta2/query.rpc.Query"; -import * as _393 from "./market/v1beta2/query.rpc.Query"; -import * as _394 from "./provider/v1beta2/query.rpc.Query"; -import * as _395 from "./audit/v1beta1/audit.rpc.msg"; -import * as _396 from "./audit/v1beta2/audit.rpc.msg"; -import * as _397 from "./cert/v1beta2/cert.rpc.msg"; -import * as _398 from "./deployment/v1beta2/service.rpc.msg"; -import * as _399 from "./market/v1beta2/service.rpc.msg"; -import * as _400 from "./provider/v1beta1/provider.rpc.msg"; -import * as _401 from "./provider/v1beta2/provider.rpc.msg"; -import * as _402 from "./cert/v1beta2/query.pinia.store"; -import * as _624 from "./lcd"; -import * as _625 from "./rpc.query"; -import * as _626 from "./rpc.tx"; +import * as _388 from "./audit/v1beta2/query.rpc.func"; +import * as _389 from "./cert/v1beta2/query.rpc.func"; +import * as _390 from "./deployment/v1beta1/query.rpc.func"; +import * as _391 from "./deployment/v1beta2/query.rpc.func"; +import * as _392 from "./escrow/v1beta1/query.rpc.func"; +import * as _393 from "./escrow/v1beta2/query.rpc.func"; +import * as _394 from "./market/v1beta2/query.rpc.func"; +import * as _395 from "./provider/v1beta2/query.rpc.func"; +import * as _396 from "./audit/v1beta2/query.rpc.Query"; +import * as _397 from "./cert/v1beta2/query.rpc.Query"; +import * as _398 from "./deployment/v1beta2/query.rpc.Query"; +import * as _399 from "./escrow/v1beta1/query.rpc.Query"; +import * as _400 from "./escrow/v1beta2/query.rpc.Query"; +import * as _401 from "./market/v1beta2/query.rpc.Query"; +import * as _402 from "./provider/v1beta2/query.rpc.Query"; +import * as _403 from "./audit/v1beta1/audit.rpc.func"; +import * as _404 from "./audit/v1beta2/audit.rpc.func"; +import * as _405 from "./cert/v1beta2/cert.rpc.func"; +import * as _406 from "./deployment/v1beta1/deployment.rpc.func"; +import * as _407 from "./deployment/v1beta2/service.rpc.func"; +import * as _408 from "./market/v1beta2/service.rpc.func"; +import * as _409 from "./provider/v1beta1/provider.rpc.func"; +import * as _410 from "./provider/v1beta2/provider.rpc.func"; +import * as _411 from "./audit/v1beta1/audit.rpc.msg"; +import * as _412 from "./audit/v1beta2/audit.rpc.msg"; +import * as _413 from "./cert/v1beta2/cert.rpc.msg"; +import * as _414 from "./deployment/v1beta2/service.rpc.msg"; +import * as _415 from "./market/v1beta2/service.rpc.msg"; +import * as _416 from "./provider/v1beta1/provider.rpc.msg"; +import * as _417 from "./provider/v1beta2/provider.rpc.msg"; +import * as _418 from "./cert/v1beta2/query.pinia.store"; +import * as _733 from "./lcd"; +import * as _734 from "./rpc.query"; +import * as _735 from "./rpc.tx"; export namespace akash { export namespace audit { export const v1beta1 = { ..._0, ..._366, ..._373, - ..._395 + ..._403, + ..._411 }; export const v1beta2 = { ..._1, @@ -107,7 +124,9 @@ export namespace akash { ..._374, ..._380, ..._388, - ..._396 + ..._396, + ..._404, + ..._412 }; } export namespace base { @@ -135,7 +154,9 @@ export namespace akash { ..._381, ..._389, ..._397, - ..._402 + ..._405, + ..._413, + ..._418 }; } export namespace deployment { @@ -146,7 +167,9 @@ export namespace akash { ..._19, ..._20, ..._21, - ..._382 + ..._382, + ..._390, + ..._406 }; export const v1beta2 = { ..._22, @@ -164,8 +187,10 @@ export namespace akash { ..._369, ..._376, ..._383, - ..._390, - ..._398 + ..._391, + ..._398, + ..._407, + ..._414 }; } export namespace escrow { @@ -174,14 +199,16 @@ export namespace akash { ..._35, ..._36, ..._384, - ..._391 + ..._392, + ..._399 }; export const v1beta2 = { ..._37, ..._38, ..._39, ..._385, - ..._392 + ..._393, + ..._400 }; } export namespace inflation { @@ -202,8 +229,10 @@ export namespace akash { ..._370, ..._377, ..._386, - ..._393, - ..._399 + ..._394, + ..._401, + ..._408, + ..._415 }; } export namespace provider { @@ -211,7 +240,8 @@ export namespace akash { ..._49, ..._371, ..._378, - ..._400 + ..._409, + ..._416 }; export const v1beta2 = { ..._50, @@ -220,13 +250,15 @@ export namespace akash { ..._372, ..._379, ..._387, - ..._394, - ..._401 + ..._395, + ..._402, + ..._410, + ..._417 }; } export const ClientFactory = { - ..._624, - ..._625, - ..._626 + ..._733, + ..._734, + ..._735 }; } \ No newline at end of file diff --git a/__fixtures__/v-next/outputosmojs/akash/cert/v1beta2/cert.registry.ts b/__fixtures__/v-next/outputosmojs/akash/cert/v1beta2/cert.registry.ts index db2b4835c6..b2dbebb1de 100644 --- a/__fixtures__/v-next/outputosmojs/akash/cert/v1beta2/cert.registry.ts +++ b/__fixtures__/v-next/outputosmojs/akash/cert/v1beta2/cert.registry.ts @@ -1,11 +1,6 @@ -import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { TelescopeGeneratedType } from "../../../types"; import { MsgCreateCertificate, MsgCreateCertificateSDKType, MsgRevokeCertificate, MsgRevokeCertificateSDKType } from "./cert"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/akash.cert.v1beta2.MsgCreateCertificate", MsgCreateCertificate], ["/akash.cert.v1beta2.MsgRevokeCertificate", MsgRevokeCertificate]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/akash.cert.v1beta2.MsgCreateCertificate", MsgCreateCertificate], ["/akash.cert.v1beta2.MsgRevokeCertificate", MsgRevokeCertificate]]; export const MessageComposer = { encoded: { createCertificate(value: MsgCreateCertificate) { diff --git a/__fixtures__/v-next/outputosmojs/akash/cert/v1beta2/cert.rpc.func.ts b/__fixtures__/v-next/outputosmojs/akash/cert/v1beta2/cert.rpc.func.ts new file mode 100644 index 0000000000..bd7aec965f --- /dev/null +++ b/__fixtures__/v-next/outputosmojs/akash/cert/v1beta2/cert.rpc.func.ts @@ -0,0 +1,20 @@ +import { buildTx } from "../../../helper-func-types"; +import { MsgCreateCertificate, MsgCreateCertificateSDKType, MsgCreateCertificateResponse, MsgCreateCertificateResponseSDKType, MsgRevokeCertificate, MsgRevokeCertificateSDKType, MsgRevokeCertificateResponse, MsgRevokeCertificateResponseSDKType } from "./cert"; +/** + * CreateCertificate defines a method to create new certificate given proper inputs. + * @name createCertificate + * @package akash.cert.v1beta2 + * @see proto service: akash.cert.v1beta2.CreateCertificate + */ +export const createCertificate = buildTx({ + msg: MsgCreateCertificate +}); +/** + * RevokeCertificate defines a method to revoke the certificate + * @name revokeCertificate + * @package akash.cert.v1beta2 + * @see proto service: akash.cert.v1beta2.RevokeCertificate + */ +export const revokeCertificate = buildTx({ + msg: MsgRevokeCertificate +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputosmojs/akash/cert/v1beta2/cert.rpc.msg.ts b/__fixtures__/v-next/outputosmojs/akash/cert/v1beta2/cert.rpc.msg.ts index a00c4317ea..330249b9ca 100644 --- a/__fixtures__/v-next/outputosmojs/akash/cert/v1beta2/cert.rpc.msg.ts +++ b/__fixtures__/v-next/outputosmojs/akash/cert/v1beta2/cert.rpc.msg.ts @@ -1,4 +1,4 @@ -import { Rpc } from "../../../helpers"; +import { TxRpc } from "../../../types"; import { BinaryReader } from "../../../binary"; import { MsgCreateCertificate, MsgCreateCertificateSDKType, MsgCreateCertificateResponse, MsgCreateCertificateResponseSDKType, MsgRevokeCertificate, MsgRevokeCertificateSDKType, MsgRevokeCertificateResponse, MsgRevokeCertificateResponseSDKType } from "./cert"; /** Msg defines the provider Msg service */ @@ -9,8 +9,8 @@ export interface Msg { revokeCertificate(request: MsgRevokeCertificate): Promise; } export class MsgClientImpl implements Msg { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; } /* CreateCertificate defines a method to create new certificate given proper inputs. */ @@ -26,6 +26,6 @@ export class MsgClientImpl implements Msg { return promise.then(data => MsgRevokeCertificateResponse.decode(new BinaryReader(data))); }; } -export const createClientImpl = (rpc: Rpc) => { +export const createClientImpl = (rpc: TxRpc) => { return new MsgClientImpl(rpc); }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputosmojs/akash/cert/v1beta2/query.rpc.Query.ts b/__fixtures__/v-next/outputosmojs/akash/cert/v1beta2/query.rpc.Query.ts index 9fa4b5a5a7..19625aa464 100644 --- a/__fixtures__/v-next/outputosmojs/akash/cert/v1beta2/query.rpc.Query.ts +++ b/__fixtures__/v-next/outputosmojs/akash/cert/v1beta2/query.rpc.Query.ts @@ -1,6 +1,6 @@ import { CertificateFilter, CertificateFilterSDKType, Certificate, CertificateSDKType } from "./cert"; import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination"; -import { Rpc } from "../../../helpers"; +import { TxRpc } from "../../../types"; import { BinaryReader } from "../../../binary"; import { QueryClient, createProtobufRpcClient, ProtobufRpcClient } from "@cosmjs/stargate"; import { ReactQueryParams } from "../../../react-query"; @@ -14,8 +14,8 @@ export interface Query { certificates(request: QueryCertificatesRequest): Promise; } export class QueryClientImpl implements Query { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; } /* Certificates queries certificates */ diff --git a/__fixtures__/v-next/outputosmojs/akash/cert/v1beta2/query.rpc.func.ts b/__fixtures__/v-next/outputosmojs/akash/cert/v1beta2/query.rpc.func.ts new file mode 100644 index 0000000000..adca22be83 --- /dev/null +++ b/__fixtures__/v-next/outputosmojs/akash/cert/v1beta2/query.rpc.func.ts @@ -0,0 +1,16 @@ +import { CertificateFilter, CertificateFilterSDKType, Certificate, CertificateSDKType } from "./cert"; +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { QueryCertificatesRequest, QueryCertificatesRequestSDKType, QueryCertificatesResponse, QueryCertificatesResponseSDKType } from "./query"; +/** + * Certificates queries certificates + * @name getCertificates + * @package akash.cert.v1beta2 + * @see proto service: akash.cert.v1beta2.Certificates + */ +export const getCertificates = buildQuery({ + encode: QueryCertificatesRequest.encode, + decode: QueryCertificatesResponse.decode, + service: "akash.cert.v1beta2.Query", + method: "Certificates" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta1/deployment.rpc.func.ts b/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta1/deployment.rpc.func.ts new file mode 100644 index 0000000000..74f7d60ba4 --- /dev/null +++ b/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta1/deployment.rpc.func.ts @@ -0,0 +1,67 @@ +import { GroupSpec, GroupSpecSDKType, GroupID, GroupIDSDKType, MsgCloseGroup, MsgCloseGroupSDKType, MsgCloseGroupResponse, MsgCloseGroupResponseSDKType, MsgPauseGroup, MsgPauseGroupSDKType, MsgPauseGroupResponse, MsgPauseGroupResponseSDKType, MsgStartGroup, MsgStartGroupSDKType, MsgStartGroupResponse, MsgStartGroupResponseSDKType } from "./group"; +import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; +import { buildTx } from "../../../helper-func-types"; +import { MsgCreateDeployment, MsgCreateDeploymentSDKType, MsgCreateDeploymentResponse, MsgCreateDeploymentResponseSDKType, MsgDepositDeployment, MsgDepositDeploymentSDKType, MsgDepositDeploymentResponse, MsgDepositDeploymentResponseSDKType, MsgUpdateDeployment, MsgUpdateDeploymentSDKType, MsgUpdateDeploymentResponse, MsgUpdateDeploymentResponseSDKType, MsgCloseDeployment, MsgCloseDeploymentSDKType, MsgCloseDeploymentResponse, MsgCloseDeploymentResponseSDKType } from "./deployment"; +/** + * CreateDeployment defines a method to create new deployment given proper inputs. + * @name createDeployment + * @package akash.deployment.v1beta1 + * @see proto service: akash.deployment.v1beta1.CreateDeployment + */ +export const createDeployment = buildTx({ + msg: MsgCreateDeployment +}); +/** + * DepositDeployment deposits more funds into the deployment account + * @name depositDeployment + * @package akash.deployment.v1beta1 + * @see proto service: akash.deployment.v1beta1.DepositDeployment + */ +export const depositDeployment = buildTx({ + msg: MsgDepositDeployment +}); +/** + * UpdateDeployment defines a method to update a deployment given proper inputs. + * @name updateDeployment + * @package akash.deployment.v1beta1 + * @see proto service: akash.deployment.v1beta1.UpdateDeployment + */ +export const updateDeployment = buildTx({ + msg: MsgUpdateDeployment +}); +/** + * CloseDeployment defines a method to close a deployment given proper inputs. + * @name closeDeployment + * @package akash.deployment.v1beta1 + * @see proto service: akash.deployment.v1beta1.CloseDeployment + */ +export const closeDeployment = buildTx({ + msg: MsgCloseDeployment +}); +/** + * CloseGroup defines a method to close a group of a deployment given proper inputs. + * @name closeGroup + * @package akash.deployment.v1beta1 + * @see proto service: akash.deployment.v1beta1.CloseGroup + */ +export const closeGroup = buildTx({ + msg: MsgCloseGroup +}); +/** + * PauseGroup defines a method to close a group of a deployment given proper inputs. + * @name pauseGroup + * @package akash.deployment.v1beta1 + * @see proto service: akash.deployment.v1beta1.PauseGroup + */ +export const pauseGroup = buildTx({ + msg: MsgPauseGroup +}); +/** + * StartGroup defines a method to close a group of a deployment given proper inputs. + * @name startGroup + * @package akash.deployment.v1beta1 + * @see proto service: akash.deployment.v1beta1.StartGroup + */ +export const startGroup = buildTx({ + msg: MsgStartGroup +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta1/deployment.ts b/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta1/deployment.ts index 8fa40e0896..b8de4d371f 100644 --- a/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta1/deployment.ts +++ b/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta1/deployment.ts @@ -3,8 +3,9 @@ import { GroupSpec, GroupSpecSDKType, GroupID, GroupIDSDKType } from "./group"; import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, bytesFromBase64, base64FromBytes, Exact, Rpc } from "../../../helpers"; +import { isSet, bytesFromBase64, base64FromBytes, Exact } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; +import { TxRpc } from "../../../types"; export const protobufPackage = "akash.deployment.v1beta1"; /** State is an enum which refers to state of deployment */ export enum Deployment_State { @@ -1555,8 +1556,8 @@ export interface Msg { startGroup(request: MsgStartGroup): Promise; } export class MsgClientImpl implements Msg { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; } /* CreateDeployment defines a method to create new deployment given proper inputs. */ @@ -1602,6 +1603,6 @@ export class MsgClientImpl implements Msg { return promise.then(data => MsgStartGroupResponse.decode(new BinaryReader(data))); }; } -export const createClientImpl = (rpc: Rpc) => { +export const createClientImpl = (rpc: TxRpc) => { return new MsgClientImpl(rpc); }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta1/query.rpc.func.ts new file mode 100644 index 0000000000..77a812c186 --- /dev/null +++ b/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta1/query.rpc.func.ts @@ -0,0 +1,42 @@ +import { DeploymentFilters, DeploymentFiltersSDKType, DeploymentID, DeploymentIDSDKType, Deployment, DeploymentSDKType } from "./deployment"; +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination"; +import { GroupID, GroupIDSDKType, Group, GroupSDKType } from "./group"; +import { Account, AccountSDKType } from "../../escrow/v1beta1/types"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { QueryDeploymentsRequest, QueryDeploymentsRequestSDKType, QueryDeploymentsResponse, QueryDeploymentsResponseSDKType, QueryDeploymentRequest, QueryDeploymentRequestSDKType, QueryDeploymentResponse, QueryDeploymentResponseSDKType, QueryGroupRequest, QueryGroupRequestSDKType, QueryGroupResponse, QueryGroupResponseSDKType } from "./query"; +/** + * Deployments queries deployments + * @name getDeployments + * @package akash.deployment.v1beta1 + * @see proto service: akash.deployment.v1beta1.Deployments + */ +export const getDeployments = buildQuery({ + encode: QueryDeploymentsRequest.encode, + decode: QueryDeploymentsResponse.decode, + service: "akash.deployment.v1beta1.Query", + method: "Deployments" +}); +/** + * Deployment queries deployment details + * @name getDeployment + * @package akash.deployment.v1beta1 + * @see proto service: akash.deployment.v1beta1.Deployment + */ +export const getDeployment = buildQuery({ + encode: QueryDeploymentRequest.encode, + decode: QueryDeploymentResponse.decode, + service: "akash.deployment.v1beta1.Query", + method: "Deployment" +}); +/** + * Group queries group details + * @name getGroup + * @package akash.deployment.v1beta1 + * @see proto service: akash.deployment.v1beta1.Group + */ +export const getGroup = buildQuery({ + encode: QueryGroupRequest.encode, + decode: QueryGroupResponse.decode, + service: "akash.deployment.v1beta1.Query", + method: "Group" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta1/query.ts b/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta1/query.ts index 199d8a29bc..736be4dd61 100644 --- a/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta1/query.ts +++ b/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta1/query.ts @@ -3,8 +3,9 @@ import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } fr import { GroupID, GroupIDSDKType, Group, GroupSDKType } from "./group"; import { Account, AccountSDKType } from "../../escrow/v1beta1/types"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, Exact, Rpc } from "../../../helpers"; +import { isSet, Exact } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; +import { TxRpc } from "../../../types"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; export const protobufPackage = "akash.deployment.v1beta1"; /** @@ -845,8 +846,8 @@ export interface Query { group(request: QueryGroupRequest): Promise; } export class QueryClientImpl implements Query { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; } /* Deployments queries deployments */ diff --git a/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta2/query.rpc.Query.ts b/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta2/query.rpc.Query.ts index cebfb9fbba..d1c32a2ea3 100644 --- a/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta2/query.rpc.Query.ts +++ b/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta2/query.rpc.Query.ts @@ -3,7 +3,7 @@ import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } fr import { GroupID, GroupIDSDKType } from "./groupid"; import { Group, GroupSDKType } from "./group"; import { Account, AccountSDKType } from "../../escrow/v1beta2/types"; -import { Rpc } from "../../../helpers"; +import { TxRpc } from "../../../types"; import { BinaryReader } from "../../../binary"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; import { QueryDeploymentsRequest, QueryDeploymentsRequestSDKType, QueryDeploymentsResponse, QueryDeploymentsResponseSDKType, QueryDeploymentRequest, QueryDeploymentRequestSDKType, QueryDeploymentResponse, QueryDeploymentResponseSDKType, QueryGroupRequest, QueryGroupRequestSDKType, QueryGroupResponse, QueryGroupResponseSDKType } from "./query"; @@ -17,8 +17,8 @@ export interface Query { group(request: QueryGroupRequest): Promise; } export class QueryClientImpl implements Query { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; } /* Deployments queries deployments */ diff --git a/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta2/query.rpc.func.ts b/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta2/query.rpc.func.ts new file mode 100644 index 0000000000..8de064dc44 --- /dev/null +++ b/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta2/query.rpc.func.ts @@ -0,0 +1,43 @@ +import { DeploymentFilters, DeploymentFiltersSDKType, DeploymentID, DeploymentIDSDKType, Deployment, DeploymentSDKType } from "./deployment"; +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination"; +import { GroupID, GroupIDSDKType } from "./groupid"; +import { Group, GroupSDKType } from "./group"; +import { Account, AccountSDKType } from "../../escrow/v1beta2/types"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { QueryDeploymentsRequest, QueryDeploymentsRequestSDKType, QueryDeploymentsResponse, QueryDeploymentsResponseSDKType, QueryDeploymentRequest, QueryDeploymentRequestSDKType, QueryDeploymentResponse, QueryDeploymentResponseSDKType, QueryGroupRequest, QueryGroupRequestSDKType, QueryGroupResponse, QueryGroupResponseSDKType } from "./query"; +/** + * Deployments queries deployments + * @name getDeployments + * @package akash.deployment.v1beta2 + * @see proto service: akash.deployment.v1beta2.Deployments + */ +export const getDeployments = buildQuery({ + encode: QueryDeploymentsRequest.encode, + decode: QueryDeploymentsResponse.decode, + service: "akash.deployment.v1beta2.Query", + method: "Deployments" +}); +/** + * Deployment queries deployment details + * @name getDeployment + * @package akash.deployment.v1beta2 + * @see proto service: akash.deployment.v1beta2.Deployment + */ +export const getDeployment = buildQuery({ + encode: QueryDeploymentRequest.encode, + decode: QueryDeploymentResponse.decode, + service: "akash.deployment.v1beta2.Query", + method: "Deployment" +}); +/** + * Group queries group details + * @name getGroup + * @package akash.deployment.v1beta2 + * @see proto service: akash.deployment.v1beta2.Group + */ +export const getGroup = buildQuery({ + encode: QueryGroupRequest.encode, + decode: QueryGroupResponse.decode, + service: "akash.deployment.v1beta2.Query", + method: "Group" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta2/service.registry.ts b/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta2/service.registry.ts index 06a1603411..ffa9b2b188 100644 --- a/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta2/service.registry.ts +++ b/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta2/service.registry.ts @@ -2,15 +2,10 @@ import { DeploymentID, DeploymentIDSDKType } from "./deployment"; import { GroupSpec, GroupSpecSDKType } from "./groupspec"; import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { GroupID, GroupIDSDKType } from "./groupid"; -import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { TelescopeGeneratedType } from "../../../types"; import { MsgCreateDeployment, MsgCreateDeploymentSDKType, MsgDepositDeployment, MsgDepositDeploymentSDKType, MsgUpdateDeployment, MsgUpdateDeploymentSDKType, MsgCloseDeployment, MsgCloseDeploymentSDKType } from "./deploymentmsg"; import { MsgCloseGroup, MsgCloseGroupSDKType, MsgPauseGroup, MsgPauseGroupSDKType, MsgStartGroup, MsgStartGroupSDKType } from "./groupmsg"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/akash.deployment.v1beta2.MsgCreateDeployment", MsgCreateDeployment], ["/akash.deployment.v1beta2.MsgDepositDeployment", MsgDepositDeployment], ["/akash.deployment.v1beta2.MsgUpdateDeployment", MsgUpdateDeployment], ["/akash.deployment.v1beta2.MsgCloseDeployment", MsgCloseDeployment], ["/akash.deployment.v1beta2.MsgCloseGroup", MsgCloseGroup], ["/akash.deployment.v1beta2.MsgPauseGroup", MsgPauseGroup], ["/akash.deployment.v1beta2.MsgStartGroup", MsgStartGroup]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/akash.deployment.v1beta2.MsgCreateDeployment", MsgCreateDeployment], ["/akash.deployment.v1beta2.MsgDepositDeployment", MsgDepositDeployment], ["/akash.deployment.v1beta2.MsgUpdateDeployment", MsgUpdateDeployment], ["/akash.deployment.v1beta2.MsgCloseDeployment", MsgCloseDeployment], ["/akash.deployment.v1beta2.MsgCloseGroup", MsgCloseGroup], ["/akash.deployment.v1beta2.MsgPauseGroup", MsgPauseGroup], ["/akash.deployment.v1beta2.MsgStartGroup", MsgStartGroup]]; export const MessageComposer = { encoded: { createDeployment(value: MsgCreateDeployment) { diff --git a/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta2/service.rpc.func.ts b/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta2/service.rpc.func.ts new file mode 100644 index 0000000000..bd99b0050f --- /dev/null +++ b/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta2/service.rpc.func.ts @@ -0,0 +1,70 @@ +import { DeploymentID, DeploymentIDSDKType } from "./deployment"; +import { GroupSpec, GroupSpecSDKType } from "./groupspec"; +import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; +import { GroupID, GroupIDSDKType } from "./groupid"; +import { buildTx } from "../../../helper-func-types"; +import { MsgCreateDeployment, MsgCreateDeploymentSDKType, MsgCreateDeploymentResponse, MsgCreateDeploymentResponseSDKType, MsgDepositDeployment, MsgDepositDeploymentSDKType, MsgDepositDeploymentResponse, MsgDepositDeploymentResponseSDKType, MsgUpdateDeployment, MsgUpdateDeploymentSDKType, MsgUpdateDeploymentResponse, MsgUpdateDeploymentResponseSDKType, MsgCloseDeployment, MsgCloseDeploymentSDKType, MsgCloseDeploymentResponse, MsgCloseDeploymentResponseSDKType } from "./deploymentmsg"; +import { MsgCloseGroup, MsgCloseGroupSDKType, MsgCloseGroupResponse, MsgCloseGroupResponseSDKType, MsgPauseGroup, MsgPauseGroupSDKType, MsgPauseGroupResponse, MsgPauseGroupResponseSDKType, MsgStartGroup, MsgStartGroupSDKType, MsgStartGroupResponse, MsgStartGroupResponseSDKType } from "./groupmsg"; +/** + * CreateDeployment defines a method to create new deployment given proper inputs. + * @name createDeployment + * @package akash.deployment.v1beta2 + * @see proto service: akash.deployment.v1beta2.CreateDeployment + */ +export const createDeployment = buildTx({ + msg: MsgCreateDeployment +}); +/** + * DepositDeployment deposits more funds into the deployment account + * @name depositDeployment + * @package akash.deployment.v1beta2 + * @see proto service: akash.deployment.v1beta2.DepositDeployment + */ +export const depositDeployment = buildTx({ + msg: MsgDepositDeployment +}); +/** + * UpdateDeployment defines a method to update a deployment given proper inputs. + * @name updateDeployment + * @package akash.deployment.v1beta2 + * @see proto service: akash.deployment.v1beta2.UpdateDeployment + */ +export const updateDeployment = buildTx({ + msg: MsgUpdateDeployment +}); +/** + * CloseDeployment defines a method to close a deployment given proper inputs. + * @name closeDeployment + * @package akash.deployment.v1beta2 + * @see proto service: akash.deployment.v1beta2.CloseDeployment + */ +export const closeDeployment = buildTx({ + msg: MsgCloseDeployment +}); +/** + * CloseGroup defines a method to close a group of a deployment given proper inputs. + * @name closeGroup + * @package akash.deployment.v1beta2 + * @see proto service: akash.deployment.v1beta2.CloseGroup + */ +export const closeGroup = buildTx({ + msg: MsgCloseGroup +}); +/** + * PauseGroup defines a method to close a group of a deployment given proper inputs. + * @name pauseGroup + * @package akash.deployment.v1beta2 + * @see proto service: akash.deployment.v1beta2.PauseGroup + */ +export const pauseGroup = buildTx({ + msg: MsgPauseGroup +}); +/** + * StartGroup defines a method to close a group of a deployment given proper inputs. + * @name startGroup + * @package akash.deployment.v1beta2 + * @see proto service: akash.deployment.v1beta2.StartGroup + */ +export const startGroup = buildTx({ + msg: MsgStartGroup +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta2/service.rpc.msg.ts b/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta2/service.rpc.msg.ts index 39e571bc84..beb142b07b 100644 --- a/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta2/service.rpc.msg.ts +++ b/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta2/service.rpc.msg.ts @@ -2,7 +2,7 @@ import { DeploymentID, DeploymentIDSDKType } from "./deployment"; import { GroupSpec, GroupSpecSDKType } from "./groupspec"; import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { GroupID, GroupIDSDKType } from "./groupid"; -import { Rpc } from "../../../helpers"; +import { TxRpc } from "../../../types"; import { BinaryReader } from "../../../binary"; import { MsgCreateDeployment, MsgCreateDeploymentSDKType, MsgCreateDeploymentResponse, MsgCreateDeploymentResponseSDKType, MsgDepositDeployment, MsgDepositDeploymentSDKType, MsgDepositDeploymentResponse, MsgDepositDeploymentResponseSDKType, MsgUpdateDeployment, MsgUpdateDeploymentSDKType, MsgUpdateDeploymentResponse, MsgUpdateDeploymentResponseSDKType, MsgCloseDeployment, MsgCloseDeploymentSDKType, MsgCloseDeploymentResponse, MsgCloseDeploymentResponseSDKType } from "./deploymentmsg"; import { MsgCloseGroup, MsgCloseGroupSDKType, MsgCloseGroupResponse, MsgCloseGroupResponseSDKType, MsgPauseGroup, MsgPauseGroupSDKType, MsgPauseGroupResponse, MsgPauseGroupResponseSDKType, MsgStartGroup, MsgStartGroupSDKType, MsgStartGroupResponse, MsgStartGroupResponseSDKType } from "./groupmsg"; @@ -24,8 +24,8 @@ export interface Msg { startGroup(request: MsgStartGroup): Promise; } export class MsgClientImpl implements Msg { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; } /* CreateDeployment defines a method to create new deployment given proper inputs. */ @@ -71,6 +71,6 @@ export class MsgClientImpl implements Msg { return promise.then(data => MsgStartGroupResponse.decode(new BinaryReader(data))); }; } -export const createClientImpl = (rpc: Rpc) => { +export const createClientImpl = (rpc: TxRpc) => { return new MsgClientImpl(rpc); }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputosmojs/akash/escrow/v1beta1/query.rpc.Query.ts b/__fixtures__/v-next/outputosmojs/akash/escrow/v1beta1/query.rpc.Query.ts index c036b3ea10..fd782f137f 100644 --- a/__fixtures__/v-next/outputosmojs/akash/escrow/v1beta1/query.rpc.Query.ts +++ b/__fixtures__/v-next/outputosmojs/akash/escrow/v1beta1/query.rpc.Query.ts @@ -1,6 +1,6 @@ import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination"; import { Account, AccountSDKType, Payment, PaymentSDKType } from "./types"; -import { Rpc } from "../../../helpers"; +import { TxRpc } from "../../../types"; import { BinaryReader } from "../../../binary"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; import { QueryAccountsRequest, QueryAccountsRequestSDKType, QueryAccountsResponse, QueryAccountsResponseSDKType, QueryPaymentsRequest, QueryPaymentsRequestSDKType, QueryPaymentsResponse, QueryPaymentsResponseSDKType } from "./query"; @@ -20,8 +20,8 @@ export interface Query { payments(request: QueryPaymentsRequest): Promise; } export class QueryClientImpl implements Query { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; } /* buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE diff --git a/__fixtures__/v-next/outputosmojs/akash/escrow/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputosmojs/akash/escrow/v1beta1/query.rpc.func.ts new file mode 100644 index 0000000000..dfbdf297d1 --- /dev/null +++ b/__fixtures__/v-next/outputosmojs/akash/escrow/v1beta1/query.rpc.func.ts @@ -0,0 +1,32 @@ +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination"; +import { Account, AccountSDKType, Payment, PaymentSDKType } from "./types"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { QueryAccountsRequest, QueryAccountsRequestSDKType, QueryAccountsResponse, QueryAccountsResponseSDKType, QueryPaymentsRequest, QueryPaymentsRequestSDKType, QueryPaymentsResponse, QueryPaymentsResponseSDKType } from "./query"; +/** + * buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE + * buf:lint:ignore RPC_RESPONSE_STANDARD_NAME + * Accounts queries all accounts + * @name getAccounts + * @package akash.escrow.v1beta1 + * @see proto service: akash.escrow.v1beta1.Accounts + */ +export const getAccounts = buildQuery({ + encode: QueryAccountsRequest.encode, + decode: QueryAccountsResponse.decode, + service: "akash.escrow.v1beta1.Query", + method: "Accounts" +}); +/** + * buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE + * buf:lint:ignore RPC_RESPONSE_STANDARD_NAME + * Payments queries all payments + * @name getPayments + * @package akash.escrow.v1beta1 + * @see proto service: akash.escrow.v1beta1.Payments + */ +export const getPayments = buildQuery({ + encode: QueryPaymentsRequest.encode, + decode: QueryPaymentsResponse.decode, + service: "akash.escrow.v1beta1.Query", + method: "Payments" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputosmojs/akash/escrow/v1beta2/query.rpc.Query.ts b/__fixtures__/v-next/outputosmojs/akash/escrow/v1beta2/query.rpc.Query.ts index c342a1e9be..d73336e940 100644 --- a/__fixtures__/v-next/outputosmojs/akash/escrow/v1beta2/query.rpc.Query.ts +++ b/__fixtures__/v-next/outputosmojs/akash/escrow/v1beta2/query.rpc.Query.ts @@ -1,6 +1,6 @@ import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination"; import { Account, AccountSDKType, FractionalPayment, FractionalPaymentSDKType } from "./types"; -import { Rpc } from "../../../helpers"; +import { TxRpc } from "../../../types"; import { BinaryReader } from "../../../binary"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; import { QueryAccountsRequest, QueryAccountsRequestSDKType, QueryAccountsResponse, QueryAccountsResponseSDKType, QueryPaymentsRequest, QueryPaymentsRequestSDKType, QueryPaymentsResponse, QueryPaymentsResponseSDKType } from "./query"; @@ -20,8 +20,8 @@ export interface Query { payments(request: QueryPaymentsRequest): Promise; } export class QueryClientImpl implements Query { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; } /* buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE diff --git a/__fixtures__/v-next/outputosmojs/akash/escrow/v1beta2/query.rpc.func.ts b/__fixtures__/v-next/outputosmojs/akash/escrow/v1beta2/query.rpc.func.ts new file mode 100644 index 0000000000..6d929b5658 --- /dev/null +++ b/__fixtures__/v-next/outputosmojs/akash/escrow/v1beta2/query.rpc.func.ts @@ -0,0 +1,32 @@ +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination"; +import { Account, AccountSDKType, FractionalPayment, FractionalPaymentSDKType } from "./types"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { QueryAccountsRequest, QueryAccountsRequestSDKType, QueryAccountsResponse, QueryAccountsResponseSDKType, QueryPaymentsRequest, QueryPaymentsRequestSDKType, QueryPaymentsResponse, QueryPaymentsResponseSDKType } from "./query"; +/** + * buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE + * buf:lint:ignore RPC_RESPONSE_STANDARD_NAME + * Accounts queries all accounts + * @name getAccounts + * @package akash.escrow.v1beta2 + * @see proto service: akash.escrow.v1beta2.Accounts + */ +export const getAccounts = buildQuery({ + encode: QueryAccountsRequest.encode, + decode: QueryAccountsResponse.decode, + service: "akash.escrow.v1beta2.Query", + method: "Accounts" +}); +/** + * buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE + * buf:lint:ignore RPC_RESPONSE_STANDARD_NAME + * Payments queries all payments + * @name getPayments + * @package akash.escrow.v1beta2 + * @see proto service: akash.escrow.v1beta2.Payments + */ +export const getPayments = buildQuery({ + encode: QueryPaymentsRequest.encode, + decode: QueryPaymentsResponse.decode, + service: "akash.escrow.v1beta2.Query", + method: "Payments" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputosmojs/akash/inflation/v1beta2/params.ts b/__fixtures__/v-next/outputosmojs/akash/inflation/v1beta2/params.ts index 3cc711ca94..b7e6e08d5b 100644 --- a/__fixtures__/v-next/outputosmojs/akash/inflation/v1beta2/params.ts +++ b/__fixtures__/v-next/outputosmojs/akash/inflation/v1beta2/params.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { Decimal } from "@cosmjs/math"; +import { Decimal } from "@interchainjs/math"; import { isSet, DeepPartial, Exact } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "akash.inflation.v1beta2"; @@ -147,9 +147,9 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.inflation_decay_factor = message.inflationDecayFactor ?? ""; - obj.initial_inflation = message.initialInflation ?? ""; - obj.variance = message.variance ?? ""; + obj.inflation_decay_factor = Decimal.fromUserInput(message.inflationDecayFactor, 18).atomics ?? ""; + obj.initial_inflation = Decimal.fromUserInput(message.initialInflation, 18).atomics ?? ""; + obj.variance = Decimal.fromUserInput(message.variance, 18).atomics ?? ""; return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputosmojs/akash/market/v1beta2/query.rpc.Query.ts b/__fixtures__/v-next/outputosmojs/akash/market/v1beta2/query.rpc.Query.ts index 3b71843494..72b96c1cb9 100644 --- a/__fixtures__/v-next/outputosmojs/akash/market/v1beta2/query.rpc.Query.ts +++ b/__fixtures__/v-next/outputosmojs/akash/market/v1beta2/query.rpc.Query.ts @@ -3,7 +3,7 @@ import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } fr import { BidFilters, BidFiltersSDKType, BidID, BidIDSDKType, Bid, BidSDKType } from "./bid"; import { LeaseFilters, LeaseFiltersSDKType, LeaseID, LeaseIDSDKType, Lease, LeaseSDKType } from "./lease"; import { Account, AccountSDKType, FractionalPayment, FractionalPaymentSDKType } from "../../escrow/v1beta2/types"; -import { Rpc } from "../../../helpers"; +import { TxRpc } from "../../../types"; import { BinaryReader } from "../../../binary"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; import { QueryOrdersRequest, QueryOrdersRequestSDKType, QueryOrdersResponse, QueryOrdersResponseSDKType, QueryOrderRequest, QueryOrderRequestSDKType, QueryOrderResponse, QueryOrderResponseSDKType, QueryBidsRequest, QueryBidsRequestSDKType, QueryBidsResponse, QueryBidsResponseSDKType, QueryBidRequest, QueryBidRequestSDKType, QueryBidResponse, QueryBidResponseSDKType, QueryLeasesRequest, QueryLeasesRequestSDKType, QueryLeasesResponse, QueryLeasesResponseSDKType, QueryLeaseRequest, QueryLeaseRequestSDKType, QueryLeaseResponse, QueryLeaseResponseSDKType } from "./query"; @@ -23,8 +23,8 @@ export interface Query { lease(request: QueryLeaseRequest): Promise; } export class QueryClientImpl implements Query { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; } /* Orders queries orders with filters */ diff --git a/__fixtures__/v-next/outputosmojs/akash/market/v1beta2/query.rpc.func.ts b/__fixtures__/v-next/outputosmojs/akash/market/v1beta2/query.rpc.func.ts new file mode 100644 index 0000000000..3f82015da6 --- /dev/null +++ b/__fixtures__/v-next/outputosmojs/akash/market/v1beta2/query.rpc.func.ts @@ -0,0 +1,79 @@ +import { OrderFilters, OrderFiltersSDKType, OrderID, OrderIDSDKType, Order, OrderSDKType } from "./order"; +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination"; +import { BidFilters, BidFiltersSDKType, BidID, BidIDSDKType, Bid, BidSDKType } from "./bid"; +import { LeaseFilters, LeaseFiltersSDKType, LeaseID, LeaseIDSDKType, Lease, LeaseSDKType } from "./lease"; +import { Account, AccountSDKType, FractionalPayment, FractionalPaymentSDKType } from "../../escrow/v1beta2/types"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { QueryOrdersRequest, QueryOrdersRequestSDKType, QueryOrdersResponse, QueryOrdersResponseSDKType, QueryOrderRequest, QueryOrderRequestSDKType, QueryOrderResponse, QueryOrderResponseSDKType, QueryBidsRequest, QueryBidsRequestSDKType, QueryBidsResponse, QueryBidsResponseSDKType, QueryBidRequest, QueryBidRequestSDKType, QueryBidResponse, QueryBidResponseSDKType, QueryLeasesRequest, QueryLeasesRequestSDKType, QueryLeasesResponse, QueryLeasesResponseSDKType, QueryLeaseRequest, QueryLeaseRequestSDKType, QueryLeaseResponse, QueryLeaseResponseSDKType } from "./query"; +/** + * Orders queries orders with filters + * @name getOrders + * @package akash.market.v1beta2 + * @see proto service: akash.market.v1beta2.Orders + */ +export const getOrders = buildQuery({ + encode: QueryOrdersRequest.encode, + decode: QueryOrdersResponse.decode, + service: "akash.market.v1beta2.Query", + method: "Orders" +}); +/** + * Order queries order details + * @name getOrder + * @package akash.market.v1beta2 + * @see proto service: akash.market.v1beta2.Order + */ +export const getOrder = buildQuery({ + encode: QueryOrderRequest.encode, + decode: QueryOrderResponse.decode, + service: "akash.market.v1beta2.Query", + method: "Order" +}); +/** + * Bids queries bids with filters + * @name getBids + * @package akash.market.v1beta2 + * @see proto service: akash.market.v1beta2.Bids + */ +export const getBids = buildQuery({ + encode: QueryBidsRequest.encode, + decode: QueryBidsResponse.decode, + service: "akash.market.v1beta2.Query", + method: "Bids" +}); +/** + * Bid queries bid details + * @name getBid + * @package akash.market.v1beta2 + * @see proto service: akash.market.v1beta2.Bid + */ +export const getBid = buildQuery({ + encode: QueryBidRequest.encode, + decode: QueryBidResponse.decode, + service: "akash.market.v1beta2.Query", + method: "Bid" +}); +/** + * Leases queries leases with filters + * @name getLeases + * @package akash.market.v1beta2 + * @see proto service: akash.market.v1beta2.Leases + */ +export const getLeases = buildQuery({ + encode: QueryLeasesRequest.encode, + decode: QueryLeasesResponse.decode, + service: "akash.market.v1beta2.Query", + method: "Leases" +}); +/** + * Lease queries lease details + * @name getLease + * @package akash.market.v1beta2 + * @see proto service: akash.market.v1beta2.Lease + */ +export const getLease = buildQuery({ + encode: QueryLeaseRequest.encode, + decode: QueryLeaseResponse.decode, + service: "akash.market.v1beta2.Query", + method: "Lease" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputosmojs/akash/market/v1beta2/service.registry.ts b/__fixtures__/v-next/outputosmojs/akash/market/v1beta2/service.registry.ts index 18b233a564..a9c57a78fb 100644 --- a/__fixtures__/v-next/outputosmojs/akash/market/v1beta2/service.registry.ts +++ b/__fixtures__/v-next/outputosmojs/akash/market/v1beta2/service.registry.ts @@ -2,13 +2,8 @@ import { OrderID, OrderIDSDKType } from "./order"; import { DecCoin, DecCoinSDKType, Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { BidID, BidIDSDKType, MsgCreateBid, MsgCreateBidSDKType, MsgCloseBid, MsgCloseBidSDKType } from "./bid"; import { LeaseID, LeaseIDSDKType, MsgWithdrawLease, MsgWithdrawLeaseSDKType, MsgCreateLease, MsgCreateLeaseSDKType, MsgCloseLease, MsgCloseLeaseSDKType } from "./lease"; -import { GeneratedType, Registry } from "@cosmjs/proto-signing"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/akash.market.v1beta2.MsgCreateBid", MsgCreateBid], ["/akash.market.v1beta2.MsgCloseBid", MsgCloseBid], ["/akash.market.v1beta2.MsgWithdrawLease", MsgWithdrawLease], ["/akash.market.v1beta2.MsgCreateLease", MsgCreateLease], ["/akash.market.v1beta2.MsgCloseLease", MsgCloseLease]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; +import { TelescopeGeneratedType } from "../../../types"; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/akash.market.v1beta2.MsgCreateBid", MsgCreateBid], ["/akash.market.v1beta2.MsgCloseBid", MsgCloseBid], ["/akash.market.v1beta2.MsgWithdrawLease", MsgWithdrawLease], ["/akash.market.v1beta2.MsgCreateLease", MsgCreateLease], ["/akash.market.v1beta2.MsgCloseLease", MsgCloseLease]]; export const MessageComposer = { encoded: { createBid(value: MsgCreateBid) { diff --git a/__fixtures__/v-next/outputosmojs/akash/market/v1beta2/service.rpc.func.ts b/__fixtures__/v-next/outputosmojs/akash/market/v1beta2/service.rpc.func.ts new file mode 100644 index 0000000000..778aff6790 --- /dev/null +++ b/__fixtures__/v-next/outputosmojs/akash/market/v1beta2/service.rpc.func.ts @@ -0,0 +1,50 @@ +import { OrderID, OrderIDSDKType } from "./order"; +import { DecCoin, DecCoinSDKType, Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; +import { BidID, BidIDSDKType, MsgCreateBid, MsgCreateBidSDKType, MsgCreateBidResponse, MsgCreateBidResponseSDKType, MsgCloseBid, MsgCloseBidSDKType, MsgCloseBidResponse, MsgCloseBidResponseSDKType } from "./bid"; +import { LeaseID, LeaseIDSDKType, MsgWithdrawLease, MsgWithdrawLeaseSDKType, MsgWithdrawLeaseResponse, MsgWithdrawLeaseResponseSDKType, MsgCreateLease, MsgCreateLeaseSDKType, MsgCreateLeaseResponse, MsgCreateLeaseResponseSDKType, MsgCloseLease, MsgCloseLeaseSDKType, MsgCloseLeaseResponse, MsgCloseLeaseResponseSDKType } from "./lease"; +import { buildTx } from "../../../helper-func-types"; +/** + * CreateBid defines a method to create a bid given proper inputs. + * @name createBid + * @package akash.market.v1beta2 + * @see proto service: akash.market.v1beta2.CreateBid + */ +export const createBid = buildTx({ + msg: MsgCreateBid +}); +/** + * CloseBid defines a method to close a bid given proper inputs. + * @name closeBid + * @package akash.market.v1beta2 + * @see proto service: akash.market.v1beta2.CloseBid + */ +export const closeBid = buildTx({ + msg: MsgCloseBid +}); +/** + * WithdrawLease withdraws accrued funds from the lease payment + * @name withdrawLease + * @package akash.market.v1beta2 + * @see proto service: akash.market.v1beta2.WithdrawLease + */ +export const withdrawLease = buildTx({ + msg: MsgWithdrawLease +}); +/** + * CreateLease creates a new lease + * @name createLease + * @package akash.market.v1beta2 + * @see proto service: akash.market.v1beta2.CreateLease + */ +export const createLease = buildTx({ + msg: MsgCreateLease +}); +/** + * CloseLease defines a method to close an order given proper inputs. + * @name closeLease + * @package akash.market.v1beta2 + * @see proto service: akash.market.v1beta2.CloseLease + */ +export const closeLease = buildTx({ + msg: MsgCloseLease +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputosmojs/akash/market/v1beta2/service.rpc.msg.ts b/__fixtures__/v-next/outputosmojs/akash/market/v1beta2/service.rpc.msg.ts index 58690c2fb1..a94cf55678 100644 --- a/__fixtures__/v-next/outputosmojs/akash/market/v1beta2/service.rpc.msg.ts +++ b/__fixtures__/v-next/outputosmojs/akash/market/v1beta2/service.rpc.msg.ts @@ -2,7 +2,7 @@ import { OrderID, OrderIDSDKType } from "./order"; import { DecCoin, DecCoinSDKType, Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { BidID, BidIDSDKType, MsgCreateBid, MsgCreateBidSDKType, MsgCreateBidResponse, MsgCreateBidResponseSDKType, MsgCloseBid, MsgCloseBidSDKType, MsgCloseBidResponse, MsgCloseBidResponseSDKType } from "./bid"; import { LeaseID, LeaseIDSDKType, MsgWithdrawLease, MsgWithdrawLeaseSDKType, MsgWithdrawLeaseResponse, MsgWithdrawLeaseResponseSDKType, MsgCreateLease, MsgCreateLeaseSDKType, MsgCreateLeaseResponse, MsgCreateLeaseResponseSDKType, MsgCloseLease, MsgCloseLeaseSDKType, MsgCloseLeaseResponse, MsgCloseLeaseResponseSDKType } from "./lease"; -import { Rpc } from "../../../helpers"; +import { TxRpc } from "../../../types"; import { BinaryReader } from "../../../binary"; /** Msg defines the market Msg service */ export interface Msg { @@ -18,8 +18,8 @@ export interface Msg { closeLease(request: MsgCloseLease): Promise; } export class MsgClientImpl implements Msg { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; } /* CreateBid defines a method to create a bid given proper inputs. */ @@ -53,6 +53,6 @@ export class MsgClientImpl implements Msg { return promise.then(data => MsgCloseLeaseResponse.decode(new BinaryReader(data))); }; } -export const createClientImpl = (rpc: Rpc) => { +export const createClientImpl = (rpc: TxRpc) => { return new MsgClientImpl(rpc); }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputosmojs/akash/provider/v1beta1/provider.registry.ts b/__fixtures__/v-next/outputosmojs/akash/provider/v1beta1/provider.registry.ts index 5762807fef..7682a6571c 100644 --- a/__fixtures__/v-next/outputosmojs/akash/provider/v1beta1/provider.registry.ts +++ b/__fixtures__/v-next/outputosmojs/akash/provider/v1beta1/provider.registry.ts @@ -1,12 +1,7 @@ import { Attribute, AttributeSDKType } from "../../base/v1beta1/attribute"; -import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { TelescopeGeneratedType } from "../../../types"; import { MsgCreateProvider, MsgCreateProviderSDKType, MsgUpdateProvider, MsgUpdateProviderSDKType, MsgDeleteProvider, MsgDeleteProviderSDKType } from "./provider"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/akash.provider.v1beta1.MsgCreateProvider", MsgCreateProvider], ["/akash.provider.v1beta1.MsgUpdateProvider", MsgUpdateProvider], ["/akash.provider.v1beta1.MsgDeleteProvider", MsgDeleteProvider]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/akash.provider.v1beta1.MsgCreateProvider", MsgCreateProvider], ["/akash.provider.v1beta1.MsgUpdateProvider", MsgUpdateProvider], ["/akash.provider.v1beta1.MsgDeleteProvider", MsgDeleteProvider]]; export const MessageComposer = { encoded: { createProvider(value: MsgCreateProvider) { diff --git a/__fixtures__/v-next/outputosmojs/akash/provider/v1beta1/provider.rpc.func.ts b/__fixtures__/v-next/outputosmojs/akash/provider/v1beta1/provider.rpc.func.ts new file mode 100644 index 0000000000..7f012148ff --- /dev/null +++ b/__fixtures__/v-next/outputosmojs/akash/provider/v1beta1/provider.rpc.func.ts @@ -0,0 +1,30 @@ +import { Attribute, AttributeSDKType } from "../../base/v1beta1/attribute"; +import { buildTx } from "../../../helper-func-types"; +import { MsgCreateProvider, MsgCreateProviderSDKType, MsgCreateProviderResponse, MsgCreateProviderResponseSDKType, MsgUpdateProvider, MsgUpdateProviderSDKType, MsgUpdateProviderResponse, MsgUpdateProviderResponseSDKType, MsgDeleteProvider, MsgDeleteProviderSDKType, MsgDeleteProviderResponse, MsgDeleteProviderResponseSDKType } from "./provider"; +/** + * CreateProvider defines a method that creates a provider given the proper inputs + * @name createProvider + * @package akash.provider.v1beta1 + * @see proto service: akash.provider.v1beta1.CreateProvider + */ +export const createProvider = buildTx({ + msg: MsgCreateProvider +}); +/** + * UpdateProvider defines a method that updates a provider given the proper inputs + * @name updateProvider + * @package akash.provider.v1beta1 + * @see proto service: akash.provider.v1beta1.UpdateProvider + */ +export const updateProvider = buildTx({ + msg: MsgUpdateProvider +}); +/** + * DeleteProvider defines a method that deletes a provider given the proper inputs + * @name deleteProvider + * @package akash.provider.v1beta1 + * @see proto service: akash.provider.v1beta1.DeleteProvider + */ +export const deleteProvider = buildTx({ + msg: MsgDeleteProvider +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputosmojs/akash/provider/v1beta1/provider.rpc.msg.ts b/__fixtures__/v-next/outputosmojs/akash/provider/v1beta1/provider.rpc.msg.ts index 624fa5f89d..daefd27f63 100644 --- a/__fixtures__/v-next/outputosmojs/akash/provider/v1beta1/provider.rpc.msg.ts +++ b/__fixtures__/v-next/outputosmojs/akash/provider/v1beta1/provider.rpc.msg.ts @@ -1,5 +1,5 @@ import { Attribute, AttributeSDKType } from "../../base/v1beta1/attribute"; -import { Rpc } from "../../../helpers"; +import { TxRpc } from "../../../types"; import { BinaryReader } from "../../../binary"; import { MsgCreateProvider, MsgCreateProviderSDKType, MsgCreateProviderResponse, MsgCreateProviderResponseSDKType, MsgUpdateProvider, MsgUpdateProviderSDKType, MsgUpdateProviderResponse, MsgUpdateProviderResponseSDKType, MsgDeleteProvider, MsgDeleteProviderSDKType, MsgDeleteProviderResponse, MsgDeleteProviderResponseSDKType } from "./provider"; /** Msg defines the provider Msg service */ @@ -12,8 +12,8 @@ export interface Msg { deleteProvider(request: MsgDeleteProvider): Promise; } export class MsgClientImpl implements Msg { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; } /* CreateProvider defines a method that creates a provider given the proper inputs */ @@ -35,6 +35,6 @@ export class MsgClientImpl implements Msg { return promise.then(data => MsgDeleteProviderResponse.decode(new BinaryReader(data))); }; } -export const createClientImpl = (rpc: Rpc) => { +export const createClientImpl = (rpc: TxRpc) => { return new MsgClientImpl(rpc); }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputosmojs/akash/provider/v1beta2/provider.registry.ts b/__fixtures__/v-next/outputosmojs/akash/provider/v1beta2/provider.registry.ts index e436157fb1..386647f173 100644 --- a/__fixtures__/v-next/outputosmojs/akash/provider/v1beta2/provider.registry.ts +++ b/__fixtures__/v-next/outputosmojs/akash/provider/v1beta2/provider.registry.ts @@ -1,12 +1,7 @@ import { Attribute, AttributeSDKType } from "../../base/v1beta2/attribute"; -import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { TelescopeGeneratedType } from "../../../types"; import { MsgCreateProvider, MsgCreateProviderSDKType, MsgUpdateProvider, MsgUpdateProviderSDKType, MsgDeleteProvider, MsgDeleteProviderSDKType } from "./provider"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/akash.provider.v1beta2.MsgCreateProvider", MsgCreateProvider], ["/akash.provider.v1beta2.MsgUpdateProvider", MsgUpdateProvider], ["/akash.provider.v1beta2.MsgDeleteProvider", MsgDeleteProvider]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/akash.provider.v1beta2.MsgCreateProvider", MsgCreateProvider], ["/akash.provider.v1beta2.MsgUpdateProvider", MsgUpdateProvider], ["/akash.provider.v1beta2.MsgDeleteProvider", MsgDeleteProvider]]; export const MessageComposer = { encoded: { createProvider(value: MsgCreateProvider) { diff --git a/__fixtures__/v-next/outputosmojs/akash/provider/v1beta2/provider.rpc.func.ts b/__fixtures__/v-next/outputosmojs/akash/provider/v1beta2/provider.rpc.func.ts new file mode 100644 index 0000000000..2bf0b72d01 --- /dev/null +++ b/__fixtures__/v-next/outputosmojs/akash/provider/v1beta2/provider.rpc.func.ts @@ -0,0 +1,30 @@ +import { Attribute, AttributeSDKType } from "../../base/v1beta2/attribute"; +import { buildTx } from "../../../helper-func-types"; +import { MsgCreateProvider, MsgCreateProviderSDKType, MsgCreateProviderResponse, MsgCreateProviderResponseSDKType, MsgUpdateProvider, MsgUpdateProviderSDKType, MsgUpdateProviderResponse, MsgUpdateProviderResponseSDKType, MsgDeleteProvider, MsgDeleteProviderSDKType, MsgDeleteProviderResponse, MsgDeleteProviderResponseSDKType } from "./provider"; +/** + * CreateProvider defines a method that creates a provider given the proper inputs + * @name createProvider + * @package akash.provider.v1beta2 + * @see proto service: akash.provider.v1beta2.CreateProvider + */ +export const createProvider = buildTx({ + msg: MsgCreateProvider +}); +/** + * UpdateProvider defines a method that updates a provider given the proper inputs + * @name updateProvider + * @package akash.provider.v1beta2 + * @see proto service: akash.provider.v1beta2.UpdateProvider + */ +export const updateProvider = buildTx({ + msg: MsgUpdateProvider +}); +/** + * DeleteProvider defines a method that deletes a provider given the proper inputs + * @name deleteProvider + * @package akash.provider.v1beta2 + * @see proto service: akash.provider.v1beta2.DeleteProvider + */ +export const deleteProvider = buildTx({ + msg: MsgDeleteProvider +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputosmojs/akash/provider/v1beta2/provider.rpc.msg.ts b/__fixtures__/v-next/outputosmojs/akash/provider/v1beta2/provider.rpc.msg.ts index c9bc693c61..7a54bc575d 100644 --- a/__fixtures__/v-next/outputosmojs/akash/provider/v1beta2/provider.rpc.msg.ts +++ b/__fixtures__/v-next/outputosmojs/akash/provider/v1beta2/provider.rpc.msg.ts @@ -1,5 +1,5 @@ import { Attribute, AttributeSDKType } from "../../base/v1beta2/attribute"; -import { Rpc } from "../../../helpers"; +import { TxRpc } from "../../../types"; import { BinaryReader } from "../../../binary"; import { MsgCreateProvider, MsgCreateProviderSDKType, MsgCreateProviderResponse, MsgCreateProviderResponseSDKType, MsgUpdateProvider, MsgUpdateProviderSDKType, MsgUpdateProviderResponse, MsgUpdateProviderResponseSDKType, MsgDeleteProvider, MsgDeleteProviderSDKType, MsgDeleteProviderResponse, MsgDeleteProviderResponseSDKType } from "./provider"; /** Msg defines the provider Msg service */ @@ -12,8 +12,8 @@ export interface Msg { deleteProvider(request: MsgDeleteProvider): Promise; } export class MsgClientImpl implements Msg { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; } /* CreateProvider defines a method that creates a provider given the proper inputs */ @@ -35,6 +35,6 @@ export class MsgClientImpl implements Msg { return promise.then(data => MsgDeleteProviderResponse.decode(new BinaryReader(data))); }; } -export const createClientImpl = (rpc: Rpc) => { +export const createClientImpl = (rpc: TxRpc) => { return new MsgClientImpl(rpc); }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputosmojs/akash/provider/v1beta2/query.rpc.Query.ts b/__fixtures__/v-next/outputosmojs/akash/provider/v1beta2/query.rpc.Query.ts index 47e6a2fbba..672f97b5b8 100644 --- a/__fixtures__/v-next/outputosmojs/akash/provider/v1beta2/query.rpc.Query.ts +++ b/__fixtures__/v-next/outputosmojs/akash/provider/v1beta2/query.rpc.Query.ts @@ -1,6 +1,6 @@ import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination"; import { Provider, ProviderSDKType } from "./provider"; -import { Rpc } from "../../../helpers"; +import { TxRpc } from "../../../types"; import { BinaryReader } from "../../../binary"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; import { QueryProvidersRequest, QueryProvidersRequestSDKType, QueryProvidersResponse, QueryProvidersResponseSDKType, QueryProviderRequest, QueryProviderRequestSDKType, QueryProviderResponse, QueryProviderResponseSDKType } from "./query"; @@ -12,8 +12,8 @@ export interface Query { provider(request: QueryProviderRequest): Promise; } export class QueryClientImpl implements Query { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; } /* Providers queries providers */ diff --git a/__fixtures__/v-next/outputosmojs/akash/provider/v1beta2/query.rpc.func.ts b/__fixtures__/v-next/outputosmojs/akash/provider/v1beta2/query.rpc.func.ts new file mode 100644 index 0000000000..56006aca31 --- /dev/null +++ b/__fixtures__/v-next/outputosmojs/akash/provider/v1beta2/query.rpc.func.ts @@ -0,0 +1,28 @@ +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination"; +import { Provider, ProviderSDKType } from "./provider"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { QueryProvidersRequest, QueryProvidersRequestSDKType, QueryProvidersResponse, QueryProvidersResponseSDKType, QueryProviderRequest, QueryProviderRequestSDKType, QueryProviderResponse, QueryProviderResponseSDKType } from "./query"; +/** + * Providers queries providers + * @name getProviders + * @package akash.provider.v1beta2 + * @see proto service: akash.provider.v1beta2.Providers + */ +export const getProviders = buildQuery({ + encode: QueryProvidersRequest.encode, + decode: QueryProvidersResponse.decode, + service: "akash.provider.v1beta2.Query", + method: "Providers" +}); +/** + * Provider queries provider details + * @name getProvider + * @package akash.provider.v1beta2 + * @see proto service: akash.provider.v1beta2.Provider + */ +export const getProvider = buildQuery({ + encode: QueryProviderRequest.encode, + decode: QueryProviderResponse.decode, + service: "akash.provider.v1beta2.Query", + method: "Provider" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputosmojs/cosmos/app/v1alpha1/query.rpc.Query.ts b/__fixtures__/v-next/outputosmojs/cosmos/app/v1alpha1/query.rpc.Query.ts index 40e5aa9bec..6d7d0f9715 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/app/v1alpha1/query.rpc.Query.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/app/v1alpha1/query.rpc.Query.ts @@ -1,5 +1,5 @@ import { Config, ConfigSDKType } from "./config"; -import { Rpc } from "../../../helpers"; +import { TxRpc } from "../../../types"; import { BinaryReader } from "../../../binary"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; import { QueryConfigRequest, QueryConfigRequestSDKType, QueryConfigResponse, QueryConfigResponseSDKType } from "./query"; @@ -9,8 +9,8 @@ export interface Query { config(request?: QueryConfigRequest): Promise; } export class QueryClientImpl implements Query { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.config = this.config.bind(this); } diff --git a/__fixtures__/v-next/outputosmojs/cosmos/app/v1alpha1/query.rpc.func.ts b/__fixtures__/v-next/outputosmojs/cosmos/app/v1alpha1/query.rpc.func.ts new file mode 100644 index 0000000000..1503803062 --- /dev/null +++ b/__fixtures__/v-next/outputosmojs/cosmos/app/v1alpha1/query.rpc.func.ts @@ -0,0 +1,15 @@ +import { Config, ConfigSDKType } from "./config"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { QueryConfigRequest, QueryConfigRequestSDKType, QueryConfigResponse, QueryConfigResponseSDKType } from "./query"; +/** + * Config returns the current app config. + * @name getConfig + * @package cosmos.app.v1alpha1 + * @see proto service: cosmos.app.v1alpha1.Config + */ +export const getConfig = buildQuery({ + encode: QueryConfigRequest.encode, + decode: QueryConfigResponse.decode, + service: "cosmos.app.v1alpha1.Query", + method: "Config" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputosmojs/cosmos/auth/v1beta1/query.rpc.Query.ts b/__fixtures__/v-next/outputosmojs/cosmos/auth/v1beta1/query.rpc.Query.ts index 9d189b93b1..de3af18fe4 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/auth/v1beta1/query.rpc.Query.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/auth/v1beta1/query.rpc.Query.ts @@ -1,7 +1,7 @@ import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; import { Any, AnySDKType } from "../../../google/protobuf/any"; import { Params, ParamsSDKType } from "./auth"; -import { Rpc } from "../../../helpers"; +import { TxRpc } from "../../../types"; import { BinaryReader } from "../../../binary"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; import { QueryAccountsRequest, QueryAccountsRequestSDKType, QueryAccountsResponse, QueryAccountsResponseSDKType, QueryAccountRequest, QueryAccountRequestSDKType, QueryAccountResponse, QueryAccountResponseSDKType, QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, QueryModuleAccountsRequest, QueryModuleAccountsRequestSDKType, QueryModuleAccountsResponse, QueryModuleAccountsResponseSDKType, Bech32PrefixRequest, Bech32PrefixRequestSDKType, Bech32PrefixResponse, Bech32PrefixResponseSDKType, AddressBytesToStringRequest, AddressBytesToStringRequestSDKType, AddressBytesToStringResponse, AddressBytesToStringResponseSDKType, AddressStringToBytesRequest, AddressStringToBytesRequestSDKType, AddressStringToBytesResponse, AddressStringToBytesResponseSDKType } from "./query"; @@ -27,8 +27,8 @@ export interface Query { addressStringToBytes(request: AddressStringToBytesRequest): Promise; } export class QueryClientImpl implements Query { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.accounts = this.accounts.bind(this); this.account = this.account.bind(this); diff --git a/__fixtures__/v-next/outputosmojs/cosmos/auth/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputosmojs/cosmos/auth/v1beta1/query.rpc.func.ts new file mode 100644 index 0000000000..cface65b7b --- /dev/null +++ b/__fixtures__/v-next/outputosmojs/cosmos/auth/v1beta1/query.rpc.func.ts @@ -0,0 +1,91 @@ +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; +import { Any, AnySDKType } from "../../../google/protobuf/any"; +import { Params, ParamsSDKType } from "./auth"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { QueryAccountsRequest, QueryAccountsRequestSDKType, QueryAccountsResponse, QueryAccountsResponseSDKType, QueryAccountRequest, QueryAccountRequestSDKType, QueryAccountResponse, QueryAccountResponseSDKType, QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, QueryModuleAccountsRequest, QueryModuleAccountsRequestSDKType, QueryModuleAccountsResponse, QueryModuleAccountsResponseSDKType, Bech32PrefixRequest, Bech32PrefixRequestSDKType, Bech32PrefixResponse, Bech32PrefixResponseSDKType, AddressBytesToStringRequest, AddressBytesToStringRequestSDKType, AddressBytesToStringResponse, AddressBytesToStringResponseSDKType, AddressStringToBytesRequest, AddressStringToBytesRequestSDKType, AddressStringToBytesResponse, AddressStringToBytesResponseSDKType } from "./query"; +/** + * Accounts returns all the existing accounts + * + * Since: cosmos-sdk 0.43 + * @name getAccounts + * @package cosmos.auth.v1beta1 + * @see proto service: cosmos.auth.v1beta1.Accounts + */ +export const getAccounts = buildQuery({ + encode: QueryAccountsRequest.encode, + decode: QueryAccountsResponse.decode, + service: "cosmos.auth.v1beta1.Query", + method: "Accounts" +}); +/** + * Account returns account details based on address. + * @name getAccount + * @package cosmos.auth.v1beta1 + * @see proto service: cosmos.auth.v1beta1.Account + */ +export const getAccount = buildQuery({ + encode: QueryAccountRequest.encode, + decode: QueryAccountResponse.decode, + service: "cosmos.auth.v1beta1.Query", + method: "Account" +}); +/** + * Params queries all parameters. + * @name getParams + * @package cosmos.auth.v1beta1 + * @see proto service: cosmos.auth.v1beta1.Params + */ +export const getParams = buildQuery({ + encode: QueryParamsRequest.encode, + decode: QueryParamsResponse.decode, + service: "cosmos.auth.v1beta1.Query", + method: "Params" +}); +/** + * ModuleAccounts returns all the existing module accounts. + * @name getModuleAccounts + * @package cosmos.auth.v1beta1 + * @see proto service: cosmos.auth.v1beta1.ModuleAccounts + */ +export const getModuleAccounts = buildQuery({ + encode: QueryModuleAccountsRequest.encode, + decode: QueryModuleAccountsResponse.decode, + service: "cosmos.auth.v1beta1.Query", + method: "ModuleAccounts" +}); +/** + * Bech32 queries bech32Prefix + * @name getBech32Prefix + * @package cosmos.auth.v1beta1 + * @see proto service: cosmos.auth.v1beta1.Bech32Prefix + */ +export const getBech32Prefix = buildQuery({ + encode: Bech32PrefixRequest.encode, + decode: Bech32PrefixResponse.decode, + service: "cosmos.auth.v1beta1.Query", + method: "Bech32Prefix" +}); +/** + * AddressBytesToString converts Account Address bytes to string + * @name getAddressBytesToString + * @package cosmos.auth.v1beta1 + * @see proto service: cosmos.auth.v1beta1.AddressBytesToString + */ +export const getAddressBytesToString = buildQuery({ + encode: AddressBytesToStringRequest.encode, + decode: AddressBytesToStringResponse.decode, + service: "cosmos.auth.v1beta1.Query", + method: "AddressBytesToString" +}); +/** + * AddressStringToBytes converts Address string to bytes + * @name getAddressStringToBytes + * @package cosmos.auth.v1beta1 + * @see proto service: cosmos.auth.v1beta1.AddressStringToBytes + */ +export const getAddressStringToBytes = buildQuery({ + encode: AddressStringToBytesRequest.encode, + decode: AddressStringToBytesResponse.decode, + service: "cosmos.auth.v1beta1.Query", + method: "AddressStringToBytes" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputosmojs/cosmos/authz/v1beta1/query.rpc.Query.ts b/__fixtures__/v-next/outputosmojs/cosmos/authz/v1beta1/query.rpc.Query.ts index 57e205e1d4..333ef38103 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/authz/v1beta1/query.rpc.Query.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/authz/v1beta1/query.rpc.Query.ts @@ -1,6 +1,6 @@ import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; import { Grant, GrantSDKType, GrantAuthorization, GrantAuthorizationSDKType } from "./authz"; -import { Rpc } from "../../../helpers"; +import { TxRpc } from "../../../types"; import { BinaryReader } from "../../../binary"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; import { QueryGrantsRequest, QueryGrantsRequestSDKType, QueryGrantsResponse, QueryGrantsResponseSDKType, QueryGranterGrantsRequest, QueryGranterGrantsRequestSDKType, QueryGranterGrantsResponse, QueryGranterGrantsResponseSDKType, QueryGranteeGrantsRequest, QueryGranteeGrantsRequestSDKType, QueryGranteeGrantsResponse, QueryGranteeGrantsResponseSDKType } from "./query"; @@ -22,8 +22,8 @@ export interface Query { granteeGrants(request: QueryGranteeGrantsRequest): Promise; } export class QueryClientImpl implements Query { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.grants = this.grants.bind(this); this.granterGrants = this.granterGrants.bind(this); diff --git a/__fixtures__/v-next/outputosmojs/cosmos/authz/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputosmojs/cosmos/authz/v1beta1/query.rpc.func.ts new file mode 100644 index 0000000000..1088892b72 --- /dev/null +++ b/__fixtures__/v-next/outputosmojs/cosmos/authz/v1beta1/query.rpc.func.ts @@ -0,0 +1,44 @@ +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; +import { Grant, GrantSDKType, GrantAuthorization, GrantAuthorizationSDKType } from "./authz"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { QueryGrantsRequest, QueryGrantsRequestSDKType, QueryGrantsResponse, QueryGrantsResponseSDKType, QueryGranterGrantsRequest, QueryGranterGrantsRequestSDKType, QueryGranterGrantsResponse, QueryGranterGrantsResponseSDKType, QueryGranteeGrantsRequest, QueryGranteeGrantsRequestSDKType, QueryGranteeGrantsResponse, QueryGranteeGrantsResponseSDKType } from "./query"; +/** + * Returns list of `Authorization`, granted to the grantee by the granter. + * @name getGrants + * @package cosmos.authz.v1beta1 + * @see proto service: cosmos.authz.v1beta1.Grants + */ +export const getGrants = buildQuery({ + encode: QueryGrantsRequest.encode, + decode: QueryGrantsResponse.decode, + service: "cosmos.authz.v1beta1.Query", + method: "Grants" +}); +/** + * GranterGrants returns list of `GrantAuthorization`, granted by granter. + * + * Since: cosmos-sdk 0.46 + * @name getGranterGrants + * @package cosmos.authz.v1beta1 + * @see proto service: cosmos.authz.v1beta1.GranterGrants + */ +export const getGranterGrants = buildQuery({ + encode: QueryGranterGrantsRequest.encode, + decode: QueryGranterGrantsResponse.decode, + service: "cosmos.authz.v1beta1.Query", + method: "GranterGrants" +}); +/** + * GranteeGrants returns a list of `GrantAuthorization` by grantee. + * + * Since: cosmos-sdk 0.46 + * @name getGranteeGrants + * @package cosmos.authz.v1beta1 + * @see proto service: cosmos.authz.v1beta1.GranteeGrants + */ +export const getGranteeGrants = buildQuery({ + encode: QueryGranteeGrantsRequest.encode, + decode: QueryGranteeGrantsResponse.decode, + service: "cosmos.authz.v1beta1.Query", + method: "GranteeGrants" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputosmojs/cosmos/authz/v1beta1/tx.registry.ts b/__fixtures__/v-next/outputosmojs/cosmos/authz/v1beta1/tx.registry.ts index 273cecc9e3..4fed700d50 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/authz/v1beta1/tx.registry.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/authz/v1beta1/tx.registry.ts @@ -1,13 +1,8 @@ import { Grant, GrantSDKType } from "./authz"; import { Any, AnySDKType } from "../../../google/protobuf/any"; -import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { TelescopeGeneratedType } from "../../../types"; import { MsgGrant, MsgGrantSDKType, MsgExec, MsgExecSDKType, MsgRevoke, MsgRevokeSDKType } from "./tx"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/cosmos.authz.v1beta1.MsgGrant", MsgGrant], ["/cosmos.authz.v1beta1.MsgExec", MsgExec], ["/cosmos.authz.v1beta1.MsgRevoke", MsgRevoke]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/cosmos.authz.v1beta1.MsgGrant", MsgGrant], ["/cosmos.authz.v1beta1.MsgExec", MsgExec], ["/cosmos.authz.v1beta1.MsgRevoke", MsgRevoke]]; export const MessageComposer = { encoded: { grant(value: MsgGrant) { diff --git a/__fixtures__/v-next/outputosmojs/cosmos/authz/v1beta1/tx.rpc.func.ts b/__fixtures__/v-next/outputosmojs/cosmos/authz/v1beta1/tx.rpc.func.ts new file mode 100644 index 0000000000..7f9d1ce40c --- /dev/null +++ b/__fixtures__/v-next/outputosmojs/cosmos/authz/v1beta1/tx.rpc.func.ts @@ -0,0 +1,37 @@ +import { Grant, GrantSDKType } from "./authz"; +import { Any, AnySDKType } from "../../../google/protobuf/any"; +import { buildTx } from "../../../helper-func-types"; +import { MsgGrant, MsgGrantSDKType, MsgGrantResponse, MsgGrantResponseSDKType, MsgExec, MsgExecSDKType, MsgExecResponse, MsgExecResponseSDKType, MsgRevoke, MsgRevokeSDKType, MsgRevokeResponse, MsgRevokeResponseSDKType } from "./tx"; +/** + * Grant grants the provided authorization to the grantee on the granter's + * account with the provided expiration time. If there is already a grant + * for the given (granter, grantee, Authorization) triple, then the grant + * will be overwritten. + * @name grant + * @package cosmos.authz.v1beta1 + * @see proto service: cosmos.authz.v1beta1.Grant + */ +export const grant = buildTx({ + msg: MsgGrant +}); +/** + * Exec attempts to execute the provided messages using + * authorizations granted to the grantee. Each message should have only + * one signer corresponding to the granter of the authorization. + * @name exec + * @package cosmos.authz.v1beta1 + * @see proto service: cosmos.authz.v1beta1.Exec + */ +export const exec = buildTx({ + msg: MsgExec +}); +/** + * Revoke revokes any authorization corresponding to the provided method name on the + * granter's account that has been granted to the grantee. + * @name revoke + * @package cosmos.authz.v1beta1 + * @see proto service: cosmos.authz.v1beta1.Revoke + */ +export const revoke = buildTx({ + msg: MsgRevoke +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputosmojs/cosmos/authz/v1beta1/tx.rpc.msg.ts b/__fixtures__/v-next/outputosmojs/cosmos/authz/v1beta1/tx.rpc.msg.ts index 9f6a262bfb..51d6fc716d 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/authz/v1beta1/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/authz/v1beta1/tx.rpc.msg.ts @@ -1,6 +1,6 @@ import { Grant, GrantSDKType } from "./authz"; import { Any, AnySDKType } from "../../../google/protobuf/any"; -import { Rpc } from "../../../helpers"; +import { TxRpc } from "../../../types"; import { BinaryReader } from "../../../binary"; import { MsgGrant, MsgGrantSDKType, MsgGrantResponse, MsgGrantResponseSDKType, MsgExec, MsgExecSDKType, MsgExecResponse, MsgExecResponseSDKType, MsgRevoke, MsgRevokeSDKType, MsgRevokeResponse, MsgRevokeResponseSDKType } from "./tx"; /** Msg defines the authz Msg service. */ @@ -25,8 +25,8 @@ export interface Msg { revoke(request: MsgRevoke): Promise; } export class MsgClientImpl implements Msg { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.grant = this.grant.bind(this); this.exec = this.exec.bind(this); @@ -48,6 +48,6 @@ export class MsgClientImpl implements Msg { return promise.then(data => MsgRevokeResponse.decode(new BinaryReader(data))); } } -export const createClientImpl = (rpc: Rpc) => { +export const createClientImpl = (rpc: TxRpc) => { return new MsgClientImpl(rpc); }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputosmojs/cosmos/bank/v1beta1/query.rpc.Query.ts b/__fixtures__/v-next/outputosmojs/cosmos/bank/v1beta1/query.rpc.Query.ts index 157ad7e411..6ec481dcc2 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/bank/v1beta1/query.rpc.Query.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/bank/v1beta1/query.rpc.Query.ts @@ -1,7 +1,7 @@ import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; import { Params, ParamsSDKType, Metadata, MetadataSDKType } from "./bank"; -import { Rpc } from "../../../helpers"; +import { TxRpc } from "../../../types"; import { BinaryReader } from "../../../binary"; import { QueryClient, createProtobufRpcClient, ProtobufRpcClient } from "@cosmjs/stargate"; import { ReactQueryParams } from "../../../react-query"; @@ -38,8 +38,8 @@ export interface Query { denomOwners(request: QueryDenomOwnersRequest): Promise; } export class QueryClientImpl implements Query { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.balance = this.balance.bind(this); this.allBalances = this.allBalances.bind(this); diff --git a/__fixtures__/v-next/outputosmojs/cosmos/bank/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputosmojs/cosmos/bank/v1beta1/query.rpc.func.ts new file mode 100644 index 0000000000..82263d9de8 --- /dev/null +++ b/__fixtures__/v-next/outputosmojs/cosmos/bank/v1beta1/query.rpc.func.ts @@ -0,0 +1,116 @@ +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; +import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; +import { Params, ParamsSDKType, Metadata, MetadataSDKType } from "./bank"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { QueryBalanceRequest, QueryBalanceRequestSDKType, QueryBalanceResponse, QueryBalanceResponseSDKType, QueryAllBalancesRequest, QueryAllBalancesRequestSDKType, QueryAllBalancesResponse, QueryAllBalancesResponseSDKType, QuerySpendableBalancesRequest, QuerySpendableBalancesRequestSDKType, QuerySpendableBalancesResponse, QuerySpendableBalancesResponseSDKType, QueryTotalSupplyRequest, QueryTotalSupplyRequestSDKType, QueryTotalSupplyResponse, QueryTotalSupplyResponseSDKType, QuerySupplyOfRequest, QuerySupplyOfRequestSDKType, QuerySupplyOfResponse, QuerySupplyOfResponseSDKType, QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, QueryDenomMetadataRequest, QueryDenomMetadataRequestSDKType, QueryDenomMetadataResponse, QueryDenomMetadataResponseSDKType, QueryDenomsMetadataRequest, QueryDenomsMetadataRequestSDKType, QueryDenomsMetadataResponse, QueryDenomsMetadataResponseSDKType, QueryDenomOwnersRequest, QueryDenomOwnersRequestSDKType, QueryDenomOwnersResponse, QueryDenomOwnersResponseSDKType } from "./query"; +/** + * Balance queries the balance of a single coin for a single account. + * @name getBalance + * @package cosmos.bank.v1beta1 + * @see proto service: cosmos.bank.v1beta1.Balance + */ +export const getBalance = buildQuery({ + encode: QueryBalanceRequest.encode, + decode: QueryBalanceResponse.decode, + service: "cosmos.bank.v1beta1.Query", + method: "Balance" +}); +/** + * AllBalances queries the balance of all coins for a single account. + * @name getAllBalances + * @package cosmos.bank.v1beta1 + * @see proto service: cosmos.bank.v1beta1.AllBalances + */ +export const getAllBalances = buildQuery({ + encode: QueryAllBalancesRequest.encode, + decode: QueryAllBalancesResponse.decode, + service: "cosmos.bank.v1beta1.Query", + method: "AllBalances" +}); +/** + * SpendableBalances queries the spenable balance of all coins for a single + * account. + * @name getSpendableBalances + * @package cosmos.bank.v1beta1 + * @see proto service: cosmos.bank.v1beta1.SpendableBalances + */ +export const getSpendableBalances = buildQuery({ + encode: QuerySpendableBalancesRequest.encode, + decode: QuerySpendableBalancesResponse.decode, + service: "cosmos.bank.v1beta1.Query", + method: "SpendableBalances" +}); +/** + * TotalSupply queries the total supply of all coins. + * @name getTotalSupply + * @package cosmos.bank.v1beta1 + * @see proto service: cosmos.bank.v1beta1.TotalSupply + */ +export const getTotalSupply = buildQuery({ + encode: QueryTotalSupplyRequest.encode, + decode: QueryTotalSupplyResponse.decode, + service: "cosmos.bank.v1beta1.Query", + method: "TotalSupply" +}); +/** + * SupplyOf queries the supply of a single coin. + * @name getSupplyOf + * @package cosmos.bank.v1beta1 + * @see proto service: cosmos.bank.v1beta1.SupplyOf + */ +export const getSupplyOf = buildQuery({ + encode: QuerySupplyOfRequest.encode, + decode: QuerySupplyOfResponse.decode, + service: "cosmos.bank.v1beta1.Query", + method: "SupplyOf" +}); +/** + * Params queries the parameters of x/bank module. + * @name getParams + * @package cosmos.bank.v1beta1 + * @see proto service: cosmos.bank.v1beta1.Params + */ +export const getParams = buildQuery({ + encode: QueryParamsRequest.encode, + decode: QueryParamsResponse.decode, + service: "cosmos.bank.v1beta1.Query", + method: "Params" +}); +/** + * DenomsMetadata queries the client metadata of a given coin denomination. + * @name getDenomMetadata + * @package cosmos.bank.v1beta1 + * @see proto service: cosmos.bank.v1beta1.DenomMetadata + */ +export const getDenomMetadata = buildQuery({ + encode: QueryDenomMetadataRequest.encode, + decode: QueryDenomMetadataResponse.decode, + service: "cosmos.bank.v1beta1.Query", + method: "DenomMetadata" +}); +/** + * DenomsMetadata queries the client metadata for all registered coin + * denominations. + * @name getDenomsMetadata + * @package cosmos.bank.v1beta1 + * @see proto service: cosmos.bank.v1beta1.DenomsMetadata + */ +export const getDenomsMetadata = buildQuery({ + encode: QueryDenomsMetadataRequest.encode, + decode: QueryDenomsMetadataResponse.decode, + service: "cosmos.bank.v1beta1.Query", + method: "DenomsMetadata" +}); +/** + * DenomOwners queries for all account addresses that own a particular token + * denomination. + * @name getDenomOwners + * @package cosmos.bank.v1beta1 + * @see proto service: cosmos.bank.v1beta1.DenomOwners + */ +export const getDenomOwners = buildQuery({ + encode: QueryDenomOwnersRequest.encode, + decode: QueryDenomOwnersResponse.decode, + service: "cosmos.bank.v1beta1.Query", + method: "DenomOwners" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputosmojs/cosmos/bank/v1beta1/tx.registry.ts b/__fixtures__/v-next/outputosmojs/cosmos/bank/v1beta1/tx.registry.ts index 0bd58f9efc..3bd1884e0d 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/bank/v1beta1/tx.registry.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/bank/v1beta1/tx.registry.ts @@ -1,13 +1,8 @@ import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; import { Input, InputSDKType, Output, OutputSDKType } from "./bank"; -import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { TelescopeGeneratedType } from "../../../types"; import { MsgSend, MsgSendSDKType, MsgMultiSend, MsgMultiSendSDKType } from "./tx"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/cosmos.bank.v1beta1.MsgSend", MsgSend], ["/cosmos.bank.v1beta1.MsgMultiSend", MsgMultiSend]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/cosmos.bank.v1beta1.MsgSend", MsgSend], ["/cosmos.bank.v1beta1.MsgMultiSend", MsgMultiSend]]; export const MessageComposer = { encoded: { send(value: MsgSend) { diff --git a/__fixtures__/v-next/outputosmojs/cosmos/bank/v1beta1/tx.rpc.func.ts b/__fixtures__/v-next/outputosmojs/cosmos/bank/v1beta1/tx.rpc.func.ts new file mode 100644 index 0000000000..3c274e156d --- /dev/null +++ b/__fixtures__/v-next/outputosmojs/cosmos/bank/v1beta1/tx.rpc.func.ts @@ -0,0 +1,22 @@ +import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; +import { Input, InputSDKType, Output, OutputSDKType } from "./bank"; +import { buildTx } from "../../../helper-func-types"; +import { MsgSend, MsgSendSDKType, MsgSendResponse, MsgSendResponseSDKType, MsgMultiSend, MsgMultiSendSDKType, MsgMultiSendResponse, MsgMultiSendResponseSDKType } from "./tx"; +/** + * Send defines a method for sending coins from one account to another account. + * @name send + * @package cosmos.bank.v1beta1 + * @see proto service: cosmos.bank.v1beta1.Send + */ +export const send = buildTx({ + msg: MsgSend +}); +/** + * MultiSend defines a method for sending coins from some accounts to other accounts. + * @name multiSend + * @package cosmos.bank.v1beta1 + * @see proto service: cosmos.bank.v1beta1.MultiSend + */ +export const multiSend = buildTx({ + msg: MsgMultiSend +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputosmojs/cosmos/bank/v1beta1/tx.rpc.msg.ts b/__fixtures__/v-next/outputosmojs/cosmos/bank/v1beta1/tx.rpc.msg.ts index 252d95dc7d..e87fe87df9 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/bank/v1beta1/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/bank/v1beta1/tx.rpc.msg.ts @@ -1,6 +1,6 @@ import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; import { Input, InputSDKType, Output, OutputSDKType } from "./bank"; -import { Rpc } from "../../../helpers"; +import { TxRpc } from "../../../types"; import { BinaryReader } from "../../../binary"; import { MsgSend, MsgSendSDKType, MsgSendResponse, MsgSendResponseSDKType, MsgMultiSend, MsgMultiSendSDKType, MsgMultiSendResponse, MsgMultiSendResponseSDKType } from "./tx"; /** Msg defines the bank Msg service. */ @@ -11,8 +11,8 @@ export interface Msg { multiSend(request: MsgMultiSend): Promise; } export class MsgClientImpl implements Msg { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.send = this.send.bind(this); this.multiSend = this.multiSend.bind(this); @@ -28,6 +28,6 @@ export class MsgClientImpl implements Msg { return promise.then(data => MsgMultiSendResponse.decode(new BinaryReader(data))); } } -export const createClientImpl = (rpc: Rpc) => { +export const createClientImpl = (rpc: TxRpc) => { return new MsgClientImpl(rpc); }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputosmojs/cosmos/base/node/v1beta1/query.rpc.Service.ts b/__fixtures__/v-next/outputosmojs/cosmos/base/node/v1beta1/query.rpc.Service.ts index 3c6058c257..1917e8ba48 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/base/node/v1beta1/query.rpc.Service.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/base/node/v1beta1/query.rpc.Service.ts @@ -1,4 +1,4 @@ -import { Rpc } from "../../../../helpers"; +import { TxRpc } from "../../../../types"; import { BinaryReader } from "../../../../binary"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; import { ConfigRequest, ConfigRequestSDKType, ConfigResponse, ConfigResponseSDKType } from "./query"; @@ -8,8 +8,8 @@ export interface Service { config(request?: ConfigRequest): Promise; } export class ServiceClientImpl implements Service { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.config = this.config.bind(this); } diff --git a/__fixtures__/v-next/outputosmojs/cosmos/base/node/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputosmojs/cosmos/base/node/v1beta1/query.rpc.func.ts new file mode 100644 index 0000000000..ee63c5781b --- /dev/null +++ b/__fixtures__/v-next/outputosmojs/cosmos/base/node/v1beta1/query.rpc.func.ts @@ -0,0 +1,14 @@ +import { EndpointOrRpc, buildQuery } from "../../../../helper-func-types"; +import { ConfigRequest, ConfigRequestSDKType, ConfigResponse, ConfigResponseSDKType } from "./query"; +/** + * Config queries for the operator configuration. + * @name getConfig + * @package cosmos.base.node.v1beta1 + * @see proto service: cosmos.base.node.v1beta1.Config + */ +export const getConfig = buildQuery({ + encode: ConfigRequest.encode, + decode: ConfigResponse.decode, + service: "cosmos.base.node.v1beta1.Service", + method: "Config" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputosmojs/cosmos/base/reflection/v1beta1/reflection.rpc.ReflectionService.ts b/__fixtures__/v-next/outputosmojs/cosmos/base/reflection/v1beta1/reflection.rpc.ReflectionService.ts index 0a2876d475..146ecaddaa 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/base/reflection/v1beta1/reflection.rpc.ReflectionService.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/base/reflection/v1beta1/reflection.rpc.ReflectionService.ts @@ -1,4 +1,4 @@ -import { Rpc } from "../../../../helpers"; +import { TxRpc } from "../../../../types"; import { BinaryReader } from "../../../../binary"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; import { ListAllInterfacesRequest, ListAllInterfacesRequestSDKType, ListAllInterfacesResponse, ListAllInterfacesResponseSDKType, ListImplementationsRequest, ListImplementationsRequestSDKType, ListImplementationsResponse, ListImplementationsResponseSDKType } from "./reflection"; @@ -16,8 +16,8 @@ export interface ReflectionService { listImplementations(request: ListImplementationsRequest): Promise; } export class ReflectionServiceClientImpl implements ReflectionService { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.listAllInterfaces = this.listAllInterfaces.bind(this); this.listImplementations = this.listImplementations.bind(this); diff --git a/__fixtures__/v-next/outputosmojs/cosmos/base/reflection/v1beta1/reflection.rpc.func.ts b/__fixtures__/v-next/outputosmojs/cosmos/base/reflection/v1beta1/reflection.rpc.func.ts new file mode 100644 index 0000000000..457419f04b --- /dev/null +++ b/__fixtures__/v-next/outputosmojs/cosmos/base/reflection/v1beta1/reflection.rpc.func.ts @@ -0,0 +1,28 @@ +import { EndpointOrRpc, buildQuery } from "../../../../helper-func-types"; +import { ListAllInterfacesRequest, ListAllInterfacesRequestSDKType, ListAllInterfacesResponse, ListAllInterfacesResponseSDKType, ListImplementationsRequest, ListImplementationsRequestSDKType, ListImplementationsResponse, ListImplementationsResponseSDKType } from "./reflection"; +/** + * ListAllInterfaces lists all the interfaces registered in the interface + * registry. + * @name getListAllInterfaces + * @package cosmos.base.reflection.v1beta1 + * @see proto service: cosmos.base.reflection.v1beta1.ListAllInterfaces + */ +export const getListAllInterfaces = buildQuery({ + encode: ListAllInterfacesRequest.encode, + decode: ListAllInterfacesResponse.decode, + service: "cosmos.base.reflection.v1beta1.ReflectionService", + method: "ListAllInterfaces" +}); +/** + * ListImplementations list all the concrete types that implement a given + * interface. + * @name getListImplementations + * @package cosmos.base.reflection.v1beta1 + * @see proto service: cosmos.base.reflection.v1beta1.ListImplementations + */ +export const getListImplementations = buildQuery({ + encode: ListImplementationsRequest.encode, + decode: ListImplementationsResponse.decode, + service: "cosmos.base.reflection.v1beta1.ReflectionService", + method: "ListImplementations" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputosmojs/cosmos/base/reflection/v2alpha1/reflection.rpc.ReflectionService.ts b/__fixtures__/v-next/outputosmojs/cosmos/base/reflection/v2alpha1/reflection.rpc.ReflectionService.ts index 51a2e52526..d77e5f637a 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/base/reflection/v2alpha1/reflection.rpc.ReflectionService.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/base/reflection/v2alpha1/reflection.rpc.ReflectionService.ts @@ -1,4 +1,4 @@ -import { Rpc } from "../../../../helpers"; +import { TxRpc } from "../../../../types"; import { BinaryReader } from "../../../../binary"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; import { GetAuthnDescriptorRequest, GetAuthnDescriptorRequestSDKType, GetAuthnDescriptorResponse, GetAuthnDescriptorResponseSDKType, GetChainDescriptorRequest, GetChainDescriptorRequestSDKType, GetChainDescriptorResponse, GetChainDescriptorResponseSDKType, GetCodecDescriptorRequest, GetCodecDescriptorRequestSDKType, GetCodecDescriptorResponse, GetCodecDescriptorResponseSDKType, GetConfigurationDescriptorRequest, GetConfigurationDescriptorRequestSDKType, GetConfigurationDescriptorResponse, GetConfigurationDescriptorResponseSDKType, GetQueryServicesDescriptorRequest, GetQueryServicesDescriptorRequestSDKType, GetQueryServicesDescriptorResponse, GetQueryServicesDescriptorResponseSDKType, GetTxDescriptorRequest, GetTxDescriptorRequestSDKType, GetTxDescriptorResponse, GetTxDescriptorResponseSDKType } from "./reflection"; @@ -22,8 +22,8 @@ export interface ReflectionService { getTxDescriptor(request?: GetTxDescriptorRequest): Promise; } export class ReflectionServiceClientImpl implements ReflectionService { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.getAuthnDescriptor = this.getAuthnDescriptor.bind(this); this.getChainDescriptor = this.getChainDescriptor.bind(this); diff --git a/__fixtures__/v-next/outputosmojs/cosmos/base/reflection/v2alpha1/reflection.rpc.func.ts b/__fixtures__/v-next/outputosmojs/cosmos/base/reflection/v2alpha1/reflection.rpc.func.ts new file mode 100644 index 0000000000..98ce9c04a0 --- /dev/null +++ b/__fixtures__/v-next/outputosmojs/cosmos/base/reflection/v2alpha1/reflection.rpc.func.ts @@ -0,0 +1,76 @@ +import { EndpointOrRpc, buildQuery } from "../../../../helper-func-types"; +import { GetAuthnDescriptorRequest, GetAuthnDescriptorRequestSDKType, GetAuthnDescriptorResponse, GetAuthnDescriptorResponseSDKType, GetChainDescriptorRequest, GetChainDescriptorRequestSDKType, GetChainDescriptorResponse, GetChainDescriptorResponseSDKType, GetCodecDescriptorRequest, GetCodecDescriptorRequestSDKType, GetCodecDescriptorResponse, GetCodecDescriptorResponseSDKType, GetConfigurationDescriptorRequest, GetConfigurationDescriptorRequestSDKType, GetConfigurationDescriptorResponse, GetConfigurationDescriptorResponseSDKType, GetQueryServicesDescriptorRequest, GetQueryServicesDescriptorRequestSDKType, GetQueryServicesDescriptorResponse, GetQueryServicesDescriptorResponseSDKType, GetTxDescriptorRequest, GetTxDescriptorRequestSDKType, GetTxDescriptorResponse, GetTxDescriptorResponseSDKType } from "./reflection"; +/** + * GetAuthnDescriptor returns information on how to authenticate transactions in the application + * NOTE: this RPC is still experimental and might be subject to breaking changes or removal in + * future releases of the cosmos-sdk. + * @name getGetAuthnDescriptor + * @package cosmos.base.reflection.v2alpha1 + * @see proto service: cosmos.base.reflection.v2alpha1.GetAuthnDescriptor + */ +export const getGetAuthnDescriptor = buildQuery({ + encode: GetAuthnDescriptorRequest.encode, + decode: GetAuthnDescriptorResponse.decode, + service: "cosmos.base.reflection.v2alpha1.ReflectionService", + method: "GetAuthnDescriptor" +}); +/** + * GetChainDescriptor returns the description of the chain + * @name getGetChainDescriptor + * @package cosmos.base.reflection.v2alpha1 + * @see proto service: cosmos.base.reflection.v2alpha1.GetChainDescriptor + */ +export const getGetChainDescriptor = buildQuery({ + encode: GetChainDescriptorRequest.encode, + decode: GetChainDescriptorResponse.decode, + service: "cosmos.base.reflection.v2alpha1.ReflectionService", + method: "GetChainDescriptor" +}); +/** + * GetCodecDescriptor returns the descriptor of the codec of the application + * @name getGetCodecDescriptor + * @package cosmos.base.reflection.v2alpha1 + * @see proto service: cosmos.base.reflection.v2alpha1.GetCodecDescriptor + */ +export const getGetCodecDescriptor = buildQuery({ + encode: GetCodecDescriptorRequest.encode, + decode: GetCodecDescriptorResponse.decode, + service: "cosmos.base.reflection.v2alpha1.ReflectionService", + method: "GetCodecDescriptor" +}); +/** + * GetConfigurationDescriptor returns the descriptor for the sdk.Config of the application + * @name getGetConfigurationDescriptor + * @package cosmos.base.reflection.v2alpha1 + * @see proto service: cosmos.base.reflection.v2alpha1.GetConfigurationDescriptor + */ +export const getGetConfigurationDescriptor = buildQuery({ + encode: GetConfigurationDescriptorRequest.encode, + decode: GetConfigurationDescriptorResponse.decode, + service: "cosmos.base.reflection.v2alpha1.ReflectionService", + method: "GetConfigurationDescriptor" +}); +/** + * GetQueryServicesDescriptor returns the available gRPC queryable services of the application + * @name getGetQueryServicesDescriptor + * @package cosmos.base.reflection.v2alpha1 + * @see proto service: cosmos.base.reflection.v2alpha1.GetQueryServicesDescriptor + */ +export const getGetQueryServicesDescriptor = buildQuery({ + encode: GetQueryServicesDescriptorRequest.encode, + decode: GetQueryServicesDescriptorResponse.decode, + service: "cosmos.base.reflection.v2alpha1.ReflectionService", + method: "GetQueryServicesDescriptor" +}); +/** + * GetTxDescriptor returns information on the used transaction object and available msgs that can be used + * @name getGetTxDescriptor + * @package cosmos.base.reflection.v2alpha1 + * @see proto service: cosmos.base.reflection.v2alpha1.GetTxDescriptor + */ +export const getGetTxDescriptor = buildQuery({ + encode: GetTxDescriptorRequest.encode, + decode: GetTxDescriptorResponse.decode, + service: "cosmos.base.reflection.v2alpha1.ReflectionService", + method: "GetTxDescriptor" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputosmojs/cosmos/base/tendermint/v1beta1/query.rpc.Service.ts b/__fixtures__/v-next/outputosmojs/cosmos/base/tendermint/v1beta1/query.rpc.Service.ts index 2d426d3d4c..289551f4e4 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/base/tendermint/v1beta1/query.rpc.Service.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/base/tendermint/v1beta1/query.rpc.Service.ts @@ -3,7 +3,7 @@ import { Any, AnySDKType } from "../../../../google/protobuf/any"; import { BlockID, BlockIDSDKType } from "../../../../tendermint/types/types"; import { Block, BlockSDKType } from "../../../../tendermint/types/block"; import { NodeInfo, NodeInfoSDKType } from "../../../../tendermint/p2p/types"; -import { Rpc } from "../../../../helpers"; +import { TxRpc } from "../../../../types"; import { BinaryReader } from "../../../../binary"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; import { GetNodeInfoRequest, GetNodeInfoRequestSDKType, GetNodeInfoResponse, GetNodeInfoResponseSDKType, GetSyncingRequest, GetSyncingRequestSDKType, GetSyncingResponse, GetSyncingResponseSDKType, GetLatestBlockRequest, GetLatestBlockRequestSDKType, GetLatestBlockResponse, GetLatestBlockResponseSDKType, GetBlockByHeightRequest, GetBlockByHeightRequestSDKType, GetBlockByHeightResponse, GetBlockByHeightResponseSDKType, GetLatestValidatorSetRequest, GetLatestValidatorSetRequestSDKType, GetLatestValidatorSetResponse, GetLatestValidatorSetResponseSDKType, GetValidatorSetByHeightRequest, GetValidatorSetByHeightRequestSDKType, GetValidatorSetByHeightResponse, GetValidatorSetByHeightResponseSDKType } from "./query"; @@ -23,8 +23,8 @@ export interface Service { getValidatorSetByHeight(request: GetValidatorSetByHeightRequest): Promise; } export class ServiceClientImpl implements Service { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.getNodeInfo = this.getNodeInfo.bind(this); this.getSyncing = this.getSyncing.bind(this); diff --git a/__fixtures__/v-next/outputosmojs/cosmos/base/tendermint/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputosmojs/cosmos/base/tendermint/v1beta1/query.rpc.func.ts new file mode 100644 index 0000000000..4710fdb42e --- /dev/null +++ b/__fixtures__/v-next/outputosmojs/cosmos/base/tendermint/v1beta1/query.rpc.func.ts @@ -0,0 +1,79 @@ +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../query/v1beta1/pagination"; +import { Any, AnySDKType } from "../../../../google/protobuf/any"; +import { BlockID, BlockIDSDKType } from "../../../../tendermint/types/types"; +import { Block, BlockSDKType } from "../../../../tendermint/types/block"; +import { NodeInfo, NodeInfoSDKType } from "../../../../tendermint/p2p/types"; +import { EndpointOrRpc, buildQuery } from "../../../../helper-func-types"; +import { GetNodeInfoRequest, GetNodeInfoRequestSDKType, GetNodeInfoResponse, GetNodeInfoResponseSDKType, GetSyncingRequest, GetSyncingRequestSDKType, GetSyncingResponse, GetSyncingResponseSDKType, GetLatestBlockRequest, GetLatestBlockRequestSDKType, GetLatestBlockResponse, GetLatestBlockResponseSDKType, GetBlockByHeightRequest, GetBlockByHeightRequestSDKType, GetBlockByHeightResponse, GetBlockByHeightResponseSDKType, GetLatestValidatorSetRequest, GetLatestValidatorSetRequestSDKType, GetLatestValidatorSetResponse, GetLatestValidatorSetResponseSDKType, GetValidatorSetByHeightRequest, GetValidatorSetByHeightRequestSDKType, GetValidatorSetByHeightResponse, GetValidatorSetByHeightResponseSDKType } from "./query"; +/** + * GetNodeInfo queries the current node info. + * @name getGetNodeInfo + * @package cosmos.base.tendermint.v1beta1 + * @see proto service: cosmos.base.tendermint.v1beta1.GetNodeInfo + */ +export const getGetNodeInfo = buildQuery({ + encode: GetNodeInfoRequest.encode, + decode: GetNodeInfoResponse.decode, + service: "cosmos.base.tendermint.v1beta1.Service", + method: "GetNodeInfo" +}); +/** + * GetSyncing queries node syncing. + * @name getGetSyncing + * @package cosmos.base.tendermint.v1beta1 + * @see proto service: cosmos.base.tendermint.v1beta1.GetSyncing + */ +export const getGetSyncing = buildQuery({ + encode: GetSyncingRequest.encode, + decode: GetSyncingResponse.decode, + service: "cosmos.base.tendermint.v1beta1.Service", + method: "GetSyncing" +}); +/** + * GetLatestBlock returns the latest block. + * @name getGetLatestBlock + * @package cosmos.base.tendermint.v1beta1 + * @see proto service: cosmos.base.tendermint.v1beta1.GetLatestBlock + */ +export const getGetLatestBlock = buildQuery({ + encode: GetLatestBlockRequest.encode, + decode: GetLatestBlockResponse.decode, + service: "cosmos.base.tendermint.v1beta1.Service", + method: "GetLatestBlock" +}); +/** + * GetBlockByHeight queries block for given height. + * @name getGetBlockByHeight + * @package cosmos.base.tendermint.v1beta1 + * @see proto service: cosmos.base.tendermint.v1beta1.GetBlockByHeight + */ +export const getGetBlockByHeight = buildQuery({ + encode: GetBlockByHeightRequest.encode, + decode: GetBlockByHeightResponse.decode, + service: "cosmos.base.tendermint.v1beta1.Service", + method: "GetBlockByHeight" +}); +/** + * GetLatestValidatorSet queries latest validator-set. + * @name getGetLatestValidatorSet + * @package cosmos.base.tendermint.v1beta1 + * @see proto service: cosmos.base.tendermint.v1beta1.GetLatestValidatorSet + */ +export const getGetLatestValidatorSet = buildQuery({ + encode: GetLatestValidatorSetRequest.encode, + decode: GetLatestValidatorSetResponse.decode, + service: "cosmos.base.tendermint.v1beta1.Service", + method: "GetLatestValidatorSet" +}); +/** + * GetValidatorSetByHeight queries validator-set at a given height. + * @name getGetValidatorSetByHeight + * @package cosmos.base.tendermint.v1beta1 + * @see proto service: cosmos.base.tendermint.v1beta1.GetValidatorSetByHeight + */ +export const getGetValidatorSetByHeight = buildQuery({ + encode: GetValidatorSetByHeightRequest.encode, + decode: GetValidatorSetByHeightResponse.decode, + service: "cosmos.base.tendermint.v1beta1.Service", + method: "GetValidatorSetByHeight" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputosmojs/cosmos/base/v1beta1/coin.ts b/__fixtures__/v-next/outputosmojs/cosmos/base/v1beta1/coin.ts index 29592ef49d..75a9d89bb4 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/base/v1beta1/coin.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/base/v1beta1/coin.ts @@ -1,7 +1,7 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; import { isSet, DeepPartial } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; -import { Decimal } from "@cosmjs/math"; +import { Decimal } from "@interchainjs/math"; export const protobufPackage = "cosmos.base.v1beta1"; /** * Coin defines a token with a denomination and an amount. @@ -322,7 +322,7 @@ export const DecCoin = { toAmino(message: DecCoin): DecCoinAmino { const obj: any = {}; obj.denom = message.denom === "" ? undefined : message.denom; - obj.amount = message.amount === "" ? undefined : message.amount; + obj.amount = message.amount === "" ? undefined : Decimal.fromUserInput(message.amount, 18).atomics; return obj; }, fromAminoMsg(object: DecCoinAminoMsg): DecCoin { @@ -522,7 +522,7 @@ export const DecProto = { }, toAmino(message: DecProto): DecProtoAmino { const obj: any = {}; - obj.dec = message.dec === "" ? undefined : message.dec; + obj.dec = message.dec === "" ? undefined : Decimal.fromUserInput(message.dec, 18).atomics; return obj; }, fromAminoMsg(object: DecProtoAminoMsg): DecProto { diff --git a/__fixtures__/v-next/outputosmojs/cosmos/bundle.ts b/__fixtures__/v-next/outputosmojs/cosmos/bundle.ts index 4cf37a4974..044c3a37a6 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/bundle.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/bundle.ts @@ -92,101 +92,137 @@ import * as _145 from "./upgrade/v1beta1/upgrade"; import * as _146 from "./vesting/v1beta1/tx"; import * as _147 from "./vesting/v1beta1/vesting"; import * as _148 from "./ics23/v1/proofs"; -import * as _403 from "./authz/v1beta1/tx.amino"; -import * as _404 from "./bank/v1beta1/tx.amino"; -import * as _405 from "./crisis/v1beta1/tx.amino"; -import * as _406 from "./distribution/v1beta1/tx.amino"; -import * as _407 from "./evidence/v1beta1/tx.amino"; -import * as _408 from "./feegrant/v1beta1/tx.amino"; -import * as _409 from "./gov/v1/tx.amino"; -import * as _410 from "./gov/v1beta1/tx.amino"; -import * as _411 from "./group/v1/tx.amino"; -import * as _412 from "./nft/v1beta1/tx.amino"; -import * as _413 from "./slashing/v1beta1/tx.amino"; -import * as _414 from "./staking/v1beta1/tx.amino"; -import * as _415 from "./upgrade/v1beta1/tx.amino"; -import * as _416 from "./vesting/v1beta1/tx.amino"; -import * as _417 from "./authz/v1beta1/tx.registry"; -import * as _418 from "./bank/v1beta1/tx.registry"; -import * as _419 from "./crisis/v1beta1/tx.registry"; -import * as _420 from "./distribution/v1beta1/tx.registry"; -import * as _421 from "./evidence/v1beta1/tx.registry"; -import * as _422 from "./feegrant/v1beta1/tx.registry"; -import * as _423 from "./gov/v1/tx.registry"; -import * as _424 from "./gov/v1beta1/tx.registry"; -import * as _425 from "./group/v1/tx.registry"; -import * as _426 from "./nft/v1beta1/tx.registry"; -import * as _427 from "./slashing/v1beta1/tx.registry"; -import * as _428 from "./staking/v1beta1/tx.registry"; -import * as _429 from "./upgrade/v1beta1/tx.registry"; -import * as _430 from "./vesting/v1beta1/tx.registry"; -import * as _431 from "./auth/v1beta1/query.lcd"; -import * as _432 from "./authz/v1beta1/query.lcd"; -import * as _433 from "./bank/v1beta1/query.lcd"; -import * as _434 from "./base/reflection/v1beta1/reflection.lcd"; -import * as _435 from "./base/reflection/v2alpha1/reflection.lcd"; -import * as _436 from "./base/tendermint/v1beta1/query.lcd"; -import * as _437 from "./distribution/v1beta1/query.lcd"; -import * as _438 from "./evidence/v1beta1/query.lcd"; -import * as _439 from "./feegrant/v1beta1/query.lcd"; -import * as _440 from "./gov/v1/query.lcd"; -import * as _441 from "./gov/v1beta1/query.lcd"; -import * as _442 from "./group/v1/query.lcd"; -import * as _443 from "./mint/v1beta1/query.lcd"; -import * as _444 from "./nft/v1beta1/query.lcd"; -import * as _445 from "./params/v1beta1/query.lcd"; -import * as _446 from "./slashing/v1beta1/query.lcd"; -import * as _447 from "./staking/v1beta1/query.lcd"; -import * as _448 from "./tx/v1beta1/service.lcd"; -import * as _449 from "./upgrade/v1beta1/query.lcd"; -import * as _450 from "./base/node/v1beta1/query.lcd"; -import * as _451 from "./app/v1alpha1/query.rpc.Query"; -import * as _452 from "./auth/v1beta1/query.rpc.Query"; -import * as _453 from "./authz/v1beta1/query.rpc.Query"; -import * as _454 from "./bank/v1beta1/query.rpc.Query"; -import * as _455 from "./base/reflection/v1beta1/reflection.rpc.ReflectionService"; -import * as _456 from "./base/reflection/v2alpha1/reflection.rpc.ReflectionService"; -import * as _457 from "./base/tendermint/v1beta1/query.rpc.Service"; -import * as _458 from "./distribution/v1beta1/query.rpc.Query"; -import * as _459 from "./evidence/v1beta1/query.rpc.Query"; -import * as _460 from "./feegrant/v1beta1/query.rpc.Query"; -import * as _461 from "./gov/v1/query.rpc.Query"; -import * as _462 from "./gov/v1beta1/query.rpc.Query"; -import * as _463 from "./group/v1/query.rpc.Query"; -import * as _464 from "./mint/v1beta1/query.rpc.Query"; -import * as _465 from "./nft/v1beta1/query.rpc.Query"; -import * as _466 from "./params/v1beta1/query.rpc.Query"; -import * as _467 from "./slashing/v1beta1/query.rpc.Query"; -import * as _468 from "./staking/v1beta1/query.rpc.Query"; -import * as _469 from "./tx/v1beta1/service.rpc.Service"; -import * as _470 from "./upgrade/v1beta1/query.rpc.Query"; -import * as _471 from "./base/node/v1beta1/query.rpc.Service"; -import * as _472 from "./authz/v1beta1/tx.rpc.msg"; -import * as _473 from "./bank/v1beta1/tx.rpc.msg"; -import * as _474 from "./crisis/v1beta1/tx.rpc.msg"; -import * as _475 from "./distribution/v1beta1/tx.rpc.msg"; -import * as _476 from "./evidence/v1beta1/tx.rpc.msg"; -import * as _477 from "./feegrant/v1beta1/tx.rpc.msg"; -import * as _478 from "./gov/v1/tx.rpc.msg"; -import * as _479 from "./gov/v1beta1/tx.rpc.msg"; -import * as _480 from "./group/v1/tx.rpc.msg"; -import * as _481 from "./nft/v1beta1/tx.rpc.msg"; -import * as _482 from "./slashing/v1beta1/tx.rpc.msg"; -import * as _483 from "./staking/v1beta1/tx.rpc.msg"; -import * as _484 from "./upgrade/v1beta1/tx.rpc.msg"; -import * as _485 from "./vesting/v1beta1/tx.rpc.msg"; -import * as _627 from "./lcd"; -import * as _628 from "./rpc.query"; -import * as _629 from "./cosmos-rpc-client.query"; -import * as _630 from "./rpc.tx"; -import * as _631 from "./cosmos-rpc-client.tx"; +import * as _419 from "./authz/v1beta1/tx.amino"; +import * as _420 from "./bank/v1beta1/tx.amino"; +import * as _421 from "./crisis/v1beta1/tx.amino"; +import * as _422 from "./distribution/v1beta1/tx.amino"; +import * as _423 from "./evidence/v1beta1/tx.amino"; +import * as _424 from "./feegrant/v1beta1/tx.amino"; +import * as _425 from "./gov/v1/tx.amino"; +import * as _426 from "./gov/v1beta1/tx.amino"; +import * as _427 from "./group/v1/tx.amino"; +import * as _428 from "./nft/v1beta1/tx.amino"; +import * as _429 from "./slashing/v1beta1/tx.amino"; +import * as _430 from "./staking/v1beta1/tx.amino"; +import * as _431 from "./upgrade/v1beta1/tx.amino"; +import * as _432 from "./vesting/v1beta1/tx.amino"; +import * as _433 from "./authz/v1beta1/tx.registry"; +import * as _434 from "./bank/v1beta1/tx.registry"; +import * as _435 from "./crisis/v1beta1/tx.registry"; +import * as _436 from "./distribution/v1beta1/tx.registry"; +import * as _437 from "./evidence/v1beta1/tx.registry"; +import * as _438 from "./feegrant/v1beta1/tx.registry"; +import * as _439 from "./gov/v1/tx.registry"; +import * as _440 from "./gov/v1beta1/tx.registry"; +import * as _441 from "./group/v1/tx.registry"; +import * as _442 from "./nft/v1beta1/tx.registry"; +import * as _443 from "./slashing/v1beta1/tx.registry"; +import * as _444 from "./staking/v1beta1/tx.registry"; +import * as _445 from "./upgrade/v1beta1/tx.registry"; +import * as _446 from "./vesting/v1beta1/tx.registry"; +import * as _447 from "./auth/v1beta1/query.lcd"; +import * as _448 from "./authz/v1beta1/query.lcd"; +import * as _449 from "./bank/v1beta1/query.lcd"; +import * as _450 from "./base/reflection/v1beta1/reflection.lcd"; +import * as _451 from "./base/reflection/v2alpha1/reflection.lcd"; +import * as _452 from "./base/tendermint/v1beta1/query.lcd"; +import * as _453 from "./distribution/v1beta1/query.lcd"; +import * as _454 from "./evidence/v1beta1/query.lcd"; +import * as _455 from "./feegrant/v1beta1/query.lcd"; +import * as _456 from "./gov/v1/query.lcd"; +import * as _457 from "./gov/v1beta1/query.lcd"; +import * as _458 from "./group/v1/query.lcd"; +import * as _459 from "./mint/v1beta1/query.lcd"; +import * as _460 from "./nft/v1beta1/query.lcd"; +import * as _461 from "./params/v1beta1/query.lcd"; +import * as _462 from "./slashing/v1beta1/query.lcd"; +import * as _463 from "./staking/v1beta1/query.lcd"; +import * as _464 from "./tx/v1beta1/service.lcd"; +import * as _465 from "./upgrade/v1beta1/query.lcd"; +import * as _466 from "./base/node/v1beta1/query.lcd"; +import * as _467 from "./app/v1alpha1/query.rpc.func"; +import * as _468 from "./auth/v1beta1/query.rpc.func"; +import * as _469 from "./authz/v1beta1/query.rpc.func"; +import * as _470 from "./bank/v1beta1/query.rpc.func"; +import * as _471 from "./base/reflection/v1beta1/reflection.rpc.func"; +import * as _472 from "./base/reflection/v2alpha1/reflection.rpc.func"; +import * as _473 from "./base/tendermint/v1beta1/query.rpc.func"; +import * as _474 from "./distribution/v1beta1/query.rpc.func"; +import * as _475 from "./evidence/v1beta1/query.rpc.func"; +import * as _476 from "./feegrant/v1beta1/query.rpc.func"; +import * as _477 from "./gov/v1/query.rpc.func"; +import * as _478 from "./gov/v1beta1/query.rpc.func"; +import * as _479 from "./group/v1/query.rpc.func"; +import * as _480 from "./mint/v1beta1/query.rpc.func"; +import * as _481 from "./nft/v1beta1/query.rpc.func"; +import * as _482 from "./params/v1beta1/query.rpc.func"; +import * as _483 from "./slashing/v1beta1/query.rpc.func"; +import * as _484 from "./staking/v1beta1/query.rpc.func"; +import * as _485 from "./tx/v1beta1/service.rpc.func"; +import * as _486 from "./upgrade/v1beta1/query.rpc.func"; +import * as _487 from "./base/node/v1beta1/query.rpc.func"; +import * as _488 from "./app/v1alpha1/query.rpc.Query"; +import * as _489 from "./auth/v1beta1/query.rpc.Query"; +import * as _490 from "./authz/v1beta1/query.rpc.Query"; +import * as _491 from "./bank/v1beta1/query.rpc.Query"; +import * as _492 from "./base/reflection/v1beta1/reflection.rpc.ReflectionService"; +import * as _493 from "./base/reflection/v2alpha1/reflection.rpc.ReflectionService"; +import * as _494 from "./base/tendermint/v1beta1/query.rpc.Service"; +import * as _495 from "./distribution/v1beta1/query.rpc.Query"; +import * as _496 from "./evidence/v1beta1/query.rpc.Query"; +import * as _497 from "./feegrant/v1beta1/query.rpc.Query"; +import * as _498 from "./gov/v1/query.rpc.Query"; +import * as _499 from "./gov/v1beta1/query.rpc.Query"; +import * as _500 from "./group/v1/query.rpc.Query"; +import * as _501 from "./mint/v1beta1/query.rpc.Query"; +import * as _502 from "./nft/v1beta1/query.rpc.Query"; +import * as _503 from "./params/v1beta1/query.rpc.Query"; +import * as _504 from "./slashing/v1beta1/query.rpc.Query"; +import * as _505 from "./staking/v1beta1/query.rpc.Query"; +import * as _506 from "./tx/v1beta1/service.rpc.Service"; +import * as _507 from "./upgrade/v1beta1/query.rpc.Query"; +import * as _508 from "./base/node/v1beta1/query.rpc.Service"; +import * as _509 from "./authz/v1beta1/tx.rpc.func"; +import * as _510 from "./bank/v1beta1/tx.rpc.func"; +import * as _511 from "./crisis/v1beta1/tx.rpc.func"; +import * as _512 from "./distribution/v1beta1/tx.rpc.func"; +import * as _513 from "./evidence/v1beta1/tx.rpc.func"; +import * as _514 from "./feegrant/v1beta1/tx.rpc.func"; +import * as _515 from "./gov/v1/tx.rpc.func"; +import * as _516 from "./gov/v1beta1/tx.rpc.func"; +import * as _517 from "./group/v1/tx.rpc.func"; +import * as _518 from "./nft/v1beta1/tx.rpc.func"; +import * as _519 from "./slashing/v1beta1/tx.rpc.func"; +import * as _520 from "./staking/v1beta1/tx.rpc.func"; +import * as _521 from "./upgrade/v1beta1/tx.rpc.func"; +import * as _522 from "./vesting/v1beta1/tx.rpc.func"; +import * as _523 from "./authz/v1beta1/tx.rpc.msg"; +import * as _524 from "./bank/v1beta1/tx.rpc.msg"; +import * as _525 from "./crisis/v1beta1/tx.rpc.msg"; +import * as _526 from "./distribution/v1beta1/tx.rpc.msg"; +import * as _527 from "./evidence/v1beta1/tx.rpc.msg"; +import * as _528 from "./feegrant/v1beta1/tx.rpc.msg"; +import * as _529 from "./gov/v1/tx.rpc.msg"; +import * as _530 from "./gov/v1beta1/tx.rpc.msg"; +import * as _531 from "./group/v1/tx.rpc.msg"; +import * as _532 from "./nft/v1beta1/tx.rpc.msg"; +import * as _533 from "./slashing/v1beta1/tx.rpc.msg"; +import * as _534 from "./staking/v1beta1/tx.rpc.msg"; +import * as _535 from "./upgrade/v1beta1/tx.rpc.msg"; +import * as _536 from "./vesting/v1beta1/tx.rpc.msg"; +import * as _736 from "./lcd"; +import * as _737 from "./rpc.query"; +import * as _738 from "./cosmos-rpc-client.query"; +import * as _739 from "./rpc.tx"; +import * as _740 from "./cosmos-rpc-client.tx"; export namespace cosmos { export namespace app { export const v1alpha1 = { ..._55, ..._56, ..._57, - ..._451 + ..._467, + ..._488 }; } export namespace auth { @@ -194,8 +230,9 @@ export namespace cosmos { ..._58, ..._59, ..._60, - ..._431, - ..._452 + ..._447, + ..._468, + ..._489 }; } export namespace authz { @@ -204,11 +241,13 @@ export namespace cosmos { ..._62, ..._63, ..._64, - ..._403, - ..._417, - ..._432, - ..._453, - ..._472 + ..._419, + ..._433, + ..._448, + ..._469, + ..._490, + ..._509, + ..._523 }; } export namespace bank { @@ -218,11 +257,13 @@ export namespace cosmos { ..._67, ..._68, ..._69, - ..._404, - ..._418, - ..._433, - ..._454, - ..._473 + ..._420, + ..._434, + ..._449, + ..._470, + ..._491, + ..._510, + ..._524 }; } export namespace base { @@ -244,13 +285,15 @@ export namespace cosmos { export namespace reflection { export const v1beta1 = { ..._73, - ..._434, - ..._455 + ..._450, + ..._471, + ..._492 }; export const v2alpha1 = { ..._74, - ..._435, - ..._456 + ..._451, + ..._472, + ..._493 }; } export namespace snapshots { @@ -267,8 +310,9 @@ export namespace cosmos { export namespace tendermint { export const v1beta1 = { ..._78, - ..._436, - ..._457 + ..._452, + ..._473, + ..._494 }; } export const v1beta1 = { @@ -277,8 +321,9 @@ export namespace cosmos { export namespace node { export const v1beta1 = { ..._80, - ..._450, - ..._471 + ..._466, + ..._487, + ..._508 }; } } @@ -292,9 +337,10 @@ export namespace cosmos { export const v1beta1 = { ..._83, ..._84, - ..._405, - ..._419, - ..._474 + ..._421, + ..._435, + ..._511, + ..._525 }; } export namespace crypto { @@ -327,11 +373,13 @@ export namespace cosmos { ..._92, ..._93, ..._94, - ..._406, - ..._420, - ..._437, - ..._458, - ..._475 + ..._422, + ..._436, + ..._453, + ..._474, + ..._495, + ..._512, + ..._526 }; } export namespace evidence { @@ -340,11 +388,13 @@ export namespace cosmos { ..._96, ..._97, ..._98, - ..._407, - ..._421, - ..._438, - ..._459, - ..._476 + ..._423, + ..._437, + ..._454, + ..._475, + ..._496, + ..._513, + ..._527 }; } export namespace feegrant { @@ -353,11 +403,13 @@ export namespace cosmos { ..._100, ..._101, ..._102, - ..._408, - ..._422, - ..._439, - ..._460, - ..._477 + ..._424, + ..._438, + ..._455, + ..._476, + ..._497, + ..._514, + ..._528 }; } export namespace genutil { @@ -371,22 +423,26 @@ export namespace cosmos { ..._105, ..._106, ..._107, - ..._409, - ..._423, - ..._440, - ..._461, - ..._478 + ..._425, + ..._439, + ..._456, + ..._477, + ..._498, + ..._515, + ..._529 }; export const v1beta1 = { ..._108, ..._109, ..._110, ..._111, - ..._410, - ..._424, - ..._441, - ..._462, - ..._479 + ..._426, + ..._440, + ..._457, + ..._478, + ..._499, + ..._516, + ..._530 }; } export namespace group { @@ -396,11 +452,13 @@ export namespace cosmos { ..._114, ..._115, ..._116, - ..._411, - ..._425, - ..._442, - ..._463, - ..._480 + ..._427, + ..._441, + ..._458, + ..._479, + ..._500, + ..._517, + ..._531 }; } export namespace mint { @@ -408,8 +466,9 @@ export namespace cosmos { ..._117, ..._118, ..._119, - ..._443, - ..._464 + ..._459, + ..._480, + ..._501 }; } export namespace msg { @@ -424,11 +483,13 @@ export namespace cosmos { ..._123, ..._124, ..._125, - ..._412, - ..._426, - ..._444, - ..._465, - ..._481 + ..._428, + ..._442, + ..._460, + ..._481, + ..._502, + ..._518, + ..._532 }; } export namespace orm { @@ -448,8 +509,9 @@ export namespace cosmos { export const v1beta1 = { ..._129, ..._130, - ..._445, - ..._466 + ..._461, + ..._482, + ..._503 }; } export namespace slashing { @@ -458,11 +520,13 @@ export namespace cosmos { ..._132, ..._133, ..._134, - ..._413, - ..._427, - ..._446, - ..._467, - ..._482 + ..._429, + ..._443, + ..._462, + ..._483, + ..._504, + ..._519, + ..._533 }; } export namespace staking { @@ -472,11 +536,13 @@ export namespace cosmos { ..._137, ..._138, ..._139, - ..._414, - ..._428, - ..._447, - ..._468, - ..._483 + ..._430, + ..._444, + ..._463, + ..._484, + ..._505, + ..._520, + ..._534 }; } export namespace tx { @@ -488,8 +554,9 @@ export namespace cosmos { export const v1beta1 = { ..._141, ..._142, - ..._448, - ..._469 + ..._464, + ..._485, + ..._506 }; } export namespace upgrade { @@ -497,20 +564,23 @@ export namespace cosmos { ..._143, ..._144, ..._145, - ..._415, - ..._429, - ..._449, - ..._470, - ..._484 + ..._431, + ..._445, + ..._465, + ..._486, + ..._507, + ..._521, + ..._535 }; } export namespace vesting { export const v1beta1 = { ..._146, ..._147, - ..._416, - ..._430, - ..._485 + ..._432, + ..._446, + ..._522, + ..._536 }; } export namespace ics23 { @@ -519,10 +589,10 @@ export namespace cosmos { }; } export const ClientFactory = { - ..._627, - ..._628, - ..._629, - ..._630, - ..._631 + ..._736, + ..._737, + ..._738, + ..._739, + ..._740 }; } \ No newline at end of file diff --git a/__fixtures__/v-next/outputosmojs/cosmos/crisis/v1beta1/tx.registry.ts b/__fixtures__/v-next/outputosmojs/cosmos/crisis/v1beta1/tx.registry.ts index 77f206ab58..58c31ab80e 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/crisis/v1beta1/tx.registry.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/crisis/v1beta1/tx.registry.ts @@ -1,11 +1,6 @@ -import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { TelescopeGeneratedType } from "../../../types"; import { MsgVerifyInvariant, MsgVerifyInvariantSDKType } from "./tx"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/cosmos.crisis.v1beta1.MsgVerifyInvariant", MsgVerifyInvariant]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/cosmos.crisis.v1beta1.MsgVerifyInvariant", MsgVerifyInvariant]]; export const MessageComposer = { encoded: { verifyInvariant(value: MsgVerifyInvariant) { diff --git a/__fixtures__/v-next/outputosmojs/cosmos/crisis/v1beta1/tx.rpc.func.ts b/__fixtures__/v-next/outputosmojs/cosmos/crisis/v1beta1/tx.rpc.func.ts new file mode 100644 index 0000000000..da292c9a67 --- /dev/null +++ b/__fixtures__/v-next/outputosmojs/cosmos/crisis/v1beta1/tx.rpc.func.ts @@ -0,0 +1,11 @@ +import { buildTx } from "../../../helper-func-types"; +import { MsgVerifyInvariant, MsgVerifyInvariantSDKType, MsgVerifyInvariantResponse, MsgVerifyInvariantResponseSDKType } from "./tx"; +/** + * VerifyInvariant defines a method to verify a particular invariance. + * @name verifyInvariant + * @package cosmos.crisis.v1beta1 + * @see proto service: cosmos.crisis.v1beta1.VerifyInvariant + */ +export const verifyInvariant = buildTx({ + msg: MsgVerifyInvariant +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputosmojs/cosmos/crisis/v1beta1/tx.rpc.msg.ts b/__fixtures__/v-next/outputosmojs/cosmos/crisis/v1beta1/tx.rpc.msg.ts index 0c0a897cff..bf8abd398a 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/crisis/v1beta1/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/crisis/v1beta1/tx.rpc.msg.ts @@ -1,4 +1,4 @@ -import { Rpc } from "../../../helpers"; +import { TxRpc } from "../../../types"; import { BinaryReader } from "../../../binary"; import { MsgVerifyInvariant, MsgVerifyInvariantSDKType, MsgVerifyInvariantResponse, MsgVerifyInvariantResponseSDKType } from "./tx"; /** Msg defines the bank Msg service. */ @@ -7,8 +7,8 @@ export interface Msg { verifyInvariant(request: MsgVerifyInvariant): Promise; } export class MsgClientImpl implements Msg { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.verifyInvariant = this.verifyInvariant.bind(this); } @@ -18,6 +18,6 @@ export class MsgClientImpl implements Msg { return promise.then(data => MsgVerifyInvariantResponse.decode(new BinaryReader(data))); } } -export const createClientImpl = (rpc: Rpc) => { +export const createClientImpl = (rpc: TxRpc) => { return new MsgClientImpl(rpc); }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputosmojs/cosmos/distribution/v1beta1/distribution.ts b/__fixtures__/v-next/outputosmojs/cosmos/distribution/v1beta1/distribution.ts index 3a872a59ca..06120a5fc0 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/distribution/v1beta1/distribution.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/distribution/v1beta1/distribution.ts @@ -1,6 +1,6 @@ import { DecCoin, DecCoinSDKType, Coin, CoinSDKType } from "../../base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { Decimal } from "@cosmjs/math"; +import { Decimal } from "@interchainjs/math"; import { isSet, DeepPartial } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "cosmos.distribution.v1beta1"; @@ -477,9 +477,9 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.community_tax = message.communityTax === "" ? undefined : message.communityTax; - obj.base_proposer_reward = message.baseProposerReward === "" ? undefined : message.baseProposerReward; - obj.bonus_proposer_reward = message.bonusProposerReward === "" ? undefined : message.bonusProposerReward; + obj.community_tax = message.communityTax === "" ? undefined : Decimal.fromUserInput(message.communityTax, 18).atomics; + obj.base_proposer_reward = message.baseProposerReward === "" ? undefined : Decimal.fromUserInput(message.baseProposerReward, 18).atomics; + obj.bonus_proposer_reward = message.bonusProposerReward === "" ? undefined : Decimal.fromUserInput(message.bonusProposerReward, 18).atomics; obj.withdraw_addr_enabled = message.withdrawAddrEnabled === false ? undefined : message.withdrawAddrEnabled; return obj; }, @@ -1089,7 +1089,7 @@ export const ValidatorSlashEvent = { toAmino(message: ValidatorSlashEvent): ValidatorSlashEventAmino { const obj: any = {}; obj.validator_period = message.validatorPeriod !== BigInt(0) ? message.validatorPeriod?.toString() : undefined; - obj.fraction = message.fraction === "" ? undefined : message.fraction; + obj.fraction = message.fraction === "" ? undefined : Decimal.fromUserInput(message.fraction, 18).atomics; return obj; }, fromAminoMsg(object: ValidatorSlashEventAminoMsg): ValidatorSlashEvent { @@ -1610,7 +1610,7 @@ export const DelegatorStartingInfo = { toAmino(message: DelegatorStartingInfo): DelegatorStartingInfoAmino { const obj: any = {}; obj.previous_period = message.previousPeriod !== BigInt(0) ? message.previousPeriod?.toString() : undefined; - obj.stake = message.stake === "" ? undefined : message.stake; + obj.stake = message.stake === "" ? undefined : Decimal.fromUserInput(message.stake, 18).atomics; obj.height = message.height ? message.height?.toString() : "0"; return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/cosmos/distribution/v1beta1/query.rpc.Query.ts b/__fixtures__/v-next/outputosmojs/cosmos/distribution/v1beta1/query.rpc.Query.ts index f469b268e6..9f59ffafe6 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/distribution/v1beta1/query.rpc.Query.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/distribution/v1beta1/query.rpc.Query.ts @@ -1,7 +1,7 @@ import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; import { Params, ParamsSDKType, ValidatorOutstandingRewards, ValidatorOutstandingRewardsSDKType, ValidatorAccumulatedCommission, ValidatorAccumulatedCommissionSDKType, ValidatorSlashEvent, ValidatorSlashEventSDKType, DelegationDelegatorReward, DelegationDelegatorRewardSDKType } from "./distribution"; import { DecCoin, DecCoinSDKType } from "../../base/v1beta1/coin"; -import { Rpc } from "../../../helpers"; +import { TxRpc } from "../../../types"; import { BinaryReader } from "../../../binary"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; import { QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, QueryValidatorOutstandingRewardsRequest, QueryValidatorOutstandingRewardsRequestSDKType, QueryValidatorOutstandingRewardsResponse, QueryValidatorOutstandingRewardsResponseSDKType, QueryValidatorCommissionRequest, QueryValidatorCommissionRequestSDKType, QueryValidatorCommissionResponse, QueryValidatorCommissionResponseSDKType, QueryValidatorSlashesRequest, QueryValidatorSlashesRequestSDKType, QueryValidatorSlashesResponse, QueryValidatorSlashesResponseSDKType, QueryDelegationRewardsRequest, QueryDelegationRewardsRequestSDKType, QueryDelegationRewardsResponse, QueryDelegationRewardsResponseSDKType, QueryDelegationTotalRewardsRequest, QueryDelegationTotalRewardsRequestSDKType, QueryDelegationTotalRewardsResponse, QueryDelegationTotalRewardsResponseSDKType, QueryDelegatorValidatorsRequest, QueryDelegatorValidatorsRequestSDKType, QueryDelegatorValidatorsResponse, QueryDelegatorValidatorsResponseSDKType, QueryDelegatorWithdrawAddressRequest, QueryDelegatorWithdrawAddressRequestSDKType, QueryDelegatorWithdrawAddressResponse, QueryDelegatorWithdrawAddressResponseSDKType, QueryCommunityPoolRequest, QueryCommunityPoolRequestSDKType, QueryCommunityPoolResponse, QueryCommunityPoolResponseSDKType } from "./query"; @@ -30,8 +30,8 @@ export interface Query { communityPool(request?: QueryCommunityPoolRequest): Promise; } export class QueryClientImpl implements Query { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.params = this.params.bind(this); this.validatorOutstandingRewards = this.validatorOutstandingRewards.bind(this); diff --git a/__fixtures__/v-next/outputosmojs/cosmos/distribution/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputosmojs/cosmos/distribution/v1beta1/query.rpc.func.ts new file mode 100644 index 0000000000..7283b1ff84 --- /dev/null +++ b/__fixtures__/v-next/outputosmojs/cosmos/distribution/v1beta1/query.rpc.func.ts @@ -0,0 +1,114 @@ +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; +import { Params, ParamsSDKType, ValidatorOutstandingRewards, ValidatorOutstandingRewardsSDKType, ValidatorAccumulatedCommission, ValidatorAccumulatedCommissionSDKType, ValidatorSlashEvent, ValidatorSlashEventSDKType, DelegationDelegatorReward, DelegationDelegatorRewardSDKType } from "./distribution"; +import { DecCoin, DecCoinSDKType } from "../../base/v1beta1/coin"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, QueryValidatorOutstandingRewardsRequest, QueryValidatorOutstandingRewardsRequestSDKType, QueryValidatorOutstandingRewardsResponse, QueryValidatorOutstandingRewardsResponseSDKType, QueryValidatorCommissionRequest, QueryValidatorCommissionRequestSDKType, QueryValidatorCommissionResponse, QueryValidatorCommissionResponseSDKType, QueryValidatorSlashesRequest, QueryValidatorSlashesRequestSDKType, QueryValidatorSlashesResponse, QueryValidatorSlashesResponseSDKType, QueryDelegationRewardsRequest, QueryDelegationRewardsRequestSDKType, QueryDelegationRewardsResponse, QueryDelegationRewardsResponseSDKType, QueryDelegationTotalRewardsRequest, QueryDelegationTotalRewardsRequestSDKType, QueryDelegationTotalRewardsResponse, QueryDelegationTotalRewardsResponseSDKType, QueryDelegatorValidatorsRequest, QueryDelegatorValidatorsRequestSDKType, QueryDelegatorValidatorsResponse, QueryDelegatorValidatorsResponseSDKType, QueryDelegatorWithdrawAddressRequest, QueryDelegatorWithdrawAddressRequestSDKType, QueryDelegatorWithdrawAddressResponse, QueryDelegatorWithdrawAddressResponseSDKType, QueryCommunityPoolRequest, QueryCommunityPoolRequestSDKType, QueryCommunityPoolResponse, QueryCommunityPoolResponseSDKType } from "./query"; +/** + * Params queries params of the distribution module. + * @name getParams + * @package cosmos.distribution.v1beta1 + * @see proto service: cosmos.distribution.v1beta1.Params + */ +export const getParams = buildQuery({ + encode: QueryParamsRequest.encode, + decode: QueryParamsResponse.decode, + service: "cosmos.distribution.v1beta1.Query", + method: "Params" +}); +/** + * ValidatorOutstandingRewards queries rewards of a validator address. + * @name getValidatorOutstandingRewards + * @package cosmos.distribution.v1beta1 + * @see proto service: cosmos.distribution.v1beta1.ValidatorOutstandingRewards + */ +export const getValidatorOutstandingRewards = buildQuery({ + encode: QueryValidatorOutstandingRewardsRequest.encode, + decode: QueryValidatorOutstandingRewardsResponse.decode, + service: "cosmos.distribution.v1beta1.Query", + method: "ValidatorOutstandingRewards" +}); +/** + * ValidatorCommission queries accumulated commission for a validator. + * @name getValidatorCommission + * @package cosmos.distribution.v1beta1 + * @see proto service: cosmos.distribution.v1beta1.ValidatorCommission + */ +export const getValidatorCommission = buildQuery({ + encode: QueryValidatorCommissionRequest.encode, + decode: QueryValidatorCommissionResponse.decode, + service: "cosmos.distribution.v1beta1.Query", + method: "ValidatorCommission" +}); +/** + * ValidatorSlashes queries slash events of a validator. + * @name getValidatorSlashes + * @package cosmos.distribution.v1beta1 + * @see proto service: cosmos.distribution.v1beta1.ValidatorSlashes + */ +export const getValidatorSlashes = buildQuery({ + encode: QueryValidatorSlashesRequest.encode, + decode: QueryValidatorSlashesResponse.decode, + service: "cosmos.distribution.v1beta1.Query", + method: "ValidatorSlashes" +}); +/** + * DelegationRewards queries the total rewards accrued by a delegation. + * @name getDelegationRewards + * @package cosmos.distribution.v1beta1 + * @see proto service: cosmos.distribution.v1beta1.DelegationRewards + */ +export const getDelegationRewards = buildQuery({ + encode: QueryDelegationRewardsRequest.encode, + decode: QueryDelegationRewardsResponse.decode, + service: "cosmos.distribution.v1beta1.Query", + method: "DelegationRewards" +}); +/** + * DelegationTotalRewards queries the total rewards accrued by a each + * validator. + * @name getDelegationTotalRewards + * @package cosmos.distribution.v1beta1 + * @see proto service: cosmos.distribution.v1beta1.DelegationTotalRewards + */ +export const getDelegationTotalRewards = buildQuery({ + encode: QueryDelegationTotalRewardsRequest.encode, + decode: QueryDelegationTotalRewardsResponse.decode, + service: "cosmos.distribution.v1beta1.Query", + method: "DelegationTotalRewards" +}); +/** + * DelegatorValidators queries the validators of a delegator. + * @name getDelegatorValidators + * @package cosmos.distribution.v1beta1 + * @see proto service: cosmos.distribution.v1beta1.DelegatorValidators + */ +export const getDelegatorValidators = buildQuery({ + encode: QueryDelegatorValidatorsRequest.encode, + decode: QueryDelegatorValidatorsResponse.decode, + service: "cosmos.distribution.v1beta1.Query", + method: "DelegatorValidators" +}); +/** + * DelegatorWithdrawAddress queries withdraw address of a delegator. + * @name getDelegatorWithdrawAddress + * @package cosmos.distribution.v1beta1 + * @see proto service: cosmos.distribution.v1beta1.DelegatorWithdrawAddress + */ +export const getDelegatorWithdrawAddress = buildQuery({ + encode: QueryDelegatorWithdrawAddressRequest.encode, + decode: QueryDelegatorWithdrawAddressResponse.decode, + service: "cosmos.distribution.v1beta1.Query", + method: "DelegatorWithdrawAddress" +}); +/** + * CommunityPool queries the community pool coins. + * @name getCommunityPool + * @package cosmos.distribution.v1beta1 + * @see proto service: cosmos.distribution.v1beta1.CommunityPool + */ +export const getCommunityPool = buildQuery({ + encode: QueryCommunityPoolRequest.encode, + decode: QueryCommunityPoolResponse.decode, + service: "cosmos.distribution.v1beta1.Query", + method: "CommunityPool" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputosmojs/cosmos/distribution/v1beta1/tx.registry.ts b/__fixtures__/v-next/outputosmojs/cosmos/distribution/v1beta1/tx.registry.ts index 6241519ba0..b332aef187 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/distribution/v1beta1/tx.registry.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/distribution/v1beta1/tx.registry.ts @@ -1,12 +1,7 @@ import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; -import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { TelescopeGeneratedType } from "../../../types"; import { MsgSetWithdrawAddress, MsgSetWithdrawAddressSDKType, MsgWithdrawDelegatorReward, MsgWithdrawDelegatorRewardSDKType, MsgWithdrawValidatorCommission, MsgWithdrawValidatorCommissionSDKType, MsgFundCommunityPool, MsgFundCommunityPoolSDKType } from "./tx"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/cosmos.distribution.v1beta1.MsgSetWithdrawAddress", MsgSetWithdrawAddress], ["/cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward", MsgWithdrawDelegatorReward], ["/cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission", MsgWithdrawValidatorCommission], ["/cosmos.distribution.v1beta1.MsgFundCommunityPool", MsgFundCommunityPool]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/cosmos.distribution.v1beta1.MsgSetWithdrawAddress", MsgSetWithdrawAddress], ["/cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward", MsgWithdrawDelegatorReward], ["/cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission", MsgWithdrawValidatorCommission], ["/cosmos.distribution.v1beta1.MsgFundCommunityPool", MsgFundCommunityPool]]; export const MessageComposer = { encoded: { setWithdrawAddress(value: MsgSetWithdrawAddress) { diff --git a/__fixtures__/v-next/outputosmojs/cosmos/distribution/v1beta1/tx.rpc.func.ts b/__fixtures__/v-next/outputosmojs/cosmos/distribution/v1beta1/tx.rpc.func.ts new file mode 100644 index 0000000000..27ee8a8714 --- /dev/null +++ b/__fixtures__/v-next/outputosmojs/cosmos/distribution/v1beta1/tx.rpc.func.ts @@ -0,0 +1,43 @@ +import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; +import { buildTx } from "../../../helper-func-types"; +import { MsgSetWithdrawAddress, MsgSetWithdrawAddressSDKType, MsgSetWithdrawAddressResponse, MsgSetWithdrawAddressResponseSDKType, MsgWithdrawDelegatorReward, MsgWithdrawDelegatorRewardSDKType, MsgWithdrawDelegatorRewardResponse, MsgWithdrawDelegatorRewardResponseSDKType, MsgWithdrawValidatorCommission, MsgWithdrawValidatorCommissionSDKType, MsgWithdrawValidatorCommissionResponse, MsgWithdrawValidatorCommissionResponseSDKType, MsgFundCommunityPool, MsgFundCommunityPoolSDKType, MsgFundCommunityPoolResponse, MsgFundCommunityPoolResponseSDKType } from "./tx"; +/** + * SetWithdrawAddress defines a method to change the withdraw address + * for a delegator (or validator self-delegation). + * @name setWithdrawAddress + * @package cosmos.distribution.v1beta1 + * @see proto service: cosmos.distribution.v1beta1.SetWithdrawAddress + */ +export const setWithdrawAddress = buildTx({ + msg: MsgSetWithdrawAddress +}); +/** + * WithdrawDelegatorReward defines a method to withdraw rewards of delegator + * from a single validator. + * @name withdrawDelegatorReward + * @package cosmos.distribution.v1beta1 + * @see proto service: cosmos.distribution.v1beta1.WithdrawDelegatorReward + */ +export const withdrawDelegatorReward = buildTx({ + msg: MsgWithdrawDelegatorReward +}); +/** + * WithdrawValidatorCommission defines a method to withdraw the + * full commission to the validator address. + * @name withdrawValidatorCommission + * @package cosmos.distribution.v1beta1 + * @see proto service: cosmos.distribution.v1beta1.WithdrawValidatorCommission + */ +export const withdrawValidatorCommission = buildTx({ + msg: MsgWithdrawValidatorCommission +}); +/** + * FundCommunityPool defines a method to allow an account to directly + * fund the community pool. + * @name fundCommunityPool + * @package cosmos.distribution.v1beta1 + * @see proto service: cosmos.distribution.v1beta1.FundCommunityPool + */ +export const fundCommunityPool = buildTx({ + msg: MsgFundCommunityPool +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputosmojs/cosmos/distribution/v1beta1/tx.rpc.msg.ts b/__fixtures__/v-next/outputosmojs/cosmos/distribution/v1beta1/tx.rpc.msg.ts index 4a6132c737..c82a8054f5 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/distribution/v1beta1/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/distribution/v1beta1/tx.rpc.msg.ts @@ -1,5 +1,5 @@ import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; -import { Rpc } from "../../../helpers"; +import { TxRpc } from "../../../types"; import { BinaryReader } from "../../../binary"; import { MsgSetWithdrawAddress, MsgSetWithdrawAddressSDKType, MsgSetWithdrawAddressResponse, MsgSetWithdrawAddressResponseSDKType, MsgWithdrawDelegatorReward, MsgWithdrawDelegatorRewardSDKType, MsgWithdrawDelegatorRewardResponse, MsgWithdrawDelegatorRewardResponseSDKType, MsgWithdrawValidatorCommission, MsgWithdrawValidatorCommissionSDKType, MsgWithdrawValidatorCommissionResponse, MsgWithdrawValidatorCommissionResponseSDKType, MsgFundCommunityPool, MsgFundCommunityPoolSDKType, MsgFundCommunityPoolResponse, MsgFundCommunityPoolResponseSDKType } from "./tx"; /** Msg defines the distribution Msg service. */ @@ -26,8 +26,8 @@ export interface Msg { fundCommunityPool(request: MsgFundCommunityPool): Promise; } export class MsgClientImpl implements Msg { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.setWithdrawAddress = this.setWithdrawAddress.bind(this); this.withdrawDelegatorReward = this.withdrawDelegatorReward.bind(this); @@ -55,6 +55,6 @@ export class MsgClientImpl implements Msg { return promise.then(data => MsgFundCommunityPoolResponse.decode(new BinaryReader(data))); } } -export const createClientImpl = (rpc: Rpc) => { +export const createClientImpl = (rpc: TxRpc) => { return new MsgClientImpl(rpc); }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputosmojs/cosmos/evidence/v1beta1/query.rpc.Query.ts b/__fixtures__/v-next/outputosmojs/cosmos/evidence/v1beta1/query.rpc.Query.ts index d83b760cf7..e21ec08e40 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/evidence/v1beta1/query.rpc.Query.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/evidence/v1beta1/query.rpc.Query.ts @@ -1,6 +1,6 @@ import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; import { Any, AnySDKType } from "../../../google/protobuf/any"; -import { Rpc } from "../../../helpers"; +import { TxRpc } from "../../../types"; import { BinaryReader } from "../../../binary"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; import { QueryEvidenceRequest, QueryEvidenceRequestSDKType, QueryEvidenceResponse, QueryEvidenceResponseSDKType, QueryAllEvidenceRequest, QueryAllEvidenceRequestSDKType, QueryAllEvidenceResponse, QueryAllEvidenceResponseSDKType } from "./query"; @@ -12,8 +12,8 @@ export interface Query { allEvidence(request?: QueryAllEvidenceRequest): Promise; } export class QueryClientImpl implements Query { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.evidence = this.evidence.bind(this); this.allEvidence = this.allEvidence.bind(this); diff --git a/__fixtures__/v-next/outputosmojs/cosmos/evidence/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputosmojs/cosmos/evidence/v1beta1/query.rpc.func.ts new file mode 100644 index 0000000000..57423e9da7 --- /dev/null +++ b/__fixtures__/v-next/outputosmojs/cosmos/evidence/v1beta1/query.rpc.func.ts @@ -0,0 +1,28 @@ +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; +import { Any, AnySDKType } from "../../../google/protobuf/any"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { QueryEvidenceRequest, QueryEvidenceRequestSDKType, QueryEvidenceResponse, QueryEvidenceResponseSDKType, QueryAllEvidenceRequest, QueryAllEvidenceRequestSDKType, QueryAllEvidenceResponse, QueryAllEvidenceResponseSDKType } from "./query"; +/** + * Evidence queries evidence based on evidence hash. + * @name getEvidence + * @package cosmos.evidence.v1beta1 + * @see proto service: cosmos.evidence.v1beta1.Evidence + */ +export const getEvidence = buildQuery({ + encode: QueryEvidenceRequest.encode, + decode: QueryEvidenceResponse.decode, + service: "cosmos.evidence.v1beta1.Query", + method: "Evidence" +}); +/** + * AllEvidence queries all evidence. + * @name getAllEvidence + * @package cosmos.evidence.v1beta1 + * @see proto service: cosmos.evidence.v1beta1.AllEvidence + */ +export const getAllEvidence = buildQuery({ + encode: QueryAllEvidenceRequest.encode, + decode: QueryAllEvidenceResponse.decode, + service: "cosmos.evidence.v1beta1.Query", + method: "AllEvidence" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputosmojs/cosmos/evidence/v1beta1/tx.registry.ts b/__fixtures__/v-next/outputosmojs/cosmos/evidence/v1beta1/tx.registry.ts index d48dba61f0..160f7f990a 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/evidence/v1beta1/tx.registry.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/evidence/v1beta1/tx.registry.ts @@ -1,12 +1,7 @@ import { Any, AnySDKType } from "../../../google/protobuf/any"; -import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { TelescopeGeneratedType } from "../../../types"; import { MsgSubmitEvidence, MsgSubmitEvidenceSDKType } from "./tx"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/cosmos.evidence.v1beta1.MsgSubmitEvidence", MsgSubmitEvidence]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/cosmos.evidence.v1beta1.MsgSubmitEvidence", MsgSubmitEvidence]]; export const MessageComposer = { encoded: { submitEvidence(value: MsgSubmitEvidence) { diff --git a/__fixtures__/v-next/outputosmojs/cosmos/evidence/v1beta1/tx.rpc.func.ts b/__fixtures__/v-next/outputosmojs/cosmos/evidence/v1beta1/tx.rpc.func.ts new file mode 100644 index 0000000000..53a16e4bcd --- /dev/null +++ b/__fixtures__/v-next/outputosmojs/cosmos/evidence/v1beta1/tx.rpc.func.ts @@ -0,0 +1,13 @@ +import { Any, AnySDKType } from "../../../google/protobuf/any"; +import { buildTx } from "../../../helper-func-types"; +import { MsgSubmitEvidence, MsgSubmitEvidenceSDKType, MsgSubmitEvidenceResponse, MsgSubmitEvidenceResponseSDKType } from "./tx"; +/** + * SubmitEvidence submits an arbitrary Evidence of misbehavior such as equivocation or + * counterfactual signing. + * @name submitEvidence + * @package cosmos.evidence.v1beta1 + * @see proto service: cosmos.evidence.v1beta1.SubmitEvidence + */ +export const submitEvidence = buildTx({ + msg: MsgSubmitEvidence +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputosmojs/cosmos/evidence/v1beta1/tx.rpc.msg.ts b/__fixtures__/v-next/outputosmojs/cosmos/evidence/v1beta1/tx.rpc.msg.ts index 0b661ab18f..96dee6c85f 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/evidence/v1beta1/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/evidence/v1beta1/tx.rpc.msg.ts @@ -1,5 +1,5 @@ import { Any, AnySDKType } from "../../../google/protobuf/any"; -import { Rpc } from "../../../helpers"; +import { TxRpc } from "../../../types"; import { BinaryReader } from "../../../binary"; import { MsgSubmitEvidence, MsgSubmitEvidenceSDKType, MsgSubmitEvidenceResponse, MsgSubmitEvidenceResponseSDKType } from "./tx"; /** Msg defines the evidence Msg service. */ @@ -11,8 +11,8 @@ export interface Msg { submitEvidence(request: MsgSubmitEvidence): Promise; } export class MsgClientImpl implements Msg { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.submitEvidence = this.submitEvidence.bind(this); } @@ -22,6 +22,6 @@ export class MsgClientImpl implements Msg { return promise.then(data => MsgSubmitEvidenceResponse.decode(new BinaryReader(data))); } } -export const createClientImpl = (rpc: Rpc) => { +export const createClientImpl = (rpc: TxRpc) => { return new MsgClientImpl(rpc); }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputosmojs/cosmos/feegrant/v1beta1/query.rpc.Query.ts b/__fixtures__/v-next/outputosmojs/cosmos/feegrant/v1beta1/query.rpc.Query.ts index 6df7894fc8..8f593e0ef1 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/feegrant/v1beta1/query.rpc.Query.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/feegrant/v1beta1/query.rpc.Query.ts @@ -1,6 +1,6 @@ import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; import { Grant, GrantSDKType } from "./feegrant"; -import { Rpc } from "../../../helpers"; +import { TxRpc } from "../../../types"; import { BinaryReader } from "../../../binary"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; import { QueryAllowanceRequest, QueryAllowanceRequestSDKType, QueryAllowanceResponse, QueryAllowanceResponseSDKType, QueryAllowancesRequest, QueryAllowancesRequestSDKType, QueryAllowancesResponse, QueryAllowancesResponseSDKType, QueryAllowancesByGranterRequest, QueryAllowancesByGranterRequestSDKType, QueryAllowancesByGranterResponse, QueryAllowancesByGranterResponseSDKType } from "./query"; @@ -17,8 +17,8 @@ export interface Query { allowancesByGranter(request: QueryAllowancesByGranterRequest): Promise; } export class QueryClientImpl implements Query { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.allowance = this.allowance.bind(this); this.allowances = this.allowances.bind(this); diff --git a/__fixtures__/v-next/outputosmojs/cosmos/feegrant/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputosmojs/cosmos/feegrant/v1beta1/query.rpc.func.ts new file mode 100644 index 0000000000..3f0bea649a --- /dev/null +++ b/__fixtures__/v-next/outputosmojs/cosmos/feegrant/v1beta1/query.rpc.func.ts @@ -0,0 +1,41 @@ +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; +import { Grant, GrantSDKType } from "./feegrant"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { QueryAllowanceRequest, QueryAllowanceRequestSDKType, QueryAllowanceResponse, QueryAllowanceResponseSDKType, QueryAllowancesRequest, QueryAllowancesRequestSDKType, QueryAllowancesResponse, QueryAllowancesResponseSDKType, QueryAllowancesByGranterRequest, QueryAllowancesByGranterRequestSDKType, QueryAllowancesByGranterResponse, QueryAllowancesByGranterResponseSDKType } from "./query"; +/** + * Allowance returns fee granted to the grantee by the granter. + * @name getAllowance + * @package cosmos.feegrant.v1beta1 + * @see proto service: cosmos.feegrant.v1beta1.Allowance + */ +export const getAllowance = buildQuery({ + encode: QueryAllowanceRequest.encode, + decode: QueryAllowanceResponse.decode, + service: "cosmos.feegrant.v1beta1.Query", + method: "Allowance" +}); +/** + * Allowances returns all the grants for address. + * @name getAllowances + * @package cosmos.feegrant.v1beta1 + * @see proto service: cosmos.feegrant.v1beta1.Allowances + */ +export const getAllowances = buildQuery({ + encode: QueryAllowancesRequest.encode, + decode: QueryAllowancesResponse.decode, + service: "cosmos.feegrant.v1beta1.Query", + method: "Allowances" +}); +/** + * AllowancesByGranter returns all the grants given by an address + * Since v0.46 + * @name getAllowancesByGranter + * @package cosmos.feegrant.v1beta1 + * @see proto service: cosmos.feegrant.v1beta1.AllowancesByGranter + */ +export const getAllowancesByGranter = buildQuery({ + encode: QueryAllowancesByGranterRequest.encode, + decode: QueryAllowancesByGranterResponse.decode, + service: "cosmos.feegrant.v1beta1.Query", + method: "AllowancesByGranter" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputosmojs/cosmos/feegrant/v1beta1/tx.registry.ts b/__fixtures__/v-next/outputosmojs/cosmos/feegrant/v1beta1/tx.registry.ts index 071630f5c9..e850beebad 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/feegrant/v1beta1/tx.registry.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/feegrant/v1beta1/tx.registry.ts @@ -1,12 +1,7 @@ import { Any, AnySDKType } from "../../../google/protobuf/any"; -import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { TelescopeGeneratedType } from "../../../types"; import { MsgGrantAllowance, MsgGrantAllowanceSDKType, MsgRevokeAllowance, MsgRevokeAllowanceSDKType } from "./tx"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/cosmos.feegrant.v1beta1.MsgGrantAllowance", MsgGrantAllowance], ["/cosmos.feegrant.v1beta1.MsgRevokeAllowance", MsgRevokeAllowance]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/cosmos.feegrant.v1beta1.MsgGrantAllowance", MsgGrantAllowance], ["/cosmos.feegrant.v1beta1.MsgRevokeAllowance", MsgRevokeAllowance]]; export const MessageComposer = { encoded: { grantAllowance(value: MsgGrantAllowance) { diff --git a/__fixtures__/v-next/outputosmojs/cosmos/feegrant/v1beta1/tx.rpc.func.ts b/__fixtures__/v-next/outputosmojs/cosmos/feegrant/v1beta1/tx.rpc.func.ts new file mode 100644 index 0000000000..fdeebec5ab --- /dev/null +++ b/__fixtures__/v-next/outputosmojs/cosmos/feegrant/v1beta1/tx.rpc.func.ts @@ -0,0 +1,23 @@ +import { Any, AnySDKType } from "../../../google/protobuf/any"; +import { buildTx } from "../../../helper-func-types"; +import { MsgGrantAllowance, MsgGrantAllowanceSDKType, MsgGrantAllowanceResponse, MsgGrantAllowanceResponseSDKType, MsgRevokeAllowance, MsgRevokeAllowanceSDKType, MsgRevokeAllowanceResponse, MsgRevokeAllowanceResponseSDKType } from "./tx"; +/** + * GrantAllowance grants fee allowance to the grantee on the granter's + * account with the provided expiration time. + * @name grantAllowance + * @package cosmos.feegrant.v1beta1 + * @see proto service: cosmos.feegrant.v1beta1.GrantAllowance + */ +export const grantAllowance = buildTx({ + msg: MsgGrantAllowance +}); +/** + * RevokeAllowance revokes any fee allowance of granter's account that + * has been granted to the grantee. + * @name revokeAllowance + * @package cosmos.feegrant.v1beta1 + * @see proto service: cosmos.feegrant.v1beta1.RevokeAllowance + */ +export const revokeAllowance = buildTx({ + msg: MsgRevokeAllowance +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputosmojs/cosmos/feegrant/v1beta1/tx.rpc.msg.ts b/__fixtures__/v-next/outputosmojs/cosmos/feegrant/v1beta1/tx.rpc.msg.ts index 26ad0c4e9d..f3b2db1e70 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/feegrant/v1beta1/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/feegrant/v1beta1/tx.rpc.msg.ts @@ -1,5 +1,5 @@ import { Any, AnySDKType } from "../../../google/protobuf/any"; -import { Rpc } from "../../../helpers"; +import { TxRpc } from "../../../types"; import { BinaryReader } from "../../../binary"; import { MsgGrantAllowance, MsgGrantAllowanceSDKType, MsgGrantAllowanceResponse, MsgGrantAllowanceResponseSDKType, MsgRevokeAllowance, MsgRevokeAllowanceSDKType, MsgRevokeAllowanceResponse, MsgRevokeAllowanceResponseSDKType } from "./tx"; /** Msg defines the feegrant msg service. */ @@ -16,8 +16,8 @@ export interface Msg { revokeAllowance(request: MsgRevokeAllowance): Promise; } export class MsgClientImpl implements Msg { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.grantAllowance = this.grantAllowance.bind(this); this.revokeAllowance = this.revokeAllowance.bind(this); @@ -33,6 +33,6 @@ export class MsgClientImpl implements Msg { return promise.then(data => MsgRevokeAllowanceResponse.decode(new BinaryReader(data))); } } -export const createClientImpl = (rpc: Rpc) => { +export const createClientImpl = (rpc: TxRpc) => { return new MsgClientImpl(rpc); }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputosmojs/cosmos/gov/v1/query.rpc.Query.ts b/__fixtures__/v-next/outputosmojs/cosmos/gov/v1/query.rpc.Query.ts index b91631b07a..6cb6f81032 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/gov/v1/query.rpc.Query.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/gov/v1/query.rpc.Query.ts @@ -1,6 +1,6 @@ import { ProposalStatus, ProposalStatusSDKType, Proposal, ProposalSDKType, Vote, VoteSDKType, VotingParams, VotingParamsSDKType, DepositParams, DepositParamsSDKType, TallyParams, TallyParamsSDKType, Deposit, DepositSDKType, TallyResult, TallyResultSDKType } from "./gov"; import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; -import { Rpc } from "../../../helpers"; +import { TxRpc } from "../../../types"; import { BinaryReader } from "../../../binary"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; 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"; @@ -24,8 +24,8 @@ export interface Query { tallyResult(request: QueryTallyResultRequest): Promise; } export class QueryClientImpl implements Query { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.proposal = this.proposal.bind(this); this.proposals = this.proposals.bind(this); diff --git a/__fixtures__/v-next/outputosmojs/cosmos/gov/v1/query.rpc.func.ts b/__fixtures__/v-next/outputosmojs/cosmos/gov/v1/query.rpc.func.ts new file mode 100644 index 0000000000..72ca1d7f03 --- /dev/null +++ b/__fixtures__/v-next/outputosmojs/cosmos/gov/v1/query.rpc.func.ts @@ -0,0 +1,100 @@ +import { ProposalStatus, ProposalStatusSDKType, Proposal, ProposalSDKType, Vote, VoteSDKType, VotingParams, VotingParamsSDKType, DepositParams, DepositParamsSDKType, TallyParams, TallyParamsSDKType, Deposit, DepositSDKType, TallyResult, TallyResultSDKType } from "./gov"; +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +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"; +/** + * Proposal queries proposal details based on ProposalID. + * @name getProposal + * @package cosmos.gov.v1 + * @see proto service: cosmos.gov.v1.Proposal + */ +export const getProposal = buildQuery({ + encode: QueryProposalRequest.encode, + decode: QueryProposalResponse.decode, + service: "cosmos.gov.v1.Query", + method: "Proposal" +}); +/** + * Proposals queries all proposals based on given status. + * @name getProposals + * @package cosmos.gov.v1 + * @see proto service: cosmos.gov.v1.Proposals + */ +export const getProposals = buildQuery({ + encode: QueryProposalsRequest.encode, + decode: QueryProposalsResponse.decode, + service: "cosmos.gov.v1.Query", + method: "Proposals" +}); +/** + * Vote queries voted information based on proposalID, voterAddr. + * @name getVote + * @package cosmos.gov.v1 + * @see proto service: cosmos.gov.v1.Vote + */ +export const getVote = buildQuery({ + encode: QueryVoteRequest.encode, + decode: QueryVoteResponse.decode, + service: "cosmos.gov.v1.Query", + method: "Vote" +}); +/** + * Votes queries votes of a given proposal. + * @name getVotes + * @package cosmos.gov.v1 + * @see proto service: cosmos.gov.v1.Votes + */ +export const getVotes = buildQuery({ + encode: QueryVotesRequest.encode, + decode: QueryVotesResponse.decode, + service: "cosmos.gov.v1.Query", + method: "Votes" +}); +/** + * Params queries all parameters of the gov module. + * @name getParams + * @package cosmos.gov.v1 + * @see proto service: cosmos.gov.v1.Params + */ +export const getParams = buildQuery({ + encode: QueryParamsRequest.encode, + decode: QueryParamsResponse.decode, + service: "cosmos.gov.v1.Query", + method: "Params" +}); +/** + * Deposit queries single deposit information based proposalID, depositAddr. + * @name getDeposit + * @package cosmos.gov.v1 + * @see proto service: cosmos.gov.v1.Deposit + */ +export const getDeposit = buildQuery({ + encode: QueryDepositRequest.encode, + decode: QueryDepositResponse.decode, + service: "cosmos.gov.v1.Query", + method: "Deposit" +}); +/** + * Deposits queries all deposits of a single proposal. + * @name getDeposits + * @package cosmos.gov.v1 + * @see proto service: cosmos.gov.v1.Deposits + */ +export const getDeposits = buildQuery({ + encode: QueryDepositsRequest.encode, + decode: QueryDepositsResponse.decode, + service: "cosmos.gov.v1.Query", + method: "Deposits" +}); +/** + * TallyResult queries the tally of a proposal vote. + * @name getTallyResult + * @package cosmos.gov.v1 + * @see proto service: cosmos.gov.v1.TallyResult + */ +export const getTallyResult = buildQuery({ + encode: QueryTallyResultRequest.encode, + decode: QueryTallyResultResponse.decode, + service: "cosmos.gov.v1.Query", + method: "TallyResult" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputosmojs/cosmos/gov/v1/tx.registry.ts b/__fixtures__/v-next/outputosmojs/cosmos/gov/v1/tx.registry.ts index eeb73d2528..da38566e53 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/gov/v1/tx.registry.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/gov/v1/tx.registry.ts @@ -1,14 +1,9 @@ import { Any, AnySDKType } from "../../../google/protobuf/any"; import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; import { VoteOption, VoteOptionSDKType, WeightedVoteOption, WeightedVoteOptionSDKType } from "./gov"; -import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { TelescopeGeneratedType } from "../../../types"; import { MsgSubmitProposal, MsgSubmitProposalSDKType, MsgExecLegacyContent, MsgExecLegacyContentSDKType, MsgVote, MsgVoteSDKType, MsgVoteWeighted, MsgVoteWeightedSDKType, MsgDeposit, MsgDepositSDKType } from "./tx"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/cosmos.gov.v1.MsgSubmitProposal", MsgSubmitProposal], ["/cosmos.gov.v1.MsgExecLegacyContent", MsgExecLegacyContent], ["/cosmos.gov.v1.MsgVote", MsgVote], ["/cosmos.gov.v1.MsgVoteWeighted", MsgVoteWeighted], ["/cosmos.gov.v1.MsgDeposit", MsgDeposit]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/cosmos.gov.v1.MsgSubmitProposal", MsgSubmitProposal], ["/cosmos.gov.v1.MsgExecLegacyContent", MsgExecLegacyContent], ["/cosmos.gov.v1.MsgVote", MsgVote], ["/cosmos.gov.v1.MsgVoteWeighted", MsgVoteWeighted], ["/cosmos.gov.v1.MsgDeposit", MsgDeposit]]; export const MessageComposer = { encoded: { submitProposal(value: MsgSubmitProposal) { diff --git a/__fixtures__/v-next/outputosmojs/cosmos/gov/v1/tx.rpc.func.ts b/__fixtures__/v-next/outputosmojs/cosmos/gov/v1/tx.rpc.func.ts new file mode 100644 index 0000000000..3e94b91fbe --- /dev/null +++ b/__fixtures__/v-next/outputosmojs/cosmos/gov/v1/tx.rpc.func.ts @@ -0,0 +1,51 @@ +import { Any, AnySDKType } from "../../../google/protobuf/any"; +import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; +import { VoteOption, VoteOptionSDKType, WeightedVoteOption, WeightedVoteOptionSDKType } from "./gov"; +import { buildTx } from "../../../helper-func-types"; +import { MsgSubmitProposal, MsgSubmitProposalSDKType, MsgSubmitProposalResponse, MsgSubmitProposalResponseSDKType, MsgExecLegacyContent, MsgExecLegacyContentSDKType, MsgExecLegacyContentResponse, MsgExecLegacyContentResponseSDKType, MsgVote, MsgVoteSDKType, MsgVoteResponse, MsgVoteResponseSDKType, MsgVoteWeighted, MsgVoteWeightedSDKType, MsgVoteWeightedResponse, MsgVoteWeightedResponseSDKType, MsgDeposit, MsgDepositSDKType, MsgDepositResponse, MsgDepositResponseSDKType } from "./tx"; +/** + * SubmitProposal defines a method to create new proposal given a content. + * @name submitProposal + * @package cosmos.gov.v1 + * @see proto service: cosmos.gov.v1.SubmitProposal + */ +export const submitProposal = buildTx({ + msg: MsgSubmitProposal +}); +/** + * ExecLegacyContent defines a Msg to be in included in a MsgSubmitProposal + * to execute a legacy content-based proposal. + * @name execLegacyContent + * @package cosmos.gov.v1 + * @see proto service: cosmos.gov.v1.ExecLegacyContent + */ +export const execLegacyContent = buildTx({ + msg: MsgExecLegacyContent +}); +/** + * Vote defines a method to add a vote on a specific proposal. + * @name vote + * @package cosmos.gov.v1 + * @see proto service: cosmos.gov.v1.Vote + */ +export const vote = buildTx({ + msg: MsgVote +}); +/** + * VoteWeighted defines a method to add a weighted vote on a specific proposal. + * @name voteWeighted + * @package cosmos.gov.v1 + * @see proto service: cosmos.gov.v1.VoteWeighted + */ +export const voteWeighted = buildTx({ + msg: MsgVoteWeighted +}); +/** + * Deposit defines a method to add deposit on a specific proposal. + * @name deposit + * @package cosmos.gov.v1 + * @see proto service: cosmos.gov.v1.Deposit + */ +export const deposit = buildTx({ + msg: MsgDeposit +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputosmojs/cosmos/gov/v1/tx.rpc.msg.ts b/__fixtures__/v-next/outputosmojs/cosmos/gov/v1/tx.rpc.msg.ts index fe1fce32e3..854194f875 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/gov/v1/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/gov/v1/tx.rpc.msg.ts @@ -1,7 +1,7 @@ import { Any, AnySDKType } from "../../../google/protobuf/any"; import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; import { VoteOption, VoteOptionSDKType, WeightedVoteOption, WeightedVoteOptionSDKType } from "./gov"; -import { Rpc } from "../../../helpers"; +import { TxRpc } from "../../../types"; import { BinaryReader } from "../../../binary"; import { MsgSubmitProposal, MsgSubmitProposalSDKType, MsgSubmitProposalResponse, MsgSubmitProposalResponseSDKType, MsgExecLegacyContent, MsgExecLegacyContentSDKType, MsgExecLegacyContentResponse, MsgExecLegacyContentResponseSDKType, MsgVote, MsgVoteSDKType, MsgVoteResponse, MsgVoteResponseSDKType, MsgVoteWeighted, MsgVoteWeightedSDKType, MsgVoteWeightedResponse, MsgVoteWeightedResponseSDKType, MsgDeposit, MsgDepositSDKType, MsgDepositResponse, MsgDepositResponseSDKType } from "./tx"; /** Msg defines the gov Msg service. */ @@ -21,8 +21,8 @@ export interface Msg { deposit(request: MsgDeposit): Promise; } export class MsgClientImpl implements Msg { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.submitProposal = this.submitProposal.bind(this); this.execLegacyContent = this.execLegacyContent.bind(this); @@ -56,6 +56,6 @@ export class MsgClientImpl implements Msg { return promise.then(data => MsgDepositResponse.decode(new BinaryReader(data))); } } -export const createClientImpl = (rpc: Rpc) => { +export const createClientImpl = (rpc: TxRpc) => { return new MsgClientImpl(rpc); }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputosmojs/cosmos/gov/v1beta1/gov.ts b/__fixtures__/v-next/outputosmojs/cosmos/gov/v1beta1/gov.ts index d01e8de627..12321bb5cc 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/gov/v1beta1/gov.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/gov/v1beta1/gov.ts @@ -3,7 +3,7 @@ import { Any, AnySDKType } from "../../../google/protobuf/any"; import { Timestamp, TimestampSDKType } from "../../../google/protobuf/timestamp"; import { Duration, DurationSDKType } from "../../../google/protobuf/duration"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { Decimal } from "@cosmjs/math"; +import { Decimal } from "@interchainjs/math"; import { isSet, DeepPartial, toTimestamp, fromTimestamp, bytesFromBase64, base64FromBytes } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "cosmos.gov.v1beta1"; @@ -521,7 +521,7 @@ export const WeightedVoteOption = { toAmino(message: WeightedVoteOption): WeightedVoteOptionAmino { const obj: any = {}; obj.option = message.option === 0 ? undefined : message.option; - obj.weight = message.weight === "" ? undefined : message.weight; + obj.weight = message.weight === "" ? undefined : Decimal.fromUserInput(message.weight, 18).atomics; return obj; }, fromAminoMsg(object: WeightedVoteOptionAminoMsg): WeightedVoteOption { diff --git a/__fixtures__/v-next/outputosmojs/cosmos/gov/v1beta1/query.rpc.Query.ts b/__fixtures__/v-next/outputosmojs/cosmos/gov/v1beta1/query.rpc.Query.ts index c9d530b12e..06b400aa02 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/gov/v1beta1/query.rpc.Query.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/gov/v1beta1/query.rpc.Query.ts @@ -1,6 +1,6 @@ import { ProposalStatus, ProposalStatusSDKType, Proposal, ProposalSDKType, Vote, VoteSDKType, VotingParams, VotingParamsSDKType, DepositParams, DepositParamsSDKType, TallyParams, TallyParamsSDKType, Deposit, DepositSDKType, TallyResult, TallyResultSDKType } from "./gov"; import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; -import { Rpc } from "../../../helpers"; +import { TxRpc } from "../../../types"; import { BinaryReader } from "../../../binary"; import { QueryClient, createProtobufRpcClient, ProtobufRpcClient } from "@cosmjs/stargate"; import { QueryStore, MobxResponse } from "../../../mobx"; @@ -26,8 +26,8 @@ export interface Query { tallyResult(request: QueryTallyResultRequest): Promise; } export class QueryClientImpl implements Query { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.proposal = this.proposal.bind(this); this.proposals = this.proposals.bind(this); diff --git a/__fixtures__/v-next/outputosmojs/cosmos/gov/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputosmojs/cosmos/gov/v1beta1/query.rpc.func.ts new file mode 100644 index 0000000000..8a24300a35 --- /dev/null +++ b/__fixtures__/v-next/outputosmojs/cosmos/gov/v1beta1/query.rpc.func.ts @@ -0,0 +1,100 @@ +import { ProposalStatus, ProposalStatusSDKType, Proposal, ProposalSDKType, Vote, VoteSDKType, VotingParams, VotingParamsSDKType, DepositParams, DepositParamsSDKType, TallyParams, TallyParamsSDKType, Deposit, DepositSDKType, TallyResult, TallyResultSDKType } from "./gov"; +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +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"; +/** + * Proposal queries proposal details based on ProposalID. + * @name getProposal + * @package cosmos.gov.v1beta1 + * @see proto service: cosmos.gov.v1beta1.Proposal + */ +export const getProposal = buildQuery({ + encode: QueryProposalRequest.encode, + decode: QueryProposalResponse.decode, + service: "cosmos.gov.v1beta1.Query", + method: "Proposal" +}); +/** + * Proposals queries all proposals based on given status. + * @name getProposals + * @package cosmos.gov.v1beta1 + * @see proto service: cosmos.gov.v1beta1.Proposals + */ +export const getProposals = buildQuery({ + encode: QueryProposalsRequest.encode, + decode: QueryProposalsResponse.decode, + service: "cosmos.gov.v1beta1.Query", + method: "Proposals" +}); +/** + * Vote queries voted information based on proposalID, voterAddr. + * @name getVote + * @package cosmos.gov.v1beta1 + * @see proto service: cosmos.gov.v1beta1.Vote + */ +export const getVote = buildQuery({ + encode: QueryVoteRequest.encode, + decode: QueryVoteResponse.decode, + service: "cosmos.gov.v1beta1.Query", + method: "Vote" +}); +/** + * Votes queries votes of a given proposal. + * @name getVotes + * @package cosmos.gov.v1beta1 + * @see proto service: cosmos.gov.v1beta1.Votes + */ +export const getVotes = buildQuery({ + encode: QueryVotesRequest.encode, + decode: QueryVotesResponse.decode, + service: "cosmos.gov.v1beta1.Query", + method: "Votes" +}); +/** + * Params queries all parameters of the gov module. + * @name getParams + * @package cosmos.gov.v1beta1 + * @see proto service: cosmos.gov.v1beta1.Params + */ +export const getParams = buildQuery({ + encode: QueryParamsRequest.encode, + decode: QueryParamsResponse.decode, + service: "cosmos.gov.v1beta1.Query", + method: "Params" +}); +/** + * Deposit queries single deposit information based proposalID, depositAddr. + * @name getDeposit + * @package cosmos.gov.v1beta1 + * @see proto service: cosmos.gov.v1beta1.Deposit + */ +export const getDeposit = buildQuery({ + encode: QueryDepositRequest.encode, + decode: QueryDepositResponse.decode, + service: "cosmos.gov.v1beta1.Query", + method: "Deposit" +}); +/** + * Deposits queries all deposits of a single proposal. + * @name getDeposits + * @package cosmos.gov.v1beta1 + * @see proto service: cosmos.gov.v1beta1.Deposits + */ +export const getDeposits = buildQuery({ + encode: QueryDepositsRequest.encode, + decode: QueryDepositsResponse.decode, + service: "cosmos.gov.v1beta1.Query", + method: "Deposits" +}); +/** + * TallyResult queries the tally of a proposal vote. + * @name getTallyResult + * @package cosmos.gov.v1beta1 + * @see proto service: cosmos.gov.v1beta1.TallyResult + */ +export const getTallyResult = buildQuery({ + encode: QueryTallyResultRequest.encode, + decode: QueryTallyResultResponse.decode, + service: "cosmos.gov.v1beta1.Query", + method: "TallyResult" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputosmojs/cosmos/gov/v1beta1/tx.amino.ts b/__fixtures__/v-next/outputosmojs/cosmos/gov/v1beta1/tx.amino.ts index fad45eaf42..4f11e53efa 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/gov/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/gov/v1beta1/tx.amino.ts @@ -2,6 +2,7 @@ import { Any, AnySDKType } from "../../../google/protobuf/any"; import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; import { VoteOption, VoteOptionSDKType, WeightedVoteOption, WeightedVoteOptionSDKType, voteOptionFromJSON } from "./gov"; import { AminoMsg } from "@cosmjs/amino"; +import { Decimal } from "@interchainjs/math"; import { MsgSubmitProposal, MsgSubmitProposalSDKType, MsgVote, MsgVoteSDKType, MsgVoteWeighted, MsgVoteWeightedSDKType, MsgDeposit, MsgDepositSDKType } from "./tx"; export interface MsgSubmitProposalAminoType extends AminoMsg { type: "cosmos-sdk/MsgSubmitProposal"; @@ -122,7 +123,7 @@ export const AminoConverter = { voter, options: options.map(el0 => ({ option: el0.option, - weight: el0.weight + weight: Decimal.fromUserInput(el0.weight, 18).atomics })) }; }, diff --git a/__fixtures__/v-next/outputosmojs/cosmos/gov/v1beta1/tx.registry.ts b/__fixtures__/v-next/outputosmojs/cosmos/gov/v1beta1/tx.registry.ts index 0b7996cb4f..e199dcdad2 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/gov/v1beta1/tx.registry.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/gov/v1beta1/tx.registry.ts @@ -1,14 +1,9 @@ import { Any, AnySDKType } from "../../../google/protobuf/any"; import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; import { VoteOption, VoteOptionSDKType, WeightedVoteOption, WeightedVoteOptionSDKType } from "./gov"; -import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { TelescopeGeneratedType } from "../../../types"; import { MsgSubmitProposal, MsgSubmitProposalSDKType, MsgVote, MsgVoteSDKType, MsgVoteWeighted, MsgVoteWeightedSDKType, MsgDeposit, MsgDepositSDKType } from "./tx"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/cosmos.gov.v1beta1.MsgSubmitProposal", MsgSubmitProposal], ["/cosmos.gov.v1beta1.MsgVote", MsgVote], ["/cosmos.gov.v1beta1.MsgVoteWeighted", MsgVoteWeighted], ["/cosmos.gov.v1beta1.MsgDeposit", MsgDeposit]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/cosmos.gov.v1beta1.MsgSubmitProposal", MsgSubmitProposal], ["/cosmos.gov.v1beta1.MsgVote", MsgVote], ["/cosmos.gov.v1beta1.MsgVoteWeighted", MsgVoteWeighted], ["/cosmos.gov.v1beta1.MsgDeposit", MsgDeposit]]; export const MessageComposer = { encoded: { submitProposal(value: MsgSubmitProposal) { diff --git a/__fixtures__/v-next/outputosmojs/cosmos/gov/v1beta1/tx.rpc.func.ts b/__fixtures__/v-next/outputosmojs/cosmos/gov/v1beta1/tx.rpc.func.ts new file mode 100644 index 0000000000..27f5d2f876 --- /dev/null +++ b/__fixtures__/v-next/outputosmojs/cosmos/gov/v1beta1/tx.rpc.func.ts @@ -0,0 +1,43 @@ +import { Any, AnySDKType } from "../../../google/protobuf/any"; +import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; +import { VoteOption, VoteOptionSDKType, WeightedVoteOption, WeightedVoteOptionSDKType } from "./gov"; +import { buildTx } from "../../../helper-func-types"; +import { MsgSubmitProposal, MsgSubmitProposalSDKType, MsgSubmitProposalResponse, MsgSubmitProposalResponseSDKType, MsgVote, MsgVoteSDKType, MsgVoteResponse, MsgVoteResponseSDKType, MsgVoteWeighted, MsgVoteWeightedSDKType, MsgVoteWeightedResponse, MsgVoteWeightedResponseSDKType, MsgDeposit, MsgDepositSDKType, MsgDepositResponse, MsgDepositResponseSDKType } from "./tx"; +/** + * SubmitProposal defines a method to create new proposal given a content. + * @name submitProposal + * @package cosmos.gov.v1beta1 + * @see proto service: cosmos.gov.v1beta1.SubmitProposal + */ +export const submitProposal = buildTx({ + msg: MsgSubmitProposal +}); +/** + * Vote defines a method to add a vote on a specific proposal. + * @name vote + * @package cosmos.gov.v1beta1 + * @see proto service: cosmos.gov.v1beta1.Vote + */ +export const vote = buildTx({ + msg: MsgVote +}); +/** + * VoteWeighted defines a method to add a weighted vote on a specific proposal. + * + * Since: cosmos-sdk 0.43 + * @name voteWeighted + * @package cosmos.gov.v1beta1 + * @see proto service: cosmos.gov.v1beta1.VoteWeighted + */ +export const voteWeighted = buildTx({ + msg: MsgVoteWeighted +}); +/** + * Deposit defines a method to add deposit on a specific proposal. + * @name deposit + * @package cosmos.gov.v1beta1 + * @see proto service: cosmos.gov.v1beta1.Deposit + */ +export const deposit = buildTx({ + msg: MsgDeposit +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputosmojs/cosmos/gov/v1beta1/tx.rpc.msg.ts b/__fixtures__/v-next/outputosmojs/cosmos/gov/v1beta1/tx.rpc.msg.ts index 1d377e2fcd..ee139be1ef 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/gov/v1beta1/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/gov/v1beta1/tx.rpc.msg.ts @@ -1,7 +1,7 @@ import { Any, AnySDKType } from "../../../google/protobuf/any"; import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; import { VoteOption, VoteOptionSDKType, WeightedVoteOption, WeightedVoteOptionSDKType } from "./gov"; -import { Rpc } from "../../../helpers"; +import { TxRpc } from "../../../types"; import { BinaryReader } from "../../../binary"; import { MsgSubmitProposal, MsgSubmitProposalSDKType, MsgSubmitProposalResponse, MsgSubmitProposalResponseSDKType, MsgVote, MsgVoteSDKType, MsgVoteResponse, MsgVoteResponseSDKType, MsgVoteWeighted, MsgVoteWeightedSDKType, MsgVoteWeightedResponse, MsgVoteWeightedResponseSDKType, MsgDeposit, MsgDepositSDKType, MsgDepositResponse, MsgDepositResponseSDKType } from "./tx"; /** Msg defines the bank Msg service. */ @@ -20,8 +20,8 @@ export interface Msg { deposit(request: MsgDeposit): Promise; } export class MsgClientImpl implements Msg { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.submitProposal = this.submitProposal.bind(this); this.vote = this.vote.bind(this); @@ -49,6 +49,6 @@ export class MsgClientImpl implements Msg { return promise.then(data => MsgDepositResponse.decode(new BinaryReader(data))); } } -export const createClientImpl = (rpc: Rpc) => { +export const createClientImpl = (rpc: TxRpc) => { return new MsgClientImpl(rpc); }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputosmojs/cosmos/group/v1/query.rpc.Query.ts b/__fixtures__/v-next/outputosmojs/cosmos/group/v1/query.rpc.Query.ts index 111dd91449..e22d58ec58 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/group/v1/query.rpc.Query.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/group/v1/query.rpc.Query.ts @@ -1,6 +1,6 @@ import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; import { GroupInfo, GroupInfoSDKType, GroupPolicyInfo, GroupPolicyInfoSDKType, GroupMember, GroupMemberSDKType, Proposal, ProposalSDKType, Vote, VoteSDKType, TallyResult, TallyResultSDKType } from "./types"; -import { Rpc } from "../../../helpers"; +import { TxRpc } from "../../../types"; import { BinaryReader } from "../../../binary"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; import { QueryGroupInfoRequest, QueryGroupInfoRequestSDKType, QueryGroupInfoResponse, QueryGroupInfoResponseSDKType, QueryGroupPolicyInfoRequest, QueryGroupPolicyInfoRequestSDKType, QueryGroupPolicyInfoResponse, QueryGroupPolicyInfoResponseSDKType, QueryGroupMembersRequest, QueryGroupMembersRequestSDKType, QueryGroupMembersResponse, QueryGroupMembersResponseSDKType, QueryGroupsByAdminRequest, QueryGroupsByAdminRequestSDKType, QueryGroupsByAdminResponse, QueryGroupsByAdminResponseSDKType, QueryGroupPoliciesByGroupRequest, QueryGroupPoliciesByGroupRequestSDKType, QueryGroupPoliciesByGroupResponse, QueryGroupPoliciesByGroupResponseSDKType, QueryGroupPoliciesByAdminRequest, QueryGroupPoliciesByAdminRequestSDKType, QueryGroupPoliciesByAdminResponse, QueryGroupPoliciesByAdminResponseSDKType, QueryProposalRequest, QueryProposalRequestSDKType, QueryProposalResponse, QueryProposalResponseSDKType, QueryProposalsByGroupPolicyRequest, QueryProposalsByGroupPolicyRequestSDKType, QueryProposalsByGroupPolicyResponse, QueryProposalsByGroupPolicyResponseSDKType, QueryVoteByProposalVoterRequest, QueryVoteByProposalVoterRequestSDKType, QueryVoteByProposalVoterResponse, QueryVoteByProposalVoterResponseSDKType, QueryVotesByProposalRequest, QueryVotesByProposalRequestSDKType, QueryVotesByProposalResponse, QueryVotesByProposalResponseSDKType, QueryVotesByVoterRequest, QueryVotesByVoterRequestSDKType, QueryVotesByVoterResponse, QueryVotesByVoterResponseSDKType, QueryGroupsByMemberRequest, QueryGroupsByMemberRequestSDKType, QueryGroupsByMemberResponse, QueryGroupsByMemberResponseSDKType, QueryTallyResultRequest, QueryTallyResultRequestSDKType, QueryTallyResultResponse, QueryTallyResultResponseSDKType } from "./query"; @@ -34,8 +34,8 @@ export interface Query { tallyResult(request: QueryTallyResultRequest): Promise; } export class QueryClientImpl implements Query { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.groupInfo = this.groupInfo.bind(this); this.groupPolicyInfo = this.groupPolicyInfo.bind(this); diff --git a/__fixtures__/v-next/outputosmojs/cosmos/group/v1/query.rpc.func.ts b/__fixtures__/v-next/outputosmojs/cosmos/group/v1/query.rpc.func.ts new file mode 100644 index 0000000000..6172c0378f --- /dev/null +++ b/__fixtures__/v-next/outputosmojs/cosmos/group/v1/query.rpc.func.ts @@ -0,0 +1,160 @@ +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; +import { GroupInfo, GroupInfoSDKType, GroupPolicyInfo, GroupPolicyInfoSDKType, GroupMember, GroupMemberSDKType, Proposal, ProposalSDKType, Vote, VoteSDKType, TallyResult, TallyResultSDKType } from "./types"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { QueryGroupInfoRequest, QueryGroupInfoRequestSDKType, QueryGroupInfoResponse, QueryGroupInfoResponseSDKType, QueryGroupPolicyInfoRequest, QueryGroupPolicyInfoRequestSDKType, QueryGroupPolicyInfoResponse, QueryGroupPolicyInfoResponseSDKType, QueryGroupMembersRequest, QueryGroupMembersRequestSDKType, QueryGroupMembersResponse, QueryGroupMembersResponseSDKType, QueryGroupsByAdminRequest, QueryGroupsByAdminRequestSDKType, QueryGroupsByAdminResponse, QueryGroupsByAdminResponseSDKType, QueryGroupPoliciesByGroupRequest, QueryGroupPoliciesByGroupRequestSDKType, QueryGroupPoliciesByGroupResponse, QueryGroupPoliciesByGroupResponseSDKType, QueryGroupPoliciesByAdminRequest, QueryGroupPoliciesByAdminRequestSDKType, QueryGroupPoliciesByAdminResponse, QueryGroupPoliciesByAdminResponseSDKType, QueryProposalRequest, QueryProposalRequestSDKType, QueryProposalResponse, QueryProposalResponseSDKType, QueryProposalsByGroupPolicyRequest, QueryProposalsByGroupPolicyRequestSDKType, QueryProposalsByGroupPolicyResponse, QueryProposalsByGroupPolicyResponseSDKType, QueryVoteByProposalVoterRequest, QueryVoteByProposalVoterRequestSDKType, QueryVoteByProposalVoterResponse, QueryVoteByProposalVoterResponseSDKType, QueryVotesByProposalRequest, QueryVotesByProposalRequestSDKType, QueryVotesByProposalResponse, QueryVotesByProposalResponseSDKType, QueryVotesByVoterRequest, QueryVotesByVoterRequestSDKType, QueryVotesByVoterResponse, QueryVotesByVoterResponseSDKType, QueryGroupsByMemberRequest, QueryGroupsByMemberRequestSDKType, QueryGroupsByMemberResponse, QueryGroupsByMemberResponseSDKType, QueryTallyResultRequest, QueryTallyResultRequestSDKType, QueryTallyResultResponse, QueryTallyResultResponseSDKType } from "./query"; +/** + * GroupInfo queries group info based on group id. + * @name getGroupInfo + * @package cosmos.group.v1 + * @see proto service: cosmos.group.v1.GroupInfo + */ +export const getGroupInfo = buildQuery({ + encode: QueryGroupInfoRequest.encode, + decode: QueryGroupInfoResponse.decode, + service: "cosmos.group.v1.Query", + method: "GroupInfo" +}); +/** + * GroupPolicyInfo queries group policy info based on account address of group policy. + * @name getGroupPolicyInfo + * @package cosmos.group.v1 + * @see proto service: cosmos.group.v1.GroupPolicyInfo + */ +export const getGroupPolicyInfo = buildQuery({ + encode: QueryGroupPolicyInfoRequest.encode, + decode: QueryGroupPolicyInfoResponse.decode, + service: "cosmos.group.v1.Query", + method: "GroupPolicyInfo" +}); +/** + * GroupMembers queries members of a group + * @name getGroupMembers + * @package cosmos.group.v1 + * @see proto service: cosmos.group.v1.GroupMembers + */ +export const getGroupMembers = buildQuery({ + encode: QueryGroupMembersRequest.encode, + decode: QueryGroupMembersResponse.decode, + service: "cosmos.group.v1.Query", + method: "GroupMembers" +}); +/** + * GroupsByAdmin queries groups by admin address. + * @name getGroupsByAdmin + * @package cosmos.group.v1 + * @see proto service: cosmos.group.v1.GroupsByAdmin + */ +export const getGroupsByAdmin = buildQuery({ + encode: QueryGroupsByAdminRequest.encode, + decode: QueryGroupsByAdminResponse.decode, + service: "cosmos.group.v1.Query", + method: "GroupsByAdmin" +}); +/** + * GroupPoliciesByGroup queries group policies by group id. + * @name getGroupPoliciesByGroup + * @package cosmos.group.v1 + * @see proto service: cosmos.group.v1.GroupPoliciesByGroup + */ +export const getGroupPoliciesByGroup = buildQuery({ + encode: QueryGroupPoliciesByGroupRequest.encode, + decode: QueryGroupPoliciesByGroupResponse.decode, + service: "cosmos.group.v1.Query", + method: "GroupPoliciesByGroup" +}); +/** + * GroupsByAdmin queries group policies by admin address. + * @name getGroupPoliciesByAdmin + * @package cosmos.group.v1 + * @see proto service: cosmos.group.v1.GroupPoliciesByAdmin + */ +export const getGroupPoliciesByAdmin = buildQuery({ + encode: QueryGroupPoliciesByAdminRequest.encode, + decode: QueryGroupPoliciesByAdminResponse.decode, + service: "cosmos.group.v1.Query", + method: "GroupPoliciesByAdmin" +}); +/** + * Proposal queries a proposal based on proposal id. + * @name getProposal + * @package cosmos.group.v1 + * @see proto service: cosmos.group.v1.Proposal + */ +export const getProposal = buildQuery({ + encode: QueryProposalRequest.encode, + decode: QueryProposalResponse.decode, + service: "cosmos.group.v1.Query", + method: "Proposal" +}); +/** + * ProposalsByGroupPolicy queries proposals based on account address of group policy. + * @name getProposalsByGroupPolicy + * @package cosmos.group.v1 + * @see proto service: cosmos.group.v1.ProposalsByGroupPolicy + */ +export const getProposalsByGroupPolicy = buildQuery({ + encode: QueryProposalsByGroupPolicyRequest.encode, + decode: QueryProposalsByGroupPolicyResponse.decode, + service: "cosmos.group.v1.Query", + method: "ProposalsByGroupPolicy" +}); +/** + * VoteByProposalVoter queries a vote by proposal id and voter. + * @name getVoteByProposalVoter + * @package cosmos.group.v1 + * @see proto service: cosmos.group.v1.VoteByProposalVoter + */ +export const getVoteByProposalVoter = buildQuery({ + encode: QueryVoteByProposalVoterRequest.encode, + decode: QueryVoteByProposalVoterResponse.decode, + service: "cosmos.group.v1.Query", + method: "VoteByProposalVoter" +}); +/** + * VotesByProposal queries a vote by proposal. + * @name getVotesByProposal + * @package cosmos.group.v1 + * @see proto service: cosmos.group.v1.VotesByProposal + */ +export const getVotesByProposal = buildQuery({ + encode: QueryVotesByProposalRequest.encode, + decode: QueryVotesByProposalResponse.decode, + service: "cosmos.group.v1.Query", + method: "VotesByProposal" +}); +/** + * VotesByVoter queries a vote by voter. + * @name getVotesByVoter + * @package cosmos.group.v1 + * @see proto service: cosmos.group.v1.VotesByVoter + */ +export const getVotesByVoter = buildQuery({ + encode: QueryVotesByVoterRequest.encode, + decode: QueryVotesByVoterResponse.decode, + service: "cosmos.group.v1.Query", + method: "VotesByVoter" +}); +/** + * GroupsByMember queries groups by member address. + * @name getGroupsByMember + * @package cosmos.group.v1 + * @see proto service: cosmos.group.v1.GroupsByMember + */ +export const getGroupsByMember = buildQuery({ + encode: QueryGroupsByMemberRequest.encode, + decode: QueryGroupsByMemberResponse.decode, + service: "cosmos.group.v1.Query", + method: "GroupsByMember" +}); +/** + * TallyResult queries the tally of a proposal votes. + * @name getTallyResult + * @package cosmos.group.v1 + * @see proto service: cosmos.group.v1.TallyResult + */ +export const getTallyResult = buildQuery({ + encode: QueryTallyResultRequest.encode, + decode: QueryTallyResultResponse.decode, + service: "cosmos.group.v1.Query", + method: "TallyResult" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputosmojs/cosmos/group/v1/tx.registry.ts b/__fixtures__/v-next/outputosmojs/cosmos/group/v1/tx.registry.ts index acd413bd4d..a39bff7e74 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/group/v1/tx.registry.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/group/v1/tx.registry.ts @@ -1,13 +1,8 @@ import { Member, MemberSDKType, VoteOption, VoteOptionSDKType } from "./types"; import { Any, AnySDKType } from "../../../google/protobuf/any"; -import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { TelescopeGeneratedType } from "../../../types"; import { MsgCreateGroup, MsgCreateGroupSDKType, MsgUpdateGroupMembers, MsgUpdateGroupMembersSDKType, MsgUpdateGroupAdmin, MsgUpdateGroupAdminSDKType, MsgUpdateGroupMetadata, MsgUpdateGroupMetadataSDKType, MsgCreateGroupPolicy, MsgCreateGroupPolicySDKType, MsgCreateGroupWithPolicy, MsgCreateGroupWithPolicySDKType, MsgUpdateGroupPolicyAdmin, MsgUpdateGroupPolicyAdminSDKType, MsgUpdateGroupPolicyDecisionPolicy, MsgUpdateGroupPolicyDecisionPolicySDKType, MsgUpdateGroupPolicyMetadata, MsgUpdateGroupPolicyMetadataSDKType, MsgSubmitProposal, MsgSubmitProposalSDKType, MsgWithdrawProposal, MsgWithdrawProposalSDKType, MsgVote, MsgVoteSDKType, MsgExec, MsgExecSDKType, MsgLeaveGroup, MsgLeaveGroupSDKType } from "./tx"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/cosmos.group.v1.MsgCreateGroup", MsgCreateGroup], ["/cosmos.group.v1.MsgUpdateGroupMembers", MsgUpdateGroupMembers], ["/cosmos.group.v1.MsgUpdateGroupAdmin", MsgUpdateGroupAdmin], ["/cosmos.group.v1.MsgUpdateGroupMetadata", MsgUpdateGroupMetadata], ["/cosmos.group.v1.MsgCreateGroupPolicy", MsgCreateGroupPolicy], ["/cosmos.group.v1.MsgCreateGroupWithPolicy", MsgCreateGroupWithPolicy], ["/cosmos.group.v1.MsgUpdateGroupPolicyAdmin", MsgUpdateGroupPolicyAdmin], ["/cosmos.group.v1.MsgUpdateGroupPolicyDecisionPolicy", MsgUpdateGroupPolicyDecisionPolicy], ["/cosmos.group.v1.MsgUpdateGroupPolicyMetadata", MsgUpdateGroupPolicyMetadata], ["/cosmos.group.v1.MsgSubmitProposal", MsgSubmitProposal], ["/cosmos.group.v1.MsgWithdrawProposal", MsgWithdrawProposal], ["/cosmos.group.v1.MsgVote", MsgVote], ["/cosmos.group.v1.MsgExec", MsgExec], ["/cosmos.group.v1.MsgLeaveGroup", MsgLeaveGroup]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/cosmos.group.v1.MsgCreateGroup", MsgCreateGroup], ["/cosmos.group.v1.MsgUpdateGroupMembers", MsgUpdateGroupMembers], ["/cosmos.group.v1.MsgUpdateGroupAdmin", MsgUpdateGroupAdmin], ["/cosmos.group.v1.MsgUpdateGroupMetadata", MsgUpdateGroupMetadata], ["/cosmos.group.v1.MsgCreateGroupPolicy", MsgCreateGroupPolicy], ["/cosmos.group.v1.MsgCreateGroupWithPolicy", MsgCreateGroupWithPolicy], ["/cosmos.group.v1.MsgUpdateGroupPolicyAdmin", MsgUpdateGroupPolicyAdmin], ["/cosmos.group.v1.MsgUpdateGroupPolicyDecisionPolicy", MsgUpdateGroupPolicyDecisionPolicy], ["/cosmos.group.v1.MsgUpdateGroupPolicyMetadata", MsgUpdateGroupPolicyMetadata], ["/cosmos.group.v1.MsgSubmitProposal", MsgSubmitProposal], ["/cosmos.group.v1.MsgWithdrawProposal", MsgWithdrawProposal], ["/cosmos.group.v1.MsgVote", MsgVote], ["/cosmos.group.v1.MsgExec", MsgExec], ["/cosmos.group.v1.MsgLeaveGroup", MsgLeaveGroup]]; export const MessageComposer = { encoded: { createGroup(value: MsgCreateGroup) { diff --git a/__fixtures__/v-next/outputosmojs/cosmos/group/v1/tx.rpc.func.ts b/__fixtures__/v-next/outputosmojs/cosmos/group/v1/tx.rpc.func.ts new file mode 100644 index 0000000000..4efd31c9e6 --- /dev/null +++ b/__fixtures__/v-next/outputosmojs/cosmos/group/v1/tx.rpc.func.ts @@ -0,0 +1,130 @@ +import { Member, MemberSDKType, VoteOption, VoteOptionSDKType } from "./types"; +import { Any, AnySDKType } from "../../../google/protobuf/any"; +import { buildTx } from "../../../helper-func-types"; +import { MsgCreateGroup, MsgCreateGroupSDKType, MsgCreateGroupResponse, MsgCreateGroupResponseSDKType, MsgUpdateGroupMembers, MsgUpdateGroupMembersSDKType, MsgUpdateGroupMembersResponse, MsgUpdateGroupMembersResponseSDKType, MsgUpdateGroupAdmin, MsgUpdateGroupAdminSDKType, MsgUpdateGroupAdminResponse, MsgUpdateGroupAdminResponseSDKType, MsgUpdateGroupMetadata, MsgUpdateGroupMetadataSDKType, MsgUpdateGroupMetadataResponse, MsgUpdateGroupMetadataResponseSDKType, MsgCreateGroupPolicy, MsgCreateGroupPolicySDKType, MsgCreateGroupPolicyResponse, MsgCreateGroupPolicyResponseSDKType, MsgCreateGroupWithPolicy, MsgCreateGroupWithPolicySDKType, MsgCreateGroupWithPolicyResponse, MsgCreateGroupWithPolicyResponseSDKType, MsgUpdateGroupPolicyAdmin, MsgUpdateGroupPolicyAdminSDKType, MsgUpdateGroupPolicyAdminResponse, MsgUpdateGroupPolicyAdminResponseSDKType, MsgUpdateGroupPolicyDecisionPolicy, MsgUpdateGroupPolicyDecisionPolicySDKType, MsgUpdateGroupPolicyDecisionPolicyResponse, MsgUpdateGroupPolicyDecisionPolicyResponseSDKType, MsgUpdateGroupPolicyMetadata, MsgUpdateGroupPolicyMetadataSDKType, MsgUpdateGroupPolicyMetadataResponse, MsgUpdateGroupPolicyMetadataResponseSDKType, MsgSubmitProposal, MsgSubmitProposalSDKType, MsgSubmitProposalResponse, MsgSubmitProposalResponseSDKType, MsgWithdrawProposal, MsgWithdrawProposalSDKType, MsgWithdrawProposalResponse, MsgWithdrawProposalResponseSDKType, MsgVote, MsgVoteSDKType, MsgVoteResponse, MsgVoteResponseSDKType, MsgExec, MsgExecSDKType, MsgExecResponse, MsgExecResponseSDKType, MsgLeaveGroup, MsgLeaveGroupSDKType, MsgLeaveGroupResponse, MsgLeaveGroupResponseSDKType } from "./tx"; +/** + * CreateGroup creates a new group with an admin account address, a list of members and some optional metadata. + * @name createGroup + * @package cosmos.group.v1 + * @see proto service: cosmos.group.v1.CreateGroup + */ +export const createGroup = buildTx({ + msg: MsgCreateGroup +}); +/** + * UpdateGroupMembers updates the group members with given group id and admin address. + * @name updateGroupMembers + * @package cosmos.group.v1 + * @see proto service: cosmos.group.v1.UpdateGroupMembers + */ +export const updateGroupMembers = buildTx({ + msg: MsgUpdateGroupMembers +}); +/** + * UpdateGroupAdmin updates the group admin with given group id and previous admin address. + * @name updateGroupAdmin + * @package cosmos.group.v1 + * @see proto service: cosmos.group.v1.UpdateGroupAdmin + */ +export const updateGroupAdmin = buildTx({ + msg: MsgUpdateGroupAdmin +}); +/** + * UpdateGroupMetadata updates the group metadata with given group id and admin address. + * @name updateGroupMetadata + * @package cosmos.group.v1 + * @see proto service: cosmos.group.v1.UpdateGroupMetadata + */ +export const updateGroupMetadata = buildTx({ + msg: MsgUpdateGroupMetadata +}); +/** + * CreateGroupPolicy creates a new group policy using given DecisionPolicy. + * @name createGroupPolicy + * @package cosmos.group.v1 + * @see proto service: cosmos.group.v1.CreateGroupPolicy + */ +export const createGroupPolicy = buildTx({ + msg: MsgCreateGroupPolicy +}); +/** + * CreateGroupWithPolicy creates a new group with policy. + * @name createGroupWithPolicy + * @package cosmos.group.v1 + * @see proto service: cosmos.group.v1.CreateGroupWithPolicy + */ +export const createGroupWithPolicy = buildTx({ + msg: MsgCreateGroupWithPolicy +}); +/** + * UpdateGroupPolicyAdmin updates a group policy admin. + * @name updateGroupPolicyAdmin + * @package cosmos.group.v1 + * @see proto service: cosmos.group.v1.UpdateGroupPolicyAdmin + */ +export const updateGroupPolicyAdmin = buildTx({ + msg: MsgUpdateGroupPolicyAdmin +}); +/** + * UpdateGroupPolicyDecisionPolicy allows a group policy's decision policy to be updated. + * @name updateGroupPolicyDecisionPolicy + * @package cosmos.group.v1 + * @see proto service: cosmos.group.v1.UpdateGroupPolicyDecisionPolicy + */ +export const updateGroupPolicyDecisionPolicy = buildTx({ + msg: MsgUpdateGroupPolicyDecisionPolicy +}); +/** + * UpdateGroupPolicyMetadata updates a group policy metadata. + * @name updateGroupPolicyMetadata + * @package cosmos.group.v1 + * @see proto service: cosmos.group.v1.UpdateGroupPolicyMetadata + */ +export const updateGroupPolicyMetadata = buildTx({ + msg: MsgUpdateGroupPolicyMetadata +}); +/** + * SubmitProposal submits a new proposal. + * @name submitProposal + * @package cosmos.group.v1 + * @see proto service: cosmos.group.v1.SubmitProposal + */ +export const submitProposal = buildTx({ + msg: MsgSubmitProposal +}); +/** + * WithdrawProposal aborts a proposal. + * @name withdrawProposal + * @package cosmos.group.v1 + * @see proto service: cosmos.group.v1.WithdrawProposal + */ +export const withdrawProposal = buildTx({ + msg: MsgWithdrawProposal +}); +/** + * Vote allows a voter to vote on a proposal. + * @name vote + * @package cosmos.group.v1 + * @see proto service: cosmos.group.v1.Vote + */ +export const vote = buildTx({ + msg: MsgVote +}); +/** + * Exec executes a proposal. + * @name exec + * @package cosmos.group.v1 + * @see proto service: cosmos.group.v1.Exec + */ +export const exec = buildTx({ + msg: MsgExec +}); +/** + * LeaveGroup allows a group member to leave the group. + * @name leaveGroup + * @package cosmos.group.v1 + * @see proto service: cosmos.group.v1.LeaveGroup + */ +export const leaveGroup = buildTx({ + msg: MsgLeaveGroup +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputosmojs/cosmos/group/v1/tx.rpc.msg.ts b/__fixtures__/v-next/outputosmojs/cosmos/group/v1/tx.rpc.msg.ts index 67b6593653..75755963b9 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/group/v1/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/group/v1/tx.rpc.msg.ts @@ -1,6 +1,6 @@ import { Member, MemberSDKType, VoteOption, VoteOptionSDKType } from "./types"; import { Any, AnySDKType } from "../../../google/protobuf/any"; -import { Rpc } from "../../../helpers"; +import { TxRpc } from "../../../types"; import { BinaryReader } from "../../../binary"; import { MsgCreateGroup, MsgCreateGroupSDKType, MsgCreateGroupResponse, MsgCreateGroupResponseSDKType, MsgUpdateGroupMembers, MsgUpdateGroupMembersSDKType, MsgUpdateGroupMembersResponse, MsgUpdateGroupMembersResponseSDKType, MsgUpdateGroupAdmin, MsgUpdateGroupAdminSDKType, MsgUpdateGroupAdminResponse, MsgUpdateGroupAdminResponseSDKType, MsgUpdateGroupMetadata, MsgUpdateGroupMetadataSDKType, MsgUpdateGroupMetadataResponse, MsgUpdateGroupMetadataResponseSDKType, MsgCreateGroupPolicy, MsgCreateGroupPolicySDKType, MsgCreateGroupPolicyResponse, MsgCreateGroupPolicyResponseSDKType, MsgCreateGroupWithPolicy, MsgCreateGroupWithPolicySDKType, MsgCreateGroupWithPolicyResponse, MsgCreateGroupWithPolicyResponseSDKType, MsgUpdateGroupPolicyAdmin, MsgUpdateGroupPolicyAdminSDKType, MsgUpdateGroupPolicyAdminResponse, MsgUpdateGroupPolicyAdminResponseSDKType, MsgUpdateGroupPolicyDecisionPolicy, MsgUpdateGroupPolicyDecisionPolicySDKType, MsgUpdateGroupPolicyDecisionPolicyResponse, MsgUpdateGroupPolicyDecisionPolicyResponseSDKType, MsgUpdateGroupPolicyMetadata, MsgUpdateGroupPolicyMetadataSDKType, MsgUpdateGroupPolicyMetadataResponse, MsgUpdateGroupPolicyMetadataResponseSDKType, MsgSubmitProposal, MsgSubmitProposalSDKType, MsgSubmitProposalResponse, MsgSubmitProposalResponseSDKType, MsgWithdrawProposal, MsgWithdrawProposalSDKType, MsgWithdrawProposalResponse, MsgWithdrawProposalResponseSDKType, MsgVote, MsgVoteSDKType, MsgVoteResponse, MsgVoteResponseSDKType, MsgExec, MsgExecSDKType, MsgExecResponse, MsgExecResponseSDKType, MsgLeaveGroup, MsgLeaveGroupSDKType, MsgLeaveGroupResponse, MsgLeaveGroupResponseSDKType } from "./tx"; /** Msg is the cosmos.group.v1 Msg service. */ @@ -35,8 +35,8 @@ export interface Msg { leaveGroup(request: MsgLeaveGroup): Promise; } export class MsgClientImpl implements Msg { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.createGroup = this.createGroup.bind(this); this.updateGroupMembers = this.updateGroupMembers.bind(this); @@ -124,6 +124,6 @@ export class MsgClientImpl implements Msg { return promise.then(data => MsgLeaveGroupResponse.decode(new BinaryReader(data))); } } -export const createClientImpl = (rpc: Rpc) => { +export const createClientImpl = (rpc: TxRpc) => { return new MsgClientImpl(rpc); }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputosmojs/cosmos/mint/v1beta1/mint.ts b/__fixtures__/v-next/outputosmojs/cosmos/mint/v1beta1/mint.ts index 85efbdd444..75f190e607 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/mint/v1beta1/mint.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/mint/v1beta1/mint.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { Decimal } from "@cosmjs/math"; +import { Decimal } from "@interchainjs/math"; import { isSet, DeepPartial } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "cosmos.mint.v1beta1"; @@ -174,8 +174,8 @@ export const Minter = { }, toAmino(message: Minter): MinterAmino { const obj: any = {}; - obj.inflation = message.inflation === "" ? undefined : message.inflation; - obj.annual_provisions = message.annualProvisions === "" ? undefined : message.annualProvisions; + obj.inflation = message.inflation === "" ? undefined : Decimal.fromUserInput(message.inflation, 18).atomics; + obj.annual_provisions = message.annualProvisions === "" ? undefined : Decimal.fromUserInput(message.annualProvisions, 18).atomics; return obj; }, fromAminoMsg(object: MinterAminoMsg): Minter { @@ -356,10 +356,10 @@ export const Params = { toAmino(message: Params): ParamsAmino { const obj: any = {}; obj.mint_denom = message.mintDenom === "" ? undefined : message.mintDenom; - obj.inflation_rate_change = message.inflationRateChange === "" ? undefined : message.inflationRateChange; - obj.inflation_max = message.inflationMax === "" ? undefined : message.inflationMax; - obj.inflation_min = message.inflationMin === "" ? undefined : message.inflationMin; - obj.goal_bonded = message.goalBonded === "" ? undefined : message.goalBonded; + obj.inflation_rate_change = message.inflationRateChange === "" ? undefined : Decimal.fromUserInput(message.inflationRateChange, 18).atomics; + obj.inflation_max = message.inflationMax === "" ? undefined : Decimal.fromUserInput(message.inflationMax, 18).atomics; + obj.inflation_min = message.inflationMin === "" ? undefined : Decimal.fromUserInput(message.inflationMin, 18).atomics; + obj.goal_bonded = message.goalBonded === "" ? undefined : Decimal.fromUserInput(message.goalBonded, 18).atomics; obj.blocks_per_year = message.blocksPerYear !== BigInt(0) ? message.blocksPerYear?.toString() : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/cosmos/mint/v1beta1/query.rpc.Query.ts b/__fixtures__/v-next/outputosmojs/cosmos/mint/v1beta1/query.rpc.Query.ts index 2b274c89bd..8489812aef 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/mint/v1beta1/query.rpc.Query.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/mint/v1beta1/query.rpc.Query.ts @@ -1,5 +1,5 @@ import { Params, ParamsSDKType } from "./mint"; -import { Rpc } from "../../../helpers"; +import { TxRpc } from "../../../types"; import { BinaryReader } from "../../../binary"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; import { QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, QueryInflationRequest, QueryInflationRequestSDKType, QueryInflationResponse, QueryInflationResponseSDKType, QueryAnnualProvisionsRequest, QueryAnnualProvisionsRequestSDKType, QueryAnnualProvisionsResponse, QueryAnnualProvisionsResponseSDKType } from "./query"; @@ -13,8 +13,8 @@ export interface Query { annualProvisions(request?: QueryAnnualProvisionsRequest): Promise; } export class QueryClientImpl implements Query { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.params = this.params.bind(this); this.inflation = this.inflation.bind(this); diff --git a/__fixtures__/v-next/outputosmojs/cosmos/mint/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputosmojs/cosmos/mint/v1beta1/query.rpc.func.ts new file mode 100644 index 0000000000..68f23adc68 --- /dev/null +++ b/__fixtures__/v-next/outputosmojs/cosmos/mint/v1beta1/query.rpc.func.ts @@ -0,0 +1,39 @@ +import { Params, ParamsSDKType } from "./mint"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, QueryInflationRequest, QueryInflationRequestSDKType, QueryInflationResponse, QueryInflationResponseSDKType, QueryAnnualProvisionsRequest, QueryAnnualProvisionsRequestSDKType, QueryAnnualProvisionsResponse, QueryAnnualProvisionsResponseSDKType } from "./query"; +/** + * Params returns the total set of minting parameters. + * @name getParams + * @package cosmos.mint.v1beta1 + * @see proto service: cosmos.mint.v1beta1.Params + */ +export const getParams = buildQuery({ + encode: QueryParamsRequest.encode, + decode: QueryParamsResponse.decode, + service: "cosmos.mint.v1beta1.Query", + method: "Params" +}); +/** + * Inflation returns the current minting inflation value. + * @name getInflation + * @package cosmos.mint.v1beta1 + * @see proto service: cosmos.mint.v1beta1.Inflation + */ +export const getInflation = buildQuery({ + encode: QueryInflationRequest.encode, + decode: QueryInflationResponse.decode, + service: "cosmos.mint.v1beta1.Query", + method: "Inflation" +}); +/** + * AnnualProvisions current minting annual provisions value. + * @name getAnnualProvisions + * @package cosmos.mint.v1beta1 + * @see proto service: cosmos.mint.v1beta1.AnnualProvisions + */ +export const getAnnualProvisions = buildQuery({ + encode: QueryAnnualProvisionsRequest.encode, + decode: QueryAnnualProvisionsResponse.decode, + service: "cosmos.mint.v1beta1.Query", + method: "AnnualProvisions" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputosmojs/cosmos/nft/v1beta1/query.rpc.Query.ts b/__fixtures__/v-next/outputosmojs/cosmos/nft/v1beta1/query.rpc.Query.ts index 8e8c59f399..198c500fa9 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/nft/v1beta1/query.rpc.Query.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/nft/v1beta1/query.rpc.Query.ts @@ -1,6 +1,6 @@ import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; import { NFT, NFTSDKType, Class, ClassSDKType } from "./nft"; -import { Rpc } from "../../../helpers"; +import { TxRpc } from "../../../types"; import { BinaryReader } from "../../../binary"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; import { QueryBalanceRequest, QueryBalanceRequestSDKType, QueryBalanceResponse, QueryBalanceResponseSDKType, QueryOwnerRequest, QueryOwnerRequestSDKType, QueryOwnerResponse, QueryOwnerResponseSDKType, QuerySupplyRequest, QuerySupplyRequestSDKType, QuerySupplyResponse, QuerySupplyResponseSDKType, QueryNFTsRequest, QueryNFTsRequestSDKType, QueryNFTsResponse, QueryNFTsResponseSDKType, QueryNFTRequest, QueryNFTRequestSDKType, QueryNFTResponse, QueryNFTResponseSDKType, QueryClassRequest, QueryClassRequestSDKType, QueryClassResponse, QueryClassResponseSDKType, QueryClassesRequest, QueryClassesRequestSDKType, QueryClassesResponse, QueryClassesResponseSDKType } from "./query"; @@ -25,8 +25,8 @@ export interface Query { classes(request?: QueryClassesRequest): Promise; } export class QueryClientImpl implements Query { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.balance = this.balance.bind(this); this.owner = this.owner.bind(this); diff --git a/__fixtures__/v-next/outputosmojs/cosmos/nft/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputosmojs/cosmos/nft/v1beta1/query.rpc.func.ts new file mode 100644 index 0000000000..ef9577f449 --- /dev/null +++ b/__fixtures__/v-next/outputosmojs/cosmos/nft/v1beta1/query.rpc.func.ts @@ -0,0 +1,89 @@ +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; +import { NFT, NFTSDKType, Class, ClassSDKType } from "./nft"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { QueryBalanceRequest, QueryBalanceRequestSDKType, QueryBalanceResponse, QueryBalanceResponseSDKType, QueryOwnerRequest, QueryOwnerRequestSDKType, QueryOwnerResponse, QueryOwnerResponseSDKType, QuerySupplyRequest, QuerySupplyRequestSDKType, QuerySupplyResponse, QuerySupplyResponseSDKType, QueryNFTsRequest, QueryNFTsRequestSDKType, QueryNFTsResponse, QueryNFTsResponseSDKType, QueryNFTRequest, QueryNFTRequestSDKType, QueryNFTResponse, QueryNFTResponseSDKType, QueryClassRequest, QueryClassRequestSDKType, QueryClassResponse, QueryClassResponseSDKType, QueryClassesRequest, QueryClassesRequestSDKType, QueryClassesResponse, QueryClassesResponseSDKType } from "./query"; +/** + * Balance queries the number of NFTs of a given class owned by the owner, same as balanceOf in ERC721 + * @name getBalance + * @package cosmos.nft.v1beta1 + * @see proto service: cosmos.nft.v1beta1.Balance + */ +export const getBalance = buildQuery({ + encode: QueryBalanceRequest.encode, + decode: QueryBalanceResponse.decode, + service: "cosmos.nft.v1beta1.Query", + method: "Balance" +}); +/** + * Owner queries the owner of the NFT based on its class and id, same as ownerOf in ERC721 + * @name getOwner + * @package cosmos.nft.v1beta1 + * @see proto service: cosmos.nft.v1beta1.Owner + */ +export const getOwner = buildQuery({ + encode: QueryOwnerRequest.encode, + decode: QueryOwnerResponse.decode, + service: "cosmos.nft.v1beta1.Query", + method: "Owner" +}); +/** + * Supply queries the number of NFTs from the given class, same as totalSupply of ERC721. + * @name getSupply + * @package cosmos.nft.v1beta1 + * @see proto service: cosmos.nft.v1beta1.Supply + */ +export const getSupply = buildQuery({ + encode: QuerySupplyRequest.encode, + decode: QuerySupplyResponse.decode, + service: "cosmos.nft.v1beta1.Query", + method: "Supply" +}); +/** + * NFTs queries all NFTs of a given class or owner,choose at least one of the two, similar to tokenByIndex in + * ERC721Enumerable + * @name getNFTs + * @package cosmos.nft.v1beta1 + * @see proto service: cosmos.nft.v1beta1.NFTs + */ +export const getNFTs = buildQuery({ + encode: QueryNFTsRequest.encode, + decode: QueryNFTsResponse.decode, + service: "cosmos.nft.v1beta1.Query", + method: "NFTs" +}); +/** + * NFT queries an NFT based on its class and id. + * @name getNFT + * @package cosmos.nft.v1beta1 + * @see proto service: cosmos.nft.v1beta1.NFT + */ +export const getNFT = buildQuery({ + encode: QueryNFTRequest.encode, + decode: QueryNFTResponse.decode, + service: "cosmos.nft.v1beta1.Query", + method: "NFT" +}); +/** + * Class queries an NFT class based on its id + * @name getClass + * @package cosmos.nft.v1beta1 + * @see proto service: cosmos.nft.v1beta1.Class + */ +export const getClass = buildQuery({ + encode: QueryClassRequest.encode, + decode: QueryClassResponse.decode, + service: "cosmos.nft.v1beta1.Query", + method: "Class" +}); +/** + * Classes queries all NFT classes + * @name getClasses + * @package cosmos.nft.v1beta1 + * @see proto service: cosmos.nft.v1beta1.Classes + */ +export const getClasses = buildQuery({ + encode: QueryClassesRequest.encode, + decode: QueryClassesResponse.decode, + service: "cosmos.nft.v1beta1.Query", + method: "Classes" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputosmojs/cosmos/nft/v1beta1/tx.registry.ts b/__fixtures__/v-next/outputosmojs/cosmos/nft/v1beta1/tx.registry.ts index 49958a4bc4..8c30af2dc8 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/nft/v1beta1/tx.registry.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/nft/v1beta1/tx.registry.ts @@ -1,11 +1,6 @@ -import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { TelescopeGeneratedType } from "../../../types"; import { MsgSend, MsgSendSDKType } from "./tx"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/cosmos.nft.v1beta1.MsgSend", MsgSend]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/cosmos.nft.v1beta1.MsgSend", MsgSend]]; export const MessageComposer = { encoded: { send(value: MsgSend) { diff --git a/__fixtures__/v-next/outputosmojs/cosmos/nft/v1beta1/tx.rpc.func.ts b/__fixtures__/v-next/outputosmojs/cosmos/nft/v1beta1/tx.rpc.func.ts new file mode 100644 index 0000000000..770b6c79e4 --- /dev/null +++ b/__fixtures__/v-next/outputosmojs/cosmos/nft/v1beta1/tx.rpc.func.ts @@ -0,0 +1,11 @@ +import { buildTx } from "../../../helper-func-types"; +import { MsgSend, MsgSendSDKType, MsgSendResponse, MsgSendResponseSDKType } from "./tx"; +/** + * Send defines a method to send a nft from one account to another account. + * @name send + * @package cosmos.nft.v1beta1 + * @see proto service: cosmos.nft.v1beta1.Send + */ +export const send = buildTx({ + msg: MsgSend +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputosmojs/cosmos/nft/v1beta1/tx.rpc.msg.ts b/__fixtures__/v-next/outputosmojs/cosmos/nft/v1beta1/tx.rpc.msg.ts index 8913d37649..b3b258b03e 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/nft/v1beta1/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/nft/v1beta1/tx.rpc.msg.ts @@ -1,4 +1,4 @@ -import { Rpc } from "../../../helpers"; +import { TxRpc } from "../../../types"; import { BinaryReader } from "../../../binary"; import { MsgSend, MsgSendSDKType, MsgSendResponse, MsgSendResponseSDKType } from "./tx"; /** Msg defines the nft Msg service. */ @@ -7,8 +7,8 @@ export interface Msg { send(request: MsgSend): Promise; } export class MsgClientImpl implements Msg { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.send = this.send.bind(this); } @@ -18,6 +18,6 @@ export class MsgClientImpl implements Msg { return promise.then(data => MsgSendResponse.decode(new BinaryReader(data))); } } -export const createClientImpl = (rpc: Rpc) => { +export const createClientImpl = (rpc: TxRpc) => { return new MsgClientImpl(rpc); }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputosmojs/cosmos/params/v1beta1/query.rpc.Query.ts b/__fixtures__/v-next/outputosmojs/cosmos/params/v1beta1/query.rpc.Query.ts index e8ec67f379..c0dac69cf0 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/params/v1beta1/query.rpc.Query.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/params/v1beta1/query.rpc.Query.ts @@ -1,5 +1,5 @@ import { ParamChange, ParamChangeSDKType } from "./params"; -import { Rpc } from "../../../helpers"; +import { TxRpc } from "../../../types"; import { BinaryReader } from "../../../binary"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; import { QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, QuerySubspacesRequest, QuerySubspacesRequestSDKType, QuerySubspacesResponse, QuerySubspacesResponseSDKType } from "./query"; @@ -14,8 +14,8 @@ export interface Query { subspaces(request?: QuerySubspacesRequest): Promise; } export class QueryClientImpl implements Query { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.params = this.params.bind(this); this.subspaces = this.subspaces.bind(this); diff --git a/__fixtures__/v-next/outputosmojs/cosmos/params/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputosmojs/cosmos/params/v1beta1/query.rpc.func.ts new file mode 100644 index 0000000000..8caaba803d --- /dev/null +++ b/__fixtures__/v-next/outputosmojs/cosmos/params/v1beta1/query.rpc.func.ts @@ -0,0 +1,28 @@ +import { ParamChange, ParamChangeSDKType } from "./params"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, QuerySubspacesRequest, QuerySubspacesRequestSDKType, QuerySubspacesResponse, QuerySubspacesResponseSDKType } from "./query"; +/** + * Params queries a specific parameter of a module, given its subspace and + * key. + * @name getParams + * @package cosmos.params.v1beta1 + * @see proto service: cosmos.params.v1beta1.Params + */ +export const getParams = buildQuery({ + encode: QueryParamsRequest.encode, + decode: QueryParamsResponse.decode, + service: "cosmos.params.v1beta1.Query", + method: "Params" +}); +/** + * Subspaces queries for all registered subspaces and all keys for a subspace. + * @name getSubspaces + * @package cosmos.params.v1beta1 + * @see proto service: cosmos.params.v1beta1.Subspaces + */ +export const getSubspaces = buildQuery({ + encode: QuerySubspacesRequest.encode, + decode: QuerySubspacesResponse.decode, + service: "cosmos.params.v1beta1.Query", + method: "Subspaces" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputosmojs/cosmos/slashing/v1beta1/query.rpc.Query.ts b/__fixtures__/v-next/outputosmojs/cosmos/slashing/v1beta1/query.rpc.Query.ts index 366b379453..17ee0ffb07 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/slashing/v1beta1/query.rpc.Query.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/slashing/v1beta1/query.rpc.Query.ts @@ -1,6 +1,6 @@ import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; import { Params, ParamsSDKType, ValidatorSigningInfo, ValidatorSigningInfoSDKType } from "./slashing"; -import { Rpc } from "../../../helpers"; +import { TxRpc } from "../../../types"; import { BinaryReader } from "../../../binary"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; import { QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, QuerySigningInfoRequest, QuerySigningInfoRequestSDKType, QuerySigningInfoResponse, QuerySigningInfoResponseSDKType, QuerySigningInfosRequest, QuerySigningInfosRequestSDKType, QuerySigningInfosResponse, QuerySigningInfosResponseSDKType } from "./query"; @@ -14,8 +14,8 @@ export interface Query { signingInfos(request?: QuerySigningInfosRequest): Promise; } export class QueryClientImpl implements Query { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.params = this.params.bind(this); this.signingInfo = this.signingInfo.bind(this); diff --git a/__fixtures__/v-next/outputosmojs/cosmos/slashing/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputosmojs/cosmos/slashing/v1beta1/query.rpc.func.ts new file mode 100644 index 0000000000..fb8415e520 --- /dev/null +++ b/__fixtures__/v-next/outputosmojs/cosmos/slashing/v1beta1/query.rpc.func.ts @@ -0,0 +1,40 @@ +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; +import { Params, ParamsSDKType, ValidatorSigningInfo, ValidatorSigningInfoSDKType } from "./slashing"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, QuerySigningInfoRequest, QuerySigningInfoRequestSDKType, QuerySigningInfoResponse, QuerySigningInfoResponseSDKType, QuerySigningInfosRequest, QuerySigningInfosRequestSDKType, QuerySigningInfosResponse, QuerySigningInfosResponseSDKType } from "./query"; +/** + * Params queries the parameters of slashing module + * @name getParams + * @package cosmos.slashing.v1beta1 + * @see proto service: cosmos.slashing.v1beta1.Params + */ +export const getParams = buildQuery({ + encode: QueryParamsRequest.encode, + decode: QueryParamsResponse.decode, + service: "cosmos.slashing.v1beta1.Query", + method: "Params" +}); +/** + * SigningInfo queries the signing info of given cons address + * @name getSigningInfo + * @package cosmos.slashing.v1beta1 + * @see proto service: cosmos.slashing.v1beta1.SigningInfo + */ +export const getSigningInfo = buildQuery({ + encode: QuerySigningInfoRequest.encode, + decode: QuerySigningInfoResponse.decode, + service: "cosmos.slashing.v1beta1.Query", + method: "SigningInfo" +}); +/** + * SigningInfos queries signing info of all validators + * @name getSigningInfos + * @package cosmos.slashing.v1beta1 + * @see proto service: cosmos.slashing.v1beta1.SigningInfos + */ +export const getSigningInfos = buildQuery({ + encode: QuerySigningInfosRequest.encode, + decode: QuerySigningInfosResponse.decode, + service: "cosmos.slashing.v1beta1.Query", + method: "SigningInfos" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputosmojs/cosmos/slashing/v1beta1/tx.registry.ts b/__fixtures__/v-next/outputosmojs/cosmos/slashing/v1beta1/tx.registry.ts index cbbf990ff1..114c70c136 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/slashing/v1beta1/tx.registry.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/slashing/v1beta1/tx.registry.ts @@ -1,11 +1,6 @@ -import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { TelescopeGeneratedType } from "../../../types"; import { MsgUnjail, MsgUnjailSDKType } from "./tx"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/cosmos.slashing.v1beta1.MsgUnjail", MsgUnjail]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/cosmos.slashing.v1beta1.MsgUnjail", MsgUnjail]]; export const MessageComposer = { encoded: { unjail(value: MsgUnjail) { diff --git a/__fixtures__/v-next/outputosmojs/cosmos/slashing/v1beta1/tx.rpc.func.ts b/__fixtures__/v-next/outputosmojs/cosmos/slashing/v1beta1/tx.rpc.func.ts new file mode 100644 index 0000000000..175d9272fa --- /dev/null +++ b/__fixtures__/v-next/outputosmojs/cosmos/slashing/v1beta1/tx.rpc.func.ts @@ -0,0 +1,13 @@ +import { buildTx } from "../../../helper-func-types"; +import { MsgUnjail, MsgUnjailSDKType, MsgUnjailResponse, MsgUnjailResponseSDKType } from "./tx"; +/** + * Unjail defines a method for unjailing a jailed validator, thus returning + * them into the bonded validator set, so they can begin receiving provisions + * and rewards again. + * @name unjail + * @package cosmos.slashing.v1beta1 + * @see proto service: cosmos.slashing.v1beta1.Unjail + */ +export const unjail = buildTx({ + msg: MsgUnjail +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputosmojs/cosmos/slashing/v1beta1/tx.rpc.msg.ts b/__fixtures__/v-next/outputosmojs/cosmos/slashing/v1beta1/tx.rpc.msg.ts index 7003cb7909..5dbcc2706f 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/slashing/v1beta1/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/slashing/v1beta1/tx.rpc.msg.ts @@ -1,4 +1,4 @@ -import { Rpc } from "../../../helpers"; +import { TxRpc } from "../../../types"; import { BinaryReader } from "../../../binary"; import { MsgUnjail, MsgUnjailSDKType, MsgUnjailResponse, MsgUnjailResponseSDKType } from "./tx"; /** Msg defines the slashing Msg service. */ @@ -11,8 +11,8 @@ export interface Msg { unjail(request: MsgUnjail): Promise; } export class MsgClientImpl implements Msg { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.unjail = this.unjail.bind(this); } @@ -22,6 +22,6 @@ export class MsgClientImpl implements Msg { return promise.then(data => MsgUnjailResponse.decode(new BinaryReader(data))); } } -export const createClientImpl = (rpc: Rpc) => { +export const createClientImpl = (rpc: TxRpc) => { return new MsgClientImpl(rpc); }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputosmojs/cosmos/staking/v1beta1/query.rpc.Query.ts b/__fixtures__/v-next/outputosmojs/cosmos/staking/v1beta1/query.rpc.Query.ts index 50a6665e0f..6e2c39ec6a 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/staking/v1beta1/query.rpc.Query.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/staking/v1beta1/query.rpc.Query.ts @@ -1,6 +1,6 @@ import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; import { Validator, ValidatorSDKType, DelegationResponse, DelegationResponseSDKType, UnbondingDelegation, UnbondingDelegationSDKType, RedelegationResponse, RedelegationResponseSDKType, HistoricalInfo, HistoricalInfoSDKType, Pool, PoolSDKType, Params, ParamsSDKType } from "./staking"; -import { Rpc } from "../../../helpers"; +import { TxRpc } from "../../../types"; import { BinaryReader } from "../../../binary"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; import { QueryValidatorsRequest, QueryValidatorsRequestSDKType, QueryValidatorsResponse, QueryValidatorsResponseSDKType, QueryValidatorRequest, QueryValidatorRequestSDKType, QueryValidatorResponse, QueryValidatorResponseSDKType, QueryValidatorDelegationsRequest, QueryValidatorDelegationsRequestSDKType, QueryValidatorDelegationsResponse, QueryValidatorDelegationsResponseSDKType, QueryValidatorUnbondingDelegationsRequest, QueryValidatorUnbondingDelegationsRequestSDKType, QueryValidatorUnbondingDelegationsResponse, QueryValidatorUnbondingDelegationsResponseSDKType, QueryDelegationRequest, QueryDelegationRequestSDKType, QueryDelegationResponse, QueryDelegationResponseSDKType, QueryUnbondingDelegationRequest, QueryUnbondingDelegationRequestSDKType, QueryUnbondingDelegationResponse, QueryUnbondingDelegationResponseSDKType, QueryDelegatorDelegationsRequest, QueryDelegatorDelegationsRequestSDKType, QueryDelegatorDelegationsResponse, QueryDelegatorDelegationsResponseSDKType, QueryDelegatorUnbondingDelegationsRequest, QueryDelegatorUnbondingDelegationsRequestSDKType, QueryDelegatorUnbondingDelegationsResponse, QueryDelegatorUnbondingDelegationsResponseSDKType, QueryRedelegationsRequest, QueryRedelegationsRequestSDKType, QueryRedelegationsResponse, QueryRedelegationsResponseSDKType, QueryDelegatorValidatorsRequest, QueryDelegatorValidatorsRequestSDKType, QueryDelegatorValidatorsResponse, QueryDelegatorValidatorsResponseSDKType, QueryDelegatorValidatorRequest, QueryDelegatorValidatorRequestSDKType, QueryDelegatorValidatorResponse, QueryDelegatorValidatorResponseSDKType, QueryHistoricalInfoRequest, QueryHistoricalInfoRequestSDKType, QueryHistoricalInfoResponse, QueryHistoricalInfoResponseSDKType, QueryPoolRequest, QueryPoolRequestSDKType, QueryPoolResponse, QueryPoolResponseSDKType, QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType } from "./query"; @@ -48,8 +48,8 @@ export interface Query { params(request?: QueryParamsRequest): Promise; } export class QueryClientImpl implements Query { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.validators = this.validators.bind(this); this.validator = this.validator.bind(this); diff --git a/__fixtures__/v-next/outputosmojs/cosmos/staking/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputosmojs/cosmos/staking/v1beta1/query.rpc.func.ts new file mode 100644 index 0000000000..71abf29eb2 --- /dev/null +++ b/__fixtures__/v-next/outputosmojs/cosmos/staking/v1beta1/query.rpc.func.ts @@ -0,0 +1,176 @@ +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; +import { Validator, ValidatorSDKType, DelegationResponse, DelegationResponseSDKType, UnbondingDelegation, UnbondingDelegationSDKType, RedelegationResponse, RedelegationResponseSDKType, HistoricalInfo, HistoricalInfoSDKType, Pool, PoolSDKType, Params, ParamsSDKType } from "./staking"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { QueryValidatorsRequest, QueryValidatorsRequestSDKType, QueryValidatorsResponse, QueryValidatorsResponseSDKType, QueryValidatorRequest, QueryValidatorRequestSDKType, QueryValidatorResponse, QueryValidatorResponseSDKType, QueryValidatorDelegationsRequest, QueryValidatorDelegationsRequestSDKType, QueryValidatorDelegationsResponse, QueryValidatorDelegationsResponseSDKType, QueryValidatorUnbondingDelegationsRequest, QueryValidatorUnbondingDelegationsRequestSDKType, QueryValidatorUnbondingDelegationsResponse, QueryValidatorUnbondingDelegationsResponseSDKType, QueryDelegationRequest, QueryDelegationRequestSDKType, QueryDelegationResponse, QueryDelegationResponseSDKType, QueryUnbondingDelegationRequest, QueryUnbondingDelegationRequestSDKType, QueryUnbondingDelegationResponse, QueryUnbondingDelegationResponseSDKType, QueryDelegatorDelegationsRequest, QueryDelegatorDelegationsRequestSDKType, QueryDelegatorDelegationsResponse, QueryDelegatorDelegationsResponseSDKType, QueryDelegatorUnbondingDelegationsRequest, QueryDelegatorUnbondingDelegationsRequestSDKType, QueryDelegatorUnbondingDelegationsResponse, QueryDelegatorUnbondingDelegationsResponseSDKType, QueryRedelegationsRequest, QueryRedelegationsRequestSDKType, QueryRedelegationsResponse, QueryRedelegationsResponseSDKType, QueryDelegatorValidatorsRequest, QueryDelegatorValidatorsRequestSDKType, QueryDelegatorValidatorsResponse, QueryDelegatorValidatorsResponseSDKType, QueryDelegatorValidatorRequest, QueryDelegatorValidatorRequestSDKType, QueryDelegatorValidatorResponse, QueryDelegatorValidatorResponseSDKType, QueryHistoricalInfoRequest, QueryHistoricalInfoRequestSDKType, QueryHistoricalInfoResponse, QueryHistoricalInfoResponseSDKType, QueryPoolRequest, QueryPoolRequestSDKType, QueryPoolResponse, QueryPoolResponseSDKType, QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType } from "./query"; +/** + * Validators queries all validators that match the given status. + * @name getValidators + * @package cosmos.staking.v1beta1 + * @see proto service: cosmos.staking.v1beta1.Validators + */ +export const getValidators = buildQuery({ + encode: QueryValidatorsRequest.encode, + decode: QueryValidatorsResponse.decode, + service: "cosmos.staking.v1beta1.Query", + method: "Validators" +}); +/** + * Validator queries validator info for given validator address. + * @name getValidator + * @package cosmos.staking.v1beta1 + * @see proto service: cosmos.staking.v1beta1.Validator + */ +export const getValidator = buildQuery({ + encode: QueryValidatorRequest.encode, + decode: QueryValidatorResponse.decode, + service: "cosmos.staking.v1beta1.Query", + method: "Validator" +}); +/** + * ValidatorDelegations queries delegate info for given validator. + * @name getValidatorDelegations + * @package cosmos.staking.v1beta1 + * @see proto service: cosmos.staking.v1beta1.ValidatorDelegations + */ +export const getValidatorDelegations = buildQuery({ + encode: QueryValidatorDelegationsRequest.encode, + decode: QueryValidatorDelegationsResponse.decode, + service: "cosmos.staking.v1beta1.Query", + method: "ValidatorDelegations" +}); +/** + * ValidatorUnbondingDelegations queries unbonding delegations of a validator. + * @name getValidatorUnbondingDelegations + * @package cosmos.staking.v1beta1 + * @see proto service: cosmos.staking.v1beta1.ValidatorUnbondingDelegations + */ +export const getValidatorUnbondingDelegations = buildQuery({ + encode: QueryValidatorUnbondingDelegationsRequest.encode, + decode: QueryValidatorUnbondingDelegationsResponse.decode, + service: "cosmos.staking.v1beta1.Query", + method: "ValidatorUnbondingDelegations" +}); +/** + * Delegation queries delegate info for given validator delegator pair. + * @name getDelegation + * @package cosmos.staking.v1beta1 + * @see proto service: cosmos.staking.v1beta1.Delegation + */ +export const getDelegation = buildQuery({ + encode: QueryDelegationRequest.encode, + decode: QueryDelegationResponse.decode, + service: "cosmos.staking.v1beta1.Query", + method: "Delegation" +}); +/** + * UnbondingDelegation queries unbonding info for given validator delegator + * pair. + * @name getUnbondingDelegation + * @package cosmos.staking.v1beta1 + * @see proto service: cosmos.staking.v1beta1.UnbondingDelegation + */ +export const getUnbondingDelegation = buildQuery({ + encode: QueryUnbondingDelegationRequest.encode, + decode: QueryUnbondingDelegationResponse.decode, + service: "cosmos.staking.v1beta1.Query", + method: "UnbondingDelegation" +}); +/** + * DelegatorDelegations queries all delegations of a given delegator address. + * @name getDelegatorDelegations + * @package cosmos.staking.v1beta1 + * @see proto service: cosmos.staking.v1beta1.DelegatorDelegations + */ +export const getDelegatorDelegations = buildQuery({ + encode: QueryDelegatorDelegationsRequest.encode, + decode: QueryDelegatorDelegationsResponse.decode, + service: "cosmos.staking.v1beta1.Query", + method: "DelegatorDelegations" +}); +/** + * DelegatorUnbondingDelegations queries all unbonding delegations of a given + * delegator address. + * @name getDelegatorUnbondingDelegations + * @package cosmos.staking.v1beta1 + * @see proto service: cosmos.staking.v1beta1.DelegatorUnbondingDelegations + */ +export const getDelegatorUnbondingDelegations = buildQuery({ + encode: QueryDelegatorUnbondingDelegationsRequest.encode, + decode: QueryDelegatorUnbondingDelegationsResponse.decode, + service: "cosmos.staking.v1beta1.Query", + method: "DelegatorUnbondingDelegations" +}); +/** + * Redelegations queries redelegations of given address. + * @name getRedelegations + * @package cosmos.staking.v1beta1 + * @see proto service: cosmos.staking.v1beta1.Redelegations + */ +export const getRedelegations = buildQuery({ + encode: QueryRedelegationsRequest.encode, + decode: QueryRedelegationsResponse.decode, + service: "cosmos.staking.v1beta1.Query", + method: "Redelegations" +}); +/** + * DelegatorValidators queries all validators info for given delegator + * address. + * @name getDelegatorValidators + * @package cosmos.staking.v1beta1 + * @see proto service: cosmos.staking.v1beta1.DelegatorValidators + */ +export const getDelegatorValidators = buildQuery({ + encode: QueryDelegatorValidatorsRequest.encode, + decode: QueryDelegatorValidatorsResponse.decode, + service: "cosmos.staking.v1beta1.Query", + method: "DelegatorValidators" +}); +/** + * DelegatorValidator queries validator info for given delegator validator + * pair. + * @name getDelegatorValidator + * @package cosmos.staking.v1beta1 + * @see proto service: cosmos.staking.v1beta1.DelegatorValidator + */ +export const getDelegatorValidator = buildQuery({ + encode: QueryDelegatorValidatorRequest.encode, + decode: QueryDelegatorValidatorResponse.decode, + service: "cosmos.staking.v1beta1.Query", + method: "DelegatorValidator" +}); +/** + * HistoricalInfo queries the historical info for given height. + * @name getHistoricalInfo + * @package cosmos.staking.v1beta1 + * @see proto service: cosmos.staking.v1beta1.HistoricalInfo + */ +export const getHistoricalInfo = buildQuery({ + encode: QueryHistoricalInfoRequest.encode, + decode: QueryHistoricalInfoResponse.decode, + service: "cosmos.staking.v1beta1.Query", + method: "HistoricalInfo" +}); +/** + * Pool queries the pool info. + * @name getPool + * @package cosmos.staking.v1beta1 + * @see proto service: cosmos.staking.v1beta1.Pool + */ +export const getPool = buildQuery({ + encode: QueryPoolRequest.encode, + decode: QueryPoolResponse.decode, + service: "cosmos.staking.v1beta1.Query", + method: "Pool" +}); +/** + * Parameters queries the staking parameters. + * @name getParams + * @package cosmos.staking.v1beta1 + * @see proto service: cosmos.staking.v1beta1.Params + */ +export const getParams = buildQuery({ + encode: QueryParamsRequest.encode, + decode: QueryParamsResponse.decode, + service: "cosmos.staking.v1beta1.Query", + method: "Params" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputosmojs/cosmos/staking/v1beta1/staking.ts b/__fixtures__/v-next/outputosmojs/cosmos/staking/v1beta1/staking.ts index d9468980f3..8022e42183 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/staking/v1beta1/staking.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/staking/v1beta1/staking.ts @@ -6,8 +6,8 @@ import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { isSet, DeepPartial, toTimestamp, fromTimestamp } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; -import { Decimal } from "@cosmjs/math"; -import { encodePubkey, decodePubkey } from "@cosmjs/proto-signing"; +import { Decimal } from "@interchainjs/math"; +import { encodePubkey, decodePubkey } from "@interchainjs/pubkey"; export const protobufPackage = "cosmos.staking.v1beta1"; /** BondStatus is the status of a validator. */ export enum BondStatus { @@ -1008,9 +1008,9 @@ export const CommissionRates = { }, toAmino(message: CommissionRates): CommissionRatesAmino { const obj: any = {}; - obj.rate = message.rate === "" ? undefined : message.rate; - obj.max_rate = message.maxRate === "" ? undefined : message.maxRate; - obj.max_change_rate = message.maxChangeRate === "" ? undefined : message.maxChangeRate; + obj.rate = message.rate === "" ? undefined : Decimal.fromUserInput(message.rate, 18).atomics; + obj.max_rate = message.maxRate === "" ? undefined : Decimal.fromUserInput(message.maxRate, 18).atomics; + obj.max_change_rate = message.maxChangeRate === "" ? undefined : Decimal.fromUserInput(message.maxChangeRate, 18).atomics; return obj; }, fromAminoMsg(object: CommissionRatesAminoMsg): CommissionRates { @@ -1567,7 +1567,7 @@ export const Validator = { obj.jailed = message.jailed === false ? undefined : message.jailed; obj.status = message.status === 0 ? undefined : message.status; obj.tokens = message.tokens === "" ? undefined : message.tokens; - obj.delegator_shares = message.delegatorShares === "" ? undefined : message.delegatorShares; + obj.delegator_shares = message.delegatorShares === "" ? undefined : Decimal.fromUserInput(message.delegatorShares, 18).atomics; obj.description = message.description ? Description.toAmino(message.description) : undefined; obj.unbonding_height = message.unbondingHeight !== BigInt(0) ? message.unbondingHeight?.toString() : undefined; obj.unbonding_time = message.unbondingTime ? Timestamp.toAmino(toTimestamp(message.unbondingTime)) : undefined; @@ -2294,7 +2294,7 @@ export const Delegation = { const obj: any = {}; obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; - obj.shares = message.shares === "" ? undefined : message.shares; + obj.shares = message.shares === "" ? undefined : Decimal.fromUserInput(message.shares, 18).atomics; return obj; }, fromAminoMsg(object: DelegationAminoMsg): Delegation { @@ -2741,7 +2741,7 @@ export const RedelegationEntry = { obj.creation_height = message.creationHeight !== BigInt(0) ? message.creationHeight?.toString() : undefined; obj.completion_time = message.completionTime ? Timestamp.toAmino(toTimestamp(message.completionTime)) : undefined; obj.initial_balance = message.initialBalance === "" ? undefined : message.initialBalance; - obj.shares_dst = message.sharesDst === "" ? undefined : message.sharesDst; + obj.shares_dst = message.sharesDst === "" ? undefined : Decimal.fromUserInput(message.sharesDst, 18).atomics; return obj; }, fromAminoMsg(object: RedelegationEntryAminoMsg): RedelegationEntry { @@ -3088,7 +3088,7 @@ export const Params = { obj.max_entries = message.maxEntries === 0 ? undefined : message.maxEntries; obj.historical_entries = message.historicalEntries === 0 ? undefined : message.historicalEntries; obj.bond_denom = message.bondDenom === "" ? undefined : message.bondDenom; - obj.min_commission_rate = message.minCommissionRate === "" ? undefined : message.minCommissionRate; + obj.min_commission_rate = message.minCommissionRate === "" ? undefined : Decimal.fromUserInput(message.minCommissionRate, 18).atomics; return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputosmojs/cosmos/staking/v1beta1/tx.amino.ts b/__fixtures__/v-next/outputosmojs/cosmos/staking/v1beta1/tx.amino.ts index 86e67cabcd..6e030c7695 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/staking/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/staking/v1beta1/tx.amino.ts @@ -3,7 +3,8 @@ import { Any, AnySDKType } from "../../../google/protobuf/any"; import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; import { Timestamp, TimestampSDKType } from "../../../google/protobuf/timestamp"; import { AminoMsg, Pubkey } from "@cosmjs/amino"; -import { decodePubkey, encodePubkey } from "@cosmjs/proto-signing"; +import { Decimal } from "@interchainjs/math"; +import { decodePubkey, encodePubkey } from "@interchainjs/pubkey"; import { MsgCreateValidator, MsgCreateValidatorSDKType, MsgEditValidator, MsgEditValidatorSDKType, MsgDelegate, MsgDelegateSDKType, MsgBeginRedelegate, MsgBeginRedelegateSDKType, MsgUndelegate, MsgUndelegateSDKType } from "./tx"; export interface MsgCreateValidatorAminoType extends AminoMsg { type: "cosmos-sdk/MsgCreateValidator"; @@ -100,9 +101,9 @@ export const AminoConverter = { details: description.details }, commission: { - rate: commission.rate, - max_rate: commission.maxRate, - max_change_rate: commission.maxChangeRate + rate: Decimal.fromUserInput(commission.rate, 18).atomics, + max_rate: Decimal.fromUserInput(commission.maxRate, 18).atomics, + max_change_rate: Decimal.fromUserInput(commission.maxChangeRate, 18).atomics }, min_self_delegation: minSelfDelegation, delegator_address: delegatorAddress, @@ -164,7 +165,7 @@ export const AminoConverter = { details: description.details }, validator_address: validatorAddress, - commission_rate: commissionRate, + commission_rate: Decimal.fromUserInput(commissionRate, 18).atomics, min_self_delegation: minSelfDelegation }; }, diff --git a/__fixtures__/v-next/outputosmojs/cosmos/staking/v1beta1/tx.registry.ts b/__fixtures__/v-next/outputosmojs/cosmos/staking/v1beta1/tx.registry.ts index e93cb84370..b220546f20 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/staking/v1beta1/tx.registry.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/staking/v1beta1/tx.registry.ts @@ -2,14 +2,9 @@ import { Description, DescriptionSDKType, CommissionRates, CommissionRatesSDKTyp import { Any, AnySDKType } from "../../../google/protobuf/any"; import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; import { Timestamp, TimestampSDKType } from "../../../google/protobuf/timestamp"; -import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { TelescopeGeneratedType } from "../../../types"; import { MsgCreateValidator, MsgCreateValidatorSDKType, MsgEditValidator, MsgEditValidatorSDKType, MsgDelegate, MsgDelegateSDKType, MsgBeginRedelegate, MsgBeginRedelegateSDKType, MsgUndelegate, MsgUndelegateSDKType } from "./tx"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/cosmos.staking.v1beta1.MsgCreateValidator", MsgCreateValidator], ["/cosmos.staking.v1beta1.MsgEditValidator", MsgEditValidator], ["/cosmos.staking.v1beta1.MsgDelegate", MsgDelegate], ["/cosmos.staking.v1beta1.MsgBeginRedelegate", MsgBeginRedelegate], ["/cosmos.staking.v1beta1.MsgUndelegate", MsgUndelegate]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/cosmos.staking.v1beta1.MsgCreateValidator", MsgCreateValidator], ["/cosmos.staking.v1beta1.MsgEditValidator", MsgEditValidator], ["/cosmos.staking.v1beta1.MsgDelegate", MsgDelegate], ["/cosmos.staking.v1beta1.MsgBeginRedelegate", MsgBeginRedelegate], ["/cosmos.staking.v1beta1.MsgUndelegate", MsgUndelegate]]; export const MessageComposer = { encoded: { createValidator(value: MsgCreateValidator) { diff --git a/__fixtures__/v-next/outputosmojs/cosmos/staking/v1beta1/tx.rpc.func.ts b/__fixtures__/v-next/outputosmojs/cosmos/staking/v1beta1/tx.rpc.func.ts new file mode 100644 index 0000000000..9609629ce1 --- /dev/null +++ b/__fixtures__/v-next/outputosmojs/cosmos/staking/v1beta1/tx.rpc.func.ts @@ -0,0 +1,54 @@ +import { Description, DescriptionSDKType, CommissionRates, CommissionRatesSDKType } from "./staking"; +import { Any, AnySDKType } from "../../../google/protobuf/any"; +import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; +import { Timestamp, TimestampSDKType } from "../../../google/protobuf/timestamp"; +import { buildTx } from "../../../helper-func-types"; +import { MsgCreateValidator, MsgCreateValidatorSDKType, MsgCreateValidatorResponse, MsgCreateValidatorResponseSDKType, MsgEditValidator, MsgEditValidatorSDKType, MsgEditValidatorResponse, MsgEditValidatorResponseSDKType, MsgDelegate, MsgDelegateSDKType, MsgDelegateResponse, MsgDelegateResponseSDKType, MsgBeginRedelegate, MsgBeginRedelegateSDKType, MsgBeginRedelegateResponse, MsgBeginRedelegateResponseSDKType, MsgUndelegate, MsgUndelegateSDKType, MsgUndelegateResponse, MsgUndelegateResponseSDKType } from "./tx"; +/** + * CreateValidator defines a method for creating a new validator. + * @name createValidator + * @package cosmos.staking.v1beta1 + * @see proto service: cosmos.staking.v1beta1.CreateValidator + */ +export const createValidator = buildTx({ + msg: MsgCreateValidator +}); +/** + * EditValidator defines a method for editing an existing validator. + * @name editValidator + * @package cosmos.staking.v1beta1 + * @see proto service: cosmos.staking.v1beta1.EditValidator + */ +export const editValidator = buildTx({ + msg: MsgEditValidator +}); +/** + * Delegate defines a method for performing a delegation of coins + * from a delegator to a validator. + * @name delegate + * @package cosmos.staking.v1beta1 + * @see proto service: cosmos.staking.v1beta1.Delegate + */ +export const delegate = buildTx({ + msg: MsgDelegate +}); +/** + * BeginRedelegate defines a method for performing a redelegation + * of coins from a delegator and source validator to a destination validator. + * @name beginRedelegate + * @package cosmos.staking.v1beta1 + * @see proto service: cosmos.staking.v1beta1.BeginRedelegate + */ +export const beginRedelegate = buildTx({ + msg: MsgBeginRedelegate +}); +/** + * Undelegate defines a method for performing an undelegation from a + * delegate and a validator. + * @name undelegate + * @package cosmos.staking.v1beta1 + * @see proto service: cosmos.staking.v1beta1.Undelegate + */ +export const undelegate = buildTx({ + msg: MsgUndelegate +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputosmojs/cosmos/staking/v1beta1/tx.rpc.msg.ts b/__fixtures__/v-next/outputosmojs/cosmos/staking/v1beta1/tx.rpc.msg.ts index c50d6c8f28..cb1ff5183c 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/staking/v1beta1/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/staking/v1beta1/tx.rpc.msg.ts @@ -2,7 +2,7 @@ import { Description, DescriptionSDKType, CommissionRates, CommissionRatesSDKTyp import { Any, AnySDKType } from "../../../google/protobuf/any"; import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; import { Timestamp, TimestampSDKType } from "../../../google/protobuf/timestamp"; -import { Rpc } from "../../../helpers"; +import { TxRpc } from "../../../types"; import { BinaryReader } from "../../../binary"; import { MsgCreateValidator, MsgCreateValidatorSDKType, MsgCreateValidatorResponse, MsgCreateValidatorResponseSDKType, MsgEditValidator, MsgEditValidatorSDKType, MsgEditValidatorResponse, MsgEditValidatorResponseSDKType, MsgDelegate, MsgDelegateSDKType, MsgDelegateResponse, MsgDelegateResponseSDKType, MsgBeginRedelegate, MsgBeginRedelegateSDKType, MsgBeginRedelegateResponse, MsgBeginRedelegateResponseSDKType, MsgUndelegate, MsgUndelegateSDKType, MsgUndelegateResponse, MsgUndelegateResponseSDKType } from "./tx"; /** Msg defines the staking Msg service. */ @@ -28,8 +28,8 @@ export interface Msg { undelegate(request: MsgUndelegate): Promise; } export class MsgClientImpl implements Msg { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.createValidator = this.createValidator.bind(this); this.editValidator = this.editValidator.bind(this); @@ -63,6 +63,6 @@ export class MsgClientImpl implements Msg { return promise.then(data => MsgUndelegateResponse.decode(new BinaryReader(data))); } } -export const createClientImpl = (rpc: Rpc) => { +export const createClientImpl = (rpc: TxRpc) => { return new MsgClientImpl(rpc); }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputosmojs/cosmos/staking/v1beta1/tx.ts b/__fixtures__/v-next/outputosmojs/cosmos/staking/v1beta1/tx.ts index a481bce08c..85c87b0229 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/staking/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/staking/v1beta1/tx.ts @@ -5,8 +5,8 @@ import { Timestamp, TimestampSDKType } from "../../../google/protobuf/timestamp" import { BinaryReader, BinaryWriter } from "../../../binary"; import { isSet, DeepPartial, toTimestamp, fromTimestamp } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; -import { encodePubkey, decodePubkey } from "@cosmjs/proto-signing"; -import { Decimal } from "@cosmjs/math"; +import { encodePubkey, decodePubkey } from "@interchainjs/pubkey"; +import { Decimal } from "@interchainjs/math"; export const protobufPackage = "cosmos.staking.v1beta1"; /** * MsgCreateValidator defines a SDK message for creating a new validator. @@ -666,7 +666,7 @@ export const MsgEditValidator = { const obj: any = {}; obj.description = message.description ? Description.toAmino(message.description) : undefined; obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; - obj.commission_rate = message.commissionRate === "" ? undefined : message.commissionRate; + obj.commission_rate = message.commissionRate === "" ? undefined : Decimal.fromUserInput(message.commissionRate, 18).atomics; obj.min_self_delegation = message.minSelfDelegation === "" ? undefined : message.minSelfDelegation; return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/cosmos/tx/v1beta1/service.rpc.Service.ts b/__fixtures__/v-next/outputosmojs/cosmos/tx/v1beta1/service.rpc.Service.ts index bbc924eb0f..099b270030 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/tx/v1beta1/service.rpc.Service.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/tx/v1beta1/service.rpc.Service.ts @@ -3,7 +3,7 @@ import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } fr import { TxResponse, TxResponseSDKType, GasInfo, GasInfoSDKType, Result, ResultSDKType } from "../../base/abci/v1beta1/abci"; import { BlockID, BlockIDSDKType } from "../../../tendermint/types/types"; import { Block, BlockSDKType } from "../../../tendermint/types/block"; -import { Rpc } from "../../../helpers"; +import { TxRpc } from "../../../types"; import { BinaryReader } from "../../../binary"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; import { SimulateRequest, SimulateRequestSDKType, SimulateResponse, SimulateResponseSDKType, GetTxRequest, GetTxRequestSDKType, GetTxResponse, GetTxResponseSDKType, BroadcastTxRequest, BroadcastTxRequestSDKType, BroadcastTxResponse, BroadcastTxResponseSDKType, GetTxsEventRequest, GetTxsEventRequestSDKType, GetTxsEventResponse, GetTxsEventResponseSDKType, GetBlockWithTxsRequest, GetBlockWithTxsRequestSDKType, GetBlockWithTxsResponse, GetBlockWithTxsResponseSDKType } from "./service"; @@ -25,8 +25,8 @@ export interface Service { getBlockWithTxs(request: GetBlockWithTxsRequest): Promise; } export class ServiceClientImpl implements Service { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.simulate = this.simulate.bind(this); this.getTx = this.getTx.bind(this); diff --git a/__fixtures__/v-next/outputosmojs/cosmos/tx/v1beta1/service.rpc.func.ts b/__fixtures__/v-next/outputosmojs/cosmos/tx/v1beta1/service.rpc.func.ts new file mode 100644 index 0000000000..92ccd67aa3 --- /dev/null +++ b/__fixtures__/v-next/outputosmojs/cosmos/tx/v1beta1/service.rpc.func.ts @@ -0,0 +1,69 @@ +import { Tx, TxSDKType } from "./tx"; +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; +import { TxResponse, TxResponseSDKType, GasInfo, GasInfoSDKType, Result, ResultSDKType } from "../../base/abci/v1beta1/abci"; +import { BlockID, BlockIDSDKType } from "../../../tendermint/types/types"; +import { Block, BlockSDKType } from "../../../tendermint/types/block"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { SimulateRequest, SimulateRequestSDKType, SimulateResponse, SimulateResponseSDKType, GetTxRequest, GetTxRequestSDKType, GetTxResponse, GetTxResponseSDKType, BroadcastTxRequest, BroadcastTxRequestSDKType, BroadcastTxResponse, BroadcastTxResponseSDKType, GetTxsEventRequest, GetTxsEventRequestSDKType, GetTxsEventResponse, GetTxsEventResponseSDKType, GetBlockWithTxsRequest, GetBlockWithTxsRequestSDKType, GetBlockWithTxsResponse, GetBlockWithTxsResponseSDKType } from "./service"; +/** + * Simulate simulates executing a transaction for estimating gas usage. + * @name getSimulate + * @package cosmos.tx.v1beta1 + * @see proto service: cosmos.tx.v1beta1.Simulate + */ +export const getSimulate = buildQuery({ + encode: SimulateRequest.encode, + decode: SimulateResponse.decode, + service: "cosmos.tx.v1beta1.Service", + method: "Simulate" +}); +/** + * GetTx fetches a tx by hash. + * @name getGetTx + * @package cosmos.tx.v1beta1 + * @see proto service: cosmos.tx.v1beta1.GetTx + */ +export const getGetTx = buildQuery({ + encode: GetTxRequest.encode, + decode: GetTxResponse.decode, + service: "cosmos.tx.v1beta1.Service", + method: "GetTx" +}); +/** + * BroadcastTx broadcast transaction. + * @name getBroadcastTx + * @package cosmos.tx.v1beta1 + * @see proto service: cosmos.tx.v1beta1.BroadcastTx + */ +export const getBroadcastTx = buildQuery({ + encode: BroadcastTxRequest.encode, + decode: BroadcastTxResponse.decode, + service: "cosmos.tx.v1beta1.Service", + method: "BroadcastTx" +}); +/** + * GetTxsEvent fetches txs by event. + * @name getGetTxsEvent + * @package cosmos.tx.v1beta1 + * @see proto service: cosmos.tx.v1beta1.GetTxsEvent + */ +export const getGetTxsEvent = buildQuery({ + encode: GetTxsEventRequest.encode, + decode: GetTxsEventResponse.decode, + service: "cosmos.tx.v1beta1.Service", + method: "GetTxsEvent" +}); +/** + * GetBlockWithTxs fetches a block with decoded txs. + * + * Since: cosmos-sdk 0.45.2 + * @name getGetBlockWithTxs + * @package cosmos.tx.v1beta1 + * @see proto service: cosmos.tx.v1beta1.GetBlockWithTxs + */ +export const getGetBlockWithTxs = buildQuery({ + encode: GetBlockWithTxsRequest.encode, + decode: GetBlockWithTxsResponse.decode, + service: "cosmos.tx.v1beta1.Service", + method: "GetBlockWithTxs" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputosmojs/cosmos/upgrade/v1beta1/query.rpc.Query.ts b/__fixtures__/v-next/outputosmojs/cosmos/upgrade/v1beta1/query.rpc.Query.ts index edc7b59a9a..2175a1f5ac 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/upgrade/v1beta1/query.rpc.Query.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/upgrade/v1beta1/query.rpc.Query.ts @@ -1,5 +1,5 @@ import { Plan, PlanSDKType, ModuleVersion, ModuleVersionSDKType } from "./upgrade"; -import { Rpc } from "../../../helpers"; +import { TxRpc } from "../../../types"; import { BinaryReader } from "../../../binary"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; import { QueryCurrentPlanRequest, QueryCurrentPlanRequestSDKType, QueryCurrentPlanResponse, QueryCurrentPlanResponseSDKType, QueryAppliedPlanRequest, QueryAppliedPlanRequestSDKType, QueryAppliedPlanResponse, QueryAppliedPlanResponseSDKType, QueryUpgradedConsensusStateRequest, QueryUpgradedConsensusStateRequestSDKType, QueryUpgradedConsensusStateResponse, QueryUpgradedConsensusStateResponseSDKType, QueryModuleVersionsRequest, QueryModuleVersionsRequestSDKType, QueryModuleVersionsResponse, QueryModuleVersionsResponseSDKType, QueryAuthorityRequest, QueryAuthorityRequestSDKType, QueryAuthorityResponse, QueryAuthorityResponseSDKType } from "./query"; @@ -28,8 +28,8 @@ export interface Query { authority(request?: QueryAuthorityRequest): Promise; } export class QueryClientImpl implements Query { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.currentPlan = this.currentPlan.bind(this); this.appliedPlan = this.appliedPlan.bind(this); diff --git a/__fixtures__/v-next/outputosmojs/cosmos/upgrade/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputosmojs/cosmos/upgrade/v1beta1/query.rpc.func.ts new file mode 100644 index 0000000000..e3cbd36065 --- /dev/null +++ b/__fixtures__/v-next/outputosmojs/cosmos/upgrade/v1beta1/query.rpc.func.ts @@ -0,0 +1,71 @@ +import { Plan, PlanSDKType, ModuleVersion, ModuleVersionSDKType } from "./upgrade"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { QueryCurrentPlanRequest, QueryCurrentPlanRequestSDKType, QueryCurrentPlanResponse, QueryCurrentPlanResponseSDKType, QueryAppliedPlanRequest, QueryAppliedPlanRequestSDKType, QueryAppliedPlanResponse, QueryAppliedPlanResponseSDKType, QueryUpgradedConsensusStateRequest, QueryUpgradedConsensusStateRequestSDKType, QueryUpgradedConsensusStateResponse, QueryUpgradedConsensusStateResponseSDKType, QueryModuleVersionsRequest, QueryModuleVersionsRequestSDKType, QueryModuleVersionsResponse, QueryModuleVersionsResponseSDKType, QueryAuthorityRequest, QueryAuthorityRequestSDKType, QueryAuthorityResponse, QueryAuthorityResponseSDKType } from "./query"; +/** + * CurrentPlan queries the current upgrade plan. + * @name getCurrentPlan + * @package cosmos.upgrade.v1beta1 + * @see proto service: cosmos.upgrade.v1beta1.CurrentPlan + */ +export const getCurrentPlan = buildQuery({ + encode: QueryCurrentPlanRequest.encode, + decode: QueryCurrentPlanResponse.decode, + service: "cosmos.upgrade.v1beta1.Query", + method: "CurrentPlan" +}); +/** + * AppliedPlan queries a previously applied upgrade plan by its name. + * @name getAppliedPlan + * @package cosmos.upgrade.v1beta1 + * @see proto service: cosmos.upgrade.v1beta1.AppliedPlan + */ +export const getAppliedPlan = buildQuery({ + encode: QueryAppliedPlanRequest.encode, + decode: QueryAppliedPlanResponse.decode, + service: "cosmos.upgrade.v1beta1.Query", + method: "AppliedPlan" +}); +/** + * UpgradedConsensusState queries the consensus state that will serve + * as a trusted kernel for the next version of this chain. It will only be + * stored at the last height of this chain. + * UpgradedConsensusState RPC not supported with legacy querier + * This rpc is deprecated now that IBC has its own replacement + * (https://github.com/cosmos/ibc-go/blob/2c880a22e9f9cc75f62b527ca94aa75ce1106001/proto/ibc/core/client/v1/query.proto#L54) + * @name getUpgradedConsensusState + * @package cosmos.upgrade.v1beta1 + * @see proto service: cosmos.upgrade.v1beta1.UpgradedConsensusState + * @deprecated + */ +export const getUpgradedConsensusState = buildQuery({ + encode: QueryUpgradedConsensusStateRequest.encode, + decode: QueryUpgradedConsensusStateResponse.decode, + service: "cosmos.upgrade.v1beta1.Query", + method: "UpgradedConsensusState" +}); +/** + * ModuleVersions queries the list of module versions from state. + * + * Since: cosmos-sdk 0.43 + * @name getModuleVersions + * @package cosmos.upgrade.v1beta1 + * @see proto service: cosmos.upgrade.v1beta1.ModuleVersions + */ +export const getModuleVersions = buildQuery({ + encode: QueryModuleVersionsRequest.encode, + decode: QueryModuleVersionsResponse.decode, + service: "cosmos.upgrade.v1beta1.Query", + method: "ModuleVersions" +}); +/** + * Returns the account with authority to conduct upgrades + * @name getAuthority + * @package cosmos.upgrade.v1beta1 + * @see proto service: cosmos.upgrade.v1beta1.Authority + */ +export const getAuthority = buildQuery({ + encode: QueryAuthorityRequest.encode, + decode: QueryAuthorityResponse.decode, + service: "cosmos.upgrade.v1beta1.Query", + method: "Authority" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputosmojs/cosmos/upgrade/v1beta1/tx.registry.ts b/__fixtures__/v-next/outputosmojs/cosmos/upgrade/v1beta1/tx.registry.ts index 57f220dec3..2ed5f7f5bb 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/upgrade/v1beta1/tx.registry.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/upgrade/v1beta1/tx.registry.ts @@ -1,12 +1,7 @@ import { Plan, PlanSDKType } from "./upgrade"; -import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { TelescopeGeneratedType } from "../../../types"; import { MsgSoftwareUpgrade, MsgSoftwareUpgradeSDKType, MsgCancelUpgrade, MsgCancelUpgradeSDKType } from "./tx"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/cosmos.upgrade.v1beta1.MsgSoftwareUpgrade", MsgSoftwareUpgrade], ["/cosmos.upgrade.v1beta1.MsgCancelUpgrade", MsgCancelUpgrade]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/cosmos.upgrade.v1beta1.MsgSoftwareUpgrade", MsgSoftwareUpgrade], ["/cosmos.upgrade.v1beta1.MsgCancelUpgrade", MsgCancelUpgrade]]; export const MessageComposer = { encoded: { softwareUpgrade(value: MsgSoftwareUpgrade) { diff --git a/__fixtures__/v-next/outputosmojs/cosmos/upgrade/v1beta1/tx.rpc.func.ts b/__fixtures__/v-next/outputosmojs/cosmos/upgrade/v1beta1/tx.rpc.func.ts new file mode 100644 index 0000000000..ad84eeefb9 --- /dev/null +++ b/__fixtures__/v-next/outputosmojs/cosmos/upgrade/v1beta1/tx.rpc.func.ts @@ -0,0 +1,26 @@ +import { Plan, PlanSDKType } from "./upgrade"; +import { buildTx } from "../../../helper-func-types"; +import { MsgSoftwareUpgrade, MsgSoftwareUpgradeSDKType, MsgSoftwareUpgradeResponse, MsgSoftwareUpgradeResponseSDKType, MsgCancelUpgrade, MsgCancelUpgradeSDKType, MsgCancelUpgradeResponse, MsgCancelUpgradeResponseSDKType } from "./tx"; +/** + * SoftwareUpgrade is a governance operation for initiating a software upgrade. + * + * Since: cosmos-sdk 0.46 + * @name softwareUpgrade + * @package cosmos.upgrade.v1beta1 + * @see proto service: cosmos.upgrade.v1beta1.SoftwareUpgrade + */ +export const softwareUpgrade = buildTx({ + msg: MsgSoftwareUpgrade +}); +/** + * CancelUpgrade is a governance operation for cancelling a previously + * approvid software upgrade. + * + * Since: cosmos-sdk 0.46 + * @name cancelUpgrade + * @package cosmos.upgrade.v1beta1 + * @see proto service: cosmos.upgrade.v1beta1.CancelUpgrade + */ +export const cancelUpgrade = buildTx({ + msg: MsgCancelUpgrade +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputosmojs/cosmos/upgrade/v1beta1/tx.rpc.msg.ts b/__fixtures__/v-next/outputosmojs/cosmos/upgrade/v1beta1/tx.rpc.msg.ts index 7700a4b9b3..ed9d54cbb4 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/upgrade/v1beta1/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/upgrade/v1beta1/tx.rpc.msg.ts @@ -1,5 +1,5 @@ import { Plan, PlanSDKType } from "./upgrade"; -import { Rpc } from "../../../helpers"; +import { TxRpc } from "../../../types"; import { BinaryReader } from "../../../binary"; import { MsgSoftwareUpgrade, MsgSoftwareUpgradeSDKType, MsgSoftwareUpgradeResponse, MsgSoftwareUpgradeResponseSDKType, MsgCancelUpgrade, MsgCancelUpgradeSDKType, MsgCancelUpgradeResponse, MsgCancelUpgradeResponseSDKType } from "./tx"; /** Msg defines the upgrade Msg service. */ @@ -19,8 +19,8 @@ export interface Msg { cancelUpgrade(request: MsgCancelUpgrade): Promise; } export class MsgClientImpl implements Msg { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.softwareUpgrade = this.softwareUpgrade.bind(this); this.cancelUpgrade = this.cancelUpgrade.bind(this); @@ -36,6 +36,6 @@ export class MsgClientImpl implements Msg { return promise.then(data => MsgCancelUpgradeResponse.decode(new BinaryReader(data))); } } -export const createClientImpl = (rpc: Rpc) => { +export const createClientImpl = (rpc: TxRpc) => { return new MsgClientImpl(rpc); }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputosmojs/cosmos/vesting/v1beta1/tx.registry.ts b/__fixtures__/v-next/outputosmojs/cosmos/vesting/v1beta1/tx.registry.ts index 2add4a8dc6..f3c470a160 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/vesting/v1beta1/tx.registry.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/vesting/v1beta1/tx.registry.ts @@ -1,13 +1,8 @@ import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; import { Period, PeriodSDKType } from "./vesting"; -import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { TelescopeGeneratedType } from "../../../types"; import { MsgCreateVestingAccount, MsgCreateVestingAccountSDKType, MsgCreatePermanentLockedAccount, MsgCreatePermanentLockedAccountSDKType, MsgCreatePeriodicVestingAccount, MsgCreatePeriodicVestingAccountSDKType } from "./tx"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/cosmos.vesting.v1beta1.MsgCreateVestingAccount", MsgCreateVestingAccount], ["/cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccount", MsgCreatePermanentLockedAccount], ["/cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccount", MsgCreatePeriodicVestingAccount]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/cosmos.vesting.v1beta1.MsgCreateVestingAccount", MsgCreateVestingAccount], ["/cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccount", MsgCreatePermanentLockedAccount], ["/cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccount", MsgCreatePeriodicVestingAccount]]; export const MessageComposer = { encoded: { createVestingAccount(value: MsgCreateVestingAccount) { diff --git a/__fixtures__/v-next/outputosmojs/cosmos/vesting/v1beta1/tx.rpc.func.ts b/__fixtures__/v-next/outputosmojs/cosmos/vesting/v1beta1/tx.rpc.func.ts new file mode 100644 index 0000000000..1e5c552640 --- /dev/null +++ b/__fixtures__/v-next/outputosmojs/cosmos/vesting/v1beta1/tx.rpc.func.ts @@ -0,0 +1,34 @@ +import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; +import { Period, PeriodSDKType } from "./vesting"; +import { buildTx } from "../../../helper-func-types"; +import { MsgCreateVestingAccount, MsgCreateVestingAccountSDKType, MsgCreateVestingAccountResponse, MsgCreateVestingAccountResponseSDKType, MsgCreatePermanentLockedAccount, MsgCreatePermanentLockedAccountSDKType, MsgCreatePermanentLockedAccountResponse, MsgCreatePermanentLockedAccountResponseSDKType, MsgCreatePeriodicVestingAccount, MsgCreatePeriodicVestingAccountSDKType, MsgCreatePeriodicVestingAccountResponse, MsgCreatePeriodicVestingAccountResponseSDKType } from "./tx"; +/** + * CreateVestingAccount defines a method that enables creating a vesting + * account. + * @name createVestingAccount + * @package cosmos.vesting.v1beta1 + * @see proto service: cosmos.vesting.v1beta1.CreateVestingAccount + */ +export const createVestingAccount = buildTx({ + msg: MsgCreateVestingAccount +}); +/** + * CreatePermanentLockedAccount defines a method that enables creating a permanent + * locked account. + * @name createPermanentLockedAccount + * @package cosmos.vesting.v1beta1 + * @see proto service: cosmos.vesting.v1beta1.CreatePermanentLockedAccount + */ +export const createPermanentLockedAccount = buildTx({ + msg: MsgCreatePermanentLockedAccount +}); +/** + * CreatePeriodicVestingAccount defines a method that enables creating a + * periodic vesting account. + * @name createPeriodicVestingAccount + * @package cosmos.vesting.v1beta1 + * @see proto service: cosmos.vesting.v1beta1.CreatePeriodicVestingAccount + */ +export const createPeriodicVestingAccount = buildTx({ + msg: MsgCreatePeriodicVestingAccount +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputosmojs/cosmos/vesting/v1beta1/tx.rpc.msg.ts b/__fixtures__/v-next/outputosmojs/cosmos/vesting/v1beta1/tx.rpc.msg.ts index dc8d141651..edf2b3cee7 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/vesting/v1beta1/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/vesting/v1beta1/tx.rpc.msg.ts @@ -1,6 +1,6 @@ import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; import { Period, PeriodSDKType } from "./vesting"; -import { Rpc } from "../../../helpers"; +import { TxRpc } from "../../../types"; import { BinaryReader } from "../../../binary"; import { MsgCreateVestingAccount, MsgCreateVestingAccountSDKType, MsgCreateVestingAccountResponse, MsgCreateVestingAccountResponseSDKType, MsgCreatePermanentLockedAccount, MsgCreatePermanentLockedAccountSDKType, MsgCreatePermanentLockedAccountResponse, MsgCreatePermanentLockedAccountResponseSDKType, MsgCreatePeriodicVestingAccount, MsgCreatePeriodicVestingAccountSDKType, MsgCreatePeriodicVestingAccountResponse, MsgCreatePeriodicVestingAccountResponseSDKType } from "./tx"; /** Msg defines the bank Msg service. */ @@ -22,8 +22,8 @@ export interface Msg { createPeriodicVestingAccount(request: MsgCreatePeriodicVestingAccount): Promise; } export class MsgClientImpl implements Msg { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.createVestingAccount = this.createVestingAccount.bind(this); this.createPermanentLockedAccount = this.createPermanentLockedAccount.bind(this); @@ -45,6 +45,6 @@ export class MsgClientImpl implements Msg { return promise.then(data => MsgCreatePeriodicVestingAccountResponse.decode(new BinaryReader(data))); } } -export const createClientImpl = (rpc: Rpc) => { +export const createClientImpl = (rpc: TxRpc) => { return new MsgClientImpl(rpc); }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputosmojs/cosmwasm/bundle.ts b/__fixtures__/v-next/outputosmojs/cosmwasm/bundle.ts index c303ada3f0..7cb7a583d4 100644 --- a/__fixtures__/v-next/outputosmojs/cosmwasm/bundle.ts +++ b/__fixtures__/v-next/outputosmojs/cosmwasm/bundle.ts @@ -5,14 +5,16 @@ import * as _152 from "./wasm/v1/query"; import * as _153 from "./wasm/v1/tx"; import * as _154 from "./wasm/v1/types"; import * as _155 from "./wasm/v1/authz"; -import * as _486 from "./wasm/v1/tx.amino"; -import * as _487 from "./wasm/v1/tx.registry"; -import * as _488 from "./wasm/v1/query.lcd"; -import * as _489 from "./wasm/v1/query.rpc.Query"; -import * as _490 from "./wasm/v1/tx.rpc.msg"; -import * as _632 from "./lcd"; -import * as _633 from "./rpc.query"; -import * as _634 from "./rpc.tx"; +import * as _537 from "./wasm/v1/tx.amino"; +import * as _538 from "./wasm/v1/tx.registry"; +import * as _539 from "./wasm/v1/query.lcd"; +import * as _540 from "./wasm/v1/query.rpc.func"; +import * as _541 from "./wasm/v1/query.rpc.Query"; +import * as _542 from "./wasm/v1/tx.rpc.func"; +import * as _543 from "./wasm/v1/tx.rpc.msg"; +import * as _741 from "./lcd"; +import * as _742 from "./rpc.query"; +import * as _743 from "./rpc.tx"; export namespace cosmwasm { export namespace wasm { export const v1 = { @@ -23,16 +25,18 @@ export namespace cosmwasm { ..._153, ..._154, ..._155, - ..._486, - ..._487, - ..._488, - ..._489, - ..._490 + ..._537, + ..._538, + ..._539, + ..._540, + ..._541, + ..._542, + ..._543 }; } export const ClientFactory = { - ..._632, - ..._633, - ..._634 + ..._741, + ..._742, + ..._743 }; } \ No newline at end of file diff --git a/__fixtures__/v-next/outputosmojs/cosmwasm/wasm/v1/authz.ts b/__fixtures__/v-next/outputosmojs/cosmwasm/wasm/v1/authz.ts index 024baa16be..e425db549d 100644 --- a/__fixtures__/v-next/outputosmojs/cosmwasm/wasm/v1/authz.ts +++ b/__fixtures__/v-next/outputosmojs/cosmwasm/wasm/v1/authz.ts @@ -3,7 +3,7 @@ import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { JsonSafe } from "../../../json-safe"; import { DeepPartial, isSet, bytesFromBase64, base64FromBytes } from "../../../helpers"; -import { toUtf8, fromUtf8 } from "@cosmjs/encoding"; +import { toUtf8, fromUtf8 } from "@interchainjs/encoding"; export const protobufPackage = "cosmwasm.wasm.v1"; /** * ContractExecutionAuthorization defines authorization for wasm execute. diff --git a/__fixtures__/v-next/outputosmojs/cosmwasm/wasm/v1/proposal.ts b/__fixtures__/v-next/outputosmojs/cosmwasm/wasm/v1/proposal.ts index 17f8aa460f..80e10ec2d4 100644 --- a/__fixtures__/v-next/outputosmojs/cosmwasm/wasm/v1/proposal.ts +++ b/__fixtures__/v-next/outputosmojs/cosmwasm/wasm/v1/proposal.ts @@ -3,7 +3,7 @@ import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; -import { fromBase64, toBase64, toUtf8, fromUtf8 } from "@cosmjs/encoding"; +import { fromBase64, toBase64, toUtf8, fromUtf8 } from "@interchainjs/encoding"; export const protobufPackage = "cosmwasm.wasm.v1"; /** * StoreCodeProposal gov proposal content type to submit WASM code to the system diff --git a/__fixtures__/v-next/outputosmojs/cosmwasm/wasm/v1/query.rpc.Query.ts b/__fixtures__/v-next/outputosmojs/cosmwasm/wasm/v1/query.rpc.Query.ts index 7f4067bb29..f15b0db72b 100644 --- a/__fixtures__/v-next/outputosmojs/cosmwasm/wasm/v1/query.rpc.Query.ts +++ b/__fixtures__/v-next/outputosmojs/cosmwasm/wasm/v1/query.rpc.Query.ts @@ -1,6 +1,6 @@ import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination"; import { ContractInfo, ContractInfoSDKType, ContractCodeHistoryEntry, ContractCodeHistoryEntrySDKType, Model, ModelSDKType } from "./types"; -import { Rpc } from "../../../helpers"; +import { TxRpc } from "../../../types"; import { BinaryReader } from "../../../binary"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; import { QueryContractInfoRequest, QueryContractInfoRequestSDKType, QueryContractInfoResponse, QueryContractInfoResponseSDKType, QueryContractHistoryRequest, QueryContractHistoryRequestSDKType, QueryContractHistoryResponse, QueryContractHistoryResponseSDKType, QueryContractsByCodeRequest, QueryContractsByCodeRequestSDKType, QueryContractsByCodeResponse, QueryContractsByCodeResponseSDKType, QueryAllContractStateRequest, QueryAllContractStateRequestSDKType, QueryAllContractStateResponse, QueryAllContractStateResponseSDKType, QueryRawContractStateRequest, QueryRawContractStateRequestSDKType, QueryRawContractStateResponse, QueryRawContractStateResponseSDKType, QuerySmartContractStateRequest, QuerySmartContractStateRequestSDKType, QuerySmartContractStateResponse, QuerySmartContractStateResponseSDKType, QueryCodeRequest, QueryCodeRequestSDKType, QueryCodeResponse, QueryCodeResponseSDKType, QueryCodesRequest, QueryCodesRequestSDKType, QueryCodesResponse, QueryCodesResponseSDKType, QueryPinnedCodesRequest, QueryPinnedCodesRequestSDKType, QueryPinnedCodesResponse, QueryPinnedCodesResponseSDKType } from "./query"; @@ -26,8 +26,8 @@ export interface Query { pinnedCodes(request?: QueryPinnedCodesRequest): Promise; } export class QueryClientImpl implements Query { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.contractInfo = this.contractInfo.bind(this); this.contractHistory = this.contractHistory.bind(this); diff --git a/__fixtures__/v-next/outputosmojs/cosmwasm/wasm/v1/query.rpc.func.ts b/__fixtures__/v-next/outputosmojs/cosmwasm/wasm/v1/query.rpc.func.ts new file mode 100644 index 0000000000..80787742a4 --- /dev/null +++ b/__fixtures__/v-next/outputosmojs/cosmwasm/wasm/v1/query.rpc.func.ts @@ -0,0 +1,112 @@ +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination"; +import { ContractInfo, ContractInfoSDKType, ContractCodeHistoryEntry, ContractCodeHistoryEntrySDKType, Model, ModelSDKType } from "./types"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { QueryContractInfoRequest, QueryContractInfoRequestSDKType, QueryContractInfoResponse, QueryContractInfoResponseSDKType, QueryContractHistoryRequest, QueryContractHistoryRequestSDKType, QueryContractHistoryResponse, QueryContractHistoryResponseSDKType, QueryContractsByCodeRequest, QueryContractsByCodeRequestSDKType, QueryContractsByCodeResponse, QueryContractsByCodeResponseSDKType, QueryAllContractStateRequest, QueryAllContractStateRequestSDKType, QueryAllContractStateResponse, QueryAllContractStateResponseSDKType, QueryRawContractStateRequest, QueryRawContractStateRequestSDKType, QueryRawContractStateResponse, QueryRawContractStateResponseSDKType, QuerySmartContractStateRequest, QuerySmartContractStateRequestSDKType, QuerySmartContractStateResponse, QuerySmartContractStateResponseSDKType, QueryCodeRequest, QueryCodeRequestSDKType, QueryCodeResponse, QueryCodeResponseSDKType, QueryCodesRequest, QueryCodesRequestSDKType, QueryCodesResponse, QueryCodesResponseSDKType, QueryPinnedCodesRequest, QueryPinnedCodesRequestSDKType, QueryPinnedCodesResponse, QueryPinnedCodesResponseSDKType } from "./query"; +/** + * ContractInfo gets the contract meta data + * @name getContractInfo + * @package cosmwasm.wasm.v1 + * @see proto service: cosmwasm.wasm.v1.ContractInfo + */ +export const getContractInfo = buildQuery({ + encode: QueryContractInfoRequest.encode, + decode: QueryContractInfoResponse.decode, + service: "cosmwasm.wasm.v1.Query", + method: "ContractInfo" +}); +/** + * ContractHistory gets the contract code history + * @name getContractHistory + * @package cosmwasm.wasm.v1 + * @see proto service: cosmwasm.wasm.v1.ContractHistory + */ +export const getContractHistory = buildQuery({ + encode: QueryContractHistoryRequest.encode, + decode: QueryContractHistoryResponse.decode, + service: "cosmwasm.wasm.v1.Query", + method: "ContractHistory" +}); +/** + * ContractsByCode lists all smart contracts for a code id + * @name getContractsByCode + * @package cosmwasm.wasm.v1 + * @see proto service: cosmwasm.wasm.v1.ContractsByCode + */ +export const getContractsByCode = buildQuery({ + encode: QueryContractsByCodeRequest.encode, + decode: QueryContractsByCodeResponse.decode, + service: "cosmwasm.wasm.v1.Query", + method: "ContractsByCode" +}); +/** + * AllContractState gets all raw store data for a single contract + * @name getAllContractState + * @package cosmwasm.wasm.v1 + * @see proto service: cosmwasm.wasm.v1.AllContractState + */ +export const getAllContractState = buildQuery({ + encode: QueryAllContractStateRequest.encode, + decode: QueryAllContractStateResponse.decode, + service: "cosmwasm.wasm.v1.Query", + method: "AllContractState" +}); +/** + * RawContractState gets single key from the raw store data of a contract + * @name getRawContractState + * @package cosmwasm.wasm.v1 + * @see proto service: cosmwasm.wasm.v1.RawContractState + */ +export const getRawContractState = buildQuery({ + encode: QueryRawContractStateRequest.encode, + decode: QueryRawContractStateResponse.decode, + service: "cosmwasm.wasm.v1.Query", + method: "RawContractState" +}); +/** + * SmartContractState get smart query result from the contract + * @name getSmartContractState + * @package cosmwasm.wasm.v1 + * @see proto service: cosmwasm.wasm.v1.SmartContractState + */ +export const getSmartContractState = buildQuery({ + encode: QuerySmartContractStateRequest.encode, + decode: QuerySmartContractStateResponse.decode, + service: "cosmwasm.wasm.v1.Query", + method: "SmartContractState" +}); +/** + * Code gets the binary code and metadata for a singe wasm code + * @name getCode + * @package cosmwasm.wasm.v1 + * @see proto service: cosmwasm.wasm.v1.Code + */ +export const getCode = buildQuery({ + encode: QueryCodeRequest.encode, + decode: QueryCodeResponse.decode, + service: "cosmwasm.wasm.v1.Query", + method: "Code" +}); +/** + * Codes gets the metadata for all stored wasm codes + * @name getCodes + * @package cosmwasm.wasm.v1 + * @see proto service: cosmwasm.wasm.v1.Codes + */ +export const getCodes = buildQuery({ + encode: QueryCodesRequest.encode, + decode: QueryCodesResponse.decode, + service: "cosmwasm.wasm.v1.Query", + method: "Codes" +}); +/** + * PinnedCodes gets the pinned code ids + * @name getPinnedCodes + * @package cosmwasm.wasm.v1 + * @see proto service: cosmwasm.wasm.v1.PinnedCodes + */ +export const getPinnedCodes = buildQuery({ + encode: QueryPinnedCodesRequest.encode, + decode: QueryPinnedCodesResponse.decode, + service: "cosmwasm.wasm.v1.Query", + method: "PinnedCodes" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputosmojs/cosmwasm/wasm/v1/query.ts b/__fixtures__/v-next/outputosmojs/cosmwasm/wasm/v1/query.ts index a913ffac6c..352d925e0f 100644 --- a/__fixtures__/v-next/outputosmojs/cosmwasm/wasm/v1/query.ts +++ b/__fixtures__/v-next/outputosmojs/cosmwasm/wasm/v1/query.ts @@ -3,7 +3,7 @@ import { ContractInfo, ContractInfoSDKType, ContractCodeHistoryEntry, ContractCo import { BinaryReader, BinaryWriter } from "../../../binary"; import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; -import { toUtf8, fromUtf8 } from "@cosmjs/encoding"; +import { toUtf8, fromUtf8 } from "@interchainjs/encoding"; export const protobufPackage = "cosmwasm.wasm.v1"; /** * QueryContractInfoRequest is the request type for the Query/ContractInfo RPC diff --git a/__fixtures__/v-next/outputosmojs/cosmwasm/wasm/v1/tx.amino.ts b/__fixtures__/v-next/outputosmojs/cosmwasm/wasm/v1/tx.amino.ts index db3abbec45..a31a33ed71 100644 --- a/__fixtures__/v-next/outputosmojs/cosmwasm/wasm/v1/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/cosmwasm/wasm/v1/tx.amino.ts @@ -1,7 +1,7 @@ import { AccessConfig, AccessConfigSDKType, accessTypeFromJSON } from "./types"; import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { AminoMsg } from "@cosmjs/amino"; -import { toBase64, fromBase64, fromUtf8, toUtf8 } from "@cosmjs/encoding"; +import { toBase64, fromBase64, fromUtf8, toUtf8 } from "@interchainjs/encoding"; import { MsgStoreCode, MsgStoreCodeSDKType, MsgInstantiateContract, MsgInstantiateContractSDKType, MsgExecuteContract, MsgExecuteContractSDKType, MsgMigrateContract, MsgMigrateContractSDKType, MsgUpdateAdmin, MsgUpdateAdminSDKType, MsgClearAdmin, MsgClearAdminSDKType } from "./tx"; export interface MsgStoreCodeAminoType extends AminoMsg { type: "wasm/MsgStoreCode"; diff --git a/__fixtures__/v-next/outputosmojs/cosmwasm/wasm/v1/tx.registry.ts b/__fixtures__/v-next/outputosmojs/cosmwasm/wasm/v1/tx.registry.ts index f5f468179a..d007f7e50d 100644 --- a/__fixtures__/v-next/outputosmojs/cosmwasm/wasm/v1/tx.registry.ts +++ b/__fixtures__/v-next/outputosmojs/cosmwasm/wasm/v1/tx.registry.ts @@ -1,13 +1,8 @@ import { AccessConfig, AccessConfigSDKType } from "./types"; import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; -import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { TelescopeGeneratedType } from "../../../types"; import { MsgStoreCode, MsgStoreCodeSDKType, MsgInstantiateContract, MsgInstantiateContractSDKType, MsgExecuteContract, MsgExecuteContractSDKType, MsgMigrateContract, MsgMigrateContractSDKType, MsgUpdateAdmin, MsgUpdateAdminSDKType, MsgClearAdmin, MsgClearAdminSDKType } from "./tx"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/cosmwasm.wasm.v1.MsgStoreCode", MsgStoreCode], ["/cosmwasm.wasm.v1.MsgInstantiateContract", MsgInstantiateContract], ["/cosmwasm.wasm.v1.MsgExecuteContract", MsgExecuteContract], ["/cosmwasm.wasm.v1.MsgMigrateContract", MsgMigrateContract], ["/cosmwasm.wasm.v1.MsgUpdateAdmin", MsgUpdateAdmin], ["/cosmwasm.wasm.v1.MsgClearAdmin", MsgClearAdmin]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/cosmwasm.wasm.v1.MsgStoreCode", MsgStoreCode], ["/cosmwasm.wasm.v1.MsgInstantiateContract", MsgInstantiateContract], ["/cosmwasm.wasm.v1.MsgExecuteContract", MsgExecuteContract], ["/cosmwasm.wasm.v1.MsgMigrateContract", MsgMigrateContract], ["/cosmwasm.wasm.v1.MsgUpdateAdmin", MsgUpdateAdmin], ["/cosmwasm.wasm.v1.MsgClearAdmin", MsgClearAdmin]]; export const MessageComposer = { encoded: { storeCode(value: MsgStoreCode) { diff --git a/__fixtures__/v-next/outputosmojs/cosmwasm/wasm/v1/tx.rpc.func.ts b/__fixtures__/v-next/outputosmojs/cosmwasm/wasm/v1/tx.rpc.func.ts new file mode 100644 index 0000000000..1faf1de1bf --- /dev/null +++ b/__fixtures__/v-next/outputosmojs/cosmwasm/wasm/v1/tx.rpc.func.ts @@ -0,0 +1,58 @@ +import { AccessConfig, AccessConfigSDKType } from "./types"; +import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; +import { buildTx } from "../../../helper-func-types"; +import { MsgStoreCode, MsgStoreCodeSDKType, MsgStoreCodeResponse, MsgStoreCodeResponseSDKType, MsgInstantiateContract, MsgInstantiateContractSDKType, MsgInstantiateContractResponse, MsgInstantiateContractResponseSDKType, MsgExecuteContract, MsgExecuteContractSDKType, MsgExecuteContractResponse, MsgExecuteContractResponseSDKType, MsgMigrateContract, MsgMigrateContractSDKType, MsgMigrateContractResponse, MsgMigrateContractResponseSDKType, MsgUpdateAdmin, MsgUpdateAdminSDKType, MsgUpdateAdminResponse, MsgUpdateAdminResponseSDKType, MsgClearAdmin, MsgClearAdminSDKType, MsgClearAdminResponse, MsgClearAdminResponseSDKType } from "./tx"; +/** + * StoreCode to submit Wasm code to the system + * @name storeCode + * @package cosmwasm.wasm.v1 + * @see proto service: cosmwasm.wasm.v1.StoreCode + */ +export const storeCode = buildTx({ + msg: MsgStoreCode +}); +/** + * Instantiate creates a new smart contract instance for the given code id. + * @name instantiateContract + * @package cosmwasm.wasm.v1 + * @see proto service: cosmwasm.wasm.v1.InstantiateContract + */ +export const instantiateContract = buildTx({ + msg: MsgInstantiateContract +}); +/** + * Execute submits the given message data to a smart contract + * @name executeContract + * @package cosmwasm.wasm.v1 + * @see proto service: cosmwasm.wasm.v1.ExecuteContract + */ +export const executeContract = buildTx({ + msg: MsgExecuteContract +}); +/** + * Migrate runs a code upgrade/ downgrade for a smart contract + * @name migrateContract + * @package cosmwasm.wasm.v1 + * @see proto service: cosmwasm.wasm.v1.MigrateContract + */ +export const migrateContract = buildTx({ + msg: MsgMigrateContract +}); +/** + * UpdateAdmin sets a new admin for a smart contract + * @name updateAdmin + * @package cosmwasm.wasm.v1 + * @see proto service: cosmwasm.wasm.v1.UpdateAdmin + */ +export const updateAdmin = buildTx({ + msg: MsgUpdateAdmin +}); +/** + * ClearAdmin removes any admin stored for a smart contract + * @name clearAdmin + * @package cosmwasm.wasm.v1 + * @see proto service: cosmwasm.wasm.v1.ClearAdmin + */ +export const clearAdmin = buildTx({ + msg: MsgClearAdmin +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputosmojs/cosmwasm/wasm/v1/tx.rpc.msg.ts b/__fixtures__/v-next/outputosmojs/cosmwasm/wasm/v1/tx.rpc.msg.ts index 9ac6092cc2..1ccb622733 100644 --- a/__fixtures__/v-next/outputosmojs/cosmwasm/wasm/v1/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputosmojs/cosmwasm/wasm/v1/tx.rpc.msg.ts @@ -1,6 +1,6 @@ import { AccessConfig, AccessConfigSDKType } from "./types"; import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; -import { Rpc } from "../../../helpers"; +import { TxRpc } from "../../../types"; import { BinaryReader } from "../../../binary"; import { MsgStoreCode, MsgStoreCodeSDKType, MsgStoreCodeResponse, MsgStoreCodeResponseSDKType, MsgInstantiateContract, MsgInstantiateContractSDKType, MsgInstantiateContractResponse, MsgInstantiateContractResponseSDKType, MsgExecuteContract, MsgExecuteContractSDKType, MsgExecuteContractResponse, MsgExecuteContractResponseSDKType, MsgMigrateContract, MsgMigrateContractSDKType, MsgMigrateContractResponse, MsgMigrateContractResponseSDKType, MsgUpdateAdmin, MsgUpdateAdminSDKType, MsgUpdateAdminResponse, MsgUpdateAdminResponseSDKType, MsgClearAdmin, MsgClearAdminSDKType, MsgClearAdminResponse, MsgClearAdminResponseSDKType } from "./tx"; /** Msg defines the wasm Msg service. */ @@ -19,8 +19,8 @@ export interface Msg { clearAdmin(request: MsgClearAdmin): Promise; } export class MsgClientImpl implements Msg { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.storeCode = this.storeCode.bind(this); this.instantiateContract = this.instantiateContract.bind(this); @@ -60,6 +60,6 @@ export class MsgClientImpl implements Msg { return promise.then(data => MsgClearAdminResponse.decode(new BinaryReader(data))); } } -export const createClientImpl = (rpc: Rpc) => { +export const createClientImpl = (rpc: TxRpc) => { return new MsgClientImpl(rpc); }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputosmojs/cosmwasm/wasm/v1/tx.ts b/__fixtures__/v-next/outputosmojs/cosmwasm/wasm/v1/tx.ts index bc0d11625b..8f0e1caee4 100644 --- a/__fixtures__/v-next/outputosmojs/cosmwasm/wasm/v1/tx.ts +++ b/__fixtures__/v-next/outputosmojs/cosmwasm/wasm/v1/tx.ts @@ -3,7 +3,7 @@ import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; -import { fromBase64, toBase64, toUtf8, fromUtf8 } from "@cosmjs/encoding"; +import { fromBase64, toBase64, toUtf8, fromUtf8 } from "@interchainjs/encoding"; export const protobufPackage = "cosmwasm.wasm.v1"; /** * MsgStoreCode submit Wasm code to the system diff --git a/__fixtures__/v-next/outputosmojs/cosmwasm/wasm/v1/types.ts b/__fixtures__/v-next/outputosmojs/cosmwasm/wasm/v1/types.ts index 4f1e9095ab..3384de6697 100644 --- a/__fixtures__/v-next/outputosmojs/cosmwasm/wasm/v1/types.ts +++ b/__fixtures__/v-next/outputosmojs/cosmwasm/wasm/v1/types.ts @@ -2,7 +2,7 @@ import { Any, AnySDKType } from "../../../google/protobuf/any"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; -import { toUtf8, fromUtf8 } from "@cosmjs/encoding"; +import { toUtf8, fromUtf8 } from "@interchainjs/encoding"; export const protobufPackage = "cosmwasm.wasm.v1"; /** AccessType permission types */ export enum AccessType { diff --git a/__fixtures__/v-next/outputosmojs/evmos/bundle.ts b/__fixtures__/v-next/outputosmojs/evmos/bundle.ts index aa8b269b04..f5b09e28ea 100644 --- a/__fixtures__/v-next/outputosmojs/evmos/bundle.ts +++ b/__fixtures__/v-next/outputosmojs/evmos/bundle.ts @@ -22,54 +22,67 @@ import * as _176 from "./recovery/v1/query"; import * as _177 from "./vesting/v1/query"; import * as _178 from "./vesting/v1/tx"; import * as _179 from "./vesting/v1/vesting"; -import * as _491 from "./erc20/v1/tx.amino"; -import * as _492 from "./fees/v1/tx.amino"; -import * as _493 from "./vesting/v1/tx.amino"; -import * as _494 from "./erc20/v1/tx.registry"; -import * as _495 from "./fees/v1/tx.registry"; -import * as _496 from "./vesting/v1/tx.registry"; -import * as _497 from "./claims/v1/query.lcd"; -import * as _498 from "./epochs/v1/query.lcd"; -import * as _499 from "./erc20/v1/query.lcd"; -import * as _500 from "./fees/v1/query.lcd"; -import * as _501 from "./incentives/v1/query.lcd"; -import * as _502 from "./inflation/v1/query.lcd"; -import * as _503 from "./recovery/v1/query.lcd"; -import * as _504 from "./vesting/v1/query.lcd"; -import * as _505 from "./claims/v1/query.rpc.Query"; -import * as _506 from "./epochs/v1/query.rpc.Query"; -import * as _507 from "./erc20/v1/query.rpc.Query"; -import * as _508 from "./fees/v1/query.rpc.Query"; -import * as _509 from "./incentives/v1/query.rpc.Query"; -import * as _510 from "./inflation/v1/query.rpc.Query"; -import * as _511 from "./recovery/v1/query.rpc.Query"; -import * as _512 from "./vesting/v1/query.rpc.Query"; -import * as _513 from "./erc20/v1/tx.rpc.msg"; -import * as _514 from "./fees/v1/tx.rpc.msg"; -import * as _515 from "./vesting/v1/tx.rpc.msg"; -import * as _516 from "./erc20/v1/query.pinia.store"; -import * as _635 from "./lcd"; -import * as _636 from "./custom-lcd-client"; -import * as _637 from "./rpc.query"; -import * as _638 from "./evmos-rpc-client.query"; -import * as _639 from "./rpc.tx"; -import * as _640 from "./evmos-rpc-client.tx"; +import * as _544 from "./erc20/v1/tx.amino"; +import * as _545 from "./fees/v1/tx.amino"; +import * as _546 from "./vesting/v1/tx.amino"; +import * as _547 from "./erc20/v1/tx.registry"; +import * as _548 from "./fees/v1/tx.registry"; +import * as _549 from "./vesting/v1/tx.registry"; +import * as _550 from "./claims/v1/query.lcd"; +import * as _551 from "./epochs/v1/query.lcd"; +import * as _552 from "./erc20/v1/query.lcd"; +import * as _553 from "./fees/v1/query.lcd"; +import * as _554 from "./incentives/v1/query.lcd"; +import * as _555 from "./inflation/v1/query.lcd"; +import * as _556 from "./recovery/v1/query.lcd"; +import * as _557 from "./vesting/v1/query.lcd"; +import * as _558 from "./claims/v1/query.rpc.func"; +import * as _559 from "./epochs/v1/query.rpc.func"; +import * as _560 from "./erc20/v1/query.rpc.func"; +import * as _561 from "./fees/v1/query.rpc.func"; +import * as _562 from "./incentives/v1/query.rpc.func"; +import * as _563 from "./inflation/v1/query.rpc.func"; +import * as _564 from "./recovery/v1/query.rpc.func"; +import * as _565 from "./vesting/v1/query.rpc.func"; +import * as _566 from "./claims/v1/query.rpc.Query"; +import * as _567 from "./epochs/v1/query.rpc.Query"; +import * as _568 from "./erc20/v1/query.rpc.Query"; +import * as _569 from "./fees/v1/query.rpc.Query"; +import * as _570 from "./incentives/v1/query.rpc.Query"; +import * as _571 from "./inflation/v1/query.rpc.Query"; +import * as _572 from "./recovery/v1/query.rpc.Query"; +import * as _573 from "./vesting/v1/query.rpc.Query"; +import * as _574 from "./erc20/v1/tx.rpc.func"; +import * as _575 from "./fees/v1/tx.rpc.func"; +import * as _576 from "./vesting/v1/tx.rpc.func"; +import * as _577 from "./erc20/v1/tx.rpc.msg"; +import * as _578 from "./fees/v1/tx.rpc.msg"; +import * as _579 from "./vesting/v1/tx.rpc.msg"; +import * as _580 from "./erc20/v1/query.pinia.store"; +import * as _744 from "./lcd"; +import * as _745 from "./custom-lcd-client"; +import * as _746 from "./rpc.query"; +import * as _747 from "./evmos-rpc-client.query"; +import * as _748 from "./rpc.tx"; +import * as _749 from "./evmos-rpc-client.tx"; export namespace evmos { export namespace claims { export const v1 = { ..._156, ..._157, ..._158, - ..._497, - ..._505 + ..._550, + ..._558, + ..._566 }; } export namespace epochs { export const v1 = { ..._159, ..._160, - ..._498, - ..._506 + ..._551, + ..._559, + ..._567 }; } export namespace erc20 { @@ -78,12 +91,14 @@ export namespace evmos { ..._162, ..._163, ..._164, - ..._491, - ..._494, - ..._499, - ..._507, - ..._513, - ..._516 + ..._544, + ..._547, + ..._552, + ..._560, + ..._568, + ..._574, + ..._577, + ..._580 }; } export namespace fees { @@ -92,11 +107,13 @@ export namespace evmos { ..._166, ..._167, ..._168, - ..._492, - ..._495, - ..._500, - ..._508, - ..._514 + ..._545, + ..._548, + ..._553, + ..._561, + ..._569, + ..._575, + ..._578 }; } export namespace incentives { @@ -104,8 +121,9 @@ export namespace evmos { ..._169, ..._170, ..._171, - ..._501, - ..._509 + ..._554, + ..._562, + ..._570 }; } export namespace inflation { @@ -113,16 +131,18 @@ export namespace evmos { ..._172, ..._173, ..._174, - ..._502, - ..._510 + ..._555, + ..._563, + ..._571 }; } export namespace recovery { export const v1 = { ..._175, ..._176, - ..._503, - ..._511 + ..._556, + ..._564, + ..._572 }; } export namespace vesting { @@ -130,19 +150,21 @@ export namespace evmos { ..._177, ..._178, ..._179, - ..._493, - ..._496, - ..._504, - ..._512, - ..._515 + ..._546, + ..._549, + ..._557, + ..._565, + ..._573, + ..._576, + ..._579 }; } export const ClientFactory = { - ..._635, - ..._636, - ..._637, - ..._638, - ..._639, - ..._640 + ..._744, + ..._745, + ..._746, + ..._747, + ..._748, + ..._749 }; } \ No newline at end of file diff --git a/__fixtures__/v-next/outputosmojs/evmos/claims/v1/query.rpc.Query.ts b/__fixtures__/v-next/outputosmojs/evmos/claims/v1/query.rpc.Query.ts index 6df0aabbd5..8e7564c77d 100644 --- a/__fixtures__/v-next/outputosmojs/evmos/claims/v1/query.rpc.Query.ts +++ b/__fixtures__/v-next/outputosmojs/evmos/claims/v1/query.rpc.Query.ts @@ -2,7 +2,7 @@ import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } fr import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { Params, ParamsSDKType } from "./genesis"; import { ClaimsRecordAddress, ClaimsRecordAddressSDKType, Claim, ClaimSDKType } from "./claims"; -import { Rpc } from "../../../helpers"; +import { TxRpc } from "../../../types"; import { BinaryReader } from "../../../binary"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; import { QueryTotalUnclaimedRequest, QueryTotalUnclaimedRequestSDKType, QueryTotalUnclaimedResponse, QueryTotalUnclaimedResponseSDKType, QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, QueryClaimsRecordsRequest, QueryClaimsRecordsRequestSDKType, QueryClaimsRecordsResponse, QueryClaimsRecordsResponseSDKType, QueryClaimsRecordRequest, QueryClaimsRecordRequestSDKType, QueryClaimsRecordResponse, QueryClaimsRecordResponseSDKType } from "./query"; @@ -18,8 +18,8 @@ export interface Query { claimsRecord(request: QueryClaimsRecordRequest): Promise; } export class QueryClientImpl implements Query { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.totalUnclaimed = this.totalUnclaimed.bind(this); this.params = this.params.bind(this); diff --git a/__fixtures__/v-next/outputosmojs/evmos/claims/v1/query.rpc.func.ts b/__fixtures__/v-next/outputosmojs/evmos/claims/v1/query.rpc.func.ts new file mode 100644 index 0000000000..f4add38251 --- /dev/null +++ b/__fixtures__/v-next/outputosmojs/evmos/claims/v1/query.rpc.func.ts @@ -0,0 +1,54 @@ +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination"; +import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; +import { Params, ParamsSDKType } from "./genesis"; +import { ClaimsRecordAddress, ClaimsRecordAddressSDKType, Claim, ClaimSDKType } from "./claims"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { QueryTotalUnclaimedRequest, QueryTotalUnclaimedRequestSDKType, QueryTotalUnclaimedResponse, QueryTotalUnclaimedResponseSDKType, QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, QueryClaimsRecordsRequest, QueryClaimsRecordsRequestSDKType, QueryClaimsRecordsResponse, QueryClaimsRecordsResponseSDKType, QueryClaimsRecordRequest, QueryClaimsRecordRequestSDKType, QueryClaimsRecordResponse, QueryClaimsRecordResponseSDKType } from "./query"; +/** + * TotalUnclaimed queries the total unclaimed tokens from the airdrop + * @name getTotalUnclaimed + * @package evmos.claims.v1 + * @see proto service: evmos.claims.v1.TotalUnclaimed + */ +export const getTotalUnclaimed = buildQuery({ + encode: QueryTotalUnclaimedRequest.encode, + decode: QueryTotalUnclaimedResponse.decode, + service: "evmos.claims.v1.Query", + method: "TotalUnclaimed" +}); +/** + * Params returns the claims module parameters + * @name getParams + * @package evmos.claims.v1 + * @see proto service: evmos.claims.v1.Params + */ +export const getParams = buildQuery({ + encode: QueryParamsRequest.encode, + decode: QueryParamsResponse.decode, + service: "evmos.claims.v1.Query", + method: "Params" +}); +/** + * ClaimsRecords returns all claims records + * @name getClaimsRecords + * @package evmos.claims.v1 + * @see proto service: evmos.claims.v1.ClaimsRecords + */ +export const getClaimsRecords = buildQuery({ + encode: QueryClaimsRecordsRequest.encode, + decode: QueryClaimsRecordsResponse.decode, + service: "evmos.claims.v1.Query", + method: "ClaimsRecords" +}); +/** + * ClaimsRecord returns the claims record for a given address + * @name getClaimsRecord + * @package evmos.claims.v1 + * @see proto service: evmos.claims.v1.ClaimsRecord + */ +export const getClaimsRecord = buildQuery({ + encode: QueryClaimsRecordRequest.encode, + decode: QueryClaimsRecordResponse.decode, + service: "evmos.claims.v1.Query", + method: "ClaimsRecord" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputosmojs/evmos/epochs/v1/query.rpc.Query.ts b/__fixtures__/v-next/outputosmojs/evmos/epochs/v1/query.rpc.Query.ts index f27fd465fa..22f442a8fd 100644 --- a/__fixtures__/v-next/outputosmojs/evmos/epochs/v1/query.rpc.Query.ts +++ b/__fixtures__/v-next/outputosmojs/evmos/epochs/v1/query.rpc.Query.ts @@ -1,6 +1,6 @@ import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination"; import { EpochInfo, EpochInfoSDKType } from "./genesis"; -import { Rpc } from "../../../helpers"; +import { TxRpc } from "../../../types"; import { BinaryReader } from "../../../binary"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; import { QueryEpochsInfoRequest, QueryEpochsInfoRequestSDKType, QueryEpochsInfoResponse, QueryEpochsInfoResponseSDKType, QueryCurrentEpochRequest, QueryCurrentEpochRequestSDKType, QueryCurrentEpochResponse, QueryCurrentEpochResponseSDKType } from "./query"; @@ -12,8 +12,8 @@ export interface Query { currentEpoch(request: QueryCurrentEpochRequest): Promise; } export class QueryClientImpl implements Query { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.epochInfos = this.epochInfos.bind(this); this.currentEpoch = this.currentEpoch.bind(this); diff --git a/__fixtures__/v-next/outputosmojs/evmos/epochs/v1/query.rpc.func.ts b/__fixtures__/v-next/outputosmojs/evmos/epochs/v1/query.rpc.func.ts new file mode 100644 index 0000000000..feef14872a --- /dev/null +++ b/__fixtures__/v-next/outputosmojs/evmos/epochs/v1/query.rpc.func.ts @@ -0,0 +1,28 @@ +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination"; +import { EpochInfo, EpochInfoSDKType } from "./genesis"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { QueryEpochsInfoRequest, QueryEpochsInfoRequestSDKType, QueryEpochsInfoResponse, QueryEpochsInfoResponseSDKType, QueryCurrentEpochRequest, QueryCurrentEpochRequestSDKType, QueryCurrentEpochResponse, QueryCurrentEpochResponseSDKType } from "./query"; +/** + * EpochInfos provide running epochInfos + * @name getEpochInfos + * @package evmos.epochs.v1 + * @see proto service: evmos.epochs.v1.EpochInfos + */ +export const getEpochInfos = buildQuery({ + encode: QueryEpochsInfoRequest.encode, + decode: QueryEpochsInfoResponse.decode, + service: "evmos.epochs.v1.Query", + method: "EpochInfos" +}); +/** + * CurrentEpoch provide current epoch of specified identifier + * @name getCurrentEpoch + * @package evmos.epochs.v1 + * @see proto service: evmos.epochs.v1.CurrentEpoch + */ +export const getCurrentEpoch = buildQuery({ + encode: QueryCurrentEpochRequest.encode, + decode: QueryCurrentEpochResponse.decode, + service: "evmos.epochs.v1.Query", + method: "CurrentEpoch" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputosmojs/evmos/erc20/v1/query.rpc.Query.ts b/__fixtures__/v-next/outputosmojs/evmos/erc20/v1/query.rpc.Query.ts index 25ecdc22d3..2807f12bce 100644 --- a/__fixtures__/v-next/outputosmojs/evmos/erc20/v1/query.rpc.Query.ts +++ b/__fixtures__/v-next/outputosmojs/evmos/erc20/v1/query.rpc.Query.ts @@ -1,7 +1,7 @@ import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination"; import { TokenPair, TokenPairSDKType } from "./erc20"; import { Params, ParamsSDKType } from "./genesis"; -import { Rpc } from "../../../helpers"; +import { TxRpc } from "../../../types"; import { BinaryReader } from "../../../binary"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; import { QueryTokenPairsRequest, QueryTokenPairsRequestSDKType, QueryTokenPairsResponse, QueryTokenPairsResponseSDKType, QueryTokenPairRequest, QueryTokenPairRequestSDKType, QueryTokenPairResponse, QueryTokenPairResponseSDKType, QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType } from "./query"; @@ -15,8 +15,8 @@ export interface Query { params(request?: QueryParamsRequest): Promise; } export class QueryClientImpl implements Query { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.tokenPairs = this.tokenPairs.bind(this); this.tokenPair = this.tokenPair.bind(this); diff --git a/__fixtures__/v-next/outputosmojs/evmos/erc20/v1/query.rpc.func.ts b/__fixtures__/v-next/outputosmojs/evmos/erc20/v1/query.rpc.func.ts new file mode 100644 index 0000000000..e2c4310faa --- /dev/null +++ b/__fixtures__/v-next/outputosmojs/evmos/erc20/v1/query.rpc.func.ts @@ -0,0 +1,41 @@ +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination"; +import { TokenPair, TokenPairSDKType } from "./erc20"; +import { Params, ParamsSDKType } from "./genesis"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { QueryTokenPairsRequest, QueryTokenPairsRequestSDKType, QueryTokenPairsResponse, QueryTokenPairsResponseSDKType, QueryTokenPairRequest, QueryTokenPairRequestSDKType, QueryTokenPairResponse, QueryTokenPairResponseSDKType, QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType } from "./query"; +/** + * TokenPairs retrieves registered token pairs + * @name getTokenPairs + * @package evmos.erc20.v1 + * @see proto service: evmos.erc20.v1.TokenPairs + */ +export const getTokenPairs = buildQuery({ + encode: QueryTokenPairsRequest.encode, + decode: QueryTokenPairsResponse.decode, + service: "evmos.erc20.v1.Query", + method: "TokenPairs" +}); +/** + * TokenPair retrieves a registered token pair + * @name getTokenPair + * @package evmos.erc20.v1 + * @see proto service: evmos.erc20.v1.TokenPair + */ +export const getTokenPair = buildQuery({ + encode: QueryTokenPairRequest.encode, + decode: QueryTokenPairResponse.decode, + service: "evmos.erc20.v1.Query", + method: "TokenPair" +}); +/** + * Params retrieves the erc20 module params + * @name getParams + * @package evmos.erc20.v1 + * @see proto service: evmos.erc20.v1.Params + */ +export const getParams = buildQuery({ + encode: QueryParamsRequest.encode, + decode: QueryParamsResponse.decode, + service: "evmos.erc20.v1.Query", + method: "Params" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputosmojs/evmos/erc20/v1/tx.registry.ts b/__fixtures__/v-next/outputosmojs/evmos/erc20/v1/tx.registry.ts index bc1f20222b..ee32b10c6c 100644 --- a/__fixtures__/v-next/outputosmojs/evmos/erc20/v1/tx.registry.ts +++ b/__fixtures__/v-next/outputosmojs/evmos/erc20/v1/tx.registry.ts @@ -1,12 +1,7 @@ import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; -import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { TelescopeGeneratedType } from "../../../types"; import { MsgConvertCoin, MsgConvertCoinSDKType, MsgConvertERC20, MsgConvertERC20SDKType } from "./tx"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/evmos.erc20.v1.MsgConvertCoin", MsgConvertCoin], ["/evmos.erc20.v1.MsgConvertERC20", MsgConvertERC20]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/evmos.erc20.v1.MsgConvertCoin", MsgConvertCoin], ["/evmos.erc20.v1.MsgConvertERC20", MsgConvertERC20]]; export const MessageComposer = { encoded: { convertCoin(value: MsgConvertCoin) { diff --git a/__fixtures__/v-next/outputosmojs/evmos/erc20/v1/tx.rpc.func.ts b/__fixtures__/v-next/outputosmojs/evmos/erc20/v1/tx.rpc.func.ts new file mode 100644 index 0000000000..98c71c793d --- /dev/null +++ b/__fixtures__/v-next/outputosmojs/evmos/erc20/v1/tx.rpc.func.ts @@ -0,0 +1,23 @@ +import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; +import { buildTx } from "../../../helper-func-types"; +import { MsgConvertCoin, MsgConvertCoinSDKType, MsgConvertCoinResponse, MsgConvertCoinResponseSDKType, MsgConvertERC20, MsgConvertERC20SDKType, MsgConvertERC20Response, MsgConvertERC20ResponseSDKType } from "./tx"; +/** + * ConvertCoin mints a ERC20 representation of the native Cosmos coin denom + * that is registered on the token mapping. + * @name convertCoin + * @package evmos.erc20.v1 + * @see proto service: evmos.erc20.v1.ConvertCoin + */ +export const convertCoin = buildTx({ + msg: MsgConvertCoin +}); +/** + * ConvertERC20 mints a native Cosmos coin representation of the ERC20 token + * contract that is registered on the token mapping. + * @name convertERC20 + * @package evmos.erc20.v1 + * @see proto service: evmos.erc20.v1.ConvertERC20 + */ +export const convertERC20 = buildTx({ + msg: MsgConvertERC20 +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputosmojs/evmos/erc20/v1/tx.rpc.msg.ts b/__fixtures__/v-next/outputosmojs/evmos/erc20/v1/tx.rpc.msg.ts index 63e3041b30..9d1c6f684e 100644 --- a/__fixtures__/v-next/outputosmojs/evmos/erc20/v1/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputosmojs/evmos/erc20/v1/tx.rpc.msg.ts @@ -1,5 +1,5 @@ import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; -import { Rpc } from "../../../helpers"; +import { TxRpc } from "../../../types"; import { BinaryReader } from "../../../binary"; import { MsgConvertCoin, MsgConvertCoinSDKType, MsgConvertCoinResponse, MsgConvertCoinResponseSDKType, MsgConvertERC20, MsgConvertERC20SDKType, MsgConvertERC20Response, MsgConvertERC20ResponseSDKType } from "./tx"; /** Msg defines the erc20 Msg service. */ @@ -16,8 +16,8 @@ export interface Msg { convertERC20(request: MsgConvertERC20): Promise; } export class MsgClientImpl implements Msg { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.convertCoin = this.convertCoin.bind(this); this.convertERC20 = this.convertERC20.bind(this); @@ -33,6 +33,6 @@ export class MsgClientImpl implements Msg { return promise.then(data => MsgConvertERC20Response.decode(new BinaryReader(data))); } } -export const createClientImpl = (rpc: Rpc) => { +export const createClientImpl = (rpc: TxRpc) => { return new MsgClientImpl(rpc); }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputosmojs/evmos/fees/v1/genesis.ts b/__fixtures__/v-next/outputosmojs/evmos/fees/v1/genesis.ts index f42d8d916b..a9c5c8eebe 100644 --- a/__fixtures__/v-next/outputosmojs/evmos/fees/v1/genesis.ts +++ b/__fixtures__/v-next/outputosmojs/evmos/fees/v1/genesis.ts @@ -2,7 +2,7 @@ import { DevFeeInfo, DevFeeInfoSDKType } from "./fees"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { isSet, DeepPartial } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; -import { Decimal } from "@cosmjs/math"; +import { Decimal } from "@interchainjs/math"; export const protobufPackage = "evmos.fees.v1"; /** * GenesisState defines the module's genesis state. @@ -343,10 +343,10 @@ export const Params = { toAmino(message: Params): ParamsAmino { const obj: any = {}; obj.enable_fees = message.enableFees === false ? undefined : message.enableFees; - obj.developer_shares = message.developerShares === "" ? undefined : message.developerShares; - obj.validator_shares = message.validatorShares === "" ? undefined : message.validatorShares; + obj.developer_shares = message.developerShares === "" ? undefined : Decimal.fromUserInput(message.developerShares, 18).atomics; + obj.validator_shares = message.validatorShares === "" ? undefined : Decimal.fromUserInput(message.validatorShares, 18).atomics; obj.addr_derivation_cost_create = message.addrDerivationCostCreate !== BigInt(0) ? message.addrDerivationCostCreate?.toString() : undefined; - obj.min_gas_price = message.minGasPrice === "" ? undefined : message.minGasPrice; + obj.min_gas_price = message.minGasPrice === "" ? undefined : Decimal.fromUserInput(message.minGasPrice, 18).atomics; return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputosmojs/evmos/fees/v1/query.rpc.Query.ts b/__fixtures__/v-next/outputosmojs/evmos/fees/v1/query.rpc.Query.ts index d0c8bb5e61..313e98db45 100644 --- a/__fixtures__/v-next/outputosmojs/evmos/fees/v1/query.rpc.Query.ts +++ b/__fixtures__/v-next/outputosmojs/evmos/fees/v1/query.rpc.Query.ts @@ -1,7 +1,7 @@ import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination"; import { DevFeeInfo, DevFeeInfoSDKType } from "./fees"; import { Params, ParamsSDKType } from "./genesis"; -import { Rpc } from "../../../helpers"; +import { TxRpc } from "../../../types"; import { BinaryReader } from "../../../binary"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; import { QueryDevFeeInfosRequest, QueryDevFeeInfosRequestSDKType, QueryDevFeeInfosResponse, QueryDevFeeInfosResponseSDKType, QueryDevFeeInfoRequest, QueryDevFeeInfoRequestSDKType, QueryDevFeeInfoResponse, QueryDevFeeInfoResponseSDKType, QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, QueryDevFeeInfosPerDeployerRequest, QueryDevFeeInfosPerDeployerRequestSDKType, QueryDevFeeInfosPerDeployerResponse, QueryDevFeeInfosPerDeployerResponseSDKType } from "./query"; @@ -20,8 +20,8 @@ export interface Query { devFeeInfosPerDeployer(request: QueryDevFeeInfosPerDeployerRequest): Promise; } export class QueryClientImpl implements Query { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.devFeeInfos = this.devFeeInfos.bind(this); this.devFeeInfo = this.devFeeInfo.bind(this); diff --git a/__fixtures__/v-next/outputosmojs/evmos/fees/v1/query.rpc.func.ts b/__fixtures__/v-next/outputosmojs/evmos/fees/v1/query.rpc.func.ts new file mode 100644 index 0000000000..bfa56fcc9d --- /dev/null +++ b/__fixtures__/v-next/outputosmojs/evmos/fees/v1/query.rpc.func.ts @@ -0,0 +1,54 @@ +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination"; +import { DevFeeInfo, DevFeeInfoSDKType } from "./fees"; +import { Params, ParamsSDKType } from "./genesis"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { QueryDevFeeInfosRequest, QueryDevFeeInfosRequestSDKType, QueryDevFeeInfosResponse, QueryDevFeeInfosResponseSDKType, QueryDevFeeInfoRequest, QueryDevFeeInfoRequestSDKType, QueryDevFeeInfoResponse, QueryDevFeeInfoResponseSDKType, QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, QueryDevFeeInfosPerDeployerRequest, QueryDevFeeInfosPerDeployerRequestSDKType, QueryDevFeeInfosPerDeployerResponse, QueryDevFeeInfosPerDeployerResponseSDKType } from "./query"; +/** + * DevFeeInfos retrieves all registered contracts for fee distribution + * @name getDevFeeInfos + * @package evmos.fees.v1 + * @see proto service: evmos.fees.v1.DevFeeInfos + */ +export const getDevFeeInfos = buildQuery({ + encode: QueryDevFeeInfosRequest.encode, + decode: QueryDevFeeInfosResponse.decode, + service: "evmos.fees.v1.Query", + method: "DevFeeInfos" +}); +/** + * DevFeeInfo retrieves a registered contract for fee distribution + * @name getDevFeeInfo + * @package evmos.fees.v1 + * @see proto service: evmos.fees.v1.DevFeeInfo + */ +export const getDevFeeInfo = buildQuery({ + encode: QueryDevFeeInfoRequest.encode, + decode: QueryDevFeeInfoResponse.decode, + service: "evmos.fees.v1.Query", + method: "DevFeeInfo" +}); +/** + * Params retrieves the fees module params + * @name getParams + * @package evmos.fees.v1 + * @see proto service: evmos.fees.v1.Params + */ +export const getParams = buildQuery({ + encode: QueryParamsRequest.encode, + decode: QueryParamsResponse.decode, + service: "evmos.fees.v1.Query", + method: "Params" +}); +/** + * DevFeeInfosPerDeployer retrieves all contracts that a deployer has + * registered for fee distribution + * @name getDevFeeInfosPerDeployer + * @package evmos.fees.v1 + * @see proto service: evmos.fees.v1.DevFeeInfosPerDeployer + */ +export const getDevFeeInfosPerDeployer = buildQuery({ + encode: QueryDevFeeInfosPerDeployerRequest.encode, + decode: QueryDevFeeInfosPerDeployerResponse.decode, + service: "evmos.fees.v1.Query", + method: "DevFeeInfosPerDeployer" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputosmojs/evmos/fees/v1/tx.registry.ts b/__fixtures__/v-next/outputosmojs/evmos/fees/v1/tx.registry.ts index fc2890b2d6..92fecb8eb3 100644 --- a/__fixtures__/v-next/outputosmojs/evmos/fees/v1/tx.registry.ts +++ b/__fixtures__/v-next/outputosmojs/evmos/fees/v1/tx.registry.ts @@ -1,11 +1,6 @@ -import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { TelescopeGeneratedType } from "../../../types"; import { MsgRegisterDevFeeInfo, MsgRegisterDevFeeInfoSDKType, MsgCancelDevFeeInfo, MsgCancelDevFeeInfoSDKType, MsgUpdateDevFeeInfo, MsgUpdateDevFeeInfoSDKType } from "./tx"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/evmos.fees.v1.MsgRegisterDevFeeInfo", MsgRegisterDevFeeInfo], ["/evmos.fees.v1.MsgCancelDevFeeInfo", MsgCancelDevFeeInfo], ["/evmos.fees.v1.MsgUpdateDevFeeInfo", MsgUpdateDevFeeInfo]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/evmos.fees.v1.MsgRegisterDevFeeInfo", MsgRegisterDevFeeInfo], ["/evmos.fees.v1.MsgCancelDevFeeInfo", MsgCancelDevFeeInfo], ["/evmos.fees.v1.MsgUpdateDevFeeInfo", MsgUpdateDevFeeInfo]]; export const MessageComposer = { encoded: { registerDevFeeInfo(value: MsgRegisterDevFeeInfo) { diff --git a/__fixtures__/v-next/outputosmojs/evmos/fees/v1/tx.rpc.func.ts b/__fixtures__/v-next/outputosmojs/evmos/fees/v1/tx.rpc.func.ts new file mode 100644 index 0000000000..150928bee9 --- /dev/null +++ b/__fixtures__/v-next/outputosmojs/evmos/fees/v1/tx.rpc.func.ts @@ -0,0 +1,31 @@ +import { buildTx } from "../../../helper-func-types"; +import { MsgRegisterDevFeeInfo, MsgRegisterDevFeeInfoSDKType, MsgRegisterDevFeeInfoResponse, MsgRegisterDevFeeInfoResponseSDKType, MsgCancelDevFeeInfo, MsgCancelDevFeeInfoSDKType, MsgCancelDevFeeInfoResponse, MsgCancelDevFeeInfoResponseSDKType, MsgUpdateDevFeeInfo, MsgUpdateDevFeeInfoSDKType, MsgUpdateDevFeeInfoResponse, MsgUpdateDevFeeInfoResponseSDKType } from "./tx"; +/** + * RegisterDevFeeInfo is used by a deployer to register a new contract for + * receiving transaction fees + * @name registerDevFeeInfo + * @package evmos.fees.v1 + * @see proto service: evmos.fees.v1.RegisterDevFeeInfo + */ +export const registerDevFeeInfo = buildTx({ + msg: MsgRegisterDevFeeInfo +}); +/** + * CancelDevFeeInfo is used by a deployer to cancel a registered contract + * and stop receiving transaction fees + * @name cancelDevFeeInfo + * @package evmos.fees.v1 + * @see proto service: evmos.fees.v1.CancelDevFeeInfo + */ +export const cancelDevFeeInfo = buildTx({ + msg: MsgCancelDevFeeInfo +}); +/** + * UpdateDevFeeInfo is used by a deployer to update the withdraw address + * @name updateDevFeeInfo + * @package evmos.fees.v1 + * @see proto service: evmos.fees.v1.UpdateDevFeeInfo + */ +export const updateDevFeeInfo = buildTx({ + msg: MsgUpdateDevFeeInfo +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputosmojs/evmos/fees/v1/tx.rpc.msg.ts b/__fixtures__/v-next/outputosmojs/evmos/fees/v1/tx.rpc.msg.ts index d5c4b6ff41..d9a9fccfba 100644 --- a/__fixtures__/v-next/outputosmojs/evmos/fees/v1/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputosmojs/evmos/fees/v1/tx.rpc.msg.ts @@ -1,4 +1,4 @@ -import { Rpc } from "../../../helpers"; +import { TxRpc } from "../../../types"; import { BinaryReader } from "../../../binary"; import { MsgRegisterDevFeeInfo, MsgRegisterDevFeeInfoSDKType, MsgRegisterDevFeeInfoResponse, MsgRegisterDevFeeInfoResponseSDKType, MsgCancelDevFeeInfo, MsgCancelDevFeeInfoSDKType, MsgCancelDevFeeInfoResponse, MsgCancelDevFeeInfoResponseSDKType, MsgUpdateDevFeeInfo, MsgUpdateDevFeeInfoSDKType, MsgUpdateDevFeeInfoResponse, MsgUpdateDevFeeInfoResponseSDKType } from "./tx"; /** Msg defines the fees Msg service. */ @@ -17,8 +17,8 @@ export interface Msg { updateDevFeeInfo(request: MsgUpdateDevFeeInfo): Promise; } export class MsgClientImpl implements Msg { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.registerDevFeeInfo = this.registerDevFeeInfo.bind(this); this.cancelDevFeeInfo = this.cancelDevFeeInfo.bind(this); @@ -40,6 +40,6 @@ export class MsgClientImpl implements Msg { return promise.then(data => MsgUpdateDevFeeInfoResponse.decode(new BinaryReader(data))); } } -export const createClientImpl = (rpc: Rpc) => { +export const createClientImpl = (rpc: TxRpc) => { return new MsgClientImpl(rpc); }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputosmojs/evmos/incentives/v1/genesis.ts b/__fixtures__/v-next/outputosmojs/evmos/incentives/v1/genesis.ts index eb082e29d9..0e168fcafe 100644 --- a/__fixtures__/v-next/outputosmojs/evmos/incentives/v1/genesis.ts +++ b/__fixtures__/v-next/outputosmojs/evmos/incentives/v1/genesis.ts @@ -2,7 +2,7 @@ import { Incentive, IncentiveSDKType, GasMeter, GasMeterSDKType } from "./incent import { BinaryReader, BinaryWriter } from "../../../binary"; import { isSet, DeepPartial } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; -import { Decimal } from "@cosmjs/math"; +import { Decimal } from "@interchainjs/math"; export const protobufPackage = "evmos.incentives.v1"; /** * GenesisState defines the module's genesis state. @@ -351,9 +351,9 @@ export const Params = { toAmino(message: Params): ParamsAmino { const obj: any = {}; obj.enable_incentives = message.enableIncentives === false ? undefined : message.enableIncentives; - obj.allocation_limit = message.allocationLimit === "" ? undefined : message.allocationLimit; + obj.allocation_limit = message.allocationLimit === "" ? undefined : Decimal.fromUserInput(message.allocationLimit, 18).atomics; obj.incentives_epoch_identifier = message.incentivesEpochIdentifier === "" ? undefined : message.incentivesEpochIdentifier; - obj.reward_scaler = message.rewardScaler === "" ? undefined : message.rewardScaler; + obj.reward_scaler = message.rewardScaler === "" ? undefined : Decimal.fromUserInput(message.rewardScaler, 18).atomics; return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputosmojs/evmos/incentives/v1/query.rpc.Query.ts b/__fixtures__/v-next/outputosmojs/evmos/incentives/v1/query.rpc.Query.ts index 42fcb09a22..4160679c1b 100644 --- a/__fixtures__/v-next/outputosmojs/evmos/incentives/v1/query.rpc.Query.ts +++ b/__fixtures__/v-next/outputosmojs/evmos/incentives/v1/query.rpc.Query.ts @@ -2,7 +2,7 @@ import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } fr import { Incentive, IncentiveSDKType, GasMeter, GasMeterSDKType } from "./incentives"; import { DecCoin, DecCoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { Params, ParamsSDKType } from "./genesis"; -import { Rpc } from "../../../helpers"; +import { TxRpc } from "../../../types"; import { BinaryReader } from "../../../binary"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; import { QueryIncentivesRequest, QueryIncentivesRequestSDKType, QueryIncentivesResponse, QueryIncentivesResponseSDKType, QueryIncentiveRequest, QueryIncentiveRequestSDKType, QueryIncentiveResponse, QueryIncentiveResponseSDKType, QueryGasMetersRequest, QueryGasMetersRequestSDKType, QueryGasMetersResponse, QueryGasMetersResponseSDKType, QueryGasMeterRequest, QueryGasMeterRequestSDKType, QueryGasMeterResponse, QueryGasMeterResponseSDKType, QueryAllocationMetersRequest, QueryAllocationMetersRequestSDKType, QueryAllocationMetersResponse, QueryAllocationMetersResponseSDKType, QueryAllocationMeterRequest, QueryAllocationMeterRequestSDKType, QueryAllocationMeterResponse, QueryAllocationMeterResponseSDKType, QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType } from "./query"; @@ -27,8 +27,8 @@ export interface Query { params(request?: QueryParamsRequest): Promise; } export class QueryClientImpl implements Query { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.incentives = this.incentives.bind(this); this.incentive = this.incentive.bind(this); diff --git a/__fixtures__/v-next/outputosmojs/evmos/incentives/v1/query.rpc.func.ts b/__fixtures__/v-next/outputosmojs/evmos/incentives/v1/query.rpc.func.ts new file mode 100644 index 0000000000..1321096062 --- /dev/null +++ b/__fixtures__/v-next/outputosmojs/evmos/incentives/v1/query.rpc.func.ts @@ -0,0 +1,91 @@ +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination"; +import { Incentive, IncentiveSDKType, GasMeter, GasMeterSDKType } from "./incentives"; +import { DecCoin, DecCoinSDKType } from "../../../cosmos/base/v1beta1/coin"; +import { Params, ParamsSDKType } from "./genesis"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { QueryIncentivesRequest, QueryIncentivesRequestSDKType, QueryIncentivesResponse, QueryIncentivesResponseSDKType, QueryIncentiveRequest, QueryIncentiveRequestSDKType, QueryIncentiveResponse, QueryIncentiveResponseSDKType, QueryGasMetersRequest, QueryGasMetersRequestSDKType, QueryGasMetersResponse, QueryGasMetersResponseSDKType, QueryGasMeterRequest, QueryGasMeterRequestSDKType, QueryGasMeterResponse, QueryGasMeterResponseSDKType, QueryAllocationMetersRequest, QueryAllocationMetersRequestSDKType, QueryAllocationMetersResponse, QueryAllocationMetersResponseSDKType, QueryAllocationMeterRequest, QueryAllocationMeterRequestSDKType, QueryAllocationMeterResponse, QueryAllocationMeterResponseSDKType, QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType } from "./query"; +/** + * Incentives retrieves registered incentives + * @name getIncentives + * @package evmos.incentives.v1 + * @see proto service: evmos.incentives.v1.Incentives + */ +export const getIncentives = buildQuery({ + encode: QueryIncentivesRequest.encode, + decode: QueryIncentivesResponse.decode, + service: "evmos.incentives.v1.Query", + method: "Incentives" +}); +/** + * Incentive retrieves a registered incentive + * @name getIncentive + * @package evmos.incentives.v1 + * @see proto service: evmos.incentives.v1.Incentive + */ +export const getIncentive = buildQuery({ + encode: QueryIncentiveRequest.encode, + decode: QueryIncentiveResponse.decode, + service: "evmos.incentives.v1.Query", + method: "Incentive" +}); +/** + * GasMeters retrieves active gas meters for a given contract + * @name getGasMeters + * @package evmos.incentives.v1 + * @see proto service: evmos.incentives.v1.GasMeters + */ +export const getGasMeters = buildQuery({ + encode: QueryGasMetersRequest.encode, + decode: QueryGasMetersResponse.decode, + service: "evmos.incentives.v1.Query", + method: "GasMeters" +}); +/** + * GasMeter Retrieves a active gas meter + * @name getGasMeter + * @package evmos.incentives.v1 + * @see proto service: evmos.incentives.v1.GasMeter + */ +export const getGasMeter = buildQuery({ + encode: QueryGasMeterRequest.encode, + decode: QueryGasMeterResponse.decode, + service: "evmos.incentives.v1.Query", + method: "GasMeter" +}); +/** + * AllocationMeters retrieves active allocation meters for a given + * denomination + * @name getAllocationMeters + * @package evmos.incentives.v1 + * @see proto service: evmos.incentives.v1.AllocationMeters + */ +export const getAllocationMeters = buildQuery({ + encode: QueryAllocationMetersRequest.encode, + decode: QueryAllocationMetersResponse.decode, + service: "evmos.incentives.v1.Query", + method: "AllocationMeters" +}); +/** + * AllocationMeter Retrieves a active gas meter + * @name getAllocationMeter + * @package evmos.incentives.v1 + * @see proto service: evmos.incentives.v1.AllocationMeter + */ +export const getAllocationMeter = buildQuery({ + encode: QueryAllocationMeterRequest.encode, + decode: QueryAllocationMeterResponse.decode, + service: "evmos.incentives.v1.Query", + method: "AllocationMeter" +}); +/** + * Params retrieves the incentives module params + * @name getParams + * @package evmos.incentives.v1 + * @see proto service: evmos.incentives.v1.Params + */ +export const getParams = buildQuery({ + encode: QueryParamsRequest.encode, + decode: QueryParamsResponse.decode, + service: "evmos.incentives.v1.Query", + method: "Params" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputosmojs/evmos/inflation/v1/inflation.ts b/__fixtures__/v-next/outputosmojs/evmos/inflation/v1/inflation.ts index 83e035e8e8..27d67651e6 100644 --- a/__fixtures__/v-next/outputosmojs/evmos/inflation/v1/inflation.ts +++ b/__fixtures__/v-next/outputosmojs/evmos/inflation/v1/inflation.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { Decimal } from "@cosmjs/math"; +import { Decimal } from "@interchainjs/math"; import { isSet, DeepPartial } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "evmos.inflation.v1"; @@ -219,9 +219,9 @@ export const InflationDistribution = { }, toAmino(message: InflationDistribution): InflationDistributionAmino { const obj: any = {}; - obj.staking_rewards = message.stakingRewards === "" ? undefined : message.stakingRewards; - obj.usage_incentives = message.usageIncentives === "" ? undefined : message.usageIncentives; - obj.community_pool = message.communityPool === "" ? undefined : message.communityPool; + obj.staking_rewards = message.stakingRewards === "" ? undefined : Decimal.fromUserInput(message.stakingRewards, 18).atomics; + obj.usage_incentives = message.usageIncentives === "" ? undefined : Decimal.fromUserInput(message.usageIncentives, 18).atomics; + obj.community_pool = message.communityPool === "" ? undefined : Decimal.fromUserInput(message.communityPool, 18).atomics; return obj; }, fromAminoMsg(object: InflationDistributionAminoMsg): InflationDistribution { @@ -383,11 +383,11 @@ export const ExponentialCalculation = { }, toAmino(message: ExponentialCalculation): ExponentialCalculationAmino { const obj: any = {}; - obj.a = message.a === "" ? undefined : message.a; - obj.r = message.r === "" ? undefined : message.r; - obj.c = message.c === "" ? undefined : message.c; - obj.bonding_target = message.bondingTarget === "" ? undefined : message.bondingTarget; - obj.max_variance = message.maxVariance === "" ? undefined : message.maxVariance; + obj.a = message.a === "" ? undefined : Decimal.fromUserInput(message.a, 18).atomics; + obj.r = message.r === "" ? undefined : Decimal.fromUserInput(message.r, 18).atomics; + obj.c = message.c === "" ? undefined : Decimal.fromUserInput(message.c, 18).atomics; + obj.bonding_target = message.bondingTarget === "" ? undefined : Decimal.fromUserInput(message.bondingTarget, 18).atomics; + obj.max_variance = message.maxVariance === "" ? undefined : Decimal.fromUserInput(message.maxVariance, 18).atomics; return obj; }, fromAminoMsg(object: ExponentialCalculationAminoMsg): ExponentialCalculation { diff --git a/__fixtures__/v-next/outputosmojs/evmos/inflation/v1/query.rpc.Query.ts b/__fixtures__/v-next/outputosmojs/evmos/inflation/v1/query.rpc.Query.ts index 833c815af6..1110cf3029 100644 --- a/__fixtures__/v-next/outputosmojs/evmos/inflation/v1/query.rpc.Query.ts +++ b/__fixtures__/v-next/outputosmojs/evmos/inflation/v1/query.rpc.Query.ts @@ -1,6 +1,6 @@ import { DecCoin, DecCoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { Params, ParamsSDKType } from "./genesis"; -import { Rpc } from "../../../helpers"; +import { TxRpc } from "../../../types"; import { BinaryReader } from "../../../binary"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; import { QueryPeriodRequest, QueryPeriodRequestSDKType, QueryPeriodResponse, QueryPeriodResponseSDKType, QueryEpochMintProvisionRequest, QueryEpochMintProvisionRequestSDKType, QueryEpochMintProvisionResponse, QueryEpochMintProvisionResponseSDKType, QuerySkippedEpochsRequest, QuerySkippedEpochsRequestSDKType, QuerySkippedEpochsResponse, QuerySkippedEpochsResponseSDKType, QueryCirculatingSupplyRequest, QueryCirculatingSupplyRequestSDKType, QueryCirculatingSupplyResponse, QueryCirculatingSupplyResponseSDKType, QueryInflationRateRequest, QueryInflationRateRequestSDKType, QueryInflationRateResponse, QueryInflationRateResponseSDKType, QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType } from "./query"; @@ -23,8 +23,8 @@ export interface Query { params(request?: QueryParamsRequest): Promise; } export class QueryClientImpl implements Query { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.period = this.period.bind(this); this.epochMintProvision = this.epochMintProvision.bind(this); diff --git a/__fixtures__/v-next/outputosmojs/evmos/inflation/v1/query.rpc.func.ts b/__fixtures__/v-next/outputosmojs/evmos/inflation/v1/query.rpc.func.ts new file mode 100644 index 0000000000..151eefa68d --- /dev/null +++ b/__fixtures__/v-next/outputosmojs/evmos/inflation/v1/query.rpc.func.ts @@ -0,0 +1,77 @@ +import { DecCoin, DecCoinSDKType } from "../../../cosmos/base/v1beta1/coin"; +import { Params, ParamsSDKType } from "./genesis"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { QueryPeriodRequest, QueryPeriodRequestSDKType, QueryPeriodResponse, QueryPeriodResponseSDKType, QueryEpochMintProvisionRequest, QueryEpochMintProvisionRequestSDKType, QueryEpochMintProvisionResponse, QueryEpochMintProvisionResponseSDKType, QuerySkippedEpochsRequest, QuerySkippedEpochsRequestSDKType, QuerySkippedEpochsResponse, QuerySkippedEpochsResponseSDKType, QueryCirculatingSupplyRequest, QueryCirculatingSupplyRequestSDKType, QueryCirculatingSupplyResponse, QueryCirculatingSupplyResponseSDKType, QueryInflationRateRequest, QueryInflationRateRequestSDKType, QueryInflationRateResponse, QueryInflationRateResponseSDKType, QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType } from "./query"; +/** + * Period retrieves current period. + * @name getPeriod + * @package evmos.inflation.v1 + * @see proto service: evmos.inflation.v1.Period + */ +export const getPeriod = buildQuery({ + encode: QueryPeriodRequest.encode, + decode: QueryPeriodResponse.decode, + service: "evmos.inflation.v1.Query", + method: "Period" +}); +/** + * EpochMintProvision retrieves current minting epoch provision value. + * @name getEpochMintProvision + * @package evmos.inflation.v1 + * @see proto service: evmos.inflation.v1.EpochMintProvision + */ +export const getEpochMintProvision = buildQuery({ + encode: QueryEpochMintProvisionRequest.encode, + decode: QueryEpochMintProvisionResponse.decode, + service: "evmos.inflation.v1.Query", + method: "EpochMintProvision" +}); +/** + * SkippedEpochs retrieves the total number of skipped epochs. + * @name getSkippedEpochs + * @package evmos.inflation.v1 + * @see proto service: evmos.inflation.v1.SkippedEpochs + */ +export const getSkippedEpochs = buildQuery({ + encode: QuerySkippedEpochsRequest.encode, + decode: QuerySkippedEpochsResponse.decode, + service: "evmos.inflation.v1.Query", + method: "SkippedEpochs" +}); +/** + * CirculatingSupply retrieves the total number of tokens that are in + * circulation (i.e. excluding unvested tokens). + * @name getCirculatingSupply + * @package evmos.inflation.v1 + * @see proto service: evmos.inflation.v1.CirculatingSupply + */ +export const getCirculatingSupply = buildQuery({ + encode: QueryCirculatingSupplyRequest.encode, + decode: QueryCirculatingSupplyResponse.decode, + service: "evmos.inflation.v1.Query", + method: "CirculatingSupply" +}); +/** + * InflationRate retrieves the inflation rate of the current period. + * @name getInflationRate + * @package evmos.inflation.v1 + * @see proto service: evmos.inflation.v1.InflationRate + */ +export const getInflationRate = buildQuery({ + encode: QueryInflationRateRequest.encode, + decode: QueryInflationRateResponse.decode, + service: "evmos.inflation.v1.Query", + method: "InflationRate" +}); +/** + * Params retrieves the total set of minting parameters. + * @name getParams + * @package evmos.inflation.v1 + * @see proto service: evmos.inflation.v1.Params + */ +export const getParams = buildQuery({ + encode: QueryParamsRequest.encode, + decode: QueryParamsResponse.decode, + service: "evmos.inflation.v1.Query", + method: "Params" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputosmojs/evmos/inflation/v1/query.ts b/__fixtures__/v-next/outputosmojs/evmos/inflation/v1/query.ts index ee3f74a627..9a949f9e10 100644 --- a/__fixtures__/v-next/outputosmojs/evmos/inflation/v1/query.ts +++ b/__fixtures__/v-next/outputosmojs/evmos/inflation/v1/query.ts @@ -3,7 +3,7 @@ import { Params, ParamsSDKType } from "./genesis"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { JsonSafe } from "../../../json-safe"; import { DeepPartial, isSet } from "../../../helpers"; -import { Decimal } from "@cosmjs/math"; +import { Decimal } from "@interchainjs/math"; export const protobufPackage = "evmos.inflation.v1"; /** * QueryPeriodRequest is the request type for the Query/Period RPC method. @@ -1103,7 +1103,7 @@ export const QueryInflationRateResponse = { }, toAmino(message: QueryInflationRateResponse): QueryInflationRateResponseAmino { const obj: any = {}; - obj.inflation_rate = message.inflationRate === "" ? undefined : message.inflationRate; + obj.inflation_rate = message.inflationRate === "" ? undefined : Decimal.fromUserInput(message.inflationRate, 18).atomics; return obj; }, fromAminoMsg(object: QueryInflationRateResponseAminoMsg): QueryInflationRateResponse { diff --git a/__fixtures__/v-next/outputosmojs/evmos/recovery/v1/query.rpc.Query.ts b/__fixtures__/v-next/outputosmojs/evmos/recovery/v1/query.rpc.Query.ts index ce6f2f0c8b..33f42fff99 100644 --- a/__fixtures__/v-next/outputosmojs/evmos/recovery/v1/query.rpc.Query.ts +++ b/__fixtures__/v-next/outputosmojs/evmos/recovery/v1/query.rpc.Query.ts @@ -1,5 +1,5 @@ import { Params, ParamsSDKType } from "./genesis"; -import { Rpc } from "../../../helpers"; +import { TxRpc } from "../../../types"; import { BinaryReader } from "../../../binary"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; import { QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType } from "./query"; @@ -9,8 +9,8 @@ export interface Query { params(request?: QueryParamsRequest): Promise; } export class QueryClientImpl implements Query { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.params = this.params.bind(this); } diff --git a/__fixtures__/v-next/outputosmojs/evmos/recovery/v1/query.rpc.func.ts b/__fixtures__/v-next/outputosmojs/evmos/recovery/v1/query.rpc.func.ts new file mode 100644 index 0000000000..5403b6c737 --- /dev/null +++ b/__fixtures__/v-next/outputosmojs/evmos/recovery/v1/query.rpc.func.ts @@ -0,0 +1,15 @@ +import { Params, ParamsSDKType } from "./genesis"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType } from "./query"; +/** + * Params retrieves the total set of recovery parameters. + * @name getParams + * @package evmos.recovery.v1 + * @see proto service: evmos.recovery.v1.Params + */ +export const getParams = buildQuery({ + encode: QueryParamsRequest.encode, + decode: QueryParamsResponse.decode, + service: "evmos.recovery.v1.Query", + method: "Params" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputosmojs/evmos/vesting/v1/query.rpc.Query.ts b/__fixtures__/v-next/outputosmojs/evmos/vesting/v1/query.rpc.Query.ts index 1cf75ebcc0..4c1315dd81 100644 --- a/__fixtures__/v-next/outputosmojs/evmos/vesting/v1/query.rpc.Query.ts +++ b/__fixtures__/v-next/outputosmojs/evmos/vesting/v1/query.rpc.Query.ts @@ -1,5 +1,5 @@ import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; -import { Rpc } from "../../../helpers"; +import { TxRpc } from "../../../types"; import { BinaryReader } from "../../../binary"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; import { QueryBalancesRequest, QueryBalancesRequestSDKType, QueryBalancesResponse, QueryBalancesResponseSDKType } from "./query"; @@ -9,8 +9,8 @@ export interface Query { balances(request: QueryBalancesRequest): Promise; } export class QueryClientImpl implements Query { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.balances = this.balances.bind(this); } diff --git a/__fixtures__/v-next/outputosmojs/evmos/vesting/v1/query.rpc.func.ts b/__fixtures__/v-next/outputosmojs/evmos/vesting/v1/query.rpc.func.ts new file mode 100644 index 0000000000..e60916d404 --- /dev/null +++ b/__fixtures__/v-next/outputosmojs/evmos/vesting/v1/query.rpc.func.ts @@ -0,0 +1,15 @@ +import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { QueryBalancesRequest, QueryBalancesRequestSDKType, QueryBalancesResponse, QueryBalancesResponseSDKType } from "./query"; +/** + * Retrieves the unvested, vested and locked tokens for a vesting account + * @name getBalances + * @package evmos.vesting.v1 + * @see proto service: evmos.vesting.v1.Balances + */ +export const getBalances = buildQuery({ + encode: QueryBalancesRequest.encode, + decode: QueryBalancesResponse.decode, + service: "evmos.vesting.v1.Query", + method: "Balances" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputosmojs/evmos/vesting/v1/tx.registry.ts b/__fixtures__/v-next/outputosmojs/evmos/vesting/v1/tx.registry.ts index 2336f7dc27..72ee678911 100644 --- a/__fixtures__/v-next/outputosmojs/evmos/vesting/v1/tx.registry.ts +++ b/__fixtures__/v-next/outputosmojs/evmos/vesting/v1/tx.registry.ts @@ -1,13 +1,8 @@ import { Timestamp, TimestampSDKType } from "../../../google/protobuf/timestamp"; import { Period, PeriodSDKType } from "../../../cosmos/vesting/v1beta1/vesting"; -import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { TelescopeGeneratedType } from "../../../types"; import { MsgCreateClawbackVestingAccount, MsgCreateClawbackVestingAccountSDKType, MsgClawback, MsgClawbackSDKType } from "./tx"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/evmos.vesting.v1.MsgCreateClawbackVestingAccount", MsgCreateClawbackVestingAccount], ["/evmos.vesting.v1.MsgClawback", MsgClawback]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/evmos.vesting.v1.MsgCreateClawbackVestingAccount", MsgCreateClawbackVestingAccount], ["/evmos.vesting.v1.MsgClawback", MsgClawback]]; export const MessageComposer = { encoded: { createClawbackVestingAccount(value: MsgCreateClawbackVestingAccount) { diff --git a/__fixtures__/v-next/outputosmojs/evmos/vesting/v1/tx.rpc.func.ts b/__fixtures__/v-next/outputosmojs/evmos/vesting/v1/tx.rpc.func.ts new file mode 100644 index 0000000000..a00219b97b --- /dev/null +++ b/__fixtures__/v-next/outputosmojs/evmos/vesting/v1/tx.rpc.func.ts @@ -0,0 +1,23 @@ +import { Timestamp, TimestampSDKType } from "../../../google/protobuf/timestamp"; +import { Period, PeriodSDKType } from "../../../cosmos/vesting/v1beta1/vesting"; +import { buildTx } from "../../../helper-func-types"; +import { MsgCreateClawbackVestingAccount, MsgCreateClawbackVestingAccountSDKType, MsgCreateClawbackVestingAccountResponse, MsgCreateClawbackVestingAccountResponseSDKType, MsgClawback, MsgClawbackSDKType, MsgClawbackResponse, MsgClawbackResponseSDKType } from "./tx"; +/** + * CreateClawbackVestingAccount creats a vesting account that is subject to + * clawback and the configuration of vesting and lockup schedules. + * @name createClawbackVestingAccount + * @package evmos.vesting.v1 + * @see proto service: evmos.vesting.v1.CreateClawbackVestingAccount + */ +export const createClawbackVestingAccount = buildTx({ + msg: MsgCreateClawbackVestingAccount +}); +/** + * Clawback removes the unvested tokens from a ClawbackVestingAccount. + * @name clawback + * @package evmos.vesting.v1 + * @see proto service: evmos.vesting.v1.Clawback + */ +export const clawback = buildTx({ + msg: MsgClawback +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputosmojs/evmos/vesting/v1/tx.rpc.msg.ts b/__fixtures__/v-next/outputosmojs/evmos/vesting/v1/tx.rpc.msg.ts index a49badd9d1..214e15aff9 100644 --- a/__fixtures__/v-next/outputosmojs/evmos/vesting/v1/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputosmojs/evmos/vesting/v1/tx.rpc.msg.ts @@ -1,6 +1,6 @@ import { Timestamp, TimestampSDKType } from "../../../google/protobuf/timestamp"; import { Period, PeriodSDKType } from "../../../cosmos/vesting/v1beta1/vesting"; -import { Rpc } from "../../../helpers"; +import { TxRpc } from "../../../types"; import { BinaryReader } from "../../../binary"; import { MsgCreateClawbackVestingAccount, MsgCreateClawbackVestingAccountSDKType, MsgCreateClawbackVestingAccountResponse, MsgCreateClawbackVestingAccountResponseSDKType, MsgClawback, MsgClawbackSDKType, MsgClawbackResponse, MsgClawbackResponseSDKType } from "./tx"; /** Msg defines the vesting Msg service. */ @@ -14,8 +14,8 @@ export interface Msg { clawback(request: MsgClawback): Promise; } export class MsgClientImpl implements Msg { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.createClawbackVestingAccount = this.createClawbackVestingAccount.bind(this); this.clawback = this.clawback.bind(this); @@ -31,6 +31,6 @@ export class MsgClientImpl implements Msg { return promise.then(data => MsgClawbackResponse.decode(new BinaryReader(data))); } } -export const createClientImpl = (rpc: Rpc) => { +export const createClientImpl = (rpc: TxRpc) => { return new MsgClientImpl(rpc); }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputosmojs/extern.ts b/__fixtures__/v-next/outputosmojs/extern.ts index c3e7cbcac8..83d6864ae2 100644 --- a/__fixtures__/v-next/outputosmojs/extern.ts +++ b/__fixtures__/v-next/outputosmojs/extern.ts @@ -4,30 +4,45 @@ * and run the transpile command or npm scripts command that is used to regenerate this bundle. */ -import { QueryClient, createProtobufRpcClient, ProtobufRpcClient } from '@cosmjs/stargate' -import { Tendermint34Client, HttpEndpoint } from "@cosmjs/tendermint-rpc"; -const _rpcClients: Record = {}; +import { HttpEndpoint } from "@interchainjs/types"; +import { Rpc } from "./helpers"; +import { ClientOptions, createCosmosQueryClient } from "@interchainjs/cosmos"; + +const _rpcClients: Record = {}; export const getRpcEndpointKey = (rpcEndpoint: string | HttpEndpoint) => { - if (typeof rpcEndpoint === 'string') { - return rpcEndpoint; - } else if (!!rpcEndpoint) { - //@ts-ignore - return rpcEndpoint.url; - } + if (typeof rpcEndpoint === 'string') { + return rpcEndpoint; + } else if (!!rpcEndpoint) { + //@ts-ignore + return rpcEndpoint.url; + } } export const getRpcClient = async (rpcEndpoint: string | HttpEndpoint) => { - const key = getRpcEndpointKey(rpcEndpoint); - if (!key) return; - if (_rpcClients.hasOwnProperty(key)) { - return _rpcClients[key]; - } - const tmClient = await Tendermint34Client.connect(rpcEndpoint); - //@ts-ignore - const client = new QueryClient(tmClient); - const rpc = createProtobufRpcClient(client); - _rpcClients[key] = rpc; - return rpc; + const key = getRpcEndpointKey(rpcEndpoint); + if (!key) return; + if (_rpcClients.hasOwnProperty(key)) { + return _rpcClients[key]; + } + const rpc = await createRpcClient(rpcEndpoint); + _rpcClients[key] = rpc; + return rpc; +} + +export const createRpcClient = async (rpcEndpoint: string | HttpEndpoint, + options?: ClientOptions +) => { + if (typeof rpcEndpoint === 'string') { + return createCosmosQueryClient(rpcEndpoint, options); + } else { + const endpointStr = rpcEndpoint.url; + const clientOptions = { + ...options, + headers: rpcEndpoint.headers + }; + + return createCosmosQueryClient(endpointStr, clientOptions); + } } diff --git a/__fixtures__/v-next/outputosmojs/helper-func-types.ts b/__fixtures__/v-next/outputosmojs/helper-func-types.ts new file mode 100644 index 0000000000..5f9d7a87a0 --- /dev/null +++ b/__fixtures__/v-next/outputosmojs/helper-func-types.ts @@ -0,0 +1,92 @@ +/** +* This file and any referenced files were automatically generated by @hyperweb/telescope@latest +* DO NOT MODIFY BY HAND. Instead, download the latest proto files for your chain +* and run the transpile command or npm scripts command that is used to regenerate this bundle. +*/ + + +import { HttpEndpoint } from "@interchainjs/types"; +import { BinaryReader, BinaryWriter } from "./binary"; +import { getRpcClient } from "./extern"; +import { isRpc, Rpc } from "./helpers"; +import { TelescopeGeneratedCodec, DeliverTxResponse, Message, StdFee } from "./types"; +import { toConverters, toEncoders } from "@interchainjs/cosmos/utils"; +import { ISigningClient } from "@interchainjs/cosmos/types/signing-client"; + +export interface QueryBuilderOptions { + encode: (request: TReq, writer?: BinaryWriter) => BinaryWriter + decode: (input: BinaryReader | Uint8Array, length?: number) => TRes + service: string, + method: string, +} + +export function buildQuery(opts: QueryBuilderOptions) { + return async (client: EndpointOrRpc, request: TReq) => { + let rpc: Rpc | undefined; + + if(isRpc(client)) { + rpc = client; + } else { + rpc = client ? await getRpcClient(client) : undefined; + } + + if (!rpc) throw new Error("Query Rpc is not initialized"); + + const data = opts.encode(request).finish(); + const response = await rpc.request(opts.service, opts.method, data); + return opts.decode(response); + }; +} + +export interface ITxArgs { + signerAddress: string; + message: TMsg | TMsg[]; + fee: StdFee | 'auto'; + memo: string; +} + +export interface TxBuilderOptions { + msg: TelescopeGeneratedCodec +} + +export function buildTx(opts: TxBuilderOptions) { + return async ( + client: ISigningClient, + signerAddress: string, + message: TMsg | TMsg[], + fee: StdFee | 'auto', + memo: string + ): Promise => { + if (!client) throw new Error("SigningClient is not initialized"); + + //register all related encoders and converters + client.addEncoders?.(toEncoders(opts.msg)); + client.addConverters?.(toConverters(opts.msg)); + + const data = Array.isArray(message) + ? message.map(msg => ({ + typeUrl: opts.msg.typeUrl, + value: msg, + })) + : [{ + typeUrl: opts.msg.typeUrl, + value: message, + }]; + return client.signAndBroadcast!(signerAddress, data, fee, memo); + }; +} + +export interface Encoder { + typeUrl: string; + fromPartial: (data: any) => any; + encode: (data: any) => Uint8Array; +} + +export interface AminoConverter { + typeUrl: string; + aminoType: string; + fromAmino: (data: any) => any; + toAmino: (data: any) => any; +} + +export type EndpointOrRpc = string | HttpEndpoint | Rpc ; diff --git a/__fixtures__/v-next/outputosmojs/ibc/applications/fee/v1/query.rpc.Query.ts b/__fixtures__/v-next/outputosmojs/ibc/applications/fee/v1/query.rpc.Query.ts index e81cc991dc..3ae13ba7c7 100644 --- a/__fixtures__/v-next/outputosmojs/ibc/applications/fee/v1/query.rpc.Query.ts +++ b/__fixtures__/v-next/outputosmojs/ibc/applications/fee/v1/query.rpc.Query.ts @@ -2,7 +2,7 @@ import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } fr import { IdentifiedPacketFees, IdentifiedPacketFeesSDKType } from "./fee"; import { Coin, CoinSDKType } from "../../../../cosmos/base/v1beta1/coin"; import { FeeEnabledChannel, FeeEnabledChannelSDKType } from "./genesis"; -import { Rpc } from "../../../../helpers"; +import { TxRpc } from "../../../../types"; import { BinaryReader } from "../../../../binary"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; import { QueryIncentivizedPacketsRequest, QueryIncentivizedPacketsRequestSDKType, QueryIncentivizedPacketsResponse, QueryIncentivizedPacketsResponseSDKType, QueryIncentivizedPacketRequest, QueryIncentivizedPacketRequestSDKType, QueryIncentivizedPacketResponse, QueryIncentivizedPacketResponseSDKType, QueryIncentivizedPacketsForChannelRequest, QueryIncentivizedPacketsForChannelRequestSDKType, QueryIncentivizedPacketsForChannelResponse, QueryIncentivizedPacketsForChannelResponseSDKType, QueryTotalRecvFeesRequest, QueryTotalRecvFeesRequestSDKType, QueryTotalRecvFeesResponse, QueryTotalRecvFeesResponseSDKType, QueryTotalAckFeesRequest, QueryTotalAckFeesRequestSDKType, QueryTotalAckFeesResponse, QueryTotalAckFeesResponseSDKType, QueryTotalTimeoutFeesRequest, QueryTotalTimeoutFeesRequestSDKType, QueryTotalTimeoutFeesResponse, QueryTotalTimeoutFeesResponseSDKType, QueryPayeeRequest, QueryPayeeRequestSDKType, QueryPayeeResponse, QueryPayeeResponseSDKType, QueryCounterpartyPayeeRequest, QueryCounterpartyPayeeRequestSDKType, QueryCounterpartyPayeeResponse, QueryCounterpartyPayeeResponseSDKType, QueryFeeEnabledChannelsRequest, QueryFeeEnabledChannelsRequestSDKType, QueryFeeEnabledChannelsResponse, QueryFeeEnabledChannelsResponseSDKType, QueryFeeEnabledChannelRequest, QueryFeeEnabledChannelRequestSDKType, QueryFeeEnabledChannelResponse, QueryFeeEnabledChannelResponseSDKType } from "./query"; @@ -30,8 +30,8 @@ export interface Query { feeEnabledChannel(request: QueryFeeEnabledChannelRequest): Promise; } export class QueryClientImpl implements Query { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.incentivizedPackets = this.incentivizedPackets.bind(this); this.incentivizedPacket = this.incentivizedPacket.bind(this); diff --git a/__fixtures__/v-next/outputosmojs/ibc/applications/fee/v1/query.rpc.func.ts b/__fixtures__/v-next/outputosmojs/ibc/applications/fee/v1/query.rpc.func.ts new file mode 100644 index 0000000000..3ca62b68aa --- /dev/null +++ b/__fixtures__/v-next/outputosmojs/ibc/applications/fee/v1/query.rpc.func.ts @@ -0,0 +1,126 @@ +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../../cosmos/base/query/v1beta1/pagination"; +import { IdentifiedPacketFees, IdentifiedPacketFeesSDKType } from "./fee"; +import { Coin, CoinSDKType } from "../../../../cosmos/base/v1beta1/coin"; +import { FeeEnabledChannel, FeeEnabledChannelSDKType } from "./genesis"; +import { EndpointOrRpc, buildQuery } from "../../../../helper-func-types"; +import { QueryIncentivizedPacketsRequest, QueryIncentivizedPacketsRequestSDKType, QueryIncentivizedPacketsResponse, QueryIncentivizedPacketsResponseSDKType, QueryIncentivizedPacketRequest, QueryIncentivizedPacketRequestSDKType, QueryIncentivizedPacketResponse, QueryIncentivizedPacketResponseSDKType, QueryIncentivizedPacketsForChannelRequest, QueryIncentivizedPacketsForChannelRequestSDKType, QueryIncentivizedPacketsForChannelResponse, QueryIncentivizedPacketsForChannelResponseSDKType, QueryTotalRecvFeesRequest, QueryTotalRecvFeesRequestSDKType, QueryTotalRecvFeesResponse, QueryTotalRecvFeesResponseSDKType, QueryTotalAckFeesRequest, QueryTotalAckFeesRequestSDKType, QueryTotalAckFeesResponse, QueryTotalAckFeesResponseSDKType, QueryTotalTimeoutFeesRequest, QueryTotalTimeoutFeesRequestSDKType, QueryTotalTimeoutFeesResponse, QueryTotalTimeoutFeesResponseSDKType, QueryPayeeRequest, QueryPayeeRequestSDKType, QueryPayeeResponse, QueryPayeeResponseSDKType, QueryCounterpartyPayeeRequest, QueryCounterpartyPayeeRequestSDKType, QueryCounterpartyPayeeResponse, QueryCounterpartyPayeeResponseSDKType, QueryFeeEnabledChannelsRequest, QueryFeeEnabledChannelsRequestSDKType, QueryFeeEnabledChannelsResponse, QueryFeeEnabledChannelsResponseSDKType, QueryFeeEnabledChannelRequest, QueryFeeEnabledChannelRequestSDKType, QueryFeeEnabledChannelResponse, QueryFeeEnabledChannelResponseSDKType } from "./query"; +/** + * IncentivizedPackets returns all incentivized packets and their associated fees + * @name getIncentivizedPackets + * @package ibc.applications.fee.v1 + * @see proto service: ibc.applications.fee.v1.IncentivizedPackets + */ +export const getIncentivizedPackets = buildQuery({ + encode: QueryIncentivizedPacketsRequest.encode, + decode: QueryIncentivizedPacketsResponse.decode, + service: "ibc.applications.fee.v1.Query", + method: "IncentivizedPackets" +}); +/** + * IncentivizedPacket returns all packet fees for a packet given its identifier + * @name getIncentivizedPacket + * @package ibc.applications.fee.v1 + * @see proto service: ibc.applications.fee.v1.IncentivizedPacket + */ +export const getIncentivizedPacket = buildQuery({ + encode: QueryIncentivizedPacketRequest.encode, + decode: QueryIncentivizedPacketResponse.decode, + service: "ibc.applications.fee.v1.Query", + method: "IncentivizedPacket" +}); +/** + * Gets all incentivized packets for a specific channel + * @name getIncentivizedPacketsForChannel + * @package ibc.applications.fee.v1 + * @see proto service: ibc.applications.fee.v1.IncentivizedPacketsForChannel + */ +export const getIncentivizedPacketsForChannel = buildQuery({ + encode: QueryIncentivizedPacketsForChannelRequest.encode, + decode: QueryIncentivizedPacketsForChannelResponse.decode, + service: "ibc.applications.fee.v1.Query", + method: "IncentivizedPacketsForChannel" +}); +/** + * TotalRecvFees returns the total receive fees for a packet given its identifier + * @name getTotalRecvFees + * @package ibc.applications.fee.v1 + * @see proto service: ibc.applications.fee.v1.TotalRecvFees + */ +export const getTotalRecvFees = buildQuery({ + encode: QueryTotalRecvFeesRequest.encode, + decode: QueryTotalRecvFeesResponse.decode, + service: "ibc.applications.fee.v1.Query", + method: "TotalRecvFees" +}); +/** + * TotalAckFees returns the total acknowledgement fees for a packet given its identifier + * @name getTotalAckFees + * @package ibc.applications.fee.v1 + * @see proto service: ibc.applications.fee.v1.TotalAckFees + */ +export const getTotalAckFees = buildQuery({ + encode: QueryTotalAckFeesRequest.encode, + decode: QueryTotalAckFeesResponse.decode, + service: "ibc.applications.fee.v1.Query", + method: "TotalAckFees" +}); +/** + * TotalTimeoutFees returns the total timeout fees for a packet given its identifier + * @name getTotalTimeoutFees + * @package ibc.applications.fee.v1 + * @see proto service: ibc.applications.fee.v1.TotalTimeoutFees + */ +export const getTotalTimeoutFees = buildQuery({ + encode: QueryTotalTimeoutFeesRequest.encode, + decode: QueryTotalTimeoutFeesResponse.decode, + service: "ibc.applications.fee.v1.Query", + method: "TotalTimeoutFees" +}); +/** + * Payee returns the registered payee address for a specific channel given the relayer address + * @name getPayee + * @package ibc.applications.fee.v1 + * @see proto service: ibc.applications.fee.v1.Payee + */ +export const getPayee = buildQuery({ + encode: QueryPayeeRequest.encode, + decode: QueryPayeeResponse.decode, + service: "ibc.applications.fee.v1.Query", + method: "Payee" +}); +/** + * CounterpartyPayee returns the registered counterparty payee for forward relaying + * @name getCounterpartyPayee + * @package ibc.applications.fee.v1 + * @see proto service: ibc.applications.fee.v1.CounterpartyPayee + */ +export const getCounterpartyPayee = buildQuery({ + encode: QueryCounterpartyPayeeRequest.encode, + decode: QueryCounterpartyPayeeResponse.decode, + service: "ibc.applications.fee.v1.Query", + method: "CounterpartyPayee" +}); +/** + * FeeEnabledChannels returns a list of all fee enabled channels + * @name getFeeEnabledChannels + * @package ibc.applications.fee.v1 + * @see proto service: ibc.applications.fee.v1.FeeEnabledChannels + */ +export const getFeeEnabledChannels = buildQuery({ + encode: QueryFeeEnabledChannelsRequest.encode, + decode: QueryFeeEnabledChannelsResponse.decode, + service: "ibc.applications.fee.v1.Query", + method: "FeeEnabledChannels" +}); +/** + * FeeEnabledChannel returns true if the provided port and channel identifiers belong to a fee enabled channel + * @name getFeeEnabledChannel + * @package ibc.applications.fee.v1 + * @see proto service: ibc.applications.fee.v1.FeeEnabledChannel + */ +export const getFeeEnabledChannel = buildQuery({ + encode: QueryFeeEnabledChannelRequest.encode, + decode: QueryFeeEnabledChannelResponse.decode, + service: "ibc.applications.fee.v1.Query", + method: "FeeEnabledChannel" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputosmojs/ibc/applications/fee/v1/tx.registry.ts b/__fixtures__/v-next/outputosmojs/ibc/applications/fee/v1/tx.registry.ts index c86b1ba00b..506414a321 100644 --- a/__fixtures__/v-next/outputosmojs/ibc/applications/fee/v1/tx.registry.ts +++ b/__fixtures__/v-next/outputosmojs/ibc/applications/fee/v1/tx.registry.ts @@ -1,12 +1,7 @@ import { Fee, FeeSDKType, PacketFee, PacketFeeSDKType } from "./fee"; -import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { TelescopeGeneratedType } from "../../../../types"; import { MsgRegisterPayee, MsgRegisterPayeeSDKType, MsgRegisterCounterpartyPayee, MsgRegisterCounterpartyPayeeSDKType, MsgPayPacketFee, MsgPayPacketFeeSDKType, MsgPayPacketFeeAsync, MsgPayPacketFeeAsyncSDKType } from "./tx"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/ibc.applications.fee.v1.MsgRegisterPayee", MsgRegisterPayee], ["/ibc.applications.fee.v1.MsgRegisterCounterpartyPayee", MsgRegisterCounterpartyPayee], ["/ibc.applications.fee.v1.MsgPayPacketFee", MsgPayPacketFee], ["/ibc.applications.fee.v1.MsgPayPacketFeeAsync", MsgPayPacketFeeAsync]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/ibc.applications.fee.v1.MsgRegisterPayee", MsgRegisterPayee], ["/ibc.applications.fee.v1.MsgRegisterCounterpartyPayee", MsgRegisterCounterpartyPayee], ["/ibc.applications.fee.v1.MsgPayPacketFee", MsgPayPacketFee], ["/ibc.applications.fee.v1.MsgPayPacketFeeAsync", MsgPayPacketFeeAsync]]; export const MessageComposer = { encoded: { registerPayee(value: MsgRegisterPayee) { diff --git a/__fixtures__/v-next/outputosmojs/ibc/applications/fee/v1/tx.rpc.func.ts b/__fixtures__/v-next/outputosmojs/ibc/applications/fee/v1/tx.rpc.func.ts new file mode 100644 index 0000000000..8a88695f35 --- /dev/null +++ b/__fixtures__/v-next/outputosmojs/ibc/applications/fee/v1/tx.rpc.func.ts @@ -0,0 +1,53 @@ +import { Fee, FeeSDKType, PacketFee, PacketFeeSDKType } from "./fee"; +import { buildTx } from "../../../../helper-func-types"; +import { MsgRegisterPayee, MsgRegisterPayeeSDKType, MsgRegisterPayeeResponse, MsgRegisterPayeeResponseSDKType, MsgRegisterCounterpartyPayee, MsgRegisterCounterpartyPayeeSDKType, MsgRegisterCounterpartyPayeeResponse, MsgRegisterCounterpartyPayeeResponseSDKType, MsgPayPacketFee, MsgPayPacketFeeSDKType, MsgPayPacketFeeResponse, MsgPayPacketFeeResponseSDKType, MsgPayPacketFeeAsync, MsgPayPacketFeeAsyncSDKType, MsgPayPacketFeeAsyncResponse, MsgPayPacketFeeAsyncResponseSDKType } from "./tx"; +/** + * RegisterPayee defines a rpc handler method for MsgRegisterPayee + * RegisterPayee is called by the relayer on each channelEnd and allows them to set an optional + * payee to which reverse and timeout relayer packet fees will be paid out. The payee should be registered on + * the source chain from which packets originate as this is where fee distribution takes place. This function may be + * called more than once by a relayer, in which case, the latest payee is always used. + * @name registerPayee + * @package ibc.applications.fee.v1 + * @see proto service: ibc.applications.fee.v1.RegisterPayee + */ +export const registerPayee = buildTx({ + msg: MsgRegisterPayee +}); +/** + * RegisterCounterpartyPayee defines a rpc handler method for MsgRegisterCounterpartyPayee + * RegisterCounterpartyPayee is called by the relayer on each channelEnd and allows them to specify the counterparty + * payee address before relaying. This ensures they will be properly compensated for forward relaying since + * the destination chain must include the registered counterparty payee address in the acknowledgement. This function + * may be called more than once by a relayer, in which case, the latest counterparty payee address is always used. + * @name registerCounterpartyPayee + * @package ibc.applications.fee.v1 + * @see proto service: ibc.applications.fee.v1.RegisterCounterpartyPayee + */ +export const registerCounterpartyPayee = buildTx({ + msg: MsgRegisterCounterpartyPayee +}); +/** + * PayPacketFee defines a rpc handler method for MsgPayPacketFee + * PayPacketFee is an open callback that may be called by any module/user that wishes to escrow funds in order to + * incentivize the relaying of the packet at the next sequence + * NOTE: This method is intended to be used within a multi msg transaction, where the subsequent msg that follows + * initiates the lifecycle of the incentivized packet + * @name payPacketFee + * @package ibc.applications.fee.v1 + * @see proto service: ibc.applications.fee.v1.PayPacketFee + */ +export const payPacketFee = buildTx({ + msg: MsgPayPacketFee +}); +/** + * PayPacketFeeAsync defines a rpc handler method for MsgPayPacketFeeAsync + * PayPacketFeeAsync is an open callback that may be called by any module/user that wishes to escrow funds in order to + * incentivize the relaying of a known packet (i.e. at a particular sequence) + * @name payPacketFeeAsync + * @package ibc.applications.fee.v1 + * @see proto service: ibc.applications.fee.v1.PayPacketFeeAsync + */ +export const payPacketFeeAsync = buildTx({ + msg: MsgPayPacketFeeAsync +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputosmojs/ibc/applications/fee/v1/tx.rpc.msg.ts b/__fixtures__/v-next/outputosmojs/ibc/applications/fee/v1/tx.rpc.msg.ts index fea442c62c..f9e6541b31 100644 --- a/__fixtures__/v-next/outputosmojs/ibc/applications/fee/v1/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputosmojs/ibc/applications/fee/v1/tx.rpc.msg.ts @@ -1,5 +1,5 @@ import { Fee, FeeSDKType, PacketFee, PacketFeeSDKType } from "./fee"; -import { Rpc } from "../../../../helpers"; +import { TxRpc } from "../../../../types"; import { BinaryReader } from "../../../../binary"; import { MsgRegisterPayee, MsgRegisterPayeeSDKType, MsgRegisterPayeeResponse, MsgRegisterPayeeResponseSDKType, MsgRegisterCounterpartyPayee, MsgRegisterCounterpartyPayeeSDKType, MsgRegisterCounterpartyPayeeResponse, MsgRegisterCounterpartyPayeeResponseSDKType, MsgPayPacketFee, MsgPayPacketFeeSDKType, MsgPayPacketFeeResponse, MsgPayPacketFeeResponseSDKType, MsgPayPacketFeeAsync, MsgPayPacketFeeAsyncSDKType, MsgPayPacketFeeAsyncResponse, MsgPayPacketFeeAsyncResponseSDKType } from "./tx"; /** Msg defines the ICS29 Msg service. */ @@ -36,8 +36,8 @@ export interface Msg { payPacketFeeAsync(request: MsgPayPacketFeeAsync): Promise; } export class MsgClientImpl implements Msg { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.registerPayee = this.registerPayee.bind(this); this.registerCounterpartyPayee = this.registerCounterpartyPayee.bind(this); @@ -65,6 +65,6 @@ export class MsgClientImpl implements Msg { return promise.then(data => MsgPayPacketFeeAsyncResponse.decode(new BinaryReader(data))); } } -export const createClientImpl = (rpc: Rpc) => { +export const createClientImpl = (rpc: TxRpc) => { return new MsgClientImpl(rpc); }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputosmojs/ibc/applications/interchain_accounts/controller/v1/query.rpc.Query.ts b/__fixtures__/v-next/outputosmojs/ibc/applications/interchain_accounts/controller/v1/query.rpc.Query.ts index 797df5f5fa..140812fbbc 100644 --- a/__fixtures__/v-next/outputosmojs/ibc/applications/interchain_accounts/controller/v1/query.rpc.Query.ts +++ b/__fixtures__/v-next/outputosmojs/ibc/applications/interchain_accounts/controller/v1/query.rpc.Query.ts @@ -1,5 +1,5 @@ import { Params, ParamsSDKType } from "./controller"; -import { Rpc } from "../../../../../helpers"; +import { TxRpc } from "../../../../../types"; import { BinaryReader } from "../../../../../binary"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; import { QueryInterchainAccountRequest, QueryInterchainAccountRequestSDKType, QueryInterchainAccountResponse, QueryInterchainAccountResponseSDKType, QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType } from "./query"; @@ -11,8 +11,8 @@ export interface Query { params(request?: QueryParamsRequest): Promise; } export class QueryClientImpl implements Query { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.interchainAccount = this.interchainAccount.bind(this); this.params = this.params.bind(this); diff --git a/__fixtures__/v-next/outputosmojs/ibc/applications/interchain_accounts/controller/v1/query.rpc.func.ts b/__fixtures__/v-next/outputosmojs/ibc/applications/interchain_accounts/controller/v1/query.rpc.func.ts new file mode 100644 index 0000000000..4a901300ef --- /dev/null +++ b/__fixtures__/v-next/outputosmojs/ibc/applications/interchain_accounts/controller/v1/query.rpc.func.ts @@ -0,0 +1,27 @@ +import { Params, ParamsSDKType } from "./controller"; +import { EndpointOrRpc, buildQuery } from "../../../../../helper-func-types"; +import { QueryInterchainAccountRequest, QueryInterchainAccountRequestSDKType, QueryInterchainAccountResponse, QueryInterchainAccountResponseSDKType, QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType } from "./query"; +/** + * InterchainAccount returns the interchain account address for a given owner address on a given connection + * @name getInterchainAccount + * @package ibc.applications.interchain_accounts.controller.v1 + * @see proto service: ibc.applications.interchain_accounts.controller.v1.InterchainAccount + */ +export const getInterchainAccount = buildQuery({ + encode: QueryInterchainAccountRequest.encode, + decode: QueryInterchainAccountResponse.decode, + service: "ibc.applications.interchain_accounts.controller.v1.Query", + method: "InterchainAccount" +}); +/** + * Params queries all parameters of the ICA controller submodule. + * @name getParams + * @package ibc.applications.interchain_accounts.controller.v1 + * @see proto service: ibc.applications.interchain_accounts.controller.v1.Params + */ +export const getParams = buildQuery({ + encode: QueryParamsRequest.encode, + decode: QueryParamsResponse.decode, + service: "ibc.applications.interchain_accounts.controller.v1.Query", + method: "Params" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputosmojs/ibc/applications/interchain_accounts/controller/v1/tx.registry.ts b/__fixtures__/v-next/outputosmojs/ibc/applications/interchain_accounts/controller/v1/tx.registry.ts index c2ba487c95..a896e5ebfd 100644 --- a/__fixtures__/v-next/outputosmojs/ibc/applications/interchain_accounts/controller/v1/tx.registry.ts +++ b/__fixtures__/v-next/outputosmojs/ibc/applications/interchain_accounts/controller/v1/tx.registry.ts @@ -1,12 +1,7 @@ import { InterchainAccountPacketData, InterchainAccountPacketDataSDKType } from "../../v1/packet"; -import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { TelescopeGeneratedType } from "../../../../../types"; import { MsgRegisterInterchainAccount, MsgRegisterInterchainAccountSDKType, MsgSendTx, MsgSendTxSDKType } from "./tx"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/ibc.applications.interchain_accounts.controller.v1.MsgRegisterInterchainAccount", MsgRegisterInterchainAccount], ["/ibc.applications.interchain_accounts.controller.v1.MsgSendTx", MsgSendTx]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/ibc.applications.interchain_accounts.controller.v1.MsgRegisterInterchainAccount", MsgRegisterInterchainAccount], ["/ibc.applications.interchain_accounts.controller.v1.MsgSendTx", MsgSendTx]]; export const MessageComposer = { encoded: { registerInterchainAccount(value: MsgRegisterInterchainAccount) { diff --git a/__fixtures__/v-next/outputosmojs/ibc/applications/interchain_accounts/controller/v1/tx.rpc.func.ts b/__fixtures__/v-next/outputosmojs/ibc/applications/interchain_accounts/controller/v1/tx.rpc.func.ts new file mode 100644 index 0000000000..c017f2cd86 --- /dev/null +++ b/__fixtures__/v-next/outputosmojs/ibc/applications/interchain_accounts/controller/v1/tx.rpc.func.ts @@ -0,0 +1,21 @@ +import { InterchainAccountPacketData, InterchainAccountPacketDataSDKType } from "../../v1/packet"; +import { buildTx } from "../../../../../helper-func-types"; +import { MsgRegisterInterchainAccount, MsgRegisterInterchainAccountSDKType, MsgRegisterInterchainAccountResponse, MsgRegisterInterchainAccountResponseSDKType, MsgSendTx, MsgSendTxSDKType, MsgSendTxResponse, MsgSendTxResponseSDKType } from "./tx"; +/** + * RegisterInterchainAccount defines a rpc handler for MsgRegisterInterchainAccount. + * @name registerInterchainAccount + * @package ibc.applications.interchain_accounts.controller.v1 + * @see proto service: ibc.applications.interchain_accounts.controller.v1.RegisterInterchainAccount + */ +export const registerInterchainAccount = buildTx({ + msg: MsgRegisterInterchainAccount +}); +/** + * SendTx defines a rpc handler for MsgSendTx. + * @name sendTx + * @package ibc.applications.interchain_accounts.controller.v1 + * @see proto service: ibc.applications.interchain_accounts.controller.v1.SendTx + */ +export const sendTx = buildTx({ + msg: MsgSendTx +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputosmojs/ibc/applications/interchain_accounts/controller/v1/tx.rpc.msg.ts b/__fixtures__/v-next/outputosmojs/ibc/applications/interchain_accounts/controller/v1/tx.rpc.msg.ts index 2cd551df97..d2e62c8278 100644 --- a/__fixtures__/v-next/outputosmojs/ibc/applications/interchain_accounts/controller/v1/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputosmojs/ibc/applications/interchain_accounts/controller/v1/tx.rpc.msg.ts @@ -1,5 +1,5 @@ import { InterchainAccountPacketData, InterchainAccountPacketDataSDKType } from "../../v1/packet"; -import { Rpc } from "../../../../../helpers"; +import { TxRpc } from "../../../../../types"; import { BinaryReader } from "../../../../../binary"; import { MsgRegisterInterchainAccount, MsgRegisterInterchainAccountSDKType, MsgRegisterInterchainAccountResponse, MsgRegisterInterchainAccountResponseSDKType, MsgSendTx, MsgSendTxSDKType, MsgSendTxResponse, MsgSendTxResponseSDKType } from "./tx"; /** Msg defines the 27-interchain-accounts/controller Msg service. */ @@ -10,8 +10,8 @@ export interface Msg { sendTx(request: MsgSendTx): Promise; } export class MsgClientImpl implements Msg { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.registerInterchainAccount = this.registerInterchainAccount.bind(this); this.sendTx = this.sendTx.bind(this); @@ -27,6 +27,6 @@ export class MsgClientImpl implements Msg { return promise.then(data => MsgSendTxResponse.decode(new BinaryReader(data))); } } -export const createClientImpl = (rpc: Rpc) => { +export const createClientImpl = (rpc: TxRpc) => { return new MsgClientImpl(rpc); }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputosmojs/ibc/applications/interchain_accounts/host/v1/query.rpc.Query.ts b/__fixtures__/v-next/outputosmojs/ibc/applications/interchain_accounts/host/v1/query.rpc.Query.ts index 889c438a8f..c743529b2b 100644 --- a/__fixtures__/v-next/outputosmojs/ibc/applications/interchain_accounts/host/v1/query.rpc.Query.ts +++ b/__fixtures__/v-next/outputosmojs/ibc/applications/interchain_accounts/host/v1/query.rpc.Query.ts @@ -1,5 +1,5 @@ import { Params, ParamsSDKType } from "./host"; -import { Rpc } from "../../../../../helpers"; +import { TxRpc } from "../../../../../types"; import { BinaryReader } from "../../../../../binary"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; import { QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType } from "./query"; @@ -9,8 +9,8 @@ export interface Query { params(request?: QueryParamsRequest): Promise; } export class QueryClientImpl implements Query { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.params = this.params.bind(this); } diff --git a/__fixtures__/v-next/outputosmojs/ibc/applications/interchain_accounts/host/v1/query.rpc.func.ts b/__fixtures__/v-next/outputosmojs/ibc/applications/interchain_accounts/host/v1/query.rpc.func.ts new file mode 100644 index 0000000000..cd528b062d --- /dev/null +++ b/__fixtures__/v-next/outputosmojs/ibc/applications/interchain_accounts/host/v1/query.rpc.func.ts @@ -0,0 +1,15 @@ +import { Params, ParamsSDKType } from "./host"; +import { EndpointOrRpc, buildQuery } from "../../../../../helper-func-types"; +import { QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType } from "./query"; +/** + * Params queries all parameters of the ICA host submodule. + * @name getParams + * @package ibc.applications.interchain_accounts.host.v1 + * @see proto service: ibc.applications.interchain_accounts.host.v1.Params + */ +export const getParams = buildQuery({ + encode: QueryParamsRequest.encode, + decode: QueryParamsResponse.decode, + service: "ibc.applications.interchain_accounts.host.v1.Query", + method: "Params" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputosmojs/ibc/applications/transfer/v1/query.rpc.Query.ts b/__fixtures__/v-next/outputosmojs/ibc/applications/transfer/v1/query.rpc.Query.ts index 00566f5332..6ffadc20d8 100644 --- a/__fixtures__/v-next/outputosmojs/ibc/applications/transfer/v1/query.rpc.Query.ts +++ b/__fixtures__/v-next/outputosmojs/ibc/applications/transfer/v1/query.rpc.Query.ts @@ -1,6 +1,6 @@ import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../../cosmos/base/query/v1beta1/pagination"; import { DenomTrace, DenomTraceSDKType, Params, ParamsSDKType } from "./transfer"; -import { Rpc } from "../../../../helpers"; +import { TxRpc } from "../../../../types"; import { BinaryReader } from "../../../../binary"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; import { QueryDenomTraceRequest, QueryDenomTraceRequestSDKType, QueryDenomTraceResponse, QueryDenomTraceResponseSDKType, QueryDenomTracesRequest, QueryDenomTracesRequestSDKType, QueryDenomTracesResponse, QueryDenomTracesResponseSDKType, QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType } from "./query"; @@ -14,8 +14,8 @@ export interface Query { params(request?: QueryParamsRequest): Promise; } export class QueryClientImpl implements Query { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.denomTrace = this.denomTrace.bind(this); this.denomTraces = this.denomTraces.bind(this); diff --git a/__fixtures__/v-next/outputosmojs/ibc/applications/transfer/v1/query.rpc.func.ts b/__fixtures__/v-next/outputosmojs/ibc/applications/transfer/v1/query.rpc.func.ts new file mode 100644 index 0000000000..b0991df88a --- /dev/null +++ b/__fixtures__/v-next/outputosmojs/ibc/applications/transfer/v1/query.rpc.func.ts @@ -0,0 +1,40 @@ +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../../cosmos/base/query/v1beta1/pagination"; +import { DenomTrace, DenomTraceSDKType, Params, ParamsSDKType } from "./transfer"; +import { EndpointOrRpc, buildQuery } from "../../../../helper-func-types"; +import { QueryDenomTraceRequest, QueryDenomTraceRequestSDKType, QueryDenomTraceResponse, QueryDenomTraceResponseSDKType, QueryDenomTracesRequest, QueryDenomTracesRequestSDKType, QueryDenomTracesResponse, QueryDenomTracesResponseSDKType, QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType } from "./query"; +/** + * DenomTrace queries a denomination trace information. + * @name getDenomTrace + * @package ibc.applications.transfer.v1 + * @see proto service: ibc.applications.transfer.v1.DenomTrace + */ +export const getDenomTrace = buildQuery({ + encode: QueryDenomTraceRequest.encode, + decode: QueryDenomTraceResponse.decode, + service: "ibc.applications.transfer.v1.Query", + method: "DenomTrace" +}); +/** + * DenomTraces queries all denomination traces. + * @name getDenomTraces + * @package ibc.applications.transfer.v1 + * @see proto service: ibc.applications.transfer.v1.DenomTraces + */ +export const getDenomTraces = buildQuery({ + encode: QueryDenomTracesRequest.encode, + decode: QueryDenomTracesResponse.decode, + service: "ibc.applications.transfer.v1.Query", + method: "DenomTraces" +}); +/** + * Params queries all parameters of the ibc-transfer module. + * @name getParams + * @package ibc.applications.transfer.v1 + * @see proto service: ibc.applications.transfer.v1.Params + */ +export const getParams = buildQuery({ + encode: QueryParamsRequest.encode, + decode: QueryParamsResponse.decode, + service: "ibc.applications.transfer.v1.Query", + method: "Params" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputosmojs/ibc/applications/transfer/v1/tx.registry.ts b/__fixtures__/v-next/outputosmojs/ibc/applications/transfer/v1/tx.registry.ts index 204a0db521..416cef2847 100644 --- a/__fixtures__/v-next/outputosmojs/ibc/applications/transfer/v1/tx.registry.ts +++ b/__fixtures__/v-next/outputosmojs/ibc/applications/transfer/v1/tx.registry.ts @@ -1,13 +1,8 @@ import { Coin, CoinSDKType } from "../../../../cosmos/base/v1beta1/coin"; import { Height, HeightSDKType } from "../../../core/client/v1/client"; -import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { TelescopeGeneratedType } from "../../../../types"; import { MsgTransfer, MsgTransferSDKType } from "./tx"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/ibc.applications.transfer.v1.MsgTransfer", MsgTransfer]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/ibc.applications.transfer.v1.MsgTransfer", MsgTransfer]]; export const MessageComposer = { encoded: { transfer(value: MsgTransfer) { diff --git a/__fixtures__/v-next/outputosmojs/ibc/applications/transfer/v1/tx.rpc.func.ts b/__fixtures__/v-next/outputosmojs/ibc/applications/transfer/v1/tx.rpc.func.ts new file mode 100644 index 0000000000..9f352ae025 --- /dev/null +++ b/__fixtures__/v-next/outputosmojs/ibc/applications/transfer/v1/tx.rpc.func.ts @@ -0,0 +1,13 @@ +import { Coin, CoinSDKType } from "../../../../cosmos/base/v1beta1/coin"; +import { Height, HeightSDKType } from "../../../core/client/v1/client"; +import { buildTx } from "../../../../helper-func-types"; +import { MsgTransfer, MsgTransferSDKType, MsgTransferResponse, MsgTransferResponseSDKType } from "./tx"; +/** + * Transfer defines a rpc handler method for MsgTransfer. + * @name transfer + * @package ibc.applications.transfer.v1 + * @see proto service: ibc.applications.transfer.v1.Transfer + */ +export const transfer = buildTx({ + msg: MsgTransfer +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputosmojs/ibc/applications/transfer/v1/tx.rpc.msg.ts b/__fixtures__/v-next/outputosmojs/ibc/applications/transfer/v1/tx.rpc.msg.ts index 0184a5fb40..f8191a43d9 100644 --- a/__fixtures__/v-next/outputosmojs/ibc/applications/transfer/v1/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputosmojs/ibc/applications/transfer/v1/tx.rpc.msg.ts @@ -1,6 +1,6 @@ import { Coin, CoinSDKType } from "../../../../cosmos/base/v1beta1/coin"; import { Height, HeightSDKType } from "../../../core/client/v1/client"; -import { Rpc } from "../../../../helpers"; +import { TxRpc } from "../../../../types"; import { BinaryReader } from "../../../../binary"; import { MsgTransfer, MsgTransferSDKType, MsgTransferResponse, MsgTransferResponseSDKType } from "./tx"; /** Msg defines the ibc/transfer Msg service. */ @@ -9,8 +9,8 @@ export interface Msg { transfer(request: MsgTransfer): Promise; } export class MsgClientImpl implements Msg { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.transfer = this.transfer.bind(this); } @@ -20,6 +20,6 @@ export class MsgClientImpl implements Msg { return promise.then(data => MsgTransferResponse.decode(new BinaryReader(data))); } } -export const createClientImpl = (rpc: Rpc) => { +export const createClientImpl = (rpc: TxRpc) => { return new MsgClientImpl(rpc); }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputosmojs/ibc/bundle.ts b/__fixtures__/v-next/outputosmojs/ibc/bundle.ts index 19f5fdbd78..3e7842925b 100644 --- a/__fixtures__/v-next/outputosmojs/ibc/bundle.ts +++ b/__fixtures__/v-next/outputosmojs/ibc/bundle.ts @@ -40,42 +40,56 @@ import * as _271 from "./lightclients/solomachine/v1/solomachine"; import * as _272 from "./lightclients/solomachine/v2/solomachine"; import * as _273 from "./lightclients/solomachine/v3/solomachine"; import * as _274 from "./lightclients/tendermint/v1/tendermint"; -import * as _517 from "./applications/transfer/v1/tx.amino"; -import * as _518 from "./core/channel/v1/tx.amino"; -import * as _519 from "./core/client/v1/tx.amino"; -import * as _520 from "./core/connection/v1/tx.amino"; -import * as _521 from "./applications/fee/v1/tx.amino"; -import * as _522 from "./applications/interchain_accounts/controller/v1/tx.amino"; -import * as _523 from "./applications/transfer/v1/tx.registry"; -import * as _524 from "./core/channel/v1/tx.registry"; -import * as _525 from "./core/client/v1/tx.registry"; -import * as _526 from "./core/connection/v1/tx.registry"; -import * as _527 from "./applications/fee/v1/tx.registry"; -import * as _528 from "./applications/interchain_accounts/controller/v1/tx.registry"; -import * as _529 from "./applications/transfer/v1/query.lcd"; -import * as _530 from "./core/channel/v1/query.lcd"; -import * as _531 from "./core/client/v1/query.lcd"; -import * as _532 from "./core/connection/v1/query.lcd"; -import * as _533 from "./applications/fee/v1/query.lcd"; -import * as _534 from "./applications/interchain_accounts/controller/v1/query.lcd"; -import * as _535 from "./applications/interchain_accounts/host/v1/query.lcd"; -import * as _536 from "./applications/transfer/v1/query.rpc.Query"; -import * as _537 from "./core/channel/v1/query.rpc.Query"; -import * as _538 from "./core/client/v1/query.rpc.Query"; -import * as _539 from "./core/connection/v1/query.rpc.Query"; -import * as _540 from "./core/port/v1/query.rpc.Query"; -import * as _541 from "./applications/fee/v1/query.rpc.Query"; -import * as _542 from "./applications/interchain_accounts/controller/v1/query.rpc.Query"; -import * as _543 from "./applications/interchain_accounts/host/v1/query.rpc.Query"; -import * as _544 from "./applications/transfer/v1/tx.rpc.msg"; -import * as _545 from "./core/channel/v1/tx.rpc.msg"; -import * as _546 from "./core/client/v1/tx.rpc.msg"; -import * as _547 from "./core/connection/v1/tx.rpc.msg"; -import * as _548 from "./applications/fee/v1/tx.rpc.msg"; -import * as _549 from "./applications/interchain_accounts/controller/v1/tx.rpc.msg"; -import * as _641 from "./lcd"; -import * as _642 from "./rpc.query"; -import * as _643 from "./rpc.tx"; +import * as _581 from "./applications/transfer/v1/tx.amino"; +import * as _582 from "./core/channel/v1/tx.amino"; +import * as _583 from "./core/client/v1/tx.amino"; +import * as _584 from "./core/connection/v1/tx.amino"; +import * as _585 from "./applications/fee/v1/tx.amino"; +import * as _586 from "./applications/interchain_accounts/controller/v1/tx.amino"; +import * as _587 from "./applications/transfer/v1/tx.registry"; +import * as _588 from "./core/channel/v1/tx.registry"; +import * as _589 from "./core/client/v1/tx.registry"; +import * as _590 from "./core/connection/v1/tx.registry"; +import * as _591 from "./applications/fee/v1/tx.registry"; +import * as _592 from "./applications/interchain_accounts/controller/v1/tx.registry"; +import * as _593 from "./applications/transfer/v1/query.lcd"; +import * as _594 from "./core/channel/v1/query.lcd"; +import * as _595 from "./core/client/v1/query.lcd"; +import * as _596 from "./core/connection/v1/query.lcd"; +import * as _597 from "./applications/fee/v1/query.lcd"; +import * as _598 from "./applications/interchain_accounts/controller/v1/query.lcd"; +import * as _599 from "./applications/interchain_accounts/host/v1/query.lcd"; +import * as _600 from "./applications/transfer/v1/query.rpc.func"; +import * as _601 from "./core/channel/v1/query.rpc.func"; +import * as _602 from "./core/client/v1/query.rpc.func"; +import * as _603 from "./core/connection/v1/query.rpc.func"; +import * as _604 from "./core/port/v1/query.rpc.func"; +import * as _605 from "./applications/fee/v1/query.rpc.func"; +import * as _606 from "./applications/interchain_accounts/controller/v1/query.rpc.func"; +import * as _607 from "./applications/interchain_accounts/host/v1/query.rpc.func"; +import * as _608 from "./applications/transfer/v1/query.rpc.Query"; +import * as _609 from "./core/channel/v1/query.rpc.Query"; +import * as _610 from "./core/client/v1/query.rpc.Query"; +import * as _611 from "./core/connection/v1/query.rpc.Query"; +import * as _612 from "./core/port/v1/query.rpc.Query"; +import * as _613 from "./applications/fee/v1/query.rpc.Query"; +import * as _614 from "./applications/interchain_accounts/controller/v1/query.rpc.Query"; +import * as _615 from "./applications/interchain_accounts/host/v1/query.rpc.Query"; +import * as _616 from "./applications/transfer/v1/tx.rpc.func"; +import * as _617 from "./core/channel/v1/tx.rpc.func"; +import * as _618 from "./core/client/v1/tx.rpc.func"; +import * as _619 from "./core/connection/v1/tx.rpc.func"; +import * as _620 from "./applications/fee/v1/tx.rpc.func"; +import * as _621 from "./applications/interchain_accounts/controller/v1/tx.rpc.func"; +import * as _622 from "./applications/transfer/v1/tx.rpc.msg"; +import * as _623 from "./core/channel/v1/tx.rpc.msg"; +import * as _624 from "./core/client/v1/tx.rpc.msg"; +import * as _625 from "./core/connection/v1/tx.rpc.msg"; +import * as _626 from "./applications/fee/v1/tx.rpc.msg"; +import * as _627 from "./applications/interchain_accounts/controller/v1/tx.rpc.msg"; +import * as _750 from "./lcd"; +import * as _751 from "./rpc.query"; +import * as _752 from "./rpc.tx"; export namespace ibc { export namespace applications { export namespace transfer { @@ -85,11 +99,13 @@ export namespace ibc { ..._235, ..._236, ..._237, - ..._517, - ..._523, - ..._529, - ..._536, - ..._544 + ..._581, + ..._587, + ..._593, + ..._600, + ..._608, + ..._616, + ..._622 }; export const v2 = { ..._238 @@ -103,11 +119,13 @@ export namespace ibc { ..._242, ..._243, ..._244, - ..._521, - ..._527, - ..._533, - ..._541, - ..._548 + ..._585, + ..._591, + ..._597, + ..._605, + ..._613, + ..._620, + ..._626 }; } export namespace interchain_accounts { @@ -116,11 +134,13 @@ export namespace ibc { ..._245, ..._246, ..._247, - ..._522, - ..._528, - ..._534, - ..._542, - ..._549 + ..._586, + ..._592, + ..._598, + ..._606, + ..._614, + ..._621, + ..._627 }; } export namespace genesis { @@ -132,8 +152,9 @@ export namespace ibc { export const v1 = { ..._249, ..._250, - ..._535, - ..._543 + ..._599, + ..._607, + ..._615 }; } export const v1 = { @@ -150,11 +171,13 @@ export namespace ibc { ..._255, ..._256, ..._257, - ..._518, - ..._524, - ..._530, - ..._537, - ..._545 + ..._582, + ..._588, + ..._594, + ..._601, + ..._609, + ..._617, + ..._623 }; } export namespace client { @@ -163,11 +186,13 @@ export namespace ibc { ..._259, ..._260, ..._261, - ..._519, - ..._525, - ..._531, - ..._538, - ..._546 + ..._583, + ..._589, + ..._595, + ..._602, + ..._610, + ..._618, + ..._624 }; } export namespace commitment { @@ -181,17 +206,20 @@ export namespace ibc { ..._264, ..._265, ..._266, - ..._520, - ..._526, - ..._532, - ..._539, - ..._547 + ..._584, + ..._590, + ..._596, + ..._603, + ..._611, + ..._619, + ..._625 }; } export namespace port { export const v1 = { ..._267, - ..._540 + ..._604, + ..._612 }; } export namespace types { @@ -227,8 +255,8 @@ export namespace ibc { } } export const ClientFactory = { - ..._641, - ..._642, - ..._643 + ..._750, + ..._751, + ..._752 }; } \ No newline at end of file diff --git a/__fixtures__/v-next/outputosmojs/ibc/core/channel/v1/query.rpc.Query.ts b/__fixtures__/v-next/outputosmojs/ibc/core/channel/v1/query.rpc.Query.ts index 6a6a7bfc31..67985f98de 100644 --- a/__fixtures__/v-next/outputosmojs/ibc/core/channel/v1/query.rpc.Query.ts +++ b/__fixtures__/v-next/outputosmojs/ibc/core/channel/v1/query.rpc.Query.ts @@ -2,7 +2,7 @@ import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } fr import { Channel, ChannelSDKType, IdentifiedChannel, IdentifiedChannelSDKType, PacketState, PacketStateSDKType } from "./channel"; import { Height, HeightSDKType, IdentifiedClientState, IdentifiedClientStateSDKType } from "../../client/v1/client"; import { Any, AnySDKType } from "../../../../google/protobuf/any"; -import { Rpc } from "../../../../helpers"; +import { TxRpc } from "../../../../types"; import { BinaryReader } from "../../../../binary"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; import { QueryChannelRequest, QueryChannelRequestSDKType, QueryChannelResponse, QueryChannelResponseSDKType, QueryChannelsRequest, QueryChannelsRequestSDKType, QueryChannelsResponse, QueryChannelsResponseSDKType, QueryConnectionChannelsRequest, QueryConnectionChannelsRequestSDKType, QueryConnectionChannelsResponse, QueryConnectionChannelsResponseSDKType, QueryChannelClientStateRequest, QueryChannelClientStateRequestSDKType, QueryChannelClientStateResponse, QueryChannelClientStateResponseSDKType, QueryChannelConsensusStateRequest, QueryChannelConsensusStateRequestSDKType, QueryChannelConsensusStateResponse, QueryChannelConsensusStateResponseSDKType, QueryPacketCommitmentRequest, QueryPacketCommitmentRequestSDKType, QueryPacketCommitmentResponse, QueryPacketCommitmentResponseSDKType, QueryPacketCommitmentsRequest, QueryPacketCommitmentsRequestSDKType, QueryPacketCommitmentsResponse, QueryPacketCommitmentsResponseSDKType, QueryPacketReceiptRequest, QueryPacketReceiptRequestSDKType, QueryPacketReceiptResponse, QueryPacketReceiptResponseSDKType, QueryPacketAcknowledgementRequest, QueryPacketAcknowledgementRequestSDKType, QueryPacketAcknowledgementResponse, QueryPacketAcknowledgementResponseSDKType, QueryPacketAcknowledgementsRequest, QueryPacketAcknowledgementsRequestSDKType, QueryPacketAcknowledgementsResponse, QueryPacketAcknowledgementsResponseSDKType, QueryUnreceivedPacketsRequest, QueryUnreceivedPacketsRequestSDKType, QueryUnreceivedPacketsResponse, QueryUnreceivedPacketsResponseSDKType, QueryUnreceivedAcksRequest, QueryUnreceivedAcksRequestSDKType, QueryUnreceivedAcksResponse, QueryUnreceivedAcksResponseSDKType, QueryNextSequenceReceiveRequest, QueryNextSequenceReceiveRequestSDKType, QueryNextSequenceReceiveResponse, QueryNextSequenceReceiveResponseSDKType } from "./query"; @@ -60,8 +60,8 @@ export interface Query { nextSequenceReceive(request: QueryNextSequenceReceiveRequest): Promise; } export class QueryClientImpl implements Query { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.channel = this.channel.bind(this); this.channels = this.channels.bind(this); diff --git a/__fixtures__/v-next/outputosmojs/ibc/core/channel/v1/query.rpc.func.ts b/__fixtures__/v-next/outputosmojs/ibc/core/channel/v1/query.rpc.func.ts new file mode 100644 index 0000000000..66f63bfd32 --- /dev/null +++ b/__fixtures__/v-next/outputosmojs/ibc/core/channel/v1/query.rpc.func.ts @@ -0,0 +1,170 @@ +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../../cosmos/base/query/v1beta1/pagination"; +import { Channel, ChannelSDKType, IdentifiedChannel, IdentifiedChannelSDKType, PacketState, PacketStateSDKType } from "./channel"; +import { Height, HeightSDKType, IdentifiedClientState, IdentifiedClientStateSDKType } from "../../client/v1/client"; +import { Any, AnySDKType } from "../../../../google/protobuf/any"; +import { EndpointOrRpc, buildQuery } from "../../../../helper-func-types"; +import { QueryChannelRequest, QueryChannelRequestSDKType, QueryChannelResponse, QueryChannelResponseSDKType, QueryChannelsRequest, QueryChannelsRequestSDKType, QueryChannelsResponse, QueryChannelsResponseSDKType, QueryConnectionChannelsRequest, QueryConnectionChannelsRequestSDKType, QueryConnectionChannelsResponse, QueryConnectionChannelsResponseSDKType, QueryChannelClientStateRequest, QueryChannelClientStateRequestSDKType, QueryChannelClientStateResponse, QueryChannelClientStateResponseSDKType, QueryChannelConsensusStateRequest, QueryChannelConsensusStateRequestSDKType, QueryChannelConsensusStateResponse, QueryChannelConsensusStateResponseSDKType, QueryPacketCommitmentRequest, QueryPacketCommitmentRequestSDKType, QueryPacketCommitmentResponse, QueryPacketCommitmentResponseSDKType, QueryPacketCommitmentsRequest, QueryPacketCommitmentsRequestSDKType, QueryPacketCommitmentsResponse, QueryPacketCommitmentsResponseSDKType, QueryPacketReceiptRequest, QueryPacketReceiptRequestSDKType, QueryPacketReceiptResponse, QueryPacketReceiptResponseSDKType, QueryPacketAcknowledgementRequest, QueryPacketAcknowledgementRequestSDKType, QueryPacketAcknowledgementResponse, QueryPacketAcknowledgementResponseSDKType, QueryPacketAcknowledgementsRequest, QueryPacketAcknowledgementsRequestSDKType, QueryPacketAcknowledgementsResponse, QueryPacketAcknowledgementsResponseSDKType, QueryUnreceivedPacketsRequest, QueryUnreceivedPacketsRequestSDKType, QueryUnreceivedPacketsResponse, QueryUnreceivedPacketsResponseSDKType, QueryUnreceivedAcksRequest, QueryUnreceivedAcksRequestSDKType, QueryUnreceivedAcksResponse, QueryUnreceivedAcksResponseSDKType, QueryNextSequenceReceiveRequest, QueryNextSequenceReceiveRequestSDKType, QueryNextSequenceReceiveResponse, QueryNextSequenceReceiveResponseSDKType } from "./query"; +/** + * Channel queries an IBC Channel. + * @name getChannel + * @package ibc.core.channel.v1 + * @see proto service: ibc.core.channel.v1.Channel + */ +export const getChannel = buildQuery({ + encode: QueryChannelRequest.encode, + decode: QueryChannelResponse.decode, + service: "ibc.core.channel.v1.Query", + method: "Channel" +}); +/** + * Channels queries all the IBC channels of a chain. + * @name getChannels + * @package ibc.core.channel.v1 + * @see proto service: ibc.core.channel.v1.Channels + */ +export const getChannels = buildQuery({ + encode: QueryChannelsRequest.encode, + decode: QueryChannelsResponse.decode, + service: "ibc.core.channel.v1.Query", + method: "Channels" +}); +/** + * ConnectionChannels queries all the channels associated with a connection + * end. + * @name getConnectionChannels + * @package ibc.core.channel.v1 + * @see proto service: ibc.core.channel.v1.ConnectionChannels + */ +export const getConnectionChannels = buildQuery({ + encode: QueryConnectionChannelsRequest.encode, + decode: QueryConnectionChannelsResponse.decode, + service: "ibc.core.channel.v1.Query", + method: "ConnectionChannels" +}); +/** + * ChannelClientState queries for the client state for the channel associated + * with the provided channel identifiers. + * @name getChannelClientState + * @package ibc.core.channel.v1 + * @see proto service: ibc.core.channel.v1.ChannelClientState + */ +export const getChannelClientState = buildQuery({ + encode: QueryChannelClientStateRequest.encode, + decode: QueryChannelClientStateResponse.decode, + service: "ibc.core.channel.v1.Query", + method: "ChannelClientState" +}); +/** + * ChannelConsensusState queries for the consensus state for the channel + * associated with the provided channel identifiers. + * @name getChannelConsensusState + * @package ibc.core.channel.v1 + * @see proto service: ibc.core.channel.v1.ChannelConsensusState + */ +export const getChannelConsensusState = buildQuery({ + encode: QueryChannelConsensusStateRequest.encode, + decode: QueryChannelConsensusStateResponse.decode, + service: "ibc.core.channel.v1.Query", + method: "ChannelConsensusState" +}); +/** + * PacketCommitment queries a stored packet commitment hash. + * @name getPacketCommitment + * @package ibc.core.channel.v1 + * @see proto service: ibc.core.channel.v1.PacketCommitment + */ +export const getPacketCommitment = buildQuery({ + encode: QueryPacketCommitmentRequest.encode, + decode: QueryPacketCommitmentResponse.decode, + service: "ibc.core.channel.v1.Query", + method: "PacketCommitment" +}); +/** + * PacketCommitments returns all the packet commitments hashes associated + * with a channel. + * @name getPacketCommitments + * @package ibc.core.channel.v1 + * @see proto service: ibc.core.channel.v1.PacketCommitments + */ +export const getPacketCommitments = buildQuery({ + encode: QueryPacketCommitmentsRequest.encode, + decode: QueryPacketCommitmentsResponse.decode, + service: "ibc.core.channel.v1.Query", + method: "PacketCommitments" +}); +/** + * PacketReceipt queries if a given packet sequence has been received on the + * queried chain + * @name getPacketReceipt + * @package ibc.core.channel.v1 + * @see proto service: ibc.core.channel.v1.PacketReceipt + */ +export const getPacketReceipt = buildQuery({ + encode: QueryPacketReceiptRequest.encode, + decode: QueryPacketReceiptResponse.decode, + service: "ibc.core.channel.v1.Query", + method: "PacketReceipt" +}); +/** + * PacketAcknowledgement queries a stored packet acknowledgement hash. + * @name getPacketAcknowledgement + * @package ibc.core.channel.v1 + * @see proto service: ibc.core.channel.v1.PacketAcknowledgement + */ +export const getPacketAcknowledgement = buildQuery({ + encode: QueryPacketAcknowledgementRequest.encode, + decode: QueryPacketAcknowledgementResponse.decode, + service: "ibc.core.channel.v1.Query", + method: "PacketAcknowledgement" +}); +/** + * PacketAcknowledgements returns all the packet acknowledgements associated + * with a channel. + * @name getPacketAcknowledgements + * @package ibc.core.channel.v1 + * @see proto service: ibc.core.channel.v1.PacketAcknowledgements + */ +export const getPacketAcknowledgements = buildQuery({ + encode: QueryPacketAcknowledgementsRequest.encode, + decode: QueryPacketAcknowledgementsResponse.decode, + service: "ibc.core.channel.v1.Query", + method: "PacketAcknowledgements" +}); +/** + * UnreceivedPackets returns all the unreceived IBC packets associated with a + * channel and sequences. + * @name getUnreceivedPackets + * @package ibc.core.channel.v1 + * @see proto service: ibc.core.channel.v1.UnreceivedPackets + */ +export const getUnreceivedPackets = buildQuery({ + encode: QueryUnreceivedPacketsRequest.encode, + decode: QueryUnreceivedPacketsResponse.decode, + service: "ibc.core.channel.v1.Query", + method: "UnreceivedPackets" +}); +/** + * UnreceivedAcks returns all the unreceived IBC acknowledgements associated + * with a channel and sequences. + * @name getUnreceivedAcks + * @package ibc.core.channel.v1 + * @see proto service: ibc.core.channel.v1.UnreceivedAcks + */ +export const getUnreceivedAcks = buildQuery({ + encode: QueryUnreceivedAcksRequest.encode, + decode: QueryUnreceivedAcksResponse.decode, + service: "ibc.core.channel.v1.Query", + method: "UnreceivedAcks" +}); +/** + * NextSequenceReceive returns the next receive sequence for a given channel. + * @name getNextSequenceReceive + * @package ibc.core.channel.v1 + * @see proto service: ibc.core.channel.v1.NextSequenceReceive + */ +export const getNextSequenceReceive = buildQuery({ + encode: QueryNextSequenceReceiveRequest.encode, + decode: QueryNextSequenceReceiveResponse.decode, + service: "ibc.core.channel.v1.Query", + method: "NextSequenceReceive" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputosmojs/ibc/core/channel/v1/tx.registry.ts b/__fixtures__/v-next/outputosmojs/ibc/core/channel/v1/tx.registry.ts index a74ee98c9d..e3505d4f12 100644 --- a/__fixtures__/v-next/outputosmojs/ibc/core/channel/v1/tx.registry.ts +++ b/__fixtures__/v-next/outputosmojs/ibc/core/channel/v1/tx.registry.ts @@ -1,13 +1,8 @@ import { Channel, ChannelSDKType, Packet, PacketSDKType } from "./channel"; import { Height, HeightSDKType } from "../../client/v1/client"; -import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { TelescopeGeneratedType } from "../../../../types"; import { MsgChannelOpenInit, MsgChannelOpenInitSDKType, MsgChannelOpenTry, MsgChannelOpenTrySDKType, MsgChannelOpenAck, MsgChannelOpenAckSDKType, MsgChannelOpenConfirm, MsgChannelOpenConfirmSDKType, MsgChannelCloseInit, MsgChannelCloseInitSDKType, MsgChannelCloseConfirm, MsgChannelCloseConfirmSDKType, MsgRecvPacket, MsgRecvPacketSDKType, MsgTimeout, MsgTimeoutSDKType, MsgTimeoutOnClose, MsgTimeoutOnCloseSDKType, MsgAcknowledgement, MsgAcknowledgementSDKType } from "./tx"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/ibc.core.channel.v1.MsgChannelOpenInit", MsgChannelOpenInit], ["/ibc.core.channel.v1.MsgChannelOpenTry", MsgChannelOpenTry], ["/ibc.core.channel.v1.MsgChannelOpenAck", MsgChannelOpenAck], ["/ibc.core.channel.v1.MsgChannelOpenConfirm", MsgChannelOpenConfirm], ["/ibc.core.channel.v1.MsgChannelCloseInit", MsgChannelCloseInit], ["/ibc.core.channel.v1.MsgChannelCloseConfirm", MsgChannelCloseConfirm], ["/ibc.core.channel.v1.MsgRecvPacket", MsgRecvPacket], ["/ibc.core.channel.v1.MsgTimeout", MsgTimeout], ["/ibc.core.channel.v1.MsgTimeoutOnClose", MsgTimeoutOnClose], ["/ibc.core.channel.v1.MsgAcknowledgement", MsgAcknowledgement]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/ibc.core.channel.v1.MsgChannelOpenInit", MsgChannelOpenInit], ["/ibc.core.channel.v1.MsgChannelOpenTry", MsgChannelOpenTry], ["/ibc.core.channel.v1.MsgChannelOpenAck", MsgChannelOpenAck], ["/ibc.core.channel.v1.MsgChannelOpenConfirm", MsgChannelOpenConfirm], ["/ibc.core.channel.v1.MsgChannelCloseInit", MsgChannelCloseInit], ["/ibc.core.channel.v1.MsgChannelCloseConfirm", MsgChannelCloseConfirm], ["/ibc.core.channel.v1.MsgRecvPacket", MsgRecvPacket], ["/ibc.core.channel.v1.MsgTimeout", MsgTimeout], ["/ibc.core.channel.v1.MsgTimeoutOnClose", MsgTimeoutOnClose], ["/ibc.core.channel.v1.MsgAcknowledgement", MsgAcknowledgement]]; export const MessageComposer = { encoded: { channelOpenInit(value: MsgChannelOpenInit) { diff --git a/__fixtures__/v-next/outputosmojs/ibc/core/channel/v1/tx.rpc.func.ts b/__fixtures__/v-next/outputosmojs/ibc/core/channel/v1/tx.rpc.func.ts new file mode 100644 index 0000000000..98c04fd664 --- /dev/null +++ b/__fixtures__/v-next/outputosmojs/ibc/core/channel/v1/tx.rpc.func.ts @@ -0,0 +1,95 @@ +import { Channel, ChannelSDKType, Packet, PacketSDKType } from "./channel"; +import { Height, HeightSDKType } from "../../client/v1/client"; +import { buildTx } from "../../../../helper-func-types"; +import { MsgChannelOpenInit, MsgChannelOpenInitSDKType, MsgChannelOpenInitResponse, MsgChannelOpenInitResponseSDKType, MsgChannelOpenTry, MsgChannelOpenTrySDKType, MsgChannelOpenTryResponse, MsgChannelOpenTryResponseSDKType, MsgChannelOpenAck, MsgChannelOpenAckSDKType, MsgChannelOpenAckResponse, MsgChannelOpenAckResponseSDKType, MsgChannelOpenConfirm, MsgChannelOpenConfirmSDKType, MsgChannelOpenConfirmResponse, MsgChannelOpenConfirmResponseSDKType, MsgChannelCloseInit, MsgChannelCloseInitSDKType, MsgChannelCloseInitResponse, MsgChannelCloseInitResponseSDKType, MsgChannelCloseConfirm, MsgChannelCloseConfirmSDKType, MsgChannelCloseConfirmResponse, MsgChannelCloseConfirmResponseSDKType, MsgRecvPacket, MsgRecvPacketSDKType, MsgRecvPacketResponse, MsgRecvPacketResponseSDKType, MsgTimeout, MsgTimeoutSDKType, MsgTimeoutResponse, MsgTimeoutResponseSDKType, MsgTimeoutOnClose, MsgTimeoutOnCloseSDKType, MsgTimeoutOnCloseResponse, MsgTimeoutOnCloseResponseSDKType, MsgAcknowledgement, MsgAcknowledgementSDKType, MsgAcknowledgementResponse, MsgAcknowledgementResponseSDKType } from "./tx"; +/** + * ChannelOpenInit defines a rpc handler method for MsgChannelOpenInit. + * @name channelOpenInit + * @package ibc.core.channel.v1 + * @see proto service: ibc.core.channel.v1.ChannelOpenInit + */ +export const channelOpenInit = buildTx({ + msg: MsgChannelOpenInit +}); +/** + * ChannelOpenTry defines a rpc handler method for MsgChannelOpenTry. + * @name channelOpenTry + * @package ibc.core.channel.v1 + * @see proto service: ibc.core.channel.v1.ChannelOpenTry + */ +export const channelOpenTry = buildTx({ + msg: MsgChannelOpenTry +}); +/** + * ChannelOpenAck defines a rpc handler method for MsgChannelOpenAck. + * @name channelOpenAck + * @package ibc.core.channel.v1 + * @see proto service: ibc.core.channel.v1.ChannelOpenAck + */ +export const channelOpenAck = buildTx({ + msg: MsgChannelOpenAck +}); +/** + * ChannelOpenConfirm defines a rpc handler method for MsgChannelOpenConfirm. + * @name channelOpenConfirm + * @package ibc.core.channel.v1 + * @see proto service: ibc.core.channel.v1.ChannelOpenConfirm + */ +export const channelOpenConfirm = buildTx({ + msg: MsgChannelOpenConfirm +}); +/** + * ChannelCloseInit defines a rpc handler method for MsgChannelCloseInit. + * @name channelCloseInit + * @package ibc.core.channel.v1 + * @see proto service: ibc.core.channel.v1.ChannelCloseInit + */ +export const channelCloseInit = buildTx({ + msg: MsgChannelCloseInit +}); +/** + * ChannelCloseConfirm defines a rpc handler method for + * MsgChannelCloseConfirm. + * @name channelCloseConfirm + * @package ibc.core.channel.v1 + * @see proto service: ibc.core.channel.v1.ChannelCloseConfirm + */ +export const channelCloseConfirm = buildTx({ + msg: MsgChannelCloseConfirm +}); +/** + * RecvPacket defines a rpc handler method for MsgRecvPacket. + * @name recvPacket + * @package ibc.core.channel.v1 + * @see proto service: ibc.core.channel.v1.RecvPacket + */ +export const recvPacket = buildTx({ + msg: MsgRecvPacket +}); +/** + * Timeout defines a rpc handler method for MsgTimeout. + * @name timeout + * @package ibc.core.channel.v1 + * @see proto service: ibc.core.channel.v1.Timeout + */ +export const timeout = buildTx({ + msg: MsgTimeout +}); +/** + * TimeoutOnClose defines a rpc handler method for MsgTimeoutOnClose. + * @name timeoutOnClose + * @package ibc.core.channel.v1 + * @see proto service: ibc.core.channel.v1.TimeoutOnClose + */ +export const timeoutOnClose = buildTx({ + msg: MsgTimeoutOnClose +}); +/** + * Acknowledgement defines a rpc handler method for MsgAcknowledgement. + * @name acknowledgement + * @package ibc.core.channel.v1 + * @see proto service: ibc.core.channel.v1.Acknowledgement + */ +export const acknowledgement = buildTx({ + msg: MsgAcknowledgement +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputosmojs/ibc/core/channel/v1/tx.rpc.msg.ts b/__fixtures__/v-next/outputosmojs/ibc/core/channel/v1/tx.rpc.msg.ts index 66669e2dd7..ac02a1fd85 100644 --- a/__fixtures__/v-next/outputosmojs/ibc/core/channel/v1/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputosmojs/ibc/core/channel/v1/tx.rpc.msg.ts @@ -1,6 +1,6 @@ import { Channel, ChannelSDKType, Packet, PacketSDKType } from "./channel"; import { Height, HeightSDKType } from "../../client/v1/client"; -import { Rpc } from "../../../../helpers"; +import { TxRpc } from "../../../../types"; import { BinaryReader } from "../../../../binary"; import { MsgChannelOpenInit, MsgChannelOpenInitSDKType, MsgChannelOpenInitResponse, MsgChannelOpenInitResponseSDKType, MsgChannelOpenTry, MsgChannelOpenTrySDKType, MsgChannelOpenTryResponse, MsgChannelOpenTryResponseSDKType, MsgChannelOpenAck, MsgChannelOpenAckSDKType, MsgChannelOpenAckResponse, MsgChannelOpenAckResponseSDKType, MsgChannelOpenConfirm, MsgChannelOpenConfirmSDKType, MsgChannelOpenConfirmResponse, MsgChannelOpenConfirmResponseSDKType, MsgChannelCloseInit, MsgChannelCloseInitSDKType, MsgChannelCloseInitResponse, MsgChannelCloseInitResponseSDKType, MsgChannelCloseConfirm, MsgChannelCloseConfirmSDKType, MsgChannelCloseConfirmResponse, MsgChannelCloseConfirmResponseSDKType, MsgRecvPacket, MsgRecvPacketSDKType, MsgRecvPacketResponse, MsgRecvPacketResponseSDKType, MsgTimeout, MsgTimeoutSDKType, MsgTimeoutResponse, MsgTimeoutResponseSDKType, MsgTimeoutOnClose, MsgTimeoutOnCloseSDKType, MsgTimeoutOnCloseResponse, MsgTimeoutOnCloseResponseSDKType, MsgAcknowledgement, MsgAcknowledgementSDKType, MsgAcknowledgementResponse, MsgAcknowledgementResponseSDKType } from "./tx"; /** Msg defines the ibc/channel Msg service. */ @@ -30,8 +30,8 @@ export interface Msg { acknowledgement(request: MsgAcknowledgement): Promise; } export class MsgClientImpl implements Msg { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.channelOpenInit = this.channelOpenInit.bind(this); this.channelOpenTry = this.channelOpenTry.bind(this); @@ -95,6 +95,6 @@ export class MsgClientImpl implements Msg { return promise.then(data => MsgAcknowledgementResponse.decode(new BinaryReader(data))); } } -export const createClientImpl = (rpc: Rpc) => { +export const createClientImpl = (rpc: TxRpc) => { return new MsgClientImpl(rpc); }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputosmojs/ibc/core/client/v1/query.rpc.Query.ts b/__fixtures__/v-next/outputosmojs/ibc/core/client/v1/query.rpc.Query.ts index 0b317175eb..1c7c5eb390 100644 --- a/__fixtures__/v-next/outputosmojs/ibc/core/client/v1/query.rpc.Query.ts +++ b/__fixtures__/v-next/outputosmojs/ibc/core/client/v1/query.rpc.Query.ts @@ -1,7 +1,7 @@ import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../../cosmos/base/query/v1beta1/pagination"; import { Any, AnySDKType } from "../../../../google/protobuf/any"; import { Height, HeightSDKType, IdentifiedClientState, IdentifiedClientStateSDKType, ConsensusStateWithHeight, ConsensusStateWithHeightSDKType, Params, ParamsSDKType } from "./client"; -import { Rpc } from "../../../../helpers"; +import { TxRpc } from "../../../../types"; import { BinaryReader } from "../../../../binary"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; import { QueryClientStateRequest, QueryClientStateRequestSDKType, QueryClientStateResponse, QueryClientStateResponseSDKType, QueryClientStatesRequest, QueryClientStatesRequestSDKType, QueryClientStatesResponse, QueryClientStatesResponseSDKType, QueryConsensusStateRequest, QueryConsensusStateRequestSDKType, QueryConsensusStateResponse, QueryConsensusStateResponseSDKType, QueryConsensusStatesRequest, QueryConsensusStatesRequestSDKType, QueryConsensusStatesResponse, QueryConsensusStatesResponseSDKType, QueryClientStatusRequest, QueryClientStatusRequestSDKType, QueryClientStatusResponse, QueryClientStatusResponseSDKType, QueryClientParamsRequest, QueryClientParamsRequestSDKType, QueryClientParamsResponse, QueryClientParamsResponseSDKType, QueryUpgradedClientStateRequest, QueryUpgradedClientStateRequestSDKType, QueryUpgradedClientStateResponse, QueryUpgradedClientStateResponseSDKType, QueryUpgradedConsensusStateRequest, QueryUpgradedConsensusStateRequestSDKType, QueryUpgradedConsensusStateResponse, QueryUpgradedConsensusStateResponseSDKType } from "./query"; @@ -31,8 +31,8 @@ export interface Query { upgradedConsensusState(request?: QueryUpgradedConsensusStateRequest): Promise; } export class QueryClientImpl implements Query { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.clientState = this.clientState.bind(this); this.clientStates = this.clientStates.bind(this); diff --git a/__fixtures__/v-next/outputosmojs/ibc/core/client/v1/query.rpc.func.ts b/__fixtures__/v-next/outputosmojs/ibc/core/client/v1/query.rpc.func.ts new file mode 100644 index 0000000000..3c120e7419 --- /dev/null +++ b/__fixtures__/v-next/outputosmojs/ibc/core/client/v1/query.rpc.func.ts @@ -0,0 +1,103 @@ +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../../cosmos/base/query/v1beta1/pagination"; +import { Any, AnySDKType } from "../../../../google/protobuf/any"; +import { Height, HeightSDKType, IdentifiedClientState, IdentifiedClientStateSDKType, ConsensusStateWithHeight, ConsensusStateWithHeightSDKType, Params, ParamsSDKType } from "./client"; +import { EndpointOrRpc, buildQuery } from "../../../../helper-func-types"; +import { QueryClientStateRequest, QueryClientStateRequestSDKType, QueryClientStateResponse, QueryClientStateResponseSDKType, QueryClientStatesRequest, QueryClientStatesRequestSDKType, QueryClientStatesResponse, QueryClientStatesResponseSDKType, QueryConsensusStateRequest, QueryConsensusStateRequestSDKType, QueryConsensusStateResponse, QueryConsensusStateResponseSDKType, QueryConsensusStatesRequest, QueryConsensusStatesRequestSDKType, QueryConsensusStatesResponse, QueryConsensusStatesResponseSDKType, QueryClientStatusRequest, QueryClientStatusRequestSDKType, QueryClientStatusResponse, QueryClientStatusResponseSDKType, QueryClientParamsRequest, QueryClientParamsRequestSDKType, QueryClientParamsResponse, QueryClientParamsResponseSDKType, QueryUpgradedClientStateRequest, QueryUpgradedClientStateRequestSDKType, QueryUpgradedClientStateResponse, QueryUpgradedClientStateResponseSDKType, QueryUpgradedConsensusStateRequest, QueryUpgradedConsensusStateRequestSDKType, QueryUpgradedConsensusStateResponse, QueryUpgradedConsensusStateResponseSDKType } from "./query"; +/** + * ClientState queries an IBC light client. + * @name getClientState + * @package ibc.core.client.v1 + * @see proto service: ibc.core.client.v1.ClientState + */ +export const getClientState = buildQuery({ + encode: QueryClientStateRequest.encode, + decode: QueryClientStateResponse.decode, + service: "ibc.core.client.v1.Query", + method: "ClientState" +}); +/** + * ClientStates queries all the IBC light clients of a chain. + * @name getClientStates + * @package ibc.core.client.v1 + * @see proto service: ibc.core.client.v1.ClientStates + */ +export const getClientStates = buildQuery({ + encode: QueryClientStatesRequest.encode, + decode: QueryClientStatesResponse.decode, + service: "ibc.core.client.v1.Query", + method: "ClientStates" +}); +/** + * ConsensusState queries a consensus state associated with a client state at + * a given height. + * @name getConsensusState + * @package ibc.core.client.v1 + * @see proto service: ibc.core.client.v1.ConsensusState + */ +export const getConsensusState = buildQuery({ + encode: QueryConsensusStateRequest.encode, + decode: QueryConsensusStateResponse.decode, + service: "ibc.core.client.v1.Query", + method: "ConsensusState" +}); +/** + * ConsensusStates queries all the consensus state associated with a given + * client. + * @name getConsensusStates + * @package ibc.core.client.v1 + * @see proto service: ibc.core.client.v1.ConsensusStates + */ +export const getConsensusStates = buildQuery({ + encode: QueryConsensusStatesRequest.encode, + decode: QueryConsensusStatesResponse.decode, + service: "ibc.core.client.v1.Query", + method: "ConsensusStates" +}); +/** + * Status queries the status of an IBC client. + * @name getClientStatus + * @package ibc.core.client.v1 + * @see proto service: ibc.core.client.v1.ClientStatus + */ +export const getClientStatus = buildQuery({ + encode: QueryClientStatusRequest.encode, + decode: QueryClientStatusResponse.decode, + service: "ibc.core.client.v1.Query", + method: "ClientStatus" +}); +/** + * ClientParams queries all parameters of the ibc client. + * @name getClientParams + * @package ibc.core.client.v1 + * @see proto service: ibc.core.client.v1.ClientParams + */ +export const getClientParams = buildQuery({ + encode: QueryClientParamsRequest.encode, + decode: QueryClientParamsResponse.decode, + service: "ibc.core.client.v1.Query", + method: "ClientParams" +}); +/** + * UpgradedClientState queries an Upgraded IBC light client. + * @name getUpgradedClientState + * @package ibc.core.client.v1 + * @see proto service: ibc.core.client.v1.UpgradedClientState + */ +export const getUpgradedClientState = buildQuery({ + encode: QueryUpgradedClientStateRequest.encode, + decode: QueryUpgradedClientStateResponse.decode, + service: "ibc.core.client.v1.Query", + method: "UpgradedClientState" +}); +/** + * UpgradedConsensusState queries an Upgraded IBC consensus state. + * @name getUpgradedConsensusState + * @package ibc.core.client.v1 + * @see proto service: ibc.core.client.v1.UpgradedConsensusState + */ +export const getUpgradedConsensusState = buildQuery({ + encode: QueryUpgradedConsensusStateRequest.encode, + decode: QueryUpgradedConsensusStateResponse.decode, + service: "ibc.core.client.v1.Query", + method: "UpgradedConsensusState" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputosmojs/ibc/core/client/v1/tx.registry.ts b/__fixtures__/v-next/outputosmojs/ibc/core/client/v1/tx.registry.ts index 8fdd202504..6bb8746b2b 100644 --- a/__fixtures__/v-next/outputosmojs/ibc/core/client/v1/tx.registry.ts +++ b/__fixtures__/v-next/outputosmojs/ibc/core/client/v1/tx.registry.ts @@ -1,12 +1,7 @@ import { Any, AnySDKType } from "../../../../google/protobuf/any"; -import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { TelescopeGeneratedType } from "../../../../types"; import { MsgCreateClient, MsgCreateClientSDKType, MsgUpdateClient, MsgUpdateClientSDKType, MsgUpgradeClient, MsgUpgradeClientSDKType, MsgSubmitMisbehaviour, MsgSubmitMisbehaviourSDKType } from "./tx"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/ibc.core.client.v1.MsgCreateClient", MsgCreateClient], ["/ibc.core.client.v1.MsgUpdateClient", MsgUpdateClient], ["/ibc.core.client.v1.MsgUpgradeClient", MsgUpgradeClient], ["/ibc.core.client.v1.MsgSubmitMisbehaviour", MsgSubmitMisbehaviour]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/ibc.core.client.v1.MsgCreateClient", MsgCreateClient], ["/ibc.core.client.v1.MsgUpdateClient", MsgUpdateClient], ["/ibc.core.client.v1.MsgUpgradeClient", MsgUpgradeClient], ["/ibc.core.client.v1.MsgSubmitMisbehaviour", MsgSubmitMisbehaviour]]; export const MessageComposer = { encoded: { createClient(value: MsgCreateClient) { diff --git a/__fixtures__/v-next/outputosmojs/ibc/core/client/v1/tx.rpc.func.ts b/__fixtures__/v-next/outputosmojs/ibc/core/client/v1/tx.rpc.func.ts new file mode 100644 index 0000000000..2a84b5b7f2 --- /dev/null +++ b/__fixtures__/v-next/outputosmojs/ibc/core/client/v1/tx.rpc.func.ts @@ -0,0 +1,39 @@ +import { Any, AnySDKType } from "../../../../google/protobuf/any"; +import { buildTx } from "../../../../helper-func-types"; +import { MsgCreateClient, MsgCreateClientSDKType, MsgCreateClientResponse, MsgCreateClientResponseSDKType, MsgUpdateClient, MsgUpdateClientSDKType, MsgUpdateClientResponse, MsgUpdateClientResponseSDKType, MsgUpgradeClient, MsgUpgradeClientSDKType, MsgUpgradeClientResponse, MsgUpgradeClientResponseSDKType, MsgSubmitMisbehaviour, MsgSubmitMisbehaviourSDKType, MsgSubmitMisbehaviourResponse, MsgSubmitMisbehaviourResponseSDKType } from "./tx"; +/** + * CreateClient defines a rpc handler method for MsgCreateClient. + * @name createClient + * @package ibc.core.client.v1 + * @see proto service: ibc.core.client.v1.CreateClient + */ +export const createClient = buildTx({ + msg: MsgCreateClient +}); +/** + * UpdateClient defines a rpc handler method for MsgUpdateClient. + * @name updateClient + * @package ibc.core.client.v1 + * @see proto service: ibc.core.client.v1.UpdateClient + */ +export const updateClient = buildTx({ + msg: MsgUpdateClient +}); +/** + * UpgradeClient defines a rpc handler method for MsgUpgradeClient. + * @name upgradeClient + * @package ibc.core.client.v1 + * @see proto service: ibc.core.client.v1.UpgradeClient + */ +export const upgradeClient = buildTx({ + msg: MsgUpgradeClient +}); +/** + * SubmitMisbehaviour defines a rpc handler method for MsgSubmitMisbehaviour. + * @name submitMisbehaviour + * @package ibc.core.client.v1 + * @see proto service: ibc.core.client.v1.SubmitMisbehaviour + */ +export const submitMisbehaviour = buildTx({ + msg: MsgSubmitMisbehaviour +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputosmojs/ibc/core/client/v1/tx.rpc.msg.ts b/__fixtures__/v-next/outputosmojs/ibc/core/client/v1/tx.rpc.msg.ts index aa64390f0c..295f3397ac 100644 --- a/__fixtures__/v-next/outputosmojs/ibc/core/client/v1/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputosmojs/ibc/core/client/v1/tx.rpc.msg.ts @@ -1,5 +1,5 @@ import { Any, AnySDKType } from "../../../../google/protobuf/any"; -import { Rpc } from "../../../../helpers"; +import { TxRpc } from "../../../../types"; import { BinaryReader } from "../../../../binary"; import { MsgCreateClient, MsgCreateClientSDKType, MsgCreateClientResponse, MsgCreateClientResponseSDKType, MsgUpdateClient, MsgUpdateClientSDKType, MsgUpdateClientResponse, MsgUpdateClientResponseSDKType, MsgUpgradeClient, MsgUpgradeClientSDKType, MsgUpgradeClientResponse, MsgUpgradeClientResponseSDKType, MsgSubmitMisbehaviour, MsgSubmitMisbehaviourSDKType, MsgSubmitMisbehaviourResponse, MsgSubmitMisbehaviourResponseSDKType } from "./tx"; /** Msg defines the ibc/client Msg service. */ @@ -14,8 +14,8 @@ export interface Msg { submitMisbehaviour(request: MsgSubmitMisbehaviour): Promise; } export class MsgClientImpl implements Msg { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.createClient = this.createClient.bind(this); this.updateClient = this.updateClient.bind(this); @@ -43,6 +43,6 @@ export class MsgClientImpl implements Msg { return promise.then(data => MsgSubmitMisbehaviourResponse.decode(new BinaryReader(data))); } } -export const createClientImpl = (rpc: Rpc) => { +export const createClientImpl = (rpc: TxRpc) => { return new MsgClientImpl(rpc); }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputosmojs/ibc/core/connection/v1/query.rpc.Query.ts b/__fixtures__/v-next/outputosmojs/ibc/core/connection/v1/query.rpc.Query.ts index fcff02ccae..f77e98ce35 100644 --- a/__fixtures__/v-next/outputosmojs/ibc/core/connection/v1/query.rpc.Query.ts +++ b/__fixtures__/v-next/outputosmojs/ibc/core/connection/v1/query.rpc.Query.ts @@ -2,7 +2,7 @@ import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } fr import { ConnectionEnd, ConnectionEndSDKType, IdentifiedConnection, IdentifiedConnectionSDKType } from "./connection"; import { Height, HeightSDKType, IdentifiedClientState, IdentifiedClientStateSDKType } from "../../client/v1/client"; import { Any, AnySDKType } from "../../../../google/protobuf/any"; -import { Rpc } from "../../../../helpers"; +import { TxRpc } from "../../../../types"; import { BinaryReader } from "../../../../binary"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; import { QueryConnectionRequest, QueryConnectionRequestSDKType, QueryConnectionResponse, QueryConnectionResponseSDKType, QueryConnectionsRequest, QueryConnectionsRequestSDKType, QueryConnectionsResponse, QueryConnectionsResponseSDKType, QueryClientConnectionsRequest, QueryClientConnectionsRequestSDKType, QueryClientConnectionsResponse, QueryClientConnectionsResponseSDKType, QueryConnectionClientStateRequest, QueryConnectionClientStateRequestSDKType, QueryConnectionClientStateResponse, QueryConnectionClientStateResponseSDKType, QueryConnectionConsensusStateRequest, QueryConnectionConsensusStateRequestSDKType, QueryConnectionConsensusStateResponse, QueryConnectionConsensusStateResponseSDKType } from "./query"; @@ -29,8 +29,8 @@ export interface Query { connectionConsensusState(request: QueryConnectionConsensusStateRequest): Promise; } export class QueryClientImpl implements Query { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.connection = this.connection.bind(this); this.connections = this.connections.bind(this); diff --git a/__fixtures__/v-next/outputosmojs/ibc/core/connection/v1/query.rpc.func.ts b/__fixtures__/v-next/outputosmojs/ibc/core/connection/v1/query.rpc.func.ts new file mode 100644 index 0000000000..e1536fe9cf --- /dev/null +++ b/__fixtures__/v-next/outputosmojs/ibc/core/connection/v1/query.rpc.func.ts @@ -0,0 +1,69 @@ +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../../cosmos/base/query/v1beta1/pagination"; +import { ConnectionEnd, ConnectionEndSDKType, IdentifiedConnection, IdentifiedConnectionSDKType } from "./connection"; +import { Height, HeightSDKType, IdentifiedClientState, IdentifiedClientStateSDKType } from "../../client/v1/client"; +import { Any, AnySDKType } from "../../../../google/protobuf/any"; +import { EndpointOrRpc, buildQuery } from "../../../../helper-func-types"; +import { QueryConnectionRequest, QueryConnectionRequestSDKType, QueryConnectionResponse, QueryConnectionResponseSDKType, QueryConnectionsRequest, QueryConnectionsRequestSDKType, QueryConnectionsResponse, QueryConnectionsResponseSDKType, QueryClientConnectionsRequest, QueryClientConnectionsRequestSDKType, QueryClientConnectionsResponse, QueryClientConnectionsResponseSDKType, QueryConnectionClientStateRequest, QueryConnectionClientStateRequestSDKType, QueryConnectionClientStateResponse, QueryConnectionClientStateResponseSDKType, QueryConnectionConsensusStateRequest, QueryConnectionConsensusStateRequestSDKType, QueryConnectionConsensusStateResponse, QueryConnectionConsensusStateResponseSDKType } from "./query"; +/** + * Connection queries an IBC connection end. + * @name getConnection + * @package ibc.core.connection.v1 + * @see proto service: ibc.core.connection.v1.Connection + */ +export const getConnection = buildQuery({ + encode: QueryConnectionRequest.encode, + decode: QueryConnectionResponse.decode, + service: "ibc.core.connection.v1.Query", + method: "Connection" +}); +/** + * Connections queries all the IBC connections of a chain. + * @name getConnections + * @package ibc.core.connection.v1 + * @see proto service: ibc.core.connection.v1.Connections + */ +export const getConnections = buildQuery({ + encode: QueryConnectionsRequest.encode, + decode: QueryConnectionsResponse.decode, + service: "ibc.core.connection.v1.Query", + method: "Connections" +}); +/** + * ClientConnections queries the connection paths associated with a client + * state. + * @name getClientConnections + * @package ibc.core.connection.v1 + * @see proto service: ibc.core.connection.v1.ClientConnections + */ +export const getClientConnections = buildQuery({ + encode: QueryClientConnectionsRequest.encode, + decode: QueryClientConnectionsResponse.decode, + service: "ibc.core.connection.v1.Query", + method: "ClientConnections" +}); +/** + * ConnectionClientState queries the client state associated with the + * connection. + * @name getConnectionClientState + * @package ibc.core.connection.v1 + * @see proto service: ibc.core.connection.v1.ConnectionClientState + */ +export const getConnectionClientState = buildQuery({ + encode: QueryConnectionClientStateRequest.encode, + decode: QueryConnectionClientStateResponse.decode, + service: "ibc.core.connection.v1.Query", + method: "ConnectionClientState" +}); +/** + * ConnectionConsensusState queries the consensus state associated with the + * connection. + * @name getConnectionConsensusState + * @package ibc.core.connection.v1 + * @see proto service: ibc.core.connection.v1.ConnectionConsensusState + */ +export const getConnectionConsensusState = buildQuery({ + encode: QueryConnectionConsensusStateRequest.encode, + decode: QueryConnectionConsensusStateResponse.decode, + service: "ibc.core.connection.v1.Query", + method: "ConnectionConsensusState" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputosmojs/ibc/core/connection/v1/tx.registry.ts b/__fixtures__/v-next/outputosmojs/ibc/core/connection/v1/tx.registry.ts index f01b0b714c..098219db92 100644 --- a/__fixtures__/v-next/outputosmojs/ibc/core/connection/v1/tx.registry.ts +++ b/__fixtures__/v-next/outputosmojs/ibc/core/connection/v1/tx.registry.ts @@ -1,14 +1,9 @@ import { Counterparty, CounterpartySDKType, Version, VersionSDKType } from "./connection"; import { Any, AnySDKType } from "../../../../google/protobuf/any"; import { Height, HeightSDKType } from "../../client/v1/client"; -import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { TelescopeGeneratedType } from "../../../../types"; import { MsgConnectionOpenInit, MsgConnectionOpenInitSDKType, MsgConnectionOpenTry, MsgConnectionOpenTrySDKType, MsgConnectionOpenAck, MsgConnectionOpenAckSDKType, MsgConnectionOpenConfirm, MsgConnectionOpenConfirmSDKType } from "./tx"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/ibc.core.connection.v1.MsgConnectionOpenInit", MsgConnectionOpenInit], ["/ibc.core.connection.v1.MsgConnectionOpenTry", MsgConnectionOpenTry], ["/ibc.core.connection.v1.MsgConnectionOpenAck", MsgConnectionOpenAck], ["/ibc.core.connection.v1.MsgConnectionOpenConfirm", MsgConnectionOpenConfirm]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/ibc.core.connection.v1.MsgConnectionOpenInit", MsgConnectionOpenInit], ["/ibc.core.connection.v1.MsgConnectionOpenTry", MsgConnectionOpenTry], ["/ibc.core.connection.v1.MsgConnectionOpenAck", MsgConnectionOpenAck], ["/ibc.core.connection.v1.MsgConnectionOpenConfirm", MsgConnectionOpenConfirm]]; export const MessageComposer = { encoded: { connectionOpenInit(value: MsgConnectionOpenInit) { diff --git a/__fixtures__/v-next/outputosmojs/ibc/core/connection/v1/tx.rpc.func.ts b/__fixtures__/v-next/outputosmojs/ibc/core/connection/v1/tx.rpc.func.ts new file mode 100644 index 0000000000..ea5f1a0814 --- /dev/null +++ b/__fixtures__/v-next/outputosmojs/ibc/core/connection/v1/tx.rpc.func.ts @@ -0,0 +1,42 @@ +import { Counterparty, CounterpartySDKType, Version, VersionSDKType } from "./connection"; +import { Any, AnySDKType } from "../../../../google/protobuf/any"; +import { Height, HeightSDKType } from "../../client/v1/client"; +import { buildTx } from "../../../../helper-func-types"; +import { MsgConnectionOpenInit, MsgConnectionOpenInitSDKType, MsgConnectionOpenInitResponse, MsgConnectionOpenInitResponseSDKType, MsgConnectionOpenTry, MsgConnectionOpenTrySDKType, MsgConnectionOpenTryResponse, MsgConnectionOpenTryResponseSDKType, MsgConnectionOpenAck, MsgConnectionOpenAckSDKType, MsgConnectionOpenAckResponse, MsgConnectionOpenAckResponseSDKType, MsgConnectionOpenConfirm, MsgConnectionOpenConfirmSDKType, MsgConnectionOpenConfirmResponse, MsgConnectionOpenConfirmResponseSDKType } from "./tx"; +/** + * ConnectionOpenInit defines a rpc handler method for MsgConnectionOpenInit. + * @name connectionOpenInit + * @package ibc.core.connection.v1 + * @see proto service: ibc.core.connection.v1.ConnectionOpenInit + */ +export const connectionOpenInit = buildTx({ + msg: MsgConnectionOpenInit +}); +/** + * ConnectionOpenTry defines a rpc handler method for MsgConnectionOpenTry. + * @name connectionOpenTry + * @package ibc.core.connection.v1 + * @see proto service: ibc.core.connection.v1.ConnectionOpenTry + */ +export const connectionOpenTry = buildTx({ + msg: MsgConnectionOpenTry +}); +/** + * ConnectionOpenAck defines a rpc handler method for MsgConnectionOpenAck. + * @name connectionOpenAck + * @package ibc.core.connection.v1 + * @see proto service: ibc.core.connection.v1.ConnectionOpenAck + */ +export const connectionOpenAck = buildTx({ + msg: MsgConnectionOpenAck +}); +/** + * ConnectionOpenConfirm defines a rpc handler method for + * MsgConnectionOpenConfirm. + * @name connectionOpenConfirm + * @package ibc.core.connection.v1 + * @see proto service: ibc.core.connection.v1.ConnectionOpenConfirm + */ +export const connectionOpenConfirm = buildTx({ + msg: MsgConnectionOpenConfirm +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputosmojs/ibc/core/connection/v1/tx.rpc.msg.ts b/__fixtures__/v-next/outputosmojs/ibc/core/connection/v1/tx.rpc.msg.ts index e4818a48ea..73d830a74a 100644 --- a/__fixtures__/v-next/outputosmojs/ibc/core/connection/v1/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputosmojs/ibc/core/connection/v1/tx.rpc.msg.ts @@ -1,7 +1,7 @@ import { Counterparty, CounterpartySDKType, Version, VersionSDKType } from "./connection"; import { Any, AnySDKType } from "../../../../google/protobuf/any"; import { Height, HeightSDKType } from "../../client/v1/client"; -import { Rpc } from "../../../../helpers"; +import { TxRpc } from "../../../../types"; import { BinaryReader } from "../../../../binary"; import { MsgConnectionOpenInit, MsgConnectionOpenInitSDKType, MsgConnectionOpenInitResponse, MsgConnectionOpenInitResponseSDKType, MsgConnectionOpenTry, MsgConnectionOpenTrySDKType, MsgConnectionOpenTryResponse, MsgConnectionOpenTryResponseSDKType, MsgConnectionOpenAck, MsgConnectionOpenAckSDKType, MsgConnectionOpenAckResponse, MsgConnectionOpenAckResponseSDKType, MsgConnectionOpenConfirm, MsgConnectionOpenConfirmSDKType, MsgConnectionOpenConfirmResponse, MsgConnectionOpenConfirmResponseSDKType } from "./tx"; /** Msg defines the ibc/connection Msg service. */ @@ -19,8 +19,8 @@ export interface Msg { connectionOpenConfirm(request: MsgConnectionOpenConfirm): Promise; } export class MsgClientImpl implements Msg { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.connectionOpenInit = this.connectionOpenInit.bind(this); this.connectionOpenTry = this.connectionOpenTry.bind(this); @@ -48,6 +48,6 @@ export class MsgClientImpl implements Msg { return promise.then(data => MsgConnectionOpenConfirmResponse.decode(new BinaryReader(data))); } } -export const createClientImpl = (rpc: Rpc) => { +export const createClientImpl = (rpc: TxRpc) => { return new MsgClientImpl(rpc); }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputosmojs/ibc/core/port/v1/query.rpc.Query.ts b/__fixtures__/v-next/outputosmojs/ibc/core/port/v1/query.rpc.Query.ts index 98ce2a3cf3..4ef3545c86 100644 --- a/__fixtures__/v-next/outputosmojs/ibc/core/port/v1/query.rpc.Query.ts +++ b/__fixtures__/v-next/outputosmojs/ibc/core/port/v1/query.rpc.Query.ts @@ -1,5 +1,5 @@ import { Order, OrderSDKType, Counterparty, CounterpartySDKType } from "../../channel/v1/channel"; -import { Rpc } from "../../../../helpers"; +import { TxRpc } from "../../../../types"; import { BinaryReader } from "../../../../binary"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; import { QueryAppVersionRequest, QueryAppVersionRequestSDKType, QueryAppVersionResponse, QueryAppVersionResponseSDKType } from "./query"; @@ -9,8 +9,8 @@ export interface Query { appVersion(request: QueryAppVersionRequest): Promise; } export class QueryClientImpl implements Query { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.appVersion = this.appVersion.bind(this); } diff --git a/__fixtures__/v-next/outputosmojs/ibc/core/port/v1/query.rpc.func.ts b/__fixtures__/v-next/outputosmojs/ibc/core/port/v1/query.rpc.func.ts new file mode 100644 index 0000000000..51096ee97c --- /dev/null +++ b/__fixtures__/v-next/outputosmojs/ibc/core/port/v1/query.rpc.func.ts @@ -0,0 +1,15 @@ +import { Order, OrderSDKType, Counterparty, CounterpartySDKType } from "../../channel/v1/channel"; +import { EndpointOrRpc, buildQuery } from "../../../../helper-func-types"; +import { QueryAppVersionRequest, QueryAppVersionRequestSDKType, QueryAppVersionResponse, QueryAppVersionResponseSDKType } from "./query"; +/** + * AppVersion queries an IBC Port and determines the appropriate application version to be used + * @name getAppVersion + * @package ibc.core.port.v1 + * @see proto service: ibc.core.port.v1.AppVersion + */ +export const getAppVersion = buildQuery({ + encode: QueryAppVersionRequest.encode, + decode: QueryAppVersionResponse.decode, + service: "ibc.core.port.v1.Query", + method: "AppVersion" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputosmojs/index.ts b/__fixtures__/v-next/outputosmojs/index.ts index 284b09ae56..bbd88ad1b9 100644 --- a/__fixtures__/v-next/outputosmojs/index.ts +++ b/__fixtures__/v-next/outputosmojs/index.ts @@ -26,6 +26,7 @@ export * from "./capability/bundle"; export * from "./hooks"; export * from "./mobx.stores"; export * from "./extern"; +export * from "./helper-func-types"; export * from "./react-query"; export * from "./mobx"; export * from "./pinia-endpoint"; @@ -33,4 +34,5 @@ export * from "./json-safe"; export * from "./varint"; export * from "./utf8"; export * from "./binary"; +export * from "./types"; export * from "./pinia.store"; \ No newline at end of file diff --git a/__fixtures__/v-next/outputosmojs/osmosis/accum/v1beta1/accum.ts b/__fixtures__/v-next/outputosmojs/osmosis/accum/v1beta1/accum.ts index b04f8713ec..cc8abf66e0 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/accum/v1beta1/accum.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/accum/v1beta1/accum.ts @@ -1,6 +1,6 @@ import { DecCoin, DecCoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { Decimal } from "@cosmjs/math"; +import { Decimal } from "@interchainjs/math"; import { isSet, DeepPartial } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "osmosis.accum.v1beta1"; @@ -169,7 +169,7 @@ export const AccumulatorContent = { } else { obj.accum_value = message.accumValue; } - obj.total_shares = message.totalShares === "" ? undefined : message.totalShares; + obj.total_shares = message.totalShares === "" ? undefined : Decimal.fromUserInput(message.totalShares, 18).atomics; return obj; }, fromAminoMsg(object: AccumulatorContentAminoMsg): AccumulatorContent { @@ -406,7 +406,7 @@ export const Record = { }, toAmino(message: Record): RecordAmino { const obj: any = {}; - obj.num_shares = message.numShares === "" ? undefined : message.numShares; + obj.num_shares = message.numShares === "" ? undefined : Decimal.fromUserInput(message.numShares, 18).atomics; if (message.initAccumValue) { obj.init_accum_value = message.initAccumValue.map(e => e ? DecCoin.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputosmojs/osmosis/bundle.ts b/__fixtures__/v-next/outputosmojs/osmosis/bundle.ts index 1e45e92a2a..f4c2e1d07b 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/bundle.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/bundle.ts @@ -75,83 +75,113 @@ import * as _348 from "./protorev/v1beta1/tx"; import * as _349 from "./valset-pref/v1beta1/query"; import * as _350 from "./valset-pref/v1beta1/state"; import * as _351 from "./valset-pref/v1beta1/tx"; -import * as _550 from "./gamm/pool-models/balancer/tx/tx.amino"; -import * as _551 from "./gamm/pool-models/stableswap/tx.amino"; -import * as _552 from "./gamm/v1beta1/tx.amino"; -import * as _553 from "./incentives/tx.amino"; -import * as _554 from "./lockup/tx.amino"; -import * as _555 from "./superfluid/tx.amino"; -import * as _556 from "./tokenfactory/v1beta1/tx.amino"; -import * as _557 from "./concentrated-liquidity/tx.amino"; -import * as _558 from "./poolmanager/v1beta1/tx.amino"; -import * as _559 from "./protorev/v1beta1/tx.amino"; -import * as _560 from "./valset-pref/v1beta1/tx.amino"; -import * as _561 from "./gamm/pool-models/balancer/tx/tx.registry"; -import * as _562 from "./gamm/pool-models/stableswap/tx.registry"; -import * as _563 from "./gamm/v1beta1/tx.registry"; -import * as _564 from "./incentives/tx.registry"; -import * as _565 from "./lockup/tx.registry"; -import * as _566 from "./superfluid/tx.registry"; -import * as _567 from "./tokenfactory/v1beta1/tx.registry"; -import * as _568 from "./concentrated-liquidity/tx.registry"; -import * as _569 from "./poolmanager/v1beta1/tx.registry"; -import * as _570 from "./protorev/v1beta1/tx.registry"; -import * as _571 from "./valset-pref/v1beta1/tx.registry"; -import * as _572 from "./claim/v1beta1/query.lcd"; -import * as _573 from "./epochs/query.lcd"; -import * as _574 from "./gamm/v1beta1/query.lcd"; -import * as _575 from "./gamm/v2/query.lcd"; -import * as _576 from "./ibc-rate-limit/v1beta1/query.lcd"; -import * as _577 from "./incentives/query.lcd"; -import * as _578 from "./lockup/query.lcd"; -import * as _579 from "./mint/v1beta1/query.lcd"; -import * as _580 from "./pool-incentives/v1beta1/query.lcd"; -import * as _581 from "./superfluid/query.lcd"; -import * as _582 from "./tokenfactory/v1beta1/query.lcd"; -import * as _583 from "./twap/v1beta1/query.lcd"; -import * as _584 from "./txfees/v1beta1/query.lcd"; -import * as _585 from "./concentrated-liquidity/pool-model/query.lcd"; -import * as _586 from "./cosmwasmpool/v1beta1/query.lcd"; -import * as _587 from "./downtime-detector/v1beta1/query.lcd"; -import * as _588 from "./poolmanager/v1beta1/query.lcd"; -import * as _589 from "./protorev/v1beta1/query.lcd"; -import * as _590 from "./valset-pref/v1beta1/query.lcd"; -import * as _591 from "./claim/v1beta1/query.rpc.Query"; -import * as _592 from "./epochs/query.rpc.Query"; -import * as _593 from "./gamm/v1beta1/query.rpc.Query"; -import * as _594 from "./gamm/v2/query.rpc.Query"; -import * as _595 from "./ibc-rate-limit/v1beta1/query.rpc.Query"; -import * as _596 from "./incentives/query.rpc.Query"; -import * as _597 from "./lockup/query.rpc.Query"; -import * as _598 from "./mint/v1beta1/query.rpc.Query"; -import * as _599 from "./pool-incentives/v1beta1/query.rpc.Query"; -import * as _600 from "./superfluid/query.rpc.Query"; -import * as _601 from "./tokenfactory/v1beta1/query.rpc.Query"; -import * as _602 from "./twap/v1beta1/query.rpc.Query"; -import * as _603 from "./txfees/v1beta1/query.rpc.Query"; -import * as _604 from "./concentrated-liquidity/pool-model/query.rpc.Query"; -import * as _605 from "./cosmwasmpool/v1beta1/query.rpc.Query"; -import * as _606 from "./downtime-detector/v1beta1/query.rpc.Query"; -import * as _607 from "./poolmanager/v1beta1/query.rpc.Query"; -import * as _608 from "./protorev/v1beta1/query.rpc.Query"; -import * as _609 from "./valset-pref/v1beta1/query.rpc.Query"; -import * as _610 from "./gamm/pool-models/balancer/tx/tx.rpc.msg"; -import * as _611 from "./gamm/pool-models/stableswap/tx.rpc.msg"; -import * as _612 from "./gamm/v1beta1/tx.rpc.msg"; -import * as _613 from "./incentives/tx.rpc.msg"; -import * as _614 from "./lockup/tx.rpc.msg"; -import * as _615 from "./superfluid/tx.rpc.msg"; -import * as _616 from "./tokenfactory/v1beta1/tx.rpc.msg"; -import * as _617 from "./concentrated-liquidity/tx.rpc.msg"; -import * as _618 from "./poolmanager/v1beta1/tx.rpc.msg"; -import * as _619 from "./protorev/v1beta1/tx.rpc.msg"; -import * as _620 from "./valset-pref/v1beta1/tx.rpc.msg"; -import * as _621 from "./gamm/v1beta1/query.pinia.store"; -import * as _622 from "./gamm/v2/query.pinia.store"; -import * as _644 from "./lcd"; -import * as _645 from "./custom-lcd-client"; -import * as _646 from "./rpc.query"; -import * as _647 from "./rpc.tx"; +import * as _628 from "./gamm/pool-models/balancer/tx/tx.amino"; +import * as _629 from "./gamm/pool-models/stableswap/tx.amino"; +import * as _630 from "./gamm/v1beta1/tx.amino"; +import * as _631 from "./incentives/tx.amino"; +import * as _632 from "./lockup/tx.amino"; +import * as _633 from "./superfluid/tx.amino"; +import * as _634 from "./tokenfactory/v1beta1/tx.amino"; +import * as _635 from "./concentrated-liquidity/tx.amino"; +import * as _636 from "./poolmanager/v1beta1/tx.amino"; +import * as _637 from "./protorev/v1beta1/tx.amino"; +import * as _638 from "./valset-pref/v1beta1/tx.amino"; +import * as _639 from "./gamm/pool-models/balancer/tx/tx.registry"; +import * as _640 from "./gamm/pool-models/stableswap/tx.registry"; +import * as _641 from "./gamm/v1beta1/tx.registry"; +import * as _642 from "./incentives/tx.registry"; +import * as _643 from "./lockup/tx.registry"; +import * as _644 from "./superfluid/tx.registry"; +import * as _645 from "./tokenfactory/v1beta1/tx.registry"; +import * as _646 from "./concentrated-liquidity/tx.registry"; +import * as _647 from "./poolmanager/v1beta1/tx.registry"; +import * as _648 from "./protorev/v1beta1/tx.registry"; +import * as _649 from "./valset-pref/v1beta1/tx.registry"; +import * as _650 from "./claim/v1beta1/query.lcd"; +import * as _651 from "./epochs/query.lcd"; +import * as _652 from "./gamm/v1beta1/query.lcd"; +import * as _653 from "./gamm/v2/query.lcd"; +import * as _654 from "./ibc-rate-limit/v1beta1/query.lcd"; +import * as _655 from "./incentives/query.lcd"; +import * as _656 from "./lockup/query.lcd"; +import * as _657 from "./mint/v1beta1/query.lcd"; +import * as _658 from "./pool-incentives/v1beta1/query.lcd"; +import * as _659 from "./superfluid/query.lcd"; +import * as _660 from "./tokenfactory/v1beta1/query.lcd"; +import * as _661 from "./twap/v1beta1/query.lcd"; +import * as _662 from "./txfees/v1beta1/query.lcd"; +import * as _663 from "./concentrated-liquidity/pool-model/query.lcd"; +import * as _664 from "./cosmwasmpool/v1beta1/query.lcd"; +import * as _665 from "./downtime-detector/v1beta1/query.lcd"; +import * as _666 from "./poolmanager/v1beta1/query.lcd"; +import * as _667 from "./protorev/v1beta1/query.lcd"; +import * as _668 from "./valset-pref/v1beta1/query.lcd"; +import * as _669 from "./claim/v1beta1/query.rpc.func"; +import * as _670 from "./epochs/query.rpc.func"; +import * as _671 from "./gamm/v1beta1/query.rpc.func"; +import * as _672 from "./gamm/v2/query.rpc.func"; +import * as _673 from "./ibc-rate-limit/v1beta1/query.rpc.func"; +import * as _674 from "./incentives/query.rpc.func"; +import * as _675 from "./lockup/query.rpc.func"; +import * as _676 from "./mint/v1beta1/query.rpc.func"; +import * as _677 from "./pool-incentives/v1beta1/query.rpc.func"; +import * as _678 from "./superfluid/query.rpc.func"; +import * as _679 from "./tokenfactory/v1beta1/query.rpc.func"; +import * as _680 from "./twap/v1beta1/query.rpc.func"; +import * as _681 from "./txfees/v1beta1/query.rpc.func"; +import * as _682 from "./concentrated-liquidity/pool-model/query.rpc.func"; +import * as _683 from "./cosmwasmpool/v1beta1/query.rpc.func"; +import * as _684 from "./downtime-detector/v1beta1/query.rpc.func"; +import * as _685 from "./poolmanager/v1beta1/query.rpc.func"; +import * as _686 from "./protorev/v1beta1/query.rpc.func"; +import * as _687 from "./valset-pref/v1beta1/query.rpc.func"; +import * as _688 from "./claim/v1beta1/query.rpc.Query"; +import * as _689 from "./epochs/query.rpc.Query"; +import * as _690 from "./gamm/v1beta1/query.rpc.Query"; +import * as _691 from "./gamm/v2/query.rpc.Query"; +import * as _692 from "./ibc-rate-limit/v1beta1/query.rpc.Query"; +import * as _693 from "./incentives/query.rpc.Query"; +import * as _694 from "./lockup/query.rpc.Query"; +import * as _695 from "./mint/v1beta1/query.rpc.Query"; +import * as _696 from "./pool-incentives/v1beta1/query.rpc.Query"; +import * as _697 from "./superfluid/query.rpc.Query"; +import * as _698 from "./tokenfactory/v1beta1/query.rpc.Query"; +import * as _699 from "./twap/v1beta1/query.rpc.Query"; +import * as _700 from "./txfees/v1beta1/query.rpc.Query"; +import * as _701 from "./concentrated-liquidity/pool-model/query.rpc.Query"; +import * as _702 from "./cosmwasmpool/v1beta1/query.rpc.Query"; +import * as _703 from "./downtime-detector/v1beta1/query.rpc.Query"; +import * as _704 from "./poolmanager/v1beta1/query.rpc.Query"; +import * as _705 from "./protorev/v1beta1/query.rpc.Query"; +import * as _706 from "./valset-pref/v1beta1/query.rpc.Query"; +import * as _707 from "./gamm/pool-models/balancer/tx/tx.rpc.func"; +import * as _708 from "./gamm/pool-models/stableswap/tx.rpc.func"; +import * as _709 from "./gamm/v1beta1/tx.rpc.func"; +import * as _710 from "./incentives/tx.rpc.func"; +import * as _711 from "./lockup/tx.rpc.func"; +import * as _712 from "./superfluid/tx.rpc.func"; +import * as _713 from "./tokenfactory/v1beta1/tx.rpc.func"; +import * as _714 from "./concentrated-liquidity/tx.rpc.func"; +import * as _715 from "./poolmanager/v1beta1/tx.rpc.func"; +import * as _716 from "./protorev/v1beta1/tx.rpc.func"; +import * as _717 from "./valset-pref/v1beta1/tx.rpc.func"; +import * as _718 from "./gamm/pool-models/balancer/tx/tx.rpc.msg"; +import * as _719 from "./gamm/pool-models/stableswap/tx.rpc.msg"; +import * as _720 from "./gamm/v1beta1/tx.rpc.msg"; +import * as _721 from "./incentives/tx.rpc.msg"; +import * as _722 from "./lockup/tx.rpc.msg"; +import * as _723 from "./superfluid/tx.rpc.msg"; +import * as _724 from "./tokenfactory/v1beta1/tx.rpc.msg"; +import * as _725 from "./concentrated-liquidity/tx.rpc.msg"; +import * as _726 from "./poolmanager/v1beta1/tx.rpc.msg"; +import * as _727 from "./protorev/v1beta1/tx.rpc.msg"; +import * as _728 from "./valset-pref/v1beta1/tx.rpc.msg"; +import * as _729 from "./gamm/v1beta1/query.pinia.store"; +import * as _730 from "./gamm/v2/query.pinia.store"; +import * as _753 from "./lcd"; +import * as _754 from "./custom-lcd-client"; +import * as _755 from "./rpc.query"; +import * as _756 from "./rpc.tx"; export namespace osmosis { export namespace claim { export const v1beta1 = { @@ -159,16 +189,18 @@ export namespace osmosis { ..._276, ..._277, ..._278, - ..._572, - ..._591 + ..._650, + ..._669, + ..._688 }; } export namespace epochs { export const v1beta1 = { ..._279, ..._280, - ..._573, - ..._592 + ..._651, + ..._670, + ..._689 }; } export namespace gamm { @@ -178,37 +210,42 @@ export namespace osmosis { ..._283, ..._284, ..._285, - ..._552, - ..._563, - ..._574, - ..._593, - ..._612, - ..._621 + ..._630, + ..._641, + ..._652, + ..._671, + ..._690, + ..._709, + ..._720, + ..._729 }; export namespace poolmodels { export namespace balancer { export const v1beta1 = { ..._286, - ..._550, - ..._561, - ..._610 + ..._628, + ..._639, + ..._707, + ..._718 }; } export namespace stableswap { export const v1beta1 = { ..._287, ..._288, - ..._551, - ..._562, - ..._611 + ..._629, + ..._640, + ..._708, + ..._719 }; } } export const v2 = { ..._289, - ..._575, - ..._594, - ..._622 + ..._653, + ..._672, + ..._691, + ..._730 }; } export namespace ibcratelimit { @@ -216,8 +253,9 @@ export namespace osmosis { ..._290, ..._291, ..._292, - ..._576, - ..._595 + ..._654, + ..._673, + ..._692 }; } export const incentives = { @@ -226,11 +264,13 @@ export namespace osmosis { ..._295, ..._296, ..._297, - ..._553, - ..._564, - ..._577, - ..._596, - ..._613 + ..._631, + ..._642, + ..._655, + ..._674, + ..._693, + ..._710, + ..._721 }; export const lockup = { ..._298, @@ -238,19 +278,22 @@ export namespace osmosis { ..._300, ..._301, ..._302, - ..._554, - ..._565, - ..._578, - ..._597, - ..._614 + ..._632, + ..._643, + ..._656, + ..._675, + ..._694, + ..._711, + ..._722 }; export namespace mint { export const v1beta1 = { ..._303, ..._304, ..._305, - ..._579, - ..._598 + ..._657, + ..._676, + ..._695 }; } export namespace poolincentives { @@ -259,8 +302,9 @@ export namespace osmosis { ..._307, ..._308, ..._309, - ..._580, - ..._599 + ..._658, + ..._677, + ..._696 }; } export namespace store { @@ -274,11 +318,13 @@ export namespace osmosis { ..._313, ..._314, ..._315, - ..._555, - ..._566, - ..._581, - ..._600, - ..._615 + ..._633, + ..._644, + ..._659, + ..._678, + ..._697, + ..._712, + ..._723 }; export namespace tokenfactory { export const v1beta1 = { @@ -287,11 +333,13 @@ export namespace osmosis { ..._318, ..._319, ..._320, - ..._556, - ..._567, - ..._582, - ..._601, - ..._616 + ..._634, + ..._645, + ..._660, + ..._679, + ..._698, + ..._713, + ..._724 }; } export namespace twap { @@ -299,8 +347,9 @@ export namespace osmosis { ..._321, ..._322, ..._323, - ..._583, - ..._602 + ..._661, + ..._680, + ..._699 }; } export namespace txfees { @@ -309,8 +358,9 @@ export namespace osmosis { ..._325, ..._326, ..._327, - ..._584, - ..._603 + ..._662, + ..._681, + ..._700 }; } export namespace accum { @@ -321,11 +371,13 @@ export namespace osmosis { export const concentratedliquidity = { ..._329, v1beta1: { - ..._557, - ..._568, - ..._585, - ..._604, - ..._617 + ..._635, + ..._646, + ..._663, + ..._682, + ..._701, + ..._714, + ..._725 } }; export namespace cosmwasmpool { @@ -335,8 +387,9 @@ export namespace osmosis { ..._332, ..._333, ..._334, - ..._586, - ..._605 + ..._664, + ..._683, + ..._702 }; } export namespace downtimedetector { @@ -344,8 +397,9 @@ export namespace osmosis { ..._335, ..._336, ..._337, - ..._587, - ..._606 + ..._665, + ..._684, + ..._703 }; } export namespace poolmanager { @@ -355,11 +409,13 @@ export namespace osmosis { ..._340, ..._341, ..._342, - ..._558, - ..._569, - ..._588, - ..._607, - ..._618 + ..._636, + ..._647, + ..._666, + ..._685, + ..._704, + ..._715, + ..._726 }; } export namespace protorev { @@ -370,11 +426,13 @@ export namespace osmosis { ..._346, ..._347, ..._348, - ..._559, - ..._570, - ..._589, - ..._608, - ..._619 + ..._637, + ..._648, + ..._667, + ..._686, + ..._705, + ..._716, + ..._727 }; } export namespace valsetpref { @@ -382,17 +440,19 @@ export namespace osmosis { ..._349, ..._350, ..._351, - ..._560, - ..._571, - ..._590, - ..._609, - ..._620 + ..._638, + ..._649, + ..._668, + ..._687, + ..._706, + ..._717, + ..._728 }; } export const ClientFactory = { - ..._644, - ..._645, - ..._646, - ..._647 + ..._753, + ..._754, + ..._755, + ..._756 }; } \ No newline at end of file diff --git a/__fixtures__/v-next/outputosmojs/osmosis/claim/v1beta1/query.rpc.Query.ts b/__fixtures__/v-next/outputosmojs/osmosis/claim/v1beta1/query.rpc.Query.ts index c8d2daa079..9666e3591a 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/claim/v1beta1/query.rpc.Query.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/claim/v1beta1/query.rpc.Query.ts @@ -1,7 +1,7 @@ import { Action, ActionSDKType, ClaimRecord, ClaimRecordSDKType } from "./claim"; import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { Params, ParamsSDKType } from "./params"; -import { Rpc } from "../../../helpers"; +import { TxRpc } from "../../../types"; import { BinaryReader } from "../../../binary"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; import { QueryModuleAccountBalanceRequest, QueryModuleAccountBalanceRequestSDKType, QueryModuleAccountBalanceResponse, QueryModuleAccountBalanceResponseSDKType, QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, QueryClaimRecordRequest, QueryClaimRecordRequestSDKType, QueryClaimRecordResponse, QueryClaimRecordResponseSDKType, QueryClaimableForActionRequest, QueryClaimableForActionRequestSDKType, QueryClaimableForActionResponse, QueryClaimableForActionResponseSDKType, QueryTotalClaimableRequest, QueryTotalClaimableRequestSDKType, QueryTotalClaimableResponse, QueryTotalClaimableResponseSDKType } from "./query"; @@ -14,8 +14,8 @@ export interface Query { totalClaimable(request: QueryTotalClaimableRequest): Promise; } export class QueryClientImpl implements Query { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.moduleAccountBalance = this.moduleAccountBalance.bind(this); this.params = this.params.bind(this); diff --git a/__fixtures__/v-next/outputosmojs/osmosis/claim/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputosmojs/osmosis/claim/v1beta1/query.rpc.func.ts new file mode 100644 index 0000000000..533eec15e2 --- /dev/null +++ b/__fixtures__/v-next/outputosmojs/osmosis/claim/v1beta1/query.rpc.func.ts @@ -0,0 +1,60 @@ +import { Action, ActionSDKType, ClaimRecord, ClaimRecordSDKType } from "./claim"; +import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; +import { Params, ParamsSDKType } from "./params"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { QueryModuleAccountBalanceRequest, QueryModuleAccountBalanceRequestSDKType, QueryModuleAccountBalanceResponse, QueryModuleAccountBalanceResponseSDKType, QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, QueryClaimRecordRequest, QueryClaimRecordRequestSDKType, QueryClaimRecordResponse, QueryClaimRecordResponseSDKType, QueryClaimableForActionRequest, QueryClaimableForActionRequestSDKType, QueryClaimableForActionResponse, QueryClaimableForActionResponseSDKType, QueryTotalClaimableRequest, QueryTotalClaimableRequestSDKType, QueryTotalClaimableResponse, QueryTotalClaimableResponseSDKType } from "./query"; +/** + * @name getModuleAccountBalance + * @package osmosis.claim.v1beta1 + * @see proto service: osmosis.claim.v1beta1.ModuleAccountBalance + */ +export const getModuleAccountBalance = buildQuery({ + encode: QueryModuleAccountBalanceRequest.encode, + decode: QueryModuleAccountBalanceResponse.decode, + service: "osmosis.claim.v1beta1.Query", + method: "ModuleAccountBalance" +}); +/** + * @name getParams + * @package osmosis.claim.v1beta1 + * @see proto service: osmosis.claim.v1beta1.Params + */ +export const getParams = buildQuery({ + encode: QueryParamsRequest.encode, + decode: QueryParamsResponse.decode, + service: "osmosis.claim.v1beta1.Query", + method: "Params" +}); +/** + * @name getClaimRecord + * @package osmosis.claim.v1beta1 + * @see proto service: osmosis.claim.v1beta1.ClaimRecord + */ +export const getClaimRecord = buildQuery({ + encode: QueryClaimRecordRequest.encode, + decode: QueryClaimRecordResponse.decode, + service: "osmosis.claim.v1beta1.Query", + method: "ClaimRecord" +}); +/** + * @name getClaimableForAction + * @package osmosis.claim.v1beta1 + * @see proto service: osmosis.claim.v1beta1.ClaimableForAction + */ +export const getClaimableForAction = buildQuery({ + encode: QueryClaimableForActionRequest.encode, + decode: QueryClaimableForActionResponse.decode, + service: "osmosis.claim.v1beta1.Query", + method: "ClaimableForAction" +}); +/** + * @name getTotalClaimable + * @package osmosis.claim.v1beta1 + * @see proto service: osmosis.claim.v1beta1.TotalClaimable + */ +export const getTotalClaimable = buildQuery({ + encode: QueryTotalClaimableRequest.encode, + decode: QueryTotalClaimableResponse.decode, + service: "osmosis.claim.v1beta1.Query", + method: "TotalClaimable" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/incentive_record.ts b/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/incentive_record.ts index 7239dcfc1f..6fb6fa4356 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/incentive_record.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/incentive_record.ts @@ -3,7 +3,7 @@ import { Timestamp, TimestampSDKType } from "../../google/protobuf/timestamp"; import { BinaryReader, BinaryWriter } from "../../binary"; import { isSet, DeepPartial, toTimestamp, fromTimestamp } from "../../helpers"; import { JsonSafe } from "../../json-safe"; -import { Decimal } from "@cosmjs/math"; +import { Decimal } from "@interchainjs/math"; export const protobufPackage = "osmosis.concentratedliquidity.v1beta1"; /** * IncentiveRecord is the high-level struct we use to deal with an independent @@ -374,8 +374,8 @@ export const IncentiveRecordBody = { }, toAmino(message: IncentiveRecordBody): IncentiveRecordBodyAmino { const obj: any = {}; - obj.remaining_amount = message.remainingAmount === "" ? undefined : message.remainingAmount; - obj.emission_rate = message.emissionRate === "" ? undefined : message.emissionRate; + obj.remaining_amount = message.remainingAmount === "" ? undefined : Decimal.fromUserInput(message.remainingAmount, 18).atomics; + obj.emission_rate = message.emissionRate === "" ? undefined : Decimal.fromUserInput(message.emissionRate, 18).atomics; obj.start_time = message.startTime ? Timestamp.toAmino(toTimestamp(message.startTime)) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/params.ts b/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/params.ts index 8aa6d28e49..8b638e2145 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/params.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/params.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { Decimal } from "@cosmjs/math"; +import { Decimal } from "@interchainjs/math"; import { JsonSafe } from "../../json-safe"; import { DeepPartial } from "../../helpers"; export const protobufPackage = "osmosis.concentratedliquidity"; @@ -148,7 +148,7 @@ export const Params = { obj.authorized_tick_spacing = message.authorizedTickSpacing; } if (message.authorizedSwapFees) { - obj.authorized_swap_fees = message.authorizedSwapFees.map(e => e); + obj.authorized_swap_fees = message.authorizedSwapFees.map(e => Decimal.fromUserInput(e, 18).atomics); } else { obj.authorized_swap_fees = message.authorizedSwapFees; } diff --git a/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/pool-model/query.rpc.Query.ts b/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/pool-model/query.rpc.Query.ts index bab32d3de6..5ac4f2015a 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/pool-model/query.rpc.Query.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/pool-model/query.rpc.Query.ts @@ -3,7 +3,7 @@ import { PositionWithUnderlyingAssetBreakdown, PositionWithUnderlyingAssetBreakd import { Any, AnySDKType } from "../../../google/protobuf/any"; import { Params, ParamsSDKType } from "../params"; import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; -import { Rpc } from "../../../helpers"; +import { TxRpc } from "../../../types"; import { BinaryReader } from "../../../binary"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; import { QueryPoolsRequest, QueryPoolsRequestSDKType, QueryPoolsResponse, QueryPoolsResponseSDKType, QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, QueryUserPositionsRequest, QueryUserPositionsRequestSDKType, QueryUserPositionsResponse, QueryUserPositionsResponseSDKType, QueryTotalLiquidityForRangeRequest, QueryTotalLiquidityForRangeRequestSDKType, QueryTotalLiquidityForRangeResponse, QueryTotalLiquidityForRangeResponseSDKType, QueryLiquidityNetInDirectionRequest, QueryLiquidityNetInDirectionRequestSDKType, QueryLiquidityNetInDirectionResponse, QueryLiquidityNetInDirectionResponseSDKType, QueryClaimableFeesRequest, QueryClaimableFeesRequestSDKType, QueryClaimableFeesResponse, QueryClaimableFeesResponseSDKType, QueryPositionByIdRequest, QueryPositionByIdRequestSDKType, QueryPositionByIdResponse, QueryPositionByIdResponseSDKType } from "./query"; @@ -31,8 +31,8 @@ export interface Query { positionById(request: QueryPositionByIdRequest): Promise; } export class QueryClientImpl implements Query { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.pools = this.pools.bind(this); this.params = this.params.bind(this); diff --git a/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/pool-model/query.rpc.func.ts b/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/pool-model/query.rpc.func.ts new file mode 100644 index 0000000000..53ce111c57 --- /dev/null +++ b/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/pool-model/query.rpc.func.ts @@ -0,0 +1,94 @@ +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination"; +import { PositionWithUnderlyingAssetBreakdown, PositionWithUnderlyingAssetBreakdownSDKType } from "../position"; +import { Any, AnySDKType } from "../../../google/protobuf/any"; +import { Params, ParamsSDKType } from "../params"; +import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { QueryPoolsRequest, QueryPoolsRequestSDKType, QueryPoolsResponse, QueryPoolsResponseSDKType, QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, QueryUserPositionsRequest, QueryUserPositionsRequestSDKType, QueryUserPositionsResponse, QueryUserPositionsResponseSDKType, QueryTotalLiquidityForRangeRequest, QueryTotalLiquidityForRangeRequestSDKType, QueryTotalLiquidityForRangeResponse, QueryTotalLiquidityForRangeResponseSDKType, QueryLiquidityNetInDirectionRequest, QueryLiquidityNetInDirectionRequestSDKType, QueryLiquidityNetInDirectionResponse, QueryLiquidityNetInDirectionResponseSDKType, QueryClaimableFeesRequest, QueryClaimableFeesRequestSDKType, QueryClaimableFeesResponse, QueryClaimableFeesResponseSDKType, QueryPositionByIdRequest, QueryPositionByIdRequestSDKType, QueryPositionByIdResponse, QueryPositionByIdResponseSDKType } from "./query"; +/** + * Pools returns all concentrated liquidity pools + * @name getPools + * @package osmosis.concentratedliquidity.v1beta1 + * @see proto service: osmosis.concentratedliquidity.v1beta1.Pools + */ +export const getPools = buildQuery({ + encode: QueryPoolsRequest.encode, + decode: QueryPoolsResponse.decode, + service: "osmosis.concentratedliquidity.v1beta1.Query", + method: "Pools" +}); +/** + * Params returns concentrated liquidity module params. + * @name getParams + * @package osmosis.concentratedliquidity.v1beta1 + * @see proto service: osmosis.concentratedliquidity.v1beta1.Params + */ +export const getParams = buildQuery({ + encode: QueryParamsRequest.encode, + decode: QueryParamsResponse.decode, + service: "osmosis.concentratedliquidity.v1beta1.Query", + method: "Params" +}); +/** + * UserPositions returns all concentrated positions of some address. + * @name getUserPositions + * @package osmosis.concentratedliquidity.v1beta1 + * @see proto service: osmosis.concentratedliquidity.v1beta1.UserPositions + */ +export const getUserPositions = buildQuery({ + encode: QueryUserPositionsRequest.encode, + decode: QueryUserPositionsResponse.decode, + service: "osmosis.concentratedliquidity.v1beta1.Query", + method: "UserPositions" +}); +/** + * TotalLiquidityForRange the amount of liquidity existing within given range. + * @name getTotalLiquidityForRange + * @package osmosis.concentratedliquidity.v1beta1 + * @see proto service: osmosis.concentratedliquidity.v1beta1.TotalLiquidityForRange + */ +export const getTotalLiquidityForRange = buildQuery({ + encode: QueryTotalLiquidityForRangeRequest.encode, + decode: QueryTotalLiquidityForRangeResponse.decode, + service: "osmosis.concentratedliquidity.v1beta1.Query", + method: "TotalLiquidityForRange" +}); +/** + * LiquidityNetInDirection returns liquidity net in the direction given. + * Uses the bound if specified, if not uses either min tick / max tick + * depending on the direction. + * @name getLiquidityNetInDirection + * @package osmosis.concentratedliquidity.v1beta1 + * @see proto service: osmosis.concentratedliquidity.v1beta1.LiquidityNetInDirection + */ +export const getLiquidityNetInDirection = buildQuery({ + encode: QueryLiquidityNetInDirectionRequest.encode, + decode: QueryLiquidityNetInDirectionResponse.decode, + service: "osmosis.concentratedliquidity.v1beta1.Query", + method: "LiquidityNetInDirection" +}); +/** + * ClaimableFees returns the amount of fees that can be claimed by a position + * with the given id. + * @name getClaimableFees + * @package osmosis.concentratedliquidity.v1beta1 + * @see proto service: osmosis.concentratedliquidity.v1beta1.ClaimableFees + */ +export const getClaimableFees = buildQuery({ + encode: QueryClaimableFeesRequest.encode, + decode: QueryClaimableFeesResponse.decode, + service: "osmosis.concentratedliquidity.v1beta1.Query", + method: "ClaimableFees" +}); +/** + * PositionById returns a position with the given id. + * @name getPositionById + * @package osmosis.concentratedliquidity.v1beta1 + * @see proto service: osmosis.concentratedliquidity.v1beta1.PositionById + */ +export const getPositionById = buildQuery({ + encode: QueryPositionByIdRequest.encode, + decode: QueryPositionByIdResponse.decode, + service: "osmosis.concentratedliquidity.v1beta1.Query", + method: "PositionById" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/pool-model/query.ts b/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/pool-model/query.ts index 36a5930d2e..276b634611 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/pool-model/query.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/pool-model/query.ts @@ -6,7 +6,7 @@ import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { isSet, DeepPartial } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; -import { Decimal } from "@cosmjs/math"; +import { Decimal } from "@interchainjs/math"; export const protobufPackage = "osmosis.concentratedliquidity.v1beta1"; /** * =============================== UserPositions @@ -1283,7 +1283,7 @@ export const TickLiquidityNet = { }, toAmino(message: TickLiquidityNet): TickLiquidityNetAmino { const obj: any = {}; - obj.liquidity_net = message.liquidityNet === "" ? undefined : message.liquidityNet; + obj.liquidity_net = message.liquidityNet === "" ? undefined : Decimal.fromUserInput(message.liquidityNet, 18).atomics; obj.tick_index = message.tickIndex === "" ? undefined : message.tickIndex; return obj; }, @@ -1415,7 +1415,7 @@ export const LiquidityDepthWithRange = { }, toAmino(message: LiquidityDepthWithRange): LiquidityDepthWithRangeAmino { const obj: any = {}; - obj.liquidity_amount = message.liquidityAmount === "" ? undefined : message.liquidityAmount; + obj.liquidity_amount = message.liquidityAmount === "" ? undefined : Decimal.fromUserInput(message.liquidityAmount, 18).atomics; obj.lower_tick = message.lowerTick === "" ? undefined : message.lowerTick; obj.upper_tick = message.upperTick === "" ? undefined : message.upperTick; return obj; @@ -1711,7 +1711,7 @@ export const QueryLiquidityNetInDirectionResponse = { obj.liquidity_depths = message.liquidityDepths; } obj.current_tick = message.currentTick !== BigInt(0) ? message.currentTick?.toString() : undefined; - obj.current_liquidity = message.currentLiquidity === "" ? undefined : message.currentLiquidity; + obj.current_liquidity = message.currentLiquidity === "" ? undefined : Decimal.fromUserInput(message.currentLiquidity, 18).atomics; return obj; }, fromAminoMsg(object: QueryLiquidityNetInDirectionResponseAminoMsg): QueryLiquidityNetInDirectionResponse { diff --git a/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/pool-model/tx.ts b/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/pool-model/tx.ts index c868b8bc6f..8abb12f541 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/pool-model/tx.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/pool-model/tx.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { Decimal } from "@cosmjs/math"; +import { Decimal } from "@interchainjs/math"; import { isSet, DeepPartial } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "osmosis.concentratedliquidity.v1beta1"; @@ -217,7 +217,7 @@ export const MsgCreateConcentratedPool = { obj.denom1 = message.denom1 === "" ? undefined : message.denom1; obj.tick_spacing = message.tickSpacing !== BigInt(0) ? message.tickSpacing?.toString() : undefined; obj.exponent_at_price_one = message.exponentAtPriceOne === "" ? undefined : message.exponentAtPriceOne; - obj.swap_fee = message.swapFee === "" ? undefined : message.swapFee; + obj.swap_fee = message.swapFee === "" ? undefined : Decimal.fromUserInput(message.swapFee, 18).atomics; return obj; }, fromAminoMsg(object: MsgCreateConcentratedPoolAminoMsg): MsgCreateConcentratedPool { diff --git a/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/pool.ts b/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/pool.ts index 8f970e349a..bf81fa04db 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/pool.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/pool.ts @@ -1,6 +1,6 @@ import { Timestamp, TimestampSDKType } from "../../google/protobuf/timestamp"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { Decimal } from "@cosmjs/math"; +import { Decimal } from "@interchainjs/math"; import { toTimestamp, fromTimestamp, isSet, DeepPartial } from "../../helpers"; import { JsonSafe } from "../../json-safe"; export const protobufPackage = "osmosis.concentratedliquidity.v1beta1"; @@ -319,14 +319,14 @@ export const Pool = { obj.address = message.address === "" ? undefined : message.address; obj.incentives_address = message.incentivesAddress === "" ? undefined : message.incentivesAddress; obj.id = message.id !== BigInt(0) ? message.id?.toString() : undefined; - obj.current_tick_liquidity = message.currentTickLiquidity === "" ? undefined : message.currentTickLiquidity; + obj.current_tick_liquidity = message.currentTickLiquidity === "" ? undefined : Decimal.fromUserInput(message.currentTickLiquidity, 18).atomics; obj.token0 = message.token0 === "" ? undefined : message.token0; obj.token1 = message.token1 === "" ? undefined : message.token1; - obj.current_sqrt_price = message.currentSqrtPrice === "" ? undefined : message.currentSqrtPrice; + obj.current_sqrt_price = message.currentSqrtPrice === "" ? undefined : Decimal.fromUserInput(message.currentSqrtPrice, 18).atomics; obj.current_tick = message.currentTick === "" ? undefined : message.currentTick; obj.tick_spacing = message.tickSpacing !== BigInt(0) ? message.tickSpacing?.toString() : undefined; obj.exponent_at_price_one = message.exponentAtPriceOne === "" ? undefined : message.exponentAtPriceOne; - obj.swap_fee = message.swapFee === "" ? undefined : message.swapFee; + obj.swap_fee = message.swapFee === "" ? undefined : Decimal.fromUserInput(message.swapFee, 18).atomics; obj.last_liquidity_update = message.lastLiquidityUpdate ? Timestamp.toAmino(toTimestamp(message.lastLiquidityUpdate)) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/position.ts b/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/position.ts index 210354e655..d2b6e95ebe 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/position.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/position.ts @@ -2,7 +2,7 @@ import { Timestamp, TimestampSDKType } from "../../google/protobuf/timestamp"; import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../binary"; import { toTimestamp, fromTimestamp, isSet, DeepPartial } from "../../helpers"; -import { Decimal } from "@cosmjs/math"; +import { Decimal } from "@interchainjs/math"; import { JsonSafe } from "../../json-safe"; export const protobufPackage = "osmosis.concentratedliquidity.v1beta1"; /** @@ -243,7 +243,7 @@ export const Position = { obj.lower_tick = message.lowerTick !== BigInt(0) ? message.lowerTick?.toString() : undefined; obj.upper_tick = message.upperTick !== BigInt(0) ? message.upperTick?.toString() : undefined; obj.join_time = message.joinTime ? Timestamp.toAmino(toTimestamp(message.joinTime)) : undefined; - obj.liquidity = message.liquidity === "" ? undefined : message.liquidity; + obj.liquidity = message.liquidity === "" ? undefined : Decimal.fromUserInput(message.liquidity, 18).atomics; return obj; }, fromAminoMsg(object: PositionAminoMsg): Position { diff --git a/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/tickInfo.ts b/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/tickInfo.ts index d7cf8ba77b..33551db52e 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/tickInfo.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/tickInfo.ts @@ -1,6 +1,6 @@ import { DecCoin, DecCoinSDKType } from "../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { Decimal } from "@cosmjs/math"; +import { Decimal } from "@interchainjs/math"; import { isSet, DeepPartial } from "../../helpers"; import { JsonSafe } from "../../json-safe"; export const protobufPackage = "osmosis.concentratedliquidity.v1beta1"; @@ -184,8 +184,8 @@ export const TickInfo = { }, toAmino(message: TickInfo): TickInfoAmino { const obj: any = {}; - obj.liquidity_gross = message.liquidityGross === "" ? undefined : message.liquidityGross; - obj.liquidity_net = message.liquidityNet === "" ? undefined : message.liquidityNet; + obj.liquidity_gross = message.liquidityGross === "" ? undefined : Decimal.fromUserInput(message.liquidityGross, 18).atomics; + obj.liquidity_net = message.liquidityNet === "" ? undefined : Decimal.fromUserInput(message.liquidityNet, 18).atomics; if (message.feeGrowthOutside) { obj.fee_growth_outside = message.feeGrowthOutside.map(e => e ? DecCoin.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/tx.amino.ts b/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/tx.amino.ts index 1632416bcc..df7aa9484c 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/tx.amino.ts @@ -3,6 +3,7 @@ import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; import { Timestamp, TimestampSDKType } from "../../google/protobuf/timestamp"; import { Duration, DurationSDKType } from "../../google/protobuf/duration"; import { AminoMsg } from "@cosmjs/amino"; +import { Decimal } from "@interchainjs/math"; import { MsgCreatePosition, MsgCreatePositionSDKType, MsgWithdrawPosition, MsgWithdrawPositionSDKType, MsgCollectFees, MsgCollectFeesSDKType, MsgCollectIncentives, MsgCollectIncentivesSDKType, MsgFungifyChargedPositions, MsgFungifyChargedPositionsSDKType } from "./tx"; export interface MsgCreatePositionAminoType extends AminoMsg { type: "osmosis/concentratedliquidity/create-position"; @@ -120,7 +121,7 @@ export const AminoConverter = { return { position_id: positionId.toString(), sender, - liquidity_amount: liquidityAmount + liquidity_amount: Decimal.fromUserInput(liquidityAmount, 18).atomics }; }, fromAmino: ({ diff --git a/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/tx.registry.ts b/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/tx.registry.ts index 40ce079d81..ac92e85782 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/tx.registry.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/tx.registry.ts @@ -1,14 +1,9 @@ import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; import { Timestamp, TimestampSDKType } from "../../google/protobuf/timestamp"; import { Duration, DurationSDKType } from "../../google/protobuf/duration"; -import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { TelescopeGeneratedType } from "../../types"; import { MsgCreatePosition, MsgCreatePositionSDKType, MsgWithdrawPosition, MsgWithdrawPositionSDKType, MsgCollectFees, MsgCollectFeesSDKType, MsgCollectIncentives, MsgCollectIncentivesSDKType, MsgFungifyChargedPositions, MsgFungifyChargedPositionsSDKType } from "./tx"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/osmosis.concentratedliquidity.v1beta1.MsgCreatePosition", MsgCreatePosition], ["/osmosis.concentratedliquidity.v1beta1.MsgWithdrawPosition", MsgWithdrawPosition], ["/osmosis.concentratedliquidity.v1beta1.MsgCollectFees", MsgCollectFees], ["/osmosis.concentratedliquidity.v1beta1.MsgCollectIncentives", MsgCollectIncentives], ["/osmosis.concentratedliquidity.v1beta1.MsgFungifyChargedPositions", MsgFungifyChargedPositions]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/osmosis.concentratedliquidity.v1beta1.MsgCreatePosition", MsgCreatePosition], ["/osmosis.concentratedliquidity.v1beta1.MsgWithdrawPosition", MsgWithdrawPosition], ["/osmosis.concentratedliquidity.v1beta1.MsgCollectFees", MsgCollectFees], ["/osmosis.concentratedliquidity.v1beta1.MsgCollectIncentives", MsgCollectIncentives], ["/osmosis.concentratedliquidity.v1beta1.MsgFungifyChargedPositions", MsgFungifyChargedPositions]]; export const MessageComposer = { encoded: { createPosition(value: MsgCreatePosition) { diff --git a/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/tx.rpc.func.ts b/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/tx.rpc.func.ts new file mode 100644 index 0000000000..2d5b07e99e --- /dev/null +++ b/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/tx.rpc.func.ts @@ -0,0 +1,45 @@ +import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; +import { Timestamp, TimestampSDKType } from "../../google/protobuf/timestamp"; +import { Duration, DurationSDKType } from "../../google/protobuf/duration"; +import { buildTx } from "../../helper-func-types"; +import { MsgCreatePosition, MsgCreatePositionSDKType, MsgCreatePositionResponse, MsgCreatePositionResponseSDKType, MsgWithdrawPosition, MsgWithdrawPositionSDKType, MsgWithdrawPositionResponse, MsgWithdrawPositionResponseSDKType, MsgCollectFees, MsgCollectFeesSDKType, MsgCollectFeesResponse, MsgCollectFeesResponseSDKType, MsgCollectIncentives, MsgCollectIncentivesSDKType, MsgCollectIncentivesResponse, MsgCollectIncentivesResponseSDKType, MsgFungifyChargedPositions, MsgFungifyChargedPositionsSDKType, MsgFungifyChargedPositionsResponse, MsgFungifyChargedPositionsResponseSDKType } from "./tx"; +/** + * @name createPosition + * @package osmosis.concentratedliquidity.v1beta1 + * @see proto service: osmosis.concentratedliquidity.v1beta1.CreatePosition + */ +export const createPosition = buildTx({ + msg: MsgCreatePosition +}); +/** + * @name withdrawPosition + * @package osmosis.concentratedliquidity.v1beta1 + * @see proto service: osmosis.concentratedliquidity.v1beta1.WithdrawPosition + */ +export const withdrawPosition = buildTx({ + msg: MsgWithdrawPosition +}); +/** + * @name collectFees + * @package osmosis.concentratedliquidity.v1beta1 + * @see proto service: osmosis.concentratedliquidity.v1beta1.CollectFees + */ +export const collectFees = buildTx({ + msg: MsgCollectFees +}); +/** + * @name collectIncentives + * @package osmosis.concentratedliquidity.v1beta1 + * @see proto service: osmosis.concentratedliquidity.v1beta1.CollectIncentives + */ +export const collectIncentives = buildTx({ + msg: MsgCollectIncentives +}); +/** + * @name fungifyChargedPositions + * @package osmosis.concentratedliquidity.v1beta1 + * @see proto service: osmosis.concentratedliquidity.v1beta1.FungifyChargedPositions + */ +export const fungifyChargedPositions = buildTx({ + msg: MsgFungifyChargedPositions +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/tx.rpc.msg.ts b/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/tx.rpc.msg.ts index f7c73aea0c..69b4e4e1e3 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/tx.rpc.msg.ts @@ -1,7 +1,7 @@ import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; import { Timestamp, TimestampSDKType } from "../../google/protobuf/timestamp"; import { Duration, DurationSDKType } from "../../google/protobuf/duration"; -import { Rpc } from "../../helpers"; +import { TxRpc } from "../../types"; import { BinaryReader } from "../../binary"; import { MsgCreatePosition, MsgCreatePositionSDKType, MsgCreatePositionResponse, MsgCreatePositionResponseSDKType, MsgWithdrawPosition, MsgWithdrawPositionSDKType, MsgWithdrawPositionResponse, MsgWithdrawPositionResponseSDKType, MsgCollectFees, MsgCollectFeesSDKType, MsgCollectFeesResponse, MsgCollectFeesResponseSDKType, MsgCollectIncentives, MsgCollectIncentivesSDKType, MsgCollectIncentivesResponse, MsgCollectIncentivesResponseSDKType, MsgFungifyChargedPositions, MsgFungifyChargedPositionsSDKType, MsgFungifyChargedPositionsResponse, MsgFungifyChargedPositionsResponseSDKType } from "./tx"; export interface Msg { @@ -12,8 +12,8 @@ export interface Msg { fungifyChargedPositions(request: MsgFungifyChargedPositions): Promise; } export class MsgClientImpl implements Msg { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.createPosition = this.createPosition.bind(this); this.withdrawPosition = this.withdrawPosition.bind(this); @@ -47,6 +47,6 @@ export class MsgClientImpl implements Msg { return promise.then(data => MsgFungifyChargedPositionsResponse.decode(new BinaryReader(data))); } } -export const createClientImpl = (rpc: Rpc) => { +export const createClientImpl = (rpc: TxRpc) => { return new MsgClientImpl(rpc); }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/tx.ts b/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/tx.ts index f0a6e097db..fe5e6031c3 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/tx.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/tx.ts @@ -4,7 +4,7 @@ import { Duration, DurationSDKType } from "../../google/protobuf/duration"; import { BinaryReader, BinaryWriter } from "../../binary"; import { isSet, DeepPartial, toTimestamp, fromTimestamp } from "../../helpers"; import { JsonSafe } from "../../json-safe"; -import { Decimal } from "@cosmjs/math"; +import { Decimal } from "@interchainjs/math"; export const protobufPackage = "osmosis.concentratedliquidity.v1beta1"; /** * ===================== MsgCreatePosition @@ -673,7 +673,7 @@ export const MsgCreatePositionResponse = { obj.amount0 = message.amount0 === "" ? undefined : message.amount0; obj.amount1 = message.amount1 === "" ? undefined : message.amount1; obj.join_time = message.joinTime ? Timestamp.toAmino(toTimestamp(message.joinTime)) : undefined; - obj.liquidity_created = message.liquidityCreated === "" ? undefined : message.liquidityCreated; + obj.liquidity_created = message.liquidityCreated === "" ? undefined : Decimal.fromUserInput(message.liquidityCreated, 18).atomics; return obj; }, fromAminoMsg(object: MsgCreatePositionResponseAminoMsg): MsgCreatePositionResponse { @@ -807,7 +807,7 @@ export const MsgWithdrawPosition = { const obj: any = {}; obj.position_id = message.positionId !== BigInt(0) ? message.positionId?.toString() : undefined; obj.sender = message.sender === "" ? undefined : message.sender; - obj.liquidity_amount = message.liquidityAmount === "" ? undefined : message.liquidityAmount; + obj.liquidity_amount = message.liquidityAmount === "" ? undefined : Decimal.fromUserInput(message.liquidityAmount, 18).atomics; return obj; }, fromAminoMsg(object: MsgWithdrawPositionAminoMsg): MsgWithdrawPosition { @@ -1613,7 +1613,7 @@ export const MsgCreateIncentive = { obj.sender = message.sender === "" ? undefined : message.sender; obj.incentive_denom = message.incentiveDenom === "" ? undefined : message.incentiveDenom; obj.incentive_amount = message.incentiveAmount === "" ? undefined : message.incentiveAmount; - obj.emission_rate = message.emissionRate === "" ? undefined : message.emissionRate; + obj.emission_rate = message.emissionRate === "" ? undefined : Decimal.fromUserInput(message.emissionRate, 18).atomics; obj.start_time = message.startTime ? Timestamp.toAmino(toTimestamp(message.startTime)) : undefined; obj.min_uptime = message.minUptime ? Duration.toAmino(message.minUptime) : undefined; return obj; @@ -1779,8 +1779,8 @@ export const MsgCreateIncentiveResponse = { toAmino(message: MsgCreateIncentiveResponse): MsgCreateIncentiveResponseAmino { const obj: any = {}; obj.incentive_denom = message.incentiveDenom === "" ? undefined : message.incentiveDenom; - obj.incentive_amount = message.incentiveAmount === "" ? undefined : message.incentiveAmount; - obj.emission_rate = message.emissionRate === "" ? undefined : message.emissionRate; + obj.incentive_amount = message.incentiveAmount === "" ? undefined : Decimal.fromUserInput(message.incentiveAmount, 18).atomics; + obj.emission_rate = message.emissionRate === "" ? undefined : Decimal.fromUserInput(message.emissionRate, 18).atomics; obj.start_time = message.startTime ? Timestamp.toAmino(toTimestamp(message.startTime)) : undefined; obj.min_uptime = message.minUptime ? Duration.toAmino(message.minUptime) : undefined; return obj; diff --git a/__fixtures__/v-next/outputosmojs/osmosis/cosmwasmpool/v1beta1/query.rpc.Query.ts b/__fixtures__/v-next/outputosmojs/osmosis/cosmwasmpool/v1beta1/query.rpc.Query.ts index b46a8a2ac7..7bf2edeb3f 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/cosmwasmpool/v1beta1/query.rpc.Query.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/cosmwasmpool/v1beta1/query.rpc.Query.ts @@ -1,5 +1,5 @@ import { Params, ParamsSDKType } from "./genesis"; -import { Rpc } from "../../../helpers"; +import { TxRpc } from "../../../types"; import { BinaryReader } from "../../../binary"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; import { ParamsRequest, ParamsRequestSDKType, ParamsResponse, ParamsResponseSDKType } from "./query"; @@ -7,8 +7,8 @@ export interface Query { params(request?: ParamsRequest): Promise; } export class QueryClientImpl implements Query { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.params = this.params.bind(this); } diff --git a/__fixtures__/v-next/outputosmojs/osmosis/cosmwasmpool/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputosmojs/osmosis/cosmwasmpool/v1beta1/query.rpc.func.ts new file mode 100644 index 0000000000..00d4fb948d --- /dev/null +++ b/__fixtures__/v-next/outputosmojs/osmosis/cosmwasmpool/v1beta1/query.rpc.func.ts @@ -0,0 +1,14 @@ +import { Params, ParamsSDKType } from "./genesis"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { ParamsRequest, ParamsRequestSDKType, ParamsResponse, ParamsResponseSDKType } from "./query"; +/** + * @name getParams + * @package osmosis.cosmwasmpool.v1beta1 + * @see proto service: osmosis.cosmwasmpool.v1beta1.Params + */ +export const getParams = buildQuery({ + encode: ParamsRequest.encode, + decode: ParamsResponse.decode, + service: "osmosis.cosmwasmpool.v1beta1.Query", + method: "Params" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputosmojs/osmosis/downtime-detector/v1beta1/query.rpc.Query.ts b/__fixtures__/v-next/outputosmojs/osmosis/downtime-detector/v1beta1/query.rpc.Query.ts index ef6f7fa9b5..731ccb11c8 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/downtime-detector/v1beta1/query.rpc.Query.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/downtime-detector/v1beta1/query.rpc.Query.ts @@ -1,6 +1,6 @@ import { Downtime, DowntimeSDKType } from "./downtime_duration"; import { Duration, DurationSDKType } from "../../../google/protobuf/duration"; -import { Rpc } from "../../../helpers"; +import { TxRpc } from "../../../types"; import { BinaryReader } from "../../../binary"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; import { RecoveredSinceDowntimeOfLengthRequest, RecoveredSinceDowntimeOfLengthRequestSDKType, RecoveredSinceDowntimeOfLengthResponse, RecoveredSinceDowntimeOfLengthResponseSDKType } from "./query"; @@ -8,8 +8,8 @@ export interface Query { recoveredSinceDowntimeOfLength(request: RecoveredSinceDowntimeOfLengthRequest): Promise; } export class QueryClientImpl implements Query { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.recoveredSinceDowntimeOfLength = this.recoveredSinceDowntimeOfLength.bind(this); } diff --git a/__fixtures__/v-next/outputosmojs/osmosis/downtime-detector/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputosmojs/osmosis/downtime-detector/v1beta1/query.rpc.func.ts new file mode 100644 index 0000000000..ef817e3d17 --- /dev/null +++ b/__fixtures__/v-next/outputosmojs/osmosis/downtime-detector/v1beta1/query.rpc.func.ts @@ -0,0 +1,15 @@ +import { Downtime, DowntimeSDKType } from "./downtime_duration"; +import { Duration, DurationSDKType } from "../../../google/protobuf/duration"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { RecoveredSinceDowntimeOfLengthRequest, RecoveredSinceDowntimeOfLengthRequestSDKType, RecoveredSinceDowntimeOfLengthResponse, RecoveredSinceDowntimeOfLengthResponseSDKType } from "./query"; +/** + * @name getRecoveredSinceDowntimeOfLength + * @package osmosis.downtimedetector.v1beta1 + * @see proto service: osmosis.downtimedetector.v1beta1.RecoveredSinceDowntimeOfLength + */ +export const getRecoveredSinceDowntimeOfLength = buildQuery({ + encode: RecoveredSinceDowntimeOfLengthRequest.encode, + decode: RecoveredSinceDowntimeOfLengthResponse.decode, + service: "osmosis.downtimedetector.v1beta1.Query", + method: "RecoveredSinceDowntimeOfLength" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputosmojs/osmosis/epochs/query.rpc.Query.ts b/__fixtures__/v-next/outputosmojs/osmosis/epochs/query.rpc.Query.ts index e909dbc2a2..d2f0306a27 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/epochs/query.rpc.Query.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/epochs/query.rpc.Query.ts @@ -1,5 +1,5 @@ import { EpochInfo, EpochInfoSDKType } from "./genesis"; -import { Rpc } from "../../helpers"; +import { TxRpc } from "../../types"; import { BinaryReader } from "../../binary"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; import { QueryEpochsInfoRequest, QueryEpochsInfoRequestSDKType, QueryEpochsInfoResponse, QueryEpochsInfoResponseSDKType, QueryCurrentEpochRequest, QueryCurrentEpochRequestSDKType, QueryCurrentEpochResponse, QueryCurrentEpochResponseSDKType } from "./query"; @@ -11,8 +11,8 @@ export interface Query { currentEpoch(request: QueryCurrentEpochRequest): Promise; } export class QueryClientImpl implements Query { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.epochInfos = this.epochInfos.bind(this); this.currentEpoch = this.currentEpoch.bind(this); diff --git a/__fixtures__/v-next/outputosmojs/osmosis/epochs/query.rpc.func.ts b/__fixtures__/v-next/outputosmojs/osmosis/epochs/query.rpc.func.ts new file mode 100644 index 0000000000..30e6281677 --- /dev/null +++ b/__fixtures__/v-next/outputosmojs/osmosis/epochs/query.rpc.func.ts @@ -0,0 +1,27 @@ +import { EpochInfo, EpochInfoSDKType } from "./genesis"; +import { EndpointOrRpc, buildQuery } from "../../helper-func-types"; +import { QueryEpochsInfoRequest, QueryEpochsInfoRequestSDKType, QueryEpochsInfoResponse, QueryEpochsInfoResponseSDKType, QueryCurrentEpochRequest, QueryCurrentEpochRequestSDKType, QueryCurrentEpochResponse, QueryCurrentEpochResponseSDKType } from "./query"; +/** + * EpochInfos provide running epochInfos + * @name getEpochInfos + * @package osmosis.epochs.v1beta1 + * @see proto service: osmosis.epochs.v1beta1.EpochInfos + */ +export const getEpochInfos = buildQuery({ + encode: QueryEpochsInfoRequest.encode, + decode: QueryEpochsInfoResponse.decode, + service: "osmosis.epochs.v1beta1.Query", + method: "EpochInfos" +}); +/** + * CurrentEpoch provide current epoch of specified identifier + * @name getCurrentEpoch + * @package osmosis.epochs.v1beta1 + * @see proto service: osmosis.epochs.v1beta1.CurrentEpoch + */ +export const getCurrentEpoch = buildQuery({ + encode: QueryCurrentEpochRequest.encode, + decode: QueryCurrentEpochResponse.decode, + service: "osmosis.epochs.v1beta1.Query", + method: "CurrentEpoch" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputosmojs/osmosis/gamm/pool-models/balancer/balancerPool.ts b/__fixtures__/v-next/outputosmojs/osmosis/gamm/pool-models/balancer/balancerPool.ts index 2f8c2a83ca..d4ab8cde0b 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/gamm/pool-models/balancer/balancerPool.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/gamm/pool-models/balancer/balancerPool.ts @@ -4,7 +4,7 @@ import { Coin, CoinSDKType } from "../../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../../binary"; import { toTimestamp, fromTimestamp, isSet, DeepPartial } from "../../../../helpers"; import { JsonSafe } from "../../../../json-safe"; -import { Decimal } from "@cosmjs/math"; +import { Decimal } from "@interchainjs/math"; export const protobufPackage = "osmosis.gamm.v1beta1"; /** * Parameters for changing the weights in a balancer pool smoothly from @@ -488,8 +488,8 @@ export const PoolParams = { }, toAmino(message: PoolParams): PoolParamsAmino { const obj: any = {}; - obj.swap_fee = message.swapFee === "" ? undefined : message.swapFee; - obj.exit_fee = message.exitFee === "" ? undefined : message.exitFee; + obj.swap_fee = message.swapFee === "" ? undefined : Decimal.fromUserInput(message.swapFee, 18).atomics; + obj.exit_fee = message.exitFee === "" ? undefined : Decimal.fromUserInput(message.exitFee, 18).atomics; obj.smooth_weight_change_params = message.smoothWeightChangeParams ? SmoothWeightChangeParams.toAmino(message.smoothWeightChangeParams) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/osmosis/gamm/pool-models/balancer/tx/tx.amino.ts b/__fixtures__/v-next/outputosmojs/osmosis/gamm/pool-models/balancer/tx/tx.amino.ts index e481a8e582..6fc0f5d180 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/gamm/pool-models/balancer/tx/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/gamm/pool-models/balancer/tx/tx.amino.ts @@ -1,6 +1,7 @@ //@ts-nocheck import { PoolParams, PoolParamsSDKType, PoolAsset, PoolAssetSDKType, SmoothWeightChangeParams, SmoothWeightChangeParamsSDKType } from "../balancerPool"; import { AminoMsg } from "@cosmjs/amino"; +import { Decimal } from "@interchainjs/math"; import { Duration, DurationSDKType } from "../../../../../google/protobuf/duration"; import { Coin, CoinSDKType } from "../../../../../cosmos/base/v1beta1/coin"; import { MsgCreateBalancerPool, MsgCreateBalancerPoolSDKType } from "./tx"; @@ -55,8 +56,8 @@ export const AminoConverter = { return { sender, pool_params: { - swap_fee: poolParams.swapFee, - exit_fee: poolParams.exitFee, + swap_fee: Decimal.fromUserInput(poolParams.swapFee, 18).atomics, + exit_fee: Decimal.fromUserInput(poolParams.exitFee, 18).atomics, smooth_weight_change_params: { start_time: poolParams.smoothWeightChangeParams.startTime, duration: (poolParams.smoothWeightChangeParams.duration * 1_000_000_000).toString(), diff --git a/__fixtures__/v-next/outputosmojs/osmosis/gamm/pool-models/balancer/tx/tx.registry.ts b/__fixtures__/v-next/outputosmojs/osmosis/gamm/pool-models/balancer/tx/tx.registry.ts index 2f35b2b3f4..65088d4d18 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/gamm/pool-models/balancer/tx/tx.registry.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/gamm/pool-models/balancer/tx/tx.registry.ts @@ -1,12 +1,7 @@ import { PoolParams, PoolParamsSDKType, PoolAsset, PoolAssetSDKType } from "../balancerPool"; -import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { TelescopeGeneratedType } from "../../../../../types"; import { MsgCreateBalancerPool, MsgCreateBalancerPoolSDKType } from "./tx"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/osmosis.gamm.poolmodels.balancer.v1beta1.MsgCreateBalancerPool", MsgCreateBalancerPool]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/osmosis.gamm.poolmodels.balancer.v1beta1.MsgCreateBalancerPool", MsgCreateBalancerPool]]; export const MessageComposer = { encoded: { createBalancerPool(value: MsgCreateBalancerPool) { diff --git a/__fixtures__/v-next/outputosmojs/osmosis/gamm/pool-models/balancer/tx/tx.rpc.func.ts b/__fixtures__/v-next/outputosmojs/osmosis/gamm/pool-models/balancer/tx/tx.rpc.func.ts new file mode 100644 index 0000000000..d5b603efb5 --- /dev/null +++ b/__fixtures__/v-next/outputosmojs/osmosis/gamm/pool-models/balancer/tx/tx.rpc.func.ts @@ -0,0 +1,11 @@ +import { PoolParams, PoolParamsSDKType, PoolAsset, PoolAssetSDKType } from "../balancerPool"; +import { buildTx } from "../../../../../helper-func-types"; +import { MsgCreateBalancerPool, MsgCreateBalancerPoolSDKType, MsgCreateBalancerPoolResponse, MsgCreateBalancerPoolResponseSDKType } from "./tx"; +/** + * @name createBalancerPool + * @package osmosis.gamm.poolmodels.balancer.v1beta1 + * @see proto service: osmosis.gamm.poolmodels.balancer.v1beta1.CreateBalancerPool + */ +export const createBalancerPool = buildTx({ + msg: MsgCreateBalancerPool +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputosmojs/osmosis/gamm/pool-models/balancer/tx/tx.rpc.msg.ts b/__fixtures__/v-next/outputosmojs/osmosis/gamm/pool-models/balancer/tx/tx.rpc.msg.ts index c73a6d2a01..12babe0dd1 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/gamm/pool-models/balancer/tx/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/gamm/pool-models/balancer/tx/tx.rpc.msg.ts @@ -1,13 +1,13 @@ import { PoolParams, PoolParamsSDKType, PoolAsset, PoolAssetSDKType } from "../balancerPool"; -import { Rpc } from "../../../../../helpers"; +import { TxRpc } from "../../../../../types"; import { BinaryReader } from "../../../../../binary"; import { MsgCreateBalancerPool, MsgCreateBalancerPoolSDKType, MsgCreateBalancerPoolResponse, MsgCreateBalancerPoolResponseSDKType } from "./tx"; export interface Msg { createBalancerPool(request: MsgCreateBalancerPool): Promise; } export class MsgClientImpl implements Msg { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.createBalancerPool = this.createBalancerPool.bind(this); } @@ -17,6 +17,6 @@ export class MsgClientImpl implements Msg { return promise.then(data => MsgCreateBalancerPoolResponse.decode(new BinaryReader(data))); } } -export const createClientImpl = (rpc: Rpc) => { +export const createClientImpl = (rpc: TxRpc) => { return new MsgClientImpl(rpc); }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputosmojs/osmosis/gamm/pool-models/stableswap/stableswap_pool.ts b/__fixtures__/v-next/outputosmojs/osmosis/gamm/pool-models/stableswap/stableswap_pool.ts index 97ee493f93..5e08b9b02d 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/gamm/pool-models/stableswap/stableswap_pool.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/gamm/pool-models/stableswap/stableswap_pool.ts @@ -1,6 +1,6 @@ import { Coin, CoinSDKType } from "../../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { Decimal } from "@cosmjs/math"; +import { Decimal } from "@interchainjs/math"; import { isSet, DeepPartial } from "../../../../helpers"; import { JsonSafe } from "../../../../json-safe"; export const protobufPackage = "osmosis.gamm.poolmodels.stableswap.v1beta1"; @@ -186,8 +186,8 @@ export const PoolParams = { }, toAmino(message: PoolParams): PoolParamsAmino { const obj: any = {}; - obj.swap_fee = message.swapFee === "" ? undefined : message.swapFee; - obj.exit_fee = message.exitFee === "" ? undefined : message.exitFee; + obj.swap_fee = message.swapFee === "" ? undefined : Decimal.fromUserInput(message.swapFee, 18).atomics; + obj.exit_fee = message.exitFee === "" ? undefined : Decimal.fromUserInput(message.exitFee, 18).atomics; return obj; }, fromAminoMsg(object: PoolParamsAminoMsg): PoolParams { diff --git a/__fixtures__/v-next/outputosmojs/osmosis/gamm/pool-models/stableswap/tx.amino.ts b/__fixtures__/v-next/outputosmojs/osmosis/gamm/pool-models/stableswap/tx.amino.ts index 7811c40f43..d69e356d63 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/gamm/pool-models/stableswap/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/gamm/pool-models/stableswap/tx.amino.ts @@ -2,6 +2,7 @@ import { PoolParams, PoolParamsSDKType } from "./stableswap_pool"; import { Coin, CoinSDKType } from "../../../../cosmos/base/v1beta1/coin"; import { AminoMsg } from "@cosmjs/amino"; +import { Decimal } from "@interchainjs/math"; import { MsgCreateStableswapPool, MsgCreateStableswapPoolSDKType, MsgStableSwapAdjustScalingFactors, MsgStableSwapAdjustScalingFactorsSDKType } from "./tx"; export interface MsgCreateStableswapPoolAminoType extends AminoMsg { type: "osmosis/gamm/create-stableswap-pool"; @@ -42,8 +43,8 @@ export const AminoConverter = { return { sender, pool_params: { - swap_fee: poolParams.swapFee, - exit_fee: poolParams.exitFee + swap_fee: Decimal.fromUserInput(poolParams.swapFee, 18).atomics, + exit_fee: Decimal.fromUserInput(poolParams.exitFee, 18).atomics }, initial_pool_liquidity: initialPoolLiquidity.map(el0 => ({ denom: el0.denom, diff --git a/__fixtures__/v-next/outputosmojs/osmosis/gamm/pool-models/stableswap/tx.registry.ts b/__fixtures__/v-next/outputosmojs/osmosis/gamm/pool-models/stableswap/tx.registry.ts index 3266bc5bb8..8543c53439 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/gamm/pool-models/stableswap/tx.registry.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/gamm/pool-models/stableswap/tx.registry.ts @@ -1,13 +1,8 @@ import { PoolParams, PoolParamsSDKType } from "./stableswap_pool"; import { Coin, CoinSDKType } from "../../../../cosmos/base/v1beta1/coin"; -import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { TelescopeGeneratedType } from "../../../../types"; import { MsgCreateStableswapPool, MsgCreateStableswapPoolSDKType, MsgStableSwapAdjustScalingFactors, MsgStableSwapAdjustScalingFactorsSDKType } from "./tx"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/osmosis.gamm.poolmodels.stableswap.v1beta1.MsgCreateStableswapPool", MsgCreateStableswapPool], ["/osmosis.gamm.poolmodels.stableswap.v1beta1.MsgStableSwapAdjustScalingFactors", MsgStableSwapAdjustScalingFactors]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/osmosis.gamm.poolmodels.stableswap.v1beta1.MsgCreateStableswapPool", MsgCreateStableswapPool], ["/osmosis.gamm.poolmodels.stableswap.v1beta1.MsgStableSwapAdjustScalingFactors", MsgStableSwapAdjustScalingFactors]]; export const MessageComposer = { encoded: { createStableswapPool(value: MsgCreateStableswapPool) { diff --git a/__fixtures__/v-next/outputosmojs/osmosis/gamm/pool-models/stableswap/tx.rpc.func.ts b/__fixtures__/v-next/outputosmojs/osmosis/gamm/pool-models/stableswap/tx.rpc.func.ts new file mode 100644 index 0000000000..6e46af505b --- /dev/null +++ b/__fixtures__/v-next/outputosmojs/osmosis/gamm/pool-models/stableswap/tx.rpc.func.ts @@ -0,0 +1,20 @@ +import { PoolParams, PoolParamsSDKType } from "./stableswap_pool"; +import { Coin, CoinSDKType } from "../../../../cosmos/base/v1beta1/coin"; +import { buildTx } from "../../../../helper-func-types"; +import { MsgCreateStableswapPool, MsgCreateStableswapPoolSDKType, MsgCreateStableswapPoolResponse, MsgCreateStableswapPoolResponseSDKType, MsgStableSwapAdjustScalingFactors, MsgStableSwapAdjustScalingFactorsSDKType, MsgStableSwapAdjustScalingFactorsResponse, MsgStableSwapAdjustScalingFactorsResponseSDKType } from "./tx"; +/** + * @name createStableswapPool + * @package osmosis.gamm.poolmodels.stableswap.v1beta1 + * @see proto service: osmosis.gamm.poolmodels.stableswap.v1beta1.CreateStableswapPool + */ +export const createStableswapPool = buildTx({ + msg: MsgCreateStableswapPool +}); +/** + * @name stableSwapAdjustScalingFactors + * @package osmosis.gamm.poolmodels.stableswap.v1beta1 + * @see proto service: osmosis.gamm.poolmodels.stableswap.v1beta1.StableSwapAdjustScalingFactors + */ +export const stableSwapAdjustScalingFactors = buildTx({ + msg: MsgStableSwapAdjustScalingFactors +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputosmojs/osmosis/gamm/pool-models/stableswap/tx.rpc.msg.ts b/__fixtures__/v-next/outputosmojs/osmosis/gamm/pool-models/stableswap/tx.rpc.msg.ts index bbaaf941cb..2a5e3f2b29 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/gamm/pool-models/stableswap/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/gamm/pool-models/stableswap/tx.rpc.msg.ts @@ -1,6 +1,6 @@ import { PoolParams, PoolParamsSDKType } from "./stableswap_pool"; import { Coin, CoinSDKType } from "../../../../cosmos/base/v1beta1/coin"; -import { Rpc } from "../../../../helpers"; +import { TxRpc } from "../../../../types"; import { BinaryReader } from "../../../../binary"; import { MsgCreateStableswapPool, MsgCreateStableswapPoolSDKType, MsgCreateStableswapPoolResponse, MsgCreateStableswapPoolResponseSDKType, MsgStableSwapAdjustScalingFactors, MsgStableSwapAdjustScalingFactorsSDKType, MsgStableSwapAdjustScalingFactorsResponse, MsgStableSwapAdjustScalingFactorsResponseSDKType } from "./tx"; export interface Msg { @@ -8,8 +8,8 @@ export interface Msg { stableSwapAdjustScalingFactors(request: MsgStableSwapAdjustScalingFactors): Promise; } export class MsgClientImpl implements Msg { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.createStableswapPool = this.createStableswapPool.bind(this); this.stableSwapAdjustScalingFactors = this.stableSwapAdjustScalingFactors.bind(this); @@ -25,6 +25,6 @@ export class MsgClientImpl implements Msg { return promise.then(data => MsgStableSwapAdjustScalingFactorsResponse.decode(new BinaryReader(data))); } } -export const createClientImpl = (rpc: Rpc) => { +export const createClientImpl = (rpc: TxRpc) => { return new MsgClientImpl(rpc); }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputosmojs/osmosis/gamm/v1beta1/query.rpc.Query.ts b/__fixtures__/v-next/outputosmojs/osmosis/gamm/v1beta1/query.rpc.Query.ts index 0225b3e2e5..118d10b8a2 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/gamm/v1beta1/query.rpc.Query.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/gamm/v1beta1/query.rpc.Query.ts @@ -2,7 +2,7 @@ import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } fr import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { SwapAmountInRoute, SwapAmountInRouteSDKType, SwapAmountOutRoute, SwapAmountOutRouteSDKType } from "./tx"; import { Any, AnySDKType } from "../../../google/protobuf/any"; -import { Rpc } from "../../../helpers"; +import { TxRpc } from "../../../types"; import { BinaryReader } from "../../../binary"; import { QueryClient, createProtobufRpcClient, ProtobufRpcClient } from "@cosmjs/stargate"; import { ReactQueryParams } from "../../../react-query"; @@ -47,8 +47,8 @@ export interface Query { estimateSwapExactAmountOut(request: QuerySwapExactAmountOutRequest): Promise; } export class QueryClientImpl implements Query { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.pools = this.pools.bind(this); this.numPools = this.numPools.bind(this); diff --git a/__fixtures__/v-next/outputosmojs/osmosis/gamm/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputosmojs/osmosis/gamm/v1beta1/query.rpc.func.ts new file mode 100644 index 0000000000..394a6d6e65 --- /dev/null +++ b/__fixtures__/v-next/outputosmojs/osmosis/gamm/v1beta1/query.rpc.func.ts @@ -0,0 +1,183 @@ +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination"; +import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; +import { SwapAmountInRoute, SwapAmountInRouteSDKType, SwapAmountOutRoute, SwapAmountOutRouteSDKType } from "./tx"; +import { Any, AnySDKType } from "../../../google/protobuf/any"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { QueryPoolsRequest, QueryPoolsRequestSDKType, QueryPoolsResponse, QueryPoolsResponseSDKType, QueryNumPoolsRequest, QueryNumPoolsRequestSDKType, QueryNumPoolsResponse, QueryNumPoolsResponseSDKType, QueryTotalLiquidityRequest, QueryTotalLiquidityRequestSDKType, QueryTotalLiquidityResponse, QueryTotalLiquidityResponseSDKType, QueryPoolsWithFilterRequest, QueryPoolsWithFilterRequestSDKType, QueryPoolsWithFilterResponse, QueryPoolsWithFilterResponseSDKType, QueryPoolRequest, QueryPoolRequestSDKType, QueryPoolResponse, QueryPoolResponseSDKType, QueryPoolTypeRequest, QueryPoolTypeRequestSDKType, QueryPoolTypeResponse, QueryPoolTypeResponseSDKType, QueryCalcJoinPoolNoSwapSharesRequest, QueryCalcJoinPoolNoSwapSharesRequestSDKType, QueryCalcJoinPoolNoSwapSharesResponse, QueryCalcJoinPoolNoSwapSharesResponseSDKType, QueryCalcJoinPoolSharesRequest, QueryCalcJoinPoolSharesRequestSDKType, QueryCalcJoinPoolSharesResponse, QueryCalcJoinPoolSharesResponseSDKType, QueryCalcExitPoolCoinsFromSharesRequest, QueryCalcExitPoolCoinsFromSharesRequestSDKType, QueryCalcExitPoolCoinsFromSharesResponse, QueryCalcExitPoolCoinsFromSharesResponseSDKType, QueryPoolParamsRequest, QueryPoolParamsRequestSDKType, QueryPoolParamsResponse, QueryPoolParamsResponseSDKType, QueryTotalPoolLiquidityRequest, QueryTotalPoolLiquidityRequestSDKType, QueryTotalPoolLiquidityResponse, QueryTotalPoolLiquidityResponseSDKType, QueryTotalSharesRequest, QueryTotalSharesRequestSDKType, QueryTotalSharesResponse, QueryTotalSharesResponseSDKType, QuerySpotPriceRequest, QuerySpotPriceRequestSDKType, QuerySpotPriceResponse, QuerySpotPriceResponseSDKType, QuerySwapExactAmountInRequest, QuerySwapExactAmountInRequestSDKType, QuerySwapExactAmountInResponse, QuerySwapExactAmountInResponseSDKType, QuerySwapExactAmountOutRequest, QuerySwapExactAmountOutRequestSDKType, QuerySwapExactAmountOutResponse, QuerySwapExactAmountOutResponseSDKType } from "./query"; +/** + * @name getPools + * @package osmosis.gamm.v1beta1 + * @see proto service: osmosis.gamm.v1beta1.Pools + */ +export const getPools = buildQuery({ + encode: QueryPoolsRequest.encode, + decode: QueryPoolsResponse.decode, + service: "osmosis.gamm.v1beta1.Query", + method: "Pools" +}); +/** + * @name getNumPools + * @package osmosis.gamm.v1beta1 + * @see proto service: osmosis.gamm.v1beta1.NumPools + */ +export const getNumPools = buildQuery({ + encode: QueryNumPoolsRequest.encode, + decode: QueryNumPoolsResponse.decode, + service: "osmosis.gamm.v1beta1.Query", + method: "NumPools" +}); +/** + * @name getTotalLiquidity + * @package osmosis.gamm.v1beta1 + * @see proto service: osmosis.gamm.v1beta1.TotalLiquidity + */ +export const getTotalLiquidity = buildQuery({ + encode: QueryTotalLiquidityRequest.encode, + decode: QueryTotalLiquidityResponse.decode, + service: "osmosis.gamm.v1beta1.Query", + method: "TotalLiquidity" +}); +/** + * PoolsWithFilter allows you to query specific pools with requested + * parameters + * @name getPoolsWithFilter + * @package osmosis.gamm.v1beta1 + * @see proto service: osmosis.gamm.v1beta1.PoolsWithFilter + */ +export const getPoolsWithFilter = buildQuery({ + encode: QueryPoolsWithFilterRequest.encode, + decode: QueryPoolsWithFilterResponse.decode, + service: "osmosis.gamm.v1beta1.Query", + method: "PoolsWithFilter" +}); +/** + * Per Pool gRPC Endpoints + * @name getPool + * @package osmosis.gamm.v1beta1 + * @see proto service: osmosis.gamm.v1beta1.Pool + */ +export const getPool = buildQuery({ + encode: QueryPoolRequest.encode, + decode: QueryPoolResponse.decode, + service: "osmosis.gamm.v1beta1.Query", + method: "Pool" +}); +/** + * PoolType returns the type of the pool. + * Returns "Balancer" as a string literal when the pool is a balancer pool. + * Errors if the pool is failed to be type caseted. + * @name getPoolType + * @package osmosis.gamm.v1beta1 + * @see proto service: osmosis.gamm.v1beta1.PoolType + */ +export const getPoolType = buildQuery({ + encode: QueryPoolTypeRequest.encode, + decode: QueryPoolTypeResponse.decode, + service: "osmosis.gamm.v1beta1.Query", + method: "PoolType" +}); +/** + * Simulates joining pool without a swap. Returns the amount of shares you'd + * get and tokens needed to provide + * @name getCalcJoinPoolNoSwapShares + * @package osmosis.gamm.v1beta1 + * @see proto service: osmosis.gamm.v1beta1.CalcJoinPoolNoSwapShares + */ +export const getCalcJoinPoolNoSwapShares = buildQuery({ + encode: QueryCalcJoinPoolNoSwapSharesRequest.encode, + decode: QueryCalcJoinPoolNoSwapSharesResponse.decode, + service: "osmosis.gamm.v1beta1.Query", + method: "CalcJoinPoolNoSwapShares" +}); +/** + * @name getCalcJoinPoolShares + * @package osmosis.gamm.v1beta1 + * @see proto service: osmosis.gamm.v1beta1.CalcJoinPoolShares + */ +export const getCalcJoinPoolShares = buildQuery({ + encode: QueryCalcJoinPoolSharesRequest.encode, + decode: QueryCalcJoinPoolSharesResponse.decode, + service: "osmosis.gamm.v1beta1.Query", + method: "CalcJoinPoolShares" +}); +/** + * @name getCalcExitPoolCoinsFromShares + * @package osmosis.gamm.v1beta1 + * @see proto service: osmosis.gamm.v1beta1.CalcExitPoolCoinsFromShares + */ +export const getCalcExitPoolCoinsFromShares = buildQuery({ + encode: QueryCalcExitPoolCoinsFromSharesRequest.encode, + decode: QueryCalcExitPoolCoinsFromSharesResponse.decode, + service: "osmosis.gamm.v1beta1.Query", + method: "CalcExitPoolCoinsFromShares" +}); +/** + * @name getPoolParams + * @package osmosis.gamm.v1beta1 + * @see proto service: osmosis.gamm.v1beta1.PoolParams + */ +export const getPoolParams = buildQuery({ + encode: QueryPoolParamsRequest.encode, + decode: QueryPoolParamsResponse.decode, + service: "osmosis.gamm.v1beta1.Query", + method: "PoolParams" +}); +/** + * @name getTotalPoolLiquidity + * @package osmosis.gamm.v1beta1 + * @see proto service: osmosis.gamm.v1beta1.TotalPoolLiquidity + */ +export const getTotalPoolLiquidity = buildQuery({ + encode: QueryTotalPoolLiquidityRequest.encode, + decode: QueryTotalPoolLiquidityResponse.decode, + service: "osmosis.gamm.v1beta1.Query", + method: "TotalPoolLiquidity" +}); +/** + * @name getTotalShares + * @package osmosis.gamm.v1beta1 + * @see proto service: osmosis.gamm.v1beta1.TotalShares + */ +export const getTotalShares = buildQuery({ + encode: QueryTotalSharesRequest.encode, + decode: QueryTotalSharesResponse.decode, + service: "osmosis.gamm.v1beta1.Query", + method: "TotalShares" +}); +/** + * SpotPrice defines a gRPC query handler that returns the spot price given + * a base denomination and a quote denomination. + * @name getSpotPrice + * @package osmosis.gamm.v1beta1 + * @see proto service: osmosis.gamm.v1beta1.SpotPrice + * @deprecated + */ +export const getSpotPrice = buildQuery({ + encode: QuerySpotPriceRequest.encode, + decode: QuerySpotPriceResponse.decode, + service: "osmosis.gamm.v1beta1.Query", + method: "SpotPrice" +}); +/** + * Estimate the swap. + * @name getEstimateSwapExactAmountIn + * @package osmosis.gamm.v1beta1 + * @see proto service: osmosis.gamm.v1beta1.EstimateSwapExactAmountIn + */ +export const getEstimateSwapExactAmountIn = buildQuery({ + encode: QuerySwapExactAmountInRequest.encode, + decode: QuerySwapExactAmountInResponse.decode, + service: "osmosis.gamm.v1beta1.Query", + method: "EstimateSwapExactAmountIn" +}); +/** + * @name getEstimateSwapExactAmountOut + * @package osmosis.gamm.v1beta1 + * @see proto service: osmosis.gamm.v1beta1.EstimateSwapExactAmountOut + */ +export const getEstimateSwapExactAmountOut = buildQuery({ + encode: QuerySwapExactAmountOutRequest.encode, + decode: QuerySwapExactAmountOutResponse.decode, + service: "osmosis.gamm.v1beta1.Query", + method: "EstimateSwapExactAmountOut" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputosmojs/osmosis/gamm/v1beta1/tx.registry.ts b/__fixtures__/v-next/outputosmojs/osmosis/gamm/v1beta1/tx.registry.ts index edf6e0b6b9..195d3096de 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/gamm/v1beta1/tx.registry.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/gamm/v1beta1/tx.registry.ts @@ -1,12 +1,7 @@ import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; -import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { TelescopeGeneratedType } from "../../../types"; import { MsgJoinPool, MsgJoinPoolSDKType, MsgExitPool, MsgExitPoolSDKType, MsgSwapExactAmountIn, MsgSwapExactAmountInSDKType, MsgSwapExactAmountOut, MsgSwapExactAmountOutSDKType, MsgJoinSwapExternAmountIn, MsgJoinSwapExternAmountInSDKType, MsgJoinSwapShareAmountOut, MsgJoinSwapShareAmountOutSDKType, MsgExitSwapExternAmountOut, MsgExitSwapExternAmountOutSDKType, MsgExitSwapShareAmountIn, MsgExitSwapShareAmountInSDKType } from "./tx"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/osmosis.gamm.v1beta1.MsgJoinPool", MsgJoinPool], ["/osmosis.gamm.v1beta1.MsgExitPool", MsgExitPool], ["/osmosis.gamm.v1beta1.MsgSwapExactAmountIn", MsgSwapExactAmountIn], ["/osmosis.gamm.v1beta1.MsgSwapExactAmountOut", MsgSwapExactAmountOut], ["/osmosis.gamm.v1beta1.MsgJoinSwapExternAmountIn", MsgJoinSwapExternAmountIn], ["/osmosis.gamm.v1beta1.MsgJoinSwapShareAmountOut", MsgJoinSwapShareAmountOut], ["/osmosis.gamm.v1beta1.MsgExitSwapExternAmountOut", MsgExitSwapExternAmountOut], ["/osmosis.gamm.v1beta1.MsgExitSwapShareAmountIn", MsgExitSwapShareAmountIn]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/osmosis.gamm.v1beta1.MsgJoinPool", MsgJoinPool], ["/osmosis.gamm.v1beta1.MsgExitPool", MsgExitPool], ["/osmosis.gamm.v1beta1.MsgSwapExactAmountIn", MsgSwapExactAmountIn], ["/osmosis.gamm.v1beta1.MsgSwapExactAmountOut", MsgSwapExactAmountOut], ["/osmosis.gamm.v1beta1.MsgJoinSwapExternAmountIn", MsgJoinSwapExternAmountIn], ["/osmosis.gamm.v1beta1.MsgJoinSwapShareAmountOut", MsgJoinSwapShareAmountOut], ["/osmosis.gamm.v1beta1.MsgExitSwapExternAmountOut", MsgExitSwapExternAmountOut], ["/osmosis.gamm.v1beta1.MsgExitSwapShareAmountIn", MsgExitSwapShareAmountIn]]; export const MessageComposer = { encoded: { joinPool(value: MsgJoinPool) { diff --git a/__fixtures__/v-next/outputosmojs/osmosis/gamm/v1beta1/tx.rpc.func.ts b/__fixtures__/v-next/outputosmojs/osmosis/gamm/v1beta1/tx.rpc.func.ts new file mode 100644 index 0000000000..005459cc78 --- /dev/null +++ b/__fixtures__/v-next/outputosmojs/osmosis/gamm/v1beta1/tx.rpc.func.ts @@ -0,0 +1,67 @@ +import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; +import { buildTx } from "../../../helper-func-types"; +import { MsgJoinPool, MsgJoinPoolSDKType, MsgJoinPoolResponse, MsgJoinPoolResponseSDKType, MsgExitPool, MsgExitPoolSDKType, MsgExitPoolResponse, MsgExitPoolResponseSDKType, MsgSwapExactAmountIn, MsgSwapExactAmountInSDKType, MsgSwapExactAmountInResponse, MsgSwapExactAmountInResponseSDKType, MsgSwapExactAmountOut, MsgSwapExactAmountOutSDKType, MsgSwapExactAmountOutResponse, MsgSwapExactAmountOutResponseSDKType, MsgJoinSwapExternAmountIn, MsgJoinSwapExternAmountInSDKType, MsgJoinSwapExternAmountInResponse, MsgJoinSwapExternAmountInResponseSDKType, MsgJoinSwapShareAmountOut, MsgJoinSwapShareAmountOutSDKType, MsgJoinSwapShareAmountOutResponse, MsgJoinSwapShareAmountOutResponseSDKType, MsgExitSwapExternAmountOut, MsgExitSwapExternAmountOutSDKType, MsgExitSwapExternAmountOutResponse, MsgExitSwapExternAmountOutResponseSDKType, MsgExitSwapShareAmountIn, MsgExitSwapShareAmountInSDKType, MsgExitSwapShareAmountInResponse, MsgExitSwapShareAmountInResponseSDKType } from "./tx"; +/** + * @name joinPool + * @package osmosis.gamm.v1beta1 + * @see proto service: osmosis.gamm.v1beta1.JoinPool + */ +export const joinPool = buildTx({ + msg: MsgJoinPool +}); +/** + * @name exitPool + * @package osmosis.gamm.v1beta1 + * @see proto service: osmosis.gamm.v1beta1.ExitPool + */ +export const exitPool = buildTx({ + msg: MsgExitPool +}); +/** + * @name swapExactAmountIn + * @package osmosis.gamm.v1beta1 + * @see proto service: osmosis.gamm.v1beta1.SwapExactAmountIn + */ +export const swapExactAmountIn = buildTx({ + msg: MsgSwapExactAmountIn +}); +/** + * @name swapExactAmountOut + * @package osmosis.gamm.v1beta1 + * @see proto service: osmosis.gamm.v1beta1.SwapExactAmountOut + */ +export const swapExactAmountOut = buildTx({ + msg: MsgSwapExactAmountOut +}); +/** + * @name joinSwapExternAmountIn + * @package osmosis.gamm.v1beta1 + * @see proto service: osmosis.gamm.v1beta1.JoinSwapExternAmountIn + */ +export const joinSwapExternAmountIn = buildTx({ + msg: MsgJoinSwapExternAmountIn +}); +/** + * @name joinSwapShareAmountOut + * @package osmosis.gamm.v1beta1 + * @see proto service: osmosis.gamm.v1beta1.JoinSwapShareAmountOut + */ +export const joinSwapShareAmountOut = buildTx({ + msg: MsgJoinSwapShareAmountOut +}); +/** + * @name exitSwapExternAmountOut + * @package osmosis.gamm.v1beta1 + * @see proto service: osmosis.gamm.v1beta1.ExitSwapExternAmountOut + */ +export const exitSwapExternAmountOut = buildTx({ + msg: MsgExitSwapExternAmountOut +}); +/** + * @name exitSwapShareAmountIn + * @package osmosis.gamm.v1beta1 + * @see proto service: osmosis.gamm.v1beta1.ExitSwapShareAmountIn + */ +export const exitSwapShareAmountIn = buildTx({ + msg: MsgExitSwapShareAmountIn +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputosmojs/osmosis/gamm/v1beta1/tx.rpc.msg.ts b/__fixtures__/v-next/outputosmojs/osmosis/gamm/v1beta1/tx.rpc.msg.ts index ef9c4b4ade..0a12012e3f 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/gamm/v1beta1/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/gamm/v1beta1/tx.rpc.msg.ts @@ -1,5 +1,5 @@ import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; -import { Rpc } from "../../../helpers"; +import { TxRpc } from "../../../types"; import { BinaryReader } from "../../../binary"; import { MsgJoinPool, MsgJoinPoolSDKType, MsgJoinPoolResponse, MsgJoinPoolResponseSDKType, MsgExitPool, MsgExitPoolSDKType, MsgExitPoolResponse, MsgExitPoolResponseSDKType, MsgSwapExactAmountIn, MsgSwapExactAmountInSDKType, MsgSwapExactAmountInResponse, MsgSwapExactAmountInResponseSDKType, MsgSwapExactAmountOut, MsgSwapExactAmountOutSDKType, MsgSwapExactAmountOutResponse, MsgSwapExactAmountOutResponseSDKType, MsgJoinSwapExternAmountIn, MsgJoinSwapExternAmountInSDKType, MsgJoinSwapExternAmountInResponse, MsgJoinSwapExternAmountInResponseSDKType, MsgJoinSwapShareAmountOut, MsgJoinSwapShareAmountOutSDKType, MsgJoinSwapShareAmountOutResponse, MsgJoinSwapShareAmountOutResponseSDKType, MsgExitSwapExternAmountOut, MsgExitSwapExternAmountOutSDKType, MsgExitSwapExternAmountOutResponse, MsgExitSwapExternAmountOutResponseSDKType, MsgExitSwapShareAmountIn, MsgExitSwapShareAmountInSDKType, MsgExitSwapShareAmountInResponse, MsgExitSwapShareAmountInResponseSDKType } from "./tx"; export interface Msg { @@ -13,8 +13,8 @@ export interface Msg { exitSwapShareAmountIn(request: MsgExitSwapShareAmountIn): Promise; } export class MsgClientImpl implements Msg { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.joinPool = this.joinPool.bind(this); this.exitPool = this.exitPool.bind(this); @@ -66,6 +66,6 @@ export class MsgClientImpl implements Msg { return promise.then(data => MsgExitSwapShareAmountInResponse.decode(new BinaryReader(data))); } } -export const createClientImpl = (rpc: Rpc) => { +export const createClientImpl = (rpc: TxRpc) => { return new MsgClientImpl(rpc); }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputosmojs/osmosis/gamm/v2/query.rpc.Query.ts b/__fixtures__/v-next/outputosmojs/osmosis/gamm/v2/query.rpc.Query.ts index 1242357c8c..a641dbe86a 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/gamm/v2/query.rpc.Query.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/gamm/v2/query.rpc.Query.ts @@ -1,4 +1,4 @@ -import { Rpc } from "../../../helpers"; +import { TxRpc } from "../../../types"; import { BinaryReader } from "../../../binary"; import { QueryClient, createProtobufRpcClient, ProtobufRpcClient } from "@cosmjs/stargate"; import { ReactQueryParams } from "../../../react-query"; @@ -14,8 +14,8 @@ export interface Query { spotPrice(request: QuerySpotPriceRequest): Promise; } export class QueryClientImpl implements Query { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.spotPrice = this.spotPrice.bind(this); } diff --git a/__fixtures__/v-next/outputosmojs/osmosis/gamm/v2/query.rpc.func.ts b/__fixtures__/v-next/outputosmojs/osmosis/gamm/v2/query.rpc.func.ts new file mode 100644 index 0000000000..7e1cbf5290 --- /dev/null +++ b/__fixtures__/v-next/outputosmojs/osmosis/gamm/v2/query.rpc.func.ts @@ -0,0 +1,15 @@ +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { QuerySpotPriceRequest, QuerySpotPriceRequestSDKType, QuerySpotPriceResponse, QuerySpotPriceResponseSDKType } from "./query"; +/** + * SpotPrice defines a gRPC query handler that returns the spot price given + * a base denomination and a quote denomination. + * @name getSpotPrice + * @package osmosis.gamm.v2 + * @see proto service: osmosis.gamm.v2.SpotPrice + */ +export const getSpotPrice = buildQuery({ + encode: QuerySpotPriceRequest.encode, + decode: QuerySpotPriceResponse.decode, + service: "osmosis.gamm.v2.Query", + method: "SpotPrice" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputosmojs/osmosis/ibc-rate-limit/v1beta1/query.rpc.Query.ts b/__fixtures__/v-next/outputosmojs/osmosis/ibc-rate-limit/v1beta1/query.rpc.Query.ts index 970f457451..9926392e4e 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/ibc-rate-limit/v1beta1/query.rpc.Query.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/ibc-rate-limit/v1beta1/query.rpc.Query.ts @@ -1,5 +1,5 @@ import { Params, ParamsSDKType } from "./params"; -import { Rpc } from "../../../helpers"; +import { TxRpc } from "../../../types"; import { BinaryReader } from "../../../binary"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; import { QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType } from "./query"; @@ -12,8 +12,8 @@ export interface Query { params(request?: QueryParamsRequest): Promise; } export class QueryClientImpl implements Query { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.params = this.params.bind(this); } diff --git a/__fixtures__/v-next/outputosmojs/osmosis/ibc-rate-limit/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputosmojs/osmosis/ibc-rate-limit/v1beta1/query.rpc.func.ts new file mode 100644 index 0000000000..ce47a9f6ce --- /dev/null +++ b/__fixtures__/v-next/outputosmojs/osmosis/ibc-rate-limit/v1beta1/query.rpc.func.ts @@ -0,0 +1,16 @@ +import { Params, ParamsSDKType } from "./params"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType } from "./query"; +/** + * Params defines a gRPC query method that returns the ibc-rate-limit module's + * parameters. + * @name getParams + * @package osmosis.ibcratelimit.v1beta1 + * @see proto service: osmosis.ibcratelimit.v1beta1.Params + */ +export const getParams = buildQuery({ + encode: QueryParamsRequest.encode, + decode: QueryParamsResponse.decode, + service: "osmosis.ibcratelimit.v1beta1.Query", + method: "Params" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputosmojs/osmosis/incentives/query.rpc.Query.ts b/__fixtures__/v-next/outputosmojs/osmosis/incentives/query.rpc.Query.ts index e90c59a953..966ffe4fc7 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/incentives/query.rpc.Query.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/incentives/query.rpc.Query.ts @@ -2,7 +2,7 @@ import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } fr import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; import { Gauge, GaugeSDKType } from "./gauge"; import { Duration, DurationSDKType } from "../../google/protobuf/duration"; -import { Rpc } from "../../helpers"; +import { TxRpc } from "../../types"; import { BinaryReader } from "../../binary"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; import { ModuleToDistributeCoinsRequest, ModuleToDistributeCoinsRequestSDKType, ModuleToDistributeCoinsResponse, ModuleToDistributeCoinsResponseSDKType, GaugeByIDRequest, GaugeByIDRequestSDKType, GaugeByIDResponse, GaugeByIDResponseSDKType, GaugesRequest, GaugesRequestSDKType, GaugesResponse, GaugesResponseSDKType, ActiveGaugesRequest, ActiveGaugesRequestSDKType, ActiveGaugesResponse, ActiveGaugesResponseSDKType, ActiveGaugesPerDenomRequest, ActiveGaugesPerDenomRequestSDKType, ActiveGaugesPerDenomResponse, ActiveGaugesPerDenomResponseSDKType, UpcomingGaugesRequest, UpcomingGaugesRequestSDKType, UpcomingGaugesResponse, UpcomingGaugesResponseSDKType, UpcomingGaugesPerDenomRequest, UpcomingGaugesPerDenomRequestSDKType, UpcomingGaugesPerDenomResponse, UpcomingGaugesPerDenomResponseSDKType, RewardsEstRequest, RewardsEstRequestSDKType, RewardsEstResponse, RewardsEstResponseSDKType, QueryLockableDurationsRequest, QueryLockableDurationsRequestSDKType, QueryLockableDurationsResponse, QueryLockableDurationsResponseSDKType } from "./query"; @@ -38,8 +38,8 @@ export interface Query { lockableDurations(request?: QueryLockableDurationsRequest): Promise; } export class QueryClientImpl implements Query { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.moduleToDistributeCoins = this.moduleToDistributeCoins.bind(this); this.gaugeByID = this.gaugeByID.bind(this); diff --git a/__fixtures__/v-next/outputosmojs/osmosis/incentives/query.rpc.func.ts b/__fixtures__/v-next/outputosmojs/osmosis/incentives/query.rpc.func.ts new file mode 100644 index 0000000000..38b91c63ed --- /dev/null +++ b/__fixtures__/v-next/outputosmojs/osmosis/incentives/query.rpc.func.ts @@ -0,0 +1,118 @@ +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../cosmos/base/query/v1beta1/pagination"; +import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; +import { Gauge, GaugeSDKType } from "./gauge"; +import { Duration, DurationSDKType } from "../../google/protobuf/duration"; +import { EndpointOrRpc, buildQuery } from "../../helper-func-types"; +import { ModuleToDistributeCoinsRequest, ModuleToDistributeCoinsRequestSDKType, ModuleToDistributeCoinsResponse, ModuleToDistributeCoinsResponseSDKType, GaugeByIDRequest, GaugeByIDRequestSDKType, GaugeByIDResponse, GaugeByIDResponseSDKType, GaugesRequest, GaugesRequestSDKType, GaugesResponse, GaugesResponseSDKType, ActiveGaugesRequest, ActiveGaugesRequestSDKType, ActiveGaugesResponse, ActiveGaugesResponseSDKType, ActiveGaugesPerDenomRequest, ActiveGaugesPerDenomRequestSDKType, ActiveGaugesPerDenomResponse, ActiveGaugesPerDenomResponseSDKType, UpcomingGaugesRequest, UpcomingGaugesRequestSDKType, UpcomingGaugesResponse, UpcomingGaugesResponseSDKType, UpcomingGaugesPerDenomRequest, UpcomingGaugesPerDenomRequestSDKType, UpcomingGaugesPerDenomResponse, UpcomingGaugesPerDenomResponseSDKType, RewardsEstRequest, RewardsEstRequestSDKType, RewardsEstResponse, RewardsEstResponseSDKType, QueryLockableDurationsRequest, QueryLockableDurationsRequestSDKType, QueryLockableDurationsResponse, QueryLockableDurationsResponseSDKType } from "./query"; +/** + * ModuleToDistributeCoins returns coins that are going to be distributed + * @name getModuleToDistributeCoins + * @package osmosis.incentives + * @see proto service: osmosis.incentives.ModuleToDistributeCoins + */ +export const getModuleToDistributeCoins = buildQuery({ + encode: ModuleToDistributeCoinsRequest.encode, + decode: ModuleToDistributeCoinsResponse.decode, + service: "osmosis.incentives.Query", + method: "ModuleToDistributeCoins" +}); +/** + * GaugeByID returns gauges by their respective ID + * @name getGaugeByID + * @package osmosis.incentives + * @see proto service: osmosis.incentives.GaugeByID + */ +export const getGaugeByID = buildQuery({ + encode: GaugeByIDRequest.encode, + decode: GaugeByIDResponse.decode, + service: "osmosis.incentives.Query", + method: "GaugeByID" +}); +/** + * Gauges returns both upcoming and active gauges + * @name getGauges + * @package osmosis.incentives + * @see proto service: osmosis.incentives.Gauges + */ +export const getGauges = buildQuery({ + encode: GaugesRequest.encode, + decode: GaugesResponse.decode, + service: "osmosis.incentives.Query", + method: "Gauges" +}); +/** + * ActiveGauges returns active gauges + * @name getActiveGauges + * @package osmosis.incentives + * @see proto service: osmosis.incentives.ActiveGauges + */ +export const getActiveGauges = buildQuery({ + encode: ActiveGaugesRequest.encode, + decode: ActiveGaugesResponse.decode, + service: "osmosis.incentives.Query", + method: "ActiveGauges" +}); +/** + * ActiveGaugesPerDenom returns active gauges by denom + * @name getActiveGaugesPerDenom + * @package osmosis.incentives + * @see proto service: osmosis.incentives.ActiveGaugesPerDenom + */ +export const getActiveGaugesPerDenom = buildQuery({ + encode: ActiveGaugesPerDenomRequest.encode, + decode: ActiveGaugesPerDenomResponse.decode, + service: "osmosis.incentives.Query", + method: "ActiveGaugesPerDenom" +}); +/** + * Returns scheduled gauges that have not yet occured + * @name getUpcomingGauges + * @package osmosis.incentives + * @see proto service: osmosis.incentives.UpcomingGauges + */ +export const getUpcomingGauges = buildQuery({ + encode: UpcomingGaugesRequest.encode, + decode: UpcomingGaugesResponse.decode, + service: "osmosis.incentives.Query", + method: "UpcomingGauges" +}); +/** + * UpcomingGaugesPerDenom returns scheduled gauges that have not yet occured + * by denom + * @name getUpcomingGaugesPerDenom + * @package osmosis.incentives + * @see proto service: osmosis.incentives.UpcomingGaugesPerDenom + */ +export const getUpcomingGaugesPerDenom = buildQuery({ + encode: UpcomingGaugesPerDenomRequest.encode, + decode: UpcomingGaugesPerDenomResponse.decode, + service: "osmosis.incentives.Query", + method: "UpcomingGaugesPerDenom" +}); +/** + * RewardsEst returns an estimate of the rewards from now until a specified + * time in the future The querier either provides an address or a set of locks + * for which they want to find the associated rewards + * @name getRewardsEst + * @package osmosis.incentives + * @see proto service: osmosis.incentives.RewardsEst + */ +export const getRewardsEst = buildQuery({ + encode: RewardsEstRequest.encode, + decode: RewardsEstResponse.decode, + service: "osmosis.incentives.Query", + method: "RewardsEst" +}); +/** + * LockableDurations returns lockable durations that are valid to distribute + * incentives for + * @name getLockableDurations + * @package osmosis.incentives + * @see proto service: osmosis.incentives.LockableDurations + */ +export const getLockableDurations = buildQuery({ + encode: QueryLockableDurationsRequest.encode, + decode: QueryLockableDurationsResponse.decode, + service: "osmosis.incentives.Query", + method: "LockableDurations" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputosmojs/osmosis/incentives/tx.registry.ts b/__fixtures__/v-next/outputosmojs/osmosis/incentives/tx.registry.ts index 78505bdf4d..a96c6bbf24 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/incentives/tx.registry.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/incentives/tx.registry.ts @@ -1,14 +1,9 @@ import { QueryCondition, QueryConditionSDKType } from "../lockup/lock"; import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; import { Timestamp, TimestampSDKType } from "../../google/protobuf/timestamp"; -import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { TelescopeGeneratedType } from "../../types"; import { MsgCreateGauge, MsgCreateGaugeSDKType, MsgAddToGauge, MsgAddToGaugeSDKType } from "./tx"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/osmosis.incentives.MsgCreateGauge", MsgCreateGauge], ["/osmosis.incentives.MsgAddToGauge", MsgAddToGauge]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/osmosis.incentives.MsgCreateGauge", MsgCreateGauge], ["/osmosis.incentives.MsgAddToGauge", MsgAddToGauge]]; export const MessageComposer = { encoded: { createGauge(value: MsgCreateGauge) { diff --git a/__fixtures__/v-next/outputosmojs/osmosis/incentives/tx.rpc.func.ts b/__fixtures__/v-next/outputosmojs/osmosis/incentives/tx.rpc.func.ts new file mode 100644 index 0000000000..6c5516e08b --- /dev/null +++ b/__fixtures__/v-next/outputosmojs/osmosis/incentives/tx.rpc.func.ts @@ -0,0 +1,21 @@ +import { QueryCondition, QueryConditionSDKType } from "../lockup/lock"; +import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; +import { Timestamp, TimestampSDKType } from "../../google/protobuf/timestamp"; +import { buildTx } from "../../helper-func-types"; +import { MsgCreateGauge, MsgCreateGaugeSDKType, MsgCreateGaugeResponse, MsgCreateGaugeResponseSDKType, MsgAddToGauge, MsgAddToGaugeSDKType, MsgAddToGaugeResponse, MsgAddToGaugeResponseSDKType } from "./tx"; +/** + * @name createGauge + * @package osmosis.incentives + * @see proto service: osmosis.incentives.CreateGauge + */ +export const createGauge = buildTx({ + msg: MsgCreateGauge +}); +/** + * @name addToGauge + * @package osmosis.incentives + * @see proto service: osmosis.incentives.AddToGauge + */ +export const addToGauge = buildTx({ + msg: MsgAddToGauge +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputosmojs/osmosis/incentives/tx.rpc.msg.ts b/__fixtures__/v-next/outputosmojs/osmosis/incentives/tx.rpc.msg.ts index c3d761eac7..3ce7ec86b0 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/incentives/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/incentives/tx.rpc.msg.ts @@ -1,7 +1,7 @@ import { QueryCondition, QueryConditionSDKType } from "../lockup/lock"; import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; import { Timestamp, TimestampSDKType } from "../../google/protobuf/timestamp"; -import { Rpc } from "../../helpers"; +import { TxRpc } from "../../types"; import { BinaryReader } from "../../binary"; import { MsgCreateGauge, MsgCreateGaugeSDKType, MsgCreateGaugeResponse, MsgCreateGaugeResponseSDKType, MsgAddToGauge, MsgAddToGaugeSDKType, MsgAddToGaugeResponse, MsgAddToGaugeResponseSDKType } from "./tx"; export interface Msg { @@ -9,8 +9,8 @@ export interface Msg { addToGauge(request: MsgAddToGauge): Promise; } export class MsgClientImpl implements Msg { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.createGauge = this.createGauge.bind(this); this.addToGauge = this.addToGauge.bind(this); @@ -26,6 +26,6 @@ export class MsgClientImpl implements Msg { return promise.then(data => MsgAddToGaugeResponse.decode(new BinaryReader(data))); } } -export const createClientImpl = (rpc: Rpc) => { +export const createClientImpl = (rpc: TxRpc) => { return new MsgClientImpl(rpc); }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputosmojs/osmosis/lockup/query.rpc.Query.ts b/__fixtures__/v-next/outputosmojs/osmosis/lockup/query.rpc.Query.ts index 3858ff5b64..84ac24020b 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/lockup/query.rpc.Query.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/lockup/query.rpc.Query.ts @@ -3,7 +3,7 @@ import { Duration, DurationSDKType } from "../../google/protobuf/duration"; import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; import { PeriodLock, PeriodLockSDKType, SyntheticLock, SyntheticLockSDKType } from "./lock"; import { Params, ParamsSDKType } from "./params"; -import { Rpc } from "../../helpers"; +import { TxRpc } from "../../types"; import { BinaryReader } from "../../binary"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; import { ModuleBalanceRequest, ModuleBalanceRequestSDKType, ModuleBalanceResponse, ModuleBalanceResponseSDKType, ModuleLockedAmountRequest, ModuleLockedAmountRequestSDKType, ModuleLockedAmountResponse, ModuleLockedAmountResponseSDKType, AccountUnlockableCoinsRequest, AccountUnlockableCoinsRequestSDKType, AccountUnlockableCoinsResponse, AccountUnlockableCoinsResponseSDKType, AccountUnlockingCoinsRequest, AccountUnlockingCoinsRequestSDKType, AccountUnlockingCoinsResponse, AccountUnlockingCoinsResponseSDKType, AccountLockedCoinsRequest, AccountLockedCoinsRequestSDKType, AccountLockedCoinsResponse, AccountLockedCoinsResponseSDKType, AccountLockedPastTimeRequest, AccountLockedPastTimeRequestSDKType, AccountLockedPastTimeResponse, AccountLockedPastTimeResponseSDKType, AccountLockedPastTimeNotUnlockingOnlyRequest, AccountLockedPastTimeNotUnlockingOnlyRequestSDKType, AccountLockedPastTimeNotUnlockingOnlyResponse, AccountLockedPastTimeNotUnlockingOnlyResponseSDKType, AccountUnlockedBeforeTimeRequest, AccountUnlockedBeforeTimeRequestSDKType, AccountUnlockedBeforeTimeResponse, AccountUnlockedBeforeTimeResponseSDKType, AccountLockedPastTimeDenomRequest, AccountLockedPastTimeDenomRequestSDKType, AccountLockedPastTimeDenomResponse, AccountLockedPastTimeDenomResponseSDKType, LockedDenomRequest, LockedDenomRequestSDKType, LockedDenomResponse, LockedDenomResponseSDKType, LockedRequest, LockedRequestSDKType, LockedResponse, LockedResponseSDKType, SyntheticLockupsByLockupIDRequest, SyntheticLockupsByLockupIDRequestSDKType, SyntheticLockupsByLockupIDResponse, SyntheticLockupsByLockupIDResponseSDKType, AccountLockedLongerDurationRequest, AccountLockedLongerDurationRequestSDKType, AccountLockedLongerDurationResponse, AccountLockedLongerDurationResponseSDKType, AccountLockedDurationRequest, AccountLockedDurationRequestSDKType, AccountLockedDurationResponse, AccountLockedDurationResponseSDKType, AccountLockedLongerDurationNotUnlockingOnlyRequest, AccountLockedLongerDurationNotUnlockingOnlyRequestSDKType, AccountLockedLongerDurationNotUnlockingOnlyResponse, AccountLockedLongerDurationNotUnlockingOnlyResponseSDKType, AccountLockedLongerDurationDenomRequest, AccountLockedLongerDurationDenomRequestSDKType, AccountLockedLongerDurationDenomResponse, AccountLockedLongerDurationDenomResponseSDKType, QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType } from "./query"; @@ -51,8 +51,8 @@ export interface Query { params(request?: QueryParamsRequest): Promise; } export class QueryClientImpl implements Query { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.moduleBalance = this.moduleBalance.bind(this); this.moduleLockedAmount = this.moduleLockedAmount.bind(this); diff --git a/__fixtures__/v-next/outputosmojs/osmosis/lockup/query.rpc.func.ts b/__fixtures__/v-next/outputosmojs/osmosis/lockup/query.rpc.func.ts new file mode 100644 index 0000000000..a126fbdd36 --- /dev/null +++ b/__fixtures__/v-next/outputosmojs/osmosis/lockup/query.rpc.func.ts @@ -0,0 +1,213 @@ +import { Timestamp, TimestampSDKType } from "../../google/protobuf/timestamp"; +import { Duration, DurationSDKType } from "../../google/protobuf/duration"; +import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; +import { PeriodLock, PeriodLockSDKType, SyntheticLock, SyntheticLockSDKType } from "./lock"; +import { Params, ParamsSDKType } from "./params"; +import { EndpointOrRpc, buildQuery } from "../../helper-func-types"; +import { ModuleBalanceRequest, ModuleBalanceRequestSDKType, ModuleBalanceResponse, ModuleBalanceResponseSDKType, ModuleLockedAmountRequest, ModuleLockedAmountRequestSDKType, ModuleLockedAmountResponse, ModuleLockedAmountResponseSDKType, AccountUnlockableCoinsRequest, AccountUnlockableCoinsRequestSDKType, AccountUnlockableCoinsResponse, AccountUnlockableCoinsResponseSDKType, AccountUnlockingCoinsRequest, AccountUnlockingCoinsRequestSDKType, AccountUnlockingCoinsResponse, AccountUnlockingCoinsResponseSDKType, AccountLockedCoinsRequest, AccountLockedCoinsRequestSDKType, AccountLockedCoinsResponse, AccountLockedCoinsResponseSDKType, AccountLockedPastTimeRequest, AccountLockedPastTimeRequestSDKType, AccountLockedPastTimeResponse, AccountLockedPastTimeResponseSDKType, AccountLockedPastTimeNotUnlockingOnlyRequest, AccountLockedPastTimeNotUnlockingOnlyRequestSDKType, AccountLockedPastTimeNotUnlockingOnlyResponse, AccountLockedPastTimeNotUnlockingOnlyResponseSDKType, AccountUnlockedBeforeTimeRequest, AccountUnlockedBeforeTimeRequestSDKType, AccountUnlockedBeforeTimeResponse, AccountUnlockedBeforeTimeResponseSDKType, AccountLockedPastTimeDenomRequest, AccountLockedPastTimeDenomRequestSDKType, AccountLockedPastTimeDenomResponse, AccountLockedPastTimeDenomResponseSDKType, LockedDenomRequest, LockedDenomRequestSDKType, LockedDenomResponse, LockedDenomResponseSDKType, LockedRequest, LockedRequestSDKType, LockedResponse, LockedResponseSDKType, SyntheticLockupsByLockupIDRequest, SyntheticLockupsByLockupIDRequestSDKType, SyntheticLockupsByLockupIDResponse, SyntheticLockupsByLockupIDResponseSDKType, AccountLockedLongerDurationRequest, AccountLockedLongerDurationRequestSDKType, AccountLockedLongerDurationResponse, AccountLockedLongerDurationResponseSDKType, AccountLockedDurationRequest, AccountLockedDurationRequestSDKType, AccountLockedDurationResponse, AccountLockedDurationResponseSDKType, AccountLockedLongerDurationNotUnlockingOnlyRequest, AccountLockedLongerDurationNotUnlockingOnlyRequestSDKType, AccountLockedLongerDurationNotUnlockingOnlyResponse, AccountLockedLongerDurationNotUnlockingOnlyResponseSDKType, AccountLockedLongerDurationDenomRequest, AccountLockedLongerDurationDenomRequestSDKType, AccountLockedLongerDurationDenomResponse, AccountLockedLongerDurationDenomResponseSDKType, QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType } from "./query"; +/** + * Return full balance of the module + * @name getModuleBalance + * @package osmosis.lockup + * @see proto service: osmosis.lockup.ModuleBalance + */ +export const getModuleBalance = buildQuery({ + encode: ModuleBalanceRequest.encode, + decode: ModuleBalanceResponse.decode, + service: "osmosis.lockup.Query", + method: "ModuleBalance" +}); +/** + * Return locked balance of the module + * @name getModuleLockedAmount + * @package osmosis.lockup + * @see proto service: osmosis.lockup.ModuleLockedAmount + */ +export const getModuleLockedAmount = buildQuery({ + encode: ModuleLockedAmountRequest.encode, + decode: ModuleLockedAmountResponse.decode, + service: "osmosis.lockup.Query", + method: "ModuleLockedAmount" +}); +/** + * Returns unlockable coins which are not withdrawn yet + * @name getAccountUnlockableCoins + * @package osmosis.lockup + * @see proto service: osmosis.lockup.AccountUnlockableCoins + */ +export const getAccountUnlockableCoins = buildQuery({ + encode: AccountUnlockableCoinsRequest.encode, + decode: AccountUnlockableCoinsResponse.decode, + service: "osmosis.lockup.Query", + method: "AccountUnlockableCoins" +}); +/** + * Returns unlocking coins + * @name getAccountUnlockingCoins + * @package osmosis.lockup + * @see proto service: osmosis.lockup.AccountUnlockingCoins + */ +export const getAccountUnlockingCoins = buildQuery({ + encode: AccountUnlockingCoinsRequest.encode, + decode: AccountUnlockingCoinsResponse.decode, + service: "osmosis.lockup.Query", + method: "AccountUnlockingCoins" +}); +/** + * Return a locked coins that can't be withdrawn + * @name getAccountLockedCoins + * @package osmosis.lockup + * @see proto service: osmosis.lockup.AccountLockedCoins + */ +export const getAccountLockedCoins = buildQuery({ + encode: AccountLockedCoinsRequest.encode, + decode: AccountLockedCoinsResponse.decode, + service: "osmosis.lockup.Query", + method: "AccountLockedCoins" +}); +/** + * Returns locked records of an account with unlock time beyond timestamp + * @name getAccountLockedPastTime + * @package osmosis.lockup + * @see proto service: osmosis.lockup.AccountLockedPastTime + */ +export const getAccountLockedPastTime = buildQuery({ + encode: AccountLockedPastTimeRequest.encode, + decode: AccountLockedPastTimeResponse.decode, + service: "osmosis.lockup.Query", + method: "AccountLockedPastTime" +}); +/** + * Returns locked records of an account with unlock time beyond timestamp + * excluding tokens started unlocking + * @name getAccountLockedPastTimeNotUnlockingOnly + * @package osmosis.lockup + * @see proto service: osmosis.lockup.AccountLockedPastTimeNotUnlockingOnly + */ +export const getAccountLockedPastTimeNotUnlockingOnly = buildQuery({ + encode: AccountLockedPastTimeNotUnlockingOnlyRequest.encode, + decode: AccountLockedPastTimeNotUnlockingOnlyResponse.decode, + service: "osmosis.lockup.Query", + method: "AccountLockedPastTimeNotUnlockingOnly" +}); +/** + * Returns unlocked records with unlock time before timestamp + * @name getAccountUnlockedBeforeTime + * @package osmosis.lockup + * @see proto service: osmosis.lockup.AccountUnlockedBeforeTime + */ +export const getAccountUnlockedBeforeTime = buildQuery({ + encode: AccountUnlockedBeforeTimeRequest.encode, + decode: AccountUnlockedBeforeTimeResponse.decode, + service: "osmosis.lockup.Query", + method: "AccountUnlockedBeforeTime" +}); +/** + * Returns lock records by address, timestamp, denom + * @name getAccountLockedPastTimeDenom + * @package osmosis.lockup + * @see proto service: osmosis.lockup.AccountLockedPastTimeDenom + */ +export const getAccountLockedPastTimeDenom = buildQuery({ + encode: AccountLockedPastTimeDenomRequest.encode, + decode: AccountLockedPastTimeDenomResponse.decode, + service: "osmosis.lockup.Query", + method: "AccountLockedPastTimeDenom" +}); +/** + * Returns total locked per denom with longer past given time + * @name getLockedDenom + * @package osmosis.lockup + * @see proto service: osmosis.lockup.LockedDenom + */ +export const getLockedDenom = buildQuery({ + encode: LockedDenomRequest.encode, + decode: LockedDenomResponse.decode, + service: "osmosis.lockup.Query", + method: "LockedDenom" +}); +/** + * Returns lock record by id + * @name getLockedByID + * @package osmosis.lockup + * @see proto service: osmosis.lockup.LockedByID + */ +export const getLockedByID = buildQuery({ + encode: LockedRequest.encode, + decode: LockedResponse.decode, + service: "osmosis.lockup.Query", + method: "LockedByID" +}); +/** + * Returns synthetic lockups by native lockup id + * @name getSyntheticLockupsByLockupID + * @package osmosis.lockup + * @see proto service: osmosis.lockup.SyntheticLockupsByLockupID + */ +export const getSyntheticLockupsByLockupID = buildQuery({ + encode: SyntheticLockupsByLockupIDRequest.encode, + decode: SyntheticLockupsByLockupIDResponse.decode, + service: "osmosis.lockup.Query", + method: "SyntheticLockupsByLockupID" +}); +/** + * Returns account locked records with longer duration + * @name getAccountLockedLongerDuration + * @package osmosis.lockup + * @see proto service: osmosis.lockup.AccountLockedLongerDuration + */ +export const getAccountLockedLongerDuration = buildQuery({ + encode: AccountLockedLongerDurationRequest.encode, + decode: AccountLockedLongerDurationResponse.decode, + service: "osmosis.lockup.Query", + method: "AccountLockedLongerDuration" +}); +/** + * Returns account locked records with a specific duration + * @name getAccountLockedDuration + * @package osmosis.lockup + * @see proto service: osmosis.lockup.AccountLockedDuration + */ +export const getAccountLockedDuration = buildQuery({ + encode: AccountLockedDurationRequest.encode, + decode: AccountLockedDurationResponse.decode, + service: "osmosis.lockup.Query", + method: "AccountLockedDuration" +}); +/** + * Returns account locked records with longer duration excluding tokens + * started unlocking + * @name getAccountLockedLongerDurationNotUnlockingOnly + * @package osmosis.lockup + * @see proto service: osmosis.lockup.AccountLockedLongerDurationNotUnlockingOnly + */ +export const getAccountLockedLongerDurationNotUnlockingOnly = buildQuery({ + encode: AccountLockedLongerDurationNotUnlockingOnlyRequest.encode, + decode: AccountLockedLongerDurationNotUnlockingOnlyResponse.decode, + service: "osmosis.lockup.Query", + method: "AccountLockedLongerDurationNotUnlockingOnly" +}); +/** + * Returns account's locked records for a denom with longer duration + * @name getAccountLockedLongerDurationDenom + * @package osmosis.lockup + * @see proto service: osmosis.lockup.AccountLockedLongerDurationDenom + */ +export const getAccountLockedLongerDurationDenom = buildQuery({ + encode: AccountLockedLongerDurationDenomRequest.encode, + decode: AccountLockedLongerDurationDenomResponse.decode, + service: "osmosis.lockup.Query", + method: "AccountLockedLongerDurationDenom" +}); +/** + * Params returns lockup params. + * @name getParams + * @package osmosis.lockup + * @see proto service: osmosis.lockup.Params + */ +export const getParams = buildQuery({ + encode: QueryParamsRequest.encode, + decode: QueryParamsResponse.decode, + service: "osmosis.lockup.Query", + method: "Params" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputosmojs/osmosis/lockup/tx.registry.ts b/__fixtures__/v-next/outputosmojs/osmosis/lockup/tx.registry.ts index dda1657f40..a4a8fde8f7 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/lockup/tx.registry.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/lockup/tx.registry.ts @@ -1,14 +1,9 @@ import { Duration, DurationSDKType } from "../../google/protobuf/duration"; import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; import { PeriodLock, PeriodLockSDKType } from "./lock"; -import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { TelescopeGeneratedType } from "../../types"; import { MsgLockTokens, MsgLockTokensSDKType, MsgBeginUnlockingAll, MsgBeginUnlockingAllSDKType, MsgBeginUnlocking, MsgBeginUnlockingSDKType, MsgExtendLockup, MsgExtendLockupSDKType, MsgForceUnlock, MsgForceUnlockSDKType } from "./tx"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/osmosis.lockup.MsgLockTokens", MsgLockTokens], ["/osmosis.lockup.MsgBeginUnlockingAll", MsgBeginUnlockingAll], ["/osmosis.lockup.MsgBeginUnlocking", MsgBeginUnlocking], ["/osmosis.lockup.MsgExtendLockup", MsgExtendLockup], ["/osmosis.lockup.MsgForceUnlock", MsgForceUnlock]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/osmosis.lockup.MsgLockTokens", MsgLockTokens], ["/osmosis.lockup.MsgBeginUnlockingAll", MsgBeginUnlockingAll], ["/osmosis.lockup.MsgBeginUnlocking", MsgBeginUnlocking], ["/osmosis.lockup.MsgExtendLockup", MsgExtendLockup], ["/osmosis.lockup.MsgForceUnlock", MsgForceUnlock]]; export const MessageComposer = { encoded: { lockTokens(value: MsgLockTokens) { diff --git a/__fixtures__/v-next/outputosmojs/osmosis/lockup/tx.rpc.func.ts b/__fixtures__/v-next/outputosmojs/osmosis/lockup/tx.rpc.func.ts new file mode 100644 index 0000000000..f9b47db3d7 --- /dev/null +++ b/__fixtures__/v-next/outputosmojs/osmosis/lockup/tx.rpc.func.ts @@ -0,0 +1,49 @@ +import { Duration, DurationSDKType } from "../../google/protobuf/duration"; +import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; +import { PeriodLock, PeriodLockSDKType } from "./lock"; +import { buildTx } from "../../helper-func-types"; +import { MsgLockTokens, MsgLockTokensSDKType, MsgLockTokensResponse, MsgLockTokensResponseSDKType, MsgBeginUnlockingAll, MsgBeginUnlockingAllSDKType, MsgBeginUnlockingAllResponse, MsgBeginUnlockingAllResponseSDKType, MsgBeginUnlocking, MsgBeginUnlockingSDKType, MsgBeginUnlockingResponse, MsgBeginUnlockingResponseSDKType, MsgExtendLockup, MsgExtendLockupSDKType, MsgExtendLockupResponse, MsgExtendLockupResponseSDKType, MsgForceUnlock, MsgForceUnlockSDKType, MsgForceUnlockResponse, MsgForceUnlockResponseSDKType } from "./tx"; +/** + * LockTokens lock tokens + * @name lockTokens + * @package osmosis.lockup + * @see proto service: osmosis.lockup.LockTokens + */ +export const lockTokens = buildTx({ + msg: MsgLockTokens +}); +/** + * BeginUnlockingAll begin unlocking all tokens + * @name beginUnlockingAll + * @package osmosis.lockup + * @see proto service: osmosis.lockup.BeginUnlockingAll + */ +export const beginUnlockingAll = buildTx({ + msg: MsgBeginUnlockingAll +}); +/** + * MsgBeginUnlocking begins unlocking tokens by lock ID + * @name beginUnlocking + * @package osmosis.lockup + * @see proto service: osmosis.lockup.BeginUnlocking + */ +export const beginUnlocking = buildTx({ + msg: MsgBeginUnlocking +}); +/** + * MsgEditLockup edits the existing lockups by lock ID + * @name extendLockup + * @package osmosis.lockup + * @see proto service: osmosis.lockup.ExtendLockup + */ +export const extendLockup = buildTx({ + msg: MsgExtendLockup +}); +/** + * @name forceUnlock + * @package osmosis.lockup + * @see proto service: osmosis.lockup.ForceUnlock + */ +export const forceUnlock = buildTx({ + msg: MsgForceUnlock +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputosmojs/osmosis/lockup/tx.rpc.msg.ts b/__fixtures__/v-next/outputosmojs/osmosis/lockup/tx.rpc.msg.ts index b6ed2eed29..e7bff818ef 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/lockup/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/lockup/tx.rpc.msg.ts @@ -1,7 +1,7 @@ import { Duration, DurationSDKType } from "../../google/protobuf/duration"; import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; import { PeriodLock, PeriodLockSDKType } from "./lock"; -import { Rpc } from "../../helpers"; +import { TxRpc } from "../../types"; import { BinaryReader } from "../../binary"; import { MsgLockTokens, MsgLockTokensSDKType, MsgLockTokensResponse, MsgLockTokensResponseSDKType, MsgBeginUnlockingAll, MsgBeginUnlockingAllSDKType, MsgBeginUnlockingAllResponse, MsgBeginUnlockingAllResponseSDKType, MsgBeginUnlocking, MsgBeginUnlockingSDKType, MsgBeginUnlockingResponse, MsgBeginUnlockingResponseSDKType, MsgExtendLockup, MsgExtendLockupSDKType, MsgExtendLockupResponse, MsgExtendLockupResponseSDKType, MsgForceUnlock, MsgForceUnlockSDKType, MsgForceUnlockResponse, MsgForceUnlockResponseSDKType } from "./tx"; /** Msg defines the Msg service. */ @@ -17,8 +17,8 @@ export interface Msg { forceUnlock(request: MsgForceUnlock): Promise; } export class MsgClientImpl implements Msg { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.lockTokens = this.lockTokens.bind(this); this.beginUnlockingAll = this.beginUnlockingAll.bind(this); @@ -52,6 +52,6 @@ export class MsgClientImpl implements Msg { return promise.then(data => MsgForceUnlockResponse.decode(new BinaryReader(data))); } } -export const createClientImpl = (rpc: Rpc) => { +export const createClientImpl = (rpc: TxRpc) => { return new MsgClientImpl(rpc); }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputosmojs/osmosis/mint/v1beta1/mint.ts b/__fixtures__/v-next/outputosmojs/osmosis/mint/v1beta1/mint.ts index 27550e070c..01c528ae53 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/mint/v1beta1/mint.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/mint/v1beta1/mint.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { Decimal } from "@cosmjs/math"; +import { Decimal } from "@interchainjs/math"; import { isSet, DeepPartial } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "osmosis.mint.v1beta1"; @@ -247,7 +247,7 @@ export const Minter = { }, toAmino(message: Minter): MinterAmino { const obj: any = {}; - obj.epoch_provisions = message.epochProvisions === "" ? undefined : message.epochProvisions; + obj.epoch_provisions = message.epochProvisions === "" ? undefined : Decimal.fromUserInput(message.epochProvisions, 18).atomics; return obj; }, fromAminoMsg(object: MinterAminoMsg): Minter { @@ -366,7 +366,7 @@ export const WeightedAddress = { toAmino(message: WeightedAddress): WeightedAddressAmino { const obj: any = {}; obj.address = message.address === "" ? undefined : message.address; - obj.weight = message.weight === "" ? undefined : message.weight; + obj.weight = message.weight === "" ? undefined : Decimal.fromUserInput(message.weight, 18).atomics; return obj; }, fromAminoMsg(object: WeightedAddressAminoMsg): WeightedAddress { @@ -516,10 +516,10 @@ export const DistributionProportions = { }, toAmino(message: DistributionProportions): DistributionProportionsAmino { const obj: any = {}; - obj.staking = message.staking === "" ? undefined : message.staking; - obj.pool_incentives = message.poolIncentives === "" ? undefined : message.poolIncentives; - obj.developer_rewards = message.developerRewards === "" ? undefined : message.developerRewards; - obj.community_pool = message.communityPool === "" ? undefined : message.communityPool; + obj.staking = message.staking === "" ? undefined : Decimal.fromUserInput(message.staking, 18).atomics; + obj.pool_incentives = message.poolIncentives === "" ? undefined : Decimal.fromUserInput(message.poolIncentives, 18).atomics; + obj.developer_rewards = message.developerRewards === "" ? undefined : Decimal.fromUserInput(message.developerRewards, 18).atomics; + obj.community_pool = message.communityPool === "" ? undefined : Decimal.fromUserInput(message.communityPool, 18).atomics; return obj; }, fromAminoMsg(object: DistributionProportionsAminoMsg): DistributionProportions { @@ -738,10 +738,10 @@ export const Params = { toAmino(message: Params): ParamsAmino { const obj: any = {}; obj.mint_denom = message.mintDenom === "" ? undefined : message.mintDenom; - obj.genesis_epoch_provisions = message.genesisEpochProvisions === "" ? undefined : message.genesisEpochProvisions; + obj.genesis_epoch_provisions = message.genesisEpochProvisions === "" ? undefined : Decimal.fromUserInput(message.genesisEpochProvisions, 18).atomics; obj.epoch_identifier = message.epochIdentifier === "" ? undefined : message.epochIdentifier; obj.reduction_period_in_epochs = message.reductionPeriodInEpochs !== BigInt(0) ? message.reductionPeriodInEpochs?.toString() : undefined; - obj.reduction_factor = message.reductionFactor === "" ? undefined : message.reductionFactor; + obj.reduction_factor = message.reductionFactor === "" ? undefined : Decimal.fromUserInput(message.reductionFactor, 18).atomics; obj.distribution_proportions = message.distributionProportions ? DistributionProportions.toAmino(message.distributionProportions) : undefined; if (message.weightedDeveloperRewardsReceivers) { obj.weighted_developer_rewards_receivers = message.weightedDeveloperRewardsReceivers.map(e => e ? WeightedAddress.toAmino(e) : undefined); diff --git a/__fixtures__/v-next/outputosmojs/osmosis/mint/v1beta1/query.rpc.Query.ts b/__fixtures__/v-next/outputosmojs/osmosis/mint/v1beta1/query.rpc.Query.ts index 7a78db1131..95a78115b6 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/mint/v1beta1/query.rpc.Query.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/mint/v1beta1/query.rpc.Query.ts @@ -1,5 +1,5 @@ import { Params, ParamsSDKType } from "./mint"; -import { Rpc } from "../../../helpers"; +import { TxRpc } from "../../../types"; import { BinaryReader } from "../../../binary"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; import { QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, QueryEpochProvisionsRequest, QueryEpochProvisionsRequestSDKType, QueryEpochProvisionsResponse, QueryEpochProvisionsResponseSDKType } from "./query"; @@ -11,8 +11,8 @@ export interface Query { epochProvisions(request?: QueryEpochProvisionsRequest): Promise; } export class QueryClientImpl implements Query { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.params = this.params.bind(this); this.epochProvisions = this.epochProvisions.bind(this); diff --git a/__fixtures__/v-next/outputosmojs/osmosis/mint/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputosmojs/osmosis/mint/v1beta1/query.rpc.func.ts new file mode 100644 index 0000000000..46ed6c8ec6 --- /dev/null +++ b/__fixtures__/v-next/outputosmojs/osmosis/mint/v1beta1/query.rpc.func.ts @@ -0,0 +1,27 @@ +import { Params, ParamsSDKType } from "./mint"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, QueryEpochProvisionsRequest, QueryEpochProvisionsRequestSDKType, QueryEpochProvisionsResponse, QueryEpochProvisionsResponseSDKType } from "./query"; +/** + * Params returns the total set of minting parameters. + * @name getParams + * @package osmosis.mint.v1beta1 + * @see proto service: osmosis.mint.v1beta1.Params + */ +export const getParams = buildQuery({ + encode: QueryParamsRequest.encode, + decode: QueryParamsResponse.decode, + service: "osmosis.mint.v1beta1.Query", + method: "Params" +}); +/** + * EpochProvisions returns the current minting epoch provisions value. + * @name getEpochProvisions + * @package osmosis.mint.v1beta1 + * @see proto service: osmosis.mint.v1beta1.EpochProvisions + */ +export const getEpochProvisions = buildQuery({ + encode: QueryEpochProvisionsRequest.encode, + decode: QueryEpochProvisionsResponse.decode, + service: "osmosis.mint.v1beta1.Query", + method: "EpochProvisions" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputosmojs/osmosis/pool-incentives/v1beta1/query.rpc.Query.ts b/__fixtures__/v-next/outputosmojs/osmosis/pool-incentives/v1beta1/query.rpc.Query.ts index 0da0162dbd..c86f0f4401 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/pool-incentives/v1beta1/query.rpc.Query.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/pool-incentives/v1beta1/query.rpc.Query.ts @@ -1,7 +1,7 @@ import { Duration, DurationSDKType } from "../../../google/protobuf/duration"; import { DistrInfo, DistrInfoSDKType, Params, ParamsSDKType } from "./incentives"; import { Gauge, GaugeSDKType } from "../../incentives/gauge"; -import { Rpc } from "../../../helpers"; +import { TxRpc } from "../../../types"; import { BinaryReader } from "../../../binary"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; import { QueryGaugeIdsRequest, QueryGaugeIdsRequestSDKType, QueryGaugeIdsResponse, QueryGaugeIdsResponseSDKType, QueryDistrInfoRequest, QueryDistrInfoRequestSDKType, QueryDistrInfoResponse, QueryDistrInfoResponseSDKType, QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, QueryLockableDurationsRequest, QueryLockableDurationsRequestSDKType, QueryLockableDurationsResponse, QueryLockableDurationsResponseSDKType, QueryIncentivizedPoolsRequest, QueryIncentivizedPoolsRequestSDKType, QueryIncentivizedPoolsResponse, QueryIncentivizedPoolsResponseSDKType, QueryExternalIncentiveGaugesRequest, QueryExternalIncentiveGaugesRequestSDKType, QueryExternalIncentiveGaugesResponse, QueryExternalIncentiveGaugesResponseSDKType } from "./query"; @@ -20,8 +20,8 @@ export interface Query { externalIncentiveGauges(request?: QueryExternalIncentiveGaugesRequest): Promise; } export class QueryClientImpl implements Query { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.gaugeIds = this.gaugeIds.bind(this); this.distrInfo = this.distrInfo.bind(this); diff --git a/__fixtures__/v-next/outputosmojs/osmosis/pool-incentives/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputosmojs/osmosis/pool-incentives/v1beta1/query.rpc.func.ts new file mode 100644 index 0000000000..468816faa5 --- /dev/null +++ b/__fixtures__/v-next/outputosmojs/osmosis/pool-incentives/v1beta1/query.rpc.func.ts @@ -0,0 +1,77 @@ +import { Duration, DurationSDKType } from "../../../google/protobuf/duration"; +import { DistrInfo, DistrInfoSDKType, Params, ParamsSDKType } from "./incentives"; +import { Gauge, GaugeSDKType } from "../../incentives/gauge"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { QueryGaugeIdsRequest, QueryGaugeIdsRequestSDKType, QueryGaugeIdsResponse, QueryGaugeIdsResponseSDKType, QueryDistrInfoRequest, QueryDistrInfoRequestSDKType, QueryDistrInfoResponse, QueryDistrInfoResponseSDKType, QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, QueryLockableDurationsRequest, QueryLockableDurationsRequestSDKType, QueryLockableDurationsResponse, QueryLockableDurationsResponseSDKType, QueryIncentivizedPoolsRequest, QueryIncentivizedPoolsRequestSDKType, QueryIncentivizedPoolsResponse, QueryIncentivizedPoolsResponseSDKType, QueryExternalIncentiveGaugesRequest, QueryExternalIncentiveGaugesRequestSDKType, QueryExternalIncentiveGaugesResponse, QueryExternalIncentiveGaugesResponseSDKType } from "./query"; +/** + * GaugeIds takes the pool id and returns the matching gauge ids and durations + * @name getGaugeIds + * @package osmosis.poolincentives.v1beta1 + * @see proto service: osmosis.poolincentives.v1beta1.GaugeIds + */ +export const getGaugeIds = buildQuery({ + encode: QueryGaugeIdsRequest.encode, + decode: QueryGaugeIdsResponse.decode, + service: "osmosis.poolincentives.v1beta1.Query", + method: "GaugeIds" +}); +/** + * DistrInfo returns the pool's matching gauge ids and weights. + * @name getDistrInfo + * @package osmosis.poolincentives.v1beta1 + * @see proto service: osmosis.poolincentives.v1beta1.DistrInfo + */ +export const getDistrInfo = buildQuery({ + encode: QueryDistrInfoRequest.encode, + decode: QueryDistrInfoResponse.decode, + service: "osmosis.poolincentives.v1beta1.Query", + method: "DistrInfo" +}); +/** + * Params returns pool incentives params. + * @name getParams + * @package osmosis.poolincentives.v1beta1 + * @see proto service: osmosis.poolincentives.v1beta1.Params + */ +export const getParams = buildQuery({ + encode: QueryParamsRequest.encode, + decode: QueryParamsResponse.decode, + service: "osmosis.poolincentives.v1beta1.Query", + method: "Params" +}); +/** + * LockableDurations returns lock durations for pools. + * @name getLockableDurations + * @package osmosis.poolincentives.v1beta1 + * @see proto service: osmosis.poolincentives.v1beta1.LockableDurations + */ +export const getLockableDurations = buildQuery({ + encode: QueryLockableDurationsRequest.encode, + decode: QueryLockableDurationsResponse.decode, + service: "osmosis.poolincentives.v1beta1.Query", + method: "LockableDurations" +}); +/** + * IncentivizedPools returns currently incentivized pools + * @name getIncentivizedPools + * @package osmosis.poolincentives.v1beta1 + * @see proto service: osmosis.poolincentives.v1beta1.IncentivizedPools + */ +export const getIncentivizedPools = buildQuery({ + encode: QueryIncentivizedPoolsRequest.encode, + decode: QueryIncentivizedPoolsResponse.decode, + service: "osmosis.poolincentives.v1beta1.Query", + method: "IncentivizedPools" +}); +/** + * ExternalIncentiveGauges returns external incentive gauges. + * @name getExternalIncentiveGauges + * @package osmosis.poolincentives.v1beta1 + * @see proto service: osmosis.poolincentives.v1beta1.ExternalIncentiveGauges + */ +export const getExternalIncentiveGauges = buildQuery({ + encode: QueryExternalIncentiveGaugesRequest.encode, + decode: QueryExternalIncentiveGaugesResponse.decode, + service: "osmosis.poolincentives.v1beta1.Query", + method: "ExternalIncentiveGauges" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputosmojs/osmosis/poolmanager/v1beta1/query.rpc.Query.ts b/__fixtures__/v-next/outputosmojs/osmosis/poolmanager/v1beta1/query.rpc.Query.ts index 9ebe50f257..a0b1b7006b 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/poolmanager/v1beta1/query.rpc.Query.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/poolmanager/v1beta1/query.rpc.Query.ts @@ -1,7 +1,7 @@ import { SwapAmountInRoute, SwapAmountInRouteSDKType, SwapAmountOutRoute, SwapAmountOutRouteSDKType } from "./swap_route"; import { Params, ParamsSDKType } from "./genesis"; import { Any, AnySDKType } from "../../../google/protobuf/any"; -import { Rpc } from "../../../helpers"; +import { TxRpc } from "../../../types"; import { BinaryReader } from "../../../binary"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; import { ParamsRequest, ParamsRequestSDKType, ParamsResponse, ParamsResponseSDKType, EstimateSwapExactAmountInRequest, EstimateSwapExactAmountInRequestSDKType, EstimateSwapExactAmountInResponse, EstimateSwapExactAmountInResponseSDKType, EstimateSinglePoolSwapExactAmountInRequest, EstimateSinglePoolSwapExactAmountInRequestSDKType, EstimateSwapExactAmountOutRequest, EstimateSwapExactAmountOutRequestSDKType, EstimateSwapExactAmountOutResponse, EstimateSwapExactAmountOutResponseSDKType, EstimateSinglePoolSwapExactAmountOutRequest, EstimateSinglePoolSwapExactAmountOutRequestSDKType, NumPoolsRequest, NumPoolsRequestSDKType, NumPoolsResponse, NumPoolsResponseSDKType, PoolRequest, PoolRequestSDKType, PoolResponse, PoolResponseSDKType, AllPoolsRequest, AllPoolsRequestSDKType, AllPoolsResponse, AllPoolsResponseSDKType, SpotPriceRequest, SpotPriceRequestSDKType, SpotPriceResponse, SpotPriceResponseSDKType } from "./query"; @@ -26,8 +26,8 @@ export interface Query { spotPrice(request: SpotPriceRequest): Promise; } export class QueryClientImpl implements Query { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.params = this.params.bind(this); this.estimateSwapExactAmountIn = this.estimateSwapExactAmountIn.bind(this); diff --git a/__fixtures__/v-next/outputosmojs/osmosis/poolmanager/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputosmojs/osmosis/poolmanager/v1beta1/query.rpc.func.ts new file mode 100644 index 0000000000..f699ad191a --- /dev/null +++ b/__fixtures__/v-next/outputosmojs/osmosis/poolmanager/v1beta1/query.rpc.func.ts @@ -0,0 +1,111 @@ +import { SwapAmountInRoute, SwapAmountInRouteSDKType, SwapAmountOutRoute, SwapAmountOutRouteSDKType } from "./swap_route"; +import { Params, ParamsSDKType } from "./genesis"; +import { Any, AnySDKType } from "../../../google/protobuf/any"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { ParamsRequest, ParamsRequestSDKType, ParamsResponse, ParamsResponseSDKType, EstimateSwapExactAmountInRequest, EstimateSwapExactAmountInRequestSDKType, EstimateSwapExactAmountInResponse, EstimateSwapExactAmountInResponseSDKType, EstimateSinglePoolSwapExactAmountInRequest, EstimateSinglePoolSwapExactAmountInRequestSDKType, EstimateSwapExactAmountOutRequest, EstimateSwapExactAmountOutRequestSDKType, EstimateSwapExactAmountOutResponse, EstimateSwapExactAmountOutResponseSDKType, EstimateSinglePoolSwapExactAmountOutRequest, EstimateSinglePoolSwapExactAmountOutRequestSDKType, NumPoolsRequest, NumPoolsRequestSDKType, NumPoolsResponse, NumPoolsResponseSDKType, PoolRequest, PoolRequestSDKType, PoolResponse, PoolResponseSDKType, AllPoolsRequest, AllPoolsRequestSDKType, AllPoolsResponse, AllPoolsResponseSDKType, SpotPriceRequest, SpotPriceRequestSDKType, SpotPriceResponse, SpotPriceResponseSDKType } from "./query"; +/** + * @name getParams + * @package osmosis.poolmanager.v1beta1 + * @see proto service: osmosis.poolmanager.v1beta1.Params + */ +export const getParams = buildQuery({ + encode: ParamsRequest.encode, + decode: ParamsResponse.decode, + service: "osmosis.poolmanager.v1beta1.Query", + method: "Params" +}); +/** + * Estimates swap amount out given in. + * @name getEstimateSwapExactAmountIn + * @package osmosis.poolmanager.v1beta1 + * @see proto service: osmosis.poolmanager.v1beta1.EstimateSwapExactAmountIn + */ +export const getEstimateSwapExactAmountIn = buildQuery({ + encode: EstimateSwapExactAmountInRequest.encode, + decode: EstimateSwapExactAmountInResponse.decode, + service: "osmosis.poolmanager.v1beta1.Query", + method: "EstimateSwapExactAmountIn" +}); +/** + * @name getEstimateSinglePoolSwapExactAmountIn + * @package osmosis.poolmanager.v1beta1 + * @see proto service: osmosis.poolmanager.v1beta1.EstimateSinglePoolSwapExactAmountIn + */ +export const getEstimateSinglePoolSwapExactAmountIn = buildQuery({ + encode: EstimateSinglePoolSwapExactAmountInRequest.encode, + decode: EstimateSwapExactAmountInResponse.decode, + service: "osmosis.poolmanager.v1beta1.Query", + method: "EstimateSinglePoolSwapExactAmountIn" +}); +/** + * Estimates swap amount in given out. + * @name getEstimateSwapExactAmountOut + * @package osmosis.poolmanager.v1beta1 + * @see proto service: osmosis.poolmanager.v1beta1.EstimateSwapExactAmountOut + */ +export const getEstimateSwapExactAmountOut = buildQuery({ + encode: EstimateSwapExactAmountOutRequest.encode, + decode: EstimateSwapExactAmountOutResponse.decode, + service: "osmosis.poolmanager.v1beta1.Query", + method: "EstimateSwapExactAmountOut" +}); +/** + * @name getEstimateSinglePoolSwapExactAmountOut + * @package osmosis.poolmanager.v1beta1 + * @see proto service: osmosis.poolmanager.v1beta1.EstimateSinglePoolSwapExactAmountOut + */ +export const getEstimateSinglePoolSwapExactAmountOut = buildQuery({ + encode: EstimateSinglePoolSwapExactAmountOutRequest.encode, + decode: EstimateSwapExactAmountOutResponse.decode, + service: "osmosis.poolmanager.v1beta1.Query", + method: "EstimateSinglePoolSwapExactAmountOut" +}); +/** + * Returns the total number of pools existing in Osmosis. + * @name getNumPools + * @package osmosis.poolmanager.v1beta1 + * @see proto service: osmosis.poolmanager.v1beta1.NumPools + */ +export const getNumPools = buildQuery({ + encode: NumPoolsRequest.encode, + decode: NumPoolsResponse.decode, + service: "osmosis.poolmanager.v1beta1.Query", + method: "NumPools" +}); +/** + * Pool returns the Pool specified by the pool id + * @name getPool + * @package osmosis.poolmanager.v1beta1 + * @see proto service: osmosis.poolmanager.v1beta1.Pool + */ +export const getPool = buildQuery({ + encode: PoolRequest.encode, + decode: PoolResponse.decode, + service: "osmosis.poolmanager.v1beta1.Query", + method: "Pool" +}); +/** + * AllPools returns all pools on the Osmosis chain sorted by IDs. + * @name getAllPools + * @package osmosis.poolmanager.v1beta1 + * @see proto service: osmosis.poolmanager.v1beta1.AllPools + */ +export const getAllPools = buildQuery({ + encode: AllPoolsRequest.encode, + decode: AllPoolsResponse.decode, + service: "osmosis.poolmanager.v1beta1.Query", + method: "AllPools" +}); +/** + * SpotPrice defines a gRPC query handler that returns the spot price given + * a base denomination and a quote denomination. + * @name getSpotPrice + * @package osmosis.poolmanager.v1beta1 + * @see proto service: osmosis.poolmanager.v1beta1.SpotPrice + */ +export const getSpotPrice = buildQuery({ + encode: SpotPriceRequest.encode, + decode: SpotPriceResponse.decode, + service: "osmosis.poolmanager.v1beta1.Query", + method: "SpotPrice" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputosmojs/osmosis/poolmanager/v1beta1/tx.registry.ts b/__fixtures__/v-next/outputosmojs/osmosis/poolmanager/v1beta1/tx.registry.ts index 883d9dce5c..1fc39b1d05 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/poolmanager/v1beta1/tx.registry.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/poolmanager/v1beta1/tx.registry.ts @@ -1,13 +1,8 @@ import { SwapAmountInRoute, SwapAmountInRouteSDKType, SwapAmountOutRoute, SwapAmountOutRouteSDKType } from "./swap_route"; import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; -import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { TelescopeGeneratedType } from "../../../types"; import { MsgSwapExactAmountIn, MsgSwapExactAmountInSDKType, MsgSwapExactAmountOut, MsgSwapExactAmountOutSDKType } from "./tx"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/osmosis.poolmanager.v1beta1.MsgSwapExactAmountIn", MsgSwapExactAmountIn], ["/osmosis.poolmanager.v1beta1.MsgSwapExactAmountOut", MsgSwapExactAmountOut]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/osmosis.poolmanager.v1beta1.MsgSwapExactAmountIn", MsgSwapExactAmountIn], ["/osmosis.poolmanager.v1beta1.MsgSwapExactAmountOut", MsgSwapExactAmountOut]]; export const MessageComposer = { encoded: { swapExactAmountIn(value: MsgSwapExactAmountIn) { diff --git a/__fixtures__/v-next/outputosmojs/osmosis/poolmanager/v1beta1/tx.rpc.func.ts b/__fixtures__/v-next/outputosmojs/osmosis/poolmanager/v1beta1/tx.rpc.func.ts new file mode 100644 index 0000000000..e378264ec2 --- /dev/null +++ b/__fixtures__/v-next/outputosmojs/osmosis/poolmanager/v1beta1/tx.rpc.func.ts @@ -0,0 +1,20 @@ +import { SwapAmountInRoute, SwapAmountInRouteSDKType, SwapAmountOutRoute, SwapAmountOutRouteSDKType } from "./swap_route"; +import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; +import { buildTx } from "../../../helper-func-types"; +import { MsgSwapExactAmountIn, MsgSwapExactAmountInSDKType, MsgSwapExactAmountInResponse, MsgSwapExactAmountInResponseSDKType, MsgSwapExactAmountOut, MsgSwapExactAmountOutSDKType, MsgSwapExactAmountOutResponse, MsgSwapExactAmountOutResponseSDKType } from "./tx"; +/** + * @name swapExactAmountIn + * @package osmosis.poolmanager.v1beta1 + * @see proto service: osmosis.poolmanager.v1beta1.SwapExactAmountIn + */ +export const swapExactAmountIn = buildTx({ + msg: MsgSwapExactAmountIn +}); +/** + * @name swapExactAmountOut + * @package osmosis.poolmanager.v1beta1 + * @see proto service: osmosis.poolmanager.v1beta1.SwapExactAmountOut + */ +export const swapExactAmountOut = buildTx({ + msg: MsgSwapExactAmountOut +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputosmojs/osmosis/poolmanager/v1beta1/tx.rpc.msg.ts b/__fixtures__/v-next/outputosmojs/osmosis/poolmanager/v1beta1/tx.rpc.msg.ts index 777133554e..e1f6104108 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/poolmanager/v1beta1/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/poolmanager/v1beta1/tx.rpc.msg.ts @@ -1,6 +1,6 @@ import { SwapAmountInRoute, SwapAmountInRouteSDKType, SwapAmountOutRoute, SwapAmountOutRouteSDKType } from "./swap_route"; import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; -import { Rpc } from "../../../helpers"; +import { TxRpc } from "../../../types"; import { BinaryReader } from "../../../binary"; import { MsgSwapExactAmountIn, MsgSwapExactAmountInSDKType, MsgSwapExactAmountInResponse, MsgSwapExactAmountInResponseSDKType, MsgSwapExactAmountOut, MsgSwapExactAmountOutSDKType, MsgSwapExactAmountOutResponse, MsgSwapExactAmountOutResponseSDKType } from "./tx"; export interface Msg { @@ -8,8 +8,8 @@ export interface Msg { swapExactAmountOut(request: MsgSwapExactAmountOut): Promise; } export class MsgClientImpl implements Msg { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.swapExactAmountIn = this.swapExactAmountIn.bind(this); this.swapExactAmountOut = this.swapExactAmountOut.bind(this); @@ -25,6 +25,6 @@ export class MsgClientImpl implements Msg { return promise.then(data => MsgSwapExactAmountOutResponse.decode(new BinaryReader(data))); } } -export const createClientImpl = (rpc: Rpc) => { +export const createClientImpl = (rpc: TxRpc) => { return new MsgClientImpl(rpc); }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputosmojs/osmosis/protorev/v1beta1/query.rpc.Query.ts b/__fixtures__/v-next/outputosmojs/osmosis/protorev/v1beta1/query.rpc.Query.ts index bcc9f9b448..890be09dcf 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/protorev/v1beta1/query.rpc.Query.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/protorev/v1beta1/query.rpc.Query.ts @@ -1,7 +1,7 @@ import { Params, ParamsSDKType } from "./params"; import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { RouteStatistics, RouteStatisticsSDKType, TokenPairArbRoutes, TokenPairArbRoutesSDKType, PoolWeights, PoolWeightsSDKType, BaseDenom, BaseDenomSDKType } from "./protorev"; -import { Rpc } from "../../../helpers"; +import { TxRpc } from "../../../types"; import { BinaryReader } from "../../../binary"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; import { QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, QueryGetProtoRevNumberOfTradesRequest, QueryGetProtoRevNumberOfTradesRequestSDKType, QueryGetProtoRevNumberOfTradesResponse, QueryGetProtoRevNumberOfTradesResponseSDKType, QueryGetProtoRevProfitsByDenomRequest, QueryGetProtoRevProfitsByDenomRequestSDKType, QueryGetProtoRevProfitsByDenomResponse, QueryGetProtoRevProfitsByDenomResponseSDKType, QueryGetProtoRevAllProfitsRequest, QueryGetProtoRevAllProfitsRequestSDKType, QueryGetProtoRevAllProfitsResponse, QueryGetProtoRevAllProfitsResponseSDKType, QueryGetProtoRevStatisticsByRouteRequest, QueryGetProtoRevStatisticsByRouteRequestSDKType, QueryGetProtoRevStatisticsByRouteResponse, QueryGetProtoRevStatisticsByRouteResponseSDKType, QueryGetProtoRevAllRouteStatisticsRequest, QueryGetProtoRevAllRouteStatisticsRequestSDKType, QueryGetProtoRevAllRouteStatisticsResponse, QueryGetProtoRevAllRouteStatisticsResponseSDKType, QueryGetProtoRevTokenPairArbRoutesRequest, QueryGetProtoRevTokenPairArbRoutesRequestSDKType, QueryGetProtoRevTokenPairArbRoutesResponse, QueryGetProtoRevTokenPairArbRoutesResponseSDKType, QueryGetProtoRevAdminAccountRequest, QueryGetProtoRevAdminAccountRequestSDKType, QueryGetProtoRevAdminAccountResponse, QueryGetProtoRevAdminAccountResponseSDKType, QueryGetProtoRevDeveloperAccountRequest, QueryGetProtoRevDeveloperAccountRequestSDKType, QueryGetProtoRevDeveloperAccountResponse, QueryGetProtoRevDeveloperAccountResponseSDKType, QueryGetProtoRevPoolWeightsRequest, QueryGetProtoRevPoolWeightsRequestSDKType, QueryGetProtoRevPoolWeightsResponse, QueryGetProtoRevPoolWeightsResponseSDKType, QueryGetProtoRevMaxPoolPointsPerTxRequest, QueryGetProtoRevMaxPoolPointsPerTxRequestSDKType, QueryGetProtoRevMaxPoolPointsPerTxResponse, QueryGetProtoRevMaxPoolPointsPerTxResponseSDKType, QueryGetProtoRevMaxPoolPointsPerBlockRequest, QueryGetProtoRevMaxPoolPointsPerBlockRequestSDKType, QueryGetProtoRevMaxPoolPointsPerBlockResponse, QueryGetProtoRevMaxPoolPointsPerBlockResponseSDKType, QueryGetProtoRevBaseDenomsRequest, QueryGetProtoRevBaseDenomsRequestSDKType, QueryGetProtoRevBaseDenomsResponse, QueryGetProtoRevBaseDenomsResponseSDKType, QueryGetProtoRevEnabledRequest, QueryGetProtoRevEnabledRequestSDKType, QueryGetProtoRevEnabledResponse, QueryGetProtoRevEnabledResponseSDKType } from "./query"; @@ -62,8 +62,8 @@ export interface Query { getProtoRevEnabled(request?: QueryGetProtoRevEnabledRequest): Promise; } export class QueryClientImpl implements Query { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.params = this.params.bind(this); this.getProtoRevNumberOfTrades = this.getProtoRevNumberOfTrades.bind(this); diff --git a/__fixtures__/v-next/outputosmojs/osmosis/protorev/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputosmojs/osmosis/protorev/v1beta1/query.rpc.func.ts new file mode 100644 index 0000000000..7a6b858bf5 --- /dev/null +++ b/__fixtures__/v-next/outputosmojs/osmosis/protorev/v1beta1/query.rpc.func.ts @@ -0,0 +1,182 @@ +import { Params, ParamsSDKType } from "./params"; +import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; +import { RouteStatistics, RouteStatisticsSDKType, TokenPairArbRoutes, TokenPairArbRoutesSDKType, PoolWeights, PoolWeightsSDKType, BaseDenom, BaseDenomSDKType } from "./protorev"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, QueryGetProtoRevNumberOfTradesRequest, QueryGetProtoRevNumberOfTradesRequestSDKType, QueryGetProtoRevNumberOfTradesResponse, QueryGetProtoRevNumberOfTradesResponseSDKType, QueryGetProtoRevProfitsByDenomRequest, QueryGetProtoRevProfitsByDenomRequestSDKType, QueryGetProtoRevProfitsByDenomResponse, QueryGetProtoRevProfitsByDenomResponseSDKType, QueryGetProtoRevAllProfitsRequest, QueryGetProtoRevAllProfitsRequestSDKType, QueryGetProtoRevAllProfitsResponse, QueryGetProtoRevAllProfitsResponseSDKType, QueryGetProtoRevStatisticsByRouteRequest, QueryGetProtoRevStatisticsByRouteRequestSDKType, QueryGetProtoRevStatisticsByRouteResponse, QueryGetProtoRevStatisticsByRouteResponseSDKType, QueryGetProtoRevAllRouteStatisticsRequest, QueryGetProtoRevAllRouteStatisticsRequestSDKType, QueryGetProtoRevAllRouteStatisticsResponse, QueryGetProtoRevAllRouteStatisticsResponseSDKType, QueryGetProtoRevTokenPairArbRoutesRequest, QueryGetProtoRevTokenPairArbRoutesRequestSDKType, QueryGetProtoRevTokenPairArbRoutesResponse, QueryGetProtoRevTokenPairArbRoutesResponseSDKType, QueryGetProtoRevAdminAccountRequest, QueryGetProtoRevAdminAccountRequestSDKType, QueryGetProtoRevAdminAccountResponse, QueryGetProtoRevAdminAccountResponseSDKType, QueryGetProtoRevDeveloperAccountRequest, QueryGetProtoRevDeveloperAccountRequestSDKType, QueryGetProtoRevDeveloperAccountResponse, QueryGetProtoRevDeveloperAccountResponseSDKType, QueryGetProtoRevPoolWeightsRequest, QueryGetProtoRevPoolWeightsRequestSDKType, QueryGetProtoRevPoolWeightsResponse, QueryGetProtoRevPoolWeightsResponseSDKType, QueryGetProtoRevMaxPoolPointsPerTxRequest, QueryGetProtoRevMaxPoolPointsPerTxRequestSDKType, QueryGetProtoRevMaxPoolPointsPerTxResponse, QueryGetProtoRevMaxPoolPointsPerTxResponseSDKType, QueryGetProtoRevMaxPoolPointsPerBlockRequest, QueryGetProtoRevMaxPoolPointsPerBlockRequestSDKType, QueryGetProtoRevMaxPoolPointsPerBlockResponse, QueryGetProtoRevMaxPoolPointsPerBlockResponseSDKType, QueryGetProtoRevBaseDenomsRequest, QueryGetProtoRevBaseDenomsRequestSDKType, QueryGetProtoRevBaseDenomsResponse, QueryGetProtoRevBaseDenomsResponseSDKType, QueryGetProtoRevEnabledRequest, QueryGetProtoRevEnabledRequestSDKType, QueryGetProtoRevEnabledResponse, QueryGetProtoRevEnabledResponseSDKType } from "./query"; +/** + * Params queries the parameters of the module. + * @name getParams + * @package osmosis.protorev.v1beta1 + * @see proto service: osmosis.protorev.v1beta1.Params + */ +export const getParams = buildQuery({ + encode: QueryParamsRequest.encode, + decode: QueryParamsResponse.decode, + service: "osmosis.protorev.v1beta1.Query", + method: "Params" +}); +/** + * GetProtoRevNumberOfTrades queries the number of arbitrage trades the module + * has executed + * @name getGetProtoRevNumberOfTrades + * @package osmosis.protorev.v1beta1 + * @see proto service: osmosis.protorev.v1beta1.GetProtoRevNumberOfTrades + */ +export const getGetProtoRevNumberOfTrades = buildQuery({ + encode: QueryGetProtoRevNumberOfTradesRequest.encode, + decode: QueryGetProtoRevNumberOfTradesResponse.decode, + service: "osmosis.protorev.v1beta1.Query", + method: "GetProtoRevNumberOfTrades" +}); +/** + * GetProtoRevProfitsByDenom queries the profits of the module by denom + * @name getGetProtoRevProfitsByDenom + * @package osmosis.protorev.v1beta1 + * @see proto service: osmosis.protorev.v1beta1.GetProtoRevProfitsByDenom + */ +export const getGetProtoRevProfitsByDenom = buildQuery({ + encode: QueryGetProtoRevProfitsByDenomRequest.encode, + decode: QueryGetProtoRevProfitsByDenomResponse.decode, + service: "osmosis.protorev.v1beta1.Query", + method: "GetProtoRevProfitsByDenom" +}); +/** + * GetProtoRevAllProfits queries all of the profits from the module + * @name getGetProtoRevAllProfits + * @package osmosis.protorev.v1beta1 + * @see proto service: osmosis.protorev.v1beta1.GetProtoRevAllProfits + */ +export const getGetProtoRevAllProfits = buildQuery({ + encode: QueryGetProtoRevAllProfitsRequest.encode, + decode: QueryGetProtoRevAllProfitsResponse.decode, + service: "osmosis.protorev.v1beta1.Query", + method: "GetProtoRevAllProfits" +}); +/** + * GetProtoRevStatisticsByRoute queries the number of arbitrages and profits + * that have been executed for a given route + * @name getGetProtoRevStatisticsByRoute + * @package osmosis.protorev.v1beta1 + * @see proto service: osmosis.protorev.v1beta1.GetProtoRevStatisticsByRoute + */ +export const getGetProtoRevStatisticsByRoute = buildQuery({ + encode: QueryGetProtoRevStatisticsByRouteRequest.encode, + decode: QueryGetProtoRevStatisticsByRouteResponse.decode, + service: "osmosis.protorev.v1beta1.Query", + method: "GetProtoRevStatisticsByRoute" +}); +/** + * GetProtoRevAllRouteStatistics queries all of routes that the module has + * arbitraged against and the number of trades and profits that have been + * accumulated for each route + * @name getGetProtoRevAllRouteStatistics + * @package osmosis.protorev.v1beta1 + * @see proto service: osmosis.protorev.v1beta1.GetProtoRevAllRouteStatistics + */ +export const getGetProtoRevAllRouteStatistics = buildQuery({ + encode: QueryGetProtoRevAllRouteStatisticsRequest.encode, + decode: QueryGetProtoRevAllRouteStatisticsResponse.decode, + service: "osmosis.protorev.v1beta1.Query", + method: "GetProtoRevAllRouteStatistics" +}); +/** + * GetProtoRevTokenPairArbRoutes queries all of the hot routes that the module + * is currently arbitraging + * @name getGetProtoRevTokenPairArbRoutes + * @package osmosis.protorev.v1beta1 + * @see proto service: osmosis.protorev.v1beta1.GetProtoRevTokenPairArbRoutes + */ +export const getGetProtoRevTokenPairArbRoutes = buildQuery({ + encode: QueryGetProtoRevTokenPairArbRoutesRequest.encode, + decode: QueryGetProtoRevTokenPairArbRoutesResponse.decode, + service: "osmosis.protorev.v1beta1.Query", + method: "GetProtoRevTokenPairArbRoutes" +}); +/** + * GetProtoRevAdminAccount queries the admin account of the module + * @name getGetProtoRevAdminAccount + * @package osmosis.protorev.v1beta1 + * @see proto service: osmosis.protorev.v1beta1.GetProtoRevAdminAccount + */ +export const getGetProtoRevAdminAccount = buildQuery({ + encode: QueryGetProtoRevAdminAccountRequest.encode, + decode: QueryGetProtoRevAdminAccountResponse.decode, + service: "osmosis.protorev.v1beta1.Query", + method: "GetProtoRevAdminAccount" +}); +/** + * GetProtoRevDeveloperAccount queries the developer account of the module + * @name getGetProtoRevDeveloperAccount + * @package osmosis.protorev.v1beta1 + * @see proto service: osmosis.protorev.v1beta1.GetProtoRevDeveloperAccount + */ +export const getGetProtoRevDeveloperAccount = buildQuery({ + encode: QueryGetProtoRevDeveloperAccountRequest.encode, + decode: QueryGetProtoRevDeveloperAccountResponse.decode, + service: "osmosis.protorev.v1beta1.Query", + method: "GetProtoRevDeveloperAccount" +}); +/** + * GetProtoRevPoolWeights queries the weights of each pool type currently + * being used by the module + * @name getGetProtoRevPoolWeights + * @package osmosis.protorev.v1beta1 + * @see proto service: osmosis.protorev.v1beta1.GetProtoRevPoolWeights + */ +export const getGetProtoRevPoolWeights = buildQuery({ + encode: QueryGetProtoRevPoolWeightsRequest.encode, + decode: QueryGetProtoRevPoolWeightsResponse.decode, + service: "osmosis.protorev.v1beta1.Query", + method: "GetProtoRevPoolWeights" +}); +/** + * GetProtoRevMaxPoolPointsPerTx queries the maximum number of pool points + * that can be consumed per transaction + * @name getGetProtoRevMaxPoolPointsPerTx + * @package osmosis.protorev.v1beta1 + * @see proto service: osmosis.protorev.v1beta1.GetProtoRevMaxPoolPointsPerTx + */ +export const getGetProtoRevMaxPoolPointsPerTx = buildQuery({ + encode: QueryGetProtoRevMaxPoolPointsPerTxRequest.encode, + decode: QueryGetProtoRevMaxPoolPointsPerTxResponse.decode, + service: "osmosis.protorev.v1beta1.Query", + method: "GetProtoRevMaxPoolPointsPerTx" +}); +/** + * GetProtoRevMaxPoolPointsPerBlock queries the maximum number of pool points + * that can consumed per block + * @name getGetProtoRevMaxPoolPointsPerBlock + * @package osmosis.protorev.v1beta1 + * @see proto service: osmosis.protorev.v1beta1.GetProtoRevMaxPoolPointsPerBlock + */ +export const getGetProtoRevMaxPoolPointsPerBlock = buildQuery({ + encode: QueryGetProtoRevMaxPoolPointsPerBlockRequest.encode, + decode: QueryGetProtoRevMaxPoolPointsPerBlockResponse.decode, + service: "osmosis.protorev.v1beta1.Query", + method: "GetProtoRevMaxPoolPointsPerBlock" +}); +/** + * GetProtoRevBaseDenoms queries the base denoms that the module is currently + * utilizing for arbitrage + * @name getGetProtoRevBaseDenoms + * @package osmosis.protorev.v1beta1 + * @see proto service: osmosis.protorev.v1beta1.GetProtoRevBaseDenoms + */ +export const getGetProtoRevBaseDenoms = buildQuery({ + encode: QueryGetProtoRevBaseDenomsRequest.encode, + decode: QueryGetProtoRevBaseDenomsResponse.decode, + service: "osmosis.protorev.v1beta1.Query", + method: "GetProtoRevBaseDenoms" +}); +/** + * GetProtoRevEnabled queries whether the module is enabled or not + * @name getGetProtoRevEnabled + * @package osmosis.protorev.v1beta1 + * @see proto service: osmosis.protorev.v1beta1.GetProtoRevEnabled + */ +export const getGetProtoRevEnabled = buildQuery({ + encode: QueryGetProtoRevEnabledRequest.encode, + decode: QueryGetProtoRevEnabledResponse.decode, + service: "osmosis.protorev.v1beta1.Query", + method: "GetProtoRevEnabled" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputosmojs/osmosis/protorev/v1beta1/tx.registry.ts b/__fixtures__/v-next/outputosmojs/osmosis/protorev/v1beta1/tx.registry.ts index 7450097fdf..dbec0c67f9 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/protorev/v1beta1/tx.registry.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/protorev/v1beta1/tx.registry.ts @@ -1,12 +1,7 @@ import { TokenPairArbRoutes, TokenPairArbRoutesSDKType, PoolWeights, PoolWeightsSDKType, BaseDenom, BaseDenomSDKType } from "./protorev"; -import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { TelescopeGeneratedType } from "../../../types"; import { MsgSetHotRoutes, MsgSetHotRoutesSDKType, MsgSetDeveloperAccount, MsgSetDeveloperAccountSDKType, MsgSetMaxPoolPointsPerTx, MsgSetMaxPoolPointsPerTxSDKType, MsgSetMaxPoolPointsPerBlock, MsgSetMaxPoolPointsPerBlockSDKType, MsgSetPoolWeights, MsgSetPoolWeightsSDKType, MsgSetBaseDenoms, MsgSetBaseDenomsSDKType } from "./tx"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/osmosis.protorev.v1beta1.MsgSetHotRoutes", MsgSetHotRoutes], ["/osmosis.protorev.v1beta1.MsgSetDeveloperAccount", MsgSetDeveloperAccount], ["/osmosis.protorev.v1beta1.MsgSetMaxPoolPointsPerTx", MsgSetMaxPoolPointsPerTx], ["/osmosis.protorev.v1beta1.MsgSetMaxPoolPointsPerBlock", MsgSetMaxPoolPointsPerBlock], ["/osmosis.protorev.v1beta1.MsgSetPoolWeights", MsgSetPoolWeights], ["/osmosis.protorev.v1beta1.MsgSetBaseDenoms", MsgSetBaseDenoms]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/osmosis.protorev.v1beta1.MsgSetHotRoutes", MsgSetHotRoutes], ["/osmosis.protorev.v1beta1.MsgSetDeveloperAccount", MsgSetDeveloperAccount], ["/osmosis.protorev.v1beta1.MsgSetMaxPoolPointsPerTx", MsgSetMaxPoolPointsPerTx], ["/osmosis.protorev.v1beta1.MsgSetMaxPoolPointsPerBlock", MsgSetMaxPoolPointsPerBlock], ["/osmosis.protorev.v1beta1.MsgSetPoolWeights", MsgSetPoolWeights], ["/osmosis.protorev.v1beta1.MsgSetBaseDenoms", MsgSetBaseDenoms]]; export const MessageComposer = { encoded: { setHotRoutes(value: MsgSetHotRoutes) { diff --git a/__fixtures__/v-next/outputosmojs/osmosis/protorev/v1beta1/tx.rpc.func.ts b/__fixtures__/v-next/outputosmojs/osmosis/protorev/v1beta1/tx.rpc.func.ts new file mode 100644 index 0000000000..097182fab7 --- /dev/null +++ b/__fixtures__/v-next/outputosmojs/osmosis/protorev/v1beta1/tx.rpc.func.ts @@ -0,0 +1,63 @@ +import { TokenPairArbRoutes, TokenPairArbRoutesSDKType, PoolWeights, PoolWeightsSDKType, BaseDenom, BaseDenomSDKType } from "./protorev"; +import { buildTx } from "../../../helper-func-types"; +import { MsgSetHotRoutes, MsgSetHotRoutesSDKType, MsgSetHotRoutesResponse, MsgSetHotRoutesResponseSDKType, MsgSetDeveloperAccount, MsgSetDeveloperAccountSDKType, MsgSetDeveloperAccountResponse, MsgSetDeveloperAccountResponseSDKType, MsgSetMaxPoolPointsPerTx, MsgSetMaxPoolPointsPerTxSDKType, MsgSetMaxPoolPointsPerTxResponse, MsgSetMaxPoolPointsPerTxResponseSDKType, MsgSetMaxPoolPointsPerBlock, MsgSetMaxPoolPointsPerBlockSDKType, MsgSetMaxPoolPointsPerBlockResponse, MsgSetMaxPoolPointsPerBlockResponseSDKType, MsgSetPoolWeights, MsgSetPoolWeightsSDKType, MsgSetPoolWeightsResponse, MsgSetPoolWeightsResponseSDKType, MsgSetBaseDenoms, MsgSetBaseDenomsSDKType, MsgSetBaseDenomsResponse, MsgSetBaseDenomsResponseSDKType } from "./tx"; +/** + * SetHotRoutes sets the hot routes that will be explored when creating + * cyclic arbitrage routes. Can only be called by the admin account. + * @name setHotRoutes + * @package osmosis.protorev.v1beta1 + * @see proto service: osmosis.protorev.v1beta1.SetHotRoutes + */ +export const setHotRoutes = buildTx({ + msg: MsgSetHotRoutes +}); +/** + * SetDeveloperAccount sets the account that can withdraw a portion of the + * profits from the protorev module. This will be Skip's address. + * @name setDeveloperAccount + * @package osmosis.protorev.v1beta1 + * @see proto service: osmosis.protorev.v1beta1.SetDeveloperAccount + */ +export const setDeveloperAccount = buildTx({ + msg: MsgSetDeveloperAccount +}); +/** + * SetMaxPoolPointsPerTx sets the maximum number of pool points that can be + * consumed per transaction. Can only be called by the admin account. + * @name setMaxPoolPointsPerTx + * @package osmosis.protorev.v1beta1 + * @see proto service: osmosis.protorev.v1beta1.SetMaxPoolPointsPerTx + */ +export const setMaxPoolPointsPerTx = buildTx({ + msg: MsgSetMaxPoolPointsPerTx +}); +/** + * SetMaxPoolPointsPerBlock sets the maximum number of pool points that can be + * consumed per block. Can only be called by the admin account. + * @name setMaxPoolPointsPerBlock + * @package osmosis.protorev.v1beta1 + * @see proto service: osmosis.protorev.v1beta1.SetMaxPoolPointsPerBlock + */ +export const setMaxPoolPointsPerBlock = buildTx({ + msg: MsgSetMaxPoolPointsPerBlock +}); +/** + * SetPoolWeights sets the weights of each pool type in the store. Can only be + * called by the admin account. + * @name setPoolWeights + * @package osmosis.protorev.v1beta1 + * @see proto service: osmosis.protorev.v1beta1.SetPoolWeights + */ +export const setPoolWeights = buildTx({ + msg: MsgSetPoolWeights +}); +/** + * SetBaseDenoms sets the base denoms that will be used to create cyclic + * arbitrage routes. Can only be called by the admin account. + * @name setBaseDenoms + * @package osmosis.protorev.v1beta1 + * @see proto service: osmosis.protorev.v1beta1.SetBaseDenoms + */ +export const setBaseDenoms = buildTx({ + msg: MsgSetBaseDenoms +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputosmojs/osmosis/protorev/v1beta1/tx.rpc.msg.ts b/__fixtures__/v-next/outputosmojs/osmosis/protorev/v1beta1/tx.rpc.msg.ts index c0936a1052..5fdf3524f7 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/protorev/v1beta1/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/protorev/v1beta1/tx.rpc.msg.ts @@ -1,5 +1,5 @@ import { TokenPairArbRoutes, TokenPairArbRoutesSDKType, PoolWeights, PoolWeightsSDKType, BaseDenom, BaseDenomSDKType } from "./protorev"; -import { Rpc } from "../../../helpers"; +import { TxRpc } from "../../../types"; import { BinaryReader } from "../../../binary"; import { MsgSetHotRoutes, MsgSetHotRoutesSDKType, MsgSetHotRoutesResponse, MsgSetHotRoutesResponseSDKType, MsgSetDeveloperAccount, MsgSetDeveloperAccountSDKType, MsgSetDeveloperAccountResponse, MsgSetDeveloperAccountResponseSDKType, MsgSetMaxPoolPointsPerTx, MsgSetMaxPoolPointsPerTxSDKType, MsgSetMaxPoolPointsPerTxResponse, MsgSetMaxPoolPointsPerTxResponseSDKType, MsgSetMaxPoolPointsPerBlock, MsgSetMaxPoolPointsPerBlockSDKType, MsgSetMaxPoolPointsPerBlockResponse, MsgSetMaxPoolPointsPerBlockResponseSDKType, MsgSetPoolWeights, MsgSetPoolWeightsSDKType, MsgSetPoolWeightsResponse, MsgSetPoolWeightsResponseSDKType, MsgSetBaseDenoms, MsgSetBaseDenomsSDKType, MsgSetBaseDenomsResponse, MsgSetBaseDenomsResponseSDKType } from "./tx"; export interface Msg { @@ -35,8 +35,8 @@ export interface Msg { setBaseDenoms(request: MsgSetBaseDenoms): Promise; } export class MsgClientImpl implements Msg { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.setHotRoutes = this.setHotRoutes.bind(this); this.setDeveloperAccount = this.setDeveloperAccount.bind(this); @@ -76,6 +76,6 @@ export class MsgClientImpl implements Msg { return promise.then(data => MsgSetBaseDenomsResponse.decode(new BinaryReader(data))); } } -export const createClientImpl = (rpc: Rpc) => { +export const createClientImpl = (rpc: TxRpc) => { return new MsgClientImpl(rpc); }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputosmojs/osmosis/superfluid/params.ts b/__fixtures__/v-next/outputosmojs/osmosis/superfluid/params.ts index 78a0b33ddb..3968aad658 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/superfluid/params.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/superfluid/params.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { Decimal } from "@cosmjs/math"; +import { Decimal } from "@interchainjs/math"; import { isSet, DeepPartial } from "../../helpers"; import { JsonSafe } from "../../json-safe"; export const protobufPackage = "osmosis.superfluid"; @@ -106,7 +106,7 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.minimum_risk_factor = message.minimumRiskFactor === "" ? undefined : message.minimumRiskFactor; + obj.minimum_risk_factor = message.minimumRiskFactor === "" ? undefined : Decimal.fromUserInput(message.minimumRiskFactor, 18).atomics; return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputosmojs/osmosis/superfluid/query.rpc.Query.ts b/__fixtures__/v-next/outputosmojs/osmosis/superfluid/query.rpc.Query.ts index 084321965b..43e0415219 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/superfluid/query.rpc.Query.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/superfluid/query.rpc.Query.ts @@ -4,7 +4,7 @@ import { SuperfluidAssetType, SuperfluidAssetTypeSDKType, SuperfluidAsset, Super import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; import { SyntheticLock, SyntheticLockSDKType } from "../lockup/lock"; import { DelegationResponse, DelegationResponseSDKType } from "../../cosmos/staking/v1beta1/staking"; -import { Rpc } from "../../helpers"; +import { TxRpc } from "../../types"; import { BinaryReader } from "../../binary"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; import { QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, AssetTypeRequest, AssetTypeRequestSDKType, AssetTypeResponse, AssetTypeResponseSDKType, AllAssetsRequest, AllAssetsRequestSDKType, AllAssetsResponse, AllAssetsResponseSDKType, AssetMultiplierRequest, AssetMultiplierRequestSDKType, AssetMultiplierResponse, AssetMultiplierResponseSDKType, AllIntermediaryAccountsRequest, AllIntermediaryAccountsRequestSDKType, AllIntermediaryAccountsResponse, AllIntermediaryAccountsResponseSDKType, ConnectedIntermediaryAccountRequest, ConnectedIntermediaryAccountRequestSDKType, ConnectedIntermediaryAccountResponse, ConnectedIntermediaryAccountResponseSDKType, QueryTotalDelegationByValidatorForDenomRequest, QueryTotalDelegationByValidatorForDenomRequestSDKType, QueryTotalDelegationByValidatorForDenomResponse, QueryTotalDelegationByValidatorForDenomResponseSDKType, TotalSuperfluidDelegationsRequest, TotalSuperfluidDelegationsRequestSDKType, TotalSuperfluidDelegationsResponse, TotalSuperfluidDelegationsResponseSDKType, SuperfluidDelegationAmountRequest, SuperfluidDelegationAmountRequestSDKType, SuperfluidDelegationAmountResponse, SuperfluidDelegationAmountResponseSDKType, SuperfluidDelegationsByDelegatorRequest, SuperfluidDelegationsByDelegatorRequestSDKType, SuperfluidDelegationsByDelegatorResponse, SuperfluidDelegationsByDelegatorResponseSDKType, SuperfluidUndelegationsByDelegatorRequest, SuperfluidUndelegationsByDelegatorRequestSDKType, SuperfluidUndelegationsByDelegatorResponse, SuperfluidUndelegationsByDelegatorResponseSDKType, SuperfluidDelegationsByValidatorDenomRequest, SuperfluidDelegationsByValidatorDenomRequestSDKType, SuperfluidDelegationsByValidatorDenomResponse, SuperfluidDelegationsByValidatorDenomResponseSDKType, EstimateSuperfluidDelegatedAmountByValidatorDenomRequest, EstimateSuperfluidDelegatedAmountByValidatorDenomRequestSDKType, EstimateSuperfluidDelegatedAmountByValidatorDenomResponse, EstimateSuperfluidDelegatedAmountByValidatorDenomResponseSDKType, QueryTotalDelegationByDelegatorRequest, QueryTotalDelegationByDelegatorRequestSDKType, QueryTotalDelegationByDelegatorResponse, QueryTotalDelegationByDelegatorResponseSDKType, QueryUnpoolWhitelistRequest, QueryUnpoolWhitelistRequestSDKType, QueryUnpoolWhitelistResponse, QueryUnpoolWhitelistResponseSDKType } from "./query"; @@ -58,8 +58,8 @@ export interface Query { unpoolWhitelist(request?: QueryUnpoolWhitelistRequest): Promise; } export class QueryClientImpl implements Query { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.params = this.params.bind(this); this.assetType = this.assetType.bind(this); diff --git a/__fixtures__/v-next/outputosmojs/osmosis/superfluid/query.rpc.func.ts b/__fixtures__/v-next/outputosmojs/osmosis/superfluid/query.rpc.func.ts new file mode 100644 index 0000000000..366d548135 --- /dev/null +++ b/__fixtures__/v-next/outputosmojs/osmosis/superfluid/query.rpc.func.ts @@ -0,0 +1,194 @@ +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../cosmos/base/query/v1beta1/pagination"; +import { Params, ParamsSDKType } from "./params"; +import { SuperfluidAssetType, SuperfluidAssetTypeSDKType, SuperfluidAsset, SuperfluidAssetSDKType, OsmoEquivalentMultiplierRecord, OsmoEquivalentMultiplierRecordSDKType, SuperfluidDelegationRecord, SuperfluidDelegationRecordSDKType } from "./superfluid"; +import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; +import { SyntheticLock, SyntheticLockSDKType } from "../lockup/lock"; +import { DelegationResponse, DelegationResponseSDKType } from "../../cosmos/staking/v1beta1/staking"; +import { EndpointOrRpc, buildQuery } from "../../helper-func-types"; +import { QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, AssetTypeRequest, AssetTypeRequestSDKType, AssetTypeResponse, AssetTypeResponseSDKType, AllAssetsRequest, AllAssetsRequestSDKType, AllAssetsResponse, AllAssetsResponseSDKType, AssetMultiplierRequest, AssetMultiplierRequestSDKType, AssetMultiplierResponse, AssetMultiplierResponseSDKType, AllIntermediaryAccountsRequest, AllIntermediaryAccountsRequestSDKType, AllIntermediaryAccountsResponse, AllIntermediaryAccountsResponseSDKType, ConnectedIntermediaryAccountRequest, ConnectedIntermediaryAccountRequestSDKType, ConnectedIntermediaryAccountResponse, ConnectedIntermediaryAccountResponseSDKType, QueryTotalDelegationByValidatorForDenomRequest, QueryTotalDelegationByValidatorForDenomRequestSDKType, QueryTotalDelegationByValidatorForDenomResponse, QueryTotalDelegationByValidatorForDenomResponseSDKType, TotalSuperfluidDelegationsRequest, TotalSuperfluidDelegationsRequestSDKType, TotalSuperfluidDelegationsResponse, TotalSuperfluidDelegationsResponseSDKType, SuperfluidDelegationAmountRequest, SuperfluidDelegationAmountRequestSDKType, SuperfluidDelegationAmountResponse, SuperfluidDelegationAmountResponseSDKType, SuperfluidDelegationsByDelegatorRequest, SuperfluidDelegationsByDelegatorRequestSDKType, SuperfluidDelegationsByDelegatorResponse, SuperfluidDelegationsByDelegatorResponseSDKType, SuperfluidUndelegationsByDelegatorRequest, SuperfluidUndelegationsByDelegatorRequestSDKType, SuperfluidUndelegationsByDelegatorResponse, SuperfluidUndelegationsByDelegatorResponseSDKType, SuperfluidDelegationsByValidatorDenomRequest, SuperfluidDelegationsByValidatorDenomRequestSDKType, SuperfluidDelegationsByValidatorDenomResponse, SuperfluidDelegationsByValidatorDenomResponseSDKType, EstimateSuperfluidDelegatedAmountByValidatorDenomRequest, EstimateSuperfluidDelegatedAmountByValidatorDenomRequestSDKType, EstimateSuperfluidDelegatedAmountByValidatorDenomResponse, EstimateSuperfluidDelegatedAmountByValidatorDenomResponseSDKType, QueryTotalDelegationByDelegatorRequest, QueryTotalDelegationByDelegatorRequestSDKType, QueryTotalDelegationByDelegatorResponse, QueryTotalDelegationByDelegatorResponseSDKType, QueryUnpoolWhitelistRequest, QueryUnpoolWhitelistRequestSDKType, QueryUnpoolWhitelistResponse, QueryUnpoolWhitelistResponseSDKType } from "./query"; +/** + * Params returns the total set of superfluid parameters. + * @name getParams + * @package osmosis.superfluid + * @see proto service: osmosis.superfluid.Params + */ +export const getParams = buildQuery({ + encode: QueryParamsRequest.encode, + decode: QueryParamsResponse.decode, + service: "osmosis.superfluid.Query", + method: "Params" +}); +/** + * Returns superfluid asset type, whether if it's a native asset or an lp + * share. + * @name getAssetType + * @package osmosis.superfluid + * @see proto service: osmosis.superfluid.AssetType + */ +export const getAssetType = buildQuery({ + encode: AssetTypeRequest.encode, + decode: AssetTypeResponse.decode, + service: "osmosis.superfluid.Query", + method: "AssetType" +}); +/** + * Returns all registered superfluid assets. + * @name getAllAssets + * @package osmosis.superfluid + * @see proto service: osmosis.superfluid.AllAssets + */ +export const getAllAssets = buildQuery({ + encode: AllAssetsRequest.encode, + decode: AllAssetsResponse.decode, + service: "osmosis.superfluid.Query", + method: "AllAssets" +}); +/** + * Returns the osmo equivalent multiplier used in the most recent epoch. + * @name getAssetMultiplier + * @package osmosis.superfluid + * @see proto service: osmosis.superfluid.AssetMultiplier + */ +export const getAssetMultiplier = buildQuery({ + encode: AssetMultiplierRequest.encode, + decode: AssetMultiplierResponse.decode, + service: "osmosis.superfluid.Query", + method: "AssetMultiplier" +}); +/** + * Returns all superfluid intermediary accounts. + * @name getAllIntermediaryAccounts + * @package osmosis.superfluid + * @see proto service: osmosis.superfluid.AllIntermediaryAccounts + */ +export const getAllIntermediaryAccounts = buildQuery({ + encode: AllIntermediaryAccountsRequest.encode, + decode: AllIntermediaryAccountsResponse.decode, + service: "osmosis.superfluid.Query", + method: "AllIntermediaryAccounts" +}); +/** + * Returns intermediary account connected to a superfluid staked lock by id + * @name getConnectedIntermediaryAccount + * @package osmosis.superfluid + * @see proto service: osmosis.superfluid.ConnectedIntermediaryAccount + */ +export const getConnectedIntermediaryAccount = buildQuery({ + encode: ConnectedIntermediaryAccountRequest.encode, + decode: ConnectedIntermediaryAccountResponse.decode, + service: "osmosis.superfluid.Query", + method: "ConnectedIntermediaryAccount" +}); +/** + * Returns the amount of delegations of specific denom for all validators + * @name getTotalDelegationByValidatorForDenom + * @package osmosis.superfluid + * @see proto service: osmosis.superfluid.TotalDelegationByValidatorForDenom + */ +export const getTotalDelegationByValidatorForDenom = buildQuery({ + encode: QueryTotalDelegationByValidatorForDenomRequest.encode, + decode: QueryTotalDelegationByValidatorForDenomResponse.decode, + service: "osmosis.superfluid.Query", + method: "TotalDelegationByValidatorForDenom" +}); +/** + * Returns the total amount of osmo superfluidly staked. + * Response is denominated in uosmo. + * @name getTotalSuperfluidDelegations + * @package osmosis.superfluid + * @see proto service: osmosis.superfluid.TotalSuperfluidDelegations + */ +export const getTotalSuperfluidDelegations = buildQuery({ + encode: TotalSuperfluidDelegationsRequest.encode, + decode: TotalSuperfluidDelegationsResponse.decode, + service: "osmosis.superfluid.Query", + method: "TotalSuperfluidDelegations" +}); +/** + * Returns the coins superfluid delegated for the delegator, validator, denom + * triplet + * @name getSuperfluidDelegationAmount + * @package osmosis.superfluid + * @see proto service: osmosis.superfluid.SuperfluidDelegationAmount + */ +export const getSuperfluidDelegationAmount = buildQuery({ + encode: SuperfluidDelegationAmountRequest.encode, + decode: SuperfluidDelegationAmountResponse.decode, + service: "osmosis.superfluid.Query", + method: "SuperfluidDelegationAmount" +}); +/** + * Returns all the delegated superfluid poistions for a specific delegator. + * @name getSuperfluidDelegationsByDelegator + * @package osmosis.superfluid + * @see proto service: osmosis.superfluid.SuperfluidDelegationsByDelegator + */ +export const getSuperfluidDelegationsByDelegator = buildQuery({ + encode: SuperfluidDelegationsByDelegatorRequest.encode, + decode: SuperfluidDelegationsByDelegatorResponse.decode, + service: "osmosis.superfluid.Query", + method: "SuperfluidDelegationsByDelegator" +}); +/** + * Returns all the undelegating superfluid poistions for a specific delegator. + * @name getSuperfluidUndelegationsByDelegator + * @package osmosis.superfluid + * @see proto service: osmosis.superfluid.SuperfluidUndelegationsByDelegator + */ +export const getSuperfluidUndelegationsByDelegator = buildQuery({ + encode: SuperfluidUndelegationsByDelegatorRequest.encode, + decode: SuperfluidUndelegationsByDelegatorResponse.decode, + service: "osmosis.superfluid.Query", + method: "SuperfluidUndelegationsByDelegator" +}); +/** + * Returns all the superfluid positions of a specific denom delegated to one + * validator + * @name getSuperfluidDelegationsByValidatorDenom + * @package osmosis.superfluid + * @see proto service: osmosis.superfluid.SuperfluidDelegationsByValidatorDenom + */ +export const getSuperfluidDelegationsByValidatorDenom = buildQuery({ + encode: SuperfluidDelegationsByValidatorDenomRequest.encode, + decode: SuperfluidDelegationsByValidatorDenomResponse.decode, + service: "osmosis.superfluid.Query", + method: "SuperfluidDelegationsByValidatorDenom" +}); +/** + * Returns the amount of a specific denom delegated to a specific validator + * This is labeled an estimate, because the way it calculates the amount can + * lead rounding errors from the true delegated amount + * @name getEstimateSuperfluidDelegatedAmountByValidatorDenom + * @package osmosis.superfluid + * @see proto service: osmosis.superfluid.EstimateSuperfluidDelegatedAmountByValidatorDenom + */ +export const getEstimateSuperfluidDelegatedAmountByValidatorDenom = buildQuery({ + encode: EstimateSuperfluidDelegatedAmountByValidatorDenomRequest.encode, + decode: EstimateSuperfluidDelegatedAmountByValidatorDenomResponse.decode, + service: "osmosis.superfluid.Query", + method: "EstimateSuperfluidDelegatedAmountByValidatorDenom" +}); +/** + * Returns the specified delegations for a specific delegator + * @name getTotalDelegationByDelegator + * @package osmosis.superfluid + * @see proto service: osmosis.superfluid.TotalDelegationByDelegator + */ +export const getTotalDelegationByDelegator = buildQuery({ + encode: QueryTotalDelegationByDelegatorRequest.encode, + decode: QueryTotalDelegationByDelegatorResponse.decode, + service: "osmosis.superfluid.Query", + method: "TotalDelegationByDelegator" +}); +/** + * Returns a list of whitelisted pool ids to unpool. + * @name getUnpoolWhitelist + * @package osmosis.superfluid + * @see proto service: osmosis.superfluid.UnpoolWhitelist + */ +export const getUnpoolWhitelist = buildQuery({ + encode: QueryUnpoolWhitelistRequest.encode, + decode: QueryUnpoolWhitelistResponse.decode, + service: "osmosis.superfluid.Query", + method: "UnpoolWhitelist" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputosmojs/osmosis/superfluid/superfluid.ts b/__fixtures__/v-next/outputosmojs/osmosis/superfluid/superfluid.ts index 4391646d58..f30f750524 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/superfluid/superfluid.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/superfluid/superfluid.ts @@ -2,7 +2,7 @@ import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../binary"; import { isSet, DeepPartial } from "../../helpers"; import { JsonSafe } from "../../json-safe"; -import { Decimal } from "@cosmjs/math"; +import { Decimal } from "@interchainjs/math"; export const protobufPackage = "osmosis.superfluid"; /** * SuperfluidAssetType indicates whether the superfluid asset is @@ -590,7 +590,7 @@ export const OsmoEquivalentMultiplierRecord = { const obj: any = {}; obj.epoch_number = message.epochNumber !== BigInt(0) ? message.epochNumber?.toString() : undefined; obj.denom = message.denom === "" ? undefined : message.denom; - obj.multiplier = message.multiplier === "" ? undefined : message.multiplier; + obj.multiplier = message.multiplier === "" ? undefined : Decimal.fromUserInput(message.multiplier, 18).atomics; return obj; }, fromAminoMsg(object: OsmoEquivalentMultiplierRecordAminoMsg): OsmoEquivalentMultiplierRecord { diff --git a/__fixtures__/v-next/outputosmojs/osmosis/superfluid/tx.registry.ts b/__fixtures__/v-next/outputosmojs/osmosis/superfluid/tx.registry.ts index deed96f927..c4015fa902 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/superfluid/tx.registry.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/superfluid/tx.registry.ts @@ -1,12 +1,7 @@ import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; -import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { TelescopeGeneratedType } from "../../types"; import { MsgSuperfluidDelegate, MsgSuperfluidDelegateSDKType, MsgSuperfluidUndelegate, MsgSuperfluidUndelegateSDKType, MsgSuperfluidUnbondLock, MsgSuperfluidUnbondLockSDKType, MsgLockAndSuperfluidDelegate, MsgLockAndSuperfluidDelegateSDKType, MsgUnPoolWhitelistedPool, MsgUnPoolWhitelistedPoolSDKType } from "./tx"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/osmosis.superfluid.MsgSuperfluidDelegate", MsgSuperfluidDelegate], ["/osmosis.superfluid.MsgSuperfluidUndelegate", MsgSuperfluidUndelegate], ["/osmosis.superfluid.MsgSuperfluidUnbondLock", MsgSuperfluidUnbondLock], ["/osmosis.superfluid.MsgLockAndSuperfluidDelegate", MsgLockAndSuperfluidDelegate], ["/osmosis.superfluid.MsgUnPoolWhitelistedPool", MsgUnPoolWhitelistedPool]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/osmosis.superfluid.MsgSuperfluidDelegate", MsgSuperfluidDelegate], ["/osmosis.superfluid.MsgSuperfluidUndelegate", MsgSuperfluidUndelegate], ["/osmosis.superfluid.MsgSuperfluidUnbondLock", MsgSuperfluidUnbondLock], ["/osmosis.superfluid.MsgLockAndSuperfluidDelegate", MsgLockAndSuperfluidDelegate], ["/osmosis.superfluid.MsgUnPoolWhitelistedPool", MsgUnPoolWhitelistedPool]]; export const MessageComposer = { encoded: { superfluidDelegate(value: MsgSuperfluidDelegate) { diff --git a/__fixtures__/v-next/outputosmojs/osmosis/superfluid/tx.rpc.func.ts b/__fixtures__/v-next/outputosmojs/osmosis/superfluid/tx.rpc.func.ts new file mode 100644 index 0000000000..85a48aab1b --- /dev/null +++ b/__fixtures__/v-next/outputosmojs/osmosis/superfluid/tx.rpc.func.ts @@ -0,0 +1,48 @@ +import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; +import { buildTx } from "../../helper-func-types"; +import { MsgSuperfluidDelegate, MsgSuperfluidDelegateSDKType, MsgSuperfluidDelegateResponse, MsgSuperfluidDelegateResponseSDKType, MsgSuperfluidUndelegate, MsgSuperfluidUndelegateSDKType, MsgSuperfluidUndelegateResponse, MsgSuperfluidUndelegateResponseSDKType, MsgSuperfluidUnbondLock, MsgSuperfluidUnbondLockSDKType, MsgSuperfluidUnbondLockResponse, MsgSuperfluidUnbondLockResponseSDKType, MsgLockAndSuperfluidDelegate, MsgLockAndSuperfluidDelegateSDKType, MsgLockAndSuperfluidDelegateResponse, MsgLockAndSuperfluidDelegateResponseSDKType, MsgUnPoolWhitelistedPool, MsgUnPoolWhitelistedPoolSDKType, MsgUnPoolWhitelistedPoolResponse, MsgUnPoolWhitelistedPoolResponseSDKType } from "./tx"; +/** + * Execute superfluid delegation for a lockup + * @name superfluidDelegate + * @package osmosis.superfluid + * @see proto service: osmosis.superfluid.SuperfluidDelegate + */ +export const superfluidDelegate = buildTx({ + msg: MsgSuperfluidDelegate +}); +/** + * Execute superfluid undelegation for a lockup + * @name superfluidUndelegate + * @package osmosis.superfluid + * @see proto service: osmosis.superfluid.SuperfluidUndelegate + */ +export const superfluidUndelegate = buildTx({ + msg: MsgSuperfluidUndelegate +}); +/** + * For a given lock that is being superfluidly undelegated, + * also unbond the underlying lock. + * @name superfluidUnbondLock + * @package osmosis.superfluid + * @see proto service: osmosis.superfluid.SuperfluidUnbondLock + */ +export const superfluidUnbondLock = buildTx({ + msg: MsgSuperfluidUnbondLock +}); +/** + * Execute lockup lock and superfluid delegation in a single msg + * @name lockAndSuperfluidDelegate + * @package osmosis.superfluid + * @see proto service: osmosis.superfluid.LockAndSuperfluidDelegate + */ +export const lockAndSuperfluidDelegate = buildTx({ + msg: MsgLockAndSuperfluidDelegate +}); +/** + * @name unPoolWhitelistedPool + * @package osmosis.superfluid + * @see proto service: osmosis.superfluid.UnPoolWhitelistedPool + */ +export const unPoolWhitelistedPool = buildTx({ + msg: MsgUnPoolWhitelistedPool +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputosmojs/osmosis/superfluid/tx.rpc.msg.ts b/__fixtures__/v-next/outputosmojs/osmosis/superfluid/tx.rpc.msg.ts index baea77de88..f4603db24f 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/superfluid/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/superfluid/tx.rpc.msg.ts @@ -1,5 +1,5 @@ import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; -import { Rpc } from "../../helpers"; +import { TxRpc } from "../../types"; import { BinaryReader } from "../../binary"; import { MsgSuperfluidDelegate, MsgSuperfluidDelegateSDKType, MsgSuperfluidDelegateResponse, MsgSuperfluidDelegateResponseSDKType, MsgSuperfluidUndelegate, MsgSuperfluidUndelegateSDKType, MsgSuperfluidUndelegateResponse, MsgSuperfluidUndelegateResponseSDKType, MsgSuperfluidUnbondLock, MsgSuperfluidUnbondLockSDKType, MsgSuperfluidUnbondLockResponse, MsgSuperfluidUnbondLockResponseSDKType, MsgLockAndSuperfluidDelegate, MsgLockAndSuperfluidDelegateSDKType, MsgLockAndSuperfluidDelegateResponse, MsgLockAndSuperfluidDelegateResponseSDKType, MsgUnPoolWhitelistedPool, MsgUnPoolWhitelistedPoolSDKType, MsgUnPoolWhitelistedPoolResponse, MsgUnPoolWhitelistedPoolResponseSDKType } from "./tx"; /** Msg defines the Msg service. */ @@ -18,8 +18,8 @@ export interface Msg { unPoolWhitelistedPool(request: MsgUnPoolWhitelistedPool): Promise; } export class MsgClientImpl implements Msg { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.superfluidDelegate = this.superfluidDelegate.bind(this); this.superfluidUndelegate = this.superfluidUndelegate.bind(this); @@ -53,6 +53,6 @@ export class MsgClientImpl implements Msg { return promise.then(data => MsgUnPoolWhitelistedPoolResponse.decode(new BinaryReader(data))); } } -export const createClientImpl = (rpc: Rpc) => { +export const createClientImpl = (rpc: TxRpc) => { return new MsgClientImpl(rpc); }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputosmojs/osmosis/tokenfactory/v1beta1/query.rpc.Query.ts b/__fixtures__/v-next/outputosmojs/osmosis/tokenfactory/v1beta1/query.rpc.Query.ts index f51c5d0696..d2eacbdce1 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/tokenfactory/v1beta1/query.rpc.Query.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/tokenfactory/v1beta1/query.rpc.Query.ts @@ -1,6 +1,6 @@ import { Params, ParamsSDKType } from "./params"; import { DenomAuthorityMetadata, DenomAuthorityMetadataSDKType } from "./authorityMetadata"; -import { Rpc } from "../../../helpers"; +import { TxRpc } from "../../../types"; import { BinaryReader } from "../../../binary"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; import { QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, QueryDenomAuthorityMetadataRequest, QueryDenomAuthorityMetadataRequestSDKType, QueryDenomAuthorityMetadataResponse, QueryDenomAuthorityMetadataResponseSDKType, QueryDenomsFromCreatorRequest, QueryDenomsFromCreatorRequestSDKType, QueryDenomsFromCreatorResponse, QueryDenomsFromCreatorResponseSDKType } from "./query"; @@ -23,8 +23,8 @@ export interface Query { denomsFromCreator(request: QueryDenomsFromCreatorRequest): Promise; } export class QueryClientImpl implements Query { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.params = this.params.bind(this); this.denomAuthorityMetadata = this.denomAuthorityMetadata.bind(this); diff --git a/__fixtures__/v-next/outputosmojs/osmosis/tokenfactory/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputosmojs/osmosis/tokenfactory/v1beta1/query.rpc.func.ts new file mode 100644 index 0000000000..d816826644 --- /dev/null +++ b/__fixtures__/v-next/outputosmojs/osmosis/tokenfactory/v1beta1/query.rpc.func.ts @@ -0,0 +1,43 @@ +import { Params, ParamsSDKType } from "./params"; +import { DenomAuthorityMetadata, DenomAuthorityMetadataSDKType } from "./authorityMetadata"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, QueryDenomAuthorityMetadataRequest, QueryDenomAuthorityMetadataRequestSDKType, QueryDenomAuthorityMetadataResponse, QueryDenomAuthorityMetadataResponseSDKType, QueryDenomsFromCreatorRequest, QueryDenomsFromCreatorRequestSDKType, QueryDenomsFromCreatorResponse, QueryDenomsFromCreatorResponseSDKType } from "./query"; +/** + * Params defines a gRPC query method that returns the tokenfactory module's + * parameters. + * @name getParams + * @package osmosis.tokenfactory.v1beta1 + * @see proto service: osmosis.tokenfactory.v1beta1.Params + */ +export const getParams = buildQuery({ + encode: QueryParamsRequest.encode, + decode: QueryParamsResponse.decode, + service: "osmosis.tokenfactory.v1beta1.Query", + method: "Params" +}); +/** + * DenomAuthorityMetadata defines a gRPC query method for fetching + * DenomAuthorityMetadata for a particular denom. + * @name getDenomAuthorityMetadata + * @package osmosis.tokenfactory.v1beta1 + * @see proto service: osmosis.tokenfactory.v1beta1.DenomAuthorityMetadata + */ +export const getDenomAuthorityMetadata = buildQuery({ + encode: QueryDenomAuthorityMetadataRequest.encode, + decode: QueryDenomAuthorityMetadataResponse.decode, + service: "osmosis.tokenfactory.v1beta1.Query", + method: "DenomAuthorityMetadata" +}); +/** + * DenomsFromCreator defines a gRPC query method for fetching all + * denominations created by a specific admin/creator. + * @name getDenomsFromCreator + * @package osmosis.tokenfactory.v1beta1 + * @see proto service: osmosis.tokenfactory.v1beta1.DenomsFromCreator + */ +export const getDenomsFromCreator = buildQuery({ + encode: QueryDenomsFromCreatorRequest.encode, + decode: QueryDenomsFromCreatorResponse.decode, + service: "osmosis.tokenfactory.v1beta1.Query", + method: "DenomsFromCreator" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputosmojs/osmosis/tokenfactory/v1beta1/tx.registry.ts b/__fixtures__/v-next/outputosmojs/osmosis/tokenfactory/v1beta1/tx.registry.ts index a351809f22..15491bcdc3 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/tokenfactory/v1beta1/tx.registry.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/tokenfactory/v1beta1/tx.registry.ts @@ -1,13 +1,8 @@ import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { Metadata, MetadataSDKType } from "../../../cosmos/bank/v1beta1/bank"; -import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { TelescopeGeneratedType } from "../../../types"; import { MsgCreateDenom, MsgCreateDenomSDKType, MsgMint, MsgMintSDKType, MsgBurn, MsgBurnSDKType, MsgChangeAdmin, MsgChangeAdminSDKType, MsgSetDenomMetadata, MsgSetDenomMetadataSDKType } from "./tx"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/osmosis.tokenfactory.v1beta1.MsgCreateDenom", MsgCreateDenom], ["/osmosis.tokenfactory.v1beta1.MsgMint", MsgMint], ["/osmosis.tokenfactory.v1beta1.MsgBurn", MsgBurn], ["/osmosis.tokenfactory.v1beta1.MsgChangeAdmin", MsgChangeAdmin], ["/osmosis.tokenfactory.v1beta1.MsgSetDenomMetadata", MsgSetDenomMetadata]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/osmosis.tokenfactory.v1beta1.MsgCreateDenom", MsgCreateDenom], ["/osmosis.tokenfactory.v1beta1.MsgMint", MsgMint], ["/osmosis.tokenfactory.v1beta1.MsgBurn", MsgBurn], ["/osmosis.tokenfactory.v1beta1.MsgChangeAdmin", MsgChangeAdmin], ["/osmosis.tokenfactory.v1beta1.MsgSetDenomMetadata", MsgSetDenomMetadata]]; export const MessageComposer = { encoded: { createDenom(value: MsgCreateDenom) { diff --git a/__fixtures__/v-next/outputosmojs/osmosis/tokenfactory/v1beta1/tx.rpc.func.ts b/__fixtures__/v-next/outputosmojs/osmosis/tokenfactory/v1beta1/tx.rpc.func.ts new file mode 100644 index 0000000000..4f68bf3691 --- /dev/null +++ b/__fixtures__/v-next/outputosmojs/osmosis/tokenfactory/v1beta1/tx.rpc.func.ts @@ -0,0 +1,44 @@ +import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; +import { Metadata, MetadataSDKType } from "../../../cosmos/bank/v1beta1/bank"; +import { buildTx } from "../../../helper-func-types"; +import { MsgCreateDenom, MsgCreateDenomSDKType, MsgCreateDenomResponse, MsgCreateDenomResponseSDKType, MsgMint, MsgMintSDKType, MsgMintResponse, MsgMintResponseSDKType, MsgBurn, MsgBurnSDKType, MsgBurnResponse, MsgBurnResponseSDKType, MsgChangeAdmin, MsgChangeAdminSDKType, MsgChangeAdminResponse, MsgChangeAdminResponseSDKType, MsgSetDenomMetadata, MsgSetDenomMetadataSDKType, MsgSetDenomMetadataResponse, MsgSetDenomMetadataResponseSDKType } from "./tx"; +/** + * @name createDenom + * @package osmosis.tokenfactory.v1beta1 + * @see proto service: osmosis.tokenfactory.v1beta1.CreateDenom + */ +export const createDenom = buildTx({ + msg: MsgCreateDenom +}); +/** + * @name mint + * @package osmosis.tokenfactory.v1beta1 + * @see proto service: osmosis.tokenfactory.v1beta1.Mint + */ +export const mint = buildTx({ + msg: MsgMint +}); +/** + * @name burn + * @package osmosis.tokenfactory.v1beta1 + * @see proto service: osmosis.tokenfactory.v1beta1.Burn + */ +export const burn = buildTx({ + msg: MsgBurn +}); +/** + * @name changeAdmin + * @package osmosis.tokenfactory.v1beta1 + * @see proto service: osmosis.tokenfactory.v1beta1.ChangeAdmin + */ +export const changeAdmin = buildTx({ + msg: MsgChangeAdmin +}); +/** + * @name setDenomMetadata + * @package osmosis.tokenfactory.v1beta1 + * @see proto service: osmosis.tokenfactory.v1beta1.SetDenomMetadata + */ +export const setDenomMetadata = buildTx({ + msg: MsgSetDenomMetadata +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputosmojs/osmosis/tokenfactory/v1beta1/tx.rpc.msg.ts b/__fixtures__/v-next/outputosmojs/osmosis/tokenfactory/v1beta1/tx.rpc.msg.ts index 509326d21e..54cd71228f 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/tokenfactory/v1beta1/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/tokenfactory/v1beta1/tx.rpc.msg.ts @@ -1,6 +1,6 @@ import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { Metadata, MetadataSDKType } from "../../../cosmos/bank/v1beta1/bank"; -import { Rpc } from "../../../helpers"; +import { TxRpc } from "../../../types"; import { BinaryReader } from "../../../binary"; import { MsgCreateDenom, MsgCreateDenomSDKType, MsgCreateDenomResponse, MsgCreateDenomResponseSDKType, MsgMint, MsgMintSDKType, MsgMintResponse, MsgMintResponseSDKType, MsgBurn, MsgBurnSDKType, MsgBurnResponse, MsgBurnResponseSDKType, MsgChangeAdmin, MsgChangeAdminSDKType, MsgChangeAdminResponse, MsgChangeAdminResponseSDKType, MsgSetDenomMetadata, MsgSetDenomMetadataSDKType, MsgSetDenomMetadataResponse, MsgSetDenomMetadataResponseSDKType } from "./tx"; /** Msg defines the tokefactory module's gRPC message service. */ @@ -12,8 +12,8 @@ export interface Msg { setDenomMetadata(request: MsgSetDenomMetadata): Promise; } export class MsgClientImpl implements Msg { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.createDenom = this.createDenom.bind(this); this.mint = this.mint.bind(this); @@ -47,6 +47,6 @@ export class MsgClientImpl implements Msg { return promise.then(data => MsgSetDenomMetadataResponse.decode(new BinaryReader(data))); } } -export const createClientImpl = (rpc: Rpc) => { +export const createClientImpl = (rpc: TxRpc) => { return new MsgClientImpl(rpc); }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputosmojs/osmosis/twap/v1beta1/query.rpc.Query.ts b/__fixtures__/v-next/outputosmojs/osmosis/twap/v1beta1/query.rpc.Query.ts index ae9fb21fdc..8149f35aea 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/twap/v1beta1/query.rpc.Query.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/twap/v1beta1/query.rpc.Query.ts @@ -1,6 +1,6 @@ import { Timestamp, TimestampSDKType } from "../../../google/protobuf/timestamp"; import { Params, ParamsSDKType } from "./genesis"; -import { Rpc } from "../../../helpers"; +import { TxRpc } from "../../../types"; import { BinaryReader } from "../../../binary"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; import { ParamsRequest, ParamsRequestSDKType, ParamsResponse, ParamsResponseSDKType, ArithmeticTwapRequest, ArithmeticTwapRequestSDKType, ArithmeticTwapResponse, ArithmeticTwapResponseSDKType, ArithmeticTwapToNowRequest, ArithmeticTwapToNowRequestSDKType, ArithmeticTwapToNowResponse, ArithmeticTwapToNowResponseSDKType } from "./query"; @@ -10,8 +10,8 @@ export interface Query { arithmeticTwapToNow(request: ArithmeticTwapToNowRequest): Promise; } export class QueryClientImpl implements Query { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.params = this.params.bind(this); this.arithmeticTwap = this.arithmeticTwap.bind(this); diff --git a/__fixtures__/v-next/outputosmojs/osmosis/twap/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputosmojs/osmosis/twap/v1beta1/query.rpc.func.ts new file mode 100644 index 0000000000..e076baed66 --- /dev/null +++ b/__fixtures__/v-next/outputosmojs/osmosis/twap/v1beta1/query.rpc.func.ts @@ -0,0 +1,38 @@ +import { Timestamp, TimestampSDKType } from "../../../google/protobuf/timestamp"; +import { Params, ParamsSDKType } from "./genesis"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { ParamsRequest, ParamsRequestSDKType, ParamsResponse, ParamsResponseSDKType, ArithmeticTwapRequest, ArithmeticTwapRequestSDKType, ArithmeticTwapResponse, ArithmeticTwapResponseSDKType, ArithmeticTwapToNowRequest, ArithmeticTwapToNowRequestSDKType, ArithmeticTwapToNowResponse, ArithmeticTwapToNowResponseSDKType } from "./query"; +/** + * @name getParams + * @package osmosis.twap.v1beta1 + * @see proto service: osmosis.twap.v1beta1.Params + */ +export const getParams = buildQuery({ + encode: ParamsRequest.encode, + decode: ParamsResponse.decode, + service: "osmosis.twap.v1beta1.Query", + method: "Params" +}); +/** + * @name getArithmeticTwap + * @package osmosis.twap.v1beta1 + * @see proto service: osmosis.twap.v1beta1.ArithmeticTwap + */ +export const getArithmeticTwap = buildQuery({ + encode: ArithmeticTwapRequest.encode, + decode: ArithmeticTwapResponse.decode, + service: "osmosis.twap.v1beta1.Query", + method: "ArithmeticTwap" +}); +/** + * @name getArithmeticTwapToNow + * @package osmosis.twap.v1beta1 + * @see proto service: osmosis.twap.v1beta1.ArithmeticTwapToNow + * @deprecated + */ +export const getArithmeticTwapToNow = buildQuery({ + encode: ArithmeticTwapToNowRequest.encode, + decode: ArithmeticTwapToNowResponse.decode, + service: "osmosis.twap.v1beta1.Query", + method: "ArithmeticTwapToNow" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputosmojs/osmosis/twap/v1beta1/query.ts b/__fixtures__/v-next/outputosmojs/osmosis/twap/v1beta1/query.ts index e80bc67a19..7ddb1fe00d 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/twap/v1beta1/query.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/twap/v1beta1/query.ts @@ -3,7 +3,7 @@ import { Params, ParamsSDKType } from "./genesis"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { toTimestamp, fromTimestamp, isSet, DeepPartial } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; -import { Decimal } from "@cosmjs/math"; +import { Decimal } from "@interchainjs/math"; export const protobufPackage = "osmosis.twap.v1beta1"; /** * @name ArithmeticTwapRequest @@ -376,7 +376,7 @@ export const ArithmeticTwapResponse = { }, toAmino(message: ArithmeticTwapResponse): ArithmeticTwapResponseAmino { const obj: any = {}; - obj.arithmetic_twap = message.arithmeticTwap === "" ? undefined : message.arithmeticTwap; + obj.arithmetic_twap = message.arithmeticTwap === "" ? undefined : Decimal.fromUserInput(message.arithmeticTwap, 18).atomics; return obj; }, fromAminoMsg(object: ArithmeticTwapResponseAminoMsg): ArithmeticTwapResponse { @@ -625,7 +625,7 @@ export const ArithmeticTwapToNowResponse = { }, toAmino(message: ArithmeticTwapToNowResponse): ArithmeticTwapToNowResponseAmino { const obj: any = {}; - obj.arithmetic_twap = message.arithmeticTwap === "" ? undefined : message.arithmeticTwap; + obj.arithmetic_twap = message.arithmeticTwap === "" ? undefined : Decimal.fromUserInput(message.arithmeticTwap, 18).atomics; return obj; }, fromAminoMsg(object: ArithmeticTwapToNowResponseAminoMsg): ArithmeticTwapToNowResponse { diff --git a/__fixtures__/v-next/outputosmojs/osmosis/twap/v1beta1/twap_record.ts b/__fixtures__/v-next/outputosmojs/osmosis/twap/v1beta1/twap_record.ts index 6acf952821..a5c162275d 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/twap/v1beta1/twap_record.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/twap/v1beta1/twap_record.ts @@ -1,7 +1,7 @@ import { Timestamp, TimestampSDKType } from "../../../google/protobuf/timestamp"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { toTimestamp, fromTimestamp, isSet, DeepPartial } from "../../../helpers"; -import { Decimal } from "@cosmjs/math"; +import { Decimal } from "@interchainjs/math"; import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "osmosis.twap.v1beta1"; /** @@ -308,10 +308,10 @@ export const TwapRecord = { obj.asset1_denom = message.asset1Denom === "" ? undefined : message.asset1Denom; obj.height = message.height ? message.height?.toString() : "0"; obj.time = message.time ? Timestamp.toAmino(toTimestamp(message.time)) : undefined; - obj.p0_last_spot_price = message.p0LastSpotPrice === "" ? undefined : message.p0LastSpotPrice; - obj.p1_last_spot_price = message.p1LastSpotPrice === "" ? undefined : message.p1LastSpotPrice; - obj.p0_arithmetic_twap_accumulator = message.p0ArithmeticTwapAccumulator === "" ? undefined : message.p0ArithmeticTwapAccumulator; - obj.p1_arithmetic_twap_accumulator = message.p1ArithmeticTwapAccumulator === "" ? undefined : message.p1ArithmeticTwapAccumulator; + obj.p0_last_spot_price = message.p0LastSpotPrice === "" ? undefined : Decimal.fromUserInput(message.p0LastSpotPrice, 18).atomics; + obj.p1_last_spot_price = message.p1LastSpotPrice === "" ? undefined : Decimal.fromUserInput(message.p1LastSpotPrice, 18).atomics; + obj.p0_arithmetic_twap_accumulator = message.p0ArithmeticTwapAccumulator === "" ? undefined : Decimal.fromUserInput(message.p0ArithmeticTwapAccumulator, 18).atomics; + obj.p1_arithmetic_twap_accumulator = message.p1ArithmeticTwapAccumulator === "" ? undefined : Decimal.fromUserInput(message.p1ArithmeticTwapAccumulator, 18).atomics; obj.last_error_time = message.lastErrorTime ? Timestamp.toAmino(toTimestamp(message.lastErrorTime)) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/osmosis/txfees/v1beta1/query.rpc.Query.ts b/__fixtures__/v-next/outputosmojs/osmosis/txfees/v1beta1/query.rpc.Query.ts index f7fad4767e..54cedd4fc6 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/txfees/v1beta1/query.rpc.Query.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/txfees/v1beta1/query.rpc.Query.ts @@ -1,5 +1,5 @@ import { FeeToken, FeeTokenSDKType } from "./feetoken"; -import { Rpc } from "../../../helpers"; +import { TxRpc } from "../../../types"; import { BinaryReader } from "../../../binary"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; import { QueryFeeTokensRequest, QueryFeeTokensRequestSDKType, QueryFeeTokensResponse, QueryFeeTokensResponseSDKType, QueryDenomSpotPriceRequest, QueryDenomSpotPriceRequestSDKType, QueryDenomSpotPriceResponse, QueryDenomSpotPriceResponseSDKType, QueryDenomPoolIdRequest, QueryDenomPoolIdRequestSDKType, QueryDenomPoolIdResponse, QueryDenomPoolIdResponseSDKType, QueryBaseDenomRequest, QueryBaseDenomRequestSDKType, QueryBaseDenomResponse, QueryBaseDenomResponseSDKType } from "./query"; @@ -18,8 +18,8 @@ export interface Query { baseDenom(request?: QueryBaseDenomRequest): Promise; } export class QueryClientImpl implements Query { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.feeTokens = this.feeTokens.bind(this); this.denomSpotPrice = this.denomSpotPrice.bind(this); diff --git a/__fixtures__/v-next/outputosmojs/osmosis/txfees/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputosmojs/osmosis/txfees/v1beta1/query.rpc.func.ts new file mode 100644 index 0000000000..a461827fa5 --- /dev/null +++ b/__fixtures__/v-next/outputosmojs/osmosis/txfees/v1beta1/query.rpc.func.ts @@ -0,0 +1,53 @@ +import { FeeToken, FeeTokenSDKType } from "./feetoken"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { QueryFeeTokensRequest, QueryFeeTokensRequestSDKType, QueryFeeTokensResponse, QueryFeeTokensResponseSDKType, QueryDenomSpotPriceRequest, QueryDenomSpotPriceRequestSDKType, QueryDenomSpotPriceResponse, QueryDenomSpotPriceResponseSDKType, QueryDenomPoolIdRequest, QueryDenomPoolIdRequestSDKType, QueryDenomPoolIdResponse, QueryDenomPoolIdResponseSDKType, QueryBaseDenomRequest, QueryBaseDenomRequestSDKType, QueryBaseDenomResponse, QueryBaseDenomResponseSDKType } from "./query"; +/** + * FeeTokens returns a list of all the whitelisted fee tokens and their + * corresponding pools. It does not include the BaseDenom, which has its own + * query endpoint + * @name getFeeTokens + * @package osmosis.txfees.v1beta1 + * @see proto service: osmosis.txfees.v1beta1.FeeTokens + */ +export const getFeeTokens = buildQuery({ + encode: QueryFeeTokensRequest.encode, + decode: QueryFeeTokensResponse.decode, + service: "osmosis.txfees.v1beta1.Query", + method: "FeeTokens" +}); +/** + * DenomSpotPrice returns all spot prices by each registered token denom. + * @name getDenomSpotPrice + * @package osmosis.txfees.v1beta1 + * @see proto service: osmosis.txfees.v1beta1.DenomSpotPrice + */ +export const getDenomSpotPrice = buildQuery({ + encode: QueryDenomSpotPriceRequest.encode, + decode: QueryDenomSpotPriceResponse.decode, + service: "osmosis.txfees.v1beta1.Query", + method: "DenomSpotPrice" +}); +/** + * Returns the poolID for a specified denom input. + * @name getDenomPoolId + * @package osmosis.txfees.v1beta1 + * @see proto service: osmosis.txfees.v1beta1.DenomPoolId + */ +export const getDenomPoolId = buildQuery({ + encode: QueryDenomPoolIdRequest.encode, + decode: QueryDenomPoolIdResponse.decode, + service: "osmosis.txfees.v1beta1.Query", + method: "DenomPoolId" +}); +/** + * Returns a list of all base denom tokens and their corresponding pools. + * @name getBaseDenom + * @package osmosis.txfees.v1beta1 + * @see proto service: osmosis.txfees.v1beta1.BaseDenom + */ +export const getBaseDenom = buildQuery({ + encode: QueryBaseDenomRequest.encode, + decode: QueryBaseDenomResponse.decode, + service: "osmosis.txfees.v1beta1.Query", + method: "BaseDenom" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputosmojs/osmosis/txfees/v1beta1/query.ts b/__fixtures__/v-next/outputosmojs/osmosis/txfees/v1beta1/query.ts index 3350dbc3d9..a8b77431b4 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/txfees/v1beta1/query.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/txfees/v1beta1/query.ts @@ -2,7 +2,7 @@ import { FeeToken, FeeTokenSDKType } from "./feetoken"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { JsonSafe } from "../../../json-safe"; import { DeepPartial, isSet } from "../../../helpers"; -import { Decimal } from "@cosmjs/math"; +import { Decimal } from "@interchainjs/math"; export const protobufPackage = "osmosis.txfees.v1beta1"; /** * @name QueryFeeTokensRequest @@ -547,7 +547,7 @@ export const QueryDenomSpotPriceResponse = { toAmino(message: QueryDenomSpotPriceResponse): QueryDenomSpotPriceResponseAmino { const obj: any = {}; obj.poolID = message.poolID !== BigInt(0) ? message.poolID?.toString() : undefined; - obj.spot_price = message.spotPrice === "" ? undefined : message.spotPrice; + obj.spot_price = message.spotPrice === "" ? undefined : Decimal.fromUserInput(message.spotPrice, 18).atomics; return obj; }, fromAminoMsg(object: QueryDenomSpotPriceResponseAminoMsg): QueryDenomSpotPriceResponse { diff --git a/__fixtures__/v-next/outputosmojs/osmosis/valset-pref/v1beta1/query.rpc.Query.ts b/__fixtures__/v-next/outputosmojs/osmosis/valset-pref/v1beta1/query.rpc.Query.ts index 0619776f2d..3741140bc8 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/valset-pref/v1beta1/query.rpc.Query.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/valset-pref/v1beta1/query.rpc.Query.ts @@ -1,5 +1,5 @@ import { ValidatorPreference, ValidatorPreferenceSDKType } from "./state"; -import { Rpc } from "../../../helpers"; +import { TxRpc } from "../../../types"; import { BinaryReader } from "../../../binary"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; import { UserValidatorPreferencesRequest, UserValidatorPreferencesRequestSDKType, UserValidatorPreferencesResponse, UserValidatorPreferencesResponseSDKType } from "./query"; @@ -9,8 +9,8 @@ export interface Query { userValidatorPreferences(request: UserValidatorPreferencesRequest): Promise; } export class QueryClientImpl implements Query { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.userValidatorPreferences = this.userValidatorPreferences.bind(this); } diff --git a/__fixtures__/v-next/outputosmojs/osmosis/valset-pref/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputosmojs/osmosis/valset-pref/v1beta1/query.rpc.func.ts new file mode 100644 index 0000000000..21b74ec537 --- /dev/null +++ b/__fixtures__/v-next/outputosmojs/osmosis/valset-pref/v1beta1/query.rpc.func.ts @@ -0,0 +1,15 @@ +import { ValidatorPreference, ValidatorPreferenceSDKType } from "./state"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { UserValidatorPreferencesRequest, UserValidatorPreferencesRequestSDKType, UserValidatorPreferencesResponse, UserValidatorPreferencesResponseSDKType } from "./query"; +/** + * Returns the list of ValidatorPreferences for the user. + * @name getUserValidatorPreferences + * @package osmosis.valsetpref.v1beta1 + * @see proto service: osmosis.valsetpref.v1beta1.UserValidatorPreferences + */ +export const getUserValidatorPreferences = buildQuery({ + encode: UserValidatorPreferencesRequest.encode, + decode: UserValidatorPreferencesResponse.decode, + service: "osmosis.valsetpref.v1beta1.Query", + method: "UserValidatorPreferences" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputosmojs/osmosis/valset-pref/v1beta1/state.ts b/__fixtures__/v-next/outputosmojs/osmosis/valset-pref/v1beta1/state.ts index 7d22369e62..a9e1041d4e 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/valset-pref/v1beta1/state.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/valset-pref/v1beta1/state.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { Decimal } from "@cosmjs/math"; +import { Decimal } from "@interchainjs/math"; import { isSet, DeepPartial } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "osmosis.valsetpref.v1beta1"; @@ -169,7 +169,7 @@ export const ValidatorPreference = { toAmino(message: ValidatorPreference): ValidatorPreferenceAmino { const obj: any = {}; obj.val_oper_address = message.valOperAddress === "" ? undefined : message.valOperAddress; - obj.weight = message.weight === "" ? undefined : message.weight; + obj.weight = message.weight === "" ? undefined : Decimal.fromUserInput(message.weight, 18).atomics; return obj; }, fromAminoMsg(object: ValidatorPreferenceAminoMsg): ValidatorPreference { diff --git a/__fixtures__/v-next/outputosmojs/osmosis/valset-pref/v1beta1/tx.amino.ts b/__fixtures__/v-next/outputosmojs/osmosis/valset-pref/v1beta1/tx.amino.ts index 4cb0b8802d..856e31a4c5 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/valset-pref/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/valset-pref/v1beta1/tx.amino.ts @@ -2,6 +2,7 @@ import { ValidatorPreference, ValidatorPreferenceSDKType } from "./state"; import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { AminoMsg } from "@cosmjs/amino"; +import { Decimal } from "@interchainjs/math"; import { MsgSetValidatorSetPreference, MsgSetValidatorSetPreferenceSDKType, MsgDelegateToValidatorSet, MsgDelegateToValidatorSetSDKType, MsgUndelegateFromValidatorSet, MsgUndelegateFromValidatorSetSDKType, MsgRedelegateValidatorSet, MsgRedelegateValidatorSetSDKType, MsgWithdrawDelegationRewards, MsgWithdrawDelegationRewardsSDKType, MsgDelegateBondedTokens, MsgDelegateBondedTokensSDKType } from "./tx"; export interface MsgSetValidatorSetPreferenceAminoType extends AminoMsg { type: "osmosis/valset-pref/MsgSetValidatorSetPreference"; @@ -67,7 +68,7 @@ export const AminoConverter = { delegator, preferences: preferences.map(el0 => ({ val_oper_address: el0.valOperAddress, - weight: el0.weight + weight: Decimal.fromUserInput(el0.weight, 18).atomics })) }; }, @@ -148,7 +149,7 @@ export const AminoConverter = { delegator, preferences: preferences.map(el0 => ({ val_oper_address: el0.valOperAddress, - weight: el0.weight + weight: Decimal.fromUserInput(el0.weight, 18).atomics })) }; }, diff --git a/__fixtures__/v-next/outputosmojs/osmosis/valset-pref/v1beta1/tx.registry.ts b/__fixtures__/v-next/outputosmojs/osmosis/valset-pref/v1beta1/tx.registry.ts index 80c7737941..d56914aa31 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/valset-pref/v1beta1/tx.registry.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/valset-pref/v1beta1/tx.registry.ts @@ -1,13 +1,8 @@ import { ValidatorPreference, ValidatorPreferenceSDKType } from "./state"; import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; -import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { TelescopeGeneratedType } from "../../../types"; import { MsgSetValidatorSetPreference, MsgSetValidatorSetPreferenceSDKType, MsgDelegateToValidatorSet, MsgDelegateToValidatorSetSDKType, MsgUndelegateFromValidatorSet, MsgUndelegateFromValidatorSetSDKType, MsgRedelegateValidatorSet, MsgRedelegateValidatorSetSDKType, MsgWithdrawDelegationRewards, MsgWithdrawDelegationRewardsSDKType, MsgDelegateBondedTokens, MsgDelegateBondedTokensSDKType } from "./tx"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/osmosis.valsetpref.v1beta1.MsgSetValidatorSetPreference", MsgSetValidatorSetPreference], ["/osmosis.valsetpref.v1beta1.MsgDelegateToValidatorSet", MsgDelegateToValidatorSet], ["/osmosis.valsetpref.v1beta1.MsgUndelegateFromValidatorSet", MsgUndelegateFromValidatorSet], ["/osmosis.valsetpref.v1beta1.MsgRedelegateValidatorSet", MsgRedelegateValidatorSet], ["/osmosis.valsetpref.v1beta1.MsgWithdrawDelegationRewards", MsgWithdrawDelegationRewards], ["/osmosis.valsetpref.v1beta1.MsgDelegateBondedTokens", MsgDelegateBondedTokens]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/osmosis.valsetpref.v1beta1.MsgSetValidatorSetPreference", MsgSetValidatorSetPreference], ["/osmosis.valsetpref.v1beta1.MsgDelegateToValidatorSet", MsgDelegateToValidatorSet], ["/osmosis.valsetpref.v1beta1.MsgUndelegateFromValidatorSet", MsgUndelegateFromValidatorSet], ["/osmosis.valsetpref.v1beta1.MsgRedelegateValidatorSet", MsgRedelegateValidatorSet], ["/osmosis.valsetpref.v1beta1.MsgWithdrawDelegationRewards", MsgWithdrawDelegationRewards], ["/osmosis.valsetpref.v1beta1.MsgDelegateBondedTokens", MsgDelegateBondedTokens]]; export const MessageComposer = { encoded: { setValidatorSetPreference(value: MsgSetValidatorSetPreference) { diff --git a/__fixtures__/v-next/outputosmojs/osmosis/valset-pref/v1beta1/tx.rpc.func.ts b/__fixtures__/v-next/outputosmojs/osmosis/valset-pref/v1beta1/tx.rpc.func.ts new file mode 100644 index 0000000000..da65638446 --- /dev/null +++ b/__fixtures__/v-next/outputosmojs/osmosis/valset-pref/v1beta1/tx.rpc.func.ts @@ -0,0 +1,65 @@ +import { ValidatorPreference, ValidatorPreferenceSDKType } from "./state"; +import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; +import { buildTx } from "../../../helper-func-types"; +import { MsgSetValidatorSetPreference, MsgSetValidatorSetPreferenceSDKType, MsgSetValidatorSetPreferenceResponse, MsgSetValidatorSetPreferenceResponseSDKType, MsgDelegateToValidatorSet, MsgDelegateToValidatorSetSDKType, MsgDelegateToValidatorSetResponse, MsgDelegateToValidatorSetResponseSDKType, MsgUndelegateFromValidatorSet, MsgUndelegateFromValidatorSetSDKType, MsgUndelegateFromValidatorSetResponse, MsgUndelegateFromValidatorSetResponseSDKType, MsgRedelegateValidatorSet, MsgRedelegateValidatorSetSDKType, MsgRedelegateValidatorSetResponse, MsgRedelegateValidatorSetResponseSDKType, MsgWithdrawDelegationRewards, MsgWithdrawDelegationRewardsSDKType, MsgWithdrawDelegationRewardsResponse, MsgWithdrawDelegationRewardsResponseSDKType, MsgDelegateBondedTokens, MsgDelegateBondedTokensSDKType, MsgDelegateBondedTokensResponse, MsgDelegateBondedTokensResponseSDKType } from "./tx"; +/** + * SetValidatorSetPreference creates a set of validator preference. + * This message will process both create + update request. + * @name setValidatorSetPreference + * @package osmosis.valsetpref.v1beta1 + * @see proto service: osmosis.valsetpref.v1beta1.SetValidatorSetPreference + */ +export const setValidatorSetPreference = buildTx({ + msg: MsgSetValidatorSetPreference +}); +/** + * DelegateToValidatorSet gets the owner, coins and delegates to a + * validator-set. + * @name delegateToValidatorSet + * @package osmosis.valsetpref.v1beta1 + * @see proto service: osmosis.valsetpref.v1beta1.DelegateToValidatorSet + */ +export const delegateToValidatorSet = buildTx({ + msg: MsgDelegateToValidatorSet +}); +/** + * UndelegateFromValidatorSet gets the owner and coins and undelegates from + * validator-set. The unbonding logic will follow the `Undelegate` logic from + * the sdk. + * @name undelegateFromValidatorSet + * @package osmosis.valsetpref.v1beta1 + * @see proto service: osmosis.valsetpref.v1beta1.UndelegateFromValidatorSet + */ +export const undelegateFromValidatorSet = buildTx({ + msg: MsgUndelegateFromValidatorSet +}); +/** + * RedelegateValidatorSet takes the existing validator set and redelegates to + * a new set. + * @name redelegateValidatorSet + * @package osmosis.valsetpref.v1beta1 + * @see proto service: osmosis.valsetpref.v1beta1.RedelegateValidatorSet + */ +export const redelegateValidatorSet = buildTx({ + msg: MsgRedelegateValidatorSet +}); +/** + * WithdrawDelegationRewards allows users to claim rewards from the + * validator-set. + * @name withdrawDelegationRewards + * @package osmosis.valsetpref.v1beta1 + * @see proto service: osmosis.valsetpref.v1beta1.WithdrawDelegationRewards + */ +export const withdrawDelegationRewards = buildTx({ + msg: MsgWithdrawDelegationRewards +}); +/** + * DelegateBondedTokens allows users to break the lockup bond and delegate + * osmo tokens to a predefined validator-set. + * @name delegateBondedTokens + * @package osmosis.valsetpref.v1beta1 + * @see proto service: osmosis.valsetpref.v1beta1.DelegateBondedTokens + */ +export const delegateBondedTokens = buildTx({ + msg: MsgDelegateBondedTokens +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputosmojs/osmosis/valset-pref/v1beta1/tx.rpc.msg.ts b/__fixtures__/v-next/outputosmojs/osmosis/valset-pref/v1beta1/tx.rpc.msg.ts index 468c2d737c..46340cfec2 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/valset-pref/v1beta1/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/valset-pref/v1beta1/tx.rpc.msg.ts @@ -1,6 +1,6 @@ import { ValidatorPreference, ValidatorPreferenceSDKType } from "./state"; import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; -import { Rpc } from "../../../helpers"; +import { TxRpc } from "../../../types"; import { BinaryReader } from "../../../binary"; import { MsgSetValidatorSetPreference, MsgSetValidatorSetPreferenceSDKType, MsgSetValidatorSetPreferenceResponse, MsgSetValidatorSetPreferenceResponseSDKType, MsgDelegateToValidatorSet, MsgDelegateToValidatorSetSDKType, MsgDelegateToValidatorSetResponse, MsgDelegateToValidatorSetResponseSDKType, MsgUndelegateFromValidatorSet, MsgUndelegateFromValidatorSetSDKType, MsgUndelegateFromValidatorSetResponse, MsgUndelegateFromValidatorSetResponseSDKType, MsgRedelegateValidatorSet, MsgRedelegateValidatorSetSDKType, MsgRedelegateValidatorSetResponse, MsgRedelegateValidatorSetResponseSDKType, MsgWithdrawDelegationRewards, MsgWithdrawDelegationRewardsSDKType, MsgWithdrawDelegationRewardsResponse, MsgWithdrawDelegationRewardsResponseSDKType, MsgDelegateBondedTokens, MsgDelegateBondedTokensSDKType, MsgDelegateBondedTokensResponse, MsgDelegateBondedTokensResponseSDKType } from "./tx"; /** Msg defines the valset-pref modules's gRPC message service. */ @@ -38,8 +38,8 @@ export interface Msg { delegateBondedTokens(request: MsgDelegateBondedTokens): Promise; } export class MsgClientImpl implements Msg { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.setValidatorSetPreference = this.setValidatorSetPreference.bind(this); this.delegateToValidatorSet = this.delegateToValidatorSet.bind(this); @@ -79,6 +79,6 @@ export class MsgClientImpl implements Msg { return promise.then(data => MsgDelegateBondedTokensResponse.decode(new BinaryReader(data))); } } -export const createClientImpl = (rpc: Rpc) => { +export const createClientImpl = (rpc: TxRpc) => { return new MsgClientImpl(rpc); }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputosmojs/tendermint/abci/types.rpc.ABCIApplication.ts b/__fixtures__/v-next/outputosmojs/tendermint/abci/types.rpc.ABCIApplication.ts index 623b0f2fcb..ee947e4b60 100644 --- a/__fixtures__/v-next/outputosmojs/tendermint/abci/types.rpc.ABCIApplication.ts +++ b/__fixtures__/v-next/outputosmojs/tendermint/abci/types.rpc.ABCIApplication.ts @@ -3,7 +3,7 @@ import { Header, HeaderSDKType } from "../types/types"; import { ProofOps, ProofOpsSDKType } from "../crypto/proof"; import { EvidenceParams, EvidenceParamsSDKType, ValidatorParams, ValidatorParamsSDKType, VersionParams, VersionParamsSDKType } from "../types/params"; import { PublicKey, PublicKeySDKType } from "../crypto/keys"; -import { Rpc } from "../../helpers"; +import { TxRpc } from "../../types"; import { BinaryReader } from "../../binary"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; import { RequestEcho, RequestEchoSDKType, ResponseEcho, ResponseEchoSDKType, RequestFlush, RequestFlushSDKType, ResponseFlush, ResponseFlushSDKType, RequestInfo, RequestInfoSDKType, ResponseInfo, ResponseInfoSDKType, RequestSetOption, RequestSetOptionSDKType, ResponseSetOption, ResponseSetOptionSDKType, RequestDeliverTx, RequestDeliverTxSDKType, ResponseDeliverTx, ResponseDeliverTxSDKType, RequestCheckTx, RequestCheckTxSDKType, ResponseCheckTx, ResponseCheckTxSDKType, RequestQuery, RequestQuerySDKType, ResponseQuery, ResponseQuerySDKType, RequestCommit, RequestCommitSDKType, ResponseCommit, ResponseCommitSDKType, RequestInitChain, RequestInitChainSDKType, ResponseInitChain, ResponseInitChainSDKType, RequestBeginBlock, RequestBeginBlockSDKType, ResponseBeginBlock, ResponseBeginBlockSDKType, RequestEndBlock, RequestEndBlockSDKType, ResponseEndBlock, ResponseEndBlockSDKType, RequestListSnapshots, RequestListSnapshotsSDKType, ResponseListSnapshots, ResponseListSnapshotsSDKType, RequestOfferSnapshot, RequestOfferSnapshotSDKType, ResponseOfferSnapshot, ResponseOfferSnapshotSDKType, RequestLoadSnapshotChunk, RequestLoadSnapshotChunkSDKType, ResponseLoadSnapshotChunk, ResponseLoadSnapshotChunkSDKType, RequestApplySnapshotChunk, RequestApplySnapshotChunkSDKType, ResponseApplySnapshotChunk, ResponseApplySnapshotChunkSDKType } from "./types"; @@ -25,8 +25,8 @@ export interface ABCIApplication { applySnapshotChunk(request: RequestApplySnapshotChunk): Promise; } export class ABCIApplicationClientImpl implements ABCIApplication { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.echo = this.echo.bind(this); this.flush = this.flush.bind(this); diff --git a/__fixtures__/v-next/outputosmojs/tendermint/abci/types.rpc.func.ts b/__fixtures__/v-next/outputosmojs/tendermint/abci/types.rpc.func.ts new file mode 100644 index 0000000000..dee086cb02 --- /dev/null +++ b/__fixtures__/v-next/outputosmojs/tendermint/abci/types.rpc.func.ts @@ -0,0 +1,172 @@ +import { Timestamp, TimestampSDKType } from "../../google/protobuf/timestamp"; +import { Header, HeaderSDKType } from "../types/types"; +import { ProofOps, ProofOpsSDKType } from "../crypto/proof"; +import { EvidenceParams, EvidenceParamsSDKType, ValidatorParams, ValidatorParamsSDKType, VersionParams, VersionParamsSDKType } from "../types/params"; +import { PublicKey, PublicKeySDKType } from "../crypto/keys"; +import { EndpointOrRpc, buildQuery } from "../../helper-func-types"; +import { RequestEcho, RequestEchoSDKType, ResponseEcho, ResponseEchoSDKType, RequestFlush, RequestFlushSDKType, ResponseFlush, ResponseFlushSDKType, RequestInfo, RequestInfoSDKType, ResponseInfo, ResponseInfoSDKType, RequestSetOption, RequestSetOptionSDKType, ResponseSetOption, ResponseSetOptionSDKType, RequestDeliverTx, RequestDeliverTxSDKType, ResponseDeliverTx, ResponseDeliverTxSDKType, RequestCheckTx, RequestCheckTxSDKType, ResponseCheckTx, ResponseCheckTxSDKType, RequestQuery, RequestQuerySDKType, ResponseQuery, ResponseQuerySDKType, RequestCommit, RequestCommitSDKType, ResponseCommit, ResponseCommitSDKType, RequestInitChain, RequestInitChainSDKType, ResponseInitChain, ResponseInitChainSDKType, RequestBeginBlock, RequestBeginBlockSDKType, ResponseBeginBlock, ResponseBeginBlockSDKType, RequestEndBlock, RequestEndBlockSDKType, ResponseEndBlock, ResponseEndBlockSDKType, RequestListSnapshots, RequestListSnapshotsSDKType, ResponseListSnapshots, ResponseListSnapshotsSDKType, RequestOfferSnapshot, RequestOfferSnapshotSDKType, ResponseOfferSnapshot, ResponseOfferSnapshotSDKType, RequestLoadSnapshotChunk, RequestLoadSnapshotChunkSDKType, ResponseLoadSnapshotChunk, ResponseLoadSnapshotChunkSDKType, RequestApplySnapshotChunk, RequestApplySnapshotChunkSDKType, ResponseApplySnapshotChunk, ResponseApplySnapshotChunkSDKType } from "./types"; +/** + * @name getEcho + * @package tendermint.abci + * @see proto service: tendermint.abci.Echo + */ +export const getEcho = buildQuery({ + encode: RequestEcho.encode, + decode: ResponseEcho.decode, + service: "tendermint.abci.ABCIApplication", + method: "Echo" +}); +/** + * @name getFlush + * @package tendermint.abci + * @see proto service: tendermint.abci.Flush + */ +export const getFlush = buildQuery({ + encode: RequestFlush.encode, + decode: ResponseFlush.decode, + service: "tendermint.abci.ABCIApplication", + method: "Flush" +}); +/** + * @name getInfo + * @package tendermint.abci + * @see proto service: tendermint.abci.Info + */ +export const getInfo = buildQuery({ + encode: RequestInfo.encode, + decode: ResponseInfo.decode, + service: "tendermint.abci.ABCIApplication", + method: "Info" +}); +/** + * @name getSetOption + * @package tendermint.abci + * @see proto service: tendermint.abci.SetOption + */ +export const getSetOption = buildQuery({ + encode: RequestSetOption.encode, + decode: ResponseSetOption.decode, + service: "tendermint.abci.ABCIApplication", + method: "SetOption" +}); +/** + * @name getDeliverTx + * @package tendermint.abci + * @see proto service: tendermint.abci.DeliverTx + */ +export const getDeliverTx = buildQuery({ + encode: RequestDeliverTx.encode, + decode: ResponseDeliverTx.decode, + service: "tendermint.abci.ABCIApplication", + method: "DeliverTx" +}); +/** + * @name getCheckTx + * @package tendermint.abci + * @see proto service: tendermint.abci.CheckTx + */ +export const getCheckTx = buildQuery({ + encode: RequestCheckTx.encode, + decode: ResponseCheckTx.decode, + service: "tendermint.abci.ABCIApplication", + method: "CheckTx" +}); +/** + * @name getQuery + * @package tendermint.abci + * @see proto service: tendermint.abci.Query + */ +export const getQuery = buildQuery({ + encode: RequestQuery.encode, + decode: ResponseQuery.decode, + service: "tendermint.abci.ABCIApplication", + method: "Query" +}); +/** + * @name getCommit + * @package tendermint.abci + * @see proto service: tendermint.abci.Commit + */ +export const getCommit = buildQuery({ + encode: RequestCommit.encode, + decode: ResponseCommit.decode, + service: "tendermint.abci.ABCIApplication", + method: "Commit" +}); +/** + * @name getInitChain + * @package tendermint.abci + * @see proto service: tendermint.abci.InitChain + */ +export const getInitChain = buildQuery({ + encode: RequestInitChain.encode, + decode: ResponseInitChain.decode, + service: "tendermint.abci.ABCIApplication", + method: "InitChain" +}); +/** + * @name getBeginBlock + * @package tendermint.abci + * @see proto service: tendermint.abci.BeginBlock + */ +export const getBeginBlock = buildQuery({ + encode: RequestBeginBlock.encode, + decode: ResponseBeginBlock.decode, + service: "tendermint.abci.ABCIApplication", + method: "BeginBlock" +}); +/** + * @name getEndBlock + * @package tendermint.abci + * @see proto service: tendermint.abci.EndBlock + */ +export const getEndBlock = buildQuery({ + encode: RequestEndBlock.encode, + decode: ResponseEndBlock.decode, + service: "tendermint.abci.ABCIApplication", + method: "EndBlock" +}); +/** + * @name getListSnapshots + * @package tendermint.abci + * @see proto service: tendermint.abci.ListSnapshots + */ +export const getListSnapshots = buildQuery({ + encode: RequestListSnapshots.encode, + decode: ResponseListSnapshots.decode, + service: "tendermint.abci.ABCIApplication", + method: "ListSnapshots" +}); +/** + * @name getOfferSnapshot + * @package tendermint.abci + * @see proto service: tendermint.abci.OfferSnapshot + */ +export const getOfferSnapshot = buildQuery({ + encode: RequestOfferSnapshot.encode, + decode: ResponseOfferSnapshot.decode, + service: "tendermint.abci.ABCIApplication", + method: "OfferSnapshot" +}); +/** + * @name getLoadSnapshotChunk + * @package tendermint.abci + * @see proto service: tendermint.abci.LoadSnapshotChunk + */ +export const getLoadSnapshotChunk = buildQuery({ + encode: RequestLoadSnapshotChunk.encode, + decode: ResponseLoadSnapshotChunk.decode, + service: "tendermint.abci.ABCIApplication", + method: "LoadSnapshotChunk" +}); +/** + * @name getApplySnapshotChunk + * @package tendermint.abci + * @see proto service: tendermint.abci.ApplySnapshotChunk + */ +export const getApplySnapshotChunk = buildQuery({ + encode: RequestApplySnapshotChunk.encode, + decode: ResponseApplySnapshotChunk.decode, + service: "tendermint.abci.ABCIApplication", + method: "ApplySnapshotChunk" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputosmojs/tendermint/bundle.ts b/__fixtures__/v-next/outputosmojs/tendermint/bundle.ts index 1c555067a6..15d0291e4b 100644 --- a/__fixtures__/v-next/outputosmojs/tendermint/bundle.ts +++ b/__fixtures__/v-next/outputosmojs/tendermint/bundle.ts @@ -9,13 +9,15 @@ import * as _359 from "./types/params"; import * as _360 from "./types/types"; import * as _361 from "./types/validator"; import * as _362 from "./version/types"; -import * as _623 from "./abci/types.rpc.ABCIApplication"; -import * as _648 from "./lcd"; -import * as _649 from "./rpc.query"; +import * as _731 from "./abci/types.rpc.func"; +import * as _732 from "./abci/types.rpc.ABCIApplication"; +import * as _757 from "./lcd"; +import * as _758 from "./rpc.query"; export namespace tendermint { export const abci = { ..._352, - ..._623 + ..._731, + ..._732 }; export const crypto = { ..._353, @@ -40,7 +42,7 @@ export namespace tendermint { ..._362 }; export const ClientFactory = { - ..._648, - ..._649 + ..._757, + ..._758 }; } \ No newline at end of file diff --git a/__fixtures__/v-next/outputosmojs/types.ts b/__fixtures__/v-next/outputosmojs/types.ts new file mode 100644 index 0000000000..1acee677e2 --- /dev/null +++ b/__fixtures__/v-next/outputosmojs/types.ts @@ -0,0 +1,109 @@ +/** +* This file and any referenced files were automatically generated by @hyperweb/telescope@latest +* DO NOT MODIFY BY HAND. Instead, download the latest proto files for your chain +* and run the transpile command or npm scripts command that is used to regenerate this bundle. +*/ + +import { IBinaryReader, IBinaryWriter } from "./binary"; +import { Any } from "./google/protobuf/any"; + +import { HttpEndpoint } from "@interchainjs/types"; + + +import { DeliverTxResponse, Event, Attribute } from "@interchainjs/types"; + +export { DeliverTxResponse } + + +export type ProtoMsg = Omit & { typeUrl: any }; + +export interface IAminoMsg { + type: any; + value: Amino; +} + +export interface IProtoType { + $typeUrl?: any; +} + +/** + * A type generated by Telescope 1.0. + */ +export interface TelescopeGeneratedCodec< + T = unknown, + SDK = unknown, + Amino = unknown +> { + readonly typeUrl: string; + readonly aminoType?: string; + is?(o: unknown): o is T; + isSDK?(o: unknown): o is SDK; + isAmino?(o: unknown): o is Amino; + encode: (message: T, writer?: IBinaryWriter | any) => IBinaryWriter | any; + decode: (input: IBinaryReader | Uint8Array | any, length?: number) => T; + fromPartial: (object: any) => T | any; + fromJSON?: (object: any) => T | any; + toJSON?: (message: T | any) => any; + fromSDK?: (sdk: SDK) => T; + fromSDKJSON?: (object: any) => SDK; + toSDK?: (message: T) => SDK; + fromAmino?: (amino: Amino) => T; + toAmino?: (message: T) => Amino; + fromAminoMsg?: (aminoMsg: IAminoMsg) => T; + toAminoMsg?: (message: T) => IAminoMsg; + toProto?: (message: T) => Uint8Array; + fromProtoMsg?: (message: ProtoMsg) => T; + toProtoMsg?: (message: T) => Any; + registerTypeUrl?: () => void; +} + +export type TelescopeGeneratedType< + T = unknown, + SDK = unknown, + Amino = unknown +> = TelescopeGeneratedCodec; + +export type GeneratedType = TelescopeGeneratedCodec; + +/** + * Coin defines a token with a denomination and an amount. + * + * NOTE: The amount field is an Int which implements the custom method + * signatures required by gogoproto. + */ +interface Coin { + denom: string; + amount: string; +} + +export type EncodeObject = Message; + +export interface Message { + typeUrl: string; + value: T; +} + +export interface StdFee { + amount: Coin[]; + gas: string; + /** The granter address that is used for paying with feegrants */ + granter?: string; + /** The fee payer address. The payer must have signed the transaction. */ + payer?: string; +} + + +export interface TxRpc { + request( + service: string, + method: string, + data: Uint8Array + ): Promise; + signAndBroadcast?( + signerAddress: string, + messages: EncodeObject[], + fee: StdFee | "auto" | number, + memo: string + ): Promise; +} + diff --git a/__fixtures__/v-next/outputsign/akash/audit/v1beta1/audit.rpc.func.ts b/__fixtures__/v-next/outputsign/akash/audit/v1beta1/audit.rpc.func.ts new file mode 100644 index 0000000000..2c7f66ceab --- /dev/null +++ b/__fixtures__/v-next/outputsign/akash/audit/v1beta1/audit.rpc.func.ts @@ -0,0 +1,21 @@ +import { Attribute, AttributeSDKType } from "../../base/v1beta1/attribute"; +import { buildTx } from "../../../helper-func-types"; +import { MsgSignProviderAttributes, MsgSignProviderAttributesSDKType, MsgSignProviderAttributesResponse, MsgSignProviderAttributesResponseSDKType, MsgDeleteProviderAttributes, MsgDeleteProviderAttributesSDKType, MsgDeleteProviderAttributesResponse, MsgDeleteProviderAttributesResponseSDKType } from "./audit"; +/** + * SignProviderAttributes defines a method that signs provider attributes + * @name signProviderAttributes + * @package akash.audit.v1beta1 + * @see proto service: akash.audit.v1beta1.SignProviderAttributes + */ +export const signProviderAttributes = buildTx({ + msg: MsgSignProviderAttributes +}); +/** + * DeleteProviderAttributes defines a method that deletes provider attributes + * @name deleteProviderAttributes + * @package akash.audit.v1beta1 + * @see proto service: akash.audit.v1beta1.DeleteProviderAttributes + */ +export const deleteProviderAttributes = buildTx({ + msg: MsgDeleteProviderAttributes +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputsign/akash/audit/v1beta2/audit.rpc.func.ts b/__fixtures__/v-next/outputsign/akash/audit/v1beta2/audit.rpc.func.ts new file mode 100644 index 0000000000..3e6236d47c --- /dev/null +++ b/__fixtures__/v-next/outputsign/akash/audit/v1beta2/audit.rpc.func.ts @@ -0,0 +1,21 @@ +import { Attribute, AttributeSDKType } from "../../base/v1beta2/attribute"; +import { buildTx } from "../../../helper-func-types"; +import { MsgSignProviderAttributes, MsgSignProviderAttributesSDKType, MsgSignProviderAttributesResponse, MsgSignProviderAttributesResponseSDKType, MsgDeleteProviderAttributes, MsgDeleteProviderAttributesSDKType, MsgDeleteProviderAttributesResponse, MsgDeleteProviderAttributesResponseSDKType } from "./audit"; +/** + * SignProviderAttributes defines a method that signs provider attributes + * @name signProviderAttributes + * @package akash.audit.v1beta2 + * @see proto service: akash.audit.v1beta2.SignProviderAttributes + */ +export const signProviderAttributes = buildTx({ + msg: MsgSignProviderAttributes +}); +/** + * DeleteProviderAttributes defines a method that deletes provider attributes + * @name deleteProviderAttributes + * @package akash.audit.v1beta2 + * @see proto service: akash.audit.v1beta2.DeleteProviderAttributes + */ +export const deleteProviderAttributes = buildTx({ + msg: MsgDeleteProviderAttributes +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputsign/akash/audit/v1beta2/query.rpc.func.ts b/__fixtures__/v-next/outputsign/akash/audit/v1beta2/query.rpc.func.ts new file mode 100644 index 0000000000..37305420f7 --- /dev/null +++ b/__fixtures__/v-next/outputsign/akash/audit/v1beta2/query.rpc.func.ts @@ -0,0 +1,60 @@ +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination"; +import { Provider, ProviderSDKType } from "./audit"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { QueryAllProvidersAttributesRequest, QueryAllProvidersAttributesRequestSDKType, QueryProvidersResponse, QueryProvidersResponseSDKType, QueryProviderAttributesRequest, QueryProviderAttributesRequestSDKType, QueryProviderAuditorRequest, QueryProviderAuditorRequestSDKType, QueryAuditorAttributesRequest, QueryAuditorAttributesRequestSDKType } from "./query"; +/** + * AllProvidersAttributes queries all providers + * buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE + * buf:lint:ignore RPC_RESPONSE_STANDARD_NAME + * @name getAllProvidersAttributes + * @package akash.audit.v1beta2 + * @see proto service: akash.audit.v1beta2.AllProvidersAttributes + */ +export const getAllProvidersAttributes = buildQuery({ + encode: QueryAllProvidersAttributesRequest.encode, + decode: QueryProvidersResponse.decode, + service: "akash.audit.v1beta2.Query", + method: "AllProvidersAttributes" +}); +/** + * ProviderAttributes queries all provider signed attributes + * buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE + * buf:lint:ignore RPC_RESPONSE_STANDARD_NAME + * @name getProviderAttributes + * @package akash.audit.v1beta2 + * @see proto service: akash.audit.v1beta2.ProviderAttributes + */ +export const getProviderAttributes = buildQuery({ + encode: QueryProviderAttributesRequest.encode, + decode: QueryProvidersResponse.decode, + service: "akash.audit.v1beta2.Query", + method: "ProviderAttributes" +}); +/** + * ProviderAuditorAttributes queries provider signed attributes by specific auditor + * buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE + * buf:lint:ignore RPC_RESPONSE_STANDARD_NAME + * @name getProviderAuditorAttributes + * @package akash.audit.v1beta2 + * @see proto service: akash.audit.v1beta2.ProviderAuditorAttributes + */ +export const getProviderAuditorAttributes = buildQuery({ + encode: QueryProviderAuditorRequest.encode, + decode: QueryProvidersResponse.decode, + service: "akash.audit.v1beta2.Query", + method: "ProviderAuditorAttributes" +}); +/** + * AuditorAttributes queries all providers signed by this auditor + * buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE + * buf:lint:ignore RPC_RESPONSE_STANDARD_NAME + * @name getAuditorAttributes + * @package akash.audit.v1beta2 + * @see proto service: akash.audit.v1beta2.AuditorAttributes + */ +export const getAuditorAttributes = buildQuery({ + encode: QueryAuditorAttributesRequest.encode, + decode: QueryProvidersResponse.decode, + service: "akash.audit.v1beta2.Query", + method: "AuditorAttributes" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputsign/akash/bundle.ts b/__fixtures__/v-next/outputsign/akash/bundle.ts index 6de3114418..a669ea6030 100644 --- a/__fixtures__/v-next/outputsign/akash/bundle.ts +++ b/__fixtures__/v-next/outputsign/akash/bundle.ts @@ -73,31 +73,48 @@ import * as _334 from "./escrow/v1beta1/query.lcd"; import * as _335 from "./escrow/v1beta2/query.lcd"; import * as _336 from "./market/v1beta2/query.lcd"; import * as _337 from "./provider/v1beta2/query.lcd"; -import * as _338 from "./audit/v1beta2/query.rpc.Query"; -import * as _339 from "./cert/v1beta2/query.rpc.Query"; -import * as _340 from "./deployment/v1beta2/query.rpc.Query"; -import * as _341 from "./escrow/v1beta1/query.rpc.Query"; -import * as _342 from "./escrow/v1beta2/query.rpc.Query"; -import * as _343 from "./market/v1beta2/query.rpc.Query"; -import * as _344 from "./provider/v1beta2/query.rpc.Query"; -import * as _345 from "./audit/v1beta1/audit.rpc.msg"; -import * as _346 from "./audit/v1beta2/audit.rpc.msg"; -import * as _347 from "./cert/v1beta2/cert.rpc.msg"; -import * as _348 from "./deployment/v1beta2/service.rpc.msg"; -import * as _349 from "./market/v1beta2/service.rpc.msg"; -import * as _350 from "./provider/v1beta1/provider.rpc.msg"; -import * as _351 from "./provider/v1beta2/provider.rpc.msg"; -import * as _352 from "./cert/v1beta2/query.pinia.store"; -import * as _536 from "./lcd"; -import * as _537 from "./rpc.query"; -import * as _538 from "./rpc.tx"; +import * as _338 from "./audit/v1beta2/query.rpc.func"; +import * as _339 from "./cert/v1beta2/query.rpc.func"; +import * as _340 from "./deployment/v1beta1/query.rpc.func"; +import * as _341 from "./deployment/v1beta2/query.rpc.func"; +import * as _342 from "./escrow/v1beta1/query.rpc.func"; +import * as _343 from "./escrow/v1beta2/query.rpc.func"; +import * as _344 from "./market/v1beta2/query.rpc.func"; +import * as _345 from "./provider/v1beta2/query.rpc.func"; +import * as _346 from "./audit/v1beta2/query.rpc.Query"; +import * as _347 from "./cert/v1beta2/query.rpc.Query"; +import * as _348 from "./deployment/v1beta2/query.rpc.Query"; +import * as _349 from "./escrow/v1beta1/query.rpc.Query"; +import * as _350 from "./escrow/v1beta2/query.rpc.Query"; +import * as _351 from "./market/v1beta2/query.rpc.Query"; +import * as _352 from "./provider/v1beta2/query.rpc.Query"; +import * as _353 from "./audit/v1beta1/audit.rpc.func"; +import * as _354 from "./audit/v1beta2/audit.rpc.func"; +import * as _355 from "./cert/v1beta2/cert.rpc.func"; +import * as _356 from "./deployment/v1beta1/deployment.rpc.func"; +import * as _357 from "./deployment/v1beta2/service.rpc.func"; +import * as _358 from "./market/v1beta2/service.rpc.func"; +import * as _359 from "./provider/v1beta1/provider.rpc.func"; +import * as _360 from "./provider/v1beta2/provider.rpc.func"; +import * as _361 from "./audit/v1beta1/audit.rpc.msg"; +import * as _362 from "./audit/v1beta2/audit.rpc.msg"; +import * as _363 from "./cert/v1beta2/cert.rpc.msg"; +import * as _364 from "./deployment/v1beta2/service.rpc.msg"; +import * as _365 from "./market/v1beta2/service.rpc.msg"; +import * as _366 from "./provider/v1beta1/provider.rpc.msg"; +import * as _367 from "./provider/v1beta2/provider.rpc.msg"; +import * as _368 from "./cert/v1beta2/query.pinia.store"; +import * as _629 from "./lcd"; +import * as _630 from "./rpc.query"; +import * as _631 from "./rpc.tx"; export namespace akash { export namespace audit { export const v1beta1 = { ..._0, ..._316, ..._323, - ..._345 + ..._353, + ..._361 }; export const v1beta2 = { ..._1, @@ -107,7 +124,9 @@ export namespace akash { ..._324, ..._330, ..._338, - ..._346 + ..._346, + ..._354, + ..._362 }; } export namespace base { @@ -135,7 +154,9 @@ export namespace akash { ..._331, ..._339, ..._347, - ..._352 + ..._355, + ..._363, + ..._368 }; } export namespace deployment { @@ -146,7 +167,9 @@ export namespace akash { ..._19, ..._20, ..._21, - ..._332 + ..._332, + ..._340, + ..._356 }; export const v1beta2 = { ..._22, @@ -164,8 +187,10 @@ export namespace akash { ..._319, ..._326, ..._333, - ..._340, - ..._348 + ..._341, + ..._348, + ..._357, + ..._364 }; } export namespace escrow { @@ -174,14 +199,16 @@ export namespace akash { ..._35, ..._36, ..._334, - ..._341 + ..._342, + ..._349 }; export const v1beta2 = { ..._37, ..._38, ..._39, ..._335, - ..._342 + ..._343, + ..._350 }; } export namespace inflation { @@ -202,8 +229,10 @@ export namespace akash { ..._320, ..._327, ..._336, - ..._343, - ..._349 + ..._344, + ..._351, + ..._358, + ..._365 }; } export namespace provider { @@ -211,7 +240,8 @@ export namespace akash { ..._49, ..._321, ..._328, - ..._350 + ..._359, + ..._366 }; export const v1beta2 = { ..._50, @@ -220,13 +250,15 @@ export namespace akash { ..._322, ..._329, ..._337, - ..._344, - ..._351 + ..._345, + ..._352, + ..._360, + ..._367 }; } export const ClientFactory = { - ..._536, - ..._537, - ..._538 + ..._629, + ..._630, + ..._631 }; } \ No newline at end of file diff --git a/__fixtures__/v-next/outputsign/akash/cert/v1beta2/cert.rpc.func.ts b/__fixtures__/v-next/outputsign/akash/cert/v1beta2/cert.rpc.func.ts new file mode 100644 index 0000000000..bd7aec965f --- /dev/null +++ b/__fixtures__/v-next/outputsign/akash/cert/v1beta2/cert.rpc.func.ts @@ -0,0 +1,20 @@ +import { buildTx } from "../../../helper-func-types"; +import { MsgCreateCertificate, MsgCreateCertificateSDKType, MsgCreateCertificateResponse, MsgCreateCertificateResponseSDKType, MsgRevokeCertificate, MsgRevokeCertificateSDKType, MsgRevokeCertificateResponse, MsgRevokeCertificateResponseSDKType } from "./cert"; +/** + * CreateCertificate defines a method to create new certificate given proper inputs. + * @name createCertificate + * @package akash.cert.v1beta2 + * @see proto service: akash.cert.v1beta2.CreateCertificate + */ +export const createCertificate = buildTx({ + msg: MsgCreateCertificate +}); +/** + * RevokeCertificate defines a method to revoke the certificate + * @name revokeCertificate + * @package akash.cert.v1beta2 + * @see proto service: akash.cert.v1beta2.RevokeCertificate + */ +export const revokeCertificate = buildTx({ + msg: MsgRevokeCertificate +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputsign/akash/cert/v1beta2/query.rpc.func.ts b/__fixtures__/v-next/outputsign/akash/cert/v1beta2/query.rpc.func.ts new file mode 100644 index 0000000000..adca22be83 --- /dev/null +++ b/__fixtures__/v-next/outputsign/akash/cert/v1beta2/query.rpc.func.ts @@ -0,0 +1,16 @@ +import { CertificateFilter, CertificateFilterSDKType, Certificate, CertificateSDKType } from "./cert"; +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { QueryCertificatesRequest, QueryCertificatesRequestSDKType, QueryCertificatesResponse, QueryCertificatesResponseSDKType } from "./query"; +/** + * Certificates queries certificates + * @name getCertificates + * @package akash.cert.v1beta2 + * @see proto service: akash.cert.v1beta2.Certificates + */ +export const getCertificates = buildQuery({ + encode: QueryCertificatesRequest.encode, + decode: QueryCertificatesResponse.decode, + service: "akash.cert.v1beta2.Query", + method: "Certificates" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputsign/akash/deployment/v1beta1/deployment.rpc.func.ts b/__fixtures__/v-next/outputsign/akash/deployment/v1beta1/deployment.rpc.func.ts new file mode 100644 index 0000000000..74f7d60ba4 --- /dev/null +++ b/__fixtures__/v-next/outputsign/akash/deployment/v1beta1/deployment.rpc.func.ts @@ -0,0 +1,67 @@ +import { GroupSpec, GroupSpecSDKType, GroupID, GroupIDSDKType, MsgCloseGroup, MsgCloseGroupSDKType, MsgCloseGroupResponse, MsgCloseGroupResponseSDKType, MsgPauseGroup, MsgPauseGroupSDKType, MsgPauseGroupResponse, MsgPauseGroupResponseSDKType, MsgStartGroup, MsgStartGroupSDKType, MsgStartGroupResponse, MsgStartGroupResponseSDKType } from "./group"; +import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; +import { buildTx } from "../../../helper-func-types"; +import { MsgCreateDeployment, MsgCreateDeploymentSDKType, MsgCreateDeploymentResponse, MsgCreateDeploymentResponseSDKType, MsgDepositDeployment, MsgDepositDeploymentSDKType, MsgDepositDeploymentResponse, MsgDepositDeploymentResponseSDKType, MsgUpdateDeployment, MsgUpdateDeploymentSDKType, MsgUpdateDeploymentResponse, MsgUpdateDeploymentResponseSDKType, MsgCloseDeployment, MsgCloseDeploymentSDKType, MsgCloseDeploymentResponse, MsgCloseDeploymentResponseSDKType } from "./deployment"; +/** + * CreateDeployment defines a method to create new deployment given proper inputs. + * @name createDeployment + * @package akash.deployment.v1beta1 + * @see proto service: akash.deployment.v1beta1.CreateDeployment + */ +export const createDeployment = buildTx({ + msg: MsgCreateDeployment +}); +/** + * DepositDeployment deposits more funds into the deployment account + * @name depositDeployment + * @package akash.deployment.v1beta1 + * @see proto service: akash.deployment.v1beta1.DepositDeployment + */ +export const depositDeployment = buildTx({ + msg: MsgDepositDeployment +}); +/** + * UpdateDeployment defines a method to update a deployment given proper inputs. + * @name updateDeployment + * @package akash.deployment.v1beta1 + * @see proto service: akash.deployment.v1beta1.UpdateDeployment + */ +export const updateDeployment = buildTx({ + msg: MsgUpdateDeployment +}); +/** + * CloseDeployment defines a method to close a deployment given proper inputs. + * @name closeDeployment + * @package akash.deployment.v1beta1 + * @see proto service: akash.deployment.v1beta1.CloseDeployment + */ +export const closeDeployment = buildTx({ + msg: MsgCloseDeployment +}); +/** + * CloseGroup defines a method to close a group of a deployment given proper inputs. + * @name closeGroup + * @package akash.deployment.v1beta1 + * @see proto service: akash.deployment.v1beta1.CloseGroup + */ +export const closeGroup = buildTx({ + msg: MsgCloseGroup +}); +/** + * PauseGroup defines a method to close a group of a deployment given proper inputs. + * @name pauseGroup + * @package akash.deployment.v1beta1 + * @see proto service: akash.deployment.v1beta1.PauseGroup + */ +export const pauseGroup = buildTx({ + msg: MsgPauseGroup +}); +/** + * StartGroup defines a method to close a group of a deployment given proper inputs. + * @name startGroup + * @package akash.deployment.v1beta1 + * @see proto service: akash.deployment.v1beta1.StartGroup + */ +export const startGroup = buildTx({ + msg: MsgStartGroup +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputsign/akash/deployment/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputsign/akash/deployment/v1beta1/query.rpc.func.ts new file mode 100644 index 0000000000..77a812c186 --- /dev/null +++ b/__fixtures__/v-next/outputsign/akash/deployment/v1beta1/query.rpc.func.ts @@ -0,0 +1,42 @@ +import { DeploymentFilters, DeploymentFiltersSDKType, DeploymentID, DeploymentIDSDKType, Deployment, DeploymentSDKType } from "./deployment"; +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination"; +import { GroupID, GroupIDSDKType, Group, GroupSDKType } from "./group"; +import { Account, AccountSDKType } from "../../escrow/v1beta1/types"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { QueryDeploymentsRequest, QueryDeploymentsRequestSDKType, QueryDeploymentsResponse, QueryDeploymentsResponseSDKType, QueryDeploymentRequest, QueryDeploymentRequestSDKType, QueryDeploymentResponse, QueryDeploymentResponseSDKType, QueryGroupRequest, QueryGroupRequestSDKType, QueryGroupResponse, QueryGroupResponseSDKType } from "./query"; +/** + * Deployments queries deployments + * @name getDeployments + * @package akash.deployment.v1beta1 + * @see proto service: akash.deployment.v1beta1.Deployments + */ +export const getDeployments = buildQuery({ + encode: QueryDeploymentsRequest.encode, + decode: QueryDeploymentsResponse.decode, + service: "akash.deployment.v1beta1.Query", + method: "Deployments" +}); +/** + * Deployment queries deployment details + * @name getDeployment + * @package akash.deployment.v1beta1 + * @see proto service: akash.deployment.v1beta1.Deployment + */ +export const getDeployment = buildQuery({ + encode: QueryDeploymentRequest.encode, + decode: QueryDeploymentResponse.decode, + service: "akash.deployment.v1beta1.Query", + method: "Deployment" +}); +/** + * Group queries group details + * @name getGroup + * @package akash.deployment.v1beta1 + * @see proto service: akash.deployment.v1beta1.Group + */ +export const getGroup = buildQuery({ + encode: QueryGroupRequest.encode, + decode: QueryGroupResponse.decode, + service: "akash.deployment.v1beta1.Query", + method: "Group" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputsign/akash/deployment/v1beta2/query.rpc.func.ts b/__fixtures__/v-next/outputsign/akash/deployment/v1beta2/query.rpc.func.ts new file mode 100644 index 0000000000..8de064dc44 --- /dev/null +++ b/__fixtures__/v-next/outputsign/akash/deployment/v1beta2/query.rpc.func.ts @@ -0,0 +1,43 @@ +import { DeploymentFilters, DeploymentFiltersSDKType, DeploymentID, DeploymentIDSDKType, Deployment, DeploymentSDKType } from "./deployment"; +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination"; +import { GroupID, GroupIDSDKType } from "./groupid"; +import { Group, GroupSDKType } from "./group"; +import { Account, AccountSDKType } from "../../escrow/v1beta2/types"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { QueryDeploymentsRequest, QueryDeploymentsRequestSDKType, QueryDeploymentsResponse, QueryDeploymentsResponseSDKType, QueryDeploymentRequest, QueryDeploymentRequestSDKType, QueryDeploymentResponse, QueryDeploymentResponseSDKType, QueryGroupRequest, QueryGroupRequestSDKType, QueryGroupResponse, QueryGroupResponseSDKType } from "./query"; +/** + * Deployments queries deployments + * @name getDeployments + * @package akash.deployment.v1beta2 + * @see proto service: akash.deployment.v1beta2.Deployments + */ +export const getDeployments = buildQuery({ + encode: QueryDeploymentsRequest.encode, + decode: QueryDeploymentsResponse.decode, + service: "akash.deployment.v1beta2.Query", + method: "Deployments" +}); +/** + * Deployment queries deployment details + * @name getDeployment + * @package akash.deployment.v1beta2 + * @see proto service: akash.deployment.v1beta2.Deployment + */ +export const getDeployment = buildQuery({ + encode: QueryDeploymentRequest.encode, + decode: QueryDeploymentResponse.decode, + service: "akash.deployment.v1beta2.Query", + method: "Deployment" +}); +/** + * Group queries group details + * @name getGroup + * @package akash.deployment.v1beta2 + * @see proto service: akash.deployment.v1beta2.Group + */ +export const getGroup = buildQuery({ + encode: QueryGroupRequest.encode, + decode: QueryGroupResponse.decode, + service: "akash.deployment.v1beta2.Query", + method: "Group" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputsign/akash/deployment/v1beta2/service.rpc.func.ts b/__fixtures__/v-next/outputsign/akash/deployment/v1beta2/service.rpc.func.ts new file mode 100644 index 0000000000..bd99b0050f --- /dev/null +++ b/__fixtures__/v-next/outputsign/akash/deployment/v1beta2/service.rpc.func.ts @@ -0,0 +1,70 @@ +import { DeploymentID, DeploymentIDSDKType } from "./deployment"; +import { GroupSpec, GroupSpecSDKType } from "./groupspec"; +import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; +import { GroupID, GroupIDSDKType } from "./groupid"; +import { buildTx } from "../../../helper-func-types"; +import { MsgCreateDeployment, MsgCreateDeploymentSDKType, MsgCreateDeploymentResponse, MsgCreateDeploymentResponseSDKType, MsgDepositDeployment, MsgDepositDeploymentSDKType, MsgDepositDeploymentResponse, MsgDepositDeploymentResponseSDKType, MsgUpdateDeployment, MsgUpdateDeploymentSDKType, MsgUpdateDeploymentResponse, MsgUpdateDeploymentResponseSDKType, MsgCloseDeployment, MsgCloseDeploymentSDKType, MsgCloseDeploymentResponse, MsgCloseDeploymentResponseSDKType } from "./deploymentmsg"; +import { MsgCloseGroup, MsgCloseGroupSDKType, MsgCloseGroupResponse, MsgCloseGroupResponseSDKType, MsgPauseGroup, MsgPauseGroupSDKType, MsgPauseGroupResponse, MsgPauseGroupResponseSDKType, MsgStartGroup, MsgStartGroupSDKType, MsgStartGroupResponse, MsgStartGroupResponseSDKType } from "./groupmsg"; +/** + * CreateDeployment defines a method to create new deployment given proper inputs. + * @name createDeployment + * @package akash.deployment.v1beta2 + * @see proto service: akash.deployment.v1beta2.CreateDeployment + */ +export const createDeployment = buildTx({ + msg: MsgCreateDeployment +}); +/** + * DepositDeployment deposits more funds into the deployment account + * @name depositDeployment + * @package akash.deployment.v1beta2 + * @see proto service: akash.deployment.v1beta2.DepositDeployment + */ +export const depositDeployment = buildTx({ + msg: MsgDepositDeployment +}); +/** + * UpdateDeployment defines a method to update a deployment given proper inputs. + * @name updateDeployment + * @package akash.deployment.v1beta2 + * @see proto service: akash.deployment.v1beta2.UpdateDeployment + */ +export const updateDeployment = buildTx({ + msg: MsgUpdateDeployment +}); +/** + * CloseDeployment defines a method to close a deployment given proper inputs. + * @name closeDeployment + * @package akash.deployment.v1beta2 + * @see proto service: akash.deployment.v1beta2.CloseDeployment + */ +export const closeDeployment = buildTx({ + msg: MsgCloseDeployment +}); +/** + * CloseGroup defines a method to close a group of a deployment given proper inputs. + * @name closeGroup + * @package akash.deployment.v1beta2 + * @see proto service: akash.deployment.v1beta2.CloseGroup + */ +export const closeGroup = buildTx({ + msg: MsgCloseGroup +}); +/** + * PauseGroup defines a method to close a group of a deployment given proper inputs. + * @name pauseGroup + * @package akash.deployment.v1beta2 + * @see proto service: akash.deployment.v1beta2.PauseGroup + */ +export const pauseGroup = buildTx({ + msg: MsgPauseGroup +}); +/** + * StartGroup defines a method to close a group of a deployment given proper inputs. + * @name startGroup + * @package akash.deployment.v1beta2 + * @see proto service: akash.deployment.v1beta2.StartGroup + */ +export const startGroup = buildTx({ + msg: MsgStartGroup +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputsign/akash/escrow/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputsign/akash/escrow/v1beta1/query.rpc.func.ts new file mode 100644 index 0000000000..dfbdf297d1 --- /dev/null +++ b/__fixtures__/v-next/outputsign/akash/escrow/v1beta1/query.rpc.func.ts @@ -0,0 +1,32 @@ +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination"; +import { Account, AccountSDKType, Payment, PaymentSDKType } from "./types"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { QueryAccountsRequest, QueryAccountsRequestSDKType, QueryAccountsResponse, QueryAccountsResponseSDKType, QueryPaymentsRequest, QueryPaymentsRequestSDKType, QueryPaymentsResponse, QueryPaymentsResponseSDKType } from "./query"; +/** + * buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE + * buf:lint:ignore RPC_RESPONSE_STANDARD_NAME + * Accounts queries all accounts + * @name getAccounts + * @package akash.escrow.v1beta1 + * @see proto service: akash.escrow.v1beta1.Accounts + */ +export const getAccounts = buildQuery({ + encode: QueryAccountsRequest.encode, + decode: QueryAccountsResponse.decode, + service: "akash.escrow.v1beta1.Query", + method: "Accounts" +}); +/** + * buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE + * buf:lint:ignore RPC_RESPONSE_STANDARD_NAME + * Payments queries all payments + * @name getPayments + * @package akash.escrow.v1beta1 + * @see proto service: akash.escrow.v1beta1.Payments + */ +export const getPayments = buildQuery({ + encode: QueryPaymentsRequest.encode, + decode: QueryPaymentsResponse.decode, + service: "akash.escrow.v1beta1.Query", + method: "Payments" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputsign/akash/escrow/v1beta2/query.rpc.func.ts b/__fixtures__/v-next/outputsign/akash/escrow/v1beta2/query.rpc.func.ts new file mode 100644 index 0000000000..6d929b5658 --- /dev/null +++ b/__fixtures__/v-next/outputsign/akash/escrow/v1beta2/query.rpc.func.ts @@ -0,0 +1,32 @@ +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination"; +import { Account, AccountSDKType, FractionalPayment, FractionalPaymentSDKType } from "./types"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { QueryAccountsRequest, QueryAccountsRequestSDKType, QueryAccountsResponse, QueryAccountsResponseSDKType, QueryPaymentsRequest, QueryPaymentsRequestSDKType, QueryPaymentsResponse, QueryPaymentsResponseSDKType } from "./query"; +/** + * buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE + * buf:lint:ignore RPC_RESPONSE_STANDARD_NAME + * Accounts queries all accounts + * @name getAccounts + * @package akash.escrow.v1beta2 + * @see proto service: akash.escrow.v1beta2.Accounts + */ +export const getAccounts = buildQuery({ + encode: QueryAccountsRequest.encode, + decode: QueryAccountsResponse.decode, + service: "akash.escrow.v1beta2.Query", + method: "Accounts" +}); +/** + * buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE + * buf:lint:ignore RPC_RESPONSE_STANDARD_NAME + * Payments queries all payments + * @name getPayments + * @package akash.escrow.v1beta2 + * @see proto service: akash.escrow.v1beta2.Payments + */ +export const getPayments = buildQuery({ + encode: QueryPaymentsRequest.encode, + decode: QueryPaymentsResponse.decode, + service: "akash.escrow.v1beta2.Query", + method: "Payments" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputsign/akash/inflation/v1beta2/params.ts b/__fixtures__/v-next/outputsign/akash/inflation/v1beta2/params.ts index ba2140a6fc..f9b69524b4 100644 --- a/__fixtures__/v-next/outputsign/akash/inflation/v1beta2/params.ts +++ b/__fixtures__/v-next/outputsign/akash/inflation/v1beta2/params.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { Decimal } from "@cosmjs/math"; +import { Decimal } from "@interchainjs/math"; import { DeepPartial, Exact } from "../../../helpers"; export const protobufPackage = "akash.inflation.v1beta2"; /** @@ -137,9 +137,9 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.inflation_decay_factor = message.inflationDecayFactor ?? ""; - obj.initial_inflation = message.initialInflation ?? ""; - obj.variance = message.variance ?? ""; + obj.inflation_decay_factor = Decimal.fromUserInput(message.inflationDecayFactor, 18).atomics ?? ""; + obj.initial_inflation = Decimal.fromUserInput(message.initialInflation, 18).atomics ?? ""; + obj.variance = Decimal.fromUserInput(message.variance, 18).atomics ?? ""; return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputsign/akash/market/v1beta2/query.rpc.func.ts b/__fixtures__/v-next/outputsign/akash/market/v1beta2/query.rpc.func.ts new file mode 100644 index 0000000000..3f82015da6 --- /dev/null +++ b/__fixtures__/v-next/outputsign/akash/market/v1beta2/query.rpc.func.ts @@ -0,0 +1,79 @@ +import { OrderFilters, OrderFiltersSDKType, OrderID, OrderIDSDKType, Order, OrderSDKType } from "./order"; +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination"; +import { BidFilters, BidFiltersSDKType, BidID, BidIDSDKType, Bid, BidSDKType } from "./bid"; +import { LeaseFilters, LeaseFiltersSDKType, LeaseID, LeaseIDSDKType, Lease, LeaseSDKType } from "./lease"; +import { Account, AccountSDKType, FractionalPayment, FractionalPaymentSDKType } from "../../escrow/v1beta2/types"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { QueryOrdersRequest, QueryOrdersRequestSDKType, QueryOrdersResponse, QueryOrdersResponseSDKType, QueryOrderRequest, QueryOrderRequestSDKType, QueryOrderResponse, QueryOrderResponseSDKType, QueryBidsRequest, QueryBidsRequestSDKType, QueryBidsResponse, QueryBidsResponseSDKType, QueryBidRequest, QueryBidRequestSDKType, QueryBidResponse, QueryBidResponseSDKType, QueryLeasesRequest, QueryLeasesRequestSDKType, QueryLeasesResponse, QueryLeasesResponseSDKType, QueryLeaseRequest, QueryLeaseRequestSDKType, QueryLeaseResponse, QueryLeaseResponseSDKType } from "./query"; +/** + * Orders queries orders with filters + * @name getOrders + * @package akash.market.v1beta2 + * @see proto service: akash.market.v1beta2.Orders + */ +export const getOrders = buildQuery({ + encode: QueryOrdersRequest.encode, + decode: QueryOrdersResponse.decode, + service: "akash.market.v1beta2.Query", + method: "Orders" +}); +/** + * Order queries order details + * @name getOrder + * @package akash.market.v1beta2 + * @see proto service: akash.market.v1beta2.Order + */ +export const getOrder = buildQuery({ + encode: QueryOrderRequest.encode, + decode: QueryOrderResponse.decode, + service: "akash.market.v1beta2.Query", + method: "Order" +}); +/** + * Bids queries bids with filters + * @name getBids + * @package akash.market.v1beta2 + * @see proto service: akash.market.v1beta2.Bids + */ +export const getBids = buildQuery({ + encode: QueryBidsRequest.encode, + decode: QueryBidsResponse.decode, + service: "akash.market.v1beta2.Query", + method: "Bids" +}); +/** + * Bid queries bid details + * @name getBid + * @package akash.market.v1beta2 + * @see proto service: akash.market.v1beta2.Bid + */ +export const getBid = buildQuery({ + encode: QueryBidRequest.encode, + decode: QueryBidResponse.decode, + service: "akash.market.v1beta2.Query", + method: "Bid" +}); +/** + * Leases queries leases with filters + * @name getLeases + * @package akash.market.v1beta2 + * @see proto service: akash.market.v1beta2.Leases + */ +export const getLeases = buildQuery({ + encode: QueryLeasesRequest.encode, + decode: QueryLeasesResponse.decode, + service: "akash.market.v1beta2.Query", + method: "Leases" +}); +/** + * Lease queries lease details + * @name getLease + * @package akash.market.v1beta2 + * @see proto service: akash.market.v1beta2.Lease + */ +export const getLease = buildQuery({ + encode: QueryLeaseRequest.encode, + decode: QueryLeaseResponse.decode, + service: "akash.market.v1beta2.Query", + method: "Lease" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputsign/akash/market/v1beta2/service.rpc.func.ts b/__fixtures__/v-next/outputsign/akash/market/v1beta2/service.rpc.func.ts new file mode 100644 index 0000000000..778aff6790 --- /dev/null +++ b/__fixtures__/v-next/outputsign/akash/market/v1beta2/service.rpc.func.ts @@ -0,0 +1,50 @@ +import { OrderID, OrderIDSDKType } from "./order"; +import { DecCoin, DecCoinSDKType, Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; +import { BidID, BidIDSDKType, MsgCreateBid, MsgCreateBidSDKType, MsgCreateBidResponse, MsgCreateBidResponseSDKType, MsgCloseBid, MsgCloseBidSDKType, MsgCloseBidResponse, MsgCloseBidResponseSDKType } from "./bid"; +import { LeaseID, LeaseIDSDKType, MsgWithdrawLease, MsgWithdrawLeaseSDKType, MsgWithdrawLeaseResponse, MsgWithdrawLeaseResponseSDKType, MsgCreateLease, MsgCreateLeaseSDKType, MsgCreateLeaseResponse, MsgCreateLeaseResponseSDKType, MsgCloseLease, MsgCloseLeaseSDKType, MsgCloseLeaseResponse, MsgCloseLeaseResponseSDKType } from "./lease"; +import { buildTx } from "../../../helper-func-types"; +/** + * CreateBid defines a method to create a bid given proper inputs. + * @name createBid + * @package akash.market.v1beta2 + * @see proto service: akash.market.v1beta2.CreateBid + */ +export const createBid = buildTx({ + msg: MsgCreateBid +}); +/** + * CloseBid defines a method to close a bid given proper inputs. + * @name closeBid + * @package akash.market.v1beta2 + * @see proto service: akash.market.v1beta2.CloseBid + */ +export const closeBid = buildTx({ + msg: MsgCloseBid +}); +/** + * WithdrawLease withdraws accrued funds from the lease payment + * @name withdrawLease + * @package akash.market.v1beta2 + * @see proto service: akash.market.v1beta2.WithdrawLease + */ +export const withdrawLease = buildTx({ + msg: MsgWithdrawLease +}); +/** + * CreateLease creates a new lease + * @name createLease + * @package akash.market.v1beta2 + * @see proto service: akash.market.v1beta2.CreateLease + */ +export const createLease = buildTx({ + msg: MsgCreateLease +}); +/** + * CloseLease defines a method to close an order given proper inputs. + * @name closeLease + * @package akash.market.v1beta2 + * @see proto service: akash.market.v1beta2.CloseLease + */ +export const closeLease = buildTx({ + msg: MsgCloseLease +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputsign/akash/provider/v1beta1/provider.rpc.func.ts b/__fixtures__/v-next/outputsign/akash/provider/v1beta1/provider.rpc.func.ts new file mode 100644 index 0000000000..7f012148ff --- /dev/null +++ b/__fixtures__/v-next/outputsign/akash/provider/v1beta1/provider.rpc.func.ts @@ -0,0 +1,30 @@ +import { Attribute, AttributeSDKType } from "../../base/v1beta1/attribute"; +import { buildTx } from "../../../helper-func-types"; +import { MsgCreateProvider, MsgCreateProviderSDKType, MsgCreateProviderResponse, MsgCreateProviderResponseSDKType, MsgUpdateProvider, MsgUpdateProviderSDKType, MsgUpdateProviderResponse, MsgUpdateProviderResponseSDKType, MsgDeleteProvider, MsgDeleteProviderSDKType, MsgDeleteProviderResponse, MsgDeleteProviderResponseSDKType } from "./provider"; +/** + * CreateProvider defines a method that creates a provider given the proper inputs + * @name createProvider + * @package akash.provider.v1beta1 + * @see proto service: akash.provider.v1beta1.CreateProvider + */ +export const createProvider = buildTx({ + msg: MsgCreateProvider +}); +/** + * UpdateProvider defines a method that updates a provider given the proper inputs + * @name updateProvider + * @package akash.provider.v1beta1 + * @see proto service: akash.provider.v1beta1.UpdateProvider + */ +export const updateProvider = buildTx({ + msg: MsgUpdateProvider +}); +/** + * DeleteProvider defines a method that deletes a provider given the proper inputs + * @name deleteProvider + * @package akash.provider.v1beta1 + * @see proto service: akash.provider.v1beta1.DeleteProvider + */ +export const deleteProvider = buildTx({ + msg: MsgDeleteProvider +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputsign/akash/provider/v1beta2/provider.rpc.func.ts b/__fixtures__/v-next/outputsign/akash/provider/v1beta2/provider.rpc.func.ts new file mode 100644 index 0000000000..2bf0b72d01 --- /dev/null +++ b/__fixtures__/v-next/outputsign/akash/provider/v1beta2/provider.rpc.func.ts @@ -0,0 +1,30 @@ +import { Attribute, AttributeSDKType } from "../../base/v1beta2/attribute"; +import { buildTx } from "../../../helper-func-types"; +import { MsgCreateProvider, MsgCreateProviderSDKType, MsgCreateProviderResponse, MsgCreateProviderResponseSDKType, MsgUpdateProvider, MsgUpdateProviderSDKType, MsgUpdateProviderResponse, MsgUpdateProviderResponseSDKType, MsgDeleteProvider, MsgDeleteProviderSDKType, MsgDeleteProviderResponse, MsgDeleteProviderResponseSDKType } from "./provider"; +/** + * CreateProvider defines a method that creates a provider given the proper inputs + * @name createProvider + * @package akash.provider.v1beta2 + * @see proto service: akash.provider.v1beta2.CreateProvider + */ +export const createProvider = buildTx({ + msg: MsgCreateProvider +}); +/** + * UpdateProvider defines a method that updates a provider given the proper inputs + * @name updateProvider + * @package akash.provider.v1beta2 + * @see proto service: akash.provider.v1beta2.UpdateProvider + */ +export const updateProvider = buildTx({ + msg: MsgUpdateProvider +}); +/** + * DeleteProvider defines a method that deletes a provider given the proper inputs + * @name deleteProvider + * @package akash.provider.v1beta2 + * @see proto service: akash.provider.v1beta2.DeleteProvider + */ +export const deleteProvider = buildTx({ + msg: MsgDeleteProvider +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputsign/akash/provider/v1beta2/query.rpc.func.ts b/__fixtures__/v-next/outputsign/akash/provider/v1beta2/query.rpc.func.ts new file mode 100644 index 0000000000..56006aca31 --- /dev/null +++ b/__fixtures__/v-next/outputsign/akash/provider/v1beta2/query.rpc.func.ts @@ -0,0 +1,28 @@ +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination"; +import { Provider, ProviderSDKType } from "./provider"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { QueryProvidersRequest, QueryProvidersRequestSDKType, QueryProvidersResponse, QueryProvidersResponseSDKType, QueryProviderRequest, QueryProviderRequestSDKType, QueryProviderResponse, QueryProviderResponseSDKType } from "./query"; +/** + * Providers queries providers + * @name getProviders + * @package akash.provider.v1beta2 + * @see proto service: akash.provider.v1beta2.Providers + */ +export const getProviders = buildQuery({ + encode: QueryProvidersRequest.encode, + decode: QueryProvidersResponse.decode, + service: "akash.provider.v1beta2.Query", + method: "Providers" +}); +/** + * Provider queries provider details + * @name getProvider + * @package akash.provider.v1beta2 + * @see proto service: akash.provider.v1beta2.Provider + */ +export const getProvider = buildQuery({ + encode: QueryProviderRequest.encode, + decode: QueryProviderResponse.decode, + service: "akash.provider.v1beta2.Query", + method: "Provider" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputsign/cosmos/app/v1alpha1/query.rpc.func.ts b/__fixtures__/v-next/outputsign/cosmos/app/v1alpha1/query.rpc.func.ts new file mode 100644 index 0000000000..1503803062 --- /dev/null +++ b/__fixtures__/v-next/outputsign/cosmos/app/v1alpha1/query.rpc.func.ts @@ -0,0 +1,15 @@ +import { Config, ConfigSDKType } from "./config"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { QueryConfigRequest, QueryConfigRequestSDKType, QueryConfigResponse, QueryConfigResponseSDKType } from "./query"; +/** + * Config returns the current app config. + * @name getConfig + * @package cosmos.app.v1alpha1 + * @see proto service: cosmos.app.v1alpha1.Config + */ +export const getConfig = buildQuery({ + encode: QueryConfigRequest.encode, + decode: QueryConfigResponse.decode, + service: "cosmos.app.v1alpha1.Query", + method: "Config" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputsign/cosmos/auth/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputsign/cosmos/auth/v1beta1/query.rpc.func.ts new file mode 100644 index 0000000000..0fcd44fabf --- /dev/null +++ b/__fixtures__/v-next/outputsign/cosmos/auth/v1beta1/query.rpc.func.ts @@ -0,0 +1,91 @@ +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; +import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../google/protobuf/any"; +import { Params, ParamsSDKType } from "./auth"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { QueryAccountsRequest, QueryAccountsRequestSDKType, QueryAccountsResponse, QueryAccountsResponseSDKType, QueryAccountRequest, QueryAccountRequestSDKType, QueryAccountResponse, QueryAccountResponseSDKType, QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, QueryModuleAccountsRequest, QueryModuleAccountsRequestSDKType, QueryModuleAccountsResponse, QueryModuleAccountsResponseSDKType, Bech32PrefixRequest, Bech32PrefixRequestSDKType, Bech32PrefixResponse, Bech32PrefixResponseSDKType, AddressBytesToStringRequest, AddressBytesToStringRequestSDKType, AddressBytesToStringResponse, AddressBytesToStringResponseSDKType, AddressStringToBytesRequest, AddressStringToBytesRequestSDKType, AddressStringToBytesResponse, AddressStringToBytesResponseSDKType } from "./query"; +/** + * Accounts returns all the existing accounts + * + * Since: cosmos-sdk 0.43 + * @name getAccounts + * @package cosmos.auth.v1beta1 + * @see proto service: cosmos.auth.v1beta1.Accounts + */ +export const getAccounts = buildQuery({ + encode: QueryAccountsRequest.encode, + decode: QueryAccountsResponse.decode, + service: "cosmos.auth.v1beta1.Query", + method: "Accounts" +}); +/** + * Account returns account details based on address. + * @name getAccount + * @package cosmos.auth.v1beta1 + * @see proto service: cosmos.auth.v1beta1.Account + */ +export const getAccount = buildQuery({ + encode: QueryAccountRequest.encode, + decode: QueryAccountResponse.decode, + service: "cosmos.auth.v1beta1.Query", + method: "Account" +}); +/** + * Params queries all parameters. + * @name getParams + * @package cosmos.auth.v1beta1 + * @see proto service: cosmos.auth.v1beta1.Params + */ +export const getParams = buildQuery({ + encode: QueryParamsRequest.encode, + decode: QueryParamsResponse.decode, + service: "cosmos.auth.v1beta1.Query", + method: "Params" +}); +/** + * ModuleAccounts returns all the existing module accounts. + * @name getModuleAccounts + * @package cosmos.auth.v1beta1 + * @see proto service: cosmos.auth.v1beta1.ModuleAccounts + */ +export const getModuleAccounts = buildQuery({ + encode: QueryModuleAccountsRequest.encode, + decode: QueryModuleAccountsResponse.decode, + service: "cosmos.auth.v1beta1.Query", + method: "ModuleAccounts" +}); +/** + * Bech32 queries bech32Prefix + * @name getBech32Prefix + * @package cosmos.auth.v1beta1 + * @see proto service: cosmos.auth.v1beta1.Bech32Prefix + */ +export const getBech32Prefix = buildQuery({ + encode: Bech32PrefixRequest.encode, + decode: Bech32PrefixResponse.decode, + service: "cosmos.auth.v1beta1.Query", + method: "Bech32Prefix" +}); +/** + * AddressBytesToString converts Account Address bytes to string + * @name getAddressBytesToString + * @package cosmos.auth.v1beta1 + * @see proto service: cosmos.auth.v1beta1.AddressBytesToString + */ +export const getAddressBytesToString = buildQuery({ + encode: AddressBytesToStringRequest.encode, + decode: AddressBytesToStringResponse.decode, + service: "cosmos.auth.v1beta1.Query", + method: "AddressBytesToString" +}); +/** + * AddressStringToBytes converts Address string to bytes + * @name getAddressStringToBytes + * @package cosmos.auth.v1beta1 + * @see proto service: cosmos.auth.v1beta1.AddressStringToBytes + */ +export const getAddressStringToBytes = buildQuery({ + encode: AddressStringToBytesRequest.encode, + decode: AddressStringToBytesResponse.decode, + service: "cosmos.auth.v1beta1.Query", + method: "AddressStringToBytes" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputsign/cosmos/authz/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputsign/cosmos/authz/v1beta1/query.rpc.func.ts new file mode 100644 index 0000000000..1088892b72 --- /dev/null +++ b/__fixtures__/v-next/outputsign/cosmos/authz/v1beta1/query.rpc.func.ts @@ -0,0 +1,44 @@ +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; +import { Grant, GrantSDKType, GrantAuthorization, GrantAuthorizationSDKType } from "./authz"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { QueryGrantsRequest, QueryGrantsRequestSDKType, QueryGrantsResponse, QueryGrantsResponseSDKType, QueryGranterGrantsRequest, QueryGranterGrantsRequestSDKType, QueryGranterGrantsResponse, QueryGranterGrantsResponseSDKType, QueryGranteeGrantsRequest, QueryGranteeGrantsRequestSDKType, QueryGranteeGrantsResponse, QueryGranteeGrantsResponseSDKType } from "./query"; +/** + * Returns list of `Authorization`, granted to the grantee by the granter. + * @name getGrants + * @package cosmos.authz.v1beta1 + * @see proto service: cosmos.authz.v1beta1.Grants + */ +export const getGrants = buildQuery({ + encode: QueryGrantsRequest.encode, + decode: QueryGrantsResponse.decode, + service: "cosmos.authz.v1beta1.Query", + method: "Grants" +}); +/** + * GranterGrants returns list of `GrantAuthorization`, granted by granter. + * + * Since: cosmos-sdk 0.46 + * @name getGranterGrants + * @package cosmos.authz.v1beta1 + * @see proto service: cosmos.authz.v1beta1.GranterGrants + */ +export const getGranterGrants = buildQuery({ + encode: QueryGranterGrantsRequest.encode, + decode: QueryGranterGrantsResponse.decode, + service: "cosmos.authz.v1beta1.Query", + method: "GranterGrants" +}); +/** + * GranteeGrants returns a list of `GrantAuthorization` by grantee. + * + * Since: cosmos-sdk 0.46 + * @name getGranteeGrants + * @package cosmos.authz.v1beta1 + * @see proto service: cosmos.authz.v1beta1.GranteeGrants + */ +export const getGranteeGrants = buildQuery({ + encode: QueryGranteeGrantsRequest.encode, + decode: QueryGranteeGrantsResponse.decode, + service: "cosmos.authz.v1beta1.Query", + method: "GranteeGrants" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputsign/cosmos/authz/v1beta1/tx.rpc.func.ts b/__fixtures__/v-next/outputsign/cosmos/authz/v1beta1/tx.rpc.func.ts new file mode 100644 index 0000000000..c4ddbc1be9 --- /dev/null +++ b/__fixtures__/v-next/outputsign/cosmos/authz/v1beta1/tx.rpc.func.ts @@ -0,0 +1,37 @@ +import { Grant, GrantSDKType } from "./authz"; +import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../google/protobuf/any"; +import { buildTx } from "../../../helper-func-types"; +import { MsgGrant, MsgGrantSDKType, MsgGrantResponse, MsgGrantResponseSDKType, MsgExec, MsgExecSDKType, MsgExecResponse, MsgExecResponseSDKType, MsgRevoke, MsgRevokeSDKType, MsgRevokeResponse, MsgRevokeResponseSDKType } from "./tx"; +/** + * Grant grants the provided authorization to the grantee on the granter's + * account with the provided expiration time. If there is already a grant + * for the given (granter, grantee, Authorization) triple, then the grant + * will be overwritten. + * @name grant + * @package cosmos.authz.v1beta1 + * @see proto service: cosmos.authz.v1beta1.Grant + */ +export const grant = buildTx({ + msg: MsgGrant +}); +/** + * Exec attempts to execute the provided messages using + * authorizations granted to the grantee. Each message should have only + * one signer corresponding to the granter of the authorization. + * @name exec + * @package cosmos.authz.v1beta1 + * @see proto service: cosmos.authz.v1beta1.Exec + */ +export const exec = buildTx({ + msg: MsgExec +}); +/** + * Revoke revokes any authorization corresponding to the provided method name on the + * granter's account that has been granted to the grantee. + * @name revoke + * @package cosmos.authz.v1beta1 + * @see proto service: cosmos.authz.v1beta1.Revoke + */ +export const revoke = buildTx({ + msg: MsgRevoke +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputsign/cosmos/bank/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputsign/cosmos/bank/v1beta1/query.rpc.func.ts new file mode 100644 index 0000000000..82263d9de8 --- /dev/null +++ b/__fixtures__/v-next/outputsign/cosmos/bank/v1beta1/query.rpc.func.ts @@ -0,0 +1,116 @@ +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; +import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; +import { Params, ParamsSDKType, Metadata, MetadataSDKType } from "./bank"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { QueryBalanceRequest, QueryBalanceRequestSDKType, QueryBalanceResponse, QueryBalanceResponseSDKType, QueryAllBalancesRequest, QueryAllBalancesRequestSDKType, QueryAllBalancesResponse, QueryAllBalancesResponseSDKType, QuerySpendableBalancesRequest, QuerySpendableBalancesRequestSDKType, QuerySpendableBalancesResponse, QuerySpendableBalancesResponseSDKType, QueryTotalSupplyRequest, QueryTotalSupplyRequestSDKType, QueryTotalSupplyResponse, QueryTotalSupplyResponseSDKType, QuerySupplyOfRequest, QuerySupplyOfRequestSDKType, QuerySupplyOfResponse, QuerySupplyOfResponseSDKType, QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, QueryDenomMetadataRequest, QueryDenomMetadataRequestSDKType, QueryDenomMetadataResponse, QueryDenomMetadataResponseSDKType, QueryDenomsMetadataRequest, QueryDenomsMetadataRequestSDKType, QueryDenomsMetadataResponse, QueryDenomsMetadataResponseSDKType, QueryDenomOwnersRequest, QueryDenomOwnersRequestSDKType, QueryDenomOwnersResponse, QueryDenomOwnersResponseSDKType } from "./query"; +/** + * Balance queries the balance of a single coin for a single account. + * @name getBalance + * @package cosmos.bank.v1beta1 + * @see proto service: cosmos.bank.v1beta1.Balance + */ +export const getBalance = buildQuery({ + encode: QueryBalanceRequest.encode, + decode: QueryBalanceResponse.decode, + service: "cosmos.bank.v1beta1.Query", + method: "Balance" +}); +/** + * AllBalances queries the balance of all coins for a single account. + * @name getAllBalances + * @package cosmos.bank.v1beta1 + * @see proto service: cosmos.bank.v1beta1.AllBalances + */ +export const getAllBalances = buildQuery({ + encode: QueryAllBalancesRequest.encode, + decode: QueryAllBalancesResponse.decode, + service: "cosmos.bank.v1beta1.Query", + method: "AllBalances" +}); +/** + * SpendableBalances queries the spenable balance of all coins for a single + * account. + * @name getSpendableBalances + * @package cosmos.bank.v1beta1 + * @see proto service: cosmos.bank.v1beta1.SpendableBalances + */ +export const getSpendableBalances = buildQuery({ + encode: QuerySpendableBalancesRequest.encode, + decode: QuerySpendableBalancesResponse.decode, + service: "cosmos.bank.v1beta1.Query", + method: "SpendableBalances" +}); +/** + * TotalSupply queries the total supply of all coins. + * @name getTotalSupply + * @package cosmos.bank.v1beta1 + * @see proto service: cosmos.bank.v1beta1.TotalSupply + */ +export const getTotalSupply = buildQuery({ + encode: QueryTotalSupplyRequest.encode, + decode: QueryTotalSupplyResponse.decode, + service: "cosmos.bank.v1beta1.Query", + method: "TotalSupply" +}); +/** + * SupplyOf queries the supply of a single coin. + * @name getSupplyOf + * @package cosmos.bank.v1beta1 + * @see proto service: cosmos.bank.v1beta1.SupplyOf + */ +export const getSupplyOf = buildQuery({ + encode: QuerySupplyOfRequest.encode, + decode: QuerySupplyOfResponse.decode, + service: "cosmos.bank.v1beta1.Query", + method: "SupplyOf" +}); +/** + * Params queries the parameters of x/bank module. + * @name getParams + * @package cosmos.bank.v1beta1 + * @see proto service: cosmos.bank.v1beta1.Params + */ +export const getParams = buildQuery({ + encode: QueryParamsRequest.encode, + decode: QueryParamsResponse.decode, + service: "cosmos.bank.v1beta1.Query", + method: "Params" +}); +/** + * DenomsMetadata queries the client metadata of a given coin denomination. + * @name getDenomMetadata + * @package cosmos.bank.v1beta1 + * @see proto service: cosmos.bank.v1beta1.DenomMetadata + */ +export const getDenomMetadata = buildQuery({ + encode: QueryDenomMetadataRequest.encode, + decode: QueryDenomMetadataResponse.decode, + service: "cosmos.bank.v1beta1.Query", + method: "DenomMetadata" +}); +/** + * DenomsMetadata queries the client metadata for all registered coin + * denominations. + * @name getDenomsMetadata + * @package cosmos.bank.v1beta1 + * @see proto service: cosmos.bank.v1beta1.DenomsMetadata + */ +export const getDenomsMetadata = buildQuery({ + encode: QueryDenomsMetadataRequest.encode, + decode: QueryDenomsMetadataResponse.decode, + service: "cosmos.bank.v1beta1.Query", + method: "DenomsMetadata" +}); +/** + * DenomOwners queries for all account addresses that own a particular token + * denomination. + * @name getDenomOwners + * @package cosmos.bank.v1beta1 + * @see proto service: cosmos.bank.v1beta1.DenomOwners + */ +export const getDenomOwners = buildQuery({ + encode: QueryDenomOwnersRequest.encode, + decode: QueryDenomOwnersResponse.decode, + service: "cosmos.bank.v1beta1.Query", + method: "DenomOwners" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputsign/cosmos/bank/v1beta1/tx.rpc.func.ts b/__fixtures__/v-next/outputsign/cosmos/bank/v1beta1/tx.rpc.func.ts new file mode 100644 index 0000000000..3c274e156d --- /dev/null +++ b/__fixtures__/v-next/outputsign/cosmos/bank/v1beta1/tx.rpc.func.ts @@ -0,0 +1,22 @@ +import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; +import { Input, InputSDKType, Output, OutputSDKType } from "./bank"; +import { buildTx } from "../../../helper-func-types"; +import { MsgSend, MsgSendSDKType, MsgSendResponse, MsgSendResponseSDKType, MsgMultiSend, MsgMultiSendSDKType, MsgMultiSendResponse, MsgMultiSendResponseSDKType } from "./tx"; +/** + * Send defines a method for sending coins from one account to another account. + * @name send + * @package cosmos.bank.v1beta1 + * @see proto service: cosmos.bank.v1beta1.Send + */ +export const send = buildTx({ + msg: MsgSend +}); +/** + * MultiSend defines a method for sending coins from some accounts to other accounts. + * @name multiSend + * @package cosmos.bank.v1beta1 + * @see proto service: cosmos.bank.v1beta1.MultiSend + */ +export const multiSend = buildTx({ + msg: MsgMultiSend +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputsign/cosmos/base/reflection/v1beta1/reflection.rpc.func.ts b/__fixtures__/v-next/outputsign/cosmos/base/reflection/v1beta1/reflection.rpc.func.ts new file mode 100644 index 0000000000..457419f04b --- /dev/null +++ b/__fixtures__/v-next/outputsign/cosmos/base/reflection/v1beta1/reflection.rpc.func.ts @@ -0,0 +1,28 @@ +import { EndpointOrRpc, buildQuery } from "../../../../helper-func-types"; +import { ListAllInterfacesRequest, ListAllInterfacesRequestSDKType, ListAllInterfacesResponse, ListAllInterfacesResponseSDKType, ListImplementationsRequest, ListImplementationsRequestSDKType, ListImplementationsResponse, ListImplementationsResponseSDKType } from "./reflection"; +/** + * ListAllInterfaces lists all the interfaces registered in the interface + * registry. + * @name getListAllInterfaces + * @package cosmos.base.reflection.v1beta1 + * @see proto service: cosmos.base.reflection.v1beta1.ListAllInterfaces + */ +export const getListAllInterfaces = buildQuery({ + encode: ListAllInterfacesRequest.encode, + decode: ListAllInterfacesResponse.decode, + service: "cosmos.base.reflection.v1beta1.ReflectionService", + method: "ListAllInterfaces" +}); +/** + * ListImplementations list all the concrete types that implement a given + * interface. + * @name getListImplementations + * @package cosmos.base.reflection.v1beta1 + * @see proto service: cosmos.base.reflection.v1beta1.ListImplementations + */ +export const getListImplementations = buildQuery({ + encode: ListImplementationsRequest.encode, + decode: ListImplementationsResponse.decode, + service: "cosmos.base.reflection.v1beta1.ReflectionService", + method: "ListImplementations" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputsign/cosmos/base/reflection/v2alpha1/reflection.rpc.func.ts b/__fixtures__/v-next/outputsign/cosmos/base/reflection/v2alpha1/reflection.rpc.func.ts new file mode 100644 index 0000000000..98ce9c04a0 --- /dev/null +++ b/__fixtures__/v-next/outputsign/cosmos/base/reflection/v2alpha1/reflection.rpc.func.ts @@ -0,0 +1,76 @@ +import { EndpointOrRpc, buildQuery } from "../../../../helper-func-types"; +import { GetAuthnDescriptorRequest, GetAuthnDescriptorRequestSDKType, GetAuthnDescriptorResponse, GetAuthnDescriptorResponseSDKType, GetChainDescriptorRequest, GetChainDescriptorRequestSDKType, GetChainDescriptorResponse, GetChainDescriptorResponseSDKType, GetCodecDescriptorRequest, GetCodecDescriptorRequestSDKType, GetCodecDescriptorResponse, GetCodecDescriptorResponseSDKType, GetConfigurationDescriptorRequest, GetConfigurationDescriptorRequestSDKType, GetConfigurationDescriptorResponse, GetConfigurationDescriptorResponseSDKType, GetQueryServicesDescriptorRequest, GetQueryServicesDescriptorRequestSDKType, GetQueryServicesDescriptorResponse, GetQueryServicesDescriptorResponseSDKType, GetTxDescriptorRequest, GetTxDescriptorRequestSDKType, GetTxDescriptorResponse, GetTxDescriptorResponseSDKType } from "./reflection"; +/** + * GetAuthnDescriptor returns information on how to authenticate transactions in the application + * NOTE: this RPC is still experimental and might be subject to breaking changes or removal in + * future releases of the cosmos-sdk. + * @name getGetAuthnDescriptor + * @package cosmos.base.reflection.v2alpha1 + * @see proto service: cosmos.base.reflection.v2alpha1.GetAuthnDescriptor + */ +export const getGetAuthnDescriptor = buildQuery({ + encode: GetAuthnDescriptorRequest.encode, + decode: GetAuthnDescriptorResponse.decode, + service: "cosmos.base.reflection.v2alpha1.ReflectionService", + method: "GetAuthnDescriptor" +}); +/** + * GetChainDescriptor returns the description of the chain + * @name getGetChainDescriptor + * @package cosmos.base.reflection.v2alpha1 + * @see proto service: cosmos.base.reflection.v2alpha1.GetChainDescriptor + */ +export const getGetChainDescriptor = buildQuery({ + encode: GetChainDescriptorRequest.encode, + decode: GetChainDescriptorResponse.decode, + service: "cosmos.base.reflection.v2alpha1.ReflectionService", + method: "GetChainDescriptor" +}); +/** + * GetCodecDescriptor returns the descriptor of the codec of the application + * @name getGetCodecDescriptor + * @package cosmos.base.reflection.v2alpha1 + * @see proto service: cosmos.base.reflection.v2alpha1.GetCodecDescriptor + */ +export const getGetCodecDescriptor = buildQuery({ + encode: GetCodecDescriptorRequest.encode, + decode: GetCodecDescriptorResponse.decode, + service: "cosmos.base.reflection.v2alpha1.ReflectionService", + method: "GetCodecDescriptor" +}); +/** + * GetConfigurationDescriptor returns the descriptor for the sdk.Config of the application + * @name getGetConfigurationDescriptor + * @package cosmos.base.reflection.v2alpha1 + * @see proto service: cosmos.base.reflection.v2alpha1.GetConfigurationDescriptor + */ +export const getGetConfigurationDescriptor = buildQuery({ + encode: GetConfigurationDescriptorRequest.encode, + decode: GetConfigurationDescriptorResponse.decode, + service: "cosmos.base.reflection.v2alpha1.ReflectionService", + method: "GetConfigurationDescriptor" +}); +/** + * GetQueryServicesDescriptor returns the available gRPC queryable services of the application + * @name getGetQueryServicesDescriptor + * @package cosmos.base.reflection.v2alpha1 + * @see proto service: cosmos.base.reflection.v2alpha1.GetQueryServicesDescriptor + */ +export const getGetQueryServicesDescriptor = buildQuery({ + encode: GetQueryServicesDescriptorRequest.encode, + decode: GetQueryServicesDescriptorResponse.decode, + service: "cosmos.base.reflection.v2alpha1.ReflectionService", + method: "GetQueryServicesDescriptor" +}); +/** + * GetTxDescriptor returns information on the used transaction object and available msgs that can be used + * @name getGetTxDescriptor + * @package cosmos.base.reflection.v2alpha1 + * @see proto service: cosmos.base.reflection.v2alpha1.GetTxDescriptor + */ +export const getGetTxDescriptor = buildQuery({ + encode: GetTxDescriptorRequest.encode, + decode: GetTxDescriptorResponse.decode, + service: "cosmos.base.reflection.v2alpha1.ReflectionService", + method: "GetTxDescriptor" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputsign/cosmos/base/tendermint/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputsign/cosmos/base/tendermint/v1beta1/query.rpc.func.ts new file mode 100644 index 0000000000..11a4a15dea --- /dev/null +++ b/__fixtures__/v-next/outputsign/cosmos/base/tendermint/v1beta1/query.rpc.func.ts @@ -0,0 +1,79 @@ +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../query/v1beta1/pagination"; +import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../../google/protobuf/any"; +import { BlockID, BlockIDSDKType } from "../../../../tendermint/types/types"; +import { Block, BlockSDKType } from "../../../../tendermint/types/block"; +import { NodeInfo, NodeInfoSDKType } from "../../../../tendermint/p2p/types"; +import { EndpointOrRpc, buildQuery } from "../../../../helper-func-types"; +import { GetNodeInfoRequest, GetNodeInfoRequestSDKType, GetNodeInfoResponse, GetNodeInfoResponseSDKType, GetSyncingRequest, GetSyncingRequestSDKType, GetSyncingResponse, GetSyncingResponseSDKType, GetLatestBlockRequest, GetLatestBlockRequestSDKType, GetLatestBlockResponse, GetLatestBlockResponseSDKType, GetBlockByHeightRequest, GetBlockByHeightRequestSDKType, GetBlockByHeightResponse, GetBlockByHeightResponseSDKType, GetLatestValidatorSetRequest, GetLatestValidatorSetRequestSDKType, GetLatestValidatorSetResponse, GetLatestValidatorSetResponseSDKType, GetValidatorSetByHeightRequest, GetValidatorSetByHeightRequestSDKType, GetValidatorSetByHeightResponse, GetValidatorSetByHeightResponseSDKType } from "./query"; +/** + * GetNodeInfo queries the current node info. + * @name getGetNodeInfo + * @package cosmos.base.tendermint.v1beta1 + * @see proto service: cosmos.base.tendermint.v1beta1.GetNodeInfo + */ +export const getGetNodeInfo = buildQuery({ + encode: GetNodeInfoRequest.encode, + decode: GetNodeInfoResponse.decode, + service: "cosmos.base.tendermint.v1beta1.Service", + method: "GetNodeInfo" +}); +/** + * GetSyncing queries node syncing. + * @name getGetSyncing + * @package cosmos.base.tendermint.v1beta1 + * @see proto service: cosmos.base.tendermint.v1beta1.GetSyncing + */ +export const getGetSyncing = buildQuery({ + encode: GetSyncingRequest.encode, + decode: GetSyncingResponse.decode, + service: "cosmos.base.tendermint.v1beta1.Service", + method: "GetSyncing" +}); +/** + * GetLatestBlock returns the latest block. + * @name getGetLatestBlock + * @package cosmos.base.tendermint.v1beta1 + * @see proto service: cosmos.base.tendermint.v1beta1.GetLatestBlock + */ +export const getGetLatestBlock = buildQuery({ + encode: GetLatestBlockRequest.encode, + decode: GetLatestBlockResponse.decode, + service: "cosmos.base.tendermint.v1beta1.Service", + method: "GetLatestBlock" +}); +/** + * GetBlockByHeight queries block for given height. + * @name getGetBlockByHeight + * @package cosmos.base.tendermint.v1beta1 + * @see proto service: cosmos.base.tendermint.v1beta1.GetBlockByHeight + */ +export const getGetBlockByHeight = buildQuery({ + encode: GetBlockByHeightRequest.encode, + decode: GetBlockByHeightResponse.decode, + service: "cosmos.base.tendermint.v1beta1.Service", + method: "GetBlockByHeight" +}); +/** + * GetLatestValidatorSet queries latest validator-set. + * @name getGetLatestValidatorSet + * @package cosmos.base.tendermint.v1beta1 + * @see proto service: cosmos.base.tendermint.v1beta1.GetLatestValidatorSet + */ +export const getGetLatestValidatorSet = buildQuery({ + encode: GetLatestValidatorSetRequest.encode, + decode: GetLatestValidatorSetResponse.decode, + service: "cosmos.base.tendermint.v1beta1.Service", + method: "GetLatestValidatorSet" +}); +/** + * GetValidatorSetByHeight queries validator-set at a given height. + * @name getGetValidatorSetByHeight + * @package cosmos.base.tendermint.v1beta1 + * @see proto service: cosmos.base.tendermint.v1beta1.GetValidatorSetByHeight + */ +export const getGetValidatorSetByHeight = buildQuery({ + encode: GetValidatorSetByHeightRequest.encode, + decode: GetValidatorSetByHeightResponse.decode, + service: "cosmos.base.tendermint.v1beta1.Service", + method: "GetValidatorSetByHeight" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputsign/cosmos/base/v1beta1/coin.ts b/__fixtures__/v-next/outputsign/cosmos/base/v1beta1/coin.ts index 7171deb4be..ac005ae395 100644 --- a/__fixtures__/v-next/outputsign/cosmos/base/v1beta1/coin.ts +++ b/__fixtures__/v-next/outputsign/cosmos/base/v1beta1/coin.ts @@ -1,6 +1,6 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; import { DeepPartial } from "../../../helpers"; -import { Decimal } from "@cosmjs/math"; +import { Decimal } from "@interchainjs/math"; export const protobufPackage = "cosmos.base.v1beta1"; /** * Coin defines a token with a denomination and an amount. @@ -321,7 +321,7 @@ export const DecCoin = { toAmino(message: DecCoin): DecCoinAmino { const obj: any = {}; obj.denom = message.denom === "" ? undefined : message.denom; - obj.amount = message.amount === "" ? undefined : message.amount; + obj.amount = message.amount === "" ? undefined : Decimal.fromUserInput(message.amount, 18).atomics; return obj; }, fromAminoMsg(object: DecCoinAminoMsg): DecCoin { @@ -471,7 +471,7 @@ export const DecProto = { }, toAmino(message: DecProto): DecProtoAmino { const obj: any = {}; - obj.dec = message.dec === "" ? undefined : message.dec; + obj.dec = message.dec === "" ? undefined : Decimal.fromUserInput(message.dec, 18).atomics; return obj; }, fromAminoMsg(object: DecProtoAminoMsg): DecProto { diff --git a/__fixtures__/v-next/outputsign/cosmos/bundle.ts b/__fixtures__/v-next/outputsign/cosmos/bundle.ts index 43fd69eb5c..da6ada7a28 100644 --- a/__fixtures__/v-next/outputsign/cosmos/bundle.ts +++ b/__fixtures__/v-next/outputsign/cosmos/bundle.ts @@ -90,99 +90,134 @@ import * as _143 from "./upgrade/v1beta1/tx"; import * as _144 from "./upgrade/v1beta1/upgrade"; import * as _145 from "./vesting/v1beta1/tx"; import * as _146 from "./vesting/v1beta1/vesting"; -import * as _353 from "./authz/v1beta1/tx.amino"; -import * as _354 from "./bank/v1beta1/tx.amino"; -import * as _355 from "./crisis/v1beta1/tx.amino"; -import * as _356 from "./distribution/v1beta1/tx.amino"; -import * as _357 from "./evidence/v1beta1/tx.amino"; -import * as _358 from "./feegrant/v1beta1/tx.amino"; -import * as _359 from "./gov/v1/tx.amino"; -import * as _360 from "./gov/v1beta1/tx.amino"; -import * as _361 from "./group/v1/tx.amino"; -import * as _362 from "./nft/v1beta1/tx.amino"; -import * as _363 from "./slashing/v1beta1/tx.amino"; -import * as _364 from "./staking/v1beta1/tx.amino"; -import * as _365 from "./upgrade/v1beta1/tx.amino"; -import * as _366 from "./vesting/v1beta1/tx.amino"; -import * as _367 from "./authz/v1beta1/tx.registry"; -import * as _368 from "./bank/v1beta1/tx.registry"; -import * as _369 from "./crisis/v1beta1/tx.registry"; -import * as _370 from "./distribution/v1beta1/tx.registry"; -import * as _371 from "./evidence/v1beta1/tx.registry"; -import * as _372 from "./feegrant/v1beta1/tx.registry"; -import * as _373 from "./gov/v1/tx.registry"; -import * as _374 from "./gov/v1beta1/tx.registry"; -import * as _375 from "./group/v1/tx.registry"; -import * as _376 from "./nft/v1beta1/tx.registry"; -import * as _377 from "./slashing/v1beta1/tx.registry"; -import * as _378 from "./staking/v1beta1/tx.registry"; -import * as _379 from "./upgrade/v1beta1/tx.registry"; -import * as _380 from "./vesting/v1beta1/tx.registry"; -import * as _381 from "./auth/v1beta1/query.lcd"; -import * as _382 from "./authz/v1beta1/query.lcd"; -import * as _383 from "./bank/v1beta1/query.lcd"; -import * as _384 from "./base/reflection/v1beta1/reflection.lcd"; -import * as _385 from "./base/reflection/v2alpha1/reflection.lcd"; -import * as _386 from "./base/tendermint/v1beta1/query.lcd"; -import * as _387 from "./distribution/v1beta1/query.lcd"; -import * as _388 from "./evidence/v1beta1/query.lcd"; -import * as _389 from "./feegrant/v1beta1/query.lcd"; -import * as _390 from "./gov/v1/query.lcd"; -import * as _391 from "./gov/v1beta1/query.lcd"; -import * as _392 from "./group/v1/query.lcd"; -import * as _393 from "./mint/v1beta1/query.lcd"; -import * as _394 from "./nft/v1beta1/query.lcd"; -import * as _395 from "./params/v1beta1/query.lcd"; -import * as _396 from "./slashing/v1beta1/query.lcd"; -import * as _397 from "./staking/v1beta1/query.lcd"; -import * as _398 from "./tx/v1beta1/service.lcd"; -import * as _399 from "./upgrade/v1beta1/query.lcd"; -import * as _400 from "./app/v1alpha1/query.rpc.Query"; -import * as _401 from "./auth/v1beta1/query.rpc.Query"; -import * as _402 from "./authz/v1beta1/query.rpc.Query"; -import * as _403 from "./bank/v1beta1/query.rpc.Query"; -import * as _404 from "./base/reflection/v1beta1/reflection.rpc.ReflectionService"; -import * as _405 from "./base/reflection/v2alpha1/reflection.rpc.ReflectionService"; -import * as _406 from "./base/tendermint/v1beta1/query.rpc.Service"; -import * as _407 from "./distribution/v1beta1/query.rpc.Query"; -import * as _408 from "./evidence/v1beta1/query.rpc.Query"; -import * as _409 from "./feegrant/v1beta1/query.rpc.Query"; -import * as _410 from "./gov/v1/query.rpc.Query"; -import * as _411 from "./gov/v1beta1/query.rpc.Query"; -import * as _412 from "./group/v1/query.rpc.Query"; -import * as _413 from "./mint/v1beta1/query.rpc.Query"; -import * as _414 from "./nft/v1beta1/query.rpc.Query"; -import * as _415 from "./params/v1beta1/query.rpc.Query"; -import * as _416 from "./slashing/v1beta1/query.rpc.Query"; -import * as _417 from "./staking/v1beta1/query.rpc.Query"; -import * as _418 from "./tx/v1beta1/service.rpc.Service"; -import * as _419 from "./upgrade/v1beta1/query.rpc.Query"; -import * as _420 from "./authz/v1beta1/tx.rpc.msg"; -import * as _421 from "./bank/v1beta1/tx.rpc.msg"; -import * as _422 from "./crisis/v1beta1/tx.rpc.msg"; -import * as _423 from "./distribution/v1beta1/tx.rpc.msg"; -import * as _424 from "./evidence/v1beta1/tx.rpc.msg"; -import * as _425 from "./feegrant/v1beta1/tx.rpc.msg"; -import * as _426 from "./gov/v1/tx.rpc.msg"; -import * as _427 from "./gov/v1beta1/tx.rpc.msg"; -import * as _428 from "./group/v1/tx.rpc.msg"; -import * as _429 from "./nft/v1beta1/tx.rpc.msg"; -import * as _430 from "./slashing/v1beta1/tx.rpc.msg"; -import * as _431 from "./staking/v1beta1/tx.rpc.msg"; -import * as _432 from "./upgrade/v1beta1/tx.rpc.msg"; -import * as _433 from "./vesting/v1beta1/tx.rpc.msg"; -import * as _539 from "./lcd"; -import * as _540 from "./rpc.query"; -import * as _541 from "./cosmos-rpc-client.query"; -import * as _542 from "./rpc.tx"; -import * as _543 from "./cosmos-rpc-client.tx"; +import * as _369 from "./authz/v1beta1/tx.amino"; +import * as _370 from "./bank/v1beta1/tx.amino"; +import * as _371 from "./crisis/v1beta1/tx.amino"; +import * as _372 from "./distribution/v1beta1/tx.amino"; +import * as _373 from "./evidence/v1beta1/tx.amino"; +import * as _374 from "./feegrant/v1beta1/tx.amino"; +import * as _375 from "./gov/v1/tx.amino"; +import * as _376 from "./gov/v1beta1/tx.amino"; +import * as _377 from "./group/v1/tx.amino"; +import * as _378 from "./nft/v1beta1/tx.amino"; +import * as _379 from "./slashing/v1beta1/tx.amino"; +import * as _380 from "./staking/v1beta1/tx.amino"; +import * as _381 from "./upgrade/v1beta1/tx.amino"; +import * as _382 from "./vesting/v1beta1/tx.amino"; +import * as _383 from "./authz/v1beta1/tx.registry"; +import * as _384 from "./bank/v1beta1/tx.registry"; +import * as _385 from "./crisis/v1beta1/tx.registry"; +import * as _386 from "./distribution/v1beta1/tx.registry"; +import * as _387 from "./evidence/v1beta1/tx.registry"; +import * as _388 from "./feegrant/v1beta1/tx.registry"; +import * as _389 from "./gov/v1/tx.registry"; +import * as _390 from "./gov/v1beta1/tx.registry"; +import * as _391 from "./group/v1/tx.registry"; +import * as _392 from "./nft/v1beta1/tx.registry"; +import * as _393 from "./slashing/v1beta1/tx.registry"; +import * as _394 from "./staking/v1beta1/tx.registry"; +import * as _395 from "./upgrade/v1beta1/tx.registry"; +import * as _396 from "./vesting/v1beta1/tx.registry"; +import * as _397 from "./auth/v1beta1/query.lcd"; +import * as _398 from "./authz/v1beta1/query.lcd"; +import * as _399 from "./bank/v1beta1/query.lcd"; +import * as _400 from "./base/reflection/v1beta1/reflection.lcd"; +import * as _401 from "./base/reflection/v2alpha1/reflection.lcd"; +import * as _402 from "./base/tendermint/v1beta1/query.lcd"; +import * as _403 from "./distribution/v1beta1/query.lcd"; +import * as _404 from "./evidence/v1beta1/query.lcd"; +import * as _405 from "./feegrant/v1beta1/query.lcd"; +import * as _406 from "./gov/v1/query.lcd"; +import * as _407 from "./gov/v1beta1/query.lcd"; +import * as _408 from "./group/v1/query.lcd"; +import * as _409 from "./mint/v1beta1/query.lcd"; +import * as _410 from "./nft/v1beta1/query.lcd"; +import * as _411 from "./params/v1beta1/query.lcd"; +import * as _412 from "./slashing/v1beta1/query.lcd"; +import * as _413 from "./staking/v1beta1/query.lcd"; +import * as _414 from "./tx/v1beta1/service.lcd"; +import * as _415 from "./upgrade/v1beta1/query.lcd"; +import * as _416 from "./app/v1alpha1/query.rpc.func"; +import * as _417 from "./auth/v1beta1/query.rpc.func"; +import * as _418 from "./authz/v1beta1/query.rpc.func"; +import * as _419 from "./bank/v1beta1/query.rpc.func"; +import * as _420 from "./base/reflection/v1beta1/reflection.rpc.func"; +import * as _421 from "./base/reflection/v2alpha1/reflection.rpc.func"; +import * as _422 from "./base/tendermint/v1beta1/query.rpc.func"; +import * as _423 from "./distribution/v1beta1/query.rpc.func"; +import * as _424 from "./evidence/v1beta1/query.rpc.func"; +import * as _425 from "./feegrant/v1beta1/query.rpc.func"; +import * as _426 from "./gov/v1/query.rpc.func"; +import * as _427 from "./gov/v1beta1/query.rpc.func"; +import * as _428 from "./group/v1/query.rpc.func"; +import * as _429 from "./mint/v1beta1/query.rpc.func"; +import * as _430 from "./nft/v1beta1/query.rpc.func"; +import * as _431 from "./params/v1beta1/query.rpc.func"; +import * as _432 from "./slashing/v1beta1/query.rpc.func"; +import * as _433 from "./staking/v1beta1/query.rpc.func"; +import * as _434 from "./tx/v1beta1/service.rpc.func"; +import * as _435 from "./upgrade/v1beta1/query.rpc.func"; +import * as _436 from "./app/v1alpha1/query.rpc.Query"; +import * as _437 from "./auth/v1beta1/query.rpc.Query"; +import * as _438 from "./authz/v1beta1/query.rpc.Query"; +import * as _439 from "./bank/v1beta1/query.rpc.Query"; +import * as _440 from "./base/reflection/v1beta1/reflection.rpc.ReflectionService"; +import * as _441 from "./base/reflection/v2alpha1/reflection.rpc.ReflectionService"; +import * as _442 from "./base/tendermint/v1beta1/query.rpc.Service"; +import * as _443 from "./distribution/v1beta1/query.rpc.Query"; +import * as _444 from "./evidence/v1beta1/query.rpc.Query"; +import * as _445 from "./feegrant/v1beta1/query.rpc.Query"; +import * as _446 from "./gov/v1/query.rpc.Query"; +import * as _447 from "./gov/v1beta1/query.rpc.Query"; +import * as _448 from "./group/v1/query.rpc.Query"; +import * as _449 from "./mint/v1beta1/query.rpc.Query"; +import * as _450 from "./nft/v1beta1/query.rpc.Query"; +import * as _451 from "./params/v1beta1/query.rpc.Query"; +import * as _452 from "./slashing/v1beta1/query.rpc.Query"; +import * as _453 from "./staking/v1beta1/query.rpc.Query"; +import * as _454 from "./tx/v1beta1/service.rpc.Service"; +import * as _455 from "./upgrade/v1beta1/query.rpc.Query"; +import * as _456 from "./authz/v1beta1/tx.rpc.func"; +import * as _457 from "./bank/v1beta1/tx.rpc.func"; +import * as _458 from "./crisis/v1beta1/tx.rpc.func"; +import * as _459 from "./distribution/v1beta1/tx.rpc.func"; +import * as _460 from "./evidence/v1beta1/tx.rpc.func"; +import * as _461 from "./feegrant/v1beta1/tx.rpc.func"; +import * as _462 from "./gov/v1/tx.rpc.func"; +import * as _463 from "./gov/v1beta1/tx.rpc.func"; +import * as _464 from "./group/v1/tx.rpc.func"; +import * as _465 from "./nft/v1beta1/tx.rpc.func"; +import * as _466 from "./slashing/v1beta1/tx.rpc.func"; +import * as _467 from "./staking/v1beta1/tx.rpc.func"; +import * as _468 from "./upgrade/v1beta1/tx.rpc.func"; +import * as _469 from "./vesting/v1beta1/tx.rpc.func"; +import * as _470 from "./authz/v1beta1/tx.rpc.msg"; +import * as _471 from "./bank/v1beta1/tx.rpc.msg"; +import * as _472 from "./crisis/v1beta1/tx.rpc.msg"; +import * as _473 from "./distribution/v1beta1/tx.rpc.msg"; +import * as _474 from "./evidence/v1beta1/tx.rpc.msg"; +import * as _475 from "./feegrant/v1beta1/tx.rpc.msg"; +import * as _476 from "./gov/v1/tx.rpc.msg"; +import * as _477 from "./gov/v1beta1/tx.rpc.msg"; +import * as _478 from "./group/v1/tx.rpc.msg"; +import * as _479 from "./nft/v1beta1/tx.rpc.msg"; +import * as _480 from "./slashing/v1beta1/tx.rpc.msg"; +import * as _481 from "./staking/v1beta1/tx.rpc.msg"; +import * as _482 from "./upgrade/v1beta1/tx.rpc.msg"; +import * as _483 from "./vesting/v1beta1/tx.rpc.msg"; +import * as _632 from "./lcd"; +import * as _633 from "./rpc.query"; +import * as _634 from "./cosmos-rpc-client.query"; +import * as _635 from "./rpc.tx"; +import * as _636 from "./cosmos-rpc-client.tx"; export namespace cosmos { export namespace app { export const v1alpha1 = { ..._55, ..._56, ..._57, - ..._400 + ..._416, + ..._436 }; } export namespace auth { @@ -190,8 +225,9 @@ export namespace cosmos { ..._58, ..._59, ..._60, - ..._381, - ..._401 + ..._397, + ..._417, + ..._437 }; } export namespace authz { @@ -200,11 +236,13 @@ export namespace cosmos { ..._62, ..._63, ..._64, - ..._353, - ..._367, - ..._382, - ..._402, - ..._420 + ..._369, + ..._383, + ..._398, + ..._418, + ..._438, + ..._456, + ..._470 }; } export namespace bank { @@ -214,11 +252,13 @@ export namespace cosmos { ..._67, ..._68, ..._69, - ..._354, - ..._368, - ..._383, - ..._403, - ..._421 + ..._370, + ..._384, + ..._399, + ..._419, + ..._439, + ..._457, + ..._471 }; } export namespace base { @@ -240,13 +280,15 @@ export namespace cosmos { export namespace reflection { export const v1beta1 = { ..._73, - ..._384, - ..._404 + ..._400, + ..._420, + ..._440 }; export const v2alpha1 = { ..._74, - ..._385, - ..._405 + ..._401, + ..._421, + ..._441 }; } export namespace snapshots { @@ -263,8 +305,9 @@ export namespace cosmos { export namespace tendermint { export const v1beta1 = { ..._78, - ..._386, - ..._406 + ..._402, + ..._422, + ..._442 }; } export const v1beta1 = { @@ -281,9 +324,10 @@ export namespace cosmos { export const v1beta1 = { ..._82, ..._83, - ..._355, - ..._369, - ..._422 + ..._371, + ..._385, + ..._458, + ..._472 }; } export namespace crypto { @@ -316,11 +360,13 @@ export namespace cosmos { ..._91, ..._92, ..._93, - ..._356, - ..._370, - ..._387, - ..._407, - ..._423 + ..._372, + ..._386, + ..._403, + ..._423, + ..._443, + ..._459, + ..._473 }; } export namespace evidence { @@ -329,11 +375,13 @@ export namespace cosmos { ..._95, ..._96, ..._97, - ..._357, - ..._371, - ..._388, - ..._408, - ..._424 + ..._373, + ..._387, + ..._404, + ..._424, + ..._444, + ..._460, + ..._474 }; } export namespace feegrant { @@ -342,11 +390,13 @@ export namespace cosmos { ..._99, ..._100, ..._101, - ..._358, - ..._372, - ..._389, - ..._409, - ..._425 + ..._374, + ..._388, + ..._405, + ..._425, + ..._445, + ..._461, + ..._475 }; } export namespace genutil { @@ -360,22 +410,26 @@ export namespace cosmos { ..._104, ..._105, ..._106, - ..._359, - ..._373, - ..._390, - ..._410, - ..._426 + ..._375, + ..._389, + ..._406, + ..._426, + ..._446, + ..._462, + ..._476 }; export const v1beta1 = { ..._107, ..._108, ..._109, ..._110, - ..._360, - ..._374, - ..._391, - ..._411, - ..._427 + ..._376, + ..._390, + ..._407, + ..._427, + ..._447, + ..._463, + ..._477 }; } export namespace group { @@ -385,11 +439,13 @@ export namespace cosmos { ..._113, ..._114, ..._115, - ..._361, - ..._375, - ..._392, - ..._412, - ..._428 + ..._377, + ..._391, + ..._408, + ..._428, + ..._448, + ..._464, + ..._478 }; } export namespace mint { @@ -397,8 +453,9 @@ export namespace cosmos { ..._116, ..._117, ..._118, - ..._393, - ..._413 + ..._409, + ..._429, + ..._449 }; } export namespace msg { @@ -413,11 +470,13 @@ export namespace cosmos { ..._122, ..._123, ..._124, - ..._362, - ..._376, - ..._394, - ..._414, - ..._429 + ..._378, + ..._392, + ..._410, + ..._430, + ..._450, + ..._465, + ..._479 }; } export namespace orm { @@ -437,8 +496,9 @@ export namespace cosmos { export const v1beta1 = { ..._128, ..._129, - ..._395, - ..._415 + ..._411, + ..._431, + ..._451 }; } export namespace slashing { @@ -447,11 +507,13 @@ export namespace cosmos { ..._131, ..._132, ..._133, - ..._363, - ..._377, - ..._396, - ..._416, - ..._430 + ..._379, + ..._393, + ..._412, + ..._432, + ..._452, + ..._466, + ..._480 }; } export namespace staking { @@ -461,11 +523,13 @@ export namespace cosmos { ..._136, ..._137, ..._138, - ..._364, - ..._378, - ..._397, - ..._417, - ..._431 + ..._380, + ..._394, + ..._413, + ..._433, + ..._453, + ..._467, + ..._481 }; } export namespace tx { @@ -477,8 +541,9 @@ export namespace cosmos { export const v1beta1 = { ..._140, ..._141, - ..._398, - ..._418 + ..._414, + ..._434, + ..._454 }; } export namespace upgrade { @@ -486,27 +551,30 @@ export namespace cosmos { ..._142, ..._143, ..._144, - ..._365, - ..._379, - ..._399, - ..._419, - ..._432 + ..._381, + ..._395, + ..._415, + ..._435, + ..._455, + ..._468, + ..._482 }; } export namespace vesting { export const v1beta1 = { ..._145, ..._146, - ..._366, - ..._380, - ..._433 + ..._382, + ..._396, + ..._469, + ..._483 }; } export const ClientFactory = { - ..._539, - ..._540, - ..._541, - ..._542, - ..._543 + ..._632, + ..._633, + ..._634, + ..._635, + ..._636 }; } \ No newline at end of file diff --git a/__fixtures__/v-next/outputsign/cosmos/crisis/v1beta1/tx.rpc.func.ts b/__fixtures__/v-next/outputsign/cosmos/crisis/v1beta1/tx.rpc.func.ts new file mode 100644 index 0000000000..da292c9a67 --- /dev/null +++ b/__fixtures__/v-next/outputsign/cosmos/crisis/v1beta1/tx.rpc.func.ts @@ -0,0 +1,11 @@ +import { buildTx } from "../../../helper-func-types"; +import { MsgVerifyInvariant, MsgVerifyInvariantSDKType, MsgVerifyInvariantResponse, MsgVerifyInvariantResponseSDKType } from "./tx"; +/** + * VerifyInvariant defines a method to verify a particular invariance. + * @name verifyInvariant + * @package cosmos.crisis.v1beta1 + * @see proto service: cosmos.crisis.v1beta1.VerifyInvariant + */ +export const verifyInvariant = buildTx({ + msg: MsgVerifyInvariant +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputsign/cosmos/distribution/v1beta1/distribution.ts b/__fixtures__/v-next/outputsign/cosmos/distribution/v1beta1/distribution.ts index 560d0a8f31..5b85ed3934 100644 --- a/__fixtures__/v-next/outputsign/cosmos/distribution/v1beta1/distribution.ts +++ b/__fixtures__/v-next/outputsign/cosmos/distribution/v1beta1/distribution.ts @@ -1,6 +1,6 @@ import { DecCoin, DecCoinAmino, DecCoinSDKType, Coin, CoinAmino, CoinSDKType } from "../../base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { Decimal } from "@cosmjs/math"; +import { Decimal } from "@interchainjs/math"; import { DeepPartial } from "../../../helpers"; export const protobufPackage = "cosmos.distribution.v1beta1"; /** @@ -635,9 +635,9 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.community_tax = message.communityTax === "" ? undefined : message.communityTax; - obj.base_proposer_reward = message.baseProposerReward === "" ? undefined : message.baseProposerReward; - obj.bonus_proposer_reward = message.bonusProposerReward === "" ? undefined : message.bonusProposerReward; + obj.community_tax = message.communityTax === "" ? undefined : Decimal.fromUserInput(message.communityTax, 18).atomics; + obj.base_proposer_reward = message.baseProposerReward === "" ? undefined : Decimal.fromUserInput(message.baseProposerReward, 18).atomics; + obj.bonus_proposer_reward = message.bonusProposerReward === "" ? undefined : Decimal.fromUserInput(message.bonusProposerReward, 18).atomics; obj.withdraw_addr_enabled = message.withdrawAddrEnabled === false ? undefined : message.withdrawAddrEnabled; return obj; }, @@ -1079,7 +1079,7 @@ export const ValidatorSlashEvent = { toAmino(message: ValidatorSlashEvent): ValidatorSlashEventAmino { const obj: any = {}; obj.validator_period = message.validatorPeriod !== BigInt(0) ? message.validatorPeriod?.toString() : undefined; - obj.fraction = message.fraction === "" ? undefined : message.fraction; + obj.fraction = message.fraction === "" ? undefined : Decimal.fromUserInput(message.fraction, 18).atomics; return obj; }, fromAminoMsg(object: ValidatorSlashEventAminoMsg): ValidatorSlashEvent { @@ -1455,7 +1455,7 @@ export const DelegatorStartingInfo = { toAmino(message: DelegatorStartingInfo): DelegatorStartingInfoAmino { const obj: any = {}; obj.previous_period = message.previousPeriod !== BigInt(0) ? message.previousPeriod?.toString() : undefined; - obj.stake = message.stake === "" ? undefined : message.stake; + obj.stake = message.stake === "" ? undefined : Decimal.fromUserInput(message.stake, 18).atomics; obj.height = message.height ? message.height?.toString() : "0"; return obj; }, diff --git a/__fixtures__/v-next/outputsign/cosmos/distribution/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputsign/cosmos/distribution/v1beta1/query.rpc.func.ts new file mode 100644 index 0000000000..7283b1ff84 --- /dev/null +++ b/__fixtures__/v-next/outputsign/cosmos/distribution/v1beta1/query.rpc.func.ts @@ -0,0 +1,114 @@ +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; +import { Params, ParamsSDKType, ValidatorOutstandingRewards, ValidatorOutstandingRewardsSDKType, ValidatorAccumulatedCommission, ValidatorAccumulatedCommissionSDKType, ValidatorSlashEvent, ValidatorSlashEventSDKType, DelegationDelegatorReward, DelegationDelegatorRewardSDKType } from "./distribution"; +import { DecCoin, DecCoinSDKType } from "../../base/v1beta1/coin"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, QueryValidatorOutstandingRewardsRequest, QueryValidatorOutstandingRewardsRequestSDKType, QueryValidatorOutstandingRewardsResponse, QueryValidatorOutstandingRewardsResponseSDKType, QueryValidatorCommissionRequest, QueryValidatorCommissionRequestSDKType, QueryValidatorCommissionResponse, QueryValidatorCommissionResponseSDKType, QueryValidatorSlashesRequest, QueryValidatorSlashesRequestSDKType, QueryValidatorSlashesResponse, QueryValidatorSlashesResponseSDKType, QueryDelegationRewardsRequest, QueryDelegationRewardsRequestSDKType, QueryDelegationRewardsResponse, QueryDelegationRewardsResponseSDKType, QueryDelegationTotalRewardsRequest, QueryDelegationTotalRewardsRequestSDKType, QueryDelegationTotalRewardsResponse, QueryDelegationTotalRewardsResponseSDKType, QueryDelegatorValidatorsRequest, QueryDelegatorValidatorsRequestSDKType, QueryDelegatorValidatorsResponse, QueryDelegatorValidatorsResponseSDKType, QueryDelegatorWithdrawAddressRequest, QueryDelegatorWithdrawAddressRequestSDKType, QueryDelegatorWithdrawAddressResponse, QueryDelegatorWithdrawAddressResponseSDKType, QueryCommunityPoolRequest, QueryCommunityPoolRequestSDKType, QueryCommunityPoolResponse, QueryCommunityPoolResponseSDKType } from "./query"; +/** + * Params queries params of the distribution module. + * @name getParams + * @package cosmos.distribution.v1beta1 + * @see proto service: cosmos.distribution.v1beta1.Params + */ +export const getParams = buildQuery({ + encode: QueryParamsRequest.encode, + decode: QueryParamsResponse.decode, + service: "cosmos.distribution.v1beta1.Query", + method: "Params" +}); +/** + * ValidatorOutstandingRewards queries rewards of a validator address. + * @name getValidatorOutstandingRewards + * @package cosmos.distribution.v1beta1 + * @see proto service: cosmos.distribution.v1beta1.ValidatorOutstandingRewards + */ +export const getValidatorOutstandingRewards = buildQuery({ + encode: QueryValidatorOutstandingRewardsRequest.encode, + decode: QueryValidatorOutstandingRewardsResponse.decode, + service: "cosmos.distribution.v1beta1.Query", + method: "ValidatorOutstandingRewards" +}); +/** + * ValidatorCommission queries accumulated commission for a validator. + * @name getValidatorCommission + * @package cosmos.distribution.v1beta1 + * @see proto service: cosmos.distribution.v1beta1.ValidatorCommission + */ +export const getValidatorCommission = buildQuery({ + encode: QueryValidatorCommissionRequest.encode, + decode: QueryValidatorCommissionResponse.decode, + service: "cosmos.distribution.v1beta1.Query", + method: "ValidatorCommission" +}); +/** + * ValidatorSlashes queries slash events of a validator. + * @name getValidatorSlashes + * @package cosmos.distribution.v1beta1 + * @see proto service: cosmos.distribution.v1beta1.ValidatorSlashes + */ +export const getValidatorSlashes = buildQuery({ + encode: QueryValidatorSlashesRequest.encode, + decode: QueryValidatorSlashesResponse.decode, + service: "cosmos.distribution.v1beta1.Query", + method: "ValidatorSlashes" +}); +/** + * DelegationRewards queries the total rewards accrued by a delegation. + * @name getDelegationRewards + * @package cosmos.distribution.v1beta1 + * @see proto service: cosmos.distribution.v1beta1.DelegationRewards + */ +export const getDelegationRewards = buildQuery({ + encode: QueryDelegationRewardsRequest.encode, + decode: QueryDelegationRewardsResponse.decode, + service: "cosmos.distribution.v1beta1.Query", + method: "DelegationRewards" +}); +/** + * DelegationTotalRewards queries the total rewards accrued by a each + * validator. + * @name getDelegationTotalRewards + * @package cosmos.distribution.v1beta1 + * @see proto service: cosmos.distribution.v1beta1.DelegationTotalRewards + */ +export const getDelegationTotalRewards = buildQuery({ + encode: QueryDelegationTotalRewardsRequest.encode, + decode: QueryDelegationTotalRewardsResponse.decode, + service: "cosmos.distribution.v1beta1.Query", + method: "DelegationTotalRewards" +}); +/** + * DelegatorValidators queries the validators of a delegator. + * @name getDelegatorValidators + * @package cosmos.distribution.v1beta1 + * @see proto service: cosmos.distribution.v1beta1.DelegatorValidators + */ +export const getDelegatorValidators = buildQuery({ + encode: QueryDelegatorValidatorsRequest.encode, + decode: QueryDelegatorValidatorsResponse.decode, + service: "cosmos.distribution.v1beta1.Query", + method: "DelegatorValidators" +}); +/** + * DelegatorWithdrawAddress queries withdraw address of a delegator. + * @name getDelegatorWithdrawAddress + * @package cosmos.distribution.v1beta1 + * @see proto service: cosmos.distribution.v1beta1.DelegatorWithdrawAddress + */ +export const getDelegatorWithdrawAddress = buildQuery({ + encode: QueryDelegatorWithdrawAddressRequest.encode, + decode: QueryDelegatorWithdrawAddressResponse.decode, + service: "cosmos.distribution.v1beta1.Query", + method: "DelegatorWithdrawAddress" +}); +/** + * CommunityPool queries the community pool coins. + * @name getCommunityPool + * @package cosmos.distribution.v1beta1 + * @see proto service: cosmos.distribution.v1beta1.CommunityPool + */ +export const getCommunityPool = buildQuery({ + encode: QueryCommunityPoolRequest.encode, + decode: QueryCommunityPoolResponse.decode, + service: "cosmos.distribution.v1beta1.Query", + method: "CommunityPool" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputsign/cosmos/distribution/v1beta1/tx.rpc.func.ts b/__fixtures__/v-next/outputsign/cosmos/distribution/v1beta1/tx.rpc.func.ts new file mode 100644 index 0000000000..27ee8a8714 --- /dev/null +++ b/__fixtures__/v-next/outputsign/cosmos/distribution/v1beta1/tx.rpc.func.ts @@ -0,0 +1,43 @@ +import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; +import { buildTx } from "../../../helper-func-types"; +import { MsgSetWithdrawAddress, MsgSetWithdrawAddressSDKType, MsgSetWithdrawAddressResponse, MsgSetWithdrawAddressResponseSDKType, MsgWithdrawDelegatorReward, MsgWithdrawDelegatorRewardSDKType, MsgWithdrawDelegatorRewardResponse, MsgWithdrawDelegatorRewardResponseSDKType, MsgWithdrawValidatorCommission, MsgWithdrawValidatorCommissionSDKType, MsgWithdrawValidatorCommissionResponse, MsgWithdrawValidatorCommissionResponseSDKType, MsgFundCommunityPool, MsgFundCommunityPoolSDKType, MsgFundCommunityPoolResponse, MsgFundCommunityPoolResponseSDKType } from "./tx"; +/** + * SetWithdrawAddress defines a method to change the withdraw address + * for a delegator (or validator self-delegation). + * @name setWithdrawAddress + * @package cosmos.distribution.v1beta1 + * @see proto service: cosmos.distribution.v1beta1.SetWithdrawAddress + */ +export const setWithdrawAddress = buildTx({ + msg: MsgSetWithdrawAddress +}); +/** + * WithdrawDelegatorReward defines a method to withdraw rewards of delegator + * from a single validator. + * @name withdrawDelegatorReward + * @package cosmos.distribution.v1beta1 + * @see proto service: cosmos.distribution.v1beta1.WithdrawDelegatorReward + */ +export const withdrawDelegatorReward = buildTx({ + msg: MsgWithdrawDelegatorReward +}); +/** + * WithdrawValidatorCommission defines a method to withdraw the + * full commission to the validator address. + * @name withdrawValidatorCommission + * @package cosmos.distribution.v1beta1 + * @see proto service: cosmos.distribution.v1beta1.WithdrawValidatorCommission + */ +export const withdrawValidatorCommission = buildTx({ + msg: MsgWithdrawValidatorCommission +}); +/** + * FundCommunityPool defines a method to allow an account to directly + * fund the community pool. + * @name fundCommunityPool + * @package cosmos.distribution.v1beta1 + * @see proto service: cosmos.distribution.v1beta1.FundCommunityPool + */ +export const fundCommunityPool = buildTx({ + msg: MsgFundCommunityPool +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputsign/cosmos/evidence/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputsign/cosmos/evidence/v1beta1/query.rpc.func.ts new file mode 100644 index 0000000000..5e6f6be188 --- /dev/null +++ b/__fixtures__/v-next/outputsign/cosmos/evidence/v1beta1/query.rpc.func.ts @@ -0,0 +1,28 @@ +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; +import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../google/protobuf/any"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { QueryEvidenceRequest, QueryEvidenceRequestSDKType, QueryEvidenceResponse, QueryEvidenceResponseSDKType, QueryAllEvidenceRequest, QueryAllEvidenceRequestSDKType, QueryAllEvidenceResponse, QueryAllEvidenceResponseSDKType } from "./query"; +/** + * Evidence queries evidence based on evidence hash. + * @name getEvidence + * @package cosmos.evidence.v1beta1 + * @see proto service: cosmos.evidence.v1beta1.Evidence + */ +export const getEvidence = buildQuery({ + encode: QueryEvidenceRequest.encode, + decode: QueryEvidenceResponse.decode, + service: "cosmos.evidence.v1beta1.Query", + method: "Evidence" +}); +/** + * AllEvidence queries all evidence. + * @name getAllEvidence + * @package cosmos.evidence.v1beta1 + * @see proto service: cosmos.evidence.v1beta1.AllEvidence + */ +export const getAllEvidence = buildQuery({ + encode: QueryAllEvidenceRequest.encode, + decode: QueryAllEvidenceResponse.decode, + service: "cosmos.evidence.v1beta1.Query", + method: "AllEvidence" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputsign/cosmos/evidence/v1beta1/tx.rpc.func.ts b/__fixtures__/v-next/outputsign/cosmos/evidence/v1beta1/tx.rpc.func.ts new file mode 100644 index 0000000000..8bfbb783fc --- /dev/null +++ b/__fixtures__/v-next/outputsign/cosmos/evidence/v1beta1/tx.rpc.func.ts @@ -0,0 +1,13 @@ +import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../google/protobuf/any"; +import { buildTx } from "../../../helper-func-types"; +import { MsgSubmitEvidence, MsgSubmitEvidenceSDKType, MsgSubmitEvidenceResponse, MsgSubmitEvidenceResponseSDKType } from "./tx"; +/** + * SubmitEvidence submits an arbitrary Evidence of misbehavior such as equivocation or + * counterfactual signing. + * @name submitEvidence + * @package cosmos.evidence.v1beta1 + * @see proto service: cosmos.evidence.v1beta1.SubmitEvidence + */ +export const submitEvidence = buildTx({ + msg: MsgSubmitEvidence +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputsign/cosmos/feegrant/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputsign/cosmos/feegrant/v1beta1/query.rpc.func.ts new file mode 100644 index 0000000000..3f0bea649a --- /dev/null +++ b/__fixtures__/v-next/outputsign/cosmos/feegrant/v1beta1/query.rpc.func.ts @@ -0,0 +1,41 @@ +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; +import { Grant, GrantSDKType } from "./feegrant"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { QueryAllowanceRequest, QueryAllowanceRequestSDKType, QueryAllowanceResponse, QueryAllowanceResponseSDKType, QueryAllowancesRequest, QueryAllowancesRequestSDKType, QueryAllowancesResponse, QueryAllowancesResponseSDKType, QueryAllowancesByGranterRequest, QueryAllowancesByGranterRequestSDKType, QueryAllowancesByGranterResponse, QueryAllowancesByGranterResponseSDKType } from "./query"; +/** + * Allowance returns fee granted to the grantee by the granter. + * @name getAllowance + * @package cosmos.feegrant.v1beta1 + * @see proto service: cosmos.feegrant.v1beta1.Allowance + */ +export const getAllowance = buildQuery({ + encode: QueryAllowanceRequest.encode, + decode: QueryAllowanceResponse.decode, + service: "cosmos.feegrant.v1beta1.Query", + method: "Allowance" +}); +/** + * Allowances returns all the grants for address. + * @name getAllowances + * @package cosmos.feegrant.v1beta1 + * @see proto service: cosmos.feegrant.v1beta1.Allowances + */ +export const getAllowances = buildQuery({ + encode: QueryAllowancesRequest.encode, + decode: QueryAllowancesResponse.decode, + service: "cosmos.feegrant.v1beta1.Query", + method: "Allowances" +}); +/** + * AllowancesByGranter returns all the grants given by an address + * Since v0.46 + * @name getAllowancesByGranter + * @package cosmos.feegrant.v1beta1 + * @see proto service: cosmos.feegrant.v1beta1.AllowancesByGranter + */ +export const getAllowancesByGranter = buildQuery({ + encode: QueryAllowancesByGranterRequest.encode, + decode: QueryAllowancesByGranterResponse.decode, + service: "cosmos.feegrant.v1beta1.Query", + method: "AllowancesByGranter" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputsign/cosmos/feegrant/v1beta1/tx.rpc.func.ts b/__fixtures__/v-next/outputsign/cosmos/feegrant/v1beta1/tx.rpc.func.ts new file mode 100644 index 0000000000..ca487c7f69 --- /dev/null +++ b/__fixtures__/v-next/outputsign/cosmos/feegrant/v1beta1/tx.rpc.func.ts @@ -0,0 +1,23 @@ +import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../google/protobuf/any"; +import { buildTx } from "../../../helper-func-types"; +import { MsgGrantAllowance, MsgGrantAllowanceSDKType, MsgGrantAllowanceResponse, MsgGrantAllowanceResponseSDKType, MsgRevokeAllowance, MsgRevokeAllowanceSDKType, MsgRevokeAllowanceResponse, MsgRevokeAllowanceResponseSDKType } from "./tx"; +/** + * GrantAllowance grants fee allowance to the grantee on the granter's + * account with the provided expiration time. + * @name grantAllowance + * @package cosmos.feegrant.v1beta1 + * @see proto service: cosmos.feegrant.v1beta1.GrantAllowance + */ +export const grantAllowance = buildTx({ + msg: MsgGrantAllowance +}); +/** + * RevokeAllowance revokes any fee allowance of granter's account that + * has been granted to the grantee. + * @name revokeAllowance + * @package cosmos.feegrant.v1beta1 + * @see proto service: cosmos.feegrant.v1beta1.RevokeAllowance + */ +export const revokeAllowance = buildTx({ + msg: MsgRevokeAllowance +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputsign/cosmos/gov/v1/query.rpc.func.ts b/__fixtures__/v-next/outputsign/cosmos/gov/v1/query.rpc.func.ts new file mode 100644 index 0000000000..72ca1d7f03 --- /dev/null +++ b/__fixtures__/v-next/outputsign/cosmos/gov/v1/query.rpc.func.ts @@ -0,0 +1,100 @@ +import { ProposalStatus, ProposalStatusSDKType, Proposal, ProposalSDKType, Vote, VoteSDKType, VotingParams, VotingParamsSDKType, DepositParams, DepositParamsSDKType, TallyParams, TallyParamsSDKType, Deposit, DepositSDKType, TallyResult, TallyResultSDKType } from "./gov"; +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +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"; +/** + * Proposal queries proposal details based on ProposalID. + * @name getProposal + * @package cosmos.gov.v1 + * @see proto service: cosmos.gov.v1.Proposal + */ +export const getProposal = buildQuery({ + encode: QueryProposalRequest.encode, + decode: QueryProposalResponse.decode, + service: "cosmos.gov.v1.Query", + method: "Proposal" +}); +/** + * Proposals queries all proposals based on given status. + * @name getProposals + * @package cosmos.gov.v1 + * @see proto service: cosmos.gov.v1.Proposals + */ +export const getProposals = buildQuery({ + encode: QueryProposalsRequest.encode, + decode: QueryProposalsResponse.decode, + service: "cosmos.gov.v1.Query", + method: "Proposals" +}); +/** + * Vote queries voted information based on proposalID, voterAddr. + * @name getVote + * @package cosmos.gov.v1 + * @see proto service: cosmos.gov.v1.Vote + */ +export const getVote = buildQuery({ + encode: QueryVoteRequest.encode, + decode: QueryVoteResponse.decode, + service: "cosmos.gov.v1.Query", + method: "Vote" +}); +/** + * Votes queries votes of a given proposal. + * @name getVotes + * @package cosmos.gov.v1 + * @see proto service: cosmos.gov.v1.Votes + */ +export const getVotes = buildQuery({ + encode: QueryVotesRequest.encode, + decode: QueryVotesResponse.decode, + service: "cosmos.gov.v1.Query", + method: "Votes" +}); +/** + * Params queries all parameters of the gov module. + * @name getParams + * @package cosmos.gov.v1 + * @see proto service: cosmos.gov.v1.Params + */ +export const getParams = buildQuery({ + encode: QueryParamsRequest.encode, + decode: QueryParamsResponse.decode, + service: "cosmos.gov.v1.Query", + method: "Params" +}); +/** + * Deposit queries single deposit information based proposalID, depositAddr. + * @name getDeposit + * @package cosmos.gov.v1 + * @see proto service: cosmos.gov.v1.Deposit + */ +export const getDeposit = buildQuery({ + encode: QueryDepositRequest.encode, + decode: QueryDepositResponse.decode, + service: "cosmos.gov.v1.Query", + method: "Deposit" +}); +/** + * Deposits queries all deposits of a single proposal. + * @name getDeposits + * @package cosmos.gov.v1 + * @see proto service: cosmos.gov.v1.Deposits + */ +export const getDeposits = buildQuery({ + encode: QueryDepositsRequest.encode, + decode: QueryDepositsResponse.decode, + service: "cosmos.gov.v1.Query", + method: "Deposits" +}); +/** + * TallyResult queries the tally of a proposal vote. + * @name getTallyResult + * @package cosmos.gov.v1 + * @see proto service: cosmos.gov.v1.TallyResult + */ +export const getTallyResult = buildQuery({ + encode: QueryTallyResultRequest.encode, + decode: QueryTallyResultResponse.decode, + service: "cosmos.gov.v1.Query", + method: "TallyResult" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputsign/cosmos/gov/v1/tx.rpc.func.ts b/__fixtures__/v-next/outputsign/cosmos/gov/v1/tx.rpc.func.ts new file mode 100644 index 0000000000..46d4af0726 --- /dev/null +++ b/__fixtures__/v-next/outputsign/cosmos/gov/v1/tx.rpc.func.ts @@ -0,0 +1,51 @@ +import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../google/protobuf/any"; +import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; +import { VoteOption, VoteOptionSDKType, WeightedVoteOption, WeightedVoteOptionSDKType } from "./gov"; +import { buildTx } from "../../../helper-func-types"; +import { MsgSubmitProposal, MsgSubmitProposalSDKType, MsgSubmitProposalResponse, MsgSubmitProposalResponseSDKType, MsgExecLegacyContent, MsgExecLegacyContentSDKType, MsgExecLegacyContentResponse, MsgExecLegacyContentResponseSDKType, MsgVote, MsgVoteSDKType, MsgVoteResponse, MsgVoteResponseSDKType, MsgVoteWeighted, MsgVoteWeightedSDKType, MsgVoteWeightedResponse, MsgVoteWeightedResponseSDKType, MsgDeposit, MsgDepositSDKType, MsgDepositResponse, MsgDepositResponseSDKType } from "./tx"; +/** + * SubmitProposal defines a method to create new proposal given a content. + * @name submitProposal + * @package cosmos.gov.v1 + * @see proto service: cosmos.gov.v1.SubmitProposal + */ +export const submitProposal = buildTx({ + msg: MsgSubmitProposal +}); +/** + * ExecLegacyContent defines a Msg to be in included in a MsgSubmitProposal + * to execute a legacy content-based proposal. + * @name execLegacyContent + * @package cosmos.gov.v1 + * @see proto service: cosmos.gov.v1.ExecLegacyContent + */ +export const execLegacyContent = buildTx({ + msg: MsgExecLegacyContent +}); +/** + * Vote defines a method to add a vote on a specific proposal. + * @name vote + * @package cosmos.gov.v1 + * @see proto service: cosmos.gov.v1.Vote + */ +export const vote = buildTx({ + msg: MsgVote +}); +/** + * VoteWeighted defines a method to add a weighted vote on a specific proposal. + * @name voteWeighted + * @package cosmos.gov.v1 + * @see proto service: cosmos.gov.v1.VoteWeighted + */ +export const voteWeighted = buildTx({ + msg: MsgVoteWeighted +}); +/** + * Deposit defines a method to add deposit on a specific proposal. + * @name deposit + * @package cosmos.gov.v1 + * @see proto service: cosmos.gov.v1.Deposit + */ +export const deposit = buildTx({ + msg: MsgDeposit +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputsign/cosmos/gov/v1beta1/gov.ts b/__fixtures__/v-next/outputsign/cosmos/gov/v1beta1/gov.ts index 1ec67bce75..8127c6aa92 100644 --- a/__fixtures__/v-next/outputsign/cosmos/gov/v1beta1/gov.ts +++ b/__fixtures__/v-next/outputsign/cosmos/gov/v1beta1/gov.ts @@ -3,7 +3,7 @@ import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../google/protobuf import { Timestamp, TimestampAmino, TimestampSDKType } from "../../../google/protobuf/timestamp"; import { Duration, DurationAmino, DurationSDKType } from "../../../google/protobuf/duration"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { Decimal } from "@cosmjs/math"; +import { Decimal } from "@interchainjs/math"; import { DeepPartial, toTimestamp, fromTimestamp, bytesFromBase64, base64FromBytes } from "../../../helpers"; export const protobufPackage = "cosmos.gov.v1beta1"; /** VoteOption enumerates the valid vote options for a given governance proposal. */ @@ -670,7 +670,7 @@ export const WeightedVoteOption = { toAmino(message: WeightedVoteOption): WeightedVoteOptionAmino { const obj: any = {}; obj.option = message.option === 0 ? undefined : message.option; - obj.weight = message.weight === "" ? undefined : message.weight; + obj.weight = message.weight === "" ? undefined : Decimal.fromUserInput(message.weight, 18).atomics; return obj; }, fromAminoMsg(object: WeightedVoteOptionAminoMsg): WeightedVoteOption { diff --git a/__fixtures__/v-next/outputsign/cosmos/gov/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputsign/cosmos/gov/v1beta1/query.rpc.func.ts new file mode 100644 index 0000000000..8a24300a35 --- /dev/null +++ b/__fixtures__/v-next/outputsign/cosmos/gov/v1beta1/query.rpc.func.ts @@ -0,0 +1,100 @@ +import { ProposalStatus, ProposalStatusSDKType, Proposal, ProposalSDKType, Vote, VoteSDKType, VotingParams, VotingParamsSDKType, DepositParams, DepositParamsSDKType, TallyParams, TallyParamsSDKType, Deposit, DepositSDKType, TallyResult, TallyResultSDKType } from "./gov"; +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +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"; +/** + * Proposal queries proposal details based on ProposalID. + * @name getProposal + * @package cosmos.gov.v1beta1 + * @see proto service: cosmos.gov.v1beta1.Proposal + */ +export const getProposal = buildQuery({ + encode: QueryProposalRequest.encode, + decode: QueryProposalResponse.decode, + service: "cosmos.gov.v1beta1.Query", + method: "Proposal" +}); +/** + * Proposals queries all proposals based on given status. + * @name getProposals + * @package cosmos.gov.v1beta1 + * @see proto service: cosmos.gov.v1beta1.Proposals + */ +export const getProposals = buildQuery({ + encode: QueryProposalsRequest.encode, + decode: QueryProposalsResponse.decode, + service: "cosmos.gov.v1beta1.Query", + method: "Proposals" +}); +/** + * Vote queries voted information based on proposalID, voterAddr. + * @name getVote + * @package cosmos.gov.v1beta1 + * @see proto service: cosmos.gov.v1beta1.Vote + */ +export const getVote = buildQuery({ + encode: QueryVoteRequest.encode, + decode: QueryVoteResponse.decode, + service: "cosmos.gov.v1beta1.Query", + method: "Vote" +}); +/** + * Votes queries votes of a given proposal. + * @name getVotes + * @package cosmos.gov.v1beta1 + * @see proto service: cosmos.gov.v1beta1.Votes + */ +export const getVotes = buildQuery({ + encode: QueryVotesRequest.encode, + decode: QueryVotesResponse.decode, + service: "cosmos.gov.v1beta1.Query", + method: "Votes" +}); +/** + * Params queries all parameters of the gov module. + * @name getParams + * @package cosmos.gov.v1beta1 + * @see proto service: cosmos.gov.v1beta1.Params + */ +export const getParams = buildQuery({ + encode: QueryParamsRequest.encode, + decode: QueryParamsResponse.decode, + service: "cosmos.gov.v1beta1.Query", + method: "Params" +}); +/** + * Deposit queries single deposit information based proposalID, depositAddr. + * @name getDeposit + * @package cosmos.gov.v1beta1 + * @see proto service: cosmos.gov.v1beta1.Deposit + */ +export const getDeposit = buildQuery({ + encode: QueryDepositRequest.encode, + decode: QueryDepositResponse.decode, + service: "cosmos.gov.v1beta1.Query", + method: "Deposit" +}); +/** + * Deposits queries all deposits of a single proposal. + * @name getDeposits + * @package cosmos.gov.v1beta1 + * @see proto service: cosmos.gov.v1beta1.Deposits + */ +export const getDeposits = buildQuery({ + encode: QueryDepositsRequest.encode, + decode: QueryDepositsResponse.decode, + service: "cosmos.gov.v1beta1.Query", + method: "Deposits" +}); +/** + * TallyResult queries the tally of a proposal vote. + * @name getTallyResult + * @package cosmos.gov.v1beta1 + * @see proto service: cosmos.gov.v1beta1.TallyResult + */ +export const getTallyResult = buildQuery({ + encode: QueryTallyResultRequest.encode, + decode: QueryTallyResultResponse.decode, + service: "cosmos.gov.v1beta1.Query", + method: "TallyResult" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputsign/cosmos/gov/v1beta1/tx.rpc.func.ts b/__fixtures__/v-next/outputsign/cosmos/gov/v1beta1/tx.rpc.func.ts new file mode 100644 index 0000000000..fb776d5815 --- /dev/null +++ b/__fixtures__/v-next/outputsign/cosmos/gov/v1beta1/tx.rpc.func.ts @@ -0,0 +1,43 @@ +import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../google/protobuf/any"; +import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; +import { VoteOption, VoteOptionSDKType, WeightedVoteOption, WeightedVoteOptionSDKType } from "./gov"; +import { buildTx } from "../../../helper-func-types"; +import { MsgSubmitProposal, MsgSubmitProposalSDKType, MsgSubmitProposalResponse, MsgSubmitProposalResponseSDKType, MsgVote, MsgVoteSDKType, MsgVoteResponse, MsgVoteResponseSDKType, MsgVoteWeighted, MsgVoteWeightedSDKType, MsgVoteWeightedResponse, MsgVoteWeightedResponseSDKType, MsgDeposit, MsgDepositSDKType, MsgDepositResponse, MsgDepositResponseSDKType } from "./tx"; +/** + * SubmitProposal defines a method to create new proposal given a content. + * @name submitProposal + * @package cosmos.gov.v1beta1 + * @see proto service: cosmos.gov.v1beta1.SubmitProposal + */ +export const submitProposal = buildTx({ + msg: MsgSubmitProposal +}); +/** + * Vote defines a method to add a vote on a specific proposal. + * @name vote + * @package cosmos.gov.v1beta1 + * @see proto service: cosmos.gov.v1beta1.Vote + */ +export const vote = buildTx({ + msg: MsgVote +}); +/** + * VoteWeighted defines a method to add a weighted vote on a specific proposal. + * + * Since: cosmos-sdk 0.43 + * @name voteWeighted + * @package cosmos.gov.v1beta1 + * @see proto service: cosmos.gov.v1beta1.VoteWeighted + */ +export const voteWeighted = buildTx({ + msg: MsgVoteWeighted +}); +/** + * Deposit defines a method to add deposit on a specific proposal. + * @name deposit + * @package cosmos.gov.v1beta1 + * @see proto service: cosmos.gov.v1beta1.Deposit + */ +export const deposit = buildTx({ + msg: MsgDeposit +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputsign/cosmos/group/v1/query.rpc.func.ts b/__fixtures__/v-next/outputsign/cosmos/group/v1/query.rpc.func.ts new file mode 100644 index 0000000000..6172c0378f --- /dev/null +++ b/__fixtures__/v-next/outputsign/cosmos/group/v1/query.rpc.func.ts @@ -0,0 +1,160 @@ +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; +import { GroupInfo, GroupInfoSDKType, GroupPolicyInfo, GroupPolicyInfoSDKType, GroupMember, GroupMemberSDKType, Proposal, ProposalSDKType, Vote, VoteSDKType, TallyResult, TallyResultSDKType } from "./types"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { QueryGroupInfoRequest, QueryGroupInfoRequestSDKType, QueryGroupInfoResponse, QueryGroupInfoResponseSDKType, QueryGroupPolicyInfoRequest, QueryGroupPolicyInfoRequestSDKType, QueryGroupPolicyInfoResponse, QueryGroupPolicyInfoResponseSDKType, QueryGroupMembersRequest, QueryGroupMembersRequestSDKType, QueryGroupMembersResponse, QueryGroupMembersResponseSDKType, QueryGroupsByAdminRequest, QueryGroupsByAdminRequestSDKType, QueryGroupsByAdminResponse, QueryGroupsByAdminResponseSDKType, QueryGroupPoliciesByGroupRequest, QueryGroupPoliciesByGroupRequestSDKType, QueryGroupPoliciesByGroupResponse, QueryGroupPoliciesByGroupResponseSDKType, QueryGroupPoliciesByAdminRequest, QueryGroupPoliciesByAdminRequestSDKType, QueryGroupPoliciesByAdminResponse, QueryGroupPoliciesByAdminResponseSDKType, QueryProposalRequest, QueryProposalRequestSDKType, QueryProposalResponse, QueryProposalResponseSDKType, QueryProposalsByGroupPolicyRequest, QueryProposalsByGroupPolicyRequestSDKType, QueryProposalsByGroupPolicyResponse, QueryProposalsByGroupPolicyResponseSDKType, QueryVoteByProposalVoterRequest, QueryVoteByProposalVoterRequestSDKType, QueryVoteByProposalVoterResponse, QueryVoteByProposalVoterResponseSDKType, QueryVotesByProposalRequest, QueryVotesByProposalRequestSDKType, QueryVotesByProposalResponse, QueryVotesByProposalResponseSDKType, QueryVotesByVoterRequest, QueryVotesByVoterRequestSDKType, QueryVotesByVoterResponse, QueryVotesByVoterResponseSDKType, QueryGroupsByMemberRequest, QueryGroupsByMemberRequestSDKType, QueryGroupsByMemberResponse, QueryGroupsByMemberResponseSDKType, QueryTallyResultRequest, QueryTallyResultRequestSDKType, QueryTallyResultResponse, QueryTallyResultResponseSDKType } from "./query"; +/** + * GroupInfo queries group info based on group id. + * @name getGroupInfo + * @package cosmos.group.v1 + * @see proto service: cosmos.group.v1.GroupInfo + */ +export const getGroupInfo = buildQuery({ + encode: QueryGroupInfoRequest.encode, + decode: QueryGroupInfoResponse.decode, + service: "cosmos.group.v1.Query", + method: "GroupInfo" +}); +/** + * GroupPolicyInfo queries group policy info based on account address of group policy. + * @name getGroupPolicyInfo + * @package cosmos.group.v1 + * @see proto service: cosmos.group.v1.GroupPolicyInfo + */ +export const getGroupPolicyInfo = buildQuery({ + encode: QueryGroupPolicyInfoRequest.encode, + decode: QueryGroupPolicyInfoResponse.decode, + service: "cosmos.group.v1.Query", + method: "GroupPolicyInfo" +}); +/** + * GroupMembers queries members of a group + * @name getGroupMembers + * @package cosmos.group.v1 + * @see proto service: cosmos.group.v1.GroupMembers + */ +export const getGroupMembers = buildQuery({ + encode: QueryGroupMembersRequest.encode, + decode: QueryGroupMembersResponse.decode, + service: "cosmos.group.v1.Query", + method: "GroupMembers" +}); +/** + * GroupsByAdmin queries groups by admin address. + * @name getGroupsByAdmin + * @package cosmos.group.v1 + * @see proto service: cosmos.group.v1.GroupsByAdmin + */ +export const getGroupsByAdmin = buildQuery({ + encode: QueryGroupsByAdminRequest.encode, + decode: QueryGroupsByAdminResponse.decode, + service: "cosmos.group.v1.Query", + method: "GroupsByAdmin" +}); +/** + * GroupPoliciesByGroup queries group policies by group id. + * @name getGroupPoliciesByGroup + * @package cosmos.group.v1 + * @see proto service: cosmos.group.v1.GroupPoliciesByGroup + */ +export const getGroupPoliciesByGroup = buildQuery({ + encode: QueryGroupPoliciesByGroupRequest.encode, + decode: QueryGroupPoliciesByGroupResponse.decode, + service: "cosmos.group.v1.Query", + method: "GroupPoliciesByGroup" +}); +/** + * GroupsByAdmin queries group policies by admin address. + * @name getGroupPoliciesByAdmin + * @package cosmos.group.v1 + * @see proto service: cosmos.group.v1.GroupPoliciesByAdmin + */ +export const getGroupPoliciesByAdmin = buildQuery({ + encode: QueryGroupPoliciesByAdminRequest.encode, + decode: QueryGroupPoliciesByAdminResponse.decode, + service: "cosmos.group.v1.Query", + method: "GroupPoliciesByAdmin" +}); +/** + * Proposal queries a proposal based on proposal id. + * @name getProposal + * @package cosmos.group.v1 + * @see proto service: cosmos.group.v1.Proposal + */ +export const getProposal = buildQuery({ + encode: QueryProposalRequest.encode, + decode: QueryProposalResponse.decode, + service: "cosmos.group.v1.Query", + method: "Proposal" +}); +/** + * ProposalsByGroupPolicy queries proposals based on account address of group policy. + * @name getProposalsByGroupPolicy + * @package cosmos.group.v1 + * @see proto service: cosmos.group.v1.ProposalsByGroupPolicy + */ +export const getProposalsByGroupPolicy = buildQuery({ + encode: QueryProposalsByGroupPolicyRequest.encode, + decode: QueryProposalsByGroupPolicyResponse.decode, + service: "cosmos.group.v1.Query", + method: "ProposalsByGroupPolicy" +}); +/** + * VoteByProposalVoter queries a vote by proposal id and voter. + * @name getVoteByProposalVoter + * @package cosmos.group.v1 + * @see proto service: cosmos.group.v1.VoteByProposalVoter + */ +export const getVoteByProposalVoter = buildQuery({ + encode: QueryVoteByProposalVoterRequest.encode, + decode: QueryVoteByProposalVoterResponse.decode, + service: "cosmos.group.v1.Query", + method: "VoteByProposalVoter" +}); +/** + * VotesByProposal queries a vote by proposal. + * @name getVotesByProposal + * @package cosmos.group.v1 + * @see proto service: cosmos.group.v1.VotesByProposal + */ +export const getVotesByProposal = buildQuery({ + encode: QueryVotesByProposalRequest.encode, + decode: QueryVotesByProposalResponse.decode, + service: "cosmos.group.v1.Query", + method: "VotesByProposal" +}); +/** + * VotesByVoter queries a vote by voter. + * @name getVotesByVoter + * @package cosmos.group.v1 + * @see proto service: cosmos.group.v1.VotesByVoter + */ +export const getVotesByVoter = buildQuery({ + encode: QueryVotesByVoterRequest.encode, + decode: QueryVotesByVoterResponse.decode, + service: "cosmos.group.v1.Query", + method: "VotesByVoter" +}); +/** + * GroupsByMember queries groups by member address. + * @name getGroupsByMember + * @package cosmos.group.v1 + * @see proto service: cosmos.group.v1.GroupsByMember + */ +export const getGroupsByMember = buildQuery({ + encode: QueryGroupsByMemberRequest.encode, + decode: QueryGroupsByMemberResponse.decode, + service: "cosmos.group.v1.Query", + method: "GroupsByMember" +}); +/** + * TallyResult queries the tally of a proposal votes. + * @name getTallyResult + * @package cosmos.group.v1 + * @see proto service: cosmos.group.v1.TallyResult + */ +export const getTallyResult = buildQuery({ + encode: QueryTallyResultRequest.encode, + decode: QueryTallyResultResponse.decode, + service: "cosmos.group.v1.Query", + method: "TallyResult" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputsign/cosmos/group/v1/tx.rpc.func.ts b/__fixtures__/v-next/outputsign/cosmos/group/v1/tx.rpc.func.ts new file mode 100644 index 0000000000..dd85201704 --- /dev/null +++ b/__fixtures__/v-next/outputsign/cosmos/group/v1/tx.rpc.func.ts @@ -0,0 +1,130 @@ +import { Member, MemberSDKType, VoteOption, VoteOptionSDKType } from "./types"; +import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../google/protobuf/any"; +import { buildTx } from "../../../helper-func-types"; +import { MsgCreateGroup, MsgCreateGroupSDKType, MsgCreateGroupResponse, MsgCreateGroupResponseSDKType, MsgUpdateGroupMembers, MsgUpdateGroupMembersSDKType, MsgUpdateGroupMembersResponse, MsgUpdateGroupMembersResponseSDKType, MsgUpdateGroupAdmin, MsgUpdateGroupAdminSDKType, MsgUpdateGroupAdminResponse, MsgUpdateGroupAdminResponseSDKType, MsgUpdateGroupMetadata, MsgUpdateGroupMetadataSDKType, MsgUpdateGroupMetadataResponse, MsgUpdateGroupMetadataResponseSDKType, MsgCreateGroupPolicy, MsgCreateGroupPolicySDKType, MsgCreateGroupPolicyResponse, MsgCreateGroupPolicyResponseSDKType, MsgCreateGroupWithPolicy, MsgCreateGroupWithPolicySDKType, MsgCreateGroupWithPolicyResponse, MsgCreateGroupWithPolicyResponseSDKType, MsgUpdateGroupPolicyAdmin, MsgUpdateGroupPolicyAdminSDKType, MsgUpdateGroupPolicyAdminResponse, MsgUpdateGroupPolicyAdminResponseSDKType, MsgUpdateGroupPolicyDecisionPolicy, MsgUpdateGroupPolicyDecisionPolicySDKType, MsgUpdateGroupPolicyDecisionPolicyResponse, MsgUpdateGroupPolicyDecisionPolicyResponseSDKType, MsgUpdateGroupPolicyMetadata, MsgUpdateGroupPolicyMetadataSDKType, MsgUpdateGroupPolicyMetadataResponse, MsgUpdateGroupPolicyMetadataResponseSDKType, MsgSubmitProposal, MsgSubmitProposalSDKType, MsgSubmitProposalResponse, MsgSubmitProposalResponseSDKType, MsgWithdrawProposal, MsgWithdrawProposalSDKType, MsgWithdrawProposalResponse, MsgWithdrawProposalResponseSDKType, MsgVote, MsgVoteSDKType, MsgVoteResponse, MsgVoteResponseSDKType, MsgExec, MsgExecSDKType, MsgExecResponse, MsgExecResponseSDKType, MsgLeaveGroup, MsgLeaveGroupSDKType, MsgLeaveGroupResponse, MsgLeaveGroupResponseSDKType } from "./tx"; +/** + * CreateGroup creates a new group with an admin account address, a list of members and some optional metadata. + * @name createGroup + * @package cosmos.group.v1 + * @see proto service: cosmos.group.v1.CreateGroup + */ +export const createGroup = buildTx({ + msg: MsgCreateGroup +}); +/** + * UpdateGroupMembers updates the group members with given group id and admin address. + * @name updateGroupMembers + * @package cosmos.group.v1 + * @see proto service: cosmos.group.v1.UpdateGroupMembers + */ +export const updateGroupMembers = buildTx({ + msg: MsgUpdateGroupMembers +}); +/** + * UpdateGroupAdmin updates the group admin with given group id and previous admin address. + * @name updateGroupAdmin + * @package cosmos.group.v1 + * @see proto service: cosmos.group.v1.UpdateGroupAdmin + */ +export const updateGroupAdmin = buildTx({ + msg: MsgUpdateGroupAdmin +}); +/** + * UpdateGroupMetadata updates the group metadata with given group id and admin address. + * @name updateGroupMetadata + * @package cosmos.group.v1 + * @see proto service: cosmos.group.v1.UpdateGroupMetadata + */ +export const updateGroupMetadata = buildTx({ + msg: MsgUpdateGroupMetadata +}); +/** + * CreateGroupPolicy creates a new group policy using given DecisionPolicy. + * @name createGroupPolicy + * @package cosmos.group.v1 + * @see proto service: cosmos.group.v1.CreateGroupPolicy + */ +export const createGroupPolicy = buildTx({ + msg: MsgCreateGroupPolicy +}); +/** + * CreateGroupWithPolicy creates a new group with policy. + * @name createGroupWithPolicy + * @package cosmos.group.v1 + * @see proto service: cosmos.group.v1.CreateGroupWithPolicy + */ +export const createGroupWithPolicy = buildTx({ + msg: MsgCreateGroupWithPolicy +}); +/** + * UpdateGroupPolicyAdmin updates a group policy admin. + * @name updateGroupPolicyAdmin + * @package cosmos.group.v1 + * @see proto service: cosmos.group.v1.UpdateGroupPolicyAdmin + */ +export const updateGroupPolicyAdmin = buildTx({ + msg: MsgUpdateGroupPolicyAdmin +}); +/** + * UpdateGroupPolicyDecisionPolicy allows a group policy's decision policy to be updated. + * @name updateGroupPolicyDecisionPolicy + * @package cosmos.group.v1 + * @see proto service: cosmos.group.v1.UpdateGroupPolicyDecisionPolicy + */ +export const updateGroupPolicyDecisionPolicy = buildTx({ + msg: MsgUpdateGroupPolicyDecisionPolicy +}); +/** + * UpdateGroupPolicyMetadata updates a group policy metadata. + * @name updateGroupPolicyMetadata + * @package cosmos.group.v1 + * @see proto service: cosmos.group.v1.UpdateGroupPolicyMetadata + */ +export const updateGroupPolicyMetadata = buildTx({ + msg: MsgUpdateGroupPolicyMetadata +}); +/** + * SubmitProposal submits a new proposal. + * @name submitProposal + * @package cosmos.group.v1 + * @see proto service: cosmos.group.v1.SubmitProposal + */ +export const submitProposal = buildTx({ + msg: MsgSubmitProposal +}); +/** + * WithdrawProposal aborts a proposal. + * @name withdrawProposal + * @package cosmos.group.v1 + * @see proto service: cosmos.group.v1.WithdrawProposal + */ +export const withdrawProposal = buildTx({ + msg: MsgWithdrawProposal +}); +/** + * Vote allows a voter to vote on a proposal. + * @name vote + * @package cosmos.group.v1 + * @see proto service: cosmos.group.v1.Vote + */ +export const vote = buildTx({ + msg: MsgVote +}); +/** + * Exec executes a proposal. + * @name exec + * @package cosmos.group.v1 + * @see proto service: cosmos.group.v1.Exec + */ +export const exec = buildTx({ + msg: MsgExec +}); +/** + * LeaveGroup allows a group member to leave the group. + * @name leaveGroup + * @package cosmos.group.v1 + * @see proto service: cosmos.group.v1.LeaveGroup + */ +export const leaveGroup = buildTx({ + msg: MsgLeaveGroup +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputsign/cosmos/mint/v1beta1/mint.ts b/__fixtures__/v-next/outputsign/cosmos/mint/v1beta1/mint.ts index 89a30e35fb..587b2f9d47 100644 --- a/__fixtures__/v-next/outputsign/cosmos/mint/v1beta1/mint.ts +++ b/__fixtures__/v-next/outputsign/cosmos/mint/v1beta1/mint.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { Decimal } from "@cosmjs/math"; +import { Decimal } from "@interchainjs/math"; import { DeepPartial } from "../../../helpers"; export const protobufPackage = "cosmos.mint.v1beta1"; /** @@ -199,8 +199,8 @@ export const Minter = { }, toAmino(message: Minter): MinterAmino { const obj: any = {}; - obj.inflation = message.inflation === "" ? undefined : message.inflation; - obj.annual_provisions = message.annualProvisions === "" ? undefined : message.annualProvisions; + obj.inflation = message.inflation === "" ? undefined : Decimal.fromUserInput(message.inflation, 18).atomics; + obj.annual_provisions = message.annualProvisions === "" ? undefined : Decimal.fromUserInput(message.annualProvisions, 18).atomics; return obj; }, fromAminoMsg(object: MinterAminoMsg): Minter { @@ -333,10 +333,10 @@ export const Params = { toAmino(message: Params): ParamsAmino { const obj: any = {}; obj.mint_denom = message.mintDenom === "" ? undefined : message.mintDenom; - obj.inflation_rate_change = message.inflationRateChange === "" ? undefined : message.inflationRateChange; - obj.inflation_max = message.inflationMax === "" ? undefined : message.inflationMax; - obj.inflation_min = message.inflationMin === "" ? undefined : message.inflationMin; - obj.goal_bonded = message.goalBonded === "" ? undefined : message.goalBonded; + obj.inflation_rate_change = message.inflationRateChange === "" ? undefined : Decimal.fromUserInput(message.inflationRateChange, 18).atomics; + obj.inflation_max = message.inflationMax === "" ? undefined : Decimal.fromUserInput(message.inflationMax, 18).atomics; + obj.inflation_min = message.inflationMin === "" ? undefined : Decimal.fromUserInput(message.inflationMin, 18).atomics; + obj.goal_bonded = message.goalBonded === "" ? undefined : Decimal.fromUserInput(message.goalBonded, 18).atomics; obj.blocks_per_year = message.blocksPerYear !== BigInt(0) ? message.blocksPerYear?.toString() : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputsign/cosmos/mint/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputsign/cosmos/mint/v1beta1/query.rpc.func.ts new file mode 100644 index 0000000000..68f23adc68 --- /dev/null +++ b/__fixtures__/v-next/outputsign/cosmos/mint/v1beta1/query.rpc.func.ts @@ -0,0 +1,39 @@ +import { Params, ParamsSDKType } from "./mint"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, QueryInflationRequest, QueryInflationRequestSDKType, QueryInflationResponse, QueryInflationResponseSDKType, QueryAnnualProvisionsRequest, QueryAnnualProvisionsRequestSDKType, QueryAnnualProvisionsResponse, QueryAnnualProvisionsResponseSDKType } from "./query"; +/** + * Params returns the total set of minting parameters. + * @name getParams + * @package cosmos.mint.v1beta1 + * @see proto service: cosmos.mint.v1beta1.Params + */ +export const getParams = buildQuery({ + encode: QueryParamsRequest.encode, + decode: QueryParamsResponse.decode, + service: "cosmos.mint.v1beta1.Query", + method: "Params" +}); +/** + * Inflation returns the current minting inflation value. + * @name getInflation + * @package cosmos.mint.v1beta1 + * @see proto service: cosmos.mint.v1beta1.Inflation + */ +export const getInflation = buildQuery({ + encode: QueryInflationRequest.encode, + decode: QueryInflationResponse.decode, + service: "cosmos.mint.v1beta1.Query", + method: "Inflation" +}); +/** + * AnnualProvisions current minting annual provisions value. + * @name getAnnualProvisions + * @package cosmos.mint.v1beta1 + * @see proto service: cosmos.mint.v1beta1.AnnualProvisions + */ +export const getAnnualProvisions = buildQuery({ + encode: QueryAnnualProvisionsRequest.encode, + decode: QueryAnnualProvisionsResponse.decode, + service: "cosmos.mint.v1beta1.Query", + method: "AnnualProvisions" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputsign/cosmos/nft/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputsign/cosmos/nft/v1beta1/query.rpc.func.ts new file mode 100644 index 0000000000..ef9577f449 --- /dev/null +++ b/__fixtures__/v-next/outputsign/cosmos/nft/v1beta1/query.rpc.func.ts @@ -0,0 +1,89 @@ +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; +import { NFT, NFTSDKType, Class, ClassSDKType } from "./nft"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { QueryBalanceRequest, QueryBalanceRequestSDKType, QueryBalanceResponse, QueryBalanceResponseSDKType, QueryOwnerRequest, QueryOwnerRequestSDKType, QueryOwnerResponse, QueryOwnerResponseSDKType, QuerySupplyRequest, QuerySupplyRequestSDKType, QuerySupplyResponse, QuerySupplyResponseSDKType, QueryNFTsRequest, QueryNFTsRequestSDKType, QueryNFTsResponse, QueryNFTsResponseSDKType, QueryNFTRequest, QueryNFTRequestSDKType, QueryNFTResponse, QueryNFTResponseSDKType, QueryClassRequest, QueryClassRequestSDKType, QueryClassResponse, QueryClassResponseSDKType, QueryClassesRequest, QueryClassesRequestSDKType, QueryClassesResponse, QueryClassesResponseSDKType } from "./query"; +/** + * Balance queries the number of NFTs of a given class owned by the owner, same as balanceOf in ERC721 + * @name getBalance + * @package cosmos.nft.v1beta1 + * @see proto service: cosmos.nft.v1beta1.Balance + */ +export const getBalance = buildQuery({ + encode: QueryBalanceRequest.encode, + decode: QueryBalanceResponse.decode, + service: "cosmos.nft.v1beta1.Query", + method: "Balance" +}); +/** + * Owner queries the owner of the NFT based on its class and id, same as ownerOf in ERC721 + * @name getOwner + * @package cosmos.nft.v1beta1 + * @see proto service: cosmos.nft.v1beta1.Owner + */ +export const getOwner = buildQuery({ + encode: QueryOwnerRequest.encode, + decode: QueryOwnerResponse.decode, + service: "cosmos.nft.v1beta1.Query", + method: "Owner" +}); +/** + * Supply queries the number of NFTs from the given class, same as totalSupply of ERC721. + * @name getSupply + * @package cosmos.nft.v1beta1 + * @see proto service: cosmos.nft.v1beta1.Supply + */ +export const getSupply = buildQuery({ + encode: QuerySupplyRequest.encode, + decode: QuerySupplyResponse.decode, + service: "cosmos.nft.v1beta1.Query", + method: "Supply" +}); +/** + * NFTs queries all NFTs of a given class or owner,choose at least one of the two, similar to tokenByIndex in + * ERC721Enumerable + * @name getNFTs + * @package cosmos.nft.v1beta1 + * @see proto service: cosmos.nft.v1beta1.NFTs + */ +export const getNFTs = buildQuery({ + encode: QueryNFTsRequest.encode, + decode: QueryNFTsResponse.decode, + service: "cosmos.nft.v1beta1.Query", + method: "NFTs" +}); +/** + * NFT queries an NFT based on its class and id. + * @name getNFT + * @package cosmos.nft.v1beta1 + * @see proto service: cosmos.nft.v1beta1.NFT + */ +export const getNFT = buildQuery({ + encode: QueryNFTRequest.encode, + decode: QueryNFTResponse.decode, + service: "cosmos.nft.v1beta1.Query", + method: "NFT" +}); +/** + * Class queries an NFT class based on its id + * @name getClass + * @package cosmos.nft.v1beta1 + * @see proto service: cosmos.nft.v1beta1.Class + */ +export const getClass = buildQuery({ + encode: QueryClassRequest.encode, + decode: QueryClassResponse.decode, + service: "cosmos.nft.v1beta1.Query", + method: "Class" +}); +/** + * Classes queries all NFT classes + * @name getClasses + * @package cosmos.nft.v1beta1 + * @see proto service: cosmos.nft.v1beta1.Classes + */ +export const getClasses = buildQuery({ + encode: QueryClassesRequest.encode, + decode: QueryClassesResponse.decode, + service: "cosmos.nft.v1beta1.Query", + method: "Classes" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputsign/cosmos/nft/v1beta1/tx.rpc.func.ts b/__fixtures__/v-next/outputsign/cosmos/nft/v1beta1/tx.rpc.func.ts new file mode 100644 index 0000000000..770b6c79e4 --- /dev/null +++ b/__fixtures__/v-next/outputsign/cosmos/nft/v1beta1/tx.rpc.func.ts @@ -0,0 +1,11 @@ +import { buildTx } from "../../../helper-func-types"; +import { MsgSend, MsgSendSDKType, MsgSendResponse, MsgSendResponseSDKType } from "./tx"; +/** + * Send defines a method to send a nft from one account to another account. + * @name send + * @package cosmos.nft.v1beta1 + * @see proto service: cosmos.nft.v1beta1.Send + */ +export const send = buildTx({ + msg: MsgSend +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputsign/cosmos/params/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputsign/cosmos/params/v1beta1/query.rpc.func.ts new file mode 100644 index 0000000000..8caaba803d --- /dev/null +++ b/__fixtures__/v-next/outputsign/cosmos/params/v1beta1/query.rpc.func.ts @@ -0,0 +1,28 @@ +import { ParamChange, ParamChangeSDKType } from "./params"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, QuerySubspacesRequest, QuerySubspacesRequestSDKType, QuerySubspacesResponse, QuerySubspacesResponseSDKType } from "./query"; +/** + * Params queries a specific parameter of a module, given its subspace and + * key. + * @name getParams + * @package cosmos.params.v1beta1 + * @see proto service: cosmos.params.v1beta1.Params + */ +export const getParams = buildQuery({ + encode: QueryParamsRequest.encode, + decode: QueryParamsResponse.decode, + service: "cosmos.params.v1beta1.Query", + method: "Params" +}); +/** + * Subspaces queries for all registered subspaces and all keys for a subspace. + * @name getSubspaces + * @package cosmos.params.v1beta1 + * @see proto service: cosmos.params.v1beta1.Subspaces + */ +export const getSubspaces = buildQuery({ + encode: QuerySubspacesRequest.encode, + decode: QuerySubspacesResponse.decode, + service: "cosmos.params.v1beta1.Query", + method: "Subspaces" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputsign/cosmos/slashing/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputsign/cosmos/slashing/v1beta1/query.rpc.func.ts new file mode 100644 index 0000000000..fb8415e520 --- /dev/null +++ b/__fixtures__/v-next/outputsign/cosmos/slashing/v1beta1/query.rpc.func.ts @@ -0,0 +1,40 @@ +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; +import { Params, ParamsSDKType, ValidatorSigningInfo, ValidatorSigningInfoSDKType } from "./slashing"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, QuerySigningInfoRequest, QuerySigningInfoRequestSDKType, QuerySigningInfoResponse, QuerySigningInfoResponseSDKType, QuerySigningInfosRequest, QuerySigningInfosRequestSDKType, QuerySigningInfosResponse, QuerySigningInfosResponseSDKType } from "./query"; +/** + * Params queries the parameters of slashing module + * @name getParams + * @package cosmos.slashing.v1beta1 + * @see proto service: cosmos.slashing.v1beta1.Params + */ +export const getParams = buildQuery({ + encode: QueryParamsRequest.encode, + decode: QueryParamsResponse.decode, + service: "cosmos.slashing.v1beta1.Query", + method: "Params" +}); +/** + * SigningInfo queries the signing info of given cons address + * @name getSigningInfo + * @package cosmos.slashing.v1beta1 + * @see proto service: cosmos.slashing.v1beta1.SigningInfo + */ +export const getSigningInfo = buildQuery({ + encode: QuerySigningInfoRequest.encode, + decode: QuerySigningInfoResponse.decode, + service: "cosmos.slashing.v1beta1.Query", + method: "SigningInfo" +}); +/** + * SigningInfos queries signing info of all validators + * @name getSigningInfos + * @package cosmos.slashing.v1beta1 + * @see proto service: cosmos.slashing.v1beta1.SigningInfos + */ +export const getSigningInfos = buildQuery({ + encode: QuerySigningInfosRequest.encode, + decode: QuerySigningInfosResponse.decode, + service: "cosmos.slashing.v1beta1.Query", + method: "SigningInfos" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputsign/cosmos/slashing/v1beta1/tx.rpc.func.ts b/__fixtures__/v-next/outputsign/cosmos/slashing/v1beta1/tx.rpc.func.ts new file mode 100644 index 0000000000..175d9272fa --- /dev/null +++ b/__fixtures__/v-next/outputsign/cosmos/slashing/v1beta1/tx.rpc.func.ts @@ -0,0 +1,13 @@ +import { buildTx } from "../../../helper-func-types"; +import { MsgUnjail, MsgUnjailSDKType, MsgUnjailResponse, MsgUnjailResponseSDKType } from "./tx"; +/** + * Unjail defines a method for unjailing a jailed validator, thus returning + * them into the bonded validator set, so they can begin receiving provisions + * and rewards again. + * @name unjail + * @package cosmos.slashing.v1beta1 + * @see proto service: cosmos.slashing.v1beta1.Unjail + */ +export const unjail = buildTx({ + msg: MsgUnjail +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputsign/cosmos/staking/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputsign/cosmos/staking/v1beta1/query.rpc.func.ts new file mode 100644 index 0000000000..71abf29eb2 --- /dev/null +++ b/__fixtures__/v-next/outputsign/cosmos/staking/v1beta1/query.rpc.func.ts @@ -0,0 +1,176 @@ +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; +import { Validator, ValidatorSDKType, DelegationResponse, DelegationResponseSDKType, UnbondingDelegation, UnbondingDelegationSDKType, RedelegationResponse, RedelegationResponseSDKType, HistoricalInfo, HistoricalInfoSDKType, Pool, PoolSDKType, Params, ParamsSDKType } from "./staking"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { QueryValidatorsRequest, QueryValidatorsRequestSDKType, QueryValidatorsResponse, QueryValidatorsResponseSDKType, QueryValidatorRequest, QueryValidatorRequestSDKType, QueryValidatorResponse, QueryValidatorResponseSDKType, QueryValidatorDelegationsRequest, QueryValidatorDelegationsRequestSDKType, QueryValidatorDelegationsResponse, QueryValidatorDelegationsResponseSDKType, QueryValidatorUnbondingDelegationsRequest, QueryValidatorUnbondingDelegationsRequestSDKType, QueryValidatorUnbondingDelegationsResponse, QueryValidatorUnbondingDelegationsResponseSDKType, QueryDelegationRequest, QueryDelegationRequestSDKType, QueryDelegationResponse, QueryDelegationResponseSDKType, QueryUnbondingDelegationRequest, QueryUnbondingDelegationRequestSDKType, QueryUnbondingDelegationResponse, QueryUnbondingDelegationResponseSDKType, QueryDelegatorDelegationsRequest, QueryDelegatorDelegationsRequestSDKType, QueryDelegatorDelegationsResponse, QueryDelegatorDelegationsResponseSDKType, QueryDelegatorUnbondingDelegationsRequest, QueryDelegatorUnbondingDelegationsRequestSDKType, QueryDelegatorUnbondingDelegationsResponse, QueryDelegatorUnbondingDelegationsResponseSDKType, QueryRedelegationsRequest, QueryRedelegationsRequestSDKType, QueryRedelegationsResponse, QueryRedelegationsResponseSDKType, QueryDelegatorValidatorsRequest, QueryDelegatorValidatorsRequestSDKType, QueryDelegatorValidatorsResponse, QueryDelegatorValidatorsResponseSDKType, QueryDelegatorValidatorRequest, QueryDelegatorValidatorRequestSDKType, QueryDelegatorValidatorResponse, QueryDelegatorValidatorResponseSDKType, QueryHistoricalInfoRequest, QueryHistoricalInfoRequestSDKType, QueryHistoricalInfoResponse, QueryHistoricalInfoResponseSDKType, QueryPoolRequest, QueryPoolRequestSDKType, QueryPoolResponse, QueryPoolResponseSDKType, QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType } from "./query"; +/** + * Validators queries all validators that match the given status. + * @name getValidators + * @package cosmos.staking.v1beta1 + * @see proto service: cosmos.staking.v1beta1.Validators + */ +export const getValidators = buildQuery({ + encode: QueryValidatorsRequest.encode, + decode: QueryValidatorsResponse.decode, + service: "cosmos.staking.v1beta1.Query", + method: "Validators" +}); +/** + * Validator queries validator info for given validator address. + * @name getValidator + * @package cosmos.staking.v1beta1 + * @see proto service: cosmos.staking.v1beta1.Validator + */ +export const getValidator = buildQuery({ + encode: QueryValidatorRequest.encode, + decode: QueryValidatorResponse.decode, + service: "cosmos.staking.v1beta1.Query", + method: "Validator" +}); +/** + * ValidatorDelegations queries delegate info for given validator. + * @name getValidatorDelegations + * @package cosmos.staking.v1beta1 + * @see proto service: cosmos.staking.v1beta1.ValidatorDelegations + */ +export const getValidatorDelegations = buildQuery({ + encode: QueryValidatorDelegationsRequest.encode, + decode: QueryValidatorDelegationsResponse.decode, + service: "cosmos.staking.v1beta1.Query", + method: "ValidatorDelegations" +}); +/** + * ValidatorUnbondingDelegations queries unbonding delegations of a validator. + * @name getValidatorUnbondingDelegations + * @package cosmos.staking.v1beta1 + * @see proto service: cosmos.staking.v1beta1.ValidatorUnbondingDelegations + */ +export const getValidatorUnbondingDelegations = buildQuery({ + encode: QueryValidatorUnbondingDelegationsRequest.encode, + decode: QueryValidatorUnbondingDelegationsResponse.decode, + service: "cosmos.staking.v1beta1.Query", + method: "ValidatorUnbondingDelegations" +}); +/** + * Delegation queries delegate info for given validator delegator pair. + * @name getDelegation + * @package cosmos.staking.v1beta1 + * @see proto service: cosmos.staking.v1beta1.Delegation + */ +export const getDelegation = buildQuery({ + encode: QueryDelegationRequest.encode, + decode: QueryDelegationResponse.decode, + service: "cosmos.staking.v1beta1.Query", + method: "Delegation" +}); +/** + * UnbondingDelegation queries unbonding info for given validator delegator + * pair. + * @name getUnbondingDelegation + * @package cosmos.staking.v1beta1 + * @see proto service: cosmos.staking.v1beta1.UnbondingDelegation + */ +export const getUnbondingDelegation = buildQuery({ + encode: QueryUnbondingDelegationRequest.encode, + decode: QueryUnbondingDelegationResponse.decode, + service: "cosmos.staking.v1beta1.Query", + method: "UnbondingDelegation" +}); +/** + * DelegatorDelegations queries all delegations of a given delegator address. + * @name getDelegatorDelegations + * @package cosmos.staking.v1beta1 + * @see proto service: cosmos.staking.v1beta1.DelegatorDelegations + */ +export const getDelegatorDelegations = buildQuery({ + encode: QueryDelegatorDelegationsRequest.encode, + decode: QueryDelegatorDelegationsResponse.decode, + service: "cosmos.staking.v1beta1.Query", + method: "DelegatorDelegations" +}); +/** + * DelegatorUnbondingDelegations queries all unbonding delegations of a given + * delegator address. + * @name getDelegatorUnbondingDelegations + * @package cosmos.staking.v1beta1 + * @see proto service: cosmos.staking.v1beta1.DelegatorUnbondingDelegations + */ +export const getDelegatorUnbondingDelegations = buildQuery({ + encode: QueryDelegatorUnbondingDelegationsRequest.encode, + decode: QueryDelegatorUnbondingDelegationsResponse.decode, + service: "cosmos.staking.v1beta1.Query", + method: "DelegatorUnbondingDelegations" +}); +/** + * Redelegations queries redelegations of given address. + * @name getRedelegations + * @package cosmos.staking.v1beta1 + * @see proto service: cosmos.staking.v1beta1.Redelegations + */ +export const getRedelegations = buildQuery({ + encode: QueryRedelegationsRequest.encode, + decode: QueryRedelegationsResponse.decode, + service: "cosmos.staking.v1beta1.Query", + method: "Redelegations" +}); +/** + * DelegatorValidators queries all validators info for given delegator + * address. + * @name getDelegatorValidators + * @package cosmos.staking.v1beta1 + * @see proto service: cosmos.staking.v1beta1.DelegatorValidators + */ +export const getDelegatorValidators = buildQuery({ + encode: QueryDelegatorValidatorsRequest.encode, + decode: QueryDelegatorValidatorsResponse.decode, + service: "cosmos.staking.v1beta1.Query", + method: "DelegatorValidators" +}); +/** + * DelegatorValidator queries validator info for given delegator validator + * pair. + * @name getDelegatorValidator + * @package cosmos.staking.v1beta1 + * @see proto service: cosmos.staking.v1beta1.DelegatorValidator + */ +export const getDelegatorValidator = buildQuery({ + encode: QueryDelegatorValidatorRequest.encode, + decode: QueryDelegatorValidatorResponse.decode, + service: "cosmos.staking.v1beta1.Query", + method: "DelegatorValidator" +}); +/** + * HistoricalInfo queries the historical info for given height. + * @name getHistoricalInfo + * @package cosmos.staking.v1beta1 + * @see proto service: cosmos.staking.v1beta1.HistoricalInfo + */ +export const getHistoricalInfo = buildQuery({ + encode: QueryHistoricalInfoRequest.encode, + decode: QueryHistoricalInfoResponse.decode, + service: "cosmos.staking.v1beta1.Query", + method: "HistoricalInfo" +}); +/** + * Pool queries the pool info. + * @name getPool + * @package cosmos.staking.v1beta1 + * @see proto service: cosmos.staking.v1beta1.Pool + */ +export const getPool = buildQuery({ + encode: QueryPoolRequest.encode, + decode: QueryPoolResponse.decode, + service: "cosmos.staking.v1beta1.Query", + method: "Pool" +}); +/** + * Parameters queries the staking parameters. + * @name getParams + * @package cosmos.staking.v1beta1 + * @see proto service: cosmos.staking.v1beta1.Params + */ +export const getParams = buildQuery({ + encode: QueryParamsRequest.encode, + decode: QueryParamsResponse.decode, + service: "cosmos.staking.v1beta1.Query", + method: "Params" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputsign/cosmos/staking/v1beta1/staking.ts b/__fixtures__/v-next/outputsign/cosmos/staking/v1beta1/staking.ts index a0e3d0d468..d3f3e78133 100644 --- a/__fixtures__/v-next/outputsign/cosmos/staking/v1beta1/staking.ts +++ b/__fixtures__/v-next/outputsign/cosmos/staking/v1beta1/staking.ts @@ -5,8 +5,8 @@ import { Duration, DurationAmino, DurationSDKType } from "../../../google/protob import { Coin, CoinAmino, CoinSDKType } from "../../base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { DeepPartial, toTimestamp, fromTimestamp } from "../../../helpers"; -import { Decimal } from "@cosmjs/math"; -import { encodePubkey, decodePubkey } from "@cosmjs/proto-signing"; +import { Decimal } from "@interchainjs/math"; +import { encodePubkey, decodePubkey } from "@interchainjs/pubkey"; export const protobufPackage = "cosmos.staking.v1beta1"; /** BondStatus is the status of a validator. */ export enum BondStatus { @@ -1401,9 +1401,9 @@ export const CommissionRates = { }, toAmino(message: CommissionRates): CommissionRatesAmino { const obj: any = {}; - obj.rate = message.rate === "" ? undefined : message.rate; - obj.max_rate = message.maxRate === "" ? undefined : message.maxRate; - obj.max_change_rate = message.maxChangeRate === "" ? undefined : message.maxChangeRate; + obj.rate = message.rate === "" ? undefined : Decimal.fromUserInput(message.rate, 18).atomics; + obj.max_rate = message.maxRate === "" ? undefined : Decimal.fromUserInput(message.maxRate, 18).atomics; + obj.max_change_rate = message.maxChangeRate === "" ? undefined : Decimal.fromUserInput(message.maxChangeRate, 18).atomics; return obj; }, fromAminoMsg(object: CommissionRatesAminoMsg): CommissionRates { @@ -1820,7 +1820,7 @@ export const Validator = { obj.jailed = message.jailed === false ? undefined : message.jailed; obj.status = message.status === 0 ? undefined : message.status; obj.tokens = message.tokens === "" ? undefined : message.tokens; - obj.delegator_shares = message.delegatorShares === "" ? undefined : message.delegatorShares; + obj.delegator_shares = message.delegatorShares === "" ? undefined : Decimal.fromUserInput(message.delegatorShares, 18).atomics; obj.description = message.description ? Description.toAmino(message.description) : undefined; obj.unbonding_height = message.unbondingHeight !== BigInt(0) ? message.unbondingHeight?.toString() : undefined; obj.unbonding_time = message.unbondingTime ? Timestamp.toAmino(toTimestamp(message.unbondingTime)) : undefined; @@ -2348,7 +2348,7 @@ export const Delegation = { const obj: any = {}; obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; - obj.shares = message.shares === "" ? undefined : message.shares; + obj.shares = message.shares === "" ? undefined : Decimal.fromUserInput(message.shares, 18).atomics; return obj; }, fromAminoMsg(object: DelegationAminoMsg): Delegation { @@ -2676,7 +2676,7 @@ export const RedelegationEntry = { obj.creation_height = message.creationHeight !== BigInt(0) ? message.creationHeight?.toString() : undefined; obj.completion_time = message.completionTime ? Timestamp.toAmino(toTimestamp(message.completionTime)) : undefined; obj.initial_balance = message.initialBalance === "" ? undefined : message.initialBalance; - obj.shares_dst = message.sharesDst === "" ? undefined : message.sharesDst; + obj.shares_dst = message.sharesDst === "" ? undefined : Decimal.fromUserInput(message.sharesDst, 18).atomics; return obj; }, fromAminoMsg(object: RedelegationEntryAminoMsg): RedelegationEntry { @@ -2927,7 +2927,7 @@ export const Params = { obj.max_entries = message.maxEntries === 0 ? undefined : message.maxEntries; obj.historical_entries = message.historicalEntries === 0 ? undefined : message.historicalEntries; obj.bond_denom = message.bondDenom === "" ? undefined : message.bondDenom; - obj.min_commission_rate = message.minCommissionRate === "" ? undefined : message.minCommissionRate; + obj.min_commission_rate = message.minCommissionRate === "" ? undefined : Decimal.fromUserInput(message.minCommissionRate, 18).atomics; return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputsign/cosmos/staking/v1beta1/tx.rpc.func.ts b/__fixtures__/v-next/outputsign/cosmos/staking/v1beta1/tx.rpc.func.ts new file mode 100644 index 0000000000..e16fa812df --- /dev/null +++ b/__fixtures__/v-next/outputsign/cosmos/staking/v1beta1/tx.rpc.func.ts @@ -0,0 +1,54 @@ +import { Description, DescriptionSDKType, CommissionRates, CommissionRatesSDKType } from "./staking"; +import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../google/protobuf/any"; +import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; +import { Timestamp, TimestampSDKType } from "../../../google/protobuf/timestamp"; +import { buildTx } from "../../../helper-func-types"; +import { MsgCreateValidator, MsgCreateValidatorSDKType, MsgCreateValidatorResponse, MsgCreateValidatorResponseSDKType, MsgEditValidator, MsgEditValidatorSDKType, MsgEditValidatorResponse, MsgEditValidatorResponseSDKType, MsgDelegate, MsgDelegateSDKType, MsgDelegateResponse, MsgDelegateResponseSDKType, MsgBeginRedelegate, MsgBeginRedelegateSDKType, MsgBeginRedelegateResponse, MsgBeginRedelegateResponseSDKType, MsgUndelegate, MsgUndelegateSDKType, MsgUndelegateResponse, MsgUndelegateResponseSDKType } from "./tx"; +/** + * CreateValidator defines a method for creating a new validator. + * @name createValidator + * @package cosmos.staking.v1beta1 + * @see proto service: cosmos.staking.v1beta1.CreateValidator + */ +export const createValidator = buildTx({ + msg: MsgCreateValidator +}); +/** + * EditValidator defines a method for editing an existing validator. + * @name editValidator + * @package cosmos.staking.v1beta1 + * @see proto service: cosmos.staking.v1beta1.EditValidator + */ +export const editValidator = buildTx({ + msg: MsgEditValidator +}); +/** + * Delegate defines a method for performing a delegation of coins + * from a delegator to a validator. + * @name delegate + * @package cosmos.staking.v1beta1 + * @see proto service: cosmos.staking.v1beta1.Delegate + */ +export const delegate = buildTx({ + msg: MsgDelegate +}); +/** + * BeginRedelegate defines a method for performing a redelegation + * of coins from a delegator and source validator to a destination validator. + * @name beginRedelegate + * @package cosmos.staking.v1beta1 + * @see proto service: cosmos.staking.v1beta1.BeginRedelegate + */ +export const beginRedelegate = buildTx({ + msg: MsgBeginRedelegate +}); +/** + * Undelegate defines a method for performing an undelegation from a + * delegate and a validator. + * @name undelegate + * @package cosmos.staking.v1beta1 + * @see proto service: cosmos.staking.v1beta1.Undelegate + */ +export const undelegate = buildTx({ + msg: MsgUndelegate +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputsign/cosmos/staking/v1beta1/tx.ts b/__fixtures__/v-next/outputsign/cosmos/staking/v1beta1/tx.ts index 66ded8b220..4a91dcebb9 100644 --- a/__fixtures__/v-next/outputsign/cosmos/staking/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputsign/cosmos/staking/v1beta1/tx.ts @@ -4,8 +4,8 @@ import { Coin, CoinAmino, CoinSDKType } from "../../base/v1beta1/coin"; import { Timestamp, TimestampAmino, TimestampSDKType } from "../../../google/protobuf/timestamp"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { DeepPartial, toTimestamp, fromTimestamp } from "../../../helpers"; -import { encodePubkey, decodePubkey } from "@cosmjs/proto-signing"; -import { Decimal } from "@cosmjs/math"; +import { encodePubkey, decodePubkey } from "@interchainjs/pubkey"; +import { Decimal } from "@interchainjs/math"; export const protobufPackage = "cosmos.staking.v1beta1"; /** * MsgCreateValidator defines a SDK message for creating a new validator. @@ -712,7 +712,7 @@ export const MsgEditValidator = { const obj: any = {}; obj.description = message.description ? Description.toAmino(message.description) : undefined; obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; - obj.commission_rate = message.commissionRate === "" ? undefined : message.commissionRate; + obj.commission_rate = message.commissionRate === "" ? undefined : Decimal.fromUserInput(message.commissionRate, 18).atomics; obj.min_self_delegation = message.minSelfDelegation === "" ? undefined : message.minSelfDelegation; return obj; }, diff --git a/__fixtures__/v-next/outputsign/cosmos/tx/v1beta1/service.rpc.func.ts b/__fixtures__/v-next/outputsign/cosmos/tx/v1beta1/service.rpc.func.ts new file mode 100644 index 0000000000..92ccd67aa3 --- /dev/null +++ b/__fixtures__/v-next/outputsign/cosmos/tx/v1beta1/service.rpc.func.ts @@ -0,0 +1,69 @@ +import { Tx, TxSDKType } from "./tx"; +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; +import { TxResponse, TxResponseSDKType, GasInfo, GasInfoSDKType, Result, ResultSDKType } from "../../base/abci/v1beta1/abci"; +import { BlockID, BlockIDSDKType } from "../../../tendermint/types/types"; +import { Block, BlockSDKType } from "../../../tendermint/types/block"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { SimulateRequest, SimulateRequestSDKType, SimulateResponse, SimulateResponseSDKType, GetTxRequest, GetTxRequestSDKType, GetTxResponse, GetTxResponseSDKType, BroadcastTxRequest, BroadcastTxRequestSDKType, BroadcastTxResponse, BroadcastTxResponseSDKType, GetTxsEventRequest, GetTxsEventRequestSDKType, GetTxsEventResponse, GetTxsEventResponseSDKType, GetBlockWithTxsRequest, GetBlockWithTxsRequestSDKType, GetBlockWithTxsResponse, GetBlockWithTxsResponseSDKType } from "./service"; +/** + * Simulate simulates executing a transaction for estimating gas usage. + * @name getSimulate + * @package cosmos.tx.v1beta1 + * @see proto service: cosmos.tx.v1beta1.Simulate + */ +export const getSimulate = buildQuery({ + encode: SimulateRequest.encode, + decode: SimulateResponse.decode, + service: "cosmos.tx.v1beta1.Service", + method: "Simulate" +}); +/** + * GetTx fetches a tx by hash. + * @name getGetTx + * @package cosmos.tx.v1beta1 + * @see proto service: cosmos.tx.v1beta1.GetTx + */ +export const getGetTx = buildQuery({ + encode: GetTxRequest.encode, + decode: GetTxResponse.decode, + service: "cosmos.tx.v1beta1.Service", + method: "GetTx" +}); +/** + * BroadcastTx broadcast transaction. + * @name getBroadcastTx + * @package cosmos.tx.v1beta1 + * @see proto service: cosmos.tx.v1beta1.BroadcastTx + */ +export const getBroadcastTx = buildQuery({ + encode: BroadcastTxRequest.encode, + decode: BroadcastTxResponse.decode, + service: "cosmos.tx.v1beta1.Service", + method: "BroadcastTx" +}); +/** + * GetTxsEvent fetches txs by event. + * @name getGetTxsEvent + * @package cosmos.tx.v1beta1 + * @see proto service: cosmos.tx.v1beta1.GetTxsEvent + */ +export const getGetTxsEvent = buildQuery({ + encode: GetTxsEventRequest.encode, + decode: GetTxsEventResponse.decode, + service: "cosmos.tx.v1beta1.Service", + method: "GetTxsEvent" +}); +/** + * GetBlockWithTxs fetches a block with decoded txs. + * + * Since: cosmos-sdk 0.45.2 + * @name getGetBlockWithTxs + * @package cosmos.tx.v1beta1 + * @see proto service: cosmos.tx.v1beta1.GetBlockWithTxs + */ +export const getGetBlockWithTxs = buildQuery({ + encode: GetBlockWithTxsRequest.encode, + decode: GetBlockWithTxsResponse.decode, + service: "cosmos.tx.v1beta1.Service", + method: "GetBlockWithTxs" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputsign/cosmos/upgrade/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputsign/cosmos/upgrade/v1beta1/query.rpc.func.ts new file mode 100644 index 0000000000..e3cbd36065 --- /dev/null +++ b/__fixtures__/v-next/outputsign/cosmos/upgrade/v1beta1/query.rpc.func.ts @@ -0,0 +1,71 @@ +import { Plan, PlanSDKType, ModuleVersion, ModuleVersionSDKType } from "./upgrade"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { QueryCurrentPlanRequest, QueryCurrentPlanRequestSDKType, QueryCurrentPlanResponse, QueryCurrentPlanResponseSDKType, QueryAppliedPlanRequest, QueryAppliedPlanRequestSDKType, QueryAppliedPlanResponse, QueryAppliedPlanResponseSDKType, QueryUpgradedConsensusStateRequest, QueryUpgradedConsensusStateRequestSDKType, QueryUpgradedConsensusStateResponse, QueryUpgradedConsensusStateResponseSDKType, QueryModuleVersionsRequest, QueryModuleVersionsRequestSDKType, QueryModuleVersionsResponse, QueryModuleVersionsResponseSDKType, QueryAuthorityRequest, QueryAuthorityRequestSDKType, QueryAuthorityResponse, QueryAuthorityResponseSDKType } from "./query"; +/** + * CurrentPlan queries the current upgrade plan. + * @name getCurrentPlan + * @package cosmos.upgrade.v1beta1 + * @see proto service: cosmos.upgrade.v1beta1.CurrentPlan + */ +export const getCurrentPlan = buildQuery({ + encode: QueryCurrentPlanRequest.encode, + decode: QueryCurrentPlanResponse.decode, + service: "cosmos.upgrade.v1beta1.Query", + method: "CurrentPlan" +}); +/** + * AppliedPlan queries a previously applied upgrade plan by its name. + * @name getAppliedPlan + * @package cosmos.upgrade.v1beta1 + * @see proto service: cosmos.upgrade.v1beta1.AppliedPlan + */ +export const getAppliedPlan = buildQuery({ + encode: QueryAppliedPlanRequest.encode, + decode: QueryAppliedPlanResponse.decode, + service: "cosmos.upgrade.v1beta1.Query", + method: "AppliedPlan" +}); +/** + * UpgradedConsensusState queries the consensus state that will serve + * as a trusted kernel for the next version of this chain. It will only be + * stored at the last height of this chain. + * UpgradedConsensusState RPC not supported with legacy querier + * This rpc is deprecated now that IBC has its own replacement + * (https://github.com/cosmos/ibc-go/blob/2c880a22e9f9cc75f62b527ca94aa75ce1106001/proto/ibc/core/client/v1/query.proto#L54) + * @name getUpgradedConsensusState + * @package cosmos.upgrade.v1beta1 + * @see proto service: cosmos.upgrade.v1beta1.UpgradedConsensusState + * @deprecated + */ +export const getUpgradedConsensusState = buildQuery({ + encode: QueryUpgradedConsensusStateRequest.encode, + decode: QueryUpgradedConsensusStateResponse.decode, + service: "cosmos.upgrade.v1beta1.Query", + method: "UpgradedConsensusState" +}); +/** + * ModuleVersions queries the list of module versions from state. + * + * Since: cosmos-sdk 0.43 + * @name getModuleVersions + * @package cosmos.upgrade.v1beta1 + * @see proto service: cosmos.upgrade.v1beta1.ModuleVersions + */ +export const getModuleVersions = buildQuery({ + encode: QueryModuleVersionsRequest.encode, + decode: QueryModuleVersionsResponse.decode, + service: "cosmos.upgrade.v1beta1.Query", + method: "ModuleVersions" +}); +/** + * Returns the account with authority to conduct upgrades + * @name getAuthority + * @package cosmos.upgrade.v1beta1 + * @see proto service: cosmos.upgrade.v1beta1.Authority + */ +export const getAuthority = buildQuery({ + encode: QueryAuthorityRequest.encode, + decode: QueryAuthorityResponse.decode, + service: "cosmos.upgrade.v1beta1.Query", + method: "Authority" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputsign/cosmos/upgrade/v1beta1/tx.rpc.func.ts b/__fixtures__/v-next/outputsign/cosmos/upgrade/v1beta1/tx.rpc.func.ts new file mode 100644 index 0000000000..ad84eeefb9 --- /dev/null +++ b/__fixtures__/v-next/outputsign/cosmos/upgrade/v1beta1/tx.rpc.func.ts @@ -0,0 +1,26 @@ +import { Plan, PlanSDKType } from "./upgrade"; +import { buildTx } from "../../../helper-func-types"; +import { MsgSoftwareUpgrade, MsgSoftwareUpgradeSDKType, MsgSoftwareUpgradeResponse, MsgSoftwareUpgradeResponseSDKType, MsgCancelUpgrade, MsgCancelUpgradeSDKType, MsgCancelUpgradeResponse, MsgCancelUpgradeResponseSDKType } from "./tx"; +/** + * SoftwareUpgrade is a governance operation for initiating a software upgrade. + * + * Since: cosmos-sdk 0.46 + * @name softwareUpgrade + * @package cosmos.upgrade.v1beta1 + * @see proto service: cosmos.upgrade.v1beta1.SoftwareUpgrade + */ +export const softwareUpgrade = buildTx({ + msg: MsgSoftwareUpgrade +}); +/** + * CancelUpgrade is a governance operation for cancelling a previously + * approvid software upgrade. + * + * Since: cosmos-sdk 0.46 + * @name cancelUpgrade + * @package cosmos.upgrade.v1beta1 + * @see proto service: cosmos.upgrade.v1beta1.CancelUpgrade + */ +export const cancelUpgrade = buildTx({ + msg: MsgCancelUpgrade +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputsign/cosmos/vesting/v1beta1/tx.rpc.func.ts b/__fixtures__/v-next/outputsign/cosmos/vesting/v1beta1/tx.rpc.func.ts new file mode 100644 index 0000000000..1e5c552640 --- /dev/null +++ b/__fixtures__/v-next/outputsign/cosmos/vesting/v1beta1/tx.rpc.func.ts @@ -0,0 +1,34 @@ +import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; +import { Period, PeriodSDKType } from "./vesting"; +import { buildTx } from "../../../helper-func-types"; +import { MsgCreateVestingAccount, MsgCreateVestingAccountSDKType, MsgCreateVestingAccountResponse, MsgCreateVestingAccountResponseSDKType, MsgCreatePermanentLockedAccount, MsgCreatePermanentLockedAccountSDKType, MsgCreatePermanentLockedAccountResponse, MsgCreatePermanentLockedAccountResponseSDKType, MsgCreatePeriodicVestingAccount, MsgCreatePeriodicVestingAccountSDKType, MsgCreatePeriodicVestingAccountResponse, MsgCreatePeriodicVestingAccountResponseSDKType } from "./tx"; +/** + * CreateVestingAccount defines a method that enables creating a vesting + * account. + * @name createVestingAccount + * @package cosmos.vesting.v1beta1 + * @see proto service: cosmos.vesting.v1beta1.CreateVestingAccount + */ +export const createVestingAccount = buildTx({ + msg: MsgCreateVestingAccount +}); +/** + * CreatePermanentLockedAccount defines a method that enables creating a permanent + * locked account. + * @name createPermanentLockedAccount + * @package cosmos.vesting.v1beta1 + * @see proto service: cosmos.vesting.v1beta1.CreatePermanentLockedAccount + */ +export const createPermanentLockedAccount = buildTx({ + msg: MsgCreatePermanentLockedAccount +}); +/** + * CreatePeriodicVestingAccount defines a method that enables creating a + * periodic vesting account. + * @name createPeriodicVestingAccount + * @package cosmos.vesting.v1beta1 + * @see proto service: cosmos.vesting.v1beta1.CreatePeriodicVestingAccount + */ +export const createPeriodicVestingAccount = buildTx({ + msg: MsgCreatePeriodicVestingAccount +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputsign/cosmwasm/bundle.ts b/__fixtures__/v-next/outputsign/cosmwasm/bundle.ts index 3cc96d9e49..5ce93aff23 100644 --- a/__fixtures__/v-next/outputsign/cosmwasm/bundle.ts +++ b/__fixtures__/v-next/outputsign/cosmwasm/bundle.ts @@ -4,14 +4,16 @@ import * as _149 from "./wasm/v1/proposal"; import * as _150 from "./wasm/v1/query"; import * as _151 from "./wasm/v1/tx"; import * as _152 from "./wasm/v1/types"; -import * as _434 from "./wasm/v1/tx.amino"; -import * as _435 from "./wasm/v1/tx.registry"; -import * as _436 from "./wasm/v1/query.lcd"; -import * as _437 from "./wasm/v1/query.rpc.Query"; -import * as _438 from "./wasm/v1/tx.rpc.msg"; -import * as _544 from "./lcd"; -import * as _545 from "./rpc.query"; -import * as _546 from "./rpc.tx"; +import * as _484 from "./wasm/v1/tx.amino"; +import * as _485 from "./wasm/v1/tx.registry"; +import * as _486 from "./wasm/v1/query.lcd"; +import * as _487 from "./wasm/v1/query.rpc.func"; +import * as _488 from "./wasm/v1/query.rpc.Query"; +import * as _489 from "./wasm/v1/tx.rpc.func"; +import * as _490 from "./wasm/v1/tx.rpc.msg"; +import * as _637 from "./lcd"; +import * as _638 from "./rpc.query"; +import * as _639 from "./rpc.tx"; export namespace cosmwasm { export namespace wasm { export const v1 = { @@ -21,16 +23,18 @@ export namespace cosmwasm { ..._150, ..._151, ..._152, - ..._434, - ..._435, - ..._436, - ..._437, - ..._438 + ..._484, + ..._485, + ..._486, + ..._487, + ..._488, + ..._489, + ..._490 }; } export const ClientFactory = { - ..._544, - ..._545, - ..._546 + ..._637, + ..._638, + ..._639 }; } \ No newline at end of file diff --git a/__fixtures__/v-next/outputsign/cosmwasm/wasm/v1/proposal.ts b/__fixtures__/v-next/outputsign/cosmwasm/wasm/v1/proposal.ts index 94d920da7b..a3331e1a62 100644 --- a/__fixtures__/v-next/outputsign/cosmwasm/wasm/v1/proposal.ts +++ b/__fixtures__/v-next/outputsign/cosmwasm/wasm/v1/proposal.ts @@ -2,7 +2,7 @@ import { AccessConfig, AccessConfigAmino, AccessConfigSDKType } from "./types"; import { Coin, CoinAmino, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { DeepPartial } from "../../../helpers"; -import { fromBase64, toBase64, toUtf8, fromUtf8 } from "@cosmjs/encoding"; +import { fromBase64, toBase64, toUtf8, fromUtf8 } from "@interchainjs/encoding"; export const protobufPackage = "cosmwasm.wasm.v1"; /** * StoreCodeProposal gov proposal content type to submit WASM code to the system diff --git a/__fixtures__/v-next/outputsign/cosmwasm/wasm/v1/query.rpc.func.ts b/__fixtures__/v-next/outputsign/cosmwasm/wasm/v1/query.rpc.func.ts new file mode 100644 index 0000000000..80787742a4 --- /dev/null +++ b/__fixtures__/v-next/outputsign/cosmwasm/wasm/v1/query.rpc.func.ts @@ -0,0 +1,112 @@ +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination"; +import { ContractInfo, ContractInfoSDKType, ContractCodeHistoryEntry, ContractCodeHistoryEntrySDKType, Model, ModelSDKType } from "./types"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { QueryContractInfoRequest, QueryContractInfoRequestSDKType, QueryContractInfoResponse, QueryContractInfoResponseSDKType, QueryContractHistoryRequest, QueryContractHistoryRequestSDKType, QueryContractHistoryResponse, QueryContractHistoryResponseSDKType, QueryContractsByCodeRequest, QueryContractsByCodeRequestSDKType, QueryContractsByCodeResponse, QueryContractsByCodeResponseSDKType, QueryAllContractStateRequest, QueryAllContractStateRequestSDKType, QueryAllContractStateResponse, QueryAllContractStateResponseSDKType, QueryRawContractStateRequest, QueryRawContractStateRequestSDKType, QueryRawContractStateResponse, QueryRawContractStateResponseSDKType, QuerySmartContractStateRequest, QuerySmartContractStateRequestSDKType, QuerySmartContractStateResponse, QuerySmartContractStateResponseSDKType, QueryCodeRequest, QueryCodeRequestSDKType, QueryCodeResponse, QueryCodeResponseSDKType, QueryCodesRequest, QueryCodesRequestSDKType, QueryCodesResponse, QueryCodesResponseSDKType, QueryPinnedCodesRequest, QueryPinnedCodesRequestSDKType, QueryPinnedCodesResponse, QueryPinnedCodesResponseSDKType } from "./query"; +/** + * ContractInfo gets the contract meta data + * @name getContractInfo + * @package cosmwasm.wasm.v1 + * @see proto service: cosmwasm.wasm.v1.ContractInfo + */ +export const getContractInfo = buildQuery({ + encode: QueryContractInfoRequest.encode, + decode: QueryContractInfoResponse.decode, + service: "cosmwasm.wasm.v1.Query", + method: "ContractInfo" +}); +/** + * ContractHistory gets the contract code history + * @name getContractHistory + * @package cosmwasm.wasm.v1 + * @see proto service: cosmwasm.wasm.v1.ContractHistory + */ +export const getContractHistory = buildQuery({ + encode: QueryContractHistoryRequest.encode, + decode: QueryContractHistoryResponse.decode, + service: "cosmwasm.wasm.v1.Query", + method: "ContractHistory" +}); +/** + * ContractsByCode lists all smart contracts for a code id + * @name getContractsByCode + * @package cosmwasm.wasm.v1 + * @see proto service: cosmwasm.wasm.v1.ContractsByCode + */ +export const getContractsByCode = buildQuery({ + encode: QueryContractsByCodeRequest.encode, + decode: QueryContractsByCodeResponse.decode, + service: "cosmwasm.wasm.v1.Query", + method: "ContractsByCode" +}); +/** + * AllContractState gets all raw store data for a single contract + * @name getAllContractState + * @package cosmwasm.wasm.v1 + * @see proto service: cosmwasm.wasm.v1.AllContractState + */ +export const getAllContractState = buildQuery({ + encode: QueryAllContractStateRequest.encode, + decode: QueryAllContractStateResponse.decode, + service: "cosmwasm.wasm.v1.Query", + method: "AllContractState" +}); +/** + * RawContractState gets single key from the raw store data of a contract + * @name getRawContractState + * @package cosmwasm.wasm.v1 + * @see proto service: cosmwasm.wasm.v1.RawContractState + */ +export const getRawContractState = buildQuery({ + encode: QueryRawContractStateRequest.encode, + decode: QueryRawContractStateResponse.decode, + service: "cosmwasm.wasm.v1.Query", + method: "RawContractState" +}); +/** + * SmartContractState get smart query result from the contract + * @name getSmartContractState + * @package cosmwasm.wasm.v1 + * @see proto service: cosmwasm.wasm.v1.SmartContractState + */ +export const getSmartContractState = buildQuery({ + encode: QuerySmartContractStateRequest.encode, + decode: QuerySmartContractStateResponse.decode, + service: "cosmwasm.wasm.v1.Query", + method: "SmartContractState" +}); +/** + * Code gets the binary code and metadata for a singe wasm code + * @name getCode + * @package cosmwasm.wasm.v1 + * @see proto service: cosmwasm.wasm.v1.Code + */ +export const getCode = buildQuery({ + encode: QueryCodeRequest.encode, + decode: QueryCodeResponse.decode, + service: "cosmwasm.wasm.v1.Query", + method: "Code" +}); +/** + * Codes gets the metadata for all stored wasm codes + * @name getCodes + * @package cosmwasm.wasm.v1 + * @see proto service: cosmwasm.wasm.v1.Codes + */ +export const getCodes = buildQuery({ + encode: QueryCodesRequest.encode, + decode: QueryCodesResponse.decode, + service: "cosmwasm.wasm.v1.Query", + method: "Codes" +}); +/** + * PinnedCodes gets the pinned code ids + * @name getPinnedCodes + * @package cosmwasm.wasm.v1 + * @see proto service: cosmwasm.wasm.v1.PinnedCodes + */ +export const getPinnedCodes = buildQuery({ + encode: QueryPinnedCodesRequest.encode, + decode: QueryPinnedCodesResponse.decode, + service: "cosmwasm.wasm.v1.Query", + method: "PinnedCodes" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputsign/cosmwasm/wasm/v1/query.ts b/__fixtures__/v-next/outputsign/cosmwasm/wasm/v1/query.ts index 56ac746425..857df90d95 100644 --- a/__fixtures__/v-next/outputsign/cosmwasm/wasm/v1/query.ts +++ b/__fixtures__/v-next/outputsign/cosmwasm/wasm/v1/query.ts @@ -2,7 +2,7 @@ import { PageRequest, PageRequestAmino, PageRequestSDKType, PageResponse, PageRe import { ContractInfo, ContractInfoAmino, ContractInfoSDKType, ContractCodeHistoryEntry, ContractCodeHistoryEntryAmino, ContractCodeHistoryEntrySDKType, Model, ModelAmino, ModelSDKType } from "./types"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { DeepPartial, bytesFromBase64, base64FromBytes } from "../../../helpers"; -import { toUtf8, fromUtf8 } from "@cosmjs/encoding"; +import { toUtf8, fromUtf8 } from "@interchainjs/encoding"; export const protobufPackage = "cosmwasm.wasm.v1"; /** * QueryContractInfoRequest is the request type for the Query/ContractInfo RPC diff --git a/__fixtures__/v-next/outputsign/cosmwasm/wasm/v1/tx.rpc.func.ts b/__fixtures__/v-next/outputsign/cosmwasm/wasm/v1/tx.rpc.func.ts new file mode 100644 index 0000000000..1faf1de1bf --- /dev/null +++ b/__fixtures__/v-next/outputsign/cosmwasm/wasm/v1/tx.rpc.func.ts @@ -0,0 +1,58 @@ +import { AccessConfig, AccessConfigSDKType } from "./types"; +import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; +import { buildTx } from "../../../helper-func-types"; +import { MsgStoreCode, MsgStoreCodeSDKType, MsgStoreCodeResponse, MsgStoreCodeResponseSDKType, MsgInstantiateContract, MsgInstantiateContractSDKType, MsgInstantiateContractResponse, MsgInstantiateContractResponseSDKType, MsgExecuteContract, MsgExecuteContractSDKType, MsgExecuteContractResponse, MsgExecuteContractResponseSDKType, MsgMigrateContract, MsgMigrateContractSDKType, MsgMigrateContractResponse, MsgMigrateContractResponseSDKType, MsgUpdateAdmin, MsgUpdateAdminSDKType, MsgUpdateAdminResponse, MsgUpdateAdminResponseSDKType, MsgClearAdmin, MsgClearAdminSDKType, MsgClearAdminResponse, MsgClearAdminResponseSDKType } from "./tx"; +/** + * StoreCode to submit Wasm code to the system + * @name storeCode + * @package cosmwasm.wasm.v1 + * @see proto service: cosmwasm.wasm.v1.StoreCode + */ +export const storeCode = buildTx({ + msg: MsgStoreCode +}); +/** + * Instantiate creates a new smart contract instance for the given code id. + * @name instantiateContract + * @package cosmwasm.wasm.v1 + * @see proto service: cosmwasm.wasm.v1.InstantiateContract + */ +export const instantiateContract = buildTx({ + msg: MsgInstantiateContract +}); +/** + * Execute submits the given message data to a smart contract + * @name executeContract + * @package cosmwasm.wasm.v1 + * @see proto service: cosmwasm.wasm.v1.ExecuteContract + */ +export const executeContract = buildTx({ + msg: MsgExecuteContract +}); +/** + * Migrate runs a code upgrade/ downgrade for a smart contract + * @name migrateContract + * @package cosmwasm.wasm.v1 + * @see proto service: cosmwasm.wasm.v1.MigrateContract + */ +export const migrateContract = buildTx({ + msg: MsgMigrateContract +}); +/** + * UpdateAdmin sets a new admin for a smart contract + * @name updateAdmin + * @package cosmwasm.wasm.v1 + * @see proto service: cosmwasm.wasm.v1.UpdateAdmin + */ +export const updateAdmin = buildTx({ + msg: MsgUpdateAdmin +}); +/** + * ClearAdmin removes any admin stored for a smart contract + * @name clearAdmin + * @package cosmwasm.wasm.v1 + * @see proto service: cosmwasm.wasm.v1.ClearAdmin + */ +export const clearAdmin = buildTx({ + msg: MsgClearAdmin +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputsign/cosmwasm/wasm/v1/tx.ts b/__fixtures__/v-next/outputsign/cosmwasm/wasm/v1/tx.ts index 52f268be81..5b295e98cf 100644 --- a/__fixtures__/v-next/outputsign/cosmwasm/wasm/v1/tx.ts +++ b/__fixtures__/v-next/outputsign/cosmwasm/wasm/v1/tx.ts @@ -2,7 +2,7 @@ import { AccessConfig, AccessConfigAmino, AccessConfigSDKType } from "./types"; import { Coin, CoinAmino, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { DeepPartial, bytesFromBase64, base64FromBytes } from "../../../helpers"; -import { fromBase64, toBase64, toUtf8, fromUtf8 } from "@cosmjs/encoding"; +import { fromBase64, toBase64, toUtf8, fromUtf8 } from "@interchainjs/encoding"; export const protobufPackage = "cosmwasm.wasm.v1"; /** * MsgStoreCode submit Wasm code to the system diff --git a/__fixtures__/v-next/outputsign/cosmwasm/wasm/v1/types.ts b/__fixtures__/v-next/outputsign/cosmwasm/wasm/v1/types.ts index cd884e418f..9c91fc8a91 100644 --- a/__fixtures__/v-next/outputsign/cosmwasm/wasm/v1/types.ts +++ b/__fixtures__/v-next/outputsign/cosmwasm/wasm/v1/types.ts @@ -1,7 +1,7 @@ import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../google/protobuf/any"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { DeepPartial, bytesFromBase64, base64FromBytes } from "../../../helpers"; -import { toUtf8, fromUtf8 } from "@cosmjs/encoding"; +import { toUtf8, fromUtf8 } from "@interchainjs/encoding"; export const protobufPackage = "cosmwasm.wasm.v1"; /** AccessType permission types */ export enum AccessType { diff --git a/__fixtures__/v-next/outputsign/evmos/bundle.ts b/__fixtures__/v-next/outputsign/evmos/bundle.ts index afa209d271..f52b9e400a 100644 --- a/__fixtures__/v-next/outputsign/evmos/bundle.ts +++ b/__fixtures__/v-next/outputsign/evmos/bundle.ts @@ -22,54 +22,67 @@ import * as _173 from "./recovery/v1/query"; import * as _174 from "./vesting/v1/query"; import * as _175 from "./vesting/v1/tx"; import * as _176 from "./vesting/v1/vesting"; -import * as _439 from "./erc20/v1/tx.amino"; -import * as _440 from "./fees/v1/tx.amino"; -import * as _441 from "./vesting/v1/tx.amino"; -import * as _442 from "./erc20/v1/tx.registry"; -import * as _443 from "./fees/v1/tx.registry"; -import * as _444 from "./vesting/v1/tx.registry"; -import * as _445 from "./claims/v1/query.lcd"; -import * as _446 from "./epochs/v1/query.lcd"; -import * as _447 from "./erc20/v1/query.lcd"; -import * as _448 from "./fees/v1/query.lcd"; -import * as _449 from "./incentives/v1/query.lcd"; -import * as _450 from "./inflation/v1/query.lcd"; -import * as _451 from "./recovery/v1/query.lcd"; -import * as _452 from "./vesting/v1/query.lcd"; -import * as _453 from "./claims/v1/query.rpc.Query"; -import * as _454 from "./epochs/v1/query.rpc.Query"; -import * as _455 from "./erc20/v1/query.rpc.Query"; -import * as _456 from "./fees/v1/query.rpc.Query"; -import * as _457 from "./incentives/v1/query.rpc.Query"; -import * as _458 from "./inflation/v1/query.rpc.Query"; -import * as _459 from "./recovery/v1/query.rpc.Query"; -import * as _460 from "./vesting/v1/query.rpc.Query"; -import * as _461 from "./erc20/v1/tx.rpc.msg"; -import * as _462 from "./fees/v1/tx.rpc.msg"; -import * as _463 from "./vesting/v1/tx.rpc.msg"; -import * as _464 from "./erc20/v1/query.pinia.store"; -import * as _547 from "./lcd"; -import * as _548 from "./custom-lcd-client"; -import * as _549 from "./rpc.query"; -import * as _550 from "./evmos-rpc-client.query"; -import * as _551 from "./rpc.tx"; -import * as _552 from "./evmos-rpc-client.tx"; +import * as _491 from "./erc20/v1/tx.amino"; +import * as _492 from "./fees/v1/tx.amino"; +import * as _493 from "./vesting/v1/tx.amino"; +import * as _494 from "./erc20/v1/tx.registry"; +import * as _495 from "./fees/v1/tx.registry"; +import * as _496 from "./vesting/v1/tx.registry"; +import * as _497 from "./claims/v1/query.lcd"; +import * as _498 from "./epochs/v1/query.lcd"; +import * as _499 from "./erc20/v1/query.lcd"; +import * as _500 from "./fees/v1/query.lcd"; +import * as _501 from "./incentives/v1/query.lcd"; +import * as _502 from "./inflation/v1/query.lcd"; +import * as _503 from "./recovery/v1/query.lcd"; +import * as _504 from "./vesting/v1/query.lcd"; +import * as _505 from "./claims/v1/query.rpc.func"; +import * as _506 from "./epochs/v1/query.rpc.func"; +import * as _507 from "./erc20/v1/query.rpc.func"; +import * as _508 from "./fees/v1/query.rpc.func"; +import * as _509 from "./incentives/v1/query.rpc.func"; +import * as _510 from "./inflation/v1/query.rpc.func"; +import * as _511 from "./recovery/v1/query.rpc.func"; +import * as _512 from "./vesting/v1/query.rpc.func"; +import * as _513 from "./claims/v1/query.rpc.Query"; +import * as _514 from "./epochs/v1/query.rpc.Query"; +import * as _515 from "./erc20/v1/query.rpc.Query"; +import * as _516 from "./fees/v1/query.rpc.Query"; +import * as _517 from "./incentives/v1/query.rpc.Query"; +import * as _518 from "./inflation/v1/query.rpc.Query"; +import * as _519 from "./recovery/v1/query.rpc.Query"; +import * as _520 from "./vesting/v1/query.rpc.Query"; +import * as _521 from "./erc20/v1/tx.rpc.func"; +import * as _522 from "./fees/v1/tx.rpc.func"; +import * as _523 from "./vesting/v1/tx.rpc.func"; +import * as _524 from "./erc20/v1/tx.rpc.msg"; +import * as _525 from "./fees/v1/tx.rpc.msg"; +import * as _526 from "./vesting/v1/tx.rpc.msg"; +import * as _527 from "./erc20/v1/query.pinia.store"; +import * as _640 from "./lcd"; +import * as _641 from "./custom-lcd-client"; +import * as _642 from "./rpc.query"; +import * as _643 from "./evmos-rpc-client.query"; +import * as _644 from "./rpc.tx"; +import * as _645 from "./evmos-rpc-client.tx"; export namespace evmos { export namespace claims { export const v1 = { ..._153, ..._154, ..._155, - ..._445, - ..._453 + ..._497, + ..._505, + ..._513 }; } export namespace epochs { export const v1 = { ..._156, ..._157, - ..._446, - ..._454 + ..._498, + ..._506, + ..._514 }; } export namespace erc20 { @@ -78,12 +91,14 @@ export namespace evmos { ..._159, ..._160, ..._161, - ..._439, - ..._442, - ..._447, - ..._455, - ..._461, - ..._464 + ..._491, + ..._494, + ..._499, + ..._507, + ..._515, + ..._521, + ..._524, + ..._527 }; } export namespace fees { @@ -92,11 +107,13 @@ export namespace evmos { ..._163, ..._164, ..._165, - ..._440, - ..._443, - ..._448, - ..._456, - ..._462 + ..._492, + ..._495, + ..._500, + ..._508, + ..._516, + ..._522, + ..._525 }; } export namespace incentives { @@ -104,8 +121,9 @@ export namespace evmos { ..._166, ..._167, ..._168, - ..._449, - ..._457 + ..._501, + ..._509, + ..._517 }; } export namespace inflation { @@ -113,16 +131,18 @@ export namespace evmos { ..._169, ..._170, ..._171, - ..._450, - ..._458 + ..._502, + ..._510, + ..._518 }; } export namespace recovery { export const v1 = { ..._172, ..._173, - ..._451, - ..._459 + ..._503, + ..._511, + ..._519 }; } export namespace vesting { @@ -130,19 +150,21 @@ export namespace evmos { ..._174, ..._175, ..._176, - ..._441, - ..._444, - ..._452, - ..._460, - ..._463 + ..._493, + ..._496, + ..._504, + ..._512, + ..._520, + ..._523, + ..._526 }; } export const ClientFactory = { - ..._547, - ..._548, - ..._549, - ..._550, - ..._551, - ..._552 + ..._640, + ..._641, + ..._642, + ..._643, + ..._644, + ..._645 }; } \ No newline at end of file diff --git a/__fixtures__/v-next/outputsign/evmos/claims/v1/query.rpc.func.ts b/__fixtures__/v-next/outputsign/evmos/claims/v1/query.rpc.func.ts new file mode 100644 index 0000000000..f4add38251 --- /dev/null +++ b/__fixtures__/v-next/outputsign/evmos/claims/v1/query.rpc.func.ts @@ -0,0 +1,54 @@ +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination"; +import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; +import { Params, ParamsSDKType } from "./genesis"; +import { ClaimsRecordAddress, ClaimsRecordAddressSDKType, Claim, ClaimSDKType } from "./claims"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { QueryTotalUnclaimedRequest, QueryTotalUnclaimedRequestSDKType, QueryTotalUnclaimedResponse, QueryTotalUnclaimedResponseSDKType, QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, QueryClaimsRecordsRequest, QueryClaimsRecordsRequestSDKType, QueryClaimsRecordsResponse, QueryClaimsRecordsResponseSDKType, QueryClaimsRecordRequest, QueryClaimsRecordRequestSDKType, QueryClaimsRecordResponse, QueryClaimsRecordResponseSDKType } from "./query"; +/** + * TotalUnclaimed queries the total unclaimed tokens from the airdrop + * @name getTotalUnclaimed + * @package evmos.claims.v1 + * @see proto service: evmos.claims.v1.TotalUnclaimed + */ +export const getTotalUnclaimed = buildQuery({ + encode: QueryTotalUnclaimedRequest.encode, + decode: QueryTotalUnclaimedResponse.decode, + service: "evmos.claims.v1.Query", + method: "TotalUnclaimed" +}); +/** + * Params returns the claims module parameters + * @name getParams + * @package evmos.claims.v1 + * @see proto service: evmos.claims.v1.Params + */ +export const getParams = buildQuery({ + encode: QueryParamsRequest.encode, + decode: QueryParamsResponse.decode, + service: "evmos.claims.v1.Query", + method: "Params" +}); +/** + * ClaimsRecords returns all claims records + * @name getClaimsRecords + * @package evmos.claims.v1 + * @see proto service: evmos.claims.v1.ClaimsRecords + */ +export const getClaimsRecords = buildQuery({ + encode: QueryClaimsRecordsRequest.encode, + decode: QueryClaimsRecordsResponse.decode, + service: "evmos.claims.v1.Query", + method: "ClaimsRecords" +}); +/** + * ClaimsRecord returns the claims record for a given address + * @name getClaimsRecord + * @package evmos.claims.v1 + * @see proto service: evmos.claims.v1.ClaimsRecord + */ +export const getClaimsRecord = buildQuery({ + encode: QueryClaimsRecordRequest.encode, + decode: QueryClaimsRecordResponse.decode, + service: "evmos.claims.v1.Query", + method: "ClaimsRecord" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputsign/evmos/epochs/v1/query.rpc.func.ts b/__fixtures__/v-next/outputsign/evmos/epochs/v1/query.rpc.func.ts new file mode 100644 index 0000000000..feef14872a --- /dev/null +++ b/__fixtures__/v-next/outputsign/evmos/epochs/v1/query.rpc.func.ts @@ -0,0 +1,28 @@ +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination"; +import { EpochInfo, EpochInfoSDKType } from "./genesis"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { QueryEpochsInfoRequest, QueryEpochsInfoRequestSDKType, QueryEpochsInfoResponse, QueryEpochsInfoResponseSDKType, QueryCurrentEpochRequest, QueryCurrentEpochRequestSDKType, QueryCurrentEpochResponse, QueryCurrentEpochResponseSDKType } from "./query"; +/** + * EpochInfos provide running epochInfos + * @name getEpochInfos + * @package evmos.epochs.v1 + * @see proto service: evmos.epochs.v1.EpochInfos + */ +export const getEpochInfos = buildQuery({ + encode: QueryEpochsInfoRequest.encode, + decode: QueryEpochsInfoResponse.decode, + service: "evmos.epochs.v1.Query", + method: "EpochInfos" +}); +/** + * CurrentEpoch provide current epoch of specified identifier + * @name getCurrentEpoch + * @package evmos.epochs.v1 + * @see proto service: evmos.epochs.v1.CurrentEpoch + */ +export const getCurrentEpoch = buildQuery({ + encode: QueryCurrentEpochRequest.encode, + decode: QueryCurrentEpochResponse.decode, + service: "evmos.epochs.v1.Query", + method: "CurrentEpoch" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputsign/evmos/erc20/v1/query.rpc.func.ts b/__fixtures__/v-next/outputsign/evmos/erc20/v1/query.rpc.func.ts new file mode 100644 index 0000000000..e2c4310faa --- /dev/null +++ b/__fixtures__/v-next/outputsign/evmos/erc20/v1/query.rpc.func.ts @@ -0,0 +1,41 @@ +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination"; +import { TokenPair, TokenPairSDKType } from "./erc20"; +import { Params, ParamsSDKType } from "./genesis"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { QueryTokenPairsRequest, QueryTokenPairsRequestSDKType, QueryTokenPairsResponse, QueryTokenPairsResponseSDKType, QueryTokenPairRequest, QueryTokenPairRequestSDKType, QueryTokenPairResponse, QueryTokenPairResponseSDKType, QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType } from "./query"; +/** + * TokenPairs retrieves registered token pairs + * @name getTokenPairs + * @package evmos.erc20.v1 + * @see proto service: evmos.erc20.v1.TokenPairs + */ +export const getTokenPairs = buildQuery({ + encode: QueryTokenPairsRequest.encode, + decode: QueryTokenPairsResponse.decode, + service: "evmos.erc20.v1.Query", + method: "TokenPairs" +}); +/** + * TokenPair retrieves a registered token pair + * @name getTokenPair + * @package evmos.erc20.v1 + * @see proto service: evmos.erc20.v1.TokenPair + */ +export const getTokenPair = buildQuery({ + encode: QueryTokenPairRequest.encode, + decode: QueryTokenPairResponse.decode, + service: "evmos.erc20.v1.Query", + method: "TokenPair" +}); +/** + * Params retrieves the erc20 module params + * @name getParams + * @package evmos.erc20.v1 + * @see proto service: evmos.erc20.v1.Params + */ +export const getParams = buildQuery({ + encode: QueryParamsRequest.encode, + decode: QueryParamsResponse.decode, + service: "evmos.erc20.v1.Query", + method: "Params" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputsign/evmos/erc20/v1/tx.rpc.func.ts b/__fixtures__/v-next/outputsign/evmos/erc20/v1/tx.rpc.func.ts new file mode 100644 index 0000000000..98c71c793d --- /dev/null +++ b/__fixtures__/v-next/outputsign/evmos/erc20/v1/tx.rpc.func.ts @@ -0,0 +1,23 @@ +import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; +import { buildTx } from "../../../helper-func-types"; +import { MsgConvertCoin, MsgConvertCoinSDKType, MsgConvertCoinResponse, MsgConvertCoinResponseSDKType, MsgConvertERC20, MsgConvertERC20SDKType, MsgConvertERC20Response, MsgConvertERC20ResponseSDKType } from "./tx"; +/** + * ConvertCoin mints a ERC20 representation of the native Cosmos coin denom + * that is registered on the token mapping. + * @name convertCoin + * @package evmos.erc20.v1 + * @see proto service: evmos.erc20.v1.ConvertCoin + */ +export const convertCoin = buildTx({ + msg: MsgConvertCoin +}); +/** + * ConvertERC20 mints a native Cosmos coin representation of the ERC20 token + * contract that is registered on the token mapping. + * @name convertERC20 + * @package evmos.erc20.v1 + * @see proto service: evmos.erc20.v1.ConvertERC20 + */ +export const convertERC20 = buildTx({ + msg: MsgConvertERC20 +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputsign/evmos/fees/v1/genesis.ts b/__fixtures__/v-next/outputsign/evmos/fees/v1/genesis.ts index 668ea9a6a5..429f31ec76 100644 --- a/__fixtures__/v-next/outputsign/evmos/fees/v1/genesis.ts +++ b/__fixtures__/v-next/outputsign/evmos/fees/v1/genesis.ts @@ -1,7 +1,7 @@ import { DevFeeInfo, DevFeeInfoAmino, DevFeeInfoSDKType } from "./fees"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { DeepPartial } from "../../../helpers"; -import { Decimal } from "@cosmjs/math"; +import { Decimal } from "@interchainjs/math"; export const protobufPackage = "evmos.fees.v1"; /** * GenesisState defines the module's genesis state. @@ -318,10 +318,10 @@ export const Params = { toAmino(message: Params): ParamsAmino { const obj: any = {}; obj.enable_fees = message.enableFees === false ? undefined : message.enableFees; - obj.developer_shares = message.developerShares === "" ? undefined : message.developerShares; - obj.validator_shares = message.validatorShares === "" ? undefined : message.validatorShares; + obj.developer_shares = message.developerShares === "" ? undefined : Decimal.fromUserInput(message.developerShares, 18).atomics; + obj.validator_shares = message.validatorShares === "" ? undefined : Decimal.fromUserInput(message.validatorShares, 18).atomics; obj.addr_derivation_cost_create = message.addrDerivationCostCreate !== BigInt(0) ? message.addrDerivationCostCreate?.toString() : undefined; - obj.min_gas_price = message.minGasPrice === "" ? undefined : message.minGasPrice; + obj.min_gas_price = message.minGasPrice === "" ? undefined : Decimal.fromUserInput(message.minGasPrice, 18).atomics; return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputsign/evmos/fees/v1/query.rpc.func.ts b/__fixtures__/v-next/outputsign/evmos/fees/v1/query.rpc.func.ts new file mode 100644 index 0000000000..bfa56fcc9d --- /dev/null +++ b/__fixtures__/v-next/outputsign/evmos/fees/v1/query.rpc.func.ts @@ -0,0 +1,54 @@ +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination"; +import { DevFeeInfo, DevFeeInfoSDKType } from "./fees"; +import { Params, ParamsSDKType } from "./genesis"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { QueryDevFeeInfosRequest, QueryDevFeeInfosRequestSDKType, QueryDevFeeInfosResponse, QueryDevFeeInfosResponseSDKType, QueryDevFeeInfoRequest, QueryDevFeeInfoRequestSDKType, QueryDevFeeInfoResponse, QueryDevFeeInfoResponseSDKType, QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, QueryDevFeeInfosPerDeployerRequest, QueryDevFeeInfosPerDeployerRequestSDKType, QueryDevFeeInfosPerDeployerResponse, QueryDevFeeInfosPerDeployerResponseSDKType } from "./query"; +/** + * DevFeeInfos retrieves all registered contracts for fee distribution + * @name getDevFeeInfos + * @package evmos.fees.v1 + * @see proto service: evmos.fees.v1.DevFeeInfos + */ +export const getDevFeeInfos = buildQuery({ + encode: QueryDevFeeInfosRequest.encode, + decode: QueryDevFeeInfosResponse.decode, + service: "evmos.fees.v1.Query", + method: "DevFeeInfos" +}); +/** + * DevFeeInfo retrieves a registered contract for fee distribution + * @name getDevFeeInfo + * @package evmos.fees.v1 + * @see proto service: evmos.fees.v1.DevFeeInfo + */ +export const getDevFeeInfo = buildQuery({ + encode: QueryDevFeeInfoRequest.encode, + decode: QueryDevFeeInfoResponse.decode, + service: "evmos.fees.v1.Query", + method: "DevFeeInfo" +}); +/** + * Params retrieves the fees module params + * @name getParams + * @package evmos.fees.v1 + * @see proto service: evmos.fees.v1.Params + */ +export const getParams = buildQuery({ + encode: QueryParamsRequest.encode, + decode: QueryParamsResponse.decode, + service: "evmos.fees.v1.Query", + method: "Params" +}); +/** + * DevFeeInfosPerDeployer retrieves all contracts that a deployer has + * registered for fee distribution + * @name getDevFeeInfosPerDeployer + * @package evmos.fees.v1 + * @see proto service: evmos.fees.v1.DevFeeInfosPerDeployer + */ +export const getDevFeeInfosPerDeployer = buildQuery({ + encode: QueryDevFeeInfosPerDeployerRequest.encode, + decode: QueryDevFeeInfosPerDeployerResponse.decode, + service: "evmos.fees.v1.Query", + method: "DevFeeInfosPerDeployer" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputsign/evmos/fees/v1/tx.rpc.func.ts b/__fixtures__/v-next/outputsign/evmos/fees/v1/tx.rpc.func.ts new file mode 100644 index 0000000000..150928bee9 --- /dev/null +++ b/__fixtures__/v-next/outputsign/evmos/fees/v1/tx.rpc.func.ts @@ -0,0 +1,31 @@ +import { buildTx } from "../../../helper-func-types"; +import { MsgRegisterDevFeeInfo, MsgRegisterDevFeeInfoSDKType, MsgRegisterDevFeeInfoResponse, MsgRegisterDevFeeInfoResponseSDKType, MsgCancelDevFeeInfo, MsgCancelDevFeeInfoSDKType, MsgCancelDevFeeInfoResponse, MsgCancelDevFeeInfoResponseSDKType, MsgUpdateDevFeeInfo, MsgUpdateDevFeeInfoSDKType, MsgUpdateDevFeeInfoResponse, MsgUpdateDevFeeInfoResponseSDKType } from "./tx"; +/** + * RegisterDevFeeInfo is used by a deployer to register a new contract for + * receiving transaction fees + * @name registerDevFeeInfo + * @package evmos.fees.v1 + * @see proto service: evmos.fees.v1.RegisterDevFeeInfo + */ +export const registerDevFeeInfo = buildTx({ + msg: MsgRegisterDevFeeInfo +}); +/** + * CancelDevFeeInfo is used by a deployer to cancel a registered contract + * and stop receiving transaction fees + * @name cancelDevFeeInfo + * @package evmos.fees.v1 + * @see proto service: evmos.fees.v1.CancelDevFeeInfo + */ +export const cancelDevFeeInfo = buildTx({ + msg: MsgCancelDevFeeInfo +}); +/** + * UpdateDevFeeInfo is used by a deployer to update the withdraw address + * @name updateDevFeeInfo + * @package evmos.fees.v1 + * @see proto service: evmos.fees.v1.UpdateDevFeeInfo + */ +export const updateDevFeeInfo = buildTx({ + msg: MsgUpdateDevFeeInfo +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputsign/evmos/incentives/v1/genesis.ts b/__fixtures__/v-next/outputsign/evmos/incentives/v1/genesis.ts index ea9a6c381e..fd5884d0f6 100644 --- a/__fixtures__/v-next/outputsign/evmos/incentives/v1/genesis.ts +++ b/__fixtures__/v-next/outputsign/evmos/incentives/v1/genesis.ts @@ -1,7 +1,7 @@ import { Incentive, IncentiveAmino, IncentiveSDKType, GasMeter, GasMeterAmino, GasMeterSDKType } from "./incentives"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { DeepPartial } from "../../../helpers"; -import { Decimal } from "@cosmjs/math"; +import { Decimal } from "@interchainjs/math"; export const protobufPackage = "evmos.incentives.v1"; /** * GenesisState defines the module's genesis state. @@ -313,9 +313,9 @@ export const Params = { toAmino(message: Params): ParamsAmino { const obj: any = {}; obj.enable_incentives = message.enableIncentives === false ? undefined : message.enableIncentives; - obj.allocation_limit = message.allocationLimit === "" ? undefined : message.allocationLimit; + obj.allocation_limit = message.allocationLimit === "" ? undefined : Decimal.fromUserInput(message.allocationLimit, 18).atomics; obj.incentives_epoch_identifier = message.incentivesEpochIdentifier === "" ? undefined : message.incentivesEpochIdentifier; - obj.reward_scaler = message.rewardScaler === "" ? undefined : message.rewardScaler; + obj.reward_scaler = message.rewardScaler === "" ? undefined : Decimal.fromUserInput(message.rewardScaler, 18).atomics; return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputsign/evmos/incentives/v1/query.rpc.func.ts b/__fixtures__/v-next/outputsign/evmos/incentives/v1/query.rpc.func.ts new file mode 100644 index 0000000000..1321096062 --- /dev/null +++ b/__fixtures__/v-next/outputsign/evmos/incentives/v1/query.rpc.func.ts @@ -0,0 +1,91 @@ +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination"; +import { Incentive, IncentiveSDKType, GasMeter, GasMeterSDKType } from "./incentives"; +import { DecCoin, DecCoinSDKType } from "../../../cosmos/base/v1beta1/coin"; +import { Params, ParamsSDKType } from "./genesis"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { QueryIncentivesRequest, QueryIncentivesRequestSDKType, QueryIncentivesResponse, QueryIncentivesResponseSDKType, QueryIncentiveRequest, QueryIncentiveRequestSDKType, QueryIncentiveResponse, QueryIncentiveResponseSDKType, QueryGasMetersRequest, QueryGasMetersRequestSDKType, QueryGasMetersResponse, QueryGasMetersResponseSDKType, QueryGasMeterRequest, QueryGasMeterRequestSDKType, QueryGasMeterResponse, QueryGasMeterResponseSDKType, QueryAllocationMetersRequest, QueryAllocationMetersRequestSDKType, QueryAllocationMetersResponse, QueryAllocationMetersResponseSDKType, QueryAllocationMeterRequest, QueryAllocationMeterRequestSDKType, QueryAllocationMeterResponse, QueryAllocationMeterResponseSDKType, QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType } from "./query"; +/** + * Incentives retrieves registered incentives + * @name getIncentives + * @package evmos.incentives.v1 + * @see proto service: evmos.incentives.v1.Incentives + */ +export const getIncentives = buildQuery({ + encode: QueryIncentivesRequest.encode, + decode: QueryIncentivesResponse.decode, + service: "evmos.incentives.v1.Query", + method: "Incentives" +}); +/** + * Incentive retrieves a registered incentive + * @name getIncentive + * @package evmos.incentives.v1 + * @see proto service: evmos.incentives.v1.Incentive + */ +export const getIncentive = buildQuery({ + encode: QueryIncentiveRequest.encode, + decode: QueryIncentiveResponse.decode, + service: "evmos.incentives.v1.Query", + method: "Incentive" +}); +/** + * GasMeters retrieves active gas meters for a given contract + * @name getGasMeters + * @package evmos.incentives.v1 + * @see proto service: evmos.incentives.v1.GasMeters + */ +export const getGasMeters = buildQuery({ + encode: QueryGasMetersRequest.encode, + decode: QueryGasMetersResponse.decode, + service: "evmos.incentives.v1.Query", + method: "GasMeters" +}); +/** + * GasMeter Retrieves a active gas meter + * @name getGasMeter + * @package evmos.incentives.v1 + * @see proto service: evmos.incentives.v1.GasMeter + */ +export const getGasMeter = buildQuery({ + encode: QueryGasMeterRequest.encode, + decode: QueryGasMeterResponse.decode, + service: "evmos.incentives.v1.Query", + method: "GasMeter" +}); +/** + * AllocationMeters retrieves active allocation meters for a given + * denomination + * @name getAllocationMeters + * @package evmos.incentives.v1 + * @see proto service: evmos.incentives.v1.AllocationMeters + */ +export const getAllocationMeters = buildQuery({ + encode: QueryAllocationMetersRequest.encode, + decode: QueryAllocationMetersResponse.decode, + service: "evmos.incentives.v1.Query", + method: "AllocationMeters" +}); +/** + * AllocationMeter Retrieves a active gas meter + * @name getAllocationMeter + * @package evmos.incentives.v1 + * @see proto service: evmos.incentives.v1.AllocationMeter + */ +export const getAllocationMeter = buildQuery({ + encode: QueryAllocationMeterRequest.encode, + decode: QueryAllocationMeterResponse.decode, + service: "evmos.incentives.v1.Query", + method: "AllocationMeter" +}); +/** + * Params retrieves the incentives module params + * @name getParams + * @package evmos.incentives.v1 + * @see proto service: evmos.incentives.v1.Params + */ +export const getParams = buildQuery({ + encode: QueryParamsRequest.encode, + decode: QueryParamsResponse.decode, + service: "evmos.incentives.v1.Query", + method: "Params" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputsign/evmos/inflation/v1/inflation.ts b/__fixtures__/v-next/outputsign/evmos/inflation/v1/inflation.ts index 0d9ec20d5e..c8f6a883bc 100644 --- a/__fixtures__/v-next/outputsign/evmos/inflation/v1/inflation.ts +++ b/__fixtures__/v-next/outputsign/evmos/inflation/v1/inflation.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { Decimal } from "@cosmjs/math"; +import { Decimal } from "@interchainjs/math"; import { DeepPartial } from "../../../helpers"; export const protobufPackage = "evmos.inflation.v1"; /** @@ -252,9 +252,9 @@ export const InflationDistribution = { }, toAmino(message: InflationDistribution): InflationDistributionAmino { const obj: any = {}; - obj.staking_rewards = message.stakingRewards === "" ? undefined : message.stakingRewards; - obj.usage_incentives = message.usageIncentives === "" ? undefined : message.usageIncentives; - obj.community_pool = message.communityPool === "" ? undefined : message.communityPool; + obj.staking_rewards = message.stakingRewards === "" ? undefined : Decimal.fromUserInput(message.stakingRewards, 18).atomics; + obj.usage_incentives = message.usageIncentives === "" ? undefined : Decimal.fromUserInput(message.usageIncentives, 18).atomics; + obj.community_pool = message.communityPool === "" ? undefined : Decimal.fromUserInput(message.communityPool, 18).atomics; return obj; }, fromAminoMsg(object: InflationDistributionAminoMsg): InflationDistribution { @@ -371,11 +371,11 @@ export const ExponentialCalculation = { }, toAmino(message: ExponentialCalculation): ExponentialCalculationAmino { const obj: any = {}; - obj.a = message.a === "" ? undefined : message.a; - obj.r = message.r === "" ? undefined : message.r; - obj.c = message.c === "" ? undefined : message.c; - obj.bonding_target = message.bondingTarget === "" ? undefined : message.bondingTarget; - obj.max_variance = message.maxVariance === "" ? undefined : message.maxVariance; + obj.a = message.a === "" ? undefined : Decimal.fromUserInput(message.a, 18).atomics; + obj.r = message.r === "" ? undefined : Decimal.fromUserInput(message.r, 18).atomics; + obj.c = message.c === "" ? undefined : Decimal.fromUserInput(message.c, 18).atomics; + obj.bonding_target = message.bondingTarget === "" ? undefined : Decimal.fromUserInput(message.bondingTarget, 18).atomics; + obj.max_variance = message.maxVariance === "" ? undefined : Decimal.fromUserInput(message.maxVariance, 18).atomics; return obj; }, fromAminoMsg(object: ExponentialCalculationAminoMsg): ExponentialCalculation { diff --git a/__fixtures__/v-next/outputsign/evmos/inflation/v1/query.rpc.func.ts b/__fixtures__/v-next/outputsign/evmos/inflation/v1/query.rpc.func.ts new file mode 100644 index 0000000000..151eefa68d --- /dev/null +++ b/__fixtures__/v-next/outputsign/evmos/inflation/v1/query.rpc.func.ts @@ -0,0 +1,77 @@ +import { DecCoin, DecCoinSDKType } from "../../../cosmos/base/v1beta1/coin"; +import { Params, ParamsSDKType } from "./genesis"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { QueryPeriodRequest, QueryPeriodRequestSDKType, QueryPeriodResponse, QueryPeriodResponseSDKType, QueryEpochMintProvisionRequest, QueryEpochMintProvisionRequestSDKType, QueryEpochMintProvisionResponse, QueryEpochMintProvisionResponseSDKType, QuerySkippedEpochsRequest, QuerySkippedEpochsRequestSDKType, QuerySkippedEpochsResponse, QuerySkippedEpochsResponseSDKType, QueryCirculatingSupplyRequest, QueryCirculatingSupplyRequestSDKType, QueryCirculatingSupplyResponse, QueryCirculatingSupplyResponseSDKType, QueryInflationRateRequest, QueryInflationRateRequestSDKType, QueryInflationRateResponse, QueryInflationRateResponseSDKType, QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType } from "./query"; +/** + * Period retrieves current period. + * @name getPeriod + * @package evmos.inflation.v1 + * @see proto service: evmos.inflation.v1.Period + */ +export const getPeriod = buildQuery({ + encode: QueryPeriodRequest.encode, + decode: QueryPeriodResponse.decode, + service: "evmos.inflation.v1.Query", + method: "Period" +}); +/** + * EpochMintProvision retrieves current minting epoch provision value. + * @name getEpochMintProvision + * @package evmos.inflation.v1 + * @see proto service: evmos.inflation.v1.EpochMintProvision + */ +export const getEpochMintProvision = buildQuery({ + encode: QueryEpochMintProvisionRequest.encode, + decode: QueryEpochMintProvisionResponse.decode, + service: "evmos.inflation.v1.Query", + method: "EpochMintProvision" +}); +/** + * SkippedEpochs retrieves the total number of skipped epochs. + * @name getSkippedEpochs + * @package evmos.inflation.v1 + * @see proto service: evmos.inflation.v1.SkippedEpochs + */ +export const getSkippedEpochs = buildQuery({ + encode: QuerySkippedEpochsRequest.encode, + decode: QuerySkippedEpochsResponse.decode, + service: "evmos.inflation.v1.Query", + method: "SkippedEpochs" +}); +/** + * CirculatingSupply retrieves the total number of tokens that are in + * circulation (i.e. excluding unvested tokens). + * @name getCirculatingSupply + * @package evmos.inflation.v1 + * @see proto service: evmos.inflation.v1.CirculatingSupply + */ +export const getCirculatingSupply = buildQuery({ + encode: QueryCirculatingSupplyRequest.encode, + decode: QueryCirculatingSupplyResponse.decode, + service: "evmos.inflation.v1.Query", + method: "CirculatingSupply" +}); +/** + * InflationRate retrieves the inflation rate of the current period. + * @name getInflationRate + * @package evmos.inflation.v1 + * @see proto service: evmos.inflation.v1.InflationRate + */ +export const getInflationRate = buildQuery({ + encode: QueryInflationRateRequest.encode, + decode: QueryInflationRateResponse.decode, + service: "evmos.inflation.v1.Query", + method: "InflationRate" +}); +/** + * Params retrieves the total set of minting parameters. + * @name getParams + * @package evmos.inflation.v1 + * @see proto service: evmos.inflation.v1.Params + */ +export const getParams = buildQuery({ + encode: QueryParamsRequest.encode, + decode: QueryParamsResponse.decode, + service: "evmos.inflation.v1.Query", + method: "Params" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputsign/evmos/inflation/v1/query.ts b/__fixtures__/v-next/outputsign/evmos/inflation/v1/query.ts index 27b3dfab1f..2d8c10cbf3 100644 --- a/__fixtures__/v-next/outputsign/evmos/inflation/v1/query.ts +++ b/__fixtures__/v-next/outputsign/evmos/inflation/v1/query.ts @@ -2,7 +2,7 @@ import { DecCoin, DecCoinAmino, DecCoinSDKType } from "../../../cosmos/base/v1be import { Params, ParamsAmino, ParamsSDKType } from "./genesis"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { DeepPartial } from "../../../helpers"; -import { Decimal } from "@cosmjs/math"; +import { Decimal } from "@interchainjs/math"; export const protobufPackage = "evmos.inflation.v1"; /** * QueryPeriodRequest is the request type for the Query/Period RPC method. @@ -1070,7 +1070,7 @@ export const QueryInflationRateResponse = { }, toAmino(message: QueryInflationRateResponse): QueryInflationRateResponseAmino { const obj: any = {}; - obj.inflation_rate = message.inflationRate === "" ? undefined : message.inflationRate; + obj.inflation_rate = message.inflationRate === "" ? undefined : Decimal.fromUserInput(message.inflationRate, 18).atomics; return obj; }, fromAminoMsg(object: QueryInflationRateResponseAminoMsg): QueryInflationRateResponse { diff --git a/__fixtures__/v-next/outputsign/evmos/recovery/v1/query.rpc.func.ts b/__fixtures__/v-next/outputsign/evmos/recovery/v1/query.rpc.func.ts new file mode 100644 index 0000000000..5403b6c737 --- /dev/null +++ b/__fixtures__/v-next/outputsign/evmos/recovery/v1/query.rpc.func.ts @@ -0,0 +1,15 @@ +import { Params, ParamsSDKType } from "./genesis"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType } from "./query"; +/** + * Params retrieves the total set of recovery parameters. + * @name getParams + * @package evmos.recovery.v1 + * @see proto service: evmos.recovery.v1.Params + */ +export const getParams = buildQuery({ + encode: QueryParamsRequest.encode, + decode: QueryParamsResponse.decode, + service: "evmos.recovery.v1.Query", + method: "Params" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputsign/evmos/vesting/v1/query.rpc.func.ts b/__fixtures__/v-next/outputsign/evmos/vesting/v1/query.rpc.func.ts new file mode 100644 index 0000000000..e60916d404 --- /dev/null +++ b/__fixtures__/v-next/outputsign/evmos/vesting/v1/query.rpc.func.ts @@ -0,0 +1,15 @@ +import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { QueryBalancesRequest, QueryBalancesRequestSDKType, QueryBalancesResponse, QueryBalancesResponseSDKType } from "./query"; +/** + * Retrieves the unvested, vested and locked tokens for a vesting account + * @name getBalances + * @package evmos.vesting.v1 + * @see proto service: evmos.vesting.v1.Balances + */ +export const getBalances = buildQuery({ + encode: QueryBalancesRequest.encode, + decode: QueryBalancesResponse.decode, + service: "evmos.vesting.v1.Query", + method: "Balances" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputsign/evmos/vesting/v1/tx.rpc.func.ts b/__fixtures__/v-next/outputsign/evmos/vesting/v1/tx.rpc.func.ts new file mode 100644 index 0000000000..a00219b97b --- /dev/null +++ b/__fixtures__/v-next/outputsign/evmos/vesting/v1/tx.rpc.func.ts @@ -0,0 +1,23 @@ +import { Timestamp, TimestampSDKType } from "../../../google/protobuf/timestamp"; +import { Period, PeriodSDKType } from "../../../cosmos/vesting/v1beta1/vesting"; +import { buildTx } from "../../../helper-func-types"; +import { MsgCreateClawbackVestingAccount, MsgCreateClawbackVestingAccountSDKType, MsgCreateClawbackVestingAccountResponse, MsgCreateClawbackVestingAccountResponseSDKType, MsgClawback, MsgClawbackSDKType, MsgClawbackResponse, MsgClawbackResponseSDKType } from "./tx"; +/** + * CreateClawbackVestingAccount creats a vesting account that is subject to + * clawback and the configuration of vesting and lockup schedules. + * @name createClawbackVestingAccount + * @package evmos.vesting.v1 + * @see proto service: evmos.vesting.v1.CreateClawbackVestingAccount + */ +export const createClawbackVestingAccount = buildTx({ + msg: MsgCreateClawbackVestingAccount +}); +/** + * Clawback removes the unvested tokens from a ClawbackVestingAccount. + * @name clawback + * @package evmos.vesting.v1 + * @see proto service: evmos.vesting.v1.Clawback + */ +export const clawback = buildTx({ + msg: MsgClawback +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputsign/extern.ts b/__fixtures__/v-next/outputsign/extern.ts index c3e7cbcac8..83d6864ae2 100644 --- a/__fixtures__/v-next/outputsign/extern.ts +++ b/__fixtures__/v-next/outputsign/extern.ts @@ -4,30 +4,45 @@ * and run the transpile command or npm scripts command that is used to regenerate this bundle. */ -import { QueryClient, createProtobufRpcClient, ProtobufRpcClient } from '@cosmjs/stargate' -import { Tendermint34Client, HttpEndpoint } from "@cosmjs/tendermint-rpc"; -const _rpcClients: Record = {}; +import { HttpEndpoint } from "@interchainjs/types"; +import { Rpc } from "./helpers"; +import { ClientOptions, createCosmosQueryClient } from "@interchainjs/cosmos"; + +const _rpcClients: Record = {}; export const getRpcEndpointKey = (rpcEndpoint: string | HttpEndpoint) => { - if (typeof rpcEndpoint === 'string') { - return rpcEndpoint; - } else if (!!rpcEndpoint) { - //@ts-ignore - return rpcEndpoint.url; - } + if (typeof rpcEndpoint === 'string') { + return rpcEndpoint; + } else if (!!rpcEndpoint) { + //@ts-ignore + return rpcEndpoint.url; + } } export const getRpcClient = async (rpcEndpoint: string | HttpEndpoint) => { - const key = getRpcEndpointKey(rpcEndpoint); - if (!key) return; - if (_rpcClients.hasOwnProperty(key)) { - return _rpcClients[key]; - } - const tmClient = await Tendermint34Client.connect(rpcEndpoint); - //@ts-ignore - const client = new QueryClient(tmClient); - const rpc = createProtobufRpcClient(client); - _rpcClients[key] = rpc; - return rpc; + const key = getRpcEndpointKey(rpcEndpoint); + if (!key) return; + if (_rpcClients.hasOwnProperty(key)) { + return _rpcClients[key]; + } + const rpc = await createRpcClient(rpcEndpoint); + _rpcClients[key] = rpc; + return rpc; +} + +export const createRpcClient = async (rpcEndpoint: string | HttpEndpoint, + options?: ClientOptions +) => { + if (typeof rpcEndpoint === 'string') { + return createCosmosQueryClient(rpcEndpoint, options); + } else { + const endpointStr = rpcEndpoint.url; + const clientOptions = { + ...options, + headers: rpcEndpoint.headers + }; + + return createCosmosQueryClient(endpointStr, clientOptions); + } } diff --git a/__fixtures__/v-next/outputsign/helper-func-types.ts b/__fixtures__/v-next/outputsign/helper-func-types.ts new file mode 100644 index 0000000000..5f9d7a87a0 --- /dev/null +++ b/__fixtures__/v-next/outputsign/helper-func-types.ts @@ -0,0 +1,92 @@ +/** +* This file and any referenced files were automatically generated by @hyperweb/telescope@latest +* DO NOT MODIFY BY HAND. Instead, download the latest proto files for your chain +* and run the transpile command or npm scripts command that is used to regenerate this bundle. +*/ + + +import { HttpEndpoint } from "@interchainjs/types"; +import { BinaryReader, BinaryWriter } from "./binary"; +import { getRpcClient } from "./extern"; +import { isRpc, Rpc } from "./helpers"; +import { TelescopeGeneratedCodec, DeliverTxResponse, Message, StdFee } from "./types"; +import { toConverters, toEncoders } from "@interchainjs/cosmos/utils"; +import { ISigningClient } from "@interchainjs/cosmos/types/signing-client"; + +export interface QueryBuilderOptions { + encode: (request: TReq, writer?: BinaryWriter) => BinaryWriter + decode: (input: BinaryReader | Uint8Array, length?: number) => TRes + service: string, + method: string, +} + +export function buildQuery(opts: QueryBuilderOptions) { + return async (client: EndpointOrRpc, request: TReq) => { + let rpc: Rpc | undefined; + + if(isRpc(client)) { + rpc = client; + } else { + rpc = client ? await getRpcClient(client) : undefined; + } + + if (!rpc) throw new Error("Query Rpc is not initialized"); + + const data = opts.encode(request).finish(); + const response = await rpc.request(opts.service, opts.method, data); + return opts.decode(response); + }; +} + +export interface ITxArgs { + signerAddress: string; + message: TMsg | TMsg[]; + fee: StdFee | 'auto'; + memo: string; +} + +export interface TxBuilderOptions { + msg: TelescopeGeneratedCodec +} + +export function buildTx(opts: TxBuilderOptions) { + return async ( + client: ISigningClient, + signerAddress: string, + message: TMsg | TMsg[], + fee: StdFee | 'auto', + memo: string + ): Promise => { + if (!client) throw new Error("SigningClient is not initialized"); + + //register all related encoders and converters + client.addEncoders?.(toEncoders(opts.msg)); + client.addConverters?.(toConverters(opts.msg)); + + const data = Array.isArray(message) + ? message.map(msg => ({ + typeUrl: opts.msg.typeUrl, + value: msg, + })) + : [{ + typeUrl: opts.msg.typeUrl, + value: message, + }]; + return client.signAndBroadcast!(signerAddress, data, fee, memo); + }; +} + +export interface Encoder { + typeUrl: string; + fromPartial: (data: any) => any; + encode: (data: any) => Uint8Array; +} + +export interface AminoConverter { + typeUrl: string; + aminoType: string; + fromAmino: (data: any) => any; + toAmino: (data: any) => any; +} + +export type EndpointOrRpc = string | HttpEndpoint | Rpc ; diff --git a/__fixtures__/v-next/outputsign/ibc/applications/transfer/v1/query.rpc.func.ts b/__fixtures__/v-next/outputsign/ibc/applications/transfer/v1/query.rpc.func.ts new file mode 100644 index 0000000000..b0991df88a --- /dev/null +++ b/__fixtures__/v-next/outputsign/ibc/applications/transfer/v1/query.rpc.func.ts @@ -0,0 +1,40 @@ +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../../cosmos/base/query/v1beta1/pagination"; +import { DenomTrace, DenomTraceSDKType, Params, ParamsSDKType } from "./transfer"; +import { EndpointOrRpc, buildQuery } from "../../../../helper-func-types"; +import { QueryDenomTraceRequest, QueryDenomTraceRequestSDKType, QueryDenomTraceResponse, QueryDenomTraceResponseSDKType, QueryDenomTracesRequest, QueryDenomTracesRequestSDKType, QueryDenomTracesResponse, QueryDenomTracesResponseSDKType, QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType } from "./query"; +/** + * DenomTrace queries a denomination trace information. + * @name getDenomTrace + * @package ibc.applications.transfer.v1 + * @see proto service: ibc.applications.transfer.v1.DenomTrace + */ +export const getDenomTrace = buildQuery({ + encode: QueryDenomTraceRequest.encode, + decode: QueryDenomTraceResponse.decode, + service: "ibc.applications.transfer.v1.Query", + method: "DenomTrace" +}); +/** + * DenomTraces queries all denomination traces. + * @name getDenomTraces + * @package ibc.applications.transfer.v1 + * @see proto service: ibc.applications.transfer.v1.DenomTraces + */ +export const getDenomTraces = buildQuery({ + encode: QueryDenomTracesRequest.encode, + decode: QueryDenomTracesResponse.decode, + service: "ibc.applications.transfer.v1.Query", + method: "DenomTraces" +}); +/** + * Params queries all parameters of the ibc-transfer module. + * @name getParams + * @package ibc.applications.transfer.v1 + * @see proto service: ibc.applications.transfer.v1.Params + */ +export const getParams = buildQuery({ + encode: QueryParamsRequest.encode, + decode: QueryParamsResponse.decode, + service: "ibc.applications.transfer.v1.Query", + method: "Params" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputsign/ibc/applications/transfer/v1/tx.rpc.func.ts b/__fixtures__/v-next/outputsign/ibc/applications/transfer/v1/tx.rpc.func.ts new file mode 100644 index 0000000000..9f352ae025 --- /dev/null +++ b/__fixtures__/v-next/outputsign/ibc/applications/transfer/v1/tx.rpc.func.ts @@ -0,0 +1,13 @@ +import { Coin, CoinSDKType } from "../../../../cosmos/base/v1beta1/coin"; +import { Height, HeightSDKType } from "../../../core/client/v1/client"; +import { buildTx } from "../../../../helper-func-types"; +import { MsgTransfer, MsgTransferSDKType, MsgTransferResponse, MsgTransferResponseSDKType } from "./tx"; +/** + * Transfer defines a rpc handler method for MsgTransfer. + * @name transfer + * @package ibc.applications.transfer.v1 + * @see proto service: ibc.applications.transfer.v1.Transfer + */ +export const transfer = buildTx({ + msg: MsgTransfer +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputsign/ibc/bundle.ts b/__fixtures__/v-next/outputsign/ibc/bundle.ts index aced34b163..92ca4087cb 100644 --- a/__fixtures__/v-next/outputsign/ibc/bundle.ts +++ b/__fixtures__/v-next/outputsign/ibc/bundle.ts @@ -22,30 +22,39 @@ import * as _250 from "./lightclients/localhost/v1/localhost"; import * as _251 from "./lightclients/solomachine/v1/solomachine"; import * as _252 from "./lightclients/solomachine/v2/solomachine"; import * as _253 from "./lightclients/tendermint/v1/tendermint"; -import * as _465 from "./applications/transfer/v1/tx.amino"; -import * as _466 from "./core/channel/v1/tx.amino"; -import * as _467 from "./core/client/v1/tx.amino"; -import * as _468 from "./core/connection/v1/tx.amino"; -import * as _469 from "./applications/transfer/v1/tx.registry"; -import * as _470 from "./core/channel/v1/tx.registry"; -import * as _471 from "./core/client/v1/tx.registry"; -import * as _472 from "./core/connection/v1/tx.registry"; -import * as _473 from "./applications/transfer/v1/query.lcd"; -import * as _474 from "./core/channel/v1/query.lcd"; -import * as _475 from "./core/client/v1/query.lcd"; -import * as _476 from "./core/connection/v1/query.lcd"; -import * as _477 from "./applications/transfer/v1/query.rpc.Query"; -import * as _478 from "./core/channel/v1/query.rpc.Query"; -import * as _479 from "./core/client/v1/query.rpc.Query"; -import * as _480 from "./core/connection/v1/query.rpc.Query"; -import * as _481 from "./core/port/v1/query.rpc.Query"; -import * as _482 from "./applications/transfer/v1/tx.rpc.msg"; -import * as _483 from "./core/channel/v1/tx.rpc.msg"; -import * as _484 from "./core/client/v1/tx.rpc.msg"; -import * as _485 from "./core/connection/v1/tx.rpc.msg"; -import * as _553 from "./lcd"; -import * as _554 from "./rpc.query"; -import * as _555 from "./rpc.tx"; +import * as _528 from "./applications/transfer/v1/tx.amino"; +import * as _529 from "./core/channel/v1/tx.amino"; +import * as _530 from "./core/client/v1/tx.amino"; +import * as _531 from "./core/connection/v1/tx.amino"; +import * as _532 from "./applications/transfer/v1/tx.registry"; +import * as _533 from "./core/channel/v1/tx.registry"; +import * as _534 from "./core/client/v1/tx.registry"; +import * as _535 from "./core/connection/v1/tx.registry"; +import * as _536 from "./applications/transfer/v1/query.lcd"; +import * as _537 from "./core/channel/v1/query.lcd"; +import * as _538 from "./core/client/v1/query.lcd"; +import * as _539 from "./core/connection/v1/query.lcd"; +import * as _540 from "./applications/transfer/v1/query.rpc.func"; +import * as _541 from "./core/channel/v1/query.rpc.func"; +import * as _542 from "./core/client/v1/query.rpc.func"; +import * as _543 from "./core/connection/v1/query.rpc.func"; +import * as _544 from "./core/port/v1/query.rpc.func"; +import * as _545 from "./applications/transfer/v1/query.rpc.Query"; +import * as _546 from "./core/channel/v1/query.rpc.Query"; +import * as _547 from "./core/client/v1/query.rpc.Query"; +import * as _548 from "./core/connection/v1/query.rpc.Query"; +import * as _549 from "./core/port/v1/query.rpc.Query"; +import * as _550 from "./applications/transfer/v1/tx.rpc.func"; +import * as _551 from "./core/channel/v1/tx.rpc.func"; +import * as _552 from "./core/client/v1/tx.rpc.func"; +import * as _553 from "./core/connection/v1/tx.rpc.func"; +import * as _554 from "./applications/transfer/v1/tx.rpc.msg"; +import * as _555 from "./core/channel/v1/tx.rpc.msg"; +import * as _556 from "./core/client/v1/tx.rpc.msg"; +import * as _557 from "./core/connection/v1/tx.rpc.msg"; +import * as _646 from "./lcd"; +import * as _647 from "./rpc.query"; +import * as _648 from "./rpc.tx"; export namespace ibc { export namespace applications { export namespace transfer { @@ -54,11 +63,13 @@ export namespace ibc { ..._231, ..._232, ..._233, - ..._465, - ..._469, - ..._473, - ..._477, - ..._482 + ..._528, + ..._532, + ..._536, + ..._540, + ..._545, + ..._550, + ..._554 }; export const v2 = { ..._234 @@ -72,11 +83,13 @@ export namespace ibc { ..._236, ..._237, ..._238, - ..._466, - ..._470, - ..._474, - ..._478, - ..._483 + ..._529, + ..._533, + ..._537, + ..._541, + ..._546, + ..._551, + ..._555 }; } export namespace client { @@ -85,11 +98,13 @@ export namespace ibc { ..._240, ..._241, ..._242, - ..._467, - ..._471, - ..._475, - ..._479, - ..._484 + ..._530, + ..._534, + ..._538, + ..._542, + ..._547, + ..._552, + ..._556 }; } export namespace commitment { @@ -103,17 +118,20 @@ export namespace ibc { ..._245, ..._246, ..._247, - ..._468, - ..._472, - ..._476, - ..._480, - ..._485 + ..._531, + ..._535, + ..._539, + ..._543, + ..._548, + ..._553, + ..._557 }; } export namespace port { export const v1 = { ..._248, - ..._481 + ..._544, + ..._549 }; } export namespace types { @@ -143,8 +161,8 @@ export namespace ibc { } } export const ClientFactory = { - ..._553, - ..._554, - ..._555 + ..._646, + ..._647, + ..._648 }; } \ No newline at end of file diff --git a/__fixtures__/v-next/outputsign/ibc/core/channel/v1/query.rpc.func.ts b/__fixtures__/v-next/outputsign/ibc/core/channel/v1/query.rpc.func.ts new file mode 100644 index 0000000000..97f7f75246 --- /dev/null +++ b/__fixtures__/v-next/outputsign/ibc/core/channel/v1/query.rpc.func.ts @@ -0,0 +1,170 @@ +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../../cosmos/base/query/v1beta1/pagination"; +import { Channel, ChannelSDKType, IdentifiedChannel, IdentifiedChannelSDKType, PacketState, PacketStateSDKType } from "./channel"; +import { Height, HeightSDKType, IdentifiedClientState, IdentifiedClientStateSDKType } from "../../client/v1/client"; +import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../../google/protobuf/any"; +import { EndpointOrRpc, buildQuery } from "../../../../helper-func-types"; +import { QueryChannelRequest, QueryChannelRequestSDKType, QueryChannelResponse, QueryChannelResponseSDKType, QueryChannelsRequest, QueryChannelsRequestSDKType, QueryChannelsResponse, QueryChannelsResponseSDKType, QueryConnectionChannelsRequest, QueryConnectionChannelsRequestSDKType, QueryConnectionChannelsResponse, QueryConnectionChannelsResponseSDKType, QueryChannelClientStateRequest, QueryChannelClientStateRequestSDKType, QueryChannelClientStateResponse, QueryChannelClientStateResponseSDKType, QueryChannelConsensusStateRequest, QueryChannelConsensusStateRequestSDKType, QueryChannelConsensusStateResponse, QueryChannelConsensusStateResponseSDKType, QueryPacketCommitmentRequest, QueryPacketCommitmentRequestSDKType, QueryPacketCommitmentResponse, QueryPacketCommitmentResponseSDKType, QueryPacketCommitmentsRequest, QueryPacketCommitmentsRequestSDKType, QueryPacketCommitmentsResponse, QueryPacketCommitmentsResponseSDKType, QueryPacketReceiptRequest, QueryPacketReceiptRequestSDKType, QueryPacketReceiptResponse, QueryPacketReceiptResponseSDKType, QueryPacketAcknowledgementRequest, QueryPacketAcknowledgementRequestSDKType, QueryPacketAcknowledgementResponse, QueryPacketAcknowledgementResponseSDKType, QueryPacketAcknowledgementsRequest, QueryPacketAcknowledgementsRequestSDKType, QueryPacketAcknowledgementsResponse, QueryPacketAcknowledgementsResponseSDKType, QueryUnreceivedPacketsRequest, QueryUnreceivedPacketsRequestSDKType, QueryUnreceivedPacketsResponse, QueryUnreceivedPacketsResponseSDKType, QueryUnreceivedAcksRequest, QueryUnreceivedAcksRequestSDKType, QueryUnreceivedAcksResponse, QueryUnreceivedAcksResponseSDKType, QueryNextSequenceReceiveRequest, QueryNextSequenceReceiveRequestSDKType, QueryNextSequenceReceiveResponse, QueryNextSequenceReceiveResponseSDKType } from "./query"; +/** + * Channel queries an IBC Channel. + * @name getChannel + * @package ibc.core.channel.v1 + * @see proto service: ibc.core.channel.v1.Channel + */ +export const getChannel = buildQuery({ + encode: QueryChannelRequest.encode, + decode: QueryChannelResponse.decode, + service: "ibc.core.channel.v1.Query", + method: "Channel" +}); +/** + * Channels queries all the IBC channels of a chain. + * @name getChannels + * @package ibc.core.channel.v1 + * @see proto service: ibc.core.channel.v1.Channels + */ +export const getChannels = buildQuery({ + encode: QueryChannelsRequest.encode, + decode: QueryChannelsResponse.decode, + service: "ibc.core.channel.v1.Query", + method: "Channels" +}); +/** + * ConnectionChannels queries all the channels associated with a connection + * end. + * @name getConnectionChannels + * @package ibc.core.channel.v1 + * @see proto service: ibc.core.channel.v1.ConnectionChannels + */ +export const getConnectionChannels = buildQuery({ + encode: QueryConnectionChannelsRequest.encode, + decode: QueryConnectionChannelsResponse.decode, + service: "ibc.core.channel.v1.Query", + method: "ConnectionChannels" +}); +/** + * ChannelClientState queries for the client state for the channel associated + * with the provided channel identifiers. + * @name getChannelClientState + * @package ibc.core.channel.v1 + * @see proto service: ibc.core.channel.v1.ChannelClientState + */ +export const getChannelClientState = buildQuery({ + encode: QueryChannelClientStateRequest.encode, + decode: QueryChannelClientStateResponse.decode, + service: "ibc.core.channel.v1.Query", + method: "ChannelClientState" +}); +/** + * ChannelConsensusState queries for the consensus state for the channel + * associated with the provided channel identifiers. + * @name getChannelConsensusState + * @package ibc.core.channel.v1 + * @see proto service: ibc.core.channel.v1.ChannelConsensusState + */ +export const getChannelConsensusState = buildQuery({ + encode: QueryChannelConsensusStateRequest.encode, + decode: QueryChannelConsensusStateResponse.decode, + service: "ibc.core.channel.v1.Query", + method: "ChannelConsensusState" +}); +/** + * PacketCommitment queries a stored packet commitment hash. + * @name getPacketCommitment + * @package ibc.core.channel.v1 + * @see proto service: ibc.core.channel.v1.PacketCommitment + */ +export const getPacketCommitment = buildQuery({ + encode: QueryPacketCommitmentRequest.encode, + decode: QueryPacketCommitmentResponse.decode, + service: "ibc.core.channel.v1.Query", + method: "PacketCommitment" +}); +/** + * PacketCommitments returns all the packet commitments hashes associated + * with a channel. + * @name getPacketCommitments + * @package ibc.core.channel.v1 + * @see proto service: ibc.core.channel.v1.PacketCommitments + */ +export const getPacketCommitments = buildQuery({ + encode: QueryPacketCommitmentsRequest.encode, + decode: QueryPacketCommitmentsResponse.decode, + service: "ibc.core.channel.v1.Query", + method: "PacketCommitments" +}); +/** + * PacketReceipt queries if a given packet sequence has been received on the + * queried chain + * @name getPacketReceipt + * @package ibc.core.channel.v1 + * @see proto service: ibc.core.channel.v1.PacketReceipt + */ +export const getPacketReceipt = buildQuery({ + encode: QueryPacketReceiptRequest.encode, + decode: QueryPacketReceiptResponse.decode, + service: "ibc.core.channel.v1.Query", + method: "PacketReceipt" +}); +/** + * PacketAcknowledgement queries a stored packet acknowledgement hash. + * @name getPacketAcknowledgement + * @package ibc.core.channel.v1 + * @see proto service: ibc.core.channel.v1.PacketAcknowledgement + */ +export const getPacketAcknowledgement = buildQuery({ + encode: QueryPacketAcknowledgementRequest.encode, + decode: QueryPacketAcknowledgementResponse.decode, + service: "ibc.core.channel.v1.Query", + method: "PacketAcknowledgement" +}); +/** + * PacketAcknowledgements returns all the packet acknowledgements associated + * with a channel. + * @name getPacketAcknowledgements + * @package ibc.core.channel.v1 + * @see proto service: ibc.core.channel.v1.PacketAcknowledgements + */ +export const getPacketAcknowledgements = buildQuery({ + encode: QueryPacketAcknowledgementsRequest.encode, + decode: QueryPacketAcknowledgementsResponse.decode, + service: "ibc.core.channel.v1.Query", + method: "PacketAcknowledgements" +}); +/** + * UnreceivedPackets returns all the unreceived IBC packets associated with a + * channel and sequences. + * @name getUnreceivedPackets + * @package ibc.core.channel.v1 + * @see proto service: ibc.core.channel.v1.UnreceivedPackets + */ +export const getUnreceivedPackets = buildQuery({ + encode: QueryUnreceivedPacketsRequest.encode, + decode: QueryUnreceivedPacketsResponse.decode, + service: "ibc.core.channel.v1.Query", + method: "UnreceivedPackets" +}); +/** + * UnreceivedAcks returns all the unreceived IBC acknowledgements associated + * with a channel and sequences. + * @name getUnreceivedAcks + * @package ibc.core.channel.v1 + * @see proto service: ibc.core.channel.v1.UnreceivedAcks + */ +export const getUnreceivedAcks = buildQuery({ + encode: QueryUnreceivedAcksRequest.encode, + decode: QueryUnreceivedAcksResponse.decode, + service: "ibc.core.channel.v1.Query", + method: "UnreceivedAcks" +}); +/** + * NextSequenceReceive returns the next receive sequence for a given channel. + * @name getNextSequenceReceive + * @package ibc.core.channel.v1 + * @see proto service: ibc.core.channel.v1.NextSequenceReceive + */ +export const getNextSequenceReceive = buildQuery({ + encode: QueryNextSequenceReceiveRequest.encode, + decode: QueryNextSequenceReceiveResponse.decode, + service: "ibc.core.channel.v1.Query", + method: "NextSequenceReceive" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputsign/ibc/core/channel/v1/tx.rpc.func.ts b/__fixtures__/v-next/outputsign/ibc/core/channel/v1/tx.rpc.func.ts new file mode 100644 index 0000000000..98c04fd664 --- /dev/null +++ b/__fixtures__/v-next/outputsign/ibc/core/channel/v1/tx.rpc.func.ts @@ -0,0 +1,95 @@ +import { Channel, ChannelSDKType, Packet, PacketSDKType } from "./channel"; +import { Height, HeightSDKType } from "../../client/v1/client"; +import { buildTx } from "../../../../helper-func-types"; +import { MsgChannelOpenInit, MsgChannelOpenInitSDKType, MsgChannelOpenInitResponse, MsgChannelOpenInitResponseSDKType, MsgChannelOpenTry, MsgChannelOpenTrySDKType, MsgChannelOpenTryResponse, MsgChannelOpenTryResponseSDKType, MsgChannelOpenAck, MsgChannelOpenAckSDKType, MsgChannelOpenAckResponse, MsgChannelOpenAckResponseSDKType, MsgChannelOpenConfirm, MsgChannelOpenConfirmSDKType, MsgChannelOpenConfirmResponse, MsgChannelOpenConfirmResponseSDKType, MsgChannelCloseInit, MsgChannelCloseInitSDKType, MsgChannelCloseInitResponse, MsgChannelCloseInitResponseSDKType, MsgChannelCloseConfirm, MsgChannelCloseConfirmSDKType, MsgChannelCloseConfirmResponse, MsgChannelCloseConfirmResponseSDKType, MsgRecvPacket, MsgRecvPacketSDKType, MsgRecvPacketResponse, MsgRecvPacketResponseSDKType, MsgTimeout, MsgTimeoutSDKType, MsgTimeoutResponse, MsgTimeoutResponseSDKType, MsgTimeoutOnClose, MsgTimeoutOnCloseSDKType, MsgTimeoutOnCloseResponse, MsgTimeoutOnCloseResponseSDKType, MsgAcknowledgement, MsgAcknowledgementSDKType, MsgAcknowledgementResponse, MsgAcknowledgementResponseSDKType } from "./tx"; +/** + * ChannelOpenInit defines a rpc handler method for MsgChannelOpenInit. + * @name channelOpenInit + * @package ibc.core.channel.v1 + * @see proto service: ibc.core.channel.v1.ChannelOpenInit + */ +export const channelOpenInit = buildTx({ + msg: MsgChannelOpenInit +}); +/** + * ChannelOpenTry defines a rpc handler method for MsgChannelOpenTry. + * @name channelOpenTry + * @package ibc.core.channel.v1 + * @see proto service: ibc.core.channel.v1.ChannelOpenTry + */ +export const channelOpenTry = buildTx({ + msg: MsgChannelOpenTry +}); +/** + * ChannelOpenAck defines a rpc handler method for MsgChannelOpenAck. + * @name channelOpenAck + * @package ibc.core.channel.v1 + * @see proto service: ibc.core.channel.v1.ChannelOpenAck + */ +export const channelOpenAck = buildTx({ + msg: MsgChannelOpenAck +}); +/** + * ChannelOpenConfirm defines a rpc handler method for MsgChannelOpenConfirm. + * @name channelOpenConfirm + * @package ibc.core.channel.v1 + * @see proto service: ibc.core.channel.v1.ChannelOpenConfirm + */ +export const channelOpenConfirm = buildTx({ + msg: MsgChannelOpenConfirm +}); +/** + * ChannelCloseInit defines a rpc handler method for MsgChannelCloseInit. + * @name channelCloseInit + * @package ibc.core.channel.v1 + * @see proto service: ibc.core.channel.v1.ChannelCloseInit + */ +export const channelCloseInit = buildTx({ + msg: MsgChannelCloseInit +}); +/** + * ChannelCloseConfirm defines a rpc handler method for + * MsgChannelCloseConfirm. + * @name channelCloseConfirm + * @package ibc.core.channel.v1 + * @see proto service: ibc.core.channel.v1.ChannelCloseConfirm + */ +export const channelCloseConfirm = buildTx({ + msg: MsgChannelCloseConfirm +}); +/** + * RecvPacket defines a rpc handler method for MsgRecvPacket. + * @name recvPacket + * @package ibc.core.channel.v1 + * @see proto service: ibc.core.channel.v1.RecvPacket + */ +export const recvPacket = buildTx({ + msg: MsgRecvPacket +}); +/** + * Timeout defines a rpc handler method for MsgTimeout. + * @name timeout + * @package ibc.core.channel.v1 + * @see proto service: ibc.core.channel.v1.Timeout + */ +export const timeout = buildTx({ + msg: MsgTimeout +}); +/** + * TimeoutOnClose defines a rpc handler method for MsgTimeoutOnClose. + * @name timeoutOnClose + * @package ibc.core.channel.v1 + * @see proto service: ibc.core.channel.v1.TimeoutOnClose + */ +export const timeoutOnClose = buildTx({ + msg: MsgTimeoutOnClose +}); +/** + * Acknowledgement defines a rpc handler method for MsgAcknowledgement. + * @name acknowledgement + * @package ibc.core.channel.v1 + * @see proto service: ibc.core.channel.v1.Acknowledgement + */ +export const acknowledgement = buildTx({ + msg: MsgAcknowledgement +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputsign/ibc/core/client/v1/query.rpc.func.ts b/__fixtures__/v-next/outputsign/ibc/core/client/v1/query.rpc.func.ts new file mode 100644 index 0000000000..57bc864e7a --- /dev/null +++ b/__fixtures__/v-next/outputsign/ibc/core/client/v1/query.rpc.func.ts @@ -0,0 +1,103 @@ +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../../cosmos/base/query/v1beta1/pagination"; +import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../../google/protobuf/any"; +import { Height, HeightSDKType, IdentifiedClientState, IdentifiedClientStateSDKType, ConsensusStateWithHeight, ConsensusStateWithHeightSDKType, Params, ParamsSDKType } from "./client"; +import { EndpointOrRpc, buildQuery } from "../../../../helper-func-types"; +import { QueryClientStateRequest, QueryClientStateRequestSDKType, QueryClientStateResponse, QueryClientStateResponseSDKType, QueryClientStatesRequest, QueryClientStatesRequestSDKType, QueryClientStatesResponse, QueryClientStatesResponseSDKType, QueryConsensusStateRequest, QueryConsensusStateRequestSDKType, QueryConsensusStateResponse, QueryConsensusStateResponseSDKType, QueryConsensusStatesRequest, QueryConsensusStatesRequestSDKType, QueryConsensusStatesResponse, QueryConsensusStatesResponseSDKType, QueryClientStatusRequest, QueryClientStatusRequestSDKType, QueryClientStatusResponse, QueryClientStatusResponseSDKType, QueryClientParamsRequest, QueryClientParamsRequestSDKType, QueryClientParamsResponse, QueryClientParamsResponseSDKType, QueryUpgradedClientStateRequest, QueryUpgradedClientStateRequestSDKType, QueryUpgradedClientStateResponse, QueryUpgradedClientStateResponseSDKType, QueryUpgradedConsensusStateRequest, QueryUpgradedConsensusStateRequestSDKType, QueryUpgradedConsensusStateResponse, QueryUpgradedConsensusStateResponseSDKType } from "./query"; +/** + * ClientState queries an IBC light client. + * @name getClientState + * @package ibc.core.client.v1 + * @see proto service: ibc.core.client.v1.ClientState + */ +export const getClientState = buildQuery({ + encode: QueryClientStateRequest.encode, + decode: QueryClientStateResponse.decode, + service: "ibc.core.client.v1.Query", + method: "ClientState" +}); +/** + * ClientStates queries all the IBC light clients of a chain. + * @name getClientStates + * @package ibc.core.client.v1 + * @see proto service: ibc.core.client.v1.ClientStates + */ +export const getClientStates = buildQuery({ + encode: QueryClientStatesRequest.encode, + decode: QueryClientStatesResponse.decode, + service: "ibc.core.client.v1.Query", + method: "ClientStates" +}); +/** + * ConsensusState queries a consensus state associated with a client state at + * a given height. + * @name getConsensusState + * @package ibc.core.client.v1 + * @see proto service: ibc.core.client.v1.ConsensusState + */ +export const getConsensusState = buildQuery({ + encode: QueryConsensusStateRequest.encode, + decode: QueryConsensusStateResponse.decode, + service: "ibc.core.client.v1.Query", + method: "ConsensusState" +}); +/** + * ConsensusStates queries all the consensus state associated with a given + * client. + * @name getConsensusStates + * @package ibc.core.client.v1 + * @see proto service: ibc.core.client.v1.ConsensusStates + */ +export const getConsensusStates = buildQuery({ + encode: QueryConsensusStatesRequest.encode, + decode: QueryConsensusStatesResponse.decode, + service: "ibc.core.client.v1.Query", + method: "ConsensusStates" +}); +/** + * Status queries the status of an IBC client. + * @name getClientStatus + * @package ibc.core.client.v1 + * @see proto service: ibc.core.client.v1.ClientStatus + */ +export const getClientStatus = buildQuery({ + encode: QueryClientStatusRequest.encode, + decode: QueryClientStatusResponse.decode, + service: "ibc.core.client.v1.Query", + method: "ClientStatus" +}); +/** + * ClientParams queries all parameters of the ibc client. + * @name getClientParams + * @package ibc.core.client.v1 + * @see proto service: ibc.core.client.v1.ClientParams + */ +export const getClientParams = buildQuery({ + encode: QueryClientParamsRequest.encode, + decode: QueryClientParamsResponse.decode, + service: "ibc.core.client.v1.Query", + method: "ClientParams" +}); +/** + * UpgradedClientState queries an Upgraded IBC light client. + * @name getUpgradedClientState + * @package ibc.core.client.v1 + * @see proto service: ibc.core.client.v1.UpgradedClientState + */ +export const getUpgradedClientState = buildQuery({ + encode: QueryUpgradedClientStateRequest.encode, + decode: QueryUpgradedClientStateResponse.decode, + service: "ibc.core.client.v1.Query", + method: "UpgradedClientState" +}); +/** + * UpgradedConsensusState queries an Upgraded IBC consensus state. + * @name getUpgradedConsensusState + * @package ibc.core.client.v1 + * @see proto service: ibc.core.client.v1.UpgradedConsensusState + */ +export const getUpgradedConsensusState = buildQuery({ + encode: QueryUpgradedConsensusStateRequest.encode, + decode: QueryUpgradedConsensusStateResponse.decode, + service: "ibc.core.client.v1.Query", + method: "UpgradedConsensusState" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputsign/ibc/core/client/v1/tx.rpc.func.ts b/__fixtures__/v-next/outputsign/ibc/core/client/v1/tx.rpc.func.ts new file mode 100644 index 0000000000..ec1f3b6322 --- /dev/null +++ b/__fixtures__/v-next/outputsign/ibc/core/client/v1/tx.rpc.func.ts @@ -0,0 +1,39 @@ +import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../../google/protobuf/any"; +import { buildTx } from "../../../../helper-func-types"; +import { MsgCreateClient, MsgCreateClientSDKType, MsgCreateClientResponse, MsgCreateClientResponseSDKType, MsgUpdateClient, MsgUpdateClientSDKType, MsgUpdateClientResponse, MsgUpdateClientResponseSDKType, MsgUpgradeClient, MsgUpgradeClientSDKType, MsgUpgradeClientResponse, MsgUpgradeClientResponseSDKType, MsgSubmitMisbehaviour, MsgSubmitMisbehaviourSDKType, MsgSubmitMisbehaviourResponse, MsgSubmitMisbehaviourResponseSDKType } from "./tx"; +/** + * CreateClient defines a rpc handler method for MsgCreateClient. + * @name createClient + * @package ibc.core.client.v1 + * @see proto service: ibc.core.client.v1.CreateClient + */ +export const createClient = buildTx({ + msg: MsgCreateClient +}); +/** + * UpdateClient defines a rpc handler method for MsgUpdateClient. + * @name updateClient + * @package ibc.core.client.v1 + * @see proto service: ibc.core.client.v1.UpdateClient + */ +export const updateClient = buildTx({ + msg: MsgUpdateClient +}); +/** + * UpgradeClient defines a rpc handler method for MsgUpgradeClient. + * @name upgradeClient + * @package ibc.core.client.v1 + * @see proto service: ibc.core.client.v1.UpgradeClient + */ +export const upgradeClient = buildTx({ + msg: MsgUpgradeClient +}); +/** + * SubmitMisbehaviour defines a rpc handler method for MsgSubmitMisbehaviour. + * @name submitMisbehaviour + * @package ibc.core.client.v1 + * @see proto service: ibc.core.client.v1.SubmitMisbehaviour + */ +export const submitMisbehaviour = buildTx({ + msg: MsgSubmitMisbehaviour +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputsign/ibc/core/connection/v1/query.rpc.func.ts b/__fixtures__/v-next/outputsign/ibc/core/connection/v1/query.rpc.func.ts new file mode 100644 index 0000000000..f7d2aaa807 --- /dev/null +++ b/__fixtures__/v-next/outputsign/ibc/core/connection/v1/query.rpc.func.ts @@ -0,0 +1,69 @@ +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../../cosmos/base/query/v1beta1/pagination"; +import { ConnectionEnd, ConnectionEndSDKType, IdentifiedConnection, IdentifiedConnectionSDKType } from "./connection"; +import { Height, HeightSDKType, IdentifiedClientState, IdentifiedClientStateSDKType } from "../../client/v1/client"; +import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../../google/protobuf/any"; +import { EndpointOrRpc, buildQuery } from "../../../../helper-func-types"; +import { QueryConnectionRequest, QueryConnectionRequestSDKType, QueryConnectionResponse, QueryConnectionResponseSDKType, QueryConnectionsRequest, QueryConnectionsRequestSDKType, QueryConnectionsResponse, QueryConnectionsResponseSDKType, QueryClientConnectionsRequest, QueryClientConnectionsRequestSDKType, QueryClientConnectionsResponse, QueryClientConnectionsResponseSDKType, QueryConnectionClientStateRequest, QueryConnectionClientStateRequestSDKType, QueryConnectionClientStateResponse, QueryConnectionClientStateResponseSDKType, QueryConnectionConsensusStateRequest, QueryConnectionConsensusStateRequestSDKType, QueryConnectionConsensusStateResponse, QueryConnectionConsensusStateResponseSDKType } from "./query"; +/** + * Connection queries an IBC connection end. + * @name getConnection + * @package ibc.core.connection.v1 + * @see proto service: ibc.core.connection.v1.Connection + */ +export const getConnection = buildQuery({ + encode: QueryConnectionRequest.encode, + decode: QueryConnectionResponse.decode, + service: "ibc.core.connection.v1.Query", + method: "Connection" +}); +/** + * Connections queries all the IBC connections of a chain. + * @name getConnections + * @package ibc.core.connection.v1 + * @see proto service: ibc.core.connection.v1.Connections + */ +export const getConnections = buildQuery({ + encode: QueryConnectionsRequest.encode, + decode: QueryConnectionsResponse.decode, + service: "ibc.core.connection.v1.Query", + method: "Connections" +}); +/** + * ClientConnections queries the connection paths associated with a client + * state. + * @name getClientConnections + * @package ibc.core.connection.v1 + * @see proto service: ibc.core.connection.v1.ClientConnections + */ +export const getClientConnections = buildQuery({ + encode: QueryClientConnectionsRequest.encode, + decode: QueryClientConnectionsResponse.decode, + service: "ibc.core.connection.v1.Query", + method: "ClientConnections" +}); +/** + * ConnectionClientState queries the client state associated with the + * connection. + * @name getConnectionClientState + * @package ibc.core.connection.v1 + * @see proto service: ibc.core.connection.v1.ConnectionClientState + */ +export const getConnectionClientState = buildQuery({ + encode: QueryConnectionClientStateRequest.encode, + decode: QueryConnectionClientStateResponse.decode, + service: "ibc.core.connection.v1.Query", + method: "ConnectionClientState" +}); +/** + * ConnectionConsensusState queries the consensus state associated with the + * connection. + * @name getConnectionConsensusState + * @package ibc.core.connection.v1 + * @see proto service: ibc.core.connection.v1.ConnectionConsensusState + */ +export const getConnectionConsensusState = buildQuery({ + encode: QueryConnectionConsensusStateRequest.encode, + decode: QueryConnectionConsensusStateResponse.decode, + service: "ibc.core.connection.v1.Query", + method: "ConnectionConsensusState" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputsign/ibc/core/connection/v1/tx.rpc.func.ts b/__fixtures__/v-next/outputsign/ibc/core/connection/v1/tx.rpc.func.ts new file mode 100644 index 0000000000..19a25c9bd6 --- /dev/null +++ b/__fixtures__/v-next/outputsign/ibc/core/connection/v1/tx.rpc.func.ts @@ -0,0 +1,42 @@ +import { Counterparty, CounterpartySDKType, Version, VersionSDKType } from "./connection"; +import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../../google/protobuf/any"; +import { Height, HeightSDKType } from "../../client/v1/client"; +import { buildTx } from "../../../../helper-func-types"; +import { MsgConnectionOpenInit, MsgConnectionOpenInitSDKType, MsgConnectionOpenInitResponse, MsgConnectionOpenInitResponseSDKType, MsgConnectionOpenTry, MsgConnectionOpenTrySDKType, MsgConnectionOpenTryResponse, MsgConnectionOpenTryResponseSDKType, MsgConnectionOpenAck, MsgConnectionOpenAckSDKType, MsgConnectionOpenAckResponse, MsgConnectionOpenAckResponseSDKType, MsgConnectionOpenConfirm, MsgConnectionOpenConfirmSDKType, MsgConnectionOpenConfirmResponse, MsgConnectionOpenConfirmResponseSDKType } from "./tx"; +/** + * ConnectionOpenInit defines a rpc handler method for MsgConnectionOpenInit. + * @name connectionOpenInit + * @package ibc.core.connection.v1 + * @see proto service: ibc.core.connection.v1.ConnectionOpenInit + */ +export const connectionOpenInit = buildTx({ + msg: MsgConnectionOpenInit +}); +/** + * ConnectionOpenTry defines a rpc handler method for MsgConnectionOpenTry. + * @name connectionOpenTry + * @package ibc.core.connection.v1 + * @see proto service: ibc.core.connection.v1.ConnectionOpenTry + */ +export const connectionOpenTry = buildTx({ + msg: MsgConnectionOpenTry +}); +/** + * ConnectionOpenAck defines a rpc handler method for MsgConnectionOpenAck. + * @name connectionOpenAck + * @package ibc.core.connection.v1 + * @see proto service: ibc.core.connection.v1.ConnectionOpenAck + */ +export const connectionOpenAck = buildTx({ + msg: MsgConnectionOpenAck +}); +/** + * ConnectionOpenConfirm defines a rpc handler method for + * MsgConnectionOpenConfirm. + * @name connectionOpenConfirm + * @package ibc.core.connection.v1 + * @see proto service: ibc.core.connection.v1.ConnectionOpenConfirm + */ +export const connectionOpenConfirm = buildTx({ + msg: MsgConnectionOpenConfirm +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputsign/ibc/core/port/v1/query.rpc.func.ts b/__fixtures__/v-next/outputsign/ibc/core/port/v1/query.rpc.func.ts new file mode 100644 index 0000000000..51096ee97c --- /dev/null +++ b/__fixtures__/v-next/outputsign/ibc/core/port/v1/query.rpc.func.ts @@ -0,0 +1,15 @@ +import { Order, OrderSDKType, Counterparty, CounterpartySDKType } from "../../channel/v1/channel"; +import { EndpointOrRpc, buildQuery } from "../../../../helper-func-types"; +import { QueryAppVersionRequest, QueryAppVersionRequestSDKType, QueryAppVersionResponse, QueryAppVersionResponseSDKType } from "./query"; +/** + * AppVersion queries an IBC Port and determines the appropriate application version to be used + * @name getAppVersion + * @package ibc.core.port.v1 + * @see proto service: ibc.core.port.v1.AppVersion + */ +export const getAppVersion = buildQuery({ + encode: QueryAppVersionRequest.encode, + decode: QueryAppVersionResponse.decode, + service: "ibc.core.port.v1.Query", + method: "AppVersion" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputsign/index.ts b/__fixtures__/v-next/outputsign/index.ts index b1595fc9f3..8b35bf53fd 100644 --- a/__fixtures__/v-next/outputsign/index.ts +++ b/__fixtures__/v-next/outputsign/index.ts @@ -24,6 +24,7 @@ export * from "./tendermint/bundle"; export * from "./hooks"; export * from "./mobx.stores"; export * from "./extern"; +export * from "./helper-func-types"; export * from "./react-query"; export * from "./mobx"; export * from "./pinia-endpoint"; diff --git a/__fixtures__/v-next/outputsign/osmosis/bundle.ts b/__fixtures__/v-next/outputsign/osmosis/bundle.ts index 34b563b82f..6ac2c6dfed 100644 --- a/__fixtures__/v-next/outputsign/osmosis/bundle.ts +++ b/__fixtures__/v-next/outputsign/osmosis/bundle.ts @@ -49,59 +49,79 @@ import * as _301 from "./txfees/v1beta1/feetoken"; import * as _302 from "./txfees/v1beta1/genesis"; import * as _303 from "./txfees/v1beta1/gov"; import * as _304 from "./txfees/v1beta1/query"; -import * as _486 from "./gamm/pool-models/balancer/tx/tx.amino"; -import * as _487 from "./gamm/pool-models/stableswap/tx.amino"; -import * as _488 from "./gamm/v1beta1/tx.amino"; -import * as _489 from "./incentives/tx.amino"; -import * as _490 from "./lockup/tx.amino"; -import * as _491 from "./superfluid/tx.amino"; -import * as _492 from "./tokenfactory/v1beta1/tx.amino"; -import * as _493 from "./gamm/pool-models/balancer/tx/tx.registry"; -import * as _494 from "./gamm/pool-models/stableswap/tx.registry"; -import * as _495 from "./gamm/v1beta1/tx.registry"; -import * as _496 from "./incentives/tx.registry"; -import * as _497 from "./lockup/tx.registry"; -import * as _498 from "./superfluid/tx.registry"; -import * as _499 from "./tokenfactory/v1beta1/tx.registry"; -import * as _500 from "./claim/v1beta1/query.lcd"; -import * as _501 from "./epochs/query.lcd"; -import * as _502 from "./gamm/v1beta1/query.lcd"; -import * as _503 from "./gamm/v2/query.lcd"; -import * as _504 from "./ibc-rate-limit/v1beta1/query.lcd"; -import * as _505 from "./incentives/query.lcd"; -import * as _506 from "./lockup/query.lcd"; -import * as _507 from "./mint/v1beta1/query.lcd"; -import * as _508 from "./pool-incentives/v1beta1/query.lcd"; -import * as _509 from "./superfluid/query.lcd"; -import * as _510 from "./tokenfactory/v1beta1/query.lcd"; -import * as _511 from "./twap/v1beta1/query.lcd"; -import * as _512 from "./txfees/v1beta1/query.lcd"; -import * as _513 from "./claim/v1beta1/query.rpc.Query"; -import * as _514 from "./epochs/query.rpc.Query"; -import * as _515 from "./gamm/v1beta1/query.rpc.Query"; -import * as _516 from "./gamm/v2/query.rpc.Query"; -import * as _517 from "./ibc-rate-limit/v1beta1/query.rpc.Query"; -import * as _518 from "./incentives/query.rpc.Query"; -import * as _519 from "./lockup/query.rpc.Query"; -import * as _520 from "./mint/v1beta1/query.rpc.Query"; -import * as _521 from "./pool-incentives/v1beta1/query.rpc.Query"; -import * as _522 from "./superfluid/query.rpc.Query"; -import * as _523 from "./tokenfactory/v1beta1/query.rpc.Query"; -import * as _524 from "./twap/v1beta1/query.rpc.Query"; -import * as _525 from "./txfees/v1beta1/query.rpc.Query"; -import * as _526 from "./gamm/pool-models/balancer/tx/tx.rpc.msg"; -import * as _527 from "./gamm/pool-models/stableswap/tx.rpc.msg"; -import * as _528 from "./gamm/v1beta1/tx.rpc.msg"; -import * as _529 from "./incentives/tx.rpc.msg"; -import * as _530 from "./lockup/tx.rpc.msg"; -import * as _531 from "./superfluid/tx.rpc.msg"; -import * as _532 from "./tokenfactory/v1beta1/tx.rpc.msg"; -import * as _533 from "./gamm/v1beta1/query.pinia.store"; -import * as _534 from "./gamm/v2/query.pinia.store"; -import * as _556 from "./lcd"; -import * as _557 from "./custom-lcd-client"; -import * as _558 from "./rpc.query"; -import * as _559 from "./rpc.tx"; +import * as _558 from "./gamm/pool-models/balancer/tx/tx.amino"; +import * as _559 from "./gamm/pool-models/stableswap/tx.amino"; +import * as _560 from "./gamm/v1beta1/tx.amino"; +import * as _561 from "./incentives/tx.amino"; +import * as _562 from "./lockup/tx.amino"; +import * as _563 from "./superfluid/tx.amino"; +import * as _564 from "./tokenfactory/v1beta1/tx.amino"; +import * as _565 from "./gamm/pool-models/balancer/tx/tx.registry"; +import * as _566 from "./gamm/pool-models/stableswap/tx.registry"; +import * as _567 from "./gamm/v1beta1/tx.registry"; +import * as _568 from "./incentives/tx.registry"; +import * as _569 from "./lockup/tx.registry"; +import * as _570 from "./superfluid/tx.registry"; +import * as _571 from "./tokenfactory/v1beta1/tx.registry"; +import * as _572 from "./claim/v1beta1/query.lcd"; +import * as _573 from "./epochs/query.lcd"; +import * as _574 from "./gamm/v1beta1/query.lcd"; +import * as _575 from "./gamm/v2/query.lcd"; +import * as _576 from "./ibc-rate-limit/v1beta1/query.lcd"; +import * as _577 from "./incentives/query.lcd"; +import * as _578 from "./lockup/query.lcd"; +import * as _579 from "./mint/v1beta1/query.lcd"; +import * as _580 from "./pool-incentives/v1beta1/query.lcd"; +import * as _581 from "./superfluid/query.lcd"; +import * as _582 from "./tokenfactory/v1beta1/query.lcd"; +import * as _583 from "./twap/v1beta1/query.lcd"; +import * as _584 from "./txfees/v1beta1/query.lcd"; +import * as _585 from "./claim/v1beta1/query.rpc.func"; +import * as _586 from "./epochs/query.rpc.func"; +import * as _587 from "./gamm/v1beta1/query.rpc.func"; +import * as _588 from "./gamm/v2/query.rpc.func"; +import * as _589 from "./ibc-rate-limit/v1beta1/query.rpc.func"; +import * as _590 from "./incentives/query.rpc.func"; +import * as _591 from "./lockup/query.rpc.func"; +import * as _592 from "./mint/v1beta1/query.rpc.func"; +import * as _593 from "./pool-incentives/v1beta1/query.rpc.func"; +import * as _594 from "./superfluid/query.rpc.func"; +import * as _595 from "./tokenfactory/v1beta1/query.rpc.func"; +import * as _596 from "./twap/v1beta1/query.rpc.func"; +import * as _597 from "./txfees/v1beta1/query.rpc.func"; +import * as _598 from "./claim/v1beta1/query.rpc.Query"; +import * as _599 from "./epochs/query.rpc.Query"; +import * as _600 from "./gamm/v1beta1/query.rpc.Query"; +import * as _601 from "./gamm/v2/query.rpc.Query"; +import * as _602 from "./ibc-rate-limit/v1beta1/query.rpc.Query"; +import * as _603 from "./incentives/query.rpc.Query"; +import * as _604 from "./lockup/query.rpc.Query"; +import * as _605 from "./mint/v1beta1/query.rpc.Query"; +import * as _606 from "./pool-incentives/v1beta1/query.rpc.Query"; +import * as _607 from "./superfluid/query.rpc.Query"; +import * as _608 from "./tokenfactory/v1beta1/query.rpc.Query"; +import * as _609 from "./twap/v1beta1/query.rpc.Query"; +import * as _610 from "./txfees/v1beta1/query.rpc.Query"; +import * as _611 from "./gamm/pool-models/balancer/tx/tx.rpc.func"; +import * as _612 from "./gamm/pool-models/stableswap/tx.rpc.func"; +import * as _613 from "./gamm/v1beta1/tx.rpc.func"; +import * as _614 from "./incentives/tx.rpc.func"; +import * as _615 from "./lockup/tx.rpc.func"; +import * as _616 from "./superfluid/tx.rpc.func"; +import * as _617 from "./tokenfactory/v1beta1/tx.rpc.func"; +import * as _618 from "./gamm/pool-models/balancer/tx/tx.rpc.msg"; +import * as _619 from "./gamm/pool-models/stableswap/tx.rpc.msg"; +import * as _620 from "./gamm/v1beta1/tx.rpc.msg"; +import * as _621 from "./incentives/tx.rpc.msg"; +import * as _622 from "./lockup/tx.rpc.msg"; +import * as _623 from "./superfluid/tx.rpc.msg"; +import * as _624 from "./tokenfactory/v1beta1/tx.rpc.msg"; +import * as _625 from "./gamm/v1beta1/query.pinia.store"; +import * as _626 from "./gamm/v2/query.pinia.store"; +import * as _649 from "./lcd"; +import * as _650 from "./custom-lcd-client"; +import * as _651 from "./rpc.query"; +import * as _652 from "./rpc.tx"; export namespace osmosis { export namespace claim { export const v1beta1 = { @@ -109,16 +129,18 @@ export namespace osmosis { ..._255, ..._256, ..._257, - ..._500, - ..._513 + ..._572, + ..._585, + ..._598 }; } export namespace epochs { export const v1beta1 = { ..._258, ..._259, - ..._501, - ..._514 + ..._573, + ..._586, + ..._599 }; } export namespace gamm { @@ -127,45 +149,51 @@ export namespace osmosis { ..._261, ..._262, ..._263, - ..._488, - ..._495, - ..._502, - ..._515, - ..._528, - ..._533 + ..._560, + ..._567, + ..._574, + ..._587, + ..._600, + ..._613, + ..._620, + ..._625 }; export namespace poolmodels { export namespace balancer { export const v1beta1 = { ..._264, - ..._486, - ..._493, - ..._526 + ..._558, + ..._565, + ..._611, + ..._618 }; } export namespace stableswap { export const v1beta1 = { ..._265, ..._266, - ..._487, - ..._494, - ..._527 + ..._559, + ..._566, + ..._612, + ..._619 }; } } export const v2 = { ..._267, - ..._503, - ..._516, - ..._534 + ..._575, + ..._588, + ..._601, + ..._626 }; } export namespace ibcratelimit { export const v1beta1 = { ..._268, ..._269, - ..._504, - ..._517 + ..._576, + ..._589, + ..._602 }; } export const incentives = { @@ -174,11 +202,13 @@ export namespace osmosis { ..._272, ..._273, ..._274, - ..._489, - ..._496, - ..._505, - ..._518, - ..._529 + ..._561, + ..._568, + ..._577, + ..._590, + ..._603, + ..._614, + ..._621 }; export const lockup = { ..._275, @@ -186,19 +216,22 @@ export namespace osmosis { ..._277, ..._278, ..._279, - ..._490, - ..._497, - ..._506, - ..._519, - ..._530 + ..._562, + ..._569, + ..._578, + ..._591, + ..._604, + ..._615, + ..._622 }; export namespace mint { export const v1beta1 = { ..._280, ..._281, ..._282, - ..._507, - ..._520 + ..._579, + ..._592, + ..._605 }; } export namespace poolincentives { @@ -207,8 +240,9 @@ export namespace osmosis { ..._284, ..._285, ..._286, - ..._508, - ..._521 + ..._580, + ..._593, + ..._606 }; } export namespace store { @@ -222,11 +256,13 @@ export namespace osmosis { ..._290, ..._291, ..._292, - ..._491, - ..._498, - ..._509, - ..._522, - ..._531 + ..._563, + ..._570, + ..._581, + ..._594, + ..._607, + ..._616, + ..._623 }; export namespace tokenfactory { export const v1beta1 = { @@ -235,11 +271,13 @@ export namespace osmosis { ..._295, ..._296, ..._297, - ..._492, - ..._499, - ..._510, - ..._523, - ..._532 + ..._564, + ..._571, + ..._582, + ..._595, + ..._608, + ..._617, + ..._624 }; } export namespace twap { @@ -247,8 +285,9 @@ export namespace osmosis { ..._298, ..._299, ..._300, - ..._511, - ..._524 + ..._583, + ..._596, + ..._609 }; } export namespace txfees { @@ -257,14 +296,15 @@ export namespace osmosis { ..._302, ..._303, ..._304, - ..._512, - ..._525 + ..._584, + ..._597, + ..._610 }; } export const ClientFactory = { - ..._556, - ..._557, - ..._558, - ..._559 + ..._649, + ..._650, + ..._651, + ..._652 }; } \ No newline at end of file diff --git a/__fixtures__/v-next/outputsign/osmosis/claim/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputsign/osmosis/claim/v1beta1/query.rpc.func.ts new file mode 100644 index 0000000000..533eec15e2 --- /dev/null +++ b/__fixtures__/v-next/outputsign/osmosis/claim/v1beta1/query.rpc.func.ts @@ -0,0 +1,60 @@ +import { Action, ActionSDKType, ClaimRecord, ClaimRecordSDKType } from "./claim"; +import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; +import { Params, ParamsSDKType } from "./params"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { QueryModuleAccountBalanceRequest, QueryModuleAccountBalanceRequestSDKType, QueryModuleAccountBalanceResponse, QueryModuleAccountBalanceResponseSDKType, QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, QueryClaimRecordRequest, QueryClaimRecordRequestSDKType, QueryClaimRecordResponse, QueryClaimRecordResponseSDKType, QueryClaimableForActionRequest, QueryClaimableForActionRequestSDKType, QueryClaimableForActionResponse, QueryClaimableForActionResponseSDKType, QueryTotalClaimableRequest, QueryTotalClaimableRequestSDKType, QueryTotalClaimableResponse, QueryTotalClaimableResponseSDKType } from "./query"; +/** + * @name getModuleAccountBalance + * @package osmosis.claim.v1beta1 + * @see proto service: osmosis.claim.v1beta1.ModuleAccountBalance + */ +export const getModuleAccountBalance = buildQuery({ + encode: QueryModuleAccountBalanceRequest.encode, + decode: QueryModuleAccountBalanceResponse.decode, + service: "osmosis.claim.v1beta1.Query", + method: "ModuleAccountBalance" +}); +/** + * @name getParams + * @package osmosis.claim.v1beta1 + * @see proto service: osmosis.claim.v1beta1.Params + */ +export const getParams = buildQuery({ + encode: QueryParamsRequest.encode, + decode: QueryParamsResponse.decode, + service: "osmosis.claim.v1beta1.Query", + method: "Params" +}); +/** + * @name getClaimRecord + * @package osmosis.claim.v1beta1 + * @see proto service: osmosis.claim.v1beta1.ClaimRecord + */ +export const getClaimRecord = buildQuery({ + encode: QueryClaimRecordRequest.encode, + decode: QueryClaimRecordResponse.decode, + service: "osmosis.claim.v1beta1.Query", + method: "ClaimRecord" +}); +/** + * @name getClaimableForAction + * @package osmosis.claim.v1beta1 + * @see proto service: osmosis.claim.v1beta1.ClaimableForAction + */ +export const getClaimableForAction = buildQuery({ + encode: QueryClaimableForActionRequest.encode, + decode: QueryClaimableForActionResponse.decode, + service: "osmosis.claim.v1beta1.Query", + method: "ClaimableForAction" +}); +/** + * @name getTotalClaimable + * @package osmosis.claim.v1beta1 + * @see proto service: osmosis.claim.v1beta1.TotalClaimable + */ +export const getTotalClaimable = buildQuery({ + encode: QueryTotalClaimableRequest.encode, + decode: QueryTotalClaimableResponse.decode, + service: "osmosis.claim.v1beta1.Query", + method: "TotalClaimable" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputsign/osmosis/epochs/query.rpc.func.ts b/__fixtures__/v-next/outputsign/osmosis/epochs/query.rpc.func.ts new file mode 100644 index 0000000000..30e6281677 --- /dev/null +++ b/__fixtures__/v-next/outputsign/osmosis/epochs/query.rpc.func.ts @@ -0,0 +1,27 @@ +import { EpochInfo, EpochInfoSDKType } from "./genesis"; +import { EndpointOrRpc, buildQuery } from "../../helper-func-types"; +import { QueryEpochsInfoRequest, QueryEpochsInfoRequestSDKType, QueryEpochsInfoResponse, QueryEpochsInfoResponseSDKType, QueryCurrentEpochRequest, QueryCurrentEpochRequestSDKType, QueryCurrentEpochResponse, QueryCurrentEpochResponseSDKType } from "./query"; +/** + * EpochInfos provide running epochInfos + * @name getEpochInfos + * @package osmosis.epochs.v1beta1 + * @see proto service: osmosis.epochs.v1beta1.EpochInfos + */ +export const getEpochInfos = buildQuery({ + encode: QueryEpochsInfoRequest.encode, + decode: QueryEpochsInfoResponse.decode, + service: "osmosis.epochs.v1beta1.Query", + method: "EpochInfos" +}); +/** + * CurrentEpoch provide current epoch of specified identifier + * @name getCurrentEpoch + * @package osmosis.epochs.v1beta1 + * @see proto service: osmosis.epochs.v1beta1.CurrentEpoch + */ +export const getCurrentEpoch = buildQuery({ + encode: QueryCurrentEpochRequest.encode, + decode: QueryCurrentEpochResponse.decode, + service: "osmosis.epochs.v1beta1.Query", + method: "CurrentEpoch" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputsign/osmosis/gamm/pool-models/balancer/balancerPool.ts b/__fixtures__/v-next/outputsign/osmosis/gamm/pool-models/balancer/balancerPool.ts index 06ea57702a..b3ae564b8e 100644 --- a/__fixtures__/v-next/outputsign/osmosis/gamm/pool-models/balancer/balancerPool.ts +++ b/__fixtures__/v-next/outputsign/osmosis/gamm/pool-models/balancer/balancerPool.ts @@ -3,7 +3,7 @@ import { Duration, DurationAmino, DurationSDKType } from "../../../../google/pro import { Coin, CoinAmino, CoinSDKType } from "../../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../../binary"; import { toTimestamp, fromTimestamp, DeepPartial } from "../../../../helpers"; -import { Decimal } from "@cosmjs/math"; +import { Decimal } from "@interchainjs/math"; export const protobufPackage = "osmosis.gamm.v1beta1"; /** * Parameters for changing the weights in a balancer pool smoothly from @@ -528,8 +528,8 @@ export const PoolParams = { }, toAmino(message: PoolParams): PoolParamsAmino { const obj: any = {}; - obj.swap_fee = message.swapFee === "" ? undefined : message.swapFee; - obj.exit_fee = message.exitFee === "" ? undefined : message.exitFee; + obj.swap_fee = message.swapFee === "" ? undefined : Decimal.fromUserInput(message.swapFee, 18).atomics; + obj.exit_fee = message.exitFee === "" ? undefined : Decimal.fromUserInput(message.exitFee, 18).atomics; obj.smooth_weight_change_params = message.smoothWeightChangeParams ? SmoothWeightChangeParams.toAmino(message.smoothWeightChangeParams) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputsign/osmosis/gamm/pool-models/balancer/tx/tx.rpc.func.ts b/__fixtures__/v-next/outputsign/osmosis/gamm/pool-models/balancer/tx/tx.rpc.func.ts new file mode 100644 index 0000000000..d5b603efb5 --- /dev/null +++ b/__fixtures__/v-next/outputsign/osmosis/gamm/pool-models/balancer/tx/tx.rpc.func.ts @@ -0,0 +1,11 @@ +import { PoolParams, PoolParamsSDKType, PoolAsset, PoolAssetSDKType } from "../balancerPool"; +import { buildTx } from "../../../../../helper-func-types"; +import { MsgCreateBalancerPool, MsgCreateBalancerPoolSDKType, MsgCreateBalancerPoolResponse, MsgCreateBalancerPoolResponseSDKType } from "./tx"; +/** + * @name createBalancerPool + * @package osmosis.gamm.poolmodels.balancer.v1beta1 + * @see proto service: osmosis.gamm.poolmodels.balancer.v1beta1.CreateBalancerPool + */ +export const createBalancerPool = buildTx({ + msg: MsgCreateBalancerPool +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputsign/osmosis/gamm/pool-models/stableswap/stableswap_pool.ts b/__fixtures__/v-next/outputsign/osmosis/gamm/pool-models/stableswap/stableswap_pool.ts index ffacfced75..13304b8d11 100644 --- a/__fixtures__/v-next/outputsign/osmosis/gamm/pool-models/stableswap/stableswap_pool.ts +++ b/__fixtures__/v-next/outputsign/osmosis/gamm/pool-models/stableswap/stableswap_pool.ts @@ -1,6 +1,6 @@ import { Coin, CoinAmino, CoinSDKType } from "../../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { Decimal } from "@cosmjs/math"; +import { Decimal } from "@interchainjs/math"; import { DeepPartial } from "../../../../helpers"; export const protobufPackage = "osmosis.gamm.poolmodels.stableswap.v1beta1"; /** @@ -214,8 +214,8 @@ export const PoolParams = { }, toAmino(message: PoolParams): PoolParamsAmino { const obj: any = {}; - obj.swap_fee = message.swapFee === "" ? undefined : message.swapFee; - obj.exit_fee = message.exitFee === "" ? undefined : message.exitFee; + obj.swap_fee = message.swapFee === "" ? undefined : Decimal.fromUserInput(message.swapFee, 18).atomics; + obj.exit_fee = message.exitFee === "" ? undefined : Decimal.fromUserInput(message.exitFee, 18).atomics; return obj; }, fromAminoMsg(object: PoolParamsAminoMsg): PoolParams { diff --git a/__fixtures__/v-next/outputsign/osmosis/gamm/pool-models/stableswap/tx.rpc.func.ts b/__fixtures__/v-next/outputsign/osmosis/gamm/pool-models/stableswap/tx.rpc.func.ts new file mode 100644 index 0000000000..6e46af505b --- /dev/null +++ b/__fixtures__/v-next/outputsign/osmosis/gamm/pool-models/stableswap/tx.rpc.func.ts @@ -0,0 +1,20 @@ +import { PoolParams, PoolParamsSDKType } from "./stableswap_pool"; +import { Coin, CoinSDKType } from "../../../../cosmos/base/v1beta1/coin"; +import { buildTx } from "../../../../helper-func-types"; +import { MsgCreateStableswapPool, MsgCreateStableswapPoolSDKType, MsgCreateStableswapPoolResponse, MsgCreateStableswapPoolResponseSDKType, MsgStableSwapAdjustScalingFactors, MsgStableSwapAdjustScalingFactorsSDKType, MsgStableSwapAdjustScalingFactorsResponse, MsgStableSwapAdjustScalingFactorsResponseSDKType } from "./tx"; +/** + * @name createStableswapPool + * @package osmosis.gamm.poolmodels.stableswap.v1beta1 + * @see proto service: osmosis.gamm.poolmodels.stableswap.v1beta1.CreateStableswapPool + */ +export const createStableswapPool = buildTx({ + msg: MsgCreateStableswapPool +}); +/** + * @name stableSwapAdjustScalingFactors + * @package osmosis.gamm.poolmodels.stableswap.v1beta1 + * @see proto service: osmosis.gamm.poolmodels.stableswap.v1beta1.StableSwapAdjustScalingFactors + */ +export const stableSwapAdjustScalingFactors = buildTx({ + msg: MsgStableSwapAdjustScalingFactors +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputsign/osmosis/gamm/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputsign/osmosis/gamm/v1beta1/query.rpc.func.ts new file mode 100644 index 0000000000..0ef0f1c3c1 --- /dev/null +++ b/__fixtures__/v-next/outputsign/osmosis/gamm/v1beta1/query.rpc.func.ts @@ -0,0 +1,183 @@ +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination"; +import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; +import { SwapAmountInRoute, SwapAmountInRouteSDKType, SwapAmountOutRoute, SwapAmountOutRouteSDKType } from "./tx"; +import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../google/protobuf/any"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { QueryPoolsRequest, QueryPoolsRequestSDKType, QueryPoolsResponse, QueryPoolsResponseSDKType, QueryNumPoolsRequest, QueryNumPoolsRequestSDKType, QueryNumPoolsResponse, QueryNumPoolsResponseSDKType, QueryTotalLiquidityRequest, QueryTotalLiquidityRequestSDKType, QueryTotalLiquidityResponse, QueryTotalLiquidityResponseSDKType, QueryPoolsWithFilterRequest, QueryPoolsWithFilterRequestSDKType, QueryPoolsWithFilterResponse, QueryPoolsWithFilterResponseSDKType, QueryPoolRequest, QueryPoolRequestSDKType, QueryPoolResponse, QueryPoolResponseSDKType, QueryPoolTypeRequest, QueryPoolTypeRequestSDKType, QueryPoolTypeResponse, QueryPoolTypeResponseSDKType, QueryCalcJoinPoolNoSwapSharesRequest, QueryCalcJoinPoolNoSwapSharesRequestSDKType, QueryCalcJoinPoolNoSwapSharesResponse, QueryCalcJoinPoolNoSwapSharesResponseSDKType, QueryCalcJoinPoolSharesRequest, QueryCalcJoinPoolSharesRequestSDKType, QueryCalcJoinPoolSharesResponse, QueryCalcJoinPoolSharesResponseSDKType, QueryCalcExitPoolCoinsFromSharesRequest, QueryCalcExitPoolCoinsFromSharesRequestSDKType, QueryCalcExitPoolCoinsFromSharesResponse, QueryCalcExitPoolCoinsFromSharesResponseSDKType, QueryPoolParamsRequest, QueryPoolParamsRequestSDKType, QueryPoolParamsResponse, QueryPoolParamsResponseSDKType, QueryTotalPoolLiquidityRequest, QueryTotalPoolLiquidityRequestSDKType, QueryTotalPoolLiquidityResponse, QueryTotalPoolLiquidityResponseSDKType, QueryTotalSharesRequest, QueryTotalSharesRequestSDKType, QueryTotalSharesResponse, QueryTotalSharesResponseSDKType, QuerySpotPriceRequest, QuerySpotPriceRequestSDKType, QuerySpotPriceResponse, QuerySpotPriceResponseSDKType, QuerySwapExactAmountInRequest, QuerySwapExactAmountInRequestSDKType, QuerySwapExactAmountInResponse, QuerySwapExactAmountInResponseSDKType, QuerySwapExactAmountOutRequest, QuerySwapExactAmountOutRequestSDKType, QuerySwapExactAmountOutResponse, QuerySwapExactAmountOutResponseSDKType } from "./query"; +/** + * @name getPools + * @package osmosis.gamm.v1beta1 + * @see proto service: osmosis.gamm.v1beta1.Pools + */ +export const getPools = buildQuery({ + encode: QueryPoolsRequest.encode, + decode: QueryPoolsResponse.decode, + service: "osmosis.gamm.v1beta1.Query", + method: "Pools" +}); +/** + * @name getNumPools + * @package osmosis.gamm.v1beta1 + * @see proto service: osmosis.gamm.v1beta1.NumPools + */ +export const getNumPools = buildQuery({ + encode: QueryNumPoolsRequest.encode, + decode: QueryNumPoolsResponse.decode, + service: "osmosis.gamm.v1beta1.Query", + method: "NumPools" +}); +/** + * @name getTotalLiquidity + * @package osmosis.gamm.v1beta1 + * @see proto service: osmosis.gamm.v1beta1.TotalLiquidity + */ +export const getTotalLiquidity = buildQuery({ + encode: QueryTotalLiquidityRequest.encode, + decode: QueryTotalLiquidityResponse.decode, + service: "osmosis.gamm.v1beta1.Query", + method: "TotalLiquidity" +}); +/** + * PoolsWithFilter allows you to query specific pools with requested + * parameters + * @name getPoolsWithFilter + * @package osmosis.gamm.v1beta1 + * @see proto service: osmosis.gamm.v1beta1.PoolsWithFilter + */ +export const getPoolsWithFilter = buildQuery({ + encode: QueryPoolsWithFilterRequest.encode, + decode: QueryPoolsWithFilterResponse.decode, + service: "osmosis.gamm.v1beta1.Query", + method: "PoolsWithFilter" +}); +/** + * Per Pool gRPC Endpoints + * @name getPool + * @package osmosis.gamm.v1beta1 + * @see proto service: osmosis.gamm.v1beta1.Pool + */ +export const getPool = buildQuery({ + encode: QueryPoolRequest.encode, + decode: QueryPoolResponse.decode, + service: "osmosis.gamm.v1beta1.Query", + method: "Pool" +}); +/** + * PoolType returns the type of the pool. + * Returns "Balancer" as a string literal when the pool is a balancer pool. + * Errors if the pool is failed to be type caseted. + * @name getPoolType + * @package osmosis.gamm.v1beta1 + * @see proto service: osmosis.gamm.v1beta1.PoolType + */ +export const getPoolType = buildQuery({ + encode: QueryPoolTypeRequest.encode, + decode: QueryPoolTypeResponse.decode, + service: "osmosis.gamm.v1beta1.Query", + method: "PoolType" +}); +/** + * Simulates joining pool without a swap. Returns the amount of shares you'd + * get and tokens needed to provide + * @name getCalcJoinPoolNoSwapShares + * @package osmosis.gamm.v1beta1 + * @see proto service: osmosis.gamm.v1beta1.CalcJoinPoolNoSwapShares + */ +export const getCalcJoinPoolNoSwapShares = buildQuery({ + encode: QueryCalcJoinPoolNoSwapSharesRequest.encode, + decode: QueryCalcJoinPoolNoSwapSharesResponse.decode, + service: "osmosis.gamm.v1beta1.Query", + method: "CalcJoinPoolNoSwapShares" +}); +/** + * @name getCalcJoinPoolShares + * @package osmosis.gamm.v1beta1 + * @see proto service: osmosis.gamm.v1beta1.CalcJoinPoolShares + */ +export const getCalcJoinPoolShares = buildQuery({ + encode: QueryCalcJoinPoolSharesRequest.encode, + decode: QueryCalcJoinPoolSharesResponse.decode, + service: "osmosis.gamm.v1beta1.Query", + method: "CalcJoinPoolShares" +}); +/** + * @name getCalcExitPoolCoinsFromShares + * @package osmosis.gamm.v1beta1 + * @see proto service: osmosis.gamm.v1beta1.CalcExitPoolCoinsFromShares + */ +export const getCalcExitPoolCoinsFromShares = buildQuery({ + encode: QueryCalcExitPoolCoinsFromSharesRequest.encode, + decode: QueryCalcExitPoolCoinsFromSharesResponse.decode, + service: "osmosis.gamm.v1beta1.Query", + method: "CalcExitPoolCoinsFromShares" +}); +/** + * @name getPoolParams + * @package osmosis.gamm.v1beta1 + * @see proto service: osmosis.gamm.v1beta1.PoolParams + */ +export const getPoolParams = buildQuery({ + encode: QueryPoolParamsRequest.encode, + decode: QueryPoolParamsResponse.decode, + service: "osmosis.gamm.v1beta1.Query", + method: "PoolParams" +}); +/** + * @name getTotalPoolLiquidity + * @package osmosis.gamm.v1beta1 + * @see proto service: osmosis.gamm.v1beta1.TotalPoolLiquidity + */ +export const getTotalPoolLiquidity = buildQuery({ + encode: QueryTotalPoolLiquidityRequest.encode, + decode: QueryTotalPoolLiquidityResponse.decode, + service: "osmosis.gamm.v1beta1.Query", + method: "TotalPoolLiquidity" +}); +/** + * @name getTotalShares + * @package osmosis.gamm.v1beta1 + * @see proto service: osmosis.gamm.v1beta1.TotalShares + */ +export const getTotalShares = buildQuery({ + encode: QueryTotalSharesRequest.encode, + decode: QueryTotalSharesResponse.decode, + service: "osmosis.gamm.v1beta1.Query", + method: "TotalShares" +}); +/** + * SpotPrice defines a gRPC query handler that returns the spot price given + * a base denomination and a quote denomination. + * @name getSpotPrice + * @package osmosis.gamm.v1beta1 + * @see proto service: osmosis.gamm.v1beta1.SpotPrice + * @deprecated + */ +export const getSpotPrice = buildQuery({ + encode: QuerySpotPriceRequest.encode, + decode: QuerySpotPriceResponse.decode, + service: "osmosis.gamm.v1beta1.Query", + method: "SpotPrice" +}); +/** + * Estimate the swap. + * @name getEstimateSwapExactAmountIn + * @package osmosis.gamm.v1beta1 + * @see proto service: osmosis.gamm.v1beta1.EstimateSwapExactAmountIn + */ +export const getEstimateSwapExactAmountIn = buildQuery({ + encode: QuerySwapExactAmountInRequest.encode, + decode: QuerySwapExactAmountInResponse.decode, + service: "osmosis.gamm.v1beta1.Query", + method: "EstimateSwapExactAmountIn" +}); +/** + * @name getEstimateSwapExactAmountOut + * @package osmosis.gamm.v1beta1 + * @see proto service: osmosis.gamm.v1beta1.EstimateSwapExactAmountOut + */ +export const getEstimateSwapExactAmountOut = buildQuery({ + encode: QuerySwapExactAmountOutRequest.encode, + decode: QuerySwapExactAmountOutResponse.decode, + service: "osmosis.gamm.v1beta1.Query", + method: "EstimateSwapExactAmountOut" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputsign/osmosis/gamm/v1beta1/tx.rpc.func.ts b/__fixtures__/v-next/outputsign/osmosis/gamm/v1beta1/tx.rpc.func.ts new file mode 100644 index 0000000000..005459cc78 --- /dev/null +++ b/__fixtures__/v-next/outputsign/osmosis/gamm/v1beta1/tx.rpc.func.ts @@ -0,0 +1,67 @@ +import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; +import { buildTx } from "../../../helper-func-types"; +import { MsgJoinPool, MsgJoinPoolSDKType, MsgJoinPoolResponse, MsgJoinPoolResponseSDKType, MsgExitPool, MsgExitPoolSDKType, MsgExitPoolResponse, MsgExitPoolResponseSDKType, MsgSwapExactAmountIn, MsgSwapExactAmountInSDKType, MsgSwapExactAmountInResponse, MsgSwapExactAmountInResponseSDKType, MsgSwapExactAmountOut, MsgSwapExactAmountOutSDKType, MsgSwapExactAmountOutResponse, MsgSwapExactAmountOutResponseSDKType, MsgJoinSwapExternAmountIn, MsgJoinSwapExternAmountInSDKType, MsgJoinSwapExternAmountInResponse, MsgJoinSwapExternAmountInResponseSDKType, MsgJoinSwapShareAmountOut, MsgJoinSwapShareAmountOutSDKType, MsgJoinSwapShareAmountOutResponse, MsgJoinSwapShareAmountOutResponseSDKType, MsgExitSwapExternAmountOut, MsgExitSwapExternAmountOutSDKType, MsgExitSwapExternAmountOutResponse, MsgExitSwapExternAmountOutResponseSDKType, MsgExitSwapShareAmountIn, MsgExitSwapShareAmountInSDKType, MsgExitSwapShareAmountInResponse, MsgExitSwapShareAmountInResponseSDKType } from "./tx"; +/** + * @name joinPool + * @package osmosis.gamm.v1beta1 + * @see proto service: osmosis.gamm.v1beta1.JoinPool + */ +export const joinPool = buildTx({ + msg: MsgJoinPool +}); +/** + * @name exitPool + * @package osmosis.gamm.v1beta1 + * @see proto service: osmosis.gamm.v1beta1.ExitPool + */ +export const exitPool = buildTx({ + msg: MsgExitPool +}); +/** + * @name swapExactAmountIn + * @package osmosis.gamm.v1beta1 + * @see proto service: osmosis.gamm.v1beta1.SwapExactAmountIn + */ +export const swapExactAmountIn = buildTx({ + msg: MsgSwapExactAmountIn +}); +/** + * @name swapExactAmountOut + * @package osmosis.gamm.v1beta1 + * @see proto service: osmosis.gamm.v1beta1.SwapExactAmountOut + */ +export const swapExactAmountOut = buildTx({ + msg: MsgSwapExactAmountOut +}); +/** + * @name joinSwapExternAmountIn + * @package osmosis.gamm.v1beta1 + * @see proto service: osmosis.gamm.v1beta1.JoinSwapExternAmountIn + */ +export const joinSwapExternAmountIn = buildTx({ + msg: MsgJoinSwapExternAmountIn +}); +/** + * @name joinSwapShareAmountOut + * @package osmosis.gamm.v1beta1 + * @see proto service: osmosis.gamm.v1beta1.JoinSwapShareAmountOut + */ +export const joinSwapShareAmountOut = buildTx({ + msg: MsgJoinSwapShareAmountOut +}); +/** + * @name exitSwapExternAmountOut + * @package osmosis.gamm.v1beta1 + * @see proto service: osmosis.gamm.v1beta1.ExitSwapExternAmountOut + */ +export const exitSwapExternAmountOut = buildTx({ + msg: MsgExitSwapExternAmountOut +}); +/** + * @name exitSwapShareAmountIn + * @package osmosis.gamm.v1beta1 + * @see proto service: osmosis.gamm.v1beta1.ExitSwapShareAmountIn + */ +export const exitSwapShareAmountIn = buildTx({ + msg: MsgExitSwapShareAmountIn +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputsign/osmosis/gamm/v2/query.rpc.func.ts b/__fixtures__/v-next/outputsign/osmosis/gamm/v2/query.rpc.func.ts new file mode 100644 index 0000000000..7e1cbf5290 --- /dev/null +++ b/__fixtures__/v-next/outputsign/osmosis/gamm/v2/query.rpc.func.ts @@ -0,0 +1,15 @@ +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { QuerySpotPriceRequest, QuerySpotPriceRequestSDKType, QuerySpotPriceResponse, QuerySpotPriceResponseSDKType } from "./query"; +/** + * SpotPrice defines a gRPC query handler that returns the spot price given + * a base denomination and a quote denomination. + * @name getSpotPrice + * @package osmosis.gamm.v2 + * @see proto service: osmosis.gamm.v2.SpotPrice + */ +export const getSpotPrice = buildQuery({ + encode: QuerySpotPriceRequest.encode, + decode: QuerySpotPriceResponse.decode, + service: "osmosis.gamm.v2.Query", + method: "SpotPrice" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputsign/osmosis/ibc-rate-limit/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputsign/osmosis/ibc-rate-limit/v1beta1/query.rpc.func.ts new file mode 100644 index 0000000000..ce47a9f6ce --- /dev/null +++ b/__fixtures__/v-next/outputsign/osmosis/ibc-rate-limit/v1beta1/query.rpc.func.ts @@ -0,0 +1,16 @@ +import { Params, ParamsSDKType } from "./params"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType } from "./query"; +/** + * Params defines a gRPC query method that returns the ibc-rate-limit module's + * parameters. + * @name getParams + * @package osmosis.ibcratelimit.v1beta1 + * @see proto service: osmosis.ibcratelimit.v1beta1.Params + */ +export const getParams = buildQuery({ + encode: QueryParamsRequest.encode, + decode: QueryParamsResponse.decode, + service: "osmosis.ibcratelimit.v1beta1.Query", + method: "Params" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputsign/osmosis/incentives/query.rpc.func.ts b/__fixtures__/v-next/outputsign/osmosis/incentives/query.rpc.func.ts new file mode 100644 index 0000000000..38b91c63ed --- /dev/null +++ b/__fixtures__/v-next/outputsign/osmosis/incentives/query.rpc.func.ts @@ -0,0 +1,118 @@ +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../cosmos/base/query/v1beta1/pagination"; +import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; +import { Gauge, GaugeSDKType } from "./gauge"; +import { Duration, DurationSDKType } from "../../google/protobuf/duration"; +import { EndpointOrRpc, buildQuery } from "../../helper-func-types"; +import { ModuleToDistributeCoinsRequest, ModuleToDistributeCoinsRequestSDKType, ModuleToDistributeCoinsResponse, ModuleToDistributeCoinsResponseSDKType, GaugeByIDRequest, GaugeByIDRequestSDKType, GaugeByIDResponse, GaugeByIDResponseSDKType, GaugesRequest, GaugesRequestSDKType, GaugesResponse, GaugesResponseSDKType, ActiveGaugesRequest, ActiveGaugesRequestSDKType, ActiveGaugesResponse, ActiveGaugesResponseSDKType, ActiveGaugesPerDenomRequest, ActiveGaugesPerDenomRequestSDKType, ActiveGaugesPerDenomResponse, ActiveGaugesPerDenomResponseSDKType, UpcomingGaugesRequest, UpcomingGaugesRequestSDKType, UpcomingGaugesResponse, UpcomingGaugesResponseSDKType, UpcomingGaugesPerDenomRequest, UpcomingGaugesPerDenomRequestSDKType, UpcomingGaugesPerDenomResponse, UpcomingGaugesPerDenomResponseSDKType, RewardsEstRequest, RewardsEstRequestSDKType, RewardsEstResponse, RewardsEstResponseSDKType, QueryLockableDurationsRequest, QueryLockableDurationsRequestSDKType, QueryLockableDurationsResponse, QueryLockableDurationsResponseSDKType } from "./query"; +/** + * ModuleToDistributeCoins returns coins that are going to be distributed + * @name getModuleToDistributeCoins + * @package osmosis.incentives + * @see proto service: osmosis.incentives.ModuleToDistributeCoins + */ +export const getModuleToDistributeCoins = buildQuery({ + encode: ModuleToDistributeCoinsRequest.encode, + decode: ModuleToDistributeCoinsResponse.decode, + service: "osmosis.incentives.Query", + method: "ModuleToDistributeCoins" +}); +/** + * GaugeByID returns gauges by their respective ID + * @name getGaugeByID + * @package osmosis.incentives + * @see proto service: osmosis.incentives.GaugeByID + */ +export const getGaugeByID = buildQuery({ + encode: GaugeByIDRequest.encode, + decode: GaugeByIDResponse.decode, + service: "osmosis.incentives.Query", + method: "GaugeByID" +}); +/** + * Gauges returns both upcoming and active gauges + * @name getGauges + * @package osmosis.incentives + * @see proto service: osmosis.incentives.Gauges + */ +export const getGauges = buildQuery({ + encode: GaugesRequest.encode, + decode: GaugesResponse.decode, + service: "osmosis.incentives.Query", + method: "Gauges" +}); +/** + * ActiveGauges returns active gauges + * @name getActiveGauges + * @package osmosis.incentives + * @see proto service: osmosis.incentives.ActiveGauges + */ +export const getActiveGauges = buildQuery({ + encode: ActiveGaugesRequest.encode, + decode: ActiveGaugesResponse.decode, + service: "osmosis.incentives.Query", + method: "ActiveGauges" +}); +/** + * ActiveGaugesPerDenom returns active gauges by denom + * @name getActiveGaugesPerDenom + * @package osmosis.incentives + * @see proto service: osmosis.incentives.ActiveGaugesPerDenom + */ +export const getActiveGaugesPerDenom = buildQuery({ + encode: ActiveGaugesPerDenomRequest.encode, + decode: ActiveGaugesPerDenomResponse.decode, + service: "osmosis.incentives.Query", + method: "ActiveGaugesPerDenom" +}); +/** + * Returns scheduled gauges that have not yet occured + * @name getUpcomingGauges + * @package osmosis.incentives + * @see proto service: osmosis.incentives.UpcomingGauges + */ +export const getUpcomingGauges = buildQuery({ + encode: UpcomingGaugesRequest.encode, + decode: UpcomingGaugesResponse.decode, + service: "osmosis.incentives.Query", + method: "UpcomingGauges" +}); +/** + * UpcomingGaugesPerDenom returns scheduled gauges that have not yet occured + * by denom + * @name getUpcomingGaugesPerDenom + * @package osmosis.incentives + * @see proto service: osmosis.incentives.UpcomingGaugesPerDenom + */ +export const getUpcomingGaugesPerDenom = buildQuery({ + encode: UpcomingGaugesPerDenomRequest.encode, + decode: UpcomingGaugesPerDenomResponse.decode, + service: "osmosis.incentives.Query", + method: "UpcomingGaugesPerDenom" +}); +/** + * RewardsEst returns an estimate of the rewards from now until a specified + * time in the future The querier either provides an address or a set of locks + * for which they want to find the associated rewards + * @name getRewardsEst + * @package osmosis.incentives + * @see proto service: osmosis.incentives.RewardsEst + */ +export const getRewardsEst = buildQuery({ + encode: RewardsEstRequest.encode, + decode: RewardsEstResponse.decode, + service: "osmosis.incentives.Query", + method: "RewardsEst" +}); +/** + * LockableDurations returns lockable durations that are valid to distribute + * incentives for + * @name getLockableDurations + * @package osmosis.incentives + * @see proto service: osmosis.incentives.LockableDurations + */ +export const getLockableDurations = buildQuery({ + encode: QueryLockableDurationsRequest.encode, + decode: QueryLockableDurationsResponse.decode, + service: "osmosis.incentives.Query", + method: "LockableDurations" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputsign/osmosis/incentives/tx.rpc.func.ts b/__fixtures__/v-next/outputsign/osmosis/incentives/tx.rpc.func.ts new file mode 100644 index 0000000000..6c5516e08b --- /dev/null +++ b/__fixtures__/v-next/outputsign/osmosis/incentives/tx.rpc.func.ts @@ -0,0 +1,21 @@ +import { QueryCondition, QueryConditionSDKType } from "../lockup/lock"; +import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; +import { Timestamp, TimestampSDKType } from "../../google/protobuf/timestamp"; +import { buildTx } from "../../helper-func-types"; +import { MsgCreateGauge, MsgCreateGaugeSDKType, MsgCreateGaugeResponse, MsgCreateGaugeResponseSDKType, MsgAddToGauge, MsgAddToGaugeSDKType, MsgAddToGaugeResponse, MsgAddToGaugeResponseSDKType } from "./tx"; +/** + * @name createGauge + * @package osmosis.incentives + * @see proto service: osmosis.incentives.CreateGauge + */ +export const createGauge = buildTx({ + msg: MsgCreateGauge +}); +/** + * @name addToGauge + * @package osmosis.incentives + * @see proto service: osmosis.incentives.AddToGauge + */ +export const addToGauge = buildTx({ + msg: MsgAddToGauge +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputsign/osmosis/lockup/query.rpc.func.ts b/__fixtures__/v-next/outputsign/osmosis/lockup/query.rpc.func.ts new file mode 100644 index 0000000000..a126fbdd36 --- /dev/null +++ b/__fixtures__/v-next/outputsign/osmosis/lockup/query.rpc.func.ts @@ -0,0 +1,213 @@ +import { Timestamp, TimestampSDKType } from "../../google/protobuf/timestamp"; +import { Duration, DurationSDKType } from "../../google/protobuf/duration"; +import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; +import { PeriodLock, PeriodLockSDKType, SyntheticLock, SyntheticLockSDKType } from "./lock"; +import { Params, ParamsSDKType } from "./params"; +import { EndpointOrRpc, buildQuery } from "../../helper-func-types"; +import { ModuleBalanceRequest, ModuleBalanceRequestSDKType, ModuleBalanceResponse, ModuleBalanceResponseSDKType, ModuleLockedAmountRequest, ModuleLockedAmountRequestSDKType, ModuleLockedAmountResponse, ModuleLockedAmountResponseSDKType, AccountUnlockableCoinsRequest, AccountUnlockableCoinsRequestSDKType, AccountUnlockableCoinsResponse, AccountUnlockableCoinsResponseSDKType, AccountUnlockingCoinsRequest, AccountUnlockingCoinsRequestSDKType, AccountUnlockingCoinsResponse, AccountUnlockingCoinsResponseSDKType, AccountLockedCoinsRequest, AccountLockedCoinsRequestSDKType, AccountLockedCoinsResponse, AccountLockedCoinsResponseSDKType, AccountLockedPastTimeRequest, AccountLockedPastTimeRequestSDKType, AccountLockedPastTimeResponse, AccountLockedPastTimeResponseSDKType, AccountLockedPastTimeNotUnlockingOnlyRequest, AccountLockedPastTimeNotUnlockingOnlyRequestSDKType, AccountLockedPastTimeNotUnlockingOnlyResponse, AccountLockedPastTimeNotUnlockingOnlyResponseSDKType, AccountUnlockedBeforeTimeRequest, AccountUnlockedBeforeTimeRequestSDKType, AccountUnlockedBeforeTimeResponse, AccountUnlockedBeforeTimeResponseSDKType, AccountLockedPastTimeDenomRequest, AccountLockedPastTimeDenomRequestSDKType, AccountLockedPastTimeDenomResponse, AccountLockedPastTimeDenomResponseSDKType, LockedDenomRequest, LockedDenomRequestSDKType, LockedDenomResponse, LockedDenomResponseSDKType, LockedRequest, LockedRequestSDKType, LockedResponse, LockedResponseSDKType, SyntheticLockupsByLockupIDRequest, SyntheticLockupsByLockupIDRequestSDKType, SyntheticLockupsByLockupIDResponse, SyntheticLockupsByLockupIDResponseSDKType, AccountLockedLongerDurationRequest, AccountLockedLongerDurationRequestSDKType, AccountLockedLongerDurationResponse, AccountLockedLongerDurationResponseSDKType, AccountLockedDurationRequest, AccountLockedDurationRequestSDKType, AccountLockedDurationResponse, AccountLockedDurationResponseSDKType, AccountLockedLongerDurationNotUnlockingOnlyRequest, AccountLockedLongerDurationNotUnlockingOnlyRequestSDKType, AccountLockedLongerDurationNotUnlockingOnlyResponse, AccountLockedLongerDurationNotUnlockingOnlyResponseSDKType, AccountLockedLongerDurationDenomRequest, AccountLockedLongerDurationDenomRequestSDKType, AccountLockedLongerDurationDenomResponse, AccountLockedLongerDurationDenomResponseSDKType, QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType } from "./query"; +/** + * Return full balance of the module + * @name getModuleBalance + * @package osmosis.lockup + * @see proto service: osmosis.lockup.ModuleBalance + */ +export const getModuleBalance = buildQuery({ + encode: ModuleBalanceRequest.encode, + decode: ModuleBalanceResponse.decode, + service: "osmosis.lockup.Query", + method: "ModuleBalance" +}); +/** + * Return locked balance of the module + * @name getModuleLockedAmount + * @package osmosis.lockup + * @see proto service: osmosis.lockup.ModuleLockedAmount + */ +export const getModuleLockedAmount = buildQuery({ + encode: ModuleLockedAmountRequest.encode, + decode: ModuleLockedAmountResponse.decode, + service: "osmosis.lockup.Query", + method: "ModuleLockedAmount" +}); +/** + * Returns unlockable coins which are not withdrawn yet + * @name getAccountUnlockableCoins + * @package osmosis.lockup + * @see proto service: osmosis.lockup.AccountUnlockableCoins + */ +export const getAccountUnlockableCoins = buildQuery({ + encode: AccountUnlockableCoinsRequest.encode, + decode: AccountUnlockableCoinsResponse.decode, + service: "osmosis.lockup.Query", + method: "AccountUnlockableCoins" +}); +/** + * Returns unlocking coins + * @name getAccountUnlockingCoins + * @package osmosis.lockup + * @see proto service: osmosis.lockup.AccountUnlockingCoins + */ +export const getAccountUnlockingCoins = buildQuery({ + encode: AccountUnlockingCoinsRequest.encode, + decode: AccountUnlockingCoinsResponse.decode, + service: "osmosis.lockup.Query", + method: "AccountUnlockingCoins" +}); +/** + * Return a locked coins that can't be withdrawn + * @name getAccountLockedCoins + * @package osmosis.lockup + * @see proto service: osmosis.lockup.AccountLockedCoins + */ +export const getAccountLockedCoins = buildQuery({ + encode: AccountLockedCoinsRequest.encode, + decode: AccountLockedCoinsResponse.decode, + service: "osmosis.lockup.Query", + method: "AccountLockedCoins" +}); +/** + * Returns locked records of an account with unlock time beyond timestamp + * @name getAccountLockedPastTime + * @package osmosis.lockup + * @see proto service: osmosis.lockup.AccountLockedPastTime + */ +export const getAccountLockedPastTime = buildQuery({ + encode: AccountLockedPastTimeRequest.encode, + decode: AccountLockedPastTimeResponse.decode, + service: "osmosis.lockup.Query", + method: "AccountLockedPastTime" +}); +/** + * Returns locked records of an account with unlock time beyond timestamp + * excluding tokens started unlocking + * @name getAccountLockedPastTimeNotUnlockingOnly + * @package osmosis.lockup + * @see proto service: osmosis.lockup.AccountLockedPastTimeNotUnlockingOnly + */ +export const getAccountLockedPastTimeNotUnlockingOnly = buildQuery({ + encode: AccountLockedPastTimeNotUnlockingOnlyRequest.encode, + decode: AccountLockedPastTimeNotUnlockingOnlyResponse.decode, + service: "osmosis.lockup.Query", + method: "AccountLockedPastTimeNotUnlockingOnly" +}); +/** + * Returns unlocked records with unlock time before timestamp + * @name getAccountUnlockedBeforeTime + * @package osmosis.lockup + * @see proto service: osmosis.lockup.AccountUnlockedBeforeTime + */ +export const getAccountUnlockedBeforeTime = buildQuery({ + encode: AccountUnlockedBeforeTimeRequest.encode, + decode: AccountUnlockedBeforeTimeResponse.decode, + service: "osmosis.lockup.Query", + method: "AccountUnlockedBeforeTime" +}); +/** + * Returns lock records by address, timestamp, denom + * @name getAccountLockedPastTimeDenom + * @package osmosis.lockup + * @see proto service: osmosis.lockup.AccountLockedPastTimeDenom + */ +export const getAccountLockedPastTimeDenom = buildQuery({ + encode: AccountLockedPastTimeDenomRequest.encode, + decode: AccountLockedPastTimeDenomResponse.decode, + service: "osmosis.lockup.Query", + method: "AccountLockedPastTimeDenom" +}); +/** + * Returns total locked per denom with longer past given time + * @name getLockedDenom + * @package osmosis.lockup + * @see proto service: osmosis.lockup.LockedDenom + */ +export const getLockedDenom = buildQuery({ + encode: LockedDenomRequest.encode, + decode: LockedDenomResponse.decode, + service: "osmosis.lockup.Query", + method: "LockedDenom" +}); +/** + * Returns lock record by id + * @name getLockedByID + * @package osmosis.lockup + * @see proto service: osmosis.lockup.LockedByID + */ +export const getLockedByID = buildQuery({ + encode: LockedRequest.encode, + decode: LockedResponse.decode, + service: "osmosis.lockup.Query", + method: "LockedByID" +}); +/** + * Returns synthetic lockups by native lockup id + * @name getSyntheticLockupsByLockupID + * @package osmosis.lockup + * @see proto service: osmosis.lockup.SyntheticLockupsByLockupID + */ +export const getSyntheticLockupsByLockupID = buildQuery({ + encode: SyntheticLockupsByLockupIDRequest.encode, + decode: SyntheticLockupsByLockupIDResponse.decode, + service: "osmosis.lockup.Query", + method: "SyntheticLockupsByLockupID" +}); +/** + * Returns account locked records with longer duration + * @name getAccountLockedLongerDuration + * @package osmosis.lockup + * @see proto service: osmosis.lockup.AccountLockedLongerDuration + */ +export const getAccountLockedLongerDuration = buildQuery({ + encode: AccountLockedLongerDurationRequest.encode, + decode: AccountLockedLongerDurationResponse.decode, + service: "osmosis.lockup.Query", + method: "AccountLockedLongerDuration" +}); +/** + * Returns account locked records with a specific duration + * @name getAccountLockedDuration + * @package osmosis.lockup + * @see proto service: osmosis.lockup.AccountLockedDuration + */ +export const getAccountLockedDuration = buildQuery({ + encode: AccountLockedDurationRequest.encode, + decode: AccountLockedDurationResponse.decode, + service: "osmosis.lockup.Query", + method: "AccountLockedDuration" +}); +/** + * Returns account locked records with longer duration excluding tokens + * started unlocking + * @name getAccountLockedLongerDurationNotUnlockingOnly + * @package osmosis.lockup + * @see proto service: osmosis.lockup.AccountLockedLongerDurationNotUnlockingOnly + */ +export const getAccountLockedLongerDurationNotUnlockingOnly = buildQuery({ + encode: AccountLockedLongerDurationNotUnlockingOnlyRequest.encode, + decode: AccountLockedLongerDurationNotUnlockingOnlyResponse.decode, + service: "osmosis.lockup.Query", + method: "AccountLockedLongerDurationNotUnlockingOnly" +}); +/** + * Returns account's locked records for a denom with longer duration + * @name getAccountLockedLongerDurationDenom + * @package osmosis.lockup + * @see proto service: osmosis.lockup.AccountLockedLongerDurationDenom + */ +export const getAccountLockedLongerDurationDenom = buildQuery({ + encode: AccountLockedLongerDurationDenomRequest.encode, + decode: AccountLockedLongerDurationDenomResponse.decode, + service: "osmosis.lockup.Query", + method: "AccountLockedLongerDurationDenom" +}); +/** + * Params returns lockup params. + * @name getParams + * @package osmosis.lockup + * @see proto service: osmosis.lockup.Params + */ +export const getParams = buildQuery({ + encode: QueryParamsRequest.encode, + decode: QueryParamsResponse.decode, + service: "osmosis.lockup.Query", + method: "Params" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputsign/osmosis/lockup/tx.rpc.func.ts b/__fixtures__/v-next/outputsign/osmosis/lockup/tx.rpc.func.ts new file mode 100644 index 0000000000..f9b47db3d7 --- /dev/null +++ b/__fixtures__/v-next/outputsign/osmosis/lockup/tx.rpc.func.ts @@ -0,0 +1,49 @@ +import { Duration, DurationSDKType } from "../../google/protobuf/duration"; +import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; +import { PeriodLock, PeriodLockSDKType } from "./lock"; +import { buildTx } from "../../helper-func-types"; +import { MsgLockTokens, MsgLockTokensSDKType, MsgLockTokensResponse, MsgLockTokensResponseSDKType, MsgBeginUnlockingAll, MsgBeginUnlockingAllSDKType, MsgBeginUnlockingAllResponse, MsgBeginUnlockingAllResponseSDKType, MsgBeginUnlocking, MsgBeginUnlockingSDKType, MsgBeginUnlockingResponse, MsgBeginUnlockingResponseSDKType, MsgExtendLockup, MsgExtendLockupSDKType, MsgExtendLockupResponse, MsgExtendLockupResponseSDKType, MsgForceUnlock, MsgForceUnlockSDKType, MsgForceUnlockResponse, MsgForceUnlockResponseSDKType } from "./tx"; +/** + * LockTokens lock tokens + * @name lockTokens + * @package osmosis.lockup + * @see proto service: osmosis.lockup.LockTokens + */ +export const lockTokens = buildTx({ + msg: MsgLockTokens +}); +/** + * BeginUnlockingAll begin unlocking all tokens + * @name beginUnlockingAll + * @package osmosis.lockup + * @see proto service: osmosis.lockup.BeginUnlockingAll + */ +export const beginUnlockingAll = buildTx({ + msg: MsgBeginUnlockingAll +}); +/** + * MsgBeginUnlocking begins unlocking tokens by lock ID + * @name beginUnlocking + * @package osmosis.lockup + * @see proto service: osmosis.lockup.BeginUnlocking + */ +export const beginUnlocking = buildTx({ + msg: MsgBeginUnlocking +}); +/** + * MsgEditLockup edits the existing lockups by lock ID + * @name extendLockup + * @package osmosis.lockup + * @see proto service: osmosis.lockup.ExtendLockup + */ +export const extendLockup = buildTx({ + msg: MsgExtendLockup +}); +/** + * @name forceUnlock + * @package osmosis.lockup + * @see proto service: osmosis.lockup.ForceUnlock + */ +export const forceUnlock = buildTx({ + msg: MsgForceUnlock +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputsign/osmosis/mint/v1beta1/mint.ts b/__fixtures__/v-next/outputsign/osmosis/mint/v1beta1/mint.ts index c1a5dedd2c..0b9f1614b8 100644 --- a/__fixtures__/v-next/outputsign/osmosis/mint/v1beta1/mint.ts +++ b/__fixtures__/v-next/outputsign/osmosis/mint/v1beta1/mint.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { Decimal } from "@cosmjs/math"; +import { Decimal } from "@interchainjs/math"; import { DeepPartial } from "../../../helpers"; export const protobufPackage = "osmosis.mint.v1beta1"; /** @@ -339,7 +339,7 @@ export const Minter = { }, toAmino(message: Minter): MinterAmino { const obj: any = {}; - obj.epoch_provisions = message.epochProvisions === "" ? undefined : message.epochProvisions; + obj.epoch_provisions = message.epochProvisions === "" ? undefined : Decimal.fromUserInput(message.epochProvisions, 18).atomics; return obj; }, fromAminoMsg(object: MinterAminoMsg): Minter { @@ -428,7 +428,7 @@ export const WeightedAddress = { toAmino(message: WeightedAddress): WeightedAddressAmino { const obj: any = {}; obj.address = message.address === "" ? undefined : message.address; - obj.weight = message.weight === "" ? undefined : message.weight; + obj.weight = message.weight === "" ? undefined : Decimal.fromUserInput(message.weight, 18).atomics; return obj; }, fromAminoMsg(object: WeightedAddressAminoMsg): WeightedAddress { @@ -538,10 +538,10 @@ export const DistributionProportions = { }, toAmino(message: DistributionProportions): DistributionProportionsAmino { const obj: any = {}; - obj.staking = message.staking === "" ? undefined : message.staking; - obj.pool_incentives = message.poolIncentives === "" ? undefined : message.poolIncentives; - obj.developer_rewards = message.developerRewards === "" ? undefined : message.developerRewards; - obj.community_pool = message.communityPool === "" ? undefined : message.communityPool; + obj.staking = message.staking === "" ? undefined : Decimal.fromUserInput(message.staking, 18).atomics; + obj.pool_incentives = message.poolIncentives === "" ? undefined : Decimal.fromUserInput(message.poolIncentives, 18).atomics; + obj.developer_rewards = message.developerRewards === "" ? undefined : Decimal.fromUserInput(message.developerRewards, 18).atomics; + obj.community_pool = message.communityPool === "" ? undefined : Decimal.fromUserInput(message.communityPool, 18).atomics; return obj; }, fromAminoMsg(object: DistributionProportionsAminoMsg): DistributionProportions { @@ -698,10 +698,10 @@ export const Params = { toAmino(message: Params): ParamsAmino { const obj: any = {}; obj.mint_denom = message.mintDenom === "" ? undefined : message.mintDenom; - obj.genesis_epoch_provisions = message.genesisEpochProvisions === "" ? undefined : message.genesisEpochProvisions; + obj.genesis_epoch_provisions = message.genesisEpochProvisions === "" ? undefined : Decimal.fromUserInput(message.genesisEpochProvisions, 18).atomics; obj.epoch_identifier = message.epochIdentifier === "" ? undefined : message.epochIdentifier; obj.reduction_period_in_epochs = message.reductionPeriodInEpochs !== BigInt(0) ? message.reductionPeriodInEpochs?.toString() : undefined; - obj.reduction_factor = message.reductionFactor === "" ? undefined : message.reductionFactor; + obj.reduction_factor = message.reductionFactor === "" ? undefined : Decimal.fromUserInput(message.reductionFactor, 18).atomics; obj.distribution_proportions = message.distributionProportions ? DistributionProportions.toAmino(message.distributionProportions) : undefined; if (message.weightedDeveloperRewardsReceivers) { obj.weighted_developer_rewards_receivers = message.weightedDeveloperRewardsReceivers.map(e => e ? WeightedAddress.toAmino(e) : undefined); diff --git a/__fixtures__/v-next/outputsign/osmosis/mint/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputsign/osmosis/mint/v1beta1/query.rpc.func.ts new file mode 100644 index 0000000000..46ed6c8ec6 --- /dev/null +++ b/__fixtures__/v-next/outputsign/osmosis/mint/v1beta1/query.rpc.func.ts @@ -0,0 +1,27 @@ +import { Params, ParamsSDKType } from "./mint"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, QueryEpochProvisionsRequest, QueryEpochProvisionsRequestSDKType, QueryEpochProvisionsResponse, QueryEpochProvisionsResponseSDKType } from "./query"; +/** + * Params returns the total set of minting parameters. + * @name getParams + * @package osmosis.mint.v1beta1 + * @see proto service: osmosis.mint.v1beta1.Params + */ +export const getParams = buildQuery({ + encode: QueryParamsRequest.encode, + decode: QueryParamsResponse.decode, + service: "osmosis.mint.v1beta1.Query", + method: "Params" +}); +/** + * EpochProvisions returns the current minting epoch provisions value. + * @name getEpochProvisions + * @package osmosis.mint.v1beta1 + * @see proto service: osmosis.mint.v1beta1.EpochProvisions + */ +export const getEpochProvisions = buildQuery({ + encode: QueryEpochProvisionsRequest.encode, + decode: QueryEpochProvisionsResponse.decode, + service: "osmosis.mint.v1beta1.Query", + method: "EpochProvisions" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputsign/osmosis/pool-incentives/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputsign/osmosis/pool-incentives/v1beta1/query.rpc.func.ts new file mode 100644 index 0000000000..468816faa5 --- /dev/null +++ b/__fixtures__/v-next/outputsign/osmosis/pool-incentives/v1beta1/query.rpc.func.ts @@ -0,0 +1,77 @@ +import { Duration, DurationSDKType } from "../../../google/protobuf/duration"; +import { DistrInfo, DistrInfoSDKType, Params, ParamsSDKType } from "./incentives"; +import { Gauge, GaugeSDKType } from "../../incentives/gauge"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { QueryGaugeIdsRequest, QueryGaugeIdsRequestSDKType, QueryGaugeIdsResponse, QueryGaugeIdsResponseSDKType, QueryDistrInfoRequest, QueryDistrInfoRequestSDKType, QueryDistrInfoResponse, QueryDistrInfoResponseSDKType, QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, QueryLockableDurationsRequest, QueryLockableDurationsRequestSDKType, QueryLockableDurationsResponse, QueryLockableDurationsResponseSDKType, QueryIncentivizedPoolsRequest, QueryIncentivizedPoolsRequestSDKType, QueryIncentivizedPoolsResponse, QueryIncentivizedPoolsResponseSDKType, QueryExternalIncentiveGaugesRequest, QueryExternalIncentiveGaugesRequestSDKType, QueryExternalIncentiveGaugesResponse, QueryExternalIncentiveGaugesResponseSDKType } from "./query"; +/** + * GaugeIds takes the pool id and returns the matching gauge ids and durations + * @name getGaugeIds + * @package osmosis.poolincentives.v1beta1 + * @see proto service: osmosis.poolincentives.v1beta1.GaugeIds + */ +export const getGaugeIds = buildQuery({ + encode: QueryGaugeIdsRequest.encode, + decode: QueryGaugeIdsResponse.decode, + service: "osmosis.poolincentives.v1beta1.Query", + method: "GaugeIds" +}); +/** + * DistrInfo returns the pool's matching gauge ids and weights. + * @name getDistrInfo + * @package osmosis.poolincentives.v1beta1 + * @see proto service: osmosis.poolincentives.v1beta1.DistrInfo + */ +export const getDistrInfo = buildQuery({ + encode: QueryDistrInfoRequest.encode, + decode: QueryDistrInfoResponse.decode, + service: "osmosis.poolincentives.v1beta1.Query", + method: "DistrInfo" +}); +/** + * Params returns pool incentives params. + * @name getParams + * @package osmosis.poolincentives.v1beta1 + * @see proto service: osmosis.poolincentives.v1beta1.Params + */ +export const getParams = buildQuery({ + encode: QueryParamsRequest.encode, + decode: QueryParamsResponse.decode, + service: "osmosis.poolincentives.v1beta1.Query", + method: "Params" +}); +/** + * LockableDurations returns lock durations for pools. + * @name getLockableDurations + * @package osmosis.poolincentives.v1beta1 + * @see proto service: osmosis.poolincentives.v1beta1.LockableDurations + */ +export const getLockableDurations = buildQuery({ + encode: QueryLockableDurationsRequest.encode, + decode: QueryLockableDurationsResponse.decode, + service: "osmosis.poolincentives.v1beta1.Query", + method: "LockableDurations" +}); +/** + * IncentivizedPools returns currently incentivized pools + * @name getIncentivizedPools + * @package osmosis.poolincentives.v1beta1 + * @see proto service: osmosis.poolincentives.v1beta1.IncentivizedPools + */ +export const getIncentivizedPools = buildQuery({ + encode: QueryIncentivizedPoolsRequest.encode, + decode: QueryIncentivizedPoolsResponse.decode, + service: "osmosis.poolincentives.v1beta1.Query", + method: "IncentivizedPools" +}); +/** + * ExternalIncentiveGauges returns external incentive gauges. + * @name getExternalIncentiveGauges + * @package osmosis.poolincentives.v1beta1 + * @see proto service: osmosis.poolincentives.v1beta1.ExternalIncentiveGauges + */ +export const getExternalIncentiveGauges = buildQuery({ + encode: QueryExternalIncentiveGaugesRequest.encode, + decode: QueryExternalIncentiveGaugesResponse.decode, + service: "osmosis.poolincentives.v1beta1.Query", + method: "ExternalIncentiveGauges" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputsign/osmosis/superfluid/params.ts b/__fixtures__/v-next/outputsign/osmosis/superfluid/params.ts index 2e6190f838..bb54a3afa1 100644 --- a/__fixtures__/v-next/outputsign/osmosis/superfluid/params.ts +++ b/__fixtures__/v-next/outputsign/osmosis/superfluid/params.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { Decimal } from "@cosmjs/math"; +import { Decimal } from "@interchainjs/math"; import { DeepPartial } from "../../helpers"; export const protobufPackage = "osmosis.superfluid"; /** @@ -99,7 +99,7 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.minimum_risk_factor = message.minimumRiskFactor === "" ? undefined : message.minimumRiskFactor; + obj.minimum_risk_factor = message.minimumRiskFactor === "" ? undefined : Decimal.fromUserInput(message.minimumRiskFactor, 18).atomics; return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputsign/osmosis/superfluid/query.rpc.func.ts b/__fixtures__/v-next/outputsign/osmosis/superfluid/query.rpc.func.ts new file mode 100644 index 0000000000..366d548135 --- /dev/null +++ b/__fixtures__/v-next/outputsign/osmosis/superfluid/query.rpc.func.ts @@ -0,0 +1,194 @@ +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../cosmos/base/query/v1beta1/pagination"; +import { Params, ParamsSDKType } from "./params"; +import { SuperfluidAssetType, SuperfluidAssetTypeSDKType, SuperfluidAsset, SuperfluidAssetSDKType, OsmoEquivalentMultiplierRecord, OsmoEquivalentMultiplierRecordSDKType, SuperfluidDelegationRecord, SuperfluidDelegationRecordSDKType } from "./superfluid"; +import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; +import { SyntheticLock, SyntheticLockSDKType } from "../lockup/lock"; +import { DelegationResponse, DelegationResponseSDKType } from "../../cosmos/staking/v1beta1/staking"; +import { EndpointOrRpc, buildQuery } from "../../helper-func-types"; +import { QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, AssetTypeRequest, AssetTypeRequestSDKType, AssetTypeResponse, AssetTypeResponseSDKType, AllAssetsRequest, AllAssetsRequestSDKType, AllAssetsResponse, AllAssetsResponseSDKType, AssetMultiplierRequest, AssetMultiplierRequestSDKType, AssetMultiplierResponse, AssetMultiplierResponseSDKType, AllIntermediaryAccountsRequest, AllIntermediaryAccountsRequestSDKType, AllIntermediaryAccountsResponse, AllIntermediaryAccountsResponseSDKType, ConnectedIntermediaryAccountRequest, ConnectedIntermediaryAccountRequestSDKType, ConnectedIntermediaryAccountResponse, ConnectedIntermediaryAccountResponseSDKType, QueryTotalDelegationByValidatorForDenomRequest, QueryTotalDelegationByValidatorForDenomRequestSDKType, QueryTotalDelegationByValidatorForDenomResponse, QueryTotalDelegationByValidatorForDenomResponseSDKType, TotalSuperfluidDelegationsRequest, TotalSuperfluidDelegationsRequestSDKType, TotalSuperfluidDelegationsResponse, TotalSuperfluidDelegationsResponseSDKType, SuperfluidDelegationAmountRequest, SuperfluidDelegationAmountRequestSDKType, SuperfluidDelegationAmountResponse, SuperfluidDelegationAmountResponseSDKType, SuperfluidDelegationsByDelegatorRequest, SuperfluidDelegationsByDelegatorRequestSDKType, SuperfluidDelegationsByDelegatorResponse, SuperfluidDelegationsByDelegatorResponseSDKType, SuperfluidUndelegationsByDelegatorRequest, SuperfluidUndelegationsByDelegatorRequestSDKType, SuperfluidUndelegationsByDelegatorResponse, SuperfluidUndelegationsByDelegatorResponseSDKType, SuperfluidDelegationsByValidatorDenomRequest, SuperfluidDelegationsByValidatorDenomRequestSDKType, SuperfluidDelegationsByValidatorDenomResponse, SuperfluidDelegationsByValidatorDenomResponseSDKType, EstimateSuperfluidDelegatedAmountByValidatorDenomRequest, EstimateSuperfluidDelegatedAmountByValidatorDenomRequestSDKType, EstimateSuperfluidDelegatedAmountByValidatorDenomResponse, EstimateSuperfluidDelegatedAmountByValidatorDenomResponseSDKType, QueryTotalDelegationByDelegatorRequest, QueryTotalDelegationByDelegatorRequestSDKType, QueryTotalDelegationByDelegatorResponse, QueryTotalDelegationByDelegatorResponseSDKType, QueryUnpoolWhitelistRequest, QueryUnpoolWhitelistRequestSDKType, QueryUnpoolWhitelistResponse, QueryUnpoolWhitelistResponseSDKType } from "./query"; +/** + * Params returns the total set of superfluid parameters. + * @name getParams + * @package osmosis.superfluid + * @see proto service: osmosis.superfluid.Params + */ +export const getParams = buildQuery({ + encode: QueryParamsRequest.encode, + decode: QueryParamsResponse.decode, + service: "osmosis.superfluid.Query", + method: "Params" +}); +/** + * Returns superfluid asset type, whether if it's a native asset or an lp + * share. + * @name getAssetType + * @package osmosis.superfluid + * @see proto service: osmosis.superfluid.AssetType + */ +export const getAssetType = buildQuery({ + encode: AssetTypeRequest.encode, + decode: AssetTypeResponse.decode, + service: "osmosis.superfluid.Query", + method: "AssetType" +}); +/** + * Returns all registered superfluid assets. + * @name getAllAssets + * @package osmosis.superfluid + * @see proto service: osmosis.superfluid.AllAssets + */ +export const getAllAssets = buildQuery({ + encode: AllAssetsRequest.encode, + decode: AllAssetsResponse.decode, + service: "osmosis.superfluid.Query", + method: "AllAssets" +}); +/** + * Returns the osmo equivalent multiplier used in the most recent epoch. + * @name getAssetMultiplier + * @package osmosis.superfluid + * @see proto service: osmosis.superfluid.AssetMultiplier + */ +export const getAssetMultiplier = buildQuery({ + encode: AssetMultiplierRequest.encode, + decode: AssetMultiplierResponse.decode, + service: "osmosis.superfluid.Query", + method: "AssetMultiplier" +}); +/** + * Returns all superfluid intermediary accounts. + * @name getAllIntermediaryAccounts + * @package osmosis.superfluid + * @see proto service: osmosis.superfluid.AllIntermediaryAccounts + */ +export const getAllIntermediaryAccounts = buildQuery({ + encode: AllIntermediaryAccountsRequest.encode, + decode: AllIntermediaryAccountsResponse.decode, + service: "osmosis.superfluid.Query", + method: "AllIntermediaryAccounts" +}); +/** + * Returns intermediary account connected to a superfluid staked lock by id + * @name getConnectedIntermediaryAccount + * @package osmosis.superfluid + * @see proto service: osmosis.superfluid.ConnectedIntermediaryAccount + */ +export const getConnectedIntermediaryAccount = buildQuery({ + encode: ConnectedIntermediaryAccountRequest.encode, + decode: ConnectedIntermediaryAccountResponse.decode, + service: "osmosis.superfluid.Query", + method: "ConnectedIntermediaryAccount" +}); +/** + * Returns the amount of delegations of specific denom for all validators + * @name getTotalDelegationByValidatorForDenom + * @package osmosis.superfluid + * @see proto service: osmosis.superfluid.TotalDelegationByValidatorForDenom + */ +export const getTotalDelegationByValidatorForDenom = buildQuery({ + encode: QueryTotalDelegationByValidatorForDenomRequest.encode, + decode: QueryTotalDelegationByValidatorForDenomResponse.decode, + service: "osmosis.superfluid.Query", + method: "TotalDelegationByValidatorForDenom" +}); +/** + * Returns the total amount of osmo superfluidly staked. + * Response is denominated in uosmo. + * @name getTotalSuperfluidDelegations + * @package osmosis.superfluid + * @see proto service: osmosis.superfluid.TotalSuperfluidDelegations + */ +export const getTotalSuperfluidDelegations = buildQuery({ + encode: TotalSuperfluidDelegationsRequest.encode, + decode: TotalSuperfluidDelegationsResponse.decode, + service: "osmosis.superfluid.Query", + method: "TotalSuperfluidDelegations" +}); +/** + * Returns the coins superfluid delegated for the delegator, validator, denom + * triplet + * @name getSuperfluidDelegationAmount + * @package osmosis.superfluid + * @see proto service: osmosis.superfluid.SuperfluidDelegationAmount + */ +export const getSuperfluidDelegationAmount = buildQuery({ + encode: SuperfluidDelegationAmountRequest.encode, + decode: SuperfluidDelegationAmountResponse.decode, + service: "osmosis.superfluid.Query", + method: "SuperfluidDelegationAmount" +}); +/** + * Returns all the delegated superfluid poistions for a specific delegator. + * @name getSuperfluidDelegationsByDelegator + * @package osmosis.superfluid + * @see proto service: osmosis.superfluid.SuperfluidDelegationsByDelegator + */ +export const getSuperfluidDelegationsByDelegator = buildQuery({ + encode: SuperfluidDelegationsByDelegatorRequest.encode, + decode: SuperfluidDelegationsByDelegatorResponse.decode, + service: "osmosis.superfluid.Query", + method: "SuperfluidDelegationsByDelegator" +}); +/** + * Returns all the undelegating superfluid poistions for a specific delegator. + * @name getSuperfluidUndelegationsByDelegator + * @package osmosis.superfluid + * @see proto service: osmosis.superfluid.SuperfluidUndelegationsByDelegator + */ +export const getSuperfluidUndelegationsByDelegator = buildQuery({ + encode: SuperfluidUndelegationsByDelegatorRequest.encode, + decode: SuperfluidUndelegationsByDelegatorResponse.decode, + service: "osmosis.superfluid.Query", + method: "SuperfluidUndelegationsByDelegator" +}); +/** + * Returns all the superfluid positions of a specific denom delegated to one + * validator + * @name getSuperfluidDelegationsByValidatorDenom + * @package osmosis.superfluid + * @see proto service: osmosis.superfluid.SuperfluidDelegationsByValidatorDenom + */ +export const getSuperfluidDelegationsByValidatorDenom = buildQuery({ + encode: SuperfluidDelegationsByValidatorDenomRequest.encode, + decode: SuperfluidDelegationsByValidatorDenomResponse.decode, + service: "osmosis.superfluid.Query", + method: "SuperfluidDelegationsByValidatorDenom" +}); +/** + * Returns the amount of a specific denom delegated to a specific validator + * This is labeled an estimate, because the way it calculates the amount can + * lead rounding errors from the true delegated amount + * @name getEstimateSuperfluidDelegatedAmountByValidatorDenom + * @package osmosis.superfluid + * @see proto service: osmosis.superfluid.EstimateSuperfluidDelegatedAmountByValidatorDenom + */ +export const getEstimateSuperfluidDelegatedAmountByValidatorDenom = buildQuery({ + encode: EstimateSuperfluidDelegatedAmountByValidatorDenomRequest.encode, + decode: EstimateSuperfluidDelegatedAmountByValidatorDenomResponse.decode, + service: "osmosis.superfluid.Query", + method: "EstimateSuperfluidDelegatedAmountByValidatorDenom" +}); +/** + * Returns the specified delegations for a specific delegator + * @name getTotalDelegationByDelegator + * @package osmosis.superfluid + * @see proto service: osmosis.superfluid.TotalDelegationByDelegator + */ +export const getTotalDelegationByDelegator = buildQuery({ + encode: QueryTotalDelegationByDelegatorRequest.encode, + decode: QueryTotalDelegationByDelegatorResponse.decode, + service: "osmosis.superfluid.Query", + method: "TotalDelegationByDelegator" +}); +/** + * Returns a list of whitelisted pool ids to unpool. + * @name getUnpoolWhitelist + * @package osmosis.superfluid + * @see proto service: osmosis.superfluid.UnpoolWhitelist + */ +export const getUnpoolWhitelist = buildQuery({ + encode: QueryUnpoolWhitelistRequest.encode, + decode: QueryUnpoolWhitelistResponse.decode, + service: "osmosis.superfluid.Query", + method: "UnpoolWhitelist" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputsign/osmosis/superfluid/superfluid.ts b/__fixtures__/v-next/outputsign/osmosis/superfluid/superfluid.ts index d48b1ab1b0..1c98845ff6 100644 --- a/__fixtures__/v-next/outputsign/osmosis/superfluid/superfluid.ts +++ b/__fixtures__/v-next/outputsign/osmosis/superfluid/superfluid.ts @@ -1,7 +1,7 @@ import { Coin, CoinAmino, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../binary"; import { DeepPartial } from "../../helpers"; -import { Decimal } from "@cosmjs/math"; +import { Decimal } from "@interchainjs/math"; export const protobufPackage = "osmosis.superfluid"; /** * SuperfluidAssetType indicates whether the superfluid asset is @@ -604,7 +604,7 @@ export const OsmoEquivalentMultiplierRecord = { const obj: any = {}; obj.epoch_number = message.epochNumber !== BigInt(0) ? message.epochNumber?.toString() : undefined; obj.denom = message.denom === "" ? undefined : message.denom; - obj.multiplier = message.multiplier === "" ? undefined : message.multiplier; + obj.multiplier = message.multiplier === "" ? undefined : Decimal.fromUserInput(message.multiplier, 18).atomics; return obj; }, fromAminoMsg(object: OsmoEquivalentMultiplierRecordAminoMsg): OsmoEquivalentMultiplierRecord { diff --git a/__fixtures__/v-next/outputsign/osmosis/superfluid/tx.rpc.func.ts b/__fixtures__/v-next/outputsign/osmosis/superfluid/tx.rpc.func.ts new file mode 100644 index 0000000000..85a48aab1b --- /dev/null +++ b/__fixtures__/v-next/outputsign/osmosis/superfluid/tx.rpc.func.ts @@ -0,0 +1,48 @@ +import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; +import { buildTx } from "../../helper-func-types"; +import { MsgSuperfluidDelegate, MsgSuperfluidDelegateSDKType, MsgSuperfluidDelegateResponse, MsgSuperfluidDelegateResponseSDKType, MsgSuperfluidUndelegate, MsgSuperfluidUndelegateSDKType, MsgSuperfluidUndelegateResponse, MsgSuperfluidUndelegateResponseSDKType, MsgSuperfluidUnbondLock, MsgSuperfluidUnbondLockSDKType, MsgSuperfluidUnbondLockResponse, MsgSuperfluidUnbondLockResponseSDKType, MsgLockAndSuperfluidDelegate, MsgLockAndSuperfluidDelegateSDKType, MsgLockAndSuperfluidDelegateResponse, MsgLockAndSuperfluidDelegateResponseSDKType, MsgUnPoolWhitelistedPool, MsgUnPoolWhitelistedPoolSDKType, MsgUnPoolWhitelistedPoolResponse, MsgUnPoolWhitelistedPoolResponseSDKType } from "./tx"; +/** + * Execute superfluid delegation for a lockup + * @name superfluidDelegate + * @package osmosis.superfluid + * @see proto service: osmosis.superfluid.SuperfluidDelegate + */ +export const superfluidDelegate = buildTx({ + msg: MsgSuperfluidDelegate +}); +/** + * Execute superfluid undelegation for a lockup + * @name superfluidUndelegate + * @package osmosis.superfluid + * @see proto service: osmosis.superfluid.SuperfluidUndelegate + */ +export const superfluidUndelegate = buildTx({ + msg: MsgSuperfluidUndelegate +}); +/** + * For a given lock that is being superfluidly undelegated, + * also unbond the underlying lock. + * @name superfluidUnbondLock + * @package osmosis.superfluid + * @see proto service: osmosis.superfluid.SuperfluidUnbondLock + */ +export const superfluidUnbondLock = buildTx({ + msg: MsgSuperfluidUnbondLock +}); +/** + * Execute lockup lock and superfluid delegation in a single msg + * @name lockAndSuperfluidDelegate + * @package osmosis.superfluid + * @see proto service: osmosis.superfluid.LockAndSuperfluidDelegate + */ +export const lockAndSuperfluidDelegate = buildTx({ + msg: MsgLockAndSuperfluidDelegate +}); +/** + * @name unPoolWhitelistedPool + * @package osmosis.superfluid + * @see proto service: osmosis.superfluid.UnPoolWhitelistedPool + */ +export const unPoolWhitelistedPool = buildTx({ + msg: MsgUnPoolWhitelistedPool +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputsign/osmosis/tokenfactory/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputsign/osmosis/tokenfactory/v1beta1/query.rpc.func.ts new file mode 100644 index 0000000000..d816826644 --- /dev/null +++ b/__fixtures__/v-next/outputsign/osmosis/tokenfactory/v1beta1/query.rpc.func.ts @@ -0,0 +1,43 @@ +import { Params, ParamsSDKType } from "./params"; +import { DenomAuthorityMetadata, DenomAuthorityMetadataSDKType } from "./authorityMetadata"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, QueryDenomAuthorityMetadataRequest, QueryDenomAuthorityMetadataRequestSDKType, QueryDenomAuthorityMetadataResponse, QueryDenomAuthorityMetadataResponseSDKType, QueryDenomsFromCreatorRequest, QueryDenomsFromCreatorRequestSDKType, QueryDenomsFromCreatorResponse, QueryDenomsFromCreatorResponseSDKType } from "./query"; +/** + * Params defines a gRPC query method that returns the tokenfactory module's + * parameters. + * @name getParams + * @package osmosis.tokenfactory.v1beta1 + * @see proto service: osmosis.tokenfactory.v1beta1.Params + */ +export const getParams = buildQuery({ + encode: QueryParamsRequest.encode, + decode: QueryParamsResponse.decode, + service: "osmosis.tokenfactory.v1beta1.Query", + method: "Params" +}); +/** + * DenomAuthorityMetadata defines a gRPC query method for fetching + * DenomAuthorityMetadata for a particular denom. + * @name getDenomAuthorityMetadata + * @package osmosis.tokenfactory.v1beta1 + * @see proto service: osmosis.tokenfactory.v1beta1.DenomAuthorityMetadata + */ +export const getDenomAuthorityMetadata = buildQuery({ + encode: QueryDenomAuthorityMetadataRequest.encode, + decode: QueryDenomAuthorityMetadataResponse.decode, + service: "osmosis.tokenfactory.v1beta1.Query", + method: "DenomAuthorityMetadata" +}); +/** + * DenomsFromCreator defines a gRPC query method for fetching all + * denominations created by a specific admin/creator. + * @name getDenomsFromCreator + * @package osmosis.tokenfactory.v1beta1 + * @see proto service: osmosis.tokenfactory.v1beta1.DenomsFromCreator + */ +export const getDenomsFromCreator = buildQuery({ + encode: QueryDenomsFromCreatorRequest.encode, + decode: QueryDenomsFromCreatorResponse.decode, + service: "osmosis.tokenfactory.v1beta1.Query", + method: "DenomsFromCreator" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputsign/osmosis/tokenfactory/v1beta1/tx.rpc.func.ts b/__fixtures__/v-next/outputsign/osmosis/tokenfactory/v1beta1/tx.rpc.func.ts new file mode 100644 index 0000000000..4f68bf3691 --- /dev/null +++ b/__fixtures__/v-next/outputsign/osmosis/tokenfactory/v1beta1/tx.rpc.func.ts @@ -0,0 +1,44 @@ +import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; +import { Metadata, MetadataSDKType } from "../../../cosmos/bank/v1beta1/bank"; +import { buildTx } from "../../../helper-func-types"; +import { MsgCreateDenom, MsgCreateDenomSDKType, MsgCreateDenomResponse, MsgCreateDenomResponseSDKType, MsgMint, MsgMintSDKType, MsgMintResponse, MsgMintResponseSDKType, MsgBurn, MsgBurnSDKType, MsgBurnResponse, MsgBurnResponseSDKType, MsgChangeAdmin, MsgChangeAdminSDKType, MsgChangeAdminResponse, MsgChangeAdminResponseSDKType, MsgSetDenomMetadata, MsgSetDenomMetadataSDKType, MsgSetDenomMetadataResponse, MsgSetDenomMetadataResponseSDKType } from "./tx"; +/** + * @name createDenom + * @package osmosis.tokenfactory.v1beta1 + * @see proto service: osmosis.tokenfactory.v1beta1.CreateDenom + */ +export const createDenom = buildTx({ + msg: MsgCreateDenom +}); +/** + * @name mint + * @package osmosis.tokenfactory.v1beta1 + * @see proto service: osmosis.tokenfactory.v1beta1.Mint + */ +export const mint = buildTx({ + msg: MsgMint +}); +/** + * @name burn + * @package osmosis.tokenfactory.v1beta1 + * @see proto service: osmosis.tokenfactory.v1beta1.Burn + */ +export const burn = buildTx({ + msg: MsgBurn +}); +/** + * @name changeAdmin + * @package osmosis.tokenfactory.v1beta1 + * @see proto service: osmosis.tokenfactory.v1beta1.ChangeAdmin + */ +export const changeAdmin = buildTx({ + msg: MsgChangeAdmin +}); +/** + * @name setDenomMetadata + * @package osmosis.tokenfactory.v1beta1 + * @see proto service: osmosis.tokenfactory.v1beta1.SetDenomMetadata + */ +export const setDenomMetadata = buildTx({ + msg: MsgSetDenomMetadata +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputsign/osmosis/twap/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputsign/osmosis/twap/v1beta1/query.rpc.func.ts new file mode 100644 index 0000000000..e076baed66 --- /dev/null +++ b/__fixtures__/v-next/outputsign/osmosis/twap/v1beta1/query.rpc.func.ts @@ -0,0 +1,38 @@ +import { Timestamp, TimestampSDKType } from "../../../google/protobuf/timestamp"; +import { Params, ParamsSDKType } from "./genesis"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { ParamsRequest, ParamsRequestSDKType, ParamsResponse, ParamsResponseSDKType, ArithmeticTwapRequest, ArithmeticTwapRequestSDKType, ArithmeticTwapResponse, ArithmeticTwapResponseSDKType, ArithmeticTwapToNowRequest, ArithmeticTwapToNowRequestSDKType, ArithmeticTwapToNowResponse, ArithmeticTwapToNowResponseSDKType } from "./query"; +/** + * @name getParams + * @package osmosis.twap.v1beta1 + * @see proto service: osmosis.twap.v1beta1.Params + */ +export const getParams = buildQuery({ + encode: ParamsRequest.encode, + decode: ParamsResponse.decode, + service: "osmosis.twap.v1beta1.Query", + method: "Params" +}); +/** + * @name getArithmeticTwap + * @package osmosis.twap.v1beta1 + * @see proto service: osmosis.twap.v1beta1.ArithmeticTwap + */ +export const getArithmeticTwap = buildQuery({ + encode: ArithmeticTwapRequest.encode, + decode: ArithmeticTwapResponse.decode, + service: "osmosis.twap.v1beta1.Query", + method: "ArithmeticTwap" +}); +/** + * @name getArithmeticTwapToNow + * @package osmosis.twap.v1beta1 + * @see proto service: osmosis.twap.v1beta1.ArithmeticTwapToNow + * @deprecated + */ +export const getArithmeticTwapToNow = buildQuery({ + encode: ArithmeticTwapToNowRequest.encode, + decode: ArithmeticTwapToNowResponse.decode, + service: "osmosis.twap.v1beta1.Query", + method: "ArithmeticTwapToNow" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputsign/osmosis/twap/v1beta1/query.ts b/__fixtures__/v-next/outputsign/osmosis/twap/v1beta1/query.ts index 5e9c13b90a..0dcbf5a0bf 100644 --- a/__fixtures__/v-next/outputsign/osmosis/twap/v1beta1/query.ts +++ b/__fixtures__/v-next/outputsign/osmosis/twap/v1beta1/query.ts @@ -2,7 +2,7 @@ import { Timestamp, TimestampAmino, TimestampSDKType } from "../../../google/pro import { Params, ParamsAmino, ParamsSDKType } from "./genesis"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { toTimestamp, fromTimestamp, DeepPartial } from "../../../helpers"; -import { Decimal } from "@cosmjs/math"; +import { Decimal } from "@interchainjs/math"; export const protobufPackage = "osmosis.twap.v1beta1"; /** * @name ArithmeticTwapRequest @@ -384,7 +384,7 @@ export const ArithmeticTwapResponse = { }, toAmino(message: ArithmeticTwapResponse): ArithmeticTwapResponseAmino { const obj: any = {}; - obj.arithmetic_twap = message.arithmeticTwap === "" ? undefined : message.arithmeticTwap; + obj.arithmetic_twap = message.arithmeticTwap === "" ? undefined : Decimal.fromUserInput(message.arithmeticTwap, 18).atomics; return obj; }, fromAminoMsg(object: ArithmeticTwapResponseAminoMsg): ArithmeticTwapResponse { @@ -570,7 +570,7 @@ export const ArithmeticTwapToNowResponse = { }, toAmino(message: ArithmeticTwapToNowResponse): ArithmeticTwapToNowResponseAmino { const obj: any = {}; - obj.arithmetic_twap = message.arithmeticTwap === "" ? undefined : message.arithmeticTwap; + obj.arithmetic_twap = message.arithmeticTwap === "" ? undefined : Decimal.fromUserInput(message.arithmeticTwap, 18).atomics; return obj; }, fromAminoMsg(object: ArithmeticTwapToNowResponseAminoMsg): ArithmeticTwapToNowResponse { diff --git a/__fixtures__/v-next/outputsign/osmosis/twap/v1beta1/twap_record.ts b/__fixtures__/v-next/outputsign/osmosis/twap/v1beta1/twap_record.ts index a7eb4e84c6..ec9ff79a2e 100644 --- a/__fixtures__/v-next/outputsign/osmosis/twap/v1beta1/twap_record.ts +++ b/__fixtures__/v-next/outputsign/osmosis/twap/v1beta1/twap_record.ts @@ -1,7 +1,7 @@ import { Timestamp, TimestampAmino, TimestampSDKType } from "../../../google/protobuf/timestamp"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { toTimestamp, fromTimestamp, DeepPartial } from "../../../helpers"; -import { Decimal } from "@cosmjs/math"; +import { Decimal } from "@interchainjs/math"; export const protobufPackage = "osmosis.twap.v1beta1"; /** * A TWAP record should be indexed in state by pool_id, (asset pair), timestamp @@ -291,10 +291,10 @@ export const TwapRecord = { obj.asset1_denom = message.asset1Denom === "" ? undefined : message.asset1Denom; obj.height = message.height ? message.height?.toString() : "0"; obj.time = message.time ? Timestamp.toAmino(toTimestamp(message.time)) : undefined; - obj.p0_last_spot_price = message.p0LastSpotPrice === "" ? undefined : message.p0LastSpotPrice; - obj.p1_last_spot_price = message.p1LastSpotPrice === "" ? undefined : message.p1LastSpotPrice; - obj.p0_arithmetic_twap_accumulator = message.p0ArithmeticTwapAccumulator === "" ? undefined : message.p0ArithmeticTwapAccumulator; - obj.p1_arithmetic_twap_accumulator = message.p1ArithmeticTwapAccumulator === "" ? undefined : message.p1ArithmeticTwapAccumulator; + obj.p0_last_spot_price = message.p0LastSpotPrice === "" ? undefined : Decimal.fromUserInput(message.p0LastSpotPrice, 18).atomics; + obj.p1_last_spot_price = message.p1LastSpotPrice === "" ? undefined : Decimal.fromUserInput(message.p1LastSpotPrice, 18).atomics; + obj.p0_arithmetic_twap_accumulator = message.p0ArithmeticTwapAccumulator === "" ? undefined : Decimal.fromUserInput(message.p0ArithmeticTwapAccumulator, 18).atomics; + obj.p1_arithmetic_twap_accumulator = message.p1ArithmeticTwapAccumulator === "" ? undefined : Decimal.fromUserInput(message.p1ArithmeticTwapAccumulator, 18).atomics; obj.last_error_time = message.lastErrorTime ? Timestamp.toAmino(toTimestamp(message.lastErrorTime)) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputsign/osmosis/txfees/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputsign/osmosis/txfees/v1beta1/query.rpc.func.ts new file mode 100644 index 0000000000..a461827fa5 --- /dev/null +++ b/__fixtures__/v-next/outputsign/osmosis/txfees/v1beta1/query.rpc.func.ts @@ -0,0 +1,53 @@ +import { FeeToken, FeeTokenSDKType } from "./feetoken"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { QueryFeeTokensRequest, QueryFeeTokensRequestSDKType, QueryFeeTokensResponse, QueryFeeTokensResponseSDKType, QueryDenomSpotPriceRequest, QueryDenomSpotPriceRequestSDKType, QueryDenomSpotPriceResponse, QueryDenomSpotPriceResponseSDKType, QueryDenomPoolIdRequest, QueryDenomPoolIdRequestSDKType, QueryDenomPoolIdResponse, QueryDenomPoolIdResponseSDKType, QueryBaseDenomRequest, QueryBaseDenomRequestSDKType, QueryBaseDenomResponse, QueryBaseDenomResponseSDKType } from "./query"; +/** + * FeeTokens returns a list of all the whitelisted fee tokens and their + * corresponding pools. It does not include the BaseDenom, which has its own + * query endpoint + * @name getFeeTokens + * @package osmosis.txfees.v1beta1 + * @see proto service: osmosis.txfees.v1beta1.FeeTokens + */ +export const getFeeTokens = buildQuery({ + encode: QueryFeeTokensRequest.encode, + decode: QueryFeeTokensResponse.decode, + service: "osmosis.txfees.v1beta1.Query", + method: "FeeTokens" +}); +/** + * DenomSpotPrice returns all spot prices by each registered token denom. + * @name getDenomSpotPrice + * @package osmosis.txfees.v1beta1 + * @see proto service: osmosis.txfees.v1beta1.DenomSpotPrice + */ +export const getDenomSpotPrice = buildQuery({ + encode: QueryDenomSpotPriceRequest.encode, + decode: QueryDenomSpotPriceResponse.decode, + service: "osmosis.txfees.v1beta1.Query", + method: "DenomSpotPrice" +}); +/** + * Returns the poolID for a specified denom input. + * @name getDenomPoolId + * @package osmosis.txfees.v1beta1 + * @see proto service: osmosis.txfees.v1beta1.DenomPoolId + */ +export const getDenomPoolId = buildQuery({ + encode: QueryDenomPoolIdRequest.encode, + decode: QueryDenomPoolIdResponse.decode, + service: "osmosis.txfees.v1beta1.Query", + method: "DenomPoolId" +}); +/** + * Returns a list of all base denom tokens and their corresponding pools. + * @name getBaseDenom + * @package osmosis.txfees.v1beta1 + * @see proto service: osmosis.txfees.v1beta1.BaseDenom + */ +export const getBaseDenom = buildQuery({ + encode: QueryBaseDenomRequest.encode, + decode: QueryBaseDenomResponse.decode, + service: "osmosis.txfees.v1beta1.Query", + method: "BaseDenom" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputsign/osmosis/txfees/v1beta1/query.ts b/__fixtures__/v-next/outputsign/osmosis/txfees/v1beta1/query.ts index 887043cd64..62f7c46d3c 100644 --- a/__fixtures__/v-next/outputsign/osmosis/txfees/v1beta1/query.ts +++ b/__fixtures__/v-next/outputsign/osmosis/txfees/v1beta1/query.ts @@ -1,7 +1,7 @@ import { FeeToken, FeeTokenAmino, FeeTokenSDKType } from "./feetoken"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { DeepPartial } from "../../../helpers"; -import { Decimal } from "@cosmjs/math"; +import { Decimal } from "@interchainjs/math"; export const protobufPackage = "osmosis.txfees.v1beta1"; /** * @name QueryFeeTokensRequest @@ -540,7 +540,7 @@ export const QueryDenomSpotPriceResponse = { toAmino(message: QueryDenomSpotPriceResponse): QueryDenomSpotPriceResponseAmino { const obj: any = {}; obj.poolID = message.poolID !== BigInt(0) ? message.poolID?.toString() : undefined; - obj.spot_price = message.spotPrice === "" ? undefined : message.spotPrice; + obj.spot_price = message.spotPrice === "" ? undefined : Decimal.fromUserInput(message.spotPrice, 18).atomics; return obj; }, fromAminoMsg(object: QueryDenomSpotPriceResponseAminoMsg): QueryDenomSpotPriceResponse { diff --git a/__fixtures__/v-next/outputsign/tendermint/abci/types.rpc.func.ts b/__fixtures__/v-next/outputsign/tendermint/abci/types.rpc.func.ts new file mode 100644 index 0000000000..dee086cb02 --- /dev/null +++ b/__fixtures__/v-next/outputsign/tendermint/abci/types.rpc.func.ts @@ -0,0 +1,172 @@ +import { Timestamp, TimestampSDKType } from "../../google/protobuf/timestamp"; +import { Header, HeaderSDKType } from "../types/types"; +import { ProofOps, ProofOpsSDKType } from "../crypto/proof"; +import { EvidenceParams, EvidenceParamsSDKType, ValidatorParams, ValidatorParamsSDKType, VersionParams, VersionParamsSDKType } from "../types/params"; +import { PublicKey, PublicKeySDKType } from "../crypto/keys"; +import { EndpointOrRpc, buildQuery } from "../../helper-func-types"; +import { RequestEcho, RequestEchoSDKType, ResponseEcho, ResponseEchoSDKType, RequestFlush, RequestFlushSDKType, ResponseFlush, ResponseFlushSDKType, RequestInfo, RequestInfoSDKType, ResponseInfo, ResponseInfoSDKType, RequestSetOption, RequestSetOptionSDKType, ResponseSetOption, ResponseSetOptionSDKType, RequestDeliverTx, RequestDeliverTxSDKType, ResponseDeliverTx, ResponseDeliverTxSDKType, RequestCheckTx, RequestCheckTxSDKType, ResponseCheckTx, ResponseCheckTxSDKType, RequestQuery, RequestQuerySDKType, ResponseQuery, ResponseQuerySDKType, RequestCommit, RequestCommitSDKType, ResponseCommit, ResponseCommitSDKType, RequestInitChain, RequestInitChainSDKType, ResponseInitChain, ResponseInitChainSDKType, RequestBeginBlock, RequestBeginBlockSDKType, ResponseBeginBlock, ResponseBeginBlockSDKType, RequestEndBlock, RequestEndBlockSDKType, ResponseEndBlock, ResponseEndBlockSDKType, RequestListSnapshots, RequestListSnapshotsSDKType, ResponseListSnapshots, ResponseListSnapshotsSDKType, RequestOfferSnapshot, RequestOfferSnapshotSDKType, ResponseOfferSnapshot, ResponseOfferSnapshotSDKType, RequestLoadSnapshotChunk, RequestLoadSnapshotChunkSDKType, ResponseLoadSnapshotChunk, ResponseLoadSnapshotChunkSDKType, RequestApplySnapshotChunk, RequestApplySnapshotChunkSDKType, ResponseApplySnapshotChunk, ResponseApplySnapshotChunkSDKType } from "./types"; +/** + * @name getEcho + * @package tendermint.abci + * @see proto service: tendermint.abci.Echo + */ +export const getEcho = buildQuery({ + encode: RequestEcho.encode, + decode: ResponseEcho.decode, + service: "tendermint.abci.ABCIApplication", + method: "Echo" +}); +/** + * @name getFlush + * @package tendermint.abci + * @see proto service: tendermint.abci.Flush + */ +export const getFlush = buildQuery({ + encode: RequestFlush.encode, + decode: ResponseFlush.decode, + service: "tendermint.abci.ABCIApplication", + method: "Flush" +}); +/** + * @name getInfo + * @package tendermint.abci + * @see proto service: tendermint.abci.Info + */ +export const getInfo = buildQuery({ + encode: RequestInfo.encode, + decode: ResponseInfo.decode, + service: "tendermint.abci.ABCIApplication", + method: "Info" +}); +/** + * @name getSetOption + * @package tendermint.abci + * @see proto service: tendermint.abci.SetOption + */ +export const getSetOption = buildQuery({ + encode: RequestSetOption.encode, + decode: ResponseSetOption.decode, + service: "tendermint.abci.ABCIApplication", + method: "SetOption" +}); +/** + * @name getDeliverTx + * @package tendermint.abci + * @see proto service: tendermint.abci.DeliverTx + */ +export const getDeliverTx = buildQuery({ + encode: RequestDeliverTx.encode, + decode: ResponseDeliverTx.decode, + service: "tendermint.abci.ABCIApplication", + method: "DeliverTx" +}); +/** + * @name getCheckTx + * @package tendermint.abci + * @see proto service: tendermint.abci.CheckTx + */ +export const getCheckTx = buildQuery({ + encode: RequestCheckTx.encode, + decode: ResponseCheckTx.decode, + service: "tendermint.abci.ABCIApplication", + method: "CheckTx" +}); +/** + * @name getQuery + * @package tendermint.abci + * @see proto service: tendermint.abci.Query + */ +export const getQuery = buildQuery({ + encode: RequestQuery.encode, + decode: ResponseQuery.decode, + service: "tendermint.abci.ABCIApplication", + method: "Query" +}); +/** + * @name getCommit + * @package tendermint.abci + * @see proto service: tendermint.abci.Commit + */ +export const getCommit = buildQuery({ + encode: RequestCommit.encode, + decode: ResponseCommit.decode, + service: "tendermint.abci.ABCIApplication", + method: "Commit" +}); +/** + * @name getInitChain + * @package tendermint.abci + * @see proto service: tendermint.abci.InitChain + */ +export const getInitChain = buildQuery({ + encode: RequestInitChain.encode, + decode: ResponseInitChain.decode, + service: "tendermint.abci.ABCIApplication", + method: "InitChain" +}); +/** + * @name getBeginBlock + * @package tendermint.abci + * @see proto service: tendermint.abci.BeginBlock + */ +export const getBeginBlock = buildQuery({ + encode: RequestBeginBlock.encode, + decode: ResponseBeginBlock.decode, + service: "tendermint.abci.ABCIApplication", + method: "BeginBlock" +}); +/** + * @name getEndBlock + * @package tendermint.abci + * @see proto service: tendermint.abci.EndBlock + */ +export const getEndBlock = buildQuery({ + encode: RequestEndBlock.encode, + decode: ResponseEndBlock.decode, + service: "tendermint.abci.ABCIApplication", + method: "EndBlock" +}); +/** + * @name getListSnapshots + * @package tendermint.abci + * @see proto service: tendermint.abci.ListSnapshots + */ +export const getListSnapshots = buildQuery({ + encode: RequestListSnapshots.encode, + decode: ResponseListSnapshots.decode, + service: "tendermint.abci.ABCIApplication", + method: "ListSnapshots" +}); +/** + * @name getOfferSnapshot + * @package tendermint.abci + * @see proto service: tendermint.abci.OfferSnapshot + */ +export const getOfferSnapshot = buildQuery({ + encode: RequestOfferSnapshot.encode, + decode: ResponseOfferSnapshot.decode, + service: "tendermint.abci.ABCIApplication", + method: "OfferSnapshot" +}); +/** + * @name getLoadSnapshotChunk + * @package tendermint.abci + * @see proto service: tendermint.abci.LoadSnapshotChunk + */ +export const getLoadSnapshotChunk = buildQuery({ + encode: RequestLoadSnapshotChunk.encode, + decode: ResponseLoadSnapshotChunk.decode, + service: "tendermint.abci.ABCIApplication", + method: "LoadSnapshotChunk" +}); +/** + * @name getApplySnapshotChunk + * @package tendermint.abci + * @see proto service: tendermint.abci.ApplySnapshotChunk + */ +export const getApplySnapshotChunk = buildQuery({ + encode: RequestApplySnapshotChunk.encode, + decode: ResponseApplySnapshotChunk.decode, + service: "tendermint.abci.ABCIApplication", + method: "ApplySnapshotChunk" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputsign/tendermint/bundle.ts b/__fixtures__/v-next/outputsign/tendermint/bundle.ts index 65380eb031..bbc829adb0 100644 --- a/__fixtures__/v-next/outputsign/tendermint/bundle.ts +++ b/__fixtures__/v-next/outputsign/tendermint/bundle.ts @@ -9,13 +9,15 @@ import * as _312 from "./types/params"; import * as _313 from "./types/types"; import * as _314 from "./types/validator"; import * as _315 from "./version/types"; -import * as _535 from "./abci/types.rpc.ABCIApplication"; -import * as _560 from "./lcd"; -import * as _561 from "./rpc.query"; +import * as _627 from "./abci/types.rpc.func"; +import * as _628 from "./abci/types.rpc.ABCIApplication"; +import * as _653 from "./lcd"; +import * as _654 from "./rpc.query"; export namespace tendermint { export const abci = { ..._305, - ..._535 + ..._627, + ..._628 }; export const crypto = { ..._306, @@ -40,7 +42,7 @@ export namespace tendermint { ..._315 }; export const ClientFactory = { - ..._560, - ..._561 + ..._653, + ..._654 }; } \ No newline at end of file diff --git a/__fixtures__/v-next/outputsign/types.ts b/__fixtures__/v-next/outputsign/types.ts index b2016c1a9d..1acee677e2 100644 --- a/__fixtures__/v-next/outputsign/types.ts +++ b/__fixtures__/v-next/outputsign/types.ts @@ -6,8 +6,14 @@ import { IBinaryReader, IBinaryWriter } from "./binary"; import { Any } from "./google/protobuf/any"; -import { OfflineSigner } from "@cosmjs/proto-signing"; -import { HttpEndpoint } from "@cosmjs/tendermint-rpc"; + +import { HttpEndpoint } from "@interchainjs/types"; + + +import { DeliverTxResponse, Event, Attribute } from "@interchainjs/types"; + +export { DeliverTxResponse } + export type ProtoMsg = Omit & { typeUrl: any }; @@ -87,56 +93,6 @@ export interface StdFee { } -export interface MsgData { - msgType: string; - data: Uint8Array; -} -export interface Attribute { - key: string; - value: string; - index?: boolean; -} -export interface Event { - type: string; - attributes: readonly Attribute[]; -} - -/** - * The response after successfully broadcasting a transaction. - * Success or failure refer to the execution result. - */ -export interface DeliverTxResponse { - height: number; - /** The position of the transaction within the block. This is a 0-based index. */ - txIndex: number; - /** Error code. The transaction suceeded if and only if code is 0. */ - code: number; - transactionHash: string; - events: readonly Event[]; - /** - * A string-based log document. - * - * This currently seems to merge attributes of multiple events into one event per type - * (https://github.com/tendermint/tendermint/issues/9595). You might want to use the `events` - * field instead. - */ - rawLog?: string; - /** @deprecated Use `msgResponses` instead. */ - data?: readonly MsgData[]; - /** - * The message responses of the [TxMsgData](https://github.com/cosmos/cosmos-sdk/blob/v0.46.3/proto/cosmos/base/abci/v1beta1/abci.proto#L128-L140) - * as `Any`s. - * This field is an empty list for chains running Cosmos SDK < 0.46. - */ - msgResponses: Array<{ - typeUrl: string; - value: Uint8Array; - }>; - gasUsed: bigint; - gasWanted: bigint; - origin?: any; -} - export interface TxRpc { request( service: string, @@ -151,8 +107,3 @@ export interface TxRpc { ): Promise; } -export interface SigningClientParams { - rpcEndpoint: string | HttpEndpoint; - signer: OfflineSigner; -} - diff --git a/__fixtures__/v-next/outputv2/akash/audit/v1beta1/audit.registry.ts b/__fixtures__/v-next/outputv2/akash/audit/v1beta1/audit.registry.ts index 80ad40181e..535264e21d 100644 --- a/__fixtures__/v-next/outputv2/akash/audit/v1beta1/audit.registry.ts +++ b/__fixtures__/v-next/outputv2/akash/audit/v1beta1/audit.registry.ts @@ -1,11 +1,6 @@ -import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { TelescopeGeneratedType } from "../../../types"; import { MsgSignProviderAttributes, MsgDeleteProviderAttributes } from "./audit"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/akash.audit.v1beta1.MsgSignProviderAttributes", MsgSignProviderAttributes], ["/akash.audit.v1beta1.MsgDeleteProviderAttributes", MsgDeleteProviderAttributes]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/akash.audit.v1beta1.MsgSignProviderAttributes", MsgSignProviderAttributes], ["/akash.audit.v1beta1.MsgDeleteProviderAttributes", MsgDeleteProviderAttributes]]; export const MessageComposer = { encoded: { signProviderAttributes(value: MsgSignProviderAttributes) { diff --git a/__fixtures__/v-next/outputv2/akash/audit/v1beta1/audit.rpc.func.ts b/__fixtures__/v-next/outputv2/akash/audit/v1beta1/audit.rpc.func.ts new file mode 100644 index 0000000000..b0f277265d --- /dev/null +++ b/__fixtures__/v-next/outputv2/akash/audit/v1beta1/audit.rpc.func.ts @@ -0,0 +1,20 @@ +import { buildTx } from "../../../helper-func-types"; +import { MsgSignProviderAttributes, MsgDeleteProviderAttributes } from "./audit"; +/** + * SignProviderAttributes defines a method that signs provider attributes + * @name signProviderAttributes + * @package akash.audit.v1beta1 + * @see proto service: akash.audit.v1beta1.SignProviderAttributes + */ +export const signProviderAttributes = buildTx({ + msg: MsgSignProviderAttributes +}); +/** + * DeleteProviderAttributes defines a method that deletes provider attributes + * @name deleteProviderAttributes + * @package akash.audit.v1beta1 + * @see proto service: akash.audit.v1beta1.DeleteProviderAttributes + */ +export const deleteProviderAttributes = buildTx({ + msg: MsgDeleteProviderAttributes +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/akash/audit/v1beta1/audit.ts b/__fixtures__/v-next/outputv2/akash/audit/v1beta1/audit.ts index b0c09a693c..9edf55342b 100644 --- a/__fixtures__/v-next/outputv2/akash/audit/v1beta1/audit.ts +++ b/__fixtures__/v-next/outputv2/akash/audit/v1beta1/audit.ts @@ -2,6 +2,7 @@ import { Attribute, AttributeAmino, AttributeSDKType } from "../../base/v1beta1/ import { BinaryReader, BinaryWriter } from "../../../binary"; import { isSet, DeepPartial } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "akash.audit.v1beta1"; /** * Provider stores owner auditor and attributes details @@ -313,6 +314,15 @@ function createBaseProvider(): Provider { */ export const Provider = { typeUrl: "/akash.audit.v1beta1.Provider", + is(o: any): o is Provider { + return o && (o.$typeUrl === Provider.typeUrl || typeof o.owner === "string" && typeof o.auditor === "string" && Array.isArray(o.attributes) && (!o.attributes.length || Attribute.is(o.attributes[0]))); + }, + isSDK(o: any): o is ProviderSDKType { + return o && (o.$typeUrl === Provider.typeUrl || typeof o.owner === "string" && typeof o.auditor === "string" && Array.isArray(o.attributes) && (!o.attributes.length || Attribute.isSDK(o.attributes[0]))); + }, + isAmino(o: any): o is ProviderAmino { + return o && (o.$typeUrl === Provider.typeUrl || typeof o.owner === "string" && typeof o.auditor === "string" && Array.isArray(o.attributes) && (!o.attributes.length || Attribute.isAmino(o.attributes[0]))); + }, encode(message: Provider, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.owner !== "") { writer.uint32(10).string(message.owner); @@ -427,6 +437,12 @@ export const Provider = { typeUrl: "/akash.audit.v1beta1.Provider", value: Provider.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Provider.typeUrl)) { + return; + } + Attribute.registerTypeUrl(); } }; function createBaseAuditedAttributes(): AuditedAttributes { @@ -444,6 +460,15 @@ function createBaseAuditedAttributes(): AuditedAttributes { */ export const AuditedAttributes = { typeUrl: "/akash.audit.v1beta1.AuditedAttributes", + is(o: any): o is AuditedAttributes { + return o && (o.$typeUrl === AuditedAttributes.typeUrl || typeof o.owner === "string" && typeof o.auditor === "string" && Array.isArray(o.attributes) && (!o.attributes.length || Attribute.is(o.attributes[0]))); + }, + isSDK(o: any): o is AuditedAttributesSDKType { + return o && (o.$typeUrl === AuditedAttributes.typeUrl || typeof o.owner === "string" && typeof o.auditor === "string" && Array.isArray(o.attributes) && (!o.attributes.length || Attribute.isSDK(o.attributes[0]))); + }, + isAmino(o: any): o is AuditedAttributesAmino { + return o && (o.$typeUrl === AuditedAttributes.typeUrl || typeof o.owner === "string" && typeof o.auditor === "string" && Array.isArray(o.attributes) && (!o.attributes.length || Attribute.isAmino(o.attributes[0]))); + }, encode(message: AuditedAttributes, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.owner !== "") { writer.uint32(10).string(message.owner); @@ -558,6 +583,12 @@ export const AuditedAttributes = { typeUrl: "/akash.audit.v1beta1.AuditedAttributes", value: AuditedAttributes.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(AuditedAttributes.typeUrl)) { + return; + } + Attribute.registerTypeUrl(); } }; function createBaseAttributesResponse(): AttributesResponse { @@ -573,6 +604,15 @@ function createBaseAttributesResponse(): AttributesResponse { */ export const AttributesResponse = { typeUrl: "/akash.audit.v1beta1.AttributesResponse", + is(o: any): o is AttributesResponse { + return o && (o.$typeUrl === AttributesResponse.typeUrl || Array.isArray(o.attributes) && (!o.attributes.length || AuditedAttributes.is(o.attributes[0]))); + }, + isSDK(o: any): o is AttributesResponseSDKType { + return o && (o.$typeUrl === AttributesResponse.typeUrl || Array.isArray(o.attributes) && (!o.attributes.length || AuditedAttributes.isSDK(o.attributes[0]))); + }, + isAmino(o: any): o is AttributesResponseAmino { + return o && (o.$typeUrl === AttributesResponse.typeUrl || Array.isArray(o.attributes) && (!o.attributes.length || AuditedAttributes.isAmino(o.attributes[0]))); + }, encode(message: AttributesResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.attributes) { AuditedAttributes.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -657,6 +697,12 @@ export const AttributesResponse = { typeUrl: "/akash.audit.v1beta1.AttributesResponse", value: AttributesResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(AttributesResponse.typeUrl)) { + return; + } + AuditedAttributes.registerTypeUrl(); } }; function createBaseAttributesFilters(): AttributesFilters { @@ -673,6 +719,15 @@ function createBaseAttributesFilters(): AttributesFilters { */ export const AttributesFilters = { typeUrl: "/akash.audit.v1beta1.AttributesFilters", + is(o: any): o is AttributesFilters { + return o && (o.$typeUrl === AttributesFilters.typeUrl || Array.isArray(o.auditors) && (!o.auditors.length || typeof o.auditors[0] === "string") && Array.isArray(o.owners) && (!o.owners.length || typeof o.owners[0] === "string")); + }, + isSDK(o: any): o is AttributesFiltersSDKType { + return o && (o.$typeUrl === AttributesFilters.typeUrl || Array.isArray(o.auditors) && (!o.auditors.length || typeof o.auditors[0] === "string") && Array.isArray(o.owners) && (!o.owners.length || typeof o.owners[0] === "string")); + }, + isAmino(o: any): o is AttributesFiltersAmino { + return o && (o.$typeUrl === AttributesFilters.typeUrl || Array.isArray(o.auditors) && (!o.auditors.length || typeof o.auditors[0] === "string") && Array.isArray(o.owners) && (!o.owners.length || typeof o.owners[0] === "string")); + }, encode(message: AttributesFilters, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.auditors) { writer.uint32(10).string(v!); @@ -782,7 +837,8 @@ export const AttributesFilters = { typeUrl: "/akash.audit.v1beta1.AttributesFilters", value: AttributesFilters.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgSignProviderAttributes(): MsgSignProviderAttributes { return { @@ -799,6 +855,15 @@ function createBaseMsgSignProviderAttributes(): MsgSignProviderAttributes { */ export const MsgSignProviderAttributes = { typeUrl: "/akash.audit.v1beta1.MsgSignProviderAttributes", + is(o: any): o is MsgSignProviderAttributes { + return o && (o.$typeUrl === MsgSignProviderAttributes.typeUrl || typeof o.owner === "string" && typeof o.auditor === "string" && Array.isArray(o.attributes) && (!o.attributes.length || Attribute.is(o.attributes[0]))); + }, + isSDK(o: any): o is MsgSignProviderAttributesSDKType { + return o && (o.$typeUrl === MsgSignProviderAttributes.typeUrl || typeof o.owner === "string" && typeof o.auditor === "string" && Array.isArray(o.attributes) && (!o.attributes.length || Attribute.isSDK(o.attributes[0]))); + }, + isAmino(o: any): o is MsgSignProviderAttributesAmino { + return o && (o.$typeUrl === MsgSignProviderAttributes.typeUrl || typeof o.owner === "string" && typeof o.auditor === "string" && Array.isArray(o.attributes) && (!o.attributes.length || Attribute.isAmino(o.attributes[0]))); + }, encode(message: MsgSignProviderAttributes, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.owner !== "") { writer.uint32(10).string(message.owner); @@ -913,6 +978,12 @@ export const MsgSignProviderAttributes = { typeUrl: "/akash.audit.v1beta1.MsgSignProviderAttributes", value: MsgSignProviderAttributes.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgSignProviderAttributes.typeUrl)) { + return; + } + Attribute.registerTypeUrl(); } }; function createBaseMsgSignProviderAttributesResponse(): MsgSignProviderAttributesResponse { @@ -926,6 +997,15 @@ function createBaseMsgSignProviderAttributesResponse(): MsgSignProviderAttribute */ export const MsgSignProviderAttributesResponse = { typeUrl: "/akash.audit.v1beta1.MsgSignProviderAttributesResponse", + is(o: any): o is MsgSignProviderAttributesResponse { + return o && o.$typeUrl === MsgSignProviderAttributesResponse.typeUrl; + }, + isSDK(o: any): o is MsgSignProviderAttributesResponseSDKType { + return o && o.$typeUrl === MsgSignProviderAttributesResponse.typeUrl; + }, + isAmino(o: any): o is MsgSignProviderAttributesResponseAmino { + return o && o.$typeUrl === MsgSignProviderAttributesResponse.typeUrl; + }, encode(_: MsgSignProviderAttributesResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -984,7 +1064,8 @@ export const MsgSignProviderAttributesResponse = { typeUrl: "/akash.audit.v1beta1.MsgSignProviderAttributesResponse", value: MsgSignProviderAttributesResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgDeleteProviderAttributes(): MsgDeleteProviderAttributes { return { @@ -1001,6 +1082,15 @@ function createBaseMsgDeleteProviderAttributes(): MsgDeleteProviderAttributes { */ export const MsgDeleteProviderAttributes = { typeUrl: "/akash.audit.v1beta1.MsgDeleteProviderAttributes", + is(o: any): o is MsgDeleteProviderAttributes { + return o && (o.$typeUrl === MsgDeleteProviderAttributes.typeUrl || typeof o.owner === "string" && typeof o.auditor === "string" && Array.isArray(o.keys) && (!o.keys.length || typeof o.keys[0] === "string")); + }, + isSDK(o: any): o is MsgDeleteProviderAttributesSDKType { + return o && (o.$typeUrl === MsgDeleteProviderAttributes.typeUrl || typeof o.owner === "string" && typeof o.auditor === "string" && Array.isArray(o.keys) && (!o.keys.length || typeof o.keys[0] === "string")); + }, + isAmino(o: any): o is MsgDeleteProviderAttributesAmino { + return o && (o.$typeUrl === MsgDeleteProviderAttributes.typeUrl || typeof o.owner === "string" && typeof o.auditor === "string" && Array.isArray(o.keys) && (!o.keys.length || typeof o.keys[0] === "string")); + }, encode(message: MsgDeleteProviderAttributes, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.owner !== "") { writer.uint32(10).string(message.owner); @@ -1115,7 +1205,8 @@ export const MsgDeleteProviderAttributes = { typeUrl: "/akash.audit.v1beta1.MsgDeleteProviderAttributes", value: MsgDeleteProviderAttributes.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgDeleteProviderAttributesResponse(): MsgDeleteProviderAttributesResponse { return {}; @@ -1128,6 +1219,15 @@ function createBaseMsgDeleteProviderAttributesResponse(): MsgDeleteProviderAttri */ export const MsgDeleteProviderAttributesResponse = { typeUrl: "/akash.audit.v1beta1.MsgDeleteProviderAttributesResponse", + is(o: any): o is MsgDeleteProviderAttributesResponse { + return o && o.$typeUrl === MsgDeleteProviderAttributesResponse.typeUrl; + }, + isSDK(o: any): o is MsgDeleteProviderAttributesResponseSDKType { + return o && o.$typeUrl === MsgDeleteProviderAttributesResponse.typeUrl; + }, + isAmino(o: any): o is MsgDeleteProviderAttributesResponseAmino { + return o && o.$typeUrl === MsgDeleteProviderAttributesResponse.typeUrl; + }, encode(_: MsgDeleteProviderAttributesResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -1186,5 +1286,6 @@ export const MsgDeleteProviderAttributesResponse = { typeUrl: "/akash.audit.v1beta1.MsgDeleteProviderAttributesResponse", value: MsgDeleteProviderAttributesResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/akash/audit/v1beta2/audit.registry.ts b/__fixtures__/v-next/outputv2/akash/audit/v1beta2/audit.registry.ts index c54f023f53..2b0c88ea4d 100644 --- a/__fixtures__/v-next/outputv2/akash/audit/v1beta2/audit.registry.ts +++ b/__fixtures__/v-next/outputv2/akash/audit/v1beta2/audit.registry.ts @@ -1,11 +1,6 @@ -import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { TelescopeGeneratedType } from "../../../types"; import { MsgSignProviderAttributes, MsgDeleteProviderAttributes } from "./audit"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/akash.audit.v1beta2.MsgSignProviderAttributes", MsgSignProviderAttributes], ["/akash.audit.v1beta2.MsgDeleteProviderAttributes", MsgDeleteProviderAttributes]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/akash.audit.v1beta2.MsgSignProviderAttributes", MsgSignProviderAttributes], ["/akash.audit.v1beta2.MsgDeleteProviderAttributes", MsgDeleteProviderAttributes]]; export const MessageComposer = { encoded: { signProviderAttributes(value: MsgSignProviderAttributes) { diff --git a/__fixtures__/v-next/outputv2/akash/audit/v1beta2/audit.rpc.func.ts b/__fixtures__/v-next/outputv2/akash/audit/v1beta2/audit.rpc.func.ts new file mode 100644 index 0000000000..4f22b55138 --- /dev/null +++ b/__fixtures__/v-next/outputv2/akash/audit/v1beta2/audit.rpc.func.ts @@ -0,0 +1,20 @@ +import { buildTx } from "../../../helper-func-types"; +import { MsgSignProviderAttributes, MsgDeleteProviderAttributes } from "./audit"; +/** + * SignProviderAttributes defines a method that signs provider attributes + * @name signProviderAttributes + * @package akash.audit.v1beta2 + * @see proto service: akash.audit.v1beta2.SignProviderAttributes + */ +export const signProviderAttributes = buildTx({ + msg: MsgSignProviderAttributes +}); +/** + * DeleteProviderAttributes defines a method that deletes provider attributes + * @name deleteProviderAttributes + * @package akash.audit.v1beta2 + * @see proto service: akash.audit.v1beta2.DeleteProviderAttributes + */ +export const deleteProviderAttributes = buildTx({ + msg: MsgDeleteProviderAttributes +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/akash/audit/v1beta2/audit.ts b/__fixtures__/v-next/outputv2/akash/audit/v1beta2/audit.ts index d1027f1df7..20e08348ad 100644 --- a/__fixtures__/v-next/outputv2/akash/audit/v1beta2/audit.ts +++ b/__fixtures__/v-next/outputv2/akash/audit/v1beta2/audit.ts @@ -2,6 +2,7 @@ import { Attribute, AttributeAmino, AttributeSDKType } from "../../base/v1beta2/ import { BinaryReader, BinaryWriter } from "../../../binary"; import { isSet, DeepPartial } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "akash.audit.v1beta2"; /** * Provider stores owner auditor and attributes details @@ -313,6 +314,15 @@ function createBaseProvider(): Provider { */ export const Provider = { typeUrl: "/akash.audit.v1beta2.Provider", + is(o: any): o is Provider { + return o && (o.$typeUrl === Provider.typeUrl || typeof o.owner === "string" && typeof o.auditor === "string" && Array.isArray(o.attributes) && (!o.attributes.length || Attribute.is(o.attributes[0]))); + }, + isSDK(o: any): o is ProviderSDKType { + return o && (o.$typeUrl === Provider.typeUrl || typeof o.owner === "string" && typeof o.auditor === "string" && Array.isArray(o.attributes) && (!o.attributes.length || Attribute.isSDK(o.attributes[0]))); + }, + isAmino(o: any): o is ProviderAmino { + return o && (o.$typeUrl === Provider.typeUrl || typeof o.owner === "string" && typeof o.auditor === "string" && Array.isArray(o.attributes) && (!o.attributes.length || Attribute.isAmino(o.attributes[0]))); + }, encode(message: Provider, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.owner !== "") { writer.uint32(10).string(message.owner); @@ -427,6 +437,12 @@ export const Provider = { typeUrl: "/akash.audit.v1beta2.Provider", value: Provider.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Provider.typeUrl)) { + return; + } + Attribute.registerTypeUrl(); } }; function createBaseAuditedAttributes(): AuditedAttributes { @@ -444,6 +460,15 @@ function createBaseAuditedAttributes(): AuditedAttributes { */ export const AuditedAttributes = { typeUrl: "/akash.audit.v1beta2.AuditedAttributes", + is(o: any): o is AuditedAttributes { + return o && (o.$typeUrl === AuditedAttributes.typeUrl || typeof o.owner === "string" && typeof o.auditor === "string" && Array.isArray(o.attributes) && (!o.attributes.length || Attribute.is(o.attributes[0]))); + }, + isSDK(o: any): o is AuditedAttributesSDKType { + return o && (o.$typeUrl === AuditedAttributes.typeUrl || typeof o.owner === "string" && typeof o.auditor === "string" && Array.isArray(o.attributes) && (!o.attributes.length || Attribute.isSDK(o.attributes[0]))); + }, + isAmino(o: any): o is AuditedAttributesAmino { + return o && (o.$typeUrl === AuditedAttributes.typeUrl || typeof o.owner === "string" && typeof o.auditor === "string" && Array.isArray(o.attributes) && (!o.attributes.length || Attribute.isAmino(o.attributes[0]))); + }, encode(message: AuditedAttributes, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.owner !== "") { writer.uint32(10).string(message.owner); @@ -558,6 +583,12 @@ export const AuditedAttributes = { typeUrl: "/akash.audit.v1beta2.AuditedAttributes", value: AuditedAttributes.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(AuditedAttributes.typeUrl)) { + return; + } + Attribute.registerTypeUrl(); } }; function createBaseAttributesResponse(): AttributesResponse { @@ -573,6 +604,15 @@ function createBaseAttributesResponse(): AttributesResponse { */ export const AttributesResponse = { typeUrl: "/akash.audit.v1beta2.AttributesResponse", + is(o: any): o is AttributesResponse { + return o && (o.$typeUrl === AttributesResponse.typeUrl || Array.isArray(o.attributes) && (!o.attributes.length || AuditedAttributes.is(o.attributes[0]))); + }, + isSDK(o: any): o is AttributesResponseSDKType { + return o && (o.$typeUrl === AttributesResponse.typeUrl || Array.isArray(o.attributes) && (!o.attributes.length || AuditedAttributes.isSDK(o.attributes[0]))); + }, + isAmino(o: any): o is AttributesResponseAmino { + return o && (o.$typeUrl === AttributesResponse.typeUrl || Array.isArray(o.attributes) && (!o.attributes.length || AuditedAttributes.isAmino(o.attributes[0]))); + }, encode(message: AttributesResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.attributes) { AuditedAttributes.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -657,6 +697,12 @@ export const AttributesResponse = { typeUrl: "/akash.audit.v1beta2.AttributesResponse", value: AttributesResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(AttributesResponse.typeUrl)) { + return; + } + AuditedAttributes.registerTypeUrl(); } }; function createBaseAttributesFilters(): AttributesFilters { @@ -673,6 +719,15 @@ function createBaseAttributesFilters(): AttributesFilters { */ export const AttributesFilters = { typeUrl: "/akash.audit.v1beta2.AttributesFilters", + is(o: any): o is AttributesFilters { + return o && (o.$typeUrl === AttributesFilters.typeUrl || Array.isArray(o.auditors) && (!o.auditors.length || typeof o.auditors[0] === "string") && Array.isArray(o.owners) && (!o.owners.length || typeof o.owners[0] === "string")); + }, + isSDK(o: any): o is AttributesFiltersSDKType { + return o && (o.$typeUrl === AttributesFilters.typeUrl || Array.isArray(o.auditors) && (!o.auditors.length || typeof o.auditors[0] === "string") && Array.isArray(o.owners) && (!o.owners.length || typeof o.owners[0] === "string")); + }, + isAmino(o: any): o is AttributesFiltersAmino { + return o && (o.$typeUrl === AttributesFilters.typeUrl || Array.isArray(o.auditors) && (!o.auditors.length || typeof o.auditors[0] === "string") && Array.isArray(o.owners) && (!o.owners.length || typeof o.owners[0] === "string")); + }, encode(message: AttributesFilters, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.auditors) { writer.uint32(10).string(v!); @@ -782,7 +837,8 @@ export const AttributesFilters = { typeUrl: "/akash.audit.v1beta2.AttributesFilters", value: AttributesFilters.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgSignProviderAttributes(): MsgSignProviderAttributes { return { @@ -799,6 +855,15 @@ function createBaseMsgSignProviderAttributes(): MsgSignProviderAttributes { */ export const MsgSignProviderAttributes = { typeUrl: "/akash.audit.v1beta2.MsgSignProviderAttributes", + is(o: any): o is MsgSignProviderAttributes { + return o && (o.$typeUrl === MsgSignProviderAttributes.typeUrl || typeof o.owner === "string" && typeof o.auditor === "string" && Array.isArray(o.attributes) && (!o.attributes.length || Attribute.is(o.attributes[0]))); + }, + isSDK(o: any): o is MsgSignProviderAttributesSDKType { + return o && (o.$typeUrl === MsgSignProviderAttributes.typeUrl || typeof o.owner === "string" && typeof o.auditor === "string" && Array.isArray(o.attributes) && (!o.attributes.length || Attribute.isSDK(o.attributes[0]))); + }, + isAmino(o: any): o is MsgSignProviderAttributesAmino { + return o && (o.$typeUrl === MsgSignProviderAttributes.typeUrl || typeof o.owner === "string" && typeof o.auditor === "string" && Array.isArray(o.attributes) && (!o.attributes.length || Attribute.isAmino(o.attributes[0]))); + }, encode(message: MsgSignProviderAttributes, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.owner !== "") { writer.uint32(10).string(message.owner); @@ -913,6 +978,12 @@ export const MsgSignProviderAttributes = { typeUrl: "/akash.audit.v1beta2.MsgSignProviderAttributes", value: MsgSignProviderAttributes.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgSignProviderAttributes.typeUrl)) { + return; + } + Attribute.registerTypeUrl(); } }; function createBaseMsgSignProviderAttributesResponse(): MsgSignProviderAttributesResponse { @@ -926,6 +997,15 @@ function createBaseMsgSignProviderAttributesResponse(): MsgSignProviderAttribute */ export const MsgSignProviderAttributesResponse = { typeUrl: "/akash.audit.v1beta2.MsgSignProviderAttributesResponse", + is(o: any): o is MsgSignProviderAttributesResponse { + return o && o.$typeUrl === MsgSignProviderAttributesResponse.typeUrl; + }, + isSDK(o: any): o is MsgSignProviderAttributesResponseSDKType { + return o && o.$typeUrl === MsgSignProviderAttributesResponse.typeUrl; + }, + isAmino(o: any): o is MsgSignProviderAttributesResponseAmino { + return o && o.$typeUrl === MsgSignProviderAttributesResponse.typeUrl; + }, encode(_: MsgSignProviderAttributesResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -984,7 +1064,8 @@ export const MsgSignProviderAttributesResponse = { typeUrl: "/akash.audit.v1beta2.MsgSignProviderAttributesResponse", value: MsgSignProviderAttributesResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgDeleteProviderAttributes(): MsgDeleteProviderAttributes { return { @@ -1001,6 +1082,15 @@ function createBaseMsgDeleteProviderAttributes(): MsgDeleteProviderAttributes { */ export const MsgDeleteProviderAttributes = { typeUrl: "/akash.audit.v1beta2.MsgDeleteProviderAttributes", + is(o: any): o is MsgDeleteProviderAttributes { + return o && (o.$typeUrl === MsgDeleteProviderAttributes.typeUrl || typeof o.owner === "string" && typeof o.auditor === "string" && Array.isArray(o.keys) && (!o.keys.length || typeof o.keys[0] === "string")); + }, + isSDK(o: any): o is MsgDeleteProviderAttributesSDKType { + return o && (o.$typeUrl === MsgDeleteProviderAttributes.typeUrl || typeof o.owner === "string" && typeof o.auditor === "string" && Array.isArray(o.keys) && (!o.keys.length || typeof o.keys[0] === "string")); + }, + isAmino(o: any): o is MsgDeleteProviderAttributesAmino { + return o && (o.$typeUrl === MsgDeleteProviderAttributes.typeUrl || typeof o.owner === "string" && typeof o.auditor === "string" && Array.isArray(o.keys) && (!o.keys.length || typeof o.keys[0] === "string")); + }, encode(message: MsgDeleteProviderAttributes, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.owner !== "") { writer.uint32(10).string(message.owner); @@ -1115,7 +1205,8 @@ export const MsgDeleteProviderAttributes = { typeUrl: "/akash.audit.v1beta2.MsgDeleteProviderAttributes", value: MsgDeleteProviderAttributes.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgDeleteProviderAttributesResponse(): MsgDeleteProviderAttributesResponse { return {}; @@ -1128,6 +1219,15 @@ function createBaseMsgDeleteProviderAttributesResponse(): MsgDeleteProviderAttri */ export const MsgDeleteProviderAttributesResponse = { typeUrl: "/akash.audit.v1beta2.MsgDeleteProviderAttributesResponse", + is(o: any): o is MsgDeleteProviderAttributesResponse { + return o && o.$typeUrl === MsgDeleteProviderAttributesResponse.typeUrl; + }, + isSDK(o: any): o is MsgDeleteProviderAttributesResponseSDKType { + return o && o.$typeUrl === MsgDeleteProviderAttributesResponse.typeUrl; + }, + isAmino(o: any): o is MsgDeleteProviderAttributesResponseAmino { + return o && o.$typeUrl === MsgDeleteProviderAttributesResponse.typeUrl; + }, encode(_: MsgDeleteProviderAttributesResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -1186,5 +1286,6 @@ export const MsgDeleteProviderAttributesResponse = { typeUrl: "/akash.audit.v1beta2.MsgDeleteProviderAttributesResponse", value: MsgDeleteProviderAttributesResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/akash/audit/v1beta2/genesis.ts b/__fixtures__/v-next/outputv2/akash/audit/v1beta2/genesis.ts index f5f0dad021..4f55aa3fde 100644 --- a/__fixtures__/v-next/outputv2/akash/audit/v1beta2/genesis.ts +++ b/__fixtures__/v-next/outputv2/akash/audit/v1beta2/genesis.ts @@ -2,6 +2,7 @@ import { AuditedAttributes, AuditedAttributesAmino, AuditedAttributesSDKType } f import { BinaryReader, BinaryWriter } from "../../../binary"; import { JsonSafe } from "../../../json-safe"; import { DeepPartial } from "../../../helpers"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "akash.audit.v1beta2"; /** * GenesisState defines the basic genesis state used by audit module @@ -51,6 +52,15 @@ function createBaseGenesisState(): GenesisState { */ export const GenesisState = { typeUrl: "/akash.audit.v1beta2.GenesisState", + is(o: any): o is GenesisState { + return o && (o.$typeUrl === GenesisState.typeUrl || Array.isArray(o.attributes) && (!o.attributes.length || AuditedAttributes.is(o.attributes[0]))); + }, + isSDK(o: any): o is GenesisStateSDKType { + return o && (o.$typeUrl === GenesisState.typeUrl || Array.isArray(o.attributes) && (!o.attributes.length || AuditedAttributes.isSDK(o.attributes[0]))); + }, + isAmino(o: any): o is GenesisStateAmino { + return o && (o.$typeUrl === GenesisState.typeUrl || Array.isArray(o.attributes) && (!o.attributes.length || AuditedAttributes.isAmino(o.attributes[0]))); + }, encode(message: GenesisState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.attributes) { AuditedAttributes.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -135,5 +145,11 @@ export const GenesisState = { typeUrl: "/akash.audit.v1beta2.GenesisState", value: GenesisState.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GenesisState.typeUrl)) { + return; + } + AuditedAttributes.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/akash/audit/v1beta2/query.rpc.func.ts b/__fixtures__/v-next/outputv2/akash/audit/v1beta2/query.rpc.func.ts new file mode 100644 index 0000000000..22dfc48888 --- /dev/null +++ b/__fixtures__/v-next/outputv2/akash/audit/v1beta2/query.rpc.func.ts @@ -0,0 +1,62 @@ +import { buildQuery } from "../../../helper-func-types"; +import { QueryAllProvidersAttributesRequest, QueryProvidersResponse, QueryProviderAttributesRequest, QueryProviderAuditorRequest, QueryAuditorAttributesRequest } from "./query"; +/** + * AllProvidersAttributes queries all providers + * buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE + * buf:lint:ignore RPC_RESPONSE_STANDARD_NAME + * @name getAllProvidersAttributes + * @package akash.audit.v1beta2 + * @see proto service: akash.audit.v1beta2.AllProvidersAttributes + */ +export const getAllProvidersAttributes = buildQuery({ + encode: QueryAllProvidersAttributesRequest.encode, + decode: QueryProvidersResponse.decode, + service: "akash.audit.v1beta2.Query", + method: "AllProvidersAttributes", + deps: [QueryAllProvidersAttributesRequest, QueryProvidersResponse] +}); +/** + * ProviderAttributes queries all provider signed attributes + * buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE + * buf:lint:ignore RPC_RESPONSE_STANDARD_NAME + * @name getProviderAttributes + * @package akash.audit.v1beta2 + * @see proto service: akash.audit.v1beta2.ProviderAttributes + */ +export const getProviderAttributes = buildQuery({ + encode: QueryProviderAttributesRequest.encode, + decode: QueryProvidersResponse.decode, + service: "akash.audit.v1beta2.Query", + method: "ProviderAttributes", + deps: [QueryProviderAttributesRequest, QueryProvidersResponse] +}); +/** + * ProviderAuditorAttributes queries provider signed attributes by specific auditor + * buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE + * buf:lint:ignore RPC_RESPONSE_STANDARD_NAME + * @name getProviderAuditorAttributes + * @package akash.audit.v1beta2 + * @see proto service: akash.audit.v1beta2.ProviderAuditorAttributes + */ +export const getProviderAuditorAttributes = buildQuery({ + encode: QueryProviderAuditorRequest.encode, + decode: QueryProvidersResponse.decode, + service: "akash.audit.v1beta2.Query", + method: "ProviderAuditorAttributes", + deps: [QueryProviderAuditorRequest, QueryProvidersResponse] +}); +/** + * AuditorAttributes queries all providers signed by this auditor + * buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE + * buf:lint:ignore RPC_RESPONSE_STANDARD_NAME + * @name getAuditorAttributes + * @package akash.audit.v1beta2 + * @see proto service: akash.audit.v1beta2.AuditorAttributes + */ +export const getAuditorAttributes = buildQuery({ + encode: QueryAuditorAttributesRequest.encode, + decode: QueryProvidersResponse.decode, + service: "akash.audit.v1beta2.Query", + method: "AuditorAttributes", + deps: [QueryAuditorAttributesRequest, QueryProvidersResponse] +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/akash/audit/v1beta2/query.ts b/__fixtures__/v-next/outputv2/akash/audit/v1beta2/query.ts index ee17cb2460..3b41bcefaa 100644 --- a/__fixtures__/v-next/outputv2/akash/audit/v1beta2/query.ts +++ b/__fixtures__/v-next/outputv2/akash/audit/v1beta2/query.ts @@ -1,6 +1,7 @@ import { PageRequest, PageRequestAmino, PageRequestSDKType, PageResponse, PageResponseAmino, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination"; import { Provider, ProviderAmino, ProviderSDKType } from "./audit"; import { BinaryReader, BinaryWriter } from "../../../binary"; +import { GlobalDecoderRegistry } from "../../../registry"; import { isSet, DeepPartial } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "akash.audit.v1beta2"; @@ -243,6 +244,15 @@ function createBaseQueryProvidersResponse(): QueryProvidersResponse { */ export const QueryProvidersResponse = { typeUrl: "/akash.audit.v1beta2.QueryProvidersResponse", + is(o: any): o is QueryProvidersResponse { + return o && (o.$typeUrl === QueryProvidersResponse.typeUrl || Array.isArray(o.providers) && (!o.providers.length || Provider.is(o.providers[0]))); + }, + isSDK(o: any): o is QueryProvidersResponseSDKType { + return o && (o.$typeUrl === QueryProvidersResponse.typeUrl || Array.isArray(o.providers) && (!o.providers.length || Provider.isSDK(o.providers[0]))); + }, + isAmino(o: any): o is QueryProvidersResponseAmino { + return o && (o.$typeUrl === QueryProvidersResponse.typeUrl || Array.isArray(o.providers) && (!o.providers.length || Provider.isAmino(o.providers[0]))); + }, encode(message: QueryProvidersResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.providers) { Provider.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -344,6 +354,13 @@ export const QueryProvidersResponse = { typeUrl: "/akash.audit.v1beta2.QueryProvidersResponse", value: QueryProvidersResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryProvidersResponse.typeUrl)) { + return; + } + Provider.registerTypeUrl(); + PageResponse.registerTypeUrl(); } }; function createBaseQueryProviderRequest(): QueryProviderRequest { @@ -360,6 +377,15 @@ function createBaseQueryProviderRequest(): QueryProviderRequest { */ export const QueryProviderRequest = { typeUrl: "/akash.audit.v1beta2.QueryProviderRequest", + is(o: any): o is QueryProviderRequest { + return o && (o.$typeUrl === QueryProviderRequest.typeUrl || typeof o.auditor === "string" && typeof o.owner === "string"); + }, + isSDK(o: any): o is QueryProviderRequestSDKType { + return o && (o.$typeUrl === QueryProviderRequest.typeUrl || typeof o.auditor === "string" && typeof o.owner === "string"); + }, + isAmino(o: any): o is QueryProviderRequestAmino { + return o && (o.$typeUrl === QueryProviderRequest.typeUrl || typeof o.auditor === "string" && typeof o.owner === "string"); + }, encode(message: QueryProviderRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.auditor !== "") { writer.uint32(10).string(message.auditor); @@ -449,7 +475,8 @@ export const QueryProviderRequest = { typeUrl: "/akash.audit.v1beta2.QueryProviderRequest", value: QueryProviderRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryAllProvidersAttributesRequest(): QueryAllProvidersAttributesRequest { return { @@ -464,6 +491,15 @@ function createBaseQueryAllProvidersAttributesRequest(): QueryAllProvidersAttrib */ export const QueryAllProvidersAttributesRequest = { typeUrl: "/akash.audit.v1beta2.QueryAllProvidersAttributesRequest", + is(o: any): o is QueryAllProvidersAttributesRequest { + return o && o.$typeUrl === QueryAllProvidersAttributesRequest.typeUrl; + }, + isSDK(o: any): o is QueryAllProvidersAttributesRequestSDKType { + return o && o.$typeUrl === QueryAllProvidersAttributesRequest.typeUrl; + }, + isAmino(o: any): o is QueryAllProvidersAttributesRequestAmino { + return o && o.$typeUrl === QueryAllProvidersAttributesRequest.typeUrl; + }, encode(message: QueryAllProvidersAttributesRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.pagination !== undefined) { PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); @@ -540,6 +576,12 @@ export const QueryAllProvidersAttributesRequest = { typeUrl: "/akash.audit.v1beta2.QueryAllProvidersAttributesRequest", value: QueryAllProvidersAttributesRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryAllProvidersAttributesRequest.typeUrl)) { + return; + } + PageRequest.registerTypeUrl(); } }; function createBaseQueryProviderAttributesRequest(): QueryProviderAttributesRequest { @@ -556,6 +598,15 @@ function createBaseQueryProviderAttributesRequest(): QueryProviderAttributesRequ */ export const QueryProviderAttributesRequest = { typeUrl: "/akash.audit.v1beta2.QueryProviderAttributesRequest", + is(o: any): o is QueryProviderAttributesRequest { + return o && (o.$typeUrl === QueryProviderAttributesRequest.typeUrl || typeof o.owner === "string"); + }, + isSDK(o: any): o is QueryProviderAttributesRequestSDKType { + return o && (o.$typeUrl === QueryProviderAttributesRequest.typeUrl || typeof o.owner === "string"); + }, + isAmino(o: any): o is QueryProviderAttributesRequestAmino { + return o && (o.$typeUrl === QueryProviderAttributesRequest.typeUrl || typeof o.owner === "string"); + }, encode(message: QueryProviderAttributesRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.owner !== "") { writer.uint32(10).string(message.owner); @@ -647,6 +698,12 @@ export const QueryProviderAttributesRequest = { typeUrl: "/akash.audit.v1beta2.QueryProviderAttributesRequest", value: QueryProviderAttributesRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryProviderAttributesRequest.typeUrl)) { + return; + } + PageRequest.registerTypeUrl(); } }; function createBaseQueryProviderAuditorRequest(): QueryProviderAuditorRequest { @@ -663,6 +720,15 @@ function createBaseQueryProviderAuditorRequest(): QueryProviderAuditorRequest { */ export const QueryProviderAuditorRequest = { typeUrl: "/akash.audit.v1beta2.QueryProviderAuditorRequest", + is(o: any): o is QueryProviderAuditorRequest { + return o && (o.$typeUrl === QueryProviderAuditorRequest.typeUrl || typeof o.auditor === "string" && typeof o.owner === "string"); + }, + isSDK(o: any): o is QueryProviderAuditorRequestSDKType { + return o && (o.$typeUrl === QueryProviderAuditorRequest.typeUrl || typeof o.auditor === "string" && typeof o.owner === "string"); + }, + isAmino(o: any): o is QueryProviderAuditorRequestAmino { + return o && (o.$typeUrl === QueryProviderAuditorRequest.typeUrl || typeof o.auditor === "string" && typeof o.owner === "string"); + }, encode(message: QueryProviderAuditorRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.auditor !== "") { writer.uint32(10).string(message.auditor); @@ -752,7 +818,8 @@ export const QueryProviderAuditorRequest = { typeUrl: "/akash.audit.v1beta2.QueryProviderAuditorRequest", value: QueryProviderAuditorRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryAuditorAttributesRequest(): QueryAuditorAttributesRequest { return { @@ -768,6 +835,15 @@ function createBaseQueryAuditorAttributesRequest(): QueryAuditorAttributesReques */ export const QueryAuditorAttributesRequest = { typeUrl: "/akash.audit.v1beta2.QueryAuditorAttributesRequest", + is(o: any): o is QueryAuditorAttributesRequest { + return o && (o.$typeUrl === QueryAuditorAttributesRequest.typeUrl || typeof o.auditor === "string"); + }, + isSDK(o: any): o is QueryAuditorAttributesRequestSDKType { + return o && (o.$typeUrl === QueryAuditorAttributesRequest.typeUrl || typeof o.auditor === "string"); + }, + isAmino(o: any): o is QueryAuditorAttributesRequestAmino { + return o && (o.$typeUrl === QueryAuditorAttributesRequest.typeUrl || typeof o.auditor === "string"); + }, encode(message: QueryAuditorAttributesRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.auditor !== "") { writer.uint32(10).string(message.auditor); @@ -859,5 +935,11 @@ export const QueryAuditorAttributesRequest = { typeUrl: "/akash.audit.v1beta2.QueryAuditorAttributesRequest", value: QueryAuditorAttributesRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryAuditorAttributesRequest.typeUrl)) { + return; + } + PageRequest.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/akash/base/v1beta1/attribute.ts b/__fixtures__/v-next/outputv2/akash/base/v1beta1/attribute.ts index 80020e9cef..e7beaa2f99 100644 --- a/__fixtures__/v-next/outputv2/akash/base/v1beta1/attribute.ts +++ b/__fixtures__/v-next/outputv2/akash/base/v1beta1/attribute.ts @@ -1,6 +1,7 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; import { isSet, DeepPartial } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "akash.base.v1beta1"; /** * Attribute represents key value pair @@ -163,6 +164,15 @@ function createBaseAttribute(): Attribute { */ export const Attribute = { typeUrl: "/akash.base.v1beta1.Attribute", + is(o: any): o is Attribute { + return o && (o.$typeUrl === Attribute.typeUrl || typeof o.key === "string" && typeof o.value === "string"); + }, + isSDK(o: any): o is AttributeSDKType { + return o && (o.$typeUrl === Attribute.typeUrl || typeof o.key === "string" && typeof o.value === "string"); + }, + isAmino(o: any): o is AttributeAmino { + return o && (o.$typeUrl === Attribute.typeUrl || typeof o.key === "string" && typeof o.value === "string"); + }, encode(message: Attribute, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.key !== "") { writer.uint32(10).string(message.key); @@ -252,7 +262,8 @@ export const Attribute = { typeUrl: "/akash.base.v1beta1.Attribute", value: Attribute.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseSignedBy(): SignedBy { return { @@ -271,6 +282,15 @@ function createBaseSignedBy(): SignedBy { */ export const SignedBy = { typeUrl: "/akash.base.v1beta1.SignedBy", + is(o: any): o is SignedBy { + return o && (o.$typeUrl === SignedBy.typeUrl || Array.isArray(o.allOf) && (!o.allOf.length || typeof o.allOf[0] === "string") && Array.isArray(o.anyOf) && (!o.anyOf.length || typeof o.anyOf[0] === "string")); + }, + isSDK(o: any): o is SignedBySDKType { + return o && (o.$typeUrl === SignedBy.typeUrl || Array.isArray(o.all_of) && (!o.all_of.length || typeof o.all_of[0] === "string") && Array.isArray(o.any_of) && (!o.any_of.length || typeof o.any_of[0] === "string")); + }, + isAmino(o: any): o is SignedByAmino { + return o && (o.$typeUrl === SignedBy.typeUrl || Array.isArray(o.all_of) && (!o.all_of.length || typeof o.all_of[0] === "string") && Array.isArray(o.any_of) && (!o.any_of.length || typeof o.any_of[0] === "string")); + }, encode(message: SignedBy, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.allOf) { writer.uint32(10).string(v!); @@ -380,7 +400,8 @@ export const SignedBy = { typeUrl: "/akash.base.v1beta1.SignedBy", value: SignedBy.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBasePlacementRequirements(): PlacementRequirements { return { @@ -396,6 +417,15 @@ function createBasePlacementRequirements(): PlacementRequirements { */ export const PlacementRequirements = { typeUrl: "/akash.base.v1beta1.PlacementRequirements", + is(o: any): o is PlacementRequirements { + return o && (o.$typeUrl === PlacementRequirements.typeUrl || SignedBy.is(o.signedBy) && Array.isArray(o.attributes) && (!o.attributes.length || Attribute.is(o.attributes[0]))); + }, + isSDK(o: any): o is PlacementRequirementsSDKType { + return o && (o.$typeUrl === PlacementRequirements.typeUrl || SignedBy.isSDK(o.signed_by) && Array.isArray(o.attributes) && (!o.attributes.length || Attribute.isSDK(o.attributes[0]))); + }, + isAmino(o: any): o is PlacementRequirementsAmino { + return o && (o.$typeUrl === PlacementRequirements.typeUrl || SignedBy.isAmino(o.signed_by) && Array.isArray(o.attributes) && (!o.attributes.length || Attribute.isAmino(o.attributes[0]))); + }, encode(message: PlacementRequirements, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.signedBy !== undefined) { SignedBy.encode(message.signedBy, writer.uint32(10).fork()).ldelim(); @@ -497,5 +527,12 @@ export const PlacementRequirements = { typeUrl: "/akash.base.v1beta1.PlacementRequirements", value: PlacementRequirements.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(PlacementRequirements.typeUrl)) { + return; + } + SignedBy.registerTypeUrl(); + Attribute.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/akash/base/v1beta1/endpoint.ts b/__fixtures__/v-next/outputv2/akash/base/v1beta1/endpoint.ts index cdb40948dd..e16ae9a9b6 100644 --- a/__fixtures__/v-next/outputv2/akash/base/v1beta1/endpoint.ts +++ b/__fixtures__/v-next/outputv2/akash/base/v1beta1/endpoint.ts @@ -1,5 +1,5 @@ -import { BinaryReader, BinaryWriter } from "../../../binary"; import { isSet, DeepPartial } from "../../../helpers"; +import { BinaryReader, BinaryWriter } from "../../../binary"; import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "akash.base.v1beta1"; /** This describes how the endpoint is implemented when the lease is deployed */ @@ -85,6 +85,15 @@ function createBaseEndpoint(): Endpoint { */ export const Endpoint = { typeUrl: "/akash.base.v1beta1.Endpoint", + is(o: any): o is Endpoint { + return o && (o.$typeUrl === Endpoint.typeUrl || isSet(o.kind)); + }, + isSDK(o: any): o is EndpointSDKType { + return o && (o.$typeUrl === Endpoint.typeUrl || isSet(o.kind)); + }, + isAmino(o: any): o is EndpointAmino { + return o && (o.$typeUrl === Endpoint.typeUrl || isSet(o.kind)); + }, encode(message: Endpoint, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.kind !== 0) { writer.uint32(8).int32(message.kind); @@ -159,5 +168,6 @@ export const Endpoint = { typeUrl: "/akash.base.v1beta1.Endpoint", value: Endpoint.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/akash/base/v1beta1/resource.ts b/__fixtures__/v-next/outputv2/akash/base/v1beta1/resource.ts index a9b3fb146d..a130100678 100644 --- a/__fixtures__/v-next/outputv2/akash/base/v1beta1/resource.ts +++ b/__fixtures__/v-next/outputv2/akash/base/v1beta1/resource.ts @@ -2,6 +2,7 @@ import { ResourceValue, ResourceValueAmino, ResourceValueSDKType } from "./resou import { Attribute, AttributeAmino, AttributeSDKType } from "./attribute"; import { Endpoint, EndpointAmino, EndpointSDKType } from "./endpoint"; import { BinaryReader, BinaryWriter } from "../../../binary"; +import { GlobalDecoderRegistry } from "../../../registry"; import { isSet, DeepPartial } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "akash.base.v1beta1"; @@ -180,6 +181,15 @@ function createBaseCPU(): CPU { */ export const CPU = { typeUrl: "/akash.base.v1beta1.CPU", + is(o: any): o is CPU { + return o && (o.$typeUrl === CPU.typeUrl || ResourceValue.is(o.units) && Array.isArray(o.attributes) && (!o.attributes.length || Attribute.is(o.attributes[0]))); + }, + isSDK(o: any): o is CPUSDKType { + return o && (o.$typeUrl === CPU.typeUrl || ResourceValue.isSDK(o.units) && Array.isArray(o.attributes) && (!o.attributes.length || Attribute.isSDK(o.attributes[0]))); + }, + isAmino(o: any): o is CPUAmino { + return o && (o.$typeUrl === CPU.typeUrl || ResourceValue.isAmino(o.units) && Array.isArray(o.attributes) && (!o.attributes.length || Attribute.isAmino(o.attributes[0]))); + }, encode(message: CPU, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.units !== undefined) { ResourceValue.encode(message.units, writer.uint32(10).fork()).ldelim(); @@ -281,6 +291,13 @@ export const CPU = { typeUrl: "/akash.base.v1beta1.CPU", value: CPU.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(CPU.typeUrl)) { + return; + } + ResourceValue.registerTypeUrl(); + Attribute.registerTypeUrl(); } }; function createBaseMemory(): Memory { @@ -297,6 +314,15 @@ function createBaseMemory(): Memory { */ export const Memory = { typeUrl: "/akash.base.v1beta1.Memory", + is(o: any): o is Memory { + return o && (o.$typeUrl === Memory.typeUrl || ResourceValue.is(o.quantity) && Array.isArray(o.attributes) && (!o.attributes.length || Attribute.is(o.attributes[0]))); + }, + isSDK(o: any): o is MemorySDKType { + return o && (o.$typeUrl === Memory.typeUrl || ResourceValue.isSDK(o.quantity) && Array.isArray(o.attributes) && (!o.attributes.length || Attribute.isSDK(o.attributes[0]))); + }, + isAmino(o: any): o is MemoryAmino { + return o && (o.$typeUrl === Memory.typeUrl || ResourceValue.isAmino(o.quantity) && Array.isArray(o.attributes) && (!o.attributes.length || Attribute.isAmino(o.attributes[0]))); + }, encode(message: Memory, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.quantity !== undefined) { ResourceValue.encode(message.quantity, writer.uint32(10).fork()).ldelim(); @@ -398,6 +424,13 @@ export const Memory = { typeUrl: "/akash.base.v1beta1.Memory", value: Memory.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Memory.typeUrl)) { + return; + } + ResourceValue.registerTypeUrl(); + Attribute.registerTypeUrl(); } }; function createBaseStorage(): Storage { @@ -414,6 +447,15 @@ function createBaseStorage(): Storage { */ export const Storage = { typeUrl: "/akash.base.v1beta1.Storage", + is(o: any): o is Storage { + return o && (o.$typeUrl === Storage.typeUrl || ResourceValue.is(o.quantity) && Array.isArray(o.attributes) && (!o.attributes.length || Attribute.is(o.attributes[0]))); + }, + isSDK(o: any): o is StorageSDKType { + return o && (o.$typeUrl === Storage.typeUrl || ResourceValue.isSDK(o.quantity) && Array.isArray(o.attributes) && (!o.attributes.length || Attribute.isSDK(o.attributes[0]))); + }, + isAmino(o: any): o is StorageAmino { + return o && (o.$typeUrl === Storage.typeUrl || ResourceValue.isAmino(o.quantity) && Array.isArray(o.attributes) && (!o.attributes.length || Attribute.isAmino(o.attributes[0]))); + }, encode(message: Storage, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.quantity !== undefined) { ResourceValue.encode(message.quantity, writer.uint32(10).fork()).ldelim(); @@ -515,6 +557,13 @@ export const Storage = { typeUrl: "/akash.base.v1beta1.Storage", value: Storage.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Storage.typeUrl)) { + return; + } + ResourceValue.registerTypeUrl(); + Attribute.registerTypeUrl(); } }; function createBaseResourceUnits(): ResourceUnits { @@ -534,6 +583,15 @@ function createBaseResourceUnits(): ResourceUnits { */ export const ResourceUnits = { typeUrl: "/akash.base.v1beta1.ResourceUnits", + is(o: any): o is ResourceUnits { + return o && (o.$typeUrl === ResourceUnits.typeUrl || Array.isArray(o.endpoints) && (!o.endpoints.length || Endpoint.is(o.endpoints[0]))); + }, + isSDK(o: any): o is ResourceUnitsSDKType { + return o && (o.$typeUrl === ResourceUnits.typeUrl || Array.isArray(o.endpoints) && (!o.endpoints.length || Endpoint.isSDK(o.endpoints[0]))); + }, + isAmino(o: any): o is ResourceUnitsAmino { + return o && (o.$typeUrl === ResourceUnits.typeUrl || Array.isArray(o.endpoints) && (!o.endpoints.length || Endpoint.isAmino(o.endpoints[0]))); + }, encode(message: ResourceUnits, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.cpu !== undefined) { CPU.encode(message.cpu, writer.uint32(10).fork()).ldelim(); @@ -669,5 +727,14 @@ export const ResourceUnits = { typeUrl: "/akash.base.v1beta1.ResourceUnits", value: ResourceUnits.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ResourceUnits.typeUrl)) { + return; + } + CPU.registerTypeUrl(); + Memory.registerTypeUrl(); + Storage.registerTypeUrl(); + Endpoint.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/akash/base/v1beta1/resourcevalue.ts b/__fixtures__/v-next/outputv2/akash/base/v1beta1/resourcevalue.ts index 268279e847..de90c19174 100644 --- a/__fixtures__/v-next/outputv2/akash/base/v1beta1/resourcevalue.ts +++ b/__fixtures__/v-next/outputv2/akash/base/v1beta1/resourcevalue.ts @@ -50,6 +50,15 @@ function createBaseResourceValue(): ResourceValue { */ export const ResourceValue = { typeUrl: "/akash.base.v1beta1.ResourceValue", + is(o: any): o is ResourceValue { + return o && (o.$typeUrl === ResourceValue.typeUrl || o.val instanceof Uint8Array || typeof o.val === "string"); + }, + isSDK(o: any): o is ResourceValueSDKType { + return o && (o.$typeUrl === ResourceValue.typeUrl || o.val instanceof Uint8Array || typeof o.val === "string"); + }, + isAmino(o: any): o is ResourceValueAmino { + return o && (o.$typeUrl === ResourceValue.typeUrl || o.val instanceof Uint8Array || typeof o.val === "string"); + }, encode(message: ResourceValue, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.val.length !== 0) { writer.uint32(10).bytes(message.val); @@ -124,5 +133,6 @@ export const ResourceValue = { typeUrl: "/akash.base.v1beta1.ResourceValue", value: ResourceValue.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/akash/base/v1beta2/attribute.ts b/__fixtures__/v-next/outputv2/akash/base/v1beta2/attribute.ts index a2de726dab..b850f3382e 100644 --- a/__fixtures__/v-next/outputv2/akash/base/v1beta2/attribute.ts +++ b/__fixtures__/v-next/outputv2/akash/base/v1beta2/attribute.ts @@ -1,6 +1,7 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; import { isSet, DeepPartial } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "akash.base.v1beta2"; /** * Attribute represents key value pair @@ -163,6 +164,15 @@ function createBaseAttribute(): Attribute { */ export const Attribute = { typeUrl: "/akash.base.v1beta2.Attribute", + is(o: any): o is Attribute { + return o && (o.$typeUrl === Attribute.typeUrl || typeof o.key === "string" && typeof o.value === "string"); + }, + isSDK(o: any): o is AttributeSDKType { + return o && (o.$typeUrl === Attribute.typeUrl || typeof o.key === "string" && typeof o.value === "string"); + }, + isAmino(o: any): o is AttributeAmino { + return o && (o.$typeUrl === Attribute.typeUrl || typeof o.key === "string" && typeof o.value === "string"); + }, encode(message: Attribute, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.key !== "") { writer.uint32(10).string(message.key); @@ -252,7 +262,8 @@ export const Attribute = { typeUrl: "/akash.base.v1beta2.Attribute", value: Attribute.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseSignedBy(): SignedBy { return { @@ -271,6 +282,15 @@ function createBaseSignedBy(): SignedBy { */ export const SignedBy = { typeUrl: "/akash.base.v1beta2.SignedBy", + is(o: any): o is SignedBy { + return o && (o.$typeUrl === SignedBy.typeUrl || Array.isArray(o.allOf) && (!o.allOf.length || typeof o.allOf[0] === "string") && Array.isArray(o.anyOf) && (!o.anyOf.length || typeof o.anyOf[0] === "string")); + }, + isSDK(o: any): o is SignedBySDKType { + return o && (o.$typeUrl === SignedBy.typeUrl || Array.isArray(o.all_of) && (!o.all_of.length || typeof o.all_of[0] === "string") && Array.isArray(o.any_of) && (!o.any_of.length || typeof o.any_of[0] === "string")); + }, + isAmino(o: any): o is SignedByAmino { + return o && (o.$typeUrl === SignedBy.typeUrl || Array.isArray(o.all_of) && (!o.all_of.length || typeof o.all_of[0] === "string") && Array.isArray(o.any_of) && (!o.any_of.length || typeof o.any_of[0] === "string")); + }, encode(message: SignedBy, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.allOf) { writer.uint32(10).string(v!); @@ -380,7 +400,8 @@ export const SignedBy = { typeUrl: "/akash.base.v1beta2.SignedBy", value: SignedBy.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBasePlacementRequirements(): PlacementRequirements { return { @@ -396,6 +417,15 @@ function createBasePlacementRequirements(): PlacementRequirements { */ export const PlacementRequirements = { typeUrl: "/akash.base.v1beta2.PlacementRequirements", + is(o: any): o is PlacementRequirements { + return o && (o.$typeUrl === PlacementRequirements.typeUrl || SignedBy.is(o.signedBy) && Array.isArray(o.attributes) && (!o.attributes.length || Attribute.is(o.attributes[0]))); + }, + isSDK(o: any): o is PlacementRequirementsSDKType { + return o && (o.$typeUrl === PlacementRequirements.typeUrl || SignedBy.isSDK(o.signed_by) && Array.isArray(o.attributes) && (!o.attributes.length || Attribute.isSDK(o.attributes[0]))); + }, + isAmino(o: any): o is PlacementRequirementsAmino { + return o && (o.$typeUrl === PlacementRequirements.typeUrl || SignedBy.isAmino(o.signed_by) && Array.isArray(o.attributes) && (!o.attributes.length || Attribute.isAmino(o.attributes[0]))); + }, encode(message: PlacementRequirements, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.signedBy !== undefined) { SignedBy.encode(message.signedBy, writer.uint32(10).fork()).ldelim(); @@ -497,5 +527,12 @@ export const PlacementRequirements = { typeUrl: "/akash.base.v1beta2.PlacementRequirements", value: PlacementRequirements.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(PlacementRequirements.typeUrl)) { + return; + } + SignedBy.registerTypeUrl(); + Attribute.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/akash/base/v1beta2/endpoint.ts b/__fixtures__/v-next/outputv2/akash/base/v1beta2/endpoint.ts index 4a3f54ea7e..c0e2c1d8b1 100644 --- a/__fixtures__/v-next/outputv2/akash/base/v1beta2/endpoint.ts +++ b/__fixtures__/v-next/outputv2/akash/base/v1beta2/endpoint.ts @@ -1,5 +1,5 @@ -import { BinaryReader, BinaryWriter } from "../../../binary"; import { isSet, DeepPartial } from "../../../helpers"; +import { BinaryReader, BinaryWriter } from "../../../binary"; import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "akash.base.v1beta2"; /** This describes how the endpoint is implemented when the lease is deployed */ @@ -96,6 +96,15 @@ function createBaseEndpoint(): Endpoint { */ export const Endpoint = { typeUrl: "/akash.base.v1beta2.Endpoint", + is(o: any): o is Endpoint { + return o && (o.$typeUrl === Endpoint.typeUrl || isSet(o.kind) && typeof o.sequenceNumber === "number"); + }, + isSDK(o: any): o is EndpointSDKType { + return o && (o.$typeUrl === Endpoint.typeUrl || isSet(o.kind) && typeof o.sequence_number === "number"); + }, + isAmino(o: any): o is EndpointAmino { + return o && (o.$typeUrl === Endpoint.typeUrl || isSet(o.kind) && typeof o.sequence_number === "number"); + }, encode(message: Endpoint, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.kind !== 0) { writer.uint32(8).int32(message.kind); @@ -185,5 +194,6 @@ export const Endpoint = { typeUrl: "/akash.base.v1beta2.Endpoint", value: Endpoint.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/akash/base/v1beta2/resource.ts b/__fixtures__/v-next/outputv2/akash/base/v1beta2/resource.ts index c26d49c24c..e8f16af29e 100644 --- a/__fixtures__/v-next/outputv2/akash/base/v1beta2/resource.ts +++ b/__fixtures__/v-next/outputv2/akash/base/v1beta2/resource.ts @@ -1,6 +1,7 @@ import { ResourceValue, ResourceValueAmino, ResourceValueSDKType } from "./resourcevalue"; import { Attribute, AttributeAmino, AttributeSDKType } from "./attribute"; import { BinaryReader, BinaryWriter } from "../../../binary"; +import { GlobalDecoderRegistry } from "../../../registry"; import { isSet, DeepPartial } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "akash.base.v1beta2"; @@ -135,6 +136,15 @@ function createBaseCPU(): CPU { */ export const CPU = { typeUrl: "/akash.base.v1beta2.CPU", + is(o: any): o is CPU { + return o && (o.$typeUrl === CPU.typeUrl || ResourceValue.is(o.units) && Array.isArray(o.attributes) && (!o.attributes.length || Attribute.is(o.attributes[0]))); + }, + isSDK(o: any): o is CPUSDKType { + return o && (o.$typeUrl === CPU.typeUrl || ResourceValue.isSDK(o.units) && Array.isArray(o.attributes) && (!o.attributes.length || Attribute.isSDK(o.attributes[0]))); + }, + isAmino(o: any): o is CPUAmino { + return o && (o.$typeUrl === CPU.typeUrl || ResourceValue.isAmino(o.units) && Array.isArray(o.attributes) && (!o.attributes.length || Attribute.isAmino(o.attributes[0]))); + }, encode(message: CPU, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.units !== undefined) { ResourceValue.encode(message.units, writer.uint32(10).fork()).ldelim(); @@ -236,6 +246,13 @@ export const CPU = { typeUrl: "/akash.base.v1beta2.CPU", value: CPU.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(CPU.typeUrl)) { + return; + } + ResourceValue.registerTypeUrl(); + Attribute.registerTypeUrl(); } }; function createBaseMemory(): Memory { @@ -252,6 +269,15 @@ function createBaseMemory(): Memory { */ export const Memory = { typeUrl: "/akash.base.v1beta2.Memory", + is(o: any): o is Memory { + return o && (o.$typeUrl === Memory.typeUrl || ResourceValue.is(o.quantity) && Array.isArray(o.attributes) && (!o.attributes.length || Attribute.is(o.attributes[0]))); + }, + isSDK(o: any): o is MemorySDKType { + return o && (o.$typeUrl === Memory.typeUrl || ResourceValue.isSDK(o.quantity) && Array.isArray(o.attributes) && (!o.attributes.length || Attribute.isSDK(o.attributes[0]))); + }, + isAmino(o: any): o is MemoryAmino { + return o && (o.$typeUrl === Memory.typeUrl || ResourceValue.isAmino(o.quantity) && Array.isArray(o.attributes) && (!o.attributes.length || Attribute.isAmino(o.attributes[0]))); + }, encode(message: Memory, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.quantity !== undefined) { ResourceValue.encode(message.quantity, writer.uint32(10).fork()).ldelim(); @@ -353,6 +379,13 @@ export const Memory = { typeUrl: "/akash.base.v1beta2.Memory", value: Memory.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Memory.typeUrl)) { + return; + } + ResourceValue.registerTypeUrl(); + Attribute.registerTypeUrl(); } }; function createBaseStorage(): Storage { @@ -370,6 +403,15 @@ function createBaseStorage(): Storage { */ export const Storage = { typeUrl: "/akash.base.v1beta2.Storage", + is(o: any): o is Storage { + return o && (o.$typeUrl === Storage.typeUrl || typeof o.name === "string" && ResourceValue.is(o.quantity) && Array.isArray(o.attributes) && (!o.attributes.length || Attribute.is(o.attributes[0]))); + }, + isSDK(o: any): o is StorageSDKType { + return o && (o.$typeUrl === Storage.typeUrl || typeof o.name === "string" && ResourceValue.isSDK(o.quantity) && Array.isArray(o.attributes) && (!o.attributes.length || Attribute.isSDK(o.attributes[0]))); + }, + isAmino(o: any): o is StorageAmino { + return o && (o.$typeUrl === Storage.typeUrl || typeof o.name === "string" && ResourceValue.isAmino(o.quantity) && Array.isArray(o.attributes) && (!o.attributes.length || Attribute.isAmino(o.attributes[0]))); + }, encode(message: Storage, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -486,5 +528,12 @@ export const Storage = { typeUrl: "/akash.base.v1beta2.Storage", value: Storage.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Storage.typeUrl)) { + return; + } + ResourceValue.registerTypeUrl(); + Attribute.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/akash/base/v1beta2/resourceunits.ts b/__fixtures__/v-next/outputv2/akash/base/v1beta2/resourceunits.ts index 19e3c04663..947fa47fff 100644 --- a/__fixtures__/v-next/outputv2/akash/base/v1beta2/resourceunits.ts +++ b/__fixtures__/v-next/outputv2/akash/base/v1beta2/resourceunits.ts @@ -1,6 +1,7 @@ import { CPU, CPUAmino, CPUSDKType, Memory, MemoryAmino, MemorySDKType, Storage, StorageAmino, StorageSDKType } from "./resource"; import { Endpoint, EndpointAmino, EndpointSDKType } from "./endpoint"; import { BinaryReader, BinaryWriter } from "../../../binary"; +import { GlobalDecoderRegistry } from "../../../registry"; import { isSet, DeepPartial } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "akash.base.v1beta2"; @@ -68,6 +69,15 @@ function createBaseResourceUnits(): ResourceUnits { */ export const ResourceUnits = { typeUrl: "/akash.base.v1beta2.ResourceUnits", + is(o: any): o is ResourceUnits { + return o && (o.$typeUrl === ResourceUnits.typeUrl || Array.isArray(o.storage) && (!o.storage.length || Storage.is(o.storage[0])) && Array.isArray(o.endpoints) && (!o.endpoints.length || Endpoint.is(o.endpoints[0]))); + }, + isSDK(o: any): o is ResourceUnitsSDKType { + return o && (o.$typeUrl === ResourceUnits.typeUrl || Array.isArray(o.storage) && (!o.storage.length || Storage.isSDK(o.storage[0])) && Array.isArray(o.endpoints) && (!o.endpoints.length || Endpoint.isSDK(o.endpoints[0]))); + }, + isAmino(o: any): o is ResourceUnitsAmino { + return o && (o.$typeUrl === ResourceUnits.typeUrl || Array.isArray(o.storage) && (!o.storage.length || Storage.isAmino(o.storage[0])) && Array.isArray(o.endpoints) && (!o.endpoints.length || Endpoint.isAmino(o.endpoints[0]))); + }, encode(message: ResourceUnits, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.cpu !== undefined) { CPU.encode(message.cpu, writer.uint32(10).fork()).ldelim(); @@ -211,5 +221,14 @@ export const ResourceUnits = { typeUrl: "/akash.base.v1beta2.ResourceUnits", value: ResourceUnits.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ResourceUnits.typeUrl)) { + return; + } + CPU.registerTypeUrl(); + Memory.registerTypeUrl(); + Storage.registerTypeUrl(); + Endpoint.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/akash/base/v1beta2/resourcevalue.ts b/__fixtures__/v-next/outputv2/akash/base/v1beta2/resourcevalue.ts index 6f173d180f..92212720bc 100644 --- a/__fixtures__/v-next/outputv2/akash/base/v1beta2/resourcevalue.ts +++ b/__fixtures__/v-next/outputv2/akash/base/v1beta2/resourcevalue.ts @@ -50,6 +50,15 @@ function createBaseResourceValue(): ResourceValue { */ export const ResourceValue = { typeUrl: "/akash.base.v1beta2.ResourceValue", + is(o: any): o is ResourceValue { + return o && (o.$typeUrl === ResourceValue.typeUrl || o.val instanceof Uint8Array || typeof o.val === "string"); + }, + isSDK(o: any): o is ResourceValueSDKType { + return o && (o.$typeUrl === ResourceValue.typeUrl || o.val instanceof Uint8Array || typeof o.val === "string"); + }, + isAmino(o: any): o is ResourceValueAmino { + return o && (o.$typeUrl === ResourceValue.typeUrl || o.val instanceof Uint8Array || typeof o.val === "string"); + }, encode(message: ResourceValue, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.val.length !== 0) { writer.uint32(10).bytes(message.val); @@ -124,5 +133,6 @@ export const ResourceValue = { typeUrl: "/akash.base.v1beta2.ResourceValue", value: ResourceValue.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/akash/bundle.ts b/__fixtures__/v-next/outputv2/akash/bundle.ts index 1252e3e6c0..235f53792d 100644 --- a/__fixtures__/v-next/outputv2/akash/bundle.ts +++ b/__fixtures__/v-next/outputv2/akash/bundle.ts @@ -67,14 +67,14 @@ import * as _328 from "./deployment/v1beta2/service.registry"; import * as _329 from "./market/v1beta2/service.registry"; import * as _330 from "./provider/v1beta1/provider.registry"; import * as _331 from "./provider/v1beta2/provider.registry"; -import * as _332 from "./audit/v1beta2/query.lcd"; -import * as _333 from "./cert/v1beta2/query.lcd"; -import * as _334 from "./deployment/v1beta1/query.lcd"; -import * as _335 from "./deployment/v1beta2/query.lcd"; -import * as _336 from "./escrow/v1beta1/query.lcd"; -import * as _337 from "./escrow/v1beta2/query.lcd"; -import * as _338 from "./market/v1beta2/query.lcd"; -import * as _339 from "./provider/v1beta2/query.lcd"; +import * as _332 from "./audit/v1beta2/query.rpc.func"; +import * as _333 from "./cert/v1beta2/query.rpc.func"; +import * as _334 from "./deployment/v1beta1/query.rpc.func"; +import * as _335 from "./deployment/v1beta2/query.rpc.func"; +import * as _336 from "./escrow/v1beta1/query.rpc.func"; +import * as _337 from "./escrow/v1beta2/query.rpc.func"; +import * as _338 from "./market/v1beta2/query.rpc.func"; +import * as _339 from "./provider/v1beta2/query.rpc.func"; import * as _340 from "./audit/v1beta2/query.rpc.Query"; import * as _341 from "./cert/v1beta2/query.rpc.Query"; import * as _342 from "./deployment/v1beta1/query.rpc.Query"; @@ -83,24 +83,32 @@ import * as _344 from "./escrow/v1beta1/query.rpc.Query"; import * as _345 from "./escrow/v1beta2/query.rpc.Query"; import * as _346 from "./market/v1beta2/query.rpc.Query"; import * as _347 from "./provider/v1beta2/query.rpc.Query"; -import * as _348 from "./audit/v1beta1/audit.rpc.msg"; -import * as _349 from "./audit/v1beta2/audit.rpc.msg"; -import * as _350 from "./cert/v1beta2/cert.rpc.msg"; -import * as _351 from "./deployment/v1beta1/deployment.rpc.msg"; -import * as _352 from "./deployment/v1beta2/service.rpc.msg"; -import * as _353 from "./market/v1beta2/service.rpc.msg"; -import * as _354 from "./provider/v1beta1/provider.rpc.msg"; -import * as _355 from "./provider/v1beta2/provider.rpc.msg"; -import * as _531 from "./lcd"; -import * as _532 from "./rpc.query"; -import * as _533 from "./rpc.tx"; +import * as _348 from "./audit/v1beta1/audit.rpc.func"; +import * as _349 from "./audit/v1beta2/audit.rpc.func"; +import * as _350 from "./cert/v1beta2/cert.rpc.func"; +import * as _351 from "./deployment/v1beta1/deployment.rpc.func"; +import * as _352 from "./deployment/v1beta2/service.rpc.func"; +import * as _353 from "./market/v1beta2/service.rpc.func"; +import * as _354 from "./provider/v1beta1/provider.rpc.func"; +import * as _355 from "./provider/v1beta2/provider.rpc.func"; +import * as _356 from "./audit/v1beta1/audit.rpc.msg"; +import * as _357 from "./audit/v1beta2/audit.rpc.msg"; +import * as _358 from "./cert/v1beta2/cert.rpc.msg"; +import * as _359 from "./deployment/v1beta1/deployment.rpc.msg"; +import * as _360 from "./deployment/v1beta2/service.rpc.msg"; +import * as _361 from "./market/v1beta2/service.rpc.msg"; +import * as _362 from "./provider/v1beta1/provider.rpc.msg"; +import * as _363 from "./provider/v1beta2/provider.rpc.msg"; +import * as _573 from "./rpc.query"; +import * as _574 from "./rpc.tx"; export namespace akash { export namespace audit { export const v1beta1 = { ..._0, ..._316, ..._324, - ..._348 + ..._348, + ..._356 }; export const v1beta2 = { ..._1, @@ -110,7 +118,8 @@ export namespace akash { ..._325, ..._332, ..._340, - ..._349 + ..._349, + ..._357 }; } export namespace base { @@ -137,7 +146,8 @@ export namespace akash { ..._326, ..._333, ..._341, - ..._350 + ..._350, + ..._358 }; } export namespace deployment { @@ -152,7 +162,8 @@ export namespace akash { ..._327, ..._334, ..._342, - ..._351 + ..._351, + ..._359 }; export const v1beta2 = { ..._22, @@ -171,7 +182,8 @@ export namespace akash { ..._328, ..._335, ..._343, - ..._352 + ..._352, + ..._360 }; } export namespace escrow { @@ -209,7 +221,8 @@ export namespace akash { ..._329, ..._338, ..._346, - ..._353 + ..._353, + ..._361 }; } export namespace provider { @@ -217,7 +230,8 @@ export namespace akash { ..._49, ..._322, ..._330, - ..._354 + ..._354, + ..._362 }; export const v1beta2 = { ..._50, @@ -227,12 +241,12 @@ export namespace akash { ..._331, ..._339, ..._347, - ..._355 + ..._355, + ..._363 }; } export const ClientFactory = { - ..._531, - ..._532, - ..._533 + ..._573, + ..._574 }; } \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/akash/cert/v1beta2/cert.registry.ts b/__fixtures__/v-next/outputv2/akash/cert/v1beta2/cert.registry.ts index 33e21dfbf0..2ed75d86fb 100644 --- a/__fixtures__/v-next/outputv2/akash/cert/v1beta2/cert.registry.ts +++ b/__fixtures__/v-next/outputv2/akash/cert/v1beta2/cert.registry.ts @@ -1,11 +1,6 @@ -import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { TelescopeGeneratedType } from "../../../types"; import { MsgCreateCertificate, MsgRevokeCertificate } from "./cert"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/akash.cert.v1beta2.MsgCreateCertificate", MsgCreateCertificate], ["/akash.cert.v1beta2.MsgRevokeCertificate", MsgRevokeCertificate]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/akash.cert.v1beta2.MsgCreateCertificate", MsgCreateCertificate], ["/akash.cert.v1beta2.MsgRevokeCertificate", MsgRevokeCertificate]]; export const MessageComposer = { encoded: { createCertificate(value: MsgCreateCertificate) { diff --git a/__fixtures__/v-next/outputv2/akash/cert/v1beta2/cert.rpc.func.ts b/__fixtures__/v-next/outputv2/akash/cert/v1beta2/cert.rpc.func.ts new file mode 100644 index 0000000000..5dd5208f6d --- /dev/null +++ b/__fixtures__/v-next/outputv2/akash/cert/v1beta2/cert.rpc.func.ts @@ -0,0 +1,20 @@ +import { buildTx } from "../../../helper-func-types"; +import { MsgCreateCertificate, MsgRevokeCertificate } from "./cert"; +/** + * CreateCertificate defines a method to create new certificate given proper inputs. + * @name createCertificate + * @package akash.cert.v1beta2 + * @see proto service: akash.cert.v1beta2.CreateCertificate + */ +export const createCertificate = buildTx({ + msg: MsgCreateCertificate +}); +/** + * RevokeCertificate defines a method to revoke the certificate + * @name revokeCertificate + * @package akash.cert.v1beta2 + * @see proto service: akash.cert.v1beta2.RevokeCertificate + */ +export const revokeCertificate = buildTx({ + msg: MsgRevokeCertificate +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/akash/cert/v1beta2/cert.ts b/__fixtures__/v-next/outputv2/akash/cert/v1beta2/cert.ts index 977ac15baa..7061854aa1 100644 --- a/__fixtures__/v-next/outputv2/akash/cert/v1beta2/cert.ts +++ b/__fixtures__/v-next/outputv2/akash/cert/v1beta2/cert.ts @@ -1,6 +1,7 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "akash.cert.v1beta2"; /** State is an enum which refers to state of deployment */ export enum Certificate_State { @@ -312,6 +313,15 @@ function createBaseCertificateID(): CertificateID { */ export const CertificateID = { typeUrl: "/akash.cert.v1beta2.CertificateID", + is(o: any): o is CertificateID { + return o && (o.$typeUrl === CertificateID.typeUrl || typeof o.owner === "string" && typeof o.serial === "string"); + }, + isSDK(o: any): o is CertificateIDSDKType { + return o && (o.$typeUrl === CertificateID.typeUrl || typeof o.owner === "string" && typeof o.serial === "string"); + }, + isAmino(o: any): o is CertificateIDAmino { + return o && (o.$typeUrl === CertificateID.typeUrl || typeof o.owner === "string" && typeof o.serial === "string"); + }, encode(message: CertificateID, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.owner !== "") { writer.uint32(10).string(message.owner); @@ -401,7 +411,8 @@ export const CertificateID = { typeUrl: "/akash.cert.v1beta2.CertificateID", value: CertificateID.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseCertificate(): Certificate { return { @@ -418,6 +429,15 @@ function createBaseCertificate(): Certificate { */ export const Certificate = { typeUrl: "/akash.cert.v1beta2.Certificate", + is(o: any): o is Certificate { + return o && (o.$typeUrl === Certificate.typeUrl || isSet(o.state) && (o.cert instanceof Uint8Array || typeof o.cert === "string") && (o.pubkey instanceof Uint8Array || typeof o.pubkey === "string")); + }, + isSDK(o: any): o is CertificateSDKType { + return o && (o.$typeUrl === Certificate.typeUrl || isSet(o.state) && (o.cert instanceof Uint8Array || typeof o.cert === "string") && (o.pubkey instanceof Uint8Array || typeof o.pubkey === "string")); + }, + isAmino(o: any): o is CertificateAmino { + return o && (o.$typeUrl === Certificate.typeUrl || isSet(o.state) && (o.cert instanceof Uint8Array || typeof o.cert === "string") && (o.pubkey instanceof Uint8Array || typeof o.pubkey === "string")); + }, encode(message: Certificate, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.state !== 0) { writer.uint32(16).int32(message.state); @@ -522,7 +542,8 @@ export const Certificate = { typeUrl: "/akash.cert.v1beta2.Certificate", value: Certificate.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseCertificateFilter(): CertificateFilter { return { @@ -539,6 +560,15 @@ function createBaseCertificateFilter(): CertificateFilter { */ export const CertificateFilter = { typeUrl: "/akash.cert.v1beta2.CertificateFilter", + is(o: any): o is CertificateFilter { + return o && (o.$typeUrl === CertificateFilter.typeUrl || typeof o.owner === "string" && typeof o.serial === "string" && typeof o.state === "string"); + }, + isSDK(o: any): o is CertificateFilterSDKType { + return o && (o.$typeUrl === CertificateFilter.typeUrl || typeof o.owner === "string" && typeof o.serial === "string" && typeof o.state === "string"); + }, + isAmino(o: any): o is CertificateFilterAmino { + return o && (o.$typeUrl === CertificateFilter.typeUrl || typeof o.owner === "string" && typeof o.serial === "string" && typeof o.state === "string"); + }, encode(message: CertificateFilter, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.owner !== "") { writer.uint32(10).string(message.owner); @@ -643,7 +673,8 @@ export const CertificateFilter = { typeUrl: "/akash.cert.v1beta2.CertificateFilter", value: CertificateFilter.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgCreateCertificate(): MsgCreateCertificate { return { @@ -660,6 +691,15 @@ function createBaseMsgCreateCertificate(): MsgCreateCertificate { */ export const MsgCreateCertificate = { typeUrl: "/akash.cert.v1beta2.MsgCreateCertificate", + is(o: any): o is MsgCreateCertificate { + return o && (o.$typeUrl === MsgCreateCertificate.typeUrl || typeof o.owner === "string" && (o.cert instanceof Uint8Array || typeof o.cert === "string") && (o.pubkey instanceof Uint8Array || typeof o.pubkey === "string")); + }, + isSDK(o: any): o is MsgCreateCertificateSDKType { + return o && (o.$typeUrl === MsgCreateCertificate.typeUrl || typeof o.owner === "string" && (o.cert instanceof Uint8Array || typeof o.cert === "string") && (o.pubkey instanceof Uint8Array || typeof o.pubkey === "string")); + }, + isAmino(o: any): o is MsgCreateCertificateAmino { + return o && (o.$typeUrl === MsgCreateCertificate.typeUrl || typeof o.owner === "string" && (o.cert instanceof Uint8Array || typeof o.cert === "string") && (o.pubkey instanceof Uint8Array || typeof o.pubkey === "string")); + }, encode(message: MsgCreateCertificate, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.owner !== "") { writer.uint32(10).string(message.owner); @@ -764,7 +804,8 @@ export const MsgCreateCertificate = { typeUrl: "/akash.cert.v1beta2.MsgCreateCertificate", value: MsgCreateCertificate.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgCreateCertificateResponse(): MsgCreateCertificateResponse { return {}; @@ -777,6 +818,15 @@ function createBaseMsgCreateCertificateResponse(): MsgCreateCertificateResponse */ export const MsgCreateCertificateResponse = { typeUrl: "/akash.cert.v1beta2.MsgCreateCertificateResponse", + is(o: any): o is MsgCreateCertificateResponse { + return o && o.$typeUrl === MsgCreateCertificateResponse.typeUrl; + }, + isSDK(o: any): o is MsgCreateCertificateResponseSDKType { + return o && o.$typeUrl === MsgCreateCertificateResponse.typeUrl; + }, + isAmino(o: any): o is MsgCreateCertificateResponseAmino { + return o && o.$typeUrl === MsgCreateCertificateResponse.typeUrl; + }, encode(_: MsgCreateCertificateResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -835,7 +885,8 @@ export const MsgCreateCertificateResponse = { typeUrl: "/akash.cert.v1beta2.MsgCreateCertificateResponse", value: MsgCreateCertificateResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgRevokeCertificate(): MsgRevokeCertificate { return { @@ -850,6 +901,15 @@ function createBaseMsgRevokeCertificate(): MsgRevokeCertificate { */ export const MsgRevokeCertificate = { typeUrl: "/akash.cert.v1beta2.MsgRevokeCertificate", + is(o: any): o is MsgRevokeCertificate { + return o && (o.$typeUrl === MsgRevokeCertificate.typeUrl || CertificateID.is(o.id)); + }, + isSDK(o: any): o is MsgRevokeCertificateSDKType { + return o && (o.$typeUrl === MsgRevokeCertificate.typeUrl || CertificateID.isSDK(o.id)); + }, + isAmino(o: any): o is MsgRevokeCertificateAmino { + return o && (o.$typeUrl === MsgRevokeCertificate.typeUrl || CertificateID.isAmino(o.id)); + }, encode(message: MsgRevokeCertificate, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.id !== undefined) { CertificateID.encode(message.id, writer.uint32(10).fork()).ldelim(); @@ -926,6 +986,12 @@ export const MsgRevokeCertificate = { typeUrl: "/akash.cert.v1beta2.MsgRevokeCertificate", value: MsgRevokeCertificate.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgRevokeCertificate.typeUrl)) { + return; + } + CertificateID.registerTypeUrl(); } }; function createBaseMsgRevokeCertificateResponse(): MsgRevokeCertificateResponse { @@ -939,6 +1005,15 @@ function createBaseMsgRevokeCertificateResponse(): MsgRevokeCertificateResponse */ export const MsgRevokeCertificateResponse = { typeUrl: "/akash.cert.v1beta2.MsgRevokeCertificateResponse", + is(o: any): o is MsgRevokeCertificateResponse { + return o && o.$typeUrl === MsgRevokeCertificateResponse.typeUrl; + }, + isSDK(o: any): o is MsgRevokeCertificateResponseSDKType { + return o && o.$typeUrl === MsgRevokeCertificateResponse.typeUrl; + }, + isAmino(o: any): o is MsgRevokeCertificateResponseAmino { + return o && o.$typeUrl === MsgRevokeCertificateResponse.typeUrl; + }, encode(_: MsgRevokeCertificateResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -997,5 +1072,6 @@ export const MsgRevokeCertificateResponse = { typeUrl: "/akash.cert.v1beta2.MsgRevokeCertificateResponse", value: MsgRevokeCertificateResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/akash/cert/v1beta2/genesis.ts b/__fixtures__/v-next/outputv2/akash/cert/v1beta2/genesis.ts index 5a116b5ea9..32c83339ab 100644 --- a/__fixtures__/v-next/outputv2/akash/cert/v1beta2/genesis.ts +++ b/__fixtures__/v-next/outputv2/akash/cert/v1beta2/genesis.ts @@ -1,5 +1,6 @@ import { Certificate, CertificateAmino, CertificateSDKType } from "./cert"; import { BinaryReader, BinaryWriter } from "../../../binary"; +import { GlobalDecoderRegistry } from "../../../registry"; import { isSet, DeepPartial } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "akash.cert.v1beta2"; @@ -90,6 +91,15 @@ function createBaseGenesisCertificate(): GenesisCertificate { */ export const GenesisCertificate = { typeUrl: "/akash.cert.v1beta2.GenesisCertificate", + is(o: any): o is GenesisCertificate { + return o && (o.$typeUrl === GenesisCertificate.typeUrl || typeof o.owner === "string" && Certificate.is(o.certificate)); + }, + isSDK(o: any): o is GenesisCertificateSDKType { + return o && (o.$typeUrl === GenesisCertificate.typeUrl || typeof o.owner === "string" && Certificate.isSDK(o.certificate)); + }, + isAmino(o: any): o is GenesisCertificateAmino { + return o && (o.$typeUrl === GenesisCertificate.typeUrl || typeof o.owner === "string" && Certificate.isAmino(o.certificate)); + }, encode(message: GenesisCertificate, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.owner !== "") { writer.uint32(10).string(message.owner); @@ -181,6 +191,12 @@ export const GenesisCertificate = { typeUrl: "/akash.cert.v1beta2.GenesisCertificate", value: GenesisCertificate.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GenesisCertificate.typeUrl)) { + return; + } + Certificate.registerTypeUrl(); } }; function createBaseGenesisState(): GenesisState { @@ -196,6 +212,15 @@ function createBaseGenesisState(): GenesisState { */ export const GenesisState = { typeUrl: "/akash.cert.v1beta2.GenesisState", + is(o: any): o is GenesisState { + return o && (o.$typeUrl === GenesisState.typeUrl || Array.isArray(o.certificates) && (!o.certificates.length || GenesisCertificate.is(o.certificates[0]))); + }, + isSDK(o: any): o is GenesisStateSDKType { + return o && (o.$typeUrl === GenesisState.typeUrl || Array.isArray(o.certificates) && (!o.certificates.length || GenesisCertificate.isSDK(o.certificates[0]))); + }, + isAmino(o: any): o is GenesisStateAmino { + return o && (o.$typeUrl === GenesisState.typeUrl || Array.isArray(o.certificates) && (!o.certificates.length || GenesisCertificate.isAmino(o.certificates[0]))); + }, encode(message: GenesisState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.certificates) { GenesisCertificate.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -280,5 +305,11 @@ export const GenesisState = { typeUrl: "/akash.cert.v1beta2.GenesisState", value: GenesisState.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GenesisState.typeUrl)) { + return; + } + GenesisCertificate.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/akash/cert/v1beta2/query.rpc.func.ts b/__fixtures__/v-next/outputv2/akash/cert/v1beta2/query.rpc.func.ts new file mode 100644 index 0000000000..fb1d971fc6 --- /dev/null +++ b/__fixtures__/v-next/outputv2/akash/cert/v1beta2/query.rpc.func.ts @@ -0,0 +1,15 @@ +import { buildQuery } from "../../../helper-func-types"; +import { QueryCertificatesRequest, QueryCertificatesResponse } from "./query"; +/** + * Certificates queries certificates + * @name getCertificates + * @package akash.cert.v1beta2 + * @see proto service: akash.cert.v1beta2.Certificates + */ +export const getCertificates = buildQuery({ + encode: QueryCertificatesRequest.encode, + decode: QueryCertificatesResponse.decode, + service: "akash.cert.v1beta2.Query", + method: "Certificates", + deps: [QueryCertificatesRequest, QueryCertificatesResponse] +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/akash/cert/v1beta2/query.ts b/__fixtures__/v-next/outputv2/akash/cert/v1beta2/query.ts index 5baad9ddd1..6baf9f4302 100644 --- a/__fixtures__/v-next/outputv2/akash/cert/v1beta2/query.ts +++ b/__fixtures__/v-next/outputv2/akash/cert/v1beta2/query.ts @@ -1,6 +1,7 @@ import { CertificateFilter, CertificateFilterAmino, CertificateFilterSDKType, Certificate, CertificateAmino, CertificateSDKType } from "./cert"; import { PageRequest, PageRequestAmino, PageRequestSDKType, PageResponse, PageResponseAmino, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination"; import { BinaryReader, BinaryWriter } from "../../../binary"; +import { GlobalDecoderRegistry } from "../../../registry"; import { isSet, DeepPartial } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "akash.cert.v1beta2"; @@ -132,6 +133,15 @@ function createBaseCertificateResponse(): CertificateResponse { */ export const CertificateResponse = { typeUrl: "/akash.cert.v1beta2.CertificateResponse", + is(o: any): o is CertificateResponse { + return o && (o.$typeUrl === CertificateResponse.typeUrl || Certificate.is(o.certificate) && typeof o.serial === "string"); + }, + isSDK(o: any): o is CertificateResponseSDKType { + return o && (o.$typeUrl === CertificateResponse.typeUrl || Certificate.isSDK(o.certificate) && typeof o.serial === "string"); + }, + isAmino(o: any): o is CertificateResponseAmino { + return o && (o.$typeUrl === CertificateResponse.typeUrl || Certificate.isAmino(o.certificate) && typeof o.serial === "string"); + }, encode(message: CertificateResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.certificate !== undefined) { Certificate.encode(message.certificate, writer.uint32(10).fork()).ldelim(); @@ -223,6 +233,12 @@ export const CertificateResponse = { typeUrl: "/akash.cert.v1beta2.CertificateResponse", value: CertificateResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(CertificateResponse.typeUrl)) { + return; + } + Certificate.registerTypeUrl(); } }; function createBaseQueryCertificatesRequest(): QueryCertificatesRequest { @@ -239,6 +255,15 @@ function createBaseQueryCertificatesRequest(): QueryCertificatesRequest { */ export const QueryCertificatesRequest = { typeUrl: "/akash.cert.v1beta2.QueryCertificatesRequest", + is(o: any): o is QueryCertificatesRequest { + return o && (o.$typeUrl === QueryCertificatesRequest.typeUrl || CertificateFilter.is(o.filter)); + }, + isSDK(o: any): o is QueryCertificatesRequestSDKType { + return o && (o.$typeUrl === QueryCertificatesRequest.typeUrl || CertificateFilter.isSDK(o.filter)); + }, + isAmino(o: any): o is QueryCertificatesRequestAmino { + return o && (o.$typeUrl === QueryCertificatesRequest.typeUrl || CertificateFilter.isAmino(o.filter)); + }, encode(message: QueryCertificatesRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.filter !== undefined) { CertificateFilter.encode(message.filter, writer.uint32(10).fork()).ldelim(); @@ -332,6 +357,13 @@ export const QueryCertificatesRequest = { typeUrl: "/akash.cert.v1beta2.QueryCertificatesRequest", value: QueryCertificatesRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryCertificatesRequest.typeUrl)) { + return; + } + CertificateFilter.registerTypeUrl(); + PageRequest.registerTypeUrl(); } }; function createBaseQueryCertificatesResponse(): QueryCertificatesResponse { @@ -348,6 +380,15 @@ function createBaseQueryCertificatesResponse(): QueryCertificatesResponse { */ export const QueryCertificatesResponse = { typeUrl: "/akash.cert.v1beta2.QueryCertificatesResponse", + is(o: any): o is QueryCertificatesResponse { + return o && (o.$typeUrl === QueryCertificatesResponse.typeUrl || Array.isArray(o.certificates) && (!o.certificates.length || CertificateResponse.is(o.certificates[0]))); + }, + isSDK(o: any): o is QueryCertificatesResponseSDKType { + return o && (o.$typeUrl === QueryCertificatesResponse.typeUrl || Array.isArray(o.certificates) && (!o.certificates.length || CertificateResponse.isSDK(o.certificates[0]))); + }, + isAmino(o: any): o is QueryCertificatesResponseAmino { + return o && (o.$typeUrl === QueryCertificatesResponse.typeUrl || Array.isArray(o.certificates) && (!o.certificates.length || CertificateResponse.isAmino(o.certificates[0]))); + }, encode(message: QueryCertificatesResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.certificates) { CertificateResponse.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -449,5 +490,12 @@ export const QueryCertificatesResponse = { typeUrl: "/akash.cert.v1beta2.QueryCertificatesResponse", value: QueryCertificatesResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryCertificatesResponse.typeUrl)) { + return; + } + CertificateResponse.registerTypeUrl(); + PageResponse.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/akash/deployment/v1beta1/authz.ts b/__fixtures__/v-next/outputv2/akash/deployment/v1beta1/authz.ts index 33f42ee775..9b46d2e338 100644 --- a/__fixtures__/v-next/outputv2/akash/deployment/v1beta1/authz.ts +++ b/__fixtures__/v-next/outputv2/akash/deployment/v1beta1/authz.ts @@ -1,5 +1,6 @@ import { Coin, CoinAmino, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; +import { GlobalDecoderRegistry } from "../../../registry"; import { isSet, DeepPartial } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "akash.deployment.v1beta1"; @@ -66,6 +67,15 @@ function createBaseDepositDeploymentAuthorization(): DepositDeploymentAuthorizat */ export const DepositDeploymentAuthorization = { typeUrl: "/akash.deployment.v1beta1.DepositDeploymentAuthorization", + is(o: any): o is DepositDeploymentAuthorization { + return o && (o.$typeUrl === DepositDeploymentAuthorization.typeUrl || Coin.is(o.spendLimit)); + }, + isSDK(o: any): o is DepositDeploymentAuthorizationSDKType { + return o && (o.$typeUrl === DepositDeploymentAuthorization.typeUrl || Coin.isSDK(o.spend_limit)); + }, + isAmino(o: any): o is DepositDeploymentAuthorizationAmino { + return o && (o.$typeUrl === DepositDeploymentAuthorization.typeUrl || Coin.isAmino(o.spend_limit)); + }, encode(message: DepositDeploymentAuthorization, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.spendLimit !== undefined) { Coin.encode(message.spendLimit, writer.uint32(10).fork()).ldelim(); @@ -142,5 +152,12 @@ export const DepositDeploymentAuthorization = { typeUrl: "/akash.deployment.v1beta1.DepositDeploymentAuthorization", value: DepositDeploymentAuthorization.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(DepositDeploymentAuthorization.typeUrl)) { + return; + } + GlobalDecoderRegistry.register(DepositDeploymentAuthorization.typeUrl, DepositDeploymentAuthorization); + Coin.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/akash/deployment/v1beta1/deployment.registry.ts b/__fixtures__/v-next/outputv2/akash/deployment/v1beta1/deployment.registry.ts index 956cc03bd6..094c7f85d0 100644 --- a/__fixtures__/v-next/outputv2/akash/deployment/v1beta1/deployment.registry.ts +++ b/__fixtures__/v-next/outputv2/akash/deployment/v1beta1/deployment.registry.ts @@ -1,12 +1,7 @@ import { MsgCloseGroup, MsgPauseGroup, MsgStartGroup } from "./group"; -import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { TelescopeGeneratedType } from "../../../types"; import { MsgCreateDeployment, MsgDepositDeployment, MsgUpdateDeployment, MsgCloseDeployment } from "./deployment"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/akash.deployment.v1beta1.MsgCreateDeployment", MsgCreateDeployment], ["/akash.deployment.v1beta1.MsgDepositDeployment", MsgDepositDeployment], ["/akash.deployment.v1beta1.MsgUpdateDeployment", MsgUpdateDeployment], ["/akash.deployment.v1beta1.MsgCloseDeployment", MsgCloseDeployment], ["/akash.deployment.v1beta1.MsgCloseGroup", MsgCloseGroup], ["/akash.deployment.v1beta1.MsgPauseGroup", MsgPauseGroup], ["/akash.deployment.v1beta1.MsgStartGroup", MsgStartGroup]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/akash.deployment.v1beta1.MsgCreateDeployment", MsgCreateDeployment], ["/akash.deployment.v1beta1.MsgDepositDeployment", MsgDepositDeployment], ["/akash.deployment.v1beta1.MsgUpdateDeployment", MsgUpdateDeployment], ["/akash.deployment.v1beta1.MsgCloseDeployment", MsgCloseDeployment], ["/akash.deployment.v1beta1.MsgCloseGroup", MsgCloseGroup], ["/akash.deployment.v1beta1.MsgPauseGroup", MsgPauseGroup], ["/akash.deployment.v1beta1.MsgStartGroup", MsgStartGroup]]; export const MessageComposer = { encoded: { createDeployment(value: MsgCreateDeployment) { diff --git a/__fixtures__/v-next/outputv2/akash/deployment/v1beta1/deployment.rpc.func.ts b/__fixtures__/v-next/outputv2/akash/deployment/v1beta1/deployment.rpc.func.ts new file mode 100644 index 0000000000..f680aafa76 --- /dev/null +++ b/__fixtures__/v-next/outputv2/akash/deployment/v1beta1/deployment.rpc.func.ts @@ -0,0 +1,66 @@ +import { MsgCloseGroup, MsgPauseGroup, MsgStartGroup } from "./group"; +import { buildTx } from "../../../helper-func-types"; +import { MsgCreateDeployment, MsgDepositDeployment, MsgUpdateDeployment, MsgCloseDeployment } from "./deployment"; +/** + * CreateDeployment defines a method to create new deployment given proper inputs. + * @name createDeployment + * @package akash.deployment.v1beta1 + * @see proto service: akash.deployment.v1beta1.CreateDeployment + */ +export const createDeployment = buildTx({ + msg: MsgCreateDeployment +}); +/** + * DepositDeployment deposits more funds into the deployment account + * @name depositDeployment + * @package akash.deployment.v1beta1 + * @see proto service: akash.deployment.v1beta1.DepositDeployment + */ +export const depositDeployment = buildTx({ + msg: MsgDepositDeployment +}); +/** + * UpdateDeployment defines a method to update a deployment given proper inputs. + * @name updateDeployment + * @package akash.deployment.v1beta1 + * @see proto service: akash.deployment.v1beta1.UpdateDeployment + */ +export const updateDeployment = buildTx({ + msg: MsgUpdateDeployment +}); +/** + * CloseDeployment defines a method to close a deployment given proper inputs. + * @name closeDeployment + * @package akash.deployment.v1beta1 + * @see proto service: akash.deployment.v1beta1.CloseDeployment + */ +export const closeDeployment = buildTx({ + msg: MsgCloseDeployment +}); +/** + * CloseGroup defines a method to close a group of a deployment given proper inputs. + * @name closeGroup + * @package akash.deployment.v1beta1 + * @see proto service: akash.deployment.v1beta1.CloseGroup + */ +export const closeGroup = buildTx({ + msg: MsgCloseGroup +}); +/** + * PauseGroup defines a method to close a group of a deployment given proper inputs. + * @name pauseGroup + * @package akash.deployment.v1beta1 + * @see proto service: akash.deployment.v1beta1.PauseGroup + */ +export const pauseGroup = buildTx({ + msg: MsgPauseGroup +}); +/** + * StartGroup defines a method to close a group of a deployment given proper inputs. + * @name startGroup + * @package akash.deployment.v1beta1 + * @see proto service: akash.deployment.v1beta1.StartGroup + */ +export const startGroup = buildTx({ + msg: MsgStartGroup +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/akash/deployment/v1beta1/deployment.ts b/__fixtures__/v-next/outputv2/akash/deployment/v1beta1/deployment.ts index 250203d398..b82237eaa9 100644 --- a/__fixtures__/v-next/outputv2/akash/deployment/v1beta1/deployment.ts +++ b/__fixtures__/v-next/outputv2/akash/deployment/v1beta1/deployment.ts @@ -3,6 +3,7 @@ import { GroupSpec, GroupSpecAmino, GroupSpecSDKType } from "./group"; import { Coin, CoinAmino, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; +import { GlobalDecoderRegistry } from "../../../registry"; import { isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "akash.deployment.v1beta1"; @@ -461,6 +462,15 @@ function createBaseMsgCreateDeployment(): MsgCreateDeployment { */ export const MsgCreateDeployment = { typeUrl: "/akash.deployment.v1beta1.MsgCreateDeployment", + is(o: any): o is MsgCreateDeployment { + return o && (o.$typeUrl === MsgCreateDeployment.typeUrl || DeploymentID.is(o.id) && Array.isArray(o.groups) && (!o.groups.length || GroupSpec.is(o.groups[0])) && (o.version instanceof Uint8Array || typeof o.version === "string") && Coin.is(o.deposit)); + }, + isSDK(o: any): o is MsgCreateDeploymentSDKType { + return o && (o.$typeUrl === MsgCreateDeployment.typeUrl || DeploymentID.isSDK(o.id) && Array.isArray(o.groups) && (!o.groups.length || GroupSpec.isSDK(o.groups[0])) && (o.version instanceof Uint8Array || typeof o.version === "string") && Coin.isSDK(o.deposit)); + }, + isAmino(o: any): o is MsgCreateDeploymentAmino { + return o && (o.$typeUrl === MsgCreateDeployment.typeUrl || DeploymentID.isAmino(o.id) && Array.isArray(o.groups) && (!o.groups.length || GroupSpec.isAmino(o.groups[0])) && (o.version instanceof Uint8Array || typeof o.version === "string") && Coin.isAmino(o.deposit)); + }, encode(message: MsgCreateDeployment, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.id !== undefined) { DeploymentID.encode(message.id, writer.uint32(10).fork()).ldelim(); @@ -594,6 +604,14 @@ export const MsgCreateDeployment = { typeUrl: "/akash.deployment.v1beta1.MsgCreateDeployment", value: MsgCreateDeployment.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgCreateDeployment.typeUrl)) { + return; + } + DeploymentID.registerTypeUrl(); + GroupSpec.registerTypeUrl(); + Coin.registerTypeUrl(); } }; function createBaseMsgCreateDeploymentResponse(): MsgCreateDeploymentResponse { @@ -607,6 +625,15 @@ function createBaseMsgCreateDeploymentResponse(): MsgCreateDeploymentResponse { */ export const MsgCreateDeploymentResponse = { typeUrl: "/akash.deployment.v1beta1.MsgCreateDeploymentResponse", + is(o: any): o is MsgCreateDeploymentResponse { + return o && o.$typeUrl === MsgCreateDeploymentResponse.typeUrl; + }, + isSDK(o: any): o is MsgCreateDeploymentResponseSDKType { + return o && o.$typeUrl === MsgCreateDeploymentResponse.typeUrl; + }, + isAmino(o: any): o is MsgCreateDeploymentResponseAmino { + return o && o.$typeUrl === MsgCreateDeploymentResponse.typeUrl; + }, encode(_: MsgCreateDeploymentResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -665,7 +692,8 @@ export const MsgCreateDeploymentResponse = { typeUrl: "/akash.deployment.v1beta1.MsgCreateDeploymentResponse", value: MsgCreateDeploymentResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgDepositDeployment(): MsgDepositDeployment { return { @@ -681,6 +709,15 @@ function createBaseMsgDepositDeployment(): MsgDepositDeployment { */ export const MsgDepositDeployment = { typeUrl: "/akash.deployment.v1beta1.MsgDepositDeployment", + is(o: any): o is MsgDepositDeployment { + return o && (o.$typeUrl === MsgDepositDeployment.typeUrl || DeploymentID.is(o.id) && Coin.is(o.amount)); + }, + isSDK(o: any): o is MsgDepositDeploymentSDKType { + return o && (o.$typeUrl === MsgDepositDeployment.typeUrl || DeploymentID.isSDK(o.id) && Coin.isSDK(o.amount)); + }, + isAmino(o: any): o is MsgDepositDeploymentAmino { + return o && (o.$typeUrl === MsgDepositDeployment.typeUrl || DeploymentID.isAmino(o.id) && Coin.isAmino(o.amount)); + }, encode(message: MsgDepositDeployment, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.id !== undefined) { DeploymentID.encode(message.id, writer.uint32(10).fork()).ldelim(); @@ -774,6 +811,13 @@ export const MsgDepositDeployment = { typeUrl: "/akash.deployment.v1beta1.MsgDepositDeployment", value: MsgDepositDeployment.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgDepositDeployment.typeUrl)) { + return; + } + DeploymentID.registerTypeUrl(); + Coin.registerTypeUrl(); } }; function createBaseMsgDepositDeploymentResponse(): MsgDepositDeploymentResponse { @@ -787,6 +831,15 @@ function createBaseMsgDepositDeploymentResponse(): MsgDepositDeploymentResponse */ export const MsgDepositDeploymentResponse = { typeUrl: "/akash.deployment.v1beta1.MsgDepositDeploymentResponse", + is(o: any): o is MsgDepositDeploymentResponse { + return o && o.$typeUrl === MsgDepositDeploymentResponse.typeUrl; + }, + isSDK(o: any): o is MsgDepositDeploymentResponseSDKType { + return o && o.$typeUrl === MsgDepositDeploymentResponse.typeUrl; + }, + isAmino(o: any): o is MsgDepositDeploymentResponseAmino { + return o && o.$typeUrl === MsgDepositDeploymentResponse.typeUrl; + }, encode(_: MsgDepositDeploymentResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -845,7 +898,8 @@ export const MsgDepositDeploymentResponse = { typeUrl: "/akash.deployment.v1beta1.MsgDepositDeploymentResponse", value: MsgDepositDeploymentResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgUpdateDeployment(): MsgUpdateDeployment { return { @@ -862,6 +916,15 @@ function createBaseMsgUpdateDeployment(): MsgUpdateDeployment { */ export const MsgUpdateDeployment = { typeUrl: "/akash.deployment.v1beta1.MsgUpdateDeployment", + is(o: any): o is MsgUpdateDeployment { + return o && (o.$typeUrl === MsgUpdateDeployment.typeUrl || DeploymentID.is(o.id) && Array.isArray(o.groups) && (!o.groups.length || GroupSpec.is(o.groups[0])) && (o.version instanceof Uint8Array || typeof o.version === "string")); + }, + isSDK(o: any): o is MsgUpdateDeploymentSDKType { + return o && (o.$typeUrl === MsgUpdateDeployment.typeUrl || DeploymentID.isSDK(o.id) && Array.isArray(o.groups) && (!o.groups.length || GroupSpec.isSDK(o.groups[0])) && (o.version instanceof Uint8Array || typeof o.version === "string")); + }, + isAmino(o: any): o is MsgUpdateDeploymentAmino { + return o && (o.$typeUrl === MsgUpdateDeployment.typeUrl || DeploymentID.isAmino(o.id) && Array.isArray(o.groups) && (!o.groups.length || GroupSpec.isAmino(o.groups[0])) && (o.version instanceof Uint8Array || typeof o.version === "string")); + }, encode(message: MsgUpdateDeployment, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.id !== undefined) { DeploymentID.encode(message.id, writer.uint32(10).fork()).ldelim(); @@ -978,6 +1041,13 @@ export const MsgUpdateDeployment = { typeUrl: "/akash.deployment.v1beta1.MsgUpdateDeployment", value: MsgUpdateDeployment.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgUpdateDeployment.typeUrl)) { + return; + } + DeploymentID.registerTypeUrl(); + GroupSpec.registerTypeUrl(); } }; function createBaseMsgUpdateDeploymentResponse(): MsgUpdateDeploymentResponse { @@ -991,6 +1061,15 @@ function createBaseMsgUpdateDeploymentResponse(): MsgUpdateDeploymentResponse { */ export const MsgUpdateDeploymentResponse = { typeUrl: "/akash.deployment.v1beta1.MsgUpdateDeploymentResponse", + is(o: any): o is MsgUpdateDeploymentResponse { + return o && o.$typeUrl === MsgUpdateDeploymentResponse.typeUrl; + }, + isSDK(o: any): o is MsgUpdateDeploymentResponseSDKType { + return o && o.$typeUrl === MsgUpdateDeploymentResponse.typeUrl; + }, + isAmino(o: any): o is MsgUpdateDeploymentResponseAmino { + return o && o.$typeUrl === MsgUpdateDeploymentResponse.typeUrl; + }, encode(_: MsgUpdateDeploymentResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -1049,7 +1128,8 @@ export const MsgUpdateDeploymentResponse = { typeUrl: "/akash.deployment.v1beta1.MsgUpdateDeploymentResponse", value: MsgUpdateDeploymentResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgCloseDeployment(): MsgCloseDeployment { return { @@ -1064,6 +1144,15 @@ function createBaseMsgCloseDeployment(): MsgCloseDeployment { */ export const MsgCloseDeployment = { typeUrl: "/akash.deployment.v1beta1.MsgCloseDeployment", + is(o: any): o is MsgCloseDeployment { + return o && (o.$typeUrl === MsgCloseDeployment.typeUrl || DeploymentID.is(o.id)); + }, + isSDK(o: any): o is MsgCloseDeploymentSDKType { + return o && (o.$typeUrl === MsgCloseDeployment.typeUrl || DeploymentID.isSDK(o.id)); + }, + isAmino(o: any): o is MsgCloseDeploymentAmino { + return o && (o.$typeUrl === MsgCloseDeployment.typeUrl || DeploymentID.isAmino(o.id)); + }, encode(message: MsgCloseDeployment, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.id !== undefined) { DeploymentID.encode(message.id, writer.uint32(10).fork()).ldelim(); @@ -1140,6 +1229,12 @@ export const MsgCloseDeployment = { typeUrl: "/akash.deployment.v1beta1.MsgCloseDeployment", value: MsgCloseDeployment.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgCloseDeployment.typeUrl)) { + return; + } + DeploymentID.registerTypeUrl(); } }; function createBaseMsgCloseDeploymentResponse(): MsgCloseDeploymentResponse { @@ -1153,6 +1248,15 @@ function createBaseMsgCloseDeploymentResponse(): MsgCloseDeploymentResponse { */ export const MsgCloseDeploymentResponse = { typeUrl: "/akash.deployment.v1beta1.MsgCloseDeploymentResponse", + is(o: any): o is MsgCloseDeploymentResponse { + return o && o.$typeUrl === MsgCloseDeploymentResponse.typeUrl; + }, + isSDK(o: any): o is MsgCloseDeploymentResponseSDKType { + return o && o.$typeUrl === MsgCloseDeploymentResponse.typeUrl; + }, + isAmino(o: any): o is MsgCloseDeploymentResponseAmino { + return o && o.$typeUrl === MsgCloseDeploymentResponse.typeUrl; + }, encode(_: MsgCloseDeploymentResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -1211,7 +1315,8 @@ export const MsgCloseDeploymentResponse = { typeUrl: "/akash.deployment.v1beta1.MsgCloseDeploymentResponse", value: MsgCloseDeploymentResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseDeploymentID(): DeploymentID { return { @@ -1227,6 +1332,15 @@ function createBaseDeploymentID(): DeploymentID { */ export const DeploymentID = { typeUrl: "/akash.deployment.v1beta1.DeploymentID", + is(o: any): o is DeploymentID { + return o && (o.$typeUrl === DeploymentID.typeUrl || typeof o.owner === "string" && typeof o.dseq === "bigint"); + }, + isSDK(o: any): o is DeploymentIDSDKType { + return o && (o.$typeUrl === DeploymentID.typeUrl || typeof o.owner === "string" && typeof o.dseq === "bigint"); + }, + isAmino(o: any): o is DeploymentIDAmino { + return o && (o.$typeUrl === DeploymentID.typeUrl || typeof o.owner === "string" && typeof o.dseq === "bigint"); + }, encode(message: DeploymentID, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.owner !== "") { writer.uint32(10).string(message.owner); @@ -1318,7 +1432,8 @@ export const DeploymentID = { typeUrl: "/akash.deployment.v1beta1.DeploymentID", value: DeploymentID.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseDeployment(): Deployment { return { @@ -1336,6 +1451,15 @@ function createBaseDeployment(): Deployment { */ export const Deployment = { typeUrl: "/akash.deployment.v1beta1.Deployment", + is(o: any): o is Deployment { + return o && (o.$typeUrl === Deployment.typeUrl || DeploymentID.is(o.deploymentId) && isSet(o.state) && (o.version instanceof Uint8Array || typeof o.version === "string") && typeof o.createdAt === "bigint"); + }, + isSDK(o: any): o is DeploymentSDKType { + return o && (o.$typeUrl === Deployment.typeUrl || DeploymentID.isSDK(o.deployment_id) && isSet(o.state) && (o.version instanceof Uint8Array || typeof o.version === "string") && typeof o.created_at === "bigint"); + }, + isAmino(o: any): o is DeploymentAmino { + return o && (o.$typeUrl === Deployment.typeUrl || DeploymentID.isAmino(o.deployment_id) && isSet(o.state) && (o.version instanceof Uint8Array || typeof o.version === "string") && typeof o.created_at === "bigint"); + }, encode(message: Deployment, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.deploymentId !== undefined) { DeploymentID.encode(message.deploymentId, writer.uint32(10).fork()).ldelim(); @@ -1459,6 +1583,12 @@ export const Deployment = { typeUrl: "/akash.deployment.v1beta1.Deployment", value: Deployment.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Deployment.typeUrl)) { + return; + } + DeploymentID.registerTypeUrl(); } }; function createBaseDeploymentFilters(): DeploymentFilters { @@ -1476,6 +1606,15 @@ function createBaseDeploymentFilters(): DeploymentFilters { */ export const DeploymentFilters = { typeUrl: "/akash.deployment.v1beta1.DeploymentFilters", + is(o: any): o is DeploymentFilters { + return o && (o.$typeUrl === DeploymentFilters.typeUrl || typeof o.owner === "string" && typeof o.dseq === "bigint" && typeof o.state === "string"); + }, + isSDK(o: any): o is DeploymentFiltersSDKType { + return o && (o.$typeUrl === DeploymentFilters.typeUrl || typeof o.owner === "string" && typeof o.dseq === "bigint" && typeof o.state === "string"); + }, + isAmino(o: any): o is DeploymentFiltersAmino { + return o && (o.$typeUrl === DeploymentFilters.typeUrl || typeof o.owner === "string" && typeof o.dseq === "bigint" && typeof o.state === "string"); + }, encode(message: DeploymentFilters, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.owner !== "") { writer.uint32(10).string(message.owner); @@ -1582,5 +1721,6 @@ export const DeploymentFilters = { typeUrl: "/akash.deployment.v1beta1.DeploymentFilters", value: DeploymentFilters.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/akash/deployment/v1beta1/genesis.ts b/__fixtures__/v-next/outputv2/akash/deployment/v1beta1/genesis.ts index d34b86aaa2..70e4e91130 100644 --- a/__fixtures__/v-next/outputv2/akash/deployment/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv2/akash/deployment/v1beta1/genesis.ts @@ -2,6 +2,7 @@ import { Deployment, DeploymentAmino, DeploymentSDKType } from "./deployment"; import { Group, GroupAmino, GroupSDKType } from "./group"; import { Params, ParamsAmino, ParamsSDKType } from "./params"; import { BinaryReader, BinaryWriter } from "../../../binary"; +import { GlobalDecoderRegistry } from "../../../registry"; import { isSet, DeepPartial } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "akash.deployment.v1beta1"; @@ -95,6 +96,15 @@ function createBaseGenesisDeployment(): GenesisDeployment { */ export const GenesisDeployment = { typeUrl: "/akash.deployment.v1beta1.GenesisDeployment", + is(o: any): o is GenesisDeployment { + return o && (o.$typeUrl === GenesisDeployment.typeUrl || Deployment.is(o.deployment) && Array.isArray(o.groups) && (!o.groups.length || Group.is(o.groups[0]))); + }, + isSDK(o: any): o is GenesisDeploymentSDKType { + return o && (o.$typeUrl === GenesisDeployment.typeUrl || Deployment.isSDK(o.deployment) && Array.isArray(o.groups) && (!o.groups.length || Group.isSDK(o.groups[0]))); + }, + isAmino(o: any): o is GenesisDeploymentAmino { + return o && (o.$typeUrl === GenesisDeployment.typeUrl || Deployment.isAmino(o.deployment) && Array.isArray(o.groups) && (!o.groups.length || Group.isAmino(o.groups[0]))); + }, encode(message: GenesisDeployment, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.deployment !== undefined) { Deployment.encode(message.deployment, writer.uint32(10).fork()).ldelim(); @@ -196,6 +206,13 @@ export const GenesisDeployment = { typeUrl: "/akash.deployment.v1beta1.GenesisDeployment", value: GenesisDeployment.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GenesisDeployment.typeUrl)) { + return; + } + Deployment.registerTypeUrl(); + Group.registerTypeUrl(); } }; function createBaseGenesisState(): GenesisState { @@ -212,6 +229,15 @@ function createBaseGenesisState(): GenesisState { */ export const GenesisState = { typeUrl: "/akash.deployment.v1beta1.GenesisState", + is(o: any): o is GenesisState { + return o && (o.$typeUrl === GenesisState.typeUrl || Array.isArray(o.deployments) && (!o.deployments.length || GenesisDeployment.is(o.deployments[0])) && Params.is(o.params)); + }, + isSDK(o: any): o is GenesisStateSDKType { + return o && (o.$typeUrl === GenesisState.typeUrl || Array.isArray(o.deployments) && (!o.deployments.length || GenesisDeployment.isSDK(o.deployments[0])) && Params.isSDK(o.params)); + }, + isAmino(o: any): o is GenesisStateAmino { + return o && (o.$typeUrl === GenesisState.typeUrl || Array.isArray(o.deployments) && (!o.deployments.length || GenesisDeployment.isAmino(o.deployments[0])) && Params.isAmino(o.params)); + }, encode(message: GenesisState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.deployments) { GenesisDeployment.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -313,5 +339,12 @@ export const GenesisState = { typeUrl: "/akash.deployment.v1beta1.GenesisState", value: GenesisState.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GenesisState.typeUrl)) { + return; + } + GenesisDeployment.registerTypeUrl(); + Params.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/akash/deployment/v1beta1/group.ts b/__fixtures__/v-next/outputv2/akash/deployment/v1beta1/group.ts index 93ef5f8565..48db8d4b92 100644 --- a/__fixtures__/v-next/outputv2/akash/deployment/v1beta1/group.ts +++ b/__fixtures__/v-next/outputv2/akash/deployment/v1beta1/group.ts @@ -2,6 +2,7 @@ import { PlacementRequirements, PlacementRequirementsAmino, PlacementRequirement import { ResourceUnits, ResourceUnitsAmino, ResourceUnitsSDKType } from "../../base/v1beta1/resource"; import { Coin, CoinAmino, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; +import { GlobalDecoderRegistry } from "../../../registry"; import { isSet, DeepPartial } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "akash.deployment.v1beta1"; @@ -433,6 +434,15 @@ function createBaseMsgCloseGroup(): MsgCloseGroup { */ export const MsgCloseGroup = { typeUrl: "/akash.deployment.v1beta1.MsgCloseGroup", + is(o: any): o is MsgCloseGroup { + return o && (o.$typeUrl === MsgCloseGroup.typeUrl || GroupID.is(o.id)); + }, + isSDK(o: any): o is MsgCloseGroupSDKType { + return o && (o.$typeUrl === MsgCloseGroup.typeUrl || GroupID.isSDK(o.id)); + }, + isAmino(o: any): o is MsgCloseGroupAmino { + return o && (o.$typeUrl === MsgCloseGroup.typeUrl || GroupID.isAmino(o.id)); + }, encode(message: MsgCloseGroup, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.id !== undefined) { GroupID.encode(message.id, writer.uint32(10).fork()).ldelim(); @@ -509,6 +519,12 @@ export const MsgCloseGroup = { typeUrl: "/akash.deployment.v1beta1.MsgCloseGroup", value: MsgCloseGroup.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgCloseGroup.typeUrl)) { + return; + } + GroupID.registerTypeUrl(); } }; function createBaseMsgCloseGroupResponse(): MsgCloseGroupResponse { @@ -522,6 +538,15 @@ function createBaseMsgCloseGroupResponse(): MsgCloseGroupResponse { */ export const MsgCloseGroupResponse = { typeUrl: "/akash.deployment.v1beta1.MsgCloseGroupResponse", + is(o: any): o is MsgCloseGroupResponse { + return o && o.$typeUrl === MsgCloseGroupResponse.typeUrl; + }, + isSDK(o: any): o is MsgCloseGroupResponseSDKType { + return o && o.$typeUrl === MsgCloseGroupResponse.typeUrl; + }, + isAmino(o: any): o is MsgCloseGroupResponseAmino { + return o && o.$typeUrl === MsgCloseGroupResponse.typeUrl; + }, encode(_: MsgCloseGroupResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -580,7 +605,8 @@ export const MsgCloseGroupResponse = { typeUrl: "/akash.deployment.v1beta1.MsgCloseGroupResponse", value: MsgCloseGroupResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgPauseGroup(): MsgPauseGroup { return { @@ -595,6 +621,15 @@ function createBaseMsgPauseGroup(): MsgPauseGroup { */ export const MsgPauseGroup = { typeUrl: "/akash.deployment.v1beta1.MsgPauseGroup", + is(o: any): o is MsgPauseGroup { + return o && (o.$typeUrl === MsgPauseGroup.typeUrl || GroupID.is(o.id)); + }, + isSDK(o: any): o is MsgPauseGroupSDKType { + return o && (o.$typeUrl === MsgPauseGroup.typeUrl || GroupID.isSDK(o.id)); + }, + isAmino(o: any): o is MsgPauseGroupAmino { + return o && (o.$typeUrl === MsgPauseGroup.typeUrl || GroupID.isAmino(o.id)); + }, encode(message: MsgPauseGroup, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.id !== undefined) { GroupID.encode(message.id, writer.uint32(10).fork()).ldelim(); @@ -671,6 +706,12 @@ export const MsgPauseGroup = { typeUrl: "/akash.deployment.v1beta1.MsgPauseGroup", value: MsgPauseGroup.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgPauseGroup.typeUrl)) { + return; + } + GroupID.registerTypeUrl(); } }; function createBaseMsgPauseGroupResponse(): MsgPauseGroupResponse { @@ -684,6 +725,15 @@ function createBaseMsgPauseGroupResponse(): MsgPauseGroupResponse { */ export const MsgPauseGroupResponse = { typeUrl: "/akash.deployment.v1beta1.MsgPauseGroupResponse", + is(o: any): o is MsgPauseGroupResponse { + return o && o.$typeUrl === MsgPauseGroupResponse.typeUrl; + }, + isSDK(o: any): o is MsgPauseGroupResponseSDKType { + return o && o.$typeUrl === MsgPauseGroupResponse.typeUrl; + }, + isAmino(o: any): o is MsgPauseGroupResponseAmino { + return o && o.$typeUrl === MsgPauseGroupResponse.typeUrl; + }, encode(_: MsgPauseGroupResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -742,7 +792,8 @@ export const MsgPauseGroupResponse = { typeUrl: "/akash.deployment.v1beta1.MsgPauseGroupResponse", value: MsgPauseGroupResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgStartGroup(): MsgStartGroup { return { @@ -757,6 +808,15 @@ function createBaseMsgStartGroup(): MsgStartGroup { */ export const MsgStartGroup = { typeUrl: "/akash.deployment.v1beta1.MsgStartGroup", + is(o: any): o is MsgStartGroup { + return o && (o.$typeUrl === MsgStartGroup.typeUrl || GroupID.is(o.id)); + }, + isSDK(o: any): o is MsgStartGroupSDKType { + return o && (o.$typeUrl === MsgStartGroup.typeUrl || GroupID.isSDK(o.id)); + }, + isAmino(o: any): o is MsgStartGroupAmino { + return o && (o.$typeUrl === MsgStartGroup.typeUrl || GroupID.isAmino(o.id)); + }, encode(message: MsgStartGroup, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.id !== undefined) { GroupID.encode(message.id, writer.uint32(10).fork()).ldelim(); @@ -833,6 +893,12 @@ export const MsgStartGroup = { typeUrl: "/akash.deployment.v1beta1.MsgStartGroup", value: MsgStartGroup.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgStartGroup.typeUrl)) { + return; + } + GroupID.registerTypeUrl(); } }; function createBaseMsgStartGroupResponse(): MsgStartGroupResponse { @@ -846,6 +912,15 @@ function createBaseMsgStartGroupResponse(): MsgStartGroupResponse { */ export const MsgStartGroupResponse = { typeUrl: "/akash.deployment.v1beta1.MsgStartGroupResponse", + is(o: any): o is MsgStartGroupResponse { + return o && o.$typeUrl === MsgStartGroupResponse.typeUrl; + }, + isSDK(o: any): o is MsgStartGroupResponseSDKType { + return o && o.$typeUrl === MsgStartGroupResponse.typeUrl; + }, + isAmino(o: any): o is MsgStartGroupResponseAmino { + return o && o.$typeUrl === MsgStartGroupResponse.typeUrl; + }, encode(_: MsgStartGroupResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -904,7 +979,8 @@ export const MsgStartGroupResponse = { typeUrl: "/akash.deployment.v1beta1.MsgStartGroupResponse", value: MsgStartGroupResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseGroupID(): GroupID { return { @@ -921,6 +997,15 @@ function createBaseGroupID(): GroupID { */ export const GroupID = { typeUrl: "/akash.deployment.v1beta1.GroupID", + is(o: any): o is GroupID { + return o && (o.$typeUrl === GroupID.typeUrl || typeof o.owner === "string" && typeof o.dseq === "bigint" && typeof o.gseq === "number"); + }, + isSDK(o: any): o is GroupIDSDKType { + return o && (o.$typeUrl === GroupID.typeUrl || typeof o.owner === "string" && typeof o.dseq === "bigint" && typeof o.gseq === "number"); + }, + isAmino(o: any): o is GroupIDAmino { + return o && (o.$typeUrl === GroupID.typeUrl || typeof o.owner === "string" && typeof o.dseq === "bigint" && typeof o.gseq === "number"); + }, encode(message: GroupID, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.owner !== "") { writer.uint32(10).string(message.owner); @@ -1027,7 +1112,8 @@ export const GroupID = { typeUrl: "/akash.deployment.v1beta1.GroupID", value: GroupID.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseGroupSpec(): GroupSpec { return { @@ -1044,6 +1130,15 @@ function createBaseGroupSpec(): GroupSpec { */ export const GroupSpec = { typeUrl: "/akash.deployment.v1beta1.GroupSpec", + is(o: any): o is GroupSpec { + return o && (o.$typeUrl === GroupSpec.typeUrl || typeof o.name === "string" && PlacementRequirements.is(o.requirements) && Array.isArray(o.resources) && (!o.resources.length || Resource.is(o.resources[0]))); + }, + isSDK(o: any): o is GroupSpecSDKType { + return o && (o.$typeUrl === GroupSpec.typeUrl || typeof o.name === "string" && PlacementRequirements.isSDK(o.requirements) && Array.isArray(o.resources) && (!o.resources.length || Resource.isSDK(o.resources[0]))); + }, + isAmino(o: any): o is GroupSpecAmino { + return o && (o.$typeUrl === GroupSpec.typeUrl || typeof o.name === "string" && PlacementRequirements.isAmino(o.requirements) && Array.isArray(o.resources) && (!o.resources.length || Resource.isAmino(o.resources[0]))); + }, encode(message: GroupSpec, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -1160,6 +1255,13 @@ export const GroupSpec = { typeUrl: "/akash.deployment.v1beta1.GroupSpec", value: GroupSpec.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GroupSpec.typeUrl)) { + return; + } + PlacementRequirements.registerTypeUrl(); + Resource.registerTypeUrl(); } }; function createBaseGroup(): Group { @@ -1178,6 +1280,15 @@ function createBaseGroup(): Group { */ export const Group = { typeUrl: "/akash.deployment.v1beta1.Group", + is(o: any): o is Group { + return o && (o.$typeUrl === Group.typeUrl || GroupID.is(o.groupId) && isSet(o.state) && GroupSpec.is(o.groupSpec) && typeof o.createdAt === "bigint"); + }, + isSDK(o: any): o is GroupSDKType { + return o && (o.$typeUrl === Group.typeUrl || GroupID.isSDK(o.group_id) && isSet(o.state) && GroupSpec.isSDK(o.group_spec) && typeof o.created_at === "bigint"); + }, + isAmino(o: any): o is GroupAmino { + return o && (o.$typeUrl === Group.typeUrl || GroupID.isAmino(o.group_id) && isSet(o.state) && GroupSpec.isAmino(o.group_spec) && typeof o.created_at === "bigint"); + }, encode(message: Group, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.groupId !== undefined) { GroupID.encode(message.groupId, writer.uint32(10).fork()).ldelim(); @@ -1303,6 +1414,13 @@ export const Group = { typeUrl: "/akash.deployment.v1beta1.Group", value: Group.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Group.typeUrl)) { + return; + } + GroupID.registerTypeUrl(); + GroupSpec.registerTypeUrl(); } }; function createBaseResource(): Resource { @@ -1320,6 +1438,15 @@ function createBaseResource(): Resource { */ export const Resource = { typeUrl: "/akash.deployment.v1beta1.Resource", + is(o: any): o is Resource { + return o && (o.$typeUrl === Resource.typeUrl || ResourceUnits.is(o.resources) && typeof o.count === "number" && Coin.is(o.price)); + }, + isSDK(o: any): o is ResourceSDKType { + return o && (o.$typeUrl === Resource.typeUrl || ResourceUnits.isSDK(o.resources) && typeof o.count === "number" && Coin.isSDK(o.price)); + }, + isAmino(o: any): o is ResourceAmino { + return o && (o.$typeUrl === Resource.typeUrl || ResourceUnits.isAmino(o.resources) && typeof o.count === "number" && Coin.isAmino(o.price)); + }, encode(message: Resource, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.resources !== undefined) { ResourceUnits.encode(message.resources, writer.uint32(10).fork()).ldelim(); @@ -1428,5 +1555,12 @@ export const Resource = { typeUrl: "/akash.deployment.v1beta1.Resource", value: Resource.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Resource.typeUrl)) { + return; + } + ResourceUnits.registerTypeUrl(); + Coin.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/akash/deployment/v1beta1/params.ts b/__fixtures__/v-next/outputv2/akash/deployment/v1beta1/params.ts index 2be3e2fb24..a5b059958b 100644 --- a/__fixtures__/v-next/outputv2/akash/deployment/v1beta1/params.ts +++ b/__fixtures__/v-next/outputv2/akash/deployment/v1beta1/params.ts @@ -1,5 +1,6 @@ import { Coin, CoinAmino, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; +import { GlobalDecoderRegistry } from "../../../registry"; import { isSet, DeepPartial } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "akash.deployment.v1beta1"; @@ -51,6 +52,15 @@ function createBaseParams(): Params { */ export const Params = { typeUrl: "/akash.deployment.v1beta1.Params", + is(o: any): o is Params { + return o && (o.$typeUrl === Params.typeUrl || Coin.is(o.deploymentMinDeposit)); + }, + isSDK(o: any): o is ParamsSDKType { + return o && (o.$typeUrl === Params.typeUrl || Coin.isSDK(o.deployment_min_deposit)); + }, + isAmino(o: any): o is ParamsAmino { + return o && (o.$typeUrl === Params.typeUrl || Coin.isAmino(o.deployment_min_deposit)); + }, encode(message: Params, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.deploymentMinDeposit !== undefined) { Coin.encode(message.deploymentMinDeposit, writer.uint32(10).fork()).ldelim(); @@ -127,5 +137,11 @@ export const Params = { typeUrl: "/akash.deployment.v1beta1.Params", value: Params.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Params.typeUrl)) { + return; + } + Coin.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/akash/deployment/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputv2/akash/deployment/v1beta1/query.rpc.func.ts new file mode 100644 index 0000000000..de623aae69 --- /dev/null +++ b/__fixtures__/v-next/outputv2/akash/deployment/v1beta1/query.rpc.func.ts @@ -0,0 +1,41 @@ +import { buildQuery } from "../../../helper-func-types"; +import { QueryDeploymentsRequest, QueryDeploymentsResponse, QueryDeploymentRequest, QueryDeploymentResponse, QueryGroupRequest, QueryGroupResponse } from "./query"; +/** + * Deployments queries deployments + * @name getDeployments + * @package akash.deployment.v1beta1 + * @see proto service: akash.deployment.v1beta1.Deployments + */ +export const getDeployments = buildQuery({ + encode: QueryDeploymentsRequest.encode, + decode: QueryDeploymentsResponse.decode, + service: "akash.deployment.v1beta1.Query", + method: "Deployments", + deps: [QueryDeploymentsRequest, QueryDeploymentsResponse] +}); +/** + * Deployment queries deployment details + * @name getDeployment + * @package akash.deployment.v1beta1 + * @see proto service: akash.deployment.v1beta1.Deployment + */ +export const getDeployment = buildQuery({ + encode: QueryDeploymentRequest.encode, + decode: QueryDeploymentResponse.decode, + service: "akash.deployment.v1beta1.Query", + method: "Deployment", + deps: [QueryDeploymentRequest, QueryDeploymentResponse] +}); +/** + * Group queries group details + * @name getGroup + * @package akash.deployment.v1beta1 + * @see proto service: akash.deployment.v1beta1.Group + */ +export const getGroup = buildQuery({ + encode: QueryGroupRequest.encode, + decode: QueryGroupResponse.decode, + service: "akash.deployment.v1beta1.Query", + method: "Group", + deps: [QueryGroupRequest, QueryGroupResponse] +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/akash/deployment/v1beta1/query.ts b/__fixtures__/v-next/outputv2/akash/deployment/v1beta1/query.ts index 6f14088b01..134f7d7866 100644 --- a/__fixtures__/v-next/outputv2/akash/deployment/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv2/akash/deployment/v1beta1/query.ts @@ -3,6 +3,7 @@ import { PageRequest, PageRequestAmino, PageRequestSDKType, PageResponse, PageRe import { GroupID, GroupIDAmino, GroupIDSDKType, Group, GroupAmino, GroupSDKType } from "./group"; import { Account, AccountAmino, AccountSDKType } from "../../escrow/v1beta1/types"; import { BinaryReader, BinaryWriter } from "../../../binary"; +import { GlobalDecoderRegistry } from "../../../registry"; import { isSet, DeepPartial } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "akash.deployment.v1beta1"; @@ -242,6 +243,15 @@ function createBaseQueryDeploymentsRequest(): QueryDeploymentsRequest { */ export const QueryDeploymentsRequest = { typeUrl: "/akash.deployment.v1beta1.QueryDeploymentsRequest", + is(o: any): o is QueryDeploymentsRequest { + return o && (o.$typeUrl === QueryDeploymentsRequest.typeUrl || DeploymentFilters.is(o.filters)); + }, + isSDK(o: any): o is QueryDeploymentsRequestSDKType { + return o && (o.$typeUrl === QueryDeploymentsRequest.typeUrl || DeploymentFilters.isSDK(o.filters)); + }, + isAmino(o: any): o is QueryDeploymentsRequestAmino { + return o && (o.$typeUrl === QueryDeploymentsRequest.typeUrl || DeploymentFilters.isAmino(o.filters)); + }, encode(message: QueryDeploymentsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.filters !== undefined) { DeploymentFilters.encode(message.filters, writer.uint32(10).fork()).ldelim(); @@ -335,6 +345,13 @@ export const QueryDeploymentsRequest = { typeUrl: "/akash.deployment.v1beta1.QueryDeploymentsRequest", value: QueryDeploymentsRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryDeploymentsRequest.typeUrl)) { + return; + } + DeploymentFilters.registerTypeUrl(); + PageRequest.registerTypeUrl(); } }; function createBaseQueryDeploymentsResponse(): QueryDeploymentsResponse { @@ -351,6 +368,15 @@ function createBaseQueryDeploymentsResponse(): QueryDeploymentsResponse { */ export const QueryDeploymentsResponse = { typeUrl: "/akash.deployment.v1beta1.QueryDeploymentsResponse", + is(o: any): o is QueryDeploymentsResponse { + return o && (o.$typeUrl === QueryDeploymentsResponse.typeUrl || Array.isArray(o.deployments) && (!o.deployments.length || QueryDeploymentResponse.is(o.deployments[0]))); + }, + isSDK(o: any): o is QueryDeploymentsResponseSDKType { + return o && (o.$typeUrl === QueryDeploymentsResponse.typeUrl || Array.isArray(o.deployments) && (!o.deployments.length || QueryDeploymentResponse.isSDK(o.deployments[0]))); + }, + isAmino(o: any): o is QueryDeploymentsResponseAmino { + return o && (o.$typeUrl === QueryDeploymentsResponse.typeUrl || Array.isArray(o.deployments) && (!o.deployments.length || QueryDeploymentResponse.isAmino(o.deployments[0]))); + }, encode(message: QueryDeploymentsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.deployments) { QueryDeploymentResponse.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -452,6 +478,13 @@ export const QueryDeploymentsResponse = { typeUrl: "/akash.deployment.v1beta1.QueryDeploymentsResponse", value: QueryDeploymentsResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryDeploymentsResponse.typeUrl)) { + return; + } + QueryDeploymentResponse.registerTypeUrl(); + PageResponse.registerTypeUrl(); } }; function createBaseQueryDeploymentRequest(): QueryDeploymentRequest { @@ -467,6 +500,15 @@ function createBaseQueryDeploymentRequest(): QueryDeploymentRequest { */ export const QueryDeploymentRequest = { typeUrl: "/akash.deployment.v1beta1.QueryDeploymentRequest", + is(o: any): o is QueryDeploymentRequest { + return o && (o.$typeUrl === QueryDeploymentRequest.typeUrl || DeploymentID.is(o.id)); + }, + isSDK(o: any): o is QueryDeploymentRequestSDKType { + return o && (o.$typeUrl === QueryDeploymentRequest.typeUrl || DeploymentID.isSDK(o.id)); + }, + isAmino(o: any): o is QueryDeploymentRequestAmino { + return o && (o.$typeUrl === QueryDeploymentRequest.typeUrl || DeploymentID.isAmino(o.id)); + }, encode(message: QueryDeploymentRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.id !== undefined) { DeploymentID.encode(message.id, writer.uint32(10).fork()).ldelim(); @@ -543,6 +585,12 @@ export const QueryDeploymentRequest = { typeUrl: "/akash.deployment.v1beta1.QueryDeploymentRequest", value: QueryDeploymentRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryDeploymentRequest.typeUrl)) { + return; + } + DeploymentID.registerTypeUrl(); } }; function createBaseQueryDeploymentResponse(): QueryDeploymentResponse { @@ -560,6 +608,15 @@ function createBaseQueryDeploymentResponse(): QueryDeploymentResponse { */ export const QueryDeploymentResponse = { typeUrl: "/akash.deployment.v1beta1.QueryDeploymentResponse", + is(o: any): o is QueryDeploymentResponse { + return o && (o.$typeUrl === QueryDeploymentResponse.typeUrl || Deployment.is(o.deployment) && Array.isArray(o.groups) && (!o.groups.length || Group.is(o.groups[0])) && Account.is(o.escrowAccount)); + }, + isSDK(o: any): o is QueryDeploymentResponseSDKType { + return o && (o.$typeUrl === QueryDeploymentResponse.typeUrl || Deployment.isSDK(o.deployment) && Array.isArray(o.groups) && (!o.groups.length || Group.isSDK(o.groups[0])) && Account.isSDK(o.escrow_account)); + }, + isAmino(o: any): o is QueryDeploymentResponseAmino { + return o && (o.$typeUrl === QueryDeploymentResponse.typeUrl || Deployment.isAmino(o.deployment) && Array.isArray(o.groups) && (!o.groups.length || Group.isAmino(o.groups[0])) && Account.isAmino(o.escrow_account)); + }, encode(message: QueryDeploymentResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.deployment !== undefined) { Deployment.encode(message.deployment, writer.uint32(10).fork()).ldelim(); @@ -678,6 +735,14 @@ export const QueryDeploymentResponse = { typeUrl: "/akash.deployment.v1beta1.QueryDeploymentResponse", value: QueryDeploymentResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryDeploymentResponse.typeUrl)) { + return; + } + Deployment.registerTypeUrl(); + Group.registerTypeUrl(); + Account.registerTypeUrl(); } }; function createBaseQueryGroupRequest(): QueryGroupRequest { @@ -693,6 +758,15 @@ function createBaseQueryGroupRequest(): QueryGroupRequest { */ export const QueryGroupRequest = { typeUrl: "/akash.deployment.v1beta1.QueryGroupRequest", + is(o: any): o is QueryGroupRequest { + return o && (o.$typeUrl === QueryGroupRequest.typeUrl || GroupID.is(o.id)); + }, + isSDK(o: any): o is QueryGroupRequestSDKType { + return o && (o.$typeUrl === QueryGroupRequest.typeUrl || GroupID.isSDK(o.id)); + }, + isAmino(o: any): o is QueryGroupRequestAmino { + return o && (o.$typeUrl === QueryGroupRequest.typeUrl || GroupID.isAmino(o.id)); + }, encode(message: QueryGroupRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.id !== undefined) { GroupID.encode(message.id, writer.uint32(10).fork()).ldelim(); @@ -769,6 +843,12 @@ export const QueryGroupRequest = { typeUrl: "/akash.deployment.v1beta1.QueryGroupRequest", value: QueryGroupRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryGroupRequest.typeUrl)) { + return; + } + GroupID.registerTypeUrl(); } }; function createBaseQueryGroupResponse(): QueryGroupResponse { @@ -784,6 +864,15 @@ function createBaseQueryGroupResponse(): QueryGroupResponse { */ export const QueryGroupResponse = { typeUrl: "/akash.deployment.v1beta1.QueryGroupResponse", + is(o: any): o is QueryGroupResponse { + return o && (o.$typeUrl === QueryGroupResponse.typeUrl || Group.is(o.group)); + }, + isSDK(o: any): o is QueryGroupResponseSDKType { + return o && (o.$typeUrl === QueryGroupResponse.typeUrl || Group.isSDK(o.group)); + }, + isAmino(o: any): o is QueryGroupResponseAmino { + return o && (o.$typeUrl === QueryGroupResponse.typeUrl || Group.isAmino(o.group)); + }, encode(message: QueryGroupResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.group !== undefined) { Group.encode(message.group, writer.uint32(10).fork()).ldelim(); @@ -860,5 +949,11 @@ export const QueryGroupResponse = { typeUrl: "/akash.deployment.v1beta1.QueryGroupResponse", value: QueryGroupResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryGroupResponse.typeUrl)) { + return; + } + Group.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/akash/deployment/v1beta2/authz.ts b/__fixtures__/v-next/outputv2/akash/deployment/v1beta2/authz.ts index 90f9b3a7fa..a9d304af26 100644 --- a/__fixtures__/v-next/outputv2/akash/deployment/v1beta2/authz.ts +++ b/__fixtures__/v-next/outputv2/akash/deployment/v1beta2/authz.ts @@ -1,5 +1,6 @@ import { Coin, CoinAmino, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; +import { GlobalDecoderRegistry } from "../../../registry"; import { isSet, DeepPartial } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "akash.deployment.v1beta2"; @@ -66,6 +67,15 @@ function createBaseDepositDeploymentAuthorization(): DepositDeploymentAuthorizat */ export const DepositDeploymentAuthorization = { typeUrl: "/akash.deployment.v1beta2.DepositDeploymentAuthorization", + is(o: any): o is DepositDeploymentAuthorization { + return o && (o.$typeUrl === DepositDeploymentAuthorization.typeUrl || Coin.is(o.spendLimit)); + }, + isSDK(o: any): o is DepositDeploymentAuthorizationSDKType { + return o && (o.$typeUrl === DepositDeploymentAuthorization.typeUrl || Coin.isSDK(o.spend_limit)); + }, + isAmino(o: any): o is DepositDeploymentAuthorizationAmino { + return o && (o.$typeUrl === DepositDeploymentAuthorization.typeUrl || Coin.isAmino(o.spend_limit)); + }, encode(message: DepositDeploymentAuthorization, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.spendLimit !== undefined) { Coin.encode(message.spendLimit, writer.uint32(10).fork()).ldelim(); @@ -142,5 +152,12 @@ export const DepositDeploymentAuthorization = { typeUrl: "/akash.deployment.v1beta2.DepositDeploymentAuthorization", value: DepositDeploymentAuthorization.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(DepositDeploymentAuthorization.typeUrl)) { + return; + } + GlobalDecoderRegistry.register(DepositDeploymentAuthorization.typeUrl, DepositDeploymentAuthorization); + Coin.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/akash/deployment/v1beta2/deployment.ts b/__fixtures__/v-next/outputv2/akash/deployment/v1beta2/deployment.ts index 26b16d2bea..258678ef64 100644 --- a/__fixtures__/v-next/outputv2/akash/deployment/v1beta2/deployment.ts +++ b/__fixtures__/v-next/outputv2/akash/deployment/v1beta2/deployment.ts @@ -1,6 +1,7 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "akash.deployment.v1beta2"; /** State is an enum which refers to state of deployment */ export enum Deployment_State { @@ -181,6 +182,15 @@ function createBaseDeploymentID(): DeploymentID { */ export const DeploymentID = { typeUrl: "/akash.deployment.v1beta2.DeploymentID", + is(o: any): o is DeploymentID { + return o && (o.$typeUrl === DeploymentID.typeUrl || typeof o.owner === "string" && typeof o.dseq === "bigint"); + }, + isSDK(o: any): o is DeploymentIDSDKType { + return o && (o.$typeUrl === DeploymentID.typeUrl || typeof o.owner === "string" && typeof o.dseq === "bigint"); + }, + isAmino(o: any): o is DeploymentIDAmino { + return o && (o.$typeUrl === DeploymentID.typeUrl || typeof o.owner === "string" && typeof o.dseq === "bigint"); + }, encode(message: DeploymentID, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.owner !== "") { writer.uint32(10).string(message.owner); @@ -272,7 +282,8 @@ export const DeploymentID = { typeUrl: "/akash.deployment.v1beta2.DeploymentID", value: DeploymentID.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseDeployment(): Deployment { return { @@ -290,6 +301,15 @@ function createBaseDeployment(): Deployment { */ export const Deployment = { typeUrl: "/akash.deployment.v1beta2.Deployment", + is(o: any): o is Deployment { + return o && (o.$typeUrl === Deployment.typeUrl || DeploymentID.is(o.deploymentId) && isSet(o.state) && (o.version instanceof Uint8Array || typeof o.version === "string") && typeof o.createdAt === "bigint"); + }, + isSDK(o: any): o is DeploymentSDKType { + return o && (o.$typeUrl === Deployment.typeUrl || DeploymentID.isSDK(o.deployment_id) && isSet(o.state) && (o.version instanceof Uint8Array || typeof o.version === "string") && typeof o.created_at === "bigint"); + }, + isAmino(o: any): o is DeploymentAmino { + return o && (o.$typeUrl === Deployment.typeUrl || DeploymentID.isAmino(o.deployment_id) && isSet(o.state) && (o.version instanceof Uint8Array || typeof o.version === "string") && typeof o.created_at === "bigint"); + }, encode(message: Deployment, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.deploymentId !== undefined) { DeploymentID.encode(message.deploymentId, writer.uint32(10).fork()).ldelim(); @@ -413,6 +433,12 @@ export const Deployment = { typeUrl: "/akash.deployment.v1beta2.Deployment", value: Deployment.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Deployment.typeUrl)) { + return; + } + DeploymentID.registerTypeUrl(); } }; function createBaseDeploymentFilters(): DeploymentFilters { @@ -430,6 +456,15 @@ function createBaseDeploymentFilters(): DeploymentFilters { */ export const DeploymentFilters = { typeUrl: "/akash.deployment.v1beta2.DeploymentFilters", + is(o: any): o is DeploymentFilters { + return o && (o.$typeUrl === DeploymentFilters.typeUrl || typeof o.owner === "string" && typeof o.dseq === "bigint" && typeof o.state === "string"); + }, + isSDK(o: any): o is DeploymentFiltersSDKType { + return o && (o.$typeUrl === DeploymentFilters.typeUrl || typeof o.owner === "string" && typeof o.dseq === "bigint" && typeof o.state === "string"); + }, + isAmino(o: any): o is DeploymentFiltersAmino { + return o && (o.$typeUrl === DeploymentFilters.typeUrl || typeof o.owner === "string" && typeof o.dseq === "bigint" && typeof o.state === "string"); + }, encode(message: DeploymentFilters, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.owner !== "") { writer.uint32(10).string(message.owner); @@ -536,5 +571,6 @@ export const DeploymentFilters = { typeUrl: "/akash.deployment.v1beta2.DeploymentFilters", value: DeploymentFilters.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/akash/deployment/v1beta2/deploymentmsg.ts b/__fixtures__/v-next/outputv2/akash/deployment/v1beta2/deploymentmsg.ts index 4dbec67bc6..7bbf1ed70f 100644 --- a/__fixtures__/v-next/outputv2/akash/deployment/v1beta2/deploymentmsg.ts +++ b/__fixtures__/v-next/outputv2/akash/deployment/v1beta2/deploymentmsg.ts @@ -2,6 +2,7 @@ import { DeploymentID, DeploymentIDAmino, DeploymentIDSDKType } from "./deployme import { GroupSpec, GroupSpecAmino, GroupSpecSDKType } from "./groupspec"; import { Coin, CoinAmino, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; +import { GlobalDecoderRegistry } from "../../../registry"; import { isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "akash.deployment.v1beta2"; @@ -311,6 +312,15 @@ function createBaseMsgCreateDeployment(): MsgCreateDeployment { */ export const MsgCreateDeployment = { typeUrl: "/akash.deployment.v1beta2.MsgCreateDeployment", + is(o: any): o is MsgCreateDeployment { + return o && (o.$typeUrl === MsgCreateDeployment.typeUrl || DeploymentID.is(o.id) && Array.isArray(o.groups) && (!o.groups.length || GroupSpec.is(o.groups[0])) && (o.version instanceof Uint8Array || typeof o.version === "string") && Coin.is(o.deposit) && typeof o.depositor === "string"); + }, + isSDK(o: any): o is MsgCreateDeploymentSDKType { + return o && (o.$typeUrl === MsgCreateDeployment.typeUrl || DeploymentID.isSDK(o.id) && Array.isArray(o.groups) && (!o.groups.length || GroupSpec.isSDK(o.groups[0])) && (o.version instanceof Uint8Array || typeof o.version === "string") && Coin.isSDK(o.deposit) && typeof o.depositor === "string"); + }, + isAmino(o: any): o is MsgCreateDeploymentAmino { + return o && (o.$typeUrl === MsgCreateDeployment.typeUrl || DeploymentID.isAmino(o.id) && Array.isArray(o.groups) && (!o.groups.length || GroupSpec.isAmino(o.groups[0])) && (o.version instanceof Uint8Array || typeof o.version === "string") && Coin.isAmino(o.deposit) && typeof o.depositor === "string"); + }, encode(message: MsgCreateDeployment, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.id !== undefined) { DeploymentID.encode(message.id, writer.uint32(10).fork()).ldelim(); @@ -459,6 +469,14 @@ export const MsgCreateDeployment = { typeUrl: "/akash.deployment.v1beta2.MsgCreateDeployment", value: MsgCreateDeployment.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgCreateDeployment.typeUrl)) { + return; + } + DeploymentID.registerTypeUrl(); + GroupSpec.registerTypeUrl(); + Coin.registerTypeUrl(); } }; function createBaseMsgCreateDeploymentResponse(): MsgCreateDeploymentResponse { @@ -472,6 +490,15 @@ function createBaseMsgCreateDeploymentResponse(): MsgCreateDeploymentResponse { */ export const MsgCreateDeploymentResponse = { typeUrl: "/akash.deployment.v1beta2.MsgCreateDeploymentResponse", + is(o: any): o is MsgCreateDeploymentResponse { + return o && o.$typeUrl === MsgCreateDeploymentResponse.typeUrl; + }, + isSDK(o: any): o is MsgCreateDeploymentResponseSDKType { + return o && o.$typeUrl === MsgCreateDeploymentResponse.typeUrl; + }, + isAmino(o: any): o is MsgCreateDeploymentResponseAmino { + return o && o.$typeUrl === MsgCreateDeploymentResponse.typeUrl; + }, encode(_: MsgCreateDeploymentResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -530,7 +557,8 @@ export const MsgCreateDeploymentResponse = { typeUrl: "/akash.deployment.v1beta2.MsgCreateDeploymentResponse", value: MsgCreateDeploymentResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgDepositDeployment(): MsgDepositDeployment { return { @@ -547,6 +575,15 @@ function createBaseMsgDepositDeployment(): MsgDepositDeployment { */ export const MsgDepositDeployment = { typeUrl: "/akash.deployment.v1beta2.MsgDepositDeployment", + is(o: any): o is MsgDepositDeployment { + return o && (o.$typeUrl === MsgDepositDeployment.typeUrl || DeploymentID.is(o.id) && Coin.is(o.amount) && typeof o.depositor === "string"); + }, + isSDK(o: any): o is MsgDepositDeploymentSDKType { + return o && (o.$typeUrl === MsgDepositDeployment.typeUrl || DeploymentID.isSDK(o.id) && Coin.isSDK(o.amount) && typeof o.depositor === "string"); + }, + isAmino(o: any): o is MsgDepositDeploymentAmino { + return o && (o.$typeUrl === MsgDepositDeployment.typeUrl || DeploymentID.isAmino(o.id) && Coin.isAmino(o.amount) && typeof o.depositor === "string"); + }, encode(message: MsgDepositDeployment, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.id !== undefined) { DeploymentID.encode(message.id, writer.uint32(10).fork()).ldelim(); @@ -655,6 +692,13 @@ export const MsgDepositDeployment = { typeUrl: "/akash.deployment.v1beta2.MsgDepositDeployment", value: MsgDepositDeployment.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgDepositDeployment.typeUrl)) { + return; + } + DeploymentID.registerTypeUrl(); + Coin.registerTypeUrl(); } }; function createBaseMsgDepositDeploymentResponse(): MsgDepositDeploymentResponse { @@ -668,6 +712,15 @@ function createBaseMsgDepositDeploymentResponse(): MsgDepositDeploymentResponse */ export const MsgDepositDeploymentResponse = { typeUrl: "/akash.deployment.v1beta2.MsgDepositDeploymentResponse", + is(o: any): o is MsgDepositDeploymentResponse { + return o && o.$typeUrl === MsgDepositDeploymentResponse.typeUrl; + }, + isSDK(o: any): o is MsgDepositDeploymentResponseSDKType { + return o && o.$typeUrl === MsgDepositDeploymentResponse.typeUrl; + }, + isAmino(o: any): o is MsgDepositDeploymentResponseAmino { + return o && o.$typeUrl === MsgDepositDeploymentResponse.typeUrl; + }, encode(_: MsgDepositDeploymentResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -726,7 +779,8 @@ export const MsgDepositDeploymentResponse = { typeUrl: "/akash.deployment.v1beta2.MsgDepositDeploymentResponse", value: MsgDepositDeploymentResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgUpdateDeployment(): MsgUpdateDeployment { return { @@ -742,6 +796,15 @@ function createBaseMsgUpdateDeployment(): MsgUpdateDeployment { */ export const MsgUpdateDeployment = { typeUrl: "/akash.deployment.v1beta2.MsgUpdateDeployment", + is(o: any): o is MsgUpdateDeployment { + return o && (o.$typeUrl === MsgUpdateDeployment.typeUrl || DeploymentID.is(o.id) && (o.version instanceof Uint8Array || typeof o.version === "string")); + }, + isSDK(o: any): o is MsgUpdateDeploymentSDKType { + return o && (o.$typeUrl === MsgUpdateDeployment.typeUrl || DeploymentID.isSDK(o.id) && (o.version instanceof Uint8Array || typeof o.version === "string")); + }, + isAmino(o: any): o is MsgUpdateDeploymentAmino { + return o && (o.$typeUrl === MsgUpdateDeployment.typeUrl || DeploymentID.isAmino(o.id) && (o.version instanceof Uint8Array || typeof o.version === "string")); + }, encode(message: MsgUpdateDeployment, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.id !== undefined) { DeploymentID.encode(message.id, writer.uint32(10).fork()).ldelim(); @@ -833,6 +896,12 @@ export const MsgUpdateDeployment = { typeUrl: "/akash.deployment.v1beta2.MsgUpdateDeployment", value: MsgUpdateDeployment.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgUpdateDeployment.typeUrl)) { + return; + } + DeploymentID.registerTypeUrl(); } }; function createBaseMsgUpdateDeploymentResponse(): MsgUpdateDeploymentResponse { @@ -846,6 +915,15 @@ function createBaseMsgUpdateDeploymentResponse(): MsgUpdateDeploymentResponse { */ export const MsgUpdateDeploymentResponse = { typeUrl: "/akash.deployment.v1beta2.MsgUpdateDeploymentResponse", + is(o: any): o is MsgUpdateDeploymentResponse { + return o && o.$typeUrl === MsgUpdateDeploymentResponse.typeUrl; + }, + isSDK(o: any): o is MsgUpdateDeploymentResponseSDKType { + return o && o.$typeUrl === MsgUpdateDeploymentResponse.typeUrl; + }, + isAmino(o: any): o is MsgUpdateDeploymentResponseAmino { + return o && o.$typeUrl === MsgUpdateDeploymentResponse.typeUrl; + }, encode(_: MsgUpdateDeploymentResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -904,7 +982,8 @@ export const MsgUpdateDeploymentResponse = { typeUrl: "/akash.deployment.v1beta2.MsgUpdateDeploymentResponse", value: MsgUpdateDeploymentResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgCloseDeployment(): MsgCloseDeployment { return { @@ -919,6 +998,15 @@ function createBaseMsgCloseDeployment(): MsgCloseDeployment { */ export const MsgCloseDeployment = { typeUrl: "/akash.deployment.v1beta2.MsgCloseDeployment", + is(o: any): o is MsgCloseDeployment { + return o && (o.$typeUrl === MsgCloseDeployment.typeUrl || DeploymentID.is(o.id)); + }, + isSDK(o: any): o is MsgCloseDeploymentSDKType { + return o && (o.$typeUrl === MsgCloseDeployment.typeUrl || DeploymentID.isSDK(o.id)); + }, + isAmino(o: any): o is MsgCloseDeploymentAmino { + return o && (o.$typeUrl === MsgCloseDeployment.typeUrl || DeploymentID.isAmino(o.id)); + }, encode(message: MsgCloseDeployment, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.id !== undefined) { DeploymentID.encode(message.id, writer.uint32(10).fork()).ldelim(); @@ -995,6 +1083,12 @@ export const MsgCloseDeployment = { typeUrl: "/akash.deployment.v1beta2.MsgCloseDeployment", value: MsgCloseDeployment.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgCloseDeployment.typeUrl)) { + return; + } + DeploymentID.registerTypeUrl(); } }; function createBaseMsgCloseDeploymentResponse(): MsgCloseDeploymentResponse { @@ -1008,6 +1102,15 @@ function createBaseMsgCloseDeploymentResponse(): MsgCloseDeploymentResponse { */ export const MsgCloseDeploymentResponse = { typeUrl: "/akash.deployment.v1beta2.MsgCloseDeploymentResponse", + is(o: any): o is MsgCloseDeploymentResponse { + return o && o.$typeUrl === MsgCloseDeploymentResponse.typeUrl; + }, + isSDK(o: any): o is MsgCloseDeploymentResponseSDKType { + return o && o.$typeUrl === MsgCloseDeploymentResponse.typeUrl; + }, + isAmino(o: any): o is MsgCloseDeploymentResponseAmino { + return o && o.$typeUrl === MsgCloseDeploymentResponse.typeUrl; + }, encode(_: MsgCloseDeploymentResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -1066,5 +1169,6 @@ export const MsgCloseDeploymentResponse = { typeUrl: "/akash.deployment.v1beta2.MsgCloseDeploymentResponse", value: MsgCloseDeploymentResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/akash/deployment/v1beta2/genesis.ts b/__fixtures__/v-next/outputv2/akash/deployment/v1beta2/genesis.ts index 85f1500b4a..f9ce641ac9 100644 --- a/__fixtures__/v-next/outputv2/akash/deployment/v1beta2/genesis.ts +++ b/__fixtures__/v-next/outputv2/akash/deployment/v1beta2/genesis.ts @@ -2,6 +2,7 @@ import { Deployment, DeploymentAmino, DeploymentSDKType } from "./deployment"; import { Group, GroupAmino, GroupSDKType } from "./group"; import { Params, ParamsAmino, ParamsSDKType } from "./params"; import { BinaryReader, BinaryWriter } from "../../../binary"; +import { GlobalDecoderRegistry } from "../../../registry"; import { isSet, DeepPartial } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "akash.deployment.v1beta2"; @@ -95,6 +96,15 @@ function createBaseGenesisDeployment(): GenesisDeployment { */ export const GenesisDeployment = { typeUrl: "/akash.deployment.v1beta2.GenesisDeployment", + is(o: any): o is GenesisDeployment { + return o && (o.$typeUrl === GenesisDeployment.typeUrl || Deployment.is(o.deployment) && Array.isArray(o.groups) && (!o.groups.length || Group.is(o.groups[0]))); + }, + isSDK(o: any): o is GenesisDeploymentSDKType { + return o && (o.$typeUrl === GenesisDeployment.typeUrl || Deployment.isSDK(o.deployment) && Array.isArray(o.groups) && (!o.groups.length || Group.isSDK(o.groups[0]))); + }, + isAmino(o: any): o is GenesisDeploymentAmino { + return o && (o.$typeUrl === GenesisDeployment.typeUrl || Deployment.isAmino(o.deployment) && Array.isArray(o.groups) && (!o.groups.length || Group.isAmino(o.groups[0]))); + }, encode(message: GenesisDeployment, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.deployment !== undefined) { Deployment.encode(message.deployment, writer.uint32(10).fork()).ldelim(); @@ -196,6 +206,13 @@ export const GenesisDeployment = { typeUrl: "/akash.deployment.v1beta2.GenesisDeployment", value: GenesisDeployment.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GenesisDeployment.typeUrl)) { + return; + } + Deployment.registerTypeUrl(); + Group.registerTypeUrl(); } }; function createBaseGenesisState(): GenesisState { @@ -212,6 +229,15 @@ function createBaseGenesisState(): GenesisState { */ export const GenesisState = { typeUrl: "/akash.deployment.v1beta2.GenesisState", + is(o: any): o is GenesisState { + return o && (o.$typeUrl === GenesisState.typeUrl || Array.isArray(o.deployments) && (!o.deployments.length || GenesisDeployment.is(o.deployments[0])) && Params.is(o.params)); + }, + isSDK(o: any): o is GenesisStateSDKType { + return o && (o.$typeUrl === GenesisState.typeUrl || Array.isArray(o.deployments) && (!o.deployments.length || GenesisDeployment.isSDK(o.deployments[0])) && Params.isSDK(o.params)); + }, + isAmino(o: any): o is GenesisStateAmino { + return o && (o.$typeUrl === GenesisState.typeUrl || Array.isArray(o.deployments) && (!o.deployments.length || GenesisDeployment.isAmino(o.deployments[0])) && Params.isAmino(o.params)); + }, encode(message: GenesisState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.deployments) { GenesisDeployment.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -313,5 +339,12 @@ export const GenesisState = { typeUrl: "/akash.deployment.v1beta2.GenesisState", value: GenesisState.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GenesisState.typeUrl)) { + return; + } + GenesisDeployment.registerTypeUrl(); + Params.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/akash/deployment/v1beta2/group.ts b/__fixtures__/v-next/outputv2/akash/deployment/v1beta2/group.ts index 75d93a03e1..e853735522 100644 --- a/__fixtures__/v-next/outputv2/akash/deployment/v1beta2/group.ts +++ b/__fixtures__/v-next/outputv2/akash/deployment/v1beta2/group.ts @@ -1,7 +1,8 @@ import { GroupID, GroupIDAmino, GroupIDSDKType } from "./groupid"; import { GroupSpec, GroupSpecAmino, GroupSpecSDKType } from "./groupspec"; -import { BinaryReader, BinaryWriter } from "../../../binary"; import { isSet, DeepPartial } from "../../../helpers"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { GlobalDecoderRegistry } from "../../../registry"; import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "akash.deployment.v1beta2"; /** State is an enum which refers to state of group */ @@ -120,6 +121,15 @@ function createBaseGroup(): Group { */ export const Group = { typeUrl: "/akash.deployment.v1beta2.Group", + is(o: any): o is Group { + return o && (o.$typeUrl === Group.typeUrl || GroupID.is(o.groupId) && isSet(o.state) && GroupSpec.is(o.groupSpec) && typeof o.createdAt === "bigint"); + }, + isSDK(o: any): o is GroupSDKType { + return o && (o.$typeUrl === Group.typeUrl || GroupID.isSDK(o.group_id) && isSet(o.state) && GroupSpec.isSDK(o.group_spec) && typeof o.created_at === "bigint"); + }, + isAmino(o: any): o is GroupAmino { + return o && (o.$typeUrl === Group.typeUrl || GroupID.isAmino(o.group_id) && isSet(o.state) && GroupSpec.isAmino(o.group_spec) && typeof o.created_at === "bigint"); + }, encode(message: Group, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.groupId !== undefined) { GroupID.encode(message.groupId, writer.uint32(10).fork()).ldelim(); @@ -245,5 +255,12 @@ export const Group = { typeUrl: "/akash.deployment.v1beta2.Group", value: Group.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Group.typeUrl)) { + return; + } + GroupID.registerTypeUrl(); + GroupSpec.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/akash/deployment/v1beta2/groupid.ts b/__fixtures__/v-next/outputv2/akash/deployment/v1beta2/groupid.ts index f547326204..ee7dc5b85f 100644 --- a/__fixtures__/v-next/outputv2/akash/deployment/v1beta2/groupid.ts +++ b/__fixtures__/v-next/outputv2/akash/deployment/v1beta2/groupid.ts @@ -58,6 +58,15 @@ function createBaseGroupID(): GroupID { */ export const GroupID = { typeUrl: "/akash.deployment.v1beta2.GroupID", + is(o: any): o is GroupID { + return o && (o.$typeUrl === GroupID.typeUrl || typeof o.owner === "string" && typeof o.dseq === "bigint" && typeof o.gseq === "number"); + }, + isSDK(o: any): o is GroupIDSDKType { + return o && (o.$typeUrl === GroupID.typeUrl || typeof o.owner === "string" && typeof o.dseq === "bigint" && typeof o.gseq === "number"); + }, + isAmino(o: any): o is GroupIDAmino { + return o && (o.$typeUrl === GroupID.typeUrl || typeof o.owner === "string" && typeof o.dseq === "bigint" && typeof o.gseq === "number"); + }, encode(message: GroupID, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.owner !== "") { writer.uint32(10).string(message.owner); @@ -164,5 +173,6 @@ export const GroupID = { typeUrl: "/akash.deployment.v1beta2.GroupID", value: GroupID.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/akash/deployment/v1beta2/groupmsg.ts b/__fixtures__/v-next/outputv2/akash/deployment/v1beta2/groupmsg.ts index 6d5b36a9dd..43ea519642 100644 --- a/__fixtures__/v-next/outputv2/akash/deployment/v1beta2/groupmsg.ts +++ b/__fixtures__/v-next/outputv2/akash/deployment/v1beta2/groupmsg.ts @@ -1,5 +1,6 @@ import { GroupID, GroupIDAmino, GroupIDSDKType } from "./groupid"; import { BinaryReader, BinaryWriter } from "../../../binary"; +import { GlobalDecoderRegistry } from "../../../registry"; import { isSet, DeepPartial } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "akash.deployment.v1beta2"; @@ -208,6 +209,15 @@ function createBaseMsgCloseGroup(): MsgCloseGroup { */ export const MsgCloseGroup = { typeUrl: "/akash.deployment.v1beta2.MsgCloseGroup", + is(o: any): o is MsgCloseGroup { + return o && (o.$typeUrl === MsgCloseGroup.typeUrl || GroupID.is(o.id)); + }, + isSDK(o: any): o is MsgCloseGroupSDKType { + return o && (o.$typeUrl === MsgCloseGroup.typeUrl || GroupID.isSDK(o.id)); + }, + isAmino(o: any): o is MsgCloseGroupAmino { + return o && (o.$typeUrl === MsgCloseGroup.typeUrl || GroupID.isAmino(o.id)); + }, encode(message: MsgCloseGroup, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.id !== undefined) { GroupID.encode(message.id, writer.uint32(10).fork()).ldelim(); @@ -284,6 +294,12 @@ export const MsgCloseGroup = { typeUrl: "/akash.deployment.v1beta2.MsgCloseGroup", value: MsgCloseGroup.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgCloseGroup.typeUrl)) { + return; + } + GroupID.registerTypeUrl(); } }; function createBaseMsgCloseGroupResponse(): MsgCloseGroupResponse { @@ -297,6 +313,15 @@ function createBaseMsgCloseGroupResponse(): MsgCloseGroupResponse { */ export const MsgCloseGroupResponse = { typeUrl: "/akash.deployment.v1beta2.MsgCloseGroupResponse", + is(o: any): o is MsgCloseGroupResponse { + return o && o.$typeUrl === MsgCloseGroupResponse.typeUrl; + }, + isSDK(o: any): o is MsgCloseGroupResponseSDKType { + return o && o.$typeUrl === MsgCloseGroupResponse.typeUrl; + }, + isAmino(o: any): o is MsgCloseGroupResponseAmino { + return o && o.$typeUrl === MsgCloseGroupResponse.typeUrl; + }, encode(_: MsgCloseGroupResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -355,7 +380,8 @@ export const MsgCloseGroupResponse = { typeUrl: "/akash.deployment.v1beta2.MsgCloseGroupResponse", value: MsgCloseGroupResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgPauseGroup(): MsgPauseGroup { return { @@ -370,6 +396,15 @@ function createBaseMsgPauseGroup(): MsgPauseGroup { */ export const MsgPauseGroup = { typeUrl: "/akash.deployment.v1beta2.MsgPauseGroup", + is(o: any): o is MsgPauseGroup { + return o && (o.$typeUrl === MsgPauseGroup.typeUrl || GroupID.is(o.id)); + }, + isSDK(o: any): o is MsgPauseGroupSDKType { + return o && (o.$typeUrl === MsgPauseGroup.typeUrl || GroupID.isSDK(o.id)); + }, + isAmino(o: any): o is MsgPauseGroupAmino { + return o && (o.$typeUrl === MsgPauseGroup.typeUrl || GroupID.isAmino(o.id)); + }, encode(message: MsgPauseGroup, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.id !== undefined) { GroupID.encode(message.id, writer.uint32(10).fork()).ldelim(); @@ -446,6 +481,12 @@ export const MsgPauseGroup = { typeUrl: "/akash.deployment.v1beta2.MsgPauseGroup", value: MsgPauseGroup.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgPauseGroup.typeUrl)) { + return; + } + GroupID.registerTypeUrl(); } }; function createBaseMsgPauseGroupResponse(): MsgPauseGroupResponse { @@ -459,6 +500,15 @@ function createBaseMsgPauseGroupResponse(): MsgPauseGroupResponse { */ export const MsgPauseGroupResponse = { typeUrl: "/akash.deployment.v1beta2.MsgPauseGroupResponse", + is(o: any): o is MsgPauseGroupResponse { + return o && o.$typeUrl === MsgPauseGroupResponse.typeUrl; + }, + isSDK(o: any): o is MsgPauseGroupResponseSDKType { + return o && o.$typeUrl === MsgPauseGroupResponse.typeUrl; + }, + isAmino(o: any): o is MsgPauseGroupResponseAmino { + return o && o.$typeUrl === MsgPauseGroupResponse.typeUrl; + }, encode(_: MsgPauseGroupResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -517,7 +567,8 @@ export const MsgPauseGroupResponse = { typeUrl: "/akash.deployment.v1beta2.MsgPauseGroupResponse", value: MsgPauseGroupResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgStartGroup(): MsgStartGroup { return { @@ -532,6 +583,15 @@ function createBaseMsgStartGroup(): MsgStartGroup { */ export const MsgStartGroup = { typeUrl: "/akash.deployment.v1beta2.MsgStartGroup", + is(o: any): o is MsgStartGroup { + return o && (o.$typeUrl === MsgStartGroup.typeUrl || GroupID.is(o.id)); + }, + isSDK(o: any): o is MsgStartGroupSDKType { + return o && (o.$typeUrl === MsgStartGroup.typeUrl || GroupID.isSDK(o.id)); + }, + isAmino(o: any): o is MsgStartGroupAmino { + return o && (o.$typeUrl === MsgStartGroup.typeUrl || GroupID.isAmino(o.id)); + }, encode(message: MsgStartGroup, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.id !== undefined) { GroupID.encode(message.id, writer.uint32(10).fork()).ldelim(); @@ -608,6 +668,12 @@ export const MsgStartGroup = { typeUrl: "/akash.deployment.v1beta2.MsgStartGroup", value: MsgStartGroup.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgStartGroup.typeUrl)) { + return; + } + GroupID.registerTypeUrl(); } }; function createBaseMsgStartGroupResponse(): MsgStartGroupResponse { @@ -621,6 +687,15 @@ function createBaseMsgStartGroupResponse(): MsgStartGroupResponse { */ export const MsgStartGroupResponse = { typeUrl: "/akash.deployment.v1beta2.MsgStartGroupResponse", + is(o: any): o is MsgStartGroupResponse { + return o && o.$typeUrl === MsgStartGroupResponse.typeUrl; + }, + isSDK(o: any): o is MsgStartGroupResponseSDKType { + return o && o.$typeUrl === MsgStartGroupResponse.typeUrl; + }, + isAmino(o: any): o is MsgStartGroupResponseAmino { + return o && o.$typeUrl === MsgStartGroupResponse.typeUrl; + }, encode(_: MsgStartGroupResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -679,5 +754,6 @@ export const MsgStartGroupResponse = { typeUrl: "/akash.deployment.v1beta2.MsgStartGroupResponse", value: MsgStartGroupResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/akash/deployment/v1beta2/groupspec.ts b/__fixtures__/v-next/outputv2/akash/deployment/v1beta2/groupspec.ts index 1ba21a3b13..c3337f46d3 100644 --- a/__fixtures__/v-next/outputv2/akash/deployment/v1beta2/groupspec.ts +++ b/__fixtures__/v-next/outputv2/akash/deployment/v1beta2/groupspec.ts @@ -1,6 +1,7 @@ import { PlacementRequirements, PlacementRequirementsAmino, PlacementRequirementsSDKType } from "../../base/v1beta2/attribute"; import { Resource, ResourceAmino, ResourceSDKType } from "./resource"; import { BinaryReader, BinaryWriter } from "../../../binary"; +import { GlobalDecoderRegistry } from "../../../registry"; import { isSet, DeepPartial } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "akash.deployment.v1beta2"; @@ -60,6 +61,15 @@ function createBaseGroupSpec(): GroupSpec { */ export const GroupSpec = { typeUrl: "/akash.deployment.v1beta2.GroupSpec", + is(o: any): o is GroupSpec { + return o && (o.$typeUrl === GroupSpec.typeUrl || typeof o.name === "string" && PlacementRequirements.is(o.requirements) && Array.isArray(o.resources) && (!o.resources.length || Resource.is(o.resources[0]))); + }, + isSDK(o: any): o is GroupSpecSDKType { + return o && (o.$typeUrl === GroupSpec.typeUrl || typeof o.name === "string" && PlacementRequirements.isSDK(o.requirements) && Array.isArray(o.resources) && (!o.resources.length || Resource.isSDK(o.resources[0]))); + }, + isAmino(o: any): o is GroupSpecAmino { + return o && (o.$typeUrl === GroupSpec.typeUrl || typeof o.name === "string" && PlacementRequirements.isAmino(o.requirements) && Array.isArray(o.resources) && (!o.resources.length || Resource.isAmino(o.resources[0]))); + }, encode(message: GroupSpec, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -176,5 +186,12 @@ export const GroupSpec = { typeUrl: "/akash.deployment.v1beta2.GroupSpec", value: GroupSpec.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GroupSpec.typeUrl)) { + return; + } + PlacementRequirements.registerTypeUrl(); + Resource.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/akash/deployment/v1beta2/params.ts b/__fixtures__/v-next/outputv2/akash/deployment/v1beta2/params.ts index 0db8cf0e0e..cb9db731ef 100644 --- a/__fixtures__/v-next/outputv2/akash/deployment/v1beta2/params.ts +++ b/__fixtures__/v-next/outputv2/akash/deployment/v1beta2/params.ts @@ -1,5 +1,6 @@ import { Coin, CoinAmino, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; +import { GlobalDecoderRegistry } from "../../../registry"; import { isSet, DeepPartial } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "akash.deployment.v1beta2"; @@ -51,6 +52,15 @@ function createBaseParams(): Params { */ export const Params = { typeUrl: "/akash.deployment.v1beta2.Params", + is(o: any): o is Params { + return o && (o.$typeUrl === Params.typeUrl || Coin.is(o.deploymentMinDeposit)); + }, + isSDK(o: any): o is ParamsSDKType { + return o && (o.$typeUrl === Params.typeUrl || Coin.isSDK(o.deployment_min_deposit)); + }, + isAmino(o: any): o is ParamsAmino { + return o && (o.$typeUrl === Params.typeUrl || Coin.isAmino(o.deployment_min_deposit)); + }, encode(message: Params, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.deploymentMinDeposit !== undefined) { Coin.encode(message.deploymentMinDeposit, writer.uint32(10).fork()).ldelim(); @@ -127,5 +137,11 @@ export const Params = { typeUrl: "/akash.deployment.v1beta2.Params", value: Params.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Params.typeUrl)) { + return; + } + Coin.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/akash/deployment/v1beta2/query.rpc.func.ts b/__fixtures__/v-next/outputv2/akash/deployment/v1beta2/query.rpc.func.ts new file mode 100644 index 0000000000..d5311267bc --- /dev/null +++ b/__fixtures__/v-next/outputv2/akash/deployment/v1beta2/query.rpc.func.ts @@ -0,0 +1,41 @@ +import { buildQuery } from "../../../helper-func-types"; +import { QueryDeploymentsRequest, QueryDeploymentsResponse, QueryDeploymentRequest, QueryDeploymentResponse, QueryGroupRequest, QueryGroupResponse } from "./query"; +/** + * Deployments queries deployments + * @name getDeployments + * @package akash.deployment.v1beta2 + * @see proto service: akash.deployment.v1beta2.Deployments + */ +export const getDeployments = buildQuery({ + encode: QueryDeploymentsRequest.encode, + decode: QueryDeploymentsResponse.decode, + service: "akash.deployment.v1beta2.Query", + method: "Deployments", + deps: [QueryDeploymentsRequest, QueryDeploymentsResponse] +}); +/** + * Deployment queries deployment details + * @name getDeployment + * @package akash.deployment.v1beta2 + * @see proto service: akash.deployment.v1beta2.Deployment + */ +export const getDeployment = buildQuery({ + encode: QueryDeploymentRequest.encode, + decode: QueryDeploymentResponse.decode, + service: "akash.deployment.v1beta2.Query", + method: "Deployment", + deps: [QueryDeploymentRequest, QueryDeploymentResponse] +}); +/** + * Group queries group details + * @name getGroup + * @package akash.deployment.v1beta2 + * @see proto service: akash.deployment.v1beta2.Group + */ +export const getGroup = buildQuery({ + encode: QueryGroupRequest.encode, + decode: QueryGroupResponse.decode, + service: "akash.deployment.v1beta2.Query", + method: "Group", + deps: [QueryGroupRequest, QueryGroupResponse] +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/akash/deployment/v1beta2/query.ts b/__fixtures__/v-next/outputv2/akash/deployment/v1beta2/query.ts index f93ee03a18..9ba66a733e 100644 --- a/__fixtures__/v-next/outputv2/akash/deployment/v1beta2/query.ts +++ b/__fixtures__/v-next/outputv2/akash/deployment/v1beta2/query.ts @@ -4,6 +4,7 @@ import { GroupID, GroupIDAmino, GroupIDSDKType } from "./groupid"; import { Group, GroupAmino, GroupSDKType } from "./group"; import { Account, AccountAmino, AccountSDKType } from "../../escrow/v1beta2/types"; import { BinaryReader, BinaryWriter } from "../../../binary"; +import { GlobalDecoderRegistry } from "../../../registry"; import { isSet, DeepPartial } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "akash.deployment.v1beta2"; @@ -243,6 +244,15 @@ function createBaseQueryDeploymentsRequest(): QueryDeploymentsRequest { */ export const QueryDeploymentsRequest = { typeUrl: "/akash.deployment.v1beta2.QueryDeploymentsRequest", + is(o: any): o is QueryDeploymentsRequest { + return o && (o.$typeUrl === QueryDeploymentsRequest.typeUrl || DeploymentFilters.is(o.filters)); + }, + isSDK(o: any): o is QueryDeploymentsRequestSDKType { + return o && (o.$typeUrl === QueryDeploymentsRequest.typeUrl || DeploymentFilters.isSDK(o.filters)); + }, + isAmino(o: any): o is QueryDeploymentsRequestAmino { + return o && (o.$typeUrl === QueryDeploymentsRequest.typeUrl || DeploymentFilters.isAmino(o.filters)); + }, encode(message: QueryDeploymentsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.filters !== undefined) { DeploymentFilters.encode(message.filters, writer.uint32(10).fork()).ldelim(); @@ -336,6 +346,13 @@ export const QueryDeploymentsRequest = { typeUrl: "/akash.deployment.v1beta2.QueryDeploymentsRequest", value: QueryDeploymentsRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryDeploymentsRequest.typeUrl)) { + return; + } + DeploymentFilters.registerTypeUrl(); + PageRequest.registerTypeUrl(); } }; function createBaseQueryDeploymentsResponse(): QueryDeploymentsResponse { @@ -352,6 +369,15 @@ function createBaseQueryDeploymentsResponse(): QueryDeploymentsResponse { */ export const QueryDeploymentsResponse = { typeUrl: "/akash.deployment.v1beta2.QueryDeploymentsResponse", + is(o: any): o is QueryDeploymentsResponse { + return o && (o.$typeUrl === QueryDeploymentsResponse.typeUrl || Array.isArray(o.deployments) && (!o.deployments.length || QueryDeploymentResponse.is(o.deployments[0]))); + }, + isSDK(o: any): o is QueryDeploymentsResponseSDKType { + return o && (o.$typeUrl === QueryDeploymentsResponse.typeUrl || Array.isArray(o.deployments) && (!o.deployments.length || QueryDeploymentResponse.isSDK(o.deployments[0]))); + }, + isAmino(o: any): o is QueryDeploymentsResponseAmino { + return o && (o.$typeUrl === QueryDeploymentsResponse.typeUrl || Array.isArray(o.deployments) && (!o.deployments.length || QueryDeploymentResponse.isAmino(o.deployments[0]))); + }, encode(message: QueryDeploymentsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.deployments) { QueryDeploymentResponse.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -453,6 +479,13 @@ export const QueryDeploymentsResponse = { typeUrl: "/akash.deployment.v1beta2.QueryDeploymentsResponse", value: QueryDeploymentsResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryDeploymentsResponse.typeUrl)) { + return; + } + QueryDeploymentResponse.registerTypeUrl(); + PageResponse.registerTypeUrl(); } }; function createBaseQueryDeploymentRequest(): QueryDeploymentRequest { @@ -468,6 +501,15 @@ function createBaseQueryDeploymentRequest(): QueryDeploymentRequest { */ export const QueryDeploymentRequest = { typeUrl: "/akash.deployment.v1beta2.QueryDeploymentRequest", + is(o: any): o is QueryDeploymentRequest { + return o && (o.$typeUrl === QueryDeploymentRequest.typeUrl || DeploymentID.is(o.id)); + }, + isSDK(o: any): o is QueryDeploymentRequestSDKType { + return o && (o.$typeUrl === QueryDeploymentRequest.typeUrl || DeploymentID.isSDK(o.id)); + }, + isAmino(o: any): o is QueryDeploymentRequestAmino { + return o && (o.$typeUrl === QueryDeploymentRequest.typeUrl || DeploymentID.isAmino(o.id)); + }, encode(message: QueryDeploymentRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.id !== undefined) { DeploymentID.encode(message.id, writer.uint32(10).fork()).ldelim(); @@ -544,6 +586,12 @@ export const QueryDeploymentRequest = { typeUrl: "/akash.deployment.v1beta2.QueryDeploymentRequest", value: QueryDeploymentRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryDeploymentRequest.typeUrl)) { + return; + } + DeploymentID.registerTypeUrl(); } }; function createBaseQueryDeploymentResponse(): QueryDeploymentResponse { @@ -561,6 +609,15 @@ function createBaseQueryDeploymentResponse(): QueryDeploymentResponse { */ export const QueryDeploymentResponse = { typeUrl: "/akash.deployment.v1beta2.QueryDeploymentResponse", + is(o: any): o is QueryDeploymentResponse { + return o && (o.$typeUrl === QueryDeploymentResponse.typeUrl || Deployment.is(o.deployment) && Array.isArray(o.groups) && (!o.groups.length || Group.is(o.groups[0])) && Account.is(o.escrowAccount)); + }, + isSDK(o: any): o is QueryDeploymentResponseSDKType { + return o && (o.$typeUrl === QueryDeploymentResponse.typeUrl || Deployment.isSDK(o.deployment) && Array.isArray(o.groups) && (!o.groups.length || Group.isSDK(o.groups[0])) && Account.isSDK(o.escrow_account)); + }, + isAmino(o: any): o is QueryDeploymentResponseAmino { + return o && (o.$typeUrl === QueryDeploymentResponse.typeUrl || Deployment.isAmino(o.deployment) && Array.isArray(o.groups) && (!o.groups.length || Group.isAmino(o.groups[0])) && Account.isAmino(o.escrow_account)); + }, encode(message: QueryDeploymentResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.deployment !== undefined) { Deployment.encode(message.deployment, writer.uint32(10).fork()).ldelim(); @@ -679,6 +736,14 @@ export const QueryDeploymentResponse = { typeUrl: "/akash.deployment.v1beta2.QueryDeploymentResponse", value: QueryDeploymentResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryDeploymentResponse.typeUrl)) { + return; + } + Deployment.registerTypeUrl(); + Group.registerTypeUrl(); + Account.registerTypeUrl(); } }; function createBaseQueryGroupRequest(): QueryGroupRequest { @@ -694,6 +759,15 @@ function createBaseQueryGroupRequest(): QueryGroupRequest { */ export const QueryGroupRequest = { typeUrl: "/akash.deployment.v1beta2.QueryGroupRequest", + is(o: any): o is QueryGroupRequest { + return o && (o.$typeUrl === QueryGroupRequest.typeUrl || GroupID.is(o.id)); + }, + isSDK(o: any): o is QueryGroupRequestSDKType { + return o && (o.$typeUrl === QueryGroupRequest.typeUrl || GroupID.isSDK(o.id)); + }, + isAmino(o: any): o is QueryGroupRequestAmino { + return o && (o.$typeUrl === QueryGroupRequest.typeUrl || GroupID.isAmino(o.id)); + }, encode(message: QueryGroupRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.id !== undefined) { GroupID.encode(message.id, writer.uint32(10).fork()).ldelim(); @@ -770,6 +844,12 @@ export const QueryGroupRequest = { typeUrl: "/akash.deployment.v1beta2.QueryGroupRequest", value: QueryGroupRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryGroupRequest.typeUrl)) { + return; + } + GroupID.registerTypeUrl(); } }; function createBaseQueryGroupResponse(): QueryGroupResponse { @@ -785,6 +865,15 @@ function createBaseQueryGroupResponse(): QueryGroupResponse { */ export const QueryGroupResponse = { typeUrl: "/akash.deployment.v1beta2.QueryGroupResponse", + is(o: any): o is QueryGroupResponse { + return o && (o.$typeUrl === QueryGroupResponse.typeUrl || Group.is(o.group)); + }, + isSDK(o: any): o is QueryGroupResponseSDKType { + return o && (o.$typeUrl === QueryGroupResponse.typeUrl || Group.isSDK(o.group)); + }, + isAmino(o: any): o is QueryGroupResponseAmino { + return o && (o.$typeUrl === QueryGroupResponse.typeUrl || Group.isAmino(o.group)); + }, encode(message: QueryGroupResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.group !== undefined) { Group.encode(message.group, writer.uint32(10).fork()).ldelim(); @@ -861,5 +950,11 @@ export const QueryGroupResponse = { typeUrl: "/akash.deployment.v1beta2.QueryGroupResponse", value: QueryGroupResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryGroupResponse.typeUrl)) { + return; + } + Group.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/akash/deployment/v1beta2/resource.ts b/__fixtures__/v-next/outputv2/akash/deployment/v1beta2/resource.ts index 4147ce0088..2c87ef5972 100644 --- a/__fixtures__/v-next/outputv2/akash/deployment/v1beta2/resource.ts +++ b/__fixtures__/v-next/outputv2/akash/deployment/v1beta2/resource.ts @@ -1,6 +1,7 @@ import { ResourceUnits, ResourceUnitsAmino, ResourceUnitsSDKType } from "../../base/v1beta2/resourceunits"; import { DecCoin, DecCoinAmino, DecCoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; +import { GlobalDecoderRegistry } from "../../../registry"; import { isSet, DeepPartial } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "akash.deployment.v1beta2"; @@ -60,6 +61,15 @@ function createBaseResource(): Resource { */ export const Resource = { typeUrl: "/akash.deployment.v1beta2.Resource", + is(o: any): o is Resource { + return o && (o.$typeUrl === Resource.typeUrl || ResourceUnits.is(o.resources) && typeof o.count === "number" && DecCoin.is(o.price)); + }, + isSDK(o: any): o is ResourceSDKType { + return o && (o.$typeUrl === Resource.typeUrl || ResourceUnits.isSDK(o.resources) && typeof o.count === "number" && DecCoin.isSDK(o.price)); + }, + isAmino(o: any): o is ResourceAmino { + return o && (o.$typeUrl === Resource.typeUrl || ResourceUnits.isAmino(o.resources) && typeof o.count === "number" && DecCoin.isAmino(o.price)); + }, encode(message: Resource, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.resources !== undefined) { ResourceUnits.encode(message.resources, writer.uint32(10).fork()).ldelim(); @@ -168,5 +178,12 @@ export const Resource = { typeUrl: "/akash.deployment.v1beta2.Resource", value: Resource.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Resource.typeUrl)) { + return; + } + ResourceUnits.registerTypeUrl(); + DecCoin.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/akash/deployment/v1beta2/service.registry.ts b/__fixtures__/v-next/outputv2/akash/deployment/v1beta2/service.registry.ts index 6604a38f12..445c6dac4c 100644 --- a/__fixtures__/v-next/outputv2/akash/deployment/v1beta2/service.registry.ts +++ b/__fixtures__/v-next/outputv2/akash/deployment/v1beta2/service.registry.ts @@ -1,12 +1,7 @@ -import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { TelescopeGeneratedType } from "../../../types"; import { MsgCreateDeployment, MsgDepositDeployment, MsgUpdateDeployment, MsgCloseDeployment } from "./deploymentmsg"; import { MsgCloseGroup, MsgPauseGroup, MsgStartGroup } from "./groupmsg"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/akash.deployment.v1beta2.MsgCreateDeployment", MsgCreateDeployment], ["/akash.deployment.v1beta2.MsgDepositDeployment", MsgDepositDeployment], ["/akash.deployment.v1beta2.MsgUpdateDeployment", MsgUpdateDeployment], ["/akash.deployment.v1beta2.MsgCloseDeployment", MsgCloseDeployment], ["/akash.deployment.v1beta2.MsgCloseGroup", MsgCloseGroup], ["/akash.deployment.v1beta2.MsgPauseGroup", MsgPauseGroup], ["/akash.deployment.v1beta2.MsgStartGroup", MsgStartGroup]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/akash.deployment.v1beta2.MsgCreateDeployment", MsgCreateDeployment], ["/akash.deployment.v1beta2.MsgDepositDeployment", MsgDepositDeployment], ["/akash.deployment.v1beta2.MsgUpdateDeployment", MsgUpdateDeployment], ["/akash.deployment.v1beta2.MsgCloseDeployment", MsgCloseDeployment], ["/akash.deployment.v1beta2.MsgCloseGroup", MsgCloseGroup], ["/akash.deployment.v1beta2.MsgPauseGroup", MsgPauseGroup], ["/akash.deployment.v1beta2.MsgStartGroup", MsgStartGroup]]; export const MessageComposer = { encoded: { createDeployment(value: MsgCreateDeployment) { diff --git a/__fixtures__/v-next/outputv2/akash/deployment/v1beta2/service.rpc.func.ts b/__fixtures__/v-next/outputv2/akash/deployment/v1beta2/service.rpc.func.ts new file mode 100644 index 0000000000..f76c91a725 --- /dev/null +++ b/__fixtures__/v-next/outputv2/akash/deployment/v1beta2/service.rpc.func.ts @@ -0,0 +1,66 @@ +import { buildTx } from "../../../helper-func-types"; +import { MsgCreateDeployment, MsgDepositDeployment, MsgUpdateDeployment, MsgCloseDeployment } from "./deploymentmsg"; +import { MsgCloseGroup, MsgPauseGroup, MsgStartGroup } from "./groupmsg"; +/** + * CreateDeployment defines a method to create new deployment given proper inputs. + * @name createDeployment + * @package akash.deployment.v1beta2 + * @see proto service: akash.deployment.v1beta2.CreateDeployment + */ +export const createDeployment = buildTx({ + msg: MsgCreateDeployment +}); +/** + * DepositDeployment deposits more funds into the deployment account + * @name depositDeployment + * @package akash.deployment.v1beta2 + * @see proto service: akash.deployment.v1beta2.DepositDeployment + */ +export const depositDeployment = buildTx({ + msg: MsgDepositDeployment +}); +/** + * UpdateDeployment defines a method to update a deployment given proper inputs. + * @name updateDeployment + * @package akash.deployment.v1beta2 + * @see proto service: akash.deployment.v1beta2.UpdateDeployment + */ +export const updateDeployment = buildTx({ + msg: MsgUpdateDeployment +}); +/** + * CloseDeployment defines a method to close a deployment given proper inputs. + * @name closeDeployment + * @package akash.deployment.v1beta2 + * @see proto service: akash.deployment.v1beta2.CloseDeployment + */ +export const closeDeployment = buildTx({ + msg: MsgCloseDeployment +}); +/** + * CloseGroup defines a method to close a group of a deployment given proper inputs. + * @name closeGroup + * @package akash.deployment.v1beta2 + * @see proto service: akash.deployment.v1beta2.CloseGroup + */ +export const closeGroup = buildTx({ + msg: MsgCloseGroup +}); +/** + * PauseGroup defines a method to close a group of a deployment given proper inputs. + * @name pauseGroup + * @package akash.deployment.v1beta2 + * @see proto service: akash.deployment.v1beta2.PauseGroup + */ +export const pauseGroup = buildTx({ + msg: MsgPauseGroup +}); +/** + * StartGroup defines a method to close a group of a deployment given proper inputs. + * @name startGroup + * @package akash.deployment.v1beta2 + * @see proto service: akash.deployment.v1beta2.StartGroup + */ +export const startGroup = buildTx({ + msg: MsgStartGroup +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/akash/escrow/v1beta1/genesis.ts b/__fixtures__/v-next/outputv2/akash/escrow/v1beta1/genesis.ts index 1be696f214..4af0bae7d4 100644 --- a/__fixtures__/v-next/outputv2/akash/escrow/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv2/akash/escrow/v1beta1/genesis.ts @@ -2,6 +2,7 @@ import { Account, AccountAmino, AccountSDKType, Payment, PaymentAmino, PaymentSD import { BinaryReader, BinaryWriter } from "../../../binary"; import { JsonSafe } from "../../../json-safe"; import { DeepPartial } from "../../../helpers"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "akash.escrow.v1beta1"; /** * GenesisState defines the basic genesis state used by escrow module @@ -55,6 +56,15 @@ function createBaseGenesisState(): GenesisState { */ export const GenesisState = { typeUrl: "/akash.escrow.v1beta1.GenesisState", + is(o: any): o is GenesisState { + return o && (o.$typeUrl === GenesisState.typeUrl || Array.isArray(o.accounts) && (!o.accounts.length || Account.is(o.accounts[0])) && Array.isArray(o.payments) && (!o.payments.length || Payment.is(o.payments[0]))); + }, + isSDK(o: any): o is GenesisStateSDKType { + return o && (o.$typeUrl === GenesisState.typeUrl || Array.isArray(o.accounts) && (!o.accounts.length || Account.isSDK(o.accounts[0])) && Array.isArray(o.payments) && (!o.payments.length || Payment.isSDK(o.payments[0]))); + }, + isAmino(o: any): o is GenesisStateAmino { + return o && (o.$typeUrl === GenesisState.typeUrl || Array.isArray(o.accounts) && (!o.accounts.length || Account.isAmino(o.accounts[0])) && Array.isArray(o.payments) && (!o.payments.length || Payment.isAmino(o.payments[0]))); + }, encode(message: GenesisState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.accounts) { Account.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -164,5 +174,12 @@ export const GenesisState = { typeUrl: "/akash.escrow.v1beta1.GenesisState", value: GenesisState.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GenesisState.typeUrl)) { + return; + } + Account.registerTypeUrl(); + Payment.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/akash/escrow/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputv2/akash/escrow/v1beta1/query.rpc.func.ts new file mode 100644 index 0000000000..b70b2fbce5 --- /dev/null +++ b/__fixtures__/v-next/outputv2/akash/escrow/v1beta1/query.rpc.func.ts @@ -0,0 +1,32 @@ +import { buildQuery } from "../../../helper-func-types"; +import { QueryAccountsRequest, QueryAccountsResponse, QueryPaymentsRequest, QueryPaymentsResponse } from "./query"; +/** + * buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE + * buf:lint:ignore RPC_RESPONSE_STANDARD_NAME + * Accounts queries all accounts + * @name getAccounts + * @package akash.escrow.v1beta1 + * @see proto service: akash.escrow.v1beta1.Accounts + */ +export const getAccounts = buildQuery({ + encode: QueryAccountsRequest.encode, + decode: QueryAccountsResponse.decode, + service: "akash.escrow.v1beta1.Query", + method: "Accounts", + deps: [QueryAccountsRequest, QueryAccountsResponse] +}); +/** + * buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE + * buf:lint:ignore RPC_RESPONSE_STANDARD_NAME + * Payments queries all payments + * @name getPayments + * @package akash.escrow.v1beta1 + * @see proto service: akash.escrow.v1beta1.Payments + */ +export const getPayments = buildQuery({ + encode: QueryPaymentsRequest.encode, + decode: QueryPaymentsResponse.decode, + service: "akash.escrow.v1beta1.Query", + method: "Payments", + deps: [QueryPaymentsRequest, QueryPaymentsResponse] +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/akash/escrow/v1beta1/query.ts b/__fixtures__/v-next/outputv2/akash/escrow/v1beta1/query.ts index 7234036a87..e40acdf5c9 100644 --- a/__fixtures__/v-next/outputv2/akash/escrow/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv2/akash/escrow/v1beta1/query.ts @@ -1,6 +1,7 @@ import { PageRequest, PageRequestAmino, PageRequestSDKType, PageResponse, PageResponseAmino, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination"; import { Account, AccountAmino, AccountSDKType, Payment, PaymentAmino, PaymentSDKType } from "./types"; import { BinaryReader, BinaryWriter } from "../../../binary"; +import { GlobalDecoderRegistry } from "../../../registry"; import { isSet, DeepPartial } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "akash.escrow.v1beta1"; @@ -194,6 +195,15 @@ function createBaseQueryAccountsRequest(): QueryAccountsRequest { */ export const QueryAccountsRequest = { typeUrl: "/akash.escrow.v1beta1.QueryAccountsRequest", + is(o: any): o is QueryAccountsRequest { + return o && (o.$typeUrl === QueryAccountsRequest.typeUrl || typeof o.scope === "string" && typeof o.xid === "string" && typeof o.owner === "string" && typeof o.state === "string"); + }, + isSDK(o: any): o is QueryAccountsRequestSDKType { + return o && (o.$typeUrl === QueryAccountsRequest.typeUrl || typeof o.scope === "string" && typeof o.xid === "string" && typeof o.owner === "string" && typeof o.state === "string"); + }, + isAmino(o: any): o is QueryAccountsRequestAmino { + return o && (o.$typeUrl === QueryAccountsRequest.typeUrl || typeof o.scope === "string" && typeof o.xid === "string" && typeof o.owner === "string" && typeof o.state === "string"); + }, encode(message: QueryAccountsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.scope !== "") { writer.uint32(10).string(message.scope); @@ -330,6 +340,12 @@ export const QueryAccountsRequest = { typeUrl: "/akash.escrow.v1beta1.QueryAccountsRequest", value: QueryAccountsRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryAccountsRequest.typeUrl)) { + return; + } + PageRequest.registerTypeUrl(); } }; function createBaseQueryAccountsResponse(): QueryAccountsResponse { @@ -346,6 +362,15 @@ function createBaseQueryAccountsResponse(): QueryAccountsResponse { */ export const QueryAccountsResponse = { typeUrl: "/akash.escrow.v1beta1.QueryAccountsResponse", + is(o: any): o is QueryAccountsResponse { + return o && (o.$typeUrl === QueryAccountsResponse.typeUrl || Array.isArray(o.accounts) && (!o.accounts.length || Account.is(o.accounts[0]))); + }, + isSDK(o: any): o is QueryAccountsResponseSDKType { + return o && (o.$typeUrl === QueryAccountsResponse.typeUrl || Array.isArray(o.accounts) && (!o.accounts.length || Account.isSDK(o.accounts[0]))); + }, + isAmino(o: any): o is QueryAccountsResponseAmino { + return o && (o.$typeUrl === QueryAccountsResponse.typeUrl || Array.isArray(o.accounts) && (!o.accounts.length || Account.isAmino(o.accounts[0]))); + }, encode(message: QueryAccountsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.accounts) { Account.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -447,6 +472,13 @@ export const QueryAccountsResponse = { typeUrl: "/akash.escrow.v1beta1.QueryAccountsResponse", value: QueryAccountsResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryAccountsResponse.typeUrl)) { + return; + } + Account.registerTypeUrl(); + PageResponse.registerTypeUrl(); } }; function createBaseQueryPaymentsRequest(): QueryPaymentsRequest { @@ -467,6 +499,15 @@ function createBaseQueryPaymentsRequest(): QueryPaymentsRequest { */ export const QueryPaymentsRequest = { typeUrl: "/akash.escrow.v1beta1.QueryPaymentsRequest", + is(o: any): o is QueryPaymentsRequest { + return o && (o.$typeUrl === QueryPaymentsRequest.typeUrl || typeof o.scope === "string" && typeof o.xid === "string" && typeof o.id === "string" && typeof o.owner === "string" && typeof o.state === "string"); + }, + isSDK(o: any): o is QueryPaymentsRequestSDKType { + return o && (o.$typeUrl === QueryPaymentsRequest.typeUrl || typeof o.scope === "string" && typeof o.xid === "string" && typeof o.id === "string" && typeof o.owner === "string" && typeof o.state === "string"); + }, + isAmino(o: any): o is QueryPaymentsRequestAmino { + return o && (o.$typeUrl === QueryPaymentsRequest.typeUrl || typeof o.scope === "string" && typeof o.xid === "string" && typeof o.id === "string" && typeof o.owner === "string" && typeof o.state === "string"); + }, encode(message: QueryPaymentsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.scope !== "") { writer.uint32(10).string(message.scope); @@ -618,6 +659,12 @@ export const QueryPaymentsRequest = { typeUrl: "/akash.escrow.v1beta1.QueryPaymentsRequest", value: QueryPaymentsRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryPaymentsRequest.typeUrl)) { + return; + } + PageRequest.registerTypeUrl(); } }; function createBaseQueryPaymentsResponse(): QueryPaymentsResponse { @@ -634,6 +681,15 @@ function createBaseQueryPaymentsResponse(): QueryPaymentsResponse { */ export const QueryPaymentsResponse = { typeUrl: "/akash.escrow.v1beta1.QueryPaymentsResponse", + is(o: any): o is QueryPaymentsResponse { + return o && (o.$typeUrl === QueryPaymentsResponse.typeUrl || Array.isArray(o.payments) && (!o.payments.length || Payment.is(o.payments[0]))); + }, + isSDK(o: any): o is QueryPaymentsResponseSDKType { + return o && (o.$typeUrl === QueryPaymentsResponse.typeUrl || Array.isArray(o.payments) && (!o.payments.length || Payment.isSDK(o.payments[0]))); + }, + isAmino(o: any): o is QueryPaymentsResponseAmino { + return o && (o.$typeUrl === QueryPaymentsResponse.typeUrl || Array.isArray(o.payments) && (!o.payments.length || Payment.isAmino(o.payments[0]))); + }, encode(message: QueryPaymentsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.payments) { Payment.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -735,5 +791,12 @@ export const QueryPaymentsResponse = { typeUrl: "/akash.escrow.v1beta1.QueryPaymentsResponse", value: QueryPaymentsResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryPaymentsResponse.typeUrl)) { + return; + } + Payment.registerTypeUrl(); + PageResponse.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/akash/escrow/v1beta1/types.ts b/__fixtures__/v-next/outputv2/akash/escrow/v1beta1/types.ts index 4f93d3423d..0d440d47d4 100644 --- a/__fixtures__/v-next/outputv2/akash/escrow/v1beta1/types.ts +++ b/__fixtures__/v-next/outputv2/akash/escrow/v1beta1/types.ts @@ -2,6 +2,7 @@ import { Coin, CoinAmino, CoinSDKType } from "../../../cosmos/base/v1beta1/coin" import { BinaryReader, BinaryWriter } from "../../../binary"; import { isSet, DeepPartial } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "akash.escrow.v1beta1"; /** State stores state for an escrow account */ export enum Account_State { @@ -292,6 +293,15 @@ function createBaseAccountID(): AccountID { */ export const AccountID = { typeUrl: "/akash.escrow.v1beta1.AccountID", + is(o: any): o is AccountID { + return o && (o.$typeUrl === AccountID.typeUrl || typeof o.scope === "string" && typeof o.xid === "string"); + }, + isSDK(o: any): o is AccountIDSDKType { + return o && (o.$typeUrl === AccountID.typeUrl || typeof o.scope === "string" && typeof o.xid === "string"); + }, + isAmino(o: any): o is AccountIDAmino { + return o && (o.$typeUrl === AccountID.typeUrl || typeof o.scope === "string" && typeof o.xid === "string"); + }, encode(message: AccountID, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.scope !== "") { writer.uint32(10).string(message.scope); @@ -381,7 +391,8 @@ export const AccountID = { typeUrl: "/akash.escrow.v1beta1.AccountID", value: AccountID.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseAccount(): Account { return { @@ -401,6 +412,15 @@ function createBaseAccount(): Account { */ export const Account = { typeUrl: "/akash.escrow.v1beta1.Account", + is(o: any): o is Account { + return o && (o.$typeUrl === Account.typeUrl || AccountID.is(o.id) && typeof o.owner === "string" && isSet(o.state) && Coin.is(o.balance) && Coin.is(o.transferred) && typeof o.settledAt === "bigint"); + }, + isSDK(o: any): o is AccountSDKType { + return o && (o.$typeUrl === Account.typeUrl || AccountID.isSDK(o.id) && typeof o.owner === "string" && isSet(o.state) && Coin.isSDK(o.balance) && Coin.isSDK(o.transferred) && typeof o.settled_at === "bigint"); + }, + isAmino(o: any): o is AccountAmino { + return o && (o.$typeUrl === Account.typeUrl || AccountID.isAmino(o.id) && typeof o.owner === "string" && isSet(o.state) && Coin.isAmino(o.balance) && Coin.isAmino(o.transferred) && typeof o.settled_at === "bigint"); + }, encode(message: Account, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.id !== undefined) { AccountID.encode(message.id, writer.uint32(10).fork()).ldelim(); @@ -558,6 +578,13 @@ export const Account = { typeUrl: "/akash.escrow.v1beta1.Account", value: Account.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Account.typeUrl)) { + return; + } + AccountID.registerTypeUrl(); + Coin.registerTypeUrl(); } }; function createBasePayment(): Payment { @@ -579,6 +606,15 @@ function createBasePayment(): Payment { */ export const Payment = { typeUrl: "/akash.escrow.v1beta1.Payment", + is(o: any): o is Payment { + return o && (o.$typeUrl === Payment.typeUrl || AccountID.is(o.accountId) && typeof o.paymentId === "string" && typeof o.owner === "string" && isSet(o.state) && Coin.is(o.rate) && Coin.is(o.balance) && Coin.is(o.withdrawn)); + }, + isSDK(o: any): o is PaymentSDKType { + return o && (o.$typeUrl === Payment.typeUrl || AccountID.isSDK(o.account_id) && typeof o.payment_id === "string" && typeof o.owner === "string" && isSet(o.state) && Coin.isSDK(o.rate) && Coin.isSDK(o.balance) && Coin.isSDK(o.withdrawn)); + }, + isAmino(o: any): o is PaymentAmino { + return o && (o.$typeUrl === Payment.typeUrl || AccountID.isAmino(o.account_id) && typeof o.payment_id === "string" && typeof o.owner === "string" && isSet(o.state) && Coin.isAmino(o.rate) && Coin.isAmino(o.balance) && Coin.isAmino(o.withdrawn)); + }, encode(message: Payment, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.accountId !== undefined) { AccountID.encode(message.accountId, writer.uint32(10).fork()).ldelim(); @@ -751,5 +787,12 @@ export const Payment = { typeUrl: "/akash.escrow.v1beta1.Payment", value: Payment.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Payment.typeUrl)) { + return; + } + AccountID.registerTypeUrl(); + Coin.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/akash/escrow/v1beta2/genesis.ts b/__fixtures__/v-next/outputv2/akash/escrow/v1beta2/genesis.ts index f57d10bb87..b0c9fad019 100644 --- a/__fixtures__/v-next/outputv2/akash/escrow/v1beta2/genesis.ts +++ b/__fixtures__/v-next/outputv2/akash/escrow/v1beta2/genesis.ts @@ -2,6 +2,7 @@ import { Account, AccountAmino, AccountSDKType, FractionalPayment, FractionalPay import { BinaryReader, BinaryWriter } from "../../../binary"; import { JsonSafe } from "../../../json-safe"; import { DeepPartial } from "../../../helpers"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "akash.escrow.v1beta2"; /** * GenesisState defines the basic genesis state used by escrow module @@ -55,6 +56,15 @@ function createBaseGenesisState(): GenesisState { */ export const GenesisState = { typeUrl: "/akash.escrow.v1beta2.GenesisState", + is(o: any): o is GenesisState { + return o && (o.$typeUrl === GenesisState.typeUrl || Array.isArray(o.accounts) && (!o.accounts.length || Account.is(o.accounts[0])) && Array.isArray(o.payments) && (!o.payments.length || FractionalPayment.is(o.payments[0]))); + }, + isSDK(o: any): o is GenesisStateSDKType { + return o && (o.$typeUrl === GenesisState.typeUrl || Array.isArray(o.accounts) && (!o.accounts.length || Account.isSDK(o.accounts[0])) && Array.isArray(o.payments) && (!o.payments.length || FractionalPayment.isSDK(o.payments[0]))); + }, + isAmino(o: any): o is GenesisStateAmino { + return o && (o.$typeUrl === GenesisState.typeUrl || Array.isArray(o.accounts) && (!o.accounts.length || Account.isAmino(o.accounts[0])) && Array.isArray(o.payments) && (!o.payments.length || FractionalPayment.isAmino(o.payments[0]))); + }, encode(message: GenesisState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.accounts) { Account.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -164,5 +174,12 @@ export const GenesisState = { typeUrl: "/akash.escrow.v1beta2.GenesisState", value: GenesisState.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GenesisState.typeUrl)) { + return; + } + Account.registerTypeUrl(); + FractionalPayment.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/akash/escrow/v1beta2/query.rpc.func.ts b/__fixtures__/v-next/outputv2/akash/escrow/v1beta2/query.rpc.func.ts new file mode 100644 index 0000000000..bf7f397501 --- /dev/null +++ b/__fixtures__/v-next/outputv2/akash/escrow/v1beta2/query.rpc.func.ts @@ -0,0 +1,32 @@ +import { buildQuery } from "../../../helper-func-types"; +import { QueryAccountsRequest, QueryAccountsResponse, QueryPaymentsRequest, QueryPaymentsResponse } from "./query"; +/** + * buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE + * buf:lint:ignore RPC_RESPONSE_STANDARD_NAME + * Accounts queries all accounts + * @name getAccounts + * @package akash.escrow.v1beta2 + * @see proto service: akash.escrow.v1beta2.Accounts + */ +export const getAccounts = buildQuery({ + encode: QueryAccountsRequest.encode, + decode: QueryAccountsResponse.decode, + service: "akash.escrow.v1beta2.Query", + method: "Accounts", + deps: [QueryAccountsRequest, QueryAccountsResponse] +}); +/** + * buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE + * buf:lint:ignore RPC_RESPONSE_STANDARD_NAME + * Payments queries all payments + * @name getPayments + * @package akash.escrow.v1beta2 + * @see proto service: akash.escrow.v1beta2.Payments + */ +export const getPayments = buildQuery({ + encode: QueryPaymentsRequest.encode, + decode: QueryPaymentsResponse.decode, + service: "akash.escrow.v1beta2.Query", + method: "Payments", + deps: [QueryPaymentsRequest, QueryPaymentsResponse] +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/akash/escrow/v1beta2/query.ts b/__fixtures__/v-next/outputv2/akash/escrow/v1beta2/query.ts index da097fd0e7..61888a1986 100644 --- a/__fixtures__/v-next/outputv2/akash/escrow/v1beta2/query.ts +++ b/__fixtures__/v-next/outputv2/akash/escrow/v1beta2/query.ts @@ -1,6 +1,7 @@ import { PageRequest, PageRequestAmino, PageRequestSDKType, PageResponse, PageResponseAmino, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination"; import { Account, AccountAmino, AccountSDKType, FractionalPayment, FractionalPaymentAmino, FractionalPaymentSDKType } from "./types"; import { BinaryReader, BinaryWriter } from "../../../binary"; +import { GlobalDecoderRegistry } from "../../../registry"; import { isSet, DeepPartial } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "akash.escrow.v1beta2"; @@ -194,6 +195,15 @@ function createBaseQueryAccountsRequest(): QueryAccountsRequest { */ export const QueryAccountsRequest = { typeUrl: "/akash.escrow.v1beta2.QueryAccountsRequest", + is(o: any): o is QueryAccountsRequest { + return o && (o.$typeUrl === QueryAccountsRequest.typeUrl || typeof o.scope === "string" && typeof o.xid === "string" && typeof o.owner === "string" && typeof o.state === "string"); + }, + isSDK(o: any): o is QueryAccountsRequestSDKType { + return o && (o.$typeUrl === QueryAccountsRequest.typeUrl || typeof o.scope === "string" && typeof o.xid === "string" && typeof o.owner === "string" && typeof o.state === "string"); + }, + isAmino(o: any): o is QueryAccountsRequestAmino { + return o && (o.$typeUrl === QueryAccountsRequest.typeUrl || typeof o.scope === "string" && typeof o.xid === "string" && typeof o.owner === "string" && typeof o.state === "string"); + }, encode(message: QueryAccountsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.scope !== "") { writer.uint32(10).string(message.scope); @@ -330,6 +340,12 @@ export const QueryAccountsRequest = { typeUrl: "/akash.escrow.v1beta2.QueryAccountsRequest", value: QueryAccountsRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryAccountsRequest.typeUrl)) { + return; + } + PageRequest.registerTypeUrl(); } }; function createBaseQueryAccountsResponse(): QueryAccountsResponse { @@ -346,6 +362,15 @@ function createBaseQueryAccountsResponse(): QueryAccountsResponse { */ export const QueryAccountsResponse = { typeUrl: "/akash.escrow.v1beta2.QueryAccountsResponse", + is(o: any): o is QueryAccountsResponse { + return o && (o.$typeUrl === QueryAccountsResponse.typeUrl || Array.isArray(o.accounts) && (!o.accounts.length || Account.is(o.accounts[0]))); + }, + isSDK(o: any): o is QueryAccountsResponseSDKType { + return o && (o.$typeUrl === QueryAccountsResponse.typeUrl || Array.isArray(o.accounts) && (!o.accounts.length || Account.isSDK(o.accounts[0]))); + }, + isAmino(o: any): o is QueryAccountsResponseAmino { + return o && (o.$typeUrl === QueryAccountsResponse.typeUrl || Array.isArray(o.accounts) && (!o.accounts.length || Account.isAmino(o.accounts[0]))); + }, encode(message: QueryAccountsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.accounts) { Account.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -447,6 +472,13 @@ export const QueryAccountsResponse = { typeUrl: "/akash.escrow.v1beta2.QueryAccountsResponse", value: QueryAccountsResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryAccountsResponse.typeUrl)) { + return; + } + Account.registerTypeUrl(); + PageResponse.registerTypeUrl(); } }; function createBaseQueryPaymentsRequest(): QueryPaymentsRequest { @@ -467,6 +499,15 @@ function createBaseQueryPaymentsRequest(): QueryPaymentsRequest { */ export const QueryPaymentsRequest = { typeUrl: "/akash.escrow.v1beta2.QueryPaymentsRequest", + is(o: any): o is QueryPaymentsRequest { + return o && (o.$typeUrl === QueryPaymentsRequest.typeUrl || typeof o.scope === "string" && typeof o.xid === "string" && typeof o.id === "string" && typeof o.owner === "string" && typeof o.state === "string"); + }, + isSDK(o: any): o is QueryPaymentsRequestSDKType { + return o && (o.$typeUrl === QueryPaymentsRequest.typeUrl || typeof o.scope === "string" && typeof o.xid === "string" && typeof o.id === "string" && typeof o.owner === "string" && typeof o.state === "string"); + }, + isAmino(o: any): o is QueryPaymentsRequestAmino { + return o && (o.$typeUrl === QueryPaymentsRequest.typeUrl || typeof o.scope === "string" && typeof o.xid === "string" && typeof o.id === "string" && typeof o.owner === "string" && typeof o.state === "string"); + }, encode(message: QueryPaymentsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.scope !== "") { writer.uint32(10).string(message.scope); @@ -618,6 +659,12 @@ export const QueryPaymentsRequest = { typeUrl: "/akash.escrow.v1beta2.QueryPaymentsRequest", value: QueryPaymentsRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryPaymentsRequest.typeUrl)) { + return; + } + PageRequest.registerTypeUrl(); } }; function createBaseQueryPaymentsResponse(): QueryPaymentsResponse { @@ -634,6 +681,15 @@ function createBaseQueryPaymentsResponse(): QueryPaymentsResponse { */ export const QueryPaymentsResponse = { typeUrl: "/akash.escrow.v1beta2.QueryPaymentsResponse", + is(o: any): o is QueryPaymentsResponse { + return o && (o.$typeUrl === QueryPaymentsResponse.typeUrl || Array.isArray(o.payments) && (!o.payments.length || FractionalPayment.is(o.payments[0]))); + }, + isSDK(o: any): o is QueryPaymentsResponseSDKType { + return o && (o.$typeUrl === QueryPaymentsResponse.typeUrl || Array.isArray(o.payments) && (!o.payments.length || FractionalPayment.isSDK(o.payments[0]))); + }, + isAmino(o: any): o is QueryPaymentsResponseAmino { + return o && (o.$typeUrl === QueryPaymentsResponse.typeUrl || Array.isArray(o.payments) && (!o.payments.length || FractionalPayment.isAmino(o.payments[0]))); + }, encode(message: QueryPaymentsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.payments) { FractionalPayment.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -735,5 +791,12 @@ export const QueryPaymentsResponse = { typeUrl: "/akash.escrow.v1beta2.QueryPaymentsResponse", value: QueryPaymentsResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryPaymentsResponse.typeUrl)) { + return; + } + FractionalPayment.registerTypeUrl(); + PageResponse.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/akash/escrow/v1beta2/types.ts b/__fixtures__/v-next/outputv2/akash/escrow/v1beta2/types.ts index a9a953cc34..9ad712935e 100644 --- a/__fixtures__/v-next/outputv2/akash/escrow/v1beta2/types.ts +++ b/__fixtures__/v-next/outputv2/akash/escrow/v1beta2/types.ts @@ -2,6 +2,7 @@ import { DecCoin, DecCoinAmino, DecCoinSDKType, Coin, CoinAmino, CoinSDKType } f import { BinaryReader, BinaryWriter } from "../../../binary"; import { isSet, DeepPartial } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "akash.escrow.v1beta2"; /** State stores state for an escrow account */ export enum Account_State { @@ -316,6 +317,15 @@ function createBaseAccountID(): AccountID { */ export const AccountID = { typeUrl: "/akash.escrow.v1beta2.AccountID", + is(o: any): o is AccountID { + return o && (o.$typeUrl === AccountID.typeUrl || typeof o.scope === "string" && typeof o.xid === "string"); + }, + isSDK(o: any): o is AccountIDSDKType { + return o && (o.$typeUrl === AccountID.typeUrl || typeof o.scope === "string" && typeof o.xid === "string"); + }, + isAmino(o: any): o is AccountIDAmino { + return o && (o.$typeUrl === AccountID.typeUrl || typeof o.scope === "string" && typeof o.xid === "string"); + }, encode(message: AccountID, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.scope !== "") { writer.uint32(10).string(message.scope); @@ -405,7 +415,8 @@ export const AccountID = { typeUrl: "/akash.escrow.v1beta2.AccountID", value: AccountID.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseAccount(): Account { return { @@ -427,6 +438,15 @@ function createBaseAccount(): Account { */ export const Account = { typeUrl: "/akash.escrow.v1beta2.Account", + is(o: any): o is Account { + return o && (o.$typeUrl === Account.typeUrl || AccountID.is(o.id) && typeof o.owner === "string" && isSet(o.state) && DecCoin.is(o.balance) && DecCoin.is(o.transferred) && typeof o.settledAt === "bigint" && typeof o.depositor === "string" && DecCoin.is(o.funds)); + }, + isSDK(o: any): o is AccountSDKType { + return o && (o.$typeUrl === Account.typeUrl || AccountID.isSDK(o.id) && typeof o.owner === "string" && isSet(o.state) && DecCoin.isSDK(o.balance) && DecCoin.isSDK(o.transferred) && typeof o.settled_at === "bigint" && typeof o.depositor === "string" && DecCoin.isSDK(o.funds)); + }, + isAmino(o: any): o is AccountAmino { + return o && (o.$typeUrl === Account.typeUrl || AccountID.isAmino(o.id) && typeof o.owner === "string" && isSet(o.state) && DecCoin.isAmino(o.balance) && DecCoin.isAmino(o.transferred) && typeof o.settled_at === "bigint" && typeof o.depositor === "string" && DecCoin.isAmino(o.funds)); + }, encode(message: Account, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.id !== undefined) { AccountID.encode(message.id, writer.uint32(10).fork()).ldelim(); @@ -616,6 +636,13 @@ export const Account = { typeUrl: "/akash.escrow.v1beta2.Account", value: Account.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Account.typeUrl)) { + return; + } + AccountID.registerTypeUrl(); + DecCoin.registerTypeUrl(); } }; function createBaseFractionalPayment(): FractionalPayment { @@ -637,6 +664,15 @@ function createBaseFractionalPayment(): FractionalPayment { */ export const FractionalPayment = { typeUrl: "/akash.escrow.v1beta2.FractionalPayment", + is(o: any): o is FractionalPayment { + return o && (o.$typeUrl === FractionalPayment.typeUrl || AccountID.is(o.accountId) && typeof o.paymentId === "string" && typeof o.owner === "string" && isSet(o.state) && DecCoin.is(o.rate) && DecCoin.is(o.balance) && Coin.is(o.withdrawn)); + }, + isSDK(o: any): o is FractionalPaymentSDKType { + return o && (o.$typeUrl === FractionalPayment.typeUrl || AccountID.isSDK(o.account_id) && typeof o.payment_id === "string" && typeof o.owner === "string" && isSet(o.state) && DecCoin.isSDK(o.rate) && DecCoin.isSDK(o.balance) && Coin.isSDK(o.withdrawn)); + }, + isAmino(o: any): o is FractionalPaymentAmino { + return o && (o.$typeUrl === FractionalPayment.typeUrl || AccountID.isAmino(o.account_id) && typeof o.payment_id === "string" && typeof o.owner === "string" && isSet(o.state) && DecCoin.isAmino(o.rate) && DecCoin.isAmino(o.balance) && Coin.isAmino(o.withdrawn)); + }, encode(message: FractionalPayment, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.accountId !== undefined) { AccountID.encode(message.accountId, writer.uint32(10).fork()).ldelim(); @@ -809,5 +845,13 @@ export const FractionalPayment = { typeUrl: "/akash.escrow.v1beta2.FractionalPayment", value: FractionalPayment.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(FractionalPayment.typeUrl)) { + return; + } + AccountID.registerTypeUrl(); + DecCoin.registerTypeUrl(); + Coin.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/akash/inflation/v1beta2/genesis.ts b/__fixtures__/v-next/outputv2/akash/inflation/v1beta2/genesis.ts index 81855af0f2..bde0f7ad6a 100644 --- a/__fixtures__/v-next/outputv2/akash/inflation/v1beta2/genesis.ts +++ b/__fixtures__/v-next/outputv2/akash/inflation/v1beta2/genesis.ts @@ -1,5 +1,6 @@ import { Params, ParamsAmino, ParamsSDKType } from "./params"; import { BinaryReader, BinaryWriter } from "../../../binary"; +import { GlobalDecoderRegistry } from "../../../registry"; import { isSet, DeepPartial } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "akash.inflation.v1beta2"; @@ -51,6 +52,15 @@ function createBaseGenesisState(): GenesisState { */ export const GenesisState = { typeUrl: "/akash.inflation.v1beta2.GenesisState", + is(o: any): o is GenesisState { + return o && (o.$typeUrl === GenesisState.typeUrl || Params.is(o.params)); + }, + isSDK(o: any): o is GenesisStateSDKType { + return o && (o.$typeUrl === GenesisState.typeUrl || Params.isSDK(o.params)); + }, + isAmino(o: any): o is GenesisStateAmino { + return o && (o.$typeUrl === GenesisState.typeUrl || Params.isAmino(o.params)); + }, encode(message: GenesisState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.params !== undefined) { Params.encode(message.params, writer.uint32(10).fork()).ldelim(); @@ -127,5 +137,11 @@ export const GenesisState = { typeUrl: "/akash.inflation.v1beta2.GenesisState", value: GenesisState.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GenesisState.typeUrl)) { + return; + } + Params.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/akash/inflation/v1beta2/params.ts b/__fixtures__/v-next/outputv2/akash/inflation/v1beta2/params.ts index 86a5fe3dd0..343c52114b 100644 --- a/__fixtures__/v-next/outputv2/akash/inflation/v1beta2/params.ts +++ b/__fixtures__/v-next/outputv2/akash/inflation/v1beta2/params.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { Decimal } from "@cosmjs/math"; +import { Decimal } from "@interchainjs/math"; import { isSet, DeepPartial } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "akash.inflation.v1beta2"; @@ -81,6 +81,15 @@ function createBaseParams(): Params { */ export const Params = { typeUrl: "/akash.inflation.v1beta2.Params", + is(o: any): o is Params { + return o && (o.$typeUrl === Params.typeUrl || typeof o.inflationDecayFactor === "string" && typeof o.initialInflation === "string" && typeof o.variance === "string"); + }, + isSDK(o: any): o is ParamsSDKType { + return o && (o.$typeUrl === Params.typeUrl || typeof o.inflation_decay_factor === "string" && typeof o.initial_inflation === "string" && typeof o.variance === "string"); + }, + isAmino(o: any): o is ParamsAmino { + return o && (o.$typeUrl === Params.typeUrl || typeof o.inflation_decay_factor === "string" && typeof o.initial_inflation === "string" && typeof o.variance === "string"); + }, encode(message: Params, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.inflationDecayFactor !== "") { writer.uint32(10).string(Decimal.fromUserInput(message.inflationDecayFactor, 18).atomics); @@ -166,9 +175,9 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.inflation_decay_factor = message.inflationDecayFactor ?? ""; - obj.initial_inflation = message.initialInflation ?? ""; - obj.variance = message.variance ?? ""; + obj.inflation_decay_factor = Decimal.fromUserInput(message.inflationDecayFactor, 18).atomics ?? ""; + obj.initial_inflation = Decimal.fromUserInput(message.initialInflation, 18).atomics ?? ""; + obj.variance = Decimal.fromUserInput(message.variance, 18).atomics ?? ""; return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { @@ -185,5 +194,6 @@ export const Params = { typeUrl: "/akash.inflation.v1beta2.Params", value: Params.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/akash/market/v1beta2/bid.ts b/__fixtures__/v-next/outputv2/akash/market/v1beta2/bid.ts index f01a123fa7..049e7722fc 100644 --- a/__fixtures__/v-next/outputv2/akash/market/v1beta2/bid.ts +++ b/__fixtures__/v-next/outputv2/akash/market/v1beta2/bid.ts @@ -1,6 +1,7 @@ import { OrderID, OrderIDAmino, OrderIDSDKType } from "./order"; import { DecCoin, DecCoinAmino, DecCoinSDKType, Coin, CoinAmino, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; +import { GlobalDecoderRegistry } from "../../../registry"; import { isSet, DeepPartial } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "akash.market.v1beta2"; @@ -357,6 +358,15 @@ function createBaseMsgCreateBid(): MsgCreateBid { */ export const MsgCreateBid = { typeUrl: "/akash.market.v1beta2.MsgCreateBid", + is(o: any): o is MsgCreateBid { + return o && (o.$typeUrl === MsgCreateBid.typeUrl || OrderID.is(o.order) && typeof o.provider === "string" && DecCoin.is(o.price) && Coin.is(o.deposit)); + }, + isSDK(o: any): o is MsgCreateBidSDKType { + return o && (o.$typeUrl === MsgCreateBid.typeUrl || OrderID.isSDK(o.order) && typeof o.provider === "string" && DecCoin.isSDK(o.price) && Coin.isSDK(o.deposit)); + }, + isAmino(o: any): o is MsgCreateBidAmino { + return o && (o.$typeUrl === MsgCreateBid.typeUrl || OrderID.isAmino(o.order) && typeof o.provider === "string" && DecCoin.isAmino(o.price) && Coin.isAmino(o.deposit)); + }, encode(message: MsgCreateBid, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.order !== undefined) { OrderID.encode(message.order, writer.uint32(10).fork()).ldelim(); @@ -482,6 +492,14 @@ export const MsgCreateBid = { typeUrl: "/akash.market.v1beta2.MsgCreateBid", value: MsgCreateBid.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgCreateBid.typeUrl)) { + return; + } + OrderID.registerTypeUrl(); + DecCoin.registerTypeUrl(); + Coin.registerTypeUrl(); } }; function createBaseMsgCreateBidResponse(): MsgCreateBidResponse { @@ -495,6 +513,15 @@ function createBaseMsgCreateBidResponse(): MsgCreateBidResponse { */ export const MsgCreateBidResponse = { typeUrl: "/akash.market.v1beta2.MsgCreateBidResponse", + is(o: any): o is MsgCreateBidResponse { + return o && o.$typeUrl === MsgCreateBidResponse.typeUrl; + }, + isSDK(o: any): o is MsgCreateBidResponseSDKType { + return o && o.$typeUrl === MsgCreateBidResponse.typeUrl; + }, + isAmino(o: any): o is MsgCreateBidResponseAmino { + return o && o.$typeUrl === MsgCreateBidResponse.typeUrl; + }, encode(_: MsgCreateBidResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -553,7 +580,8 @@ export const MsgCreateBidResponse = { typeUrl: "/akash.market.v1beta2.MsgCreateBidResponse", value: MsgCreateBidResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgCloseBid(): MsgCloseBid { return { @@ -568,6 +596,15 @@ function createBaseMsgCloseBid(): MsgCloseBid { */ export const MsgCloseBid = { typeUrl: "/akash.market.v1beta2.MsgCloseBid", + is(o: any): o is MsgCloseBid { + return o && (o.$typeUrl === MsgCloseBid.typeUrl || BidID.is(o.bidId)); + }, + isSDK(o: any): o is MsgCloseBidSDKType { + return o && (o.$typeUrl === MsgCloseBid.typeUrl || BidID.isSDK(o.bid_id)); + }, + isAmino(o: any): o is MsgCloseBidAmino { + return o && (o.$typeUrl === MsgCloseBid.typeUrl || BidID.isAmino(o.bid_id)); + }, encode(message: MsgCloseBid, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.bidId !== undefined) { BidID.encode(message.bidId, writer.uint32(10).fork()).ldelim(); @@ -644,6 +681,12 @@ export const MsgCloseBid = { typeUrl: "/akash.market.v1beta2.MsgCloseBid", value: MsgCloseBid.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgCloseBid.typeUrl)) { + return; + } + BidID.registerTypeUrl(); } }; function createBaseMsgCloseBidResponse(): MsgCloseBidResponse { @@ -657,6 +700,15 @@ function createBaseMsgCloseBidResponse(): MsgCloseBidResponse { */ export const MsgCloseBidResponse = { typeUrl: "/akash.market.v1beta2.MsgCloseBidResponse", + is(o: any): o is MsgCloseBidResponse { + return o && o.$typeUrl === MsgCloseBidResponse.typeUrl; + }, + isSDK(o: any): o is MsgCloseBidResponseSDKType { + return o && o.$typeUrl === MsgCloseBidResponse.typeUrl; + }, + isAmino(o: any): o is MsgCloseBidResponseAmino { + return o && o.$typeUrl === MsgCloseBidResponse.typeUrl; + }, encode(_: MsgCloseBidResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -715,7 +767,8 @@ export const MsgCloseBidResponse = { typeUrl: "/akash.market.v1beta2.MsgCloseBidResponse", value: MsgCloseBidResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseBidID(): BidID { return { @@ -735,6 +788,15 @@ function createBaseBidID(): BidID { */ export const BidID = { typeUrl: "/akash.market.v1beta2.BidID", + is(o: any): o is BidID { + return o && (o.$typeUrl === BidID.typeUrl || typeof o.owner === "string" && typeof o.dseq === "bigint" && typeof o.gseq === "number" && typeof o.oseq === "number" && typeof o.provider === "string"); + }, + isSDK(o: any): o is BidIDSDKType { + return o && (o.$typeUrl === BidID.typeUrl || typeof o.owner === "string" && typeof o.dseq === "bigint" && typeof o.gseq === "number" && typeof o.oseq === "number" && typeof o.provider === "string"); + }, + isAmino(o: any): o is BidIDAmino { + return o && (o.$typeUrl === BidID.typeUrl || typeof o.owner === "string" && typeof o.dseq === "bigint" && typeof o.gseq === "number" && typeof o.oseq === "number" && typeof o.provider === "string"); + }, encode(message: BidID, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.owner !== "") { writer.uint32(10).string(message.owner); @@ -871,7 +933,8 @@ export const BidID = { typeUrl: "/akash.market.v1beta2.BidID", value: BidID.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseBid(): Bid { return { @@ -889,6 +952,15 @@ function createBaseBid(): Bid { */ export const Bid = { typeUrl: "/akash.market.v1beta2.Bid", + is(o: any): o is Bid { + return o && (o.$typeUrl === Bid.typeUrl || BidID.is(o.bidId) && isSet(o.state) && DecCoin.is(o.price) && typeof o.createdAt === "bigint"); + }, + isSDK(o: any): o is BidSDKType { + return o && (o.$typeUrl === Bid.typeUrl || BidID.isSDK(o.bid_id) && isSet(o.state) && DecCoin.isSDK(o.price) && typeof o.created_at === "bigint"); + }, + isAmino(o: any): o is BidAmino { + return o && (o.$typeUrl === Bid.typeUrl || BidID.isAmino(o.bid_id) && isSet(o.state) && DecCoin.isAmino(o.price) && typeof o.created_at === "bigint"); + }, encode(message: Bid, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.bidId !== undefined) { BidID.encode(message.bidId, writer.uint32(10).fork()).ldelim(); @@ -1014,6 +1086,13 @@ export const Bid = { typeUrl: "/akash.market.v1beta2.Bid", value: Bid.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Bid.typeUrl)) { + return; + } + BidID.registerTypeUrl(); + DecCoin.registerTypeUrl(); } }; function createBaseBidFilters(): BidFilters { @@ -1034,6 +1113,15 @@ function createBaseBidFilters(): BidFilters { */ export const BidFilters = { typeUrl: "/akash.market.v1beta2.BidFilters", + is(o: any): o is BidFilters { + return o && (o.$typeUrl === BidFilters.typeUrl || typeof o.owner === "string" && typeof o.dseq === "bigint" && typeof o.gseq === "number" && typeof o.oseq === "number" && typeof o.provider === "string" && typeof o.state === "string"); + }, + isSDK(o: any): o is BidFiltersSDKType { + return o && (o.$typeUrl === BidFilters.typeUrl || typeof o.owner === "string" && typeof o.dseq === "bigint" && typeof o.gseq === "number" && typeof o.oseq === "number" && typeof o.provider === "string" && typeof o.state === "string"); + }, + isAmino(o: any): o is BidFiltersAmino { + return o && (o.$typeUrl === BidFilters.typeUrl || typeof o.owner === "string" && typeof o.dseq === "bigint" && typeof o.gseq === "number" && typeof o.oseq === "number" && typeof o.provider === "string" && typeof o.state === "string"); + }, encode(message: BidFilters, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.owner !== "") { writer.uint32(10).string(message.owner); @@ -1185,5 +1273,6 @@ export const BidFilters = { typeUrl: "/akash.market.v1beta2.BidFilters", value: BidFilters.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/akash/market/v1beta2/genesis.ts b/__fixtures__/v-next/outputv2/akash/market/v1beta2/genesis.ts index 3072c8b25e..638cf02d44 100644 --- a/__fixtures__/v-next/outputv2/akash/market/v1beta2/genesis.ts +++ b/__fixtures__/v-next/outputv2/akash/market/v1beta2/genesis.ts @@ -2,6 +2,7 @@ import { Order, OrderAmino, OrderSDKType } from "./order"; import { Lease, LeaseAmino, LeaseSDKType } from "./lease"; import { Params, ParamsAmino, ParamsSDKType } from "./params"; import { BinaryReader, BinaryWriter } from "../../../binary"; +import { GlobalDecoderRegistry } from "../../../registry"; import { isSet, DeepPartial } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "akash.market.v1beta2"; @@ -61,6 +62,15 @@ function createBaseGenesisState(): GenesisState { */ export const GenesisState = { typeUrl: "/akash.market.v1beta2.GenesisState", + is(o: any): o is GenesisState { + return o && (o.$typeUrl === GenesisState.typeUrl || Array.isArray(o.orders) && (!o.orders.length || Order.is(o.orders[0])) && Array.isArray(o.leases) && (!o.leases.length || Lease.is(o.leases[0])) && Params.is(o.params)); + }, + isSDK(o: any): o is GenesisStateSDKType { + return o && (o.$typeUrl === GenesisState.typeUrl || Array.isArray(o.orders) && (!o.orders.length || Order.isSDK(o.orders[0])) && Array.isArray(o.leases) && (!o.leases.length || Lease.isSDK(o.leases[0])) && Params.isSDK(o.params)); + }, + isAmino(o: any): o is GenesisStateAmino { + return o && (o.$typeUrl === GenesisState.typeUrl || Array.isArray(o.orders) && (!o.orders.length || Order.isAmino(o.orders[0])) && Array.isArray(o.leases) && (!o.leases.length || Lease.isAmino(o.leases[0])) && Params.isAmino(o.params)); + }, encode(message: GenesisState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.orders) { Order.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -187,5 +197,13 @@ export const GenesisState = { typeUrl: "/akash.market.v1beta2.GenesisState", value: GenesisState.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GenesisState.typeUrl)) { + return; + } + Order.registerTypeUrl(); + Lease.registerTypeUrl(); + Params.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/akash/market/v1beta2/lease.ts b/__fixtures__/v-next/outputv2/akash/market/v1beta2/lease.ts index f322b1910a..794c39db85 100644 --- a/__fixtures__/v-next/outputv2/akash/market/v1beta2/lease.ts +++ b/__fixtures__/v-next/outputv2/akash/market/v1beta2/lease.ts @@ -3,6 +3,7 @@ import { BidID, BidIDAmino, BidIDSDKType } from "./bid"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { isSet, DeepPartial } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "akash.market.v1beta2"; /** State is an enum which refers to state of lease */ export enum Lease_State { @@ -406,6 +407,15 @@ function createBaseLeaseID(): LeaseID { */ export const LeaseID = { typeUrl: "/akash.market.v1beta2.LeaseID", + is(o: any): o is LeaseID { + return o && (o.$typeUrl === LeaseID.typeUrl || typeof o.owner === "string" && typeof o.dseq === "bigint" && typeof o.gseq === "number" && typeof o.oseq === "number" && typeof o.provider === "string"); + }, + isSDK(o: any): o is LeaseIDSDKType { + return o && (o.$typeUrl === LeaseID.typeUrl || typeof o.owner === "string" && typeof o.dseq === "bigint" && typeof o.gseq === "number" && typeof o.oseq === "number" && typeof o.provider === "string"); + }, + isAmino(o: any): o is LeaseIDAmino { + return o && (o.$typeUrl === LeaseID.typeUrl || typeof o.owner === "string" && typeof o.dseq === "bigint" && typeof o.gseq === "number" && typeof o.oseq === "number" && typeof o.provider === "string"); + }, encode(message: LeaseID, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.owner !== "") { writer.uint32(10).string(message.owner); @@ -542,7 +552,8 @@ export const LeaseID = { typeUrl: "/akash.market.v1beta2.LeaseID", value: LeaseID.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseLease(): Lease { return { @@ -561,6 +572,15 @@ function createBaseLease(): Lease { */ export const Lease = { typeUrl: "/akash.market.v1beta2.Lease", + is(o: any): o is Lease { + return o && (o.$typeUrl === Lease.typeUrl || LeaseID.is(o.leaseId) && isSet(o.state) && DecCoin.is(o.price) && typeof o.createdAt === "bigint" && typeof o.closedOn === "bigint"); + }, + isSDK(o: any): o is LeaseSDKType { + return o && (o.$typeUrl === Lease.typeUrl || LeaseID.isSDK(o.lease_id) && isSet(o.state) && DecCoin.isSDK(o.price) && typeof o.created_at === "bigint" && typeof o.closed_on === "bigint"); + }, + isAmino(o: any): o is LeaseAmino { + return o && (o.$typeUrl === Lease.typeUrl || LeaseID.isAmino(o.lease_id) && isSet(o.state) && DecCoin.isAmino(o.price) && typeof o.created_at === "bigint" && typeof o.closed_on === "bigint"); + }, encode(message: Lease, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.leaseId !== undefined) { LeaseID.encode(message.leaseId, writer.uint32(10).fork()).ldelim(); @@ -703,6 +723,13 @@ export const Lease = { typeUrl: "/akash.market.v1beta2.Lease", value: Lease.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Lease.typeUrl)) { + return; + } + LeaseID.registerTypeUrl(); + DecCoin.registerTypeUrl(); } }; function createBaseLeaseFilters(): LeaseFilters { @@ -723,6 +750,15 @@ function createBaseLeaseFilters(): LeaseFilters { */ export const LeaseFilters = { typeUrl: "/akash.market.v1beta2.LeaseFilters", + is(o: any): o is LeaseFilters { + return o && (o.$typeUrl === LeaseFilters.typeUrl || typeof o.owner === "string" && typeof o.dseq === "bigint" && typeof o.gseq === "number" && typeof o.oseq === "number" && typeof o.provider === "string" && typeof o.state === "string"); + }, + isSDK(o: any): o is LeaseFiltersSDKType { + return o && (o.$typeUrl === LeaseFilters.typeUrl || typeof o.owner === "string" && typeof o.dseq === "bigint" && typeof o.gseq === "number" && typeof o.oseq === "number" && typeof o.provider === "string" && typeof o.state === "string"); + }, + isAmino(o: any): o is LeaseFiltersAmino { + return o && (o.$typeUrl === LeaseFilters.typeUrl || typeof o.owner === "string" && typeof o.dseq === "bigint" && typeof o.gseq === "number" && typeof o.oseq === "number" && typeof o.provider === "string" && typeof o.state === "string"); + }, encode(message: LeaseFilters, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.owner !== "") { writer.uint32(10).string(message.owner); @@ -874,7 +910,8 @@ export const LeaseFilters = { typeUrl: "/akash.market.v1beta2.LeaseFilters", value: LeaseFilters.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgCreateLease(): MsgCreateLease { return { @@ -889,6 +926,15 @@ function createBaseMsgCreateLease(): MsgCreateLease { */ export const MsgCreateLease = { typeUrl: "/akash.market.v1beta2.MsgCreateLease", + is(o: any): o is MsgCreateLease { + return o && (o.$typeUrl === MsgCreateLease.typeUrl || BidID.is(o.bidId)); + }, + isSDK(o: any): o is MsgCreateLeaseSDKType { + return o && (o.$typeUrl === MsgCreateLease.typeUrl || BidID.isSDK(o.bid_id)); + }, + isAmino(o: any): o is MsgCreateLeaseAmino { + return o && (o.$typeUrl === MsgCreateLease.typeUrl || BidID.isAmino(o.bid_id)); + }, encode(message: MsgCreateLease, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.bidId !== undefined) { BidID.encode(message.bidId, writer.uint32(10).fork()).ldelim(); @@ -965,6 +1011,12 @@ export const MsgCreateLease = { typeUrl: "/akash.market.v1beta2.MsgCreateLease", value: MsgCreateLease.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgCreateLease.typeUrl)) { + return; + } + BidID.registerTypeUrl(); } }; function createBaseMsgCreateLeaseResponse(): MsgCreateLeaseResponse { @@ -978,6 +1030,15 @@ function createBaseMsgCreateLeaseResponse(): MsgCreateLeaseResponse { */ export const MsgCreateLeaseResponse = { typeUrl: "/akash.market.v1beta2.MsgCreateLeaseResponse", + is(o: any): o is MsgCreateLeaseResponse { + return o && o.$typeUrl === MsgCreateLeaseResponse.typeUrl; + }, + isSDK(o: any): o is MsgCreateLeaseResponseSDKType { + return o && o.$typeUrl === MsgCreateLeaseResponse.typeUrl; + }, + isAmino(o: any): o is MsgCreateLeaseResponseAmino { + return o && o.$typeUrl === MsgCreateLeaseResponse.typeUrl; + }, encode(_: MsgCreateLeaseResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -1036,7 +1097,8 @@ export const MsgCreateLeaseResponse = { typeUrl: "/akash.market.v1beta2.MsgCreateLeaseResponse", value: MsgCreateLeaseResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgWithdrawLease(): MsgWithdrawLease { return { @@ -1051,6 +1113,15 @@ function createBaseMsgWithdrawLease(): MsgWithdrawLease { */ export const MsgWithdrawLease = { typeUrl: "/akash.market.v1beta2.MsgWithdrawLease", + is(o: any): o is MsgWithdrawLease { + return o && (o.$typeUrl === MsgWithdrawLease.typeUrl || LeaseID.is(o.bidId)); + }, + isSDK(o: any): o is MsgWithdrawLeaseSDKType { + return o && (o.$typeUrl === MsgWithdrawLease.typeUrl || LeaseID.isSDK(o.bid_id)); + }, + isAmino(o: any): o is MsgWithdrawLeaseAmino { + return o && (o.$typeUrl === MsgWithdrawLease.typeUrl || LeaseID.isAmino(o.bid_id)); + }, encode(message: MsgWithdrawLease, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.bidId !== undefined) { LeaseID.encode(message.bidId, writer.uint32(10).fork()).ldelim(); @@ -1127,6 +1198,12 @@ export const MsgWithdrawLease = { typeUrl: "/akash.market.v1beta2.MsgWithdrawLease", value: MsgWithdrawLease.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgWithdrawLease.typeUrl)) { + return; + } + LeaseID.registerTypeUrl(); } }; function createBaseMsgWithdrawLeaseResponse(): MsgWithdrawLeaseResponse { @@ -1140,6 +1217,15 @@ function createBaseMsgWithdrawLeaseResponse(): MsgWithdrawLeaseResponse { */ export const MsgWithdrawLeaseResponse = { typeUrl: "/akash.market.v1beta2.MsgWithdrawLeaseResponse", + is(o: any): o is MsgWithdrawLeaseResponse { + return o && o.$typeUrl === MsgWithdrawLeaseResponse.typeUrl; + }, + isSDK(o: any): o is MsgWithdrawLeaseResponseSDKType { + return o && o.$typeUrl === MsgWithdrawLeaseResponse.typeUrl; + }, + isAmino(o: any): o is MsgWithdrawLeaseResponseAmino { + return o && o.$typeUrl === MsgWithdrawLeaseResponse.typeUrl; + }, encode(_: MsgWithdrawLeaseResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -1198,7 +1284,8 @@ export const MsgWithdrawLeaseResponse = { typeUrl: "/akash.market.v1beta2.MsgWithdrawLeaseResponse", value: MsgWithdrawLeaseResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgCloseLease(): MsgCloseLease { return { @@ -1213,6 +1300,15 @@ function createBaseMsgCloseLease(): MsgCloseLease { */ export const MsgCloseLease = { typeUrl: "/akash.market.v1beta2.MsgCloseLease", + is(o: any): o is MsgCloseLease { + return o && (o.$typeUrl === MsgCloseLease.typeUrl || LeaseID.is(o.leaseId)); + }, + isSDK(o: any): o is MsgCloseLeaseSDKType { + return o && (o.$typeUrl === MsgCloseLease.typeUrl || LeaseID.isSDK(o.lease_id)); + }, + isAmino(o: any): o is MsgCloseLeaseAmino { + return o && (o.$typeUrl === MsgCloseLease.typeUrl || LeaseID.isAmino(o.lease_id)); + }, encode(message: MsgCloseLease, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.leaseId !== undefined) { LeaseID.encode(message.leaseId, writer.uint32(10).fork()).ldelim(); @@ -1289,6 +1385,12 @@ export const MsgCloseLease = { typeUrl: "/akash.market.v1beta2.MsgCloseLease", value: MsgCloseLease.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgCloseLease.typeUrl)) { + return; + } + LeaseID.registerTypeUrl(); } }; function createBaseMsgCloseLeaseResponse(): MsgCloseLeaseResponse { @@ -1302,6 +1404,15 @@ function createBaseMsgCloseLeaseResponse(): MsgCloseLeaseResponse { */ export const MsgCloseLeaseResponse = { typeUrl: "/akash.market.v1beta2.MsgCloseLeaseResponse", + is(o: any): o is MsgCloseLeaseResponse { + return o && o.$typeUrl === MsgCloseLeaseResponse.typeUrl; + }, + isSDK(o: any): o is MsgCloseLeaseResponseSDKType { + return o && o.$typeUrl === MsgCloseLeaseResponse.typeUrl; + }, + isAmino(o: any): o is MsgCloseLeaseResponseAmino { + return o && o.$typeUrl === MsgCloseLeaseResponse.typeUrl; + }, encode(_: MsgCloseLeaseResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -1360,5 +1471,6 @@ export const MsgCloseLeaseResponse = { typeUrl: "/akash.market.v1beta2.MsgCloseLeaseResponse", value: MsgCloseLeaseResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/akash/market/v1beta2/order.ts b/__fixtures__/v-next/outputv2/akash/market/v1beta2/order.ts index a51e7f4027..426119cc5f 100644 --- a/__fixtures__/v-next/outputv2/akash/market/v1beta2/order.ts +++ b/__fixtures__/v-next/outputv2/akash/market/v1beta2/order.ts @@ -2,6 +2,7 @@ import { GroupSpec, GroupSpecAmino, GroupSpecSDKType } from "../../deployment/v1 import { BinaryReader, BinaryWriter } from "../../../binary"; import { isSet, DeepPartial } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "akash.market.v1beta2"; /** State is an enum which refers to state of order */ export enum Order_State { @@ -203,6 +204,15 @@ function createBaseOrderID(): OrderID { */ export const OrderID = { typeUrl: "/akash.market.v1beta2.OrderID", + is(o: any): o is OrderID { + return o && (o.$typeUrl === OrderID.typeUrl || typeof o.owner === "string" && typeof o.dseq === "bigint" && typeof o.gseq === "number" && typeof o.oseq === "number"); + }, + isSDK(o: any): o is OrderIDSDKType { + return o && (o.$typeUrl === OrderID.typeUrl || typeof o.owner === "string" && typeof o.dseq === "bigint" && typeof o.gseq === "number" && typeof o.oseq === "number"); + }, + isAmino(o: any): o is OrderIDAmino { + return o && (o.$typeUrl === OrderID.typeUrl || typeof o.owner === "string" && typeof o.dseq === "bigint" && typeof o.gseq === "number" && typeof o.oseq === "number"); + }, encode(message: OrderID, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.owner !== "") { writer.uint32(10).string(message.owner); @@ -324,7 +334,8 @@ export const OrderID = { typeUrl: "/akash.market.v1beta2.OrderID", value: OrderID.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseOrder(): Order { return { @@ -342,6 +353,15 @@ function createBaseOrder(): Order { */ export const Order = { typeUrl: "/akash.market.v1beta2.Order", + is(o: any): o is Order { + return o && (o.$typeUrl === Order.typeUrl || OrderID.is(o.orderId) && isSet(o.state) && GroupSpec.is(o.spec) && typeof o.createdAt === "bigint"); + }, + isSDK(o: any): o is OrderSDKType { + return o && (o.$typeUrl === Order.typeUrl || OrderID.isSDK(o.order_id) && isSet(o.state) && GroupSpec.isSDK(o.spec) && typeof o.created_at === "bigint"); + }, + isAmino(o: any): o is OrderAmino { + return o && (o.$typeUrl === Order.typeUrl || OrderID.isAmino(o.order_id) && isSet(o.state) && GroupSpec.isAmino(o.spec) && typeof o.created_at === "bigint"); + }, encode(message: Order, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.orderId !== undefined) { OrderID.encode(message.orderId, writer.uint32(10).fork()).ldelim(); @@ -467,6 +487,13 @@ export const Order = { typeUrl: "/akash.market.v1beta2.Order", value: Order.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Order.typeUrl)) { + return; + } + OrderID.registerTypeUrl(); + GroupSpec.registerTypeUrl(); } }; function createBaseOrderFilters(): OrderFilters { @@ -486,6 +513,15 @@ function createBaseOrderFilters(): OrderFilters { */ export const OrderFilters = { typeUrl: "/akash.market.v1beta2.OrderFilters", + is(o: any): o is OrderFilters { + return o && (o.$typeUrl === OrderFilters.typeUrl || typeof o.owner === "string" && typeof o.dseq === "bigint" && typeof o.gseq === "number" && typeof o.oseq === "number" && typeof o.state === "string"); + }, + isSDK(o: any): o is OrderFiltersSDKType { + return o && (o.$typeUrl === OrderFilters.typeUrl || typeof o.owner === "string" && typeof o.dseq === "bigint" && typeof o.gseq === "number" && typeof o.oseq === "number" && typeof o.state === "string"); + }, + isAmino(o: any): o is OrderFiltersAmino { + return o && (o.$typeUrl === OrderFilters.typeUrl || typeof o.owner === "string" && typeof o.dseq === "bigint" && typeof o.gseq === "number" && typeof o.oseq === "number" && typeof o.state === "string"); + }, encode(message: OrderFilters, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.owner !== "") { writer.uint32(10).string(message.owner); @@ -622,5 +658,6 @@ export const OrderFilters = { typeUrl: "/akash.market.v1beta2.OrderFilters", value: OrderFilters.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/akash/market/v1beta2/params.ts b/__fixtures__/v-next/outputv2/akash/market/v1beta2/params.ts index 40cdffc53b..d7e14674b5 100644 --- a/__fixtures__/v-next/outputv2/akash/market/v1beta2/params.ts +++ b/__fixtures__/v-next/outputv2/akash/market/v1beta2/params.ts @@ -1,5 +1,6 @@ import { Coin, CoinAmino, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; +import { GlobalDecoderRegistry } from "../../../registry"; import { isSet, DeepPartial } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "akash.market.v1beta2"; @@ -55,6 +56,15 @@ function createBaseParams(): Params { */ export const Params = { typeUrl: "/akash.market.v1beta2.Params", + is(o: any): o is Params { + return o && (o.$typeUrl === Params.typeUrl || Coin.is(o.bidMinDeposit) && typeof o.orderMaxBids === "number"); + }, + isSDK(o: any): o is ParamsSDKType { + return o && (o.$typeUrl === Params.typeUrl || Coin.isSDK(o.bid_min_deposit) && typeof o.order_max_bids === "number"); + }, + isAmino(o: any): o is ParamsAmino { + return o && (o.$typeUrl === Params.typeUrl || Coin.isAmino(o.bid_min_deposit) && typeof o.order_max_bids === "number"); + }, encode(message: Params, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.bidMinDeposit !== undefined) { Coin.encode(message.bidMinDeposit, writer.uint32(10).fork()).ldelim(); @@ -146,5 +156,11 @@ export const Params = { typeUrl: "/akash.market.v1beta2.Params", value: Params.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Params.typeUrl)) { + return; + } + Coin.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/akash/market/v1beta2/query.rpc.func.ts b/__fixtures__/v-next/outputv2/akash/market/v1beta2/query.rpc.func.ts new file mode 100644 index 0000000000..b86b051cff --- /dev/null +++ b/__fixtures__/v-next/outputv2/akash/market/v1beta2/query.rpc.func.ts @@ -0,0 +1,80 @@ +import { buildQuery } from "../../../helper-func-types"; +import { QueryOrdersRequest, QueryOrdersResponse, QueryOrderRequest, QueryOrderResponse, QueryBidsRequest, QueryBidsResponse, QueryBidRequest, QueryBidResponse, QueryLeasesRequest, QueryLeasesResponse, QueryLeaseRequest, QueryLeaseResponse } from "./query"; +/** + * Orders queries orders with filters + * @name getOrders + * @package akash.market.v1beta2 + * @see proto service: akash.market.v1beta2.Orders + */ +export const getOrders = buildQuery({ + encode: QueryOrdersRequest.encode, + decode: QueryOrdersResponse.decode, + service: "akash.market.v1beta2.Query", + method: "Orders", + deps: [QueryOrdersRequest, QueryOrdersResponse] +}); +/** + * Order queries order details + * @name getOrder + * @package akash.market.v1beta2 + * @see proto service: akash.market.v1beta2.Order + */ +export const getOrder = buildQuery({ + encode: QueryOrderRequest.encode, + decode: QueryOrderResponse.decode, + service: "akash.market.v1beta2.Query", + method: "Order", + deps: [QueryOrderRequest, QueryOrderResponse] +}); +/** + * Bids queries bids with filters + * @name getBids + * @package akash.market.v1beta2 + * @see proto service: akash.market.v1beta2.Bids + */ +export const getBids = buildQuery({ + encode: QueryBidsRequest.encode, + decode: QueryBidsResponse.decode, + service: "akash.market.v1beta2.Query", + method: "Bids", + deps: [QueryBidsRequest, QueryBidsResponse] +}); +/** + * Bid queries bid details + * @name getBid + * @package akash.market.v1beta2 + * @see proto service: akash.market.v1beta2.Bid + */ +export const getBid = buildQuery({ + encode: QueryBidRequest.encode, + decode: QueryBidResponse.decode, + service: "akash.market.v1beta2.Query", + method: "Bid", + deps: [QueryBidRequest, QueryBidResponse] +}); +/** + * Leases queries leases with filters + * @name getLeases + * @package akash.market.v1beta2 + * @see proto service: akash.market.v1beta2.Leases + */ +export const getLeases = buildQuery({ + encode: QueryLeasesRequest.encode, + decode: QueryLeasesResponse.decode, + service: "akash.market.v1beta2.Query", + method: "Leases", + deps: [QueryLeasesRequest, QueryLeasesResponse] +}); +/** + * Lease queries lease details + * @name getLease + * @package akash.market.v1beta2 + * @see proto service: akash.market.v1beta2.Lease + */ +export const getLease = buildQuery({ + encode: QueryLeaseRequest.encode, + decode: QueryLeaseResponse.decode, + service: "akash.market.v1beta2.Query", + method: "Lease", + deps: [QueryLeaseRequest, QueryLeaseResponse] +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/akash/market/v1beta2/query.ts b/__fixtures__/v-next/outputv2/akash/market/v1beta2/query.ts index 1f61f708c8..e4072d8867 100644 --- a/__fixtures__/v-next/outputv2/akash/market/v1beta2/query.ts +++ b/__fixtures__/v-next/outputv2/akash/market/v1beta2/query.ts @@ -4,6 +4,7 @@ import { BidFilters, BidFiltersAmino, BidFiltersSDKType, BidID, BidIDAmino, BidI import { LeaseFilters, LeaseFiltersAmino, LeaseFiltersSDKType, LeaseID, LeaseIDAmino, LeaseIDSDKType, Lease, LeaseAmino, LeaseSDKType } from "./lease"; import { Account, AccountAmino, AccountSDKType, FractionalPayment, FractionalPaymentAmino, FractionalPaymentSDKType } from "../../escrow/v1beta2/types"; import { BinaryReader, BinaryWriter } from "../../../binary"; +import { GlobalDecoderRegistry } from "../../../registry"; import { isSet, DeepPartial } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "akash.market.v1beta2"; @@ -465,6 +466,15 @@ function createBaseQueryOrdersRequest(): QueryOrdersRequest { */ export const QueryOrdersRequest = { typeUrl: "/akash.market.v1beta2.QueryOrdersRequest", + is(o: any): o is QueryOrdersRequest { + return o && (o.$typeUrl === QueryOrdersRequest.typeUrl || OrderFilters.is(o.filters)); + }, + isSDK(o: any): o is QueryOrdersRequestSDKType { + return o && (o.$typeUrl === QueryOrdersRequest.typeUrl || OrderFilters.isSDK(o.filters)); + }, + isAmino(o: any): o is QueryOrdersRequestAmino { + return o && (o.$typeUrl === QueryOrdersRequest.typeUrl || OrderFilters.isAmino(o.filters)); + }, encode(message: QueryOrdersRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.filters !== undefined) { OrderFilters.encode(message.filters, writer.uint32(10).fork()).ldelim(); @@ -558,6 +568,13 @@ export const QueryOrdersRequest = { typeUrl: "/akash.market.v1beta2.QueryOrdersRequest", value: QueryOrdersRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryOrdersRequest.typeUrl)) { + return; + } + OrderFilters.registerTypeUrl(); + PageRequest.registerTypeUrl(); } }; function createBaseQueryOrdersResponse(): QueryOrdersResponse { @@ -574,6 +591,15 @@ function createBaseQueryOrdersResponse(): QueryOrdersResponse { */ export const QueryOrdersResponse = { typeUrl: "/akash.market.v1beta2.QueryOrdersResponse", + is(o: any): o is QueryOrdersResponse { + return o && (o.$typeUrl === QueryOrdersResponse.typeUrl || Array.isArray(o.orders) && (!o.orders.length || Order.is(o.orders[0]))); + }, + isSDK(o: any): o is QueryOrdersResponseSDKType { + return o && (o.$typeUrl === QueryOrdersResponse.typeUrl || Array.isArray(o.orders) && (!o.orders.length || Order.isSDK(o.orders[0]))); + }, + isAmino(o: any): o is QueryOrdersResponseAmino { + return o && (o.$typeUrl === QueryOrdersResponse.typeUrl || Array.isArray(o.orders) && (!o.orders.length || Order.isAmino(o.orders[0]))); + }, encode(message: QueryOrdersResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.orders) { Order.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -675,6 +701,13 @@ export const QueryOrdersResponse = { typeUrl: "/akash.market.v1beta2.QueryOrdersResponse", value: QueryOrdersResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryOrdersResponse.typeUrl)) { + return; + } + Order.registerTypeUrl(); + PageResponse.registerTypeUrl(); } }; function createBaseQueryOrderRequest(): QueryOrderRequest { @@ -690,6 +723,15 @@ function createBaseQueryOrderRequest(): QueryOrderRequest { */ export const QueryOrderRequest = { typeUrl: "/akash.market.v1beta2.QueryOrderRequest", + is(o: any): o is QueryOrderRequest { + return o && (o.$typeUrl === QueryOrderRequest.typeUrl || OrderID.is(o.id)); + }, + isSDK(o: any): o is QueryOrderRequestSDKType { + return o && (o.$typeUrl === QueryOrderRequest.typeUrl || OrderID.isSDK(o.id)); + }, + isAmino(o: any): o is QueryOrderRequestAmino { + return o && (o.$typeUrl === QueryOrderRequest.typeUrl || OrderID.isAmino(o.id)); + }, encode(message: QueryOrderRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.id !== undefined) { OrderID.encode(message.id, writer.uint32(10).fork()).ldelim(); @@ -766,6 +808,12 @@ export const QueryOrderRequest = { typeUrl: "/akash.market.v1beta2.QueryOrderRequest", value: QueryOrderRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryOrderRequest.typeUrl)) { + return; + } + OrderID.registerTypeUrl(); } }; function createBaseQueryOrderResponse(): QueryOrderResponse { @@ -781,6 +829,15 @@ function createBaseQueryOrderResponse(): QueryOrderResponse { */ export const QueryOrderResponse = { typeUrl: "/akash.market.v1beta2.QueryOrderResponse", + is(o: any): o is QueryOrderResponse { + return o && (o.$typeUrl === QueryOrderResponse.typeUrl || Order.is(o.order)); + }, + isSDK(o: any): o is QueryOrderResponseSDKType { + return o && (o.$typeUrl === QueryOrderResponse.typeUrl || Order.isSDK(o.order)); + }, + isAmino(o: any): o is QueryOrderResponseAmino { + return o && (o.$typeUrl === QueryOrderResponse.typeUrl || Order.isAmino(o.order)); + }, encode(message: QueryOrderResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.order !== undefined) { Order.encode(message.order, writer.uint32(10).fork()).ldelim(); @@ -857,6 +914,12 @@ export const QueryOrderResponse = { typeUrl: "/akash.market.v1beta2.QueryOrderResponse", value: QueryOrderResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryOrderResponse.typeUrl)) { + return; + } + Order.registerTypeUrl(); } }; function createBaseQueryBidsRequest(): QueryBidsRequest { @@ -873,6 +936,15 @@ function createBaseQueryBidsRequest(): QueryBidsRequest { */ export const QueryBidsRequest = { typeUrl: "/akash.market.v1beta2.QueryBidsRequest", + is(o: any): o is QueryBidsRequest { + return o && (o.$typeUrl === QueryBidsRequest.typeUrl || BidFilters.is(o.filters)); + }, + isSDK(o: any): o is QueryBidsRequestSDKType { + return o && (o.$typeUrl === QueryBidsRequest.typeUrl || BidFilters.isSDK(o.filters)); + }, + isAmino(o: any): o is QueryBidsRequestAmino { + return o && (o.$typeUrl === QueryBidsRequest.typeUrl || BidFilters.isAmino(o.filters)); + }, encode(message: QueryBidsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.filters !== undefined) { BidFilters.encode(message.filters, writer.uint32(10).fork()).ldelim(); @@ -966,6 +1038,13 @@ export const QueryBidsRequest = { typeUrl: "/akash.market.v1beta2.QueryBidsRequest", value: QueryBidsRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryBidsRequest.typeUrl)) { + return; + } + BidFilters.registerTypeUrl(); + PageRequest.registerTypeUrl(); } }; function createBaseQueryBidsResponse(): QueryBidsResponse { @@ -982,6 +1061,15 @@ function createBaseQueryBidsResponse(): QueryBidsResponse { */ export const QueryBidsResponse = { typeUrl: "/akash.market.v1beta2.QueryBidsResponse", + is(o: any): o is QueryBidsResponse { + return o && (o.$typeUrl === QueryBidsResponse.typeUrl || Array.isArray(o.bids) && (!o.bids.length || QueryBidResponse.is(o.bids[0]))); + }, + isSDK(o: any): o is QueryBidsResponseSDKType { + return o && (o.$typeUrl === QueryBidsResponse.typeUrl || Array.isArray(o.bids) && (!o.bids.length || QueryBidResponse.isSDK(o.bids[0]))); + }, + isAmino(o: any): o is QueryBidsResponseAmino { + return o && (o.$typeUrl === QueryBidsResponse.typeUrl || Array.isArray(o.bids) && (!o.bids.length || QueryBidResponse.isAmino(o.bids[0]))); + }, encode(message: QueryBidsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.bids) { QueryBidResponse.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -1083,6 +1171,13 @@ export const QueryBidsResponse = { typeUrl: "/akash.market.v1beta2.QueryBidsResponse", value: QueryBidsResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryBidsResponse.typeUrl)) { + return; + } + QueryBidResponse.registerTypeUrl(); + PageResponse.registerTypeUrl(); } }; function createBaseQueryBidRequest(): QueryBidRequest { @@ -1098,6 +1193,15 @@ function createBaseQueryBidRequest(): QueryBidRequest { */ export const QueryBidRequest = { typeUrl: "/akash.market.v1beta2.QueryBidRequest", + is(o: any): o is QueryBidRequest { + return o && (o.$typeUrl === QueryBidRequest.typeUrl || BidID.is(o.id)); + }, + isSDK(o: any): o is QueryBidRequestSDKType { + return o && (o.$typeUrl === QueryBidRequest.typeUrl || BidID.isSDK(o.id)); + }, + isAmino(o: any): o is QueryBidRequestAmino { + return o && (o.$typeUrl === QueryBidRequest.typeUrl || BidID.isAmino(o.id)); + }, encode(message: QueryBidRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.id !== undefined) { BidID.encode(message.id, writer.uint32(10).fork()).ldelim(); @@ -1174,6 +1278,12 @@ export const QueryBidRequest = { typeUrl: "/akash.market.v1beta2.QueryBidRequest", value: QueryBidRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryBidRequest.typeUrl)) { + return; + } + BidID.registerTypeUrl(); } }; function createBaseQueryBidResponse(): QueryBidResponse { @@ -1190,6 +1300,15 @@ function createBaseQueryBidResponse(): QueryBidResponse { */ export const QueryBidResponse = { typeUrl: "/akash.market.v1beta2.QueryBidResponse", + is(o: any): o is QueryBidResponse { + return o && (o.$typeUrl === QueryBidResponse.typeUrl || Bid.is(o.bid) && Account.is(o.escrowAccount)); + }, + isSDK(o: any): o is QueryBidResponseSDKType { + return o && (o.$typeUrl === QueryBidResponse.typeUrl || Bid.isSDK(o.bid) && Account.isSDK(o.escrow_account)); + }, + isAmino(o: any): o is QueryBidResponseAmino { + return o && (o.$typeUrl === QueryBidResponse.typeUrl || Bid.isAmino(o.bid) && Account.isAmino(o.escrow_account)); + }, encode(message: QueryBidResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.bid !== undefined) { Bid.encode(message.bid, writer.uint32(10).fork()).ldelim(); @@ -1283,6 +1402,13 @@ export const QueryBidResponse = { typeUrl: "/akash.market.v1beta2.QueryBidResponse", value: QueryBidResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryBidResponse.typeUrl)) { + return; + } + Bid.registerTypeUrl(); + Account.registerTypeUrl(); } }; function createBaseQueryLeasesRequest(): QueryLeasesRequest { @@ -1299,6 +1425,15 @@ function createBaseQueryLeasesRequest(): QueryLeasesRequest { */ export const QueryLeasesRequest = { typeUrl: "/akash.market.v1beta2.QueryLeasesRequest", + is(o: any): o is QueryLeasesRequest { + return o && (o.$typeUrl === QueryLeasesRequest.typeUrl || LeaseFilters.is(o.filters)); + }, + isSDK(o: any): o is QueryLeasesRequestSDKType { + return o && (o.$typeUrl === QueryLeasesRequest.typeUrl || LeaseFilters.isSDK(o.filters)); + }, + isAmino(o: any): o is QueryLeasesRequestAmino { + return o && (o.$typeUrl === QueryLeasesRequest.typeUrl || LeaseFilters.isAmino(o.filters)); + }, encode(message: QueryLeasesRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.filters !== undefined) { LeaseFilters.encode(message.filters, writer.uint32(10).fork()).ldelim(); @@ -1392,6 +1527,13 @@ export const QueryLeasesRequest = { typeUrl: "/akash.market.v1beta2.QueryLeasesRequest", value: QueryLeasesRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryLeasesRequest.typeUrl)) { + return; + } + LeaseFilters.registerTypeUrl(); + PageRequest.registerTypeUrl(); } }; function createBaseQueryLeasesResponse(): QueryLeasesResponse { @@ -1408,6 +1550,15 @@ function createBaseQueryLeasesResponse(): QueryLeasesResponse { */ export const QueryLeasesResponse = { typeUrl: "/akash.market.v1beta2.QueryLeasesResponse", + is(o: any): o is QueryLeasesResponse { + return o && (o.$typeUrl === QueryLeasesResponse.typeUrl || Array.isArray(o.leases) && (!o.leases.length || QueryLeaseResponse.is(o.leases[0]))); + }, + isSDK(o: any): o is QueryLeasesResponseSDKType { + return o && (o.$typeUrl === QueryLeasesResponse.typeUrl || Array.isArray(o.leases) && (!o.leases.length || QueryLeaseResponse.isSDK(o.leases[0]))); + }, + isAmino(o: any): o is QueryLeasesResponseAmino { + return o && (o.$typeUrl === QueryLeasesResponse.typeUrl || Array.isArray(o.leases) && (!o.leases.length || QueryLeaseResponse.isAmino(o.leases[0]))); + }, encode(message: QueryLeasesResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.leases) { QueryLeaseResponse.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -1509,6 +1660,13 @@ export const QueryLeasesResponse = { typeUrl: "/akash.market.v1beta2.QueryLeasesResponse", value: QueryLeasesResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryLeasesResponse.typeUrl)) { + return; + } + QueryLeaseResponse.registerTypeUrl(); + PageResponse.registerTypeUrl(); } }; function createBaseQueryLeaseRequest(): QueryLeaseRequest { @@ -1524,6 +1682,15 @@ function createBaseQueryLeaseRequest(): QueryLeaseRequest { */ export const QueryLeaseRequest = { typeUrl: "/akash.market.v1beta2.QueryLeaseRequest", + is(o: any): o is QueryLeaseRequest { + return o && (o.$typeUrl === QueryLeaseRequest.typeUrl || LeaseID.is(o.id)); + }, + isSDK(o: any): o is QueryLeaseRequestSDKType { + return o && (o.$typeUrl === QueryLeaseRequest.typeUrl || LeaseID.isSDK(o.id)); + }, + isAmino(o: any): o is QueryLeaseRequestAmino { + return o && (o.$typeUrl === QueryLeaseRequest.typeUrl || LeaseID.isAmino(o.id)); + }, encode(message: QueryLeaseRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.id !== undefined) { LeaseID.encode(message.id, writer.uint32(10).fork()).ldelim(); @@ -1600,6 +1767,12 @@ export const QueryLeaseRequest = { typeUrl: "/akash.market.v1beta2.QueryLeaseRequest", value: QueryLeaseRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryLeaseRequest.typeUrl)) { + return; + } + LeaseID.registerTypeUrl(); } }; function createBaseQueryLeaseResponse(): QueryLeaseResponse { @@ -1616,6 +1789,15 @@ function createBaseQueryLeaseResponse(): QueryLeaseResponse { */ export const QueryLeaseResponse = { typeUrl: "/akash.market.v1beta2.QueryLeaseResponse", + is(o: any): o is QueryLeaseResponse { + return o && (o.$typeUrl === QueryLeaseResponse.typeUrl || Lease.is(o.lease) && FractionalPayment.is(o.escrowPayment)); + }, + isSDK(o: any): o is QueryLeaseResponseSDKType { + return o && (o.$typeUrl === QueryLeaseResponse.typeUrl || Lease.isSDK(o.lease) && FractionalPayment.isSDK(o.escrow_payment)); + }, + isAmino(o: any): o is QueryLeaseResponseAmino { + return o && (o.$typeUrl === QueryLeaseResponse.typeUrl || Lease.isAmino(o.lease) && FractionalPayment.isAmino(o.escrow_payment)); + }, encode(message: QueryLeaseResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.lease !== undefined) { Lease.encode(message.lease, writer.uint32(10).fork()).ldelim(); @@ -1709,5 +1891,12 @@ export const QueryLeaseResponse = { typeUrl: "/akash.market.v1beta2.QueryLeaseResponse", value: QueryLeaseResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryLeaseResponse.typeUrl)) { + return; + } + Lease.registerTypeUrl(); + FractionalPayment.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/akash/market/v1beta2/service.registry.ts b/__fixtures__/v-next/outputv2/akash/market/v1beta2/service.registry.ts index e19e31637d..3047d649ca 100644 --- a/__fixtures__/v-next/outputv2/akash/market/v1beta2/service.registry.ts +++ b/__fixtures__/v-next/outputv2/akash/market/v1beta2/service.registry.ts @@ -1,12 +1,7 @@ import { MsgCreateBid, MsgCloseBid } from "./bid"; import { MsgWithdrawLease, MsgCreateLease, MsgCloseLease } from "./lease"; -import { GeneratedType, Registry } from "@cosmjs/proto-signing"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/akash.market.v1beta2.MsgCreateBid", MsgCreateBid], ["/akash.market.v1beta2.MsgCloseBid", MsgCloseBid], ["/akash.market.v1beta2.MsgWithdrawLease", MsgWithdrawLease], ["/akash.market.v1beta2.MsgCreateLease", MsgCreateLease], ["/akash.market.v1beta2.MsgCloseLease", MsgCloseLease]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; +import { TelescopeGeneratedType } from "../../../types"; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/akash.market.v1beta2.MsgCreateBid", MsgCreateBid], ["/akash.market.v1beta2.MsgCloseBid", MsgCloseBid], ["/akash.market.v1beta2.MsgWithdrawLease", MsgWithdrawLease], ["/akash.market.v1beta2.MsgCreateLease", MsgCreateLease], ["/akash.market.v1beta2.MsgCloseLease", MsgCloseLease]]; export const MessageComposer = { encoded: { createBid(value: MsgCreateBid) { diff --git a/__fixtures__/v-next/outputv2/akash/market/v1beta2/service.rpc.func.ts b/__fixtures__/v-next/outputv2/akash/market/v1beta2/service.rpc.func.ts new file mode 100644 index 0000000000..08458908d1 --- /dev/null +++ b/__fixtures__/v-next/outputv2/akash/market/v1beta2/service.rpc.func.ts @@ -0,0 +1,48 @@ +import { MsgCreateBid, MsgCloseBid } from "./bid"; +import { MsgWithdrawLease, MsgCreateLease, MsgCloseLease } from "./lease"; +import { buildTx } from "../../../helper-func-types"; +/** + * CreateBid defines a method to create a bid given proper inputs. + * @name createBid + * @package akash.market.v1beta2 + * @see proto service: akash.market.v1beta2.CreateBid + */ +export const createBid = buildTx({ + msg: MsgCreateBid +}); +/** + * CloseBid defines a method to close a bid given proper inputs. + * @name closeBid + * @package akash.market.v1beta2 + * @see proto service: akash.market.v1beta2.CloseBid + */ +export const closeBid = buildTx({ + msg: MsgCloseBid +}); +/** + * WithdrawLease withdraws accrued funds from the lease payment + * @name withdrawLease + * @package akash.market.v1beta2 + * @see proto service: akash.market.v1beta2.WithdrawLease + */ +export const withdrawLease = buildTx({ + msg: MsgWithdrawLease +}); +/** + * CreateLease creates a new lease + * @name createLease + * @package akash.market.v1beta2 + * @see proto service: akash.market.v1beta2.CreateLease + */ +export const createLease = buildTx({ + msg: MsgCreateLease +}); +/** + * CloseLease defines a method to close an order given proper inputs. + * @name closeLease + * @package akash.market.v1beta2 + * @see proto service: akash.market.v1beta2.CloseLease + */ +export const closeLease = buildTx({ + msg: MsgCloseLease +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/akash/provider/v1beta1/provider.registry.ts b/__fixtures__/v-next/outputv2/akash/provider/v1beta1/provider.registry.ts index cf59c4c130..49d7c508e0 100644 --- a/__fixtures__/v-next/outputv2/akash/provider/v1beta1/provider.registry.ts +++ b/__fixtures__/v-next/outputv2/akash/provider/v1beta1/provider.registry.ts @@ -1,11 +1,6 @@ -import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { TelescopeGeneratedType } from "../../../types"; import { MsgCreateProvider, MsgUpdateProvider, MsgDeleteProvider } from "./provider"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/akash.provider.v1beta1.MsgCreateProvider", MsgCreateProvider], ["/akash.provider.v1beta1.MsgUpdateProvider", MsgUpdateProvider], ["/akash.provider.v1beta1.MsgDeleteProvider", MsgDeleteProvider]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/akash.provider.v1beta1.MsgCreateProvider", MsgCreateProvider], ["/akash.provider.v1beta1.MsgUpdateProvider", MsgUpdateProvider], ["/akash.provider.v1beta1.MsgDeleteProvider", MsgDeleteProvider]]; export const MessageComposer = { encoded: { createProvider(value: MsgCreateProvider) { diff --git a/__fixtures__/v-next/outputv2/akash/provider/v1beta1/provider.rpc.func.ts b/__fixtures__/v-next/outputv2/akash/provider/v1beta1/provider.rpc.func.ts new file mode 100644 index 0000000000..7c379423ab --- /dev/null +++ b/__fixtures__/v-next/outputv2/akash/provider/v1beta1/provider.rpc.func.ts @@ -0,0 +1,29 @@ +import { buildTx } from "../../../helper-func-types"; +import { MsgCreateProvider, MsgUpdateProvider, MsgDeleteProvider } from "./provider"; +/** + * CreateProvider defines a method that creates a provider given the proper inputs + * @name createProvider + * @package akash.provider.v1beta1 + * @see proto service: akash.provider.v1beta1.CreateProvider + */ +export const createProvider = buildTx({ + msg: MsgCreateProvider +}); +/** + * UpdateProvider defines a method that updates a provider given the proper inputs + * @name updateProvider + * @package akash.provider.v1beta1 + * @see proto service: akash.provider.v1beta1.UpdateProvider + */ +export const updateProvider = buildTx({ + msg: MsgUpdateProvider +}); +/** + * DeleteProvider defines a method that deletes a provider given the proper inputs + * @name deleteProvider + * @package akash.provider.v1beta1 + * @see proto service: akash.provider.v1beta1.DeleteProvider + */ +export const deleteProvider = buildTx({ + msg: MsgDeleteProvider +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/akash/provider/v1beta1/provider.ts b/__fixtures__/v-next/outputv2/akash/provider/v1beta1/provider.ts index e6c2c67c7c..e9f32321a1 100644 --- a/__fixtures__/v-next/outputv2/akash/provider/v1beta1/provider.ts +++ b/__fixtures__/v-next/outputv2/akash/provider/v1beta1/provider.ts @@ -2,6 +2,7 @@ import { Attribute, AttributeAmino, AttributeSDKType } from "../../base/v1beta1/ import { BinaryReader, BinaryWriter } from "../../../binary"; import { isSet, DeepPartial } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "akash.provider.v1beta1"; /** * ProviderInfo @@ -309,6 +310,15 @@ function createBaseProviderInfo(): ProviderInfo { */ export const ProviderInfo = { typeUrl: "/akash.provider.v1beta1.ProviderInfo", + is(o: any): o is ProviderInfo { + return o && (o.$typeUrl === ProviderInfo.typeUrl || typeof o.email === "string" && typeof o.website === "string"); + }, + isSDK(o: any): o is ProviderInfoSDKType { + return o && (o.$typeUrl === ProviderInfo.typeUrl || typeof o.email === "string" && typeof o.website === "string"); + }, + isAmino(o: any): o is ProviderInfoAmino { + return o && (o.$typeUrl === ProviderInfo.typeUrl || typeof o.email === "string" && typeof o.website === "string"); + }, encode(message: ProviderInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.email !== "") { writer.uint32(10).string(message.email); @@ -398,7 +408,8 @@ export const ProviderInfo = { typeUrl: "/akash.provider.v1beta1.ProviderInfo", value: ProviderInfo.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgCreateProvider(): MsgCreateProvider { return { @@ -416,6 +427,15 @@ function createBaseMsgCreateProvider(): MsgCreateProvider { */ export const MsgCreateProvider = { typeUrl: "/akash.provider.v1beta1.MsgCreateProvider", + is(o: any): o is MsgCreateProvider { + return o && (o.$typeUrl === MsgCreateProvider.typeUrl || typeof o.owner === "string" && typeof o.hostUri === "string" && Array.isArray(o.attributes) && (!o.attributes.length || Attribute.is(o.attributes[0])) && ProviderInfo.is(o.info)); + }, + isSDK(o: any): o is MsgCreateProviderSDKType { + return o && (o.$typeUrl === MsgCreateProvider.typeUrl || typeof o.owner === "string" && typeof o.host_uri === "string" && Array.isArray(o.attributes) && (!o.attributes.length || Attribute.isSDK(o.attributes[0])) && ProviderInfo.isSDK(o.info)); + }, + isAmino(o: any): o is MsgCreateProviderAmino { + return o && (o.$typeUrl === MsgCreateProvider.typeUrl || typeof o.owner === "string" && typeof o.host_uri === "string" && Array.isArray(o.attributes) && (!o.attributes.length || Attribute.isAmino(o.attributes[0])) && ProviderInfo.isAmino(o.info)); + }, encode(message: MsgCreateProvider, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.owner !== "") { writer.uint32(10).string(message.owner); @@ -547,6 +567,13 @@ export const MsgCreateProvider = { typeUrl: "/akash.provider.v1beta1.MsgCreateProvider", value: MsgCreateProvider.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgCreateProvider.typeUrl)) { + return; + } + Attribute.registerTypeUrl(); + ProviderInfo.registerTypeUrl(); } }; function createBaseMsgCreateProviderResponse(): MsgCreateProviderResponse { @@ -560,6 +587,15 @@ function createBaseMsgCreateProviderResponse(): MsgCreateProviderResponse { */ export const MsgCreateProviderResponse = { typeUrl: "/akash.provider.v1beta1.MsgCreateProviderResponse", + is(o: any): o is MsgCreateProviderResponse { + return o && o.$typeUrl === MsgCreateProviderResponse.typeUrl; + }, + isSDK(o: any): o is MsgCreateProviderResponseSDKType { + return o && o.$typeUrl === MsgCreateProviderResponse.typeUrl; + }, + isAmino(o: any): o is MsgCreateProviderResponseAmino { + return o && o.$typeUrl === MsgCreateProviderResponse.typeUrl; + }, encode(_: MsgCreateProviderResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -618,7 +654,8 @@ export const MsgCreateProviderResponse = { typeUrl: "/akash.provider.v1beta1.MsgCreateProviderResponse", value: MsgCreateProviderResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgUpdateProvider(): MsgUpdateProvider { return { @@ -636,6 +673,15 @@ function createBaseMsgUpdateProvider(): MsgUpdateProvider { */ export const MsgUpdateProvider = { typeUrl: "/akash.provider.v1beta1.MsgUpdateProvider", + is(o: any): o is MsgUpdateProvider { + return o && (o.$typeUrl === MsgUpdateProvider.typeUrl || typeof o.owner === "string" && typeof o.hostUri === "string" && Array.isArray(o.attributes) && (!o.attributes.length || Attribute.is(o.attributes[0])) && ProviderInfo.is(o.info)); + }, + isSDK(o: any): o is MsgUpdateProviderSDKType { + return o && (o.$typeUrl === MsgUpdateProvider.typeUrl || typeof o.owner === "string" && typeof o.host_uri === "string" && Array.isArray(o.attributes) && (!o.attributes.length || Attribute.isSDK(o.attributes[0])) && ProviderInfo.isSDK(o.info)); + }, + isAmino(o: any): o is MsgUpdateProviderAmino { + return o && (o.$typeUrl === MsgUpdateProvider.typeUrl || typeof o.owner === "string" && typeof o.host_uri === "string" && Array.isArray(o.attributes) && (!o.attributes.length || Attribute.isAmino(o.attributes[0])) && ProviderInfo.isAmino(o.info)); + }, encode(message: MsgUpdateProvider, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.owner !== "") { writer.uint32(10).string(message.owner); @@ -767,6 +813,13 @@ export const MsgUpdateProvider = { typeUrl: "/akash.provider.v1beta1.MsgUpdateProvider", value: MsgUpdateProvider.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgUpdateProvider.typeUrl)) { + return; + } + Attribute.registerTypeUrl(); + ProviderInfo.registerTypeUrl(); } }; function createBaseMsgUpdateProviderResponse(): MsgUpdateProviderResponse { @@ -780,6 +833,15 @@ function createBaseMsgUpdateProviderResponse(): MsgUpdateProviderResponse { */ export const MsgUpdateProviderResponse = { typeUrl: "/akash.provider.v1beta1.MsgUpdateProviderResponse", + is(o: any): o is MsgUpdateProviderResponse { + return o && o.$typeUrl === MsgUpdateProviderResponse.typeUrl; + }, + isSDK(o: any): o is MsgUpdateProviderResponseSDKType { + return o && o.$typeUrl === MsgUpdateProviderResponse.typeUrl; + }, + isAmino(o: any): o is MsgUpdateProviderResponseAmino { + return o && o.$typeUrl === MsgUpdateProviderResponse.typeUrl; + }, encode(_: MsgUpdateProviderResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -838,7 +900,8 @@ export const MsgUpdateProviderResponse = { typeUrl: "/akash.provider.v1beta1.MsgUpdateProviderResponse", value: MsgUpdateProviderResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgDeleteProvider(): MsgDeleteProvider { return { @@ -853,6 +916,15 @@ function createBaseMsgDeleteProvider(): MsgDeleteProvider { */ export const MsgDeleteProvider = { typeUrl: "/akash.provider.v1beta1.MsgDeleteProvider", + is(o: any): o is MsgDeleteProvider { + return o && (o.$typeUrl === MsgDeleteProvider.typeUrl || typeof o.owner === "string"); + }, + isSDK(o: any): o is MsgDeleteProviderSDKType { + return o && (o.$typeUrl === MsgDeleteProvider.typeUrl || typeof o.owner === "string"); + }, + isAmino(o: any): o is MsgDeleteProviderAmino { + return o && (o.$typeUrl === MsgDeleteProvider.typeUrl || typeof o.owner === "string"); + }, encode(message: MsgDeleteProvider, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.owner !== "") { writer.uint32(10).string(message.owner); @@ -927,7 +999,8 @@ export const MsgDeleteProvider = { typeUrl: "/akash.provider.v1beta1.MsgDeleteProvider", value: MsgDeleteProvider.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgDeleteProviderResponse(): MsgDeleteProviderResponse { return {}; @@ -940,6 +1013,15 @@ function createBaseMsgDeleteProviderResponse(): MsgDeleteProviderResponse { */ export const MsgDeleteProviderResponse = { typeUrl: "/akash.provider.v1beta1.MsgDeleteProviderResponse", + is(o: any): o is MsgDeleteProviderResponse { + return o && o.$typeUrl === MsgDeleteProviderResponse.typeUrl; + }, + isSDK(o: any): o is MsgDeleteProviderResponseSDKType { + return o && o.$typeUrl === MsgDeleteProviderResponse.typeUrl; + }, + isAmino(o: any): o is MsgDeleteProviderResponseAmino { + return o && o.$typeUrl === MsgDeleteProviderResponse.typeUrl; + }, encode(_: MsgDeleteProviderResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -998,7 +1080,8 @@ export const MsgDeleteProviderResponse = { typeUrl: "/akash.provider.v1beta1.MsgDeleteProviderResponse", value: MsgDeleteProviderResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseProvider(): Provider { return { @@ -1016,6 +1099,15 @@ function createBaseProvider(): Provider { */ export const Provider = { typeUrl: "/akash.provider.v1beta1.Provider", + is(o: any): o is Provider { + return o && (o.$typeUrl === Provider.typeUrl || typeof o.owner === "string" && typeof o.hostUri === "string" && Array.isArray(o.attributes) && (!o.attributes.length || Attribute.is(o.attributes[0])) && ProviderInfo.is(o.info)); + }, + isSDK(o: any): o is ProviderSDKType { + return o && (o.$typeUrl === Provider.typeUrl || typeof o.owner === "string" && typeof o.host_uri === "string" && Array.isArray(o.attributes) && (!o.attributes.length || Attribute.isSDK(o.attributes[0])) && ProviderInfo.isSDK(o.info)); + }, + isAmino(o: any): o is ProviderAmino { + return o && (o.$typeUrl === Provider.typeUrl || typeof o.owner === "string" && typeof o.host_uri === "string" && Array.isArray(o.attributes) && (!o.attributes.length || Attribute.isAmino(o.attributes[0])) && ProviderInfo.isAmino(o.info)); + }, encode(message: Provider, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.owner !== "") { writer.uint32(10).string(message.owner); @@ -1147,5 +1239,12 @@ export const Provider = { typeUrl: "/akash.provider.v1beta1.Provider", value: Provider.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Provider.typeUrl)) { + return; + } + Attribute.registerTypeUrl(); + ProviderInfo.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/akash/provider/v1beta2/genesis.ts b/__fixtures__/v-next/outputv2/akash/provider/v1beta2/genesis.ts index bcfd5bdb82..9b76e83e3b 100644 --- a/__fixtures__/v-next/outputv2/akash/provider/v1beta2/genesis.ts +++ b/__fixtures__/v-next/outputv2/akash/provider/v1beta2/genesis.ts @@ -2,6 +2,7 @@ import { Provider, ProviderAmino, ProviderSDKType } from "./provider"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { JsonSafe } from "../../../json-safe"; import { DeepPartial } from "../../../helpers"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "akash.provider.v1beta2"; /** * GenesisState defines the basic genesis state used by provider module @@ -51,6 +52,15 @@ function createBaseGenesisState(): GenesisState { */ export const GenesisState = { typeUrl: "/akash.provider.v1beta2.GenesisState", + is(o: any): o is GenesisState { + return o && (o.$typeUrl === GenesisState.typeUrl || Array.isArray(o.providers) && (!o.providers.length || Provider.is(o.providers[0]))); + }, + isSDK(o: any): o is GenesisStateSDKType { + return o && (o.$typeUrl === GenesisState.typeUrl || Array.isArray(o.providers) && (!o.providers.length || Provider.isSDK(o.providers[0]))); + }, + isAmino(o: any): o is GenesisStateAmino { + return o && (o.$typeUrl === GenesisState.typeUrl || Array.isArray(o.providers) && (!o.providers.length || Provider.isAmino(o.providers[0]))); + }, encode(message: GenesisState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.providers) { Provider.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -135,5 +145,11 @@ export const GenesisState = { typeUrl: "/akash.provider.v1beta2.GenesisState", value: GenesisState.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GenesisState.typeUrl)) { + return; + } + Provider.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/akash/provider/v1beta2/provider.registry.ts b/__fixtures__/v-next/outputv2/akash/provider/v1beta2/provider.registry.ts index 8ff12099e0..bf9c81b9a3 100644 --- a/__fixtures__/v-next/outputv2/akash/provider/v1beta2/provider.registry.ts +++ b/__fixtures__/v-next/outputv2/akash/provider/v1beta2/provider.registry.ts @@ -1,11 +1,6 @@ -import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { TelescopeGeneratedType } from "../../../types"; import { MsgCreateProvider, MsgUpdateProvider, MsgDeleteProvider } from "./provider"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/akash.provider.v1beta2.MsgCreateProvider", MsgCreateProvider], ["/akash.provider.v1beta2.MsgUpdateProvider", MsgUpdateProvider], ["/akash.provider.v1beta2.MsgDeleteProvider", MsgDeleteProvider]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/akash.provider.v1beta2.MsgCreateProvider", MsgCreateProvider], ["/akash.provider.v1beta2.MsgUpdateProvider", MsgUpdateProvider], ["/akash.provider.v1beta2.MsgDeleteProvider", MsgDeleteProvider]]; export const MessageComposer = { encoded: { createProvider(value: MsgCreateProvider) { diff --git a/__fixtures__/v-next/outputv2/akash/provider/v1beta2/provider.rpc.func.ts b/__fixtures__/v-next/outputv2/akash/provider/v1beta2/provider.rpc.func.ts new file mode 100644 index 0000000000..9692efc275 --- /dev/null +++ b/__fixtures__/v-next/outputv2/akash/provider/v1beta2/provider.rpc.func.ts @@ -0,0 +1,29 @@ +import { buildTx } from "../../../helper-func-types"; +import { MsgCreateProvider, MsgUpdateProvider, MsgDeleteProvider } from "./provider"; +/** + * CreateProvider defines a method that creates a provider given the proper inputs + * @name createProvider + * @package akash.provider.v1beta2 + * @see proto service: akash.provider.v1beta2.CreateProvider + */ +export const createProvider = buildTx({ + msg: MsgCreateProvider +}); +/** + * UpdateProvider defines a method that updates a provider given the proper inputs + * @name updateProvider + * @package akash.provider.v1beta2 + * @see proto service: akash.provider.v1beta2.UpdateProvider + */ +export const updateProvider = buildTx({ + msg: MsgUpdateProvider +}); +/** + * DeleteProvider defines a method that deletes a provider given the proper inputs + * @name deleteProvider + * @package akash.provider.v1beta2 + * @see proto service: akash.provider.v1beta2.DeleteProvider + */ +export const deleteProvider = buildTx({ + msg: MsgDeleteProvider +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/akash/provider/v1beta2/provider.ts b/__fixtures__/v-next/outputv2/akash/provider/v1beta2/provider.ts index f7ad42e9ae..005c56c388 100644 --- a/__fixtures__/v-next/outputv2/akash/provider/v1beta2/provider.ts +++ b/__fixtures__/v-next/outputv2/akash/provider/v1beta2/provider.ts @@ -2,6 +2,7 @@ import { Attribute, AttributeAmino, AttributeSDKType } from "../../base/v1beta2/ import { BinaryReader, BinaryWriter } from "../../../binary"; import { isSet, DeepPartial } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "akash.provider.v1beta2"; /** * ProviderInfo @@ -309,6 +310,15 @@ function createBaseProviderInfo(): ProviderInfo { */ export const ProviderInfo = { typeUrl: "/akash.provider.v1beta2.ProviderInfo", + is(o: any): o is ProviderInfo { + return o && (o.$typeUrl === ProviderInfo.typeUrl || typeof o.email === "string" && typeof o.website === "string"); + }, + isSDK(o: any): o is ProviderInfoSDKType { + return o && (o.$typeUrl === ProviderInfo.typeUrl || typeof o.email === "string" && typeof o.website === "string"); + }, + isAmino(o: any): o is ProviderInfoAmino { + return o && (o.$typeUrl === ProviderInfo.typeUrl || typeof o.email === "string" && typeof o.website === "string"); + }, encode(message: ProviderInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.email !== "") { writer.uint32(10).string(message.email); @@ -398,7 +408,8 @@ export const ProviderInfo = { typeUrl: "/akash.provider.v1beta2.ProviderInfo", value: ProviderInfo.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgCreateProvider(): MsgCreateProvider { return { @@ -416,6 +427,15 @@ function createBaseMsgCreateProvider(): MsgCreateProvider { */ export const MsgCreateProvider = { typeUrl: "/akash.provider.v1beta2.MsgCreateProvider", + is(o: any): o is MsgCreateProvider { + return o && (o.$typeUrl === MsgCreateProvider.typeUrl || typeof o.owner === "string" && typeof o.hostUri === "string" && Array.isArray(o.attributes) && (!o.attributes.length || Attribute.is(o.attributes[0])) && ProviderInfo.is(o.info)); + }, + isSDK(o: any): o is MsgCreateProviderSDKType { + return o && (o.$typeUrl === MsgCreateProvider.typeUrl || typeof o.owner === "string" && typeof o.host_uri === "string" && Array.isArray(o.attributes) && (!o.attributes.length || Attribute.isSDK(o.attributes[0])) && ProviderInfo.isSDK(o.info)); + }, + isAmino(o: any): o is MsgCreateProviderAmino { + return o && (o.$typeUrl === MsgCreateProvider.typeUrl || typeof o.owner === "string" && typeof o.host_uri === "string" && Array.isArray(o.attributes) && (!o.attributes.length || Attribute.isAmino(o.attributes[0])) && ProviderInfo.isAmino(o.info)); + }, encode(message: MsgCreateProvider, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.owner !== "") { writer.uint32(10).string(message.owner); @@ -547,6 +567,13 @@ export const MsgCreateProvider = { typeUrl: "/akash.provider.v1beta2.MsgCreateProvider", value: MsgCreateProvider.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgCreateProvider.typeUrl)) { + return; + } + Attribute.registerTypeUrl(); + ProviderInfo.registerTypeUrl(); } }; function createBaseMsgCreateProviderResponse(): MsgCreateProviderResponse { @@ -560,6 +587,15 @@ function createBaseMsgCreateProviderResponse(): MsgCreateProviderResponse { */ export const MsgCreateProviderResponse = { typeUrl: "/akash.provider.v1beta2.MsgCreateProviderResponse", + is(o: any): o is MsgCreateProviderResponse { + return o && o.$typeUrl === MsgCreateProviderResponse.typeUrl; + }, + isSDK(o: any): o is MsgCreateProviderResponseSDKType { + return o && o.$typeUrl === MsgCreateProviderResponse.typeUrl; + }, + isAmino(o: any): o is MsgCreateProviderResponseAmino { + return o && o.$typeUrl === MsgCreateProviderResponse.typeUrl; + }, encode(_: MsgCreateProviderResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -618,7 +654,8 @@ export const MsgCreateProviderResponse = { typeUrl: "/akash.provider.v1beta2.MsgCreateProviderResponse", value: MsgCreateProviderResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgUpdateProvider(): MsgUpdateProvider { return { @@ -636,6 +673,15 @@ function createBaseMsgUpdateProvider(): MsgUpdateProvider { */ export const MsgUpdateProvider = { typeUrl: "/akash.provider.v1beta2.MsgUpdateProvider", + is(o: any): o is MsgUpdateProvider { + return o && (o.$typeUrl === MsgUpdateProvider.typeUrl || typeof o.owner === "string" && typeof o.hostUri === "string" && Array.isArray(o.attributes) && (!o.attributes.length || Attribute.is(o.attributes[0])) && ProviderInfo.is(o.info)); + }, + isSDK(o: any): o is MsgUpdateProviderSDKType { + return o && (o.$typeUrl === MsgUpdateProvider.typeUrl || typeof o.owner === "string" && typeof o.host_uri === "string" && Array.isArray(o.attributes) && (!o.attributes.length || Attribute.isSDK(o.attributes[0])) && ProviderInfo.isSDK(o.info)); + }, + isAmino(o: any): o is MsgUpdateProviderAmino { + return o && (o.$typeUrl === MsgUpdateProvider.typeUrl || typeof o.owner === "string" && typeof o.host_uri === "string" && Array.isArray(o.attributes) && (!o.attributes.length || Attribute.isAmino(o.attributes[0])) && ProviderInfo.isAmino(o.info)); + }, encode(message: MsgUpdateProvider, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.owner !== "") { writer.uint32(10).string(message.owner); @@ -767,6 +813,13 @@ export const MsgUpdateProvider = { typeUrl: "/akash.provider.v1beta2.MsgUpdateProvider", value: MsgUpdateProvider.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgUpdateProvider.typeUrl)) { + return; + } + Attribute.registerTypeUrl(); + ProviderInfo.registerTypeUrl(); } }; function createBaseMsgUpdateProviderResponse(): MsgUpdateProviderResponse { @@ -780,6 +833,15 @@ function createBaseMsgUpdateProviderResponse(): MsgUpdateProviderResponse { */ export const MsgUpdateProviderResponse = { typeUrl: "/akash.provider.v1beta2.MsgUpdateProviderResponse", + is(o: any): o is MsgUpdateProviderResponse { + return o && o.$typeUrl === MsgUpdateProviderResponse.typeUrl; + }, + isSDK(o: any): o is MsgUpdateProviderResponseSDKType { + return o && o.$typeUrl === MsgUpdateProviderResponse.typeUrl; + }, + isAmino(o: any): o is MsgUpdateProviderResponseAmino { + return o && o.$typeUrl === MsgUpdateProviderResponse.typeUrl; + }, encode(_: MsgUpdateProviderResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -838,7 +900,8 @@ export const MsgUpdateProviderResponse = { typeUrl: "/akash.provider.v1beta2.MsgUpdateProviderResponse", value: MsgUpdateProviderResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgDeleteProvider(): MsgDeleteProvider { return { @@ -853,6 +916,15 @@ function createBaseMsgDeleteProvider(): MsgDeleteProvider { */ export const MsgDeleteProvider = { typeUrl: "/akash.provider.v1beta2.MsgDeleteProvider", + is(o: any): o is MsgDeleteProvider { + return o && (o.$typeUrl === MsgDeleteProvider.typeUrl || typeof o.owner === "string"); + }, + isSDK(o: any): o is MsgDeleteProviderSDKType { + return o && (o.$typeUrl === MsgDeleteProvider.typeUrl || typeof o.owner === "string"); + }, + isAmino(o: any): o is MsgDeleteProviderAmino { + return o && (o.$typeUrl === MsgDeleteProvider.typeUrl || typeof o.owner === "string"); + }, encode(message: MsgDeleteProvider, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.owner !== "") { writer.uint32(10).string(message.owner); @@ -927,7 +999,8 @@ export const MsgDeleteProvider = { typeUrl: "/akash.provider.v1beta2.MsgDeleteProvider", value: MsgDeleteProvider.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgDeleteProviderResponse(): MsgDeleteProviderResponse { return {}; @@ -940,6 +1013,15 @@ function createBaseMsgDeleteProviderResponse(): MsgDeleteProviderResponse { */ export const MsgDeleteProviderResponse = { typeUrl: "/akash.provider.v1beta2.MsgDeleteProviderResponse", + is(o: any): o is MsgDeleteProviderResponse { + return o && o.$typeUrl === MsgDeleteProviderResponse.typeUrl; + }, + isSDK(o: any): o is MsgDeleteProviderResponseSDKType { + return o && o.$typeUrl === MsgDeleteProviderResponse.typeUrl; + }, + isAmino(o: any): o is MsgDeleteProviderResponseAmino { + return o && o.$typeUrl === MsgDeleteProviderResponse.typeUrl; + }, encode(_: MsgDeleteProviderResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -998,7 +1080,8 @@ export const MsgDeleteProviderResponse = { typeUrl: "/akash.provider.v1beta2.MsgDeleteProviderResponse", value: MsgDeleteProviderResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseProvider(): Provider { return { @@ -1016,6 +1099,15 @@ function createBaseProvider(): Provider { */ export const Provider = { typeUrl: "/akash.provider.v1beta2.Provider", + is(o: any): o is Provider { + return o && (o.$typeUrl === Provider.typeUrl || typeof o.owner === "string" && typeof o.hostUri === "string" && Array.isArray(o.attributes) && (!o.attributes.length || Attribute.is(o.attributes[0])) && ProviderInfo.is(o.info)); + }, + isSDK(o: any): o is ProviderSDKType { + return o && (o.$typeUrl === Provider.typeUrl || typeof o.owner === "string" && typeof o.host_uri === "string" && Array.isArray(o.attributes) && (!o.attributes.length || Attribute.isSDK(o.attributes[0])) && ProviderInfo.isSDK(o.info)); + }, + isAmino(o: any): o is ProviderAmino { + return o && (o.$typeUrl === Provider.typeUrl || typeof o.owner === "string" && typeof o.host_uri === "string" && Array.isArray(o.attributes) && (!o.attributes.length || Attribute.isAmino(o.attributes[0])) && ProviderInfo.isAmino(o.info)); + }, encode(message: Provider, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.owner !== "") { writer.uint32(10).string(message.owner); @@ -1147,5 +1239,12 @@ export const Provider = { typeUrl: "/akash.provider.v1beta2.Provider", value: Provider.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Provider.typeUrl)) { + return; + } + Attribute.registerTypeUrl(); + ProviderInfo.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/akash/provider/v1beta2/query.rpc.func.ts b/__fixtures__/v-next/outputv2/akash/provider/v1beta2/query.rpc.func.ts new file mode 100644 index 0000000000..76b977b562 --- /dev/null +++ b/__fixtures__/v-next/outputv2/akash/provider/v1beta2/query.rpc.func.ts @@ -0,0 +1,28 @@ +import { buildQuery } from "../../../helper-func-types"; +import { QueryProvidersRequest, QueryProvidersResponse, QueryProviderRequest, QueryProviderResponse } from "./query"; +/** + * Providers queries providers + * @name getProviders + * @package akash.provider.v1beta2 + * @see proto service: akash.provider.v1beta2.Providers + */ +export const getProviders = buildQuery({ + encode: QueryProvidersRequest.encode, + decode: QueryProvidersResponse.decode, + service: "akash.provider.v1beta2.Query", + method: "Providers", + deps: [QueryProvidersRequest, QueryProvidersResponse] +}); +/** + * Provider queries provider details + * @name getProvider + * @package akash.provider.v1beta2 + * @see proto service: akash.provider.v1beta2.Provider + */ +export const getProvider = buildQuery({ + encode: QueryProviderRequest.encode, + decode: QueryProviderResponse.decode, + service: "akash.provider.v1beta2.Query", + method: "Provider", + deps: [QueryProviderRequest, QueryProviderResponse] +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/akash/provider/v1beta2/query.ts b/__fixtures__/v-next/outputv2/akash/provider/v1beta2/query.ts index cca11aa02d..f16c26ec4a 100644 --- a/__fixtures__/v-next/outputv2/akash/provider/v1beta2/query.ts +++ b/__fixtures__/v-next/outputv2/akash/provider/v1beta2/query.ts @@ -1,6 +1,7 @@ import { PageRequest, PageRequestAmino, PageRequestSDKType, PageResponse, PageResponseAmino, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination"; import { Provider, ProviderAmino, ProviderSDKType } from "./provider"; import { BinaryReader, BinaryWriter } from "../../../binary"; +import { GlobalDecoderRegistry } from "../../../registry"; import { isSet, DeepPartial } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "akash.provider.v1beta2"; @@ -160,6 +161,15 @@ function createBaseQueryProvidersRequest(): QueryProvidersRequest { */ export const QueryProvidersRequest = { typeUrl: "/akash.provider.v1beta2.QueryProvidersRequest", + is(o: any): o is QueryProvidersRequest { + return o && o.$typeUrl === QueryProvidersRequest.typeUrl; + }, + isSDK(o: any): o is QueryProvidersRequestSDKType { + return o && o.$typeUrl === QueryProvidersRequest.typeUrl; + }, + isAmino(o: any): o is QueryProvidersRequestAmino { + return o && o.$typeUrl === QueryProvidersRequest.typeUrl; + }, encode(message: QueryProvidersRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.pagination !== undefined) { PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); @@ -236,6 +246,12 @@ export const QueryProvidersRequest = { typeUrl: "/akash.provider.v1beta2.QueryProvidersRequest", value: QueryProvidersRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryProvidersRequest.typeUrl)) { + return; + } + PageRequest.registerTypeUrl(); } }; function createBaseQueryProvidersResponse(): QueryProvidersResponse { @@ -252,6 +268,15 @@ function createBaseQueryProvidersResponse(): QueryProvidersResponse { */ export const QueryProvidersResponse = { typeUrl: "/akash.provider.v1beta2.QueryProvidersResponse", + is(o: any): o is QueryProvidersResponse { + return o && (o.$typeUrl === QueryProvidersResponse.typeUrl || Array.isArray(o.providers) && (!o.providers.length || Provider.is(o.providers[0]))); + }, + isSDK(o: any): o is QueryProvidersResponseSDKType { + return o && (o.$typeUrl === QueryProvidersResponse.typeUrl || Array.isArray(o.providers) && (!o.providers.length || Provider.isSDK(o.providers[0]))); + }, + isAmino(o: any): o is QueryProvidersResponseAmino { + return o && (o.$typeUrl === QueryProvidersResponse.typeUrl || Array.isArray(o.providers) && (!o.providers.length || Provider.isAmino(o.providers[0]))); + }, encode(message: QueryProvidersResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.providers) { Provider.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -353,6 +378,13 @@ export const QueryProvidersResponse = { typeUrl: "/akash.provider.v1beta2.QueryProvidersResponse", value: QueryProvidersResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryProvidersResponse.typeUrl)) { + return; + } + Provider.registerTypeUrl(); + PageResponse.registerTypeUrl(); } }; function createBaseQueryProviderRequest(): QueryProviderRequest { @@ -368,6 +400,15 @@ function createBaseQueryProviderRequest(): QueryProviderRequest { */ export const QueryProviderRequest = { typeUrl: "/akash.provider.v1beta2.QueryProviderRequest", + is(o: any): o is QueryProviderRequest { + return o && (o.$typeUrl === QueryProviderRequest.typeUrl || typeof o.owner === "string"); + }, + isSDK(o: any): o is QueryProviderRequestSDKType { + return o && (o.$typeUrl === QueryProviderRequest.typeUrl || typeof o.owner === "string"); + }, + isAmino(o: any): o is QueryProviderRequestAmino { + return o && (o.$typeUrl === QueryProviderRequest.typeUrl || typeof o.owner === "string"); + }, encode(message: QueryProviderRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.owner !== "") { writer.uint32(10).string(message.owner); @@ -442,7 +483,8 @@ export const QueryProviderRequest = { typeUrl: "/akash.provider.v1beta2.QueryProviderRequest", value: QueryProviderRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryProviderResponse(): QueryProviderResponse { return { @@ -457,6 +499,15 @@ function createBaseQueryProviderResponse(): QueryProviderResponse { */ export const QueryProviderResponse = { typeUrl: "/akash.provider.v1beta2.QueryProviderResponse", + is(o: any): o is QueryProviderResponse { + return o && (o.$typeUrl === QueryProviderResponse.typeUrl || Provider.is(o.provider)); + }, + isSDK(o: any): o is QueryProviderResponseSDKType { + return o && (o.$typeUrl === QueryProviderResponse.typeUrl || Provider.isSDK(o.provider)); + }, + isAmino(o: any): o is QueryProviderResponseAmino { + return o && (o.$typeUrl === QueryProviderResponse.typeUrl || Provider.isAmino(o.provider)); + }, encode(message: QueryProviderResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.provider !== undefined) { Provider.encode(message.provider, writer.uint32(10).fork()).ldelim(); @@ -533,5 +584,11 @@ export const QueryProviderResponse = { typeUrl: "/akash.provider.v1beta2.QueryProviderResponse", value: QueryProviderResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryProviderResponse.typeUrl)) { + return; + } + Provider.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/confio/proofs.ts b/__fixtures__/v-next/outputv2/confio/proofs.ts index 77f44054fa..a7a6e4869d 100644 --- a/__fixtures__/v-next/outputv2/confio/proofs.ts +++ b/__fixtures__/v-next/outputv2/confio/proofs.ts @@ -1,4 +1,5 @@ import { BinaryReader, BinaryWriter } from "../binary"; +import { GlobalDecoderRegistry } from "../registry"; import { isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../helpers"; import { JsonSafe } from "../json-safe"; export const protobufPackage = "ics23"; @@ -976,6 +977,15 @@ function createBaseExistenceProof(): ExistenceProof { */ export const ExistenceProof = { typeUrl: "/ics23.ExistenceProof", + is(o: any): o is ExistenceProof { + return o && (o.$typeUrl === ExistenceProof.typeUrl || (o.key instanceof Uint8Array || typeof o.key === "string") && (o.value instanceof Uint8Array || typeof o.value === "string") && Array.isArray(o.path) && (!o.path.length || InnerOp.is(o.path[0]))); + }, + isSDK(o: any): o is ExistenceProofSDKType { + return o && (o.$typeUrl === ExistenceProof.typeUrl || (o.key instanceof Uint8Array || typeof o.key === "string") && (o.value instanceof Uint8Array || typeof o.value === "string") && Array.isArray(o.path) && (!o.path.length || InnerOp.isSDK(o.path[0]))); + }, + isAmino(o: any): o is ExistenceProofAmino { + return o && (o.$typeUrl === ExistenceProof.typeUrl || (o.key instanceof Uint8Array || typeof o.key === "string") && (o.value instanceof Uint8Array || typeof o.value === "string") && Array.isArray(o.path) && (!o.path.length || InnerOp.isAmino(o.path[0]))); + }, encode(message: ExistenceProof, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.key.length !== 0) { writer.uint32(10).bytes(message.key); @@ -1107,6 +1117,13 @@ export const ExistenceProof = { typeUrl: "/ics23.ExistenceProof", value: ExistenceProof.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ExistenceProof.typeUrl)) { + return; + } + LeafOp.registerTypeUrl(); + InnerOp.registerTypeUrl(); } }; function createBaseNonExistenceProof(): NonExistenceProof { @@ -1126,6 +1143,15 @@ function createBaseNonExistenceProof(): NonExistenceProof { */ export const NonExistenceProof = { typeUrl: "/ics23.NonExistenceProof", + is(o: any): o is NonExistenceProof { + return o && (o.$typeUrl === NonExistenceProof.typeUrl || o.key instanceof Uint8Array || typeof o.key === "string"); + }, + isSDK(o: any): o is NonExistenceProofSDKType { + return o && (o.$typeUrl === NonExistenceProof.typeUrl || o.key instanceof Uint8Array || typeof o.key === "string"); + }, + isAmino(o: any): o is NonExistenceProofAmino { + return o && (o.$typeUrl === NonExistenceProof.typeUrl || o.key instanceof Uint8Array || typeof o.key === "string"); + }, encode(message: NonExistenceProof, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.key.length !== 0) { writer.uint32(10).bytes(message.key); @@ -1234,6 +1260,12 @@ export const NonExistenceProof = { typeUrl: "/ics23.NonExistenceProof", value: NonExistenceProof.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(NonExistenceProof.typeUrl)) { + return; + } + ExistenceProof.registerTypeUrl(); } }; function createBaseCommitmentProof(): CommitmentProof { @@ -1252,6 +1284,15 @@ function createBaseCommitmentProof(): CommitmentProof { */ export const CommitmentProof = { typeUrl: "/ics23.CommitmentProof", + is(o: any): o is CommitmentProof { + return o && o.$typeUrl === CommitmentProof.typeUrl; + }, + isSDK(o: any): o is CommitmentProofSDKType { + return o && o.$typeUrl === CommitmentProof.typeUrl; + }, + isAmino(o: any): o is CommitmentProofAmino { + return o && o.$typeUrl === CommitmentProof.typeUrl; + }, encode(message: CommitmentProof, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.exist !== undefined) { ExistenceProof.encode(message.exist, writer.uint32(10).fork()).ldelim(); @@ -1379,6 +1420,15 @@ export const CommitmentProof = { typeUrl: "/ics23.CommitmentProof", value: CommitmentProof.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(CommitmentProof.typeUrl)) { + return; + } + ExistenceProof.registerTypeUrl(); + NonExistenceProof.registerTypeUrl(); + BatchProof.registerTypeUrl(); + CompressedBatchProof.registerTypeUrl(); } }; function createBaseLeafOp(): LeafOp { @@ -1411,6 +1461,15 @@ function createBaseLeafOp(): LeafOp { */ export const LeafOp = { typeUrl: "/ics23.LeafOp", + is(o: any): o is LeafOp { + return o && (o.$typeUrl === LeafOp.typeUrl || isSet(o.hash) && isSet(o.prehashKey) && isSet(o.prehashValue) && isSet(o.length) && (o.prefix instanceof Uint8Array || typeof o.prefix === "string")); + }, + isSDK(o: any): o is LeafOpSDKType { + return o && (o.$typeUrl === LeafOp.typeUrl || isSet(o.hash) && isSet(o.prehash_key) && isSet(o.prehash_value) && isSet(o.length) && (o.prefix instanceof Uint8Array || typeof o.prefix === "string")); + }, + isAmino(o: any): o is LeafOpAmino { + return o && (o.$typeUrl === LeafOp.typeUrl || isSet(o.hash) && isSet(o.prehash_key) && isSet(o.prehash_value) && isSet(o.length) && (o.prefix instanceof Uint8Array || typeof o.prefix === "string")); + }, encode(message: LeafOp, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.hash !== 0) { writer.uint32(8).int32(message.hash); @@ -1545,7 +1604,8 @@ export const LeafOp = { typeUrl: "/ics23.LeafOp", value: LeafOp.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseInnerOp(): InnerOp { return { @@ -1576,6 +1636,15 @@ function createBaseInnerOp(): InnerOp { */ export const InnerOp = { typeUrl: "/ics23.InnerOp", + is(o: any): o is InnerOp { + return o && (o.$typeUrl === InnerOp.typeUrl || isSet(o.hash) && (o.prefix instanceof Uint8Array || typeof o.prefix === "string") && (o.suffix instanceof Uint8Array || typeof o.suffix === "string")); + }, + isSDK(o: any): o is InnerOpSDKType { + return o && (o.$typeUrl === InnerOp.typeUrl || isSet(o.hash) && (o.prefix instanceof Uint8Array || typeof o.prefix === "string") && (o.suffix instanceof Uint8Array || typeof o.suffix === "string")); + }, + isAmino(o: any): o is InnerOpAmino { + return o && (o.$typeUrl === InnerOp.typeUrl || isSet(o.hash) && (o.prefix instanceof Uint8Array || typeof o.prefix === "string") && (o.suffix instanceof Uint8Array || typeof o.suffix === "string")); + }, encode(message: InnerOp, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.hash !== 0) { writer.uint32(8).int32(message.hash); @@ -1680,7 +1749,8 @@ export const InnerOp = { typeUrl: "/ics23.InnerOp", value: InnerOp.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseProofSpec(): ProofSpec { return { @@ -1707,6 +1777,15 @@ function createBaseProofSpec(): ProofSpec { */ export const ProofSpec = { typeUrl: "/ics23.ProofSpec", + is(o: any): o is ProofSpec { + return o && (o.$typeUrl === ProofSpec.typeUrl || typeof o.maxDepth === "number" && typeof o.minDepth === "number"); + }, + isSDK(o: any): o is ProofSpecSDKType { + return o && (o.$typeUrl === ProofSpec.typeUrl || typeof o.max_depth === "number" && typeof o.min_depth === "number"); + }, + isAmino(o: any): o is ProofSpecAmino { + return o && (o.$typeUrl === ProofSpec.typeUrl || typeof o.max_depth === "number" && typeof o.min_depth === "number"); + }, encode(message: ProofSpec, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.leafSpec !== undefined) { LeafOp.encode(message.leafSpec, writer.uint32(10).fork()).ldelim(); @@ -1830,6 +1909,13 @@ export const ProofSpec = { typeUrl: "/ics23.ProofSpec", value: ProofSpec.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ProofSpec.typeUrl)) { + return; + } + LeafOp.registerTypeUrl(); + InnerSpec.registerTypeUrl(); } }; function createBaseInnerSpec(): InnerSpec { @@ -1857,6 +1943,15 @@ function createBaseInnerSpec(): InnerSpec { */ export const InnerSpec = { typeUrl: "/ics23.InnerSpec", + is(o: any): o is InnerSpec { + return o && (o.$typeUrl === InnerSpec.typeUrl || Array.isArray(o.childOrder) && (!o.childOrder.length || typeof o.childOrder[0] === "number") && typeof o.childSize === "number" && typeof o.minPrefixLength === "number" && typeof o.maxPrefixLength === "number" && (o.emptyChild instanceof Uint8Array || typeof o.emptyChild === "string") && isSet(o.hash)); + }, + isSDK(o: any): o is InnerSpecSDKType { + return o && (o.$typeUrl === InnerSpec.typeUrl || Array.isArray(o.child_order) && (!o.child_order.length || typeof o.child_order[0] === "number") && typeof o.child_size === "number" && typeof o.min_prefix_length === "number" && typeof o.max_prefix_length === "number" && (o.empty_child instanceof Uint8Array || typeof o.empty_child === "string") && isSet(o.hash)); + }, + isAmino(o: any): o is InnerSpecAmino { + return o && (o.$typeUrl === InnerSpec.typeUrl || Array.isArray(o.child_order) && (!o.child_order.length || typeof o.child_order[0] === "number") && typeof o.child_size === "number" && typeof o.min_prefix_length === "number" && typeof o.max_prefix_length === "number" && (o.empty_child instanceof Uint8Array || typeof o.empty_child === "string") && isSet(o.hash)); + }, encode(message: InnerSpec, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { writer.uint32(10).fork(); for (const v of message.childOrder) { @@ -2025,7 +2120,8 @@ export const InnerSpec = { typeUrl: "/ics23.InnerSpec", value: InnerSpec.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseBatchProof(): BatchProof { return { @@ -2040,6 +2136,15 @@ function createBaseBatchProof(): BatchProof { */ export const BatchProof = { typeUrl: "/ics23.BatchProof", + is(o: any): o is BatchProof { + return o && (o.$typeUrl === BatchProof.typeUrl || Array.isArray(o.entries) && (!o.entries.length || BatchEntry.is(o.entries[0]))); + }, + isSDK(o: any): o is BatchProofSDKType { + return o && (o.$typeUrl === BatchProof.typeUrl || Array.isArray(o.entries) && (!o.entries.length || BatchEntry.isSDK(o.entries[0]))); + }, + isAmino(o: any): o is BatchProofAmino { + return o && (o.$typeUrl === BatchProof.typeUrl || Array.isArray(o.entries) && (!o.entries.length || BatchEntry.isAmino(o.entries[0]))); + }, encode(message: BatchProof, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.entries) { BatchEntry.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -2124,6 +2229,12 @@ export const BatchProof = { typeUrl: "/ics23.BatchProof", value: BatchProof.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(BatchProof.typeUrl)) { + return; + } + BatchEntry.registerTypeUrl(); } }; function createBaseBatchEntry(): BatchEntry { @@ -2140,6 +2251,15 @@ function createBaseBatchEntry(): BatchEntry { */ export const BatchEntry = { typeUrl: "/ics23.BatchEntry", + is(o: any): o is BatchEntry { + return o && o.$typeUrl === BatchEntry.typeUrl; + }, + isSDK(o: any): o is BatchEntrySDKType { + return o && o.$typeUrl === BatchEntry.typeUrl; + }, + isAmino(o: any): o is BatchEntryAmino { + return o && o.$typeUrl === BatchEntry.typeUrl; + }, encode(message: BatchEntry, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.exist !== undefined) { ExistenceProof.encode(message.exist, writer.uint32(10).fork()).ldelim(); @@ -2233,6 +2353,13 @@ export const BatchEntry = { typeUrl: "/ics23.BatchEntry", value: BatchEntry.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(BatchEntry.typeUrl)) { + return; + } + ExistenceProof.registerTypeUrl(); + NonExistenceProof.registerTypeUrl(); } }; function createBaseCompressedBatchProof(): CompressedBatchProof { @@ -2248,6 +2375,15 @@ function createBaseCompressedBatchProof(): CompressedBatchProof { */ export const CompressedBatchProof = { typeUrl: "/ics23.CompressedBatchProof", + is(o: any): o is CompressedBatchProof { + return o && (o.$typeUrl === CompressedBatchProof.typeUrl || Array.isArray(o.entries) && (!o.entries.length || CompressedBatchEntry.is(o.entries[0])) && Array.isArray(o.lookupInners) && (!o.lookupInners.length || InnerOp.is(o.lookupInners[0]))); + }, + isSDK(o: any): o is CompressedBatchProofSDKType { + return o && (o.$typeUrl === CompressedBatchProof.typeUrl || Array.isArray(o.entries) && (!o.entries.length || CompressedBatchEntry.isSDK(o.entries[0])) && Array.isArray(o.lookup_inners) && (!o.lookup_inners.length || InnerOp.isSDK(o.lookup_inners[0]))); + }, + isAmino(o: any): o is CompressedBatchProofAmino { + return o && (o.$typeUrl === CompressedBatchProof.typeUrl || Array.isArray(o.entries) && (!o.entries.length || CompressedBatchEntry.isAmino(o.entries[0])) && Array.isArray(o.lookup_inners) && (!o.lookup_inners.length || InnerOp.isAmino(o.lookup_inners[0]))); + }, encode(message: CompressedBatchProof, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.entries) { CompressedBatchEntry.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -2357,6 +2493,13 @@ export const CompressedBatchProof = { typeUrl: "/ics23.CompressedBatchProof", value: CompressedBatchProof.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(CompressedBatchProof.typeUrl)) { + return; + } + CompressedBatchEntry.registerTypeUrl(); + InnerOp.registerTypeUrl(); } }; function createBaseCompressedBatchEntry(): CompressedBatchEntry { @@ -2373,6 +2516,15 @@ function createBaseCompressedBatchEntry(): CompressedBatchEntry { */ export const CompressedBatchEntry = { typeUrl: "/ics23.CompressedBatchEntry", + is(o: any): o is CompressedBatchEntry { + return o && o.$typeUrl === CompressedBatchEntry.typeUrl; + }, + isSDK(o: any): o is CompressedBatchEntrySDKType { + return o && o.$typeUrl === CompressedBatchEntry.typeUrl; + }, + isAmino(o: any): o is CompressedBatchEntryAmino { + return o && o.$typeUrl === CompressedBatchEntry.typeUrl; + }, encode(message: CompressedBatchEntry, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.exist !== undefined) { CompressedExistenceProof.encode(message.exist, writer.uint32(10).fork()).ldelim(); @@ -2466,6 +2618,13 @@ export const CompressedBatchEntry = { typeUrl: "/ics23.CompressedBatchEntry", value: CompressedBatchEntry.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(CompressedBatchEntry.typeUrl)) { + return; + } + CompressedExistenceProof.registerTypeUrl(); + CompressedNonExistenceProof.registerTypeUrl(); } }; function createBaseCompressedExistenceProof(): CompressedExistenceProof { @@ -2483,6 +2642,15 @@ function createBaseCompressedExistenceProof(): CompressedExistenceProof { */ export const CompressedExistenceProof = { typeUrl: "/ics23.CompressedExistenceProof", + is(o: any): o is CompressedExistenceProof { + return o && (o.$typeUrl === CompressedExistenceProof.typeUrl || (o.key instanceof Uint8Array || typeof o.key === "string") && (o.value instanceof Uint8Array || typeof o.value === "string") && Array.isArray(o.path) && (!o.path.length || typeof o.path[0] === "number")); + }, + isSDK(o: any): o is CompressedExistenceProofSDKType { + return o && (o.$typeUrl === CompressedExistenceProof.typeUrl || (o.key instanceof Uint8Array || typeof o.key === "string") && (o.value instanceof Uint8Array || typeof o.value === "string") && Array.isArray(o.path) && (!o.path.length || typeof o.path[0] === "number")); + }, + isAmino(o: any): o is CompressedExistenceProofAmino { + return o && (o.$typeUrl === CompressedExistenceProof.typeUrl || (o.key instanceof Uint8Array || typeof o.key === "string") && (o.value instanceof Uint8Array || typeof o.value === "string") && Array.isArray(o.path) && (!o.path.length || typeof o.path[0] === "number")); + }, encode(message: CompressedExistenceProof, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.key.length !== 0) { writer.uint32(10).bytes(message.key); @@ -2623,6 +2791,12 @@ export const CompressedExistenceProof = { typeUrl: "/ics23.CompressedExistenceProof", value: CompressedExistenceProof.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(CompressedExistenceProof.typeUrl)) { + return; + } + LeafOp.registerTypeUrl(); } }; function createBaseCompressedNonExistenceProof(): CompressedNonExistenceProof { @@ -2639,6 +2813,15 @@ function createBaseCompressedNonExistenceProof(): CompressedNonExistenceProof { */ export const CompressedNonExistenceProof = { typeUrl: "/ics23.CompressedNonExistenceProof", + is(o: any): o is CompressedNonExistenceProof { + return o && (o.$typeUrl === CompressedNonExistenceProof.typeUrl || o.key instanceof Uint8Array || typeof o.key === "string"); + }, + isSDK(o: any): o is CompressedNonExistenceProofSDKType { + return o && (o.$typeUrl === CompressedNonExistenceProof.typeUrl || o.key instanceof Uint8Array || typeof o.key === "string"); + }, + isAmino(o: any): o is CompressedNonExistenceProofAmino { + return o && (o.$typeUrl === CompressedNonExistenceProof.typeUrl || o.key instanceof Uint8Array || typeof o.key === "string"); + }, encode(message: CompressedNonExistenceProof, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.key.length !== 0) { writer.uint32(10).bytes(message.key); @@ -2747,5 +2930,11 @@ export const CompressedNonExistenceProof = { typeUrl: "/ics23.CompressedNonExistenceProof", value: CompressedNonExistenceProof.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(CompressedNonExistenceProof.typeUrl)) { + return; + } + CompressedExistenceProof.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/cosmos/app/v1alpha1/config.ts b/__fixtures__/v-next/outputv2/cosmos/app/v1alpha1/config.ts index 561bdb2367..9db93bf8b7 100644 --- a/__fixtures__/v-next/outputv2/cosmos/app/v1alpha1/config.ts +++ b/__fixtures__/v-next/outputv2/cosmos/app/v1alpha1/config.ts @@ -2,6 +2,7 @@ import { Any, AnyAmino, AnySDKType } from "../../../google/protobuf/any"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { JsonSafe } from "../../../json-safe"; import { DeepPartial, isSet } from "../../../helpers"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "cosmos.app.v1alpha1"; /** * Config represents the configuration for a Cosmos SDK ABCI app. @@ -152,6 +153,15 @@ function createBaseConfig(): Config { export const Config = { typeUrl: "/cosmos.app.v1alpha1.Config", aminoType: "cosmos-sdk/Config", + is(o: any): o is Config { + return o && (o.$typeUrl === Config.typeUrl || Array.isArray(o.modules) && (!o.modules.length || ModuleConfig.is(o.modules[0]))); + }, + isSDK(o: any): o is ConfigSDKType { + return o && (o.$typeUrl === Config.typeUrl || Array.isArray(o.modules) && (!o.modules.length || ModuleConfig.isSDK(o.modules[0]))); + }, + isAmino(o: any): o is ConfigAmino { + return o && (o.$typeUrl === Config.typeUrl || Array.isArray(o.modules) && (!o.modules.length || ModuleConfig.isAmino(o.modules[0]))); + }, encode(message: Config, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.modules) { ModuleConfig.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -242,6 +252,12 @@ export const Config = { typeUrl: "/cosmos.app.v1alpha1.Config", value: Config.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Config.typeUrl)) { + return; + } + ModuleConfig.registerTypeUrl(); } }; function createBaseModuleConfig(): ModuleConfig { @@ -259,6 +275,15 @@ function createBaseModuleConfig(): ModuleConfig { export const ModuleConfig = { typeUrl: "/cosmos.app.v1alpha1.ModuleConfig", aminoType: "cosmos-sdk/ModuleConfig", + is(o: any): o is ModuleConfig { + return o && (o.$typeUrl === ModuleConfig.typeUrl || typeof o.name === "string"); + }, + isSDK(o: any): o is ModuleConfigSDKType { + return o && (o.$typeUrl === ModuleConfig.typeUrl || typeof o.name === "string"); + }, + isAmino(o: any): o is ModuleConfigAmino { + return o && (o.$typeUrl === ModuleConfig.typeUrl || typeof o.name === "string"); + }, encode(message: ModuleConfig, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -356,5 +381,6 @@ export const ModuleConfig = { typeUrl: "/cosmos.app.v1alpha1.ModuleConfig", value: ModuleConfig.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/cosmos/app/v1alpha1/module.ts b/__fixtures__/v-next/outputv2/cosmos/app/v1alpha1/module.ts index 58b9aafdd3..413ceb15f1 100644 --- a/__fixtures__/v-next/outputv2/cosmos/app/v1alpha1/module.ts +++ b/__fixtures__/v-next/outputv2/cosmos/app/v1alpha1/module.ts @@ -1,6 +1,7 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; import { isSet, DeepPartial } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "cosmos.app.v1alpha1"; /** * ModuleDescriptor describes an app module. @@ -267,6 +268,15 @@ function createBaseModuleDescriptor(): ModuleDescriptor { export const ModuleDescriptor = { typeUrl: "/cosmos.app.v1alpha1.ModuleDescriptor", aminoType: "cosmos-sdk/ModuleDescriptor", + is(o: any): o is ModuleDescriptor { + return o && (o.$typeUrl === ModuleDescriptor.typeUrl || typeof o.goImport === "string" && Array.isArray(o.usePackage) && (!o.usePackage.length || PackageReference.is(o.usePackage[0])) && Array.isArray(o.canMigrateFrom) && (!o.canMigrateFrom.length || MigrateFromInfo.is(o.canMigrateFrom[0]))); + }, + isSDK(o: any): o is ModuleDescriptorSDKType { + return o && (o.$typeUrl === ModuleDescriptor.typeUrl || typeof o.go_import === "string" && Array.isArray(o.use_package) && (!o.use_package.length || PackageReference.isSDK(o.use_package[0])) && Array.isArray(o.can_migrate_from) && (!o.can_migrate_from.length || MigrateFromInfo.isSDK(o.can_migrate_from[0]))); + }, + isAmino(o: any): o is ModuleDescriptorAmino { + return o && (o.$typeUrl === ModuleDescriptor.typeUrl || typeof o.go_import === "string" && Array.isArray(o.use_package) && (!o.use_package.length || PackageReference.isAmino(o.use_package[0])) && Array.isArray(o.can_migrate_from) && (!o.can_migrate_from.length || MigrateFromInfo.isAmino(o.can_migrate_from[0]))); + }, encode(message: ModuleDescriptor, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.goImport !== "") { writer.uint32(10).string(message.goImport); @@ -397,6 +407,13 @@ export const ModuleDescriptor = { typeUrl: "/cosmos.app.v1alpha1.ModuleDescriptor", value: ModuleDescriptor.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ModuleDescriptor.typeUrl)) { + return; + } + PackageReference.registerTypeUrl(); + MigrateFromInfo.registerTypeUrl(); } }; function createBasePackageReference(): PackageReference { @@ -414,6 +431,15 @@ function createBasePackageReference(): PackageReference { export const PackageReference = { typeUrl: "/cosmos.app.v1alpha1.PackageReference", aminoType: "cosmos-sdk/PackageReference", + is(o: any): o is PackageReference { + return o && (o.$typeUrl === PackageReference.typeUrl || typeof o.name === "string" && typeof o.revision === "number"); + }, + isSDK(o: any): o is PackageReferenceSDKType { + return o && (o.$typeUrl === PackageReference.typeUrl || typeof o.name === "string" && typeof o.revision === "number"); + }, + isAmino(o: any): o is PackageReferenceAmino { + return o && (o.$typeUrl === PackageReference.typeUrl || typeof o.name === "string" && typeof o.revision === "number"); + }, encode(message: PackageReference, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -509,7 +535,8 @@ export const PackageReference = { typeUrl: "/cosmos.app.v1alpha1.PackageReference", value: PackageReference.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMigrateFromInfo(): MigrateFromInfo { return { @@ -526,6 +553,15 @@ function createBaseMigrateFromInfo(): MigrateFromInfo { export const MigrateFromInfo = { typeUrl: "/cosmos.app.v1alpha1.MigrateFromInfo", aminoType: "cosmos-sdk/MigrateFromInfo", + is(o: any): o is MigrateFromInfo { + return o && (o.$typeUrl === MigrateFromInfo.typeUrl || typeof o.module === "string"); + }, + isSDK(o: any): o is MigrateFromInfoSDKType { + return o && (o.$typeUrl === MigrateFromInfo.typeUrl || typeof o.module === "string"); + }, + isAmino(o: any): o is MigrateFromInfoAmino { + return o && (o.$typeUrl === MigrateFromInfo.typeUrl || typeof o.module === "string"); + }, encode(message: MigrateFromInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.module !== "") { writer.uint32(10).string(message.module); @@ -606,5 +642,6 @@ export const MigrateFromInfo = { typeUrl: "/cosmos.app.v1alpha1.MigrateFromInfo", value: MigrateFromInfo.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/cosmos/app/v1alpha1/query.rpc.func.ts b/__fixtures__/v-next/outputv2/cosmos/app/v1alpha1/query.rpc.func.ts new file mode 100644 index 0000000000..01743e8a3d --- /dev/null +++ b/__fixtures__/v-next/outputv2/cosmos/app/v1alpha1/query.rpc.func.ts @@ -0,0 +1,15 @@ +import { buildQuery } from "../../../helper-func-types"; +import { QueryConfigRequest, QueryConfigResponse } from "./query"; +/** + * Config returns the current app config. + * @name getConfig + * @package cosmos.app.v1alpha1 + * @see proto service: cosmos.app.v1alpha1.Config + */ +export const getConfig = buildQuery({ + encode: QueryConfigRequest.encode, + decode: QueryConfigResponse.decode, + service: "cosmos.app.v1alpha1.Query", + method: "Config", + deps: [QueryConfigRequest, QueryConfigResponse] +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/cosmos/app/v1alpha1/query.ts b/__fixtures__/v-next/outputv2/cosmos/app/v1alpha1/query.ts index bb259519a3..ca3469a3d6 100644 --- a/__fixtures__/v-next/outputv2/cosmos/app/v1alpha1/query.ts +++ b/__fixtures__/v-next/outputv2/cosmos/app/v1alpha1/query.ts @@ -2,6 +2,7 @@ import { Config, ConfigAmino, ConfigSDKType } from "./config"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { JsonSafe } from "../../../json-safe"; import { DeepPartial, isSet } from "../../../helpers"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "cosmos.app.v1alpha1"; /** * QueryConfigRequest is the Query/Config request type. @@ -85,6 +86,15 @@ function createBaseQueryConfigRequest(): QueryConfigRequest { export const QueryConfigRequest = { typeUrl: "/cosmos.app.v1alpha1.QueryConfigRequest", aminoType: "cosmos-sdk/QueryConfigRequest", + is(o: any): o is QueryConfigRequest { + return o && o.$typeUrl === QueryConfigRequest.typeUrl; + }, + isSDK(o: any): o is QueryConfigRequestSDKType { + return o && o.$typeUrl === QueryConfigRequest.typeUrl; + }, + isAmino(o: any): o is QueryConfigRequestAmino { + return o && o.$typeUrl === QueryConfigRequest.typeUrl; + }, encode(_: QueryConfigRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -149,7 +159,8 @@ export const QueryConfigRequest = { typeUrl: "/cosmos.app.v1alpha1.QueryConfigRequest", value: QueryConfigRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryConfigResponse(): QueryConfigResponse { return { @@ -165,6 +176,15 @@ function createBaseQueryConfigResponse(): QueryConfigResponse { export const QueryConfigResponse = { typeUrl: "/cosmos.app.v1alpha1.QueryConfigResponse", aminoType: "cosmos-sdk/QueryConfigResponse", + is(o: any): o is QueryConfigResponse { + return o && o.$typeUrl === QueryConfigResponse.typeUrl; + }, + isSDK(o: any): o is QueryConfigResponseSDKType { + return o && o.$typeUrl === QueryConfigResponse.typeUrl; + }, + isAmino(o: any): o is QueryConfigResponseAmino { + return o && o.$typeUrl === QueryConfigResponse.typeUrl; + }, encode(message: QueryConfigResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.config !== undefined) { Config.encode(message.config, writer.uint32(10).fork()).ldelim(); @@ -247,5 +267,11 @@ export const QueryConfigResponse = { typeUrl: "/cosmos.app.v1alpha1.QueryConfigResponse", value: QueryConfigResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryConfigResponse.typeUrl)) { + return; + } + Config.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/cosmos/auth/v1beta1/auth.ts b/__fixtures__/v-next/outputv2/cosmos/auth/v1beta1/auth.ts index 9cde22fba4..a5c6bd3e46 100644 --- a/__fixtures__/v-next/outputv2/cosmos/auth/v1beta1/auth.ts +++ b/__fixtures__/v-next/outputv2/cosmos/auth/v1beta1/auth.ts @@ -1,5 +1,6 @@ import { Any, AnyAmino, AnySDKType } from "../../../google/protobuf/any"; import { BinaryReader, BinaryWriter } from "../../../binary"; +import { GlobalDecoderRegistry } from "../../../registry"; import { isSet, DeepPartial } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "cosmos.auth.v1beta1"; @@ -165,6 +166,15 @@ function createBaseBaseAccount(): BaseAccount { export const BaseAccount = { typeUrl: "/cosmos.auth.v1beta1.BaseAccount", aminoType: "cosmos-sdk/BaseAccount", + is(o: any): o is BaseAccount { + return o && (o.$typeUrl === BaseAccount.typeUrl || typeof o.address === "string" && typeof o.accountNumber === "bigint" && typeof o.sequence === "bigint"); + }, + isSDK(o: any): o is BaseAccountSDKType { + return o && (o.$typeUrl === BaseAccount.typeUrl || typeof o.address === "string" && typeof o.account_number === "bigint" && typeof o.sequence === "bigint"); + }, + isAmino(o: any): o is BaseAccountAmino { + return o && (o.$typeUrl === BaseAccount.typeUrl || typeof o.address === "string" && typeof o.account_number === "bigint" && typeof o.sequence === "bigint"); + }, encode(message: BaseAccount, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.address !== "") { writer.uint32(10).string(message.address); @@ -296,6 +306,13 @@ export const BaseAccount = { typeUrl: "/cosmos.auth.v1beta1.BaseAccount", value: BaseAccount.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(BaseAccount.typeUrl)) { + return; + } + GlobalDecoderRegistry.register(BaseAccount.typeUrl, BaseAccount); + GlobalDecoderRegistry.registerAminoProtoMapping(BaseAccount.aminoType, BaseAccount.typeUrl); } }; function createBaseModuleAccount(): ModuleAccount { @@ -315,6 +332,15 @@ function createBaseModuleAccount(): ModuleAccount { export const ModuleAccount = { typeUrl: "/cosmos.auth.v1beta1.ModuleAccount", aminoType: "cosmos-sdk/ModuleAccount", + is(o: any): o is ModuleAccount { + return o && (o.$typeUrl === ModuleAccount.typeUrl || typeof o.name === "string" && Array.isArray(o.permissions) && (!o.permissions.length || typeof o.permissions[0] === "string")); + }, + isSDK(o: any): o is ModuleAccountSDKType { + return o && (o.$typeUrl === ModuleAccount.typeUrl || typeof o.name === "string" && Array.isArray(o.permissions) && (!o.permissions.length || typeof o.permissions[0] === "string")); + }, + isAmino(o: any): o is ModuleAccountAmino { + return o && (o.$typeUrl === ModuleAccount.typeUrl || typeof o.name === "string" && Array.isArray(o.permissions) && (!o.permissions.length || typeof o.permissions[0] === "string")); + }, encode(message: ModuleAccount, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.baseAccount !== undefined) { BaseAccount.encode(message.baseAccount, writer.uint32(10).fork()).ldelim(); @@ -437,6 +463,14 @@ export const ModuleAccount = { typeUrl: "/cosmos.auth.v1beta1.ModuleAccount", value: ModuleAccount.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ModuleAccount.typeUrl)) { + return; + } + GlobalDecoderRegistry.register(ModuleAccount.typeUrl, ModuleAccount); + GlobalDecoderRegistry.registerAminoProtoMapping(ModuleAccount.aminoType, ModuleAccount.typeUrl); + BaseAccount.registerTypeUrl(); } }; function createBaseParams(): Params { @@ -457,6 +491,15 @@ function createBaseParams(): Params { export const Params = { typeUrl: "/cosmos.auth.v1beta1.Params", aminoType: "cosmos-sdk/Params", + is(o: any): o is Params { + return o && (o.$typeUrl === Params.typeUrl || typeof o.maxMemoCharacters === "bigint" && typeof o.txSigLimit === "bigint" && typeof o.txSizeCostPerByte === "bigint" && typeof o.sigVerifyCostEd25519 === "bigint" && typeof o.sigVerifyCostSecp256k1 === "bigint"); + }, + isSDK(o: any): o is ParamsSDKType { + return o && (o.$typeUrl === Params.typeUrl || typeof o.max_memo_characters === "bigint" && typeof o.tx_sig_limit === "bigint" && typeof o.tx_size_cost_per_byte === "bigint" && typeof o.sig_verify_cost_ed25519 === "bigint" && typeof o.sig_verify_cost_secp256k1 === "bigint"); + }, + isAmino(o: any): o is ParamsAmino { + return o && (o.$typeUrl === Params.typeUrl || typeof o.max_memo_characters === "bigint" && typeof o.tx_sig_limit === "bigint" && typeof o.tx_size_cost_per_byte === "bigint" && typeof o.sig_verify_cost_ed25519 === "bigint" && typeof o.sig_verify_cost_secp256k1 === "bigint"); + }, encode(message: Params, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.maxMemoCharacters !== BigInt(0)) { writer.uint32(8).uint64(message.maxMemoCharacters); @@ -607,5 +650,6 @@ export const Params = { typeUrl: "/cosmos.auth.v1beta1.Params", value: Params.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/cosmos/auth/v1beta1/genesis.ts b/__fixtures__/v-next/outputv2/cosmos/auth/v1beta1/genesis.ts index 8af7dc952e..bb610e2718 100644 --- a/__fixtures__/v-next/outputv2/cosmos/auth/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv2/cosmos/auth/v1beta1/genesis.ts @@ -69,6 +69,15 @@ function createBaseGenesisState(): GenesisState { export const GenesisState = { typeUrl: "/cosmos.auth.v1beta1.GenesisState", aminoType: "cosmos-sdk/GenesisState", + is(o: any): o is GenesisState { + return o && (o.$typeUrl === GenesisState.typeUrl || Params.is(o.params) && Array.isArray(o.accounts) && (!o.accounts.length || Any.is(o.accounts[0]))); + }, + isSDK(o: any): o is GenesisStateSDKType { + return o && (o.$typeUrl === GenesisState.typeUrl || Params.isSDK(o.params) && Array.isArray(o.accounts) && (!o.accounts.length || Any.isSDK(o.accounts[0]))); + }, + isAmino(o: any): o is GenesisStateAmino { + return o && (o.$typeUrl === GenesisState.typeUrl || Params.isAmino(o.params) && Array.isArray(o.accounts) && (!o.accounts.length || Any.isAmino(o.accounts[0]))); + }, encode(message: GenesisState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.params !== undefined) { Params.encode(message.params, writer.uint32(10).fork()).ldelim(); @@ -176,5 +185,6 @@ export const GenesisState = { typeUrl: "/cosmos.auth.v1beta1.GenesisState", value: GenesisState.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/cosmos/auth/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputv2/cosmos/auth/v1beta1/query.rpc.func.ts new file mode 100644 index 0000000000..65646cc19e --- /dev/null +++ b/__fixtures__/v-next/outputv2/cosmos/auth/v1beta1/query.rpc.func.ts @@ -0,0 +1,95 @@ +import { buildQuery } from "../../../helper-func-types"; +import { QueryAccountsRequest, QueryAccountsResponse, QueryAccountRequest, QueryAccountResponse, QueryParamsRequest, QueryParamsResponse, QueryModuleAccountsRequest, QueryModuleAccountsResponse, Bech32PrefixRequest, Bech32PrefixResponse, AddressBytesToStringRequest, AddressBytesToStringResponse, AddressStringToBytesRequest, AddressStringToBytesResponse } from "./query"; +/** + * Accounts returns all the existing accounts + * + * Since: cosmos-sdk 0.43 + * @name getAccounts + * @package cosmos.auth.v1beta1 + * @see proto service: cosmos.auth.v1beta1.Accounts + */ +export const getAccounts = buildQuery({ + encode: QueryAccountsRequest.encode, + decode: QueryAccountsResponse.decode, + service: "cosmos.auth.v1beta1.Query", + method: "Accounts", + deps: [QueryAccountsRequest, QueryAccountsResponse] +}); +/** + * Account returns account details based on address. + * @name getAccount + * @package cosmos.auth.v1beta1 + * @see proto service: cosmos.auth.v1beta1.Account + */ +export const getAccount = buildQuery({ + encode: QueryAccountRequest.encode, + decode: QueryAccountResponse.decode, + service: "cosmos.auth.v1beta1.Query", + method: "Account", + deps: [QueryAccountRequest, QueryAccountResponse] +}); +/** + * Params queries all parameters. + * @name getParams + * @package cosmos.auth.v1beta1 + * @see proto service: cosmos.auth.v1beta1.Params + */ +export const getParams = buildQuery({ + encode: QueryParamsRequest.encode, + decode: QueryParamsResponse.decode, + service: "cosmos.auth.v1beta1.Query", + method: "Params", + deps: [QueryParamsRequest, QueryParamsResponse] +}); +/** + * ModuleAccounts returns all the existing module accounts. + * @name getModuleAccounts + * @package cosmos.auth.v1beta1 + * @see proto service: cosmos.auth.v1beta1.ModuleAccounts + */ +export const getModuleAccounts = buildQuery({ + encode: QueryModuleAccountsRequest.encode, + decode: QueryModuleAccountsResponse.decode, + service: "cosmos.auth.v1beta1.Query", + method: "ModuleAccounts", + deps: [QueryModuleAccountsRequest, QueryModuleAccountsResponse] +}); +/** + * Bech32 queries bech32Prefix + * @name getBech32Prefix + * @package cosmos.auth.v1beta1 + * @see proto service: cosmos.auth.v1beta1.Bech32Prefix + */ +export const getBech32Prefix = buildQuery({ + encode: Bech32PrefixRequest.encode, + decode: Bech32PrefixResponse.decode, + service: "cosmos.auth.v1beta1.Query", + method: "Bech32Prefix", + deps: [Bech32PrefixRequest, Bech32PrefixResponse] +}); +/** + * AddressBytesToString converts Account Address bytes to string + * @name getAddressBytesToString + * @package cosmos.auth.v1beta1 + * @see proto service: cosmos.auth.v1beta1.AddressBytesToString + */ +export const getAddressBytesToString = buildQuery({ + encode: AddressBytesToStringRequest.encode, + decode: AddressBytesToStringResponse.decode, + service: "cosmos.auth.v1beta1.Query", + method: "AddressBytesToString", + deps: [AddressBytesToStringRequest, AddressBytesToStringResponse] +}); +/** + * AddressStringToBytes converts Address string to bytes + * @name getAddressStringToBytes + * @package cosmos.auth.v1beta1 + * @see proto service: cosmos.auth.v1beta1.AddressStringToBytes + */ +export const getAddressStringToBytes = buildQuery({ + encode: AddressStringToBytesRequest.encode, + decode: AddressStringToBytesResponse.decode, + service: "cosmos.auth.v1beta1.Query", + method: "AddressStringToBytes", + deps: [AddressStringToBytesRequest, AddressStringToBytesResponse] +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/cosmos/auth/v1beta1/query.ts b/__fixtures__/v-next/outputv2/cosmos/auth/v1beta1/query.ts index 70b554f840..50b0fb2bb6 100644 --- a/__fixtures__/v-next/outputv2/cosmos/auth/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv2/cosmos/auth/v1beta1/query.ts @@ -2,6 +2,7 @@ import { PageRequest, PageRequestAmino, PageRequestSDKType, PageResponse, PageRe import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../google/protobuf/any"; import { Params, ParamsAmino, ParamsSDKType, BaseAccount, BaseAccountProtoMsg, BaseAccountSDKType, ModuleAccount, ModuleAccountProtoMsg, ModuleAccountSDKType } from "./auth"; import { BinaryReader, BinaryWriter } from "../../../binary"; +import { GlobalDecoderRegistry } from "../../../registry"; import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "cosmos.auth.v1beta1"; @@ -559,6 +560,15 @@ function createBaseQueryAccountsRequest(): QueryAccountsRequest { export const QueryAccountsRequest = { typeUrl: "/cosmos.auth.v1beta1.QueryAccountsRequest", aminoType: "cosmos-sdk/QueryAccountsRequest", + is(o: any): o is QueryAccountsRequest { + return o && o.$typeUrl === QueryAccountsRequest.typeUrl; + }, + isSDK(o: any): o is QueryAccountsRequestSDKType { + return o && o.$typeUrl === QueryAccountsRequest.typeUrl; + }, + isAmino(o: any): o is QueryAccountsRequestAmino { + return o && o.$typeUrl === QueryAccountsRequest.typeUrl; + }, encode(message: QueryAccountsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.pagination !== undefined) { PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); @@ -641,6 +651,12 @@ export const QueryAccountsRequest = { typeUrl: "/cosmos.auth.v1beta1.QueryAccountsRequest", value: QueryAccountsRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryAccountsRequest.typeUrl)) { + return; + } + PageRequest.registerTypeUrl(); } }; function createBaseQueryAccountsResponse(): QueryAccountsResponse { @@ -660,9 +676,18 @@ function createBaseQueryAccountsResponse(): QueryAccountsResponse { export const QueryAccountsResponse = { typeUrl: "/cosmos.auth.v1beta1.QueryAccountsResponse", aminoType: "cosmos-sdk/QueryAccountsResponse", + is(o: any): o is QueryAccountsResponse { + return o && (o.$typeUrl === QueryAccountsResponse.typeUrl || Array.isArray(o.accounts) && (!o.accounts.length || BaseAccount.is(o.accounts[0]) || Any.is(o.accounts[0]))); + }, + isSDK(o: any): o is QueryAccountsResponseSDKType { + return o && (o.$typeUrl === QueryAccountsResponse.typeUrl || Array.isArray(o.accounts) && (!o.accounts.length || BaseAccount.isSDK(o.accounts[0]) || Any.isSDK(o.accounts[0]))); + }, + isAmino(o: any): o is QueryAccountsResponseAmino { + return o && (o.$typeUrl === QueryAccountsResponse.typeUrl || Array.isArray(o.accounts) && (!o.accounts.length || BaseAccount.isAmino(o.accounts[0]) || Any.isAmino(o.accounts[0]))); + }, encode(message: QueryAccountsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.accounts) { - Any.encode((v! as Any), writer.uint32(10).fork()).ldelim(); + Any.encode(GlobalDecoderRegistry.wrapAny(v!), writer.uint32(10).fork()).ldelim(); } if (message.pagination !== undefined) { PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); @@ -677,7 +702,7 @@ export const QueryAccountsResponse = { const tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.accounts.push((Any.decode(reader, reader.uint32()) as Any)); + message.accounts.push(GlobalDecoderRegistry.unwrapAny(reader)); break; case 2: message.pagination = PageResponse.decode(reader, reader.uint32()); @@ -691,14 +716,14 @@ export const QueryAccountsResponse = { }, fromJSON(object: any): QueryAccountsResponse { const obj = createBaseQueryAccountsResponse(); - if (Array.isArray(object?.accounts)) obj.accounts = object.accounts.map((e: any) => Any.fromJSON(e)); + if (Array.isArray(object?.accounts)) obj.accounts = object.accounts.map((e: any) => GlobalDecoderRegistry.fromJSON(e)); if (isSet(object.pagination)) obj.pagination = PageResponse.fromJSON(object.pagination); return obj; }, toJSON(message: QueryAccountsResponse): JsonSafe { const obj: any = {}; if (message.accounts) { - obj.accounts = message.accounts.map(e => e ? Any.toJSON(e) : undefined); + obj.accounts = message.accounts.map(e => e ? GlobalDecoderRegistry.toJSON(e) : undefined); } else { obj.accounts = []; } @@ -707,7 +732,7 @@ export const QueryAccountsResponse = { }, fromPartial(object: DeepPartial): QueryAccountsResponse { const message = createBaseQueryAccountsResponse(); - message.accounts = object.accounts?.map(e => Any.fromPartial(e)) || []; + message.accounts = object.accounts?.map(e => (GlobalDecoderRegistry.fromPartial(e) as any)) || []; if (object.pagination !== undefined && object.pagination !== null) { message.pagination = PageResponse.fromPartial(object.pagination); } @@ -715,14 +740,14 @@ export const QueryAccountsResponse = { }, fromSDK(object: QueryAccountsResponseSDKType): QueryAccountsResponse { return { - accounts: Array.isArray(object?.accounts) ? object.accounts.map((e: any) => Any.fromSDK(e)) : [], + accounts: Array.isArray(object?.accounts) ? object.accounts.map((e: any) => GlobalDecoderRegistry.fromSDK(e)) : [], pagination: object.pagination ? PageResponse.fromSDK(object.pagination) : undefined }; }, toSDK(message: QueryAccountsResponse): QueryAccountsResponseSDKType { const obj: any = {}; if (message.accounts) { - obj.accounts = message.accounts.map(e => e ? Any.toSDK(e) : undefined); + obj.accounts = message.accounts.map(e => e ? GlobalDecoderRegistry.toSDK(e) : undefined); } else { obj.accounts = []; } @@ -731,7 +756,7 @@ export const QueryAccountsResponse = { }, fromAmino(object: QueryAccountsResponseAmino): QueryAccountsResponse { const message = createBaseQueryAccountsResponse(); - message.accounts = object.accounts?.map(e => AccountI_FromAmino(e)) || []; + message.accounts = object.accounts?.map(e => GlobalDecoderRegistry.fromAminoMsg(e)) || []; if (object.pagination !== undefined && object.pagination !== null) { message.pagination = PageResponse.fromAmino(object.pagination); } @@ -740,7 +765,7 @@ export const QueryAccountsResponse = { toAmino(message: QueryAccountsResponse): QueryAccountsResponseAmino { const obj: any = {}; if (message.accounts) { - obj.accounts = message.accounts.map(e => e ? AccountI_ToAmino((e as Any)) : undefined); + obj.accounts = message.accounts.map(e => e ? GlobalDecoderRegistry.toAminoMsg(e) : undefined); } else { obj.accounts = message.accounts; } @@ -767,6 +792,13 @@ export const QueryAccountsResponse = { typeUrl: "/cosmos.auth.v1beta1.QueryAccountsResponse", value: QueryAccountsResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryAccountsResponse.typeUrl)) { + return; + } + BaseAccount.registerTypeUrl(); + PageResponse.registerTypeUrl(); } }; function createBaseQueryAccountRequest(): QueryAccountRequest { @@ -783,6 +815,15 @@ function createBaseQueryAccountRequest(): QueryAccountRequest { export const QueryAccountRequest = { typeUrl: "/cosmos.auth.v1beta1.QueryAccountRequest", aminoType: "cosmos-sdk/QueryAccountRequest", + is(o: any): o is QueryAccountRequest { + return o && (o.$typeUrl === QueryAccountRequest.typeUrl || typeof o.address === "string"); + }, + isSDK(o: any): o is QueryAccountRequestSDKType { + return o && (o.$typeUrl === QueryAccountRequest.typeUrl || typeof o.address === "string"); + }, + isAmino(o: any): o is QueryAccountRequestAmino { + return o && (o.$typeUrl === QueryAccountRequest.typeUrl || typeof o.address === "string"); + }, encode(message: QueryAccountRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.address !== "") { writer.uint32(10).string(message.address); @@ -863,7 +904,8 @@ export const QueryAccountRequest = { typeUrl: "/cosmos.auth.v1beta1.QueryAccountRequest", value: QueryAccountRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryModuleAccountsRequest(): QueryModuleAccountsRequest { return {}; @@ -877,6 +919,15 @@ function createBaseQueryModuleAccountsRequest(): QueryModuleAccountsRequest { export const QueryModuleAccountsRequest = { typeUrl: "/cosmos.auth.v1beta1.QueryModuleAccountsRequest", aminoType: "cosmos-sdk/QueryModuleAccountsRequest", + is(o: any): o is QueryModuleAccountsRequest { + return o && o.$typeUrl === QueryModuleAccountsRequest.typeUrl; + }, + isSDK(o: any): o is QueryModuleAccountsRequestSDKType { + return o && o.$typeUrl === QueryModuleAccountsRequest.typeUrl; + }, + isAmino(o: any): o is QueryModuleAccountsRequestAmino { + return o && o.$typeUrl === QueryModuleAccountsRequest.typeUrl; + }, encode(_: QueryModuleAccountsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -941,7 +992,8 @@ export const QueryModuleAccountsRequest = { typeUrl: "/cosmos.auth.v1beta1.QueryModuleAccountsRequest", value: QueryModuleAccountsRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryParamsResponse(): QueryParamsResponse { return { @@ -957,6 +1009,15 @@ function createBaseQueryParamsResponse(): QueryParamsResponse { export const QueryParamsResponse = { typeUrl: "/cosmos.auth.v1beta1.QueryParamsResponse", aminoType: "cosmos-sdk/QueryParamsResponse", + is(o: any): o is QueryParamsResponse { + return o && (o.$typeUrl === QueryParamsResponse.typeUrl || Params.is(o.params)); + }, + isSDK(o: any): o is QueryParamsResponseSDKType { + return o && (o.$typeUrl === QueryParamsResponse.typeUrl || Params.isSDK(o.params)); + }, + isAmino(o: any): o is QueryParamsResponseAmino { + return o && (o.$typeUrl === QueryParamsResponse.typeUrl || Params.isAmino(o.params)); + }, encode(message: QueryParamsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.params !== undefined) { Params.encode(message.params, writer.uint32(10).fork()).ldelim(); @@ -1039,6 +1100,12 @@ export const QueryParamsResponse = { typeUrl: "/cosmos.auth.v1beta1.QueryParamsResponse", value: QueryParamsResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryParamsResponse.typeUrl)) { + return; + } + Params.registerTypeUrl(); } }; function createBaseQueryAccountResponse(): QueryAccountResponse { @@ -1055,9 +1122,18 @@ function createBaseQueryAccountResponse(): QueryAccountResponse { export const QueryAccountResponse = { typeUrl: "/cosmos.auth.v1beta1.QueryAccountResponse", aminoType: "cosmos-sdk/QueryAccountResponse", + is(o: any): o is QueryAccountResponse { + return o && o.$typeUrl === QueryAccountResponse.typeUrl; + }, + isSDK(o: any): o is QueryAccountResponseSDKType { + return o && o.$typeUrl === QueryAccountResponse.typeUrl; + }, + isAmino(o: any): o is QueryAccountResponseAmino { + return o && o.$typeUrl === QueryAccountResponse.typeUrl; + }, encode(message: QueryAccountResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.account !== undefined) { - Any.encode((message.account as Any), writer.uint32(10).fork()).ldelim(); + Any.encode(GlobalDecoderRegistry.wrapAny(message.account), writer.uint32(10).fork()).ldelim(); } return writer; }, @@ -1069,7 +1145,7 @@ export const QueryAccountResponse = { const tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.account = (AccountI_InterfaceDecoder(reader) as Any); + message.account = GlobalDecoderRegistry.unwrapAny(reader); break; default: reader.skipType(tag & 7); @@ -1080,41 +1156,41 @@ export const QueryAccountResponse = { }, fromJSON(object: any): QueryAccountResponse { const obj = createBaseQueryAccountResponse(); - if (isSet(object.account)) obj.account = Any.fromJSON(object.account); + if (isSet(object.account)) obj.account = GlobalDecoderRegistry.fromJSON(object.account); return obj; }, toJSON(message: QueryAccountResponse): JsonSafe { const obj: any = {}; - message.account !== undefined && (obj.account = message.account ? Any.toJSON(message.account) : undefined); + message.account !== undefined && (obj.account = message.account ? GlobalDecoderRegistry.toJSON(message.account) : undefined); return obj; }, fromPartial(object: DeepPartial): QueryAccountResponse { const message = createBaseQueryAccountResponse(); if (object.account !== undefined && object.account !== null) { - message.account = Any.fromPartial(object.account); + message.account = GlobalDecoderRegistry.fromPartial(object.account); } return message; }, fromSDK(object: QueryAccountResponseSDKType): QueryAccountResponse { return { - account: object.account ? Any.fromSDK(object.account) : undefined + account: object.account ? GlobalDecoderRegistry.fromSDK(object.account) : undefined }; }, toSDK(message: QueryAccountResponse): QueryAccountResponseSDKType { const obj: any = {}; - message.account !== undefined && (obj.account = message.account ? Any.toSDK(message.account) : undefined); + message.account !== undefined && (obj.account = message.account ? GlobalDecoderRegistry.toSDK(message.account) : undefined); return obj; }, fromAmino(object: QueryAccountResponseAmino): QueryAccountResponse { const message = createBaseQueryAccountResponse(); if (object.account !== undefined && object.account !== null) { - message.account = AccountI_FromAmino(object.account); + message.account = GlobalDecoderRegistry.fromAminoMsg(object.account); } return message; }, toAmino(message: QueryAccountResponse): QueryAccountResponseAmino { const obj: any = {}; - obj.account = message.account ? AccountI_ToAmino((message.account as Any)) : undefined; + obj.account = message.account ? GlobalDecoderRegistry.toAminoMsg(message.account) : undefined; return obj; }, fromAminoMsg(object: QueryAccountResponseAminoMsg): QueryAccountResponse { @@ -1137,6 +1213,12 @@ export const QueryAccountResponse = { typeUrl: "/cosmos.auth.v1beta1.QueryAccountResponse", value: QueryAccountResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryAccountResponse.typeUrl)) { + return; + } + BaseAccount.registerTypeUrl(); } }; function createBaseQueryParamsRequest(): QueryParamsRequest { @@ -1151,6 +1233,15 @@ function createBaseQueryParamsRequest(): QueryParamsRequest { export const QueryParamsRequest = { typeUrl: "/cosmos.auth.v1beta1.QueryParamsRequest", aminoType: "cosmos-sdk/QueryParamsRequest", + is(o: any): o is QueryParamsRequest { + return o && o.$typeUrl === QueryParamsRequest.typeUrl; + }, + isSDK(o: any): o is QueryParamsRequestSDKType { + return o && o.$typeUrl === QueryParamsRequest.typeUrl; + }, + isAmino(o: any): o is QueryParamsRequestAmino { + return o && o.$typeUrl === QueryParamsRequest.typeUrl; + }, encode(_: QueryParamsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -1215,7 +1306,8 @@ export const QueryParamsRequest = { typeUrl: "/cosmos.auth.v1beta1.QueryParamsRequest", value: QueryParamsRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryModuleAccountsResponse(): QueryModuleAccountsResponse { return { @@ -1231,9 +1323,18 @@ function createBaseQueryModuleAccountsResponse(): QueryModuleAccountsResponse { export const QueryModuleAccountsResponse = { typeUrl: "/cosmos.auth.v1beta1.QueryModuleAccountsResponse", aminoType: "cosmos-sdk/QueryModuleAccountsResponse", + is(o: any): o is QueryModuleAccountsResponse { + return o && (o.$typeUrl === QueryModuleAccountsResponse.typeUrl || Array.isArray(o.accounts) && (!o.accounts.length || ModuleAccount.is(o.accounts[0]) || Any.is(o.accounts[0]))); + }, + isSDK(o: any): o is QueryModuleAccountsResponseSDKType { + return o && (o.$typeUrl === QueryModuleAccountsResponse.typeUrl || Array.isArray(o.accounts) && (!o.accounts.length || ModuleAccount.isSDK(o.accounts[0]) || Any.isSDK(o.accounts[0]))); + }, + isAmino(o: any): o is QueryModuleAccountsResponseAmino { + return o && (o.$typeUrl === QueryModuleAccountsResponse.typeUrl || Array.isArray(o.accounts) && (!o.accounts.length || ModuleAccount.isAmino(o.accounts[0]) || Any.isAmino(o.accounts[0]))); + }, encode(message: QueryModuleAccountsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.accounts) { - Any.encode((v! as Any), writer.uint32(10).fork()).ldelim(); + Any.encode(GlobalDecoderRegistry.wrapAny(v!), writer.uint32(10).fork()).ldelim(); } return writer; }, @@ -1245,7 +1346,7 @@ export const QueryModuleAccountsResponse = { const tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.accounts.push((Any.decode(reader, reader.uint32()) as Any)); + message.accounts.push(GlobalDecoderRegistry.unwrapAny(reader)); break; default: reader.skipType(tag & 7); @@ -1256,13 +1357,13 @@ export const QueryModuleAccountsResponse = { }, fromJSON(object: any): QueryModuleAccountsResponse { const obj = createBaseQueryModuleAccountsResponse(); - if (Array.isArray(object?.accounts)) obj.accounts = object.accounts.map((e: any) => Any.fromJSON(e)); + if (Array.isArray(object?.accounts)) obj.accounts = object.accounts.map((e: any) => GlobalDecoderRegistry.fromJSON(e)); return obj; }, toJSON(message: QueryModuleAccountsResponse): JsonSafe { const obj: any = {}; if (message.accounts) { - obj.accounts = message.accounts.map(e => e ? Any.toJSON(e) : undefined); + obj.accounts = message.accounts.map(e => e ? GlobalDecoderRegistry.toJSON(e) : undefined); } else { obj.accounts = []; } @@ -1270,18 +1371,18 @@ export const QueryModuleAccountsResponse = { }, fromPartial(object: DeepPartial): QueryModuleAccountsResponse { const message = createBaseQueryModuleAccountsResponse(); - message.accounts = object.accounts?.map(e => Any.fromPartial(e)) || []; + message.accounts = object.accounts?.map(e => (GlobalDecoderRegistry.fromPartial(e) as any)) || []; return message; }, fromSDK(object: QueryModuleAccountsResponseSDKType): QueryModuleAccountsResponse { return { - accounts: Array.isArray(object?.accounts) ? object.accounts.map((e: any) => Any.fromSDK(e)) : [] + accounts: Array.isArray(object?.accounts) ? object.accounts.map((e: any) => GlobalDecoderRegistry.fromSDK(e)) : [] }; }, toSDK(message: QueryModuleAccountsResponse): QueryModuleAccountsResponseSDKType { const obj: any = {}; if (message.accounts) { - obj.accounts = message.accounts.map(e => e ? Any.toSDK(e) : undefined); + obj.accounts = message.accounts.map(e => e ? GlobalDecoderRegistry.toSDK(e) : undefined); } else { obj.accounts = []; } @@ -1289,13 +1390,13 @@ export const QueryModuleAccountsResponse = { }, fromAmino(object: QueryModuleAccountsResponseAmino): QueryModuleAccountsResponse { const message = createBaseQueryModuleAccountsResponse(); - message.accounts = object.accounts?.map(e => ModuleAccountI_FromAmino(e)) || []; + message.accounts = object.accounts?.map(e => GlobalDecoderRegistry.fromAminoMsg(e)) || []; return message; }, toAmino(message: QueryModuleAccountsResponse): QueryModuleAccountsResponseAmino { const obj: any = {}; if (message.accounts) { - obj.accounts = message.accounts.map(e => e ? ModuleAccountI_ToAmino((e as Any)) : undefined); + obj.accounts = message.accounts.map(e => e ? GlobalDecoderRegistry.toAminoMsg(e) : undefined); } else { obj.accounts = message.accounts; } @@ -1321,6 +1422,12 @@ export const QueryModuleAccountsResponse = { typeUrl: "/cosmos.auth.v1beta1.QueryModuleAccountsResponse", value: QueryModuleAccountsResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryModuleAccountsResponse.typeUrl)) { + return; + } + ModuleAccount.registerTypeUrl(); } }; function createBaseBech32PrefixRequest(): Bech32PrefixRequest { @@ -1335,6 +1442,15 @@ function createBaseBech32PrefixRequest(): Bech32PrefixRequest { export const Bech32PrefixRequest = { typeUrl: "/cosmos.auth.v1beta1.Bech32PrefixRequest", aminoType: "cosmos-sdk/Bech32PrefixRequest", + is(o: any): o is Bech32PrefixRequest { + return o && o.$typeUrl === Bech32PrefixRequest.typeUrl; + }, + isSDK(o: any): o is Bech32PrefixRequestSDKType { + return o && o.$typeUrl === Bech32PrefixRequest.typeUrl; + }, + isAmino(o: any): o is Bech32PrefixRequestAmino { + return o && o.$typeUrl === Bech32PrefixRequest.typeUrl; + }, encode(_: Bech32PrefixRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -1399,7 +1515,8 @@ export const Bech32PrefixRequest = { typeUrl: "/cosmos.auth.v1beta1.Bech32PrefixRequest", value: Bech32PrefixRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseBech32PrefixResponse(): Bech32PrefixResponse { return { @@ -1415,6 +1532,15 @@ function createBaseBech32PrefixResponse(): Bech32PrefixResponse { export const Bech32PrefixResponse = { typeUrl: "/cosmos.auth.v1beta1.Bech32PrefixResponse", aminoType: "cosmos-sdk/Bech32PrefixResponse", + is(o: any): o is Bech32PrefixResponse { + return o && (o.$typeUrl === Bech32PrefixResponse.typeUrl || typeof o.bech32Prefix === "string"); + }, + isSDK(o: any): o is Bech32PrefixResponseSDKType { + return o && (o.$typeUrl === Bech32PrefixResponse.typeUrl || typeof o.bech32_prefix === "string"); + }, + isAmino(o: any): o is Bech32PrefixResponseAmino { + return o && (o.$typeUrl === Bech32PrefixResponse.typeUrl || typeof o.bech32_prefix === "string"); + }, encode(message: Bech32PrefixResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.bech32Prefix !== "") { writer.uint32(10).string(message.bech32Prefix); @@ -1495,7 +1621,8 @@ export const Bech32PrefixResponse = { typeUrl: "/cosmos.auth.v1beta1.Bech32PrefixResponse", value: Bech32PrefixResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseAddressBytesToStringRequest(): AddressBytesToStringRequest { return { @@ -1511,6 +1638,15 @@ function createBaseAddressBytesToStringRequest(): AddressBytesToStringRequest { export const AddressBytesToStringRequest = { typeUrl: "/cosmos.auth.v1beta1.AddressBytesToStringRequest", aminoType: "cosmos-sdk/AddressBytesToStringRequest", + is(o: any): o is AddressBytesToStringRequest { + return o && (o.$typeUrl === AddressBytesToStringRequest.typeUrl || o.addressBytes instanceof Uint8Array || typeof o.addressBytes === "string"); + }, + isSDK(o: any): o is AddressBytesToStringRequestSDKType { + return o && (o.$typeUrl === AddressBytesToStringRequest.typeUrl || o.address_bytes instanceof Uint8Array || typeof o.address_bytes === "string"); + }, + isAmino(o: any): o is AddressBytesToStringRequestAmino { + return o && (o.$typeUrl === AddressBytesToStringRequest.typeUrl || o.address_bytes instanceof Uint8Array || typeof o.address_bytes === "string"); + }, encode(message: AddressBytesToStringRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.addressBytes.length !== 0) { writer.uint32(10).bytes(message.addressBytes); @@ -1591,7 +1727,8 @@ export const AddressBytesToStringRequest = { typeUrl: "/cosmos.auth.v1beta1.AddressBytesToStringRequest", value: AddressBytesToStringRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseAddressBytesToStringResponse(): AddressBytesToStringResponse { return { @@ -1607,6 +1744,15 @@ function createBaseAddressBytesToStringResponse(): AddressBytesToStringResponse export const AddressBytesToStringResponse = { typeUrl: "/cosmos.auth.v1beta1.AddressBytesToStringResponse", aminoType: "cosmos-sdk/AddressBytesToStringResponse", + is(o: any): o is AddressBytesToStringResponse { + return o && (o.$typeUrl === AddressBytesToStringResponse.typeUrl || typeof o.addressString === "string"); + }, + isSDK(o: any): o is AddressBytesToStringResponseSDKType { + return o && (o.$typeUrl === AddressBytesToStringResponse.typeUrl || typeof o.address_string === "string"); + }, + isAmino(o: any): o is AddressBytesToStringResponseAmino { + return o && (o.$typeUrl === AddressBytesToStringResponse.typeUrl || typeof o.address_string === "string"); + }, encode(message: AddressBytesToStringResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.addressString !== "") { writer.uint32(10).string(message.addressString); @@ -1687,7 +1833,8 @@ export const AddressBytesToStringResponse = { typeUrl: "/cosmos.auth.v1beta1.AddressBytesToStringResponse", value: AddressBytesToStringResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseAddressStringToBytesRequest(): AddressStringToBytesRequest { return { @@ -1703,6 +1850,15 @@ function createBaseAddressStringToBytesRequest(): AddressStringToBytesRequest { export const AddressStringToBytesRequest = { typeUrl: "/cosmos.auth.v1beta1.AddressStringToBytesRequest", aminoType: "cosmos-sdk/AddressStringToBytesRequest", + is(o: any): o is AddressStringToBytesRequest { + return o && (o.$typeUrl === AddressStringToBytesRequest.typeUrl || typeof o.addressString === "string"); + }, + isSDK(o: any): o is AddressStringToBytesRequestSDKType { + return o && (o.$typeUrl === AddressStringToBytesRequest.typeUrl || typeof o.address_string === "string"); + }, + isAmino(o: any): o is AddressStringToBytesRequestAmino { + return o && (o.$typeUrl === AddressStringToBytesRequest.typeUrl || typeof o.address_string === "string"); + }, encode(message: AddressStringToBytesRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.addressString !== "") { writer.uint32(10).string(message.addressString); @@ -1783,7 +1939,8 @@ export const AddressStringToBytesRequest = { typeUrl: "/cosmos.auth.v1beta1.AddressStringToBytesRequest", value: AddressStringToBytesRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseAddressStringToBytesResponse(): AddressStringToBytesResponse { return { @@ -1799,6 +1956,15 @@ function createBaseAddressStringToBytesResponse(): AddressStringToBytesResponse export const AddressStringToBytesResponse = { typeUrl: "/cosmos.auth.v1beta1.AddressStringToBytesResponse", aminoType: "cosmos-sdk/AddressStringToBytesResponse", + is(o: any): o is AddressStringToBytesResponse { + return o && (o.$typeUrl === AddressStringToBytesResponse.typeUrl || o.addressBytes instanceof Uint8Array || typeof o.addressBytes === "string"); + }, + isSDK(o: any): o is AddressStringToBytesResponseSDKType { + return o && (o.$typeUrl === AddressStringToBytesResponse.typeUrl || o.address_bytes instanceof Uint8Array || typeof o.address_bytes === "string"); + }, + isAmino(o: any): o is AddressStringToBytesResponseAmino { + return o && (o.$typeUrl === AddressStringToBytesResponse.typeUrl || o.address_bytes instanceof Uint8Array || typeof o.address_bytes === "string"); + }, encode(message: AddressStringToBytesResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.addressBytes.length !== 0) { writer.uint32(10).bytes(message.addressBytes); @@ -1879,69 +2045,6 @@ export const AddressStringToBytesResponse = { typeUrl: "/cosmos.auth.v1beta1.AddressStringToBytesResponse", value: AddressStringToBytesResponse.encode(message).finish() }; - } -}; -export const AccountI_InterfaceDecoder = (input: BinaryReader | Uint8Array): BaseAccount | Any => { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - const data = Any.decode(reader, reader.uint32()); - switch (data.typeUrl) { - case "/cosmos.auth.v1beta1.BaseAccount": - return BaseAccount.decode(data.value); - default: - return data; - } -}; -export const AccountI_FromAmino = (content: AnyAmino): Any => { - switch (content.type) { - case "cosmos-sdk/BaseAccount": - return Any.fromPartial({ - typeUrl: "/cosmos.auth.v1beta1.BaseAccount", - value: BaseAccount.encode(BaseAccount.fromPartial(BaseAccount.fromAmino(content.value))).finish() - }); - default: - return Any.fromAmino(content); - } -}; -export const AccountI_ToAmino = (content: Any) => { - switch (content.typeUrl) { - case "/cosmos.auth.v1beta1.BaseAccount": - return { - type: "cosmos-sdk/BaseAccount", - value: BaseAccount.toAmino(BaseAccount.decode(content.value, undefined)) - }; - default: - return Any.toAmino(content); - } -}; -export const ModuleAccountI_InterfaceDecoder = (input: BinaryReader | Uint8Array): ModuleAccount | Any => { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - const data = Any.decode(reader, reader.uint32()); - switch (data.typeUrl) { - case "/cosmos.auth.v1beta1.ModuleAccount": - return ModuleAccount.decode(data.value); - default: - return data; - } -}; -export const ModuleAccountI_FromAmino = (content: AnyAmino): Any => { - switch (content.type) { - case "cosmos-sdk/ModuleAccount": - return Any.fromPartial({ - typeUrl: "/cosmos.auth.v1beta1.ModuleAccount", - value: ModuleAccount.encode(ModuleAccount.fromPartial(ModuleAccount.fromAmino(content.value))).finish() - }); - default: - return Any.fromAmino(content); - } -}; -export const ModuleAccountI_ToAmino = (content: Any) => { - switch (content.typeUrl) { - case "/cosmos.auth.v1beta1.ModuleAccount": - return { - type: "cosmos-sdk/ModuleAccount", - value: ModuleAccount.toAmino(ModuleAccount.decode(content.value, undefined)) - }; - default: - return Any.toAmino(content); - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/cosmos/authz/v1beta1/authz.ts b/__fixtures__/v-next/outputv2/cosmos/authz/v1beta1/authz.ts index b5fc2c36b4..302638fcfb 100644 --- a/__fixtures__/v-next/outputv2/cosmos/authz/v1beta1/authz.ts +++ b/__fixtures__/v-next/outputv2/cosmos/authz/v1beta1/authz.ts @@ -11,6 +11,7 @@ import { StakeAuthorization, StakeAuthorizationProtoMsg, StakeAuthorizationSDKTy import { BinaryReader, BinaryWriter } from "../../../binary"; import { isSet, DeepPartial, toTimestamp, fromTimestamp } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "cosmos.authz.v1beta1"; /** * GenericAuthorization gives the grantee unrestricted permissions to execute @@ -219,6 +220,15 @@ function createBaseGenericAuthorization(): GenericAuthorization { export const GenericAuthorization = { typeUrl: "/cosmos.authz.v1beta1.GenericAuthorization", aminoType: "cosmos-sdk/GenericAuthorization", + is(o: any): o is GenericAuthorization { + return o && (o.$typeUrl === GenericAuthorization.typeUrl || typeof o.msg === "string"); + }, + isSDK(o: any): o is GenericAuthorizationSDKType { + return o && (o.$typeUrl === GenericAuthorization.typeUrl || typeof o.msg === "string"); + }, + isAmino(o: any): o is GenericAuthorizationAmino { + return o && (o.$typeUrl === GenericAuthorization.typeUrl || typeof o.msg === "string"); + }, encode(message: GenericAuthorization, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.msg !== "") { writer.uint32(10).string(message.msg); @@ -299,6 +309,13 @@ export const GenericAuthorization = { typeUrl: "/cosmos.authz.v1beta1.GenericAuthorization", value: GenericAuthorization.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GenericAuthorization.typeUrl)) { + return; + } + GlobalDecoderRegistry.register(GenericAuthorization.typeUrl, GenericAuthorization); + GlobalDecoderRegistry.registerAminoProtoMapping(GenericAuthorization.aminoType, GenericAuthorization.typeUrl); } }; function createBaseGrant(): Grant { @@ -317,9 +334,18 @@ function createBaseGrant(): Grant { export const Grant = { typeUrl: "/cosmos.authz.v1beta1.Grant", aminoType: "cosmos-sdk/Grant", + is(o: any): o is Grant { + return o && o.$typeUrl === Grant.typeUrl; + }, + isSDK(o: any): o is GrantSDKType { + return o && o.$typeUrl === Grant.typeUrl; + }, + isAmino(o: any): o is GrantAmino { + return o && o.$typeUrl === Grant.typeUrl; + }, encode(message: Grant, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.authorization !== undefined) { - Any.encode((message.authorization as Any), writer.uint32(10).fork()).ldelim(); + Any.encode(GlobalDecoderRegistry.wrapAny(message.authorization), writer.uint32(10).fork()).ldelim(); } if (message.expiration !== undefined) { Timestamp.encode(toTimestamp(message.expiration), writer.uint32(18).fork()).ldelim(); @@ -334,7 +360,7 @@ export const Grant = { const tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.authorization = (Authorization_InterfaceDecoder(reader) as Any); + message.authorization = GlobalDecoderRegistry.unwrapAny(reader); break; case 2: message.expiration = fromTimestamp(Timestamp.decode(reader, reader.uint32())); @@ -348,40 +374,40 @@ export const Grant = { }, fromJSON(object: any): Grant { const obj = createBaseGrant(); - if (isSet(object.authorization)) obj.authorization = Any.fromJSON(object.authorization); + if (isSet(object.authorization)) obj.authorization = GlobalDecoderRegistry.fromJSON(object.authorization); if (isSet(object.expiration)) obj.expiration = new Date(object.expiration); return obj; }, toJSON(message: Grant): JsonSafe { const obj: any = {}; - message.authorization !== undefined && (obj.authorization = message.authorization ? Any.toJSON(message.authorization) : undefined); + message.authorization !== undefined && (obj.authorization = message.authorization ? GlobalDecoderRegistry.toJSON(message.authorization) : undefined); message.expiration !== undefined && (obj.expiration = message.expiration.toISOString()); return obj; }, fromPartial(object: DeepPartial): Grant { const message = createBaseGrant(); if (object.authorization !== undefined && object.authorization !== null) { - message.authorization = Any.fromPartial(object.authorization); + message.authorization = GlobalDecoderRegistry.fromPartial(object.authorization); } message.expiration = object.expiration ?? undefined; return message; }, fromSDK(object: GrantSDKType): Grant { return { - authorization: object.authorization ? Any.fromSDK(object.authorization) : undefined, + authorization: object.authorization ? GlobalDecoderRegistry.fromSDK(object.authorization) : undefined, expiration: object.expiration ?? undefined }; }, toSDK(message: Grant): GrantSDKType { const obj: any = {}; - message.authorization !== undefined && (obj.authorization = message.authorization ? Any.toSDK(message.authorization) : undefined); + message.authorization !== undefined && (obj.authorization = message.authorization ? GlobalDecoderRegistry.toSDK(message.authorization) : undefined); message.expiration !== undefined && (obj.expiration = message.expiration ?? undefined); return obj; }, fromAmino(object: GrantAmino): Grant { const message = createBaseGrant(); if (object.authorization !== undefined && object.authorization !== null) { - message.authorization = Authorization_FromAmino(object.authorization); + message.authorization = GlobalDecoderRegistry.fromAminoMsg(object.authorization); } if (object.expiration !== undefined && object.expiration !== null) { message.expiration = fromTimestamp(Timestamp.fromAmino(object.expiration)); @@ -390,7 +416,7 @@ export const Grant = { }, toAmino(message: Grant): GrantAmino { const obj: any = {}; - obj.authorization = message.authorization ? Authorization_ToAmino((message.authorization as Any)) : undefined; + obj.authorization = message.authorization ? GlobalDecoderRegistry.toAminoMsg(message.authorization) : undefined; obj.expiration = message.expiration ? Timestamp.toAmino(toTimestamp(message.expiration)) : undefined; return obj; }, @@ -414,6 +440,16 @@ export const Grant = { typeUrl: "/cosmos.authz.v1beta1.Grant", value: Grant.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Grant.typeUrl)) { + return; + } + GenericAuthorization.registerTypeUrl(); + DepositDeploymentAuthorization1.registerTypeUrl(); + DepositDeploymentAuthorization2.registerTypeUrl(); + SendAuthorization.registerTypeUrl(); + StakeAuthorization.registerTypeUrl(); } }; function createBaseGrantAuthorization(): GrantAuthorization { @@ -434,6 +470,15 @@ function createBaseGrantAuthorization(): GrantAuthorization { export const GrantAuthorization = { typeUrl: "/cosmos.authz.v1beta1.GrantAuthorization", aminoType: "cosmos-sdk/GrantAuthorization", + is(o: any): o is GrantAuthorization { + return o && (o.$typeUrl === GrantAuthorization.typeUrl || typeof o.granter === "string" && typeof o.grantee === "string"); + }, + isSDK(o: any): o is GrantAuthorizationSDKType { + return o && (o.$typeUrl === GrantAuthorization.typeUrl || typeof o.granter === "string" && typeof o.grantee === "string"); + }, + isAmino(o: any): o is GrantAuthorizationAmino { + return o && (o.$typeUrl === GrantAuthorization.typeUrl || typeof o.granter === "string" && typeof o.grantee === "string"); + }, encode(message: GrantAuthorization, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.granter !== "") { writer.uint32(10).string(message.granter); @@ -442,7 +487,7 @@ export const GrantAuthorization = { writer.uint32(18).string(message.grantee); } if (message.authorization !== undefined) { - Any.encode((message.authorization as Any), writer.uint32(26).fork()).ldelim(); + Any.encode(GlobalDecoderRegistry.wrapAny(message.authorization), writer.uint32(26).fork()).ldelim(); } if (message.expiration !== undefined) { Timestamp.encode(toTimestamp(message.expiration), writer.uint32(34).fork()).ldelim(); @@ -463,7 +508,7 @@ export const GrantAuthorization = { message.grantee = reader.string(); break; case 3: - message.authorization = (Authorization_InterfaceDecoder(reader) as Any); + message.authorization = GlobalDecoderRegistry.unwrapAny(reader); break; case 4: message.expiration = fromTimestamp(Timestamp.decode(reader, reader.uint32())); @@ -479,7 +524,7 @@ export const GrantAuthorization = { const obj = createBaseGrantAuthorization(); if (isSet(object.granter)) obj.granter = String(object.granter); if (isSet(object.grantee)) obj.grantee = String(object.grantee); - if (isSet(object.authorization)) obj.authorization = Any.fromJSON(object.authorization); + if (isSet(object.authorization)) obj.authorization = GlobalDecoderRegistry.fromJSON(object.authorization); if (isSet(object.expiration)) obj.expiration = new Date(object.expiration); return obj; }, @@ -487,7 +532,7 @@ export const GrantAuthorization = { const obj: any = {}; message.granter !== undefined && (obj.granter = message.granter); message.grantee !== undefined && (obj.grantee = message.grantee); - message.authorization !== undefined && (obj.authorization = message.authorization ? Any.toJSON(message.authorization) : undefined); + message.authorization !== undefined && (obj.authorization = message.authorization ? GlobalDecoderRegistry.toJSON(message.authorization) : undefined); message.expiration !== undefined && (obj.expiration = message.expiration.toISOString()); return obj; }, @@ -496,7 +541,7 @@ export const GrantAuthorization = { message.granter = object.granter ?? ""; message.grantee = object.grantee ?? ""; if (object.authorization !== undefined && object.authorization !== null) { - message.authorization = Any.fromPartial(object.authorization); + message.authorization = GlobalDecoderRegistry.fromPartial(object.authorization); } message.expiration = object.expiration ?? undefined; return message; @@ -505,7 +550,7 @@ export const GrantAuthorization = { return { granter: object?.granter, grantee: object?.grantee, - authorization: object.authorization ? Any.fromSDK(object.authorization) : undefined, + authorization: object.authorization ? GlobalDecoderRegistry.fromSDK(object.authorization) : undefined, expiration: object.expiration ?? undefined }; }, @@ -513,7 +558,7 @@ export const GrantAuthorization = { const obj: any = {}; obj.granter = message.granter; obj.grantee = message.grantee; - message.authorization !== undefined && (obj.authorization = message.authorization ? Any.toSDK(message.authorization) : undefined); + message.authorization !== undefined && (obj.authorization = message.authorization ? GlobalDecoderRegistry.toSDK(message.authorization) : undefined); message.expiration !== undefined && (obj.expiration = message.expiration ?? undefined); return obj; }, @@ -526,7 +571,7 @@ export const GrantAuthorization = { message.grantee = object.grantee; } if (object.authorization !== undefined && object.authorization !== null) { - message.authorization = Authorization_FromAmino(object.authorization); + message.authorization = GlobalDecoderRegistry.fromAminoMsg(object.authorization); } if (object.expiration !== undefined && object.expiration !== null) { message.expiration = fromTimestamp(Timestamp.fromAmino(object.expiration)); @@ -537,7 +582,7 @@ export const GrantAuthorization = { const obj: any = {}; obj.granter = message.granter === "" ? undefined : message.granter; obj.grantee = message.grantee === "" ? undefined : message.grantee; - obj.authorization = message.authorization ? Authorization_ToAmino((message.authorization as Any)) : undefined; + obj.authorization = message.authorization ? GlobalDecoderRegistry.toAminoMsg(message.authorization) : undefined; obj.expiration = message.expiration ? Timestamp.toAmino(toTimestamp(message.expiration)) : undefined; return obj; }, @@ -561,6 +606,16 @@ export const GrantAuthorization = { typeUrl: "/cosmos.authz.v1beta1.GrantAuthorization", value: GrantAuthorization.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GrantAuthorization.typeUrl)) { + return; + } + GenericAuthorization.registerTypeUrl(); + DepositDeploymentAuthorization1.registerTypeUrl(); + DepositDeploymentAuthorization2.registerTypeUrl(); + SendAuthorization.registerTypeUrl(); + StakeAuthorization.registerTypeUrl(); } }; function createBaseGrantQueueItem(): GrantQueueItem { @@ -577,6 +632,15 @@ function createBaseGrantQueueItem(): GrantQueueItem { export const GrantQueueItem = { typeUrl: "/cosmos.authz.v1beta1.GrantQueueItem", aminoType: "cosmos-sdk/GrantQueueItem", + is(o: any): o is GrantQueueItem { + return o && (o.$typeUrl === GrantQueueItem.typeUrl || Array.isArray(o.msgTypeUrls) && (!o.msgTypeUrls.length || typeof o.msgTypeUrls[0] === "string")); + }, + isSDK(o: any): o is GrantQueueItemSDKType { + return o && (o.$typeUrl === GrantQueueItem.typeUrl || Array.isArray(o.msg_type_urls) && (!o.msg_type_urls.length || typeof o.msg_type_urls[0] === "string")); + }, + isAmino(o: any): o is GrantQueueItemAmino { + return o && (o.$typeUrl === GrantQueueItem.typeUrl || Array.isArray(o.msg_type_urls) && (!o.msg_type_urls.length || typeof o.msg_type_urls[0] === "string")); + }, encode(message: GrantQueueItem, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.msgTypeUrls) { writer.uint32(10).string(v!); @@ -667,85 +731,6 @@ export const GrantQueueItem = { typeUrl: "/cosmos.authz.v1beta1.GrantQueueItem", value: GrantQueueItem.encode(message).finish() }; - } -}; -export const Authorization_InterfaceDecoder = (input: BinaryReader | Uint8Array): DepositDeploymentAuthorization1 | DepositDeploymentAuthorization2 | GenericAuthorization | SendAuthorization | StakeAuthorization | Any => { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - const data = Any.decode(reader, reader.uint32()); - switch (data.typeUrl) { - case "/akash.deployment.v1beta1.DepositDeploymentAuthorization": - return DepositDeploymentAuthorization1.decode(data.value); - case "/akash.deployment.v1beta2.DepositDeploymentAuthorization": - return DepositDeploymentAuthorization2.decode(data.value); - case "/cosmos.authz.v1beta1.GenericAuthorization": - return GenericAuthorization.decode(data.value); - case "/cosmos.bank.v1beta1.SendAuthorization": - return SendAuthorization.decode(data.value); - case "/cosmos.staking.v1beta1.StakeAuthorization": - return StakeAuthorization.decode(data.value); - default: - return data; - } -}; -export const Authorization_FromAmino = (content: AnyAmino): Any => { - switch (content.type) { - case "/akash.deployment.v1beta1.DepositDeploymentAuthorization": - return Any.fromPartial({ - typeUrl: "/akash.deployment.v1beta1.DepositDeploymentAuthorization", - value: DepositDeploymentAuthorization1.encode(DepositDeploymentAuthorization1.fromPartial(DepositDeploymentAuthorization1.fromAmino(content.value))).finish() - }); - case "/akash.deployment.v1beta2.DepositDeploymentAuthorization": - return Any.fromPartial({ - typeUrl: "/akash.deployment.v1beta2.DepositDeploymentAuthorization", - value: DepositDeploymentAuthorization2.encode(DepositDeploymentAuthorization2.fromPartial(DepositDeploymentAuthorization2.fromAmino(content.value))).finish() - }); - case "cosmos-sdk/GenericAuthorization": - return Any.fromPartial({ - typeUrl: "/cosmos.authz.v1beta1.GenericAuthorization", - value: GenericAuthorization.encode(GenericAuthorization.fromPartial(GenericAuthorization.fromAmino(content.value))).finish() - }); - case "cosmos-sdk/SendAuthorization": - return Any.fromPartial({ - typeUrl: "/cosmos.bank.v1beta1.SendAuthorization", - value: SendAuthorization.encode(SendAuthorization.fromPartial(SendAuthorization.fromAmino(content.value))).finish() - }); - case "cosmos-sdk/StakeAuthorization": - return Any.fromPartial({ - typeUrl: "/cosmos.staking.v1beta1.StakeAuthorization", - value: StakeAuthorization.encode(StakeAuthorization.fromPartial(StakeAuthorization.fromAmino(content.value))).finish() - }); - default: - return Any.fromAmino(content); - } -}; -export const Authorization_ToAmino = (content: Any) => { - switch (content.typeUrl) { - case "/akash.deployment.v1beta1.DepositDeploymentAuthorization": - return { - type: "/akash.deployment.v1beta1.DepositDeploymentAuthorization", - value: DepositDeploymentAuthorization1.toAmino(DepositDeploymentAuthorization1.decode(content.value, undefined)) - }; - case "/akash.deployment.v1beta2.DepositDeploymentAuthorization": - return { - type: "/akash.deployment.v1beta2.DepositDeploymentAuthorization", - value: DepositDeploymentAuthorization2.toAmino(DepositDeploymentAuthorization2.decode(content.value, undefined)) - }; - case "/cosmos.authz.v1beta1.GenericAuthorization": - return { - type: "cosmos-sdk/GenericAuthorization", - value: GenericAuthorization.toAmino(GenericAuthorization.decode(content.value, undefined)) - }; - case "/cosmos.bank.v1beta1.SendAuthorization": - return { - type: "cosmos-sdk/SendAuthorization", - value: SendAuthorization.toAmino(SendAuthorization.decode(content.value, undefined)) - }; - case "/cosmos.staking.v1beta1.StakeAuthorization": - return { - type: "cosmos-sdk/StakeAuthorization", - value: StakeAuthorization.toAmino(StakeAuthorization.decode(content.value, undefined)) - }; - default: - return Any.toAmino(content); - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/cosmos/authz/v1beta1/genesis.ts b/__fixtures__/v-next/outputv2/cosmos/authz/v1beta1/genesis.ts index 4a63b23699..252ec8ce72 100644 --- a/__fixtures__/v-next/outputv2/cosmos/authz/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv2/cosmos/authz/v1beta1/genesis.ts @@ -2,6 +2,7 @@ import { GrantAuthorization, GrantAuthorizationAmino, GrantAuthorizationSDKType import { BinaryReader, BinaryWriter } from "../../../binary"; import { JsonSafe } from "../../../json-safe"; import { DeepPartial } from "../../../helpers"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "cosmos.authz.v1beta1"; /** * GenesisState defines the authz module's genesis state. @@ -52,6 +53,15 @@ function createBaseGenesisState(): GenesisState { export const GenesisState = { typeUrl: "/cosmos.authz.v1beta1.GenesisState", aminoType: "cosmos-sdk/GenesisState", + is(o: any): o is GenesisState { + return o && (o.$typeUrl === GenesisState.typeUrl || Array.isArray(o.authorization) && (!o.authorization.length || GrantAuthorization.is(o.authorization[0]))); + }, + isSDK(o: any): o is GenesisStateSDKType { + return o && (o.$typeUrl === GenesisState.typeUrl || Array.isArray(o.authorization) && (!o.authorization.length || GrantAuthorization.isSDK(o.authorization[0]))); + }, + isAmino(o: any): o is GenesisStateAmino { + return o && (o.$typeUrl === GenesisState.typeUrl || Array.isArray(o.authorization) && (!o.authorization.length || GrantAuthorization.isAmino(o.authorization[0]))); + }, encode(message: GenesisState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.authorization) { GrantAuthorization.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -142,5 +152,11 @@ export const GenesisState = { typeUrl: "/cosmos.authz.v1beta1.GenesisState", value: GenesisState.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GenesisState.typeUrl)) { + return; + } + GrantAuthorization.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/cosmos/authz/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputv2/cosmos/authz/v1beta1/query.rpc.func.ts new file mode 100644 index 0000000000..f7670103c2 --- /dev/null +++ b/__fixtures__/v-next/outputv2/cosmos/authz/v1beta1/query.rpc.func.ts @@ -0,0 +1,45 @@ +import { buildQuery } from "../../../helper-func-types"; +import { QueryGrantsRequest, QueryGrantsResponse, QueryGranterGrantsRequest, QueryGranterGrantsResponse, QueryGranteeGrantsRequest, QueryGranteeGrantsResponse } from "./query"; +/** + * Returns list of `Authorization`, granted to the grantee by the granter. + * @name getGrants + * @package cosmos.authz.v1beta1 + * @see proto service: cosmos.authz.v1beta1.Grants + */ +export const getGrants = buildQuery({ + encode: QueryGrantsRequest.encode, + decode: QueryGrantsResponse.decode, + service: "cosmos.authz.v1beta1.Query", + method: "Grants", + deps: [QueryGrantsRequest, QueryGrantsResponse] +}); +/** + * GranterGrants returns list of `GrantAuthorization`, granted by granter. + * + * Since: cosmos-sdk 0.46 + * @name getGranterGrants + * @package cosmos.authz.v1beta1 + * @see proto service: cosmos.authz.v1beta1.GranterGrants + */ +export const getGranterGrants = buildQuery({ + encode: QueryGranterGrantsRequest.encode, + decode: QueryGranterGrantsResponse.decode, + service: "cosmos.authz.v1beta1.Query", + method: "GranterGrants", + deps: [QueryGranterGrantsRequest, QueryGranterGrantsResponse] +}); +/** + * GranteeGrants returns a list of `GrantAuthorization` by grantee. + * + * Since: cosmos-sdk 0.46 + * @name getGranteeGrants + * @package cosmos.authz.v1beta1 + * @see proto service: cosmos.authz.v1beta1.GranteeGrants + */ +export const getGranteeGrants = buildQuery({ + encode: QueryGranteeGrantsRequest.encode, + decode: QueryGranteeGrantsResponse.decode, + service: "cosmos.authz.v1beta1.Query", + method: "GranteeGrants", + deps: [QueryGranteeGrantsRequest, QueryGranteeGrantsResponse] +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/cosmos/authz/v1beta1/query.ts b/__fixtures__/v-next/outputv2/cosmos/authz/v1beta1/query.ts index 68444fe877..55d16f378b 100644 --- a/__fixtures__/v-next/outputv2/cosmos/authz/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv2/cosmos/authz/v1beta1/query.ts @@ -1,6 +1,7 @@ import { PageRequest, PageRequestAmino, PageRequestSDKType, PageResponse, PageResponseAmino, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; import { Grant, GrantAmino, GrantSDKType, GrantAuthorization, GrantAuthorizationAmino, GrantAuthorizationSDKType } from "./authz"; import { BinaryReader, BinaryWriter } from "../../../binary"; +import { GlobalDecoderRegistry } from "../../../registry"; import { isSet, DeepPartial } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "cosmos.authz.v1beta1"; @@ -315,6 +316,15 @@ function createBaseQueryGrantsRequest(): QueryGrantsRequest { export const QueryGrantsRequest = { typeUrl: "/cosmos.authz.v1beta1.QueryGrantsRequest", aminoType: "cosmos-sdk/QueryGrantsRequest", + is(o: any): o is QueryGrantsRequest { + return o && (o.$typeUrl === QueryGrantsRequest.typeUrl || typeof o.granter === "string" && typeof o.grantee === "string" && typeof o.msgTypeUrl === "string"); + }, + isSDK(o: any): o is QueryGrantsRequestSDKType { + return o && (o.$typeUrl === QueryGrantsRequest.typeUrl || typeof o.granter === "string" && typeof o.grantee === "string" && typeof o.msg_type_url === "string"); + }, + isAmino(o: any): o is QueryGrantsRequestAmino { + return o && (o.$typeUrl === QueryGrantsRequest.typeUrl || typeof o.granter === "string" && typeof o.grantee === "string" && typeof o.msg_type_url === "string"); + }, encode(message: QueryGrantsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.granter !== "") { writer.uint32(10).string(message.granter); @@ -442,6 +452,12 @@ export const QueryGrantsRequest = { typeUrl: "/cosmos.authz.v1beta1.QueryGrantsRequest", value: QueryGrantsRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryGrantsRequest.typeUrl)) { + return; + } + PageRequest.registerTypeUrl(); } }; function createBaseQueryGrantsResponse(): QueryGrantsResponse { @@ -459,6 +475,15 @@ function createBaseQueryGrantsResponse(): QueryGrantsResponse { export const QueryGrantsResponse = { typeUrl: "/cosmos.authz.v1beta1.QueryGrantsResponse", aminoType: "cosmos-sdk/QueryGrantsResponse", + is(o: any): o is QueryGrantsResponse { + return o && (o.$typeUrl === QueryGrantsResponse.typeUrl || Array.isArray(o.grants) && (!o.grants.length || Grant.is(o.grants[0]))); + }, + isSDK(o: any): o is QueryGrantsResponseSDKType { + return o && (o.$typeUrl === QueryGrantsResponse.typeUrl || Array.isArray(o.grants) && (!o.grants.length || Grant.isSDK(o.grants[0]))); + }, + isAmino(o: any): o is QueryGrantsResponseAmino { + return o && (o.$typeUrl === QueryGrantsResponse.typeUrl || Array.isArray(o.grants) && (!o.grants.length || Grant.isAmino(o.grants[0]))); + }, encode(message: QueryGrantsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.grants) { Grant.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -566,6 +591,13 @@ export const QueryGrantsResponse = { typeUrl: "/cosmos.authz.v1beta1.QueryGrantsResponse", value: QueryGrantsResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryGrantsResponse.typeUrl)) { + return; + } + Grant.registerTypeUrl(); + PageResponse.registerTypeUrl(); } }; function createBaseQueryGranterGrantsRequest(): QueryGranterGrantsRequest { @@ -583,6 +615,15 @@ function createBaseQueryGranterGrantsRequest(): QueryGranterGrantsRequest { export const QueryGranterGrantsRequest = { typeUrl: "/cosmos.authz.v1beta1.QueryGranterGrantsRequest", aminoType: "cosmos-sdk/QueryGranterGrantsRequest", + is(o: any): o is QueryGranterGrantsRequest { + return o && (o.$typeUrl === QueryGranterGrantsRequest.typeUrl || typeof o.granter === "string"); + }, + isSDK(o: any): o is QueryGranterGrantsRequestSDKType { + return o && (o.$typeUrl === QueryGranterGrantsRequest.typeUrl || typeof o.granter === "string"); + }, + isAmino(o: any): o is QueryGranterGrantsRequestAmino { + return o && (o.$typeUrl === QueryGranterGrantsRequest.typeUrl || typeof o.granter === "string"); + }, encode(message: QueryGranterGrantsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.granter !== "") { writer.uint32(10).string(message.granter); @@ -680,6 +721,12 @@ export const QueryGranterGrantsRequest = { typeUrl: "/cosmos.authz.v1beta1.QueryGranterGrantsRequest", value: QueryGranterGrantsRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryGranterGrantsRequest.typeUrl)) { + return; + } + PageRequest.registerTypeUrl(); } }; function createBaseQueryGranterGrantsResponse(): QueryGranterGrantsResponse { @@ -697,6 +744,15 @@ function createBaseQueryGranterGrantsResponse(): QueryGranterGrantsResponse { export const QueryGranterGrantsResponse = { typeUrl: "/cosmos.authz.v1beta1.QueryGranterGrantsResponse", aminoType: "cosmos-sdk/QueryGranterGrantsResponse", + is(o: any): o is QueryGranterGrantsResponse { + return o && (o.$typeUrl === QueryGranterGrantsResponse.typeUrl || Array.isArray(o.grants) && (!o.grants.length || GrantAuthorization.is(o.grants[0]))); + }, + isSDK(o: any): o is QueryGranterGrantsResponseSDKType { + return o && (o.$typeUrl === QueryGranterGrantsResponse.typeUrl || Array.isArray(o.grants) && (!o.grants.length || GrantAuthorization.isSDK(o.grants[0]))); + }, + isAmino(o: any): o is QueryGranterGrantsResponseAmino { + return o && (o.$typeUrl === QueryGranterGrantsResponse.typeUrl || Array.isArray(o.grants) && (!o.grants.length || GrantAuthorization.isAmino(o.grants[0]))); + }, encode(message: QueryGranterGrantsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.grants) { GrantAuthorization.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -804,6 +860,13 @@ export const QueryGranterGrantsResponse = { typeUrl: "/cosmos.authz.v1beta1.QueryGranterGrantsResponse", value: QueryGranterGrantsResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryGranterGrantsResponse.typeUrl)) { + return; + } + GrantAuthorization.registerTypeUrl(); + PageResponse.registerTypeUrl(); } }; function createBaseQueryGranteeGrantsRequest(): QueryGranteeGrantsRequest { @@ -821,6 +884,15 @@ function createBaseQueryGranteeGrantsRequest(): QueryGranteeGrantsRequest { export const QueryGranteeGrantsRequest = { typeUrl: "/cosmos.authz.v1beta1.QueryGranteeGrantsRequest", aminoType: "cosmos-sdk/QueryGranteeGrantsRequest", + is(o: any): o is QueryGranteeGrantsRequest { + return o && (o.$typeUrl === QueryGranteeGrantsRequest.typeUrl || typeof o.grantee === "string"); + }, + isSDK(o: any): o is QueryGranteeGrantsRequestSDKType { + return o && (o.$typeUrl === QueryGranteeGrantsRequest.typeUrl || typeof o.grantee === "string"); + }, + isAmino(o: any): o is QueryGranteeGrantsRequestAmino { + return o && (o.$typeUrl === QueryGranteeGrantsRequest.typeUrl || typeof o.grantee === "string"); + }, encode(message: QueryGranteeGrantsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.grantee !== "") { writer.uint32(10).string(message.grantee); @@ -918,6 +990,12 @@ export const QueryGranteeGrantsRequest = { typeUrl: "/cosmos.authz.v1beta1.QueryGranteeGrantsRequest", value: QueryGranteeGrantsRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryGranteeGrantsRequest.typeUrl)) { + return; + } + PageRequest.registerTypeUrl(); } }; function createBaseQueryGranteeGrantsResponse(): QueryGranteeGrantsResponse { @@ -935,6 +1013,15 @@ function createBaseQueryGranteeGrantsResponse(): QueryGranteeGrantsResponse { export const QueryGranteeGrantsResponse = { typeUrl: "/cosmos.authz.v1beta1.QueryGranteeGrantsResponse", aminoType: "cosmos-sdk/QueryGranteeGrantsResponse", + is(o: any): o is QueryGranteeGrantsResponse { + return o && (o.$typeUrl === QueryGranteeGrantsResponse.typeUrl || Array.isArray(o.grants) && (!o.grants.length || GrantAuthorization.is(o.grants[0]))); + }, + isSDK(o: any): o is QueryGranteeGrantsResponseSDKType { + return o && (o.$typeUrl === QueryGranteeGrantsResponse.typeUrl || Array.isArray(o.grants) && (!o.grants.length || GrantAuthorization.isSDK(o.grants[0]))); + }, + isAmino(o: any): o is QueryGranteeGrantsResponseAmino { + return o && (o.$typeUrl === QueryGranteeGrantsResponse.typeUrl || Array.isArray(o.grants) && (!o.grants.length || GrantAuthorization.isAmino(o.grants[0]))); + }, encode(message: QueryGranteeGrantsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.grants) { GrantAuthorization.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -1042,5 +1129,12 @@ export const QueryGranteeGrantsResponse = { typeUrl: "/cosmos.authz.v1beta1.QueryGranteeGrantsResponse", value: QueryGranteeGrantsResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryGranteeGrantsResponse.typeUrl)) { + return; + } + GrantAuthorization.registerTypeUrl(); + PageResponse.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/cosmos/authz/v1beta1/tx.registry.ts b/__fixtures__/v-next/outputv2/cosmos/authz/v1beta1/tx.registry.ts index d4520627d9..5a95b9f22e 100644 --- a/__fixtures__/v-next/outputv2/cosmos/authz/v1beta1/tx.registry.ts +++ b/__fixtures__/v-next/outputv2/cosmos/authz/v1beta1/tx.registry.ts @@ -1,11 +1,6 @@ -import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { TelescopeGeneratedType } from "../../../types"; import { MsgGrant, MsgExec, MsgRevoke } from "./tx"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/cosmos.authz.v1beta1.MsgGrant", MsgGrant], ["/cosmos.authz.v1beta1.MsgExec", MsgExec], ["/cosmos.authz.v1beta1.MsgRevoke", MsgRevoke]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/cosmos.authz.v1beta1.MsgGrant", MsgGrant], ["/cosmos.authz.v1beta1.MsgExec", MsgExec], ["/cosmos.authz.v1beta1.MsgRevoke", MsgRevoke]]; export const MessageComposer = { encoded: { grant(value: MsgGrant) { diff --git a/__fixtures__/v-next/outputv2/cosmos/authz/v1beta1/tx.rpc.func.ts b/__fixtures__/v-next/outputv2/cosmos/authz/v1beta1/tx.rpc.func.ts new file mode 100644 index 0000000000..b697ca8b10 --- /dev/null +++ b/__fixtures__/v-next/outputv2/cosmos/authz/v1beta1/tx.rpc.func.ts @@ -0,0 +1,35 @@ +import { buildTx } from "../../../helper-func-types"; +import { MsgGrant, MsgExec, MsgRevoke } from "./tx"; +/** + * Grant grants the provided authorization to the grantee on the granter's + * account with the provided expiration time. If there is already a grant + * for the given (granter, grantee, Authorization) triple, then the grant + * will be overwritten. + * @name grant + * @package cosmos.authz.v1beta1 + * @see proto service: cosmos.authz.v1beta1.Grant + */ +export const grant = buildTx({ + msg: MsgGrant +}); +/** + * Exec attempts to execute the provided messages using + * authorizations granted to the grantee. Each message should have only + * one signer corresponding to the granter of the authorization. + * @name exec + * @package cosmos.authz.v1beta1 + * @see proto service: cosmos.authz.v1beta1.Exec + */ +export const exec = buildTx({ + msg: MsgExec +}); +/** + * Revoke revokes any authorization corresponding to the provided method name on the + * granter's account that has been granted to the grantee. + * @name revoke + * @package cosmos.authz.v1beta1 + * @see proto service: cosmos.authz.v1beta1.Revoke + */ +export const revoke = buildTx({ + msg: MsgRevoke +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/cosmos/authz/v1beta1/tx.ts b/__fixtures__/v-next/outputv2/cosmos/authz/v1beta1/tx.ts index 05ab233a7f..3b8f660eac 100644 --- a/__fixtures__/v-next/outputv2/cosmos/authz/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputv2/cosmos/authz/v1beta1/tx.ts @@ -1,6 +1,7 @@ import { Grant, GrantAmino, GrantSDKType } from "./authz"; import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../google/protobuf/any"; import { BinaryReader, BinaryWriter } from "../../../binary"; +import { GlobalDecoderRegistry } from "../../../registry"; import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "cosmos.authz.v1beta1"; @@ -264,6 +265,15 @@ function createBaseMsgGrant(): MsgGrant { export const MsgGrant = { typeUrl: "/cosmos.authz.v1beta1.MsgGrant", aminoType: "cosmos-sdk/MsgGrant", + is(o: any): o is MsgGrant { + return o && (o.$typeUrl === MsgGrant.typeUrl || typeof o.granter === "string" && typeof o.grantee === "string" && Grant.is(o.grant)); + }, + isSDK(o: any): o is MsgGrantSDKType { + return o && (o.$typeUrl === MsgGrant.typeUrl || typeof o.granter === "string" && typeof o.grantee === "string" && Grant.isSDK(o.grant)); + }, + isAmino(o: any): o is MsgGrantAmino { + return o && (o.$typeUrl === MsgGrant.typeUrl || typeof o.granter === "string" && typeof o.grantee === "string" && Grant.isAmino(o.grant)); + }, encode(message: MsgGrant, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.granter !== "") { writer.uint32(10).string(message.granter); @@ -376,6 +386,12 @@ export const MsgGrant = { typeUrl: "/cosmos.authz.v1beta1.MsgGrant", value: MsgGrant.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgGrant.typeUrl)) { + return; + } + Grant.registerTypeUrl(); } }; function createBaseMsgExecResponse(): MsgExecResponse { @@ -392,6 +408,15 @@ function createBaseMsgExecResponse(): MsgExecResponse { export const MsgExecResponse = { typeUrl: "/cosmos.authz.v1beta1.MsgExecResponse", aminoType: "cosmos-sdk/MsgExecResponse", + is(o: any): o is MsgExecResponse { + return o && (o.$typeUrl === MsgExecResponse.typeUrl || Array.isArray(o.results) && (!o.results.length || o.results[0] instanceof Uint8Array || typeof o.results[0] === "string")); + }, + isSDK(o: any): o is MsgExecResponseSDKType { + return o && (o.$typeUrl === MsgExecResponse.typeUrl || Array.isArray(o.results) && (!o.results.length || o.results[0] instanceof Uint8Array || typeof o.results[0] === "string")); + }, + isAmino(o: any): o is MsgExecResponseAmino { + return o && (o.$typeUrl === MsgExecResponse.typeUrl || Array.isArray(o.results) && (!o.results.length || o.results[0] instanceof Uint8Array || typeof o.results[0] === "string")); + }, encode(message: MsgExecResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.results) { writer.uint32(10).bytes(v!); @@ -482,7 +507,8 @@ export const MsgExecResponse = { typeUrl: "/cosmos.authz.v1beta1.MsgExecResponse", value: MsgExecResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgExec(): MsgExec { return { @@ -501,12 +527,21 @@ function createBaseMsgExec(): MsgExec { export const MsgExec = { typeUrl: "/cosmos.authz.v1beta1.MsgExec", aminoType: "cosmos-sdk/MsgExec", + is(o: any): o is MsgExec { + return o && (o.$typeUrl === MsgExec.typeUrl || typeof o.grantee === "string" && Array.isArray(o.msgs) && (!o.msgs.length || Any.is(o.msgs[0]))); + }, + isSDK(o: any): o is MsgExecSDKType { + return o && (o.$typeUrl === MsgExec.typeUrl || typeof o.grantee === "string" && Array.isArray(o.msgs) && (!o.msgs.length || Any.isSDK(o.msgs[0]))); + }, + isAmino(o: any): o is MsgExecAmino { + return o && (o.$typeUrl === MsgExec.typeUrl || typeof o.grantee === "string" && Array.isArray(o.msgs) && (!o.msgs.length || Any.isAmino(o.msgs[0]))); + }, encode(message: MsgExec, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.grantee !== "") { writer.uint32(10).string(message.grantee); } for (const v of message.msgs) { - Any.encode((v! as Any), writer.uint32(18).fork()).ldelim(); + Any.encode(GlobalDecoderRegistry.wrapAny(v!), writer.uint32(18).fork()).ldelim(); } return writer; }, @@ -521,7 +556,7 @@ export const MsgExec = { message.grantee = reader.string(); break; case 2: - message.msgs.push((Any.decode(reader, reader.uint32()) as Any)); + message.msgs.push(GlobalDecoderRegistry.unwrapAny(reader)); break; default: reader.skipType(tag & 7); @@ -533,14 +568,14 @@ export const MsgExec = { fromJSON(object: any): MsgExec { const obj = createBaseMsgExec(); if (isSet(object.grantee)) obj.grantee = String(object.grantee); - if (Array.isArray(object?.msgs)) obj.msgs = object.msgs.map((e: any) => Any.fromJSON(e)); + if (Array.isArray(object?.msgs)) obj.msgs = object.msgs.map((e: any) => GlobalDecoderRegistry.fromJSON(e)); return obj; }, toJSON(message: MsgExec): JsonSafe { const obj: any = {}; message.grantee !== undefined && (obj.grantee = message.grantee); if (message.msgs) { - obj.msgs = message.msgs.map(e => e ? Any.toJSON(e) : undefined); + obj.msgs = message.msgs.map(e => e ? GlobalDecoderRegistry.toJSON(e) : undefined); } else { obj.msgs = []; } @@ -549,20 +584,20 @@ export const MsgExec = { fromPartial(object: DeepPartial): MsgExec { const message = createBaseMsgExec(); message.grantee = object.grantee ?? ""; - message.msgs = object.msgs?.map(e => Any.fromPartial(e)) || []; + message.msgs = object.msgs?.map(e => (GlobalDecoderRegistry.fromPartial(e) as any)) || []; return message; }, fromSDK(object: MsgExecSDKType): MsgExec { return { grantee: object?.grantee, - msgs: Array.isArray(object?.msgs) ? object.msgs.map((e: any) => Any.fromSDK(e)) : [] + msgs: Array.isArray(object?.msgs) ? object.msgs.map((e: any) => GlobalDecoderRegistry.fromSDK(e)) : [] }; }, toSDK(message: MsgExec): MsgExecSDKType { const obj: any = {}; obj.grantee = message.grantee; if (message.msgs) { - obj.msgs = message.msgs.map(e => e ? Any.toSDK(e) : undefined); + obj.msgs = message.msgs.map(e => e ? GlobalDecoderRegistry.toSDK(e) : undefined); } else { obj.msgs = []; } @@ -573,14 +608,14 @@ export const MsgExec = { if (object.grantee !== undefined && object.grantee !== null) { message.grantee = object.grantee; } - message.msgs = object.msgs?.map(e => Sdk_Msg_FromAmino(e)) || []; + message.msgs = object.msgs?.map(e => GlobalDecoderRegistry.fromAminoMsg(e)) || []; return message; }, toAmino(message: MsgExec): MsgExecAmino { const obj: any = {}; obj.grantee = message.grantee === "" ? undefined : message.grantee; if (message.msgs) { - obj.msgs = message.msgs.map(e => e ? Sdk_Msg_ToAmino((e as Any)) : undefined); + obj.msgs = message.msgs.map(e => e ? GlobalDecoderRegistry.toAminoMsg(e) : undefined); } else { obj.msgs = message.msgs; } @@ -606,7 +641,8 @@ export const MsgExec = { typeUrl: "/cosmos.authz.v1beta1.MsgExec", value: MsgExec.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgGrantResponse(): MsgGrantResponse { return {}; @@ -620,6 +656,15 @@ function createBaseMsgGrantResponse(): MsgGrantResponse { export const MsgGrantResponse = { typeUrl: "/cosmos.authz.v1beta1.MsgGrantResponse", aminoType: "cosmos-sdk/MsgGrantResponse", + is(o: any): o is MsgGrantResponse { + return o && o.$typeUrl === MsgGrantResponse.typeUrl; + }, + isSDK(o: any): o is MsgGrantResponseSDKType { + return o && o.$typeUrl === MsgGrantResponse.typeUrl; + }, + isAmino(o: any): o is MsgGrantResponseAmino { + return o && o.$typeUrl === MsgGrantResponse.typeUrl; + }, encode(_: MsgGrantResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -684,7 +729,8 @@ export const MsgGrantResponse = { typeUrl: "/cosmos.authz.v1beta1.MsgGrantResponse", value: MsgGrantResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgRevoke(): MsgRevoke { return { @@ -703,6 +749,15 @@ function createBaseMsgRevoke(): MsgRevoke { export const MsgRevoke = { typeUrl: "/cosmos.authz.v1beta1.MsgRevoke", aminoType: "cosmos-sdk/MsgRevoke", + is(o: any): o is MsgRevoke { + return o && (o.$typeUrl === MsgRevoke.typeUrl || typeof o.granter === "string" && typeof o.grantee === "string" && typeof o.msgTypeUrl === "string"); + }, + isSDK(o: any): o is MsgRevokeSDKType { + return o && (o.$typeUrl === MsgRevoke.typeUrl || typeof o.granter === "string" && typeof o.grantee === "string" && typeof o.msg_type_url === "string"); + }, + isAmino(o: any): o is MsgRevokeAmino { + return o && (o.$typeUrl === MsgRevoke.typeUrl || typeof o.granter === "string" && typeof o.grantee === "string" && typeof o.msg_type_url === "string"); + }, encode(message: MsgRevoke, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.granter !== "") { writer.uint32(10).string(message.granter); @@ -813,7 +868,8 @@ export const MsgRevoke = { typeUrl: "/cosmos.authz.v1beta1.MsgRevoke", value: MsgRevoke.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgRevokeResponse(): MsgRevokeResponse { return {}; @@ -827,6 +883,15 @@ function createBaseMsgRevokeResponse(): MsgRevokeResponse { export const MsgRevokeResponse = { typeUrl: "/cosmos.authz.v1beta1.MsgRevokeResponse", aminoType: "cosmos-sdk/MsgRevokeResponse", + is(o: any): o is MsgRevokeResponse { + return o && o.$typeUrl === MsgRevokeResponse.typeUrl; + }, + isSDK(o: any): o is MsgRevokeResponseSDKType { + return o && o.$typeUrl === MsgRevokeResponse.typeUrl; + }, + isAmino(o: any): o is MsgRevokeResponseAmino { + return o && o.$typeUrl === MsgRevokeResponse.typeUrl; + }, encode(_: MsgRevokeResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -891,33 +956,6 @@ export const MsgRevokeResponse = { typeUrl: "/cosmos.authz.v1beta1.MsgRevokeResponse", value: MsgRevokeResponse.encode(message).finish() }; - } -}; -export const Sdk_Msg_InterfaceDecoder = (input: BinaryReader | Uint8Array): Any => { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - const data = Any.decode(reader, reader.uint32()); - switch (data.typeUrl) { - default: - return data; - } -}; -export const Sdk_Msg_FromAmino = (content: AnyAmino): Any => { - return Any.fromAmino(content); -}; -export const Sdk_Msg_ToAmino = (content: Any) => { - return Any.toAmino(content); -}; -export const Authz_Authorization_InterfaceDecoder = (input: BinaryReader | Uint8Array): Any => { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - const data = Any.decode(reader, reader.uint32()); - switch (data.typeUrl) { - default: - return data; - } -}; -export const Authz_Authorization_FromAmino = (content: AnyAmino): Any => { - return Any.fromAmino(content); -}; -export const Authz_Authorization_ToAmino = (content: Any) => { - return Any.toAmino(content); + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/cosmos/bank/v1beta1/authz.ts b/__fixtures__/v-next/outputv2/cosmos/bank/v1beta1/authz.ts index 32fbfa41cb..950ce9b11f 100644 --- a/__fixtures__/v-next/outputv2/cosmos/bank/v1beta1/authz.ts +++ b/__fixtures__/v-next/outputv2/cosmos/bank/v1beta1/authz.ts @@ -2,6 +2,7 @@ import { Coin, CoinAmino, CoinSDKType } from "../../base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { JsonSafe } from "../../../json-safe"; import { DeepPartial } from "../../../helpers"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "cosmos.bank.v1beta1"; /** * SendAuthorization allows the grantee to spend up to spend_limit coins from @@ -67,6 +68,15 @@ function createBaseSendAuthorization(): SendAuthorization { export const SendAuthorization = { typeUrl: "/cosmos.bank.v1beta1.SendAuthorization", aminoType: "cosmos-sdk/SendAuthorization", + is(o: any): o is SendAuthorization { + return o && (o.$typeUrl === SendAuthorization.typeUrl || Array.isArray(o.spendLimit) && (!o.spendLimit.length || Coin.is(o.spendLimit[0]))); + }, + isSDK(o: any): o is SendAuthorizationSDKType { + return o && (o.$typeUrl === SendAuthorization.typeUrl || Array.isArray(o.spend_limit) && (!o.spend_limit.length || Coin.isSDK(o.spend_limit[0]))); + }, + isAmino(o: any): o is SendAuthorizationAmino { + return o && (o.$typeUrl === SendAuthorization.typeUrl || Array.isArray(o.spend_limit) && (!o.spend_limit.length || Coin.isAmino(o.spend_limit[0]))); + }, encode(message: SendAuthorization, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.spendLimit) { Coin.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -157,5 +167,13 @@ export const SendAuthorization = { typeUrl: "/cosmos.bank.v1beta1.SendAuthorization", value: SendAuthorization.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(SendAuthorization.typeUrl)) { + return; + } + GlobalDecoderRegistry.register(SendAuthorization.typeUrl, SendAuthorization); + GlobalDecoderRegistry.registerAminoProtoMapping(SendAuthorization.aminoType, SendAuthorization.typeUrl); + Coin.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/cosmos/bank/v1beta1/bank.ts b/__fixtures__/v-next/outputv2/cosmos/bank/v1beta1/bank.ts index 189ec3c14e..cbebd1ae13 100644 --- a/__fixtures__/v-next/outputv2/cosmos/bank/v1beta1/bank.ts +++ b/__fixtures__/v-next/outputv2/cosmos/bank/v1beta1/bank.ts @@ -2,6 +2,7 @@ import { Coin, CoinAmino, CoinSDKType } from "../../base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { isSet, DeepPartial } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "cosmos.bank.v1beta1"; /** * Params defines the parameters for the bank module. @@ -412,6 +413,15 @@ function createBaseParams(): Params { export const Params = { typeUrl: "/cosmos.bank.v1beta1.Params", aminoType: "cosmos-sdk/Params", + is(o: any): o is Params { + return o && (o.$typeUrl === Params.typeUrl || Array.isArray(o.sendEnabled) && (!o.sendEnabled.length || SendEnabled.is(o.sendEnabled[0])) && typeof o.defaultSendEnabled === "boolean"); + }, + isSDK(o: any): o is ParamsSDKType { + return o && (o.$typeUrl === Params.typeUrl || Array.isArray(o.send_enabled) && (!o.send_enabled.length || SendEnabled.isSDK(o.send_enabled[0])) && typeof o.default_send_enabled === "boolean"); + }, + isAmino(o: any): o is ParamsAmino { + return o && (o.$typeUrl === Params.typeUrl || Array.isArray(o.send_enabled) && (!o.send_enabled.length || SendEnabled.isAmino(o.send_enabled[0])) && typeof o.default_send_enabled === "boolean"); + }, encode(message: Params, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.sendEnabled) { SendEnabled.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -517,6 +527,12 @@ export const Params = { typeUrl: "/cosmos.bank.v1beta1.Params", value: Params.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Params.typeUrl)) { + return; + } + SendEnabled.registerTypeUrl(); } }; function createBaseSendEnabled(): SendEnabled { @@ -535,6 +551,15 @@ function createBaseSendEnabled(): SendEnabled { export const SendEnabled = { typeUrl: "/cosmos.bank.v1beta1.SendEnabled", aminoType: "cosmos-sdk/SendEnabled", + is(o: any): o is SendEnabled { + return o && (o.$typeUrl === SendEnabled.typeUrl || typeof o.denom === "string" && typeof o.enabled === "boolean"); + }, + isSDK(o: any): o is SendEnabledSDKType { + return o && (o.$typeUrl === SendEnabled.typeUrl || typeof o.denom === "string" && typeof o.enabled === "boolean"); + }, + isAmino(o: any): o is SendEnabledAmino { + return o && (o.$typeUrl === SendEnabled.typeUrl || typeof o.denom === "string" && typeof o.enabled === "boolean"); + }, encode(message: SendEnabled, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.denom !== "") { writer.uint32(10).string(message.denom); @@ -630,7 +655,8 @@ export const SendEnabled = { typeUrl: "/cosmos.bank.v1beta1.SendEnabled", value: SendEnabled.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseInput(): Input { return { @@ -647,6 +673,15 @@ function createBaseInput(): Input { export const Input = { typeUrl: "/cosmos.bank.v1beta1.Input", aminoType: "cosmos-sdk/Input", + is(o: any): o is Input { + return o && (o.$typeUrl === Input.typeUrl || typeof o.address === "string" && Array.isArray(o.coins) && (!o.coins.length || Coin.is(o.coins[0]))); + }, + isSDK(o: any): o is InputSDKType { + return o && (o.$typeUrl === Input.typeUrl || typeof o.address === "string" && Array.isArray(o.coins) && (!o.coins.length || Coin.isSDK(o.coins[0]))); + }, + isAmino(o: any): o is InputAmino { + return o && (o.$typeUrl === Input.typeUrl || typeof o.address === "string" && Array.isArray(o.coins) && (!o.coins.length || Coin.isAmino(o.coins[0]))); + }, encode(message: Input, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.address !== "") { writer.uint32(10).string(message.address); @@ -752,6 +787,12 @@ export const Input = { typeUrl: "/cosmos.bank.v1beta1.Input", value: Input.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Input.typeUrl)) { + return; + } + Coin.registerTypeUrl(); } }; function createBaseOutput(): Output { @@ -769,6 +810,15 @@ function createBaseOutput(): Output { export const Output = { typeUrl: "/cosmos.bank.v1beta1.Output", aminoType: "cosmos-sdk/Output", + is(o: any): o is Output { + return o && (o.$typeUrl === Output.typeUrl || typeof o.address === "string" && Array.isArray(o.coins) && (!o.coins.length || Coin.is(o.coins[0]))); + }, + isSDK(o: any): o is OutputSDKType { + return o && (o.$typeUrl === Output.typeUrl || typeof o.address === "string" && Array.isArray(o.coins) && (!o.coins.length || Coin.isSDK(o.coins[0]))); + }, + isAmino(o: any): o is OutputAmino { + return o && (o.$typeUrl === Output.typeUrl || typeof o.address === "string" && Array.isArray(o.coins) && (!o.coins.length || Coin.isAmino(o.coins[0]))); + }, encode(message: Output, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.address !== "") { writer.uint32(10).string(message.address); @@ -874,6 +924,12 @@ export const Output = { typeUrl: "/cosmos.bank.v1beta1.Output", value: Output.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Output.typeUrl)) { + return; + } + Coin.registerTypeUrl(); } }; function createBaseSupply(): Supply { @@ -894,6 +950,15 @@ function createBaseSupply(): Supply { export const Supply = { typeUrl: "/cosmos.bank.v1beta1.Supply", aminoType: "cosmos-sdk/Supply", + is(o: any): o is Supply { + return o && (o.$typeUrl === Supply.typeUrl || Array.isArray(o.total) && (!o.total.length || Coin.is(o.total[0]))); + }, + isSDK(o: any): o is SupplySDKType { + return o && (o.$typeUrl === Supply.typeUrl || Array.isArray(o.total) && (!o.total.length || Coin.isSDK(o.total[0]))); + }, + isAmino(o: any): o is SupplyAmino { + return o && (o.$typeUrl === Supply.typeUrl || Array.isArray(o.total) && (!o.total.length || Coin.isAmino(o.total[0]))); + }, encode(message: Supply, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.total) { Coin.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -984,6 +1049,14 @@ export const Supply = { typeUrl: "/cosmos.bank.v1beta1.Supply", value: Supply.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Supply.typeUrl)) { + return; + } + GlobalDecoderRegistry.register(Supply.typeUrl, Supply); + GlobalDecoderRegistry.registerAminoProtoMapping(Supply.aminoType, Supply.typeUrl); + Coin.registerTypeUrl(); } }; function createBaseDenomUnit(): DenomUnit { @@ -1003,6 +1076,15 @@ function createBaseDenomUnit(): DenomUnit { export const DenomUnit = { typeUrl: "/cosmos.bank.v1beta1.DenomUnit", aminoType: "cosmos-sdk/DenomUnit", + is(o: any): o is DenomUnit { + return o && (o.$typeUrl === DenomUnit.typeUrl || typeof o.denom === "string" && typeof o.exponent === "number" && Array.isArray(o.aliases) && (!o.aliases.length || typeof o.aliases[0] === "string")); + }, + isSDK(o: any): o is DenomUnitSDKType { + return o && (o.$typeUrl === DenomUnit.typeUrl || typeof o.denom === "string" && typeof o.exponent === "number" && Array.isArray(o.aliases) && (!o.aliases.length || typeof o.aliases[0] === "string")); + }, + isAmino(o: any): o is DenomUnitAmino { + return o && (o.$typeUrl === DenomUnit.typeUrl || typeof o.denom === "string" && typeof o.exponent === "number" && Array.isArray(o.aliases) && (!o.aliases.length || typeof o.aliases[0] === "string")); + }, encode(message: DenomUnit, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.denom !== "") { writer.uint32(10).string(message.denom); @@ -1123,7 +1205,8 @@ export const DenomUnit = { typeUrl: "/cosmos.bank.v1beta1.DenomUnit", value: DenomUnit.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMetadata(): Metadata { return { @@ -1147,6 +1230,15 @@ function createBaseMetadata(): Metadata { export const Metadata = { typeUrl: "/cosmos.bank.v1beta1.Metadata", aminoType: "cosmos-sdk/Metadata", + is(o: any): o is Metadata { + return o && (o.$typeUrl === Metadata.typeUrl || typeof o.description === "string" && Array.isArray(o.denomUnits) && (!o.denomUnits.length || DenomUnit.is(o.denomUnits[0])) && typeof o.base === "string" && typeof o.display === "string" && typeof o.name === "string" && typeof o.symbol === "string" && typeof o.uri === "string" && typeof o.uriHash === "string"); + }, + isSDK(o: any): o is MetadataSDKType { + return o && (o.$typeUrl === Metadata.typeUrl || typeof o.description === "string" && Array.isArray(o.denom_units) && (!o.denom_units.length || DenomUnit.isSDK(o.denom_units[0])) && typeof o.base === "string" && typeof o.display === "string" && typeof o.name === "string" && typeof o.symbol === "string" && typeof o.uri === "string" && typeof o.uri_hash === "string"); + }, + isAmino(o: any): o is MetadataAmino { + return o && (o.$typeUrl === Metadata.typeUrl || typeof o.description === "string" && Array.isArray(o.denom_units) && (!o.denom_units.length || DenomUnit.isAmino(o.denom_units[0])) && typeof o.base === "string" && typeof o.display === "string" && typeof o.name === "string" && typeof o.symbol === "string" && typeof o.uri === "string" && typeof o.uri_hash === "string"); + }, encode(message: Metadata, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.description !== "") { writer.uint32(10).string(message.description); @@ -1342,5 +1434,11 @@ export const Metadata = { typeUrl: "/cosmos.bank.v1beta1.Metadata", value: Metadata.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Metadata.typeUrl)) { + return; + } + DenomUnit.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/cosmos/bank/v1beta1/genesis.ts b/__fixtures__/v-next/outputv2/cosmos/bank/v1beta1/genesis.ts index aeb19cdf93..a8df3c8477 100644 --- a/__fixtures__/v-next/outputv2/cosmos/bank/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv2/cosmos/bank/v1beta1/genesis.ts @@ -1,6 +1,7 @@ import { Params, ParamsAmino, ParamsSDKType, Metadata, MetadataAmino, MetadataSDKType } from "./bank"; import { Coin, CoinAmino, CoinSDKType } from "../../base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; +import { GlobalDecoderRegistry } from "../../../registry"; import { isSet, DeepPartial } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "cosmos.bank.v1beta1"; @@ -144,6 +145,15 @@ function createBaseGenesisState(): GenesisState { export const GenesisState = { typeUrl: "/cosmos.bank.v1beta1.GenesisState", aminoType: "cosmos-sdk/GenesisState", + is(o: any): o is GenesisState { + return o && (o.$typeUrl === GenesisState.typeUrl || Params.is(o.params) && Array.isArray(o.balances) && (!o.balances.length || Balance.is(o.balances[0])) && Array.isArray(o.supply) && (!o.supply.length || Coin.is(o.supply[0])) && Array.isArray(o.denomMetadata) && (!o.denomMetadata.length || Metadata.is(o.denomMetadata[0]))); + }, + isSDK(o: any): o is GenesisStateSDKType { + return o && (o.$typeUrl === GenesisState.typeUrl || Params.isSDK(o.params) && Array.isArray(o.balances) && (!o.balances.length || Balance.isSDK(o.balances[0])) && Array.isArray(o.supply) && (!o.supply.length || Coin.isSDK(o.supply[0])) && Array.isArray(o.denom_metadata) && (!o.denom_metadata.length || Metadata.isSDK(o.denom_metadata[0]))); + }, + isAmino(o: any): o is GenesisStateAmino { + return o && (o.$typeUrl === GenesisState.typeUrl || Params.isAmino(o.params) && Array.isArray(o.balances) && (!o.balances.length || Balance.isAmino(o.balances[0])) && Array.isArray(o.supply) && (!o.supply.length || Coin.isAmino(o.supply[0])) && Array.isArray(o.denom_metadata) && (!o.denom_metadata.length || Metadata.isAmino(o.denom_metadata[0]))); + }, encode(message: GenesisState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.params !== undefined) { Params.encode(message.params, writer.uint32(10).fork()).ldelim(); @@ -301,6 +311,15 @@ export const GenesisState = { typeUrl: "/cosmos.bank.v1beta1.GenesisState", value: GenesisState.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GenesisState.typeUrl)) { + return; + } + Params.registerTypeUrl(); + Balance.registerTypeUrl(); + Coin.registerTypeUrl(); + Metadata.registerTypeUrl(); } }; function createBaseBalance(): Balance { @@ -319,6 +338,15 @@ function createBaseBalance(): Balance { export const Balance = { typeUrl: "/cosmos.bank.v1beta1.Balance", aminoType: "cosmos-sdk/Balance", + is(o: any): o is Balance { + return o && (o.$typeUrl === Balance.typeUrl || typeof o.address === "string" && Array.isArray(o.coins) && (!o.coins.length || Coin.is(o.coins[0]))); + }, + isSDK(o: any): o is BalanceSDKType { + return o && (o.$typeUrl === Balance.typeUrl || typeof o.address === "string" && Array.isArray(o.coins) && (!o.coins.length || Coin.isSDK(o.coins[0]))); + }, + isAmino(o: any): o is BalanceAmino { + return o && (o.$typeUrl === Balance.typeUrl || typeof o.address === "string" && Array.isArray(o.coins) && (!o.coins.length || Coin.isAmino(o.coins[0]))); + }, encode(message: Balance, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.address !== "") { writer.uint32(10).string(message.address); @@ -424,5 +452,11 @@ export const Balance = { typeUrl: "/cosmos.bank.v1beta1.Balance", value: Balance.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Balance.typeUrl)) { + return; + } + Coin.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/cosmos/bank/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputv2/cosmos/bank/v1beta1/query.rpc.func.ts new file mode 100644 index 0000000000..127992e52b --- /dev/null +++ b/__fixtures__/v-next/outputv2/cosmos/bank/v1beta1/query.rpc.func.ts @@ -0,0 +1,122 @@ +import { buildQuery } from "../../../helper-func-types"; +import { QueryBalanceRequest, QueryBalanceResponse, QueryAllBalancesRequest, QueryAllBalancesResponse, QuerySpendableBalancesRequest, QuerySpendableBalancesResponse, QueryTotalSupplyRequest, QueryTotalSupplyResponse, QuerySupplyOfRequest, QuerySupplyOfResponse, QueryParamsRequest, QueryParamsResponse, QueryDenomMetadataRequest, QueryDenomMetadataResponse, QueryDenomsMetadataRequest, QueryDenomsMetadataResponse, QueryDenomOwnersRequest, QueryDenomOwnersResponse } from "./query"; +/** + * Balance queries the balance of a single coin for a single account. + * @name getBalance + * @package cosmos.bank.v1beta1 + * @see proto service: cosmos.bank.v1beta1.Balance + */ +export const getBalance = buildQuery({ + encode: QueryBalanceRequest.encode, + decode: QueryBalanceResponse.decode, + service: "cosmos.bank.v1beta1.Query", + method: "Balance", + deps: [QueryBalanceRequest, QueryBalanceResponse] +}); +/** + * AllBalances queries the balance of all coins for a single account. + * @name getAllBalances + * @package cosmos.bank.v1beta1 + * @see proto service: cosmos.bank.v1beta1.AllBalances + */ +export const getAllBalances = buildQuery({ + encode: QueryAllBalancesRequest.encode, + decode: QueryAllBalancesResponse.decode, + service: "cosmos.bank.v1beta1.Query", + method: "AllBalances", + deps: [QueryAllBalancesRequest, QueryAllBalancesResponse] +}); +/** + * SpendableBalances queries the spenable balance of all coins for a single + * account. + * @name getSpendableBalances + * @package cosmos.bank.v1beta1 + * @see proto service: cosmos.bank.v1beta1.SpendableBalances + */ +export const getSpendableBalances = buildQuery({ + encode: QuerySpendableBalancesRequest.encode, + decode: QuerySpendableBalancesResponse.decode, + service: "cosmos.bank.v1beta1.Query", + method: "SpendableBalances", + deps: [QuerySpendableBalancesRequest, QuerySpendableBalancesResponse] +}); +/** + * TotalSupply queries the total supply of all coins. + * @name getTotalSupply + * @package cosmos.bank.v1beta1 + * @see proto service: cosmos.bank.v1beta1.TotalSupply + */ +export const getTotalSupply = buildQuery({ + encode: QueryTotalSupplyRequest.encode, + decode: QueryTotalSupplyResponse.decode, + service: "cosmos.bank.v1beta1.Query", + method: "TotalSupply", + deps: [QueryTotalSupplyRequest, QueryTotalSupplyResponse] +}); +/** + * SupplyOf queries the supply of a single coin. + * @name getSupplyOf + * @package cosmos.bank.v1beta1 + * @see proto service: cosmos.bank.v1beta1.SupplyOf + */ +export const getSupplyOf = buildQuery({ + encode: QuerySupplyOfRequest.encode, + decode: QuerySupplyOfResponse.decode, + service: "cosmos.bank.v1beta1.Query", + method: "SupplyOf", + deps: [QuerySupplyOfRequest, QuerySupplyOfResponse] +}); +/** + * Params queries the parameters of x/bank module. + * @name getParams + * @package cosmos.bank.v1beta1 + * @see proto service: cosmos.bank.v1beta1.Params + */ +export const getParams = buildQuery({ + encode: QueryParamsRequest.encode, + decode: QueryParamsResponse.decode, + service: "cosmos.bank.v1beta1.Query", + method: "Params", + deps: [QueryParamsRequest, QueryParamsResponse] +}); +/** + * DenomsMetadata queries the client metadata of a given coin denomination. + * @name getDenomMetadata + * @package cosmos.bank.v1beta1 + * @see proto service: cosmos.bank.v1beta1.DenomMetadata + */ +export const getDenomMetadata = buildQuery({ + encode: QueryDenomMetadataRequest.encode, + decode: QueryDenomMetadataResponse.decode, + service: "cosmos.bank.v1beta1.Query", + method: "DenomMetadata", + deps: [QueryDenomMetadataRequest, QueryDenomMetadataResponse] +}); +/** + * DenomsMetadata queries the client metadata for all registered coin + * denominations. + * @name getDenomsMetadata + * @package cosmos.bank.v1beta1 + * @see proto service: cosmos.bank.v1beta1.DenomsMetadata + */ +export const getDenomsMetadata = buildQuery({ + encode: QueryDenomsMetadataRequest.encode, + decode: QueryDenomsMetadataResponse.decode, + service: "cosmos.bank.v1beta1.Query", + method: "DenomsMetadata", + deps: [QueryDenomsMetadataRequest, QueryDenomsMetadataResponse] +}); +/** + * DenomOwners queries for all account addresses that own a particular token + * denomination. + * @name getDenomOwners + * @package cosmos.bank.v1beta1 + * @see proto service: cosmos.bank.v1beta1.DenomOwners + */ +export const getDenomOwners = buildQuery({ + encode: QueryDenomOwnersRequest.encode, + decode: QueryDenomOwnersResponse.decode, + service: "cosmos.bank.v1beta1.Query", + method: "DenomOwners", + deps: [QueryDenomOwnersRequest, QueryDenomOwnersResponse] +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/cosmos/bank/v1beta1/query.ts b/__fixtures__/v-next/outputv2/cosmos/bank/v1beta1/query.ts index b2611d2cd6..e36258037f 100644 --- a/__fixtures__/v-next/outputv2/cosmos/bank/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv2/cosmos/bank/v1beta1/query.ts @@ -4,6 +4,7 @@ import { Params, ParamsAmino, ParamsSDKType, Metadata, MetadataAmino, MetadataSD import { BinaryReader, BinaryWriter } from "../../../binary"; import { isSet, DeepPartial } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "cosmos.bank.v1beta1"; /** * QueryBalanceRequest is the request type for the Query/Balance RPC method. @@ -906,6 +907,15 @@ function createBaseQueryBalanceRequest(): QueryBalanceRequest { export const QueryBalanceRequest = { typeUrl: "/cosmos.bank.v1beta1.QueryBalanceRequest", aminoType: "cosmos-sdk/QueryBalanceRequest", + is(o: any): o is QueryBalanceRequest { + return o && (o.$typeUrl === QueryBalanceRequest.typeUrl || typeof o.address === "string" && typeof o.denom === "string"); + }, + isSDK(o: any): o is QueryBalanceRequestSDKType { + return o && (o.$typeUrl === QueryBalanceRequest.typeUrl || typeof o.address === "string" && typeof o.denom === "string"); + }, + isAmino(o: any): o is QueryBalanceRequestAmino { + return o && (o.$typeUrl === QueryBalanceRequest.typeUrl || typeof o.address === "string" && typeof o.denom === "string"); + }, encode(message: QueryBalanceRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.address !== "") { writer.uint32(10).string(message.address); @@ -1001,7 +1011,8 @@ export const QueryBalanceRequest = { typeUrl: "/cosmos.bank.v1beta1.QueryBalanceRequest", value: QueryBalanceRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryBalanceResponse(): QueryBalanceResponse { return { @@ -1017,6 +1028,15 @@ function createBaseQueryBalanceResponse(): QueryBalanceResponse { export const QueryBalanceResponse = { typeUrl: "/cosmos.bank.v1beta1.QueryBalanceResponse", aminoType: "cosmos-sdk/QueryBalanceResponse", + is(o: any): o is QueryBalanceResponse { + return o && o.$typeUrl === QueryBalanceResponse.typeUrl; + }, + isSDK(o: any): o is QueryBalanceResponseSDKType { + return o && o.$typeUrl === QueryBalanceResponse.typeUrl; + }, + isAmino(o: any): o is QueryBalanceResponseAmino { + return o && o.$typeUrl === QueryBalanceResponse.typeUrl; + }, encode(message: QueryBalanceResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.balance !== undefined) { Coin.encode(message.balance, writer.uint32(10).fork()).ldelim(); @@ -1099,6 +1119,12 @@ export const QueryBalanceResponse = { typeUrl: "/cosmos.bank.v1beta1.QueryBalanceResponse", value: QueryBalanceResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryBalanceResponse.typeUrl)) { + return; + } + Coin.registerTypeUrl(); } }; function createBaseQueryAllBalancesRequest(): QueryAllBalancesRequest { @@ -1116,6 +1142,15 @@ function createBaseQueryAllBalancesRequest(): QueryAllBalancesRequest { export const QueryAllBalancesRequest = { typeUrl: "/cosmos.bank.v1beta1.QueryAllBalancesRequest", aminoType: "cosmos-sdk/QueryAllBalancesRequest", + is(o: any): o is QueryAllBalancesRequest { + return o && (o.$typeUrl === QueryAllBalancesRequest.typeUrl || typeof o.address === "string"); + }, + isSDK(o: any): o is QueryAllBalancesRequestSDKType { + return o && (o.$typeUrl === QueryAllBalancesRequest.typeUrl || typeof o.address === "string"); + }, + isAmino(o: any): o is QueryAllBalancesRequestAmino { + return o && (o.$typeUrl === QueryAllBalancesRequest.typeUrl || typeof o.address === "string"); + }, encode(message: QueryAllBalancesRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.address !== "") { writer.uint32(10).string(message.address); @@ -1213,6 +1248,12 @@ export const QueryAllBalancesRequest = { typeUrl: "/cosmos.bank.v1beta1.QueryAllBalancesRequest", value: QueryAllBalancesRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryAllBalancesRequest.typeUrl)) { + return; + } + PageRequest.registerTypeUrl(); } }; function createBaseQueryAllBalancesResponse(): QueryAllBalancesResponse { @@ -1231,6 +1272,15 @@ function createBaseQueryAllBalancesResponse(): QueryAllBalancesResponse { export const QueryAllBalancesResponse = { typeUrl: "/cosmos.bank.v1beta1.QueryAllBalancesResponse", aminoType: "cosmos-sdk/QueryAllBalancesResponse", + is(o: any): o is QueryAllBalancesResponse { + return o && (o.$typeUrl === QueryAllBalancesResponse.typeUrl || Array.isArray(o.balances) && (!o.balances.length || Coin.is(o.balances[0]))); + }, + isSDK(o: any): o is QueryAllBalancesResponseSDKType { + return o && (o.$typeUrl === QueryAllBalancesResponse.typeUrl || Array.isArray(o.balances) && (!o.balances.length || Coin.isSDK(o.balances[0]))); + }, + isAmino(o: any): o is QueryAllBalancesResponseAmino { + return o && (o.$typeUrl === QueryAllBalancesResponse.typeUrl || Array.isArray(o.balances) && (!o.balances.length || Coin.isAmino(o.balances[0]))); + }, encode(message: QueryAllBalancesResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.balances) { Coin.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -1338,6 +1388,13 @@ export const QueryAllBalancesResponse = { typeUrl: "/cosmos.bank.v1beta1.QueryAllBalancesResponse", value: QueryAllBalancesResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryAllBalancesResponse.typeUrl)) { + return; + } + Coin.registerTypeUrl(); + PageResponse.registerTypeUrl(); } }; function createBaseQuerySpendableBalancesRequest(): QuerySpendableBalancesRequest { @@ -1356,6 +1413,15 @@ function createBaseQuerySpendableBalancesRequest(): QuerySpendableBalancesReques export const QuerySpendableBalancesRequest = { typeUrl: "/cosmos.bank.v1beta1.QuerySpendableBalancesRequest", aminoType: "cosmos-sdk/QuerySpendableBalancesRequest", + is(o: any): o is QuerySpendableBalancesRequest { + return o && (o.$typeUrl === QuerySpendableBalancesRequest.typeUrl || typeof o.address === "string"); + }, + isSDK(o: any): o is QuerySpendableBalancesRequestSDKType { + return o && (o.$typeUrl === QuerySpendableBalancesRequest.typeUrl || typeof o.address === "string"); + }, + isAmino(o: any): o is QuerySpendableBalancesRequestAmino { + return o && (o.$typeUrl === QuerySpendableBalancesRequest.typeUrl || typeof o.address === "string"); + }, encode(message: QuerySpendableBalancesRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.address !== "") { writer.uint32(10).string(message.address); @@ -1453,6 +1519,12 @@ export const QuerySpendableBalancesRequest = { typeUrl: "/cosmos.bank.v1beta1.QuerySpendableBalancesRequest", value: QuerySpendableBalancesRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QuerySpendableBalancesRequest.typeUrl)) { + return; + } + PageRequest.registerTypeUrl(); } }; function createBaseQuerySpendableBalancesResponse(): QuerySpendableBalancesResponse { @@ -1471,6 +1543,15 @@ function createBaseQuerySpendableBalancesResponse(): QuerySpendableBalancesRespo export const QuerySpendableBalancesResponse = { typeUrl: "/cosmos.bank.v1beta1.QuerySpendableBalancesResponse", aminoType: "cosmos-sdk/QuerySpendableBalancesResponse", + is(o: any): o is QuerySpendableBalancesResponse { + return o && (o.$typeUrl === QuerySpendableBalancesResponse.typeUrl || Array.isArray(o.balances) && (!o.balances.length || Coin.is(o.balances[0]))); + }, + isSDK(o: any): o is QuerySpendableBalancesResponseSDKType { + return o && (o.$typeUrl === QuerySpendableBalancesResponse.typeUrl || Array.isArray(o.balances) && (!o.balances.length || Coin.isSDK(o.balances[0]))); + }, + isAmino(o: any): o is QuerySpendableBalancesResponseAmino { + return o && (o.$typeUrl === QuerySpendableBalancesResponse.typeUrl || Array.isArray(o.balances) && (!o.balances.length || Coin.isAmino(o.balances[0]))); + }, encode(message: QuerySpendableBalancesResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.balances) { Coin.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -1578,6 +1659,13 @@ export const QuerySpendableBalancesResponse = { typeUrl: "/cosmos.bank.v1beta1.QuerySpendableBalancesResponse", value: QuerySpendableBalancesResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QuerySpendableBalancesResponse.typeUrl)) { + return; + } + Coin.registerTypeUrl(); + PageResponse.registerTypeUrl(); } }; function createBaseQueryTotalSupplyRequest(): QueryTotalSupplyRequest { @@ -1595,6 +1683,15 @@ function createBaseQueryTotalSupplyRequest(): QueryTotalSupplyRequest { export const QueryTotalSupplyRequest = { typeUrl: "/cosmos.bank.v1beta1.QueryTotalSupplyRequest", aminoType: "cosmos-sdk/QueryTotalSupplyRequest", + is(o: any): o is QueryTotalSupplyRequest { + return o && o.$typeUrl === QueryTotalSupplyRequest.typeUrl; + }, + isSDK(o: any): o is QueryTotalSupplyRequestSDKType { + return o && o.$typeUrl === QueryTotalSupplyRequest.typeUrl; + }, + isAmino(o: any): o is QueryTotalSupplyRequestAmino { + return o && o.$typeUrl === QueryTotalSupplyRequest.typeUrl; + }, encode(message: QueryTotalSupplyRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.pagination !== undefined) { PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); @@ -1677,6 +1774,12 @@ export const QueryTotalSupplyRequest = { typeUrl: "/cosmos.bank.v1beta1.QueryTotalSupplyRequest", value: QueryTotalSupplyRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryTotalSupplyRequest.typeUrl)) { + return; + } + PageRequest.registerTypeUrl(); } }; function createBaseQueryTotalSupplyResponse(): QueryTotalSupplyResponse { @@ -1695,6 +1798,15 @@ function createBaseQueryTotalSupplyResponse(): QueryTotalSupplyResponse { export const QueryTotalSupplyResponse = { typeUrl: "/cosmos.bank.v1beta1.QueryTotalSupplyResponse", aminoType: "cosmos-sdk/QueryTotalSupplyResponse", + is(o: any): o is QueryTotalSupplyResponse { + return o && (o.$typeUrl === QueryTotalSupplyResponse.typeUrl || Array.isArray(o.supply) && (!o.supply.length || Coin.is(o.supply[0]))); + }, + isSDK(o: any): o is QueryTotalSupplyResponseSDKType { + return o && (o.$typeUrl === QueryTotalSupplyResponse.typeUrl || Array.isArray(o.supply) && (!o.supply.length || Coin.isSDK(o.supply[0]))); + }, + isAmino(o: any): o is QueryTotalSupplyResponseAmino { + return o && (o.$typeUrl === QueryTotalSupplyResponse.typeUrl || Array.isArray(o.supply) && (!o.supply.length || Coin.isAmino(o.supply[0]))); + }, encode(message: QueryTotalSupplyResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.supply) { Coin.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -1802,6 +1914,13 @@ export const QueryTotalSupplyResponse = { typeUrl: "/cosmos.bank.v1beta1.QueryTotalSupplyResponse", value: QueryTotalSupplyResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryTotalSupplyResponse.typeUrl)) { + return; + } + Coin.registerTypeUrl(); + PageResponse.registerTypeUrl(); } }; function createBaseQuerySupplyOfRequest(): QuerySupplyOfRequest { @@ -1818,6 +1937,15 @@ function createBaseQuerySupplyOfRequest(): QuerySupplyOfRequest { export const QuerySupplyOfRequest = { typeUrl: "/cosmos.bank.v1beta1.QuerySupplyOfRequest", aminoType: "cosmos-sdk/QuerySupplyOfRequest", + is(o: any): o is QuerySupplyOfRequest { + return o && (o.$typeUrl === QuerySupplyOfRequest.typeUrl || typeof o.denom === "string"); + }, + isSDK(o: any): o is QuerySupplyOfRequestSDKType { + return o && (o.$typeUrl === QuerySupplyOfRequest.typeUrl || typeof o.denom === "string"); + }, + isAmino(o: any): o is QuerySupplyOfRequestAmino { + return o && (o.$typeUrl === QuerySupplyOfRequest.typeUrl || typeof o.denom === "string"); + }, encode(message: QuerySupplyOfRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.denom !== "") { writer.uint32(10).string(message.denom); @@ -1898,7 +2026,8 @@ export const QuerySupplyOfRequest = { typeUrl: "/cosmos.bank.v1beta1.QuerySupplyOfRequest", value: QuerySupplyOfRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQuerySupplyOfResponse(): QuerySupplyOfResponse { return { @@ -1914,6 +2043,15 @@ function createBaseQuerySupplyOfResponse(): QuerySupplyOfResponse { export const QuerySupplyOfResponse = { typeUrl: "/cosmos.bank.v1beta1.QuerySupplyOfResponse", aminoType: "cosmos-sdk/QuerySupplyOfResponse", + is(o: any): o is QuerySupplyOfResponse { + return o && (o.$typeUrl === QuerySupplyOfResponse.typeUrl || Coin.is(o.amount)); + }, + isSDK(o: any): o is QuerySupplyOfResponseSDKType { + return o && (o.$typeUrl === QuerySupplyOfResponse.typeUrl || Coin.isSDK(o.amount)); + }, + isAmino(o: any): o is QuerySupplyOfResponseAmino { + return o && (o.$typeUrl === QuerySupplyOfResponse.typeUrl || Coin.isAmino(o.amount)); + }, encode(message: QuerySupplyOfResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.amount !== undefined) { Coin.encode(message.amount, writer.uint32(10).fork()).ldelim(); @@ -1996,6 +2134,12 @@ export const QuerySupplyOfResponse = { typeUrl: "/cosmos.bank.v1beta1.QuerySupplyOfResponse", value: QuerySupplyOfResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QuerySupplyOfResponse.typeUrl)) { + return; + } + Coin.registerTypeUrl(); } }; function createBaseQueryParamsRequest(): QueryParamsRequest { @@ -2010,6 +2154,15 @@ function createBaseQueryParamsRequest(): QueryParamsRequest { export const QueryParamsRequest = { typeUrl: "/cosmos.bank.v1beta1.QueryParamsRequest", aminoType: "cosmos-sdk/QueryParamsRequest", + is(o: any): o is QueryParamsRequest { + return o && o.$typeUrl === QueryParamsRequest.typeUrl; + }, + isSDK(o: any): o is QueryParamsRequestSDKType { + return o && o.$typeUrl === QueryParamsRequest.typeUrl; + }, + isAmino(o: any): o is QueryParamsRequestAmino { + return o && o.$typeUrl === QueryParamsRequest.typeUrl; + }, encode(_: QueryParamsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -2074,7 +2227,8 @@ export const QueryParamsRequest = { typeUrl: "/cosmos.bank.v1beta1.QueryParamsRequest", value: QueryParamsRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryParamsResponse(): QueryParamsResponse { return { @@ -2090,6 +2244,15 @@ function createBaseQueryParamsResponse(): QueryParamsResponse { export const QueryParamsResponse = { typeUrl: "/cosmos.bank.v1beta1.QueryParamsResponse", aminoType: "cosmos-sdk/QueryParamsResponse", + is(o: any): o is QueryParamsResponse { + return o && (o.$typeUrl === QueryParamsResponse.typeUrl || Params.is(o.params)); + }, + isSDK(o: any): o is QueryParamsResponseSDKType { + return o && (o.$typeUrl === QueryParamsResponse.typeUrl || Params.isSDK(o.params)); + }, + isAmino(o: any): o is QueryParamsResponseAmino { + return o && (o.$typeUrl === QueryParamsResponse.typeUrl || Params.isAmino(o.params)); + }, encode(message: QueryParamsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.params !== undefined) { Params.encode(message.params, writer.uint32(10).fork()).ldelim(); @@ -2172,6 +2335,12 @@ export const QueryParamsResponse = { typeUrl: "/cosmos.bank.v1beta1.QueryParamsResponse", value: QueryParamsResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryParamsResponse.typeUrl)) { + return; + } + Params.registerTypeUrl(); } }; function createBaseQueryDenomsMetadataRequest(): QueryDenomsMetadataRequest { @@ -2188,6 +2357,15 @@ function createBaseQueryDenomsMetadataRequest(): QueryDenomsMetadataRequest { export const QueryDenomsMetadataRequest = { typeUrl: "/cosmos.bank.v1beta1.QueryDenomsMetadataRequest", aminoType: "cosmos-sdk/QueryDenomsMetadataRequest", + is(o: any): o is QueryDenomsMetadataRequest { + return o && o.$typeUrl === QueryDenomsMetadataRequest.typeUrl; + }, + isSDK(o: any): o is QueryDenomsMetadataRequestSDKType { + return o && o.$typeUrl === QueryDenomsMetadataRequest.typeUrl; + }, + isAmino(o: any): o is QueryDenomsMetadataRequestAmino { + return o && o.$typeUrl === QueryDenomsMetadataRequest.typeUrl; + }, encode(message: QueryDenomsMetadataRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.pagination !== undefined) { PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); @@ -2270,6 +2448,12 @@ export const QueryDenomsMetadataRequest = { typeUrl: "/cosmos.bank.v1beta1.QueryDenomsMetadataRequest", value: QueryDenomsMetadataRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryDenomsMetadataRequest.typeUrl)) { + return; + } + PageRequest.registerTypeUrl(); } }; function createBaseQueryDenomsMetadataResponse(): QueryDenomsMetadataResponse { @@ -2288,6 +2472,15 @@ function createBaseQueryDenomsMetadataResponse(): QueryDenomsMetadataResponse { export const QueryDenomsMetadataResponse = { typeUrl: "/cosmos.bank.v1beta1.QueryDenomsMetadataResponse", aminoType: "cosmos-sdk/QueryDenomsMetadataResponse", + is(o: any): o is QueryDenomsMetadataResponse { + return o && (o.$typeUrl === QueryDenomsMetadataResponse.typeUrl || Array.isArray(o.metadatas) && (!o.metadatas.length || Metadata.is(o.metadatas[0]))); + }, + isSDK(o: any): o is QueryDenomsMetadataResponseSDKType { + return o && (o.$typeUrl === QueryDenomsMetadataResponse.typeUrl || Array.isArray(o.metadatas) && (!o.metadatas.length || Metadata.isSDK(o.metadatas[0]))); + }, + isAmino(o: any): o is QueryDenomsMetadataResponseAmino { + return o && (o.$typeUrl === QueryDenomsMetadataResponse.typeUrl || Array.isArray(o.metadatas) && (!o.metadatas.length || Metadata.isAmino(o.metadatas[0]))); + }, encode(message: QueryDenomsMetadataResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.metadatas) { Metadata.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -2395,6 +2588,13 @@ export const QueryDenomsMetadataResponse = { typeUrl: "/cosmos.bank.v1beta1.QueryDenomsMetadataResponse", value: QueryDenomsMetadataResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryDenomsMetadataResponse.typeUrl)) { + return; + } + Metadata.registerTypeUrl(); + PageResponse.registerTypeUrl(); } }; function createBaseQueryDenomMetadataRequest(): QueryDenomMetadataRequest { @@ -2411,6 +2611,15 @@ function createBaseQueryDenomMetadataRequest(): QueryDenomMetadataRequest { export const QueryDenomMetadataRequest = { typeUrl: "/cosmos.bank.v1beta1.QueryDenomMetadataRequest", aminoType: "cosmos-sdk/QueryDenomMetadataRequest", + is(o: any): o is QueryDenomMetadataRequest { + return o && (o.$typeUrl === QueryDenomMetadataRequest.typeUrl || typeof o.denom === "string"); + }, + isSDK(o: any): o is QueryDenomMetadataRequestSDKType { + return o && (o.$typeUrl === QueryDenomMetadataRequest.typeUrl || typeof o.denom === "string"); + }, + isAmino(o: any): o is QueryDenomMetadataRequestAmino { + return o && (o.$typeUrl === QueryDenomMetadataRequest.typeUrl || typeof o.denom === "string"); + }, encode(message: QueryDenomMetadataRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.denom !== "") { writer.uint32(10).string(message.denom); @@ -2491,7 +2700,8 @@ export const QueryDenomMetadataRequest = { typeUrl: "/cosmos.bank.v1beta1.QueryDenomMetadataRequest", value: QueryDenomMetadataRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryDenomMetadataResponse(): QueryDenomMetadataResponse { return { @@ -2508,6 +2718,15 @@ function createBaseQueryDenomMetadataResponse(): QueryDenomMetadataResponse { export const QueryDenomMetadataResponse = { typeUrl: "/cosmos.bank.v1beta1.QueryDenomMetadataResponse", aminoType: "cosmos-sdk/QueryDenomMetadataResponse", + is(o: any): o is QueryDenomMetadataResponse { + return o && (o.$typeUrl === QueryDenomMetadataResponse.typeUrl || Metadata.is(o.metadata)); + }, + isSDK(o: any): o is QueryDenomMetadataResponseSDKType { + return o && (o.$typeUrl === QueryDenomMetadataResponse.typeUrl || Metadata.isSDK(o.metadata)); + }, + isAmino(o: any): o is QueryDenomMetadataResponseAmino { + return o && (o.$typeUrl === QueryDenomMetadataResponse.typeUrl || Metadata.isAmino(o.metadata)); + }, encode(message: QueryDenomMetadataResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.metadata !== undefined) { Metadata.encode(message.metadata, writer.uint32(10).fork()).ldelim(); @@ -2590,6 +2809,12 @@ export const QueryDenomMetadataResponse = { typeUrl: "/cosmos.bank.v1beta1.QueryDenomMetadataResponse", value: QueryDenomMetadataResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryDenomMetadataResponse.typeUrl)) { + return; + } + Metadata.registerTypeUrl(); } }; function createBaseQueryDenomOwnersRequest(): QueryDenomOwnersRequest { @@ -2609,6 +2834,15 @@ function createBaseQueryDenomOwnersRequest(): QueryDenomOwnersRequest { export const QueryDenomOwnersRequest = { typeUrl: "/cosmos.bank.v1beta1.QueryDenomOwnersRequest", aminoType: "cosmos-sdk/QueryDenomOwnersRequest", + is(o: any): o is QueryDenomOwnersRequest { + return o && (o.$typeUrl === QueryDenomOwnersRequest.typeUrl || typeof o.denom === "string"); + }, + isSDK(o: any): o is QueryDenomOwnersRequestSDKType { + return o && (o.$typeUrl === QueryDenomOwnersRequest.typeUrl || typeof o.denom === "string"); + }, + isAmino(o: any): o is QueryDenomOwnersRequestAmino { + return o && (o.$typeUrl === QueryDenomOwnersRequest.typeUrl || typeof o.denom === "string"); + }, encode(message: QueryDenomOwnersRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.denom !== "") { writer.uint32(10).string(message.denom); @@ -2706,6 +2940,12 @@ export const QueryDenomOwnersRequest = { typeUrl: "/cosmos.bank.v1beta1.QueryDenomOwnersRequest", value: QueryDenomOwnersRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryDenomOwnersRequest.typeUrl)) { + return; + } + PageRequest.registerTypeUrl(); } }; function createBaseDenomOwner(): DenomOwner { @@ -2725,6 +2965,15 @@ function createBaseDenomOwner(): DenomOwner { export const DenomOwner = { typeUrl: "/cosmos.bank.v1beta1.DenomOwner", aminoType: "cosmos-sdk/DenomOwner", + is(o: any): o is DenomOwner { + return o && (o.$typeUrl === DenomOwner.typeUrl || typeof o.address === "string" && Coin.is(o.balance)); + }, + isSDK(o: any): o is DenomOwnerSDKType { + return o && (o.$typeUrl === DenomOwner.typeUrl || typeof o.address === "string" && Coin.isSDK(o.balance)); + }, + isAmino(o: any): o is DenomOwnerAmino { + return o && (o.$typeUrl === DenomOwner.typeUrl || typeof o.address === "string" && Coin.isAmino(o.balance)); + }, encode(message: DenomOwner, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.address !== "") { writer.uint32(10).string(message.address); @@ -2822,6 +3071,12 @@ export const DenomOwner = { typeUrl: "/cosmos.bank.v1beta1.DenomOwner", value: DenomOwner.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(DenomOwner.typeUrl)) { + return; + } + Coin.registerTypeUrl(); } }; function createBaseQueryDenomOwnersResponse(): QueryDenomOwnersResponse { @@ -2839,6 +3094,15 @@ function createBaseQueryDenomOwnersResponse(): QueryDenomOwnersResponse { export const QueryDenomOwnersResponse = { typeUrl: "/cosmos.bank.v1beta1.QueryDenomOwnersResponse", aminoType: "cosmos-sdk/QueryDenomOwnersResponse", + is(o: any): o is QueryDenomOwnersResponse { + return o && (o.$typeUrl === QueryDenomOwnersResponse.typeUrl || Array.isArray(o.denomOwners) && (!o.denomOwners.length || DenomOwner.is(o.denomOwners[0]))); + }, + isSDK(o: any): o is QueryDenomOwnersResponseSDKType { + return o && (o.$typeUrl === QueryDenomOwnersResponse.typeUrl || Array.isArray(o.denom_owners) && (!o.denom_owners.length || DenomOwner.isSDK(o.denom_owners[0]))); + }, + isAmino(o: any): o is QueryDenomOwnersResponseAmino { + return o && (o.$typeUrl === QueryDenomOwnersResponse.typeUrl || Array.isArray(o.denom_owners) && (!o.denom_owners.length || DenomOwner.isAmino(o.denom_owners[0]))); + }, encode(message: QueryDenomOwnersResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.denomOwners) { DenomOwner.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -2946,5 +3210,12 @@ export const QueryDenomOwnersResponse = { typeUrl: "/cosmos.bank.v1beta1.QueryDenomOwnersResponse", value: QueryDenomOwnersResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryDenomOwnersResponse.typeUrl)) { + return; + } + DenomOwner.registerTypeUrl(); + PageResponse.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/cosmos/bank/v1beta1/tx.registry.ts b/__fixtures__/v-next/outputv2/cosmos/bank/v1beta1/tx.registry.ts index cc9903e84c..2bc22132a2 100644 --- a/__fixtures__/v-next/outputv2/cosmos/bank/v1beta1/tx.registry.ts +++ b/__fixtures__/v-next/outputv2/cosmos/bank/v1beta1/tx.registry.ts @@ -1,11 +1,6 @@ -import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { TelescopeGeneratedType } from "../../../types"; import { MsgSend, MsgMultiSend } from "./tx"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/cosmos.bank.v1beta1.MsgSend", MsgSend], ["/cosmos.bank.v1beta1.MsgMultiSend", MsgMultiSend]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/cosmos.bank.v1beta1.MsgSend", MsgSend], ["/cosmos.bank.v1beta1.MsgMultiSend", MsgMultiSend]]; export const MessageComposer = { encoded: { send(value: MsgSend) { diff --git a/__fixtures__/v-next/outputv2/cosmos/bank/v1beta1/tx.rpc.func.ts b/__fixtures__/v-next/outputv2/cosmos/bank/v1beta1/tx.rpc.func.ts new file mode 100644 index 0000000000..bbee1ba98a --- /dev/null +++ b/__fixtures__/v-next/outputv2/cosmos/bank/v1beta1/tx.rpc.func.ts @@ -0,0 +1,20 @@ +import { buildTx } from "../../../helper-func-types"; +import { MsgSend, MsgMultiSend } from "./tx"; +/** + * Send defines a method for sending coins from one account to another account. + * @name send + * @package cosmos.bank.v1beta1 + * @see proto service: cosmos.bank.v1beta1.Send + */ +export const send = buildTx({ + msg: MsgSend +}); +/** + * MultiSend defines a method for sending coins from some accounts to other accounts. + * @name multiSend + * @package cosmos.bank.v1beta1 + * @see proto service: cosmos.bank.v1beta1.MultiSend + */ +export const multiSend = buildTx({ + msg: MsgMultiSend +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/cosmos/bank/v1beta1/tx.ts b/__fixtures__/v-next/outputv2/cosmos/bank/v1beta1/tx.ts index 65c27c8820..4ea8a2710d 100644 --- a/__fixtures__/v-next/outputv2/cosmos/bank/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputv2/cosmos/bank/v1beta1/tx.ts @@ -3,6 +3,7 @@ import { Input, InputAmino, InputSDKType, Output, OutputAmino, OutputSDKType } f import { BinaryReader, BinaryWriter } from "../../../binary"; import { isSet, DeepPartial } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "cosmos.bank.v1beta1"; /** * MsgSend represents a message to send coins from one account to another. @@ -157,6 +158,15 @@ function createBaseMsgSend(): MsgSend { export const MsgSend = { typeUrl: "/cosmos.bank.v1beta1.MsgSend", aminoType: "cosmos-sdk/MsgSend", + is(o: any): o is MsgSend { + return o && (o.$typeUrl === MsgSend.typeUrl || typeof o.fromAddress === "string" && typeof o.toAddress === "string" && Array.isArray(o.amount) && (!o.amount.length || Coin.is(o.amount[0]))); + }, + isSDK(o: any): o is MsgSendSDKType { + return o && (o.$typeUrl === MsgSend.typeUrl || typeof o.from_address === "string" && typeof o.to_address === "string" && Array.isArray(o.amount) && (!o.amount.length || Coin.isSDK(o.amount[0]))); + }, + isAmino(o: any): o is MsgSendAmino { + return o && (o.$typeUrl === MsgSend.typeUrl || typeof o.from_address === "string" && typeof o.to_address === "string" && Array.isArray(o.amount) && (!o.amount.length || Coin.isAmino(o.amount[0]))); + }, encode(message: MsgSend, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.fromAddress !== "") { writer.uint32(10).string(message.fromAddress); @@ -277,6 +287,12 @@ export const MsgSend = { typeUrl: "/cosmos.bank.v1beta1.MsgSend", value: MsgSend.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgSend.typeUrl)) { + return; + } + Coin.registerTypeUrl(); } }; function createBaseMsgSendResponse(): MsgSendResponse { @@ -291,6 +307,15 @@ function createBaseMsgSendResponse(): MsgSendResponse { export const MsgSendResponse = { typeUrl: "/cosmos.bank.v1beta1.MsgSendResponse", aminoType: "cosmos-sdk/MsgSendResponse", + is(o: any): o is MsgSendResponse { + return o && o.$typeUrl === MsgSendResponse.typeUrl; + }, + isSDK(o: any): o is MsgSendResponseSDKType { + return o && o.$typeUrl === MsgSendResponse.typeUrl; + }, + isAmino(o: any): o is MsgSendResponseAmino { + return o && o.$typeUrl === MsgSendResponse.typeUrl; + }, encode(_: MsgSendResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -355,7 +380,8 @@ export const MsgSendResponse = { typeUrl: "/cosmos.bank.v1beta1.MsgSendResponse", value: MsgSendResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgMultiSend(): MsgMultiSend { return { @@ -372,6 +398,15 @@ function createBaseMsgMultiSend(): MsgMultiSend { export const MsgMultiSend = { typeUrl: "/cosmos.bank.v1beta1.MsgMultiSend", aminoType: "cosmos-sdk/MsgMultiSend", + is(o: any): o is MsgMultiSend { + return o && (o.$typeUrl === MsgMultiSend.typeUrl || Array.isArray(o.inputs) && (!o.inputs.length || Input.is(o.inputs[0])) && Array.isArray(o.outputs) && (!o.outputs.length || Output.is(o.outputs[0]))); + }, + isSDK(o: any): o is MsgMultiSendSDKType { + return o && (o.$typeUrl === MsgMultiSend.typeUrl || Array.isArray(o.inputs) && (!o.inputs.length || Input.isSDK(o.inputs[0])) && Array.isArray(o.outputs) && (!o.outputs.length || Output.isSDK(o.outputs[0]))); + }, + isAmino(o: any): o is MsgMultiSendAmino { + return o && (o.$typeUrl === MsgMultiSend.typeUrl || Array.isArray(o.inputs) && (!o.inputs.length || Input.isAmino(o.inputs[0])) && Array.isArray(o.outputs) && (!o.outputs.length || Output.isAmino(o.outputs[0]))); + }, encode(message: MsgMultiSend, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.inputs) { Input.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -487,6 +522,13 @@ export const MsgMultiSend = { typeUrl: "/cosmos.bank.v1beta1.MsgMultiSend", value: MsgMultiSend.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgMultiSend.typeUrl)) { + return; + } + Input.registerTypeUrl(); + Output.registerTypeUrl(); } }; function createBaseMsgMultiSendResponse(): MsgMultiSendResponse { @@ -501,6 +543,15 @@ function createBaseMsgMultiSendResponse(): MsgMultiSendResponse { export const MsgMultiSendResponse = { typeUrl: "/cosmos.bank.v1beta1.MsgMultiSendResponse", aminoType: "cosmos-sdk/MsgMultiSendResponse", + is(o: any): o is MsgMultiSendResponse { + return o && o.$typeUrl === MsgMultiSendResponse.typeUrl; + }, + isSDK(o: any): o is MsgMultiSendResponseSDKType { + return o && o.$typeUrl === MsgMultiSendResponse.typeUrl; + }, + isAmino(o: any): o is MsgMultiSendResponseAmino { + return o && o.$typeUrl === MsgMultiSendResponse.typeUrl; + }, encode(_: MsgMultiSendResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -565,5 +616,6 @@ export const MsgMultiSendResponse = { typeUrl: "/cosmos.bank.v1beta1.MsgMultiSendResponse", value: MsgMultiSendResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/cosmos/base/abci/v1beta1/abci.ts b/__fixtures__/v-next/outputv2/cosmos/base/abci/v1beta1/abci.ts index 63cf73a70d..2abde64bad 100644 --- a/__fixtures__/v-next/outputv2/cosmos/base/abci/v1beta1/abci.ts +++ b/__fixtures__/v-next/outputv2/cosmos/base/abci/v1beta1/abci.ts @@ -1,6 +1,7 @@ import { Any, AnyAmino, AnySDKType } from "../../../../google/protobuf/any"; import { Event, EventAmino, EventSDKType } from "../../../../tendermint/abci/types"; import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { GlobalDecoderRegistry } from "../../../../registry"; import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../../helpers"; import { JsonSafe } from "../../../../json-safe"; export const protobufPackage = "cosmos.base.abci.v1beta1"; @@ -698,6 +699,15 @@ function createBaseTxResponse(): TxResponse { export const TxResponse = { typeUrl: "/cosmos.base.abci.v1beta1.TxResponse", aminoType: "cosmos-sdk/TxResponse", + is(o: any): o is TxResponse { + return o && (o.$typeUrl === TxResponse.typeUrl || typeof o.height === "bigint" && typeof o.txhash === "string" && typeof o.codespace === "string" && typeof o.code === "number" && typeof o.data === "string" && typeof o.rawLog === "string" && Array.isArray(o.logs) && (!o.logs.length || ABCIMessageLog.is(o.logs[0])) && typeof o.info === "string" && typeof o.gasWanted === "bigint" && typeof o.gasUsed === "bigint" && typeof o.timestamp === "string" && Array.isArray(o.events) && (!o.events.length || Event.is(o.events[0]))); + }, + isSDK(o: any): o is TxResponseSDKType { + return o && (o.$typeUrl === TxResponse.typeUrl || typeof o.height === "bigint" && typeof o.txhash === "string" && typeof o.codespace === "string" && typeof o.code === "number" && typeof o.data === "string" && typeof o.raw_log === "string" && Array.isArray(o.logs) && (!o.logs.length || ABCIMessageLog.isSDK(o.logs[0])) && typeof o.info === "string" && typeof o.gas_wanted === "bigint" && typeof o.gas_used === "bigint" && typeof o.timestamp === "string" && Array.isArray(o.events) && (!o.events.length || Event.isSDK(o.events[0]))); + }, + isAmino(o: any): o is TxResponseAmino { + return o && (o.$typeUrl === TxResponse.typeUrl || typeof o.height === "bigint" && typeof o.txhash === "string" && typeof o.codespace === "string" && typeof o.code === "number" && typeof o.data === "string" && typeof o.raw_log === "string" && Array.isArray(o.logs) && (!o.logs.length || ABCIMessageLog.isAmino(o.logs[0])) && typeof o.info === "string" && typeof o.gas_wanted === "bigint" && typeof o.gas_used === "bigint" && typeof o.timestamp === "string" && Array.isArray(o.events) && (!o.events.length || Event.isAmino(o.events[0]))); + }, encode(message: TxResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.height !== BigInt(0)) { writer.uint32(8).int64(message.height); @@ -986,6 +996,12 @@ export const TxResponse = { typeUrl: "/cosmos.base.abci.v1beta1.TxResponse", value: TxResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(TxResponse.typeUrl)) { + return; + } + Event.registerTypeUrl(); } }; function createBaseABCIMessageLog(): ABCIMessageLog { @@ -1004,6 +1020,15 @@ function createBaseABCIMessageLog(): ABCIMessageLog { export const ABCIMessageLog = { typeUrl: "/cosmos.base.abci.v1beta1.ABCIMessageLog", aminoType: "cosmos-sdk/ABCIMessageLog", + is(o: any): o is ABCIMessageLog { + return o && (o.$typeUrl === ABCIMessageLog.typeUrl || typeof o.msgIndex === "number" && typeof o.log === "string" && Array.isArray(o.events) && (!o.events.length || StringEvent.is(o.events[0]))); + }, + isSDK(o: any): o is ABCIMessageLogSDKType { + return o && (o.$typeUrl === ABCIMessageLog.typeUrl || typeof o.msg_index === "number" && typeof o.log === "string" && Array.isArray(o.events) && (!o.events.length || StringEvent.isSDK(o.events[0]))); + }, + isAmino(o: any): o is ABCIMessageLogAmino { + return o && (o.$typeUrl === ABCIMessageLog.typeUrl || typeof o.msg_index === "number" && typeof o.log === "string" && Array.isArray(o.events) && (!o.events.length || StringEvent.isAmino(o.events[0]))); + }, encode(message: ABCIMessageLog, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.msgIndex !== 0) { writer.uint32(8).uint32(message.msgIndex); @@ -1124,6 +1149,12 @@ export const ABCIMessageLog = { typeUrl: "/cosmos.base.abci.v1beta1.ABCIMessageLog", value: ABCIMessageLog.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ABCIMessageLog.typeUrl)) { + return; + } + StringEvent.registerTypeUrl(); } }; function createBaseStringEvent(): StringEvent { @@ -1142,6 +1173,15 @@ function createBaseStringEvent(): StringEvent { export const StringEvent = { typeUrl: "/cosmos.base.abci.v1beta1.StringEvent", aminoType: "cosmos-sdk/StringEvent", + is(o: any): o is StringEvent { + return o && (o.$typeUrl === StringEvent.typeUrl || typeof o.type === "string" && Array.isArray(o.attributes) && (!o.attributes.length || Attribute.is(o.attributes[0]))); + }, + isSDK(o: any): o is StringEventSDKType { + return o && (o.$typeUrl === StringEvent.typeUrl || typeof o.type === "string" && Array.isArray(o.attributes) && (!o.attributes.length || Attribute.isSDK(o.attributes[0]))); + }, + isAmino(o: any): o is StringEventAmino { + return o && (o.$typeUrl === StringEvent.typeUrl || typeof o.type === "string" && Array.isArray(o.attributes) && (!o.attributes.length || Attribute.isAmino(o.attributes[0]))); + }, encode(message: StringEvent, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.type !== "") { writer.uint32(10).string(message.type); @@ -1247,6 +1287,12 @@ export const StringEvent = { typeUrl: "/cosmos.base.abci.v1beta1.StringEvent", value: StringEvent.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(StringEvent.typeUrl)) { + return; + } + Attribute.registerTypeUrl(); } }; function createBaseAttribute(): Attribute { @@ -1265,6 +1311,15 @@ function createBaseAttribute(): Attribute { export const Attribute = { typeUrl: "/cosmos.base.abci.v1beta1.Attribute", aminoType: "cosmos-sdk/Attribute", + is(o: any): o is Attribute { + return o && (o.$typeUrl === Attribute.typeUrl || typeof o.key === "string" && typeof o.value === "string"); + }, + isSDK(o: any): o is AttributeSDKType { + return o && (o.$typeUrl === Attribute.typeUrl || typeof o.key === "string" && typeof o.value === "string"); + }, + isAmino(o: any): o is AttributeAmino { + return o && (o.$typeUrl === Attribute.typeUrl || typeof o.key === "string" && typeof o.value === "string"); + }, encode(message: Attribute, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.key !== "") { writer.uint32(10).string(message.key); @@ -1360,7 +1415,8 @@ export const Attribute = { typeUrl: "/cosmos.base.abci.v1beta1.Attribute", value: Attribute.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseGasInfo(): GasInfo { return { @@ -1377,6 +1433,15 @@ function createBaseGasInfo(): GasInfo { export const GasInfo = { typeUrl: "/cosmos.base.abci.v1beta1.GasInfo", aminoType: "cosmos-sdk/GasInfo", + is(o: any): o is GasInfo { + return o && (o.$typeUrl === GasInfo.typeUrl || typeof o.gasWanted === "bigint" && typeof o.gasUsed === "bigint"); + }, + isSDK(o: any): o is GasInfoSDKType { + return o && (o.$typeUrl === GasInfo.typeUrl || typeof o.gas_wanted === "bigint" && typeof o.gas_used === "bigint"); + }, + isAmino(o: any): o is GasInfoAmino { + return o && (o.$typeUrl === GasInfo.typeUrl || typeof o.gas_wanted === "bigint" && typeof o.gas_used === "bigint"); + }, encode(message: GasInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.gasWanted !== BigInt(0)) { writer.uint32(8).uint64(message.gasWanted); @@ -1476,7 +1541,8 @@ export const GasInfo = { typeUrl: "/cosmos.base.abci.v1beta1.GasInfo", value: GasInfo.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseResult(): Result { return { @@ -1495,6 +1561,15 @@ function createBaseResult(): Result { export const Result = { typeUrl: "/cosmos.base.abci.v1beta1.Result", aminoType: "cosmos-sdk/Result", + is(o: any): o is Result { + return o && (o.$typeUrl === Result.typeUrl || (o.data instanceof Uint8Array || typeof o.data === "string") && typeof o.log === "string" && Array.isArray(o.events) && (!o.events.length || Event.is(o.events[0])) && Array.isArray(o.msgResponses) && (!o.msgResponses.length || Any.is(o.msgResponses[0]))); + }, + isSDK(o: any): o is ResultSDKType { + return o && (o.$typeUrl === Result.typeUrl || (o.data instanceof Uint8Array || typeof o.data === "string") && typeof o.log === "string" && Array.isArray(o.events) && (!o.events.length || Event.isSDK(o.events[0])) && Array.isArray(o.msg_responses) && (!o.msg_responses.length || Any.isSDK(o.msg_responses[0]))); + }, + isAmino(o: any): o is ResultAmino { + return o && (o.$typeUrl === Result.typeUrl || (o.data instanceof Uint8Array || typeof o.data === "string") && typeof o.log === "string" && Array.isArray(o.events) && (!o.events.length || Event.isAmino(o.events[0])) && Array.isArray(o.msg_responses) && (!o.msg_responses.length || Any.isAmino(o.msg_responses[0]))); + }, encode(message: Result, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.data.length !== 0) { writer.uint32(10).bytes(message.data); @@ -1640,7 +1715,8 @@ export const Result = { typeUrl: "/cosmos.base.abci.v1beta1.Result", value: Result.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseSimulationResponse(): SimulationResponse { return { @@ -1658,6 +1734,15 @@ function createBaseSimulationResponse(): SimulationResponse { export const SimulationResponse = { typeUrl: "/cosmos.base.abci.v1beta1.SimulationResponse", aminoType: "cosmos-sdk/SimulationResponse", + is(o: any): o is SimulationResponse { + return o && (o.$typeUrl === SimulationResponse.typeUrl || GasInfo.is(o.gasInfo)); + }, + isSDK(o: any): o is SimulationResponseSDKType { + return o && (o.$typeUrl === SimulationResponse.typeUrl || GasInfo.isSDK(o.gas_info)); + }, + isAmino(o: any): o is SimulationResponseAmino { + return o && (o.$typeUrl === SimulationResponse.typeUrl || GasInfo.isAmino(o.gas_info)); + }, encode(message: SimulationResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.gasInfo !== undefined) { GasInfo.encode(message.gasInfo, writer.uint32(10).fork()).ldelim(); @@ -1757,6 +1842,13 @@ export const SimulationResponse = { typeUrl: "/cosmos.base.abci.v1beta1.SimulationResponse", value: SimulationResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(SimulationResponse.typeUrl)) { + return; + } + GasInfo.registerTypeUrl(); + Result.registerTypeUrl(); } }; function createBaseMsgData(): MsgData { @@ -1776,6 +1868,15 @@ function createBaseMsgData(): MsgData { export const MsgData = { typeUrl: "/cosmos.base.abci.v1beta1.MsgData", aminoType: "cosmos-sdk/MsgData", + is(o: any): o is MsgData { + return o && (o.$typeUrl === MsgData.typeUrl || typeof o.msgType === "string" && (o.data instanceof Uint8Array || typeof o.data === "string")); + }, + isSDK(o: any): o is MsgDataSDKType { + return o && (o.$typeUrl === MsgData.typeUrl || typeof o.msg_type === "string" && (o.data instanceof Uint8Array || typeof o.data === "string")); + }, + isAmino(o: any): o is MsgDataAmino { + return o && (o.$typeUrl === MsgData.typeUrl || typeof o.msg_type === "string" && (o.data instanceof Uint8Array || typeof o.data === "string")); + }, encode(message: MsgData, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.msgType !== "") { writer.uint32(10).string(message.msgType); @@ -1871,7 +1972,8 @@ export const MsgData = { typeUrl: "/cosmos.base.abci.v1beta1.MsgData", value: MsgData.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseTxMsgData(): TxMsgData { return { @@ -1889,6 +1991,15 @@ function createBaseTxMsgData(): TxMsgData { export const TxMsgData = { typeUrl: "/cosmos.base.abci.v1beta1.TxMsgData", aminoType: "cosmos-sdk/TxMsgData", + is(o: any): o is TxMsgData { + return o && (o.$typeUrl === TxMsgData.typeUrl || Array.isArray(o.data) && (!o.data.length || MsgData.is(o.data[0])) && Array.isArray(o.msgResponses) && (!o.msgResponses.length || Any.is(o.msgResponses[0]))); + }, + isSDK(o: any): o is TxMsgDataSDKType { + return o && (o.$typeUrl === TxMsgData.typeUrl || Array.isArray(o.data) && (!o.data.length || MsgData.isSDK(o.data[0])) && Array.isArray(o.msg_responses) && (!o.msg_responses.length || Any.isSDK(o.msg_responses[0]))); + }, + isAmino(o: any): o is TxMsgDataAmino { + return o && (o.$typeUrl === TxMsgData.typeUrl || Array.isArray(o.data) && (!o.data.length || MsgData.isAmino(o.data[0])) && Array.isArray(o.msg_responses) && (!o.msg_responses.length || Any.isAmino(o.msg_responses[0]))); + }, encode(message: TxMsgData, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.data) { MsgData.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -2004,7 +2115,8 @@ export const TxMsgData = { typeUrl: "/cosmos.base.abci.v1beta1.TxMsgData", value: TxMsgData.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseSearchTxsResult(): SearchTxsResult { return { @@ -2025,6 +2137,15 @@ function createBaseSearchTxsResult(): SearchTxsResult { export const SearchTxsResult = { typeUrl: "/cosmos.base.abci.v1beta1.SearchTxsResult", aminoType: "cosmos-sdk/SearchTxsResult", + is(o: any): o is SearchTxsResult { + return o && (o.$typeUrl === SearchTxsResult.typeUrl || typeof o.totalCount === "bigint" && typeof o.count === "bigint" && typeof o.pageNumber === "bigint" && typeof o.pageTotal === "bigint" && typeof o.limit === "bigint" && Array.isArray(o.txs) && (!o.txs.length || TxResponse.is(o.txs[0]))); + }, + isSDK(o: any): o is SearchTxsResultSDKType { + return o && (o.$typeUrl === SearchTxsResult.typeUrl || typeof o.total_count === "bigint" && typeof o.count === "bigint" && typeof o.page_number === "bigint" && typeof o.page_total === "bigint" && typeof o.limit === "bigint" && Array.isArray(o.txs) && (!o.txs.length || TxResponse.isSDK(o.txs[0]))); + }, + isAmino(o: any): o is SearchTxsResultAmino { + return o && (o.$typeUrl === SearchTxsResult.typeUrl || typeof o.total_count === "bigint" && typeof o.count === "bigint" && typeof o.page_number === "bigint" && typeof o.page_total === "bigint" && typeof o.limit === "bigint" && Array.isArray(o.txs) && (!o.txs.length || TxResponse.isAmino(o.txs[0]))); + }, encode(message: SearchTxsResult, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.totalCount !== BigInt(0)) { writer.uint32(8).uint64(message.totalCount); @@ -2200,5 +2321,11 @@ export const SearchTxsResult = { typeUrl: "/cosmos.base.abci.v1beta1.SearchTxsResult", value: SearchTxsResult.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(SearchTxsResult.typeUrl)) { + return; + } + TxResponse.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/cosmos/base/kv/v1beta1/kv.ts b/__fixtures__/v-next/outputv2/cosmos/base/kv/v1beta1/kv.ts index 84e6fcada6..06bb7a9f18 100644 --- a/__fixtures__/v-next/outputv2/cosmos/base/kv/v1beta1/kv.ts +++ b/__fixtures__/v-next/outputv2/cosmos/base/kv/v1beta1/kv.ts @@ -1,6 +1,7 @@ import { BinaryReader, BinaryWriter } from "../../../../binary"; import { JsonSafe } from "../../../../json-safe"; import { DeepPartial, isSet, bytesFromBase64, base64FromBytes } from "../../../../helpers"; +import { GlobalDecoderRegistry } from "../../../../registry"; export const protobufPackage = "cosmos.base.kv.v1beta1"; /** * Pairs defines a repeated slice of Pair objects. @@ -89,6 +90,15 @@ function createBasePairs(): Pairs { export const Pairs = { typeUrl: "/cosmos.base.kv.v1beta1.Pairs", aminoType: "cosmos-sdk/Pairs", + is(o: any): o is Pairs { + return o && (o.$typeUrl === Pairs.typeUrl || Array.isArray(o.pairs) && (!o.pairs.length || Pair.is(o.pairs[0]))); + }, + isSDK(o: any): o is PairsSDKType { + return o && (o.$typeUrl === Pairs.typeUrl || Array.isArray(o.pairs) && (!o.pairs.length || Pair.isSDK(o.pairs[0]))); + }, + isAmino(o: any): o is PairsAmino { + return o && (o.$typeUrl === Pairs.typeUrl || Array.isArray(o.pairs) && (!o.pairs.length || Pair.isAmino(o.pairs[0]))); + }, encode(message: Pairs, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.pairs) { Pair.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -179,6 +189,12 @@ export const Pairs = { typeUrl: "/cosmos.base.kv.v1beta1.Pairs", value: Pairs.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Pairs.typeUrl)) { + return; + } + Pair.registerTypeUrl(); } }; function createBasePair(): Pair { @@ -196,6 +212,15 @@ function createBasePair(): Pair { export const Pair = { typeUrl: "/cosmos.base.kv.v1beta1.Pair", aminoType: "cosmos-sdk/Pair", + is(o: any): o is Pair { + return o && (o.$typeUrl === Pair.typeUrl || (o.key instanceof Uint8Array || typeof o.key === "string") && (o.value instanceof Uint8Array || typeof o.value === "string")); + }, + isSDK(o: any): o is PairSDKType { + return o && (o.$typeUrl === Pair.typeUrl || (o.key instanceof Uint8Array || typeof o.key === "string") && (o.value instanceof Uint8Array || typeof o.value === "string")); + }, + isAmino(o: any): o is PairAmino { + return o && (o.$typeUrl === Pair.typeUrl || (o.key instanceof Uint8Array || typeof o.key === "string") && (o.value instanceof Uint8Array || typeof o.value === "string")); + }, encode(message: Pair, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.key.length !== 0) { writer.uint32(10).bytes(message.key); @@ -291,5 +316,6 @@ export const Pair = { typeUrl: "/cosmos.base.kv.v1beta1.Pair", value: Pair.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/cosmos/base/query/v1beta1/pagination.ts b/__fixtures__/v-next/outputv2/cosmos/base/query/v1beta1/pagination.ts index 15ae5a5206..e70d648e8a 100644 --- a/__fixtures__/v-next/outputv2/cosmos/base/query/v1beta1/pagination.ts +++ b/__fixtures__/v-next/outputv2/cosmos/base/query/v1beta1/pagination.ts @@ -215,6 +215,15 @@ function createBasePageRequest(): PageRequest { export const PageRequest = { typeUrl: "/cosmos.base.query.v1beta1.PageRequest", aminoType: "cosmos-sdk/PageRequest", + is(o: any): o is PageRequest { + return o && (o.$typeUrl === PageRequest.typeUrl || (o.key instanceof Uint8Array || typeof o.key === "string") && typeof o.offset === "bigint" && typeof o.limit === "bigint" && typeof o.countTotal === "boolean" && typeof o.reverse === "boolean"); + }, + isSDK(o: any): o is PageRequestSDKType { + return o && (o.$typeUrl === PageRequest.typeUrl || (o.key instanceof Uint8Array || typeof o.key === "string") && typeof o.offset === "bigint" && typeof o.limit === "bigint" && typeof o.count_total === "boolean" && typeof o.reverse === "boolean"); + }, + isAmino(o: any): o is PageRequestAmino { + return o && (o.$typeUrl === PageRequest.typeUrl || (o.key instanceof Uint8Array || typeof o.key === "string") && typeof o.offset === "bigint" && typeof o.limit === "bigint" && typeof o.count_total === "boolean" && typeof o.reverse === "boolean"); + }, encode(message: PageRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.key.length !== 0) { writer.uint32(10).bytes(message.key); @@ -359,7 +368,8 @@ export const PageRequest = { typeUrl: "/cosmos.base.query.v1beta1.PageRequest", value: PageRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBasePageResponse(): PageResponse { return { @@ -382,6 +392,15 @@ function createBasePageResponse(): PageResponse { export const PageResponse = { typeUrl: "/cosmos.base.query.v1beta1.PageResponse", aminoType: "cosmos-sdk/PageResponse", + is(o: any): o is PageResponse { + return o && (o.$typeUrl === PageResponse.typeUrl || (o.nextKey instanceof Uint8Array || typeof o.nextKey === "string") && typeof o.total === "bigint"); + }, + isSDK(o: any): o is PageResponseSDKType { + return o && (o.$typeUrl === PageResponse.typeUrl || (o.next_key instanceof Uint8Array || typeof o.next_key === "string") && typeof o.total === "bigint"); + }, + isAmino(o: any): o is PageResponseAmino { + return o && (o.$typeUrl === PageResponse.typeUrl || (o.next_key instanceof Uint8Array || typeof o.next_key === "string") && typeof o.total === "bigint"); + }, encode(message: PageResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.nextKey.length !== 0) { writer.uint32(10).bytes(message.nextKey); @@ -479,5 +498,6 @@ export const PageResponse = { typeUrl: "/cosmos.base.query.v1beta1.PageResponse", value: PageResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/cosmos/base/reflection/v1beta1/reflection.rpc.func.ts b/__fixtures__/v-next/outputv2/cosmos/base/reflection/v1beta1/reflection.rpc.func.ts new file mode 100644 index 0000000000..61eed6622f --- /dev/null +++ b/__fixtures__/v-next/outputv2/cosmos/base/reflection/v1beta1/reflection.rpc.func.ts @@ -0,0 +1,30 @@ +import { buildQuery } from "../../../../helper-func-types"; +import { ListAllInterfacesRequest, ListAllInterfacesResponse, ListImplementationsRequest, ListImplementationsResponse } from "./reflection"; +/** + * ListAllInterfaces lists all the interfaces registered in the interface + * registry. + * @name getListAllInterfaces + * @package cosmos.base.reflection.v1beta1 + * @see proto service: cosmos.base.reflection.v1beta1.ListAllInterfaces + */ +export const getListAllInterfaces = buildQuery({ + encode: ListAllInterfacesRequest.encode, + decode: ListAllInterfacesResponse.decode, + service: "cosmos.base.reflection.v1beta1.ReflectionService", + method: "ListAllInterfaces", + deps: [ListAllInterfacesRequest, ListAllInterfacesResponse] +}); +/** + * ListImplementations list all the concrete types that implement a given + * interface. + * @name getListImplementations + * @package cosmos.base.reflection.v1beta1 + * @see proto service: cosmos.base.reflection.v1beta1.ListImplementations + */ +export const getListImplementations = buildQuery({ + encode: ListImplementationsRequest.encode, + decode: ListImplementationsResponse.decode, + service: "cosmos.base.reflection.v1beta1.ReflectionService", + method: "ListImplementations", + deps: [ListImplementationsRequest, ListImplementationsResponse] +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/cosmos/base/reflection/v1beta1/reflection.ts b/__fixtures__/v-next/outputv2/cosmos/base/reflection/v1beta1/reflection.ts index 307e25a1ec..bc255871fa 100644 --- a/__fixtures__/v-next/outputv2/cosmos/base/reflection/v1beta1/reflection.ts +++ b/__fixtures__/v-next/outputv2/cosmos/base/reflection/v1beta1/reflection.ts @@ -166,6 +166,15 @@ function createBaseListAllInterfacesRequest(): ListAllInterfacesRequest { export const ListAllInterfacesRequest = { typeUrl: "/cosmos.base.reflection.v1beta1.ListAllInterfacesRequest", aminoType: "cosmos-sdk/ListAllInterfacesRequest", + is(o: any): o is ListAllInterfacesRequest { + return o && o.$typeUrl === ListAllInterfacesRequest.typeUrl; + }, + isSDK(o: any): o is ListAllInterfacesRequestSDKType { + return o && o.$typeUrl === ListAllInterfacesRequest.typeUrl; + }, + isAmino(o: any): o is ListAllInterfacesRequestAmino { + return o && o.$typeUrl === ListAllInterfacesRequest.typeUrl; + }, encode(_: ListAllInterfacesRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -230,7 +239,8 @@ export const ListAllInterfacesRequest = { typeUrl: "/cosmos.base.reflection.v1beta1.ListAllInterfacesRequest", value: ListAllInterfacesRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseListAllInterfacesResponse(): ListAllInterfacesResponse { return { @@ -246,6 +256,15 @@ function createBaseListAllInterfacesResponse(): ListAllInterfacesResponse { export const ListAllInterfacesResponse = { typeUrl: "/cosmos.base.reflection.v1beta1.ListAllInterfacesResponse", aminoType: "cosmos-sdk/ListAllInterfacesResponse", + is(o: any): o is ListAllInterfacesResponse { + return o && (o.$typeUrl === ListAllInterfacesResponse.typeUrl || Array.isArray(o.interfaceNames) && (!o.interfaceNames.length || typeof o.interfaceNames[0] === "string")); + }, + isSDK(o: any): o is ListAllInterfacesResponseSDKType { + return o && (o.$typeUrl === ListAllInterfacesResponse.typeUrl || Array.isArray(o.interface_names) && (!o.interface_names.length || typeof o.interface_names[0] === "string")); + }, + isAmino(o: any): o is ListAllInterfacesResponseAmino { + return o && (o.$typeUrl === ListAllInterfacesResponse.typeUrl || Array.isArray(o.interface_names) && (!o.interface_names.length || typeof o.interface_names[0] === "string")); + }, encode(message: ListAllInterfacesResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.interfaceNames) { writer.uint32(10).string(v!); @@ -336,7 +355,8 @@ export const ListAllInterfacesResponse = { typeUrl: "/cosmos.base.reflection.v1beta1.ListAllInterfacesResponse", value: ListAllInterfacesResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseListImplementationsRequest(): ListImplementationsRequest { return { @@ -353,6 +373,15 @@ function createBaseListImplementationsRequest(): ListImplementationsRequest { export const ListImplementationsRequest = { typeUrl: "/cosmos.base.reflection.v1beta1.ListImplementationsRequest", aminoType: "cosmos-sdk/ListImplementationsRequest", + is(o: any): o is ListImplementationsRequest { + return o && (o.$typeUrl === ListImplementationsRequest.typeUrl || typeof o.interfaceName === "string"); + }, + isSDK(o: any): o is ListImplementationsRequestSDKType { + return o && (o.$typeUrl === ListImplementationsRequest.typeUrl || typeof o.interface_name === "string"); + }, + isAmino(o: any): o is ListImplementationsRequestAmino { + return o && (o.$typeUrl === ListImplementationsRequest.typeUrl || typeof o.interface_name === "string"); + }, encode(message: ListImplementationsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.interfaceName !== "") { writer.uint32(10).string(message.interfaceName); @@ -433,7 +462,8 @@ export const ListImplementationsRequest = { typeUrl: "/cosmos.base.reflection.v1beta1.ListImplementationsRequest", value: ListImplementationsRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseListImplementationsResponse(): ListImplementationsResponse { return { @@ -450,6 +480,15 @@ function createBaseListImplementationsResponse(): ListImplementationsResponse { export const ListImplementationsResponse = { typeUrl: "/cosmos.base.reflection.v1beta1.ListImplementationsResponse", aminoType: "cosmos-sdk/ListImplementationsResponse", + is(o: any): o is ListImplementationsResponse { + return o && (o.$typeUrl === ListImplementationsResponse.typeUrl || Array.isArray(o.implementationMessageNames) && (!o.implementationMessageNames.length || typeof o.implementationMessageNames[0] === "string")); + }, + isSDK(o: any): o is ListImplementationsResponseSDKType { + return o && (o.$typeUrl === ListImplementationsResponse.typeUrl || Array.isArray(o.implementation_message_names) && (!o.implementation_message_names.length || typeof o.implementation_message_names[0] === "string")); + }, + isAmino(o: any): o is ListImplementationsResponseAmino { + return o && (o.$typeUrl === ListImplementationsResponse.typeUrl || Array.isArray(o.implementation_message_names) && (!o.implementation_message_names.length || typeof o.implementation_message_names[0] === "string")); + }, encode(message: ListImplementationsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.implementationMessageNames) { writer.uint32(10).string(v!); @@ -540,5 +579,6 @@ export const ListImplementationsResponse = { typeUrl: "/cosmos.base.reflection.v1beta1.ListImplementationsResponse", value: ListImplementationsResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/cosmos/base/reflection/v2alpha1/reflection.rpc.func.ts b/__fixtures__/v-next/outputv2/cosmos/base/reflection/v2alpha1/reflection.rpc.func.ts new file mode 100644 index 0000000000..b33de24c20 --- /dev/null +++ b/__fixtures__/v-next/outputv2/cosmos/base/reflection/v2alpha1/reflection.rpc.func.ts @@ -0,0 +1,82 @@ +import { buildQuery } from "../../../../helper-func-types"; +import { GetAuthnDescriptorRequest, GetAuthnDescriptorResponse, GetChainDescriptorRequest, GetChainDescriptorResponse, GetCodecDescriptorRequest, GetCodecDescriptorResponse, GetConfigurationDescriptorRequest, GetConfigurationDescriptorResponse, GetQueryServicesDescriptorRequest, GetQueryServicesDescriptorResponse, GetTxDescriptorRequest, GetTxDescriptorResponse } from "./reflection"; +/** + * GetAuthnDescriptor returns information on how to authenticate transactions in the application + * NOTE: this RPC is still experimental and might be subject to breaking changes or removal in + * future releases of the cosmos-sdk. + * @name getGetAuthnDescriptor + * @package cosmos.base.reflection.v2alpha1 + * @see proto service: cosmos.base.reflection.v2alpha1.GetAuthnDescriptor + */ +export const getGetAuthnDescriptor = buildQuery({ + encode: GetAuthnDescriptorRequest.encode, + decode: GetAuthnDescriptorResponse.decode, + service: "cosmos.base.reflection.v2alpha1.ReflectionService", + method: "GetAuthnDescriptor", + deps: [GetAuthnDescriptorRequest, GetAuthnDescriptorResponse] +}); +/** + * GetChainDescriptor returns the description of the chain + * @name getGetChainDescriptor + * @package cosmos.base.reflection.v2alpha1 + * @see proto service: cosmos.base.reflection.v2alpha1.GetChainDescriptor + */ +export const getGetChainDescriptor = buildQuery({ + encode: GetChainDescriptorRequest.encode, + decode: GetChainDescriptorResponse.decode, + service: "cosmos.base.reflection.v2alpha1.ReflectionService", + method: "GetChainDescriptor", + deps: [GetChainDescriptorRequest, GetChainDescriptorResponse] +}); +/** + * GetCodecDescriptor returns the descriptor of the codec of the application + * @name getGetCodecDescriptor + * @package cosmos.base.reflection.v2alpha1 + * @see proto service: cosmos.base.reflection.v2alpha1.GetCodecDescriptor + */ +export const getGetCodecDescriptor = buildQuery({ + encode: GetCodecDescriptorRequest.encode, + decode: GetCodecDescriptorResponse.decode, + service: "cosmos.base.reflection.v2alpha1.ReflectionService", + method: "GetCodecDescriptor", + deps: [GetCodecDescriptorRequest, GetCodecDescriptorResponse] +}); +/** + * GetConfigurationDescriptor returns the descriptor for the sdk.Config of the application + * @name getGetConfigurationDescriptor + * @package cosmos.base.reflection.v2alpha1 + * @see proto service: cosmos.base.reflection.v2alpha1.GetConfigurationDescriptor + */ +export const getGetConfigurationDescriptor = buildQuery({ + encode: GetConfigurationDescriptorRequest.encode, + decode: GetConfigurationDescriptorResponse.decode, + service: "cosmos.base.reflection.v2alpha1.ReflectionService", + method: "GetConfigurationDescriptor", + deps: [GetConfigurationDescriptorRequest, GetConfigurationDescriptorResponse] +}); +/** + * GetQueryServicesDescriptor returns the available gRPC queryable services of the application + * @name getGetQueryServicesDescriptor + * @package cosmos.base.reflection.v2alpha1 + * @see proto service: cosmos.base.reflection.v2alpha1.GetQueryServicesDescriptor + */ +export const getGetQueryServicesDescriptor = buildQuery({ + encode: GetQueryServicesDescriptorRequest.encode, + decode: GetQueryServicesDescriptorResponse.decode, + service: "cosmos.base.reflection.v2alpha1.ReflectionService", + method: "GetQueryServicesDescriptor", + deps: [GetQueryServicesDescriptorRequest, GetQueryServicesDescriptorResponse] +}); +/** + * GetTxDescriptor returns information on the used transaction object and available msgs that can be used + * @name getGetTxDescriptor + * @package cosmos.base.reflection.v2alpha1 + * @see proto service: cosmos.base.reflection.v2alpha1.GetTxDescriptor + */ +export const getGetTxDescriptor = buildQuery({ + encode: GetTxDescriptorRequest.encode, + decode: GetTxDescriptorResponse.decode, + service: "cosmos.base.reflection.v2alpha1.ReflectionService", + method: "GetTxDescriptor", + deps: [GetTxDescriptorRequest, GetTxDescriptorResponse] +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/cosmos/base/reflection/v2alpha1/reflection.ts b/__fixtures__/v-next/outputv2/cosmos/base/reflection/v2alpha1/reflection.ts index 14e356b6d4..f8da64ea78 100644 --- a/__fixtures__/v-next/outputv2/cosmos/base/reflection/v2alpha1/reflection.ts +++ b/__fixtures__/v-next/outputv2/cosmos/base/reflection/v2alpha1/reflection.ts @@ -1,4 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { GlobalDecoderRegistry } from "../../../../registry"; import { isSet, DeepPartial } from "../../../../helpers"; import { JsonSafe } from "../../../../json-safe"; export const protobufPackage = "cosmos.base.reflection.v2alpha1"; @@ -1195,6 +1196,15 @@ function createBaseAppDescriptor(): AppDescriptor { export const AppDescriptor = { typeUrl: "/cosmos.base.reflection.v2alpha1.AppDescriptor", aminoType: "cosmos-sdk/AppDescriptor", + is(o: any): o is AppDescriptor { + return o && o.$typeUrl === AppDescriptor.typeUrl; + }, + isSDK(o: any): o is AppDescriptorSDKType { + return o && o.$typeUrl === AppDescriptor.typeUrl; + }, + isAmino(o: any): o is AppDescriptorAmino { + return o && o.$typeUrl === AppDescriptor.typeUrl; + }, encode(message: AppDescriptor, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.authn !== undefined) { AuthnDescriptor.encode(message.authn, writer.uint32(10).fork()).ldelim(); @@ -1362,6 +1372,17 @@ export const AppDescriptor = { typeUrl: "/cosmos.base.reflection.v2alpha1.AppDescriptor", value: AppDescriptor.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(AppDescriptor.typeUrl)) { + return; + } + AuthnDescriptor.registerTypeUrl(); + ChainDescriptor.registerTypeUrl(); + CodecDescriptor.registerTypeUrl(); + ConfigurationDescriptor.registerTypeUrl(); + QueryServicesDescriptor.registerTypeUrl(); + TxDescriptor.registerTypeUrl(); } }; function createBaseTxDescriptor(): TxDescriptor { @@ -1379,6 +1400,15 @@ function createBaseTxDescriptor(): TxDescriptor { export const TxDescriptor = { typeUrl: "/cosmos.base.reflection.v2alpha1.TxDescriptor", aminoType: "cosmos-sdk/TxDescriptor", + is(o: any): o is TxDescriptor { + return o && (o.$typeUrl === TxDescriptor.typeUrl || typeof o.fullname === "string" && Array.isArray(o.msgs) && (!o.msgs.length || MsgDescriptor.is(o.msgs[0]))); + }, + isSDK(o: any): o is TxDescriptorSDKType { + return o && (o.$typeUrl === TxDescriptor.typeUrl || typeof o.fullname === "string" && Array.isArray(o.msgs) && (!o.msgs.length || MsgDescriptor.isSDK(o.msgs[0]))); + }, + isAmino(o: any): o is TxDescriptorAmino { + return o && (o.$typeUrl === TxDescriptor.typeUrl || typeof o.fullname === "string" && Array.isArray(o.msgs) && (!o.msgs.length || MsgDescriptor.isAmino(o.msgs[0]))); + }, encode(message: TxDescriptor, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.fullname !== "") { writer.uint32(10).string(message.fullname); @@ -1484,6 +1514,12 @@ export const TxDescriptor = { typeUrl: "/cosmos.base.reflection.v2alpha1.TxDescriptor", value: TxDescriptor.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(TxDescriptor.typeUrl)) { + return; + } + MsgDescriptor.registerTypeUrl(); } }; function createBaseAuthnDescriptor(): AuthnDescriptor { @@ -1501,6 +1537,15 @@ function createBaseAuthnDescriptor(): AuthnDescriptor { export const AuthnDescriptor = { typeUrl: "/cosmos.base.reflection.v2alpha1.AuthnDescriptor", aminoType: "cosmos-sdk/AuthnDescriptor", + is(o: any): o is AuthnDescriptor { + return o && (o.$typeUrl === AuthnDescriptor.typeUrl || Array.isArray(o.signModes) && (!o.signModes.length || SigningModeDescriptor.is(o.signModes[0]))); + }, + isSDK(o: any): o is AuthnDescriptorSDKType { + return o && (o.$typeUrl === AuthnDescriptor.typeUrl || Array.isArray(o.sign_modes) && (!o.sign_modes.length || SigningModeDescriptor.isSDK(o.sign_modes[0]))); + }, + isAmino(o: any): o is AuthnDescriptorAmino { + return o && (o.$typeUrl === AuthnDescriptor.typeUrl || Array.isArray(o.sign_modes) && (!o.sign_modes.length || SigningModeDescriptor.isAmino(o.sign_modes[0]))); + }, encode(message: AuthnDescriptor, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.signModes) { SigningModeDescriptor.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -1591,6 +1636,12 @@ export const AuthnDescriptor = { typeUrl: "/cosmos.base.reflection.v2alpha1.AuthnDescriptor", value: AuthnDescriptor.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(AuthnDescriptor.typeUrl)) { + return; + } + SigningModeDescriptor.registerTypeUrl(); } }; function createBaseSigningModeDescriptor(): SigningModeDescriptor { @@ -1612,6 +1663,15 @@ function createBaseSigningModeDescriptor(): SigningModeDescriptor { export const SigningModeDescriptor = { typeUrl: "/cosmos.base.reflection.v2alpha1.SigningModeDescriptor", aminoType: "cosmos-sdk/SigningModeDescriptor", + is(o: any): o is SigningModeDescriptor { + return o && (o.$typeUrl === SigningModeDescriptor.typeUrl || typeof o.name === "string" && typeof o.number === "number" && typeof o.authnInfoProviderMethodFullname === "string"); + }, + isSDK(o: any): o is SigningModeDescriptorSDKType { + return o && (o.$typeUrl === SigningModeDescriptor.typeUrl || typeof o.name === "string" && typeof o.number === "number" && typeof o.authn_info_provider_method_fullname === "string"); + }, + isAmino(o: any): o is SigningModeDescriptorAmino { + return o && (o.$typeUrl === SigningModeDescriptor.typeUrl || typeof o.name === "string" && typeof o.number === "number" && typeof o.authn_info_provider_method_fullname === "string"); + }, encode(message: SigningModeDescriptor, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -1722,7 +1782,8 @@ export const SigningModeDescriptor = { typeUrl: "/cosmos.base.reflection.v2alpha1.SigningModeDescriptor", value: SigningModeDescriptor.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseChainDescriptor(): ChainDescriptor { return { @@ -1738,6 +1799,15 @@ function createBaseChainDescriptor(): ChainDescriptor { export const ChainDescriptor = { typeUrl: "/cosmos.base.reflection.v2alpha1.ChainDescriptor", aminoType: "cosmos-sdk/ChainDescriptor", + is(o: any): o is ChainDescriptor { + return o && (o.$typeUrl === ChainDescriptor.typeUrl || typeof o.id === "string"); + }, + isSDK(o: any): o is ChainDescriptorSDKType { + return o && (o.$typeUrl === ChainDescriptor.typeUrl || typeof o.id === "string"); + }, + isAmino(o: any): o is ChainDescriptorAmino { + return o && (o.$typeUrl === ChainDescriptor.typeUrl || typeof o.id === "string"); + }, encode(message: ChainDescriptor, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.id !== "") { writer.uint32(10).string(message.id); @@ -1818,7 +1888,8 @@ export const ChainDescriptor = { typeUrl: "/cosmos.base.reflection.v2alpha1.ChainDescriptor", value: ChainDescriptor.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseCodecDescriptor(): CodecDescriptor { return { @@ -1834,6 +1905,15 @@ function createBaseCodecDescriptor(): CodecDescriptor { export const CodecDescriptor = { typeUrl: "/cosmos.base.reflection.v2alpha1.CodecDescriptor", aminoType: "cosmos-sdk/CodecDescriptor", + is(o: any): o is CodecDescriptor { + return o && (o.$typeUrl === CodecDescriptor.typeUrl || Array.isArray(o.interfaces) && (!o.interfaces.length || InterfaceDescriptor.is(o.interfaces[0]))); + }, + isSDK(o: any): o is CodecDescriptorSDKType { + return o && (o.$typeUrl === CodecDescriptor.typeUrl || Array.isArray(o.interfaces) && (!o.interfaces.length || InterfaceDescriptor.isSDK(o.interfaces[0]))); + }, + isAmino(o: any): o is CodecDescriptorAmino { + return o && (o.$typeUrl === CodecDescriptor.typeUrl || Array.isArray(o.interfaces) && (!o.interfaces.length || InterfaceDescriptor.isAmino(o.interfaces[0]))); + }, encode(message: CodecDescriptor, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.interfaces) { InterfaceDescriptor.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -1924,6 +2004,12 @@ export const CodecDescriptor = { typeUrl: "/cosmos.base.reflection.v2alpha1.CodecDescriptor", value: CodecDescriptor.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(CodecDescriptor.typeUrl)) { + return; + } + InterfaceDescriptor.registerTypeUrl(); } }; function createBaseInterfaceDescriptor(): InterfaceDescriptor { @@ -1942,6 +2028,15 @@ function createBaseInterfaceDescriptor(): InterfaceDescriptor { export const InterfaceDescriptor = { typeUrl: "/cosmos.base.reflection.v2alpha1.InterfaceDescriptor", aminoType: "cosmos-sdk/InterfaceDescriptor", + is(o: any): o is InterfaceDescriptor { + return o && (o.$typeUrl === InterfaceDescriptor.typeUrl || typeof o.fullname === "string" && Array.isArray(o.interfaceAcceptingMessages) && (!o.interfaceAcceptingMessages.length || InterfaceAcceptingMessageDescriptor.is(o.interfaceAcceptingMessages[0])) && Array.isArray(o.interfaceImplementers) && (!o.interfaceImplementers.length || InterfaceImplementerDescriptor.is(o.interfaceImplementers[0]))); + }, + isSDK(o: any): o is InterfaceDescriptorSDKType { + return o && (o.$typeUrl === InterfaceDescriptor.typeUrl || typeof o.fullname === "string" && Array.isArray(o.interface_accepting_messages) && (!o.interface_accepting_messages.length || InterfaceAcceptingMessageDescriptor.isSDK(o.interface_accepting_messages[0])) && Array.isArray(o.interface_implementers) && (!o.interface_implementers.length || InterfaceImplementerDescriptor.isSDK(o.interface_implementers[0]))); + }, + isAmino(o: any): o is InterfaceDescriptorAmino { + return o && (o.$typeUrl === InterfaceDescriptor.typeUrl || typeof o.fullname === "string" && Array.isArray(o.interface_accepting_messages) && (!o.interface_accepting_messages.length || InterfaceAcceptingMessageDescriptor.isAmino(o.interface_accepting_messages[0])) && Array.isArray(o.interface_implementers) && (!o.interface_implementers.length || InterfaceImplementerDescriptor.isAmino(o.interface_implementers[0]))); + }, encode(message: InterfaceDescriptor, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.fullname !== "") { writer.uint32(10).string(message.fullname); @@ -2072,6 +2167,13 @@ export const InterfaceDescriptor = { typeUrl: "/cosmos.base.reflection.v2alpha1.InterfaceDescriptor", value: InterfaceDescriptor.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(InterfaceDescriptor.typeUrl)) { + return; + } + InterfaceAcceptingMessageDescriptor.registerTypeUrl(); + InterfaceImplementerDescriptor.registerTypeUrl(); } }; function createBaseInterfaceImplementerDescriptor(): InterfaceImplementerDescriptor { @@ -2089,6 +2191,15 @@ function createBaseInterfaceImplementerDescriptor(): InterfaceImplementerDescrip export const InterfaceImplementerDescriptor = { typeUrl: "/cosmos.base.reflection.v2alpha1.InterfaceImplementerDescriptor", aminoType: "cosmos-sdk/InterfaceImplementerDescriptor", + is(o: any): o is InterfaceImplementerDescriptor { + return o && (o.$typeUrl === InterfaceImplementerDescriptor.typeUrl || typeof o.fullname === "string" && typeof o.typeUrl === "string"); + }, + isSDK(o: any): o is InterfaceImplementerDescriptorSDKType { + return o && (o.$typeUrl === InterfaceImplementerDescriptor.typeUrl || typeof o.fullname === "string" && typeof o.type_url === "string"); + }, + isAmino(o: any): o is InterfaceImplementerDescriptorAmino { + return o && (o.$typeUrl === InterfaceImplementerDescriptor.typeUrl || typeof o.fullname === "string" && typeof o.type_url === "string"); + }, encode(message: InterfaceImplementerDescriptor, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.fullname !== "") { writer.uint32(10).string(message.fullname); @@ -2184,7 +2295,8 @@ export const InterfaceImplementerDescriptor = { typeUrl: "/cosmos.base.reflection.v2alpha1.InterfaceImplementerDescriptor", value: InterfaceImplementerDescriptor.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseInterfaceAcceptingMessageDescriptor(): InterfaceAcceptingMessageDescriptor { return { @@ -2202,6 +2314,15 @@ function createBaseInterfaceAcceptingMessageDescriptor(): InterfaceAcceptingMess export const InterfaceAcceptingMessageDescriptor = { typeUrl: "/cosmos.base.reflection.v2alpha1.InterfaceAcceptingMessageDescriptor", aminoType: "cosmos-sdk/InterfaceAcceptingMessageDescriptor", + is(o: any): o is InterfaceAcceptingMessageDescriptor { + return o && (o.$typeUrl === InterfaceAcceptingMessageDescriptor.typeUrl || typeof o.fullname === "string" && Array.isArray(o.fieldDescriptorNames) && (!o.fieldDescriptorNames.length || typeof o.fieldDescriptorNames[0] === "string")); + }, + isSDK(o: any): o is InterfaceAcceptingMessageDescriptorSDKType { + return o && (o.$typeUrl === InterfaceAcceptingMessageDescriptor.typeUrl || typeof o.fullname === "string" && Array.isArray(o.field_descriptor_names) && (!o.field_descriptor_names.length || typeof o.field_descriptor_names[0] === "string")); + }, + isAmino(o: any): o is InterfaceAcceptingMessageDescriptorAmino { + return o && (o.$typeUrl === InterfaceAcceptingMessageDescriptor.typeUrl || typeof o.fullname === "string" && Array.isArray(o.field_descriptor_names) && (!o.field_descriptor_names.length || typeof o.field_descriptor_names[0] === "string")); + }, encode(message: InterfaceAcceptingMessageDescriptor, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.fullname !== "") { writer.uint32(10).string(message.fullname); @@ -2307,7 +2428,8 @@ export const InterfaceAcceptingMessageDescriptor = { typeUrl: "/cosmos.base.reflection.v2alpha1.InterfaceAcceptingMessageDescriptor", value: InterfaceAcceptingMessageDescriptor.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseConfigurationDescriptor(): ConfigurationDescriptor { return { @@ -2323,6 +2445,15 @@ function createBaseConfigurationDescriptor(): ConfigurationDescriptor { export const ConfigurationDescriptor = { typeUrl: "/cosmos.base.reflection.v2alpha1.ConfigurationDescriptor", aminoType: "cosmos-sdk/ConfigurationDescriptor", + is(o: any): o is ConfigurationDescriptor { + return o && (o.$typeUrl === ConfigurationDescriptor.typeUrl || typeof o.bech32AccountAddressPrefix === "string"); + }, + isSDK(o: any): o is ConfigurationDescriptorSDKType { + return o && (o.$typeUrl === ConfigurationDescriptor.typeUrl || typeof o.bech32_account_address_prefix === "string"); + }, + isAmino(o: any): o is ConfigurationDescriptorAmino { + return o && (o.$typeUrl === ConfigurationDescriptor.typeUrl || typeof o.bech32_account_address_prefix === "string"); + }, encode(message: ConfigurationDescriptor, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.bech32AccountAddressPrefix !== "") { writer.uint32(10).string(message.bech32AccountAddressPrefix); @@ -2403,7 +2534,8 @@ export const ConfigurationDescriptor = { typeUrl: "/cosmos.base.reflection.v2alpha1.ConfigurationDescriptor", value: ConfigurationDescriptor.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgDescriptor(): MsgDescriptor { return { @@ -2419,6 +2551,15 @@ function createBaseMsgDescriptor(): MsgDescriptor { export const MsgDescriptor = { typeUrl: "/cosmos.base.reflection.v2alpha1.MsgDescriptor", aminoType: "cosmos-sdk/MsgDescriptor", + is(o: any): o is MsgDescriptor { + return o && (o.$typeUrl === MsgDescriptor.typeUrl || typeof o.msgTypeUrl === "string"); + }, + isSDK(o: any): o is MsgDescriptorSDKType { + return o && (o.$typeUrl === MsgDescriptor.typeUrl || typeof o.msg_type_url === "string"); + }, + isAmino(o: any): o is MsgDescriptorAmino { + return o && (o.$typeUrl === MsgDescriptor.typeUrl || typeof o.msg_type_url === "string"); + }, encode(message: MsgDescriptor, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.msgTypeUrl !== "") { writer.uint32(10).string(message.msgTypeUrl); @@ -2499,7 +2640,8 @@ export const MsgDescriptor = { typeUrl: "/cosmos.base.reflection.v2alpha1.MsgDescriptor", value: MsgDescriptor.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseGetAuthnDescriptorRequest(): GetAuthnDescriptorRequest { return {}; @@ -2513,6 +2655,15 @@ function createBaseGetAuthnDescriptorRequest(): GetAuthnDescriptorRequest { export const GetAuthnDescriptorRequest = { typeUrl: "/cosmos.base.reflection.v2alpha1.GetAuthnDescriptorRequest", aminoType: "cosmos-sdk/GetAuthnDescriptorRequest", + is(o: any): o is GetAuthnDescriptorRequest { + return o && o.$typeUrl === GetAuthnDescriptorRequest.typeUrl; + }, + isSDK(o: any): o is GetAuthnDescriptorRequestSDKType { + return o && o.$typeUrl === GetAuthnDescriptorRequest.typeUrl; + }, + isAmino(o: any): o is GetAuthnDescriptorRequestAmino { + return o && o.$typeUrl === GetAuthnDescriptorRequest.typeUrl; + }, encode(_: GetAuthnDescriptorRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -2577,7 +2728,8 @@ export const GetAuthnDescriptorRequest = { typeUrl: "/cosmos.base.reflection.v2alpha1.GetAuthnDescriptorRequest", value: GetAuthnDescriptorRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseGetAuthnDescriptorResponse(): GetAuthnDescriptorResponse { return { @@ -2593,6 +2745,15 @@ function createBaseGetAuthnDescriptorResponse(): GetAuthnDescriptorResponse { export const GetAuthnDescriptorResponse = { typeUrl: "/cosmos.base.reflection.v2alpha1.GetAuthnDescriptorResponse", aminoType: "cosmos-sdk/GetAuthnDescriptorResponse", + is(o: any): o is GetAuthnDescriptorResponse { + return o && o.$typeUrl === GetAuthnDescriptorResponse.typeUrl; + }, + isSDK(o: any): o is GetAuthnDescriptorResponseSDKType { + return o && o.$typeUrl === GetAuthnDescriptorResponse.typeUrl; + }, + isAmino(o: any): o is GetAuthnDescriptorResponseAmino { + return o && o.$typeUrl === GetAuthnDescriptorResponse.typeUrl; + }, encode(message: GetAuthnDescriptorResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.authn !== undefined) { AuthnDescriptor.encode(message.authn, writer.uint32(10).fork()).ldelim(); @@ -2675,6 +2836,12 @@ export const GetAuthnDescriptorResponse = { typeUrl: "/cosmos.base.reflection.v2alpha1.GetAuthnDescriptorResponse", value: GetAuthnDescriptorResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GetAuthnDescriptorResponse.typeUrl)) { + return; + } + AuthnDescriptor.registerTypeUrl(); } }; function createBaseGetChainDescriptorRequest(): GetChainDescriptorRequest { @@ -2689,6 +2856,15 @@ function createBaseGetChainDescriptorRequest(): GetChainDescriptorRequest { export const GetChainDescriptorRequest = { typeUrl: "/cosmos.base.reflection.v2alpha1.GetChainDescriptorRequest", aminoType: "cosmos-sdk/GetChainDescriptorRequest", + is(o: any): o is GetChainDescriptorRequest { + return o && o.$typeUrl === GetChainDescriptorRequest.typeUrl; + }, + isSDK(o: any): o is GetChainDescriptorRequestSDKType { + return o && o.$typeUrl === GetChainDescriptorRequest.typeUrl; + }, + isAmino(o: any): o is GetChainDescriptorRequestAmino { + return o && o.$typeUrl === GetChainDescriptorRequest.typeUrl; + }, encode(_: GetChainDescriptorRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -2753,7 +2929,8 @@ export const GetChainDescriptorRequest = { typeUrl: "/cosmos.base.reflection.v2alpha1.GetChainDescriptorRequest", value: GetChainDescriptorRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseGetChainDescriptorResponse(): GetChainDescriptorResponse { return { @@ -2769,6 +2946,15 @@ function createBaseGetChainDescriptorResponse(): GetChainDescriptorResponse { export const GetChainDescriptorResponse = { typeUrl: "/cosmos.base.reflection.v2alpha1.GetChainDescriptorResponse", aminoType: "cosmos-sdk/GetChainDescriptorResponse", + is(o: any): o is GetChainDescriptorResponse { + return o && o.$typeUrl === GetChainDescriptorResponse.typeUrl; + }, + isSDK(o: any): o is GetChainDescriptorResponseSDKType { + return o && o.$typeUrl === GetChainDescriptorResponse.typeUrl; + }, + isAmino(o: any): o is GetChainDescriptorResponseAmino { + return o && o.$typeUrl === GetChainDescriptorResponse.typeUrl; + }, encode(message: GetChainDescriptorResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.chain !== undefined) { ChainDescriptor.encode(message.chain, writer.uint32(10).fork()).ldelim(); @@ -2851,6 +3037,12 @@ export const GetChainDescriptorResponse = { typeUrl: "/cosmos.base.reflection.v2alpha1.GetChainDescriptorResponse", value: GetChainDescriptorResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GetChainDescriptorResponse.typeUrl)) { + return; + } + ChainDescriptor.registerTypeUrl(); } }; function createBaseGetCodecDescriptorRequest(): GetCodecDescriptorRequest { @@ -2865,6 +3057,15 @@ function createBaseGetCodecDescriptorRequest(): GetCodecDescriptorRequest { export const GetCodecDescriptorRequest = { typeUrl: "/cosmos.base.reflection.v2alpha1.GetCodecDescriptorRequest", aminoType: "cosmos-sdk/GetCodecDescriptorRequest", + is(o: any): o is GetCodecDescriptorRequest { + return o && o.$typeUrl === GetCodecDescriptorRequest.typeUrl; + }, + isSDK(o: any): o is GetCodecDescriptorRequestSDKType { + return o && o.$typeUrl === GetCodecDescriptorRequest.typeUrl; + }, + isAmino(o: any): o is GetCodecDescriptorRequestAmino { + return o && o.$typeUrl === GetCodecDescriptorRequest.typeUrl; + }, encode(_: GetCodecDescriptorRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -2929,7 +3130,8 @@ export const GetCodecDescriptorRequest = { typeUrl: "/cosmos.base.reflection.v2alpha1.GetCodecDescriptorRequest", value: GetCodecDescriptorRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseGetCodecDescriptorResponse(): GetCodecDescriptorResponse { return { @@ -2945,6 +3147,15 @@ function createBaseGetCodecDescriptorResponse(): GetCodecDescriptorResponse { export const GetCodecDescriptorResponse = { typeUrl: "/cosmos.base.reflection.v2alpha1.GetCodecDescriptorResponse", aminoType: "cosmos-sdk/GetCodecDescriptorResponse", + is(o: any): o is GetCodecDescriptorResponse { + return o && o.$typeUrl === GetCodecDescriptorResponse.typeUrl; + }, + isSDK(o: any): o is GetCodecDescriptorResponseSDKType { + return o && o.$typeUrl === GetCodecDescriptorResponse.typeUrl; + }, + isAmino(o: any): o is GetCodecDescriptorResponseAmino { + return o && o.$typeUrl === GetCodecDescriptorResponse.typeUrl; + }, encode(message: GetCodecDescriptorResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.codec !== undefined) { CodecDescriptor.encode(message.codec, writer.uint32(10).fork()).ldelim(); @@ -3027,6 +3238,12 @@ export const GetCodecDescriptorResponse = { typeUrl: "/cosmos.base.reflection.v2alpha1.GetCodecDescriptorResponse", value: GetCodecDescriptorResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GetCodecDescriptorResponse.typeUrl)) { + return; + } + CodecDescriptor.registerTypeUrl(); } }; function createBaseGetConfigurationDescriptorRequest(): GetConfigurationDescriptorRequest { @@ -3041,6 +3258,15 @@ function createBaseGetConfigurationDescriptorRequest(): GetConfigurationDescript export const GetConfigurationDescriptorRequest = { typeUrl: "/cosmos.base.reflection.v2alpha1.GetConfigurationDescriptorRequest", aminoType: "cosmos-sdk/GetConfigurationDescriptorRequest", + is(o: any): o is GetConfigurationDescriptorRequest { + return o && o.$typeUrl === GetConfigurationDescriptorRequest.typeUrl; + }, + isSDK(o: any): o is GetConfigurationDescriptorRequestSDKType { + return o && o.$typeUrl === GetConfigurationDescriptorRequest.typeUrl; + }, + isAmino(o: any): o is GetConfigurationDescriptorRequestAmino { + return o && o.$typeUrl === GetConfigurationDescriptorRequest.typeUrl; + }, encode(_: GetConfigurationDescriptorRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -3105,7 +3331,8 @@ export const GetConfigurationDescriptorRequest = { typeUrl: "/cosmos.base.reflection.v2alpha1.GetConfigurationDescriptorRequest", value: GetConfigurationDescriptorRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseGetConfigurationDescriptorResponse(): GetConfigurationDescriptorResponse { return { @@ -3121,6 +3348,15 @@ function createBaseGetConfigurationDescriptorResponse(): GetConfigurationDescrip export const GetConfigurationDescriptorResponse = { typeUrl: "/cosmos.base.reflection.v2alpha1.GetConfigurationDescriptorResponse", aminoType: "cosmos-sdk/GetConfigurationDescriptorResponse", + is(o: any): o is GetConfigurationDescriptorResponse { + return o && o.$typeUrl === GetConfigurationDescriptorResponse.typeUrl; + }, + isSDK(o: any): o is GetConfigurationDescriptorResponseSDKType { + return o && o.$typeUrl === GetConfigurationDescriptorResponse.typeUrl; + }, + isAmino(o: any): o is GetConfigurationDescriptorResponseAmino { + return o && o.$typeUrl === GetConfigurationDescriptorResponse.typeUrl; + }, encode(message: GetConfigurationDescriptorResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.config !== undefined) { ConfigurationDescriptor.encode(message.config, writer.uint32(10).fork()).ldelim(); @@ -3203,6 +3439,12 @@ export const GetConfigurationDescriptorResponse = { typeUrl: "/cosmos.base.reflection.v2alpha1.GetConfigurationDescriptorResponse", value: GetConfigurationDescriptorResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GetConfigurationDescriptorResponse.typeUrl)) { + return; + } + ConfigurationDescriptor.registerTypeUrl(); } }; function createBaseGetQueryServicesDescriptorRequest(): GetQueryServicesDescriptorRequest { @@ -3217,6 +3459,15 @@ function createBaseGetQueryServicesDescriptorRequest(): GetQueryServicesDescript export const GetQueryServicesDescriptorRequest = { typeUrl: "/cosmos.base.reflection.v2alpha1.GetQueryServicesDescriptorRequest", aminoType: "cosmos-sdk/GetQueryServicesDescriptorRequest", + is(o: any): o is GetQueryServicesDescriptorRequest { + return o && o.$typeUrl === GetQueryServicesDescriptorRequest.typeUrl; + }, + isSDK(o: any): o is GetQueryServicesDescriptorRequestSDKType { + return o && o.$typeUrl === GetQueryServicesDescriptorRequest.typeUrl; + }, + isAmino(o: any): o is GetQueryServicesDescriptorRequestAmino { + return o && o.$typeUrl === GetQueryServicesDescriptorRequest.typeUrl; + }, encode(_: GetQueryServicesDescriptorRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -3281,7 +3532,8 @@ export const GetQueryServicesDescriptorRequest = { typeUrl: "/cosmos.base.reflection.v2alpha1.GetQueryServicesDescriptorRequest", value: GetQueryServicesDescriptorRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseGetQueryServicesDescriptorResponse(): GetQueryServicesDescriptorResponse { return { @@ -3297,6 +3549,15 @@ function createBaseGetQueryServicesDescriptorResponse(): GetQueryServicesDescrip export const GetQueryServicesDescriptorResponse = { typeUrl: "/cosmos.base.reflection.v2alpha1.GetQueryServicesDescriptorResponse", aminoType: "cosmos-sdk/GetQueryServicesDescriptorResponse", + is(o: any): o is GetQueryServicesDescriptorResponse { + return o && o.$typeUrl === GetQueryServicesDescriptorResponse.typeUrl; + }, + isSDK(o: any): o is GetQueryServicesDescriptorResponseSDKType { + return o && o.$typeUrl === GetQueryServicesDescriptorResponse.typeUrl; + }, + isAmino(o: any): o is GetQueryServicesDescriptorResponseAmino { + return o && o.$typeUrl === GetQueryServicesDescriptorResponse.typeUrl; + }, encode(message: GetQueryServicesDescriptorResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.queries !== undefined) { QueryServicesDescriptor.encode(message.queries, writer.uint32(10).fork()).ldelim(); @@ -3379,6 +3640,12 @@ export const GetQueryServicesDescriptorResponse = { typeUrl: "/cosmos.base.reflection.v2alpha1.GetQueryServicesDescriptorResponse", value: GetQueryServicesDescriptorResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GetQueryServicesDescriptorResponse.typeUrl)) { + return; + } + QueryServicesDescriptor.registerTypeUrl(); } }; function createBaseGetTxDescriptorRequest(): GetTxDescriptorRequest { @@ -3393,6 +3660,15 @@ function createBaseGetTxDescriptorRequest(): GetTxDescriptorRequest { export const GetTxDescriptorRequest = { typeUrl: "/cosmos.base.reflection.v2alpha1.GetTxDescriptorRequest", aminoType: "cosmos-sdk/GetTxDescriptorRequest", + is(o: any): o is GetTxDescriptorRequest { + return o && o.$typeUrl === GetTxDescriptorRequest.typeUrl; + }, + isSDK(o: any): o is GetTxDescriptorRequestSDKType { + return o && o.$typeUrl === GetTxDescriptorRequest.typeUrl; + }, + isAmino(o: any): o is GetTxDescriptorRequestAmino { + return o && o.$typeUrl === GetTxDescriptorRequest.typeUrl; + }, encode(_: GetTxDescriptorRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -3457,7 +3733,8 @@ export const GetTxDescriptorRequest = { typeUrl: "/cosmos.base.reflection.v2alpha1.GetTxDescriptorRequest", value: GetTxDescriptorRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseGetTxDescriptorResponse(): GetTxDescriptorResponse { return { @@ -3473,6 +3750,15 @@ function createBaseGetTxDescriptorResponse(): GetTxDescriptorResponse { export const GetTxDescriptorResponse = { typeUrl: "/cosmos.base.reflection.v2alpha1.GetTxDescriptorResponse", aminoType: "cosmos-sdk/GetTxDescriptorResponse", + is(o: any): o is GetTxDescriptorResponse { + return o && o.$typeUrl === GetTxDescriptorResponse.typeUrl; + }, + isSDK(o: any): o is GetTxDescriptorResponseSDKType { + return o && o.$typeUrl === GetTxDescriptorResponse.typeUrl; + }, + isAmino(o: any): o is GetTxDescriptorResponseAmino { + return o && o.$typeUrl === GetTxDescriptorResponse.typeUrl; + }, encode(message: GetTxDescriptorResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.tx !== undefined) { TxDescriptor.encode(message.tx, writer.uint32(10).fork()).ldelim(); @@ -3555,6 +3841,12 @@ export const GetTxDescriptorResponse = { typeUrl: "/cosmos.base.reflection.v2alpha1.GetTxDescriptorResponse", value: GetTxDescriptorResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GetTxDescriptorResponse.typeUrl)) { + return; + } + TxDescriptor.registerTypeUrl(); } }; function createBaseQueryServicesDescriptor(): QueryServicesDescriptor { @@ -3571,6 +3863,15 @@ function createBaseQueryServicesDescriptor(): QueryServicesDescriptor { export const QueryServicesDescriptor = { typeUrl: "/cosmos.base.reflection.v2alpha1.QueryServicesDescriptor", aminoType: "cosmos-sdk/QueryServicesDescriptor", + is(o: any): o is QueryServicesDescriptor { + return o && (o.$typeUrl === QueryServicesDescriptor.typeUrl || Array.isArray(o.queryServices) && (!o.queryServices.length || QueryServiceDescriptor.is(o.queryServices[0]))); + }, + isSDK(o: any): o is QueryServicesDescriptorSDKType { + return o && (o.$typeUrl === QueryServicesDescriptor.typeUrl || Array.isArray(o.query_services) && (!o.query_services.length || QueryServiceDescriptor.isSDK(o.query_services[0]))); + }, + isAmino(o: any): o is QueryServicesDescriptorAmino { + return o && (o.$typeUrl === QueryServicesDescriptor.typeUrl || Array.isArray(o.query_services) && (!o.query_services.length || QueryServiceDescriptor.isAmino(o.query_services[0]))); + }, encode(message: QueryServicesDescriptor, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.queryServices) { QueryServiceDescriptor.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -3661,6 +3962,12 @@ export const QueryServicesDescriptor = { typeUrl: "/cosmos.base.reflection.v2alpha1.QueryServicesDescriptor", value: QueryServicesDescriptor.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryServicesDescriptor.typeUrl)) { + return; + } + QueryServiceDescriptor.registerTypeUrl(); } }; function createBaseQueryServiceDescriptor(): QueryServiceDescriptor { @@ -3679,6 +3986,15 @@ function createBaseQueryServiceDescriptor(): QueryServiceDescriptor { export const QueryServiceDescriptor = { typeUrl: "/cosmos.base.reflection.v2alpha1.QueryServiceDescriptor", aminoType: "cosmos-sdk/QueryServiceDescriptor", + is(o: any): o is QueryServiceDescriptor { + return o && (o.$typeUrl === QueryServiceDescriptor.typeUrl || typeof o.fullname === "string" && typeof o.isModule === "boolean" && Array.isArray(o.methods) && (!o.methods.length || QueryMethodDescriptor.is(o.methods[0]))); + }, + isSDK(o: any): o is QueryServiceDescriptorSDKType { + return o && (o.$typeUrl === QueryServiceDescriptor.typeUrl || typeof o.fullname === "string" && typeof o.is_module === "boolean" && Array.isArray(o.methods) && (!o.methods.length || QueryMethodDescriptor.isSDK(o.methods[0]))); + }, + isAmino(o: any): o is QueryServiceDescriptorAmino { + return o && (o.$typeUrl === QueryServiceDescriptor.typeUrl || typeof o.fullname === "string" && typeof o.is_module === "boolean" && Array.isArray(o.methods) && (!o.methods.length || QueryMethodDescriptor.isAmino(o.methods[0]))); + }, encode(message: QueryServiceDescriptor, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.fullname !== "") { writer.uint32(10).string(message.fullname); @@ -3799,6 +4115,12 @@ export const QueryServiceDescriptor = { typeUrl: "/cosmos.base.reflection.v2alpha1.QueryServiceDescriptor", value: QueryServiceDescriptor.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryServiceDescriptor.typeUrl)) { + return; + } + QueryMethodDescriptor.registerTypeUrl(); } }; function createBaseQueryMethodDescriptor(): QueryMethodDescriptor { @@ -3818,6 +4140,15 @@ function createBaseQueryMethodDescriptor(): QueryMethodDescriptor { export const QueryMethodDescriptor = { typeUrl: "/cosmos.base.reflection.v2alpha1.QueryMethodDescriptor", aminoType: "cosmos-sdk/QueryMethodDescriptor", + is(o: any): o is QueryMethodDescriptor { + return o && (o.$typeUrl === QueryMethodDescriptor.typeUrl || typeof o.name === "string" && typeof o.fullQueryPath === "string"); + }, + isSDK(o: any): o is QueryMethodDescriptorSDKType { + return o && (o.$typeUrl === QueryMethodDescriptor.typeUrl || typeof o.name === "string" && typeof o.full_query_path === "string"); + }, + isAmino(o: any): o is QueryMethodDescriptorAmino { + return o && (o.$typeUrl === QueryMethodDescriptor.typeUrl || typeof o.name === "string" && typeof o.full_query_path === "string"); + }, encode(message: QueryMethodDescriptor, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -3913,5 +4244,6 @@ export const QueryMethodDescriptor = { typeUrl: "/cosmos.base.reflection.v2alpha1.QueryMethodDescriptor", value: QueryMethodDescriptor.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/cosmos/base/snapshots/v1beta1/snapshot.ts b/__fixtures__/v-next/outputv2/cosmos/base/snapshots/v1beta1/snapshot.ts index f992948eca..02b30084da 100644 --- a/__fixtures__/v-next/outputv2/cosmos/base/snapshots/v1beta1/snapshot.ts +++ b/__fixtures__/v-next/outputv2/cosmos/base/snapshots/v1beta1/snapshot.ts @@ -1,4 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { GlobalDecoderRegistry } from "../../../../registry"; import { isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../../../../helpers"; import { JsonSafe } from "../../../../json-safe"; export const protobufPackage = "cosmos.base.snapshots.v1beta1"; @@ -395,6 +396,15 @@ function createBaseSnapshot(): Snapshot { export const Snapshot = { typeUrl: "/cosmos.base.snapshots.v1beta1.Snapshot", aminoType: "cosmos-sdk/Snapshot", + is(o: any): o is Snapshot { + return o && (o.$typeUrl === Snapshot.typeUrl || typeof o.height === "bigint" && typeof o.format === "number" && typeof o.chunks === "number" && (o.hash instanceof Uint8Array || typeof o.hash === "string") && Metadata.is(o.metadata)); + }, + isSDK(o: any): o is SnapshotSDKType { + return o && (o.$typeUrl === Snapshot.typeUrl || typeof o.height === "bigint" && typeof o.format === "number" && typeof o.chunks === "number" && (o.hash instanceof Uint8Array || typeof o.hash === "string") && Metadata.isSDK(o.metadata)); + }, + isAmino(o: any): o is SnapshotAmino { + return o && (o.$typeUrl === Snapshot.typeUrl || typeof o.height === "bigint" && typeof o.format === "number" && typeof o.chunks === "number" && (o.hash instanceof Uint8Array || typeof o.hash === "string") && Metadata.isAmino(o.metadata)); + }, encode(message: Snapshot, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.height !== BigInt(0)) { writer.uint32(8).uint64(message.height); @@ -539,6 +549,12 @@ export const Snapshot = { typeUrl: "/cosmos.base.snapshots.v1beta1.Snapshot", value: Snapshot.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Snapshot.typeUrl)) { + return; + } + Metadata.registerTypeUrl(); } }; function createBaseMetadata(): Metadata { @@ -555,6 +571,15 @@ function createBaseMetadata(): Metadata { export const Metadata = { typeUrl: "/cosmos.base.snapshots.v1beta1.Metadata", aminoType: "cosmos-sdk/Metadata", + is(o: any): o is Metadata { + return o && (o.$typeUrl === Metadata.typeUrl || Array.isArray(o.chunkHashes) && (!o.chunkHashes.length || o.chunkHashes[0] instanceof Uint8Array || typeof o.chunkHashes[0] === "string")); + }, + isSDK(o: any): o is MetadataSDKType { + return o && (o.$typeUrl === Metadata.typeUrl || Array.isArray(o.chunk_hashes) && (!o.chunk_hashes.length || o.chunk_hashes[0] instanceof Uint8Array || typeof o.chunk_hashes[0] === "string")); + }, + isAmino(o: any): o is MetadataAmino { + return o && (o.$typeUrl === Metadata.typeUrl || Array.isArray(o.chunk_hashes) && (!o.chunk_hashes.length || o.chunk_hashes[0] instanceof Uint8Array || typeof o.chunk_hashes[0] === "string")); + }, encode(message: Metadata, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.chunkHashes) { writer.uint32(10).bytes(v!); @@ -645,7 +670,8 @@ export const Metadata = { typeUrl: "/cosmos.base.snapshots.v1beta1.Metadata", value: Metadata.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseSnapshotItem(): SnapshotItem { return { @@ -666,6 +692,15 @@ function createBaseSnapshotItem(): SnapshotItem { export const SnapshotItem = { typeUrl: "/cosmos.base.snapshots.v1beta1.SnapshotItem", aminoType: "cosmos-sdk/SnapshotItem", + is(o: any): o is SnapshotItem { + return o && o.$typeUrl === SnapshotItem.typeUrl; + }, + isSDK(o: any): o is SnapshotItemSDKType { + return o && o.$typeUrl === SnapshotItem.typeUrl; + }, + isAmino(o: any): o is SnapshotItemAmino { + return o && o.$typeUrl === SnapshotItem.typeUrl; + }, encode(message: SnapshotItem, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.store !== undefined) { SnapshotStoreItem.encode(message.store, writer.uint32(10).fork()).ldelim(); @@ -833,6 +868,17 @@ export const SnapshotItem = { typeUrl: "/cosmos.base.snapshots.v1beta1.SnapshotItem", value: SnapshotItem.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(SnapshotItem.typeUrl)) { + return; + } + SnapshotStoreItem.registerTypeUrl(); + SnapshotIAVLItem.registerTypeUrl(); + SnapshotExtensionMeta.registerTypeUrl(); + SnapshotExtensionPayload.registerTypeUrl(); + SnapshotKVItem.registerTypeUrl(); + SnapshotSchema.registerTypeUrl(); } }; function createBaseSnapshotStoreItem(): SnapshotStoreItem { @@ -849,6 +895,15 @@ function createBaseSnapshotStoreItem(): SnapshotStoreItem { export const SnapshotStoreItem = { typeUrl: "/cosmos.base.snapshots.v1beta1.SnapshotStoreItem", aminoType: "cosmos-sdk/SnapshotStoreItem", + is(o: any): o is SnapshotStoreItem { + return o && (o.$typeUrl === SnapshotStoreItem.typeUrl || typeof o.name === "string"); + }, + isSDK(o: any): o is SnapshotStoreItemSDKType { + return o && (o.$typeUrl === SnapshotStoreItem.typeUrl || typeof o.name === "string"); + }, + isAmino(o: any): o is SnapshotStoreItemAmino { + return o && (o.$typeUrl === SnapshotStoreItem.typeUrl || typeof o.name === "string"); + }, encode(message: SnapshotStoreItem, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -929,7 +984,8 @@ export const SnapshotStoreItem = { typeUrl: "/cosmos.base.snapshots.v1beta1.SnapshotStoreItem", value: SnapshotStoreItem.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseSnapshotIAVLItem(): SnapshotIAVLItem { return { @@ -948,6 +1004,15 @@ function createBaseSnapshotIAVLItem(): SnapshotIAVLItem { export const SnapshotIAVLItem = { typeUrl: "/cosmos.base.snapshots.v1beta1.SnapshotIAVLItem", aminoType: "cosmos-sdk/SnapshotIAVLItem", + is(o: any): o is SnapshotIAVLItem { + return o && (o.$typeUrl === SnapshotIAVLItem.typeUrl || (o.key instanceof Uint8Array || typeof o.key === "string") && (o.value instanceof Uint8Array || typeof o.value === "string") && typeof o.version === "bigint" && typeof o.height === "number"); + }, + isSDK(o: any): o is SnapshotIAVLItemSDKType { + return o && (o.$typeUrl === SnapshotIAVLItem.typeUrl || (o.key instanceof Uint8Array || typeof o.key === "string") && (o.value instanceof Uint8Array || typeof o.value === "string") && typeof o.version === "bigint" && typeof o.height === "number"); + }, + isAmino(o: any): o is SnapshotIAVLItemAmino { + return o && (o.$typeUrl === SnapshotIAVLItem.typeUrl || (o.key instanceof Uint8Array || typeof o.key === "string") && (o.value instanceof Uint8Array || typeof o.value === "string") && typeof o.version === "bigint" && typeof o.height === "number"); + }, encode(message: SnapshotIAVLItem, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.key.length !== 0) { writer.uint32(10).bytes(message.key); @@ -1075,7 +1140,8 @@ export const SnapshotIAVLItem = { typeUrl: "/cosmos.base.snapshots.v1beta1.SnapshotIAVLItem", value: SnapshotIAVLItem.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseSnapshotExtensionMeta(): SnapshotExtensionMeta { return { @@ -1092,6 +1158,15 @@ function createBaseSnapshotExtensionMeta(): SnapshotExtensionMeta { export const SnapshotExtensionMeta = { typeUrl: "/cosmos.base.snapshots.v1beta1.SnapshotExtensionMeta", aminoType: "cosmos-sdk/SnapshotExtensionMeta", + is(o: any): o is SnapshotExtensionMeta { + return o && (o.$typeUrl === SnapshotExtensionMeta.typeUrl || typeof o.name === "string" && typeof o.format === "number"); + }, + isSDK(o: any): o is SnapshotExtensionMetaSDKType { + return o && (o.$typeUrl === SnapshotExtensionMeta.typeUrl || typeof o.name === "string" && typeof o.format === "number"); + }, + isAmino(o: any): o is SnapshotExtensionMetaAmino { + return o && (o.$typeUrl === SnapshotExtensionMeta.typeUrl || typeof o.name === "string" && typeof o.format === "number"); + }, encode(message: SnapshotExtensionMeta, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -1187,7 +1262,8 @@ export const SnapshotExtensionMeta = { typeUrl: "/cosmos.base.snapshots.v1beta1.SnapshotExtensionMeta", value: SnapshotExtensionMeta.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseSnapshotExtensionPayload(): SnapshotExtensionPayload { return { @@ -1203,6 +1279,15 @@ function createBaseSnapshotExtensionPayload(): SnapshotExtensionPayload { export const SnapshotExtensionPayload = { typeUrl: "/cosmos.base.snapshots.v1beta1.SnapshotExtensionPayload", aminoType: "cosmos-sdk/SnapshotExtensionPayload", + is(o: any): o is SnapshotExtensionPayload { + return o && (o.$typeUrl === SnapshotExtensionPayload.typeUrl || o.payload instanceof Uint8Array || typeof o.payload === "string"); + }, + isSDK(o: any): o is SnapshotExtensionPayloadSDKType { + return o && (o.$typeUrl === SnapshotExtensionPayload.typeUrl || o.payload instanceof Uint8Array || typeof o.payload === "string"); + }, + isAmino(o: any): o is SnapshotExtensionPayloadAmino { + return o && (o.$typeUrl === SnapshotExtensionPayload.typeUrl || o.payload instanceof Uint8Array || typeof o.payload === "string"); + }, encode(message: SnapshotExtensionPayload, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.payload.length !== 0) { writer.uint32(10).bytes(message.payload); @@ -1283,7 +1368,8 @@ export const SnapshotExtensionPayload = { typeUrl: "/cosmos.base.snapshots.v1beta1.SnapshotExtensionPayload", value: SnapshotExtensionPayload.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseSnapshotKVItem(): SnapshotKVItem { return { @@ -1300,6 +1386,15 @@ function createBaseSnapshotKVItem(): SnapshotKVItem { export const SnapshotKVItem = { typeUrl: "/cosmos.base.snapshots.v1beta1.SnapshotKVItem", aminoType: "cosmos-sdk/SnapshotKVItem", + is(o: any): o is SnapshotKVItem { + return o && (o.$typeUrl === SnapshotKVItem.typeUrl || (o.key instanceof Uint8Array || typeof o.key === "string") && (o.value instanceof Uint8Array || typeof o.value === "string")); + }, + isSDK(o: any): o is SnapshotKVItemSDKType { + return o && (o.$typeUrl === SnapshotKVItem.typeUrl || (o.key instanceof Uint8Array || typeof o.key === "string") && (o.value instanceof Uint8Array || typeof o.value === "string")); + }, + isAmino(o: any): o is SnapshotKVItemAmino { + return o && (o.$typeUrl === SnapshotKVItem.typeUrl || (o.key instanceof Uint8Array || typeof o.key === "string") && (o.value instanceof Uint8Array || typeof o.value === "string")); + }, encode(message: SnapshotKVItem, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.key.length !== 0) { writer.uint32(10).bytes(message.key); @@ -1395,7 +1490,8 @@ export const SnapshotKVItem = { typeUrl: "/cosmos.base.snapshots.v1beta1.SnapshotKVItem", value: SnapshotKVItem.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseSnapshotSchema(): SnapshotSchema { return { @@ -1411,6 +1507,15 @@ function createBaseSnapshotSchema(): SnapshotSchema { export const SnapshotSchema = { typeUrl: "/cosmos.base.snapshots.v1beta1.SnapshotSchema", aminoType: "cosmos-sdk/SnapshotSchema", + is(o: any): o is SnapshotSchema { + return o && (o.$typeUrl === SnapshotSchema.typeUrl || Array.isArray(o.keys) && (!o.keys.length || o.keys[0] instanceof Uint8Array || typeof o.keys[0] === "string")); + }, + isSDK(o: any): o is SnapshotSchemaSDKType { + return o && (o.$typeUrl === SnapshotSchema.typeUrl || Array.isArray(o.keys) && (!o.keys.length || o.keys[0] instanceof Uint8Array || typeof o.keys[0] === "string")); + }, + isAmino(o: any): o is SnapshotSchemaAmino { + return o && (o.$typeUrl === SnapshotSchema.typeUrl || Array.isArray(o.keys) && (!o.keys.length || o.keys[0] instanceof Uint8Array || typeof o.keys[0] === "string")); + }, encode(message: SnapshotSchema, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.keys) { writer.uint32(10).bytes(v!); @@ -1501,5 +1606,6 @@ export const SnapshotSchema = { typeUrl: "/cosmos.base.snapshots.v1beta1.SnapshotSchema", value: SnapshotSchema.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/cosmos/base/store/v1beta1/commit_info.ts b/__fixtures__/v-next/outputv2/cosmos/base/store/v1beta1/commit_info.ts index 94f473be6e..713a9afc8d 100644 --- a/__fixtures__/v-next/outputv2/cosmos/base/store/v1beta1/commit_info.ts +++ b/__fixtures__/v-next/outputv2/cosmos/base/store/v1beta1/commit_info.ts @@ -1,6 +1,7 @@ import { BinaryReader, BinaryWriter } from "../../../../binary"; import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../../helpers"; import { JsonSafe } from "../../../../json-safe"; +import { GlobalDecoderRegistry } from "../../../../registry"; export const protobufPackage = "cosmos.base.store.v1beta1"; /** * CommitInfo defines commit information used by the multi-store when committing @@ -141,6 +142,15 @@ function createBaseCommitInfo(): CommitInfo { export const CommitInfo = { typeUrl: "/cosmos.base.store.v1beta1.CommitInfo", aminoType: "cosmos-sdk/CommitInfo", + is(o: any): o is CommitInfo { + return o && (o.$typeUrl === CommitInfo.typeUrl || typeof o.version === "bigint" && Array.isArray(o.storeInfos) && (!o.storeInfos.length || StoreInfo.is(o.storeInfos[0]))); + }, + isSDK(o: any): o is CommitInfoSDKType { + return o && (o.$typeUrl === CommitInfo.typeUrl || typeof o.version === "bigint" && Array.isArray(o.store_infos) && (!o.store_infos.length || StoreInfo.isSDK(o.store_infos[0]))); + }, + isAmino(o: any): o is CommitInfoAmino { + return o && (o.$typeUrl === CommitInfo.typeUrl || typeof o.version === "bigint" && Array.isArray(o.store_infos) && (!o.store_infos.length || StoreInfo.isAmino(o.store_infos[0]))); + }, encode(message: CommitInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.version !== BigInt(0)) { writer.uint32(8).int64(message.version); @@ -248,6 +258,12 @@ export const CommitInfo = { typeUrl: "/cosmos.base.store.v1beta1.CommitInfo", value: CommitInfo.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(CommitInfo.typeUrl)) { + return; + } + StoreInfo.registerTypeUrl(); } }; function createBaseStoreInfo(): StoreInfo { @@ -266,6 +282,15 @@ function createBaseStoreInfo(): StoreInfo { export const StoreInfo = { typeUrl: "/cosmos.base.store.v1beta1.StoreInfo", aminoType: "cosmos-sdk/StoreInfo", + is(o: any): o is StoreInfo { + return o && (o.$typeUrl === StoreInfo.typeUrl || typeof o.name === "string" && CommitID.is(o.commitId)); + }, + isSDK(o: any): o is StoreInfoSDKType { + return o && (o.$typeUrl === StoreInfo.typeUrl || typeof o.name === "string" && CommitID.isSDK(o.commit_id)); + }, + isAmino(o: any): o is StoreInfoAmino { + return o && (o.$typeUrl === StoreInfo.typeUrl || typeof o.name === "string" && CommitID.isAmino(o.commit_id)); + }, encode(message: StoreInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -363,6 +388,12 @@ export const StoreInfo = { typeUrl: "/cosmos.base.store.v1beta1.StoreInfo", value: StoreInfo.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(StoreInfo.typeUrl)) { + return; + } + CommitID.registerTypeUrl(); } }; function createBaseCommitID(): CommitID { @@ -381,6 +412,15 @@ function createBaseCommitID(): CommitID { export const CommitID = { typeUrl: "/cosmos.base.store.v1beta1.CommitID", aminoType: "cosmos-sdk/CommitID", + is(o: any): o is CommitID { + return o && (o.$typeUrl === CommitID.typeUrl || typeof o.version === "bigint" && (o.hash instanceof Uint8Array || typeof o.hash === "string")); + }, + isSDK(o: any): o is CommitIDSDKType { + return o && (o.$typeUrl === CommitID.typeUrl || typeof o.version === "bigint" && (o.hash instanceof Uint8Array || typeof o.hash === "string")); + }, + isAmino(o: any): o is CommitIDAmino { + return o && (o.$typeUrl === CommitID.typeUrl || typeof o.version === "bigint" && (o.hash instanceof Uint8Array || typeof o.hash === "string")); + }, encode(message: CommitID, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.version !== BigInt(0)) { writer.uint32(8).int64(message.version); @@ -478,5 +518,6 @@ export const CommitID = { typeUrl: "/cosmos.base.store.v1beta1.CommitID", value: CommitID.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/cosmos/base/store/v1beta1/listening.ts b/__fixtures__/v-next/outputv2/cosmos/base/store/v1beta1/listening.ts index e1165a1800..63793303ce 100644 --- a/__fixtures__/v-next/outputv2/cosmos/base/store/v1beta1/listening.ts +++ b/__fixtures__/v-next/outputv2/cosmos/base/store/v1beta1/listening.ts @@ -91,6 +91,15 @@ function createBaseStoreKVPair(): StoreKVPair { export const StoreKVPair = { typeUrl: "/cosmos.base.store.v1beta1.StoreKVPair", aminoType: "cosmos-sdk/StoreKVPair", + is(o: any): o is StoreKVPair { + return o && (o.$typeUrl === StoreKVPair.typeUrl || typeof o.storeKey === "string" && typeof o.delete === "boolean" && (o.key instanceof Uint8Array || typeof o.key === "string") && (o.value instanceof Uint8Array || typeof o.value === "string")); + }, + isSDK(o: any): o is StoreKVPairSDKType { + return o && (o.$typeUrl === StoreKVPair.typeUrl || typeof o.store_key === "string" && typeof o.delete === "boolean" && (o.key instanceof Uint8Array || typeof o.key === "string") && (o.value instanceof Uint8Array || typeof o.value === "string")); + }, + isAmino(o: any): o is StoreKVPairAmino { + return o && (o.$typeUrl === StoreKVPair.typeUrl || typeof o.store_key === "string" && typeof o.delete === "boolean" && (o.key instanceof Uint8Array || typeof o.key === "string") && (o.value instanceof Uint8Array || typeof o.value === "string")); + }, encode(message: StoreKVPair, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.storeKey !== "") { writer.uint32(10).string(message.storeKey); @@ -216,5 +225,6 @@ export const StoreKVPair = { typeUrl: "/cosmos.base.store.v1beta1.StoreKVPair", value: StoreKVPair.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/cosmos/base/tendermint/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputv2/cosmos/base/tendermint/v1beta1/query.rpc.func.ts new file mode 100644 index 0000000000..b621a8ce4d --- /dev/null +++ b/__fixtures__/v-next/outputv2/cosmos/base/tendermint/v1beta1/query.rpc.func.ts @@ -0,0 +1,80 @@ +import { buildQuery } from "../../../../helper-func-types"; +import { GetNodeInfoRequest, GetNodeInfoResponse, GetSyncingRequest, GetSyncingResponse, GetLatestBlockRequest, GetLatestBlockResponse, GetBlockByHeightRequest, GetBlockByHeightResponse, GetLatestValidatorSetRequest, GetLatestValidatorSetResponse, GetValidatorSetByHeightRequest, GetValidatorSetByHeightResponse } from "./query"; +/** + * GetNodeInfo queries the current node info. + * @name getGetNodeInfo + * @package cosmos.base.tendermint.v1beta1 + * @see proto service: cosmos.base.tendermint.v1beta1.GetNodeInfo + */ +export const getGetNodeInfo = buildQuery({ + encode: GetNodeInfoRequest.encode, + decode: GetNodeInfoResponse.decode, + service: "cosmos.base.tendermint.v1beta1.Service", + method: "GetNodeInfo", + deps: [GetNodeInfoRequest, GetNodeInfoResponse] +}); +/** + * GetSyncing queries node syncing. + * @name getGetSyncing + * @package cosmos.base.tendermint.v1beta1 + * @see proto service: cosmos.base.tendermint.v1beta1.GetSyncing + */ +export const getGetSyncing = buildQuery({ + encode: GetSyncingRequest.encode, + decode: GetSyncingResponse.decode, + service: "cosmos.base.tendermint.v1beta1.Service", + method: "GetSyncing", + deps: [GetSyncingRequest, GetSyncingResponse] +}); +/** + * GetLatestBlock returns the latest block. + * @name getGetLatestBlock + * @package cosmos.base.tendermint.v1beta1 + * @see proto service: cosmos.base.tendermint.v1beta1.GetLatestBlock + */ +export const getGetLatestBlock = buildQuery({ + encode: GetLatestBlockRequest.encode, + decode: GetLatestBlockResponse.decode, + service: "cosmos.base.tendermint.v1beta1.Service", + method: "GetLatestBlock", + deps: [GetLatestBlockRequest, GetLatestBlockResponse] +}); +/** + * GetBlockByHeight queries block for given height. + * @name getGetBlockByHeight + * @package cosmos.base.tendermint.v1beta1 + * @see proto service: cosmos.base.tendermint.v1beta1.GetBlockByHeight + */ +export const getGetBlockByHeight = buildQuery({ + encode: GetBlockByHeightRequest.encode, + decode: GetBlockByHeightResponse.decode, + service: "cosmos.base.tendermint.v1beta1.Service", + method: "GetBlockByHeight", + deps: [GetBlockByHeightRequest, GetBlockByHeightResponse] +}); +/** + * GetLatestValidatorSet queries latest validator-set. + * @name getGetLatestValidatorSet + * @package cosmos.base.tendermint.v1beta1 + * @see proto service: cosmos.base.tendermint.v1beta1.GetLatestValidatorSet + */ +export const getGetLatestValidatorSet = buildQuery({ + encode: GetLatestValidatorSetRequest.encode, + decode: GetLatestValidatorSetResponse.decode, + service: "cosmos.base.tendermint.v1beta1.Service", + method: "GetLatestValidatorSet", + deps: [GetLatestValidatorSetRequest, GetLatestValidatorSetResponse] +}); +/** + * GetValidatorSetByHeight queries validator-set at a given height. + * @name getGetValidatorSetByHeight + * @package cosmos.base.tendermint.v1beta1 + * @see proto service: cosmos.base.tendermint.v1beta1.GetValidatorSetByHeight + */ +export const getGetValidatorSetByHeight = buildQuery({ + encode: GetValidatorSetByHeightRequest.encode, + decode: GetValidatorSetByHeightResponse.decode, + service: "cosmos.base.tendermint.v1beta1.Service", + method: "GetValidatorSetByHeight", + deps: [GetValidatorSetByHeightRequest, GetValidatorSetByHeightResponse] +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/cosmos/base/tendermint/v1beta1/query.ts b/__fixtures__/v-next/outputv2/cosmos/base/tendermint/v1beta1/query.ts index e131390ea3..02013fe4f8 100644 --- a/__fixtures__/v-next/outputv2/cosmos/base/tendermint/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv2/cosmos/base/tendermint/v1beta1/query.ts @@ -4,6 +4,7 @@ import { BlockID, BlockIDAmino, BlockIDSDKType } from "../../../../tendermint/ty import { Block, BlockAmino, BlockSDKType } from "../../../../tendermint/types/block"; import { NodeInfo, NodeInfoAmino, NodeInfoSDKType } from "../../../../tendermint/p2p/types"; import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { GlobalDecoderRegistry } from "../../../../registry"; import { isSet, DeepPartial } from "../../../../helpers"; import { JsonSafe } from "../../../../json-safe"; export const protobufPackage = "cosmos.base.tendermint.v1beta1"; @@ -637,6 +638,15 @@ function createBaseGetValidatorSetByHeightRequest(): GetValidatorSetByHeightRequ export const GetValidatorSetByHeightRequest = { typeUrl: "/cosmos.base.tendermint.v1beta1.GetValidatorSetByHeightRequest", aminoType: "cosmos-sdk/GetValidatorSetByHeightRequest", + is(o: any): o is GetValidatorSetByHeightRequest { + return o && (o.$typeUrl === GetValidatorSetByHeightRequest.typeUrl || typeof o.height === "bigint"); + }, + isSDK(o: any): o is GetValidatorSetByHeightRequestSDKType { + return o && (o.$typeUrl === GetValidatorSetByHeightRequest.typeUrl || typeof o.height === "bigint"); + }, + isAmino(o: any): o is GetValidatorSetByHeightRequestAmino { + return o && (o.$typeUrl === GetValidatorSetByHeightRequest.typeUrl || typeof o.height === "bigint"); + }, encode(message: GetValidatorSetByHeightRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.height !== BigInt(0)) { writer.uint32(8).int64(message.height); @@ -736,6 +746,12 @@ export const GetValidatorSetByHeightRequest = { typeUrl: "/cosmos.base.tendermint.v1beta1.GetValidatorSetByHeightRequest", value: GetValidatorSetByHeightRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GetValidatorSetByHeightRequest.typeUrl)) { + return; + } + PageRequest.registerTypeUrl(); } }; function createBaseGetValidatorSetByHeightResponse(): GetValidatorSetByHeightResponse { @@ -754,6 +770,15 @@ function createBaseGetValidatorSetByHeightResponse(): GetValidatorSetByHeightRes export const GetValidatorSetByHeightResponse = { typeUrl: "/cosmos.base.tendermint.v1beta1.GetValidatorSetByHeightResponse", aminoType: "cosmos-sdk/GetValidatorSetByHeightResponse", + is(o: any): o is GetValidatorSetByHeightResponse { + return o && (o.$typeUrl === GetValidatorSetByHeightResponse.typeUrl || typeof o.blockHeight === "bigint" && Array.isArray(o.validators) && (!o.validators.length || Validator.is(o.validators[0]))); + }, + isSDK(o: any): o is GetValidatorSetByHeightResponseSDKType { + return o && (o.$typeUrl === GetValidatorSetByHeightResponse.typeUrl || typeof o.block_height === "bigint" && Array.isArray(o.validators) && (!o.validators.length || Validator.isSDK(o.validators[0]))); + }, + isAmino(o: any): o is GetValidatorSetByHeightResponseAmino { + return o && (o.$typeUrl === GetValidatorSetByHeightResponse.typeUrl || typeof o.block_height === "bigint" && Array.isArray(o.validators) && (!o.validators.length || Validator.isAmino(o.validators[0]))); + }, encode(message: GetValidatorSetByHeightResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.blockHeight !== BigInt(0)) { writer.uint32(8).int64(message.blockHeight); @@ -878,6 +903,13 @@ export const GetValidatorSetByHeightResponse = { typeUrl: "/cosmos.base.tendermint.v1beta1.GetValidatorSetByHeightResponse", value: GetValidatorSetByHeightResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GetValidatorSetByHeightResponse.typeUrl)) { + return; + } + Validator.registerTypeUrl(); + PageResponse.registerTypeUrl(); } }; function createBaseGetLatestValidatorSetRequest(): GetLatestValidatorSetRequest { @@ -894,6 +926,15 @@ function createBaseGetLatestValidatorSetRequest(): GetLatestValidatorSetRequest export const GetLatestValidatorSetRequest = { typeUrl: "/cosmos.base.tendermint.v1beta1.GetLatestValidatorSetRequest", aminoType: "cosmos-sdk/GetLatestValidatorSetRequest", + is(o: any): o is GetLatestValidatorSetRequest { + return o && o.$typeUrl === GetLatestValidatorSetRequest.typeUrl; + }, + isSDK(o: any): o is GetLatestValidatorSetRequestSDKType { + return o && o.$typeUrl === GetLatestValidatorSetRequest.typeUrl; + }, + isAmino(o: any): o is GetLatestValidatorSetRequestAmino { + return o && o.$typeUrl === GetLatestValidatorSetRequest.typeUrl; + }, encode(message: GetLatestValidatorSetRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.pagination !== undefined) { PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); @@ -976,6 +1017,12 @@ export const GetLatestValidatorSetRequest = { typeUrl: "/cosmos.base.tendermint.v1beta1.GetLatestValidatorSetRequest", value: GetLatestValidatorSetRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GetLatestValidatorSetRequest.typeUrl)) { + return; + } + PageRequest.registerTypeUrl(); } }; function createBaseGetLatestValidatorSetResponse(): GetLatestValidatorSetResponse { @@ -994,6 +1041,15 @@ function createBaseGetLatestValidatorSetResponse(): GetLatestValidatorSetRespons export const GetLatestValidatorSetResponse = { typeUrl: "/cosmos.base.tendermint.v1beta1.GetLatestValidatorSetResponse", aminoType: "cosmos-sdk/GetLatestValidatorSetResponse", + is(o: any): o is GetLatestValidatorSetResponse { + return o && (o.$typeUrl === GetLatestValidatorSetResponse.typeUrl || typeof o.blockHeight === "bigint" && Array.isArray(o.validators) && (!o.validators.length || Validator.is(o.validators[0]))); + }, + isSDK(o: any): o is GetLatestValidatorSetResponseSDKType { + return o && (o.$typeUrl === GetLatestValidatorSetResponse.typeUrl || typeof o.block_height === "bigint" && Array.isArray(o.validators) && (!o.validators.length || Validator.isSDK(o.validators[0]))); + }, + isAmino(o: any): o is GetLatestValidatorSetResponseAmino { + return o && (o.$typeUrl === GetLatestValidatorSetResponse.typeUrl || typeof o.block_height === "bigint" && Array.isArray(o.validators) && (!o.validators.length || Validator.isAmino(o.validators[0]))); + }, encode(message: GetLatestValidatorSetResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.blockHeight !== BigInt(0)) { writer.uint32(8).int64(message.blockHeight); @@ -1118,6 +1174,13 @@ export const GetLatestValidatorSetResponse = { typeUrl: "/cosmos.base.tendermint.v1beta1.GetLatestValidatorSetResponse", value: GetLatestValidatorSetResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GetLatestValidatorSetResponse.typeUrl)) { + return; + } + Validator.registerTypeUrl(); + PageResponse.registerTypeUrl(); } }; function createBaseValidator(): Validator { @@ -1137,6 +1200,15 @@ function createBaseValidator(): Validator { export const Validator = { typeUrl: "/cosmos.base.tendermint.v1beta1.Validator", aminoType: "cosmos-sdk/Validator", + is(o: any): o is Validator { + return o && (o.$typeUrl === Validator.typeUrl || typeof o.address === "string" && typeof o.votingPower === "bigint" && typeof o.proposerPriority === "bigint"); + }, + isSDK(o: any): o is ValidatorSDKType { + return o && (o.$typeUrl === Validator.typeUrl || typeof o.address === "string" && typeof o.voting_power === "bigint" && typeof o.proposer_priority === "bigint"); + }, + isAmino(o: any): o is ValidatorAmino { + return o && (o.$typeUrl === Validator.typeUrl || typeof o.address === "string" && typeof o.voting_power === "bigint" && typeof o.proposer_priority === "bigint"); + }, encode(message: Validator, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.address !== "") { writer.uint32(10).string(message.address); @@ -1268,7 +1340,8 @@ export const Validator = { typeUrl: "/cosmos.base.tendermint.v1beta1.Validator", value: Validator.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseGetBlockByHeightRequest(): GetBlockByHeightRequest { return { @@ -1284,6 +1357,15 @@ function createBaseGetBlockByHeightRequest(): GetBlockByHeightRequest { export const GetBlockByHeightRequest = { typeUrl: "/cosmos.base.tendermint.v1beta1.GetBlockByHeightRequest", aminoType: "cosmos-sdk/GetBlockByHeightRequest", + is(o: any): o is GetBlockByHeightRequest { + return o && (o.$typeUrl === GetBlockByHeightRequest.typeUrl || typeof o.height === "bigint"); + }, + isSDK(o: any): o is GetBlockByHeightRequestSDKType { + return o && (o.$typeUrl === GetBlockByHeightRequest.typeUrl || typeof o.height === "bigint"); + }, + isAmino(o: any): o is GetBlockByHeightRequestAmino { + return o && (o.$typeUrl === GetBlockByHeightRequest.typeUrl || typeof o.height === "bigint"); + }, encode(message: GetBlockByHeightRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.height !== BigInt(0)) { writer.uint32(8).int64(message.height); @@ -1366,7 +1448,8 @@ export const GetBlockByHeightRequest = { typeUrl: "/cosmos.base.tendermint.v1beta1.GetBlockByHeightRequest", value: GetBlockByHeightRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseGetBlockByHeightResponse(): GetBlockByHeightResponse { return { @@ -1383,6 +1466,15 @@ function createBaseGetBlockByHeightResponse(): GetBlockByHeightResponse { export const GetBlockByHeightResponse = { typeUrl: "/cosmos.base.tendermint.v1beta1.GetBlockByHeightResponse", aminoType: "cosmos-sdk/GetBlockByHeightResponse", + is(o: any): o is GetBlockByHeightResponse { + return o && o.$typeUrl === GetBlockByHeightResponse.typeUrl; + }, + isSDK(o: any): o is GetBlockByHeightResponseSDKType { + return o && o.$typeUrl === GetBlockByHeightResponse.typeUrl; + }, + isAmino(o: any): o is GetBlockByHeightResponseAmino { + return o && o.$typeUrl === GetBlockByHeightResponse.typeUrl; + }, encode(message: GetBlockByHeightResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.blockId !== undefined) { BlockID.encode(message.blockId, writer.uint32(10).fork()).ldelim(); @@ -1482,6 +1574,13 @@ export const GetBlockByHeightResponse = { typeUrl: "/cosmos.base.tendermint.v1beta1.GetBlockByHeightResponse", value: GetBlockByHeightResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GetBlockByHeightResponse.typeUrl)) { + return; + } + BlockID.registerTypeUrl(); + Block.registerTypeUrl(); } }; function createBaseGetLatestBlockRequest(): GetLatestBlockRequest { @@ -1496,6 +1595,15 @@ function createBaseGetLatestBlockRequest(): GetLatestBlockRequest { export const GetLatestBlockRequest = { typeUrl: "/cosmos.base.tendermint.v1beta1.GetLatestBlockRequest", aminoType: "cosmos-sdk/GetLatestBlockRequest", + is(o: any): o is GetLatestBlockRequest { + return o && o.$typeUrl === GetLatestBlockRequest.typeUrl; + }, + isSDK(o: any): o is GetLatestBlockRequestSDKType { + return o && o.$typeUrl === GetLatestBlockRequest.typeUrl; + }, + isAmino(o: any): o is GetLatestBlockRequestAmino { + return o && o.$typeUrl === GetLatestBlockRequest.typeUrl; + }, encode(_: GetLatestBlockRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -1560,7 +1668,8 @@ export const GetLatestBlockRequest = { typeUrl: "/cosmos.base.tendermint.v1beta1.GetLatestBlockRequest", value: GetLatestBlockRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseGetLatestBlockResponse(): GetLatestBlockResponse { return { @@ -1577,6 +1686,15 @@ function createBaseGetLatestBlockResponse(): GetLatestBlockResponse { export const GetLatestBlockResponse = { typeUrl: "/cosmos.base.tendermint.v1beta1.GetLatestBlockResponse", aminoType: "cosmos-sdk/GetLatestBlockResponse", + is(o: any): o is GetLatestBlockResponse { + return o && o.$typeUrl === GetLatestBlockResponse.typeUrl; + }, + isSDK(o: any): o is GetLatestBlockResponseSDKType { + return o && o.$typeUrl === GetLatestBlockResponse.typeUrl; + }, + isAmino(o: any): o is GetLatestBlockResponseAmino { + return o && o.$typeUrl === GetLatestBlockResponse.typeUrl; + }, encode(message: GetLatestBlockResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.blockId !== undefined) { BlockID.encode(message.blockId, writer.uint32(10).fork()).ldelim(); @@ -1676,6 +1794,13 @@ export const GetLatestBlockResponse = { typeUrl: "/cosmos.base.tendermint.v1beta1.GetLatestBlockResponse", value: GetLatestBlockResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GetLatestBlockResponse.typeUrl)) { + return; + } + BlockID.registerTypeUrl(); + Block.registerTypeUrl(); } }; function createBaseGetSyncingRequest(): GetSyncingRequest { @@ -1690,6 +1815,15 @@ function createBaseGetSyncingRequest(): GetSyncingRequest { export const GetSyncingRequest = { typeUrl: "/cosmos.base.tendermint.v1beta1.GetSyncingRequest", aminoType: "cosmos-sdk/GetSyncingRequest", + is(o: any): o is GetSyncingRequest { + return o && o.$typeUrl === GetSyncingRequest.typeUrl; + }, + isSDK(o: any): o is GetSyncingRequestSDKType { + return o && o.$typeUrl === GetSyncingRequest.typeUrl; + }, + isAmino(o: any): o is GetSyncingRequestAmino { + return o && o.$typeUrl === GetSyncingRequest.typeUrl; + }, encode(_: GetSyncingRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -1754,7 +1888,8 @@ export const GetSyncingRequest = { typeUrl: "/cosmos.base.tendermint.v1beta1.GetSyncingRequest", value: GetSyncingRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseGetSyncingResponse(): GetSyncingResponse { return { @@ -1770,6 +1905,15 @@ function createBaseGetSyncingResponse(): GetSyncingResponse { export const GetSyncingResponse = { typeUrl: "/cosmos.base.tendermint.v1beta1.GetSyncingResponse", aminoType: "cosmos-sdk/GetSyncingResponse", + is(o: any): o is GetSyncingResponse { + return o && (o.$typeUrl === GetSyncingResponse.typeUrl || typeof o.syncing === "boolean"); + }, + isSDK(o: any): o is GetSyncingResponseSDKType { + return o && (o.$typeUrl === GetSyncingResponse.typeUrl || typeof o.syncing === "boolean"); + }, + isAmino(o: any): o is GetSyncingResponseAmino { + return o && (o.$typeUrl === GetSyncingResponse.typeUrl || typeof o.syncing === "boolean"); + }, encode(message: GetSyncingResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.syncing === true) { writer.uint32(8).bool(message.syncing); @@ -1850,7 +1994,8 @@ export const GetSyncingResponse = { typeUrl: "/cosmos.base.tendermint.v1beta1.GetSyncingResponse", value: GetSyncingResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseGetNodeInfoRequest(): GetNodeInfoRequest { return {}; @@ -1864,6 +2009,15 @@ function createBaseGetNodeInfoRequest(): GetNodeInfoRequest { export const GetNodeInfoRequest = { typeUrl: "/cosmos.base.tendermint.v1beta1.GetNodeInfoRequest", aminoType: "cosmos-sdk/GetNodeInfoRequest", + is(o: any): o is GetNodeInfoRequest { + return o && o.$typeUrl === GetNodeInfoRequest.typeUrl; + }, + isSDK(o: any): o is GetNodeInfoRequestSDKType { + return o && o.$typeUrl === GetNodeInfoRequest.typeUrl; + }, + isAmino(o: any): o is GetNodeInfoRequestAmino { + return o && o.$typeUrl === GetNodeInfoRequest.typeUrl; + }, encode(_: GetNodeInfoRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -1928,7 +2082,8 @@ export const GetNodeInfoRequest = { typeUrl: "/cosmos.base.tendermint.v1beta1.GetNodeInfoRequest", value: GetNodeInfoRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseGetNodeInfoResponse(): GetNodeInfoResponse { return { @@ -1945,6 +2100,15 @@ function createBaseGetNodeInfoResponse(): GetNodeInfoResponse { export const GetNodeInfoResponse = { typeUrl: "/cosmos.base.tendermint.v1beta1.GetNodeInfoResponse", aminoType: "cosmos-sdk/GetNodeInfoResponse", + is(o: any): o is GetNodeInfoResponse { + return o && o.$typeUrl === GetNodeInfoResponse.typeUrl; + }, + isSDK(o: any): o is GetNodeInfoResponseSDKType { + return o && o.$typeUrl === GetNodeInfoResponse.typeUrl; + }, + isAmino(o: any): o is GetNodeInfoResponseAmino { + return o && o.$typeUrl === GetNodeInfoResponse.typeUrl; + }, encode(message: GetNodeInfoResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.nodeInfo !== undefined) { NodeInfo.encode(message.nodeInfo, writer.uint32(10).fork()).ldelim(); @@ -2044,6 +2208,13 @@ export const GetNodeInfoResponse = { typeUrl: "/cosmos.base.tendermint.v1beta1.GetNodeInfoResponse", value: GetNodeInfoResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GetNodeInfoResponse.typeUrl)) { + return; + } + NodeInfo.registerTypeUrl(); + VersionInfo.registerTypeUrl(); } }; function createBaseVersionInfo(): VersionInfo { @@ -2067,6 +2238,15 @@ function createBaseVersionInfo(): VersionInfo { export const VersionInfo = { typeUrl: "/cosmos.base.tendermint.v1beta1.VersionInfo", aminoType: "cosmos-sdk/VersionInfo", + is(o: any): o is VersionInfo { + return o && (o.$typeUrl === VersionInfo.typeUrl || typeof o.name === "string" && typeof o.appName === "string" && typeof o.version === "string" && typeof o.gitCommit === "string" && typeof o.buildTags === "string" && typeof o.goVersion === "string" && Array.isArray(o.buildDeps) && (!o.buildDeps.length || Module.is(o.buildDeps[0])) && typeof o.cosmosSdkVersion === "string"); + }, + isSDK(o: any): o is VersionInfoSDKType { + return o && (o.$typeUrl === VersionInfo.typeUrl || typeof o.name === "string" && typeof o.app_name === "string" && typeof o.version === "string" && typeof o.git_commit === "string" && typeof o.build_tags === "string" && typeof o.go_version === "string" && Array.isArray(o.build_deps) && (!o.build_deps.length || Module.isSDK(o.build_deps[0])) && typeof o.cosmos_sdk_version === "string"); + }, + isAmino(o: any): o is VersionInfoAmino { + return o && (o.$typeUrl === VersionInfo.typeUrl || typeof o.name === "string" && typeof o.app_name === "string" && typeof o.version === "string" && typeof o.git_commit === "string" && typeof o.build_tags === "string" && typeof o.go_version === "string" && Array.isArray(o.build_deps) && (!o.build_deps.length || Module.isAmino(o.build_deps[0])) && typeof o.cosmos_sdk_version === "string"); + }, encode(message: VersionInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -2262,6 +2442,12 @@ export const VersionInfo = { typeUrl: "/cosmos.base.tendermint.v1beta1.VersionInfo", value: VersionInfo.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(VersionInfo.typeUrl)) { + return; + } + Module.registerTypeUrl(); } }; function createBaseModule(): Module { @@ -2280,6 +2466,15 @@ function createBaseModule(): Module { export const Module = { typeUrl: "/cosmos.base.tendermint.v1beta1.Module", aminoType: "cosmos-sdk/Module", + is(o: any): o is Module { + return o && (o.$typeUrl === Module.typeUrl || typeof o.path === "string" && typeof o.version === "string" && typeof o.sum === "string"); + }, + isSDK(o: any): o is ModuleSDKType { + return o && (o.$typeUrl === Module.typeUrl || typeof o.path === "string" && typeof o.version === "string" && typeof o.sum === "string"); + }, + isAmino(o: any): o is ModuleAmino { + return o && (o.$typeUrl === Module.typeUrl || typeof o.path === "string" && typeof o.version === "string" && typeof o.sum === "string"); + }, encode(message: Module, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.path !== "") { writer.uint32(10).string(message.path); @@ -2390,5 +2585,6 @@ export const Module = { typeUrl: "/cosmos.base.tendermint.v1beta1.Module", value: Module.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/cosmos/base/v1beta1/coin.ts b/__fixtures__/v-next/outputv2/cosmos/base/v1beta1/coin.ts index 43c9bf8f1f..d953db645d 100644 --- a/__fixtures__/v-next/outputv2/cosmos/base/v1beta1/coin.ts +++ b/__fixtures__/v-next/outputv2/cosmos/base/v1beta1/coin.ts @@ -1,7 +1,7 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; import { isSet, DeepPartial } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; -import { Decimal } from "@cosmjs/math"; +import { Decimal } from "@interchainjs/math"; export const protobufPackage = "cosmos.base.v1beta1"; /** * Coin defines a token with a denomination and an amount. @@ -185,6 +185,15 @@ function createBaseCoin(): Coin { export const Coin = { typeUrl: "/cosmos.base.v1beta1.Coin", aminoType: "cosmos-sdk/Coin", + is(o: any): o is Coin { + return o && (o.$typeUrl === Coin.typeUrl || typeof o.denom === "string" && typeof o.amount === "string"); + }, + isSDK(o: any): o is CoinSDKType { + return o && (o.$typeUrl === Coin.typeUrl || typeof o.denom === "string" && typeof o.amount === "string"); + }, + isAmino(o: any): o is CoinAmino { + return o && (o.$typeUrl === Coin.typeUrl || typeof o.denom === "string" && typeof o.amount === "string"); + }, encode(message: Coin, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.denom !== "") { writer.uint32(10).string(message.denom); @@ -280,7 +289,8 @@ export const Coin = { typeUrl: "/cosmos.base.v1beta1.Coin", value: Coin.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseDecCoin(): DecCoin { return { @@ -300,6 +310,15 @@ function createBaseDecCoin(): DecCoin { export const DecCoin = { typeUrl: "/cosmos.base.v1beta1.DecCoin", aminoType: "cosmos-sdk/DecCoin", + is(o: any): o is DecCoin { + return o && (o.$typeUrl === DecCoin.typeUrl || typeof o.denom === "string" && typeof o.amount === "string"); + }, + isSDK(o: any): o is DecCoinSDKType { + return o && (o.$typeUrl === DecCoin.typeUrl || typeof o.denom === "string" && typeof o.amount === "string"); + }, + isAmino(o: any): o is DecCoinAmino { + return o && (o.$typeUrl === DecCoin.typeUrl || typeof o.denom === "string" && typeof o.amount === "string"); + }, encode(message: DecCoin, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.denom !== "") { writer.uint32(10).string(message.denom); @@ -372,7 +391,7 @@ export const DecCoin = { toAmino(message: DecCoin): DecCoinAmino { const obj: any = {}; obj.denom = message.denom === "" ? undefined : message.denom; - obj.amount = message.amount === "" ? undefined : message.amount; + obj.amount = message.amount === "" ? undefined : Decimal.fromUserInput(message.amount, 18).atomics; return obj; }, fromAminoMsg(object: DecCoinAminoMsg): DecCoin { @@ -395,7 +414,8 @@ export const DecCoin = { typeUrl: "/cosmos.base.v1beta1.DecCoin", value: DecCoin.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseIntProto(): IntProto { return { @@ -411,6 +431,15 @@ function createBaseIntProto(): IntProto { export const IntProto = { typeUrl: "/cosmos.base.v1beta1.IntProto", aminoType: "cosmos-sdk/IntProto", + is(o: any): o is IntProto { + return o && (o.$typeUrl === IntProto.typeUrl || typeof o.int === "string"); + }, + isSDK(o: any): o is IntProtoSDKType { + return o && (o.$typeUrl === IntProto.typeUrl || typeof o.int === "string"); + }, + isAmino(o: any): o is IntProtoAmino { + return o && (o.$typeUrl === IntProto.typeUrl || typeof o.int === "string"); + }, encode(message: IntProto, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.int !== "") { writer.uint32(10).string(message.int); @@ -491,7 +520,8 @@ export const IntProto = { typeUrl: "/cosmos.base.v1beta1.IntProto", value: IntProto.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseDecProto(): DecProto { return { @@ -507,6 +537,15 @@ function createBaseDecProto(): DecProto { export const DecProto = { typeUrl: "/cosmos.base.v1beta1.DecProto", aminoType: "cosmos-sdk/DecProto", + is(o: any): o is DecProto { + return o && (o.$typeUrl === DecProto.typeUrl || typeof o.dec === "string"); + }, + isSDK(o: any): o is DecProtoSDKType { + return o && (o.$typeUrl === DecProto.typeUrl || typeof o.dec === "string"); + }, + isAmino(o: any): o is DecProtoAmino { + return o && (o.$typeUrl === DecProto.typeUrl || typeof o.dec === "string"); + }, encode(message: DecProto, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.dec !== "") { writer.uint32(10).string(Decimal.fromUserInput(message.dec, 18).atomics); @@ -564,7 +603,7 @@ export const DecProto = { }, toAmino(message: DecProto): DecProtoAmino { const obj: any = {}; - obj.dec = message.dec === "" ? undefined : message.dec; + obj.dec = message.dec === "" ? undefined : Decimal.fromUserInput(message.dec, 18).atomics; return obj; }, fromAminoMsg(object: DecProtoAminoMsg): DecProto { @@ -587,5 +626,6 @@ export const DecProto = { typeUrl: "/cosmos.base.v1beta1.DecProto", value: DecProto.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/cosmos/bundle.ts b/__fixtures__/v-next/outputv2/cosmos/bundle.ts index 3e3032cd75..3fed9ab940 100644 --- a/__fixtures__/v-next/outputv2/cosmos/bundle.ts +++ b/__fixtures__/v-next/outputv2/cosmos/bundle.ts @@ -90,93 +90,110 @@ import * as _143 from "./upgrade/v1beta1/tx"; import * as _144 from "./upgrade/v1beta1/upgrade"; import * as _145 from "./vesting/v1beta1/tx"; import * as _146 from "./vesting/v1beta1/vesting"; -import * as _356 from "./authz/v1beta1/tx.amino"; -import * as _357 from "./bank/v1beta1/tx.amino"; -import * as _358 from "./crisis/v1beta1/tx.amino"; -import * as _359 from "./distribution/v1beta1/tx.amino"; -import * as _360 from "./evidence/v1beta1/tx.amino"; -import * as _361 from "./feegrant/v1beta1/tx.amino"; -import * as _362 from "./gov/v1/tx.amino"; -import * as _363 from "./gov/v1beta1/tx.amino"; -import * as _364 from "./group/v1/tx.amino"; -import * as _365 from "./nft/v1beta1/tx.amino"; -import * as _366 from "./slashing/v1beta1/tx.amino"; -import * as _367 from "./staking/v1beta1/tx.amino"; -import * as _368 from "./upgrade/v1beta1/tx.amino"; -import * as _369 from "./vesting/v1beta1/tx.amino"; -import * as _370 from "./authz/v1beta1/tx.registry"; -import * as _371 from "./bank/v1beta1/tx.registry"; -import * as _372 from "./crisis/v1beta1/tx.registry"; -import * as _373 from "./distribution/v1beta1/tx.registry"; -import * as _374 from "./evidence/v1beta1/tx.registry"; -import * as _375 from "./feegrant/v1beta1/tx.registry"; -import * as _376 from "./gov/v1/tx.registry"; -import * as _377 from "./gov/v1beta1/tx.registry"; -import * as _378 from "./group/v1/tx.registry"; -import * as _379 from "./nft/v1beta1/tx.registry"; -import * as _380 from "./slashing/v1beta1/tx.registry"; -import * as _381 from "./staking/v1beta1/tx.registry"; -import * as _382 from "./upgrade/v1beta1/tx.registry"; -import * as _383 from "./vesting/v1beta1/tx.registry"; -import * as _384 from "./auth/v1beta1/query.lcd"; -import * as _385 from "./authz/v1beta1/query.lcd"; -import * as _386 from "./bank/v1beta1/query.lcd"; -import * as _387 from "./base/tendermint/v1beta1/query.lcd"; -import * as _388 from "./distribution/v1beta1/query.lcd"; -import * as _389 from "./evidence/v1beta1/query.lcd"; -import * as _390 from "./feegrant/v1beta1/query.lcd"; -import * as _391 from "./gov/v1/query.lcd"; -import * as _392 from "./gov/v1beta1/query.lcd"; -import * as _393 from "./group/v1/query.lcd"; -import * as _394 from "./mint/v1beta1/query.lcd"; -import * as _395 from "./nft/v1beta1/query.lcd"; -import * as _396 from "./params/v1beta1/query.lcd"; -import * as _397 from "./slashing/v1beta1/query.lcd"; -import * as _398 from "./staking/v1beta1/query.lcd"; -import * as _399 from "./tx/v1beta1/service.lcd"; -import * as _400 from "./upgrade/v1beta1/query.lcd"; -import * as _401 from "./app/v1alpha1/query.rpc.Query"; -import * as _402 from "./auth/v1beta1/query.rpc.Query"; -import * as _403 from "./authz/v1beta1/query.rpc.Query"; -import * as _404 from "./bank/v1beta1/query.rpc.Query"; -import * as _405 from "./base/tendermint/v1beta1/query.rpc.Service"; -import * as _406 from "./distribution/v1beta1/query.rpc.Query"; -import * as _407 from "./evidence/v1beta1/query.rpc.Query"; -import * as _408 from "./feegrant/v1beta1/query.rpc.Query"; -import * as _409 from "./gov/v1/query.rpc.Query"; -import * as _410 from "./gov/v1beta1/query.rpc.Query"; -import * as _411 from "./group/v1/query.rpc.Query"; -import * as _412 from "./mint/v1beta1/query.rpc.Query"; -import * as _413 from "./nft/v1beta1/query.rpc.Query"; -import * as _414 from "./params/v1beta1/query.rpc.Query"; -import * as _415 from "./slashing/v1beta1/query.rpc.Query"; -import * as _416 from "./staking/v1beta1/query.rpc.Query"; -import * as _417 from "./tx/v1beta1/service.rpc.Service"; -import * as _418 from "./upgrade/v1beta1/query.rpc.Query"; -import * as _419 from "./authz/v1beta1/tx.rpc.msg"; -import * as _420 from "./bank/v1beta1/tx.rpc.msg"; -import * as _421 from "./crisis/v1beta1/tx.rpc.msg"; -import * as _422 from "./distribution/v1beta1/tx.rpc.msg"; -import * as _423 from "./evidence/v1beta1/tx.rpc.msg"; -import * as _424 from "./feegrant/v1beta1/tx.rpc.msg"; -import * as _425 from "./gov/v1/tx.rpc.msg"; -import * as _426 from "./gov/v1beta1/tx.rpc.msg"; -import * as _427 from "./group/v1/tx.rpc.msg"; -import * as _428 from "./nft/v1beta1/tx.rpc.msg"; -import * as _429 from "./slashing/v1beta1/tx.rpc.msg"; -import * as _430 from "./staking/v1beta1/tx.rpc.msg"; -import * as _431 from "./upgrade/v1beta1/tx.rpc.msg"; -import * as _432 from "./vesting/v1beta1/tx.rpc.msg"; -import * as _534 from "./lcd"; -import * as _535 from "./rpc.query"; -import * as _536 from "./rpc.tx"; +import * as _364 from "./authz/v1beta1/tx.amino"; +import * as _365 from "./bank/v1beta1/tx.amino"; +import * as _366 from "./crisis/v1beta1/tx.amino"; +import * as _367 from "./distribution/v1beta1/tx.amino"; +import * as _368 from "./evidence/v1beta1/tx.amino"; +import * as _369 from "./feegrant/v1beta1/tx.amino"; +import * as _370 from "./gov/v1/tx.amino"; +import * as _371 from "./gov/v1beta1/tx.amino"; +import * as _372 from "./group/v1/tx.amino"; +import * as _373 from "./nft/v1beta1/tx.amino"; +import * as _374 from "./slashing/v1beta1/tx.amino"; +import * as _375 from "./staking/v1beta1/tx.amino"; +import * as _376 from "./upgrade/v1beta1/tx.amino"; +import * as _377 from "./vesting/v1beta1/tx.amino"; +import * as _378 from "./authz/v1beta1/tx.registry"; +import * as _379 from "./bank/v1beta1/tx.registry"; +import * as _380 from "./crisis/v1beta1/tx.registry"; +import * as _381 from "./distribution/v1beta1/tx.registry"; +import * as _382 from "./evidence/v1beta1/tx.registry"; +import * as _383 from "./feegrant/v1beta1/tx.registry"; +import * as _384 from "./gov/v1/tx.registry"; +import * as _385 from "./gov/v1beta1/tx.registry"; +import * as _386 from "./group/v1/tx.registry"; +import * as _387 from "./nft/v1beta1/tx.registry"; +import * as _388 from "./slashing/v1beta1/tx.registry"; +import * as _389 from "./staking/v1beta1/tx.registry"; +import * as _390 from "./upgrade/v1beta1/tx.registry"; +import * as _391 from "./vesting/v1beta1/tx.registry"; +import * as _392 from "./app/v1alpha1/query.rpc.func"; +import * as _393 from "./auth/v1beta1/query.rpc.func"; +import * as _394 from "./authz/v1beta1/query.rpc.func"; +import * as _395 from "./bank/v1beta1/query.rpc.func"; +import * as _396 from "./base/reflection/v1beta1/reflection.rpc.func"; +import * as _397 from "./base/reflection/v2alpha1/reflection.rpc.func"; +import * as _398 from "./base/tendermint/v1beta1/query.rpc.func"; +import * as _399 from "./distribution/v1beta1/query.rpc.func"; +import * as _400 from "./evidence/v1beta1/query.rpc.func"; +import * as _401 from "./feegrant/v1beta1/query.rpc.func"; +import * as _402 from "./gov/v1/query.rpc.func"; +import * as _403 from "./gov/v1beta1/query.rpc.func"; +import * as _404 from "./group/v1/query.rpc.func"; +import * as _405 from "./mint/v1beta1/query.rpc.func"; +import * as _406 from "./nft/v1beta1/query.rpc.func"; +import * as _407 from "./params/v1beta1/query.rpc.func"; +import * as _408 from "./slashing/v1beta1/query.rpc.func"; +import * as _409 from "./staking/v1beta1/query.rpc.func"; +import * as _410 from "./tx/v1beta1/service.rpc.func"; +import * as _411 from "./upgrade/v1beta1/query.rpc.func"; +import * as _412 from "./app/v1alpha1/query.rpc.Query"; +import * as _413 from "./auth/v1beta1/query.rpc.Query"; +import * as _414 from "./authz/v1beta1/query.rpc.Query"; +import * as _415 from "./bank/v1beta1/query.rpc.Query"; +import * as _416 from "./base/tendermint/v1beta1/query.rpc.Service"; +import * as _417 from "./distribution/v1beta1/query.rpc.Query"; +import * as _418 from "./evidence/v1beta1/query.rpc.Query"; +import * as _419 from "./feegrant/v1beta1/query.rpc.Query"; +import * as _420 from "./gov/v1/query.rpc.Query"; +import * as _421 from "./gov/v1beta1/query.rpc.Query"; +import * as _422 from "./group/v1/query.rpc.Query"; +import * as _423 from "./mint/v1beta1/query.rpc.Query"; +import * as _424 from "./nft/v1beta1/query.rpc.Query"; +import * as _425 from "./params/v1beta1/query.rpc.Query"; +import * as _426 from "./slashing/v1beta1/query.rpc.Query"; +import * as _427 from "./staking/v1beta1/query.rpc.Query"; +import * as _428 from "./tx/v1beta1/service.rpc.Service"; +import * as _429 from "./upgrade/v1beta1/query.rpc.Query"; +import * as _430 from "./authz/v1beta1/tx.rpc.func"; +import * as _431 from "./bank/v1beta1/tx.rpc.func"; +import * as _432 from "./crisis/v1beta1/tx.rpc.func"; +import * as _433 from "./distribution/v1beta1/tx.rpc.func"; +import * as _434 from "./evidence/v1beta1/tx.rpc.func"; +import * as _435 from "./feegrant/v1beta1/tx.rpc.func"; +import * as _436 from "./gov/v1/tx.rpc.func"; +import * as _437 from "./gov/v1beta1/tx.rpc.func"; +import * as _438 from "./group/v1/tx.rpc.func"; +import * as _439 from "./nft/v1beta1/tx.rpc.func"; +import * as _440 from "./slashing/v1beta1/tx.rpc.func"; +import * as _441 from "./staking/v1beta1/tx.rpc.func"; +import * as _442 from "./upgrade/v1beta1/tx.rpc.func"; +import * as _443 from "./vesting/v1beta1/tx.rpc.func"; +import * as _444 from "./authz/v1beta1/tx.rpc.msg"; +import * as _445 from "./bank/v1beta1/tx.rpc.msg"; +import * as _446 from "./crisis/v1beta1/tx.rpc.msg"; +import * as _447 from "./distribution/v1beta1/tx.rpc.msg"; +import * as _448 from "./evidence/v1beta1/tx.rpc.msg"; +import * as _449 from "./feegrant/v1beta1/tx.rpc.msg"; +import * as _450 from "./gov/v1/tx.rpc.msg"; +import * as _451 from "./gov/v1beta1/tx.rpc.msg"; +import * as _452 from "./group/v1/tx.rpc.msg"; +import * as _453 from "./nft/v1beta1/tx.rpc.msg"; +import * as _454 from "./slashing/v1beta1/tx.rpc.msg"; +import * as _455 from "./staking/v1beta1/tx.rpc.msg"; +import * as _456 from "./upgrade/v1beta1/tx.rpc.msg"; +import * as _457 from "./vesting/v1beta1/tx.rpc.msg"; +import * as _575 from "./rpc.query"; +import * as _576 from "./rpc.tx"; export namespace cosmos { export namespace app { export const v1alpha1 = { ..._55, ..._56, ..._57, - ..._401 + ..._392, + ..._412 }; } export namespace auth { @@ -184,8 +201,8 @@ export namespace cosmos { ..._58, ..._59, ..._60, - ..._384, - ..._402 + ..._393, + ..._413 }; } export namespace authz { @@ -194,11 +211,12 @@ export namespace cosmos { ..._62, ..._63, ..._64, - ..._356, - ..._370, - ..._385, - ..._403, - ..._419 + ..._364, + ..._378, + ..._394, + ..._414, + ..._430, + ..._444 }; } export namespace bank { @@ -208,11 +226,12 @@ export namespace cosmos { ..._67, ..._68, ..._69, - ..._357, - ..._371, - ..._386, - ..._404, - ..._420 + ..._365, + ..._379, + ..._395, + ..._415, + ..._431, + ..._445 }; } export namespace base { @@ -233,10 +252,12 @@ export namespace cosmos { } export namespace reflection { export const v1beta1 = { - ..._73 + ..._73, + ..._396 }; export const v2alpha1 = { - ..._74 + ..._74, + ..._397 }; } export namespace snapshots { @@ -253,8 +274,8 @@ export namespace cosmos { export namespace tendermint { export const v1beta1 = { ..._78, - ..._387, - ..._405 + ..._398, + ..._416 }; } export const v1beta1 = { @@ -271,9 +292,10 @@ export namespace cosmos { export const v1beta1 = { ..._82, ..._83, - ..._358, - ..._372, - ..._421 + ..._366, + ..._380, + ..._432, + ..._446 }; } export namespace crypto { @@ -306,11 +328,12 @@ export namespace cosmos { ..._91, ..._92, ..._93, - ..._359, - ..._373, - ..._388, - ..._406, - ..._422 + ..._367, + ..._381, + ..._399, + ..._417, + ..._433, + ..._447 }; } export namespace evidence { @@ -319,11 +342,12 @@ export namespace cosmos { ..._95, ..._96, ..._97, - ..._360, - ..._374, - ..._389, - ..._407, - ..._423 + ..._368, + ..._382, + ..._400, + ..._418, + ..._434, + ..._448 }; } export namespace feegrant { @@ -332,11 +356,12 @@ export namespace cosmos { ..._99, ..._100, ..._101, - ..._361, - ..._375, - ..._390, - ..._408, - ..._424 + ..._369, + ..._383, + ..._401, + ..._419, + ..._435, + ..._449 }; } export namespace genutil { @@ -350,22 +375,24 @@ export namespace cosmos { ..._104, ..._105, ..._106, - ..._362, - ..._376, - ..._391, - ..._409, - ..._425 + ..._370, + ..._384, + ..._402, + ..._420, + ..._436, + ..._450 }; export const v1beta1 = { ..._107, ..._108, ..._109, ..._110, - ..._363, - ..._377, - ..._392, - ..._410, - ..._426 + ..._371, + ..._385, + ..._403, + ..._421, + ..._437, + ..._451 }; } export namespace group { @@ -375,11 +402,12 @@ export namespace cosmos { ..._113, ..._114, ..._115, - ..._364, - ..._378, - ..._393, - ..._411, - ..._427 + ..._372, + ..._386, + ..._404, + ..._422, + ..._438, + ..._452 }; } export namespace mint { @@ -387,8 +415,8 @@ export namespace cosmos { ..._116, ..._117, ..._118, - ..._394, - ..._412 + ..._405, + ..._423 }; } export namespace msg { @@ -403,11 +431,12 @@ export namespace cosmos { ..._122, ..._123, ..._124, - ..._365, - ..._379, - ..._395, - ..._413, - ..._428 + ..._373, + ..._387, + ..._406, + ..._424, + ..._439, + ..._453 }; } export namespace orm { @@ -427,8 +456,8 @@ export namespace cosmos { export const v1beta1 = { ..._128, ..._129, - ..._396, - ..._414 + ..._407, + ..._425 }; } export namespace slashing { @@ -437,11 +466,12 @@ export namespace cosmos { ..._131, ..._132, ..._133, - ..._366, - ..._380, - ..._397, - ..._415, - ..._429 + ..._374, + ..._388, + ..._408, + ..._426, + ..._440, + ..._454 }; } export namespace staking { @@ -451,11 +481,12 @@ export namespace cosmos { ..._136, ..._137, ..._138, - ..._367, - ..._381, - ..._398, - ..._416, - ..._430 + ..._375, + ..._389, + ..._409, + ..._427, + ..._441, + ..._455 }; } export namespace tx { @@ -467,8 +498,8 @@ export namespace cosmos { export const v1beta1 = { ..._140, ..._141, - ..._399, - ..._417 + ..._410, + ..._428 }; } export namespace upgrade { @@ -476,25 +507,26 @@ export namespace cosmos { ..._142, ..._143, ..._144, - ..._368, - ..._382, - ..._400, - ..._418, - ..._431 + ..._376, + ..._390, + ..._411, + ..._429, + ..._442, + ..._456 }; } export namespace vesting { export const v1beta1 = { ..._145, ..._146, - ..._369, - ..._383, - ..._432 + ..._377, + ..._391, + ..._443, + ..._457 }; } export const ClientFactory = { - ..._534, - ..._535, - ..._536 + ..._575, + ..._576 }; } \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/cosmos/capability/v1beta1/capability.ts b/__fixtures__/v-next/outputv2/cosmos/capability/v1beta1/capability.ts index 6f690d9e5f..dd00bf8ebc 100644 --- a/__fixtures__/v-next/outputv2/cosmos/capability/v1beta1/capability.ts +++ b/__fixtures__/v-next/outputv2/cosmos/capability/v1beta1/capability.ts @@ -1,6 +1,7 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; import { isSet, DeepPartial } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "cosmos.capability.v1beta1"; /** * Capability defines an implementation of an object capability. The index @@ -134,6 +135,15 @@ function createBaseCapability(): Capability { export const Capability = { typeUrl: "/cosmos.capability.v1beta1.Capability", aminoType: "cosmos-sdk/Capability", + is(o: any): o is Capability { + return o && (o.$typeUrl === Capability.typeUrl || typeof o.index === "bigint"); + }, + isSDK(o: any): o is CapabilitySDKType { + return o && (o.$typeUrl === Capability.typeUrl || typeof o.index === "bigint"); + }, + isAmino(o: any): o is CapabilityAmino { + return o && (o.$typeUrl === Capability.typeUrl || typeof o.index === "bigint"); + }, encode(message: Capability, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.index !== BigInt(0)) { writer.uint32(8).uint64(message.index); @@ -216,7 +226,8 @@ export const Capability = { typeUrl: "/cosmos.capability.v1beta1.Capability", value: Capability.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseOwner(): Owner { return { @@ -234,6 +245,15 @@ function createBaseOwner(): Owner { export const Owner = { typeUrl: "/cosmos.capability.v1beta1.Owner", aminoType: "cosmos-sdk/Owner", + is(o: any): o is Owner { + return o && (o.$typeUrl === Owner.typeUrl || typeof o.module === "string" && typeof o.name === "string"); + }, + isSDK(o: any): o is OwnerSDKType { + return o && (o.$typeUrl === Owner.typeUrl || typeof o.module === "string" && typeof o.name === "string"); + }, + isAmino(o: any): o is OwnerAmino { + return o && (o.$typeUrl === Owner.typeUrl || typeof o.module === "string" && typeof o.name === "string"); + }, encode(message: Owner, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.module !== "") { writer.uint32(10).string(message.module); @@ -329,7 +349,8 @@ export const Owner = { typeUrl: "/cosmos.capability.v1beta1.Owner", value: Owner.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseCapabilityOwners(): CapabilityOwners { return { @@ -346,6 +367,15 @@ function createBaseCapabilityOwners(): CapabilityOwners { export const CapabilityOwners = { typeUrl: "/cosmos.capability.v1beta1.CapabilityOwners", aminoType: "cosmos-sdk/CapabilityOwners", + is(o: any): o is CapabilityOwners { + return o && (o.$typeUrl === CapabilityOwners.typeUrl || Array.isArray(o.owners) && (!o.owners.length || Owner.is(o.owners[0]))); + }, + isSDK(o: any): o is CapabilityOwnersSDKType { + return o && (o.$typeUrl === CapabilityOwners.typeUrl || Array.isArray(o.owners) && (!o.owners.length || Owner.isSDK(o.owners[0]))); + }, + isAmino(o: any): o is CapabilityOwnersAmino { + return o && (o.$typeUrl === CapabilityOwners.typeUrl || Array.isArray(o.owners) && (!o.owners.length || Owner.isAmino(o.owners[0]))); + }, encode(message: CapabilityOwners, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.owners) { Owner.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -436,5 +466,11 @@ export const CapabilityOwners = { typeUrl: "/cosmos.capability.v1beta1.CapabilityOwners", value: CapabilityOwners.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(CapabilityOwners.typeUrl)) { + return; + } + Owner.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/cosmos/capability/v1beta1/genesis.ts b/__fixtures__/v-next/outputv2/cosmos/capability/v1beta1/genesis.ts index 6a4285a36c..b8e479114e 100644 --- a/__fixtures__/v-next/outputv2/cosmos/capability/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv2/cosmos/capability/v1beta1/genesis.ts @@ -1,5 +1,6 @@ import { CapabilityOwners, CapabilityOwnersAmino, CapabilityOwnersSDKType } from "./capability"; import { BinaryReader, BinaryWriter } from "../../../binary"; +import { GlobalDecoderRegistry } from "../../../registry"; import { isSet, DeepPartial } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "cosmos.capability.v1beta1"; @@ -120,6 +121,15 @@ function createBaseGenesisOwners(): GenesisOwners { export const GenesisOwners = { typeUrl: "/cosmos.capability.v1beta1.GenesisOwners", aminoType: "cosmos-sdk/GenesisOwners", + is(o: any): o is GenesisOwners { + return o && (o.$typeUrl === GenesisOwners.typeUrl || typeof o.index === "bigint" && CapabilityOwners.is(o.indexOwners)); + }, + isSDK(o: any): o is GenesisOwnersSDKType { + return o && (o.$typeUrl === GenesisOwners.typeUrl || typeof o.index === "bigint" && CapabilityOwners.isSDK(o.index_owners)); + }, + isAmino(o: any): o is GenesisOwnersAmino { + return o && (o.$typeUrl === GenesisOwners.typeUrl || typeof o.index === "bigint" && CapabilityOwners.isAmino(o.index_owners)); + }, encode(message: GenesisOwners, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.index !== BigInt(0)) { writer.uint32(8).uint64(message.index); @@ -219,6 +229,12 @@ export const GenesisOwners = { typeUrl: "/cosmos.capability.v1beta1.GenesisOwners", value: GenesisOwners.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GenesisOwners.typeUrl)) { + return; + } + CapabilityOwners.registerTypeUrl(); } }; function createBaseGenesisState(): GenesisState { @@ -236,6 +252,15 @@ function createBaseGenesisState(): GenesisState { export const GenesisState = { typeUrl: "/cosmos.capability.v1beta1.GenesisState", aminoType: "cosmos-sdk/GenesisState", + is(o: any): o is GenesisState { + return o && (o.$typeUrl === GenesisState.typeUrl || typeof o.index === "bigint" && Array.isArray(o.owners) && (!o.owners.length || GenesisOwners.is(o.owners[0]))); + }, + isSDK(o: any): o is GenesisStateSDKType { + return o && (o.$typeUrl === GenesisState.typeUrl || typeof o.index === "bigint" && Array.isArray(o.owners) && (!o.owners.length || GenesisOwners.isSDK(o.owners[0]))); + }, + isAmino(o: any): o is GenesisStateAmino { + return o && (o.$typeUrl === GenesisState.typeUrl || typeof o.index === "bigint" && Array.isArray(o.owners) && (!o.owners.length || GenesisOwners.isAmino(o.owners[0]))); + }, encode(message: GenesisState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.index !== BigInt(0)) { writer.uint32(8).uint64(message.index); @@ -343,5 +368,11 @@ export const GenesisState = { typeUrl: "/cosmos.capability.v1beta1.GenesisState", value: GenesisState.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GenesisState.typeUrl)) { + return; + } + GenesisOwners.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/cosmos/crisis/v1beta1/genesis.ts b/__fixtures__/v-next/outputv2/cosmos/crisis/v1beta1/genesis.ts index 53da5639b1..e3dcb1b56e 100644 --- a/__fixtures__/v-next/outputv2/cosmos/crisis/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv2/cosmos/crisis/v1beta1/genesis.ts @@ -1,5 +1,6 @@ import { Coin, CoinAmino, CoinSDKType } from "../../base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; +import { GlobalDecoderRegistry } from "../../../registry"; import { isSet, DeepPartial } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "cosmos.crisis.v1beta1"; @@ -60,6 +61,15 @@ function createBaseGenesisState(): GenesisState { export const GenesisState = { typeUrl: "/cosmos.crisis.v1beta1.GenesisState", aminoType: "cosmos-sdk/GenesisState", + is(o: any): o is GenesisState { + return o && (o.$typeUrl === GenesisState.typeUrl || Coin.is(o.constantFee)); + }, + isSDK(o: any): o is GenesisStateSDKType { + return o && (o.$typeUrl === GenesisState.typeUrl || Coin.isSDK(o.constant_fee)); + }, + isAmino(o: any): o is GenesisStateAmino { + return o && (o.$typeUrl === GenesisState.typeUrl || Coin.isAmino(o.constant_fee)); + }, encode(message: GenesisState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.constantFee !== undefined) { Coin.encode(message.constantFee, writer.uint32(26).fork()).ldelim(); @@ -142,5 +152,11 @@ export const GenesisState = { typeUrl: "/cosmos.crisis.v1beta1.GenesisState", value: GenesisState.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GenesisState.typeUrl)) { + return; + } + Coin.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/cosmos/crisis/v1beta1/tx.registry.ts b/__fixtures__/v-next/outputv2/cosmos/crisis/v1beta1/tx.registry.ts index df0e8e23c5..3535fbb174 100644 --- a/__fixtures__/v-next/outputv2/cosmos/crisis/v1beta1/tx.registry.ts +++ b/__fixtures__/v-next/outputv2/cosmos/crisis/v1beta1/tx.registry.ts @@ -1,11 +1,6 @@ -import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { TelescopeGeneratedType } from "../../../types"; import { MsgVerifyInvariant } from "./tx"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/cosmos.crisis.v1beta1.MsgVerifyInvariant", MsgVerifyInvariant]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/cosmos.crisis.v1beta1.MsgVerifyInvariant", MsgVerifyInvariant]]; export const MessageComposer = { encoded: { verifyInvariant(value: MsgVerifyInvariant) { diff --git a/__fixtures__/v-next/outputv2/cosmos/crisis/v1beta1/tx.rpc.func.ts b/__fixtures__/v-next/outputv2/cosmos/crisis/v1beta1/tx.rpc.func.ts new file mode 100644 index 0000000000..d92d57ba20 --- /dev/null +++ b/__fixtures__/v-next/outputv2/cosmos/crisis/v1beta1/tx.rpc.func.ts @@ -0,0 +1,11 @@ +import { buildTx } from "../../../helper-func-types"; +import { MsgVerifyInvariant } from "./tx"; +/** + * VerifyInvariant defines a method to verify a particular invariance. + * @name verifyInvariant + * @package cosmos.crisis.v1beta1 + * @see proto service: cosmos.crisis.v1beta1.VerifyInvariant + */ +export const verifyInvariant = buildTx({ + msg: MsgVerifyInvariant +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/cosmos/crisis/v1beta1/tx.ts b/__fixtures__/v-next/outputv2/cosmos/crisis/v1beta1/tx.ts index 9fbd500b57..92247772ae 100644 --- a/__fixtures__/v-next/outputv2/cosmos/crisis/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputv2/cosmos/crisis/v1beta1/tx.ts @@ -88,6 +88,15 @@ function createBaseMsgVerifyInvariant(): MsgVerifyInvariant { export const MsgVerifyInvariant = { typeUrl: "/cosmos.crisis.v1beta1.MsgVerifyInvariant", aminoType: "cosmos-sdk/MsgVerifyInvariant", + is(o: any): o is MsgVerifyInvariant { + return o && (o.$typeUrl === MsgVerifyInvariant.typeUrl || typeof o.sender === "string" && typeof o.invariantModuleName === "string" && typeof o.invariantRoute === "string"); + }, + isSDK(o: any): o is MsgVerifyInvariantSDKType { + return o && (o.$typeUrl === MsgVerifyInvariant.typeUrl || typeof o.sender === "string" && typeof o.invariant_module_name === "string" && typeof o.invariant_route === "string"); + }, + isAmino(o: any): o is MsgVerifyInvariantAmino { + return o && (o.$typeUrl === MsgVerifyInvariant.typeUrl || typeof o.sender === "string" && typeof o.invariant_module_name === "string" && typeof o.invariant_route === "string"); + }, encode(message: MsgVerifyInvariant, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.sender !== "") { writer.uint32(10).string(message.sender); @@ -198,7 +207,8 @@ export const MsgVerifyInvariant = { typeUrl: "/cosmos.crisis.v1beta1.MsgVerifyInvariant", value: MsgVerifyInvariant.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgVerifyInvariantResponse(): MsgVerifyInvariantResponse { return {}; @@ -212,6 +222,15 @@ function createBaseMsgVerifyInvariantResponse(): MsgVerifyInvariantResponse { export const MsgVerifyInvariantResponse = { typeUrl: "/cosmos.crisis.v1beta1.MsgVerifyInvariantResponse", aminoType: "cosmos-sdk/MsgVerifyInvariantResponse", + is(o: any): o is MsgVerifyInvariantResponse { + return o && o.$typeUrl === MsgVerifyInvariantResponse.typeUrl; + }, + isSDK(o: any): o is MsgVerifyInvariantResponseSDKType { + return o && o.$typeUrl === MsgVerifyInvariantResponse.typeUrl; + }, + isAmino(o: any): o is MsgVerifyInvariantResponseAmino { + return o && o.$typeUrl === MsgVerifyInvariantResponse.typeUrl; + }, encode(_: MsgVerifyInvariantResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -276,5 +295,6 @@ export const MsgVerifyInvariantResponse = { typeUrl: "/cosmos.crisis.v1beta1.MsgVerifyInvariantResponse", value: MsgVerifyInvariantResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/cosmos/crypto/ed25519/keys.ts b/__fixtures__/v-next/outputv2/cosmos/crypto/ed25519/keys.ts index e8f8d006a4..1300acc52a 100644 --- a/__fixtures__/v-next/outputv2/cosmos/crypto/ed25519/keys.ts +++ b/__fixtures__/v-next/outputv2/cosmos/crypto/ed25519/keys.ts @@ -105,6 +105,15 @@ function createBasePubKey(): PubKey { export const PubKey = { typeUrl: "/cosmos.crypto.ed25519.PubKey", aminoType: "cosmos-sdk/PubKey", + is(o: any): o is PubKey { + return o && (o.$typeUrl === PubKey.typeUrl || o.key instanceof Uint8Array || typeof o.key === "string"); + }, + isSDK(o: any): o is PubKeySDKType { + return o && (o.$typeUrl === PubKey.typeUrl || o.key instanceof Uint8Array || typeof o.key === "string"); + }, + isAmino(o: any): o is PubKeyAmino { + return o && (o.$typeUrl === PubKey.typeUrl || o.key instanceof Uint8Array || typeof o.key === "string"); + }, encode(message: PubKey, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.key.length !== 0) { writer.uint32(10).bytes(message.key); @@ -185,7 +194,8 @@ export const PubKey = { typeUrl: "/cosmos.crypto.ed25519.PubKey", value: PubKey.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBasePrivKey(): PrivKey { return { @@ -202,6 +212,15 @@ function createBasePrivKey(): PrivKey { export const PrivKey = { typeUrl: "/cosmos.crypto.ed25519.PrivKey", aminoType: "cosmos-sdk/PrivKey", + is(o: any): o is PrivKey { + return o && (o.$typeUrl === PrivKey.typeUrl || o.key instanceof Uint8Array || typeof o.key === "string"); + }, + isSDK(o: any): o is PrivKeySDKType { + return o && (o.$typeUrl === PrivKey.typeUrl || o.key instanceof Uint8Array || typeof o.key === "string"); + }, + isAmino(o: any): o is PrivKeyAmino { + return o && (o.$typeUrl === PrivKey.typeUrl || o.key instanceof Uint8Array || typeof o.key === "string"); + }, encode(message: PrivKey, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.key.length !== 0) { writer.uint32(10).bytes(message.key); @@ -282,5 +301,6 @@ export const PrivKey = { typeUrl: "/cosmos.crypto.ed25519.PrivKey", value: PrivKey.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/cosmos/crypto/hd/v1/hd.ts b/__fixtures__/v-next/outputv2/cosmos/crypto/hd/v1/hd.ts index b112cf5786..05794d9f95 100644 --- a/__fixtures__/v-next/outputv2/cosmos/crypto/hd/v1/hd.ts +++ b/__fixtures__/v-next/outputv2/cosmos/crypto/hd/v1/hd.ts @@ -99,6 +99,15 @@ function createBaseBIP44Params(): BIP44Params { export const BIP44Params = { typeUrl: "/cosmos.crypto.hd.v1.BIP44Params", aminoType: "cosmos-sdk/BIP44Params", + is(o: any): o is BIP44Params { + return o && (o.$typeUrl === BIP44Params.typeUrl || typeof o.purpose === "number" && typeof o.coinType === "number" && typeof o.account === "number" && typeof o.change === "boolean" && typeof o.addressIndex === "number"); + }, + isSDK(o: any): o is BIP44ParamsSDKType { + return o && (o.$typeUrl === BIP44Params.typeUrl || typeof o.purpose === "number" && typeof o.coin_type === "number" && typeof o.account === "number" && typeof o.change === "boolean" && typeof o.address_index === "number"); + }, + isAmino(o: any): o is BIP44ParamsAmino { + return o && (o.$typeUrl === BIP44Params.typeUrl || typeof o.purpose === "number" && typeof o.coin_type === "number" && typeof o.account === "number" && typeof o.change === "boolean" && typeof o.address_index === "number"); + }, encode(message: BIP44Params, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.purpose !== 0) { writer.uint32(8).uint32(message.purpose); @@ -239,5 +248,6 @@ export const BIP44Params = { typeUrl: "/cosmos.crypto.hd.v1.BIP44Params", value: BIP44Params.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/cosmos/crypto/keyring/v1/record.ts b/__fixtures__/v-next/outputv2/cosmos/crypto/keyring/v1/record.ts index 6aa250f088..a494576cbe 100644 --- a/__fixtures__/v-next/outputv2/cosmos/crypto/keyring/v1/record.ts +++ b/__fixtures__/v-next/outputv2/cosmos/crypto/keyring/v1/record.ts @@ -1,6 +1,7 @@ import { Any, AnyAmino, AnySDKType } from "../../../../google/protobuf/any"; import { BIP44Params, BIP44ParamsAmino, BIP44ParamsSDKType } from "../../hd/v1/hd"; import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { GlobalDecoderRegistry } from "../../../../registry"; import { isSet, DeepPartial } from "../../../../helpers"; import { JsonSafe } from "../../../../json-safe"; export const protobufPackage = "cosmos.crypto.keyring.v1"; @@ -243,6 +244,15 @@ function createBaseRecord(): Record { export const Record = { typeUrl: "/cosmos.crypto.keyring.v1.Record", aminoType: "cosmos-sdk/Record", + is(o: any): o is Record { + return o && (o.$typeUrl === Record.typeUrl || typeof o.name === "string"); + }, + isSDK(o: any): o is RecordSDKType { + return o && (o.$typeUrl === Record.typeUrl || typeof o.name === "string"); + }, + isAmino(o: any): o is RecordAmino { + return o && (o.$typeUrl === Record.typeUrl || typeof o.name === "string"); + }, encode(message: Record, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -408,6 +418,15 @@ export const Record = { typeUrl: "/cosmos.crypto.keyring.v1.Record", value: Record.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Record.typeUrl)) { + return; + } + Record_Local.registerTypeUrl(); + Record_Ledger.registerTypeUrl(); + Record_Multi.registerTypeUrl(); + Record_Offline.registerTypeUrl(); } }; function createBaseRecord_Local(): Record_Local { @@ -426,6 +445,15 @@ function createBaseRecord_Local(): Record_Local { export const Record_Local = { typeUrl: "/cosmos.crypto.keyring.v1.Local", aminoType: "cosmos-sdk/Local", + is(o: any): o is Record_Local { + return o && (o.$typeUrl === Record_Local.typeUrl || typeof o.privKeyType === "string"); + }, + isSDK(o: any): o is Record_LocalSDKType { + return o && (o.$typeUrl === Record_Local.typeUrl || typeof o.priv_key_type === "string"); + }, + isAmino(o: any): o is Record_LocalAmino { + return o && (o.$typeUrl === Record_Local.typeUrl || typeof o.priv_key_type === "string"); + }, encode(message: Record_Local, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.privKey !== undefined) { Any.encode(message.privKey, writer.uint32(10).fork()).ldelim(); @@ -523,7 +551,8 @@ export const Record_Local = { typeUrl: "/cosmos.crypto.keyring.v1.Local", value: Record_Local.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseRecord_Ledger(): Record_Ledger { return { @@ -539,6 +568,15 @@ function createBaseRecord_Ledger(): Record_Ledger { export const Record_Ledger = { typeUrl: "/cosmos.crypto.keyring.v1.Ledger", aminoType: "cosmos-sdk/Ledger", + is(o: any): o is Record_Ledger { + return o && o.$typeUrl === Record_Ledger.typeUrl; + }, + isSDK(o: any): o is Record_LedgerSDKType { + return o && o.$typeUrl === Record_Ledger.typeUrl; + }, + isAmino(o: any): o is Record_LedgerAmino { + return o && o.$typeUrl === Record_Ledger.typeUrl; + }, encode(message: Record_Ledger, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.path !== undefined) { BIP44Params.encode(message.path, writer.uint32(10).fork()).ldelim(); @@ -621,6 +659,12 @@ export const Record_Ledger = { typeUrl: "/cosmos.crypto.keyring.v1.Ledger", value: Record_Ledger.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Record_Ledger.typeUrl)) { + return; + } + BIP44Params.registerTypeUrl(); } }; function createBaseRecord_Multi(): Record_Multi { @@ -635,6 +679,15 @@ function createBaseRecord_Multi(): Record_Multi { export const Record_Multi = { typeUrl: "/cosmos.crypto.keyring.v1.Multi", aminoType: "cosmos-sdk/Multi", + is(o: any): o is Record_Multi { + return o && o.$typeUrl === Record_Multi.typeUrl; + }, + isSDK(o: any): o is Record_MultiSDKType { + return o && o.$typeUrl === Record_Multi.typeUrl; + }, + isAmino(o: any): o is Record_MultiAmino { + return o && o.$typeUrl === Record_Multi.typeUrl; + }, encode(_: Record_Multi, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -699,7 +752,8 @@ export const Record_Multi = { typeUrl: "/cosmos.crypto.keyring.v1.Multi", value: Record_Multi.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseRecord_Offline(): Record_Offline { return {}; @@ -713,6 +767,15 @@ function createBaseRecord_Offline(): Record_Offline { export const Record_Offline = { typeUrl: "/cosmos.crypto.keyring.v1.Offline", aminoType: "cosmos-sdk/Offline", + is(o: any): o is Record_Offline { + return o && o.$typeUrl === Record_Offline.typeUrl; + }, + isSDK(o: any): o is Record_OfflineSDKType { + return o && o.$typeUrl === Record_Offline.typeUrl; + }, + isAmino(o: any): o is Record_OfflineAmino { + return o && o.$typeUrl === Record_Offline.typeUrl; + }, encode(_: Record_Offline, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -777,5 +840,6 @@ export const Record_Offline = { typeUrl: "/cosmos.crypto.keyring.v1.Offline", value: Record_Offline.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/cosmos/crypto/multisig/keys.ts b/__fixtures__/v-next/outputv2/cosmos/crypto/multisig/keys.ts index e1b972a8c0..1dbf0b56d8 100644 --- a/__fixtures__/v-next/outputv2/cosmos/crypto/multisig/keys.ts +++ b/__fixtures__/v-next/outputv2/cosmos/crypto/multisig/keys.ts @@ -64,6 +64,15 @@ function createBaseLegacyAminoPubKey(): LegacyAminoPubKey { export const LegacyAminoPubKey = { typeUrl: "/cosmos.crypto.multisig.LegacyAminoPubKey", aminoType: "cosmos-sdk/LegacyAminoPubKey", + is(o: any): o is LegacyAminoPubKey { + return o && (o.$typeUrl === LegacyAminoPubKey.typeUrl || typeof o.threshold === "number" && Array.isArray(o.publicKeys) && (!o.publicKeys.length || Any.is(o.publicKeys[0]))); + }, + isSDK(o: any): o is LegacyAminoPubKeySDKType { + return o && (o.$typeUrl === LegacyAminoPubKey.typeUrl || typeof o.threshold === "number" && Array.isArray(o.public_keys) && (!o.public_keys.length || Any.isSDK(o.public_keys[0]))); + }, + isAmino(o: any): o is LegacyAminoPubKeyAmino { + return o && (o.$typeUrl === LegacyAminoPubKey.typeUrl || typeof o.threshold === "number" && Array.isArray(o.public_keys) && (!o.public_keys.length || Any.isAmino(o.public_keys[0]))); + }, encode(message: LegacyAminoPubKey, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.threshold !== 0) { writer.uint32(8).uint32(message.threshold); @@ -169,5 +178,6 @@ export const LegacyAminoPubKey = { typeUrl: "/cosmos.crypto.multisig.LegacyAminoPubKey", value: LegacyAminoPubKey.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/cosmos/crypto/multisig/v1beta1/multisig.ts b/__fixtures__/v-next/outputv2/cosmos/crypto/multisig/v1beta1/multisig.ts index 8378ad9e9e..a522c8278c 100644 --- a/__fixtures__/v-next/outputv2/cosmos/crypto/multisig/v1beta1/multisig.ts +++ b/__fixtures__/v-next/outputv2/cosmos/crypto/multisig/v1beta1/multisig.ts @@ -106,6 +106,15 @@ function createBaseMultiSignature(): MultiSignature { export const MultiSignature = { typeUrl: "/cosmos.crypto.multisig.v1beta1.MultiSignature", aminoType: "cosmos-sdk/MultiSignature", + is(o: any): o is MultiSignature { + return o && (o.$typeUrl === MultiSignature.typeUrl || Array.isArray(o.signatures) && (!o.signatures.length || o.signatures[0] instanceof Uint8Array || typeof o.signatures[0] === "string")); + }, + isSDK(o: any): o is MultiSignatureSDKType { + return o && (o.$typeUrl === MultiSignature.typeUrl || Array.isArray(o.signatures) && (!o.signatures.length || o.signatures[0] instanceof Uint8Array || typeof o.signatures[0] === "string")); + }, + isAmino(o: any): o is MultiSignatureAmino { + return o && (o.$typeUrl === MultiSignature.typeUrl || Array.isArray(o.signatures) && (!o.signatures.length || o.signatures[0] instanceof Uint8Array || typeof o.signatures[0] === "string")); + }, encode(message: MultiSignature, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.signatures) { writer.uint32(10).bytes(v!); @@ -196,7 +205,8 @@ export const MultiSignature = { typeUrl: "/cosmos.crypto.multisig.v1beta1.MultiSignature", value: MultiSignature.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseCompactBitArray(): CompactBitArray { return { @@ -216,6 +226,15 @@ function createBaseCompactBitArray(): CompactBitArray { export const CompactBitArray = { typeUrl: "/cosmos.crypto.multisig.v1beta1.CompactBitArray", aminoType: "cosmos-sdk/CompactBitArray", + is(o: any): o is CompactBitArray { + return o && (o.$typeUrl === CompactBitArray.typeUrl || typeof o.extraBitsStored === "number" && (o.elems instanceof Uint8Array || typeof o.elems === "string")); + }, + isSDK(o: any): o is CompactBitArraySDKType { + return o && (o.$typeUrl === CompactBitArray.typeUrl || typeof o.extra_bits_stored === "number" && (o.elems instanceof Uint8Array || typeof o.elems === "string")); + }, + isAmino(o: any): o is CompactBitArrayAmino { + return o && (o.$typeUrl === CompactBitArray.typeUrl || typeof o.extra_bits_stored === "number" && (o.elems instanceof Uint8Array || typeof o.elems === "string")); + }, encode(message: CompactBitArray, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.extraBitsStored !== 0) { writer.uint32(8).uint32(message.extraBitsStored); @@ -311,5 +330,6 @@ export const CompactBitArray = { typeUrl: "/cosmos.crypto.multisig.v1beta1.CompactBitArray", value: CompactBitArray.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/cosmos/crypto/secp256k1/keys.ts b/__fixtures__/v-next/outputv2/cosmos/crypto/secp256k1/keys.ts index 54f424745a..139b3951ad 100644 --- a/__fixtures__/v-next/outputv2/cosmos/crypto/secp256k1/keys.ts +++ b/__fixtures__/v-next/outputv2/cosmos/crypto/secp256k1/keys.ts @@ -102,6 +102,15 @@ function createBasePubKey(): PubKey { export const PubKey = { typeUrl: "/cosmos.crypto.secp256k1.PubKey", aminoType: "cosmos-sdk/PubKey", + is(o: any): o is PubKey { + return o && (o.$typeUrl === PubKey.typeUrl || o.key instanceof Uint8Array || typeof o.key === "string"); + }, + isSDK(o: any): o is PubKeySDKType { + return o && (o.$typeUrl === PubKey.typeUrl || o.key instanceof Uint8Array || typeof o.key === "string"); + }, + isAmino(o: any): o is PubKeyAmino { + return o && (o.$typeUrl === PubKey.typeUrl || o.key instanceof Uint8Array || typeof o.key === "string"); + }, encode(message: PubKey, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.key.length !== 0) { writer.uint32(10).bytes(message.key); @@ -182,7 +191,8 @@ export const PubKey = { typeUrl: "/cosmos.crypto.secp256k1.PubKey", value: PubKey.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBasePrivKey(): PrivKey { return { @@ -198,6 +208,15 @@ function createBasePrivKey(): PrivKey { export const PrivKey = { typeUrl: "/cosmos.crypto.secp256k1.PrivKey", aminoType: "cosmos-sdk/PrivKey", + is(o: any): o is PrivKey { + return o && (o.$typeUrl === PrivKey.typeUrl || o.key instanceof Uint8Array || typeof o.key === "string"); + }, + isSDK(o: any): o is PrivKeySDKType { + return o && (o.$typeUrl === PrivKey.typeUrl || o.key instanceof Uint8Array || typeof o.key === "string"); + }, + isAmino(o: any): o is PrivKeyAmino { + return o && (o.$typeUrl === PrivKey.typeUrl || o.key instanceof Uint8Array || typeof o.key === "string"); + }, encode(message: PrivKey, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.key.length !== 0) { writer.uint32(10).bytes(message.key); @@ -278,5 +297,6 @@ export const PrivKey = { typeUrl: "/cosmos.crypto.secp256k1.PrivKey", value: PrivKey.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/cosmos/crypto/secp256r1/keys.ts b/__fixtures__/v-next/outputv2/cosmos/crypto/secp256r1/keys.ts index f388c3c221..991503de9c 100644 --- a/__fixtures__/v-next/outputv2/cosmos/crypto/secp256r1/keys.ts +++ b/__fixtures__/v-next/outputv2/cosmos/crypto/secp256r1/keys.ts @@ -100,6 +100,15 @@ function createBasePubKey(): PubKey { export const PubKey = { typeUrl: "/cosmos.crypto.secp256r1.PubKey", aminoType: "cosmos-sdk/PubKey", + is(o: any): o is PubKey { + return o && (o.$typeUrl === PubKey.typeUrl || o.key instanceof Uint8Array || typeof o.key === "string"); + }, + isSDK(o: any): o is PubKeySDKType { + return o && (o.$typeUrl === PubKey.typeUrl || o.key instanceof Uint8Array || typeof o.key === "string"); + }, + isAmino(o: any): o is PubKeyAmino { + return o && (o.$typeUrl === PubKey.typeUrl || o.key instanceof Uint8Array || typeof o.key === "string"); + }, encode(message: PubKey, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.key.length !== 0) { writer.uint32(10).bytes(message.key); @@ -180,7 +189,8 @@ export const PubKey = { typeUrl: "/cosmos.crypto.secp256r1.PubKey", value: PubKey.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBasePrivKey(): PrivKey { return { @@ -196,6 +206,15 @@ function createBasePrivKey(): PrivKey { export const PrivKey = { typeUrl: "/cosmos.crypto.secp256r1.PrivKey", aminoType: "cosmos-sdk/PrivKey", + is(o: any): o is PrivKey { + return o && (o.$typeUrl === PrivKey.typeUrl || o.secret instanceof Uint8Array || typeof o.secret === "string"); + }, + isSDK(o: any): o is PrivKeySDKType { + return o && (o.$typeUrl === PrivKey.typeUrl || o.secret instanceof Uint8Array || typeof o.secret === "string"); + }, + isAmino(o: any): o is PrivKeyAmino { + return o && (o.$typeUrl === PrivKey.typeUrl || o.secret instanceof Uint8Array || typeof o.secret === "string"); + }, encode(message: PrivKey, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.secret.length !== 0) { writer.uint32(10).bytes(message.secret); @@ -276,5 +295,6 @@ export const PrivKey = { typeUrl: "/cosmos.crypto.secp256r1.PrivKey", value: PrivKey.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/cosmos/distribution/v1beta1/distribution.ts b/__fixtures__/v-next/outputv2/cosmos/distribution/v1beta1/distribution.ts index b7db31e6e1..45ba909d6b 100644 --- a/__fixtures__/v-next/outputv2/cosmos/distribution/v1beta1/distribution.ts +++ b/__fixtures__/v-next/outputv2/cosmos/distribution/v1beta1/distribution.ts @@ -1,8 +1,9 @@ import { DecCoin, DecCoinAmino, DecCoinSDKType, Coin, CoinAmino, CoinSDKType } from "../../base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { Decimal } from "@cosmjs/math"; +import { Decimal } from "@interchainjs/math"; import { isSet, DeepPartial } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "cosmos.distribution.v1beta1"; /** * Params defines the set of params for the distribution module. @@ -570,6 +571,15 @@ function createBaseParams(): Params { export const Params = { typeUrl: "/cosmos.distribution.v1beta1.Params", aminoType: "cosmos-sdk/Params", + is(o: any): o is Params { + return o && (o.$typeUrl === Params.typeUrl || typeof o.communityTax === "string" && typeof o.baseProposerReward === "string" && typeof o.bonusProposerReward === "string" && typeof o.withdrawAddrEnabled === "boolean"); + }, + isSDK(o: any): o is ParamsSDKType { + return o && (o.$typeUrl === Params.typeUrl || typeof o.community_tax === "string" && typeof o.base_proposer_reward === "string" && typeof o.bonus_proposer_reward === "string" && typeof o.withdraw_addr_enabled === "boolean"); + }, + isAmino(o: any): o is ParamsAmino { + return o && (o.$typeUrl === Params.typeUrl || typeof o.community_tax === "string" && typeof o.base_proposer_reward === "string" && typeof o.bonus_proposer_reward === "string" && typeof o.withdraw_addr_enabled === "boolean"); + }, encode(message: Params, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.communityTax !== "") { writer.uint32(10).string(Decimal.fromUserInput(message.communityTax, 18).atomics); @@ -669,9 +679,9 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.community_tax = message.communityTax === "" ? undefined : message.communityTax; - obj.base_proposer_reward = message.baseProposerReward === "" ? undefined : message.baseProposerReward; - obj.bonus_proposer_reward = message.bonusProposerReward === "" ? undefined : message.bonusProposerReward; + obj.community_tax = message.communityTax === "" ? undefined : Decimal.fromUserInput(message.communityTax, 18).atomics; + obj.base_proposer_reward = message.baseProposerReward === "" ? undefined : Decimal.fromUserInput(message.baseProposerReward, 18).atomics; + obj.bonus_proposer_reward = message.bonusProposerReward === "" ? undefined : Decimal.fromUserInput(message.bonusProposerReward, 18).atomics; obj.withdraw_addr_enabled = message.withdrawAddrEnabled === false ? undefined : message.withdrawAddrEnabled; return obj; }, @@ -695,7 +705,8 @@ export const Params = { typeUrl: "/cosmos.distribution.v1beta1.Params", value: Params.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseValidatorHistoricalRewards(): ValidatorHistoricalRewards { return { @@ -723,6 +734,15 @@ function createBaseValidatorHistoricalRewards(): ValidatorHistoricalRewards { export const ValidatorHistoricalRewards = { typeUrl: "/cosmos.distribution.v1beta1.ValidatorHistoricalRewards", aminoType: "cosmos-sdk/ValidatorHistoricalRewards", + is(o: any): o is ValidatorHistoricalRewards { + return o && (o.$typeUrl === ValidatorHistoricalRewards.typeUrl || Array.isArray(o.cumulativeRewardRatio) && (!o.cumulativeRewardRatio.length || DecCoin.is(o.cumulativeRewardRatio[0])) && typeof o.referenceCount === "number"); + }, + isSDK(o: any): o is ValidatorHistoricalRewardsSDKType { + return o && (o.$typeUrl === ValidatorHistoricalRewards.typeUrl || Array.isArray(o.cumulative_reward_ratio) && (!o.cumulative_reward_ratio.length || DecCoin.isSDK(o.cumulative_reward_ratio[0])) && typeof o.reference_count === "number"); + }, + isAmino(o: any): o is ValidatorHistoricalRewardsAmino { + return o && (o.$typeUrl === ValidatorHistoricalRewards.typeUrl || Array.isArray(o.cumulative_reward_ratio) && (!o.cumulative_reward_ratio.length || DecCoin.isAmino(o.cumulative_reward_ratio[0])) && typeof o.reference_count === "number"); + }, encode(message: ValidatorHistoricalRewards, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.cumulativeRewardRatio) { DecCoin.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -828,6 +848,12 @@ export const ValidatorHistoricalRewards = { typeUrl: "/cosmos.distribution.v1beta1.ValidatorHistoricalRewards", value: ValidatorHistoricalRewards.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ValidatorHistoricalRewards.typeUrl)) { + return; + } + DecCoin.registerTypeUrl(); } }; function createBaseValidatorCurrentRewards(): ValidatorCurrentRewards { @@ -847,6 +873,15 @@ function createBaseValidatorCurrentRewards(): ValidatorCurrentRewards { export const ValidatorCurrentRewards = { typeUrl: "/cosmos.distribution.v1beta1.ValidatorCurrentRewards", aminoType: "cosmos-sdk/ValidatorCurrentRewards", + is(o: any): o is ValidatorCurrentRewards { + return o && (o.$typeUrl === ValidatorCurrentRewards.typeUrl || Array.isArray(o.rewards) && (!o.rewards.length || DecCoin.is(o.rewards[0])) && typeof o.period === "bigint"); + }, + isSDK(o: any): o is ValidatorCurrentRewardsSDKType { + return o && (o.$typeUrl === ValidatorCurrentRewards.typeUrl || Array.isArray(o.rewards) && (!o.rewards.length || DecCoin.isSDK(o.rewards[0])) && typeof o.period === "bigint"); + }, + isAmino(o: any): o is ValidatorCurrentRewardsAmino { + return o && (o.$typeUrl === ValidatorCurrentRewards.typeUrl || Array.isArray(o.rewards) && (!o.rewards.length || DecCoin.isAmino(o.rewards[0])) && typeof o.period === "bigint"); + }, encode(message: ValidatorCurrentRewards, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.rewards) { DecCoin.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -954,6 +989,12 @@ export const ValidatorCurrentRewards = { typeUrl: "/cosmos.distribution.v1beta1.ValidatorCurrentRewards", value: ValidatorCurrentRewards.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ValidatorCurrentRewards.typeUrl)) { + return; + } + DecCoin.registerTypeUrl(); } }; function createBaseValidatorAccumulatedCommission(): ValidatorAccumulatedCommission { @@ -971,6 +1012,15 @@ function createBaseValidatorAccumulatedCommission(): ValidatorAccumulatedCommiss export const ValidatorAccumulatedCommission = { typeUrl: "/cosmos.distribution.v1beta1.ValidatorAccumulatedCommission", aminoType: "cosmos-sdk/ValidatorAccumulatedCommission", + is(o: any): o is ValidatorAccumulatedCommission { + return o && (o.$typeUrl === ValidatorAccumulatedCommission.typeUrl || Array.isArray(o.commission) && (!o.commission.length || DecCoin.is(o.commission[0]))); + }, + isSDK(o: any): o is ValidatorAccumulatedCommissionSDKType { + return o && (o.$typeUrl === ValidatorAccumulatedCommission.typeUrl || Array.isArray(o.commission) && (!o.commission.length || DecCoin.isSDK(o.commission[0]))); + }, + isAmino(o: any): o is ValidatorAccumulatedCommissionAmino { + return o && (o.$typeUrl === ValidatorAccumulatedCommission.typeUrl || Array.isArray(o.commission) && (!o.commission.length || DecCoin.isAmino(o.commission[0]))); + }, encode(message: ValidatorAccumulatedCommission, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.commission) { DecCoin.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -1061,6 +1111,12 @@ export const ValidatorAccumulatedCommission = { typeUrl: "/cosmos.distribution.v1beta1.ValidatorAccumulatedCommission", value: ValidatorAccumulatedCommission.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ValidatorAccumulatedCommission.typeUrl)) { + return; + } + DecCoin.registerTypeUrl(); } }; function createBaseValidatorOutstandingRewards(): ValidatorOutstandingRewards { @@ -1078,6 +1134,15 @@ function createBaseValidatorOutstandingRewards(): ValidatorOutstandingRewards { export const ValidatorOutstandingRewards = { typeUrl: "/cosmos.distribution.v1beta1.ValidatorOutstandingRewards", aminoType: "cosmos-sdk/ValidatorOutstandingRewards", + is(o: any): o is ValidatorOutstandingRewards { + return o && (o.$typeUrl === ValidatorOutstandingRewards.typeUrl || Array.isArray(o.rewards) && (!o.rewards.length || DecCoin.is(o.rewards[0]))); + }, + isSDK(o: any): o is ValidatorOutstandingRewardsSDKType { + return o && (o.$typeUrl === ValidatorOutstandingRewards.typeUrl || Array.isArray(o.rewards) && (!o.rewards.length || DecCoin.isSDK(o.rewards[0]))); + }, + isAmino(o: any): o is ValidatorOutstandingRewardsAmino { + return o && (o.$typeUrl === ValidatorOutstandingRewards.typeUrl || Array.isArray(o.rewards) && (!o.rewards.length || DecCoin.isAmino(o.rewards[0]))); + }, encode(message: ValidatorOutstandingRewards, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.rewards) { DecCoin.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -1168,6 +1233,12 @@ export const ValidatorOutstandingRewards = { typeUrl: "/cosmos.distribution.v1beta1.ValidatorOutstandingRewards", value: ValidatorOutstandingRewards.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ValidatorOutstandingRewards.typeUrl)) { + return; + } + DecCoin.registerTypeUrl(); } }; function createBaseValidatorSlashEvent(): ValidatorSlashEvent { @@ -1188,6 +1259,15 @@ function createBaseValidatorSlashEvent(): ValidatorSlashEvent { export const ValidatorSlashEvent = { typeUrl: "/cosmos.distribution.v1beta1.ValidatorSlashEvent", aminoType: "cosmos-sdk/ValidatorSlashEvent", + is(o: any): o is ValidatorSlashEvent { + return o && (o.$typeUrl === ValidatorSlashEvent.typeUrl || typeof o.validatorPeriod === "bigint" && typeof o.fraction === "string"); + }, + isSDK(o: any): o is ValidatorSlashEventSDKType { + return o && (o.$typeUrl === ValidatorSlashEvent.typeUrl || typeof o.validator_period === "bigint" && typeof o.fraction === "string"); + }, + isAmino(o: any): o is ValidatorSlashEventAmino { + return o && (o.$typeUrl === ValidatorSlashEvent.typeUrl || typeof o.validator_period === "bigint" && typeof o.fraction === "string"); + }, encode(message: ValidatorSlashEvent, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.validatorPeriod !== BigInt(0)) { writer.uint32(8).uint64(message.validatorPeriod); @@ -1262,7 +1342,7 @@ export const ValidatorSlashEvent = { toAmino(message: ValidatorSlashEvent): ValidatorSlashEventAmino { const obj: any = {}; obj.validator_period = message.validatorPeriod !== BigInt(0) ? message.validatorPeriod?.toString() : undefined; - obj.fraction = message.fraction === "" ? undefined : message.fraction; + obj.fraction = message.fraction === "" ? undefined : Decimal.fromUserInput(message.fraction, 18).atomics; return obj; }, fromAminoMsg(object: ValidatorSlashEventAminoMsg): ValidatorSlashEvent { @@ -1285,7 +1365,8 @@ export const ValidatorSlashEvent = { typeUrl: "/cosmos.distribution.v1beta1.ValidatorSlashEvent", value: ValidatorSlashEvent.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseValidatorSlashEvents(): ValidatorSlashEvents { return { @@ -1301,6 +1382,15 @@ function createBaseValidatorSlashEvents(): ValidatorSlashEvents { export const ValidatorSlashEvents = { typeUrl: "/cosmos.distribution.v1beta1.ValidatorSlashEvents", aminoType: "cosmos-sdk/ValidatorSlashEvents", + is(o: any): o is ValidatorSlashEvents { + return o && (o.$typeUrl === ValidatorSlashEvents.typeUrl || Array.isArray(o.validatorSlashEvents) && (!o.validatorSlashEvents.length || ValidatorSlashEvent.is(o.validatorSlashEvents[0]))); + }, + isSDK(o: any): o is ValidatorSlashEventsSDKType { + return o && (o.$typeUrl === ValidatorSlashEvents.typeUrl || Array.isArray(o.validator_slash_events) && (!o.validator_slash_events.length || ValidatorSlashEvent.isSDK(o.validator_slash_events[0]))); + }, + isAmino(o: any): o is ValidatorSlashEventsAmino { + return o && (o.$typeUrl === ValidatorSlashEvents.typeUrl || Array.isArray(o.validator_slash_events) && (!o.validator_slash_events.length || ValidatorSlashEvent.isAmino(o.validator_slash_events[0]))); + }, encode(message: ValidatorSlashEvents, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.validatorSlashEvents) { ValidatorSlashEvent.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -1391,6 +1481,12 @@ export const ValidatorSlashEvents = { typeUrl: "/cosmos.distribution.v1beta1.ValidatorSlashEvents", value: ValidatorSlashEvents.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ValidatorSlashEvents.typeUrl)) { + return; + } + ValidatorSlashEvent.registerTypeUrl(); } }; function createBaseFeePool(): FeePool { @@ -1407,6 +1503,15 @@ function createBaseFeePool(): FeePool { export const FeePool = { typeUrl: "/cosmos.distribution.v1beta1.FeePool", aminoType: "cosmos-sdk/FeePool", + is(o: any): o is FeePool { + return o && (o.$typeUrl === FeePool.typeUrl || Array.isArray(o.communityPool) && (!o.communityPool.length || DecCoin.is(o.communityPool[0]))); + }, + isSDK(o: any): o is FeePoolSDKType { + return o && (o.$typeUrl === FeePool.typeUrl || Array.isArray(o.community_pool) && (!o.community_pool.length || DecCoin.isSDK(o.community_pool[0]))); + }, + isAmino(o: any): o is FeePoolAmino { + return o && (o.$typeUrl === FeePool.typeUrl || Array.isArray(o.community_pool) && (!o.community_pool.length || DecCoin.isAmino(o.community_pool[0]))); + }, encode(message: FeePool, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.communityPool) { DecCoin.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -1497,6 +1602,12 @@ export const FeePool = { typeUrl: "/cosmos.distribution.v1beta1.FeePool", value: FeePool.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(FeePool.typeUrl)) { + return; + } + DecCoin.registerTypeUrl(); } }; function createBaseCommunityPoolSpendProposal(): CommunityPoolSpendProposal { @@ -1518,6 +1629,15 @@ function createBaseCommunityPoolSpendProposal(): CommunityPoolSpendProposal { export const CommunityPoolSpendProposal = { typeUrl: "/cosmos.distribution.v1beta1.CommunityPoolSpendProposal", aminoType: "cosmos-sdk/CommunityPoolSpendProposal", + is(o: any): o is CommunityPoolSpendProposal { + return o && (o.$typeUrl === CommunityPoolSpendProposal.typeUrl || typeof o.title === "string" && typeof o.description === "string" && typeof o.recipient === "string" && Array.isArray(o.amount) && (!o.amount.length || Coin.is(o.amount[0]))); + }, + isSDK(o: any): o is CommunityPoolSpendProposalSDKType { + return o && (o.$typeUrl === CommunityPoolSpendProposal.typeUrl || typeof o.title === "string" && typeof o.description === "string" && typeof o.recipient === "string" && Array.isArray(o.amount) && (!o.amount.length || Coin.isSDK(o.amount[0]))); + }, + isAmino(o: any): o is CommunityPoolSpendProposalAmino { + return o && (o.$typeUrl === CommunityPoolSpendProposal.typeUrl || typeof o.title === "string" && typeof o.description === "string" && typeof o.recipient === "string" && Array.isArray(o.amount) && (!o.amount.length || Coin.isAmino(o.amount[0]))); + }, encode(message: CommunityPoolSpendProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.title !== "") { writer.uint32(10).string(message.title); @@ -1653,6 +1773,12 @@ export const CommunityPoolSpendProposal = { typeUrl: "/cosmos.distribution.v1beta1.CommunityPoolSpendProposal", value: CommunityPoolSpendProposal.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(CommunityPoolSpendProposal.typeUrl)) { + return; + } + Coin.registerTypeUrl(); } }; function createBaseDelegatorStartingInfo(): DelegatorStartingInfo { @@ -1676,6 +1802,15 @@ function createBaseDelegatorStartingInfo(): DelegatorStartingInfo { export const DelegatorStartingInfo = { typeUrl: "/cosmos.distribution.v1beta1.DelegatorStartingInfo", aminoType: "cosmos-sdk/DelegatorStartingInfo", + is(o: any): o is DelegatorStartingInfo { + return o && (o.$typeUrl === DelegatorStartingInfo.typeUrl || typeof o.previousPeriod === "bigint" && typeof o.stake === "string" && typeof o.height === "bigint"); + }, + isSDK(o: any): o is DelegatorStartingInfoSDKType { + return o && (o.$typeUrl === DelegatorStartingInfo.typeUrl || typeof o.previous_period === "bigint" && typeof o.stake === "string" && typeof o.height === "bigint"); + }, + isAmino(o: any): o is DelegatorStartingInfoAmino { + return o && (o.$typeUrl === DelegatorStartingInfo.typeUrl || typeof o.previous_period === "bigint" && typeof o.stake === "string" && typeof o.height === "bigint"); + }, encode(message: DelegatorStartingInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.previousPeriod !== BigInt(0)) { writer.uint32(8).uint64(message.previousPeriod); @@ -1766,7 +1901,7 @@ export const DelegatorStartingInfo = { toAmino(message: DelegatorStartingInfo): DelegatorStartingInfoAmino { const obj: any = {}; obj.previous_period = message.previousPeriod !== BigInt(0) ? message.previousPeriod?.toString() : undefined; - obj.stake = message.stake === "" ? undefined : message.stake; + obj.stake = message.stake === "" ? undefined : Decimal.fromUserInput(message.stake, 18).atomics; obj.height = message.height ? message.height?.toString() : "0"; return obj; }, @@ -1790,7 +1925,8 @@ export const DelegatorStartingInfo = { typeUrl: "/cosmos.distribution.v1beta1.DelegatorStartingInfo", value: DelegatorStartingInfo.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseDelegationDelegatorReward(): DelegationDelegatorReward { return { @@ -1808,6 +1944,15 @@ function createBaseDelegationDelegatorReward(): DelegationDelegatorReward { export const DelegationDelegatorReward = { typeUrl: "/cosmos.distribution.v1beta1.DelegationDelegatorReward", aminoType: "cosmos-sdk/DelegationDelegatorReward", + is(o: any): o is DelegationDelegatorReward { + return o && (o.$typeUrl === DelegationDelegatorReward.typeUrl || typeof o.validatorAddress === "string" && Array.isArray(o.reward) && (!o.reward.length || DecCoin.is(o.reward[0]))); + }, + isSDK(o: any): o is DelegationDelegatorRewardSDKType { + return o && (o.$typeUrl === DelegationDelegatorReward.typeUrl || typeof o.validator_address === "string" && Array.isArray(o.reward) && (!o.reward.length || DecCoin.isSDK(o.reward[0]))); + }, + isAmino(o: any): o is DelegationDelegatorRewardAmino { + return o && (o.$typeUrl === DelegationDelegatorReward.typeUrl || typeof o.validator_address === "string" && Array.isArray(o.reward) && (!o.reward.length || DecCoin.isAmino(o.reward[0]))); + }, encode(message: DelegationDelegatorReward, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.validatorAddress !== "") { writer.uint32(10).string(message.validatorAddress); @@ -1913,6 +2058,12 @@ export const DelegationDelegatorReward = { typeUrl: "/cosmos.distribution.v1beta1.DelegationDelegatorReward", value: DelegationDelegatorReward.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(DelegationDelegatorReward.typeUrl)) { + return; + } + DecCoin.registerTypeUrl(); } }; function createBaseCommunityPoolSpendProposalWithDeposit(): CommunityPoolSpendProposalWithDeposit { @@ -1934,6 +2085,15 @@ function createBaseCommunityPoolSpendProposalWithDeposit(): CommunityPoolSpendPr export const CommunityPoolSpendProposalWithDeposit = { typeUrl: "/cosmos.distribution.v1beta1.CommunityPoolSpendProposalWithDeposit", aminoType: "cosmos-sdk/CommunityPoolSpendProposalWithDeposit", + is(o: any): o is CommunityPoolSpendProposalWithDeposit { + return o && (o.$typeUrl === CommunityPoolSpendProposalWithDeposit.typeUrl || typeof o.title === "string" && typeof o.description === "string" && typeof o.recipient === "string" && typeof o.amount === "string" && typeof o.deposit === "string"); + }, + isSDK(o: any): o is CommunityPoolSpendProposalWithDepositSDKType { + return o && (o.$typeUrl === CommunityPoolSpendProposalWithDeposit.typeUrl || typeof o.title === "string" && typeof o.description === "string" && typeof o.recipient === "string" && typeof o.amount === "string" && typeof o.deposit === "string"); + }, + isAmino(o: any): o is CommunityPoolSpendProposalWithDepositAmino { + return o && (o.$typeUrl === CommunityPoolSpendProposalWithDeposit.typeUrl || typeof o.title === "string" && typeof o.description === "string" && typeof o.recipient === "string" && typeof o.amount === "string" && typeof o.deposit === "string"); + }, encode(message: CommunityPoolSpendProposalWithDeposit, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.title !== "") { writer.uint32(10).string(message.title); @@ -2074,5 +2234,6 @@ export const CommunityPoolSpendProposalWithDeposit = { typeUrl: "/cosmos.distribution.v1beta1.CommunityPoolSpendProposalWithDeposit", value: CommunityPoolSpendProposalWithDeposit.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/cosmos/distribution/v1beta1/genesis.ts b/__fixtures__/v-next/outputv2/cosmos/distribution/v1beta1/genesis.ts index ff6829fc96..c6bf291f76 100644 --- a/__fixtures__/v-next/outputv2/cosmos/distribution/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv2/cosmos/distribution/v1beta1/genesis.ts @@ -3,6 +3,7 @@ import { ValidatorAccumulatedCommission, ValidatorAccumulatedCommissionAmino, Va import { BinaryReader, BinaryWriter } from "../../../binary"; import { isSet, DeepPartial } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "cosmos.distribution.v1beta1"; /** * DelegatorWithdrawInfo is the address for where distributions rewards are @@ -541,6 +542,15 @@ function createBaseDelegatorWithdrawInfo(): DelegatorWithdrawInfo { export const DelegatorWithdrawInfo = { typeUrl: "/cosmos.distribution.v1beta1.DelegatorWithdrawInfo", aminoType: "cosmos-sdk/DelegatorWithdrawInfo", + is(o: any): o is DelegatorWithdrawInfo { + return o && (o.$typeUrl === DelegatorWithdrawInfo.typeUrl || typeof o.delegatorAddress === "string" && typeof o.withdrawAddress === "string"); + }, + isSDK(o: any): o is DelegatorWithdrawInfoSDKType { + return o && (o.$typeUrl === DelegatorWithdrawInfo.typeUrl || typeof o.delegator_address === "string" && typeof o.withdraw_address === "string"); + }, + isAmino(o: any): o is DelegatorWithdrawInfoAmino { + return o && (o.$typeUrl === DelegatorWithdrawInfo.typeUrl || typeof o.delegator_address === "string" && typeof o.withdraw_address === "string"); + }, encode(message: DelegatorWithdrawInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.delegatorAddress !== "") { writer.uint32(10).string(message.delegatorAddress); @@ -636,7 +646,8 @@ export const DelegatorWithdrawInfo = { typeUrl: "/cosmos.distribution.v1beta1.DelegatorWithdrawInfo", value: DelegatorWithdrawInfo.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseValidatorOutstandingRewardsRecord(): ValidatorOutstandingRewardsRecord { return { @@ -653,6 +664,15 @@ function createBaseValidatorOutstandingRewardsRecord(): ValidatorOutstandingRewa export const ValidatorOutstandingRewardsRecord = { typeUrl: "/cosmos.distribution.v1beta1.ValidatorOutstandingRewardsRecord", aminoType: "cosmos-sdk/ValidatorOutstandingRewardsRecord", + is(o: any): o is ValidatorOutstandingRewardsRecord { + return o && (o.$typeUrl === ValidatorOutstandingRewardsRecord.typeUrl || typeof o.validatorAddress === "string" && Array.isArray(o.outstandingRewards) && (!o.outstandingRewards.length || DecCoin.is(o.outstandingRewards[0]))); + }, + isSDK(o: any): o is ValidatorOutstandingRewardsRecordSDKType { + return o && (o.$typeUrl === ValidatorOutstandingRewardsRecord.typeUrl || typeof o.validator_address === "string" && Array.isArray(o.outstanding_rewards) && (!o.outstanding_rewards.length || DecCoin.isSDK(o.outstanding_rewards[0]))); + }, + isAmino(o: any): o is ValidatorOutstandingRewardsRecordAmino { + return o && (o.$typeUrl === ValidatorOutstandingRewardsRecord.typeUrl || typeof o.validator_address === "string" && Array.isArray(o.outstanding_rewards) && (!o.outstanding_rewards.length || DecCoin.isAmino(o.outstanding_rewards[0]))); + }, encode(message: ValidatorOutstandingRewardsRecord, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.validatorAddress !== "") { writer.uint32(10).string(message.validatorAddress); @@ -758,6 +778,12 @@ export const ValidatorOutstandingRewardsRecord = { typeUrl: "/cosmos.distribution.v1beta1.ValidatorOutstandingRewardsRecord", value: ValidatorOutstandingRewardsRecord.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ValidatorOutstandingRewardsRecord.typeUrl)) { + return; + } + DecCoin.registerTypeUrl(); } }; function createBaseValidatorAccumulatedCommissionRecord(): ValidatorAccumulatedCommissionRecord { @@ -776,6 +802,15 @@ function createBaseValidatorAccumulatedCommissionRecord(): ValidatorAccumulatedC export const ValidatorAccumulatedCommissionRecord = { typeUrl: "/cosmos.distribution.v1beta1.ValidatorAccumulatedCommissionRecord", aminoType: "cosmos-sdk/ValidatorAccumulatedCommissionRecord", + is(o: any): o is ValidatorAccumulatedCommissionRecord { + return o && (o.$typeUrl === ValidatorAccumulatedCommissionRecord.typeUrl || typeof o.validatorAddress === "string" && ValidatorAccumulatedCommission.is(o.accumulated)); + }, + isSDK(o: any): o is ValidatorAccumulatedCommissionRecordSDKType { + return o && (o.$typeUrl === ValidatorAccumulatedCommissionRecord.typeUrl || typeof o.validator_address === "string" && ValidatorAccumulatedCommission.isSDK(o.accumulated)); + }, + isAmino(o: any): o is ValidatorAccumulatedCommissionRecordAmino { + return o && (o.$typeUrl === ValidatorAccumulatedCommissionRecord.typeUrl || typeof o.validator_address === "string" && ValidatorAccumulatedCommission.isAmino(o.accumulated)); + }, encode(message: ValidatorAccumulatedCommissionRecord, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.validatorAddress !== "") { writer.uint32(10).string(message.validatorAddress); @@ -873,6 +908,12 @@ export const ValidatorAccumulatedCommissionRecord = { typeUrl: "/cosmos.distribution.v1beta1.ValidatorAccumulatedCommissionRecord", value: ValidatorAccumulatedCommissionRecord.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ValidatorAccumulatedCommissionRecord.typeUrl)) { + return; + } + ValidatorAccumulatedCommission.registerTypeUrl(); } }; function createBaseValidatorHistoricalRewardsRecord(): ValidatorHistoricalRewardsRecord { @@ -892,6 +933,15 @@ function createBaseValidatorHistoricalRewardsRecord(): ValidatorHistoricalReward export const ValidatorHistoricalRewardsRecord = { typeUrl: "/cosmos.distribution.v1beta1.ValidatorHistoricalRewardsRecord", aminoType: "cosmos-sdk/ValidatorHistoricalRewardsRecord", + is(o: any): o is ValidatorHistoricalRewardsRecord { + return o && (o.$typeUrl === ValidatorHistoricalRewardsRecord.typeUrl || typeof o.validatorAddress === "string" && typeof o.period === "bigint" && ValidatorHistoricalRewards.is(o.rewards)); + }, + isSDK(o: any): o is ValidatorHistoricalRewardsRecordSDKType { + return o && (o.$typeUrl === ValidatorHistoricalRewardsRecord.typeUrl || typeof o.validator_address === "string" && typeof o.period === "bigint" && ValidatorHistoricalRewards.isSDK(o.rewards)); + }, + isAmino(o: any): o is ValidatorHistoricalRewardsRecordAmino { + return o && (o.$typeUrl === ValidatorHistoricalRewardsRecord.typeUrl || typeof o.validator_address === "string" && typeof o.period === "bigint" && ValidatorHistoricalRewards.isAmino(o.rewards)); + }, encode(message: ValidatorHistoricalRewardsRecord, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.validatorAddress !== "") { writer.uint32(10).string(message.validatorAddress); @@ -1006,6 +1056,12 @@ export const ValidatorHistoricalRewardsRecord = { typeUrl: "/cosmos.distribution.v1beta1.ValidatorHistoricalRewardsRecord", value: ValidatorHistoricalRewardsRecord.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ValidatorHistoricalRewardsRecord.typeUrl)) { + return; + } + ValidatorHistoricalRewards.registerTypeUrl(); } }; function createBaseValidatorCurrentRewardsRecord(): ValidatorCurrentRewardsRecord { @@ -1023,6 +1079,15 @@ function createBaseValidatorCurrentRewardsRecord(): ValidatorCurrentRewardsRecor export const ValidatorCurrentRewardsRecord = { typeUrl: "/cosmos.distribution.v1beta1.ValidatorCurrentRewardsRecord", aminoType: "cosmos-sdk/ValidatorCurrentRewardsRecord", + is(o: any): o is ValidatorCurrentRewardsRecord { + return o && (o.$typeUrl === ValidatorCurrentRewardsRecord.typeUrl || typeof o.validatorAddress === "string" && ValidatorCurrentRewards.is(o.rewards)); + }, + isSDK(o: any): o is ValidatorCurrentRewardsRecordSDKType { + return o && (o.$typeUrl === ValidatorCurrentRewardsRecord.typeUrl || typeof o.validator_address === "string" && ValidatorCurrentRewards.isSDK(o.rewards)); + }, + isAmino(o: any): o is ValidatorCurrentRewardsRecordAmino { + return o && (o.$typeUrl === ValidatorCurrentRewardsRecord.typeUrl || typeof o.validator_address === "string" && ValidatorCurrentRewards.isAmino(o.rewards)); + }, encode(message: ValidatorCurrentRewardsRecord, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.validatorAddress !== "") { writer.uint32(10).string(message.validatorAddress); @@ -1120,6 +1185,12 @@ export const ValidatorCurrentRewardsRecord = { typeUrl: "/cosmos.distribution.v1beta1.ValidatorCurrentRewardsRecord", value: ValidatorCurrentRewardsRecord.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ValidatorCurrentRewardsRecord.typeUrl)) { + return; + } + ValidatorCurrentRewards.registerTypeUrl(); } }; function createBaseDelegatorStartingInfoRecord(): DelegatorStartingInfoRecord { @@ -1138,6 +1209,15 @@ function createBaseDelegatorStartingInfoRecord(): DelegatorStartingInfoRecord { export const DelegatorStartingInfoRecord = { typeUrl: "/cosmos.distribution.v1beta1.DelegatorStartingInfoRecord", aminoType: "cosmos-sdk/DelegatorStartingInfoRecord", + is(o: any): o is DelegatorStartingInfoRecord { + return o && (o.$typeUrl === DelegatorStartingInfoRecord.typeUrl || typeof o.delegatorAddress === "string" && typeof o.validatorAddress === "string" && DelegatorStartingInfo.is(o.startingInfo)); + }, + isSDK(o: any): o is DelegatorStartingInfoRecordSDKType { + return o && (o.$typeUrl === DelegatorStartingInfoRecord.typeUrl || typeof o.delegator_address === "string" && typeof o.validator_address === "string" && DelegatorStartingInfo.isSDK(o.starting_info)); + }, + isAmino(o: any): o is DelegatorStartingInfoRecordAmino { + return o && (o.$typeUrl === DelegatorStartingInfoRecord.typeUrl || typeof o.delegator_address === "string" && typeof o.validator_address === "string" && DelegatorStartingInfo.isAmino(o.starting_info)); + }, encode(message: DelegatorStartingInfoRecord, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.delegatorAddress !== "") { writer.uint32(10).string(message.delegatorAddress); @@ -1250,6 +1330,12 @@ export const DelegatorStartingInfoRecord = { typeUrl: "/cosmos.distribution.v1beta1.DelegatorStartingInfoRecord", value: DelegatorStartingInfoRecord.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(DelegatorStartingInfoRecord.typeUrl)) { + return; + } + DelegatorStartingInfo.registerTypeUrl(); } }; function createBaseValidatorSlashEventRecord(): ValidatorSlashEventRecord { @@ -1269,6 +1355,15 @@ function createBaseValidatorSlashEventRecord(): ValidatorSlashEventRecord { export const ValidatorSlashEventRecord = { typeUrl: "/cosmos.distribution.v1beta1.ValidatorSlashEventRecord", aminoType: "cosmos-sdk/ValidatorSlashEventRecord", + is(o: any): o is ValidatorSlashEventRecord { + return o && (o.$typeUrl === ValidatorSlashEventRecord.typeUrl || typeof o.validatorAddress === "string" && typeof o.height === "bigint" && typeof o.period === "bigint" && ValidatorSlashEvent.is(o.validatorSlashEvent)); + }, + isSDK(o: any): o is ValidatorSlashEventRecordSDKType { + return o && (o.$typeUrl === ValidatorSlashEventRecord.typeUrl || typeof o.validator_address === "string" && typeof o.height === "bigint" && typeof o.period === "bigint" && ValidatorSlashEvent.isSDK(o.validator_slash_event)); + }, + isAmino(o: any): o is ValidatorSlashEventRecordAmino { + return o && (o.$typeUrl === ValidatorSlashEventRecord.typeUrl || typeof o.validator_address === "string" && typeof o.height === "bigint" && typeof o.period === "bigint" && ValidatorSlashEvent.isAmino(o.validator_slash_event)); + }, encode(message: ValidatorSlashEventRecord, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.validatorAddress !== "") { writer.uint32(10).string(message.validatorAddress); @@ -1400,6 +1495,12 @@ export const ValidatorSlashEventRecord = { typeUrl: "/cosmos.distribution.v1beta1.ValidatorSlashEventRecord", value: ValidatorSlashEventRecord.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ValidatorSlashEventRecord.typeUrl)) { + return; + } + ValidatorSlashEvent.registerTypeUrl(); } }; function createBaseGenesisState(): GenesisState { @@ -1425,6 +1526,15 @@ function createBaseGenesisState(): GenesisState { export const GenesisState = { typeUrl: "/cosmos.distribution.v1beta1.GenesisState", aminoType: "cosmos-sdk/GenesisState", + is(o: any): o is GenesisState { + return o && (o.$typeUrl === GenesisState.typeUrl || Params.is(o.params) && FeePool.is(o.feePool) && Array.isArray(o.delegatorWithdrawInfos) && (!o.delegatorWithdrawInfos.length || DelegatorWithdrawInfo.is(o.delegatorWithdrawInfos[0])) && typeof o.previousProposer === "string" && Array.isArray(o.outstandingRewards) && (!o.outstandingRewards.length || ValidatorOutstandingRewardsRecord.is(o.outstandingRewards[0])) && Array.isArray(o.validatorAccumulatedCommissions) && (!o.validatorAccumulatedCommissions.length || ValidatorAccumulatedCommissionRecord.is(o.validatorAccumulatedCommissions[0])) && Array.isArray(o.validatorHistoricalRewards) && (!o.validatorHistoricalRewards.length || ValidatorHistoricalRewardsRecord.is(o.validatorHistoricalRewards[0])) && Array.isArray(o.validatorCurrentRewards) && (!o.validatorCurrentRewards.length || ValidatorCurrentRewardsRecord.is(o.validatorCurrentRewards[0])) && Array.isArray(o.delegatorStartingInfos) && (!o.delegatorStartingInfos.length || DelegatorStartingInfoRecord.is(o.delegatorStartingInfos[0])) && Array.isArray(o.validatorSlashEvents) && (!o.validatorSlashEvents.length || ValidatorSlashEventRecord.is(o.validatorSlashEvents[0]))); + }, + isSDK(o: any): o is GenesisStateSDKType { + return o && (o.$typeUrl === GenesisState.typeUrl || Params.isSDK(o.params) && FeePool.isSDK(o.fee_pool) && Array.isArray(o.delegator_withdraw_infos) && (!o.delegator_withdraw_infos.length || DelegatorWithdrawInfo.isSDK(o.delegator_withdraw_infos[0])) && typeof o.previous_proposer === "string" && Array.isArray(o.outstanding_rewards) && (!o.outstanding_rewards.length || ValidatorOutstandingRewardsRecord.isSDK(o.outstanding_rewards[0])) && Array.isArray(o.validator_accumulated_commissions) && (!o.validator_accumulated_commissions.length || ValidatorAccumulatedCommissionRecord.isSDK(o.validator_accumulated_commissions[0])) && Array.isArray(o.validator_historical_rewards) && (!o.validator_historical_rewards.length || ValidatorHistoricalRewardsRecord.isSDK(o.validator_historical_rewards[0])) && Array.isArray(o.validator_current_rewards) && (!o.validator_current_rewards.length || ValidatorCurrentRewardsRecord.isSDK(o.validator_current_rewards[0])) && Array.isArray(o.delegator_starting_infos) && (!o.delegator_starting_infos.length || DelegatorStartingInfoRecord.isSDK(o.delegator_starting_infos[0])) && Array.isArray(o.validator_slash_events) && (!o.validator_slash_events.length || ValidatorSlashEventRecord.isSDK(o.validator_slash_events[0]))); + }, + isAmino(o: any): o is GenesisStateAmino { + return o && (o.$typeUrl === GenesisState.typeUrl || Params.isAmino(o.params) && FeePool.isAmino(o.fee_pool) && Array.isArray(o.delegator_withdraw_infos) && (!o.delegator_withdraw_infos.length || DelegatorWithdrawInfo.isAmino(o.delegator_withdraw_infos[0])) && typeof o.previous_proposer === "string" && Array.isArray(o.outstanding_rewards) && (!o.outstanding_rewards.length || ValidatorOutstandingRewardsRecord.isAmino(o.outstanding_rewards[0])) && Array.isArray(o.validator_accumulated_commissions) && (!o.validator_accumulated_commissions.length || ValidatorAccumulatedCommissionRecord.isAmino(o.validator_accumulated_commissions[0])) && Array.isArray(o.validator_historical_rewards) && (!o.validator_historical_rewards.length || ValidatorHistoricalRewardsRecord.isAmino(o.validator_historical_rewards[0])) && Array.isArray(o.validator_current_rewards) && (!o.validator_current_rewards.length || ValidatorCurrentRewardsRecord.isAmino(o.validator_current_rewards[0])) && Array.isArray(o.delegator_starting_infos) && (!o.delegator_starting_infos.length || DelegatorStartingInfoRecord.isAmino(o.delegator_starting_infos[0])) && Array.isArray(o.validator_slash_events) && (!o.validator_slash_events.length || ValidatorSlashEventRecord.isAmino(o.validator_slash_events[0]))); + }, encode(message: GenesisState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.params !== undefined) { Params.encode(message.params, writer.uint32(10).fork()).ldelim(); @@ -1714,5 +1824,19 @@ export const GenesisState = { typeUrl: "/cosmos.distribution.v1beta1.GenesisState", value: GenesisState.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GenesisState.typeUrl)) { + return; + } + Params.registerTypeUrl(); + FeePool.registerTypeUrl(); + DelegatorWithdrawInfo.registerTypeUrl(); + ValidatorOutstandingRewardsRecord.registerTypeUrl(); + ValidatorAccumulatedCommissionRecord.registerTypeUrl(); + ValidatorHistoricalRewardsRecord.registerTypeUrl(); + ValidatorCurrentRewardsRecord.registerTypeUrl(); + DelegatorStartingInfoRecord.registerTypeUrl(); + ValidatorSlashEventRecord.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/cosmos/distribution/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputv2/cosmos/distribution/v1beta1/query.rpc.func.ts new file mode 100644 index 0000000000..30303d4c15 --- /dev/null +++ b/__fixtures__/v-next/outputv2/cosmos/distribution/v1beta1/query.rpc.func.ts @@ -0,0 +1,120 @@ +import { buildQuery } from "../../../helper-func-types"; +import { QueryParamsRequest, QueryParamsResponse, QueryValidatorOutstandingRewardsRequest, QueryValidatorOutstandingRewardsResponse, QueryValidatorCommissionRequest, QueryValidatorCommissionResponse, QueryValidatorSlashesRequest, QueryValidatorSlashesResponse, QueryDelegationRewardsRequest, QueryDelegationRewardsResponse, QueryDelegationTotalRewardsRequest, QueryDelegationTotalRewardsResponse, QueryDelegatorValidatorsRequest, QueryDelegatorValidatorsResponse, QueryDelegatorWithdrawAddressRequest, QueryDelegatorWithdrawAddressResponse, QueryCommunityPoolRequest, QueryCommunityPoolResponse } from "./query"; +/** + * Params queries params of the distribution module. + * @name getParams + * @package cosmos.distribution.v1beta1 + * @see proto service: cosmos.distribution.v1beta1.Params + */ +export const getParams = buildQuery({ + encode: QueryParamsRequest.encode, + decode: QueryParamsResponse.decode, + service: "cosmos.distribution.v1beta1.Query", + method: "Params", + deps: [QueryParamsRequest, QueryParamsResponse] +}); +/** + * ValidatorOutstandingRewards queries rewards of a validator address. + * @name getValidatorOutstandingRewards + * @package cosmos.distribution.v1beta1 + * @see proto service: cosmos.distribution.v1beta1.ValidatorOutstandingRewards + */ +export const getValidatorOutstandingRewards = buildQuery({ + encode: QueryValidatorOutstandingRewardsRequest.encode, + decode: QueryValidatorOutstandingRewardsResponse.decode, + service: "cosmos.distribution.v1beta1.Query", + method: "ValidatorOutstandingRewards", + deps: [QueryValidatorOutstandingRewardsRequest, QueryValidatorOutstandingRewardsResponse] +}); +/** + * ValidatorCommission queries accumulated commission for a validator. + * @name getValidatorCommission + * @package cosmos.distribution.v1beta1 + * @see proto service: cosmos.distribution.v1beta1.ValidatorCommission + */ +export const getValidatorCommission = buildQuery({ + encode: QueryValidatorCommissionRequest.encode, + decode: QueryValidatorCommissionResponse.decode, + service: "cosmos.distribution.v1beta1.Query", + method: "ValidatorCommission", + deps: [QueryValidatorCommissionRequest, QueryValidatorCommissionResponse] +}); +/** + * ValidatorSlashes queries slash events of a validator. + * @name getValidatorSlashes + * @package cosmos.distribution.v1beta1 + * @see proto service: cosmos.distribution.v1beta1.ValidatorSlashes + */ +export const getValidatorSlashes = buildQuery({ + encode: QueryValidatorSlashesRequest.encode, + decode: QueryValidatorSlashesResponse.decode, + service: "cosmos.distribution.v1beta1.Query", + method: "ValidatorSlashes", + deps: [QueryValidatorSlashesRequest, QueryValidatorSlashesResponse] +}); +/** + * DelegationRewards queries the total rewards accrued by a delegation. + * @name getDelegationRewards + * @package cosmos.distribution.v1beta1 + * @see proto service: cosmos.distribution.v1beta1.DelegationRewards + */ +export const getDelegationRewards = buildQuery({ + encode: QueryDelegationRewardsRequest.encode, + decode: QueryDelegationRewardsResponse.decode, + service: "cosmos.distribution.v1beta1.Query", + method: "DelegationRewards", + deps: [QueryDelegationRewardsRequest, QueryDelegationRewardsResponse] +}); +/** + * DelegationTotalRewards queries the total rewards accrued by a each + * validator. + * @name getDelegationTotalRewards + * @package cosmos.distribution.v1beta1 + * @see proto service: cosmos.distribution.v1beta1.DelegationTotalRewards + */ +export const getDelegationTotalRewards = buildQuery({ + encode: QueryDelegationTotalRewardsRequest.encode, + decode: QueryDelegationTotalRewardsResponse.decode, + service: "cosmos.distribution.v1beta1.Query", + method: "DelegationTotalRewards", + deps: [QueryDelegationTotalRewardsRequest, QueryDelegationTotalRewardsResponse] +}); +/** + * DelegatorValidators queries the validators of a delegator. + * @name getDelegatorValidators + * @package cosmos.distribution.v1beta1 + * @see proto service: cosmos.distribution.v1beta1.DelegatorValidators + */ +export const getDelegatorValidators = buildQuery({ + encode: QueryDelegatorValidatorsRequest.encode, + decode: QueryDelegatorValidatorsResponse.decode, + service: "cosmos.distribution.v1beta1.Query", + method: "DelegatorValidators", + deps: [QueryDelegatorValidatorsRequest, QueryDelegatorValidatorsResponse] +}); +/** + * DelegatorWithdrawAddress queries withdraw address of a delegator. + * @name getDelegatorWithdrawAddress + * @package cosmos.distribution.v1beta1 + * @see proto service: cosmos.distribution.v1beta1.DelegatorWithdrawAddress + */ +export const getDelegatorWithdrawAddress = buildQuery({ + encode: QueryDelegatorWithdrawAddressRequest.encode, + decode: QueryDelegatorWithdrawAddressResponse.decode, + service: "cosmos.distribution.v1beta1.Query", + method: "DelegatorWithdrawAddress", + deps: [QueryDelegatorWithdrawAddressRequest, QueryDelegatorWithdrawAddressResponse] +}); +/** + * CommunityPool queries the community pool coins. + * @name getCommunityPool + * @package cosmos.distribution.v1beta1 + * @see proto service: cosmos.distribution.v1beta1.CommunityPool + */ +export const getCommunityPool = buildQuery({ + encode: QueryCommunityPoolRequest.encode, + decode: QueryCommunityPoolResponse.decode, + service: "cosmos.distribution.v1beta1.Query", + method: "CommunityPool", + deps: [QueryCommunityPoolRequest, QueryCommunityPoolResponse] +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/cosmos/distribution/v1beta1/query.ts b/__fixtures__/v-next/outputv2/cosmos/distribution/v1beta1/query.ts index 63c7de6a59..3add1f58c1 100644 --- a/__fixtures__/v-next/outputv2/cosmos/distribution/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv2/cosmos/distribution/v1beta1/query.ts @@ -4,6 +4,7 @@ import { DecCoin, DecCoinAmino, DecCoinSDKType } from "../../base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { JsonSafe } from "../../../json-safe"; import { DeepPartial, isSet } from "../../../helpers"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "cosmos.distribution.v1beta1"; /** * QueryParamsRequest is the request type for the Query/Params RPC method. @@ -827,6 +828,15 @@ function createBaseQueryParamsRequest(): QueryParamsRequest { export const QueryParamsRequest = { typeUrl: "/cosmos.distribution.v1beta1.QueryParamsRequest", aminoType: "cosmos-sdk/QueryParamsRequest", + is(o: any): o is QueryParamsRequest { + return o && o.$typeUrl === QueryParamsRequest.typeUrl; + }, + isSDK(o: any): o is QueryParamsRequestSDKType { + return o && o.$typeUrl === QueryParamsRequest.typeUrl; + }, + isAmino(o: any): o is QueryParamsRequestAmino { + return o && o.$typeUrl === QueryParamsRequest.typeUrl; + }, encode(_: QueryParamsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -891,7 +901,8 @@ export const QueryParamsRequest = { typeUrl: "/cosmos.distribution.v1beta1.QueryParamsRequest", value: QueryParamsRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryParamsResponse(): QueryParamsResponse { return { @@ -907,6 +918,15 @@ function createBaseQueryParamsResponse(): QueryParamsResponse { export const QueryParamsResponse = { typeUrl: "/cosmos.distribution.v1beta1.QueryParamsResponse", aminoType: "cosmos-sdk/QueryParamsResponse", + is(o: any): o is QueryParamsResponse { + return o && (o.$typeUrl === QueryParamsResponse.typeUrl || Params.is(o.params)); + }, + isSDK(o: any): o is QueryParamsResponseSDKType { + return o && (o.$typeUrl === QueryParamsResponse.typeUrl || Params.isSDK(o.params)); + }, + isAmino(o: any): o is QueryParamsResponseAmino { + return o && (o.$typeUrl === QueryParamsResponse.typeUrl || Params.isAmino(o.params)); + }, encode(message: QueryParamsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.params !== undefined) { Params.encode(message.params, writer.uint32(10).fork()).ldelim(); @@ -989,6 +1009,12 @@ export const QueryParamsResponse = { typeUrl: "/cosmos.distribution.v1beta1.QueryParamsResponse", value: QueryParamsResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryParamsResponse.typeUrl)) { + return; + } + Params.registerTypeUrl(); } }; function createBaseQueryValidatorOutstandingRewardsRequest(): QueryValidatorOutstandingRewardsRequest { @@ -1006,6 +1032,15 @@ function createBaseQueryValidatorOutstandingRewardsRequest(): QueryValidatorOuts export const QueryValidatorOutstandingRewardsRequest = { typeUrl: "/cosmos.distribution.v1beta1.QueryValidatorOutstandingRewardsRequest", aminoType: "cosmos-sdk/QueryValidatorOutstandingRewardsRequest", + is(o: any): o is QueryValidatorOutstandingRewardsRequest { + return o && (o.$typeUrl === QueryValidatorOutstandingRewardsRequest.typeUrl || typeof o.validatorAddress === "string"); + }, + isSDK(o: any): o is QueryValidatorOutstandingRewardsRequestSDKType { + return o && (o.$typeUrl === QueryValidatorOutstandingRewardsRequest.typeUrl || typeof o.validator_address === "string"); + }, + isAmino(o: any): o is QueryValidatorOutstandingRewardsRequestAmino { + return o && (o.$typeUrl === QueryValidatorOutstandingRewardsRequest.typeUrl || typeof o.validator_address === "string"); + }, encode(message: QueryValidatorOutstandingRewardsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.validatorAddress !== "") { writer.uint32(10).string(message.validatorAddress); @@ -1086,7 +1121,8 @@ export const QueryValidatorOutstandingRewardsRequest = { typeUrl: "/cosmos.distribution.v1beta1.QueryValidatorOutstandingRewardsRequest", value: QueryValidatorOutstandingRewardsRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryValidatorOutstandingRewardsResponse(): QueryValidatorOutstandingRewardsResponse { return { @@ -1103,6 +1139,15 @@ function createBaseQueryValidatorOutstandingRewardsResponse(): QueryValidatorOut export const QueryValidatorOutstandingRewardsResponse = { typeUrl: "/cosmos.distribution.v1beta1.QueryValidatorOutstandingRewardsResponse", aminoType: "cosmos-sdk/QueryValidatorOutstandingRewardsResponse", + is(o: any): o is QueryValidatorOutstandingRewardsResponse { + return o && (o.$typeUrl === QueryValidatorOutstandingRewardsResponse.typeUrl || ValidatorOutstandingRewards.is(o.rewards)); + }, + isSDK(o: any): o is QueryValidatorOutstandingRewardsResponseSDKType { + return o && (o.$typeUrl === QueryValidatorOutstandingRewardsResponse.typeUrl || ValidatorOutstandingRewards.isSDK(o.rewards)); + }, + isAmino(o: any): o is QueryValidatorOutstandingRewardsResponseAmino { + return o && (o.$typeUrl === QueryValidatorOutstandingRewardsResponse.typeUrl || ValidatorOutstandingRewards.isAmino(o.rewards)); + }, encode(message: QueryValidatorOutstandingRewardsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.rewards !== undefined) { ValidatorOutstandingRewards.encode(message.rewards, writer.uint32(10).fork()).ldelim(); @@ -1185,6 +1230,12 @@ export const QueryValidatorOutstandingRewardsResponse = { typeUrl: "/cosmos.distribution.v1beta1.QueryValidatorOutstandingRewardsResponse", value: QueryValidatorOutstandingRewardsResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryValidatorOutstandingRewardsResponse.typeUrl)) { + return; + } + ValidatorOutstandingRewards.registerTypeUrl(); } }; function createBaseQueryValidatorCommissionRequest(): QueryValidatorCommissionRequest { @@ -1202,6 +1253,15 @@ function createBaseQueryValidatorCommissionRequest(): QueryValidatorCommissionRe export const QueryValidatorCommissionRequest = { typeUrl: "/cosmos.distribution.v1beta1.QueryValidatorCommissionRequest", aminoType: "cosmos-sdk/QueryValidatorCommissionRequest", + is(o: any): o is QueryValidatorCommissionRequest { + return o && (o.$typeUrl === QueryValidatorCommissionRequest.typeUrl || typeof o.validatorAddress === "string"); + }, + isSDK(o: any): o is QueryValidatorCommissionRequestSDKType { + return o && (o.$typeUrl === QueryValidatorCommissionRequest.typeUrl || typeof o.validator_address === "string"); + }, + isAmino(o: any): o is QueryValidatorCommissionRequestAmino { + return o && (o.$typeUrl === QueryValidatorCommissionRequest.typeUrl || typeof o.validator_address === "string"); + }, encode(message: QueryValidatorCommissionRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.validatorAddress !== "") { writer.uint32(10).string(message.validatorAddress); @@ -1282,7 +1342,8 @@ export const QueryValidatorCommissionRequest = { typeUrl: "/cosmos.distribution.v1beta1.QueryValidatorCommissionRequest", value: QueryValidatorCommissionRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryValidatorCommissionResponse(): QueryValidatorCommissionResponse { return { @@ -1299,6 +1360,15 @@ function createBaseQueryValidatorCommissionResponse(): QueryValidatorCommissionR export const QueryValidatorCommissionResponse = { typeUrl: "/cosmos.distribution.v1beta1.QueryValidatorCommissionResponse", aminoType: "cosmos-sdk/QueryValidatorCommissionResponse", + is(o: any): o is QueryValidatorCommissionResponse { + return o && (o.$typeUrl === QueryValidatorCommissionResponse.typeUrl || ValidatorAccumulatedCommission.is(o.commission)); + }, + isSDK(o: any): o is QueryValidatorCommissionResponseSDKType { + return o && (o.$typeUrl === QueryValidatorCommissionResponse.typeUrl || ValidatorAccumulatedCommission.isSDK(o.commission)); + }, + isAmino(o: any): o is QueryValidatorCommissionResponseAmino { + return o && (o.$typeUrl === QueryValidatorCommissionResponse.typeUrl || ValidatorAccumulatedCommission.isAmino(o.commission)); + }, encode(message: QueryValidatorCommissionResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.commission !== undefined) { ValidatorAccumulatedCommission.encode(message.commission, writer.uint32(10).fork()).ldelim(); @@ -1381,6 +1451,12 @@ export const QueryValidatorCommissionResponse = { typeUrl: "/cosmos.distribution.v1beta1.QueryValidatorCommissionResponse", value: QueryValidatorCommissionResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryValidatorCommissionResponse.typeUrl)) { + return; + } + ValidatorAccumulatedCommission.registerTypeUrl(); } }; function createBaseQueryValidatorSlashesRequest(): QueryValidatorSlashesRequest { @@ -1401,6 +1477,15 @@ function createBaseQueryValidatorSlashesRequest(): QueryValidatorSlashesRequest export const QueryValidatorSlashesRequest = { typeUrl: "/cosmos.distribution.v1beta1.QueryValidatorSlashesRequest", aminoType: "cosmos-sdk/QueryValidatorSlashesRequest", + is(o: any): o is QueryValidatorSlashesRequest { + return o && (o.$typeUrl === QueryValidatorSlashesRequest.typeUrl || typeof o.validatorAddress === "string" && typeof o.startingHeight === "bigint" && typeof o.endingHeight === "bigint"); + }, + isSDK(o: any): o is QueryValidatorSlashesRequestSDKType { + return o && (o.$typeUrl === QueryValidatorSlashesRequest.typeUrl || typeof o.validator_address === "string" && typeof o.starting_height === "bigint" && typeof o.ending_height === "bigint"); + }, + isAmino(o: any): o is QueryValidatorSlashesRequestAmino { + return o && (o.$typeUrl === QueryValidatorSlashesRequest.typeUrl || typeof o.validator_address === "string" && typeof o.starting_height === "bigint" && typeof o.ending_height === "bigint"); + }, encode(message: QueryValidatorSlashesRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.validatorAddress !== "") { writer.uint32(10).string(message.validatorAddress); @@ -1532,6 +1617,12 @@ export const QueryValidatorSlashesRequest = { typeUrl: "/cosmos.distribution.v1beta1.QueryValidatorSlashesRequest", value: QueryValidatorSlashesRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryValidatorSlashesRequest.typeUrl)) { + return; + } + PageRequest.registerTypeUrl(); } }; function createBaseQueryValidatorSlashesResponse(): QueryValidatorSlashesResponse { @@ -1550,6 +1641,15 @@ function createBaseQueryValidatorSlashesResponse(): QueryValidatorSlashesRespons export const QueryValidatorSlashesResponse = { typeUrl: "/cosmos.distribution.v1beta1.QueryValidatorSlashesResponse", aminoType: "cosmos-sdk/QueryValidatorSlashesResponse", + is(o: any): o is QueryValidatorSlashesResponse { + return o && (o.$typeUrl === QueryValidatorSlashesResponse.typeUrl || Array.isArray(o.slashes) && (!o.slashes.length || ValidatorSlashEvent.is(o.slashes[0]))); + }, + isSDK(o: any): o is QueryValidatorSlashesResponseSDKType { + return o && (o.$typeUrl === QueryValidatorSlashesResponse.typeUrl || Array.isArray(o.slashes) && (!o.slashes.length || ValidatorSlashEvent.isSDK(o.slashes[0]))); + }, + isAmino(o: any): o is QueryValidatorSlashesResponseAmino { + return o && (o.$typeUrl === QueryValidatorSlashesResponse.typeUrl || Array.isArray(o.slashes) && (!o.slashes.length || ValidatorSlashEvent.isAmino(o.slashes[0]))); + }, encode(message: QueryValidatorSlashesResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.slashes) { ValidatorSlashEvent.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -1657,6 +1757,13 @@ export const QueryValidatorSlashesResponse = { typeUrl: "/cosmos.distribution.v1beta1.QueryValidatorSlashesResponse", value: QueryValidatorSlashesResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryValidatorSlashesResponse.typeUrl)) { + return; + } + ValidatorSlashEvent.registerTypeUrl(); + PageResponse.registerTypeUrl(); } }; function createBaseQueryDelegationRewardsRequest(): QueryDelegationRewardsRequest { @@ -1675,6 +1782,15 @@ function createBaseQueryDelegationRewardsRequest(): QueryDelegationRewardsReques export const QueryDelegationRewardsRequest = { typeUrl: "/cosmos.distribution.v1beta1.QueryDelegationRewardsRequest", aminoType: "cosmos-sdk/QueryDelegationRewardsRequest", + is(o: any): o is QueryDelegationRewardsRequest { + return o && (o.$typeUrl === QueryDelegationRewardsRequest.typeUrl || typeof o.delegatorAddress === "string" && typeof o.validatorAddress === "string"); + }, + isSDK(o: any): o is QueryDelegationRewardsRequestSDKType { + return o && (o.$typeUrl === QueryDelegationRewardsRequest.typeUrl || typeof o.delegator_address === "string" && typeof o.validator_address === "string"); + }, + isAmino(o: any): o is QueryDelegationRewardsRequestAmino { + return o && (o.$typeUrl === QueryDelegationRewardsRequest.typeUrl || typeof o.delegator_address === "string" && typeof o.validator_address === "string"); + }, encode(message: QueryDelegationRewardsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.delegatorAddress !== "") { writer.uint32(10).string(message.delegatorAddress); @@ -1770,7 +1886,8 @@ export const QueryDelegationRewardsRequest = { typeUrl: "/cosmos.distribution.v1beta1.QueryDelegationRewardsRequest", value: QueryDelegationRewardsRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryDelegationRewardsResponse(): QueryDelegationRewardsResponse { return { @@ -1787,6 +1904,15 @@ function createBaseQueryDelegationRewardsResponse(): QueryDelegationRewardsRespo export const QueryDelegationRewardsResponse = { typeUrl: "/cosmos.distribution.v1beta1.QueryDelegationRewardsResponse", aminoType: "cosmos-sdk/QueryDelegationRewardsResponse", + is(o: any): o is QueryDelegationRewardsResponse { + return o && (o.$typeUrl === QueryDelegationRewardsResponse.typeUrl || Array.isArray(o.rewards) && (!o.rewards.length || DecCoin.is(o.rewards[0]))); + }, + isSDK(o: any): o is QueryDelegationRewardsResponseSDKType { + return o && (o.$typeUrl === QueryDelegationRewardsResponse.typeUrl || Array.isArray(o.rewards) && (!o.rewards.length || DecCoin.isSDK(o.rewards[0]))); + }, + isAmino(o: any): o is QueryDelegationRewardsResponseAmino { + return o && (o.$typeUrl === QueryDelegationRewardsResponse.typeUrl || Array.isArray(o.rewards) && (!o.rewards.length || DecCoin.isAmino(o.rewards[0]))); + }, encode(message: QueryDelegationRewardsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.rewards) { DecCoin.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -1877,6 +2003,12 @@ export const QueryDelegationRewardsResponse = { typeUrl: "/cosmos.distribution.v1beta1.QueryDelegationRewardsResponse", value: QueryDelegationRewardsResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryDelegationRewardsResponse.typeUrl)) { + return; + } + DecCoin.registerTypeUrl(); } }; function createBaseQueryDelegationTotalRewardsRequest(): QueryDelegationTotalRewardsRequest { @@ -1894,6 +2026,15 @@ function createBaseQueryDelegationTotalRewardsRequest(): QueryDelegationTotalRew export const QueryDelegationTotalRewardsRequest = { typeUrl: "/cosmos.distribution.v1beta1.QueryDelegationTotalRewardsRequest", aminoType: "cosmos-sdk/QueryDelegationTotalRewardsRequest", + is(o: any): o is QueryDelegationTotalRewardsRequest { + return o && (o.$typeUrl === QueryDelegationTotalRewardsRequest.typeUrl || typeof o.delegatorAddress === "string"); + }, + isSDK(o: any): o is QueryDelegationTotalRewardsRequestSDKType { + return o && (o.$typeUrl === QueryDelegationTotalRewardsRequest.typeUrl || typeof o.delegator_address === "string"); + }, + isAmino(o: any): o is QueryDelegationTotalRewardsRequestAmino { + return o && (o.$typeUrl === QueryDelegationTotalRewardsRequest.typeUrl || typeof o.delegator_address === "string"); + }, encode(message: QueryDelegationTotalRewardsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.delegatorAddress !== "") { writer.uint32(10).string(message.delegatorAddress); @@ -1974,7 +2115,8 @@ export const QueryDelegationTotalRewardsRequest = { typeUrl: "/cosmos.distribution.v1beta1.QueryDelegationTotalRewardsRequest", value: QueryDelegationTotalRewardsRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryDelegationTotalRewardsResponse(): QueryDelegationTotalRewardsResponse { return { @@ -1992,6 +2134,15 @@ function createBaseQueryDelegationTotalRewardsResponse(): QueryDelegationTotalRe export const QueryDelegationTotalRewardsResponse = { typeUrl: "/cosmos.distribution.v1beta1.QueryDelegationTotalRewardsResponse", aminoType: "cosmos-sdk/QueryDelegationTotalRewardsResponse", + is(o: any): o is QueryDelegationTotalRewardsResponse { + return o && (o.$typeUrl === QueryDelegationTotalRewardsResponse.typeUrl || Array.isArray(o.rewards) && (!o.rewards.length || DelegationDelegatorReward.is(o.rewards[0])) && Array.isArray(o.total) && (!o.total.length || DecCoin.is(o.total[0]))); + }, + isSDK(o: any): o is QueryDelegationTotalRewardsResponseSDKType { + return o && (o.$typeUrl === QueryDelegationTotalRewardsResponse.typeUrl || Array.isArray(o.rewards) && (!o.rewards.length || DelegationDelegatorReward.isSDK(o.rewards[0])) && Array.isArray(o.total) && (!o.total.length || DecCoin.isSDK(o.total[0]))); + }, + isAmino(o: any): o is QueryDelegationTotalRewardsResponseAmino { + return o && (o.$typeUrl === QueryDelegationTotalRewardsResponse.typeUrl || Array.isArray(o.rewards) && (!o.rewards.length || DelegationDelegatorReward.isAmino(o.rewards[0])) && Array.isArray(o.total) && (!o.total.length || DecCoin.isAmino(o.total[0]))); + }, encode(message: QueryDelegationTotalRewardsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.rewards) { DelegationDelegatorReward.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -2107,6 +2258,13 @@ export const QueryDelegationTotalRewardsResponse = { typeUrl: "/cosmos.distribution.v1beta1.QueryDelegationTotalRewardsResponse", value: QueryDelegationTotalRewardsResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryDelegationTotalRewardsResponse.typeUrl)) { + return; + } + DelegationDelegatorReward.registerTypeUrl(); + DecCoin.registerTypeUrl(); } }; function createBaseQueryDelegatorValidatorsRequest(): QueryDelegatorValidatorsRequest { @@ -2124,6 +2282,15 @@ function createBaseQueryDelegatorValidatorsRequest(): QueryDelegatorValidatorsRe export const QueryDelegatorValidatorsRequest = { typeUrl: "/cosmos.distribution.v1beta1.QueryDelegatorValidatorsRequest", aminoType: "cosmos-sdk/QueryDelegatorValidatorsRequest", + is(o: any): o is QueryDelegatorValidatorsRequest { + return o && (o.$typeUrl === QueryDelegatorValidatorsRequest.typeUrl || typeof o.delegatorAddress === "string"); + }, + isSDK(o: any): o is QueryDelegatorValidatorsRequestSDKType { + return o && (o.$typeUrl === QueryDelegatorValidatorsRequest.typeUrl || typeof o.delegator_address === "string"); + }, + isAmino(o: any): o is QueryDelegatorValidatorsRequestAmino { + return o && (o.$typeUrl === QueryDelegatorValidatorsRequest.typeUrl || typeof o.delegator_address === "string"); + }, encode(message: QueryDelegatorValidatorsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.delegatorAddress !== "") { writer.uint32(10).string(message.delegatorAddress); @@ -2204,7 +2371,8 @@ export const QueryDelegatorValidatorsRequest = { typeUrl: "/cosmos.distribution.v1beta1.QueryDelegatorValidatorsRequest", value: QueryDelegatorValidatorsRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryDelegatorValidatorsResponse(): QueryDelegatorValidatorsResponse { return { @@ -2221,6 +2389,15 @@ function createBaseQueryDelegatorValidatorsResponse(): QueryDelegatorValidatorsR export const QueryDelegatorValidatorsResponse = { typeUrl: "/cosmos.distribution.v1beta1.QueryDelegatorValidatorsResponse", aminoType: "cosmos-sdk/QueryDelegatorValidatorsResponse", + is(o: any): o is QueryDelegatorValidatorsResponse { + return o && (o.$typeUrl === QueryDelegatorValidatorsResponse.typeUrl || Array.isArray(o.validators) && (!o.validators.length || typeof o.validators[0] === "string")); + }, + isSDK(o: any): o is QueryDelegatorValidatorsResponseSDKType { + return o && (o.$typeUrl === QueryDelegatorValidatorsResponse.typeUrl || Array.isArray(o.validators) && (!o.validators.length || typeof o.validators[0] === "string")); + }, + isAmino(o: any): o is QueryDelegatorValidatorsResponseAmino { + return o && (o.$typeUrl === QueryDelegatorValidatorsResponse.typeUrl || Array.isArray(o.validators) && (!o.validators.length || typeof o.validators[0] === "string")); + }, encode(message: QueryDelegatorValidatorsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.validators) { writer.uint32(10).string(v!); @@ -2311,7 +2488,8 @@ export const QueryDelegatorValidatorsResponse = { typeUrl: "/cosmos.distribution.v1beta1.QueryDelegatorValidatorsResponse", value: QueryDelegatorValidatorsResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryDelegatorWithdrawAddressRequest(): QueryDelegatorWithdrawAddressRequest { return { @@ -2328,6 +2506,15 @@ function createBaseQueryDelegatorWithdrawAddressRequest(): QueryDelegatorWithdra export const QueryDelegatorWithdrawAddressRequest = { typeUrl: "/cosmos.distribution.v1beta1.QueryDelegatorWithdrawAddressRequest", aminoType: "cosmos-sdk/QueryDelegatorWithdrawAddressRequest", + is(o: any): o is QueryDelegatorWithdrawAddressRequest { + return o && (o.$typeUrl === QueryDelegatorWithdrawAddressRequest.typeUrl || typeof o.delegatorAddress === "string"); + }, + isSDK(o: any): o is QueryDelegatorWithdrawAddressRequestSDKType { + return o && (o.$typeUrl === QueryDelegatorWithdrawAddressRequest.typeUrl || typeof o.delegator_address === "string"); + }, + isAmino(o: any): o is QueryDelegatorWithdrawAddressRequestAmino { + return o && (o.$typeUrl === QueryDelegatorWithdrawAddressRequest.typeUrl || typeof o.delegator_address === "string"); + }, encode(message: QueryDelegatorWithdrawAddressRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.delegatorAddress !== "") { writer.uint32(10).string(message.delegatorAddress); @@ -2408,7 +2595,8 @@ export const QueryDelegatorWithdrawAddressRequest = { typeUrl: "/cosmos.distribution.v1beta1.QueryDelegatorWithdrawAddressRequest", value: QueryDelegatorWithdrawAddressRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryDelegatorWithdrawAddressResponse(): QueryDelegatorWithdrawAddressResponse { return { @@ -2425,6 +2613,15 @@ function createBaseQueryDelegatorWithdrawAddressResponse(): QueryDelegatorWithdr export const QueryDelegatorWithdrawAddressResponse = { typeUrl: "/cosmos.distribution.v1beta1.QueryDelegatorWithdrawAddressResponse", aminoType: "cosmos-sdk/QueryDelegatorWithdrawAddressResponse", + is(o: any): o is QueryDelegatorWithdrawAddressResponse { + return o && (o.$typeUrl === QueryDelegatorWithdrawAddressResponse.typeUrl || typeof o.withdrawAddress === "string"); + }, + isSDK(o: any): o is QueryDelegatorWithdrawAddressResponseSDKType { + return o && (o.$typeUrl === QueryDelegatorWithdrawAddressResponse.typeUrl || typeof o.withdraw_address === "string"); + }, + isAmino(o: any): o is QueryDelegatorWithdrawAddressResponseAmino { + return o && (o.$typeUrl === QueryDelegatorWithdrawAddressResponse.typeUrl || typeof o.withdraw_address === "string"); + }, encode(message: QueryDelegatorWithdrawAddressResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.withdrawAddress !== "") { writer.uint32(10).string(message.withdrawAddress); @@ -2505,7 +2702,8 @@ export const QueryDelegatorWithdrawAddressResponse = { typeUrl: "/cosmos.distribution.v1beta1.QueryDelegatorWithdrawAddressResponse", value: QueryDelegatorWithdrawAddressResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryCommunityPoolRequest(): QueryCommunityPoolRequest { return {}; @@ -2520,6 +2718,15 @@ function createBaseQueryCommunityPoolRequest(): QueryCommunityPoolRequest { export const QueryCommunityPoolRequest = { typeUrl: "/cosmos.distribution.v1beta1.QueryCommunityPoolRequest", aminoType: "cosmos-sdk/QueryCommunityPoolRequest", + is(o: any): o is QueryCommunityPoolRequest { + return o && o.$typeUrl === QueryCommunityPoolRequest.typeUrl; + }, + isSDK(o: any): o is QueryCommunityPoolRequestSDKType { + return o && o.$typeUrl === QueryCommunityPoolRequest.typeUrl; + }, + isAmino(o: any): o is QueryCommunityPoolRequestAmino { + return o && o.$typeUrl === QueryCommunityPoolRequest.typeUrl; + }, encode(_: QueryCommunityPoolRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -2584,7 +2791,8 @@ export const QueryCommunityPoolRequest = { typeUrl: "/cosmos.distribution.v1beta1.QueryCommunityPoolRequest", value: QueryCommunityPoolRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryCommunityPoolResponse(): QueryCommunityPoolResponse { return { @@ -2601,6 +2809,15 @@ function createBaseQueryCommunityPoolResponse(): QueryCommunityPoolResponse { export const QueryCommunityPoolResponse = { typeUrl: "/cosmos.distribution.v1beta1.QueryCommunityPoolResponse", aminoType: "cosmos-sdk/QueryCommunityPoolResponse", + is(o: any): o is QueryCommunityPoolResponse { + return o && (o.$typeUrl === QueryCommunityPoolResponse.typeUrl || Array.isArray(o.pool) && (!o.pool.length || DecCoin.is(o.pool[0]))); + }, + isSDK(o: any): o is QueryCommunityPoolResponseSDKType { + return o && (o.$typeUrl === QueryCommunityPoolResponse.typeUrl || Array.isArray(o.pool) && (!o.pool.length || DecCoin.isSDK(o.pool[0]))); + }, + isAmino(o: any): o is QueryCommunityPoolResponseAmino { + return o && (o.$typeUrl === QueryCommunityPoolResponse.typeUrl || Array.isArray(o.pool) && (!o.pool.length || DecCoin.isAmino(o.pool[0]))); + }, encode(message: QueryCommunityPoolResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.pool) { DecCoin.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -2691,5 +2908,11 @@ export const QueryCommunityPoolResponse = { typeUrl: "/cosmos.distribution.v1beta1.QueryCommunityPoolResponse", value: QueryCommunityPoolResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryCommunityPoolResponse.typeUrl)) { + return; + } + DecCoin.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/cosmos/distribution/v1beta1/tx.registry.ts b/__fixtures__/v-next/outputv2/cosmos/distribution/v1beta1/tx.registry.ts index 2ceda653f3..9e31d8c48b 100644 --- a/__fixtures__/v-next/outputv2/cosmos/distribution/v1beta1/tx.registry.ts +++ b/__fixtures__/v-next/outputv2/cosmos/distribution/v1beta1/tx.registry.ts @@ -1,11 +1,6 @@ -import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { TelescopeGeneratedType } from "../../../types"; import { MsgSetWithdrawAddress, MsgWithdrawDelegatorReward, MsgWithdrawValidatorCommission, MsgFundCommunityPool } from "./tx"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/cosmos.distribution.v1beta1.MsgSetWithdrawAddress", MsgSetWithdrawAddress], ["/cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward", MsgWithdrawDelegatorReward], ["/cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission", MsgWithdrawValidatorCommission], ["/cosmos.distribution.v1beta1.MsgFundCommunityPool", MsgFundCommunityPool]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/cosmos.distribution.v1beta1.MsgSetWithdrawAddress", MsgSetWithdrawAddress], ["/cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward", MsgWithdrawDelegatorReward], ["/cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission", MsgWithdrawValidatorCommission], ["/cosmos.distribution.v1beta1.MsgFundCommunityPool", MsgFundCommunityPool]]; export const MessageComposer = { encoded: { setWithdrawAddress(value: MsgSetWithdrawAddress) { diff --git a/__fixtures__/v-next/outputv2/cosmos/distribution/v1beta1/tx.rpc.func.ts b/__fixtures__/v-next/outputv2/cosmos/distribution/v1beta1/tx.rpc.func.ts new file mode 100644 index 0000000000..d91dcc0b72 --- /dev/null +++ b/__fixtures__/v-next/outputv2/cosmos/distribution/v1beta1/tx.rpc.func.ts @@ -0,0 +1,42 @@ +import { buildTx } from "../../../helper-func-types"; +import { MsgSetWithdrawAddress, MsgWithdrawDelegatorReward, MsgWithdrawValidatorCommission, MsgFundCommunityPool } from "./tx"; +/** + * SetWithdrawAddress defines a method to change the withdraw address + * for a delegator (or validator self-delegation). + * @name setWithdrawAddress + * @package cosmos.distribution.v1beta1 + * @see proto service: cosmos.distribution.v1beta1.SetWithdrawAddress + */ +export const setWithdrawAddress = buildTx({ + msg: MsgSetWithdrawAddress +}); +/** + * WithdrawDelegatorReward defines a method to withdraw rewards of delegator + * from a single validator. + * @name withdrawDelegatorReward + * @package cosmos.distribution.v1beta1 + * @see proto service: cosmos.distribution.v1beta1.WithdrawDelegatorReward + */ +export const withdrawDelegatorReward = buildTx({ + msg: MsgWithdrawDelegatorReward +}); +/** + * WithdrawValidatorCommission defines a method to withdraw the + * full commission to the validator address. + * @name withdrawValidatorCommission + * @package cosmos.distribution.v1beta1 + * @see proto service: cosmos.distribution.v1beta1.WithdrawValidatorCommission + */ +export const withdrawValidatorCommission = buildTx({ + msg: MsgWithdrawValidatorCommission +}); +/** + * FundCommunityPool defines a method to allow an account to directly + * fund the community pool. + * @name fundCommunityPool + * @package cosmos.distribution.v1beta1 + * @see proto service: cosmos.distribution.v1beta1.FundCommunityPool + */ +export const fundCommunityPool = buildTx({ + msg: MsgFundCommunityPool +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/cosmos/distribution/v1beta1/tx.ts b/__fixtures__/v-next/outputv2/cosmos/distribution/v1beta1/tx.ts index eb05432716..42f799bdc7 100644 --- a/__fixtures__/v-next/outputv2/cosmos/distribution/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputv2/cosmos/distribution/v1beta1/tx.ts @@ -2,6 +2,7 @@ import { Coin, CoinAmino, CoinSDKType } from "../../base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { isSet, DeepPartial } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "cosmos.distribution.v1beta1"; /** * MsgSetWithdrawAddress sets the withdraw address for @@ -308,6 +309,15 @@ function createBaseMsgSetWithdrawAddress(): MsgSetWithdrawAddress { export const MsgSetWithdrawAddress = { typeUrl: "/cosmos.distribution.v1beta1.MsgSetWithdrawAddress", aminoType: "cosmos-sdk/MsgModifyWithdrawAddress", + is(o: any): o is MsgSetWithdrawAddress { + return o && (o.$typeUrl === MsgSetWithdrawAddress.typeUrl || typeof o.delegatorAddress === "string" && typeof o.withdrawAddress === "string"); + }, + isSDK(o: any): o is MsgSetWithdrawAddressSDKType { + return o && (o.$typeUrl === MsgSetWithdrawAddress.typeUrl || typeof o.delegator_address === "string" && typeof o.withdraw_address === "string"); + }, + isAmino(o: any): o is MsgSetWithdrawAddressAmino { + return o && (o.$typeUrl === MsgSetWithdrawAddress.typeUrl || typeof o.delegator_address === "string" && typeof o.withdraw_address === "string"); + }, encode(message: MsgSetWithdrawAddress, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.delegatorAddress !== "") { writer.uint32(10).string(message.delegatorAddress); @@ -403,7 +413,8 @@ export const MsgSetWithdrawAddress = { typeUrl: "/cosmos.distribution.v1beta1.MsgSetWithdrawAddress", value: MsgSetWithdrawAddress.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgSetWithdrawAddressResponse(): MsgSetWithdrawAddressResponse { return {}; @@ -417,6 +428,15 @@ function createBaseMsgSetWithdrawAddressResponse(): MsgSetWithdrawAddressRespons export const MsgSetWithdrawAddressResponse = { typeUrl: "/cosmos.distribution.v1beta1.MsgSetWithdrawAddressResponse", aminoType: "cosmos-sdk/MsgSetWithdrawAddressResponse", + is(o: any): o is MsgSetWithdrawAddressResponse { + return o && o.$typeUrl === MsgSetWithdrawAddressResponse.typeUrl; + }, + isSDK(o: any): o is MsgSetWithdrawAddressResponseSDKType { + return o && o.$typeUrl === MsgSetWithdrawAddressResponse.typeUrl; + }, + isAmino(o: any): o is MsgSetWithdrawAddressResponseAmino { + return o && o.$typeUrl === MsgSetWithdrawAddressResponse.typeUrl; + }, encode(_: MsgSetWithdrawAddressResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -481,7 +501,8 @@ export const MsgSetWithdrawAddressResponse = { typeUrl: "/cosmos.distribution.v1beta1.MsgSetWithdrawAddressResponse", value: MsgSetWithdrawAddressResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgWithdrawDelegatorReward(): MsgWithdrawDelegatorReward { return { @@ -499,6 +520,15 @@ function createBaseMsgWithdrawDelegatorReward(): MsgWithdrawDelegatorReward { export const MsgWithdrawDelegatorReward = { typeUrl: "/cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward", aminoType: "cosmos-sdk/MsgWithdrawDelegationReward", + is(o: any): o is MsgWithdrawDelegatorReward { + return o && (o.$typeUrl === MsgWithdrawDelegatorReward.typeUrl || typeof o.delegatorAddress === "string" && typeof o.validatorAddress === "string"); + }, + isSDK(o: any): o is MsgWithdrawDelegatorRewardSDKType { + return o && (o.$typeUrl === MsgWithdrawDelegatorReward.typeUrl || typeof o.delegator_address === "string" && typeof o.validator_address === "string"); + }, + isAmino(o: any): o is MsgWithdrawDelegatorRewardAmino { + return o && (o.$typeUrl === MsgWithdrawDelegatorReward.typeUrl || typeof o.delegator_address === "string" && typeof o.validator_address === "string"); + }, encode(message: MsgWithdrawDelegatorReward, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.delegatorAddress !== "") { writer.uint32(10).string(message.delegatorAddress); @@ -594,7 +624,8 @@ export const MsgWithdrawDelegatorReward = { typeUrl: "/cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward", value: MsgWithdrawDelegatorReward.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgWithdrawDelegatorRewardResponse(): MsgWithdrawDelegatorRewardResponse { return { @@ -610,6 +641,15 @@ function createBaseMsgWithdrawDelegatorRewardResponse(): MsgWithdrawDelegatorRew export const MsgWithdrawDelegatorRewardResponse = { typeUrl: "/cosmos.distribution.v1beta1.MsgWithdrawDelegatorRewardResponse", aminoType: "cosmos-sdk/MsgWithdrawDelegatorRewardResponse", + is(o: any): o is MsgWithdrawDelegatorRewardResponse { + return o && (o.$typeUrl === MsgWithdrawDelegatorRewardResponse.typeUrl || Array.isArray(o.amount) && (!o.amount.length || Coin.is(o.amount[0]))); + }, + isSDK(o: any): o is MsgWithdrawDelegatorRewardResponseSDKType { + return o && (o.$typeUrl === MsgWithdrawDelegatorRewardResponse.typeUrl || Array.isArray(o.amount) && (!o.amount.length || Coin.isSDK(o.amount[0]))); + }, + isAmino(o: any): o is MsgWithdrawDelegatorRewardResponseAmino { + return o && (o.$typeUrl === MsgWithdrawDelegatorRewardResponse.typeUrl || Array.isArray(o.amount) && (!o.amount.length || Coin.isAmino(o.amount[0]))); + }, encode(message: MsgWithdrawDelegatorRewardResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.amount) { Coin.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -700,6 +740,12 @@ export const MsgWithdrawDelegatorRewardResponse = { typeUrl: "/cosmos.distribution.v1beta1.MsgWithdrawDelegatorRewardResponse", value: MsgWithdrawDelegatorRewardResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgWithdrawDelegatorRewardResponse.typeUrl)) { + return; + } + Coin.registerTypeUrl(); } }; function createBaseMsgWithdrawValidatorCommission(): MsgWithdrawValidatorCommission { @@ -717,6 +763,15 @@ function createBaseMsgWithdrawValidatorCommission(): MsgWithdrawValidatorCommiss export const MsgWithdrawValidatorCommission = { typeUrl: "/cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission", aminoType: "cosmos-sdk/MsgWithdrawValidatorCommission", + is(o: any): o is MsgWithdrawValidatorCommission { + return o && (o.$typeUrl === MsgWithdrawValidatorCommission.typeUrl || typeof o.validatorAddress === "string"); + }, + isSDK(o: any): o is MsgWithdrawValidatorCommissionSDKType { + return o && (o.$typeUrl === MsgWithdrawValidatorCommission.typeUrl || typeof o.validator_address === "string"); + }, + isAmino(o: any): o is MsgWithdrawValidatorCommissionAmino { + return o && (o.$typeUrl === MsgWithdrawValidatorCommission.typeUrl || typeof o.validator_address === "string"); + }, encode(message: MsgWithdrawValidatorCommission, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.validatorAddress !== "") { writer.uint32(10).string(message.validatorAddress); @@ -797,7 +852,8 @@ export const MsgWithdrawValidatorCommission = { typeUrl: "/cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission", value: MsgWithdrawValidatorCommission.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgWithdrawValidatorCommissionResponse(): MsgWithdrawValidatorCommissionResponse { return { @@ -813,6 +869,15 @@ function createBaseMsgWithdrawValidatorCommissionResponse(): MsgWithdrawValidato export const MsgWithdrawValidatorCommissionResponse = { typeUrl: "/cosmos.distribution.v1beta1.MsgWithdrawValidatorCommissionResponse", aminoType: "cosmos-sdk/MsgWithdrawValidatorCommissionResponse", + is(o: any): o is MsgWithdrawValidatorCommissionResponse { + return o && (o.$typeUrl === MsgWithdrawValidatorCommissionResponse.typeUrl || Array.isArray(o.amount) && (!o.amount.length || Coin.is(o.amount[0]))); + }, + isSDK(o: any): o is MsgWithdrawValidatorCommissionResponseSDKType { + return o && (o.$typeUrl === MsgWithdrawValidatorCommissionResponse.typeUrl || Array.isArray(o.amount) && (!o.amount.length || Coin.isSDK(o.amount[0]))); + }, + isAmino(o: any): o is MsgWithdrawValidatorCommissionResponseAmino { + return o && (o.$typeUrl === MsgWithdrawValidatorCommissionResponse.typeUrl || Array.isArray(o.amount) && (!o.amount.length || Coin.isAmino(o.amount[0]))); + }, encode(message: MsgWithdrawValidatorCommissionResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.amount) { Coin.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -903,6 +968,12 @@ export const MsgWithdrawValidatorCommissionResponse = { typeUrl: "/cosmos.distribution.v1beta1.MsgWithdrawValidatorCommissionResponse", value: MsgWithdrawValidatorCommissionResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgWithdrawValidatorCommissionResponse.typeUrl)) { + return; + } + Coin.registerTypeUrl(); } }; function createBaseMsgFundCommunityPool(): MsgFundCommunityPool { @@ -921,6 +992,15 @@ function createBaseMsgFundCommunityPool(): MsgFundCommunityPool { export const MsgFundCommunityPool = { typeUrl: "/cosmos.distribution.v1beta1.MsgFundCommunityPool", aminoType: "cosmos-sdk/MsgFundCommunityPool", + is(o: any): o is MsgFundCommunityPool { + return o && (o.$typeUrl === MsgFundCommunityPool.typeUrl || Array.isArray(o.amount) && (!o.amount.length || Coin.is(o.amount[0])) && typeof o.depositor === "string"); + }, + isSDK(o: any): o is MsgFundCommunityPoolSDKType { + return o && (o.$typeUrl === MsgFundCommunityPool.typeUrl || Array.isArray(o.amount) && (!o.amount.length || Coin.isSDK(o.amount[0])) && typeof o.depositor === "string"); + }, + isAmino(o: any): o is MsgFundCommunityPoolAmino { + return o && (o.$typeUrl === MsgFundCommunityPool.typeUrl || Array.isArray(o.amount) && (!o.amount.length || Coin.isAmino(o.amount[0])) && typeof o.depositor === "string"); + }, encode(message: MsgFundCommunityPool, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.amount) { Coin.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -1026,6 +1106,12 @@ export const MsgFundCommunityPool = { typeUrl: "/cosmos.distribution.v1beta1.MsgFundCommunityPool", value: MsgFundCommunityPool.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgFundCommunityPool.typeUrl)) { + return; + } + Coin.registerTypeUrl(); } }; function createBaseMsgFundCommunityPoolResponse(): MsgFundCommunityPoolResponse { @@ -1040,6 +1126,15 @@ function createBaseMsgFundCommunityPoolResponse(): MsgFundCommunityPoolResponse export const MsgFundCommunityPoolResponse = { typeUrl: "/cosmos.distribution.v1beta1.MsgFundCommunityPoolResponse", aminoType: "cosmos-sdk/MsgFundCommunityPoolResponse", + is(o: any): o is MsgFundCommunityPoolResponse { + return o && o.$typeUrl === MsgFundCommunityPoolResponse.typeUrl; + }, + isSDK(o: any): o is MsgFundCommunityPoolResponseSDKType { + return o && o.$typeUrl === MsgFundCommunityPoolResponse.typeUrl; + }, + isAmino(o: any): o is MsgFundCommunityPoolResponseAmino { + return o && o.$typeUrl === MsgFundCommunityPoolResponse.typeUrl; + }, encode(_: MsgFundCommunityPoolResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -1104,5 +1199,6 @@ export const MsgFundCommunityPoolResponse = { typeUrl: "/cosmos.distribution.v1beta1.MsgFundCommunityPoolResponse", value: MsgFundCommunityPoolResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/cosmos/evidence/v1beta1/evidence.ts b/__fixtures__/v-next/outputv2/cosmos/evidence/v1beta1/evidence.ts index 81a1682f3a..6b3e90c613 100644 --- a/__fixtures__/v-next/outputv2/cosmos/evidence/v1beta1/evidence.ts +++ b/__fixtures__/v-next/outputv2/cosmos/evidence/v1beta1/evidence.ts @@ -68,6 +68,15 @@ function createBaseEquivocation(): Equivocation { export const Equivocation = { typeUrl: "/cosmos.evidence.v1beta1.Equivocation", aminoType: "cosmos-sdk/Equivocation", + is(o: any): o is Equivocation { + return o && (o.$typeUrl === Equivocation.typeUrl || typeof o.height === "bigint" && Timestamp.is(o.time) && typeof o.power === "bigint" && typeof o.consensusAddress === "string"); + }, + isSDK(o: any): o is EquivocationSDKType { + return o && (o.$typeUrl === Equivocation.typeUrl || typeof o.height === "bigint" && Timestamp.isSDK(o.time) && typeof o.power === "bigint" && typeof o.consensus_address === "string"); + }, + isAmino(o: any): o is EquivocationAmino { + return o && (o.$typeUrl === Equivocation.typeUrl || typeof o.height === "bigint" && Timestamp.isAmino(o.time) && typeof o.power === "bigint" && typeof o.consensus_address === "string"); + }, encode(message: Equivocation, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.height !== BigInt(0)) { writer.uint32(8).int64(message.height); @@ -197,5 +206,6 @@ export const Equivocation = { typeUrl: "/cosmos.evidence.v1beta1.Equivocation", value: Equivocation.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/cosmos/evidence/v1beta1/genesis.ts b/__fixtures__/v-next/outputv2/cosmos/evidence/v1beta1/genesis.ts index b8ae43b286..122dd0c863 100644 --- a/__fixtures__/v-next/outputv2/cosmos/evidence/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv2/cosmos/evidence/v1beta1/genesis.ts @@ -58,6 +58,15 @@ function createBaseGenesisState(): GenesisState { export const GenesisState = { typeUrl: "/cosmos.evidence.v1beta1.GenesisState", aminoType: "cosmos-sdk/GenesisState", + is(o: any): o is GenesisState { + return o && (o.$typeUrl === GenesisState.typeUrl || Array.isArray(o.evidence) && (!o.evidence.length || Any.is(o.evidence[0]))); + }, + isSDK(o: any): o is GenesisStateSDKType { + return o && (o.$typeUrl === GenesisState.typeUrl || Array.isArray(o.evidence) && (!o.evidence.length || Any.isSDK(o.evidence[0]))); + }, + isAmino(o: any): o is GenesisStateAmino { + return o && (o.$typeUrl === GenesisState.typeUrl || Array.isArray(o.evidence) && (!o.evidence.length || Any.isAmino(o.evidence[0]))); + }, encode(message: GenesisState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.evidence) { Any.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -148,5 +157,6 @@ export const GenesisState = { typeUrl: "/cosmos.evidence.v1beta1.GenesisState", value: GenesisState.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/cosmos/evidence/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputv2/cosmos/evidence/v1beta1/query.rpc.func.ts new file mode 100644 index 0000000000..917bc07f6f --- /dev/null +++ b/__fixtures__/v-next/outputv2/cosmos/evidence/v1beta1/query.rpc.func.ts @@ -0,0 +1,28 @@ +import { buildQuery } from "../../../helper-func-types"; +import { QueryEvidenceRequest, QueryEvidenceResponse, QueryAllEvidenceRequest, QueryAllEvidenceResponse } from "./query"; +/** + * Evidence queries evidence based on evidence hash. + * @name getEvidence + * @package cosmos.evidence.v1beta1 + * @see proto service: cosmos.evidence.v1beta1.Evidence + */ +export const getEvidence = buildQuery({ + encode: QueryEvidenceRequest.encode, + decode: QueryEvidenceResponse.decode, + service: "cosmos.evidence.v1beta1.Query", + method: "Evidence", + deps: [QueryEvidenceRequest, QueryEvidenceResponse] +}); +/** + * AllEvidence queries all evidence. + * @name getAllEvidence + * @package cosmos.evidence.v1beta1 + * @see proto service: cosmos.evidence.v1beta1.AllEvidence + */ +export const getAllEvidence = buildQuery({ + encode: QueryAllEvidenceRequest.encode, + decode: QueryAllEvidenceResponse.decode, + service: "cosmos.evidence.v1beta1.Query", + method: "AllEvidence", + deps: [QueryAllEvidenceRequest, QueryAllEvidenceResponse] +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/cosmos/evidence/v1beta1/query.ts b/__fixtures__/v-next/outputv2/cosmos/evidence/v1beta1/query.ts index 8597c27603..4f8830a100 100644 --- a/__fixtures__/v-next/outputv2/cosmos/evidence/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv2/cosmos/evidence/v1beta1/query.ts @@ -3,6 +3,7 @@ import { Any, AnyAmino, AnySDKType } from "../../../google/protobuf/any"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "cosmos.evidence.v1beta1"; /** * QueryEvidenceRequest is the request type for the Query/Evidence RPC method. @@ -197,6 +198,15 @@ function createBaseQueryEvidenceRequest(): QueryEvidenceRequest { export const QueryEvidenceRequest = { typeUrl: "/cosmos.evidence.v1beta1.QueryEvidenceRequest", aminoType: "cosmos-sdk/QueryEvidenceRequest", + is(o: any): o is QueryEvidenceRequest { + return o && (o.$typeUrl === QueryEvidenceRequest.typeUrl || o.evidenceHash instanceof Uint8Array || typeof o.evidenceHash === "string"); + }, + isSDK(o: any): o is QueryEvidenceRequestSDKType { + return o && (o.$typeUrl === QueryEvidenceRequest.typeUrl || o.evidence_hash instanceof Uint8Array || typeof o.evidence_hash === "string"); + }, + isAmino(o: any): o is QueryEvidenceRequestAmino { + return o && (o.$typeUrl === QueryEvidenceRequest.typeUrl || o.evidence_hash instanceof Uint8Array || typeof o.evidence_hash === "string"); + }, encode(message: QueryEvidenceRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.evidenceHash.length !== 0) { writer.uint32(10).bytes(message.evidenceHash); @@ -277,7 +287,8 @@ export const QueryEvidenceRequest = { typeUrl: "/cosmos.evidence.v1beta1.QueryEvidenceRequest", value: QueryEvidenceRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryEvidenceResponse(): QueryEvidenceResponse { return { @@ -293,6 +304,15 @@ function createBaseQueryEvidenceResponse(): QueryEvidenceResponse { export const QueryEvidenceResponse = { typeUrl: "/cosmos.evidence.v1beta1.QueryEvidenceResponse", aminoType: "cosmos-sdk/QueryEvidenceResponse", + is(o: any): o is QueryEvidenceResponse { + return o && o.$typeUrl === QueryEvidenceResponse.typeUrl; + }, + isSDK(o: any): o is QueryEvidenceResponseSDKType { + return o && o.$typeUrl === QueryEvidenceResponse.typeUrl; + }, + isAmino(o: any): o is QueryEvidenceResponseAmino { + return o && o.$typeUrl === QueryEvidenceResponse.typeUrl; + }, encode(message: QueryEvidenceResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.evidence !== undefined) { Any.encode(message.evidence, writer.uint32(10).fork()).ldelim(); @@ -375,7 +395,8 @@ export const QueryEvidenceResponse = { typeUrl: "/cosmos.evidence.v1beta1.QueryEvidenceResponse", value: QueryEvidenceResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryAllEvidenceRequest(): QueryAllEvidenceRequest { return { @@ -392,6 +413,15 @@ function createBaseQueryAllEvidenceRequest(): QueryAllEvidenceRequest { export const QueryAllEvidenceRequest = { typeUrl: "/cosmos.evidence.v1beta1.QueryAllEvidenceRequest", aminoType: "cosmos-sdk/QueryAllEvidenceRequest", + is(o: any): o is QueryAllEvidenceRequest { + return o && o.$typeUrl === QueryAllEvidenceRequest.typeUrl; + }, + isSDK(o: any): o is QueryAllEvidenceRequestSDKType { + return o && o.$typeUrl === QueryAllEvidenceRequest.typeUrl; + }, + isAmino(o: any): o is QueryAllEvidenceRequestAmino { + return o && o.$typeUrl === QueryAllEvidenceRequest.typeUrl; + }, encode(message: QueryAllEvidenceRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.pagination !== undefined) { PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); @@ -474,6 +504,12 @@ export const QueryAllEvidenceRequest = { typeUrl: "/cosmos.evidence.v1beta1.QueryAllEvidenceRequest", value: QueryAllEvidenceRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryAllEvidenceRequest.typeUrl)) { + return; + } + PageRequest.registerTypeUrl(); } }; function createBaseQueryAllEvidenceResponse(): QueryAllEvidenceResponse { @@ -492,6 +528,15 @@ function createBaseQueryAllEvidenceResponse(): QueryAllEvidenceResponse { export const QueryAllEvidenceResponse = { typeUrl: "/cosmos.evidence.v1beta1.QueryAllEvidenceResponse", aminoType: "cosmos-sdk/QueryAllEvidenceResponse", + is(o: any): o is QueryAllEvidenceResponse { + return o && (o.$typeUrl === QueryAllEvidenceResponse.typeUrl || Array.isArray(o.evidence) && (!o.evidence.length || Any.is(o.evidence[0]))); + }, + isSDK(o: any): o is QueryAllEvidenceResponseSDKType { + return o && (o.$typeUrl === QueryAllEvidenceResponse.typeUrl || Array.isArray(o.evidence) && (!o.evidence.length || Any.isSDK(o.evidence[0]))); + }, + isAmino(o: any): o is QueryAllEvidenceResponseAmino { + return o && (o.$typeUrl === QueryAllEvidenceResponse.typeUrl || Array.isArray(o.evidence) && (!o.evidence.length || Any.isAmino(o.evidence[0]))); + }, encode(message: QueryAllEvidenceResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.evidence) { Any.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -599,5 +644,11 @@ export const QueryAllEvidenceResponse = { typeUrl: "/cosmos.evidence.v1beta1.QueryAllEvidenceResponse", value: QueryAllEvidenceResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryAllEvidenceResponse.typeUrl)) { + return; + } + PageResponse.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/cosmos/evidence/v1beta1/tx.registry.ts b/__fixtures__/v-next/outputv2/cosmos/evidence/v1beta1/tx.registry.ts index 8f0a633d3b..3c26f586b0 100644 --- a/__fixtures__/v-next/outputv2/cosmos/evidence/v1beta1/tx.registry.ts +++ b/__fixtures__/v-next/outputv2/cosmos/evidence/v1beta1/tx.registry.ts @@ -1,11 +1,6 @@ -import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { TelescopeGeneratedType } from "../../../types"; import { MsgSubmitEvidence } from "./tx"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/cosmos.evidence.v1beta1.MsgSubmitEvidence", MsgSubmitEvidence]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/cosmos.evidence.v1beta1.MsgSubmitEvidence", MsgSubmitEvidence]]; export const MessageComposer = { encoded: { submitEvidence(value: MsgSubmitEvidence) { diff --git a/__fixtures__/v-next/outputv2/cosmos/evidence/v1beta1/tx.rpc.func.ts b/__fixtures__/v-next/outputv2/cosmos/evidence/v1beta1/tx.rpc.func.ts new file mode 100644 index 0000000000..f5058f213a --- /dev/null +++ b/__fixtures__/v-next/outputv2/cosmos/evidence/v1beta1/tx.rpc.func.ts @@ -0,0 +1,12 @@ +import { buildTx } from "../../../helper-func-types"; +import { MsgSubmitEvidence } from "./tx"; +/** + * SubmitEvidence submits an arbitrary Evidence of misbehavior such as equivocation or + * counterfactual signing. + * @name submitEvidence + * @package cosmos.evidence.v1beta1 + * @see proto service: cosmos.evidence.v1beta1.SubmitEvidence + */ +export const submitEvidence = buildTx({ + msg: MsgSubmitEvidence +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/cosmos/evidence/v1beta1/tx.ts b/__fixtures__/v-next/outputv2/cosmos/evidence/v1beta1/tx.ts index 965f4c9276..ce3765786a 100644 --- a/__fixtures__/v-next/outputv2/cosmos/evidence/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputv2/cosmos/evidence/v1beta1/tx.ts @@ -1,5 +1,6 @@ import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../google/protobuf/any"; import { BinaryReader, BinaryWriter } from "../../../binary"; +import { GlobalDecoderRegistry } from "../../../registry"; import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "cosmos.evidence.v1beta1"; @@ -104,12 +105,21 @@ function createBaseMsgSubmitEvidence(): MsgSubmitEvidence { export const MsgSubmitEvidence = { typeUrl: "/cosmos.evidence.v1beta1.MsgSubmitEvidence", aminoType: "cosmos-sdk/MsgSubmitEvidence", + is(o: any): o is MsgSubmitEvidence { + return o && (o.$typeUrl === MsgSubmitEvidence.typeUrl || typeof o.submitter === "string"); + }, + isSDK(o: any): o is MsgSubmitEvidenceSDKType { + return o && (o.$typeUrl === MsgSubmitEvidence.typeUrl || typeof o.submitter === "string"); + }, + isAmino(o: any): o is MsgSubmitEvidenceAmino { + return o && (o.$typeUrl === MsgSubmitEvidence.typeUrl || typeof o.submitter === "string"); + }, encode(message: MsgSubmitEvidence, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.submitter !== "") { writer.uint32(10).string(message.submitter); } if (message.evidence !== undefined) { - Any.encode((message.evidence as Any), writer.uint32(18).fork()).ldelim(); + Any.encode(GlobalDecoderRegistry.wrapAny(message.evidence), writer.uint32(18).fork()).ldelim(); } return writer; }, @@ -124,7 +134,7 @@ export const MsgSubmitEvidence = { message.submitter = reader.string(); break; case 2: - message.evidence = (Evidence_InterfaceDecoder(reader) as Any); + message.evidence = GlobalDecoderRegistry.unwrapAny(reader); break; default: reader.skipType(tag & 7); @@ -136,33 +146,33 @@ export const MsgSubmitEvidence = { fromJSON(object: any): MsgSubmitEvidence { const obj = createBaseMsgSubmitEvidence(); if (isSet(object.submitter)) obj.submitter = String(object.submitter); - if (isSet(object.evidence)) obj.evidence = Any.fromJSON(object.evidence); + if (isSet(object.evidence)) obj.evidence = GlobalDecoderRegistry.fromJSON(object.evidence); return obj; }, toJSON(message: MsgSubmitEvidence): JsonSafe { const obj: any = {}; message.submitter !== undefined && (obj.submitter = message.submitter); - message.evidence !== undefined && (obj.evidence = message.evidence ? Any.toJSON(message.evidence) : undefined); + message.evidence !== undefined && (obj.evidence = message.evidence ? GlobalDecoderRegistry.toJSON(message.evidence) : undefined); return obj; }, fromPartial(object: DeepPartial): MsgSubmitEvidence { const message = createBaseMsgSubmitEvidence(); message.submitter = object.submitter ?? ""; if (object.evidence !== undefined && object.evidence !== null) { - message.evidence = Any.fromPartial(object.evidence); + message.evidence = GlobalDecoderRegistry.fromPartial(object.evidence); } return message; }, fromSDK(object: MsgSubmitEvidenceSDKType): MsgSubmitEvidence { return { submitter: object?.submitter, - evidence: object.evidence ? Any.fromSDK(object.evidence) : undefined + evidence: object.evidence ? GlobalDecoderRegistry.fromSDK(object.evidence) : undefined }; }, toSDK(message: MsgSubmitEvidence): MsgSubmitEvidenceSDKType { const obj: any = {}; obj.submitter = message.submitter; - message.evidence !== undefined && (obj.evidence = message.evidence ? Any.toSDK(message.evidence) : undefined); + message.evidence !== undefined && (obj.evidence = message.evidence ? GlobalDecoderRegistry.toSDK(message.evidence) : undefined); return obj; }, fromAmino(object: MsgSubmitEvidenceAmino): MsgSubmitEvidence { @@ -171,14 +181,14 @@ export const MsgSubmitEvidence = { message.submitter = object.submitter; } if (object.evidence !== undefined && object.evidence !== null) { - message.evidence = Evidence_FromAmino(object.evidence); + message.evidence = GlobalDecoderRegistry.fromAminoMsg(object.evidence); } return message; }, toAmino(message: MsgSubmitEvidence): MsgSubmitEvidenceAmino { const obj: any = {}; obj.submitter = message.submitter === "" ? undefined : message.submitter; - obj.evidence = message.evidence ? Evidence_ToAmino((message.evidence as Any)) : undefined; + obj.evidence = message.evidence ? GlobalDecoderRegistry.toAminoMsg(message.evidence) : undefined; return obj; }, fromAminoMsg(object: MsgSubmitEvidenceAminoMsg): MsgSubmitEvidence { @@ -201,7 +211,8 @@ export const MsgSubmitEvidence = { typeUrl: "/cosmos.evidence.v1beta1.MsgSubmitEvidence", value: MsgSubmitEvidence.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgSubmitEvidenceResponse(): MsgSubmitEvidenceResponse { return { @@ -217,6 +228,15 @@ function createBaseMsgSubmitEvidenceResponse(): MsgSubmitEvidenceResponse { export const MsgSubmitEvidenceResponse = { typeUrl: "/cosmos.evidence.v1beta1.MsgSubmitEvidenceResponse", aminoType: "cosmos-sdk/MsgSubmitEvidenceResponse", + is(o: any): o is MsgSubmitEvidenceResponse { + return o && (o.$typeUrl === MsgSubmitEvidenceResponse.typeUrl || o.hash instanceof Uint8Array || typeof o.hash === "string"); + }, + isSDK(o: any): o is MsgSubmitEvidenceResponseSDKType { + return o && (o.$typeUrl === MsgSubmitEvidenceResponse.typeUrl || o.hash instanceof Uint8Array || typeof o.hash === "string"); + }, + isAmino(o: any): o is MsgSubmitEvidenceResponseAmino { + return o && (o.$typeUrl === MsgSubmitEvidenceResponse.typeUrl || o.hash instanceof Uint8Array || typeof o.hash === "string"); + }, encode(message: MsgSubmitEvidenceResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.hash.length !== 0) { writer.uint32(34).bytes(message.hash); @@ -297,19 +317,6 @@ export const MsgSubmitEvidenceResponse = { typeUrl: "/cosmos.evidence.v1beta1.MsgSubmitEvidenceResponse", value: MsgSubmitEvidenceResponse.encode(message).finish() }; - } -}; -export const Evidence_InterfaceDecoder = (input: BinaryReader | Uint8Array): Any => { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - const data = Any.decode(reader, reader.uint32()); - switch (data.typeUrl) { - default: - return data; - } -}; -export const Evidence_FromAmino = (content: AnyAmino): Any => { - return Any.fromAmino(content); -}; -export const Evidence_ToAmino = (content: Any) => { - return Any.toAmino(content); + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/cosmos/feegrant/v1beta1/feegrant.ts b/__fixtures__/v-next/outputv2/cosmos/feegrant/v1beta1/feegrant.ts index 29dcd58c46..a29787c582 100644 --- a/__fixtures__/v-next/outputv2/cosmos/feegrant/v1beta1/feegrant.ts +++ b/__fixtures__/v-next/outputv2/cosmos/feegrant/v1beta1/feegrant.ts @@ -5,6 +5,7 @@ import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../google/protobuf import { BinaryReader, BinaryWriter } from "../../../binary"; import { toTimestamp, fromTimestamp, isSet, DeepPartial } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "cosmos.feegrant.v1beta1"; /** * BasicAllowance implements Allowance with a one-time grant of tokens @@ -295,6 +296,15 @@ function createBaseBasicAllowance(): BasicAllowance { export const BasicAllowance = { typeUrl: "/cosmos.feegrant.v1beta1.BasicAllowance", aminoType: "cosmos-sdk/BasicAllowance", + is(o: any): o is BasicAllowance { + return o && (o.$typeUrl === BasicAllowance.typeUrl || Array.isArray(o.spendLimit) && (!o.spendLimit.length || Coin.is(o.spendLimit[0]))); + }, + isSDK(o: any): o is BasicAllowanceSDKType { + return o && (o.$typeUrl === BasicAllowance.typeUrl || Array.isArray(o.spend_limit) && (!o.spend_limit.length || Coin.isSDK(o.spend_limit[0]))); + }, + isAmino(o: any): o is BasicAllowanceAmino { + return o && (o.$typeUrl === BasicAllowance.typeUrl || Array.isArray(o.spend_limit) && (!o.spend_limit.length || Coin.isAmino(o.spend_limit[0]))); + }, encode(message: BasicAllowance, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.spendLimit) { Coin.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -400,6 +410,14 @@ export const BasicAllowance = { typeUrl: "/cosmos.feegrant.v1beta1.BasicAllowance", value: BasicAllowance.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(BasicAllowance.typeUrl)) { + return; + } + GlobalDecoderRegistry.register(BasicAllowance.typeUrl, BasicAllowance); + GlobalDecoderRegistry.registerAminoProtoMapping(BasicAllowance.aminoType, BasicAllowance.typeUrl); + Coin.registerTypeUrl(); } }; function createBasePeriodicAllowance(): PeriodicAllowance { @@ -422,6 +440,15 @@ function createBasePeriodicAllowance(): PeriodicAllowance { export const PeriodicAllowance = { typeUrl: "/cosmos.feegrant.v1beta1.PeriodicAllowance", aminoType: "cosmos-sdk/PeriodicAllowance", + is(o: any): o is PeriodicAllowance { + return o && (o.$typeUrl === PeriodicAllowance.typeUrl || BasicAllowance.is(o.basic) && Duration.is(o.period) && Array.isArray(o.periodSpendLimit) && (!o.periodSpendLimit.length || Coin.is(o.periodSpendLimit[0])) && Array.isArray(o.periodCanSpend) && (!o.periodCanSpend.length || Coin.is(o.periodCanSpend[0])) && Timestamp.is(o.periodReset)); + }, + isSDK(o: any): o is PeriodicAllowanceSDKType { + return o && (o.$typeUrl === PeriodicAllowance.typeUrl || BasicAllowance.isSDK(o.basic) && Duration.isSDK(o.period) && Array.isArray(o.period_spend_limit) && (!o.period_spend_limit.length || Coin.isSDK(o.period_spend_limit[0])) && Array.isArray(o.period_can_spend) && (!o.period_can_spend.length || Coin.isSDK(o.period_can_spend[0])) && Timestamp.isSDK(o.period_reset)); + }, + isAmino(o: any): o is PeriodicAllowanceAmino { + return o && (o.$typeUrl === PeriodicAllowance.typeUrl || BasicAllowance.isAmino(o.basic) && Duration.isAmino(o.period) && Array.isArray(o.period_spend_limit) && (!o.period_spend_limit.length || Coin.isAmino(o.period_spend_limit[0])) && Array.isArray(o.period_can_spend) && (!o.period_can_spend.length || Coin.isAmino(o.period_can_spend[0])) && Timestamp.isAmino(o.period_reset)); + }, encode(message: PeriodicAllowance, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.basic !== undefined) { BasicAllowance.encode(message.basic, writer.uint32(10).fork()).ldelim(); @@ -586,6 +613,15 @@ export const PeriodicAllowance = { typeUrl: "/cosmos.feegrant.v1beta1.PeriodicAllowance", value: PeriodicAllowance.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(PeriodicAllowance.typeUrl)) { + return; + } + GlobalDecoderRegistry.register(PeriodicAllowance.typeUrl, PeriodicAllowance); + GlobalDecoderRegistry.registerAminoProtoMapping(PeriodicAllowance.aminoType, PeriodicAllowance.typeUrl); + BasicAllowance.registerTypeUrl(); + Coin.registerTypeUrl(); } }; function createBaseAllowedMsgAllowance(): AllowedMsgAllowance { @@ -604,9 +640,18 @@ function createBaseAllowedMsgAllowance(): AllowedMsgAllowance { export const AllowedMsgAllowance = { typeUrl: "/cosmos.feegrant.v1beta1.AllowedMsgAllowance", aminoType: "cosmos-sdk/AllowedMsgAllowance", + is(o: any): o is AllowedMsgAllowance { + return o && (o.$typeUrl === AllowedMsgAllowance.typeUrl || Array.isArray(o.allowedMessages) && (!o.allowedMessages.length || typeof o.allowedMessages[0] === "string")); + }, + isSDK(o: any): o is AllowedMsgAllowanceSDKType { + return o && (o.$typeUrl === AllowedMsgAllowance.typeUrl || Array.isArray(o.allowed_messages) && (!o.allowed_messages.length || typeof o.allowed_messages[0] === "string")); + }, + isAmino(o: any): o is AllowedMsgAllowanceAmino { + return o && (o.$typeUrl === AllowedMsgAllowance.typeUrl || Array.isArray(o.allowed_messages) && (!o.allowed_messages.length || typeof o.allowed_messages[0] === "string")); + }, encode(message: AllowedMsgAllowance, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.allowance !== undefined) { - Any.encode((message.allowance as Any), writer.uint32(10).fork()).ldelim(); + Any.encode(GlobalDecoderRegistry.wrapAny(message.allowance), writer.uint32(10).fork()).ldelim(); } for (const v of message.allowedMessages) { writer.uint32(18).string(v!); @@ -621,7 +666,7 @@ export const AllowedMsgAllowance = { const tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.allowance = (FeeAllowanceI_InterfaceDecoder(reader) as Any); + message.allowance = GlobalDecoderRegistry.unwrapAny(reader); break; case 2: message.allowedMessages.push(reader.string()); @@ -635,13 +680,13 @@ export const AllowedMsgAllowance = { }, fromJSON(object: any): AllowedMsgAllowance { const obj = createBaseAllowedMsgAllowance(); - if (isSet(object.allowance)) obj.allowance = Any.fromJSON(object.allowance); + if (isSet(object.allowance)) obj.allowance = GlobalDecoderRegistry.fromJSON(object.allowance); if (Array.isArray(object?.allowedMessages)) obj.allowedMessages = object.allowedMessages.map((e: any) => String(e)); return obj; }, toJSON(message: AllowedMsgAllowance): JsonSafe { const obj: any = {}; - message.allowance !== undefined && (obj.allowance = message.allowance ? Any.toJSON(message.allowance) : undefined); + message.allowance !== undefined && (obj.allowance = message.allowance ? GlobalDecoderRegistry.toJSON(message.allowance) : undefined); if (message.allowedMessages) { obj.allowedMessages = message.allowedMessages.map(e => e); } else { @@ -652,20 +697,20 @@ export const AllowedMsgAllowance = { fromPartial(object: DeepPartial): AllowedMsgAllowance { const message = createBaseAllowedMsgAllowance(); if (object.allowance !== undefined && object.allowance !== null) { - message.allowance = Any.fromPartial(object.allowance); + message.allowance = GlobalDecoderRegistry.fromPartial(object.allowance); } message.allowedMessages = object.allowedMessages?.map(e => e) || []; return message; }, fromSDK(object: AllowedMsgAllowanceSDKType): AllowedMsgAllowance { return { - allowance: object.allowance ? Any.fromSDK(object.allowance) : undefined, + allowance: object.allowance ? GlobalDecoderRegistry.fromSDK(object.allowance) : undefined, allowedMessages: Array.isArray(object?.allowed_messages) ? object.allowed_messages.map((e: any) => e) : [] }; }, toSDK(message: AllowedMsgAllowance): AllowedMsgAllowanceSDKType { const obj: any = {}; - message.allowance !== undefined && (obj.allowance = message.allowance ? Any.toSDK(message.allowance) : undefined); + message.allowance !== undefined && (obj.allowance = message.allowance ? GlobalDecoderRegistry.toSDK(message.allowance) : undefined); if (message.allowedMessages) { obj.allowed_messages = message.allowedMessages.map(e => e); } else { @@ -676,14 +721,14 @@ export const AllowedMsgAllowance = { fromAmino(object: AllowedMsgAllowanceAmino): AllowedMsgAllowance { const message = createBaseAllowedMsgAllowance(); if (object.allowance !== undefined && object.allowance !== null) { - message.allowance = FeeAllowanceI_FromAmino(object.allowance); + message.allowance = GlobalDecoderRegistry.fromAminoMsg(object.allowance); } message.allowedMessages = object.allowed_messages?.map(e => e) || []; return message; }, toAmino(message: AllowedMsgAllowance): AllowedMsgAllowanceAmino { const obj: any = {}; - obj.allowance = message.allowance ? FeeAllowanceI_ToAmino((message.allowance as Any)) : undefined; + obj.allowance = message.allowance ? GlobalDecoderRegistry.toAminoMsg(message.allowance) : undefined; if (message.allowedMessages) { obj.allowed_messages = message.allowedMessages.map(e => e); } else { @@ -711,6 +756,16 @@ export const AllowedMsgAllowance = { typeUrl: "/cosmos.feegrant.v1beta1.AllowedMsgAllowance", value: AllowedMsgAllowance.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(AllowedMsgAllowance.typeUrl)) { + return; + } + GlobalDecoderRegistry.register(AllowedMsgAllowance.typeUrl, AllowedMsgAllowance); + GlobalDecoderRegistry.registerAminoProtoMapping(AllowedMsgAllowance.aminoType, AllowedMsgAllowance.typeUrl); + BasicAllowance.registerTypeUrl(); + PeriodicAllowance.registerTypeUrl(); + AllowedMsgAllowance.registerTypeUrl(); } }; function createBaseGrant(): Grant { @@ -729,6 +784,15 @@ function createBaseGrant(): Grant { export const Grant = { typeUrl: "/cosmos.feegrant.v1beta1.Grant", aminoType: "cosmos-sdk/Grant", + is(o: any): o is Grant { + return o && (o.$typeUrl === Grant.typeUrl || typeof o.granter === "string" && typeof o.grantee === "string"); + }, + isSDK(o: any): o is GrantSDKType { + return o && (o.$typeUrl === Grant.typeUrl || typeof o.granter === "string" && typeof o.grantee === "string"); + }, + isAmino(o: any): o is GrantAmino { + return o && (o.$typeUrl === Grant.typeUrl || typeof o.granter === "string" && typeof o.grantee === "string"); + }, encode(message: Grant, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.granter !== "") { writer.uint32(10).string(message.granter); @@ -737,7 +801,7 @@ export const Grant = { writer.uint32(18).string(message.grantee); } if (message.allowance !== undefined) { - Any.encode((message.allowance as Any), writer.uint32(26).fork()).ldelim(); + Any.encode(GlobalDecoderRegistry.wrapAny(message.allowance), writer.uint32(26).fork()).ldelim(); } return writer; }, @@ -755,7 +819,7 @@ export const Grant = { message.grantee = reader.string(); break; case 3: - message.allowance = (FeeAllowanceI_InterfaceDecoder(reader) as Any); + message.allowance = GlobalDecoderRegistry.unwrapAny(reader); break; default: reader.skipType(tag & 7); @@ -768,14 +832,14 @@ export const Grant = { const obj = createBaseGrant(); if (isSet(object.granter)) obj.granter = String(object.granter); if (isSet(object.grantee)) obj.grantee = String(object.grantee); - if (isSet(object.allowance)) obj.allowance = Any.fromJSON(object.allowance); + if (isSet(object.allowance)) obj.allowance = GlobalDecoderRegistry.fromJSON(object.allowance); return obj; }, toJSON(message: Grant): JsonSafe { const obj: any = {}; message.granter !== undefined && (obj.granter = message.granter); message.grantee !== undefined && (obj.grantee = message.grantee); - message.allowance !== undefined && (obj.allowance = message.allowance ? Any.toJSON(message.allowance) : undefined); + message.allowance !== undefined && (obj.allowance = message.allowance ? GlobalDecoderRegistry.toJSON(message.allowance) : undefined); return obj; }, fromPartial(object: DeepPartial): Grant { @@ -783,7 +847,7 @@ export const Grant = { message.granter = object.granter ?? ""; message.grantee = object.grantee ?? ""; if (object.allowance !== undefined && object.allowance !== null) { - message.allowance = Any.fromPartial(object.allowance); + message.allowance = GlobalDecoderRegistry.fromPartial(object.allowance); } return message; }, @@ -791,14 +855,14 @@ export const Grant = { return { granter: object?.granter, grantee: object?.grantee, - allowance: object.allowance ? Any.fromSDK(object.allowance) : undefined + allowance: object.allowance ? GlobalDecoderRegistry.fromSDK(object.allowance) : undefined }; }, toSDK(message: Grant): GrantSDKType { const obj: any = {}; obj.granter = message.granter; obj.grantee = message.grantee; - message.allowance !== undefined && (obj.allowance = message.allowance ? Any.toSDK(message.allowance) : undefined); + message.allowance !== undefined && (obj.allowance = message.allowance ? GlobalDecoderRegistry.toSDK(message.allowance) : undefined); return obj; }, fromAmino(object: GrantAmino): Grant { @@ -810,7 +874,7 @@ export const Grant = { message.grantee = object.grantee; } if (object.allowance !== undefined && object.allowance !== null) { - message.allowance = FeeAllowanceI_FromAmino(object.allowance); + message.allowance = GlobalDecoderRegistry.fromAminoMsg(object.allowance); } return message; }, @@ -818,7 +882,7 @@ export const Grant = { const obj: any = {}; obj.granter = message.granter === "" ? undefined : message.granter; obj.grantee = message.grantee === "" ? undefined : message.grantee; - obj.allowance = message.allowance ? FeeAllowanceI_ToAmino((message.allowance as Any)) : undefined; + obj.allowance = message.allowance ? GlobalDecoderRegistry.toAminoMsg(message.allowance) : undefined; return obj; }, fromAminoMsg(object: GrantAminoMsg): Grant { @@ -841,61 +905,13 @@ export const Grant = { typeUrl: "/cosmos.feegrant.v1beta1.Grant", value: Grant.encode(message).finish() }; - } -}; -export const FeeAllowanceI_InterfaceDecoder = (input: BinaryReader | Uint8Array): BasicAllowance | PeriodicAllowance | AllowedMsgAllowance | Any => { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - const data = Any.decode(reader, reader.uint32()); - switch (data.typeUrl) { - case "/cosmos.feegrant.v1beta1.BasicAllowance": - return BasicAllowance.decode(data.value); - case "/cosmos.feegrant.v1beta1.PeriodicAllowance": - return PeriodicAllowance.decode(data.value); - case "/cosmos.feegrant.v1beta1.AllowedMsgAllowance": - return AllowedMsgAllowance.decode(data.value); - default: - return data; - } -}; -export const FeeAllowanceI_FromAmino = (content: AnyAmino): Any => { - switch (content.type) { - case "cosmos-sdk/BasicAllowance": - return Any.fromPartial({ - typeUrl: "/cosmos.feegrant.v1beta1.BasicAllowance", - value: BasicAllowance.encode(BasicAllowance.fromPartial(BasicAllowance.fromAmino(content.value))).finish() - }); - case "cosmos-sdk/PeriodicAllowance": - return Any.fromPartial({ - typeUrl: "/cosmos.feegrant.v1beta1.PeriodicAllowance", - value: PeriodicAllowance.encode(PeriodicAllowance.fromPartial(PeriodicAllowance.fromAmino(content.value))).finish() - }); - case "cosmos-sdk/AllowedMsgAllowance": - return Any.fromPartial({ - typeUrl: "/cosmos.feegrant.v1beta1.AllowedMsgAllowance", - value: AllowedMsgAllowance.encode(AllowedMsgAllowance.fromPartial(AllowedMsgAllowance.fromAmino(content.value))).finish() - }); - default: - return Any.fromAmino(content); - } -}; -export const FeeAllowanceI_ToAmino = (content: Any) => { - switch (content.typeUrl) { - case "/cosmos.feegrant.v1beta1.BasicAllowance": - return { - type: "cosmos-sdk/BasicAllowance", - value: BasicAllowance.toAmino(BasicAllowance.decode(content.value, undefined)) - }; - case "/cosmos.feegrant.v1beta1.PeriodicAllowance": - return { - type: "cosmos-sdk/PeriodicAllowance", - value: PeriodicAllowance.toAmino(PeriodicAllowance.decode(content.value, undefined)) - }; - case "/cosmos.feegrant.v1beta1.AllowedMsgAllowance": - return { - type: "cosmos-sdk/AllowedMsgAllowance", - value: AllowedMsgAllowance.toAmino(AllowedMsgAllowance.decode(content.value, undefined)) - }; - default: - return Any.toAmino(content); + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Grant.typeUrl)) { + return; + } + BasicAllowance.registerTypeUrl(); + PeriodicAllowance.registerTypeUrl(); + AllowedMsgAllowance.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/cosmos/feegrant/v1beta1/genesis.ts b/__fixtures__/v-next/outputv2/cosmos/feegrant/v1beta1/genesis.ts index c8cba71985..133873f9b7 100644 --- a/__fixtures__/v-next/outputv2/cosmos/feegrant/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv2/cosmos/feegrant/v1beta1/genesis.ts @@ -2,6 +2,7 @@ import { Grant, GrantAmino, GrantSDKType } from "./feegrant"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { JsonSafe } from "../../../json-safe"; import { DeepPartial } from "../../../helpers"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "cosmos.feegrant.v1beta1"; /** * GenesisState contains a set of fee allowances, persisted from the store @@ -52,6 +53,15 @@ function createBaseGenesisState(): GenesisState { export const GenesisState = { typeUrl: "/cosmos.feegrant.v1beta1.GenesisState", aminoType: "cosmos-sdk/GenesisState", + is(o: any): o is GenesisState { + return o && (o.$typeUrl === GenesisState.typeUrl || Array.isArray(o.allowances) && (!o.allowances.length || Grant.is(o.allowances[0]))); + }, + isSDK(o: any): o is GenesisStateSDKType { + return o && (o.$typeUrl === GenesisState.typeUrl || Array.isArray(o.allowances) && (!o.allowances.length || Grant.isSDK(o.allowances[0]))); + }, + isAmino(o: any): o is GenesisStateAmino { + return o && (o.$typeUrl === GenesisState.typeUrl || Array.isArray(o.allowances) && (!o.allowances.length || Grant.isAmino(o.allowances[0]))); + }, encode(message: GenesisState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.allowances) { Grant.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -142,5 +152,11 @@ export const GenesisState = { typeUrl: "/cosmos.feegrant.v1beta1.GenesisState", value: GenesisState.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GenesisState.typeUrl)) { + return; + } + Grant.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/cosmos/feegrant/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputv2/cosmos/feegrant/v1beta1/query.rpc.func.ts new file mode 100644 index 0000000000..8a674f1e5c --- /dev/null +++ b/__fixtures__/v-next/outputv2/cosmos/feegrant/v1beta1/query.rpc.func.ts @@ -0,0 +1,42 @@ +import { buildQuery } from "../../../helper-func-types"; +import { QueryAllowanceRequest, QueryAllowanceResponse, QueryAllowancesRequest, QueryAllowancesResponse, QueryAllowancesByGranterRequest, QueryAllowancesByGranterResponse } from "./query"; +/** + * Allowance returns fee granted to the grantee by the granter. + * @name getAllowance + * @package cosmos.feegrant.v1beta1 + * @see proto service: cosmos.feegrant.v1beta1.Allowance + */ +export const getAllowance = buildQuery({ + encode: QueryAllowanceRequest.encode, + decode: QueryAllowanceResponse.decode, + service: "cosmos.feegrant.v1beta1.Query", + method: "Allowance", + deps: [QueryAllowanceRequest, QueryAllowanceResponse] +}); +/** + * Allowances returns all the grants for address. + * @name getAllowances + * @package cosmos.feegrant.v1beta1 + * @see proto service: cosmos.feegrant.v1beta1.Allowances + */ +export const getAllowances = buildQuery({ + encode: QueryAllowancesRequest.encode, + decode: QueryAllowancesResponse.decode, + service: "cosmos.feegrant.v1beta1.Query", + method: "Allowances", + deps: [QueryAllowancesRequest, QueryAllowancesResponse] +}); +/** + * AllowancesByGranter returns all the grants given by an address + * Since v0.46 + * @name getAllowancesByGranter + * @package cosmos.feegrant.v1beta1 + * @see proto service: cosmos.feegrant.v1beta1.AllowancesByGranter + */ +export const getAllowancesByGranter = buildQuery({ + encode: QueryAllowancesByGranterRequest.encode, + decode: QueryAllowancesByGranterResponse.decode, + service: "cosmos.feegrant.v1beta1.Query", + method: "AllowancesByGranter", + deps: [QueryAllowancesByGranterRequest, QueryAllowancesByGranterResponse] +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/cosmos/feegrant/v1beta1/query.ts b/__fixtures__/v-next/outputv2/cosmos/feegrant/v1beta1/query.ts index 187c6a354b..e7e26140e3 100644 --- a/__fixtures__/v-next/outputv2/cosmos/feegrant/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv2/cosmos/feegrant/v1beta1/query.ts @@ -3,6 +3,7 @@ import { Grant, GrantAmino, GrantSDKType } from "./feegrant"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { isSet, DeepPartial } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "cosmos.feegrant.v1beta1"; /** * QueryAllowanceRequest is the request type for the Query/Allowance RPC method. @@ -298,6 +299,15 @@ function createBaseQueryAllowanceRequest(): QueryAllowanceRequest { export const QueryAllowanceRequest = { typeUrl: "/cosmos.feegrant.v1beta1.QueryAllowanceRequest", aminoType: "cosmos-sdk/QueryAllowanceRequest", + is(o: any): o is QueryAllowanceRequest { + return o && (o.$typeUrl === QueryAllowanceRequest.typeUrl || typeof o.granter === "string" && typeof o.grantee === "string"); + }, + isSDK(o: any): o is QueryAllowanceRequestSDKType { + return o && (o.$typeUrl === QueryAllowanceRequest.typeUrl || typeof o.granter === "string" && typeof o.grantee === "string"); + }, + isAmino(o: any): o is QueryAllowanceRequestAmino { + return o && (o.$typeUrl === QueryAllowanceRequest.typeUrl || typeof o.granter === "string" && typeof o.grantee === "string"); + }, encode(message: QueryAllowanceRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.granter !== "") { writer.uint32(10).string(message.granter); @@ -393,7 +403,8 @@ export const QueryAllowanceRequest = { typeUrl: "/cosmos.feegrant.v1beta1.QueryAllowanceRequest", value: QueryAllowanceRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryAllowanceResponse(): QueryAllowanceResponse { return { @@ -409,6 +420,15 @@ function createBaseQueryAllowanceResponse(): QueryAllowanceResponse { export const QueryAllowanceResponse = { typeUrl: "/cosmos.feegrant.v1beta1.QueryAllowanceResponse", aminoType: "cosmos-sdk/QueryAllowanceResponse", + is(o: any): o is QueryAllowanceResponse { + return o && o.$typeUrl === QueryAllowanceResponse.typeUrl; + }, + isSDK(o: any): o is QueryAllowanceResponseSDKType { + return o && o.$typeUrl === QueryAllowanceResponse.typeUrl; + }, + isAmino(o: any): o is QueryAllowanceResponseAmino { + return o && o.$typeUrl === QueryAllowanceResponse.typeUrl; + }, encode(message: QueryAllowanceResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.allowance !== undefined) { Grant.encode(message.allowance, writer.uint32(10).fork()).ldelim(); @@ -491,6 +511,12 @@ export const QueryAllowanceResponse = { typeUrl: "/cosmos.feegrant.v1beta1.QueryAllowanceResponse", value: QueryAllowanceResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryAllowanceResponse.typeUrl)) { + return; + } + Grant.registerTypeUrl(); } }; function createBaseQueryAllowancesRequest(): QueryAllowancesRequest { @@ -508,6 +534,15 @@ function createBaseQueryAllowancesRequest(): QueryAllowancesRequest { export const QueryAllowancesRequest = { typeUrl: "/cosmos.feegrant.v1beta1.QueryAllowancesRequest", aminoType: "cosmos-sdk/QueryAllowancesRequest", + is(o: any): o is QueryAllowancesRequest { + return o && (o.$typeUrl === QueryAllowancesRequest.typeUrl || typeof o.grantee === "string"); + }, + isSDK(o: any): o is QueryAllowancesRequestSDKType { + return o && (o.$typeUrl === QueryAllowancesRequest.typeUrl || typeof o.grantee === "string"); + }, + isAmino(o: any): o is QueryAllowancesRequestAmino { + return o && (o.$typeUrl === QueryAllowancesRequest.typeUrl || typeof o.grantee === "string"); + }, encode(message: QueryAllowancesRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.grantee !== "") { writer.uint32(10).string(message.grantee); @@ -605,6 +640,12 @@ export const QueryAllowancesRequest = { typeUrl: "/cosmos.feegrant.v1beta1.QueryAllowancesRequest", value: QueryAllowancesRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryAllowancesRequest.typeUrl)) { + return; + } + PageRequest.registerTypeUrl(); } }; function createBaseQueryAllowancesResponse(): QueryAllowancesResponse { @@ -622,6 +663,15 @@ function createBaseQueryAllowancesResponse(): QueryAllowancesResponse { export const QueryAllowancesResponse = { typeUrl: "/cosmos.feegrant.v1beta1.QueryAllowancesResponse", aminoType: "cosmos-sdk/QueryAllowancesResponse", + is(o: any): o is QueryAllowancesResponse { + return o && (o.$typeUrl === QueryAllowancesResponse.typeUrl || Array.isArray(o.allowances) && (!o.allowances.length || Grant.is(o.allowances[0]))); + }, + isSDK(o: any): o is QueryAllowancesResponseSDKType { + return o && (o.$typeUrl === QueryAllowancesResponse.typeUrl || Array.isArray(o.allowances) && (!o.allowances.length || Grant.isSDK(o.allowances[0]))); + }, + isAmino(o: any): o is QueryAllowancesResponseAmino { + return o && (o.$typeUrl === QueryAllowancesResponse.typeUrl || Array.isArray(o.allowances) && (!o.allowances.length || Grant.isAmino(o.allowances[0]))); + }, encode(message: QueryAllowancesResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.allowances) { Grant.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -729,6 +779,13 @@ export const QueryAllowancesResponse = { typeUrl: "/cosmos.feegrant.v1beta1.QueryAllowancesResponse", value: QueryAllowancesResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryAllowancesResponse.typeUrl)) { + return; + } + Grant.registerTypeUrl(); + PageResponse.registerTypeUrl(); } }; function createBaseQueryAllowancesByGranterRequest(): QueryAllowancesByGranterRequest { @@ -746,6 +803,15 @@ function createBaseQueryAllowancesByGranterRequest(): QueryAllowancesByGranterRe export const QueryAllowancesByGranterRequest = { typeUrl: "/cosmos.feegrant.v1beta1.QueryAllowancesByGranterRequest", aminoType: "cosmos-sdk/QueryAllowancesByGranterRequest", + is(o: any): o is QueryAllowancesByGranterRequest { + return o && (o.$typeUrl === QueryAllowancesByGranterRequest.typeUrl || typeof o.granter === "string"); + }, + isSDK(o: any): o is QueryAllowancesByGranterRequestSDKType { + return o && (o.$typeUrl === QueryAllowancesByGranterRequest.typeUrl || typeof o.granter === "string"); + }, + isAmino(o: any): o is QueryAllowancesByGranterRequestAmino { + return o && (o.$typeUrl === QueryAllowancesByGranterRequest.typeUrl || typeof o.granter === "string"); + }, encode(message: QueryAllowancesByGranterRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.granter !== "") { writer.uint32(10).string(message.granter); @@ -843,6 +909,12 @@ export const QueryAllowancesByGranterRequest = { typeUrl: "/cosmos.feegrant.v1beta1.QueryAllowancesByGranterRequest", value: QueryAllowancesByGranterRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryAllowancesByGranterRequest.typeUrl)) { + return; + } + PageRequest.registerTypeUrl(); } }; function createBaseQueryAllowancesByGranterResponse(): QueryAllowancesByGranterResponse { @@ -860,6 +932,15 @@ function createBaseQueryAllowancesByGranterResponse(): QueryAllowancesByGranterR export const QueryAllowancesByGranterResponse = { typeUrl: "/cosmos.feegrant.v1beta1.QueryAllowancesByGranterResponse", aminoType: "cosmos-sdk/QueryAllowancesByGranterResponse", + is(o: any): o is QueryAllowancesByGranterResponse { + return o && (o.$typeUrl === QueryAllowancesByGranterResponse.typeUrl || Array.isArray(o.allowances) && (!o.allowances.length || Grant.is(o.allowances[0]))); + }, + isSDK(o: any): o is QueryAllowancesByGranterResponseSDKType { + return o && (o.$typeUrl === QueryAllowancesByGranterResponse.typeUrl || Array.isArray(o.allowances) && (!o.allowances.length || Grant.isSDK(o.allowances[0]))); + }, + isAmino(o: any): o is QueryAllowancesByGranterResponseAmino { + return o && (o.$typeUrl === QueryAllowancesByGranterResponse.typeUrl || Array.isArray(o.allowances) && (!o.allowances.length || Grant.isAmino(o.allowances[0]))); + }, encode(message: QueryAllowancesByGranterResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.allowances) { Grant.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -967,5 +1048,12 @@ export const QueryAllowancesByGranterResponse = { typeUrl: "/cosmos.feegrant.v1beta1.QueryAllowancesByGranterResponse", value: QueryAllowancesByGranterResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryAllowancesByGranterResponse.typeUrl)) { + return; + } + Grant.registerTypeUrl(); + PageResponse.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/cosmos/feegrant/v1beta1/tx.registry.ts b/__fixtures__/v-next/outputv2/cosmos/feegrant/v1beta1/tx.registry.ts index e7592e81f6..78fba0549c 100644 --- a/__fixtures__/v-next/outputv2/cosmos/feegrant/v1beta1/tx.registry.ts +++ b/__fixtures__/v-next/outputv2/cosmos/feegrant/v1beta1/tx.registry.ts @@ -1,11 +1,6 @@ -import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { TelescopeGeneratedType } from "../../../types"; import { MsgGrantAllowance, MsgRevokeAllowance } from "./tx"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/cosmos.feegrant.v1beta1.MsgGrantAllowance", MsgGrantAllowance], ["/cosmos.feegrant.v1beta1.MsgRevokeAllowance", MsgRevokeAllowance]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/cosmos.feegrant.v1beta1.MsgGrantAllowance", MsgGrantAllowance], ["/cosmos.feegrant.v1beta1.MsgRevokeAllowance", MsgRevokeAllowance]]; export const MessageComposer = { encoded: { grantAllowance(value: MsgGrantAllowance) { diff --git a/__fixtures__/v-next/outputv2/cosmos/feegrant/v1beta1/tx.rpc.func.ts b/__fixtures__/v-next/outputv2/cosmos/feegrant/v1beta1/tx.rpc.func.ts new file mode 100644 index 0000000000..830936d444 --- /dev/null +++ b/__fixtures__/v-next/outputv2/cosmos/feegrant/v1beta1/tx.rpc.func.ts @@ -0,0 +1,22 @@ +import { buildTx } from "../../../helper-func-types"; +import { MsgGrantAllowance, MsgRevokeAllowance } from "./tx"; +/** + * GrantAllowance grants fee allowance to the grantee on the granter's + * account with the provided expiration time. + * @name grantAllowance + * @package cosmos.feegrant.v1beta1 + * @see proto service: cosmos.feegrant.v1beta1.GrantAllowance + */ +export const grantAllowance = buildTx({ + msg: MsgGrantAllowance +}); +/** + * RevokeAllowance revokes any fee allowance of granter's account that + * has been granted to the grantee. + * @name revokeAllowance + * @package cosmos.feegrant.v1beta1 + * @see proto service: cosmos.feegrant.v1beta1.RevokeAllowance + */ +export const revokeAllowance = buildTx({ + msg: MsgRevokeAllowance +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/cosmos/feegrant/v1beta1/tx.ts b/__fixtures__/v-next/outputv2/cosmos/feegrant/v1beta1/tx.ts index 9f9ba9f100..ff6b5eb56e 100644 --- a/__fixtures__/v-next/outputv2/cosmos/feegrant/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputv2/cosmos/feegrant/v1beta1/tx.ts @@ -1,6 +1,7 @@ import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../google/protobuf/any"; import { BasicAllowance, BasicAllowanceProtoMsg, BasicAllowanceSDKType, PeriodicAllowance, PeriodicAllowanceProtoMsg, PeriodicAllowanceSDKType, AllowedMsgAllowance, AllowedMsgAllowanceProtoMsg, AllowedMsgAllowanceSDKType } from "./feegrant"; import { BinaryReader, BinaryWriter } from "../../../binary"; +import { GlobalDecoderRegistry } from "../../../registry"; import { isSet, DeepPartial } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "cosmos.feegrant.v1beta1"; @@ -197,6 +198,15 @@ function createBaseMsgGrantAllowance(): MsgGrantAllowance { export const MsgGrantAllowance = { typeUrl: "/cosmos.feegrant.v1beta1.MsgGrantAllowance", aminoType: "cosmos-sdk/MsgGrantAllowance", + is(o: any): o is MsgGrantAllowance { + return o && (o.$typeUrl === MsgGrantAllowance.typeUrl || typeof o.granter === "string" && typeof o.grantee === "string"); + }, + isSDK(o: any): o is MsgGrantAllowanceSDKType { + return o && (o.$typeUrl === MsgGrantAllowance.typeUrl || typeof o.granter === "string" && typeof o.grantee === "string"); + }, + isAmino(o: any): o is MsgGrantAllowanceAmino { + return o && (o.$typeUrl === MsgGrantAllowance.typeUrl || typeof o.granter === "string" && typeof o.grantee === "string"); + }, encode(message: MsgGrantAllowance, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.granter !== "") { writer.uint32(10).string(message.granter); @@ -205,7 +215,7 @@ export const MsgGrantAllowance = { writer.uint32(18).string(message.grantee); } if (message.allowance !== undefined) { - Any.encode((message.allowance as Any), writer.uint32(26).fork()).ldelim(); + Any.encode(GlobalDecoderRegistry.wrapAny(message.allowance), writer.uint32(26).fork()).ldelim(); } return writer; }, @@ -223,7 +233,7 @@ export const MsgGrantAllowance = { message.grantee = reader.string(); break; case 3: - message.allowance = (FeeAllowanceI_InterfaceDecoder(reader) as Any); + message.allowance = GlobalDecoderRegistry.unwrapAny(reader); break; default: reader.skipType(tag & 7); @@ -236,14 +246,14 @@ export const MsgGrantAllowance = { const obj = createBaseMsgGrantAllowance(); if (isSet(object.granter)) obj.granter = String(object.granter); if (isSet(object.grantee)) obj.grantee = String(object.grantee); - if (isSet(object.allowance)) obj.allowance = Any.fromJSON(object.allowance); + if (isSet(object.allowance)) obj.allowance = GlobalDecoderRegistry.fromJSON(object.allowance); return obj; }, toJSON(message: MsgGrantAllowance): JsonSafe { const obj: any = {}; message.granter !== undefined && (obj.granter = message.granter); message.grantee !== undefined && (obj.grantee = message.grantee); - message.allowance !== undefined && (obj.allowance = message.allowance ? Any.toJSON(message.allowance) : undefined); + message.allowance !== undefined && (obj.allowance = message.allowance ? GlobalDecoderRegistry.toJSON(message.allowance) : undefined); return obj; }, fromPartial(object: DeepPartial): MsgGrantAllowance { @@ -251,7 +261,7 @@ export const MsgGrantAllowance = { message.granter = object.granter ?? ""; message.grantee = object.grantee ?? ""; if (object.allowance !== undefined && object.allowance !== null) { - message.allowance = Any.fromPartial(object.allowance); + message.allowance = GlobalDecoderRegistry.fromPartial(object.allowance); } return message; }, @@ -259,14 +269,14 @@ export const MsgGrantAllowance = { return { granter: object?.granter, grantee: object?.grantee, - allowance: object.allowance ? Any.fromSDK(object.allowance) : undefined + allowance: object.allowance ? GlobalDecoderRegistry.fromSDK(object.allowance) : undefined }; }, toSDK(message: MsgGrantAllowance): MsgGrantAllowanceSDKType { const obj: any = {}; obj.granter = message.granter; obj.grantee = message.grantee; - message.allowance !== undefined && (obj.allowance = message.allowance ? Any.toSDK(message.allowance) : undefined); + message.allowance !== undefined && (obj.allowance = message.allowance ? GlobalDecoderRegistry.toSDK(message.allowance) : undefined); return obj; }, fromAmino(object: MsgGrantAllowanceAmino): MsgGrantAllowance { @@ -278,7 +288,7 @@ export const MsgGrantAllowance = { message.grantee = object.grantee; } if (object.allowance !== undefined && object.allowance !== null) { - message.allowance = FeeAllowanceI_FromAmino(object.allowance); + message.allowance = GlobalDecoderRegistry.fromAminoMsg(object.allowance); } return message; }, @@ -286,7 +296,7 @@ export const MsgGrantAllowance = { const obj: any = {}; obj.granter = message.granter === "" ? undefined : message.granter; obj.grantee = message.grantee === "" ? undefined : message.grantee; - obj.allowance = message.allowance ? FeeAllowanceI_ToAmino((message.allowance as Any)) : undefined; + obj.allowance = message.allowance ? GlobalDecoderRegistry.toAminoMsg(message.allowance) : undefined; return obj; }, fromAminoMsg(object: MsgGrantAllowanceAminoMsg): MsgGrantAllowance { @@ -309,6 +319,14 @@ export const MsgGrantAllowance = { typeUrl: "/cosmos.feegrant.v1beta1.MsgGrantAllowance", value: MsgGrantAllowance.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgGrantAllowance.typeUrl)) { + return; + } + BasicAllowance.registerTypeUrl(); + PeriodicAllowance.registerTypeUrl(); + AllowedMsgAllowance.registerTypeUrl(); } }; function createBaseMsgGrantAllowanceResponse(): MsgGrantAllowanceResponse { @@ -323,6 +341,15 @@ function createBaseMsgGrantAllowanceResponse(): MsgGrantAllowanceResponse { export const MsgGrantAllowanceResponse = { typeUrl: "/cosmos.feegrant.v1beta1.MsgGrantAllowanceResponse", aminoType: "cosmos-sdk/MsgGrantAllowanceResponse", + is(o: any): o is MsgGrantAllowanceResponse { + return o && o.$typeUrl === MsgGrantAllowanceResponse.typeUrl; + }, + isSDK(o: any): o is MsgGrantAllowanceResponseSDKType { + return o && o.$typeUrl === MsgGrantAllowanceResponse.typeUrl; + }, + isAmino(o: any): o is MsgGrantAllowanceResponseAmino { + return o && o.$typeUrl === MsgGrantAllowanceResponse.typeUrl; + }, encode(_: MsgGrantAllowanceResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -387,7 +414,8 @@ export const MsgGrantAllowanceResponse = { typeUrl: "/cosmos.feegrant.v1beta1.MsgGrantAllowanceResponse", value: MsgGrantAllowanceResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgRevokeAllowance(): MsgRevokeAllowance { return { @@ -404,6 +432,15 @@ function createBaseMsgRevokeAllowance(): MsgRevokeAllowance { export const MsgRevokeAllowance = { typeUrl: "/cosmos.feegrant.v1beta1.MsgRevokeAllowance", aminoType: "cosmos-sdk/MsgRevokeAllowance", + is(o: any): o is MsgRevokeAllowance { + return o && (o.$typeUrl === MsgRevokeAllowance.typeUrl || typeof o.granter === "string" && typeof o.grantee === "string"); + }, + isSDK(o: any): o is MsgRevokeAllowanceSDKType { + return o && (o.$typeUrl === MsgRevokeAllowance.typeUrl || typeof o.granter === "string" && typeof o.grantee === "string"); + }, + isAmino(o: any): o is MsgRevokeAllowanceAmino { + return o && (o.$typeUrl === MsgRevokeAllowance.typeUrl || typeof o.granter === "string" && typeof o.grantee === "string"); + }, encode(message: MsgRevokeAllowance, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.granter !== "") { writer.uint32(10).string(message.granter); @@ -499,7 +536,8 @@ export const MsgRevokeAllowance = { typeUrl: "/cosmos.feegrant.v1beta1.MsgRevokeAllowance", value: MsgRevokeAllowance.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgRevokeAllowanceResponse(): MsgRevokeAllowanceResponse { return {}; @@ -513,6 +551,15 @@ function createBaseMsgRevokeAllowanceResponse(): MsgRevokeAllowanceResponse { export const MsgRevokeAllowanceResponse = { typeUrl: "/cosmos.feegrant.v1beta1.MsgRevokeAllowanceResponse", aminoType: "cosmos-sdk/MsgRevokeAllowanceResponse", + is(o: any): o is MsgRevokeAllowanceResponse { + return o && o.$typeUrl === MsgRevokeAllowanceResponse.typeUrl; + }, + isSDK(o: any): o is MsgRevokeAllowanceResponseSDKType { + return o && o.$typeUrl === MsgRevokeAllowanceResponse.typeUrl; + }, + isAmino(o: any): o is MsgRevokeAllowanceResponseAmino { + return o && o.$typeUrl === MsgRevokeAllowanceResponse.typeUrl; + }, encode(_: MsgRevokeAllowanceResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -577,61 +624,6 @@ export const MsgRevokeAllowanceResponse = { typeUrl: "/cosmos.feegrant.v1beta1.MsgRevokeAllowanceResponse", value: MsgRevokeAllowanceResponse.encode(message).finish() }; - } -}; -export const FeeAllowanceI_InterfaceDecoder = (input: BinaryReader | Uint8Array): BasicAllowance | PeriodicAllowance | AllowedMsgAllowance | Any => { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - const data = Any.decode(reader, reader.uint32()); - switch (data.typeUrl) { - case "/cosmos.feegrant.v1beta1.BasicAllowance": - return BasicAllowance.decode(data.value); - case "/cosmos.feegrant.v1beta1.PeriodicAllowance": - return PeriodicAllowance.decode(data.value); - case "/cosmos.feegrant.v1beta1.AllowedMsgAllowance": - return AllowedMsgAllowance.decode(data.value); - default: - return data; - } -}; -export const FeeAllowanceI_FromAmino = (content: AnyAmino): Any => { - switch (content.type) { - case "cosmos-sdk/BasicAllowance": - return Any.fromPartial({ - typeUrl: "/cosmos.feegrant.v1beta1.BasicAllowance", - value: BasicAllowance.encode(BasicAllowance.fromPartial(BasicAllowance.fromAmino(content.value))).finish() - }); - case "cosmos-sdk/PeriodicAllowance": - return Any.fromPartial({ - typeUrl: "/cosmos.feegrant.v1beta1.PeriodicAllowance", - value: PeriodicAllowance.encode(PeriodicAllowance.fromPartial(PeriodicAllowance.fromAmino(content.value))).finish() - }); - case "cosmos-sdk/AllowedMsgAllowance": - return Any.fromPartial({ - typeUrl: "/cosmos.feegrant.v1beta1.AllowedMsgAllowance", - value: AllowedMsgAllowance.encode(AllowedMsgAllowance.fromPartial(AllowedMsgAllowance.fromAmino(content.value))).finish() - }); - default: - return Any.fromAmino(content); - } -}; -export const FeeAllowanceI_ToAmino = (content: Any) => { - switch (content.typeUrl) { - case "/cosmos.feegrant.v1beta1.BasicAllowance": - return { - type: "cosmos-sdk/BasicAllowance", - value: BasicAllowance.toAmino(BasicAllowance.decode(content.value, undefined)) - }; - case "/cosmos.feegrant.v1beta1.PeriodicAllowance": - return { - type: "cosmos-sdk/PeriodicAllowance", - value: PeriodicAllowance.toAmino(PeriodicAllowance.decode(content.value, undefined)) - }; - case "/cosmos.feegrant.v1beta1.AllowedMsgAllowance": - return { - type: "cosmos-sdk/AllowedMsgAllowance", - value: AllowedMsgAllowance.toAmino(AllowedMsgAllowance.decode(content.value, undefined)) - }; - default: - return Any.toAmino(content); - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/cosmos/genutil/v1beta1/genesis.ts b/__fixtures__/v-next/outputv2/cosmos/genutil/v1beta1/genesis.ts index ed1febdf5a..1e7148d3db 100644 --- a/__fixtures__/v-next/outputv2/cosmos/genutil/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv2/cosmos/genutil/v1beta1/genesis.ts @@ -57,6 +57,15 @@ function createBaseGenesisState(): GenesisState { export const GenesisState = { typeUrl: "/cosmos.genutil.v1beta1.GenesisState", aminoType: "cosmos-sdk/GenesisState", + is(o: any): o is GenesisState { + return o && (o.$typeUrl === GenesisState.typeUrl || Array.isArray(o.genTxs) && (!o.genTxs.length || o.genTxs[0] instanceof Uint8Array || typeof o.genTxs[0] === "string")); + }, + isSDK(o: any): o is GenesisStateSDKType { + return o && (o.$typeUrl === GenesisState.typeUrl || Array.isArray(o.gen_txs) && (!o.gen_txs.length || o.gen_txs[0] instanceof Uint8Array || typeof o.gen_txs[0] === "string")); + }, + isAmino(o: any): o is GenesisStateAmino { + return o && (o.$typeUrl === GenesisState.typeUrl || Array.isArray(o.gen_txs) && (!o.gen_txs.length || o.gen_txs[0] instanceof Uint8Array || typeof o.gen_txs[0] === "string")); + }, encode(message: GenesisState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.genTxs) { writer.uint32(10).bytes(v!); @@ -147,5 +156,6 @@ export const GenesisState = { typeUrl: "/cosmos.genutil.v1beta1.GenesisState", value: GenesisState.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/cosmos/gov/v1/genesis.ts b/__fixtures__/v-next/outputv2/cosmos/gov/v1/genesis.ts index b8dfa57905..3ca02cf3b6 100644 --- a/__fixtures__/v-next/outputv2/cosmos/gov/v1/genesis.ts +++ b/__fixtures__/v-next/outputv2/cosmos/gov/v1/genesis.ts @@ -1,5 +1,6 @@ import { Deposit, DepositAmino, DepositSDKType, Vote, VoteAmino, VoteSDKType, Proposal, ProposalAmino, ProposalSDKType, DepositParams, DepositParamsAmino, DepositParamsSDKType, VotingParams, VotingParamsAmino, VotingParamsSDKType, TallyParams, TallyParamsAmino, TallyParamsSDKType } from "./gov"; import { BinaryReader, BinaryWriter } from "../../../binary"; +import { GlobalDecoderRegistry } from "../../../registry"; import { isSet, DeepPartial } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "cosmos.gov.v1"; @@ -118,6 +119,15 @@ function createBaseGenesisState(): GenesisState { export const GenesisState = { typeUrl: "/cosmos.gov.v1.GenesisState", aminoType: "cosmos-sdk/v1/GenesisState", + is(o: any): o is GenesisState { + return o && (o.$typeUrl === GenesisState.typeUrl || typeof o.startingProposalId === "bigint" && Array.isArray(o.deposits) && (!o.deposits.length || Deposit.is(o.deposits[0])) && Array.isArray(o.votes) && (!o.votes.length || Vote.is(o.votes[0])) && Array.isArray(o.proposals) && (!o.proposals.length || Proposal.is(o.proposals[0]))); + }, + isSDK(o: any): o is GenesisStateSDKType { + return o && (o.$typeUrl === GenesisState.typeUrl || typeof o.starting_proposal_id === "bigint" && Array.isArray(o.deposits) && (!o.deposits.length || Deposit.isSDK(o.deposits[0])) && Array.isArray(o.votes) && (!o.votes.length || Vote.isSDK(o.votes[0])) && Array.isArray(o.proposals) && (!o.proposals.length || Proposal.isSDK(o.proposals[0]))); + }, + isAmino(o: any): o is GenesisStateAmino { + return o && (o.$typeUrl === GenesisState.typeUrl || typeof o.starting_proposal_id === "bigint" && Array.isArray(o.deposits) && (!o.deposits.length || Deposit.isAmino(o.deposits[0])) && Array.isArray(o.votes) && (!o.votes.length || Vote.isAmino(o.votes[0])) && Array.isArray(o.proposals) && (!o.proposals.length || Proposal.isAmino(o.proposals[0]))); + }, encode(message: GenesisState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.startingProposalId !== BigInt(0)) { writer.uint32(8).uint64(message.startingProposalId); @@ -326,5 +336,16 @@ export const GenesisState = { typeUrl: "/cosmos.gov.v1.GenesisState", value: GenesisState.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GenesisState.typeUrl)) { + return; + } + Deposit.registerTypeUrl(); + Vote.registerTypeUrl(); + Proposal.registerTypeUrl(); + DepositParams.registerTypeUrl(); + VotingParams.registerTypeUrl(); + TallyParams.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/cosmos/gov/v1/gov.ts b/__fixtures__/v-next/outputv2/cosmos/gov/v1/gov.ts index 4d96212b17..ef429e6361 100644 --- a/__fixtures__/v-next/outputv2/cosmos/gov/v1/gov.ts +++ b/__fixtures__/v-next/outputv2/cosmos/gov/v1/gov.ts @@ -2,9 +2,10 @@ import { Coin, CoinAmino, CoinSDKType } from "../../base/v1beta1/coin"; import { Any, AnyAmino, AnySDKType } from "../../../google/protobuf/any"; import { Timestamp } from "../../../google/protobuf/timestamp"; import { Duration, DurationAmino, DurationSDKType } from "../../../google/protobuf/duration"; -import { BinaryReader, BinaryWriter } from "../../../binary"; import { isSet, DeepPartial, toTimestamp, fromTimestamp } from "../../../helpers"; +import { BinaryReader, BinaryWriter } from "../../../binary"; import { JsonSafe } from "../../../json-safe"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "cosmos.gov.v1"; /** VoteOption enumerates the valid vote options for a given governance proposal. */ export enum VoteOption { @@ -568,6 +569,15 @@ function createBaseWeightedVoteOption(): WeightedVoteOption { export const WeightedVoteOption = { typeUrl: "/cosmos.gov.v1.WeightedVoteOption", aminoType: "cosmos-sdk/v1/WeightedVoteOption", + is(o: any): o is WeightedVoteOption { + return o && (o.$typeUrl === WeightedVoteOption.typeUrl || isSet(o.option) && typeof o.weight === "string"); + }, + isSDK(o: any): o is WeightedVoteOptionSDKType { + return o && (o.$typeUrl === WeightedVoteOption.typeUrl || isSet(o.option) && typeof o.weight === "string"); + }, + isAmino(o: any): o is WeightedVoteOptionAmino { + return o && (o.$typeUrl === WeightedVoteOption.typeUrl || isSet(o.option) && typeof o.weight === "string"); + }, encode(message: WeightedVoteOption, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.option !== 0) { writer.uint32(8).int32(message.option); @@ -663,7 +673,8 @@ export const WeightedVoteOption = { typeUrl: "/cosmos.gov.v1.WeightedVoteOption", value: WeightedVoteOption.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseDeposit(): Deposit { return { @@ -682,6 +693,15 @@ function createBaseDeposit(): Deposit { export const Deposit = { typeUrl: "/cosmos.gov.v1.Deposit", aminoType: "cosmos-sdk/v1/Deposit", + is(o: any): o is Deposit { + return o && (o.$typeUrl === Deposit.typeUrl || typeof o.proposalId === "bigint" && typeof o.depositor === "string" && Array.isArray(o.amount) && (!o.amount.length || Coin.is(o.amount[0]))); + }, + isSDK(o: any): o is DepositSDKType { + return o && (o.$typeUrl === Deposit.typeUrl || typeof o.proposal_id === "bigint" && typeof o.depositor === "string" && Array.isArray(o.amount) && (!o.amount.length || Coin.isSDK(o.amount[0]))); + }, + isAmino(o: any): o is DepositAmino { + return o && (o.$typeUrl === Deposit.typeUrl || typeof o.proposal_id === "bigint" && typeof o.depositor === "string" && Array.isArray(o.amount) && (!o.amount.length || Coin.isAmino(o.amount[0]))); + }, encode(message: Deposit, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.proposalId !== BigInt(0)) { writer.uint32(8).uint64(message.proposalId); @@ -804,6 +824,12 @@ export const Deposit = { typeUrl: "/cosmos.gov.v1.Deposit", value: Deposit.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Deposit.typeUrl)) { + return; + } + Coin.registerTypeUrl(); } }; function createBaseProposal(): Proposal { @@ -829,6 +855,15 @@ function createBaseProposal(): Proposal { export const Proposal = { typeUrl: "/cosmos.gov.v1.Proposal", aminoType: "cosmos-sdk/v1/Proposal", + is(o: any): o is Proposal { + return o && (o.$typeUrl === Proposal.typeUrl || typeof o.id === "bigint" && Array.isArray(o.messages) && (!o.messages.length || Any.is(o.messages[0])) && isSet(o.status) && Array.isArray(o.totalDeposit) && (!o.totalDeposit.length || Coin.is(o.totalDeposit[0])) && typeof o.metadata === "string"); + }, + isSDK(o: any): o is ProposalSDKType { + return o && (o.$typeUrl === Proposal.typeUrl || typeof o.id === "bigint" && Array.isArray(o.messages) && (!o.messages.length || Any.isSDK(o.messages[0])) && isSet(o.status) && Array.isArray(o.total_deposit) && (!o.total_deposit.length || Coin.isSDK(o.total_deposit[0])) && typeof o.metadata === "string"); + }, + isAmino(o: any): o is ProposalAmino { + return o && (o.$typeUrl === Proposal.typeUrl || typeof o.id === "bigint" && Array.isArray(o.messages) && (!o.messages.length || Any.isAmino(o.messages[0])) && isSet(o.status) && Array.isArray(o.total_deposit) && (!o.total_deposit.length || Coin.isAmino(o.total_deposit[0])) && typeof o.metadata === "string"); + }, encode(message: Proposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.id !== BigInt(0)) { writer.uint32(8).uint64(message.id); @@ -1068,6 +1103,13 @@ export const Proposal = { typeUrl: "/cosmos.gov.v1.Proposal", value: Proposal.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Proposal.typeUrl)) { + return; + } + TallyResult.registerTypeUrl(); + Coin.registerTypeUrl(); } }; function createBaseTallyResult(): TallyResult { @@ -1087,6 +1129,15 @@ function createBaseTallyResult(): TallyResult { export const TallyResult = { typeUrl: "/cosmos.gov.v1.TallyResult", aminoType: "cosmos-sdk/v1/TallyResult", + is(o: any): o is TallyResult { + return o && (o.$typeUrl === TallyResult.typeUrl || typeof o.yesCount === "string" && typeof o.abstainCount === "string" && typeof o.noCount === "string" && typeof o.noWithVetoCount === "string"); + }, + isSDK(o: any): o is TallyResultSDKType { + return o && (o.$typeUrl === TallyResult.typeUrl || typeof o.yes_count === "string" && typeof o.abstain_count === "string" && typeof o.no_count === "string" && typeof o.no_with_veto_count === "string"); + }, + isAmino(o: any): o is TallyResultAmino { + return o && (o.$typeUrl === TallyResult.typeUrl || typeof o.yes_count === "string" && typeof o.abstain_count === "string" && typeof o.no_count === "string" && typeof o.no_with_veto_count === "string"); + }, encode(message: TallyResult, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.yesCount !== "") { writer.uint32(10).string(message.yesCount); @@ -1212,7 +1263,8 @@ export const TallyResult = { typeUrl: "/cosmos.gov.v1.TallyResult", value: TallyResult.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseVote(): Vote { return { @@ -1232,6 +1284,15 @@ function createBaseVote(): Vote { export const Vote = { typeUrl: "/cosmos.gov.v1.Vote", aminoType: "cosmos-sdk/v1/Vote", + is(o: any): o is Vote { + return o && (o.$typeUrl === Vote.typeUrl || typeof o.proposalId === "bigint" && typeof o.voter === "string" && Array.isArray(o.options) && (!o.options.length || WeightedVoteOption.is(o.options[0])) && typeof o.metadata === "string"); + }, + isSDK(o: any): o is VoteSDKType { + return o && (o.$typeUrl === Vote.typeUrl || typeof o.proposal_id === "bigint" && typeof o.voter === "string" && Array.isArray(o.options) && (!o.options.length || WeightedVoteOption.isSDK(o.options[0])) && typeof o.metadata === "string"); + }, + isAmino(o: any): o is VoteAmino { + return o && (o.$typeUrl === Vote.typeUrl || typeof o.proposal_id === "bigint" && typeof o.voter === "string" && Array.isArray(o.options) && (!o.options.length || WeightedVoteOption.isAmino(o.options[0])) && typeof o.metadata === "string"); + }, encode(message: Vote, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.proposalId !== BigInt(0)) { writer.uint32(8).uint64(message.proposalId); @@ -1369,6 +1430,12 @@ export const Vote = { typeUrl: "/cosmos.gov.v1.Vote", value: Vote.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Vote.typeUrl)) { + return; + } + WeightedVoteOption.registerTypeUrl(); } }; function createBaseDepositParams(): DepositParams { @@ -1386,6 +1453,15 @@ function createBaseDepositParams(): DepositParams { export const DepositParams = { typeUrl: "/cosmos.gov.v1.DepositParams", aminoType: "cosmos-sdk/v1/DepositParams", + is(o: any): o is DepositParams { + return o && (o.$typeUrl === DepositParams.typeUrl || Array.isArray(o.minDeposit) && (!o.minDeposit.length || Coin.is(o.minDeposit[0]))); + }, + isSDK(o: any): o is DepositParamsSDKType { + return o && (o.$typeUrl === DepositParams.typeUrl || Array.isArray(o.min_deposit) && (!o.min_deposit.length || Coin.isSDK(o.min_deposit[0]))); + }, + isAmino(o: any): o is DepositParamsAmino { + return o && (o.$typeUrl === DepositParams.typeUrl || Array.isArray(o.min_deposit) && (!o.min_deposit.length || Coin.isAmino(o.min_deposit[0]))); + }, encode(message: DepositParams, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.minDeposit) { Coin.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -1493,6 +1569,12 @@ export const DepositParams = { typeUrl: "/cosmos.gov.v1.DepositParams", value: DepositParams.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(DepositParams.typeUrl)) { + return; + } + Coin.registerTypeUrl(); } }; function createBaseVotingParams(): VotingParams { @@ -1509,6 +1591,15 @@ function createBaseVotingParams(): VotingParams { export const VotingParams = { typeUrl: "/cosmos.gov.v1.VotingParams", aminoType: "cosmos-sdk/v1/VotingParams", + is(o: any): o is VotingParams { + return o && o.$typeUrl === VotingParams.typeUrl; + }, + isSDK(o: any): o is VotingParamsSDKType { + return o && o.$typeUrl === VotingParams.typeUrl; + }, + isAmino(o: any): o is VotingParamsAmino { + return o && o.$typeUrl === VotingParams.typeUrl; + }, encode(message: VotingParams, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.votingPeriod !== undefined) { Duration.encode(message.votingPeriod, writer.uint32(10).fork()).ldelim(); @@ -1591,7 +1682,8 @@ export const VotingParams = { typeUrl: "/cosmos.gov.v1.VotingParams", value: VotingParams.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseTallyParams(): TallyParams { return { @@ -1609,6 +1701,15 @@ function createBaseTallyParams(): TallyParams { export const TallyParams = { typeUrl: "/cosmos.gov.v1.TallyParams", aminoType: "cosmos-sdk/v1/TallyParams", + is(o: any): o is TallyParams { + return o && (o.$typeUrl === TallyParams.typeUrl || typeof o.quorum === "string" && typeof o.threshold === "string" && typeof o.vetoThreshold === "string"); + }, + isSDK(o: any): o is TallyParamsSDKType { + return o && (o.$typeUrl === TallyParams.typeUrl || typeof o.quorum === "string" && typeof o.threshold === "string" && typeof o.veto_threshold === "string"); + }, + isAmino(o: any): o is TallyParamsAmino { + return o && (o.$typeUrl === TallyParams.typeUrl || typeof o.quorum === "string" && typeof o.threshold === "string" && typeof o.veto_threshold === "string"); + }, encode(message: TallyParams, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.quorum !== "") { writer.uint32(10).string(message.quorum); @@ -1719,5 +1820,6 @@ export const TallyParams = { typeUrl: "/cosmos.gov.v1.TallyParams", value: TallyParams.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/cosmos/gov/v1/query.rpc.func.ts b/__fixtures__/v-next/outputv2/cosmos/gov/v1/query.rpc.func.ts new file mode 100644 index 0000000000..7a86d0d630 --- /dev/null +++ b/__fixtures__/v-next/outputv2/cosmos/gov/v1/query.rpc.func.ts @@ -0,0 +1,106 @@ +import { buildQuery } from "../../../helper-func-types"; +import { QueryProposalRequest, QueryProposalResponse, QueryProposalsRequest, QueryProposalsResponse, QueryVoteRequest, QueryVoteResponse, QueryVotesRequest, QueryVotesResponse, QueryParamsRequest, QueryParamsResponse, QueryDepositRequest, QueryDepositResponse, QueryDepositsRequest, QueryDepositsResponse, QueryTallyResultRequest, QueryTallyResultResponse } from "./query"; +/** + * Proposal queries proposal details based on ProposalID. + * @name getProposal + * @package cosmos.gov.v1 + * @see proto service: cosmos.gov.v1.Proposal + */ +export const getProposal = buildQuery({ + encode: QueryProposalRequest.encode, + decode: QueryProposalResponse.decode, + service: "cosmos.gov.v1.Query", + method: "Proposal", + deps: [QueryProposalRequest, QueryProposalResponse] +}); +/** + * Proposals queries all proposals based on given status. + * @name getProposals + * @package cosmos.gov.v1 + * @see proto service: cosmos.gov.v1.Proposals + */ +export const getProposals = buildQuery({ + encode: QueryProposalsRequest.encode, + decode: QueryProposalsResponse.decode, + service: "cosmos.gov.v1.Query", + method: "Proposals", + deps: [QueryProposalsRequest, QueryProposalsResponse] +}); +/** + * Vote queries voted information based on proposalID, voterAddr. + * @name getVote + * @package cosmos.gov.v1 + * @see proto service: cosmos.gov.v1.Vote + */ +export const getVote = buildQuery({ + encode: QueryVoteRequest.encode, + decode: QueryVoteResponse.decode, + service: "cosmos.gov.v1.Query", + method: "Vote", + deps: [QueryVoteRequest, QueryVoteResponse] +}); +/** + * Votes queries votes of a given proposal. + * @name getVotes + * @package cosmos.gov.v1 + * @see proto service: cosmos.gov.v1.Votes + */ +export const getVotes = buildQuery({ + encode: QueryVotesRequest.encode, + decode: QueryVotesResponse.decode, + service: "cosmos.gov.v1.Query", + method: "Votes", + deps: [QueryVotesRequest, QueryVotesResponse] +}); +/** + * Params queries all parameters of the gov module. + * @name getParams + * @package cosmos.gov.v1 + * @see proto service: cosmos.gov.v1.Params + */ +export const getParams = buildQuery({ + encode: QueryParamsRequest.encode, + decode: QueryParamsResponse.decode, + service: "cosmos.gov.v1.Query", + method: "Params", + deps: [QueryParamsRequest, QueryParamsResponse] +}); +/** + * Deposit queries single deposit information based proposalID, depositAddr. + * @name getDeposit + * @package cosmos.gov.v1 + * @see proto service: cosmos.gov.v1.Deposit + */ +export const getDeposit = buildQuery({ + encode: QueryDepositRequest.encode, + decode: QueryDepositResponse.decode, + service: "cosmos.gov.v1.Query", + method: "Deposit", + deps: [QueryDepositRequest, QueryDepositResponse] +}); +/** + * Deposits queries all deposits of a single proposal. + * @name getDeposits + * @package cosmos.gov.v1 + * @see proto service: cosmos.gov.v1.Deposits + */ +export const getDeposits = buildQuery({ + encode: QueryDepositsRequest.encode, + decode: QueryDepositsResponse.decode, + service: "cosmos.gov.v1.Query", + method: "Deposits", + deps: [QueryDepositsRequest, QueryDepositsResponse] +}); +/** + * TallyResult queries the tally of a proposal vote. + * @name getTallyResult + * @package cosmos.gov.v1 + * @see proto service: cosmos.gov.v1.TallyResult + */ +export const getTallyResult = buildQuery({ + encode: QueryTallyResultRequest.encode, + decode: QueryTallyResultResponse.decode, + service: "cosmos.gov.v1.Query", + method: "TallyResult", + deps: [QueryTallyResultRequest, QueryTallyResultResponse] +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/cosmos/gov/v1/query.ts b/__fixtures__/v-next/outputv2/cosmos/gov/v1/query.ts index ce492be9b5..4ccfbb8545 100644 --- a/__fixtures__/v-next/outputv2/cosmos/gov/v1/query.ts +++ b/__fixtures__/v-next/outputv2/cosmos/gov/v1/query.ts @@ -3,6 +3,7 @@ import { PageRequest, PageRequestAmino, PageRequestSDKType, PageResponse, PageRe import { BinaryReader, BinaryWriter } from "../../../binary"; import { isSet, DeepPartial } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "cosmos.gov.v1"; /** * QueryProposalRequest is the request type for the Query/Proposal RPC method. @@ -769,6 +770,15 @@ function createBaseQueryProposalRequest(): QueryProposalRequest { export const QueryProposalRequest = { typeUrl: "/cosmos.gov.v1.QueryProposalRequest", aminoType: "cosmos-sdk/v1/QueryProposalRequest", + is(o: any): o is QueryProposalRequest { + return o && (o.$typeUrl === QueryProposalRequest.typeUrl || typeof o.proposalId === "bigint"); + }, + isSDK(o: any): o is QueryProposalRequestSDKType { + return o && (o.$typeUrl === QueryProposalRequest.typeUrl || typeof o.proposal_id === "bigint"); + }, + isAmino(o: any): o is QueryProposalRequestAmino { + return o && (o.$typeUrl === QueryProposalRequest.typeUrl || typeof o.proposal_id === "bigint"); + }, encode(message: QueryProposalRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.proposalId !== BigInt(0)) { writer.uint32(8).uint64(message.proposalId); @@ -851,7 +861,8 @@ export const QueryProposalRequest = { typeUrl: "/cosmos.gov.v1.QueryProposalRequest", value: QueryProposalRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryProposalResponse(): QueryProposalResponse { return { @@ -867,6 +878,15 @@ function createBaseQueryProposalResponse(): QueryProposalResponse { export const QueryProposalResponse = { typeUrl: "/cosmos.gov.v1.QueryProposalResponse", aminoType: "cosmos-sdk/v1/QueryProposalResponse", + is(o: any): o is QueryProposalResponse { + return o && o.$typeUrl === QueryProposalResponse.typeUrl; + }, + isSDK(o: any): o is QueryProposalResponseSDKType { + return o && o.$typeUrl === QueryProposalResponse.typeUrl; + }, + isAmino(o: any): o is QueryProposalResponseAmino { + return o && o.$typeUrl === QueryProposalResponse.typeUrl; + }, encode(message: QueryProposalResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.proposal !== undefined) { Proposal.encode(message.proposal, writer.uint32(10).fork()).ldelim(); @@ -949,6 +969,12 @@ export const QueryProposalResponse = { typeUrl: "/cosmos.gov.v1.QueryProposalResponse", value: QueryProposalResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryProposalResponse.typeUrl)) { + return; + } + Proposal.registerTypeUrl(); } }; function createBaseQueryProposalsRequest(): QueryProposalsRequest { @@ -968,6 +994,15 @@ function createBaseQueryProposalsRequest(): QueryProposalsRequest { export const QueryProposalsRequest = { typeUrl: "/cosmos.gov.v1.QueryProposalsRequest", aminoType: "cosmos-sdk/v1/QueryProposalsRequest", + is(o: any): o is QueryProposalsRequest { + return o && (o.$typeUrl === QueryProposalsRequest.typeUrl || isSet(o.proposalStatus) && typeof o.voter === "string" && typeof o.depositor === "string"); + }, + isSDK(o: any): o is QueryProposalsRequestSDKType { + return o && (o.$typeUrl === QueryProposalsRequest.typeUrl || isSet(o.proposal_status) && typeof o.voter === "string" && typeof o.depositor === "string"); + }, + isAmino(o: any): o is QueryProposalsRequestAmino { + return o && (o.$typeUrl === QueryProposalsRequest.typeUrl || isSet(o.proposal_status) && typeof o.voter === "string" && typeof o.depositor === "string"); + }, encode(message: QueryProposalsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.proposalStatus !== 0) { writer.uint32(8).int32(message.proposalStatus); @@ -1095,6 +1130,12 @@ export const QueryProposalsRequest = { typeUrl: "/cosmos.gov.v1.QueryProposalsRequest", value: QueryProposalsRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryProposalsRequest.typeUrl)) { + return; + } + PageRequest.registerTypeUrl(); } }; function createBaseQueryProposalsResponse(): QueryProposalsResponse { @@ -1113,6 +1154,15 @@ function createBaseQueryProposalsResponse(): QueryProposalsResponse { export const QueryProposalsResponse = { typeUrl: "/cosmos.gov.v1.QueryProposalsResponse", aminoType: "cosmos-sdk/v1/QueryProposalsResponse", + is(o: any): o is QueryProposalsResponse { + return o && (o.$typeUrl === QueryProposalsResponse.typeUrl || Array.isArray(o.proposals) && (!o.proposals.length || Proposal.is(o.proposals[0]))); + }, + isSDK(o: any): o is QueryProposalsResponseSDKType { + return o && (o.$typeUrl === QueryProposalsResponse.typeUrl || Array.isArray(o.proposals) && (!o.proposals.length || Proposal.isSDK(o.proposals[0]))); + }, + isAmino(o: any): o is QueryProposalsResponseAmino { + return o && (o.$typeUrl === QueryProposalsResponse.typeUrl || Array.isArray(o.proposals) && (!o.proposals.length || Proposal.isAmino(o.proposals[0]))); + }, encode(message: QueryProposalsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.proposals) { Proposal.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -1220,6 +1270,13 @@ export const QueryProposalsResponse = { typeUrl: "/cosmos.gov.v1.QueryProposalsResponse", value: QueryProposalsResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryProposalsResponse.typeUrl)) { + return; + } + Proposal.registerTypeUrl(); + PageResponse.registerTypeUrl(); } }; function createBaseQueryVoteRequest(): QueryVoteRequest { @@ -1237,6 +1294,15 @@ function createBaseQueryVoteRequest(): QueryVoteRequest { export const QueryVoteRequest = { typeUrl: "/cosmos.gov.v1.QueryVoteRequest", aminoType: "cosmos-sdk/v1/QueryVoteRequest", + is(o: any): o is QueryVoteRequest { + return o && (o.$typeUrl === QueryVoteRequest.typeUrl || typeof o.proposalId === "bigint" && typeof o.voter === "string"); + }, + isSDK(o: any): o is QueryVoteRequestSDKType { + return o && (o.$typeUrl === QueryVoteRequest.typeUrl || typeof o.proposal_id === "bigint" && typeof o.voter === "string"); + }, + isAmino(o: any): o is QueryVoteRequestAmino { + return o && (o.$typeUrl === QueryVoteRequest.typeUrl || typeof o.proposal_id === "bigint" && typeof o.voter === "string"); + }, encode(message: QueryVoteRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.proposalId !== BigInt(0)) { writer.uint32(8).uint64(message.proposalId); @@ -1334,7 +1400,8 @@ export const QueryVoteRequest = { typeUrl: "/cosmos.gov.v1.QueryVoteRequest", value: QueryVoteRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryVoteResponse(): QueryVoteResponse { return { @@ -1350,6 +1417,15 @@ function createBaseQueryVoteResponse(): QueryVoteResponse { export const QueryVoteResponse = { typeUrl: "/cosmos.gov.v1.QueryVoteResponse", aminoType: "cosmos-sdk/v1/QueryVoteResponse", + is(o: any): o is QueryVoteResponse { + return o && o.$typeUrl === QueryVoteResponse.typeUrl; + }, + isSDK(o: any): o is QueryVoteResponseSDKType { + return o && o.$typeUrl === QueryVoteResponse.typeUrl; + }, + isAmino(o: any): o is QueryVoteResponseAmino { + return o && o.$typeUrl === QueryVoteResponse.typeUrl; + }, encode(message: QueryVoteResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.vote !== undefined) { Vote.encode(message.vote, writer.uint32(10).fork()).ldelim(); @@ -1432,6 +1508,12 @@ export const QueryVoteResponse = { typeUrl: "/cosmos.gov.v1.QueryVoteResponse", value: QueryVoteResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryVoteResponse.typeUrl)) { + return; + } + Vote.registerTypeUrl(); } }; function createBaseQueryVotesRequest(): QueryVotesRequest { @@ -1449,6 +1531,15 @@ function createBaseQueryVotesRequest(): QueryVotesRequest { export const QueryVotesRequest = { typeUrl: "/cosmos.gov.v1.QueryVotesRequest", aminoType: "cosmos-sdk/v1/QueryVotesRequest", + is(o: any): o is QueryVotesRequest { + return o && (o.$typeUrl === QueryVotesRequest.typeUrl || typeof o.proposalId === "bigint"); + }, + isSDK(o: any): o is QueryVotesRequestSDKType { + return o && (o.$typeUrl === QueryVotesRequest.typeUrl || typeof o.proposal_id === "bigint"); + }, + isAmino(o: any): o is QueryVotesRequestAmino { + return o && (o.$typeUrl === QueryVotesRequest.typeUrl || typeof o.proposal_id === "bigint"); + }, encode(message: QueryVotesRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.proposalId !== BigInt(0)) { writer.uint32(8).uint64(message.proposalId); @@ -1548,6 +1639,12 @@ export const QueryVotesRequest = { typeUrl: "/cosmos.gov.v1.QueryVotesRequest", value: QueryVotesRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryVotesRequest.typeUrl)) { + return; + } + PageRequest.registerTypeUrl(); } }; function createBaseQueryVotesResponse(): QueryVotesResponse { @@ -1565,6 +1662,15 @@ function createBaseQueryVotesResponse(): QueryVotesResponse { export const QueryVotesResponse = { typeUrl: "/cosmos.gov.v1.QueryVotesResponse", aminoType: "cosmos-sdk/v1/QueryVotesResponse", + is(o: any): o is QueryVotesResponse { + return o && (o.$typeUrl === QueryVotesResponse.typeUrl || Array.isArray(o.votes) && (!o.votes.length || Vote.is(o.votes[0]))); + }, + isSDK(o: any): o is QueryVotesResponseSDKType { + return o && (o.$typeUrl === QueryVotesResponse.typeUrl || Array.isArray(o.votes) && (!o.votes.length || Vote.isSDK(o.votes[0]))); + }, + isAmino(o: any): o is QueryVotesResponseAmino { + return o && (o.$typeUrl === QueryVotesResponse.typeUrl || Array.isArray(o.votes) && (!o.votes.length || Vote.isAmino(o.votes[0]))); + }, encode(message: QueryVotesResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.votes) { Vote.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -1672,6 +1778,13 @@ export const QueryVotesResponse = { typeUrl: "/cosmos.gov.v1.QueryVotesResponse", value: QueryVotesResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryVotesResponse.typeUrl)) { + return; + } + Vote.registerTypeUrl(); + PageResponse.registerTypeUrl(); } }; function createBaseQueryParamsRequest(): QueryParamsRequest { @@ -1688,6 +1801,15 @@ function createBaseQueryParamsRequest(): QueryParamsRequest { export const QueryParamsRequest = { typeUrl: "/cosmos.gov.v1.QueryParamsRequest", aminoType: "cosmos-sdk/v1/QueryParamsRequest", + is(o: any): o is QueryParamsRequest { + return o && (o.$typeUrl === QueryParamsRequest.typeUrl || typeof o.paramsType === "string"); + }, + isSDK(o: any): o is QueryParamsRequestSDKType { + return o && (o.$typeUrl === QueryParamsRequest.typeUrl || typeof o.params_type === "string"); + }, + isAmino(o: any): o is QueryParamsRequestAmino { + return o && (o.$typeUrl === QueryParamsRequest.typeUrl || typeof o.params_type === "string"); + }, encode(message: QueryParamsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.paramsType !== "") { writer.uint32(10).string(message.paramsType); @@ -1768,7 +1890,8 @@ export const QueryParamsRequest = { typeUrl: "/cosmos.gov.v1.QueryParamsRequest", value: QueryParamsRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryParamsResponse(): QueryParamsResponse { return { @@ -1786,6 +1909,15 @@ function createBaseQueryParamsResponse(): QueryParamsResponse { export const QueryParamsResponse = { typeUrl: "/cosmos.gov.v1.QueryParamsResponse", aminoType: "cosmos-sdk/v1/QueryParamsResponse", + is(o: any): o is QueryParamsResponse { + return o && o.$typeUrl === QueryParamsResponse.typeUrl; + }, + isSDK(o: any): o is QueryParamsResponseSDKType { + return o && o.$typeUrl === QueryParamsResponse.typeUrl; + }, + isAmino(o: any): o is QueryParamsResponseAmino { + return o && o.$typeUrl === QueryParamsResponse.typeUrl; + }, encode(message: QueryParamsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.votingParams !== undefined) { VotingParams.encode(message.votingParams, writer.uint32(10).fork()).ldelim(); @@ -1902,6 +2034,14 @@ export const QueryParamsResponse = { typeUrl: "/cosmos.gov.v1.QueryParamsResponse", value: QueryParamsResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryParamsResponse.typeUrl)) { + return; + } + VotingParams.registerTypeUrl(); + DepositParams.registerTypeUrl(); + TallyParams.registerTypeUrl(); } }; function createBaseQueryDepositRequest(): QueryDepositRequest { @@ -1919,6 +2059,15 @@ function createBaseQueryDepositRequest(): QueryDepositRequest { export const QueryDepositRequest = { typeUrl: "/cosmos.gov.v1.QueryDepositRequest", aminoType: "cosmos-sdk/v1/QueryDepositRequest", + is(o: any): o is QueryDepositRequest { + return o && (o.$typeUrl === QueryDepositRequest.typeUrl || typeof o.proposalId === "bigint" && typeof o.depositor === "string"); + }, + isSDK(o: any): o is QueryDepositRequestSDKType { + return o && (o.$typeUrl === QueryDepositRequest.typeUrl || typeof o.proposal_id === "bigint" && typeof o.depositor === "string"); + }, + isAmino(o: any): o is QueryDepositRequestAmino { + return o && (o.$typeUrl === QueryDepositRequest.typeUrl || typeof o.proposal_id === "bigint" && typeof o.depositor === "string"); + }, encode(message: QueryDepositRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.proposalId !== BigInt(0)) { writer.uint32(8).uint64(message.proposalId); @@ -2016,7 +2165,8 @@ export const QueryDepositRequest = { typeUrl: "/cosmos.gov.v1.QueryDepositRequest", value: QueryDepositRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryDepositResponse(): QueryDepositResponse { return { @@ -2032,6 +2182,15 @@ function createBaseQueryDepositResponse(): QueryDepositResponse { export const QueryDepositResponse = { typeUrl: "/cosmos.gov.v1.QueryDepositResponse", aminoType: "cosmos-sdk/v1/QueryDepositResponse", + is(o: any): o is QueryDepositResponse { + return o && o.$typeUrl === QueryDepositResponse.typeUrl; + }, + isSDK(o: any): o is QueryDepositResponseSDKType { + return o && o.$typeUrl === QueryDepositResponse.typeUrl; + }, + isAmino(o: any): o is QueryDepositResponseAmino { + return o && o.$typeUrl === QueryDepositResponse.typeUrl; + }, encode(message: QueryDepositResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.deposit !== undefined) { Deposit.encode(message.deposit, writer.uint32(10).fork()).ldelim(); @@ -2114,6 +2273,12 @@ export const QueryDepositResponse = { typeUrl: "/cosmos.gov.v1.QueryDepositResponse", value: QueryDepositResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryDepositResponse.typeUrl)) { + return; + } + Deposit.registerTypeUrl(); } }; function createBaseQueryDepositsRequest(): QueryDepositsRequest { @@ -2131,6 +2296,15 @@ function createBaseQueryDepositsRequest(): QueryDepositsRequest { export const QueryDepositsRequest = { typeUrl: "/cosmos.gov.v1.QueryDepositsRequest", aminoType: "cosmos-sdk/v1/QueryDepositsRequest", + is(o: any): o is QueryDepositsRequest { + return o && (o.$typeUrl === QueryDepositsRequest.typeUrl || typeof o.proposalId === "bigint"); + }, + isSDK(o: any): o is QueryDepositsRequestSDKType { + return o && (o.$typeUrl === QueryDepositsRequest.typeUrl || typeof o.proposal_id === "bigint"); + }, + isAmino(o: any): o is QueryDepositsRequestAmino { + return o && (o.$typeUrl === QueryDepositsRequest.typeUrl || typeof o.proposal_id === "bigint"); + }, encode(message: QueryDepositsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.proposalId !== BigInt(0)) { writer.uint32(8).uint64(message.proposalId); @@ -2230,6 +2404,12 @@ export const QueryDepositsRequest = { typeUrl: "/cosmos.gov.v1.QueryDepositsRequest", value: QueryDepositsRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryDepositsRequest.typeUrl)) { + return; + } + PageRequest.registerTypeUrl(); } }; function createBaseQueryDepositsResponse(): QueryDepositsResponse { @@ -2247,6 +2427,15 @@ function createBaseQueryDepositsResponse(): QueryDepositsResponse { export const QueryDepositsResponse = { typeUrl: "/cosmos.gov.v1.QueryDepositsResponse", aminoType: "cosmos-sdk/v1/QueryDepositsResponse", + is(o: any): o is QueryDepositsResponse { + return o && (o.$typeUrl === QueryDepositsResponse.typeUrl || Array.isArray(o.deposits) && (!o.deposits.length || Deposit.is(o.deposits[0]))); + }, + isSDK(o: any): o is QueryDepositsResponseSDKType { + return o && (o.$typeUrl === QueryDepositsResponse.typeUrl || Array.isArray(o.deposits) && (!o.deposits.length || Deposit.isSDK(o.deposits[0]))); + }, + isAmino(o: any): o is QueryDepositsResponseAmino { + return o && (o.$typeUrl === QueryDepositsResponse.typeUrl || Array.isArray(o.deposits) && (!o.deposits.length || Deposit.isAmino(o.deposits[0]))); + }, encode(message: QueryDepositsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.deposits) { Deposit.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -2354,6 +2543,13 @@ export const QueryDepositsResponse = { typeUrl: "/cosmos.gov.v1.QueryDepositsResponse", value: QueryDepositsResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryDepositsResponse.typeUrl)) { + return; + } + Deposit.registerTypeUrl(); + PageResponse.registerTypeUrl(); } }; function createBaseQueryTallyResultRequest(): QueryTallyResultRequest { @@ -2370,6 +2566,15 @@ function createBaseQueryTallyResultRequest(): QueryTallyResultRequest { export const QueryTallyResultRequest = { typeUrl: "/cosmos.gov.v1.QueryTallyResultRequest", aminoType: "cosmos-sdk/v1/QueryTallyResultRequest", + is(o: any): o is QueryTallyResultRequest { + return o && (o.$typeUrl === QueryTallyResultRequest.typeUrl || typeof o.proposalId === "bigint"); + }, + isSDK(o: any): o is QueryTallyResultRequestSDKType { + return o && (o.$typeUrl === QueryTallyResultRequest.typeUrl || typeof o.proposal_id === "bigint"); + }, + isAmino(o: any): o is QueryTallyResultRequestAmino { + return o && (o.$typeUrl === QueryTallyResultRequest.typeUrl || typeof o.proposal_id === "bigint"); + }, encode(message: QueryTallyResultRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.proposalId !== BigInt(0)) { writer.uint32(8).uint64(message.proposalId); @@ -2452,7 +2657,8 @@ export const QueryTallyResultRequest = { typeUrl: "/cosmos.gov.v1.QueryTallyResultRequest", value: QueryTallyResultRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryTallyResultResponse(): QueryTallyResultResponse { return { @@ -2468,6 +2674,15 @@ function createBaseQueryTallyResultResponse(): QueryTallyResultResponse { export const QueryTallyResultResponse = { typeUrl: "/cosmos.gov.v1.QueryTallyResultResponse", aminoType: "cosmos-sdk/v1/QueryTallyResultResponse", + is(o: any): o is QueryTallyResultResponse { + return o && o.$typeUrl === QueryTallyResultResponse.typeUrl; + }, + isSDK(o: any): o is QueryTallyResultResponseSDKType { + return o && o.$typeUrl === QueryTallyResultResponse.typeUrl; + }, + isAmino(o: any): o is QueryTallyResultResponseAmino { + return o && o.$typeUrl === QueryTallyResultResponse.typeUrl; + }, encode(message: QueryTallyResultResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.tally !== undefined) { TallyResult.encode(message.tally, writer.uint32(10).fork()).ldelim(); @@ -2550,5 +2765,11 @@ export const QueryTallyResultResponse = { typeUrl: "/cosmos.gov.v1.QueryTallyResultResponse", value: QueryTallyResultResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryTallyResultResponse.typeUrl)) { + return; + } + TallyResult.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/cosmos/gov/v1/tx.registry.ts b/__fixtures__/v-next/outputv2/cosmos/gov/v1/tx.registry.ts index ffd5c163be..7cd7f58456 100644 --- a/__fixtures__/v-next/outputv2/cosmos/gov/v1/tx.registry.ts +++ b/__fixtures__/v-next/outputv2/cosmos/gov/v1/tx.registry.ts @@ -1,11 +1,6 @@ -import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { TelescopeGeneratedType } from "../../../types"; import { MsgSubmitProposal, MsgExecLegacyContent, MsgVote, MsgVoteWeighted, MsgDeposit } from "./tx"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/cosmos.gov.v1.MsgSubmitProposal", MsgSubmitProposal], ["/cosmos.gov.v1.MsgExecLegacyContent", MsgExecLegacyContent], ["/cosmos.gov.v1.MsgVote", MsgVote], ["/cosmos.gov.v1.MsgVoteWeighted", MsgVoteWeighted], ["/cosmos.gov.v1.MsgDeposit", MsgDeposit]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/cosmos.gov.v1.MsgSubmitProposal", MsgSubmitProposal], ["/cosmos.gov.v1.MsgExecLegacyContent", MsgExecLegacyContent], ["/cosmos.gov.v1.MsgVote", MsgVote], ["/cosmos.gov.v1.MsgVoteWeighted", MsgVoteWeighted], ["/cosmos.gov.v1.MsgDeposit", MsgDeposit]]; export const MessageComposer = { encoded: { submitProposal(value: MsgSubmitProposal) { diff --git a/__fixtures__/v-next/outputv2/cosmos/gov/v1/tx.rpc.func.ts b/__fixtures__/v-next/outputv2/cosmos/gov/v1/tx.rpc.func.ts new file mode 100644 index 0000000000..0c84754b55 --- /dev/null +++ b/__fixtures__/v-next/outputv2/cosmos/gov/v1/tx.rpc.func.ts @@ -0,0 +1,48 @@ +import { buildTx } from "../../../helper-func-types"; +import { MsgSubmitProposal, MsgExecLegacyContent, MsgVote, MsgVoteWeighted, MsgDeposit } from "./tx"; +/** + * SubmitProposal defines a method to create new proposal given a content. + * @name submitProposal + * @package cosmos.gov.v1 + * @see proto service: cosmos.gov.v1.SubmitProposal + */ +export const submitProposal = buildTx({ + msg: MsgSubmitProposal +}); +/** + * ExecLegacyContent defines a Msg to be in included in a MsgSubmitProposal + * to execute a legacy content-based proposal. + * @name execLegacyContent + * @package cosmos.gov.v1 + * @see proto service: cosmos.gov.v1.ExecLegacyContent + */ +export const execLegacyContent = buildTx({ + msg: MsgExecLegacyContent +}); +/** + * Vote defines a method to add a vote on a specific proposal. + * @name vote + * @package cosmos.gov.v1 + * @see proto service: cosmos.gov.v1.Vote + */ +export const vote = buildTx({ + msg: MsgVote +}); +/** + * VoteWeighted defines a method to add a weighted vote on a specific proposal. + * @name voteWeighted + * @package cosmos.gov.v1 + * @see proto service: cosmos.gov.v1.VoteWeighted + */ +export const voteWeighted = buildTx({ + msg: MsgVoteWeighted +}); +/** + * Deposit defines a method to add deposit on a specific proposal. + * @name deposit + * @package cosmos.gov.v1 + * @see proto service: cosmos.gov.v1.Deposit + */ +export const deposit = buildTx({ + msg: MsgDeposit +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/cosmos/gov/v1/tx.ts b/__fixtures__/v-next/outputv2/cosmos/gov/v1/tx.ts index 9b3e29ab9f..de84be852f 100644 --- a/__fixtures__/v-next/outputv2/cosmos/gov/v1/tx.ts +++ b/__fixtures__/v-next/outputv2/cosmos/gov/v1/tx.ts @@ -9,6 +9,7 @@ import { UpdateFeeTokenProposal, UpdateFeeTokenProposalProtoMsg, UpdateFeeTokenP import { BinaryReader, BinaryWriter } from "../../../binary"; import { isSet, DeepPartial } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "cosmos.gov.v1"; /** * MsgSubmitProposal defines an sdk.Msg type that supports submitting arbitrary @@ -423,9 +424,18 @@ function createBaseMsgSubmitProposal(): MsgSubmitProposal { export const MsgSubmitProposal = { typeUrl: "/cosmos.gov.v1.MsgSubmitProposal", aminoType: "cosmos-sdk/v1/MsgSubmitProposal", + is(o: any): o is MsgSubmitProposal { + return o && (o.$typeUrl === MsgSubmitProposal.typeUrl || Array.isArray(o.messages) && (!o.messages.length || TextProposal.is(o.messages[0]) || RegisterIncentiveProposal.is(o.messages[0]) || ClientUpdateProposal.is(o.messages[0]) || UpgradeProposal.is(o.messages[0]) || ReplacePoolIncentivesProposal.is(o.messages[0]) || UpdatePoolIncentivesProposal.is(o.messages[0]) || UpdateFeeTokenProposal.is(o.messages[0]) || Any.is(o.messages[0])) && Array.isArray(o.initialDeposit) && (!o.initialDeposit.length || Coin.is(o.initialDeposit[0])) && typeof o.proposer === "string" && typeof o.metadata === "string"); + }, + isSDK(o: any): o is MsgSubmitProposalSDKType { + return o && (o.$typeUrl === MsgSubmitProposal.typeUrl || Array.isArray(o.messages) && (!o.messages.length || TextProposal.isSDK(o.messages[0]) || RegisterIncentiveProposal.isSDK(o.messages[0]) || ClientUpdateProposal.isSDK(o.messages[0]) || UpgradeProposal.isSDK(o.messages[0]) || ReplacePoolIncentivesProposal.isSDK(o.messages[0]) || UpdatePoolIncentivesProposal.isSDK(o.messages[0]) || UpdateFeeTokenProposal.isSDK(o.messages[0]) || Any.isSDK(o.messages[0])) && Array.isArray(o.initial_deposit) && (!o.initial_deposit.length || Coin.isSDK(o.initial_deposit[0])) && typeof o.proposer === "string" && typeof o.metadata === "string"); + }, + isAmino(o: any): o is MsgSubmitProposalAmino { + return o && (o.$typeUrl === MsgSubmitProposal.typeUrl || Array.isArray(o.messages) && (!o.messages.length || TextProposal.isAmino(o.messages[0]) || RegisterIncentiveProposal.isAmino(o.messages[0]) || ClientUpdateProposal.isAmino(o.messages[0]) || UpgradeProposal.isAmino(o.messages[0]) || ReplacePoolIncentivesProposal.isAmino(o.messages[0]) || UpdatePoolIncentivesProposal.isAmino(o.messages[0]) || UpdateFeeTokenProposal.isAmino(o.messages[0]) || Any.isAmino(o.messages[0])) && Array.isArray(o.initial_deposit) && (!o.initial_deposit.length || Coin.isAmino(o.initial_deposit[0])) && typeof o.proposer === "string" && typeof o.metadata === "string"); + }, encode(message: MsgSubmitProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.messages) { - Any.encode((v! as Any), writer.uint32(10).fork()).ldelim(); + Any.encode(GlobalDecoderRegistry.wrapAny(v!), writer.uint32(10).fork()).ldelim(); } for (const v of message.initialDeposit) { Coin.encode(v!, writer.uint32(18).fork()).ldelim(); @@ -446,7 +456,7 @@ export const MsgSubmitProposal = { const tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.messages.push((Any.decode(reader, reader.uint32()) as Any)); + message.messages.push(GlobalDecoderRegistry.unwrapAny(reader)); break; case 2: message.initialDeposit.push(Coin.decode(reader, reader.uint32())); @@ -466,7 +476,7 @@ export const MsgSubmitProposal = { }, fromJSON(object: any): MsgSubmitProposal { const obj = createBaseMsgSubmitProposal(); - if (Array.isArray(object?.messages)) obj.messages = object.messages.map((e: any) => Any.fromJSON(e)); + if (Array.isArray(object?.messages)) obj.messages = object.messages.map((e: any) => GlobalDecoderRegistry.fromJSON(e)); if (Array.isArray(object?.initialDeposit)) obj.initialDeposit = object.initialDeposit.map((e: any) => Coin.fromJSON(e)); if (isSet(object.proposer)) obj.proposer = String(object.proposer); if (isSet(object.metadata)) obj.metadata = String(object.metadata); @@ -475,7 +485,7 @@ export const MsgSubmitProposal = { toJSON(message: MsgSubmitProposal): JsonSafe { const obj: any = {}; if (message.messages) { - obj.messages = message.messages.map(e => e ? Any.toJSON(e) : undefined); + obj.messages = message.messages.map(e => e ? GlobalDecoderRegistry.toJSON(e) : undefined); } else { obj.messages = []; } @@ -490,7 +500,7 @@ export const MsgSubmitProposal = { }, fromPartial(object: DeepPartial): MsgSubmitProposal { const message = createBaseMsgSubmitProposal(); - message.messages = object.messages?.map(e => Any.fromPartial(e)) || []; + message.messages = object.messages?.map(e => (GlobalDecoderRegistry.fromPartial(e) as any)) || []; message.initialDeposit = object.initialDeposit?.map(e => Coin.fromPartial(e)) || []; message.proposer = object.proposer ?? ""; message.metadata = object.metadata ?? ""; @@ -498,7 +508,7 @@ export const MsgSubmitProposal = { }, fromSDK(object: MsgSubmitProposalSDKType): MsgSubmitProposal { return { - messages: Array.isArray(object?.messages) ? object.messages.map((e: any) => Any.fromSDK(e)) : [], + messages: Array.isArray(object?.messages) ? object.messages.map((e: any) => GlobalDecoderRegistry.fromSDK(e)) : [], initialDeposit: Array.isArray(object?.initial_deposit) ? object.initial_deposit.map((e: any) => Coin.fromSDK(e)) : [], proposer: object?.proposer, metadata: object?.metadata @@ -507,7 +517,7 @@ export const MsgSubmitProposal = { toSDK(message: MsgSubmitProposal): MsgSubmitProposalSDKType { const obj: any = {}; if (message.messages) { - obj.messages = message.messages.map(e => e ? Any.toSDK(e) : undefined); + obj.messages = message.messages.map(e => e ? GlobalDecoderRegistry.toSDK(e) : undefined); } else { obj.messages = []; } @@ -522,7 +532,7 @@ export const MsgSubmitProposal = { }, fromAmino(object: MsgSubmitProposalAmino): MsgSubmitProposal { const message = createBaseMsgSubmitProposal(); - message.messages = object.messages?.map(e => ProposalContentI_FromAmino(e)) || []; + message.messages = object.messages?.map(e => GlobalDecoderRegistry.fromAminoMsg(e)) || []; message.initialDeposit = object.initial_deposit?.map(e => Coin.fromAmino(e)) || []; if (object.proposer !== undefined && object.proposer !== null) { message.proposer = object.proposer; @@ -535,7 +545,7 @@ export const MsgSubmitProposal = { toAmino(message: MsgSubmitProposal): MsgSubmitProposalAmino { const obj: any = {}; if (message.messages) { - obj.messages = message.messages.map(e => e ? ProposalContentI_ToAmino((e as Any)) : undefined); + obj.messages = message.messages.map(e => e ? GlobalDecoderRegistry.toAminoMsg(e) : undefined); } else { obj.messages = message.messages; } @@ -568,6 +578,19 @@ export const MsgSubmitProposal = { typeUrl: "/cosmos.gov.v1.MsgSubmitProposal", value: MsgSubmitProposal.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgSubmitProposal.typeUrl)) { + return; + } + TextProposal.registerTypeUrl(); + RegisterIncentiveProposal.registerTypeUrl(); + ClientUpdateProposal.registerTypeUrl(); + UpgradeProposal.registerTypeUrl(); + ReplacePoolIncentivesProposal.registerTypeUrl(); + UpdatePoolIncentivesProposal.registerTypeUrl(); + UpdateFeeTokenProposal.registerTypeUrl(); + Coin.registerTypeUrl(); } }; function createBaseMsgSubmitProposalResponse(): MsgSubmitProposalResponse { @@ -584,6 +607,15 @@ function createBaseMsgSubmitProposalResponse(): MsgSubmitProposalResponse { export const MsgSubmitProposalResponse = { typeUrl: "/cosmos.gov.v1.MsgSubmitProposalResponse", aminoType: "cosmos-sdk/v1/MsgSubmitProposalResponse", + is(o: any): o is MsgSubmitProposalResponse { + return o && (o.$typeUrl === MsgSubmitProposalResponse.typeUrl || typeof o.proposalId === "bigint"); + }, + isSDK(o: any): o is MsgSubmitProposalResponseSDKType { + return o && (o.$typeUrl === MsgSubmitProposalResponse.typeUrl || typeof o.proposal_id === "bigint"); + }, + isAmino(o: any): o is MsgSubmitProposalResponseAmino { + return o && (o.$typeUrl === MsgSubmitProposalResponse.typeUrl || typeof o.proposal_id === "bigint"); + }, encode(message: MsgSubmitProposalResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.proposalId !== BigInt(0)) { writer.uint32(8).uint64(message.proposalId); @@ -666,7 +698,8 @@ export const MsgSubmitProposalResponse = { typeUrl: "/cosmos.gov.v1.MsgSubmitProposalResponse", value: MsgSubmitProposalResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgExecLegacyContent(): MsgExecLegacyContent { return { @@ -684,9 +717,18 @@ function createBaseMsgExecLegacyContent(): MsgExecLegacyContent { export const MsgExecLegacyContent = { typeUrl: "/cosmos.gov.v1.MsgExecLegacyContent", aminoType: "cosmos-sdk/v1/MsgExecLegacyContent", + is(o: any): o is MsgExecLegacyContent { + return o && (o.$typeUrl === MsgExecLegacyContent.typeUrl || typeof o.authority === "string"); + }, + isSDK(o: any): o is MsgExecLegacyContentSDKType { + return o && (o.$typeUrl === MsgExecLegacyContent.typeUrl || typeof o.authority === "string"); + }, + isAmino(o: any): o is MsgExecLegacyContentAmino { + return o && (o.$typeUrl === MsgExecLegacyContent.typeUrl || typeof o.authority === "string"); + }, encode(message: MsgExecLegacyContent, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.content !== undefined) { - Any.encode((message.content as Any), writer.uint32(10).fork()).ldelim(); + Any.encode(GlobalDecoderRegistry.wrapAny(message.content), writer.uint32(10).fork()).ldelim(); } if (message.authority !== "") { writer.uint32(18).string(message.authority); @@ -701,7 +743,7 @@ export const MsgExecLegacyContent = { const tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.content = (ProposalContentI_InterfaceDecoder(reader) as Any); + message.content = GlobalDecoderRegistry.unwrapAny(reader); break; case 2: message.authority = reader.string(); @@ -715,40 +757,40 @@ export const MsgExecLegacyContent = { }, fromJSON(object: any): MsgExecLegacyContent { const obj = createBaseMsgExecLegacyContent(); - if (isSet(object.content)) obj.content = Any.fromJSON(object.content); + if (isSet(object.content)) obj.content = GlobalDecoderRegistry.fromJSON(object.content); if (isSet(object.authority)) obj.authority = String(object.authority); return obj; }, toJSON(message: MsgExecLegacyContent): JsonSafe { const obj: any = {}; - message.content !== undefined && (obj.content = message.content ? Any.toJSON(message.content) : undefined); + message.content !== undefined && (obj.content = message.content ? GlobalDecoderRegistry.toJSON(message.content) : undefined); message.authority !== undefined && (obj.authority = message.authority); return obj; }, fromPartial(object: DeepPartial): MsgExecLegacyContent { const message = createBaseMsgExecLegacyContent(); if (object.content !== undefined && object.content !== null) { - message.content = Any.fromPartial(object.content); + message.content = GlobalDecoderRegistry.fromPartial(object.content); } message.authority = object.authority ?? ""; return message; }, fromSDK(object: MsgExecLegacyContentSDKType): MsgExecLegacyContent { return { - content: object.content ? Any.fromSDK(object.content) : undefined, + content: object.content ? GlobalDecoderRegistry.fromSDK(object.content) : undefined, authority: object?.authority }; }, toSDK(message: MsgExecLegacyContent): MsgExecLegacyContentSDKType { const obj: any = {}; - message.content !== undefined && (obj.content = message.content ? Any.toSDK(message.content) : undefined); + message.content !== undefined && (obj.content = message.content ? GlobalDecoderRegistry.toSDK(message.content) : undefined); obj.authority = message.authority; return obj; }, fromAmino(object: MsgExecLegacyContentAmino): MsgExecLegacyContent { const message = createBaseMsgExecLegacyContent(); if (object.content !== undefined && object.content !== null) { - message.content = ProposalContentI_FromAmino(object.content); + message.content = GlobalDecoderRegistry.fromAminoMsg(object.content); } if (object.authority !== undefined && object.authority !== null) { message.authority = object.authority; @@ -757,7 +799,7 @@ export const MsgExecLegacyContent = { }, toAmino(message: MsgExecLegacyContent): MsgExecLegacyContentAmino { const obj: any = {}; - obj.content = message.content ? ProposalContentI_ToAmino((message.content as Any)) : undefined; + obj.content = message.content ? GlobalDecoderRegistry.toAminoMsg(message.content) : undefined; obj.authority = message.authority === "" ? undefined : message.authority; return obj; }, @@ -781,6 +823,18 @@ export const MsgExecLegacyContent = { typeUrl: "/cosmos.gov.v1.MsgExecLegacyContent", value: MsgExecLegacyContent.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgExecLegacyContent.typeUrl)) { + return; + } + TextProposal.registerTypeUrl(); + RegisterIncentiveProposal.registerTypeUrl(); + ClientUpdateProposal.registerTypeUrl(); + UpgradeProposal.registerTypeUrl(); + ReplacePoolIncentivesProposal.registerTypeUrl(); + UpdatePoolIncentivesProposal.registerTypeUrl(); + UpdateFeeTokenProposal.registerTypeUrl(); } }; function createBaseMsgExecLegacyContentResponse(): MsgExecLegacyContentResponse { @@ -795,6 +849,15 @@ function createBaseMsgExecLegacyContentResponse(): MsgExecLegacyContentResponse export const MsgExecLegacyContentResponse = { typeUrl: "/cosmos.gov.v1.MsgExecLegacyContentResponse", aminoType: "cosmos-sdk/v1/MsgExecLegacyContentResponse", + is(o: any): o is MsgExecLegacyContentResponse { + return o && o.$typeUrl === MsgExecLegacyContentResponse.typeUrl; + }, + isSDK(o: any): o is MsgExecLegacyContentResponseSDKType { + return o && o.$typeUrl === MsgExecLegacyContentResponse.typeUrl; + }, + isAmino(o: any): o is MsgExecLegacyContentResponseAmino { + return o && o.$typeUrl === MsgExecLegacyContentResponse.typeUrl; + }, encode(_: MsgExecLegacyContentResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -859,7 +922,8 @@ export const MsgExecLegacyContentResponse = { typeUrl: "/cosmos.gov.v1.MsgExecLegacyContentResponse", value: MsgExecLegacyContentResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgVote(): MsgVote { return { @@ -878,6 +942,15 @@ function createBaseMsgVote(): MsgVote { export const MsgVote = { typeUrl: "/cosmos.gov.v1.MsgVote", aminoType: "cosmos-sdk/v1/MsgVote", + is(o: any): o is MsgVote { + return o && (o.$typeUrl === MsgVote.typeUrl || typeof o.proposalId === "bigint" && typeof o.voter === "string" && isSet(o.option) && typeof o.metadata === "string"); + }, + isSDK(o: any): o is MsgVoteSDKType { + return o && (o.$typeUrl === MsgVote.typeUrl || typeof o.proposal_id === "bigint" && typeof o.voter === "string" && isSet(o.option) && typeof o.metadata === "string"); + }, + isAmino(o: any): o is MsgVoteAmino { + return o && (o.$typeUrl === MsgVote.typeUrl || typeof o.proposal_id === "bigint" && typeof o.voter === "string" && isSet(o.option) && typeof o.metadata === "string"); + }, encode(message: MsgVote, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.proposalId !== BigInt(0)) { writer.uint32(8).uint64(message.proposalId); @@ -1005,7 +1078,8 @@ export const MsgVote = { typeUrl: "/cosmos.gov.v1.MsgVote", value: MsgVote.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgVoteResponse(): MsgVoteResponse { return {}; @@ -1019,6 +1093,15 @@ function createBaseMsgVoteResponse(): MsgVoteResponse { export const MsgVoteResponse = { typeUrl: "/cosmos.gov.v1.MsgVoteResponse", aminoType: "cosmos-sdk/v1/MsgVoteResponse", + is(o: any): o is MsgVoteResponse { + return o && o.$typeUrl === MsgVoteResponse.typeUrl; + }, + isSDK(o: any): o is MsgVoteResponseSDKType { + return o && o.$typeUrl === MsgVoteResponse.typeUrl; + }, + isAmino(o: any): o is MsgVoteResponseAmino { + return o && o.$typeUrl === MsgVoteResponse.typeUrl; + }, encode(_: MsgVoteResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -1083,7 +1166,8 @@ export const MsgVoteResponse = { typeUrl: "/cosmos.gov.v1.MsgVoteResponse", value: MsgVoteResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgVoteWeighted(): MsgVoteWeighted { return { @@ -1102,6 +1186,15 @@ function createBaseMsgVoteWeighted(): MsgVoteWeighted { export const MsgVoteWeighted = { typeUrl: "/cosmos.gov.v1.MsgVoteWeighted", aminoType: "cosmos-sdk/v1/MsgVoteWeighted", + is(o: any): o is MsgVoteWeighted { + return o && (o.$typeUrl === MsgVoteWeighted.typeUrl || typeof o.proposalId === "bigint" && typeof o.voter === "string" && Array.isArray(o.options) && (!o.options.length || WeightedVoteOption.is(o.options[0])) && typeof o.metadata === "string"); + }, + isSDK(o: any): o is MsgVoteWeightedSDKType { + return o && (o.$typeUrl === MsgVoteWeighted.typeUrl || typeof o.proposal_id === "bigint" && typeof o.voter === "string" && Array.isArray(o.options) && (!o.options.length || WeightedVoteOption.isSDK(o.options[0])) && typeof o.metadata === "string"); + }, + isAmino(o: any): o is MsgVoteWeightedAmino { + return o && (o.$typeUrl === MsgVoteWeighted.typeUrl || typeof o.proposal_id === "bigint" && typeof o.voter === "string" && Array.isArray(o.options) && (!o.options.length || WeightedVoteOption.isAmino(o.options[0])) && typeof o.metadata === "string"); + }, encode(message: MsgVoteWeighted, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.proposalId !== BigInt(0)) { writer.uint32(8).uint64(message.proposalId); @@ -1239,6 +1332,12 @@ export const MsgVoteWeighted = { typeUrl: "/cosmos.gov.v1.MsgVoteWeighted", value: MsgVoteWeighted.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgVoteWeighted.typeUrl)) { + return; + } + WeightedVoteOption.registerTypeUrl(); } }; function createBaseMsgVoteWeightedResponse(): MsgVoteWeightedResponse { @@ -1253,6 +1352,15 @@ function createBaseMsgVoteWeightedResponse(): MsgVoteWeightedResponse { export const MsgVoteWeightedResponse = { typeUrl: "/cosmos.gov.v1.MsgVoteWeightedResponse", aminoType: "cosmos-sdk/v1/MsgVoteWeightedResponse", + is(o: any): o is MsgVoteWeightedResponse { + return o && o.$typeUrl === MsgVoteWeightedResponse.typeUrl; + }, + isSDK(o: any): o is MsgVoteWeightedResponseSDKType { + return o && o.$typeUrl === MsgVoteWeightedResponse.typeUrl; + }, + isAmino(o: any): o is MsgVoteWeightedResponseAmino { + return o && o.$typeUrl === MsgVoteWeightedResponse.typeUrl; + }, encode(_: MsgVoteWeightedResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -1317,7 +1425,8 @@ export const MsgVoteWeightedResponse = { typeUrl: "/cosmos.gov.v1.MsgVoteWeightedResponse", value: MsgVoteWeightedResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgDeposit(): MsgDeposit { return { @@ -1335,6 +1444,15 @@ function createBaseMsgDeposit(): MsgDeposit { export const MsgDeposit = { typeUrl: "/cosmos.gov.v1.MsgDeposit", aminoType: "cosmos-sdk/v1/MsgDeposit", + is(o: any): o is MsgDeposit { + return o && (o.$typeUrl === MsgDeposit.typeUrl || typeof o.proposalId === "bigint" && typeof o.depositor === "string" && Array.isArray(o.amount) && (!o.amount.length || Coin.is(o.amount[0]))); + }, + isSDK(o: any): o is MsgDepositSDKType { + return o && (o.$typeUrl === MsgDeposit.typeUrl || typeof o.proposal_id === "bigint" && typeof o.depositor === "string" && Array.isArray(o.amount) && (!o.amount.length || Coin.isSDK(o.amount[0]))); + }, + isAmino(o: any): o is MsgDepositAmino { + return o && (o.$typeUrl === MsgDeposit.typeUrl || typeof o.proposal_id === "bigint" && typeof o.depositor === "string" && Array.isArray(o.amount) && (!o.amount.length || Coin.isAmino(o.amount[0]))); + }, encode(message: MsgDeposit, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.proposalId !== BigInt(0)) { writer.uint32(8).uint64(message.proposalId); @@ -1457,6 +1575,12 @@ export const MsgDeposit = { typeUrl: "/cosmos.gov.v1.MsgDeposit", value: MsgDeposit.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgDeposit.typeUrl)) { + return; + } + Coin.registerTypeUrl(); } }; function createBaseMsgDepositResponse(): MsgDepositResponse { @@ -1471,6 +1595,15 @@ function createBaseMsgDepositResponse(): MsgDepositResponse { export const MsgDepositResponse = { typeUrl: "/cosmos.gov.v1.MsgDepositResponse", aminoType: "cosmos-sdk/v1/MsgDepositResponse", + is(o: any): o is MsgDepositResponse { + return o && o.$typeUrl === MsgDepositResponse.typeUrl; + }, + isSDK(o: any): o is MsgDepositResponseSDKType { + return o && o.$typeUrl === MsgDepositResponse.typeUrl; + }, + isAmino(o: any): o is MsgDepositResponseAmino { + return o && o.$typeUrl === MsgDepositResponse.typeUrl; + }, encode(_: MsgDepositResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -1535,109 +1668,6 @@ export const MsgDepositResponse = { typeUrl: "/cosmos.gov.v1.MsgDepositResponse", value: MsgDepositResponse.encode(message).finish() }; - } -}; -export const ProposalContentI_InterfaceDecoder = (input: BinaryReader | Uint8Array): TextProposal | RegisterIncentiveProposal | ClientUpdateProposal | UpgradeProposal | ReplacePoolIncentivesProposal | UpdatePoolIncentivesProposal | UpdateFeeTokenProposal | Any => { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - const data = Any.decode(reader, reader.uint32()); - switch (data.typeUrl) { - case "/cosmos.gov.v1beta1.TextProposal": - return TextProposal.decode(data.value); - case "/evmos.incentives.v1.RegisterIncentiveProposal": - return RegisterIncentiveProposal.decode(data.value); - case "/ibc.core.client.v1.ClientUpdateProposal": - return ClientUpdateProposal.decode(data.value); - case "/ibc.core.client.v1.UpgradeProposal": - return UpgradeProposal.decode(data.value); - case "/osmosis.poolincentives.v1beta1.ReplacePoolIncentivesProposal": - return ReplacePoolIncentivesProposal.decode(data.value); - case "/osmosis.poolincentives.v1beta1.UpdatePoolIncentivesProposal": - return UpdatePoolIncentivesProposal.decode(data.value); - case "/osmosis.txfees.v1beta1.UpdateFeeTokenProposal": - return UpdateFeeTokenProposal.decode(data.value); - default: - return data; - } -}; -export const ProposalContentI_FromAmino = (content: AnyAmino): Any => { - switch (content.type) { - case "cosmos-sdk/v1/TextProposal": - return Any.fromPartial({ - typeUrl: "/cosmos.gov.v1beta1.TextProposal", - value: TextProposal.encode(TextProposal.fromPartial(TextProposal.fromAmino(content.value))).finish() - }); - case "/evmos.incentives.v1.RegisterIncentiveProposal": - return Any.fromPartial({ - typeUrl: "/evmos.incentives.v1.RegisterIncentiveProposal", - value: RegisterIncentiveProposal.encode(RegisterIncentiveProposal.fromPartial(RegisterIncentiveProposal.fromAmino(content.value))).finish() - }); - case "cosmos-sdk/ClientUpdateProposal": - return Any.fromPartial({ - typeUrl: "/ibc.core.client.v1.ClientUpdateProposal", - value: ClientUpdateProposal.encode(ClientUpdateProposal.fromPartial(ClientUpdateProposal.fromAmino(content.value))).finish() - }); - case "cosmos-sdk/UpgradeProposal": - return Any.fromPartial({ - typeUrl: "/ibc.core.client.v1.UpgradeProposal", - value: UpgradeProposal.encode(UpgradeProposal.fromPartial(UpgradeProposal.fromAmino(content.value))).finish() - }); - case "osmosis/poolincentives/replace-pool-incentives-proposal": - return Any.fromPartial({ - typeUrl: "/osmosis.poolincentives.v1beta1.ReplacePoolIncentivesProposal", - value: ReplacePoolIncentivesProposal.encode(ReplacePoolIncentivesProposal.fromPartial(ReplacePoolIncentivesProposal.fromAmino(content.value))).finish() - }); - case "osmosis/poolincentives/update-pool-incentives-proposal": - return Any.fromPartial({ - typeUrl: "/osmosis.poolincentives.v1beta1.UpdatePoolIncentivesProposal", - value: UpdatePoolIncentivesProposal.encode(UpdatePoolIncentivesProposal.fromPartial(UpdatePoolIncentivesProposal.fromAmino(content.value))).finish() - }); - case "osmosis/txfees/update-fee-token-proposal": - return Any.fromPartial({ - typeUrl: "/osmosis.txfees.v1beta1.UpdateFeeTokenProposal", - value: UpdateFeeTokenProposal.encode(UpdateFeeTokenProposal.fromPartial(UpdateFeeTokenProposal.fromAmino(content.value))).finish() - }); - default: - return Any.fromAmino(content); - } -}; -export const ProposalContentI_ToAmino = (content: Any) => { - switch (content.typeUrl) { - case "/cosmos.gov.v1beta1.TextProposal": - return { - type: "cosmos-sdk/v1/TextProposal", - value: TextProposal.toAmino(TextProposal.decode(content.value, undefined)) - }; - case "/evmos.incentives.v1.RegisterIncentiveProposal": - return { - type: "/evmos.incentives.v1.RegisterIncentiveProposal", - value: RegisterIncentiveProposal.toAmino(RegisterIncentiveProposal.decode(content.value, undefined)) - }; - case "/ibc.core.client.v1.ClientUpdateProposal": - return { - type: "cosmos-sdk/ClientUpdateProposal", - value: ClientUpdateProposal.toAmino(ClientUpdateProposal.decode(content.value, undefined)) - }; - case "/ibc.core.client.v1.UpgradeProposal": - return { - type: "cosmos-sdk/UpgradeProposal", - value: UpgradeProposal.toAmino(UpgradeProposal.decode(content.value, undefined)) - }; - case "/osmosis.poolincentives.v1beta1.ReplacePoolIncentivesProposal": - return { - type: "osmosis/poolincentives/replace-pool-incentives-proposal", - value: ReplacePoolIncentivesProposal.toAmino(ReplacePoolIncentivesProposal.decode(content.value, undefined)) - }; - case "/osmosis.poolincentives.v1beta1.UpdatePoolIncentivesProposal": - return { - type: "osmosis/poolincentives/update-pool-incentives-proposal", - value: UpdatePoolIncentivesProposal.toAmino(UpdatePoolIncentivesProposal.decode(content.value, undefined)) - }; - case "/osmosis.txfees.v1beta1.UpdateFeeTokenProposal": - return { - type: "osmosis/txfees/update-fee-token-proposal", - value: UpdateFeeTokenProposal.toAmino(UpdateFeeTokenProposal.decode(content.value, undefined)) - }; - default: - return Any.toAmino(content); - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/cosmos/gov/v1beta1/genesis.ts b/__fixtures__/v-next/outputv2/cosmos/gov/v1beta1/genesis.ts index 6d9ee3b09f..eefff523f2 100644 --- a/__fixtures__/v-next/outputv2/cosmos/gov/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv2/cosmos/gov/v1beta1/genesis.ts @@ -1,5 +1,6 @@ import { Deposit, DepositAmino, DepositSDKType, Vote, VoteAmino, VoteSDKType, Proposal, ProposalAmino, ProposalSDKType, DepositParams, DepositParamsAmino, DepositParamsSDKType, VotingParams, VotingParamsAmino, VotingParamsSDKType, TallyParams, TallyParamsAmino, TallyParamsSDKType } from "./gov"; import { BinaryReader, BinaryWriter } from "../../../binary"; +import { GlobalDecoderRegistry } from "../../../registry"; import { isSet, DeepPartial } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "cosmos.gov.v1beta1"; @@ -118,6 +119,15 @@ function createBaseGenesisState(): GenesisState { export const GenesisState = { typeUrl: "/cosmos.gov.v1beta1.GenesisState", aminoType: "cosmos-sdk/GenesisState", + is(o: any): o is GenesisState { + return o && (o.$typeUrl === GenesisState.typeUrl || typeof o.startingProposalId === "bigint" && Array.isArray(o.deposits) && (!o.deposits.length || Deposit.is(o.deposits[0])) && Array.isArray(o.votes) && (!o.votes.length || Vote.is(o.votes[0])) && Array.isArray(o.proposals) && (!o.proposals.length || Proposal.is(o.proposals[0])) && DepositParams.is(o.depositParams) && VotingParams.is(o.votingParams) && TallyParams.is(o.tallyParams)); + }, + isSDK(o: any): o is GenesisStateSDKType { + return o && (o.$typeUrl === GenesisState.typeUrl || typeof o.starting_proposal_id === "bigint" && Array.isArray(o.deposits) && (!o.deposits.length || Deposit.isSDK(o.deposits[0])) && Array.isArray(o.votes) && (!o.votes.length || Vote.isSDK(o.votes[0])) && Array.isArray(o.proposals) && (!o.proposals.length || Proposal.isSDK(o.proposals[0])) && DepositParams.isSDK(o.deposit_params) && VotingParams.isSDK(o.voting_params) && TallyParams.isSDK(o.tally_params)); + }, + isAmino(o: any): o is GenesisStateAmino { + return o && (o.$typeUrl === GenesisState.typeUrl || typeof o.starting_proposal_id === "bigint" && Array.isArray(o.deposits) && (!o.deposits.length || Deposit.isAmino(o.deposits[0])) && Array.isArray(o.votes) && (!o.votes.length || Vote.isAmino(o.votes[0])) && Array.isArray(o.proposals) && (!o.proposals.length || Proposal.isAmino(o.proposals[0])) && DepositParams.isAmino(o.deposit_params) && VotingParams.isAmino(o.voting_params) && TallyParams.isAmino(o.tally_params)); + }, encode(message: GenesisState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.startingProposalId !== BigInt(0)) { writer.uint32(8).uint64(message.startingProposalId); @@ -326,5 +336,16 @@ export const GenesisState = { typeUrl: "/cosmos.gov.v1beta1.GenesisState", value: GenesisState.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GenesisState.typeUrl)) { + return; + } + Deposit.registerTypeUrl(); + Vote.registerTypeUrl(); + Proposal.registerTypeUrl(); + DepositParams.registerTypeUrl(); + VotingParams.registerTypeUrl(); + TallyParams.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/cosmos/gov/v1beta1/gov.ts b/__fixtures__/v-next/outputv2/cosmos/gov/v1beta1/gov.ts index 8263a2297d..f91865ac8f 100644 --- a/__fixtures__/v-next/outputv2/cosmos/gov/v1beta1/gov.ts +++ b/__fixtures__/v-next/outputv2/cosmos/gov/v1beta1/gov.ts @@ -6,10 +6,11 @@ import { RegisterIncentiveProposal, RegisterIncentiveProposalProtoMsg, RegisterI import { ClientUpdateProposal, ClientUpdateProposalProtoMsg, ClientUpdateProposalSDKType, UpgradeProposal, UpgradeProposalProtoMsg, UpgradeProposalSDKType } from "../../../ibc/core/client/v1/client"; import { ReplacePoolIncentivesProposal, ReplacePoolIncentivesProposalProtoMsg, ReplacePoolIncentivesProposalSDKType, UpdatePoolIncentivesProposal, UpdatePoolIncentivesProposalProtoMsg, UpdatePoolIncentivesProposalSDKType } from "../../../osmosis/pool-incentives/v1beta1/gov"; import { UpdateFeeTokenProposal, UpdateFeeTokenProposalProtoMsg, UpdateFeeTokenProposalSDKType } from "../../../osmosis/txfees/v1beta1/gov"; -import { BinaryReader, BinaryWriter } from "../../../binary"; -import { Decimal } from "@cosmjs/math"; import { isSet, DeepPartial, toTimestamp, fromTimestamp, bytesFromBase64, base64FromBytes } from "../../../helpers"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { Decimal } from "@interchainjs/math"; import { JsonSafe } from "../../../json-safe"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "cosmos.gov.v1beta1"; /** VoteOption enumerates the valid vote options for a given governance proposal. */ export enum VoteOption { @@ -633,6 +634,15 @@ function createBaseWeightedVoteOption(): WeightedVoteOption { export const WeightedVoteOption = { typeUrl: "/cosmos.gov.v1beta1.WeightedVoteOption", aminoType: "cosmos-sdk/WeightedVoteOption", + is(o: any): o is WeightedVoteOption { + return o && (o.$typeUrl === WeightedVoteOption.typeUrl || isSet(o.option) && typeof o.weight === "string"); + }, + isSDK(o: any): o is WeightedVoteOptionSDKType { + return o && (o.$typeUrl === WeightedVoteOption.typeUrl || isSet(o.option) && typeof o.weight === "string"); + }, + isAmino(o: any): o is WeightedVoteOptionAmino { + return o && (o.$typeUrl === WeightedVoteOption.typeUrl || isSet(o.option) && typeof o.weight === "string"); + }, encode(message: WeightedVoteOption, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.option !== 0) { writer.uint32(8).int32(message.option); @@ -705,7 +715,7 @@ export const WeightedVoteOption = { toAmino(message: WeightedVoteOption): WeightedVoteOptionAmino { const obj: any = {}; obj.option = message.option === 0 ? undefined : message.option; - obj.weight = message.weight === "" ? undefined : message.weight; + obj.weight = message.weight === "" ? undefined : Decimal.fromUserInput(message.weight, 18).atomics; return obj; }, fromAminoMsg(object: WeightedVoteOptionAminoMsg): WeightedVoteOption { @@ -728,7 +738,8 @@ export const WeightedVoteOption = { typeUrl: "/cosmos.gov.v1beta1.WeightedVoteOption", value: WeightedVoteOption.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseTextProposal(): TextProposal { return { @@ -747,6 +758,15 @@ function createBaseTextProposal(): TextProposal { export const TextProposal = { typeUrl: "/cosmos.gov.v1beta1.TextProposal", aminoType: "cosmos-sdk/TextProposal", + is(o: any): o is TextProposal { + return o && (o.$typeUrl === TextProposal.typeUrl || typeof o.title === "string" && typeof o.description === "string"); + }, + isSDK(o: any): o is TextProposalSDKType { + return o && (o.$typeUrl === TextProposal.typeUrl || typeof o.title === "string" && typeof o.description === "string"); + }, + isAmino(o: any): o is TextProposalAmino { + return o && (o.$typeUrl === TextProposal.typeUrl || typeof o.title === "string" && typeof o.description === "string"); + }, encode(message: TextProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.title !== "") { writer.uint32(10).string(message.title); @@ -842,6 +862,13 @@ export const TextProposal = { typeUrl: "/cosmos.gov.v1beta1.TextProposal", value: TextProposal.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(TextProposal.typeUrl)) { + return; + } + GlobalDecoderRegistry.register(TextProposal.typeUrl, TextProposal); + GlobalDecoderRegistry.registerAminoProtoMapping(TextProposal.aminoType, TextProposal.typeUrl); } }; function createBaseDeposit(): Deposit { @@ -861,6 +888,15 @@ function createBaseDeposit(): Deposit { export const Deposit = { typeUrl: "/cosmos.gov.v1beta1.Deposit", aminoType: "cosmos-sdk/Deposit", + is(o: any): o is Deposit { + return o && (o.$typeUrl === Deposit.typeUrl || typeof o.proposalId === "bigint" && typeof o.depositor === "string" && Array.isArray(o.amount) && (!o.amount.length || Coin.is(o.amount[0]))); + }, + isSDK(o: any): o is DepositSDKType { + return o && (o.$typeUrl === Deposit.typeUrl || typeof o.proposal_id === "bigint" && typeof o.depositor === "string" && Array.isArray(o.amount) && (!o.amount.length || Coin.isSDK(o.amount[0]))); + }, + isAmino(o: any): o is DepositAmino { + return o && (o.$typeUrl === Deposit.typeUrl || typeof o.proposal_id === "bigint" && typeof o.depositor === "string" && Array.isArray(o.amount) && (!o.amount.length || Coin.isAmino(o.amount[0]))); + }, encode(message: Deposit, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.proposalId !== BigInt(0)) { writer.uint32(8).uint64(message.proposalId); @@ -983,6 +1019,12 @@ export const Deposit = { typeUrl: "/cosmos.gov.v1beta1.Deposit", value: Deposit.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Deposit.typeUrl)) { + return; + } + Coin.registerTypeUrl(); } }; function createBaseProposal(): Proposal { @@ -1007,12 +1049,21 @@ function createBaseProposal(): Proposal { export const Proposal = { typeUrl: "/cosmos.gov.v1beta1.Proposal", aminoType: "cosmos-sdk/Proposal", + is(o: any): o is Proposal { + return o && (o.$typeUrl === Proposal.typeUrl || typeof o.proposalId === "bigint" && isSet(o.status) && TallyResult.is(o.finalTallyResult) && Timestamp.is(o.submitTime) && Timestamp.is(o.depositEndTime) && Array.isArray(o.totalDeposit) && (!o.totalDeposit.length || Coin.is(o.totalDeposit[0])) && Timestamp.is(o.votingStartTime) && Timestamp.is(o.votingEndTime)); + }, + isSDK(o: any): o is ProposalSDKType { + return o && (o.$typeUrl === Proposal.typeUrl || typeof o.proposal_id === "bigint" && isSet(o.status) && TallyResult.isSDK(o.final_tally_result) && Timestamp.isSDK(o.submit_time) && Timestamp.isSDK(o.deposit_end_time) && Array.isArray(o.total_deposit) && (!o.total_deposit.length || Coin.isSDK(o.total_deposit[0])) && Timestamp.isSDK(o.voting_start_time) && Timestamp.isSDK(o.voting_end_time)); + }, + isAmino(o: any): o is ProposalAmino { + return o && (o.$typeUrl === Proposal.typeUrl || typeof o.proposal_id === "bigint" && isSet(o.status) && TallyResult.isAmino(o.final_tally_result) && Timestamp.isAmino(o.submit_time) && Timestamp.isAmino(o.deposit_end_time) && Array.isArray(o.total_deposit) && (!o.total_deposit.length || Coin.isAmino(o.total_deposit[0])) && Timestamp.isAmino(o.voting_start_time) && Timestamp.isAmino(o.voting_end_time)); + }, encode(message: Proposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.proposalId !== BigInt(0)) { writer.uint32(8).uint64(message.proposalId); } if (message.content !== undefined) { - Any.encode((message.content as Any), writer.uint32(18).fork()).ldelim(); + Any.encode(GlobalDecoderRegistry.wrapAny(message.content), writer.uint32(18).fork()).ldelim(); } if (message.status !== 0) { writer.uint32(24).int32(message.status); @@ -1048,7 +1099,7 @@ export const Proposal = { message.proposalId = reader.uint64(); break; case 2: - message.content = (ProposalContentI_InterfaceDecoder(reader) as Any); + message.content = GlobalDecoderRegistry.unwrapAny(reader); break; case 3: message.status = (reader.int32() as any); @@ -1081,7 +1132,7 @@ export const Proposal = { fromJSON(object: any): Proposal { const obj = createBaseProposal(); if (isSet(object.proposalId)) obj.proposalId = BigInt(object.proposalId.toString()); - if (isSet(object.content)) obj.content = Any.fromJSON(object.content); + if (isSet(object.content)) obj.content = GlobalDecoderRegistry.fromJSON(object.content); if (isSet(object.status)) obj.status = proposalStatusFromJSON(object.status); if (isSet(object.finalTallyResult)) obj.finalTallyResult = TallyResult.fromJSON(object.finalTallyResult); if (isSet(object.submitTime)) obj.submitTime = new Date(object.submitTime); @@ -1094,7 +1145,7 @@ export const Proposal = { toJSON(message: Proposal): JsonSafe { const obj: any = {}; message.proposalId !== undefined && (obj.proposalId = (message.proposalId || BigInt(0)).toString()); - message.content !== undefined && (obj.content = message.content ? Any.toJSON(message.content) : undefined); + message.content !== undefined && (obj.content = message.content ? GlobalDecoderRegistry.toJSON(message.content) : undefined); message.status !== undefined && (obj.status = proposalStatusToJSON(message.status)); message.finalTallyResult !== undefined && (obj.finalTallyResult = message.finalTallyResult ? TallyResult.toJSON(message.finalTallyResult) : undefined); message.submitTime !== undefined && (obj.submitTime = message.submitTime.toISOString()); @@ -1114,7 +1165,7 @@ export const Proposal = { message.proposalId = BigInt(object.proposalId.toString()); } if (object.content !== undefined && object.content !== null) { - message.content = Any.fromPartial(object.content); + message.content = GlobalDecoderRegistry.fromPartial(object.content); } message.status = object.status ?? 0; if (object.finalTallyResult !== undefined && object.finalTallyResult !== null) { @@ -1130,7 +1181,7 @@ export const Proposal = { fromSDK(object: ProposalSDKType): Proposal { return { proposalId: object?.proposal_id, - content: object.content ? Any.fromSDK(object.content) : undefined, + content: object.content ? GlobalDecoderRegistry.fromSDK(object.content) : undefined, status: isSet(object.status) ? proposalStatusFromJSON(object.status) : -1, finalTallyResult: object.final_tally_result ? TallyResult.fromSDK(object.final_tally_result) : undefined, submitTime: object.submit_time ?? undefined, @@ -1143,7 +1194,7 @@ export const Proposal = { toSDK(message: Proposal): ProposalSDKType { const obj: any = {}; obj.proposal_id = message.proposalId; - message.content !== undefined && (obj.content = message.content ? Any.toSDK(message.content) : undefined); + message.content !== undefined && (obj.content = message.content ? GlobalDecoderRegistry.toSDK(message.content) : undefined); message.status !== undefined && (obj.status = proposalStatusToJSON(message.status)); message.finalTallyResult !== undefined && (obj.final_tally_result = message.finalTallyResult ? TallyResult.toSDK(message.finalTallyResult) : undefined); message.submitTime !== undefined && (obj.submit_time = message.submitTime ?? undefined); @@ -1163,7 +1214,7 @@ export const Proposal = { message.proposalId = BigInt(object.proposal_id); } if (object.content !== undefined && object.content !== null) { - message.content = ProposalContentI_FromAmino(object.content); + message.content = GlobalDecoderRegistry.fromAminoMsg(object.content); } if (object.status !== undefined && object.status !== null) { message.status = object.status; @@ -1189,7 +1240,7 @@ export const Proposal = { toAmino(message: Proposal): ProposalAmino { const obj: any = {}; obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId?.toString() : undefined; - obj.content = message.content ? ProposalContentI_ToAmino((message.content as Any)) : undefined; + obj.content = message.content ? GlobalDecoderRegistry.toAminoMsg(message.content) : undefined; obj.status = message.status === 0 ? undefined : message.status; obj.final_tally_result = message.finalTallyResult ? TallyResult.toAmino(message.finalTallyResult) : undefined; obj.submit_time = message.submitTime ? Timestamp.toAmino(toTimestamp(message.submitTime)) : undefined; @@ -1223,6 +1274,20 @@ export const Proposal = { typeUrl: "/cosmos.gov.v1beta1.Proposal", value: Proposal.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Proposal.typeUrl)) { + return; + } + TextProposal.registerTypeUrl(); + RegisterIncentiveProposal.registerTypeUrl(); + ClientUpdateProposal.registerTypeUrl(); + UpgradeProposal.registerTypeUrl(); + ReplacePoolIncentivesProposal.registerTypeUrl(); + UpdatePoolIncentivesProposal.registerTypeUrl(); + UpdateFeeTokenProposal.registerTypeUrl(); + TallyResult.registerTypeUrl(); + Coin.registerTypeUrl(); } }; function createBaseTallyResult(): TallyResult { @@ -1242,6 +1307,15 @@ function createBaseTallyResult(): TallyResult { export const TallyResult = { typeUrl: "/cosmos.gov.v1beta1.TallyResult", aminoType: "cosmos-sdk/TallyResult", + is(o: any): o is TallyResult { + return o && (o.$typeUrl === TallyResult.typeUrl || typeof o.yes === "string" && typeof o.abstain === "string" && typeof o.no === "string" && typeof o.noWithVeto === "string"); + }, + isSDK(o: any): o is TallyResultSDKType { + return o && (o.$typeUrl === TallyResult.typeUrl || typeof o.yes === "string" && typeof o.abstain === "string" && typeof o.no === "string" && typeof o.no_with_veto === "string"); + }, + isAmino(o: any): o is TallyResultAmino { + return o && (o.$typeUrl === TallyResult.typeUrl || typeof o.yes === "string" && typeof o.abstain === "string" && typeof o.no === "string" && typeof o.no_with_veto === "string"); + }, encode(message: TallyResult, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.yes !== "") { writer.uint32(10).string(message.yes); @@ -1367,7 +1441,8 @@ export const TallyResult = { typeUrl: "/cosmos.gov.v1beta1.TallyResult", value: TallyResult.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseVote(): Vote { return { @@ -1387,6 +1462,15 @@ function createBaseVote(): Vote { export const Vote = { typeUrl: "/cosmos.gov.v1beta1.Vote", aminoType: "cosmos-sdk/Vote", + is(o: any): o is Vote { + return o && (o.$typeUrl === Vote.typeUrl || typeof o.proposalId === "bigint" && typeof o.voter === "string" && isSet(o.option) && Array.isArray(o.options) && (!o.options.length || WeightedVoteOption.is(o.options[0]))); + }, + isSDK(o: any): o is VoteSDKType { + return o && (o.$typeUrl === Vote.typeUrl || typeof o.proposal_id === "bigint" && typeof o.voter === "string" && isSet(o.option) && Array.isArray(o.options) && (!o.options.length || WeightedVoteOption.isSDK(o.options[0]))); + }, + isAmino(o: any): o is VoteAmino { + return o && (o.$typeUrl === Vote.typeUrl || typeof o.proposal_id === "bigint" && typeof o.voter === "string" && isSet(o.option) && Array.isArray(o.options) && (!o.options.length || WeightedVoteOption.isAmino(o.options[0]))); + }, encode(message: Vote, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.proposalId !== BigInt(0)) { writer.uint32(8).uint64(message.proposalId); @@ -1524,6 +1608,12 @@ export const Vote = { typeUrl: "/cosmos.gov.v1beta1.Vote", value: Vote.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Vote.typeUrl)) { + return; + } + WeightedVoteOption.registerTypeUrl(); } }; function createBaseDepositParams(): DepositParams { @@ -1541,6 +1631,15 @@ function createBaseDepositParams(): DepositParams { export const DepositParams = { typeUrl: "/cosmos.gov.v1beta1.DepositParams", aminoType: "cosmos-sdk/DepositParams", + is(o: any): o is DepositParams { + return o && (o.$typeUrl === DepositParams.typeUrl || Array.isArray(o.minDeposit) && (!o.minDeposit.length || Coin.is(o.minDeposit[0])) && Duration.is(o.maxDepositPeriod)); + }, + isSDK(o: any): o is DepositParamsSDKType { + return o && (o.$typeUrl === DepositParams.typeUrl || Array.isArray(o.min_deposit) && (!o.min_deposit.length || Coin.isSDK(o.min_deposit[0])) && Duration.isSDK(o.max_deposit_period)); + }, + isAmino(o: any): o is DepositParamsAmino { + return o && (o.$typeUrl === DepositParams.typeUrl || Array.isArray(o.min_deposit) && (!o.min_deposit.length || Coin.isAmino(o.min_deposit[0])) && Duration.isAmino(o.max_deposit_period)); + }, encode(message: DepositParams, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.minDeposit) { Coin.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -1648,6 +1747,12 @@ export const DepositParams = { typeUrl: "/cosmos.gov.v1beta1.DepositParams", value: DepositParams.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(DepositParams.typeUrl)) { + return; + } + Coin.registerTypeUrl(); } }; function createBaseVotingParams(): VotingParams { @@ -1664,6 +1769,15 @@ function createBaseVotingParams(): VotingParams { export const VotingParams = { typeUrl: "/cosmos.gov.v1beta1.VotingParams", aminoType: "cosmos-sdk/VotingParams", + is(o: any): o is VotingParams { + return o && (o.$typeUrl === VotingParams.typeUrl || Duration.is(o.votingPeriod)); + }, + isSDK(o: any): o is VotingParamsSDKType { + return o && (o.$typeUrl === VotingParams.typeUrl || Duration.isSDK(o.voting_period)); + }, + isAmino(o: any): o is VotingParamsAmino { + return o && (o.$typeUrl === VotingParams.typeUrl || Duration.isAmino(o.voting_period)); + }, encode(message: VotingParams, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.votingPeriod !== undefined) { Duration.encode(message.votingPeriod, writer.uint32(10).fork()).ldelim(); @@ -1746,7 +1860,8 @@ export const VotingParams = { typeUrl: "/cosmos.gov.v1beta1.VotingParams", value: VotingParams.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseTallyParams(): TallyParams { return { @@ -1764,6 +1879,15 @@ function createBaseTallyParams(): TallyParams { export const TallyParams = { typeUrl: "/cosmos.gov.v1beta1.TallyParams", aminoType: "cosmos-sdk/TallyParams", + is(o: any): o is TallyParams { + return o && (o.$typeUrl === TallyParams.typeUrl || (o.quorum instanceof Uint8Array || typeof o.quorum === "string") && (o.threshold instanceof Uint8Array || typeof o.threshold === "string") && (o.vetoThreshold instanceof Uint8Array || typeof o.vetoThreshold === "string")); + }, + isSDK(o: any): o is TallyParamsSDKType { + return o && (o.$typeUrl === TallyParams.typeUrl || (o.quorum instanceof Uint8Array || typeof o.quorum === "string") && (o.threshold instanceof Uint8Array || typeof o.threshold === "string") && (o.veto_threshold instanceof Uint8Array || typeof o.veto_threshold === "string")); + }, + isAmino(o: any): o is TallyParamsAmino { + return o && (o.$typeUrl === TallyParams.typeUrl || (o.quorum instanceof Uint8Array || typeof o.quorum === "string") && (o.threshold instanceof Uint8Array || typeof o.threshold === "string") && (o.veto_threshold instanceof Uint8Array || typeof o.veto_threshold === "string")); + }, encode(message: TallyParams, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.quorum.length !== 0) { writer.uint32(10).bytes(message.quorum); @@ -1874,109 +1998,6 @@ export const TallyParams = { typeUrl: "/cosmos.gov.v1beta1.TallyParams", value: TallyParams.encode(message).finish() }; - } -}; -export const ProposalContentI_InterfaceDecoder = (input: BinaryReader | Uint8Array): TextProposal | RegisterIncentiveProposal | ClientUpdateProposal | UpgradeProposal | ReplacePoolIncentivesProposal | UpdatePoolIncentivesProposal | UpdateFeeTokenProposal | Any => { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - const data = Any.decode(reader, reader.uint32()); - switch (data.typeUrl) { - case "/cosmos.gov.v1beta1.TextProposal": - return TextProposal.decode(data.value); - case "/evmos.incentives.v1.RegisterIncentiveProposal": - return RegisterIncentiveProposal.decode(data.value); - case "/ibc.core.client.v1.ClientUpdateProposal": - return ClientUpdateProposal.decode(data.value); - case "/ibc.core.client.v1.UpgradeProposal": - return UpgradeProposal.decode(data.value); - case "/osmosis.poolincentives.v1beta1.ReplacePoolIncentivesProposal": - return ReplacePoolIncentivesProposal.decode(data.value); - case "/osmosis.poolincentives.v1beta1.UpdatePoolIncentivesProposal": - return UpdatePoolIncentivesProposal.decode(data.value); - case "/osmosis.txfees.v1beta1.UpdateFeeTokenProposal": - return UpdateFeeTokenProposal.decode(data.value); - default: - return data; - } -}; -export const ProposalContentI_FromAmino = (content: AnyAmino): Any => { - switch (content.type) { - case "cosmos-sdk/TextProposal": - return Any.fromPartial({ - typeUrl: "/cosmos.gov.v1beta1.TextProposal", - value: TextProposal.encode(TextProposal.fromPartial(TextProposal.fromAmino(content.value))).finish() - }); - case "/evmos.incentives.v1.RegisterIncentiveProposal": - return Any.fromPartial({ - typeUrl: "/evmos.incentives.v1.RegisterIncentiveProposal", - value: RegisterIncentiveProposal.encode(RegisterIncentiveProposal.fromPartial(RegisterIncentiveProposal.fromAmino(content.value))).finish() - }); - case "cosmos-sdk/ClientUpdateProposal": - return Any.fromPartial({ - typeUrl: "/ibc.core.client.v1.ClientUpdateProposal", - value: ClientUpdateProposal.encode(ClientUpdateProposal.fromPartial(ClientUpdateProposal.fromAmino(content.value))).finish() - }); - case "cosmos-sdk/UpgradeProposal": - return Any.fromPartial({ - typeUrl: "/ibc.core.client.v1.UpgradeProposal", - value: UpgradeProposal.encode(UpgradeProposal.fromPartial(UpgradeProposal.fromAmino(content.value))).finish() - }); - case "osmosis/poolincentives/replace-pool-incentives-proposal": - return Any.fromPartial({ - typeUrl: "/osmosis.poolincentives.v1beta1.ReplacePoolIncentivesProposal", - value: ReplacePoolIncentivesProposal.encode(ReplacePoolIncentivesProposal.fromPartial(ReplacePoolIncentivesProposal.fromAmino(content.value))).finish() - }); - case "osmosis/poolincentives/update-pool-incentives-proposal": - return Any.fromPartial({ - typeUrl: "/osmosis.poolincentives.v1beta1.UpdatePoolIncentivesProposal", - value: UpdatePoolIncentivesProposal.encode(UpdatePoolIncentivesProposal.fromPartial(UpdatePoolIncentivesProposal.fromAmino(content.value))).finish() - }); - case "osmosis/txfees/update-fee-token-proposal": - return Any.fromPartial({ - typeUrl: "/osmosis.txfees.v1beta1.UpdateFeeTokenProposal", - value: UpdateFeeTokenProposal.encode(UpdateFeeTokenProposal.fromPartial(UpdateFeeTokenProposal.fromAmino(content.value))).finish() - }); - default: - return Any.fromAmino(content); - } -}; -export const ProposalContentI_ToAmino = (content: Any) => { - switch (content.typeUrl) { - case "/cosmos.gov.v1beta1.TextProposal": - return { - type: "cosmos-sdk/TextProposal", - value: TextProposal.toAmino(TextProposal.decode(content.value, undefined)) - }; - case "/evmos.incentives.v1.RegisterIncentiveProposal": - return { - type: "/evmos.incentives.v1.RegisterIncentiveProposal", - value: RegisterIncentiveProposal.toAmino(RegisterIncentiveProposal.decode(content.value, undefined)) - }; - case "/ibc.core.client.v1.ClientUpdateProposal": - return { - type: "cosmos-sdk/ClientUpdateProposal", - value: ClientUpdateProposal.toAmino(ClientUpdateProposal.decode(content.value, undefined)) - }; - case "/ibc.core.client.v1.UpgradeProposal": - return { - type: "cosmos-sdk/UpgradeProposal", - value: UpgradeProposal.toAmino(UpgradeProposal.decode(content.value, undefined)) - }; - case "/osmosis.poolincentives.v1beta1.ReplacePoolIncentivesProposal": - return { - type: "osmosis/poolincentives/replace-pool-incentives-proposal", - value: ReplacePoolIncentivesProposal.toAmino(ReplacePoolIncentivesProposal.decode(content.value, undefined)) - }; - case "/osmosis.poolincentives.v1beta1.UpdatePoolIncentivesProposal": - return { - type: "osmosis/poolincentives/update-pool-incentives-proposal", - value: UpdatePoolIncentivesProposal.toAmino(UpdatePoolIncentivesProposal.decode(content.value, undefined)) - }; - case "/osmosis.txfees.v1beta1.UpdateFeeTokenProposal": - return { - type: "osmosis/txfees/update-fee-token-proposal", - value: UpdateFeeTokenProposal.toAmino(UpdateFeeTokenProposal.decode(content.value, undefined)) - }; - default: - return Any.toAmino(content); - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/cosmos/gov/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputv2/cosmos/gov/v1beta1/query.rpc.func.ts new file mode 100644 index 0000000000..ac01a6aeb2 --- /dev/null +++ b/__fixtures__/v-next/outputv2/cosmos/gov/v1beta1/query.rpc.func.ts @@ -0,0 +1,106 @@ +import { buildQuery } from "../../../helper-func-types"; +import { QueryProposalRequest, QueryProposalResponse, QueryProposalsRequest, QueryProposalsResponse, QueryVoteRequest, QueryVoteResponse, QueryVotesRequest, QueryVotesResponse, QueryParamsRequest, QueryParamsResponse, QueryDepositRequest, QueryDepositResponse, QueryDepositsRequest, QueryDepositsResponse, QueryTallyResultRequest, QueryTallyResultResponse } from "./query"; +/** + * Proposal queries proposal details based on ProposalID. + * @name getProposal + * @package cosmos.gov.v1beta1 + * @see proto service: cosmos.gov.v1beta1.Proposal + */ +export const getProposal = buildQuery({ + encode: QueryProposalRequest.encode, + decode: QueryProposalResponse.decode, + service: "cosmos.gov.v1beta1.Query", + method: "Proposal", + deps: [QueryProposalRequest, QueryProposalResponse] +}); +/** + * Proposals queries all proposals based on given status. + * @name getProposals + * @package cosmos.gov.v1beta1 + * @see proto service: cosmos.gov.v1beta1.Proposals + */ +export const getProposals = buildQuery({ + encode: QueryProposalsRequest.encode, + decode: QueryProposalsResponse.decode, + service: "cosmos.gov.v1beta1.Query", + method: "Proposals", + deps: [QueryProposalsRequest, QueryProposalsResponse] +}); +/** + * Vote queries voted information based on proposalID, voterAddr. + * @name getVote + * @package cosmos.gov.v1beta1 + * @see proto service: cosmos.gov.v1beta1.Vote + */ +export const getVote = buildQuery({ + encode: QueryVoteRequest.encode, + decode: QueryVoteResponse.decode, + service: "cosmos.gov.v1beta1.Query", + method: "Vote", + deps: [QueryVoteRequest, QueryVoteResponse] +}); +/** + * Votes queries votes of a given proposal. + * @name getVotes + * @package cosmos.gov.v1beta1 + * @see proto service: cosmos.gov.v1beta1.Votes + */ +export const getVotes = buildQuery({ + encode: QueryVotesRequest.encode, + decode: QueryVotesResponse.decode, + service: "cosmos.gov.v1beta1.Query", + method: "Votes", + deps: [QueryVotesRequest, QueryVotesResponse] +}); +/** + * Params queries all parameters of the gov module. + * @name getParams + * @package cosmos.gov.v1beta1 + * @see proto service: cosmos.gov.v1beta1.Params + */ +export const getParams = buildQuery({ + encode: QueryParamsRequest.encode, + decode: QueryParamsResponse.decode, + service: "cosmos.gov.v1beta1.Query", + method: "Params", + deps: [QueryParamsRequest, QueryParamsResponse] +}); +/** + * Deposit queries single deposit information based proposalID, depositAddr. + * @name getDeposit + * @package cosmos.gov.v1beta1 + * @see proto service: cosmos.gov.v1beta1.Deposit + */ +export const getDeposit = buildQuery({ + encode: QueryDepositRequest.encode, + decode: QueryDepositResponse.decode, + service: "cosmos.gov.v1beta1.Query", + method: "Deposit", + deps: [QueryDepositRequest, QueryDepositResponse] +}); +/** + * Deposits queries all deposits of a single proposal. + * @name getDeposits + * @package cosmos.gov.v1beta1 + * @see proto service: cosmos.gov.v1beta1.Deposits + */ +export const getDeposits = buildQuery({ + encode: QueryDepositsRequest.encode, + decode: QueryDepositsResponse.decode, + service: "cosmos.gov.v1beta1.Query", + method: "Deposits", + deps: [QueryDepositsRequest, QueryDepositsResponse] +}); +/** + * TallyResult queries the tally of a proposal vote. + * @name getTallyResult + * @package cosmos.gov.v1beta1 + * @see proto service: cosmos.gov.v1beta1.TallyResult + */ +export const getTallyResult = buildQuery({ + encode: QueryTallyResultRequest.encode, + decode: QueryTallyResultResponse.decode, + service: "cosmos.gov.v1beta1.Query", + method: "TallyResult", + deps: [QueryTallyResultRequest, QueryTallyResultResponse] +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/cosmos/gov/v1beta1/query.ts b/__fixtures__/v-next/outputv2/cosmos/gov/v1beta1/query.ts index 6a2faa752b..d06e8ef643 100644 --- a/__fixtures__/v-next/outputv2/cosmos/gov/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv2/cosmos/gov/v1beta1/query.ts @@ -3,6 +3,7 @@ import { PageRequest, PageRequestAmino, PageRequestSDKType, PageResponse, PageRe import { BinaryReader, BinaryWriter } from "../../../binary"; import { isSet, DeepPartial } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "cosmos.gov.v1beta1"; /** * QueryProposalRequest is the request type for the Query/Proposal RPC method. @@ -769,6 +770,15 @@ function createBaseQueryProposalRequest(): QueryProposalRequest { export const QueryProposalRequest = { typeUrl: "/cosmos.gov.v1beta1.QueryProposalRequest", aminoType: "cosmos-sdk/QueryProposalRequest", + is(o: any): o is QueryProposalRequest { + return o && (o.$typeUrl === QueryProposalRequest.typeUrl || typeof o.proposalId === "bigint"); + }, + isSDK(o: any): o is QueryProposalRequestSDKType { + return o && (o.$typeUrl === QueryProposalRequest.typeUrl || typeof o.proposal_id === "bigint"); + }, + isAmino(o: any): o is QueryProposalRequestAmino { + return o && (o.$typeUrl === QueryProposalRequest.typeUrl || typeof o.proposal_id === "bigint"); + }, encode(message: QueryProposalRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.proposalId !== BigInt(0)) { writer.uint32(8).uint64(message.proposalId); @@ -851,7 +861,8 @@ export const QueryProposalRequest = { typeUrl: "/cosmos.gov.v1beta1.QueryProposalRequest", value: QueryProposalRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryProposalResponse(): QueryProposalResponse { return { @@ -867,6 +878,15 @@ function createBaseQueryProposalResponse(): QueryProposalResponse { export const QueryProposalResponse = { typeUrl: "/cosmos.gov.v1beta1.QueryProposalResponse", aminoType: "cosmos-sdk/QueryProposalResponse", + is(o: any): o is QueryProposalResponse { + return o && (o.$typeUrl === QueryProposalResponse.typeUrl || Proposal.is(o.proposal)); + }, + isSDK(o: any): o is QueryProposalResponseSDKType { + return o && (o.$typeUrl === QueryProposalResponse.typeUrl || Proposal.isSDK(o.proposal)); + }, + isAmino(o: any): o is QueryProposalResponseAmino { + return o && (o.$typeUrl === QueryProposalResponse.typeUrl || Proposal.isAmino(o.proposal)); + }, encode(message: QueryProposalResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.proposal !== undefined) { Proposal.encode(message.proposal, writer.uint32(10).fork()).ldelim(); @@ -949,6 +969,12 @@ export const QueryProposalResponse = { typeUrl: "/cosmos.gov.v1beta1.QueryProposalResponse", value: QueryProposalResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryProposalResponse.typeUrl)) { + return; + } + Proposal.registerTypeUrl(); } }; function createBaseQueryProposalsRequest(): QueryProposalsRequest { @@ -968,6 +994,15 @@ function createBaseQueryProposalsRequest(): QueryProposalsRequest { export const QueryProposalsRequest = { typeUrl: "/cosmos.gov.v1beta1.QueryProposalsRequest", aminoType: "cosmos-sdk/QueryProposalsRequest", + is(o: any): o is QueryProposalsRequest { + return o && (o.$typeUrl === QueryProposalsRequest.typeUrl || isSet(o.proposalStatus) && typeof o.voter === "string" && typeof o.depositor === "string"); + }, + isSDK(o: any): o is QueryProposalsRequestSDKType { + return o && (o.$typeUrl === QueryProposalsRequest.typeUrl || isSet(o.proposal_status) && typeof o.voter === "string" && typeof o.depositor === "string"); + }, + isAmino(o: any): o is QueryProposalsRequestAmino { + return o && (o.$typeUrl === QueryProposalsRequest.typeUrl || isSet(o.proposal_status) && typeof o.voter === "string" && typeof o.depositor === "string"); + }, encode(message: QueryProposalsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.proposalStatus !== 0) { writer.uint32(8).int32(message.proposalStatus); @@ -1095,6 +1130,12 @@ export const QueryProposalsRequest = { typeUrl: "/cosmos.gov.v1beta1.QueryProposalsRequest", value: QueryProposalsRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryProposalsRequest.typeUrl)) { + return; + } + PageRequest.registerTypeUrl(); } }; function createBaseQueryProposalsResponse(): QueryProposalsResponse { @@ -1113,6 +1154,15 @@ function createBaseQueryProposalsResponse(): QueryProposalsResponse { export const QueryProposalsResponse = { typeUrl: "/cosmos.gov.v1beta1.QueryProposalsResponse", aminoType: "cosmos-sdk/QueryProposalsResponse", + is(o: any): o is QueryProposalsResponse { + return o && (o.$typeUrl === QueryProposalsResponse.typeUrl || Array.isArray(o.proposals) && (!o.proposals.length || Proposal.is(o.proposals[0]))); + }, + isSDK(o: any): o is QueryProposalsResponseSDKType { + return o && (o.$typeUrl === QueryProposalsResponse.typeUrl || Array.isArray(o.proposals) && (!o.proposals.length || Proposal.isSDK(o.proposals[0]))); + }, + isAmino(o: any): o is QueryProposalsResponseAmino { + return o && (o.$typeUrl === QueryProposalsResponse.typeUrl || Array.isArray(o.proposals) && (!o.proposals.length || Proposal.isAmino(o.proposals[0]))); + }, encode(message: QueryProposalsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.proposals) { Proposal.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -1220,6 +1270,13 @@ export const QueryProposalsResponse = { typeUrl: "/cosmos.gov.v1beta1.QueryProposalsResponse", value: QueryProposalsResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryProposalsResponse.typeUrl)) { + return; + } + Proposal.registerTypeUrl(); + PageResponse.registerTypeUrl(); } }; function createBaseQueryVoteRequest(): QueryVoteRequest { @@ -1237,6 +1294,15 @@ function createBaseQueryVoteRequest(): QueryVoteRequest { export const QueryVoteRequest = { typeUrl: "/cosmos.gov.v1beta1.QueryVoteRequest", aminoType: "cosmos-sdk/QueryVoteRequest", + is(o: any): o is QueryVoteRequest { + return o && (o.$typeUrl === QueryVoteRequest.typeUrl || typeof o.proposalId === "bigint" && typeof o.voter === "string"); + }, + isSDK(o: any): o is QueryVoteRequestSDKType { + return o && (o.$typeUrl === QueryVoteRequest.typeUrl || typeof o.proposal_id === "bigint" && typeof o.voter === "string"); + }, + isAmino(o: any): o is QueryVoteRequestAmino { + return o && (o.$typeUrl === QueryVoteRequest.typeUrl || typeof o.proposal_id === "bigint" && typeof o.voter === "string"); + }, encode(message: QueryVoteRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.proposalId !== BigInt(0)) { writer.uint32(8).uint64(message.proposalId); @@ -1334,7 +1400,8 @@ export const QueryVoteRequest = { typeUrl: "/cosmos.gov.v1beta1.QueryVoteRequest", value: QueryVoteRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryVoteResponse(): QueryVoteResponse { return { @@ -1350,6 +1417,15 @@ function createBaseQueryVoteResponse(): QueryVoteResponse { export const QueryVoteResponse = { typeUrl: "/cosmos.gov.v1beta1.QueryVoteResponse", aminoType: "cosmos-sdk/QueryVoteResponse", + is(o: any): o is QueryVoteResponse { + return o && (o.$typeUrl === QueryVoteResponse.typeUrl || Vote.is(o.vote)); + }, + isSDK(o: any): o is QueryVoteResponseSDKType { + return o && (o.$typeUrl === QueryVoteResponse.typeUrl || Vote.isSDK(o.vote)); + }, + isAmino(o: any): o is QueryVoteResponseAmino { + return o && (o.$typeUrl === QueryVoteResponse.typeUrl || Vote.isAmino(o.vote)); + }, encode(message: QueryVoteResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.vote !== undefined) { Vote.encode(message.vote, writer.uint32(10).fork()).ldelim(); @@ -1432,6 +1508,12 @@ export const QueryVoteResponse = { typeUrl: "/cosmos.gov.v1beta1.QueryVoteResponse", value: QueryVoteResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryVoteResponse.typeUrl)) { + return; + } + Vote.registerTypeUrl(); } }; function createBaseQueryVotesRequest(): QueryVotesRequest { @@ -1449,6 +1531,15 @@ function createBaseQueryVotesRequest(): QueryVotesRequest { export const QueryVotesRequest = { typeUrl: "/cosmos.gov.v1beta1.QueryVotesRequest", aminoType: "cosmos-sdk/QueryVotesRequest", + is(o: any): o is QueryVotesRequest { + return o && (o.$typeUrl === QueryVotesRequest.typeUrl || typeof o.proposalId === "bigint"); + }, + isSDK(o: any): o is QueryVotesRequestSDKType { + return o && (o.$typeUrl === QueryVotesRequest.typeUrl || typeof o.proposal_id === "bigint"); + }, + isAmino(o: any): o is QueryVotesRequestAmino { + return o && (o.$typeUrl === QueryVotesRequest.typeUrl || typeof o.proposal_id === "bigint"); + }, encode(message: QueryVotesRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.proposalId !== BigInt(0)) { writer.uint32(8).uint64(message.proposalId); @@ -1548,6 +1639,12 @@ export const QueryVotesRequest = { typeUrl: "/cosmos.gov.v1beta1.QueryVotesRequest", value: QueryVotesRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryVotesRequest.typeUrl)) { + return; + } + PageRequest.registerTypeUrl(); } }; function createBaseQueryVotesResponse(): QueryVotesResponse { @@ -1565,6 +1662,15 @@ function createBaseQueryVotesResponse(): QueryVotesResponse { export const QueryVotesResponse = { typeUrl: "/cosmos.gov.v1beta1.QueryVotesResponse", aminoType: "cosmos-sdk/QueryVotesResponse", + is(o: any): o is QueryVotesResponse { + return o && (o.$typeUrl === QueryVotesResponse.typeUrl || Array.isArray(o.votes) && (!o.votes.length || Vote.is(o.votes[0]))); + }, + isSDK(o: any): o is QueryVotesResponseSDKType { + return o && (o.$typeUrl === QueryVotesResponse.typeUrl || Array.isArray(o.votes) && (!o.votes.length || Vote.isSDK(o.votes[0]))); + }, + isAmino(o: any): o is QueryVotesResponseAmino { + return o && (o.$typeUrl === QueryVotesResponse.typeUrl || Array.isArray(o.votes) && (!o.votes.length || Vote.isAmino(o.votes[0]))); + }, encode(message: QueryVotesResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.votes) { Vote.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -1672,6 +1778,13 @@ export const QueryVotesResponse = { typeUrl: "/cosmos.gov.v1beta1.QueryVotesResponse", value: QueryVotesResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryVotesResponse.typeUrl)) { + return; + } + Vote.registerTypeUrl(); + PageResponse.registerTypeUrl(); } }; function createBaseQueryParamsRequest(): QueryParamsRequest { @@ -1688,6 +1801,15 @@ function createBaseQueryParamsRequest(): QueryParamsRequest { export const QueryParamsRequest = { typeUrl: "/cosmos.gov.v1beta1.QueryParamsRequest", aminoType: "cosmos-sdk/QueryParamsRequest", + is(o: any): o is QueryParamsRequest { + return o && (o.$typeUrl === QueryParamsRequest.typeUrl || typeof o.paramsType === "string"); + }, + isSDK(o: any): o is QueryParamsRequestSDKType { + return o && (o.$typeUrl === QueryParamsRequest.typeUrl || typeof o.params_type === "string"); + }, + isAmino(o: any): o is QueryParamsRequestAmino { + return o && (o.$typeUrl === QueryParamsRequest.typeUrl || typeof o.params_type === "string"); + }, encode(message: QueryParamsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.paramsType !== "") { writer.uint32(10).string(message.paramsType); @@ -1768,7 +1890,8 @@ export const QueryParamsRequest = { typeUrl: "/cosmos.gov.v1beta1.QueryParamsRequest", value: QueryParamsRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryParamsResponse(): QueryParamsResponse { return { @@ -1786,6 +1909,15 @@ function createBaseQueryParamsResponse(): QueryParamsResponse { export const QueryParamsResponse = { typeUrl: "/cosmos.gov.v1beta1.QueryParamsResponse", aminoType: "cosmos-sdk/QueryParamsResponse", + is(o: any): o is QueryParamsResponse { + return o && (o.$typeUrl === QueryParamsResponse.typeUrl || VotingParams.is(o.votingParams) && DepositParams.is(o.depositParams) && TallyParams.is(o.tallyParams)); + }, + isSDK(o: any): o is QueryParamsResponseSDKType { + return o && (o.$typeUrl === QueryParamsResponse.typeUrl || VotingParams.isSDK(o.voting_params) && DepositParams.isSDK(o.deposit_params) && TallyParams.isSDK(o.tally_params)); + }, + isAmino(o: any): o is QueryParamsResponseAmino { + return o && (o.$typeUrl === QueryParamsResponse.typeUrl || VotingParams.isAmino(o.voting_params) && DepositParams.isAmino(o.deposit_params) && TallyParams.isAmino(o.tally_params)); + }, encode(message: QueryParamsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.votingParams !== undefined) { VotingParams.encode(message.votingParams, writer.uint32(10).fork()).ldelim(); @@ -1902,6 +2034,14 @@ export const QueryParamsResponse = { typeUrl: "/cosmos.gov.v1beta1.QueryParamsResponse", value: QueryParamsResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryParamsResponse.typeUrl)) { + return; + } + VotingParams.registerTypeUrl(); + DepositParams.registerTypeUrl(); + TallyParams.registerTypeUrl(); } }; function createBaseQueryDepositRequest(): QueryDepositRequest { @@ -1919,6 +2059,15 @@ function createBaseQueryDepositRequest(): QueryDepositRequest { export const QueryDepositRequest = { typeUrl: "/cosmos.gov.v1beta1.QueryDepositRequest", aminoType: "cosmos-sdk/QueryDepositRequest", + is(o: any): o is QueryDepositRequest { + return o && (o.$typeUrl === QueryDepositRequest.typeUrl || typeof o.proposalId === "bigint" && typeof o.depositor === "string"); + }, + isSDK(o: any): o is QueryDepositRequestSDKType { + return o && (o.$typeUrl === QueryDepositRequest.typeUrl || typeof o.proposal_id === "bigint" && typeof o.depositor === "string"); + }, + isAmino(o: any): o is QueryDepositRequestAmino { + return o && (o.$typeUrl === QueryDepositRequest.typeUrl || typeof o.proposal_id === "bigint" && typeof o.depositor === "string"); + }, encode(message: QueryDepositRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.proposalId !== BigInt(0)) { writer.uint32(8).uint64(message.proposalId); @@ -2016,7 +2165,8 @@ export const QueryDepositRequest = { typeUrl: "/cosmos.gov.v1beta1.QueryDepositRequest", value: QueryDepositRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryDepositResponse(): QueryDepositResponse { return { @@ -2032,6 +2182,15 @@ function createBaseQueryDepositResponse(): QueryDepositResponse { export const QueryDepositResponse = { typeUrl: "/cosmos.gov.v1beta1.QueryDepositResponse", aminoType: "cosmos-sdk/QueryDepositResponse", + is(o: any): o is QueryDepositResponse { + return o && (o.$typeUrl === QueryDepositResponse.typeUrl || Deposit.is(o.deposit)); + }, + isSDK(o: any): o is QueryDepositResponseSDKType { + return o && (o.$typeUrl === QueryDepositResponse.typeUrl || Deposit.isSDK(o.deposit)); + }, + isAmino(o: any): o is QueryDepositResponseAmino { + return o && (o.$typeUrl === QueryDepositResponse.typeUrl || Deposit.isAmino(o.deposit)); + }, encode(message: QueryDepositResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.deposit !== undefined) { Deposit.encode(message.deposit, writer.uint32(10).fork()).ldelim(); @@ -2114,6 +2273,12 @@ export const QueryDepositResponse = { typeUrl: "/cosmos.gov.v1beta1.QueryDepositResponse", value: QueryDepositResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryDepositResponse.typeUrl)) { + return; + } + Deposit.registerTypeUrl(); } }; function createBaseQueryDepositsRequest(): QueryDepositsRequest { @@ -2131,6 +2296,15 @@ function createBaseQueryDepositsRequest(): QueryDepositsRequest { export const QueryDepositsRequest = { typeUrl: "/cosmos.gov.v1beta1.QueryDepositsRequest", aminoType: "cosmos-sdk/QueryDepositsRequest", + is(o: any): o is QueryDepositsRequest { + return o && (o.$typeUrl === QueryDepositsRequest.typeUrl || typeof o.proposalId === "bigint"); + }, + isSDK(o: any): o is QueryDepositsRequestSDKType { + return o && (o.$typeUrl === QueryDepositsRequest.typeUrl || typeof o.proposal_id === "bigint"); + }, + isAmino(o: any): o is QueryDepositsRequestAmino { + return o && (o.$typeUrl === QueryDepositsRequest.typeUrl || typeof o.proposal_id === "bigint"); + }, encode(message: QueryDepositsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.proposalId !== BigInt(0)) { writer.uint32(8).uint64(message.proposalId); @@ -2230,6 +2404,12 @@ export const QueryDepositsRequest = { typeUrl: "/cosmos.gov.v1beta1.QueryDepositsRequest", value: QueryDepositsRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryDepositsRequest.typeUrl)) { + return; + } + PageRequest.registerTypeUrl(); } }; function createBaseQueryDepositsResponse(): QueryDepositsResponse { @@ -2247,6 +2427,15 @@ function createBaseQueryDepositsResponse(): QueryDepositsResponse { export const QueryDepositsResponse = { typeUrl: "/cosmos.gov.v1beta1.QueryDepositsResponse", aminoType: "cosmos-sdk/QueryDepositsResponse", + is(o: any): o is QueryDepositsResponse { + return o && (o.$typeUrl === QueryDepositsResponse.typeUrl || Array.isArray(o.deposits) && (!o.deposits.length || Deposit.is(o.deposits[0]))); + }, + isSDK(o: any): o is QueryDepositsResponseSDKType { + return o && (o.$typeUrl === QueryDepositsResponse.typeUrl || Array.isArray(o.deposits) && (!o.deposits.length || Deposit.isSDK(o.deposits[0]))); + }, + isAmino(o: any): o is QueryDepositsResponseAmino { + return o && (o.$typeUrl === QueryDepositsResponse.typeUrl || Array.isArray(o.deposits) && (!o.deposits.length || Deposit.isAmino(o.deposits[0]))); + }, encode(message: QueryDepositsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.deposits) { Deposit.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -2354,6 +2543,13 @@ export const QueryDepositsResponse = { typeUrl: "/cosmos.gov.v1beta1.QueryDepositsResponse", value: QueryDepositsResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryDepositsResponse.typeUrl)) { + return; + } + Deposit.registerTypeUrl(); + PageResponse.registerTypeUrl(); } }; function createBaseQueryTallyResultRequest(): QueryTallyResultRequest { @@ -2370,6 +2566,15 @@ function createBaseQueryTallyResultRequest(): QueryTallyResultRequest { export const QueryTallyResultRequest = { typeUrl: "/cosmos.gov.v1beta1.QueryTallyResultRequest", aminoType: "cosmos-sdk/QueryTallyResultRequest", + is(o: any): o is QueryTallyResultRequest { + return o && (o.$typeUrl === QueryTallyResultRequest.typeUrl || typeof o.proposalId === "bigint"); + }, + isSDK(o: any): o is QueryTallyResultRequestSDKType { + return o && (o.$typeUrl === QueryTallyResultRequest.typeUrl || typeof o.proposal_id === "bigint"); + }, + isAmino(o: any): o is QueryTallyResultRequestAmino { + return o && (o.$typeUrl === QueryTallyResultRequest.typeUrl || typeof o.proposal_id === "bigint"); + }, encode(message: QueryTallyResultRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.proposalId !== BigInt(0)) { writer.uint32(8).uint64(message.proposalId); @@ -2452,7 +2657,8 @@ export const QueryTallyResultRequest = { typeUrl: "/cosmos.gov.v1beta1.QueryTallyResultRequest", value: QueryTallyResultRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryTallyResultResponse(): QueryTallyResultResponse { return { @@ -2468,6 +2674,15 @@ function createBaseQueryTallyResultResponse(): QueryTallyResultResponse { export const QueryTallyResultResponse = { typeUrl: "/cosmos.gov.v1beta1.QueryTallyResultResponse", aminoType: "cosmos-sdk/QueryTallyResultResponse", + is(o: any): o is QueryTallyResultResponse { + return o && (o.$typeUrl === QueryTallyResultResponse.typeUrl || TallyResult.is(o.tally)); + }, + isSDK(o: any): o is QueryTallyResultResponseSDKType { + return o && (o.$typeUrl === QueryTallyResultResponse.typeUrl || TallyResult.isSDK(o.tally)); + }, + isAmino(o: any): o is QueryTallyResultResponseAmino { + return o && (o.$typeUrl === QueryTallyResultResponse.typeUrl || TallyResult.isAmino(o.tally)); + }, encode(message: QueryTallyResultResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.tally !== undefined) { TallyResult.encode(message.tally, writer.uint32(10).fork()).ldelim(); @@ -2550,5 +2765,11 @@ export const QueryTallyResultResponse = { typeUrl: "/cosmos.gov.v1beta1.QueryTallyResultResponse", value: QueryTallyResultResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryTallyResultResponse.typeUrl)) { + return; + } + TallyResult.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/cosmos/gov/v1beta1/tx.registry.ts b/__fixtures__/v-next/outputv2/cosmos/gov/v1beta1/tx.registry.ts index 6941cf1967..db204fad50 100644 --- a/__fixtures__/v-next/outputv2/cosmos/gov/v1beta1/tx.registry.ts +++ b/__fixtures__/v-next/outputv2/cosmos/gov/v1beta1/tx.registry.ts @@ -1,11 +1,6 @@ -import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { TelescopeGeneratedType } from "../../../types"; import { MsgSubmitProposal, MsgVote, MsgVoteWeighted, MsgDeposit } from "./tx"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/cosmos.gov.v1beta1.MsgSubmitProposal", MsgSubmitProposal], ["/cosmos.gov.v1beta1.MsgVote", MsgVote], ["/cosmos.gov.v1beta1.MsgVoteWeighted", MsgVoteWeighted], ["/cosmos.gov.v1beta1.MsgDeposit", MsgDeposit]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/cosmos.gov.v1beta1.MsgSubmitProposal", MsgSubmitProposal], ["/cosmos.gov.v1beta1.MsgVote", MsgVote], ["/cosmos.gov.v1beta1.MsgVoteWeighted", MsgVoteWeighted], ["/cosmos.gov.v1beta1.MsgDeposit", MsgDeposit]]; export const MessageComposer = { encoded: { submitProposal(value: MsgSubmitProposal) { diff --git a/__fixtures__/v-next/outputv2/cosmos/gov/v1beta1/tx.rpc.func.ts b/__fixtures__/v-next/outputv2/cosmos/gov/v1beta1/tx.rpc.func.ts new file mode 100644 index 0000000000..e527170120 --- /dev/null +++ b/__fixtures__/v-next/outputv2/cosmos/gov/v1beta1/tx.rpc.func.ts @@ -0,0 +1,40 @@ +import { buildTx } from "../../../helper-func-types"; +import { MsgSubmitProposal, MsgVote, MsgVoteWeighted, MsgDeposit } from "./tx"; +/** + * SubmitProposal defines a method to create new proposal given a content. + * @name submitProposal + * @package cosmos.gov.v1beta1 + * @see proto service: cosmos.gov.v1beta1.SubmitProposal + */ +export const submitProposal = buildTx({ + msg: MsgSubmitProposal +}); +/** + * Vote defines a method to add a vote on a specific proposal. + * @name vote + * @package cosmos.gov.v1beta1 + * @see proto service: cosmos.gov.v1beta1.Vote + */ +export const vote = buildTx({ + msg: MsgVote +}); +/** + * VoteWeighted defines a method to add a weighted vote on a specific proposal. + * + * Since: cosmos-sdk 0.43 + * @name voteWeighted + * @package cosmos.gov.v1beta1 + * @see proto service: cosmos.gov.v1beta1.VoteWeighted + */ +export const voteWeighted = buildTx({ + msg: MsgVoteWeighted +}); +/** + * Deposit defines a method to add deposit on a specific proposal. + * @name deposit + * @package cosmos.gov.v1beta1 + * @see proto service: cosmos.gov.v1beta1.Deposit + */ +export const deposit = buildTx({ + msg: MsgDeposit +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/cosmos/gov/v1beta1/tx.ts b/__fixtures__/v-next/outputv2/cosmos/gov/v1beta1/tx.ts index 722b4db344..a7126b8f05 100644 --- a/__fixtures__/v-next/outputv2/cosmos/gov/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputv2/cosmos/gov/v1beta1/tx.ts @@ -6,6 +6,7 @@ import { ClientUpdateProposal, ClientUpdateProposalProtoMsg, ClientUpdateProposa import { ReplacePoolIncentivesProposal, ReplacePoolIncentivesProposalProtoMsg, ReplacePoolIncentivesProposalSDKType, UpdatePoolIncentivesProposal, UpdatePoolIncentivesProposalProtoMsg, UpdatePoolIncentivesProposalSDKType } from "../../../osmosis/pool-incentives/v1beta1/gov"; import { UpdateFeeTokenProposal, UpdateFeeTokenProposalProtoMsg, UpdateFeeTokenProposalSDKType } from "../../../osmosis/txfees/v1beta1/gov"; import { BinaryReader, BinaryWriter } from "../../../binary"; +import { GlobalDecoderRegistry } from "../../../registry"; import { isSet, DeepPartial } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "cosmos.gov.v1beta1"; @@ -330,9 +331,18 @@ function createBaseMsgSubmitProposal(): MsgSubmitProposal { export const MsgSubmitProposal = { typeUrl: "/cosmos.gov.v1beta1.MsgSubmitProposal", aminoType: "cosmos-sdk/MsgSubmitProposal", + is(o: any): o is MsgSubmitProposal { + return o && (o.$typeUrl === MsgSubmitProposal.typeUrl || Array.isArray(o.initialDeposit) && (!o.initialDeposit.length || Coin.is(o.initialDeposit[0])) && typeof o.proposer === "string"); + }, + isSDK(o: any): o is MsgSubmitProposalSDKType { + return o && (o.$typeUrl === MsgSubmitProposal.typeUrl || Array.isArray(o.initial_deposit) && (!o.initial_deposit.length || Coin.isSDK(o.initial_deposit[0])) && typeof o.proposer === "string"); + }, + isAmino(o: any): o is MsgSubmitProposalAmino { + return o && (o.$typeUrl === MsgSubmitProposal.typeUrl || Array.isArray(o.initial_deposit) && (!o.initial_deposit.length || Coin.isAmino(o.initial_deposit[0])) && typeof o.proposer === "string"); + }, encode(message: MsgSubmitProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.content !== undefined) { - Any.encode((message.content as Any), writer.uint32(10).fork()).ldelim(); + Any.encode(GlobalDecoderRegistry.wrapAny(message.content), writer.uint32(10).fork()).ldelim(); } for (const v of message.initialDeposit) { Coin.encode(v!, writer.uint32(18).fork()).ldelim(); @@ -350,7 +360,7 @@ export const MsgSubmitProposal = { const tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.content = (ProposalContentI_InterfaceDecoder(reader) as Any); + message.content = GlobalDecoderRegistry.unwrapAny(reader); break; case 2: message.initialDeposit.push(Coin.decode(reader, reader.uint32())); @@ -367,14 +377,14 @@ export const MsgSubmitProposal = { }, fromJSON(object: any): MsgSubmitProposal { const obj = createBaseMsgSubmitProposal(); - if (isSet(object.content)) obj.content = Any.fromJSON(object.content); + if (isSet(object.content)) obj.content = GlobalDecoderRegistry.fromJSON(object.content); if (Array.isArray(object?.initialDeposit)) obj.initialDeposit = object.initialDeposit.map((e: any) => Coin.fromJSON(e)); if (isSet(object.proposer)) obj.proposer = String(object.proposer); return obj; }, toJSON(message: MsgSubmitProposal): JsonSafe { const obj: any = {}; - message.content !== undefined && (obj.content = message.content ? Any.toJSON(message.content) : undefined); + message.content !== undefined && (obj.content = message.content ? GlobalDecoderRegistry.toJSON(message.content) : undefined); if (message.initialDeposit) { obj.initialDeposit = message.initialDeposit.map(e => e ? Coin.toJSON(e) : undefined); } else { @@ -386,7 +396,7 @@ export const MsgSubmitProposal = { fromPartial(object: DeepPartial): MsgSubmitProposal { const message = createBaseMsgSubmitProposal(); if (object.content !== undefined && object.content !== null) { - message.content = Any.fromPartial(object.content); + message.content = GlobalDecoderRegistry.fromPartial(object.content); } message.initialDeposit = object.initialDeposit?.map(e => Coin.fromPartial(e)) || []; message.proposer = object.proposer ?? ""; @@ -394,14 +404,14 @@ export const MsgSubmitProposal = { }, fromSDK(object: MsgSubmitProposalSDKType): MsgSubmitProposal { return { - content: object.content ? Any.fromSDK(object.content) : undefined, + content: object.content ? GlobalDecoderRegistry.fromSDK(object.content) : undefined, initialDeposit: Array.isArray(object?.initial_deposit) ? object.initial_deposit.map((e: any) => Coin.fromSDK(e)) : [], proposer: object?.proposer }; }, toSDK(message: MsgSubmitProposal): MsgSubmitProposalSDKType { const obj: any = {}; - message.content !== undefined && (obj.content = message.content ? Any.toSDK(message.content) : undefined); + message.content !== undefined && (obj.content = message.content ? GlobalDecoderRegistry.toSDK(message.content) : undefined); if (message.initialDeposit) { obj.initial_deposit = message.initialDeposit.map(e => e ? Coin.toSDK(e) : undefined); } else { @@ -413,7 +423,7 @@ export const MsgSubmitProposal = { fromAmino(object: MsgSubmitProposalAmino): MsgSubmitProposal { const message = createBaseMsgSubmitProposal(); if (object.content !== undefined && object.content !== null) { - message.content = ProposalContentI_FromAmino(object.content); + message.content = GlobalDecoderRegistry.fromAminoMsg(object.content); } message.initialDeposit = object.initial_deposit?.map(e => Coin.fromAmino(e)) || []; if (object.proposer !== undefined && object.proposer !== null) { @@ -423,7 +433,7 @@ export const MsgSubmitProposal = { }, toAmino(message: MsgSubmitProposal): MsgSubmitProposalAmino { const obj: any = {}; - obj.content = message.content ? ProposalContentI_ToAmino((message.content as Any)) : undefined; + obj.content = message.content ? GlobalDecoderRegistry.toAminoMsg(message.content) : undefined; if (message.initialDeposit) { obj.initial_deposit = message.initialDeposit.map(e => e ? Coin.toAmino(e) : undefined); } else { @@ -452,6 +462,19 @@ export const MsgSubmitProposal = { typeUrl: "/cosmos.gov.v1beta1.MsgSubmitProposal", value: MsgSubmitProposal.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgSubmitProposal.typeUrl)) { + return; + } + TextProposal.registerTypeUrl(); + RegisterIncentiveProposal.registerTypeUrl(); + ClientUpdateProposal.registerTypeUrl(); + UpgradeProposal.registerTypeUrl(); + ReplacePoolIncentivesProposal.registerTypeUrl(); + UpdatePoolIncentivesProposal.registerTypeUrl(); + UpdateFeeTokenProposal.registerTypeUrl(); + Coin.registerTypeUrl(); } }; function createBaseMsgSubmitProposalResponse(): MsgSubmitProposalResponse { @@ -468,6 +491,15 @@ function createBaseMsgSubmitProposalResponse(): MsgSubmitProposalResponse { export const MsgSubmitProposalResponse = { typeUrl: "/cosmos.gov.v1beta1.MsgSubmitProposalResponse", aminoType: "cosmos-sdk/MsgSubmitProposalResponse", + is(o: any): o is MsgSubmitProposalResponse { + return o && (o.$typeUrl === MsgSubmitProposalResponse.typeUrl || typeof o.proposalId === "bigint"); + }, + isSDK(o: any): o is MsgSubmitProposalResponseSDKType { + return o && (o.$typeUrl === MsgSubmitProposalResponse.typeUrl || typeof o.proposal_id === "bigint"); + }, + isAmino(o: any): o is MsgSubmitProposalResponseAmino { + return o && (o.$typeUrl === MsgSubmitProposalResponse.typeUrl || typeof o.proposal_id === "bigint"); + }, encode(message: MsgSubmitProposalResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.proposalId !== BigInt(0)) { writer.uint32(8).uint64(message.proposalId); @@ -550,7 +582,8 @@ export const MsgSubmitProposalResponse = { typeUrl: "/cosmos.gov.v1beta1.MsgSubmitProposalResponse", value: MsgSubmitProposalResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgVote(): MsgVote { return { @@ -568,6 +601,15 @@ function createBaseMsgVote(): MsgVote { export const MsgVote = { typeUrl: "/cosmos.gov.v1beta1.MsgVote", aminoType: "cosmos-sdk/MsgVote", + is(o: any): o is MsgVote { + return o && (o.$typeUrl === MsgVote.typeUrl || typeof o.proposalId === "bigint" && typeof o.voter === "string" && isSet(o.option)); + }, + isSDK(o: any): o is MsgVoteSDKType { + return o && (o.$typeUrl === MsgVote.typeUrl || typeof o.proposal_id === "bigint" && typeof o.voter === "string" && isSet(o.option)); + }, + isAmino(o: any): o is MsgVoteAmino { + return o && (o.$typeUrl === MsgVote.typeUrl || typeof o.proposal_id === "bigint" && typeof o.voter === "string" && isSet(o.option)); + }, encode(message: MsgVote, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.proposalId !== BigInt(0)) { writer.uint32(8).uint64(message.proposalId); @@ -680,7 +722,8 @@ export const MsgVote = { typeUrl: "/cosmos.gov.v1beta1.MsgVote", value: MsgVote.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgVoteResponse(): MsgVoteResponse { return {}; @@ -694,6 +737,15 @@ function createBaseMsgVoteResponse(): MsgVoteResponse { export const MsgVoteResponse = { typeUrl: "/cosmos.gov.v1beta1.MsgVoteResponse", aminoType: "cosmos-sdk/MsgVoteResponse", + is(o: any): o is MsgVoteResponse { + return o && o.$typeUrl === MsgVoteResponse.typeUrl; + }, + isSDK(o: any): o is MsgVoteResponseSDKType { + return o && o.$typeUrl === MsgVoteResponse.typeUrl; + }, + isAmino(o: any): o is MsgVoteResponseAmino { + return o && o.$typeUrl === MsgVoteResponse.typeUrl; + }, encode(_: MsgVoteResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -758,7 +810,8 @@ export const MsgVoteResponse = { typeUrl: "/cosmos.gov.v1beta1.MsgVoteResponse", value: MsgVoteResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgVoteWeighted(): MsgVoteWeighted { return { @@ -778,6 +831,15 @@ function createBaseMsgVoteWeighted(): MsgVoteWeighted { export const MsgVoteWeighted = { typeUrl: "/cosmos.gov.v1beta1.MsgVoteWeighted", aminoType: "cosmos-sdk/MsgVoteWeighted", + is(o: any): o is MsgVoteWeighted { + return o && (o.$typeUrl === MsgVoteWeighted.typeUrl || typeof o.proposalId === "bigint" && typeof o.voter === "string" && Array.isArray(o.options) && (!o.options.length || WeightedVoteOption.is(o.options[0]))); + }, + isSDK(o: any): o is MsgVoteWeightedSDKType { + return o && (o.$typeUrl === MsgVoteWeighted.typeUrl || typeof o.proposal_id === "bigint" && typeof o.voter === "string" && Array.isArray(o.options) && (!o.options.length || WeightedVoteOption.isSDK(o.options[0]))); + }, + isAmino(o: any): o is MsgVoteWeightedAmino { + return o && (o.$typeUrl === MsgVoteWeighted.typeUrl || typeof o.proposal_id === "bigint" && typeof o.voter === "string" && Array.isArray(o.options) && (!o.options.length || WeightedVoteOption.isAmino(o.options[0]))); + }, encode(message: MsgVoteWeighted, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.proposalId !== BigInt(0)) { writer.uint32(8).uint64(message.proposalId); @@ -900,6 +962,12 @@ export const MsgVoteWeighted = { typeUrl: "/cosmos.gov.v1beta1.MsgVoteWeighted", value: MsgVoteWeighted.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgVoteWeighted.typeUrl)) { + return; + } + WeightedVoteOption.registerTypeUrl(); } }; function createBaseMsgVoteWeightedResponse(): MsgVoteWeightedResponse { @@ -916,6 +984,15 @@ function createBaseMsgVoteWeightedResponse(): MsgVoteWeightedResponse { export const MsgVoteWeightedResponse = { typeUrl: "/cosmos.gov.v1beta1.MsgVoteWeightedResponse", aminoType: "cosmos-sdk/MsgVoteWeightedResponse", + is(o: any): o is MsgVoteWeightedResponse { + return o && o.$typeUrl === MsgVoteWeightedResponse.typeUrl; + }, + isSDK(o: any): o is MsgVoteWeightedResponseSDKType { + return o && o.$typeUrl === MsgVoteWeightedResponse.typeUrl; + }, + isAmino(o: any): o is MsgVoteWeightedResponseAmino { + return o && o.$typeUrl === MsgVoteWeightedResponse.typeUrl; + }, encode(_: MsgVoteWeightedResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -980,7 +1057,8 @@ export const MsgVoteWeightedResponse = { typeUrl: "/cosmos.gov.v1beta1.MsgVoteWeightedResponse", value: MsgVoteWeightedResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgDeposit(): MsgDeposit { return { @@ -998,6 +1076,15 @@ function createBaseMsgDeposit(): MsgDeposit { export const MsgDeposit = { typeUrl: "/cosmos.gov.v1beta1.MsgDeposit", aminoType: "cosmos-sdk/MsgDeposit", + is(o: any): o is MsgDeposit { + return o && (o.$typeUrl === MsgDeposit.typeUrl || typeof o.proposalId === "bigint" && typeof o.depositor === "string" && Array.isArray(o.amount) && (!o.amount.length || Coin.is(o.amount[0]))); + }, + isSDK(o: any): o is MsgDepositSDKType { + return o && (o.$typeUrl === MsgDeposit.typeUrl || typeof o.proposal_id === "bigint" && typeof o.depositor === "string" && Array.isArray(o.amount) && (!o.amount.length || Coin.isSDK(o.amount[0]))); + }, + isAmino(o: any): o is MsgDepositAmino { + return o && (o.$typeUrl === MsgDeposit.typeUrl || typeof o.proposal_id === "bigint" && typeof o.depositor === "string" && Array.isArray(o.amount) && (!o.amount.length || Coin.isAmino(o.amount[0]))); + }, encode(message: MsgDeposit, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.proposalId !== BigInt(0)) { writer.uint32(8).uint64(message.proposalId); @@ -1120,6 +1207,12 @@ export const MsgDeposit = { typeUrl: "/cosmos.gov.v1beta1.MsgDeposit", value: MsgDeposit.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgDeposit.typeUrl)) { + return; + } + Coin.registerTypeUrl(); } }; function createBaseMsgDepositResponse(): MsgDepositResponse { @@ -1134,6 +1227,15 @@ function createBaseMsgDepositResponse(): MsgDepositResponse { export const MsgDepositResponse = { typeUrl: "/cosmos.gov.v1beta1.MsgDepositResponse", aminoType: "cosmos-sdk/MsgDepositResponse", + is(o: any): o is MsgDepositResponse { + return o && o.$typeUrl === MsgDepositResponse.typeUrl; + }, + isSDK(o: any): o is MsgDepositResponseSDKType { + return o && o.$typeUrl === MsgDepositResponse.typeUrl; + }, + isAmino(o: any): o is MsgDepositResponseAmino { + return o && o.$typeUrl === MsgDepositResponse.typeUrl; + }, encode(_: MsgDepositResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -1198,109 +1300,6 @@ export const MsgDepositResponse = { typeUrl: "/cosmos.gov.v1beta1.MsgDepositResponse", value: MsgDepositResponse.encode(message).finish() }; - } -}; -export const ProposalContentI_InterfaceDecoder = (input: BinaryReader | Uint8Array): TextProposal | RegisterIncentiveProposal | ClientUpdateProposal | UpgradeProposal | ReplacePoolIncentivesProposal | UpdatePoolIncentivesProposal | UpdateFeeTokenProposal | Any => { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - const data = Any.decode(reader, reader.uint32()); - switch (data.typeUrl) { - case "/cosmos.gov.v1beta1.TextProposal": - return TextProposal.decode(data.value); - case "/evmos.incentives.v1.RegisterIncentiveProposal": - return RegisterIncentiveProposal.decode(data.value); - case "/ibc.core.client.v1.ClientUpdateProposal": - return ClientUpdateProposal.decode(data.value); - case "/ibc.core.client.v1.UpgradeProposal": - return UpgradeProposal.decode(data.value); - case "/osmosis.poolincentives.v1beta1.ReplacePoolIncentivesProposal": - return ReplacePoolIncentivesProposal.decode(data.value); - case "/osmosis.poolincentives.v1beta1.UpdatePoolIncentivesProposal": - return UpdatePoolIncentivesProposal.decode(data.value); - case "/osmosis.txfees.v1beta1.UpdateFeeTokenProposal": - return UpdateFeeTokenProposal.decode(data.value); - default: - return data; - } -}; -export const ProposalContentI_FromAmino = (content: AnyAmino): Any => { - switch (content.type) { - case "cosmos-sdk/TextProposal": - return Any.fromPartial({ - typeUrl: "/cosmos.gov.v1beta1.TextProposal", - value: TextProposal.encode(TextProposal.fromPartial(TextProposal.fromAmino(content.value))).finish() - }); - case "/evmos.incentives.v1.RegisterIncentiveProposal": - return Any.fromPartial({ - typeUrl: "/evmos.incentives.v1.RegisterIncentiveProposal", - value: RegisterIncentiveProposal.encode(RegisterIncentiveProposal.fromPartial(RegisterIncentiveProposal.fromAmino(content.value))).finish() - }); - case "cosmos-sdk/ClientUpdateProposal": - return Any.fromPartial({ - typeUrl: "/ibc.core.client.v1.ClientUpdateProposal", - value: ClientUpdateProposal.encode(ClientUpdateProposal.fromPartial(ClientUpdateProposal.fromAmino(content.value))).finish() - }); - case "cosmos-sdk/UpgradeProposal": - return Any.fromPartial({ - typeUrl: "/ibc.core.client.v1.UpgradeProposal", - value: UpgradeProposal.encode(UpgradeProposal.fromPartial(UpgradeProposal.fromAmino(content.value))).finish() - }); - case "osmosis/poolincentives/replace-pool-incentives-proposal": - return Any.fromPartial({ - typeUrl: "/osmosis.poolincentives.v1beta1.ReplacePoolIncentivesProposal", - value: ReplacePoolIncentivesProposal.encode(ReplacePoolIncentivesProposal.fromPartial(ReplacePoolIncentivesProposal.fromAmino(content.value))).finish() - }); - case "osmosis/poolincentives/update-pool-incentives-proposal": - return Any.fromPartial({ - typeUrl: "/osmosis.poolincentives.v1beta1.UpdatePoolIncentivesProposal", - value: UpdatePoolIncentivesProposal.encode(UpdatePoolIncentivesProposal.fromPartial(UpdatePoolIncentivesProposal.fromAmino(content.value))).finish() - }); - case "osmosis/txfees/update-fee-token-proposal": - return Any.fromPartial({ - typeUrl: "/osmosis.txfees.v1beta1.UpdateFeeTokenProposal", - value: UpdateFeeTokenProposal.encode(UpdateFeeTokenProposal.fromPartial(UpdateFeeTokenProposal.fromAmino(content.value))).finish() - }); - default: - return Any.fromAmino(content); - } -}; -export const ProposalContentI_ToAmino = (content: Any) => { - switch (content.typeUrl) { - case "/cosmos.gov.v1beta1.TextProposal": - return { - type: "cosmos-sdk/TextProposal", - value: TextProposal.toAmino(TextProposal.decode(content.value, undefined)) - }; - case "/evmos.incentives.v1.RegisterIncentiveProposal": - return { - type: "/evmos.incentives.v1.RegisterIncentiveProposal", - value: RegisterIncentiveProposal.toAmino(RegisterIncentiveProposal.decode(content.value, undefined)) - }; - case "/ibc.core.client.v1.ClientUpdateProposal": - return { - type: "cosmos-sdk/ClientUpdateProposal", - value: ClientUpdateProposal.toAmino(ClientUpdateProposal.decode(content.value, undefined)) - }; - case "/ibc.core.client.v1.UpgradeProposal": - return { - type: "cosmos-sdk/UpgradeProposal", - value: UpgradeProposal.toAmino(UpgradeProposal.decode(content.value, undefined)) - }; - case "/osmosis.poolincentives.v1beta1.ReplacePoolIncentivesProposal": - return { - type: "osmosis/poolincentives/replace-pool-incentives-proposal", - value: ReplacePoolIncentivesProposal.toAmino(ReplacePoolIncentivesProposal.decode(content.value, undefined)) - }; - case "/osmosis.poolincentives.v1beta1.UpdatePoolIncentivesProposal": - return { - type: "osmosis/poolincentives/update-pool-incentives-proposal", - value: UpdatePoolIncentivesProposal.toAmino(UpdatePoolIncentivesProposal.decode(content.value, undefined)) - }; - case "/osmosis.txfees.v1beta1.UpdateFeeTokenProposal": - return { - type: "osmosis/txfees/update-fee-token-proposal", - value: UpdateFeeTokenProposal.toAmino(UpdateFeeTokenProposal.decode(content.value, undefined)) - }; - default: - return Any.toAmino(content); - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/cosmos/group/v1/events.ts b/__fixtures__/v-next/outputv2/cosmos/group/v1/events.ts index edae500154..1183cc1785 100644 --- a/__fixtures__/v-next/outputv2/cosmos/group/v1/events.ts +++ b/__fixtures__/v-next/outputv2/cosmos/group/v1/events.ts @@ -404,6 +404,15 @@ function createBaseEventCreateGroup(): EventCreateGroup { export const EventCreateGroup = { typeUrl: "/cosmos.group.v1.EventCreateGroup", aminoType: "cosmos-sdk/EventCreateGroup", + is(o: any): o is EventCreateGroup { + return o && (o.$typeUrl === EventCreateGroup.typeUrl || typeof o.groupId === "bigint"); + }, + isSDK(o: any): o is EventCreateGroupSDKType { + return o && (o.$typeUrl === EventCreateGroup.typeUrl || typeof o.group_id === "bigint"); + }, + isAmino(o: any): o is EventCreateGroupAmino { + return o && (o.$typeUrl === EventCreateGroup.typeUrl || typeof o.group_id === "bigint"); + }, encode(message: EventCreateGroup, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.groupId !== BigInt(0)) { writer.uint32(8).uint64(message.groupId); @@ -486,7 +495,8 @@ export const EventCreateGroup = { typeUrl: "/cosmos.group.v1.EventCreateGroup", value: EventCreateGroup.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseEventUpdateGroup(): EventUpdateGroup { return { @@ -502,6 +512,15 @@ function createBaseEventUpdateGroup(): EventUpdateGroup { export const EventUpdateGroup = { typeUrl: "/cosmos.group.v1.EventUpdateGroup", aminoType: "cosmos-sdk/EventUpdateGroup", + is(o: any): o is EventUpdateGroup { + return o && (o.$typeUrl === EventUpdateGroup.typeUrl || typeof o.groupId === "bigint"); + }, + isSDK(o: any): o is EventUpdateGroupSDKType { + return o && (o.$typeUrl === EventUpdateGroup.typeUrl || typeof o.group_id === "bigint"); + }, + isAmino(o: any): o is EventUpdateGroupAmino { + return o && (o.$typeUrl === EventUpdateGroup.typeUrl || typeof o.group_id === "bigint"); + }, encode(message: EventUpdateGroup, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.groupId !== BigInt(0)) { writer.uint32(8).uint64(message.groupId); @@ -584,7 +603,8 @@ export const EventUpdateGroup = { typeUrl: "/cosmos.group.v1.EventUpdateGroup", value: EventUpdateGroup.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseEventCreateGroupPolicy(): EventCreateGroupPolicy { return { @@ -600,6 +620,15 @@ function createBaseEventCreateGroupPolicy(): EventCreateGroupPolicy { export const EventCreateGroupPolicy = { typeUrl: "/cosmos.group.v1.EventCreateGroupPolicy", aminoType: "cosmos-sdk/EventCreateGroupPolicy", + is(o: any): o is EventCreateGroupPolicy { + return o && (o.$typeUrl === EventCreateGroupPolicy.typeUrl || typeof o.address === "string"); + }, + isSDK(o: any): o is EventCreateGroupPolicySDKType { + return o && (o.$typeUrl === EventCreateGroupPolicy.typeUrl || typeof o.address === "string"); + }, + isAmino(o: any): o is EventCreateGroupPolicyAmino { + return o && (o.$typeUrl === EventCreateGroupPolicy.typeUrl || typeof o.address === "string"); + }, encode(message: EventCreateGroupPolicy, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.address !== "") { writer.uint32(10).string(message.address); @@ -680,7 +709,8 @@ export const EventCreateGroupPolicy = { typeUrl: "/cosmos.group.v1.EventCreateGroupPolicy", value: EventCreateGroupPolicy.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseEventUpdateGroupPolicy(): EventUpdateGroupPolicy { return { @@ -696,6 +726,15 @@ function createBaseEventUpdateGroupPolicy(): EventUpdateGroupPolicy { export const EventUpdateGroupPolicy = { typeUrl: "/cosmos.group.v1.EventUpdateGroupPolicy", aminoType: "cosmos-sdk/EventUpdateGroupPolicy", + is(o: any): o is EventUpdateGroupPolicy { + return o && (o.$typeUrl === EventUpdateGroupPolicy.typeUrl || typeof o.address === "string"); + }, + isSDK(o: any): o is EventUpdateGroupPolicySDKType { + return o && (o.$typeUrl === EventUpdateGroupPolicy.typeUrl || typeof o.address === "string"); + }, + isAmino(o: any): o is EventUpdateGroupPolicyAmino { + return o && (o.$typeUrl === EventUpdateGroupPolicy.typeUrl || typeof o.address === "string"); + }, encode(message: EventUpdateGroupPolicy, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.address !== "") { writer.uint32(10).string(message.address); @@ -776,7 +815,8 @@ export const EventUpdateGroupPolicy = { typeUrl: "/cosmos.group.v1.EventUpdateGroupPolicy", value: EventUpdateGroupPolicy.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseEventSubmitProposal(): EventSubmitProposal { return { @@ -792,6 +832,15 @@ function createBaseEventSubmitProposal(): EventSubmitProposal { export const EventSubmitProposal = { typeUrl: "/cosmos.group.v1.EventSubmitProposal", aminoType: "cosmos-sdk/EventSubmitProposal", + is(o: any): o is EventSubmitProposal { + return o && (o.$typeUrl === EventSubmitProposal.typeUrl || typeof o.proposalId === "bigint"); + }, + isSDK(o: any): o is EventSubmitProposalSDKType { + return o && (o.$typeUrl === EventSubmitProposal.typeUrl || typeof o.proposal_id === "bigint"); + }, + isAmino(o: any): o is EventSubmitProposalAmino { + return o && (o.$typeUrl === EventSubmitProposal.typeUrl || typeof o.proposal_id === "bigint"); + }, encode(message: EventSubmitProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.proposalId !== BigInt(0)) { writer.uint32(8).uint64(message.proposalId); @@ -874,7 +923,8 @@ export const EventSubmitProposal = { typeUrl: "/cosmos.group.v1.EventSubmitProposal", value: EventSubmitProposal.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseEventWithdrawProposal(): EventWithdrawProposal { return { @@ -890,6 +940,15 @@ function createBaseEventWithdrawProposal(): EventWithdrawProposal { export const EventWithdrawProposal = { typeUrl: "/cosmos.group.v1.EventWithdrawProposal", aminoType: "cosmos-sdk/EventWithdrawProposal", + is(o: any): o is EventWithdrawProposal { + return o && (o.$typeUrl === EventWithdrawProposal.typeUrl || typeof o.proposalId === "bigint"); + }, + isSDK(o: any): o is EventWithdrawProposalSDKType { + return o && (o.$typeUrl === EventWithdrawProposal.typeUrl || typeof o.proposal_id === "bigint"); + }, + isAmino(o: any): o is EventWithdrawProposalAmino { + return o && (o.$typeUrl === EventWithdrawProposal.typeUrl || typeof o.proposal_id === "bigint"); + }, encode(message: EventWithdrawProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.proposalId !== BigInt(0)) { writer.uint32(8).uint64(message.proposalId); @@ -972,7 +1031,8 @@ export const EventWithdrawProposal = { typeUrl: "/cosmos.group.v1.EventWithdrawProposal", value: EventWithdrawProposal.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseEventVote(): EventVote { return { @@ -988,6 +1048,15 @@ function createBaseEventVote(): EventVote { export const EventVote = { typeUrl: "/cosmos.group.v1.EventVote", aminoType: "cosmos-sdk/EventVote", + is(o: any): o is EventVote { + return o && (o.$typeUrl === EventVote.typeUrl || typeof o.proposalId === "bigint"); + }, + isSDK(o: any): o is EventVoteSDKType { + return o && (o.$typeUrl === EventVote.typeUrl || typeof o.proposal_id === "bigint"); + }, + isAmino(o: any): o is EventVoteAmino { + return o && (o.$typeUrl === EventVote.typeUrl || typeof o.proposal_id === "bigint"); + }, encode(message: EventVote, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.proposalId !== BigInt(0)) { writer.uint32(8).uint64(message.proposalId); @@ -1070,7 +1139,8 @@ export const EventVote = { typeUrl: "/cosmos.group.v1.EventVote", value: EventVote.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseEventExec(): EventExec { return { @@ -1087,6 +1157,15 @@ function createBaseEventExec(): EventExec { export const EventExec = { typeUrl: "/cosmos.group.v1.EventExec", aminoType: "cosmos-sdk/EventExec", + is(o: any): o is EventExec { + return o && (o.$typeUrl === EventExec.typeUrl || typeof o.proposalId === "bigint" && isSet(o.result)); + }, + isSDK(o: any): o is EventExecSDKType { + return o && (o.$typeUrl === EventExec.typeUrl || typeof o.proposal_id === "bigint" && isSet(o.result)); + }, + isAmino(o: any): o is EventExecAmino { + return o && (o.$typeUrl === EventExec.typeUrl || typeof o.proposal_id === "bigint" && isSet(o.result)); + }, encode(message: EventExec, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.proposalId !== BigInt(0)) { writer.uint32(8).uint64(message.proposalId); @@ -1184,7 +1263,8 @@ export const EventExec = { typeUrl: "/cosmos.group.v1.EventExec", value: EventExec.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseEventLeaveGroup(): EventLeaveGroup { return { @@ -1201,6 +1281,15 @@ function createBaseEventLeaveGroup(): EventLeaveGroup { export const EventLeaveGroup = { typeUrl: "/cosmos.group.v1.EventLeaveGroup", aminoType: "cosmos-sdk/EventLeaveGroup", + is(o: any): o is EventLeaveGroup { + return o && (o.$typeUrl === EventLeaveGroup.typeUrl || typeof o.groupId === "bigint" && typeof o.address === "string"); + }, + isSDK(o: any): o is EventLeaveGroupSDKType { + return o && (o.$typeUrl === EventLeaveGroup.typeUrl || typeof o.group_id === "bigint" && typeof o.address === "string"); + }, + isAmino(o: any): o is EventLeaveGroupAmino { + return o && (o.$typeUrl === EventLeaveGroup.typeUrl || typeof o.group_id === "bigint" && typeof o.address === "string"); + }, encode(message: EventLeaveGroup, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.groupId !== BigInt(0)) { writer.uint32(8).uint64(message.groupId); @@ -1298,5 +1387,6 @@ export const EventLeaveGroup = { typeUrl: "/cosmos.group.v1.EventLeaveGroup", value: EventLeaveGroup.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/cosmos/group/v1/genesis.ts b/__fixtures__/v-next/outputv2/cosmos/group/v1/genesis.ts index dbed76f739..ddb7bf804e 100644 --- a/__fixtures__/v-next/outputv2/cosmos/group/v1/genesis.ts +++ b/__fixtures__/v-next/outputv2/cosmos/group/v1/genesis.ts @@ -2,6 +2,7 @@ import { GroupInfo, GroupInfoAmino, GroupInfoSDKType, GroupMember, GroupMemberAm import { BinaryReader, BinaryWriter } from "../../../binary"; import { isSet, DeepPartial } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "cosmos.group.v1"; /** * GenesisState defines the group module's genesis state. @@ -134,6 +135,15 @@ function createBaseGenesisState(): GenesisState { export const GenesisState = { typeUrl: "/cosmos.group.v1.GenesisState", aminoType: "cosmos-sdk/GenesisState", + is(o: any): o is GenesisState { + return o && (o.$typeUrl === GenesisState.typeUrl || typeof o.groupSeq === "bigint" && Array.isArray(o.groups) && (!o.groups.length || GroupInfo.is(o.groups[0])) && Array.isArray(o.groupMembers) && (!o.groupMembers.length || GroupMember.is(o.groupMembers[0])) && typeof o.groupPolicySeq === "bigint" && Array.isArray(o.groupPolicies) && (!o.groupPolicies.length || GroupPolicyInfo.is(o.groupPolicies[0])) && typeof o.proposalSeq === "bigint" && Array.isArray(o.proposals) && (!o.proposals.length || Proposal.is(o.proposals[0])) && Array.isArray(o.votes) && (!o.votes.length || Vote.is(o.votes[0]))); + }, + isSDK(o: any): o is GenesisStateSDKType { + return o && (o.$typeUrl === GenesisState.typeUrl || typeof o.group_seq === "bigint" && Array.isArray(o.groups) && (!o.groups.length || GroupInfo.isSDK(o.groups[0])) && Array.isArray(o.group_members) && (!o.group_members.length || GroupMember.isSDK(o.group_members[0])) && typeof o.group_policy_seq === "bigint" && Array.isArray(o.group_policies) && (!o.group_policies.length || GroupPolicyInfo.isSDK(o.group_policies[0])) && typeof o.proposal_seq === "bigint" && Array.isArray(o.proposals) && (!o.proposals.length || Proposal.isSDK(o.proposals[0])) && Array.isArray(o.votes) && (!o.votes.length || Vote.isSDK(o.votes[0]))); + }, + isAmino(o: any): o is GenesisStateAmino { + return o && (o.$typeUrl === GenesisState.typeUrl || typeof o.group_seq === "bigint" && Array.isArray(o.groups) && (!o.groups.length || GroupInfo.isAmino(o.groups[0])) && Array.isArray(o.group_members) && (!o.group_members.length || GroupMember.isAmino(o.group_members[0])) && typeof o.group_policy_seq === "bigint" && Array.isArray(o.group_policies) && (!o.group_policies.length || GroupPolicyInfo.isAmino(o.group_policies[0])) && typeof o.proposal_seq === "bigint" && Array.isArray(o.proposals) && (!o.proposals.length || Proposal.isAmino(o.proposals[0])) && Array.isArray(o.votes) && (!o.votes.length || Vote.isAmino(o.votes[0]))); + }, encode(message: GenesisState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.groupSeq !== BigInt(0)) { writer.uint32(8).uint64(message.groupSeq); @@ -375,5 +385,15 @@ export const GenesisState = { typeUrl: "/cosmos.group.v1.GenesisState", value: GenesisState.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GenesisState.typeUrl)) { + return; + } + GroupInfo.registerTypeUrl(); + GroupMember.registerTypeUrl(); + GroupPolicyInfo.registerTypeUrl(); + Proposal.registerTypeUrl(); + Vote.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/cosmos/group/v1/query.rpc.func.ts b/__fixtures__/v-next/outputv2/cosmos/group/v1/query.rpc.func.ts new file mode 100644 index 0000000000..2f2ded17c7 --- /dev/null +++ b/__fixtures__/v-next/outputv2/cosmos/group/v1/query.rpc.func.ts @@ -0,0 +1,171 @@ +import { buildQuery } from "../../../helper-func-types"; +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"; +/** + * GroupInfo queries group info based on group id. + * @name getGroupInfo + * @package cosmos.group.v1 + * @see proto service: cosmos.group.v1.GroupInfo + */ +export const getGroupInfo = buildQuery({ + encode: QueryGroupInfoRequest.encode, + decode: QueryGroupInfoResponse.decode, + service: "cosmos.group.v1.Query", + method: "GroupInfo", + deps: [QueryGroupInfoRequest, QueryGroupInfoResponse] +}); +/** + * GroupPolicyInfo queries group policy info based on account address of group policy. + * @name getGroupPolicyInfo + * @package cosmos.group.v1 + * @see proto service: cosmos.group.v1.GroupPolicyInfo + */ +export const getGroupPolicyInfo = buildQuery({ + encode: QueryGroupPolicyInfoRequest.encode, + decode: QueryGroupPolicyInfoResponse.decode, + service: "cosmos.group.v1.Query", + method: "GroupPolicyInfo", + deps: [QueryGroupPolicyInfoRequest, QueryGroupPolicyInfoResponse] +}); +/** + * GroupMembers queries members of a group + * @name getGroupMembers + * @package cosmos.group.v1 + * @see proto service: cosmos.group.v1.GroupMembers + */ +export const getGroupMembers = buildQuery({ + encode: QueryGroupMembersRequest.encode, + decode: QueryGroupMembersResponse.decode, + service: "cosmos.group.v1.Query", + method: "GroupMembers", + deps: [QueryGroupMembersRequest, QueryGroupMembersResponse] +}); +/** + * GroupsByAdmin queries groups by admin address. + * @name getGroupsByAdmin + * @package cosmos.group.v1 + * @see proto service: cosmos.group.v1.GroupsByAdmin + */ +export const getGroupsByAdmin = buildQuery({ + encode: QueryGroupsByAdminRequest.encode, + decode: QueryGroupsByAdminResponse.decode, + service: "cosmos.group.v1.Query", + method: "GroupsByAdmin", + deps: [QueryGroupsByAdminRequest, QueryGroupsByAdminResponse] +}); +/** + * GroupPoliciesByGroup queries group policies by group id. + * @name getGroupPoliciesByGroup + * @package cosmos.group.v1 + * @see proto service: cosmos.group.v1.GroupPoliciesByGroup + */ +export const getGroupPoliciesByGroup = buildQuery({ + encode: QueryGroupPoliciesByGroupRequest.encode, + decode: QueryGroupPoliciesByGroupResponse.decode, + service: "cosmos.group.v1.Query", + method: "GroupPoliciesByGroup", + deps: [QueryGroupPoliciesByGroupRequest, QueryGroupPoliciesByGroupResponse] +}); +/** + * GroupsByAdmin queries group policies by admin address. + * @name getGroupPoliciesByAdmin + * @package cosmos.group.v1 + * @see proto service: cosmos.group.v1.GroupPoliciesByAdmin + */ +export const getGroupPoliciesByAdmin = buildQuery({ + encode: QueryGroupPoliciesByAdminRequest.encode, + decode: QueryGroupPoliciesByAdminResponse.decode, + service: "cosmos.group.v1.Query", + method: "GroupPoliciesByAdmin", + deps: [QueryGroupPoliciesByAdminRequest, QueryGroupPoliciesByAdminResponse] +}); +/** + * Proposal queries a proposal based on proposal id. + * @name getProposal + * @package cosmos.group.v1 + * @see proto service: cosmos.group.v1.Proposal + */ +export const getProposal = buildQuery({ + encode: QueryProposalRequest.encode, + decode: QueryProposalResponse.decode, + service: "cosmos.group.v1.Query", + method: "Proposal", + deps: [QueryProposalRequest, QueryProposalResponse] +}); +/** + * ProposalsByGroupPolicy queries proposals based on account address of group policy. + * @name getProposalsByGroupPolicy + * @package cosmos.group.v1 + * @see proto service: cosmos.group.v1.ProposalsByGroupPolicy + */ +export const getProposalsByGroupPolicy = buildQuery({ + encode: QueryProposalsByGroupPolicyRequest.encode, + decode: QueryProposalsByGroupPolicyResponse.decode, + service: "cosmos.group.v1.Query", + method: "ProposalsByGroupPolicy", + deps: [QueryProposalsByGroupPolicyRequest, QueryProposalsByGroupPolicyResponse] +}); +/** + * VoteByProposalVoter queries a vote by proposal id and voter. + * @name getVoteByProposalVoter + * @package cosmos.group.v1 + * @see proto service: cosmos.group.v1.VoteByProposalVoter + */ +export const getVoteByProposalVoter = buildQuery({ + encode: QueryVoteByProposalVoterRequest.encode, + decode: QueryVoteByProposalVoterResponse.decode, + service: "cosmos.group.v1.Query", + method: "VoteByProposalVoter", + deps: [QueryVoteByProposalVoterRequest, QueryVoteByProposalVoterResponse] +}); +/** + * VotesByProposal queries a vote by proposal. + * @name getVotesByProposal + * @package cosmos.group.v1 + * @see proto service: cosmos.group.v1.VotesByProposal + */ +export const getVotesByProposal = buildQuery({ + encode: QueryVotesByProposalRequest.encode, + decode: QueryVotesByProposalResponse.decode, + service: "cosmos.group.v1.Query", + method: "VotesByProposal", + deps: [QueryVotesByProposalRequest, QueryVotesByProposalResponse] +}); +/** + * VotesByVoter queries a vote by voter. + * @name getVotesByVoter + * @package cosmos.group.v1 + * @see proto service: cosmos.group.v1.VotesByVoter + */ +export const getVotesByVoter = buildQuery({ + encode: QueryVotesByVoterRequest.encode, + decode: QueryVotesByVoterResponse.decode, + service: "cosmos.group.v1.Query", + method: "VotesByVoter", + deps: [QueryVotesByVoterRequest, QueryVotesByVoterResponse] +}); +/** + * GroupsByMember queries groups by member address. + * @name getGroupsByMember + * @package cosmos.group.v1 + * @see proto service: cosmos.group.v1.GroupsByMember + */ +export const getGroupsByMember = buildQuery({ + encode: QueryGroupsByMemberRequest.encode, + decode: QueryGroupsByMemberResponse.decode, + service: "cosmos.group.v1.Query", + method: "GroupsByMember", + deps: [QueryGroupsByMemberRequest, QueryGroupsByMemberResponse] +}); +/** + * TallyResult queries the tally of a proposal votes. + * @name getTallyResult + * @package cosmos.group.v1 + * @see proto service: cosmos.group.v1.TallyResult + */ +export const getTallyResult = buildQuery({ + encode: QueryTallyResultRequest.encode, + decode: QueryTallyResultResponse.decode, + service: "cosmos.group.v1.Query", + method: "TallyResult", + deps: [QueryTallyResultRequest, QueryTallyResultResponse] +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/cosmos/group/v1/query.ts b/__fixtures__/v-next/outputv2/cosmos/group/v1/query.ts index 2fff6dea9e..372a34a96f 100644 --- a/__fixtures__/v-next/outputv2/cosmos/group/v1/query.ts +++ b/__fixtures__/v-next/outputv2/cosmos/group/v1/query.ts @@ -3,6 +3,7 @@ import { GroupInfo, GroupInfoAmino, GroupInfoSDKType, GroupPolicyInfo, GroupPoli import { BinaryReader, BinaryWriter } from "../../../binary"; import { isSet, DeepPartial } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "cosmos.group.v1"; /** * QueryGroupInfoRequest is the Query/GroupInfo request type. @@ -1237,6 +1238,15 @@ function createBaseQueryGroupInfoRequest(): QueryGroupInfoRequest { export const QueryGroupInfoRequest = { typeUrl: "/cosmos.group.v1.QueryGroupInfoRequest", aminoType: "cosmos-sdk/QueryGroupInfoRequest", + is(o: any): o is QueryGroupInfoRequest { + return o && (o.$typeUrl === QueryGroupInfoRequest.typeUrl || typeof o.groupId === "bigint"); + }, + isSDK(o: any): o is QueryGroupInfoRequestSDKType { + return o && (o.$typeUrl === QueryGroupInfoRequest.typeUrl || typeof o.group_id === "bigint"); + }, + isAmino(o: any): o is QueryGroupInfoRequestAmino { + return o && (o.$typeUrl === QueryGroupInfoRequest.typeUrl || typeof o.group_id === "bigint"); + }, encode(message: QueryGroupInfoRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.groupId !== BigInt(0)) { writer.uint32(8).uint64(message.groupId); @@ -1319,7 +1329,8 @@ export const QueryGroupInfoRequest = { typeUrl: "/cosmos.group.v1.QueryGroupInfoRequest", value: QueryGroupInfoRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryGroupInfoResponse(): QueryGroupInfoResponse { return { @@ -1335,6 +1346,15 @@ function createBaseQueryGroupInfoResponse(): QueryGroupInfoResponse { export const QueryGroupInfoResponse = { typeUrl: "/cosmos.group.v1.QueryGroupInfoResponse", aminoType: "cosmos-sdk/QueryGroupInfoResponse", + is(o: any): o is QueryGroupInfoResponse { + return o && o.$typeUrl === QueryGroupInfoResponse.typeUrl; + }, + isSDK(o: any): o is QueryGroupInfoResponseSDKType { + return o && o.$typeUrl === QueryGroupInfoResponse.typeUrl; + }, + isAmino(o: any): o is QueryGroupInfoResponseAmino { + return o && o.$typeUrl === QueryGroupInfoResponse.typeUrl; + }, encode(message: QueryGroupInfoResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.info !== undefined) { GroupInfo.encode(message.info, writer.uint32(10).fork()).ldelim(); @@ -1417,6 +1437,12 @@ export const QueryGroupInfoResponse = { typeUrl: "/cosmos.group.v1.QueryGroupInfoResponse", value: QueryGroupInfoResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryGroupInfoResponse.typeUrl)) { + return; + } + GroupInfo.registerTypeUrl(); } }; function createBaseQueryGroupPolicyInfoRequest(): QueryGroupPolicyInfoRequest { @@ -1433,6 +1459,15 @@ function createBaseQueryGroupPolicyInfoRequest(): QueryGroupPolicyInfoRequest { export const QueryGroupPolicyInfoRequest = { typeUrl: "/cosmos.group.v1.QueryGroupPolicyInfoRequest", aminoType: "cosmos-sdk/QueryGroupPolicyInfoRequest", + is(o: any): o is QueryGroupPolicyInfoRequest { + return o && (o.$typeUrl === QueryGroupPolicyInfoRequest.typeUrl || typeof o.address === "string"); + }, + isSDK(o: any): o is QueryGroupPolicyInfoRequestSDKType { + return o && (o.$typeUrl === QueryGroupPolicyInfoRequest.typeUrl || typeof o.address === "string"); + }, + isAmino(o: any): o is QueryGroupPolicyInfoRequestAmino { + return o && (o.$typeUrl === QueryGroupPolicyInfoRequest.typeUrl || typeof o.address === "string"); + }, encode(message: QueryGroupPolicyInfoRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.address !== "") { writer.uint32(10).string(message.address); @@ -1513,7 +1548,8 @@ export const QueryGroupPolicyInfoRequest = { typeUrl: "/cosmos.group.v1.QueryGroupPolicyInfoRequest", value: QueryGroupPolicyInfoRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryGroupPolicyInfoResponse(): QueryGroupPolicyInfoResponse { return { @@ -1529,6 +1565,15 @@ function createBaseQueryGroupPolicyInfoResponse(): QueryGroupPolicyInfoResponse export const QueryGroupPolicyInfoResponse = { typeUrl: "/cosmos.group.v1.QueryGroupPolicyInfoResponse", aminoType: "cosmos-sdk/QueryGroupPolicyInfoResponse", + is(o: any): o is QueryGroupPolicyInfoResponse { + return o && o.$typeUrl === QueryGroupPolicyInfoResponse.typeUrl; + }, + isSDK(o: any): o is QueryGroupPolicyInfoResponseSDKType { + return o && o.$typeUrl === QueryGroupPolicyInfoResponse.typeUrl; + }, + isAmino(o: any): o is QueryGroupPolicyInfoResponseAmino { + return o && o.$typeUrl === QueryGroupPolicyInfoResponse.typeUrl; + }, encode(message: QueryGroupPolicyInfoResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.info !== undefined) { GroupPolicyInfo.encode(message.info, writer.uint32(10).fork()).ldelim(); @@ -1611,6 +1656,12 @@ export const QueryGroupPolicyInfoResponse = { typeUrl: "/cosmos.group.v1.QueryGroupPolicyInfoResponse", value: QueryGroupPolicyInfoResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryGroupPolicyInfoResponse.typeUrl)) { + return; + } + GroupPolicyInfo.registerTypeUrl(); } }; function createBaseQueryGroupMembersRequest(): QueryGroupMembersRequest { @@ -1628,6 +1679,15 @@ function createBaseQueryGroupMembersRequest(): QueryGroupMembersRequest { export const QueryGroupMembersRequest = { typeUrl: "/cosmos.group.v1.QueryGroupMembersRequest", aminoType: "cosmos-sdk/QueryGroupMembersRequest", + is(o: any): o is QueryGroupMembersRequest { + return o && (o.$typeUrl === QueryGroupMembersRequest.typeUrl || typeof o.groupId === "bigint"); + }, + isSDK(o: any): o is QueryGroupMembersRequestSDKType { + return o && (o.$typeUrl === QueryGroupMembersRequest.typeUrl || typeof o.group_id === "bigint"); + }, + isAmino(o: any): o is QueryGroupMembersRequestAmino { + return o && (o.$typeUrl === QueryGroupMembersRequest.typeUrl || typeof o.group_id === "bigint"); + }, encode(message: QueryGroupMembersRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.groupId !== BigInt(0)) { writer.uint32(8).uint64(message.groupId); @@ -1727,6 +1787,12 @@ export const QueryGroupMembersRequest = { typeUrl: "/cosmos.group.v1.QueryGroupMembersRequest", value: QueryGroupMembersRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryGroupMembersRequest.typeUrl)) { + return; + } + PageRequest.registerTypeUrl(); } }; function createBaseQueryGroupMembersResponse(): QueryGroupMembersResponse { @@ -1744,6 +1810,15 @@ function createBaseQueryGroupMembersResponse(): QueryGroupMembersResponse { export const QueryGroupMembersResponse = { typeUrl: "/cosmos.group.v1.QueryGroupMembersResponse", aminoType: "cosmos-sdk/QueryGroupMembersResponse", + is(o: any): o is QueryGroupMembersResponse { + return o && (o.$typeUrl === QueryGroupMembersResponse.typeUrl || Array.isArray(o.members) && (!o.members.length || GroupMember.is(o.members[0]))); + }, + isSDK(o: any): o is QueryGroupMembersResponseSDKType { + return o && (o.$typeUrl === QueryGroupMembersResponse.typeUrl || Array.isArray(o.members) && (!o.members.length || GroupMember.isSDK(o.members[0]))); + }, + isAmino(o: any): o is QueryGroupMembersResponseAmino { + return o && (o.$typeUrl === QueryGroupMembersResponse.typeUrl || Array.isArray(o.members) && (!o.members.length || GroupMember.isAmino(o.members[0]))); + }, encode(message: QueryGroupMembersResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.members) { GroupMember.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -1851,6 +1926,13 @@ export const QueryGroupMembersResponse = { typeUrl: "/cosmos.group.v1.QueryGroupMembersResponse", value: QueryGroupMembersResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryGroupMembersResponse.typeUrl)) { + return; + } + GroupMember.registerTypeUrl(); + PageResponse.registerTypeUrl(); } }; function createBaseQueryGroupsByAdminRequest(): QueryGroupsByAdminRequest { @@ -1868,6 +1950,15 @@ function createBaseQueryGroupsByAdminRequest(): QueryGroupsByAdminRequest { export const QueryGroupsByAdminRequest = { typeUrl: "/cosmos.group.v1.QueryGroupsByAdminRequest", aminoType: "cosmos-sdk/QueryGroupsByAdminRequest", + is(o: any): o is QueryGroupsByAdminRequest { + return o && (o.$typeUrl === QueryGroupsByAdminRequest.typeUrl || typeof o.admin === "string"); + }, + isSDK(o: any): o is QueryGroupsByAdminRequestSDKType { + return o && (o.$typeUrl === QueryGroupsByAdminRequest.typeUrl || typeof o.admin === "string"); + }, + isAmino(o: any): o is QueryGroupsByAdminRequestAmino { + return o && (o.$typeUrl === QueryGroupsByAdminRequest.typeUrl || typeof o.admin === "string"); + }, encode(message: QueryGroupsByAdminRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.admin !== "") { writer.uint32(10).string(message.admin); @@ -1965,6 +2056,12 @@ export const QueryGroupsByAdminRequest = { typeUrl: "/cosmos.group.v1.QueryGroupsByAdminRequest", value: QueryGroupsByAdminRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryGroupsByAdminRequest.typeUrl)) { + return; + } + PageRequest.registerTypeUrl(); } }; function createBaseQueryGroupsByAdminResponse(): QueryGroupsByAdminResponse { @@ -1982,6 +2079,15 @@ function createBaseQueryGroupsByAdminResponse(): QueryGroupsByAdminResponse { export const QueryGroupsByAdminResponse = { typeUrl: "/cosmos.group.v1.QueryGroupsByAdminResponse", aminoType: "cosmos-sdk/QueryGroupsByAdminResponse", + is(o: any): o is QueryGroupsByAdminResponse { + return o && (o.$typeUrl === QueryGroupsByAdminResponse.typeUrl || Array.isArray(o.groups) && (!o.groups.length || GroupInfo.is(o.groups[0]))); + }, + isSDK(o: any): o is QueryGroupsByAdminResponseSDKType { + return o && (o.$typeUrl === QueryGroupsByAdminResponse.typeUrl || Array.isArray(o.groups) && (!o.groups.length || GroupInfo.isSDK(o.groups[0]))); + }, + isAmino(o: any): o is QueryGroupsByAdminResponseAmino { + return o && (o.$typeUrl === QueryGroupsByAdminResponse.typeUrl || Array.isArray(o.groups) && (!o.groups.length || GroupInfo.isAmino(o.groups[0]))); + }, encode(message: QueryGroupsByAdminResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.groups) { GroupInfo.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -2089,6 +2195,13 @@ export const QueryGroupsByAdminResponse = { typeUrl: "/cosmos.group.v1.QueryGroupsByAdminResponse", value: QueryGroupsByAdminResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryGroupsByAdminResponse.typeUrl)) { + return; + } + GroupInfo.registerTypeUrl(); + PageResponse.registerTypeUrl(); } }; function createBaseQueryGroupPoliciesByGroupRequest(): QueryGroupPoliciesByGroupRequest { @@ -2106,6 +2219,15 @@ function createBaseQueryGroupPoliciesByGroupRequest(): QueryGroupPoliciesByGroup export const QueryGroupPoliciesByGroupRequest = { typeUrl: "/cosmos.group.v1.QueryGroupPoliciesByGroupRequest", aminoType: "cosmos-sdk/QueryGroupPoliciesByGroupRequest", + is(o: any): o is QueryGroupPoliciesByGroupRequest { + return o && (o.$typeUrl === QueryGroupPoliciesByGroupRequest.typeUrl || typeof o.groupId === "bigint"); + }, + isSDK(o: any): o is QueryGroupPoliciesByGroupRequestSDKType { + return o && (o.$typeUrl === QueryGroupPoliciesByGroupRequest.typeUrl || typeof o.group_id === "bigint"); + }, + isAmino(o: any): o is QueryGroupPoliciesByGroupRequestAmino { + return o && (o.$typeUrl === QueryGroupPoliciesByGroupRequest.typeUrl || typeof o.group_id === "bigint"); + }, encode(message: QueryGroupPoliciesByGroupRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.groupId !== BigInt(0)) { writer.uint32(8).uint64(message.groupId); @@ -2205,6 +2327,12 @@ export const QueryGroupPoliciesByGroupRequest = { typeUrl: "/cosmos.group.v1.QueryGroupPoliciesByGroupRequest", value: QueryGroupPoliciesByGroupRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryGroupPoliciesByGroupRequest.typeUrl)) { + return; + } + PageRequest.registerTypeUrl(); } }; function createBaseQueryGroupPoliciesByGroupResponse(): QueryGroupPoliciesByGroupResponse { @@ -2222,6 +2350,15 @@ function createBaseQueryGroupPoliciesByGroupResponse(): QueryGroupPoliciesByGrou export const QueryGroupPoliciesByGroupResponse = { typeUrl: "/cosmos.group.v1.QueryGroupPoliciesByGroupResponse", aminoType: "cosmos-sdk/QueryGroupPoliciesByGroupResponse", + is(o: any): o is QueryGroupPoliciesByGroupResponse { + return o && (o.$typeUrl === QueryGroupPoliciesByGroupResponse.typeUrl || Array.isArray(o.groupPolicies) && (!o.groupPolicies.length || GroupPolicyInfo.is(o.groupPolicies[0]))); + }, + isSDK(o: any): o is QueryGroupPoliciesByGroupResponseSDKType { + return o && (o.$typeUrl === QueryGroupPoliciesByGroupResponse.typeUrl || Array.isArray(o.group_policies) && (!o.group_policies.length || GroupPolicyInfo.isSDK(o.group_policies[0]))); + }, + isAmino(o: any): o is QueryGroupPoliciesByGroupResponseAmino { + return o && (o.$typeUrl === QueryGroupPoliciesByGroupResponse.typeUrl || Array.isArray(o.group_policies) && (!o.group_policies.length || GroupPolicyInfo.isAmino(o.group_policies[0]))); + }, encode(message: QueryGroupPoliciesByGroupResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.groupPolicies) { GroupPolicyInfo.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -2329,6 +2466,13 @@ export const QueryGroupPoliciesByGroupResponse = { typeUrl: "/cosmos.group.v1.QueryGroupPoliciesByGroupResponse", value: QueryGroupPoliciesByGroupResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryGroupPoliciesByGroupResponse.typeUrl)) { + return; + } + GroupPolicyInfo.registerTypeUrl(); + PageResponse.registerTypeUrl(); } }; function createBaseQueryGroupPoliciesByAdminRequest(): QueryGroupPoliciesByAdminRequest { @@ -2346,6 +2490,15 @@ function createBaseQueryGroupPoliciesByAdminRequest(): QueryGroupPoliciesByAdmin export const QueryGroupPoliciesByAdminRequest = { typeUrl: "/cosmos.group.v1.QueryGroupPoliciesByAdminRequest", aminoType: "cosmos-sdk/QueryGroupPoliciesByAdminRequest", + is(o: any): o is QueryGroupPoliciesByAdminRequest { + return o && (o.$typeUrl === QueryGroupPoliciesByAdminRequest.typeUrl || typeof o.admin === "string"); + }, + isSDK(o: any): o is QueryGroupPoliciesByAdminRequestSDKType { + return o && (o.$typeUrl === QueryGroupPoliciesByAdminRequest.typeUrl || typeof o.admin === "string"); + }, + isAmino(o: any): o is QueryGroupPoliciesByAdminRequestAmino { + return o && (o.$typeUrl === QueryGroupPoliciesByAdminRequest.typeUrl || typeof o.admin === "string"); + }, encode(message: QueryGroupPoliciesByAdminRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.admin !== "") { writer.uint32(10).string(message.admin); @@ -2443,6 +2596,12 @@ export const QueryGroupPoliciesByAdminRequest = { typeUrl: "/cosmos.group.v1.QueryGroupPoliciesByAdminRequest", value: QueryGroupPoliciesByAdminRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryGroupPoliciesByAdminRequest.typeUrl)) { + return; + } + PageRequest.registerTypeUrl(); } }; function createBaseQueryGroupPoliciesByAdminResponse(): QueryGroupPoliciesByAdminResponse { @@ -2460,6 +2619,15 @@ function createBaseQueryGroupPoliciesByAdminResponse(): QueryGroupPoliciesByAdmi export const QueryGroupPoliciesByAdminResponse = { typeUrl: "/cosmos.group.v1.QueryGroupPoliciesByAdminResponse", aminoType: "cosmos-sdk/QueryGroupPoliciesByAdminResponse", + is(o: any): o is QueryGroupPoliciesByAdminResponse { + return o && (o.$typeUrl === QueryGroupPoliciesByAdminResponse.typeUrl || Array.isArray(o.groupPolicies) && (!o.groupPolicies.length || GroupPolicyInfo.is(o.groupPolicies[0]))); + }, + isSDK(o: any): o is QueryGroupPoliciesByAdminResponseSDKType { + return o && (o.$typeUrl === QueryGroupPoliciesByAdminResponse.typeUrl || Array.isArray(o.group_policies) && (!o.group_policies.length || GroupPolicyInfo.isSDK(o.group_policies[0]))); + }, + isAmino(o: any): o is QueryGroupPoliciesByAdminResponseAmino { + return o && (o.$typeUrl === QueryGroupPoliciesByAdminResponse.typeUrl || Array.isArray(o.group_policies) && (!o.group_policies.length || GroupPolicyInfo.isAmino(o.group_policies[0]))); + }, encode(message: QueryGroupPoliciesByAdminResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.groupPolicies) { GroupPolicyInfo.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -2567,6 +2735,13 @@ export const QueryGroupPoliciesByAdminResponse = { typeUrl: "/cosmos.group.v1.QueryGroupPoliciesByAdminResponse", value: QueryGroupPoliciesByAdminResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryGroupPoliciesByAdminResponse.typeUrl)) { + return; + } + GroupPolicyInfo.registerTypeUrl(); + PageResponse.registerTypeUrl(); } }; function createBaseQueryProposalRequest(): QueryProposalRequest { @@ -2583,6 +2758,15 @@ function createBaseQueryProposalRequest(): QueryProposalRequest { export const QueryProposalRequest = { typeUrl: "/cosmos.group.v1.QueryProposalRequest", aminoType: "cosmos-sdk/QueryProposalRequest", + is(o: any): o is QueryProposalRequest { + return o && (o.$typeUrl === QueryProposalRequest.typeUrl || typeof o.proposalId === "bigint"); + }, + isSDK(o: any): o is QueryProposalRequestSDKType { + return o && (o.$typeUrl === QueryProposalRequest.typeUrl || typeof o.proposal_id === "bigint"); + }, + isAmino(o: any): o is QueryProposalRequestAmino { + return o && (o.$typeUrl === QueryProposalRequest.typeUrl || typeof o.proposal_id === "bigint"); + }, encode(message: QueryProposalRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.proposalId !== BigInt(0)) { writer.uint32(8).uint64(message.proposalId); @@ -2665,7 +2849,8 @@ export const QueryProposalRequest = { typeUrl: "/cosmos.group.v1.QueryProposalRequest", value: QueryProposalRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryProposalResponse(): QueryProposalResponse { return { @@ -2681,6 +2866,15 @@ function createBaseQueryProposalResponse(): QueryProposalResponse { export const QueryProposalResponse = { typeUrl: "/cosmos.group.v1.QueryProposalResponse", aminoType: "cosmos-sdk/QueryProposalResponse", + is(o: any): o is QueryProposalResponse { + return o && o.$typeUrl === QueryProposalResponse.typeUrl; + }, + isSDK(o: any): o is QueryProposalResponseSDKType { + return o && o.$typeUrl === QueryProposalResponse.typeUrl; + }, + isAmino(o: any): o is QueryProposalResponseAmino { + return o && o.$typeUrl === QueryProposalResponse.typeUrl; + }, encode(message: QueryProposalResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.proposal !== undefined) { Proposal.encode(message.proposal, writer.uint32(10).fork()).ldelim(); @@ -2763,6 +2957,12 @@ export const QueryProposalResponse = { typeUrl: "/cosmos.group.v1.QueryProposalResponse", value: QueryProposalResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryProposalResponse.typeUrl)) { + return; + } + Proposal.registerTypeUrl(); } }; function createBaseQueryProposalsByGroupPolicyRequest(): QueryProposalsByGroupPolicyRequest { @@ -2780,6 +2980,15 @@ function createBaseQueryProposalsByGroupPolicyRequest(): QueryProposalsByGroupPo export const QueryProposalsByGroupPolicyRequest = { typeUrl: "/cosmos.group.v1.QueryProposalsByGroupPolicyRequest", aminoType: "cosmos-sdk/QueryProposalsByGroupPolicyRequest", + is(o: any): o is QueryProposalsByGroupPolicyRequest { + return o && (o.$typeUrl === QueryProposalsByGroupPolicyRequest.typeUrl || typeof o.address === "string"); + }, + isSDK(o: any): o is QueryProposalsByGroupPolicyRequestSDKType { + return o && (o.$typeUrl === QueryProposalsByGroupPolicyRequest.typeUrl || typeof o.address === "string"); + }, + isAmino(o: any): o is QueryProposalsByGroupPolicyRequestAmino { + return o && (o.$typeUrl === QueryProposalsByGroupPolicyRequest.typeUrl || typeof o.address === "string"); + }, encode(message: QueryProposalsByGroupPolicyRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.address !== "") { writer.uint32(10).string(message.address); @@ -2877,6 +3086,12 @@ export const QueryProposalsByGroupPolicyRequest = { typeUrl: "/cosmos.group.v1.QueryProposalsByGroupPolicyRequest", value: QueryProposalsByGroupPolicyRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryProposalsByGroupPolicyRequest.typeUrl)) { + return; + } + PageRequest.registerTypeUrl(); } }; function createBaseQueryProposalsByGroupPolicyResponse(): QueryProposalsByGroupPolicyResponse { @@ -2894,6 +3109,15 @@ function createBaseQueryProposalsByGroupPolicyResponse(): QueryProposalsByGroupP export const QueryProposalsByGroupPolicyResponse = { typeUrl: "/cosmos.group.v1.QueryProposalsByGroupPolicyResponse", aminoType: "cosmos-sdk/QueryProposalsByGroupPolicyResponse", + is(o: any): o is QueryProposalsByGroupPolicyResponse { + return o && (o.$typeUrl === QueryProposalsByGroupPolicyResponse.typeUrl || Array.isArray(o.proposals) && (!o.proposals.length || Proposal.is(o.proposals[0]))); + }, + isSDK(o: any): o is QueryProposalsByGroupPolicyResponseSDKType { + return o && (o.$typeUrl === QueryProposalsByGroupPolicyResponse.typeUrl || Array.isArray(o.proposals) && (!o.proposals.length || Proposal.isSDK(o.proposals[0]))); + }, + isAmino(o: any): o is QueryProposalsByGroupPolicyResponseAmino { + return o && (o.$typeUrl === QueryProposalsByGroupPolicyResponse.typeUrl || Array.isArray(o.proposals) && (!o.proposals.length || Proposal.isAmino(o.proposals[0]))); + }, encode(message: QueryProposalsByGroupPolicyResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.proposals) { Proposal.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -3001,6 +3225,13 @@ export const QueryProposalsByGroupPolicyResponse = { typeUrl: "/cosmos.group.v1.QueryProposalsByGroupPolicyResponse", value: QueryProposalsByGroupPolicyResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryProposalsByGroupPolicyResponse.typeUrl)) { + return; + } + Proposal.registerTypeUrl(); + PageResponse.registerTypeUrl(); } }; function createBaseQueryVoteByProposalVoterRequest(): QueryVoteByProposalVoterRequest { @@ -3018,6 +3249,15 @@ function createBaseQueryVoteByProposalVoterRequest(): QueryVoteByProposalVoterRe export const QueryVoteByProposalVoterRequest = { typeUrl: "/cosmos.group.v1.QueryVoteByProposalVoterRequest", aminoType: "cosmos-sdk/QueryVoteByProposalVoterRequest", + is(o: any): o is QueryVoteByProposalVoterRequest { + return o && (o.$typeUrl === QueryVoteByProposalVoterRequest.typeUrl || typeof o.proposalId === "bigint" && typeof o.voter === "string"); + }, + isSDK(o: any): o is QueryVoteByProposalVoterRequestSDKType { + return o && (o.$typeUrl === QueryVoteByProposalVoterRequest.typeUrl || typeof o.proposal_id === "bigint" && typeof o.voter === "string"); + }, + isAmino(o: any): o is QueryVoteByProposalVoterRequestAmino { + return o && (o.$typeUrl === QueryVoteByProposalVoterRequest.typeUrl || typeof o.proposal_id === "bigint" && typeof o.voter === "string"); + }, encode(message: QueryVoteByProposalVoterRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.proposalId !== BigInt(0)) { writer.uint32(8).uint64(message.proposalId); @@ -3115,7 +3355,8 @@ export const QueryVoteByProposalVoterRequest = { typeUrl: "/cosmos.group.v1.QueryVoteByProposalVoterRequest", value: QueryVoteByProposalVoterRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryVoteByProposalVoterResponse(): QueryVoteByProposalVoterResponse { return { @@ -3131,6 +3372,15 @@ function createBaseQueryVoteByProposalVoterResponse(): QueryVoteByProposalVoterR export const QueryVoteByProposalVoterResponse = { typeUrl: "/cosmos.group.v1.QueryVoteByProposalVoterResponse", aminoType: "cosmos-sdk/QueryVoteByProposalVoterResponse", + is(o: any): o is QueryVoteByProposalVoterResponse { + return o && o.$typeUrl === QueryVoteByProposalVoterResponse.typeUrl; + }, + isSDK(o: any): o is QueryVoteByProposalVoterResponseSDKType { + return o && o.$typeUrl === QueryVoteByProposalVoterResponse.typeUrl; + }, + isAmino(o: any): o is QueryVoteByProposalVoterResponseAmino { + return o && o.$typeUrl === QueryVoteByProposalVoterResponse.typeUrl; + }, encode(message: QueryVoteByProposalVoterResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.vote !== undefined) { Vote.encode(message.vote, writer.uint32(10).fork()).ldelim(); @@ -3213,6 +3463,12 @@ export const QueryVoteByProposalVoterResponse = { typeUrl: "/cosmos.group.v1.QueryVoteByProposalVoterResponse", value: QueryVoteByProposalVoterResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryVoteByProposalVoterResponse.typeUrl)) { + return; + } + Vote.registerTypeUrl(); } }; function createBaseQueryVotesByProposalRequest(): QueryVotesByProposalRequest { @@ -3230,6 +3486,15 @@ function createBaseQueryVotesByProposalRequest(): QueryVotesByProposalRequest { export const QueryVotesByProposalRequest = { typeUrl: "/cosmos.group.v1.QueryVotesByProposalRequest", aminoType: "cosmos-sdk/QueryVotesByProposalRequest", + is(o: any): o is QueryVotesByProposalRequest { + return o && (o.$typeUrl === QueryVotesByProposalRequest.typeUrl || typeof o.proposalId === "bigint"); + }, + isSDK(o: any): o is QueryVotesByProposalRequestSDKType { + return o && (o.$typeUrl === QueryVotesByProposalRequest.typeUrl || typeof o.proposal_id === "bigint"); + }, + isAmino(o: any): o is QueryVotesByProposalRequestAmino { + return o && (o.$typeUrl === QueryVotesByProposalRequest.typeUrl || typeof o.proposal_id === "bigint"); + }, encode(message: QueryVotesByProposalRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.proposalId !== BigInt(0)) { writer.uint32(8).uint64(message.proposalId); @@ -3329,6 +3594,12 @@ export const QueryVotesByProposalRequest = { typeUrl: "/cosmos.group.v1.QueryVotesByProposalRequest", value: QueryVotesByProposalRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryVotesByProposalRequest.typeUrl)) { + return; + } + PageRequest.registerTypeUrl(); } }; function createBaseQueryVotesByProposalResponse(): QueryVotesByProposalResponse { @@ -3346,6 +3617,15 @@ function createBaseQueryVotesByProposalResponse(): QueryVotesByProposalResponse export const QueryVotesByProposalResponse = { typeUrl: "/cosmos.group.v1.QueryVotesByProposalResponse", aminoType: "cosmos-sdk/QueryVotesByProposalResponse", + is(o: any): o is QueryVotesByProposalResponse { + return o && (o.$typeUrl === QueryVotesByProposalResponse.typeUrl || Array.isArray(o.votes) && (!o.votes.length || Vote.is(o.votes[0]))); + }, + isSDK(o: any): o is QueryVotesByProposalResponseSDKType { + return o && (o.$typeUrl === QueryVotesByProposalResponse.typeUrl || Array.isArray(o.votes) && (!o.votes.length || Vote.isSDK(o.votes[0]))); + }, + isAmino(o: any): o is QueryVotesByProposalResponseAmino { + return o && (o.$typeUrl === QueryVotesByProposalResponse.typeUrl || Array.isArray(o.votes) && (!o.votes.length || Vote.isAmino(o.votes[0]))); + }, encode(message: QueryVotesByProposalResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.votes) { Vote.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -3453,6 +3733,13 @@ export const QueryVotesByProposalResponse = { typeUrl: "/cosmos.group.v1.QueryVotesByProposalResponse", value: QueryVotesByProposalResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryVotesByProposalResponse.typeUrl)) { + return; + } + Vote.registerTypeUrl(); + PageResponse.registerTypeUrl(); } }; function createBaseQueryVotesByVoterRequest(): QueryVotesByVoterRequest { @@ -3470,6 +3757,15 @@ function createBaseQueryVotesByVoterRequest(): QueryVotesByVoterRequest { export const QueryVotesByVoterRequest = { typeUrl: "/cosmos.group.v1.QueryVotesByVoterRequest", aminoType: "cosmos-sdk/QueryVotesByVoterRequest", + is(o: any): o is QueryVotesByVoterRequest { + return o && (o.$typeUrl === QueryVotesByVoterRequest.typeUrl || typeof o.voter === "string"); + }, + isSDK(o: any): o is QueryVotesByVoterRequestSDKType { + return o && (o.$typeUrl === QueryVotesByVoterRequest.typeUrl || typeof o.voter === "string"); + }, + isAmino(o: any): o is QueryVotesByVoterRequestAmino { + return o && (o.$typeUrl === QueryVotesByVoterRequest.typeUrl || typeof o.voter === "string"); + }, encode(message: QueryVotesByVoterRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.voter !== "") { writer.uint32(10).string(message.voter); @@ -3567,6 +3863,12 @@ export const QueryVotesByVoterRequest = { typeUrl: "/cosmos.group.v1.QueryVotesByVoterRequest", value: QueryVotesByVoterRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryVotesByVoterRequest.typeUrl)) { + return; + } + PageRequest.registerTypeUrl(); } }; function createBaseQueryVotesByVoterResponse(): QueryVotesByVoterResponse { @@ -3584,6 +3886,15 @@ function createBaseQueryVotesByVoterResponse(): QueryVotesByVoterResponse { export const QueryVotesByVoterResponse = { typeUrl: "/cosmos.group.v1.QueryVotesByVoterResponse", aminoType: "cosmos-sdk/QueryVotesByVoterResponse", + is(o: any): o is QueryVotesByVoterResponse { + return o && (o.$typeUrl === QueryVotesByVoterResponse.typeUrl || Array.isArray(o.votes) && (!o.votes.length || Vote.is(o.votes[0]))); + }, + isSDK(o: any): o is QueryVotesByVoterResponseSDKType { + return o && (o.$typeUrl === QueryVotesByVoterResponse.typeUrl || Array.isArray(o.votes) && (!o.votes.length || Vote.isSDK(o.votes[0]))); + }, + isAmino(o: any): o is QueryVotesByVoterResponseAmino { + return o && (o.$typeUrl === QueryVotesByVoterResponse.typeUrl || Array.isArray(o.votes) && (!o.votes.length || Vote.isAmino(o.votes[0]))); + }, encode(message: QueryVotesByVoterResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.votes) { Vote.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -3691,6 +4002,13 @@ export const QueryVotesByVoterResponse = { typeUrl: "/cosmos.group.v1.QueryVotesByVoterResponse", value: QueryVotesByVoterResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryVotesByVoterResponse.typeUrl)) { + return; + } + Vote.registerTypeUrl(); + PageResponse.registerTypeUrl(); } }; function createBaseQueryGroupsByMemberRequest(): QueryGroupsByMemberRequest { @@ -3708,6 +4026,15 @@ function createBaseQueryGroupsByMemberRequest(): QueryGroupsByMemberRequest { export const QueryGroupsByMemberRequest = { typeUrl: "/cosmos.group.v1.QueryGroupsByMemberRequest", aminoType: "cosmos-sdk/QueryGroupsByMemberRequest", + is(o: any): o is QueryGroupsByMemberRequest { + return o && (o.$typeUrl === QueryGroupsByMemberRequest.typeUrl || typeof o.address === "string"); + }, + isSDK(o: any): o is QueryGroupsByMemberRequestSDKType { + return o && (o.$typeUrl === QueryGroupsByMemberRequest.typeUrl || typeof o.address === "string"); + }, + isAmino(o: any): o is QueryGroupsByMemberRequestAmino { + return o && (o.$typeUrl === QueryGroupsByMemberRequest.typeUrl || typeof o.address === "string"); + }, encode(message: QueryGroupsByMemberRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.address !== "") { writer.uint32(10).string(message.address); @@ -3805,6 +4132,12 @@ export const QueryGroupsByMemberRequest = { typeUrl: "/cosmos.group.v1.QueryGroupsByMemberRequest", value: QueryGroupsByMemberRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryGroupsByMemberRequest.typeUrl)) { + return; + } + PageRequest.registerTypeUrl(); } }; function createBaseQueryGroupsByMemberResponse(): QueryGroupsByMemberResponse { @@ -3822,6 +4155,15 @@ function createBaseQueryGroupsByMemberResponse(): QueryGroupsByMemberResponse { export const QueryGroupsByMemberResponse = { typeUrl: "/cosmos.group.v1.QueryGroupsByMemberResponse", aminoType: "cosmos-sdk/QueryGroupsByMemberResponse", + is(o: any): o is QueryGroupsByMemberResponse { + return o && (o.$typeUrl === QueryGroupsByMemberResponse.typeUrl || Array.isArray(o.groups) && (!o.groups.length || GroupInfo.is(o.groups[0]))); + }, + isSDK(o: any): o is QueryGroupsByMemberResponseSDKType { + return o && (o.$typeUrl === QueryGroupsByMemberResponse.typeUrl || Array.isArray(o.groups) && (!o.groups.length || GroupInfo.isSDK(o.groups[0]))); + }, + isAmino(o: any): o is QueryGroupsByMemberResponseAmino { + return o && (o.$typeUrl === QueryGroupsByMemberResponse.typeUrl || Array.isArray(o.groups) && (!o.groups.length || GroupInfo.isAmino(o.groups[0]))); + }, encode(message: QueryGroupsByMemberResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.groups) { GroupInfo.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -3929,6 +4271,13 @@ export const QueryGroupsByMemberResponse = { typeUrl: "/cosmos.group.v1.QueryGroupsByMemberResponse", value: QueryGroupsByMemberResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryGroupsByMemberResponse.typeUrl)) { + return; + } + GroupInfo.registerTypeUrl(); + PageResponse.registerTypeUrl(); } }; function createBaseQueryTallyResultRequest(): QueryTallyResultRequest { @@ -3945,6 +4294,15 @@ function createBaseQueryTallyResultRequest(): QueryTallyResultRequest { export const QueryTallyResultRequest = { typeUrl: "/cosmos.group.v1.QueryTallyResultRequest", aminoType: "cosmos-sdk/QueryTallyResultRequest", + is(o: any): o is QueryTallyResultRequest { + return o && (o.$typeUrl === QueryTallyResultRequest.typeUrl || typeof o.proposalId === "bigint"); + }, + isSDK(o: any): o is QueryTallyResultRequestSDKType { + return o && (o.$typeUrl === QueryTallyResultRequest.typeUrl || typeof o.proposal_id === "bigint"); + }, + isAmino(o: any): o is QueryTallyResultRequestAmino { + return o && (o.$typeUrl === QueryTallyResultRequest.typeUrl || typeof o.proposal_id === "bigint"); + }, encode(message: QueryTallyResultRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.proposalId !== BigInt(0)) { writer.uint32(8).uint64(message.proposalId); @@ -4027,7 +4385,8 @@ export const QueryTallyResultRequest = { typeUrl: "/cosmos.group.v1.QueryTallyResultRequest", value: QueryTallyResultRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryTallyResultResponse(): QueryTallyResultResponse { return { @@ -4043,6 +4402,15 @@ function createBaseQueryTallyResultResponse(): QueryTallyResultResponse { export const QueryTallyResultResponse = { typeUrl: "/cosmos.group.v1.QueryTallyResultResponse", aminoType: "cosmos-sdk/QueryTallyResultResponse", + is(o: any): o is QueryTallyResultResponse { + return o && (o.$typeUrl === QueryTallyResultResponse.typeUrl || TallyResult.is(o.tally)); + }, + isSDK(o: any): o is QueryTallyResultResponseSDKType { + return o && (o.$typeUrl === QueryTallyResultResponse.typeUrl || TallyResult.isSDK(o.tally)); + }, + isAmino(o: any): o is QueryTallyResultResponseAmino { + return o && (o.$typeUrl === QueryTallyResultResponse.typeUrl || TallyResult.isAmino(o.tally)); + }, encode(message: QueryTallyResultResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.tally !== undefined) { TallyResult.encode(message.tally, writer.uint32(10).fork()).ldelim(); @@ -4125,5 +4493,11 @@ export const QueryTallyResultResponse = { typeUrl: "/cosmos.group.v1.QueryTallyResultResponse", value: QueryTallyResultResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryTallyResultResponse.typeUrl)) { + return; + } + TallyResult.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/cosmos/group/v1/tx.registry.ts b/__fixtures__/v-next/outputv2/cosmos/group/v1/tx.registry.ts index e2bceb8c04..1e522228d8 100644 --- a/__fixtures__/v-next/outputv2/cosmos/group/v1/tx.registry.ts +++ b/__fixtures__/v-next/outputv2/cosmos/group/v1/tx.registry.ts @@ -1,11 +1,6 @@ -import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { TelescopeGeneratedType } from "../../../types"; import { MsgCreateGroup, MsgUpdateGroupMembers, MsgUpdateGroupAdmin, MsgUpdateGroupMetadata, MsgCreateGroupPolicy, MsgCreateGroupWithPolicy, MsgUpdateGroupPolicyAdmin, MsgUpdateGroupPolicyDecisionPolicy, MsgUpdateGroupPolicyMetadata, MsgSubmitProposal, MsgWithdrawProposal, MsgVote, MsgExec, MsgLeaveGroup } from "./tx"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/cosmos.group.v1.MsgCreateGroup", MsgCreateGroup], ["/cosmos.group.v1.MsgUpdateGroupMembers", MsgUpdateGroupMembers], ["/cosmos.group.v1.MsgUpdateGroupAdmin", MsgUpdateGroupAdmin], ["/cosmos.group.v1.MsgUpdateGroupMetadata", MsgUpdateGroupMetadata], ["/cosmos.group.v1.MsgCreateGroupPolicy", MsgCreateGroupPolicy], ["/cosmos.group.v1.MsgCreateGroupWithPolicy", MsgCreateGroupWithPolicy], ["/cosmos.group.v1.MsgUpdateGroupPolicyAdmin", MsgUpdateGroupPolicyAdmin], ["/cosmos.group.v1.MsgUpdateGroupPolicyDecisionPolicy", MsgUpdateGroupPolicyDecisionPolicy], ["/cosmos.group.v1.MsgUpdateGroupPolicyMetadata", MsgUpdateGroupPolicyMetadata], ["/cosmos.group.v1.MsgSubmitProposal", MsgSubmitProposal], ["/cosmos.group.v1.MsgWithdrawProposal", MsgWithdrawProposal], ["/cosmos.group.v1.MsgVote", MsgVote], ["/cosmos.group.v1.MsgExec", MsgExec], ["/cosmos.group.v1.MsgLeaveGroup", MsgLeaveGroup]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/cosmos.group.v1.MsgCreateGroup", MsgCreateGroup], ["/cosmos.group.v1.MsgUpdateGroupMembers", MsgUpdateGroupMembers], ["/cosmos.group.v1.MsgUpdateGroupAdmin", MsgUpdateGroupAdmin], ["/cosmos.group.v1.MsgUpdateGroupMetadata", MsgUpdateGroupMetadata], ["/cosmos.group.v1.MsgCreateGroupPolicy", MsgCreateGroupPolicy], ["/cosmos.group.v1.MsgCreateGroupWithPolicy", MsgCreateGroupWithPolicy], ["/cosmos.group.v1.MsgUpdateGroupPolicyAdmin", MsgUpdateGroupPolicyAdmin], ["/cosmos.group.v1.MsgUpdateGroupPolicyDecisionPolicy", MsgUpdateGroupPolicyDecisionPolicy], ["/cosmos.group.v1.MsgUpdateGroupPolicyMetadata", MsgUpdateGroupPolicyMetadata], ["/cosmos.group.v1.MsgSubmitProposal", MsgSubmitProposal], ["/cosmos.group.v1.MsgWithdrawProposal", MsgWithdrawProposal], ["/cosmos.group.v1.MsgVote", MsgVote], ["/cosmos.group.v1.MsgExec", MsgExec], ["/cosmos.group.v1.MsgLeaveGroup", MsgLeaveGroup]]; export const MessageComposer = { encoded: { createGroup(value: MsgCreateGroup) { diff --git a/__fixtures__/v-next/outputv2/cosmos/group/v1/tx.rpc.func.ts b/__fixtures__/v-next/outputv2/cosmos/group/v1/tx.rpc.func.ts new file mode 100644 index 0000000000..176510fc47 --- /dev/null +++ b/__fixtures__/v-next/outputv2/cosmos/group/v1/tx.rpc.func.ts @@ -0,0 +1,128 @@ +import { buildTx } from "../../../helper-func-types"; +import { MsgCreateGroup, MsgUpdateGroupMembers, MsgUpdateGroupAdmin, MsgUpdateGroupMetadata, MsgCreateGroupPolicy, MsgCreateGroupWithPolicy, MsgUpdateGroupPolicyAdmin, MsgUpdateGroupPolicyDecisionPolicy, MsgUpdateGroupPolicyMetadata, MsgSubmitProposal, MsgWithdrawProposal, MsgVote, MsgExec, MsgLeaveGroup } from "./tx"; +/** + * CreateGroup creates a new group with an admin account address, a list of members and some optional metadata. + * @name createGroup + * @package cosmos.group.v1 + * @see proto service: cosmos.group.v1.CreateGroup + */ +export const createGroup = buildTx({ + msg: MsgCreateGroup +}); +/** + * UpdateGroupMembers updates the group members with given group id and admin address. + * @name updateGroupMembers + * @package cosmos.group.v1 + * @see proto service: cosmos.group.v1.UpdateGroupMembers + */ +export const updateGroupMembers = buildTx({ + msg: MsgUpdateGroupMembers +}); +/** + * UpdateGroupAdmin updates the group admin with given group id and previous admin address. + * @name updateGroupAdmin + * @package cosmos.group.v1 + * @see proto service: cosmos.group.v1.UpdateGroupAdmin + */ +export const updateGroupAdmin = buildTx({ + msg: MsgUpdateGroupAdmin +}); +/** + * UpdateGroupMetadata updates the group metadata with given group id and admin address. + * @name updateGroupMetadata + * @package cosmos.group.v1 + * @see proto service: cosmos.group.v1.UpdateGroupMetadata + */ +export const updateGroupMetadata = buildTx({ + msg: MsgUpdateGroupMetadata +}); +/** + * CreateGroupPolicy creates a new group policy using given DecisionPolicy. + * @name createGroupPolicy + * @package cosmos.group.v1 + * @see proto service: cosmos.group.v1.CreateGroupPolicy + */ +export const createGroupPolicy = buildTx({ + msg: MsgCreateGroupPolicy +}); +/** + * CreateGroupWithPolicy creates a new group with policy. + * @name createGroupWithPolicy + * @package cosmos.group.v1 + * @see proto service: cosmos.group.v1.CreateGroupWithPolicy + */ +export const createGroupWithPolicy = buildTx({ + msg: MsgCreateGroupWithPolicy +}); +/** + * UpdateGroupPolicyAdmin updates a group policy admin. + * @name updateGroupPolicyAdmin + * @package cosmos.group.v1 + * @see proto service: cosmos.group.v1.UpdateGroupPolicyAdmin + */ +export const updateGroupPolicyAdmin = buildTx({ + msg: MsgUpdateGroupPolicyAdmin +}); +/** + * UpdateGroupPolicyDecisionPolicy allows a group policy's decision policy to be updated. + * @name updateGroupPolicyDecisionPolicy + * @package cosmos.group.v1 + * @see proto service: cosmos.group.v1.UpdateGroupPolicyDecisionPolicy + */ +export const updateGroupPolicyDecisionPolicy = buildTx({ + msg: MsgUpdateGroupPolicyDecisionPolicy +}); +/** + * UpdateGroupPolicyMetadata updates a group policy metadata. + * @name updateGroupPolicyMetadata + * @package cosmos.group.v1 + * @see proto service: cosmos.group.v1.UpdateGroupPolicyMetadata + */ +export const updateGroupPolicyMetadata = buildTx({ + msg: MsgUpdateGroupPolicyMetadata +}); +/** + * SubmitProposal submits a new proposal. + * @name submitProposal + * @package cosmos.group.v1 + * @see proto service: cosmos.group.v1.SubmitProposal + */ +export const submitProposal = buildTx({ + msg: MsgSubmitProposal +}); +/** + * WithdrawProposal aborts a proposal. + * @name withdrawProposal + * @package cosmos.group.v1 + * @see proto service: cosmos.group.v1.WithdrawProposal + */ +export const withdrawProposal = buildTx({ + msg: MsgWithdrawProposal +}); +/** + * Vote allows a voter to vote on a proposal. + * @name vote + * @package cosmos.group.v1 + * @see proto service: cosmos.group.v1.Vote + */ +export const vote = buildTx({ + msg: MsgVote +}); +/** + * Exec executes a proposal. + * @name exec + * @package cosmos.group.v1 + * @see proto service: cosmos.group.v1.Exec + */ +export const exec = buildTx({ + msg: MsgExec +}); +/** + * LeaveGroup allows a group member to leave the group. + * @name leaveGroup + * @package cosmos.group.v1 + * @see proto service: cosmos.group.v1.LeaveGroup + */ +export const leaveGroup = buildTx({ + msg: MsgLeaveGroup +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/cosmos/group/v1/tx.ts b/__fixtures__/v-next/outputv2/cosmos/group/v1/tx.ts index 6f0697d84d..8148fb8acd 100644 --- a/__fixtures__/v-next/outputv2/cosmos/group/v1/tx.ts +++ b/__fixtures__/v-next/outputv2/cosmos/group/v1/tx.ts @@ -3,6 +3,7 @@ import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../google/protobuf import { BinaryReader, BinaryWriter } from "../../../binary"; import { isSet, DeepPartial } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "cosmos.group.v1"; /** Exec defines modes of execution of a proposal on creation or on new vote. */ export enum Exec { @@ -1425,6 +1426,15 @@ function createBaseMsgCreateGroup(): MsgCreateGroup { export const MsgCreateGroup = { typeUrl: "/cosmos.group.v1.MsgCreateGroup", aminoType: "cosmos-sdk/MsgCreateGroup", + is(o: any): o is MsgCreateGroup { + return o && (o.$typeUrl === MsgCreateGroup.typeUrl || typeof o.admin === "string" && Array.isArray(o.members) && (!o.members.length || Member.is(o.members[0])) && typeof o.metadata === "string"); + }, + isSDK(o: any): o is MsgCreateGroupSDKType { + return o && (o.$typeUrl === MsgCreateGroup.typeUrl || typeof o.admin === "string" && Array.isArray(o.members) && (!o.members.length || Member.isSDK(o.members[0])) && typeof o.metadata === "string"); + }, + isAmino(o: any): o is MsgCreateGroupAmino { + return o && (o.$typeUrl === MsgCreateGroup.typeUrl || typeof o.admin === "string" && Array.isArray(o.members) && (!o.members.length || Member.isAmino(o.members[0])) && typeof o.metadata === "string"); + }, encode(message: MsgCreateGroup, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.admin !== "") { writer.uint32(10).string(message.admin); @@ -1545,6 +1555,12 @@ export const MsgCreateGroup = { typeUrl: "/cosmos.group.v1.MsgCreateGroup", value: MsgCreateGroup.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgCreateGroup.typeUrl)) { + return; + } + Member.registerTypeUrl(); } }; function createBaseMsgCreateGroupResponse(): MsgCreateGroupResponse { @@ -1561,6 +1577,15 @@ function createBaseMsgCreateGroupResponse(): MsgCreateGroupResponse { export const MsgCreateGroupResponse = { typeUrl: "/cosmos.group.v1.MsgCreateGroupResponse", aminoType: "cosmos-sdk/MsgCreateGroupResponse", + is(o: any): o is MsgCreateGroupResponse { + return o && (o.$typeUrl === MsgCreateGroupResponse.typeUrl || typeof o.groupId === "bigint"); + }, + isSDK(o: any): o is MsgCreateGroupResponseSDKType { + return o && (o.$typeUrl === MsgCreateGroupResponse.typeUrl || typeof o.group_id === "bigint"); + }, + isAmino(o: any): o is MsgCreateGroupResponseAmino { + return o && (o.$typeUrl === MsgCreateGroupResponse.typeUrl || typeof o.group_id === "bigint"); + }, encode(message: MsgCreateGroupResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.groupId !== BigInt(0)) { writer.uint32(8).uint64(message.groupId); @@ -1643,7 +1668,8 @@ export const MsgCreateGroupResponse = { typeUrl: "/cosmos.group.v1.MsgCreateGroupResponse", value: MsgCreateGroupResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgUpdateGroupMembers(): MsgUpdateGroupMembers { return { @@ -1661,6 +1687,15 @@ function createBaseMsgUpdateGroupMembers(): MsgUpdateGroupMembers { export const MsgUpdateGroupMembers = { typeUrl: "/cosmos.group.v1.MsgUpdateGroupMembers", aminoType: "cosmos-sdk/MsgUpdateGroupMembers", + is(o: any): o is MsgUpdateGroupMembers { + return o && (o.$typeUrl === MsgUpdateGroupMembers.typeUrl || typeof o.admin === "string" && typeof o.groupId === "bigint" && Array.isArray(o.memberUpdates) && (!o.memberUpdates.length || Member.is(o.memberUpdates[0]))); + }, + isSDK(o: any): o is MsgUpdateGroupMembersSDKType { + return o && (o.$typeUrl === MsgUpdateGroupMembers.typeUrl || typeof o.admin === "string" && typeof o.group_id === "bigint" && Array.isArray(o.member_updates) && (!o.member_updates.length || Member.isSDK(o.member_updates[0]))); + }, + isAmino(o: any): o is MsgUpdateGroupMembersAmino { + return o && (o.$typeUrl === MsgUpdateGroupMembers.typeUrl || typeof o.admin === "string" && typeof o.group_id === "bigint" && Array.isArray(o.member_updates) && (!o.member_updates.length || Member.isAmino(o.member_updates[0]))); + }, encode(message: MsgUpdateGroupMembers, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.admin !== "") { writer.uint32(10).string(message.admin); @@ -1783,6 +1818,12 @@ export const MsgUpdateGroupMembers = { typeUrl: "/cosmos.group.v1.MsgUpdateGroupMembers", value: MsgUpdateGroupMembers.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgUpdateGroupMembers.typeUrl)) { + return; + } + Member.registerTypeUrl(); } }; function createBaseMsgUpdateGroupMembersResponse(): MsgUpdateGroupMembersResponse { @@ -1797,6 +1838,15 @@ function createBaseMsgUpdateGroupMembersResponse(): MsgUpdateGroupMembersRespons export const MsgUpdateGroupMembersResponse = { typeUrl: "/cosmos.group.v1.MsgUpdateGroupMembersResponse", aminoType: "cosmos-sdk/MsgUpdateGroupMembersResponse", + is(o: any): o is MsgUpdateGroupMembersResponse { + return o && o.$typeUrl === MsgUpdateGroupMembersResponse.typeUrl; + }, + isSDK(o: any): o is MsgUpdateGroupMembersResponseSDKType { + return o && o.$typeUrl === MsgUpdateGroupMembersResponse.typeUrl; + }, + isAmino(o: any): o is MsgUpdateGroupMembersResponseAmino { + return o && o.$typeUrl === MsgUpdateGroupMembersResponse.typeUrl; + }, encode(_: MsgUpdateGroupMembersResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -1861,7 +1911,8 @@ export const MsgUpdateGroupMembersResponse = { typeUrl: "/cosmos.group.v1.MsgUpdateGroupMembersResponse", value: MsgUpdateGroupMembersResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgUpdateGroupAdmin(): MsgUpdateGroupAdmin { return { @@ -1879,6 +1930,15 @@ function createBaseMsgUpdateGroupAdmin(): MsgUpdateGroupAdmin { export const MsgUpdateGroupAdmin = { typeUrl: "/cosmos.group.v1.MsgUpdateGroupAdmin", aminoType: "cosmos-sdk/MsgUpdateGroupAdmin", + is(o: any): o is MsgUpdateGroupAdmin { + return o && (o.$typeUrl === MsgUpdateGroupAdmin.typeUrl || typeof o.admin === "string" && typeof o.groupId === "bigint" && typeof o.newAdmin === "string"); + }, + isSDK(o: any): o is MsgUpdateGroupAdminSDKType { + return o && (o.$typeUrl === MsgUpdateGroupAdmin.typeUrl || typeof o.admin === "string" && typeof o.group_id === "bigint" && typeof o.new_admin === "string"); + }, + isAmino(o: any): o is MsgUpdateGroupAdminAmino { + return o && (o.$typeUrl === MsgUpdateGroupAdmin.typeUrl || typeof o.admin === "string" && typeof o.group_id === "bigint" && typeof o.new_admin === "string"); + }, encode(message: MsgUpdateGroupAdmin, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.admin !== "") { writer.uint32(10).string(message.admin); @@ -1991,7 +2051,8 @@ export const MsgUpdateGroupAdmin = { typeUrl: "/cosmos.group.v1.MsgUpdateGroupAdmin", value: MsgUpdateGroupAdmin.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgUpdateGroupAdminResponse(): MsgUpdateGroupAdminResponse { return {}; @@ -2005,6 +2066,15 @@ function createBaseMsgUpdateGroupAdminResponse(): MsgUpdateGroupAdminResponse { export const MsgUpdateGroupAdminResponse = { typeUrl: "/cosmos.group.v1.MsgUpdateGroupAdminResponse", aminoType: "cosmos-sdk/MsgUpdateGroupAdminResponse", + is(o: any): o is MsgUpdateGroupAdminResponse { + return o && o.$typeUrl === MsgUpdateGroupAdminResponse.typeUrl; + }, + isSDK(o: any): o is MsgUpdateGroupAdminResponseSDKType { + return o && o.$typeUrl === MsgUpdateGroupAdminResponse.typeUrl; + }, + isAmino(o: any): o is MsgUpdateGroupAdminResponseAmino { + return o && o.$typeUrl === MsgUpdateGroupAdminResponse.typeUrl; + }, encode(_: MsgUpdateGroupAdminResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -2069,7 +2139,8 @@ export const MsgUpdateGroupAdminResponse = { typeUrl: "/cosmos.group.v1.MsgUpdateGroupAdminResponse", value: MsgUpdateGroupAdminResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgUpdateGroupMetadata(): MsgUpdateGroupMetadata { return { @@ -2087,6 +2158,15 @@ function createBaseMsgUpdateGroupMetadata(): MsgUpdateGroupMetadata { export const MsgUpdateGroupMetadata = { typeUrl: "/cosmos.group.v1.MsgUpdateGroupMetadata", aminoType: "cosmos-sdk/MsgUpdateGroupMetadata", + is(o: any): o is MsgUpdateGroupMetadata { + return o && (o.$typeUrl === MsgUpdateGroupMetadata.typeUrl || typeof o.admin === "string" && typeof o.groupId === "bigint" && typeof o.metadata === "string"); + }, + isSDK(o: any): o is MsgUpdateGroupMetadataSDKType { + return o && (o.$typeUrl === MsgUpdateGroupMetadata.typeUrl || typeof o.admin === "string" && typeof o.group_id === "bigint" && typeof o.metadata === "string"); + }, + isAmino(o: any): o is MsgUpdateGroupMetadataAmino { + return o && (o.$typeUrl === MsgUpdateGroupMetadata.typeUrl || typeof o.admin === "string" && typeof o.group_id === "bigint" && typeof o.metadata === "string"); + }, encode(message: MsgUpdateGroupMetadata, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.admin !== "") { writer.uint32(10).string(message.admin); @@ -2199,7 +2279,8 @@ export const MsgUpdateGroupMetadata = { typeUrl: "/cosmos.group.v1.MsgUpdateGroupMetadata", value: MsgUpdateGroupMetadata.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgUpdateGroupMetadataResponse(): MsgUpdateGroupMetadataResponse { return {}; @@ -2213,6 +2294,15 @@ function createBaseMsgUpdateGroupMetadataResponse(): MsgUpdateGroupMetadataRespo export const MsgUpdateGroupMetadataResponse = { typeUrl: "/cosmos.group.v1.MsgUpdateGroupMetadataResponse", aminoType: "cosmos-sdk/MsgUpdateGroupMetadataResponse", + is(o: any): o is MsgUpdateGroupMetadataResponse { + return o && o.$typeUrl === MsgUpdateGroupMetadataResponse.typeUrl; + }, + isSDK(o: any): o is MsgUpdateGroupMetadataResponseSDKType { + return o && o.$typeUrl === MsgUpdateGroupMetadataResponse.typeUrl; + }, + isAmino(o: any): o is MsgUpdateGroupMetadataResponseAmino { + return o && o.$typeUrl === MsgUpdateGroupMetadataResponse.typeUrl; + }, encode(_: MsgUpdateGroupMetadataResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -2277,7 +2367,8 @@ export const MsgUpdateGroupMetadataResponse = { typeUrl: "/cosmos.group.v1.MsgUpdateGroupMetadataResponse", value: MsgUpdateGroupMetadataResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgCreateGroupPolicy(): MsgCreateGroupPolicy { return { @@ -2296,6 +2387,15 @@ function createBaseMsgCreateGroupPolicy(): MsgCreateGroupPolicy { export const MsgCreateGroupPolicy = { typeUrl: "/cosmos.group.v1.MsgCreateGroupPolicy", aminoType: "cosmos-sdk/MsgCreateGroupPolicy", + is(o: any): o is MsgCreateGroupPolicy { + return o && (o.$typeUrl === MsgCreateGroupPolicy.typeUrl || typeof o.admin === "string" && typeof o.groupId === "bigint" && typeof o.metadata === "string"); + }, + isSDK(o: any): o is MsgCreateGroupPolicySDKType { + return o && (o.$typeUrl === MsgCreateGroupPolicy.typeUrl || typeof o.admin === "string" && typeof o.group_id === "bigint" && typeof o.metadata === "string"); + }, + isAmino(o: any): o is MsgCreateGroupPolicyAmino { + return o && (o.$typeUrl === MsgCreateGroupPolicy.typeUrl || typeof o.admin === "string" && typeof o.group_id === "bigint" && typeof o.metadata === "string"); + }, encode(message: MsgCreateGroupPolicy, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.admin !== "") { writer.uint32(10).string(message.admin); @@ -2307,7 +2407,7 @@ export const MsgCreateGroupPolicy = { writer.uint32(26).string(message.metadata); } if (message.decisionPolicy !== undefined) { - Any.encode((message.decisionPolicy as Any), writer.uint32(34).fork()).ldelim(); + Any.encode(GlobalDecoderRegistry.wrapAny(message.decisionPolicy), writer.uint32(34).fork()).ldelim(); } return writer; }, @@ -2328,7 +2428,7 @@ export const MsgCreateGroupPolicy = { message.metadata = reader.string(); break; case 4: - message.decisionPolicy = (DecisionPolicy_InterfaceDecoder(reader) as Any); + message.decisionPolicy = GlobalDecoderRegistry.unwrapAny(reader); break; default: reader.skipType(tag & 7); @@ -2342,7 +2442,7 @@ export const MsgCreateGroupPolicy = { if (isSet(object.admin)) obj.admin = String(object.admin); if (isSet(object.groupId)) obj.groupId = BigInt(object.groupId.toString()); if (isSet(object.metadata)) obj.metadata = String(object.metadata); - if (isSet(object.decisionPolicy)) obj.decisionPolicy = Any.fromJSON(object.decisionPolicy); + if (isSet(object.decisionPolicy)) obj.decisionPolicy = GlobalDecoderRegistry.fromJSON(object.decisionPolicy); return obj; }, toJSON(message: MsgCreateGroupPolicy): JsonSafe { @@ -2350,7 +2450,7 @@ export const MsgCreateGroupPolicy = { message.admin !== undefined && (obj.admin = message.admin); message.groupId !== undefined && (obj.groupId = (message.groupId || BigInt(0)).toString()); message.metadata !== undefined && (obj.metadata = message.metadata); - message.decisionPolicy !== undefined && (obj.decisionPolicy = message.decisionPolicy ? Any.toJSON(message.decisionPolicy) : undefined); + message.decisionPolicy !== undefined && (obj.decisionPolicy = message.decisionPolicy ? GlobalDecoderRegistry.toJSON(message.decisionPolicy) : undefined); return obj; }, fromPartial(object: DeepPartial): MsgCreateGroupPolicy { @@ -2361,7 +2461,7 @@ export const MsgCreateGroupPolicy = { } message.metadata = object.metadata ?? ""; if (object.decisionPolicy !== undefined && object.decisionPolicy !== null) { - message.decisionPolicy = Any.fromPartial(object.decisionPolicy); + message.decisionPolicy = GlobalDecoderRegistry.fromPartial(object.decisionPolicy); } return message; }, @@ -2370,7 +2470,7 @@ export const MsgCreateGroupPolicy = { admin: object?.admin, groupId: object?.group_id, metadata: object?.metadata, - decisionPolicy: object.decision_policy ? Any.fromSDK(object.decision_policy) : undefined + decisionPolicy: object.decision_policy ? GlobalDecoderRegistry.fromSDK(object.decision_policy) : undefined }; }, toSDK(message: MsgCreateGroupPolicy): MsgCreateGroupPolicySDKType { @@ -2378,7 +2478,7 @@ export const MsgCreateGroupPolicy = { obj.admin = message.admin; obj.group_id = message.groupId; obj.metadata = message.metadata; - message.decisionPolicy !== undefined && (obj.decision_policy = message.decisionPolicy ? Any.toSDK(message.decisionPolicy) : undefined); + message.decisionPolicy !== undefined && (obj.decision_policy = message.decisionPolicy ? GlobalDecoderRegistry.toSDK(message.decisionPolicy) : undefined); return obj; }, fromAmino(object: MsgCreateGroupPolicyAmino): MsgCreateGroupPolicy { @@ -2393,7 +2493,7 @@ export const MsgCreateGroupPolicy = { message.metadata = object.metadata; } if (object.decision_policy !== undefined && object.decision_policy !== null) { - message.decisionPolicy = DecisionPolicy_FromAmino(object.decision_policy); + message.decisionPolicy = GlobalDecoderRegistry.fromAminoMsg(object.decision_policy); } return message; }, @@ -2402,7 +2502,7 @@ export const MsgCreateGroupPolicy = { obj.admin = message.admin === "" ? undefined : message.admin; obj.group_id = message.groupId !== BigInt(0) ? message.groupId?.toString() : undefined; obj.metadata = message.metadata === "" ? undefined : message.metadata; - obj.decision_policy = message.decisionPolicy ? DecisionPolicy_ToAmino((message.decisionPolicy as Any)) : undefined; + obj.decision_policy = message.decisionPolicy ? GlobalDecoderRegistry.toAminoMsg(message.decisionPolicy) : undefined; return obj; }, fromAminoMsg(object: MsgCreateGroupPolicyAminoMsg): MsgCreateGroupPolicy { @@ -2425,6 +2525,13 @@ export const MsgCreateGroupPolicy = { typeUrl: "/cosmos.group.v1.MsgCreateGroupPolicy", value: MsgCreateGroupPolicy.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgCreateGroupPolicy.typeUrl)) { + return; + } + ThresholdDecisionPolicy.registerTypeUrl(); + PercentageDecisionPolicy.registerTypeUrl(); } }; function createBaseMsgCreateGroupPolicyResponse(): MsgCreateGroupPolicyResponse { @@ -2441,6 +2548,15 @@ function createBaseMsgCreateGroupPolicyResponse(): MsgCreateGroupPolicyResponse export const MsgCreateGroupPolicyResponse = { typeUrl: "/cosmos.group.v1.MsgCreateGroupPolicyResponse", aminoType: "cosmos-sdk/MsgCreateGroupPolicyResponse", + is(o: any): o is MsgCreateGroupPolicyResponse { + return o && (o.$typeUrl === MsgCreateGroupPolicyResponse.typeUrl || typeof o.address === "string"); + }, + isSDK(o: any): o is MsgCreateGroupPolicyResponseSDKType { + return o && (o.$typeUrl === MsgCreateGroupPolicyResponse.typeUrl || typeof o.address === "string"); + }, + isAmino(o: any): o is MsgCreateGroupPolicyResponseAmino { + return o && (o.$typeUrl === MsgCreateGroupPolicyResponse.typeUrl || typeof o.address === "string"); + }, encode(message: MsgCreateGroupPolicyResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.address !== "") { writer.uint32(10).string(message.address); @@ -2521,7 +2637,8 @@ export const MsgCreateGroupPolicyResponse = { typeUrl: "/cosmos.group.v1.MsgCreateGroupPolicyResponse", value: MsgCreateGroupPolicyResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgUpdateGroupPolicyAdmin(): MsgUpdateGroupPolicyAdmin { return { @@ -2539,6 +2656,15 @@ function createBaseMsgUpdateGroupPolicyAdmin(): MsgUpdateGroupPolicyAdmin { export const MsgUpdateGroupPolicyAdmin = { typeUrl: "/cosmos.group.v1.MsgUpdateGroupPolicyAdmin", aminoType: "cosmos-sdk/MsgUpdateGroupPolicyAdmin", + is(o: any): o is MsgUpdateGroupPolicyAdmin { + return o && (o.$typeUrl === MsgUpdateGroupPolicyAdmin.typeUrl || typeof o.admin === "string" && typeof o.address === "string" && typeof o.newAdmin === "string"); + }, + isSDK(o: any): o is MsgUpdateGroupPolicyAdminSDKType { + return o && (o.$typeUrl === MsgUpdateGroupPolicyAdmin.typeUrl || typeof o.admin === "string" && typeof o.address === "string" && typeof o.new_admin === "string"); + }, + isAmino(o: any): o is MsgUpdateGroupPolicyAdminAmino { + return o && (o.$typeUrl === MsgUpdateGroupPolicyAdmin.typeUrl || typeof o.admin === "string" && typeof o.address === "string" && typeof o.new_admin === "string"); + }, encode(message: MsgUpdateGroupPolicyAdmin, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.admin !== "") { writer.uint32(10).string(message.admin); @@ -2649,7 +2775,8 @@ export const MsgUpdateGroupPolicyAdmin = { typeUrl: "/cosmos.group.v1.MsgUpdateGroupPolicyAdmin", value: MsgUpdateGroupPolicyAdmin.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgCreateGroupWithPolicy(): MsgCreateGroupWithPolicy { return { @@ -2670,6 +2797,15 @@ function createBaseMsgCreateGroupWithPolicy(): MsgCreateGroupWithPolicy { export const MsgCreateGroupWithPolicy = { typeUrl: "/cosmos.group.v1.MsgCreateGroupWithPolicy", aminoType: "cosmos-sdk/MsgCreateGroupWithPolicy", + is(o: any): o is MsgCreateGroupWithPolicy { + return o && (o.$typeUrl === MsgCreateGroupWithPolicy.typeUrl || typeof o.admin === "string" && Array.isArray(o.members) && (!o.members.length || Member.is(o.members[0])) && typeof o.groupMetadata === "string" && typeof o.groupPolicyMetadata === "string" && typeof o.groupPolicyAsAdmin === "boolean"); + }, + isSDK(o: any): o is MsgCreateGroupWithPolicySDKType { + return o && (o.$typeUrl === MsgCreateGroupWithPolicy.typeUrl || typeof o.admin === "string" && Array.isArray(o.members) && (!o.members.length || Member.isSDK(o.members[0])) && typeof o.group_metadata === "string" && typeof o.group_policy_metadata === "string" && typeof o.group_policy_as_admin === "boolean"); + }, + isAmino(o: any): o is MsgCreateGroupWithPolicyAmino { + return o && (o.$typeUrl === MsgCreateGroupWithPolicy.typeUrl || typeof o.admin === "string" && Array.isArray(o.members) && (!o.members.length || Member.isAmino(o.members[0])) && typeof o.group_metadata === "string" && typeof o.group_policy_metadata === "string" && typeof o.group_policy_as_admin === "boolean"); + }, encode(message: MsgCreateGroupWithPolicy, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.admin !== "") { writer.uint32(10).string(message.admin); @@ -2687,7 +2823,7 @@ export const MsgCreateGroupWithPolicy = { writer.uint32(40).bool(message.groupPolicyAsAdmin); } if (message.decisionPolicy !== undefined) { - Any.encode((message.decisionPolicy as Any), writer.uint32(50).fork()).ldelim(); + Any.encode(GlobalDecoderRegistry.wrapAny(message.decisionPolicy), writer.uint32(50).fork()).ldelim(); } return writer; }, @@ -2714,7 +2850,7 @@ export const MsgCreateGroupWithPolicy = { message.groupPolicyAsAdmin = reader.bool(); break; case 6: - message.decisionPolicy = (DecisionPolicy_InterfaceDecoder(reader) as Any); + message.decisionPolicy = GlobalDecoderRegistry.unwrapAny(reader); break; default: reader.skipType(tag & 7); @@ -2730,7 +2866,7 @@ export const MsgCreateGroupWithPolicy = { if (isSet(object.groupMetadata)) obj.groupMetadata = String(object.groupMetadata); if (isSet(object.groupPolicyMetadata)) obj.groupPolicyMetadata = String(object.groupPolicyMetadata); if (isSet(object.groupPolicyAsAdmin)) obj.groupPolicyAsAdmin = Boolean(object.groupPolicyAsAdmin); - if (isSet(object.decisionPolicy)) obj.decisionPolicy = Any.fromJSON(object.decisionPolicy); + if (isSet(object.decisionPolicy)) obj.decisionPolicy = GlobalDecoderRegistry.fromJSON(object.decisionPolicy); return obj; }, toJSON(message: MsgCreateGroupWithPolicy): JsonSafe { @@ -2744,7 +2880,7 @@ export const MsgCreateGroupWithPolicy = { message.groupMetadata !== undefined && (obj.groupMetadata = message.groupMetadata); message.groupPolicyMetadata !== undefined && (obj.groupPolicyMetadata = message.groupPolicyMetadata); message.groupPolicyAsAdmin !== undefined && (obj.groupPolicyAsAdmin = message.groupPolicyAsAdmin); - message.decisionPolicy !== undefined && (obj.decisionPolicy = message.decisionPolicy ? Any.toJSON(message.decisionPolicy) : undefined); + message.decisionPolicy !== undefined && (obj.decisionPolicy = message.decisionPolicy ? GlobalDecoderRegistry.toJSON(message.decisionPolicy) : undefined); return obj; }, fromPartial(object: DeepPartial): MsgCreateGroupWithPolicy { @@ -2755,7 +2891,7 @@ export const MsgCreateGroupWithPolicy = { message.groupPolicyMetadata = object.groupPolicyMetadata ?? ""; message.groupPolicyAsAdmin = object.groupPolicyAsAdmin ?? false; if (object.decisionPolicy !== undefined && object.decisionPolicy !== null) { - message.decisionPolicy = Any.fromPartial(object.decisionPolicy); + message.decisionPolicy = GlobalDecoderRegistry.fromPartial(object.decisionPolicy); } return message; }, @@ -2766,7 +2902,7 @@ export const MsgCreateGroupWithPolicy = { groupMetadata: object?.group_metadata, groupPolicyMetadata: object?.group_policy_metadata, groupPolicyAsAdmin: object?.group_policy_as_admin, - decisionPolicy: object.decision_policy ? Any.fromSDK(object.decision_policy) : undefined + decisionPolicy: object.decision_policy ? GlobalDecoderRegistry.fromSDK(object.decision_policy) : undefined }; }, toSDK(message: MsgCreateGroupWithPolicy): MsgCreateGroupWithPolicySDKType { @@ -2780,7 +2916,7 @@ export const MsgCreateGroupWithPolicy = { obj.group_metadata = message.groupMetadata; obj.group_policy_metadata = message.groupPolicyMetadata; obj.group_policy_as_admin = message.groupPolicyAsAdmin; - message.decisionPolicy !== undefined && (obj.decision_policy = message.decisionPolicy ? Any.toSDK(message.decisionPolicy) : undefined); + message.decisionPolicy !== undefined && (obj.decision_policy = message.decisionPolicy ? GlobalDecoderRegistry.toSDK(message.decisionPolicy) : undefined); return obj; }, fromAmino(object: MsgCreateGroupWithPolicyAmino): MsgCreateGroupWithPolicy { @@ -2799,7 +2935,7 @@ export const MsgCreateGroupWithPolicy = { message.groupPolicyAsAdmin = object.group_policy_as_admin; } if (object.decision_policy !== undefined && object.decision_policy !== null) { - message.decisionPolicy = DecisionPolicy_FromAmino(object.decision_policy); + message.decisionPolicy = GlobalDecoderRegistry.fromAminoMsg(object.decision_policy); } return message; }, @@ -2814,7 +2950,7 @@ export const MsgCreateGroupWithPolicy = { obj.group_metadata = message.groupMetadata === "" ? undefined : message.groupMetadata; obj.group_policy_metadata = message.groupPolicyMetadata === "" ? undefined : message.groupPolicyMetadata; obj.group_policy_as_admin = message.groupPolicyAsAdmin === false ? undefined : message.groupPolicyAsAdmin; - obj.decision_policy = message.decisionPolicy ? DecisionPolicy_ToAmino((message.decisionPolicy as Any)) : undefined; + obj.decision_policy = message.decisionPolicy ? GlobalDecoderRegistry.toAminoMsg(message.decisionPolicy) : undefined; return obj; }, fromAminoMsg(object: MsgCreateGroupWithPolicyAminoMsg): MsgCreateGroupWithPolicy { @@ -2837,6 +2973,13 @@ export const MsgCreateGroupWithPolicy = { typeUrl: "/cosmos.group.v1.MsgCreateGroupWithPolicy", value: MsgCreateGroupWithPolicy.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgCreateGroupWithPolicy.typeUrl)) { + return; + } + ThresholdDecisionPolicy.registerTypeUrl(); + PercentageDecisionPolicy.registerTypeUrl(); } }; function createBaseMsgCreateGroupWithPolicyResponse(): MsgCreateGroupWithPolicyResponse { @@ -2854,6 +2997,15 @@ function createBaseMsgCreateGroupWithPolicyResponse(): MsgCreateGroupWithPolicyR export const MsgCreateGroupWithPolicyResponse = { typeUrl: "/cosmos.group.v1.MsgCreateGroupWithPolicyResponse", aminoType: "cosmos-sdk/MsgCreateGroupWithPolicyResponse", + is(o: any): o is MsgCreateGroupWithPolicyResponse { + return o && (o.$typeUrl === MsgCreateGroupWithPolicyResponse.typeUrl || typeof o.groupId === "bigint" && typeof o.groupPolicyAddress === "string"); + }, + isSDK(o: any): o is MsgCreateGroupWithPolicyResponseSDKType { + return o && (o.$typeUrl === MsgCreateGroupWithPolicyResponse.typeUrl || typeof o.group_id === "bigint" && typeof o.group_policy_address === "string"); + }, + isAmino(o: any): o is MsgCreateGroupWithPolicyResponseAmino { + return o && (o.$typeUrl === MsgCreateGroupWithPolicyResponse.typeUrl || typeof o.group_id === "bigint" && typeof o.group_policy_address === "string"); + }, encode(message: MsgCreateGroupWithPolicyResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.groupId !== BigInt(0)) { writer.uint32(8).uint64(message.groupId); @@ -2951,7 +3103,8 @@ export const MsgCreateGroupWithPolicyResponse = { typeUrl: "/cosmos.group.v1.MsgCreateGroupWithPolicyResponse", value: MsgCreateGroupWithPolicyResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgUpdateGroupPolicyAdminResponse(): MsgUpdateGroupPolicyAdminResponse { return {}; @@ -2965,6 +3118,15 @@ function createBaseMsgUpdateGroupPolicyAdminResponse(): MsgUpdateGroupPolicyAdmi export const MsgUpdateGroupPolicyAdminResponse = { typeUrl: "/cosmos.group.v1.MsgUpdateGroupPolicyAdminResponse", aminoType: "cosmos-sdk/MsgUpdateGroupPolicyAdminResponse", + is(o: any): o is MsgUpdateGroupPolicyAdminResponse { + return o && o.$typeUrl === MsgUpdateGroupPolicyAdminResponse.typeUrl; + }, + isSDK(o: any): o is MsgUpdateGroupPolicyAdminResponseSDKType { + return o && o.$typeUrl === MsgUpdateGroupPolicyAdminResponse.typeUrl; + }, + isAmino(o: any): o is MsgUpdateGroupPolicyAdminResponseAmino { + return o && o.$typeUrl === MsgUpdateGroupPolicyAdminResponse.typeUrl; + }, encode(_: MsgUpdateGroupPolicyAdminResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -3029,7 +3191,8 @@ export const MsgUpdateGroupPolicyAdminResponse = { typeUrl: "/cosmos.group.v1.MsgUpdateGroupPolicyAdminResponse", value: MsgUpdateGroupPolicyAdminResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgUpdateGroupPolicyDecisionPolicy(): MsgUpdateGroupPolicyDecisionPolicy { return { @@ -3047,6 +3210,15 @@ function createBaseMsgUpdateGroupPolicyDecisionPolicy(): MsgUpdateGroupPolicyDec export const MsgUpdateGroupPolicyDecisionPolicy = { typeUrl: "/cosmos.group.v1.MsgUpdateGroupPolicyDecisionPolicy", aminoType: "cosmos-sdk/MsgUpdateGroupPolicyDecisionPolicy", + is(o: any): o is MsgUpdateGroupPolicyDecisionPolicy { + return o && (o.$typeUrl === MsgUpdateGroupPolicyDecisionPolicy.typeUrl || typeof o.admin === "string" && typeof o.address === "string"); + }, + isSDK(o: any): o is MsgUpdateGroupPolicyDecisionPolicySDKType { + return o && (o.$typeUrl === MsgUpdateGroupPolicyDecisionPolicy.typeUrl || typeof o.admin === "string" && typeof o.address === "string"); + }, + isAmino(o: any): o is MsgUpdateGroupPolicyDecisionPolicyAmino { + return o && (o.$typeUrl === MsgUpdateGroupPolicyDecisionPolicy.typeUrl || typeof o.admin === "string" && typeof o.address === "string"); + }, encode(message: MsgUpdateGroupPolicyDecisionPolicy, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.admin !== "") { writer.uint32(10).string(message.admin); @@ -3055,7 +3227,7 @@ export const MsgUpdateGroupPolicyDecisionPolicy = { writer.uint32(18).string(message.address); } if (message.decisionPolicy !== undefined) { - Any.encode((message.decisionPolicy as Any), writer.uint32(26).fork()).ldelim(); + Any.encode(GlobalDecoderRegistry.wrapAny(message.decisionPolicy), writer.uint32(26).fork()).ldelim(); } return writer; }, @@ -3073,7 +3245,7 @@ export const MsgUpdateGroupPolicyDecisionPolicy = { message.address = reader.string(); break; case 3: - message.decisionPolicy = (DecisionPolicy_InterfaceDecoder(reader) as Any); + message.decisionPolicy = GlobalDecoderRegistry.unwrapAny(reader); break; default: reader.skipType(tag & 7); @@ -3086,14 +3258,14 @@ export const MsgUpdateGroupPolicyDecisionPolicy = { const obj = createBaseMsgUpdateGroupPolicyDecisionPolicy(); if (isSet(object.admin)) obj.admin = String(object.admin); if (isSet(object.address)) obj.address = String(object.address); - if (isSet(object.decisionPolicy)) obj.decisionPolicy = Any.fromJSON(object.decisionPolicy); + if (isSet(object.decisionPolicy)) obj.decisionPolicy = GlobalDecoderRegistry.fromJSON(object.decisionPolicy); return obj; }, toJSON(message: MsgUpdateGroupPolicyDecisionPolicy): JsonSafe { const obj: any = {}; message.admin !== undefined && (obj.admin = message.admin); message.address !== undefined && (obj.address = message.address); - message.decisionPolicy !== undefined && (obj.decisionPolicy = message.decisionPolicy ? Any.toJSON(message.decisionPolicy) : undefined); + message.decisionPolicy !== undefined && (obj.decisionPolicy = message.decisionPolicy ? GlobalDecoderRegistry.toJSON(message.decisionPolicy) : undefined); return obj; }, fromPartial(object: DeepPartial): MsgUpdateGroupPolicyDecisionPolicy { @@ -3101,7 +3273,7 @@ export const MsgUpdateGroupPolicyDecisionPolicy = { message.admin = object.admin ?? ""; message.address = object.address ?? ""; if (object.decisionPolicy !== undefined && object.decisionPolicy !== null) { - message.decisionPolicy = Any.fromPartial(object.decisionPolicy); + message.decisionPolicy = GlobalDecoderRegistry.fromPartial(object.decisionPolicy); } return message; }, @@ -3109,14 +3281,14 @@ export const MsgUpdateGroupPolicyDecisionPolicy = { return { admin: object?.admin, address: object?.address, - decisionPolicy: object.decision_policy ? Any.fromSDK(object.decision_policy) : undefined + decisionPolicy: object.decision_policy ? GlobalDecoderRegistry.fromSDK(object.decision_policy) : undefined }; }, toSDK(message: MsgUpdateGroupPolicyDecisionPolicy): MsgUpdateGroupPolicyDecisionPolicySDKType { const obj: any = {}; obj.admin = message.admin; obj.address = message.address; - message.decisionPolicy !== undefined && (obj.decision_policy = message.decisionPolicy ? Any.toSDK(message.decisionPolicy) : undefined); + message.decisionPolicy !== undefined && (obj.decision_policy = message.decisionPolicy ? GlobalDecoderRegistry.toSDK(message.decisionPolicy) : undefined); return obj; }, fromAmino(object: MsgUpdateGroupPolicyDecisionPolicyAmino): MsgUpdateGroupPolicyDecisionPolicy { @@ -3128,7 +3300,7 @@ export const MsgUpdateGroupPolicyDecisionPolicy = { message.address = object.address; } if (object.decision_policy !== undefined && object.decision_policy !== null) { - message.decisionPolicy = DecisionPolicy_FromAmino(object.decision_policy); + message.decisionPolicy = GlobalDecoderRegistry.fromAminoMsg(object.decision_policy); } return message; }, @@ -3136,7 +3308,7 @@ export const MsgUpdateGroupPolicyDecisionPolicy = { const obj: any = {}; obj.admin = message.admin === "" ? undefined : message.admin; obj.address = message.address === "" ? undefined : message.address; - obj.decision_policy = message.decisionPolicy ? DecisionPolicy_ToAmino((message.decisionPolicy as Any)) : undefined; + obj.decision_policy = message.decisionPolicy ? GlobalDecoderRegistry.toAminoMsg(message.decisionPolicy) : undefined; return obj; }, fromAminoMsg(object: MsgUpdateGroupPolicyDecisionPolicyAminoMsg): MsgUpdateGroupPolicyDecisionPolicy { @@ -3159,6 +3331,13 @@ export const MsgUpdateGroupPolicyDecisionPolicy = { typeUrl: "/cosmos.group.v1.MsgUpdateGroupPolicyDecisionPolicy", value: MsgUpdateGroupPolicyDecisionPolicy.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgUpdateGroupPolicyDecisionPolicy.typeUrl)) { + return; + } + ThresholdDecisionPolicy.registerTypeUrl(); + PercentageDecisionPolicy.registerTypeUrl(); } }; function createBaseMsgUpdateGroupPolicyDecisionPolicyResponse(): MsgUpdateGroupPolicyDecisionPolicyResponse { @@ -3173,6 +3352,15 @@ function createBaseMsgUpdateGroupPolicyDecisionPolicyResponse(): MsgUpdateGroupP export const MsgUpdateGroupPolicyDecisionPolicyResponse = { typeUrl: "/cosmos.group.v1.MsgUpdateGroupPolicyDecisionPolicyResponse", aminoType: "cosmos-sdk/MsgUpdateGroupPolicyDecisionPolicyResponse", + is(o: any): o is MsgUpdateGroupPolicyDecisionPolicyResponse { + return o && o.$typeUrl === MsgUpdateGroupPolicyDecisionPolicyResponse.typeUrl; + }, + isSDK(o: any): o is MsgUpdateGroupPolicyDecisionPolicyResponseSDKType { + return o && o.$typeUrl === MsgUpdateGroupPolicyDecisionPolicyResponse.typeUrl; + }, + isAmino(o: any): o is MsgUpdateGroupPolicyDecisionPolicyResponseAmino { + return o && o.$typeUrl === MsgUpdateGroupPolicyDecisionPolicyResponse.typeUrl; + }, encode(_: MsgUpdateGroupPolicyDecisionPolicyResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -3237,7 +3425,8 @@ export const MsgUpdateGroupPolicyDecisionPolicyResponse = { typeUrl: "/cosmos.group.v1.MsgUpdateGroupPolicyDecisionPolicyResponse", value: MsgUpdateGroupPolicyDecisionPolicyResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgUpdateGroupPolicyMetadata(): MsgUpdateGroupPolicyMetadata { return { @@ -3255,6 +3444,15 @@ function createBaseMsgUpdateGroupPolicyMetadata(): MsgUpdateGroupPolicyMetadata export const MsgUpdateGroupPolicyMetadata = { typeUrl: "/cosmos.group.v1.MsgUpdateGroupPolicyMetadata", aminoType: "cosmos-sdk/MsgUpdateGroupPolicyMetadata", + is(o: any): o is MsgUpdateGroupPolicyMetadata { + return o && (o.$typeUrl === MsgUpdateGroupPolicyMetadata.typeUrl || typeof o.admin === "string" && typeof o.address === "string" && typeof o.metadata === "string"); + }, + isSDK(o: any): o is MsgUpdateGroupPolicyMetadataSDKType { + return o && (o.$typeUrl === MsgUpdateGroupPolicyMetadata.typeUrl || typeof o.admin === "string" && typeof o.address === "string" && typeof o.metadata === "string"); + }, + isAmino(o: any): o is MsgUpdateGroupPolicyMetadataAmino { + return o && (o.$typeUrl === MsgUpdateGroupPolicyMetadata.typeUrl || typeof o.admin === "string" && typeof o.address === "string" && typeof o.metadata === "string"); + }, encode(message: MsgUpdateGroupPolicyMetadata, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.admin !== "") { writer.uint32(10).string(message.admin); @@ -3365,7 +3563,8 @@ export const MsgUpdateGroupPolicyMetadata = { typeUrl: "/cosmos.group.v1.MsgUpdateGroupPolicyMetadata", value: MsgUpdateGroupPolicyMetadata.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgUpdateGroupPolicyMetadataResponse(): MsgUpdateGroupPolicyMetadataResponse { return {}; @@ -3379,6 +3578,15 @@ function createBaseMsgUpdateGroupPolicyMetadataResponse(): MsgUpdateGroupPolicyM export const MsgUpdateGroupPolicyMetadataResponse = { typeUrl: "/cosmos.group.v1.MsgUpdateGroupPolicyMetadataResponse", aminoType: "cosmos-sdk/MsgUpdateGroupPolicyMetadataResponse", + is(o: any): o is MsgUpdateGroupPolicyMetadataResponse { + return o && o.$typeUrl === MsgUpdateGroupPolicyMetadataResponse.typeUrl; + }, + isSDK(o: any): o is MsgUpdateGroupPolicyMetadataResponseSDKType { + return o && o.$typeUrl === MsgUpdateGroupPolicyMetadataResponse.typeUrl; + }, + isAmino(o: any): o is MsgUpdateGroupPolicyMetadataResponseAmino { + return o && o.$typeUrl === MsgUpdateGroupPolicyMetadataResponse.typeUrl; + }, encode(_: MsgUpdateGroupPolicyMetadataResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -3443,7 +3651,8 @@ export const MsgUpdateGroupPolicyMetadataResponse = { typeUrl: "/cosmos.group.v1.MsgUpdateGroupPolicyMetadataResponse", value: MsgUpdateGroupPolicyMetadataResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgSubmitProposal(): MsgSubmitProposal { return { @@ -3463,6 +3672,15 @@ function createBaseMsgSubmitProposal(): MsgSubmitProposal { export const MsgSubmitProposal = { typeUrl: "/cosmos.group.v1.MsgSubmitProposal", aminoType: "cosmos-sdk/group/MsgSubmitProposal", + is(o: any): o is MsgSubmitProposal { + return o && (o.$typeUrl === MsgSubmitProposal.typeUrl || typeof o.address === "string" && Array.isArray(o.proposers) && (!o.proposers.length || typeof o.proposers[0] === "string") && typeof o.metadata === "string" && Array.isArray(o.messages) && (!o.messages.length || Any.is(o.messages[0])) && isSet(o.exec)); + }, + isSDK(o: any): o is MsgSubmitProposalSDKType { + return o && (o.$typeUrl === MsgSubmitProposal.typeUrl || typeof o.address === "string" && Array.isArray(o.proposers) && (!o.proposers.length || typeof o.proposers[0] === "string") && typeof o.metadata === "string" && Array.isArray(o.messages) && (!o.messages.length || Any.isSDK(o.messages[0])) && isSet(o.exec)); + }, + isAmino(o: any): o is MsgSubmitProposalAmino { + return o && (o.$typeUrl === MsgSubmitProposal.typeUrl || typeof o.address === "string" && Array.isArray(o.proposers) && (!o.proposers.length || typeof o.proposers[0] === "string") && typeof o.metadata === "string" && Array.isArray(o.messages) && (!o.messages.length || Any.isAmino(o.messages[0])) && isSet(o.exec)); + }, encode(message: MsgSubmitProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.address !== "") { writer.uint32(10).string(message.address); @@ -3623,7 +3841,8 @@ export const MsgSubmitProposal = { typeUrl: "/cosmos.group.v1.MsgSubmitProposal", value: MsgSubmitProposal.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgSubmitProposalResponse(): MsgSubmitProposalResponse { return { @@ -3639,6 +3858,15 @@ function createBaseMsgSubmitProposalResponse(): MsgSubmitProposalResponse { export const MsgSubmitProposalResponse = { typeUrl: "/cosmos.group.v1.MsgSubmitProposalResponse", aminoType: "cosmos-sdk/MsgSubmitProposalResponse", + is(o: any): o is MsgSubmitProposalResponse { + return o && (o.$typeUrl === MsgSubmitProposalResponse.typeUrl || typeof o.proposalId === "bigint"); + }, + isSDK(o: any): o is MsgSubmitProposalResponseSDKType { + return o && (o.$typeUrl === MsgSubmitProposalResponse.typeUrl || typeof o.proposal_id === "bigint"); + }, + isAmino(o: any): o is MsgSubmitProposalResponseAmino { + return o && (o.$typeUrl === MsgSubmitProposalResponse.typeUrl || typeof o.proposal_id === "bigint"); + }, encode(message: MsgSubmitProposalResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.proposalId !== BigInt(0)) { writer.uint32(8).uint64(message.proposalId); @@ -3721,7 +3949,8 @@ export const MsgSubmitProposalResponse = { typeUrl: "/cosmos.group.v1.MsgSubmitProposalResponse", value: MsgSubmitProposalResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgWithdrawProposal(): MsgWithdrawProposal { return { @@ -3738,6 +3967,15 @@ function createBaseMsgWithdrawProposal(): MsgWithdrawProposal { export const MsgWithdrawProposal = { typeUrl: "/cosmos.group.v1.MsgWithdrawProposal", aminoType: "cosmos-sdk/group/MsgWithdrawProposal", + is(o: any): o is MsgWithdrawProposal { + return o && (o.$typeUrl === MsgWithdrawProposal.typeUrl || typeof o.proposalId === "bigint" && typeof o.address === "string"); + }, + isSDK(o: any): o is MsgWithdrawProposalSDKType { + return o && (o.$typeUrl === MsgWithdrawProposal.typeUrl || typeof o.proposal_id === "bigint" && typeof o.address === "string"); + }, + isAmino(o: any): o is MsgWithdrawProposalAmino { + return o && (o.$typeUrl === MsgWithdrawProposal.typeUrl || typeof o.proposal_id === "bigint" && typeof o.address === "string"); + }, encode(message: MsgWithdrawProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.proposalId !== BigInt(0)) { writer.uint32(8).uint64(message.proposalId); @@ -3835,7 +4073,8 @@ export const MsgWithdrawProposal = { typeUrl: "/cosmos.group.v1.MsgWithdrawProposal", value: MsgWithdrawProposal.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgWithdrawProposalResponse(): MsgWithdrawProposalResponse { return {}; @@ -3849,6 +4088,15 @@ function createBaseMsgWithdrawProposalResponse(): MsgWithdrawProposalResponse { export const MsgWithdrawProposalResponse = { typeUrl: "/cosmos.group.v1.MsgWithdrawProposalResponse", aminoType: "cosmos-sdk/MsgWithdrawProposalResponse", + is(o: any): o is MsgWithdrawProposalResponse { + return o && o.$typeUrl === MsgWithdrawProposalResponse.typeUrl; + }, + isSDK(o: any): o is MsgWithdrawProposalResponseSDKType { + return o && o.$typeUrl === MsgWithdrawProposalResponse.typeUrl; + }, + isAmino(o: any): o is MsgWithdrawProposalResponseAmino { + return o && o.$typeUrl === MsgWithdrawProposalResponse.typeUrl; + }, encode(_: MsgWithdrawProposalResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -3913,7 +4161,8 @@ export const MsgWithdrawProposalResponse = { typeUrl: "/cosmos.group.v1.MsgWithdrawProposalResponse", value: MsgWithdrawProposalResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgVote(): MsgVote { return { @@ -3933,6 +4182,15 @@ function createBaseMsgVote(): MsgVote { export const MsgVote = { typeUrl: "/cosmos.group.v1.MsgVote", aminoType: "cosmos-sdk/group/MsgVote", + is(o: any): o is MsgVote { + return o && (o.$typeUrl === MsgVote.typeUrl || typeof o.proposalId === "bigint" && typeof o.voter === "string" && isSet(o.option) && typeof o.metadata === "string" && isSet(o.exec)); + }, + isSDK(o: any): o is MsgVoteSDKType { + return o && (o.$typeUrl === MsgVote.typeUrl || typeof o.proposal_id === "bigint" && typeof o.voter === "string" && isSet(o.option) && typeof o.metadata === "string" && isSet(o.exec)); + }, + isAmino(o: any): o is MsgVoteAmino { + return o && (o.$typeUrl === MsgVote.typeUrl || typeof o.proposal_id === "bigint" && typeof o.voter === "string" && isSet(o.option) && typeof o.metadata === "string" && isSet(o.exec)); + }, encode(message: MsgVote, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.proposalId !== BigInt(0)) { writer.uint32(8).uint64(message.proposalId); @@ -4075,7 +4333,8 @@ export const MsgVote = { typeUrl: "/cosmos.group.v1.MsgVote", value: MsgVote.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgVoteResponse(): MsgVoteResponse { return {}; @@ -4089,6 +4348,15 @@ function createBaseMsgVoteResponse(): MsgVoteResponse { export const MsgVoteResponse = { typeUrl: "/cosmos.group.v1.MsgVoteResponse", aminoType: "cosmos-sdk/MsgVoteResponse", + is(o: any): o is MsgVoteResponse { + return o && o.$typeUrl === MsgVoteResponse.typeUrl; + }, + isSDK(o: any): o is MsgVoteResponseSDKType { + return o && o.$typeUrl === MsgVoteResponse.typeUrl; + }, + isAmino(o: any): o is MsgVoteResponseAmino { + return o && o.$typeUrl === MsgVoteResponse.typeUrl; + }, encode(_: MsgVoteResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -4153,7 +4421,8 @@ export const MsgVoteResponse = { typeUrl: "/cosmos.group.v1.MsgVoteResponse", value: MsgVoteResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgExec(): MsgExec { return { @@ -4170,6 +4439,15 @@ function createBaseMsgExec(): MsgExec { export const MsgExec = { typeUrl: "/cosmos.group.v1.MsgExec", aminoType: "cosmos-sdk/group/MsgExec", + is(o: any): o is MsgExec { + return o && (o.$typeUrl === MsgExec.typeUrl || typeof o.proposalId === "bigint" && typeof o.signer === "string"); + }, + isSDK(o: any): o is MsgExecSDKType { + return o && (o.$typeUrl === MsgExec.typeUrl || typeof o.proposal_id === "bigint" && typeof o.signer === "string"); + }, + isAmino(o: any): o is MsgExecAmino { + return o && (o.$typeUrl === MsgExec.typeUrl || typeof o.proposal_id === "bigint" && typeof o.signer === "string"); + }, encode(message: MsgExec, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.proposalId !== BigInt(0)) { writer.uint32(8).uint64(message.proposalId); @@ -4267,7 +4545,8 @@ export const MsgExec = { typeUrl: "/cosmos.group.v1.MsgExec", value: MsgExec.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgExecResponse(): MsgExecResponse { return {}; @@ -4281,6 +4560,15 @@ function createBaseMsgExecResponse(): MsgExecResponse { export const MsgExecResponse = { typeUrl: "/cosmos.group.v1.MsgExecResponse", aminoType: "cosmos-sdk/MsgExecResponse", + is(o: any): o is MsgExecResponse { + return o && o.$typeUrl === MsgExecResponse.typeUrl; + }, + isSDK(o: any): o is MsgExecResponseSDKType { + return o && o.$typeUrl === MsgExecResponse.typeUrl; + }, + isAmino(o: any): o is MsgExecResponseAmino { + return o && o.$typeUrl === MsgExecResponse.typeUrl; + }, encode(_: MsgExecResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -4345,7 +4633,8 @@ export const MsgExecResponse = { typeUrl: "/cosmos.group.v1.MsgExecResponse", value: MsgExecResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgLeaveGroup(): MsgLeaveGroup { return { @@ -4362,6 +4651,15 @@ function createBaseMsgLeaveGroup(): MsgLeaveGroup { export const MsgLeaveGroup = { typeUrl: "/cosmos.group.v1.MsgLeaveGroup", aminoType: "cosmos-sdk/group/MsgLeaveGroup", + is(o: any): o is MsgLeaveGroup { + return o && (o.$typeUrl === MsgLeaveGroup.typeUrl || typeof o.address === "string" && typeof o.groupId === "bigint"); + }, + isSDK(o: any): o is MsgLeaveGroupSDKType { + return o && (o.$typeUrl === MsgLeaveGroup.typeUrl || typeof o.address === "string" && typeof o.group_id === "bigint"); + }, + isAmino(o: any): o is MsgLeaveGroupAmino { + return o && (o.$typeUrl === MsgLeaveGroup.typeUrl || typeof o.address === "string" && typeof o.group_id === "bigint"); + }, encode(message: MsgLeaveGroup, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.address !== "") { writer.uint32(10).string(message.address); @@ -4459,7 +4757,8 @@ export const MsgLeaveGroup = { typeUrl: "/cosmos.group.v1.MsgLeaveGroup", value: MsgLeaveGroup.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgLeaveGroupResponse(): MsgLeaveGroupResponse { return {}; @@ -4473,6 +4772,15 @@ function createBaseMsgLeaveGroupResponse(): MsgLeaveGroupResponse { export const MsgLeaveGroupResponse = { typeUrl: "/cosmos.group.v1.MsgLeaveGroupResponse", aminoType: "cosmos-sdk/MsgLeaveGroupResponse", + is(o: any): o is MsgLeaveGroupResponse { + return o && o.$typeUrl === MsgLeaveGroupResponse.typeUrl; + }, + isSDK(o: any): o is MsgLeaveGroupResponseSDKType { + return o && o.$typeUrl === MsgLeaveGroupResponse.typeUrl; + }, + isAmino(o: any): o is MsgLeaveGroupResponseAmino { + return o && o.$typeUrl === MsgLeaveGroupResponse.typeUrl; + }, encode(_: MsgLeaveGroupResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -4537,49 +4845,6 @@ export const MsgLeaveGroupResponse = { typeUrl: "/cosmos.group.v1.MsgLeaveGroupResponse", value: MsgLeaveGroupResponse.encode(message).finish() }; - } -}; -export const DecisionPolicy_InterfaceDecoder = (input: BinaryReader | Uint8Array): ThresholdDecisionPolicy | PercentageDecisionPolicy | Any => { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - const data = Any.decode(reader, reader.uint32()); - switch (data.typeUrl) { - case "/cosmos.group.v1.ThresholdDecisionPolicy": - return ThresholdDecisionPolicy.decode(data.value); - case "/cosmos.group.v1.PercentageDecisionPolicy": - return PercentageDecisionPolicy.decode(data.value); - default: - return data; - } -}; -export const DecisionPolicy_FromAmino = (content: AnyAmino): Any => { - switch (content.type) { - case "cosmos-sdk/ThresholdDecisionPolicy": - return Any.fromPartial({ - typeUrl: "/cosmos.group.v1.ThresholdDecisionPolicy", - value: ThresholdDecisionPolicy.encode(ThresholdDecisionPolicy.fromPartial(ThresholdDecisionPolicy.fromAmino(content.value))).finish() - }); - case "cosmos-sdk/PercentageDecisionPolicy": - return Any.fromPartial({ - typeUrl: "/cosmos.group.v1.PercentageDecisionPolicy", - value: PercentageDecisionPolicy.encode(PercentageDecisionPolicy.fromPartial(PercentageDecisionPolicy.fromAmino(content.value))).finish() - }); - default: - return Any.fromAmino(content); - } -}; -export const DecisionPolicy_ToAmino = (content: Any) => { - switch (content.typeUrl) { - case "/cosmos.group.v1.ThresholdDecisionPolicy": - return { - type: "cosmos-sdk/ThresholdDecisionPolicy", - value: ThresholdDecisionPolicy.toAmino(ThresholdDecisionPolicy.decode(content.value, undefined)) - }; - case "/cosmos.group.v1.PercentageDecisionPolicy": - return { - type: "cosmos-sdk/PercentageDecisionPolicy", - value: PercentageDecisionPolicy.toAmino(PercentageDecisionPolicy.decode(content.value, undefined)) - }; - default: - return Any.toAmino(content); - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/cosmos/group/v1/types.ts b/__fixtures__/v-next/outputv2/cosmos/group/v1/types.ts index a6fd63af95..e939aea55f 100644 --- a/__fixtures__/v-next/outputv2/cosmos/group/v1/types.ts +++ b/__fixtures__/v-next/outputv2/cosmos/group/v1/types.ts @@ -4,6 +4,7 @@ import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../google/protobuf import { BinaryReader, BinaryWriter } from "../../../binary"; import { toTimestamp, fromTimestamp, isSet, DeepPartial } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "cosmos.group.v1"; /** VoteOption enumerates the valid vote options for a given proposal. */ export enum VoteOption { @@ -1092,6 +1093,15 @@ function createBaseMember(): Member { export const Member = { typeUrl: "/cosmos.group.v1.Member", aminoType: "cosmos-sdk/Member", + is(o: any): o is Member { + return o && (o.$typeUrl === Member.typeUrl || typeof o.address === "string" && typeof o.weight === "string" && typeof o.metadata === "string" && Timestamp.is(o.addedAt)); + }, + isSDK(o: any): o is MemberSDKType { + return o && (o.$typeUrl === Member.typeUrl || typeof o.address === "string" && typeof o.weight === "string" && typeof o.metadata === "string" && Timestamp.isSDK(o.added_at)); + }, + isAmino(o: any): o is MemberAmino { + return o && (o.$typeUrl === Member.typeUrl || typeof o.address === "string" && typeof o.weight === "string" && typeof o.metadata === "string" && Timestamp.isAmino(o.added_at)); + }, encode(message: Member, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.address !== "") { writer.uint32(10).string(message.address); @@ -1217,7 +1227,8 @@ export const Member = { typeUrl: "/cosmos.group.v1.Member", value: Member.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMembers(): Members { return { @@ -1233,6 +1244,15 @@ function createBaseMembers(): Members { export const Members = { typeUrl: "/cosmos.group.v1.Members", aminoType: "cosmos-sdk/Members", + is(o: any): o is Members { + return o && (o.$typeUrl === Members.typeUrl || Array.isArray(o.members) && (!o.members.length || Member.is(o.members[0]))); + }, + isSDK(o: any): o is MembersSDKType { + return o && (o.$typeUrl === Members.typeUrl || Array.isArray(o.members) && (!o.members.length || Member.isSDK(o.members[0]))); + }, + isAmino(o: any): o is MembersAmino { + return o && (o.$typeUrl === Members.typeUrl || Array.isArray(o.members) && (!o.members.length || Member.isAmino(o.members[0]))); + }, encode(message: Members, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.members) { Member.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -1323,6 +1343,12 @@ export const Members = { typeUrl: "/cosmos.group.v1.Members", value: Members.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Members.typeUrl)) { + return; + } + Member.registerTypeUrl(); } }; function createBaseThresholdDecisionPolicy(): ThresholdDecisionPolicy { @@ -1341,6 +1367,15 @@ function createBaseThresholdDecisionPolicy(): ThresholdDecisionPolicy { export const ThresholdDecisionPolicy = { typeUrl: "/cosmos.group.v1.ThresholdDecisionPolicy", aminoType: "cosmos-sdk/ThresholdDecisionPolicy", + is(o: any): o is ThresholdDecisionPolicy { + return o && (o.$typeUrl === ThresholdDecisionPolicy.typeUrl || typeof o.threshold === "string"); + }, + isSDK(o: any): o is ThresholdDecisionPolicySDKType { + return o && (o.$typeUrl === ThresholdDecisionPolicy.typeUrl || typeof o.threshold === "string"); + }, + isAmino(o: any): o is ThresholdDecisionPolicyAmino { + return o && (o.$typeUrl === ThresholdDecisionPolicy.typeUrl || typeof o.threshold === "string"); + }, encode(message: ThresholdDecisionPolicy, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.threshold !== "") { writer.uint32(10).string(message.threshold); @@ -1438,6 +1473,14 @@ export const ThresholdDecisionPolicy = { typeUrl: "/cosmos.group.v1.ThresholdDecisionPolicy", value: ThresholdDecisionPolicy.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ThresholdDecisionPolicy.typeUrl)) { + return; + } + GlobalDecoderRegistry.register(ThresholdDecisionPolicy.typeUrl, ThresholdDecisionPolicy); + GlobalDecoderRegistry.registerAminoProtoMapping(ThresholdDecisionPolicy.aminoType, ThresholdDecisionPolicy.typeUrl); + DecisionPolicyWindows.registerTypeUrl(); } }; function createBasePercentageDecisionPolicy(): PercentageDecisionPolicy { @@ -1456,6 +1499,15 @@ function createBasePercentageDecisionPolicy(): PercentageDecisionPolicy { export const PercentageDecisionPolicy = { typeUrl: "/cosmos.group.v1.PercentageDecisionPolicy", aminoType: "cosmos-sdk/PercentageDecisionPolicy", + is(o: any): o is PercentageDecisionPolicy { + return o && (o.$typeUrl === PercentageDecisionPolicy.typeUrl || typeof o.percentage === "string"); + }, + isSDK(o: any): o is PercentageDecisionPolicySDKType { + return o && (o.$typeUrl === PercentageDecisionPolicy.typeUrl || typeof o.percentage === "string"); + }, + isAmino(o: any): o is PercentageDecisionPolicyAmino { + return o && (o.$typeUrl === PercentageDecisionPolicy.typeUrl || typeof o.percentage === "string"); + }, encode(message: PercentageDecisionPolicy, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.percentage !== "") { writer.uint32(10).string(message.percentage); @@ -1553,6 +1605,14 @@ export const PercentageDecisionPolicy = { typeUrl: "/cosmos.group.v1.PercentageDecisionPolicy", value: PercentageDecisionPolicy.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(PercentageDecisionPolicy.typeUrl)) { + return; + } + GlobalDecoderRegistry.register(PercentageDecisionPolicy.typeUrl, PercentageDecisionPolicy); + GlobalDecoderRegistry.registerAminoProtoMapping(PercentageDecisionPolicy.aminoType, PercentageDecisionPolicy.typeUrl); + DecisionPolicyWindows.registerTypeUrl(); } }; function createBaseDecisionPolicyWindows(): DecisionPolicyWindows { @@ -1570,6 +1630,15 @@ function createBaseDecisionPolicyWindows(): DecisionPolicyWindows { export const DecisionPolicyWindows = { typeUrl: "/cosmos.group.v1.DecisionPolicyWindows", aminoType: "cosmos-sdk/DecisionPolicyWindows", + is(o: any): o is DecisionPolicyWindows { + return o && (o.$typeUrl === DecisionPolicyWindows.typeUrl || Duration.is(o.votingPeriod) && Duration.is(o.minExecutionPeriod)); + }, + isSDK(o: any): o is DecisionPolicyWindowsSDKType { + return o && (o.$typeUrl === DecisionPolicyWindows.typeUrl || Duration.isSDK(o.voting_period) && Duration.isSDK(o.min_execution_period)); + }, + isAmino(o: any): o is DecisionPolicyWindowsAmino { + return o && (o.$typeUrl === DecisionPolicyWindows.typeUrl || Duration.isAmino(o.voting_period) && Duration.isAmino(o.min_execution_period)); + }, encode(message: DecisionPolicyWindows, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.votingPeriod !== undefined) { Duration.encode(message.votingPeriod, writer.uint32(10).fork()).ldelim(); @@ -1669,7 +1738,8 @@ export const DecisionPolicyWindows = { typeUrl: "/cosmos.group.v1.DecisionPolicyWindows", value: DecisionPolicyWindows.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseGroupInfo(): GroupInfo { return { @@ -1690,6 +1760,15 @@ function createBaseGroupInfo(): GroupInfo { export const GroupInfo = { typeUrl: "/cosmos.group.v1.GroupInfo", aminoType: "cosmos-sdk/GroupInfo", + is(o: any): o is GroupInfo { + return o && (o.$typeUrl === GroupInfo.typeUrl || typeof o.id === "bigint" && typeof o.admin === "string" && typeof o.metadata === "string" && typeof o.version === "bigint" && typeof o.totalWeight === "string" && Timestamp.is(o.createdAt)); + }, + isSDK(o: any): o is GroupInfoSDKType { + return o && (o.$typeUrl === GroupInfo.typeUrl || typeof o.id === "bigint" && typeof o.admin === "string" && typeof o.metadata === "string" && typeof o.version === "bigint" && typeof o.total_weight === "string" && Timestamp.isSDK(o.created_at)); + }, + isAmino(o: any): o is GroupInfoAmino { + return o && (o.$typeUrl === GroupInfo.typeUrl || typeof o.id === "bigint" && typeof o.admin === "string" && typeof o.metadata === "string" && typeof o.version === "bigint" && typeof o.total_weight === "string" && Timestamp.isAmino(o.created_at)); + }, encode(message: GroupInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.id !== BigInt(0)) { writer.uint32(8).uint64(message.id); @@ -1849,7 +1928,8 @@ export const GroupInfo = { typeUrl: "/cosmos.group.v1.GroupInfo", value: GroupInfo.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseGroupMember(): GroupMember { return { @@ -1866,6 +1946,15 @@ function createBaseGroupMember(): GroupMember { export const GroupMember = { typeUrl: "/cosmos.group.v1.GroupMember", aminoType: "cosmos-sdk/GroupMember", + is(o: any): o is GroupMember { + return o && (o.$typeUrl === GroupMember.typeUrl || typeof o.groupId === "bigint"); + }, + isSDK(o: any): o is GroupMemberSDKType { + return o && (o.$typeUrl === GroupMember.typeUrl || typeof o.group_id === "bigint"); + }, + isAmino(o: any): o is GroupMemberAmino { + return o && (o.$typeUrl === GroupMember.typeUrl || typeof o.group_id === "bigint"); + }, encode(message: GroupMember, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.groupId !== BigInt(0)) { writer.uint32(8).uint64(message.groupId); @@ -1965,6 +2054,12 @@ export const GroupMember = { typeUrl: "/cosmos.group.v1.GroupMember", value: GroupMember.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GroupMember.typeUrl)) { + return; + } + Member.registerTypeUrl(); } }; function createBaseGroupPolicyInfo(): GroupPolicyInfo { @@ -1987,6 +2082,15 @@ function createBaseGroupPolicyInfo(): GroupPolicyInfo { export const GroupPolicyInfo = { typeUrl: "/cosmos.group.v1.GroupPolicyInfo", aminoType: "cosmos-sdk/GroupPolicyInfo", + is(o: any): o is GroupPolicyInfo { + return o && (o.$typeUrl === GroupPolicyInfo.typeUrl || typeof o.address === "string" && typeof o.groupId === "bigint" && typeof o.admin === "string" && typeof o.metadata === "string" && typeof o.version === "bigint" && Timestamp.is(o.createdAt)); + }, + isSDK(o: any): o is GroupPolicyInfoSDKType { + return o && (o.$typeUrl === GroupPolicyInfo.typeUrl || typeof o.address === "string" && typeof o.group_id === "bigint" && typeof o.admin === "string" && typeof o.metadata === "string" && typeof o.version === "bigint" && Timestamp.isSDK(o.created_at)); + }, + isAmino(o: any): o is GroupPolicyInfoAmino { + return o && (o.$typeUrl === GroupPolicyInfo.typeUrl || typeof o.address === "string" && typeof o.group_id === "bigint" && typeof o.admin === "string" && typeof o.metadata === "string" && typeof o.version === "bigint" && Timestamp.isAmino(o.created_at)); + }, encode(message: GroupPolicyInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.address !== "") { writer.uint32(10).string(message.address); @@ -2004,7 +2108,7 @@ export const GroupPolicyInfo = { writer.uint32(40).uint64(message.version); } if (message.decisionPolicy !== undefined) { - Any.encode((message.decisionPolicy as Any), writer.uint32(50).fork()).ldelim(); + Any.encode(GlobalDecoderRegistry.wrapAny(message.decisionPolicy), writer.uint32(50).fork()).ldelim(); } if (message.createdAt !== undefined) { Timestamp.encode(toTimestamp(message.createdAt), writer.uint32(58).fork()).ldelim(); @@ -2034,7 +2138,7 @@ export const GroupPolicyInfo = { message.version = reader.uint64(); break; case 6: - message.decisionPolicy = (DecisionPolicy_InterfaceDecoder(reader) as Any); + message.decisionPolicy = GlobalDecoderRegistry.unwrapAny(reader); break; case 7: message.createdAt = fromTimestamp(Timestamp.decode(reader, reader.uint32())); @@ -2053,7 +2157,7 @@ export const GroupPolicyInfo = { if (isSet(object.admin)) obj.admin = String(object.admin); if (isSet(object.metadata)) obj.metadata = String(object.metadata); if (isSet(object.version)) obj.version = BigInt(object.version.toString()); - if (isSet(object.decisionPolicy)) obj.decisionPolicy = Any.fromJSON(object.decisionPolicy); + if (isSet(object.decisionPolicy)) obj.decisionPolicy = GlobalDecoderRegistry.fromJSON(object.decisionPolicy); if (isSet(object.createdAt)) obj.createdAt = new Date(object.createdAt); return obj; }, @@ -2064,7 +2168,7 @@ export const GroupPolicyInfo = { message.admin !== undefined && (obj.admin = message.admin); message.metadata !== undefined && (obj.metadata = message.metadata); message.version !== undefined && (obj.version = (message.version || BigInt(0)).toString()); - message.decisionPolicy !== undefined && (obj.decisionPolicy = message.decisionPolicy ? Any.toJSON(message.decisionPolicy) : undefined); + message.decisionPolicy !== undefined && (obj.decisionPolicy = message.decisionPolicy ? GlobalDecoderRegistry.toJSON(message.decisionPolicy) : undefined); message.createdAt !== undefined && (obj.createdAt = message.createdAt.toISOString()); return obj; }, @@ -2080,7 +2184,7 @@ export const GroupPolicyInfo = { message.version = BigInt(object.version.toString()); } if (object.decisionPolicy !== undefined && object.decisionPolicy !== null) { - message.decisionPolicy = Any.fromPartial(object.decisionPolicy); + message.decisionPolicy = GlobalDecoderRegistry.fromPartial(object.decisionPolicy); } message.createdAt = object.createdAt ?? undefined; return message; @@ -2092,7 +2196,7 @@ export const GroupPolicyInfo = { admin: object?.admin, metadata: object?.metadata, version: object?.version, - decisionPolicy: object.decision_policy ? Any.fromSDK(object.decision_policy) : undefined, + decisionPolicy: object.decision_policy ? GlobalDecoderRegistry.fromSDK(object.decision_policy) : undefined, createdAt: object.created_at ?? undefined }; }, @@ -2103,7 +2207,7 @@ export const GroupPolicyInfo = { obj.admin = message.admin; obj.metadata = message.metadata; obj.version = message.version; - message.decisionPolicy !== undefined && (obj.decision_policy = message.decisionPolicy ? Any.toSDK(message.decisionPolicy) : undefined); + message.decisionPolicy !== undefined && (obj.decision_policy = message.decisionPolicy ? GlobalDecoderRegistry.toSDK(message.decisionPolicy) : undefined); message.createdAt !== undefined && (obj.created_at = message.createdAt ?? undefined); return obj; }, @@ -2125,7 +2229,7 @@ export const GroupPolicyInfo = { message.version = BigInt(object.version); } if (object.decision_policy !== undefined && object.decision_policy !== null) { - message.decisionPolicy = DecisionPolicy_FromAmino(object.decision_policy); + message.decisionPolicy = GlobalDecoderRegistry.fromAminoMsg(object.decision_policy); } if (object.created_at !== undefined && object.created_at !== null) { message.createdAt = fromTimestamp(Timestamp.fromAmino(object.created_at)); @@ -2139,7 +2243,7 @@ export const GroupPolicyInfo = { obj.admin = message.admin === "" ? undefined : message.admin; obj.metadata = message.metadata === "" ? undefined : message.metadata; obj.version = message.version !== BigInt(0) ? message.version?.toString() : undefined; - obj.decision_policy = message.decisionPolicy ? DecisionPolicy_ToAmino((message.decisionPolicy as Any)) : undefined; + obj.decision_policy = message.decisionPolicy ? GlobalDecoderRegistry.toAminoMsg(message.decisionPolicy) : undefined; obj.created_at = message.createdAt ? Timestamp.toAmino(toTimestamp(message.createdAt)) : undefined; return obj; }, @@ -2163,6 +2267,13 @@ export const GroupPolicyInfo = { typeUrl: "/cosmos.group.v1.GroupPolicyInfo", value: GroupPolicyInfo.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GroupPolicyInfo.typeUrl)) { + return; + } + ThresholdDecisionPolicy.registerTypeUrl(); + PercentageDecisionPolicy.registerTypeUrl(); } }; function createBaseProposal(): Proposal { @@ -2194,6 +2305,15 @@ function createBaseProposal(): Proposal { export const Proposal = { typeUrl: "/cosmos.group.v1.Proposal", aminoType: "cosmos-sdk/Proposal", + is(o: any): o is Proposal { + return o && (o.$typeUrl === Proposal.typeUrl || typeof o.id === "bigint" && typeof o.address === "string" && typeof o.metadata === "string" && Array.isArray(o.proposers) && (!o.proposers.length || typeof o.proposers[0] === "string") && Timestamp.is(o.submitTime) && typeof o.groupVersion === "bigint" && typeof o.groupPolicyVersion === "bigint" && isSet(o.status) && isSet(o.result) && TallyResult.is(o.finalTallyResult) && Timestamp.is(o.votingPeriodEnd) && isSet(o.executorResult) && Array.isArray(o.messages) && (!o.messages.length || Any.is(o.messages[0]))); + }, + isSDK(o: any): o is ProposalSDKType { + return o && (o.$typeUrl === Proposal.typeUrl || typeof o.id === "bigint" && typeof o.address === "string" && typeof o.metadata === "string" && Array.isArray(o.proposers) && (!o.proposers.length || typeof o.proposers[0] === "string") && Timestamp.isSDK(o.submit_time) && typeof o.group_version === "bigint" && typeof o.group_policy_version === "bigint" && isSet(o.status) && isSet(o.result) && TallyResult.isSDK(o.final_tally_result) && Timestamp.isSDK(o.voting_period_end) && isSet(o.executor_result) && Array.isArray(o.messages) && (!o.messages.length || Any.isSDK(o.messages[0]))); + }, + isAmino(o: any): o is ProposalAmino { + return o && (o.$typeUrl === Proposal.typeUrl || typeof o.id === "bigint" && typeof o.address === "string" && typeof o.metadata === "string" && Array.isArray(o.proposers) && (!o.proposers.length || typeof o.proposers[0] === "string") && Timestamp.isAmino(o.submit_time) && typeof o.group_version === "bigint" && typeof o.group_policy_version === "bigint" && isSet(o.status) && isSet(o.result) && TallyResult.isAmino(o.final_tally_result) && Timestamp.isAmino(o.voting_period_end) && isSet(o.executor_result) && Array.isArray(o.messages) && (!o.messages.length || Any.isAmino(o.messages[0]))); + }, encode(message: Proposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.id !== BigInt(0)) { writer.uint32(8).uint64(message.id); @@ -2482,7 +2602,8 @@ export const Proposal = { typeUrl: "/cosmos.group.v1.Proposal", value: Proposal.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseTallyResult(): TallyResult { return { @@ -2501,6 +2622,15 @@ function createBaseTallyResult(): TallyResult { export const TallyResult = { typeUrl: "/cosmos.group.v1.TallyResult", aminoType: "cosmos-sdk/TallyResult", + is(o: any): o is TallyResult { + return o && (o.$typeUrl === TallyResult.typeUrl || typeof o.yesCount === "string" && typeof o.abstainCount === "string" && typeof o.noCount === "string" && typeof o.noWithVetoCount === "string"); + }, + isSDK(o: any): o is TallyResultSDKType { + return o && (o.$typeUrl === TallyResult.typeUrl || typeof o.yes_count === "string" && typeof o.abstain_count === "string" && typeof o.no_count === "string" && typeof o.no_with_veto_count === "string"); + }, + isAmino(o: any): o is TallyResultAmino { + return o && (o.$typeUrl === TallyResult.typeUrl || typeof o.yes_count === "string" && typeof o.abstain_count === "string" && typeof o.no_count === "string" && typeof o.no_with_veto_count === "string"); + }, encode(message: TallyResult, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.yesCount !== "") { writer.uint32(10).string(message.yesCount); @@ -2626,7 +2756,8 @@ export const TallyResult = { typeUrl: "/cosmos.group.v1.TallyResult", value: TallyResult.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseVote(): Vote { return { @@ -2646,6 +2777,15 @@ function createBaseVote(): Vote { export const Vote = { typeUrl: "/cosmos.group.v1.Vote", aminoType: "cosmos-sdk/Vote", + is(o: any): o is Vote { + return o && (o.$typeUrl === Vote.typeUrl || typeof o.proposalId === "bigint" && typeof o.voter === "string" && isSet(o.option) && typeof o.metadata === "string" && Timestamp.is(o.submitTime)); + }, + isSDK(o: any): o is VoteSDKType { + return o && (o.$typeUrl === Vote.typeUrl || typeof o.proposal_id === "bigint" && typeof o.voter === "string" && isSet(o.option) && typeof o.metadata === "string" && Timestamp.isSDK(o.submit_time)); + }, + isAmino(o: any): o is VoteAmino { + return o && (o.$typeUrl === Vote.typeUrl || typeof o.proposal_id === "bigint" && typeof o.voter === "string" && isSet(o.option) && typeof o.metadata === "string" && Timestamp.isAmino(o.submit_time)); + }, encode(message: Vote, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.proposalId !== BigInt(0)) { writer.uint32(8).uint64(message.proposalId); @@ -2788,49 +2928,6 @@ export const Vote = { typeUrl: "/cosmos.group.v1.Vote", value: Vote.encode(message).finish() }; - } -}; -export const DecisionPolicy_InterfaceDecoder = (input: BinaryReader | Uint8Array): ThresholdDecisionPolicy | PercentageDecisionPolicy | Any => { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - const data = Any.decode(reader, reader.uint32()); - switch (data.typeUrl) { - case "/cosmos.group.v1.ThresholdDecisionPolicy": - return ThresholdDecisionPolicy.decode(data.value); - case "/cosmos.group.v1.PercentageDecisionPolicy": - return PercentageDecisionPolicy.decode(data.value); - default: - return data; - } -}; -export const DecisionPolicy_FromAmino = (content: AnyAmino): Any => { - switch (content.type) { - case "cosmos-sdk/ThresholdDecisionPolicy": - return Any.fromPartial({ - typeUrl: "/cosmos.group.v1.ThresholdDecisionPolicy", - value: ThresholdDecisionPolicy.encode(ThresholdDecisionPolicy.fromPartial(ThresholdDecisionPolicy.fromAmino(content.value))).finish() - }); - case "cosmos-sdk/PercentageDecisionPolicy": - return Any.fromPartial({ - typeUrl: "/cosmos.group.v1.PercentageDecisionPolicy", - value: PercentageDecisionPolicy.encode(PercentageDecisionPolicy.fromPartial(PercentageDecisionPolicy.fromAmino(content.value))).finish() - }); - default: - return Any.fromAmino(content); - } -}; -export const DecisionPolicy_ToAmino = (content: Any) => { - switch (content.typeUrl) { - case "/cosmos.group.v1.ThresholdDecisionPolicy": - return { - type: "cosmos-sdk/ThresholdDecisionPolicy", - value: ThresholdDecisionPolicy.toAmino(ThresholdDecisionPolicy.decode(content.value, undefined)) - }; - case "/cosmos.group.v1.PercentageDecisionPolicy": - return { - type: "cosmos-sdk/PercentageDecisionPolicy", - value: PercentageDecisionPolicy.toAmino(PercentageDecisionPolicy.decode(content.value, undefined)) - }; - default: - return Any.toAmino(content); - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/cosmos/mint/v1beta1/genesis.ts b/__fixtures__/v-next/outputv2/cosmos/mint/v1beta1/genesis.ts index 790f1c8d1f..a3b09fccba 100644 --- a/__fixtures__/v-next/outputv2/cosmos/mint/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv2/cosmos/mint/v1beta1/genesis.ts @@ -1,5 +1,6 @@ import { Minter, MinterAmino, MinterSDKType, Params, ParamsAmino, ParamsSDKType } from "./mint"; import { BinaryReader, BinaryWriter } from "../../../binary"; +import { GlobalDecoderRegistry } from "../../../registry"; import { isSet, DeepPartial } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "cosmos.mint.v1beta1"; @@ -68,6 +69,15 @@ function createBaseGenesisState(): GenesisState { export const GenesisState = { typeUrl: "/cosmos.mint.v1beta1.GenesisState", aminoType: "cosmos-sdk/GenesisState", + is(o: any): o is GenesisState { + return o && (o.$typeUrl === GenesisState.typeUrl || Minter.is(o.minter) && Params.is(o.params)); + }, + isSDK(o: any): o is GenesisStateSDKType { + return o && (o.$typeUrl === GenesisState.typeUrl || Minter.isSDK(o.minter) && Params.isSDK(o.params)); + }, + isAmino(o: any): o is GenesisStateAmino { + return o && (o.$typeUrl === GenesisState.typeUrl || Minter.isAmino(o.minter) && Params.isAmino(o.params)); + }, encode(message: GenesisState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.minter !== undefined) { Minter.encode(message.minter, writer.uint32(10).fork()).ldelim(); @@ -167,5 +177,12 @@ export const GenesisState = { typeUrl: "/cosmos.mint.v1beta1.GenesisState", value: GenesisState.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GenesisState.typeUrl)) { + return; + } + Minter.registerTypeUrl(); + Params.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/cosmos/mint/v1beta1/mint.ts b/__fixtures__/v-next/outputv2/cosmos/mint/v1beta1/mint.ts index 21a1afa64c..a8d5022fba 100644 --- a/__fixtures__/v-next/outputv2/cosmos/mint/v1beta1/mint.ts +++ b/__fixtures__/v-next/outputv2/cosmos/mint/v1beta1/mint.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { Decimal } from "@cosmjs/math"; +import { Decimal } from "@interchainjs/math"; import { isSet, DeepPartial } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "cosmos.mint.v1beta1"; @@ -154,6 +154,15 @@ function createBaseMinter(): Minter { export const Minter = { typeUrl: "/cosmos.mint.v1beta1.Minter", aminoType: "cosmos-sdk/Minter", + is(o: any): o is Minter { + return o && (o.$typeUrl === Minter.typeUrl || typeof o.inflation === "string" && typeof o.annualProvisions === "string"); + }, + isSDK(o: any): o is MinterSDKType { + return o && (o.$typeUrl === Minter.typeUrl || typeof o.inflation === "string" && typeof o.annual_provisions === "string"); + }, + isAmino(o: any): o is MinterAmino { + return o && (o.$typeUrl === Minter.typeUrl || typeof o.inflation === "string" && typeof o.annual_provisions === "string"); + }, encode(message: Minter, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.inflation !== "") { writer.uint32(10).string(Decimal.fromUserInput(message.inflation, 18).atomics); @@ -225,8 +234,8 @@ export const Minter = { }, toAmino(message: Minter): MinterAmino { const obj: any = {}; - obj.inflation = message.inflation === "" ? undefined : message.inflation; - obj.annual_provisions = message.annualProvisions === "" ? undefined : message.annualProvisions; + obj.inflation = message.inflation === "" ? undefined : Decimal.fromUserInput(message.inflation, 18).atomics; + obj.annual_provisions = message.annualProvisions === "" ? undefined : Decimal.fromUserInput(message.annualProvisions, 18).atomics; return obj; }, fromAminoMsg(object: MinterAminoMsg): Minter { @@ -249,7 +258,8 @@ export const Minter = { typeUrl: "/cosmos.mint.v1beta1.Minter", value: Minter.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseParams(): Params { return { @@ -270,6 +280,15 @@ function createBaseParams(): Params { export const Params = { typeUrl: "/cosmos.mint.v1beta1.Params", aminoType: "cosmos-sdk/Params", + is(o: any): o is Params { + return o && (o.$typeUrl === Params.typeUrl || typeof o.mintDenom === "string" && typeof o.inflationRateChange === "string" && typeof o.inflationMax === "string" && typeof o.inflationMin === "string" && typeof o.goalBonded === "string" && typeof o.blocksPerYear === "bigint"); + }, + isSDK(o: any): o is ParamsSDKType { + return o && (o.$typeUrl === Params.typeUrl || typeof o.mint_denom === "string" && typeof o.inflation_rate_change === "string" && typeof o.inflation_max === "string" && typeof o.inflation_min === "string" && typeof o.goal_bonded === "string" && typeof o.blocks_per_year === "bigint"); + }, + isAmino(o: any): o is ParamsAmino { + return o && (o.$typeUrl === Params.typeUrl || typeof o.mint_denom === "string" && typeof o.inflation_rate_change === "string" && typeof o.inflation_max === "string" && typeof o.inflation_min === "string" && typeof o.goal_bonded === "string" && typeof o.blocks_per_year === "bigint"); + }, encode(message: Params, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.mintDenom !== "") { writer.uint32(10).string(message.mintDenom); @@ -400,10 +419,10 @@ export const Params = { toAmino(message: Params): ParamsAmino { const obj: any = {}; obj.mint_denom = message.mintDenom === "" ? undefined : message.mintDenom; - obj.inflation_rate_change = message.inflationRateChange === "" ? undefined : message.inflationRateChange; - obj.inflation_max = message.inflationMax === "" ? undefined : message.inflationMax; - obj.inflation_min = message.inflationMin === "" ? undefined : message.inflationMin; - obj.goal_bonded = message.goalBonded === "" ? undefined : message.goalBonded; + obj.inflation_rate_change = message.inflationRateChange === "" ? undefined : Decimal.fromUserInput(message.inflationRateChange, 18).atomics; + obj.inflation_max = message.inflationMax === "" ? undefined : Decimal.fromUserInput(message.inflationMax, 18).atomics; + obj.inflation_min = message.inflationMin === "" ? undefined : Decimal.fromUserInput(message.inflationMin, 18).atomics; + obj.goal_bonded = message.goalBonded === "" ? undefined : Decimal.fromUserInput(message.goalBonded, 18).atomics; obj.blocks_per_year = message.blocksPerYear !== BigInt(0) ? message.blocksPerYear?.toString() : undefined; return obj; }, @@ -427,5 +446,6 @@ export const Params = { typeUrl: "/cosmos.mint.v1beta1.Params", value: Params.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/cosmos/mint/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputv2/cosmos/mint/v1beta1/query.rpc.func.ts new file mode 100644 index 0000000000..e1273e7486 --- /dev/null +++ b/__fixtures__/v-next/outputv2/cosmos/mint/v1beta1/query.rpc.func.ts @@ -0,0 +1,41 @@ +import { buildQuery } from "../../../helper-func-types"; +import { QueryParamsRequest, QueryParamsResponse, QueryInflationRequest, QueryInflationResponse, QueryAnnualProvisionsRequest, QueryAnnualProvisionsResponse } from "./query"; +/** + * Params returns the total set of minting parameters. + * @name getParams + * @package cosmos.mint.v1beta1 + * @see proto service: cosmos.mint.v1beta1.Params + */ +export const getParams = buildQuery({ + encode: QueryParamsRequest.encode, + decode: QueryParamsResponse.decode, + service: "cosmos.mint.v1beta1.Query", + method: "Params", + deps: [QueryParamsRequest, QueryParamsResponse] +}); +/** + * Inflation returns the current minting inflation value. + * @name getInflation + * @package cosmos.mint.v1beta1 + * @see proto service: cosmos.mint.v1beta1.Inflation + */ +export const getInflation = buildQuery({ + encode: QueryInflationRequest.encode, + decode: QueryInflationResponse.decode, + service: "cosmos.mint.v1beta1.Query", + method: "Inflation", + deps: [QueryInflationRequest, QueryInflationResponse] +}); +/** + * AnnualProvisions current minting annual provisions value. + * @name getAnnualProvisions + * @package cosmos.mint.v1beta1 + * @see proto service: cosmos.mint.v1beta1.AnnualProvisions + */ +export const getAnnualProvisions = buildQuery({ + encode: QueryAnnualProvisionsRequest.encode, + decode: QueryAnnualProvisionsResponse.decode, + service: "cosmos.mint.v1beta1.Query", + method: "AnnualProvisions", + deps: [QueryAnnualProvisionsRequest, QueryAnnualProvisionsResponse] +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/cosmos/mint/v1beta1/query.ts b/__fixtures__/v-next/outputv2/cosmos/mint/v1beta1/query.ts index 3985fa5705..442fdc54c8 100644 --- a/__fixtures__/v-next/outputv2/cosmos/mint/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv2/cosmos/mint/v1beta1/query.ts @@ -2,6 +2,7 @@ import { Params, ParamsAmino, ParamsSDKType } from "./mint"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { JsonSafe } from "../../../json-safe"; import { DeepPartial, isSet, bytesFromBase64, base64FromBytes } from "../../../helpers"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "cosmos.mint.v1beta1"; /** * QueryParamsRequest is the request type for the Query/Params RPC method. @@ -234,6 +235,15 @@ function createBaseQueryParamsRequest(): QueryParamsRequest { export const QueryParamsRequest = { typeUrl: "/cosmos.mint.v1beta1.QueryParamsRequest", aminoType: "cosmos-sdk/QueryParamsRequest", + is(o: any): o is QueryParamsRequest { + return o && o.$typeUrl === QueryParamsRequest.typeUrl; + }, + isSDK(o: any): o is QueryParamsRequestSDKType { + return o && o.$typeUrl === QueryParamsRequest.typeUrl; + }, + isAmino(o: any): o is QueryParamsRequestAmino { + return o && o.$typeUrl === QueryParamsRequest.typeUrl; + }, encode(_: QueryParamsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -298,7 +308,8 @@ export const QueryParamsRequest = { typeUrl: "/cosmos.mint.v1beta1.QueryParamsRequest", value: QueryParamsRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryParamsResponse(): QueryParamsResponse { return { @@ -314,6 +325,15 @@ function createBaseQueryParamsResponse(): QueryParamsResponse { export const QueryParamsResponse = { typeUrl: "/cosmos.mint.v1beta1.QueryParamsResponse", aminoType: "cosmos-sdk/QueryParamsResponse", + is(o: any): o is QueryParamsResponse { + return o && (o.$typeUrl === QueryParamsResponse.typeUrl || Params.is(o.params)); + }, + isSDK(o: any): o is QueryParamsResponseSDKType { + return o && (o.$typeUrl === QueryParamsResponse.typeUrl || Params.isSDK(o.params)); + }, + isAmino(o: any): o is QueryParamsResponseAmino { + return o && (o.$typeUrl === QueryParamsResponse.typeUrl || Params.isAmino(o.params)); + }, encode(message: QueryParamsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.params !== undefined) { Params.encode(message.params, writer.uint32(10).fork()).ldelim(); @@ -396,6 +416,12 @@ export const QueryParamsResponse = { typeUrl: "/cosmos.mint.v1beta1.QueryParamsResponse", value: QueryParamsResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryParamsResponse.typeUrl)) { + return; + } + Params.registerTypeUrl(); } }; function createBaseQueryInflationRequest(): QueryInflationRequest { @@ -410,6 +436,15 @@ function createBaseQueryInflationRequest(): QueryInflationRequest { export const QueryInflationRequest = { typeUrl: "/cosmos.mint.v1beta1.QueryInflationRequest", aminoType: "cosmos-sdk/QueryInflationRequest", + is(o: any): o is QueryInflationRequest { + return o && o.$typeUrl === QueryInflationRequest.typeUrl; + }, + isSDK(o: any): o is QueryInflationRequestSDKType { + return o && o.$typeUrl === QueryInflationRequest.typeUrl; + }, + isAmino(o: any): o is QueryInflationRequestAmino { + return o && o.$typeUrl === QueryInflationRequest.typeUrl; + }, encode(_: QueryInflationRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -474,7 +509,8 @@ export const QueryInflationRequest = { typeUrl: "/cosmos.mint.v1beta1.QueryInflationRequest", value: QueryInflationRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryInflationResponse(): QueryInflationResponse { return { @@ -491,6 +527,15 @@ function createBaseQueryInflationResponse(): QueryInflationResponse { export const QueryInflationResponse = { typeUrl: "/cosmos.mint.v1beta1.QueryInflationResponse", aminoType: "cosmos-sdk/QueryInflationResponse", + is(o: any): o is QueryInflationResponse { + return o && (o.$typeUrl === QueryInflationResponse.typeUrl || o.inflation instanceof Uint8Array || typeof o.inflation === "string"); + }, + isSDK(o: any): o is QueryInflationResponseSDKType { + return o && (o.$typeUrl === QueryInflationResponse.typeUrl || o.inflation instanceof Uint8Array || typeof o.inflation === "string"); + }, + isAmino(o: any): o is QueryInflationResponseAmino { + return o && (o.$typeUrl === QueryInflationResponse.typeUrl || o.inflation instanceof Uint8Array || typeof o.inflation === "string"); + }, encode(message: QueryInflationResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.inflation.length !== 0) { writer.uint32(10).bytes(message.inflation); @@ -571,7 +616,8 @@ export const QueryInflationResponse = { typeUrl: "/cosmos.mint.v1beta1.QueryInflationResponse", value: QueryInflationResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryAnnualProvisionsRequest(): QueryAnnualProvisionsRequest { return {}; @@ -586,6 +632,15 @@ function createBaseQueryAnnualProvisionsRequest(): QueryAnnualProvisionsRequest export const QueryAnnualProvisionsRequest = { typeUrl: "/cosmos.mint.v1beta1.QueryAnnualProvisionsRequest", aminoType: "cosmos-sdk/QueryAnnualProvisionsRequest", + is(o: any): o is QueryAnnualProvisionsRequest { + return o && o.$typeUrl === QueryAnnualProvisionsRequest.typeUrl; + }, + isSDK(o: any): o is QueryAnnualProvisionsRequestSDKType { + return o && o.$typeUrl === QueryAnnualProvisionsRequest.typeUrl; + }, + isAmino(o: any): o is QueryAnnualProvisionsRequestAmino { + return o && o.$typeUrl === QueryAnnualProvisionsRequest.typeUrl; + }, encode(_: QueryAnnualProvisionsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -650,7 +705,8 @@ export const QueryAnnualProvisionsRequest = { typeUrl: "/cosmos.mint.v1beta1.QueryAnnualProvisionsRequest", value: QueryAnnualProvisionsRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryAnnualProvisionsResponse(): QueryAnnualProvisionsResponse { return { @@ -667,6 +723,15 @@ function createBaseQueryAnnualProvisionsResponse(): QueryAnnualProvisionsRespons export const QueryAnnualProvisionsResponse = { typeUrl: "/cosmos.mint.v1beta1.QueryAnnualProvisionsResponse", aminoType: "cosmos-sdk/QueryAnnualProvisionsResponse", + is(o: any): o is QueryAnnualProvisionsResponse { + return o && (o.$typeUrl === QueryAnnualProvisionsResponse.typeUrl || o.annualProvisions instanceof Uint8Array || typeof o.annualProvisions === "string"); + }, + isSDK(o: any): o is QueryAnnualProvisionsResponseSDKType { + return o && (o.$typeUrl === QueryAnnualProvisionsResponse.typeUrl || o.annual_provisions instanceof Uint8Array || typeof o.annual_provisions === "string"); + }, + isAmino(o: any): o is QueryAnnualProvisionsResponseAmino { + return o && (o.$typeUrl === QueryAnnualProvisionsResponse.typeUrl || o.annual_provisions instanceof Uint8Array || typeof o.annual_provisions === "string"); + }, encode(message: QueryAnnualProvisionsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.annualProvisions.length !== 0) { writer.uint32(10).bytes(message.annualProvisions); @@ -747,5 +812,6 @@ export const QueryAnnualProvisionsResponse = { typeUrl: "/cosmos.mint.v1beta1.QueryAnnualProvisionsResponse", value: QueryAnnualProvisionsResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/cosmos/nft/v1beta1/event.ts b/__fixtures__/v-next/outputv2/cosmos/nft/v1beta1/event.ts index 5b314c171c..d3b9044d52 100644 --- a/__fixtures__/v-next/outputv2/cosmos/nft/v1beta1/event.ts +++ b/__fixtures__/v-next/outputv2/cosmos/nft/v1beta1/event.ts @@ -145,6 +145,15 @@ function createBaseEventSend(): EventSend { export const EventSend = { typeUrl: "/cosmos.nft.v1beta1.EventSend", aminoType: "cosmos-sdk/EventSend", + is(o: any): o is EventSend { + return o && (o.$typeUrl === EventSend.typeUrl || typeof o.classId === "string" && typeof o.id === "string" && typeof o.sender === "string" && typeof o.receiver === "string"); + }, + isSDK(o: any): o is EventSendSDKType { + return o && (o.$typeUrl === EventSend.typeUrl || typeof o.class_id === "string" && typeof o.id === "string" && typeof o.sender === "string" && typeof o.receiver === "string"); + }, + isAmino(o: any): o is EventSendAmino { + return o && (o.$typeUrl === EventSend.typeUrl || typeof o.class_id === "string" && typeof o.id === "string" && typeof o.sender === "string" && typeof o.receiver === "string"); + }, encode(message: EventSend, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.classId !== "") { writer.uint32(10).string(message.classId); @@ -270,7 +279,8 @@ export const EventSend = { typeUrl: "/cosmos.nft.v1beta1.EventSend", value: EventSend.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseEventMint(): EventMint { return { @@ -288,6 +298,15 @@ function createBaseEventMint(): EventMint { export const EventMint = { typeUrl: "/cosmos.nft.v1beta1.EventMint", aminoType: "cosmos-sdk/EventMint", + is(o: any): o is EventMint { + return o && (o.$typeUrl === EventMint.typeUrl || typeof o.classId === "string" && typeof o.id === "string" && typeof o.owner === "string"); + }, + isSDK(o: any): o is EventMintSDKType { + return o && (o.$typeUrl === EventMint.typeUrl || typeof o.class_id === "string" && typeof o.id === "string" && typeof o.owner === "string"); + }, + isAmino(o: any): o is EventMintAmino { + return o && (o.$typeUrl === EventMint.typeUrl || typeof o.class_id === "string" && typeof o.id === "string" && typeof o.owner === "string"); + }, encode(message: EventMint, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.classId !== "") { writer.uint32(10).string(message.classId); @@ -398,7 +417,8 @@ export const EventMint = { typeUrl: "/cosmos.nft.v1beta1.EventMint", value: EventMint.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseEventBurn(): EventBurn { return { @@ -416,6 +436,15 @@ function createBaseEventBurn(): EventBurn { export const EventBurn = { typeUrl: "/cosmos.nft.v1beta1.EventBurn", aminoType: "cosmos-sdk/EventBurn", + is(o: any): o is EventBurn { + return o && (o.$typeUrl === EventBurn.typeUrl || typeof o.classId === "string" && typeof o.id === "string" && typeof o.owner === "string"); + }, + isSDK(o: any): o is EventBurnSDKType { + return o && (o.$typeUrl === EventBurn.typeUrl || typeof o.class_id === "string" && typeof o.id === "string" && typeof o.owner === "string"); + }, + isAmino(o: any): o is EventBurnAmino { + return o && (o.$typeUrl === EventBurn.typeUrl || typeof o.class_id === "string" && typeof o.id === "string" && typeof o.owner === "string"); + }, encode(message: EventBurn, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.classId !== "") { writer.uint32(10).string(message.classId); @@ -526,5 +555,6 @@ export const EventBurn = { typeUrl: "/cosmos.nft.v1beta1.EventBurn", value: EventBurn.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/cosmos/nft/v1beta1/genesis.ts b/__fixtures__/v-next/outputv2/cosmos/nft/v1beta1/genesis.ts index f527110e46..af134ef6b1 100644 --- a/__fixtures__/v-next/outputv2/cosmos/nft/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv2/cosmos/nft/v1beta1/genesis.ts @@ -2,6 +2,7 @@ import { Class, ClassAmino, ClassSDKType, NFT, NFTAmino, NFTSDKType } from "./nf import { BinaryReader, BinaryWriter } from "../../../binary"; import { JsonSafe } from "../../../json-safe"; import { DeepPartial, isSet } from "../../../helpers"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "cosmos.nft.v1beta1"; /** * GenesisState defines the nft module's genesis state. @@ -112,6 +113,15 @@ function createBaseGenesisState(): GenesisState { export const GenesisState = { typeUrl: "/cosmos.nft.v1beta1.GenesisState", aminoType: "cosmos-sdk/GenesisState", + is(o: any): o is GenesisState { + return o && (o.$typeUrl === GenesisState.typeUrl || Array.isArray(o.classes) && (!o.classes.length || Class.is(o.classes[0])) && Array.isArray(o.entries) && (!o.entries.length || Entry.is(o.entries[0]))); + }, + isSDK(o: any): o is GenesisStateSDKType { + return o && (o.$typeUrl === GenesisState.typeUrl || Array.isArray(o.classes) && (!o.classes.length || Class.isSDK(o.classes[0])) && Array.isArray(o.entries) && (!o.entries.length || Entry.isSDK(o.entries[0]))); + }, + isAmino(o: any): o is GenesisStateAmino { + return o && (o.$typeUrl === GenesisState.typeUrl || Array.isArray(o.classes) && (!o.classes.length || Class.isAmino(o.classes[0])) && Array.isArray(o.entries) && (!o.entries.length || Entry.isAmino(o.entries[0]))); + }, encode(message: GenesisState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.classes) { Class.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -227,6 +237,13 @@ export const GenesisState = { typeUrl: "/cosmos.nft.v1beta1.GenesisState", value: GenesisState.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GenesisState.typeUrl)) { + return; + } + Class.registerTypeUrl(); + Entry.registerTypeUrl(); } }; function createBaseEntry(): Entry { @@ -244,6 +261,15 @@ function createBaseEntry(): Entry { export const Entry = { typeUrl: "/cosmos.nft.v1beta1.Entry", aminoType: "cosmos-sdk/Entry", + is(o: any): o is Entry { + return o && (o.$typeUrl === Entry.typeUrl || typeof o.owner === "string" && Array.isArray(o.nfts) && (!o.nfts.length || NFT.is(o.nfts[0]))); + }, + isSDK(o: any): o is EntrySDKType { + return o && (o.$typeUrl === Entry.typeUrl || typeof o.owner === "string" && Array.isArray(o.nfts) && (!o.nfts.length || NFT.isSDK(o.nfts[0]))); + }, + isAmino(o: any): o is EntryAmino { + return o && (o.$typeUrl === Entry.typeUrl || typeof o.owner === "string" && Array.isArray(o.nfts) && (!o.nfts.length || NFT.isAmino(o.nfts[0]))); + }, encode(message: Entry, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.owner !== "") { writer.uint32(10).string(message.owner); @@ -349,5 +375,11 @@ export const Entry = { typeUrl: "/cosmos.nft.v1beta1.Entry", value: Entry.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Entry.typeUrl)) { + return; + } + NFT.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/cosmos/nft/v1beta1/nft.ts b/__fixtures__/v-next/outputv2/cosmos/nft/v1beta1/nft.ts index 8458e284d5..bdce097dad 100644 --- a/__fixtures__/v-next/outputv2/cosmos/nft/v1beta1/nft.ts +++ b/__fixtures__/v-next/outputv2/cosmos/nft/v1beta1/nft.ts @@ -195,6 +195,15 @@ function createBaseClass(): Class { export const Class = { typeUrl: "/cosmos.nft.v1beta1.Class", aminoType: "cosmos-sdk/Class", + is(o: any): o is Class { + return o && (o.$typeUrl === Class.typeUrl || typeof o.id === "string" && typeof o.name === "string" && typeof o.symbol === "string" && typeof o.description === "string" && typeof o.uri === "string" && typeof o.uriHash === "string"); + }, + isSDK(o: any): o is ClassSDKType { + return o && (o.$typeUrl === Class.typeUrl || typeof o.id === "string" && typeof o.name === "string" && typeof o.symbol === "string" && typeof o.description === "string" && typeof o.uri === "string" && typeof o.uri_hash === "string"); + }, + isAmino(o: any): o is ClassAmino { + return o && (o.$typeUrl === Class.typeUrl || typeof o.id === "string" && typeof o.name === "string" && typeof o.symbol === "string" && typeof o.description === "string" && typeof o.uri === "string" && typeof o.uri_hash === "string"); + }, encode(message: Class, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.id !== "") { writer.uint32(10).string(message.id); @@ -367,7 +376,8 @@ export const Class = { typeUrl: "/cosmos.nft.v1beta1.Class", value: Class.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseNFT(): NFT { return { @@ -387,6 +397,15 @@ function createBaseNFT(): NFT { export const NFT = { typeUrl: "/cosmos.nft.v1beta1.NFT", aminoType: "cosmos-sdk/NFT", + is(o: any): o is NFT { + return o && (o.$typeUrl === NFT.typeUrl || typeof o.classId === "string" && typeof o.id === "string" && typeof o.uri === "string" && typeof o.uriHash === "string"); + }, + isSDK(o: any): o is NFTSDKType { + return o && (o.$typeUrl === NFT.typeUrl || typeof o.class_id === "string" && typeof o.id === "string" && typeof o.uri === "string" && typeof o.uri_hash === "string"); + }, + isAmino(o: any): o is NFTAmino { + return o && (o.$typeUrl === NFT.typeUrl || typeof o.class_id === "string" && typeof o.id === "string" && typeof o.uri === "string" && typeof o.uri_hash === "string"); + }, encode(message: NFT, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.classId !== "") { writer.uint32(10).string(message.classId); @@ -529,5 +548,6 @@ export const NFT = { typeUrl: "/cosmos.nft.v1beta1.NFT", value: NFT.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/cosmos/nft/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputv2/cosmos/nft/v1beta1/query.rpc.func.ts new file mode 100644 index 0000000000..26262a488c --- /dev/null +++ b/__fixtures__/v-next/outputv2/cosmos/nft/v1beta1/query.rpc.func.ts @@ -0,0 +1,94 @@ +import { buildQuery } from "../../../helper-func-types"; +import { QueryBalanceRequest, QueryBalanceResponse, QueryOwnerRequest, QueryOwnerResponse, QuerySupplyRequest, QuerySupplyResponse, QueryNFTsRequest, QueryNFTsResponse, QueryNFTRequest, QueryNFTResponse, QueryClassRequest, QueryClassResponse, QueryClassesRequest, QueryClassesResponse } from "./query"; +/** + * Balance queries the number of NFTs of a given class owned by the owner, same as balanceOf in ERC721 + * @name getBalance + * @package cosmos.nft.v1beta1 + * @see proto service: cosmos.nft.v1beta1.Balance + */ +export const getBalance = buildQuery({ + encode: QueryBalanceRequest.encode, + decode: QueryBalanceResponse.decode, + service: "cosmos.nft.v1beta1.Query", + method: "Balance", + deps: [QueryBalanceRequest, QueryBalanceResponse] +}); +/** + * Owner queries the owner of the NFT based on its class and id, same as ownerOf in ERC721 + * @name getOwner + * @package cosmos.nft.v1beta1 + * @see proto service: cosmos.nft.v1beta1.Owner + */ +export const getOwner = buildQuery({ + encode: QueryOwnerRequest.encode, + decode: QueryOwnerResponse.decode, + service: "cosmos.nft.v1beta1.Query", + method: "Owner", + deps: [QueryOwnerRequest, QueryOwnerResponse] +}); +/** + * Supply queries the number of NFTs from the given class, same as totalSupply of ERC721. + * @name getSupply + * @package cosmos.nft.v1beta1 + * @see proto service: cosmos.nft.v1beta1.Supply + */ +export const getSupply = buildQuery({ + encode: QuerySupplyRequest.encode, + decode: QuerySupplyResponse.decode, + service: "cosmos.nft.v1beta1.Query", + method: "Supply", + deps: [QuerySupplyRequest, QuerySupplyResponse] +}); +/** + * NFTs queries all NFTs of a given class or owner,choose at least one of the two, similar to tokenByIndex in + * ERC721Enumerable + * @name getNFTs + * @package cosmos.nft.v1beta1 + * @see proto service: cosmos.nft.v1beta1.NFTs + */ +export const getNFTs = buildQuery({ + encode: QueryNFTsRequest.encode, + decode: QueryNFTsResponse.decode, + service: "cosmos.nft.v1beta1.Query", + method: "NFTs", + deps: [QueryNFTsRequest, QueryNFTsResponse] +}); +/** + * NFT queries an NFT based on its class and id. + * @name getNFT + * @package cosmos.nft.v1beta1 + * @see proto service: cosmos.nft.v1beta1.NFT + */ +export const getNFT = buildQuery({ + encode: QueryNFTRequest.encode, + decode: QueryNFTResponse.decode, + service: "cosmos.nft.v1beta1.Query", + method: "NFT", + deps: [QueryNFTRequest, QueryNFTResponse] +}); +/** + * Class queries an NFT class based on its id + * @name getClass + * @package cosmos.nft.v1beta1 + * @see proto service: cosmos.nft.v1beta1.Class + */ +export const getClass = buildQuery({ + encode: QueryClassRequest.encode, + decode: QueryClassResponse.decode, + service: "cosmos.nft.v1beta1.Query", + method: "Class", + deps: [QueryClassRequest, QueryClassResponse] +}); +/** + * Classes queries all NFT classes + * @name getClasses + * @package cosmos.nft.v1beta1 + * @see proto service: cosmos.nft.v1beta1.Classes + */ +export const getClasses = buildQuery({ + encode: QueryClassesRequest.encode, + decode: QueryClassesResponse.decode, + service: "cosmos.nft.v1beta1.Query", + method: "Classes", + deps: [QueryClassesRequest, QueryClassesResponse] +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/cosmos/nft/v1beta1/query.ts b/__fixtures__/v-next/outputv2/cosmos/nft/v1beta1/query.ts index 5692948090..c8aa68ea48 100644 --- a/__fixtures__/v-next/outputv2/cosmos/nft/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv2/cosmos/nft/v1beta1/query.ts @@ -3,6 +3,7 @@ import { NFT, NFTAmino, NFTSDKType, Class, ClassAmino, ClassSDKType } from "./nf import { BinaryReader, BinaryWriter } from "../../../binary"; import { isSet, DeepPartial } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "cosmos.nft.v1beta1"; /** * QueryBalanceRequest is the request type for the Query/Balance RPC method @@ -536,6 +537,15 @@ function createBaseQueryBalanceRequest(): QueryBalanceRequest { export const QueryBalanceRequest = { typeUrl: "/cosmos.nft.v1beta1.QueryBalanceRequest", aminoType: "cosmos-sdk/QueryBalanceRequest", + is(o: any): o is QueryBalanceRequest { + return o && (o.$typeUrl === QueryBalanceRequest.typeUrl || typeof o.classId === "string" && typeof o.owner === "string"); + }, + isSDK(o: any): o is QueryBalanceRequestSDKType { + return o && (o.$typeUrl === QueryBalanceRequest.typeUrl || typeof o.class_id === "string" && typeof o.owner === "string"); + }, + isAmino(o: any): o is QueryBalanceRequestAmino { + return o && (o.$typeUrl === QueryBalanceRequest.typeUrl || typeof o.class_id === "string" && typeof o.owner === "string"); + }, encode(message: QueryBalanceRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.classId !== "") { writer.uint32(10).string(message.classId); @@ -631,7 +641,8 @@ export const QueryBalanceRequest = { typeUrl: "/cosmos.nft.v1beta1.QueryBalanceRequest", value: QueryBalanceRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryBalanceResponse(): QueryBalanceResponse { return { @@ -647,6 +658,15 @@ function createBaseQueryBalanceResponse(): QueryBalanceResponse { export const QueryBalanceResponse = { typeUrl: "/cosmos.nft.v1beta1.QueryBalanceResponse", aminoType: "cosmos-sdk/QueryBalanceResponse", + is(o: any): o is QueryBalanceResponse { + return o && (o.$typeUrl === QueryBalanceResponse.typeUrl || typeof o.amount === "bigint"); + }, + isSDK(o: any): o is QueryBalanceResponseSDKType { + return o && (o.$typeUrl === QueryBalanceResponse.typeUrl || typeof o.amount === "bigint"); + }, + isAmino(o: any): o is QueryBalanceResponseAmino { + return o && (o.$typeUrl === QueryBalanceResponse.typeUrl || typeof o.amount === "bigint"); + }, encode(message: QueryBalanceResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.amount !== BigInt(0)) { writer.uint32(8).uint64(message.amount); @@ -729,7 +749,8 @@ export const QueryBalanceResponse = { typeUrl: "/cosmos.nft.v1beta1.QueryBalanceResponse", value: QueryBalanceResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryOwnerRequest(): QueryOwnerRequest { return { @@ -746,6 +767,15 @@ function createBaseQueryOwnerRequest(): QueryOwnerRequest { export const QueryOwnerRequest = { typeUrl: "/cosmos.nft.v1beta1.QueryOwnerRequest", aminoType: "cosmos-sdk/QueryOwnerRequest", + is(o: any): o is QueryOwnerRequest { + return o && (o.$typeUrl === QueryOwnerRequest.typeUrl || typeof o.classId === "string" && typeof o.id === "string"); + }, + isSDK(o: any): o is QueryOwnerRequestSDKType { + return o && (o.$typeUrl === QueryOwnerRequest.typeUrl || typeof o.class_id === "string" && typeof o.id === "string"); + }, + isAmino(o: any): o is QueryOwnerRequestAmino { + return o && (o.$typeUrl === QueryOwnerRequest.typeUrl || typeof o.class_id === "string" && typeof o.id === "string"); + }, encode(message: QueryOwnerRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.classId !== "") { writer.uint32(10).string(message.classId); @@ -841,7 +871,8 @@ export const QueryOwnerRequest = { typeUrl: "/cosmos.nft.v1beta1.QueryOwnerRequest", value: QueryOwnerRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryOwnerResponse(): QueryOwnerResponse { return { @@ -857,6 +888,15 @@ function createBaseQueryOwnerResponse(): QueryOwnerResponse { export const QueryOwnerResponse = { typeUrl: "/cosmos.nft.v1beta1.QueryOwnerResponse", aminoType: "cosmos-sdk/QueryOwnerResponse", + is(o: any): o is QueryOwnerResponse { + return o && (o.$typeUrl === QueryOwnerResponse.typeUrl || typeof o.owner === "string"); + }, + isSDK(o: any): o is QueryOwnerResponseSDKType { + return o && (o.$typeUrl === QueryOwnerResponse.typeUrl || typeof o.owner === "string"); + }, + isAmino(o: any): o is QueryOwnerResponseAmino { + return o && (o.$typeUrl === QueryOwnerResponse.typeUrl || typeof o.owner === "string"); + }, encode(message: QueryOwnerResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.owner !== "") { writer.uint32(10).string(message.owner); @@ -937,7 +977,8 @@ export const QueryOwnerResponse = { typeUrl: "/cosmos.nft.v1beta1.QueryOwnerResponse", value: QueryOwnerResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQuerySupplyRequest(): QuerySupplyRequest { return { @@ -953,6 +994,15 @@ function createBaseQuerySupplyRequest(): QuerySupplyRequest { export const QuerySupplyRequest = { typeUrl: "/cosmos.nft.v1beta1.QuerySupplyRequest", aminoType: "cosmos-sdk/QuerySupplyRequest", + is(o: any): o is QuerySupplyRequest { + return o && (o.$typeUrl === QuerySupplyRequest.typeUrl || typeof o.classId === "string"); + }, + isSDK(o: any): o is QuerySupplyRequestSDKType { + return o && (o.$typeUrl === QuerySupplyRequest.typeUrl || typeof o.class_id === "string"); + }, + isAmino(o: any): o is QuerySupplyRequestAmino { + return o && (o.$typeUrl === QuerySupplyRequest.typeUrl || typeof o.class_id === "string"); + }, encode(message: QuerySupplyRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.classId !== "") { writer.uint32(10).string(message.classId); @@ -1033,7 +1083,8 @@ export const QuerySupplyRequest = { typeUrl: "/cosmos.nft.v1beta1.QuerySupplyRequest", value: QuerySupplyRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQuerySupplyResponse(): QuerySupplyResponse { return { @@ -1049,6 +1100,15 @@ function createBaseQuerySupplyResponse(): QuerySupplyResponse { export const QuerySupplyResponse = { typeUrl: "/cosmos.nft.v1beta1.QuerySupplyResponse", aminoType: "cosmos-sdk/QuerySupplyResponse", + is(o: any): o is QuerySupplyResponse { + return o && (o.$typeUrl === QuerySupplyResponse.typeUrl || typeof o.amount === "bigint"); + }, + isSDK(o: any): o is QuerySupplyResponseSDKType { + return o && (o.$typeUrl === QuerySupplyResponse.typeUrl || typeof o.amount === "bigint"); + }, + isAmino(o: any): o is QuerySupplyResponseAmino { + return o && (o.$typeUrl === QuerySupplyResponse.typeUrl || typeof o.amount === "bigint"); + }, encode(message: QuerySupplyResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.amount !== BigInt(0)) { writer.uint32(8).uint64(message.amount); @@ -1131,7 +1191,8 @@ export const QuerySupplyResponse = { typeUrl: "/cosmos.nft.v1beta1.QuerySupplyResponse", value: QuerySupplyResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryNFTsRequest(): QueryNFTsRequest { return { @@ -1149,6 +1210,15 @@ function createBaseQueryNFTsRequest(): QueryNFTsRequest { export const QueryNFTsRequest = { typeUrl: "/cosmos.nft.v1beta1.QueryNFTsRequest", aminoType: "cosmos-sdk/QueryNFTsRequest", + is(o: any): o is QueryNFTsRequest { + return o && (o.$typeUrl === QueryNFTsRequest.typeUrl || typeof o.classId === "string" && typeof o.owner === "string"); + }, + isSDK(o: any): o is QueryNFTsRequestSDKType { + return o && (o.$typeUrl === QueryNFTsRequest.typeUrl || typeof o.class_id === "string" && typeof o.owner === "string"); + }, + isAmino(o: any): o is QueryNFTsRequestAmino { + return o && (o.$typeUrl === QueryNFTsRequest.typeUrl || typeof o.class_id === "string" && typeof o.owner === "string"); + }, encode(message: QueryNFTsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.classId !== "") { writer.uint32(10).string(message.classId); @@ -1261,6 +1331,12 @@ export const QueryNFTsRequest = { typeUrl: "/cosmos.nft.v1beta1.QueryNFTsRequest", value: QueryNFTsRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryNFTsRequest.typeUrl)) { + return; + } + PageRequest.registerTypeUrl(); } }; function createBaseQueryNFTsResponse(): QueryNFTsResponse { @@ -1278,6 +1354,15 @@ function createBaseQueryNFTsResponse(): QueryNFTsResponse { export const QueryNFTsResponse = { typeUrl: "/cosmos.nft.v1beta1.QueryNFTsResponse", aminoType: "cosmos-sdk/QueryNFTsResponse", + is(o: any): o is QueryNFTsResponse { + return o && (o.$typeUrl === QueryNFTsResponse.typeUrl || Array.isArray(o.nfts) && (!o.nfts.length || NFT.is(o.nfts[0]))); + }, + isSDK(o: any): o is QueryNFTsResponseSDKType { + return o && (o.$typeUrl === QueryNFTsResponse.typeUrl || Array.isArray(o.nfts) && (!o.nfts.length || NFT.isSDK(o.nfts[0]))); + }, + isAmino(o: any): o is QueryNFTsResponseAmino { + return o && (o.$typeUrl === QueryNFTsResponse.typeUrl || Array.isArray(o.nfts) && (!o.nfts.length || NFT.isAmino(o.nfts[0]))); + }, encode(message: QueryNFTsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.nfts) { NFT.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -1385,6 +1470,13 @@ export const QueryNFTsResponse = { typeUrl: "/cosmos.nft.v1beta1.QueryNFTsResponse", value: QueryNFTsResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryNFTsResponse.typeUrl)) { + return; + } + NFT.registerTypeUrl(); + PageResponse.registerTypeUrl(); } }; function createBaseQueryNFTRequest(): QueryNFTRequest { @@ -1402,6 +1494,15 @@ function createBaseQueryNFTRequest(): QueryNFTRequest { export const QueryNFTRequest = { typeUrl: "/cosmos.nft.v1beta1.QueryNFTRequest", aminoType: "cosmos-sdk/QueryNFTRequest", + is(o: any): o is QueryNFTRequest { + return o && (o.$typeUrl === QueryNFTRequest.typeUrl || typeof o.classId === "string" && typeof o.id === "string"); + }, + isSDK(o: any): o is QueryNFTRequestSDKType { + return o && (o.$typeUrl === QueryNFTRequest.typeUrl || typeof o.class_id === "string" && typeof o.id === "string"); + }, + isAmino(o: any): o is QueryNFTRequestAmino { + return o && (o.$typeUrl === QueryNFTRequest.typeUrl || typeof o.class_id === "string" && typeof o.id === "string"); + }, encode(message: QueryNFTRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.classId !== "") { writer.uint32(10).string(message.classId); @@ -1497,7 +1598,8 @@ export const QueryNFTRequest = { typeUrl: "/cosmos.nft.v1beta1.QueryNFTRequest", value: QueryNFTRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryNFTResponse(): QueryNFTResponse { return { @@ -1513,6 +1615,15 @@ function createBaseQueryNFTResponse(): QueryNFTResponse { export const QueryNFTResponse = { typeUrl: "/cosmos.nft.v1beta1.QueryNFTResponse", aminoType: "cosmos-sdk/QueryNFTResponse", + is(o: any): o is QueryNFTResponse { + return o && o.$typeUrl === QueryNFTResponse.typeUrl; + }, + isSDK(o: any): o is QueryNFTResponseSDKType { + return o && o.$typeUrl === QueryNFTResponse.typeUrl; + }, + isAmino(o: any): o is QueryNFTResponseAmino { + return o && o.$typeUrl === QueryNFTResponse.typeUrl; + }, encode(message: QueryNFTResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.nft !== undefined) { NFT.encode(message.nft, writer.uint32(10).fork()).ldelim(); @@ -1595,6 +1706,12 @@ export const QueryNFTResponse = { typeUrl: "/cosmos.nft.v1beta1.QueryNFTResponse", value: QueryNFTResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryNFTResponse.typeUrl)) { + return; + } + NFT.registerTypeUrl(); } }; function createBaseQueryClassRequest(): QueryClassRequest { @@ -1611,6 +1728,15 @@ function createBaseQueryClassRequest(): QueryClassRequest { export const QueryClassRequest = { typeUrl: "/cosmos.nft.v1beta1.QueryClassRequest", aminoType: "cosmos-sdk/QueryClassRequest", + is(o: any): o is QueryClassRequest { + return o && (o.$typeUrl === QueryClassRequest.typeUrl || typeof o.classId === "string"); + }, + isSDK(o: any): o is QueryClassRequestSDKType { + return o && (o.$typeUrl === QueryClassRequest.typeUrl || typeof o.class_id === "string"); + }, + isAmino(o: any): o is QueryClassRequestAmino { + return o && (o.$typeUrl === QueryClassRequest.typeUrl || typeof o.class_id === "string"); + }, encode(message: QueryClassRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.classId !== "") { writer.uint32(10).string(message.classId); @@ -1691,7 +1817,8 @@ export const QueryClassRequest = { typeUrl: "/cosmos.nft.v1beta1.QueryClassRequest", value: QueryClassRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryClassResponse(): QueryClassResponse { return { @@ -1707,6 +1834,15 @@ function createBaseQueryClassResponse(): QueryClassResponse { export const QueryClassResponse = { typeUrl: "/cosmos.nft.v1beta1.QueryClassResponse", aminoType: "cosmos-sdk/QueryClassResponse", + is(o: any): o is QueryClassResponse { + return o && o.$typeUrl === QueryClassResponse.typeUrl; + }, + isSDK(o: any): o is QueryClassResponseSDKType { + return o && o.$typeUrl === QueryClassResponse.typeUrl; + }, + isAmino(o: any): o is QueryClassResponseAmino { + return o && o.$typeUrl === QueryClassResponse.typeUrl; + }, encode(message: QueryClassResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.class !== undefined) { Class.encode(message.class, writer.uint32(10).fork()).ldelim(); @@ -1789,6 +1925,12 @@ export const QueryClassResponse = { typeUrl: "/cosmos.nft.v1beta1.QueryClassResponse", value: QueryClassResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryClassResponse.typeUrl)) { + return; + } + Class.registerTypeUrl(); } }; function createBaseQueryClassesRequest(): QueryClassesRequest { @@ -1805,6 +1947,15 @@ function createBaseQueryClassesRequest(): QueryClassesRequest { export const QueryClassesRequest = { typeUrl: "/cosmos.nft.v1beta1.QueryClassesRequest", aminoType: "cosmos-sdk/QueryClassesRequest", + is(o: any): o is QueryClassesRequest { + return o && o.$typeUrl === QueryClassesRequest.typeUrl; + }, + isSDK(o: any): o is QueryClassesRequestSDKType { + return o && o.$typeUrl === QueryClassesRequest.typeUrl; + }, + isAmino(o: any): o is QueryClassesRequestAmino { + return o && o.$typeUrl === QueryClassesRequest.typeUrl; + }, encode(message: QueryClassesRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.pagination !== undefined) { PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); @@ -1887,6 +2038,12 @@ export const QueryClassesRequest = { typeUrl: "/cosmos.nft.v1beta1.QueryClassesRequest", value: QueryClassesRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryClassesRequest.typeUrl)) { + return; + } + PageRequest.registerTypeUrl(); } }; function createBaseQueryClassesResponse(): QueryClassesResponse { @@ -1904,6 +2061,15 @@ function createBaseQueryClassesResponse(): QueryClassesResponse { export const QueryClassesResponse = { typeUrl: "/cosmos.nft.v1beta1.QueryClassesResponse", aminoType: "cosmos-sdk/QueryClassesResponse", + is(o: any): o is QueryClassesResponse { + return o && (o.$typeUrl === QueryClassesResponse.typeUrl || Array.isArray(o.classes) && (!o.classes.length || Class.is(o.classes[0]))); + }, + isSDK(o: any): o is QueryClassesResponseSDKType { + return o && (o.$typeUrl === QueryClassesResponse.typeUrl || Array.isArray(o.classes) && (!o.classes.length || Class.isSDK(o.classes[0]))); + }, + isAmino(o: any): o is QueryClassesResponseAmino { + return o && (o.$typeUrl === QueryClassesResponse.typeUrl || Array.isArray(o.classes) && (!o.classes.length || Class.isAmino(o.classes[0]))); + }, encode(message: QueryClassesResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.classes) { Class.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -2011,5 +2177,12 @@ export const QueryClassesResponse = { typeUrl: "/cosmos.nft.v1beta1.QueryClassesResponse", value: QueryClassesResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryClassesResponse.typeUrl)) { + return; + } + Class.registerTypeUrl(); + PageResponse.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/cosmos/nft/v1beta1/tx.registry.ts b/__fixtures__/v-next/outputv2/cosmos/nft/v1beta1/tx.registry.ts index 44ffd8b132..bc4b9d68a8 100644 --- a/__fixtures__/v-next/outputv2/cosmos/nft/v1beta1/tx.registry.ts +++ b/__fixtures__/v-next/outputv2/cosmos/nft/v1beta1/tx.registry.ts @@ -1,11 +1,6 @@ -import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { TelescopeGeneratedType } from "../../../types"; import { MsgSend } from "./tx"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/cosmos.nft.v1beta1.MsgSend", MsgSend]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/cosmos.nft.v1beta1.MsgSend", MsgSend]]; export const MessageComposer = { encoded: { send(value: MsgSend) { diff --git a/__fixtures__/v-next/outputv2/cosmos/nft/v1beta1/tx.rpc.func.ts b/__fixtures__/v-next/outputv2/cosmos/nft/v1beta1/tx.rpc.func.ts new file mode 100644 index 0000000000..657be11d0e --- /dev/null +++ b/__fixtures__/v-next/outputv2/cosmos/nft/v1beta1/tx.rpc.func.ts @@ -0,0 +1,11 @@ +import { buildTx } from "../../../helper-func-types"; +import { MsgSend } from "./tx"; +/** + * Send defines a method to send a nft from one account to another account. + * @name send + * @package cosmos.nft.v1beta1 + * @see proto service: cosmos.nft.v1beta1.Send + */ +export const send = buildTx({ + msg: MsgSend +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/cosmos/nft/v1beta1/tx.ts b/__fixtures__/v-next/outputv2/cosmos/nft/v1beta1/tx.ts index b476645d40..9383acf4a2 100644 --- a/__fixtures__/v-next/outputv2/cosmos/nft/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputv2/cosmos/nft/v1beta1/tx.ts @@ -116,6 +116,15 @@ function createBaseMsgSend(): MsgSend { export const MsgSend = { typeUrl: "/cosmos.nft.v1beta1.MsgSend", aminoType: "cosmos-sdk/MsgNFTSend", + is(o: any): o is MsgSend { + return o && (o.$typeUrl === MsgSend.typeUrl || typeof o.classId === "string" && typeof o.id === "string" && typeof o.sender === "string" && typeof o.receiver === "string"); + }, + isSDK(o: any): o is MsgSendSDKType { + return o && (o.$typeUrl === MsgSend.typeUrl || typeof o.class_id === "string" && typeof o.id === "string" && typeof o.sender === "string" && typeof o.receiver === "string"); + }, + isAmino(o: any): o is MsgSendAmino { + return o && (o.$typeUrl === MsgSend.typeUrl || typeof o.class_id === "string" && typeof o.id === "string" && typeof o.sender === "string" && typeof o.receiver === "string"); + }, encode(message: MsgSend, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.classId !== "") { writer.uint32(10).string(message.classId); @@ -241,7 +250,8 @@ export const MsgSend = { typeUrl: "/cosmos.nft.v1beta1.MsgSend", value: MsgSend.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgSendResponse(): MsgSendResponse { return {}; @@ -255,6 +265,15 @@ function createBaseMsgSendResponse(): MsgSendResponse { export const MsgSendResponse = { typeUrl: "/cosmos.nft.v1beta1.MsgSendResponse", aminoType: "cosmos-sdk/MsgSendResponse", + is(o: any): o is MsgSendResponse { + return o && o.$typeUrl === MsgSendResponse.typeUrl; + }, + isSDK(o: any): o is MsgSendResponseSDKType { + return o && o.$typeUrl === MsgSendResponse.typeUrl; + }, + isAmino(o: any): o is MsgSendResponseAmino { + return o && o.$typeUrl === MsgSendResponse.typeUrl; + }, encode(_: MsgSendResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -319,5 +338,6 @@ export const MsgSendResponse = { typeUrl: "/cosmos.nft.v1beta1.MsgSendResponse", value: MsgSendResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/cosmos/orm/module/v1alpha1/module.ts b/__fixtures__/v-next/outputv2/cosmos/orm/module/v1alpha1/module.ts index 1ee77ea2ff..077bb42c2e 100644 --- a/__fixtures__/v-next/outputv2/cosmos/orm/module/v1alpha1/module.ts +++ b/__fixtures__/v-next/outputv2/cosmos/orm/module/v1alpha1/module.ts @@ -51,6 +51,15 @@ function createBaseModule(): Module { export const Module = { typeUrl: "/cosmos.orm.module.v1alpha1.Module", aminoType: "cosmos-sdk/Module", + is(o: any): o is Module { + return o && o.$typeUrl === Module.typeUrl; + }, + isSDK(o: any): o is ModuleSDKType { + return o && o.$typeUrl === Module.typeUrl; + }, + isAmino(o: any): o is ModuleAmino { + return o && o.$typeUrl === Module.typeUrl; + }, encode(_: Module, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -115,5 +124,6 @@ export const Module = { typeUrl: "/cosmos.orm.module.v1alpha1.Module", value: Module.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/cosmos/orm/v1/orm.ts b/__fixtures__/v-next/outputv2/cosmos/orm/v1/orm.ts index 3d63c6c893..7b91b7db85 100644 --- a/__fixtures__/v-next/outputv2/cosmos/orm/v1/orm.ts +++ b/__fixtures__/v-next/outputv2/cosmos/orm/v1/orm.ts @@ -1,4 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; +import { GlobalDecoderRegistry } from "../../../registry"; import { isSet, DeepPartial } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "cosmos.orm.v1"; @@ -317,6 +318,15 @@ function createBaseTableDescriptor(): TableDescriptor { export const TableDescriptor = { typeUrl: "/cosmos.orm.v1.TableDescriptor", aminoType: "cosmos-sdk/TableDescriptor", + is(o: any): o is TableDescriptor { + return o && (o.$typeUrl === TableDescriptor.typeUrl || Array.isArray(o.index) && (!o.index.length || SecondaryIndexDescriptor.is(o.index[0])) && typeof o.id === "number"); + }, + isSDK(o: any): o is TableDescriptorSDKType { + return o && (o.$typeUrl === TableDescriptor.typeUrl || Array.isArray(o.index) && (!o.index.length || SecondaryIndexDescriptor.isSDK(o.index[0])) && typeof o.id === "number"); + }, + isAmino(o: any): o is TableDescriptorAmino { + return o && (o.$typeUrl === TableDescriptor.typeUrl || Array.isArray(o.index) && (!o.index.length || SecondaryIndexDescriptor.isAmino(o.index[0])) && typeof o.id === "number"); + }, encode(message: TableDescriptor, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.primaryKey !== undefined) { PrimaryKeyDescriptor.encode(message.primaryKey, writer.uint32(10).fork()).ldelim(); @@ -439,6 +449,13 @@ export const TableDescriptor = { typeUrl: "/cosmos.orm.v1.TableDescriptor", value: TableDescriptor.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(TableDescriptor.typeUrl)) { + return; + } + PrimaryKeyDescriptor.registerTypeUrl(); + SecondaryIndexDescriptor.registerTypeUrl(); } }; function createBasePrimaryKeyDescriptor(): PrimaryKeyDescriptor { @@ -456,6 +473,15 @@ function createBasePrimaryKeyDescriptor(): PrimaryKeyDescriptor { export const PrimaryKeyDescriptor = { typeUrl: "/cosmos.orm.v1.PrimaryKeyDescriptor", aminoType: "cosmos-sdk/PrimaryKeyDescriptor", + is(o: any): o is PrimaryKeyDescriptor { + return o && (o.$typeUrl === PrimaryKeyDescriptor.typeUrl || typeof o.fields === "string" && typeof o.autoIncrement === "boolean"); + }, + isSDK(o: any): o is PrimaryKeyDescriptorSDKType { + return o && (o.$typeUrl === PrimaryKeyDescriptor.typeUrl || typeof o.fields === "string" && typeof o.auto_increment === "boolean"); + }, + isAmino(o: any): o is PrimaryKeyDescriptorAmino { + return o && (o.$typeUrl === PrimaryKeyDescriptor.typeUrl || typeof o.fields === "string" && typeof o.auto_increment === "boolean"); + }, encode(message: PrimaryKeyDescriptor, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.fields !== "") { writer.uint32(10).string(message.fields); @@ -551,7 +577,8 @@ export const PrimaryKeyDescriptor = { typeUrl: "/cosmos.orm.v1.PrimaryKeyDescriptor", value: PrimaryKeyDescriptor.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseSecondaryIndexDescriptor(): SecondaryIndexDescriptor { return { @@ -569,6 +596,15 @@ function createBaseSecondaryIndexDescriptor(): SecondaryIndexDescriptor { export const SecondaryIndexDescriptor = { typeUrl: "/cosmos.orm.v1.SecondaryIndexDescriptor", aminoType: "cosmos-sdk/SecondaryIndexDescriptor", + is(o: any): o is SecondaryIndexDescriptor { + return o && (o.$typeUrl === SecondaryIndexDescriptor.typeUrl || typeof o.fields === "string" && typeof o.id === "number" && typeof o.unique === "boolean"); + }, + isSDK(o: any): o is SecondaryIndexDescriptorSDKType { + return o && (o.$typeUrl === SecondaryIndexDescriptor.typeUrl || typeof o.fields === "string" && typeof o.id === "number" && typeof o.unique === "boolean"); + }, + isAmino(o: any): o is SecondaryIndexDescriptorAmino { + return o && (o.$typeUrl === SecondaryIndexDescriptor.typeUrl || typeof o.fields === "string" && typeof o.id === "number" && typeof o.unique === "boolean"); + }, encode(message: SecondaryIndexDescriptor, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.fields !== "") { writer.uint32(10).string(message.fields); @@ -679,7 +715,8 @@ export const SecondaryIndexDescriptor = { typeUrl: "/cosmos.orm.v1.SecondaryIndexDescriptor", value: SecondaryIndexDescriptor.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseSingletonDescriptor(): SingletonDescriptor { return { @@ -695,6 +732,15 @@ function createBaseSingletonDescriptor(): SingletonDescriptor { export const SingletonDescriptor = { typeUrl: "/cosmos.orm.v1.SingletonDescriptor", aminoType: "cosmos-sdk/SingletonDescriptor", + is(o: any): o is SingletonDescriptor { + return o && (o.$typeUrl === SingletonDescriptor.typeUrl || typeof o.id === "number"); + }, + isSDK(o: any): o is SingletonDescriptorSDKType { + return o && (o.$typeUrl === SingletonDescriptor.typeUrl || typeof o.id === "number"); + }, + isAmino(o: any): o is SingletonDescriptorAmino { + return o && (o.$typeUrl === SingletonDescriptor.typeUrl || typeof o.id === "number"); + }, encode(message: SingletonDescriptor, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.id !== 0) { writer.uint32(8).uint32(message.id); @@ -775,5 +821,6 @@ export const SingletonDescriptor = { typeUrl: "/cosmos.orm.v1.SingletonDescriptor", value: SingletonDescriptor.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/cosmos/orm/v1alpha1/schema.ts b/__fixtures__/v-next/outputv2/cosmos/orm/v1alpha1/schema.ts index 6fb6c27acb..2f534286a9 100644 --- a/__fixtures__/v-next/outputv2/cosmos/orm/v1alpha1/schema.ts +++ b/__fixtures__/v-next/outputv2/cosmos/orm/v1alpha1/schema.ts @@ -1,6 +1,7 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; import { isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "cosmos.orm.v1alpha1"; /** StorageType */ export enum StorageType { @@ -217,6 +218,15 @@ function createBaseModuleSchemaDescriptor(): ModuleSchemaDescriptor { export const ModuleSchemaDescriptor = { typeUrl: "/cosmos.orm.v1alpha1.ModuleSchemaDescriptor", aminoType: "cosmos-sdk/ModuleSchemaDescriptor", + is(o: any): o is ModuleSchemaDescriptor { + return o && (o.$typeUrl === ModuleSchemaDescriptor.typeUrl || Array.isArray(o.schemaFile) && (!o.schemaFile.length || ModuleSchemaDescriptor_FileEntry.is(o.schemaFile[0])) && (o.prefix instanceof Uint8Array || typeof o.prefix === "string")); + }, + isSDK(o: any): o is ModuleSchemaDescriptorSDKType { + return o && (o.$typeUrl === ModuleSchemaDescriptor.typeUrl || Array.isArray(o.schema_file) && (!o.schema_file.length || ModuleSchemaDescriptor_FileEntry.isSDK(o.schema_file[0])) && (o.prefix instanceof Uint8Array || typeof o.prefix === "string")); + }, + isAmino(o: any): o is ModuleSchemaDescriptorAmino { + return o && (o.$typeUrl === ModuleSchemaDescriptor.typeUrl || Array.isArray(o.schema_file) && (!o.schema_file.length || ModuleSchemaDescriptor_FileEntry.isAmino(o.schema_file[0])) && (o.prefix instanceof Uint8Array || typeof o.prefix === "string")); + }, encode(message: ModuleSchemaDescriptor, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.schemaFile) { ModuleSchemaDescriptor_FileEntry.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -322,6 +332,12 @@ export const ModuleSchemaDescriptor = { typeUrl: "/cosmos.orm.v1alpha1.ModuleSchemaDescriptor", value: ModuleSchemaDescriptor.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ModuleSchemaDescriptor.typeUrl)) { + return; + } + ModuleSchemaDescriptor_FileEntry.registerTypeUrl(); } }; function createBaseModuleSchemaDescriptor_FileEntry(): ModuleSchemaDescriptor_FileEntry { @@ -340,6 +356,15 @@ function createBaseModuleSchemaDescriptor_FileEntry(): ModuleSchemaDescriptor_Fi export const ModuleSchemaDescriptor_FileEntry = { typeUrl: "/cosmos.orm.v1alpha1.FileEntry", aminoType: "cosmos-sdk/FileEntry", + is(o: any): o is ModuleSchemaDescriptor_FileEntry { + return o && (o.$typeUrl === ModuleSchemaDescriptor_FileEntry.typeUrl || typeof o.id === "number" && typeof o.protoFileName === "string" && isSet(o.storageType)); + }, + isSDK(o: any): o is ModuleSchemaDescriptor_FileEntrySDKType { + return o && (o.$typeUrl === ModuleSchemaDescriptor_FileEntry.typeUrl || typeof o.id === "number" && typeof o.proto_file_name === "string" && isSet(o.storage_type)); + }, + isAmino(o: any): o is ModuleSchemaDescriptor_FileEntryAmino { + return o && (o.$typeUrl === ModuleSchemaDescriptor_FileEntry.typeUrl || typeof o.id === "number" && typeof o.proto_file_name === "string" && isSet(o.storage_type)); + }, encode(message: ModuleSchemaDescriptor_FileEntry, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.id !== 0) { writer.uint32(8).uint32(message.id); @@ -450,5 +475,6 @@ export const ModuleSchemaDescriptor_FileEntry = { typeUrl: "/cosmos.orm.v1alpha1.FileEntry", value: ModuleSchemaDescriptor_FileEntry.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/cosmos/params/v1beta1/params.ts b/__fixtures__/v-next/outputv2/cosmos/params/v1beta1/params.ts index 4520ab73b7..9164b7757d 100644 --- a/__fixtures__/v-next/outputv2/cosmos/params/v1beta1/params.ts +++ b/__fixtures__/v-next/outputv2/cosmos/params/v1beta1/params.ts @@ -1,6 +1,7 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; import { isSet, DeepPartial } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "cosmos.params.v1beta1"; /** * ParameterChangeProposal defines a proposal to change one or more parameters. @@ -103,6 +104,15 @@ function createBaseParameterChangeProposal(): ParameterChangeProposal { export const ParameterChangeProposal = { typeUrl: "/cosmos.params.v1beta1.ParameterChangeProposal", aminoType: "cosmos-sdk/ParameterChangeProposal", + is(o: any): o is ParameterChangeProposal { + return o && (o.$typeUrl === ParameterChangeProposal.typeUrl || typeof o.title === "string" && typeof o.description === "string" && Array.isArray(o.changes) && (!o.changes.length || ParamChange.is(o.changes[0]))); + }, + isSDK(o: any): o is ParameterChangeProposalSDKType { + return o && (o.$typeUrl === ParameterChangeProposal.typeUrl || typeof o.title === "string" && typeof o.description === "string" && Array.isArray(o.changes) && (!o.changes.length || ParamChange.isSDK(o.changes[0]))); + }, + isAmino(o: any): o is ParameterChangeProposalAmino { + return o && (o.$typeUrl === ParameterChangeProposal.typeUrl || typeof o.title === "string" && typeof o.description === "string" && Array.isArray(o.changes) && (!o.changes.length || ParamChange.isAmino(o.changes[0]))); + }, encode(message: ParameterChangeProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.title !== "") { writer.uint32(10).string(message.title); @@ -223,6 +233,12 @@ export const ParameterChangeProposal = { typeUrl: "/cosmos.params.v1beta1.ParameterChangeProposal", value: ParameterChangeProposal.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ParameterChangeProposal.typeUrl)) { + return; + } + ParamChange.registerTypeUrl(); } }; function createBaseParamChange(): ParamChange { @@ -242,6 +258,15 @@ function createBaseParamChange(): ParamChange { export const ParamChange = { typeUrl: "/cosmos.params.v1beta1.ParamChange", aminoType: "cosmos-sdk/ParamChange", + is(o: any): o is ParamChange { + return o && (o.$typeUrl === ParamChange.typeUrl || typeof o.subspace === "string" && typeof o.key === "string" && typeof o.value === "string"); + }, + isSDK(o: any): o is ParamChangeSDKType { + return o && (o.$typeUrl === ParamChange.typeUrl || typeof o.subspace === "string" && typeof o.key === "string" && typeof o.value === "string"); + }, + isAmino(o: any): o is ParamChangeAmino { + return o && (o.$typeUrl === ParamChange.typeUrl || typeof o.subspace === "string" && typeof o.key === "string" && typeof o.value === "string"); + }, encode(message: ParamChange, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.subspace !== "") { writer.uint32(10).string(message.subspace); @@ -352,5 +377,6 @@ export const ParamChange = { typeUrl: "/cosmos.params.v1beta1.ParamChange", value: ParamChange.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/cosmos/params/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputv2/cosmos/params/v1beta1/query.rpc.func.ts new file mode 100644 index 0000000000..19339ea725 --- /dev/null +++ b/__fixtures__/v-next/outputv2/cosmos/params/v1beta1/query.rpc.func.ts @@ -0,0 +1,29 @@ +import { buildQuery } from "../../../helper-func-types"; +import { QueryParamsRequest, QueryParamsResponse, QuerySubspacesRequest, QuerySubspacesResponse } from "./query"; +/** + * Params queries a specific parameter of a module, given its subspace and + * key. + * @name getParams + * @package cosmos.params.v1beta1 + * @see proto service: cosmos.params.v1beta1.Params + */ +export const getParams = buildQuery({ + encode: QueryParamsRequest.encode, + decode: QueryParamsResponse.decode, + service: "cosmos.params.v1beta1.Query", + method: "Params", + deps: [QueryParamsRequest, QueryParamsResponse] +}); +/** + * Subspaces queries for all registered subspaces and all keys for a subspace. + * @name getSubspaces + * @package cosmos.params.v1beta1 + * @see proto service: cosmos.params.v1beta1.Subspaces + */ +export const getSubspaces = buildQuery({ + encode: QuerySubspacesRequest.encode, + decode: QuerySubspacesResponse.decode, + service: "cosmos.params.v1beta1.Query", + method: "Subspaces", + deps: [QuerySubspacesRequest, QuerySubspacesResponse] +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/cosmos/params/v1beta1/query.ts b/__fixtures__/v-next/outputv2/cosmos/params/v1beta1/query.ts index 716559a831..670e3c6b82 100644 --- a/__fixtures__/v-next/outputv2/cosmos/params/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv2/cosmos/params/v1beta1/query.ts @@ -2,6 +2,7 @@ import { ParamChange, ParamChangeAmino, ParamChangeSDKType } from "./params"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { isSet, DeepPartial } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "cosmos.params.v1beta1"; /** * QueryParamsRequest is request type for the Query/Params RPC method. @@ -220,6 +221,15 @@ function createBaseQueryParamsRequest(): QueryParamsRequest { export const QueryParamsRequest = { typeUrl: "/cosmos.params.v1beta1.QueryParamsRequest", aminoType: "cosmos-sdk/QueryParamsRequest", + is(o: any): o is QueryParamsRequest { + return o && (o.$typeUrl === QueryParamsRequest.typeUrl || typeof o.subspace === "string" && typeof o.key === "string"); + }, + isSDK(o: any): o is QueryParamsRequestSDKType { + return o && (o.$typeUrl === QueryParamsRequest.typeUrl || typeof o.subspace === "string" && typeof o.key === "string"); + }, + isAmino(o: any): o is QueryParamsRequestAmino { + return o && (o.$typeUrl === QueryParamsRequest.typeUrl || typeof o.subspace === "string" && typeof o.key === "string"); + }, encode(message: QueryParamsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.subspace !== "") { writer.uint32(10).string(message.subspace); @@ -315,7 +325,8 @@ export const QueryParamsRequest = { typeUrl: "/cosmos.params.v1beta1.QueryParamsRequest", value: QueryParamsRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryParamsResponse(): QueryParamsResponse { return { @@ -331,6 +342,15 @@ function createBaseQueryParamsResponse(): QueryParamsResponse { export const QueryParamsResponse = { typeUrl: "/cosmos.params.v1beta1.QueryParamsResponse", aminoType: "cosmos-sdk/QueryParamsResponse", + is(o: any): o is QueryParamsResponse { + return o && (o.$typeUrl === QueryParamsResponse.typeUrl || ParamChange.is(o.param)); + }, + isSDK(o: any): o is QueryParamsResponseSDKType { + return o && (o.$typeUrl === QueryParamsResponse.typeUrl || ParamChange.isSDK(o.param)); + }, + isAmino(o: any): o is QueryParamsResponseAmino { + return o && (o.$typeUrl === QueryParamsResponse.typeUrl || ParamChange.isAmino(o.param)); + }, encode(message: QueryParamsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.param !== undefined) { ParamChange.encode(message.param, writer.uint32(10).fork()).ldelim(); @@ -413,6 +433,12 @@ export const QueryParamsResponse = { typeUrl: "/cosmos.params.v1beta1.QueryParamsResponse", value: QueryParamsResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryParamsResponse.typeUrl)) { + return; + } + ParamChange.registerTypeUrl(); } }; function createBaseQuerySubspacesRequest(): QuerySubspacesRequest { @@ -428,6 +454,15 @@ function createBaseQuerySubspacesRequest(): QuerySubspacesRequest { export const QuerySubspacesRequest = { typeUrl: "/cosmos.params.v1beta1.QuerySubspacesRequest", aminoType: "cosmos-sdk/QuerySubspacesRequest", + is(o: any): o is QuerySubspacesRequest { + return o && o.$typeUrl === QuerySubspacesRequest.typeUrl; + }, + isSDK(o: any): o is QuerySubspacesRequestSDKType { + return o && o.$typeUrl === QuerySubspacesRequest.typeUrl; + }, + isAmino(o: any): o is QuerySubspacesRequestAmino { + return o && o.$typeUrl === QuerySubspacesRequest.typeUrl; + }, encode(_: QuerySubspacesRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -492,7 +527,8 @@ export const QuerySubspacesRequest = { typeUrl: "/cosmos.params.v1beta1.QuerySubspacesRequest", value: QuerySubspacesRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQuerySubspacesResponse(): QuerySubspacesResponse { return { @@ -509,6 +545,15 @@ function createBaseQuerySubspacesResponse(): QuerySubspacesResponse { export const QuerySubspacesResponse = { typeUrl: "/cosmos.params.v1beta1.QuerySubspacesResponse", aminoType: "cosmos-sdk/QuerySubspacesResponse", + is(o: any): o is QuerySubspacesResponse { + return o && (o.$typeUrl === QuerySubspacesResponse.typeUrl || Array.isArray(o.subspaces) && (!o.subspaces.length || Subspace.is(o.subspaces[0]))); + }, + isSDK(o: any): o is QuerySubspacesResponseSDKType { + return o && (o.$typeUrl === QuerySubspacesResponse.typeUrl || Array.isArray(o.subspaces) && (!o.subspaces.length || Subspace.isSDK(o.subspaces[0]))); + }, + isAmino(o: any): o is QuerySubspacesResponseAmino { + return o && (o.$typeUrl === QuerySubspacesResponse.typeUrl || Array.isArray(o.subspaces) && (!o.subspaces.length || Subspace.isAmino(o.subspaces[0]))); + }, encode(message: QuerySubspacesResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.subspaces) { Subspace.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -599,6 +644,12 @@ export const QuerySubspacesResponse = { typeUrl: "/cosmos.params.v1beta1.QuerySubspacesResponse", value: QuerySubspacesResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QuerySubspacesResponse.typeUrl)) { + return; + } + Subspace.registerTypeUrl(); } }; function createBaseSubspace(): Subspace { @@ -617,6 +668,15 @@ function createBaseSubspace(): Subspace { export const Subspace = { typeUrl: "/cosmos.params.v1beta1.Subspace", aminoType: "cosmos-sdk/Subspace", + is(o: any): o is Subspace { + return o && (o.$typeUrl === Subspace.typeUrl || typeof o.subspace === "string" && Array.isArray(o.keys) && (!o.keys.length || typeof o.keys[0] === "string")); + }, + isSDK(o: any): o is SubspaceSDKType { + return o && (o.$typeUrl === Subspace.typeUrl || typeof o.subspace === "string" && Array.isArray(o.keys) && (!o.keys.length || typeof o.keys[0] === "string")); + }, + isAmino(o: any): o is SubspaceAmino { + return o && (o.$typeUrl === Subspace.typeUrl || typeof o.subspace === "string" && Array.isArray(o.keys) && (!o.keys.length || typeof o.keys[0] === "string")); + }, encode(message: Subspace, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.subspace !== "") { writer.uint32(10).string(message.subspace); @@ -722,5 +782,6 @@ export const Subspace = { typeUrl: "/cosmos.params.v1beta1.Subspace", value: Subspace.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/cosmos/slashing/v1beta1/genesis.ts b/__fixtures__/v-next/outputv2/cosmos/slashing/v1beta1/genesis.ts index 38688787db..a187eb2d03 100644 --- a/__fixtures__/v-next/outputv2/cosmos/slashing/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv2/cosmos/slashing/v1beta1/genesis.ts @@ -1,5 +1,6 @@ import { Params, ParamsAmino, ParamsSDKType, ValidatorSigningInfo, ValidatorSigningInfoAmino, ValidatorSigningInfoSDKType } from "./slashing"; import { BinaryReader, BinaryWriter } from "../../../binary"; +import { GlobalDecoderRegistry } from "../../../registry"; import { isSet, DeepPartial } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "cosmos.slashing.v1beta1"; @@ -235,6 +236,15 @@ function createBaseGenesisState(): GenesisState { export const GenesisState = { typeUrl: "/cosmos.slashing.v1beta1.GenesisState", aminoType: "cosmos-sdk/GenesisState", + is(o: any): o is GenesisState { + return o && (o.$typeUrl === GenesisState.typeUrl || Params.is(o.params) && Array.isArray(o.signingInfos) && (!o.signingInfos.length || SigningInfo.is(o.signingInfos[0])) && Array.isArray(o.missedBlocks) && (!o.missedBlocks.length || ValidatorMissedBlocks.is(o.missedBlocks[0]))); + }, + isSDK(o: any): o is GenesisStateSDKType { + return o && (o.$typeUrl === GenesisState.typeUrl || Params.isSDK(o.params) && Array.isArray(o.signing_infos) && (!o.signing_infos.length || SigningInfo.isSDK(o.signing_infos[0])) && Array.isArray(o.missed_blocks) && (!o.missed_blocks.length || ValidatorMissedBlocks.isSDK(o.missed_blocks[0]))); + }, + isAmino(o: any): o is GenesisStateAmino { + return o && (o.$typeUrl === GenesisState.typeUrl || Params.isAmino(o.params) && Array.isArray(o.signing_infos) && (!o.signing_infos.length || SigningInfo.isAmino(o.signing_infos[0])) && Array.isArray(o.missed_blocks) && (!o.missed_blocks.length || ValidatorMissedBlocks.isAmino(o.missed_blocks[0]))); + }, encode(message: GenesisState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.params !== undefined) { Params.encode(message.params, writer.uint32(10).fork()).ldelim(); @@ -367,6 +377,14 @@ export const GenesisState = { typeUrl: "/cosmos.slashing.v1beta1.GenesisState", value: GenesisState.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GenesisState.typeUrl)) { + return; + } + Params.registerTypeUrl(); + SigningInfo.registerTypeUrl(); + ValidatorMissedBlocks.registerTypeUrl(); } }; function createBaseSigningInfo(): SigningInfo { @@ -384,6 +402,15 @@ function createBaseSigningInfo(): SigningInfo { export const SigningInfo = { typeUrl: "/cosmos.slashing.v1beta1.SigningInfo", aminoType: "cosmos-sdk/SigningInfo", + is(o: any): o is SigningInfo { + return o && (o.$typeUrl === SigningInfo.typeUrl || typeof o.address === "string" && ValidatorSigningInfo.is(o.validatorSigningInfo)); + }, + isSDK(o: any): o is SigningInfoSDKType { + return o && (o.$typeUrl === SigningInfo.typeUrl || typeof o.address === "string" && ValidatorSigningInfo.isSDK(o.validator_signing_info)); + }, + isAmino(o: any): o is SigningInfoAmino { + return o && (o.$typeUrl === SigningInfo.typeUrl || typeof o.address === "string" && ValidatorSigningInfo.isAmino(o.validator_signing_info)); + }, encode(message: SigningInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.address !== "") { writer.uint32(10).string(message.address); @@ -481,6 +508,12 @@ export const SigningInfo = { typeUrl: "/cosmos.slashing.v1beta1.SigningInfo", value: SigningInfo.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(SigningInfo.typeUrl)) { + return; + } + ValidatorSigningInfo.registerTypeUrl(); } }; function createBaseValidatorMissedBlocks(): ValidatorMissedBlocks { @@ -499,6 +532,15 @@ function createBaseValidatorMissedBlocks(): ValidatorMissedBlocks { export const ValidatorMissedBlocks = { typeUrl: "/cosmos.slashing.v1beta1.ValidatorMissedBlocks", aminoType: "cosmos-sdk/ValidatorMissedBlocks", + is(o: any): o is ValidatorMissedBlocks { + return o && (o.$typeUrl === ValidatorMissedBlocks.typeUrl || typeof o.address === "string" && Array.isArray(o.missedBlocks) && (!o.missedBlocks.length || MissedBlock.is(o.missedBlocks[0]))); + }, + isSDK(o: any): o is ValidatorMissedBlocksSDKType { + return o && (o.$typeUrl === ValidatorMissedBlocks.typeUrl || typeof o.address === "string" && Array.isArray(o.missed_blocks) && (!o.missed_blocks.length || MissedBlock.isSDK(o.missed_blocks[0]))); + }, + isAmino(o: any): o is ValidatorMissedBlocksAmino { + return o && (o.$typeUrl === ValidatorMissedBlocks.typeUrl || typeof o.address === "string" && Array.isArray(o.missed_blocks) && (!o.missed_blocks.length || MissedBlock.isAmino(o.missed_blocks[0]))); + }, encode(message: ValidatorMissedBlocks, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.address !== "") { writer.uint32(10).string(message.address); @@ -604,6 +646,12 @@ export const ValidatorMissedBlocks = { typeUrl: "/cosmos.slashing.v1beta1.ValidatorMissedBlocks", value: ValidatorMissedBlocks.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ValidatorMissedBlocks.typeUrl)) { + return; + } + MissedBlock.registerTypeUrl(); } }; function createBaseMissedBlock(): MissedBlock { @@ -621,6 +669,15 @@ function createBaseMissedBlock(): MissedBlock { export const MissedBlock = { typeUrl: "/cosmos.slashing.v1beta1.MissedBlock", aminoType: "cosmos-sdk/MissedBlock", + is(o: any): o is MissedBlock { + return o && (o.$typeUrl === MissedBlock.typeUrl || typeof o.index === "bigint" && typeof o.missed === "boolean"); + }, + isSDK(o: any): o is MissedBlockSDKType { + return o && (o.$typeUrl === MissedBlock.typeUrl || typeof o.index === "bigint" && typeof o.missed === "boolean"); + }, + isAmino(o: any): o is MissedBlockAmino { + return o && (o.$typeUrl === MissedBlock.typeUrl || typeof o.index === "bigint" && typeof o.missed === "boolean"); + }, encode(message: MissedBlock, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.index !== BigInt(0)) { writer.uint32(8).int64(message.index); @@ -718,5 +775,6 @@ export const MissedBlock = { typeUrl: "/cosmos.slashing.v1beta1.MissedBlock", value: MissedBlock.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/cosmos/slashing/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputv2/cosmos/slashing/v1beta1/query.rpc.func.ts new file mode 100644 index 0000000000..763ace7f1e --- /dev/null +++ b/__fixtures__/v-next/outputv2/cosmos/slashing/v1beta1/query.rpc.func.ts @@ -0,0 +1,41 @@ +import { buildQuery } from "../../../helper-func-types"; +import { QueryParamsRequest, QueryParamsResponse, QuerySigningInfoRequest, QuerySigningInfoResponse, QuerySigningInfosRequest, QuerySigningInfosResponse } from "./query"; +/** + * Params queries the parameters of slashing module + * @name getParams + * @package cosmos.slashing.v1beta1 + * @see proto service: cosmos.slashing.v1beta1.Params + */ +export const getParams = buildQuery({ + encode: QueryParamsRequest.encode, + decode: QueryParamsResponse.decode, + service: "cosmos.slashing.v1beta1.Query", + method: "Params", + deps: [QueryParamsRequest, QueryParamsResponse] +}); +/** + * SigningInfo queries the signing info of given cons address + * @name getSigningInfo + * @package cosmos.slashing.v1beta1 + * @see proto service: cosmos.slashing.v1beta1.SigningInfo + */ +export const getSigningInfo = buildQuery({ + encode: QuerySigningInfoRequest.encode, + decode: QuerySigningInfoResponse.decode, + service: "cosmos.slashing.v1beta1.Query", + method: "SigningInfo", + deps: [QuerySigningInfoRequest, QuerySigningInfoResponse] +}); +/** + * SigningInfos queries signing info of all validators + * @name getSigningInfos + * @package cosmos.slashing.v1beta1 + * @see proto service: cosmos.slashing.v1beta1.SigningInfos + */ +export const getSigningInfos = buildQuery({ + encode: QuerySigningInfosRequest.encode, + decode: QuerySigningInfosResponse.decode, + service: "cosmos.slashing.v1beta1.Query", + method: "SigningInfos", + deps: [QuerySigningInfosRequest, QuerySigningInfosResponse] +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/cosmos/slashing/v1beta1/query.ts b/__fixtures__/v-next/outputv2/cosmos/slashing/v1beta1/query.ts index ec2daa33b6..392debfed5 100644 --- a/__fixtures__/v-next/outputv2/cosmos/slashing/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv2/cosmos/slashing/v1beta1/query.ts @@ -3,6 +3,7 @@ import { Params, ParamsAmino, ParamsSDKType, ValidatorSigningInfo, ValidatorSign import { BinaryReader, BinaryWriter } from "../../../binary"; import { JsonSafe } from "../../../json-safe"; import { DeepPartial, isSet } from "../../../helpers"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "cosmos.slashing.v1beta1"; /** * QueryParamsRequest is the request type for the Query/Params RPC method @@ -253,6 +254,15 @@ function createBaseQueryParamsRequest(): QueryParamsRequest { export const QueryParamsRequest = { typeUrl: "/cosmos.slashing.v1beta1.QueryParamsRequest", aminoType: "cosmos-sdk/QueryParamsRequest", + is(o: any): o is QueryParamsRequest { + return o && o.$typeUrl === QueryParamsRequest.typeUrl; + }, + isSDK(o: any): o is QueryParamsRequestSDKType { + return o && o.$typeUrl === QueryParamsRequest.typeUrl; + }, + isAmino(o: any): o is QueryParamsRequestAmino { + return o && o.$typeUrl === QueryParamsRequest.typeUrl; + }, encode(_: QueryParamsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -317,7 +327,8 @@ export const QueryParamsRequest = { typeUrl: "/cosmos.slashing.v1beta1.QueryParamsRequest", value: QueryParamsRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryParamsResponse(): QueryParamsResponse { return { @@ -333,6 +344,15 @@ function createBaseQueryParamsResponse(): QueryParamsResponse { export const QueryParamsResponse = { typeUrl: "/cosmos.slashing.v1beta1.QueryParamsResponse", aminoType: "cosmos-sdk/QueryParamsResponse", + is(o: any): o is QueryParamsResponse { + return o && (o.$typeUrl === QueryParamsResponse.typeUrl || Params.is(o.params)); + }, + isSDK(o: any): o is QueryParamsResponseSDKType { + return o && (o.$typeUrl === QueryParamsResponse.typeUrl || Params.isSDK(o.params)); + }, + isAmino(o: any): o is QueryParamsResponseAmino { + return o && (o.$typeUrl === QueryParamsResponse.typeUrl || Params.isAmino(o.params)); + }, encode(message: QueryParamsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.params !== undefined) { Params.encode(message.params, writer.uint32(10).fork()).ldelim(); @@ -415,6 +435,12 @@ export const QueryParamsResponse = { typeUrl: "/cosmos.slashing.v1beta1.QueryParamsResponse", value: QueryParamsResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryParamsResponse.typeUrl)) { + return; + } + Params.registerTypeUrl(); } }; function createBaseQuerySigningInfoRequest(): QuerySigningInfoRequest { @@ -432,6 +458,15 @@ function createBaseQuerySigningInfoRequest(): QuerySigningInfoRequest { export const QuerySigningInfoRequest = { typeUrl: "/cosmos.slashing.v1beta1.QuerySigningInfoRequest", aminoType: "cosmos-sdk/QuerySigningInfoRequest", + is(o: any): o is QuerySigningInfoRequest { + return o && (o.$typeUrl === QuerySigningInfoRequest.typeUrl || typeof o.consAddress === "string"); + }, + isSDK(o: any): o is QuerySigningInfoRequestSDKType { + return o && (o.$typeUrl === QuerySigningInfoRequest.typeUrl || typeof o.cons_address === "string"); + }, + isAmino(o: any): o is QuerySigningInfoRequestAmino { + return o && (o.$typeUrl === QuerySigningInfoRequest.typeUrl || typeof o.cons_address === "string"); + }, encode(message: QuerySigningInfoRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.consAddress !== "") { writer.uint32(10).string(message.consAddress); @@ -512,7 +547,8 @@ export const QuerySigningInfoRequest = { typeUrl: "/cosmos.slashing.v1beta1.QuerySigningInfoRequest", value: QuerySigningInfoRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQuerySigningInfoResponse(): QuerySigningInfoResponse { return { @@ -529,6 +565,15 @@ function createBaseQuerySigningInfoResponse(): QuerySigningInfoResponse { export const QuerySigningInfoResponse = { typeUrl: "/cosmos.slashing.v1beta1.QuerySigningInfoResponse", aminoType: "cosmos-sdk/QuerySigningInfoResponse", + is(o: any): o is QuerySigningInfoResponse { + return o && (o.$typeUrl === QuerySigningInfoResponse.typeUrl || ValidatorSigningInfo.is(o.valSigningInfo)); + }, + isSDK(o: any): o is QuerySigningInfoResponseSDKType { + return o && (o.$typeUrl === QuerySigningInfoResponse.typeUrl || ValidatorSigningInfo.isSDK(o.val_signing_info)); + }, + isAmino(o: any): o is QuerySigningInfoResponseAmino { + return o && (o.$typeUrl === QuerySigningInfoResponse.typeUrl || ValidatorSigningInfo.isAmino(o.val_signing_info)); + }, encode(message: QuerySigningInfoResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.valSigningInfo !== undefined) { ValidatorSigningInfo.encode(message.valSigningInfo, writer.uint32(10).fork()).ldelim(); @@ -611,6 +656,12 @@ export const QuerySigningInfoResponse = { typeUrl: "/cosmos.slashing.v1beta1.QuerySigningInfoResponse", value: QuerySigningInfoResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QuerySigningInfoResponse.typeUrl)) { + return; + } + ValidatorSigningInfo.registerTypeUrl(); } }; function createBaseQuerySigningInfosRequest(): QuerySigningInfosRequest { @@ -628,6 +679,15 @@ function createBaseQuerySigningInfosRequest(): QuerySigningInfosRequest { export const QuerySigningInfosRequest = { typeUrl: "/cosmos.slashing.v1beta1.QuerySigningInfosRequest", aminoType: "cosmos-sdk/QuerySigningInfosRequest", + is(o: any): o is QuerySigningInfosRequest { + return o && o.$typeUrl === QuerySigningInfosRequest.typeUrl; + }, + isSDK(o: any): o is QuerySigningInfosRequestSDKType { + return o && o.$typeUrl === QuerySigningInfosRequest.typeUrl; + }, + isAmino(o: any): o is QuerySigningInfosRequestAmino { + return o && o.$typeUrl === QuerySigningInfosRequest.typeUrl; + }, encode(message: QuerySigningInfosRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.pagination !== undefined) { PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); @@ -710,6 +770,12 @@ export const QuerySigningInfosRequest = { typeUrl: "/cosmos.slashing.v1beta1.QuerySigningInfosRequest", value: QuerySigningInfosRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QuerySigningInfosRequest.typeUrl)) { + return; + } + PageRequest.registerTypeUrl(); } }; function createBaseQuerySigningInfosResponse(): QuerySigningInfosResponse { @@ -728,6 +794,15 @@ function createBaseQuerySigningInfosResponse(): QuerySigningInfosResponse { export const QuerySigningInfosResponse = { typeUrl: "/cosmos.slashing.v1beta1.QuerySigningInfosResponse", aminoType: "cosmos-sdk/QuerySigningInfosResponse", + is(o: any): o is QuerySigningInfosResponse { + return o && (o.$typeUrl === QuerySigningInfosResponse.typeUrl || Array.isArray(o.info) && (!o.info.length || ValidatorSigningInfo.is(o.info[0]))); + }, + isSDK(o: any): o is QuerySigningInfosResponseSDKType { + return o && (o.$typeUrl === QuerySigningInfosResponse.typeUrl || Array.isArray(o.info) && (!o.info.length || ValidatorSigningInfo.isSDK(o.info[0]))); + }, + isAmino(o: any): o is QuerySigningInfosResponseAmino { + return o && (o.$typeUrl === QuerySigningInfosResponse.typeUrl || Array.isArray(o.info) && (!o.info.length || ValidatorSigningInfo.isAmino(o.info[0]))); + }, encode(message: QuerySigningInfosResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.info) { ValidatorSigningInfo.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -835,5 +910,12 @@ export const QuerySigningInfosResponse = { typeUrl: "/cosmos.slashing.v1beta1.QuerySigningInfosResponse", value: QuerySigningInfosResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QuerySigningInfosResponse.typeUrl)) { + return; + } + ValidatorSigningInfo.registerTypeUrl(); + PageResponse.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/cosmos/slashing/v1beta1/slashing.ts b/__fixtures__/v-next/outputv2/cosmos/slashing/v1beta1/slashing.ts index 13167e66f1..6378e4c9b8 100644 --- a/__fixtures__/v-next/outputv2/cosmos/slashing/v1beta1/slashing.ts +++ b/__fixtures__/v-next/outputv2/cosmos/slashing/v1beta1/slashing.ts @@ -162,6 +162,15 @@ function createBaseValidatorSigningInfo(): ValidatorSigningInfo { export const ValidatorSigningInfo = { typeUrl: "/cosmos.slashing.v1beta1.ValidatorSigningInfo", aminoType: "cosmos-sdk/ValidatorSigningInfo", + is(o: any): o is ValidatorSigningInfo { + return o && (o.$typeUrl === ValidatorSigningInfo.typeUrl || typeof o.address === "string" && typeof o.startHeight === "bigint" && typeof o.indexOffset === "bigint" && Timestamp.is(o.jailedUntil) && typeof o.tombstoned === "boolean" && typeof o.missedBlocksCounter === "bigint"); + }, + isSDK(o: any): o is ValidatorSigningInfoSDKType { + return o && (o.$typeUrl === ValidatorSigningInfo.typeUrl || typeof o.address === "string" && typeof o.start_height === "bigint" && typeof o.index_offset === "bigint" && Timestamp.isSDK(o.jailed_until) && typeof o.tombstoned === "boolean" && typeof o.missed_blocks_counter === "bigint"); + }, + isAmino(o: any): o is ValidatorSigningInfoAmino { + return o && (o.$typeUrl === ValidatorSigningInfo.typeUrl || typeof o.address === "string" && typeof o.start_height === "bigint" && typeof o.index_offset === "bigint" && Timestamp.isAmino(o.jailed_until) && typeof o.tombstoned === "boolean" && typeof o.missed_blocks_counter === "bigint"); + }, encode(message: ValidatorSigningInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.address !== "") { writer.uint32(10).string(message.address); @@ -323,7 +332,8 @@ export const ValidatorSigningInfo = { typeUrl: "/cosmos.slashing.v1beta1.ValidatorSigningInfo", value: ValidatorSigningInfo.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseParams(): Params { return { @@ -343,6 +353,15 @@ function createBaseParams(): Params { export const Params = { typeUrl: "/cosmos.slashing.v1beta1.Params", aminoType: "cosmos-sdk/Params", + is(o: any): o is Params { + return o && (o.$typeUrl === Params.typeUrl || typeof o.signedBlocksWindow === "bigint" && (o.minSignedPerWindow instanceof Uint8Array || typeof o.minSignedPerWindow === "string") && Duration.is(o.downtimeJailDuration) && (o.slashFractionDoubleSign instanceof Uint8Array || typeof o.slashFractionDoubleSign === "string") && (o.slashFractionDowntime instanceof Uint8Array || typeof o.slashFractionDowntime === "string")); + }, + isSDK(o: any): o is ParamsSDKType { + return o && (o.$typeUrl === Params.typeUrl || typeof o.signed_blocks_window === "bigint" && (o.min_signed_per_window instanceof Uint8Array || typeof o.min_signed_per_window === "string") && Duration.isSDK(o.downtime_jail_duration) && (o.slash_fraction_double_sign instanceof Uint8Array || typeof o.slash_fraction_double_sign === "string") && (o.slash_fraction_downtime instanceof Uint8Array || typeof o.slash_fraction_downtime === "string")); + }, + isAmino(o: any): o is ParamsAmino { + return o && (o.$typeUrl === Params.typeUrl || typeof o.signed_blocks_window === "bigint" && (o.min_signed_per_window instanceof Uint8Array || typeof o.min_signed_per_window === "string") && Duration.isAmino(o.downtime_jail_duration) && (o.slash_fraction_double_sign instanceof Uint8Array || typeof o.slash_fraction_double_sign === "string") && (o.slash_fraction_downtime instanceof Uint8Array || typeof o.slash_fraction_downtime === "string")); + }, encode(message: Params, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.signedBlocksWindow !== BigInt(0)) { writer.uint32(8).int64(message.signedBlocksWindow); @@ -487,5 +506,6 @@ export const Params = { typeUrl: "/cosmos.slashing.v1beta1.Params", value: Params.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/cosmos/slashing/v1beta1/tx.registry.ts b/__fixtures__/v-next/outputv2/cosmos/slashing/v1beta1/tx.registry.ts index 9b87b671e3..789e3eaf6c 100644 --- a/__fixtures__/v-next/outputv2/cosmos/slashing/v1beta1/tx.registry.ts +++ b/__fixtures__/v-next/outputv2/cosmos/slashing/v1beta1/tx.registry.ts @@ -1,11 +1,6 @@ -import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { TelescopeGeneratedType } from "../../../types"; import { MsgUnjail } from "./tx"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/cosmos.slashing.v1beta1.MsgUnjail", MsgUnjail]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/cosmos.slashing.v1beta1.MsgUnjail", MsgUnjail]]; export const MessageComposer = { encoded: { unjail(value: MsgUnjail) { diff --git a/__fixtures__/v-next/outputv2/cosmos/slashing/v1beta1/tx.rpc.func.ts b/__fixtures__/v-next/outputv2/cosmos/slashing/v1beta1/tx.rpc.func.ts new file mode 100644 index 0000000000..96e1840613 --- /dev/null +++ b/__fixtures__/v-next/outputv2/cosmos/slashing/v1beta1/tx.rpc.func.ts @@ -0,0 +1,13 @@ +import { buildTx } from "../../../helper-func-types"; +import { MsgUnjail } from "./tx"; +/** + * Unjail defines a method for unjailing a jailed validator, thus returning + * them into the bonded validator set, so they can begin receiving provisions + * and rewards again. + * @name unjail + * @package cosmos.slashing.v1beta1 + * @see proto service: cosmos.slashing.v1beta1.Unjail + */ +export const unjail = buildTx({ + msg: MsgUnjail +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/cosmos/slashing/v1beta1/tx.ts b/__fixtures__/v-next/outputv2/cosmos/slashing/v1beta1/tx.ts index 125e76171e..4e86064c1a 100644 --- a/__fixtures__/v-next/outputv2/cosmos/slashing/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputv2/cosmos/slashing/v1beta1/tx.ts @@ -80,6 +80,15 @@ function createBaseMsgUnjail(): MsgUnjail { export const MsgUnjail = { typeUrl: "/cosmos.slashing.v1beta1.MsgUnjail", aminoType: "cosmos-sdk/MsgUnjail", + is(o: any): o is MsgUnjail { + return o && (o.$typeUrl === MsgUnjail.typeUrl || typeof o.validatorAddr === "string"); + }, + isSDK(o: any): o is MsgUnjailSDKType { + return o && (o.$typeUrl === MsgUnjail.typeUrl || typeof o.validator_addr === "string"); + }, + isAmino(o: any): o is MsgUnjailAmino { + return o && (o.$typeUrl === MsgUnjail.typeUrl || typeof o.validator_addr === "string"); + }, encode(message: MsgUnjail, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.validatorAddr !== "") { writer.uint32(10).string(message.validatorAddr); @@ -160,7 +169,8 @@ export const MsgUnjail = { typeUrl: "/cosmos.slashing.v1beta1.MsgUnjail", value: MsgUnjail.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgUnjailResponse(): MsgUnjailResponse { return {}; @@ -174,6 +184,15 @@ function createBaseMsgUnjailResponse(): MsgUnjailResponse { export const MsgUnjailResponse = { typeUrl: "/cosmos.slashing.v1beta1.MsgUnjailResponse", aminoType: "cosmos-sdk/MsgUnjailResponse", + is(o: any): o is MsgUnjailResponse { + return o && o.$typeUrl === MsgUnjailResponse.typeUrl; + }, + isSDK(o: any): o is MsgUnjailResponseSDKType { + return o && o.$typeUrl === MsgUnjailResponse.typeUrl; + }, + isAmino(o: any): o is MsgUnjailResponseAmino { + return o && o.$typeUrl === MsgUnjailResponse.typeUrl; + }, encode(_: MsgUnjailResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -238,5 +257,6 @@ export const MsgUnjailResponse = { typeUrl: "/cosmos.slashing.v1beta1.MsgUnjailResponse", value: MsgUnjailResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/cosmos/staking/v1beta1/authz.ts b/__fixtures__/v-next/outputv2/cosmos/staking/v1beta1/authz.ts index 29ccf766b4..2d20dacacd 100644 --- a/__fixtures__/v-next/outputv2/cosmos/staking/v1beta1/authz.ts +++ b/__fixtures__/v-next/outputv2/cosmos/staking/v1beta1/authz.ts @@ -1,6 +1,7 @@ import { Coin, CoinAmino, CoinSDKType } from "../../base/v1beta1/coin"; -import { BinaryReader, BinaryWriter } from "../../../binary"; import { isSet, DeepPartial } from "../../../helpers"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { GlobalDecoderRegistry } from "../../../registry"; import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "cosmos.staking.v1beta1"; /** @@ -191,6 +192,15 @@ function createBaseStakeAuthorization(): StakeAuthorization { export const StakeAuthorization = { typeUrl: "/cosmos.staking.v1beta1.StakeAuthorization", aminoType: "cosmos-sdk/StakeAuthorization", + is(o: any): o is StakeAuthorization { + return o && (o.$typeUrl === StakeAuthorization.typeUrl || isSet(o.authorizationType)); + }, + isSDK(o: any): o is StakeAuthorizationSDKType { + return o && (o.$typeUrl === StakeAuthorization.typeUrl || isSet(o.authorization_type)); + }, + isAmino(o: any): o is StakeAuthorizationAmino { + return o && (o.$typeUrl === StakeAuthorization.typeUrl || isSet(o.authorization_type)); + }, encode(message: StakeAuthorization, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.maxTokens !== undefined) { Coin.encode(message.maxTokens, writer.uint32(10).fork()).ldelim(); @@ -322,6 +332,15 @@ export const StakeAuthorization = { typeUrl: "/cosmos.staking.v1beta1.StakeAuthorization", value: StakeAuthorization.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(StakeAuthorization.typeUrl)) { + return; + } + GlobalDecoderRegistry.register(StakeAuthorization.typeUrl, StakeAuthorization); + GlobalDecoderRegistry.registerAminoProtoMapping(StakeAuthorization.aminoType, StakeAuthorization.typeUrl); + Coin.registerTypeUrl(); + StakeAuthorization_Validators.registerTypeUrl(); } }; function createBaseStakeAuthorization_Validators(): StakeAuthorization_Validators { @@ -338,6 +357,15 @@ function createBaseStakeAuthorization_Validators(): StakeAuthorization_Validator export const StakeAuthorization_Validators = { typeUrl: "/cosmos.staking.v1beta1.Validators", aminoType: "cosmos-sdk/Validators", + is(o: any): o is StakeAuthorization_Validators { + return o && (o.$typeUrl === StakeAuthorization_Validators.typeUrl || Array.isArray(o.address) && (!o.address.length || typeof o.address[0] === "string")); + }, + isSDK(o: any): o is StakeAuthorization_ValidatorsSDKType { + return o && (o.$typeUrl === StakeAuthorization_Validators.typeUrl || Array.isArray(o.address) && (!o.address.length || typeof o.address[0] === "string")); + }, + isAmino(o: any): o is StakeAuthorization_ValidatorsAmino { + return o && (o.$typeUrl === StakeAuthorization_Validators.typeUrl || Array.isArray(o.address) && (!o.address.length || typeof o.address[0] === "string")); + }, encode(message: StakeAuthorization_Validators, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.address) { writer.uint32(10).string(v!); @@ -428,5 +456,6 @@ export const StakeAuthorization_Validators = { typeUrl: "/cosmos.staking.v1beta1.Validators", value: StakeAuthorization_Validators.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/cosmos/staking/v1beta1/genesis.ts b/__fixtures__/v-next/outputv2/cosmos/staking/v1beta1/genesis.ts index f428883633..a7cd6f1225 100644 --- a/__fixtures__/v-next/outputv2/cosmos/staking/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv2/cosmos/staking/v1beta1/genesis.ts @@ -1,5 +1,6 @@ import { Params, ParamsAmino, ParamsSDKType, Validator, ValidatorAmino, ValidatorSDKType, Delegation, DelegationAmino, DelegationSDKType, UnbondingDelegation, UnbondingDelegationAmino, UnbondingDelegationSDKType, Redelegation, RedelegationAmino, RedelegationSDKType } from "./staking"; import { BinaryReader, BinaryWriter } from "../../../binary"; +import { GlobalDecoderRegistry } from "../../../registry"; import { isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "cosmos.staking.v1beta1"; @@ -176,6 +177,15 @@ function createBaseGenesisState(): GenesisState { export const GenesisState = { typeUrl: "/cosmos.staking.v1beta1.GenesisState", aminoType: "cosmos-sdk/GenesisState", + is(o: any): o is GenesisState { + return o && (o.$typeUrl === GenesisState.typeUrl || Params.is(o.params) && (o.lastTotalPower instanceof Uint8Array || typeof o.lastTotalPower === "string") && Array.isArray(o.lastValidatorPowers) && (!o.lastValidatorPowers.length || LastValidatorPower.is(o.lastValidatorPowers[0])) && Array.isArray(o.validators) && (!o.validators.length || Validator.is(o.validators[0])) && Array.isArray(o.delegations) && (!o.delegations.length || Delegation.is(o.delegations[0])) && Array.isArray(o.unbondingDelegations) && (!o.unbondingDelegations.length || UnbondingDelegation.is(o.unbondingDelegations[0])) && Array.isArray(o.redelegations) && (!o.redelegations.length || Redelegation.is(o.redelegations[0])) && typeof o.exported === "boolean"); + }, + isSDK(o: any): o is GenesisStateSDKType { + return o && (o.$typeUrl === GenesisState.typeUrl || Params.isSDK(o.params) && (o.last_total_power instanceof Uint8Array || typeof o.last_total_power === "string") && Array.isArray(o.last_validator_powers) && (!o.last_validator_powers.length || LastValidatorPower.isSDK(o.last_validator_powers[0])) && Array.isArray(o.validators) && (!o.validators.length || Validator.isSDK(o.validators[0])) && Array.isArray(o.delegations) && (!o.delegations.length || Delegation.isSDK(o.delegations[0])) && Array.isArray(o.unbonding_delegations) && (!o.unbonding_delegations.length || UnbondingDelegation.isSDK(o.unbonding_delegations[0])) && Array.isArray(o.redelegations) && (!o.redelegations.length || Redelegation.isSDK(o.redelegations[0])) && typeof o.exported === "boolean"); + }, + isAmino(o: any): o is GenesisStateAmino { + return o && (o.$typeUrl === GenesisState.typeUrl || Params.isAmino(o.params) && (o.last_total_power instanceof Uint8Array || typeof o.last_total_power === "string") && Array.isArray(o.last_validator_powers) && (!o.last_validator_powers.length || LastValidatorPower.isAmino(o.last_validator_powers[0])) && Array.isArray(o.validators) && (!o.validators.length || Validator.isAmino(o.validators[0])) && Array.isArray(o.delegations) && (!o.delegations.length || Delegation.isAmino(o.delegations[0])) && Array.isArray(o.unbonding_delegations) && (!o.unbonding_delegations.length || UnbondingDelegation.isAmino(o.unbonding_delegations[0])) && Array.isArray(o.redelegations) && (!o.redelegations.length || Redelegation.isAmino(o.redelegations[0])) && typeof o.exported === "boolean"); + }, encode(message: GenesisState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.params !== undefined) { Params.encode(message.params, writer.uint32(10).fork()).ldelim(); @@ -413,6 +423,17 @@ export const GenesisState = { typeUrl: "/cosmos.staking.v1beta1.GenesisState", value: GenesisState.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GenesisState.typeUrl)) { + return; + } + Params.registerTypeUrl(); + LastValidatorPower.registerTypeUrl(); + Validator.registerTypeUrl(); + Delegation.registerTypeUrl(); + UnbondingDelegation.registerTypeUrl(); + Redelegation.registerTypeUrl(); } }; function createBaseLastValidatorPower(): LastValidatorPower { @@ -430,6 +451,15 @@ function createBaseLastValidatorPower(): LastValidatorPower { export const LastValidatorPower = { typeUrl: "/cosmos.staking.v1beta1.LastValidatorPower", aminoType: "cosmos-sdk/LastValidatorPower", + is(o: any): o is LastValidatorPower { + return o && (o.$typeUrl === LastValidatorPower.typeUrl || typeof o.address === "string" && typeof o.power === "bigint"); + }, + isSDK(o: any): o is LastValidatorPowerSDKType { + return o && (o.$typeUrl === LastValidatorPower.typeUrl || typeof o.address === "string" && typeof o.power === "bigint"); + }, + isAmino(o: any): o is LastValidatorPowerAmino { + return o && (o.$typeUrl === LastValidatorPower.typeUrl || typeof o.address === "string" && typeof o.power === "bigint"); + }, encode(message: LastValidatorPower, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.address !== "") { writer.uint32(10).string(message.address); @@ -527,5 +557,6 @@ export const LastValidatorPower = { typeUrl: "/cosmos.staking.v1beta1.LastValidatorPower", value: LastValidatorPower.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/cosmos/staking/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputv2/cosmos/staking/v1beta1/query.rpc.func.ts new file mode 100644 index 0000000000..3511729f70 --- /dev/null +++ b/__fixtures__/v-next/outputv2/cosmos/staking/v1beta1/query.rpc.func.ts @@ -0,0 +1,188 @@ +import { buildQuery } from "../../../helper-func-types"; +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"; +/** + * Validators queries all validators that match the given status. + * @name getValidators + * @package cosmos.staking.v1beta1 + * @see proto service: cosmos.staking.v1beta1.Validators + */ +export const getValidators = buildQuery({ + encode: QueryValidatorsRequest.encode, + decode: QueryValidatorsResponse.decode, + service: "cosmos.staking.v1beta1.Query", + method: "Validators", + deps: [QueryValidatorsRequest, QueryValidatorsResponse] +}); +/** + * Validator queries validator info for given validator address. + * @name getValidator + * @package cosmos.staking.v1beta1 + * @see proto service: cosmos.staking.v1beta1.Validator + */ +export const getValidator = buildQuery({ + encode: QueryValidatorRequest.encode, + decode: QueryValidatorResponse.decode, + service: "cosmos.staking.v1beta1.Query", + method: "Validator", + deps: [QueryValidatorRequest, QueryValidatorResponse] +}); +/** + * ValidatorDelegations queries delegate info for given validator. + * @name getValidatorDelegations + * @package cosmos.staking.v1beta1 + * @see proto service: cosmos.staking.v1beta1.ValidatorDelegations + */ +export const getValidatorDelegations = buildQuery({ + encode: QueryValidatorDelegationsRequest.encode, + decode: QueryValidatorDelegationsResponse.decode, + service: "cosmos.staking.v1beta1.Query", + method: "ValidatorDelegations", + deps: [QueryValidatorDelegationsRequest, QueryValidatorDelegationsResponse] +}); +/** + * ValidatorUnbondingDelegations queries unbonding delegations of a validator. + * @name getValidatorUnbondingDelegations + * @package cosmos.staking.v1beta1 + * @see proto service: cosmos.staking.v1beta1.ValidatorUnbondingDelegations + */ +export const getValidatorUnbondingDelegations = buildQuery({ + encode: QueryValidatorUnbondingDelegationsRequest.encode, + decode: QueryValidatorUnbondingDelegationsResponse.decode, + service: "cosmos.staking.v1beta1.Query", + method: "ValidatorUnbondingDelegations", + deps: [QueryValidatorUnbondingDelegationsRequest, QueryValidatorUnbondingDelegationsResponse] +}); +/** + * Delegation queries delegate info for given validator delegator pair. + * @name getDelegation + * @package cosmos.staking.v1beta1 + * @see proto service: cosmos.staking.v1beta1.Delegation + */ +export const getDelegation = buildQuery({ + encode: QueryDelegationRequest.encode, + decode: QueryDelegationResponse.decode, + service: "cosmos.staking.v1beta1.Query", + method: "Delegation", + deps: [QueryDelegationRequest, QueryDelegationResponse] +}); +/** + * UnbondingDelegation queries unbonding info for given validator delegator + * pair. + * @name getUnbondingDelegation + * @package cosmos.staking.v1beta1 + * @see proto service: cosmos.staking.v1beta1.UnbondingDelegation + */ +export const getUnbondingDelegation = buildQuery({ + encode: QueryUnbondingDelegationRequest.encode, + decode: QueryUnbondingDelegationResponse.decode, + service: "cosmos.staking.v1beta1.Query", + method: "UnbondingDelegation", + deps: [QueryUnbondingDelegationRequest, QueryUnbondingDelegationResponse] +}); +/** + * DelegatorDelegations queries all delegations of a given delegator address. + * @name getDelegatorDelegations + * @package cosmos.staking.v1beta1 + * @see proto service: cosmos.staking.v1beta1.DelegatorDelegations + */ +export const getDelegatorDelegations = buildQuery({ + encode: QueryDelegatorDelegationsRequest.encode, + decode: QueryDelegatorDelegationsResponse.decode, + service: "cosmos.staking.v1beta1.Query", + method: "DelegatorDelegations", + deps: [QueryDelegatorDelegationsRequest, QueryDelegatorDelegationsResponse] +}); +/** + * DelegatorUnbondingDelegations queries all unbonding delegations of a given + * delegator address. + * @name getDelegatorUnbondingDelegations + * @package cosmos.staking.v1beta1 + * @see proto service: cosmos.staking.v1beta1.DelegatorUnbondingDelegations + */ +export const getDelegatorUnbondingDelegations = buildQuery({ + encode: QueryDelegatorUnbondingDelegationsRequest.encode, + decode: QueryDelegatorUnbondingDelegationsResponse.decode, + service: "cosmos.staking.v1beta1.Query", + method: "DelegatorUnbondingDelegations", + deps: [QueryDelegatorUnbondingDelegationsRequest, QueryDelegatorUnbondingDelegationsResponse] +}); +/** + * Redelegations queries redelegations of given address. + * @name getRedelegations + * @package cosmos.staking.v1beta1 + * @see proto service: cosmos.staking.v1beta1.Redelegations + */ +export const getRedelegations = buildQuery({ + encode: QueryRedelegationsRequest.encode, + decode: QueryRedelegationsResponse.decode, + service: "cosmos.staking.v1beta1.Query", + method: "Redelegations", + deps: [QueryRedelegationsRequest, QueryRedelegationsResponse] +}); +/** + * DelegatorValidators queries all validators info for given delegator + * address. + * @name getDelegatorValidators + * @package cosmos.staking.v1beta1 + * @see proto service: cosmos.staking.v1beta1.DelegatorValidators + */ +export const getDelegatorValidators = buildQuery({ + encode: QueryDelegatorValidatorsRequest.encode, + decode: QueryDelegatorValidatorsResponse.decode, + service: "cosmos.staking.v1beta1.Query", + method: "DelegatorValidators", + deps: [QueryDelegatorValidatorsRequest, QueryDelegatorValidatorsResponse] +}); +/** + * DelegatorValidator queries validator info for given delegator validator + * pair. + * @name getDelegatorValidator + * @package cosmos.staking.v1beta1 + * @see proto service: cosmos.staking.v1beta1.DelegatorValidator + */ +export const getDelegatorValidator = buildQuery({ + encode: QueryDelegatorValidatorRequest.encode, + decode: QueryDelegatorValidatorResponse.decode, + service: "cosmos.staking.v1beta1.Query", + method: "DelegatorValidator", + deps: [QueryDelegatorValidatorRequest, QueryDelegatorValidatorResponse] +}); +/** + * HistoricalInfo queries the historical info for given height. + * @name getHistoricalInfo + * @package cosmos.staking.v1beta1 + * @see proto service: cosmos.staking.v1beta1.HistoricalInfo + */ +export const getHistoricalInfo = buildQuery({ + encode: QueryHistoricalInfoRequest.encode, + decode: QueryHistoricalInfoResponse.decode, + service: "cosmos.staking.v1beta1.Query", + method: "HistoricalInfo", + deps: [QueryHistoricalInfoRequest, QueryHistoricalInfoResponse] +}); +/** + * Pool queries the pool info. + * @name getPool + * @package cosmos.staking.v1beta1 + * @see proto service: cosmos.staking.v1beta1.Pool + */ +export const getPool = buildQuery({ + encode: QueryPoolRequest.encode, + decode: QueryPoolResponse.decode, + service: "cosmos.staking.v1beta1.Query", + method: "Pool", + deps: [QueryPoolRequest, QueryPoolResponse] +}); +/** + * Parameters queries the staking parameters. + * @name getParams + * @package cosmos.staking.v1beta1 + * @see proto service: cosmos.staking.v1beta1.Params + */ +export const getParams = buildQuery({ + encode: QueryParamsRequest.encode, + decode: QueryParamsResponse.decode, + service: "cosmos.staking.v1beta1.Query", + method: "Params", + deps: [QueryParamsRequest, QueryParamsResponse] +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/cosmos/staking/v1beta1/query.ts b/__fixtures__/v-next/outputv2/cosmos/staking/v1beta1/query.ts index 44fbabe76e..36f8e69521 100644 --- a/__fixtures__/v-next/outputv2/cosmos/staking/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv2/cosmos/staking/v1beta1/query.ts @@ -1,6 +1,7 @@ import { PageRequest, PageRequestAmino, PageRequestSDKType, PageResponse, PageResponseAmino, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; import { Validator, ValidatorAmino, ValidatorSDKType, DelegationResponse, DelegationResponseAmino, DelegationResponseSDKType, UnbondingDelegation, UnbondingDelegationAmino, UnbondingDelegationSDKType, RedelegationResponse, RedelegationResponseAmino, RedelegationResponseSDKType, HistoricalInfo, HistoricalInfoAmino, HistoricalInfoSDKType, Pool, PoolAmino, PoolSDKType, Params, ParamsAmino, ParamsSDKType } from "./staking"; import { BinaryReader, BinaryWriter } from "../../../binary"; +import { GlobalDecoderRegistry } from "../../../registry"; import { isSet, DeepPartial } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "cosmos.staking.v1beta1"; @@ -1344,6 +1345,15 @@ function createBaseQueryValidatorsRequest(): QueryValidatorsRequest { export const QueryValidatorsRequest = { typeUrl: "/cosmos.staking.v1beta1.QueryValidatorsRequest", aminoType: "cosmos-sdk/QueryValidatorsRequest", + is(o: any): o is QueryValidatorsRequest { + return o && (o.$typeUrl === QueryValidatorsRequest.typeUrl || typeof o.status === "string"); + }, + isSDK(o: any): o is QueryValidatorsRequestSDKType { + return o && (o.$typeUrl === QueryValidatorsRequest.typeUrl || typeof o.status === "string"); + }, + isAmino(o: any): o is QueryValidatorsRequestAmino { + return o && (o.$typeUrl === QueryValidatorsRequest.typeUrl || typeof o.status === "string"); + }, encode(message: QueryValidatorsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.status !== "") { writer.uint32(10).string(message.status); @@ -1441,6 +1451,12 @@ export const QueryValidatorsRequest = { typeUrl: "/cosmos.staking.v1beta1.QueryValidatorsRequest", value: QueryValidatorsRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryValidatorsRequest.typeUrl)) { + return; + } + PageRequest.registerTypeUrl(); } }; function createBaseQueryValidatorsResponse(): QueryValidatorsResponse { @@ -1458,6 +1474,15 @@ function createBaseQueryValidatorsResponse(): QueryValidatorsResponse { export const QueryValidatorsResponse = { typeUrl: "/cosmos.staking.v1beta1.QueryValidatorsResponse", aminoType: "cosmos-sdk/QueryValidatorsResponse", + is(o: any): o is QueryValidatorsResponse { + return o && (o.$typeUrl === QueryValidatorsResponse.typeUrl || Array.isArray(o.validators) && (!o.validators.length || Validator.is(o.validators[0]))); + }, + isSDK(o: any): o is QueryValidatorsResponseSDKType { + return o && (o.$typeUrl === QueryValidatorsResponse.typeUrl || Array.isArray(o.validators) && (!o.validators.length || Validator.isSDK(o.validators[0]))); + }, + isAmino(o: any): o is QueryValidatorsResponseAmino { + return o && (o.$typeUrl === QueryValidatorsResponse.typeUrl || Array.isArray(o.validators) && (!o.validators.length || Validator.isAmino(o.validators[0]))); + }, encode(message: QueryValidatorsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.validators) { Validator.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -1565,6 +1590,13 @@ export const QueryValidatorsResponse = { typeUrl: "/cosmos.staking.v1beta1.QueryValidatorsResponse", value: QueryValidatorsResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryValidatorsResponse.typeUrl)) { + return; + } + Validator.registerTypeUrl(); + PageResponse.registerTypeUrl(); } }; function createBaseQueryValidatorRequest(): QueryValidatorRequest { @@ -1581,6 +1613,15 @@ function createBaseQueryValidatorRequest(): QueryValidatorRequest { export const QueryValidatorRequest = { typeUrl: "/cosmos.staking.v1beta1.QueryValidatorRequest", aminoType: "cosmos-sdk/QueryValidatorRequest", + is(o: any): o is QueryValidatorRequest { + return o && (o.$typeUrl === QueryValidatorRequest.typeUrl || typeof o.validatorAddr === "string"); + }, + isSDK(o: any): o is QueryValidatorRequestSDKType { + return o && (o.$typeUrl === QueryValidatorRequest.typeUrl || typeof o.validator_addr === "string"); + }, + isAmino(o: any): o is QueryValidatorRequestAmino { + return o && (o.$typeUrl === QueryValidatorRequest.typeUrl || typeof o.validator_addr === "string"); + }, encode(message: QueryValidatorRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.validatorAddr !== "") { writer.uint32(10).string(message.validatorAddr); @@ -1661,7 +1702,8 @@ export const QueryValidatorRequest = { typeUrl: "/cosmos.staking.v1beta1.QueryValidatorRequest", value: QueryValidatorRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryValidatorResponse(): QueryValidatorResponse { return { @@ -1677,6 +1719,15 @@ function createBaseQueryValidatorResponse(): QueryValidatorResponse { export const QueryValidatorResponse = { typeUrl: "/cosmos.staking.v1beta1.QueryValidatorResponse", aminoType: "cosmos-sdk/QueryValidatorResponse", + is(o: any): o is QueryValidatorResponse { + return o && (o.$typeUrl === QueryValidatorResponse.typeUrl || Validator.is(o.validator)); + }, + isSDK(o: any): o is QueryValidatorResponseSDKType { + return o && (o.$typeUrl === QueryValidatorResponse.typeUrl || Validator.isSDK(o.validator)); + }, + isAmino(o: any): o is QueryValidatorResponseAmino { + return o && (o.$typeUrl === QueryValidatorResponse.typeUrl || Validator.isAmino(o.validator)); + }, encode(message: QueryValidatorResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.validator !== undefined) { Validator.encode(message.validator, writer.uint32(10).fork()).ldelim(); @@ -1759,6 +1810,12 @@ export const QueryValidatorResponse = { typeUrl: "/cosmos.staking.v1beta1.QueryValidatorResponse", value: QueryValidatorResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryValidatorResponse.typeUrl)) { + return; + } + Validator.registerTypeUrl(); } }; function createBaseQueryValidatorDelegationsRequest(): QueryValidatorDelegationsRequest { @@ -1777,6 +1834,15 @@ function createBaseQueryValidatorDelegationsRequest(): QueryValidatorDelegations export const QueryValidatorDelegationsRequest = { typeUrl: "/cosmos.staking.v1beta1.QueryValidatorDelegationsRequest", aminoType: "cosmos-sdk/QueryValidatorDelegationsRequest", + is(o: any): o is QueryValidatorDelegationsRequest { + return o && (o.$typeUrl === QueryValidatorDelegationsRequest.typeUrl || typeof o.validatorAddr === "string"); + }, + isSDK(o: any): o is QueryValidatorDelegationsRequestSDKType { + return o && (o.$typeUrl === QueryValidatorDelegationsRequest.typeUrl || typeof o.validator_addr === "string"); + }, + isAmino(o: any): o is QueryValidatorDelegationsRequestAmino { + return o && (o.$typeUrl === QueryValidatorDelegationsRequest.typeUrl || typeof o.validator_addr === "string"); + }, encode(message: QueryValidatorDelegationsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.validatorAddr !== "") { writer.uint32(10).string(message.validatorAddr); @@ -1874,6 +1940,12 @@ export const QueryValidatorDelegationsRequest = { typeUrl: "/cosmos.staking.v1beta1.QueryValidatorDelegationsRequest", value: QueryValidatorDelegationsRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryValidatorDelegationsRequest.typeUrl)) { + return; + } + PageRequest.registerTypeUrl(); } }; function createBaseQueryValidatorDelegationsResponse(): QueryValidatorDelegationsResponse { @@ -1892,6 +1964,15 @@ function createBaseQueryValidatorDelegationsResponse(): QueryValidatorDelegation export const QueryValidatorDelegationsResponse = { typeUrl: "/cosmos.staking.v1beta1.QueryValidatorDelegationsResponse", aminoType: "cosmos-sdk/QueryValidatorDelegationsResponse", + is(o: any): o is QueryValidatorDelegationsResponse { + return o && (o.$typeUrl === QueryValidatorDelegationsResponse.typeUrl || Array.isArray(o.delegationResponses) && (!o.delegationResponses.length || DelegationResponse.is(o.delegationResponses[0]))); + }, + isSDK(o: any): o is QueryValidatorDelegationsResponseSDKType { + return o && (o.$typeUrl === QueryValidatorDelegationsResponse.typeUrl || Array.isArray(o.delegation_responses) && (!o.delegation_responses.length || DelegationResponse.isSDK(o.delegation_responses[0]))); + }, + isAmino(o: any): o is QueryValidatorDelegationsResponseAmino { + return o && (o.$typeUrl === QueryValidatorDelegationsResponse.typeUrl || Array.isArray(o.delegation_responses) && (!o.delegation_responses.length || DelegationResponse.isAmino(o.delegation_responses[0]))); + }, encode(message: QueryValidatorDelegationsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.delegationResponses) { DelegationResponse.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -1999,6 +2080,13 @@ export const QueryValidatorDelegationsResponse = { typeUrl: "/cosmos.staking.v1beta1.QueryValidatorDelegationsResponse", value: QueryValidatorDelegationsResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryValidatorDelegationsResponse.typeUrl)) { + return; + } + DelegationResponse.registerTypeUrl(); + PageResponse.registerTypeUrl(); } }; function createBaseQueryValidatorUnbondingDelegationsRequest(): QueryValidatorUnbondingDelegationsRequest { @@ -2017,6 +2105,15 @@ function createBaseQueryValidatorUnbondingDelegationsRequest(): QueryValidatorUn export const QueryValidatorUnbondingDelegationsRequest = { typeUrl: "/cosmos.staking.v1beta1.QueryValidatorUnbondingDelegationsRequest", aminoType: "cosmos-sdk/QueryValidatorUnbondingDelegationsRequest", + is(o: any): o is QueryValidatorUnbondingDelegationsRequest { + return o && (o.$typeUrl === QueryValidatorUnbondingDelegationsRequest.typeUrl || typeof o.validatorAddr === "string"); + }, + isSDK(o: any): o is QueryValidatorUnbondingDelegationsRequestSDKType { + return o && (o.$typeUrl === QueryValidatorUnbondingDelegationsRequest.typeUrl || typeof o.validator_addr === "string"); + }, + isAmino(o: any): o is QueryValidatorUnbondingDelegationsRequestAmino { + return o && (o.$typeUrl === QueryValidatorUnbondingDelegationsRequest.typeUrl || typeof o.validator_addr === "string"); + }, encode(message: QueryValidatorUnbondingDelegationsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.validatorAddr !== "") { writer.uint32(10).string(message.validatorAddr); @@ -2114,6 +2211,12 @@ export const QueryValidatorUnbondingDelegationsRequest = { typeUrl: "/cosmos.staking.v1beta1.QueryValidatorUnbondingDelegationsRequest", value: QueryValidatorUnbondingDelegationsRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryValidatorUnbondingDelegationsRequest.typeUrl)) { + return; + } + PageRequest.registerTypeUrl(); } }; function createBaseQueryValidatorUnbondingDelegationsResponse(): QueryValidatorUnbondingDelegationsResponse { @@ -2132,6 +2235,15 @@ function createBaseQueryValidatorUnbondingDelegationsResponse(): QueryValidatorU export const QueryValidatorUnbondingDelegationsResponse = { typeUrl: "/cosmos.staking.v1beta1.QueryValidatorUnbondingDelegationsResponse", aminoType: "cosmos-sdk/QueryValidatorUnbondingDelegationsResponse", + is(o: any): o is QueryValidatorUnbondingDelegationsResponse { + return o && (o.$typeUrl === QueryValidatorUnbondingDelegationsResponse.typeUrl || Array.isArray(o.unbondingResponses) && (!o.unbondingResponses.length || UnbondingDelegation.is(o.unbondingResponses[0]))); + }, + isSDK(o: any): o is QueryValidatorUnbondingDelegationsResponseSDKType { + return o && (o.$typeUrl === QueryValidatorUnbondingDelegationsResponse.typeUrl || Array.isArray(o.unbonding_responses) && (!o.unbonding_responses.length || UnbondingDelegation.isSDK(o.unbonding_responses[0]))); + }, + isAmino(o: any): o is QueryValidatorUnbondingDelegationsResponseAmino { + return o && (o.$typeUrl === QueryValidatorUnbondingDelegationsResponse.typeUrl || Array.isArray(o.unbonding_responses) && (!o.unbonding_responses.length || UnbondingDelegation.isAmino(o.unbonding_responses[0]))); + }, encode(message: QueryValidatorUnbondingDelegationsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.unbondingResponses) { UnbondingDelegation.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -2239,6 +2351,13 @@ export const QueryValidatorUnbondingDelegationsResponse = { typeUrl: "/cosmos.staking.v1beta1.QueryValidatorUnbondingDelegationsResponse", value: QueryValidatorUnbondingDelegationsResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryValidatorUnbondingDelegationsResponse.typeUrl)) { + return; + } + UnbondingDelegation.registerTypeUrl(); + PageResponse.registerTypeUrl(); } }; function createBaseQueryDelegationRequest(): QueryDelegationRequest { @@ -2256,6 +2375,15 @@ function createBaseQueryDelegationRequest(): QueryDelegationRequest { export const QueryDelegationRequest = { typeUrl: "/cosmos.staking.v1beta1.QueryDelegationRequest", aminoType: "cosmos-sdk/QueryDelegationRequest", + is(o: any): o is QueryDelegationRequest { + return o && (o.$typeUrl === QueryDelegationRequest.typeUrl || typeof o.delegatorAddr === "string" && typeof o.validatorAddr === "string"); + }, + isSDK(o: any): o is QueryDelegationRequestSDKType { + return o && (o.$typeUrl === QueryDelegationRequest.typeUrl || typeof o.delegator_addr === "string" && typeof o.validator_addr === "string"); + }, + isAmino(o: any): o is QueryDelegationRequestAmino { + return o && (o.$typeUrl === QueryDelegationRequest.typeUrl || typeof o.delegator_addr === "string" && typeof o.validator_addr === "string"); + }, encode(message: QueryDelegationRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.delegatorAddr !== "") { writer.uint32(10).string(message.delegatorAddr); @@ -2351,7 +2479,8 @@ export const QueryDelegationRequest = { typeUrl: "/cosmos.staking.v1beta1.QueryDelegationRequest", value: QueryDelegationRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryDelegationResponse(): QueryDelegationResponse { return { @@ -2367,6 +2496,15 @@ function createBaseQueryDelegationResponse(): QueryDelegationResponse { export const QueryDelegationResponse = { typeUrl: "/cosmos.staking.v1beta1.QueryDelegationResponse", aminoType: "cosmos-sdk/QueryDelegationResponse", + is(o: any): o is QueryDelegationResponse { + return o && o.$typeUrl === QueryDelegationResponse.typeUrl; + }, + isSDK(o: any): o is QueryDelegationResponseSDKType { + return o && o.$typeUrl === QueryDelegationResponse.typeUrl; + }, + isAmino(o: any): o is QueryDelegationResponseAmino { + return o && o.$typeUrl === QueryDelegationResponse.typeUrl; + }, encode(message: QueryDelegationResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.delegationResponse !== undefined) { DelegationResponse.encode(message.delegationResponse, writer.uint32(10).fork()).ldelim(); @@ -2449,6 +2587,12 @@ export const QueryDelegationResponse = { typeUrl: "/cosmos.staking.v1beta1.QueryDelegationResponse", value: QueryDelegationResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryDelegationResponse.typeUrl)) { + return; + } + DelegationResponse.registerTypeUrl(); } }; function createBaseQueryUnbondingDelegationRequest(): QueryUnbondingDelegationRequest { @@ -2467,6 +2611,15 @@ function createBaseQueryUnbondingDelegationRequest(): QueryUnbondingDelegationRe export const QueryUnbondingDelegationRequest = { typeUrl: "/cosmos.staking.v1beta1.QueryUnbondingDelegationRequest", aminoType: "cosmos-sdk/QueryUnbondingDelegationRequest", + is(o: any): o is QueryUnbondingDelegationRequest { + return o && (o.$typeUrl === QueryUnbondingDelegationRequest.typeUrl || typeof o.delegatorAddr === "string" && typeof o.validatorAddr === "string"); + }, + isSDK(o: any): o is QueryUnbondingDelegationRequestSDKType { + return o && (o.$typeUrl === QueryUnbondingDelegationRequest.typeUrl || typeof o.delegator_addr === "string" && typeof o.validator_addr === "string"); + }, + isAmino(o: any): o is QueryUnbondingDelegationRequestAmino { + return o && (o.$typeUrl === QueryUnbondingDelegationRequest.typeUrl || typeof o.delegator_addr === "string" && typeof o.validator_addr === "string"); + }, encode(message: QueryUnbondingDelegationRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.delegatorAddr !== "") { writer.uint32(10).string(message.delegatorAddr); @@ -2562,7 +2715,8 @@ export const QueryUnbondingDelegationRequest = { typeUrl: "/cosmos.staking.v1beta1.QueryUnbondingDelegationRequest", value: QueryUnbondingDelegationRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryUnbondingDelegationResponse(): QueryUnbondingDelegationResponse { return { @@ -2579,6 +2733,15 @@ function createBaseQueryUnbondingDelegationResponse(): QueryUnbondingDelegationR export const QueryUnbondingDelegationResponse = { typeUrl: "/cosmos.staking.v1beta1.QueryUnbondingDelegationResponse", aminoType: "cosmos-sdk/QueryUnbondingDelegationResponse", + is(o: any): o is QueryUnbondingDelegationResponse { + return o && (o.$typeUrl === QueryUnbondingDelegationResponse.typeUrl || UnbondingDelegation.is(o.unbond)); + }, + isSDK(o: any): o is QueryUnbondingDelegationResponseSDKType { + return o && (o.$typeUrl === QueryUnbondingDelegationResponse.typeUrl || UnbondingDelegation.isSDK(o.unbond)); + }, + isAmino(o: any): o is QueryUnbondingDelegationResponseAmino { + return o && (o.$typeUrl === QueryUnbondingDelegationResponse.typeUrl || UnbondingDelegation.isAmino(o.unbond)); + }, encode(message: QueryUnbondingDelegationResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.unbond !== undefined) { UnbondingDelegation.encode(message.unbond, writer.uint32(10).fork()).ldelim(); @@ -2661,6 +2824,12 @@ export const QueryUnbondingDelegationResponse = { typeUrl: "/cosmos.staking.v1beta1.QueryUnbondingDelegationResponse", value: QueryUnbondingDelegationResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryUnbondingDelegationResponse.typeUrl)) { + return; + } + UnbondingDelegation.registerTypeUrl(); } }; function createBaseQueryDelegatorDelegationsRequest(): QueryDelegatorDelegationsRequest { @@ -2679,6 +2848,15 @@ function createBaseQueryDelegatorDelegationsRequest(): QueryDelegatorDelegations export const QueryDelegatorDelegationsRequest = { typeUrl: "/cosmos.staking.v1beta1.QueryDelegatorDelegationsRequest", aminoType: "cosmos-sdk/QueryDelegatorDelegationsRequest", + is(o: any): o is QueryDelegatorDelegationsRequest { + return o && (o.$typeUrl === QueryDelegatorDelegationsRequest.typeUrl || typeof o.delegatorAddr === "string"); + }, + isSDK(o: any): o is QueryDelegatorDelegationsRequestSDKType { + return o && (o.$typeUrl === QueryDelegatorDelegationsRequest.typeUrl || typeof o.delegator_addr === "string"); + }, + isAmino(o: any): o is QueryDelegatorDelegationsRequestAmino { + return o && (o.$typeUrl === QueryDelegatorDelegationsRequest.typeUrl || typeof o.delegator_addr === "string"); + }, encode(message: QueryDelegatorDelegationsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.delegatorAddr !== "") { writer.uint32(10).string(message.delegatorAddr); @@ -2776,6 +2954,12 @@ export const QueryDelegatorDelegationsRequest = { typeUrl: "/cosmos.staking.v1beta1.QueryDelegatorDelegationsRequest", value: QueryDelegatorDelegationsRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryDelegatorDelegationsRequest.typeUrl)) { + return; + } + PageRequest.registerTypeUrl(); } }; function createBaseQueryDelegatorDelegationsResponse(): QueryDelegatorDelegationsResponse { @@ -2794,6 +2978,15 @@ function createBaseQueryDelegatorDelegationsResponse(): QueryDelegatorDelegation export const QueryDelegatorDelegationsResponse = { typeUrl: "/cosmos.staking.v1beta1.QueryDelegatorDelegationsResponse", aminoType: "cosmos-sdk/QueryDelegatorDelegationsResponse", + is(o: any): o is QueryDelegatorDelegationsResponse { + return o && (o.$typeUrl === QueryDelegatorDelegationsResponse.typeUrl || Array.isArray(o.delegationResponses) && (!o.delegationResponses.length || DelegationResponse.is(o.delegationResponses[0]))); + }, + isSDK(o: any): o is QueryDelegatorDelegationsResponseSDKType { + return o && (o.$typeUrl === QueryDelegatorDelegationsResponse.typeUrl || Array.isArray(o.delegation_responses) && (!o.delegation_responses.length || DelegationResponse.isSDK(o.delegation_responses[0]))); + }, + isAmino(o: any): o is QueryDelegatorDelegationsResponseAmino { + return o && (o.$typeUrl === QueryDelegatorDelegationsResponse.typeUrl || Array.isArray(o.delegation_responses) && (!o.delegation_responses.length || DelegationResponse.isAmino(o.delegation_responses[0]))); + }, encode(message: QueryDelegatorDelegationsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.delegationResponses) { DelegationResponse.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -2901,6 +3094,13 @@ export const QueryDelegatorDelegationsResponse = { typeUrl: "/cosmos.staking.v1beta1.QueryDelegatorDelegationsResponse", value: QueryDelegatorDelegationsResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryDelegatorDelegationsResponse.typeUrl)) { + return; + } + DelegationResponse.registerTypeUrl(); + PageResponse.registerTypeUrl(); } }; function createBaseQueryDelegatorUnbondingDelegationsRequest(): QueryDelegatorUnbondingDelegationsRequest { @@ -2919,6 +3119,15 @@ function createBaseQueryDelegatorUnbondingDelegationsRequest(): QueryDelegatorUn export const QueryDelegatorUnbondingDelegationsRequest = { typeUrl: "/cosmos.staking.v1beta1.QueryDelegatorUnbondingDelegationsRequest", aminoType: "cosmos-sdk/QueryDelegatorUnbondingDelegationsRequest", + is(o: any): o is QueryDelegatorUnbondingDelegationsRequest { + return o && (o.$typeUrl === QueryDelegatorUnbondingDelegationsRequest.typeUrl || typeof o.delegatorAddr === "string"); + }, + isSDK(o: any): o is QueryDelegatorUnbondingDelegationsRequestSDKType { + return o && (o.$typeUrl === QueryDelegatorUnbondingDelegationsRequest.typeUrl || typeof o.delegator_addr === "string"); + }, + isAmino(o: any): o is QueryDelegatorUnbondingDelegationsRequestAmino { + return o && (o.$typeUrl === QueryDelegatorUnbondingDelegationsRequest.typeUrl || typeof o.delegator_addr === "string"); + }, encode(message: QueryDelegatorUnbondingDelegationsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.delegatorAddr !== "") { writer.uint32(10).string(message.delegatorAddr); @@ -3016,6 +3225,12 @@ export const QueryDelegatorUnbondingDelegationsRequest = { typeUrl: "/cosmos.staking.v1beta1.QueryDelegatorUnbondingDelegationsRequest", value: QueryDelegatorUnbondingDelegationsRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryDelegatorUnbondingDelegationsRequest.typeUrl)) { + return; + } + PageRequest.registerTypeUrl(); } }; function createBaseQueryDelegatorUnbondingDelegationsResponse(): QueryDelegatorUnbondingDelegationsResponse { @@ -3034,6 +3249,15 @@ function createBaseQueryDelegatorUnbondingDelegationsResponse(): QueryDelegatorU export const QueryDelegatorUnbondingDelegationsResponse = { typeUrl: "/cosmos.staking.v1beta1.QueryDelegatorUnbondingDelegationsResponse", aminoType: "cosmos-sdk/QueryDelegatorUnbondingDelegationsResponse", + is(o: any): o is QueryDelegatorUnbondingDelegationsResponse { + return o && (o.$typeUrl === QueryDelegatorUnbondingDelegationsResponse.typeUrl || Array.isArray(o.unbondingResponses) && (!o.unbondingResponses.length || UnbondingDelegation.is(o.unbondingResponses[0]))); + }, + isSDK(o: any): o is QueryDelegatorUnbondingDelegationsResponseSDKType { + return o && (o.$typeUrl === QueryDelegatorUnbondingDelegationsResponse.typeUrl || Array.isArray(o.unbonding_responses) && (!o.unbonding_responses.length || UnbondingDelegation.isSDK(o.unbonding_responses[0]))); + }, + isAmino(o: any): o is QueryDelegatorUnbondingDelegationsResponseAmino { + return o && (o.$typeUrl === QueryDelegatorUnbondingDelegationsResponse.typeUrl || Array.isArray(o.unbonding_responses) && (!o.unbonding_responses.length || UnbondingDelegation.isAmino(o.unbonding_responses[0]))); + }, encode(message: QueryDelegatorUnbondingDelegationsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.unbondingResponses) { UnbondingDelegation.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -3141,6 +3365,13 @@ export const QueryDelegatorUnbondingDelegationsResponse = { typeUrl: "/cosmos.staking.v1beta1.QueryDelegatorUnbondingDelegationsResponse", value: QueryDelegatorUnbondingDelegationsResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryDelegatorUnbondingDelegationsResponse.typeUrl)) { + return; + } + UnbondingDelegation.registerTypeUrl(); + PageResponse.registerTypeUrl(); } }; function createBaseQueryRedelegationsRequest(): QueryRedelegationsRequest { @@ -3161,6 +3392,15 @@ function createBaseQueryRedelegationsRequest(): QueryRedelegationsRequest { export const QueryRedelegationsRequest = { typeUrl: "/cosmos.staking.v1beta1.QueryRedelegationsRequest", aminoType: "cosmos-sdk/QueryRedelegationsRequest", + is(o: any): o is QueryRedelegationsRequest { + return o && (o.$typeUrl === QueryRedelegationsRequest.typeUrl || typeof o.delegatorAddr === "string" && typeof o.srcValidatorAddr === "string" && typeof o.dstValidatorAddr === "string"); + }, + isSDK(o: any): o is QueryRedelegationsRequestSDKType { + return o && (o.$typeUrl === QueryRedelegationsRequest.typeUrl || typeof o.delegator_addr === "string" && typeof o.src_validator_addr === "string" && typeof o.dst_validator_addr === "string"); + }, + isAmino(o: any): o is QueryRedelegationsRequestAmino { + return o && (o.$typeUrl === QueryRedelegationsRequest.typeUrl || typeof o.delegator_addr === "string" && typeof o.src_validator_addr === "string" && typeof o.dst_validator_addr === "string"); + }, encode(message: QueryRedelegationsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.delegatorAddr !== "") { writer.uint32(10).string(message.delegatorAddr); @@ -3288,6 +3528,12 @@ export const QueryRedelegationsRequest = { typeUrl: "/cosmos.staking.v1beta1.QueryRedelegationsRequest", value: QueryRedelegationsRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryRedelegationsRequest.typeUrl)) { + return; + } + PageRequest.registerTypeUrl(); } }; function createBaseQueryRedelegationsResponse(): QueryRedelegationsResponse { @@ -3306,6 +3552,15 @@ function createBaseQueryRedelegationsResponse(): QueryRedelegationsResponse { export const QueryRedelegationsResponse = { typeUrl: "/cosmos.staking.v1beta1.QueryRedelegationsResponse", aminoType: "cosmos-sdk/QueryRedelegationsResponse", + is(o: any): o is QueryRedelegationsResponse { + return o && (o.$typeUrl === QueryRedelegationsResponse.typeUrl || Array.isArray(o.redelegationResponses) && (!o.redelegationResponses.length || RedelegationResponse.is(o.redelegationResponses[0]))); + }, + isSDK(o: any): o is QueryRedelegationsResponseSDKType { + return o && (o.$typeUrl === QueryRedelegationsResponse.typeUrl || Array.isArray(o.redelegation_responses) && (!o.redelegation_responses.length || RedelegationResponse.isSDK(o.redelegation_responses[0]))); + }, + isAmino(o: any): o is QueryRedelegationsResponseAmino { + return o && (o.$typeUrl === QueryRedelegationsResponse.typeUrl || Array.isArray(o.redelegation_responses) && (!o.redelegation_responses.length || RedelegationResponse.isAmino(o.redelegation_responses[0]))); + }, encode(message: QueryRedelegationsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.redelegationResponses) { RedelegationResponse.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -3413,6 +3668,13 @@ export const QueryRedelegationsResponse = { typeUrl: "/cosmos.staking.v1beta1.QueryRedelegationsResponse", value: QueryRedelegationsResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryRedelegationsResponse.typeUrl)) { + return; + } + RedelegationResponse.registerTypeUrl(); + PageResponse.registerTypeUrl(); } }; function createBaseQueryDelegatorValidatorsRequest(): QueryDelegatorValidatorsRequest { @@ -3431,6 +3693,15 @@ function createBaseQueryDelegatorValidatorsRequest(): QueryDelegatorValidatorsRe export const QueryDelegatorValidatorsRequest = { typeUrl: "/cosmos.staking.v1beta1.QueryDelegatorValidatorsRequest", aminoType: "cosmos-sdk/QueryDelegatorValidatorsRequest", + is(o: any): o is QueryDelegatorValidatorsRequest { + return o && (o.$typeUrl === QueryDelegatorValidatorsRequest.typeUrl || typeof o.delegatorAddr === "string"); + }, + isSDK(o: any): o is QueryDelegatorValidatorsRequestSDKType { + return o && (o.$typeUrl === QueryDelegatorValidatorsRequest.typeUrl || typeof o.delegator_addr === "string"); + }, + isAmino(o: any): o is QueryDelegatorValidatorsRequestAmino { + return o && (o.$typeUrl === QueryDelegatorValidatorsRequest.typeUrl || typeof o.delegator_addr === "string"); + }, encode(message: QueryDelegatorValidatorsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.delegatorAddr !== "") { writer.uint32(10).string(message.delegatorAddr); @@ -3528,6 +3799,12 @@ export const QueryDelegatorValidatorsRequest = { typeUrl: "/cosmos.staking.v1beta1.QueryDelegatorValidatorsRequest", value: QueryDelegatorValidatorsRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryDelegatorValidatorsRequest.typeUrl)) { + return; + } + PageRequest.registerTypeUrl(); } }; function createBaseQueryDelegatorValidatorsResponse(): QueryDelegatorValidatorsResponse { @@ -3546,6 +3823,15 @@ function createBaseQueryDelegatorValidatorsResponse(): QueryDelegatorValidatorsR export const QueryDelegatorValidatorsResponse = { typeUrl: "/cosmos.staking.v1beta1.QueryDelegatorValidatorsResponse", aminoType: "cosmos-sdk/QueryDelegatorValidatorsResponse", + is(o: any): o is QueryDelegatorValidatorsResponse { + return o && (o.$typeUrl === QueryDelegatorValidatorsResponse.typeUrl || Array.isArray(o.validators) && (!o.validators.length || Validator.is(o.validators[0]))); + }, + isSDK(o: any): o is QueryDelegatorValidatorsResponseSDKType { + return o && (o.$typeUrl === QueryDelegatorValidatorsResponse.typeUrl || Array.isArray(o.validators) && (!o.validators.length || Validator.isSDK(o.validators[0]))); + }, + isAmino(o: any): o is QueryDelegatorValidatorsResponseAmino { + return o && (o.$typeUrl === QueryDelegatorValidatorsResponse.typeUrl || Array.isArray(o.validators) && (!o.validators.length || Validator.isAmino(o.validators[0]))); + }, encode(message: QueryDelegatorValidatorsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.validators) { Validator.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -3653,6 +3939,13 @@ export const QueryDelegatorValidatorsResponse = { typeUrl: "/cosmos.staking.v1beta1.QueryDelegatorValidatorsResponse", value: QueryDelegatorValidatorsResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryDelegatorValidatorsResponse.typeUrl)) { + return; + } + Validator.registerTypeUrl(); + PageResponse.registerTypeUrl(); } }; function createBaseQueryDelegatorValidatorRequest(): QueryDelegatorValidatorRequest { @@ -3671,6 +3964,15 @@ function createBaseQueryDelegatorValidatorRequest(): QueryDelegatorValidatorRequ export const QueryDelegatorValidatorRequest = { typeUrl: "/cosmos.staking.v1beta1.QueryDelegatorValidatorRequest", aminoType: "cosmos-sdk/QueryDelegatorValidatorRequest", + is(o: any): o is QueryDelegatorValidatorRequest { + return o && (o.$typeUrl === QueryDelegatorValidatorRequest.typeUrl || typeof o.delegatorAddr === "string" && typeof o.validatorAddr === "string"); + }, + isSDK(o: any): o is QueryDelegatorValidatorRequestSDKType { + return o && (o.$typeUrl === QueryDelegatorValidatorRequest.typeUrl || typeof o.delegator_addr === "string" && typeof o.validator_addr === "string"); + }, + isAmino(o: any): o is QueryDelegatorValidatorRequestAmino { + return o && (o.$typeUrl === QueryDelegatorValidatorRequest.typeUrl || typeof o.delegator_addr === "string" && typeof o.validator_addr === "string"); + }, encode(message: QueryDelegatorValidatorRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.delegatorAddr !== "") { writer.uint32(10).string(message.delegatorAddr); @@ -3766,7 +4068,8 @@ export const QueryDelegatorValidatorRequest = { typeUrl: "/cosmos.staking.v1beta1.QueryDelegatorValidatorRequest", value: QueryDelegatorValidatorRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryDelegatorValidatorResponse(): QueryDelegatorValidatorResponse { return { @@ -3783,6 +4086,15 @@ function createBaseQueryDelegatorValidatorResponse(): QueryDelegatorValidatorRes export const QueryDelegatorValidatorResponse = { typeUrl: "/cosmos.staking.v1beta1.QueryDelegatorValidatorResponse", aminoType: "cosmos-sdk/QueryDelegatorValidatorResponse", + is(o: any): o is QueryDelegatorValidatorResponse { + return o && (o.$typeUrl === QueryDelegatorValidatorResponse.typeUrl || Validator.is(o.validator)); + }, + isSDK(o: any): o is QueryDelegatorValidatorResponseSDKType { + return o && (o.$typeUrl === QueryDelegatorValidatorResponse.typeUrl || Validator.isSDK(o.validator)); + }, + isAmino(o: any): o is QueryDelegatorValidatorResponseAmino { + return o && (o.$typeUrl === QueryDelegatorValidatorResponse.typeUrl || Validator.isAmino(o.validator)); + }, encode(message: QueryDelegatorValidatorResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.validator !== undefined) { Validator.encode(message.validator, writer.uint32(10).fork()).ldelim(); @@ -3865,6 +4177,12 @@ export const QueryDelegatorValidatorResponse = { typeUrl: "/cosmos.staking.v1beta1.QueryDelegatorValidatorResponse", value: QueryDelegatorValidatorResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryDelegatorValidatorResponse.typeUrl)) { + return; + } + Validator.registerTypeUrl(); } }; function createBaseQueryHistoricalInfoRequest(): QueryHistoricalInfoRequest { @@ -3882,6 +4200,15 @@ function createBaseQueryHistoricalInfoRequest(): QueryHistoricalInfoRequest { export const QueryHistoricalInfoRequest = { typeUrl: "/cosmos.staking.v1beta1.QueryHistoricalInfoRequest", aminoType: "cosmos-sdk/QueryHistoricalInfoRequest", + is(o: any): o is QueryHistoricalInfoRequest { + return o && (o.$typeUrl === QueryHistoricalInfoRequest.typeUrl || typeof o.height === "bigint"); + }, + isSDK(o: any): o is QueryHistoricalInfoRequestSDKType { + return o && (o.$typeUrl === QueryHistoricalInfoRequest.typeUrl || typeof o.height === "bigint"); + }, + isAmino(o: any): o is QueryHistoricalInfoRequestAmino { + return o && (o.$typeUrl === QueryHistoricalInfoRequest.typeUrl || typeof o.height === "bigint"); + }, encode(message: QueryHistoricalInfoRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.height !== BigInt(0)) { writer.uint32(8).int64(message.height); @@ -3964,7 +4291,8 @@ export const QueryHistoricalInfoRequest = { typeUrl: "/cosmos.staking.v1beta1.QueryHistoricalInfoRequest", value: QueryHistoricalInfoRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryHistoricalInfoResponse(): QueryHistoricalInfoResponse { return { @@ -3981,6 +4309,15 @@ function createBaseQueryHistoricalInfoResponse(): QueryHistoricalInfoResponse { export const QueryHistoricalInfoResponse = { typeUrl: "/cosmos.staking.v1beta1.QueryHistoricalInfoResponse", aminoType: "cosmos-sdk/QueryHistoricalInfoResponse", + is(o: any): o is QueryHistoricalInfoResponse { + return o && o.$typeUrl === QueryHistoricalInfoResponse.typeUrl; + }, + isSDK(o: any): o is QueryHistoricalInfoResponseSDKType { + return o && o.$typeUrl === QueryHistoricalInfoResponse.typeUrl; + }, + isAmino(o: any): o is QueryHistoricalInfoResponseAmino { + return o && o.$typeUrl === QueryHistoricalInfoResponse.typeUrl; + }, encode(message: QueryHistoricalInfoResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.hist !== undefined) { HistoricalInfo.encode(message.hist, writer.uint32(10).fork()).ldelim(); @@ -4063,6 +4400,12 @@ export const QueryHistoricalInfoResponse = { typeUrl: "/cosmos.staking.v1beta1.QueryHistoricalInfoResponse", value: QueryHistoricalInfoResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryHistoricalInfoResponse.typeUrl)) { + return; + } + HistoricalInfo.registerTypeUrl(); } }; function createBaseQueryPoolRequest(): QueryPoolRequest { @@ -4077,6 +4420,15 @@ function createBaseQueryPoolRequest(): QueryPoolRequest { export const QueryPoolRequest = { typeUrl: "/cosmos.staking.v1beta1.QueryPoolRequest", aminoType: "cosmos-sdk/QueryPoolRequest", + is(o: any): o is QueryPoolRequest { + return o && o.$typeUrl === QueryPoolRequest.typeUrl; + }, + isSDK(o: any): o is QueryPoolRequestSDKType { + return o && o.$typeUrl === QueryPoolRequest.typeUrl; + }, + isAmino(o: any): o is QueryPoolRequestAmino { + return o && o.$typeUrl === QueryPoolRequest.typeUrl; + }, encode(_: QueryPoolRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -4141,7 +4493,8 @@ export const QueryPoolRequest = { typeUrl: "/cosmos.staking.v1beta1.QueryPoolRequest", value: QueryPoolRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryPoolResponse(): QueryPoolResponse { return { @@ -4157,6 +4510,15 @@ function createBaseQueryPoolResponse(): QueryPoolResponse { export const QueryPoolResponse = { typeUrl: "/cosmos.staking.v1beta1.QueryPoolResponse", aminoType: "cosmos-sdk/QueryPoolResponse", + is(o: any): o is QueryPoolResponse { + return o && (o.$typeUrl === QueryPoolResponse.typeUrl || Pool.is(o.pool)); + }, + isSDK(o: any): o is QueryPoolResponseSDKType { + return o && (o.$typeUrl === QueryPoolResponse.typeUrl || Pool.isSDK(o.pool)); + }, + isAmino(o: any): o is QueryPoolResponseAmino { + return o && (o.$typeUrl === QueryPoolResponse.typeUrl || Pool.isAmino(o.pool)); + }, encode(message: QueryPoolResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.pool !== undefined) { Pool.encode(message.pool, writer.uint32(10).fork()).ldelim(); @@ -4239,6 +4601,12 @@ export const QueryPoolResponse = { typeUrl: "/cosmos.staking.v1beta1.QueryPoolResponse", value: QueryPoolResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryPoolResponse.typeUrl)) { + return; + } + Pool.registerTypeUrl(); } }; function createBaseQueryParamsRequest(): QueryParamsRequest { @@ -4253,6 +4621,15 @@ function createBaseQueryParamsRequest(): QueryParamsRequest { export const QueryParamsRequest = { typeUrl: "/cosmos.staking.v1beta1.QueryParamsRequest", aminoType: "cosmos-sdk/QueryParamsRequest", + is(o: any): o is QueryParamsRequest { + return o && o.$typeUrl === QueryParamsRequest.typeUrl; + }, + isSDK(o: any): o is QueryParamsRequestSDKType { + return o && o.$typeUrl === QueryParamsRequest.typeUrl; + }, + isAmino(o: any): o is QueryParamsRequestAmino { + return o && o.$typeUrl === QueryParamsRequest.typeUrl; + }, encode(_: QueryParamsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -4317,7 +4694,8 @@ export const QueryParamsRequest = { typeUrl: "/cosmos.staking.v1beta1.QueryParamsRequest", value: QueryParamsRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryParamsResponse(): QueryParamsResponse { return { @@ -4333,6 +4711,15 @@ function createBaseQueryParamsResponse(): QueryParamsResponse { export const QueryParamsResponse = { typeUrl: "/cosmos.staking.v1beta1.QueryParamsResponse", aminoType: "cosmos-sdk/QueryParamsResponse", + is(o: any): o is QueryParamsResponse { + return o && (o.$typeUrl === QueryParamsResponse.typeUrl || Params.is(o.params)); + }, + isSDK(o: any): o is QueryParamsResponseSDKType { + return o && (o.$typeUrl === QueryParamsResponse.typeUrl || Params.isSDK(o.params)); + }, + isAmino(o: any): o is QueryParamsResponseAmino { + return o && (o.$typeUrl === QueryParamsResponse.typeUrl || Params.isAmino(o.params)); + }, encode(message: QueryParamsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.params !== undefined) { Params.encode(message.params, writer.uint32(10).fork()).ldelim(); @@ -4415,5 +4802,11 @@ export const QueryParamsResponse = { typeUrl: "/cosmos.staking.v1beta1.QueryParamsResponse", value: QueryParamsResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryParamsResponse.typeUrl)) { + return; + } + Params.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/cosmos/staking/v1beta1/staking.ts b/__fixtures__/v-next/outputv2/cosmos/staking/v1beta1/staking.ts index 7da1d62bec..ae7dda5ad2 100644 --- a/__fixtures__/v-next/outputv2/cosmos/staking/v1beta1/staking.ts +++ b/__fixtures__/v-next/outputv2/cosmos/staking/v1beta1/staking.ts @@ -4,11 +4,11 @@ import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../google/protobuf import { Duration, DurationAmino, DurationSDKType } from "../../../google/protobuf/duration"; import { Coin, CoinAmino, CoinSDKType } from "../../base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; +import { GlobalDecoderRegistry } from "../../../registry"; import { isSet, DeepPartial, toTimestamp, fromTimestamp } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; -import { Decimal } from "@cosmjs/math"; -import { encodePubkey, decodePubkey } from "@cosmjs/proto-signing"; -import { Pubkey } from "@cosmjs/amino"; +import { Decimal } from "@interchainjs/math"; +import { encodePubkey, decodePubkey } from "@interchainjs/pubkey"; export const protobufPackage = "cosmos.staking.v1beta1"; /** BondStatus is the status of a validator. */ export enum BondStatus { @@ -1260,6 +1260,15 @@ function createBaseHistoricalInfo(): HistoricalInfo { export const HistoricalInfo = { typeUrl: "/cosmos.staking.v1beta1.HistoricalInfo", aminoType: "cosmos-sdk/HistoricalInfo", + is(o: any): o is HistoricalInfo { + return o && (o.$typeUrl === HistoricalInfo.typeUrl || Header.is(o.header) && Array.isArray(o.valset) && (!o.valset.length || Validator.is(o.valset[0]))); + }, + isSDK(o: any): o is HistoricalInfoSDKType { + return o && (o.$typeUrl === HistoricalInfo.typeUrl || Header.isSDK(o.header) && Array.isArray(o.valset) && (!o.valset.length || Validator.isSDK(o.valset[0]))); + }, + isAmino(o: any): o is HistoricalInfoAmino { + return o && (o.$typeUrl === HistoricalInfo.typeUrl || Header.isAmino(o.header) && Array.isArray(o.valset) && (!o.valset.length || Validator.isAmino(o.valset[0]))); + }, encode(message: HistoricalInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.header !== undefined) { Header.encode(message.header, writer.uint32(10).fork()).ldelim(); @@ -1367,6 +1376,13 @@ export const HistoricalInfo = { typeUrl: "/cosmos.staking.v1beta1.HistoricalInfo", value: HistoricalInfo.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(HistoricalInfo.typeUrl)) { + return; + } + Header.registerTypeUrl(); + Validator.registerTypeUrl(); } }; function createBaseCommissionRates(): CommissionRates { @@ -1386,6 +1402,15 @@ function createBaseCommissionRates(): CommissionRates { export const CommissionRates = { typeUrl: "/cosmos.staking.v1beta1.CommissionRates", aminoType: "cosmos-sdk/CommissionRates", + is(o: any): o is CommissionRates { + return o && (o.$typeUrl === CommissionRates.typeUrl || typeof o.rate === "string" && typeof o.maxRate === "string" && typeof o.maxChangeRate === "string"); + }, + isSDK(o: any): o is CommissionRatesSDKType { + return o && (o.$typeUrl === CommissionRates.typeUrl || typeof o.rate === "string" && typeof o.max_rate === "string" && typeof o.max_change_rate === "string"); + }, + isAmino(o: any): o is CommissionRatesAmino { + return o && (o.$typeUrl === CommissionRates.typeUrl || typeof o.rate === "string" && typeof o.max_rate === "string" && typeof o.max_change_rate === "string"); + }, encode(message: CommissionRates, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.rate !== "") { writer.uint32(10).string(Decimal.fromUserInput(message.rate, 18).atomics); @@ -1471,9 +1496,9 @@ export const CommissionRates = { }, toAmino(message: CommissionRates): CommissionRatesAmino { const obj: any = {}; - obj.rate = message.rate === "" ? undefined : message.rate; - obj.max_rate = message.maxRate === "" ? undefined : message.maxRate; - obj.max_change_rate = message.maxChangeRate === "" ? undefined : message.maxChangeRate; + obj.rate = message.rate === "" ? undefined : Decimal.fromUserInput(message.rate, 18).atomics; + obj.max_rate = message.maxRate === "" ? undefined : Decimal.fromUserInput(message.maxRate, 18).atomics; + obj.max_change_rate = message.maxChangeRate === "" ? undefined : Decimal.fromUserInput(message.maxChangeRate, 18).atomics; return obj; }, fromAminoMsg(object: CommissionRatesAminoMsg): CommissionRates { @@ -1496,7 +1521,8 @@ export const CommissionRates = { typeUrl: "/cosmos.staking.v1beta1.CommissionRates", value: CommissionRates.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseCommission(): Commission { return { @@ -1513,6 +1539,15 @@ function createBaseCommission(): Commission { export const Commission = { typeUrl: "/cosmos.staking.v1beta1.Commission", aminoType: "cosmos-sdk/Commission", + is(o: any): o is Commission { + return o && (o.$typeUrl === Commission.typeUrl || CommissionRates.is(o.commissionRates) && Timestamp.is(o.updateTime)); + }, + isSDK(o: any): o is CommissionSDKType { + return o && (o.$typeUrl === Commission.typeUrl || CommissionRates.isSDK(o.commission_rates) && Timestamp.isSDK(o.update_time)); + }, + isAmino(o: any): o is CommissionAmino { + return o && (o.$typeUrl === Commission.typeUrl || CommissionRates.isAmino(o.commission_rates) && Timestamp.isAmino(o.update_time)); + }, encode(message: Commission, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.commissionRates !== undefined) { CommissionRates.encode(message.commissionRates, writer.uint32(10).fork()).ldelim(); @@ -1610,6 +1645,12 @@ export const Commission = { typeUrl: "/cosmos.staking.v1beta1.Commission", value: Commission.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Commission.typeUrl)) { + return; + } + CommissionRates.registerTypeUrl(); } }; function createBaseDescription(): Description { @@ -1630,6 +1671,15 @@ function createBaseDescription(): Description { export const Description = { typeUrl: "/cosmos.staking.v1beta1.Description", aminoType: "cosmos-sdk/Description", + is(o: any): o is Description { + return o && (o.$typeUrl === Description.typeUrl || typeof o.moniker === "string" && typeof o.identity === "string" && typeof o.website === "string" && typeof o.securityContact === "string" && typeof o.details === "string"); + }, + isSDK(o: any): o is DescriptionSDKType { + return o && (o.$typeUrl === Description.typeUrl || typeof o.moniker === "string" && typeof o.identity === "string" && typeof o.website === "string" && typeof o.security_contact === "string" && typeof o.details === "string"); + }, + isAmino(o: any): o is DescriptionAmino { + return o && (o.$typeUrl === Description.typeUrl || typeof o.moniker === "string" && typeof o.identity === "string" && typeof o.website === "string" && typeof o.security_contact === "string" && typeof o.details === "string"); + }, encode(message: Description, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.moniker !== "") { writer.uint32(10).string(message.moniker); @@ -1770,7 +1820,8 @@ export const Description = { typeUrl: "/cosmos.staking.v1beta1.Description", value: Description.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseValidator(): Validator { return { @@ -1803,12 +1854,21 @@ function createBaseValidator(): Validator { export const Validator = { typeUrl: "/cosmos.staking.v1beta1.Validator", aminoType: "cosmos-sdk/Validator", + is(o: any): o is Validator { + return o && (o.$typeUrl === Validator.typeUrl || typeof o.operatorAddress === "string" && typeof o.jailed === "boolean" && isSet(o.status) && typeof o.tokens === "string" && typeof o.delegatorShares === "string" && Description.is(o.description) && typeof o.unbondingHeight === "bigint" && Timestamp.is(o.unbondingTime) && Commission.is(o.commission) && typeof o.minSelfDelegation === "string"); + }, + isSDK(o: any): o is ValidatorSDKType { + return o && (o.$typeUrl === Validator.typeUrl || typeof o.operator_address === "string" && typeof o.jailed === "boolean" && isSet(o.status) && typeof o.tokens === "string" && typeof o.delegator_shares === "string" && Description.isSDK(o.description) && typeof o.unbonding_height === "bigint" && Timestamp.isSDK(o.unbonding_time) && Commission.isSDK(o.commission) && typeof o.min_self_delegation === "string"); + }, + isAmino(o: any): o is ValidatorAmino { + return o && (o.$typeUrl === Validator.typeUrl || typeof o.operator_address === "string" && typeof o.jailed === "boolean" && isSet(o.status) && typeof o.tokens === "string" && typeof o.delegator_shares === "string" && Description.isAmino(o.description) && typeof o.unbonding_height === "bigint" && Timestamp.isAmino(o.unbonding_time) && Commission.isAmino(o.commission) && typeof o.min_self_delegation === "string"); + }, encode(message: Validator, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.operatorAddress !== "") { writer.uint32(10).string(message.operatorAddress); } if (message.consensusPubkey !== undefined) { - Any.encode((message.consensusPubkey as Any), writer.uint32(18).fork()).ldelim(); + Any.encode(GlobalDecoderRegistry.wrapAny(message.consensusPubkey), writer.uint32(18).fork()).ldelim(); } if (message.jailed === true) { writer.uint32(24).bool(message.jailed); @@ -1850,7 +1910,7 @@ export const Validator = { message.operatorAddress = reader.string(); break; case 2: - message.consensusPubkey = (Cosmos_cryptoPubKey_InterfaceDecoder(reader) as Any); + message.consensusPubkey = GlobalDecoderRegistry.unwrapAny(reader); break; case 3: message.jailed = reader.bool(); @@ -1889,7 +1949,7 @@ export const Validator = { fromJSON(object: any): Validator { const obj = createBaseValidator(); if (isSet(object.operatorAddress)) obj.operatorAddress = String(object.operatorAddress); - if (isSet(object.consensusPubkey)) obj.consensusPubkey = Any.fromJSON(object.consensusPubkey); + if (isSet(object.consensusPubkey)) obj.consensusPubkey = GlobalDecoderRegistry.fromJSON(object.consensusPubkey); if (isSet(object.jailed)) obj.jailed = Boolean(object.jailed); if (isSet(object.status)) obj.status = bondStatusFromJSON(object.status); if (isSet(object.tokens)) obj.tokens = String(object.tokens); @@ -1904,7 +1964,7 @@ export const Validator = { toJSON(message: Validator): JsonSafe { const obj: any = {}; message.operatorAddress !== undefined && (obj.operatorAddress = message.operatorAddress); - message.consensusPubkey !== undefined && (obj.consensusPubkey = message.consensusPubkey ? Any.toJSON(message.consensusPubkey) : undefined); + message.consensusPubkey !== undefined && (obj.consensusPubkey = message.consensusPubkey ? GlobalDecoderRegistry.toJSON(message.consensusPubkey) : undefined); message.jailed !== undefined && (obj.jailed = message.jailed); message.status !== undefined && (obj.status = bondStatusToJSON(message.status)); message.tokens !== undefined && (obj.tokens = message.tokens); @@ -1920,7 +1980,7 @@ export const Validator = { const message = createBaseValidator(); message.operatorAddress = object.operatorAddress ?? ""; if (object.consensusPubkey !== undefined && object.consensusPubkey !== null) { - message.consensusPubkey = Any.fromPartial(object.consensusPubkey); + message.consensusPubkey = GlobalDecoderRegistry.fromPartial(object.consensusPubkey); } message.jailed = object.jailed ?? false; message.status = object.status ?? 0; @@ -1942,7 +2002,7 @@ export const Validator = { fromSDK(object: ValidatorSDKType): Validator { return { operatorAddress: object?.operator_address, - consensusPubkey: object.consensus_pubkey ? Any.fromSDK(object.consensus_pubkey) : undefined, + consensusPubkey: object.consensus_pubkey ? GlobalDecoderRegistry.fromSDK(object.consensus_pubkey) : undefined, jailed: object?.jailed, status: isSet(object.status) ? bondStatusFromJSON(object.status) : -1, tokens: object?.tokens, @@ -1957,7 +2017,7 @@ export const Validator = { toSDK(message: Validator): ValidatorSDKType { const obj: any = {}; obj.operator_address = message.operatorAddress; - message.consensusPubkey !== undefined && (obj.consensus_pubkey = message.consensusPubkey ? Any.toSDK(message.consensusPubkey) : undefined); + message.consensusPubkey !== undefined && (obj.consensus_pubkey = message.consensusPubkey ? GlobalDecoderRegistry.toSDK(message.consensusPubkey) : undefined); obj.jailed = message.jailed; message.status !== undefined && (obj.status = bondStatusToJSON(message.status)); obj.tokens = message.tokens; @@ -2013,7 +2073,7 @@ export const Validator = { obj.jailed = message.jailed === false ? undefined : message.jailed; obj.status = message.status === 0 ? undefined : message.status; obj.tokens = message.tokens === "" ? undefined : message.tokens; - obj.delegator_shares = message.delegatorShares === "" ? undefined : message.delegatorShares; + obj.delegator_shares = message.delegatorShares === "" ? undefined : Decimal.fromUserInput(message.delegatorShares, 18).atomics; obj.description = message.description ? Description.toAmino(message.description) : undefined; obj.unbonding_height = message.unbondingHeight !== BigInt(0) ? message.unbondingHeight?.toString() : undefined; obj.unbonding_time = message.unbondingTime ? Timestamp.toAmino(toTimestamp(message.unbondingTime)) : undefined; @@ -2041,6 +2101,13 @@ export const Validator = { typeUrl: "/cosmos.staking.v1beta1.Validator", value: Validator.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Validator.typeUrl)) { + return; + } + Description.registerTypeUrl(); + Commission.registerTypeUrl(); } }; function createBaseValAddresses(): ValAddresses { @@ -2057,6 +2124,15 @@ function createBaseValAddresses(): ValAddresses { export const ValAddresses = { typeUrl: "/cosmos.staking.v1beta1.ValAddresses", aminoType: "cosmos-sdk/ValAddresses", + is(o: any): o is ValAddresses { + return o && (o.$typeUrl === ValAddresses.typeUrl || Array.isArray(o.addresses) && (!o.addresses.length || typeof o.addresses[0] === "string")); + }, + isSDK(o: any): o is ValAddressesSDKType { + return o && (o.$typeUrl === ValAddresses.typeUrl || Array.isArray(o.addresses) && (!o.addresses.length || typeof o.addresses[0] === "string")); + }, + isAmino(o: any): o is ValAddressesAmino { + return o && (o.$typeUrl === ValAddresses.typeUrl || Array.isArray(o.addresses) && (!o.addresses.length || typeof o.addresses[0] === "string")); + }, encode(message: ValAddresses, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.addresses) { writer.uint32(10).string(v!); @@ -2147,7 +2223,8 @@ export const ValAddresses = { typeUrl: "/cosmos.staking.v1beta1.ValAddresses", value: ValAddresses.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseDVPair(): DVPair { return { @@ -2166,6 +2243,15 @@ function createBaseDVPair(): DVPair { export const DVPair = { typeUrl: "/cosmos.staking.v1beta1.DVPair", aminoType: "cosmos-sdk/DVPair", + is(o: any): o is DVPair { + return o && (o.$typeUrl === DVPair.typeUrl || typeof o.delegatorAddress === "string" && typeof o.validatorAddress === "string"); + }, + isSDK(o: any): o is DVPairSDKType { + return o && (o.$typeUrl === DVPair.typeUrl || typeof o.delegator_address === "string" && typeof o.validator_address === "string"); + }, + isAmino(o: any): o is DVPairAmino { + return o && (o.$typeUrl === DVPair.typeUrl || typeof o.delegator_address === "string" && typeof o.validator_address === "string"); + }, encode(message: DVPair, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.delegatorAddress !== "") { writer.uint32(10).string(message.delegatorAddress); @@ -2261,7 +2347,8 @@ export const DVPair = { typeUrl: "/cosmos.staking.v1beta1.DVPair", value: DVPair.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseDVPairs(): DVPairs { return { @@ -2277,6 +2364,15 @@ function createBaseDVPairs(): DVPairs { export const DVPairs = { typeUrl: "/cosmos.staking.v1beta1.DVPairs", aminoType: "cosmos-sdk/DVPairs", + is(o: any): o is DVPairs { + return o && (o.$typeUrl === DVPairs.typeUrl || Array.isArray(o.pairs) && (!o.pairs.length || DVPair.is(o.pairs[0]))); + }, + isSDK(o: any): o is DVPairsSDKType { + return o && (o.$typeUrl === DVPairs.typeUrl || Array.isArray(o.pairs) && (!o.pairs.length || DVPair.isSDK(o.pairs[0]))); + }, + isAmino(o: any): o is DVPairsAmino { + return o && (o.$typeUrl === DVPairs.typeUrl || Array.isArray(o.pairs) && (!o.pairs.length || DVPair.isAmino(o.pairs[0]))); + }, encode(message: DVPairs, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.pairs) { DVPair.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -2367,6 +2463,12 @@ export const DVPairs = { typeUrl: "/cosmos.staking.v1beta1.DVPairs", value: DVPairs.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(DVPairs.typeUrl)) { + return; + } + DVPair.registerTypeUrl(); } }; function createBaseDVVTriplet(): DVVTriplet { @@ -2388,6 +2490,15 @@ function createBaseDVVTriplet(): DVVTriplet { export const DVVTriplet = { typeUrl: "/cosmos.staking.v1beta1.DVVTriplet", aminoType: "cosmos-sdk/DVVTriplet", + is(o: any): o is DVVTriplet { + return o && (o.$typeUrl === DVVTriplet.typeUrl || typeof o.delegatorAddress === "string" && typeof o.validatorSrcAddress === "string" && typeof o.validatorDstAddress === "string"); + }, + isSDK(o: any): o is DVVTripletSDKType { + return o && (o.$typeUrl === DVVTriplet.typeUrl || typeof o.delegator_address === "string" && typeof o.validator_src_address === "string" && typeof o.validator_dst_address === "string"); + }, + isAmino(o: any): o is DVVTripletAmino { + return o && (o.$typeUrl === DVVTriplet.typeUrl || typeof o.delegator_address === "string" && typeof o.validator_src_address === "string" && typeof o.validator_dst_address === "string"); + }, encode(message: DVVTriplet, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.delegatorAddress !== "") { writer.uint32(10).string(message.delegatorAddress); @@ -2498,7 +2609,8 @@ export const DVVTriplet = { typeUrl: "/cosmos.staking.v1beta1.DVVTriplet", value: DVVTriplet.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseDVVTriplets(): DVVTriplets { return { @@ -2514,6 +2626,15 @@ function createBaseDVVTriplets(): DVVTriplets { export const DVVTriplets = { typeUrl: "/cosmos.staking.v1beta1.DVVTriplets", aminoType: "cosmos-sdk/DVVTriplets", + is(o: any): o is DVVTriplets { + return o && (o.$typeUrl === DVVTriplets.typeUrl || Array.isArray(o.triplets) && (!o.triplets.length || DVVTriplet.is(o.triplets[0]))); + }, + isSDK(o: any): o is DVVTripletsSDKType { + return o && (o.$typeUrl === DVVTriplets.typeUrl || Array.isArray(o.triplets) && (!o.triplets.length || DVVTriplet.isSDK(o.triplets[0]))); + }, + isAmino(o: any): o is DVVTripletsAmino { + return o && (o.$typeUrl === DVVTriplets.typeUrl || Array.isArray(o.triplets) && (!o.triplets.length || DVVTriplet.isAmino(o.triplets[0]))); + }, encode(message: DVVTriplets, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.triplets) { DVVTriplet.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -2604,6 +2725,12 @@ export const DVVTriplets = { typeUrl: "/cosmos.staking.v1beta1.DVVTriplets", value: DVVTriplets.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(DVVTriplets.typeUrl)) { + return; + } + DVVTriplet.registerTypeUrl(); } }; function createBaseDelegation(): Delegation { @@ -2624,6 +2751,15 @@ function createBaseDelegation(): Delegation { export const Delegation = { typeUrl: "/cosmos.staking.v1beta1.Delegation", aminoType: "cosmos-sdk/Delegation", + is(o: any): o is Delegation { + return o && (o.$typeUrl === Delegation.typeUrl || typeof o.delegatorAddress === "string" && typeof o.validatorAddress === "string" && typeof o.shares === "string"); + }, + isSDK(o: any): o is DelegationSDKType { + return o && (o.$typeUrl === Delegation.typeUrl || typeof o.delegator_address === "string" && typeof o.validator_address === "string" && typeof o.shares === "string"); + }, + isAmino(o: any): o is DelegationAmino { + return o && (o.$typeUrl === Delegation.typeUrl || typeof o.delegator_address === "string" && typeof o.validator_address === "string" && typeof o.shares === "string"); + }, encode(message: Delegation, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.delegatorAddress !== "") { writer.uint32(10).string(message.delegatorAddress); @@ -2711,7 +2847,7 @@ export const Delegation = { const obj: any = {}; obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; - obj.shares = message.shares === "" ? undefined : message.shares; + obj.shares = message.shares === "" ? undefined : Decimal.fromUserInput(message.shares, 18).atomics; return obj; }, fromAminoMsg(object: DelegationAminoMsg): Delegation { @@ -2734,7 +2870,8 @@ export const Delegation = { typeUrl: "/cosmos.staking.v1beta1.Delegation", value: Delegation.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseUnbondingDelegation(): UnbondingDelegation { return { @@ -2753,6 +2890,15 @@ function createBaseUnbondingDelegation(): UnbondingDelegation { export const UnbondingDelegation = { typeUrl: "/cosmos.staking.v1beta1.UnbondingDelegation", aminoType: "cosmos-sdk/UnbondingDelegation", + is(o: any): o is UnbondingDelegation { + return o && (o.$typeUrl === UnbondingDelegation.typeUrl || typeof o.delegatorAddress === "string" && typeof o.validatorAddress === "string" && Array.isArray(o.entries) && (!o.entries.length || UnbondingDelegationEntry.is(o.entries[0]))); + }, + isSDK(o: any): o is UnbondingDelegationSDKType { + return o && (o.$typeUrl === UnbondingDelegation.typeUrl || typeof o.delegator_address === "string" && typeof o.validator_address === "string" && Array.isArray(o.entries) && (!o.entries.length || UnbondingDelegationEntry.isSDK(o.entries[0]))); + }, + isAmino(o: any): o is UnbondingDelegationAmino { + return o && (o.$typeUrl === UnbondingDelegation.typeUrl || typeof o.delegator_address === "string" && typeof o.validator_address === "string" && Array.isArray(o.entries) && (!o.entries.length || UnbondingDelegationEntry.isAmino(o.entries[0]))); + }, encode(message: UnbondingDelegation, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.delegatorAddress !== "") { writer.uint32(10).string(message.delegatorAddress); @@ -2873,6 +3019,12 @@ export const UnbondingDelegation = { typeUrl: "/cosmos.staking.v1beta1.UnbondingDelegation", value: UnbondingDelegation.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(UnbondingDelegation.typeUrl)) { + return; + } + UnbondingDelegationEntry.registerTypeUrl(); } }; function createBaseUnbondingDelegationEntry(): UnbondingDelegationEntry { @@ -2892,6 +3044,15 @@ function createBaseUnbondingDelegationEntry(): UnbondingDelegationEntry { export const UnbondingDelegationEntry = { typeUrl: "/cosmos.staking.v1beta1.UnbondingDelegationEntry", aminoType: "cosmos-sdk/UnbondingDelegationEntry", + is(o: any): o is UnbondingDelegationEntry { + return o && (o.$typeUrl === UnbondingDelegationEntry.typeUrl || typeof o.creationHeight === "bigint" && Timestamp.is(o.completionTime) && typeof o.initialBalance === "string" && typeof o.balance === "string"); + }, + isSDK(o: any): o is UnbondingDelegationEntrySDKType { + return o && (o.$typeUrl === UnbondingDelegationEntry.typeUrl || typeof o.creation_height === "bigint" && Timestamp.isSDK(o.completion_time) && typeof o.initial_balance === "string" && typeof o.balance === "string"); + }, + isAmino(o: any): o is UnbondingDelegationEntryAmino { + return o && (o.$typeUrl === UnbondingDelegationEntry.typeUrl || typeof o.creation_height === "bigint" && Timestamp.isAmino(o.completion_time) && typeof o.initial_balance === "string" && typeof o.balance === "string"); + }, encode(message: UnbondingDelegationEntry, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.creationHeight !== BigInt(0)) { writer.uint32(8).int64(message.creationHeight); @@ -3019,7 +3180,8 @@ export const UnbondingDelegationEntry = { typeUrl: "/cosmos.staking.v1beta1.UnbondingDelegationEntry", value: UnbondingDelegationEntry.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseRedelegationEntry(): RedelegationEntry { return { @@ -3038,6 +3200,15 @@ function createBaseRedelegationEntry(): RedelegationEntry { export const RedelegationEntry = { typeUrl: "/cosmos.staking.v1beta1.RedelegationEntry", aminoType: "cosmos-sdk/RedelegationEntry", + is(o: any): o is RedelegationEntry { + return o && (o.$typeUrl === RedelegationEntry.typeUrl || typeof o.creationHeight === "bigint" && Timestamp.is(o.completionTime) && typeof o.initialBalance === "string" && typeof o.sharesDst === "string"); + }, + isSDK(o: any): o is RedelegationEntrySDKType { + return o && (o.$typeUrl === RedelegationEntry.typeUrl || typeof o.creation_height === "bigint" && Timestamp.isSDK(o.completion_time) && typeof o.initial_balance === "string" && typeof o.shares_dst === "string"); + }, + isAmino(o: any): o is RedelegationEntryAmino { + return o && (o.$typeUrl === RedelegationEntry.typeUrl || typeof o.creation_height === "bigint" && Timestamp.isAmino(o.completion_time) && typeof o.initial_balance === "string" && typeof o.shares_dst === "string"); + }, encode(message: RedelegationEntry, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.creationHeight !== BigInt(0)) { writer.uint32(8).int64(message.creationHeight); @@ -3142,7 +3313,7 @@ export const RedelegationEntry = { obj.creation_height = message.creationHeight !== BigInt(0) ? message.creationHeight?.toString() : undefined; obj.completion_time = message.completionTime ? Timestamp.toAmino(toTimestamp(message.completionTime)) : undefined; obj.initial_balance = message.initialBalance === "" ? undefined : message.initialBalance; - obj.shares_dst = message.sharesDst === "" ? undefined : message.sharesDst; + obj.shares_dst = message.sharesDst === "" ? undefined : Decimal.fromUserInput(message.sharesDst, 18).atomics; return obj; }, fromAminoMsg(object: RedelegationEntryAminoMsg): RedelegationEntry { @@ -3165,7 +3336,8 @@ export const RedelegationEntry = { typeUrl: "/cosmos.staking.v1beta1.RedelegationEntry", value: RedelegationEntry.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseRedelegation(): Redelegation { return { @@ -3185,6 +3357,15 @@ function createBaseRedelegation(): Redelegation { export const Redelegation = { typeUrl: "/cosmos.staking.v1beta1.Redelegation", aminoType: "cosmos-sdk/Redelegation", + is(o: any): o is Redelegation { + return o && (o.$typeUrl === Redelegation.typeUrl || typeof o.delegatorAddress === "string" && typeof o.validatorSrcAddress === "string" && typeof o.validatorDstAddress === "string" && Array.isArray(o.entries) && (!o.entries.length || RedelegationEntry.is(o.entries[0]))); + }, + isSDK(o: any): o is RedelegationSDKType { + return o && (o.$typeUrl === Redelegation.typeUrl || typeof o.delegator_address === "string" && typeof o.validator_src_address === "string" && typeof o.validator_dst_address === "string" && Array.isArray(o.entries) && (!o.entries.length || RedelegationEntry.isSDK(o.entries[0]))); + }, + isAmino(o: any): o is RedelegationAmino { + return o && (o.$typeUrl === Redelegation.typeUrl || typeof o.delegator_address === "string" && typeof o.validator_src_address === "string" && typeof o.validator_dst_address === "string" && Array.isArray(o.entries) && (!o.entries.length || RedelegationEntry.isAmino(o.entries[0]))); + }, encode(message: Redelegation, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.delegatorAddress !== "") { writer.uint32(10).string(message.delegatorAddress); @@ -3320,6 +3501,12 @@ export const Redelegation = { typeUrl: "/cosmos.staking.v1beta1.Redelegation", value: Redelegation.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Redelegation.typeUrl)) { + return; + } + RedelegationEntry.registerTypeUrl(); } }; function createBaseParams(): Params { @@ -3341,6 +3528,15 @@ function createBaseParams(): Params { export const Params = { typeUrl: "/cosmos.staking.v1beta1.Params", aminoType: "cosmos-sdk/Params", + is(o: any): o is Params { + return o && (o.$typeUrl === Params.typeUrl || Duration.is(o.unbondingTime) && typeof o.maxValidators === "number" && typeof o.maxEntries === "number" && typeof o.historicalEntries === "number" && typeof o.bondDenom === "string" && typeof o.minCommissionRate === "string"); + }, + isSDK(o: any): o is ParamsSDKType { + return o && (o.$typeUrl === Params.typeUrl || Duration.isSDK(o.unbonding_time) && typeof o.max_validators === "number" && typeof o.max_entries === "number" && typeof o.historical_entries === "number" && typeof o.bond_denom === "string" && typeof o.min_commission_rate === "string"); + }, + isAmino(o: any): o is ParamsAmino { + return o && (o.$typeUrl === Params.typeUrl || Duration.isAmino(o.unbonding_time) && typeof o.max_validators === "number" && typeof o.max_entries === "number" && typeof o.historical_entries === "number" && typeof o.bond_denom === "string" && typeof o.min_commission_rate === "string"); + }, encode(message: Params, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.unbondingTime !== undefined) { Duration.encode(message.unbondingTime, writer.uint32(10).fork()).ldelim(); @@ -3475,7 +3671,7 @@ export const Params = { obj.max_entries = message.maxEntries === 0 ? undefined : message.maxEntries; obj.historical_entries = message.historicalEntries === 0 ? undefined : message.historicalEntries; obj.bond_denom = message.bondDenom === "" ? undefined : message.bondDenom; - obj.min_commission_rate = message.minCommissionRate === "" ? undefined : message.minCommissionRate; + obj.min_commission_rate = message.minCommissionRate === "" ? undefined : Decimal.fromUserInput(message.minCommissionRate, 18).atomics; return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { @@ -3498,7 +3694,8 @@ export const Params = { typeUrl: "/cosmos.staking.v1beta1.Params", value: Params.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseDelegationResponse(): DelegationResponse { return { @@ -3516,6 +3713,15 @@ function createBaseDelegationResponse(): DelegationResponse { export const DelegationResponse = { typeUrl: "/cosmos.staking.v1beta1.DelegationResponse", aminoType: "cosmos-sdk/DelegationResponse", + is(o: any): o is DelegationResponse { + return o && (o.$typeUrl === DelegationResponse.typeUrl || Delegation.is(o.delegation) && Coin.is(o.balance)); + }, + isSDK(o: any): o is DelegationResponseSDKType { + return o && (o.$typeUrl === DelegationResponse.typeUrl || Delegation.isSDK(o.delegation) && Coin.isSDK(o.balance)); + }, + isAmino(o: any): o is DelegationResponseAmino { + return o && (o.$typeUrl === DelegationResponse.typeUrl || Delegation.isAmino(o.delegation) && Coin.isAmino(o.balance)); + }, encode(message: DelegationResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.delegation !== undefined) { Delegation.encode(message.delegation, writer.uint32(10).fork()).ldelim(); @@ -3615,6 +3821,13 @@ export const DelegationResponse = { typeUrl: "/cosmos.staking.v1beta1.DelegationResponse", value: DelegationResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(DelegationResponse.typeUrl)) { + return; + } + Delegation.registerTypeUrl(); + Coin.registerTypeUrl(); } }; function createBaseRedelegationEntryResponse(): RedelegationEntryResponse { @@ -3634,6 +3847,15 @@ function createBaseRedelegationEntryResponse(): RedelegationEntryResponse { export const RedelegationEntryResponse = { typeUrl: "/cosmos.staking.v1beta1.RedelegationEntryResponse", aminoType: "cosmos-sdk/RedelegationEntryResponse", + is(o: any): o is RedelegationEntryResponse { + return o && (o.$typeUrl === RedelegationEntryResponse.typeUrl || RedelegationEntry.is(o.redelegationEntry) && typeof o.balance === "string"); + }, + isSDK(o: any): o is RedelegationEntryResponseSDKType { + return o && (o.$typeUrl === RedelegationEntryResponse.typeUrl || RedelegationEntry.isSDK(o.redelegation_entry) && typeof o.balance === "string"); + }, + isAmino(o: any): o is RedelegationEntryResponseAmino { + return o && (o.$typeUrl === RedelegationEntryResponse.typeUrl || RedelegationEntry.isAmino(o.redelegation_entry) && typeof o.balance === "string"); + }, encode(message: RedelegationEntryResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.redelegationEntry !== undefined) { RedelegationEntry.encode(message.redelegationEntry, writer.uint32(10).fork()).ldelim(); @@ -3731,6 +3953,12 @@ export const RedelegationEntryResponse = { typeUrl: "/cosmos.staking.v1beta1.RedelegationEntryResponse", value: RedelegationEntryResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(RedelegationEntryResponse.typeUrl)) { + return; + } + RedelegationEntry.registerTypeUrl(); } }; function createBaseRedelegationResponse(): RedelegationResponse { @@ -3750,6 +3978,15 @@ function createBaseRedelegationResponse(): RedelegationResponse { export const RedelegationResponse = { typeUrl: "/cosmos.staking.v1beta1.RedelegationResponse", aminoType: "cosmos-sdk/RedelegationResponse", + is(o: any): o is RedelegationResponse { + return o && (o.$typeUrl === RedelegationResponse.typeUrl || Redelegation.is(o.redelegation) && Array.isArray(o.entries) && (!o.entries.length || RedelegationEntryResponse.is(o.entries[0]))); + }, + isSDK(o: any): o is RedelegationResponseSDKType { + return o && (o.$typeUrl === RedelegationResponse.typeUrl || Redelegation.isSDK(o.redelegation) && Array.isArray(o.entries) && (!o.entries.length || RedelegationEntryResponse.isSDK(o.entries[0]))); + }, + isAmino(o: any): o is RedelegationResponseAmino { + return o && (o.$typeUrl === RedelegationResponse.typeUrl || Redelegation.isAmino(o.redelegation) && Array.isArray(o.entries) && (!o.entries.length || RedelegationEntryResponse.isAmino(o.entries[0]))); + }, encode(message: RedelegationResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.redelegation !== undefined) { Redelegation.encode(message.redelegation, writer.uint32(10).fork()).ldelim(); @@ -3857,6 +4094,13 @@ export const RedelegationResponse = { typeUrl: "/cosmos.staking.v1beta1.RedelegationResponse", value: RedelegationResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(RedelegationResponse.typeUrl)) { + return; + } + Redelegation.registerTypeUrl(); + RedelegationEntryResponse.registerTypeUrl(); } }; function createBasePool(): Pool { @@ -3875,6 +4119,15 @@ function createBasePool(): Pool { export const Pool = { typeUrl: "/cosmos.staking.v1beta1.Pool", aminoType: "cosmos-sdk/Pool", + is(o: any): o is Pool { + return o && (o.$typeUrl === Pool.typeUrl || typeof o.notBondedTokens === "string" && typeof o.bondedTokens === "string"); + }, + isSDK(o: any): o is PoolSDKType { + return o && (o.$typeUrl === Pool.typeUrl || typeof o.not_bonded_tokens === "string" && typeof o.bonded_tokens === "string"); + }, + isAmino(o: any): o is PoolAmino { + return o && (o.$typeUrl === Pool.typeUrl || typeof o.not_bonded_tokens === "string" && typeof o.bonded_tokens === "string"); + }, encode(message: Pool, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.notBondedTokens !== "") { writer.uint32(10).string(message.notBondedTokens); @@ -3970,19 +4223,6 @@ export const Pool = { typeUrl: "/cosmos.staking.v1beta1.Pool", value: Pool.encode(message).finish() }; - } -}; -export const Cosmos_cryptoPubKey_InterfaceDecoder = (input: BinaryReader | Uint8Array): Any => { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - const data = Any.decode(reader, reader.uint32()); - switch (data.typeUrl) { - default: - return data; - } -}; -export const Cosmos_cryptoPubKey_FromAmino = (content: AnyAmino): Any => { - return encodePubkey(content); -}; -export const Cosmos_cryptoPubKey_ToAmino = (content: Any): Pubkey | null => { - return decodePubkey(content); + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/cosmos/staking/v1beta1/tx.registry.ts b/__fixtures__/v-next/outputv2/cosmos/staking/v1beta1/tx.registry.ts index df6c66c232..85a6de8e4f 100644 --- a/__fixtures__/v-next/outputv2/cosmos/staking/v1beta1/tx.registry.ts +++ b/__fixtures__/v-next/outputv2/cosmos/staking/v1beta1/tx.registry.ts @@ -1,11 +1,6 @@ -import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { TelescopeGeneratedType } from "../../../types"; import { MsgCreateValidator, MsgEditValidator, MsgDelegate, MsgBeginRedelegate, MsgUndelegate } from "./tx"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/cosmos.staking.v1beta1.MsgCreateValidator", MsgCreateValidator], ["/cosmos.staking.v1beta1.MsgEditValidator", MsgEditValidator], ["/cosmos.staking.v1beta1.MsgDelegate", MsgDelegate], ["/cosmos.staking.v1beta1.MsgBeginRedelegate", MsgBeginRedelegate], ["/cosmos.staking.v1beta1.MsgUndelegate", MsgUndelegate]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/cosmos.staking.v1beta1.MsgCreateValidator", MsgCreateValidator], ["/cosmos.staking.v1beta1.MsgEditValidator", MsgEditValidator], ["/cosmos.staking.v1beta1.MsgDelegate", MsgDelegate], ["/cosmos.staking.v1beta1.MsgBeginRedelegate", MsgBeginRedelegate], ["/cosmos.staking.v1beta1.MsgUndelegate", MsgUndelegate]]; export const MessageComposer = { encoded: { createValidator(value: MsgCreateValidator) { diff --git a/__fixtures__/v-next/outputv2/cosmos/staking/v1beta1/tx.rpc.func.ts b/__fixtures__/v-next/outputv2/cosmos/staking/v1beta1/tx.rpc.func.ts new file mode 100644 index 0000000000..c50b8b45cf --- /dev/null +++ b/__fixtures__/v-next/outputv2/cosmos/staking/v1beta1/tx.rpc.func.ts @@ -0,0 +1,50 @@ +import { buildTx } from "../../../helper-func-types"; +import { MsgCreateValidator, MsgEditValidator, MsgDelegate, MsgBeginRedelegate, MsgUndelegate } from "./tx"; +/** + * CreateValidator defines a method for creating a new validator. + * @name createValidator + * @package cosmos.staking.v1beta1 + * @see proto service: cosmos.staking.v1beta1.CreateValidator + */ +export const createValidator = buildTx({ + msg: MsgCreateValidator +}); +/** + * EditValidator defines a method for editing an existing validator. + * @name editValidator + * @package cosmos.staking.v1beta1 + * @see proto service: cosmos.staking.v1beta1.EditValidator + */ +export const editValidator = buildTx({ + msg: MsgEditValidator +}); +/** + * Delegate defines a method for performing a delegation of coins + * from a delegator to a validator. + * @name delegate + * @package cosmos.staking.v1beta1 + * @see proto service: cosmos.staking.v1beta1.Delegate + */ +export const delegate = buildTx({ + msg: MsgDelegate +}); +/** + * BeginRedelegate defines a method for performing a redelegation + * of coins from a delegator and source validator to a destination validator. + * @name beginRedelegate + * @package cosmos.staking.v1beta1 + * @see proto service: cosmos.staking.v1beta1.BeginRedelegate + */ +export const beginRedelegate = buildTx({ + msg: MsgBeginRedelegate +}); +/** + * Undelegate defines a method for performing an undelegation from a + * delegate and a validator. + * @name undelegate + * @package cosmos.staking.v1beta1 + * @see proto service: cosmos.staking.v1beta1.Undelegate + */ +export const undelegate = buildTx({ + msg: MsgUndelegate +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/cosmos/staking/v1beta1/tx.ts b/__fixtures__/v-next/outputv2/cosmos/staking/v1beta1/tx.ts index 4700f8a32f..1f8d72d2a2 100644 --- a/__fixtures__/v-next/outputv2/cosmos/staking/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputv2/cosmos/staking/v1beta1/tx.ts @@ -3,11 +3,11 @@ import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../google/protobuf import { Coin, CoinAmino, CoinSDKType } from "../../base/v1beta1/coin"; import { Timestamp } from "../../../google/protobuf/timestamp"; import { BinaryReader, BinaryWriter } from "../../../binary"; +import { GlobalDecoderRegistry } from "../../../registry"; import { isSet, DeepPartial, toTimestamp, fromTimestamp } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; -import { encodePubkey, decodePubkey } from "@cosmjs/proto-signing"; -import { Decimal } from "@cosmjs/math"; -import { Pubkey } from "@cosmjs/amino"; +import { encodePubkey, decodePubkey } from "@interchainjs/pubkey"; +import { Decimal } from "@interchainjs/math"; export const protobufPackage = "cosmos.staking.v1beta1"; /** * MsgCreateValidator defines a SDK message for creating a new validator. @@ -433,6 +433,15 @@ function createBaseMsgCreateValidator(): MsgCreateValidator { export const MsgCreateValidator = { typeUrl: "/cosmos.staking.v1beta1.MsgCreateValidator", aminoType: "cosmos-sdk/MsgCreateValidator", + is(o: any): o is MsgCreateValidator { + return o && (o.$typeUrl === MsgCreateValidator.typeUrl || Description.is(o.description) && CommissionRates.is(o.commission) && typeof o.minSelfDelegation === "string" && typeof o.delegatorAddress === "string" && typeof o.validatorAddress === "string" && Coin.is(o.value)); + }, + isSDK(o: any): o is MsgCreateValidatorSDKType { + return o && (o.$typeUrl === MsgCreateValidator.typeUrl || Description.isSDK(o.description) && CommissionRates.isSDK(o.commission) && typeof o.min_self_delegation === "string" && typeof o.delegator_address === "string" && typeof o.validator_address === "string" && Coin.isSDK(o.value)); + }, + isAmino(o: any): o is MsgCreateValidatorAmino { + return o && (o.$typeUrl === MsgCreateValidator.typeUrl || Description.isAmino(o.description) && CommissionRates.isAmino(o.commission) && typeof o.min_self_delegation === "string" && typeof o.delegator_address === "string" && typeof o.validator_address === "string" && Coin.isAmino(o.value)); + }, encode(message: MsgCreateValidator, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.description !== undefined) { Description.encode(message.description, writer.uint32(10).fork()).ldelim(); @@ -450,7 +459,7 @@ export const MsgCreateValidator = { writer.uint32(42).string(message.validatorAddress); } if (message.pubkey !== undefined) { - Any.encode((message.pubkey as Any), writer.uint32(50).fork()).ldelim(); + Any.encode(GlobalDecoderRegistry.wrapAny(message.pubkey), writer.uint32(50).fork()).ldelim(); } if (message.value !== undefined) { Coin.encode(message.value, writer.uint32(58).fork()).ldelim(); @@ -480,7 +489,7 @@ export const MsgCreateValidator = { message.validatorAddress = reader.string(); break; case 6: - message.pubkey = (Cosmos_cryptoPubKey_InterfaceDecoder(reader) as Any); + message.pubkey = GlobalDecoderRegistry.unwrapAny(reader); break; case 7: message.value = Coin.decode(reader, reader.uint32()); @@ -499,7 +508,7 @@ export const MsgCreateValidator = { if (isSet(object.minSelfDelegation)) obj.minSelfDelegation = String(object.minSelfDelegation); if (isSet(object.delegatorAddress)) obj.delegatorAddress = String(object.delegatorAddress); if (isSet(object.validatorAddress)) obj.validatorAddress = String(object.validatorAddress); - if (isSet(object.pubkey)) obj.pubkey = Any.fromJSON(object.pubkey); + if (isSet(object.pubkey)) obj.pubkey = GlobalDecoderRegistry.fromJSON(object.pubkey); if (isSet(object.value)) obj.value = Coin.fromJSON(object.value); return obj; }, @@ -510,7 +519,7 @@ export const MsgCreateValidator = { message.minSelfDelegation !== undefined && (obj.minSelfDelegation = message.minSelfDelegation); message.delegatorAddress !== undefined && (obj.delegatorAddress = message.delegatorAddress); message.validatorAddress !== undefined && (obj.validatorAddress = message.validatorAddress); - message.pubkey !== undefined && (obj.pubkey = message.pubkey ? Any.toJSON(message.pubkey) : undefined); + message.pubkey !== undefined && (obj.pubkey = message.pubkey ? GlobalDecoderRegistry.toJSON(message.pubkey) : undefined); message.value !== undefined && (obj.value = message.value ? Coin.toJSON(message.value) : undefined); return obj; }, @@ -526,7 +535,7 @@ export const MsgCreateValidator = { message.delegatorAddress = object.delegatorAddress ?? ""; message.validatorAddress = object.validatorAddress ?? ""; if (object.pubkey !== undefined && object.pubkey !== null) { - message.pubkey = Any.fromPartial(object.pubkey); + message.pubkey = GlobalDecoderRegistry.fromPartial(object.pubkey); } if (object.value !== undefined && object.value !== null) { message.value = Coin.fromPartial(object.value); @@ -540,7 +549,7 @@ export const MsgCreateValidator = { minSelfDelegation: object?.min_self_delegation, delegatorAddress: object?.delegator_address, validatorAddress: object?.validator_address, - pubkey: object.pubkey ? Any.fromSDK(object.pubkey) : undefined, + pubkey: object.pubkey ? GlobalDecoderRegistry.fromSDK(object.pubkey) : undefined, value: object.value ? Coin.fromSDK(object.value) : undefined }; }, @@ -551,7 +560,7 @@ export const MsgCreateValidator = { obj.min_self_delegation = message.minSelfDelegation; obj.delegator_address = message.delegatorAddress; obj.validator_address = message.validatorAddress; - message.pubkey !== undefined && (obj.pubkey = message.pubkey ? Any.toSDK(message.pubkey) : undefined); + message.pubkey !== undefined && (obj.pubkey = message.pubkey ? GlobalDecoderRegistry.toSDK(message.pubkey) : undefined); message.value !== undefined && (obj.value = message.value ? Coin.toSDK(message.value) : undefined); return obj; }, @@ -611,6 +620,12 @@ export const MsgCreateValidator = { typeUrl: "/cosmos.staking.v1beta1.MsgCreateValidator", value: MsgCreateValidator.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgCreateValidator.typeUrl)) { + return; + } + Coin.registerTypeUrl(); } }; function createBaseMsgCreateValidatorResponse(): MsgCreateValidatorResponse { @@ -625,6 +640,15 @@ function createBaseMsgCreateValidatorResponse(): MsgCreateValidatorResponse { export const MsgCreateValidatorResponse = { typeUrl: "/cosmos.staking.v1beta1.MsgCreateValidatorResponse", aminoType: "cosmos-sdk/MsgCreateValidatorResponse", + is(o: any): o is MsgCreateValidatorResponse { + return o && o.$typeUrl === MsgCreateValidatorResponse.typeUrl; + }, + isSDK(o: any): o is MsgCreateValidatorResponseSDKType { + return o && o.$typeUrl === MsgCreateValidatorResponse.typeUrl; + }, + isAmino(o: any): o is MsgCreateValidatorResponseAmino { + return o && o.$typeUrl === MsgCreateValidatorResponse.typeUrl; + }, encode(_: MsgCreateValidatorResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -689,7 +713,8 @@ export const MsgCreateValidatorResponse = { typeUrl: "/cosmos.staking.v1beta1.MsgCreateValidatorResponse", value: MsgCreateValidatorResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgEditValidator(): MsgEditValidator { return { @@ -708,6 +733,15 @@ function createBaseMsgEditValidator(): MsgEditValidator { export const MsgEditValidator = { typeUrl: "/cosmos.staking.v1beta1.MsgEditValidator", aminoType: "cosmos-sdk/MsgEditValidator", + is(o: any): o is MsgEditValidator { + return o && (o.$typeUrl === MsgEditValidator.typeUrl || Description.is(o.description) && typeof o.validatorAddress === "string" && typeof o.commissionRate === "string" && typeof o.minSelfDelegation === "string"); + }, + isSDK(o: any): o is MsgEditValidatorSDKType { + return o && (o.$typeUrl === MsgEditValidator.typeUrl || Description.isSDK(o.description) && typeof o.validator_address === "string" && typeof o.commission_rate === "string" && typeof o.min_self_delegation === "string"); + }, + isAmino(o: any): o is MsgEditValidatorAmino { + return o && (o.$typeUrl === MsgEditValidator.typeUrl || Description.isAmino(o.description) && typeof o.validator_address === "string" && typeof o.commission_rate === "string" && typeof o.min_self_delegation === "string"); + }, encode(message: MsgEditValidator, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.description !== undefined) { Description.encode(message.description, writer.uint32(10).fork()).ldelim(); @@ -811,7 +845,7 @@ export const MsgEditValidator = { const obj: any = {}; obj.description = message.description ? Description.toAmino(message.description) : undefined; obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; - obj.commission_rate = message.commissionRate === "" ? undefined : message.commissionRate; + obj.commission_rate = message.commissionRate === "" ? undefined : Decimal.fromUserInput(message.commissionRate, 18).atomics; obj.min_self_delegation = message.minSelfDelegation === "" ? undefined : message.minSelfDelegation; return obj; }, @@ -835,6 +869,12 @@ export const MsgEditValidator = { typeUrl: "/cosmos.staking.v1beta1.MsgEditValidator", value: MsgEditValidator.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgEditValidator.typeUrl)) { + return; + } + Description.registerTypeUrl(); } }; function createBaseMsgEditValidatorResponse(): MsgEditValidatorResponse { @@ -849,6 +889,15 @@ function createBaseMsgEditValidatorResponse(): MsgEditValidatorResponse { export const MsgEditValidatorResponse = { typeUrl: "/cosmos.staking.v1beta1.MsgEditValidatorResponse", aminoType: "cosmos-sdk/MsgEditValidatorResponse", + is(o: any): o is MsgEditValidatorResponse { + return o && o.$typeUrl === MsgEditValidatorResponse.typeUrl; + }, + isSDK(o: any): o is MsgEditValidatorResponseSDKType { + return o && o.$typeUrl === MsgEditValidatorResponse.typeUrl; + }, + isAmino(o: any): o is MsgEditValidatorResponseAmino { + return o && o.$typeUrl === MsgEditValidatorResponse.typeUrl; + }, encode(_: MsgEditValidatorResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -913,7 +962,8 @@ export const MsgEditValidatorResponse = { typeUrl: "/cosmos.staking.v1beta1.MsgEditValidatorResponse", value: MsgEditValidatorResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgDelegate(): MsgDelegate { return { @@ -932,6 +982,15 @@ function createBaseMsgDelegate(): MsgDelegate { export const MsgDelegate = { typeUrl: "/cosmos.staking.v1beta1.MsgDelegate", aminoType: "cosmos-sdk/MsgDelegate", + is(o: any): o is MsgDelegate { + return o && (o.$typeUrl === MsgDelegate.typeUrl || typeof o.delegatorAddress === "string" && typeof o.validatorAddress === "string" && Coin.is(o.amount)); + }, + isSDK(o: any): o is MsgDelegateSDKType { + return o && (o.$typeUrl === MsgDelegate.typeUrl || typeof o.delegator_address === "string" && typeof o.validator_address === "string" && Coin.isSDK(o.amount)); + }, + isAmino(o: any): o is MsgDelegateAmino { + return o && (o.$typeUrl === MsgDelegate.typeUrl || typeof o.delegator_address === "string" && typeof o.validator_address === "string" && Coin.isAmino(o.amount)); + }, encode(message: MsgDelegate, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.delegatorAddress !== "") { writer.uint32(10).string(message.delegatorAddress); @@ -1044,6 +1103,12 @@ export const MsgDelegate = { typeUrl: "/cosmos.staking.v1beta1.MsgDelegate", value: MsgDelegate.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgDelegate.typeUrl)) { + return; + } + Coin.registerTypeUrl(); } }; function createBaseMsgDelegateResponse(): MsgDelegateResponse { @@ -1058,6 +1123,15 @@ function createBaseMsgDelegateResponse(): MsgDelegateResponse { export const MsgDelegateResponse = { typeUrl: "/cosmos.staking.v1beta1.MsgDelegateResponse", aminoType: "cosmos-sdk/MsgDelegateResponse", + is(o: any): o is MsgDelegateResponse { + return o && o.$typeUrl === MsgDelegateResponse.typeUrl; + }, + isSDK(o: any): o is MsgDelegateResponseSDKType { + return o && o.$typeUrl === MsgDelegateResponse.typeUrl; + }, + isAmino(o: any): o is MsgDelegateResponseAmino { + return o && o.$typeUrl === MsgDelegateResponse.typeUrl; + }, encode(_: MsgDelegateResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -1122,7 +1196,8 @@ export const MsgDelegateResponse = { typeUrl: "/cosmos.staking.v1beta1.MsgDelegateResponse", value: MsgDelegateResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgBeginRedelegate(): MsgBeginRedelegate { return { @@ -1142,6 +1217,15 @@ function createBaseMsgBeginRedelegate(): MsgBeginRedelegate { export const MsgBeginRedelegate = { typeUrl: "/cosmos.staking.v1beta1.MsgBeginRedelegate", aminoType: "cosmos-sdk/MsgBeginRedelegate", + is(o: any): o is MsgBeginRedelegate { + return o && (o.$typeUrl === MsgBeginRedelegate.typeUrl || typeof o.delegatorAddress === "string" && typeof o.validatorSrcAddress === "string" && typeof o.validatorDstAddress === "string" && Coin.is(o.amount)); + }, + isSDK(o: any): o is MsgBeginRedelegateSDKType { + return o && (o.$typeUrl === MsgBeginRedelegate.typeUrl || typeof o.delegator_address === "string" && typeof o.validator_src_address === "string" && typeof o.validator_dst_address === "string" && Coin.isSDK(o.amount)); + }, + isAmino(o: any): o is MsgBeginRedelegateAmino { + return o && (o.$typeUrl === MsgBeginRedelegate.typeUrl || typeof o.delegator_address === "string" && typeof o.validator_src_address === "string" && typeof o.validator_dst_address === "string" && Coin.isAmino(o.amount)); + }, encode(message: MsgBeginRedelegate, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.delegatorAddress !== "") { writer.uint32(10).string(message.delegatorAddress); @@ -1269,6 +1353,12 @@ export const MsgBeginRedelegate = { typeUrl: "/cosmos.staking.v1beta1.MsgBeginRedelegate", value: MsgBeginRedelegate.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgBeginRedelegate.typeUrl)) { + return; + } + Coin.registerTypeUrl(); } }; function createBaseMsgBeginRedelegateResponse(): MsgBeginRedelegateResponse { @@ -1285,6 +1375,15 @@ function createBaseMsgBeginRedelegateResponse(): MsgBeginRedelegateResponse { export const MsgBeginRedelegateResponse = { typeUrl: "/cosmos.staking.v1beta1.MsgBeginRedelegateResponse", aminoType: "cosmos-sdk/MsgBeginRedelegateResponse", + is(o: any): o is MsgBeginRedelegateResponse { + return o && (o.$typeUrl === MsgBeginRedelegateResponse.typeUrl || Timestamp.is(o.completionTime)); + }, + isSDK(o: any): o is MsgBeginRedelegateResponseSDKType { + return o && (o.$typeUrl === MsgBeginRedelegateResponse.typeUrl || Timestamp.isSDK(o.completion_time)); + }, + isAmino(o: any): o is MsgBeginRedelegateResponseAmino { + return o && (o.$typeUrl === MsgBeginRedelegateResponse.typeUrl || Timestamp.isAmino(o.completion_time)); + }, encode(message: MsgBeginRedelegateResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.completionTime !== undefined) { Timestamp.encode(toTimestamp(message.completionTime), writer.uint32(10).fork()).ldelim(); @@ -1365,7 +1464,8 @@ export const MsgBeginRedelegateResponse = { typeUrl: "/cosmos.staking.v1beta1.MsgBeginRedelegateResponse", value: MsgBeginRedelegateResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgUndelegate(): MsgUndelegate { return { @@ -1384,6 +1484,15 @@ function createBaseMsgUndelegate(): MsgUndelegate { export const MsgUndelegate = { typeUrl: "/cosmos.staking.v1beta1.MsgUndelegate", aminoType: "cosmos-sdk/MsgUndelegate", + is(o: any): o is MsgUndelegate { + return o && (o.$typeUrl === MsgUndelegate.typeUrl || typeof o.delegatorAddress === "string" && typeof o.validatorAddress === "string" && Coin.is(o.amount)); + }, + isSDK(o: any): o is MsgUndelegateSDKType { + return o && (o.$typeUrl === MsgUndelegate.typeUrl || typeof o.delegator_address === "string" && typeof o.validator_address === "string" && Coin.isSDK(o.amount)); + }, + isAmino(o: any): o is MsgUndelegateAmino { + return o && (o.$typeUrl === MsgUndelegate.typeUrl || typeof o.delegator_address === "string" && typeof o.validator_address === "string" && Coin.isAmino(o.amount)); + }, encode(message: MsgUndelegate, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.delegatorAddress !== "") { writer.uint32(10).string(message.delegatorAddress); @@ -1496,6 +1605,12 @@ export const MsgUndelegate = { typeUrl: "/cosmos.staking.v1beta1.MsgUndelegate", value: MsgUndelegate.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgUndelegate.typeUrl)) { + return; + } + Coin.registerTypeUrl(); } }; function createBaseMsgUndelegateResponse(): MsgUndelegateResponse { @@ -1512,6 +1627,15 @@ function createBaseMsgUndelegateResponse(): MsgUndelegateResponse { export const MsgUndelegateResponse = { typeUrl: "/cosmos.staking.v1beta1.MsgUndelegateResponse", aminoType: "cosmos-sdk/MsgUndelegateResponse", + is(o: any): o is MsgUndelegateResponse { + return o && (o.$typeUrl === MsgUndelegateResponse.typeUrl || Timestamp.is(o.completionTime)); + }, + isSDK(o: any): o is MsgUndelegateResponseSDKType { + return o && (o.$typeUrl === MsgUndelegateResponse.typeUrl || Timestamp.isSDK(o.completion_time)); + }, + isAmino(o: any): o is MsgUndelegateResponseAmino { + return o && (o.$typeUrl === MsgUndelegateResponse.typeUrl || Timestamp.isAmino(o.completion_time)); + }, encode(message: MsgUndelegateResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.completionTime !== undefined) { Timestamp.encode(toTimestamp(message.completionTime), writer.uint32(10).fork()).ldelim(); @@ -1592,19 +1716,6 @@ export const MsgUndelegateResponse = { typeUrl: "/cosmos.staking.v1beta1.MsgUndelegateResponse", value: MsgUndelegateResponse.encode(message).finish() }; - } -}; -export const Cosmos_cryptoPubKey_InterfaceDecoder = (input: BinaryReader | Uint8Array): Any => { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - const data = Any.decode(reader, reader.uint32()); - switch (data.typeUrl) { - default: - return data; - } -}; -export const Cosmos_cryptoPubKey_FromAmino = (content: AnyAmino): Any => { - return encodePubkey(content); -}; -export const Cosmos_cryptoPubKey_ToAmino = (content: Any): Pubkey | null => { - return decodePubkey(content); + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/cosmos/tx/signing/v1beta1/signing.ts b/__fixtures__/v-next/outputv2/cosmos/tx/signing/v1beta1/signing.ts index 3b2050a8f7..84bf03abc5 100644 --- a/__fixtures__/v-next/outputv2/cosmos/tx/signing/v1beta1/signing.ts +++ b/__fixtures__/v-next/outputv2/cosmos/tx/signing/v1beta1/signing.ts @@ -3,6 +3,7 @@ import { Any, AnyAmino, AnySDKType } from "../../../../google/protobuf/any"; import { BinaryReader, BinaryWriter } from "../../../../binary"; import { JsonSafe } from "../../../../json-safe"; import { DeepPartial, isSet, bytesFromBase64, base64FromBytes } from "../../../../helpers"; +import { GlobalDecoderRegistry } from "../../../../registry"; export const protobufPackage = "cosmos.tx.signing.v1beta1"; /** * SignMode represents a signing mode with its own security guarantees. @@ -360,6 +361,15 @@ function createBaseSignatureDescriptors(): SignatureDescriptors { export const SignatureDescriptors = { typeUrl: "/cosmos.tx.signing.v1beta1.SignatureDescriptors", aminoType: "cosmos-sdk/SignatureDescriptors", + is(o: any): o is SignatureDescriptors { + return o && (o.$typeUrl === SignatureDescriptors.typeUrl || Array.isArray(o.signatures) && (!o.signatures.length || SignatureDescriptor.is(o.signatures[0]))); + }, + isSDK(o: any): o is SignatureDescriptorsSDKType { + return o && (o.$typeUrl === SignatureDescriptors.typeUrl || Array.isArray(o.signatures) && (!o.signatures.length || SignatureDescriptor.isSDK(o.signatures[0]))); + }, + isAmino(o: any): o is SignatureDescriptorsAmino { + return o && (o.$typeUrl === SignatureDescriptors.typeUrl || Array.isArray(o.signatures) && (!o.signatures.length || SignatureDescriptor.isAmino(o.signatures[0]))); + }, encode(message: SignatureDescriptors, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.signatures) { SignatureDescriptor.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -450,6 +460,12 @@ export const SignatureDescriptors = { typeUrl: "/cosmos.tx.signing.v1beta1.SignatureDescriptors", value: SignatureDescriptors.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(SignatureDescriptors.typeUrl)) { + return; + } + SignatureDescriptor.registerTypeUrl(); } }; function createBaseSignatureDescriptor(): SignatureDescriptor { @@ -471,6 +487,15 @@ function createBaseSignatureDescriptor(): SignatureDescriptor { export const SignatureDescriptor = { typeUrl: "/cosmos.tx.signing.v1beta1.SignatureDescriptor", aminoType: "cosmos-sdk/SignatureDescriptor", + is(o: any): o is SignatureDescriptor { + return o && (o.$typeUrl === SignatureDescriptor.typeUrl || typeof o.sequence === "bigint"); + }, + isSDK(o: any): o is SignatureDescriptorSDKType { + return o && (o.$typeUrl === SignatureDescriptor.typeUrl || typeof o.sequence === "bigint"); + }, + isAmino(o: any): o is SignatureDescriptorAmino { + return o && (o.$typeUrl === SignatureDescriptor.typeUrl || typeof o.sequence === "bigint"); + }, encode(message: SignatureDescriptor, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.publicKey !== undefined) { Any.encode(message.publicKey, writer.uint32(10).fork()).ldelim(); @@ -587,6 +612,12 @@ export const SignatureDescriptor = { typeUrl: "/cosmos.tx.signing.v1beta1.SignatureDescriptor", value: SignatureDescriptor.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(SignatureDescriptor.typeUrl)) { + return; + } + SignatureDescriptor_Data.registerTypeUrl(); } }; function createBaseSignatureDescriptor_Data(): SignatureDescriptor_Data { @@ -604,6 +635,15 @@ function createBaseSignatureDescriptor_Data(): SignatureDescriptor_Data { export const SignatureDescriptor_Data = { typeUrl: "/cosmos.tx.signing.v1beta1.Data", aminoType: "cosmos-sdk/Data", + is(o: any): o is SignatureDescriptor_Data { + return o && o.$typeUrl === SignatureDescriptor_Data.typeUrl; + }, + isSDK(o: any): o is SignatureDescriptor_DataSDKType { + return o && o.$typeUrl === SignatureDescriptor_Data.typeUrl; + }, + isAmino(o: any): o is SignatureDescriptor_DataAmino { + return o && o.$typeUrl === SignatureDescriptor_Data.typeUrl; + }, encode(message: SignatureDescriptor_Data, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.single !== undefined) { SignatureDescriptor_Data_Single.encode(message.single, writer.uint32(10).fork()).ldelim(); @@ -703,6 +743,13 @@ export const SignatureDescriptor_Data = { typeUrl: "/cosmos.tx.signing.v1beta1.Data", value: SignatureDescriptor_Data.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(SignatureDescriptor_Data.typeUrl)) { + return; + } + SignatureDescriptor_Data_Single.registerTypeUrl(); + SignatureDescriptor_Data_Multi.registerTypeUrl(); } }; function createBaseSignatureDescriptor_Data_Single(): SignatureDescriptor_Data_Single { @@ -720,6 +767,15 @@ function createBaseSignatureDescriptor_Data_Single(): SignatureDescriptor_Data_S export const SignatureDescriptor_Data_Single = { typeUrl: "/cosmos.tx.signing.v1beta1.Single", aminoType: "cosmos-sdk/Single", + is(o: any): o is SignatureDescriptor_Data_Single { + return o && (o.$typeUrl === SignatureDescriptor_Data_Single.typeUrl || isSet(o.mode) && (o.signature instanceof Uint8Array || typeof o.signature === "string")); + }, + isSDK(o: any): o is SignatureDescriptor_Data_SingleSDKType { + return o && (o.$typeUrl === SignatureDescriptor_Data_Single.typeUrl || isSet(o.mode) && (o.signature instanceof Uint8Array || typeof o.signature === "string")); + }, + isAmino(o: any): o is SignatureDescriptor_Data_SingleAmino { + return o && (o.$typeUrl === SignatureDescriptor_Data_Single.typeUrl || isSet(o.mode) && (o.signature instanceof Uint8Array || typeof o.signature === "string")); + }, encode(message: SignatureDescriptor_Data_Single, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.mode !== 0) { writer.uint32(8).int32(message.mode); @@ -815,7 +871,8 @@ export const SignatureDescriptor_Data_Single = { typeUrl: "/cosmos.tx.signing.v1beta1.Single", value: SignatureDescriptor_Data_Single.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseSignatureDescriptor_Data_Multi(): SignatureDescriptor_Data_Multi { return { @@ -832,6 +889,15 @@ function createBaseSignatureDescriptor_Data_Multi(): SignatureDescriptor_Data_Mu export const SignatureDescriptor_Data_Multi = { typeUrl: "/cosmos.tx.signing.v1beta1.Multi", aminoType: "cosmos-sdk/Multi", + is(o: any): o is SignatureDescriptor_Data_Multi { + return o && (o.$typeUrl === SignatureDescriptor_Data_Multi.typeUrl || Array.isArray(o.signatures) && (!o.signatures.length || SignatureDescriptor_Data.is(o.signatures[0]))); + }, + isSDK(o: any): o is SignatureDescriptor_Data_MultiSDKType { + return o && (o.$typeUrl === SignatureDescriptor_Data_Multi.typeUrl || Array.isArray(o.signatures) && (!o.signatures.length || SignatureDescriptor_Data.isSDK(o.signatures[0]))); + }, + isAmino(o: any): o is SignatureDescriptor_Data_MultiAmino { + return o && (o.$typeUrl === SignatureDescriptor_Data_Multi.typeUrl || Array.isArray(o.signatures) && (!o.signatures.length || SignatureDescriptor_Data.isAmino(o.signatures[0]))); + }, encode(message: SignatureDescriptor_Data_Multi, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.bitarray !== undefined) { CompactBitArray.encode(message.bitarray, writer.uint32(10).fork()).ldelim(); @@ -939,5 +1005,12 @@ export const SignatureDescriptor_Data_Multi = { typeUrl: "/cosmos.tx.signing.v1beta1.Multi", value: SignatureDescriptor_Data_Multi.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(SignatureDescriptor_Data_Multi.typeUrl)) { + return; + } + CompactBitArray.registerTypeUrl(); + SignatureDescriptor_Data.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/cosmos/tx/v1beta1/service.rpc.func.ts b/__fixtures__/v-next/outputv2/cosmos/tx/v1beta1/service.rpc.func.ts new file mode 100644 index 0000000000..a4342c334a --- /dev/null +++ b/__fixtures__/v-next/outputv2/cosmos/tx/v1beta1/service.rpc.func.ts @@ -0,0 +1,69 @@ +import { buildQuery } from "../../../helper-func-types"; +import { SimulateRequest, SimulateResponse, GetTxRequest, GetTxResponse, BroadcastTxRequest, BroadcastTxResponse, GetTxsEventRequest, GetTxsEventResponse, GetBlockWithTxsRequest, GetBlockWithTxsResponse } from "./service"; +/** + * Simulate simulates executing a transaction for estimating gas usage. + * @name getSimulate + * @package cosmos.tx.v1beta1 + * @see proto service: cosmos.tx.v1beta1.Simulate + */ +export const getSimulate = buildQuery({ + encode: SimulateRequest.encode, + decode: SimulateResponse.decode, + service: "cosmos.tx.v1beta1.Service", + method: "Simulate", + deps: [SimulateRequest, SimulateResponse] +}); +/** + * GetTx fetches a tx by hash. + * @name getGetTx + * @package cosmos.tx.v1beta1 + * @see proto service: cosmos.tx.v1beta1.GetTx + */ +export const getGetTx = buildQuery({ + encode: GetTxRequest.encode, + decode: GetTxResponse.decode, + service: "cosmos.tx.v1beta1.Service", + method: "GetTx", + deps: [GetTxRequest, GetTxResponse] +}); +/** + * BroadcastTx broadcast transaction. + * @name getBroadcastTx + * @package cosmos.tx.v1beta1 + * @see proto service: cosmos.tx.v1beta1.BroadcastTx + */ +export const getBroadcastTx = buildQuery({ + encode: BroadcastTxRequest.encode, + decode: BroadcastTxResponse.decode, + service: "cosmos.tx.v1beta1.Service", + method: "BroadcastTx", + deps: [BroadcastTxRequest, BroadcastTxResponse] +}); +/** + * GetTxsEvent fetches txs by event. + * @name getGetTxsEvent + * @package cosmos.tx.v1beta1 + * @see proto service: cosmos.tx.v1beta1.GetTxsEvent + */ +export const getGetTxsEvent = buildQuery({ + encode: GetTxsEventRequest.encode, + decode: GetTxsEventResponse.decode, + service: "cosmos.tx.v1beta1.Service", + method: "GetTxsEvent", + deps: [GetTxsEventRequest, GetTxsEventResponse] +}); +/** + * GetBlockWithTxs fetches a block with decoded txs. + * + * Since: cosmos-sdk 0.45.2 + * @name getGetBlockWithTxs + * @package cosmos.tx.v1beta1 + * @see proto service: cosmos.tx.v1beta1.GetBlockWithTxs + */ +export const getGetBlockWithTxs = buildQuery({ + encode: GetBlockWithTxsRequest.encode, + decode: GetBlockWithTxsResponse.decode, + service: "cosmos.tx.v1beta1.Service", + method: "GetBlockWithTxs", + deps: [GetBlockWithTxsRequest, GetBlockWithTxsResponse] +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/cosmos/tx/v1beta1/service.ts b/__fixtures__/v-next/outputv2/cosmos/tx/v1beta1/service.ts index f710124d52..04400a57d7 100644 --- a/__fixtures__/v-next/outputv2/cosmos/tx/v1beta1/service.ts +++ b/__fixtures__/v-next/outputv2/cosmos/tx/v1beta1/service.ts @@ -3,8 +3,9 @@ import { PageRequest, PageRequestAmino, PageRequestSDKType, PageResponse, PageRe import { TxResponse, TxResponseAmino, TxResponseSDKType, GasInfo, GasInfoAmino, GasInfoSDKType, Result, ResultAmino, ResultSDKType } from "../../base/abci/v1beta1/abci"; import { BlockID, BlockIDAmino, BlockIDSDKType } from "../../../tendermint/types/types"; import { Block, BlockAmino, BlockSDKType } from "../../../tendermint/types/block"; -import { BinaryReader, BinaryWriter } from "../../../binary"; import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../helpers"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { GlobalDecoderRegistry } from "../../../registry"; import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "cosmos.tx.v1beta1"; /** OrderBy defines the sorting order */ @@ -665,6 +666,15 @@ function createBaseGetTxsEventRequest(): GetTxsEventRequest { export const GetTxsEventRequest = { typeUrl: "/cosmos.tx.v1beta1.GetTxsEventRequest", aminoType: "cosmos-sdk/GetTxsEventRequest", + is(o: any): o is GetTxsEventRequest { + return o && (o.$typeUrl === GetTxsEventRequest.typeUrl || Array.isArray(o.events) && (!o.events.length || typeof o.events[0] === "string") && isSet(o.orderBy)); + }, + isSDK(o: any): o is GetTxsEventRequestSDKType { + return o && (o.$typeUrl === GetTxsEventRequest.typeUrl || Array.isArray(o.events) && (!o.events.length || typeof o.events[0] === "string") && isSet(o.order_by)); + }, + isAmino(o: any): o is GetTxsEventRequestAmino { + return o && (o.$typeUrl === GetTxsEventRequest.typeUrl || Array.isArray(o.events) && (!o.events.length || typeof o.events[0] === "string") && isSet(o.order_by)); + }, encode(message: GetTxsEventRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.events) { writer.uint32(10).string(v!); @@ -787,6 +797,12 @@ export const GetTxsEventRequest = { typeUrl: "/cosmos.tx.v1beta1.GetTxsEventRequest", value: GetTxsEventRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GetTxsEventRequest.typeUrl)) { + return; + } + PageRequest.registerTypeUrl(); } }; function createBaseGetTxsEventResponse(): GetTxsEventResponse { @@ -806,6 +822,15 @@ function createBaseGetTxsEventResponse(): GetTxsEventResponse { export const GetTxsEventResponse = { typeUrl: "/cosmos.tx.v1beta1.GetTxsEventResponse", aminoType: "cosmos-sdk/GetTxsEventResponse", + is(o: any): o is GetTxsEventResponse { + return o && (o.$typeUrl === GetTxsEventResponse.typeUrl || Array.isArray(o.txs) && (!o.txs.length || Tx.is(o.txs[0])) && Array.isArray(o.txResponses) && (!o.txResponses.length || TxResponse.is(o.txResponses[0]))); + }, + isSDK(o: any): o is GetTxsEventResponseSDKType { + return o && (o.$typeUrl === GetTxsEventResponse.typeUrl || Array.isArray(o.txs) && (!o.txs.length || Tx.isSDK(o.txs[0])) && Array.isArray(o.tx_responses) && (!o.tx_responses.length || TxResponse.isSDK(o.tx_responses[0]))); + }, + isAmino(o: any): o is GetTxsEventResponseAmino { + return o && (o.$typeUrl === GetTxsEventResponse.typeUrl || Array.isArray(o.txs) && (!o.txs.length || Tx.isAmino(o.txs[0])) && Array.isArray(o.tx_responses) && (!o.tx_responses.length || TxResponse.isAmino(o.tx_responses[0]))); + }, encode(message: GetTxsEventResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.txs) { Tx.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -938,6 +963,14 @@ export const GetTxsEventResponse = { typeUrl: "/cosmos.tx.v1beta1.GetTxsEventResponse", value: GetTxsEventResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GetTxsEventResponse.typeUrl)) { + return; + } + Tx.registerTypeUrl(); + TxResponse.registerTypeUrl(); + PageResponse.registerTypeUrl(); } }; function createBaseBroadcastTxRequest(): BroadcastTxRequest { @@ -956,6 +989,15 @@ function createBaseBroadcastTxRequest(): BroadcastTxRequest { export const BroadcastTxRequest = { typeUrl: "/cosmos.tx.v1beta1.BroadcastTxRequest", aminoType: "cosmos-sdk/BroadcastTxRequest", + is(o: any): o is BroadcastTxRequest { + return o && (o.$typeUrl === BroadcastTxRequest.typeUrl || (o.txBytes instanceof Uint8Array || typeof o.txBytes === "string") && isSet(o.mode)); + }, + isSDK(o: any): o is BroadcastTxRequestSDKType { + return o && (o.$typeUrl === BroadcastTxRequest.typeUrl || (o.tx_bytes instanceof Uint8Array || typeof o.tx_bytes === "string") && isSet(o.mode)); + }, + isAmino(o: any): o is BroadcastTxRequestAmino { + return o && (o.$typeUrl === BroadcastTxRequest.typeUrl || (o.tx_bytes instanceof Uint8Array || typeof o.tx_bytes === "string") && isSet(o.mode)); + }, encode(message: BroadcastTxRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.txBytes.length !== 0) { writer.uint32(10).bytes(message.txBytes); @@ -1051,7 +1093,8 @@ export const BroadcastTxRequest = { typeUrl: "/cosmos.tx.v1beta1.BroadcastTxRequest", value: BroadcastTxRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseBroadcastTxResponse(): BroadcastTxResponse { return { @@ -1068,6 +1111,15 @@ function createBaseBroadcastTxResponse(): BroadcastTxResponse { export const BroadcastTxResponse = { typeUrl: "/cosmos.tx.v1beta1.BroadcastTxResponse", aminoType: "cosmos-sdk/BroadcastTxResponse", + is(o: any): o is BroadcastTxResponse { + return o && o.$typeUrl === BroadcastTxResponse.typeUrl; + }, + isSDK(o: any): o is BroadcastTxResponseSDKType { + return o && o.$typeUrl === BroadcastTxResponse.typeUrl; + }, + isAmino(o: any): o is BroadcastTxResponseAmino { + return o && o.$typeUrl === BroadcastTxResponse.typeUrl; + }, encode(message: BroadcastTxResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.txResponse !== undefined) { TxResponse.encode(message.txResponse, writer.uint32(10).fork()).ldelim(); @@ -1150,6 +1202,12 @@ export const BroadcastTxResponse = { typeUrl: "/cosmos.tx.v1beta1.BroadcastTxResponse", value: BroadcastTxResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(BroadcastTxResponse.typeUrl)) { + return; + } + TxResponse.registerTypeUrl(); } }; function createBaseSimulateRequest(): SimulateRequest { @@ -1168,6 +1226,15 @@ function createBaseSimulateRequest(): SimulateRequest { export const SimulateRequest = { typeUrl: "/cosmos.tx.v1beta1.SimulateRequest", aminoType: "cosmos-sdk/SimulateRequest", + is(o: any): o is SimulateRequest { + return o && (o.$typeUrl === SimulateRequest.typeUrl || o.txBytes instanceof Uint8Array || typeof o.txBytes === "string"); + }, + isSDK(o: any): o is SimulateRequestSDKType { + return o && (o.$typeUrl === SimulateRequest.typeUrl || o.tx_bytes instanceof Uint8Array || typeof o.tx_bytes === "string"); + }, + isAmino(o: any): o is SimulateRequestAmino { + return o && (o.$typeUrl === SimulateRequest.typeUrl || o.tx_bytes instanceof Uint8Array || typeof o.tx_bytes === "string"); + }, encode(message: SimulateRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.tx !== undefined) { Tx.encode(message.tx, writer.uint32(10).fork()).ldelim(); @@ -1265,6 +1332,12 @@ export const SimulateRequest = { typeUrl: "/cosmos.tx.v1beta1.SimulateRequest", value: SimulateRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(SimulateRequest.typeUrl)) { + return; + } + Tx.registerTypeUrl(); } }; function createBaseSimulateResponse(): SimulateResponse { @@ -1283,6 +1356,15 @@ function createBaseSimulateResponse(): SimulateResponse { export const SimulateResponse = { typeUrl: "/cosmos.tx.v1beta1.SimulateResponse", aminoType: "cosmos-sdk/SimulateResponse", + is(o: any): o is SimulateResponse { + return o && o.$typeUrl === SimulateResponse.typeUrl; + }, + isSDK(o: any): o is SimulateResponseSDKType { + return o && o.$typeUrl === SimulateResponse.typeUrl; + }, + isAmino(o: any): o is SimulateResponseAmino { + return o && o.$typeUrl === SimulateResponse.typeUrl; + }, encode(message: SimulateResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.gasInfo !== undefined) { GasInfo.encode(message.gasInfo, writer.uint32(10).fork()).ldelim(); @@ -1382,6 +1464,13 @@ export const SimulateResponse = { typeUrl: "/cosmos.tx.v1beta1.SimulateResponse", value: SimulateResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(SimulateResponse.typeUrl)) { + return; + } + GasInfo.registerTypeUrl(); + Result.registerTypeUrl(); } }; function createBaseGetTxRequest(): GetTxRequest { @@ -1399,6 +1488,15 @@ function createBaseGetTxRequest(): GetTxRequest { export const GetTxRequest = { typeUrl: "/cosmos.tx.v1beta1.GetTxRequest", aminoType: "cosmos-sdk/GetTxRequest", + is(o: any): o is GetTxRequest { + return o && (o.$typeUrl === GetTxRequest.typeUrl || typeof o.hash === "string"); + }, + isSDK(o: any): o is GetTxRequestSDKType { + return o && (o.$typeUrl === GetTxRequest.typeUrl || typeof o.hash === "string"); + }, + isAmino(o: any): o is GetTxRequestAmino { + return o && (o.$typeUrl === GetTxRequest.typeUrl || typeof o.hash === "string"); + }, encode(message: GetTxRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.hash !== "") { writer.uint32(10).string(message.hash); @@ -1479,7 +1577,8 @@ export const GetTxRequest = { typeUrl: "/cosmos.tx.v1beta1.GetTxRequest", value: GetTxRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseGetTxResponse(): GetTxResponse { return { @@ -1496,6 +1595,15 @@ function createBaseGetTxResponse(): GetTxResponse { export const GetTxResponse = { typeUrl: "/cosmos.tx.v1beta1.GetTxResponse", aminoType: "cosmos-sdk/GetTxResponse", + is(o: any): o is GetTxResponse { + return o && o.$typeUrl === GetTxResponse.typeUrl; + }, + isSDK(o: any): o is GetTxResponseSDKType { + return o && o.$typeUrl === GetTxResponse.typeUrl; + }, + isAmino(o: any): o is GetTxResponseAmino { + return o && o.$typeUrl === GetTxResponse.typeUrl; + }, encode(message: GetTxResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.tx !== undefined) { Tx.encode(message.tx, writer.uint32(10).fork()).ldelim(); @@ -1595,6 +1703,13 @@ export const GetTxResponse = { typeUrl: "/cosmos.tx.v1beta1.GetTxResponse", value: GetTxResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GetTxResponse.typeUrl)) { + return; + } + Tx.registerTypeUrl(); + TxResponse.registerTypeUrl(); } }; function createBaseGetBlockWithTxsRequest(): GetBlockWithTxsRequest { @@ -1615,6 +1730,15 @@ function createBaseGetBlockWithTxsRequest(): GetBlockWithTxsRequest { export const GetBlockWithTxsRequest = { typeUrl: "/cosmos.tx.v1beta1.GetBlockWithTxsRequest", aminoType: "cosmos-sdk/GetBlockWithTxsRequest", + is(o: any): o is GetBlockWithTxsRequest { + return o && (o.$typeUrl === GetBlockWithTxsRequest.typeUrl || typeof o.height === "bigint"); + }, + isSDK(o: any): o is GetBlockWithTxsRequestSDKType { + return o && (o.$typeUrl === GetBlockWithTxsRequest.typeUrl || typeof o.height === "bigint"); + }, + isAmino(o: any): o is GetBlockWithTxsRequestAmino { + return o && (o.$typeUrl === GetBlockWithTxsRequest.typeUrl || typeof o.height === "bigint"); + }, encode(message: GetBlockWithTxsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.height !== BigInt(0)) { writer.uint32(8).int64(message.height); @@ -1714,6 +1838,12 @@ export const GetBlockWithTxsRequest = { typeUrl: "/cosmos.tx.v1beta1.GetBlockWithTxsRequest", value: GetBlockWithTxsRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GetBlockWithTxsRequest.typeUrl)) { + return; + } + PageRequest.registerTypeUrl(); } }; function createBaseGetBlockWithTxsResponse(): GetBlockWithTxsResponse { @@ -1735,6 +1865,15 @@ function createBaseGetBlockWithTxsResponse(): GetBlockWithTxsResponse { export const GetBlockWithTxsResponse = { typeUrl: "/cosmos.tx.v1beta1.GetBlockWithTxsResponse", aminoType: "cosmos-sdk/GetBlockWithTxsResponse", + is(o: any): o is GetBlockWithTxsResponse { + return o && (o.$typeUrl === GetBlockWithTxsResponse.typeUrl || Array.isArray(o.txs) && (!o.txs.length || Tx.is(o.txs[0]))); + }, + isSDK(o: any): o is GetBlockWithTxsResponseSDKType { + return o && (o.$typeUrl === GetBlockWithTxsResponse.typeUrl || Array.isArray(o.txs) && (!o.txs.length || Tx.isSDK(o.txs[0]))); + }, + isAmino(o: any): o is GetBlockWithTxsResponseAmino { + return o && (o.$typeUrl === GetBlockWithTxsResponse.typeUrl || Array.isArray(o.txs) && (!o.txs.length || Tx.isAmino(o.txs[0]))); + }, encode(message: GetBlockWithTxsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.txs) { Tx.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -1876,5 +2015,14 @@ export const GetBlockWithTxsResponse = { typeUrl: "/cosmos.tx.v1beta1.GetBlockWithTxsResponse", value: GetBlockWithTxsResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GetBlockWithTxsResponse.typeUrl)) { + return; + } + Tx.registerTypeUrl(); + BlockID.registerTypeUrl(); + Block.registerTypeUrl(); + PageResponse.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/cosmos/tx/v1beta1/tx.ts b/__fixtures__/v-next/outputv2/cosmos/tx/v1beta1/tx.ts index e3f1272cc0..b57d4cc0a5 100644 --- a/__fixtures__/v-next/outputv2/cosmos/tx/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputv2/cosmos/tx/v1beta1/tx.ts @@ -3,6 +3,7 @@ import { SignMode, signModeFromJSON, signModeToJSON } from "../signing/v1beta1/s import { CompactBitArray, CompactBitArrayAmino, CompactBitArraySDKType } from "../../crypto/multisig/v1beta1/multisig"; import { Coin, CoinAmino, CoinSDKType } from "../../base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; +import { GlobalDecoderRegistry } from "../../../registry"; import { isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "cosmos.tx.v1beta1"; @@ -978,6 +979,15 @@ function createBaseTx(): Tx { export const Tx = { typeUrl: "/cosmos.tx.v1beta1.Tx", aminoType: "cosmos-sdk/Tx", + is(o: any): o is Tx { + return o && (o.$typeUrl === Tx.typeUrl || Array.isArray(o.signatures) && (!o.signatures.length || o.signatures[0] instanceof Uint8Array || typeof o.signatures[0] === "string")); + }, + isSDK(o: any): o is TxSDKType { + return o && (o.$typeUrl === Tx.typeUrl || Array.isArray(o.signatures) && (!o.signatures.length || o.signatures[0] instanceof Uint8Array || typeof o.signatures[0] === "string")); + }, + isAmino(o: any): o is TxAmino { + return o && (o.$typeUrl === Tx.typeUrl || Array.isArray(o.signatures) && (!o.signatures.length || o.signatures[0] instanceof Uint8Array || typeof o.signatures[0] === "string")); + }, encode(message: Tx, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.body !== undefined) { TxBody.encode(message.body, writer.uint32(10).fork()).ldelim(); @@ -1102,6 +1112,13 @@ export const Tx = { typeUrl: "/cosmos.tx.v1beta1.Tx", value: Tx.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Tx.typeUrl)) { + return; + } + TxBody.registerTypeUrl(); + AuthInfo.registerTypeUrl(); } }; function createBaseTxRaw(): TxRaw { @@ -1124,6 +1141,15 @@ function createBaseTxRaw(): TxRaw { export const TxRaw = { typeUrl: "/cosmos.tx.v1beta1.TxRaw", aminoType: "cosmos-sdk/TxRaw", + is(o: any): o is TxRaw { + return o && (o.$typeUrl === TxRaw.typeUrl || (o.bodyBytes instanceof Uint8Array || typeof o.bodyBytes === "string") && (o.authInfoBytes instanceof Uint8Array || typeof o.authInfoBytes === "string") && Array.isArray(o.signatures) && (!o.signatures.length || o.signatures[0] instanceof Uint8Array || typeof o.signatures[0] === "string")); + }, + isSDK(o: any): o is TxRawSDKType { + return o && (o.$typeUrl === TxRaw.typeUrl || (o.body_bytes instanceof Uint8Array || typeof o.body_bytes === "string") && (o.auth_info_bytes instanceof Uint8Array || typeof o.auth_info_bytes === "string") && Array.isArray(o.signatures) && (!o.signatures.length || o.signatures[0] instanceof Uint8Array || typeof o.signatures[0] === "string")); + }, + isAmino(o: any): o is TxRawAmino { + return o && (o.$typeUrl === TxRaw.typeUrl || (o.body_bytes instanceof Uint8Array || typeof o.body_bytes === "string") && (o.auth_info_bytes instanceof Uint8Array || typeof o.auth_info_bytes === "string") && Array.isArray(o.signatures) && (!o.signatures.length || o.signatures[0] instanceof Uint8Array || typeof o.signatures[0] === "string")); + }, encode(message: TxRaw, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.bodyBytes.length !== 0) { writer.uint32(10).bytes(message.bodyBytes); @@ -1244,7 +1270,8 @@ export const TxRaw = { typeUrl: "/cosmos.tx.v1beta1.TxRaw", value: TxRaw.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseSignDoc(): SignDoc { return { @@ -1263,6 +1290,15 @@ function createBaseSignDoc(): SignDoc { export const SignDoc = { typeUrl: "/cosmos.tx.v1beta1.SignDoc", aminoType: "cosmos-sdk/SignDoc", + is(o: any): o is SignDoc { + return o && (o.$typeUrl === SignDoc.typeUrl || (o.bodyBytes instanceof Uint8Array || typeof o.bodyBytes === "string") && (o.authInfoBytes instanceof Uint8Array || typeof o.authInfoBytes === "string") && typeof o.chainId === "string" && typeof o.accountNumber === "bigint"); + }, + isSDK(o: any): o is SignDocSDKType { + return o && (o.$typeUrl === SignDoc.typeUrl || (o.body_bytes instanceof Uint8Array || typeof o.body_bytes === "string") && (o.auth_info_bytes instanceof Uint8Array || typeof o.auth_info_bytes === "string") && typeof o.chain_id === "string" && typeof o.account_number === "bigint"); + }, + isAmino(o: any): o is SignDocAmino { + return o && (o.$typeUrl === SignDoc.typeUrl || (o.body_bytes instanceof Uint8Array || typeof o.body_bytes === "string") && (o.auth_info_bytes instanceof Uint8Array || typeof o.auth_info_bytes === "string") && typeof o.chain_id === "string" && typeof o.account_number === "bigint"); + }, encode(message: SignDoc, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.bodyBytes.length !== 0) { writer.uint32(10).bytes(message.bodyBytes); @@ -1390,7 +1426,8 @@ export const SignDoc = { typeUrl: "/cosmos.tx.v1beta1.SignDoc", value: SignDoc.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseSignDocDirectAux(): SignDocDirectAux { return { @@ -1414,6 +1451,15 @@ function createBaseSignDocDirectAux(): SignDocDirectAux { export const SignDocDirectAux = { typeUrl: "/cosmos.tx.v1beta1.SignDocDirectAux", aminoType: "cosmos-sdk/SignDocDirectAux", + is(o: any): o is SignDocDirectAux { + return o && (o.$typeUrl === SignDocDirectAux.typeUrl || (o.bodyBytes instanceof Uint8Array || typeof o.bodyBytes === "string") && typeof o.chainId === "string" && typeof o.accountNumber === "bigint" && typeof o.sequence === "bigint"); + }, + isSDK(o: any): o is SignDocDirectAuxSDKType { + return o && (o.$typeUrl === SignDocDirectAux.typeUrl || (o.body_bytes instanceof Uint8Array || typeof o.body_bytes === "string") && typeof o.chain_id === "string" && typeof o.account_number === "bigint" && typeof o.sequence === "bigint"); + }, + isAmino(o: any): o is SignDocDirectAuxAmino { + return o && (o.$typeUrl === SignDocDirectAux.typeUrl || (o.body_bytes instanceof Uint8Array || typeof o.body_bytes === "string") && typeof o.chain_id === "string" && typeof o.account_number === "bigint" && typeof o.sequence === "bigint"); + }, encode(message: SignDocDirectAux, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.bodyBytes.length !== 0) { writer.uint32(10).bytes(message.bodyBytes); @@ -1577,6 +1623,12 @@ export const SignDocDirectAux = { typeUrl: "/cosmos.tx.v1beta1.SignDocDirectAux", value: SignDocDirectAux.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(SignDocDirectAux.typeUrl)) { + return; + } + Tip.registerTypeUrl(); } }; function createBaseTxBody(): TxBody { @@ -1597,6 +1649,15 @@ function createBaseTxBody(): TxBody { export const TxBody = { typeUrl: "/cosmos.tx.v1beta1.TxBody", aminoType: "cosmos-sdk/TxBody", + is(o: any): o is TxBody { + return o && (o.$typeUrl === TxBody.typeUrl || Array.isArray(o.messages) && (!o.messages.length || Any.is(o.messages[0])) && typeof o.memo === "string" && typeof o.timeoutHeight === "bigint" && Array.isArray(o.extensionOptions) && (!o.extensionOptions.length || Any.is(o.extensionOptions[0])) && Array.isArray(o.nonCriticalExtensionOptions) && (!o.nonCriticalExtensionOptions.length || Any.is(o.nonCriticalExtensionOptions[0]))); + }, + isSDK(o: any): o is TxBodySDKType { + return o && (o.$typeUrl === TxBody.typeUrl || Array.isArray(o.messages) && (!o.messages.length || Any.isSDK(o.messages[0])) && typeof o.memo === "string" && typeof o.timeout_height === "bigint" && Array.isArray(o.extension_options) && (!o.extension_options.length || Any.isSDK(o.extension_options[0])) && Array.isArray(o.non_critical_extension_options) && (!o.non_critical_extension_options.length || Any.isSDK(o.non_critical_extension_options[0]))); + }, + isAmino(o: any): o is TxBodyAmino { + return o && (o.$typeUrl === TxBody.typeUrl || Array.isArray(o.messages) && (!o.messages.length || Any.isAmino(o.messages[0])) && typeof o.memo === "string" && typeof o.timeout_height === "bigint" && Array.isArray(o.extension_options) && (!o.extension_options.length || Any.isAmino(o.extension_options[0])) && Array.isArray(o.non_critical_extension_options) && (!o.non_critical_extension_options.length || Any.isAmino(o.non_critical_extension_options[0]))); + }, encode(message: TxBody, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.messages) { Any.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -1769,7 +1830,8 @@ export const TxBody = { typeUrl: "/cosmos.tx.v1beta1.TxBody", value: TxBody.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseAuthInfo(): AuthInfo { return { @@ -1788,6 +1850,15 @@ function createBaseAuthInfo(): AuthInfo { export const AuthInfo = { typeUrl: "/cosmos.tx.v1beta1.AuthInfo", aminoType: "cosmos-sdk/AuthInfo", + is(o: any): o is AuthInfo { + return o && (o.$typeUrl === AuthInfo.typeUrl || Array.isArray(o.signerInfos) && (!o.signerInfos.length || SignerInfo.is(o.signerInfos[0]))); + }, + isSDK(o: any): o is AuthInfoSDKType { + return o && (o.$typeUrl === AuthInfo.typeUrl || Array.isArray(o.signer_infos) && (!o.signer_infos.length || SignerInfo.isSDK(o.signer_infos[0]))); + }, + isAmino(o: any): o is AuthInfoAmino { + return o && (o.$typeUrl === AuthInfo.typeUrl || Array.isArray(o.signer_infos) && (!o.signer_infos.length || SignerInfo.isAmino(o.signer_infos[0]))); + }, encode(message: AuthInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.signerInfos) { SignerInfo.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -1912,6 +1983,14 @@ export const AuthInfo = { typeUrl: "/cosmos.tx.v1beta1.AuthInfo", value: AuthInfo.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(AuthInfo.typeUrl)) { + return; + } + SignerInfo.registerTypeUrl(); + Fee.registerTypeUrl(); + Tip.registerTypeUrl(); } }; function createBaseSignerInfo(): SignerInfo { @@ -1931,6 +2010,15 @@ function createBaseSignerInfo(): SignerInfo { export const SignerInfo = { typeUrl: "/cosmos.tx.v1beta1.SignerInfo", aminoType: "cosmos-sdk/SignerInfo", + is(o: any): o is SignerInfo { + return o && (o.$typeUrl === SignerInfo.typeUrl || typeof o.sequence === "bigint"); + }, + isSDK(o: any): o is SignerInfoSDKType { + return o && (o.$typeUrl === SignerInfo.typeUrl || typeof o.sequence === "bigint"); + }, + isAmino(o: any): o is SignerInfoAmino { + return o && (o.$typeUrl === SignerInfo.typeUrl || typeof o.sequence === "bigint"); + }, encode(message: SignerInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.publicKey !== undefined) { Any.encode(message.publicKey, writer.uint32(10).fork()).ldelim(); @@ -2047,6 +2135,12 @@ export const SignerInfo = { typeUrl: "/cosmos.tx.v1beta1.SignerInfo", value: SignerInfo.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(SignerInfo.typeUrl)) { + return; + } + ModeInfo.registerTypeUrl(); } }; function createBaseModeInfo(): ModeInfo { @@ -2064,6 +2158,15 @@ function createBaseModeInfo(): ModeInfo { export const ModeInfo = { typeUrl: "/cosmos.tx.v1beta1.ModeInfo", aminoType: "cosmos-sdk/ModeInfo", + is(o: any): o is ModeInfo { + return o && o.$typeUrl === ModeInfo.typeUrl; + }, + isSDK(o: any): o is ModeInfoSDKType { + return o && o.$typeUrl === ModeInfo.typeUrl; + }, + isAmino(o: any): o is ModeInfoAmino { + return o && o.$typeUrl === ModeInfo.typeUrl; + }, encode(message: ModeInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.single !== undefined) { ModeInfo_Single.encode(message.single, writer.uint32(10).fork()).ldelim(); @@ -2163,6 +2266,13 @@ export const ModeInfo = { typeUrl: "/cosmos.tx.v1beta1.ModeInfo", value: ModeInfo.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ModeInfo.typeUrl)) { + return; + } + ModeInfo_Single.registerTypeUrl(); + ModeInfo_Multi.registerTypeUrl(); } }; function createBaseModeInfo_Single(): ModeInfo_Single { @@ -2181,6 +2291,15 @@ function createBaseModeInfo_Single(): ModeInfo_Single { export const ModeInfo_Single = { typeUrl: "/cosmos.tx.v1beta1.Single", aminoType: "cosmos-sdk/Single", + is(o: any): o is ModeInfo_Single { + return o && (o.$typeUrl === ModeInfo_Single.typeUrl || isSet(o.mode)); + }, + isSDK(o: any): o is ModeInfo_SingleSDKType { + return o && (o.$typeUrl === ModeInfo_Single.typeUrl || isSet(o.mode)); + }, + isAmino(o: any): o is ModeInfo_SingleAmino { + return o && (o.$typeUrl === ModeInfo_Single.typeUrl || isSet(o.mode)); + }, encode(message: ModeInfo_Single, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.mode !== 0) { writer.uint32(8).int32(message.mode); @@ -2261,7 +2380,8 @@ export const ModeInfo_Single = { typeUrl: "/cosmos.tx.v1beta1.Single", value: ModeInfo_Single.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseModeInfo_Multi(): ModeInfo_Multi { return { @@ -2278,6 +2398,15 @@ function createBaseModeInfo_Multi(): ModeInfo_Multi { export const ModeInfo_Multi = { typeUrl: "/cosmos.tx.v1beta1.Multi", aminoType: "cosmos-sdk/Multi", + is(o: any): o is ModeInfo_Multi { + return o && (o.$typeUrl === ModeInfo_Multi.typeUrl || Array.isArray(o.modeInfos) && (!o.modeInfos.length || ModeInfo.is(o.modeInfos[0]))); + }, + isSDK(o: any): o is ModeInfo_MultiSDKType { + return o && (o.$typeUrl === ModeInfo_Multi.typeUrl || Array.isArray(o.mode_infos) && (!o.mode_infos.length || ModeInfo.isSDK(o.mode_infos[0]))); + }, + isAmino(o: any): o is ModeInfo_MultiAmino { + return o && (o.$typeUrl === ModeInfo_Multi.typeUrl || Array.isArray(o.mode_infos) && (!o.mode_infos.length || ModeInfo.isAmino(o.mode_infos[0]))); + }, encode(message: ModeInfo_Multi, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.bitarray !== undefined) { CompactBitArray.encode(message.bitarray, writer.uint32(10).fork()).ldelim(); @@ -2385,6 +2514,13 @@ export const ModeInfo_Multi = { typeUrl: "/cosmos.tx.v1beta1.Multi", value: ModeInfo_Multi.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ModeInfo_Multi.typeUrl)) { + return; + } + CompactBitArray.registerTypeUrl(); + ModeInfo.registerTypeUrl(); } }; function createBaseFee(): Fee { @@ -2406,6 +2542,15 @@ function createBaseFee(): Fee { export const Fee = { typeUrl: "/cosmos.tx.v1beta1.Fee", aminoType: "cosmos-sdk/Fee", + is(o: any): o is Fee { + return o && (o.$typeUrl === Fee.typeUrl || Array.isArray(o.amount) && (!o.amount.length || Coin.is(o.amount[0])) && typeof o.gasLimit === "bigint" && typeof o.payer === "string" && typeof o.granter === "string"); + }, + isSDK(o: any): o is FeeSDKType { + return o && (o.$typeUrl === Fee.typeUrl || Array.isArray(o.amount) && (!o.amount.length || Coin.isSDK(o.amount[0])) && typeof o.gas_limit === "bigint" && typeof o.payer === "string" && typeof o.granter === "string"); + }, + isAmino(o: any): o is FeeAmino { + return o && (o.$typeUrl === Fee.typeUrl || Array.isArray(o.amount) && (!o.amount.length || Coin.isAmino(o.amount[0])) && typeof o.gas_limit === "bigint" && typeof o.payer === "string" && typeof o.granter === "string"); + }, encode(message: Fee, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.amount) { Coin.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -2543,6 +2688,12 @@ export const Fee = { typeUrl: "/cosmos.tx.v1beta1.Fee", value: Fee.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Fee.typeUrl)) { + return; + } + Coin.registerTypeUrl(); } }; function createBaseTip(): Tip { @@ -2562,6 +2713,15 @@ function createBaseTip(): Tip { export const Tip = { typeUrl: "/cosmos.tx.v1beta1.Tip", aminoType: "cosmos-sdk/Tip", + is(o: any): o is Tip { + return o && (o.$typeUrl === Tip.typeUrl || Array.isArray(o.amount) && (!o.amount.length || Coin.is(o.amount[0])) && typeof o.tipper === "string"); + }, + isSDK(o: any): o is TipSDKType { + return o && (o.$typeUrl === Tip.typeUrl || Array.isArray(o.amount) && (!o.amount.length || Coin.isSDK(o.amount[0])) && typeof o.tipper === "string"); + }, + isAmino(o: any): o is TipAmino { + return o && (o.$typeUrl === Tip.typeUrl || Array.isArray(o.amount) && (!o.amount.length || Coin.isAmino(o.amount[0])) && typeof o.tipper === "string"); + }, encode(message: Tip, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.amount) { Coin.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -2667,6 +2827,12 @@ export const Tip = { typeUrl: "/cosmos.tx.v1beta1.Tip", value: Tip.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Tip.typeUrl)) { + return; + } + Coin.registerTypeUrl(); } }; function createBaseAuxSignerData(): AuxSignerData { @@ -2691,6 +2857,15 @@ function createBaseAuxSignerData(): AuxSignerData { export const AuxSignerData = { typeUrl: "/cosmos.tx.v1beta1.AuxSignerData", aminoType: "cosmos-sdk/AuxSignerData", + is(o: any): o is AuxSignerData { + return o && (o.$typeUrl === AuxSignerData.typeUrl || typeof o.address === "string" && isSet(o.mode) && (o.sig instanceof Uint8Array || typeof o.sig === "string")); + }, + isSDK(o: any): o is AuxSignerDataSDKType { + return o && (o.$typeUrl === AuxSignerData.typeUrl || typeof o.address === "string" && isSet(o.mode) && (o.sig instanceof Uint8Array || typeof o.sig === "string")); + }, + isAmino(o: any): o is AuxSignerDataAmino { + return o && (o.$typeUrl === AuxSignerData.typeUrl || typeof o.address === "string" && isSet(o.mode) && (o.sig instanceof Uint8Array || typeof o.sig === "string")); + }, encode(message: AuxSignerData, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.address !== "") { writer.uint32(10).string(message.address); @@ -2818,5 +2993,11 @@ export const AuxSignerData = { typeUrl: "/cosmos.tx.v1beta1.AuxSignerData", value: AuxSignerData.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(AuxSignerData.typeUrl)) { + return; + } + SignDocDirectAux.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/cosmos/upgrade/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputv2/cosmos/upgrade/v1beta1/query.rpc.func.ts new file mode 100644 index 0000000000..b1f5caa0b4 --- /dev/null +++ b/__fixtures__/v-next/outputv2/cosmos/upgrade/v1beta1/query.rpc.func.ts @@ -0,0 +1,75 @@ +import { buildQuery } from "../../../helper-func-types"; +import { QueryCurrentPlanRequest, QueryCurrentPlanResponse, QueryAppliedPlanRequest, QueryAppliedPlanResponse, QueryUpgradedConsensusStateRequest, QueryUpgradedConsensusStateResponse, QueryModuleVersionsRequest, QueryModuleVersionsResponse, QueryAuthorityRequest, QueryAuthorityResponse } from "./query"; +/** + * CurrentPlan queries the current upgrade plan. + * @name getCurrentPlan + * @package cosmos.upgrade.v1beta1 + * @see proto service: cosmos.upgrade.v1beta1.CurrentPlan + */ +export const getCurrentPlan = buildQuery({ + encode: QueryCurrentPlanRequest.encode, + decode: QueryCurrentPlanResponse.decode, + service: "cosmos.upgrade.v1beta1.Query", + method: "CurrentPlan", + deps: [QueryCurrentPlanRequest, QueryCurrentPlanResponse] +}); +/** + * AppliedPlan queries a previously applied upgrade plan by its name. + * @name getAppliedPlan + * @package cosmos.upgrade.v1beta1 + * @see proto service: cosmos.upgrade.v1beta1.AppliedPlan + */ +export const getAppliedPlan = buildQuery({ + encode: QueryAppliedPlanRequest.encode, + decode: QueryAppliedPlanResponse.decode, + service: "cosmos.upgrade.v1beta1.Query", + method: "AppliedPlan", + deps: [QueryAppliedPlanRequest, QueryAppliedPlanResponse] +}); +/** + * UpgradedConsensusState queries the consensus state that will serve + * as a trusted kernel for the next version of this chain. It will only be + * stored at the last height of this chain. + * UpgradedConsensusState RPC not supported with legacy querier + * This rpc is deprecated now that IBC has its own replacement + * (https://github.com/cosmos/ibc-go/blob/2c880a22e9f9cc75f62b527ca94aa75ce1106001/proto/ibc/core/client/v1/query.proto#L54) + * @name getUpgradedConsensusState + * @package cosmos.upgrade.v1beta1 + * @see proto service: cosmos.upgrade.v1beta1.UpgradedConsensusState + * @deprecated + */ +export const getUpgradedConsensusState = buildQuery({ + encode: QueryUpgradedConsensusStateRequest.encode, + decode: QueryUpgradedConsensusStateResponse.decode, + service: "cosmos.upgrade.v1beta1.Query", + method: "UpgradedConsensusState", + deps: [QueryUpgradedConsensusStateRequest, QueryUpgradedConsensusStateResponse] +}); +/** + * ModuleVersions queries the list of module versions from state. + * + * Since: cosmos-sdk 0.43 + * @name getModuleVersions + * @package cosmos.upgrade.v1beta1 + * @see proto service: cosmos.upgrade.v1beta1.ModuleVersions + */ +export const getModuleVersions = buildQuery({ + encode: QueryModuleVersionsRequest.encode, + decode: QueryModuleVersionsResponse.decode, + service: "cosmos.upgrade.v1beta1.Query", + method: "ModuleVersions", + deps: [QueryModuleVersionsRequest, QueryModuleVersionsResponse] +}); +/** + * Returns the account with authority to conduct upgrades + * @name getAuthority + * @package cosmos.upgrade.v1beta1 + * @see proto service: cosmos.upgrade.v1beta1.Authority + */ +export const getAuthority = buildQuery({ + encode: QueryAuthorityRequest.encode, + decode: QueryAuthorityResponse.decode, + service: "cosmos.upgrade.v1beta1.Query", + method: "Authority", + deps: [QueryAuthorityRequest, QueryAuthorityResponse] +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/cosmos/upgrade/v1beta1/query.ts b/__fixtures__/v-next/outputv2/cosmos/upgrade/v1beta1/query.ts index 7dd504e6f7..9ad2d06a42 100644 --- a/__fixtures__/v-next/outputv2/cosmos/upgrade/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv2/cosmos/upgrade/v1beta1/query.ts @@ -2,6 +2,7 @@ import { Plan, PlanAmino, PlanSDKType, ModuleVersion, ModuleVersionAmino, Module import { BinaryReader, BinaryWriter } from "../../../binary"; import { JsonSafe } from "../../../json-safe"; import { DeepPartial, isSet, bytesFromBase64, base64FromBytes } from "../../../helpers"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "cosmos.upgrade.v1beta1"; /** * QueryCurrentPlanRequest is the request type for the Query/CurrentPlan RPC @@ -456,6 +457,15 @@ function createBaseQueryCurrentPlanRequest(): QueryCurrentPlanRequest { export const QueryCurrentPlanRequest = { typeUrl: "/cosmos.upgrade.v1beta1.QueryCurrentPlanRequest", aminoType: "cosmos-sdk/QueryCurrentPlanRequest", + is(o: any): o is QueryCurrentPlanRequest { + return o && o.$typeUrl === QueryCurrentPlanRequest.typeUrl; + }, + isSDK(o: any): o is QueryCurrentPlanRequestSDKType { + return o && o.$typeUrl === QueryCurrentPlanRequest.typeUrl; + }, + isAmino(o: any): o is QueryCurrentPlanRequestAmino { + return o && o.$typeUrl === QueryCurrentPlanRequest.typeUrl; + }, encode(_: QueryCurrentPlanRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -520,7 +530,8 @@ export const QueryCurrentPlanRequest = { typeUrl: "/cosmos.upgrade.v1beta1.QueryCurrentPlanRequest", value: QueryCurrentPlanRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryCurrentPlanResponse(): QueryCurrentPlanResponse { return { @@ -537,6 +548,15 @@ function createBaseQueryCurrentPlanResponse(): QueryCurrentPlanResponse { export const QueryCurrentPlanResponse = { typeUrl: "/cosmos.upgrade.v1beta1.QueryCurrentPlanResponse", aminoType: "cosmos-sdk/QueryCurrentPlanResponse", + is(o: any): o is QueryCurrentPlanResponse { + return o && o.$typeUrl === QueryCurrentPlanResponse.typeUrl; + }, + isSDK(o: any): o is QueryCurrentPlanResponseSDKType { + return o && o.$typeUrl === QueryCurrentPlanResponse.typeUrl; + }, + isAmino(o: any): o is QueryCurrentPlanResponseAmino { + return o && o.$typeUrl === QueryCurrentPlanResponse.typeUrl; + }, encode(message: QueryCurrentPlanResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.plan !== undefined) { Plan.encode(message.plan, writer.uint32(10).fork()).ldelim(); @@ -619,6 +639,12 @@ export const QueryCurrentPlanResponse = { typeUrl: "/cosmos.upgrade.v1beta1.QueryCurrentPlanResponse", value: QueryCurrentPlanResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryCurrentPlanResponse.typeUrl)) { + return; + } + Plan.registerTypeUrl(); } }; function createBaseQueryAppliedPlanRequest(): QueryAppliedPlanRequest { @@ -636,6 +662,15 @@ function createBaseQueryAppliedPlanRequest(): QueryAppliedPlanRequest { export const QueryAppliedPlanRequest = { typeUrl: "/cosmos.upgrade.v1beta1.QueryAppliedPlanRequest", aminoType: "cosmos-sdk/QueryAppliedPlanRequest", + is(o: any): o is QueryAppliedPlanRequest { + return o && (o.$typeUrl === QueryAppliedPlanRequest.typeUrl || typeof o.name === "string"); + }, + isSDK(o: any): o is QueryAppliedPlanRequestSDKType { + return o && (o.$typeUrl === QueryAppliedPlanRequest.typeUrl || typeof o.name === "string"); + }, + isAmino(o: any): o is QueryAppliedPlanRequestAmino { + return o && (o.$typeUrl === QueryAppliedPlanRequest.typeUrl || typeof o.name === "string"); + }, encode(message: QueryAppliedPlanRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -716,7 +751,8 @@ export const QueryAppliedPlanRequest = { typeUrl: "/cosmos.upgrade.v1beta1.QueryAppliedPlanRequest", value: QueryAppliedPlanRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryAppliedPlanResponse(): QueryAppliedPlanResponse { return { @@ -733,6 +769,15 @@ function createBaseQueryAppliedPlanResponse(): QueryAppliedPlanResponse { export const QueryAppliedPlanResponse = { typeUrl: "/cosmos.upgrade.v1beta1.QueryAppliedPlanResponse", aminoType: "cosmos-sdk/QueryAppliedPlanResponse", + is(o: any): o is QueryAppliedPlanResponse { + return o && (o.$typeUrl === QueryAppliedPlanResponse.typeUrl || typeof o.height === "bigint"); + }, + isSDK(o: any): o is QueryAppliedPlanResponseSDKType { + return o && (o.$typeUrl === QueryAppliedPlanResponse.typeUrl || typeof o.height === "bigint"); + }, + isAmino(o: any): o is QueryAppliedPlanResponseAmino { + return o && (o.$typeUrl === QueryAppliedPlanResponse.typeUrl || typeof o.height === "bigint"); + }, encode(message: QueryAppliedPlanResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.height !== BigInt(0)) { writer.uint32(8).int64(message.height); @@ -815,7 +860,8 @@ export const QueryAppliedPlanResponse = { typeUrl: "/cosmos.upgrade.v1beta1.QueryAppliedPlanResponse", value: QueryAppliedPlanResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryUpgradedConsensusStateRequest(): QueryUpgradedConsensusStateRequest { return { @@ -833,6 +879,15 @@ function createBaseQueryUpgradedConsensusStateRequest(): QueryUpgradedConsensusS export const QueryUpgradedConsensusStateRequest = { typeUrl: "/cosmos.upgrade.v1beta1.QueryUpgradedConsensusStateRequest", aminoType: "cosmos-sdk/QueryUpgradedConsensusStateRequest", + is(o: any): o is QueryUpgradedConsensusStateRequest { + return o && (o.$typeUrl === QueryUpgradedConsensusStateRequest.typeUrl || typeof o.lastHeight === "bigint"); + }, + isSDK(o: any): o is QueryUpgradedConsensusStateRequestSDKType { + return o && (o.$typeUrl === QueryUpgradedConsensusStateRequest.typeUrl || typeof o.last_height === "bigint"); + }, + isAmino(o: any): o is QueryUpgradedConsensusStateRequestAmino { + return o && (o.$typeUrl === QueryUpgradedConsensusStateRequest.typeUrl || typeof o.last_height === "bigint"); + }, encode(message: QueryUpgradedConsensusStateRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.lastHeight !== BigInt(0)) { writer.uint32(8).int64(message.lastHeight); @@ -915,7 +970,8 @@ export const QueryUpgradedConsensusStateRequest = { typeUrl: "/cosmos.upgrade.v1beta1.QueryUpgradedConsensusStateRequest", value: QueryUpgradedConsensusStateRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryUpgradedConsensusStateResponse(): QueryUpgradedConsensusStateResponse { return { @@ -933,6 +989,15 @@ function createBaseQueryUpgradedConsensusStateResponse(): QueryUpgradedConsensus export const QueryUpgradedConsensusStateResponse = { typeUrl: "/cosmos.upgrade.v1beta1.QueryUpgradedConsensusStateResponse", aminoType: "cosmos-sdk/QueryUpgradedConsensusStateResponse", + is(o: any): o is QueryUpgradedConsensusStateResponse { + return o && (o.$typeUrl === QueryUpgradedConsensusStateResponse.typeUrl || o.upgradedConsensusState instanceof Uint8Array || typeof o.upgradedConsensusState === "string"); + }, + isSDK(o: any): o is QueryUpgradedConsensusStateResponseSDKType { + return o && (o.$typeUrl === QueryUpgradedConsensusStateResponse.typeUrl || o.upgraded_consensus_state instanceof Uint8Array || typeof o.upgraded_consensus_state === "string"); + }, + isAmino(o: any): o is QueryUpgradedConsensusStateResponseAmino { + return o && (o.$typeUrl === QueryUpgradedConsensusStateResponse.typeUrl || o.upgraded_consensus_state instanceof Uint8Array || typeof o.upgraded_consensus_state === "string"); + }, encode(message: QueryUpgradedConsensusStateResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.upgradedConsensusState.length !== 0) { writer.uint32(18).bytes(message.upgradedConsensusState); @@ -1013,7 +1078,8 @@ export const QueryUpgradedConsensusStateResponse = { typeUrl: "/cosmos.upgrade.v1beta1.QueryUpgradedConsensusStateResponse", value: QueryUpgradedConsensusStateResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryModuleVersionsRequest(): QueryModuleVersionsRequest { return { @@ -1032,6 +1098,15 @@ function createBaseQueryModuleVersionsRequest(): QueryModuleVersionsRequest { export const QueryModuleVersionsRequest = { typeUrl: "/cosmos.upgrade.v1beta1.QueryModuleVersionsRequest", aminoType: "cosmos-sdk/QueryModuleVersionsRequest", + is(o: any): o is QueryModuleVersionsRequest { + return o && (o.$typeUrl === QueryModuleVersionsRequest.typeUrl || typeof o.moduleName === "string"); + }, + isSDK(o: any): o is QueryModuleVersionsRequestSDKType { + return o && (o.$typeUrl === QueryModuleVersionsRequest.typeUrl || typeof o.module_name === "string"); + }, + isAmino(o: any): o is QueryModuleVersionsRequestAmino { + return o && (o.$typeUrl === QueryModuleVersionsRequest.typeUrl || typeof o.module_name === "string"); + }, encode(message: QueryModuleVersionsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.moduleName !== "") { writer.uint32(10).string(message.moduleName); @@ -1112,7 +1187,8 @@ export const QueryModuleVersionsRequest = { typeUrl: "/cosmos.upgrade.v1beta1.QueryModuleVersionsRequest", value: QueryModuleVersionsRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryModuleVersionsResponse(): QueryModuleVersionsResponse { return { @@ -1131,6 +1207,15 @@ function createBaseQueryModuleVersionsResponse(): QueryModuleVersionsResponse { export const QueryModuleVersionsResponse = { typeUrl: "/cosmos.upgrade.v1beta1.QueryModuleVersionsResponse", aminoType: "cosmos-sdk/QueryModuleVersionsResponse", + is(o: any): o is QueryModuleVersionsResponse { + return o && (o.$typeUrl === QueryModuleVersionsResponse.typeUrl || Array.isArray(o.moduleVersions) && (!o.moduleVersions.length || ModuleVersion.is(o.moduleVersions[0]))); + }, + isSDK(o: any): o is QueryModuleVersionsResponseSDKType { + return o && (o.$typeUrl === QueryModuleVersionsResponse.typeUrl || Array.isArray(o.module_versions) && (!o.module_versions.length || ModuleVersion.isSDK(o.module_versions[0]))); + }, + isAmino(o: any): o is QueryModuleVersionsResponseAmino { + return o && (o.$typeUrl === QueryModuleVersionsResponse.typeUrl || Array.isArray(o.module_versions) && (!o.module_versions.length || ModuleVersion.isAmino(o.module_versions[0]))); + }, encode(message: QueryModuleVersionsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.moduleVersions) { ModuleVersion.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -1221,6 +1306,12 @@ export const QueryModuleVersionsResponse = { typeUrl: "/cosmos.upgrade.v1beta1.QueryModuleVersionsResponse", value: QueryModuleVersionsResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryModuleVersionsResponse.typeUrl)) { + return; + } + ModuleVersion.registerTypeUrl(); } }; function createBaseQueryAuthorityRequest(): QueryAuthorityRequest { @@ -1237,6 +1328,15 @@ function createBaseQueryAuthorityRequest(): QueryAuthorityRequest { export const QueryAuthorityRequest = { typeUrl: "/cosmos.upgrade.v1beta1.QueryAuthorityRequest", aminoType: "cosmos-sdk/QueryAuthorityRequest", + is(o: any): o is QueryAuthorityRequest { + return o && o.$typeUrl === QueryAuthorityRequest.typeUrl; + }, + isSDK(o: any): o is QueryAuthorityRequestSDKType { + return o && o.$typeUrl === QueryAuthorityRequest.typeUrl; + }, + isAmino(o: any): o is QueryAuthorityRequestAmino { + return o && o.$typeUrl === QueryAuthorityRequest.typeUrl; + }, encode(_: QueryAuthorityRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -1301,7 +1401,8 @@ export const QueryAuthorityRequest = { typeUrl: "/cosmos.upgrade.v1beta1.QueryAuthorityRequest", value: QueryAuthorityRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryAuthorityResponse(): QueryAuthorityResponse { return { @@ -1319,6 +1420,15 @@ function createBaseQueryAuthorityResponse(): QueryAuthorityResponse { export const QueryAuthorityResponse = { typeUrl: "/cosmos.upgrade.v1beta1.QueryAuthorityResponse", aminoType: "cosmos-sdk/QueryAuthorityResponse", + is(o: any): o is QueryAuthorityResponse { + return o && (o.$typeUrl === QueryAuthorityResponse.typeUrl || typeof o.address === "string"); + }, + isSDK(o: any): o is QueryAuthorityResponseSDKType { + return o && (o.$typeUrl === QueryAuthorityResponse.typeUrl || typeof o.address === "string"); + }, + isAmino(o: any): o is QueryAuthorityResponseAmino { + return o && (o.$typeUrl === QueryAuthorityResponse.typeUrl || typeof o.address === "string"); + }, encode(message: QueryAuthorityResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.address !== "") { writer.uint32(10).string(message.address); @@ -1399,5 +1509,6 @@ export const QueryAuthorityResponse = { typeUrl: "/cosmos.upgrade.v1beta1.QueryAuthorityResponse", value: QueryAuthorityResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/cosmos/upgrade/v1beta1/tx.registry.ts b/__fixtures__/v-next/outputv2/cosmos/upgrade/v1beta1/tx.registry.ts index 2ace489f80..47be75a4e2 100644 --- a/__fixtures__/v-next/outputv2/cosmos/upgrade/v1beta1/tx.registry.ts +++ b/__fixtures__/v-next/outputv2/cosmos/upgrade/v1beta1/tx.registry.ts @@ -1,11 +1,6 @@ -import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { TelescopeGeneratedType } from "../../../types"; import { MsgSoftwareUpgrade, MsgCancelUpgrade } from "./tx"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/cosmos.upgrade.v1beta1.MsgSoftwareUpgrade", MsgSoftwareUpgrade], ["/cosmos.upgrade.v1beta1.MsgCancelUpgrade", MsgCancelUpgrade]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/cosmos.upgrade.v1beta1.MsgSoftwareUpgrade", MsgSoftwareUpgrade], ["/cosmos.upgrade.v1beta1.MsgCancelUpgrade", MsgCancelUpgrade]]; export const MessageComposer = { encoded: { softwareUpgrade(value: MsgSoftwareUpgrade) { diff --git a/__fixtures__/v-next/outputv2/cosmos/upgrade/v1beta1/tx.rpc.func.ts b/__fixtures__/v-next/outputv2/cosmos/upgrade/v1beta1/tx.rpc.func.ts new file mode 100644 index 0000000000..4a9274c644 --- /dev/null +++ b/__fixtures__/v-next/outputv2/cosmos/upgrade/v1beta1/tx.rpc.func.ts @@ -0,0 +1,25 @@ +import { buildTx } from "../../../helper-func-types"; +import { MsgSoftwareUpgrade, MsgCancelUpgrade } from "./tx"; +/** + * SoftwareUpgrade is a governance operation for initiating a software upgrade. + * + * Since: cosmos-sdk 0.46 + * @name softwareUpgrade + * @package cosmos.upgrade.v1beta1 + * @see proto service: cosmos.upgrade.v1beta1.SoftwareUpgrade + */ +export const softwareUpgrade = buildTx({ + msg: MsgSoftwareUpgrade +}); +/** + * CancelUpgrade is a governance operation for cancelling a previously + * approvid software upgrade. + * + * Since: cosmos-sdk 0.46 + * @name cancelUpgrade + * @package cosmos.upgrade.v1beta1 + * @see proto service: cosmos.upgrade.v1beta1.CancelUpgrade + */ +export const cancelUpgrade = buildTx({ + msg: MsgCancelUpgrade +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/cosmos/upgrade/v1beta1/tx.ts b/__fixtures__/v-next/outputv2/cosmos/upgrade/v1beta1/tx.ts index 4d4cda99aa..7151449530 100644 --- a/__fixtures__/v-next/outputv2/cosmos/upgrade/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputv2/cosmos/upgrade/v1beta1/tx.ts @@ -1,5 +1,6 @@ import { Plan, PlanAmino, PlanSDKType } from "./upgrade"; import { BinaryReader, BinaryWriter } from "../../../binary"; +import { GlobalDecoderRegistry } from "../../../registry"; import { isSet, DeepPartial } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "cosmos.upgrade.v1beta1"; @@ -193,6 +194,15 @@ function createBaseMsgSoftwareUpgrade(): MsgSoftwareUpgrade { export const MsgSoftwareUpgrade = { typeUrl: "/cosmos.upgrade.v1beta1.MsgSoftwareUpgrade", aminoType: "cosmos-sdk/MsgSoftwareUpgrade", + is(o: any): o is MsgSoftwareUpgrade { + return o && (o.$typeUrl === MsgSoftwareUpgrade.typeUrl || typeof o.authority === "string" && Plan.is(o.plan)); + }, + isSDK(o: any): o is MsgSoftwareUpgradeSDKType { + return o && (o.$typeUrl === MsgSoftwareUpgrade.typeUrl || typeof o.authority === "string" && Plan.isSDK(o.plan)); + }, + isAmino(o: any): o is MsgSoftwareUpgradeAmino { + return o && (o.$typeUrl === MsgSoftwareUpgrade.typeUrl || typeof o.authority === "string" && Plan.isAmino(o.plan)); + }, encode(message: MsgSoftwareUpgrade, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.authority !== "") { writer.uint32(10).string(message.authority); @@ -290,6 +300,12 @@ export const MsgSoftwareUpgrade = { typeUrl: "/cosmos.upgrade.v1beta1.MsgSoftwareUpgrade", value: MsgSoftwareUpgrade.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgSoftwareUpgrade.typeUrl)) { + return; + } + Plan.registerTypeUrl(); } }; function createBaseMsgSoftwareUpgradeResponse(): MsgSoftwareUpgradeResponse { @@ -306,6 +322,15 @@ function createBaseMsgSoftwareUpgradeResponse(): MsgSoftwareUpgradeResponse { export const MsgSoftwareUpgradeResponse = { typeUrl: "/cosmos.upgrade.v1beta1.MsgSoftwareUpgradeResponse", aminoType: "cosmos-sdk/MsgSoftwareUpgradeResponse", + is(o: any): o is MsgSoftwareUpgradeResponse { + return o && o.$typeUrl === MsgSoftwareUpgradeResponse.typeUrl; + }, + isSDK(o: any): o is MsgSoftwareUpgradeResponseSDKType { + return o && o.$typeUrl === MsgSoftwareUpgradeResponse.typeUrl; + }, + isAmino(o: any): o is MsgSoftwareUpgradeResponseAmino { + return o && o.$typeUrl === MsgSoftwareUpgradeResponse.typeUrl; + }, encode(_: MsgSoftwareUpgradeResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -370,7 +395,8 @@ export const MsgSoftwareUpgradeResponse = { typeUrl: "/cosmos.upgrade.v1beta1.MsgSoftwareUpgradeResponse", value: MsgSoftwareUpgradeResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgCancelUpgrade(): MsgCancelUpgrade { return { @@ -388,6 +414,15 @@ function createBaseMsgCancelUpgrade(): MsgCancelUpgrade { export const MsgCancelUpgrade = { typeUrl: "/cosmos.upgrade.v1beta1.MsgCancelUpgrade", aminoType: "cosmos-sdk/MsgCancelUpgrade", + is(o: any): o is MsgCancelUpgrade { + return o && (o.$typeUrl === MsgCancelUpgrade.typeUrl || typeof o.authority === "string"); + }, + isSDK(o: any): o is MsgCancelUpgradeSDKType { + return o && (o.$typeUrl === MsgCancelUpgrade.typeUrl || typeof o.authority === "string"); + }, + isAmino(o: any): o is MsgCancelUpgradeAmino { + return o && (o.$typeUrl === MsgCancelUpgrade.typeUrl || typeof o.authority === "string"); + }, encode(message: MsgCancelUpgrade, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.authority !== "") { writer.uint32(10).string(message.authority); @@ -468,7 +503,8 @@ export const MsgCancelUpgrade = { typeUrl: "/cosmos.upgrade.v1beta1.MsgCancelUpgrade", value: MsgCancelUpgrade.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgCancelUpgradeResponse(): MsgCancelUpgradeResponse { return {}; @@ -484,6 +520,15 @@ function createBaseMsgCancelUpgradeResponse(): MsgCancelUpgradeResponse { export const MsgCancelUpgradeResponse = { typeUrl: "/cosmos.upgrade.v1beta1.MsgCancelUpgradeResponse", aminoType: "cosmos-sdk/MsgCancelUpgradeResponse", + is(o: any): o is MsgCancelUpgradeResponse { + return o && o.$typeUrl === MsgCancelUpgradeResponse.typeUrl; + }, + isSDK(o: any): o is MsgCancelUpgradeResponseSDKType { + return o && o.$typeUrl === MsgCancelUpgradeResponse.typeUrl; + }, + isAmino(o: any): o is MsgCancelUpgradeResponseAmino { + return o && o.$typeUrl === MsgCancelUpgradeResponse.typeUrl; + }, encode(_: MsgCancelUpgradeResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -548,5 +593,6 @@ export const MsgCancelUpgradeResponse = { typeUrl: "/cosmos.upgrade.v1beta1.MsgCancelUpgradeResponse", value: MsgCancelUpgradeResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/cosmos/upgrade/v1beta1/upgrade.ts b/__fixtures__/v-next/outputv2/cosmos/upgrade/v1beta1/upgrade.ts index 1f3561fa70..19d9c9eea5 100644 --- a/__fixtures__/v-next/outputv2/cosmos/upgrade/v1beta1/upgrade.ts +++ b/__fixtures__/v-next/outputv2/cosmos/upgrade/v1beta1/upgrade.ts @@ -2,6 +2,7 @@ import { Timestamp } from "../../../google/protobuf/timestamp"; import { Any, AnyAmino, AnySDKType } from "../../../google/protobuf/any"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { toTimestamp, fromTimestamp, isSet, DeepPartial } from "../../../helpers"; +import { GlobalDecoderRegistry } from "../../../registry"; import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "cosmos.upgrade.v1beta1"; /** @@ -292,6 +293,15 @@ function createBasePlan(): Plan { export const Plan = { typeUrl: "/cosmos.upgrade.v1beta1.Plan", aminoType: "cosmos-sdk/Plan", + is(o: any): o is Plan { + return o && (o.$typeUrl === Plan.typeUrl || typeof o.name === "string" && Timestamp.is(o.time) && typeof o.height === "bigint" && typeof o.info === "string"); + }, + isSDK(o: any): o is PlanSDKType { + return o && (o.$typeUrl === Plan.typeUrl || typeof o.name === "string" && Timestamp.isSDK(o.time) && typeof o.height === "bigint" && typeof o.info === "string"); + }, + isAmino(o: any): o is PlanAmino { + return o && (o.$typeUrl === Plan.typeUrl || typeof o.name === "string" && Timestamp.isAmino(o.time) && typeof o.height === "bigint" && typeof o.info === "string"); + }, encode(message: Plan, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -436,7 +446,8 @@ export const Plan = { typeUrl: "/cosmos.upgrade.v1beta1.Plan", value: Plan.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseSoftwareUpgradeProposal(): SoftwareUpgradeProposal { return { @@ -458,6 +469,15 @@ function createBaseSoftwareUpgradeProposal(): SoftwareUpgradeProposal { export const SoftwareUpgradeProposal = { typeUrl: "/cosmos.upgrade.v1beta1.SoftwareUpgradeProposal", aminoType: "cosmos-sdk/SoftwareUpgradeProposal", + is(o: any): o is SoftwareUpgradeProposal { + return o && (o.$typeUrl === SoftwareUpgradeProposal.typeUrl || typeof o.title === "string" && typeof o.description === "string" && Plan.is(o.plan)); + }, + isSDK(o: any): o is SoftwareUpgradeProposalSDKType { + return o && (o.$typeUrl === SoftwareUpgradeProposal.typeUrl || typeof o.title === "string" && typeof o.description === "string" && Plan.isSDK(o.plan)); + }, + isAmino(o: any): o is SoftwareUpgradeProposalAmino { + return o && (o.$typeUrl === SoftwareUpgradeProposal.typeUrl || typeof o.title === "string" && typeof o.description === "string" && Plan.isAmino(o.plan)); + }, encode(message: SoftwareUpgradeProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.title !== "") { writer.uint32(10).string(message.title); @@ -570,6 +590,12 @@ export const SoftwareUpgradeProposal = { typeUrl: "/cosmos.upgrade.v1beta1.SoftwareUpgradeProposal", value: SoftwareUpgradeProposal.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(SoftwareUpgradeProposal.typeUrl)) { + return; + } + Plan.registerTypeUrl(); } }; function createBaseCancelSoftwareUpgradeProposal(): CancelSoftwareUpgradeProposal { @@ -591,6 +617,15 @@ function createBaseCancelSoftwareUpgradeProposal(): CancelSoftwareUpgradeProposa export const CancelSoftwareUpgradeProposal = { typeUrl: "/cosmos.upgrade.v1beta1.CancelSoftwareUpgradeProposal", aminoType: "cosmos-sdk/CancelSoftwareUpgradeProposal", + is(o: any): o is CancelSoftwareUpgradeProposal { + return o && (o.$typeUrl === CancelSoftwareUpgradeProposal.typeUrl || typeof o.title === "string" && typeof o.description === "string"); + }, + isSDK(o: any): o is CancelSoftwareUpgradeProposalSDKType { + return o && (o.$typeUrl === CancelSoftwareUpgradeProposal.typeUrl || typeof o.title === "string" && typeof o.description === "string"); + }, + isAmino(o: any): o is CancelSoftwareUpgradeProposalAmino { + return o && (o.$typeUrl === CancelSoftwareUpgradeProposal.typeUrl || typeof o.title === "string" && typeof o.description === "string"); + }, encode(message: CancelSoftwareUpgradeProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.title !== "") { writer.uint32(10).string(message.title); @@ -686,7 +721,8 @@ export const CancelSoftwareUpgradeProposal = { typeUrl: "/cosmos.upgrade.v1beta1.CancelSoftwareUpgradeProposal", value: CancelSoftwareUpgradeProposal.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseModuleVersion(): ModuleVersion { return { @@ -705,6 +741,15 @@ function createBaseModuleVersion(): ModuleVersion { export const ModuleVersion = { typeUrl: "/cosmos.upgrade.v1beta1.ModuleVersion", aminoType: "cosmos-sdk/ModuleVersion", + is(o: any): o is ModuleVersion { + return o && (o.$typeUrl === ModuleVersion.typeUrl || typeof o.name === "string" && typeof o.version === "bigint"); + }, + isSDK(o: any): o is ModuleVersionSDKType { + return o && (o.$typeUrl === ModuleVersion.typeUrl || typeof o.name === "string" && typeof o.version === "bigint"); + }, + isAmino(o: any): o is ModuleVersionAmino { + return o && (o.$typeUrl === ModuleVersion.typeUrl || typeof o.name === "string" && typeof o.version === "bigint"); + }, encode(message: ModuleVersion, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -802,5 +847,6 @@ export const ModuleVersion = { typeUrl: "/cosmos.upgrade.v1beta1.ModuleVersion", value: ModuleVersion.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/cosmos/vesting/v1beta1/tx.registry.ts b/__fixtures__/v-next/outputv2/cosmos/vesting/v1beta1/tx.registry.ts index ba736f6167..222d103fcc 100644 --- a/__fixtures__/v-next/outputv2/cosmos/vesting/v1beta1/tx.registry.ts +++ b/__fixtures__/v-next/outputv2/cosmos/vesting/v1beta1/tx.registry.ts @@ -1,11 +1,6 @@ -import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { TelescopeGeneratedType } from "../../../types"; import { MsgCreateVestingAccount, MsgCreatePermanentLockedAccount, MsgCreatePeriodicVestingAccount } from "./tx"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/cosmos.vesting.v1beta1.MsgCreateVestingAccount", MsgCreateVestingAccount], ["/cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccount", MsgCreatePermanentLockedAccount], ["/cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccount", MsgCreatePeriodicVestingAccount]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/cosmos.vesting.v1beta1.MsgCreateVestingAccount", MsgCreateVestingAccount], ["/cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccount", MsgCreatePermanentLockedAccount], ["/cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccount", MsgCreatePeriodicVestingAccount]]; export const MessageComposer = { encoded: { createVestingAccount(value: MsgCreateVestingAccount) { diff --git a/__fixtures__/v-next/outputv2/cosmos/vesting/v1beta1/tx.rpc.func.ts b/__fixtures__/v-next/outputv2/cosmos/vesting/v1beta1/tx.rpc.func.ts new file mode 100644 index 0000000000..bde0114bbb --- /dev/null +++ b/__fixtures__/v-next/outputv2/cosmos/vesting/v1beta1/tx.rpc.func.ts @@ -0,0 +1,32 @@ +import { buildTx } from "../../../helper-func-types"; +import { MsgCreateVestingAccount, MsgCreatePermanentLockedAccount, MsgCreatePeriodicVestingAccount } from "./tx"; +/** + * CreateVestingAccount defines a method that enables creating a vesting + * account. + * @name createVestingAccount + * @package cosmos.vesting.v1beta1 + * @see proto service: cosmos.vesting.v1beta1.CreateVestingAccount + */ +export const createVestingAccount = buildTx({ + msg: MsgCreateVestingAccount +}); +/** + * CreatePermanentLockedAccount defines a method that enables creating a permanent + * locked account. + * @name createPermanentLockedAccount + * @package cosmos.vesting.v1beta1 + * @see proto service: cosmos.vesting.v1beta1.CreatePermanentLockedAccount + */ +export const createPermanentLockedAccount = buildTx({ + msg: MsgCreatePermanentLockedAccount +}); +/** + * CreatePeriodicVestingAccount defines a method that enables creating a + * periodic vesting account. + * @name createPeriodicVestingAccount + * @package cosmos.vesting.v1beta1 + * @see proto service: cosmos.vesting.v1beta1.CreatePeriodicVestingAccount + */ +export const createPeriodicVestingAccount = buildTx({ + msg: MsgCreatePeriodicVestingAccount +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/cosmos/vesting/v1beta1/tx.ts b/__fixtures__/v-next/outputv2/cosmos/vesting/v1beta1/tx.ts index 7a1d31c57b..d19c7746df 100644 --- a/__fixtures__/v-next/outputv2/cosmos/vesting/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputv2/cosmos/vesting/v1beta1/tx.ts @@ -3,6 +3,7 @@ import { Period, PeriodAmino, PeriodSDKType } from "./vesting"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { isSet, DeepPartial } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "cosmos.vesting.v1beta1"; /** * MsgCreateVestingAccount defines a message that enables creating a vesting @@ -254,6 +255,15 @@ function createBaseMsgCreateVestingAccount(): MsgCreateVestingAccount { export const MsgCreateVestingAccount = { typeUrl: "/cosmos.vesting.v1beta1.MsgCreateVestingAccount", aminoType: "cosmos-sdk/MsgCreateVestingAccount", + is(o: any): o is MsgCreateVestingAccount { + return o && (o.$typeUrl === MsgCreateVestingAccount.typeUrl || typeof o.fromAddress === "string" && typeof o.toAddress === "string" && Array.isArray(o.amount) && (!o.amount.length || Coin.is(o.amount[0])) && typeof o.endTime === "bigint" && typeof o.delayed === "boolean"); + }, + isSDK(o: any): o is MsgCreateVestingAccountSDKType { + return o && (o.$typeUrl === MsgCreateVestingAccount.typeUrl || typeof o.from_address === "string" && typeof o.to_address === "string" && Array.isArray(o.amount) && (!o.amount.length || Coin.isSDK(o.amount[0])) && typeof o.end_time === "bigint" && typeof o.delayed === "boolean"); + }, + isAmino(o: any): o is MsgCreateVestingAccountAmino { + return o && (o.$typeUrl === MsgCreateVestingAccount.typeUrl || typeof o.from_address === "string" && typeof o.to_address === "string" && Array.isArray(o.amount) && (!o.amount.length || Coin.isAmino(o.amount[0])) && typeof o.end_time === "bigint" && typeof o.delayed === "boolean"); + }, encode(message: MsgCreateVestingAccount, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.fromAddress !== "") { writer.uint32(10).string(message.fromAddress); @@ -406,6 +416,12 @@ export const MsgCreateVestingAccount = { typeUrl: "/cosmos.vesting.v1beta1.MsgCreateVestingAccount", value: MsgCreateVestingAccount.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgCreateVestingAccount.typeUrl)) { + return; + } + Coin.registerTypeUrl(); } }; function createBaseMsgCreateVestingAccountResponse(): MsgCreateVestingAccountResponse { @@ -420,6 +436,15 @@ function createBaseMsgCreateVestingAccountResponse(): MsgCreateVestingAccountRes export const MsgCreateVestingAccountResponse = { typeUrl: "/cosmos.vesting.v1beta1.MsgCreateVestingAccountResponse", aminoType: "cosmos-sdk/MsgCreateVestingAccountResponse", + is(o: any): o is MsgCreateVestingAccountResponse { + return o && o.$typeUrl === MsgCreateVestingAccountResponse.typeUrl; + }, + isSDK(o: any): o is MsgCreateVestingAccountResponseSDKType { + return o && o.$typeUrl === MsgCreateVestingAccountResponse.typeUrl; + }, + isAmino(o: any): o is MsgCreateVestingAccountResponseAmino { + return o && o.$typeUrl === MsgCreateVestingAccountResponse.typeUrl; + }, encode(_: MsgCreateVestingAccountResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -484,7 +509,8 @@ export const MsgCreateVestingAccountResponse = { typeUrl: "/cosmos.vesting.v1beta1.MsgCreateVestingAccountResponse", value: MsgCreateVestingAccountResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgCreatePermanentLockedAccount(): MsgCreatePermanentLockedAccount { return { @@ -503,6 +529,15 @@ function createBaseMsgCreatePermanentLockedAccount(): MsgCreatePermanentLockedAc export const MsgCreatePermanentLockedAccount = { typeUrl: "/cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccount", aminoType: "cosmos-sdk/MsgCreatePermanentLockedAccount", + is(o: any): o is MsgCreatePermanentLockedAccount { + return o && (o.$typeUrl === MsgCreatePermanentLockedAccount.typeUrl || typeof o.fromAddress === "string" && typeof o.toAddress === "string" && Array.isArray(o.amount) && (!o.amount.length || Coin.is(o.amount[0]))); + }, + isSDK(o: any): o is MsgCreatePermanentLockedAccountSDKType { + return o && (o.$typeUrl === MsgCreatePermanentLockedAccount.typeUrl || typeof o.from_address === "string" && typeof o.to_address === "string" && Array.isArray(o.amount) && (!o.amount.length || Coin.isSDK(o.amount[0]))); + }, + isAmino(o: any): o is MsgCreatePermanentLockedAccountAmino { + return o && (o.$typeUrl === MsgCreatePermanentLockedAccount.typeUrl || typeof o.from_address === "string" && typeof o.to_address === "string" && Array.isArray(o.amount) && (!o.amount.length || Coin.isAmino(o.amount[0]))); + }, encode(message: MsgCreatePermanentLockedAccount, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.fromAddress !== "") { writer.uint32(10).string(message.fromAddress); @@ -623,6 +658,12 @@ export const MsgCreatePermanentLockedAccount = { typeUrl: "/cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccount", value: MsgCreatePermanentLockedAccount.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgCreatePermanentLockedAccount.typeUrl)) { + return; + } + Coin.registerTypeUrl(); } }; function createBaseMsgCreatePermanentLockedAccountResponse(): MsgCreatePermanentLockedAccountResponse { @@ -637,6 +678,15 @@ function createBaseMsgCreatePermanentLockedAccountResponse(): MsgCreatePermanent export const MsgCreatePermanentLockedAccountResponse = { typeUrl: "/cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccountResponse", aminoType: "cosmos-sdk/MsgCreatePermanentLockedAccountResponse", + is(o: any): o is MsgCreatePermanentLockedAccountResponse { + return o && o.$typeUrl === MsgCreatePermanentLockedAccountResponse.typeUrl; + }, + isSDK(o: any): o is MsgCreatePermanentLockedAccountResponseSDKType { + return o && o.$typeUrl === MsgCreatePermanentLockedAccountResponse.typeUrl; + }, + isAmino(o: any): o is MsgCreatePermanentLockedAccountResponseAmino { + return o && o.$typeUrl === MsgCreatePermanentLockedAccountResponse.typeUrl; + }, encode(_: MsgCreatePermanentLockedAccountResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -701,7 +751,8 @@ export const MsgCreatePermanentLockedAccountResponse = { typeUrl: "/cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccountResponse", value: MsgCreatePermanentLockedAccountResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgCreatePeriodicVestingAccount(): MsgCreatePeriodicVestingAccount { return { @@ -721,6 +772,15 @@ function createBaseMsgCreatePeriodicVestingAccount(): MsgCreatePeriodicVestingAc export const MsgCreatePeriodicVestingAccount = { typeUrl: "/cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccount", aminoType: "cosmos-sdk/MsgCreatePeriodicVestingAccount", + is(o: any): o is MsgCreatePeriodicVestingAccount { + return o && (o.$typeUrl === MsgCreatePeriodicVestingAccount.typeUrl || typeof o.fromAddress === "string" && typeof o.toAddress === "string" && typeof o.startTime === "bigint" && Array.isArray(o.vestingPeriods) && (!o.vestingPeriods.length || Period.is(o.vestingPeriods[0]))); + }, + isSDK(o: any): o is MsgCreatePeriodicVestingAccountSDKType { + return o && (o.$typeUrl === MsgCreatePeriodicVestingAccount.typeUrl || typeof o.from_address === "string" && typeof o.to_address === "string" && typeof o.start_time === "bigint" && Array.isArray(o.vesting_periods) && (!o.vesting_periods.length || Period.isSDK(o.vesting_periods[0]))); + }, + isAmino(o: any): o is MsgCreatePeriodicVestingAccountAmino { + return o && (o.$typeUrl === MsgCreatePeriodicVestingAccount.typeUrl || typeof o.from_address === "string" && typeof o.to_address === "string" && typeof o.start_time === "bigint" && Array.isArray(o.vesting_periods) && (!o.vesting_periods.length || Period.isAmino(o.vesting_periods[0]))); + }, encode(message: MsgCreatePeriodicVestingAccount, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.fromAddress !== "") { writer.uint32(10).string(message.fromAddress); @@ -858,6 +918,12 @@ export const MsgCreatePeriodicVestingAccount = { typeUrl: "/cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccount", value: MsgCreatePeriodicVestingAccount.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgCreatePeriodicVestingAccount.typeUrl)) { + return; + } + Period.registerTypeUrl(); } }; function createBaseMsgCreatePeriodicVestingAccountResponse(): MsgCreatePeriodicVestingAccountResponse { @@ -873,6 +939,15 @@ function createBaseMsgCreatePeriodicVestingAccountResponse(): MsgCreatePeriodicV export const MsgCreatePeriodicVestingAccountResponse = { typeUrl: "/cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccountResponse", aminoType: "cosmos-sdk/MsgCreatePeriodicVestingAccountResponse", + is(o: any): o is MsgCreatePeriodicVestingAccountResponse { + return o && o.$typeUrl === MsgCreatePeriodicVestingAccountResponse.typeUrl; + }, + isSDK(o: any): o is MsgCreatePeriodicVestingAccountResponseSDKType { + return o && o.$typeUrl === MsgCreatePeriodicVestingAccountResponse.typeUrl; + }, + isAmino(o: any): o is MsgCreatePeriodicVestingAccountResponseAmino { + return o && o.$typeUrl === MsgCreatePeriodicVestingAccountResponse.typeUrl; + }, encode(_: MsgCreatePeriodicVestingAccountResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -937,5 +1012,6 @@ export const MsgCreatePeriodicVestingAccountResponse = { typeUrl: "/cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccountResponse", value: MsgCreatePeriodicVestingAccountResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/cosmos/vesting/v1beta1/vesting.ts b/__fixtures__/v-next/outputv2/cosmos/vesting/v1beta1/vesting.ts index 68f3c3346c..276060ee83 100644 --- a/__fixtures__/v-next/outputv2/cosmos/vesting/v1beta1/vesting.ts +++ b/__fixtures__/v-next/outputv2/cosmos/vesting/v1beta1/vesting.ts @@ -1,6 +1,7 @@ import { BaseAccount, BaseAccountAmino, BaseAccountSDKType } from "../../auth/v1beta1/auth"; import { Coin, CoinAmino, CoinSDKType } from "../../base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; +import { GlobalDecoderRegistry } from "../../../registry"; import { isSet, DeepPartial } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "cosmos.vesting.v1beta1"; @@ -284,6 +285,15 @@ function createBaseBaseVestingAccount(): BaseVestingAccount { export const BaseVestingAccount = { typeUrl: "/cosmos.vesting.v1beta1.BaseVestingAccount", aminoType: "cosmos-sdk/BaseVestingAccount", + is(o: any): o is BaseVestingAccount { + return o && (o.$typeUrl === BaseVestingAccount.typeUrl || Array.isArray(o.originalVesting) && (!o.originalVesting.length || Coin.is(o.originalVesting[0])) && Array.isArray(o.delegatedFree) && (!o.delegatedFree.length || Coin.is(o.delegatedFree[0])) && Array.isArray(o.delegatedVesting) && (!o.delegatedVesting.length || Coin.is(o.delegatedVesting[0])) && typeof o.endTime === "bigint"); + }, + isSDK(o: any): o is BaseVestingAccountSDKType { + return o && (o.$typeUrl === BaseVestingAccount.typeUrl || Array.isArray(o.original_vesting) && (!o.original_vesting.length || Coin.isSDK(o.original_vesting[0])) && Array.isArray(o.delegated_free) && (!o.delegated_free.length || Coin.isSDK(o.delegated_free[0])) && Array.isArray(o.delegated_vesting) && (!o.delegated_vesting.length || Coin.isSDK(o.delegated_vesting[0])) && typeof o.end_time === "bigint"); + }, + isAmino(o: any): o is BaseVestingAccountAmino { + return o && (o.$typeUrl === BaseVestingAccount.typeUrl || Array.isArray(o.original_vesting) && (!o.original_vesting.length || Coin.isAmino(o.original_vesting[0])) && Array.isArray(o.delegated_free) && (!o.delegated_free.length || Coin.isAmino(o.delegated_free[0])) && Array.isArray(o.delegated_vesting) && (!o.delegated_vesting.length || Coin.isAmino(o.delegated_vesting[0])) && typeof o.end_time === "bigint"); + }, encode(message: BaseVestingAccount, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.baseAccount !== undefined) { BaseAccount.encode(message.baseAccount, writer.uint32(10).fork()).ldelim(); @@ -458,6 +468,13 @@ export const BaseVestingAccount = { typeUrl: "/cosmos.vesting.v1beta1.BaseVestingAccount", value: BaseVestingAccount.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(BaseVestingAccount.typeUrl)) { + return; + } + BaseAccount.registerTypeUrl(); + Coin.registerTypeUrl(); } }; function createBaseContinuousVestingAccount(): ContinuousVestingAccount { @@ -476,6 +493,15 @@ function createBaseContinuousVestingAccount(): ContinuousVestingAccount { export const ContinuousVestingAccount = { typeUrl: "/cosmos.vesting.v1beta1.ContinuousVestingAccount", aminoType: "cosmos-sdk/ContinuousVestingAccount", + is(o: any): o is ContinuousVestingAccount { + return o && (o.$typeUrl === ContinuousVestingAccount.typeUrl || typeof o.startTime === "bigint"); + }, + isSDK(o: any): o is ContinuousVestingAccountSDKType { + return o && (o.$typeUrl === ContinuousVestingAccount.typeUrl || typeof o.start_time === "bigint"); + }, + isAmino(o: any): o is ContinuousVestingAccountAmino { + return o && (o.$typeUrl === ContinuousVestingAccount.typeUrl || typeof o.start_time === "bigint"); + }, encode(message: ContinuousVestingAccount, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.baseVestingAccount !== undefined) { BaseVestingAccount.encode(message.baseVestingAccount, writer.uint32(10).fork()).ldelim(); @@ -575,6 +601,12 @@ export const ContinuousVestingAccount = { typeUrl: "/cosmos.vesting.v1beta1.ContinuousVestingAccount", value: ContinuousVestingAccount.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ContinuousVestingAccount.typeUrl)) { + return; + } + BaseVestingAccount.registerTypeUrl(); } }; function createBaseDelayedVestingAccount(): DelayedVestingAccount { @@ -593,6 +625,15 @@ function createBaseDelayedVestingAccount(): DelayedVestingAccount { export const DelayedVestingAccount = { typeUrl: "/cosmos.vesting.v1beta1.DelayedVestingAccount", aminoType: "cosmos-sdk/DelayedVestingAccount", + is(o: any): o is DelayedVestingAccount { + return o && o.$typeUrl === DelayedVestingAccount.typeUrl; + }, + isSDK(o: any): o is DelayedVestingAccountSDKType { + return o && o.$typeUrl === DelayedVestingAccount.typeUrl; + }, + isAmino(o: any): o is DelayedVestingAccountAmino { + return o && o.$typeUrl === DelayedVestingAccount.typeUrl; + }, encode(message: DelayedVestingAccount, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.baseVestingAccount !== undefined) { BaseVestingAccount.encode(message.baseVestingAccount, writer.uint32(10).fork()).ldelim(); @@ -675,6 +716,12 @@ export const DelayedVestingAccount = { typeUrl: "/cosmos.vesting.v1beta1.DelayedVestingAccount", value: DelayedVestingAccount.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(DelayedVestingAccount.typeUrl)) { + return; + } + BaseVestingAccount.registerTypeUrl(); } }; function createBasePeriod(): Period { @@ -692,6 +739,15 @@ function createBasePeriod(): Period { export const Period = { typeUrl: "/cosmos.vesting.v1beta1.Period", aminoType: "cosmos-sdk/Period", + is(o: any): o is Period { + return o && (o.$typeUrl === Period.typeUrl || typeof o.length === "bigint" && Array.isArray(o.amount) && (!o.amount.length || Coin.is(o.amount[0]))); + }, + isSDK(o: any): o is PeriodSDKType { + return o && (o.$typeUrl === Period.typeUrl || typeof o.length === "bigint" && Array.isArray(o.amount) && (!o.amount.length || Coin.isSDK(o.amount[0]))); + }, + isAmino(o: any): o is PeriodAmino { + return o && (o.$typeUrl === Period.typeUrl || typeof o.length === "bigint" && Array.isArray(o.amount) && (!o.amount.length || Coin.isAmino(o.amount[0]))); + }, encode(message: Period, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.length !== BigInt(0)) { writer.uint32(8).int64(message.length); @@ -799,6 +855,12 @@ export const Period = { typeUrl: "/cosmos.vesting.v1beta1.Period", value: Period.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Period.typeUrl)) { + return; + } + Coin.registerTypeUrl(); } }; function createBasePeriodicVestingAccount(): PeriodicVestingAccount { @@ -818,6 +880,15 @@ function createBasePeriodicVestingAccount(): PeriodicVestingAccount { export const PeriodicVestingAccount = { typeUrl: "/cosmos.vesting.v1beta1.PeriodicVestingAccount", aminoType: "cosmos-sdk/PeriodicVestingAccount", + is(o: any): o is PeriodicVestingAccount { + return o && (o.$typeUrl === PeriodicVestingAccount.typeUrl || typeof o.startTime === "bigint" && Array.isArray(o.vestingPeriods) && (!o.vestingPeriods.length || Period.is(o.vestingPeriods[0]))); + }, + isSDK(o: any): o is PeriodicVestingAccountSDKType { + return o && (o.$typeUrl === PeriodicVestingAccount.typeUrl || typeof o.start_time === "bigint" && Array.isArray(o.vesting_periods) && (!o.vesting_periods.length || Period.isSDK(o.vesting_periods[0]))); + }, + isAmino(o: any): o is PeriodicVestingAccountAmino { + return o && (o.$typeUrl === PeriodicVestingAccount.typeUrl || typeof o.start_time === "bigint" && Array.isArray(o.vesting_periods) && (!o.vesting_periods.length || Period.isAmino(o.vesting_periods[0]))); + }, encode(message: PeriodicVestingAccount, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.baseVestingAccount !== undefined) { BaseVestingAccount.encode(message.baseVestingAccount, writer.uint32(10).fork()).ldelim(); @@ -942,6 +1013,13 @@ export const PeriodicVestingAccount = { typeUrl: "/cosmos.vesting.v1beta1.PeriodicVestingAccount", value: PeriodicVestingAccount.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(PeriodicVestingAccount.typeUrl)) { + return; + } + BaseVestingAccount.registerTypeUrl(); + Period.registerTypeUrl(); } }; function createBasePermanentLockedAccount(): PermanentLockedAccount { @@ -962,6 +1040,15 @@ function createBasePermanentLockedAccount(): PermanentLockedAccount { export const PermanentLockedAccount = { typeUrl: "/cosmos.vesting.v1beta1.PermanentLockedAccount", aminoType: "cosmos-sdk/PermanentLockedAccount", + is(o: any): o is PermanentLockedAccount { + return o && o.$typeUrl === PermanentLockedAccount.typeUrl; + }, + isSDK(o: any): o is PermanentLockedAccountSDKType { + return o && o.$typeUrl === PermanentLockedAccount.typeUrl; + }, + isAmino(o: any): o is PermanentLockedAccountAmino { + return o && o.$typeUrl === PermanentLockedAccount.typeUrl; + }, encode(message: PermanentLockedAccount, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.baseVestingAccount !== undefined) { BaseVestingAccount.encode(message.baseVestingAccount, writer.uint32(10).fork()).ldelim(); @@ -1044,5 +1131,11 @@ export const PermanentLockedAccount = { typeUrl: "/cosmos.vesting.v1beta1.PermanentLockedAccount", value: PermanentLockedAccount.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(PermanentLockedAccount.typeUrl)) { + return; + } + BaseVestingAccount.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/cosmos_proto/cosmos.ts b/__fixtures__/v-next/outputv2/cosmos_proto/cosmos.ts index d907c73d4c..b5ea444cd6 100644 --- a/__fixtures__/v-next/outputv2/cosmos_proto/cosmos.ts +++ b/__fixtures__/v-next/outputv2/cosmos_proto/cosmos.ts @@ -209,6 +209,15 @@ function createBaseInterfaceDescriptor(): InterfaceDescriptor { */ export const InterfaceDescriptor = { typeUrl: "/cosmos_proto.InterfaceDescriptor", + is(o: any): o is InterfaceDescriptor { + return o && (o.$typeUrl === InterfaceDescriptor.typeUrl || typeof o.name === "string" && typeof o.description === "string"); + }, + isSDK(o: any): o is InterfaceDescriptorSDKType { + return o && (o.$typeUrl === InterfaceDescriptor.typeUrl || typeof o.name === "string" && typeof o.description === "string"); + }, + isAmino(o: any): o is InterfaceDescriptorAmino { + return o && (o.$typeUrl === InterfaceDescriptor.typeUrl || typeof o.name === "string" && typeof o.description === "string"); + }, encode(message: InterfaceDescriptor, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -298,7 +307,8 @@ export const InterfaceDescriptor = { typeUrl: "/cosmos_proto.InterfaceDescriptor", value: InterfaceDescriptor.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseScalarDescriptor(): ScalarDescriptor { return { @@ -321,6 +331,15 @@ function createBaseScalarDescriptor(): ScalarDescriptor { */ export const ScalarDescriptor = { typeUrl: "/cosmos_proto.ScalarDescriptor", + is(o: any): o is ScalarDescriptor { + return o && (o.$typeUrl === ScalarDescriptor.typeUrl || typeof o.name === "string" && typeof o.description === "string" && Array.isArray(o.fieldType)); + }, + isSDK(o: any): o is ScalarDescriptorSDKType { + return o && (o.$typeUrl === ScalarDescriptor.typeUrl || typeof o.name === "string" && typeof o.description === "string" && Array.isArray(o.field_type)); + }, + isAmino(o: any): o is ScalarDescriptorAmino { + return o && (o.$typeUrl === ScalarDescriptor.typeUrl || typeof o.name === "string" && typeof o.description === "string" && Array.isArray(o.field_type)); + }, encode(message: ScalarDescriptor, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -444,5 +463,6 @@ export const ScalarDescriptor = { typeUrl: "/cosmos_proto.ScalarDescriptor", value: ScalarDescriptor.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/cosmwasm/bundle.ts b/__fixtures__/v-next/outputv2/cosmwasm/bundle.ts index 9a437d296c..f55e61295c 100644 --- a/__fixtures__/v-next/outputv2/cosmwasm/bundle.ts +++ b/__fixtures__/v-next/outputv2/cosmwasm/bundle.ts @@ -4,14 +4,14 @@ import * as _149 from "./wasm/v1/proposal"; import * as _150 from "./wasm/v1/query"; import * as _151 from "./wasm/v1/tx"; import * as _152 from "./wasm/v1/types"; -import * as _433 from "./wasm/v1/tx.amino"; -import * as _434 from "./wasm/v1/tx.registry"; -import * as _435 from "./wasm/v1/query.lcd"; -import * as _436 from "./wasm/v1/query.rpc.Query"; -import * as _437 from "./wasm/v1/tx.rpc.msg"; -import * as _537 from "./lcd"; -import * as _538 from "./rpc.query"; -import * as _539 from "./rpc.tx"; +import * as _458 from "./wasm/v1/tx.amino"; +import * as _459 from "./wasm/v1/tx.registry"; +import * as _460 from "./wasm/v1/query.rpc.func"; +import * as _461 from "./wasm/v1/query.rpc.Query"; +import * as _462 from "./wasm/v1/tx.rpc.func"; +import * as _463 from "./wasm/v1/tx.rpc.msg"; +import * as _577 from "./rpc.query"; +import * as _578 from "./rpc.tx"; export namespace cosmwasm { export namespace wasm { export const v1 = { @@ -21,16 +21,16 @@ export namespace cosmwasm { ..._150, ..._151, ..._152, - ..._433, - ..._434, - ..._435, - ..._436, - ..._437 + ..._458, + ..._459, + ..._460, + ..._461, + ..._462, + ..._463 }; } export const ClientFactory = { - ..._537, - ..._538, - ..._539 + ..._577, + ..._578 }; } \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/cosmwasm/wasm/v1/genesis.ts b/__fixtures__/v-next/outputv2/cosmwasm/wasm/v1/genesis.ts index d1d94c6449..5d6c51198d 100644 --- a/__fixtures__/v-next/outputv2/cosmwasm/wasm/v1/genesis.ts +++ b/__fixtures__/v-next/outputv2/cosmwasm/wasm/v1/genesis.ts @@ -1,6 +1,7 @@ import { MsgStoreCode, MsgStoreCodeAmino, MsgStoreCodeSDKType, MsgInstantiateContract, MsgInstantiateContractAmino, MsgInstantiateContractSDKType, MsgExecuteContract, MsgExecuteContractAmino, MsgExecuteContractSDKType } from "./tx"; import { Params, ParamsAmino, ParamsSDKType, CodeInfo, CodeInfoAmino, CodeInfoSDKType, ContractInfo, ContractInfoAmino, ContractInfoSDKType, Model, ModelAmino, ModelSDKType } from "./types"; import { BinaryReader, BinaryWriter } from "../../../binary"; +import { GlobalDecoderRegistry } from "../../../registry"; import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "cosmwasm.wasm.v1"; @@ -242,6 +243,15 @@ function createBaseGenesisState(): GenesisState { export const GenesisState = { typeUrl: "/cosmwasm.wasm.v1.GenesisState", aminoType: "wasm/GenesisState", + is(o: any): o is GenesisState { + return o && (o.$typeUrl === GenesisState.typeUrl || Params.is(o.params) && Array.isArray(o.codes) && (!o.codes.length || Code.is(o.codes[0])) && Array.isArray(o.contracts) && (!o.contracts.length || Contract.is(o.contracts[0])) && Array.isArray(o.sequences) && (!o.sequences.length || Sequence.is(o.sequences[0])) && Array.isArray(o.genMsgs) && (!o.genMsgs.length || GenesisState_GenMsgs.is(o.genMsgs[0]))); + }, + isSDK(o: any): o is GenesisStateSDKType { + return o && (o.$typeUrl === GenesisState.typeUrl || Params.isSDK(o.params) && Array.isArray(o.codes) && (!o.codes.length || Code.isSDK(o.codes[0])) && Array.isArray(o.contracts) && (!o.contracts.length || Contract.isSDK(o.contracts[0])) && Array.isArray(o.sequences) && (!o.sequences.length || Sequence.isSDK(o.sequences[0])) && Array.isArray(o.gen_msgs) && (!o.gen_msgs.length || GenesisState_GenMsgs.isSDK(o.gen_msgs[0]))); + }, + isAmino(o: any): o is GenesisStateAmino { + return o && (o.$typeUrl === GenesisState.typeUrl || Params.isAmino(o.params) && Array.isArray(o.codes) && (!o.codes.length || Code.isAmino(o.codes[0])) && Array.isArray(o.contracts) && (!o.contracts.length || Contract.isAmino(o.contracts[0])) && Array.isArray(o.sequences) && (!o.sequences.length || Sequence.isAmino(o.sequences[0])) && Array.isArray(o.gen_msgs) && (!o.gen_msgs.length || GenesisState_GenMsgs.isAmino(o.gen_msgs[0]))); + }, encode(message: GenesisState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.params !== undefined) { Params.encode(message.params, writer.uint32(10).fork()).ldelim(); @@ -424,6 +434,16 @@ export const GenesisState = { typeUrl: "/cosmwasm.wasm.v1.GenesisState", value: GenesisState.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GenesisState.typeUrl)) { + return; + } + Params.registerTypeUrl(); + Code.registerTypeUrl(); + Contract.registerTypeUrl(); + Sequence.registerTypeUrl(); + GenesisState_GenMsgs.registerTypeUrl(); } }; function createBaseGenesisState_GenMsgs(): GenesisState_GenMsgs { @@ -443,6 +463,15 @@ function createBaseGenesisState_GenMsgs(): GenesisState_GenMsgs { export const GenesisState_GenMsgs = { typeUrl: "/cosmwasm.wasm.v1.GenMsgs", aminoType: "wasm/GenMsgs", + is(o: any): o is GenesisState_GenMsgs { + return o && o.$typeUrl === GenesisState_GenMsgs.typeUrl; + }, + isSDK(o: any): o is GenesisState_GenMsgsSDKType { + return o && o.$typeUrl === GenesisState_GenMsgs.typeUrl; + }, + isAmino(o: any): o is GenesisState_GenMsgsAmino { + return o && o.$typeUrl === GenesisState_GenMsgs.typeUrl; + }, encode(message: GenesisState_GenMsgs, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.storeCode !== undefined) { MsgStoreCode.encode(message.storeCode, writer.uint32(10).fork()).ldelim(); @@ -559,6 +588,14 @@ export const GenesisState_GenMsgs = { typeUrl: "/cosmwasm.wasm.v1.GenMsgs", value: GenesisState_GenMsgs.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GenesisState_GenMsgs.typeUrl)) { + return; + } + MsgStoreCode.registerTypeUrl(); + MsgInstantiateContract.registerTypeUrl(); + MsgExecuteContract.registerTypeUrl(); } }; function createBaseCode(): Code { @@ -578,6 +615,15 @@ function createBaseCode(): Code { export const Code = { typeUrl: "/cosmwasm.wasm.v1.Code", aminoType: "wasm/Code", + is(o: any): o is Code { + return o && (o.$typeUrl === Code.typeUrl || typeof o.codeId === "bigint" && CodeInfo.is(o.codeInfo) && (o.codeBytes instanceof Uint8Array || typeof o.codeBytes === "string") && typeof o.pinned === "boolean"); + }, + isSDK(o: any): o is CodeSDKType { + return o && (o.$typeUrl === Code.typeUrl || typeof o.code_id === "bigint" && CodeInfo.isSDK(o.code_info) && (o.code_bytes instanceof Uint8Array || typeof o.code_bytes === "string") && typeof o.pinned === "boolean"); + }, + isAmino(o: any): o is CodeAmino { + return o && (o.$typeUrl === Code.typeUrl || typeof o.code_id === "bigint" && CodeInfo.isAmino(o.code_info) && (o.code_bytes instanceof Uint8Array || typeof o.code_bytes === "string") && typeof o.pinned === "boolean"); + }, encode(message: Code, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.codeId !== BigInt(0)) { writer.uint32(8).uint64(message.codeId); @@ -707,6 +753,12 @@ export const Code = { typeUrl: "/cosmwasm.wasm.v1.Code", value: Code.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Code.typeUrl)) { + return; + } + CodeInfo.registerTypeUrl(); } }; function createBaseContract(): Contract { @@ -725,6 +777,15 @@ function createBaseContract(): Contract { export const Contract = { typeUrl: "/cosmwasm.wasm.v1.Contract", aminoType: "wasm/Contract", + is(o: any): o is Contract { + return o && (o.$typeUrl === Contract.typeUrl || typeof o.contractAddress === "string" && ContractInfo.is(o.contractInfo) && Array.isArray(o.contractState) && (!o.contractState.length || Model.is(o.contractState[0]))); + }, + isSDK(o: any): o is ContractSDKType { + return o && (o.$typeUrl === Contract.typeUrl || typeof o.contract_address === "string" && ContractInfo.isSDK(o.contract_info) && Array.isArray(o.contract_state) && (!o.contract_state.length || Model.isSDK(o.contract_state[0]))); + }, + isAmino(o: any): o is ContractAmino { + return o && (o.$typeUrl === Contract.typeUrl || typeof o.contract_address === "string" && ContractInfo.isAmino(o.contract_info) && Array.isArray(o.contract_state) && (!o.contract_state.length || Model.isAmino(o.contract_state[0]))); + }, encode(message: Contract, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.contractAddress !== "") { writer.uint32(10).string(message.contractAddress); @@ -847,6 +908,13 @@ export const Contract = { typeUrl: "/cosmwasm.wasm.v1.Contract", value: Contract.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Contract.typeUrl)) { + return; + } + ContractInfo.registerTypeUrl(); + Model.registerTypeUrl(); } }; function createBaseSequence(): Sequence { @@ -864,6 +932,15 @@ function createBaseSequence(): Sequence { export const Sequence = { typeUrl: "/cosmwasm.wasm.v1.Sequence", aminoType: "wasm/Sequence", + is(o: any): o is Sequence { + return o && (o.$typeUrl === Sequence.typeUrl || (o.idKey instanceof Uint8Array || typeof o.idKey === "string") && typeof o.value === "bigint"); + }, + isSDK(o: any): o is SequenceSDKType { + return o && (o.$typeUrl === Sequence.typeUrl || (o.id_key instanceof Uint8Array || typeof o.id_key === "string") && typeof o.value === "bigint"); + }, + isAmino(o: any): o is SequenceAmino { + return o && (o.$typeUrl === Sequence.typeUrl || (o.id_key instanceof Uint8Array || typeof o.id_key === "string") && typeof o.value === "bigint"); + }, encode(message: Sequence, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.idKey.length !== 0) { writer.uint32(10).bytes(message.idKey); @@ -961,5 +1038,6 @@ export const Sequence = { typeUrl: "/cosmwasm.wasm.v1.Sequence", value: Sequence.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/cosmwasm/wasm/v1/ibc.ts b/__fixtures__/v-next/outputv2/cosmwasm/wasm/v1/ibc.ts index 15ff497828..f4223a5eff 100644 --- a/__fixtures__/v-next/outputv2/cosmwasm/wasm/v1/ibc.ts +++ b/__fixtures__/v-next/outputv2/cosmwasm/wasm/v1/ibc.ts @@ -128,6 +128,15 @@ function createBaseMsgIBCSend(): MsgIBCSend { export const MsgIBCSend = { typeUrl: "/cosmwasm.wasm.v1.MsgIBCSend", aminoType: "wasm/MsgIBCSend", + is(o: any): o is MsgIBCSend { + return o && (o.$typeUrl === MsgIBCSend.typeUrl || typeof o.channel === "string" && typeof o.timeoutHeight === "bigint" && typeof o.timeoutTimestamp === "bigint" && (o.data instanceof Uint8Array || typeof o.data === "string")); + }, + isSDK(o: any): o is MsgIBCSendSDKType { + return o && (o.$typeUrl === MsgIBCSend.typeUrl || typeof o.channel === "string" && typeof o.timeout_height === "bigint" && typeof o.timeout_timestamp === "bigint" && (o.data instanceof Uint8Array || typeof o.data === "string")); + }, + isAmino(o: any): o is MsgIBCSendAmino { + return o && (o.$typeUrl === MsgIBCSend.typeUrl || typeof o.channel === "string" && typeof o.timeout_height === "bigint" && typeof o.timeout_timestamp === "bigint" && (o.data instanceof Uint8Array || typeof o.data === "string")); + }, encode(message: MsgIBCSend, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.channel !== "") { writer.uint32(18).string(message.channel); @@ -257,7 +266,8 @@ export const MsgIBCSend = { typeUrl: "/cosmwasm.wasm.v1.MsgIBCSend", value: MsgIBCSend.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgIBCCloseChannel(): MsgIBCCloseChannel { return { @@ -273,6 +283,15 @@ function createBaseMsgIBCCloseChannel(): MsgIBCCloseChannel { export const MsgIBCCloseChannel = { typeUrl: "/cosmwasm.wasm.v1.MsgIBCCloseChannel", aminoType: "wasm/MsgIBCCloseChannel", + is(o: any): o is MsgIBCCloseChannel { + return o && (o.$typeUrl === MsgIBCCloseChannel.typeUrl || typeof o.channel === "string"); + }, + isSDK(o: any): o is MsgIBCCloseChannelSDKType { + return o && (o.$typeUrl === MsgIBCCloseChannel.typeUrl || typeof o.channel === "string"); + }, + isAmino(o: any): o is MsgIBCCloseChannelAmino { + return o && (o.$typeUrl === MsgIBCCloseChannel.typeUrl || typeof o.channel === "string"); + }, encode(message: MsgIBCCloseChannel, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.channel !== "") { writer.uint32(18).string(message.channel); @@ -353,5 +372,6 @@ export const MsgIBCCloseChannel = { typeUrl: "/cosmwasm.wasm.v1.MsgIBCCloseChannel", value: MsgIBCCloseChannel.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/cosmwasm/wasm/v1/proposal.ts b/__fixtures__/v-next/outputv2/cosmwasm/wasm/v1/proposal.ts index 271586119b..6f9791aa1f 100644 --- a/__fixtures__/v-next/outputv2/cosmwasm/wasm/v1/proposal.ts +++ b/__fixtures__/v-next/outputv2/cosmwasm/wasm/v1/proposal.ts @@ -1,9 +1,10 @@ import { AccessConfig, AccessConfigAmino, AccessConfigSDKType } from "./types"; import { Coin, CoinAmino, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; +import { GlobalDecoderRegistry } from "../../../registry"; import { isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; -import { fromBase64, toBase64, toUtf8, fromUtf8 } from "@cosmjs/encoding"; +import { fromBase64, toBase64, toUtf8, fromUtf8 } from "@interchainjs/encoding"; export const protobufPackage = "cosmwasm.wasm.v1"; /** * StoreCodeProposal gov proposal content type to submit WASM code to the system @@ -695,6 +696,15 @@ function createBaseStoreCodeProposal(): StoreCodeProposal { export const StoreCodeProposal = { typeUrl: "/cosmwasm.wasm.v1.StoreCodeProposal", aminoType: "wasm/StoreCodeProposal", + is(o: any): o is StoreCodeProposal { + return o && (o.$typeUrl === StoreCodeProposal.typeUrl || typeof o.title === "string" && typeof o.description === "string" && typeof o.runAs === "string" && (o.wasmByteCode instanceof Uint8Array || typeof o.wasmByteCode === "string")); + }, + isSDK(o: any): o is StoreCodeProposalSDKType { + return o && (o.$typeUrl === StoreCodeProposal.typeUrl || typeof o.title === "string" && typeof o.description === "string" && typeof o.run_as === "string" && (o.wasm_byte_code instanceof Uint8Array || typeof o.wasm_byte_code === "string")); + }, + isAmino(o: any): o is StoreCodeProposalAmino { + return o && (o.$typeUrl === StoreCodeProposal.typeUrl || typeof o.title === "string" && typeof o.description === "string" && typeof o.run_as === "string" && (o.wasm_byte_code instanceof Uint8Array || typeof o.wasm_byte_code === "string")); + }, encode(message: StoreCodeProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.title !== "") { writer.uint32(10).string(message.title); @@ -837,6 +847,12 @@ export const StoreCodeProposal = { typeUrl: "/cosmwasm.wasm.v1.StoreCodeProposal", value: StoreCodeProposal.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(StoreCodeProposal.typeUrl)) { + return; + } + AccessConfig.registerTypeUrl(); } }; function createBaseInstantiateContractProposal(): InstantiateContractProposal { @@ -861,6 +877,15 @@ function createBaseInstantiateContractProposal(): InstantiateContractProposal { export const InstantiateContractProposal = { typeUrl: "/cosmwasm.wasm.v1.InstantiateContractProposal", aminoType: "wasm/InstantiateContractProposal", + is(o: any): o is InstantiateContractProposal { + return o && (o.$typeUrl === InstantiateContractProposal.typeUrl || typeof o.title === "string" && typeof o.description === "string" && typeof o.runAs === "string" && typeof o.admin === "string" && typeof o.codeId === "bigint" && typeof o.label === "string" && (o.msg instanceof Uint8Array || typeof o.msg === "string") && Array.isArray(o.funds) && (!o.funds.length || Coin.is(o.funds[0]))); + }, + isSDK(o: any): o is InstantiateContractProposalSDKType { + return o && (o.$typeUrl === InstantiateContractProposal.typeUrl || typeof o.title === "string" && typeof o.description === "string" && typeof o.run_as === "string" && typeof o.admin === "string" && typeof o.code_id === "bigint" && typeof o.label === "string" && (o.msg instanceof Uint8Array || typeof o.msg === "string") && Array.isArray(o.funds) && (!o.funds.length || Coin.isSDK(o.funds[0]))); + }, + isAmino(o: any): o is InstantiateContractProposalAmino { + return o && (o.$typeUrl === InstantiateContractProposal.typeUrl || typeof o.title === "string" && typeof o.description === "string" && typeof o.run_as === "string" && typeof o.admin === "string" && typeof o.code_id === "bigint" && typeof o.label === "string" && (o.msg instanceof Uint8Array || typeof o.msg === "string") && Array.isArray(o.funds) && (!o.funds.length || Coin.isAmino(o.funds[0]))); + }, encode(message: InstantiateContractProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.title !== "") { writer.uint32(10).string(message.title); @@ -1058,6 +1083,12 @@ export const InstantiateContractProposal = { typeUrl: "/cosmwasm.wasm.v1.InstantiateContractProposal", value: InstantiateContractProposal.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(InstantiateContractProposal.typeUrl)) { + return; + } + Coin.registerTypeUrl(); } }; function createBaseMigrateContractProposal(): MigrateContractProposal { @@ -1078,6 +1109,15 @@ function createBaseMigrateContractProposal(): MigrateContractProposal { export const MigrateContractProposal = { typeUrl: "/cosmwasm.wasm.v1.MigrateContractProposal", aminoType: "wasm/MigrateContractProposal", + is(o: any): o is MigrateContractProposal { + return o && (o.$typeUrl === MigrateContractProposal.typeUrl || typeof o.title === "string" && typeof o.description === "string" && typeof o.contract === "string" && typeof o.codeId === "bigint" && (o.msg instanceof Uint8Array || typeof o.msg === "string")); + }, + isSDK(o: any): o is MigrateContractProposalSDKType { + return o && (o.$typeUrl === MigrateContractProposal.typeUrl || typeof o.title === "string" && typeof o.description === "string" && typeof o.contract === "string" && typeof o.code_id === "bigint" && (o.msg instanceof Uint8Array || typeof o.msg === "string")); + }, + isAmino(o: any): o is MigrateContractProposalAmino { + return o && (o.$typeUrl === MigrateContractProposal.typeUrl || typeof o.title === "string" && typeof o.description === "string" && typeof o.contract === "string" && typeof o.code_id === "bigint" && (o.msg instanceof Uint8Array || typeof o.msg === "string")); + }, encode(message: MigrateContractProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.title !== "") { writer.uint32(10).string(message.title); @@ -1220,7 +1260,8 @@ export const MigrateContractProposal = { typeUrl: "/cosmwasm.wasm.v1.MigrateContractProposal", value: MigrateContractProposal.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseSudoContractProposal(): SudoContractProposal { return { @@ -1239,6 +1280,15 @@ function createBaseSudoContractProposal(): SudoContractProposal { export const SudoContractProposal = { typeUrl: "/cosmwasm.wasm.v1.SudoContractProposal", aminoType: "wasm/SudoContractProposal", + is(o: any): o is SudoContractProposal { + return o && (o.$typeUrl === SudoContractProposal.typeUrl || typeof o.title === "string" && typeof o.description === "string" && typeof o.contract === "string" && (o.msg instanceof Uint8Array || typeof o.msg === "string")); + }, + isSDK(o: any): o is SudoContractProposalSDKType { + return o && (o.$typeUrl === SudoContractProposal.typeUrl || typeof o.title === "string" && typeof o.description === "string" && typeof o.contract === "string" && (o.msg instanceof Uint8Array || typeof o.msg === "string")); + }, + isAmino(o: any): o is SudoContractProposalAmino { + return o && (o.$typeUrl === SudoContractProposal.typeUrl || typeof o.title === "string" && typeof o.description === "string" && typeof o.contract === "string" && (o.msg instanceof Uint8Array || typeof o.msg === "string")); + }, encode(message: SudoContractProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.title !== "") { writer.uint32(10).string(message.title); @@ -1364,7 +1414,8 @@ export const SudoContractProposal = { typeUrl: "/cosmwasm.wasm.v1.SudoContractProposal", value: SudoContractProposal.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseExecuteContractProposal(): ExecuteContractProposal { return { @@ -1386,6 +1437,15 @@ function createBaseExecuteContractProposal(): ExecuteContractProposal { export const ExecuteContractProposal = { typeUrl: "/cosmwasm.wasm.v1.ExecuteContractProposal", aminoType: "wasm/ExecuteContractProposal", + is(o: any): o is ExecuteContractProposal { + return o && (o.$typeUrl === ExecuteContractProposal.typeUrl || typeof o.title === "string" && typeof o.description === "string" && typeof o.runAs === "string" && typeof o.contract === "string" && (o.msg instanceof Uint8Array || typeof o.msg === "string") && Array.isArray(o.funds) && (!o.funds.length || Coin.is(o.funds[0]))); + }, + isSDK(o: any): o is ExecuteContractProposalSDKType { + return o && (o.$typeUrl === ExecuteContractProposal.typeUrl || typeof o.title === "string" && typeof o.description === "string" && typeof o.run_as === "string" && typeof o.contract === "string" && (o.msg instanceof Uint8Array || typeof o.msg === "string") && Array.isArray(o.funds) && (!o.funds.length || Coin.isSDK(o.funds[0]))); + }, + isAmino(o: any): o is ExecuteContractProposalAmino { + return o && (o.$typeUrl === ExecuteContractProposal.typeUrl || typeof o.title === "string" && typeof o.description === "string" && typeof o.run_as === "string" && typeof o.contract === "string" && (o.msg instanceof Uint8Array || typeof o.msg === "string") && Array.isArray(o.funds) && (!o.funds.length || Coin.isAmino(o.funds[0]))); + }, encode(message: ExecuteContractProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.title !== "") { writer.uint32(10).string(message.title); @@ -1551,6 +1611,12 @@ export const ExecuteContractProposal = { typeUrl: "/cosmwasm.wasm.v1.ExecuteContractProposal", value: ExecuteContractProposal.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ExecuteContractProposal.typeUrl)) { + return; + } + Coin.registerTypeUrl(); } }; function createBaseUpdateAdminProposal(): UpdateAdminProposal { @@ -1570,6 +1636,15 @@ function createBaseUpdateAdminProposal(): UpdateAdminProposal { export const UpdateAdminProposal = { typeUrl: "/cosmwasm.wasm.v1.UpdateAdminProposal", aminoType: "wasm/UpdateAdminProposal", + is(o: any): o is UpdateAdminProposal { + return o && (o.$typeUrl === UpdateAdminProposal.typeUrl || typeof o.title === "string" && typeof o.description === "string" && typeof o.newAdmin === "string" && typeof o.contract === "string"); + }, + isSDK(o: any): o is UpdateAdminProposalSDKType { + return o && (o.$typeUrl === UpdateAdminProposal.typeUrl || typeof o.title === "string" && typeof o.description === "string" && typeof o.new_admin === "string" && typeof o.contract === "string"); + }, + isAmino(o: any): o is UpdateAdminProposalAmino { + return o && (o.$typeUrl === UpdateAdminProposal.typeUrl || typeof o.title === "string" && typeof o.description === "string" && typeof o.new_admin === "string" && typeof o.contract === "string"); + }, encode(message: UpdateAdminProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.title !== "") { writer.uint32(10).string(message.title); @@ -1695,7 +1770,8 @@ export const UpdateAdminProposal = { typeUrl: "/cosmwasm.wasm.v1.UpdateAdminProposal", value: UpdateAdminProposal.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseClearAdminProposal(): ClearAdminProposal { return { @@ -1714,6 +1790,15 @@ function createBaseClearAdminProposal(): ClearAdminProposal { export const ClearAdminProposal = { typeUrl: "/cosmwasm.wasm.v1.ClearAdminProposal", aminoType: "wasm/ClearAdminProposal", + is(o: any): o is ClearAdminProposal { + return o && (o.$typeUrl === ClearAdminProposal.typeUrl || typeof o.title === "string" && typeof o.description === "string" && typeof o.contract === "string"); + }, + isSDK(o: any): o is ClearAdminProposalSDKType { + return o && (o.$typeUrl === ClearAdminProposal.typeUrl || typeof o.title === "string" && typeof o.description === "string" && typeof o.contract === "string"); + }, + isAmino(o: any): o is ClearAdminProposalAmino { + return o && (o.$typeUrl === ClearAdminProposal.typeUrl || typeof o.title === "string" && typeof o.description === "string" && typeof o.contract === "string"); + }, encode(message: ClearAdminProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.title !== "") { writer.uint32(10).string(message.title); @@ -1824,7 +1909,8 @@ export const ClearAdminProposal = { typeUrl: "/cosmwasm.wasm.v1.ClearAdminProposal", value: ClearAdminProposal.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBasePinCodesProposal(): PinCodesProposal { return { @@ -1843,6 +1929,15 @@ function createBasePinCodesProposal(): PinCodesProposal { export const PinCodesProposal = { typeUrl: "/cosmwasm.wasm.v1.PinCodesProposal", aminoType: "wasm/PinCodesProposal", + is(o: any): o is PinCodesProposal { + return o && (o.$typeUrl === PinCodesProposal.typeUrl || typeof o.title === "string" && typeof o.description === "string" && Array.isArray(o.codeIds) && (!o.codeIds.length || typeof o.codeIds[0] === "bigint")); + }, + isSDK(o: any): o is PinCodesProposalSDKType { + return o && (o.$typeUrl === PinCodesProposal.typeUrl || typeof o.title === "string" && typeof o.description === "string" && Array.isArray(o.code_ids) && (!o.code_ids.length || typeof o.code_ids[0] === "bigint")); + }, + isAmino(o: any): o is PinCodesProposalAmino { + return o && (o.$typeUrl === PinCodesProposal.typeUrl || typeof o.title === "string" && typeof o.description === "string" && Array.isArray(o.code_ids) && (!o.code_ids.length || typeof o.code_ids[0] === "bigint")); + }, encode(message: PinCodesProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.title !== "") { writer.uint32(10).string(message.title); @@ -1972,7 +2067,8 @@ export const PinCodesProposal = { typeUrl: "/cosmwasm.wasm.v1.PinCodesProposal", value: PinCodesProposal.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseUnpinCodesProposal(): UnpinCodesProposal { return { @@ -1991,6 +2087,15 @@ function createBaseUnpinCodesProposal(): UnpinCodesProposal { export const UnpinCodesProposal = { typeUrl: "/cosmwasm.wasm.v1.UnpinCodesProposal", aminoType: "wasm/UnpinCodesProposal", + is(o: any): o is UnpinCodesProposal { + return o && (o.$typeUrl === UnpinCodesProposal.typeUrl || typeof o.title === "string" && typeof o.description === "string" && Array.isArray(o.codeIds) && (!o.codeIds.length || typeof o.codeIds[0] === "bigint")); + }, + isSDK(o: any): o is UnpinCodesProposalSDKType { + return o && (o.$typeUrl === UnpinCodesProposal.typeUrl || typeof o.title === "string" && typeof o.description === "string" && Array.isArray(o.code_ids) && (!o.code_ids.length || typeof o.code_ids[0] === "bigint")); + }, + isAmino(o: any): o is UnpinCodesProposalAmino { + return o && (o.$typeUrl === UnpinCodesProposal.typeUrl || typeof o.title === "string" && typeof o.description === "string" && Array.isArray(o.code_ids) && (!o.code_ids.length || typeof o.code_ids[0] === "bigint")); + }, encode(message: UnpinCodesProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.title !== "") { writer.uint32(10).string(message.title); @@ -2120,5 +2225,6 @@ export const UnpinCodesProposal = { typeUrl: "/cosmwasm.wasm.v1.UnpinCodesProposal", value: UnpinCodesProposal.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/cosmwasm/wasm/v1/query.rpc.func.ts b/__fixtures__/v-next/outputv2/cosmwasm/wasm/v1/query.rpc.func.ts new file mode 100644 index 0000000000..ea8246791b --- /dev/null +++ b/__fixtures__/v-next/outputv2/cosmwasm/wasm/v1/query.rpc.func.ts @@ -0,0 +1,119 @@ +import { buildQuery } from "../../../helper-func-types"; +import { QueryContractInfoRequest, QueryContractInfoResponse, QueryContractHistoryRequest, QueryContractHistoryResponse, QueryContractsByCodeRequest, QueryContractsByCodeResponse, QueryAllContractStateRequest, QueryAllContractStateResponse, QueryRawContractStateRequest, QueryRawContractStateResponse, QuerySmartContractStateRequest, QuerySmartContractStateResponse, QueryCodeRequest, QueryCodeResponse, QueryCodesRequest, QueryCodesResponse, QueryPinnedCodesRequest, QueryPinnedCodesResponse } from "./query"; +/** + * ContractInfo gets the contract meta data + * @name getContractInfo + * @package cosmwasm.wasm.v1 + * @see proto service: cosmwasm.wasm.v1.ContractInfo + */ +export const getContractInfo = buildQuery({ + encode: QueryContractInfoRequest.encode, + decode: QueryContractInfoResponse.decode, + service: "cosmwasm.wasm.v1.Query", + method: "ContractInfo", + deps: [QueryContractInfoRequest, QueryContractInfoResponse] +}); +/** + * ContractHistory gets the contract code history + * @name getContractHistory + * @package cosmwasm.wasm.v1 + * @see proto service: cosmwasm.wasm.v1.ContractHistory + */ +export const getContractHistory = buildQuery({ + encode: QueryContractHistoryRequest.encode, + decode: QueryContractHistoryResponse.decode, + service: "cosmwasm.wasm.v1.Query", + method: "ContractHistory", + deps: [QueryContractHistoryRequest, QueryContractHistoryResponse] +}); +/** + * ContractsByCode lists all smart contracts for a code id + * @name getContractsByCode + * @package cosmwasm.wasm.v1 + * @see proto service: cosmwasm.wasm.v1.ContractsByCode + */ +export const getContractsByCode = buildQuery({ + encode: QueryContractsByCodeRequest.encode, + decode: QueryContractsByCodeResponse.decode, + service: "cosmwasm.wasm.v1.Query", + method: "ContractsByCode", + deps: [QueryContractsByCodeRequest, QueryContractsByCodeResponse] +}); +/** + * AllContractState gets all raw store data for a single contract + * @name getAllContractState + * @package cosmwasm.wasm.v1 + * @see proto service: cosmwasm.wasm.v1.AllContractState + */ +export const getAllContractState = buildQuery({ + encode: QueryAllContractStateRequest.encode, + decode: QueryAllContractStateResponse.decode, + service: "cosmwasm.wasm.v1.Query", + method: "AllContractState", + deps: [QueryAllContractStateRequest, QueryAllContractStateResponse] +}); +/** + * RawContractState gets single key from the raw store data of a contract + * @name getRawContractState + * @package cosmwasm.wasm.v1 + * @see proto service: cosmwasm.wasm.v1.RawContractState + */ +export const getRawContractState = buildQuery({ + encode: QueryRawContractStateRequest.encode, + decode: QueryRawContractStateResponse.decode, + service: "cosmwasm.wasm.v1.Query", + method: "RawContractState", + deps: [QueryRawContractStateRequest, QueryRawContractStateResponse] +}); +/** + * SmartContractState get smart query result from the contract + * @name getSmartContractState + * @package cosmwasm.wasm.v1 + * @see proto service: cosmwasm.wasm.v1.SmartContractState + */ +export const getSmartContractState = buildQuery({ + encode: QuerySmartContractStateRequest.encode, + decode: QuerySmartContractStateResponse.decode, + service: "cosmwasm.wasm.v1.Query", + method: "SmartContractState", + deps: [QuerySmartContractStateRequest, QuerySmartContractStateResponse] +}); +/** + * Code gets the binary code and metadata for a singe wasm code + * @name getCode + * @package cosmwasm.wasm.v1 + * @see proto service: cosmwasm.wasm.v1.Code + */ +export const getCode = buildQuery({ + encode: QueryCodeRequest.encode, + decode: QueryCodeResponse.decode, + service: "cosmwasm.wasm.v1.Query", + method: "Code", + deps: [QueryCodeRequest, QueryCodeResponse] +}); +/** + * Codes gets the metadata for all stored wasm codes + * @name getCodes + * @package cosmwasm.wasm.v1 + * @see proto service: cosmwasm.wasm.v1.Codes + */ +export const getCodes = buildQuery({ + encode: QueryCodesRequest.encode, + decode: QueryCodesResponse.decode, + service: "cosmwasm.wasm.v1.Query", + method: "Codes", + deps: [QueryCodesRequest, QueryCodesResponse] +}); +/** + * PinnedCodes gets the pinned code ids + * @name getPinnedCodes + * @package cosmwasm.wasm.v1 + * @see proto service: cosmwasm.wasm.v1.PinnedCodes + */ +export const getPinnedCodes = buildQuery({ + encode: QueryPinnedCodesRequest.encode, + decode: QueryPinnedCodesResponse.decode, + service: "cosmwasm.wasm.v1.Query", + method: "PinnedCodes", + deps: [QueryPinnedCodesRequest, QueryPinnedCodesResponse] +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/cosmwasm/wasm/v1/query.ts b/__fixtures__/v-next/outputv2/cosmwasm/wasm/v1/query.ts index 3dd430e8ec..caf2a0b7d6 100644 --- a/__fixtures__/v-next/outputv2/cosmwasm/wasm/v1/query.ts +++ b/__fixtures__/v-next/outputv2/cosmwasm/wasm/v1/query.ts @@ -3,7 +3,8 @@ import { ContractInfo, ContractInfoAmino, ContractInfoSDKType, ContractCodeHisto import { BinaryReader, BinaryWriter } from "../../../binary"; import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; -import { toUtf8, fromUtf8 } from "@cosmjs/encoding"; +import { GlobalDecoderRegistry } from "../../../registry"; +import { toUtf8, fromUtf8 } from "@interchainjs/encoding"; export const protobufPackage = "cosmwasm.wasm.v1"; /** * QueryContractInfoRequest is the request type for the Query/ContractInfo RPC @@ -901,6 +902,15 @@ function createBaseQueryContractInfoRequest(): QueryContractInfoRequest { export const QueryContractInfoRequest = { typeUrl: "/cosmwasm.wasm.v1.QueryContractInfoRequest", aminoType: "wasm/QueryContractInfoRequest", + is(o: any): o is QueryContractInfoRequest { + return o && (o.$typeUrl === QueryContractInfoRequest.typeUrl || typeof o.address === "string"); + }, + isSDK(o: any): o is QueryContractInfoRequestSDKType { + return o && (o.$typeUrl === QueryContractInfoRequest.typeUrl || typeof o.address === "string"); + }, + isAmino(o: any): o is QueryContractInfoRequestAmino { + return o && (o.$typeUrl === QueryContractInfoRequest.typeUrl || typeof o.address === "string"); + }, encode(message: QueryContractInfoRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.address !== "") { writer.uint32(10).string(message.address); @@ -981,7 +991,8 @@ export const QueryContractInfoRequest = { typeUrl: "/cosmwasm.wasm.v1.QueryContractInfoRequest", value: QueryContractInfoRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryContractInfoResponse(): QueryContractInfoResponse { return { @@ -999,6 +1010,15 @@ function createBaseQueryContractInfoResponse(): QueryContractInfoResponse { export const QueryContractInfoResponse = { typeUrl: "/cosmwasm.wasm.v1.QueryContractInfoResponse", aminoType: "wasm/QueryContractInfoResponse", + is(o: any): o is QueryContractInfoResponse { + return o && (o.$typeUrl === QueryContractInfoResponse.typeUrl || typeof o.address === "string" && ContractInfo.is(o.contractInfo)); + }, + isSDK(o: any): o is QueryContractInfoResponseSDKType { + return o && (o.$typeUrl === QueryContractInfoResponse.typeUrl || typeof o.address === "string" && ContractInfo.isSDK(o.contract_info)); + }, + isAmino(o: any): o is QueryContractInfoResponseAmino { + return o && (o.$typeUrl === QueryContractInfoResponse.typeUrl || typeof o.address === "string" && ContractInfo.isAmino(o.contract_info)); + }, encode(message: QueryContractInfoResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.address !== "") { writer.uint32(10).string(message.address); @@ -1096,6 +1116,12 @@ export const QueryContractInfoResponse = { typeUrl: "/cosmwasm.wasm.v1.QueryContractInfoResponse", value: QueryContractInfoResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryContractInfoResponse.typeUrl)) { + return; + } + ContractInfo.registerTypeUrl(); } }; function createBaseQueryContractHistoryRequest(): QueryContractHistoryRequest { @@ -1114,6 +1140,15 @@ function createBaseQueryContractHistoryRequest(): QueryContractHistoryRequest { export const QueryContractHistoryRequest = { typeUrl: "/cosmwasm.wasm.v1.QueryContractHistoryRequest", aminoType: "wasm/QueryContractHistoryRequest", + is(o: any): o is QueryContractHistoryRequest { + return o && (o.$typeUrl === QueryContractHistoryRequest.typeUrl || typeof o.address === "string"); + }, + isSDK(o: any): o is QueryContractHistoryRequestSDKType { + return o && (o.$typeUrl === QueryContractHistoryRequest.typeUrl || typeof o.address === "string"); + }, + isAmino(o: any): o is QueryContractHistoryRequestAmino { + return o && (o.$typeUrl === QueryContractHistoryRequest.typeUrl || typeof o.address === "string"); + }, encode(message: QueryContractHistoryRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.address !== "") { writer.uint32(10).string(message.address); @@ -1211,6 +1246,12 @@ export const QueryContractHistoryRequest = { typeUrl: "/cosmwasm.wasm.v1.QueryContractHistoryRequest", value: QueryContractHistoryRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryContractHistoryRequest.typeUrl)) { + return; + } + PageRequest.registerTypeUrl(); } }; function createBaseQueryContractHistoryResponse(): QueryContractHistoryResponse { @@ -1229,6 +1270,15 @@ function createBaseQueryContractHistoryResponse(): QueryContractHistoryResponse export const QueryContractHistoryResponse = { typeUrl: "/cosmwasm.wasm.v1.QueryContractHistoryResponse", aminoType: "wasm/QueryContractHistoryResponse", + is(o: any): o is QueryContractHistoryResponse { + return o && (o.$typeUrl === QueryContractHistoryResponse.typeUrl || Array.isArray(o.entries) && (!o.entries.length || ContractCodeHistoryEntry.is(o.entries[0]))); + }, + isSDK(o: any): o is QueryContractHistoryResponseSDKType { + return o && (o.$typeUrl === QueryContractHistoryResponse.typeUrl || Array.isArray(o.entries) && (!o.entries.length || ContractCodeHistoryEntry.isSDK(o.entries[0]))); + }, + isAmino(o: any): o is QueryContractHistoryResponseAmino { + return o && (o.$typeUrl === QueryContractHistoryResponse.typeUrl || Array.isArray(o.entries) && (!o.entries.length || ContractCodeHistoryEntry.isAmino(o.entries[0]))); + }, encode(message: QueryContractHistoryResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.entries) { ContractCodeHistoryEntry.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -1336,6 +1386,13 @@ export const QueryContractHistoryResponse = { typeUrl: "/cosmwasm.wasm.v1.QueryContractHistoryResponse", value: QueryContractHistoryResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryContractHistoryResponse.typeUrl)) { + return; + } + ContractCodeHistoryEntry.registerTypeUrl(); + PageResponse.registerTypeUrl(); } }; function createBaseQueryContractsByCodeRequest(): QueryContractsByCodeRequest { @@ -1354,6 +1411,15 @@ function createBaseQueryContractsByCodeRequest(): QueryContractsByCodeRequest { export const QueryContractsByCodeRequest = { typeUrl: "/cosmwasm.wasm.v1.QueryContractsByCodeRequest", aminoType: "wasm/QueryContractsByCodeRequest", + is(o: any): o is QueryContractsByCodeRequest { + return o && (o.$typeUrl === QueryContractsByCodeRequest.typeUrl || typeof o.codeId === "bigint"); + }, + isSDK(o: any): o is QueryContractsByCodeRequestSDKType { + return o && (o.$typeUrl === QueryContractsByCodeRequest.typeUrl || typeof o.code_id === "bigint"); + }, + isAmino(o: any): o is QueryContractsByCodeRequestAmino { + return o && (o.$typeUrl === QueryContractsByCodeRequest.typeUrl || typeof o.code_id === "bigint"); + }, encode(message: QueryContractsByCodeRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.codeId !== BigInt(0)) { writer.uint32(8).uint64(message.codeId); @@ -1453,6 +1519,12 @@ export const QueryContractsByCodeRequest = { typeUrl: "/cosmwasm.wasm.v1.QueryContractsByCodeRequest", value: QueryContractsByCodeRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryContractsByCodeRequest.typeUrl)) { + return; + } + PageRequest.registerTypeUrl(); } }; function createBaseQueryContractsByCodeResponse(): QueryContractsByCodeResponse { @@ -1471,6 +1543,15 @@ function createBaseQueryContractsByCodeResponse(): QueryContractsByCodeResponse export const QueryContractsByCodeResponse = { typeUrl: "/cosmwasm.wasm.v1.QueryContractsByCodeResponse", aminoType: "wasm/QueryContractsByCodeResponse", + is(o: any): o is QueryContractsByCodeResponse { + return o && (o.$typeUrl === QueryContractsByCodeResponse.typeUrl || Array.isArray(o.contracts) && (!o.contracts.length || typeof o.contracts[0] === "string")); + }, + isSDK(o: any): o is QueryContractsByCodeResponseSDKType { + return o && (o.$typeUrl === QueryContractsByCodeResponse.typeUrl || Array.isArray(o.contracts) && (!o.contracts.length || typeof o.contracts[0] === "string")); + }, + isAmino(o: any): o is QueryContractsByCodeResponseAmino { + return o && (o.$typeUrl === QueryContractsByCodeResponse.typeUrl || Array.isArray(o.contracts) && (!o.contracts.length || typeof o.contracts[0] === "string")); + }, encode(message: QueryContractsByCodeResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.contracts) { writer.uint32(10).string(v!); @@ -1578,6 +1659,12 @@ export const QueryContractsByCodeResponse = { typeUrl: "/cosmwasm.wasm.v1.QueryContractsByCodeResponse", value: QueryContractsByCodeResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryContractsByCodeResponse.typeUrl)) { + return; + } + PageResponse.registerTypeUrl(); } }; function createBaseQueryAllContractStateRequest(): QueryAllContractStateRequest { @@ -1596,6 +1683,15 @@ function createBaseQueryAllContractStateRequest(): QueryAllContractStateRequest export const QueryAllContractStateRequest = { typeUrl: "/cosmwasm.wasm.v1.QueryAllContractStateRequest", aminoType: "wasm/QueryAllContractStateRequest", + is(o: any): o is QueryAllContractStateRequest { + return o && (o.$typeUrl === QueryAllContractStateRequest.typeUrl || typeof o.address === "string"); + }, + isSDK(o: any): o is QueryAllContractStateRequestSDKType { + return o && (o.$typeUrl === QueryAllContractStateRequest.typeUrl || typeof o.address === "string"); + }, + isAmino(o: any): o is QueryAllContractStateRequestAmino { + return o && (o.$typeUrl === QueryAllContractStateRequest.typeUrl || typeof o.address === "string"); + }, encode(message: QueryAllContractStateRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.address !== "") { writer.uint32(10).string(message.address); @@ -1693,6 +1789,12 @@ export const QueryAllContractStateRequest = { typeUrl: "/cosmwasm.wasm.v1.QueryAllContractStateRequest", value: QueryAllContractStateRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryAllContractStateRequest.typeUrl)) { + return; + } + PageRequest.registerTypeUrl(); } }; function createBaseQueryAllContractStateResponse(): QueryAllContractStateResponse { @@ -1711,6 +1813,15 @@ function createBaseQueryAllContractStateResponse(): QueryAllContractStateRespons export const QueryAllContractStateResponse = { typeUrl: "/cosmwasm.wasm.v1.QueryAllContractStateResponse", aminoType: "wasm/QueryAllContractStateResponse", + is(o: any): o is QueryAllContractStateResponse { + return o && (o.$typeUrl === QueryAllContractStateResponse.typeUrl || Array.isArray(o.models) && (!o.models.length || Model.is(o.models[0]))); + }, + isSDK(o: any): o is QueryAllContractStateResponseSDKType { + return o && (o.$typeUrl === QueryAllContractStateResponse.typeUrl || Array.isArray(o.models) && (!o.models.length || Model.isSDK(o.models[0]))); + }, + isAmino(o: any): o is QueryAllContractStateResponseAmino { + return o && (o.$typeUrl === QueryAllContractStateResponse.typeUrl || Array.isArray(o.models) && (!o.models.length || Model.isAmino(o.models[0]))); + }, encode(message: QueryAllContractStateResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.models) { Model.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -1818,6 +1929,13 @@ export const QueryAllContractStateResponse = { typeUrl: "/cosmwasm.wasm.v1.QueryAllContractStateResponse", value: QueryAllContractStateResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryAllContractStateResponse.typeUrl)) { + return; + } + Model.registerTypeUrl(); + PageResponse.registerTypeUrl(); } }; function createBaseQueryRawContractStateRequest(): QueryRawContractStateRequest { @@ -1836,6 +1954,15 @@ function createBaseQueryRawContractStateRequest(): QueryRawContractStateRequest export const QueryRawContractStateRequest = { typeUrl: "/cosmwasm.wasm.v1.QueryRawContractStateRequest", aminoType: "wasm/QueryRawContractStateRequest", + is(o: any): o is QueryRawContractStateRequest { + return o && (o.$typeUrl === QueryRawContractStateRequest.typeUrl || typeof o.address === "string" && (o.queryData instanceof Uint8Array || typeof o.queryData === "string")); + }, + isSDK(o: any): o is QueryRawContractStateRequestSDKType { + return o && (o.$typeUrl === QueryRawContractStateRequest.typeUrl || typeof o.address === "string" && (o.query_data instanceof Uint8Array || typeof o.query_data === "string")); + }, + isAmino(o: any): o is QueryRawContractStateRequestAmino { + return o && (o.$typeUrl === QueryRawContractStateRequest.typeUrl || typeof o.address === "string" && (o.query_data instanceof Uint8Array || typeof o.query_data === "string")); + }, encode(message: QueryRawContractStateRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.address !== "") { writer.uint32(10).string(message.address); @@ -1931,7 +2058,8 @@ export const QueryRawContractStateRequest = { typeUrl: "/cosmwasm.wasm.v1.QueryRawContractStateRequest", value: QueryRawContractStateRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryRawContractStateResponse(): QueryRawContractStateResponse { return { @@ -1948,6 +2076,15 @@ function createBaseQueryRawContractStateResponse(): QueryRawContractStateRespons export const QueryRawContractStateResponse = { typeUrl: "/cosmwasm.wasm.v1.QueryRawContractStateResponse", aminoType: "wasm/QueryRawContractStateResponse", + is(o: any): o is QueryRawContractStateResponse { + return o && (o.$typeUrl === QueryRawContractStateResponse.typeUrl || o.data instanceof Uint8Array || typeof o.data === "string"); + }, + isSDK(o: any): o is QueryRawContractStateResponseSDKType { + return o && (o.$typeUrl === QueryRawContractStateResponse.typeUrl || o.data instanceof Uint8Array || typeof o.data === "string"); + }, + isAmino(o: any): o is QueryRawContractStateResponseAmino { + return o && (o.$typeUrl === QueryRawContractStateResponse.typeUrl || o.data instanceof Uint8Array || typeof o.data === "string"); + }, encode(message: QueryRawContractStateResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.data.length !== 0) { writer.uint32(10).bytes(message.data); @@ -2028,7 +2165,8 @@ export const QueryRawContractStateResponse = { typeUrl: "/cosmwasm.wasm.v1.QueryRawContractStateResponse", value: QueryRawContractStateResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQuerySmartContractStateRequest(): QuerySmartContractStateRequest { return { @@ -2046,6 +2184,15 @@ function createBaseQuerySmartContractStateRequest(): QuerySmartContractStateRequ export const QuerySmartContractStateRequest = { typeUrl: "/cosmwasm.wasm.v1.QuerySmartContractStateRequest", aminoType: "wasm/QuerySmartContractStateRequest", + is(o: any): o is QuerySmartContractStateRequest { + return o && (o.$typeUrl === QuerySmartContractStateRequest.typeUrl || typeof o.address === "string" && (o.queryData instanceof Uint8Array || typeof o.queryData === "string")); + }, + isSDK(o: any): o is QuerySmartContractStateRequestSDKType { + return o && (o.$typeUrl === QuerySmartContractStateRequest.typeUrl || typeof o.address === "string" && (o.query_data instanceof Uint8Array || typeof o.query_data === "string")); + }, + isAmino(o: any): o is QuerySmartContractStateRequestAmino { + return o && (o.$typeUrl === QuerySmartContractStateRequest.typeUrl || typeof o.address === "string" && (o.query_data instanceof Uint8Array || typeof o.query_data === "string")); + }, encode(message: QuerySmartContractStateRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.address !== "") { writer.uint32(10).string(message.address); @@ -2141,7 +2288,8 @@ export const QuerySmartContractStateRequest = { typeUrl: "/cosmwasm.wasm.v1.QuerySmartContractStateRequest", value: QuerySmartContractStateRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQuerySmartContractStateResponse(): QuerySmartContractStateResponse { return { @@ -2158,6 +2306,15 @@ function createBaseQuerySmartContractStateResponse(): QuerySmartContractStateRes export const QuerySmartContractStateResponse = { typeUrl: "/cosmwasm.wasm.v1.QuerySmartContractStateResponse", aminoType: "wasm/QuerySmartContractStateResponse", + is(o: any): o is QuerySmartContractStateResponse { + return o && (o.$typeUrl === QuerySmartContractStateResponse.typeUrl || o.data instanceof Uint8Array || typeof o.data === "string"); + }, + isSDK(o: any): o is QuerySmartContractStateResponseSDKType { + return o && (o.$typeUrl === QuerySmartContractStateResponse.typeUrl || o.data instanceof Uint8Array || typeof o.data === "string"); + }, + isAmino(o: any): o is QuerySmartContractStateResponseAmino { + return o && (o.$typeUrl === QuerySmartContractStateResponse.typeUrl || o.data instanceof Uint8Array || typeof o.data === "string"); + }, encode(message: QuerySmartContractStateResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.data.length !== 0) { writer.uint32(10).bytes(message.data); @@ -2238,7 +2395,8 @@ export const QuerySmartContractStateResponse = { typeUrl: "/cosmwasm.wasm.v1.QuerySmartContractStateResponse", value: QuerySmartContractStateResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryCodeRequest(): QueryCodeRequest { return { @@ -2254,6 +2412,15 @@ function createBaseQueryCodeRequest(): QueryCodeRequest { export const QueryCodeRequest = { typeUrl: "/cosmwasm.wasm.v1.QueryCodeRequest", aminoType: "wasm/QueryCodeRequest", + is(o: any): o is QueryCodeRequest { + return o && (o.$typeUrl === QueryCodeRequest.typeUrl || typeof o.codeId === "bigint"); + }, + isSDK(o: any): o is QueryCodeRequestSDKType { + return o && (o.$typeUrl === QueryCodeRequest.typeUrl || typeof o.code_id === "bigint"); + }, + isAmino(o: any): o is QueryCodeRequestAmino { + return o && (o.$typeUrl === QueryCodeRequest.typeUrl || typeof o.code_id === "bigint"); + }, encode(message: QueryCodeRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.codeId !== BigInt(0)) { writer.uint32(8).uint64(message.codeId); @@ -2336,7 +2503,8 @@ export const QueryCodeRequest = { typeUrl: "/cosmwasm.wasm.v1.QueryCodeRequest", value: QueryCodeRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseCodeInfoResponse(): CodeInfoResponse { return { @@ -2354,6 +2522,15 @@ function createBaseCodeInfoResponse(): CodeInfoResponse { export const CodeInfoResponse = { typeUrl: "/cosmwasm.wasm.v1.CodeInfoResponse", aminoType: "wasm/CodeInfoResponse", + is(o: any): o is CodeInfoResponse { + return o && (o.$typeUrl === CodeInfoResponse.typeUrl || typeof o.codeId === "bigint" && typeof o.creator === "string" && (o.dataHash instanceof Uint8Array || typeof o.dataHash === "string")); + }, + isSDK(o: any): o is CodeInfoResponseSDKType { + return o && (o.$typeUrl === CodeInfoResponse.typeUrl || typeof o.code_id === "bigint" && typeof o.creator === "string" && (o.data_hash instanceof Uint8Array || typeof o.data_hash === "string")); + }, + isAmino(o: any): o is CodeInfoResponseAmino { + return o && (o.$typeUrl === CodeInfoResponse.typeUrl || typeof o.code_id === "bigint" && typeof o.creator === "string" && (o.data_hash instanceof Uint8Array || typeof o.data_hash === "string")); + }, encode(message: CodeInfoResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.codeId !== BigInt(0)) { writer.uint32(8).uint64(message.codeId); @@ -2466,7 +2643,8 @@ export const CodeInfoResponse = { typeUrl: "/cosmwasm.wasm.v1.CodeInfoResponse", value: CodeInfoResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryCodeResponse(): QueryCodeResponse { return { @@ -2483,6 +2661,15 @@ function createBaseQueryCodeResponse(): QueryCodeResponse { export const QueryCodeResponse = { typeUrl: "/cosmwasm.wasm.v1.QueryCodeResponse", aminoType: "wasm/QueryCodeResponse", + is(o: any): o is QueryCodeResponse { + return o && (o.$typeUrl === QueryCodeResponse.typeUrl || o.data instanceof Uint8Array || typeof o.data === "string"); + }, + isSDK(o: any): o is QueryCodeResponseSDKType { + return o && (o.$typeUrl === QueryCodeResponse.typeUrl || o.data instanceof Uint8Array || typeof o.data === "string"); + }, + isAmino(o: any): o is QueryCodeResponseAmino { + return o && (o.$typeUrl === QueryCodeResponse.typeUrl || o.data instanceof Uint8Array || typeof o.data === "string"); + }, encode(message: QueryCodeResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.codeInfo !== undefined) { CodeInfoResponse.encode(message.codeInfo, writer.uint32(10).fork()).ldelim(); @@ -2580,6 +2767,12 @@ export const QueryCodeResponse = { typeUrl: "/cosmwasm.wasm.v1.QueryCodeResponse", value: QueryCodeResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryCodeResponse.typeUrl)) { + return; + } + CodeInfoResponse.registerTypeUrl(); } }; function createBaseQueryCodesRequest(): QueryCodesRequest { @@ -2596,6 +2789,15 @@ function createBaseQueryCodesRequest(): QueryCodesRequest { export const QueryCodesRequest = { typeUrl: "/cosmwasm.wasm.v1.QueryCodesRequest", aminoType: "wasm/QueryCodesRequest", + is(o: any): o is QueryCodesRequest { + return o && o.$typeUrl === QueryCodesRequest.typeUrl; + }, + isSDK(o: any): o is QueryCodesRequestSDKType { + return o && o.$typeUrl === QueryCodesRequest.typeUrl; + }, + isAmino(o: any): o is QueryCodesRequestAmino { + return o && o.$typeUrl === QueryCodesRequest.typeUrl; + }, encode(message: QueryCodesRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.pagination !== undefined) { PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); @@ -2678,6 +2880,12 @@ export const QueryCodesRequest = { typeUrl: "/cosmwasm.wasm.v1.QueryCodesRequest", value: QueryCodesRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryCodesRequest.typeUrl)) { + return; + } + PageRequest.registerTypeUrl(); } }; function createBaseQueryCodesResponse(): QueryCodesResponse { @@ -2695,6 +2903,15 @@ function createBaseQueryCodesResponse(): QueryCodesResponse { export const QueryCodesResponse = { typeUrl: "/cosmwasm.wasm.v1.QueryCodesResponse", aminoType: "wasm/QueryCodesResponse", + is(o: any): o is QueryCodesResponse { + return o && (o.$typeUrl === QueryCodesResponse.typeUrl || Array.isArray(o.codeInfos) && (!o.codeInfos.length || CodeInfoResponse.is(o.codeInfos[0]))); + }, + isSDK(o: any): o is QueryCodesResponseSDKType { + return o && (o.$typeUrl === QueryCodesResponse.typeUrl || Array.isArray(o.code_infos) && (!o.code_infos.length || CodeInfoResponse.isSDK(o.code_infos[0]))); + }, + isAmino(o: any): o is QueryCodesResponseAmino { + return o && (o.$typeUrl === QueryCodesResponse.typeUrl || Array.isArray(o.code_infos) && (!o.code_infos.length || CodeInfoResponse.isAmino(o.code_infos[0]))); + }, encode(message: QueryCodesResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.codeInfos) { CodeInfoResponse.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -2802,6 +3019,13 @@ export const QueryCodesResponse = { typeUrl: "/cosmwasm.wasm.v1.QueryCodesResponse", value: QueryCodesResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryCodesResponse.typeUrl)) { + return; + } + CodeInfoResponse.registerTypeUrl(); + PageResponse.registerTypeUrl(); } }; function createBaseQueryPinnedCodesRequest(): QueryPinnedCodesRequest { @@ -2819,6 +3043,15 @@ function createBaseQueryPinnedCodesRequest(): QueryPinnedCodesRequest { export const QueryPinnedCodesRequest = { typeUrl: "/cosmwasm.wasm.v1.QueryPinnedCodesRequest", aminoType: "wasm/QueryPinnedCodesRequest", + is(o: any): o is QueryPinnedCodesRequest { + return o && o.$typeUrl === QueryPinnedCodesRequest.typeUrl; + }, + isSDK(o: any): o is QueryPinnedCodesRequestSDKType { + return o && o.$typeUrl === QueryPinnedCodesRequest.typeUrl; + }, + isAmino(o: any): o is QueryPinnedCodesRequestAmino { + return o && o.$typeUrl === QueryPinnedCodesRequest.typeUrl; + }, encode(message: QueryPinnedCodesRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.pagination !== undefined) { PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); @@ -2901,6 +3134,12 @@ export const QueryPinnedCodesRequest = { typeUrl: "/cosmwasm.wasm.v1.QueryPinnedCodesRequest", value: QueryPinnedCodesRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryPinnedCodesRequest.typeUrl)) { + return; + } + PageRequest.registerTypeUrl(); } }; function createBaseQueryPinnedCodesResponse(): QueryPinnedCodesResponse { @@ -2919,6 +3158,15 @@ function createBaseQueryPinnedCodesResponse(): QueryPinnedCodesResponse { export const QueryPinnedCodesResponse = { typeUrl: "/cosmwasm.wasm.v1.QueryPinnedCodesResponse", aminoType: "wasm/QueryPinnedCodesResponse", + is(o: any): o is QueryPinnedCodesResponse { + return o && (o.$typeUrl === QueryPinnedCodesResponse.typeUrl || Array.isArray(o.codeIds) && (!o.codeIds.length || typeof o.codeIds[0] === "bigint")); + }, + isSDK(o: any): o is QueryPinnedCodesResponseSDKType { + return o && (o.$typeUrl === QueryPinnedCodesResponse.typeUrl || Array.isArray(o.code_ids) && (!o.code_ids.length || typeof o.code_ids[0] === "bigint")); + }, + isAmino(o: any): o is QueryPinnedCodesResponseAmino { + return o && (o.$typeUrl === QueryPinnedCodesResponse.typeUrl || Array.isArray(o.code_ids) && (!o.code_ids.length || typeof o.code_ids[0] === "bigint")); + }, encode(message: QueryPinnedCodesResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { writer.uint32(10).fork(); for (const v of message.codeIds) { @@ -3035,5 +3283,11 @@ export const QueryPinnedCodesResponse = { typeUrl: "/cosmwasm.wasm.v1.QueryPinnedCodesResponse", value: QueryPinnedCodesResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryPinnedCodesResponse.typeUrl)) { + return; + } + PageResponse.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/cosmwasm/wasm/v1/tx.registry.ts b/__fixtures__/v-next/outputv2/cosmwasm/wasm/v1/tx.registry.ts index 7792ce88e9..ce26db131f 100644 --- a/__fixtures__/v-next/outputv2/cosmwasm/wasm/v1/tx.registry.ts +++ b/__fixtures__/v-next/outputv2/cosmwasm/wasm/v1/tx.registry.ts @@ -1,11 +1,6 @@ -import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { TelescopeGeneratedType } from "../../../types"; import { MsgStoreCode, MsgInstantiateContract, MsgExecuteContract, MsgMigrateContract, MsgUpdateAdmin, MsgClearAdmin } from "./tx"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/cosmwasm.wasm.v1.MsgStoreCode", MsgStoreCode], ["/cosmwasm.wasm.v1.MsgInstantiateContract", MsgInstantiateContract], ["/cosmwasm.wasm.v1.MsgExecuteContract", MsgExecuteContract], ["/cosmwasm.wasm.v1.MsgMigrateContract", MsgMigrateContract], ["/cosmwasm.wasm.v1.MsgUpdateAdmin", MsgUpdateAdmin], ["/cosmwasm.wasm.v1.MsgClearAdmin", MsgClearAdmin]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/cosmwasm.wasm.v1.MsgStoreCode", MsgStoreCode], ["/cosmwasm.wasm.v1.MsgInstantiateContract", MsgInstantiateContract], ["/cosmwasm.wasm.v1.MsgExecuteContract", MsgExecuteContract], ["/cosmwasm.wasm.v1.MsgMigrateContract", MsgMigrateContract], ["/cosmwasm.wasm.v1.MsgUpdateAdmin", MsgUpdateAdmin], ["/cosmwasm.wasm.v1.MsgClearAdmin", MsgClearAdmin]]; export const MessageComposer = { encoded: { storeCode(value: MsgStoreCode) { diff --git a/__fixtures__/v-next/outputv2/cosmwasm/wasm/v1/tx.rpc.func.ts b/__fixtures__/v-next/outputv2/cosmwasm/wasm/v1/tx.rpc.func.ts new file mode 100644 index 0000000000..008b1afca5 --- /dev/null +++ b/__fixtures__/v-next/outputv2/cosmwasm/wasm/v1/tx.rpc.func.ts @@ -0,0 +1,56 @@ +import { buildTx } from "../../../helper-func-types"; +import { MsgStoreCode, MsgInstantiateContract, MsgExecuteContract, MsgMigrateContract, MsgUpdateAdmin, MsgClearAdmin } from "./tx"; +/** + * StoreCode to submit Wasm code to the system + * @name storeCode + * @package cosmwasm.wasm.v1 + * @see proto service: cosmwasm.wasm.v1.StoreCode + */ +export const storeCode = buildTx({ + msg: MsgStoreCode +}); +/** + * Instantiate creates a new smart contract instance for the given code id. + * @name instantiateContract + * @package cosmwasm.wasm.v1 + * @see proto service: cosmwasm.wasm.v1.InstantiateContract + */ +export const instantiateContract = buildTx({ + msg: MsgInstantiateContract +}); +/** + * Execute submits the given message data to a smart contract + * @name executeContract + * @package cosmwasm.wasm.v1 + * @see proto service: cosmwasm.wasm.v1.ExecuteContract + */ +export const executeContract = buildTx({ + msg: MsgExecuteContract +}); +/** + * Migrate runs a code upgrade/ downgrade for a smart contract + * @name migrateContract + * @package cosmwasm.wasm.v1 + * @see proto service: cosmwasm.wasm.v1.MigrateContract + */ +export const migrateContract = buildTx({ + msg: MsgMigrateContract +}); +/** + * UpdateAdmin sets a new admin for a smart contract + * @name updateAdmin + * @package cosmwasm.wasm.v1 + * @see proto service: cosmwasm.wasm.v1.UpdateAdmin + */ +export const updateAdmin = buildTx({ + msg: MsgUpdateAdmin +}); +/** + * ClearAdmin removes any admin stored for a smart contract + * @name clearAdmin + * @package cosmwasm.wasm.v1 + * @see proto service: cosmwasm.wasm.v1.ClearAdmin + */ +export const clearAdmin = buildTx({ + msg: MsgClearAdmin +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/cosmwasm/wasm/v1/tx.ts b/__fixtures__/v-next/outputv2/cosmwasm/wasm/v1/tx.ts index b9959fd6c6..f4dc5f8154 100644 --- a/__fixtures__/v-next/outputv2/cosmwasm/wasm/v1/tx.ts +++ b/__fixtures__/v-next/outputv2/cosmwasm/wasm/v1/tx.ts @@ -1,9 +1,10 @@ import { AccessConfig, AccessConfigAmino, AccessConfigSDKType } from "./types"; import { Coin, CoinAmino, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; +import { GlobalDecoderRegistry } from "../../../registry"; import { isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; -import { fromBase64, toBase64, toUtf8, fromUtf8 } from "@cosmjs/encoding"; +import { fromBase64, toBase64, toUtf8, fromUtf8 } from "@interchainjs/encoding"; export const protobufPackage = "cosmwasm.wasm.v1"; /** * MsgStoreCode submit Wasm code to the system @@ -649,6 +650,15 @@ function createBaseMsgStoreCode(): MsgStoreCode { export const MsgStoreCode = { typeUrl: "/cosmwasm.wasm.v1.MsgStoreCode", aminoType: "wasm/MsgStoreCode", + is(o: any): o is MsgStoreCode { + return o && (o.$typeUrl === MsgStoreCode.typeUrl || typeof o.sender === "string" && (o.wasmByteCode instanceof Uint8Array || typeof o.wasmByteCode === "string")); + }, + isSDK(o: any): o is MsgStoreCodeSDKType { + return o && (o.$typeUrl === MsgStoreCode.typeUrl || typeof o.sender === "string" && (o.wasm_byte_code instanceof Uint8Array || typeof o.wasm_byte_code === "string")); + }, + isAmino(o: any): o is MsgStoreCodeAmino { + return o && (o.$typeUrl === MsgStoreCode.typeUrl || typeof o.sender === "string" && (o.wasm_byte_code instanceof Uint8Array || typeof o.wasm_byte_code === "string")); + }, encode(message: MsgStoreCode, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.sender !== "") { writer.uint32(10).string(message.sender); @@ -761,6 +771,12 @@ export const MsgStoreCode = { typeUrl: "/cosmwasm.wasm.v1.MsgStoreCode", value: MsgStoreCode.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgStoreCode.typeUrl)) { + return; + } + AccessConfig.registerTypeUrl(); } }; function createBaseMsgStoreCodeResponse(): MsgStoreCodeResponse { @@ -777,6 +793,15 @@ function createBaseMsgStoreCodeResponse(): MsgStoreCodeResponse { export const MsgStoreCodeResponse = { typeUrl: "/cosmwasm.wasm.v1.MsgStoreCodeResponse", aminoType: "wasm/MsgStoreCodeResponse", + is(o: any): o is MsgStoreCodeResponse { + return o && (o.$typeUrl === MsgStoreCodeResponse.typeUrl || typeof o.codeId === "bigint"); + }, + isSDK(o: any): o is MsgStoreCodeResponseSDKType { + return o && (o.$typeUrl === MsgStoreCodeResponse.typeUrl || typeof o.code_id === "bigint"); + }, + isAmino(o: any): o is MsgStoreCodeResponseAmino { + return o && (o.$typeUrl === MsgStoreCodeResponse.typeUrl || typeof o.code_id === "bigint"); + }, encode(message: MsgStoreCodeResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.codeId !== BigInt(0)) { writer.uint32(8).uint64(message.codeId); @@ -859,7 +884,8 @@ export const MsgStoreCodeResponse = { typeUrl: "/cosmwasm.wasm.v1.MsgStoreCodeResponse", value: MsgStoreCodeResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgInstantiateContract(): MsgInstantiateContract { return { @@ -881,6 +907,15 @@ function createBaseMsgInstantiateContract(): MsgInstantiateContract { export const MsgInstantiateContract = { typeUrl: "/cosmwasm.wasm.v1.MsgInstantiateContract", aminoType: "wasm/MsgInstantiateContract", + is(o: any): o is MsgInstantiateContract { + return o && (o.$typeUrl === MsgInstantiateContract.typeUrl || typeof o.sender === "string" && typeof o.admin === "string" && typeof o.codeId === "bigint" && typeof o.label === "string" && (o.msg instanceof Uint8Array || typeof o.msg === "string") && Array.isArray(o.funds) && (!o.funds.length || Coin.is(o.funds[0]))); + }, + isSDK(o: any): o is MsgInstantiateContractSDKType { + return o && (o.$typeUrl === MsgInstantiateContract.typeUrl || typeof o.sender === "string" && typeof o.admin === "string" && typeof o.code_id === "bigint" && typeof o.label === "string" && (o.msg instanceof Uint8Array || typeof o.msg === "string") && Array.isArray(o.funds) && (!o.funds.length || Coin.isSDK(o.funds[0]))); + }, + isAmino(o: any): o is MsgInstantiateContractAmino { + return o && (o.$typeUrl === MsgInstantiateContract.typeUrl || typeof o.sender === "string" && typeof o.admin === "string" && typeof o.code_id === "bigint" && typeof o.label === "string" && (o.msg instanceof Uint8Array || typeof o.msg === "string") && Array.isArray(o.funds) && (!o.funds.length || Coin.isAmino(o.funds[0]))); + }, encode(message: MsgInstantiateContract, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.sender !== "") { writer.uint32(10).string(message.sender); @@ -1048,6 +1083,12 @@ export const MsgInstantiateContract = { typeUrl: "/cosmwasm.wasm.v1.MsgInstantiateContract", value: MsgInstantiateContract.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgInstantiateContract.typeUrl)) { + return; + } + Coin.registerTypeUrl(); } }; function createBaseMsgInstantiateContractResponse(): MsgInstantiateContractResponse { @@ -1065,6 +1106,15 @@ function createBaseMsgInstantiateContractResponse(): MsgInstantiateContractRespo export const MsgInstantiateContractResponse = { typeUrl: "/cosmwasm.wasm.v1.MsgInstantiateContractResponse", aminoType: "wasm/MsgInstantiateContractResponse", + is(o: any): o is MsgInstantiateContractResponse { + return o && (o.$typeUrl === MsgInstantiateContractResponse.typeUrl || typeof o.address === "string" && (o.data instanceof Uint8Array || typeof o.data === "string")); + }, + isSDK(o: any): o is MsgInstantiateContractResponseSDKType { + return o && (o.$typeUrl === MsgInstantiateContractResponse.typeUrl || typeof o.address === "string" && (o.data instanceof Uint8Array || typeof o.data === "string")); + }, + isAmino(o: any): o is MsgInstantiateContractResponseAmino { + return o && (o.$typeUrl === MsgInstantiateContractResponse.typeUrl || typeof o.address === "string" && (o.data instanceof Uint8Array || typeof o.data === "string")); + }, encode(message: MsgInstantiateContractResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.address !== "") { writer.uint32(10).string(message.address); @@ -1160,7 +1210,8 @@ export const MsgInstantiateContractResponse = { typeUrl: "/cosmwasm.wasm.v1.MsgInstantiateContractResponse", value: MsgInstantiateContractResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgExecuteContract(): MsgExecuteContract { return { @@ -1179,6 +1230,15 @@ function createBaseMsgExecuteContract(): MsgExecuteContract { export const MsgExecuteContract = { typeUrl: "/cosmwasm.wasm.v1.MsgExecuteContract", aminoType: "wasm/MsgExecuteContract", + is(o: any): o is MsgExecuteContract { + return o && (o.$typeUrl === MsgExecuteContract.typeUrl || typeof o.sender === "string" && typeof o.contract === "string" && (o.msg instanceof Uint8Array || typeof o.msg === "string") && Array.isArray(o.funds) && (!o.funds.length || Coin.is(o.funds[0]))); + }, + isSDK(o: any): o is MsgExecuteContractSDKType { + return o && (o.$typeUrl === MsgExecuteContract.typeUrl || typeof o.sender === "string" && typeof o.contract === "string" && (o.msg instanceof Uint8Array || typeof o.msg === "string") && Array.isArray(o.funds) && (!o.funds.length || Coin.isSDK(o.funds[0]))); + }, + isAmino(o: any): o is MsgExecuteContractAmino { + return o && (o.$typeUrl === MsgExecuteContract.typeUrl || typeof o.sender === "string" && typeof o.contract === "string" && (o.msg instanceof Uint8Array || typeof o.msg === "string") && Array.isArray(o.funds) && (!o.funds.length || Coin.isAmino(o.funds[0]))); + }, encode(message: MsgExecuteContract, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.sender !== "") { writer.uint32(10).string(message.sender); @@ -1314,6 +1374,12 @@ export const MsgExecuteContract = { typeUrl: "/cosmwasm.wasm.v1.MsgExecuteContract", value: MsgExecuteContract.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgExecuteContract.typeUrl)) { + return; + } + Coin.registerTypeUrl(); } }; function createBaseMsgExecuteContractResponse(): MsgExecuteContractResponse { @@ -1330,6 +1396,15 @@ function createBaseMsgExecuteContractResponse(): MsgExecuteContractResponse { export const MsgExecuteContractResponse = { typeUrl: "/cosmwasm.wasm.v1.MsgExecuteContractResponse", aminoType: "wasm/MsgExecuteContractResponse", + is(o: any): o is MsgExecuteContractResponse { + return o && (o.$typeUrl === MsgExecuteContractResponse.typeUrl || o.data instanceof Uint8Array || typeof o.data === "string"); + }, + isSDK(o: any): o is MsgExecuteContractResponseSDKType { + return o && (o.$typeUrl === MsgExecuteContractResponse.typeUrl || o.data instanceof Uint8Array || typeof o.data === "string"); + }, + isAmino(o: any): o is MsgExecuteContractResponseAmino { + return o && (o.$typeUrl === MsgExecuteContractResponse.typeUrl || o.data instanceof Uint8Array || typeof o.data === "string"); + }, encode(message: MsgExecuteContractResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.data.length !== 0) { writer.uint32(10).bytes(message.data); @@ -1410,7 +1485,8 @@ export const MsgExecuteContractResponse = { typeUrl: "/cosmwasm.wasm.v1.MsgExecuteContractResponse", value: MsgExecuteContractResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgMigrateContract(): MsgMigrateContract { return { @@ -1429,6 +1505,15 @@ function createBaseMsgMigrateContract(): MsgMigrateContract { export const MsgMigrateContract = { typeUrl: "/cosmwasm.wasm.v1.MsgMigrateContract", aminoType: "wasm/MsgMigrateContract", + is(o: any): o is MsgMigrateContract { + return o && (o.$typeUrl === MsgMigrateContract.typeUrl || typeof o.sender === "string" && typeof o.contract === "string" && typeof o.codeId === "bigint" && (o.msg instanceof Uint8Array || typeof o.msg === "string")); + }, + isSDK(o: any): o is MsgMigrateContractSDKType { + return o && (o.$typeUrl === MsgMigrateContract.typeUrl || typeof o.sender === "string" && typeof o.contract === "string" && typeof o.code_id === "bigint" && (o.msg instanceof Uint8Array || typeof o.msg === "string")); + }, + isAmino(o: any): o is MsgMigrateContractAmino { + return o && (o.$typeUrl === MsgMigrateContract.typeUrl || typeof o.sender === "string" && typeof o.contract === "string" && typeof o.code_id === "bigint" && (o.msg instanceof Uint8Array || typeof o.msg === "string")); + }, encode(message: MsgMigrateContract, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.sender !== "") { writer.uint32(10).string(message.sender); @@ -1556,7 +1641,8 @@ export const MsgMigrateContract = { typeUrl: "/cosmwasm.wasm.v1.MsgMigrateContract", value: MsgMigrateContract.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgMigrateContractResponse(): MsgMigrateContractResponse { return { @@ -1572,6 +1658,15 @@ function createBaseMsgMigrateContractResponse(): MsgMigrateContractResponse { export const MsgMigrateContractResponse = { typeUrl: "/cosmwasm.wasm.v1.MsgMigrateContractResponse", aminoType: "wasm/MsgMigrateContractResponse", + is(o: any): o is MsgMigrateContractResponse { + return o && (o.$typeUrl === MsgMigrateContractResponse.typeUrl || o.data instanceof Uint8Array || typeof o.data === "string"); + }, + isSDK(o: any): o is MsgMigrateContractResponseSDKType { + return o && (o.$typeUrl === MsgMigrateContractResponse.typeUrl || o.data instanceof Uint8Array || typeof o.data === "string"); + }, + isAmino(o: any): o is MsgMigrateContractResponseAmino { + return o && (o.$typeUrl === MsgMigrateContractResponse.typeUrl || o.data instanceof Uint8Array || typeof o.data === "string"); + }, encode(message: MsgMigrateContractResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.data.length !== 0) { writer.uint32(10).bytes(message.data); @@ -1652,7 +1747,8 @@ export const MsgMigrateContractResponse = { typeUrl: "/cosmwasm.wasm.v1.MsgMigrateContractResponse", value: MsgMigrateContractResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgUpdateAdmin(): MsgUpdateAdmin { return { @@ -1670,6 +1766,15 @@ function createBaseMsgUpdateAdmin(): MsgUpdateAdmin { export const MsgUpdateAdmin = { typeUrl: "/cosmwasm.wasm.v1.MsgUpdateAdmin", aminoType: "wasm/MsgUpdateAdmin", + is(o: any): o is MsgUpdateAdmin { + return o && (o.$typeUrl === MsgUpdateAdmin.typeUrl || typeof o.sender === "string" && typeof o.newAdmin === "string" && typeof o.contract === "string"); + }, + isSDK(o: any): o is MsgUpdateAdminSDKType { + return o && (o.$typeUrl === MsgUpdateAdmin.typeUrl || typeof o.sender === "string" && typeof o.new_admin === "string" && typeof o.contract === "string"); + }, + isAmino(o: any): o is MsgUpdateAdminAmino { + return o && (o.$typeUrl === MsgUpdateAdmin.typeUrl || typeof o.sender === "string" && typeof o.new_admin === "string" && typeof o.contract === "string"); + }, encode(message: MsgUpdateAdmin, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.sender !== "") { writer.uint32(10).string(message.sender); @@ -1780,7 +1885,8 @@ export const MsgUpdateAdmin = { typeUrl: "/cosmwasm.wasm.v1.MsgUpdateAdmin", value: MsgUpdateAdmin.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgUpdateAdminResponse(): MsgUpdateAdminResponse { return {}; @@ -1794,6 +1900,15 @@ function createBaseMsgUpdateAdminResponse(): MsgUpdateAdminResponse { export const MsgUpdateAdminResponse = { typeUrl: "/cosmwasm.wasm.v1.MsgUpdateAdminResponse", aminoType: "wasm/MsgUpdateAdminResponse", + is(o: any): o is MsgUpdateAdminResponse { + return o && o.$typeUrl === MsgUpdateAdminResponse.typeUrl; + }, + isSDK(o: any): o is MsgUpdateAdminResponseSDKType { + return o && o.$typeUrl === MsgUpdateAdminResponse.typeUrl; + }, + isAmino(o: any): o is MsgUpdateAdminResponseAmino { + return o && o.$typeUrl === MsgUpdateAdminResponse.typeUrl; + }, encode(_: MsgUpdateAdminResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -1858,7 +1973,8 @@ export const MsgUpdateAdminResponse = { typeUrl: "/cosmwasm.wasm.v1.MsgUpdateAdminResponse", value: MsgUpdateAdminResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgClearAdmin(): MsgClearAdmin { return { @@ -1875,6 +1991,15 @@ function createBaseMsgClearAdmin(): MsgClearAdmin { export const MsgClearAdmin = { typeUrl: "/cosmwasm.wasm.v1.MsgClearAdmin", aminoType: "wasm/MsgClearAdmin", + is(o: any): o is MsgClearAdmin { + return o && (o.$typeUrl === MsgClearAdmin.typeUrl || typeof o.sender === "string" && typeof o.contract === "string"); + }, + isSDK(o: any): o is MsgClearAdminSDKType { + return o && (o.$typeUrl === MsgClearAdmin.typeUrl || typeof o.sender === "string" && typeof o.contract === "string"); + }, + isAmino(o: any): o is MsgClearAdminAmino { + return o && (o.$typeUrl === MsgClearAdmin.typeUrl || typeof o.sender === "string" && typeof o.contract === "string"); + }, encode(message: MsgClearAdmin, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.sender !== "") { writer.uint32(10).string(message.sender); @@ -1970,7 +2095,8 @@ export const MsgClearAdmin = { typeUrl: "/cosmwasm.wasm.v1.MsgClearAdmin", value: MsgClearAdmin.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgClearAdminResponse(): MsgClearAdminResponse { return {}; @@ -1984,6 +2110,15 @@ function createBaseMsgClearAdminResponse(): MsgClearAdminResponse { export const MsgClearAdminResponse = { typeUrl: "/cosmwasm.wasm.v1.MsgClearAdminResponse", aminoType: "wasm/MsgClearAdminResponse", + is(o: any): o is MsgClearAdminResponse { + return o && o.$typeUrl === MsgClearAdminResponse.typeUrl; + }, + isSDK(o: any): o is MsgClearAdminResponseSDKType { + return o && o.$typeUrl === MsgClearAdminResponse.typeUrl; + }, + isAmino(o: any): o is MsgClearAdminResponseAmino { + return o && o.$typeUrl === MsgClearAdminResponse.typeUrl; + }, encode(_: MsgClearAdminResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -2048,5 +2183,6 @@ export const MsgClearAdminResponse = { typeUrl: "/cosmwasm.wasm.v1.MsgClearAdminResponse", value: MsgClearAdminResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/cosmwasm/wasm/v1/types.ts b/__fixtures__/v-next/outputv2/cosmwasm/wasm/v1/types.ts index cf8a329c2b..199fce2643 100644 --- a/__fixtures__/v-next/outputv2/cosmwasm/wasm/v1/types.ts +++ b/__fixtures__/v-next/outputv2/cosmwasm/wasm/v1/types.ts @@ -1,8 +1,9 @@ import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../google/protobuf/any"; -import { BinaryReader, BinaryWriter } from "../../../binary"; import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../helpers"; +import { BinaryReader, BinaryWriter } from "../../../binary"; import { JsonSafe } from "../../../json-safe"; -import { toUtf8, fromUtf8 } from "@cosmjs/encoding"; +import { GlobalDecoderRegistry } from "../../../registry"; +import { toUtf8, fromUtf8 } from "@interchainjs/encoding"; export const protobufPackage = "cosmwasm.wasm.v1"; /** AccessType permission types */ export enum AccessType { @@ -552,6 +553,15 @@ function createBaseAccessTypeParam(): AccessTypeParam { export const AccessTypeParam = { typeUrl: "/cosmwasm.wasm.v1.AccessTypeParam", aminoType: "wasm/AccessTypeParam", + is(o: any): o is AccessTypeParam { + return o && (o.$typeUrl === AccessTypeParam.typeUrl || isSet(o.value)); + }, + isSDK(o: any): o is AccessTypeParamSDKType { + return o && (o.$typeUrl === AccessTypeParam.typeUrl || isSet(o.value)); + }, + isAmino(o: any): o is AccessTypeParamAmino { + return o && (o.$typeUrl === AccessTypeParam.typeUrl || isSet(o.value)); + }, encode(message: AccessTypeParam, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.value !== 0) { writer.uint32(8).int32(message.value); @@ -632,7 +642,8 @@ export const AccessTypeParam = { typeUrl: "/cosmwasm.wasm.v1.AccessTypeParam", value: AccessTypeParam.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseAccessConfig(): AccessConfig { return { @@ -649,6 +660,15 @@ function createBaseAccessConfig(): AccessConfig { export const AccessConfig = { typeUrl: "/cosmwasm.wasm.v1.AccessConfig", aminoType: "wasm/AccessConfig", + is(o: any): o is AccessConfig { + return o && (o.$typeUrl === AccessConfig.typeUrl || isSet(o.permission) && typeof o.address === "string"); + }, + isSDK(o: any): o is AccessConfigSDKType { + return o && (o.$typeUrl === AccessConfig.typeUrl || isSet(o.permission) && typeof o.address === "string"); + }, + isAmino(o: any): o is AccessConfigAmino { + return o && (o.$typeUrl === AccessConfig.typeUrl || isSet(o.permission) && typeof o.address === "string"); + }, encode(message: AccessConfig, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.permission !== 0) { writer.uint32(8).int32(message.permission); @@ -744,7 +764,8 @@ export const AccessConfig = { typeUrl: "/cosmwasm.wasm.v1.AccessConfig", value: AccessConfig.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseParams(): Params { return { @@ -762,6 +783,15 @@ function createBaseParams(): Params { export const Params = { typeUrl: "/cosmwasm.wasm.v1.Params", aminoType: "wasm/Params", + is(o: any): o is Params { + return o && (o.$typeUrl === Params.typeUrl || AccessConfig.is(o.codeUploadAccess) && isSet(o.instantiateDefaultPermission) && typeof o.maxWasmCodeSize === "bigint"); + }, + isSDK(o: any): o is ParamsSDKType { + return o && (o.$typeUrl === Params.typeUrl || AccessConfig.isSDK(o.code_upload_access) && isSet(o.instantiate_default_permission) && typeof o.max_wasm_code_size === "bigint"); + }, + isAmino(o: any): o is ParamsAmino { + return o && (o.$typeUrl === Params.typeUrl || AccessConfig.isAmino(o.code_upload_access) && isSet(o.instantiate_default_permission) && typeof o.max_wasm_code_size === "bigint"); + }, encode(message: Params, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.codeUploadAccess !== undefined) { AccessConfig.encode(message.codeUploadAccess, writer.uint32(10).fork()).ldelim(); @@ -876,6 +906,12 @@ export const Params = { typeUrl: "/cosmwasm.wasm.v1.Params", value: Params.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Params.typeUrl)) { + return; + } + AccessConfig.registerTypeUrl(); } }; function createBaseCodeInfo(): CodeInfo { @@ -894,6 +930,15 @@ function createBaseCodeInfo(): CodeInfo { export const CodeInfo = { typeUrl: "/cosmwasm.wasm.v1.CodeInfo", aminoType: "wasm/CodeInfo", + is(o: any): o is CodeInfo { + return o && (o.$typeUrl === CodeInfo.typeUrl || (o.codeHash instanceof Uint8Array || typeof o.codeHash === "string") && typeof o.creator === "string" && AccessConfig.is(o.instantiateConfig)); + }, + isSDK(o: any): o is CodeInfoSDKType { + return o && (o.$typeUrl === CodeInfo.typeUrl || (o.code_hash instanceof Uint8Array || typeof o.code_hash === "string") && typeof o.creator === "string" && AccessConfig.isSDK(o.instantiate_config)); + }, + isAmino(o: any): o is CodeInfoAmino { + return o && (o.$typeUrl === CodeInfo.typeUrl || (o.code_hash instanceof Uint8Array || typeof o.code_hash === "string") && typeof o.creator === "string" && AccessConfig.isAmino(o.instantiate_config)); + }, encode(message: CodeInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.codeHash.length !== 0) { writer.uint32(10).bytes(message.codeHash); @@ -1006,6 +1051,12 @@ export const CodeInfo = { typeUrl: "/cosmwasm.wasm.v1.CodeInfo", value: CodeInfo.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(CodeInfo.typeUrl)) { + return; + } + AccessConfig.registerTypeUrl(); } }; function createBaseContractInfo(): ContractInfo { @@ -1028,6 +1079,15 @@ function createBaseContractInfo(): ContractInfo { export const ContractInfo = { typeUrl: "/cosmwasm.wasm.v1.ContractInfo", aminoType: "wasm/ContractInfo", + is(o: any): o is ContractInfo { + return o && (o.$typeUrl === ContractInfo.typeUrl || typeof o.codeId === "bigint" && typeof o.creator === "string" && typeof o.admin === "string" && typeof o.label === "string" && typeof o.ibcPortId === "string"); + }, + isSDK(o: any): o is ContractInfoSDKType { + return o && (o.$typeUrl === ContractInfo.typeUrl || typeof o.code_id === "bigint" && typeof o.creator === "string" && typeof o.admin === "string" && typeof o.label === "string" && typeof o.ibc_port_id === "string"); + }, + isAmino(o: any): o is ContractInfoAmino { + return o && (o.$typeUrl === ContractInfo.typeUrl || typeof o.code_id === "bigint" && typeof o.creator === "string" && typeof o.admin === "string" && typeof o.label === "string" && typeof o.ibc_port_id === "string"); + }, encode(message: ContractInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.codeId !== BigInt(0)) { writer.uint32(8).uint64(message.codeId); @@ -1048,7 +1108,7 @@ export const ContractInfo = { writer.uint32(50).string(message.ibcPortId); } if (message.extension !== undefined) { - Any.encode((message.extension as Any), writer.uint32(58).fork()).ldelim(); + Any.encode(GlobalDecoderRegistry.wrapAny(message.extension), writer.uint32(58).fork()).ldelim(); } return writer; }, @@ -1078,7 +1138,7 @@ export const ContractInfo = { message.ibcPortId = reader.string(); break; case 7: - message.extension = (ContractInfoExtension_InterfaceDecoder(reader) as Any); + message.extension = GlobalDecoderRegistry.unwrapAny(reader); break; default: reader.skipType(tag & 7); @@ -1095,7 +1155,7 @@ export const ContractInfo = { if (isSet(object.label)) obj.label = String(object.label); if (isSet(object.created)) obj.created = AbsoluteTxPosition.fromJSON(object.created); if (isSet(object.ibcPortId)) obj.ibcPortId = String(object.ibcPortId); - if (isSet(object.extension)) obj.extension = Any.fromJSON(object.extension); + if (isSet(object.extension)) obj.extension = GlobalDecoderRegistry.fromJSON(object.extension); return obj; }, toJSON(message: ContractInfo): JsonSafe { @@ -1106,7 +1166,7 @@ export const ContractInfo = { message.label !== undefined && (obj.label = message.label); message.created !== undefined && (obj.created = message.created ? AbsoluteTxPosition.toJSON(message.created) : undefined); message.ibcPortId !== undefined && (obj.ibcPortId = message.ibcPortId); - message.extension !== undefined && (obj.extension = message.extension ? Any.toJSON(message.extension) : undefined); + message.extension !== undefined && (obj.extension = message.extension ? GlobalDecoderRegistry.toJSON(message.extension) : undefined); return obj; }, fromPartial(object: DeepPartial): ContractInfo { @@ -1122,7 +1182,7 @@ export const ContractInfo = { } message.ibcPortId = object.ibcPortId ?? ""; if (object.extension !== undefined && object.extension !== null) { - message.extension = Any.fromPartial(object.extension); + message.extension = GlobalDecoderRegistry.fromPartial(object.extension); } return message; }, @@ -1134,7 +1194,7 @@ export const ContractInfo = { label: object?.label, created: object.created ? AbsoluteTxPosition.fromSDK(object.created) : undefined, ibcPortId: object?.ibc_port_id, - extension: object.extension ? Any.fromSDK(object.extension) : undefined + extension: object.extension ? GlobalDecoderRegistry.fromSDK(object.extension) : undefined }; }, toSDK(message: ContractInfo): ContractInfoSDKType { @@ -1145,7 +1205,7 @@ export const ContractInfo = { obj.label = message.label; message.created !== undefined && (obj.created = message.created ? AbsoluteTxPosition.toSDK(message.created) : undefined); obj.ibc_port_id = message.ibcPortId; - message.extension !== undefined && (obj.extension = message.extension ? Any.toSDK(message.extension) : undefined); + message.extension !== undefined && (obj.extension = message.extension ? GlobalDecoderRegistry.toSDK(message.extension) : undefined); return obj; }, fromAmino(object: ContractInfoAmino): ContractInfo { @@ -1169,7 +1229,7 @@ export const ContractInfo = { message.ibcPortId = object.ibc_port_id; } if (object.extension !== undefined && object.extension !== null) { - message.extension = ContractInfoExtension_FromAmino(object.extension); + message.extension = GlobalDecoderRegistry.fromAminoMsg(object.extension); } return message; }, @@ -1181,7 +1241,7 @@ export const ContractInfo = { obj.label = message.label === "" ? undefined : message.label; obj.created = message.created ? AbsoluteTxPosition.toAmino(message.created) : undefined; obj.ibc_port_id = message.ibcPortId === "" ? undefined : message.ibcPortId; - obj.extension = message.extension ? ContractInfoExtension_ToAmino((message.extension as Any)) : undefined; + obj.extension = message.extension ? GlobalDecoderRegistry.toAminoMsg(message.extension) : undefined; return obj; }, fromAminoMsg(object: ContractInfoAminoMsg): ContractInfo { @@ -1204,7 +1264,8 @@ export const ContractInfo = { typeUrl: "/cosmwasm.wasm.v1.ContractInfo", value: ContractInfo.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseContractCodeHistoryEntry(): ContractCodeHistoryEntry { return { @@ -1223,6 +1284,15 @@ function createBaseContractCodeHistoryEntry(): ContractCodeHistoryEntry { export const ContractCodeHistoryEntry = { typeUrl: "/cosmwasm.wasm.v1.ContractCodeHistoryEntry", aminoType: "wasm/ContractCodeHistoryEntry", + is(o: any): o is ContractCodeHistoryEntry { + return o && (o.$typeUrl === ContractCodeHistoryEntry.typeUrl || isSet(o.operation) && typeof o.codeId === "bigint" && (o.msg instanceof Uint8Array || typeof o.msg === "string")); + }, + isSDK(o: any): o is ContractCodeHistoryEntrySDKType { + return o && (o.$typeUrl === ContractCodeHistoryEntry.typeUrl || isSet(o.operation) && typeof o.code_id === "bigint" && (o.msg instanceof Uint8Array || typeof o.msg === "string")); + }, + isAmino(o: any): o is ContractCodeHistoryEntryAmino { + return o && (o.$typeUrl === ContractCodeHistoryEntry.typeUrl || isSet(o.operation) && typeof o.code_id === "bigint" && (o.msg instanceof Uint8Array || typeof o.msg === "string")); + }, encode(message: ContractCodeHistoryEntry, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.operation !== 0) { writer.uint32(8).int32(message.operation); @@ -1352,6 +1422,12 @@ export const ContractCodeHistoryEntry = { typeUrl: "/cosmwasm.wasm.v1.ContractCodeHistoryEntry", value: ContractCodeHistoryEntry.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ContractCodeHistoryEntry.typeUrl)) { + return; + } + AbsoluteTxPosition.registerTypeUrl(); } }; function createBaseAbsoluteTxPosition(): AbsoluteTxPosition { @@ -1370,6 +1446,15 @@ function createBaseAbsoluteTxPosition(): AbsoluteTxPosition { export const AbsoluteTxPosition = { typeUrl: "/cosmwasm.wasm.v1.AbsoluteTxPosition", aminoType: "wasm/AbsoluteTxPosition", + is(o: any): o is AbsoluteTxPosition { + return o && (o.$typeUrl === AbsoluteTxPosition.typeUrl || typeof o.blockHeight === "bigint" && typeof o.txIndex === "bigint"); + }, + isSDK(o: any): o is AbsoluteTxPositionSDKType { + return o && (o.$typeUrl === AbsoluteTxPosition.typeUrl || typeof o.block_height === "bigint" && typeof o.tx_index === "bigint"); + }, + isAmino(o: any): o is AbsoluteTxPositionAmino { + return o && (o.$typeUrl === AbsoluteTxPosition.typeUrl || typeof o.block_height === "bigint" && typeof o.tx_index === "bigint"); + }, encode(message: AbsoluteTxPosition, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.blockHeight !== BigInt(0)) { writer.uint32(8).uint64(message.blockHeight); @@ -1469,7 +1554,8 @@ export const AbsoluteTxPosition = { typeUrl: "/cosmwasm.wasm.v1.AbsoluteTxPosition", value: AbsoluteTxPosition.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseModel(): Model { return { @@ -1486,6 +1572,15 @@ function createBaseModel(): Model { export const Model = { typeUrl: "/cosmwasm.wasm.v1.Model", aminoType: "wasm/Model", + is(o: any): o is Model { + return o && (o.$typeUrl === Model.typeUrl || (o.key instanceof Uint8Array || typeof o.key === "string") && (o.value instanceof Uint8Array || typeof o.value === "string")); + }, + isSDK(o: any): o is ModelSDKType { + return o && (o.$typeUrl === Model.typeUrl || (o.key instanceof Uint8Array || typeof o.key === "string") && (o.value instanceof Uint8Array || typeof o.value === "string")); + }, + isAmino(o: any): o is ModelAmino { + return o && (o.$typeUrl === Model.typeUrl || (o.key instanceof Uint8Array || typeof o.key === "string") && (o.value instanceof Uint8Array || typeof o.value === "string")); + }, encode(message: Model, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.key.length !== 0) { writer.uint32(10).bytes(message.key); @@ -1581,19 +1676,6 @@ export const Model = { typeUrl: "/cosmwasm.wasm.v1.Model", value: Model.encode(message).finish() }; - } -}; -export const ContractInfoExtension_InterfaceDecoder = (input: BinaryReader | Uint8Array): Any => { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - const data = Any.decode(reader, reader.uint32()); - switch (data.typeUrl) { - default: - return data; - } -}; -export const ContractInfoExtension_FromAmino = (content: AnyAmino): Any => { - return Any.fromAmino(content); -}; -export const ContractInfoExtension_ToAmino = (content: Any) => { - return Any.toAmino(content); + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/evmos/bundle.ts b/__fixtures__/v-next/outputv2/evmos/bundle.ts index 9490653068..835402f42f 100644 --- a/__fixtures__/v-next/outputv2/evmos/bundle.ts +++ b/__fixtures__/v-next/outputv2/evmos/bundle.ts @@ -22,50 +22,52 @@ import * as _173 from "./recovery/v1/query"; import * as _174 from "./vesting/v1/query"; import * as _175 from "./vesting/v1/tx"; import * as _176 from "./vesting/v1/vesting"; -import * as _438 from "./erc20/v1/tx.amino"; -import * as _439 from "./fees/v1/tx.amino"; -import * as _440 from "./vesting/v1/tx.amino"; -import * as _441 from "./erc20/v1/tx.registry"; -import * as _442 from "./fees/v1/tx.registry"; -import * as _443 from "./vesting/v1/tx.registry"; -import * as _444 from "./claims/v1/query.lcd"; -import * as _445 from "./epochs/v1/query.lcd"; -import * as _446 from "./erc20/v1/query.lcd"; -import * as _447 from "./fees/v1/query.lcd"; -import * as _448 from "./incentives/v1/query.lcd"; -import * as _449 from "./inflation/v1/query.lcd"; -import * as _450 from "./recovery/v1/query.lcd"; -import * as _451 from "./vesting/v1/query.lcd"; -import * as _452 from "./claims/v1/query.rpc.Query"; -import * as _453 from "./epochs/v1/query.rpc.Query"; -import * as _454 from "./erc20/v1/query.rpc.Query"; -import * as _455 from "./fees/v1/query.rpc.Query"; -import * as _456 from "./incentives/v1/query.rpc.Query"; -import * as _457 from "./inflation/v1/query.rpc.Query"; -import * as _458 from "./recovery/v1/query.rpc.Query"; -import * as _459 from "./vesting/v1/query.rpc.Query"; -import * as _460 from "./erc20/v1/tx.rpc.msg"; -import * as _461 from "./fees/v1/tx.rpc.msg"; -import * as _462 from "./vesting/v1/tx.rpc.msg"; -import * as _540 from "./lcd"; -import * as _541 from "./rpc.query"; -import * as _542 from "./rpc.tx"; +import * as _464 from "./erc20/v1/tx.amino"; +import * as _465 from "./fees/v1/tx.amino"; +import * as _466 from "./vesting/v1/tx.amino"; +import * as _467 from "./erc20/v1/tx.registry"; +import * as _468 from "./fees/v1/tx.registry"; +import * as _469 from "./vesting/v1/tx.registry"; +import * as _470 from "./claims/v1/query.rpc.func"; +import * as _471 from "./epochs/v1/query.rpc.func"; +import * as _472 from "./erc20/v1/query.rpc.func"; +import * as _473 from "./fees/v1/query.rpc.func"; +import * as _474 from "./incentives/v1/query.rpc.func"; +import * as _475 from "./inflation/v1/query.rpc.func"; +import * as _476 from "./recovery/v1/query.rpc.func"; +import * as _477 from "./vesting/v1/query.rpc.func"; +import * as _478 from "./claims/v1/query.rpc.Query"; +import * as _479 from "./epochs/v1/query.rpc.Query"; +import * as _480 from "./erc20/v1/query.rpc.Query"; +import * as _481 from "./fees/v1/query.rpc.Query"; +import * as _482 from "./incentives/v1/query.rpc.Query"; +import * as _483 from "./inflation/v1/query.rpc.Query"; +import * as _484 from "./recovery/v1/query.rpc.Query"; +import * as _485 from "./vesting/v1/query.rpc.Query"; +import * as _486 from "./erc20/v1/tx.rpc.func"; +import * as _487 from "./fees/v1/tx.rpc.func"; +import * as _488 from "./vesting/v1/tx.rpc.func"; +import * as _489 from "./erc20/v1/tx.rpc.msg"; +import * as _490 from "./fees/v1/tx.rpc.msg"; +import * as _491 from "./vesting/v1/tx.rpc.msg"; +import * as _579 from "./rpc.query"; +import * as _580 from "./rpc.tx"; export namespace evmos { export namespace claims { export const v1 = { ..._153, ..._154, ..._155, - ..._444, - ..._452 + ..._470, + ..._478 }; } export namespace epochs { export const v1 = { ..._156, ..._157, - ..._445, - ..._453 + ..._471, + ..._479 }; } export namespace erc20 { @@ -74,11 +76,12 @@ export namespace evmos { ..._159, ..._160, ..._161, - ..._438, - ..._441, - ..._446, - ..._454, - ..._460 + ..._464, + ..._467, + ..._472, + ..._480, + ..._486, + ..._489 }; } export namespace fees { @@ -87,11 +90,12 @@ export namespace evmos { ..._163, ..._164, ..._165, - ..._439, - ..._442, - ..._447, - ..._455, - ..._461 + ..._465, + ..._468, + ..._473, + ..._481, + ..._487, + ..._490 }; } export namespace incentives { @@ -99,8 +103,8 @@ export namespace evmos { ..._166, ..._167, ..._168, - ..._448, - ..._456 + ..._474, + ..._482 }; } export namespace inflation { @@ -108,16 +112,16 @@ export namespace evmos { ..._169, ..._170, ..._171, - ..._449, - ..._457 + ..._475, + ..._483 }; } export namespace recovery { export const v1 = { ..._172, ..._173, - ..._450, - ..._458 + ..._476, + ..._484 }; } export namespace vesting { @@ -125,16 +129,16 @@ export namespace evmos { ..._174, ..._175, ..._176, - ..._440, - ..._443, - ..._451, - ..._459, - ..._462 + ..._466, + ..._469, + ..._477, + ..._485, + ..._488, + ..._491 }; } export const ClientFactory = { - ..._540, - ..._541, - ..._542 + ..._579, + ..._580 }; } \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/evmos/claims/v1/claims.ts b/__fixtures__/v-next/outputv2/evmos/claims/v1/claims.ts index 03327b3c43..20d2fb61a9 100644 --- a/__fixtures__/v-next/outputv2/evmos/claims/v1/claims.ts +++ b/__fixtures__/v-next/outputv2/evmos/claims/v1/claims.ts @@ -1,5 +1,5 @@ -import { BinaryReader, BinaryWriter } from "../../../binary"; import { isSet, DeepPartial } from "../../../helpers"; +import { BinaryReader, BinaryWriter } from "../../../binary"; import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "evmos.claims.v1"; /** Action defines the list of available actions to claim the airdrop tokens. */ @@ -248,6 +248,15 @@ function createBaseClaim(): Claim { */ export const Claim = { typeUrl: "/evmos.claims.v1.Claim", + is(o: any): o is Claim { + return o && (o.$typeUrl === Claim.typeUrl || isSet(o.action) && typeof o.completed === "boolean" && typeof o.claimableAmount === "string"); + }, + isSDK(o: any): o is ClaimSDKType { + return o && (o.$typeUrl === Claim.typeUrl || isSet(o.action) && typeof o.completed === "boolean" && typeof o.claimable_amount === "string"); + }, + isAmino(o: any): o is ClaimAmino { + return o && (o.$typeUrl === Claim.typeUrl || isSet(o.action) && typeof o.completed === "boolean" && typeof o.claimable_amount === "string"); + }, encode(message: Claim, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.action !== 0) { writer.uint32(8).int32(message.action); @@ -352,7 +361,8 @@ export const Claim = { typeUrl: "/evmos.claims.v1.Claim", value: Claim.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseClaimsRecordAddress(): ClaimsRecordAddress { return { @@ -369,6 +379,15 @@ function createBaseClaimsRecordAddress(): ClaimsRecordAddress { */ export const ClaimsRecordAddress = { typeUrl: "/evmos.claims.v1.ClaimsRecordAddress", + is(o: any): o is ClaimsRecordAddress { + return o && (o.$typeUrl === ClaimsRecordAddress.typeUrl || typeof o.address === "string" && typeof o.initialClaimableAmount === "string" && Array.isArray(o.actionsCompleted) && (!o.actionsCompleted.length || typeof o.actionsCompleted[0] === "boolean")); + }, + isSDK(o: any): o is ClaimsRecordAddressSDKType { + return o && (o.$typeUrl === ClaimsRecordAddress.typeUrl || typeof o.address === "string" && typeof o.initial_claimable_amount === "string" && Array.isArray(o.actions_completed) && (!o.actions_completed.length || typeof o.actions_completed[0] === "boolean")); + }, + isAmino(o: any): o is ClaimsRecordAddressAmino { + return o && (o.$typeUrl === ClaimsRecordAddress.typeUrl || typeof o.address === "string" && typeof o.initial_claimable_amount === "string" && Array.isArray(o.actions_completed) && (!o.actions_completed.length || typeof o.actions_completed[0] === "boolean")); + }, encode(message: ClaimsRecordAddress, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.address !== "") { writer.uint32(10).string(message.address); @@ -492,7 +511,8 @@ export const ClaimsRecordAddress = { typeUrl: "/evmos.claims.v1.ClaimsRecordAddress", value: ClaimsRecordAddress.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseClaimsRecord(): ClaimsRecord { return { @@ -509,6 +529,15 @@ function createBaseClaimsRecord(): ClaimsRecord { */ export const ClaimsRecord = { typeUrl: "/evmos.claims.v1.ClaimsRecord", + is(o: any): o is ClaimsRecord { + return o && (o.$typeUrl === ClaimsRecord.typeUrl || typeof o.initialClaimableAmount === "string" && Array.isArray(o.actionsCompleted) && (!o.actionsCompleted.length || typeof o.actionsCompleted[0] === "boolean")); + }, + isSDK(o: any): o is ClaimsRecordSDKType { + return o && (o.$typeUrl === ClaimsRecord.typeUrl || typeof o.initial_claimable_amount === "string" && Array.isArray(o.actions_completed) && (!o.actions_completed.length || typeof o.actions_completed[0] === "boolean")); + }, + isAmino(o: any): o is ClaimsRecordAmino { + return o && (o.$typeUrl === ClaimsRecord.typeUrl || typeof o.initial_claimable_amount === "string" && Array.isArray(o.actions_completed) && (!o.actions_completed.length || typeof o.actions_completed[0] === "boolean")); + }, encode(message: ClaimsRecord, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.initialClaimableAmount !== "") { writer.uint32(10).string(message.initialClaimableAmount); @@ -617,5 +646,6 @@ export const ClaimsRecord = { typeUrl: "/evmos.claims.v1.ClaimsRecord", value: ClaimsRecord.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/evmos/claims/v1/genesis.ts b/__fixtures__/v-next/outputv2/evmos/claims/v1/genesis.ts index 2b60477eb5..375ca7cc36 100644 --- a/__fixtures__/v-next/outputv2/evmos/claims/v1/genesis.ts +++ b/__fixtures__/v-next/outputv2/evmos/claims/v1/genesis.ts @@ -2,6 +2,7 @@ import { ClaimsRecordAddress, ClaimsRecordAddressAmino, ClaimsRecordAddressSDKTy import { Timestamp } from "../../../google/protobuf/timestamp"; import { Duration, DurationAmino, DurationSDKType } from "../../../google/protobuf/duration"; import { BinaryReader, BinaryWriter } from "../../../binary"; +import { GlobalDecoderRegistry } from "../../../registry"; import { isSet, DeepPartial, toTimestamp, fromTimestamp } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "evmos.claims.v1"; @@ -166,6 +167,15 @@ function createBaseGenesisState(): GenesisState { */ export const GenesisState = { typeUrl: "/evmos.claims.v1.GenesisState", + is(o: any): o is GenesisState { + return o && (o.$typeUrl === GenesisState.typeUrl || Params.is(o.params) && Array.isArray(o.claimsRecords) && (!o.claimsRecords.length || ClaimsRecordAddress.is(o.claimsRecords[0]))); + }, + isSDK(o: any): o is GenesisStateSDKType { + return o && (o.$typeUrl === GenesisState.typeUrl || Params.isSDK(o.params) && Array.isArray(o.claims_records) && (!o.claims_records.length || ClaimsRecordAddress.isSDK(o.claims_records[0]))); + }, + isAmino(o: any): o is GenesisStateAmino { + return o && (o.$typeUrl === GenesisState.typeUrl || Params.isAmino(o.params) && Array.isArray(o.claims_records) && (!o.claims_records.length || ClaimsRecordAddress.isAmino(o.claims_records[0]))); + }, encode(message: GenesisState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.params !== undefined) { Params.encode(message.params, writer.uint32(10).fork()).ldelim(); @@ -267,6 +277,13 @@ export const GenesisState = { typeUrl: "/evmos.claims.v1.GenesisState", value: GenesisState.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GenesisState.typeUrl)) { + return; + } + Params.registerTypeUrl(); + ClaimsRecordAddress.registerTypeUrl(); } }; function createBaseParams(): Params { @@ -288,6 +305,15 @@ function createBaseParams(): Params { */ export const Params = { typeUrl: "/evmos.claims.v1.Params", + is(o: any): o is Params { + return o && (o.$typeUrl === Params.typeUrl || typeof o.enableClaims === "boolean" && Timestamp.is(o.airdropStartTime) && Duration.is(o.durationUntilDecay) && Duration.is(o.durationOfDecay) && typeof o.claimsDenom === "string" && Array.isArray(o.authorizedChannels) && (!o.authorizedChannels.length || typeof o.authorizedChannels[0] === "string") && Array.isArray(o.evmChannels) && (!o.evmChannels.length || typeof o.evmChannels[0] === "string")); + }, + isSDK(o: any): o is ParamsSDKType { + return o && (o.$typeUrl === Params.typeUrl || typeof o.enable_claims === "boolean" && Timestamp.isSDK(o.airdrop_start_time) && Duration.isSDK(o.duration_until_decay) && Duration.isSDK(o.duration_of_decay) && typeof o.claims_denom === "string" && Array.isArray(o.authorized_channels) && (!o.authorized_channels.length || typeof o.authorized_channels[0] === "string") && Array.isArray(o.evm_channels) && (!o.evm_channels.length || typeof o.evm_channels[0] === "string")); + }, + isAmino(o: any): o is ParamsAmino { + return o && (o.$typeUrl === Params.typeUrl || typeof o.enable_claims === "boolean" && Timestamp.isAmino(o.airdrop_start_time) && Duration.isAmino(o.duration_until_decay) && Duration.isAmino(o.duration_of_decay) && typeof o.claims_denom === "string" && Array.isArray(o.authorized_channels) && (!o.authorized_channels.length || typeof o.authorized_channels[0] === "string") && Array.isArray(o.evm_channels) && (!o.evm_channels.length || typeof o.evm_channels[0] === "string")); + }, encode(message: Params, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.enableClaims === true) { writer.uint32(8).bool(message.enableClaims); @@ -476,5 +502,6 @@ export const Params = { typeUrl: "/evmos.claims.v1.Params", value: Params.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/evmos/claims/v1/query.rpc.func.ts b/__fixtures__/v-next/outputv2/evmos/claims/v1/query.rpc.func.ts new file mode 100644 index 0000000000..40b6e1e72f --- /dev/null +++ b/__fixtures__/v-next/outputv2/evmos/claims/v1/query.rpc.func.ts @@ -0,0 +1,54 @@ +import { buildQuery } from "../../../helper-func-types"; +import { QueryTotalUnclaimedRequest, QueryTotalUnclaimedResponse, QueryParamsRequest, QueryParamsResponse, QueryClaimsRecordsRequest, QueryClaimsRecordsResponse, QueryClaimsRecordRequest, QueryClaimsRecordResponse } from "./query"; +/** + * TotalUnclaimed queries the total unclaimed tokens from the airdrop + * @name getTotalUnclaimed + * @package evmos.claims.v1 + * @see proto service: evmos.claims.v1.TotalUnclaimed + */ +export const getTotalUnclaimed = buildQuery({ + encode: QueryTotalUnclaimedRequest.encode, + decode: QueryTotalUnclaimedResponse.decode, + service: "evmos.claims.v1.Query", + method: "TotalUnclaimed", + deps: [QueryTotalUnclaimedRequest, QueryTotalUnclaimedResponse] +}); +/** + * Params returns the claims module parameters + * @name getParams + * @package evmos.claims.v1 + * @see proto service: evmos.claims.v1.Params + */ +export const getParams = buildQuery({ + encode: QueryParamsRequest.encode, + decode: QueryParamsResponse.decode, + service: "evmos.claims.v1.Query", + method: "Params", + deps: [QueryParamsRequest, QueryParamsResponse] +}); +/** + * ClaimsRecords returns all claims records + * @name getClaimsRecords + * @package evmos.claims.v1 + * @see proto service: evmos.claims.v1.ClaimsRecords + */ +export const getClaimsRecords = buildQuery({ + encode: QueryClaimsRecordsRequest.encode, + decode: QueryClaimsRecordsResponse.decode, + service: "evmos.claims.v1.Query", + method: "ClaimsRecords", + deps: [QueryClaimsRecordsRequest, QueryClaimsRecordsResponse] +}); +/** + * ClaimsRecord returns the claims record for a given address + * @name getClaimsRecord + * @package evmos.claims.v1 + * @see proto service: evmos.claims.v1.ClaimsRecord + */ +export const getClaimsRecord = buildQuery({ + encode: QueryClaimsRecordRequest.encode, + decode: QueryClaimsRecordResponse.decode, + service: "evmos.claims.v1.Query", + method: "ClaimsRecord", + deps: [QueryClaimsRecordRequest, QueryClaimsRecordResponse] +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/evmos/claims/v1/query.ts b/__fixtures__/v-next/outputv2/evmos/claims/v1/query.ts index 74e5a762a5..4126ca0a79 100644 --- a/__fixtures__/v-next/outputv2/evmos/claims/v1/query.ts +++ b/__fixtures__/v-next/outputv2/evmos/claims/v1/query.ts @@ -5,6 +5,7 @@ import { ClaimsRecordAddress, ClaimsRecordAddressAmino, ClaimsRecordAddressSDKTy import { BinaryReader, BinaryWriter } from "../../../binary"; import { JsonSafe } from "../../../json-safe"; import { DeepPartial, isSet } from "../../../helpers"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "evmos.claims.v1"; /** * QueryTotalUnclaimedRequest is the request type for the Query/TotalUnclaimed @@ -358,6 +359,15 @@ function createBaseQueryTotalUnclaimedRequest(): QueryTotalUnclaimedRequest { */ export const QueryTotalUnclaimedRequest = { typeUrl: "/evmos.claims.v1.QueryTotalUnclaimedRequest", + is(o: any): o is QueryTotalUnclaimedRequest { + return o && o.$typeUrl === QueryTotalUnclaimedRequest.typeUrl; + }, + isSDK(o: any): o is QueryTotalUnclaimedRequestSDKType { + return o && o.$typeUrl === QueryTotalUnclaimedRequest.typeUrl; + }, + isAmino(o: any): o is QueryTotalUnclaimedRequestAmino { + return o && o.$typeUrl === QueryTotalUnclaimedRequest.typeUrl; + }, encode(_: QueryTotalUnclaimedRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -416,7 +426,8 @@ export const QueryTotalUnclaimedRequest = { typeUrl: "/evmos.claims.v1.QueryTotalUnclaimedRequest", value: QueryTotalUnclaimedRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryTotalUnclaimedResponse(): QueryTotalUnclaimedResponse { return { @@ -432,6 +443,15 @@ function createBaseQueryTotalUnclaimedResponse(): QueryTotalUnclaimedResponse { */ export const QueryTotalUnclaimedResponse = { typeUrl: "/evmos.claims.v1.QueryTotalUnclaimedResponse", + is(o: any): o is QueryTotalUnclaimedResponse { + return o && (o.$typeUrl === QueryTotalUnclaimedResponse.typeUrl || Array.isArray(o.coins) && (!o.coins.length || Coin.is(o.coins[0]))); + }, + isSDK(o: any): o is QueryTotalUnclaimedResponseSDKType { + return o && (o.$typeUrl === QueryTotalUnclaimedResponse.typeUrl || Array.isArray(o.coins) && (!o.coins.length || Coin.isSDK(o.coins[0]))); + }, + isAmino(o: any): o is QueryTotalUnclaimedResponseAmino { + return o && (o.$typeUrl === QueryTotalUnclaimedResponse.typeUrl || Array.isArray(o.coins) && (!o.coins.length || Coin.isAmino(o.coins[0]))); + }, encode(message: QueryTotalUnclaimedResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.coins) { Coin.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -516,6 +536,12 @@ export const QueryTotalUnclaimedResponse = { typeUrl: "/evmos.claims.v1.QueryTotalUnclaimedResponse", value: QueryTotalUnclaimedResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryTotalUnclaimedResponse.typeUrl)) { + return; + } + Coin.registerTypeUrl(); } }; function createBaseQueryParamsRequest(): QueryParamsRequest { @@ -529,6 +555,15 @@ function createBaseQueryParamsRequest(): QueryParamsRequest { */ export const QueryParamsRequest = { typeUrl: "/evmos.claims.v1.QueryParamsRequest", + is(o: any): o is QueryParamsRequest { + return o && o.$typeUrl === QueryParamsRequest.typeUrl; + }, + isSDK(o: any): o is QueryParamsRequestSDKType { + return o && o.$typeUrl === QueryParamsRequest.typeUrl; + }, + isAmino(o: any): o is QueryParamsRequestAmino { + return o && o.$typeUrl === QueryParamsRequest.typeUrl; + }, encode(_: QueryParamsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -587,7 +622,8 @@ export const QueryParamsRequest = { typeUrl: "/evmos.claims.v1.QueryParamsRequest", value: QueryParamsRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryParamsResponse(): QueryParamsResponse { return { @@ -602,6 +638,15 @@ function createBaseQueryParamsResponse(): QueryParamsResponse { */ export const QueryParamsResponse = { typeUrl: "/evmos.claims.v1.QueryParamsResponse", + is(o: any): o is QueryParamsResponse { + return o && (o.$typeUrl === QueryParamsResponse.typeUrl || Params.is(o.params)); + }, + isSDK(o: any): o is QueryParamsResponseSDKType { + return o && (o.$typeUrl === QueryParamsResponse.typeUrl || Params.isSDK(o.params)); + }, + isAmino(o: any): o is QueryParamsResponseAmino { + return o && (o.$typeUrl === QueryParamsResponse.typeUrl || Params.isAmino(o.params)); + }, encode(message: QueryParamsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.params !== undefined) { Params.encode(message.params, writer.uint32(10).fork()).ldelim(); @@ -678,6 +723,12 @@ export const QueryParamsResponse = { typeUrl: "/evmos.claims.v1.QueryParamsResponse", value: QueryParamsResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryParamsResponse.typeUrl)) { + return; + } + Params.registerTypeUrl(); } }; function createBaseQueryClaimsRecordsRequest(): QueryClaimsRecordsRequest { @@ -694,6 +745,15 @@ function createBaseQueryClaimsRecordsRequest(): QueryClaimsRecordsRequest { */ export const QueryClaimsRecordsRequest = { typeUrl: "/evmos.claims.v1.QueryClaimsRecordsRequest", + is(o: any): o is QueryClaimsRecordsRequest { + return o && o.$typeUrl === QueryClaimsRecordsRequest.typeUrl; + }, + isSDK(o: any): o is QueryClaimsRecordsRequestSDKType { + return o && o.$typeUrl === QueryClaimsRecordsRequest.typeUrl; + }, + isAmino(o: any): o is QueryClaimsRecordsRequestAmino { + return o && o.$typeUrl === QueryClaimsRecordsRequest.typeUrl; + }, encode(message: QueryClaimsRecordsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.pagination !== undefined) { PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); @@ -770,6 +830,12 @@ export const QueryClaimsRecordsRequest = { typeUrl: "/evmos.claims.v1.QueryClaimsRecordsRequest", value: QueryClaimsRecordsRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryClaimsRecordsRequest.typeUrl)) { + return; + } + PageRequest.registerTypeUrl(); } }; function createBaseQueryClaimsRecordsResponse(): QueryClaimsRecordsResponse { @@ -787,6 +853,15 @@ function createBaseQueryClaimsRecordsResponse(): QueryClaimsRecordsResponse { */ export const QueryClaimsRecordsResponse = { typeUrl: "/evmos.claims.v1.QueryClaimsRecordsResponse", + is(o: any): o is QueryClaimsRecordsResponse { + return o && (o.$typeUrl === QueryClaimsRecordsResponse.typeUrl || Array.isArray(o.claims) && (!o.claims.length || ClaimsRecordAddress.is(o.claims[0]))); + }, + isSDK(o: any): o is QueryClaimsRecordsResponseSDKType { + return o && (o.$typeUrl === QueryClaimsRecordsResponse.typeUrl || Array.isArray(o.claims) && (!o.claims.length || ClaimsRecordAddress.isSDK(o.claims[0]))); + }, + isAmino(o: any): o is QueryClaimsRecordsResponseAmino { + return o && (o.$typeUrl === QueryClaimsRecordsResponse.typeUrl || Array.isArray(o.claims) && (!o.claims.length || ClaimsRecordAddress.isAmino(o.claims[0]))); + }, encode(message: QueryClaimsRecordsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.claims) { ClaimsRecordAddress.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -888,6 +963,13 @@ export const QueryClaimsRecordsResponse = { typeUrl: "/evmos.claims.v1.QueryClaimsRecordsResponse", value: QueryClaimsRecordsResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryClaimsRecordsResponse.typeUrl)) { + return; + } + ClaimsRecordAddress.registerTypeUrl(); + PageResponse.registerTypeUrl(); } }; function createBaseQueryClaimsRecordRequest(): QueryClaimsRecordRequest { @@ -904,6 +986,15 @@ function createBaseQueryClaimsRecordRequest(): QueryClaimsRecordRequest { */ export const QueryClaimsRecordRequest = { typeUrl: "/evmos.claims.v1.QueryClaimsRecordRequest", + is(o: any): o is QueryClaimsRecordRequest { + return o && (o.$typeUrl === QueryClaimsRecordRequest.typeUrl || typeof o.address === "string"); + }, + isSDK(o: any): o is QueryClaimsRecordRequestSDKType { + return o && (o.$typeUrl === QueryClaimsRecordRequest.typeUrl || typeof o.address === "string"); + }, + isAmino(o: any): o is QueryClaimsRecordRequestAmino { + return o && (o.$typeUrl === QueryClaimsRecordRequest.typeUrl || typeof o.address === "string"); + }, encode(message: QueryClaimsRecordRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.address !== "") { writer.uint32(10).string(message.address); @@ -978,7 +1069,8 @@ export const QueryClaimsRecordRequest = { typeUrl: "/evmos.claims.v1.QueryClaimsRecordRequest", value: QueryClaimsRecordRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryClaimsRecordResponse(): QueryClaimsRecordResponse { return { @@ -995,6 +1087,15 @@ function createBaseQueryClaimsRecordResponse(): QueryClaimsRecordResponse { */ export const QueryClaimsRecordResponse = { typeUrl: "/evmos.claims.v1.QueryClaimsRecordResponse", + is(o: any): o is QueryClaimsRecordResponse { + return o && (o.$typeUrl === QueryClaimsRecordResponse.typeUrl || typeof o.initialClaimableAmount === "string" && Array.isArray(o.claims) && (!o.claims.length || Claim.is(o.claims[0]))); + }, + isSDK(o: any): o is QueryClaimsRecordResponseSDKType { + return o && (o.$typeUrl === QueryClaimsRecordResponse.typeUrl || typeof o.initial_claimable_amount === "string" && Array.isArray(o.claims) && (!o.claims.length || Claim.isSDK(o.claims[0]))); + }, + isAmino(o: any): o is QueryClaimsRecordResponseAmino { + return o && (o.$typeUrl === QueryClaimsRecordResponse.typeUrl || typeof o.initial_claimable_amount === "string" && Array.isArray(o.claims) && (!o.claims.length || Claim.isAmino(o.claims[0]))); + }, encode(message: QueryClaimsRecordResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.initialClaimableAmount !== "") { writer.uint32(10).string(message.initialClaimableAmount); @@ -1094,5 +1195,11 @@ export const QueryClaimsRecordResponse = { typeUrl: "/evmos.claims.v1.QueryClaimsRecordResponse", value: QueryClaimsRecordResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryClaimsRecordResponse.typeUrl)) { + return; + } + Claim.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/evmos/epochs/v1/genesis.ts b/__fixtures__/v-next/outputv2/evmos/epochs/v1/genesis.ts index b4f6aefa9b..3c97647799 100644 --- a/__fixtures__/v-next/outputv2/evmos/epochs/v1/genesis.ts +++ b/__fixtures__/v-next/outputv2/evmos/epochs/v1/genesis.ts @@ -2,6 +2,7 @@ import { Timestamp } from "../../../google/protobuf/timestamp"; import { Duration, DurationAmino, DurationSDKType } from "../../../google/protobuf/duration"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { toTimestamp, fromTimestamp, isSet, DeepPartial } from "../../../helpers"; +import { GlobalDecoderRegistry } from "../../../registry"; import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "evmos.epochs.v1"; /** @@ -107,6 +108,15 @@ function createBaseEpochInfo(): EpochInfo { */ export const EpochInfo = { typeUrl: "/evmos.epochs.v1.EpochInfo", + is(o: any): o is EpochInfo { + return o && (o.$typeUrl === EpochInfo.typeUrl || typeof o.identifier === "string" && Timestamp.is(o.startTime) && Duration.is(o.duration) && typeof o.currentEpoch === "bigint" && Timestamp.is(o.currentEpochStartTime) && typeof o.epochCountingStarted === "boolean" && typeof o.currentEpochStartHeight === "bigint"); + }, + isSDK(o: any): o is EpochInfoSDKType { + return o && (o.$typeUrl === EpochInfo.typeUrl || typeof o.identifier === "string" && Timestamp.isSDK(o.start_time) && Duration.isSDK(o.duration) && typeof o.current_epoch === "bigint" && Timestamp.isSDK(o.current_epoch_start_time) && typeof o.epoch_counting_started === "boolean" && typeof o.current_epoch_start_height === "bigint"); + }, + isAmino(o: any): o is EpochInfoAmino { + return o && (o.$typeUrl === EpochInfo.typeUrl || typeof o.identifier === "string" && Timestamp.isAmino(o.start_time) && Duration.isAmino(o.duration) && typeof o.current_epoch === "bigint" && Timestamp.isAmino(o.current_epoch_start_time) && typeof o.epoch_counting_started === "boolean" && typeof o.current_epoch_start_height === "bigint"); + }, encode(message: EpochInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.identifier !== "") { writer.uint32(10).string(message.identifier); @@ -277,7 +287,8 @@ export const EpochInfo = { typeUrl: "/evmos.epochs.v1.EpochInfo", value: EpochInfo.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseGenesisState(): GenesisState { return { @@ -292,6 +303,15 @@ function createBaseGenesisState(): GenesisState { */ export const GenesisState = { typeUrl: "/evmos.epochs.v1.GenesisState", + is(o: any): o is GenesisState { + return o && (o.$typeUrl === GenesisState.typeUrl || Array.isArray(o.epochs) && (!o.epochs.length || EpochInfo.is(o.epochs[0]))); + }, + isSDK(o: any): o is GenesisStateSDKType { + return o && (o.$typeUrl === GenesisState.typeUrl || Array.isArray(o.epochs) && (!o.epochs.length || EpochInfo.isSDK(o.epochs[0]))); + }, + isAmino(o: any): o is GenesisStateAmino { + return o && (o.$typeUrl === GenesisState.typeUrl || Array.isArray(o.epochs) && (!o.epochs.length || EpochInfo.isAmino(o.epochs[0]))); + }, encode(message: GenesisState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.epochs) { EpochInfo.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -376,5 +396,11 @@ export const GenesisState = { typeUrl: "/evmos.epochs.v1.GenesisState", value: GenesisState.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GenesisState.typeUrl)) { + return; + } + EpochInfo.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/evmos/epochs/v1/query.rpc.func.ts b/__fixtures__/v-next/outputv2/evmos/epochs/v1/query.rpc.func.ts new file mode 100644 index 0000000000..273fa8a20b --- /dev/null +++ b/__fixtures__/v-next/outputv2/evmos/epochs/v1/query.rpc.func.ts @@ -0,0 +1,28 @@ +import { buildQuery } from "../../../helper-func-types"; +import { QueryEpochsInfoRequest, QueryEpochsInfoResponse, QueryCurrentEpochRequest, QueryCurrentEpochResponse } from "./query"; +/** + * EpochInfos provide running epochInfos + * @name getEpochInfos + * @package evmos.epochs.v1 + * @see proto service: evmos.epochs.v1.EpochInfos + */ +export const getEpochInfos = buildQuery({ + encode: QueryEpochsInfoRequest.encode, + decode: QueryEpochsInfoResponse.decode, + service: "evmos.epochs.v1.Query", + method: "EpochInfos", + deps: [QueryEpochsInfoRequest, QueryEpochsInfoResponse] +}); +/** + * CurrentEpoch provide current epoch of specified identifier + * @name getCurrentEpoch + * @package evmos.epochs.v1 + * @see proto service: evmos.epochs.v1.CurrentEpoch + */ +export const getCurrentEpoch = buildQuery({ + encode: QueryCurrentEpochRequest.encode, + decode: QueryCurrentEpochResponse.decode, + service: "evmos.epochs.v1.Query", + method: "CurrentEpoch", + deps: [QueryCurrentEpochRequest, QueryCurrentEpochResponse] +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/evmos/epochs/v1/query.ts b/__fixtures__/v-next/outputv2/evmos/epochs/v1/query.ts index 8cc7240789..ce8c5688cc 100644 --- a/__fixtures__/v-next/outputv2/evmos/epochs/v1/query.ts +++ b/__fixtures__/v-next/outputv2/evmos/epochs/v1/query.ts @@ -1,6 +1,7 @@ import { PageRequest, PageRequestAmino, PageRequestSDKType, PageResponse, PageResponseAmino, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination"; import { EpochInfo, EpochInfoAmino, EpochInfoSDKType } from "./genesis"; import { BinaryReader, BinaryWriter } from "../../../binary"; +import { GlobalDecoderRegistry } from "../../../registry"; import { isSet, DeepPartial } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "evmos.epochs.v1"; @@ -147,6 +148,15 @@ function createBaseQueryEpochsInfoRequest(): QueryEpochsInfoRequest { */ export const QueryEpochsInfoRequest = { typeUrl: "/evmos.epochs.v1.QueryEpochsInfoRequest", + is(o: any): o is QueryEpochsInfoRequest { + return o && o.$typeUrl === QueryEpochsInfoRequest.typeUrl; + }, + isSDK(o: any): o is QueryEpochsInfoRequestSDKType { + return o && o.$typeUrl === QueryEpochsInfoRequest.typeUrl; + }, + isAmino(o: any): o is QueryEpochsInfoRequestAmino { + return o && o.$typeUrl === QueryEpochsInfoRequest.typeUrl; + }, encode(message: QueryEpochsInfoRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.pagination !== undefined) { PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); @@ -223,6 +233,12 @@ export const QueryEpochsInfoRequest = { typeUrl: "/evmos.epochs.v1.QueryEpochsInfoRequest", value: QueryEpochsInfoRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryEpochsInfoRequest.typeUrl)) { + return; + } + PageRequest.registerTypeUrl(); } }; function createBaseQueryEpochsInfoResponse(): QueryEpochsInfoResponse { @@ -238,6 +254,15 @@ function createBaseQueryEpochsInfoResponse(): QueryEpochsInfoResponse { */ export const QueryEpochsInfoResponse = { typeUrl: "/evmos.epochs.v1.QueryEpochsInfoResponse", + is(o: any): o is QueryEpochsInfoResponse { + return o && (o.$typeUrl === QueryEpochsInfoResponse.typeUrl || Array.isArray(o.epochs) && (!o.epochs.length || EpochInfo.is(o.epochs[0]))); + }, + isSDK(o: any): o is QueryEpochsInfoResponseSDKType { + return o && (o.$typeUrl === QueryEpochsInfoResponse.typeUrl || Array.isArray(o.epochs) && (!o.epochs.length || EpochInfo.isSDK(o.epochs[0]))); + }, + isAmino(o: any): o is QueryEpochsInfoResponseAmino { + return o && (o.$typeUrl === QueryEpochsInfoResponse.typeUrl || Array.isArray(o.epochs) && (!o.epochs.length || EpochInfo.isAmino(o.epochs[0]))); + }, encode(message: QueryEpochsInfoResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.epochs) { EpochInfo.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -339,6 +364,13 @@ export const QueryEpochsInfoResponse = { typeUrl: "/evmos.epochs.v1.QueryEpochsInfoResponse", value: QueryEpochsInfoResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryEpochsInfoResponse.typeUrl)) { + return; + } + EpochInfo.registerTypeUrl(); + PageResponse.registerTypeUrl(); } }; function createBaseQueryCurrentEpochRequest(): QueryCurrentEpochRequest { @@ -353,6 +385,15 @@ function createBaseQueryCurrentEpochRequest(): QueryCurrentEpochRequest { */ export const QueryCurrentEpochRequest = { typeUrl: "/evmos.epochs.v1.QueryCurrentEpochRequest", + is(o: any): o is QueryCurrentEpochRequest { + return o && (o.$typeUrl === QueryCurrentEpochRequest.typeUrl || typeof o.identifier === "string"); + }, + isSDK(o: any): o is QueryCurrentEpochRequestSDKType { + return o && (o.$typeUrl === QueryCurrentEpochRequest.typeUrl || typeof o.identifier === "string"); + }, + isAmino(o: any): o is QueryCurrentEpochRequestAmino { + return o && (o.$typeUrl === QueryCurrentEpochRequest.typeUrl || typeof o.identifier === "string"); + }, encode(message: QueryCurrentEpochRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.identifier !== "") { writer.uint32(10).string(message.identifier); @@ -427,7 +468,8 @@ export const QueryCurrentEpochRequest = { typeUrl: "/evmos.epochs.v1.QueryCurrentEpochRequest", value: QueryCurrentEpochRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryCurrentEpochResponse(): QueryCurrentEpochResponse { return { @@ -441,6 +483,15 @@ function createBaseQueryCurrentEpochResponse(): QueryCurrentEpochResponse { */ export const QueryCurrentEpochResponse = { typeUrl: "/evmos.epochs.v1.QueryCurrentEpochResponse", + is(o: any): o is QueryCurrentEpochResponse { + return o && (o.$typeUrl === QueryCurrentEpochResponse.typeUrl || typeof o.currentEpoch === "bigint"); + }, + isSDK(o: any): o is QueryCurrentEpochResponseSDKType { + return o && (o.$typeUrl === QueryCurrentEpochResponse.typeUrl || typeof o.current_epoch === "bigint"); + }, + isAmino(o: any): o is QueryCurrentEpochResponseAmino { + return o && (o.$typeUrl === QueryCurrentEpochResponse.typeUrl || typeof o.current_epoch === "bigint"); + }, encode(message: QueryCurrentEpochResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.currentEpoch !== BigInt(0)) { writer.uint32(8).int64(message.currentEpoch); @@ -517,5 +568,6 @@ export const QueryCurrentEpochResponse = { typeUrl: "/evmos.epochs.v1.QueryCurrentEpochResponse", value: QueryCurrentEpochResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/evmos/erc20/v1/erc20.ts b/__fixtures__/v-next/outputv2/evmos/erc20/v1/erc20.ts index 9871ce3b88..b4c62b5507 100644 --- a/__fixtures__/v-next/outputv2/evmos/erc20/v1/erc20.ts +++ b/__fixtures__/v-next/outputv2/evmos/erc20/v1/erc20.ts @@ -1,7 +1,8 @@ import { Metadata, MetadataAmino, MetadataSDKType } from "../../../cosmos/bank/v1beta1/bank"; -import { BinaryReader, BinaryWriter } from "../../../binary"; import { isSet, DeepPartial } from "../../../helpers"; +import { BinaryReader, BinaryWriter } from "../../../binary"; import { JsonSafe } from "../../../json-safe"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "evmos.erc20.v1"; /** Owner enumerates the ownership of a ERC20 contract. */ export enum Owner { @@ -321,6 +322,15 @@ function createBaseTokenPair(): TokenPair { */ export const TokenPair = { typeUrl: "/evmos.erc20.v1.TokenPair", + is(o: any): o is TokenPair { + return o && (o.$typeUrl === TokenPair.typeUrl || typeof o.erc20Address === "string" && typeof o.denom === "string" && typeof o.enabled === "boolean" && isSet(o.contractOwner)); + }, + isSDK(o: any): o is TokenPairSDKType { + return o && (o.$typeUrl === TokenPair.typeUrl || typeof o.erc20_address === "string" && typeof o.denom === "string" && typeof o.enabled === "boolean" && isSet(o.contract_owner)); + }, + isAmino(o: any): o is TokenPairAmino { + return o && (o.$typeUrl === TokenPair.typeUrl || typeof o.erc20_address === "string" && typeof o.denom === "string" && typeof o.enabled === "boolean" && isSet(o.contract_owner)); + }, encode(message: TokenPair, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.erc20Address !== "") { writer.uint32(10).string(message.erc20Address); @@ -440,7 +450,8 @@ export const TokenPair = { typeUrl: "/evmos.erc20.v1.TokenPair", value: TokenPair.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseRegisterCoinProposal(): RegisterCoinProposal { return { @@ -458,6 +469,15 @@ function createBaseRegisterCoinProposal(): RegisterCoinProposal { */ export const RegisterCoinProposal = { typeUrl: "/evmos.erc20.v1.RegisterCoinProposal", + is(o: any): o is RegisterCoinProposal { + return o && (o.$typeUrl === RegisterCoinProposal.typeUrl || typeof o.title === "string" && typeof o.description === "string" && Metadata.is(o.metadata)); + }, + isSDK(o: any): o is RegisterCoinProposalSDKType { + return o && (o.$typeUrl === RegisterCoinProposal.typeUrl || typeof o.title === "string" && typeof o.description === "string" && Metadata.isSDK(o.metadata)); + }, + isAmino(o: any): o is RegisterCoinProposalAmino { + return o && (o.$typeUrl === RegisterCoinProposal.typeUrl || typeof o.title === "string" && typeof o.description === "string" && Metadata.isAmino(o.metadata)); + }, encode(message: RegisterCoinProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.title !== "") { writer.uint32(10).string(message.title); @@ -564,6 +584,12 @@ export const RegisterCoinProposal = { typeUrl: "/evmos.erc20.v1.RegisterCoinProposal", value: RegisterCoinProposal.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(RegisterCoinProposal.typeUrl)) { + return; + } + Metadata.registerTypeUrl(); } }; function createBaseRegisterERC20Proposal(): RegisterERC20Proposal { @@ -582,6 +608,15 @@ function createBaseRegisterERC20Proposal(): RegisterERC20Proposal { */ export const RegisterERC20Proposal = { typeUrl: "/evmos.erc20.v1.RegisterERC20Proposal", + is(o: any): o is RegisterERC20Proposal { + return o && (o.$typeUrl === RegisterERC20Proposal.typeUrl || typeof o.title === "string" && typeof o.description === "string" && typeof o.erc20address === "string"); + }, + isSDK(o: any): o is RegisterERC20ProposalSDKType { + return o && (o.$typeUrl === RegisterERC20Proposal.typeUrl || typeof o.title === "string" && typeof o.description === "string" && typeof o.erc20address === "string"); + }, + isAmino(o: any): o is RegisterERC20ProposalAmino { + return o && (o.$typeUrl === RegisterERC20Proposal.typeUrl || typeof o.title === "string" && typeof o.description === "string" && typeof o.erc20address === "string"); + }, encode(message: RegisterERC20Proposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.title !== "") { writer.uint32(10).string(message.title); @@ -686,7 +721,8 @@ export const RegisterERC20Proposal = { typeUrl: "/evmos.erc20.v1.RegisterERC20Proposal", value: RegisterERC20Proposal.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseToggleTokenConversionProposal(): ToggleTokenConversionProposal { return { @@ -704,6 +740,15 @@ function createBaseToggleTokenConversionProposal(): ToggleTokenConversionProposa */ export const ToggleTokenConversionProposal = { typeUrl: "/evmos.erc20.v1.ToggleTokenConversionProposal", + is(o: any): o is ToggleTokenConversionProposal { + return o && (o.$typeUrl === ToggleTokenConversionProposal.typeUrl || typeof o.title === "string" && typeof o.description === "string" && typeof o.token === "string"); + }, + isSDK(o: any): o is ToggleTokenConversionProposalSDKType { + return o && (o.$typeUrl === ToggleTokenConversionProposal.typeUrl || typeof o.title === "string" && typeof o.description === "string" && typeof o.token === "string"); + }, + isAmino(o: any): o is ToggleTokenConversionProposalAmino { + return o && (o.$typeUrl === ToggleTokenConversionProposal.typeUrl || typeof o.title === "string" && typeof o.description === "string" && typeof o.token === "string"); + }, encode(message: ToggleTokenConversionProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.title !== "") { writer.uint32(10).string(message.title); @@ -808,5 +853,6 @@ export const ToggleTokenConversionProposal = { typeUrl: "/evmos.erc20.v1.ToggleTokenConversionProposal", value: ToggleTokenConversionProposal.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/evmos/erc20/v1/genesis.ts b/__fixtures__/v-next/outputv2/evmos/erc20/v1/genesis.ts index 6ded01e1cc..b70d204fb2 100644 --- a/__fixtures__/v-next/outputv2/evmos/erc20/v1/genesis.ts +++ b/__fixtures__/v-next/outputv2/evmos/erc20/v1/genesis.ts @@ -1,5 +1,6 @@ import { TokenPair, TokenPairAmino, TokenPairSDKType } from "./erc20"; import { BinaryReader, BinaryWriter } from "../../../binary"; +import { GlobalDecoderRegistry } from "../../../registry"; import { isSet, DeepPartial } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "evmos.erc20.v1"; @@ -121,6 +122,15 @@ function createBaseGenesisState(): GenesisState { */ export const GenesisState = { typeUrl: "/evmos.erc20.v1.GenesisState", + is(o: any): o is GenesisState { + return o && (o.$typeUrl === GenesisState.typeUrl || Params.is(o.params) && Array.isArray(o.tokenPairs) && (!o.tokenPairs.length || TokenPair.is(o.tokenPairs[0]))); + }, + isSDK(o: any): o is GenesisStateSDKType { + return o && (o.$typeUrl === GenesisState.typeUrl || Params.isSDK(o.params) && Array.isArray(o.token_pairs) && (!o.token_pairs.length || TokenPair.isSDK(o.token_pairs[0]))); + }, + isAmino(o: any): o is GenesisStateAmino { + return o && (o.$typeUrl === GenesisState.typeUrl || Params.isAmino(o.params) && Array.isArray(o.token_pairs) && (!o.token_pairs.length || TokenPair.isAmino(o.token_pairs[0]))); + }, encode(message: GenesisState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.params !== undefined) { Params.encode(message.params, writer.uint32(10).fork()).ldelim(); @@ -222,6 +232,13 @@ export const GenesisState = { typeUrl: "/evmos.erc20.v1.GenesisState", value: GenesisState.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GenesisState.typeUrl)) { + return; + } + Params.registerTypeUrl(); + TokenPair.registerTypeUrl(); } }; function createBaseParams(): Params { @@ -238,6 +255,15 @@ function createBaseParams(): Params { */ export const Params = { typeUrl: "/evmos.erc20.v1.Params", + is(o: any): o is Params { + return o && (o.$typeUrl === Params.typeUrl || typeof o.enableErc20 === "boolean" && typeof o.enableEvmHook === "boolean"); + }, + isSDK(o: any): o is ParamsSDKType { + return o && (o.$typeUrl === Params.typeUrl || typeof o.enable_erc20 === "boolean" && typeof o.enable_evm_hook === "boolean"); + }, + isAmino(o: any): o is ParamsAmino { + return o && (o.$typeUrl === Params.typeUrl || typeof o.enable_erc20 === "boolean" && typeof o.enable_evm_hook === "boolean"); + }, encode(message: Params, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.enableErc20 === true) { writer.uint32(8).bool(message.enableErc20); @@ -327,5 +353,6 @@ export const Params = { typeUrl: "/evmos.erc20.v1.Params", value: Params.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/evmos/erc20/v1/query.rpc.func.ts b/__fixtures__/v-next/outputv2/evmos/erc20/v1/query.rpc.func.ts new file mode 100644 index 0000000000..af6fe24194 --- /dev/null +++ b/__fixtures__/v-next/outputv2/evmos/erc20/v1/query.rpc.func.ts @@ -0,0 +1,41 @@ +import { buildQuery } from "../../../helper-func-types"; +import { QueryTokenPairsRequest, QueryTokenPairsResponse, QueryTokenPairRequest, QueryTokenPairResponse, QueryParamsRequest, QueryParamsResponse } from "./query"; +/** + * TokenPairs retrieves registered token pairs + * @name getTokenPairs + * @package evmos.erc20.v1 + * @see proto service: evmos.erc20.v1.TokenPairs + */ +export const getTokenPairs = buildQuery({ + encode: QueryTokenPairsRequest.encode, + decode: QueryTokenPairsResponse.decode, + service: "evmos.erc20.v1.Query", + method: "TokenPairs", + deps: [QueryTokenPairsRequest, QueryTokenPairsResponse] +}); +/** + * TokenPair retrieves a registered token pair + * @name getTokenPair + * @package evmos.erc20.v1 + * @see proto service: evmos.erc20.v1.TokenPair + */ +export const getTokenPair = buildQuery({ + encode: QueryTokenPairRequest.encode, + decode: QueryTokenPairResponse.decode, + service: "evmos.erc20.v1.Query", + method: "TokenPair", + deps: [QueryTokenPairRequest, QueryTokenPairResponse] +}); +/** + * Params retrieves the erc20 module params + * @name getParams + * @package evmos.erc20.v1 + * @see proto service: evmos.erc20.v1.Params + */ +export const getParams = buildQuery({ + encode: QueryParamsRequest.encode, + decode: QueryParamsResponse.decode, + service: "evmos.erc20.v1.Query", + method: "Params", + deps: [QueryParamsRequest, QueryParamsResponse] +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/evmos/erc20/v1/query.ts b/__fixtures__/v-next/outputv2/evmos/erc20/v1/query.ts index 9217ff2bfb..e879140bbc 100644 --- a/__fixtures__/v-next/outputv2/evmos/erc20/v1/query.ts +++ b/__fixtures__/v-next/outputv2/evmos/erc20/v1/query.ts @@ -2,6 +2,7 @@ import { PageRequest, PageRequestAmino, PageRequestSDKType, PageResponse, PageRe import { TokenPair, TokenPairAmino, TokenPairSDKType } from "./erc20"; import { Params, ParamsAmino, ParamsSDKType } from "./genesis"; import { BinaryReader, BinaryWriter } from "../../../binary"; +import { GlobalDecoderRegistry } from "../../../registry"; import { isSet, DeepPartial } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "evmos.erc20.v1"; @@ -258,6 +259,15 @@ function createBaseQueryTokenPairsRequest(): QueryTokenPairsRequest { */ export const QueryTokenPairsRequest = { typeUrl: "/evmos.erc20.v1.QueryTokenPairsRequest", + is(o: any): o is QueryTokenPairsRequest { + return o && o.$typeUrl === QueryTokenPairsRequest.typeUrl; + }, + isSDK(o: any): o is QueryTokenPairsRequestSDKType { + return o && o.$typeUrl === QueryTokenPairsRequest.typeUrl; + }, + isAmino(o: any): o is QueryTokenPairsRequestAmino { + return o && o.$typeUrl === QueryTokenPairsRequest.typeUrl; + }, encode(message: QueryTokenPairsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.pagination !== undefined) { PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); @@ -334,6 +344,12 @@ export const QueryTokenPairsRequest = { typeUrl: "/evmos.erc20.v1.QueryTokenPairsRequest", value: QueryTokenPairsRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryTokenPairsRequest.typeUrl)) { + return; + } + PageRequest.registerTypeUrl(); } }; function createBaseQueryTokenPairsResponse(): QueryTokenPairsResponse { @@ -351,6 +367,15 @@ function createBaseQueryTokenPairsResponse(): QueryTokenPairsResponse { */ export const QueryTokenPairsResponse = { typeUrl: "/evmos.erc20.v1.QueryTokenPairsResponse", + is(o: any): o is QueryTokenPairsResponse { + return o && (o.$typeUrl === QueryTokenPairsResponse.typeUrl || Array.isArray(o.tokenPairs) && (!o.tokenPairs.length || TokenPair.is(o.tokenPairs[0]))); + }, + isSDK(o: any): o is QueryTokenPairsResponseSDKType { + return o && (o.$typeUrl === QueryTokenPairsResponse.typeUrl || Array.isArray(o.token_pairs) && (!o.token_pairs.length || TokenPair.isSDK(o.token_pairs[0]))); + }, + isAmino(o: any): o is QueryTokenPairsResponseAmino { + return o && (o.$typeUrl === QueryTokenPairsResponse.typeUrl || Array.isArray(o.token_pairs) && (!o.token_pairs.length || TokenPair.isAmino(o.token_pairs[0]))); + }, encode(message: QueryTokenPairsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.tokenPairs) { TokenPair.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -452,6 +477,13 @@ export const QueryTokenPairsResponse = { typeUrl: "/evmos.erc20.v1.QueryTokenPairsResponse", value: QueryTokenPairsResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryTokenPairsResponse.typeUrl)) { + return; + } + TokenPair.registerTypeUrl(); + PageResponse.registerTypeUrl(); } }; function createBaseQueryTokenPairRequest(): QueryTokenPairRequest { @@ -467,6 +499,15 @@ function createBaseQueryTokenPairRequest(): QueryTokenPairRequest { */ export const QueryTokenPairRequest = { typeUrl: "/evmos.erc20.v1.QueryTokenPairRequest", + is(o: any): o is QueryTokenPairRequest { + return o && (o.$typeUrl === QueryTokenPairRequest.typeUrl || typeof o.token === "string"); + }, + isSDK(o: any): o is QueryTokenPairRequestSDKType { + return o && (o.$typeUrl === QueryTokenPairRequest.typeUrl || typeof o.token === "string"); + }, + isAmino(o: any): o is QueryTokenPairRequestAmino { + return o && (o.$typeUrl === QueryTokenPairRequest.typeUrl || typeof o.token === "string"); + }, encode(message: QueryTokenPairRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.token !== "") { writer.uint32(10).string(message.token); @@ -541,7 +582,8 @@ export const QueryTokenPairRequest = { typeUrl: "/evmos.erc20.v1.QueryTokenPairRequest", value: QueryTokenPairRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryTokenPairResponse(): QueryTokenPairResponse { return { @@ -557,6 +599,15 @@ function createBaseQueryTokenPairResponse(): QueryTokenPairResponse { */ export const QueryTokenPairResponse = { typeUrl: "/evmos.erc20.v1.QueryTokenPairResponse", + is(o: any): o is QueryTokenPairResponse { + return o && (o.$typeUrl === QueryTokenPairResponse.typeUrl || TokenPair.is(o.tokenPair)); + }, + isSDK(o: any): o is QueryTokenPairResponseSDKType { + return o && (o.$typeUrl === QueryTokenPairResponse.typeUrl || TokenPair.isSDK(o.token_pair)); + }, + isAmino(o: any): o is QueryTokenPairResponseAmino { + return o && (o.$typeUrl === QueryTokenPairResponse.typeUrl || TokenPair.isAmino(o.token_pair)); + }, encode(message: QueryTokenPairResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.tokenPair !== undefined) { TokenPair.encode(message.tokenPair, writer.uint32(10).fork()).ldelim(); @@ -633,6 +684,12 @@ export const QueryTokenPairResponse = { typeUrl: "/evmos.erc20.v1.QueryTokenPairResponse", value: QueryTokenPairResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryTokenPairResponse.typeUrl)) { + return; + } + TokenPair.registerTypeUrl(); } }; function createBaseQueryParamsRequest(): QueryParamsRequest { @@ -646,6 +703,15 @@ function createBaseQueryParamsRequest(): QueryParamsRequest { */ export const QueryParamsRequest = { typeUrl: "/evmos.erc20.v1.QueryParamsRequest", + is(o: any): o is QueryParamsRequest { + return o && o.$typeUrl === QueryParamsRequest.typeUrl; + }, + isSDK(o: any): o is QueryParamsRequestSDKType { + return o && o.$typeUrl === QueryParamsRequest.typeUrl; + }, + isAmino(o: any): o is QueryParamsRequestAmino { + return o && o.$typeUrl === QueryParamsRequest.typeUrl; + }, encode(_: QueryParamsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -704,7 +770,8 @@ export const QueryParamsRequest = { typeUrl: "/evmos.erc20.v1.QueryParamsRequest", value: QueryParamsRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryParamsResponse(): QueryParamsResponse { return { @@ -720,6 +787,15 @@ function createBaseQueryParamsResponse(): QueryParamsResponse { */ export const QueryParamsResponse = { typeUrl: "/evmos.erc20.v1.QueryParamsResponse", + is(o: any): o is QueryParamsResponse { + return o && (o.$typeUrl === QueryParamsResponse.typeUrl || Params.is(o.params)); + }, + isSDK(o: any): o is QueryParamsResponseSDKType { + return o && (o.$typeUrl === QueryParamsResponse.typeUrl || Params.isSDK(o.params)); + }, + isAmino(o: any): o is QueryParamsResponseAmino { + return o && (o.$typeUrl === QueryParamsResponse.typeUrl || Params.isAmino(o.params)); + }, encode(message: QueryParamsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.params !== undefined) { Params.encode(message.params, writer.uint32(10).fork()).ldelim(); @@ -796,5 +872,11 @@ export const QueryParamsResponse = { typeUrl: "/evmos.erc20.v1.QueryParamsResponse", value: QueryParamsResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryParamsResponse.typeUrl)) { + return; + } + Params.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/evmos/erc20/v1/tx.registry.ts b/__fixtures__/v-next/outputv2/evmos/erc20/v1/tx.registry.ts index 69b39f7d9b..d58306c174 100644 --- a/__fixtures__/v-next/outputv2/evmos/erc20/v1/tx.registry.ts +++ b/__fixtures__/v-next/outputv2/evmos/erc20/v1/tx.registry.ts @@ -1,11 +1,6 @@ -import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { TelescopeGeneratedType } from "../../../types"; import { MsgConvertCoin, MsgConvertERC20 } from "./tx"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/evmos.erc20.v1.MsgConvertCoin", MsgConvertCoin], ["/evmos.erc20.v1.MsgConvertERC20", MsgConvertERC20]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/evmos.erc20.v1.MsgConvertCoin", MsgConvertCoin], ["/evmos.erc20.v1.MsgConvertERC20", MsgConvertERC20]]; export const MessageComposer = { encoded: { convertCoin(value: MsgConvertCoin) { diff --git a/__fixtures__/v-next/outputv2/evmos/erc20/v1/tx.rpc.func.ts b/__fixtures__/v-next/outputv2/evmos/erc20/v1/tx.rpc.func.ts new file mode 100644 index 0000000000..f93dc81135 --- /dev/null +++ b/__fixtures__/v-next/outputv2/evmos/erc20/v1/tx.rpc.func.ts @@ -0,0 +1,22 @@ +import { buildTx } from "../../../helper-func-types"; +import { MsgConvertCoin, MsgConvertERC20 } from "./tx"; +/** + * ConvertCoin mints a ERC20 representation of the native Cosmos coin denom + * that is registered on the token mapping. + * @name convertCoin + * @package evmos.erc20.v1 + * @see proto service: evmos.erc20.v1.ConvertCoin + */ +export const convertCoin = buildTx({ + msg: MsgConvertCoin +}); +/** + * ConvertERC20 mints a native Cosmos coin representation of the ERC20 token + * contract that is registered on the token mapping. + * @name convertERC20 + * @package evmos.erc20.v1 + * @see proto service: evmos.erc20.v1.ConvertERC20 + */ +export const convertERC20 = buildTx({ + msg: MsgConvertERC20 +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/evmos/erc20/v1/tx.ts b/__fixtures__/v-next/outputv2/evmos/erc20/v1/tx.ts index f6feebe492..ff2a29b8d3 100644 --- a/__fixtures__/v-next/outputv2/evmos/erc20/v1/tx.ts +++ b/__fixtures__/v-next/outputv2/evmos/erc20/v1/tx.ts @@ -1,5 +1,6 @@ import { Coin, CoinAmino, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; +import { GlobalDecoderRegistry } from "../../../registry"; import { isSet, DeepPartial } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "evmos.erc20.v1"; @@ -208,6 +209,15 @@ function createBaseMsgConvertCoin(): MsgConvertCoin { */ export const MsgConvertCoin = { typeUrl: "/evmos.erc20.v1.MsgConvertCoin", + is(o: any): o is MsgConvertCoin { + return o && (o.$typeUrl === MsgConvertCoin.typeUrl || Coin.is(o.coin) && typeof o.receiver === "string" && typeof o.sender === "string"); + }, + isSDK(o: any): o is MsgConvertCoinSDKType { + return o && (o.$typeUrl === MsgConvertCoin.typeUrl || Coin.isSDK(o.coin) && typeof o.receiver === "string" && typeof o.sender === "string"); + }, + isAmino(o: any): o is MsgConvertCoinAmino { + return o && (o.$typeUrl === MsgConvertCoin.typeUrl || Coin.isAmino(o.coin) && typeof o.receiver === "string" && typeof o.sender === "string"); + }, encode(message: MsgConvertCoin, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.coin !== undefined) { Coin.encode(message.coin, writer.uint32(10).fork()).ldelim(); @@ -314,6 +324,12 @@ export const MsgConvertCoin = { typeUrl: "/evmos.erc20.v1.MsgConvertCoin", value: MsgConvertCoin.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgConvertCoin.typeUrl)) { + return; + } + Coin.registerTypeUrl(); } }; function createBaseMsgConvertCoinResponse(): MsgConvertCoinResponse { @@ -327,6 +343,15 @@ function createBaseMsgConvertCoinResponse(): MsgConvertCoinResponse { */ export const MsgConvertCoinResponse = { typeUrl: "/evmos.erc20.v1.MsgConvertCoinResponse", + is(o: any): o is MsgConvertCoinResponse { + return o && o.$typeUrl === MsgConvertCoinResponse.typeUrl; + }, + isSDK(o: any): o is MsgConvertCoinResponseSDKType { + return o && o.$typeUrl === MsgConvertCoinResponse.typeUrl; + }, + isAmino(o: any): o is MsgConvertCoinResponseAmino { + return o && o.$typeUrl === MsgConvertCoinResponse.typeUrl; + }, encode(_: MsgConvertCoinResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -385,7 +410,8 @@ export const MsgConvertCoinResponse = { typeUrl: "/evmos.erc20.v1.MsgConvertCoinResponse", value: MsgConvertCoinResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgConvertERC20(): MsgConvertERC20 { return { @@ -404,6 +430,15 @@ function createBaseMsgConvertERC20(): MsgConvertERC20 { */ export const MsgConvertERC20 = { typeUrl: "/evmos.erc20.v1.MsgConvertERC20", + is(o: any): o is MsgConvertERC20 { + return o && (o.$typeUrl === MsgConvertERC20.typeUrl || typeof o.contractAddress === "string" && typeof o.amount === "string" && typeof o.receiver === "string" && typeof o.sender === "string"); + }, + isSDK(o: any): o is MsgConvertERC20SDKType { + return o && (o.$typeUrl === MsgConvertERC20.typeUrl || typeof o.contract_address === "string" && typeof o.amount === "string" && typeof o.receiver === "string" && typeof o.sender === "string"); + }, + isAmino(o: any): o is MsgConvertERC20Amino { + return o && (o.$typeUrl === MsgConvertERC20.typeUrl || typeof o.contract_address === "string" && typeof o.amount === "string" && typeof o.receiver === "string" && typeof o.sender === "string"); + }, encode(message: MsgConvertERC20, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.contractAddress !== "") { writer.uint32(10).string(message.contractAddress); @@ -523,7 +558,8 @@ export const MsgConvertERC20 = { typeUrl: "/evmos.erc20.v1.MsgConvertERC20", value: MsgConvertERC20.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgConvertERC20Response(): MsgConvertERC20Response { return {}; @@ -536,6 +572,15 @@ function createBaseMsgConvertERC20Response(): MsgConvertERC20Response { */ export const MsgConvertERC20Response = { typeUrl: "/evmos.erc20.v1.MsgConvertERC20Response", + is(o: any): o is MsgConvertERC20Response { + return o && o.$typeUrl === MsgConvertERC20Response.typeUrl; + }, + isSDK(o: any): o is MsgConvertERC20ResponseSDKType { + return o && o.$typeUrl === MsgConvertERC20Response.typeUrl; + }, + isAmino(o: any): o is MsgConvertERC20ResponseAmino { + return o && o.$typeUrl === MsgConvertERC20Response.typeUrl; + }, encode(_: MsgConvertERC20Response, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -594,5 +639,6 @@ export const MsgConvertERC20Response = { typeUrl: "/evmos.erc20.v1.MsgConvertERC20Response", value: MsgConvertERC20Response.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/evmos/fees/v1/fees.ts b/__fixtures__/v-next/outputv2/evmos/fees/v1/fees.ts index 3c507d0163..17080458da 100644 --- a/__fixtures__/v-next/outputv2/evmos/fees/v1/fees.ts +++ b/__fixtures__/v-next/outputv2/evmos/fees/v1/fees.ts @@ -82,6 +82,15 @@ function createBaseDevFeeInfo(): DevFeeInfo { */ export const DevFeeInfo = { typeUrl: "/evmos.fees.v1.DevFeeInfo", + is(o: any): o is DevFeeInfo { + return o && (o.$typeUrl === DevFeeInfo.typeUrl || typeof o.contractAddress === "string" && typeof o.deployerAddress === "string" && typeof o.withdrawAddress === "string"); + }, + isSDK(o: any): o is DevFeeInfoSDKType { + return o && (o.$typeUrl === DevFeeInfo.typeUrl || typeof o.contract_address === "string" && typeof o.deployer_address === "string" && typeof o.withdraw_address === "string"); + }, + isAmino(o: any): o is DevFeeInfoAmino { + return o && (o.$typeUrl === DevFeeInfo.typeUrl || typeof o.contract_address === "string" && typeof o.deployer_address === "string" && typeof o.withdraw_address === "string"); + }, encode(message: DevFeeInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.contractAddress !== "") { writer.uint32(10).string(message.contractAddress); @@ -186,5 +195,6 @@ export const DevFeeInfo = { typeUrl: "/evmos.fees.v1.DevFeeInfo", value: DevFeeInfo.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/evmos/fees/v1/genesis.ts b/__fixtures__/v-next/outputv2/evmos/fees/v1/genesis.ts index 3403e61674..92d22edc73 100644 --- a/__fixtures__/v-next/outputv2/evmos/fees/v1/genesis.ts +++ b/__fixtures__/v-next/outputv2/evmos/fees/v1/genesis.ts @@ -1,8 +1,9 @@ import { DevFeeInfo, DevFeeInfoAmino, DevFeeInfoSDKType } from "./fees"; import { BinaryReader, BinaryWriter } from "../../../binary"; +import { GlobalDecoderRegistry } from "../../../registry"; import { isSet, DeepPartial } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; -import { Decimal } from "@cosmjs/math"; +import { Decimal } from "@interchainjs/math"; export const protobufPackage = "evmos.fees.v1"; /** * GenesisState defines the module's genesis state. @@ -151,6 +152,15 @@ function createBaseGenesisState(): GenesisState { */ export const GenesisState = { typeUrl: "/evmos.fees.v1.GenesisState", + is(o: any): o is GenesisState { + return o && (o.$typeUrl === GenesisState.typeUrl || Params.is(o.params) && Array.isArray(o.devFeeInfos) && (!o.devFeeInfos.length || DevFeeInfo.is(o.devFeeInfos[0]))); + }, + isSDK(o: any): o is GenesisStateSDKType { + return o && (o.$typeUrl === GenesisState.typeUrl || Params.isSDK(o.params) && Array.isArray(o.dev_fee_infos) && (!o.dev_fee_infos.length || DevFeeInfo.isSDK(o.dev_fee_infos[0]))); + }, + isAmino(o: any): o is GenesisStateAmino { + return o && (o.$typeUrl === GenesisState.typeUrl || Params.isAmino(o.params) && Array.isArray(o.dev_fee_infos) && (!o.dev_fee_infos.length || DevFeeInfo.isAmino(o.dev_fee_infos[0]))); + }, encode(message: GenesisState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.params !== undefined) { Params.encode(message.params, writer.uint32(10).fork()).ldelim(); @@ -252,6 +262,13 @@ export const GenesisState = { typeUrl: "/evmos.fees.v1.GenesisState", value: GenesisState.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GenesisState.typeUrl)) { + return; + } + Params.registerTypeUrl(); + DevFeeInfo.registerTypeUrl(); } }; function createBaseParams(): Params { @@ -271,6 +288,15 @@ function createBaseParams(): Params { */ export const Params = { typeUrl: "/evmos.fees.v1.Params", + is(o: any): o is Params { + return o && (o.$typeUrl === Params.typeUrl || typeof o.enableFees === "boolean" && typeof o.developerShares === "string" && typeof o.validatorShares === "string" && typeof o.addrDerivationCostCreate === "bigint" && typeof o.minGasPrice === "string"); + }, + isSDK(o: any): o is ParamsSDKType { + return o && (o.$typeUrl === Params.typeUrl || typeof o.enable_fees === "boolean" && typeof o.developer_shares === "string" && typeof o.validator_shares === "string" && typeof o.addr_derivation_cost_create === "bigint" && typeof o.min_gas_price === "string"); + }, + isAmino(o: any): o is ParamsAmino { + return o && (o.$typeUrl === Params.typeUrl || typeof o.enable_fees === "boolean" && typeof o.developer_shares === "string" && typeof o.validator_shares === "string" && typeof o.addr_derivation_cost_create === "bigint" && typeof o.min_gas_price === "string"); + }, encode(message: Params, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.enableFees === true) { writer.uint32(8).bool(message.enableFees); @@ -387,10 +413,10 @@ export const Params = { toAmino(message: Params): ParamsAmino { const obj: any = {}; obj.enable_fees = message.enableFees === false ? undefined : message.enableFees; - obj.developer_shares = message.developerShares === "" ? undefined : message.developerShares; - obj.validator_shares = message.validatorShares === "" ? undefined : message.validatorShares; + obj.developer_shares = message.developerShares === "" ? undefined : Decimal.fromUserInput(message.developerShares, 18).atomics; + obj.validator_shares = message.validatorShares === "" ? undefined : Decimal.fromUserInput(message.validatorShares, 18).atomics; obj.addr_derivation_cost_create = message.addrDerivationCostCreate !== BigInt(0) ? message.addrDerivationCostCreate?.toString() : undefined; - obj.min_gas_price = message.minGasPrice === "" ? undefined : message.minGasPrice; + obj.min_gas_price = message.minGasPrice === "" ? undefined : Decimal.fromUserInput(message.minGasPrice, 18).atomics; return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { @@ -407,5 +433,6 @@ export const Params = { typeUrl: "/evmos.fees.v1.Params", value: Params.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/evmos/fees/v1/query.rpc.func.ts b/__fixtures__/v-next/outputv2/evmos/fees/v1/query.rpc.func.ts new file mode 100644 index 0000000000..f3cbc3a754 --- /dev/null +++ b/__fixtures__/v-next/outputv2/evmos/fees/v1/query.rpc.func.ts @@ -0,0 +1,55 @@ +import { buildQuery } from "../../../helper-func-types"; +import { QueryDevFeeInfosRequest, QueryDevFeeInfosResponse, QueryDevFeeInfoRequest, QueryDevFeeInfoResponse, QueryParamsRequest, QueryParamsResponse, QueryDevFeeInfosPerDeployerRequest, QueryDevFeeInfosPerDeployerResponse } from "./query"; +/** + * DevFeeInfos retrieves all registered contracts for fee distribution + * @name getDevFeeInfos + * @package evmos.fees.v1 + * @see proto service: evmos.fees.v1.DevFeeInfos + */ +export const getDevFeeInfos = buildQuery({ + encode: QueryDevFeeInfosRequest.encode, + decode: QueryDevFeeInfosResponse.decode, + service: "evmos.fees.v1.Query", + method: "DevFeeInfos", + deps: [QueryDevFeeInfosRequest, QueryDevFeeInfosResponse] +}); +/** + * DevFeeInfo retrieves a registered contract for fee distribution + * @name getDevFeeInfo + * @package evmos.fees.v1 + * @see proto service: evmos.fees.v1.DevFeeInfo + */ +export const getDevFeeInfo = buildQuery({ + encode: QueryDevFeeInfoRequest.encode, + decode: QueryDevFeeInfoResponse.decode, + service: "evmos.fees.v1.Query", + method: "DevFeeInfo", + deps: [QueryDevFeeInfoRequest, QueryDevFeeInfoResponse] +}); +/** + * Params retrieves the fees module params + * @name getParams + * @package evmos.fees.v1 + * @see proto service: evmos.fees.v1.Params + */ +export const getParams = buildQuery({ + encode: QueryParamsRequest.encode, + decode: QueryParamsResponse.decode, + service: "evmos.fees.v1.Query", + method: "Params", + deps: [QueryParamsRequest, QueryParamsResponse] +}); +/** + * DevFeeInfosPerDeployer retrieves all contracts that a deployer has + * registered for fee distribution + * @name getDevFeeInfosPerDeployer + * @package evmos.fees.v1 + * @see proto service: evmos.fees.v1.DevFeeInfosPerDeployer + */ +export const getDevFeeInfosPerDeployer = buildQuery({ + encode: QueryDevFeeInfosPerDeployerRequest.encode, + decode: QueryDevFeeInfosPerDeployerResponse.decode, + service: "evmos.fees.v1.Query", + method: "DevFeeInfosPerDeployer", + deps: [QueryDevFeeInfosPerDeployerRequest, QueryDevFeeInfosPerDeployerResponse] +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/evmos/fees/v1/query.ts b/__fixtures__/v-next/outputv2/evmos/fees/v1/query.ts index 798655cfcc..c9597c5fa5 100644 --- a/__fixtures__/v-next/outputv2/evmos/fees/v1/query.ts +++ b/__fixtures__/v-next/outputv2/evmos/fees/v1/query.ts @@ -2,6 +2,7 @@ import { PageRequest, PageRequestAmino, PageRequestSDKType, PageResponse, PageRe import { DevFeeInfo, DevFeeInfoAmino, DevFeeInfoSDKType } from "./fees"; import { Params, ParamsAmino, ParamsSDKType } from "./genesis"; import { BinaryReader, BinaryWriter } from "../../../binary"; +import { GlobalDecoderRegistry } from "../../../registry"; import { isSet, DeepPartial } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "evmos.fees.v1"; @@ -359,6 +360,15 @@ function createBaseQueryDevFeeInfosRequest(): QueryDevFeeInfosRequest { */ export const QueryDevFeeInfosRequest = { typeUrl: "/evmos.fees.v1.QueryDevFeeInfosRequest", + is(o: any): o is QueryDevFeeInfosRequest { + return o && o.$typeUrl === QueryDevFeeInfosRequest.typeUrl; + }, + isSDK(o: any): o is QueryDevFeeInfosRequestSDKType { + return o && o.$typeUrl === QueryDevFeeInfosRequest.typeUrl; + }, + isAmino(o: any): o is QueryDevFeeInfosRequestAmino { + return o && o.$typeUrl === QueryDevFeeInfosRequest.typeUrl; + }, encode(message: QueryDevFeeInfosRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.pagination !== undefined) { PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); @@ -435,6 +445,12 @@ export const QueryDevFeeInfosRequest = { typeUrl: "/evmos.fees.v1.QueryDevFeeInfosRequest", value: QueryDevFeeInfosRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryDevFeeInfosRequest.typeUrl)) { + return; + } + PageRequest.registerTypeUrl(); } }; function createBaseQueryDevFeeInfosResponse(): QueryDevFeeInfosResponse { @@ -452,6 +468,15 @@ function createBaseQueryDevFeeInfosResponse(): QueryDevFeeInfosResponse { */ export const QueryDevFeeInfosResponse = { typeUrl: "/evmos.fees.v1.QueryDevFeeInfosResponse", + is(o: any): o is QueryDevFeeInfosResponse { + return o && (o.$typeUrl === QueryDevFeeInfosResponse.typeUrl || Array.isArray(o.fees) && (!o.fees.length || DevFeeInfo.is(o.fees[0]))); + }, + isSDK(o: any): o is QueryDevFeeInfosResponseSDKType { + return o && (o.$typeUrl === QueryDevFeeInfosResponse.typeUrl || Array.isArray(o.fees) && (!o.fees.length || DevFeeInfo.isSDK(o.fees[0]))); + }, + isAmino(o: any): o is QueryDevFeeInfosResponseAmino { + return o && (o.$typeUrl === QueryDevFeeInfosResponse.typeUrl || Array.isArray(o.fees) && (!o.fees.length || DevFeeInfo.isAmino(o.fees[0]))); + }, encode(message: QueryDevFeeInfosResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.fees) { DevFeeInfo.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -553,6 +578,13 @@ export const QueryDevFeeInfosResponse = { typeUrl: "/evmos.fees.v1.QueryDevFeeInfosResponse", value: QueryDevFeeInfosResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryDevFeeInfosResponse.typeUrl)) { + return; + } + DevFeeInfo.registerTypeUrl(); + PageResponse.registerTypeUrl(); } }; function createBaseQueryDevFeeInfoRequest(): QueryDevFeeInfoRequest { @@ -569,6 +601,15 @@ function createBaseQueryDevFeeInfoRequest(): QueryDevFeeInfoRequest { */ export const QueryDevFeeInfoRequest = { typeUrl: "/evmos.fees.v1.QueryDevFeeInfoRequest", + is(o: any): o is QueryDevFeeInfoRequest { + return o && (o.$typeUrl === QueryDevFeeInfoRequest.typeUrl || typeof o.contractAddress === "string"); + }, + isSDK(o: any): o is QueryDevFeeInfoRequestSDKType { + return o && (o.$typeUrl === QueryDevFeeInfoRequest.typeUrl || typeof o.contract_address === "string"); + }, + isAmino(o: any): o is QueryDevFeeInfoRequestAmino { + return o && (o.$typeUrl === QueryDevFeeInfoRequest.typeUrl || typeof o.contract_address === "string"); + }, encode(message: QueryDevFeeInfoRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.contractAddress !== "") { writer.uint32(10).string(message.contractAddress); @@ -643,7 +684,8 @@ export const QueryDevFeeInfoRequest = { typeUrl: "/evmos.fees.v1.QueryDevFeeInfoRequest", value: QueryDevFeeInfoRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryDevFeeInfoResponse(): QueryDevFeeInfoResponse { return { @@ -659,6 +701,15 @@ function createBaseQueryDevFeeInfoResponse(): QueryDevFeeInfoResponse { */ export const QueryDevFeeInfoResponse = { typeUrl: "/evmos.fees.v1.QueryDevFeeInfoResponse", + is(o: any): o is QueryDevFeeInfoResponse { + return o && (o.$typeUrl === QueryDevFeeInfoResponse.typeUrl || DevFeeInfo.is(o.fee)); + }, + isSDK(o: any): o is QueryDevFeeInfoResponseSDKType { + return o && (o.$typeUrl === QueryDevFeeInfoResponse.typeUrl || DevFeeInfo.isSDK(o.fee)); + }, + isAmino(o: any): o is QueryDevFeeInfoResponseAmino { + return o && (o.$typeUrl === QueryDevFeeInfoResponse.typeUrl || DevFeeInfo.isAmino(o.fee)); + }, encode(message: QueryDevFeeInfoResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.fee !== undefined) { DevFeeInfo.encode(message.fee, writer.uint32(10).fork()).ldelim(); @@ -735,6 +786,12 @@ export const QueryDevFeeInfoResponse = { typeUrl: "/evmos.fees.v1.QueryDevFeeInfoResponse", value: QueryDevFeeInfoResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryDevFeeInfoResponse.typeUrl)) { + return; + } + DevFeeInfo.registerTypeUrl(); } }; function createBaseQueryParamsRequest(): QueryParamsRequest { @@ -748,6 +805,15 @@ function createBaseQueryParamsRequest(): QueryParamsRequest { */ export const QueryParamsRequest = { typeUrl: "/evmos.fees.v1.QueryParamsRequest", + is(o: any): o is QueryParamsRequest { + return o && o.$typeUrl === QueryParamsRequest.typeUrl; + }, + isSDK(o: any): o is QueryParamsRequestSDKType { + return o && o.$typeUrl === QueryParamsRequest.typeUrl; + }, + isAmino(o: any): o is QueryParamsRequestAmino { + return o && o.$typeUrl === QueryParamsRequest.typeUrl; + }, encode(_: QueryParamsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -806,7 +872,8 @@ export const QueryParamsRequest = { typeUrl: "/evmos.fees.v1.QueryParamsRequest", value: QueryParamsRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryParamsResponse(): QueryParamsResponse { return { @@ -822,6 +889,15 @@ function createBaseQueryParamsResponse(): QueryParamsResponse { */ export const QueryParamsResponse = { typeUrl: "/evmos.fees.v1.QueryParamsResponse", + is(o: any): o is QueryParamsResponse { + return o && (o.$typeUrl === QueryParamsResponse.typeUrl || Params.is(o.params)); + }, + isSDK(o: any): o is QueryParamsResponseSDKType { + return o && (o.$typeUrl === QueryParamsResponse.typeUrl || Params.isSDK(o.params)); + }, + isAmino(o: any): o is QueryParamsResponseAmino { + return o && (o.$typeUrl === QueryParamsResponse.typeUrl || Params.isAmino(o.params)); + }, encode(message: QueryParamsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.params !== undefined) { Params.encode(message.params, writer.uint32(10).fork()).ldelim(); @@ -898,6 +974,12 @@ export const QueryParamsResponse = { typeUrl: "/evmos.fees.v1.QueryParamsResponse", value: QueryParamsResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryParamsResponse.typeUrl)) { + return; + } + Params.registerTypeUrl(); } }; function createBaseQueryDevFeeInfosPerDeployerRequest(): QueryDevFeeInfosPerDeployerRequest { @@ -915,6 +997,15 @@ function createBaseQueryDevFeeInfosPerDeployerRequest(): QueryDevFeeInfosPerDepl */ export const QueryDevFeeInfosPerDeployerRequest = { typeUrl: "/evmos.fees.v1.QueryDevFeeInfosPerDeployerRequest", + is(o: any): o is QueryDevFeeInfosPerDeployerRequest { + return o && (o.$typeUrl === QueryDevFeeInfosPerDeployerRequest.typeUrl || typeof o.deployerAddress === "string"); + }, + isSDK(o: any): o is QueryDevFeeInfosPerDeployerRequestSDKType { + return o && (o.$typeUrl === QueryDevFeeInfosPerDeployerRequest.typeUrl || typeof o.deployer_address === "string"); + }, + isAmino(o: any): o is QueryDevFeeInfosPerDeployerRequestAmino { + return o && (o.$typeUrl === QueryDevFeeInfosPerDeployerRequest.typeUrl || typeof o.deployer_address === "string"); + }, encode(message: QueryDevFeeInfosPerDeployerRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.deployerAddress !== "") { writer.uint32(10).string(message.deployerAddress); @@ -1006,6 +1097,12 @@ export const QueryDevFeeInfosPerDeployerRequest = { typeUrl: "/evmos.fees.v1.QueryDevFeeInfosPerDeployerRequest", value: QueryDevFeeInfosPerDeployerRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryDevFeeInfosPerDeployerRequest.typeUrl)) { + return; + } + PageRequest.registerTypeUrl(); } }; function createBaseQueryDevFeeInfosPerDeployerResponse(): QueryDevFeeInfosPerDeployerResponse { @@ -1023,6 +1120,15 @@ function createBaseQueryDevFeeInfosPerDeployerResponse(): QueryDevFeeInfosPerDep */ export const QueryDevFeeInfosPerDeployerResponse = { typeUrl: "/evmos.fees.v1.QueryDevFeeInfosPerDeployerResponse", + is(o: any): o is QueryDevFeeInfosPerDeployerResponse { + return o && (o.$typeUrl === QueryDevFeeInfosPerDeployerResponse.typeUrl || Array.isArray(o.fees) && (!o.fees.length || DevFeeInfo.is(o.fees[0]))); + }, + isSDK(o: any): o is QueryDevFeeInfosPerDeployerResponseSDKType { + return o && (o.$typeUrl === QueryDevFeeInfosPerDeployerResponse.typeUrl || Array.isArray(o.fees) && (!o.fees.length || DevFeeInfo.isSDK(o.fees[0]))); + }, + isAmino(o: any): o is QueryDevFeeInfosPerDeployerResponseAmino { + return o && (o.$typeUrl === QueryDevFeeInfosPerDeployerResponse.typeUrl || Array.isArray(o.fees) && (!o.fees.length || DevFeeInfo.isAmino(o.fees[0]))); + }, encode(message: QueryDevFeeInfosPerDeployerResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.fees) { DevFeeInfo.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -1124,5 +1230,12 @@ export const QueryDevFeeInfosPerDeployerResponse = { typeUrl: "/evmos.fees.v1.QueryDevFeeInfosPerDeployerResponse", value: QueryDevFeeInfosPerDeployerResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryDevFeeInfosPerDeployerResponse.typeUrl)) { + return; + } + DevFeeInfo.registerTypeUrl(); + PageResponse.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/evmos/fees/v1/tx.registry.ts b/__fixtures__/v-next/outputv2/evmos/fees/v1/tx.registry.ts index 8d7b72d7b7..55307861da 100644 --- a/__fixtures__/v-next/outputv2/evmos/fees/v1/tx.registry.ts +++ b/__fixtures__/v-next/outputv2/evmos/fees/v1/tx.registry.ts @@ -1,11 +1,6 @@ -import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { TelescopeGeneratedType } from "../../../types"; import { MsgRegisterDevFeeInfo, MsgCancelDevFeeInfo, MsgUpdateDevFeeInfo } from "./tx"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/evmos.fees.v1.MsgRegisterDevFeeInfo", MsgRegisterDevFeeInfo], ["/evmos.fees.v1.MsgCancelDevFeeInfo", MsgCancelDevFeeInfo], ["/evmos.fees.v1.MsgUpdateDevFeeInfo", MsgUpdateDevFeeInfo]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/evmos.fees.v1.MsgRegisterDevFeeInfo", MsgRegisterDevFeeInfo], ["/evmos.fees.v1.MsgCancelDevFeeInfo", MsgCancelDevFeeInfo], ["/evmos.fees.v1.MsgUpdateDevFeeInfo", MsgUpdateDevFeeInfo]]; export const MessageComposer = { encoded: { registerDevFeeInfo(value: MsgRegisterDevFeeInfo) { diff --git a/__fixtures__/v-next/outputv2/evmos/fees/v1/tx.rpc.func.ts b/__fixtures__/v-next/outputv2/evmos/fees/v1/tx.rpc.func.ts new file mode 100644 index 0000000000..c8f7b0f452 --- /dev/null +++ b/__fixtures__/v-next/outputv2/evmos/fees/v1/tx.rpc.func.ts @@ -0,0 +1,31 @@ +import { buildTx } from "../../../helper-func-types"; +import { MsgRegisterDevFeeInfo, MsgCancelDevFeeInfo, MsgUpdateDevFeeInfo } from "./tx"; +/** + * RegisterDevFeeInfo is used by a deployer to register a new contract for + * receiving transaction fees + * @name registerDevFeeInfo + * @package evmos.fees.v1 + * @see proto service: evmos.fees.v1.RegisterDevFeeInfo + */ +export const registerDevFeeInfo = buildTx({ + msg: MsgRegisterDevFeeInfo +}); +/** + * CancelDevFeeInfo is used by a deployer to cancel a registered contract + * and stop receiving transaction fees + * @name cancelDevFeeInfo + * @package evmos.fees.v1 + * @see proto service: evmos.fees.v1.CancelDevFeeInfo + */ +export const cancelDevFeeInfo = buildTx({ + msg: MsgCancelDevFeeInfo +}); +/** + * UpdateDevFeeInfo is used by a deployer to update the withdraw address + * @name updateDevFeeInfo + * @package evmos.fees.v1 + * @see proto service: evmos.fees.v1.UpdateDevFeeInfo + */ +export const updateDevFeeInfo = buildTx({ + msg: MsgUpdateDevFeeInfo +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/evmos/fees/v1/tx.ts b/__fixtures__/v-next/outputv2/evmos/fees/v1/tx.ts index 7458a1b476..4c4fa857ee 100644 --- a/__fixtures__/v-next/outputv2/evmos/fees/v1/tx.ts +++ b/__fixtures__/v-next/outputv2/evmos/fees/v1/tx.ts @@ -297,6 +297,15 @@ function createBaseMsgRegisterDevFeeInfo(): MsgRegisterDevFeeInfo { */ export const MsgRegisterDevFeeInfo = { typeUrl: "/evmos.fees.v1.MsgRegisterDevFeeInfo", + is(o: any): o is MsgRegisterDevFeeInfo { + return o && (o.$typeUrl === MsgRegisterDevFeeInfo.typeUrl || typeof o.contractAddress === "string" && typeof o.deployerAddress === "string" && typeof o.withdrawAddress === "string" && Array.isArray(o.nonces) && (!o.nonces.length || typeof o.nonces[0] === "bigint")); + }, + isSDK(o: any): o is MsgRegisterDevFeeInfoSDKType { + return o && (o.$typeUrl === MsgRegisterDevFeeInfo.typeUrl || typeof o.contract_address === "string" && typeof o.deployer_address === "string" && typeof o.withdraw_address === "string" && Array.isArray(o.nonces) && (!o.nonces.length || typeof o.nonces[0] === "bigint")); + }, + isAmino(o: any): o is MsgRegisterDevFeeInfoAmino { + return o && (o.$typeUrl === MsgRegisterDevFeeInfo.typeUrl || typeof o.contract_address === "string" && typeof o.deployer_address === "string" && typeof o.withdraw_address === "string" && Array.isArray(o.nonces) && (!o.nonces.length || typeof o.nonces[0] === "bigint")); + }, encode(message: MsgRegisterDevFeeInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.contractAddress !== "") { writer.uint32(10).string(message.contractAddress); @@ -435,7 +444,8 @@ export const MsgRegisterDevFeeInfo = { typeUrl: "/evmos.fees.v1.MsgRegisterDevFeeInfo", value: MsgRegisterDevFeeInfo.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgRegisterDevFeeInfoResponse(): MsgRegisterDevFeeInfoResponse { return {}; @@ -449,6 +459,15 @@ function createBaseMsgRegisterDevFeeInfoResponse(): MsgRegisterDevFeeInfoRespons */ export const MsgRegisterDevFeeInfoResponse = { typeUrl: "/evmos.fees.v1.MsgRegisterDevFeeInfoResponse", + is(o: any): o is MsgRegisterDevFeeInfoResponse { + return o && o.$typeUrl === MsgRegisterDevFeeInfoResponse.typeUrl; + }, + isSDK(o: any): o is MsgRegisterDevFeeInfoResponseSDKType { + return o && o.$typeUrl === MsgRegisterDevFeeInfoResponse.typeUrl; + }, + isAmino(o: any): o is MsgRegisterDevFeeInfoResponseAmino { + return o && o.$typeUrl === MsgRegisterDevFeeInfoResponse.typeUrl; + }, encode(_: MsgRegisterDevFeeInfoResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -507,7 +526,8 @@ export const MsgRegisterDevFeeInfoResponse = { typeUrl: "/evmos.fees.v1.MsgRegisterDevFeeInfoResponse", value: MsgRegisterDevFeeInfoResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgCancelDevFeeInfo(): MsgCancelDevFeeInfo { return { @@ -524,6 +544,15 @@ function createBaseMsgCancelDevFeeInfo(): MsgCancelDevFeeInfo { */ export const MsgCancelDevFeeInfo = { typeUrl: "/evmos.fees.v1.MsgCancelDevFeeInfo", + is(o: any): o is MsgCancelDevFeeInfo { + return o && (o.$typeUrl === MsgCancelDevFeeInfo.typeUrl || typeof o.contractAddress === "string" && typeof o.deployerAddress === "string"); + }, + isSDK(o: any): o is MsgCancelDevFeeInfoSDKType { + return o && (o.$typeUrl === MsgCancelDevFeeInfo.typeUrl || typeof o.contract_address === "string" && typeof o.deployer_address === "string"); + }, + isAmino(o: any): o is MsgCancelDevFeeInfoAmino { + return o && (o.$typeUrl === MsgCancelDevFeeInfo.typeUrl || typeof o.contract_address === "string" && typeof o.deployer_address === "string"); + }, encode(message: MsgCancelDevFeeInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.contractAddress !== "") { writer.uint32(10).string(message.contractAddress); @@ -613,7 +642,8 @@ export const MsgCancelDevFeeInfo = { typeUrl: "/evmos.fees.v1.MsgCancelDevFeeInfo", value: MsgCancelDevFeeInfo.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgCancelDevFeeInfoResponse(): MsgCancelDevFeeInfoResponse { return {}; @@ -626,6 +656,15 @@ function createBaseMsgCancelDevFeeInfoResponse(): MsgCancelDevFeeInfoResponse { */ export const MsgCancelDevFeeInfoResponse = { typeUrl: "/evmos.fees.v1.MsgCancelDevFeeInfoResponse", + is(o: any): o is MsgCancelDevFeeInfoResponse { + return o && o.$typeUrl === MsgCancelDevFeeInfoResponse.typeUrl; + }, + isSDK(o: any): o is MsgCancelDevFeeInfoResponseSDKType { + return o && o.$typeUrl === MsgCancelDevFeeInfoResponse.typeUrl; + }, + isAmino(o: any): o is MsgCancelDevFeeInfoResponseAmino { + return o && o.$typeUrl === MsgCancelDevFeeInfoResponse.typeUrl; + }, encode(_: MsgCancelDevFeeInfoResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -684,7 +723,8 @@ export const MsgCancelDevFeeInfoResponse = { typeUrl: "/evmos.fees.v1.MsgCancelDevFeeInfoResponse", value: MsgCancelDevFeeInfoResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgUpdateDevFeeInfo(): MsgUpdateDevFeeInfo { return { @@ -702,6 +742,15 @@ function createBaseMsgUpdateDevFeeInfo(): MsgUpdateDevFeeInfo { */ export const MsgUpdateDevFeeInfo = { typeUrl: "/evmos.fees.v1.MsgUpdateDevFeeInfo", + is(o: any): o is MsgUpdateDevFeeInfo { + return o && (o.$typeUrl === MsgUpdateDevFeeInfo.typeUrl || typeof o.contractAddress === "string" && typeof o.deployerAddress === "string" && typeof o.withdrawAddress === "string"); + }, + isSDK(o: any): o is MsgUpdateDevFeeInfoSDKType { + return o && (o.$typeUrl === MsgUpdateDevFeeInfo.typeUrl || typeof o.contract_address === "string" && typeof o.deployer_address === "string" && typeof o.withdraw_address === "string"); + }, + isAmino(o: any): o is MsgUpdateDevFeeInfoAmino { + return o && (o.$typeUrl === MsgUpdateDevFeeInfo.typeUrl || typeof o.contract_address === "string" && typeof o.deployer_address === "string" && typeof o.withdraw_address === "string"); + }, encode(message: MsgUpdateDevFeeInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.contractAddress !== "") { writer.uint32(10).string(message.contractAddress); @@ -806,7 +855,8 @@ export const MsgUpdateDevFeeInfo = { typeUrl: "/evmos.fees.v1.MsgUpdateDevFeeInfo", value: MsgUpdateDevFeeInfo.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgUpdateDevFeeInfoResponse(): MsgUpdateDevFeeInfoResponse { return {}; @@ -819,6 +869,15 @@ function createBaseMsgUpdateDevFeeInfoResponse(): MsgUpdateDevFeeInfoResponse { */ export const MsgUpdateDevFeeInfoResponse = { typeUrl: "/evmos.fees.v1.MsgUpdateDevFeeInfoResponse", + is(o: any): o is MsgUpdateDevFeeInfoResponse { + return o && o.$typeUrl === MsgUpdateDevFeeInfoResponse.typeUrl; + }, + isSDK(o: any): o is MsgUpdateDevFeeInfoResponseSDKType { + return o && o.$typeUrl === MsgUpdateDevFeeInfoResponse.typeUrl; + }, + isAmino(o: any): o is MsgUpdateDevFeeInfoResponseAmino { + return o && o.$typeUrl === MsgUpdateDevFeeInfoResponse.typeUrl; + }, encode(_: MsgUpdateDevFeeInfoResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -877,5 +936,6 @@ export const MsgUpdateDevFeeInfoResponse = { typeUrl: "/evmos.fees.v1.MsgUpdateDevFeeInfoResponse", value: MsgUpdateDevFeeInfoResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/evmos/incentives/v1/genesis.ts b/__fixtures__/v-next/outputv2/evmos/incentives/v1/genesis.ts index 6282530fde..ada3c50694 100644 --- a/__fixtures__/v-next/outputv2/evmos/incentives/v1/genesis.ts +++ b/__fixtures__/v-next/outputv2/evmos/incentives/v1/genesis.ts @@ -1,8 +1,9 @@ import { Incentive, IncentiveAmino, IncentiveSDKType, GasMeter, GasMeterAmino, GasMeterSDKType } from "./incentives"; import { BinaryReader, BinaryWriter } from "../../../binary"; +import { GlobalDecoderRegistry } from "../../../registry"; import { isSet, DeepPartial } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; -import { Decimal } from "@cosmjs/math"; +import { Decimal } from "@interchainjs/math"; export const protobufPackage = "evmos.incentives.v1"; /** * GenesisState defines the module's genesis state. @@ -146,6 +147,15 @@ function createBaseGenesisState(): GenesisState { */ export const GenesisState = { typeUrl: "/evmos.incentives.v1.GenesisState", + is(o: any): o is GenesisState { + return o && (o.$typeUrl === GenesisState.typeUrl || Params.is(o.params) && Array.isArray(o.incentives) && (!o.incentives.length || Incentive.is(o.incentives[0])) && Array.isArray(o.gasMeters) && (!o.gasMeters.length || GasMeter.is(o.gasMeters[0]))); + }, + isSDK(o: any): o is GenesisStateSDKType { + return o && (o.$typeUrl === GenesisState.typeUrl || Params.isSDK(o.params) && Array.isArray(o.incentives) && (!o.incentives.length || Incentive.isSDK(o.incentives[0])) && Array.isArray(o.gas_meters) && (!o.gas_meters.length || GasMeter.isSDK(o.gas_meters[0]))); + }, + isAmino(o: any): o is GenesisStateAmino { + return o && (o.$typeUrl === GenesisState.typeUrl || Params.isAmino(o.params) && Array.isArray(o.incentives) && (!o.incentives.length || Incentive.isAmino(o.incentives[0])) && Array.isArray(o.gas_meters) && (!o.gas_meters.length || GasMeter.isAmino(o.gas_meters[0]))); + }, encode(message: GenesisState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.params !== undefined) { Params.encode(message.params, writer.uint32(10).fork()).ldelim(); @@ -272,6 +282,14 @@ export const GenesisState = { typeUrl: "/evmos.incentives.v1.GenesisState", value: GenesisState.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GenesisState.typeUrl)) { + return; + } + Params.registerTypeUrl(); + Incentive.registerTypeUrl(); + GasMeter.registerTypeUrl(); } }; function createBaseParams(): Params { @@ -290,6 +308,15 @@ function createBaseParams(): Params { */ export const Params = { typeUrl: "/evmos.incentives.v1.Params", + is(o: any): o is Params { + return o && (o.$typeUrl === Params.typeUrl || typeof o.enableIncentives === "boolean" && typeof o.allocationLimit === "string" && typeof o.incentivesEpochIdentifier === "string" && typeof o.rewardScaler === "string"); + }, + isSDK(o: any): o is ParamsSDKType { + return o && (o.$typeUrl === Params.typeUrl || typeof o.enable_incentives === "boolean" && typeof o.allocation_limit === "string" && typeof o.incentives_epoch_identifier === "string" && typeof o.reward_scaler === "string"); + }, + isAmino(o: any): o is ParamsAmino { + return o && (o.$typeUrl === Params.typeUrl || typeof o.enable_incentives === "boolean" && typeof o.allocation_limit === "string" && typeof o.incentives_epoch_identifier === "string" && typeof o.reward_scaler === "string"); + }, encode(message: Params, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.enableIncentives === true) { writer.uint32(8).bool(message.enableIncentives); @@ -390,9 +417,9 @@ export const Params = { toAmino(message: Params): ParamsAmino { const obj: any = {}; obj.enable_incentives = message.enableIncentives === false ? undefined : message.enableIncentives; - obj.allocation_limit = message.allocationLimit === "" ? undefined : message.allocationLimit; + obj.allocation_limit = message.allocationLimit === "" ? undefined : Decimal.fromUserInput(message.allocationLimit, 18).atomics; obj.incentives_epoch_identifier = message.incentivesEpochIdentifier === "" ? undefined : message.incentivesEpochIdentifier; - obj.reward_scaler = message.rewardScaler === "" ? undefined : message.rewardScaler; + obj.reward_scaler = message.rewardScaler === "" ? undefined : Decimal.fromUserInput(message.rewardScaler, 18).atomics; return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { @@ -409,5 +436,6 @@ export const Params = { typeUrl: "/evmos.incentives.v1.Params", value: Params.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/evmos/incentives/v1/incentives.ts b/__fixtures__/v-next/outputv2/evmos/incentives/v1/incentives.ts index c4f40c8743..ee3ab66347 100644 --- a/__fixtures__/v-next/outputv2/evmos/incentives/v1/incentives.ts +++ b/__fixtures__/v-next/outputv2/evmos/incentives/v1/incentives.ts @@ -3,6 +3,7 @@ import { Timestamp } from "../../../google/protobuf/timestamp"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { toTimestamp, fromTimestamp, isSet, DeepPartial } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "evmos.incentives.v1"; /** * Incentive defines an instance that organizes distribution conditions for a @@ -299,6 +300,15 @@ function createBaseIncentive(): Incentive { */ export const Incentive = { typeUrl: "/evmos.incentives.v1.Incentive", + is(o: any): o is Incentive { + return o && (o.$typeUrl === Incentive.typeUrl || typeof o.contract === "string" && Array.isArray(o.allocations) && (!o.allocations.length || DecCoin.is(o.allocations[0])) && typeof o.epochs === "number" && Timestamp.is(o.startTime) && typeof o.totalGas === "bigint"); + }, + isSDK(o: any): o is IncentiveSDKType { + return o && (o.$typeUrl === Incentive.typeUrl || typeof o.contract === "string" && Array.isArray(o.allocations) && (!o.allocations.length || DecCoin.isSDK(o.allocations[0])) && typeof o.epochs === "number" && Timestamp.isSDK(o.start_time) && typeof o.total_gas === "bigint"); + }, + isAmino(o: any): o is IncentiveAmino { + return o && (o.$typeUrl === Incentive.typeUrl || typeof o.contract === "string" && Array.isArray(o.allocations) && (!o.allocations.length || DecCoin.isAmino(o.allocations[0])) && typeof o.epochs === "number" && Timestamp.isAmino(o.start_time) && typeof o.total_gas === "bigint"); + }, encode(message: Incentive, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.contract !== "") { writer.uint32(10).string(message.contract); @@ -445,6 +455,12 @@ export const Incentive = { typeUrl: "/evmos.incentives.v1.Incentive", value: Incentive.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Incentive.typeUrl)) { + return; + } + DecCoin.registerTypeUrl(); } }; function createBaseGasMeter(): GasMeter { @@ -462,6 +478,15 @@ function createBaseGasMeter(): GasMeter { */ export const GasMeter = { typeUrl: "/evmos.incentives.v1.GasMeter", + is(o: any): o is GasMeter { + return o && (o.$typeUrl === GasMeter.typeUrl || typeof o.contract === "string" && typeof o.participant === "string" && typeof o.cumulativeGas === "bigint"); + }, + isSDK(o: any): o is GasMeterSDKType { + return o && (o.$typeUrl === GasMeter.typeUrl || typeof o.contract === "string" && typeof o.participant === "string" && typeof o.cumulative_gas === "bigint"); + }, + isAmino(o: any): o is GasMeterAmino { + return o && (o.$typeUrl === GasMeter.typeUrl || typeof o.contract === "string" && typeof o.participant === "string" && typeof o.cumulative_gas === "bigint"); + }, encode(message: GasMeter, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.contract !== "") { writer.uint32(10).string(message.contract); @@ -568,7 +593,8 @@ export const GasMeter = { typeUrl: "/evmos.incentives.v1.GasMeter", value: GasMeter.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseRegisterIncentiveProposal(): RegisterIncentiveProposal { return { @@ -588,6 +614,15 @@ function createBaseRegisterIncentiveProposal(): RegisterIncentiveProposal { */ export const RegisterIncentiveProposal = { typeUrl: "/evmos.incentives.v1.RegisterIncentiveProposal", + is(o: any): o is RegisterIncentiveProposal { + return o && (o.$typeUrl === RegisterIncentiveProposal.typeUrl || typeof o.title === "string" && typeof o.description === "string" && typeof o.contract === "string" && Array.isArray(o.allocations) && (!o.allocations.length || DecCoin.is(o.allocations[0])) && typeof o.epochs === "number"); + }, + isSDK(o: any): o is RegisterIncentiveProposalSDKType { + return o && (o.$typeUrl === RegisterIncentiveProposal.typeUrl || typeof o.title === "string" && typeof o.description === "string" && typeof o.contract === "string" && Array.isArray(o.allocations) && (!o.allocations.length || DecCoin.isSDK(o.allocations[0])) && typeof o.epochs === "number"); + }, + isAmino(o: any): o is RegisterIncentiveProposalAmino { + return o && (o.$typeUrl === RegisterIncentiveProposal.typeUrl || typeof o.title === "string" && typeof o.description === "string" && typeof o.contract === "string" && Array.isArray(o.allocations) && (!o.allocations.length || DecCoin.isAmino(o.allocations[0])) && typeof o.epochs === "number"); + }, encode(message: RegisterIncentiveProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.title !== "") { writer.uint32(10).string(message.title); @@ -732,6 +767,13 @@ export const RegisterIncentiveProposal = { typeUrl: "/evmos.incentives.v1.RegisterIncentiveProposal", value: RegisterIncentiveProposal.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(RegisterIncentiveProposal.typeUrl)) { + return; + } + GlobalDecoderRegistry.register(RegisterIncentiveProposal.typeUrl, RegisterIncentiveProposal); + DecCoin.registerTypeUrl(); } }; function createBaseCancelIncentiveProposal(): CancelIncentiveProposal { @@ -749,6 +791,15 @@ function createBaseCancelIncentiveProposal(): CancelIncentiveProposal { */ export const CancelIncentiveProposal = { typeUrl: "/evmos.incentives.v1.CancelIncentiveProposal", + is(o: any): o is CancelIncentiveProposal { + return o && (o.$typeUrl === CancelIncentiveProposal.typeUrl || typeof o.title === "string" && typeof o.description === "string" && typeof o.contract === "string"); + }, + isSDK(o: any): o is CancelIncentiveProposalSDKType { + return o && (o.$typeUrl === CancelIncentiveProposal.typeUrl || typeof o.title === "string" && typeof o.description === "string" && typeof o.contract === "string"); + }, + isAmino(o: any): o is CancelIncentiveProposalAmino { + return o && (o.$typeUrl === CancelIncentiveProposal.typeUrl || typeof o.title === "string" && typeof o.description === "string" && typeof o.contract === "string"); + }, encode(message: CancelIncentiveProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.title !== "") { writer.uint32(10).string(message.title); @@ -853,5 +904,6 @@ export const CancelIncentiveProposal = { typeUrl: "/evmos.incentives.v1.CancelIncentiveProposal", value: CancelIncentiveProposal.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/evmos/incentives/v1/query.rpc.func.ts b/__fixtures__/v-next/outputv2/evmos/incentives/v1/query.rpc.func.ts new file mode 100644 index 0000000000..f90dad7628 --- /dev/null +++ b/__fixtures__/v-next/outputv2/evmos/incentives/v1/query.rpc.func.ts @@ -0,0 +1,94 @@ +import { buildQuery } from "../../../helper-func-types"; +import { QueryIncentivesRequest, QueryIncentivesResponse, QueryIncentiveRequest, QueryIncentiveResponse, QueryGasMetersRequest, QueryGasMetersResponse, QueryGasMeterRequest, QueryGasMeterResponse, QueryAllocationMetersRequest, QueryAllocationMetersResponse, QueryAllocationMeterRequest, QueryAllocationMeterResponse, QueryParamsRequest, QueryParamsResponse } from "./query"; +/** + * Incentives retrieves registered incentives + * @name getIncentives + * @package evmos.incentives.v1 + * @see proto service: evmos.incentives.v1.Incentives + */ +export const getIncentives = buildQuery({ + encode: QueryIncentivesRequest.encode, + decode: QueryIncentivesResponse.decode, + service: "evmos.incentives.v1.Query", + method: "Incentives", + deps: [QueryIncentivesRequest, QueryIncentivesResponse] +}); +/** + * Incentive retrieves a registered incentive + * @name getIncentive + * @package evmos.incentives.v1 + * @see proto service: evmos.incentives.v1.Incentive + */ +export const getIncentive = buildQuery({ + encode: QueryIncentiveRequest.encode, + decode: QueryIncentiveResponse.decode, + service: "evmos.incentives.v1.Query", + method: "Incentive", + deps: [QueryIncentiveRequest, QueryIncentiveResponse] +}); +/** + * GasMeters retrieves active gas meters for a given contract + * @name getGasMeters + * @package evmos.incentives.v1 + * @see proto service: evmos.incentives.v1.GasMeters + */ +export const getGasMeters = buildQuery({ + encode: QueryGasMetersRequest.encode, + decode: QueryGasMetersResponse.decode, + service: "evmos.incentives.v1.Query", + method: "GasMeters", + deps: [QueryGasMetersRequest, QueryGasMetersResponse] +}); +/** + * GasMeter Retrieves a active gas meter + * @name getGasMeter + * @package evmos.incentives.v1 + * @see proto service: evmos.incentives.v1.GasMeter + */ +export const getGasMeter = buildQuery({ + encode: QueryGasMeterRequest.encode, + decode: QueryGasMeterResponse.decode, + service: "evmos.incentives.v1.Query", + method: "GasMeter", + deps: [QueryGasMeterRequest, QueryGasMeterResponse] +}); +/** + * AllocationMeters retrieves active allocation meters for a given + * denomination + * @name getAllocationMeters + * @package evmos.incentives.v1 + * @see proto service: evmos.incentives.v1.AllocationMeters + */ +export const getAllocationMeters = buildQuery({ + encode: QueryAllocationMetersRequest.encode, + decode: QueryAllocationMetersResponse.decode, + service: "evmos.incentives.v1.Query", + method: "AllocationMeters", + deps: [QueryAllocationMetersRequest, QueryAllocationMetersResponse] +}); +/** + * AllocationMeter Retrieves a active gas meter + * @name getAllocationMeter + * @package evmos.incentives.v1 + * @see proto service: evmos.incentives.v1.AllocationMeter + */ +export const getAllocationMeter = buildQuery({ + encode: QueryAllocationMeterRequest.encode, + decode: QueryAllocationMeterResponse.decode, + service: "evmos.incentives.v1.Query", + method: "AllocationMeter", + deps: [QueryAllocationMeterRequest, QueryAllocationMeterResponse] +}); +/** + * Params retrieves the incentives module params + * @name getParams + * @package evmos.incentives.v1 + * @see proto service: evmos.incentives.v1.Params + */ +export const getParams = buildQuery({ + encode: QueryParamsRequest.encode, + decode: QueryParamsResponse.decode, + service: "evmos.incentives.v1.Query", + method: "Params", + deps: [QueryParamsRequest, QueryParamsResponse] +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/evmos/incentives/v1/query.ts b/__fixtures__/v-next/outputv2/evmos/incentives/v1/query.ts index 6fae70c19c..be192e60f4 100644 --- a/__fixtures__/v-next/outputv2/evmos/incentives/v1/query.ts +++ b/__fixtures__/v-next/outputv2/evmos/incentives/v1/query.ts @@ -3,6 +3,7 @@ import { Incentive, IncentiveAmino, IncentiveSDKType, GasMeter, GasMeterAmino, G import { DecCoin, DecCoinAmino, DecCoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { Params, ParamsAmino, ParamsSDKType } from "./genesis"; import { BinaryReader, BinaryWriter } from "../../../binary"; +import { GlobalDecoderRegistry } from "../../../registry"; import { isSet, DeepPartial } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "evmos.incentives.v1"; @@ -618,6 +619,15 @@ function createBaseQueryIncentivesRequest(): QueryIncentivesRequest { */ export const QueryIncentivesRequest = { typeUrl: "/evmos.incentives.v1.QueryIncentivesRequest", + is(o: any): o is QueryIncentivesRequest { + return o && o.$typeUrl === QueryIncentivesRequest.typeUrl; + }, + isSDK(o: any): o is QueryIncentivesRequestSDKType { + return o && o.$typeUrl === QueryIncentivesRequest.typeUrl; + }, + isAmino(o: any): o is QueryIncentivesRequestAmino { + return o && o.$typeUrl === QueryIncentivesRequest.typeUrl; + }, encode(message: QueryIncentivesRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.pagination !== undefined) { PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); @@ -694,6 +704,12 @@ export const QueryIncentivesRequest = { typeUrl: "/evmos.incentives.v1.QueryIncentivesRequest", value: QueryIncentivesRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryIncentivesRequest.typeUrl)) { + return; + } + PageRequest.registerTypeUrl(); } }; function createBaseQueryIncentivesResponse(): QueryIncentivesResponse { @@ -711,6 +727,15 @@ function createBaseQueryIncentivesResponse(): QueryIncentivesResponse { */ export const QueryIncentivesResponse = { typeUrl: "/evmos.incentives.v1.QueryIncentivesResponse", + is(o: any): o is QueryIncentivesResponse { + return o && (o.$typeUrl === QueryIncentivesResponse.typeUrl || Array.isArray(o.incentives) && (!o.incentives.length || Incentive.is(o.incentives[0]))); + }, + isSDK(o: any): o is QueryIncentivesResponseSDKType { + return o && (o.$typeUrl === QueryIncentivesResponse.typeUrl || Array.isArray(o.incentives) && (!o.incentives.length || Incentive.isSDK(o.incentives[0]))); + }, + isAmino(o: any): o is QueryIncentivesResponseAmino { + return o && (o.$typeUrl === QueryIncentivesResponse.typeUrl || Array.isArray(o.incentives) && (!o.incentives.length || Incentive.isAmino(o.incentives[0]))); + }, encode(message: QueryIncentivesResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.incentives) { Incentive.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -812,6 +837,13 @@ export const QueryIncentivesResponse = { typeUrl: "/evmos.incentives.v1.QueryIncentivesResponse", value: QueryIncentivesResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryIncentivesResponse.typeUrl)) { + return; + } + Incentive.registerTypeUrl(); + PageResponse.registerTypeUrl(); } }; function createBaseQueryIncentiveRequest(): QueryIncentiveRequest { @@ -827,6 +859,15 @@ function createBaseQueryIncentiveRequest(): QueryIncentiveRequest { */ export const QueryIncentiveRequest = { typeUrl: "/evmos.incentives.v1.QueryIncentiveRequest", + is(o: any): o is QueryIncentiveRequest { + return o && (o.$typeUrl === QueryIncentiveRequest.typeUrl || typeof o.contract === "string"); + }, + isSDK(o: any): o is QueryIncentiveRequestSDKType { + return o && (o.$typeUrl === QueryIncentiveRequest.typeUrl || typeof o.contract === "string"); + }, + isAmino(o: any): o is QueryIncentiveRequestAmino { + return o && (o.$typeUrl === QueryIncentiveRequest.typeUrl || typeof o.contract === "string"); + }, encode(message: QueryIncentiveRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.contract !== "") { writer.uint32(10).string(message.contract); @@ -901,7 +942,8 @@ export const QueryIncentiveRequest = { typeUrl: "/evmos.incentives.v1.QueryIncentiveRequest", value: QueryIncentiveRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryIncentiveResponse(): QueryIncentiveResponse { return { @@ -917,6 +959,15 @@ function createBaseQueryIncentiveResponse(): QueryIncentiveResponse { */ export const QueryIncentiveResponse = { typeUrl: "/evmos.incentives.v1.QueryIncentiveResponse", + is(o: any): o is QueryIncentiveResponse { + return o && (o.$typeUrl === QueryIncentiveResponse.typeUrl || Incentive.is(o.incentive)); + }, + isSDK(o: any): o is QueryIncentiveResponseSDKType { + return o && (o.$typeUrl === QueryIncentiveResponse.typeUrl || Incentive.isSDK(o.incentive)); + }, + isAmino(o: any): o is QueryIncentiveResponseAmino { + return o && (o.$typeUrl === QueryIncentiveResponse.typeUrl || Incentive.isAmino(o.incentive)); + }, encode(message: QueryIncentiveResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.incentive !== undefined) { Incentive.encode(message.incentive, writer.uint32(10).fork()).ldelim(); @@ -993,6 +1044,12 @@ export const QueryIncentiveResponse = { typeUrl: "/evmos.incentives.v1.QueryIncentiveResponse", value: QueryIncentiveResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryIncentiveResponse.typeUrl)) { + return; + } + Incentive.registerTypeUrl(); } }; function createBaseQueryGasMetersRequest(): QueryGasMetersRequest { @@ -1010,6 +1067,15 @@ function createBaseQueryGasMetersRequest(): QueryGasMetersRequest { */ export const QueryGasMetersRequest = { typeUrl: "/evmos.incentives.v1.QueryGasMetersRequest", + is(o: any): o is QueryGasMetersRequest { + return o && (o.$typeUrl === QueryGasMetersRequest.typeUrl || typeof o.contract === "string"); + }, + isSDK(o: any): o is QueryGasMetersRequestSDKType { + return o && (o.$typeUrl === QueryGasMetersRequest.typeUrl || typeof o.contract === "string"); + }, + isAmino(o: any): o is QueryGasMetersRequestAmino { + return o && (o.$typeUrl === QueryGasMetersRequest.typeUrl || typeof o.contract === "string"); + }, encode(message: QueryGasMetersRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.contract !== "") { writer.uint32(10).string(message.contract); @@ -1101,6 +1167,12 @@ export const QueryGasMetersRequest = { typeUrl: "/evmos.incentives.v1.QueryGasMetersRequest", value: QueryGasMetersRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryGasMetersRequest.typeUrl)) { + return; + } + PageRequest.registerTypeUrl(); } }; function createBaseQueryGasMetersResponse(): QueryGasMetersResponse { @@ -1118,6 +1190,15 @@ function createBaseQueryGasMetersResponse(): QueryGasMetersResponse { */ export const QueryGasMetersResponse = { typeUrl: "/evmos.incentives.v1.QueryGasMetersResponse", + is(o: any): o is QueryGasMetersResponse { + return o && (o.$typeUrl === QueryGasMetersResponse.typeUrl || Array.isArray(o.gasMeters) && (!o.gasMeters.length || GasMeter.is(o.gasMeters[0]))); + }, + isSDK(o: any): o is QueryGasMetersResponseSDKType { + return o && (o.$typeUrl === QueryGasMetersResponse.typeUrl || Array.isArray(o.gas_meters) && (!o.gas_meters.length || GasMeter.isSDK(o.gas_meters[0]))); + }, + isAmino(o: any): o is QueryGasMetersResponseAmino { + return o && (o.$typeUrl === QueryGasMetersResponse.typeUrl || Array.isArray(o.gas_meters) && (!o.gas_meters.length || GasMeter.isAmino(o.gas_meters[0]))); + }, encode(message: QueryGasMetersResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.gasMeters) { GasMeter.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -1219,6 +1300,13 @@ export const QueryGasMetersResponse = { typeUrl: "/evmos.incentives.v1.QueryGasMetersResponse", value: QueryGasMetersResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryGasMetersResponse.typeUrl)) { + return; + } + GasMeter.registerTypeUrl(); + PageResponse.registerTypeUrl(); } }; function createBaseQueryGasMeterRequest(): QueryGasMeterRequest { @@ -1235,6 +1323,15 @@ function createBaseQueryGasMeterRequest(): QueryGasMeterRequest { */ export const QueryGasMeterRequest = { typeUrl: "/evmos.incentives.v1.QueryGasMeterRequest", + is(o: any): o is QueryGasMeterRequest { + return o && (o.$typeUrl === QueryGasMeterRequest.typeUrl || typeof o.contract === "string" && typeof o.participant === "string"); + }, + isSDK(o: any): o is QueryGasMeterRequestSDKType { + return o && (o.$typeUrl === QueryGasMeterRequest.typeUrl || typeof o.contract === "string" && typeof o.participant === "string"); + }, + isAmino(o: any): o is QueryGasMeterRequestAmino { + return o && (o.$typeUrl === QueryGasMeterRequest.typeUrl || typeof o.contract === "string" && typeof o.participant === "string"); + }, encode(message: QueryGasMeterRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.contract !== "") { writer.uint32(10).string(message.contract); @@ -1324,7 +1421,8 @@ export const QueryGasMeterRequest = { typeUrl: "/evmos.incentives.v1.QueryGasMeterRequest", value: QueryGasMeterRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryGasMeterResponse(): QueryGasMeterResponse { return { @@ -1340,6 +1438,15 @@ function createBaseQueryGasMeterResponse(): QueryGasMeterResponse { */ export const QueryGasMeterResponse = { typeUrl: "/evmos.incentives.v1.QueryGasMeterResponse", + is(o: any): o is QueryGasMeterResponse { + return o && (o.$typeUrl === QueryGasMeterResponse.typeUrl || typeof o.gasMeter === "bigint"); + }, + isSDK(o: any): o is QueryGasMeterResponseSDKType { + return o && (o.$typeUrl === QueryGasMeterResponse.typeUrl || typeof o.gas_meter === "bigint"); + }, + isAmino(o: any): o is QueryGasMeterResponseAmino { + return o && (o.$typeUrl === QueryGasMeterResponse.typeUrl || typeof o.gas_meter === "bigint"); + }, encode(message: QueryGasMeterResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.gasMeter !== BigInt(0)) { writer.uint32(8).uint64(message.gasMeter); @@ -1416,7 +1523,8 @@ export const QueryGasMeterResponse = { typeUrl: "/evmos.incentives.v1.QueryGasMeterResponse", value: QueryGasMeterResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryAllocationMetersRequest(): QueryAllocationMetersRequest { return { @@ -1432,6 +1540,15 @@ function createBaseQueryAllocationMetersRequest(): QueryAllocationMetersRequest */ export const QueryAllocationMetersRequest = { typeUrl: "/evmos.incentives.v1.QueryAllocationMetersRequest", + is(o: any): o is QueryAllocationMetersRequest { + return o && o.$typeUrl === QueryAllocationMetersRequest.typeUrl; + }, + isSDK(o: any): o is QueryAllocationMetersRequestSDKType { + return o && o.$typeUrl === QueryAllocationMetersRequest.typeUrl; + }, + isAmino(o: any): o is QueryAllocationMetersRequestAmino { + return o && o.$typeUrl === QueryAllocationMetersRequest.typeUrl; + }, encode(message: QueryAllocationMetersRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.pagination !== undefined) { PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); @@ -1508,6 +1625,12 @@ export const QueryAllocationMetersRequest = { typeUrl: "/evmos.incentives.v1.QueryAllocationMetersRequest", value: QueryAllocationMetersRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryAllocationMetersRequest.typeUrl)) { + return; + } + PageRequest.registerTypeUrl(); } }; function createBaseQueryAllocationMetersResponse(): QueryAllocationMetersResponse { @@ -1525,6 +1648,15 @@ function createBaseQueryAllocationMetersResponse(): QueryAllocationMetersRespons */ export const QueryAllocationMetersResponse = { typeUrl: "/evmos.incentives.v1.QueryAllocationMetersResponse", + is(o: any): o is QueryAllocationMetersResponse { + return o && (o.$typeUrl === QueryAllocationMetersResponse.typeUrl || Array.isArray(o.allocationMeters) && (!o.allocationMeters.length || DecCoin.is(o.allocationMeters[0]))); + }, + isSDK(o: any): o is QueryAllocationMetersResponseSDKType { + return o && (o.$typeUrl === QueryAllocationMetersResponse.typeUrl || Array.isArray(o.allocation_meters) && (!o.allocation_meters.length || DecCoin.isSDK(o.allocation_meters[0]))); + }, + isAmino(o: any): o is QueryAllocationMetersResponseAmino { + return o && (o.$typeUrl === QueryAllocationMetersResponse.typeUrl || Array.isArray(o.allocation_meters) && (!o.allocation_meters.length || DecCoin.isAmino(o.allocation_meters[0]))); + }, encode(message: QueryAllocationMetersResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.allocationMeters) { DecCoin.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -1626,6 +1758,13 @@ export const QueryAllocationMetersResponse = { typeUrl: "/evmos.incentives.v1.QueryAllocationMetersResponse", value: QueryAllocationMetersResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryAllocationMetersResponse.typeUrl)) { + return; + } + DecCoin.registerTypeUrl(); + PageResponse.registerTypeUrl(); } }; function createBaseQueryAllocationMeterRequest(): QueryAllocationMeterRequest { @@ -1642,6 +1781,15 @@ function createBaseQueryAllocationMeterRequest(): QueryAllocationMeterRequest { */ export const QueryAllocationMeterRequest = { typeUrl: "/evmos.incentives.v1.QueryAllocationMeterRequest", + is(o: any): o is QueryAllocationMeterRequest { + return o && (o.$typeUrl === QueryAllocationMeterRequest.typeUrl || typeof o.denom === "string"); + }, + isSDK(o: any): o is QueryAllocationMeterRequestSDKType { + return o && (o.$typeUrl === QueryAllocationMeterRequest.typeUrl || typeof o.denom === "string"); + }, + isAmino(o: any): o is QueryAllocationMeterRequestAmino { + return o && (o.$typeUrl === QueryAllocationMeterRequest.typeUrl || typeof o.denom === "string"); + }, encode(message: QueryAllocationMeterRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.denom !== "") { writer.uint32(10).string(message.denom); @@ -1716,7 +1864,8 @@ export const QueryAllocationMeterRequest = { typeUrl: "/evmos.incentives.v1.QueryAllocationMeterRequest", value: QueryAllocationMeterRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryAllocationMeterResponse(): QueryAllocationMeterResponse { return { @@ -1732,6 +1881,15 @@ function createBaseQueryAllocationMeterResponse(): QueryAllocationMeterResponse */ export const QueryAllocationMeterResponse = { typeUrl: "/evmos.incentives.v1.QueryAllocationMeterResponse", + is(o: any): o is QueryAllocationMeterResponse { + return o && (o.$typeUrl === QueryAllocationMeterResponse.typeUrl || DecCoin.is(o.allocationMeter)); + }, + isSDK(o: any): o is QueryAllocationMeterResponseSDKType { + return o && (o.$typeUrl === QueryAllocationMeterResponse.typeUrl || DecCoin.isSDK(o.allocation_meter)); + }, + isAmino(o: any): o is QueryAllocationMeterResponseAmino { + return o && (o.$typeUrl === QueryAllocationMeterResponse.typeUrl || DecCoin.isAmino(o.allocation_meter)); + }, encode(message: QueryAllocationMeterResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.allocationMeter !== undefined) { DecCoin.encode(message.allocationMeter, writer.uint32(10).fork()).ldelim(); @@ -1808,6 +1966,12 @@ export const QueryAllocationMeterResponse = { typeUrl: "/evmos.incentives.v1.QueryAllocationMeterResponse", value: QueryAllocationMeterResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryAllocationMeterResponse.typeUrl)) { + return; + } + DecCoin.registerTypeUrl(); } }; function createBaseQueryParamsRequest(): QueryParamsRequest { @@ -1821,6 +1985,15 @@ function createBaseQueryParamsRequest(): QueryParamsRequest { */ export const QueryParamsRequest = { typeUrl: "/evmos.incentives.v1.QueryParamsRequest", + is(o: any): o is QueryParamsRequest { + return o && o.$typeUrl === QueryParamsRequest.typeUrl; + }, + isSDK(o: any): o is QueryParamsRequestSDKType { + return o && o.$typeUrl === QueryParamsRequest.typeUrl; + }, + isAmino(o: any): o is QueryParamsRequestAmino { + return o && o.$typeUrl === QueryParamsRequest.typeUrl; + }, encode(_: QueryParamsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -1879,7 +2052,8 @@ export const QueryParamsRequest = { typeUrl: "/evmos.incentives.v1.QueryParamsRequest", value: QueryParamsRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryParamsResponse(): QueryParamsResponse { return { @@ -1895,6 +2069,15 @@ function createBaseQueryParamsResponse(): QueryParamsResponse { */ export const QueryParamsResponse = { typeUrl: "/evmos.incentives.v1.QueryParamsResponse", + is(o: any): o is QueryParamsResponse { + return o && (o.$typeUrl === QueryParamsResponse.typeUrl || Params.is(o.params)); + }, + isSDK(o: any): o is QueryParamsResponseSDKType { + return o && (o.$typeUrl === QueryParamsResponse.typeUrl || Params.isSDK(o.params)); + }, + isAmino(o: any): o is QueryParamsResponseAmino { + return o && (o.$typeUrl === QueryParamsResponse.typeUrl || Params.isAmino(o.params)); + }, encode(message: QueryParamsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.params !== undefined) { Params.encode(message.params, writer.uint32(10).fork()).ldelim(); @@ -1971,5 +2154,11 @@ export const QueryParamsResponse = { typeUrl: "/evmos.incentives.v1.QueryParamsResponse", value: QueryParamsResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryParamsResponse.typeUrl)) { + return; + } + Params.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/evmos/inflation/v1/genesis.ts b/__fixtures__/v-next/outputv2/evmos/inflation/v1/genesis.ts index 688a4837d4..f431dc1831 100644 --- a/__fixtures__/v-next/outputv2/evmos/inflation/v1/genesis.ts +++ b/__fixtures__/v-next/outputv2/evmos/inflation/v1/genesis.ts @@ -1,5 +1,6 @@ import { ExponentialCalculation, ExponentialCalculationAmino, ExponentialCalculationSDKType, InflationDistribution, InflationDistributionAmino, InflationDistributionSDKType } from "./inflation"; import { BinaryReader, BinaryWriter } from "../../../binary"; +import { GlobalDecoderRegistry } from "../../../registry"; import { isSet, DeepPartial } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "evmos.inflation.v1"; @@ -165,6 +166,15 @@ function createBaseGenesisState(): GenesisState { */ export const GenesisState = { typeUrl: "/evmos.inflation.v1.GenesisState", + is(o: any): o is GenesisState { + return o && (o.$typeUrl === GenesisState.typeUrl || Params.is(o.params) && typeof o.period === "bigint" && typeof o.epochIdentifier === "string" && typeof o.epochsPerPeriod === "bigint" && typeof o.skippedEpochs === "bigint"); + }, + isSDK(o: any): o is GenesisStateSDKType { + return o && (o.$typeUrl === GenesisState.typeUrl || Params.isSDK(o.params) && typeof o.period === "bigint" && typeof o.epoch_identifier === "string" && typeof o.epochs_per_period === "bigint" && typeof o.skipped_epochs === "bigint"); + }, + isAmino(o: any): o is GenesisStateAmino { + return o && (o.$typeUrl === GenesisState.typeUrl || Params.isAmino(o.params) && typeof o.period === "bigint" && typeof o.epoch_identifier === "string" && typeof o.epochs_per_period === "bigint" && typeof o.skipped_epochs === "bigint"); + }, encode(message: GenesisState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.params !== undefined) { Params.encode(message.params, writer.uint32(10).fork()).ldelim(); @@ -307,6 +317,12 @@ export const GenesisState = { typeUrl: "/evmos.inflation.v1.GenesisState", value: GenesisState.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GenesisState.typeUrl)) { + return; + } + Params.registerTypeUrl(); } }; function createBaseParams(): Params { @@ -325,6 +341,15 @@ function createBaseParams(): Params { */ export const Params = { typeUrl: "/evmos.inflation.v1.Params", + is(o: any): o is Params { + return o && (o.$typeUrl === Params.typeUrl || typeof o.mintDenom === "string" && ExponentialCalculation.is(o.exponentialCalculation) && InflationDistribution.is(o.inflationDistribution) && typeof o.enableInflation === "boolean"); + }, + isSDK(o: any): o is ParamsSDKType { + return o && (o.$typeUrl === Params.typeUrl || typeof o.mint_denom === "string" && ExponentialCalculation.isSDK(o.exponential_calculation) && InflationDistribution.isSDK(o.inflation_distribution) && typeof o.enable_inflation === "boolean"); + }, + isAmino(o: any): o is ParamsAmino { + return o && (o.$typeUrl === Params.typeUrl || typeof o.mint_denom === "string" && ExponentialCalculation.isAmino(o.exponential_calculation) && InflationDistribution.isAmino(o.inflation_distribution) && typeof o.enable_inflation === "boolean"); + }, encode(message: Params, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.mintDenom !== "") { writer.uint32(10).string(message.mintDenom); @@ -448,5 +473,12 @@ export const Params = { typeUrl: "/evmos.inflation.v1.Params", value: Params.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Params.typeUrl)) { + return; + } + ExponentialCalculation.registerTypeUrl(); + InflationDistribution.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/evmos/inflation/v1/inflation.ts b/__fixtures__/v-next/outputv2/evmos/inflation/v1/inflation.ts index b3a71df6a6..1178c4e4d5 100644 --- a/__fixtures__/v-next/outputv2/evmos/inflation/v1/inflation.ts +++ b/__fixtures__/v-next/outputv2/evmos/inflation/v1/inflation.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { Decimal } from "@cosmjs/math"; +import { Decimal } from "@interchainjs/math"; import { isSet, DeepPartial } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "evmos.inflation.v1"; @@ -196,6 +196,15 @@ function createBaseInflationDistribution(): InflationDistribution { */ export const InflationDistribution = { typeUrl: "/evmos.inflation.v1.InflationDistribution", + is(o: any): o is InflationDistribution { + return o && (o.$typeUrl === InflationDistribution.typeUrl || typeof o.stakingRewards === "string" && typeof o.usageIncentives === "string" && typeof o.communityPool === "string"); + }, + isSDK(o: any): o is InflationDistributionSDKType { + return o && (o.$typeUrl === InflationDistribution.typeUrl || typeof o.staking_rewards === "string" && typeof o.usage_incentives === "string" && typeof o.community_pool === "string"); + }, + isAmino(o: any): o is InflationDistributionAmino { + return o && (o.$typeUrl === InflationDistribution.typeUrl || typeof o.staking_rewards === "string" && typeof o.usage_incentives === "string" && typeof o.community_pool === "string"); + }, encode(message: InflationDistribution, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.stakingRewards !== "") { writer.uint32(10).string(Decimal.fromUserInput(message.stakingRewards, 18).atomics); @@ -281,9 +290,9 @@ export const InflationDistribution = { }, toAmino(message: InflationDistribution): InflationDistributionAmino { const obj: any = {}; - obj.staking_rewards = message.stakingRewards === "" ? undefined : message.stakingRewards; - obj.usage_incentives = message.usageIncentives === "" ? undefined : message.usageIncentives; - obj.community_pool = message.communityPool === "" ? undefined : message.communityPool; + obj.staking_rewards = message.stakingRewards === "" ? undefined : Decimal.fromUserInput(message.stakingRewards, 18).atomics; + obj.usage_incentives = message.usageIncentives === "" ? undefined : Decimal.fromUserInput(message.usageIncentives, 18).atomics; + obj.community_pool = message.communityPool === "" ? undefined : Decimal.fromUserInput(message.communityPool, 18).atomics; return obj; }, fromAminoMsg(object: InflationDistributionAminoMsg): InflationDistribution { @@ -300,7 +309,8 @@ export const InflationDistribution = { typeUrl: "/evmos.inflation.v1.InflationDistribution", value: InflationDistribution.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseExponentialCalculation(): ExponentialCalculation { return { @@ -323,6 +333,15 @@ function createBaseExponentialCalculation(): ExponentialCalculation { */ export const ExponentialCalculation = { typeUrl: "/evmos.inflation.v1.ExponentialCalculation", + is(o: any): o is ExponentialCalculation { + return o && (o.$typeUrl === ExponentialCalculation.typeUrl || typeof o.a === "string" && typeof o.r === "string" && typeof o.c === "string" && typeof o.bondingTarget === "string" && typeof o.maxVariance === "string"); + }, + isSDK(o: any): o is ExponentialCalculationSDKType { + return o && (o.$typeUrl === ExponentialCalculation.typeUrl || typeof o.a === "string" && typeof o.r === "string" && typeof o.c === "string" && typeof o.bonding_target === "string" && typeof o.max_variance === "string"); + }, + isAmino(o: any): o is ExponentialCalculationAmino { + return o && (o.$typeUrl === ExponentialCalculation.typeUrl || typeof o.a === "string" && typeof o.r === "string" && typeof o.c === "string" && typeof o.bonding_target === "string" && typeof o.max_variance === "string"); + }, encode(message: ExponentialCalculation, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.a !== "") { writer.uint32(10).string(Decimal.fromUserInput(message.a, 18).atomics); @@ -436,11 +455,11 @@ export const ExponentialCalculation = { }, toAmino(message: ExponentialCalculation): ExponentialCalculationAmino { const obj: any = {}; - obj.a = message.a === "" ? undefined : message.a; - obj.r = message.r === "" ? undefined : message.r; - obj.c = message.c === "" ? undefined : message.c; - obj.bonding_target = message.bondingTarget === "" ? undefined : message.bondingTarget; - obj.max_variance = message.maxVariance === "" ? undefined : message.maxVariance; + obj.a = message.a === "" ? undefined : Decimal.fromUserInput(message.a, 18).atomics; + obj.r = message.r === "" ? undefined : Decimal.fromUserInput(message.r, 18).atomics; + obj.c = message.c === "" ? undefined : Decimal.fromUserInput(message.c, 18).atomics; + obj.bonding_target = message.bondingTarget === "" ? undefined : Decimal.fromUserInput(message.bondingTarget, 18).atomics; + obj.max_variance = message.maxVariance === "" ? undefined : Decimal.fromUserInput(message.maxVariance, 18).atomics; return obj; }, fromAminoMsg(object: ExponentialCalculationAminoMsg): ExponentialCalculation { @@ -457,5 +476,6 @@ export const ExponentialCalculation = { typeUrl: "/evmos.inflation.v1.ExponentialCalculation", value: ExponentialCalculation.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/evmos/inflation/v1/query.rpc.func.ts b/__fixtures__/v-next/outputv2/evmos/inflation/v1/query.rpc.func.ts new file mode 100644 index 0000000000..4778d3b7f7 --- /dev/null +++ b/__fixtures__/v-next/outputv2/evmos/inflation/v1/query.rpc.func.ts @@ -0,0 +1,81 @@ +import { buildQuery } from "../../../helper-func-types"; +import { QueryPeriodRequest, QueryPeriodResponse, QueryEpochMintProvisionRequest, QueryEpochMintProvisionResponse, QuerySkippedEpochsRequest, QuerySkippedEpochsResponse, QueryCirculatingSupplyRequest, QueryCirculatingSupplyResponse, QueryInflationRateRequest, QueryInflationRateResponse, QueryParamsRequest, QueryParamsResponse } from "./query"; +/** + * Period retrieves current period. + * @name getPeriod + * @package evmos.inflation.v1 + * @see proto service: evmos.inflation.v1.Period + */ +export const getPeriod = buildQuery({ + encode: QueryPeriodRequest.encode, + decode: QueryPeriodResponse.decode, + service: "evmos.inflation.v1.Query", + method: "Period", + deps: [QueryPeriodRequest, QueryPeriodResponse] +}); +/** + * EpochMintProvision retrieves current minting epoch provision value. + * @name getEpochMintProvision + * @package evmos.inflation.v1 + * @see proto service: evmos.inflation.v1.EpochMintProvision + */ +export const getEpochMintProvision = buildQuery({ + encode: QueryEpochMintProvisionRequest.encode, + decode: QueryEpochMintProvisionResponse.decode, + service: "evmos.inflation.v1.Query", + method: "EpochMintProvision", + deps: [QueryEpochMintProvisionRequest, QueryEpochMintProvisionResponse] +}); +/** + * SkippedEpochs retrieves the total number of skipped epochs. + * @name getSkippedEpochs + * @package evmos.inflation.v1 + * @see proto service: evmos.inflation.v1.SkippedEpochs + */ +export const getSkippedEpochs = buildQuery({ + encode: QuerySkippedEpochsRequest.encode, + decode: QuerySkippedEpochsResponse.decode, + service: "evmos.inflation.v1.Query", + method: "SkippedEpochs", + deps: [QuerySkippedEpochsRequest, QuerySkippedEpochsResponse] +}); +/** + * CirculatingSupply retrieves the total number of tokens that are in + * circulation (i.e. excluding unvested tokens). + * @name getCirculatingSupply + * @package evmos.inflation.v1 + * @see proto service: evmos.inflation.v1.CirculatingSupply + */ +export const getCirculatingSupply = buildQuery({ + encode: QueryCirculatingSupplyRequest.encode, + decode: QueryCirculatingSupplyResponse.decode, + service: "evmos.inflation.v1.Query", + method: "CirculatingSupply", + deps: [QueryCirculatingSupplyRequest, QueryCirculatingSupplyResponse] +}); +/** + * InflationRate retrieves the inflation rate of the current period. + * @name getInflationRate + * @package evmos.inflation.v1 + * @see proto service: evmos.inflation.v1.InflationRate + */ +export const getInflationRate = buildQuery({ + encode: QueryInflationRateRequest.encode, + decode: QueryInflationRateResponse.decode, + service: "evmos.inflation.v1.Query", + method: "InflationRate", + deps: [QueryInflationRateRequest, QueryInflationRateResponse] +}); +/** + * Params retrieves the total set of minting parameters. + * @name getParams + * @package evmos.inflation.v1 + * @see proto service: evmos.inflation.v1.Params + */ +export const getParams = buildQuery({ + encode: QueryParamsRequest.encode, + decode: QueryParamsResponse.decode, + service: "evmos.inflation.v1.Query", + method: "Params", + deps: [QueryParamsRequest, QueryParamsResponse] +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/evmos/inflation/v1/query.ts b/__fixtures__/v-next/outputv2/evmos/inflation/v1/query.ts index d70de7ea13..a902067ae8 100644 --- a/__fixtures__/v-next/outputv2/evmos/inflation/v1/query.ts +++ b/__fixtures__/v-next/outputv2/evmos/inflation/v1/query.ts @@ -3,7 +3,8 @@ import { Params, ParamsAmino, ParamsSDKType } from "./genesis"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { JsonSafe } from "../../../json-safe"; import { DeepPartial, isSet } from "../../../helpers"; -import { Decimal } from "@cosmjs/math"; +import { GlobalDecoderRegistry } from "../../../registry"; +import { Decimal } from "@interchainjs/math"; export const protobufPackage = "evmos.inflation.v1"; /** * QueryPeriodRequest is the request type for the Query/Period RPC method. @@ -460,6 +461,15 @@ function createBaseQueryPeriodRequest(): QueryPeriodRequest { */ export const QueryPeriodRequest = { typeUrl: "/evmos.inflation.v1.QueryPeriodRequest", + is(o: any): o is QueryPeriodRequest { + return o && o.$typeUrl === QueryPeriodRequest.typeUrl; + }, + isSDK(o: any): o is QueryPeriodRequestSDKType { + return o && o.$typeUrl === QueryPeriodRequest.typeUrl; + }, + isAmino(o: any): o is QueryPeriodRequestAmino { + return o && o.$typeUrl === QueryPeriodRequest.typeUrl; + }, encode(_: QueryPeriodRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -518,7 +528,8 @@ export const QueryPeriodRequest = { typeUrl: "/evmos.inflation.v1.QueryPeriodRequest", value: QueryPeriodRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryPeriodResponse(): QueryPeriodResponse { return { @@ -533,6 +544,15 @@ function createBaseQueryPeriodResponse(): QueryPeriodResponse { */ export const QueryPeriodResponse = { typeUrl: "/evmos.inflation.v1.QueryPeriodResponse", + is(o: any): o is QueryPeriodResponse { + return o && (o.$typeUrl === QueryPeriodResponse.typeUrl || typeof o.period === "bigint"); + }, + isSDK(o: any): o is QueryPeriodResponseSDKType { + return o && (o.$typeUrl === QueryPeriodResponse.typeUrl || typeof o.period === "bigint"); + }, + isAmino(o: any): o is QueryPeriodResponseAmino { + return o && (o.$typeUrl === QueryPeriodResponse.typeUrl || typeof o.period === "bigint"); + }, encode(message: QueryPeriodResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.period !== BigInt(0)) { writer.uint32(8).uint64(message.period); @@ -609,7 +629,8 @@ export const QueryPeriodResponse = { typeUrl: "/evmos.inflation.v1.QueryPeriodResponse", value: QueryPeriodResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryEpochMintProvisionRequest(): QueryEpochMintProvisionRequest { return {}; @@ -623,6 +644,15 @@ function createBaseQueryEpochMintProvisionRequest(): QueryEpochMintProvisionRequ */ export const QueryEpochMintProvisionRequest = { typeUrl: "/evmos.inflation.v1.QueryEpochMintProvisionRequest", + is(o: any): o is QueryEpochMintProvisionRequest { + return o && o.$typeUrl === QueryEpochMintProvisionRequest.typeUrl; + }, + isSDK(o: any): o is QueryEpochMintProvisionRequestSDKType { + return o && o.$typeUrl === QueryEpochMintProvisionRequest.typeUrl; + }, + isAmino(o: any): o is QueryEpochMintProvisionRequestAmino { + return o && o.$typeUrl === QueryEpochMintProvisionRequest.typeUrl; + }, encode(_: QueryEpochMintProvisionRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -681,7 +711,8 @@ export const QueryEpochMintProvisionRequest = { typeUrl: "/evmos.inflation.v1.QueryEpochMintProvisionRequest", value: QueryEpochMintProvisionRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryEpochMintProvisionResponse(): QueryEpochMintProvisionResponse { return { @@ -697,6 +728,15 @@ function createBaseQueryEpochMintProvisionResponse(): QueryEpochMintProvisionRes */ export const QueryEpochMintProvisionResponse = { typeUrl: "/evmos.inflation.v1.QueryEpochMintProvisionResponse", + is(o: any): o is QueryEpochMintProvisionResponse { + return o && (o.$typeUrl === QueryEpochMintProvisionResponse.typeUrl || DecCoin.is(o.epochMintProvision)); + }, + isSDK(o: any): o is QueryEpochMintProvisionResponseSDKType { + return o && (o.$typeUrl === QueryEpochMintProvisionResponse.typeUrl || DecCoin.isSDK(o.epoch_mint_provision)); + }, + isAmino(o: any): o is QueryEpochMintProvisionResponseAmino { + return o && (o.$typeUrl === QueryEpochMintProvisionResponse.typeUrl || DecCoin.isAmino(o.epoch_mint_provision)); + }, encode(message: QueryEpochMintProvisionResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.epochMintProvision !== undefined) { DecCoin.encode(message.epochMintProvision, writer.uint32(10).fork()).ldelim(); @@ -773,6 +813,12 @@ export const QueryEpochMintProvisionResponse = { typeUrl: "/evmos.inflation.v1.QueryEpochMintProvisionResponse", value: QueryEpochMintProvisionResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryEpochMintProvisionResponse.typeUrl)) { + return; + } + DecCoin.registerTypeUrl(); } }; function createBaseQuerySkippedEpochsRequest(): QuerySkippedEpochsRequest { @@ -787,6 +833,15 @@ function createBaseQuerySkippedEpochsRequest(): QuerySkippedEpochsRequest { */ export const QuerySkippedEpochsRequest = { typeUrl: "/evmos.inflation.v1.QuerySkippedEpochsRequest", + is(o: any): o is QuerySkippedEpochsRequest { + return o && o.$typeUrl === QuerySkippedEpochsRequest.typeUrl; + }, + isSDK(o: any): o is QuerySkippedEpochsRequestSDKType { + return o && o.$typeUrl === QuerySkippedEpochsRequest.typeUrl; + }, + isAmino(o: any): o is QuerySkippedEpochsRequestAmino { + return o && o.$typeUrl === QuerySkippedEpochsRequest.typeUrl; + }, encode(_: QuerySkippedEpochsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -845,7 +900,8 @@ export const QuerySkippedEpochsRequest = { typeUrl: "/evmos.inflation.v1.QuerySkippedEpochsRequest", value: QuerySkippedEpochsRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQuerySkippedEpochsResponse(): QuerySkippedEpochsResponse { return { @@ -861,6 +917,15 @@ function createBaseQuerySkippedEpochsResponse(): QuerySkippedEpochsResponse { */ export const QuerySkippedEpochsResponse = { typeUrl: "/evmos.inflation.v1.QuerySkippedEpochsResponse", + is(o: any): o is QuerySkippedEpochsResponse { + return o && (o.$typeUrl === QuerySkippedEpochsResponse.typeUrl || typeof o.skippedEpochs === "bigint"); + }, + isSDK(o: any): o is QuerySkippedEpochsResponseSDKType { + return o && (o.$typeUrl === QuerySkippedEpochsResponse.typeUrl || typeof o.skipped_epochs === "bigint"); + }, + isAmino(o: any): o is QuerySkippedEpochsResponseAmino { + return o && (o.$typeUrl === QuerySkippedEpochsResponse.typeUrl || typeof o.skipped_epochs === "bigint"); + }, encode(message: QuerySkippedEpochsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.skippedEpochs !== BigInt(0)) { writer.uint32(8).uint64(message.skippedEpochs); @@ -937,7 +1002,8 @@ export const QuerySkippedEpochsResponse = { typeUrl: "/evmos.inflation.v1.QuerySkippedEpochsResponse", value: QuerySkippedEpochsResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryCirculatingSupplyRequest(): QueryCirculatingSupplyRequest { return {}; @@ -951,6 +1017,15 @@ function createBaseQueryCirculatingSupplyRequest(): QueryCirculatingSupplyReques */ export const QueryCirculatingSupplyRequest = { typeUrl: "/evmos.inflation.v1.QueryCirculatingSupplyRequest", + is(o: any): o is QueryCirculatingSupplyRequest { + return o && o.$typeUrl === QueryCirculatingSupplyRequest.typeUrl; + }, + isSDK(o: any): o is QueryCirculatingSupplyRequestSDKType { + return o && o.$typeUrl === QueryCirculatingSupplyRequest.typeUrl; + }, + isAmino(o: any): o is QueryCirculatingSupplyRequestAmino { + return o && o.$typeUrl === QueryCirculatingSupplyRequest.typeUrl; + }, encode(_: QueryCirculatingSupplyRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -1009,7 +1084,8 @@ export const QueryCirculatingSupplyRequest = { typeUrl: "/evmos.inflation.v1.QueryCirculatingSupplyRequest", value: QueryCirculatingSupplyRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryCirculatingSupplyResponse(): QueryCirculatingSupplyResponse { return { @@ -1025,6 +1101,15 @@ function createBaseQueryCirculatingSupplyResponse(): QueryCirculatingSupplyRespo */ export const QueryCirculatingSupplyResponse = { typeUrl: "/evmos.inflation.v1.QueryCirculatingSupplyResponse", + is(o: any): o is QueryCirculatingSupplyResponse { + return o && (o.$typeUrl === QueryCirculatingSupplyResponse.typeUrl || DecCoin.is(o.circulatingSupply)); + }, + isSDK(o: any): o is QueryCirculatingSupplyResponseSDKType { + return o && (o.$typeUrl === QueryCirculatingSupplyResponse.typeUrl || DecCoin.isSDK(o.circulating_supply)); + }, + isAmino(o: any): o is QueryCirculatingSupplyResponseAmino { + return o && (o.$typeUrl === QueryCirculatingSupplyResponse.typeUrl || DecCoin.isAmino(o.circulating_supply)); + }, encode(message: QueryCirculatingSupplyResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.circulatingSupply !== undefined) { DecCoin.encode(message.circulatingSupply, writer.uint32(10).fork()).ldelim(); @@ -1101,6 +1186,12 @@ export const QueryCirculatingSupplyResponse = { typeUrl: "/evmos.inflation.v1.QueryCirculatingSupplyResponse", value: QueryCirculatingSupplyResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryCirculatingSupplyResponse.typeUrl)) { + return; + } + DecCoin.registerTypeUrl(); } }; function createBaseQueryInflationRateRequest(): QueryInflationRateRequest { @@ -1115,6 +1206,15 @@ function createBaseQueryInflationRateRequest(): QueryInflationRateRequest { */ export const QueryInflationRateRequest = { typeUrl: "/evmos.inflation.v1.QueryInflationRateRequest", + is(o: any): o is QueryInflationRateRequest { + return o && o.$typeUrl === QueryInflationRateRequest.typeUrl; + }, + isSDK(o: any): o is QueryInflationRateRequestSDKType { + return o && o.$typeUrl === QueryInflationRateRequest.typeUrl; + }, + isAmino(o: any): o is QueryInflationRateRequestAmino { + return o && o.$typeUrl === QueryInflationRateRequest.typeUrl; + }, encode(_: QueryInflationRateRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -1173,7 +1273,8 @@ export const QueryInflationRateRequest = { typeUrl: "/evmos.inflation.v1.QueryInflationRateRequest", value: QueryInflationRateRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryInflationRateResponse(): QueryInflationRateResponse { return { @@ -1189,6 +1290,15 @@ function createBaseQueryInflationRateResponse(): QueryInflationRateResponse { */ export const QueryInflationRateResponse = { typeUrl: "/evmos.inflation.v1.QueryInflationRateResponse", + is(o: any): o is QueryInflationRateResponse { + return o && (o.$typeUrl === QueryInflationRateResponse.typeUrl || typeof o.inflationRate === "string"); + }, + isSDK(o: any): o is QueryInflationRateResponseSDKType { + return o && (o.$typeUrl === QueryInflationRateResponse.typeUrl || typeof o.inflation_rate === "string"); + }, + isAmino(o: any): o is QueryInflationRateResponseAmino { + return o && (o.$typeUrl === QueryInflationRateResponse.typeUrl || typeof o.inflation_rate === "string"); + }, encode(message: QueryInflationRateResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.inflationRate !== "") { writer.uint32(10).string(Decimal.fromUserInput(message.inflationRate, 18).atomics); @@ -1246,7 +1356,7 @@ export const QueryInflationRateResponse = { }, toAmino(message: QueryInflationRateResponse): QueryInflationRateResponseAmino { const obj: any = {}; - obj.inflation_rate = message.inflationRate === "" ? undefined : message.inflationRate; + obj.inflation_rate = message.inflationRate === "" ? undefined : Decimal.fromUserInput(message.inflationRate, 18).atomics; return obj; }, fromAminoMsg(object: QueryInflationRateResponseAminoMsg): QueryInflationRateResponse { @@ -1263,7 +1373,8 @@ export const QueryInflationRateResponse = { typeUrl: "/evmos.inflation.v1.QueryInflationRateResponse", value: QueryInflationRateResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryParamsRequest(): QueryParamsRequest { return {}; @@ -1276,6 +1387,15 @@ function createBaseQueryParamsRequest(): QueryParamsRequest { */ export const QueryParamsRequest = { typeUrl: "/evmos.inflation.v1.QueryParamsRequest", + is(o: any): o is QueryParamsRequest { + return o && o.$typeUrl === QueryParamsRequest.typeUrl; + }, + isSDK(o: any): o is QueryParamsRequestSDKType { + return o && o.$typeUrl === QueryParamsRequest.typeUrl; + }, + isAmino(o: any): o is QueryParamsRequestAmino { + return o && o.$typeUrl === QueryParamsRequest.typeUrl; + }, encode(_: QueryParamsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -1334,7 +1454,8 @@ export const QueryParamsRequest = { typeUrl: "/evmos.inflation.v1.QueryParamsRequest", value: QueryParamsRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryParamsResponse(): QueryParamsResponse { return { @@ -1349,6 +1470,15 @@ function createBaseQueryParamsResponse(): QueryParamsResponse { */ export const QueryParamsResponse = { typeUrl: "/evmos.inflation.v1.QueryParamsResponse", + is(o: any): o is QueryParamsResponse { + return o && (o.$typeUrl === QueryParamsResponse.typeUrl || Params.is(o.params)); + }, + isSDK(o: any): o is QueryParamsResponseSDKType { + return o && (o.$typeUrl === QueryParamsResponse.typeUrl || Params.isSDK(o.params)); + }, + isAmino(o: any): o is QueryParamsResponseAmino { + return o && (o.$typeUrl === QueryParamsResponse.typeUrl || Params.isAmino(o.params)); + }, encode(message: QueryParamsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.params !== undefined) { Params.encode(message.params, writer.uint32(10).fork()).ldelim(); @@ -1425,5 +1555,11 @@ export const QueryParamsResponse = { typeUrl: "/evmos.inflation.v1.QueryParamsResponse", value: QueryParamsResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryParamsResponse.typeUrl)) { + return; + } + Params.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/evmos/recovery/v1/genesis.ts b/__fixtures__/v-next/outputv2/evmos/recovery/v1/genesis.ts index c613ec555c..8e83aa38f9 100644 --- a/__fixtures__/v-next/outputv2/evmos/recovery/v1/genesis.ts +++ b/__fixtures__/v-next/outputv2/evmos/recovery/v1/genesis.ts @@ -1,5 +1,6 @@ import { Duration, DurationAmino, DurationSDKType } from "../../../google/protobuf/duration"; import { BinaryReader, BinaryWriter } from "../../../binary"; +import { GlobalDecoderRegistry } from "../../../registry"; import { isSet, DeepPartial } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "evmos.recovery.v1"; @@ -107,6 +108,15 @@ function createBaseGenesisState(): GenesisState { */ export const GenesisState = { typeUrl: "/evmos.recovery.v1.GenesisState", + is(o: any): o is GenesisState { + return o && (o.$typeUrl === GenesisState.typeUrl || Params.is(o.params)); + }, + isSDK(o: any): o is GenesisStateSDKType { + return o && (o.$typeUrl === GenesisState.typeUrl || Params.isSDK(o.params)); + }, + isAmino(o: any): o is GenesisStateAmino { + return o && (o.$typeUrl === GenesisState.typeUrl || Params.isAmino(o.params)); + }, encode(message: GenesisState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.params !== undefined) { Params.encode(message.params, writer.uint32(10).fork()).ldelim(); @@ -183,6 +193,12 @@ export const GenesisState = { typeUrl: "/evmos.recovery.v1.GenesisState", value: GenesisState.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GenesisState.typeUrl)) { + return; + } + Params.registerTypeUrl(); } }; function createBaseParams(): Params { @@ -199,6 +215,15 @@ function createBaseParams(): Params { */ export const Params = { typeUrl: "/evmos.recovery.v1.Params", + is(o: any): o is Params { + return o && (o.$typeUrl === Params.typeUrl || typeof o.enableRecovery === "boolean" && Duration.is(o.packetTimeoutDuration)); + }, + isSDK(o: any): o is ParamsSDKType { + return o && (o.$typeUrl === Params.typeUrl || typeof o.enable_recovery === "boolean" && Duration.isSDK(o.packet_timeout_duration)); + }, + isAmino(o: any): o is ParamsAmino { + return o && (o.$typeUrl === Params.typeUrl || typeof o.enable_recovery === "boolean" && Duration.isAmino(o.packet_timeout_duration)); + }, encode(message: Params, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.enableRecovery === true) { writer.uint32(8).bool(message.enableRecovery); @@ -290,5 +315,6 @@ export const Params = { typeUrl: "/evmos.recovery.v1.Params", value: Params.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/evmos/recovery/v1/query.rpc.func.ts b/__fixtures__/v-next/outputv2/evmos/recovery/v1/query.rpc.func.ts new file mode 100644 index 0000000000..3ea138b8ed --- /dev/null +++ b/__fixtures__/v-next/outputv2/evmos/recovery/v1/query.rpc.func.ts @@ -0,0 +1,15 @@ +import { buildQuery } from "../../../helper-func-types"; +import { QueryParamsRequest, QueryParamsResponse } from "./query"; +/** + * Params retrieves the total set of recovery parameters. + * @name getParams + * @package evmos.recovery.v1 + * @see proto service: evmos.recovery.v1.Params + */ +export const getParams = buildQuery({ + encode: QueryParamsRequest.encode, + decode: QueryParamsResponse.decode, + service: "evmos.recovery.v1.Query", + method: "Params", + deps: [QueryParamsRequest, QueryParamsResponse] +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/evmos/recovery/v1/query.ts b/__fixtures__/v-next/outputv2/evmos/recovery/v1/query.ts index cb29ca3dad..2ceb4a97b9 100644 --- a/__fixtures__/v-next/outputv2/evmos/recovery/v1/query.ts +++ b/__fixtures__/v-next/outputv2/evmos/recovery/v1/query.ts @@ -2,6 +2,7 @@ import { Params, ParamsAmino, ParamsSDKType } from "./genesis"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { JsonSafe } from "../../../json-safe"; import { DeepPartial, isSet } from "../../../helpers"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "evmos.recovery.v1"; /** * QueryParamsRequest is the request type for the Query/Params RPC method. @@ -84,6 +85,15 @@ function createBaseQueryParamsRequest(): QueryParamsRequest { */ export const QueryParamsRequest = { typeUrl: "/evmos.recovery.v1.QueryParamsRequest", + is(o: any): o is QueryParamsRequest { + return o && o.$typeUrl === QueryParamsRequest.typeUrl; + }, + isSDK(o: any): o is QueryParamsRequestSDKType { + return o && o.$typeUrl === QueryParamsRequest.typeUrl; + }, + isAmino(o: any): o is QueryParamsRequestAmino { + return o && o.$typeUrl === QueryParamsRequest.typeUrl; + }, encode(_: QueryParamsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -142,7 +152,8 @@ export const QueryParamsRequest = { typeUrl: "/evmos.recovery.v1.QueryParamsRequest", value: QueryParamsRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryParamsResponse(): QueryParamsResponse { return { @@ -157,6 +168,15 @@ function createBaseQueryParamsResponse(): QueryParamsResponse { */ export const QueryParamsResponse = { typeUrl: "/evmos.recovery.v1.QueryParamsResponse", + is(o: any): o is QueryParamsResponse { + return o && (o.$typeUrl === QueryParamsResponse.typeUrl || Params.is(o.params)); + }, + isSDK(o: any): o is QueryParamsResponseSDKType { + return o && (o.$typeUrl === QueryParamsResponse.typeUrl || Params.isSDK(o.params)); + }, + isAmino(o: any): o is QueryParamsResponseAmino { + return o && (o.$typeUrl === QueryParamsResponse.typeUrl || Params.isAmino(o.params)); + }, encode(message: QueryParamsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.params !== undefined) { Params.encode(message.params, writer.uint32(10).fork()).ldelim(); @@ -233,5 +253,11 @@ export const QueryParamsResponse = { typeUrl: "/evmos.recovery.v1.QueryParamsResponse", value: QueryParamsResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryParamsResponse.typeUrl)) { + return; + } + Params.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/evmos/vesting/v1/query.rpc.func.ts b/__fixtures__/v-next/outputv2/evmos/vesting/v1/query.rpc.func.ts new file mode 100644 index 0000000000..0d76080237 --- /dev/null +++ b/__fixtures__/v-next/outputv2/evmos/vesting/v1/query.rpc.func.ts @@ -0,0 +1,15 @@ +import { buildQuery } from "../../../helper-func-types"; +import { QueryBalancesRequest, QueryBalancesResponse } from "./query"; +/** + * Retrieves the unvested, vested and locked tokens for a vesting account + * @name getBalances + * @package evmos.vesting.v1 + * @see proto service: evmos.vesting.v1.Balances + */ +export const getBalances = buildQuery({ + encode: QueryBalancesRequest.encode, + decode: QueryBalancesResponse.decode, + service: "evmos.vesting.v1.Query", + method: "Balances", + deps: [QueryBalancesRequest, QueryBalancesResponse] +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/evmos/vesting/v1/query.ts b/__fixtures__/v-next/outputv2/evmos/vesting/v1/query.ts index 1260b84eaa..5d5e85014e 100644 --- a/__fixtures__/v-next/outputv2/evmos/vesting/v1/query.ts +++ b/__fixtures__/v-next/outputv2/evmos/vesting/v1/query.ts @@ -2,6 +2,7 @@ import { Coin, CoinAmino, CoinSDKType } from "../../../cosmos/base/v1beta1/coin" import { BinaryReader, BinaryWriter } from "../../../binary"; import { isSet, DeepPartial } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "evmos.vesting.v1"; /** * QueryBalancesRequest is the request type for the Query/Balances RPC method. @@ -119,6 +120,15 @@ function createBaseQueryBalancesRequest(): QueryBalancesRequest { */ export const QueryBalancesRequest = { typeUrl: "/evmos.vesting.v1.QueryBalancesRequest", + is(o: any): o is QueryBalancesRequest { + return o && (o.$typeUrl === QueryBalancesRequest.typeUrl || typeof o.address === "string"); + }, + isSDK(o: any): o is QueryBalancesRequestSDKType { + return o && (o.$typeUrl === QueryBalancesRequest.typeUrl || typeof o.address === "string"); + }, + isAmino(o: any): o is QueryBalancesRequestAmino { + return o && (o.$typeUrl === QueryBalancesRequest.typeUrl || typeof o.address === "string"); + }, encode(message: QueryBalancesRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.address !== "") { writer.uint32(10).string(message.address); @@ -193,7 +203,8 @@ export const QueryBalancesRequest = { typeUrl: "/evmos.vesting.v1.QueryBalancesRequest", value: QueryBalancesRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryBalancesResponse(): QueryBalancesResponse { return { @@ -211,6 +222,15 @@ function createBaseQueryBalancesResponse(): QueryBalancesResponse { */ export const QueryBalancesResponse = { typeUrl: "/evmos.vesting.v1.QueryBalancesResponse", + is(o: any): o is QueryBalancesResponse { + return o && (o.$typeUrl === QueryBalancesResponse.typeUrl || Array.isArray(o.locked) && (!o.locked.length || Coin.is(o.locked[0])) && Array.isArray(o.unvested) && (!o.unvested.length || Coin.is(o.unvested[0])) && Array.isArray(o.vested) && (!o.vested.length || Coin.is(o.vested[0]))); + }, + isSDK(o: any): o is QueryBalancesResponseSDKType { + return o && (o.$typeUrl === QueryBalancesResponse.typeUrl || Array.isArray(o.locked) && (!o.locked.length || Coin.isSDK(o.locked[0])) && Array.isArray(o.unvested) && (!o.unvested.length || Coin.isSDK(o.unvested[0])) && Array.isArray(o.vested) && (!o.vested.length || Coin.isSDK(o.vested[0]))); + }, + isAmino(o: any): o is QueryBalancesResponseAmino { + return o && (o.$typeUrl === QueryBalancesResponse.typeUrl || Array.isArray(o.locked) && (!o.locked.length || Coin.isAmino(o.locked[0])) && Array.isArray(o.unvested) && (!o.unvested.length || Coin.isAmino(o.unvested[0])) && Array.isArray(o.vested) && (!o.vested.length || Coin.isAmino(o.vested[0]))); + }, encode(message: QueryBalancesResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.locked) { Coin.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -345,5 +365,11 @@ export const QueryBalancesResponse = { typeUrl: "/evmos.vesting.v1.QueryBalancesResponse", value: QueryBalancesResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryBalancesResponse.typeUrl)) { + return; + } + Coin.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/evmos/vesting/v1/tx.registry.ts b/__fixtures__/v-next/outputv2/evmos/vesting/v1/tx.registry.ts index 88a844e831..891e401a83 100644 --- a/__fixtures__/v-next/outputv2/evmos/vesting/v1/tx.registry.ts +++ b/__fixtures__/v-next/outputv2/evmos/vesting/v1/tx.registry.ts @@ -1,11 +1,6 @@ -import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { TelescopeGeneratedType } from "../../../types"; import { MsgCreateClawbackVestingAccount, MsgClawback } from "./tx"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/evmos.vesting.v1.MsgCreateClawbackVestingAccount", MsgCreateClawbackVestingAccount], ["/evmos.vesting.v1.MsgClawback", MsgClawback]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/evmos.vesting.v1.MsgCreateClawbackVestingAccount", MsgCreateClawbackVestingAccount], ["/evmos.vesting.v1.MsgClawback", MsgClawback]]; export const MessageComposer = { encoded: { createClawbackVestingAccount(value: MsgCreateClawbackVestingAccount) { diff --git a/__fixtures__/v-next/outputv2/evmos/vesting/v1/tx.rpc.func.ts b/__fixtures__/v-next/outputv2/evmos/vesting/v1/tx.rpc.func.ts new file mode 100644 index 0000000000..1859634c2b --- /dev/null +++ b/__fixtures__/v-next/outputv2/evmos/vesting/v1/tx.rpc.func.ts @@ -0,0 +1,21 @@ +import { buildTx } from "../../../helper-func-types"; +import { MsgCreateClawbackVestingAccount, MsgClawback } from "./tx"; +/** + * CreateClawbackVestingAccount creats a vesting account that is subject to + * clawback and the configuration of vesting and lockup schedules. + * @name createClawbackVestingAccount + * @package evmos.vesting.v1 + * @see proto service: evmos.vesting.v1.CreateClawbackVestingAccount + */ +export const createClawbackVestingAccount = buildTx({ + msg: MsgCreateClawbackVestingAccount +}); +/** + * Clawback removes the unvested tokens from a ClawbackVestingAccount. + * @name clawback + * @package evmos.vesting.v1 + * @see proto service: evmos.vesting.v1.Clawback + */ +export const clawback = buildTx({ + msg: MsgClawback +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/evmos/vesting/v1/tx.ts b/__fixtures__/v-next/outputv2/evmos/vesting/v1/tx.ts index 56968402fb..6f997a049e 100644 --- a/__fixtures__/v-next/outputv2/evmos/vesting/v1/tx.ts +++ b/__fixtures__/v-next/outputv2/evmos/vesting/v1/tx.ts @@ -3,6 +3,7 @@ import { Period, PeriodAmino, PeriodSDKType } from "../../../cosmos/vesting/v1be import { BinaryReader, BinaryWriter } from "../../../binary"; import { toTimestamp, fromTimestamp, isSet, DeepPartial } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "evmos.vesting.v1"; /** * MsgCreateClawbackVestingAccount defines a message that enables creating a ClawbackVestingAccount. @@ -245,6 +246,15 @@ function createBaseMsgCreateClawbackVestingAccount(): MsgCreateClawbackVestingAc */ export const MsgCreateClawbackVestingAccount = { typeUrl: "/evmos.vesting.v1.MsgCreateClawbackVestingAccount", + is(o: any): o is MsgCreateClawbackVestingAccount { + return o && (o.$typeUrl === MsgCreateClawbackVestingAccount.typeUrl || typeof o.fromAddress === "string" && typeof o.toAddress === "string" && Timestamp.is(o.startTime) && Array.isArray(o.lockupPeriods) && (!o.lockupPeriods.length || Period.is(o.lockupPeriods[0])) && Array.isArray(o.vestingPeriods) && (!o.vestingPeriods.length || Period.is(o.vestingPeriods[0])) && typeof o.merge === "boolean"); + }, + isSDK(o: any): o is MsgCreateClawbackVestingAccountSDKType { + return o && (o.$typeUrl === MsgCreateClawbackVestingAccount.typeUrl || typeof o.from_address === "string" && typeof o.to_address === "string" && Timestamp.isSDK(o.start_time) && Array.isArray(o.lockup_periods) && (!o.lockup_periods.length || Period.isSDK(o.lockup_periods[0])) && Array.isArray(o.vesting_periods) && (!o.vesting_periods.length || Period.isSDK(o.vesting_periods[0])) && typeof o.merge === "boolean"); + }, + isAmino(o: any): o is MsgCreateClawbackVestingAccountAmino { + return o && (o.$typeUrl === MsgCreateClawbackVestingAccount.typeUrl || typeof o.from_address === "string" && typeof o.to_address === "string" && Timestamp.isAmino(o.start_time) && Array.isArray(o.lockup_periods) && (!o.lockup_periods.length || Period.isAmino(o.lockup_periods[0])) && Array.isArray(o.vesting_periods) && (!o.vesting_periods.length || Period.isAmino(o.vesting_periods[0])) && typeof o.merge === "boolean"); + }, encode(message: MsgCreateClawbackVestingAccount, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.fromAddress !== "") { writer.uint32(10).string(message.fromAddress); @@ -414,6 +424,12 @@ export const MsgCreateClawbackVestingAccount = { typeUrl: "/evmos.vesting.v1.MsgCreateClawbackVestingAccount", value: MsgCreateClawbackVestingAccount.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgCreateClawbackVestingAccount.typeUrl)) { + return; + } + Period.registerTypeUrl(); } }; function createBaseMsgCreateClawbackVestingAccountResponse(): MsgCreateClawbackVestingAccountResponse { @@ -428,6 +444,15 @@ function createBaseMsgCreateClawbackVestingAccountResponse(): MsgCreateClawbackV */ export const MsgCreateClawbackVestingAccountResponse = { typeUrl: "/evmos.vesting.v1.MsgCreateClawbackVestingAccountResponse", + is(o: any): o is MsgCreateClawbackVestingAccountResponse { + return o && o.$typeUrl === MsgCreateClawbackVestingAccountResponse.typeUrl; + }, + isSDK(o: any): o is MsgCreateClawbackVestingAccountResponseSDKType { + return o && o.$typeUrl === MsgCreateClawbackVestingAccountResponse.typeUrl; + }, + isAmino(o: any): o is MsgCreateClawbackVestingAccountResponseAmino { + return o && o.$typeUrl === MsgCreateClawbackVestingAccountResponse.typeUrl; + }, encode(_: MsgCreateClawbackVestingAccountResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -486,7 +511,8 @@ export const MsgCreateClawbackVestingAccountResponse = { typeUrl: "/evmos.vesting.v1.MsgCreateClawbackVestingAccountResponse", value: MsgCreateClawbackVestingAccountResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgClawback(): MsgClawback { return { @@ -504,6 +530,15 @@ function createBaseMsgClawback(): MsgClawback { */ export const MsgClawback = { typeUrl: "/evmos.vesting.v1.MsgClawback", + is(o: any): o is MsgClawback { + return o && (o.$typeUrl === MsgClawback.typeUrl || typeof o.funderAddress === "string" && typeof o.accountAddress === "string" && typeof o.destAddress === "string"); + }, + isSDK(o: any): o is MsgClawbackSDKType { + return o && (o.$typeUrl === MsgClawback.typeUrl || typeof o.funder_address === "string" && typeof o.account_address === "string" && typeof o.dest_address === "string"); + }, + isAmino(o: any): o is MsgClawbackAmino { + return o && (o.$typeUrl === MsgClawback.typeUrl || typeof o.funder_address === "string" && typeof o.account_address === "string" && typeof o.dest_address === "string"); + }, encode(message: MsgClawback, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.funderAddress !== "") { writer.uint32(10).string(message.funderAddress); @@ -608,7 +643,8 @@ export const MsgClawback = { typeUrl: "/evmos.vesting.v1.MsgClawback", value: MsgClawback.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgClawbackResponse(): MsgClawbackResponse { return {}; @@ -621,6 +657,15 @@ function createBaseMsgClawbackResponse(): MsgClawbackResponse { */ export const MsgClawbackResponse = { typeUrl: "/evmos.vesting.v1.MsgClawbackResponse", + is(o: any): o is MsgClawbackResponse { + return o && o.$typeUrl === MsgClawbackResponse.typeUrl; + }, + isSDK(o: any): o is MsgClawbackResponseSDKType { + return o && o.$typeUrl === MsgClawbackResponse.typeUrl; + }, + isAmino(o: any): o is MsgClawbackResponseAmino { + return o && o.$typeUrl === MsgClawbackResponse.typeUrl; + }, encode(_: MsgClawbackResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -679,5 +724,6 @@ export const MsgClawbackResponse = { typeUrl: "/evmos.vesting.v1.MsgClawbackResponse", value: MsgClawbackResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/evmos/vesting/v1/vesting.ts b/__fixtures__/v-next/outputv2/evmos/vesting/v1/vesting.ts index 0d1c600a9a..7d5be26355 100644 --- a/__fixtures__/v-next/outputv2/evmos/vesting/v1/vesting.ts +++ b/__fixtures__/v-next/outputv2/evmos/vesting/v1/vesting.ts @@ -1,6 +1,7 @@ import { BaseVestingAccount, BaseVestingAccountAmino, BaseVestingAccountSDKType, Period, PeriodAmino, PeriodSDKType } from "../../../cosmos/vesting/v1beta1/vesting"; import { Timestamp } from "../../../google/protobuf/timestamp"; import { BinaryReader, BinaryWriter } from "../../../binary"; +import { GlobalDecoderRegistry } from "../../../registry"; import { toTimestamp, fromTimestamp, isSet, DeepPartial } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "evmos.vesting.v1"; @@ -112,6 +113,15 @@ function createBaseClawbackVestingAccount(): ClawbackVestingAccount { */ export const ClawbackVestingAccount = { typeUrl: "/evmos.vesting.v1.ClawbackVestingAccount", + is(o: any): o is ClawbackVestingAccount { + return o && (o.$typeUrl === ClawbackVestingAccount.typeUrl || typeof o.funderAddress === "string" && Timestamp.is(o.startTime) && Array.isArray(o.lockupPeriods) && (!o.lockupPeriods.length || Period.is(o.lockupPeriods[0])) && Array.isArray(o.vestingPeriods) && (!o.vestingPeriods.length || Period.is(o.vestingPeriods[0]))); + }, + isSDK(o: any): o is ClawbackVestingAccountSDKType { + return o && (o.$typeUrl === ClawbackVestingAccount.typeUrl || typeof o.funder_address === "string" && Timestamp.isSDK(o.start_time) && Array.isArray(o.lockup_periods) && (!o.lockup_periods.length || Period.isSDK(o.lockup_periods[0])) && Array.isArray(o.vesting_periods) && (!o.vesting_periods.length || Period.isSDK(o.vesting_periods[0]))); + }, + isAmino(o: any): o is ClawbackVestingAccountAmino { + return o && (o.$typeUrl === ClawbackVestingAccount.typeUrl || typeof o.funder_address === "string" && Timestamp.isAmino(o.start_time) && Array.isArray(o.lockup_periods) && (!o.lockup_periods.length || Period.isAmino(o.lockup_periods[0])) && Array.isArray(o.vesting_periods) && (!o.vesting_periods.length || Period.isAmino(o.vesting_periods[0]))); + }, encode(message: ClawbackVestingAccount, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.baseVestingAccount !== undefined) { BaseVestingAccount.encode(message.baseVestingAccount, writer.uint32(10).fork()).ldelim(); @@ -268,5 +278,12 @@ export const ClawbackVestingAccount = { typeUrl: "/evmos.vesting.v1.ClawbackVestingAccount", value: ClawbackVestingAccount.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ClawbackVestingAccount.typeUrl)) { + return; + } + BaseVestingAccount.registerTypeUrl(); + Period.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/extern.ts b/__fixtures__/v-next/outputv2/extern.ts index c3e7cbcac8..83d6864ae2 100644 --- a/__fixtures__/v-next/outputv2/extern.ts +++ b/__fixtures__/v-next/outputv2/extern.ts @@ -4,30 +4,45 @@ * and run the transpile command or npm scripts command that is used to regenerate this bundle. */ -import { QueryClient, createProtobufRpcClient, ProtobufRpcClient } from '@cosmjs/stargate' -import { Tendermint34Client, HttpEndpoint } from "@cosmjs/tendermint-rpc"; -const _rpcClients: Record = {}; +import { HttpEndpoint } from "@interchainjs/types"; +import { Rpc } from "./helpers"; +import { ClientOptions, createCosmosQueryClient } from "@interchainjs/cosmos"; + +const _rpcClients: Record = {}; export const getRpcEndpointKey = (rpcEndpoint: string | HttpEndpoint) => { - if (typeof rpcEndpoint === 'string') { - return rpcEndpoint; - } else if (!!rpcEndpoint) { - //@ts-ignore - return rpcEndpoint.url; - } + if (typeof rpcEndpoint === 'string') { + return rpcEndpoint; + } else if (!!rpcEndpoint) { + //@ts-ignore + return rpcEndpoint.url; + } } export const getRpcClient = async (rpcEndpoint: string | HttpEndpoint) => { - const key = getRpcEndpointKey(rpcEndpoint); - if (!key) return; - if (_rpcClients.hasOwnProperty(key)) { - return _rpcClients[key]; - } - const tmClient = await Tendermint34Client.connect(rpcEndpoint); - //@ts-ignore - const client = new QueryClient(tmClient); - const rpc = createProtobufRpcClient(client); - _rpcClients[key] = rpc; - return rpc; + const key = getRpcEndpointKey(rpcEndpoint); + if (!key) return; + if (_rpcClients.hasOwnProperty(key)) { + return _rpcClients[key]; + } + const rpc = await createRpcClient(rpcEndpoint); + _rpcClients[key] = rpc; + return rpc; +} + +export const createRpcClient = async (rpcEndpoint: string | HttpEndpoint, + options?: ClientOptions +) => { + if (typeof rpcEndpoint === 'string') { + return createCosmosQueryClient(rpcEndpoint, options); + } else { + const endpointStr = rpcEndpoint.url; + const clientOptions = { + ...options, + headers: rpcEndpoint.headers + }; + + return createCosmosQueryClient(endpointStr, clientOptions); + } } diff --git a/__fixtures__/v-next/outputv2/google/api/auth.ts b/__fixtures__/v-next/outputv2/google/api/auth.ts index d44789ae38..3ca92bf214 100644 --- a/__fixtures__/v-next/outputv2/google/api/auth.ts +++ b/__fixtures__/v-next/outputv2/google/api/auth.ts @@ -1,6 +1,7 @@ import { BinaryReader, BinaryWriter } from "../../binary"; import { JsonSafe } from "../../json-safe"; import { DeepPartial, isSet } from "../../helpers"; +import { GlobalDecoderRegistry } from "../../registry"; export const protobufPackage = "google.api"; /** * `Authentication` defines the authentication configuration for API methods @@ -703,6 +704,15 @@ function createBaseAuthentication(): Authentication { */ export const Authentication = { typeUrl: "/google.api.Authentication", + is(o: any): o is Authentication { + return o && (o.$typeUrl === Authentication.typeUrl || Array.isArray(o.rules) && (!o.rules.length || AuthenticationRule.is(o.rules[0])) && Array.isArray(o.providers) && (!o.providers.length || AuthProvider.is(o.providers[0]))); + }, + isSDK(o: any): o is AuthenticationSDKType { + return o && (o.$typeUrl === Authentication.typeUrl || Array.isArray(o.rules) && (!o.rules.length || AuthenticationRule.isSDK(o.rules[0])) && Array.isArray(o.providers) && (!o.providers.length || AuthProvider.isSDK(o.providers[0]))); + }, + isAmino(o: any): o is AuthenticationAmino { + return o && (o.$typeUrl === Authentication.typeUrl || Array.isArray(o.rules) && (!o.rules.length || AuthenticationRule.isAmino(o.rules[0])) && Array.isArray(o.providers) && (!o.providers.length || AuthProvider.isAmino(o.providers[0]))); + }, encode(message: Authentication, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.rules) { AuthenticationRule.encode(v!, writer.uint32(26).fork()).ldelim(); @@ -812,6 +822,13 @@ export const Authentication = { typeUrl: "/google.api.Authentication", value: Authentication.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Authentication.typeUrl)) { + return; + } + AuthenticationRule.registerTypeUrl(); + AuthProvider.registerTypeUrl(); } }; function createBaseAuthenticationRule(): AuthenticationRule { @@ -838,6 +855,15 @@ function createBaseAuthenticationRule(): AuthenticationRule { */ export const AuthenticationRule = { typeUrl: "/google.api.AuthenticationRule", + is(o: any): o is AuthenticationRule { + return o && (o.$typeUrl === AuthenticationRule.typeUrl || typeof o.selector === "string" && typeof o.allowWithoutCredential === "boolean" && Array.isArray(o.requirements) && (!o.requirements.length || AuthRequirement.is(o.requirements[0]))); + }, + isSDK(o: any): o is AuthenticationRuleSDKType { + return o && (o.$typeUrl === AuthenticationRule.typeUrl || typeof o.selector === "string" && typeof o.allow_without_credential === "boolean" && Array.isArray(o.requirements) && (!o.requirements.length || AuthRequirement.isSDK(o.requirements[0]))); + }, + isAmino(o: any): o is AuthenticationRuleAmino { + return o && (o.$typeUrl === AuthenticationRule.typeUrl || typeof o.selector === "string" && typeof o.allow_without_credential === "boolean" && Array.isArray(o.requirements) && (!o.requirements.length || AuthRequirement.isAmino(o.requirements[0]))); + }, encode(message: AuthenticationRule, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.selector !== "") { writer.uint32(10).string(message.selector); @@ -969,6 +995,13 @@ export const AuthenticationRule = { typeUrl: "/google.api.AuthenticationRule", value: AuthenticationRule.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(AuthenticationRule.typeUrl)) { + return; + } + OAuthRequirements.registerTypeUrl(); + AuthRequirement.registerTypeUrl(); } }; function createBaseJwtLocation(): JwtLocation { @@ -986,6 +1019,15 @@ function createBaseJwtLocation(): JwtLocation { */ export const JwtLocation = { typeUrl: "/google.api.JwtLocation", + is(o: any): o is JwtLocation { + return o && (o.$typeUrl === JwtLocation.typeUrl || typeof o.valuePrefix === "string"); + }, + isSDK(o: any): o is JwtLocationSDKType { + return o && (o.$typeUrl === JwtLocation.typeUrl || typeof o.value_prefix === "string"); + }, + isAmino(o: any): o is JwtLocationAmino { + return o && (o.$typeUrl === JwtLocation.typeUrl || typeof o.value_prefix === "string"); + }, encode(message: JwtLocation, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.header !== undefined) { writer.uint32(10).string(message.header); @@ -1090,7 +1132,8 @@ export const JwtLocation = { typeUrl: "/google.api.JwtLocation", value: JwtLocation.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseAuthProvider(): AuthProvider { return { @@ -1112,6 +1155,15 @@ function createBaseAuthProvider(): AuthProvider { */ export const AuthProvider = { typeUrl: "/google.api.AuthProvider", + is(o: any): o is AuthProvider { + return o && (o.$typeUrl === AuthProvider.typeUrl || typeof o.id === "string" && typeof o.issuer === "string" && typeof o.jwksUri === "string" && typeof o.audiences === "string" && typeof o.authorizationUrl === "string" && Array.isArray(o.jwtLocations) && (!o.jwtLocations.length || JwtLocation.is(o.jwtLocations[0]))); + }, + isSDK(o: any): o is AuthProviderSDKType { + return o && (o.$typeUrl === AuthProvider.typeUrl || typeof o.id === "string" && typeof o.issuer === "string" && typeof o.jwks_uri === "string" && typeof o.audiences === "string" && typeof o.authorization_url === "string" && Array.isArray(o.jwt_locations) && (!o.jwt_locations.length || JwtLocation.isSDK(o.jwt_locations[0]))); + }, + isAmino(o: any): o is AuthProviderAmino { + return o && (o.$typeUrl === AuthProvider.typeUrl || typeof o.id === "string" && typeof o.issuer === "string" && typeof o.jwks_uri === "string" && typeof o.audiences === "string" && typeof o.authorization_url === "string" && Array.isArray(o.jwt_locations) && (!o.jwt_locations.length || JwtLocation.isAmino(o.jwt_locations[0]))); + }, encode(message: AuthProvider, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.id !== "") { writer.uint32(10).string(message.id); @@ -1271,6 +1323,12 @@ export const AuthProvider = { typeUrl: "/google.api.AuthProvider", value: AuthProvider.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(AuthProvider.typeUrl)) { + return; + } + JwtLocation.registerTypeUrl(); } }; function createBaseOAuthRequirements(): OAuthRequirements { @@ -1303,6 +1361,15 @@ function createBaseOAuthRequirements(): OAuthRequirements { */ export const OAuthRequirements = { typeUrl: "/google.api.OAuthRequirements", + is(o: any): o is OAuthRequirements { + return o && (o.$typeUrl === OAuthRequirements.typeUrl || typeof o.canonicalScopes === "string"); + }, + isSDK(o: any): o is OAuthRequirementsSDKType { + return o && (o.$typeUrl === OAuthRequirements.typeUrl || typeof o.canonical_scopes === "string"); + }, + isAmino(o: any): o is OAuthRequirementsAmino { + return o && (o.$typeUrl === OAuthRequirements.typeUrl || typeof o.canonical_scopes === "string"); + }, encode(message: OAuthRequirements, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.canonicalScopes !== "") { writer.uint32(10).string(message.canonicalScopes); @@ -1377,7 +1444,8 @@ export const OAuthRequirements = { typeUrl: "/google.api.OAuthRequirements", value: OAuthRequirements.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseAuthRequirement(): AuthRequirement { return { @@ -1395,6 +1463,15 @@ function createBaseAuthRequirement(): AuthRequirement { */ export const AuthRequirement = { typeUrl: "/google.api.AuthRequirement", + is(o: any): o is AuthRequirement { + return o && (o.$typeUrl === AuthRequirement.typeUrl || typeof o.providerId === "string" && typeof o.audiences === "string"); + }, + isSDK(o: any): o is AuthRequirementSDKType { + return o && (o.$typeUrl === AuthRequirement.typeUrl || typeof o.provider_id === "string" && typeof o.audiences === "string"); + }, + isAmino(o: any): o is AuthRequirementAmino { + return o && (o.$typeUrl === AuthRequirement.typeUrl || typeof o.provider_id === "string" && typeof o.audiences === "string"); + }, encode(message: AuthRequirement, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.providerId !== "") { writer.uint32(10).string(message.providerId); @@ -1484,5 +1561,6 @@ export const AuthRequirement = { typeUrl: "/google.api.AuthRequirement", value: AuthRequirement.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/google/api/backend.ts b/__fixtures__/v-next/outputv2/google/api/backend.ts index fb6e4452b6..570ff70b50 100644 --- a/__fixtures__/v-next/outputv2/google/api/backend.ts +++ b/__fixtures__/v-next/outputv2/google/api/backend.ts @@ -1,6 +1,7 @@ import { BinaryReader, BinaryWriter } from "../../binary"; import { JsonSafe } from "../../json-safe"; import { DeepPartial, isSet } from "../../helpers"; +import { GlobalDecoderRegistry } from "../../registry"; export const protobufPackage = "google.api"; /** * Path Translation specifies how to combine the backend address with the @@ -358,6 +359,15 @@ function createBaseBackend(): Backend { */ export const Backend = { typeUrl: "/google.api.Backend", + is(o: any): o is Backend { + return o && (o.$typeUrl === Backend.typeUrl || Array.isArray(o.rules) && (!o.rules.length || BackendRule.is(o.rules[0]))); + }, + isSDK(o: any): o is BackendSDKType { + return o && (o.$typeUrl === Backend.typeUrl || Array.isArray(o.rules) && (!o.rules.length || BackendRule.isSDK(o.rules[0]))); + }, + isAmino(o: any): o is BackendAmino { + return o && (o.$typeUrl === Backend.typeUrl || Array.isArray(o.rules) && (!o.rules.length || BackendRule.isAmino(o.rules[0]))); + }, encode(message: Backend, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.rules) { BackendRule.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -442,6 +452,12 @@ export const Backend = { typeUrl: "/google.api.Backend", value: Backend.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Backend.typeUrl)) { + return; + } + BackendRule.registerTypeUrl(); } }; function createBaseBackendRule(): BackendRule { @@ -465,6 +481,15 @@ function createBaseBackendRule(): BackendRule { */ export const BackendRule = { typeUrl: "/google.api.BackendRule", + is(o: any): o is BackendRule { + return o && (o.$typeUrl === BackendRule.typeUrl || typeof o.selector === "string" && typeof o.address === "string" && typeof o.deadline === "number" && typeof o.minDeadline === "number" && typeof o.operationDeadline === "number" && isSet(o.pathTranslation) && typeof o.protocol === "string"); + }, + isSDK(o: any): o is BackendRuleSDKType { + return o && (o.$typeUrl === BackendRule.typeUrl || typeof o.selector === "string" && typeof o.address === "string" && typeof o.deadline === "number" && typeof o.min_deadline === "number" && typeof o.operation_deadline === "number" && isSet(o.path_translation) && typeof o.protocol === "string"); + }, + isAmino(o: any): o is BackendRuleAmino { + return o && (o.$typeUrl === BackendRule.typeUrl || typeof o.selector === "string" && typeof o.address === "string" && typeof o.deadline === "number" && typeof o.min_deadline === "number" && typeof o.operation_deadline === "number" && isSet(o.path_translation) && typeof o.protocol === "string"); + }, encode(message: BackendRule, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.selector !== "") { writer.uint32(10).string(message.selector); @@ -659,5 +684,6 @@ export const BackendRule = { typeUrl: "/google.api.BackendRule", value: BackendRule.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/google/api/billing.ts b/__fixtures__/v-next/outputv2/google/api/billing.ts index 4ff336629c..5a99f8317b 100644 --- a/__fixtures__/v-next/outputv2/google/api/billing.ts +++ b/__fixtures__/v-next/outputv2/google/api/billing.ts @@ -1,6 +1,7 @@ import { BinaryReader, BinaryWriter } from "../../binary"; import { JsonSafe } from "../../json-safe"; import { DeepPartial, isSet } from "../../helpers"; +import { GlobalDecoderRegistry } from "../../registry"; export const protobufPackage = "google.api"; /** * Billing related configuration of the service. @@ -243,6 +244,15 @@ function createBaseBilling(): Billing { */ export const Billing = { typeUrl: "/google.api.Billing", + is(o: any): o is Billing { + return o && (o.$typeUrl === Billing.typeUrl || Array.isArray(o.consumerDestinations) && (!o.consumerDestinations.length || Billing_BillingDestination.is(o.consumerDestinations[0]))); + }, + isSDK(o: any): o is BillingSDKType { + return o && (o.$typeUrl === Billing.typeUrl || Array.isArray(o.consumer_destinations) && (!o.consumer_destinations.length || Billing_BillingDestination.isSDK(o.consumer_destinations[0]))); + }, + isAmino(o: any): o is BillingAmino { + return o && (o.$typeUrl === Billing.typeUrl || Array.isArray(o.consumer_destinations) && (!o.consumer_destinations.length || Billing_BillingDestination.isAmino(o.consumer_destinations[0]))); + }, encode(message: Billing, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.consumerDestinations) { Billing_BillingDestination.encode(v!, writer.uint32(66).fork()).ldelim(); @@ -327,6 +337,12 @@ export const Billing = { typeUrl: "/google.api.Billing", value: Billing.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Billing.typeUrl)) { + return; + } + Billing_BillingDestination.registerTypeUrl(); } }; function createBaseBilling_BillingDestination(): Billing_BillingDestination { @@ -344,6 +360,15 @@ function createBaseBilling_BillingDestination(): Billing_BillingDestination { */ export const Billing_BillingDestination = { typeUrl: "/google.api.BillingDestination", + is(o: any): o is Billing_BillingDestination { + return o && (o.$typeUrl === Billing_BillingDestination.typeUrl || typeof o.monitoredResource === "string" && Array.isArray(o.metrics) && (!o.metrics.length || typeof o.metrics[0] === "string")); + }, + isSDK(o: any): o is Billing_BillingDestinationSDKType { + return o && (o.$typeUrl === Billing_BillingDestination.typeUrl || typeof o.monitored_resource === "string" && Array.isArray(o.metrics) && (!o.metrics.length || typeof o.metrics[0] === "string")); + }, + isAmino(o: any): o is Billing_BillingDestinationAmino { + return o && (o.$typeUrl === Billing_BillingDestination.typeUrl || typeof o.monitored_resource === "string" && Array.isArray(o.metrics) && (!o.metrics.length || typeof o.metrics[0] === "string")); + }, encode(message: Billing_BillingDestination, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.monitoredResource !== "") { writer.uint32(10).string(message.monitoredResource); @@ -443,5 +468,6 @@ export const Billing_BillingDestination = { typeUrl: "/google.api.BillingDestination", value: Billing_BillingDestination.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/google/api/config_change.ts b/__fixtures__/v-next/outputv2/google/api/config_change.ts index c54e0ced5d..6e1a0834c2 100644 --- a/__fixtures__/v-next/outputv2/google/api/config_change.ts +++ b/__fixtures__/v-next/outputv2/google/api/config_change.ts @@ -1,6 +1,7 @@ -import { BinaryReader, BinaryWriter } from "../../binary"; import { isSet, DeepPartial } from "../../helpers"; +import { BinaryReader, BinaryWriter } from "../../binary"; import { JsonSafe } from "../../json-safe"; +import { GlobalDecoderRegistry } from "../../registry"; export const protobufPackage = "google.api"; /** * Classifies set of possible modifications to an object in the service @@ -245,6 +246,15 @@ function createBaseConfigChange(): ConfigChange { */ export const ConfigChange = { typeUrl: "/google.api.ConfigChange", + is(o: any): o is ConfigChange { + return o && (o.$typeUrl === ConfigChange.typeUrl || typeof o.element === "string" && typeof o.oldValue === "string" && typeof o.newValue === "string" && isSet(o.changeType) && Array.isArray(o.advices) && (!o.advices.length || Advice.is(o.advices[0]))); + }, + isSDK(o: any): o is ConfigChangeSDKType { + return o && (o.$typeUrl === ConfigChange.typeUrl || typeof o.element === "string" && typeof o.old_value === "string" && typeof o.new_value === "string" && isSet(o.change_type) && Array.isArray(o.advices) && (!o.advices.length || Advice.isSDK(o.advices[0]))); + }, + isAmino(o: any): o is ConfigChangeAmino { + return o && (o.$typeUrl === ConfigChange.typeUrl || typeof o.element === "string" && typeof o.old_value === "string" && typeof o.new_value === "string" && isSet(o.change_type) && Array.isArray(o.advices) && (!o.advices.length || Advice.isAmino(o.advices[0]))); + }, encode(message: ConfigChange, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.element !== "") { writer.uint32(10).string(message.element); @@ -389,6 +399,12 @@ export const ConfigChange = { typeUrl: "/google.api.ConfigChange", value: ConfigChange.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ConfigChange.typeUrl)) { + return; + } + Advice.registerTypeUrl(); } }; function createBaseAdvice(): Advice { @@ -405,6 +421,15 @@ function createBaseAdvice(): Advice { */ export const Advice = { typeUrl: "/google.api.Advice", + is(o: any): o is Advice { + return o && (o.$typeUrl === Advice.typeUrl || typeof o.description === "string"); + }, + isSDK(o: any): o is AdviceSDKType { + return o && (o.$typeUrl === Advice.typeUrl || typeof o.description === "string"); + }, + isAmino(o: any): o is AdviceAmino { + return o && (o.$typeUrl === Advice.typeUrl || typeof o.description === "string"); + }, encode(message: Advice, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.description !== "") { writer.uint32(18).string(message.description); @@ -479,5 +504,6 @@ export const Advice = { typeUrl: "/google.api.Advice", value: Advice.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/google/api/consumer.ts b/__fixtures__/v-next/outputv2/google/api/consumer.ts index d854e7cef2..e1ae9fd810 100644 --- a/__fixtures__/v-next/outputv2/google/api/consumer.ts +++ b/__fixtures__/v-next/outputv2/google/api/consumer.ts @@ -1,6 +1,7 @@ import { BinaryReader, BinaryWriter } from "../../binary"; import { JsonSafe } from "../../json-safe"; import { DeepPartial, isSet } from "../../helpers"; +import { GlobalDecoderRegistry } from "../../registry"; export const protobufPackage = "google.api"; /** Supported data type of the property values */ export enum Property_PropertyType { @@ -258,6 +259,15 @@ function createBaseProjectProperties(): ProjectProperties { */ export const ProjectProperties = { typeUrl: "/google.api.ProjectProperties", + is(o: any): o is ProjectProperties { + return o && (o.$typeUrl === ProjectProperties.typeUrl || Array.isArray(o.properties) && (!o.properties.length || Property.is(o.properties[0]))); + }, + isSDK(o: any): o is ProjectPropertiesSDKType { + return o && (o.$typeUrl === ProjectProperties.typeUrl || Array.isArray(o.properties) && (!o.properties.length || Property.isSDK(o.properties[0]))); + }, + isAmino(o: any): o is ProjectPropertiesAmino { + return o && (o.$typeUrl === ProjectProperties.typeUrl || Array.isArray(o.properties) && (!o.properties.length || Property.isAmino(o.properties[0]))); + }, encode(message: ProjectProperties, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.properties) { Property.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -342,6 +352,12 @@ export const ProjectProperties = { typeUrl: "/google.api.ProjectProperties", value: ProjectProperties.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ProjectProperties.typeUrl)) { + return; + } + Property.registerTypeUrl(); } }; function createBaseProperty(): Property { @@ -368,6 +384,15 @@ function createBaseProperty(): Property { */ export const Property = { typeUrl: "/google.api.Property", + is(o: any): o is Property { + return o && (o.$typeUrl === Property.typeUrl || typeof o.name === "string" && isSet(o.type) && typeof o.description === "string"); + }, + isSDK(o: any): o is PropertySDKType { + return o && (o.$typeUrl === Property.typeUrl || typeof o.name === "string" && isSet(o.type) && typeof o.description === "string"); + }, + isAmino(o: any): o is PropertyAmino { + return o && (o.$typeUrl === Property.typeUrl || typeof o.name === "string" && isSet(o.type) && typeof o.description === "string"); + }, encode(message: Property, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -472,5 +497,6 @@ export const Property = { typeUrl: "/google.api.Property", value: Property.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/google/api/context.ts b/__fixtures__/v-next/outputv2/google/api/context.ts index 33564e4294..d01aa807ca 100644 --- a/__fixtures__/v-next/outputv2/google/api/context.ts +++ b/__fixtures__/v-next/outputv2/google/api/context.ts @@ -1,6 +1,7 @@ import { BinaryReader, BinaryWriter } from "../../binary"; import { JsonSafe } from "../../json-safe"; import { DeepPartial, isSet } from "../../helpers"; +import { GlobalDecoderRegistry } from "../../registry"; export const protobufPackage = "google.api"; /** * `Context` defines which contexts an API requests. @@ -288,6 +289,15 @@ function createBaseContext(): Context { */ export const Context = { typeUrl: "/google.api.Context", + is(o: any): o is Context { + return o && (o.$typeUrl === Context.typeUrl || Array.isArray(o.rules) && (!o.rules.length || ContextRule.is(o.rules[0]))); + }, + isSDK(o: any): o is ContextSDKType { + return o && (o.$typeUrl === Context.typeUrl || Array.isArray(o.rules) && (!o.rules.length || ContextRule.isSDK(o.rules[0]))); + }, + isAmino(o: any): o is ContextAmino { + return o && (o.$typeUrl === Context.typeUrl || Array.isArray(o.rules) && (!o.rules.length || ContextRule.isAmino(o.rules[0]))); + }, encode(message: Context, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.rules) { ContextRule.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -372,6 +382,12 @@ export const Context = { typeUrl: "/google.api.Context", value: Context.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Context.typeUrl)) { + return; + } + ContextRule.registerTypeUrl(); } }; function createBaseContextRule(): ContextRule { @@ -392,6 +408,15 @@ function createBaseContextRule(): ContextRule { */ export const ContextRule = { typeUrl: "/google.api.ContextRule", + is(o: any): o is ContextRule { + return o && (o.$typeUrl === ContextRule.typeUrl || typeof o.selector === "string" && Array.isArray(o.requested) && (!o.requested.length || typeof o.requested[0] === "string") && Array.isArray(o.provided) && (!o.provided.length || typeof o.provided[0] === "string") && Array.isArray(o.allowedRequestExtensions) && (!o.allowedRequestExtensions.length || typeof o.allowedRequestExtensions[0] === "string") && Array.isArray(o.allowedResponseExtensions) && (!o.allowedResponseExtensions.length || typeof o.allowedResponseExtensions[0] === "string")); + }, + isSDK(o: any): o is ContextRuleSDKType { + return o && (o.$typeUrl === ContextRule.typeUrl || typeof o.selector === "string" && Array.isArray(o.requested) && (!o.requested.length || typeof o.requested[0] === "string") && Array.isArray(o.provided) && (!o.provided.length || typeof o.provided[0] === "string") && Array.isArray(o.allowed_request_extensions) && (!o.allowed_request_extensions.length || typeof o.allowed_request_extensions[0] === "string") && Array.isArray(o.allowed_response_extensions) && (!o.allowed_response_extensions.length || typeof o.allowed_response_extensions[0] === "string")); + }, + isAmino(o: any): o is ContextRuleAmino { + return o && (o.$typeUrl === ContextRule.typeUrl || typeof o.selector === "string" && Array.isArray(o.requested) && (!o.requested.length || typeof o.requested[0] === "string") && Array.isArray(o.provided) && (!o.provided.length || typeof o.provided[0] === "string") && Array.isArray(o.allowed_request_extensions) && (!o.allowed_request_extensions.length || typeof o.allowed_request_extensions[0] === "string") && Array.isArray(o.allowed_response_extensions) && (!o.allowed_response_extensions.length || typeof o.allowed_response_extensions[0] === "string")); + }, encode(message: ContextRule, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.selector !== "") { writer.uint32(10).string(message.selector); @@ -566,5 +591,6 @@ export const ContextRule = { typeUrl: "/google.api.ContextRule", value: ContextRule.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/google/api/control.ts b/__fixtures__/v-next/outputv2/google/api/control.ts index 7eccbbaf78..eab3b40752 100644 --- a/__fixtures__/v-next/outputv2/google/api/control.ts +++ b/__fixtures__/v-next/outputv2/google/api/control.ts @@ -66,6 +66,15 @@ function createBaseControl(): Control { */ export const Control = { typeUrl: "/google.api.Control", + is(o: any): o is Control { + return o && (o.$typeUrl === Control.typeUrl || typeof o.environment === "string"); + }, + isSDK(o: any): o is ControlSDKType { + return o && (o.$typeUrl === Control.typeUrl || typeof o.environment === "string"); + }, + isAmino(o: any): o is ControlAmino { + return o && (o.$typeUrl === Control.typeUrl || typeof o.environment === "string"); + }, encode(message: Control, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.environment !== "") { writer.uint32(10).string(message.environment); @@ -140,5 +149,6 @@ export const Control = { typeUrl: "/google.api.Control", value: Control.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/google/api/distribution.ts b/__fixtures__/v-next/outputv2/google/api/distribution.ts index cae50a7341..715054c48d 100644 --- a/__fixtures__/v-next/outputv2/google/api/distribution.ts +++ b/__fixtures__/v-next/outputv2/google/api/distribution.ts @@ -1,6 +1,7 @@ import { Timestamp } from "../protobuf/timestamp"; import { Any, AnyAmino, AnySDKType } from "../protobuf/any"; import { BinaryReader, BinaryWriter } from "../../binary"; +import { GlobalDecoderRegistry } from "../../registry"; import { isSet, DeepPartial, toTimestamp, fromTimestamp } from "../../helpers"; import { JsonSafe } from "../../json-safe"; export const protobufPackage = "google.api"; @@ -705,6 +706,15 @@ function createBaseDistribution(): Distribution { */ export const Distribution = { typeUrl: "/google.api.Distribution", + is(o: any): o is Distribution { + return o && (o.$typeUrl === Distribution.typeUrl || typeof o.count === "bigint" && typeof o.mean === "number" && typeof o.sumOfSquaredDeviation === "number" && Array.isArray(o.bucketCounts) && (!o.bucketCounts.length || typeof o.bucketCounts[0] === "bigint") && Array.isArray(o.exemplars) && (!o.exemplars.length || Distribution_Exemplar.is(o.exemplars[0]))); + }, + isSDK(o: any): o is DistributionSDKType { + return o && (o.$typeUrl === Distribution.typeUrl || typeof o.count === "bigint" && typeof o.mean === "number" && typeof o.sum_of_squared_deviation === "number" && Array.isArray(o.bucket_counts) && (!o.bucket_counts.length || typeof o.bucket_counts[0] === "bigint") && Array.isArray(o.exemplars) && (!o.exemplars.length || Distribution_Exemplar.isSDK(o.exemplars[0]))); + }, + isAmino(o: any): o is DistributionAmino { + return o && (o.$typeUrl === Distribution.typeUrl || typeof o.count === "bigint" && typeof o.mean === "number" && typeof o.sum_of_squared_deviation === "number" && Array.isArray(o.bucket_counts) && (!o.bucket_counts.length || typeof o.bucket_counts[0] === "bigint") && Array.isArray(o.exemplars) && (!o.exemplars.length || Distribution_Exemplar.isAmino(o.exemplars[0]))); + }, encode(message: Distribution, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.count !== BigInt(0)) { writer.uint32(8).int64(message.count); @@ -904,6 +914,14 @@ export const Distribution = { typeUrl: "/google.api.Distribution", value: Distribution.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Distribution.typeUrl)) { + return; + } + Distribution_Range.registerTypeUrl(); + Distribution_BucketOptions.registerTypeUrl(); + Distribution_Exemplar.registerTypeUrl(); } }; function createBaseDistribution_Range(): Distribution_Range { @@ -920,6 +938,15 @@ function createBaseDistribution_Range(): Distribution_Range { */ export const Distribution_Range = { typeUrl: "/google.api.Range", + is(o: any): o is Distribution_Range { + return o && (o.$typeUrl === Distribution_Range.typeUrl || typeof o.min === "number" && typeof o.max === "number"); + }, + isSDK(o: any): o is Distribution_RangeSDKType { + return o && (o.$typeUrl === Distribution_Range.typeUrl || typeof o.min === "number" && typeof o.max === "number"); + }, + isAmino(o: any): o is Distribution_RangeAmino { + return o && (o.$typeUrl === Distribution_Range.typeUrl || typeof o.min === "number" && typeof o.max === "number"); + }, encode(message: Distribution_Range, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.min !== 0) { writer.uint32(9).double(message.min); @@ -1009,7 +1036,8 @@ export const Distribution_Range = { typeUrl: "/google.api.Range", value: Distribution_Range.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseDistribution_BucketOptions(): Distribution_BucketOptions { return { @@ -1040,6 +1068,15 @@ function createBaseDistribution_BucketOptions(): Distribution_BucketOptions { */ export const Distribution_BucketOptions = { typeUrl: "/google.api.BucketOptions", + is(o: any): o is Distribution_BucketOptions { + return o && o.$typeUrl === Distribution_BucketOptions.typeUrl; + }, + isSDK(o: any): o is Distribution_BucketOptionsSDKType { + return o && o.$typeUrl === Distribution_BucketOptions.typeUrl; + }, + isAmino(o: any): o is Distribution_BucketOptionsAmino { + return o && o.$typeUrl === Distribution_BucketOptions.typeUrl; + }, encode(message: Distribution_BucketOptions, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.linearBuckets !== undefined) { Distribution_BucketOptions_Linear.encode(message.linearBuckets, writer.uint32(10).fork()).ldelim(); @@ -1150,6 +1187,14 @@ export const Distribution_BucketOptions = { typeUrl: "/google.api.BucketOptions", value: Distribution_BucketOptions.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Distribution_BucketOptions.typeUrl)) { + return; + } + Distribution_BucketOptions_Linear.registerTypeUrl(); + Distribution_BucketOptions_Exponential.registerTypeUrl(); + Distribution_BucketOptions_Explicit.registerTypeUrl(); } }; function createBaseDistribution_BucketOptions_Linear(): Distribution_BucketOptions_Linear { @@ -1175,6 +1220,15 @@ function createBaseDistribution_BucketOptions_Linear(): Distribution_BucketOptio */ export const Distribution_BucketOptions_Linear = { typeUrl: "/google.api.Linear", + is(o: any): o is Distribution_BucketOptions_Linear { + return o && (o.$typeUrl === Distribution_BucketOptions_Linear.typeUrl || typeof o.numFiniteBuckets === "number" && typeof o.width === "number" && typeof o.offset === "number"); + }, + isSDK(o: any): o is Distribution_BucketOptions_LinearSDKType { + return o && (o.$typeUrl === Distribution_BucketOptions_Linear.typeUrl || typeof o.num_finite_buckets === "number" && typeof o.width === "number" && typeof o.offset === "number"); + }, + isAmino(o: any): o is Distribution_BucketOptions_LinearAmino { + return o && (o.$typeUrl === Distribution_BucketOptions_Linear.typeUrl || typeof o.num_finite_buckets === "number" && typeof o.width === "number" && typeof o.offset === "number"); + }, encode(message: Distribution_BucketOptions_Linear, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.numFiniteBuckets !== 0) { writer.uint32(8).int32(message.numFiniteBuckets); @@ -1279,7 +1333,8 @@ export const Distribution_BucketOptions_Linear = { typeUrl: "/google.api.Linear", value: Distribution_BucketOptions_Linear.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseDistribution_BucketOptions_Exponential(): Distribution_BucketOptions_Exponential { return { @@ -1304,6 +1359,15 @@ function createBaseDistribution_BucketOptions_Exponential(): Distribution_Bucket */ export const Distribution_BucketOptions_Exponential = { typeUrl: "/google.api.Exponential", + is(o: any): o is Distribution_BucketOptions_Exponential { + return o && (o.$typeUrl === Distribution_BucketOptions_Exponential.typeUrl || typeof o.numFiniteBuckets === "number" && typeof o.growthFactor === "number" && typeof o.scale === "number"); + }, + isSDK(o: any): o is Distribution_BucketOptions_ExponentialSDKType { + return o && (o.$typeUrl === Distribution_BucketOptions_Exponential.typeUrl || typeof o.num_finite_buckets === "number" && typeof o.growth_factor === "number" && typeof o.scale === "number"); + }, + isAmino(o: any): o is Distribution_BucketOptions_ExponentialAmino { + return o && (o.$typeUrl === Distribution_BucketOptions_Exponential.typeUrl || typeof o.num_finite_buckets === "number" && typeof o.growth_factor === "number" && typeof o.scale === "number"); + }, encode(message: Distribution_BucketOptions_Exponential, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.numFiniteBuckets !== 0) { writer.uint32(8).int32(message.numFiniteBuckets); @@ -1408,7 +1472,8 @@ export const Distribution_BucketOptions_Exponential = { typeUrl: "/google.api.Exponential", value: Distribution_BucketOptions_Exponential.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseDistribution_BucketOptions_Explicit(): Distribution_BucketOptions_Explicit { return { @@ -1433,6 +1498,15 @@ function createBaseDistribution_BucketOptions_Explicit(): Distribution_BucketOpt */ export const Distribution_BucketOptions_Explicit = { typeUrl: "/google.api.Explicit", + is(o: any): o is Distribution_BucketOptions_Explicit { + return o && (o.$typeUrl === Distribution_BucketOptions_Explicit.typeUrl || Array.isArray(o.bounds) && (!o.bounds.length || typeof o.bounds[0] === "number")); + }, + isSDK(o: any): o is Distribution_BucketOptions_ExplicitSDKType { + return o && (o.$typeUrl === Distribution_BucketOptions_Explicit.typeUrl || Array.isArray(o.bounds) && (!o.bounds.length || typeof o.bounds[0] === "number")); + }, + isAmino(o: any): o is Distribution_BucketOptions_ExplicitAmino { + return o && (o.$typeUrl === Distribution_BucketOptions_Explicit.typeUrl || Array.isArray(o.bounds) && (!o.bounds.length || typeof o.bounds[0] === "number")); + }, encode(message: Distribution_BucketOptions_Explicit, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { writer.uint32(10).fork(); for (const v of message.bounds) { @@ -1526,7 +1600,8 @@ export const Distribution_BucketOptions_Explicit = { typeUrl: "/google.api.Explicit", value: Distribution_BucketOptions_Explicit.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseDistribution_Exemplar(): Distribution_Exemplar { return { @@ -1547,6 +1622,15 @@ function createBaseDistribution_Exemplar(): Distribution_Exemplar { */ export const Distribution_Exemplar = { typeUrl: "/google.api.Exemplar", + is(o: any): o is Distribution_Exemplar { + return o && (o.$typeUrl === Distribution_Exemplar.typeUrl || typeof o.value === "number" && Array.isArray(o.attachments) && (!o.attachments.length || Any.is(o.attachments[0]))); + }, + isSDK(o: any): o is Distribution_ExemplarSDKType { + return o && (o.$typeUrl === Distribution_Exemplar.typeUrl || typeof o.value === "number" && Array.isArray(o.attachments) && (!o.attachments.length || Any.isSDK(o.attachments[0]))); + }, + isAmino(o: any): o is Distribution_ExemplarAmino { + return o && (o.$typeUrl === Distribution_Exemplar.typeUrl || typeof o.value === "number" && Array.isArray(o.attachments) && (!o.attachments.length || Any.isAmino(o.attachments[0]))); + }, encode(message: Distribution_Exemplar, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.value !== 0) { writer.uint32(9).double(message.value); @@ -1661,5 +1745,6 @@ export const Distribution_Exemplar = { typeUrl: "/google.api.Exemplar", value: Distribution_Exemplar.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/google/api/documentation.ts b/__fixtures__/v-next/outputv2/google/api/documentation.ts index 3796408e08..b2ed629c21 100644 --- a/__fixtures__/v-next/outputv2/google/api/documentation.ts +++ b/__fixtures__/v-next/outputv2/google/api/documentation.ts @@ -1,6 +1,7 @@ import { BinaryReader, BinaryWriter } from "../../binary"; import { isSet, DeepPartial } from "../../helpers"; import { JsonSafe } from "../../json-safe"; +import { GlobalDecoderRegistry } from "../../registry"; export const protobufPackage = "google.api"; /** * `Documentation` provides the information for describing a service. @@ -521,6 +522,15 @@ function createBaseDocumentation(): Documentation { */ export const Documentation = { typeUrl: "/google.api.Documentation", + is(o: any): o is Documentation { + return o && (o.$typeUrl === Documentation.typeUrl || typeof o.summary === "string" && Array.isArray(o.pages) && (!o.pages.length || Page.is(o.pages[0])) && Array.isArray(o.rules) && (!o.rules.length || DocumentationRule.is(o.rules[0])) && typeof o.documentationRootUrl === "string" && typeof o.serviceRootUrl === "string" && typeof o.overview === "string"); + }, + isSDK(o: any): o is DocumentationSDKType { + return o && (o.$typeUrl === Documentation.typeUrl || typeof o.summary === "string" && Array.isArray(o.pages) && (!o.pages.length || Page.isSDK(o.pages[0])) && Array.isArray(o.rules) && (!o.rules.length || DocumentationRule.isSDK(o.rules[0])) && typeof o.documentation_root_url === "string" && typeof o.service_root_url === "string" && typeof o.overview === "string"); + }, + isAmino(o: any): o is DocumentationAmino { + return o && (o.$typeUrl === Documentation.typeUrl || typeof o.summary === "string" && Array.isArray(o.pages) && (!o.pages.length || Page.isAmino(o.pages[0])) && Array.isArray(o.rules) && (!o.rules.length || DocumentationRule.isAmino(o.rules[0])) && typeof o.documentation_root_url === "string" && typeof o.service_root_url === "string" && typeof o.overview === "string"); + }, encode(message: Documentation, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.summary !== "") { writer.uint32(10).string(message.summary); @@ -690,6 +700,13 @@ export const Documentation = { typeUrl: "/google.api.Documentation", value: Documentation.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Documentation.typeUrl)) { + return; + } + Page.registerTypeUrl(); + DocumentationRule.registerTypeUrl(); } }; function createBaseDocumentationRule(): DocumentationRule { @@ -707,6 +724,15 @@ function createBaseDocumentationRule(): DocumentationRule { */ export const DocumentationRule = { typeUrl: "/google.api.DocumentationRule", + is(o: any): o is DocumentationRule { + return o && (o.$typeUrl === DocumentationRule.typeUrl || typeof o.selector === "string" && typeof o.description === "string" && typeof o.deprecationDescription === "string"); + }, + isSDK(o: any): o is DocumentationRuleSDKType { + return o && (o.$typeUrl === DocumentationRule.typeUrl || typeof o.selector === "string" && typeof o.description === "string" && typeof o.deprecation_description === "string"); + }, + isAmino(o: any): o is DocumentationRuleAmino { + return o && (o.$typeUrl === DocumentationRule.typeUrl || typeof o.selector === "string" && typeof o.description === "string" && typeof o.deprecation_description === "string"); + }, encode(message: DocumentationRule, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.selector !== "") { writer.uint32(10).string(message.selector); @@ -811,7 +837,8 @@ export const DocumentationRule = { typeUrl: "/google.api.DocumentationRule", value: DocumentationRule.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBasePage(): Page { return { @@ -829,6 +856,15 @@ function createBasePage(): Page { */ export const Page = { typeUrl: "/google.api.Page", + is(o: any): o is Page { + return o && (o.$typeUrl === Page.typeUrl || typeof o.name === "string" && typeof o.content === "string" && Array.isArray(o.subpages) && (!o.subpages.length || Page.is(o.subpages[0]))); + }, + isSDK(o: any): o is PageSDKType { + return o && (o.$typeUrl === Page.typeUrl || typeof o.name === "string" && typeof o.content === "string" && Array.isArray(o.subpages) && (!o.subpages.length || Page.isSDK(o.subpages[0]))); + }, + isAmino(o: any): o is PageAmino { + return o && (o.$typeUrl === Page.typeUrl || typeof o.name === "string" && typeof o.content === "string" && Array.isArray(o.subpages) && (!o.subpages.length || Page.isAmino(o.subpages[0]))); + }, encode(message: Page, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -943,5 +979,11 @@ export const Page = { typeUrl: "/google.api.Page", value: Page.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Page.typeUrl)) { + return; + } + Page.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/google/api/endpoint.ts b/__fixtures__/v-next/outputv2/google/api/endpoint.ts index 7f201a2485..ff0905e80b 100644 --- a/__fixtures__/v-next/outputv2/google/api/endpoint.ts +++ b/__fixtures__/v-next/outputv2/google/api/endpoint.ts @@ -181,6 +181,15 @@ function createBaseEndpoint(): Endpoint { */ export const Endpoint = { typeUrl: "/google.api.Endpoint", + is(o: any): o is Endpoint { + return o && (o.$typeUrl === Endpoint.typeUrl || typeof o.name === "string" && Array.isArray(o.aliases) && (!o.aliases.length || typeof o.aliases[0] === "string") && typeof o.target === "string" && typeof o.allowCors === "boolean"); + }, + isSDK(o: any): o is EndpointSDKType { + return o && (o.$typeUrl === Endpoint.typeUrl || typeof o.name === "string" && Array.isArray(o.aliases) && (!o.aliases.length || typeof o.aliases[0] === "string") && typeof o.target === "string" && typeof o.allow_cors === "boolean"); + }, + isAmino(o: any): o is EndpointAmino { + return o && (o.$typeUrl === Endpoint.typeUrl || typeof o.name === "string" && Array.isArray(o.aliases) && (!o.aliases.length || typeof o.aliases[0] === "string") && typeof o.target === "string" && typeof o.allow_cors === "boolean"); + }, encode(message: Endpoint, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -310,5 +319,6 @@ export const Endpoint = { typeUrl: "/google.api.Endpoint", value: Endpoint.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/google/api/expr/conformance/v1alpha1/conformance_service.ts b/__fixtures__/v-next/outputv2/google/api/expr/conformance/v1alpha1/conformance_service.ts index f638623676..e1d474f242 100644 --- a/__fixtures__/v-next/outputv2/google/api/expr/conformance/v1alpha1/conformance_service.ts +++ b/__fixtures__/v-next/outputv2/google/api/expr/conformance/v1alpha1/conformance_service.ts @@ -5,6 +5,7 @@ import { Status, StatusAmino, StatusSDKType } from "../../../../rpc/status"; import { BinaryReader, BinaryWriter } from "../../../../../binary"; import { isSet, DeepPartial, isObject } from "../../../../../helpers"; import { JsonSafe } from "../../../../../json-safe"; +import { GlobalDecoderRegistry } from "../../../../../registry"; export const protobufPackage = "google.api.expr.conformance.v1alpha1"; /** Severities of issues. */ export enum IssueDetails_Severity { @@ -552,6 +553,15 @@ function createBaseParseRequest(): ParseRequest { */ export const ParseRequest = { typeUrl: "/google.api.expr.conformance.v1alpha1.ParseRequest", + is(o: any): o is ParseRequest { + return o && (o.$typeUrl === ParseRequest.typeUrl || typeof o.celSource === "string" && typeof o.syntaxVersion === "string" && typeof o.sourceLocation === "string" && typeof o.disableMacros === "boolean"); + }, + isSDK(o: any): o is ParseRequestSDKType { + return o && (o.$typeUrl === ParseRequest.typeUrl || typeof o.cel_source === "string" && typeof o.syntax_version === "string" && typeof o.source_location === "string" && typeof o.disable_macros === "boolean"); + }, + isAmino(o: any): o is ParseRequestAmino { + return o && (o.$typeUrl === ParseRequest.typeUrl || typeof o.cel_source === "string" && typeof o.syntax_version === "string" && typeof o.source_location === "string" && typeof o.disable_macros === "boolean"); + }, encode(message: ParseRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.celSource !== "") { writer.uint32(10).string(message.celSource); @@ -671,7 +681,8 @@ export const ParseRequest = { typeUrl: "/google.api.expr.conformance.v1alpha1.ParseRequest", value: ParseRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseParseResponse(): ParseResponse { return { @@ -687,6 +698,15 @@ function createBaseParseResponse(): ParseResponse { */ export const ParseResponse = { typeUrl: "/google.api.expr.conformance.v1alpha1.ParseResponse", + is(o: any): o is ParseResponse { + return o && (o.$typeUrl === ParseResponse.typeUrl || Array.isArray(o.issues) && (!o.issues.length || Status.is(o.issues[0]))); + }, + isSDK(o: any): o is ParseResponseSDKType { + return o && (o.$typeUrl === ParseResponse.typeUrl || Array.isArray(o.issues) && (!o.issues.length || Status.isSDK(o.issues[0]))); + }, + isAmino(o: any): o is ParseResponseAmino { + return o && (o.$typeUrl === ParseResponse.typeUrl || Array.isArray(o.issues) && (!o.issues.length || Status.isAmino(o.issues[0]))); + }, encode(message: ParseResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.parsedExpr !== undefined) { ParsedExpr.encode(message.parsedExpr, writer.uint32(10).fork()).ldelim(); @@ -788,6 +808,13 @@ export const ParseResponse = { typeUrl: "/google.api.expr.conformance.v1alpha1.ParseResponse", value: ParseResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ParseResponse.typeUrl)) { + return; + } + ParsedExpr.registerTypeUrl(); + Status.registerTypeUrl(); } }; function createBaseCheckRequest(): CheckRequest { @@ -806,6 +833,15 @@ function createBaseCheckRequest(): CheckRequest { */ export const CheckRequest = { typeUrl: "/google.api.expr.conformance.v1alpha1.CheckRequest", + is(o: any): o is CheckRequest { + return o && (o.$typeUrl === CheckRequest.typeUrl || Array.isArray(o.typeEnv) && (!o.typeEnv.length || Decl.is(o.typeEnv[0])) && typeof o.container === "string" && typeof o.noStdEnv === "boolean"); + }, + isSDK(o: any): o is CheckRequestSDKType { + return o && (o.$typeUrl === CheckRequest.typeUrl || Array.isArray(o.type_env) && (!o.type_env.length || Decl.isSDK(o.type_env[0])) && typeof o.container === "string" && typeof o.no_std_env === "boolean"); + }, + isAmino(o: any): o is CheckRequestAmino { + return o && (o.$typeUrl === CheckRequest.typeUrl || Array.isArray(o.type_env) && (!o.type_env.length || Decl.isAmino(o.type_env[0])) && typeof o.container === "string" && typeof o.no_std_env === "boolean"); + }, encode(message: CheckRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.parsedExpr !== undefined) { ParsedExpr.encode(message.parsedExpr, writer.uint32(10).fork()).ldelim(); @@ -937,6 +973,13 @@ export const CheckRequest = { typeUrl: "/google.api.expr.conformance.v1alpha1.CheckRequest", value: CheckRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(CheckRequest.typeUrl)) { + return; + } + ParsedExpr.registerTypeUrl(); + Decl.registerTypeUrl(); } }; function createBaseCheckResponse(): CheckResponse { @@ -953,6 +996,15 @@ function createBaseCheckResponse(): CheckResponse { */ export const CheckResponse = { typeUrl: "/google.api.expr.conformance.v1alpha1.CheckResponse", + is(o: any): o is CheckResponse { + return o && (o.$typeUrl === CheckResponse.typeUrl || Array.isArray(o.issues) && (!o.issues.length || Status.is(o.issues[0]))); + }, + isSDK(o: any): o is CheckResponseSDKType { + return o && (o.$typeUrl === CheckResponse.typeUrl || Array.isArray(o.issues) && (!o.issues.length || Status.isSDK(o.issues[0]))); + }, + isAmino(o: any): o is CheckResponseAmino { + return o && (o.$typeUrl === CheckResponse.typeUrl || Array.isArray(o.issues) && (!o.issues.length || Status.isAmino(o.issues[0]))); + }, encode(message: CheckResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.checkedExpr !== undefined) { CheckedExpr.encode(message.checkedExpr, writer.uint32(10).fork()).ldelim(); @@ -1054,6 +1106,13 @@ export const CheckResponse = { typeUrl: "/google.api.expr.conformance.v1alpha1.CheckResponse", value: CheckResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(CheckResponse.typeUrl)) { + return; + } + CheckedExpr.registerTypeUrl(); + Status.registerTypeUrl(); } }; function createBaseEvalRequest_BindingsEntry(): EvalRequest_BindingsEntry { @@ -1153,6 +1212,9 @@ export const EvalRequest_BindingsEntry = { }, toProto(message: EvalRequest_BindingsEntry): Uint8Array { return EvalRequest_BindingsEntry.encode(message).finish(); + }, + registerTypeUrl() { + ExprValue.registerTypeUrl(); } }; function createBaseEvalRequest(): EvalRequest { @@ -1171,6 +1233,15 @@ function createBaseEvalRequest(): EvalRequest { */ export const EvalRequest = { typeUrl: "/google.api.expr.conformance.v1alpha1.EvalRequest", + is(o: any): o is EvalRequest { + return o && (o.$typeUrl === EvalRequest.typeUrl || isSet(o.bindings) && typeof o.container === "string"); + }, + isSDK(o: any): o is EvalRequestSDKType { + return o && (o.$typeUrl === EvalRequest.typeUrl || isSet(o.bindings) && typeof o.container === "string"); + }, + isAmino(o: any): o is EvalRequestAmino { + return o && (o.$typeUrl === EvalRequest.typeUrl || isSet(o.bindings) && typeof o.container === "string"); + }, encode(message: EvalRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.parsedExpr !== undefined) { ParsedExpr.encode(message.parsedExpr, writer.uint32(10).fork()).ldelim(); @@ -1337,6 +1408,14 @@ export const EvalRequest = { typeUrl: "/google.api.expr.conformance.v1alpha1.EvalRequest", value: EvalRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(EvalRequest.typeUrl)) { + return; + } + ParsedExpr.registerTypeUrl(); + CheckedExpr.registerTypeUrl(); + ExprValue.registerTypeUrl(); } }; function createBaseEvalResponse(): EvalResponse { @@ -1353,6 +1432,15 @@ function createBaseEvalResponse(): EvalResponse { */ export const EvalResponse = { typeUrl: "/google.api.expr.conformance.v1alpha1.EvalResponse", + is(o: any): o is EvalResponse { + return o && (o.$typeUrl === EvalResponse.typeUrl || Array.isArray(o.issues) && (!o.issues.length || Status.is(o.issues[0]))); + }, + isSDK(o: any): o is EvalResponseSDKType { + return o && (o.$typeUrl === EvalResponse.typeUrl || Array.isArray(o.issues) && (!o.issues.length || Status.isSDK(o.issues[0]))); + }, + isAmino(o: any): o is EvalResponseAmino { + return o && (o.$typeUrl === EvalResponse.typeUrl || Array.isArray(o.issues) && (!o.issues.length || Status.isAmino(o.issues[0]))); + }, encode(message: EvalResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.result !== undefined) { ExprValue.encode(message.result, writer.uint32(10).fork()).ldelim(); @@ -1454,6 +1542,13 @@ export const EvalResponse = { typeUrl: "/google.api.expr.conformance.v1alpha1.EvalResponse", value: EvalResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(EvalResponse.typeUrl)) { + return; + } + ExprValue.registerTypeUrl(); + Status.registerTypeUrl(); } }; function createBaseIssueDetails(): IssueDetails { @@ -1473,6 +1568,15 @@ function createBaseIssueDetails(): IssueDetails { */ export const IssueDetails = { typeUrl: "/google.api.expr.conformance.v1alpha1.IssueDetails", + is(o: any): o is IssueDetails { + return o && (o.$typeUrl === IssueDetails.typeUrl || isSet(o.severity) && typeof o.id === "bigint"); + }, + isSDK(o: any): o is IssueDetailsSDKType { + return o && (o.$typeUrl === IssueDetails.typeUrl || isSet(o.severity) && typeof o.id === "bigint"); + }, + isAmino(o: any): o is IssueDetailsAmino { + return o && (o.$typeUrl === IssueDetails.typeUrl || isSet(o.severity) && typeof o.id === "bigint"); + }, encode(message: IssueDetails, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.severity !== 0) { writer.uint32(8).int32(message.severity); @@ -1581,5 +1685,11 @@ export const IssueDetails = { typeUrl: "/google.api.expr.conformance.v1alpha1.IssueDetails", value: IssueDetails.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(IssueDetails.typeUrl)) { + return; + } + SourcePosition.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/google/api/expr/v1alpha1/checked.ts b/__fixtures__/v-next/outputv2/google/api/expr/v1alpha1/checked.ts index aed55287eb..63f51f26c1 100644 --- a/__fixtures__/v-next/outputv2/google/api/expr/v1alpha1/checked.ts +++ b/__fixtures__/v-next/outputv2/google/api/expr/v1alpha1/checked.ts @@ -2,6 +2,7 @@ import { SourceInfo, SourceInfoAmino, SourceInfoSDKType, Expr, ExprAmino, ExprSD import { Empty, EmptyAmino, EmptySDKType } from "../../../protobuf/empty"; import { NullValue, nullValueFromJSON, nullValueToJSON } from "../../../protobuf/struct"; import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { GlobalDecoderRegistry } from "../../../../registry"; import { isSet, DeepPartial, isObject } from "../../../../helpers"; import { JsonSafe } from "../../../../json-safe"; export const protobufPackage = "google.api.expr.v1alpha1"; @@ -1261,6 +1262,9 @@ export const CheckedExpr_ReferenceMapEntry = { }, toProto(message: CheckedExpr_ReferenceMapEntry): Uint8Array { return CheckedExpr_ReferenceMapEntry.encode(message).finish(); + }, + registerTypeUrl() { + Reference.registerTypeUrl(); } }; function createBaseCheckedExpr_TypeMapEntry(): CheckedExpr_TypeMapEntry { @@ -1362,6 +1366,9 @@ export const CheckedExpr_TypeMapEntry = { }, toProto(message: CheckedExpr_TypeMapEntry): Uint8Array { return CheckedExpr_TypeMapEntry.encode(message).finish(); + }, + registerTypeUrl() { + Type.registerTypeUrl(); } }; function createBaseCheckedExpr(): CheckedExpr { @@ -1381,6 +1388,15 @@ function createBaseCheckedExpr(): CheckedExpr { */ export const CheckedExpr = { typeUrl: "/google.api.expr.v1alpha1.CheckedExpr", + is(o: any): o is CheckedExpr { + return o && (o.$typeUrl === CheckedExpr.typeUrl || isSet(o.referenceMap) && isSet(o.typeMap) && typeof o.exprVersion === "string"); + }, + isSDK(o: any): o is CheckedExprSDKType { + return o && (o.$typeUrl === CheckedExpr.typeUrl || isSet(o.reference_map) && isSet(o.type_map) && typeof o.expr_version === "string"); + }, + isAmino(o: any): o is CheckedExprAmino { + return o && (o.$typeUrl === CheckedExpr.typeUrl || isSet(o.reference_map) && isSet(o.type_map) && typeof o.expr_version === "string"); + }, encode(message: CheckedExpr, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { Object.entries(message.referenceMap).forEach(([key, value]) => { CheckedExpr_ReferenceMapEntry.encode({ @@ -1605,6 +1621,15 @@ export const CheckedExpr = { typeUrl: "/google.api.expr.v1alpha1.CheckedExpr", value: CheckedExpr.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(CheckedExpr.typeUrl)) { + return; + } + Reference.registerTypeUrl(); + Type.registerTypeUrl(); + SourceInfo.registerTypeUrl(); + Expr.registerTypeUrl(); } }; function createBaseType(): Type { @@ -1632,6 +1657,15 @@ function createBaseType(): Type { */ export const Type = { typeUrl: "/google.api.expr.v1alpha1.Type", + is(o: any): o is Type { + return o && o.$typeUrl === Type.typeUrl; + }, + isSDK(o: any): o is TypeSDKType { + return o && o.$typeUrl === Type.typeUrl; + }, + isAmino(o: any): o is TypeAmino { + return o && o.$typeUrl === Type.typeUrl; + }, encode(message: Type, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.dyn !== undefined) { Empty.encode(message.dyn, writer.uint32(10).fork()).ldelim(); @@ -1900,6 +1934,17 @@ export const Type = { typeUrl: "/google.api.expr.v1alpha1.Type", value: Type.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Type.typeUrl)) { + return; + } + Empty.registerTypeUrl(); + Type_ListType.registerTypeUrl(); + Type_MapType.registerTypeUrl(); + Type_FunctionType.registerTypeUrl(); + Type.registerTypeUrl(); + Type_AbstractType.registerTypeUrl(); } }; function createBaseType_ListType(): Type_ListType { @@ -1915,6 +1960,15 @@ function createBaseType_ListType(): Type_ListType { */ export const Type_ListType = { typeUrl: "/google.api.expr.v1alpha1.ListType", + is(o: any): o is Type_ListType { + return o && o.$typeUrl === Type_ListType.typeUrl; + }, + isSDK(o: any): o is Type_ListTypeSDKType { + return o && o.$typeUrl === Type_ListType.typeUrl; + }, + isAmino(o: any): o is Type_ListTypeAmino { + return o && o.$typeUrl === Type_ListType.typeUrl; + }, encode(message: Type_ListType, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.elemType !== undefined) { Type.encode(message.elemType, writer.uint32(10).fork()).ldelim(); @@ -1991,6 +2045,12 @@ export const Type_ListType = { typeUrl: "/google.api.expr.v1alpha1.ListType", value: Type_ListType.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Type_ListType.typeUrl)) { + return; + } + Type.registerTypeUrl(); } }; function createBaseType_MapType(): Type_MapType { @@ -2007,6 +2067,15 @@ function createBaseType_MapType(): Type_MapType { */ export const Type_MapType = { typeUrl: "/google.api.expr.v1alpha1.MapType", + is(o: any): o is Type_MapType { + return o && o.$typeUrl === Type_MapType.typeUrl; + }, + isSDK(o: any): o is Type_MapTypeSDKType { + return o && o.$typeUrl === Type_MapType.typeUrl; + }, + isAmino(o: any): o is Type_MapTypeAmino { + return o && o.$typeUrl === Type_MapType.typeUrl; + }, encode(message: Type_MapType, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.keyType !== undefined) { Type.encode(message.keyType, writer.uint32(10).fork()).ldelim(); @@ -2100,6 +2169,12 @@ export const Type_MapType = { typeUrl: "/google.api.expr.v1alpha1.MapType", value: Type_MapType.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Type_MapType.typeUrl)) { + return; + } + Type.registerTypeUrl(); } }; function createBaseType_FunctionType(): Type_FunctionType { @@ -2116,6 +2191,15 @@ function createBaseType_FunctionType(): Type_FunctionType { */ export const Type_FunctionType = { typeUrl: "/google.api.expr.v1alpha1.FunctionType", + is(o: any): o is Type_FunctionType { + return o && (o.$typeUrl === Type_FunctionType.typeUrl || Array.isArray(o.argTypes) && (!o.argTypes.length || Type.is(o.argTypes[0]))); + }, + isSDK(o: any): o is Type_FunctionTypeSDKType { + return o && (o.$typeUrl === Type_FunctionType.typeUrl || Array.isArray(o.arg_types) && (!o.arg_types.length || Type.isSDK(o.arg_types[0]))); + }, + isAmino(o: any): o is Type_FunctionTypeAmino { + return o && (o.$typeUrl === Type_FunctionType.typeUrl || Array.isArray(o.arg_types) && (!o.arg_types.length || Type.isAmino(o.arg_types[0]))); + }, encode(message: Type_FunctionType, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.resultType !== undefined) { Type.encode(message.resultType, writer.uint32(10).fork()).ldelim(); @@ -2217,6 +2301,12 @@ export const Type_FunctionType = { typeUrl: "/google.api.expr.v1alpha1.FunctionType", value: Type_FunctionType.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Type_FunctionType.typeUrl)) { + return; + } + Type.registerTypeUrl(); } }; function createBaseType_AbstractType(): Type_AbstractType { @@ -2233,6 +2323,15 @@ function createBaseType_AbstractType(): Type_AbstractType { */ export const Type_AbstractType = { typeUrl: "/google.api.expr.v1alpha1.AbstractType", + is(o: any): o is Type_AbstractType { + return o && (o.$typeUrl === Type_AbstractType.typeUrl || typeof o.name === "string" && Array.isArray(o.parameterTypes) && (!o.parameterTypes.length || Type.is(o.parameterTypes[0]))); + }, + isSDK(o: any): o is Type_AbstractTypeSDKType { + return o && (o.$typeUrl === Type_AbstractType.typeUrl || typeof o.name === "string" && Array.isArray(o.parameter_types) && (!o.parameter_types.length || Type.isSDK(o.parameter_types[0]))); + }, + isAmino(o: any): o is Type_AbstractTypeAmino { + return o && (o.$typeUrl === Type_AbstractType.typeUrl || typeof o.name === "string" && Array.isArray(o.parameter_types) && (!o.parameter_types.length || Type.isAmino(o.parameter_types[0]))); + }, encode(message: Type_AbstractType, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -2332,6 +2431,12 @@ export const Type_AbstractType = { typeUrl: "/google.api.expr.v1alpha1.AbstractType", value: Type_AbstractType.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Type_AbstractType.typeUrl)) { + return; + } + Type.registerTypeUrl(); } }; function createBaseDecl(): Decl { @@ -2352,6 +2457,15 @@ function createBaseDecl(): Decl { */ export const Decl = { typeUrl: "/google.api.expr.v1alpha1.Decl", + is(o: any): o is Decl { + return o && (o.$typeUrl === Decl.typeUrl || typeof o.name === "string"); + }, + isSDK(o: any): o is DeclSDKType { + return o && (o.$typeUrl === Decl.typeUrl || typeof o.name === "string"); + }, + isAmino(o: any): o is DeclAmino { + return o && (o.$typeUrl === Decl.typeUrl || typeof o.name === "string"); + }, encode(message: Decl, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -2460,6 +2574,13 @@ export const Decl = { typeUrl: "/google.api.expr.v1alpha1.Decl", value: Decl.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Decl.typeUrl)) { + return; + } + Decl_IdentDecl.registerTypeUrl(); + Decl_FunctionDecl.registerTypeUrl(); } }; function createBaseDecl_IdentDecl(): Decl_IdentDecl { @@ -2482,6 +2603,15 @@ function createBaseDecl_IdentDecl(): Decl_IdentDecl { */ export const Decl_IdentDecl = { typeUrl: "/google.api.expr.v1alpha1.IdentDecl", + is(o: any): o is Decl_IdentDecl { + return o && (o.$typeUrl === Decl_IdentDecl.typeUrl || typeof o.doc === "string"); + }, + isSDK(o: any): o is Decl_IdentDeclSDKType { + return o && (o.$typeUrl === Decl_IdentDecl.typeUrl || typeof o.doc === "string"); + }, + isAmino(o: any): o is Decl_IdentDeclAmino { + return o && (o.$typeUrl === Decl_IdentDecl.typeUrl || typeof o.doc === "string"); + }, encode(message: Decl_IdentDecl, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.type !== undefined) { Type.encode(message.type, writer.uint32(10).fork()).ldelim(); @@ -2590,6 +2720,13 @@ export const Decl_IdentDecl = { typeUrl: "/google.api.expr.v1alpha1.IdentDecl", value: Decl_IdentDecl.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Decl_IdentDecl.typeUrl)) { + return; + } + Type.registerTypeUrl(); + Constant.registerTypeUrl(); } }; function createBaseDecl_FunctionDecl(): Decl_FunctionDecl { @@ -2609,6 +2746,15 @@ function createBaseDecl_FunctionDecl(): Decl_FunctionDecl { */ export const Decl_FunctionDecl = { typeUrl: "/google.api.expr.v1alpha1.FunctionDecl", + is(o: any): o is Decl_FunctionDecl { + return o && (o.$typeUrl === Decl_FunctionDecl.typeUrl || Array.isArray(o.overloads) && (!o.overloads.length || Decl_FunctionDecl_Overload.is(o.overloads[0]))); + }, + isSDK(o: any): o is Decl_FunctionDeclSDKType { + return o && (o.$typeUrl === Decl_FunctionDecl.typeUrl || Array.isArray(o.overloads) && (!o.overloads.length || Decl_FunctionDecl_Overload.isSDK(o.overloads[0]))); + }, + isAmino(o: any): o is Decl_FunctionDeclAmino { + return o && (o.$typeUrl === Decl_FunctionDecl.typeUrl || Array.isArray(o.overloads) && (!o.overloads.length || Decl_FunctionDecl_Overload.isAmino(o.overloads[0]))); + }, encode(message: Decl_FunctionDecl, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.overloads) { Decl_FunctionDecl_Overload.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -2693,6 +2839,12 @@ export const Decl_FunctionDecl = { typeUrl: "/google.api.expr.v1alpha1.FunctionDecl", value: Decl_FunctionDecl.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Decl_FunctionDecl.typeUrl)) { + return; + } + Decl_FunctionDecl_Overload.registerTypeUrl(); } }; function createBaseDecl_FunctionDecl_Overload(): Decl_FunctionDecl_Overload { @@ -2722,6 +2874,15 @@ function createBaseDecl_FunctionDecl_Overload(): Decl_FunctionDecl_Overload { */ export const Decl_FunctionDecl_Overload = { typeUrl: "/google.api.expr.v1alpha1.Overload", + is(o: any): o is Decl_FunctionDecl_Overload { + return o && (o.$typeUrl === Decl_FunctionDecl_Overload.typeUrl || typeof o.overloadId === "string" && Array.isArray(o.params) && (!o.params.length || Type.is(o.params[0])) && Array.isArray(o.typeParams) && (!o.typeParams.length || typeof o.typeParams[0] === "string") && typeof o.isInstanceFunction === "boolean" && typeof o.doc === "string"); + }, + isSDK(o: any): o is Decl_FunctionDecl_OverloadSDKType { + return o && (o.$typeUrl === Decl_FunctionDecl_Overload.typeUrl || typeof o.overload_id === "string" && Array.isArray(o.params) && (!o.params.length || Type.isSDK(o.params[0])) && Array.isArray(o.type_params) && (!o.type_params.length || typeof o.type_params[0] === "string") && typeof o.is_instance_function === "boolean" && typeof o.doc === "string"); + }, + isAmino(o: any): o is Decl_FunctionDecl_OverloadAmino { + return o && (o.$typeUrl === Decl_FunctionDecl_Overload.typeUrl || typeof o.overload_id === "string" && Array.isArray(o.params) && (!o.params.length || Type.isAmino(o.params[0])) && Array.isArray(o.type_params) && (!o.type_params.length || typeof o.type_params[0] === "string") && typeof o.is_instance_function === "boolean" && typeof o.doc === "string"); + }, encode(message: Decl_FunctionDecl_Overload, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.overloadId !== "") { writer.uint32(10).string(message.overloadId); @@ -2893,6 +3054,12 @@ export const Decl_FunctionDecl_Overload = { typeUrl: "/google.api.expr.v1alpha1.Overload", value: Decl_FunctionDecl_Overload.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Decl_FunctionDecl_Overload.typeUrl)) { + return; + } + Type.registerTypeUrl(); } }; function createBaseReference(): Reference { @@ -2910,6 +3077,15 @@ function createBaseReference(): Reference { */ export const Reference = { typeUrl: "/google.api.expr.v1alpha1.Reference", + is(o: any): o is Reference { + return o && (o.$typeUrl === Reference.typeUrl || typeof o.name === "string" && Array.isArray(o.overloadId) && (!o.overloadId.length || typeof o.overloadId[0] === "string")); + }, + isSDK(o: any): o is ReferenceSDKType { + return o && (o.$typeUrl === Reference.typeUrl || typeof o.name === "string" && Array.isArray(o.overload_id) && (!o.overload_id.length || typeof o.overload_id[0] === "string")); + }, + isAmino(o: any): o is ReferenceAmino { + return o && (o.$typeUrl === Reference.typeUrl || typeof o.name === "string" && Array.isArray(o.overload_id) && (!o.overload_id.length || typeof o.overload_id[0] === "string")); + }, encode(message: Reference, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -3026,5 +3202,11 @@ export const Reference = { typeUrl: "/google.api.expr.v1alpha1.Reference", value: Reference.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Reference.typeUrl)) { + return; + } + Constant.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/google/api/expr/v1alpha1/eval.ts b/__fixtures__/v-next/outputv2/google/api/expr/v1alpha1/eval.ts index c694737a89..15a837deb7 100644 --- a/__fixtures__/v-next/outputv2/google/api/expr/v1alpha1/eval.ts +++ b/__fixtures__/v-next/outputv2/google/api/expr/v1alpha1/eval.ts @@ -3,6 +3,7 @@ import { Status, StatusAmino, StatusSDKType } from "../../../rpc/status"; import { BinaryReader, BinaryWriter } from "../../../../binary"; import { JsonSafe } from "../../../../json-safe"; import { DeepPartial, isSet } from "../../../../helpers"; +import { GlobalDecoderRegistry } from "../../../../registry"; export const protobufPackage = "google.api.expr.v1alpha1"; /** * The state of an evaluation. @@ -361,6 +362,15 @@ function createBaseEvalState(): EvalState { */ export const EvalState = { typeUrl: "/google.api.expr.v1alpha1.EvalState", + is(o: any): o is EvalState { + return o && (o.$typeUrl === EvalState.typeUrl || Array.isArray(o.values) && (!o.values.length || ExprValue.is(o.values[0])) && Array.isArray(o.results) && (!o.results.length || EvalState_Result.is(o.results[0]))); + }, + isSDK(o: any): o is EvalStateSDKType { + return o && (o.$typeUrl === EvalState.typeUrl || Array.isArray(o.values) && (!o.values.length || ExprValue.isSDK(o.values[0])) && Array.isArray(o.results) && (!o.results.length || EvalState_Result.isSDK(o.results[0]))); + }, + isAmino(o: any): o is EvalStateAmino { + return o && (o.$typeUrl === EvalState.typeUrl || Array.isArray(o.values) && (!o.values.length || ExprValue.isAmino(o.values[0])) && Array.isArray(o.results) && (!o.results.length || EvalState_Result.isAmino(o.results[0]))); + }, encode(message: EvalState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.values) { ExprValue.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -470,6 +480,13 @@ export const EvalState = { typeUrl: "/google.api.expr.v1alpha1.EvalState", value: EvalState.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(EvalState.typeUrl)) { + return; + } + ExprValue.registerTypeUrl(); + EvalState_Result.registerTypeUrl(); } }; function createBaseEvalState_Result(): EvalState_Result { @@ -486,6 +503,15 @@ function createBaseEvalState_Result(): EvalState_Result { */ export const EvalState_Result = { typeUrl: "/google.api.expr.v1alpha1.Result", + is(o: any): o is EvalState_Result { + return o && (o.$typeUrl === EvalState_Result.typeUrl || typeof o.expr === "bigint" && typeof o.value === "bigint"); + }, + isSDK(o: any): o is EvalState_ResultSDKType { + return o && (o.$typeUrl === EvalState_Result.typeUrl || typeof o.expr === "bigint" && typeof o.value === "bigint"); + }, + isAmino(o: any): o is EvalState_ResultAmino { + return o && (o.$typeUrl === EvalState_Result.typeUrl || typeof o.expr === "bigint" && typeof o.value === "bigint"); + }, encode(message: EvalState_Result, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.expr !== BigInt(0)) { writer.uint32(8).int64(message.expr); @@ -579,7 +605,8 @@ export const EvalState_Result = { typeUrl: "/google.api.expr.v1alpha1.Result", value: EvalState_Result.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseExprValue(): ExprValue { return { @@ -596,6 +623,15 @@ function createBaseExprValue(): ExprValue { */ export const ExprValue = { typeUrl: "/google.api.expr.v1alpha1.ExprValue", + is(o: any): o is ExprValue { + return o && o.$typeUrl === ExprValue.typeUrl; + }, + isSDK(o: any): o is ExprValueSDKType { + return o && o.$typeUrl === ExprValue.typeUrl; + }, + isAmino(o: any): o is ExprValueAmino { + return o && o.$typeUrl === ExprValue.typeUrl; + }, encode(message: ExprValue, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.value !== undefined) { Value.encode(message.value, writer.uint32(10).fork()).ldelim(); @@ -706,6 +742,14 @@ export const ExprValue = { typeUrl: "/google.api.expr.v1alpha1.ExprValue", value: ExprValue.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ExprValue.typeUrl)) { + return; + } + Value.registerTypeUrl(); + ErrorSet.registerTypeUrl(); + UnknownSet.registerTypeUrl(); } }; function createBaseErrorSet(): ErrorSet { @@ -723,6 +767,15 @@ function createBaseErrorSet(): ErrorSet { */ export const ErrorSet = { typeUrl: "/google.api.expr.v1alpha1.ErrorSet", + is(o: any): o is ErrorSet { + return o && (o.$typeUrl === ErrorSet.typeUrl || Array.isArray(o.errors) && (!o.errors.length || Status.is(o.errors[0]))); + }, + isSDK(o: any): o is ErrorSetSDKType { + return o && (o.$typeUrl === ErrorSet.typeUrl || Array.isArray(o.errors) && (!o.errors.length || Status.isSDK(o.errors[0]))); + }, + isAmino(o: any): o is ErrorSetAmino { + return o && (o.$typeUrl === ErrorSet.typeUrl || Array.isArray(o.errors) && (!o.errors.length || Status.isAmino(o.errors[0]))); + }, encode(message: ErrorSet, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.errors) { Status.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -807,6 +860,12 @@ export const ErrorSet = { typeUrl: "/google.api.expr.v1alpha1.ErrorSet", value: ErrorSet.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ErrorSet.typeUrl)) { + return; + } + Status.registerTypeUrl(); } }; function createBaseUnknownSet(): UnknownSet { @@ -824,6 +883,15 @@ function createBaseUnknownSet(): UnknownSet { */ export const UnknownSet = { typeUrl: "/google.api.expr.v1alpha1.UnknownSet", + is(o: any): o is UnknownSet { + return o && (o.$typeUrl === UnknownSet.typeUrl || Array.isArray(o.exprs) && (!o.exprs.length || typeof o.exprs[0] === "bigint")); + }, + isSDK(o: any): o is UnknownSetSDKType { + return o && (o.$typeUrl === UnknownSet.typeUrl || Array.isArray(o.exprs) && (!o.exprs.length || typeof o.exprs[0] === "bigint")); + }, + isAmino(o: any): o is UnknownSetAmino { + return o && (o.$typeUrl === UnknownSet.typeUrl || Array.isArray(o.exprs) && (!o.exprs.length || typeof o.exprs[0] === "bigint")); + }, encode(message: UnknownSet, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { writer.uint32(10).fork(); for (const v of message.exprs) { @@ -917,5 +985,6 @@ export const UnknownSet = { typeUrl: "/google.api.expr.v1alpha1.UnknownSet", value: UnknownSet.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/google/api/expr/v1alpha1/explain.ts b/__fixtures__/v-next/outputv2/google/api/expr/v1alpha1/explain.ts index 0ca1e9aec8..65115011bd 100644 --- a/__fixtures__/v-next/outputv2/google/api/expr/v1alpha1/explain.ts +++ b/__fixtures__/v-next/outputv2/google/api/expr/v1alpha1/explain.ts @@ -2,6 +2,7 @@ import { Value, ValueAmino, ValueSDKType } from "./value"; import { BinaryReader, BinaryWriter } from "../../../../binary"; import { JsonSafe } from "../../../../json-safe"; import { DeepPartial, isSet } from "../../../../helpers"; +import { GlobalDecoderRegistry } from "../../../../registry"; export const protobufPackage = "google.api.expr.v1alpha1"; /** * Values of intermediate expressions produced when evaluating expression. @@ -139,6 +140,15 @@ function createBaseExplain(): Explain { */ export const Explain = { typeUrl: "/google.api.expr.v1alpha1.Explain", + is(o: any): o is Explain { + return o && (o.$typeUrl === Explain.typeUrl || Array.isArray(o.values) && (!o.values.length || Value.is(o.values[0])) && Array.isArray(o.exprSteps) && (!o.exprSteps.length || Explain_ExprStep.is(o.exprSteps[0]))); + }, + isSDK(o: any): o is ExplainSDKType { + return o && (o.$typeUrl === Explain.typeUrl || Array.isArray(o.values) && (!o.values.length || Value.isSDK(o.values[0])) && Array.isArray(o.expr_steps) && (!o.expr_steps.length || Explain_ExprStep.isSDK(o.expr_steps[0]))); + }, + isAmino(o: any): o is ExplainAmino { + return o && (o.$typeUrl === Explain.typeUrl || Array.isArray(o.values) && (!o.values.length || Value.isAmino(o.values[0])) && Array.isArray(o.expr_steps) && (!o.expr_steps.length || Explain_ExprStep.isAmino(o.expr_steps[0]))); + }, encode(message: Explain, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.values) { Value.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -248,6 +258,13 @@ export const Explain = { typeUrl: "/google.api.expr.v1alpha1.Explain", value: Explain.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Explain.typeUrl)) { + return; + } + Value.registerTypeUrl(); + Explain_ExprStep.registerTypeUrl(); } }; function createBaseExplain_ExprStep(): Explain_ExprStep { @@ -264,6 +281,15 @@ function createBaseExplain_ExprStep(): Explain_ExprStep { */ export const Explain_ExprStep = { typeUrl: "/google.api.expr.v1alpha1.ExprStep", + is(o: any): o is Explain_ExprStep { + return o && (o.$typeUrl === Explain_ExprStep.typeUrl || typeof o.id === "bigint" && typeof o.valueIndex === "number"); + }, + isSDK(o: any): o is Explain_ExprStepSDKType { + return o && (o.$typeUrl === Explain_ExprStep.typeUrl || typeof o.id === "bigint" && typeof o.value_index === "number"); + }, + isAmino(o: any): o is Explain_ExprStepAmino { + return o && (o.$typeUrl === Explain_ExprStep.typeUrl || typeof o.id === "bigint" && typeof o.value_index === "number"); + }, encode(message: Explain_ExprStep, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.id !== BigInt(0)) { writer.uint32(8).int64(message.id); @@ -355,5 +381,6 @@ export const Explain_ExprStep = { typeUrl: "/google.api.expr.v1alpha1.ExprStep", value: Explain_ExprStep.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/google/api/expr/v1alpha1/syntax.ts b/__fixtures__/v-next/outputv2/google/api/expr/v1alpha1/syntax.ts index 2e252cda80..1d21032e7d 100644 --- a/__fixtures__/v-next/outputv2/google/api/expr/v1alpha1/syntax.ts +++ b/__fixtures__/v-next/outputv2/google/api/expr/v1alpha1/syntax.ts @@ -2,6 +2,7 @@ import { NullValue, nullValueFromJSON, nullValueToJSON } from "../../../protobuf import { Duration, DurationAmino, DurationSDKType } from "../../../protobuf/duration"; import { Timestamp } from "../../../protobuf/timestamp"; import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { GlobalDecoderRegistry } from "../../../../registry"; import { isSet, DeepPartial, toTimestamp, fromTimestamp, bytesFromBase64, base64FromBytes, isObject } from "../../../../helpers"; import { JsonSafe } from "../../../../json-safe"; export const protobufPackage = "google.api.expr.v1alpha1"; @@ -1210,6 +1211,15 @@ function createBaseParsedExpr(): ParsedExpr { */ export const ParsedExpr = { typeUrl: "/google.api.expr.v1alpha1.ParsedExpr", + is(o: any): o is ParsedExpr { + return o && o.$typeUrl === ParsedExpr.typeUrl; + }, + isSDK(o: any): o is ParsedExprSDKType { + return o && o.$typeUrl === ParsedExpr.typeUrl; + }, + isAmino(o: any): o is ParsedExprAmino { + return o && o.$typeUrl === ParsedExpr.typeUrl; + }, encode(message: ParsedExpr, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.expr !== undefined) { Expr.encode(message.expr, writer.uint32(18).fork()).ldelim(); @@ -1303,6 +1313,13 @@ export const ParsedExpr = { typeUrl: "/google.api.expr.v1alpha1.ParsedExpr", value: ParsedExpr.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ParsedExpr.typeUrl)) { + return; + } + Expr.registerTypeUrl(); + SourceInfo.registerTypeUrl(); } }; function createBaseExpr(): Expr { @@ -1339,6 +1356,15 @@ function createBaseExpr(): Expr { */ export const Expr = { typeUrl: "/google.api.expr.v1alpha1.Expr", + is(o: any): o is Expr { + return o && (o.$typeUrl === Expr.typeUrl || typeof o.id === "bigint"); + }, + isSDK(o: any): o is ExprSDKType { + return o && (o.$typeUrl === Expr.typeUrl || typeof o.id === "bigint"); + }, + isAmino(o: any): o is ExprAmino { + return o && (o.$typeUrl === Expr.typeUrl || typeof o.id === "bigint"); + }, encode(message: Expr, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.id !== BigInt(0)) { writer.uint32(16).int64(message.id); @@ -1534,6 +1560,18 @@ export const Expr = { typeUrl: "/google.api.expr.v1alpha1.Expr", value: Expr.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Expr.typeUrl)) { + return; + } + Constant.registerTypeUrl(); + Expr_Ident.registerTypeUrl(); + Expr_Select.registerTypeUrl(); + Expr_Call.registerTypeUrl(); + Expr_CreateList.registerTypeUrl(); + Expr_CreateStruct.registerTypeUrl(); + Expr_Comprehension.registerTypeUrl(); } }; function createBaseExpr_Ident(): Expr_Ident { @@ -1549,6 +1587,15 @@ function createBaseExpr_Ident(): Expr_Ident { */ export const Expr_Ident = { typeUrl: "/google.api.expr.v1alpha1.Ident", + is(o: any): o is Expr_Ident { + return o && (o.$typeUrl === Expr_Ident.typeUrl || typeof o.name === "string"); + }, + isSDK(o: any): o is Expr_IdentSDKType { + return o && (o.$typeUrl === Expr_Ident.typeUrl || typeof o.name === "string"); + }, + isAmino(o: any): o is Expr_IdentAmino { + return o && (o.$typeUrl === Expr_Ident.typeUrl || typeof o.name === "string"); + }, encode(message: Expr_Ident, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -1623,7 +1670,8 @@ export const Expr_Ident = { typeUrl: "/google.api.expr.v1alpha1.Ident", value: Expr_Ident.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseExpr_Select(): Expr_Select { return { @@ -1640,6 +1688,15 @@ function createBaseExpr_Select(): Expr_Select { */ export const Expr_Select = { typeUrl: "/google.api.expr.v1alpha1.Select", + is(o: any): o is Expr_Select { + return o && (o.$typeUrl === Expr_Select.typeUrl || typeof o.field === "string" && typeof o.testOnly === "boolean"); + }, + isSDK(o: any): o is Expr_SelectSDKType { + return o && (o.$typeUrl === Expr_Select.typeUrl || typeof o.field === "string" && typeof o.test_only === "boolean"); + }, + isAmino(o: any): o is Expr_SelectAmino { + return o && (o.$typeUrl === Expr_Select.typeUrl || typeof o.field === "string" && typeof o.test_only === "boolean"); + }, encode(message: Expr_Select, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.operand !== undefined) { Expr.encode(message.operand, writer.uint32(10).fork()).ldelim(); @@ -1746,6 +1803,12 @@ export const Expr_Select = { typeUrl: "/google.api.expr.v1alpha1.Select", value: Expr_Select.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Expr_Select.typeUrl)) { + return; + } + Expr.registerTypeUrl(); } }; function createBaseExpr_Call(): Expr_Call { @@ -1765,6 +1828,15 @@ function createBaseExpr_Call(): Expr_Call { */ export const Expr_Call = { typeUrl: "/google.api.expr.v1alpha1.Call", + is(o: any): o is Expr_Call { + return o && (o.$typeUrl === Expr_Call.typeUrl || typeof o.function === "string" && Array.isArray(o.args) && (!o.args.length || Expr.is(o.args[0]))); + }, + isSDK(o: any): o is Expr_CallSDKType { + return o && (o.$typeUrl === Expr_Call.typeUrl || typeof o.function === "string" && Array.isArray(o.args) && (!o.args.length || Expr.isSDK(o.args[0]))); + }, + isAmino(o: any): o is Expr_CallAmino { + return o && (o.$typeUrl === Expr_Call.typeUrl || typeof o.function === "string" && Array.isArray(o.args) && (!o.args.length || Expr.isAmino(o.args[0]))); + }, encode(message: Expr_Call, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.target !== undefined) { Expr.encode(message.target, writer.uint32(10).fork()).ldelim(); @@ -1881,6 +1953,12 @@ export const Expr_Call = { typeUrl: "/google.api.expr.v1alpha1.Call", value: Expr_Call.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Expr_Call.typeUrl)) { + return; + } + Expr.registerTypeUrl(); } }; function createBaseExpr_CreateList(): Expr_CreateList { @@ -1899,6 +1977,15 @@ function createBaseExpr_CreateList(): Expr_CreateList { */ export const Expr_CreateList = { typeUrl: "/google.api.expr.v1alpha1.CreateList", + is(o: any): o is Expr_CreateList { + return o && (o.$typeUrl === Expr_CreateList.typeUrl || Array.isArray(o.elements) && (!o.elements.length || Expr.is(o.elements[0]))); + }, + isSDK(o: any): o is Expr_CreateListSDKType { + return o && (o.$typeUrl === Expr_CreateList.typeUrl || Array.isArray(o.elements) && (!o.elements.length || Expr.isSDK(o.elements[0]))); + }, + isAmino(o: any): o is Expr_CreateListAmino { + return o && (o.$typeUrl === Expr_CreateList.typeUrl || Array.isArray(o.elements) && (!o.elements.length || Expr.isAmino(o.elements[0]))); + }, encode(message: Expr_CreateList, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.elements) { Expr.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -1983,6 +2070,12 @@ export const Expr_CreateList = { typeUrl: "/google.api.expr.v1alpha1.CreateList", value: Expr_CreateList.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Expr_CreateList.typeUrl)) { + return; + } + Expr.registerTypeUrl(); } }; function createBaseExpr_CreateStruct(): Expr_CreateStruct { @@ -2003,6 +2096,15 @@ function createBaseExpr_CreateStruct(): Expr_CreateStruct { */ export const Expr_CreateStruct = { typeUrl: "/google.api.expr.v1alpha1.CreateStruct", + is(o: any): o is Expr_CreateStruct { + return o && (o.$typeUrl === Expr_CreateStruct.typeUrl || typeof o.messageName === "string" && Array.isArray(o.entries) && (!o.entries.length || Expr_CreateStruct_Entry.is(o.entries[0]))); + }, + isSDK(o: any): o is Expr_CreateStructSDKType { + return o && (o.$typeUrl === Expr_CreateStruct.typeUrl || typeof o.message_name === "string" && Array.isArray(o.entries) && (!o.entries.length || Expr_CreateStruct_Entry.isSDK(o.entries[0]))); + }, + isAmino(o: any): o is Expr_CreateStructAmino { + return o && (o.$typeUrl === Expr_CreateStruct.typeUrl || typeof o.message_name === "string" && Array.isArray(o.entries) && (!o.entries.length || Expr_CreateStruct_Entry.isAmino(o.entries[0]))); + }, encode(message: Expr_CreateStruct, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.messageName !== "") { writer.uint32(10).string(message.messageName); @@ -2102,6 +2204,12 @@ export const Expr_CreateStruct = { typeUrl: "/google.api.expr.v1alpha1.CreateStruct", value: Expr_CreateStruct.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Expr_CreateStruct.typeUrl)) { + return; + } + Expr_CreateStruct_Entry.registerTypeUrl(); } }; function createBaseExpr_CreateStruct_Entry(): Expr_CreateStruct_Entry { @@ -2120,6 +2228,15 @@ function createBaseExpr_CreateStruct_Entry(): Expr_CreateStruct_Entry { */ export const Expr_CreateStruct_Entry = { typeUrl: "/google.api.expr.v1alpha1.Entry", + is(o: any): o is Expr_CreateStruct_Entry { + return o && (o.$typeUrl === Expr_CreateStruct_Entry.typeUrl || typeof o.id === "bigint"); + }, + isSDK(o: any): o is Expr_CreateStruct_EntrySDKType { + return o && (o.$typeUrl === Expr_CreateStruct_Entry.typeUrl || typeof o.id === "bigint"); + }, + isAmino(o: any): o is Expr_CreateStruct_EntryAmino { + return o && (o.$typeUrl === Expr_CreateStruct_Entry.typeUrl || typeof o.id === "bigint"); + }, encode(message: Expr_CreateStruct_Entry, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.id !== BigInt(0)) { writer.uint32(8).int64(message.id); @@ -2245,6 +2362,12 @@ export const Expr_CreateStruct_Entry = { typeUrl: "/google.api.expr.v1alpha1.Entry", value: Expr_CreateStruct_Entry.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Expr_CreateStruct_Entry.typeUrl)) { + return; + } + Expr.registerTypeUrl(); } }; function createBaseExpr_Comprehension(): Expr_Comprehension { @@ -2291,6 +2414,15 @@ function createBaseExpr_Comprehension(): Expr_Comprehension { */ export const Expr_Comprehension = { typeUrl: "/google.api.expr.v1alpha1.Comprehension", + is(o: any): o is Expr_Comprehension { + return o && (o.$typeUrl === Expr_Comprehension.typeUrl || typeof o.iterVar === "string" && typeof o.accuVar === "string"); + }, + isSDK(o: any): o is Expr_ComprehensionSDKType { + return o && (o.$typeUrl === Expr_Comprehension.typeUrl || typeof o.iter_var === "string" && typeof o.accu_var === "string"); + }, + isAmino(o: any): o is Expr_ComprehensionAmino { + return o && (o.$typeUrl === Expr_Comprehension.typeUrl || typeof o.iter_var === "string" && typeof o.accu_var === "string"); + }, encode(message: Expr_Comprehension, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.iterVar !== "") { writer.uint32(10).string(message.iterVar); @@ -2465,6 +2597,12 @@ export const Expr_Comprehension = { typeUrl: "/google.api.expr.v1alpha1.Comprehension", value: Expr_Comprehension.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Expr_Comprehension.typeUrl)) { + return; + } + Expr.registerTypeUrl(); } }; function createBaseConstant(): Constant { @@ -2500,6 +2638,15 @@ function createBaseConstant(): Constant { */ export const Constant = { typeUrl: "/google.api.expr.v1alpha1.Constant", + is(o: any): o is Constant { + return o && o.$typeUrl === Constant.typeUrl; + }, + isSDK(o: any): o is ConstantSDKType { + return o && o.$typeUrl === Constant.typeUrl; + }, + isAmino(o: any): o is ConstantAmino { + return o && o.$typeUrl === Constant.typeUrl; + }, encode(message: Constant, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.nullValue !== undefined) { writer.uint32(8).int32(message.nullValue); @@ -2704,7 +2851,8 @@ export const Constant = { typeUrl: "/google.api.expr.v1alpha1.Constant", value: Constant.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseSourceInfo_PositionsEntry(): SourceInfo_PositionsEntry { return { @@ -2803,7 +2951,8 @@ export const SourceInfo_PositionsEntry = { }, toProto(message: SourceInfo_PositionsEntry): Uint8Array { return SourceInfo_PositionsEntry.encode(message).finish(); - } + }, + registerTypeUrl() {} }; function createBaseSourceInfo_MacroCallsEntry(): SourceInfo_MacroCallsEntry { return { @@ -2904,6 +3053,9 @@ export const SourceInfo_MacroCallsEntry = { }, toProto(message: SourceInfo_MacroCallsEntry): Uint8Array { return SourceInfo_MacroCallsEntry.encode(message).finish(); + }, + registerTypeUrl() { + Expr.registerTypeUrl(); } }; function createBaseSourceInfo(): SourceInfo { @@ -2923,6 +3075,15 @@ function createBaseSourceInfo(): SourceInfo { */ export const SourceInfo = { typeUrl: "/google.api.expr.v1alpha1.SourceInfo", + is(o: any): o is SourceInfo { + return o && (o.$typeUrl === SourceInfo.typeUrl || typeof o.syntaxVersion === "string" && typeof o.location === "string" && Array.isArray(o.lineOffsets) && (!o.lineOffsets.length || typeof o.lineOffsets[0] === "number") && isSet(o.positions) && isSet(o.macroCalls)); + }, + isSDK(o: any): o is SourceInfoSDKType { + return o && (o.$typeUrl === SourceInfo.typeUrl || typeof o.syntax_version === "string" && typeof o.location === "string" && Array.isArray(o.line_offsets) && (!o.line_offsets.length || typeof o.line_offsets[0] === "number") && isSet(o.positions) && isSet(o.macro_calls)); + }, + isAmino(o: any): o is SourceInfoAmino { + return o && (o.$typeUrl === SourceInfo.typeUrl || typeof o.syntax_version === "string" && typeof o.location === "string" && Array.isArray(o.line_offsets) && (!o.line_offsets.length || typeof o.line_offsets[0] === "number") && isSet(o.positions) && isSet(o.macro_calls)); + }, encode(message: SourceInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.syntaxVersion !== "") { writer.uint32(10).string(message.syntaxVersion); @@ -3162,6 +3323,12 @@ export const SourceInfo = { typeUrl: "/google.api.expr.v1alpha1.SourceInfo", value: SourceInfo.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(SourceInfo.typeUrl)) { + return; + } + Expr.registerTypeUrl(); } }; function createBaseSourcePosition(): SourcePosition { @@ -3180,6 +3347,15 @@ function createBaseSourcePosition(): SourcePosition { */ export const SourcePosition = { typeUrl: "/google.api.expr.v1alpha1.SourcePosition", + is(o: any): o is SourcePosition { + return o && (o.$typeUrl === SourcePosition.typeUrl || typeof o.location === "string" && typeof o.offset === "number" && typeof o.line === "number" && typeof o.column === "number"); + }, + isSDK(o: any): o is SourcePositionSDKType { + return o && (o.$typeUrl === SourcePosition.typeUrl || typeof o.location === "string" && typeof o.offset === "number" && typeof o.line === "number" && typeof o.column === "number"); + }, + isAmino(o: any): o is SourcePositionAmino { + return o && (o.$typeUrl === SourcePosition.typeUrl || typeof o.location === "string" && typeof o.offset === "number" && typeof o.line === "number" && typeof o.column === "number"); + }, encode(message: SourcePosition, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.location !== "") { writer.uint32(10).string(message.location); @@ -3299,5 +3475,6 @@ export const SourcePosition = { typeUrl: "/google.api.expr.v1alpha1.SourcePosition", value: SourcePosition.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/google/api/expr/v1alpha1/value.ts b/__fixtures__/v-next/outputv2/google/api/expr/v1alpha1/value.ts index f52e33b004..8f83efce84 100644 --- a/__fixtures__/v-next/outputv2/google/api/expr/v1alpha1/value.ts +++ b/__fixtures__/v-next/outputv2/google/api/expr/v1alpha1/value.ts @@ -1,6 +1,7 @@ import { NullValue, nullValueFromJSON, nullValueToJSON } from "../../../protobuf/struct"; import { Any, AnyAmino, AnySDKType } from "../../../protobuf/any"; import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { GlobalDecoderRegistry } from "../../../../registry"; import { isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../../../../helpers"; import { JsonSafe } from "../../../../json-safe"; export const protobufPackage = "google.api.expr.v1alpha1"; @@ -392,6 +393,15 @@ function createBaseValue(): Value { */ export const Value = { typeUrl: "/google.api.expr.v1alpha1.Value", + is(o: any): o is Value { + return o && o.$typeUrl === Value.typeUrl; + }, + isSDK(o: any): o is ValueSDKType { + return o && o.$typeUrl === Value.typeUrl; + }, + isAmino(o: any): o is ValueAmino { + return o && o.$typeUrl === Value.typeUrl; + }, encode(message: Value, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.nullValue !== undefined) { writer.uint32(8).int32(message.nullValue); @@ -647,6 +657,13 @@ export const Value = { typeUrl: "/google.api.expr.v1alpha1.Value", value: Value.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Value.typeUrl)) { + return; + } + MapValue.registerTypeUrl(); + ListValue.registerTypeUrl(); } }; function createBaseEnumValue(): EnumValue { @@ -663,6 +680,15 @@ function createBaseEnumValue(): EnumValue { */ export const EnumValue = { typeUrl: "/google.api.expr.v1alpha1.EnumValue", + is(o: any): o is EnumValue { + return o && (o.$typeUrl === EnumValue.typeUrl || typeof o.type === "string" && typeof o.value === "number"); + }, + isSDK(o: any): o is EnumValueSDKType { + return o && (o.$typeUrl === EnumValue.typeUrl || typeof o.type === "string" && typeof o.value === "number"); + }, + isAmino(o: any): o is EnumValueAmino { + return o && (o.$typeUrl === EnumValue.typeUrl || typeof o.type === "string" && typeof o.value === "number"); + }, encode(message: EnumValue, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.type !== "") { writer.uint32(10).string(message.type); @@ -752,7 +778,8 @@ export const EnumValue = { typeUrl: "/google.api.expr.v1alpha1.EnumValue", value: EnumValue.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseListValue(): ListValue { return { @@ -770,6 +797,15 @@ function createBaseListValue(): ListValue { */ export const ListValue = { typeUrl: "/google.api.expr.v1alpha1.ListValue", + is(o: any): o is ListValue { + return o && (o.$typeUrl === ListValue.typeUrl || Array.isArray(o.values) && (!o.values.length || Value.is(o.values[0]))); + }, + isSDK(o: any): o is ListValueSDKType { + return o && (o.$typeUrl === ListValue.typeUrl || Array.isArray(o.values) && (!o.values.length || Value.isSDK(o.values[0]))); + }, + isAmino(o: any): o is ListValueAmino { + return o && (o.$typeUrl === ListValue.typeUrl || Array.isArray(o.values) && (!o.values.length || Value.isAmino(o.values[0]))); + }, encode(message: ListValue, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.values) { Value.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -854,6 +890,12 @@ export const ListValue = { typeUrl: "/google.api.expr.v1alpha1.ListValue", value: ListValue.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ListValue.typeUrl)) { + return; + } + Value.registerTypeUrl(); } }; function createBaseMapValue(): MapValue { @@ -872,6 +914,15 @@ function createBaseMapValue(): MapValue { */ export const MapValue = { typeUrl: "/google.api.expr.v1alpha1.MapValue", + is(o: any): o is MapValue { + return o && (o.$typeUrl === MapValue.typeUrl || Array.isArray(o.entries) && (!o.entries.length || MapValue_Entry.is(o.entries[0]))); + }, + isSDK(o: any): o is MapValueSDKType { + return o && (o.$typeUrl === MapValue.typeUrl || Array.isArray(o.entries) && (!o.entries.length || MapValue_Entry.isSDK(o.entries[0]))); + }, + isAmino(o: any): o is MapValueAmino { + return o && (o.$typeUrl === MapValue.typeUrl || Array.isArray(o.entries) && (!o.entries.length || MapValue_Entry.isAmino(o.entries[0]))); + }, encode(message: MapValue, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.entries) { MapValue_Entry.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -956,6 +1007,12 @@ export const MapValue = { typeUrl: "/google.api.expr.v1alpha1.MapValue", value: MapValue.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MapValue.typeUrl)) { + return; + } + MapValue_Entry.registerTypeUrl(); } }; function createBaseMapValue_Entry(): MapValue_Entry { @@ -972,6 +1029,15 @@ function createBaseMapValue_Entry(): MapValue_Entry { */ export const MapValue_Entry = { typeUrl: "/google.api.expr.v1alpha1.Entry", + is(o: any): o is MapValue_Entry { + return o && o.$typeUrl === MapValue_Entry.typeUrl; + }, + isSDK(o: any): o is MapValue_EntrySDKType { + return o && o.$typeUrl === MapValue_Entry.typeUrl; + }, + isAmino(o: any): o is MapValue_EntryAmino { + return o && o.$typeUrl === MapValue_Entry.typeUrl; + }, encode(message: MapValue_Entry, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.key !== undefined) { Value.encode(message.key, writer.uint32(10).fork()).ldelim(); @@ -1065,5 +1131,11 @@ export const MapValue_Entry = { typeUrl: "/google.api.expr.v1alpha1.Entry", value: MapValue_Entry.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MapValue_Entry.typeUrl)) { + return; + } + Value.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/google/api/expr/v1beta1/decl.ts b/__fixtures__/v-next/outputv2/google/api/expr/v1beta1/decl.ts index a30d1d8e27..61f9c52a50 100644 --- a/__fixtures__/v-next/outputv2/google/api/expr/v1beta1/decl.ts +++ b/__fixtures__/v-next/outputv2/google/api/expr/v1beta1/decl.ts @@ -1,5 +1,6 @@ import { Expr, ExprAmino, ExprSDKType } from "./expr"; import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { GlobalDecoderRegistry } from "../../../../registry"; import { isSet, DeepPartial } from "../../../../helpers"; import { JsonSafe } from "../../../../json-safe"; export const protobufPackage = "google.api.expr.v1beta1"; @@ -276,6 +277,15 @@ function createBaseDecl(): Decl { */ export const Decl = { typeUrl: "/google.api.expr.v1beta1.Decl", + is(o: any): o is Decl { + return o && (o.$typeUrl === Decl.typeUrl || typeof o.id === "number" && typeof o.name === "string" && typeof o.doc === "string"); + }, + isSDK(o: any): o is DeclSDKType { + return o && (o.$typeUrl === Decl.typeUrl || typeof o.id === "number" && typeof o.name === "string" && typeof o.doc === "string"); + }, + isAmino(o: any): o is DeclAmino { + return o && (o.$typeUrl === Decl.typeUrl || typeof o.id === "number" && typeof o.name === "string" && typeof o.doc === "string"); + }, encode(message: Decl, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.id !== 0) { writer.uint32(8).int32(message.id); @@ -414,6 +424,13 @@ export const Decl = { typeUrl: "/google.api.expr.v1beta1.Decl", value: Decl.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Decl.typeUrl)) { + return; + } + IdentDecl.registerTypeUrl(); + FunctionDecl.registerTypeUrl(); } }; function createBaseDeclType(): DeclType { @@ -434,6 +451,15 @@ function createBaseDeclType(): DeclType { */ export const DeclType = { typeUrl: "/google.api.expr.v1beta1.DeclType", + is(o: any): o is DeclType { + return o && (o.$typeUrl === DeclType.typeUrl || typeof o.id === "number" && typeof o.type === "string" && Array.isArray(o.typeParams) && (!o.typeParams.length || DeclType.is(o.typeParams[0]))); + }, + isSDK(o: any): o is DeclTypeSDKType { + return o && (o.$typeUrl === DeclType.typeUrl || typeof o.id === "number" && typeof o.type === "string" && Array.isArray(o.type_params) && (!o.type_params.length || DeclType.isSDK(o.type_params[0]))); + }, + isAmino(o: any): o is DeclTypeAmino { + return o && (o.$typeUrl === DeclType.typeUrl || typeof o.id === "number" && typeof o.type === "string" && Array.isArray(o.type_params) && (!o.type_params.length || DeclType.isAmino(o.type_params[0]))); + }, encode(message: DeclType, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.id !== 0) { writer.uint32(8).int32(message.id); @@ -548,6 +574,12 @@ export const DeclType = { typeUrl: "/google.api.expr.v1beta1.DeclType", value: DeclType.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(DeclType.typeUrl)) { + return; + } + DeclType.registerTypeUrl(); } }; function createBaseIdentDecl(): IdentDecl { @@ -564,6 +596,15 @@ function createBaseIdentDecl(): IdentDecl { */ export const IdentDecl = { typeUrl: "/google.api.expr.v1beta1.IdentDecl", + is(o: any): o is IdentDecl { + return o && o.$typeUrl === IdentDecl.typeUrl; + }, + isSDK(o: any): o is IdentDeclSDKType { + return o && o.$typeUrl === IdentDecl.typeUrl; + }, + isAmino(o: any): o is IdentDeclAmino { + return o && o.$typeUrl === IdentDecl.typeUrl; + }, encode(message: IdentDecl, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.type !== undefined) { DeclType.encode(message.type, writer.uint32(26).fork()).ldelim(); @@ -657,6 +698,13 @@ export const IdentDecl = { typeUrl: "/google.api.expr.v1beta1.IdentDecl", value: IdentDecl.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(IdentDecl.typeUrl)) { + return; + } + DeclType.registerTypeUrl(); + Expr.registerTypeUrl(); } }; function createBaseFunctionDecl(): FunctionDecl { @@ -674,6 +722,15 @@ function createBaseFunctionDecl(): FunctionDecl { */ export const FunctionDecl = { typeUrl: "/google.api.expr.v1beta1.FunctionDecl", + is(o: any): o is FunctionDecl { + return o && (o.$typeUrl === FunctionDecl.typeUrl || Array.isArray(o.args) && (!o.args.length || IdentDecl.is(o.args[0])) && typeof o.receiverFunction === "boolean"); + }, + isSDK(o: any): o is FunctionDeclSDKType { + return o && (o.$typeUrl === FunctionDecl.typeUrl || Array.isArray(o.args) && (!o.args.length || IdentDecl.isSDK(o.args[0])) && typeof o.receiver_function === "boolean"); + }, + isAmino(o: any): o is FunctionDeclAmino { + return o && (o.$typeUrl === FunctionDecl.typeUrl || Array.isArray(o.args) && (!o.args.length || IdentDecl.isAmino(o.args[0])) && typeof o.receiver_function === "boolean"); + }, encode(message: FunctionDecl, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.args) { IdentDecl.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -790,5 +847,12 @@ export const FunctionDecl = { typeUrl: "/google.api.expr.v1beta1.FunctionDecl", value: FunctionDecl.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(FunctionDecl.typeUrl)) { + return; + } + IdentDecl.registerTypeUrl(); + DeclType.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/google/api/expr/v1beta1/eval.ts b/__fixtures__/v-next/outputv2/google/api/expr/v1beta1/eval.ts index eac280869d..6d0052334c 100644 --- a/__fixtures__/v-next/outputv2/google/api/expr/v1beta1/eval.ts +++ b/__fixtures__/v-next/outputv2/google/api/expr/v1beta1/eval.ts @@ -3,6 +3,7 @@ import { Status, StatusAmino, StatusSDKType } from "../../../rpc/status"; import { BinaryReader, BinaryWriter } from "../../../../binary"; import { JsonSafe } from "../../../../json-safe"; import { DeepPartial, isSet } from "../../../../helpers"; +import { GlobalDecoderRegistry } from "../../../../registry"; export const protobufPackage = "google.api.expr.v1beta1"; /** * The state of an evaluation. @@ -402,6 +403,15 @@ function createBaseEvalState(): EvalState { */ export const EvalState = { typeUrl: "/google.api.expr.v1beta1.EvalState", + is(o: any): o is EvalState { + return o && (o.$typeUrl === EvalState.typeUrl || Array.isArray(o.values) && (!o.values.length || ExprValue.is(o.values[0])) && Array.isArray(o.results) && (!o.results.length || EvalState_Result.is(o.results[0]))); + }, + isSDK(o: any): o is EvalStateSDKType { + return o && (o.$typeUrl === EvalState.typeUrl || Array.isArray(o.values) && (!o.values.length || ExprValue.isSDK(o.values[0])) && Array.isArray(o.results) && (!o.results.length || EvalState_Result.isSDK(o.results[0]))); + }, + isAmino(o: any): o is EvalStateAmino { + return o && (o.$typeUrl === EvalState.typeUrl || Array.isArray(o.values) && (!o.values.length || ExprValue.isAmino(o.values[0])) && Array.isArray(o.results) && (!o.results.length || EvalState_Result.isAmino(o.results[0]))); + }, encode(message: EvalState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.values) { ExprValue.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -511,6 +521,13 @@ export const EvalState = { typeUrl: "/google.api.expr.v1beta1.EvalState", value: EvalState.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(EvalState.typeUrl)) { + return; + } + ExprValue.registerTypeUrl(); + EvalState_Result.registerTypeUrl(); } }; function createBaseEvalState_Result(): EvalState_Result { @@ -527,6 +544,15 @@ function createBaseEvalState_Result(): EvalState_Result { */ export const EvalState_Result = { typeUrl: "/google.api.expr.v1beta1.Result", + is(o: any): o is EvalState_Result { + return o && (o.$typeUrl === EvalState_Result.typeUrl || typeof o.value === "number"); + }, + isSDK(o: any): o is EvalState_ResultSDKType { + return o && (o.$typeUrl === EvalState_Result.typeUrl || typeof o.value === "number"); + }, + isAmino(o: any): o is EvalState_ResultAmino { + return o && (o.$typeUrl === EvalState_Result.typeUrl || typeof o.value === "number"); + }, encode(message: EvalState_Result, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.expr !== undefined) { IdRef.encode(message.expr, writer.uint32(10).fork()).ldelim(); @@ -618,6 +644,12 @@ export const EvalState_Result = { typeUrl: "/google.api.expr.v1beta1.Result", value: EvalState_Result.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(EvalState_Result.typeUrl)) { + return; + } + IdRef.registerTypeUrl(); } }; function createBaseExprValue(): ExprValue { @@ -635,6 +667,15 @@ function createBaseExprValue(): ExprValue { */ export const ExprValue = { typeUrl: "/google.api.expr.v1beta1.ExprValue", + is(o: any): o is ExprValue { + return o && o.$typeUrl === ExprValue.typeUrl; + }, + isSDK(o: any): o is ExprValueSDKType { + return o && o.$typeUrl === ExprValue.typeUrl; + }, + isAmino(o: any): o is ExprValueAmino { + return o && o.$typeUrl === ExprValue.typeUrl; + }, encode(message: ExprValue, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.value !== undefined) { Value.encode(message.value, writer.uint32(10).fork()).ldelim(); @@ -745,6 +786,14 @@ export const ExprValue = { typeUrl: "/google.api.expr.v1beta1.ExprValue", value: ExprValue.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ExprValue.typeUrl)) { + return; + } + Value.registerTypeUrl(); + ErrorSet.registerTypeUrl(); + UnknownSet.registerTypeUrl(); } }; function createBaseErrorSet(): ErrorSet { @@ -762,6 +811,15 @@ function createBaseErrorSet(): ErrorSet { */ export const ErrorSet = { typeUrl: "/google.api.expr.v1beta1.ErrorSet", + is(o: any): o is ErrorSet { + return o && (o.$typeUrl === ErrorSet.typeUrl || Array.isArray(o.errors) && (!o.errors.length || Status.is(o.errors[0]))); + }, + isSDK(o: any): o is ErrorSetSDKType { + return o && (o.$typeUrl === ErrorSet.typeUrl || Array.isArray(o.errors) && (!o.errors.length || Status.isSDK(o.errors[0]))); + }, + isAmino(o: any): o is ErrorSetAmino { + return o && (o.$typeUrl === ErrorSet.typeUrl || Array.isArray(o.errors) && (!o.errors.length || Status.isAmino(o.errors[0]))); + }, encode(message: ErrorSet, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.errors) { Status.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -846,6 +904,12 @@ export const ErrorSet = { typeUrl: "/google.api.expr.v1beta1.ErrorSet", value: ErrorSet.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ErrorSet.typeUrl)) { + return; + } + Status.registerTypeUrl(); } }; function createBaseUnknownSet(): UnknownSet { @@ -863,6 +927,15 @@ function createBaseUnknownSet(): UnknownSet { */ export const UnknownSet = { typeUrl: "/google.api.expr.v1beta1.UnknownSet", + is(o: any): o is UnknownSet { + return o && (o.$typeUrl === UnknownSet.typeUrl || Array.isArray(o.exprs) && (!o.exprs.length || IdRef.is(o.exprs[0]))); + }, + isSDK(o: any): o is UnknownSetSDKType { + return o && (o.$typeUrl === UnknownSet.typeUrl || Array.isArray(o.exprs) && (!o.exprs.length || IdRef.isSDK(o.exprs[0]))); + }, + isAmino(o: any): o is UnknownSetAmino { + return o && (o.$typeUrl === UnknownSet.typeUrl || Array.isArray(o.exprs) && (!o.exprs.length || IdRef.isAmino(o.exprs[0]))); + }, encode(message: UnknownSet, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.exprs) { IdRef.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -947,6 +1020,12 @@ export const UnknownSet = { typeUrl: "/google.api.expr.v1beta1.UnknownSet", value: UnknownSet.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(UnknownSet.typeUrl)) { + return; + } + IdRef.registerTypeUrl(); } }; function createBaseIdRef(): IdRef { @@ -962,6 +1041,15 @@ function createBaseIdRef(): IdRef { */ export const IdRef = { typeUrl: "/google.api.expr.v1beta1.IdRef", + is(o: any): o is IdRef { + return o && (o.$typeUrl === IdRef.typeUrl || typeof o.id === "number"); + }, + isSDK(o: any): o is IdRefSDKType { + return o && (o.$typeUrl === IdRef.typeUrl || typeof o.id === "number"); + }, + isAmino(o: any): o is IdRefAmino { + return o && (o.$typeUrl === IdRef.typeUrl || typeof o.id === "number"); + }, encode(message: IdRef, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.id !== 0) { writer.uint32(8).int32(message.id); @@ -1036,5 +1124,6 @@ export const IdRef = { typeUrl: "/google.api.expr.v1beta1.IdRef", value: IdRef.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/google/api/expr/v1beta1/expr.ts b/__fixtures__/v-next/outputv2/google/api/expr/v1beta1/expr.ts index 8a51f33c8a..5fbc6dcb3b 100644 --- a/__fixtures__/v-next/outputv2/google/api/expr/v1beta1/expr.ts +++ b/__fixtures__/v-next/outputv2/google/api/expr/v1beta1/expr.ts @@ -1,6 +1,7 @@ import { SourceInfo, SourceInfoAmino, SourceInfoSDKType } from "./source"; import { NullValue, nullValueFromJSON, nullValueToJSON } from "../../../protobuf/struct"; import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { GlobalDecoderRegistry } from "../../../../registry"; import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../../helpers"; import { JsonSafe } from "../../../../json-safe"; export const protobufPackage = "google.api.expr.v1beta1"; @@ -912,6 +913,15 @@ function createBaseParsedExpr(): ParsedExpr { */ export const ParsedExpr = { typeUrl: "/google.api.expr.v1beta1.ParsedExpr", + is(o: any): o is ParsedExpr { + return o && (o.$typeUrl === ParsedExpr.typeUrl || typeof o.syntaxVersion === "string"); + }, + isSDK(o: any): o is ParsedExprSDKType { + return o && (o.$typeUrl === ParsedExpr.typeUrl || typeof o.syntax_version === "string"); + }, + isAmino(o: any): o is ParsedExprAmino { + return o && (o.$typeUrl === ParsedExpr.typeUrl || typeof o.syntax_version === "string"); + }, encode(message: ParsedExpr, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.expr !== undefined) { Expr.encode(message.expr, writer.uint32(18).fork()).ldelim(); @@ -1020,6 +1030,13 @@ export const ParsedExpr = { typeUrl: "/google.api.expr.v1beta1.ParsedExpr", value: ParsedExpr.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ParsedExpr.typeUrl)) { + return; + } + Expr.registerTypeUrl(); + SourceInfo.registerTypeUrl(); } }; function createBaseExpr(): Expr { @@ -1056,6 +1073,15 @@ function createBaseExpr(): Expr { */ export const Expr = { typeUrl: "/google.api.expr.v1beta1.Expr", + is(o: any): o is Expr { + return o && (o.$typeUrl === Expr.typeUrl || typeof o.id === "number"); + }, + isSDK(o: any): o is ExprSDKType { + return o && (o.$typeUrl === Expr.typeUrl || typeof o.id === "number"); + }, + isAmino(o: any): o is ExprAmino { + return o && (o.$typeUrl === Expr.typeUrl || typeof o.id === "number"); + }, encode(message: Expr, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.id !== 0) { writer.uint32(16).int32(message.id); @@ -1249,6 +1275,18 @@ export const Expr = { typeUrl: "/google.api.expr.v1beta1.Expr", value: Expr.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Expr.typeUrl)) { + return; + } + Literal.registerTypeUrl(); + Expr_Ident.registerTypeUrl(); + Expr_Select.registerTypeUrl(); + Expr_Call.registerTypeUrl(); + Expr_CreateList.registerTypeUrl(); + Expr_CreateStruct.registerTypeUrl(); + Expr_Comprehension.registerTypeUrl(); } }; function createBaseExpr_Ident(): Expr_Ident { @@ -1264,6 +1302,15 @@ function createBaseExpr_Ident(): Expr_Ident { */ export const Expr_Ident = { typeUrl: "/google.api.expr.v1beta1.Ident", + is(o: any): o is Expr_Ident { + return o && (o.$typeUrl === Expr_Ident.typeUrl || typeof o.name === "string"); + }, + isSDK(o: any): o is Expr_IdentSDKType { + return o && (o.$typeUrl === Expr_Ident.typeUrl || typeof o.name === "string"); + }, + isAmino(o: any): o is Expr_IdentAmino { + return o && (o.$typeUrl === Expr_Ident.typeUrl || typeof o.name === "string"); + }, encode(message: Expr_Ident, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -1338,7 +1385,8 @@ export const Expr_Ident = { typeUrl: "/google.api.expr.v1beta1.Ident", value: Expr_Ident.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseExpr_Select(): Expr_Select { return { @@ -1355,6 +1403,15 @@ function createBaseExpr_Select(): Expr_Select { */ export const Expr_Select = { typeUrl: "/google.api.expr.v1beta1.Select", + is(o: any): o is Expr_Select { + return o && (o.$typeUrl === Expr_Select.typeUrl || typeof o.field === "string" && typeof o.testOnly === "boolean"); + }, + isSDK(o: any): o is Expr_SelectSDKType { + return o && (o.$typeUrl === Expr_Select.typeUrl || typeof o.field === "string" && typeof o.test_only === "boolean"); + }, + isAmino(o: any): o is Expr_SelectAmino { + return o && (o.$typeUrl === Expr_Select.typeUrl || typeof o.field === "string" && typeof o.test_only === "boolean"); + }, encode(message: Expr_Select, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.operand !== undefined) { Expr.encode(message.operand, writer.uint32(10).fork()).ldelim(); @@ -1461,6 +1518,12 @@ export const Expr_Select = { typeUrl: "/google.api.expr.v1beta1.Select", value: Expr_Select.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Expr_Select.typeUrl)) { + return; + } + Expr.registerTypeUrl(); } }; function createBaseExpr_Call(): Expr_Call { @@ -1480,6 +1543,15 @@ function createBaseExpr_Call(): Expr_Call { */ export const Expr_Call = { typeUrl: "/google.api.expr.v1beta1.Call", + is(o: any): o is Expr_Call { + return o && (o.$typeUrl === Expr_Call.typeUrl || typeof o.function === "string" && Array.isArray(o.args) && (!o.args.length || Expr.is(o.args[0]))); + }, + isSDK(o: any): o is Expr_CallSDKType { + return o && (o.$typeUrl === Expr_Call.typeUrl || typeof o.function === "string" && Array.isArray(o.args) && (!o.args.length || Expr.isSDK(o.args[0]))); + }, + isAmino(o: any): o is Expr_CallAmino { + return o && (o.$typeUrl === Expr_Call.typeUrl || typeof o.function === "string" && Array.isArray(o.args) && (!o.args.length || Expr.isAmino(o.args[0]))); + }, encode(message: Expr_Call, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.target !== undefined) { Expr.encode(message.target, writer.uint32(10).fork()).ldelim(); @@ -1596,6 +1668,12 @@ export const Expr_Call = { typeUrl: "/google.api.expr.v1beta1.Call", value: Expr_Call.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Expr_Call.typeUrl)) { + return; + } + Expr.registerTypeUrl(); } }; function createBaseExpr_CreateList(): Expr_CreateList { @@ -1614,6 +1692,15 @@ function createBaseExpr_CreateList(): Expr_CreateList { */ export const Expr_CreateList = { typeUrl: "/google.api.expr.v1beta1.CreateList", + is(o: any): o is Expr_CreateList { + return o && (o.$typeUrl === Expr_CreateList.typeUrl || Array.isArray(o.elements) && (!o.elements.length || Expr.is(o.elements[0]))); + }, + isSDK(o: any): o is Expr_CreateListSDKType { + return o && (o.$typeUrl === Expr_CreateList.typeUrl || Array.isArray(o.elements) && (!o.elements.length || Expr.isSDK(o.elements[0]))); + }, + isAmino(o: any): o is Expr_CreateListAmino { + return o && (o.$typeUrl === Expr_CreateList.typeUrl || Array.isArray(o.elements) && (!o.elements.length || Expr.isAmino(o.elements[0]))); + }, encode(message: Expr_CreateList, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.elements) { Expr.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -1698,6 +1785,12 @@ export const Expr_CreateList = { typeUrl: "/google.api.expr.v1beta1.CreateList", value: Expr_CreateList.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Expr_CreateList.typeUrl)) { + return; + } + Expr.registerTypeUrl(); } }; function createBaseExpr_CreateStruct(): Expr_CreateStruct { @@ -1718,6 +1811,15 @@ function createBaseExpr_CreateStruct(): Expr_CreateStruct { */ export const Expr_CreateStruct = { typeUrl: "/google.api.expr.v1beta1.CreateStruct", + is(o: any): o is Expr_CreateStruct { + return o && (o.$typeUrl === Expr_CreateStruct.typeUrl || typeof o.type === "string" && Array.isArray(o.entries) && (!o.entries.length || Expr_CreateStruct_Entry.is(o.entries[0]))); + }, + isSDK(o: any): o is Expr_CreateStructSDKType { + return o && (o.$typeUrl === Expr_CreateStruct.typeUrl || typeof o.type === "string" && Array.isArray(o.entries) && (!o.entries.length || Expr_CreateStruct_Entry.isSDK(o.entries[0]))); + }, + isAmino(o: any): o is Expr_CreateStructAmino { + return o && (o.$typeUrl === Expr_CreateStruct.typeUrl || typeof o.type === "string" && Array.isArray(o.entries) && (!o.entries.length || Expr_CreateStruct_Entry.isAmino(o.entries[0]))); + }, encode(message: Expr_CreateStruct, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.type !== "") { writer.uint32(10).string(message.type); @@ -1817,6 +1919,12 @@ export const Expr_CreateStruct = { typeUrl: "/google.api.expr.v1beta1.CreateStruct", value: Expr_CreateStruct.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Expr_CreateStruct.typeUrl)) { + return; + } + Expr_CreateStruct_Entry.registerTypeUrl(); } }; function createBaseExpr_CreateStruct_Entry(): Expr_CreateStruct_Entry { @@ -1835,6 +1943,15 @@ function createBaseExpr_CreateStruct_Entry(): Expr_CreateStruct_Entry { */ export const Expr_CreateStruct_Entry = { typeUrl: "/google.api.expr.v1beta1.Entry", + is(o: any): o is Expr_CreateStruct_Entry { + return o && (o.$typeUrl === Expr_CreateStruct_Entry.typeUrl || typeof o.id === "number"); + }, + isSDK(o: any): o is Expr_CreateStruct_EntrySDKType { + return o && (o.$typeUrl === Expr_CreateStruct_Entry.typeUrl || typeof o.id === "number"); + }, + isAmino(o: any): o is Expr_CreateStruct_EntryAmino { + return o && (o.$typeUrl === Expr_CreateStruct_Entry.typeUrl || typeof o.id === "number"); + }, encode(message: Expr_CreateStruct_Entry, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.id !== 0) { writer.uint32(8).int32(message.id); @@ -1958,6 +2075,12 @@ export const Expr_CreateStruct_Entry = { typeUrl: "/google.api.expr.v1beta1.Entry", value: Expr_CreateStruct_Entry.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Expr_CreateStruct_Entry.typeUrl)) { + return; + } + Expr.registerTypeUrl(); } }; function createBaseExpr_Comprehension(): Expr_Comprehension { @@ -2004,6 +2127,15 @@ function createBaseExpr_Comprehension(): Expr_Comprehension { */ export const Expr_Comprehension = { typeUrl: "/google.api.expr.v1beta1.Comprehension", + is(o: any): o is Expr_Comprehension { + return o && (o.$typeUrl === Expr_Comprehension.typeUrl || typeof o.iterVar === "string" && typeof o.accuVar === "string"); + }, + isSDK(o: any): o is Expr_ComprehensionSDKType { + return o && (o.$typeUrl === Expr_Comprehension.typeUrl || typeof o.iter_var === "string" && typeof o.accu_var === "string"); + }, + isAmino(o: any): o is Expr_ComprehensionAmino { + return o && (o.$typeUrl === Expr_Comprehension.typeUrl || typeof o.iter_var === "string" && typeof o.accu_var === "string"); + }, encode(message: Expr_Comprehension, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.iterVar !== "") { writer.uint32(10).string(message.iterVar); @@ -2178,6 +2310,12 @@ export const Expr_Comprehension = { typeUrl: "/google.api.expr.v1beta1.Comprehension", value: Expr_Comprehension.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Expr_Comprehension.typeUrl)) { + return; + } + Expr.registerTypeUrl(); } }; function createBaseLiteral(): Literal { @@ -2209,6 +2347,15 @@ function createBaseLiteral(): Literal { */ export const Literal = { typeUrl: "/google.api.expr.v1beta1.Literal", + is(o: any): o is Literal { + return o && o.$typeUrl === Literal.typeUrl; + }, + isSDK(o: any): o is LiteralSDKType { + return o && o.$typeUrl === Literal.typeUrl; + }, + isAmino(o: any): o is LiteralAmino { + return o && o.$typeUrl === Literal.typeUrl; + }, encode(message: Literal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.nullValue !== undefined) { writer.uint32(8).int32(message.nullValue); @@ -2381,5 +2528,6 @@ export const Literal = { typeUrl: "/google.api.expr.v1beta1.Literal", value: Literal.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/google/api/expr/v1beta1/source.ts b/__fixtures__/v-next/outputv2/google/api/expr/v1beta1/source.ts index b96c781232..1009cfff81 100644 --- a/__fixtures__/v-next/outputv2/google/api/expr/v1beta1/source.ts +++ b/__fixtures__/v-next/outputv2/google/api/expr/v1beta1/source.ts @@ -287,7 +287,8 @@ export const SourceInfo_PositionsEntry = { }, toProto(message: SourceInfo_PositionsEntry): Uint8Array { return SourceInfo_PositionsEntry.encode(message).finish(); - } + }, + registerTypeUrl() {} }; function createBaseSourceInfo(): SourceInfo { return { @@ -304,6 +305,15 @@ function createBaseSourceInfo(): SourceInfo { */ export const SourceInfo = { typeUrl: "/google.api.expr.v1beta1.SourceInfo", + is(o: any): o is SourceInfo { + return o && (o.$typeUrl === SourceInfo.typeUrl || typeof o.location === "string" && Array.isArray(o.lineOffsets) && (!o.lineOffsets.length || typeof o.lineOffsets[0] === "number") && isSet(o.positions)); + }, + isSDK(o: any): o is SourceInfoSDKType { + return o && (o.$typeUrl === SourceInfo.typeUrl || typeof o.location === "string" && Array.isArray(o.line_offsets) && (!o.line_offsets.length || typeof o.line_offsets[0] === "number") && isSet(o.positions)); + }, + isAmino(o: any): o is SourceInfoAmino { + return o && (o.$typeUrl === SourceInfo.typeUrl || typeof o.location === "string" && Array.isArray(o.line_offsets) && (!o.line_offsets.length || typeof o.line_offsets[0] === "number") && isSet(o.positions)); + }, encode(message: SourceInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.location !== "") { writer.uint32(18).string(message.location); @@ -470,7 +480,8 @@ export const SourceInfo = { typeUrl: "/google.api.expr.v1beta1.SourceInfo", value: SourceInfo.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseSourcePosition(): SourcePosition { return { @@ -488,6 +499,15 @@ function createBaseSourcePosition(): SourcePosition { */ export const SourcePosition = { typeUrl: "/google.api.expr.v1beta1.SourcePosition", + is(o: any): o is SourcePosition { + return o && (o.$typeUrl === SourcePosition.typeUrl || typeof o.location === "string" && typeof o.offset === "number" && typeof o.line === "number" && typeof o.column === "number"); + }, + isSDK(o: any): o is SourcePositionSDKType { + return o && (o.$typeUrl === SourcePosition.typeUrl || typeof o.location === "string" && typeof o.offset === "number" && typeof o.line === "number" && typeof o.column === "number"); + }, + isAmino(o: any): o is SourcePositionAmino { + return o && (o.$typeUrl === SourcePosition.typeUrl || typeof o.location === "string" && typeof o.offset === "number" && typeof o.line === "number" && typeof o.column === "number"); + }, encode(message: SourcePosition, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.location !== "") { writer.uint32(10).string(message.location); @@ -607,5 +627,6 @@ export const SourcePosition = { typeUrl: "/google.api.expr.v1beta1.SourcePosition", value: SourcePosition.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/google/api/expr/v1beta1/value.ts b/__fixtures__/v-next/outputv2/google/api/expr/v1beta1/value.ts index db575ccde9..cbe58cdf6e 100644 --- a/__fixtures__/v-next/outputv2/google/api/expr/v1beta1/value.ts +++ b/__fixtures__/v-next/outputv2/google/api/expr/v1beta1/value.ts @@ -1,6 +1,7 @@ import { NullValue, nullValueFromJSON, nullValueToJSON } from "../../../protobuf/struct"; import { Any, AnyAmino, AnySDKType } from "../../../protobuf/any"; import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { GlobalDecoderRegistry } from "../../../../registry"; import { isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../../../../helpers"; import { JsonSafe } from "../../../../json-safe"; export const protobufPackage = "google.api.expr.v1beta1"; @@ -392,6 +393,15 @@ function createBaseValue(): Value { */ export const Value = { typeUrl: "/google.api.expr.v1beta1.Value", + is(o: any): o is Value { + return o && o.$typeUrl === Value.typeUrl; + }, + isSDK(o: any): o is ValueSDKType { + return o && o.$typeUrl === Value.typeUrl; + }, + isAmino(o: any): o is ValueAmino { + return o && o.$typeUrl === Value.typeUrl; + }, encode(message: Value, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.nullValue !== undefined) { writer.uint32(8).int32(message.nullValue); @@ -647,6 +657,13 @@ export const Value = { typeUrl: "/google.api.expr.v1beta1.Value", value: Value.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Value.typeUrl)) { + return; + } + MapValue.registerTypeUrl(); + ListValue.registerTypeUrl(); } }; function createBaseEnumValue(): EnumValue { @@ -663,6 +680,15 @@ function createBaseEnumValue(): EnumValue { */ export const EnumValue = { typeUrl: "/google.api.expr.v1beta1.EnumValue", + is(o: any): o is EnumValue { + return o && (o.$typeUrl === EnumValue.typeUrl || typeof o.type === "string" && typeof o.value === "number"); + }, + isSDK(o: any): o is EnumValueSDKType { + return o && (o.$typeUrl === EnumValue.typeUrl || typeof o.type === "string" && typeof o.value === "number"); + }, + isAmino(o: any): o is EnumValueAmino { + return o && (o.$typeUrl === EnumValue.typeUrl || typeof o.type === "string" && typeof o.value === "number"); + }, encode(message: EnumValue, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.type !== "") { writer.uint32(10).string(message.type); @@ -752,7 +778,8 @@ export const EnumValue = { typeUrl: "/google.api.expr.v1beta1.EnumValue", value: EnumValue.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseListValue(): ListValue { return { @@ -770,6 +797,15 @@ function createBaseListValue(): ListValue { */ export const ListValue = { typeUrl: "/google.api.expr.v1beta1.ListValue", + is(o: any): o is ListValue { + return o && (o.$typeUrl === ListValue.typeUrl || Array.isArray(o.values) && (!o.values.length || Value.is(o.values[0]))); + }, + isSDK(o: any): o is ListValueSDKType { + return o && (o.$typeUrl === ListValue.typeUrl || Array.isArray(o.values) && (!o.values.length || Value.isSDK(o.values[0]))); + }, + isAmino(o: any): o is ListValueAmino { + return o && (o.$typeUrl === ListValue.typeUrl || Array.isArray(o.values) && (!o.values.length || Value.isAmino(o.values[0]))); + }, encode(message: ListValue, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.values) { Value.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -854,6 +890,12 @@ export const ListValue = { typeUrl: "/google.api.expr.v1beta1.ListValue", value: ListValue.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ListValue.typeUrl)) { + return; + } + Value.registerTypeUrl(); } }; function createBaseMapValue(): MapValue { @@ -872,6 +914,15 @@ function createBaseMapValue(): MapValue { */ export const MapValue = { typeUrl: "/google.api.expr.v1beta1.MapValue", + is(o: any): o is MapValue { + return o && (o.$typeUrl === MapValue.typeUrl || Array.isArray(o.entries) && (!o.entries.length || MapValue_Entry.is(o.entries[0]))); + }, + isSDK(o: any): o is MapValueSDKType { + return o && (o.$typeUrl === MapValue.typeUrl || Array.isArray(o.entries) && (!o.entries.length || MapValue_Entry.isSDK(o.entries[0]))); + }, + isAmino(o: any): o is MapValueAmino { + return o && (o.$typeUrl === MapValue.typeUrl || Array.isArray(o.entries) && (!o.entries.length || MapValue_Entry.isAmino(o.entries[0]))); + }, encode(message: MapValue, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.entries) { MapValue_Entry.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -956,6 +1007,12 @@ export const MapValue = { typeUrl: "/google.api.expr.v1beta1.MapValue", value: MapValue.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MapValue.typeUrl)) { + return; + } + MapValue_Entry.registerTypeUrl(); } }; function createBaseMapValue_Entry(): MapValue_Entry { @@ -972,6 +1029,15 @@ function createBaseMapValue_Entry(): MapValue_Entry { */ export const MapValue_Entry = { typeUrl: "/google.api.expr.v1beta1.Entry", + is(o: any): o is MapValue_Entry { + return o && o.$typeUrl === MapValue_Entry.typeUrl; + }, + isSDK(o: any): o is MapValue_EntrySDKType { + return o && o.$typeUrl === MapValue_Entry.typeUrl; + }, + isAmino(o: any): o is MapValue_EntryAmino { + return o && o.$typeUrl === MapValue_Entry.typeUrl; + }, encode(message: MapValue_Entry, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.key !== undefined) { Value.encode(message.key, writer.uint32(10).fork()).ldelim(); @@ -1065,5 +1131,11 @@ export const MapValue_Entry = { typeUrl: "/google.api.expr.v1beta1.Entry", value: MapValue_Entry.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MapValue_Entry.typeUrl)) { + return; + } + Value.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/google/api/http.ts b/__fixtures__/v-next/outputv2/google/api/http.ts index ff5d727095..452e3b1521 100644 --- a/__fixtures__/v-next/outputv2/google/api/http.ts +++ b/__fixtures__/v-next/outputv2/google/api/http.ts @@ -1,6 +1,7 @@ import { BinaryReader, BinaryWriter } from "../../binary"; import { isSet, DeepPartial } from "../../helpers"; import { JsonSafe } from "../../json-safe"; +import { GlobalDecoderRegistry } from "../../registry"; export const protobufPackage = "google.api"; /** * Defines the HTTP configuration for an API service. It contains a list of @@ -1100,6 +1101,15 @@ function createBaseHttp(): Http { */ export const Http = { typeUrl: "/google.api.Http", + is(o: any): o is Http { + return o && (o.$typeUrl === Http.typeUrl || Array.isArray(o.rules) && (!o.rules.length || HttpRule.is(o.rules[0])) && typeof o.fullyDecodeReservedExpansion === "boolean"); + }, + isSDK(o: any): o is HttpSDKType { + return o && (o.$typeUrl === Http.typeUrl || Array.isArray(o.rules) && (!o.rules.length || HttpRule.isSDK(o.rules[0])) && typeof o.fully_decode_reserved_expansion === "boolean"); + }, + isAmino(o: any): o is HttpAmino { + return o && (o.$typeUrl === Http.typeUrl || Array.isArray(o.rules) && (!o.rules.length || HttpRule.isAmino(o.rules[0])) && typeof o.fully_decode_reserved_expansion === "boolean"); + }, encode(message: Http, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.rules) { HttpRule.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -1199,6 +1209,12 @@ export const Http = { typeUrl: "/google.api.Http", value: Http.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Http.typeUrl)) { + return; + } + HttpRule.registerTypeUrl(); } }; function createBaseHttpRule(): HttpRule { @@ -1491,6 +1507,15 @@ function createBaseHttpRule(): HttpRule { */ export const HttpRule = { typeUrl: "/google.api.HttpRule", + is(o: any): o is HttpRule { + return o && (o.$typeUrl === HttpRule.typeUrl || typeof o.selector === "string" && typeof o.body === "string" && typeof o.responseBody === "string" && Array.isArray(o.additionalBindings) && (!o.additionalBindings.length || HttpRule.is(o.additionalBindings[0]))); + }, + isSDK(o: any): o is HttpRuleSDKType { + return o && (o.$typeUrl === HttpRule.typeUrl || typeof o.selector === "string" && typeof o.body === "string" && typeof o.response_body === "string" && Array.isArray(o.additional_bindings) && (!o.additional_bindings.length || HttpRule.isSDK(o.additional_bindings[0]))); + }, + isAmino(o: any): o is HttpRuleAmino { + return o && (o.$typeUrl === HttpRule.typeUrl || typeof o.selector === "string" && typeof o.body === "string" && typeof o.response_body === "string" && Array.isArray(o.additional_bindings) && (!o.additional_bindings.length || HttpRule.isAmino(o.additional_bindings[0]))); + }, encode(message: HttpRule, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.selector !== "") { writer.uint32(10).string(message.selector); @@ -1712,6 +1737,13 @@ export const HttpRule = { typeUrl: "/google.api.HttpRule", value: HttpRule.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(HttpRule.typeUrl)) { + return; + } + CustomHttpPattern.registerTypeUrl(); + HttpRule.registerTypeUrl(); } }; function createBaseCustomHttpPattern(): CustomHttpPattern { @@ -1728,6 +1760,15 @@ function createBaseCustomHttpPattern(): CustomHttpPattern { */ export const CustomHttpPattern = { typeUrl: "/google.api.CustomHttpPattern", + is(o: any): o is CustomHttpPattern { + return o && (o.$typeUrl === CustomHttpPattern.typeUrl || typeof o.kind === "string" && typeof o.path === "string"); + }, + isSDK(o: any): o is CustomHttpPatternSDKType { + return o && (o.$typeUrl === CustomHttpPattern.typeUrl || typeof o.kind === "string" && typeof o.path === "string"); + }, + isAmino(o: any): o is CustomHttpPatternAmino { + return o && (o.$typeUrl === CustomHttpPattern.typeUrl || typeof o.kind === "string" && typeof o.path === "string"); + }, encode(message: CustomHttpPattern, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.kind !== "") { writer.uint32(10).string(message.kind); @@ -1817,5 +1858,6 @@ export const CustomHttpPattern = { typeUrl: "/google.api.CustomHttpPattern", value: CustomHttpPattern.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/google/api/httpbody.ts b/__fixtures__/v-next/outputv2/google/api/httpbody.ts index 25ee719e17..8ea3093e9f 100644 --- a/__fixtures__/v-next/outputv2/google/api/httpbody.ts +++ b/__fixtures__/v-next/outputv2/google/api/httpbody.ts @@ -247,6 +247,15 @@ function createBaseHttpBody(): HttpBody { */ export const HttpBody = { typeUrl: "/google.api.HttpBody", + is(o: any): o is HttpBody { + return o && (o.$typeUrl === HttpBody.typeUrl || typeof o.contentType === "string" && (o.data instanceof Uint8Array || typeof o.data === "string") && Array.isArray(o.extensions) && (!o.extensions.length || Any.is(o.extensions[0]))); + }, + isSDK(o: any): o is HttpBodySDKType { + return o && (o.$typeUrl === HttpBody.typeUrl || typeof o.content_type === "string" && (o.data instanceof Uint8Array || typeof o.data === "string") && Array.isArray(o.extensions) && (!o.extensions.length || Any.isSDK(o.extensions[0]))); + }, + isAmino(o: any): o is HttpBodyAmino { + return o && (o.$typeUrl === HttpBody.typeUrl || typeof o.content_type === "string" && (o.data instanceof Uint8Array || typeof o.data === "string") && Array.isArray(o.extensions) && (!o.extensions.length || Any.isAmino(o.extensions[0]))); + }, encode(message: HttpBody, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.contentType !== "") { writer.uint32(10).string(message.contentType); @@ -361,5 +370,6 @@ export const HttpBody = { typeUrl: "/google.api.HttpBody", value: HttpBody.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/google/api/label.ts b/__fixtures__/v-next/outputv2/google/api/label.ts index a34a693d89..0559a756cb 100644 --- a/__fixtures__/v-next/outputv2/google/api/label.ts +++ b/__fixtures__/v-next/outputv2/google/api/label.ts @@ -1,5 +1,5 @@ -import { BinaryReader, BinaryWriter } from "../../binary"; import { isSet, DeepPartial } from "../../helpers"; +import { BinaryReader, BinaryWriter } from "../../binary"; import { JsonSafe } from "../../json-safe"; export const protobufPackage = "google.api"; /** Value types that can be used as label values. */ @@ -118,6 +118,15 @@ function createBaseLabelDescriptor(): LabelDescriptor { */ export const LabelDescriptor = { typeUrl: "/google.api.LabelDescriptor", + is(o: any): o is LabelDescriptor { + return o && (o.$typeUrl === LabelDescriptor.typeUrl || typeof o.key === "string" && isSet(o.valueType) && typeof o.description === "string"); + }, + isSDK(o: any): o is LabelDescriptorSDKType { + return o && (o.$typeUrl === LabelDescriptor.typeUrl || typeof o.key === "string" && isSet(o.value_type) && typeof o.description === "string"); + }, + isAmino(o: any): o is LabelDescriptorAmino { + return o && (o.$typeUrl === LabelDescriptor.typeUrl || typeof o.key === "string" && isSet(o.value_type) && typeof o.description === "string"); + }, encode(message: LabelDescriptor, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.key !== "") { writer.uint32(10).string(message.key); @@ -222,5 +231,6 @@ export const LabelDescriptor = { typeUrl: "/google.api.LabelDescriptor", value: LabelDescriptor.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/google/api/log.ts b/__fixtures__/v-next/outputv2/google/api/log.ts index 1b1b0579a8..c65acc2330 100644 --- a/__fixtures__/v-next/outputv2/google/api/log.ts +++ b/__fixtures__/v-next/outputv2/google/api/log.ts @@ -2,6 +2,7 @@ import { LabelDescriptor, LabelDescriptorAmino, LabelDescriptorSDKType } from ". import { BinaryReader, BinaryWriter } from "../../binary"; import { isSet, DeepPartial } from "../../helpers"; import { JsonSafe } from "../../json-safe"; +import { GlobalDecoderRegistry } from "../../registry"; export const protobufPackage = "google.api"; /** * A description of a log type. Example in YAML format: @@ -129,6 +130,15 @@ function createBaseLogDescriptor(): LogDescriptor { */ export const LogDescriptor = { typeUrl: "/google.api.LogDescriptor", + is(o: any): o is LogDescriptor { + return o && (o.$typeUrl === LogDescriptor.typeUrl || typeof o.name === "string" && Array.isArray(o.labels) && (!o.labels.length || LabelDescriptor.is(o.labels[0])) && typeof o.description === "string" && typeof o.displayName === "string"); + }, + isSDK(o: any): o is LogDescriptorSDKType { + return o && (o.$typeUrl === LogDescriptor.typeUrl || typeof o.name === "string" && Array.isArray(o.labels) && (!o.labels.length || LabelDescriptor.isSDK(o.labels[0])) && typeof o.description === "string" && typeof o.display_name === "string"); + }, + isAmino(o: any): o is LogDescriptorAmino { + return o && (o.$typeUrl === LogDescriptor.typeUrl || typeof o.name === "string" && Array.isArray(o.labels) && (!o.labels.length || LabelDescriptor.isAmino(o.labels[0])) && typeof o.description === "string" && typeof o.display_name === "string"); + }, encode(message: LogDescriptor, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -258,5 +268,11 @@ export const LogDescriptor = { typeUrl: "/google.api.LogDescriptor", value: LogDescriptor.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(LogDescriptor.typeUrl)) { + return; + } + LabelDescriptor.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/google/api/logging.ts b/__fixtures__/v-next/outputv2/google/api/logging.ts index 7d99bf6a4c..81816454f7 100644 --- a/__fixtures__/v-next/outputv2/google/api/logging.ts +++ b/__fixtures__/v-next/outputv2/google/api/logging.ts @@ -1,6 +1,7 @@ import { BinaryReader, BinaryWriter } from "../../binary"; import { JsonSafe } from "../../json-safe"; import { DeepPartial, isSet } from "../../helpers"; +import { GlobalDecoderRegistry } from "../../registry"; export const protobufPackage = "google.api"; /** * Logging configuration of the service. @@ -251,6 +252,15 @@ function createBaseLogging(): Logging { */ export const Logging = { typeUrl: "/google.api.Logging", + is(o: any): o is Logging { + return o && (o.$typeUrl === Logging.typeUrl || Array.isArray(o.producerDestinations) && (!o.producerDestinations.length || Logging_LoggingDestination.is(o.producerDestinations[0])) && Array.isArray(o.consumerDestinations) && (!o.consumerDestinations.length || Logging_LoggingDestination.is(o.consumerDestinations[0]))); + }, + isSDK(o: any): o is LoggingSDKType { + return o && (o.$typeUrl === Logging.typeUrl || Array.isArray(o.producer_destinations) && (!o.producer_destinations.length || Logging_LoggingDestination.isSDK(o.producer_destinations[0])) && Array.isArray(o.consumer_destinations) && (!o.consumer_destinations.length || Logging_LoggingDestination.isSDK(o.consumer_destinations[0]))); + }, + isAmino(o: any): o is LoggingAmino { + return o && (o.$typeUrl === Logging.typeUrl || Array.isArray(o.producer_destinations) && (!o.producer_destinations.length || Logging_LoggingDestination.isAmino(o.producer_destinations[0])) && Array.isArray(o.consumer_destinations) && (!o.consumer_destinations.length || Logging_LoggingDestination.isAmino(o.consumer_destinations[0]))); + }, encode(message: Logging, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.producerDestinations) { Logging_LoggingDestination.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -360,6 +370,12 @@ export const Logging = { typeUrl: "/google.api.Logging", value: Logging.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Logging.typeUrl)) { + return; + } + Logging_LoggingDestination.registerTypeUrl(); } }; function createBaseLogging_LoggingDestination(): Logging_LoggingDestination { @@ -377,6 +393,15 @@ function createBaseLogging_LoggingDestination(): Logging_LoggingDestination { */ export const Logging_LoggingDestination = { typeUrl: "/google.api.LoggingDestination", + is(o: any): o is Logging_LoggingDestination { + return o && (o.$typeUrl === Logging_LoggingDestination.typeUrl || typeof o.monitoredResource === "string" && Array.isArray(o.logs) && (!o.logs.length || typeof o.logs[0] === "string")); + }, + isSDK(o: any): o is Logging_LoggingDestinationSDKType { + return o && (o.$typeUrl === Logging_LoggingDestination.typeUrl || typeof o.monitored_resource === "string" && Array.isArray(o.logs) && (!o.logs.length || typeof o.logs[0] === "string")); + }, + isAmino(o: any): o is Logging_LoggingDestinationAmino { + return o && (o.$typeUrl === Logging_LoggingDestination.typeUrl || typeof o.monitored_resource === "string" && Array.isArray(o.logs) && (!o.logs.length || typeof o.logs[0] === "string")); + }, encode(message: Logging_LoggingDestination, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.monitoredResource !== "") { writer.uint32(26).string(message.monitoredResource); @@ -476,5 +501,6 @@ export const Logging_LoggingDestination = { typeUrl: "/google.api.LoggingDestination", value: Logging_LoggingDestination.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/google/api/metric.ts b/__fixtures__/v-next/outputv2/google/api/metric.ts index f098887c9a..3b9d05548a 100644 --- a/__fixtures__/v-next/outputv2/google/api/metric.ts +++ b/__fixtures__/v-next/outputv2/google/api/metric.ts @@ -1,8 +1,9 @@ import { LaunchStage, launchStageFromJSON, launchStageToJSON } from "./launch_stage"; import { Duration, DurationAmino, DurationSDKType } from "../protobuf/duration"; import { LabelDescriptor, LabelDescriptorAmino, LabelDescriptorSDKType } from "./label"; -import { BinaryReader, BinaryWriter } from "../../binary"; import { isSet, DeepPartial, isObject } from "../../helpers"; +import { BinaryReader, BinaryWriter } from "../../binary"; +import { GlobalDecoderRegistry } from "../../registry"; import { JsonSafe } from "../../json-safe"; export const protobufPackage = "google.api"; /** @@ -718,6 +719,15 @@ function createBaseMetricDescriptor(): MetricDescriptor { */ export const MetricDescriptor = { typeUrl: "/google.api.MetricDescriptor", + is(o: any): o is MetricDescriptor { + return o && (o.$typeUrl === MetricDescriptor.typeUrl || typeof o.name === "string" && typeof o.type === "string" && Array.isArray(o.labels) && (!o.labels.length || LabelDescriptor.is(o.labels[0])) && isSet(o.metricKind) && isSet(o.valueType) && typeof o.unit === "string" && typeof o.description === "string" && typeof o.displayName === "string" && isSet(o.launchStage) && Array.isArray(o.monitoredResourceTypes) && (!o.monitoredResourceTypes.length || typeof o.monitoredResourceTypes[0] === "string")); + }, + isSDK(o: any): o is MetricDescriptorSDKType { + return o && (o.$typeUrl === MetricDescriptor.typeUrl || typeof o.name === "string" && typeof o.type === "string" && Array.isArray(o.labels) && (!o.labels.length || LabelDescriptor.isSDK(o.labels[0])) && isSet(o.metric_kind) && isSet(o.value_type) && typeof o.unit === "string" && typeof o.description === "string" && typeof o.display_name === "string" && isSet(o.launch_stage) && Array.isArray(o.monitored_resource_types) && (!o.monitored_resource_types.length || typeof o.monitored_resource_types[0] === "string")); + }, + isAmino(o: any): o is MetricDescriptorAmino { + return o && (o.$typeUrl === MetricDescriptor.typeUrl || typeof o.name === "string" && typeof o.type === "string" && Array.isArray(o.labels) && (!o.labels.length || LabelDescriptor.isAmino(o.labels[0])) && isSet(o.metric_kind) && isSet(o.value_type) && typeof o.unit === "string" && typeof o.description === "string" && typeof o.display_name === "string" && isSet(o.launch_stage) && Array.isArray(o.monitored_resource_types) && (!o.monitored_resource_types.length || typeof o.monitored_resource_types[0] === "string")); + }, encode(message: MetricDescriptor, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -964,6 +974,13 @@ export const MetricDescriptor = { typeUrl: "/google.api.MetricDescriptor", value: MetricDescriptor.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MetricDescriptor.typeUrl)) { + return; + } + LabelDescriptor.registerTypeUrl(); + MetricDescriptor_MetricDescriptorMetadata.registerTypeUrl(); } }; function createBaseMetricDescriptor_MetricDescriptorMetadata(): MetricDescriptor_MetricDescriptorMetadata { @@ -981,6 +998,15 @@ function createBaseMetricDescriptor_MetricDescriptorMetadata(): MetricDescriptor */ export const MetricDescriptor_MetricDescriptorMetadata = { typeUrl: "/google.api.MetricDescriptorMetadata", + is(o: any): o is MetricDescriptor_MetricDescriptorMetadata { + return o && (o.$typeUrl === MetricDescriptor_MetricDescriptorMetadata.typeUrl || isSet(o.launchStage)); + }, + isSDK(o: any): o is MetricDescriptor_MetricDescriptorMetadataSDKType { + return o && (o.$typeUrl === MetricDescriptor_MetricDescriptorMetadata.typeUrl || isSet(o.launch_stage)); + }, + isAmino(o: any): o is MetricDescriptor_MetricDescriptorMetadataAmino { + return o && (o.$typeUrl === MetricDescriptor_MetricDescriptorMetadata.typeUrl || isSet(o.launch_stage)); + }, encode(message: MetricDescriptor_MetricDescriptorMetadata, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.launchStage !== 0) { writer.uint32(8).int32(message.launchStage); @@ -1089,7 +1115,8 @@ export const MetricDescriptor_MetricDescriptorMetadata = { typeUrl: "/google.api.MetricDescriptorMetadata", value: MetricDescriptor_MetricDescriptorMetadata.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMetric_LabelsEntry(): Metric_LabelsEntry { return { @@ -1186,7 +1213,8 @@ export const Metric_LabelsEntry = { }, toProto(message: Metric_LabelsEntry): Uint8Array { return Metric_LabelsEntry.encode(message).finish(); - } + }, + registerTypeUrl() {} }; function createBaseMetric(): Metric { return { @@ -1203,6 +1231,15 @@ function createBaseMetric(): Metric { */ export const Metric = { typeUrl: "/google.api.Metric", + is(o: any): o is Metric { + return o && (o.$typeUrl === Metric.typeUrl || typeof o.type === "string" && isSet(o.labels)); + }, + isSDK(o: any): o is MetricSDKType { + return o && (o.$typeUrl === Metric.typeUrl || typeof o.type === "string" && isSet(o.labels)); + }, + isAmino(o: any): o is MetricAmino { + return o && (o.$typeUrl === Metric.typeUrl || typeof o.type === "string" && isSet(o.labels)); + }, encode(message: Metric, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.type !== "") { writer.uint32(26).string(message.type); @@ -1335,5 +1372,6 @@ export const Metric = { typeUrl: "/google.api.Metric", value: Metric.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/google/api/monitored_resource.ts b/__fixtures__/v-next/outputv2/google/api/monitored_resource.ts index eb8b492e0d..8c322fe0f6 100644 --- a/__fixtures__/v-next/outputv2/google/api/monitored_resource.ts +++ b/__fixtures__/v-next/outputv2/google/api/monitored_resource.ts @@ -1,9 +1,10 @@ import { LabelDescriptor, LabelDescriptorAmino, LabelDescriptorSDKType } from "./label"; import { LaunchStage, launchStageFromJSON, launchStageToJSON } from "./launch_stage"; import { Struct, StructAmino, StructSDKType } from "../protobuf/struct"; -import { BinaryReader, BinaryWriter } from "../../binary"; import { isSet, DeepPartial, isObject } from "../../helpers"; +import { BinaryReader, BinaryWriter } from "../../binary"; import { JsonSafe } from "../../json-safe"; +import { GlobalDecoderRegistry } from "../../registry"; export const protobufPackage = "google.api"; /** * An object that describes the schema of a [MonitoredResource][google.api.MonitoredResource] object using a @@ -424,6 +425,15 @@ function createBaseMonitoredResourceDescriptor(): MonitoredResourceDescriptor { */ export const MonitoredResourceDescriptor = { typeUrl: "/google.api.MonitoredResourceDescriptor", + is(o: any): o is MonitoredResourceDescriptor { + return o && (o.$typeUrl === MonitoredResourceDescriptor.typeUrl || typeof o.name === "string" && typeof o.type === "string" && typeof o.displayName === "string" && typeof o.description === "string" && Array.isArray(o.labels) && (!o.labels.length || LabelDescriptor.is(o.labels[0])) && isSet(o.launchStage)); + }, + isSDK(o: any): o is MonitoredResourceDescriptorSDKType { + return o && (o.$typeUrl === MonitoredResourceDescriptor.typeUrl || typeof o.name === "string" && typeof o.type === "string" && typeof o.display_name === "string" && typeof o.description === "string" && Array.isArray(o.labels) && (!o.labels.length || LabelDescriptor.isSDK(o.labels[0])) && isSet(o.launch_stage)); + }, + isAmino(o: any): o is MonitoredResourceDescriptorAmino { + return o && (o.$typeUrl === MonitoredResourceDescriptor.typeUrl || typeof o.name === "string" && typeof o.type === "string" && typeof o.display_name === "string" && typeof o.description === "string" && Array.isArray(o.labels) && (!o.labels.length || LabelDescriptor.isAmino(o.labels[0])) && isSet(o.launch_stage)); + }, encode(message: MonitoredResourceDescriptor, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(42).string(message.name); @@ -583,6 +593,12 @@ export const MonitoredResourceDescriptor = { typeUrl: "/google.api.MonitoredResourceDescriptor", value: MonitoredResourceDescriptor.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MonitoredResourceDescriptor.typeUrl)) { + return; + } + LabelDescriptor.registerTypeUrl(); } }; function createBaseMonitoredResource_LabelsEntry(): MonitoredResource_LabelsEntry { @@ -680,7 +696,8 @@ export const MonitoredResource_LabelsEntry = { }, toProto(message: MonitoredResource_LabelsEntry): Uint8Array { return MonitoredResource_LabelsEntry.encode(message).finish(); - } + }, + registerTypeUrl() {} }; function createBaseMonitoredResource(): MonitoredResource { return { @@ -708,6 +725,15 @@ function createBaseMonitoredResource(): MonitoredResource { */ export const MonitoredResource = { typeUrl: "/google.api.MonitoredResource", + is(o: any): o is MonitoredResource { + return o && (o.$typeUrl === MonitoredResource.typeUrl || typeof o.type === "string" && isSet(o.labels)); + }, + isSDK(o: any): o is MonitoredResourceSDKType { + return o && (o.$typeUrl === MonitoredResource.typeUrl || typeof o.type === "string" && isSet(o.labels)); + }, + isAmino(o: any): o is MonitoredResourceAmino { + return o && (o.$typeUrl === MonitoredResource.typeUrl || typeof o.type === "string" && isSet(o.labels)); + }, encode(message: MonitoredResource, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.type !== "") { writer.uint32(10).string(message.type); @@ -840,7 +866,8 @@ export const MonitoredResource = { typeUrl: "/google.api.MonitoredResource", value: MonitoredResource.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMonitoredResourceMetadata_UserLabelsEntry(): MonitoredResourceMetadata_UserLabelsEntry { return { @@ -937,7 +964,8 @@ export const MonitoredResourceMetadata_UserLabelsEntry = { }, toProto(message: MonitoredResourceMetadata_UserLabelsEntry): Uint8Array { return MonitoredResourceMetadata_UserLabelsEntry.encode(message).finish(); - } + }, + registerTypeUrl() {} }; function createBaseMonitoredResourceMetadata(): MonitoredResourceMetadata { return { @@ -958,6 +986,15 @@ function createBaseMonitoredResourceMetadata(): MonitoredResourceMetadata { */ export const MonitoredResourceMetadata = { typeUrl: "/google.api.MonitoredResourceMetadata", + is(o: any): o is MonitoredResourceMetadata { + return o && (o.$typeUrl === MonitoredResourceMetadata.typeUrl || isSet(o.userLabels)); + }, + isSDK(o: any): o is MonitoredResourceMetadataSDKType { + return o && (o.$typeUrl === MonitoredResourceMetadata.typeUrl || isSet(o.user_labels)); + }, + isAmino(o: any): o is MonitoredResourceMetadataAmino { + return o && (o.$typeUrl === MonitoredResourceMetadata.typeUrl || isSet(o.user_labels)); + }, encode(message: MonitoredResourceMetadata, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.systemLabels !== undefined) { Struct.encode(message.systemLabels, writer.uint32(10).fork()).ldelim(); @@ -1092,5 +1129,11 @@ export const MonitoredResourceMetadata = { typeUrl: "/google.api.MonitoredResourceMetadata", value: MonitoredResourceMetadata.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MonitoredResourceMetadata.typeUrl)) { + return; + } + Struct.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/google/api/monitoring.ts b/__fixtures__/v-next/outputv2/google/api/monitoring.ts index ee573e50ef..52ca965f99 100644 --- a/__fixtures__/v-next/outputv2/google/api/monitoring.ts +++ b/__fixtures__/v-next/outputv2/google/api/monitoring.ts @@ -1,6 +1,7 @@ import { BinaryReader, BinaryWriter } from "../../binary"; import { JsonSafe } from "../../json-safe"; import { DeepPartial, isSet } from "../../helpers"; +import { GlobalDecoderRegistry } from "../../registry"; export const protobufPackage = "google.api"; /** * Monitoring configuration of the service. @@ -347,6 +348,15 @@ function createBaseMonitoring(): Monitoring { */ export const Monitoring = { typeUrl: "/google.api.Monitoring", + is(o: any): o is Monitoring { + return o && (o.$typeUrl === Monitoring.typeUrl || Array.isArray(o.producerDestinations) && (!o.producerDestinations.length || Monitoring_MonitoringDestination.is(o.producerDestinations[0])) && Array.isArray(o.consumerDestinations) && (!o.consumerDestinations.length || Monitoring_MonitoringDestination.is(o.consumerDestinations[0]))); + }, + isSDK(o: any): o is MonitoringSDKType { + return o && (o.$typeUrl === Monitoring.typeUrl || Array.isArray(o.producer_destinations) && (!o.producer_destinations.length || Monitoring_MonitoringDestination.isSDK(o.producer_destinations[0])) && Array.isArray(o.consumer_destinations) && (!o.consumer_destinations.length || Monitoring_MonitoringDestination.isSDK(o.consumer_destinations[0]))); + }, + isAmino(o: any): o is MonitoringAmino { + return o && (o.$typeUrl === Monitoring.typeUrl || Array.isArray(o.producer_destinations) && (!o.producer_destinations.length || Monitoring_MonitoringDestination.isAmino(o.producer_destinations[0])) && Array.isArray(o.consumer_destinations) && (!o.consumer_destinations.length || Monitoring_MonitoringDestination.isAmino(o.consumer_destinations[0]))); + }, encode(message: Monitoring, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.producerDestinations) { Monitoring_MonitoringDestination.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -456,6 +466,12 @@ export const Monitoring = { typeUrl: "/google.api.Monitoring", value: Monitoring.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Monitoring.typeUrl)) { + return; + } + Monitoring_MonitoringDestination.registerTypeUrl(); } }; function createBaseMonitoring_MonitoringDestination(): Monitoring_MonitoringDestination { @@ -473,6 +489,15 @@ function createBaseMonitoring_MonitoringDestination(): Monitoring_MonitoringDest */ export const Monitoring_MonitoringDestination = { typeUrl: "/google.api.MonitoringDestination", + is(o: any): o is Monitoring_MonitoringDestination { + return o && (o.$typeUrl === Monitoring_MonitoringDestination.typeUrl || typeof o.monitoredResource === "string" && Array.isArray(o.metrics) && (!o.metrics.length || typeof o.metrics[0] === "string")); + }, + isSDK(o: any): o is Monitoring_MonitoringDestinationSDKType { + return o && (o.$typeUrl === Monitoring_MonitoringDestination.typeUrl || typeof o.monitored_resource === "string" && Array.isArray(o.metrics) && (!o.metrics.length || typeof o.metrics[0] === "string")); + }, + isAmino(o: any): o is Monitoring_MonitoringDestinationAmino { + return o && (o.$typeUrl === Monitoring_MonitoringDestination.typeUrl || typeof o.monitored_resource === "string" && Array.isArray(o.metrics) && (!o.metrics.length || typeof o.metrics[0] === "string")); + }, encode(message: Monitoring_MonitoringDestination, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.monitoredResource !== "") { writer.uint32(10).string(message.monitoredResource); @@ -572,5 +597,6 @@ export const Monitoring_MonitoringDestination = { typeUrl: "/google.api.MonitoringDestination", value: Monitoring_MonitoringDestination.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/google/api/quota.ts b/__fixtures__/v-next/outputv2/google/api/quota.ts index e06324ed80..6bf0b4e7da 100644 --- a/__fixtures__/v-next/outputv2/google/api/quota.ts +++ b/__fixtures__/v-next/outputv2/google/api/quota.ts @@ -1,6 +1,7 @@ import { BinaryReader, BinaryWriter } from "../../binary"; import { JsonSafe } from "../../json-safe"; import { DeepPartial, isSet, isObject } from "../../helpers"; +import { GlobalDecoderRegistry } from "../../registry"; export const protobufPackage = "google.api"; /** * Quota configuration helps to achieve fairness and budgeting in service @@ -633,6 +634,15 @@ function createBaseQuota(): Quota { */ export const Quota = { typeUrl: "/google.api.Quota", + is(o: any): o is Quota { + return o && (o.$typeUrl === Quota.typeUrl || Array.isArray(o.limits) && (!o.limits.length || QuotaLimit.is(o.limits[0])) && Array.isArray(o.metricRules) && (!o.metricRules.length || MetricRule.is(o.metricRules[0]))); + }, + isSDK(o: any): o is QuotaSDKType { + return o && (o.$typeUrl === Quota.typeUrl || Array.isArray(o.limits) && (!o.limits.length || QuotaLimit.isSDK(o.limits[0])) && Array.isArray(o.metric_rules) && (!o.metric_rules.length || MetricRule.isSDK(o.metric_rules[0]))); + }, + isAmino(o: any): o is QuotaAmino { + return o && (o.$typeUrl === Quota.typeUrl || Array.isArray(o.limits) && (!o.limits.length || QuotaLimit.isAmino(o.limits[0])) && Array.isArray(o.metric_rules) && (!o.metric_rules.length || MetricRule.isAmino(o.metric_rules[0]))); + }, encode(message: Quota, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.limits) { QuotaLimit.encode(v!, writer.uint32(26).fork()).ldelim(); @@ -742,6 +752,13 @@ export const Quota = { typeUrl: "/google.api.Quota", value: Quota.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Quota.typeUrl)) { + return; + } + QuotaLimit.registerTypeUrl(); + MetricRule.registerTypeUrl(); } }; function createBaseMetricRule_MetricCostsEntry(): MetricRule_MetricCostsEntry { @@ -841,7 +858,8 @@ export const MetricRule_MetricCostsEntry = { }, toProto(message: MetricRule_MetricCostsEntry): Uint8Array { return MetricRule_MetricCostsEntry.encode(message).finish(); - } + }, + registerTypeUrl() {} }; function createBaseMetricRule(): MetricRule { return { @@ -858,6 +876,15 @@ function createBaseMetricRule(): MetricRule { */ export const MetricRule = { typeUrl: "/google.api.MetricRule", + is(o: any): o is MetricRule { + return o && (o.$typeUrl === MetricRule.typeUrl || typeof o.selector === "string" && isSet(o.metricCosts)); + }, + isSDK(o: any): o is MetricRuleSDKType { + return o && (o.$typeUrl === MetricRule.typeUrl || typeof o.selector === "string" && isSet(o.metric_costs)); + }, + isAmino(o: any): o is MetricRuleAmino { + return o && (o.$typeUrl === MetricRule.typeUrl || typeof o.selector === "string" && isSet(o.metric_costs)); + }, encode(message: MetricRule, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.selector !== "") { writer.uint32(10).string(message.selector); @@ -990,7 +1017,8 @@ export const MetricRule = { typeUrl: "/google.api.MetricRule", value: MetricRule.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQuotaLimit_ValuesEntry(): QuotaLimit_ValuesEntry { return { @@ -1089,7 +1117,8 @@ export const QuotaLimit_ValuesEntry = { }, toProto(message: QuotaLimit_ValuesEntry): Uint8Array { return QuotaLimit_ValuesEntry.encode(message).finish(); - } + }, + registerTypeUrl() {} }; function createBaseQuotaLimit(): QuotaLimit { return { @@ -1115,6 +1144,15 @@ function createBaseQuotaLimit(): QuotaLimit { */ export const QuotaLimit = { typeUrl: "/google.api.QuotaLimit", + is(o: any): o is QuotaLimit { + return o && (o.$typeUrl === QuotaLimit.typeUrl || typeof o.name === "string" && typeof o.description === "string" && typeof o.defaultLimit === "bigint" && typeof o.maxLimit === "bigint" && typeof o.freeTier === "bigint" && typeof o.duration === "string" && typeof o.metric === "string" && typeof o.unit === "string" && isSet(o.values) && typeof o.displayName === "string"); + }, + isSDK(o: any): o is QuotaLimitSDKType { + return o && (o.$typeUrl === QuotaLimit.typeUrl || typeof o.name === "string" && typeof o.description === "string" && typeof o.default_limit === "bigint" && typeof o.max_limit === "bigint" && typeof o.free_tier === "bigint" && typeof o.duration === "string" && typeof o.metric === "string" && typeof o.unit === "string" && isSet(o.values) && typeof o.display_name === "string"); + }, + isAmino(o: any): o is QuotaLimitAmino { + return o && (o.$typeUrl === QuotaLimit.typeUrl || typeof o.name === "string" && typeof o.description === "string" && typeof o.default_limit === "bigint" && typeof o.max_limit === "bigint" && typeof o.free_tier === "bigint" && typeof o.duration === "string" && typeof o.metric === "string" && typeof o.unit === "string" && isSet(o.values) && typeof o.display_name === "string"); + }, encode(message: QuotaLimit, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(50).string(message.name); @@ -1373,5 +1411,6 @@ export const QuotaLimit = { typeUrl: "/google.api.QuotaLimit", value: QuotaLimit.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/google/api/resource.ts b/__fixtures__/v-next/outputv2/google/api/resource.ts index a16e98ea4b..f721f874aa 100644 --- a/__fixtures__/v-next/outputv2/google/api/resource.ts +++ b/__fixtures__/v-next/outputv2/google/api/resource.ts @@ -1,5 +1,5 @@ -import { BinaryReader, BinaryWriter } from "../../binary"; import { isSet, DeepPartial } from "../../helpers"; +import { BinaryReader, BinaryWriter } from "../../binary"; import { JsonSafe } from "../../json-safe"; export const protobufPackage = "google.api"; /** @@ -613,6 +613,15 @@ function createBaseResourceDescriptor(): ResourceDescriptor { */ export const ResourceDescriptor = { typeUrl: "/google.api.ResourceDescriptor", + is(o: any): o is ResourceDescriptor { + return o && (o.$typeUrl === ResourceDescriptor.typeUrl || typeof o.type === "string" && Array.isArray(o.pattern) && (!o.pattern.length || typeof o.pattern[0] === "string") && typeof o.nameField === "string" && isSet(o.history) && typeof o.plural === "string" && typeof o.singular === "string" && Array.isArray(o.style)); + }, + isSDK(o: any): o is ResourceDescriptorSDKType { + return o && (o.$typeUrl === ResourceDescriptor.typeUrl || typeof o.type === "string" && Array.isArray(o.pattern) && (!o.pattern.length || typeof o.pattern[0] === "string") && typeof o.name_field === "string" && isSet(o.history) && typeof o.plural === "string" && typeof o.singular === "string" && Array.isArray(o.style)); + }, + isAmino(o: any): o is ResourceDescriptorAmino { + return o && (o.$typeUrl === ResourceDescriptor.typeUrl || typeof o.type === "string" && Array.isArray(o.pattern) && (!o.pattern.length || typeof o.pattern[0] === "string") && typeof o.name_field === "string" && isSet(o.history) && typeof o.plural === "string" && typeof o.singular === "string" && Array.isArray(o.style)); + }, encode(message: ResourceDescriptor, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.type !== "") { writer.uint32(10).string(message.type); @@ -806,7 +815,8 @@ export const ResourceDescriptor = { typeUrl: "/google.api.ResourceDescriptor", value: ResourceDescriptor.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseResourceReference(): ResourceReference { return { @@ -823,6 +833,15 @@ function createBaseResourceReference(): ResourceReference { */ export const ResourceReference = { typeUrl: "/google.api.ResourceReference", + is(o: any): o is ResourceReference { + return o && (o.$typeUrl === ResourceReference.typeUrl || typeof o.type === "string" && typeof o.childType === "string"); + }, + isSDK(o: any): o is ResourceReferenceSDKType { + return o && (o.$typeUrl === ResourceReference.typeUrl || typeof o.type === "string" && typeof o.child_type === "string"); + }, + isAmino(o: any): o is ResourceReferenceAmino { + return o && (o.$typeUrl === ResourceReference.typeUrl || typeof o.type === "string" && typeof o.child_type === "string"); + }, encode(message: ResourceReference, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.type !== "") { writer.uint32(10).string(message.type); @@ -912,5 +931,6 @@ export const ResourceReference = { typeUrl: "/google.api.ResourceReference", value: ResourceReference.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/google/api/routing.ts b/__fixtures__/v-next/outputv2/google/api/routing.ts index 489208c30e..5aa248fc2a 100644 --- a/__fixtures__/v-next/outputv2/google/api/routing.ts +++ b/__fixtures__/v-next/outputv2/google/api/routing.ts @@ -1,6 +1,7 @@ import { BinaryReader, BinaryWriter } from "../../binary"; import { JsonSafe } from "../../json-safe"; import { DeepPartial, isSet } from "../../helpers"; +import { GlobalDecoderRegistry } from "../../registry"; export const protobufPackage = "google.api"; /** * Specifies the routing information that should be sent along with the request @@ -1654,6 +1655,15 @@ function createBaseRoutingRule(): RoutingRule { */ export const RoutingRule = { typeUrl: "/google.api.RoutingRule", + is(o: any): o is RoutingRule { + return o && (o.$typeUrl === RoutingRule.typeUrl || Array.isArray(o.routingParameters) && (!o.routingParameters.length || RoutingParameter.is(o.routingParameters[0]))); + }, + isSDK(o: any): o is RoutingRuleSDKType { + return o && (o.$typeUrl === RoutingRule.typeUrl || Array.isArray(o.routing_parameters) && (!o.routing_parameters.length || RoutingParameter.isSDK(o.routing_parameters[0]))); + }, + isAmino(o: any): o is RoutingRuleAmino { + return o && (o.$typeUrl === RoutingRule.typeUrl || Array.isArray(o.routing_parameters) && (!o.routing_parameters.length || RoutingParameter.isAmino(o.routing_parameters[0]))); + }, encode(message: RoutingRule, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.routingParameters) { RoutingParameter.encode(v!, writer.uint32(18).fork()).ldelim(); @@ -1738,6 +1748,12 @@ export const RoutingRule = { typeUrl: "/google.api.RoutingRule", value: RoutingRule.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(RoutingRule.typeUrl)) { + return; + } + RoutingParameter.registerTypeUrl(); } }; function createBaseRoutingParameter(): RoutingParameter { @@ -1754,6 +1770,15 @@ function createBaseRoutingParameter(): RoutingParameter { */ export const RoutingParameter = { typeUrl: "/google.api.RoutingParameter", + is(o: any): o is RoutingParameter { + return o && (o.$typeUrl === RoutingParameter.typeUrl || typeof o.field === "string" && typeof o.pathTemplate === "string"); + }, + isSDK(o: any): o is RoutingParameterSDKType { + return o && (o.$typeUrl === RoutingParameter.typeUrl || typeof o.field === "string" && typeof o.path_template === "string"); + }, + isAmino(o: any): o is RoutingParameterAmino { + return o && (o.$typeUrl === RoutingParameter.typeUrl || typeof o.field === "string" && typeof o.path_template === "string"); + }, encode(message: RoutingParameter, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.field !== "") { writer.uint32(10).string(message.field); @@ -1843,5 +1868,6 @@ export const RoutingParameter = { typeUrl: "/google.api.RoutingParameter", value: RoutingParameter.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/google/api/service.ts b/__fixtures__/v-next/outputv2/google/api/service.ts index 5aed57349a..d44e30dda9 100644 --- a/__fixtures__/v-next/outputv2/google/api/service.ts +++ b/__fixtures__/v-next/outputv2/google/api/service.ts @@ -19,6 +19,7 @@ import { SystemParameters, SystemParametersAmino, SystemParametersSDKType } from import { SourceInfo, SourceInfoAmino, SourceInfoSDKType } from "./source_info"; import { UInt32Value, UInt32ValueAmino, UInt32ValueSDKType } from "../protobuf/wrappers"; import { BinaryReader, BinaryWriter } from "../../binary"; +import { GlobalDecoderRegistry } from "../../registry"; import { isSet, DeepPartial } from "../../helpers"; import { JsonSafe } from "../../json-safe"; export const protobufPackage = "google.api"; @@ -463,6 +464,15 @@ function createBaseService(): Service { */ export const Service = { typeUrl: "/google.api.Service", + is(o: any): o is Service { + return o && (o.$typeUrl === Service.typeUrl || typeof o.name === "string" && typeof o.title === "string" && typeof o.producerProjectId === "string" && typeof o.id === "string" && Array.isArray(o.apis) && (!o.apis.length || Api.is(o.apis[0])) && Array.isArray(o.types) && (!o.types.length || Type.is(o.types[0])) && Array.isArray(o.enums) && (!o.enums.length || Enum.is(o.enums[0])) && Array.isArray(o.endpoints) && (!o.endpoints.length || Endpoint.is(o.endpoints[0])) && Array.isArray(o.logs) && (!o.logs.length || LogDescriptor.is(o.logs[0])) && Array.isArray(o.metrics) && (!o.metrics.length || MetricDescriptor.is(o.metrics[0])) && Array.isArray(o.monitoredResources) && (!o.monitoredResources.length || MonitoredResourceDescriptor.is(o.monitoredResources[0]))); + }, + isSDK(o: any): o is ServiceSDKType { + return o && (o.$typeUrl === Service.typeUrl || typeof o.name === "string" && typeof o.title === "string" && typeof o.producer_project_id === "string" && typeof o.id === "string" && Array.isArray(o.apis) && (!o.apis.length || Api.isSDK(o.apis[0])) && Array.isArray(o.types) && (!o.types.length || Type.isSDK(o.types[0])) && Array.isArray(o.enums) && (!o.enums.length || Enum.isSDK(o.enums[0])) && Array.isArray(o.endpoints) && (!o.endpoints.length || Endpoint.isSDK(o.endpoints[0])) && Array.isArray(o.logs) && (!o.logs.length || LogDescriptor.isSDK(o.logs[0])) && Array.isArray(o.metrics) && (!o.metrics.length || MetricDescriptor.isSDK(o.metrics[0])) && Array.isArray(o.monitored_resources) && (!o.monitored_resources.length || MonitoredResourceDescriptor.isSDK(o.monitored_resources[0]))); + }, + isAmino(o: any): o is ServiceAmino { + return o && (o.$typeUrl === Service.typeUrl || typeof o.name === "string" && typeof o.title === "string" && typeof o.producer_project_id === "string" && typeof o.id === "string" && Array.isArray(o.apis) && (!o.apis.length || Api.isAmino(o.apis[0])) && Array.isArray(o.types) && (!o.types.length || Type.isAmino(o.types[0])) && Array.isArray(o.enums) && (!o.enums.length || Enum.isAmino(o.enums[0])) && Array.isArray(o.endpoints) && (!o.endpoints.length || Endpoint.isAmino(o.endpoints[0])) && Array.isArray(o.logs) && (!o.logs.length || LogDescriptor.isAmino(o.logs[0])) && Array.isArray(o.metrics) && (!o.metrics.length || MetricDescriptor.isAmino(o.metrics[0])) && Array.isArray(o.monitored_resources) && (!o.monitored_resources.length || MonitoredResourceDescriptor.isAmino(o.monitored_resources[0]))); + }, encode(message: Service, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -995,5 +1005,31 @@ export const Service = { typeUrl: "/google.api.Service", value: Service.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Service.typeUrl)) { + return; + } + Api.registerTypeUrl(); + Type.registerTypeUrl(); + Enum.registerTypeUrl(); + Documentation.registerTypeUrl(); + Backend.registerTypeUrl(); + Http.registerTypeUrl(); + Quota.registerTypeUrl(); + Authentication.registerTypeUrl(); + Context.registerTypeUrl(); + Usage.registerTypeUrl(); + Endpoint.registerTypeUrl(); + Control.registerTypeUrl(); + LogDescriptor.registerTypeUrl(); + MetricDescriptor.registerTypeUrl(); + MonitoredResourceDescriptor.registerTypeUrl(); + Billing.registerTypeUrl(); + Logging.registerTypeUrl(); + Monitoring.registerTypeUrl(); + SystemParameters.registerTypeUrl(); + SourceInfo.registerTypeUrl(); + UInt32Value.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/google/api/servicecontrol/v1/check_error.ts b/__fixtures__/v-next/outputv2/google/api/servicecontrol/v1/check_error.ts index a52653ed7e..c52bf784d1 100644 --- a/__fixtures__/v-next/outputv2/google/api/servicecontrol/v1/check_error.ts +++ b/__fixtures__/v-next/outputv2/google/api/servicecontrol/v1/check_error.ts @@ -1,6 +1,7 @@ import { Status, StatusAmino, StatusSDKType } from "../../../rpc/status"; -import { BinaryReader, BinaryWriter } from "../../../../binary"; import { isSet, DeepPartial } from "../../../../helpers"; +import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { GlobalDecoderRegistry } from "../../../../registry"; import { JsonSafe } from "../../../../json-safe"; export const protobufPackage = "google.api.servicecontrol.v1"; /** Error codes for Check responses. */ @@ -294,6 +295,15 @@ function createBaseCheckError(): CheckError { */ export const CheckError = { typeUrl: "/google.api.servicecontrol.v1.CheckError", + is(o: any): o is CheckError { + return o && (o.$typeUrl === CheckError.typeUrl || isSet(o.code) && typeof o.subject === "string" && typeof o.detail === "string"); + }, + isSDK(o: any): o is CheckErrorSDKType { + return o && (o.$typeUrl === CheckError.typeUrl || isSet(o.code) && typeof o.subject === "string" && typeof o.detail === "string"); + }, + isAmino(o: any): o is CheckErrorAmino { + return o && (o.$typeUrl === CheckError.typeUrl || isSet(o.code) && typeof o.subject === "string" && typeof o.detail === "string"); + }, encode(message: CheckError, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.code !== 0) { writer.uint32(8).int32(message.code); @@ -415,5 +425,11 @@ export const CheckError = { typeUrl: "/google.api.servicecontrol.v1.CheckError", value: CheckError.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(CheckError.typeUrl)) { + return; + } + Status.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/google/api/servicecontrol/v1/distribution.ts b/__fixtures__/v-next/outputv2/google/api/servicecontrol/v1/distribution.ts index 97627ba7f7..458b426f18 100644 --- a/__fixtures__/v-next/outputv2/google/api/servicecontrol/v1/distribution.ts +++ b/__fixtures__/v-next/outputv2/google/api/servicecontrol/v1/distribution.ts @@ -1,5 +1,6 @@ import { Distribution_Exemplar, Distribution_ExemplarAmino, Distribution_ExemplarSDKType } from "../../distribution"; import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { GlobalDecoderRegistry } from "../../../../registry"; import { isSet, DeepPartial } from "../../../../helpers"; import { JsonSafe } from "../../../../json-safe"; export const protobufPackage = "google.api.servicecontrol.v1"; @@ -420,6 +421,15 @@ function createBaseDistribution(): Distribution { */ export const Distribution = { typeUrl: "/google.api.servicecontrol.v1.Distribution", + is(o: any): o is Distribution { + return o && (o.$typeUrl === Distribution.typeUrl || typeof o.count === "bigint" && typeof o.mean === "number" && typeof o.minimum === "number" && typeof o.maximum === "number" && typeof o.sumOfSquaredDeviation === "number" && Array.isArray(o.bucketCounts) && (!o.bucketCounts.length || typeof o.bucketCounts[0] === "bigint") && Array.isArray(o.exemplars) && (!o.exemplars.length || Distribution_Exemplar.is(o.exemplars[0]))); + }, + isSDK(o: any): o is DistributionSDKType { + return o && (o.$typeUrl === Distribution.typeUrl || typeof o.count === "bigint" && typeof o.mean === "number" && typeof o.minimum === "number" && typeof o.maximum === "number" && typeof o.sum_of_squared_deviation === "number" && Array.isArray(o.bucket_counts) && (!o.bucket_counts.length || typeof o.bucket_counts[0] === "bigint") && Array.isArray(o.exemplars) && (!o.exemplars.length || Distribution_Exemplar.isSDK(o.exemplars[0]))); + }, + isAmino(o: any): o is DistributionAmino { + return o && (o.$typeUrl === Distribution.typeUrl || typeof o.count === "bigint" && typeof o.mean === "number" && typeof o.minimum === "number" && typeof o.maximum === "number" && typeof o.sum_of_squared_deviation === "number" && Array.isArray(o.bucket_counts) && (!o.bucket_counts.length || typeof o.bucket_counts[0] === "bigint") && Array.isArray(o.exemplars) && (!o.exemplars.length || Distribution_Exemplar.isAmino(o.exemplars[0]))); + }, encode(message: Distribution, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.count !== BigInt(0)) { writer.uint32(8).int64(message.count); @@ -666,6 +676,15 @@ export const Distribution = { typeUrl: "/google.api.servicecontrol.v1.Distribution", value: Distribution.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Distribution.typeUrl)) { + return; + } + Distribution_LinearBuckets.registerTypeUrl(); + Distribution_ExponentialBuckets.registerTypeUrl(); + Distribution_ExplicitBuckets.registerTypeUrl(); + Distribution_Exemplar.registerTypeUrl(); } }; function createBaseDistribution_LinearBuckets(): Distribution_LinearBuckets { @@ -683,6 +702,15 @@ function createBaseDistribution_LinearBuckets(): Distribution_LinearBuckets { */ export const Distribution_LinearBuckets = { typeUrl: "/google.api.servicecontrol.v1.LinearBuckets", + is(o: any): o is Distribution_LinearBuckets { + return o && (o.$typeUrl === Distribution_LinearBuckets.typeUrl || typeof o.numFiniteBuckets === "number" && typeof o.width === "number" && typeof o.offset === "number"); + }, + isSDK(o: any): o is Distribution_LinearBucketsSDKType { + return o && (o.$typeUrl === Distribution_LinearBuckets.typeUrl || typeof o.num_finite_buckets === "number" && typeof o.width === "number" && typeof o.offset === "number"); + }, + isAmino(o: any): o is Distribution_LinearBucketsAmino { + return o && (o.$typeUrl === Distribution_LinearBuckets.typeUrl || typeof o.num_finite_buckets === "number" && typeof o.width === "number" && typeof o.offset === "number"); + }, encode(message: Distribution_LinearBuckets, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.numFiniteBuckets !== 0) { writer.uint32(8).int32(message.numFiniteBuckets); @@ -787,7 +815,8 @@ export const Distribution_LinearBuckets = { typeUrl: "/google.api.servicecontrol.v1.LinearBuckets", value: Distribution_LinearBuckets.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseDistribution_ExponentialBuckets(): Distribution_ExponentialBuckets { return { @@ -804,6 +833,15 @@ function createBaseDistribution_ExponentialBuckets(): Distribution_ExponentialBu */ export const Distribution_ExponentialBuckets = { typeUrl: "/google.api.servicecontrol.v1.ExponentialBuckets", + is(o: any): o is Distribution_ExponentialBuckets { + return o && (o.$typeUrl === Distribution_ExponentialBuckets.typeUrl || typeof o.numFiniteBuckets === "number" && typeof o.growthFactor === "number" && typeof o.scale === "number"); + }, + isSDK(o: any): o is Distribution_ExponentialBucketsSDKType { + return o && (o.$typeUrl === Distribution_ExponentialBuckets.typeUrl || typeof o.num_finite_buckets === "number" && typeof o.growth_factor === "number" && typeof o.scale === "number"); + }, + isAmino(o: any): o is Distribution_ExponentialBucketsAmino { + return o && (o.$typeUrl === Distribution_ExponentialBuckets.typeUrl || typeof o.num_finite_buckets === "number" && typeof o.growth_factor === "number" && typeof o.scale === "number"); + }, encode(message: Distribution_ExponentialBuckets, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.numFiniteBuckets !== 0) { writer.uint32(8).int32(message.numFiniteBuckets); @@ -908,7 +946,8 @@ export const Distribution_ExponentialBuckets = { typeUrl: "/google.api.servicecontrol.v1.ExponentialBuckets", value: Distribution_ExponentialBuckets.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseDistribution_ExplicitBuckets(): Distribution_ExplicitBuckets { return { @@ -923,6 +962,15 @@ function createBaseDistribution_ExplicitBuckets(): Distribution_ExplicitBuckets */ export const Distribution_ExplicitBuckets = { typeUrl: "/google.api.servicecontrol.v1.ExplicitBuckets", + is(o: any): o is Distribution_ExplicitBuckets { + return o && (o.$typeUrl === Distribution_ExplicitBuckets.typeUrl || Array.isArray(o.bounds) && (!o.bounds.length || typeof o.bounds[0] === "number")); + }, + isSDK(o: any): o is Distribution_ExplicitBucketsSDKType { + return o && (o.$typeUrl === Distribution_ExplicitBuckets.typeUrl || Array.isArray(o.bounds) && (!o.bounds.length || typeof o.bounds[0] === "number")); + }, + isAmino(o: any): o is Distribution_ExplicitBucketsAmino { + return o && (o.$typeUrl === Distribution_ExplicitBuckets.typeUrl || Array.isArray(o.bounds) && (!o.bounds.length || typeof o.bounds[0] === "number")); + }, encode(message: Distribution_ExplicitBuckets, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { writer.uint32(10).fork(); for (const v of message.bounds) { @@ -1016,5 +1064,6 @@ export const Distribution_ExplicitBuckets = { typeUrl: "/google.api.servicecontrol.v1.ExplicitBuckets", value: Distribution_ExplicitBuckets.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/google/api/servicecontrol/v1/http_request.ts b/__fixtures__/v-next/outputv2/google/api/servicecontrol/v1/http_request.ts index e26cc95b00..5c014f6bcf 100644 --- a/__fixtures__/v-next/outputv2/google/api/servicecontrol/v1/http_request.ts +++ b/__fixtures__/v-next/outputv2/google/api/servicecontrol/v1/http_request.ts @@ -237,6 +237,15 @@ function createBaseHttpRequest(): HttpRequest { */ export const HttpRequest = { typeUrl: "/google.api.servicecontrol.v1.HttpRequest", + is(o: any): o is HttpRequest { + return o && (o.$typeUrl === HttpRequest.typeUrl || typeof o.requestMethod === "string" && typeof o.requestUrl === "string" && typeof o.requestSize === "bigint" && typeof o.status === "number" && typeof o.responseSize === "bigint" && typeof o.userAgent === "string" && typeof o.remoteIp === "string" && typeof o.serverIp === "string" && typeof o.referer === "string" && typeof o.cacheLookup === "boolean" && typeof o.cacheHit === "boolean" && typeof o.cacheValidatedWithOriginServer === "boolean" && typeof o.cacheFillBytes === "bigint" && typeof o.protocol === "string"); + }, + isSDK(o: any): o is HttpRequestSDKType { + return o && (o.$typeUrl === HttpRequest.typeUrl || typeof o.request_method === "string" && typeof o.request_url === "string" && typeof o.request_size === "bigint" && typeof o.status === "number" && typeof o.response_size === "bigint" && typeof o.user_agent === "string" && typeof o.remote_ip === "string" && typeof o.server_ip === "string" && typeof o.referer === "string" && typeof o.cache_lookup === "boolean" && typeof o.cache_hit === "boolean" && typeof o.cache_validated_with_origin_server === "boolean" && typeof o.cache_fill_bytes === "bigint" && typeof o.protocol === "string"); + }, + isAmino(o: any): o is HttpRequestAmino { + return o && (o.$typeUrl === HttpRequest.typeUrl || typeof o.request_method === "string" && typeof o.request_url === "string" && typeof o.request_size === "bigint" && typeof o.status === "number" && typeof o.response_size === "bigint" && typeof o.user_agent === "string" && typeof o.remote_ip === "string" && typeof o.server_ip === "string" && typeof o.referer === "string" && typeof o.cache_lookup === "boolean" && typeof o.cache_hit === "boolean" && typeof o.cache_validated_with_origin_server === "boolean" && typeof o.cache_fill_bytes === "bigint" && typeof o.protocol === "string"); + }, encode(message: HttpRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.requestMethod !== "") { writer.uint32(10).string(message.requestMethod); @@ -529,5 +538,6 @@ export const HttpRequest = { typeUrl: "/google.api.servicecontrol.v1.HttpRequest", value: HttpRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/google/api/servicecontrol/v1/log_entry.ts b/__fixtures__/v-next/outputv2/google/api/servicecontrol/v1/log_entry.ts index 23bd610526..fc33cd4aca 100644 --- a/__fixtures__/v-next/outputv2/google/api/servicecontrol/v1/log_entry.ts +++ b/__fixtures__/v-next/outputv2/google/api/servicecontrol/v1/log_entry.ts @@ -6,6 +6,7 @@ import { Struct, StructAmino, StructSDKType } from "../../../protobuf/struct"; import { BinaryReader, BinaryWriter } from "../../../../binary"; import { isSet, DeepPartial, toTimestamp, fromTimestamp, isObject } from "../../../../helpers"; import { JsonSafe } from "../../../../json-safe"; +import { GlobalDecoderRegistry } from "../../../../registry"; export const protobufPackage = "google.api.servicecontrol.v1"; /** * @name LogEntry_LabelsEntry @@ -464,7 +465,8 @@ export const LogEntry_LabelsEntry = { }, toProto(message: LogEntry_LabelsEntry): Uint8Array { return LogEntry_LabelsEntry.encode(message).finish(); - } + }, + registerTypeUrl() {} }; function createBaseLogEntry(): LogEntry { return { @@ -490,6 +492,15 @@ function createBaseLogEntry(): LogEntry { */ export const LogEntry = { typeUrl: "/google.api.servicecontrol.v1.LogEntry", + is(o: any): o is LogEntry { + return o && (o.$typeUrl === LogEntry.typeUrl || typeof o.name === "string" && isSet(o.severity) && typeof o.trace === "string" && typeof o.insertId === "string" && isSet(o.labels)); + }, + isSDK(o: any): o is LogEntrySDKType { + return o && (o.$typeUrl === LogEntry.typeUrl || typeof o.name === "string" && isSet(o.severity) && typeof o.trace === "string" && typeof o.insert_id === "string" && isSet(o.labels)); + }, + isAmino(o: any): o is LogEntryAmino { + return o && (o.$typeUrl === LogEntry.typeUrl || typeof o.name === "string" && isSet(o.severity) && typeof o.trace === "string" && typeof o.insert_id === "string" && isSet(o.labels)); + }, encode(message: LogEntry, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(82).string(message.name); @@ -782,6 +793,14 @@ export const LogEntry = { typeUrl: "/google.api.servicecontrol.v1.LogEntry", value: LogEntry.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(LogEntry.typeUrl)) { + return; + } + Struct.registerTypeUrl(); + LogEntryOperation.registerTypeUrl(); + LogEntrySourceLocation.registerTypeUrl(); } }; function createBaseLogEntryOperation(): LogEntryOperation { @@ -801,6 +820,15 @@ function createBaseLogEntryOperation(): LogEntryOperation { */ export const LogEntryOperation = { typeUrl: "/google.api.servicecontrol.v1.LogEntryOperation", + is(o: any): o is LogEntryOperation { + return o && (o.$typeUrl === LogEntryOperation.typeUrl || typeof o.id === "string" && typeof o.producer === "string" && typeof o.first === "boolean" && typeof o.last === "boolean"); + }, + isSDK(o: any): o is LogEntryOperationSDKType { + return o && (o.$typeUrl === LogEntryOperation.typeUrl || typeof o.id === "string" && typeof o.producer === "string" && typeof o.first === "boolean" && typeof o.last === "boolean"); + }, + isAmino(o: any): o is LogEntryOperationAmino { + return o && (o.$typeUrl === LogEntryOperation.typeUrl || typeof o.id === "string" && typeof o.producer === "string" && typeof o.first === "boolean" && typeof o.last === "boolean"); + }, encode(message: LogEntryOperation, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.id !== "") { writer.uint32(10).string(message.id); @@ -920,7 +948,8 @@ export const LogEntryOperation = { typeUrl: "/google.api.servicecontrol.v1.LogEntryOperation", value: LogEntryOperation.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseLogEntrySourceLocation(): LogEntrySourceLocation { return { @@ -938,6 +967,15 @@ function createBaseLogEntrySourceLocation(): LogEntrySourceLocation { */ export const LogEntrySourceLocation = { typeUrl: "/google.api.servicecontrol.v1.LogEntrySourceLocation", + is(o: any): o is LogEntrySourceLocation { + return o && (o.$typeUrl === LogEntrySourceLocation.typeUrl || typeof o.file === "string" && typeof o.line === "bigint" && typeof o.function === "string"); + }, + isSDK(o: any): o is LogEntrySourceLocationSDKType { + return o && (o.$typeUrl === LogEntrySourceLocation.typeUrl || typeof o.file === "string" && typeof o.line === "bigint" && typeof o.function === "string"); + }, + isAmino(o: any): o is LogEntrySourceLocationAmino { + return o && (o.$typeUrl === LogEntrySourceLocation.typeUrl || typeof o.file === "string" && typeof o.line === "bigint" && typeof o.function === "string"); + }, encode(message: LogEntrySourceLocation, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.file !== "") { writer.uint32(10).string(message.file); @@ -1044,5 +1082,6 @@ export const LogEntrySourceLocation = { typeUrl: "/google.api.servicecontrol.v1.LogEntrySourceLocation", value: LogEntrySourceLocation.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/google/api/servicecontrol/v1/metric_value.ts b/__fixtures__/v-next/outputv2/google/api/servicecontrol/v1/metric_value.ts index fdbca6fc81..2bba4963ae 100644 --- a/__fixtures__/v-next/outputv2/google/api/servicecontrol/v1/metric_value.ts +++ b/__fixtures__/v-next/outputv2/google/api/servicecontrol/v1/metric_value.ts @@ -3,6 +3,7 @@ import { Distribution, DistributionAmino, DistributionSDKType } from "./distribu import { BinaryReader, BinaryWriter } from "../../../../binary"; import { isSet, DeepPartial, toTimestamp, fromTimestamp, isObject } from "../../../../helpers"; import { JsonSafe } from "../../../../json-safe"; +import { GlobalDecoderRegistry } from "../../../../registry"; export const protobufPackage = "google.api.servicecontrol.v1"; /** * @name MetricValue_LabelsEntry @@ -318,7 +319,8 @@ export const MetricValue_LabelsEntry = { }, toProto(message: MetricValue_LabelsEntry): Uint8Array { return MetricValue_LabelsEntry.encode(message).finish(); - } + }, + registerTypeUrl() {} }; function createBaseMetricValue(): MetricValue { return { @@ -340,6 +342,15 @@ function createBaseMetricValue(): MetricValue { */ export const MetricValue = { typeUrl: "/google.api.servicecontrol.v1.MetricValue", + is(o: any): o is MetricValue { + return o && (o.$typeUrl === MetricValue.typeUrl || isSet(o.labels)); + }, + isSDK(o: any): o is MetricValueSDKType { + return o && (o.$typeUrl === MetricValue.typeUrl || isSet(o.labels)); + }, + isAmino(o: any): o is MetricValueAmino { + return o && (o.$typeUrl === MetricValue.typeUrl || isSet(o.labels)); + }, encode(message: MetricValue, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { Object.entries(message.labels).forEach(([key, value]) => { MetricValue_LabelsEntry.encode({ @@ -568,6 +579,12 @@ export const MetricValue = { typeUrl: "/google.api.servicecontrol.v1.MetricValue", value: MetricValue.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MetricValue.typeUrl)) { + return; + } + Distribution.registerTypeUrl(); } }; function createBaseMetricValueSet(): MetricValueSet { @@ -586,6 +603,15 @@ function createBaseMetricValueSet(): MetricValueSet { */ export const MetricValueSet = { typeUrl: "/google.api.servicecontrol.v1.MetricValueSet", + is(o: any): o is MetricValueSet { + return o && (o.$typeUrl === MetricValueSet.typeUrl || typeof o.metricName === "string" && Array.isArray(o.metricValues) && (!o.metricValues.length || MetricValue.is(o.metricValues[0]))); + }, + isSDK(o: any): o is MetricValueSetSDKType { + return o && (o.$typeUrl === MetricValueSet.typeUrl || typeof o.metric_name === "string" && Array.isArray(o.metric_values) && (!o.metric_values.length || MetricValue.isSDK(o.metric_values[0]))); + }, + isAmino(o: any): o is MetricValueSetAmino { + return o && (o.$typeUrl === MetricValueSet.typeUrl || typeof o.metric_name === "string" && Array.isArray(o.metric_values) && (!o.metric_values.length || MetricValue.isAmino(o.metric_values[0]))); + }, encode(message: MetricValueSet, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.metricName !== "") { writer.uint32(10).string(message.metricName); @@ -685,5 +711,11 @@ export const MetricValueSet = { typeUrl: "/google.api.servicecontrol.v1.MetricValueSet", value: MetricValueSet.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MetricValueSet.typeUrl)) { + return; + } + MetricValue.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/google/api/servicecontrol/v1/operation.ts b/__fixtures__/v-next/outputv2/google/api/servicecontrol/v1/operation.ts index d2f302bb74..ce4974a600 100644 --- a/__fixtures__/v-next/outputv2/google/api/servicecontrol/v1/operation.ts +++ b/__fixtures__/v-next/outputv2/google/api/servicecontrol/v1/operation.ts @@ -400,7 +400,8 @@ export const Operation_LabelsEntry = { }, toProto(message: Operation_LabelsEntry): Uint8Array { return Operation_LabelsEntry.encode(message).finish(); - } + }, + registerTypeUrl() {} }; function createBaseOperation(): Operation { return { @@ -424,6 +425,15 @@ function createBaseOperation(): Operation { */ export const Operation = { typeUrl: "/google.api.servicecontrol.v1.Operation", + is(o: any): o is Operation { + return o && (o.$typeUrl === Operation.typeUrl || typeof o.operationId === "string" && typeof o.operationName === "string" && typeof o.consumerId === "string" && isSet(o.labels) && Array.isArray(o.metricValueSets) && (!o.metricValueSets.length || MetricValueSet.is(o.metricValueSets[0])) && Array.isArray(o.logEntries) && (!o.logEntries.length || LogEntry.is(o.logEntries[0])) && isSet(o.importance) && Array.isArray(o.extensions) && (!o.extensions.length || Any.is(o.extensions[0]))); + }, + isSDK(o: any): o is OperationSDKType { + return o && (o.$typeUrl === Operation.typeUrl || typeof o.operation_id === "string" && typeof o.operation_name === "string" && typeof o.consumer_id === "string" && isSet(o.labels) && Array.isArray(o.metric_value_sets) && (!o.metric_value_sets.length || MetricValueSet.isSDK(o.metric_value_sets[0])) && Array.isArray(o.log_entries) && (!o.log_entries.length || LogEntry.isSDK(o.log_entries[0])) && isSet(o.importance) && Array.isArray(o.extensions) && (!o.extensions.length || Any.isSDK(o.extensions[0]))); + }, + isAmino(o: any): o is OperationAmino { + return o && (o.$typeUrl === Operation.typeUrl || typeof o.operation_id === "string" && typeof o.operation_name === "string" && typeof o.consumer_id === "string" && isSet(o.labels) && Array.isArray(o.metric_value_sets) && (!o.metric_value_sets.length || MetricValueSet.isAmino(o.metric_value_sets[0])) && Array.isArray(o.log_entries) && (!o.log_entries.length || LogEntry.isAmino(o.log_entries[0])) && isSet(o.importance) && Array.isArray(o.extensions) && (!o.extensions.length || Any.isAmino(o.extensions[0]))); + }, encode(message: Operation, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.operationId !== "") { writer.uint32(10).string(message.operationId); @@ -706,5 +716,6 @@ export const Operation = { typeUrl: "/google.api.servicecontrol.v1.Operation", value: Operation.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/google/api/servicecontrol/v1/quota_controller.ts b/__fixtures__/v-next/outputv2/google/api/servicecontrol/v1/quota_controller.ts index 22c0aad936..5220eb958a 100644 --- a/__fixtures__/v-next/outputv2/google/api/servicecontrol/v1/quota_controller.ts +++ b/__fixtures__/v-next/outputv2/google/api/servicecontrol/v1/quota_controller.ts @@ -1,6 +1,7 @@ import { MetricValueSet, MetricValueSetAmino, MetricValueSetSDKType } from "./metric_value"; import { Status, StatusAmino, StatusSDKType } from "../../../rpc/status"; import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { GlobalDecoderRegistry } from "../../../../registry"; import { isSet, DeepPartial, isObject } from "../../../../helpers"; import { JsonSafe } from "../../../../json-safe"; export const protobufPackage = "google.api.servicecontrol.v1"; @@ -615,6 +616,15 @@ function createBaseAllocateQuotaRequest(): AllocateQuotaRequest { */ export const AllocateQuotaRequest = { typeUrl: "/google.api.servicecontrol.v1.AllocateQuotaRequest", + is(o: any): o is AllocateQuotaRequest { + return o && (o.$typeUrl === AllocateQuotaRequest.typeUrl || typeof o.serviceName === "string" && typeof o.serviceConfigId === "string"); + }, + isSDK(o: any): o is AllocateQuotaRequestSDKType { + return o && (o.$typeUrl === AllocateQuotaRequest.typeUrl || typeof o.service_name === "string" && typeof o.service_config_id === "string"); + }, + isAmino(o: any): o is AllocateQuotaRequestAmino { + return o && (o.$typeUrl === AllocateQuotaRequest.typeUrl || typeof o.service_name === "string" && typeof o.service_config_id === "string"); + }, encode(message: AllocateQuotaRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.serviceName !== "") { writer.uint32(10).string(message.serviceName); @@ -721,6 +731,12 @@ export const AllocateQuotaRequest = { typeUrl: "/google.api.servicecontrol.v1.AllocateQuotaRequest", value: AllocateQuotaRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(AllocateQuotaRequest.typeUrl)) { + return; + } + QuotaOperation.registerTypeUrl(); } }; function createBaseQuotaOperation_LabelsEntry(): QuotaOperation_LabelsEntry { @@ -818,7 +834,8 @@ export const QuotaOperation_LabelsEntry = { }, toProto(message: QuotaOperation_LabelsEntry): Uint8Array { return QuotaOperation_LabelsEntry.encode(message).finish(); - } + }, + registerTypeUrl() {} }; function createBaseQuotaOperation(): QuotaOperation { return { @@ -838,6 +855,15 @@ function createBaseQuotaOperation(): QuotaOperation { */ export const QuotaOperation = { typeUrl: "/google.api.servicecontrol.v1.QuotaOperation", + is(o: any): o is QuotaOperation { + return o && (o.$typeUrl === QuotaOperation.typeUrl || typeof o.operationId === "string" && typeof o.methodName === "string" && typeof o.consumerId === "string" && isSet(o.labels) && Array.isArray(o.quotaMetrics) && (!o.quotaMetrics.length || MetricValueSet.is(o.quotaMetrics[0])) && isSet(o.quotaMode)); + }, + isSDK(o: any): o is QuotaOperationSDKType { + return o && (o.$typeUrl === QuotaOperation.typeUrl || typeof o.operation_id === "string" && typeof o.method_name === "string" && typeof o.consumer_id === "string" && isSet(o.labels) && Array.isArray(o.quota_metrics) && (!o.quota_metrics.length || MetricValueSet.isSDK(o.quota_metrics[0])) && isSet(o.quota_mode)); + }, + isAmino(o: any): o is QuotaOperationAmino { + return o && (o.$typeUrl === QuotaOperation.typeUrl || typeof o.operation_id === "string" && typeof o.method_name === "string" && typeof o.consumer_id === "string" && isSet(o.labels) && Array.isArray(o.quota_metrics) && (!o.quota_metrics.length || MetricValueSet.isAmino(o.quota_metrics[0])) && isSet(o.quota_mode)); + }, encode(message: QuotaOperation, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.operationId !== "") { writer.uint32(10).string(message.operationId); @@ -1040,6 +1066,12 @@ export const QuotaOperation = { typeUrl: "/google.api.servicecontrol.v1.QuotaOperation", value: QuotaOperation.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QuotaOperation.typeUrl)) { + return; + } + MetricValueSet.registerTypeUrl(); } }; function createBaseAllocateQuotaResponse(): AllocateQuotaResponse { @@ -1058,6 +1090,15 @@ function createBaseAllocateQuotaResponse(): AllocateQuotaResponse { */ export const AllocateQuotaResponse = { typeUrl: "/google.api.servicecontrol.v1.AllocateQuotaResponse", + is(o: any): o is AllocateQuotaResponse { + return o && (o.$typeUrl === AllocateQuotaResponse.typeUrl || typeof o.operationId === "string" && Array.isArray(o.allocateErrors) && (!o.allocateErrors.length || QuotaError.is(o.allocateErrors[0])) && Array.isArray(o.quotaMetrics) && (!o.quotaMetrics.length || MetricValueSet.is(o.quotaMetrics[0])) && typeof o.serviceConfigId === "string"); + }, + isSDK(o: any): o is AllocateQuotaResponseSDKType { + return o && (o.$typeUrl === AllocateQuotaResponse.typeUrl || typeof o.operation_id === "string" && Array.isArray(o.allocate_errors) && (!o.allocate_errors.length || QuotaError.isSDK(o.allocate_errors[0])) && Array.isArray(o.quota_metrics) && (!o.quota_metrics.length || MetricValueSet.isSDK(o.quota_metrics[0])) && typeof o.service_config_id === "string"); + }, + isAmino(o: any): o is AllocateQuotaResponseAmino { + return o && (o.$typeUrl === AllocateQuotaResponse.typeUrl || typeof o.operation_id === "string" && Array.isArray(o.allocate_errors) && (!o.allocate_errors.length || QuotaError.isAmino(o.allocate_errors[0])) && Array.isArray(o.quota_metrics) && (!o.quota_metrics.length || MetricValueSet.isAmino(o.quota_metrics[0])) && typeof o.service_config_id === "string"); + }, encode(message: AllocateQuotaResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.operationId !== "") { writer.uint32(10).string(message.operationId); @@ -1197,6 +1238,13 @@ export const AllocateQuotaResponse = { typeUrl: "/google.api.servicecontrol.v1.AllocateQuotaResponse", value: AllocateQuotaResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(AllocateQuotaResponse.typeUrl)) { + return; + } + QuotaError.registerTypeUrl(); + MetricValueSet.registerTypeUrl(); } }; function createBaseQuotaError(): QuotaError { @@ -1215,6 +1263,15 @@ function createBaseQuotaError(): QuotaError { */ export const QuotaError = { typeUrl: "/google.api.servicecontrol.v1.QuotaError", + is(o: any): o is QuotaError { + return o && (o.$typeUrl === QuotaError.typeUrl || isSet(o.code) && typeof o.subject === "string" && typeof o.description === "string"); + }, + isSDK(o: any): o is QuotaErrorSDKType { + return o && (o.$typeUrl === QuotaError.typeUrl || isSet(o.code) && typeof o.subject === "string" && typeof o.description === "string"); + }, + isAmino(o: any): o is QuotaErrorAmino { + return o && (o.$typeUrl === QuotaError.typeUrl || isSet(o.code) && typeof o.subject === "string" && typeof o.description === "string"); + }, encode(message: QuotaError, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.code !== 0) { writer.uint32(8).int32(message.code); @@ -1336,5 +1393,11 @@ export const QuotaError = { typeUrl: "/google.api.servicecontrol.v1.QuotaError", value: QuotaError.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QuotaError.typeUrl)) { + return; + } + Status.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/google/api/servicecontrol/v1/service_controller.ts b/__fixtures__/v-next/outputv2/google/api/servicecontrol/v1/service_controller.ts index a0f24a5cd0..a47a5e0349 100644 --- a/__fixtures__/v-next/outputv2/google/api/servicecontrol/v1/service_controller.ts +++ b/__fixtures__/v-next/outputv2/google/api/servicecontrol/v1/service_controller.ts @@ -2,6 +2,7 @@ import { Operation, OperationAmino, OperationSDKType } from "./operation"; import { CheckError, CheckErrorAmino, CheckErrorSDKType } from "./check_error"; import { Status, StatusAmino, StatusSDKType } from "../../../rpc/status"; import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { GlobalDecoderRegistry } from "../../../../registry"; import { isSet, DeepPartial } from "../../../../helpers"; import { JsonSafe } from "../../../../json-safe"; export const protobufPackage = "google.api.servicecontrol.v1"; @@ -617,6 +618,15 @@ function createBaseCheckRequest(): CheckRequest { */ export const CheckRequest = { typeUrl: "/google.api.servicecontrol.v1.CheckRequest", + is(o: any): o is CheckRequest { + return o && (o.$typeUrl === CheckRequest.typeUrl || typeof o.serviceName === "string" && typeof o.serviceConfigId === "string"); + }, + isSDK(o: any): o is CheckRequestSDKType { + return o && (o.$typeUrl === CheckRequest.typeUrl || typeof o.service_name === "string" && typeof o.service_config_id === "string"); + }, + isAmino(o: any): o is CheckRequestAmino { + return o && (o.$typeUrl === CheckRequest.typeUrl || typeof o.service_name === "string" && typeof o.service_config_id === "string"); + }, encode(message: CheckRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.serviceName !== "") { writer.uint32(10).string(message.serviceName); @@ -723,6 +733,12 @@ export const CheckRequest = { typeUrl: "/google.api.servicecontrol.v1.CheckRequest", value: CheckRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(CheckRequest.typeUrl)) { + return; + } + Operation.registerTypeUrl(); } }; function createBaseCheckResponse(): CheckResponse { @@ -742,6 +758,15 @@ function createBaseCheckResponse(): CheckResponse { */ export const CheckResponse = { typeUrl: "/google.api.servicecontrol.v1.CheckResponse", + is(o: any): o is CheckResponse { + return o && (o.$typeUrl === CheckResponse.typeUrl || typeof o.operationId === "string" && Array.isArray(o.checkErrors) && (!o.checkErrors.length || CheckError.is(o.checkErrors[0])) && typeof o.serviceConfigId === "string" && typeof o.serviceRolloutId === "string"); + }, + isSDK(o: any): o is CheckResponseSDKType { + return o && (o.$typeUrl === CheckResponse.typeUrl || typeof o.operation_id === "string" && Array.isArray(o.check_errors) && (!o.check_errors.length || CheckError.isSDK(o.check_errors[0])) && typeof o.service_config_id === "string" && typeof o.service_rollout_id === "string"); + }, + isAmino(o: any): o is CheckResponseAmino { + return o && (o.$typeUrl === CheckResponse.typeUrl || typeof o.operation_id === "string" && Array.isArray(o.check_errors) && (!o.check_errors.length || CheckError.isAmino(o.check_errors[0])) && typeof o.service_config_id === "string" && typeof o.service_rollout_id === "string"); + }, encode(message: CheckResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.operationId !== "") { writer.uint32(10).string(message.operationId); @@ -888,6 +913,13 @@ export const CheckResponse = { typeUrl: "/google.api.servicecontrol.v1.CheckResponse", value: CheckResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(CheckResponse.typeUrl)) { + return; + } + CheckError.registerTypeUrl(); + CheckResponse_CheckInfo.registerTypeUrl(); } }; function createBaseCheckResponse_CheckInfo(): CheckResponse_CheckInfo { @@ -904,6 +936,15 @@ function createBaseCheckResponse_CheckInfo(): CheckResponse_CheckInfo { */ export const CheckResponse_CheckInfo = { typeUrl: "/google.api.servicecontrol.v1.CheckInfo", + is(o: any): o is CheckResponse_CheckInfo { + return o && (o.$typeUrl === CheckResponse_CheckInfo.typeUrl || Array.isArray(o.unusedArguments) && (!o.unusedArguments.length || typeof o.unusedArguments[0] === "string")); + }, + isSDK(o: any): o is CheckResponse_CheckInfoSDKType { + return o && (o.$typeUrl === CheckResponse_CheckInfo.typeUrl || Array.isArray(o.unused_arguments) && (!o.unused_arguments.length || typeof o.unused_arguments[0] === "string")); + }, + isAmino(o: any): o is CheckResponse_CheckInfoAmino { + return o && (o.$typeUrl === CheckResponse_CheckInfo.typeUrl || Array.isArray(o.unused_arguments) && (!o.unused_arguments.length || typeof o.unused_arguments[0] === "string")); + }, encode(message: CheckResponse_CheckInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.unusedArguments) { writer.uint32(10).string(v!); @@ -1005,6 +1046,12 @@ export const CheckResponse_CheckInfo = { typeUrl: "/google.api.servicecontrol.v1.CheckInfo", value: CheckResponse_CheckInfo.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(CheckResponse_CheckInfo.typeUrl)) { + return; + } + CheckResponse_ConsumerInfo.registerTypeUrl(); } }; function createBaseCheckResponse_ConsumerInfo(): CheckResponse_ConsumerInfo { @@ -1022,6 +1069,15 @@ function createBaseCheckResponse_ConsumerInfo(): CheckResponse_ConsumerInfo { */ export const CheckResponse_ConsumerInfo = { typeUrl: "/google.api.servicecontrol.v1.ConsumerInfo", + is(o: any): o is CheckResponse_ConsumerInfo { + return o && (o.$typeUrl === CheckResponse_ConsumerInfo.typeUrl || typeof o.projectNumber === "bigint" && isSet(o.type) && typeof o.consumerNumber === "bigint"); + }, + isSDK(o: any): o is CheckResponse_ConsumerInfoSDKType { + return o && (o.$typeUrl === CheckResponse_ConsumerInfo.typeUrl || typeof o.project_number === "bigint" && isSet(o.type) && typeof o.consumer_number === "bigint"); + }, + isAmino(o: any): o is CheckResponse_ConsumerInfoAmino { + return o && (o.$typeUrl === CheckResponse_ConsumerInfo.typeUrl || typeof o.project_number === "bigint" && isSet(o.type) && typeof o.consumer_number === "bigint"); + }, encode(message: CheckResponse_ConsumerInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.projectNumber !== BigInt(0)) { writer.uint32(8).int64(message.projectNumber); @@ -1130,7 +1186,8 @@ export const CheckResponse_ConsumerInfo = { typeUrl: "/google.api.servicecontrol.v1.ConsumerInfo", value: CheckResponse_ConsumerInfo.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseReportRequest(): ReportRequest { return { @@ -1147,6 +1204,15 @@ function createBaseReportRequest(): ReportRequest { */ export const ReportRequest = { typeUrl: "/google.api.servicecontrol.v1.ReportRequest", + is(o: any): o is ReportRequest { + return o && (o.$typeUrl === ReportRequest.typeUrl || typeof o.serviceName === "string" && Array.isArray(o.operations) && (!o.operations.length || Operation.is(o.operations[0])) && typeof o.serviceConfigId === "string"); + }, + isSDK(o: any): o is ReportRequestSDKType { + return o && (o.$typeUrl === ReportRequest.typeUrl || typeof o.service_name === "string" && Array.isArray(o.operations) && (!o.operations.length || Operation.isSDK(o.operations[0])) && typeof o.service_config_id === "string"); + }, + isAmino(o: any): o is ReportRequestAmino { + return o && (o.$typeUrl === ReportRequest.typeUrl || typeof o.service_name === "string" && Array.isArray(o.operations) && (!o.operations.length || Operation.isAmino(o.operations[0])) && typeof o.service_config_id === "string"); + }, encode(message: ReportRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.serviceName !== "") { writer.uint32(10).string(message.serviceName); @@ -1261,6 +1327,12 @@ export const ReportRequest = { typeUrl: "/google.api.servicecontrol.v1.ReportRequest", value: ReportRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ReportRequest.typeUrl)) { + return; + } + Operation.registerTypeUrl(); } }; function createBaseReportResponse(): ReportResponse { @@ -1278,6 +1350,15 @@ function createBaseReportResponse(): ReportResponse { */ export const ReportResponse = { typeUrl: "/google.api.servicecontrol.v1.ReportResponse", + is(o: any): o is ReportResponse { + return o && (o.$typeUrl === ReportResponse.typeUrl || Array.isArray(o.reportErrors) && (!o.reportErrors.length || ReportResponse_ReportError.is(o.reportErrors[0])) && typeof o.serviceConfigId === "string" && typeof o.serviceRolloutId === "string"); + }, + isSDK(o: any): o is ReportResponseSDKType { + return o && (o.$typeUrl === ReportResponse.typeUrl || Array.isArray(o.report_errors) && (!o.report_errors.length || ReportResponse_ReportError.isSDK(o.report_errors[0])) && typeof o.service_config_id === "string" && typeof o.service_rollout_id === "string"); + }, + isAmino(o: any): o is ReportResponseAmino { + return o && (o.$typeUrl === ReportResponse.typeUrl || Array.isArray(o.report_errors) && (!o.report_errors.length || ReportResponse_ReportError.isAmino(o.report_errors[0])) && typeof o.service_config_id === "string" && typeof o.service_rollout_id === "string"); + }, encode(message: ReportResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.reportErrors) { ReportResponse_ReportError.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -1392,6 +1473,12 @@ export const ReportResponse = { typeUrl: "/google.api.servicecontrol.v1.ReportResponse", value: ReportResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ReportResponse.typeUrl)) { + return; + } + ReportResponse_ReportError.registerTypeUrl(); } }; function createBaseReportResponse_ReportError(): ReportResponse_ReportError { @@ -1409,6 +1496,15 @@ function createBaseReportResponse_ReportError(): ReportResponse_ReportError { */ export const ReportResponse_ReportError = { typeUrl: "/google.api.servicecontrol.v1.ReportError", + is(o: any): o is ReportResponse_ReportError { + return o && (o.$typeUrl === ReportResponse_ReportError.typeUrl || typeof o.operationId === "string"); + }, + isSDK(o: any): o is ReportResponse_ReportErrorSDKType { + return o && (o.$typeUrl === ReportResponse_ReportError.typeUrl || typeof o.operation_id === "string"); + }, + isAmino(o: any): o is ReportResponse_ReportErrorAmino { + return o && (o.$typeUrl === ReportResponse_ReportError.typeUrl || typeof o.operation_id === "string"); + }, encode(message: ReportResponse_ReportError, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.operationId !== "") { writer.uint32(10).string(message.operationId); @@ -1500,5 +1596,11 @@ export const ReportResponse_ReportError = { typeUrl: "/google.api.servicecontrol.v1.ReportError", value: ReportResponse_ReportError.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ReportResponse_ReportError.typeUrl)) { + return; + } + Status.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/google/api/servicecontrol/v2/service_controller.ts b/__fixtures__/v-next/outputv2/google/api/servicecontrol/v2/service_controller.ts index 6716ec2e3d..282f0fded3 100644 --- a/__fixtures__/v-next/outputv2/google/api/servicecontrol/v2/service_controller.ts +++ b/__fixtures__/v-next/outputv2/google/api/servicecontrol/v2/service_controller.ts @@ -1,6 +1,7 @@ import { AttributeContext, AttributeContextAmino, AttributeContextSDKType } from "../../../rpc/context/attribute_context"; import { Status, StatusAmino, StatusSDKType } from "../../../rpc/status"; import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { GlobalDecoderRegistry } from "../../../../registry"; import { isSet, DeepPartial, isObject } from "../../../../helpers"; import { JsonSafe } from "../../../../json-safe"; export const protobufPackage = "google.api.servicecontrol.v2"; @@ -413,6 +414,15 @@ function createBaseCheckRequest(): CheckRequest { */ export const CheckRequest = { typeUrl: "/google.api.servicecontrol.v2.CheckRequest", + is(o: any): o is CheckRequest { + return o && (o.$typeUrl === CheckRequest.typeUrl || typeof o.serviceName === "string" && typeof o.serviceConfigId === "string" && Array.isArray(o.resources) && (!o.resources.length || ResourceInfo.is(o.resources[0])) && typeof o.flags === "string"); + }, + isSDK(o: any): o is CheckRequestSDKType { + return o && (o.$typeUrl === CheckRequest.typeUrl || typeof o.service_name === "string" && typeof o.service_config_id === "string" && Array.isArray(o.resources) && (!o.resources.length || ResourceInfo.isSDK(o.resources[0])) && typeof o.flags === "string"); + }, + isAmino(o: any): o is CheckRequestAmino { + return o && (o.$typeUrl === CheckRequest.typeUrl || typeof o.service_name === "string" && typeof o.service_config_id === "string" && Array.isArray(o.resources) && (!o.resources.length || ResourceInfo.isAmino(o.resources[0])) && typeof o.flags === "string"); + }, encode(message: CheckRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.serviceName !== "") { writer.uint32(10).string(message.serviceName); @@ -559,6 +569,13 @@ export const CheckRequest = { typeUrl: "/google.api.servicecontrol.v2.CheckRequest", value: CheckRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(CheckRequest.typeUrl)) { + return; + } + AttributeContext.registerTypeUrl(); + ResourceInfo.registerTypeUrl(); } }; function createBaseResourceInfo(): ResourceInfo { @@ -578,6 +595,15 @@ function createBaseResourceInfo(): ResourceInfo { */ export const ResourceInfo = { typeUrl: "/google.api.servicecontrol.v2.ResourceInfo", + is(o: any): o is ResourceInfo { + return o && (o.$typeUrl === ResourceInfo.typeUrl || typeof o.name === "string" && typeof o.type === "string" && typeof o.permission === "string" && typeof o.container === "string" && typeof o.location === "string"); + }, + isSDK(o: any): o is ResourceInfoSDKType { + return o && (o.$typeUrl === ResourceInfo.typeUrl || typeof o.name === "string" && typeof o.type === "string" && typeof o.permission === "string" && typeof o.container === "string" && typeof o.location === "string"); + }, + isAmino(o: any): o is ResourceInfoAmino { + return o && (o.$typeUrl === ResourceInfo.typeUrl || typeof o.name === "string" && typeof o.type === "string" && typeof o.permission === "string" && typeof o.container === "string" && typeof o.location === "string"); + }, encode(message: ResourceInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -712,7 +738,8 @@ export const ResourceInfo = { typeUrl: "/google.api.servicecontrol.v2.ResourceInfo", value: ResourceInfo.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseCheckResponse_HeadersEntry(): CheckResponse_HeadersEntry { return { @@ -809,7 +836,8 @@ export const CheckResponse_HeadersEntry = { }, toProto(message: CheckResponse_HeadersEntry): Uint8Array { return CheckResponse_HeadersEntry.encode(message).finish(); - } + }, + registerTypeUrl() {} }; function createBaseCheckResponse(): CheckResponse { return { @@ -825,6 +853,15 @@ function createBaseCheckResponse(): CheckResponse { */ export const CheckResponse = { typeUrl: "/google.api.servicecontrol.v2.CheckResponse", + is(o: any): o is CheckResponse { + return o && (o.$typeUrl === CheckResponse.typeUrl || isSet(o.headers)); + }, + isSDK(o: any): o is CheckResponseSDKType { + return o && (o.$typeUrl === CheckResponse.typeUrl || isSet(o.headers)); + }, + isAmino(o: any): o is CheckResponseAmino { + return o && (o.$typeUrl === CheckResponse.typeUrl || isSet(o.headers)); + }, encode(message: CheckResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.status !== undefined) { Status.encode(message.status, writer.uint32(10).fork()).ldelim(); @@ -959,6 +996,12 @@ export const CheckResponse = { typeUrl: "/google.api.servicecontrol.v2.CheckResponse", value: CheckResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(CheckResponse.typeUrl)) { + return; + } + Status.registerTypeUrl(); } }; function createBaseReportRequest(): ReportRequest { @@ -976,6 +1019,15 @@ function createBaseReportRequest(): ReportRequest { */ export const ReportRequest = { typeUrl: "/google.api.servicecontrol.v2.ReportRequest", + is(o: any): o is ReportRequest { + return o && (o.$typeUrl === ReportRequest.typeUrl || typeof o.serviceName === "string" && typeof o.serviceConfigId === "string" && Array.isArray(o.operations) && (!o.operations.length || AttributeContext.is(o.operations[0]))); + }, + isSDK(o: any): o is ReportRequestSDKType { + return o && (o.$typeUrl === ReportRequest.typeUrl || typeof o.service_name === "string" && typeof o.service_config_id === "string" && Array.isArray(o.operations) && (!o.operations.length || AttributeContext.isSDK(o.operations[0]))); + }, + isAmino(o: any): o is ReportRequestAmino { + return o && (o.$typeUrl === ReportRequest.typeUrl || typeof o.service_name === "string" && typeof o.service_config_id === "string" && Array.isArray(o.operations) && (!o.operations.length || AttributeContext.isAmino(o.operations[0]))); + }, encode(message: ReportRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.serviceName !== "") { writer.uint32(10).string(message.serviceName); @@ -1090,6 +1142,12 @@ export const ReportRequest = { typeUrl: "/google.api.servicecontrol.v2.ReportRequest", value: ReportRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ReportRequest.typeUrl)) { + return; + } + AttributeContext.registerTypeUrl(); } }; function createBaseReportResponse(): ReportResponse { @@ -1104,6 +1162,15 @@ function createBaseReportResponse(): ReportResponse { */ export const ReportResponse = { typeUrl: "/google.api.servicecontrol.v2.ReportResponse", + is(o: any): o is ReportResponse { + return o && o.$typeUrl === ReportResponse.typeUrl; + }, + isSDK(o: any): o is ReportResponseSDKType { + return o && o.$typeUrl === ReportResponse.typeUrl; + }, + isAmino(o: any): o is ReportResponseAmino { + return o && o.$typeUrl === ReportResponse.typeUrl; + }, encode(_: ReportResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -1162,5 +1229,6 @@ export const ReportResponse = { typeUrl: "/google.api.servicecontrol.v2.ReportResponse", value: ReportResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/google/api/servicemanagement/v1/resources.ts b/__fixtures__/v-next/outputv2/google/api/servicemanagement/v1/resources.ts index 432a72bbe8..34acf36096 100644 --- a/__fixtures__/v-next/outputv2/google/api/servicemanagement/v1/resources.ts +++ b/__fixtures__/v-next/outputv2/google/api/servicemanagement/v1/resources.ts @@ -3,6 +3,7 @@ import { ConfigChange, ConfigChangeAmino, ConfigChangeSDKType } from "../../conf import { BinaryReader, BinaryWriter } from "../../../../binary"; import { isSet, DeepPartial, toTimestamp, fromTimestamp, bytesFromBase64, base64FromBytes, isObject } from "../../../../helpers"; import { JsonSafe } from "../../../../json-safe"; +import { GlobalDecoderRegistry } from "../../../../registry"; export const protobufPackage = "google.api.servicemanagement.v1"; /** Code describes the status of the operation (or one of its steps). */ export enum OperationMetadata_Status { @@ -1053,6 +1054,15 @@ function createBaseManagedService(): ManagedService { */ export const ManagedService = { typeUrl: "/google.api.servicemanagement.v1.ManagedService", + is(o: any): o is ManagedService { + return o && (o.$typeUrl === ManagedService.typeUrl || typeof o.serviceName === "string" && typeof o.producerProjectId === "string"); + }, + isSDK(o: any): o is ManagedServiceSDKType { + return o && (o.$typeUrl === ManagedService.typeUrl || typeof o.service_name === "string" && typeof o.producer_project_id === "string"); + }, + isAmino(o: any): o is ManagedServiceAmino { + return o && (o.$typeUrl === ManagedService.typeUrl || typeof o.service_name === "string" && typeof o.producer_project_id === "string"); + }, encode(message: ManagedService, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.serviceName !== "") { writer.uint32(18).string(message.serviceName); @@ -1142,7 +1152,8 @@ export const ManagedService = { typeUrl: "/google.api.servicemanagement.v1.ManagedService", value: ManagedService.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseOperationMetadata(): OperationMetadata { return { @@ -1160,6 +1171,15 @@ function createBaseOperationMetadata(): OperationMetadata { */ export const OperationMetadata = { typeUrl: "/google.api.servicemanagement.v1.OperationMetadata", + is(o: any): o is OperationMetadata { + return o && (o.$typeUrl === OperationMetadata.typeUrl || Array.isArray(o.resourceNames) && (!o.resourceNames.length || typeof o.resourceNames[0] === "string") && Array.isArray(o.steps) && (!o.steps.length || OperationMetadata_Step.is(o.steps[0])) && typeof o.progressPercentage === "number"); + }, + isSDK(o: any): o is OperationMetadataSDKType { + return o && (o.$typeUrl === OperationMetadata.typeUrl || Array.isArray(o.resource_names) && (!o.resource_names.length || typeof o.resource_names[0] === "string") && Array.isArray(o.steps) && (!o.steps.length || OperationMetadata_Step.isSDK(o.steps[0])) && typeof o.progress_percentage === "number"); + }, + isAmino(o: any): o is OperationMetadataAmino { + return o && (o.$typeUrl === OperationMetadata.typeUrl || Array.isArray(o.resource_names) && (!o.resource_names.length || typeof o.resource_names[0] === "string") && Array.isArray(o.steps) && (!o.steps.length || OperationMetadata_Step.isAmino(o.steps[0])) && typeof o.progress_percentage === "number"); + }, encode(message: OperationMetadata, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.resourceNames) { writer.uint32(10).string(v!); @@ -1299,6 +1319,12 @@ export const OperationMetadata = { typeUrl: "/google.api.servicemanagement.v1.OperationMetadata", value: OperationMetadata.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(OperationMetadata.typeUrl)) { + return; + } + OperationMetadata_Step.registerTypeUrl(); } }; function createBaseOperationMetadata_Step(): OperationMetadata_Step { @@ -1315,6 +1341,15 @@ function createBaseOperationMetadata_Step(): OperationMetadata_Step { */ export const OperationMetadata_Step = { typeUrl: "/google.api.servicemanagement.v1.Step", + is(o: any): o is OperationMetadata_Step { + return o && (o.$typeUrl === OperationMetadata_Step.typeUrl || typeof o.description === "string" && isSet(o.status)); + }, + isSDK(o: any): o is OperationMetadata_StepSDKType { + return o && (o.$typeUrl === OperationMetadata_Step.typeUrl || typeof o.description === "string" && isSet(o.status)); + }, + isAmino(o: any): o is OperationMetadata_StepAmino { + return o && (o.$typeUrl === OperationMetadata_Step.typeUrl || typeof o.description === "string" && isSet(o.status)); + }, encode(message: OperationMetadata_Step, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.description !== "") { writer.uint32(18).string(message.description); @@ -1404,7 +1439,8 @@ export const OperationMetadata_Step = { typeUrl: "/google.api.servicemanagement.v1.Step", value: OperationMetadata_Step.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseDiagnostic(): Diagnostic { return { @@ -1421,6 +1457,15 @@ function createBaseDiagnostic(): Diagnostic { */ export const Diagnostic = { typeUrl: "/google.api.servicemanagement.v1.Diagnostic", + is(o: any): o is Diagnostic { + return o && (o.$typeUrl === Diagnostic.typeUrl || typeof o.location === "string" && isSet(o.kind) && typeof o.message === "string"); + }, + isSDK(o: any): o is DiagnosticSDKType { + return o && (o.$typeUrl === Diagnostic.typeUrl || typeof o.location === "string" && isSet(o.kind) && typeof o.message === "string"); + }, + isAmino(o: any): o is DiagnosticAmino { + return o && (o.$typeUrl === Diagnostic.typeUrl || typeof o.location === "string" && isSet(o.kind) && typeof o.message === "string"); + }, encode(message: Diagnostic, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.location !== "") { writer.uint32(10).string(message.location); @@ -1525,7 +1570,8 @@ export const Diagnostic = { typeUrl: "/google.api.servicemanagement.v1.Diagnostic", value: Diagnostic.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseConfigSource(): ConfigSource { return { @@ -1542,6 +1588,15 @@ function createBaseConfigSource(): ConfigSource { */ export const ConfigSource = { typeUrl: "/google.api.servicemanagement.v1.ConfigSource", + is(o: any): o is ConfigSource { + return o && (o.$typeUrl === ConfigSource.typeUrl || typeof o.id === "string" && Array.isArray(o.files) && (!o.files.length || ConfigFile.is(o.files[0]))); + }, + isSDK(o: any): o is ConfigSourceSDKType { + return o && (o.$typeUrl === ConfigSource.typeUrl || typeof o.id === "string" && Array.isArray(o.files) && (!o.files.length || ConfigFile.isSDK(o.files[0]))); + }, + isAmino(o: any): o is ConfigSourceAmino { + return o && (o.$typeUrl === ConfigSource.typeUrl || typeof o.id === "string" && Array.isArray(o.files) && (!o.files.length || ConfigFile.isAmino(o.files[0]))); + }, encode(message: ConfigSource, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.id !== "") { writer.uint32(42).string(message.id); @@ -1641,6 +1696,12 @@ export const ConfigSource = { typeUrl: "/google.api.servicemanagement.v1.ConfigSource", value: ConfigSource.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ConfigSource.typeUrl)) { + return; + } + ConfigFile.registerTypeUrl(); } }; function createBaseConfigFile(): ConfigFile { @@ -1658,6 +1719,15 @@ function createBaseConfigFile(): ConfigFile { */ export const ConfigFile = { typeUrl: "/google.api.servicemanagement.v1.ConfigFile", + is(o: any): o is ConfigFile { + return o && (o.$typeUrl === ConfigFile.typeUrl || typeof o.filePath === "string" && (o.fileContents instanceof Uint8Array || typeof o.fileContents === "string") && isSet(o.fileType)); + }, + isSDK(o: any): o is ConfigFileSDKType { + return o && (o.$typeUrl === ConfigFile.typeUrl || typeof o.file_path === "string" && (o.file_contents instanceof Uint8Array || typeof o.file_contents === "string") && isSet(o.file_type)); + }, + isAmino(o: any): o is ConfigFileAmino { + return o && (o.$typeUrl === ConfigFile.typeUrl || typeof o.file_path === "string" && (o.file_contents instanceof Uint8Array || typeof o.file_contents === "string") && isSet(o.file_type)); + }, encode(message: ConfigFile, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.filePath !== "") { writer.uint32(10).string(message.filePath); @@ -1762,7 +1832,8 @@ export const ConfigFile = { typeUrl: "/google.api.servicemanagement.v1.ConfigFile", value: ConfigFile.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseConfigRef(): ConfigRef { return { @@ -1777,6 +1848,15 @@ function createBaseConfigRef(): ConfigRef { */ export const ConfigRef = { typeUrl: "/google.api.servicemanagement.v1.ConfigRef", + is(o: any): o is ConfigRef { + return o && (o.$typeUrl === ConfigRef.typeUrl || typeof o.name === "string"); + }, + isSDK(o: any): o is ConfigRefSDKType { + return o && (o.$typeUrl === ConfigRef.typeUrl || typeof o.name === "string"); + }, + isAmino(o: any): o is ConfigRefAmino { + return o && (o.$typeUrl === ConfigRef.typeUrl || typeof o.name === "string"); + }, encode(message: ConfigRef, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -1851,7 +1931,8 @@ export const ConfigRef = { typeUrl: "/google.api.servicemanagement.v1.ConfigRef", value: ConfigRef.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseChangeReport(): ChangeReport { return { @@ -1869,6 +1950,15 @@ function createBaseChangeReport(): ChangeReport { */ export const ChangeReport = { typeUrl: "/google.api.servicemanagement.v1.ChangeReport", + is(o: any): o is ChangeReport { + return o && (o.$typeUrl === ChangeReport.typeUrl || Array.isArray(o.configChanges) && (!o.configChanges.length || ConfigChange.is(o.configChanges[0]))); + }, + isSDK(o: any): o is ChangeReportSDKType { + return o && (o.$typeUrl === ChangeReport.typeUrl || Array.isArray(o.config_changes) && (!o.config_changes.length || ConfigChange.isSDK(o.config_changes[0]))); + }, + isAmino(o: any): o is ChangeReportAmino { + return o && (o.$typeUrl === ChangeReport.typeUrl || Array.isArray(o.config_changes) && (!o.config_changes.length || ConfigChange.isAmino(o.config_changes[0]))); + }, encode(message: ChangeReport, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.configChanges) { ConfigChange.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -1953,6 +2043,12 @@ export const ChangeReport = { typeUrl: "/google.api.servicemanagement.v1.ChangeReport", value: ChangeReport.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ChangeReport.typeUrl)) { + return; + } + ConfigChange.registerTypeUrl(); } }; function createBaseRollout(): Rollout { @@ -1976,6 +2072,15 @@ function createBaseRollout(): Rollout { */ export const Rollout = { typeUrl: "/google.api.servicemanagement.v1.Rollout", + is(o: any): o is Rollout { + return o && (o.$typeUrl === Rollout.typeUrl || typeof o.rolloutId === "string" && typeof o.createdBy === "string" && isSet(o.status) && typeof o.serviceName === "string"); + }, + isSDK(o: any): o is RolloutSDKType { + return o && (o.$typeUrl === Rollout.typeUrl || typeof o.rollout_id === "string" && typeof o.created_by === "string" && isSet(o.status) && typeof o.service_name === "string"); + }, + isAmino(o: any): o is RolloutAmino { + return o && (o.$typeUrl === Rollout.typeUrl || typeof o.rollout_id === "string" && typeof o.created_by === "string" && isSet(o.status) && typeof o.service_name === "string"); + }, encode(message: Rollout, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.rolloutId !== "") { writer.uint32(10).string(message.rolloutId); @@ -2144,6 +2249,13 @@ export const Rollout = { typeUrl: "/google.api.servicemanagement.v1.Rollout", value: Rollout.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Rollout.typeUrl)) { + return; + } + Rollout_TrafficPercentStrategy.registerTypeUrl(); + Rollout_DeleteServiceStrategy.registerTypeUrl(); } }; function createBaseRollout_TrafficPercentStrategy_PercentagesEntry(): Rollout_TrafficPercentStrategy_PercentagesEntry { @@ -2241,7 +2353,8 @@ export const Rollout_TrafficPercentStrategy_PercentagesEntry = { }, toProto(message: Rollout_TrafficPercentStrategy_PercentagesEntry): Uint8Array { return Rollout_TrafficPercentStrategy_PercentagesEntry.encode(message).finish(); - } + }, + registerTypeUrl() {} }; function createBaseRollout_TrafficPercentStrategy(): Rollout_TrafficPercentStrategy { return { @@ -2285,6 +2398,15 @@ function createBaseRollout_TrafficPercentStrategy(): Rollout_TrafficPercentStrat */ export const Rollout_TrafficPercentStrategy = { typeUrl: "/google.api.servicemanagement.v1.TrafficPercentStrategy", + is(o: any): o is Rollout_TrafficPercentStrategy { + return o && (o.$typeUrl === Rollout_TrafficPercentStrategy.typeUrl || isSet(o.percentages)); + }, + isSDK(o: any): o is Rollout_TrafficPercentStrategySDKType { + return o && (o.$typeUrl === Rollout_TrafficPercentStrategy.typeUrl || isSet(o.percentages)); + }, + isAmino(o: any): o is Rollout_TrafficPercentStrategyAmino { + return o && (o.$typeUrl === Rollout_TrafficPercentStrategy.typeUrl || isSet(o.percentages)); + }, encode(message: Rollout_TrafficPercentStrategy, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { Object.entries(message.percentages).forEach(([key, value]) => { Rollout_TrafficPercentStrategy_PercentagesEntry.encode({ @@ -2402,7 +2524,8 @@ export const Rollout_TrafficPercentStrategy = { typeUrl: "/google.api.servicemanagement.v1.TrafficPercentStrategy", value: Rollout_TrafficPercentStrategy.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseRollout_DeleteServiceStrategy(): Rollout_DeleteServiceStrategy { return {}; @@ -2416,6 +2539,15 @@ function createBaseRollout_DeleteServiceStrategy(): Rollout_DeleteServiceStrateg */ export const Rollout_DeleteServiceStrategy = { typeUrl: "/google.api.servicemanagement.v1.DeleteServiceStrategy", + is(o: any): o is Rollout_DeleteServiceStrategy { + return o && o.$typeUrl === Rollout_DeleteServiceStrategy.typeUrl; + }, + isSDK(o: any): o is Rollout_DeleteServiceStrategySDKType { + return o && o.$typeUrl === Rollout_DeleteServiceStrategy.typeUrl; + }, + isAmino(o: any): o is Rollout_DeleteServiceStrategyAmino { + return o && o.$typeUrl === Rollout_DeleteServiceStrategy.typeUrl; + }, encode(_: Rollout_DeleteServiceStrategy, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -2474,5 +2606,6 @@ export const Rollout_DeleteServiceStrategy = { typeUrl: "/google.api.servicemanagement.v1.DeleteServiceStrategy", value: Rollout_DeleteServiceStrategy.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/google/api/servicemanagement/v1/servicemanager.ts b/__fixtures__/v-next/outputv2/google/api/servicemanagement/v1/servicemanager.ts index 42bd06023d..a8e173e122 100644 --- a/__fixtures__/v-next/outputv2/google/api/servicemanagement/v1/servicemanager.ts +++ b/__fixtures__/v-next/outputv2/google/api/servicemanagement/v1/servicemanager.ts @@ -4,6 +4,7 @@ import { Any, AnyAmino, AnySDKType } from "../../../protobuf/any"; import { BinaryReader, BinaryWriter } from "../../../../binary"; import { isSet, DeepPartial } from "../../../../helpers"; import { JsonSafe } from "../../../../json-safe"; +import { GlobalDecoderRegistry } from "../../../../registry"; export const protobufPackage = "google.api.servicemanagement.v1"; export enum GetServiceConfigRequest_ConfigView { /** BASIC - Server response includes all fields except SourceInfo. */ @@ -1126,6 +1127,15 @@ function createBaseListServicesRequest(): ListServicesRequest { */ export const ListServicesRequest = { typeUrl: "/google.api.servicemanagement.v1.ListServicesRequest", + is(o: any): o is ListServicesRequest { + return o && (o.$typeUrl === ListServicesRequest.typeUrl || typeof o.producerProjectId === "string" && typeof o.pageSize === "number" && typeof o.pageToken === "string" && typeof o.consumerId === "string"); + }, + isSDK(o: any): o is ListServicesRequestSDKType { + return o && (o.$typeUrl === ListServicesRequest.typeUrl || typeof o.producer_project_id === "string" && typeof o.page_size === "number" && typeof o.page_token === "string" && typeof o.consumer_id === "string"); + }, + isAmino(o: any): o is ListServicesRequestAmino { + return o && (o.$typeUrl === ListServicesRequest.typeUrl || typeof o.producer_project_id === "string" && typeof o.page_size === "number" && typeof o.page_token === "string" && typeof o.consumer_id === "string"); + }, encode(message: ListServicesRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.producerProjectId !== "") { writer.uint32(10).string(message.producerProjectId); @@ -1245,7 +1255,8 @@ export const ListServicesRequest = { typeUrl: "/google.api.servicemanagement.v1.ListServicesRequest", value: ListServicesRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseListServicesResponse(): ListServicesResponse { return { @@ -1261,6 +1272,15 @@ function createBaseListServicesResponse(): ListServicesResponse { */ export const ListServicesResponse = { typeUrl: "/google.api.servicemanagement.v1.ListServicesResponse", + is(o: any): o is ListServicesResponse { + return o && (o.$typeUrl === ListServicesResponse.typeUrl || Array.isArray(o.services) && (!o.services.length || ManagedService.is(o.services[0])) && typeof o.nextPageToken === "string"); + }, + isSDK(o: any): o is ListServicesResponseSDKType { + return o && (o.$typeUrl === ListServicesResponse.typeUrl || Array.isArray(o.services) && (!o.services.length || ManagedService.isSDK(o.services[0])) && typeof o.next_page_token === "string"); + }, + isAmino(o: any): o is ListServicesResponseAmino { + return o && (o.$typeUrl === ListServicesResponse.typeUrl || Array.isArray(o.services) && (!o.services.length || ManagedService.isAmino(o.services[0])) && typeof o.next_page_token === "string"); + }, encode(message: ListServicesResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.services) { ManagedService.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -1360,6 +1380,12 @@ export const ListServicesResponse = { typeUrl: "/google.api.servicemanagement.v1.ListServicesResponse", value: ListServicesResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ListServicesResponse.typeUrl)) { + return; + } + ManagedService.registerTypeUrl(); } }; function createBaseGetServiceRequest(): GetServiceRequest { @@ -1375,6 +1401,15 @@ function createBaseGetServiceRequest(): GetServiceRequest { */ export const GetServiceRequest = { typeUrl: "/google.api.servicemanagement.v1.GetServiceRequest", + is(o: any): o is GetServiceRequest { + return o && (o.$typeUrl === GetServiceRequest.typeUrl || typeof o.serviceName === "string"); + }, + isSDK(o: any): o is GetServiceRequestSDKType { + return o && (o.$typeUrl === GetServiceRequest.typeUrl || typeof o.service_name === "string"); + }, + isAmino(o: any): o is GetServiceRequestAmino { + return o && (o.$typeUrl === GetServiceRequest.typeUrl || typeof o.service_name === "string"); + }, encode(message: GetServiceRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.serviceName !== "") { writer.uint32(10).string(message.serviceName); @@ -1449,7 +1484,8 @@ export const GetServiceRequest = { typeUrl: "/google.api.servicemanagement.v1.GetServiceRequest", value: GetServiceRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseCreateServiceRequest(): CreateServiceRequest { return { @@ -1464,6 +1500,15 @@ function createBaseCreateServiceRequest(): CreateServiceRequest { */ export const CreateServiceRequest = { typeUrl: "/google.api.servicemanagement.v1.CreateServiceRequest", + is(o: any): o is CreateServiceRequest { + return o && o.$typeUrl === CreateServiceRequest.typeUrl; + }, + isSDK(o: any): o is CreateServiceRequestSDKType { + return o && o.$typeUrl === CreateServiceRequest.typeUrl; + }, + isAmino(o: any): o is CreateServiceRequestAmino { + return o && o.$typeUrl === CreateServiceRequest.typeUrl; + }, encode(message: CreateServiceRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.service !== undefined) { ManagedService.encode(message.service, writer.uint32(10).fork()).ldelim(); @@ -1540,6 +1585,12 @@ export const CreateServiceRequest = { typeUrl: "/google.api.servicemanagement.v1.CreateServiceRequest", value: CreateServiceRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(CreateServiceRequest.typeUrl)) { + return; + } + ManagedService.registerTypeUrl(); } }; function createBaseDeleteServiceRequest(): DeleteServiceRequest { @@ -1555,6 +1606,15 @@ function createBaseDeleteServiceRequest(): DeleteServiceRequest { */ export const DeleteServiceRequest = { typeUrl: "/google.api.servicemanagement.v1.DeleteServiceRequest", + is(o: any): o is DeleteServiceRequest { + return o && (o.$typeUrl === DeleteServiceRequest.typeUrl || typeof o.serviceName === "string"); + }, + isSDK(o: any): o is DeleteServiceRequestSDKType { + return o && (o.$typeUrl === DeleteServiceRequest.typeUrl || typeof o.service_name === "string"); + }, + isAmino(o: any): o is DeleteServiceRequestAmino { + return o && (o.$typeUrl === DeleteServiceRequest.typeUrl || typeof o.service_name === "string"); + }, encode(message: DeleteServiceRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.serviceName !== "") { writer.uint32(10).string(message.serviceName); @@ -1629,7 +1689,8 @@ export const DeleteServiceRequest = { typeUrl: "/google.api.servicemanagement.v1.DeleteServiceRequest", value: DeleteServiceRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseUndeleteServiceRequest(): UndeleteServiceRequest { return { @@ -1644,6 +1705,15 @@ function createBaseUndeleteServiceRequest(): UndeleteServiceRequest { */ export const UndeleteServiceRequest = { typeUrl: "/google.api.servicemanagement.v1.UndeleteServiceRequest", + is(o: any): o is UndeleteServiceRequest { + return o && (o.$typeUrl === UndeleteServiceRequest.typeUrl || typeof o.serviceName === "string"); + }, + isSDK(o: any): o is UndeleteServiceRequestSDKType { + return o && (o.$typeUrl === UndeleteServiceRequest.typeUrl || typeof o.service_name === "string"); + }, + isAmino(o: any): o is UndeleteServiceRequestAmino { + return o && (o.$typeUrl === UndeleteServiceRequest.typeUrl || typeof o.service_name === "string"); + }, encode(message: UndeleteServiceRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.serviceName !== "") { writer.uint32(10).string(message.serviceName); @@ -1718,7 +1788,8 @@ export const UndeleteServiceRequest = { typeUrl: "/google.api.servicemanagement.v1.UndeleteServiceRequest", value: UndeleteServiceRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseUndeleteServiceResponse(): UndeleteServiceResponse { return { @@ -1733,6 +1804,15 @@ function createBaseUndeleteServiceResponse(): UndeleteServiceResponse { */ export const UndeleteServiceResponse = { typeUrl: "/google.api.servicemanagement.v1.UndeleteServiceResponse", + is(o: any): o is UndeleteServiceResponse { + return o && o.$typeUrl === UndeleteServiceResponse.typeUrl; + }, + isSDK(o: any): o is UndeleteServiceResponseSDKType { + return o && o.$typeUrl === UndeleteServiceResponse.typeUrl; + }, + isAmino(o: any): o is UndeleteServiceResponseAmino { + return o && o.$typeUrl === UndeleteServiceResponse.typeUrl; + }, encode(message: UndeleteServiceResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.service !== undefined) { ManagedService.encode(message.service, writer.uint32(10).fork()).ldelim(); @@ -1809,6 +1889,12 @@ export const UndeleteServiceResponse = { typeUrl: "/google.api.servicemanagement.v1.UndeleteServiceResponse", value: UndeleteServiceResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(UndeleteServiceResponse.typeUrl)) { + return; + } + ManagedService.registerTypeUrl(); } }; function createBaseGetServiceConfigRequest(): GetServiceConfigRequest { @@ -1826,6 +1912,15 @@ function createBaseGetServiceConfigRequest(): GetServiceConfigRequest { */ export const GetServiceConfigRequest = { typeUrl: "/google.api.servicemanagement.v1.GetServiceConfigRequest", + is(o: any): o is GetServiceConfigRequest { + return o && (o.$typeUrl === GetServiceConfigRequest.typeUrl || typeof o.serviceName === "string" && typeof o.configId === "string" && isSet(o.view)); + }, + isSDK(o: any): o is GetServiceConfigRequestSDKType { + return o && (o.$typeUrl === GetServiceConfigRequest.typeUrl || typeof o.service_name === "string" && typeof o.config_id === "string" && isSet(o.view)); + }, + isAmino(o: any): o is GetServiceConfigRequestAmino { + return o && (o.$typeUrl === GetServiceConfigRequest.typeUrl || typeof o.service_name === "string" && typeof o.config_id === "string" && isSet(o.view)); + }, encode(message: GetServiceConfigRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.serviceName !== "") { writer.uint32(10).string(message.serviceName); @@ -1930,7 +2025,8 @@ export const GetServiceConfigRequest = { typeUrl: "/google.api.servicemanagement.v1.GetServiceConfigRequest", value: GetServiceConfigRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseListServiceConfigsRequest(): ListServiceConfigsRequest { return { @@ -1947,6 +2043,15 @@ function createBaseListServiceConfigsRequest(): ListServiceConfigsRequest { */ export const ListServiceConfigsRequest = { typeUrl: "/google.api.servicemanagement.v1.ListServiceConfigsRequest", + is(o: any): o is ListServiceConfigsRequest { + return o && (o.$typeUrl === ListServiceConfigsRequest.typeUrl || typeof o.serviceName === "string" && typeof o.pageToken === "string" && typeof o.pageSize === "number"); + }, + isSDK(o: any): o is ListServiceConfigsRequestSDKType { + return o && (o.$typeUrl === ListServiceConfigsRequest.typeUrl || typeof o.service_name === "string" && typeof o.page_token === "string" && typeof o.page_size === "number"); + }, + isAmino(o: any): o is ListServiceConfigsRequestAmino { + return o && (o.$typeUrl === ListServiceConfigsRequest.typeUrl || typeof o.service_name === "string" && typeof o.page_token === "string" && typeof o.page_size === "number"); + }, encode(message: ListServiceConfigsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.serviceName !== "") { writer.uint32(10).string(message.serviceName); @@ -2051,7 +2156,8 @@ export const ListServiceConfigsRequest = { typeUrl: "/google.api.servicemanagement.v1.ListServiceConfigsRequest", value: ListServiceConfigsRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseListServiceConfigsResponse(): ListServiceConfigsResponse { return { @@ -2067,6 +2173,15 @@ function createBaseListServiceConfigsResponse(): ListServiceConfigsResponse { */ export const ListServiceConfigsResponse = { typeUrl: "/google.api.servicemanagement.v1.ListServiceConfigsResponse", + is(o: any): o is ListServiceConfigsResponse { + return o && (o.$typeUrl === ListServiceConfigsResponse.typeUrl || Array.isArray(o.serviceConfigs) && (!o.serviceConfigs.length || Service.is(o.serviceConfigs[0])) && typeof o.nextPageToken === "string"); + }, + isSDK(o: any): o is ListServiceConfigsResponseSDKType { + return o && (o.$typeUrl === ListServiceConfigsResponse.typeUrl || Array.isArray(o.service_configs) && (!o.service_configs.length || Service.isSDK(o.service_configs[0])) && typeof o.next_page_token === "string"); + }, + isAmino(o: any): o is ListServiceConfigsResponseAmino { + return o && (o.$typeUrl === ListServiceConfigsResponse.typeUrl || Array.isArray(o.service_configs) && (!o.service_configs.length || Service.isAmino(o.service_configs[0])) && typeof o.next_page_token === "string"); + }, encode(message: ListServiceConfigsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.serviceConfigs) { Service.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -2166,6 +2281,12 @@ export const ListServiceConfigsResponse = { typeUrl: "/google.api.servicemanagement.v1.ListServiceConfigsResponse", value: ListServiceConfigsResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ListServiceConfigsResponse.typeUrl)) { + return; + } + Service.registerTypeUrl(); } }; function createBaseCreateServiceConfigRequest(): CreateServiceConfigRequest { @@ -2182,6 +2303,15 @@ function createBaseCreateServiceConfigRequest(): CreateServiceConfigRequest { */ export const CreateServiceConfigRequest = { typeUrl: "/google.api.servicemanagement.v1.CreateServiceConfigRequest", + is(o: any): o is CreateServiceConfigRequest { + return o && (o.$typeUrl === CreateServiceConfigRequest.typeUrl || typeof o.serviceName === "string"); + }, + isSDK(o: any): o is CreateServiceConfigRequestSDKType { + return o && (o.$typeUrl === CreateServiceConfigRequest.typeUrl || typeof o.service_name === "string"); + }, + isAmino(o: any): o is CreateServiceConfigRequestAmino { + return o && (o.$typeUrl === CreateServiceConfigRequest.typeUrl || typeof o.service_name === "string"); + }, encode(message: CreateServiceConfigRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.serviceName !== "") { writer.uint32(10).string(message.serviceName); @@ -2273,6 +2403,12 @@ export const CreateServiceConfigRequest = { typeUrl: "/google.api.servicemanagement.v1.CreateServiceConfigRequest", value: CreateServiceConfigRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(CreateServiceConfigRequest.typeUrl)) { + return; + } + Service.registerTypeUrl(); } }; function createBaseSubmitConfigSourceRequest(): SubmitConfigSourceRequest { @@ -2290,6 +2426,15 @@ function createBaseSubmitConfigSourceRequest(): SubmitConfigSourceRequest { */ export const SubmitConfigSourceRequest = { typeUrl: "/google.api.servicemanagement.v1.SubmitConfigSourceRequest", + is(o: any): o is SubmitConfigSourceRequest { + return o && (o.$typeUrl === SubmitConfigSourceRequest.typeUrl || typeof o.serviceName === "string" && typeof o.validateOnly === "boolean"); + }, + isSDK(o: any): o is SubmitConfigSourceRequestSDKType { + return o && (o.$typeUrl === SubmitConfigSourceRequest.typeUrl || typeof o.service_name === "string" && typeof o.validate_only === "boolean"); + }, + isAmino(o: any): o is SubmitConfigSourceRequestAmino { + return o && (o.$typeUrl === SubmitConfigSourceRequest.typeUrl || typeof o.service_name === "string" && typeof o.validate_only === "boolean"); + }, encode(message: SubmitConfigSourceRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.serviceName !== "") { writer.uint32(10).string(message.serviceName); @@ -2396,6 +2541,12 @@ export const SubmitConfigSourceRequest = { typeUrl: "/google.api.servicemanagement.v1.SubmitConfigSourceRequest", value: SubmitConfigSourceRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(SubmitConfigSourceRequest.typeUrl)) { + return; + } + ConfigSource.registerTypeUrl(); } }; function createBaseSubmitConfigSourceResponse(): SubmitConfigSourceResponse { @@ -2411,6 +2562,15 @@ function createBaseSubmitConfigSourceResponse(): SubmitConfigSourceResponse { */ export const SubmitConfigSourceResponse = { typeUrl: "/google.api.servicemanagement.v1.SubmitConfigSourceResponse", + is(o: any): o is SubmitConfigSourceResponse { + return o && o.$typeUrl === SubmitConfigSourceResponse.typeUrl; + }, + isSDK(o: any): o is SubmitConfigSourceResponseSDKType { + return o && o.$typeUrl === SubmitConfigSourceResponse.typeUrl; + }, + isAmino(o: any): o is SubmitConfigSourceResponseAmino { + return o && o.$typeUrl === SubmitConfigSourceResponse.typeUrl; + }, encode(message: SubmitConfigSourceResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.serviceConfig !== undefined) { Service.encode(message.serviceConfig, writer.uint32(10).fork()).ldelim(); @@ -2487,6 +2647,12 @@ export const SubmitConfigSourceResponse = { typeUrl: "/google.api.servicemanagement.v1.SubmitConfigSourceResponse", value: SubmitConfigSourceResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(SubmitConfigSourceResponse.typeUrl)) { + return; + } + Service.registerTypeUrl(); } }; function createBaseCreateServiceRolloutRequest(): CreateServiceRolloutRequest { @@ -2503,6 +2669,15 @@ function createBaseCreateServiceRolloutRequest(): CreateServiceRolloutRequest { */ export const CreateServiceRolloutRequest = { typeUrl: "/google.api.servicemanagement.v1.CreateServiceRolloutRequest", + is(o: any): o is CreateServiceRolloutRequest { + return o && (o.$typeUrl === CreateServiceRolloutRequest.typeUrl || typeof o.serviceName === "string"); + }, + isSDK(o: any): o is CreateServiceRolloutRequestSDKType { + return o && (o.$typeUrl === CreateServiceRolloutRequest.typeUrl || typeof o.service_name === "string"); + }, + isAmino(o: any): o is CreateServiceRolloutRequestAmino { + return o && (o.$typeUrl === CreateServiceRolloutRequest.typeUrl || typeof o.service_name === "string"); + }, encode(message: CreateServiceRolloutRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.serviceName !== "") { writer.uint32(10).string(message.serviceName); @@ -2594,6 +2769,12 @@ export const CreateServiceRolloutRequest = { typeUrl: "/google.api.servicemanagement.v1.CreateServiceRolloutRequest", value: CreateServiceRolloutRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(CreateServiceRolloutRequest.typeUrl)) { + return; + } + Rollout.registerTypeUrl(); } }; function createBaseListServiceRolloutsRequest(): ListServiceRolloutsRequest { @@ -2612,6 +2793,15 @@ function createBaseListServiceRolloutsRequest(): ListServiceRolloutsRequest { */ export const ListServiceRolloutsRequest = { typeUrl: "/google.api.servicemanagement.v1.ListServiceRolloutsRequest", + is(o: any): o is ListServiceRolloutsRequest { + return o && (o.$typeUrl === ListServiceRolloutsRequest.typeUrl || typeof o.serviceName === "string" && typeof o.pageToken === "string" && typeof o.pageSize === "number" && typeof o.filter === "string"); + }, + isSDK(o: any): o is ListServiceRolloutsRequestSDKType { + return o && (o.$typeUrl === ListServiceRolloutsRequest.typeUrl || typeof o.service_name === "string" && typeof o.page_token === "string" && typeof o.page_size === "number" && typeof o.filter === "string"); + }, + isAmino(o: any): o is ListServiceRolloutsRequestAmino { + return o && (o.$typeUrl === ListServiceRolloutsRequest.typeUrl || typeof o.service_name === "string" && typeof o.page_token === "string" && typeof o.page_size === "number" && typeof o.filter === "string"); + }, encode(message: ListServiceRolloutsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.serviceName !== "") { writer.uint32(10).string(message.serviceName); @@ -2731,7 +2921,8 @@ export const ListServiceRolloutsRequest = { typeUrl: "/google.api.servicemanagement.v1.ListServiceRolloutsRequest", value: ListServiceRolloutsRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseListServiceRolloutsResponse(): ListServiceRolloutsResponse { return { @@ -2747,6 +2938,15 @@ function createBaseListServiceRolloutsResponse(): ListServiceRolloutsResponse { */ export const ListServiceRolloutsResponse = { typeUrl: "/google.api.servicemanagement.v1.ListServiceRolloutsResponse", + is(o: any): o is ListServiceRolloutsResponse { + return o && (o.$typeUrl === ListServiceRolloutsResponse.typeUrl || Array.isArray(o.rollouts) && (!o.rollouts.length || Rollout.is(o.rollouts[0])) && typeof o.nextPageToken === "string"); + }, + isSDK(o: any): o is ListServiceRolloutsResponseSDKType { + return o && (o.$typeUrl === ListServiceRolloutsResponse.typeUrl || Array.isArray(o.rollouts) && (!o.rollouts.length || Rollout.isSDK(o.rollouts[0])) && typeof o.next_page_token === "string"); + }, + isAmino(o: any): o is ListServiceRolloutsResponseAmino { + return o && (o.$typeUrl === ListServiceRolloutsResponse.typeUrl || Array.isArray(o.rollouts) && (!o.rollouts.length || Rollout.isAmino(o.rollouts[0])) && typeof o.next_page_token === "string"); + }, encode(message: ListServiceRolloutsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.rollouts) { Rollout.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -2846,6 +3046,12 @@ export const ListServiceRolloutsResponse = { typeUrl: "/google.api.servicemanagement.v1.ListServiceRolloutsResponse", value: ListServiceRolloutsResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ListServiceRolloutsResponse.typeUrl)) { + return; + } + Rollout.registerTypeUrl(); } }; function createBaseGetServiceRolloutRequest(): GetServiceRolloutRequest { @@ -2862,6 +3068,15 @@ function createBaseGetServiceRolloutRequest(): GetServiceRolloutRequest { */ export const GetServiceRolloutRequest = { typeUrl: "/google.api.servicemanagement.v1.GetServiceRolloutRequest", + is(o: any): o is GetServiceRolloutRequest { + return o && (o.$typeUrl === GetServiceRolloutRequest.typeUrl || typeof o.serviceName === "string" && typeof o.rolloutId === "string"); + }, + isSDK(o: any): o is GetServiceRolloutRequestSDKType { + return o && (o.$typeUrl === GetServiceRolloutRequest.typeUrl || typeof o.service_name === "string" && typeof o.rollout_id === "string"); + }, + isAmino(o: any): o is GetServiceRolloutRequestAmino { + return o && (o.$typeUrl === GetServiceRolloutRequest.typeUrl || typeof o.service_name === "string" && typeof o.rollout_id === "string"); + }, encode(message: GetServiceRolloutRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.serviceName !== "") { writer.uint32(10).string(message.serviceName); @@ -2951,7 +3166,8 @@ export const GetServiceRolloutRequest = { typeUrl: "/google.api.servicemanagement.v1.GetServiceRolloutRequest", value: GetServiceRolloutRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseGenerateConfigReportRequest(): GenerateConfigReportRequest { return { @@ -2967,6 +3183,15 @@ function createBaseGenerateConfigReportRequest(): GenerateConfigReportRequest { */ export const GenerateConfigReportRequest = { typeUrl: "/google.api.servicemanagement.v1.GenerateConfigReportRequest", + is(o: any): o is GenerateConfigReportRequest { + return o && o.$typeUrl === GenerateConfigReportRequest.typeUrl; + }, + isSDK(o: any): o is GenerateConfigReportRequestSDKType { + return o && o.$typeUrl === GenerateConfigReportRequest.typeUrl; + }, + isAmino(o: any): o is GenerateConfigReportRequestAmino { + return o && o.$typeUrl === GenerateConfigReportRequest.typeUrl; + }, encode(message: GenerateConfigReportRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.newConfig !== undefined) { Any.encode(message.newConfig, writer.uint32(10).fork()).ldelim(); @@ -3060,7 +3285,8 @@ export const GenerateConfigReportRequest = { typeUrl: "/google.api.servicemanagement.v1.GenerateConfigReportRequest", value: GenerateConfigReportRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseGenerateConfigReportResponse(): GenerateConfigReportResponse { return { @@ -3078,6 +3304,15 @@ function createBaseGenerateConfigReportResponse(): GenerateConfigReportResponse */ export const GenerateConfigReportResponse = { typeUrl: "/google.api.servicemanagement.v1.GenerateConfigReportResponse", + is(o: any): o is GenerateConfigReportResponse { + return o && (o.$typeUrl === GenerateConfigReportResponse.typeUrl || typeof o.serviceName === "string" && typeof o.id === "string" && Array.isArray(o.changeReports) && (!o.changeReports.length || ChangeReport.is(o.changeReports[0])) && Array.isArray(o.diagnostics) && (!o.diagnostics.length || Diagnostic.is(o.diagnostics[0]))); + }, + isSDK(o: any): o is GenerateConfigReportResponseSDKType { + return o && (o.$typeUrl === GenerateConfigReportResponse.typeUrl || typeof o.service_name === "string" && typeof o.id === "string" && Array.isArray(o.change_reports) && (!o.change_reports.length || ChangeReport.isSDK(o.change_reports[0])) && Array.isArray(o.diagnostics) && (!o.diagnostics.length || Diagnostic.isSDK(o.diagnostics[0]))); + }, + isAmino(o: any): o is GenerateConfigReportResponseAmino { + return o && (o.$typeUrl === GenerateConfigReportResponse.typeUrl || typeof o.service_name === "string" && typeof o.id === "string" && Array.isArray(o.change_reports) && (!o.change_reports.length || ChangeReport.isAmino(o.change_reports[0])) && Array.isArray(o.diagnostics) && (!o.diagnostics.length || Diagnostic.isAmino(o.diagnostics[0]))); + }, encode(message: GenerateConfigReportResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.serviceName !== "") { writer.uint32(10).string(message.serviceName); @@ -3217,5 +3452,12 @@ export const GenerateConfigReportResponse = { typeUrl: "/google.api.servicemanagement.v1.GenerateConfigReportResponse", value: GenerateConfigReportResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GenerateConfigReportResponse.typeUrl)) { + return; + } + ChangeReport.registerTypeUrl(); + Diagnostic.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/google/api/serviceusage/v1/resources.ts b/__fixtures__/v-next/outputv2/google/api/serviceusage/v1/resources.ts index b997711220..71ea0154b9 100644 --- a/__fixtures__/v-next/outputv2/google/api/serviceusage/v1/resources.ts +++ b/__fixtures__/v-next/outputv2/google/api/serviceusage/v1/resources.ts @@ -6,8 +6,9 @@ import { Usage, UsageAmino, UsageSDKType } from "../../usage"; import { Endpoint, EndpointAmino, EndpointSDKType } from "../../endpoint"; import { MonitoredResourceDescriptor, MonitoredResourceDescriptorAmino, MonitoredResourceDescriptorSDKType } from "../../monitored_resource"; import { Monitoring, MonitoringAmino, MonitoringSDKType } from "../../monitoring"; -import { BinaryReader, BinaryWriter } from "../../../../binary"; import { isSet, DeepPartial } from "../../../../helpers"; +import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { GlobalDecoderRegistry } from "../../../../registry"; import { JsonSafe } from "../../../../json-safe"; export const protobufPackage = "google.api.serviceusage.v1"; /** Whether or not a service has been enabled for use by a consumer. */ @@ -342,6 +343,15 @@ function createBaseService(): Service { */ export const Service = { typeUrl: "/google.api.serviceusage.v1.Service", + is(o: any): o is Service { + return o && (o.$typeUrl === Service.typeUrl || typeof o.name === "string" && typeof o.parent === "string" && isSet(o.state)); + }, + isSDK(o: any): o is ServiceSDKType { + return o && (o.$typeUrl === Service.typeUrl || typeof o.name === "string" && typeof o.parent === "string" && isSet(o.state)); + }, + isAmino(o: any): o is ServiceAmino { + return o && (o.$typeUrl === Service.typeUrl || typeof o.name === "string" && typeof o.parent === "string" && isSet(o.state)); + }, encode(message: Service, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -463,6 +473,12 @@ export const Service = { typeUrl: "/google.api.serviceusage.v1.Service", value: Service.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Service.typeUrl)) { + return; + } + ServiceConfig.registerTypeUrl(); } }; function createBaseServiceConfig(): ServiceConfig { @@ -487,6 +503,15 @@ function createBaseServiceConfig(): ServiceConfig { */ export const ServiceConfig = { typeUrl: "/google.api.serviceusage.v1.ServiceConfig", + is(o: any): o is ServiceConfig { + return o && (o.$typeUrl === ServiceConfig.typeUrl || typeof o.name === "string" && typeof o.title === "string" && Array.isArray(o.apis) && (!o.apis.length || Api.is(o.apis[0])) && Array.isArray(o.endpoints) && (!o.endpoints.length || Endpoint.is(o.endpoints[0])) && Array.isArray(o.monitoredResources) && (!o.monitoredResources.length || MonitoredResourceDescriptor.is(o.monitoredResources[0]))); + }, + isSDK(o: any): o is ServiceConfigSDKType { + return o && (o.$typeUrl === ServiceConfig.typeUrl || typeof o.name === "string" && typeof o.title === "string" && Array.isArray(o.apis) && (!o.apis.length || Api.isSDK(o.apis[0])) && Array.isArray(o.endpoints) && (!o.endpoints.length || Endpoint.isSDK(o.endpoints[0])) && Array.isArray(o.monitored_resources) && (!o.monitored_resources.length || MonitoredResourceDescriptor.isSDK(o.monitored_resources[0]))); + }, + isAmino(o: any): o is ServiceConfigAmino { + return o && (o.$typeUrl === ServiceConfig.typeUrl || typeof o.name === "string" && typeof o.title === "string" && Array.isArray(o.apis) && (!o.apis.length || Api.isAmino(o.apis[0])) && Array.isArray(o.endpoints) && (!o.endpoints.length || Endpoint.isAmino(o.endpoints[0])) && Array.isArray(o.monitored_resources) && (!o.monitored_resources.length || MonitoredResourceDescriptor.isAmino(o.monitored_resources[0]))); + }, encode(message: ServiceConfig, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -736,6 +761,19 @@ export const ServiceConfig = { typeUrl: "/google.api.serviceusage.v1.ServiceConfig", value: ServiceConfig.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ServiceConfig.typeUrl)) { + return; + } + Api.registerTypeUrl(); + Documentation.registerTypeUrl(); + Quota.registerTypeUrl(); + Authentication.registerTypeUrl(); + Usage.registerTypeUrl(); + Endpoint.registerTypeUrl(); + MonitoredResourceDescriptor.registerTypeUrl(); + Monitoring.registerTypeUrl(); } }; function createBaseOperationMetadata(): OperationMetadata { @@ -751,6 +789,15 @@ function createBaseOperationMetadata(): OperationMetadata { */ export const OperationMetadata = { typeUrl: "/google.api.serviceusage.v1.OperationMetadata", + is(o: any): o is OperationMetadata { + return o && (o.$typeUrl === OperationMetadata.typeUrl || Array.isArray(o.resourceNames) && (!o.resourceNames.length || typeof o.resourceNames[0] === "string")); + }, + isSDK(o: any): o is OperationMetadataSDKType { + return o && (o.$typeUrl === OperationMetadata.typeUrl || Array.isArray(o.resource_names) && (!o.resource_names.length || typeof o.resource_names[0] === "string")); + }, + isAmino(o: any): o is OperationMetadataAmino { + return o && (o.$typeUrl === OperationMetadata.typeUrl || Array.isArray(o.resource_names) && (!o.resource_names.length || typeof o.resource_names[0] === "string")); + }, encode(message: OperationMetadata, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.resourceNames) { writer.uint32(18).string(v!); @@ -835,5 +882,6 @@ export const OperationMetadata = { typeUrl: "/google.api.serviceusage.v1.OperationMetadata", value: OperationMetadata.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/google/api/serviceusage/v1/serviceusage.ts b/__fixtures__/v-next/outputv2/google/api/serviceusage/v1/serviceusage.ts index d29d4341a6..9eb023bff8 100644 --- a/__fixtures__/v-next/outputv2/google/api/serviceusage/v1/serviceusage.ts +++ b/__fixtures__/v-next/outputv2/google/api/serviceusage/v1/serviceusage.ts @@ -2,6 +2,7 @@ import { Service, ServiceAmino, ServiceSDKType } from "./resources"; import { BinaryReader, BinaryWriter } from "../../../../binary"; import { isSet, DeepPartial } from "../../../../helpers"; import { JsonSafe } from "../../../../json-safe"; +import { GlobalDecoderRegistry } from "../../../../registry"; export const protobufPackage = "google.api.serviceusage.v1"; /** * Enum to determine if service usage should be checked when disabling a @@ -779,6 +780,15 @@ function createBaseEnableServiceRequest(): EnableServiceRequest { */ export const EnableServiceRequest = { typeUrl: "/google.api.serviceusage.v1.EnableServiceRequest", + is(o: any): o is EnableServiceRequest { + return o && (o.$typeUrl === EnableServiceRequest.typeUrl || typeof o.name === "string"); + }, + isSDK(o: any): o is EnableServiceRequestSDKType { + return o && (o.$typeUrl === EnableServiceRequest.typeUrl || typeof o.name === "string"); + }, + isAmino(o: any): o is EnableServiceRequestAmino { + return o && (o.$typeUrl === EnableServiceRequest.typeUrl || typeof o.name === "string"); + }, encode(message: EnableServiceRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -853,7 +863,8 @@ export const EnableServiceRequest = { typeUrl: "/google.api.serviceusage.v1.EnableServiceRequest", value: EnableServiceRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseEnableServiceResponse(): EnableServiceResponse { return { @@ -870,6 +881,15 @@ function createBaseEnableServiceResponse(): EnableServiceResponse { */ export const EnableServiceResponse = { typeUrl: "/google.api.serviceusage.v1.EnableServiceResponse", + is(o: any): o is EnableServiceResponse { + return o && o.$typeUrl === EnableServiceResponse.typeUrl; + }, + isSDK(o: any): o is EnableServiceResponseSDKType { + return o && o.$typeUrl === EnableServiceResponse.typeUrl; + }, + isAmino(o: any): o is EnableServiceResponseAmino { + return o && o.$typeUrl === EnableServiceResponse.typeUrl; + }, encode(message: EnableServiceResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.service !== undefined) { Service.encode(message.service, writer.uint32(10).fork()).ldelim(); @@ -946,6 +966,12 @@ export const EnableServiceResponse = { typeUrl: "/google.api.serviceusage.v1.EnableServiceResponse", value: EnableServiceResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(EnableServiceResponse.typeUrl)) { + return; + } + Service.registerTypeUrl(); } }; function createBaseDisableServiceRequest(): DisableServiceRequest { @@ -963,6 +989,15 @@ function createBaseDisableServiceRequest(): DisableServiceRequest { */ export const DisableServiceRequest = { typeUrl: "/google.api.serviceusage.v1.DisableServiceRequest", + is(o: any): o is DisableServiceRequest { + return o && (o.$typeUrl === DisableServiceRequest.typeUrl || typeof o.name === "string" && typeof o.disableDependentServices === "boolean" && isSet(o.checkIfServiceHasUsage)); + }, + isSDK(o: any): o is DisableServiceRequestSDKType { + return o && (o.$typeUrl === DisableServiceRequest.typeUrl || typeof o.name === "string" && typeof o.disable_dependent_services === "boolean" && isSet(o.check_if_service_has_usage)); + }, + isAmino(o: any): o is DisableServiceRequestAmino { + return o && (o.$typeUrl === DisableServiceRequest.typeUrl || typeof o.name === "string" && typeof o.disable_dependent_services === "boolean" && isSet(o.check_if_service_has_usage)); + }, encode(message: DisableServiceRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -1067,7 +1102,8 @@ export const DisableServiceRequest = { typeUrl: "/google.api.serviceusage.v1.DisableServiceRequest", value: DisableServiceRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseDisableServiceResponse(): DisableServiceResponse { return { @@ -1084,6 +1120,15 @@ function createBaseDisableServiceResponse(): DisableServiceResponse { */ export const DisableServiceResponse = { typeUrl: "/google.api.serviceusage.v1.DisableServiceResponse", + is(o: any): o is DisableServiceResponse { + return o && o.$typeUrl === DisableServiceResponse.typeUrl; + }, + isSDK(o: any): o is DisableServiceResponseSDKType { + return o && o.$typeUrl === DisableServiceResponse.typeUrl; + }, + isAmino(o: any): o is DisableServiceResponseAmino { + return o && o.$typeUrl === DisableServiceResponse.typeUrl; + }, encode(message: DisableServiceResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.service !== undefined) { Service.encode(message.service, writer.uint32(10).fork()).ldelim(); @@ -1160,6 +1205,12 @@ export const DisableServiceResponse = { typeUrl: "/google.api.serviceusage.v1.DisableServiceResponse", value: DisableServiceResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(DisableServiceResponse.typeUrl)) { + return; + } + Service.registerTypeUrl(); } }; function createBaseGetServiceRequest(): GetServiceRequest { @@ -1175,6 +1226,15 @@ function createBaseGetServiceRequest(): GetServiceRequest { */ export const GetServiceRequest = { typeUrl: "/google.api.serviceusage.v1.GetServiceRequest", + is(o: any): o is GetServiceRequest { + return o && (o.$typeUrl === GetServiceRequest.typeUrl || typeof o.name === "string"); + }, + isSDK(o: any): o is GetServiceRequestSDKType { + return o && (o.$typeUrl === GetServiceRequest.typeUrl || typeof o.name === "string"); + }, + isAmino(o: any): o is GetServiceRequestAmino { + return o && (o.$typeUrl === GetServiceRequest.typeUrl || typeof o.name === "string"); + }, encode(message: GetServiceRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -1249,7 +1309,8 @@ export const GetServiceRequest = { typeUrl: "/google.api.serviceusage.v1.GetServiceRequest", value: GetServiceRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseListServicesRequest(): ListServicesRequest { return { @@ -1267,6 +1328,15 @@ function createBaseListServicesRequest(): ListServicesRequest { */ export const ListServicesRequest = { typeUrl: "/google.api.serviceusage.v1.ListServicesRequest", + is(o: any): o is ListServicesRequest { + return o && (o.$typeUrl === ListServicesRequest.typeUrl || typeof o.parent === "string" && typeof o.pageSize === "number" && typeof o.pageToken === "string" && typeof o.filter === "string"); + }, + isSDK(o: any): o is ListServicesRequestSDKType { + return o && (o.$typeUrl === ListServicesRequest.typeUrl || typeof o.parent === "string" && typeof o.page_size === "number" && typeof o.page_token === "string" && typeof o.filter === "string"); + }, + isAmino(o: any): o is ListServicesRequestAmino { + return o && (o.$typeUrl === ListServicesRequest.typeUrl || typeof o.parent === "string" && typeof o.page_size === "number" && typeof o.page_token === "string" && typeof o.filter === "string"); + }, encode(message: ListServicesRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.parent !== "") { writer.uint32(10).string(message.parent); @@ -1386,7 +1456,8 @@ export const ListServicesRequest = { typeUrl: "/google.api.serviceusage.v1.ListServicesRequest", value: ListServicesRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseListServicesResponse(): ListServicesResponse { return { @@ -1402,6 +1473,15 @@ function createBaseListServicesResponse(): ListServicesResponse { */ export const ListServicesResponse = { typeUrl: "/google.api.serviceusage.v1.ListServicesResponse", + is(o: any): o is ListServicesResponse { + return o && (o.$typeUrl === ListServicesResponse.typeUrl || Array.isArray(o.services) && (!o.services.length || Service.is(o.services[0])) && typeof o.nextPageToken === "string"); + }, + isSDK(o: any): o is ListServicesResponseSDKType { + return o && (o.$typeUrl === ListServicesResponse.typeUrl || Array.isArray(o.services) && (!o.services.length || Service.isSDK(o.services[0])) && typeof o.next_page_token === "string"); + }, + isAmino(o: any): o is ListServicesResponseAmino { + return o && (o.$typeUrl === ListServicesResponse.typeUrl || Array.isArray(o.services) && (!o.services.length || Service.isAmino(o.services[0])) && typeof o.next_page_token === "string"); + }, encode(message: ListServicesResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.services) { Service.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -1501,6 +1581,12 @@ export const ListServicesResponse = { typeUrl: "/google.api.serviceusage.v1.ListServicesResponse", value: ListServicesResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ListServicesResponse.typeUrl)) { + return; + } + Service.registerTypeUrl(); } }; function createBaseBatchEnableServicesRequest(): BatchEnableServicesRequest { @@ -1517,6 +1603,15 @@ function createBaseBatchEnableServicesRequest(): BatchEnableServicesRequest { */ export const BatchEnableServicesRequest = { typeUrl: "/google.api.serviceusage.v1.BatchEnableServicesRequest", + is(o: any): o is BatchEnableServicesRequest { + return o && (o.$typeUrl === BatchEnableServicesRequest.typeUrl || typeof o.parent === "string" && Array.isArray(o.serviceIds) && (!o.serviceIds.length || typeof o.serviceIds[0] === "string")); + }, + isSDK(o: any): o is BatchEnableServicesRequestSDKType { + return o && (o.$typeUrl === BatchEnableServicesRequest.typeUrl || typeof o.parent === "string" && Array.isArray(o.service_ids) && (!o.service_ids.length || typeof o.service_ids[0] === "string")); + }, + isAmino(o: any): o is BatchEnableServicesRequestAmino { + return o && (o.$typeUrl === BatchEnableServicesRequest.typeUrl || typeof o.parent === "string" && Array.isArray(o.service_ids) && (!o.service_ids.length || typeof o.service_ids[0] === "string")); + }, encode(message: BatchEnableServicesRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.parent !== "") { writer.uint32(10).string(message.parent); @@ -1616,7 +1711,8 @@ export const BatchEnableServicesRequest = { typeUrl: "/google.api.serviceusage.v1.BatchEnableServicesRequest", value: BatchEnableServicesRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseBatchEnableServicesResponse(): BatchEnableServicesResponse { return { @@ -1634,6 +1730,15 @@ function createBaseBatchEnableServicesResponse(): BatchEnableServicesResponse { */ export const BatchEnableServicesResponse = { typeUrl: "/google.api.serviceusage.v1.BatchEnableServicesResponse", + is(o: any): o is BatchEnableServicesResponse { + return o && (o.$typeUrl === BatchEnableServicesResponse.typeUrl || Array.isArray(o.services) && (!o.services.length || Service.is(o.services[0])) && Array.isArray(o.failures) && (!o.failures.length || BatchEnableServicesResponse_EnableFailure.is(o.failures[0]))); + }, + isSDK(o: any): o is BatchEnableServicesResponseSDKType { + return o && (o.$typeUrl === BatchEnableServicesResponse.typeUrl || Array.isArray(o.services) && (!o.services.length || Service.isSDK(o.services[0])) && Array.isArray(o.failures) && (!o.failures.length || BatchEnableServicesResponse_EnableFailure.isSDK(o.failures[0]))); + }, + isAmino(o: any): o is BatchEnableServicesResponseAmino { + return o && (o.$typeUrl === BatchEnableServicesResponse.typeUrl || Array.isArray(o.services) && (!o.services.length || Service.isAmino(o.services[0])) && Array.isArray(o.failures) && (!o.failures.length || BatchEnableServicesResponse_EnableFailure.isAmino(o.failures[0]))); + }, encode(message: BatchEnableServicesResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.services) { Service.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -1743,6 +1848,13 @@ export const BatchEnableServicesResponse = { typeUrl: "/google.api.serviceusage.v1.BatchEnableServicesResponse", value: BatchEnableServicesResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(BatchEnableServicesResponse.typeUrl)) { + return; + } + Service.registerTypeUrl(); + BatchEnableServicesResponse_EnableFailure.registerTypeUrl(); } }; function createBaseBatchEnableServicesResponse_EnableFailure(): BatchEnableServicesResponse_EnableFailure { @@ -1759,6 +1871,15 @@ function createBaseBatchEnableServicesResponse_EnableFailure(): BatchEnableServi */ export const BatchEnableServicesResponse_EnableFailure = { typeUrl: "/google.api.serviceusage.v1.EnableFailure", + is(o: any): o is BatchEnableServicesResponse_EnableFailure { + return o && (o.$typeUrl === BatchEnableServicesResponse_EnableFailure.typeUrl || typeof o.serviceId === "string" && typeof o.errorMessage === "string"); + }, + isSDK(o: any): o is BatchEnableServicesResponse_EnableFailureSDKType { + return o && (o.$typeUrl === BatchEnableServicesResponse_EnableFailure.typeUrl || typeof o.service_id === "string" && typeof o.error_message === "string"); + }, + isAmino(o: any): o is BatchEnableServicesResponse_EnableFailureAmino { + return o && (o.$typeUrl === BatchEnableServicesResponse_EnableFailure.typeUrl || typeof o.service_id === "string" && typeof o.error_message === "string"); + }, encode(message: BatchEnableServicesResponse_EnableFailure, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.serviceId !== "") { writer.uint32(10).string(message.serviceId); @@ -1848,7 +1969,8 @@ export const BatchEnableServicesResponse_EnableFailure = { typeUrl: "/google.api.serviceusage.v1.EnableFailure", value: BatchEnableServicesResponse_EnableFailure.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseBatchGetServicesRequest(): BatchGetServicesRequest { return { @@ -1864,6 +1986,15 @@ function createBaseBatchGetServicesRequest(): BatchGetServicesRequest { */ export const BatchGetServicesRequest = { typeUrl: "/google.api.serviceusage.v1.BatchGetServicesRequest", + is(o: any): o is BatchGetServicesRequest { + return o && (o.$typeUrl === BatchGetServicesRequest.typeUrl || typeof o.parent === "string" && Array.isArray(o.names) && (!o.names.length || typeof o.names[0] === "string")); + }, + isSDK(o: any): o is BatchGetServicesRequestSDKType { + return o && (o.$typeUrl === BatchGetServicesRequest.typeUrl || typeof o.parent === "string" && Array.isArray(o.names) && (!o.names.length || typeof o.names[0] === "string")); + }, + isAmino(o: any): o is BatchGetServicesRequestAmino { + return o && (o.$typeUrl === BatchGetServicesRequest.typeUrl || typeof o.parent === "string" && Array.isArray(o.names) && (!o.names.length || typeof o.names[0] === "string")); + }, encode(message: BatchGetServicesRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.parent !== "") { writer.uint32(10).string(message.parent); @@ -1963,7 +2094,8 @@ export const BatchGetServicesRequest = { typeUrl: "/google.api.serviceusage.v1.BatchGetServicesRequest", value: BatchGetServicesRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseBatchGetServicesResponse(): BatchGetServicesResponse { return { @@ -1978,6 +2110,15 @@ function createBaseBatchGetServicesResponse(): BatchGetServicesResponse { */ export const BatchGetServicesResponse = { typeUrl: "/google.api.serviceusage.v1.BatchGetServicesResponse", + is(o: any): o is BatchGetServicesResponse { + return o && (o.$typeUrl === BatchGetServicesResponse.typeUrl || Array.isArray(o.services) && (!o.services.length || Service.is(o.services[0]))); + }, + isSDK(o: any): o is BatchGetServicesResponseSDKType { + return o && (o.$typeUrl === BatchGetServicesResponse.typeUrl || Array.isArray(o.services) && (!o.services.length || Service.isSDK(o.services[0]))); + }, + isAmino(o: any): o is BatchGetServicesResponseAmino { + return o && (o.$typeUrl === BatchGetServicesResponse.typeUrl || Array.isArray(o.services) && (!o.services.length || Service.isAmino(o.services[0]))); + }, encode(message: BatchGetServicesResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.services) { Service.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -2062,5 +2203,11 @@ export const BatchGetServicesResponse = { typeUrl: "/google.api.serviceusage.v1.BatchGetServicesResponse", value: BatchGetServicesResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(BatchGetServicesResponse.typeUrl)) { + return; + } + Service.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/google/api/serviceusage/v1beta1/resources.ts b/__fixtures__/v-next/outputv2/google/api/serviceusage/v1beta1/resources.ts index 9bcf9eb106..ed41715de4 100644 --- a/__fixtures__/v-next/outputv2/google/api/serviceusage/v1beta1/resources.ts +++ b/__fixtures__/v-next/outputv2/google/api/serviceusage/v1beta1/resources.ts @@ -6,8 +6,9 @@ import { Usage, UsageAmino, UsageSDKType } from "../../usage"; import { Endpoint, EndpointAmino, EndpointSDKType } from "../../endpoint"; import { MonitoredResourceDescriptor, MonitoredResourceDescriptorAmino, MonitoredResourceDescriptorSDKType } from "../../monitored_resource"; import { Monitoring, MonitoringAmino, MonitoringSDKType } from "../../monitoring"; -import { BinaryReader, BinaryWriter } from "../../../../binary"; import { isSet, DeepPartial, isObject } from "../../../../helpers"; +import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { GlobalDecoderRegistry } from "../../../../registry"; import { JsonSafe } from "../../../../json-safe"; export const protobufPackage = "google.api.serviceusage.v1beta1"; /** Whether or not a service has been enabled for use by a consumer. */ @@ -1328,6 +1329,15 @@ function createBaseService(): Service { */ export const Service = { typeUrl: "/google.api.serviceusage.v1beta1.Service", + is(o: any): o is Service { + return o && (o.$typeUrl === Service.typeUrl || typeof o.name === "string" && typeof o.parent === "string" && isSet(o.state)); + }, + isSDK(o: any): o is ServiceSDKType { + return o && (o.$typeUrl === Service.typeUrl || typeof o.name === "string" && typeof o.parent === "string" && isSet(o.state)); + }, + isAmino(o: any): o is ServiceAmino { + return o && (o.$typeUrl === Service.typeUrl || typeof o.name === "string" && typeof o.parent === "string" && isSet(o.state)); + }, encode(message: Service, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -1449,6 +1459,12 @@ export const Service = { typeUrl: "/google.api.serviceusage.v1beta1.Service", value: Service.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Service.typeUrl)) { + return; + } + ServiceConfig.registerTypeUrl(); } }; function createBaseServiceConfig(): ServiceConfig { @@ -1473,6 +1489,15 @@ function createBaseServiceConfig(): ServiceConfig { */ export const ServiceConfig = { typeUrl: "/google.api.serviceusage.v1beta1.ServiceConfig", + is(o: any): o is ServiceConfig { + return o && (o.$typeUrl === ServiceConfig.typeUrl || typeof o.name === "string" && typeof o.title === "string" && Array.isArray(o.apis) && (!o.apis.length || Api.is(o.apis[0])) && Array.isArray(o.endpoints) && (!o.endpoints.length || Endpoint.is(o.endpoints[0])) && Array.isArray(o.monitoredResources) && (!o.monitoredResources.length || MonitoredResourceDescriptor.is(o.monitoredResources[0]))); + }, + isSDK(o: any): o is ServiceConfigSDKType { + return o && (o.$typeUrl === ServiceConfig.typeUrl || typeof o.name === "string" && typeof o.title === "string" && Array.isArray(o.apis) && (!o.apis.length || Api.isSDK(o.apis[0])) && Array.isArray(o.endpoints) && (!o.endpoints.length || Endpoint.isSDK(o.endpoints[0])) && Array.isArray(o.monitored_resources) && (!o.monitored_resources.length || MonitoredResourceDescriptor.isSDK(o.monitored_resources[0]))); + }, + isAmino(o: any): o is ServiceConfigAmino { + return o && (o.$typeUrl === ServiceConfig.typeUrl || typeof o.name === "string" && typeof o.title === "string" && Array.isArray(o.apis) && (!o.apis.length || Api.isAmino(o.apis[0])) && Array.isArray(o.endpoints) && (!o.endpoints.length || Endpoint.isAmino(o.endpoints[0])) && Array.isArray(o.monitored_resources) && (!o.monitored_resources.length || MonitoredResourceDescriptor.isAmino(o.monitored_resources[0]))); + }, encode(message: ServiceConfig, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -1722,6 +1747,19 @@ export const ServiceConfig = { typeUrl: "/google.api.serviceusage.v1beta1.ServiceConfig", value: ServiceConfig.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ServiceConfig.typeUrl)) { + return; + } + Api.registerTypeUrl(); + Documentation.registerTypeUrl(); + Quota.registerTypeUrl(); + Authentication.registerTypeUrl(); + Usage.registerTypeUrl(); + Endpoint.registerTypeUrl(); + MonitoredResourceDescriptor.registerTypeUrl(); + Monitoring.registerTypeUrl(); } }; function createBaseOperationMetadata(): OperationMetadata { @@ -1737,6 +1775,15 @@ function createBaseOperationMetadata(): OperationMetadata { */ export const OperationMetadata = { typeUrl: "/google.api.serviceusage.v1beta1.OperationMetadata", + is(o: any): o is OperationMetadata { + return o && (o.$typeUrl === OperationMetadata.typeUrl || Array.isArray(o.resourceNames) && (!o.resourceNames.length || typeof o.resourceNames[0] === "string")); + }, + isSDK(o: any): o is OperationMetadataSDKType { + return o && (o.$typeUrl === OperationMetadata.typeUrl || Array.isArray(o.resource_names) && (!o.resource_names.length || typeof o.resource_names[0] === "string")); + }, + isAmino(o: any): o is OperationMetadataAmino { + return o && (o.$typeUrl === OperationMetadata.typeUrl || Array.isArray(o.resource_names) && (!o.resource_names.length || typeof o.resource_names[0] === "string")); + }, encode(message: OperationMetadata, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.resourceNames) { writer.uint32(18).string(v!); @@ -1821,7 +1868,8 @@ export const OperationMetadata = { typeUrl: "/google.api.serviceusage.v1beta1.OperationMetadata", value: OperationMetadata.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseConsumerQuotaMetric(): ConsumerQuotaMetric { return { @@ -1841,6 +1889,15 @@ function createBaseConsumerQuotaMetric(): ConsumerQuotaMetric { */ export const ConsumerQuotaMetric = { typeUrl: "/google.api.serviceusage.v1beta1.ConsumerQuotaMetric", + is(o: any): o is ConsumerQuotaMetric { + return o && (o.$typeUrl === ConsumerQuotaMetric.typeUrl || typeof o.name === "string" && typeof o.metric === "string" && typeof o.displayName === "string" && Array.isArray(o.consumerQuotaLimits) && (!o.consumerQuotaLimits.length || ConsumerQuotaLimit.is(o.consumerQuotaLimits[0])) && Array.isArray(o.descendantConsumerQuotaLimits) && (!o.descendantConsumerQuotaLimits.length || ConsumerQuotaLimit.is(o.descendantConsumerQuotaLimits[0])) && typeof o.unit === "string"); + }, + isSDK(o: any): o is ConsumerQuotaMetricSDKType { + return o && (o.$typeUrl === ConsumerQuotaMetric.typeUrl || typeof o.name === "string" && typeof o.metric === "string" && typeof o.display_name === "string" && Array.isArray(o.consumer_quota_limits) && (!o.consumer_quota_limits.length || ConsumerQuotaLimit.isSDK(o.consumer_quota_limits[0])) && Array.isArray(o.descendant_consumer_quota_limits) && (!o.descendant_consumer_quota_limits.length || ConsumerQuotaLimit.isSDK(o.descendant_consumer_quota_limits[0])) && typeof o.unit === "string"); + }, + isAmino(o: any): o is ConsumerQuotaMetricAmino { + return o && (o.$typeUrl === ConsumerQuotaMetric.typeUrl || typeof o.name === "string" && typeof o.metric === "string" && typeof o.display_name === "string" && Array.isArray(o.consumer_quota_limits) && (!o.consumer_quota_limits.length || ConsumerQuotaLimit.isAmino(o.consumer_quota_limits[0])) && Array.isArray(o.descendant_consumer_quota_limits) && (!o.descendant_consumer_quota_limits.length || ConsumerQuotaLimit.isAmino(o.descendant_consumer_quota_limits[0])) && typeof o.unit === "string"); + }, encode(message: ConsumerQuotaMetric, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -2010,6 +2067,12 @@ export const ConsumerQuotaMetric = { typeUrl: "/google.api.serviceusage.v1beta1.ConsumerQuotaMetric", value: ConsumerQuotaMetric.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ConsumerQuotaMetric.typeUrl)) { + return; + } + ConsumerQuotaLimit.registerTypeUrl(); } }; function createBaseConsumerQuotaLimit(): ConsumerQuotaLimit { @@ -2030,6 +2093,15 @@ function createBaseConsumerQuotaLimit(): ConsumerQuotaLimit { */ export const ConsumerQuotaLimit = { typeUrl: "/google.api.serviceusage.v1beta1.ConsumerQuotaLimit", + is(o: any): o is ConsumerQuotaLimit { + return o && (o.$typeUrl === ConsumerQuotaLimit.typeUrl || typeof o.name === "string" && typeof o.metric === "string" && typeof o.unit === "string" && typeof o.isPrecise === "boolean" && typeof o.allowsAdminOverrides === "boolean" && Array.isArray(o.quotaBuckets) && (!o.quotaBuckets.length || QuotaBucket.is(o.quotaBuckets[0]))); + }, + isSDK(o: any): o is ConsumerQuotaLimitSDKType { + return o && (o.$typeUrl === ConsumerQuotaLimit.typeUrl || typeof o.name === "string" && typeof o.metric === "string" && typeof o.unit === "string" && typeof o.is_precise === "boolean" && typeof o.allows_admin_overrides === "boolean" && Array.isArray(o.quota_buckets) && (!o.quota_buckets.length || QuotaBucket.isSDK(o.quota_buckets[0]))); + }, + isAmino(o: any): o is ConsumerQuotaLimitAmino { + return o && (o.$typeUrl === ConsumerQuotaLimit.typeUrl || typeof o.name === "string" && typeof o.metric === "string" && typeof o.unit === "string" && typeof o.is_precise === "boolean" && typeof o.allows_admin_overrides === "boolean" && Array.isArray(o.quota_buckets) && (!o.quota_buckets.length || QuotaBucket.isAmino(o.quota_buckets[0]))); + }, encode(message: ConsumerQuotaLimit, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -2189,6 +2261,12 @@ export const ConsumerQuotaLimit = { typeUrl: "/google.api.serviceusage.v1beta1.ConsumerQuotaLimit", value: ConsumerQuotaLimit.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ConsumerQuotaLimit.typeUrl)) { + return; + } + QuotaBucket.registerTypeUrl(); } }; function createBaseQuotaBucket_DimensionsEntry(): QuotaBucket_DimensionsEntry { @@ -2286,7 +2364,8 @@ export const QuotaBucket_DimensionsEntry = { }, toProto(message: QuotaBucket_DimensionsEntry): Uint8Array { return QuotaBucket_DimensionsEntry.encode(message).finish(); - } + }, + registerTypeUrl() {} }; function createBaseQuotaBucket(): QuotaBucket { return { @@ -2306,6 +2385,15 @@ function createBaseQuotaBucket(): QuotaBucket { */ export const QuotaBucket = { typeUrl: "/google.api.serviceusage.v1beta1.QuotaBucket", + is(o: any): o is QuotaBucket { + return o && (o.$typeUrl === QuotaBucket.typeUrl || typeof o.effectiveLimit === "bigint" && typeof o.defaultLimit === "bigint" && isSet(o.dimensions)); + }, + isSDK(o: any): o is QuotaBucketSDKType { + return o && (o.$typeUrl === QuotaBucket.typeUrl || typeof o.effective_limit === "bigint" && typeof o.default_limit === "bigint" && isSet(o.dimensions)); + }, + isAmino(o: any): o is QuotaBucketAmino { + return o && (o.$typeUrl === QuotaBucket.typeUrl || typeof o.effective_limit === "bigint" && typeof o.default_limit === "bigint" && isSet(o.dimensions)); + }, encode(message: QuotaBucket, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.effectiveLimit !== BigInt(0)) { writer.uint32(8).int64(message.effectiveLimit); @@ -2508,6 +2596,12 @@ export const QuotaBucket = { typeUrl: "/google.api.serviceusage.v1beta1.QuotaBucket", value: QuotaBucket.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QuotaBucket.typeUrl)) { + return; + } + QuotaOverride.registerTypeUrl(); } }; function createBaseQuotaOverride_DimensionsEntry(): QuotaOverride_DimensionsEntry { @@ -2605,7 +2699,8 @@ export const QuotaOverride_DimensionsEntry = { }, toProto(message: QuotaOverride_DimensionsEntry): Uint8Array { return QuotaOverride_DimensionsEntry.encode(message).finish(); - } + }, + registerTypeUrl() {} }; function createBaseQuotaOverride(): QuotaOverride { return { @@ -2625,6 +2720,15 @@ function createBaseQuotaOverride(): QuotaOverride { */ export const QuotaOverride = { typeUrl: "/google.api.serviceusage.v1beta1.QuotaOverride", + is(o: any): o is QuotaOverride { + return o && (o.$typeUrl === QuotaOverride.typeUrl || typeof o.name === "string" && typeof o.overrideValue === "bigint" && isSet(o.dimensions) && typeof o.metric === "string" && typeof o.unit === "string" && typeof o.adminOverrideAncestor === "string"); + }, + isSDK(o: any): o is QuotaOverrideSDKType { + return o && (o.$typeUrl === QuotaOverride.typeUrl || typeof o.name === "string" && typeof o.override_value === "bigint" && isSet(o.dimensions) && typeof o.metric === "string" && typeof o.unit === "string" && typeof o.admin_override_ancestor === "string"); + }, + isAmino(o: any): o is QuotaOverrideAmino { + return o && (o.$typeUrl === QuotaOverride.typeUrl || typeof o.name === "string" && typeof o.override_value === "bigint" && isSet(o.dimensions) && typeof o.metric === "string" && typeof o.unit === "string" && typeof o.admin_override_ancestor === "string"); + }, encode(message: QuotaOverride, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -2819,7 +2923,8 @@ export const QuotaOverride = { typeUrl: "/google.api.serviceusage.v1beta1.QuotaOverride", value: QuotaOverride.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseOverrideInlineSource(): OverrideInlineSource { return { @@ -2834,6 +2939,15 @@ function createBaseOverrideInlineSource(): OverrideInlineSource { */ export const OverrideInlineSource = { typeUrl: "/google.api.serviceusage.v1beta1.OverrideInlineSource", + is(o: any): o is OverrideInlineSource { + return o && (o.$typeUrl === OverrideInlineSource.typeUrl || Array.isArray(o.overrides) && (!o.overrides.length || QuotaOverride.is(o.overrides[0]))); + }, + isSDK(o: any): o is OverrideInlineSourceSDKType { + return o && (o.$typeUrl === OverrideInlineSource.typeUrl || Array.isArray(o.overrides) && (!o.overrides.length || QuotaOverride.isSDK(o.overrides[0]))); + }, + isAmino(o: any): o is OverrideInlineSourceAmino { + return o && (o.$typeUrl === OverrideInlineSource.typeUrl || Array.isArray(o.overrides) && (!o.overrides.length || QuotaOverride.isAmino(o.overrides[0]))); + }, encode(message: OverrideInlineSource, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.overrides) { QuotaOverride.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -2918,6 +3032,12 @@ export const OverrideInlineSource = { typeUrl: "/google.api.serviceusage.v1beta1.OverrideInlineSource", value: OverrideInlineSource.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(OverrideInlineSource.typeUrl)) { + return; + } + QuotaOverride.registerTypeUrl(); } }; function createBaseAdminQuotaPolicy_DimensionsEntry(): AdminQuotaPolicy_DimensionsEntry { @@ -3015,7 +3135,8 @@ export const AdminQuotaPolicy_DimensionsEntry = { }, toProto(message: AdminQuotaPolicy_DimensionsEntry): Uint8Array { return AdminQuotaPolicy_DimensionsEntry.encode(message).finish(); - } + }, + registerTypeUrl() {} }; function createBaseAdminQuotaPolicy(): AdminQuotaPolicy { return { @@ -3035,6 +3156,15 @@ function createBaseAdminQuotaPolicy(): AdminQuotaPolicy { */ export const AdminQuotaPolicy = { typeUrl: "/google.api.serviceusage.v1beta1.AdminQuotaPolicy", + is(o: any): o is AdminQuotaPolicy { + return o && (o.$typeUrl === AdminQuotaPolicy.typeUrl || typeof o.name === "string" && typeof o.policyValue === "bigint" && isSet(o.dimensions) && typeof o.metric === "string" && typeof o.unit === "string" && typeof o.container === "string"); + }, + isSDK(o: any): o is AdminQuotaPolicySDKType { + return o && (o.$typeUrl === AdminQuotaPolicy.typeUrl || typeof o.name === "string" && typeof o.policy_value === "bigint" && isSet(o.dimensions) && typeof o.metric === "string" && typeof o.unit === "string" && typeof o.container === "string"); + }, + isAmino(o: any): o is AdminQuotaPolicyAmino { + return o && (o.$typeUrl === AdminQuotaPolicy.typeUrl || typeof o.name === "string" && typeof o.policy_value === "bigint" && isSet(o.dimensions) && typeof o.metric === "string" && typeof o.unit === "string" && typeof o.container === "string"); + }, encode(message: AdminQuotaPolicy, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -3229,7 +3359,8 @@ export const AdminQuotaPolicy = { typeUrl: "/google.api.serviceusage.v1beta1.AdminQuotaPolicy", value: AdminQuotaPolicy.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseServiceIdentity(): ServiceIdentity { return { @@ -3246,6 +3377,15 @@ function createBaseServiceIdentity(): ServiceIdentity { */ export const ServiceIdentity = { typeUrl: "/google.api.serviceusage.v1beta1.ServiceIdentity", + is(o: any): o is ServiceIdentity { + return o && (o.$typeUrl === ServiceIdentity.typeUrl || typeof o.email === "string" && typeof o.uniqueId === "string"); + }, + isSDK(o: any): o is ServiceIdentitySDKType { + return o && (o.$typeUrl === ServiceIdentity.typeUrl || typeof o.email === "string" && typeof o.unique_id === "string"); + }, + isAmino(o: any): o is ServiceIdentityAmino { + return o && (o.$typeUrl === ServiceIdentity.typeUrl || typeof o.email === "string" && typeof o.unique_id === "string"); + }, encode(message: ServiceIdentity, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.email !== "") { writer.uint32(10).string(message.email); @@ -3335,5 +3475,6 @@ export const ServiceIdentity = { typeUrl: "/google.api.serviceusage.v1beta1.ServiceIdentity", value: ServiceIdentity.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/google/api/serviceusage/v1beta1/serviceusage.ts b/__fixtures__/v-next/outputv2/google/api/serviceusage/v1beta1/serviceusage.ts index df678e320f..bc32d0cac9 100644 --- a/__fixtures__/v-next/outputv2/google/api/serviceusage/v1beta1/serviceusage.ts +++ b/__fixtures__/v-next/outputv2/google/api/serviceusage/v1beta1/serviceusage.ts @@ -3,6 +3,7 @@ import { FieldMask, FieldMaskAmino, FieldMaskSDKType } from "../../../protobuf/f import { BinaryReader, BinaryWriter } from "../../../../binary"; import { isSet, DeepPartial } from "../../../../helpers"; import { JsonSafe } from "../../../../json-safe"; +import { GlobalDecoderRegistry } from "../../../../registry"; export const protobufPackage = "google.api.serviceusage.v1beta1"; /** Enum for service identity state. */ export enum GetServiceIdentityResponse_IdentityState { @@ -2163,6 +2164,15 @@ function createBaseEnableServiceRequest(): EnableServiceRequest { */ export const EnableServiceRequest = { typeUrl: "/google.api.serviceusage.v1beta1.EnableServiceRequest", + is(o: any): o is EnableServiceRequest { + return o && (o.$typeUrl === EnableServiceRequest.typeUrl || typeof o.name === "string"); + }, + isSDK(o: any): o is EnableServiceRequestSDKType { + return o && (o.$typeUrl === EnableServiceRequest.typeUrl || typeof o.name === "string"); + }, + isAmino(o: any): o is EnableServiceRequestAmino { + return o && (o.$typeUrl === EnableServiceRequest.typeUrl || typeof o.name === "string"); + }, encode(message: EnableServiceRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -2237,7 +2247,8 @@ export const EnableServiceRequest = { typeUrl: "/google.api.serviceusage.v1beta1.EnableServiceRequest", value: EnableServiceRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseDisableServiceRequest(): DisableServiceRequest { return { @@ -2252,6 +2263,15 @@ function createBaseDisableServiceRequest(): DisableServiceRequest { */ export const DisableServiceRequest = { typeUrl: "/google.api.serviceusage.v1beta1.DisableServiceRequest", + is(o: any): o is DisableServiceRequest { + return o && (o.$typeUrl === DisableServiceRequest.typeUrl || typeof o.name === "string"); + }, + isSDK(o: any): o is DisableServiceRequestSDKType { + return o && (o.$typeUrl === DisableServiceRequest.typeUrl || typeof o.name === "string"); + }, + isAmino(o: any): o is DisableServiceRequestAmino { + return o && (o.$typeUrl === DisableServiceRequest.typeUrl || typeof o.name === "string"); + }, encode(message: DisableServiceRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -2326,7 +2346,8 @@ export const DisableServiceRequest = { typeUrl: "/google.api.serviceusage.v1beta1.DisableServiceRequest", value: DisableServiceRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseGetServiceRequest(): GetServiceRequest { return { @@ -2341,6 +2362,15 @@ function createBaseGetServiceRequest(): GetServiceRequest { */ export const GetServiceRequest = { typeUrl: "/google.api.serviceusage.v1beta1.GetServiceRequest", + is(o: any): o is GetServiceRequest { + return o && (o.$typeUrl === GetServiceRequest.typeUrl || typeof o.name === "string"); + }, + isSDK(o: any): o is GetServiceRequestSDKType { + return o && (o.$typeUrl === GetServiceRequest.typeUrl || typeof o.name === "string"); + }, + isAmino(o: any): o is GetServiceRequestAmino { + return o && (o.$typeUrl === GetServiceRequest.typeUrl || typeof o.name === "string"); + }, encode(message: GetServiceRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -2415,7 +2445,8 @@ export const GetServiceRequest = { typeUrl: "/google.api.serviceusage.v1beta1.GetServiceRequest", value: GetServiceRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseListServicesRequest(): ListServicesRequest { return { @@ -2433,6 +2464,15 @@ function createBaseListServicesRequest(): ListServicesRequest { */ export const ListServicesRequest = { typeUrl: "/google.api.serviceusage.v1beta1.ListServicesRequest", + is(o: any): o is ListServicesRequest { + return o && (o.$typeUrl === ListServicesRequest.typeUrl || typeof o.parent === "string" && typeof o.pageSize === "number" && typeof o.pageToken === "string" && typeof o.filter === "string"); + }, + isSDK(o: any): o is ListServicesRequestSDKType { + return o && (o.$typeUrl === ListServicesRequest.typeUrl || typeof o.parent === "string" && typeof o.page_size === "number" && typeof o.page_token === "string" && typeof o.filter === "string"); + }, + isAmino(o: any): o is ListServicesRequestAmino { + return o && (o.$typeUrl === ListServicesRequest.typeUrl || typeof o.parent === "string" && typeof o.page_size === "number" && typeof o.page_token === "string" && typeof o.filter === "string"); + }, encode(message: ListServicesRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.parent !== "") { writer.uint32(10).string(message.parent); @@ -2552,7 +2592,8 @@ export const ListServicesRequest = { typeUrl: "/google.api.serviceusage.v1beta1.ListServicesRequest", value: ListServicesRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseListServicesResponse(): ListServicesResponse { return { @@ -2568,6 +2609,15 @@ function createBaseListServicesResponse(): ListServicesResponse { */ export const ListServicesResponse = { typeUrl: "/google.api.serviceusage.v1beta1.ListServicesResponse", + is(o: any): o is ListServicesResponse { + return o && (o.$typeUrl === ListServicesResponse.typeUrl || Array.isArray(o.services) && (!o.services.length || Service.is(o.services[0])) && typeof o.nextPageToken === "string"); + }, + isSDK(o: any): o is ListServicesResponseSDKType { + return o && (o.$typeUrl === ListServicesResponse.typeUrl || Array.isArray(o.services) && (!o.services.length || Service.isSDK(o.services[0])) && typeof o.next_page_token === "string"); + }, + isAmino(o: any): o is ListServicesResponseAmino { + return o && (o.$typeUrl === ListServicesResponse.typeUrl || Array.isArray(o.services) && (!o.services.length || Service.isAmino(o.services[0])) && typeof o.next_page_token === "string"); + }, encode(message: ListServicesResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.services) { Service.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -2667,6 +2717,12 @@ export const ListServicesResponse = { typeUrl: "/google.api.serviceusage.v1beta1.ListServicesResponse", value: ListServicesResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ListServicesResponse.typeUrl)) { + return; + } + Service.registerTypeUrl(); } }; function createBaseBatchEnableServicesRequest(): BatchEnableServicesRequest { @@ -2683,6 +2739,15 @@ function createBaseBatchEnableServicesRequest(): BatchEnableServicesRequest { */ export const BatchEnableServicesRequest = { typeUrl: "/google.api.serviceusage.v1beta1.BatchEnableServicesRequest", + is(o: any): o is BatchEnableServicesRequest { + return o && (o.$typeUrl === BatchEnableServicesRequest.typeUrl || typeof o.parent === "string" && Array.isArray(o.serviceIds) && (!o.serviceIds.length || typeof o.serviceIds[0] === "string")); + }, + isSDK(o: any): o is BatchEnableServicesRequestSDKType { + return o && (o.$typeUrl === BatchEnableServicesRequest.typeUrl || typeof o.parent === "string" && Array.isArray(o.service_ids) && (!o.service_ids.length || typeof o.service_ids[0] === "string")); + }, + isAmino(o: any): o is BatchEnableServicesRequestAmino { + return o && (o.$typeUrl === BatchEnableServicesRequest.typeUrl || typeof o.parent === "string" && Array.isArray(o.service_ids) && (!o.service_ids.length || typeof o.service_ids[0] === "string")); + }, encode(message: BatchEnableServicesRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.parent !== "") { writer.uint32(10).string(message.parent); @@ -2782,7 +2847,8 @@ export const BatchEnableServicesRequest = { typeUrl: "/google.api.serviceusage.v1beta1.BatchEnableServicesRequest", value: BatchEnableServicesRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseListConsumerQuotaMetricsRequest(): ListConsumerQuotaMetricsRequest { return { @@ -2800,6 +2866,15 @@ function createBaseListConsumerQuotaMetricsRequest(): ListConsumerQuotaMetricsRe */ export const ListConsumerQuotaMetricsRequest = { typeUrl: "/google.api.serviceusage.v1beta1.ListConsumerQuotaMetricsRequest", + is(o: any): o is ListConsumerQuotaMetricsRequest { + return o && (o.$typeUrl === ListConsumerQuotaMetricsRequest.typeUrl || typeof o.parent === "string" && typeof o.pageSize === "number" && typeof o.pageToken === "string" && isSet(o.view)); + }, + isSDK(o: any): o is ListConsumerQuotaMetricsRequestSDKType { + return o && (o.$typeUrl === ListConsumerQuotaMetricsRequest.typeUrl || typeof o.parent === "string" && typeof o.page_size === "number" && typeof o.page_token === "string" && isSet(o.view)); + }, + isAmino(o: any): o is ListConsumerQuotaMetricsRequestAmino { + return o && (o.$typeUrl === ListConsumerQuotaMetricsRequest.typeUrl || typeof o.parent === "string" && typeof o.page_size === "number" && typeof o.page_token === "string" && isSet(o.view)); + }, encode(message: ListConsumerQuotaMetricsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.parent !== "") { writer.uint32(10).string(message.parent); @@ -2919,7 +2994,8 @@ export const ListConsumerQuotaMetricsRequest = { typeUrl: "/google.api.serviceusage.v1beta1.ListConsumerQuotaMetricsRequest", value: ListConsumerQuotaMetricsRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseListConsumerQuotaMetricsResponse(): ListConsumerQuotaMetricsResponse { return { @@ -2935,6 +3011,15 @@ function createBaseListConsumerQuotaMetricsResponse(): ListConsumerQuotaMetricsR */ export const ListConsumerQuotaMetricsResponse = { typeUrl: "/google.api.serviceusage.v1beta1.ListConsumerQuotaMetricsResponse", + is(o: any): o is ListConsumerQuotaMetricsResponse { + return o && (o.$typeUrl === ListConsumerQuotaMetricsResponse.typeUrl || Array.isArray(o.metrics) && (!o.metrics.length || ConsumerQuotaMetric.is(o.metrics[0])) && typeof o.nextPageToken === "string"); + }, + isSDK(o: any): o is ListConsumerQuotaMetricsResponseSDKType { + return o && (o.$typeUrl === ListConsumerQuotaMetricsResponse.typeUrl || Array.isArray(o.metrics) && (!o.metrics.length || ConsumerQuotaMetric.isSDK(o.metrics[0])) && typeof o.next_page_token === "string"); + }, + isAmino(o: any): o is ListConsumerQuotaMetricsResponseAmino { + return o && (o.$typeUrl === ListConsumerQuotaMetricsResponse.typeUrl || Array.isArray(o.metrics) && (!o.metrics.length || ConsumerQuotaMetric.isAmino(o.metrics[0])) && typeof o.next_page_token === "string"); + }, encode(message: ListConsumerQuotaMetricsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.metrics) { ConsumerQuotaMetric.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -3034,6 +3119,12 @@ export const ListConsumerQuotaMetricsResponse = { typeUrl: "/google.api.serviceusage.v1beta1.ListConsumerQuotaMetricsResponse", value: ListConsumerQuotaMetricsResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ListConsumerQuotaMetricsResponse.typeUrl)) { + return; + } + ConsumerQuotaMetric.registerTypeUrl(); } }; function createBaseGetConsumerQuotaMetricRequest(): GetConsumerQuotaMetricRequest { @@ -3050,6 +3141,15 @@ function createBaseGetConsumerQuotaMetricRequest(): GetConsumerQuotaMetricReques */ export const GetConsumerQuotaMetricRequest = { typeUrl: "/google.api.serviceusage.v1beta1.GetConsumerQuotaMetricRequest", + is(o: any): o is GetConsumerQuotaMetricRequest { + return o && (o.$typeUrl === GetConsumerQuotaMetricRequest.typeUrl || typeof o.name === "string" && isSet(o.view)); + }, + isSDK(o: any): o is GetConsumerQuotaMetricRequestSDKType { + return o && (o.$typeUrl === GetConsumerQuotaMetricRequest.typeUrl || typeof o.name === "string" && isSet(o.view)); + }, + isAmino(o: any): o is GetConsumerQuotaMetricRequestAmino { + return o && (o.$typeUrl === GetConsumerQuotaMetricRequest.typeUrl || typeof o.name === "string" && isSet(o.view)); + }, encode(message: GetConsumerQuotaMetricRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -3139,7 +3239,8 @@ export const GetConsumerQuotaMetricRequest = { typeUrl: "/google.api.serviceusage.v1beta1.GetConsumerQuotaMetricRequest", value: GetConsumerQuotaMetricRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseGetConsumerQuotaLimitRequest(): GetConsumerQuotaLimitRequest { return { @@ -3155,6 +3256,15 @@ function createBaseGetConsumerQuotaLimitRequest(): GetConsumerQuotaLimitRequest */ export const GetConsumerQuotaLimitRequest = { typeUrl: "/google.api.serviceusage.v1beta1.GetConsumerQuotaLimitRequest", + is(o: any): o is GetConsumerQuotaLimitRequest { + return o && (o.$typeUrl === GetConsumerQuotaLimitRequest.typeUrl || typeof o.name === "string" && isSet(o.view)); + }, + isSDK(o: any): o is GetConsumerQuotaLimitRequestSDKType { + return o && (o.$typeUrl === GetConsumerQuotaLimitRequest.typeUrl || typeof o.name === "string" && isSet(o.view)); + }, + isAmino(o: any): o is GetConsumerQuotaLimitRequestAmino { + return o && (o.$typeUrl === GetConsumerQuotaLimitRequest.typeUrl || typeof o.name === "string" && isSet(o.view)); + }, encode(message: GetConsumerQuotaLimitRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -3244,7 +3354,8 @@ export const GetConsumerQuotaLimitRequest = { typeUrl: "/google.api.serviceusage.v1beta1.GetConsumerQuotaLimitRequest", value: GetConsumerQuotaLimitRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseCreateAdminOverrideRequest(): CreateAdminOverrideRequest { return { @@ -3262,6 +3373,15 @@ function createBaseCreateAdminOverrideRequest(): CreateAdminOverrideRequest { */ export const CreateAdminOverrideRequest = { typeUrl: "/google.api.serviceusage.v1beta1.CreateAdminOverrideRequest", + is(o: any): o is CreateAdminOverrideRequest { + return o && (o.$typeUrl === CreateAdminOverrideRequest.typeUrl || typeof o.parent === "string" && typeof o.force === "boolean" && Array.isArray(o.forceOnly)); + }, + isSDK(o: any): o is CreateAdminOverrideRequestSDKType { + return o && (o.$typeUrl === CreateAdminOverrideRequest.typeUrl || typeof o.parent === "string" && typeof o.force === "boolean" && Array.isArray(o.force_only)); + }, + isAmino(o: any): o is CreateAdminOverrideRequestAmino { + return o && (o.$typeUrl === CreateAdminOverrideRequest.typeUrl || typeof o.parent === "string" && typeof o.force === "boolean" && Array.isArray(o.force_only)); + }, encode(message: CreateAdminOverrideRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.parent !== "") { writer.uint32(10).string(message.parent); @@ -3402,6 +3522,12 @@ export const CreateAdminOverrideRequest = { typeUrl: "/google.api.serviceusage.v1beta1.CreateAdminOverrideRequest", value: CreateAdminOverrideRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(CreateAdminOverrideRequest.typeUrl)) { + return; + } + QuotaOverride.registerTypeUrl(); } }; function createBaseUpdateAdminOverrideRequest(): UpdateAdminOverrideRequest { @@ -3421,6 +3547,15 @@ function createBaseUpdateAdminOverrideRequest(): UpdateAdminOverrideRequest { */ export const UpdateAdminOverrideRequest = { typeUrl: "/google.api.serviceusage.v1beta1.UpdateAdminOverrideRequest", + is(o: any): o is UpdateAdminOverrideRequest { + return o && (o.$typeUrl === UpdateAdminOverrideRequest.typeUrl || typeof o.name === "string" && typeof o.force === "boolean" && Array.isArray(o.forceOnly)); + }, + isSDK(o: any): o is UpdateAdminOverrideRequestSDKType { + return o && (o.$typeUrl === UpdateAdminOverrideRequest.typeUrl || typeof o.name === "string" && typeof o.force === "boolean" && Array.isArray(o.force_only)); + }, + isAmino(o: any): o is UpdateAdminOverrideRequestAmino { + return o && (o.$typeUrl === UpdateAdminOverrideRequest.typeUrl || typeof o.name === "string" && typeof o.force === "boolean" && Array.isArray(o.force_only)); + }, encode(message: UpdateAdminOverrideRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -3578,6 +3713,13 @@ export const UpdateAdminOverrideRequest = { typeUrl: "/google.api.serviceusage.v1beta1.UpdateAdminOverrideRequest", value: UpdateAdminOverrideRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(UpdateAdminOverrideRequest.typeUrl)) { + return; + } + QuotaOverride.registerTypeUrl(); + FieldMask.registerTypeUrl(); } }; function createBaseDeleteAdminOverrideRequest(): DeleteAdminOverrideRequest { @@ -3595,6 +3737,15 @@ function createBaseDeleteAdminOverrideRequest(): DeleteAdminOverrideRequest { */ export const DeleteAdminOverrideRequest = { typeUrl: "/google.api.serviceusage.v1beta1.DeleteAdminOverrideRequest", + is(o: any): o is DeleteAdminOverrideRequest { + return o && (o.$typeUrl === DeleteAdminOverrideRequest.typeUrl || typeof o.name === "string" && typeof o.force === "boolean" && Array.isArray(o.forceOnly)); + }, + isSDK(o: any): o is DeleteAdminOverrideRequestSDKType { + return o && (o.$typeUrl === DeleteAdminOverrideRequest.typeUrl || typeof o.name === "string" && typeof o.force === "boolean" && Array.isArray(o.force_only)); + }, + isAmino(o: any): o is DeleteAdminOverrideRequestAmino { + return o && (o.$typeUrl === DeleteAdminOverrideRequest.typeUrl || typeof o.name === "string" && typeof o.force === "boolean" && Array.isArray(o.force_only)); + }, encode(message: DeleteAdminOverrideRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -3718,7 +3869,8 @@ export const DeleteAdminOverrideRequest = { typeUrl: "/google.api.serviceusage.v1beta1.DeleteAdminOverrideRequest", value: DeleteAdminOverrideRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseListAdminOverridesRequest(): ListAdminOverridesRequest { return { @@ -3735,6 +3887,15 @@ function createBaseListAdminOverridesRequest(): ListAdminOverridesRequest { */ export const ListAdminOverridesRequest = { typeUrl: "/google.api.serviceusage.v1beta1.ListAdminOverridesRequest", + is(o: any): o is ListAdminOverridesRequest { + return o && (o.$typeUrl === ListAdminOverridesRequest.typeUrl || typeof o.parent === "string" && typeof o.pageSize === "number" && typeof o.pageToken === "string"); + }, + isSDK(o: any): o is ListAdminOverridesRequestSDKType { + return o && (o.$typeUrl === ListAdminOverridesRequest.typeUrl || typeof o.parent === "string" && typeof o.page_size === "number" && typeof o.page_token === "string"); + }, + isAmino(o: any): o is ListAdminOverridesRequestAmino { + return o && (o.$typeUrl === ListAdminOverridesRequest.typeUrl || typeof o.parent === "string" && typeof o.page_size === "number" && typeof o.page_token === "string"); + }, encode(message: ListAdminOverridesRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.parent !== "") { writer.uint32(10).string(message.parent); @@ -3839,7 +4000,8 @@ export const ListAdminOverridesRequest = { typeUrl: "/google.api.serviceusage.v1beta1.ListAdminOverridesRequest", value: ListAdminOverridesRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseListAdminOverridesResponse(): ListAdminOverridesResponse { return { @@ -3855,6 +4017,15 @@ function createBaseListAdminOverridesResponse(): ListAdminOverridesResponse { */ export const ListAdminOverridesResponse = { typeUrl: "/google.api.serviceusage.v1beta1.ListAdminOverridesResponse", + is(o: any): o is ListAdminOverridesResponse { + return o && (o.$typeUrl === ListAdminOverridesResponse.typeUrl || Array.isArray(o.overrides) && (!o.overrides.length || QuotaOverride.is(o.overrides[0])) && typeof o.nextPageToken === "string"); + }, + isSDK(o: any): o is ListAdminOverridesResponseSDKType { + return o && (o.$typeUrl === ListAdminOverridesResponse.typeUrl || Array.isArray(o.overrides) && (!o.overrides.length || QuotaOverride.isSDK(o.overrides[0])) && typeof o.next_page_token === "string"); + }, + isAmino(o: any): o is ListAdminOverridesResponseAmino { + return o && (o.$typeUrl === ListAdminOverridesResponse.typeUrl || Array.isArray(o.overrides) && (!o.overrides.length || QuotaOverride.isAmino(o.overrides[0])) && typeof o.next_page_token === "string"); + }, encode(message: ListAdminOverridesResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.overrides) { QuotaOverride.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -3954,6 +4125,12 @@ export const ListAdminOverridesResponse = { typeUrl: "/google.api.serviceusage.v1beta1.ListAdminOverridesResponse", value: ListAdminOverridesResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ListAdminOverridesResponse.typeUrl)) { + return; + } + QuotaOverride.registerTypeUrl(); } }; function createBaseBatchCreateAdminOverridesResponse(): BatchCreateAdminOverridesResponse { @@ -3969,6 +4146,15 @@ function createBaseBatchCreateAdminOverridesResponse(): BatchCreateAdminOverride */ export const BatchCreateAdminOverridesResponse = { typeUrl: "/google.api.serviceusage.v1beta1.BatchCreateAdminOverridesResponse", + is(o: any): o is BatchCreateAdminOverridesResponse { + return o && (o.$typeUrl === BatchCreateAdminOverridesResponse.typeUrl || Array.isArray(o.overrides) && (!o.overrides.length || QuotaOverride.is(o.overrides[0]))); + }, + isSDK(o: any): o is BatchCreateAdminOverridesResponseSDKType { + return o && (o.$typeUrl === BatchCreateAdminOverridesResponse.typeUrl || Array.isArray(o.overrides) && (!o.overrides.length || QuotaOverride.isSDK(o.overrides[0]))); + }, + isAmino(o: any): o is BatchCreateAdminOverridesResponseAmino { + return o && (o.$typeUrl === BatchCreateAdminOverridesResponse.typeUrl || Array.isArray(o.overrides) && (!o.overrides.length || QuotaOverride.isAmino(o.overrides[0]))); + }, encode(message: BatchCreateAdminOverridesResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.overrides) { QuotaOverride.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -4053,6 +4239,12 @@ export const BatchCreateAdminOverridesResponse = { typeUrl: "/google.api.serviceusage.v1beta1.BatchCreateAdminOverridesResponse", value: BatchCreateAdminOverridesResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(BatchCreateAdminOverridesResponse.typeUrl)) { + return; + } + QuotaOverride.registerTypeUrl(); } }; function createBaseImportAdminOverridesRequest(): ImportAdminOverridesRequest { @@ -4071,6 +4263,15 @@ function createBaseImportAdminOverridesRequest(): ImportAdminOverridesRequest { */ export const ImportAdminOverridesRequest = { typeUrl: "/google.api.serviceusage.v1beta1.ImportAdminOverridesRequest", + is(o: any): o is ImportAdminOverridesRequest { + return o && (o.$typeUrl === ImportAdminOverridesRequest.typeUrl || typeof o.parent === "string" && typeof o.force === "boolean" && Array.isArray(o.forceOnly)); + }, + isSDK(o: any): o is ImportAdminOverridesRequestSDKType { + return o && (o.$typeUrl === ImportAdminOverridesRequest.typeUrl || typeof o.parent === "string" && typeof o.force === "boolean" && Array.isArray(o.force_only)); + }, + isAmino(o: any): o is ImportAdminOverridesRequestAmino { + return o && (o.$typeUrl === ImportAdminOverridesRequest.typeUrl || typeof o.parent === "string" && typeof o.force === "boolean" && Array.isArray(o.force_only)); + }, encode(message: ImportAdminOverridesRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.parent !== "") { writer.uint32(10).string(message.parent); @@ -4211,6 +4412,12 @@ export const ImportAdminOverridesRequest = { typeUrl: "/google.api.serviceusage.v1beta1.ImportAdminOverridesRequest", value: ImportAdminOverridesRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ImportAdminOverridesRequest.typeUrl)) { + return; + } + OverrideInlineSource.registerTypeUrl(); } }; function createBaseImportAdminOverridesResponse(): ImportAdminOverridesResponse { @@ -4226,6 +4433,15 @@ function createBaseImportAdminOverridesResponse(): ImportAdminOverridesResponse */ export const ImportAdminOverridesResponse = { typeUrl: "/google.api.serviceusage.v1beta1.ImportAdminOverridesResponse", + is(o: any): o is ImportAdminOverridesResponse { + return o && (o.$typeUrl === ImportAdminOverridesResponse.typeUrl || Array.isArray(o.overrides) && (!o.overrides.length || QuotaOverride.is(o.overrides[0]))); + }, + isSDK(o: any): o is ImportAdminOverridesResponseSDKType { + return o && (o.$typeUrl === ImportAdminOverridesResponse.typeUrl || Array.isArray(o.overrides) && (!o.overrides.length || QuotaOverride.isSDK(o.overrides[0]))); + }, + isAmino(o: any): o is ImportAdminOverridesResponseAmino { + return o && (o.$typeUrl === ImportAdminOverridesResponse.typeUrl || Array.isArray(o.overrides) && (!o.overrides.length || QuotaOverride.isAmino(o.overrides[0]))); + }, encode(message: ImportAdminOverridesResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.overrides) { QuotaOverride.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -4310,6 +4526,12 @@ export const ImportAdminOverridesResponse = { typeUrl: "/google.api.serviceusage.v1beta1.ImportAdminOverridesResponse", value: ImportAdminOverridesResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ImportAdminOverridesResponse.typeUrl)) { + return; + } + QuotaOverride.registerTypeUrl(); } }; function createBaseImportAdminOverridesMetadata(): ImportAdminOverridesMetadata { @@ -4325,6 +4547,15 @@ function createBaseImportAdminOverridesMetadata(): ImportAdminOverridesMetadata */ export const ImportAdminOverridesMetadata = { typeUrl: "/google.api.serviceusage.v1beta1.ImportAdminOverridesMetadata", + is(o: any): o is ImportAdminOverridesMetadata { + return o && o.$typeUrl === ImportAdminOverridesMetadata.typeUrl; + }, + isSDK(o: any): o is ImportAdminOverridesMetadataSDKType { + return o && o.$typeUrl === ImportAdminOverridesMetadata.typeUrl; + }, + isAmino(o: any): o is ImportAdminOverridesMetadataAmino { + return o && o.$typeUrl === ImportAdminOverridesMetadata.typeUrl; + }, encode(_: ImportAdminOverridesMetadata, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -4383,7 +4614,8 @@ export const ImportAdminOverridesMetadata = { typeUrl: "/google.api.serviceusage.v1beta1.ImportAdminOverridesMetadata", value: ImportAdminOverridesMetadata.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseCreateConsumerOverrideRequest(): CreateConsumerOverrideRequest { return { @@ -4401,6 +4633,15 @@ function createBaseCreateConsumerOverrideRequest(): CreateConsumerOverrideReques */ export const CreateConsumerOverrideRequest = { typeUrl: "/google.api.serviceusage.v1beta1.CreateConsumerOverrideRequest", + is(o: any): o is CreateConsumerOverrideRequest { + return o && (o.$typeUrl === CreateConsumerOverrideRequest.typeUrl || typeof o.parent === "string" && typeof o.force === "boolean" && Array.isArray(o.forceOnly)); + }, + isSDK(o: any): o is CreateConsumerOverrideRequestSDKType { + return o && (o.$typeUrl === CreateConsumerOverrideRequest.typeUrl || typeof o.parent === "string" && typeof o.force === "boolean" && Array.isArray(o.force_only)); + }, + isAmino(o: any): o is CreateConsumerOverrideRequestAmino { + return o && (o.$typeUrl === CreateConsumerOverrideRequest.typeUrl || typeof o.parent === "string" && typeof o.force === "boolean" && Array.isArray(o.force_only)); + }, encode(message: CreateConsumerOverrideRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.parent !== "") { writer.uint32(10).string(message.parent); @@ -4541,6 +4782,12 @@ export const CreateConsumerOverrideRequest = { typeUrl: "/google.api.serviceusage.v1beta1.CreateConsumerOverrideRequest", value: CreateConsumerOverrideRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(CreateConsumerOverrideRequest.typeUrl)) { + return; + } + QuotaOverride.registerTypeUrl(); } }; function createBaseUpdateConsumerOverrideRequest(): UpdateConsumerOverrideRequest { @@ -4560,6 +4807,15 @@ function createBaseUpdateConsumerOverrideRequest(): UpdateConsumerOverrideReques */ export const UpdateConsumerOverrideRequest = { typeUrl: "/google.api.serviceusage.v1beta1.UpdateConsumerOverrideRequest", + is(o: any): o is UpdateConsumerOverrideRequest { + return o && (o.$typeUrl === UpdateConsumerOverrideRequest.typeUrl || typeof o.name === "string" && typeof o.force === "boolean" && Array.isArray(o.forceOnly)); + }, + isSDK(o: any): o is UpdateConsumerOverrideRequestSDKType { + return o && (o.$typeUrl === UpdateConsumerOverrideRequest.typeUrl || typeof o.name === "string" && typeof o.force === "boolean" && Array.isArray(o.force_only)); + }, + isAmino(o: any): o is UpdateConsumerOverrideRequestAmino { + return o && (o.$typeUrl === UpdateConsumerOverrideRequest.typeUrl || typeof o.name === "string" && typeof o.force === "boolean" && Array.isArray(o.force_only)); + }, encode(message: UpdateConsumerOverrideRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -4717,6 +4973,13 @@ export const UpdateConsumerOverrideRequest = { typeUrl: "/google.api.serviceusage.v1beta1.UpdateConsumerOverrideRequest", value: UpdateConsumerOverrideRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(UpdateConsumerOverrideRequest.typeUrl)) { + return; + } + QuotaOverride.registerTypeUrl(); + FieldMask.registerTypeUrl(); } }; function createBaseDeleteConsumerOverrideRequest(): DeleteConsumerOverrideRequest { @@ -4734,6 +4997,15 @@ function createBaseDeleteConsumerOverrideRequest(): DeleteConsumerOverrideReques */ export const DeleteConsumerOverrideRequest = { typeUrl: "/google.api.serviceusage.v1beta1.DeleteConsumerOverrideRequest", + is(o: any): o is DeleteConsumerOverrideRequest { + return o && (o.$typeUrl === DeleteConsumerOverrideRequest.typeUrl || typeof o.name === "string" && typeof o.force === "boolean" && Array.isArray(o.forceOnly)); + }, + isSDK(o: any): o is DeleteConsumerOverrideRequestSDKType { + return o && (o.$typeUrl === DeleteConsumerOverrideRequest.typeUrl || typeof o.name === "string" && typeof o.force === "boolean" && Array.isArray(o.force_only)); + }, + isAmino(o: any): o is DeleteConsumerOverrideRequestAmino { + return o && (o.$typeUrl === DeleteConsumerOverrideRequest.typeUrl || typeof o.name === "string" && typeof o.force === "boolean" && Array.isArray(o.force_only)); + }, encode(message: DeleteConsumerOverrideRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -4857,7 +5129,8 @@ export const DeleteConsumerOverrideRequest = { typeUrl: "/google.api.serviceusage.v1beta1.DeleteConsumerOverrideRequest", value: DeleteConsumerOverrideRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseListConsumerOverridesRequest(): ListConsumerOverridesRequest { return { @@ -4874,6 +5147,15 @@ function createBaseListConsumerOverridesRequest(): ListConsumerOverridesRequest */ export const ListConsumerOverridesRequest = { typeUrl: "/google.api.serviceusage.v1beta1.ListConsumerOverridesRequest", + is(o: any): o is ListConsumerOverridesRequest { + return o && (o.$typeUrl === ListConsumerOverridesRequest.typeUrl || typeof o.parent === "string" && typeof o.pageSize === "number" && typeof o.pageToken === "string"); + }, + isSDK(o: any): o is ListConsumerOverridesRequestSDKType { + return o && (o.$typeUrl === ListConsumerOverridesRequest.typeUrl || typeof o.parent === "string" && typeof o.page_size === "number" && typeof o.page_token === "string"); + }, + isAmino(o: any): o is ListConsumerOverridesRequestAmino { + return o && (o.$typeUrl === ListConsumerOverridesRequest.typeUrl || typeof o.parent === "string" && typeof o.page_size === "number" && typeof o.page_token === "string"); + }, encode(message: ListConsumerOverridesRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.parent !== "") { writer.uint32(10).string(message.parent); @@ -4978,7 +5260,8 @@ export const ListConsumerOverridesRequest = { typeUrl: "/google.api.serviceusage.v1beta1.ListConsumerOverridesRequest", value: ListConsumerOverridesRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseListConsumerOverridesResponse(): ListConsumerOverridesResponse { return { @@ -4994,6 +5277,15 @@ function createBaseListConsumerOverridesResponse(): ListConsumerOverridesRespons */ export const ListConsumerOverridesResponse = { typeUrl: "/google.api.serviceusage.v1beta1.ListConsumerOverridesResponse", + is(o: any): o is ListConsumerOverridesResponse { + return o && (o.$typeUrl === ListConsumerOverridesResponse.typeUrl || Array.isArray(o.overrides) && (!o.overrides.length || QuotaOverride.is(o.overrides[0])) && typeof o.nextPageToken === "string"); + }, + isSDK(o: any): o is ListConsumerOverridesResponseSDKType { + return o && (o.$typeUrl === ListConsumerOverridesResponse.typeUrl || Array.isArray(o.overrides) && (!o.overrides.length || QuotaOverride.isSDK(o.overrides[0])) && typeof o.next_page_token === "string"); + }, + isAmino(o: any): o is ListConsumerOverridesResponseAmino { + return o && (o.$typeUrl === ListConsumerOverridesResponse.typeUrl || Array.isArray(o.overrides) && (!o.overrides.length || QuotaOverride.isAmino(o.overrides[0])) && typeof o.next_page_token === "string"); + }, encode(message: ListConsumerOverridesResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.overrides) { QuotaOverride.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -5093,6 +5385,12 @@ export const ListConsumerOverridesResponse = { typeUrl: "/google.api.serviceusage.v1beta1.ListConsumerOverridesResponse", value: ListConsumerOverridesResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ListConsumerOverridesResponse.typeUrl)) { + return; + } + QuotaOverride.registerTypeUrl(); } }; function createBaseBatchCreateConsumerOverridesResponse(): BatchCreateConsumerOverridesResponse { @@ -5108,6 +5406,15 @@ function createBaseBatchCreateConsumerOverridesResponse(): BatchCreateConsumerOv */ export const BatchCreateConsumerOverridesResponse = { typeUrl: "/google.api.serviceusage.v1beta1.BatchCreateConsumerOverridesResponse", + is(o: any): o is BatchCreateConsumerOverridesResponse { + return o && (o.$typeUrl === BatchCreateConsumerOverridesResponse.typeUrl || Array.isArray(o.overrides) && (!o.overrides.length || QuotaOverride.is(o.overrides[0]))); + }, + isSDK(o: any): o is BatchCreateConsumerOverridesResponseSDKType { + return o && (o.$typeUrl === BatchCreateConsumerOverridesResponse.typeUrl || Array.isArray(o.overrides) && (!o.overrides.length || QuotaOverride.isSDK(o.overrides[0]))); + }, + isAmino(o: any): o is BatchCreateConsumerOverridesResponseAmino { + return o && (o.$typeUrl === BatchCreateConsumerOverridesResponse.typeUrl || Array.isArray(o.overrides) && (!o.overrides.length || QuotaOverride.isAmino(o.overrides[0]))); + }, encode(message: BatchCreateConsumerOverridesResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.overrides) { QuotaOverride.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -5192,6 +5499,12 @@ export const BatchCreateConsumerOverridesResponse = { typeUrl: "/google.api.serviceusage.v1beta1.BatchCreateConsumerOverridesResponse", value: BatchCreateConsumerOverridesResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(BatchCreateConsumerOverridesResponse.typeUrl)) { + return; + } + QuotaOverride.registerTypeUrl(); } }; function createBaseImportConsumerOverridesRequest(): ImportConsumerOverridesRequest { @@ -5210,6 +5523,15 @@ function createBaseImportConsumerOverridesRequest(): ImportConsumerOverridesRequ */ export const ImportConsumerOverridesRequest = { typeUrl: "/google.api.serviceusage.v1beta1.ImportConsumerOverridesRequest", + is(o: any): o is ImportConsumerOverridesRequest { + return o && (o.$typeUrl === ImportConsumerOverridesRequest.typeUrl || typeof o.parent === "string" && typeof o.force === "boolean" && Array.isArray(o.forceOnly)); + }, + isSDK(o: any): o is ImportConsumerOverridesRequestSDKType { + return o && (o.$typeUrl === ImportConsumerOverridesRequest.typeUrl || typeof o.parent === "string" && typeof o.force === "boolean" && Array.isArray(o.force_only)); + }, + isAmino(o: any): o is ImportConsumerOverridesRequestAmino { + return o && (o.$typeUrl === ImportConsumerOverridesRequest.typeUrl || typeof o.parent === "string" && typeof o.force === "boolean" && Array.isArray(o.force_only)); + }, encode(message: ImportConsumerOverridesRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.parent !== "") { writer.uint32(10).string(message.parent); @@ -5350,6 +5672,12 @@ export const ImportConsumerOverridesRequest = { typeUrl: "/google.api.serviceusage.v1beta1.ImportConsumerOverridesRequest", value: ImportConsumerOverridesRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ImportConsumerOverridesRequest.typeUrl)) { + return; + } + OverrideInlineSource.registerTypeUrl(); } }; function createBaseImportConsumerOverridesResponse(): ImportConsumerOverridesResponse { @@ -5365,6 +5693,15 @@ function createBaseImportConsumerOverridesResponse(): ImportConsumerOverridesRes */ export const ImportConsumerOverridesResponse = { typeUrl: "/google.api.serviceusage.v1beta1.ImportConsumerOverridesResponse", + is(o: any): o is ImportConsumerOverridesResponse { + return o && (o.$typeUrl === ImportConsumerOverridesResponse.typeUrl || Array.isArray(o.overrides) && (!o.overrides.length || QuotaOverride.is(o.overrides[0]))); + }, + isSDK(o: any): o is ImportConsumerOverridesResponseSDKType { + return o && (o.$typeUrl === ImportConsumerOverridesResponse.typeUrl || Array.isArray(o.overrides) && (!o.overrides.length || QuotaOverride.isSDK(o.overrides[0]))); + }, + isAmino(o: any): o is ImportConsumerOverridesResponseAmino { + return o && (o.$typeUrl === ImportConsumerOverridesResponse.typeUrl || Array.isArray(o.overrides) && (!o.overrides.length || QuotaOverride.isAmino(o.overrides[0]))); + }, encode(message: ImportConsumerOverridesResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.overrides) { QuotaOverride.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -5449,6 +5786,12 @@ export const ImportConsumerOverridesResponse = { typeUrl: "/google.api.serviceusage.v1beta1.ImportConsumerOverridesResponse", value: ImportConsumerOverridesResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ImportConsumerOverridesResponse.typeUrl)) { + return; + } + QuotaOverride.registerTypeUrl(); } }; function createBaseImportConsumerOverridesMetadata(): ImportConsumerOverridesMetadata { @@ -5464,6 +5807,15 @@ function createBaseImportConsumerOverridesMetadata(): ImportConsumerOverridesMet */ export const ImportConsumerOverridesMetadata = { typeUrl: "/google.api.serviceusage.v1beta1.ImportConsumerOverridesMetadata", + is(o: any): o is ImportConsumerOverridesMetadata { + return o && o.$typeUrl === ImportConsumerOverridesMetadata.typeUrl; + }, + isSDK(o: any): o is ImportConsumerOverridesMetadataSDKType { + return o && o.$typeUrl === ImportConsumerOverridesMetadata.typeUrl; + }, + isAmino(o: any): o is ImportConsumerOverridesMetadataAmino { + return o && o.$typeUrl === ImportConsumerOverridesMetadata.typeUrl; + }, encode(_: ImportConsumerOverridesMetadata, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -5522,7 +5874,8 @@ export const ImportConsumerOverridesMetadata = { typeUrl: "/google.api.serviceusage.v1beta1.ImportConsumerOverridesMetadata", value: ImportConsumerOverridesMetadata.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseImportAdminQuotaPoliciesResponse(): ImportAdminQuotaPoliciesResponse { return { @@ -5537,6 +5890,15 @@ function createBaseImportAdminQuotaPoliciesResponse(): ImportAdminQuotaPoliciesR */ export const ImportAdminQuotaPoliciesResponse = { typeUrl: "/google.api.serviceusage.v1beta1.ImportAdminQuotaPoliciesResponse", + is(o: any): o is ImportAdminQuotaPoliciesResponse { + return o && (o.$typeUrl === ImportAdminQuotaPoliciesResponse.typeUrl || Array.isArray(o.policies) && (!o.policies.length || AdminQuotaPolicy.is(o.policies[0]))); + }, + isSDK(o: any): o is ImportAdminQuotaPoliciesResponseSDKType { + return o && (o.$typeUrl === ImportAdminQuotaPoliciesResponse.typeUrl || Array.isArray(o.policies) && (!o.policies.length || AdminQuotaPolicy.isSDK(o.policies[0]))); + }, + isAmino(o: any): o is ImportAdminQuotaPoliciesResponseAmino { + return o && (o.$typeUrl === ImportAdminQuotaPoliciesResponse.typeUrl || Array.isArray(o.policies) && (!o.policies.length || AdminQuotaPolicy.isAmino(o.policies[0]))); + }, encode(message: ImportAdminQuotaPoliciesResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.policies) { AdminQuotaPolicy.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -5621,6 +5983,12 @@ export const ImportAdminQuotaPoliciesResponse = { typeUrl: "/google.api.serviceusage.v1beta1.ImportAdminQuotaPoliciesResponse", value: ImportAdminQuotaPoliciesResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ImportAdminQuotaPoliciesResponse.typeUrl)) { + return; + } + AdminQuotaPolicy.registerTypeUrl(); } }; function createBaseImportAdminQuotaPoliciesMetadata(): ImportAdminQuotaPoliciesMetadata { @@ -5636,6 +6004,15 @@ function createBaseImportAdminQuotaPoliciesMetadata(): ImportAdminQuotaPoliciesM */ export const ImportAdminQuotaPoliciesMetadata = { typeUrl: "/google.api.serviceusage.v1beta1.ImportAdminQuotaPoliciesMetadata", + is(o: any): o is ImportAdminQuotaPoliciesMetadata { + return o && o.$typeUrl === ImportAdminQuotaPoliciesMetadata.typeUrl; + }, + isSDK(o: any): o is ImportAdminQuotaPoliciesMetadataSDKType { + return o && o.$typeUrl === ImportAdminQuotaPoliciesMetadata.typeUrl; + }, + isAmino(o: any): o is ImportAdminQuotaPoliciesMetadataAmino { + return o && o.$typeUrl === ImportAdminQuotaPoliciesMetadata.typeUrl; + }, encode(_: ImportAdminQuotaPoliciesMetadata, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -5694,7 +6071,8 @@ export const ImportAdminQuotaPoliciesMetadata = { typeUrl: "/google.api.serviceusage.v1beta1.ImportAdminQuotaPoliciesMetadata", value: ImportAdminQuotaPoliciesMetadata.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseCreateAdminQuotaPolicyMetadata(): CreateAdminQuotaPolicyMetadata { return {}; @@ -5709,6 +6087,15 @@ function createBaseCreateAdminQuotaPolicyMetadata(): CreateAdminQuotaPolicyMetad */ export const CreateAdminQuotaPolicyMetadata = { typeUrl: "/google.api.serviceusage.v1beta1.CreateAdminQuotaPolicyMetadata", + is(o: any): o is CreateAdminQuotaPolicyMetadata { + return o && o.$typeUrl === CreateAdminQuotaPolicyMetadata.typeUrl; + }, + isSDK(o: any): o is CreateAdminQuotaPolicyMetadataSDKType { + return o && o.$typeUrl === CreateAdminQuotaPolicyMetadata.typeUrl; + }, + isAmino(o: any): o is CreateAdminQuotaPolicyMetadataAmino { + return o && o.$typeUrl === CreateAdminQuotaPolicyMetadata.typeUrl; + }, encode(_: CreateAdminQuotaPolicyMetadata, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -5767,7 +6154,8 @@ export const CreateAdminQuotaPolicyMetadata = { typeUrl: "/google.api.serviceusage.v1beta1.CreateAdminQuotaPolicyMetadata", value: CreateAdminQuotaPolicyMetadata.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseUpdateAdminQuotaPolicyMetadata(): UpdateAdminQuotaPolicyMetadata { return {}; @@ -5782,6 +6170,15 @@ function createBaseUpdateAdminQuotaPolicyMetadata(): UpdateAdminQuotaPolicyMetad */ export const UpdateAdminQuotaPolicyMetadata = { typeUrl: "/google.api.serviceusage.v1beta1.UpdateAdminQuotaPolicyMetadata", + is(o: any): o is UpdateAdminQuotaPolicyMetadata { + return o && o.$typeUrl === UpdateAdminQuotaPolicyMetadata.typeUrl; + }, + isSDK(o: any): o is UpdateAdminQuotaPolicyMetadataSDKType { + return o && o.$typeUrl === UpdateAdminQuotaPolicyMetadata.typeUrl; + }, + isAmino(o: any): o is UpdateAdminQuotaPolicyMetadataAmino { + return o && o.$typeUrl === UpdateAdminQuotaPolicyMetadata.typeUrl; + }, encode(_: UpdateAdminQuotaPolicyMetadata, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -5840,7 +6237,8 @@ export const UpdateAdminQuotaPolicyMetadata = { typeUrl: "/google.api.serviceusage.v1beta1.UpdateAdminQuotaPolicyMetadata", value: UpdateAdminQuotaPolicyMetadata.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseDeleteAdminQuotaPolicyMetadata(): DeleteAdminQuotaPolicyMetadata { return {}; @@ -5855,6 +6253,15 @@ function createBaseDeleteAdminQuotaPolicyMetadata(): DeleteAdminQuotaPolicyMetad */ export const DeleteAdminQuotaPolicyMetadata = { typeUrl: "/google.api.serviceusage.v1beta1.DeleteAdminQuotaPolicyMetadata", + is(o: any): o is DeleteAdminQuotaPolicyMetadata { + return o && o.$typeUrl === DeleteAdminQuotaPolicyMetadata.typeUrl; + }, + isSDK(o: any): o is DeleteAdminQuotaPolicyMetadataSDKType { + return o && o.$typeUrl === DeleteAdminQuotaPolicyMetadata.typeUrl; + }, + isAmino(o: any): o is DeleteAdminQuotaPolicyMetadataAmino { + return o && o.$typeUrl === DeleteAdminQuotaPolicyMetadata.typeUrl; + }, encode(_: DeleteAdminQuotaPolicyMetadata, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -5913,7 +6320,8 @@ export const DeleteAdminQuotaPolicyMetadata = { typeUrl: "/google.api.serviceusage.v1beta1.DeleteAdminQuotaPolicyMetadata", value: DeleteAdminQuotaPolicyMetadata.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseGenerateServiceIdentityRequest(): GenerateServiceIdentityRequest { return { @@ -5928,6 +6336,15 @@ function createBaseGenerateServiceIdentityRequest(): GenerateServiceIdentityRequ */ export const GenerateServiceIdentityRequest = { typeUrl: "/google.api.serviceusage.v1beta1.GenerateServiceIdentityRequest", + is(o: any): o is GenerateServiceIdentityRequest { + return o && (o.$typeUrl === GenerateServiceIdentityRequest.typeUrl || typeof o.parent === "string"); + }, + isSDK(o: any): o is GenerateServiceIdentityRequestSDKType { + return o && (o.$typeUrl === GenerateServiceIdentityRequest.typeUrl || typeof o.parent === "string"); + }, + isAmino(o: any): o is GenerateServiceIdentityRequestAmino { + return o && (o.$typeUrl === GenerateServiceIdentityRequest.typeUrl || typeof o.parent === "string"); + }, encode(message: GenerateServiceIdentityRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.parent !== "") { writer.uint32(10).string(message.parent); @@ -6002,7 +6419,8 @@ export const GenerateServiceIdentityRequest = { typeUrl: "/google.api.serviceusage.v1beta1.GenerateServiceIdentityRequest", value: GenerateServiceIdentityRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseGetServiceIdentityResponse(): GetServiceIdentityResponse { return { @@ -6018,6 +6436,15 @@ function createBaseGetServiceIdentityResponse(): GetServiceIdentityResponse { */ export const GetServiceIdentityResponse = { typeUrl: "/google.api.serviceusage.v1beta1.GetServiceIdentityResponse", + is(o: any): o is GetServiceIdentityResponse { + return o && (o.$typeUrl === GetServiceIdentityResponse.typeUrl || isSet(o.state)); + }, + isSDK(o: any): o is GetServiceIdentityResponseSDKType { + return o && (o.$typeUrl === GetServiceIdentityResponse.typeUrl || isSet(o.state)); + }, + isAmino(o: any): o is GetServiceIdentityResponseAmino { + return o && (o.$typeUrl === GetServiceIdentityResponse.typeUrl || isSet(o.state)); + }, encode(message: GetServiceIdentityResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.identity !== undefined) { ServiceIdentity.encode(message.identity, writer.uint32(10).fork()).ldelim(); @@ -6109,6 +6536,12 @@ export const GetServiceIdentityResponse = { typeUrl: "/google.api.serviceusage.v1beta1.GetServiceIdentityResponse", value: GetServiceIdentityResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GetServiceIdentityResponse.typeUrl)) { + return; + } + ServiceIdentity.registerTypeUrl(); } }; function createBaseGetServiceIdentityMetadata(): GetServiceIdentityMetadata { @@ -6122,6 +6555,15 @@ function createBaseGetServiceIdentityMetadata(): GetServiceIdentityMetadata { */ export const GetServiceIdentityMetadata = { typeUrl: "/google.api.serviceusage.v1beta1.GetServiceIdentityMetadata", + is(o: any): o is GetServiceIdentityMetadata { + return o && o.$typeUrl === GetServiceIdentityMetadata.typeUrl; + }, + isSDK(o: any): o is GetServiceIdentityMetadataSDKType { + return o && o.$typeUrl === GetServiceIdentityMetadata.typeUrl; + }, + isAmino(o: any): o is GetServiceIdentityMetadataAmino { + return o && o.$typeUrl === GetServiceIdentityMetadata.typeUrl; + }, encode(_: GetServiceIdentityMetadata, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -6180,5 +6622,6 @@ export const GetServiceIdentityMetadata = { typeUrl: "/google.api.serviceusage.v1beta1.GetServiceIdentityMetadata", value: GetServiceIdentityMetadata.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/google/api/source_info.ts b/__fixtures__/v-next/outputv2/google/api/source_info.ts index aaa20a3436..862ba6fd0a 100644 --- a/__fixtures__/v-next/outputv2/google/api/source_info.ts +++ b/__fixtures__/v-next/outputv2/google/api/source_info.ts @@ -57,6 +57,15 @@ function createBaseSourceInfo(): SourceInfo { */ export const SourceInfo = { typeUrl: "/google.api.SourceInfo", + is(o: any): o is SourceInfo { + return o && (o.$typeUrl === SourceInfo.typeUrl || Array.isArray(o.sourceFiles) && (!o.sourceFiles.length || Any.is(o.sourceFiles[0]))); + }, + isSDK(o: any): o is SourceInfoSDKType { + return o && (o.$typeUrl === SourceInfo.typeUrl || Array.isArray(o.source_files) && (!o.source_files.length || Any.isSDK(o.source_files[0]))); + }, + isAmino(o: any): o is SourceInfoAmino { + return o && (o.$typeUrl === SourceInfo.typeUrl || Array.isArray(o.source_files) && (!o.source_files.length || Any.isAmino(o.source_files[0]))); + }, encode(message: SourceInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.sourceFiles) { Any.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -141,5 +150,6 @@ export const SourceInfo = { typeUrl: "/google.api.SourceInfo", value: SourceInfo.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/google/api/system_parameter.ts b/__fixtures__/v-next/outputv2/google/api/system_parameter.ts index 687834b101..c4cd23f49e 100644 --- a/__fixtures__/v-next/outputv2/google/api/system_parameter.ts +++ b/__fixtures__/v-next/outputv2/google/api/system_parameter.ts @@ -1,6 +1,7 @@ import { BinaryReader, BinaryWriter } from "../../binary"; import { JsonSafe } from "../../json-safe"; import { DeepPartial, isSet } from "../../helpers"; +import { GlobalDecoderRegistry } from "../../registry"; export const protobufPackage = "google.api"; /** * ### System parameter configuration @@ -268,6 +269,15 @@ function createBaseSystemParameters(): SystemParameters { */ export const SystemParameters = { typeUrl: "/google.api.SystemParameters", + is(o: any): o is SystemParameters { + return o && (o.$typeUrl === SystemParameters.typeUrl || Array.isArray(o.rules) && (!o.rules.length || SystemParameterRule.is(o.rules[0]))); + }, + isSDK(o: any): o is SystemParametersSDKType { + return o && (o.$typeUrl === SystemParameters.typeUrl || Array.isArray(o.rules) && (!o.rules.length || SystemParameterRule.isSDK(o.rules[0]))); + }, + isAmino(o: any): o is SystemParametersAmino { + return o && (o.$typeUrl === SystemParameters.typeUrl || Array.isArray(o.rules) && (!o.rules.length || SystemParameterRule.isAmino(o.rules[0]))); + }, encode(message: SystemParameters, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.rules) { SystemParameterRule.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -352,6 +362,12 @@ export const SystemParameters = { typeUrl: "/google.api.SystemParameters", value: SystemParameters.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(SystemParameters.typeUrl)) { + return; + } + SystemParameterRule.registerTypeUrl(); } }; function createBaseSystemParameterRule(): SystemParameterRule { @@ -369,6 +385,15 @@ function createBaseSystemParameterRule(): SystemParameterRule { */ export const SystemParameterRule = { typeUrl: "/google.api.SystemParameterRule", + is(o: any): o is SystemParameterRule { + return o && (o.$typeUrl === SystemParameterRule.typeUrl || typeof o.selector === "string" && Array.isArray(o.parameters) && (!o.parameters.length || SystemParameter.is(o.parameters[0]))); + }, + isSDK(o: any): o is SystemParameterRuleSDKType { + return o && (o.$typeUrl === SystemParameterRule.typeUrl || typeof o.selector === "string" && Array.isArray(o.parameters) && (!o.parameters.length || SystemParameter.isSDK(o.parameters[0]))); + }, + isAmino(o: any): o is SystemParameterRuleAmino { + return o && (o.$typeUrl === SystemParameterRule.typeUrl || typeof o.selector === "string" && Array.isArray(o.parameters) && (!o.parameters.length || SystemParameter.isAmino(o.parameters[0]))); + }, encode(message: SystemParameterRule, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.selector !== "") { writer.uint32(10).string(message.selector); @@ -468,6 +493,12 @@ export const SystemParameterRule = { typeUrl: "/google.api.SystemParameterRule", value: SystemParameterRule.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(SystemParameterRule.typeUrl)) { + return; + } + SystemParameter.registerTypeUrl(); } }; function createBaseSystemParameter(): SystemParameter { @@ -487,6 +518,15 @@ function createBaseSystemParameter(): SystemParameter { */ export const SystemParameter = { typeUrl: "/google.api.SystemParameter", + is(o: any): o is SystemParameter { + return o && (o.$typeUrl === SystemParameter.typeUrl || typeof o.name === "string" && typeof o.httpHeader === "string" && typeof o.urlQueryParameter === "string"); + }, + isSDK(o: any): o is SystemParameterSDKType { + return o && (o.$typeUrl === SystemParameter.typeUrl || typeof o.name === "string" && typeof o.http_header === "string" && typeof o.url_query_parameter === "string"); + }, + isAmino(o: any): o is SystemParameterAmino { + return o && (o.$typeUrl === SystemParameter.typeUrl || typeof o.name === "string" && typeof o.http_header === "string" && typeof o.url_query_parameter === "string"); + }, encode(message: SystemParameter, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -591,5 +631,6 @@ export const SystemParameter = { typeUrl: "/google.api.SystemParameter", value: SystemParameter.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/google/api/usage.ts b/__fixtures__/v-next/outputv2/google/api/usage.ts index ca2d026559..18e3649c3d 100644 --- a/__fixtures__/v-next/outputv2/google/api/usage.ts +++ b/__fixtures__/v-next/outputv2/google/api/usage.ts @@ -1,6 +1,7 @@ import { BinaryReader, BinaryWriter } from "../../binary"; import { isSet, DeepPartial } from "../../helpers"; import { JsonSafe } from "../../json-safe"; +import { GlobalDecoderRegistry } from "../../registry"; export const protobufPackage = "google.api"; /** * Configuration controlling usage of a service. @@ -255,6 +256,15 @@ function createBaseUsage(): Usage { */ export const Usage = { typeUrl: "/google.api.Usage", + is(o: any): o is Usage { + return o && (o.$typeUrl === Usage.typeUrl || Array.isArray(o.requirements) && (!o.requirements.length || typeof o.requirements[0] === "string") && Array.isArray(o.rules) && (!o.rules.length || UsageRule.is(o.rules[0])) && typeof o.producerNotificationChannel === "string"); + }, + isSDK(o: any): o is UsageSDKType { + return o && (o.$typeUrl === Usage.typeUrl || Array.isArray(o.requirements) && (!o.requirements.length || typeof o.requirements[0] === "string") && Array.isArray(o.rules) && (!o.rules.length || UsageRule.isSDK(o.rules[0])) && typeof o.producer_notification_channel === "string"); + }, + isAmino(o: any): o is UsageAmino { + return o && (o.$typeUrl === Usage.typeUrl || Array.isArray(o.requirements) && (!o.requirements.length || typeof o.requirements[0] === "string") && Array.isArray(o.rules) && (!o.rules.length || UsageRule.isAmino(o.rules[0])) && typeof o.producer_notification_channel === "string"); + }, encode(message: Usage, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.requirements) { writer.uint32(10).string(v!); @@ -379,6 +389,12 @@ export const Usage = { typeUrl: "/google.api.Usage", value: Usage.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Usage.typeUrl)) { + return; + } + UsageRule.registerTypeUrl(); } }; function createBaseUsageRule(): UsageRule { @@ -420,6 +436,15 @@ function createBaseUsageRule(): UsageRule { */ export const UsageRule = { typeUrl: "/google.api.UsageRule", + is(o: any): o is UsageRule { + return o && (o.$typeUrl === UsageRule.typeUrl || typeof o.selector === "string" && typeof o.allowUnregisteredCalls === "boolean" && typeof o.skipServiceControl === "boolean"); + }, + isSDK(o: any): o is UsageRuleSDKType { + return o && (o.$typeUrl === UsageRule.typeUrl || typeof o.selector === "string" && typeof o.allow_unregistered_calls === "boolean" && typeof o.skip_service_control === "boolean"); + }, + isAmino(o: any): o is UsageRuleAmino { + return o && (o.$typeUrl === UsageRule.typeUrl || typeof o.selector === "string" && typeof o.allow_unregistered_calls === "boolean" && typeof o.skip_service_control === "boolean"); + }, encode(message: UsageRule, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.selector !== "") { writer.uint32(10).string(message.selector); @@ -524,5 +549,6 @@ export const UsageRule = { typeUrl: "/google.api.UsageRule", value: UsageRule.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/google/api/visibility.ts b/__fixtures__/v-next/outputv2/google/api/visibility.ts index 5854c733ff..b11ac4eecb 100644 --- a/__fixtures__/v-next/outputv2/google/api/visibility.ts +++ b/__fixtures__/v-next/outputv2/google/api/visibility.ts @@ -1,6 +1,7 @@ import { BinaryReader, BinaryWriter } from "../../binary"; import { JsonSafe } from "../../json-safe"; import { DeepPartial, isSet } from "../../helpers"; +import { GlobalDecoderRegistry } from "../../registry"; export const protobufPackage = "google.api"; /** * `Visibility` defines restrictions for the visibility of service @@ -229,6 +230,15 @@ function createBaseVisibility(): Visibility { */ export const Visibility = { typeUrl: "/google.api.Visibility", + is(o: any): o is Visibility { + return o && (o.$typeUrl === Visibility.typeUrl || Array.isArray(o.rules) && (!o.rules.length || VisibilityRule.is(o.rules[0]))); + }, + isSDK(o: any): o is VisibilitySDKType { + return o && (o.$typeUrl === Visibility.typeUrl || Array.isArray(o.rules) && (!o.rules.length || VisibilityRule.isSDK(o.rules[0]))); + }, + isAmino(o: any): o is VisibilityAmino { + return o && (o.$typeUrl === Visibility.typeUrl || Array.isArray(o.rules) && (!o.rules.length || VisibilityRule.isAmino(o.rules[0]))); + }, encode(message: Visibility, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.rules) { VisibilityRule.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -313,6 +323,12 @@ export const Visibility = { typeUrl: "/google.api.Visibility", value: Visibility.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Visibility.typeUrl)) { + return; + } + VisibilityRule.registerTypeUrl(); } }; function createBaseVisibilityRule(): VisibilityRule { @@ -330,6 +346,15 @@ function createBaseVisibilityRule(): VisibilityRule { */ export const VisibilityRule = { typeUrl: "/google.api.VisibilityRule", + is(o: any): o is VisibilityRule { + return o && (o.$typeUrl === VisibilityRule.typeUrl || typeof o.selector === "string" && typeof o.restriction === "string"); + }, + isSDK(o: any): o is VisibilityRuleSDKType { + return o && (o.$typeUrl === VisibilityRule.typeUrl || typeof o.selector === "string" && typeof o.restriction === "string"); + }, + isAmino(o: any): o is VisibilityRuleAmino { + return o && (o.$typeUrl === VisibilityRule.typeUrl || typeof o.selector === "string" && typeof o.restriction === "string"); + }, encode(message: VisibilityRule, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.selector !== "") { writer.uint32(10).string(message.selector); @@ -419,5 +444,6 @@ export const VisibilityRule = { typeUrl: "/google.api.VisibilityRule", value: VisibilityRule.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/google/logging/type/http_request.ts b/__fixtures__/v-next/outputv2/google/logging/type/http_request.ts index c9a650e893..4fc3398427 100644 --- a/__fixtures__/v-next/outputv2/google/logging/type/http_request.ts +++ b/__fixtures__/v-next/outputv2/google/logging/type/http_request.ts @@ -241,6 +241,15 @@ function createBaseHttpRequest(): HttpRequest { */ export const HttpRequest = { typeUrl: "/google.logging.type.HttpRequest", + is(o: any): o is HttpRequest { + return o && (o.$typeUrl === HttpRequest.typeUrl || typeof o.requestMethod === "string" && typeof o.requestUrl === "string" && typeof o.requestSize === "bigint" && typeof o.status === "number" && typeof o.responseSize === "bigint" && typeof o.userAgent === "string" && typeof o.remoteIp === "string" && typeof o.serverIp === "string" && typeof o.referer === "string" && typeof o.cacheLookup === "boolean" && typeof o.cacheHit === "boolean" && typeof o.cacheValidatedWithOriginServer === "boolean" && typeof o.cacheFillBytes === "bigint" && typeof o.protocol === "string"); + }, + isSDK(o: any): o is HttpRequestSDKType { + return o && (o.$typeUrl === HttpRequest.typeUrl || typeof o.request_method === "string" && typeof o.request_url === "string" && typeof o.request_size === "bigint" && typeof o.status === "number" && typeof o.response_size === "bigint" && typeof o.user_agent === "string" && typeof o.remote_ip === "string" && typeof o.server_ip === "string" && typeof o.referer === "string" && typeof o.cache_lookup === "boolean" && typeof o.cache_hit === "boolean" && typeof o.cache_validated_with_origin_server === "boolean" && typeof o.cache_fill_bytes === "bigint" && typeof o.protocol === "string"); + }, + isAmino(o: any): o is HttpRequestAmino { + return o && (o.$typeUrl === HttpRequest.typeUrl || typeof o.request_method === "string" && typeof o.request_url === "string" && typeof o.request_size === "bigint" && typeof o.status === "number" && typeof o.response_size === "bigint" && typeof o.user_agent === "string" && typeof o.remote_ip === "string" && typeof o.server_ip === "string" && typeof o.referer === "string" && typeof o.cache_lookup === "boolean" && typeof o.cache_hit === "boolean" && typeof o.cache_validated_with_origin_server === "boolean" && typeof o.cache_fill_bytes === "bigint" && typeof o.protocol === "string"); + }, encode(message: HttpRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.requestMethod !== "") { writer.uint32(10).string(message.requestMethod); @@ -533,5 +542,6 @@ export const HttpRequest = { typeUrl: "/google.logging.type.HttpRequest", value: HttpRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/google/logging/v2/log_entry.ts b/__fixtures__/v-next/outputv2/google/logging/v2/log_entry.ts index 47045341d5..7339b65ff0 100644 --- a/__fixtures__/v-next/outputv2/google/logging/v2/log_entry.ts +++ b/__fixtures__/v-next/outputv2/google/logging/v2/log_entry.ts @@ -7,6 +7,7 @@ import { HttpRequest, HttpRequestAmino, HttpRequestSDKType } from "../type/http_ import { BinaryReader, BinaryWriter } from "../../../binary"; import { isSet, DeepPartial, toTimestamp, fromTimestamp, isObject } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "google.logging.v2"; /** * @name LogEntry_LabelsEntry @@ -721,7 +722,8 @@ export const LogEntry_LabelsEntry = { }, toProto(message: LogEntry_LabelsEntry): Uint8Array { return LogEntry_LabelsEntry.encode(message).finish(); - } + }, + registerTypeUrl() {} }; function createBaseLogEntry(): LogEntry { return { @@ -752,6 +754,15 @@ function createBaseLogEntry(): LogEntry { */ export const LogEntry = { typeUrl: "/google.logging.v2.LogEntry", + is(o: any): o is LogEntry { + return o && (o.$typeUrl === LogEntry.typeUrl || typeof o.logName === "string" && isSet(o.severity) && typeof o.insertId === "string" && isSet(o.labels) && typeof o.trace === "string" && typeof o.spanId === "string" && typeof o.traceSampled === "boolean"); + }, + isSDK(o: any): o is LogEntrySDKType { + return o && (o.$typeUrl === LogEntry.typeUrl || typeof o.log_name === "string" && isSet(o.severity) && typeof o.insert_id === "string" && isSet(o.labels) && typeof o.trace === "string" && typeof o.span_id === "string" && typeof o.trace_sampled === "boolean"); + }, + isAmino(o: any): o is LogEntryAmino { + return o && (o.$typeUrl === LogEntry.typeUrl || typeof o.log_name === "string" && isSet(o.severity) && typeof o.insert_id === "string" && isSet(o.labels) && typeof o.trace === "string" && typeof o.span_id === "string" && typeof o.trace_sampled === "boolean"); + }, encode(message: LogEntry, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.logName !== "") { writer.uint32(98).string(message.logName); @@ -1123,6 +1134,16 @@ export const LogEntry = { typeUrl: "/google.logging.v2.LogEntry", value: LogEntry.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(LogEntry.typeUrl)) { + return; + } + Struct.registerTypeUrl(); + HttpRequest.registerTypeUrl(); + LogEntryOperation.registerTypeUrl(); + LogEntrySourceLocation.registerTypeUrl(); + LogSplit.registerTypeUrl(); } }; function createBaseLogEntryOperation(): LogEntryOperation { @@ -1142,6 +1163,15 @@ function createBaseLogEntryOperation(): LogEntryOperation { */ export const LogEntryOperation = { typeUrl: "/google.logging.v2.LogEntryOperation", + is(o: any): o is LogEntryOperation { + return o && (o.$typeUrl === LogEntryOperation.typeUrl || typeof o.id === "string" && typeof o.producer === "string" && typeof o.first === "boolean" && typeof o.last === "boolean"); + }, + isSDK(o: any): o is LogEntryOperationSDKType { + return o && (o.$typeUrl === LogEntryOperation.typeUrl || typeof o.id === "string" && typeof o.producer === "string" && typeof o.first === "boolean" && typeof o.last === "boolean"); + }, + isAmino(o: any): o is LogEntryOperationAmino { + return o && (o.$typeUrl === LogEntryOperation.typeUrl || typeof o.id === "string" && typeof o.producer === "string" && typeof o.first === "boolean" && typeof o.last === "boolean"); + }, encode(message: LogEntryOperation, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.id !== "") { writer.uint32(10).string(message.id); @@ -1261,7 +1291,8 @@ export const LogEntryOperation = { typeUrl: "/google.logging.v2.LogEntryOperation", value: LogEntryOperation.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseLogEntrySourceLocation(): LogEntrySourceLocation { return { @@ -1279,6 +1310,15 @@ function createBaseLogEntrySourceLocation(): LogEntrySourceLocation { */ export const LogEntrySourceLocation = { typeUrl: "/google.logging.v2.LogEntrySourceLocation", + is(o: any): o is LogEntrySourceLocation { + return o && (o.$typeUrl === LogEntrySourceLocation.typeUrl || typeof o.file === "string" && typeof o.line === "bigint" && typeof o.function === "string"); + }, + isSDK(o: any): o is LogEntrySourceLocationSDKType { + return o && (o.$typeUrl === LogEntrySourceLocation.typeUrl || typeof o.file === "string" && typeof o.line === "bigint" && typeof o.function === "string"); + }, + isAmino(o: any): o is LogEntrySourceLocationAmino { + return o && (o.$typeUrl === LogEntrySourceLocation.typeUrl || typeof o.file === "string" && typeof o.line === "bigint" && typeof o.function === "string"); + }, encode(message: LogEntrySourceLocation, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.file !== "") { writer.uint32(10).string(message.file); @@ -1385,7 +1425,8 @@ export const LogEntrySourceLocation = { typeUrl: "/google.logging.v2.LogEntrySourceLocation", value: LogEntrySourceLocation.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseLogSplit(): LogSplit { return { @@ -1404,6 +1445,15 @@ function createBaseLogSplit(): LogSplit { */ export const LogSplit = { typeUrl: "/google.logging.v2.LogSplit", + is(o: any): o is LogSplit { + return o && (o.$typeUrl === LogSplit.typeUrl || typeof o.uid === "string" && typeof o.index === "number" && typeof o.totalSplits === "number"); + }, + isSDK(o: any): o is LogSplitSDKType { + return o && (o.$typeUrl === LogSplit.typeUrl || typeof o.uid === "string" && typeof o.index === "number" && typeof o.total_splits === "number"); + }, + isAmino(o: any): o is LogSplitAmino { + return o && (o.$typeUrl === LogSplit.typeUrl || typeof o.uid === "string" && typeof o.index === "number" && typeof o.total_splits === "number"); + }, encode(message: LogSplit, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.uid !== "") { writer.uint32(10).string(message.uid); @@ -1508,5 +1558,6 @@ export const LogSplit = { typeUrl: "/google.logging.v2.LogSplit", value: LogSplit.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/google/logging/v2/logging.ts b/__fixtures__/v-next/outputv2/google/logging/v2/logging.ts index 6a437777cd..ee5b22db79 100644 --- a/__fixtures__/v-next/outputv2/google/logging/v2/logging.ts +++ b/__fixtures__/v-next/outputv2/google/logging/v2/logging.ts @@ -5,6 +5,7 @@ import { Status, StatusAmino, StatusSDKType } from "../../rpc/status"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { isSet, DeepPartial, isObject } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "google.logging.v2"; /** An indicator of why entries were omitted. */ export enum TailLogEntriesResponse_SuppressionInfo_Reason { @@ -1202,6 +1203,15 @@ function createBaseDeleteLogRequest(): DeleteLogRequest { */ export const DeleteLogRequest = { typeUrl: "/google.logging.v2.DeleteLogRequest", + is(o: any): o is DeleteLogRequest { + return o && (o.$typeUrl === DeleteLogRequest.typeUrl || typeof o.logName === "string"); + }, + isSDK(o: any): o is DeleteLogRequestSDKType { + return o && (o.$typeUrl === DeleteLogRequest.typeUrl || typeof o.log_name === "string"); + }, + isAmino(o: any): o is DeleteLogRequestAmino { + return o && (o.$typeUrl === DeleteLogRequest.typeUrl || typeof o.log_name === "string"); + }, encode(message: DeleteLogRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.logName !== "") { writer.uint32(10).string(message.logName); @@ -1276,7 +1286,8 @@ export const DeleteLogRequest = { typeUrl: "/google.logging.v2.DeleteLogRequest", value: DeleteLogRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseWriteLogEntriesRequest_LabelsEntry(): WriteLogEntriesRequest_LabelsEntry { return { @@ -1373,7 +1384,8 @@ export const WriteLogEntriesRequest_LabelsEntry = { }, toProto(message: WriteLogEntriesRequest_LabelsEntry): Uint8Array { return WriteLogEntriesRequest_LabelsEntry.encode(message).finish(); - } + }, + registerTypeUrl() {} }; function createBaseWriteLogEntriesRequest(): WriteLogEntriesRequest { return { @@ -1393,6 +1405,15 @@ function createBaseWriteLogEntriesRequest(): WriteLogEntriesRequest { */ export const WriteLogEntriesRequest = { typeUrl: "/google.logging.v2.WriteLogEntriesRequest", + is(o: any): o is WriteLogEntriesRequest { + return o && (o.$typeUrl === WriteLogEntriesRequest.typeUrl || typeof o.logName === "string" && isSet(o.labels) && Array.isArray(o.entries) && (!o.entries.length || LogEntry.is(o.entries[0])) && typeof o.partialSuccess === "boolean" && typeof o.dryRun === "boolean"); + }, + isSDK(o: any): o is WriteLogEntriesRequestSDKType { + return o && (o.$typeUrl === WriteLogEntriesRequest.typeUrl || typeof o.log_name === "string" && isSet(o.labels) && Array.isArray(o.entries) && (!o.entries.length || LogEntry.isSDK(o.entries[0])) && typeof o.partial_success === "boolean" && typeof o.dry_run === "boolean"); + }, + isAmino(o: any): o is WriteLogEntriesRequestAmino { + return o && (o.$typeUrl === WriteLogEntriesRequest.typeUrl || typeof o.log_name === "string" && isSet(o.labels) && Array.isArray(o.entries) && (!o.entries.length || LogEntry.isAmino(o.entries[0])) && typeof o.partial_success === "boolean" && typeof o.dry_run === "boolean"); + }, encode(message: WriteLogEntriesRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.logName !== "") { writer.uint32(10).string(message.logName); @@ -1597,6 +1618,13 @@ export const WriteLogEntriesRequest = { typeUrl: "/google.logging.v2.WriteLogEntriesRequest", value: WriteLogEntriesRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(WriteLogEntriesRequest.typeUrl)) { + return; + } + MonitoredResource.registerTypeUrl(); + LogEntry.registerTypeUrl(); } }; function createBaseWriteLogEntriesResponse(): WriteLogEntriesResponse { @@ -1610,6 +1638,15 @@ function createBaseWriteLogEntriesResponse(): WriteLogEntriesResponse { */ export const WriteLogEntriesResponse = { typeUrl: "/google.logging.v2.WriteLogEntriesResponse", + is(o: any): o is WriteLogEntriesResponse { + return o && o.$typeUrl === WriteLogEntriesResponse.typeUrl; + }, + isSDK(o: any): o is WriteLogEntriesResponseSDKType { + return o && o.$typeUrl === WriteLogEntriesResponse.typeUrl; + }, + isAmino(o: any): o is WriteLogEntriesResponseAmino { + return o && o.$typeUrl === WriteLogEntriesResponse.typeUrl; + }, encode(_: WriteLogEntriesResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -1668,7 +1705,8 @@ export const WriteLogEntriesResponse = { typeUrl: "/google.logging.v2.WriteLogEntriesResponse", value: WriteLogEntriesResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseWriteLogEntriesPartialErrors_LogEntryErrorsEntry(): WriteLogEntriesPartialErrors_LogEntryErrorsEntry { return { @@ -1767,6 +1805,9 @@ export const WriteLogEntriesPartialErrors_LogEntryErrorsEntry = { }, toProto(message: WriteLogEntriesPartialErrors_LogEntryErrorsEntry): Uint8Array { return WriteLogEntriesPartialErrors_LogEntryErrorsEntry.encode(message).finish(); + }, + registerTypeUrl() { + Status.registerTypeUrl(); } }; function createBaseWriteLogEntriesPartialErrors(): WriteLogEntriesPartialErrors { @@ -1782,6 +1823,15 @@ function createBaseWriteLogEntriesPartialErrors(): WriteLogEntriesPartialErrors */ export const WriteLogEntriesPartialErrors = { typeUrl: "/google.logging.v2.WriteLogEntriesPartialErrors", + is(o: any): o is WriteLogEntriesPartialErrors { + return o && (o.$typeUrl === WriteLogEntriesPartialErrors.typeUrl || isSet(o.logEntryErrors)); + }, + isSDK(o: any): o is WriteLogEntriesPartialErrorsSDKType { + return o && (o.$typeUrl === WriteLogEntriesPartialErrors.typeUrl || isSet(o.log_entry_errors)); + }, + isAmino(o: any): o is WriteLogEntriesPartialErrorsAmino { + return o && (o.$typeUrl === WriteLogEntriesPartialErrors.typeUrl || isSet(o.log_entry_errors)); + }, encode(message: WriteLogEntriesPartialErrors, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { Object.entries(message.logEntryErrors).forEach(([key, value]) => { WriteLogEntriesPartialErrors_LogEntryErrorsEntry.encode({ @@ -1899,6 +1949,12 @@ export const WriteLogEntriesPartialErrors = { typeUrl: "/google.logging.v2.WriteLogEntriesPartialErrors", value: WriteLogEntriesPartialErrors.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(WriteLogEntriesPartialErrors.typeUrl)) { + return; + } + Status.registerTypeUrl(); } }; function createBaseListLogEntriesRequest(): ListLogEntriesRequest { @@ -1918,6 +1974,15 @@ function createBaseListLogEntriesRequest(): ListLogEntriesRequest { */ export const ListLogEntriesRequest = { typeUrl: "/google.logging.v2.ListLogEntriesRequest", + is(o: any): o is ListLogEntriesRequest { + return o && (o.$typeUrl === ListLogEntriesRequest.typeUrl || Array.isArray(o.resourceNames) && (!o.resourceNames.length || typeof o.resourceNames[0] === "string") && typeof o.filter === "string" && typeof o.orderBy === "string" && typeof o.pageSize === "number" && typeof o.pageToken === "string"); + }, + isSDK(o: any): o is ListLogEntriesRequestSDKType { + return o && (o.$typeUrl === ListLogEntriesRequest.typeUrl || Array.isArray(o.resource_names) && (!o.resource_names.length || typeof o.resource_names[0] === "string") && typeof o.filter === "string" && typeof o.order_by === "string" && typeof o.page_size === "number" && typeof o.page_token === "string"); + }, + isAmino(o: any): o is ListLogEntriesRequestAmino { + return o && (o.$typeUrl === ListLogEntriesRequest.typeUrl || Array.isArray(o.resource_names) && (!o.resource_names.length || typeof o.resource_names[0] === "string") && typeof o.filter === "string" && typeof o.order_by === "string" && typeof o.page_size === "number" && typeof o.page_token === "string"); + }, encode(message: ListLogEntriesRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.resourceNames) { writer.uint32(66).string(v!); @@ -2062,7 +2127,8 @@ export const ListLogEntriesRequest = { typeUrl: "/google.logging.v2.ListLogEntriesRequest", value: ListLogEntriesRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseListLogEntriesResponse(): ListLogEntriesResponse { return { @@ -2078,6 +2144,15 @@ function createBaseListLogEntriesResponse(): ListLogEntriesResponse { */ export const ListLogEntriesResponse = { typeUrl: "/google.logging.v2.ListLogEntriesResponse", + is(o: any): o is ListLogEntriesResponse { + return o && (o.$typeUrl === ListLogEntriesResponse.typeUrl || Array.isArray(o.entries) && (!o.entries.length || LogEntry.is(o.entries[0])) && typeof o.nextPageToken === "string"); + }, + isSDK(o: any): o is ListLogEntriesResponseSDKType { + return o && (o.$typeUrl === ListLogEntriesResponse.typeUrl || Array.isArray(o.entries) && (!o.entries.length || LogEntry.isSDK(o.entries[0])) && typeof o.next_page_token === "string"); + }, + isAmino(o: any): o is ListLogEntriesResponseAmino { + return o && (o.$typeUrl === ListLogEntriesResponse.typeUrl || Array.isArray(o.entries) && (!o.entries.length || LogEntry.isAmino(o.entries[0])) && typeof o.next_page_token === "string"); + }, encode(message: ListLogEntriesResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.entries) { LogEntry.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -2177,6 +2252,12 @@ export const ListLogEntriesResponse = { typeUrl: "/google.logging.v2.ListLogEntriesResponse", value: ListLogEntriesResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ListLogEntriesResponse.typeUrl)) { + return; + } + LogEntry.registerTypeUrl(); } }; function createBaseListMonitoredResourceDescriptorsRequest(): ListMonitoredResourceDescriptorsRequest { @@ -2193,6 +2274,15 @@ function createBaseListMonitoredResourceDescriptorsRequest(): ListMonitoredResou */ export const ListMonitoredResourceDescriptorsRequest = { typeUrl: "/google.logging.v2.ListMonitoredResourceDescriptorsRequest", + is(o: any): o is ListMonitoredResourceDescriptorsRequest { + return o && (o.$typeUrl === ListMonitoredResourceDescriptorsRequest.typeUrl || typeof o.pageSize === "number" && typeof o.pageToken === "string"); + }, + isSDK(o: any): o is ListMonitoredResourceDescriptorsRequestSDKType { + return o && (o.$typeUrl === ListMonitoredResourceDescriptorsRequest.typeUrl || typeof o.page_size === "number" && typeof o.page_token === "string"); + }, + isAmino(o: any): o is ListMonitoredResourceDescriptorsRequestAmino { + return o && (o.$typeUrl === ListMonitoredResourceDescriptorsRequest.typeUrl || typeof o.page_size === "number" && typeof o.page_token === "string"); + }, encode(message: ListMonitoredResourceDescriptorsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.pageSize !== 0) { writer.uint32(8).int32(message.pageSize); @@ -2282,7 +2372,8 @@ export const ListMonitoredResourceDescriptorsRequest = { typeUrl: "/google.logging.v2.ListMonitoredResourceDescriptorsRequest", value: ListMonitoredResourceDescriptorsRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseListMonitoredResourceDescriptorsResponse(): ListMonitoredResourceDescriptorsResponse { return { @@ -2298,6 +2389,15 @@ function createBaseListMonitoredResourceDescriptorsResponse(): ListMonitoredReso */ export const ListMonitoredResourceDescriptorsResponse = { typeUrl: "/google.logging.v2.ListMonitoredResourceDescriptorsResponse", + is(o: any): o is ListMonitoredResourceDescriptorsResponse { + return o && (o.$typeUrl === ListMonitoredResourceDescriptorsResponse.typeUrl || Array.isArray(o.resourceDescriptors) && (!o.resourceDescriptors.length || MonitoredResourceDescriptor.is(o.resourceDescriptors[0])) && typeof o.nextPageToken === "string"); + }, + isSDK(o: any): o is ListMonitoredResourceDescriptorsResponseSDKType { + return o && (o.$typeUrl === ListMonitoredResourceDescriptorsResponse.typeUrl || Array.isArray(o.resource_descriptors) && (!o.resource_descriptors.length || MonitoredResourceDescriptor.isSDK(o.resource_descriptors[0])) && typeof o.next_page_token === "string"); + }, + isAmino(o: any): o is ListMonitoredResourceDescriptorsResponseAmino { + return o && (o.$typeUrl === ListMonitoredResourceDescriptorsResponse.typeUrl || Array.isArray(o.resource_descriptors) && (!o.resource_descriptors.length || MonitoredResourceDescriptor.isAmino(o.resource_descriptors[0])) && typeof o.next_page_token === "string"); + }, encode(message: ListMonitoredResourceDescriptorsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.resourceDescriptors) { MonitoredResourceDescriptor.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -2397,6 +2497,12 @@ export const ListMonitoredResourceDescriptorsResponse = { typeUrl: "/google.logging.v2.ListMonitoredResourceDescriptorsResponse", value: ListMonitoredResourceDescriptorsResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ListMonitoredResourceDescriptorsResponse.typeUrl)) { + return; + } + MonitoredResourceDescriptor.registerTypeUrl(); } }; function createBaseListLogsRequest(): ListLogsRequest { @@ -2415,6 +2521,15 @@ function createBaseListLogsRequest(): ListLogsRequest { */ export const ListLogsRequest = { typeUrl: "/google.logging.v2.ListLogsRequest", + is(o: any): o is ListLogsRequest { + return o && (o.$typeUrl === ListLogsRequest.typeUrl || typeof o.parent === "string" && typeof o.pageSize === "number" && typeof o.pageToken === "string" && Array.isArray(o.resourceNames) && (!o.resourceNames.length || typeof o.resourceNames[0] === "string")); + }, + isSDK(o: any): o is ListLogsRequestSDKType { + return o && (o.$typeUrl === ListLogsRequest.typeUrl || typeof o.parent === "string" && typeof o.page_size === "number" && typeof o.page_token === "string" && Array.isArray(o.resource_names) && (!o.resource_names.length || typeof o.resource_names[0] === "string")); + }, + isAmino(o: any): o is ListLogsRequestAmino { + return o && (o.$typeUrl === ListLogsRequest.typeUrl || typeof o.parent === "string" && typeof o.page_size === "number" && typeof o.page_token === "string" && Array.isArray(o.resource_names) && (!o.resource_names.length || typeof o.resource_names[0] === "string")); + }, encode(message: ListLogsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.parent !== "") { writer.uint32(10).string(message.parent); @@ -2544,7 +2659,8 @@ export const ListLogsRequest = { typeUrl: "/google.logging.v2.ListLogsRequest", value: ListLogsRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseListLogsResponse(): ListLogsResponse { return { @@ -2560,6 +2676,15 @@ function createBaseListLogsResponse(): ListLogsResponse { */ export const ListLogsResponse = { typeUrl: "/google.logging.v2.ListLogsResponse", + is(o: any): o is ListLogsResponse { + return o && (o.$typeUrl === ListLogsResponse.typeUrl || Array.isArray(o.logNames) && (!o.logNames.length || typeof o.logNames[0] === "string") && typeof o.nextPageToken === "string"); + }, + isSDK(o: any): o is ListLogsResponseSDKType { + return o && (o.$typeUrl === ListLogsResponse.typeUrl || Array.isArray(o.log_names) && (!o.log_names.length || typeof o.log_names[0] === "string") && typeof o.next_page_token === "string"); + }, + isAmino(o: any): o is ListLogsResponseAmino { + return o && (o.$typeUrl === ListLogsResponse.typeUrl || Array.isArray(o.log_names) && (!o.log_names.length || typeof o.log_names[0] === "string") && typeof o.next_page_token === "string"); + }, encode(message: ListLogsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.logNames) { writer.uint32(26).string(v!); @@ -2659,7 +2784,8 @@ export const ListLogsResponse = { typeUrl: "/google.logging.v2.ListLogsResponse", value: ListLogsResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseTailLogEntriesRequest(): TailLogEntriesRequest { return { @@ -2676,6 +2802,15 @@ function createBaseTailLogEntriesRequest(): TailLogEntriesRequest { */ export const TailLogEntriesRequest = { typeUrl: "/google.logging.v2.TailLogEntriesRequest", + is(o: any): o is TailLogEntriesRequest { + return o && (o.$typeUrl === TailLogEntriesRequest.typeUrl || Array.isArray(o.resourceNames) && (!o.resourceNames.length || typeof o.resourceNames[0] === "string") && typeof o.filter === "string"); + }, + isSDK(o: any): o is TailLogEntriesRequestSDKType { + return o && (o.$typeUrl === TailLogEntriesRequest.typeUrl || Array.isArray(o.resource_names) && (!o.resource_names.length || typeof o.resource_names[0] === "string") && typeof o.filter === "string"); + }, + isAmino(o: any): o is TailLogEntriesRequestAmino { + return o && (o.$typeUrl === TailLogEntriesRequest.typeUrl || Array.isArray(o.resource_names) && (!o.resource_names.length || typeof o.resource_names[0] === "string") && typeof o.filter === "string"); + }, encode(message: TailLogEntriesRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.resourceNames) { writer.uint32(10).string(v!); @@ -2792,7 +2927,8 @@ export const TailLogEntriesRequest = { typeUrl: "/google.logging.v2.TailLogEntriesRequest", value: TailLogEntriesRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseTailLogEntriesResponse(): TailLogEntriesResponse { return { @@ -2808,6 +2944,15 @@ function createBaseTailLogEntriesResponse(): TailLogEntriesResponse { */ export const TailLogEntriesResponse = { typeUrl: "/google.logging.v2.TailLogEntriesResponse", + is(o: any): o is TailLogEntriesResponse { + return o && (o.$typeUrl === TailLogEntriesResponse.typeUrl || Array.isArray(o.entries) && (!o.entries.length || LogEntry.is(o.entries[0])) && Array.isArray(o.suppressionInfo) && (!o.suppressionInfo.length || TailLogEntriesResponse_SuppressionInfo.is(o.suppressionInfo[0]))); + }, + isSDK(o: any): o is TailLogEntriesResponseSDKType { + return o && (o.$typeUrl === TailLogEntriesResponse.typeUrl || Array.isArray(o.entries) && (!o.entries.length || LogEntry.isSDK(o.entries[0])) && Array.isArray(o.suppression_info) && (!o.suppression_info.length || TailLogEntriesResponse_SuppressionInfo.isSDK(o.suppression_info[0]))); + }, + isAmino(o: any): o is TailLogEntriesResponseAmino { + return o && (o.$typeUrl === TailLogEntriesResponse.typeUrl || Array.isArray(o.entries) && (!o.entries.length || LogEntry.isAmino(o.entries[0])) && Array.isArray(o.suppression_info) && (!o.suppression_info.length || TailLogEntriesResponse_SuppressionInfo.isAmino(o.suppression_info[0]))); + }, encode(message: TailLogEntriesResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.entries) { LogEntry.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -2917,6 +3062,13 @@ export const TailLogEntriesResponse = { typeUrl: "/google.logging.v2.TailLogEntriesResponse", value: TailLogEntriesResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(TailLogEntriesResponse.typeUrl)) { + return; + } + LogEntry.registerTypeUrl(); + TailLogEntriesResponse_SuppressionInfo.registerTypeUrl(); } }; function createBaseTailLogEntriesResponse_SuppressionInfo(): TailLogEntriesResponse_SuppressionInfo { @@ -2933,6 +3085,15 @@ function createBaseTailLogEntriesResponse_SuppressionInfo(): TailLogEntriesRespo */ export const TailLogEntriesResponse_SuppressionInfo = { typeUrl: "/google.logging.v2.SuppressionInfo", + is(o: any): o is TailLogEntriesResponse_SuppressionInfo { + return o && (o.$typeUrl === TailLogEntriesResponse_SuppressionInfo.typeUrl || isSet(o.reason) && typeof o.suppressedCount === "number"); + }, + isSDK(o: any): o is TailLogEntriesResponse_SuppressionInfoSDKType { + return o && (o.$typeUrl === TailLogEntriesResponse_SuppressionInfo.typeUrl || isSet(o.reason) && typeof o.suppressed_count === "number"); + }, + isAmino(o: any): o is TailLogEntriesResponse_SuppressionInfoAmino { + return o && (o.$typeUrl === TailLogEntriesResponse_SuppressionInfo.typeUrl || isSet(o.reason) && typeof o.suppressed_count === "number"); + }, encode(message: TailLogEntriesResponse_SuppressionInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.reason !== 0) { writer.uint32(8).int32(message.reason); @@ -3022,5 +3183,6 @@ export const TailLogEntriesResponse_SuppressionInfo = { typeUrl: "/google.logging.v2.SuppressionInfo", value: TailLogEntriesResponse_SuppressionInfo.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/google/logging/v2/logging_config.ts b/__fixtures__/v-next/outputv2/google/logging/v2/logging_config.ts index ffd8fa28a3..e4765e45e9 100644 --- a/__fixtures__/v-next/outputv2/google/logging/v2/logging_config.ts +++ b/__fixtures__/v-next/outputv2/google/logging/v2/logging_config.ts @@ -1,7 +1,8 @@ import { FieldMask, FieldMaskAmino, FieldMaskSDKType } from "../../protobuf/field_mask"; import { Timestamp } from "../../protobuf/timestamp"; +import { isSet, toTimestamp, fromTimestamp, DeepPartial } from "../../../helpers"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { toTimestamp, fromTimestamp, isSet, DeepPartial } from "../../../helpers"; +import { GlobalDecoderRegistry } from "../../../registry"; import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "google.logging.v2"; /** Deprecated. This is unused. */ @@ -3702,6 +3703,15 @@ function createBaseLogBucket(): LogBucket { */ export const LogBucket = { typeUrl: "/google.logging.v2.LogBucket", + is(o: any): o is LogBucket { + return o && (o.$typeUrl === LogBucket.typeUrl || typeof o.name === "string" && typeof o.description === "string" && typeof o.retentionDays === "number" && typeof o.locked === "boolean" && isSet(o.lifecycleState) && Array.isArray(o.restrictedFields) && (!o.restrictedFields.length || typeof o.restrictedFields[0] === "string")); + }, + isSDK(o: any): o is LogBucketSDKType { + return o && (o.$typeUrl === LogBucket.typeUrl || typeof o.name === "string" && typeof o.description === "string" && typeof o.retention_days === "number" && typeof o.locked === "boolean" && isSet(o.lifecycle_state) && Array.isArray(o.restricted_fields) && (!o.restricted_fields.length || typeof o.restricted_fields[0] === "string")); + }, + isAmino(o: any): o is LogBucketAmino { + return o && (o.$typeUrl === LogBucket.typeUrl || typeof o.name === "string" && typeof o.description === "string" && typeof o.retention_days === "number" && typeof o.locked === "boolean" && isSet(o.lifecycle_state) && Array.isArray(o.restricted_fields) && (!o.restricted_fields.length || typeof o.restricted_fields[0] === "string")); + }, encode(message: LogBucket, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -3908,6 +3918,12 @@ export const LogBucket = { typeUrl: "/google.logging.v2.LogBucket", value: LogBucket.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(LogBucket.typeUrl)) { + return; + } + CmekSettings.registerTypeUrl(); } }; function createBaseLogView(): LogView { @@ -3927,6 +3943,15 @@ function createBaseLogView(): LogView { */ export const LogView = { typeUrl: "/google.logging.v2.LogView", + is(o: any): o is LogView { + return o && (o.$typeUrl === LogView.typeUrl || typeof o.name === "string" && typeof o.description === "string" && typeof o.filter === "string"); + }, + isSDK(o: any): o is LogViewSDKType { + return o && (o.$typeUrl === LogView.typeUrl || typeof o.name === "string" && typeof o.description === "string" && typeof o.filter === "string"); + }, + isAmino(o: any): o is LogViewAmino { + return o && (o.$typeUrl === LogView.typeUrl || typeof o.name === "string" && typeof o.description === "string" && typeof o.filter === "string"); + }, encode(message: LogView, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -4061,7 +4086,8 @@ export const LogView = { typeUrl: "/google.logging.v2.LogView", value: LogView.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseLogSink(): LogSink { return { @@ -4091,6 +4117,15 @@ function createBaseLogSink(): LogSink { */ export const LogSink = { typeUrl: "/google.logging.v2.LogSink", + is(o: any): o is LogSink { + return o && (o.$typeUrl === LogSink.typeUrl || typeof o.name === "string" && typeof o.destination === "string" && typeof o.filter === "string" && typeof o.description === "string" && typeof o.disabled === "boolean" && Array.isArray(o.exclusions) && (!o.exclusions.length || LogExclusion.is(o.exclusions[0])) && isSet(o.outputVersionFormat) && typeof o.writerIdentity === "string" && typeof o.includeChildren === "boolean"); + }, + isSDK(o: any): o is LogSinkSDKType { + return o && (o.$typeUrl === LogSink.typeUrl || typeof o.name === "string" && typeof o.destination === "string" && typeof o.filter === "string" && typeof o.description === "string" && typeof o.disabled === "boolean" && Array.isArray(o.exclusions) && (!o.exclusions.length || LogExclusion.isSDK(o.exclusions[0])) && isSet(o.output_version_format) && typeof o.writer_identity === "string" && typeof o.include_children === "boolean"); + }, + isAmino(o: any): o is LogSinkAmino { + return o && (o.$typeUrl === LogSink.typeUrl || typeof o.name === "string" && typeof o.destination === "string" && typeof o.filter === "string" && typeof o.description === "string" && typeof o.disabled === "boolean" && Array.isArray(o.exclusions) && (!o.exclusions.length || LogExclusion.isAmino(o.exclusions[0])) && isSet(o.output_version_format) && typeof o.writer_identity === "string" && typeof o.include_children === "boolean"); + }, encode(message: LogSink, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -4342,6 +4377,13 @@ export const LogSink = { typeUrl: "/google.logging.v2.LogSink", value: LogSink.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(LogSink.typeUrl)) { + return; + } + LogExclusion.registerTypeUrl(); + BigQueryOptions.registerTypeUrl(); } }; function createBaseBigQueryOptions(): BigQueryOptions { @@ -4358,6 +4400,15 @@ function createBaseBigQueryOptions(): BigQueryOptions { */ export const BigQueryOptions = { typeUrl: "/google.logging.v2.BigQueryOptions", + is(o: any): o is BigQueryOptions { + return o && (o.$typeUrl === BigQueryOptions.typeUrl || typeof o.usePartitionedTables === "boolean" && typeof o.usesTimestampColumnPartitioning === "boolean"); + }, + isSDK(o: any): o is BigQueryOptionsSDKType { + return o && (o.$typeUrl === BigQueryOptions.typeUrl || typeof o.use_partitioned_tables === "boolean" && typeof o.uses_timestamp_column_partitioning === "boolean"); + }, + isAmino(o: any): o is BigQueryOptionsAmino { + return o && (o.$typeUrl === BigQueryOptions.typeUrl || typeof o.use_partitioned_tables === "boolean" && typeof o.uses_timestamp_column_partitioning === "boolean"); + }, encode(message: BigQueryOptions, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.usePartitionedTables === true) { writer.uint32(8).bool(message.usePartitionedTables); @@ -4447,7 +4498,8 @@ export const BigQueryOptions = { typeUrl: "/google.logging.v2.BigQueryOptions", value: BigQueryOptions.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseListBucketsRequest(): ListBucketsRequest { return { @@ -4464,6 +4516,15 @@ function createBaseListBucketsRequest(): ListBucketsRequest { */ export const ListBucketsRequest = { typeUrl: "/google.logging.v2.ListBucketsRequest", + is(o: any): o is ListBucketsRequest { + return o && (o.$typeUrl === ListBucketsRequest.typeUrl || typeof o.parent === "string" && typeof o.pageToken === "string" && typeof o.pageSize === "number"); + }, + isSDK(o: any): o is ListBucketsRequestSDKType { + return o && (o.$typeUrl === ListBucketsRequest.typeUrl || typeof o.parent === "string" && typeof o.page_token === "string" && typeof o.page_size === "number"); + }, + isAmino(o: any): o is ListBucketsRequestAmino { + return o && (o.$typeUrl === ListBucketsRequest.typeUrl || typeof o.parent === "string" && typeof o.page_token === "string" && typeof o.page_size === "number"); + }, encode(message: ListBucketsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.parent !== "") { writer.uint32(10).string(message.parent); @@ -4568,7 +4629,8 @@ export const ListBucketsRequest = { typeUrl: "/google.logging.v2.ListBucketsRequest", value: ListBucketsRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseListBucketsResponse(): ListBucketsResponse { return { @@ -4584,6 +4646,15 @@ function createBaseListBucketsResponse(): ListBucketsResponse { */ export const ListBucketsResponse = { typeUrl: "/google.logging.v2.ListBucketsResponse", + is(o: any): o is ListBucketsResponse { + return o && (o.$typeUrl === ListBucketsResponse.typeUrl || Array.isArray(o.buckets) && (!o.buckets.length || LogBucket.is(o.buckets[0])) && typeof o.nextPageToken === "string"); + }, + isSDK(o: any): o is ListBucketsResponseSDKType { + return o && (o.$typeUrl === ListBucketsResponse.typeUrl || Array.isArray(o.buckets) && (!o.buckets.length || LogBucket.isSDK(o.buckets[0])) && typeof o.next_page_token === "string"); + }, + isAmino(o: any): o is ListBucketsResponseAmino { + return o && (o.$typeUrl === ListBucketsResponse.typeUrl || Array.isArray(o.buckets) && (!o.buckets.length || LogBucket.isAmino(o.buckets[0])) && typeof o.next_page_token === "string"); + }, encode(message: ListBucketsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.buckets) { LogBucket.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -4683,6 +4754,12 @@ export const ListBucketsResponse = { typeUrl: "/google.logging.v2.ListBucketsResponse", value: ListBucketsResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ListBucketsResponse.typeUrl)) { + return; + } + LogBucket.registerTypeUrl(); } }; function createBaseCreateBucketRequest(): CreateBucketRequest { @@ -4700,6 +4777,15 @@ function createBaseCreateBucketRequest(): CreateBucketRequest { */ export const CreateBucketRequest = { typeUrl: "/google.logging.v2.CreateBucketRequest", + is(o: any): o is CreateBucketRequest { + return o && (o.$typeUrl === CreateBucketRequest.typeUrl || typeof o.parent === "string" && typeof o.bucketId === "string"); + }, + isSDK(o: any): o is CreateBucketRequestSDKType { + return o && (o.$typeUrl === CreateBucketRequest.typeUrl || typeof o.parent === "string" && typeof o.bucket_id === "string"); + }, + isAmino(o: any): o is CreateBucketRequestAmino { + return o && (o.$typeUrl === CreateBucketRequest.typeUrl || typeof o.parent === "string" && typeof o.bucket_id === "string"); + }, encode(message: CreateBucketRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.parent !== "") { writer.uint32(10).string(message.parent); @@ -4806,6 +4892,12 @@ export const CreateBucketRequest = { typeUrl: "/google.logging.v2.CreateBucketRequest", value: CreateBucketRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(CreateBucketRequest.typeUrl)) { + return; + } + LogBucket.registerTypeUrl(); } }; function createBaseUpdateBucketRequest(): UpdateBucketRequest { @@ -4823,6 +4915,15 @@ function createBaseUpdateBucketRequest(): UpdateBucketRequest { */ export const UpdateBucketRequest = { typeUrl: "/google.logging.v2.UpdateBucketRequest", + is(o: any): o is UpdateBucketRequest { + return o && (o.$typeUrl === UpdateBucketRequest.typeUrl || typeof o.name === "string"); + }, + isSDK(o: any): o is UpdateBucketRequestSDKType { + return o && (o.$typeUrl === UpdateBucketRequest.typeUrl || typeof o.name === "string"); + }, + isAmino(o: any): o is UpdateBucketRequestAmino { + return o && (o.$typeUrl === UpdateBucketRequest.typeUrl || typeof o.name === "string"); + }, encode(message: UpdateBucketRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -4931,6 +5032,13 @@ export const UpdateBucketRequest = { typeUrl: "/google.logging.v2.UpdateBucketRequest", value: UpdateBucketRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(UpdateBucketRequest.typeUrl)) { + return; + } + LogBucket.registerTypeUrl(); + FieldMask.registerTypeUrl(); } }; function createBaseGetBucketRequest(): GetBucketRequest { @@ -4946,6 +5054,15 @@ function createBaseGetBucketRequest(): GetBucketRequest { */ export const GetBucketRequest = { typeUrl: "/google.logging.v2.GetBucketRequest", + is(o: any): o is GetBucketRequest { + return o && (o.$typeUrl === GetBucketRequest.typeUrl || typeof o.name === "string"); + }, + isSDK(o: any): o is GetBucketRequestSDKType { + return o && (o.$typeUrl === GetBucketRequest.typeUrl || typeof o.name === "string"); + }, + isAmino(o: any): o is GetBucketRequestAmino { + return o && (o.$typeUrl === GetBucketRequest.typeUrl || typeof o.name === "string"); + }, encode(message: GetBucketRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -5020,7 +5137,8 @@ export const GetBucketRequest = { typeUrl: "/google.logging.v2.GetBucketRequest", value: GetBucketRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseDeleteBucketRequest(): DeleteBucketRequest { return { @@ -5035,6 +5153,15 @@ function createBaseDeleteBucketRequest(): DeleteBucketRequest { */ export const DeleteBucketRequest = { typeUrl: "/google.logging.v2.DeleteBucketRequest", + is(o: any): o is DeleteBucketRequest { + return o && (o.$typeUrl === DeleteBucketRequest.typeUrl || typeof o.name === "string"); + }, + isSDK(o: any): o is DeleteBucketRequestSDKType { + return o && (o.$typeUrl === DeleteBucketRequest.typeUrl || typeof o.name === "string"); + }, + isAmino(o: any): o is DeleteBucketRequestAmino { + return o && (o.$typeUrl === DeleteBucketRequest.typeUrl || typeof o.name === "string"); + }, encode(message: DeleteBucketRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -5109,7 +5236,8 @@ export const DeleteBucketRequest = { typeUrl: "/google.logging.v2.DeleteBucketRequest", value: DeleteBucketRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseUndeleteBucketRequest(): UndeleteBucketRequest { return { @@ -5124,6 +5252,15 @@ function createBaseUndeleteBucketRequest(): UndeleteBucketRequest { */ export const UndeleteBucketRequest = { typeUrl: "/google.logging.v2.UndeleteBucketRequest", + is(o: any): o is UndeleteBucketRequest { + return o && (o.$typeUrl === UndeleteBucketRequest.typeUrl || typeof o.name === "string"); + }, + isSDK(o: any): o is UndeleteBucketRequestSDKType { + return o && (o.$typeUrl === UndeleteBucketRequest.typeUrl || typeof o.name === "string"); + }, + isAmino(o: any): o is UndeleteBucketRequestAmino { + return o && (o.$typeUrl === UndeleteBucketRequest.typeUrl || typeof o.name === "string"); + }, encode(message: UndeleteBucketRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -5198,7 +5335,8 @@ export const UndeleteBucketRequest = { typeUrl: "/google.logging.v2.UndeleteBucketRequest", value: UndeleteBucketRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseListViewsRequest(): ListViewsRequest { return { @@ -5215,6 +5353,15 @@ function createBaseListViewsRequest(): ListViewsRequest { */ export const ListViewsRequest = { typeUrl: "/google.logging.v2.ListViewsRequest", + is(o: any): o is ListViewsRequest { + return o && (o.$typeUrl === ListViewsRequest.typeUrl || typeof o.parent === "string" && typeof o.pageToken === "string" && typeof o.pageSize === "number"); + }, + isSDK(o: any): o is ListViewsRequestSDKType { + return o && (o.$typeUrl === ListViewsRequest.typeUrl || typeof o.parent === "string" && typeof o.page_token === "string" && typeof o.page_size === "number"); + }, + isAmino(o: any): o is ListViewsRequestAmino { + return o && (o.$typeUrl === ListViewsRequest.typeUrl || typeof o.parent === "string" && typeof o.page_token === "string" && typeof o.page_size === "number"); + }, encode(message: ListViewsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.parent !== "") { writer.uint32(10).string(message.parent); @@ -5319,7 +5466,8 @@ export const ListViewsRequest = { typeUrl: "/google.logging.v2.ListViewsRequest", value: ListViewsRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseListViewsResponse(): ListViewsResponse { return { @@ -5335,6 +5483,15 @@ function createBaseListViewsResponse(): ListViewsResponse { */ export const ListViewsResponse = { typeUrl: "/google.logging.v2.ListViewsResponse", + is(o: any): o is ListViewsResponse { + return o && (o.$typeUrl === ListViewsResponse.typeUrl || Array.isArray(o.views) && (!o.views.length || LogView.is(o.views[0])) && typeof o.nextPageToken === "string"); + }, + isSDK(o: any): o is ListViewsResponseSDKType { + return o && (o.$typeUrl === ListViewsResponse.typeUrl || Array.isArray(o.views) && (!o.views.length || LogView.isSDK(o.views[0])) && typeof o.next_page_token === "string"); + }, + isAmino(o: any): o is ListViewsResponseAmino { + return o && (o.$typeUrl === ListViewsResponse.typeUrl || Array.isArray(o.views) && (!o.views.length || LogView.isAmino(o.views[0])) && typeof o.next_page_token === "string"); + }, encode(message: ListViewsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.views) { LogView.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -5434,6 +5591,12 @@ export const ListViewsResponse = { typeUrl: "/google.logging.v2.ListViewsResponse", value: ListViewsResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ListViewsResponse.typeUrl)) { + return; + } + LogView.registerTypeUrl(); } }; function createBaseCreateViewRequest(): CreateViewRequest { @@ -5451,6 +5614,15 @@ function createBaseCreateViewRequest(): CreateViewRequest { */ export const CreateViewRequest = { typeUrl: "/google.logging.v2.CreateViewRequest", + is(o: any): o is CreateViewRequest { + return o && (o.$typeUrl === CreateViewRequest.typeUrl || typeof o.parent === "string" && typeof o.viewId === "string"); + }, + isSDK(o: any): o is CreateViewRequestSDKType { + return o && (o.$typeUrl === CreateViewRequest.typeUrl || typeof o.parent === "string" && typeof o.view_id === "string"); + }, + isAmino(o: any): o is CreateViewRequestAmino { + return o && (o.$typeUrl === CreateViewRequest.typeUrl || typeof o.parent === "string" && typeof o.view_id === "string"); + }, encode(message: CreateViewRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.parent !== "") { writer.uint32(10).string(message.parent); @@ -5557,6 +5729,12 @@ export const CreateViewRequest = { typeUrl: "/google.logging.v2.CreateViewRequest", value: CreateViewRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(CreateViewRequest.typeUrl)) { + return; + } + LogView.registerTypeUrl(); } }; function createBaseUpdateViewRequest(): UpdateViewRequest { @@ -5574,6 +5752,15 @@ function createBaseUpdateViewRequest(): UpdateViewRequest { */ export const UpdateViewRequest = { typeUrl: "/google.logging.v2.UpdateViewRequest", + is(o: any): o is UpdateViewRequest { + return o && (o.$typeUrl === UpdateViewRequest.typeUrl || typeof o.name === "string"); + }, + isSDK(o: any): o is UpdateViewRequestSDKType { + return o && (o.$typeUrl === UpdateViewRequest.typeUrl || typeof o.name === "string"); + }, + isAmino(o: any): o is UpdateViewRequestAmino { + return o && (o.$typeUrl === UpdateViewRequest.typeUrl || typeof o.name === "string"); + }, encode(message: UpdateViewRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -5682,6 +5869,13 @@ export const UpdateViewRequest = { typeUrl: "/google.logging.v2.UpdateViewRequest", value: UpdateViewRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(UpdateViewRequest.typeUrl)) { + return; + } + LogView.registerTypeUrl(); + FieldMask.registerTypeUrl(); } }; function createBaseGetViewRequest(): GetViewRequest { @@ -5697,6 +5891,15 @@ function createBaseGetViewRequest(): GetViewRequest { */ export const GetViewRequest = { typeUrl: "/google.logging.v2.GetViewRequest", + is(o: any): o is GetViewRequest { + return o && (o.$typeUrl === GetViewRequest.typeUrl || typeof o.name === "string"); + }, + isSDK(o: any): o is GetViewRequestSDKType { + return o && (o.$typeUrl === GetViewRequest.typeUrl || typeof o.name === "string"); + }, + isAmino(o: any): o is GetViewRequestAmino { + return o && (o.$typeUrl === GetViewRequest.typeUrl || typeof o.name === "string"); + }, encode(message: GetViewRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -5771,7 +5974,8 @@ export const GetViewRequest = { typeUrl: "/google.logging.v2.GetViewRequest", value: GetViewRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseDeleteViewRequest(): DeleteViewRequest { return { @@ -5786,6 +5990,15 @@ function createBaseDeleteViewRequest(): DeleteViewRequest { */ export const DeleteViewRequest = { typeUrl: "/google.logging.v2.DeleteViewRequest", + is(o: any): o is DeleteViewRequest { + return o && (o.$typeUrl === DeleteViewRequest.typeUrl || typeof o.name === "string"); + }, + isSDK(o: any): o is DeleteViewRequestSDKType { + return o && (o.$typeUrl === DeleteViewRequest.typeUrl || typeof o.name === "string"); + }, + isAmino(o: any): o is DeleteViewRequestAmino { + return o && (o.$typeUrl === DeleteViewRequest.typeUrl || typeof o.name === "string"); + }, encode(message: DeleteViewRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -5860,7 +6073,8 @@ export const DeleteViewRequest = { typeUrl: "/google.logging.v2.DeleteViewRequest", value: DeleteViewRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseListSinksRequest(): ListSinksRequest { return { @@ -5877,6 +6091,15 @@ function createBaseListSinksRequest(): ListSinksRequest { */ export const ListSinksRequest = { typeUrl: "/google.logging.v2.ListSinksRequest", + is(o: any): o is ListSinksRequest { + return o && (o.$typeUrl === ListSinksRequest.typeUrl || typeof o.parent === "string" && typeof o.pageToken === "string" && typeof o.pageSize === "number"); + }, + isSDK(o: any): o is ListSinksRequestSDKType { + return o && (o.$typeUrl === ListSinksRequest.typeUrl || typeof o.parent === "string" && typeof o.page_token === "string" && typeof o.page_size === "number"); + }, + isAmino(o: any): o is ListSinksRequestAmino { + return o && (o.$typeUrl === ListSinksRequest.typeUrl || typeof o.parent === "string" && typeof o.page_token === "string" && typeof o.page_size === "number"); + }, encode(message: ListSinksRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.parent !== "") { writer.uint32(10).string(message.parent); @@ -5981,7 +6204,8 @@ export const ListSinksRequest = { typeUrl: "/google.logging.v2.ListSinksRequest", value: ListSinksRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseListSinksResponse(): ListSinksResponse { return { @@ -5997,6 +6221,15 @@ function createBaseListSinksResponse(): ListSinksResponse { */ export const ListSinksResponse = { typeUrl: "/google.logging.v2.ListSinksResponse", + is(o: any): o is ListSinksResponse { + return o && (o.$typeUrl === ListSinksResponse.typeUrl || Array.isArray(o.sinks) && (!o.sinks.length || LogSink.is(o.sinks[0])) && typeof o.nextPageToken === "string"); + }, + isSDK(o: any): o is ListSinksResponseSDKType { + return o && (o.$typeUrl === ListSinksResponse.typeUrl || Array.isArray(o.sinks) && (!o.sinks.length || LogSink.isSDK(o.sinks[0])) && typeof o.next_page_token === "string"); + }, + isAmino(o: any): o is ListSinksResponseAmino { + return o && (o.$typeUrl === ListSinksResponse.typeUrl || Array.isArray(o.sinks) && (!o.sinks.length || LogSink.isAmino(o.sinks[0])) && typeof o.next_page_token === "string"); + }, encode(message: ListSinksResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.sinks) { LogSink.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -6096,6 +6329,12 @@ export const ListSinksResponse = { typeUrl: "/google.logging.v2.ListSinksResponse", value: ListSinksResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ListSinksResponse.typeUrl)) { + return; + } + LogSink.registerTypeUrl(); } }; function createBaseGetSinkRequest(): GetSinkRequest { @@ -6111,6 +6350,15 @@ function createBaseGetSinkRequest(): GetSinkRequest { */ export const GetSinkRequest = { typeUrl: "/google.logging.v2.GetSinkRequest", + is(o: any): o is GetSinkRequest { + return o && (o.$typeUrl === GetSinkRequest.typeUrl || typeof o.sinkName === "string"); + }, + isSDK(o: any): o is GetSinkRequestSDKType { + return o && (o.$typeUrl === GetSinkRequest.typeUrl || typeof o.sink_name === "string"); + }, + isAmino(o: any): o is GetSinkRequestAmino { + return o && (o.$typeUrl === GetSinkRequest.typeUrl || typeof o.sink_name === "string"); + }, encode(message: GetSinkRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.sinkName !== "") { writer.uint32(10).string(message.sinkName); @@ -6185,7 +6433,8 @@ export const GetSinkRequest = { typeUrl: "/google.logging.v2.GetSinkRequest", value: GetSinkRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseCreateSinkRequest(): CreateSinkRequest { return { @@ -6202,6 +6451,15 @@ function createBaseCreateSinkRequest(): CreateSinkRequest { */ export const CreateSinkRequest = { typeUrl: "/google.logging.v2.CreateSinkRequest", + is(o: any): o is CreateSinkRequest { + return o && (o.$typeUrl === CreateSinkRequest.typeUrl || typeof o.parent === "string" && typeof o.uniqueWriterIdentity === "boolean"); + }, + isSDK(o: any): o is CreateSinkRequestSDKType { + return o && (o.$typeUrl === CreateSinkRequest.typeUrl || typeof o.parent === "string" && typeof o.unique_writer_identity === "boolean"); + }, + isAmino(o: any): o is CreateSinkRequestAmino { + return o && (o.$typeUrl === CreateSinkRequest.typeUrl || typeof o.parent === "string" && typeof o.unique_writer_identity === "boolean"); + }, encode(message: CreateSinkRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.parent !== "") { writer.uint32(10).string(message.parent); @@ -6308,6 +6566,12 @@ export const CreateSinkRequest = { typeUrl: "/google.logging.v2.CreateSinkRequest", value: CreateSinkRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(CreateSinkRequest.typeUrl)) { + return; + } + LogSink.registerTypeUrl(); } }; function createBaseUpdateSinkRequest(): UpdateSinkRequest { @@ -6326,6 +6590,15 @@ function createBaseUpdateSinkRequest(): UpdateSinkRequest { */ export const UpdateSinkRequest = { typeUrl: "/google.logging.v2.UpdateSinkRequest", + is(o: any): o is UpdateSinkRequest { + return o && (o.$typeUrl === UpdateSinkRequest.typeUrl || typeof o.sinkName === "string" && typeof o.uniqueWriterIdentity === "boolean"); + }, + isSDK(o: any): o is UpdateSinkRequestSDKType { + return o && (o.$typeUrl === UpdateSinkRequest.typeUrl || typeof o.sink_name === "string" && typeof o.unique_writer_identity === "boolean"); + }, + isAmino(o: any): o is UpdateSinkRequestAmino { + return o && (o.$typeUrl === UpdateSinkRequest.typeUrl || typeof o.sink_name === "string" && typeof o.unique_writer_identity === "boolean"); + }, encode(message: UpdateSinkRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.sinkName !== "") { writer.uint32(10).string(message.sinkName); @@ -6449,6 +6722,13 @@ export const UpdateSinkRequest = { typeUrl: "/google.logging.v2.UpdateSinkRequest", value: UpdateSinkRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(UpdateSinkRequest.typeUrl)) { + return; + } + LogSink.registerTypeUrl(); + FieldMask.registerTypeUrl(); } }; function createBaseDeleteSinkRequest(): DeleteSinkRequest { @@ -6464,6 +6744,15 @@ function createBaseDeleteSinkRequest(): DeleteSinkRequest { */ export const DeleteSinkRequest = { typeUrl: "/google.logging.v2.DeleteSinkRequest", + is(o: any): o is DeleteSinkRequest { + return o && (o.$typeUrl === DeleteSinkRequest.typeUrl || typeof o.sinkName === "string"); + }, + isSDK(o: any): o is DeleteSinkRequestSDKType { + return o && (o.$typeUrl === DeleteSinkRequest.typeUrl || typeof o.sink_name === "string"); + }, + isAmino(o: any): o is DeleteSinkRequestAmino { + return o && (o.$typeUrl === DeleteSinkRequest.typeUrl || typeof o.sink_name === "string"); + }, encode(message: DeleteSinkRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.sinkName !== "") { writer.uint32(10).string(message.sinkName); @@ -6538,7 +6827,8 @@ export const DeleteSinkRequest = { typeUrl: "/google.logging.v2.DeleteSinkRequest", value: DeleteSinkRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseLogExclusion(): LogExclusion { return { @@ -6562,6 +6852,15 @@ function createBaseLogExclusion(): LogExclusion { */ export const LogExclusion = { typeUrl: "/google.logging.v2.LogExclusion", + is(o: any): o is LogExclusion { + return o && (o.$typeUrl === LogExclusion.typeUrl || typeof o.name === "string" && typeof o.description === "string" && typeof o.filter === "string" && typeof o.disabled === "boolean"); + }, + isSDK(o: any): o is LogExclusionSDKType { + return o && (o.$typeUrl === LogExclusion.typeUrl || typeof o.name === "string" && typeof o.description === "string" && typeof o.filter === "string" && typeof o.disabled === "boolean"); + }, + isAmino(o: any): o is LogExclusionAmino { + return o && (o.$typeUrl === LogExclusion.typeUrl || typeof o.name === "string" && typeof o.description === "string" && typeof o.filter === "string" && typeof o.disabled === "boolean"); + }, encode(message: LogExclusion, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -6711,7 +7010,8 @@ export const LogExclusion = { typeUrl: "/google.logging.v2.LogExclusion", value: LogExclusion.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseListExclusionsRequest(): ListExclusionsRequest { return { @@ -6728,6 +7028,15 @@ function createBaseListExclusionsRequest(): ListExclusionsRequest { */ export const ListExclusionsRequest = { typeUrl: "/google.logging.v2.ListExclusionsRequest", + is(o: any): o is ListExclusionsRequest { + return o && (o.$typeUrl === ListExclusionsRequest.typeUrl || typeof o.parent === "string" && typeof o.pageToken === "string" && typeof o.pageSize === "number"); + }, + isSDK(o: any): o is ListExclusionsRequestSDKType { + return o && (o.$typeUrl === ListExclusionsRequest.typeUrl || typeof o.parent === "string" && typeof o.page_token === "string" && typeof o.page_size === "number"); + }, + isAmino(o: any): o is ListExclusionsRequestAmino { + return o && (o.$typeUrl === ListExclusionsRequest.typeUrl || typeof o.parent === "string" && typeof o.page_token === "string" && typeof o.page_size === "number"); + }, encode(message: ListExclusionsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.parent !== "") { writer.uint32(10).string(message.parent); @@ -6832,7 +7141,8 @@ export const ListExclusionsRequest = { typeUrl: "/google.logging.v2.ListExclusionsRequest", value: ListExclusionsRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseListExclusionsResponse(): ListExclusionsResponse { return { @@ -6848,6 +7158,15 @@ function createBaseListExclusionsResponse(): ListExclusionsResponse { */ export const ListExclusionsResponse = { typeUrl: "/google.logging.v2.ListExclusionsResponse", + is(o: any): o is ListExclusionsResponse { + return o && (o.$typeUrl === ListExclusionsResponse.typeUrl || Array.isArray(o.exclusions) && (!o.exclusions.length || LogExclusion.is(o.exclusions[0])) && typeof o.nextPageToken === "string"); + }, + isSDK(o: any): o is ListExclusionsResponseSDKType { + return o && (o.$typeUrl === ListExclusionsResponse.typeUrl || Array.isArray(o.exclusions) && (!o.exclusions.length || LogExclusion.isSDK(o.exclusions[0])) && typeof o.next_page_token === "string"); + }, + isAmino(o: any): o is ListExclusionsResponseAmino { + return o && (o.$typeUrl === ListExclusionsResponse.typeUrl || Array.isArray(o.exclusions) && (!o.exclusions.length || LogExclusion.isAmino(o.exclusions[0])) && typeof o.next_page_token === "string"); + }, encode(message: ListExclusionsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.exclusions) { LogExclusion.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -6947,6 +7266,12 @@ export const ListExclusionsResponse = { typeUrl: "/google.logging.v2.ListExclusionsResponse", value: ListExclusionsResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ListExclusionsResponse.typeUrl)) { + return; + } + LogExclusion.registerTypeUrl(); } }; function createBaseGetExclusionRequest(): GetExclusionRequest { @@ -6962,6 +7287,15 @@ function createBaseGetExclusionRequest(): GetExclusionRequest { */ export const GetExclusionRequest = { typeUrl: "/google.logging.v2.GetExclusionRequest", + is(o: any): o is GetExclusionRequest { + return o && (o.$typeUrl === GetExclusionRequest.typeUrl || typeof o.name === "string"); + }, + isSDK(o: any): o is GetExclusionRequestSDKType { + return o && (o.$typeUrl === GetExclusionRequest.typeUrl || typeof o.name === "string"); + }, + isAmino(o: any): o is GetExclusionRequestAmino { + return o && (o.$typeUrl === GetExclusionRequest.typeUrl || typeof o.name === "string"); + }, encode(message: GetExclusionRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -7036,7 +7370,8 @@ export const GetExclusionRequest = { typeUrl: "/google.logging.v2.GetExclusionRequest", value: GetExclusionRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseCreateExclusionRequest(): CreateExclusionRequest { return { @@ -7052,6 +7387,15 @@ function createBaseCreateExclusionRequest(): CreateExclusionRequest { */ export const CreateExclusionRequest = { typeUrl: "/google.logging.v2.CreateExclusionRequest", + is(o: any): o is CreateExclusionRequest { + return o && (o.$typeUrl === CreateExclusionRequest.typeUrl || typeof o.parent === "string"); + }, + isSDK(o: any): o is CreateExclusionRequestSDKType { + return o && (o.$typeUrl === CreateExclusionRequest.typeUrl || typeof o.parent === "string"); + }, + isAmino(o: any): o is CreateExclusionRequestAmino { + return o && (o.$typeUrl === CreateExclusionRequest.typeUrl || typeof o.parent === "string"); + }, encode(message: CreateExclusionRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.parent !== "") { writer.uint32(10).string(message.parent); @@ -7143,6 +7487,12 @@ export const CreateExclusionRequest = { typeUrl: "/google.logging.v2.CreateExclusionRequest", value: CreateExclusionRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(CreateExclusionRequest.typeUrl)) { + return; + } + LogExclusion.registerTypeUrl(); } }; function createBaseUpdateExclusionRequest(): UpdateExclusionRequest { @@ -7160,6 +7510,15 @@ function createBaseUpdateExclusionRequest(): UpdateExclusionRequest { */ export const UpdateExclusionRequest = { typeUrl: "/google.logging.v2.UpdateExclusionRequest", + is(o: any): o is UpdateExclusionRequest { + return o && (o.$typeUrl === UpdateExclusionRequest.typeUrl || typeof o.name === "string"); + }, + isSDK(o: any): o is UpdateExclusionRequestSDKType { + return o && (o.$typeUrl === UpdateExclusionRequest.typeUrl || typeof o.name === "string"); + }, + isAmino(o: any): o is UpdateExclusionRequestAmino { + return o && (o.$typeUrl === UpdateExclusionRequest.typeUrl || typeof o.name === "string"); + }, encode(message: UpdateExclusionRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -7268,6 +7627,13 @@ export const UpdateExclusionRequest = { typeUrl: "/google.logging.v2.UpdateExclusionRequest", value: UpdateExclusionRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(UpdateExclusionRequest.typeUrl)) { + return; + } + LogExclusion.registerTypeUrl(); + FieldMask.registerTypeUrl(); } }; function createBaseDeleteExclusionRequest(): DeleteExclusionRequest { @@ -7283,6 +7649,15 @@ function createBaseDeleteExclusionRequest(): DeleteExclusionRequest { */ export const DeleteExclusionRequest = { typeUrl: "/google.logging.v2.DeleteExclusionRequest", + is(o: any): o is DeleteExclusionRequest { + return o && (o.$typeUrl === DeleteExclusionRequest.typeUrl || typeof o.name === "string"); + }, + isSDK(o: any): o is DeleteExclusionRequestSDKType { + return o && (o.$typeUrl === DeleteExclusionRequest.typeUrl || typeof o.name === "string"); + }, + isAmino(o: any): o is DeleteExclusionRequestAmino { + return o && (o.$typeUrl === DeleteExclusionRequest.typeUrl || typeof o.name === "string"); + }, encode(message: DeleteExclusionRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -7357,7 +7732,8 @@ export const DeleteExclusionRequest = { typeUrl: "/google.logging.v2.DeleteExclusionRequest", value: DeleteExclusionRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseGetCmekSettingsRequest(): GetCmekSettingsRequest { return { @@ -7377,6 +7753,15 @@ function createBaseGetCmekSettingsRequest(): GetCmekSettingsRequest { */ export const GetCmekSettingsRequest = { typeUrl: "/google.logging.v2.GetCmekSettingsRequest", + is(o: any): o is GetCmekSettingsRequest { + return o && (o.$typeUrl === GetCmekSettingsRequest.typeUrl || typeof o.name === "string"); + }, + isSDK(o: any): o is GetCmekSettingsRequestSDKType { + return o && (o.$typeUrl === GetCmekSettingsRequest.typeUrl || typeof o.name === "string"); + }, + isAmino(o: any): o is GetCmekSettingsRequestAmino { + return o && (o.$typeUrl === GetCmekSettingsRequest.typeUrl || typeof o.name === "string"); + }, encode(message: GetCmekSettingsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -7451,7 +7836,8 @@ export const GetCmekSettingsRequest = { typeUrl: "/google.logging.v2.GetCmekSettingsRequest", value: GetCmekSettingsRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseUpdateCmekSettingsRequest(): UpdateCmekSettingsRequest { return { @@ -7473,6 +7859,15 @@ function createBaseUpdateCmekSettingsRequest(): UpdateCmekSettingsRequest { */ export const UpdateCmekSettingsRequest = { typeUrl: "/google.logging.v2.UpdateCmekSettingsRequest", + is(o: any): o is UpdateCmekSettingsRequest { + return o && (o.$typeUrl === UpdateCmekSettingsRequest.typeUrl || typeof o.name === "string"); + }, + isSDK(o: any): o is UpdateCmekSettingsRequestSDKType { + return o && (o.$typeUrl === UpdateCmekSettingsRequest.typeUrl || typeof o.name === "string"); + }, + isAmino(o: any): o is UpdateCmekSettingsRequestAmino { + return o && (o.$typeUrl === UpdateCmekSettingsRequest.typeUrl || typeof o.name === "string"); + }, encode(message: UpdateCmekSettingsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -7581,6 +7976,13 @@ export const UpdateCmekSettingsRequest = { typeUrl: "/google.logging.v2.UpdateCmekSettingsRequest", value: UpdateCmekSettingsRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(UpdateCmekSettingsRequest.typeUrl)) { + return; + } + CmekSettings.registerTypeUrl(); + FieldMask.registerTypeUrl(); } }; function createBaseCmekSettings(): CmekSettings { @@ -7607,6 +8009,15 @@ function createBaseCmekSettings(): CmekSettings { */ export const CmekSettings = { typeUrl: "/google.logging.v2.CmekSettings", + is(o: any): o is CmekSettings { + return o && (o.$typeUrl === CmekSettings.typeUrl || typeof o.name === "string" && typeof o.kmsKeyName === "string" && typeof o.serviceAccountId === "string"); + }, + isSDK(o: any): o is CmekSettingsSDKType { + return o && (o.$typeUrl === CmekSettings.typeUrl || typeof o.name === "string" && typeof o.kms_key_name === "string" && typeof o.service_account_id === "string"); + }, + isAmino(o: any): o is CmekSettingsAmino { + return o && (o.$typeUrl === CmekSettings.typeUrl || typeof o.name === "string" && typeof o.kms_key_name === "string" && typeof o.service_account_id === "string"); + }, encode(message: CmekSettings, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -7711,7 +8122,8 @@ export const CmekSettings = { typeUrl: "/google.logging.v2.CmekSettings", value: CmekSettings.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseGetSettingsRequest(): GetSettingsRequest { return { @@ -7731,6 +8143,15 @@ function createBaseGetSettingsRequest(): GetSettingsRequest { */ export const GetSettingsRequest = { typeUrl: "/google.logging.v2.GetSettingsRequest", + is(o: any): o is GetSettingsRequest { + return o && (o.$typeUrl === GetSettingsRequest.typeUrl || typeof o.name === "string"); + }, + isSDK(o: any): o is GetSettingsRequestSDKType { + return o && (o.$typeUrl === GetSettingsRequest.typeUrl || typeof o.name === "string"); + }, + isAmino(o: any): o is GetSettingsRequestAmino { + return o && (o.$typeUrl === GetSettingsRequest.typeUrl || typeof o.name === "string"); + }, encode(message: GetSettingsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -7805,7 +8226,8 @@ export const GetSettingsRequest = { typeUrl: "/google.logging.v2.GetSettingsRequest", value: GetSettingsRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseUpdateSettingsRequest(): UpdateSettingsRequest { return { @@ -7827,6 +8249,15 @@ function createBaseUpdateSettingsRequest(): UpdateSettingsRequest { */ export const UpdateSettingsRequest = { typeUrl: "/google.logging.v2.UpdateSettingsRequest", + is(o: any): o is UpdateSettingsRequest { + return o && (o.$typeUrl === UpdateSettingsRequest.typeUrl || typeof o.name === "string"); + }, + isSDK(o: any): o is UpdateSettingsRequestSDKType { + return o && (o.$typeUrl === UpdateSettingsRequest.typeUrl || typeof o.name === "string"); + }, + isAmino(o: any): o is UpdateSettingsRequestAmino { + return o && (o.$typeUrl === UpdateSettingsRequest.typeUrl || typeof o.name === "string"); + }, encode(message: UpdateSettingsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -7935,6 +8366,13 @@ export const UpdateSettingsRequest = { typeUrl: "/google.logging.v2.UpdateSettingsRequest", value: UpdateSettingsRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(UpdateSettingsRequest.typeUrl)) { + return; + } + Settings.registerTypeUrl(); + FieldMask.registerTypeUrl(); } }; function createBaseSettings(): Settings { @@ -7955,6 +8393,15 @@ function createBaseSettings(): Settings { */ export const Settings = { typeUrl: "/google.logging.v2.Settings", + is(o: any): o is Settings { + return o && (o.$typeUrl === Settings.typeUrl || typeof o.name === "string" && typeof o.kmsKeyName === "string" && typeof o.kmsServiceAccountId === "string" && typeof o.storageLocation === "string" && typeof o.disableDefaultSink === "boolean"); + }, + isSDK(o: any): o is SettingsSDKType { + return o && (o.$typeUrl === Settings.typeUrl || typeof o.name === "string" && typeof o.kms_key_name === "string" && typeof o.kms_service_account_id === "string" && typeof o.storage_location === "string" && typeof o.disable_default_sink === "boolean"); + }, + isAmino(o: any): o is SettingsAmino { + return o && (o.$typeUrl === Settings.typeUrl || typeof o.name === "string" && typeof o.kms_key_name === "string" && typeof o.kms_service_account_id === "string" && typeof o.storage_location === "string" && typeof o.disable_default_sink === "boolean"); + }, encode(message: Settings, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -8089,7 +8536,8 @@ export const Settings = { typeUrl: "/google.logging.v2.Settings", value: Settings.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseCopyLogEntriesRequest(): CopyLogEntriesRequest { return { @@ -8106,6 +8554,15 @@ function createBaseCopyLogEntriesRequest(): CopyLogEntriesRequest { */ export const CopyLogEntriesRequest = { typeUrl: "/google.logging.v2.CopyLogEntriesRequest", + is(o: any): o is CopyLogEntriesRequest { + return o && (o.$typeUrl === CopyLogEntriesRequest.typeUrl || typeof o.name === "string" && typeof o.filter === "string" && typeof o.destination === "string"); + }, + isSDK(o: any): o is CopyLogEntriesRequestSDKType { + return o && (o.$typeUrl === CopyLogEntriesRequest.typeUrl || typeof o.name === "string" && typeof o.filter === "string" && typeof o.destination === "string"); + }, + isAmino(o: any): o is CopyLogEntriesRequestAmino { + return o && (o.$typeUrl === CopyLogEntriesRequest.typeUrl || typeof o.name === "string" && typeof o.filter === "string" && typeof o.destination === "string"); + }, encode(message: CopyLogEntriesRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -8210,7 +8667,8 @@ export const CopyLogEntriesRequest = { typeUrl: "/google.logging.v2.CopyLogEntriesRequest", value: CopyLogEntriesRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseCopyLogEntriesMetadata(): CopyLogEntriesMetadata { return { @@ -8231,6 +8689,15 @@ function createBaseCopyLogEntriesMetadata(): CopyLogEntriesMetadata { */ export const CopyLogEntriesMetadata = { typeUrl: "/google.logging.v2.CopyLogEntriesMetadata", + is(o: any): o is CopyLogEntriesMetadata { + return o && (o.$typeUrl === CopyLogEntriesMetadata.typeUrl || isSet(o.state) && typeof o.cancellationRequested === "boolean" && typeof o.progress === "number" && typeof o.writerIdentity === "string"); + }, + isSDK(o: any): o is CopyLogEntriesMetadataSDKType { + return o && (o.$typeUrl === CopyLogEntriesMetadata.typeUrl || isSet(o.state) && typeof o.cancellation_requested === "boolean" && typeof o.progress === "number" && typeof o.writer_identity === "string"); + }, + isAmino(o: any): o is CopyLogEntriesMetadataAmino { + return o && (o.$typeUrl === CopyLogEntriesMetadata.typeUrl || isSet(o.state) && typeof o.cancellation_requested === "boolean" && typeof o.progress === "number" && typeof o.writer_identity === "string"); + }, encode(message: CopyLogEntriesMetadata, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.startTime !== undefined) { Timestamp.encode(toTimestamp(message.startTime), writer.uint32(10).fork()).ldelim(); @@ -8397,6 +8864,12 @@ export const CopyLogEntriesMetadata = { typeUrl: "/google.logging.v2.CopyLogEntriesMetadata", value: CopyLogEntriesMetadata.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(CopyLogEntriesMetadata.typeUrl)) { + return; + } + CopyLogEntriesRequest.registerTypeUrl(); } }; function createBaseCopyLogEntriesResponse(): CopyLogEntriesResponse { @@ -8412,6 +8885,15 @@ function createBaseCopyLogEntriesResponse(): CopyLogEntriesResponse { */ export const CopyLogEntriesResponse = { typeUrl: "/google.logging.v2.CopyLogEntriesResponse", + is(o: any): o is CopyLogEntriesResponse { + return o && (o.$typeUrl === CopyLogEntriesResponse.typeUrl || typeof o.logEntriesCopiedCount === "bigint"); + }, + isSDK(o: any): o is CopyLogEntriesResponseSDKType { + return o && (o.$typeUrl === CopyLogEntriesResponse.typeUrl || typeof o.log_entries_copied_count === "bigint"); + }, + isAmino(o: any): o is CopyLogEntriesResponseAmino { + return o && (o.$typeUrl === CopyLogEntriesResponse.typeUrl || typeof o.log_entries_copied_count === "bigint"); + }, encode(message: CopyLogEntriesResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.logEntriesCopiedCount !== BigInt(0)) { writer.uint32(8).int64(message.logEntriesCopiedCount); @@ -8488,5 +8970,6 @@ export const CopyLogEntriesResponse = { typeUrl: "/google.logging.v2.CopyLogEntriesResponse", value: CopyLogEntriesResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/google/logging/v2/logging_metrics.ts b/__fixtures__/v-next/outputv2/google/logging/v2/logging_metrics.ts index 66eff1af44..0cf9bafebf 100644 --- a/__fixtures__/v-next/outputv2/google/logging/v2/logging_metrics.ts +++ b/__fixtures__/v-next/outputv2/google/logging/v2/logging_metrics.ts @@ -4,6 +4,7 @@ import { Timestamp } from "../../protobuf/timestamp"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { isSet, DeepPartial, toTimestamp, fromTimestamp, isObject } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "google.logging.v2"; /** Logging API version. */ export enum LogMetric_ApiVersion { @@ -825,7 +826,8 @@ export const LogMetric_LabelExtractorsEntry = { }, toProto(message: LogMetric_LabelExtractorsEntry): Uint8Array { return LogMetric_LabelExtractorsEntry.encode(message).finish(); - } + }, + registerTypeUrl() {} }; function createBaseLogMetric(): LogMetric { return { @@ -856,6 +858,15 @@ function createBaseLogMetric(): LogMetric { */ export const LogMetric = { typeUrl: "/google.logging.v2.LogMetric", + is(o: any): o is LogMetric { + return o && (o.$typeUrl === LogMetric.typeUrl || typeof o.name === "string" && typeof o.description === "string" && typeof o.filter === "string" && typeof o.disabled === "boolean" && typeof o.valueExtractor === "string" && isSet(o.labelExtractors) && isSet(o.version)); + }, + isSDK(o: any): o is LogMetricSDKType { + return o && (o.$typeUrl === LogMetric.typeUrl || typeof o.name === "string" && typeof o.description === "string" && typeof o.filter === "string" && typeof o.disabled === "boolean" && typeof o.value_extractor === "string" && isSet(o.label_extractors) && isSet(o.version)); + }, + isAmino(o: any): o is LogMetricAmino { + return o && (o.$typeUrl === LogMetric.typeUrl || typeof o.name === "string" && typeof o.description === "string" && typeof o.filter === "string" && typeof o.disabled === "boolean" && typeof o.value_extractor === "string" && isSet(o.label_extractors) && isSet(o.version)); + }, encode(message: LogMetric, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -1127,6 +1138,13 @@ export const LogMetric = { typeUrl: "/google.logging.v2.LogMetric", value: LogMetric.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(LogMetric.typeUrl)) { + return; + } + MetricDescriptor.registerTypeUrl(); + Distribution_BucketOptions.registerTypeUrl(); } }; function createBaseListLogMetricsRequest(): ListLogMetricsRequest { @@ -1144,6 +1162,15 @@ function createBaseListLogMetricsRequest(): ListLogMetricsRequest { */ export const ListLogMetricsRequest = { typeUrl: "/google.logging.v2.ListLogMetricsRequest", + is(o: any): o is ListLogMetricsRequest { + return o && (o.$typeUrl === ListLogMetricsRequest.typeUrl || typeof o.parent === "string" && typeof o.pageToken === "string" && typeof o.pageSize === "number"); + }, + isSDK(o: any): o is ListLogMetricsRequestSDKType { + return o && (o.$typeUrl === ListLogMetricsRequest.typeUrl || typeof o.parent === "string" && typeof o.page_token === "string" && typeof o.page_size === "number"); + }, + isAmino(o: any): o is ListLogMetricsRequestAmino { + return o && (o.$typeUrl === ListLogMetricsRequest.typeUrl || typeof o.parent === "string" && typeof o.page_token === "string" && typeof o.page_size === "number"); + }, encode(message: ListLogMetricsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.parent !== "") { writer.uint32(10).string(message.parent); @@ -1248,7 +1275,8 @@ export const ListLogMetricsRequest = { typeUrl: "/google.logging.v2.ListLogMetricsRequest", value: ListLogMetricsRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseListLogMetricsResponse(): ListLogMetricsResponse { return { @@ -1264,6 +1292,15 @@ function createBaseListLogMetricsResponse(): ListLogMetricsResponse { */ export const ListLogMetricsResponse = { typeUrl: "/google.logging.v2.ListLogMetricsResponse", + is(o: any): o is ListLogMetricsResponse { + return o && (o.$typeUrl === ListLogMetricsResponse.typeUrl || Array.isArray(o.metrics) && (!o.metrics.length || LogMetric.is(o.metrics[0])) && typeof o.nextPageToken === "string"); + }, + isSDK(o: any): o is ListLogMetricsResponseSDKType { + return o && (o.$typeUrl === ListLogMetricsResponse.typeUrl || Array.isArray(o.metrics) && (!o.metrics.length || LogMetric.isSDK(o.metrics[0])) && typeof o.next_page_token === "string"); + }, + isAmino(o: any): o is ListLogMetricsResponseAmino { + return o && (o.$typeUrl === ListLogMetricsResponse.typeUrl || Array.isArray(o.metrics) && (!o.metrics.length || LogMetric.isAmino(o.metrics[0])) && typeof o.next_page_token === "string"); + }, encode(message: ListLogMetricsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.metrics) { LogMetric.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -1363,6 +1400,12 @@ export const ListLogMetricsResponse = { typeUrl: "/google.logging.v2.ListLogMetricsResponse", value: ListLogMetricsResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ListLogMetricsResponse.typeUrl)) { + return; + } + LogMetric.registerTypeUrl(); } }; function createBaseGetLogMetricRequest(): GetLogMetricRequest { @@ -1378,6 +1421,15 @@ function createBaseGetLogMetricRequest(): GetLogMetricRequest { */ export const GetLogMetricRequest = { typeUrl: "/google.logging.v2.GetLogMetricRequest", + is(o: any): o is GetLogMetricRequest { + return o && (o.$typeUrl === GetLogMetricRequest.typeUrl || typeof o.metricName === "string"); + }, + isSDK(o: any): o is GetLogMetricRequestSDKType { + return o && (o.$typeUrl === GetLogMetricRequest.typeUrl || typeof o.metric_name === "string"); + }, + isAmino(o: any): o is GetLogMetricRequestAmino { + return o && (o.$typeUrl === GetLogMetricRequest.typeUrl || typeof o.metric_name === "string"); + }, encode(message: GetLogMetricRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.metricName !== "") { writer.uint32(10).string(message.metricName); @@ -1452,7 +1504,8 @@ export const GetLogMetricRequest = { typeUrl: "/google.logging.v2.GetLogMetricRequest", value: GetLogMetricRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseCreateLogMetricRequest(): CreateLogMetricRequest { return { @@ -1468,6 +1521,15 @@ function createBaseCreateLogMetricRequest(): CreateLogMetricRequest { */ export const CreateLogMetricRequest = { typeUrl: "/google.logging.v2.CreateLogMetricRequest", + is(o: any): o is CreateLogMetricRequest { + return o && (o.$typeUrl === CreateLogMetricRequest.typeUrl || typeof o.parent === "string"); + }, + isSDK(o: any): o is CreateLogMetricRequestSDKType { + return o && (o.$typeUrl === CreateLogMetricRequest.typeUrl || typeof o.parent === "string"); + }, + isAmino(o: any): o is CreateLogMetricRequestAmino { + return o && (o.$typeUrl === CreateLogMetricRequest.typeUrl || typeof o.parent === "string"); + }, encode(message: CreateLogMetricRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.parent !== "") { writer.uint32(10).string(message.parent); @@ -1559,6 +1621,12 @@ export const CreateLogMetricRequest = { typeUrl: "/google.logging.v2.CreateLogMetricRequest", value: CreateLogMetricRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(CreateLogMetricRequest.typeUrl)) { + return; + } + LogMetric.registerTypeUrl(); } }; function createBaseUpdateLogMetricRequest(): UpdateLogMetricRequest { @@ -1575,6 +1643,15 @@ function createBaseUpdateLogMetricRequest(): UpdateLogMetricRequest { */ export const UpdateLogMetricRequest = { typeUrl: "/google.logging.v2.UpdateLogMetricRequest", + is(o: any): o is UpdateLogMetricRequest { + return o && (o.$typeUrl === UpdateLogMetricRequest.typeUrl || typeof o.metricName === "string"); + }, + isSDK(o: any): o is UpdateLogMetricRequestSDKType { + return o && (o.$typeUrl === UpdateLogMetricRequest.typeUrl || typeof o.metric_name === "string"); + }, + isAmino(o: any): o is UpdateLogMetricRequestAmino { + return o && (o.$typeUrl === UpdateLogMetricRequest.typeUrl || typeof o.metric_name === "string"); + }, encode(message: UpdateLogMetricRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.metricName !== "") { writer.uint32(10).string(message.metricName); @@ -1666,6 +1743,12 @@ export const UpdateLogMetricRequest = { typeUrl: "/google.logging.v2.UpdateLogMetricRequest", value: UpdateLogMetricRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(UpdateLogMetricRequest.typeUrl)) { + return; + } + LogMetric.registerTypeUrl(); } }; function createBaseDeleteLogMetricRequest(): DeleteLogMetricRequest { @@ -1681,6 +1764,15 @@ function createBaseDeleteLogMetricRequest(): DeleteLogMetricRequest { */ export const DeleteLogMetricRequest = { typeUrl: "/google.logging.v2.DeleteLogMetricRequest", + is(o: any): o is DeleteLogMetricRequest { + return o && (o.$typeUrl === DeleteLogMetricRequest.typeUrl || typeof o.metricName === "string"); + }, + isSDK(o: any): o is DeleteLogMetricRequestSDKType { + return o && (o.$typeUrl === DeleteLogMetricRequest.typeUrl || typeof o.metric_name === "string"); + }, + isAmino(o: any): o is DeleteLogMetricRequestAmino { + return o && (o.$typeUrl === DeleteLogMetricRequest.typeUrl || typeof o.metric_name === "string"); + }, encode(message: DeleteLogMetricRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.metricName !== "") { writer.uint32(10).string(message.metricName); @@ -1755,5 +1847,6 @@ export const DeleteLogMetricRequest = { typeUrl: "/google.logging.v2.DeleteLogMetricRequest", value: DeleteLogMetricRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/google/longrunning/operations.ts b/__fixtures__/v-next/outputv2/google/longrunning/operations.ts index e5410673a1..76eaea8719 100644 --- a/__fixtures__/v-next/outputv2/google/longrunning/operations.ts +++ b/__fixtures__/v-next/outputv2/google/longrunning/operations.ts @@ -2,6 +2,7 @@ import { Duration, DurationAmino, DurationSDKType } from "../protobuf/duration"; import { Any, AnyAmino, AnySDKType } from "../protobuf/any"; import { Status, StatusAmino, StatusSDKType } from "../rpc/status"; import { BinaryReader, BinaryWriter } from "../../binary"; +import { GlobalDecoderRegistry } from "../../registry"; import { isSet, DeepPartial } from "../../helpers"; import { JsonSafe } from "../../json-safe"; export const protobufPackage = "google.longrunning"; @@ -532,6 +533,15 @@ function createBaseOperation(): Operation { */ export const Operation = { typeUrl: "/google.longrunning.Operation", + is(o: any): o is Operation { + return o && (o.$typeUrl === Operation.typeUrl || typeof o.name === "string" && typeof o.done === "boolean"); + }, + isSDK(o: any): o is OperationSDKType { + return o && (o.$typeUrl === Operation.typeUrl || typeof o.name === "string" && typeof o.done === "boolean"); + }, + isAmino(o: any): o is OperationAmino { + return o && (o.$typeUrl === Operation.typeUrl || typeof o.name === "string" && typeof o.done === "boolean"); + }, encode(message: Operation, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -672,7 +682,8 @@ export const Operation = { typeUrl: "/google.longrunning.Operation", value: Operation.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseGetOperationRequest(): GetOperationRequest { return { @@ -687,6 +698,15 @@ function createBaseGetOperationRequest(): GetOperationRequest { */ export const GetOperationRequest = { typeUrl: "/google.longrunning.GetOperationRequest", + is(o: any): o is GetOperationRequest { + return o && (o.$typeUrl === GetOperationRequest.typeUrl || typeof o.name === "string"); + }, + isSDK(o: any): o is GetOperationRequestSDKType { + return o && (o.$typeUrl === GetOperationRequest.typeUrl || typeof o.name === "string"); + }, + isAmino(o: any): o is GetOperationRequestAmino { + return o && (o.$typeUrl === GetOperationRequest.typeUrl || typeof o.name === "string"); + }, encode(message: GetOperationRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -761,7 +781,8 @@ export const GetOperationRequest = { typeUrl: "/google.longrunning.GetOperationRequest", value: GetOperationRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseListOperationsRequest(): ListOperationsRequest { return { @@ -779,6 +800,15 @@ function createBaseListOperationsRequest(): ListOperationsRequest { */ export const ListOperationsRequest = { typeUrl: "/google.longrunning.ListOperationsRequest", + is(o: any): o is ListOperationsRequest { + return o && (o.$typeUrl === ListOperationsRequest.typeUrl || typeof o.name === "string" && typeof o.filter === "string" && typeof o.pageSize === "number" && typeof o.pageToken === "string"); + }, + isSDK(o: any): o is ListOperationsRequestSDKType { + return o && (o.$typeUrl === ListOperationsRequest.typeUrl || typeof o.name === "string" && typeof o.filter === "string" && typeof o.page_size === "number" && typeof o.page_token === "string"); + }, + isAmino(o: any): o is ListOperationsRequestAmino { + return o && (o.$typeUrl === ListOperationsRequest.typeUrl || typeof o.name === "string" && typeof o.filter === "string" && typeof o.page_size === "number" && typeof o.page_token === "string"); + }, encode(message: ListOperationsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(34).string(message.name); @@ -898,7 +928,8 @@ export const ListOperationsRequest = { typeUrl: "/google.longrunning.ListOperationsRequest", value: ListOperationsRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseListOperationsResponse(): ListOperationsResponse { return { @@ -914,6 +945,15 @@ function createBaseListOperationsResponse(): ListOperationsResponse { */ export const ListOperationsResponse = { typeUrl: "/google.longrunning.ListOperationsResponse", + is(o: any): o is ListOperationsResponse { + return o && (o.$typeUrl === ListOperationsResponse.typeUrl || Array.isArray(o.operations) && (!o.operations.length || Operation.is(o.operations[0])) && typeof o.nextPageToken === "string"); + }, + isSDK(o: any): o is ListOperationsResponseSDKType { + return o && (o.$typeUrl === ListOperationsResponse.typeUrl || Array.isArray(o.operations) && (!o.operations.length || Operation.isSDK(o.operations[0])) && typeof o.next_page_token === "string"); + }, + isAmino(o: any): o is ListOperationsResponseAmino { + return o && (o.$typeUrl === ListOperationsResponse.typeUrl || Array.isArray(o.operations) && (!o.operations.length || Operation.isAmino(o.operations[0])) && typeof o.next_page_token === "string"); + }, encode(message: ListOperationsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.operations) { Operation.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -1013,6 +1053,12 @@ export const ListOperationsResponse = { typeUrl: "/google.longrunning.ListOperationsResponse", value: ListOperationsResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ListOperationsResponse.typeUrl)) { + return; + } + Operation.registerTypeUrl(); } }; function createBaseCancelOperationRequest(): CancelOperationRequest { @@ -1028,6 +1074,15 @@ function createBaseCancelOperationRequest(): CancelOperationRequest { */ export const CancelOperationRequest = { typeUrl: "/google.longrunning.CancelOperationRequest", + is(o: any): o is CancelOperationRequest { + return o && (o.$typeUrl === CancelOperationRequest.typeUrl || typeof o.name === "string"); + }, + isSDK(o: any): o is CancelOperationRequestSDKType { + return o && (o.$typeUrl === CancelOperationRequest.typeUrl || typeof o.name === "string"); + }, + isAmino(o: any): o is CancelOperationRequestAmino { + return o && (o.$typeUrl === CancelOperationRequest.typeUrl || typeof o.name === "string"); + }, encode(message: CancelOperationRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -1102,7 +1157,8 @@ export const CancelOperationRequest = { typeUrl: "/google.longrunning.CancelOperationRequest", value: CancelOperationRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseDeleteOperationRequest(): DeleteOperationRequest { return { @@ -1117,6 +1173,15 @@ function createBaseDeleteOperationRequest(): DeleteOperationRequest { */ export const DeleteOperationRequest = { typeUrl: "/google.longrunning.DeleteOperationRequest", + is(o: any): o is DeleteOperationRequest { + return o && (o.$typeUrl === DeleteOperationRequest.typeUrl || typeof o.name === "string"); + }, + isSDK(o: any): o is DeleteOperationRequestSDKType { + return o && (o.$typeUrl === DeleteOperationRequest.typeUrl || typeof o.name === "string"); + }, + isAmino(o: any): o is DeleteOperationRequestAmino { + return o && (o.$typeUrl === DeleteOperationRequest.typeUrl || typeof o.name === "string"); + }, encode(message: DeleteOperationRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -1191,7 +1256,8 @@ export const DeleteOperationRequest = { typeUrl: "/google.longrunning.DeleteOperationRequest", value: DeleteOperationRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseWaitOperationRequest(): WaitOperationRequest { return { @@ -1207,6 +1273,15 @@ function createBaseWaitOperationRequest(): WaitOperationRequest { */ export const WaitOperationRequest = { typeUrl: "/google.longrunning.WaitOperationRequest", + is(o: any): o is WaitOperationRequest { + return o && (o.$typeUrl === WaitOperationRequest.typeUrl || typeof o.name === "string"); + }, + isSDK(o: any): o is WaitOperationRequestSDKType { + return o && (o.$typeUrl === WaitOperationRequest.typeUrl || typeof o.name === "string"); + }, + isAmino(o: any): o is WaitOperationRequestAmino { + return o && (o.$typeUrl === WaitOperationRequest.typeUrl || typeof o.name === "string"); + }, encode(message: WaitOperationRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -1298,7 +1373,8 @@ export const WaitOperationRequest = { typeUrl: "/google.longrunning.WaitOperationRequest", value: WaitOperationRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseOperationInfo(): OperationInfo { return { @@ -1324,6 +1400,15 @@ function createBaseOperationInfo(): OperationInfo { */ export const OperationInfo = { typeUrl: "/google.longrunning.OperationInfo", + is(o: any): o is OperationInfo { + return o && (o.$typeUrl === OperationInfo.typeUrl || typeof o.responseType === "string" && typeof o.metadataType === "string"); + }, + isSDK(o: any): o is OperationInfoSDKType { + return o && (o.$typeUrl === OperationInfo.typeUrl || typeof o.response_type === "string" && typeof o.metadata_type === "string"); + }, + isAmino(o: any): o is OperationInfoAmino { + return o && (o.$typeUrl === OperationInfo.typeUrl || typeof o.response_type === "string" && typeof o.metadata_type === "string"); + }, encode(message: OperationInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.responseType !== "") { writer.uint32(10).string(message.responseType); @@ -1413,5 +1498,6 @@ export const OperationInfo = { typeUrl: "/google.longrunning.OperationInfo", value: OperationInfo.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/google/protobuf/any.ts b/__fixtures__/v-next/outputv2/google/protobuf/any.ts index e492ca1593..987e40f2cc 100644 --- a/__fixtures__/v-next/outputv2/google/protobuf/any.ts +++ b/__fixtures__/v-next/outputv2/google/protobuf/any.ts @@ -433,6 +433,15 @@ function createBaseAny(): Any { */ export const Any = { typeUrl: "/google.protobuf.Any", + is(o: any): o is Any { + return o && (o.$typeUrl === Any.typeUrl || typeof o.typeUrl === "string" && (o.value instanceof Uint8Array || typeof o.value === "string")); + }, + isSDK(o: any): o is AnySDKType { + return o && (o.$typeUrl === Any.typeUrl || typeof o.type_url === "string" && (o.value instanceof Uint8Array || typeof o.value === "string")); + }, + isAmino(o: any): o is AnyAmino { + return o && (o.$typeUrl === Any.typeUrl || typeof o.type === "string" && (o.value instanceof Uint8Array || typeof o.value === "string")); + }, encode(message: Any, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.typeUrl !== "") { writer.uint32(10).string(message.typeUrl); @@ -518,5 +527,6 @@ export const Any = { typeUrl: "/google.protobuf.Any", value: Any.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/google/protobuf/api.ts b/__fixtures__/v-next/outputv2/google/protobuf/api.ts index 3182ccb7d9..f4dfbeee0a 100644 --- a/__fixtures__/v-next/outputv2/google/protobuf/api.ts +++ b/__fixtures__/v-next/outputv2/google/protobuf/api.ts @@ -1,7 +1,8 @@ import { Option, OptionAmino, OptionSDKType, Syntax, syntaxFromJSON, syntaxToJSON } from "./type"; import { SourceContext, SourceContextAmino, SourceContextSDKType } from "./source_context"; -import { BinaryReader, BinaryWriter } from "../../binary"; import { isSet, DeepPartial } from "../../helpers"; +import { BinaryReader, BinaryWriter } from "../../binary"; +import { GlobalDecoderRegistry } from "../../registry"; import { JsonSafe } from "../../json-safe"; export const protobufPackage = "google.protobuf"; /** @@ -568,6 +569,15 @@ function createBaseApi(): Api { */ export const Api = { typeUrl: "/google.protobuf.Api", + is(o: any): o is Api { + return o && (o.$typeUrl === Api.typeUrl || typeof o.name === "string" && Array.isArray(o.methods) && (!o.methods.length || Method.is(o.methods[0])) && Array.isArray(o.options) && (!o.options.length || Option.is(o.options[0])) && typeof o.version === "string" && Array.isArray(o.mixins) && (!o.mixins.length || Mixin.is(o.mixins[0])) && isSet(o.syntax)); + }, + isSDK(o: any): o is ApiSDKType { + return o && (o.$typeUrl === Api.typeUrl || typeof o.name === "string" && Array.isArray(o.methods) && (!o.methods.length || Method.isSDK(o.methods[0])) && Array.isArray(o.options) && (!o.options.length || Option.isSDK(o.options[0])) && typeof o.version === "string" && Array.isArray(o.mixins) && (!o.mixins.length || Mixin.isSDK(o.mixins[0])) && isSet(o.syntax)); + }, + isAmino(o: any): o is ApiAmino { + return o && (o.$typeUrl === Api.typeUrl || typeof o.name === "string" && Array.isArray(o.methods) && (!o.methods.length || Method.isAmino(o.methods[0])) && Array.isArray(o.options) && (!o.options.length || Option.isAmino(o.options[0])) && typeof o.version === "string" && Array.isArray(o.mixins) && (!o.mixins.length || Mixin.isAmino(o.mixins[0])) && isSet(o.syntax)); + }, encode(message: Api, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -764,6 +774,15 @@ export const Api = { typeUrl: "/google.protobuf.Api", value: Api.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Api.typeUrl)) { + return; + } + Method.registerTypeUrl(); + Option.registerTypeUrl(); + SourceContext.registerTypeUrl(); + Mixin.registerTypeUrl(); } }; function createBaseMethod(): Method { @@ -785,6 +804,15 @@ function createBaseMethod(): Method { */ export const Method = { typeUrl: "/google.protobuf.Method", + is(o: any): o is Method { + return o && (o.$typeUrl === Method.typeUrl || typeof o.name === "string" && typeof o.requestTypeUrl === "string" && typeof o.requestStreaming === "boolean" && typeof o.responseTypeUrl === "string" && typeof o.responseStreaming === "boolean" && Array.isArray(o.options) && (!o.options.length || Option.is(o.options[0])) && isSet(o.syntax)); + }, + isSDK(o: any): o is MethodSDKType { + return o && (o.$typeUrl === Method.typeUrl || typeof o.name === "string" && typeof o.request_type_url === "string" && typeof o.request_streaming === "boolean" && typeof o.response_type_url === "string" && typeof o.response_streaming === "boolean" && Array.isArray(o.options) && (!o.options.length || Option.isSDK(o.options[0])) && isSet(o.syntax)); + }, + isAmino(o: any): o is MethodAmino { + return o && (o.$typeUrl === Method.typeUrl || typeof o.name === "string" && typeof o.request_type_url === "string" && typeof o.request_streaming === "boolean" && typeof o.response_type_url === "string" && typeof o.response_streaming === "boolean" && Array.isArray(o.options) && (!o.options.length || Option.isAmino(o.options[0])) && isSet(o.syntax)); + }, encode(message: Method, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -959,6 +987,12 @@ export const Method = { typeUrl: "/google.protobuf.Method", value: Method.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Method.typeUrl)) { + return; + } + Option.registerTypeUrl(); } }; function createBaseMixin(): Mixin { @@ -1052,6 +1086,15 @@ function createBaseMixin(): Mixin { */ export const Mixin = { typeUrl: "/google.protobuf.Mixin", + is(o: any): o is Mixin { + return o && (o.$typeUrl === Mixin.typeUrl || typeof o.name === "string" && typeof o.root === "string"); + }, + isSDK(o: any): o is MixinSDKType { + return o && (o.$typeUrl === Mixin.typeUrl || typeof o.name === "string" && typeof o.root === "string"); + }, + isAmino(o: any): o is MixinAmino { + return o && (o.$typeUrl === Mixin.typeUrl || typeof o.name === "string" && typeof o.root === "string"); + }, encode(message: Mixin, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -1141,5 +1184,6 @@ export const Mixin = { typeUrl: "/google.protobuf.Mixin", value: Mixin.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/google/protobuf/compiler/plugin.ts b/__fixtures__/v-next/outputv2/google/protobuf/compiler/plugin.ts index 49be0c8841..3f98087f0d 100644 --- a/__fixtures__/v-next/outputv2/google/protobuf/compiler/plugin.ts +++ b/__fixtures__/v-next/outputv2/google/protobuf/compiler/plugin.ts @@ -2,6 +2,7 @@ import { FileDescriptorProto, FileDescriptorProtoAmino, FileDescriptorProtoSDKTy import { BinaryReader, BinaryWriter } from "../../../binary"; import { isSet, DeepPartial } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "google.protobuf.compiler"; /** * The version number of protocol compiler. @@ -378,6 +379,15 @@ function createBaseVersion(): Version { */ export const Version = { typeUrl: "/google.protobuf.compiler.Version", + is(o: any): o is Version { + return o && (o.$typeUrl === Version.typeUrl || typeof o.major === "number" && typeof o.minor === "number" && typeof o.patch === "number" && typeof o.suffix === "string"); + }, + isSDK(o: any): o is VersionSDKType { + return o && (o.$typeUrl === Version.typeUrl || typeof o.major === "number" && typeof o.minor === "number" && typeof o.patch === "number" && typeof o.suffix === "string"); + }, + isAmino(o: any): o is VersionAmino { + return o && (o.$typeUrl === Version.typeUrl || typeof o.major === "number" && typeof o.minor === "number" && typeof o.patch === "number" && typeof o.suffix === "string"); + }, encode(message: Version, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.major !== 0) { writer.uint32(8).int32(message.major); @@ -497,7 +507,8 @@ export const Version = { typeUrl: "/google.protobuf.compiler.Version", value: Version.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseCodeGeneratorRequest(): CodeGeneratorRequest { return { @@ -515,6 +526,15 @@ function createBaseCodeGeneratorRequest(): CodeGeneratorRequest { */ export const CodeGeneratorRequest = { typeUrl: "/google.protobuf.compiler.CodeGeneratorRequest", + is(o: any): o is CodeGeneratorRequest { + return o && (o.$typeUrl === CodeGeneratorRequest.typeUrl || Array.isArray(o.fileToGenerate) && (!o.fileToGenerate.length || typeof o.fileToGenerate[0] === "string") && typeof o.parameter === "string" && Array.isArray(o.protoFile) && (!o.protoFile.length || FileDescriptorProto.is(o.protoFile[0]))); + }, + isSDK(o: any): o is CodeGeneratorRequestSDKType { + return o && (o.$typeUrl === CodeGeneratorRequest.typeUrl || Array.isArray(o.file_to_generate) && (!o.file_to_generate.length || typeof o.file_to_generate[0] === "string") && typeof o.parameter === "string" && Array.isArray(o.proto_file) && (!o.proto_file.length || FileDescriptorProto.isSDK(o.proto_file[0]))); + }, + isAmino(o: any): o is CodeGeneratorRequestAmino { + return o && (o.$typeUrl === CodeGeneratorRequest.typeUrl || Array.isArray(o.file_to_generate) && (!o.file_to_generate.length || typeof o.file_to_generate[0] === "string") && typeof o.parameter === "string" && Array.isArray(o.proto_file) && (!o.proto_file.length || FileDescriptorProto.isAmino(o.proto_file[0]))); + }, encode(message: CodeGeneratorRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.fileToGenerate) { writer.uint32(10).string(v!); @@ -656,6 +676,13 @@ export const CodeGeneratorRequest = { typeUrl: "/google.protobuf.compiler.CodeGeneratorRequest", value: CodeGeneratorRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(CodeGeneratorRequest.typeUrl)) { + return; + } + FileDescriptorProto.registerTypeUrl(); + Version.registerTypeUrl(); } }; function createBaseCodeGeneratorResponse(): CodeGeneratorResponse { @@ -672,6 +699,15 @@ function createBaseCodeGeneratorResponse(): CodeGeneratorResponse { */ export const CodeGeneratorResponse = { typeUrl: "/google.protobuf.compiler.CodeGeneratorResponse", + is(o: any): o is CodeGeneratorResponse { + return o && (o.$typeUrl === CodeGeneratorResponse.typeUrl || typeof o.error === "string" && Array.isArray(o.file) && (!o.file.length || CodeGeneratorResponse_File.is(o.file[0]))); + }, + isSDK(o: any): o is CodeGeneratorResponseSDKType { + return o && (o.$typeUrl === CodeGeneratorResponse.typeUrl || typeof o.error === "string" && Array.isArray(o.file) && (!o.file.length || CodeGeneratorResponse_File.isSDK(o.file[0]))); + }, + isAmino(o: any): o is CodeGeneratorResponseAmino { + return o && (o.$typeUrl === CodeGeneratorResponse.typeUrl || typeof o.error === "string" && Array.isArray(o.file) && (!o.file.length || CodeGeneratorResponse_File.isAmino(o.file[0]))); + }, encode(message: CodeGeneratorResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.error !== "") { writer.uint32(10).string(message.error); @@ -771,6 +807,12 @@ export const CodeGeneratorResponse = { typeUrl: "/google.protobuf.compiler.CodeGeneratorResponse", value: CodeGeneratorResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(CodeGeneratorResponse.typeUrl)) { + return; + } + CodeGeneratorResponse_File.registerTypeUrl(); } }; function createBaseCodeGeneratorResponse_File(): CodeGeneratorResponse_File { @@ -788,6 +830,15 @@ function createBaseCodeGeneratorResponse_File(): CodeGeneratorResponse_File { */ export const CodeGeneratorResponse_File = { typeUrl: "/google.protobuf.compiler.File", + is(o: any): o is CodeGeneratorResponse_File { + return o && (o.$typeUrl === CodeGeneratorResponse_File.typeUrl || typeof o.name === "string" && typeof o.insertionPoint === "string" && typeof o.content === "string"); + }, + isSDK(o: any): o is CodeGeneratorResponse_FileSDKType { + return o && (o.$typeUrl === CodeGeneratorResponse_File.typeUrl || typeof o.name === "string" && typeof o.insertion_point === "string" && typeof o.content === "string"); + }, + isAmino(o: any): o is CodeGeneratorResponse_FileAmino { + return o && (o.$typeUrl === CodeGeneratorResponse_File.typeUrl || typeof o.name === "string" && typeof o.insertion_point === "string" && typeof o.content === "string"); + }, encode(message: CodeGeneratorResponse_File, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -892,5 +943,6 @@ export const CodeGeneratorResponse_File = { typeUrl: "/google.protobuf.compiler.File", value: CodeGeneratorResponse_File.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/google/protobuf/descriptor.ts b/__fixtures__/v-next/outputv2/google/protobuf/descriptor.ts index edffc66517..8b23cc0fc8 100644 --- a/__fixtures__/v-next/outputv2/google/protobuf/descriptor.ts +++ b/__fixtures__/v-next/outputv2/google/protobuf/descriptor.ts @@ -1,6 +1,7 @@ import { BinaryReader, BinaryWriter } from "../../binary"; import { JsonSafe } from "../../json-safe"; import { DeepPartial, isSet, bytesFromBase64, base64FromBytes } from "../../helpers"; +import { GlobalDecoderRegistry } from "../../registry"; export const protobufPackage = "google.protobuf"; export enum FieldDescriptorProto_Type { /** @@ -2677,6 +2678,15 @@ function createBaseFileDescriptorSet(): FileDescriptorSet { */ export const FileDescriptorSet = { typeUrl: "/google.protobuf.FileDescriptorSet", + is(o: any): o is FileDescriptorSet { + return o && (o.$typeUrl === FileDescriptorSet.typeUrl || Array.isArray(o.file) && (!o.file.length || FileDescriptorProto.is(o.file[0]))); + }, + isSDK(o: any): o is FileDescriptorSetSDKType { + return o && (o.$typeUrl === FileDescriptorSet.typeUrl || Array.isArray(o.file) && (!o.file.length || FileDescriptorProto.isSDK(o.file[0]))); + }, + isAmino(o: any): o is FileDescriptorSetAmino { + return o && (o.$typeUrl === FileDescriptorSet.typeUrl || Array.isArray(o.file) && (!o.file.length || FileDescriptorProto.isAmino(o.file[0]))); + }, encode(message: FileDescriptorSet, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.file) { FileDescriptorProto.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -2761,6 +2771,12 @@ export const FileDescriptorSet = { typeUrl: "/google.protobuf.FileDescriptorSet", value: FileDescriptorSet.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(FileDescriptorSet.typeUrl)) { + return; + } + FileDescriptorProto.registerTypeUrl(); } }; function createBaseFileDescriptorProto(): FileDescriptorProto { @@ -2787,6 +2803,15 @@ function createBaseFileDescriptorProto(): FileDescriptorProto { */ export const FileDescriptorProto = { typeUrl: "/google.protobuf.FileDescriptorProto", + is(o: any): o is FileDescriptorProto { + return o && (o.$typeUrl === FileDescriptorProto.typeUrl || typeof o.name === "string" && typeof o.package === "string" && Array.isArray(o.dependency) && (!o.dependency.length || typeof o.dependency[0] === "string") && Array.isArray(o.publicDependency) && (!o.publicDependency.length || typeof o.publicDependency[0] === "number") && Array.isArray(o.weakDependency) && (!o.weakDependency.length || typeof o.weakDependency[0] === "number") && Array.isArray(o.messageType) && (!o.messageType.length || DescriptorProto.is(o.messageType[0])) && Array.isArray(o.enumType) && (!o.enumType.length || EnumDescriptorProto.is(o.enumType[0])) && Array.isArray(o.service) && (!o.service.length || ServiceDescriptorProto.is(o.service[0])) && Array.isArray(o.extension) && (!o.extension.length || FieldDescriptorProto.is(o.extension[0])) && typeof o.syntax === "string"); + }, + isSDK(o: any): o is FileDescriptorProtoSDKType { + return o && (o.$typeUrl === FileDescriptorProto.typeUrl || typeof o.name === "string" && typeof o.package === "string" && Array.isArray(o.dependency) && (!o.dependency.length || typeof o.dependency[0] === "string") && Array.isArray(o.public_dependency) && (!o.public_dependency.length || typeof o.public_dependency[0] === "number") && Array.isArray(o.weak_dependency) && (!o.weak_dependency.length || typeof o.weak_dependency[0] === "number") && Array.isArray(o.message_type) && (!o.message_type.length || DescriptorProto.isSDK(o.message_type[0])) && Array.isArray(o.enum_type) && (!o.enum_type.length || EnumDescriptorProto.isSDK(o.enum_type[0])) && Array.isArray(o.service) && (!o.service.length || ServiceDescriptorProto.isSDK(o.service[0])) && Array.isArray(o.extension) && (!o.extension.length || FieldDescriptorProto.isSDK(o.extension[0])) && typeof o.syntax === "string"); + }, + isAmino(o: any): o is FileDescriptorProtoAmino { + return o && (o.$typeUrl === FileDescriptorProto.typeUrl || typeof o.name === "string" && typeof o.package === "string" && Array.isArray(o.dependency) && (!o.dependency.length || typeof o.dependency[0] === "string") && Array.isArray(o.public_dependency) && (!o.public_dependency.length || typeof o.public_dependency[0] === "number") && Array.isArray(o.weak_dependency) && (!o.weak_dependency.length || typeof o.weak_dependency[0] === "number") && Array.isArray(o.message_type) && (!o.message_type.length || DescriptorProto.isAmino(o.message_type[0])) && Array.isArray(o.enum_type) && (!o.enum_type.length || EnumDescriptorProto.isAmino(o.enum_type[0])) && Array.isArray(o.service) && (!o.service.length || ServiceDescriptorProto.isAmino(o.service[0])) && Array.isArray(o.extension) && (!o.extension.length || FieldDescriptorProto.isAmino(o.extension[0])) && typeof o.syntax === "string"); + }, encode(message: FileDescriptorProto, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -3118,6 +3143,17 @@ export const FileDescriptorProto = { typeUrl: "/google.protobuf.FileDescriptorProto", value: FileDescriptorProto.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(FileDescriptorProto.typeUrl)) { + return; + } + DescriptorProto.registerTypeUrl(); + EnumDescriptorProto.registerTypeUrl(); + ServiceDescriptorProto.registerTypeUrl(); + FieldDescriptorProto.registerTypeUrl(); + FileOptions.registerTypeUrl(); + SourceCodeInfo.registerTypeUrl(); } }; function createBaseDescriptorProto(): DescriptorProto { @@ -3142,6 +3178,15 @@ function createBaseDescriptorProto(): DescriptorProto { */ export const DescriptorProto = { typeUrl: "/google.protobuf.DescriptorProto", + is(o: any): o is DescriptorProto { + return o && (o.$typeUrl === DescriptorProto.typeUrl || typeof o.name === "string" && Array.isArray(o.field) && (!o.field.length || FieldDescriptorProto.is(o.field[0])) && Array.isArray(o.extension) && (!o.extension.length || FieldDescriptorProto.is(o.extension[0])) && Array.isArray(o.nestedType) && (!o.nestedType.length || DescriptorProto.is(o.nestedType[0])) && Array.isArray(o.enumType) && (!o.enumType.length || EnumDescriptorProto.is(o.enumType[0])) && Array.isArray(o.extensionRange) && (!o.extensionRange.length || DescriptorProto_ExtensionRange.is(o.extensionRange[0])) && Array.isArray(o.oneofDecl) && (!o.oneofDecl.length || OneofDescriptorProto.is(o.oneofDecl[0])) && Array.isArray(o.reservedRange) && (!o.reservedRange.length || DescriptorProto_ReservedRange.is(o.reservedRange[0])) && Array.isArray(o.reservedName) && (!o.reservedName.length || typeof o.reservedName[0] === "string")); + }, + isSDK(o: any): o is DescriptorProtoSDKType { + return o && (o.$typeUrl === DescriptorProto.typeUrl || typeof o.name === "string" && Array.isArray(o.field) && (!o.field.length || FieldDescriptorProto.isSDK(o.field[0])) && Array.isArray(o.extension) && (!o.extension.length || FieldDescriptorProto.isSDK(o.extension[0])) && Array.isArray(o.nested_type) && (!o.nested_type.length || DescriptorProto.isSDK(o.nested_type[0])) && Array.isArray(o.enum_type) && (!o.enum_type.length || EnumDescriptorProto.isSDK(o.enum_type[0])) && Array.isArray(o.extension_range) && (!o.extension_range.length || DescriptorProto_ExtensionRange.isSDK(o.extension_range[0])) && Array.isArray(o.oneof_decl) && (!o.oneof_decl.length || OneofDescriptorProto.isSDK(o.oneof_decl[0])) && Array.isArray(o.reserved_range) && (!o.reserved_range.length || DescriptorProto_ReservedRange.isSDK(o.reserved_range[0])) && Array.isArray(o.reserved_name) && (!o.reserved_name.length || typeof o.reserved_name[0] === "string")); + }, + isAmino(o: any): o is DescriptorProtoAmino { + return o && (o.$typeUrl === DescriptorProto.typeUrl || typeof o.name === "string" && Array.isArray(o.field) && (!o.field.length || FieldDescriptorProto.isAmino(o.field[0])) && Array.isArray(o.extension) && (!o.extension.length || FieldDescriptorProto.isAmino(o.extension[0])) && Array.isArray(o.nested_type) && (!o.nested_type.length || DescriptorProto.isAmino(o.nested_type[0])) && Array.isArray(o.enum_type) && (!o.enum_type.length || EnumDescriptorProto.isAmino(o.enum_type[0])) && Array.isArray(o.extension_range) && (!o.extension_range.length || DescriptorProto_ExtensionRange.isAmino(o.extension_range[0])) && Array.isArray(o.oneof_decl) && (!o.oneof_decl.length || OneofDescriptorProto.isAmino(o.oneof_decl[0])) && Array.isArray(o.reserved_range) && (!o.reserved_range.length || DescriptorProto_ReservedRange.isAmino(o.reserved_range[0])) && Array.isArray(o.reserved_name) && (!o.reserved_name.length || typeof o.reserved_name[0] === "string")); + }, encode(message: DescriptorProto, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -3433,6 +3478,18 @@ export const DescriptorProto = { typeUrl: "/google.protobuf.DescriptorProto", value: DescriptorProto.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(DescriptorProto.typeUrl)) { + return; + } + FieldDescriptorProto.registerTypeUrl(); + DescriptorProto.registerTypeUrl(); + EnumDescriptorProto.registerTypeUrl(); + DescriptorProto_ExtensionRange.registerTypeUrl(); + OneofDescriptorProto.registerTypeUrl(); + MessageOptions.registerTypeUrl(); + DescriptorProto_ReservedRange.registerTypeUrl(); } }; function createBaseDescriptorProto_ExtensionRange(): DescriptorProto_ExtensionRange { @@ -3449,6 +3506,15 @@ function createBaseDescriptorProto_ExtensionRange(): DescriptorProto_ExtensionRa */ export const DescriptorProto_ExtensionRange = { typeUrl: "/google.protobuf.ExtensionRange", + is(o: any): o is DescriptorProto_ExtensionRange { + return o && (o.$typeUrl === DescriptorProto_ExtensionRange.typeUrl || typeof o.start === "number" && typeof o.end === "number"); + }, + isSDK(o: any): o is DescriptorProto_ExtensionRangeSDKType { + return o && (o.$typeUrl === DescriptorProto_ExtensionRange.typeUrl || typeof o.start === "number" && typeof o.end === "number"); + }, + isAmino(o: any): o is DescriptorProto_ExtensionRangeAmino { + return o && (o.$typeUrl === DescriptorProto_ExtensionRange.typeUrl || typeof o.start === "number" && typeof o.end === "number"); + }, encode(message: DescriptorProto_ExtensionRange, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.start !== 0) { writer.uint32(8).int32(message.start); @@ -3555,6 +3621,12 @@ export const DescriptorProto_ExtensionRange = { typeUrl: "/google.protobuf.ExtensionRange", value: DescriptorProto_ExtensionRange.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(DescriptorProto_ExtensionRange.typeUrl)) { + return; + } + ExtensionRangeOptions.registerTypeUrl(); } }; function createBaseDescriptorProto_ReservedRange(): DescriptorProto_ReservedRange { @@ -3573,6 +3645,15 @@ function createBaseDescriptorProto_ReservedRange(): DescriptorProto_ReservedRang */ export const DescriptorProto_ReservedRange = { typeUrl: "/google.protobuf.ReservedRange", + is(o: any): o is DescriptorProto_ReservedRange { + return o && (o.$typeUrl === DescriptorProto_ReservedRange.typeUrl || typeof o.start === "number" && typeof o.end === "number"); + }, + isSDK(o: any): o is DescriptorProto_ReservedRangeSDKType { + return o && (o.$typeUrl === DescriptorProto_ReservedRange.typeUrl || typeof o.start === "number" && typeof o.end === "number"); + }, + isAmino(o: any): o is DescriptorProto_ReservedRangeAmino { + return o && (o.$typeUrl === DescriptorProto_ReservedRange.typeUrl || typeof o.start === "number" && typeof o.end === "number"); + }, encode(message: DescriptorProto_ReservedRange, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.start !== 0) { writer.uint32(8).int32(message.start); @@ -3662,7 +3743,8 @@ export const DescriptorProto_ReservedRange = { typeUrl: "/google.protobuf.ReservedRange", value: DescriptorProto_ReservedRange.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseExtensionRangeOptions(): ExtensionRangeOptions { return { @@ -3676,6 +3758,15 @@ function createBaseExtensionRangeOptions(): ExtensionRangeOptions { */ export const ExtensionRangeOptions = { typeUrl: "/google.protobuf.ExtensionRangeOptions", + is(o: any): o is ExtensionRangeOptions { + return o && (o.$typeUrl === ExtensionRangeOptions.typeUrl || Array.isArray(o.uninterpretedOption) && (!o.uninterpretedOption.length || UninterpretedOption.is(o.uninterpretedOption[0]))); + }, + isSDK(o: any): o is ExtensionRangeOptionsSDKType { + return o && (o.$typeUrl === ExtensionRangeOptions.typeUrl || Array.isArray(o.uninterpreted_option) && (!o.uninterpreted_option.length || UninterpretedOption.isSDK(o.uninterpreted_option[0]))); + }, + isAmino(o: any): o is ExtensionRangeOptionsAmino { + return o && (o.$typeUrl === ExtensionRangeOptions.typeUrl || Array.isArray(o.uninterpreted_option) && (!o.uninterpreted_option.length || UninterpretedOption.isAmino(o.uninterpreted_option[0]))); + }, encode(message: ExtensionRangeOptions, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.uninterpretedOption) { UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); @@ -3760,6 +3851,12 @@ export const ExtensionRangeOptions = { typeUrl: "/google.protobuf.ExtensionRangeOptions", value: ExtensionRangeOptions.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ExtensionRangeOptions.typeUrl)) { + return; + } + UninterpretedOption.registerTypeUrl(); } }; function createBaseFieldDescriptorProto(): FieldDescriptorProto { @@ -3784,6 +3881,15 @@ function createBaseFieldDescriptorProto(): FieldDescriptorProto { */ export const FieldDescriptorProto = { typeUrl: "/google.protobuf.FieldDescriptorProto", + is(o: any): o is FieldDescriptorProto { + return o && (o.$typeUrl === FieldDescriptorProto.typeUrl || typeof o.name === "string" && typeof o.number === "number" && isSet(o.label) && isSet(o.type) && typeof o.typeName === "string" && typeof o.extendee === "string" && typeof o.defaultValue === "string" && typeof o.oneofIndex === "number" && typeof o.jsonName === "string"); + }, + isSDK(o: any): o is FieldDescriptorProtoSDKType { + return o && (o.$typeUrl === FieldDescriptorProto.typeUrl || typeof o.name === "string" && typeof o.number === "number" && isSet(o.label) && isSet(o.type) && typeof o.type_name === "string" && typeof o.extendee === "string" && typeof o.default_value === "string" && typeof o.oneof_index === "number" && typeof o.json_name === "string"); + }, + isAmino(o: any): o is FieldDescriptorProtoAmino { + return o && (o.$typeUrl === FieldDescriptorProto.typeUrl || typeof o.name === "string" && typeof o.number === "number" && isSet(o.label) && isSet(o.type) && typeof o.type_name === "string" && typeof o.extendee === "string" && typeof o.default_value === "string" && typeof o.oneof_index === "number" && typeof o.json_name === "string"); + }, encode(message: FieldDescriptorProto, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -3995,6 +4101,12 @@ export const FieldDescriptorProto = { typeUrl: "/google.protobuf.FieldDescriptorProto", value: FieldDescriptorProto.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(FieldDescriptorProto.typeUrl)) { + return; + } + FieldOptions.registerTypeUrl(); } }; function createBaseOneofDescriptorProto(): OneofDescriptorProto { @@ -4011,6 +4123,15 @@ function createBaseOneofDescriptorProto(): OneofDescriptorProto { */ export const OneofDescriptorProto = { typeUrl: "/google.protobuf.OneofDescriptorProto", + is(o: any): o is OneofDescriptorProto { + return o && (o.$typeUrl === OneofDescriptorProto.typeUrl || typeof o.name === "string"); + }, + isSDK(o: any): o is OneofDescriptorProtoSDKType { + return o && (o.$typeUrl === OneofDescriptorProto.typeUrl || typeof o.name === "string"); + }, + isAmino(o: any): o is OneofDescriptorProtoAmino { + return o && (o.$typeUrl === OneofDescriptorProto.typeUrl || typeof o.name === "string"); + }, encode(message: OneofDescriptorProto, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -4102,6 +4223,12 @@ export const OneofDescriptorProto = { typeUrl: "/google.protobuf.OneofDescriptorProto", value: OneofDescriptorProto.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(OneofDescriptorProto.typeUrl)) { + return; + } + OneofOptions.registerTypeUrl(); } }; function createBaseEnumDescriptorProto(): EnumDescriptorProto { @@ -4121,6 +4248,15 @@ function createBaseEnumDescriptorProto(): EnumDescriptorProto { */ export const EnumDescriptorProto = { typeUrl: "/google.protobuf.EnumDescriptorProto", + is(o: any): o is EnumDescriptorProto { + return o && (o.$typeUrl === EnumDescriptorProto.typeUrl || typeof o.name === "string" && Array.isArray(o.value) && (!o.value.length || EnumValueDescriptorProto.is(o.value[0])) && Array.isArray(o.reservedRange) && (!o.reservedRange.length || EnumDescriptorProto_EnumReservedRange.is(o.reservedRange[0])) && Array.isArray(o.reservedName) && (!o.reservedName.length || typeof o.reservedName[0] === "string")); + }, + isSDK(o: any): o is EnumDescriptorProtoSDKType { + return o && (o.$typeUrl === EnumDescriptorProto.typeUrl || typeof o.name === "string" && Array.isArray(o.value) && (!o.value.length || EnumValueDescriptorProto.isSDK(o.value[0])) && Array.isArray(o.reserved_range) && (!o.reserved_range.length || EnumDescriptorProto_EnumReservedRange.isSDK(o.reserved_range[0])) && Array.isArray(o.reserved_name) && (!o.reserved_name.length || typeof o.reserved_name[0] === "string")); + }, + isAmino(o: any): o is EnumDescriptorProtoAmino { + return o && (o.$typeUrl === EnumDescriptorProto.typeUrl || typeof o.name === "string" && Array.isArray(o.value) && (!o.value.length || EnumValueDescriptorProto.isAmino(o.value[0])) && Array.isArray(o.reserved_range) && (!o.reserved_range.length || EnumDescriptorProto_EnumReservedRange.isAmino(o.reserved_range[0])) && Array.isArray(o.reserved_name) && (!o.reserved_name.length || typeof o.reserved_name[0] === "string")); + }, encode(message: EnumDescriptorProto, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -4287,6 +4423,14 @@ export const EnumDescriptorProto = { typeUrl: "/google.protobuf.EnumDescriptorProto", value: EnumDescriptorProto.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(EnumDescriptorProto.typeUrl)) { + return; + } + EnumValueDescriptorProto.registerTypeUrl(); + EnumOptions.registerTypeUrl(); + EnumDescriptorProto_EnumReservedRange.registerTypeUrl(); } }; function createBaseEnumDescriptorProto_EnumReservedRange(): EnumDescriptorProto_EnumReservedRange { @@ -4308,6 +4452,15 @@ function createBaseEnumDescriptorProto_EnumReservedRange(): EnumDescriptorProto_ */ export const EnumDescriptorProto_EnumReservedRange = { typeUrl: "/google.protobuf.EnumReservedRange", + is(o: any): o is EnumDescriptorProto_EnumReservedRange { + return o && (o.$typeUrl === EnumDescriptorProto_EnumReservedRange.typeUrl || typeof o.start === "number" && typeof o.end === "number"); + }, + isSDK(o: any): o is EnumDescriptorProto_EnumReservedRangeSDKType { + return o && (o.$typeUrl === EnumDescriptorProto_EnumReservedRange.typeUrl || typeof o.start === "number" && typeof o.end === "number"); + }, + isAmino(o: any): o is EnumDescriptorProto_EnumReservedRangeAmino { + return o && (o.$typeUrl === EnumDescriptorProto_EnumReservedRange.typeUrl || typeof o.start === "number" && typeof o.end === "number"); + }, encode(message: EnumDescriptorProto_EnumReservedRange, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.start !== 0) { writer.uint32(8).int32(message.start); @@ -4397,7 +4550,8 @@ export const EnumDescriptorProto_EnumReservedRange = { typeUrl: "/google.protobuf.EnumReservedRange", value: EnumDescriptorProto_EnumReservedRange.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseEnumValueDescriptorProto(): EnumValueDescriptorProto { return { @@ -4414,6 +4568,15 @@ function createBaseEnumValueDescriptorProto(): EnumValueDescriptorProto { */ export const EnumValueDescriptorProto = { typeUrl: "/google.protobuf.EnumValueDescriptorProto", + is(o: any): o is EnumValueDescriptorProto { + return o && (o.$typeUrl === EnumValueDescriptorProto.typeUrl || typeof o.name === "string" && typeof o.number === "number"); + }, + isSDK(o: any): o is EnumValueDescriptorProtoSDKType { + return o && (o.$typeUrl === EnumValueDescriptorProto.typeUrl || typeof o.name === "string" && typeof o.number === "number"); + }, + isAmino(o: any): o is EnumValueDescriptorProtoAmino { + return o && (o.$typeUrl === EnumValueDescriptorProto.typeUrl || typeof o.name === "string" && typeof o.number === "number"); + }, encode(message: EnumValueDescriptorProto, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -4520,6 +4683,12 @@ export const EnumValueDescriptorProto = { typeUrl: "/google.protobuf.EnumValueDescriptorProto", value: EnumValueDescriptorProto.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(EnumValueDescriptorProto.typeUrl)) { + return; + } + EnumValueOptions.registerTypeUrl(); } }; function createBaseServiceDescriptorProto(): ServiceDescriptorProto { @@ -4537,6 +4706,15 @@ function createBaseServiceDescriptorProto(): ServiceDescriptorProto { */ export const ServiceDescriptorProto = { typeUrl: "/google.protobuf.ServiceDescriptorProto", + is(o: any): o is ServiceDescriptorProto { + return o && (o.$typeUrl === ServiceDescriptorProto.typeUrl || typeof o.name === "string" && Array.isArray(o.method) && (!o.method.length || MethodDescriptorProto.is(o.method[0]))); + }, + isSDK(o: any): o is ServiceDescriptorProtoSDKType { + return o && (o.$typeUrl === ServiceDescriptorProto.typeUrl || typeof o.name === "string" && Array.isArray(o.method) && (!o.method.length || MethodDescriptorProto.isSDK(o.method[0]))); + }, + isAmino(o: any): o is ServiceDescriptorProtoAmino { + return o && (o.$typeUrl === ServiceDescriptorProto.typeUrl || typeof o.name === "string" && Array.isArray(o.method) && (!o.method.length || MethodDescriptorProto.isAmino(o.method[0]))); + }, encode(message: ServiceDescriptorProto, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -4653,6 +4831,13 @@ export const ServiceDescriptorProto = { typeUrl: "/google.protobuf.ServiceDescriptorProto", value: ServiceDescriptorProto.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ServiceDescriptorProto.typeUrl)) { + return; + } + MethodDescriptorProto.registerTypeUrl(); + ServiceOptions.registerTypeUrl(); } }; function createBaseMethodDescriptorProto(): MethodDescriptorProto { @@ -4673,6 +4858,15 @@ function createBaseMethodDescriptorProto(): MethodDescriptorProto { */ export const MethodDescriptorProto = { typeUrl: "/google.protobuf.MethodDescriptorProto", + is(o: any): o is MethodDescriptorProto { + return o && (o.$typeUrl === MethodDescriptorProto.typeUrl || typeof o.name === "string" && typeof o.inputType === "string" && typeof o.outputType === "string" && typeof o.clientStreaming === "boolean" && typeof o.serverStreaming === "boolean"); + }, + isSDK(o: any): o is MethodDescriptorProtoSDKType { + return o && (o.$typeUrl === MethodDescriptorProto.typeUrl || typeof o.name === "string" && typeof o.input_type === "string" && typeof o.output_type === "string" && typeof o.client_streaming === "boolean" && typeof o.server_streaming === "boolean"); + }, + isAmino(o: any): o is MethodDescriptorProtoAmino { + return o && (o.$typeUrl === MethodDescriptorProto.typeUrl || typeof o.name === "string" && typeof o.input_type === "string" && typeof o.output_type === "string" && typeof o.client_streaming === "boolean" && typeof o.server_streaming === "boolean"); + }, encode(message: MethodDescriptorProto, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -4824,6 +5018,12 @@ export const MethodDescriptorProto = { typeUrl: "/google.protobuf.MethodDescriptorProto", value: MethodDescriptorProto.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MethodDescriptorProto.typeUrl)) { + return; + } + MethodOptions.registerTypeUrl(); } }; function createBaseFileOptions(): FileOptions { @@ -4858,6 +5058,15 @@ function createBaseFileOptions(): FileOptions { */ export const FileOptions = { typeUrl: "/google.protobuf.FileOptions", + is(o: any): o is FileOptions { + return o && (o.$typeUrl === FileOptions.typeUrl || typeof o.javaPackage === "string" && typeof o.javaOuterClassname === "string" && typeof o.javaMultipleFiles === "boolean" && typeof o.javaGenerateEqualsAndHash === "boolean" && typeof o.javaStringCheckUtf8 === "boolean" && isSet(o.optimizeFor) && typeof o.goPackage === "string" && typeof o.ccGenericServices === "boolean" && typeof o.javaGenericServices === "boolean" && typeof o.pyGenericServices === "boolean" && typeof o.phpGenericServices === "boolean" && typeof o.deprecated === "boolean" && typeof o.ccEnableArenas === "boolean" && typeof o.objcClassPrefix === "string" && typeof o.csharpNamespace === "string" && typeof o.swiftPrefix === "string" && typeof o.phpClassPrefix === "string" && typeof o.phpNamespace === "string" && typeof o.phpMetadataNamespace === "string" && typeof o.rubyPackage === "string" && Array.isArray(o.uninterpretedOption) && (!o.uninterpretedOption.length || UninterpretedOption.is(o.uninterpretedOption[0]))); + }, + isSDK(o: any): o is FileOptionsSDKType { + return o && (o.$typeUrl === FileOptions.typeUrl || typeof o.java_package === "string" && typeof o.java_outer_classname === "string" && typeof o.java_multiple_files === "boolean" && typeof o.java_generate_equals_and_hash === "boolean" && typeof o.java_string_check_utf8 === "boolean" && isSet(o.optimize_for) && typeof o.go_package === "string" && typeof o.cc_generic_services === "boolean" && typeof o.java_generic_services === "boolean" && typeof o.py_generic_services === "boolean" && typeof o.php_generic_services === "boolean" && typeof o.deprecated === "boolean" && typeof o.cc_enable_arenas === "boolean" && typeof o.objc_class_prefix === "string" && typeof o.csharp_namespace === "string" && typeof o.swift_prefix === "string" && typeof o.php_class_prefix === "string" && typeof o.php_namespace === "string" && typeof o.php_metadata_namespace === "string" && typeof o.ruby_package === "string" && Array.isArray(o.uninterpreted_option) && (!o.uninterpreted_option.length || UninterpretedOption.isSDK(o.uninterpreted_option[0]))); + }, + isAmino(o: any): o is FileOptionsAmino { + return o && (o.$typeUrl === FileOptions.typeUrl || typeof o.java_package === "string" && typeof o.java_outer_classname === "string" && typeof o.java_multiple_files === "boolean" && typeof o.java_generate_equals_and_hash === "boolean" && typeof o.java_string_check_utf8 === "boolean" && isSet(o.optimize_for) && typeof o.go_package === "string" && typeof o.cc_generic_services === "boolean" && typeof o.java_generic_services === "boolean" && typeof o.py_generic_services === "boolean" && typeof o.php_generic_services === "boolean" && typeof o.deprecated === "boolean" && typeof o.cc_enable_arenas === "boolean" && typeof o.objc_class_prefix === "string" && typeof o.csharp_namespace === "string" && typeof o.swift_prefix === "string" && typeof o.php_class_prefix === "string" && typeof o.php_namespace === "string" && typeof o.php_metadata_namespace === "string" && typeof o.ruby_package === "string" && Array.isArray(o.uninterpreted_option) && (!o.uninterpreted_option.length || UninterpretedOption.isAmino(o.uninterpreted_option[0]))); + }, encode(message: FileOptions, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.javaPackage !== "") { writer.uint32(10).string(message.javaPackage); @@ -5242,6 +5451,12 @@ export const FileOptions = { typeUrl: "/google.protobuf.FileOptions", value: FileOptions.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(FileOptions.typeUrl)) { + return; + } + UninterpretedOption.registerTypeUrl(); } }; function createBaseMessageOptions(): MessageOptions { @@ -5260,6 +5475,15 @@ function createBaseMessageOptions(): MessageOptions { */ export const MessageOptions = { typeUrl: "/google.protobuf.MessageOptions", + is(o: any): o is MessageOptions { + return o && (o.$typeUrl === MessageOptions.typeUrl || typeof o.messageSetWireFormat === "boolean" && typeof o.noStandardDescriptorAccessor === "boolean" && typeof o.deprecated === "boolean" && typeof o.mapEntry === "boolean" && Array.isArray(o.uninterpretedOption) && (!o.uninterpretedOption.length || UninterpretedOption.is(o.uninterpretedOption[0]))); + }, + isSDK(o: any): o is MessageOptionsSDKType { + return o && (o.$typeUrl === MessageOptions.typeUrl || typeof o.message_set_wire_format === "boolean" && typeof o.no_standard_descriptor_accessor === "boolean" && typeof o.deprecated === "boolean" && typeof o.map_entry === "boolean" && Array.isArray(o.uninterpreted_option) && (!o.uninterpreted_option.length || UninterpretedOption.isSDK(o.uninterpreted_option[0]))); + }, + isAmino(o: any): o is MessageOptionsAmino { + return o && (o.$typeUrl === MessageOptions.typeUrl || typeof o.message_set_wire_format === "boolean" && typeof o.no_standard_descriptor_accessor === "boolean" && typeof o.deprecated === "boolean" && typeof o.map_entry === "boolean" && Array.isArray(o.uninterpreted_option) && (!o.uninterpreted_option.length || UninterpretedOption.isAmino(o.uninterpreted_option[0]))); + }, encode(message: MessageOptions, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.messageSetWireFormat === true) { writer.uint32(8).bool(message.messageSetWireFormat); @@ -5404,6 +5628,12 @@ export const MessageOptions = { typeUrl: "/google.protobuf.MessageOptions", value: MessageOptions.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MessageOptions.typeUrl)) { + return; + } + UninterpretedOption.registerTypeUrl(); } }; function createBaseFieldOptions(): FieldOptions { @@ -5424,6 +5654,15 @@ function createBaseFieldOptions(): FieldOptions { */ export const FieldOptions = { typeUrl: "/google.protobuf.FieldOptions", + is(o: any): o is FieldOptions { + return o && (o.$typeUrl === FieldOptions.typeUrl || isSet(o.ctype) && typeof o.packed === "boolean" && isSet(o.jstype) && typeof o.lazy === "boolean" && typeof o.deprecated === "boolean" && typeof o.weak === "boolean" && Array.isArray(o.uninterpretedOption) && (!o.uninterpretedOption.length || UninterpretedOption.is(o.uninterpretedOption[0]))); + }, + isSDK(o: any): o is FieldOptionsSDKType { + return o && (o.$typeUrl === FieldOptions.typeUrl || isSet(o.ctype) && typeof o.packed === "boolean" && isSet(o.jstype) && typeof o.lazy === "boolean" && typeof o.deprecated === "boolean" && typeof o.weak === "boolean" && Array.isArray(o.uninterpreted_option) && (!o.uninterpreted_option.length || UninterpretedOption.isSDK(o.uninterpreted_option[0]))); + }, + isAmino(o: any): o is FieldOptionsAmino { + return o && (o.$typeUrl === FieldOptions.typeUrl || isSet(o.ctype) && typeof o.packed === "boolean" && isSet(o.jstype) && typeof o.lazy === "boolean" && typeof o.deprecated === "boolean" && typeof o.weak === "boolean" && Array.isArray(o.uninterpreted_option) && (!o.uninterpreted_option.length || UninterpretedOption.isAmino(o.uninterpreted_option[0]))); + }, encode(message: FieldOptions, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.ctype !== 1) { writer.uint32(8).int32(message.ctype); @@ -5598,6 +5837,12 @@ export const FieldOptions = { typeUrl: "/google.protobuf.FieldOptions", value: FieldOptions.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(FieldOptions.typeUrl)) { + return; + } + UninterpretedOption.registerTypeUrl(); } }; function createBaseOneofOptions(): OneofOptions { @@ -5612,6 +5857,15 @@ function createBaseOneofOptions(): OneofOptions { */ export const OneofOptions = { typeUrl: "/google.protobuf.OneofOptions", + is(o: any): o is OneofOptions { + return o && (o.$typeUrl === OneofOptions.typeUrl || Array.isArray(o.uninterpretedOption) && (!o.uninterpretedOption.length || UninterpretedOption.is(o.uninterpretedOption[0]))); + }, + isSDK(o: any): o is OneofOptionsSDKType { + return o && (o.$typeUrl === OneofOptions.typeUrl || Array.isArray(o.uninterpreted_option) && (!o.uninterpreted_option.length || UninterpretedOption.isSDK(o.uninterpreted_option[0]))); + }, + isAmino(o: any): o is OneofOptionsAmino { + return o && (o.$typeUrl === OneofOptions.typeUrl || Array.isArray(o.uninterpreted_option) && (!o.uninterpreted_option.length || UninterpretedOption.isAmino(o.uninterpreted_option[0]))); + }, encode(message: OneofOptions, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.uninterpretedOption) { UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); @@ -5696,6 +5950,12 @@ export const OneofOptions = { typeUrl: "/google.protobuf.OneofOptions", value: OneofOptions.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(OneofOptions.typeUrl)) { + return; + } + UninterpretedOption.registerTypeUrl(); } }; function createBaseEnumOptions(): EnumOptions { @@ -5712,6 +5972,15 @@ function createBaseEnumOptions(): EnumOptions { */ export const EnumOptions = { typeUrl: "/google.protobuf.EnumOptions", + is(o: any): o is EnumOptions { + return o && (o.$typeUrl === EnumOptions.typeUrl || typeof o.allowAlias === "boolean" && typeof o.deprecated === "boolean" && Array.isArray(o.uninterpretedOption) && (!o.uninterpretedOption.length || UninterpretedOption.is(o.uninterpretedOption[0]))); + }, + isSDK(o: any): o is EnumOptionsSDKType { + return o && (o.$typeUrl === EnumOptions.typeUrl || typeof o.allow_alias === "boolean" && typeof o.deprecated === "boolean" && Array.isArray(o.uninterpreted_option) && (!o.uninterpreted_option.length || UninterpretedOption.isSDK(o.uninterpreted_option[0]))); + }, + isAmino(o: any): o is EnumOptionsAmino { + return o && (o.$typeUrl === EnumOptions.typeUrl || typeof o.allow_alias === "boolean" && typeof o.deprecated === "boolean" && Array.isArray(o.uninterpreted_option) && (!o.uninterpreted_option.length || UninterpretedOption.isAmino(o.uninterpreted_option[0]))); + }, encode(message: EnumOptions, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.allowAlias === true) { writer.uint32(16).bool(message.allowAlias); @@ -5826,6 +6095,12 @@ export const EnumOptions = { typeUrl: "/google.protobuf.EnumOptions", value: EnumOptions.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(EnumOptions.typeUrl)) { + return; + } + UninterpretedOption.registerTypeUrl(); } }; function createBaseEnumValueOptions(): EnumValueOptions { @@ -5841,6 +6116,15 @@ function createBaseEnumValueOptions(): EnumValueOptions { */ export const EnumValueOptions = { typeUrl: "/google.protobuf.EnumValueOptions", + is(o: any): o is EnumValueOptions { + return o && (o.$typeUrl === EnumValueOptions.typeUrl || typeof o.deprecated === "boolean" && Array.isArray(o.uninterpretedOption) && (!o.uninterpretedOption.length || UninterpretedOption.is(o.uninterpretedOption[0]))); + }, + isSDK(o: any): o is EnumValueOptionsSDKType { + return o && (o.$typeUrl === EnumValueOptions.typeUrl || typeof o.deprecated === "boolean" && Array.isArray(o.uninterpreted_option) && (!o.uninterpreted_option.length || UninterpretedOption.isSDK(o.uninterpreted_option[0]))); + }, + isAmino(o: any): o is EnumValueOptionsAmino { + return o && (o.$typeUrl === EnumValueOptions.typeUrl || typeof o.deprecated === "boolean" && Array.isArray(o.uninterpreted_option) && (!o.uninterpreted_option.length || UninterpretedOption.isAmino(o.uninterpreted_option[0]))); + }, encode(message: EnumValueOptions, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.deprecated === true) { writer.uint32(8).bool(message.deprecated); @@ -5940,6 +6224,12 @@ export const EnumValueOptions = { typeUrl: "/google.protobuf.EnumValueOptions", value: EnumValueOptions.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(EnumValueOptions.typeUrl)) { + return; + } + UninterpretedOption.registerTypeUrl(); } }; function createBaseServiceOptions(): ServiceOptions { @@ -5955,6 +6245,15 @@ function createBaseServiceOptions(): ServiceOptions { */ export const ServiceOptions = { typeUrl: "/google.protobuf.ServiceOptions", + is(o: any): o is ServiceOptions { + return o && (o.$typeUrl === ServiceOptions.typeUrl || typeof o.deprecated === "boolean" && Array.isArray(o.uninterpretedOption) && (!o.uninterpretedOption.length || UninterpretedOption.is(o.uninterpretedOption[0]))); + }, + isSDK(o: any): o is ServiceOptionsSDKType { + return o && (o.$typeUrl === ServiceOptions.typeUrl || typeof o.deprecated === "boolean" && Array.isArray(o.uninterpreted_option) && (!o.uninterpreted_option.length || UninterpretedOption.isSDK(o.uninterpreted_option[0]))); + }, + isAmino(o: any): o is ServiceOptionsAmino { + return o && (o.$typeUrl === ServiceOptions.typeUrl || typeof o.deprecated === "boolean" && Array.isArray(o.uninterpreted_option) && (!o.uninterpreted_option.length || UninterpretedOption.isAmino(o.uninterpreted_option[0]))); + }, encode(message: ServiceOptions, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.deprecated === true) { writer.uint32(264).bool(message.deprecated); @@ -6054,6 +6353,12 @@ export const ServiceOptions = { typeUrl: "/google.protobuf.ServiceOptions", value: ServiceOptions.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ServiceOptions.typeUrl)) { + return; + } + UninterpretedOption.registerTypeUrl(); } }; function createBaseMethodOptions(): MethodOptions { @@ -6070,6 +6375,15 @@ function createBaseMethodOptions(): MethodOptions { */ export const MethodOptions = { typeUrl: "/google.protobuf.MethodOptions", + is(o: any): o is MethodOptions { + return o && (o.$typeUrl === MethodOptions.typeUrl || typeof o.deprecated === "boolean" && isSet(o.idempotencyLevel) && Array.isArray(o.uninterpretedOption) && (!o.uninterpretedOption.length || UninterpretedOption.is(o.uninterpretedOption[0]))); + }, + isSDK(o: any): o is MethodOptionsSDKType { + return o && (o.$typeUrl === MethodOptions.typeUrl || typeof o.deprecated === "boolean" && isSet(o.idempotency_level) && Array.isArray(o.uninterpreted_option) && (!o.uninterpreted_option.length || UninterpretedOption.isSDK(o.uninterpreted_option[0]))); + }, + isAmino(o: any): o is MethodOptionsAmino { + return o && (o.$typeUrl === MethodOptions.typeUrl || typeof o.deprecated === "boolean" && isSet(o.idempotency_level) && Array.isArray(o.uninterpreted_option) && (!o.uninterpreted_option.length || UninterpretedOption.isAmino(o.uninterpreted_option[0]))); + }, encode(message: MethodOptions, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.deprecated === true) { writer.uint32(264).bool(message.deprecated); @@ -6184,6 +6498,12 @@ export const MethodOptions = { typeUrl: "/google.protobuf.MethodOptions", value: MethodOptions.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MethodOptions.typeUrl)) { + return; + } + UninterpretedOption.registerTypeUrl(); } }; function createBaseUninterpretedOption(): UninterpretedOption { @@ -6210,6 +6530,15 @@ function createBaseUninterpretedOption(): UninterpretedOption { */ export const UninterpretedOption = { typeUrl: "/google.protobuf.UninterpretedOption", + is(o: any): o is UninterpretedOption { + return o && (o.$typeUrl === UninterpretedOption.typeUrl || Array.isArray(o.name) && (!o.name.length || UninterpretedOption_NamePart.is(o.name[0])) && typeof o.identifierValue === "string" && typeof o.positiveIntValue === "bigint" && typeof o.negativeIntValue === "bigint" && typeof o.doubleValue === "number" && (o.stringValue instanceof Uint8Array || typeof o.stringValue === "string") && typeof o.aggregateValue === "string"); + }, + isSDK(o: any): o is UninterpretedOptionSDKType { + return o && (o.$typeUrl === UninterpretedOption.typeUrl || Array.isArray(o.name) && (!o.name.length || UninterpretedOption_NamePart.isSDK(o.name[0])) && typeof o.identifier_value === "string" && typeof o.positive_int_value === "bigint" && typeof o.negative_int_value === "bigint" && typeof o.double_value === "number" && (o.string_value instanceof Uint8Array || typeof o.string_value === "string") && typeof o.aggregate_value === "string"); + }, + isAmino(o: any): o is UninterpretedOptionAmino { + return o && (o.$typeUrl === UninterpretedOption.typeUrl || Array.isArray(o.name) && (!o.name.length || UninterpretedOption_NamePart.isAmino(o.name[0])) && typeof o.identifier_value === "string" && typeof o.positive_int_value === "bigint" && typeof o.negative_int_value === "bigint" && typeof o.double_value === "number" && (o.string_value instanceof Uint8Array || typeof o.string_value === "string") && typeof o.aggregate_value === "string"); + }, encode(message: UninterpretedOption, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.name) { UninterpretedOption_NamePart.encode(v!, writer.uint32(18).fork()).ldelim(); @@ -6388,6 +6717,12 @@ export const UninterpretedOption = { typeUrl: "/google.protobuf.UninterpretedOption", value: UninterpretedOption.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(UninterpretedOption.typeUrl)) { + return; + } + UninterpretedOption_NamePart.registerTypeUrl(); } }; function createBaseUninterpretedOption_NamePart(): UninterpretedOption_NamePart { @@ -6408,6 +6743,15 @@ function createBaseUninterpretedOption_NamePart(): UninterpretedOption_NamePart */ export const UninterpretedOption_NamePart = { typeUrl: "/google.protobuf.NamePart", + is(o: any): o is UninterpretedOption_NamePart { + return o && (o.$typeUrl === UninterpretedOption_NamePart.typeUrl || typeof o.namePart === "string" && typeof o.isExtension === "boolean"); + }, + isSDK(o: any): o is UninterpretedOption_NamePartSDKType { + return o && (o.$typeUrl === UninterpretedOption_NamePart.typeUrl || typeof o.name_part === "string" && typeof o.is_extension === "boolean"); + }, + isAmino(o: any): o is UninterpretedOption_NamePartAmino { + return o && (o.$typeUrl === UninterpretedOption_NamePart.typeUrl || typeof o.name_part === "string" && typeof o.is_extension === "boolean"); + }, encode(message: UninterpretedOption_NamePart, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.namePart !== "") { writer.uint32(10).string(message.namePart); @@ -6497,7 +6841,8 @@ export const UninterpretedOption_NamePart = { typeUrl: "/google.protobuf.NamePart", value: UninterpretedOption_NamePart.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseSourceCodeInfo(): SourceCodeInfo { return { @@ -6513,6 +6858,15 @@ function createBaseSourceCodeInfo(): SourceCodeInfo { */ export const SourceCodeInfo = { typeUrl: "/google.protobuf.SourceCodeInfo", + is(o: any): o is SourceCodeInfo { + return o && (o.$typeUrl === SourceCodeInfo.typeUrl || Array.isArray(o.location) && (!o.location.length || SourceCodeInfo_Location.is(o.location[0]))); + }, + isSDK(o: any): o is SourceCodeInfoSDKType { + return o && (o.$typeUrl === SourceCodeInfo.typeUrl || Array.isArray(o.location) && (!o.location.length || SourceCodeInfo_Location.isSDK(o.location[0]))); + }, + isAmino(o: any): o is SourceCodeInfoAmino { + return o && (o.$typeUrl === SourceCodeInfo.typeUrl || Array.isArray(o.location) && (!o.location.length || SourceCodeInfo_Location.isAmino(o.location[0]))); + }, encode(message: SourceCodeInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.location) { SourceCodeInfo_Location.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -6597,6 +6951,12 @@ export const SourceCodeInfo = { typeUrl: "/google.protobuf.SourceCodeInfo", value: SourceCodeInfo.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(SourceCodeInfo.typeUrl)) { + return; + } + SourceCodeInfo_Location.registerTypeUrl(); } }; function createBaseSourceCodeInfo_Location(): SourceCodeInfo_Location { @@ -6615,6 +6975,15 @@ function createBaseSourceCodeInfo_Location(): SourceCodeInfo_Location { */ export const SourceCodeInfo_Location = { typeUrl: "/google.protobuf.Location", + is(o: any): o is SourceCodeInfo_Location { + return o && (o.$typeUrl === SourceCodeInfo_Location.typeUrl || Array.isArray(o.path) && (!o.path.length || typeof o.path[0] === "number") && Array.isArray(o.span) && (!o.span.length || typeof o.span[0] === "number") && typeof o.leadingComments === "string" && typeof o.trailingComments === "string" && Array.isArray(o.leadingDetachedComments) && (!o.leadingDetachedComments.length || typeof o.leadingDetachedComments[0] === "string")); + }, + isSDK(o: any): o is SourceCodeInfo_LocationSDKType { + return o && (o.$typeUrl === SourceCodeInfo_Location.typeUrl || Array.isArray(o.path) && (!o.path.length || typeof o.path[0] === "number") && Array.isArray(o.span) && (!o.span.length || typeof o.span[0] === "number") && typeof o.leading_comments === "string" && typeof o.trailing_comments === "string" && Array.isArray(o.leading_detached_comments) && (!o.leading_detached_comments.length || typeof o.leading_detached_comments[0] === "string")); + }, + isAmino(o: any): o is SourceCodeInfo_LocationAmino { + return o && (o.$typeUrl === SourceCodeInfo_Location.typeUrl || Array.isArray(o.path) && (!o.path.length || typeof o.path[0] === "number") && Array.isArray(o.span) && (!o.span.length || typeof o.span[0] === "number") && typeof o.leading_comments === "string" && typeof o.trailing_comments === "string" && Array.isArray(o.leading_detached_comments) && (!o.leading_detached_comments.length || typeof o.leading_detached_comments[0] === "string")); + }, encode(message: SourceCodeInfo_Location, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { writer.uint32(10).fork(); for (const v of message.path) { @@ -6797,7 +7166,8 @@ export const SourceCodeInfo_Location = { typeUrl: "/google.protobuf.Location", value: SourceCodeInfo_Location.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseGeneratedCodeInfo(): GeneratedCodeInfo { return { @@ -6814,6 +7184,15 @@ function createBaseGeneratedCodeInfo(): GeneratedCodeInfo { */ export const GeneratedCodeInfo = { typeUrl: "/google.protobuf.GeneratedCodeInfo", + is(o: any): o is GeneratedCodeInfo { + return o && (o.$typeUrl === GeneratedCodeInfo.typeUrl || Array.isArray(o.annotation) && (!o.annotation.length || GeneratedCodeInfo_Annotation.is(o.annotation[0]))); + }, + isSDK(o: any): o is GeneratedCodeInfoSDKType { + return o && (o.$typeUrl === GeneratedCodeInfo.typeUrl || Array.isArray(o.annotation) && (!o.annotation.length || GeneratedCodeInfo_Annotation.isSDK(o.annotation[0]))); + }, + isAmino(o: any): o is GeneratedCodeInfoAmino { + return o && (o.$typeUrl === GeneratedCodeInfo.typeUrl || Array.isArray(o.annotation) && (!o.annotation.length || GeneratedCodeInfo_Annotation.isAmino(o.annotation[0]))); + }, encode(message: GeneratedCodeInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.annotation) { GeneratedCodeInfo_Annotation.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -6898,6 +7277,12 @@ export const GeneratedCodeInfo = { typeUrl: "/google.protobuf.GeneratedCodeInfo", value: GeneratedCodeInfo.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GeneratedCodeInfo.typeUrl)) { + return; + } + GeneratedCodeInfo_Annotation.registerTypeUrl(); } }; function createBaseGeneratedCodeInfo_Annotation(): GeneratedCodeInfo_Annotation { @@ -6915,6 +7300,15 @@ function createBaseGeneratedCodeInfo_Annotation(): GeneratedCodeInfo_Annotation */ export const GeneratedCodeInfo_Annotation = { typeUrl: "/google.protobuf.Annotation", + is(o: any): o is GeneratedCodeInfo_Annotation { + return o && (o.$typeUrl === GeneratedCodeInfo_Annotation.typeUrl || Array.isArray(o.path) && (!o.path.length || typeof o.path[0] === "number") && typeof o.sourceFile === "string" && typeof o.begin === "number" && typeof o.end === "number"); + }, + isSDK(o: any): o is GeneratedCodeInfo_AnnotationSDKType { + return o && (o.$typeUrl === GeneratedCodeInfo_Annotation.typeUrl || Array.isArray(o.path) && (!o.path.length || typeof o.path[0] === "number") && typeof o.source_file === "string" && typeof o.begin === "number" && typeof o.end === "number"); + }, + isAmino(o: any): o is GeneratedCodeInfo_AnnotationAmino { + return o && (o.$typeUrl === GeneratedCodeInfo_Annotation.typeUrl || Array.isArray(o.path) && (!o.path.length || typeof o.path[0] === "number") && typeof o.source_file === "string" && typeof o.begin === "number" && typeof o.end === "number"); + }, encode(message: GeneratedCodeInfo_Annotation, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { writer.uint32(10).fork(); for (const v of message.path) { @@ -7053,5 +7447,6 @@ export const GeneratedCodeInfo_Annotation = { typeUrl: "/google.protobuf.Annotation", value: GeneratedCodeInfo_Annotation.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/google/protobuf/duration.ts b/__fixtures__/v-next/outputv2/google/protobuf/duration.ts index 6d17845d81..7bdc4d753e 100644 --- a/__fixtures__/v-next/outputv2/google/protobuf/duration.ts +++ b/__fixtures__/v-next/outputv2/google/protobuf/duration.ts @@ -292,6 +292,15 @@ function createBaseDuration(): Duration { */ export const Duration = { typeUrl: "/google.protobuf.Duration", + is(o: any): o is Duration { + return o && (o.$typeUrl === Duration.typeUrl || typeof o.seconds === "bigint" && typeof o.nanos === "number"); + }, + isSDK(o: any): o is DurationSDKType { + return o && (o.$typeUrl === Duration.typeUrl || typeof o.seconds === "bigint" && typeof o.nanos === "number"); + }, + isAmino(o: any): o is DurationAmino { + return o && (o.$typeUrl === Duration.typeUrl || typeof o.seconds === "bigint" && typeof o.nanos === "number"); + }, encode(message: Duration, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.seconds !== BigInt(0)) { writer.uint32(8).int64(message.seconds); @@ -377,5 +386,6 @@ export const Duration = { typeUrl: "/google.protobuf.Duration", value: Duration.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/google/protobuf/empty.ts b/__fixtures__/v-next/outputv2/google/protobuf/empty.ts index 0d93034fbd..7f85cb7ecb 100644 --- a/__fixtures__/v-next/outputv2/google/protobuf/empty.ts +++ b/__fixtures__/v-next/outputv2/google/protobuf/empty.ts @@ -74,6 +74,15 @@ function createBaseEmpty(): Empty { */ export const Empty = { typeUrl: "/google.protobuf.Empty", + is(o: any): o is Empty { + return o && o.$typeUrl === Empty.typeUrl; + }, + isSDK(o: any): o is EmptySDKType { + return o && o.$typeUrl === Empty.typeUrl; + }, + isAmino(o: any): o is EmptyAmino { + return o && o.$typeUrl === Empty.typeUrl; + }, encode(_: Empty, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -132,5 +141,6 @@ export const Empty = { typeUrl: "/google.protobuf.Empty", value: Empty.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/google/protobuf/field_mask.ts b/__fixtures__/v-next/outputv2/google/protobuf/field_mask.ts index 5e6c954c2f..ddb28222a6 100644 --- a/__fixtures__/v-next/outputv2/google/protobuf/field_mask.ts +++ b/__fixtures__/v-next/outputv2/google/protobuf/field_mask.ts @@ -848,6 +848,15 @@ function createBaseFieldMask(): FieldMask { */ export const FieldMask = { typeUrl: "/google.protobuf.FieldMask", + is(o: any): o is FieldMask { + return o && (o.$typeUrl === FieldMask.typeUrl || Array.isArray(o.paths) && (!o.paths.length || typeof o.paths[0] === "string")); + }, + isSDK(o: any): o is FieldMaskSDKType { + return o && (o.$typeUrl === FieldMask.typeUrl || Array.isArray(o.paths) && (!o.paths.length || typeof o.paths[0] === "string")); + }, + isAmino(o: any): o is FieldMaskAmino { + return o && (o.$typeUrl === FieldMask.typeUrl || Array.isArray(o.paths) && (!o.paths.length || typeof o.paths[0] === "string")); + }, encode(message: FieldMask, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.paths) { writer.uint32(10).string(v!); @@ -932,5 +941,6 @@ export const FieldMask = { typeUrl: "/google.protobuf.FieldMask", value: FieldMask.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/google/protobuf/source_context.ts b/__fixtures__/v-next/outputv2/google/protobuf/source_context.ts index 9f82ba837a..91407bbacc 100644 --- a/__fixtures__/v-next/outputv2/google/protobuf/source_context.ts +++ b/__fixtures__/v-next/outputv2/google/protobuf/source_context.ts @@ -62,6 +62,15 @@ function createBaseSourceContext(): SourceContext { */ export const SourceContext = { typeUrl: "/google.protobuf.SourceContext", + is(o: any): o is SourceContext { + return o && (o.$typeUrl === SourceContext.typeUrl || typeof o.fileName === "string"); + }, + isSDK(o: any): o is SourceContextSDKType { + return o && (o.$typeUrl === SourceContext.typeUrl || typeof o.file_name === "string"); + }, + isAmino(o: any): o is SourceContextAmino { + return o && (o.$typeUrl === SourceContext.typeUrl || typeof o.file_name === "string"); + }, encode(message: SourceContext, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.fileName !== "") { writer.uint32(10).string(message.fileName); @@ -136,5 +145,6 @@ export const SourceContext = { typeUrl: "/google.protobuf.SourceContext", value: SourceContext.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/google/protobuf/struct.ts b/__fixtures__/v-next/outputv2/google/protobuf/struct.ts index a8687bbfd2..91466acbd8 100644 --- a/__fixtures__/v-next/outputv2/google/protobuf/struct.ts +++ b/__fixtures__/v-next/outputv2/google/protobuf/struct.ts @@ -1,4 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; +import { GlobalDecoderRegistry } from "../../registry"; import { isSet, DeepPartial, isObject } from "../../helpers"; import { JsonSafe } from "../../json-safe"; export const protobufPackage = "google.protobuf"; @@ -383,6 +384,9 @@ export const Struct_FieldsEntry = { }, toProto(message: Struct_FieldsEntry): Uint8Array { return Struct_FieldsEntry.encode(message).finish(); + }, + registerTypeUrl() { + Value.registerTypeUrl(); } }; function createBaseStruct(): Struct { @@ -405,6 +409,15 @@ function createBaseStruct(): Struct { */ export const Struct = { typeUrl: "/google.protobuf.Struct", + is(o: any): o is Struct { + return o && (o.$typeUrl === Struct.typeUrl || isSet(o.fields)); + }, + isSDK(o: any): o is StructSDKType { + return o && (o.$typeUrl === Struct.typeUrl || isSet(o.fields)); + }, + isAmino(o: any): o is StructAmino { + return o && (o.$typeUrl === Struct.typeUrl || isSet(o.fields)); + }, encode(message: Struct, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { Object.entries(message.fields).forEach(([key, value]) => { Struct_FieldsEntry.encode({ @@ -522,6 +535,12 @@ export const Struct = { typeUrl: "/google.protobuf.Struct", value: Struct.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Struct.typeUrl)) { + return; + } + Value.registerTypeUrl(); } }; function createBaseValue(): Value { @@ -547,6 +566,15 @@ function createBaseValue(): Value { */ export const Value = { typeUrl: "/google.protobuf.Value", + is(o: any): o is Value { + return o && o.$typeUrl === Value.typeUrl; + }, + isSDK(o: any): o is ValueSDKType { + return o && o.$typeUrl === Value.typeUrl; + }, + isAmino(o: any): o is ValueAmino { + return o && o.$typeUrl === Value.typeUrl; + }, encode(message: Value, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.nullValue !== undefined) { writer.uint32(8).int32(message.nullValue); @@ -700,6 +728,13 @@ export const Value = { typeUrl: "/google.protobuf.Value", value: Value.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Value.typeUrl)) { + return; + } + Struct.registerTypeUrl(); + ListValue.registerTypeUrl(); } }; function createBaseListValue(): ListValue { @@ -717,6 +752,15 @@ function createBaseListValue(): ListValue { */ export const ListValue = { typeUrl: "/google.protobuf.ListValue", + is(o: any): o is ListValue { + return o && (o.$typeUrl === ListValue.typeUrl || Array.isArray(o.values) && (!o.values.length || Value.is(o.values[0]))); + }, + isSDK(o: any): o is ListValueSDKType { + return o && (o.$typeUrl === ListValue.typeUrl || Array.isArray(o.values) && (!o.values.length || Value.isSDK(o.values[0]))); + }, + isAmino(o: any): o is ListValueAmino { + return o && (o.$typeUrl === ListValue.typeUrl || Array.isArray(o.values) && (!o.values.length || Value.isAmino(o.values[0]))); + }, encode(message: ListValue, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.values) { Value.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -801,5 +845,11 @@ export const ListValue = { typeUrl: "/google.protobuf.ListValue", value: ListValue.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ListValue.typeUrl)) { + return; + } + Value.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/google/protobuf/timestamp.ts b/__fixtures__/v-next/outputv2/google/protobuf/timestamp.ts index 4b928b3c64..8580263fd5 100644 --- a/__fixtures__/v-next/outputv2/google/protobuf/timestamp.ts +++ b/__fixtures__/v-next/outputv2/google/protobuf/timestamp.ts @@ -386,6 +386,15 @@ function createBaseTimestamp(): Timestamp { */ export const Timestamp = { typeUrl: "/google.protobuf.Timestamp", + is(o: any): o is Timestamp { + return o && (o.$typeUrl === Timestamp.typeUrl || typeof o.seconds === "bigint" && typeof o.nanos === "number"); + }, + isSDK(o: any): o is TimestampSDKType { + return o && (o.$typeUrl === Timestamp.typeUrl || typeof o.seconds === "bigint" && typeof o.nanos === "number"); + }, + isAmino(o: any): o is TimestampAmino { + return o && (o.$typeUrl === Timestamp.typeUrl || typeof o.seconds === "bigint" && typeof o.nanos === "number"); + }, encode(message: Timestamp, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.seconds !== BigInt(0)) { writer.uint32(8).int64(message.seconds); @@ -467,5 +476,6 @@ export const Timestamp = { typeUrl: "/google.protobuf.Timestamp", value: Timestamp.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/google/protobuf/type.ts b/__fixtures__/v-next/outputv2/google/protobuf/type.ts index 2b2dd7a693..110522b017 100644 --- a/__fixtures__/v-next/outputv2/google/protobuf/type.ts +++ b/__fixtures__/v-next/outputv2/google/protobuf/type.ts @@ -1,7 +1,8 @@ import { SourceContext, SourceContextAmino, SourceContextSDKType } from "./source_context"; import { Any, AnyAmino, AnySDKType } from "./any"; -import { BinaryReader, BinaryWriter } from "../../binary"; import { isSet, DeepPartial } from "../../helpers"; +import { BinaryReader, BinaryWriter } from "../../binary"; +import { GlobalDecoderRegistry } from "../../registry"; import { JsonSafe } from "../../json-safe"; export const protobufPackage = "google.protobuf"; /** Basic field types. */ @@ -673,6 +674,15 @@ function createBaseType(): Type { */ export const Type = { typeUrl: "/google.protobuf.Type", + is(o: any): o is Type { + return o && (o.$typeUrl === Type.typeUrl || typeof o.name === "string" && Array.isArray(o.fields) && (!o.fields.length || Field.is(o.fields[0])) && Array.isArray(o.oneofs) && (!o.oneofs.length || typeof o.oneofs[0] === "string") && Array.isArray(o.options) && (!o.options.length || Option.is(o.options[0])) && isSet(o.syntax)); + }, + isSDK(o: any): o is TypeSDKType { + return o && (o.$typeUrl === Type.typeUrl || typeof o.name === "string" && Array.isArray(o.fields) && (!o.fields.length || Field.isSDK(o.fields[0])) && Array.isArray(o.oneofs) && (!o.oneofs.length || typeof o.oneofs[0] === "string") && Array.isArray(o.options) && (!o.options.length || Option.isSDK(o.options[0])) && isSet(o.syntax)); + }, + isAmino(o: any): o is TypeAmino { + return o && (o.$typeUrl === Type.typeUrl || typeof o.name === "string" && Array.isArray(o.fields) && (!o.fields.length || Field.isAmino(o.fields[0])) && Array.isArray(o.oneofs) && (!o.oneofs.length || typeof o.oneofs[0] === "string") && Array.isArray(o.options) && (!o.options.length || Option.isAmino(o.options[0])) && isSet(o.syntax)); + }, encode(message: Type, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -854,6 +864,14 @@ export const Type = { typeUrl: "/google.protobuf.Type", value: Type.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Type.typeUrl)) { + return; + } + Field.registerTypeUrl(); + Option.registerTypeUrl(); + SourceContext.registerTypeUrl(); } }; function createBaseField(): Field { @@ -878,6 +896,15 @@ function createBaseField(): Field { */ export const Field = { typeUrl: "/google.protobuf.Field", + is(o: any): o is Field { + return o && (o.$typeUrl === Field.typeUrl || isSet(o.kind) && isSet(o.cardinality) && typeof o.number === "number" && typeof o.name === "string" && typeof o.typeUrl === "string" && typeof o.oneofIndex === "number" && typeof o.packed === "boolean" && Array.isArray(o.options) && (!o.options.length || Option.is(o.options[0])) && typeof o.jsonName === "string" && typeof o.defaultValue === "string"); + }, + isSDK(o: any): o is FieldSDKType { + return o && (o.$typeUrl === Field.typeUrl || isSet(o.kind) && isSet(o.cardinality) && typeof o.number === "number" && typeof o.name === "string" && typeof o.type_url === "string" && typeof o.oneof_index === "number" && typeof o.packed === "boolean" && Array.isArray(o.options) && (!o.options.length || Option.isSDK(o.options[0])) && typeof o.json_name === "string" && typeof o.default_value === "string"); + }, + isAmino(o: any): o is FieldAmino { + return o && (o.$typeUrl === Field.typeUrl || isSet(o.kind) && isSet(o.cardinality) && typeof o.number === "number" && typeof o.name === "string" && typeof o.type_url === "string" && typeof o.oneof_index === "number" && typeof o.packed === "boolean" && Array.isArray(o.options) && (!o.options.length || Option.isAmino(o.options[0])) && typeof o.json_name === "string" && typeof o.default_value === "string"); + }, encode(message: Field, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.kind !== 0) { writer.uint32(8).int32(message.kind); @@ -1097,6 +1124,12 @@ export const Field = { typeUrl: "/google.protobuf.Field", value: Field.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Field.typeUrl)) { + return; + } + Option.registerTypeUrl(); } }; function createBaseEnum(): Enum { @@ -1116,6 +1149,15 @@ function createBaseEnum(): Enum { */ export const Enum = { typeUrl: "/google.protobuf.Enum", + is(o: any): o is Enum { + return o && (o.$typeUrl === Enum.typeUrl || typeof o.name === "string" && Array.isArray(o.enumvalue) && (!o.enumvalue.length || EnumValue.is(o.enumvalue[0])) && Array.isArray(o.options) && (!o.options.length || Option.is(o.options[0])) && isSet(o.syntax)); + }, + isSDK(o: any): o is EnumSDKType { + return o && (o.$typeUrl === Enum.typeUrl || typeof o.name === "string" && Array.isArray(o.enumvalue) && (!o.enumvalue.length || EnumValue.isSDK(o.enumvalue[0])) && Array.isArray(o.options) && (!o.options.length || Option.isSDK(o.options[0])) && isSet(o.syntax)); + }, + isAmino(o: any): o is EnumAmino { + return o && (o.$typeUrl === Enum.typeUrl || typeof o.name === "string" && Array.isArray(o.enumvalue) && (!o.enumvalue.length || EnumValue.isAmino(o.enumvalue[0])) && Array.isArray(o.options) && (!o.options.length || Option.isAmino(o.options[0])) && isSet(o.syntax)); + }, encode(message: Enum, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -1272,6 +1314,14 @@ export const Enum = { typeUrl: "/google.protobuf.Enum", value: Enum.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Enum.typeUrl)) { + return; + } + EnumValue.registerTypeUrl(); + Option.registerTypeUrl(); + SourceContext.registerTypeUrl(); } }; function createBaseEnumValue(): EnumValue { @@ -1289,6 +1339,15 @@ function createBaseEnumValue(): EnumValue { */ export const EnumValue = { typeUrl: "/google.protobuf.EnumValue", + is(o: any): o is EnumValue { + return o && (o.$typeUrl === EnumValue.typeUrl || typeof o.name === "string" && typeof o.number === "number" && Array.isArray(o.options) && (!o.options.length || Option.is(o.options[0]))); + }, + isSDK(o: any): o is EnumValueSDKType { + return o && (o.$typeUrl === EnumValue.typeUrl || typeof o.name === "string" && typeof o.number === "number" && Array.isArray(o.options) && (!o.options.length || Option.isSDK(o.options[0]))); + }, + isAmino(o: any): o is EnumValueAmino { + return o && (o.$typeUrl === EnumValue.typeUrl || typeof o.name === "string" && typeof o.number === "number" && Array.isArray(o.options) && (!o.options.length || Option.isAmino(o.options[0]))); + }, encode(message: EnumValue, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -1403,6 +1462,12 @@ export const EnumValue = { typeUrl: "/google.protobuf.EnumValue", value: EnumValue.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(EnumValue.typeUrl)) { + return; + } + Option.registerTypeUrl(); } }; function createBaseOption(): Option { @@ -1420,6 +1485,15 @@ function createBaseOption(): Option { */ export const Option = { typeUrl: "/google.protobuf.Option", + is(o: any): o is Option { + return o && (o.$typeUrl === Option.typeUrl || typeof o.name === "string"); + }, + isSDK(o: any): o is OptionSDKType { + return o && (o.$typeUrl === Option.typeUrl || typeof o.name === "string"); + }, + isAmino(o: any): o is OptionAmino { + return o && (o.$typeUrl === Option.typeUrl || typeof o.name === "string"); + }, encode(message: Option, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -1511,5 +1585,6 @@ export const Option = { typeUrl: "/google.protobuf.Option", value: Option.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/google/protobuf/wrappers.ts b/__fixtures__/v-next/outputv2/google/protobuf/wrappers.ts index 49bcc524f6..f652347560 100644 --- a/__fixtures__/v-next/outputv2/google/protobuf/wrappers.ts +++ b/__fixtures__/v-next/outputv2/google/protobuf/wrappers.ts @@ -440,6 +440,15 @@ function createBaseDoubleValue(): DoubleValue { */ export const DoubleValue = { typeUrl: "/google.protobuf.DoubleValue", + is(o: any): o is DoubleValue { + return o && (o.$typeUrl === DoubleValue.typeUrl || typeof o.value === "number"); + }, + isSDK(o: any): o is DoubleValueSDKType { + return o && (o.$typeUrl === DoubleValue.typeUrl || typeof o.value === "number"); + }, + isAmino(o: any): o is DoubleValueAmino { + return o && (o.$typeUrl === DoubleValue.typeUrl || typeof o.value === "number"); + }, encode(message: DoubleValue, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.value !== 0) { writer.uint32(9).double(message.value); @@ -514,7 +523,8 @@ export const DoubleValue = { typeUrl: "/google.protobuf.DoubleValue", value: DoubleValue.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseFloatValue(): FloatValue { return { @@ -531,6 +541,15 @@ function createBaseFloatValue(): FloatValue { */ export const FloatValue = { typeUrl: "/google.protobuf.FloatValue", + is(o: any): o is FloatValue { + return o && (o.$typeUrl === FloatValue.typeUrl || typeof o.value === "number"); + }, + isSDK(o: any): o is FloatValueSDKType { + return o && (o.$typeUrl === FloatValue.typeUrl || typeof o.value === "number"); + }, + isAmino(o: any): o is FloatValueAmino { + return o && (o.$typeUrl === FloatValue.typeUrl || typeof o.value === "number"); + }, encode(message: FloatValue, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.value !== 0) { writer.uint32(13).float(message.value); @@ -605,7 +624,8 @@ export const FloatValue = { typeUrl: "/google.protobuf.FloatValue", value: FloatValue.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseInt64Value(): Int64Value { return { @@ -622,6 +642,15 @@ function createBaseInt64Value(): Int64Value { */ export const Int64Value = { typeUrl: "/google.protobuf.Int64Value", + is(o: any): o is Int64Value { + return o && (o.$typeUrl === Int64Value.typeUrl || typeof o.value === "bigint"); + }, + isSDK(o: any): o is Int64ValueSDKType { + return o && (o.$typeUrl === Int64Value.typeUrl || typeof o.value === "bigint"); + }, + isAmino(o: any): o is Int64ValueAmino { + return o && (o.$typeUrl === Int64Value.typeUrl || typeof o.value === "bigint"); + }, encode(message: Int64Value, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.value !== BigInt(0)) { writer.uint32(8).int64(message.value); @@ -698,7 +727,8 @@ export const Int64Value = { typeUrl: "/google.protobuf.Int64Value", value: Int64Value.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseUInt64Value(): UInt64Value { return { @@ -715,6 +745,15 @@ function createBaseUInt64Value(): UInt64Value { */ export const UInt64Value = { typeUrl: "/google.protobuf.UInt64Value", + is(o: any): o is UInt64Value { + return o && (o.$typeUrl === UInt64Value.typeUrl || typeof o.value === "bigint"); + }, + isSDK(o: any): o is UInt64ValueSDKType { + return o && (o.$typeUrl === UInt64Value.typeUrl || typeof o.value === "bigint"); + }, + isAmino(o: any): o is UInt64ValueAmino { + return o && (o.$typeUrl === UInt64Value.typeUrl || typeof o.value === "bigint"); + }, encode(message: UInt64Value, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.value !== BigInt(0)) { writer.uint32(8).uint64(message.value); @@ -791,7 +830,8 @@ export const UInt64Value = { typeUrl: "/google.protobuf.UInt64Value", value: UInt64Value.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseInt32Value(): Int32Value { return { @@ -808,6 +848,15 @@ function createBaseInt32Value(): Int32Value { */ export const Int32Value = { typeUrl: "/google.protobuf.Int32Value", + is(o: any): o is Int32Value { + return o && (o.$typeUrl === Int32Value.typeUrl || typeof o.value === "number"); + }, + isSDK(o: any): o is Int32ValueSDKType { + return o && (o.$typeUrl === Int32Value.typeUrl || typeof o.value === "number"); + }, + isAmino(o: any): o is Int32ValueAmino { + return o && (o.$typeUrl === Int32Value.typeUrl || typeof o.value === "number"); + }, encode(message: Int32Value, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.value !== 0) { writer.uint32(8).int32(message.value); @@ -882,7 +931,8 @@ export const Int32Value = { typeUrl: "/google.protobuf.Int32Value", value: Int32Value.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseUInt32Value(): UInt32Value { return { @@ -899,6 +949,15 @@ function createBaseUInt32Value(): UInt32Value { */ export const UInt32Value = { typeUrl: "/google.protobuf.UInt32Value", + is(o: any): o is UInt32Value { + return o && (o.$typeUrl === UInt32Value.typeUrl || typeof o.value === "number"); + }, + isSDK(o: any): o is UInt32ValueSDKType { + return o && (o.$typeUrl === UInt32Value.typeUrl || typeof o.value === "number"); + }, + isAmino(o: any): o is UInt32ValueAmino { + return o && (o.$typeUrl === UInt32Value.typeUrl || typeof o.value === "number"); + }, encode(message: UInt32Value, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.value !== 0) { writer.uint32(8).uint32(message.value); @@ -973,7 +1032,8 @@ export const UInt32Value = { typeUrl: "/google.protobuf.UInt32Value", value: UInt32Value.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseBoolValue(): BoolValue { return { @@ -990,6 +1050,15 @@ function createBaseBoolValue(): BoolValue { */ export const BoolValue = { typeUrl: "/google.protobuf.BoolValue", + is(o: any): o is BoolValue { + return o && (o.$typeUrl === BoolValue.typeUrl || typeof o.value === "boolean"); + }, + isSDK(o: any): o is BoolValueSDKType { + return o && (o.$typeUrl === BoolValue.typeUrl || typeof o.value === "boolean"); + }, + isAmino(o: any): o is BoolValueAmino { + return o && (o.$typeUrl === BoolValue.typeUrl || typeof o.value === "boolean"); + }, encode(message: BoolValue, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.value === true) { writer.uint32(8).bool(message.value); @@ -1064,7 +1133,8 @@ export const BoolValue = { typeUrl: "/google.protobuf.BoolValue", value: BoolValue.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseStringValue(): StringValue { return { @@ -1081,6 +1151,15 @@ function createBaseStringValue(): StringValue { */ export const StringValue = { typeUrl: "/google.protobuf.StringValue", + is(o: any): o is StringValue { + return o && (o.$typeUrl === StringValue.typeUrl || typeof o.value === "string"); + }, + isSDK(o: any): o is StringValueSDKType { + return o && (o.$typeUrl === StringValue.typeUrl || typeof o.value === "string"); + }, + isAmino(o: any): o is StringValueAmino { + return o && (o.$typeUrl === StringValue.typeUrl || typeof o.value === "string"); + }, encode(message: StringValue, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.value !== "") { writer.uint32(10).string(message.value); @@ -1155,7 +1234,8 @@ export const StringValue = { typeUrl: "/google.protobuf.StringValue", value: StringValue.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseBytesValue(): BytesValue { return { @@ -1172,6 +1252,15 @@ function createBaseBytesValue(): BytesValue { */ export const BytesValue = { typeUrl: "/google.protobuf.BytesValue", + is(o: any): o is BytesValue { + return o && (o.$typeUrl === BytesValue.typeUrl || o.value instanceof Uint8Array || typeof o.value === "string"); + }, + isSDK(o: any): o is BytesValueSDKType { + return o && (o.$typeUrl === BytesValue.typeUrl || o.value instanceof Uint8Array || typeof o.value === "string"); + }, + isAmino(o: any): o is BytesValueAmino { + return o && (o.$typeUrl === BytesValue.typeUrl || o.value instanceof Uint8Array || typeof o.value === "string"); + }, encode(message: BytesValue, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.value.length !== 0) { writer.uint32(10).bytes(message.value); @@ -1246,5 +1335,6 @@ export const BytesValue = { typeUrl: "/google.protobuf.BytesValue", value: BytesValue.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/google/rpc/context/attribute_context.ts b/__fixtures__/v-next/outputv2/google/rpc/context/attribute_context.ts index 3eed987ea3..db8e11332b 100644 --- a/__fixtures__/v-next/outputv2/google/rpc/context/attribute_context.ts +++ b/__fixtures__/v-next/outputv2/google/rpc/context/attribute_context.ts @@ -3,6 +3,7 @@ import { Timestamp } from "../../protobuf/timestamp"; import { Duration, DurationAmino, DurationSDKType } from "../../protobuf/duration"; import { Any, AnyAmino, AnySDKType } from "../../protobuf/any"; import { BinaryReader, BinaryWriter } from "../../../binary"; +import { GlobalDecoderRegistry } from "../../../registry"; import { isSet, DeepPartial, isObject, toTimestamp, fromTimestamp } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "google.rpc.context"; @@ -1240,6 +1241,15 @@ function createBaseAttributeContext(): AttributeContext { */ export const AttributeContext = { typeUrl: "/google.rpc.context.AttributeContext", + is(o: any): o is AttributeContext { + return o && (o.$typeUrl === AttributeContext.typeUrl || Array.isArray(o.extensions) && (!o.extensions.length || Any.is(o.extensions[0]))); + }, + isSDK(o: any): o is AttributeContextSDKType { + return o && (o.$typeUrl === AttributeContext.typeUrl || Array.isArray(o.extensions) && (!o.extensions.length || Any.isSDK(o.extensions[0]))); + }, + isAmino(o: any): o is AttributeContextAmino { + return o && (o.$typeUrl === AttributeContext.typeUrl || Array.isArray(o.extensions) && (!o.extensions.length || Any.isAmino(o.extensions[0]))); + }, encode(message: AttributeContext, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.origin !== undefined) { AttributeContext_Peer.encode(message.origin, writer.uint32(58).fork()).ldelim(); @@ -1443,7 +1453,8 @@ export const AttributeContext = { typeUrl: "/google.rpc.context.AttributeContext", value: AttributeContext.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseAttributeContext_Peer_LabelsEntry(): AttributeContext_Peer_LabelsEntry { return { @@ -1540,7 +1551,8 @@ export const AttributeContext_Peer_LabelsEntry = { }, toProto(message: AttributeContext_Peer_LabelsEntry): Uint8Array { return AttributeContext_Peer_LabelsEntry.encode(message).finish(); - } + }, + registerTypeUrl() {} }; function createBaseAttributeContext_Peer(): AttributeContext_Peer { return { @@ -1562,6 +1574,15 @@ function createBaseAttributeContext_Peer(): AttributeContext_Peer { */ export const AttributeContext_Peer = { typeUrl: "/google.rpc.context.Peer", + is(o: any): o is AttributeContext_Peer { + return o && (o.$typeUrl === AttributeContext_Peer.typeUrl || typeof o.ip === "string" && typeof o.port === "bigint" && isSet(o.labels) && typeof o.principal === "string" && typeof o.regionCode === "string"); + }, + isSDK(o: any): o is AttributeContext_PeerSDKType { + return o && (o.$typeUrl === AttributeContext_Peer.typeUrl || typeof o.ip === "string" && typeof o.port === "bigint" && isSet(o.labels) && typeof o.principal === "string" && typeof o.region_code === "string"); + }, + isAmino(o: any): o is AttributeContext_PeerAmino { + return o && (o.$typeUrl === AttributeContext_Peer.typeUrl || typeof o.ip === "string" && typeof o.port === "bigint" && isSet(o.labels) && typeof o.principal === "string" && typeof o.region_code === "string"); + }, encode(message: AttributeContext_Peer, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.ip !== "") { writer.uint32(10).string(message.ip); @@ -1741,7 +1762,8 @@ export const AttributeContext_Peer = { typeUrl: "/google.rpc.context.Peer", value: AttributeContext_Peer.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseAttributeContext_Api(): AttributeContext_Api { return { @@ -1761,6 +1783,15 @@ function createBaseAttributeContext_Api(): AttributeContext_Api { */ export const AttributeContext_Api = { typeUrl: "/google.rpc.context.Api", + is(o: any): o is AttributeContext_Api { + return o && (o.$typeUrl === AttributeContext_Api.typeUrl || typeof o.service === "string" && typeof o.operation === "string" && typeof o.protocol === "string" && typeof o.version === "string"); + }, + isSDK(o: any): o is AttributeContext_ApiSDKType { + return o && (o.$typeUrl === AttributeContext_Api.typeUrl || typeof o.service === "string" && typeof o.operation === "string" && typeof o.protocol === "string" && typeof o.version === "string"); + }, + isAmino(o: any): o is AttributeContext_ApiAmino { + return o && (o.$typeUrl === AttributeContext_Api.typeUrl || typeof o.service === "string" && typeof o.operation === "string" && typeof o.protocol === "string" && typeof o.version === "string"); + }, encode(message: AttributeContext_Api, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.service !== "") { writer.uint32(10).string(message.service); @@ -1880,7 +1911,8 @@ export const AttributeContext_Api = { typeUrl: "/google.rpc.context.Api", value: AttributeContext_Api.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseAttributeContext_Auth(): AttributeContext_Auth { return { @@ -1901,6 +1933,15 @@ function createBaseAttributeContext_Auth(): AttributeContext_Auth { */ export const AttributeContext_Auth = { typeUrl: "/google.rpc.context.Auth", + is(o: any): o is AttributeContext_Auth { + return o && (o.$typeUrl === AttributeContext_Auth.typeUrl || typeof o.principal === "string" && Array.isArray(o.audiences) && (!o.audiences.length || typeof o.audiences[0] === "string") && typeof o.presenter === "string" && Array.isArray(o.accessLevels) && (!o.accessLevels.length || typeof o.accessLevels[0] === "string")); + }, + isSDK(o: any): o is AttributeContext_AuthSDKType { + return o && (o.$typeUrl === AttributeContext_Auth.typeUrl || typeof o.principal === "string" && Array.isArray(o.audiences) && (!o.audiences.length || typeof o.audiences[0] === "string") && typeof o.presenter === "string" && Array.isArray(o.access_levels) && (!o.access_levels.length || typeof o.access_levels[0] === "string")); + }, + isAmino(o: any): o is AttributeContext_AuthAmino { + return o && (o.$typeUrl === AttributeContext_Auth.typeUrl || typeof o.principal === "string" && Array.isArray(o.audiences) && (!o.audiences.length || typeof o.audiences[0] === "string") && typeof o.presenter === "string" && Array.isArray(o.access_levels) && (!o.access_levels.length || typeof o.access_levels[0] === "string")); + }, encode(message: AttributeContext_Auth, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.principal !== "") { writer.uint32(10).string(message.principal); @@ -2057,6 +2098,12 @@ export const AttributeContext_Auth = { typeUrl: "/google.rpc.context.Auth", value: AttributeContext_Auth.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(AttributeContext_Auth.typeUrl)) { + return; + } + Struct.registerTypeUrl(); } }; function createBaseAttributeContext_Request_HeadersEntry(): AttributeContext_Request_HeadersEntry { @@ -2154,7 +2201,8 @@ export const AttributeContext_Request_HeadersEntry = { }, toProto(message: AttributeContext_Request_HeadersEntry): Uint8Array { return AttributeContext_Request_HeadersEntry.encode(message).finish(); - } + }, + registerTypeUrl() {} }; function createBaseAttributeContext_Request(): AttributeContext_Request { return { @@ -2182,6 +2230,15 @@ function createBaseAttributeContext_Request(): AttributeContext_Request { */ export const AttributeContext_Request = { typeUrl: "/google.rpc.context.Request", + is(o: any): o is AttributeContext_Request { + return o && (o.$typeUrl === AttributeContext_Request.typeUrl || typeof o.id === "string" && typeof o.method === "string" && isSet(o.headers) && typeof o.path === "string" && typeof o.host === "string" && typeof o.scheme === "string" && typeof o.query === "string" && typeof o.size === "bigint" && typeof o.protocol === "string" && typeof o.reason === "string"); + }, + isSDK(o: any): o is AttributeContext_RequestSDKType { + return o && (o.$typeUrl === AttributeContext_Request.typeUrl || typeof o.id === "string" && typeof o.method === "string" && isSet(o.headers) && typeof o.path === "string" && typeof o.host === "string" && typeof o.scheme === "string" && typeof o.query === "string" && typeof o.size === "bigint" && typeof o.protocol === "string" && typeof o.reason === "string"); + }, + isAmino(o: any): o is AttributeContext_RequestAmino { + return o && (o.$typeUrl === AttributeContext_Request.typeUrl || typeof o.id === "string" && typeof o.method === "string" && isSet(o.headers) && typeof o.path === "string" && typeof o.host === "string" && typeof o.scheme === "string" && typeof o.query === "string" && typeof o.size === "bigint" && typeof o.protocol === "string" && typeof o.reason === "string"); + }, encode(message: AttributeContext_Request, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.id !== "") { writer.uint32(10).string(message.id); @@ -2468,6 +2525,12 @@ export const AttributeContext_Request = { typeUrl: "/google.rpc.context.Request", value: AttributeContext_Request.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(AttributeContext_Request.typeUrl)) { + return; + } + AttributeContext_Auth.registerTypeUrl(); } }; function createBaseAttributeContext_Response_HeadersEntry(): AttributeContext_Response_HeadersEntry { @@ -2565,7 +2628,8 @@ export const AttributeContext_Response_HeadersEntry = { }, toProto(message: AttributeContext_Response_HeadersEntry): Uint8Array { return AttributeContext_Response_HeadersEntry.encode(message).finish(); - } + }, + registerTypeUrl() {} }; function createBaseAttributeContext_Response(): AttributeContext_Response { return { @@ -2585,6 +2649,15 @@ function createBaseAttributeContext_Response(): AttributeContext_Response { */ export const AttributeContext_Response = { typeUrl: "/google.rpc.context.Response", + is(o: any): o is AttributeContext_Response { + return o && (o.$typeUrl === AttributeContext_Response.typeUrl || typeof o.code === "bigint" && typeof o.size === "bigint" && isSet(o.headers)); + }, + isSDK(o: any): o is AttributeContext_ResponseSDKType { + return o && (o.$typeUrl === AttributeContext_Response.typeUrl || typeof o.code === "bigint" && typeof o.size === "bigint" && isSet(o.headers)); + }, + isAmino(o: any): o is AttributeContext_ResponseAmino { + return o && (o.$typeUrl === AttributeContext_Response.typeUrl || typeof o.code === "bigint" && typeof o.size === "bigint" && isSet(o.headers)); + }, encode(message: AttributeContext_Response, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.code !== BigInt(0)) { writer.uint32(8).int64(message.code); @@ -2768,7 +2841,8 @@ export const AttributeContext_Response = { typeUrl: "/google.rpc.context.Response", value: AttributeContext_Response.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseAttributeContext_Resource_LabelsEntry(): AttributeContext_Resource_LabelsEntry { return { @@ -2865,7 +2939,8 @@ export const AttributeContext_Resource_LabelsEntry = { }, toProto(message: AttributeContext_Resource_LabelsEntry): Uint8Array { return AttributeContext_Resource_LabelsEntry.encode(message).finish(); - } + }, + registerTypeUrl() {} }; function createBaseAttributeContext_Resource_AnnotationsEntry(): AttributeContext_Resource_AnnotationsEntry { return { @@ -2962,7 +3037,8 @@ export const AttributeContext_Resource_AnnotationsEntry = { }, toProto(message: AttributeContext_Resource_AnnotationsEntry): Uint8Array { return AttributeContext_Resource_AnnotationsEntry.encode(message).finish(); - } + }, + registerTypeUrl() {} }; function createBaseAttributeContext_Resource(): AttributeContext_Resource { return { @@ -2990,6 +3066,15 @@ function createBaseAttributeContext_Resource(): AttributeContext_Resource { */ export const AttributeContext_Resource = { typeUrl: "/google.rpc.context.Resource", + is(o: any): o is AttributeContext_Resource { + return o && (o.$typeUrl === AttributeContext_Resource.typeUrl || typeof o.service === "string" && typeof o.name === "string" && typeof o.type === "string" && isSet(o.labels) && typeof o.uid === "string" && isSet(o.annotations) && typeof o.displayName === "string" && typeof o.etag === "string" && typeof o.location === "string"); + }, + isSDK(o: any): o is AttributeContext_ResourceSDKType { + return o && (o.$typeUrl === AttributeContext_Resource.typeUrl || typeof o.service === "string" && typeof o.name === "string" && typeof o.type === "string" && isSet(o.labels) && typeof o.uid === "string" && isSet(o.annotations) && typeof o.display_name === "string" && typeof o.etag === "string" && typeof o.location === "string"); + }, + isAmino(o: any): o is AttributeContext_ResourceAmino { + return o && (o.$typeUrl === AttributeContext_Resource.typeUrl || typeof o.service === "string" && typeof o.name === "string" && typeof o.type === "string" && isSet(o.labels) && typeof o.uid === "string" && isSet(o.annotations) && typeof o.display_name === "string" && typeof o.etag === "string" && typeof o.location === "string"); + }, encode(message: AttributeContext_Resource, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.service !== "") { writer.uint32(10).string(message.service); @@ -3315,5 +3400,6 @@ export const AttributeContext_Resource = { typeUrl: "/google.rpc.context.Resource", value: AttributeContext_Resource.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/google/rpc/error_details.ts b/__fixtures__/v-next/outputv2/google/rpc/error_details.ts index b20567214f..b020ad6f40 100644 --- a/__fixtures__/v-next/outputv2/google/rpc/error_details.ts +++ b/__fixtures__/v-next/outputv2/google/rpc/error_details.ts @@ -1,5 +1,6 @@ import { Duration, DurationAmino, DurationSDKType } from "../protobuf/duration"; import { BinaryReader, BinaryWriter } from "../../binary"; +import { GlobalDecoderRegistry } from "../../registry"; import { isSet, DeepPartial, isObject } from "../../helpers"; import { JsonSafe } from "../../json-safe"; export const protobufPackage = "google.rpc"; @@ -1019,6 +1020,15 @@ function createBaseRetryInfo(): RetryInfo { */ export const RetryInfo = { typeUrl: "/google.rpc.RetryInfo", + is(o: any): o is RetryInfo { + return o && o.$typeUrl === RetryInfo.typeUrl; + }, + isSDK(o: any): o is RetryInfoSDKType { + return o && o.$typeUrl === RetryInfo.typeUrl; + }, + isAmino(o: any): o is RetryInfoAmino { + return o && o.$typeUrl === RetryInfo.typeUrl; + }, encode(message: RetryInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.retryDelay !== undefined) { Duration.encode(message.retryDelay, writer.uint32(10).fork()).ldelim(); @@ -1095,7 +1105,8 @@ export const RetryInfo = { typeUrl: "/google.rpc.RetryInfo", value: RetryInfo.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseDebugInfo(): DebugInfo { return { @@ -1111,6 +1122,15 @@ function createBaseDebugInfo(): DebugInfo { */ export const DebugInfo = { typeUrl: "/google.rpc.DebugInfo", + is(o: any): o is DebugInfo { + return o && (o.$typeUrl === DebugInfo.typeUrl || Array.isArray(o.stackEntries) && (!o.stackEntries.length || typeof o.stackEntries[0] === "string") && typeof o.detail === "string"); + }, + isSDK(o: any): o is DebugInfoSDKType { + return o && (o.$typeUrl === DebugInfo.typeUrl || Array.isArray(o.stack_entries) && (!o.stack_entries.length || typeof o.stack_entries[0] === "string") && typeof o.detail === "string"); + }, + isAmino(o: any): o is DebugInfoAmino { + return o && (o.$typeUrl === DebugInfo.typeUrl || Array.isArray(o.stack_entries) && (!o.stack_entries.length || typeof o.stack_entries[0] === "string") && typeof o.detail === "string"); + }, encode(message: DebugInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.stackEntries) { writer.uint32(10).string(v!); @@ -1210,7 +1230,8 @@ export const DebugInfo = { typeUrl: "/google.rpc.DebugInfo", value: DebugInfo.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQuotaFailure(): QuotaFailure { return { @@ -1235,6 +1256,15 @@ function createBaseQuotaFailure(): QuotaFailure { */ export const QuotaFailure = { typeUrl: "/google.rpc.QuotaFailure", + is(o: any): o is QuotaFailure { + return o && (o.$typeUrl === QuotaFailure.typeUrl || Array.isArray(o.violations) && (!o.violations.length || QuotaFailure_Violation.is(o.violations[0]))); + }, + isSDK(o: any): o is QuotaFailureSDKType { + return o && (o.$typeUrl === QuotaFailure.typeUrl || Array.isArray(o.violations) && (!o.violations.length || QuotaFailure_Violation.isSDK(o.violations[0]))); + }, + isAmino(o: any): o is QuotaFailureAmino { + return o && (o.$typeUrl === QuotaFailure.typeUrl || Array.isArray(o.violations) && (!o.violations.length || QuotaFailure_Violation.isAmino(o.violations[0]))); + }, encode(message: QuotaFailure, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.violations) { QuotaFailure_Violation.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -1319,6 +1349,12 @@ export const QuotaFailure = { typeUrl: "/google.rpc.QuotaFailure", value: QuotaFailure.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QuotaFailure.typeUrl)) { + return; + } + QuotaFailure_Violation.registerTypeUrl(); } }; function createBaseQuotaFailure_Violation(): QuotaFailure_Violation { @@ -1336,6 +1372,15 @@ function createBaseQuotaFailure_Violation(): QuotaFailure_Violation { */ export const QuotaFailure_Violation = { typeUrl: "/google.rpc.Violation", + is(o: any): o is QuotaFailure_Violation { + return o && (o.$typeUrl === QuotaFailure_Violation.typeUrl || typeof o.subject === "string" && typeof o.description === "string"); + }, + isSDK(o: any): o is QuotaFailure_ViolationSDKType { + return o && (o.$typeUrl === QuotaFailure_Violation.typeUrl || typeof o.subject === "string" && typeof o.description === "string"); + }, + isAmino(o: any): o is QuotaFailure_ViolationAmino { + return o && (o.$typeUrl === QuotaFailure_Violation.typeUrl || typeof o.subject === "string" && typeof o.description === "string"); + }, encode(message: QuotaFailure_Violation, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.subject !== "") { writer.uint32(10).string(message.subject); @@ -1425,7 +1470,8 @@ export const QuotaFailure_Violation = { typeUrl: "/google.rpc.Violation", value: QuotaFailure_Violation.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseErrorInfo_MetadataEntry(): ErrorInfo_MetadataEntry { return { @@ -1522,7 +1568,8 @@ export const ErrorInfo_MetadataEntry = { }, toProto(message: ErrorInfo_MetadataEntry): Uint8Array { return ErrorInfo_MetadataEntry.encode(message).finish(); - } + }, + registerTypeUrl() {} }; function createBaseErrorInfo(): ErrorInfo { return { @@ -1562,6 +1609,15 @@ function createBaseErrorInfo(): ErrorInfo { */ export const ErrorInfo = { typeUrl: "/google.rpc.ErrorInfo", + is(o: any): o is ErrorInfo { + return o && (o.$typeUrl === ErrorInfo.typeUrl || typeof o.reason === "string" && typeof o.domain === "string" && isSet(o.metadata)); + }, + isSDK(o: any): o is ErrorInfoSDKType { + return o && (o.$typeUrl === ErrorInfo.typeUrl || typeof o.reason === "string" && typeof o.domain === "string" && isSet(o.metadata)); + }, + isAmino(o: any): o is ErrorInfoAmino { + return o && (o.$typeUrl === ErrorInfo.typeUrl || typeof o.reason === "string" && typeof o.domain === "string" && isSet(o.metadata)); + }, encode(message: ErrorInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.reason !== "") { writer.uint32(10).string(message.reason); @@ -1709,7 +1765,8 @@ export const ErrorInfo = { typeUrl: "/google.rpc.ErrorInfo", value: ErrorInfo.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBasePreconditionFailure(): PreconditionFailure { return { @@ -1728,6 +1785,15 @@ function createBasePreconditionFailure(): PreconditionFailure { */ export const PreconditionFailure = { typeUrl: "/google.rpc.PreconditionFailure", + is(o: any): o is PreconditionFailure { + return o && (o.$typeUrl === PreconditionFailure.typeUrl || Array.isArray(o.violations) && (!o.violations.length || PreconditionFailure_Violation.is(o.violations[0]))); + }, + isSDK(o: any): o is PreconditionFailureSDKType { + return o && (o.$typeUrl === PreconditionFailure.typeUrl || Array.isArray(o.violations) && (!o.violations.length || PreconditionFailure_Violation.isSDK(o.violations[0]))); + }, + isAmino(o: any): o is PreconditionFailureAmino { + return o && (o.$typeUrl === PreconditionFailure.typeUrl || Array.isArray(o.violations) && (!o.violations.length || PreconditionFailure_Violation.isAmino(o.violations[0]))); + }, encode(message: PreconditionFailure, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.violations) { PreconditionFailure_Violation.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -1812,6 +1878,12 @@ export const PreconditionFailure = { typeUrl: "/google.rpc.PreconditionFailure", value: PreconditionFailure.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(PreconditionFailure.typeUrl)) { + return; + } + PreconditionFailure_Violation.registerTypeUrl(); } }; function createBasePreconditionFailure_Violation(): PreconditionFailure_Violation { @@ -1829,6 +1901,15 @@ function createBasePreconditionFailure_Violation(): PreconditionFailure_Violatio */ export const PreconditionFailure_Violation = { typeUrl: "/google.rpc.Violation", + is(o: any): o is PreconditionFailure_Violation { + return o && (o.$typeUrl === PreconditionFailure_Violation.typeUrl || typeof o.type === "string" && typeof o.subject === "string" && typeof o.description === "string"); + }, + isSDK(o: any): o is PreconditionFailure_ViolationSDKType { + return o && (o.$typeUrl === PreconditionFailure_Violation.typeUrl || typeof o.type === "string" && typeof o.subject === "string" && typeof o.description === "string"); + }, + isAmino(o: any): o is PreconditionFailure_ViolationAmino { + return o && (o.$typeUrl === PreconditionFailure_Violation.typeUrl || typeof o.type === "string" && typeof o.subject === "string" && typeof o.description === "string"); + }, encode(message: PreconditionFailure_Violation, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.type !== "") { writer.uint32(10).string(message.type); @@ -1933,7 +2014,8 @@ export const PreconditionFailure_Violation = { typeUrl: "/google.rpc.Violation", value: PreconditionFailure_Violation.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseBadRequest(): BadRequest { return { @@ -1949,6 +2031,15 @@ function createBaseBadRequest(): BadRequest { */ export const BadRequest = { typeUrl: "/google.rpc.BadRequest", + is(o: any): o is BadRequest { + return o && (o.$typeUrl === BadRequest.typeUrl || Array.isArray(o.fieldViolations) && (!o.fieldViolations.length || BadRequest_FieldViolation.is(o.fieldViolations[0]))); + }, + isSDK(o: any): o is BadRequestSDKType { + return o && (o.$typeUrl === BadRequest.typeUrl || Array.isArray(o.field_violations) && (!o.field_violations.length || BadRequest_FieldViolation.isSDK(o.field_violations[0]))); + }, + isAmino(o: any): o is BadRequestAmino { + return o && (o.$typeUrl === BadRequest.typeUrl || Array.isArray(o.field_violations) && (!o.field_violations.length || BadRequest_FieldViolation.isAmino(o.field_violations[0]))); + }, encode(message: BadRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.fieldViolations) { BadRequest_FieldViolation.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -2033,6 +2124,12 @@ export const BadRequest = { typeUrl: "/google.rpc.BadRequest", value: BadRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(BadRequest.typeUrl)) { + return; + } + BadRequest_FieldViolation.registerTypeUrl(); } }; function createBaseBadRequest_FieldViolation(): BadRequest_FieldViolation { @@ -2049,6 +2146,15 @@ function createBaseBadRequest_FieldViolation(): BadRequest_FieldViolation { */ export const BadRequest_FieldViolation = { typeUrl: "/google.rpc.FieldViolation", + is(o: any): o is BadRequest_FieldViolation { + return o && (o.$typeUrl === BadRequest_FieldViolation.typeUrl || typeof o.field === "string" && typeof o.description === "string"); + }, + isSDK(o: any): o is BadRequest_FieldViolationSDKType { + return o && (o.$typeUrl === BadRequest_FieldViolation.typeUrl || typeof o.field === "string" && typeof o.description === "string"); + }, + isAmino(o: any): o is BadRequest_FieldViolationAmino { + return o && (o.$typeUrl === BadRequest_FieldViolation.typeUrl || typeof o.field === "string" && typeof o.description === "string"); + }, encode(message: BadRequest_FieldViolation, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.field !== "") { writer.uint32(10).string(message.field); @@ -2138,7 +2244,8 @@ export const BadRequest_FieldViolation = { typeUrl: "/google.rpc.FieldViolation", value: BadRequest_FieldViolation.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseRequestInfo(): RequestInfo { return { @@ -2155,6 +2262,15 @@ function createBaseRequestInfo(): RequestInfo { */ export const RequestInfo = { typeUrl: "/google.rpc.RequestInfo", + is(o: any): o is RequestInfo { + return o && (o.$typeUrl === RequestInfo.typeUrl || typeof o.requestId === "string" && typeof o.servingData === "string"); + }, + isSDK(o: any): o is RequestInfoSDKType { + return o && (o.$typeUrl === RequestInfo.typeUrl || typeof o.request_id === "string" && typeof o.serving_data === "string"); + }, + isAmino(o: any): o is RequestInfoAmino { + return o && (o.$typeUrl === RequestInfo.typeUrl || typeof o.request_id === "string" && typeof o.serving_data === "string"); + }, encode(message: RequestInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.requestId !== "") { writer.uint32(10).string(message.requestId); @@ -2244,7 +2360,8 @@ export const RequestInfo = { typeUrl: "/google.rpc.RequestInfo", value: RequestInfo.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseResourceInfo(): ResourceInfo { return { @@ -2262,6 +2379,15 @@ function createBaseResourceInfo(): ResourceInfo { */ export const ResourceInfo = { typeUrl: "/google.rpc.ResourceInfo", + is(o: any): o is ResourceInfo { + return o && (o.$typeUrl === ResourceInfo.typeUrl || typeof o.resourceType === "string" && typeof o.resourceName === "string" && typeof o.owner === "string" && typeof o.description === "string"); + }, + isSDK(o: any): o is ResourceInfoSDKType { + return o && (o.$typeUrl === ResourceInfo.typeUrl || typeof o.resource_type === "string" && typeof o.resource_name === "string" && typeof o.owner === "string" && typeof o.description === "string"); + }, + isAmino(o: any): o is ResourceInfoAmino { + return o && (o.$typeUrl === ResourceInfo.typeUrl || typeof o.resource_type === "string" && typeof o.resource_name === "string" && typeof o.owner === "string" && typeof o.description === "string"); + }, encode(message: ResourceInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.resourceType !== "") { writer.uint32(10).string(message.resourceType); @@ -2381,7 +2507,8 @@ export const ResourceInfo = { typeUrl: "/google.rpc.ResourceInfo", value: ResourceInfo.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseHelp(): Help { return { @@ -2400,6 +2527,15 @@ function createBaseHelp(): Help { */ export const Help = { typeUrl: "/google.rpc.Help", + is(o: any): o is Help { + return o && (o.$typeUrl === Help.typeUrl || Array.isArray(o.links) && (!o.links.length || Help_Link.is(o.links[0]))); + }, + isSDK(o: any): o is HelpSDKType { + return o && (o.$typeUrl === Help.typeUrl || Array.isArray(o.links) && (!o.links.length || Help_Link.isSDK(o.links[0]))); + }, + isAmino(o: any): o is HelpAmino { + return o && (o.$typeUrl === Help.typeUrl || Array.isArray(o.links) && (!o.links.length || Help_Link.isAmino(o.links[0]))); + }, encode(message: Help, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.links) { Help_Link.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -2484,6 +2620,12 @@ export const Help = { typeUrl: "/google.rpc.Help", value: Help.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Help.typeUrl)) { + return; + } + Help_Link.registerTypeUrl(); } }; function createBaseHelp_Link(): Help_Link { @@ -2500,6 +2642,15 @@ function createBaseHelp_Link(): Help_Link { */ export const Help_Link = { typeUrl: "/google.rpc.Link", + is(o: any): o is Help_Link { + return o && (o.$typeUrl === Help_Link.typeUrl || typeof o.description === "string" && typeof o.url === "string"); + }, + isSDK(o: any): o is Help_LinkSDKType { + return o && (o.$typeUrl === Help_Link.typeUrl || typeof o.description === "string" && typeof o.url === "string"); + }, + isAmino(o: any): o is Help_LinkAmino { + return o && (o.$typeUrl === Help_Link.typeUrl || typeof o.description === "string" && typeof o.url === "string"); + }, encode(message: Help_Link, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.description !== "") { writer.uint32(10).string(message.description); @@ -2589,7 +2740,8 @@ export const Help_Link = { typeUrl: "/google.rpc.Link", value: Help_Link.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseLocalizedMessage(): LocalizedMessage { return { @@ -2606,6 +2758,15 @@ function createBaseLocalizedMessage(): LocalizedMessage { */ export const LocalizedMessage = { typeUrl: "/google.rpc.LocalizedMessage", + is(o: any): o is LocalizedMessage { + return o && (o.$typeUrl === LocalizedMessage.typeUrl || typeof o.locale === "string" && typeof o.message === "string"); + }, + isSDK(o: any): o is LocalizedMessageSDKType { + return o && (o.$typeUrl === LocalizedMessage.typeUrl || typeof o.locale === "string" && typeof o.message === "string"); + }, + isAmino(o: any): o is LocalizedMessageAmino { + return o && (o.$typeUrl === LocalizedMessage.typeUrl || typeof o.locale === "string" && typeof o.message === "string"); + }, encode(message: LocalizedMessage, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.locale !== "") { writer.uint32(10).string(message.locale); @@ -2695,5 +2856,6 @@ export const LocalizedMessage = { typeUrl: "/google.rpc.LocalizedMessage", value: LocalizedMessage.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/google/rpc/status.ts b/__fixtures__/v-next/outputv2/google/rpc/status.ts index ee4cf2a46a..f7610f59a0 100644 --- a/__fixtures__/v-next/outputv2/google/rpc/status.ts +++ b/__fixtures__/v-next/outputv2/google/rpc/status.ts @@ -107,6 +107,15 @@ function createBaseStatus(): Status { */ export const Status = { typeUrl: "/google.rpc.Status", + is(o: any): o is Status { + return o && (o.$typeUrl === Status.typeUrl || typeof o.code === "number" && typeof o.message === "string" && Array.isArray(o.details) && (!o.details.length || Any.is(o.details[0]))); + }, + isSDK(o: any): o is StatusSDKType { + return o && (o.$typeUrl === Status.typeUrl || typeof o.code === "number" && typeof o.message === "string" && Array.isArray(o.details) && (!o.details.length || Any.isSDK(o.details[0]))); + }, + isAmino(o: any): o is StatusAmino { + return o && (o.$typeUrl === Status.typeUrl || typeof o.code === "number" && typeof o.message === "string" && Array.isArray(o.details) && (!o.details.length || Any.isAmino(o.details[0]))); + }, encode(message: Status, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.code !== 0) { writer.uint32(8).int32(message.code); @@ -221,5 +230,6 @@ export const Status = { typeUrl: "/google.rpc.Status", value: Status.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/helper-func-types.ts b/__fixtures__/v-next/outputv2/helper-func-types.ts new file mode 100644 index 0000000000..3102611da1 --- /dev/null +++ b/__fixtures__/v-next/outputv2/helper-func-types.ts @@ -0,0 +1,105 @@ +/** +* This file and any referenced files were automatically generated by @hyperweb/telescope@latest +* DO NOT MODIFY BY HAND. Instead, download the latest proto files for your chain +* and run the transpile command or npm scripts command that is used to regenerate this bundle. +*/ + + +import { HttpEndpoint } from "@interchainjs/types"; +import { BinaryReader, BinaryWriter } from "./binary"; +import { getRpcClient } from "./extern"; +import { isRpc, Rpc } from "./helpers"; +import { TelescopeGeneratedCodec, DeliverTxResponse, Message, StdFee } from "./types"; +import { toConverters, toEncoders } from "@interchainjs/cosmos/utils"; +import { ISigningClient } from "@interchainjs/cosmos/types/signing-client"; + +export interface QueryBuilderOptions { + encode: (request: TReq, writer?: BinaryWriter) => BinaryWriter + decode: (input: BinaryReader | Uint8Array, length?: number) => TRes + service: string, + method: string, + deps?: TelescopeGeneratedCodec[], +} + +export function buildQuery(opts: QueryBuilderOptions) { + registerDependencies(opts.deps ?? []); + + return async (client: EndpointOrRpc, request: TReq) => { + let rpc: Rpc | undefined; + + if(isRpc(client)) { + rpc = client; + } else { + rpc = client ? await getRpcClient(client) : undefined; + } + + if (!rpc) throw new Error("Query Rpc is not initialized"); + + const data = opts.encode(request).finish(); + const response = await rpc.request(opts.service, opts.method, data); + return opts.decode(response); + }; +} + +export interface ITxArgs { + signerAddress: string; + message: TMsg | TMsg[]; + fee: StdFee | 'auto'; + memo: string; +} + +export interface TxBuilderOptions { + msg: TelescopeGeneratedCodec +} + +export function buildTx(opts: TxBuilderOptions) { + if(opts.msg){ + registerDependencies([opts.msg]); + } + + return async ( + client: ISigningClient, + signerAddress: string, + message: TMsg | TMsg[], + fee: StdFee | 'auto', + memo: string + ): Promise => { + if (!client) throw new Error("SigningClient is not initialized"); + + //register all related encoders and converters + client.addEncoders?.(toEncoders(opts.msg)); + client.addConverters?.(toConverters(opts.msg)); + + const data = Array.isArray(message) + ? message.map(msg => ({ + typeUrl: opts.msg.typeUrl, + value: msg, + })) + : [{ + typeUrl: opts.msg.typeUrl, + value: message, + }]; + return client.signAndBroadcast!(signerAddress, data, fee, memo); + }; +} + +export interface Encoder { + typeUrl: string; + fromPartial: (data: any) => any; + encode: (data: any) => Uint8Array; +} + +export interface AminoConverter { + typeUrl: string; + aminoType: string; + fromAmino: (data: any) => any; + toAmino: (data: any) => any; +} + +export type EndpointOrRpc = string | HttpEndpoint | Rpc ; + +function registerDependencies(deps: TelescopeGeneratedCodec[]) { + for (const dep of deps) { + dep.registerTypeUrl?.(); + } +} diff --git a/__fixtures__/v-next/outputv2/ibc/applications/transfer/v1/genesis.ts b/__fixtures__/v-next/outputv2/ibc/applications/transfer/v1/genesis.ts index 45ed06a342..691d694685 100644 --- a/__fixtures__/v-next/outputv2/ibc/applications/transfer/v1/genesis.ts +++ b/__fixtures__/v-next/outputv2/ibc/applications/transfer/v1/genesis.ts @@ -1,5 +1,6 @@ import { DenomTrace, DenomTraceAmino, DenomTraceSDKType, Params, ParamsAmino, ParamsSDKType } from "./transfer"; import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { GlobalDecoderRegistry } from "../../../../registry"; import { isSet, DeepPartial } from "../../../../helpers"; import { JsonSafe } from "../../../../json-safe"; export const protobufPackage = "ibc.applications.transfer.v1"; @@ -60,6 +61,15 @@ function createBaseGenesisState(): GenesisState { export const GenesisState = { typeUrl: "/ibc.applications.transfer.v1.GenesisState", aminoType: "cosmos-sdk/GenesisState", + is(o: any): o is GenesisState { + return o && (o.$typeUrl === GenesisState.typeUrl || typeof o.portId === "string" && Array.isArray(o.denomTraces) && (!o.denomTraces.length || DenomTrace.is(o.denomTraces[0])) && Params.is(o.params)); + }, + isSDK(o: any): o is GenesisStateSDKType { + return o && (o.$typeUrl === GenesisState.typeUrl || typeof o.port_id === "string" && Array.isArray(o.denom_traces) && (!o.denom_traces.length || DenomTrace.isSDK(o.denom_traces[0])) && Params.isSDK(o.params)); + }, + isAmino(o: any): o is GenesisStateAmino { + return o && (o.$typeUrl === GenesisState.typeUrl || typeof o.port_id === "string" && Array.isArray(o.denom_traces) && (!o.denom_traces.length || DenomTrace.isAmino(o.denom_traces[0])) && Params.isAmino(o.params)); + }, encode(message: GenesisState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.portId !== "") { writer.uint32(10).string(message.portId); @@ -182,5 +192,12 @@ export const GenesisState = { typeUrl: "/ibc.applications.transfer.v1.GenesisState", value: GenesisState.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GenesisState.typeUrl)) { + return; + } + DenomTrace.registerTypeUrl(); + Params.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/ibc/applications/transfer/v1/query.rpc.func.ts b/__fixtures__/v-next/outputv2/ibc/applications/transfer/v1/query.rpc.func.ts new file mode 100644 index 0000000000..c546f7b6d2 --- /dev/null +++ b/__fixtures__/v-next/outputv2/ibc/applications/transfer/v1/query.rpc.func.ts @@ -0,0 +1,41 @@ +import { buildQuery } from "../../../../helper-func-types"; +import { QueryDenomTraceRequest, QueryDenomTraceResponse, QueryDenomTracesRequest, QueryDenomTracesResponse, QueryParamsRequest, QueryParamsResponse } from "./query"; +/** + * DenomTrace queries a denomination trace information. + * @name getDenomTrace + * @package ibc.applications.transfer.v1 + * @see proto service: ibc.applications.transfer.v1.DenomTrace + */ +export const getDenomTrace = buildQuery({ + encode: QueryDenomTraceRequest.encode, + decode: QueryDenomTraceResponse.decode, + service: "ibc.applications.transfer.v1.Query", + method: "DenomTrace", + deps: [QueryDenomTraceRequest, QueryDenomTraceResponse] +}); +/** + * DenomTraces queries all denomination traces. + * @name getDenomTraces + * @package ibc.applications.transfer.v1 + * @see proto service: ibc.applications.transfer.v1.DenomTraces + */ +export const getDenomTraces = buildQuery({ + encode: QueryDenomTracesRequest.encode, + decode: QueryDenomTracesResponse.decode, + service: "ibc.applications.transfer.v1.Query", + method: "DenomTraces", + deps: [QueryDenomTracesRequest, QueryDenomTracesResponse] +}); +/** + * Params queries all parameters of the ibc-transfer module. + * @name getParams + * @package ibc.applications.transfer.v1 + * @see proto service: ibc.applications.transfer.v1.Params + */ +export const getParams = buildQuery({ + encode: QueryParamsRequest.encode, + decode: QueryParamsResponse.decode, + service: "ibc.applications.transfer.v1.Query", + method: "Params", + deps: [QueryParamsRequest, QueryParamsResponse] +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/ibc/applications/transfer/v1/query.ts b/__fixtures__/v-next/outputv2/ibc/applications/transfer/v1/query.ts index c959838369..984985556f 100644 --- a/__fixtures__/v-next/outputv2/ibc/applications/transfer/v1/query.ts +++ b/__fixtures__/v-next/outputv2/ibc/applications/transfer/v1/query.ts @@ -3,6 +3,7 @@ import { DenomTrace, DenomTraceAmino, DenomTraceSDKType, Params, ParamsAmino, Pa import { BinaryReader, BinaryWriter } from "../../../../binary"; import { isSet, DeepPartial } from "../../../../helpers"; import { JsonSafe } from "../../../../json-safe"; +import { GlobalDecoderRegistry } from "../../../../registry"; export const protobufPackage = "ibc.applications.transfer.v1"; /** * QueryDenomTraceRequest is the request type for the Query/DenomTrace RPC @@ -274,6 +275,15 @@ function createBaseQueryDenomTraceRequest(): QueryDenomTraceRequest { export const QueryDenomTraceRequest = { typeUrl: "/ibc.applications.transfer.v1.QueryDenomTraceRequest", aminoType: "cosmos-sdk/QueryDenomTraceRequest", + is(o: any): o is QueryDenomTraceRequest { + return o && (o.$typeUrl === QueryDenomTraceRequest.typeUrl || typeof o.hash === "string"); + }, + isSDK(o: any): o is QueryDenomTraceRequestSDKType { + return o && (o.$typeUrl === QueryDenomTraceRequest.typeUrl || typeof o.hash === "string"); + }, + isAmino(o: any): o is QueryDenomTraceRequestAmino { + return o && (o.$typeUrl === QueryDenomTraceRequest.typeUrl || typeof o.hash === "string"); + }, encode(message: QueryDenomTraceRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.hash !== "") { writer.uint32(10).string(message.hash); @@ -354,7 +364,8 @@ export const QueryDenomTraceRequest = { typeUrl: "/ibc.applications.transfer.v1.QueryDenomTraceRequest", value: QueryDenomTraceRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryDenomTraceResponse(): QueryDenomTraceResponse { return { @@ -371,6 +382,15 @@ function createBaseQueryDenomTraceResponse(): QueryDenomTraceResponse { export const QueryDenomTraceResponse = { typeUrl: "/ibc.applications.transfer.v1.QueryDenomTraceResponse", aminoType: "cosmos-sdk/QueryDenomTraceResponse", + is(o: any): o is QueryDenomTraceResponse { + return o && o.$typeUrl === QueryDenomTraceResponse.typeUrl; + }, + isSDK(o: any): o is QueryDenomTraceResponseSDKType { + return o && o.$typeUrl === QueryDenomTraceResponse.typeUrl; + }, + isAmino(o: any): o is QueryDenomTraceResponseAmino { + return o && o.$typeUrl === QueryDenomTraceResponse.typeUrl; + }, encode(message: QueryDenomTraceResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.denomTrace !== undefined) { DenomTrace.encode(message.denomTrace, writer.uint32(10).fork()).ldelim(); @@ -453,6 +473,12 @@ export const QueryDenomTraceResponse = { typeUrl: "/ibc.applications.transfer.v1.QueryDenomTraceResponse", value: QueryDenomTraceResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryDenomTraceResponse.typeUrl)) { + return; + } + DenomTrace.registerTypeUrl(); } }; function createBaseQueryDenomTracesRequest(): QueryDenomTracesRequest { @@ -470,6 +496,15 @@ function createBaseQueryDenomTracesRequest(): QueryDenomTracesRequest { export const QueryDenomTracesRequest = { typeUrl: "/ibc.applications.transfer.v1.QueryDenomTracesRequest", aminoType: "cosmos-sdk/QueryDenomTracesRequest", + is(o: any): o is QueryDenomTracesRequest { + return o && o.$typeUrl === QueryDenomTracesRequest.typeUrl; + }, + isSDK(o: any): o is QueryDenomTracesRequestSDKType { + return o && o.$typeUrl === QueryDenomTracesRequest.typeUrl; + }, + isAmino(o: any): o is QueryDenomTracesRequestAmino { + return o && o.$typeUrl === QueryDenomTracesRequest.typeUrl; + }, encode(message: QueryDenomTracesRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.pagination !== undefined) { PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); @@ -552,6 +587,12 @@ export const QueryDenomTracesRequest = { typeUrl: "/ibc.applications.transfer.v1.QueryDenomTracesRequest", value: QueryDenomTracesRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryDenomTracesRequest.typeUrl)) { + return; + } + PageRequest.registerTypeUrl(); } }; function createBaseQueryDenomTracesResponse(): QueryDenomTracesResponse { @@ -570,6 +611,15 @@ function createBaseQueryDenomTracesResponse(): QueryDenomTracesResponse { export const QueryDenomTracesResponse = { typeUrl: "/ibc.applications.transfer.v1.QueryDenomTracesResponse", aminoType: "cosmos-sdk/QueryDenomTracesResponse", + is(o: any): o is QueryDenomTracesResponse { + return o && (o.$typeUrl === QueryDenomTracesResponse.typeUrl || Array.isArray(o.denomTraces) && (!o.denomTraces.length || DenomTrace.is(o.denomTraces[0]))); + }, + isSDK(o: any): o is QueryDenomTracesResponseSDKType { + return o && (o.$typeUrl === QueryDenomTracesResponse.typeUrl || Array.isArray(o.denom_traces) && (!o.denom_traces.length || DenomTrace.isSDK(o.denom_traces[0]))); + }, + isAmino(o: any): o is QueryDenomTracesResponseAmino { + return o && (o.$typeUrl === QueryDenomTracesResponse.typeUrl || Array.isArray(o.denom_traces) && (!o.denom_traces.length || DenomTrace.isAmino(o.denom_traces[0]))); + }, encode(message: QueryDenomTracesResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.denomTraces) { DenomTrace.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -677,6 +727,13 @@ export const QueryDenomTracesResponse = { typeUrl: "/ibc.applications.transfer.v1.QueryDenomTracesResponse", value: QueryDenomTracesResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryDenomTracesResponse.typeUrl)) { + return; + } + DenomTrace.registerTypeUrl(); + PageResponse.registerTypeUrl(); } }; function createBaseQueryParamsRequest(): QueryParamsRequest { @@ -691,6 +748,15 @@ function createBaseQueryParamsRequest(): QueryParamsRequest { export const QueryParamsRequest = { typeUrl: "/ibc.applications.transfer.v1.QueryParamsRequest", aminoType: "cosmos-sdk/QueryParamsRequest", + is(o: any): o is QueryParamsRequest { + return o && o.$typeUrl === QueryParamsRequest.typeUrl; + }, + isSDK(o: any): o is QueryParamsRequestSDKType { + return o && o.$typeUrl === QueryParamsRequest.typeUrl; + }, + isAmino(o: any): o is QueryParamsRequestAmino { + return o && o.$typeUrl === QueryParamsRequest.typeUrl; + }, encode(_: QueryParamsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -755,7 +821,8 @@ export const QueryParamsRequest = { typeUrl: "/ibc.applications.transfer.v1.QueryParamsRequest", value: QueryParamsRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryParamsResponse(): QueryParamsResponse { return { @@ -771,6 +838,15 @@ function createBaseQueryParamsResponse(): QueryParamsResponse { export const QueryParamsResponse = { typeUrl: "/ibc.applications.transfer.v1.QueryParamsResponse", aminoType: "cosmos-sdk/QueryParamsResponse", + is(o: any): o is QueryParamsResponse { + return o && o.$typeUrl === QueryParamsResponse.typeUrl; + }, + isSDK(o: any): o is QueryParamsResponseSDKType { + return o && o.$typeUrl === QueryParamsResponse.typeUrl; + }, + isAmino(o: any): o is QueryParamsResponseAmino { + return o && o.$typeUrl === QueryParamsResponse.typeUrl; + }, encode(message: QueryParamsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.params !== undefined) { Params.encode(message.params, writer.uint32(10).fork()).ldelim(); @@ -853,5 +929,11 @@ export const QueryParamsResponse = { typeUrl: "/ibc.applications.transfer.v1.QueryParamsResponse", value: QueryParamsResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryParamsResponse.typeUrl)) { + return; + } + Params.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/ibc/applications/transfer/v1/transfer.ts b/__fixtures__/v-next/outputv2/ibc/applications/transfer/v1/transfer.ts index c7bf399de5..483bb59a97 100644 --- a/__fixtures__/v-next/outputv2/ibc/applications/transfer/v1/transfer.ts +++ b/__fixtures__/v-next/outputv2/ibc/applications/transfer/v1/transfer.ts @@ -136,6 +136,15 @@ function createBaseDenomTrace(): DenomTrace { export const DenomTrace = { typeUrl: "/ibc.applications.transfer.v1.DenomTrace", aminoType: "cosmos-sdk/DenomTrace", + is(o: any): o is DenomTrace { + return o && (o.$typeUrl === DenomTrace.typeUrl || typeof o.path === "string" && typeof o.baseDenom === "string"); + }, + isSDK(o: any): o is DenomTraceSDKType { + return o && (o.$typeUrl === DenomTrace.typeUrl || typeof o.path === "string" && typeof o.base_denom === "string"); + }, + isAmino(o: any): o is DenomTraceAmino { + return o && (o.$typeUrl === DenomTrace.typeUrl || typeof o.path === "string" && typeof o.base_denom === "string"); + }, encode(message: DenomTrace, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.path !== "") { writer.uint32(10).string(message.path); @@ -231,7 +240,8 @@ export const DenomTrace = { typeUrl: "/ibc.applications.transfer.v1.DenomTrace", value: DenomTrace.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseParams(): Params { return { @@ -251,6 +261,15 @@ function createBaseParams(): Params { export const Params = { typeUrl: "/ibc.applications.transfer.v1.Params", aminoType: "cosmos-sdk/Params", + is(o: any): o is Params { + return o && (o.$typeUrl === Params.typeUrl || typeof o.sendEnabled === "boolean" && typeof o.receiveEnabled === "boolean"); + }, + isSDK(o: any): o is ParamsSDKType { + return o && (o.$typeUrl === Params.typeUrl || typeof o.send_enabled === "boolean" && typeof o.receive_enabled === "boolean"); + }, + isAmino(o: any): o is ParamsAmino { + return o && (o.$typeUrl === Params.typeUrl || typeof o.send_enabled === "boolean" && typeof o.receive_enabled === "boolean"); + }, encode(message: Params, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.sendEnabled === true) { writer.uint32(8).bool(message.sendEnabled); @@ -346,5 +365,6 @@ export const Params = { typeUrl: "/ibc.applications.transfer.v1.Params", value: Params.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/ibc/applications/transfer/v1/tx.registry.ts b/__fixtures__/v-next/outputv2/ibc/applications/transfer/v1/tx.registry.ts index 64de273489..b74571af0b 100644 --- a/__fixtures__/v-next/outputv2/ibc/applications/transfer/v1/tx.registry.ts +++ b/__fixtures__/v-next/outputv2/ibc/applications/transfer/v1/tx.registry.ts @@ -1,11 +1,6 @@ -import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { TelescopeGeneratedType } from "../../../../types"; import { MsgTransfer } from "./tx"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/ibc.applications.transfer.v1.MsgTransfer", MsgTransfer]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/ibc.applications.transfer.v1.MsgTransfer", MsgTransfer]]; export const MessageComposer = { encoded: { transfer(value: MsgTransfer) { diff --git a/__fixtures__/v-next/outputv2/ibc/applications/transfer/v1/tx.rpc.func.ts b/__fixtures__/v-next/outputv2/ibc/applications/transfer/v1/tx.rpc.func.ts new file mode 100644 index 0000000000..a5471316c5 --- /dev/null +++ b/__fixtures__/v-next/outputv2/ibc/applications/transfer/v1/tx.rpc.func.ts @@ -0,0 +1,11 @@ +import { buildTx } from "../../../../helper-func-types"; +import { MsgTransfer } from "./tx"; +/** + * Transfer defines a rpc handler method for MsgTransfer. + * @name transfer + * @package ibc.applications.transfer.v1 + * @see proto service: ibc.applications.transfer.v1.Transfer + */ +export const transfer = buildTx({ + msg: MsgTransfer +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/ibc/applications/transfer/v1/tx.ts b/__fixtures__/v-next/outputv2/ibc/applications/transfer/v1/tx.ts index 110342811f..dd3a9c93a9 100644 --- a/__fixtures__/v-next/outputv2/ibc/applications/transfer/v1/tx.ts +++ b/__fixtures__/v-next/outputv2/ibc/applications/transfer/v1/tx.ts @@ -1,6 +1,7 @@ import { Coin, CoinAmino, CoinSDKType } from "../../../../cosmos/base/v1beta1/coin"; import { Height, HeightAmino, HeightSDKType } from "../../../core/client/v1/client"; import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { GlobalDecoderRegistry } from "../../../../registry"; import { isSet, DeepPartial } from "../../../../helpers"; import { JsonSafe } from "../../../../json-safe"; export const protobufPackage = "ibc.applications.transfer.v1"; @@ -160,6 +161,15 @@ function createBaseMsgTransfer(): MsgTransfer { export const MsgTransfer = { typeUrl: "/ibc.applications.transfer.v1.MsgTransfer", aminoType: "cosmos-sdk/MsgTransfer", + is(o: any): o is MsgTransfer { + return o && (o.$typeUrl === MsgTransfer.typeUrl || typeof o.sourcePort === "string" && typeof o.sourceChannel === "string" && Coin.is(o.token) && typeof o.sender === "string" && typeof o.receiver === "string" && Height.is(o.timeoutHeight) && typeof o.timeoutTimestamp === "bigint"); + }, + isSDK(o: any): o is MsgTransferSDKType { + return o && (o.$typeUrl === MsgTransfer.typeUrl || typeof o.source_port === "string" && typeof o.source_channel === "string" && Coin.isSDK(o.token) && typeof o.sender === "string" && typeof o.receiver === "string" && Height.isSDK(o.timeout_height) && typeof o.timeout_timestamp === "bigint"); + }, + isAmino(o: any): o is MsgTransferAmino { + return o && (o.$typeUrl === MsgTransfer.typeUrl || typeof o.source_port === "string" && typeof o.source_channel === "string" && Coin.isAmino(o.token) && typeof o.sender === "string" && typeof o.receiver === "string" && Height.isAmino(o.timeout_height) && typeof o.timeout_timestamp === "bigint"); + }, encode(message: MsgTransfer, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.sourcePort !== "") { writer.uint32(10).string(message.sourcePort); @@ -336,6 +346,13 @@ export const MsgTransfer = { typeUrl: "/ibc.applications.transfer.v1.MsgTransfer", value: MsgTransfer.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgTransfer.typeUrl)) { + return; + } + Coin.registerTypeUrl(); + Height.registerTypeUrl(); } }; function createBaseMsgTransferResponse(): MsgTransferResponse { @@ -350,6 +367,15 @@ function createBaseMsgTransferResponse(): MsgTransferResponse { export const MsgTransferResponse = { typeUrl: "/ibc.applications.transfer.v1.MsgTransferResponse", aminoType: "cosmos-sdk/MsgTransferResponse", + is(o: any): o is MsgTransferResponse { + return o && o.$typeUrl === MsgTransferResponse.typeUrl; + }, + isSDK(o: any): o is MsgTransferResponseSDKType { + return o && o.$typeUrl === MsgTransferResponse.typeUrl; + }, + isAmino(o: any): o is MsgTransferResponseAmino { + return o && o.$typeUrl === MsgTransferResponse.typeUrl; + }, encode(_: MsgTransferResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -414,5 +440,6 @@ export const MsgTransferResponse = { typeUrl: "/ibc.applications.transfer.v1.MsgTransferResponse", value: MsgTransferResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/ibc/applications/transfer/v2/packet.ts b/__fixtures__/v-next/outputv2/ibc/applications/transfer/v2/packet.ts index bcd8c56e80..b4583224be 100644 --- a/__fixtures__/v-next/outputv2/ibc/applications/transfer/v2/packet.ts +++ b/__fixtures__/v-next/outputv2/ibc/applications/transfer/v2/packet.ts @@ -95,6 +95,15 @@ function createBaseFungibleTokenPacketData(): FungibleTokenPacketData { export const FungibleTokenPacketData = { typeUrl: "/ibc.applications.transfer.v2.FungibleTokenPacketData", aminoType: "cosmos-sdk/FungibleTokenPacketData", + is(o: any): o is FungibleTokenPacketData { + return o && (o.$typeUrl === FungibleTokenPacketData.typeUrl || typeof o.denom === "string" && typeof o.amount === "string" && typeof o.sender === "string" && typeof o.receiver === "string"); + }, + isSDK(o: any): o is FungibleTokenPacketDataSDKType { + return o && (o.$typeUrl === FungibleTokenPacketData.typeUrl || typeof o.denom === "string" && typeof o.amount === "string" && typeof o.sender === "string" && typeof o.receiver === "string"); + }, + isAmino(o: any): o is FungibleTokenPacketDataAmino { + return o && (o.$typeUrl === FungibleTokenPacketData.typeUrl || typeof o.denom === "string" && typeof o.amount === "string" && typeof o.sender === "string" && typeof o.receiver === "string"); + }, encode(message: FungibleTokenPacketData, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.denom !== "") { writer.uint32(10).string(message.denom); @@ -220,5 +229,6 @@ export const FungibleTokenPacketData = { typeUrl: "/ibc.applications.transfer.v2.FungibleTokenPacketData", value: FungibleTokenPacketData.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/ibc/bundle.ts b/__fixtures__/v-next/outputv2/ibc/bundle.ts index 644dddf18b..9e6ce4fefd 100644 --- a/__fixtures__/v-next/outputv2/ibc/bundle.ts +++ b/__fixtures__/v-next/outputv2/ibc/bundle.ts @@ -22,30 +22,34 @@ import * as _250 from "./lightclients/localhost/v1/localhost"; import * as _251 from "./lightclients/solomachine/v1/solomachine"; import * as _252 from "./lightclients/solomachine/v2/solomachine"; import * as _253 from "./lightclients/tendermint/v1/tendermint"; -import * as _463 from "./applications/transfer/v1/tx.amino"; -import * as _464 from "./core/channel/v1/tx.amino"; -import * as _465 from "./core/client/v1/tx.amino"; -import * as _466 from "./core/connection/v1/tx.amino"; -import * as _467 from "./applications/transfer/v1/tx.registry"; -import * as _468 from "./core/channel/v1/tx.registry"; -import * as _469 from "./core/client/v1/tx.registry"; -import * as _470 from "./core/connection/v1/tx.registry"; -import * as _471 from "./applications/transfer/v1/query.lcd"; -import * as _472 from "./core/channel/v1/query.lcd"; -import * as _473 from "./core/client/v1/query.lcd"; -import * as _474 from "./core/connection/v1/query.lcd"; -import * as _475 from "./applications/transfer/v1/query.rpc.Query"; -import * as _476 from "./core/channel/v1/query.rpc.Query"; -import * as _477 from "./core/client/v1/query.rpc.Query"; -import * as _478 from "./core/connection/v1/query.rpc.Query"; -import * as _479 from "./core/port/v1/query.rpc.Query"; -import * as _480 from "./applications/transfer/v1/tx.rpc.msg"; -import * as _481 from "./core/channel/v1/tx.rpc.msg"; -import * as _482 from "./core/client/v1/tx.rpc.msg"; -import * as _483 from "./core/connection/v1/tx.rpc.msg"; -import * as _543 from "./lcd"; -import * as _544 from "./rpc.query"; -import * as _545 from "./rpc.tx"; +import * as _492 from "./applications/transfer/v1/tx.amino"; +import * as _493 from "./core/channel/v1/tx.amino"; +import * as _494 from "./core/client/v1/tx.amino"; +import * as _495 from "./core/connection/v1/tx.amino"; +import * as _496 from "./applications/transfer/v1/tx.registry"; +import * as _497 from "./core/channel/v1/tx.registry"; +import * as _498 from "./core/client/v1/tx.registry"; +import * as _499 from "./core/connection/v1/tx.registry"; +import * as _500 from "./applications/transfer/v1/query.rpc.func"; +import * as _501 from "./core/channel/v1/query.rpc.func"; +import * as _502 from "./core/client/v1/query.rpc.func"; +import * as _503 from "./core/connection/v1/query.rpc.func"; +import * as _504 from "./core/port/v1/query.rpc.func"; +import * as _505 from "./applications/transfer/v1/query.rpc.Query"; +import * as _506 from "./core/channel/v1/query.rpc.Query"; +import * as _507 from "./core/client/v1/query.rpc.Query"; +import * as _508 from "./core/connection/v1/query.rpc.Query"; +import * as _509 from "./core/port/v1/query.rpc.Query"; +import * as _510 from "./applications/transfer/v1/tx.rpc.func"; +import * as _511 from "./core/channel/v1/tx.rpc.func"; +import * as _512 from "./core/client/v1/tx.rpc.func"; +import * as _513 from "./core/connection/v1/tx.rpc.func"; +import * as _514 from "./applications/transfer/v1/tx.rpc.msg"; +import * as _515 from "./core/channel/v1/tx.rpc.msg"; +import * as _516 from "./core/client/v1/tx.rpc.msg"; +import * as _517 from "./core/connection/v1/tx.rpc.msg"; +import * as _581 from "./rpc.query"; +import * as _582 from "./rpc.tx"; export namespace ibc { export namespace applications { export namespace transfer { @@ -54,11 +58,12 @@ export namespace ibc { ..._231, ..._232, ..._233, - ..._463, - ..._467, - ..._471, - ..._475, - ..._480 + ..._492, + ..._496, + ..._500, + ..._505, + ..._510, + ..._514 }; export const v2 = { ..._234 @@ -72,11 +77,12 @@ export namespace ibc { ..._236, ..._237, ..._238, - ..._464, - ..._468, - ..._472, - ..._476, - ..._481 + ..._493, + ..._497, + ..._501, + ..._506, + ..._511, + ..._515 }; } export namespace client { @@ -85,11 +91,12 @@ export namespace ibc { ..._240, ..._241, ..._242, - ..._465, - ..._469, - ..._473, - ..._477, - ..._482 + ..._494, + ..._498, + ..._502, + ..._507, + ..._512, + ..._516 }; } export namespace commitment { @@ -103,17 +110,19 @@ export namespace ibc { ..._245, ..._246, ..._247, - ..._466, - ..._470, - ..._474, - ..._478, - ..._483 + ..._495, + ..._499, + ..._503, + ..._508, + ..._513, + ..._517 }; } export namespace port { export const v1 = { ..._248, - ..._479 + ..._504, + ..._509 }; } export namespace types { @@ -143,8 +152,7 @@ export namespace ibc { } } export const ClientFactory = { - ..._543, - ..._544, - ..._545 + ..._581, + ..._582 }; } \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/ibc/core/channel/v1/channel.ts b/__fixtures__/v-next/outputv2/ibc/core/channel/v1/channel.ts index ed289fe48d..012ab72bf9 100644 --- a/__fixtures__/v-next/outputv2/ibc/core/channel/v1/channel.ts +++ b/__fixtures__/v-next/outputv2/ibc/core/channel/v1/channel.ts @@ -1,6 +1,7 @@ import { Height, HeightAmino, HeightSDKType } from "../../client/v1/client"; -import { BinaryReader, BinaryWriter } from "../../../../binary"; import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../../helpers"; +import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { GlobalDecoderRegistry } from "../../../../registry"; import { JsonSafe } from "../../../../json-safe"; export const protobufPackage = "ibc.core.channel.v1"; /** @@ -609,6 +610,15 @@ function createBaseChannel(): Channel { export const Channel = { typeUrl: "/ibc.core.channel.v1.Channel", aminoType: "cosmos-sdk/Channel", + is(o: any): o is Channel { + return o && (o.$typeUrl === Channel.typeUrl || isSet(o.state) && isSet(o.ordering) && Counterparty.is(o.counterparty) && Array.isArray(o.connectionHops) && (!o.connectionHops.length || typeof o.connectionHops[0] === "string") && typeof o.version === "string"); + }, + isSDK(o: any): o is ChannelSDKType { + return o && (o.$typeUrl === Channel.typeUrl || isSet(o.state) && isSet(o.ordering) && Counterparty.isSDK(o.counterparty) && Array.isArray(o.connection_hops) && (!o.connection_hops.length || typeof o.connection_hops[0] === "string") && typeof o.version === "string"); + }, + isAmino(o: any): o is ChannelAmino { + return o && (o.$typeUrl === Channel.typeUrl || isSet(o.state) && isSet(o.ordering) && Counterparty.isAmino(o.counterparty) && Array.isArray(o.connection_hops) && (!o.connection_hops.length || typeof o.connection_hops[0] === "string") && typeof o.version === "string"); + }, encode(message: Channel, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.state !== 0) { writer.uint32(8).int32(message.state); @@ -761,6 +771,12 @@ export const Channel = { typeUrl: "/ibc.core.channel.v1.Channel", value: Channel.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Channel.typeUrl)) { + return; + } + Counterparty.registerTypeUrl(); } }; function createBaseIdentifiedChannel(): IdentifiedChannel { @@ -784,6 +800,15 @@ function createBaseIdentifiedChannel(): IdentifiedChannel { export const IdentifiedChannel = { typeUrl: "/ibc.core.channel.v1.IdentifiedChannel", aminoType: "cosmos-sdk/IdentifiedChannel", + is(o: any): o is IdentifiedChannel { + return o && (o.$typeUrl === IdentifiedChannel.typeUrl || isSet(o.state) && isSet(o.ordering) && Counterparty.is(o.counterparty) && Array.isArray(o.connectionHops) && (!o.connectionHops.length || typeof o.connectionHops[0] === "string") && typeof o.version === "string" && typeof o.portId === "string" && typeof o.channelId === "string"); + }, + isSDK(o: any): o is IdentifiedChannelSDKType { + return o && (o.$typeUrl === IdentifiedChannel.typeUrl || isSet(o.state) && isSet(o.ordering) && Counterparty.isSDK(o.counterparty) && Array.isArray(o.connection_hops) && (!o.connection_hops.length || typeof o.connection_hops[0] === "string") && typeof o.version === "string" && typeof o.port_id === "string" && typeof o.channel_id === "string"); + }, + isAmino(o: any): o is IdentifiedChannelAmino { + return o && (o.$typeUrl === IdentifiedChannel.typeUrl || isSet(o.state) && isSet(o.ordering) && Counterparty.isAmino(o.counterparty) && Array.isArray(o.connection_hops) && (!o.connection_hops.length || typeof o.connection_hops[0] === "string") && typeof o.version === "string" && typeof o.port_id === "string" && typeof o.channel_id === "string"); + }, encode(message: IdentifiedChannel, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.state !== 0) { writer.uint32(8).int32(message.state); @@ -966,6 +991,12 @@ export const IdentifiedChannel = { typeUrl: "/ibc.core.channel.v1.IdentifiedChannel", value: IdentifiedChannel.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(IdentifiedChannel.typeUrl)) { + return; + } + Counterparty.registerTypeUrl(); } }; function createBaseCounterparty(): Counterparty { @@ -983,6 +1014,15 @@ function createBaseCounterparty(): Counterparty { export const Counterparty = { typeUrl: "/ibc.core.channel.v1.Counterparty", aminoType: "cosmos-sdk/Counterparty", + is(o: any): o is Counterparty { + return o && (o.$typeUrl === Counterparty.typeUrl || typeof o.portId === "string" && typeof o.channelId === "string"); + }, + isSDK(o: any): o is CounterpartySDKType { + return o && (o.$typeUrl === Counterparty.typeUrl || typeof o.port_id === "string" && typeof o.channel_id === "string"); + }, + isAmino(o: any): o is CounterpartyAmino { + return o && (o.$typeUrl === Counterparty.typeUrl || typeof o.port_id === "string" && typeof o.channel_id === "string"); + }, encode(message: Counterparty, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.portId !== "") { writer.uint32(10).string(message.portId); @@ -1078,7 +1118,8 @@ export const Counterparty = { typeUrl: "/ibc.core.channel.v1.Counterparty", value: Counterparty.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBasePacket(): Packet { return { @@ -1101,6 +1142,15 @@ function createBasePacket(): Packet { export const Packet = { typeUrl: "/ibc.core.channel.v1.Packet", aminoType: "cosmos-sdk/Packet", + is(o: any): o is Packet { + return o && (o.$typeUrl === Packet.typeUrl || typeof o.sequence === "bigint" && typeof o.sourcePort === "string" && typeof o.sourceChannel === "string" && typeof o.destinationPort === "string" && typeof o.destinationChannel === "string" && (o.data instanceof Uint8Array || typeof o.data === "string") && Height.is(o.timeoutHeight) && typeof o.timeoutTimestamp === "bigint"); + }, + isSDK(o: any): o is PacketSDKType { + return o && (o.$typeUrl === Packet.typeUrl || typeof o.sequence === "bigint" && typeof o.source_port === "string" && typeof o.source_channel === "string" && typeof o.destination_port === "string" && typeof o.destination_channel === "string" && (o.data instanceof Uint8Array || typeof o.data === "string") && Height.isSDK(o.timeout_height) && typeof o.timeout_timestamp === "bigint"); + }, + isAmino(o: any): o is PacketAmino { + return o && (o.$typeUrl === Packet.typeUrl || typeof o.sequence === "bigint" && typeof o.source_port === "string" && typeof o.source_channel === "string" && typeof o.destination_port === "string" && typeof o.destination_channel === "string" && (o.data instanceof Uint8Array || typeof o.data === "string") && Height.isAmino(o.timeout_height) && typeof o.timeout_timestamp === "bigint"); + }, encode(message: Packet, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.sequence !== BigInt(0)) { writer.uint32(8).uint64(message.sequence); @@ -1292,6 +1342,12 @@ export const Packet = { typeUrl: "/ibc.core.channel.v1.Packet", value: Packet.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Packet.typeUrl)) { + return; + } + Height.registerTypeUrl(); } }; function createBasePacketState(): PacketState { @@ -1314,6 +1370,15 @@ function createBasePacketState(): PacketState { export const PacketState = { typeUrl: "/ibc.core.channel.v1.PacketState", aminoType: "cosmos-sdk/PacketState", + is(o: any): o is PacketState { + return o && (o.$typeUrl === PacketState.typeUrl || typeof o.portId === "string" && typeof o.channelId === "string" && typeof o.sequence === "bigint" && (o.data instanceof Uint8Array || typeof o.data === "string")); + }, + isSDK(o: any): o is PacketStateSDKType { + return o && (o.$typeUrl === PacketState.typeUrl || typeof o.port_id === "string" && typeof o.channel_id === "string" && typeof o.sequence === "bigint" && (o.data instanceof Uint8Array || typeof o.data === "string")); + }, + isAmino(o: any): o is PacketStateAmino { + return o && (o.$typeUrl === PacketState.typeUrl || typeof o.port_id === "string" && typeof o.channel_id === "string" && typeof o.sequence === "bigint" && (o.data instanceof Uint8Array || typeof o.data === "string")); + }, encode(message: PacketState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.portId !== "") { writer.uint32(10).string(message.portId); @@ -1441,7 +1506,8 @@ export const PacketState = { typeUrl: "/ibc.core.channel.v1.PacketState", value: PacketState.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseAcknowledgement(): Acknowledgement { return { @@ -1464,6 +1530,15 @@ function createBaseAcknowledgement(): Acknowledgement { export const Acknowledgement = { typeUrl: "/ibc.core.channel.v1.Acknowledgement", aminoType: "cosmos-sdk/Acknowledgement", + is(o: any): o is Acknowledgement { + return o && o.$typeUrl === Acknowledgement.typeUrl; + }, + isSDK(o: any): o is AcknowledgementSDKType { + return o && o.$typeUrl === Acknowledgement.typeUrl; + }, + isAmino(o: any): o is AcknowledgementAmino { + return o && o.$typeUrl === Acknowledgement.typeUrl; + }, encode(message: Acknowledgement, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.result !== undefined) { writer.uint32(170).bytes(message.result); @@ -1559,5 +1634,6 @@ export const Acknowledgement = { typeUrl: "/ibc.core.channel.v1.Acknowledgement", value: Acknowledgement.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/ibc/core/channel/v1/genesis.ts b/__fixtures__/v-next/outputv2/ibc/core/channel/v1/genesis.ts index 114bed43b7..5fbfd4bf31 100644 --- a/__fixtures__/v-next/outputv2/ibc/core/channel/v1/genesis.ts +++ b/__fixtures__/v-next/outputv2/ibc/core/channel/v1/genesis.ts @@ -2,6 +2,7 @@ import { IdentifiedChannel, IdentifiedChannelAmino, IdentifiedChannelSDKType, Pa import { BinaryReader, BinaryWriter } from "../../../../binary"; import { isSet, DeepPartial } from "../../../../helpers"; import { JsonSafe } from "../../../../json-safe"; +import { GlobalDecoderRegistry } from "../../../../registry"; export const protobufPackage = "ibc.core.channel.v1"; /** * GenesisState defines the ibc channel submodule's genesis state. @@ -130,6 +131,15 @@ function createBaseGenesisState(): GenesisState { export const GenesisState = { typeUrl: "/ibc.core.channel.v1.GenesisState", aminoType: "cosmos-sdk/GenesisState", + is(o: any): o is GenesisState { + return o && (o.$typeUrl === GenesisState.typeUrl || Array.isArray(o.channels) && (!o.channels.length || IdentifiedChannel.is(o.channels[0])) && Array.isArray(o.acknowledgements) && (!o.acknowledgements.length || PacketState.is(o.acknowledgements[0])) && Array.isArray(o.commitments) && (!o.commitments.length || PacketState.is(o.commitments[0])) && Array.isArray(o.receipts) && (!o.receipts.length || PacketState.is(o.receipts[0])) && Array.isArray(o.sendSequences) && (!o.sendSequences.length || PacketSequence.is(o.sendSequences[0])) && Array.isArray(o.recvSequences) && (!o.recvSequences.length || PacketSequence.is(o.recvSequences[0])) && Array.isArray(o.ackSequences) && (!o.ackSequences.length || PacketSequence.is(o.ackSequences[0])) && typeof o.nextChannelSequence === "bigint"); + }, + isSDK(o: any): o is GenesisStateSDKType { + return o && (o.$typeUrl === GenesisState.typeUrl || Array.isArray(o.channels) && (!o.channels.length || IdentifiedChannel.isSDK(o.channels[0])) && Array.isArray(o.acknowledgements) && (!o.acknowledgements.length || PacketState.isSDK(o.acknowledgements[0])) && Array.isArray(o.commitments) && (!o.commitments.length || PacketState.isSDK(o.commitments[0])) && Array.isArray(o.receipts) && (!o.receipts.length || PacketState.isSDK(o.receipts[0])) && Array.isArray(o.send_sequences) && (!o.send_sequences.length || PacketSequence.isSDK(o.send_sequences[0])) && Array.isArray(o.recv_sequences) && (!o.recv_sequences.length || PacketSequence.isSDK(o.recv_sequences[0])) && Array.isArray(o.ack_sequences) && (!o.ack_sequences.length || PacketSequence.isSDK(o.ack_sequences[0])) && typeof o.next_channel_sequence === "bigint"); + }, + isAmino(o: any): o is GenesisStateAmino { + return o && (o.$typeUrl === GenesisState.typeUrl || Array.isArray(o.channels) && (!o.channels.length || IdentifiedChannel.isAmino(o.channels[0])) && Array.isArray(o.acknowledgements) && (!o.acknowledgements.length || PacketState.isAmino(o.acknowledgements[0])) && Array.isArray(o.commitments) && (!o.commitments.length || PacketState.isAmino(o.commitments[0])) && Array.isArray(o.receipts) && (!o.receipts.length || PacketState.isAmino(o.receipts[0])) && Array.isArray(o.send_sequences) && (!o.send_sequences.length || PacketSequence.isAmino(o.send_sequences[0])) && Array.isArray(o.recv_sequences) && (!o.recv_sequences.length || PacketSequence.isAmino(o.recv_sequences[0])) && Array.isArray(o.ack_sequences) && (!o.ack_sequences.length || PacketSequence.isAmino(o.ack_sequences[0])) && typeof o.next_channel_sequence === "bigint"); + }, encode(message: GenesisState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.channels) { IdentifiedChannel.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -387,6 +397,14 @@ export const GenesisState = { typeUrl: "/ibc.core.channel.v1.GenesisState", value: GenesisState.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GenesisState.typeUrl)) { + return; + } + IdentifiedChannel.registerTypeUrl(); + PacketState.registerTypeUrl(); + PacketSequence.registerTypeUrl(); } }; function createBasePacketSequence(): PacketSequence { @@ -406,6 +424,15 @@ function createBasePacketSequence(): PacketSequence { export const PacketSequence = { typeUrl: "/ibc.core.channel.v1.PacketSequence", aminoType: "cosmos-sdk/PacketSequence", + is(o: any): o is PacketSequence { + return o && (o.$typeUrl === PacketSequence.typeUrl || typeof o.portId === "string" && typeof o.channelId === "string" && typeof o.sequence === "bigint"); + }, + isSDK(o: any): o is PacketSequenceSDKType { + return o && (o.$typeUrl === PacketSequence.typeUrl || typeof o.port_id === "string" && typeof o.channel_id === "string" && typeof o.sequence === "bigint"); + }, + isAmino(o: any): o is PacketSequenceAmino { + return o && (o.$typeUrl === PacketSequence.typeUrl || typeof o.port_id === "string" && typeof o.channel_id === "string" && typeof o.sequence === "bigint"); + }, encode(message: PacketSequence, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.portId !== "") { writer.uint32(10).string(message.portId); @@ -518,5 +545,6 @@ export const PacketSequence = { typeUrl: "/ibc.core.channel.v1.PacketSequence", value: PacketSequence.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/ibc/core/channel/v1/query.rpc.func.ts b/__fixtures__/v-next/outputv2/ibc/core/channel/v1/query.rpc.func.ts new file mode 100644 index 0000000000..844f349953 --- /dev/null +++ b/__fixtures__/v-next/outputv2/ibc/core/channel/v1/query.rpc.func.ts @@ -0,0 +1,179 @@ +import { buildQuery } from "../../../../helper-func-types"; +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"; +/** + * Channel queries an IBC Channel. + * @name getChannel + * @package ibc.core.channel.v1 + * @see proto service: ibc.core.channel.v1.Channel + */ +export const getChannel = buildQuery({ + encode: QueryChannelRequest.encode, + decode: QueryChannelResponse.decode, + service: "ibc.core.channel.v1.Query", + method: "Channel", + deps: [QueryChannelRequest, QueryChannelResponse] +}); +/** + * Channels queries all the IBC channels of a chain. + * @name getChannels + * @package ibc.core.channel.v1 + * @see proto service: ibc.core.channel.v1.Channels + */ +export const getChannels = buildQuery({ + encode: QueryChannelsRequest.encode, + decode: QueryChannelsResponse.decode, + service: "ibc.core.channel.v1.Query", + method: "Channels", + deps: [QueryChannelsRequest, QueryChannelsResponse] +}); +/** + * ConnectionChannels queries all the channels associated with a connection + * end. + * @name getConnectionChannels + * @package ibc.core.channel.v1 + * @see proto service: ibc.core.channel.v1.ConnectionChannels + */ +export const getConnectionChannels = buildQuery({ + encode: QueryConnectionChannelsRequest.encode, + decode: QueryConnectionChannelsResponse.decode, + service: "ibc.core.channel.v1.Query", + method: "ConnectionChannels", + deps: [QueryConnectionChannelsRequest, QueryConnectionChannelsResponse] +}); +/** + * ChannelClientState queries for the client state for the channel associated + * with the provided channel identifiers. + * @name getChannelClientState + * @package ibc.core.channel.v1 + * @see proto service: ibc.core.channel.v1.ChannelClientState + */ +export const getChannelClientState = buildQuery({ + encode: QueryChannelClientStateRequest.encode, + decode: QueryChannelClientStateResponse.decode, + service: "ibc.core.channel.v1.Query", + method: "ChannelClientState", + deps: [QueryChannelClientStateRequest, QueryChannelClientStateResponse] +}); +/** + * ChannelConsensusState queries for the consensus state for the channel + * associated with the provided channel identifiers. + * @name getChannelConsensusState + * @package ibc.core.channel.v1 + * @see proto service: ibc.core.channel.v1.ChannelConsensusState + */ +export const getChannelConsensusState = buildQuery({ + encode: QueryChannelConsensusStateRequest.encode, + decode: QueryChannelConsensusStateResponse.decode, + service: "ibc.core.channel.v1.Query", + method: "ChannelConsensusState", + deps: [QueryChannelConsensusStateRequest, QueryChannelConsensusStateResponse] +}); +/** + * PacketCommitment queries a stored packet commitment hash. + * @name getPacketCommitment + * @package ibc.core.channel.v1 + * @see proto service: ibc.core.channel.v1.PacketCommitment + */ +export const getPacketCommitment = buildQuery({ + encode: QueryPacketCommitmentRequest.encode, + decode: QueryPacketCommitmentResponse.decode, + service: "ibc.core.channel.v1.Query", + method: "PacketCommitment", + deps: [QueryPacketCommitmentRequest, QueryPacketCommitmentResponse] +}); +/** + * PacketCommitments returns all the packet commitments hashes associated + * with a channel. + * @name getPacketCommitments + * @package ibc.core.channel.v1 + * @see proto service: ibc.core.channel.v1.PacketCommitments + */ +export const getPacketCommitments = buildQuery({ + encode: QueryPacketCommitmentsRequest.encode, + decode: QueryPacketCommitmentsResponse.decode, + service: "ibc.core.channel.v1.Query", + method: "PacketCommitments", + deps: [QueryPacketCommitmentsRequest, QueryPacketCommitmentsResponse] +}); +/** + * PacketReceipt queries if a given packet sequence has been received on the + * queried chain + * @name getPacketReceipt + * @package ibc.core.channel.v1 + * @see proto service: ibc.core.channel.v1.PacketReceipt + */ +export const getPacketReceipt = buildQuery({ + encode: QueryPacketReceiptRequest.encode, + decode: QueryPacketReceiptResponse.decode, + service: "ibc.core.channel.v1.Query", + method: "PacketReceipt", + deps: [QueryPacketReceiptRequest, QueryPacketReceiptResponse] +}); +/** + * PacketAcknowledgement queries a stored packet acknowledgement hash. + * @name getPacketAcknowledgement + * @package ibc.core.channel.v1 + * @see proto service: ibc.core.channel.v1.PacketAcknowledgement + */ +export const getPacketAcknowledgement = buildQuery({ + encode: QueryPacketAcknowledgementRequest.encode, + decode: QueryPacketAcknowledgementResponse.decode, + service: "ibc.core.channel.v1.Query", + method: "PacketAcknowledgement", + deps: [QueryPacketAcknowledgementRequest, QueryPacketAcknowledgementResponse] +}); +/** + * PacketAcknowledgements returns all the packet acknowledgements associated + * with a channel. + * @name getPacketAcknowledgements + * @package ibc.core.channel.v1 + * @see proto service: ibc.core.channel.v1.PacketAcknowledgements + */ +export const getPacketAcknowledgements = buildQuery({ + encode: QueryPacketAcknowledgementsRequest.encode, + decode: QueryPacketAcknowledgementsResponse.decode, + service: "ibc.core.channel.v1.Query", + method: "PacketAcknowledgements", + deps: [QueryPacketAcknowledgementsRequest, QueryPacketAcknowledgementsResponse] +}); +/** + * UnreceivedPackets returns all the unreceived IBC packets associated with a + * channel and sequences. + * @name getUnreceivedPackets + * @package ibc.core.channel.v1 + * @see proto service: ibc.core.channel.v1.UnreceivedPackets + */ +export const getUnreceivedPackets = buildQuery({ + encode: QueryUnreceivedPacketsRequest.encode, + decode: QueryUnreceivedPacketsResponse.decode, + service: "ibc.core.channel.v1.Query", + method: "UnreceivedPackets", + deps: [QueryUnreceivedPacketsRequest, QueryUnreceivedPacketsResponse] +}); +/** + * UnreceivedAcks returns all the unreceived IBC acknowledgements associated + * with a channel and sequences. + * @name getUnreceivedAcks + * @package ibc.core.channel.v1 + * @see proto service: ibc.core.channel.v1.UnreceivedAcks + */ +export const getUnreceivedAcks = buildQuery({ + encode: QueryUnreceivedAcksRequest.encode, + decode: QueryUnreceivedAcksResponse.decode, + service: "ibc.core.channel.v1.Query", + method: "UnreceivedAcks", + deps: [QueryUnreceivedAcksRequest, QueryUnreceivedAcksResponse] +}); +/** + * NextSequenceReceive returns the next receive sequence for a given channel. + * @name getNextSequenceReceive + * @package ibc.core.channel.v1 + * @see proto service: ibc.core.channel.v1.NextSequenceReceive + */ +export const getNextSequenceReceive = buildQuery({ + encode: QueryNextSequenceReceiveRequest.encode, + decode: QueryNextSequenceReceiveResponse.decode, + service: "ibc.core.channel.v1.Query", + method: "NextSequenceReceive", + deps: [QueryNextSequenceReceiveRequest, QueryNextSequenceReceiveResponse] +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/ibc/core/channel/v1/query.ts b/__fixtures__/v-next/outputv2/ibc/core/channel/v1/query.ts index 7870e6cdaf..aec3ee36f2 100644 --- a/__fixtures__/v-next/outputv2/ibc/core/channel/v1/query.ts +++ b/__fixtures__/v-next/outputv2/ibc/core/channel/v1/query.ts @@ -5,6 +5,7 @@ import { Any, AnyAmino, AnySDKType } from "../../../../google/protobuf/any"; import { BinaryReader, BinaryWriter } from "../../../../binary"; import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../../helpers"; import { JsonSafe } from "../../../../json-safe"; +import { GlobalDecoderRegistry } from "../../../../registry"; export const protobufPackage = "ibc.core.channel.v1"; /** * QueryChannelRequest is the request type for the Query/Channel RPC method @@ -1579,6 +1580,15 @@ function createBaseQueryChannelRequest(): QueryChannelRequest { export const QueryChannelRequest = { typeUrl: "/ibc.core.channel.v1.QueryChannelRequest", aminoType: "cosmos-sdk/QueryChannelRequest", + is(o: any): o is QueryChannelRequest { + return o && (o.$typeUrl === QueryChannelRequest.typeUrl || typeof o.portId === "string" && typeof o.channelId === "string"); + }, + isSDK(o: any): o is QueryChannelRequestSDKType { + return o && (o.$typeUrl === QueryChannelRequest.typeUrl || typeof o.port_id === "string" && typeof o.channel_id === "string"); + }, + isAmino(o: any): o is QueryChannelRequestAmino { + return o && (o.$typeUrl === QueryChannelRequest.typeUrl || typeof o.port_id === "string" && typeof o.channel_id === "string"); + }, encode(message: QueryChannelRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.portId !== "") { writer.uint32(10).string(message.portId); @@ -1674,7 +1684,8 @@ export const QueryChannelRequest = { typeUrl: "/ibc.core.channel.v1.QueryChannelRequest", value: QueryChannelRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryChannelResponse(): QueryChannelResponse { return { @@ -1694,6 +1705,15 @@ function createBaseQueryChannelResponse(): QueryChannelResponse { export const QueryChannelResponse = { typeUrl: "/ibc.core.channel.v1.QueryChannelResponse", aminoType: "cosmos-sdk/QueryChannelResponse", + is(o: any): o is QueryChannelResponse { + return o && (o.$typeUrl === QueryChannelResponse.typeUrl || (o.proof instanceof Uint8Array || typeof o.proof === "string") && Height.is(o.proofHeight)); + }, + isSDK(o: any): o is QueryChannelResponseSDKType { + return o && (o.$typeUrl === QueryChannelResponse.typeUrl || (o.proof instanceof Uint8Array || typeof o.proof === "string") && Height.isSDK(o.proof_height)); + }, + isAmino(o: any): o is QueryChannelResponseAmino { + return o && (o.$typeUrl === QueryChannelResponse.typeUrl || (o.proof instanceof Uint8Array || typeof o.proof === "string") && Height.isAmino(o.proof_height)); + }, encode(message: QueryChannelResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.channel !== undefined) { Channel.encode(message.channel, writer.uint32(10).fork()).ldelim(); @@ -1808,6 +1828,13 @@ export const QueryChannelResponse = { typeUrl: "/ibc.core.channel.v1.QueryChannelResponse", value: QueryChannelResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryChannelResponse.typeUrl)) { + return; + } + Channel.registerTypeUrl(); + Height.registerTypeUrl(); } }; function createBaseQueryChannelsRequest(): QueryChannelsRequest { @@ -1824,6 +1851,15 @@ function createBaseQueryChannelsRequest(): QueryChannelsRequest { export const QueryChannelsRequest = { typeUrl: "/ibc.core.channel.v1.QueryChannelsRequest", aminoType: "cosmos-sdk/QueryChannelsRequest", + is(o: any): o is QueryChannelsRequest { + return o && o.$typeUrl === QueryChannelsRequest.typeUrl; + }, + isSDK(o: any): o is QueryChannelsRequestSDKType { + return o && o.$typeUrl === QueryChannelsRequest.typeUrl; + }, + isAmino(o: any): o is QueryChannelsRequestAmino { + return o && o.$typeUrl === QueryChannelsRequest.typeUrl; + }, encode(message: QueryChannelsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.pagination !== undefined) { PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); @@ -1906,6 +1942,12 @@ export const QueryChannelsRequest = { typeUrl: "/ibc.core.channel.v1.QueryChannelsRequest", value: QueryChannelsRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryChannelsRequest.typeUrl)) { + return; + } + PageRequest.registerTypeUrl(); } }; function createBaseQueryChannelsResponse(): QueryChannelsResponse { @@ -1924,6 +1966,15 @@ function createBaseQueryChannelsResponse(): QueryChannelsResponse { export const QueryChannelsResponse = { typeUrl: "/ibc.core.channel.v1.QueryChannelsResponse", aminoType: "cosmos-sdk/QueryChannelsResponse", + is(o: any): o is QueryChannelsResponse { + return o && (o.$typeUrl === QueryChannelsResponse.typeUrl || Array.isArray(o.channels) && (!o.channels.length || IdentifiedChannel.is(o.channels[0])) && Height.is(o.height)); + }, + isSDK(o: any): o is QueryChannelsResponseSDKType { + return o && (o.$typeUrl === QueryChannelsResponse.typeUrl || Array.isArray(o.channels) && (!o.channels.length || IdentifiedChannel.isSDK(o.channels[0])) && Height.isSDK(o.height)); + }, + isAmino(o: any): o is QueryChannelsResponseAmino { + return o && (o.$typeUrl === QueryChannelsResponse.typeUrl || Array.isArray(o.channels) && (!o.channels.length || IdentifiedChannel.isAmino(o.channels[0])) && Height.isAmino(o.height)); + }, encode(message: QueryChannelsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.channels) { IdentifiedChannel.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -2048,6 +2099,14 @@ export const QueryChannelsResponse = { typeUrl: "/ibc.core.channel.v1.QueryChannelsResponse", value: QueryChannelsResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryChannelsResponse.typeUrl)) { + return; + } + IdentifiedChannel.registerTypeUrl(); + PageResponse.registerTypeUrl(); + Height.registerTypeUrl(); } }; function createBaseQueryConnectionChannelsRequest(): QueryConnectionChannelsRequest { @@ -2066,6 +2125,15 @@ function createBaseQueryConnectionChannelsRequest(): QueryConnectionChannelsRequ export const QueryConnectionChannelsRequest = { typeUrl: "/ibc.core.channel.v1.QueryConnectionChannelsRequest", aminoType: "cosmos-sdk/QueryConnectionChannelsRequest", + is(o: any): o is QueryConnectionChannelsRequest { + return o && (o.$typeUrl === QueryConnectionChannelsRequest.typeUrl || typeof o.connection === "string"); + }, + isSDK(o: any): o is QueryConnectionChannelsRequestSDKType { + return o && (o.$typeUrl === QueryConnectionChannelsRequest.typeUrl || typeof o.connection === "string"); + }, + isAmino(o: any): o is QueryConnectionChannelsRequestAmino { + return o && (o.$typeUrl === QueryConnectionChannelsRequest.typeUrl || typeof o.connection === "string"); + }, encode(message: QueryConnectionChannelsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.connection !== "") { writer.uint32(10).string(message.connection); @@ -2163,6 +2231,12 @@ export const QueryConnectionChannelsRequest = { typeUrl: "/ibc.core.channel.v1.QueryConnectionChannelsRequest", value: QueryConnectionChannelsRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryConnectionChannelsRequest.typeUrl)) { + return; + } + PageRequest.registerTypeUrl(); } }; function createBaseQueryConnectionChannelsResponse(): QueryConnectionChannelsResponse { @@ -2182,6 +2256,15 @@ function createBaseQueryConnectionChannelsResponse(): QueryConnectionChannelsRes export const QueryConnectionChannelsResponse = { typeUrl: "/ibc.core.channel.v1.QueryConnectionChannelsResponse", aminoType: "cosmos-sdk/QueryConnectionChannelsResponse", + is(o: any): o is QueryConnectionChannelsResponse { + return o && (o.$typeUrl === QueryConnectionChannelsResponse.typeUrl || Array.isArray(o.channels) && (!o.channels.length || IdentifiedChannel.is(o.channels[0])) && Height.is(o.height)); + }, + isSDK(o: any): o is QueryConnectionChannelsResponseSDKType { + return o && (o.$typeUrl === QueryConnectionChannelsResponse.typeUrl || Array.isArray(o.channels) && (!o.channels.length || IdentifiedChannel.isSDK(o.channels[0])) && Height.isSDK(o.height)); + }, + isAmino(o: any): o is QueryConnectionChannelsResponseAmino { + return o && (o.$typeUrl === QueryConnectionChannelsResponse.typeUrl || Array.isArray(o.channels) && (!o.channels.length || IdentifiedChannel.isAmino(o.channels[0])) && Height.isAmino(o.height)); + }, encode(message: QueryConnectionChannelsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.channels) { IdentifiedChannel.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -2306,6 +2389,14 @@ export const QueryConnectionChannelsResponse = { typeUrl: "/ibc.core.channel.v1.QueryConnectionChannelsResponse", value: QueryConnectionChannelsResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryConnectionChannelsResponse.typeUrl)) { + return; + } + IdentifiedChannel.registerTypeUrl(); + PageResponse.registerTypeUrl(); + Height.registerTypeUrl(); } }; function createBaseQueryChannelClientStateRequest(): QueryChannelClientStateRequest { @@ -2324,6 +2415,15 @@ function createBaseQueryChannelClientStateRequest(): QueryChannelClientStateRequ export const QueryChannelClientStateRequest = { typeUrl: "/ibc.core.channel.v1.QueryChannelClientStateRequest", aminoType: "cosmos-sdk/QueryChannelClientStateRequest", + is(o: any): o is QueryChannelClientStateRequest { + return o && (o.$typeUrl === QueryChannelClientStateRequest.typeUrl || typeof o.portId === "string" && typeof o.channelId === "string"); + }, + isSDK(o: any): o is QueryChannelClientStateRequestSDKType { + return o && (o.$typeUrl === QueryChannelClientStateRequest.typeUrl || typeof o.port_id === "string" && typeof o.channel_id === "string"); + }, + isAmino(o: any): o is QueryChannelClientStateRequestAmino { + return o && (o.$typeUrl === QueryChannelClientStateRequest.typeUrl || typeof o.port_id === "string" && typeof o.channel_id === "string"); + }, encode(message: QueryChannelClientStateRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.portId !== "") { writer.uint32(10).string(message.portId); @@ -2419,7 +2519,8 @@ export const QueryChannelClientStateRequest = { typeUrl: "/ibc.core.channel.v1.QueryChannelClientStateRequest", value: QueryChannelClientStateRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryChannelClientStateResponse(): QueryChannelClientStateResponse { return { @@ -2438,6 +2539,15 @@ function createBaseQueryChannelClientStateResponse(): QueryChannelClientStateRes export const QueryChannelClientStateResponse = { typeUrl: "/ibc.core.channel.v1.QueryChannelClientStateResponse", aminoType: "cosmos-sdk/QueryChannelClientStateResponse", + is(o: any): o is QueryChannelClientStateResponse { + return o && (o.$typeUrl === QueryChannelClientStateResponse.typeUrl || (o.proof instanceof Uint8Array || typeof o.proof === "string") && Height.is(o.proofHeight)); + }, + isSDK(o: any): o is QueryChannelClientStateResponseSDKType { + return o && (o.$typeUrl === QueryChannelClientStateResponse.typeUrl || (o.proof instanceof Uint8Array || typeof o.proof === "string") && Height.isSDK(o.proof_height)); + }, + isAmino(o: any): o is QueryChannelClientStateResponseAmino { + return o && (o.$typeUrl === QueryChannelClientStateResponse.typeUrl || (o.proof instanceof Uint8Array || typeof o.proof === "string") && Height.isAmino(o.proof_height)); + }, encode(message: QueryChannelClientStateResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.identifiedClientState !== undefined) { IdentifiedClientState.encode(message.identifiedClientState, writer.uint32(10).fork()).ldelim(); @@ -2552,6 +2662,13 @@ export const QueryChannelClientStateResponse = { typeUrl: "/ibc.core.channel.v1.QueryChannelClientStateResponse", value: QueryChannelClientStateResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryChannelClientStateResponse.typeUrl)) { + return; + } + IdentifiedClientState.registerTypeUrl(); + Height.registerTypeUrl(); } }; function createBaseQueryChannelConsensusStateRequest(): QueryChannelConsensusStateRequest { @@ -2572,6 +2689,15 @@ function createBaseQueryChannelConsensusStateRequest(): QueryChannelConsensusSta export const QueryChannelConsensusStateRequest = { typeUrl: "/ibc.core.channel.v1.QueryChannelConsensusStateRequest", aminoType: "cosmos-sdk/QueryChannelConsensusStateRequest", + is(o: any): o is QueryChannelConsensusStateRequest { + return o && (o.$typeUrl === QueryChannelConsensusStateRequest.typeUrl || typeof o.portId === "string" && typeof o.channelId === "string" && typeof o.revisionNumber === "bigint" && typeof o.revisionHeight === "bigint"); + }, + isSDK(o: any): o is QueryChannelConsensusStateRequestSDKType { + return o && (o.$typeUrl === QueryChannelConsensusStateRequest.typeUrl || typeof o.port_id === "string" && typeof o.channel_id === "string" && typeof o.revision_number === "bigint" && typeof o.revision_height === "bigint"); + }, + isAmino(o: any): o is QueryChannelConsensusStateRequestAmino { + return o && (o.$typeUrl === QueryChannelConsensusStateRequest.typeUrl || typeof o.port_id === "string" && typeof o.channel_id === "string" && typeof o.revision_number === "bigint" && typeof o.revision_height === "bigint"); + }, encode(message: QueryChannelConsensusStateRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.portId !== "") { writer.uint32(10).string(message.portId); @@ -2701,7 +2827,8 @@ export const QueryChannelConsensusStateRequest = { typeUrl: "/ibc.core.channel.v1.QueryChannelConsensusStateRequest", value: QueryChannelConsensusStateRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryChannelConsensusStateResponse(): QueryChannelConsensusStateResponse { return { @@ -2721,6 +2848,15 @@ function createBaseQueryChannelConsensusStateResponse(): QueryChannelConsensusSt export const QueryChannelConsensusStateResponse = { typeUrl: "/ibc.core.channel.v1.QueryChannelConsensusStateResponse", aminoType: "cosmos-sdk/QueryChannelConsensusStateResponse", + is(o: any): o is QueryChannelConsensusStateResponse { + return o && (o.$typeUrl === QueryChannelConsensusStateResponse.typeUrl || typeof o.clientId === "string" && (o.proof instanceof Uint8Array || typeof o.proof === "string") && Height.is(o.proofHeight)); + }, + isSDK(o: any): o is QueryChannelConsensusStateResponseSDKType { + return o && (o.$typeUrl === QueryChannelConsensusStateResponse.typeUrl || typeof o.client_id === "string" && (o.proof instanceof Uint8Array || typeof o.proof === "string") && Height.isSDK(o.proof_height)); + }, + isAmino(o: any): o is QueryChannelConsensusStateResponseAmino { + return o && (o.$typeUrl === QueryChannelConsensusStateResponse.typeUrl || typeof o.client_id === "string" && (o.proof instanceof Uint8Array || typeof o.proof === "string") && Height.isAmino(o.proof_height)); + }, encode(message: QueryChannelConsensusStateResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.consensusState !== undefined) { Any.encode(message.consensusState, writer.uint32(10).fork()).ldelim(); @@ -2850,6 +2986,12 @@ export const QueryChannelConsensusStateResponse = { typeUrl: "/ibc.core.channel.v1.QueryChannelConsensusStateResponse", value: QueryChannelConsensusStateResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryChannelConsensusStateResponse.typeUrl)) { + return; + } + Height.registerTypeUrl(); } }; function createBaseQueryPacketCommitmentRequest(): QueryPacketCommitmentRequest { @@ -2869,6 +3011,15 @@ function createBaseQueryPacketCommitmentRequest(): QueryPacketCommitmentRequest export const QueryPacketCommitmentRequest = { typeUrl: "/ibc.core.channel.v1.QueryPacketCommitmentRequest", aminoType: "cosmos-sdk/QueryPacketCommitmentRequest", + is(o: any): o is QueryPacketCommitmentRequest { + return o && (o.$typeUrl === QueryPacketCommitmentRequest.typeUrl || typeof o.portId === "string" && typeof o.channelId === "string" && typeof o.sequence === "bigint"); + }, + isSDK(o: any): o is QueryPacketCommitmentRequestSDKType { + return o && (o.$typeUrl === QueryPacketCommitmentRequest.typeUrl || typeof o.port_id === "string" && typeof o.channel_id === "string" && typeof o.sequence === "bigint"); + }, + isAmino(o: any): o is QueryPacketCommitmentRequestAmino { + return o && (o.$typeUrl === QueryPacketCommitmentRequest.typeUrl || typeof o.port_id === "string" && typeof o.channel_id === "string" && typeof o.sequence === "bigint"); + }, encode(message: QueryPacketCommitmentRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.portId !== "") { writer.uint32(10).string(message.portId); @@ -2981,7 +3132,8 @@ export const QueryPacketCommitmentRequest = { typeUrl: "/ibc.core.channel.v1.QueryPacketCommitmentRequest", value: QueryPacketCommitmentRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryPacketCommitmentResponse(): QueryPacketCommitmentResponse { return { @@ -3001,6 +3153,15 @@ function createBaseQueryPacketCommitmentResponse(): QueryPacketCommitmentRespons export const QueryPacketCommitmentResponse = { typeUrl: "/ibc.core.channel.v1.QueryPacketCommitmentResponse", aminoType: "cosmos-sdk/QueryPacketCommitmentResponse", + is(o: any): o is QueryPacketCommitmentResponse { + return o && (o.$typeUrl === QueryPacketCommitmentResponse.typeUrl || (o.commitment instanceof Uint8Array || typeof o.commitment === "string") && (o.proof instanceof Uint8Array || typeof o.proof === "string") && Height.is(o.proofHeight)); + }, + isSDK(o: any): o is QueryPacketCommitmentResponseSDKType { + return o && (o.$typeUrl === QueryPacketCommitmentResponse.typeUrl || (o.commitment instanceof Uint8Array || typeof o.commitment === "string") && (o.proof instanceof Uint8Array || typeof o.proof === "string") && Height.isSDK(o.proof_height)); + }, + isAmino(o: any): o is QueryPacketCommitmentResponseAmino { + return o && (o.$typeUrl === QueryPacketCommitmentResponse.typeUrl || (o.commitment instanceof Uint8Array || typeof o.commitment === "string") && (o.proof instanceof Uint8Array || typeof o.proof === "string") && Height.isAmino(o.proof_height)); + }, encode(message: QueryPacketCommitmentResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.commitment.length !== 0) { writer.uint32(10).bytes(message.commitment); @@ -3113,6 +3274,12 @@ export const QueryPacketCommitmentResponse = { typeUrl: "/ibc.core.channel.v1.QueryPacketCommitmentResponse", value: QueryPacketCommitmentResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryPacketCommitmentResponse.typeUrl)) { + return; + } + Height.registerTypeUrl(); } }; function createBaseQueryPacketCommitmentsRequest(): QueryPacketCommitmentsRequest { @@ -3132,6 +3299,15 @@ function createBaseQueryPacketCommitmentsRequest(): QueryPacketCommitmentsReques export const QueryPacketCommitmentsRequest = { typeUrl: "/ibc.core.channel.v1.QueryPacketCommitmentsRequest", aminoType: "cosmos-sdk/QueryPacketCommitmentsRequest", + is(o: any): o is QueryPacketCommitmentsRequest { + return o && (o.$typeUrl === QueryPacketCommitmentsRequest.typeUrl || typeof o.portId === "string" && typeof o.channelId === "string"); + }, + isSDK(o: any): o is QueryPacketCommitmentsRequestSDKType { + return o && (o.$typeUrl === QueryPacketCommitmentsRequest.typeUrl || typeof o.port_id === "string" && typeof o.channel_id === "string"); + }, + isAmino(o: any): o is QueryPacketCommitmentsRequestAmino { + return o && (o.$typeUrl === QueryPacketCommitmentsRequest.typeUrl || typeof o.port_id === "string" && typeof o.channel_id === "string"); + }, encode(message: QueryPacketCommitmentsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.portId !== "") { writer.uint32(10).string(message.portId); @@ -3244,6 +3420,12 @@ export const QueryPacketCommitmentsRequest = { typeUrl: "/ibc.core.channel.v1.QueryPacketCommitmentsRequest", value: QueryPacketCommitmentsRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryPacketCommitmentsRequest.typeUrl)) { + return; + } + PageRequest.registerTypeUrl(); } }; function createBaseQueryPacketCommitmentsResponse(): QueryPacketCommitmentsResponse { @@ -3263,6 +3445,15 @@ function createBaseQueryPacketCommitmentsResponse(): QueryPacketCommitmentsRespo export const QueryPacketCommitmentsResponse = { typeUrl: "/ibc.core.channel.v1.QueryPacketCommitmentsResponse", aminoType: "cosmos-sdk/QueryPacketCommitmentsResponse", + is(o: any): o is QueryPacketCommitmentsResponse { + return o && (o.$typeUrl === QueryPacketCommitmentsResponse.typeUrl || Array.isArray(o.commitments) && (!o.commitments.length || PacketState.is(o.commitments[0])) && Height.is(o.height)); + }, + isSDK(o: any): o is QueryPacketCommitmentsResponseSDKType { + return o && (o.$typeUrl === QueryPacketCommitmentsResponse.typeUrl || Array.isArray(o.commitments) && (!o.commitments.length || PacketState.isSDK(o.commitments[0])) && Height.isSDK(o.height)); + }, + isAmino(o: any): o is QueryPacketCommitmentsResponseAmino { + return o && (o.$typeUrl === QueryPacketCommitmentsResponse.typeUrl || Array.isArray(o.commitments) && (!o.commitments.length || PacketState.isAmino(o.commitments[0])) && Height.isAmino(o.height)); + }, encode(message: QueryPacketCommitmentsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.commitments) { PacketState.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -3387,6 +3578,14 @@ export const QueryPacketCommitmentsResponse = { typeUrl: "/ibc.core.channel.v1.QueryPacketCommitmentsResponse", value: QueryPacketCommitmentsResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryPacketCommitmentsResponse.typeUrl)) { + return; + } + PacketState.registerTypeUrl(); + PageResponse.registerTypeUrl(); + Height.registerTypeUrl(); } }; function createBaseQueryPacketReceiptRequest(): QueryPacketReceiptRequest { @@ -3406,6 +3605,15 @@ function createBaseQueryPacketReceiptRequest(): QueryPacketReceiptRequest { export const QueryPacketReceiptRequest = { typeUrl: "/ibc.core.channel.v1.QueryPacketReceiptRequest", aminoType: "cosmos-sdk/QueryPacketReceiptRequest", + is(o: any): o is QueryPacketReceiptRequest { + return o && (o.$typeUrl === QueryPacketReceiptRequest.typeUrl || typeof o.portId === "string" && typeof o.channelId === "string" && typeof o.sequence === "bigint"); + }, + isSDK(o: any): o is QueryPacketReceiptRequestSDKType { + return o && (o.$typeUrl === QueryPacketReceiptRequest.typeUrl || typeof o.port_id === "string" && typeof o.channel_id === "string" && typeof o.sequence === "bigint"); + }, + isAmino(o: any): o is QueryPacketReceiptRequestAmino { + return o && (o.$typeUrl === QueryPacketReceiptRequest.typeUrl || typeof o.port_id === "string" && typeof o.channel_id === "string" && typeof o.sequence === "bigint"); + }, encode(message: QueryPacketReceiptRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.portId !== "") { writer.uint32(10).string(message.portId); @@ -3518,7 +3726,8 @@ export const QueryPacketReceiptRequest = { typeUrl: "/ibc.core.channel.v1.QueryPacketReceiptRequest", value: QueryPacketReceiptRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryPacketReceiptResponse(): QueryPacketReceiptResponse { return { @@ -3538,6 +3747,15 @@ function createBaseQueryPacketReceiptResponse(): QueryPacketReceiptResponse { export const QueryPacketReceiptResponse = { typeUrl: "/ibc.core.channel.v1.QueryPacketReceiptResponse", aminoType: "cosmos-sdk/QueryPacketReceiptResponse", + is(o: any): o is QueryPacketReceiptResponse { + return o && (o.$typeUrl === QueryPacketReceiptResponse.typeUrl || typeof o.received === "boolean" && (o.proof instanceof Uint8Array || typeof o.proof === "string") && Height.is(o.proofHeight)); + }, + isSDK(o: any): o is QueryPacketReceiptResponseSDKType { + return o && (o.$typeUrl === QueryPacketReceiptResponse.typeUrl || typeof o.received === "boolean" && (o.proof instanceof Uint8Array || typeof o.proof === "string") && Height.isSDK(o.proof_height)); + }, + isAmino(o: any): o is QueryPacketReceiptResponseAmino { + return o && (o.$typeUrl === QueryPacketReceiptResponse.typeUrl || typeof o.received === "boolean" && (o.proof instanceof Uint8Array || typeof o.proof === "string") && Height.isAmino(o.proof_height)); + }, encode(message: QueryPacketReceiptResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.received === true) { writer.uint32(16).bool(message.received); @@ -3650,6 +3868,12 @@ export const QueryPacketReceiptResponse = { typeUrl: "/ibc.core.channel.v1.QueryPacketReceiptResponse", value: QueryPacketReceiptResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryPacketReceiptResponse.typeUrl)) { + return; + } + Height.registerTypeUrl(); } }; function createBaseQueryPacketAcknowledgementRequest(): QueryPacketAcknowledgementRequest { @@ -3669,6 +3893,15 @@ function createBaseQueryPacketAcknowledgementRequest(): QueryPacketAcknowledgeme export const QueryPacketAcknowledgementRequest = { typeUrl: "/ibc.core.channel.v1.QueryPacketAcknowledgementRequest", aminoType: "cosmos-sdk/QueryPacketAcknowledgementRequest", + is(o: any): o is QueryPacketAcknowledgementRequest { + return o && (o.$typeUrl === QueryPacketAcknowledgementRequest.typeUrl || typeof o.portId === "string" && typeof o.channelId === "string" && typeof o.sequence === "bigint"); + }, + isSDK(o: any): o is QueryPacketAcknowledgementRequestSDKType { + return o && (o.$typeUrl === QueryPacketAcknowledgementRequest.typeUrl || typeof o.port_id === "string" && typeof o.channel_id === "string" && typeof o.sequence === "bigint"); + }, + isAmino(o: any): o is QueryPacketAcknowledgementRequestAmino { + return o && (o.$typeUrl === QueryPacketAcknowledgementRequest.typeUrl || typeof o.port_id === "string" && typeof o.channel_id === "string" && typeof o.sequence === "bigint"); + }, encode(message: QueryPacketAcknowledgementRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.portId !== "") { writer.uint32(10).string(message.portId); @@ -3781,7 +4014,8 @@ export const QueryPacketAcknowledgementRequest = { typeUrl: "/ibc.core.channel.v1.QueryPacketAcknowledgementRequest", value: QueryPacketAcknowledgementRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryPacketAcknowledgementResponse(): QueryPacketAcknowledgementResponse { return { @@ -3801,6 +4035,15 @@ function createBaseQueryPacketAcknowledgementResponse(): QueryPacketAcknowledgem export const QueryPacketAcknowledgementResponse = { typeUrl: "/ibc.core.channel.v1.QueryPacketAcknowledgementResponse", aminoType: "cosmos-sdk/QueryPacketAcknowledgementResponse", + is(o: any): o is QueryPacketAcknowledgementResponse { + return o && (o.$typeUrl === QueryPacketAcknowledgementResponse.typeUrl || (o.acknowledgement instanceof Uint8Array || typeof o.acknowledgement === "string") && (o.proof instanceof Uint8Array || typeof o.proof === "string") && Height.is(o.proofHeight)); + }, + isSDK(o: any): o is QueryPacketAcknowledgementResponseSDKType { + return o && (o.$typeUrl === QueryPacketAcknowledgementResponse.typeUrl || (o.acknowledgement instanceof Uint8Array || typeof o.acknowledgement === "string") && (o.proof instanceof Uint8Array || typeof o.proof === "string") && Height.isSDK(o.proof_height)); + }, + isAmino(o: any): o is QueryPacketAcknowledgementResponseAmino { + return o && (o.$typeUrl === QueryPacketAcknowledgementResponse.typeUrl || (o.acknowledgement instanceof Uint8Array || typeof o.acknowledgement === "string") && (o.proof instanceof Uint8Array || typeof o.proof === "string") && Height.isAmino(o.proof_height)); + }, encode(message: QueryPacketAcknowledgementResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.acknowledgement.length !== 0) { writer.uint32(10).bytes(message.acknowledgement); @@ -3913,6 +4156,12 @@ export const QueryPacketAcknowledgementResponse = { typeUrl: "/ibc.core.channel.v1.QueryPacketAcknowledgementResponse", value: QueryPacketAcknowledgementResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryPacketAcknowledgementResponse.typeUrl)) { + return; + } + Height.registerTypeUrl(); } }; function createBaseQueryPacketAcknowledgementsRequest(): QueryPacketAcknowledgementsRequest { @@ -3933,6 +4182,15 @@ function createBaseQueryPacketAcknowledgementsRequest(): QueryPacketAcknowledgem export const QueryPacketAcknowledgementsRequest = { typeUrl: "/ibc.core.channel.v1.QueryPacketAcknowledgementsRequest", aminoType: "cosmos-sdk/QueryPacketAcknowledgementsRequest", + is(o: any): o is QueryPacketAcknowledgementsRequest { + return o && (o.$typeUrl === QueryPacketAcknowledgementsRequest.typeUrl || typeof o.portId === "string" && typeof o.channelId === "string" && Array.isArray(o.packetCommitmentSequences) && (!o.packetCommitmentSequences.length || typeof o.packetCommitmentSequences[0] === "bigint")); + }, + isSDK(o: any): o is QueryPacketAcknowledgementsRequestSDKType { + return o && (o.$typeUrl === QueryPacketAcknowledgementsRequest.typeUrl || typeof o.port_id === "string" && typeof o.channel_id === "string" && Array.isArray(o.packet_commitment_sequences) && (!o.packet_commitment_sequences.length || typeof o.packet_commitment_sequences[0] === "bigint")); + }, + isAmino(o: any): o is QueryPacketAcknowledgementsRequestAmino { + return o && (o.$typeUrl === QueryPacketAcknowledgementsRequest.typeUrl || typeof o.port_id === "string" && typeof o.channel_id === "string" && Array.isArray(o.packet_commitment_sequences) && (!o.packet_commitment_sequences.length || typeof o.packet_commitment_sequences[0] === "bigint")); + }, encode(message: QueryPacketAcknowledgementsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.portId !== "") { writer.uint32(10).string(message.portId); @@ -4079,6 +4337,12 @@ export const QueryPacketAcknowledgementsRequest = { typeUrl: "/ibc.core.channel.v1.QueryPacketAcknowledgementsRequest", value: QueryPacketAcknowledgementsRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryPacketAcknowledgementsRequest.typeUrl)) { + return; + } + PageRequest.registerTypeUrl(); } }; function createBaseQueryPacketAcknowledgementsResponse(): QueryPacketAcknowledgementsResponse { @@ -4098,6 +4362,15 @@ function createBaseQueryPacketAcknowledgementsResponse(): QueryPacketAcknowledge export const QueryPacketAcknowledgementsResponse = { typeUrl: "/ibc.core.channel.v1.QueryPacketAcknowledgementsResponse", aminoType: "cosmos-sdk/QueryPacketAcknowledgementsResponse", + is(o: any): o is QueryPacketAcknowledgementsResponse { + return o && (o.$typeUrl === QueryPacketAcknowledgementsResponse.typeUrl || Array.isArray(o.acknowledgements) && (!o.acknowledgements.length || PacketState.is(o.acknowledgements[0])) && Height.is(o.height)); + }, + isSDK(o: any): o is QueryPacketAcknowledgementsResponseSDKType { + return o && (o.$typeUrl === QueryPacketAcknowledgementsResponse.typeUrl || Array.isArray(o.acknowledgements) && (!o.acknowledgements.length || PacketState.isSDK(o.acknowledgements[0])) && Height.isSDK(o.height)); + }, + isAmino(o: any): o is QueryPacketAcknowledgementsResponseAmino { + return o && (o.$typeUrl === QueryPacketAcknowledgementsResponse.typeUrl || Array.isArray(o.acknowledgements) && (!o.acknowledgements.length || PacketState.isAmino(o.acknowledgements[0])) && Height.isAmino(o.height)); + }, encode(message: QueryPacketAcknowledgementsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.acknowledgements) { PacketState.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -4222,6 +4495,14 @@ export const QueryPacketAcknowledgementsResponse = { typeUrl: "/ibc.core.channel.v1.QueryPacketAcknowledgementsResponse", value: QueryPacketAcknowledgementsResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryPacketAcknowledgementsResponse.typeUrl)) { + return; + } + PacketState.registerTypeUrl(); + PageResponse.registerTypeUrl(); + Height.registerTypeUrl(); } }; function createBaseQueryUnreceivedPacketsRequest(): QueryUnreceivedPacketsRequest { @@ -4241,6 +4522,15 @@ function createBaseQueryUnreceivedPacketsRequest(): QueryUnreceivedPacketsReques export const QueryUnreceivedPacketsRequest = { typeUrl: "/ibc.core.channel.v1.QueryUnreceivedPacketsRequest", aminoType: "cosmos-sdk/QueryUnreceivedPacketsRequest", + is(o: any): o is QueryUnreceivedPacketsRequest { + return o && (o.$typeUrl === QueryUnreceivedPacketsRequest.typeUrl || typeof o.portId === "string" && typeof o.channelId === "string" && Array.isArray(o.packetCommitmentSequences) && (!o.packetCommitmentSequences.length || typeof o.packetCommitmentSequences[0] === "bigint")); + }, + isSDK(o: any): o is QueryUnreceivedPacketsRequestSDKType { + return o && (o.$typeUrl === QueryUnreceivedPacketsRequest.typeUrl || typeof o.port_id === "string" && typeof o.channel_id === "string" && Array.isArray(o.packet_commitment_sequences) && (!o.packet_commitment_sequences.length || typeof o.packet_commitment_sequences[0] === "bigint")); + }, + isAmino(o: any): o is QueryUnreceivedPacketsRequestAmino { + return o && (o.$typeUrl === QueryUnreceivedPacketsRequest.typeUrl || typeof o.port_id === "string" && typeof o.channel_id === "string" && Array.isArray(o.packet_commitment_sequences) && (!o.packet_commitment_sequences.length || typeof o.packet_commitment_sequences[0] === "bigint")); + }, encode(message: QueryUnreceivedPacketsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.portId !== "") { writer.uint32(10).string(message.portId); @@ -4370,7 +4660,8 @@ export const QueryUnreceivedPacketsRequest = { typeUrl: "/ibc.core.channel.v1.QueryUnreceivedPacketsRequest", value: QueryUnreceivedPacketsRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryUnreceivedPacketsResponse(): QueryUnreceivedPacketsResponse { return { @@ -4388,6 +4679,15 @@ function createBaseQueryUnreceivedPacketsResponse(): QueryUnreceivedPacketsRespo export const QueryUnreceivedPacketsResponse = { typeUrl: "/ibc.core.channel.v1.QueryUnreceivedPacketsResponse", aminoType: "cosmos-sdk/QueryUnreceivedPacketsResponse", + is(o: any): o is QueryUnreceivedPacketsResponse { + return o && (o.$typeUrl === QueryUnreceivedPacketsResponse.typeUrl || Array.isArray(o.sequences) && (!o.sequences.length || typeof o.sequences[0] === "bigint") && Height.is(o.height)); + }, + isSDK(o: any): o is QueryUnreceivedPacketsResponseSDKType { + return o && (o.$typeUrl === QueryUnreceivedPacketsResponse.typeUrl || Array.isArray(o.sequences) && (!o.sequences.length || typeof o.sequences[0] === "bigint") && Height.isSDK(o.height)); + }, + isAmino(o: any): o is QueryUnreceivedPacketsResponseAmino { + return o && (o.$typeUrl === QueryUnreceivedPacketsResponse.typeUrl || Array.isArray(o.sequences) && (!o.sequences.length || typeof o.sequences[0] === "bigint") && Height.isAmino(o.height)); + }, encode(message: QueryUnreceivedPacketsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { writer.uint32(10).fork(); for (const v of message.sequences) { @@ -4504,6 +4804,12 @@ export const QueryUnreceivedPacketsResponse = { typeUrl: "/ibc.core.channel.v1.QueryUnreceivedPacketsResponse", value: QueryUnreceivedPacketsResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryUnreceivedPacketsResponse.typeUrl)) { + return; + } + Height.registerTypeUrl(); } }; function createBaseQueryUnreceivedAcksRequest(): QueryUnreceivedAcksRequest { @@ -4523,6 +4829,15 @@ function createBaseQueryUnreceivedAcksRequest(): QueryUnreceivedAcksRequest { export const QueryUnreceivedAcksRequest = { typeUrl: "/ibc.core.channel.v1.QueryUnreceivedAcksRequest", aminoType: "cosmos-sdk/QueryUnreceivedAcksRequest", + is(o: any): o is QueryUnreceivedAcksRequest { + return o && (o.$typeUrl === QueryUnreceivedAcksRequest.typeUrl || typeof o.portId === "string" && typeof o.channelId === "string" && Array.isArray(o.packetAckSequences) && (!o.packetAckSequences.length || typeof o.packetAckSequences[0] === "bigint")); + }, + isSDK(o: any): o is QueryUnreceivedAcksRequestSDKType { + return o && (o.$typeUrl === QueryUnreceivedAcksRequest.typeUrl || typeof o.port_id === "string" && typeof o.channel_id === "string" && Array.isArray(o.packet_ack_sequences) && (!o.packet_ack_sequences.length || typeof o.packet_ack_sequences[0] === "bigint")); + }, + isAmino(o: any): o is QueryUnreceivedAcksRequestAmino { + return o && (o.$typeUrl === QueryUnreceivedAcksRequest.typeUrl || typeof o.port_id === "string" && typeof o.channel_id === "string" && Array.isArray(o.packet_ack_sequences) && (!o.packet_ack_sequences.length || typeof o.packet_ack_sequences[0] === "bigint")); + }, encode(message: QueryUnreceivedAcksRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.portId !== "") { writer.uint32(10).string(message.portId); @@ -4652,7 +4967,8 @@ export const QueryUnreceivedAcksRequest = { typeUrl: "/ibc.core.channel.v1.QueryUnreceivedAcksRequest", value: QueryUnreceivedAcksRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryUnreceivedAcksResponse(): QueryUnreceivedAcksResponse { return { @@ -4670,6 +4986,15 @@ function createBaseQueryUnreceivedAcksResponse(): QueryUnreceivedAcksResponse { export const QueryUnreceivedAcksResponse = { typeUrl: "/ibc.core.channel.v1.QueryUnreceivedAcksResponse", aminoType: "cosmos-sdk/QueryUnreceivedAcksResponse", + is(o: any): o is QueryUnreceivedAcksResponse { + return o && (o.$typeUrl === QueryUnreceivedAcksResponse.typeUrl || Array.isArray(o.sequences) && (!o.sequences.length || typeof o.sequences[0] === "bigint") && Height.is(o.height)); + }, + isSDK(o: any): o is QueryUnreceivedAcksResponseSDKType { + return o && (o.$typeUrl === QueryUnreceivedAcksResponse.typeUrl || Array.isArray(o.sequences) && (!o.sequences.length || typeof o.sequences[0] === "bigint") && Height.isSDK(o.height)); + }, + isAmino(o: any): o is QueryUnreceivedAcksResponseAmino { + return o && (o.$typeUrl === QueryUnreceivedAcksResponse.typeUrl || Array.isArray(o.sequences) && (!o.sequences.length || typeof o.sequences[0] === "bigint") && Height.isAmino(o.height)); + }, encode(message: QueryUnreceivedAcksResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { writer.uint32(10).fork(); for (const v of message.sequences) { @@ -4786,6 +5111,12 @@ export const QueryUnreceivedAcksResponse = { typeUrl: "/ibc.core.channel.v1.QueryUnreceivedAcksResponse", value: QueryUnreceivedAcksResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryUnreceivedAcksResponse.typeUrl)) { + return; + } + Height.registerTypeUrl(); } }; function createBaseQueryNextSequenceReceiveRequest(): QueryNextSequenceReceiveRequest { @@ -4804,6 +5135,15 @@ function createBaseQueryNextSequenceReceiveRequest(): QueryNextSequenceReceiveRe export const QueryNextSequenceReceiveRequest = { typeUrl: "/ibc.core.channel.v1.QueryNextSequenceReceiveRequest", aminoType: "cosmos-sdk/QueryNextSequenceReceiveRequest", + is(o: any): o is QueryNextSequenceReceiveRequest { + return o && (o.$typeUrl === QueryNextSequenceReceiveRequest.typeUrl || typeof o.portId === "string" && typeof o.channelId === "string"); + }, + isSDK(o: any): o is QueryNextSequenceReceiveRequestSDKType { + return o && (o.$typeUrl === QueryNextSequenceReceiveRequest.typeUrl || typeof o.port_id === "string" && typeof o.channel_id === "string"); + }, + isAmino(o: any): o is QueryNextSequenceReceiveRequestAmino { + return o && (o.$typeUrl === QueryNextSequenceReceiveRequest.typeUrl || typeof o.port_id === "string" && typeof o.channel_id === "string"); + }, encode(message: QueryNextSequenceReceiveRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.portId !== "") { writer.uint32(10).string(message.portId); @@ -4899,7 +5239,8 @@ export const QueryNextSequenceReceiveRequest = { typeUrl: "/ibc.core.channel.v1.QueryNextSequenceReceiveRequest", value: QueryNextSequenceReceiveRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryNextSequenceReceiveResponse(): QueryNextSequenceReceiveResponse { return { @@ -4918,6 +5259,15 @@ function createBaseQueryNextSequenceReceiveResponse(): QueryNextSequenceReceiveR export const QueryNextSequenceReceiveResponse = { typeUrl: "/ibc.core.channel.v1.QueryNextSequenceReceiveResponse", aminoType: "cosmos-sdk/QueryNextSequenceReceiveResponse", + is(o: any): o is QueryNextSequenceReceiveResponse { + return o && (o.$typeUrl === QueryNextSequenceReceiveResponse.typeUrl || typeof o.nextSequenceReceive === "bigint" && (o.proof instanceof Uint8Array || typeof o.proof === "string") && Height.is(o.proofHeight)); + }, + isSDK(o: any): o is QueryNextSequenceReceiveResponseSDKType { + return o && (o.$typeUrl === QueryNextSequenceReceiveResponse.typeUrl || typeof o.next_sequence_receive === "bigint" && (o.proof instanceof Uint8Array || typeof o.proof === "string") && Height.isSDK(o.proof_height)); + }, + isAmino(o: any): o is QueryNextSequenceReceiveResponseAmino { + return o && (o.$typeUrl === QueryNextSequenceReceiveResponse.typeUrl || typeof o.next_sequence_receive === "bigint" && (o.proof instanceof Uint8Array || typeof o.proof === "string") && Height.isAmino(o.proof_height)); + }, encode(message: QueryNextSequenceReceiveResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.nextSequenceReceive !== BigInt(0)) { writer.uint32(8).uint64(message.nextSequenceReceive); @@ -5032,5 +5382,11 @@ export const QueryNextSequenceReceiveResponse = { typeUrl: "/ibc.core.channel.v1.QueryNextSequenceReceiveResponse", value: QueryNextSequenceReceiveResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryNextSequenceReceiveResponse.typeUrl)) { + return; + } + Height.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/ibc/core/channel/v1/tx.registry.ts b/__fixtures__/v-next/outputv2/ibc/core/channel/v1/tx.registry.ts index a637c775f2..d13cf1dbe6 100644 --- a/__fixtures__/v-next/outputv2/ibc/core/channel/v1/tx.registry.ts +++ b/__fixtures__/v-next/outputv2/ibc/core/channel/v1/tx.registry.ts @@ -1,11 +1,6 @@ -import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { TelescopeGeneratedType } from "../../../../types"; import { MsgChannelOpenInit, MsgChannelOpenTry, MsgChannelOpenAck, MsgChannelOpenConfirm, MsgChannelCloseInit, MsgChannelCloseConfirm, MsgRecvPacket, MsgTimeout, MsgTimeoutOnClose, MsgAcknowledgement } from "./tx"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/ibc.core.channel.v1.MsgChannelOpenInit", MsgChannelOpenInit], ["/ibc.core.channel.v1.MsgChannelOpenTry", MsgChannelOpenTry], ["/ibc.core.channel.v1.MsgChannelOpenAck", MsgChannelOpenAck], ["/ibc.core.channel.v1.MsgChannelOpenConfirm", MsgChannelOpenConfirm], ["/ibc.core.channel.v1.MsgChannelCloseInit", MsgChannelCloseInit], ["/ibc.core.channel.v1.MsgChannelCloseConfirm", MsgChannelCloseConfirm], ["/ibc.core.channel.v1.MsgRecvPacket", MsgRecvPacket], ["/ibc.core.channel.v1.MsgTimeout", MsgTimeout], ["/ibc.core.channel.v1.MsgTimeoutOnClose", MsgTimeoutOnClose], ["/ibc.core.channel.v1.MsgAcknowledgement", MsgAcknowledgement]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/ibc.core.channel.v1.MsgChannelOpenInit", MsgChannelOpenInit], ["/ibc.core.channel.v1.MsgChannelOpenTry", MsgChannelOpenTry], ["/ibc.core.channel.v1.MsgChannelOpenAck", MsgChannelOpenAck], ["/ibc.core.channel.v1.MsgChannelOpenConfirm", MsgChannelOpenConfirm], ["/ibc.core.channel.v1.MsgChannelCloseInit", MsgChannelCloseInit], ["/ibc.core.channel.v1.MsgChannelCloseConfirm", MsgChannelCloseConfirm], ["/ibc.core.channel.v1.MsgRecvPacket", MsgRecvPacket], ["/ibc.core.channel.v1.MsgTimeout", MsgTimeout], ["/ibc.core.channel.v1.MsgTimeoutOnClose", MsgTimeoutOnClose], ["/ibc.core.channel.v1.MsgAcknowledgement", MsgAcknowledgement]]; export const MessageComposer = { encoded: { channelOpenInit(value: MsgChannelOpenInit) { diff --git a/__fixtures__/v-next/outputv2/ibc/core/channel/v1/tx.rpc.func.ts b/__fixtures__/v-next/outputv2/ibc/core/channel/v1/tx.rpc.func.ts new file mode 100644 index 0000000000..ecafdb51eb --- /dev/null +++ b/__fixtures__/v-next/outputv2/ibc/core/channel/v1/tx.rpc.func.ts @@ -0,0 +1,93 @@ +import { buildTx } from "../../../../helper-func-types"; +import { MsgChannelOpenInit, MsgChannelOpenTry, MsgChannelOpenAck, MsgChannelOpenConfirm, MsgChannelCloseInit, MsgChannelCloseConfirm, MsgRecvPacket, MsgTimeout, MsgTimeoutOnClose, MsgAcknowledgement } from "./tx"; +/** + * ChannelOpenInit defines a rpc handler method for MsgChannelOpenInit. + * @name channelOpenInit + * @package ibc.core.channel.v1 + * @see proto service: ibc.core.channel.v1.ChannelOpenInit + */ +export const channelOpenInit = buildTx({ + msg: MsgChannelOpenInit +}); +/** + * ChannelOpenTry defines a rpc handler method for MsgChannelOpenTry. + * @name channelOpenTry + * @package ibc.core.channel.v1 + * @see proto service: ibc.core.channel.v1.ChannelOpenTry + */ +export const channelOpenTry = buildTx({ + msg: MsgChannelOpenTry +}); +/** + * ChannelOpenAck defines a rpc handler method for MsgChannelOpenAck. + * @name channelOpenAck + * @package ibc.core.channel.v1 + * @see proto service: ibc.core.channel.v1.ChannelOpenAck + */ +export const channelOpenAck = buildTx({ + msg: MsgChannelOpenAck +}); +/** + * ChannelOpenConfirm defines a rpc handler method for MsgChannelOpenConfirm. + * @name channelOpenConfirm + * @package ibc.core.channel.v1 + * @see proto service: ibc.core.channel.v1.ChannelOpenConfirm + */ +export const channelOpenConfirm = buildTx({ + msg: MsgChannelOpenConfirm +}); +/** + * ChannelCloseInit defines a rpc handler method for MsgChannelCloseInit. + * @name channelCloseInit + * @package ibc.core.channel.v1 + * @see proto service: ibc.core.channel.v1.ChannelCloseInit + */ +export const channelCloseInit = buildTx({ + msg: MsgChannelCloseInit +}); +/** + * ChannelCloseConfirm defines a rpc handler method for + * MsgChannelCloseConfirm. + * @name channelCloseConfirm + * @package ibc.core.channel.v1 + * @see proto service: ibc.core.channel.v1.ChannelCloseConfirm + */ +export const channelCloseConfirm = buildTx({ + msg: MsgChannelCloseConfirm +}); +/** + * RecvPacket defines a rpc handler method for MsgRecvPacket. + * @name recvPacket + * @package ibc.core.channel.v1 + * @see proto service: ibc.core.channel.v1.RecvPacket + */ +export const recvPacket = buildTx({ + msg: MsgRecvPacket +}); +/** + * Timeout defines a rpc handler method for MsgTimeout. + * @name timeout + * @package ibc.core.channel.v1 + * @see proto service: ibc.core.channel.v1.Timeout + */ +export const timeout = buildTx({ + msg: MsgTimeout +}); +/** + * TimeoutOnClose defines a rpc handler method for MsgTimeoutOnClose. + * @name timeoutOnClose + * @package ibc.core.channel.v1 + * @see proto service: ibc.core.channel.v1.TimeoutOnClose + */ +export const timeoutOnClose = buildTx({ + msg: MsgTimeoutOnClose +}); +/** + * Acknowledgement defines a rpc handler method for MsgAcknowledgement. + * @name acknowledgement + * @package ibc.core.channel.v1 + * @see proto service: ibc.core.channel.v1.Acknowledgement + */ +export const acknowledgement = buildTx({ + msg: MsgAcknowledgement +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/ibc/core/channel/v1/tx.ts b/__fixtures__/v-next/outputv2/ibc/core/channel/v1/tx.ts index 6e86dc9dea..1be7b0f94c 100644 --- a/__fixtures__/v-next/outputv2/ibc/core/channel/v1/tx.ts +++ b/__fixtures__/v-next/outputv2/ibc/core/channel/v1/tx.ts @@ -1,6 +1,7 @@ import { Channel, ChannelAmino, ChannelSDKType, Packet, PacketAmino, PacketSDKType } from "./channel"; import { Height, HeightAmino, HeightSDKType } from "../../client/v1/client"; import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { GlobalDecoderRegistry } from "../../../../registry"; import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../../helpers"; import { JsonSafe } from "../../../../json-safe"; export const protobufPackage = "ibc.core.channel.v1"; @@ -813,6 +814,15 @@ function createBaseMsgChannelOpenInit(): MsgChannelOpenInit { export const MsgChannelOpenInit = { typeUrl: "/ibc.core.channel.v1.MsgChannelOpenInit", aminoType: "cosmos-sdk/MsgChannelOpenInit", + is(o: any): o is MsgChannelOpenInit { + return o && (o.$typeUrl === MsgChannelOpenInit.typeUrl || typeof o.portId === "string" && Channel.is(o.channel) && typeof o.signer === "string"); + }, + isSDK(o: any): o is MsgChannelOpenInitSDKType { + return o && (o.$typeUrl === MsgChannelOpenInit.typeUrl || typeof o.port_id === "string" && Channel.isSDK(o.channel) && typeof o.signer === "string"); + }, + isAmino(o: any): o is MsgChannelOpenInitAmino { + return o && (o.$typeUrl === MsgChannelOpenInit.typeUrl || typeof o.port_id === "string" && Channel.isAmino(o.channel) && typeof o.signer === "string"); + }, encode(message: MsgChannelOpenInit, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.portId !== "") { writer.uint32(10).string(message.portId); @@ -925,6 +935,12 @@ export const MsgChannelOpenInit = { typeUrl: "/ibc.core.channel.v1.MsgChannelOpenInit", value: MsgChannelOpenInit.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgChannelOpenInit.typeUrl)) { + return; + } + Channel.registerTypeUrl(); } }; function createBaseMsgChannelOpenInitResponse(): MsgChannelOpenInitResponse { @@ -939,6 +955,15 @@ function createBaseMsgChannelOpenInitResponse(): MsgChannelOpenInitResponse { export const MsgChannelOpenInitResponse = { typeUrl: "/ibc.core.channel.v1.MsgChannelOpenInitResponse", aminoType: "cosmos-sdk/MsgChannelOpenInitResponse", + is(o: any): o is MsgChannelOpenInitResponse { + return o && o.$typeUrl === MsgChannelOpenInitResponse.typeUrl; + }, + isSDK(o: any): o is MsgChannelOpenInitResponseSDKType { + return o && o.$typeUrl === MsgChannelOpenInitResponse.typeUrl; + }, + isAmino(o: any): o is MsgChannelOpenInitResponseAmino { + return o && o.$typeUrl === MsgChannelOpenInitResponse.typeUrl; + }, encode(_: MsgChannelOpenInitResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -1003,7 +1028,8 @@ export const MsgChannelOpenInitResponse = { typeUrl: "/ibc.core.channel.v1.MsgChannelOpenInitResponse", value: MsgChannelOpenInitResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgChannelOpenTry(): MsgChannelOpenTry { return { @@ -1026,6 +1052,15 @@ function createBaseMsgChannelOpenTry(): MsgChannelOpenTry { export const MsgChannelOpenTry = { typeUrl: "/ibc.core.channel.v1.MsgChannelOpenTry", aminoType: "cosmos-sdk/MsgChannelOpenTry", + is(o: any): o is MsgChannelOpenTry { + return o && (o.$typeUrl === MsgChannelOpenTry.typeUrl || typeof o.portId === "string" && typeof o.previousChannelId === "string" && Channel.is(o.channel) && typeof o.counterpartyVersion === "string" && (o.proofInit instanceof Uint8Array || typeof o.proofInit === "string") && Height.is(o.proofHeight) && typeof o.signer === "string"); + }, + isSDK(o: any): o is MsgChannelOpenTrySDKType { + return o && (o.$typeUrl === MsgChannelOpenTry.typeUrl || typeof o.port_id === "string" && typeof o.previous_channel_id === "string" && Channel.isSDK(o.channel) && typeof o.counterparty_version === "string" && (o.proof_init instanceof Uint8Array || typeof o.proof_init === "string") && Height.isSDK(o.proof_height) && typeof o.signer === "string"); + }, + isAmino(o: any): o is MsgChannelOpenTryAmino { + return o && (o.$typeUrl === MsgChannelOpenTry.typeUrl || typeof o.port_id === "string" && typeof o.previous_channel_id === "string" && Channel.isAmino(o.channel) && typeof o.counterparty_version === "string" && (o.proof_init instanceof Uint8Array || typeof o.proof_init === "string") && Height.isAmino(o.proof_height) && typeof o.signer === "string"); + }, encode(message: MsgChannelOpenTry, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.portId !== "") { writer.uint32(10).string(message.portId); @@ -1200,6 +1235,13 @@ export const MsgChannelOpenTry = { typeUrl: "/ibc.core.channel.v1.MsgChannelOpenTry", value: MsgChannelOpenTry.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgChannelOpenTry.typeUrl)) { + return; + } + Channel.registerTypeUrl(); + Height.registerTypeUrl(); } }; function createBaseMsgChannelOpenTryResponse(): MsgChannelOpenTryResponse { @@ -1214,6 +1256,15 @@ function createBaseMsgChannelOpenTryResponse(): MsgChannelOpenTryResponse { export const MsgChannelOpenTryResponse = { typeUrl: "/ibc.core.channel.v1.MsgChannelOpenTryResponse", aminoType: "cosmos-sdk/MsgChannelOpenTryResponse", + is(o: any): o is MsgChannelOpenTryResponse { + return o && o.$typeUrl === MsgChannelOpenTryResponse.typeUrl; + }, + isSDK(o: any): o is MsgChannelOpenTryResponseSDKType { + return o && o.$typeUrl === MsgChannelOpenTryResponse.typeUrl; + }, + isAmino(o: any): o is MsgChannelOpenTryResponseAmino { + return o && o.$typeUrl === MsgChannelOpenTryResponse.typeUrl; + }, encode(_: MsgChannelOpenTryResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -1278,7 +1329,8 @@ export const MsgChannelOpenTryResponse = { typeUrl: "/ibc.core.channel.v1.MsgChannelOpenTryResponse", value: MsgChannelOpenTryResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgChannelOpenAck(): MsgChannelOpenAck { return { @@ -1301,6 +1353,15 @@ function createBaseMsgChannelOpenAck(): MsgChannelOpenAck { export const MsgChannelOpenAck = { typeUrl: "/ibc.core.channel.v1.MsgChannelOpenAck", aminoType: "cosmos-sdk/MsgChannelOpenAck", + is(o: any): o is MsgChannelOpenAck { + return o && (o.$typeUrl === MsgChannelOpenAck.typeUrl || typeof o.portId === "string" && typeof o.channelId === "string" && typeof o.counterpartyChannelId === "string" && typeof o.counterpartyVersion === "string" && (o.proofTry instanceof Uint8Array || typeof o.proofTry === "string") && Height.is(o.proofHeight) && typeof o.signer === "string"); + }, + isSDK(o: any): o is MsgChannelOpenAckSDKType { + return o && (o.$typeUrl === MsgChannelOpenAck.typeUrl || typeof o.port_id === "string" && typeof o.channel_id === "string" && typeof o.counterparty_channel_id === "string" && typeof o.counterparty_version === "string" && (o.proof_try instanceof Uint8Array || typeof o.proof_try === "string") && Height.isSDK(o.proof_height) && typeof o.signer === "string"); + }, + isAmino(o: any): o is MsgChannelOpenAckAmino { + return o && (o.$typeUrl === MsgChannelOpenAck.typeUrl || typeof o.port_id === "string" && typeof o.channel_id === "string" && typeof o.counterparty_channel_id === "string" && typeof o.counterparty_version === "string" && (o.proof_try instanceof Uint8Array || typeof o.proof_try === "string") && Height.isAmino(o.proof_height) && typeof o.signer === "string"); + }, encode(message: MsgChannelOpenAck, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.portId !== "") { writer.uint32(10).string(message.portId); @@ -1473,6 +1534,12 @@ export const MsgChannelOpenAck = { typeUrl: "/ibc.core.channel.v1.MsgChannelOpenAck", value: MsgChannelOpenAck.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgChannelOpenAck.typeUrl)) { + return; + } + Height.registerTypeUrl(); } }; function createBaseMsgChannelOpenAckResponse(): MsgChannelOpenAckResponse { @@ -1487,6 +1554,15 @@ function createBaseMsgChannelOpenAckResponse(): MsgChannelOpenAckResponse { export const MsgChannelOpenAckResponse = { typeUrl: "/ibc.core.channel.v1.MsgChannelOpenAckResponse", aminoType: "cosmos-sdk/MsgChannelOpenAckResponse", + is(o: any): o is MsgChannelOpenAckResponse { + return o && o.$typeUrl === MsgChannelOpenAckResponse.typeUrl; + }, + isSDK(o: any): o is MsgChannelOpenAckResponseSDKType { + return o && o.$typeUrl === MsgChannelOpenAckResponse.typeUrl; + }, + isAmino(o: any): o is MsgChannelOpenAckResponseAmino { + return o && o.$typeUrl === MsgChannelOpenAckResponse.typeUrl; + }, encode(_: MsgChannelOpenAckResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -1551,7 +1627,8 @@ export const MsgChannelOpenAckResponse = { typeUrl: "/ibc.core.channel.v1.MsgChannelOpenAckResponse", value: MsgChannelOpenAckResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgChannelOpenConfirm(): MsgChannelOpenConfirm { return { @@ -1572,6 +1649,15 @@ function createBaseMsgChannelOpenConfirm(): MsgChannelOpenConfirm { export const MsgChannelOpenConfirm = { typeUrl: "/ibc.core.channel.v1.MsgChannelOpenConfirm", aminoType: "cosmos-sdk/MsgChannelOpenConfirm", + is(o: any): o is MsgChannelOpenConfirm { + return o && (o.$typeUrl === MsgChannelOpenConfirm.typeUrl || typeof o.portId === "string" && typeof o.channelId === "string" && (o.proofAck instanceof Uint8Array || typeof o.proofAck === "string") && Height.is(o.proofHeight) && typeof o.signer === "string"); + }, + isSDK(o: any): o is MsgChannelOpenConfirmSDKType { + return o && (o.$typeUrl === MsgChannelOpenConfirm.typeUrl || typeof o.port_id === "string" && typeof o.channel_id === "string" && (o.proof_ack instanceof Uint8Array || typeof o.proof_ack === "string") && Height.isSDK(o.proof_height) && typeof o.signer === "string"); + }, + isAmino(o: any): o is MsgChannelOpenConfirmAmino { + return o && (o.$typeUrl === MsgChannelOpenConfirm.typeUrl || typeof o.port_id === "string" && typeof o.channel_id === "string" && (o.proof_ack instanceof Uint8Array || typeof o.proof_ack === "string") && Height.isAmino(o.proof_height) && typeof o.signer === "string"); + }, encode(message: MsgChannelOpenConfirm, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.portId !== "") { writer.uint32(10).string(message.portId); @@ -1714,6 +1800,12 @@ export const MsgChannelOpenConfirm = { typeUrl: "/ibc.core.channel.v1.MsgChannelOpenConfirm", value: MsgChannelOpenConfirm.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgChannelOpenConfirm.typeUrl)) { + return; + } + Height.registerTypeUrl(); } }; function createBaseMsgChannelOpenConfirmResponse(): MsgChannelOpenConfirmResponse { @@ -1729,6 +1821,15 @@ function createBaseMsgChannelOpenConfirmResponse(): MsgChannelOpenConfirmRespons export const MsgChannelOpenConfirmResponse = { typeUrl: "/ibc.core.channel.v1.MsgChannelOpenConfirmResponse", aminoType: "cosmos-sdk/MsgChannelOpenConfirmResponse", + is(o: any): o is MsgChannelOpenConfirmResponse { + return o && o.$typeUrl === MsgChannelOpenConfirmResponse.typeUrl; + }, + isSDK(o: any): o is MsgChannelOpenConfirmResponseSDKType { + return o && o.$typeUrl === MsgChannelOpenConfirmResponse.typeUrl; + }, + isAmino(o: any): o is MsgChannelOpenConfirmResponseAmino { + return o && o.$typeUrl === MsgChannelOpenConfirmResponse.typeUrl; + }, encode(_: MsgChannelOpenConfirmResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -1793,7 +1894,8 @@ export const MsgChannelOpenConfirmResponse = { typeUrl: "/ibc.core.channel.v1.MsgChannelOpenConfirmResponse", value: MsgChannelOpenConfirmResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgChannelCloseInit(): MsgChannelCloseInit { return { @@ -1812,6 +1914,15 @@ function createBaseMsgChannelCloseInit(): MsgChannelCloseInit { export const MsgChannelCloseInit = { typeUrl: "/ibc.core.channel.v1.MsgChannelCloseInit", aminoType: "cosmos-sdk/MsgChannelCloseInit", + is(o: any): o is MsgChannelCloseInit { + return o && (o.$typeUrl === MsgChannelCloseInit.typeUrl || typeof o.portId === "string" && typeof o.channelId === "string" && typeof o.signer === "string"); + }, + isSDK(o: any): o is MsgChannelCloseInitSDKType { + return o && (o.$typeUrl === MsgChannelCloseInit.typeUrl || typeof o.port_id === "string" && typeof o.channel_id === "string" && typeof o.signer === "string"); + }, + isAmino(o: any): o is MsgChannelCloseInitAmino { + return o && (o.$typeUrl === MsgChannelCloseInit.typeUrl || typeof o.port_id === "string" && typeof o.channel_id === "string" && typeof o.signer === "string"); + }, encode(message: MsgChannelCloseInit, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.portId !== "") { writer.uint32(10).string(message.portId); @@ -1922,7 +2033,8 @@ export const MsgChannelCloseInit = { typeUrl: "/ibc.core.channel.v1.MsgChannelCloseInit", value: MsgChannelCloseInit.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgChannelCloseInitResponse(): MsgChannelCloseInitResponse { return {}; @@ -1936,6 +2048,15 @@ function createBaseMsgChannelCloseInitResponse(): MsgChannelCloseInitResponse { export const MsgChannelCloseInitResponse = { typeUrl: "/ibc.core.channel.v1.MsgChannelCloseInitResponse", aminoType: "cosmos-sdk/MsgChannelCloseInitResponse", + is(o: any): o is MsgChannelCloseInitResponse { + return o && o.$typeUrl === MsgChannelCloseInitResponse.typeUrl; + }, + isSDK(o: any): o is MsgChannelCloseInitResponseSDKType { + return o && o.$typeUrl === MsgChannelCloseInitResponse.typeUrl; + }, + isAmino(o: any): o is MsgChannelCloseInitResponseAmino { + return o && o.$typeUrl === MsgChannelCloseInitResponse.typeUrl; + }, encode(_: MsgChannelCloseInitResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -2000,7 +2121,8 @@ export const MsgChannelCloseInitResponse = { typeUrl: "/ibc.core.channel.v1.MsgChannelCloseInitResponse", value: MsgChannelCloseInitResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgChannelCloseConfirm(): MsgChannelCloseConfirm { return { @@ -2021,6 +2143,15 @@ function createBaseMsgChannelCloseConfirm(): MsgChannelCloseConfirm { export const MsgChannelCloseConfirm = { typeUrl: "/ibc.core.channel.v1.MsgChannelCloseConfirm", aminoType: "cosmos-sdk/MsgChannelCloseConfirm", + is(o: any): o is MsgChannelCloseConfirm { + return o && (o.$typeUrl === MsgChannelCloseConfirm.typeUrl || typeof o.portId === "string" && typeof o.channelId === "string" && (o.proofInit instanceof Uint8Array || typeof o.proofInit === "string") && Height.is(o.proofHeight) && typeof o.signer === "string"); + }, + isSDK(o: any): o is MsgChannelCloseConfirmSDKType { + return o && (o.$typeUrl === MsgChannelCloseConfirm.typeUrl || typeof o.port_id === "string" && typeof o.channel_id === "string" && (o.proof_init instanceof Uint8Array || typeof o.proof_init === "string") && Height.isSDK(o.proof_height) && typeof o.signer === "string"); + }, + isAmino(o: any): o is MsgChannelCloseConfirmAmino { + return o && (o.$typeUrl === MsgChannelCloseConfirm.typeUrl || typeof o.port_id === "string" && typeof o.channel_id === "string" && (o.proof_init instanceof Uint8Array || typeof o.proof_init === "string") && Height.isAmino(o.proof_height) && typeof o.signer === "string"); + }, encode(message: MsgChannelCloseConfirm, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.portId !== "") { writer.uint32(10).string(message.portId); @@ -2163,6 +2294,12 @@ export const MsgChannelCloseConfirm = { typeUrl: "/ibc.core.channel.v1.MsgChannelCloseConfirm", value: MsgChannelCloseConfirm.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgChannelCloseConfirm.typeUrl)) { + return; + } + Height.registerTypeUrl(); } }; function createBaseMsgChannelCloseConfirmResponse(): MsgChannelCloseConfirmResponse { @@ -2178,6 +2315,15 @@ function createBaseMsgChannelCloseConfirmResponse(): MsgChannelCloseConfirmRespo export const MsgChannelCloseConfirmResponse = { typeUrl: "/ibc.core.channel.v1.MsgChannelCloseConfirmResponse", aminoType: "cosmos-sdk/MsgChannelCloseConfirmResponse", + is(o: any): o is MsgChannelCloseConfirmResponse { + return o && o.$typeUrl === MsgChannelCloseConfirmResponse.typeUrl; + }, + isSDK(o: any): o is MsgChannelCloseConfirmResponseSDKType { + return o && o.$typeUrl === MsgChannelCloseConfirmResponse.typeUrl; + }, + isAmino(o: any): o is MsgChannelCloseConfirmResponseAmino { + return o && o.$typeUrl === MsgChannelCloseConfirmResponse.typeUrl; + }, encode(_: MsgChannelCloseConfirmResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -2242,7 +2388,8 @@ export const MsgChannelCloseConfirmResponse = { typeUrl: "/ibc.core.channel.v1.MsgChannelCloseConfirmResponse", value: MsgChannelCloseConfirmResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgRecvPacket(): MsgRecvPacket { return { @@ -2261,6 +2408,15 @@ function createBaseMsgRecvPacket(): MsgRecvPacket { export const MsgRecvPacket = { typeUrl: "/ibc.core.channel.v1.MsgRecvPacket", aminoType: "cosmos-sdk/MsgRecvPacket", + is(o: any): o is MsgRecvPacket { + return o && (o.$typeUrl === MsgRecvPacket.typeUrl || Packet.is(o.packet) && (o.proofCommitment instanceof Uint8Array || typeof o.proofCommitment === "string") && Height.is(o.proofHeight) && typeof o.signer === "string"); + }, + isSDK(o: any): o is MsgRecvPacketSDKType { + return o && (o.$typeUrl === MsgRecvPacket.typeUrl || Packet.isSDK(o.packet) && (o.proof_commitment instanceof Uint8Array || typeof o.proof_commitment === "string") && Height.isSDK(o.proof_height) && typeof o.signer === "string"); + }, + isAmino(o: any): o is MsgRecvPacketAmino { + return o && (o.$typeUrl === MsgRecvPacket.typeUrl || Packet.isAmino(o.packet) && (o.proof_commitment instanceof Uint8Array || typeof o.proof_commitment === "string") && Height.isAmino(o.proof_height) && typeof o.signer === "string"); + }, encode(message: MsgRecvPacket, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.packet !== undefined) { Packet.encode(message.packet, writer.uint32(10).fork()).ldelim(); @@ -2390,6 +2546,13 @@ export const MsgRecvPacket = { typeUrl: "/ibc.core.channel.v1.MsgRecvPacket", value: MsgRecvPacket.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgRecvPacket.typeUrl)) { + return; + } + Packet.registerTypeUrl(); + Height.registerTypeUrl(); } }; function createBaseMsgRecvPacketResponse(): MsgRecvPacketResponse { @@ -2404,6 +2567,15 @@ function createBaseMsgRecvPacketResponse(): MsgRecvPacketResponse { export const MsgRecvPacketResponse = { typeUrl: "/ibc.core.channel.v1.MsgRecvPacketResponse", aminoType: "cosmos-sdk/MsgRecvPacketResponse", + is(o: any): o is MsgRecvPacketResponse { + return o && o.$typeUrl === MsgRecvPacketResponse.typeUrl; + }, + isSDK(o: any): o is MsgRecvPacketResponseSDKType { + return o && o.$typeUrl === MsgRecvPacketResponse.typeUrl; + }, + isAmino(o: any): o is MsgRecvPacketResponseAmino { + return o && o.$typeUrl === MsgRecvPacketResponse.typeUrl; + }, encode(_: MsgRecvPacketResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -2468,7 +2640,8 @@ export const MsgRecvPacketResponse = { typeUrl: "/ibc.core.channel.v1.MsgRecvPacketResponse", value: MsgRecvPacketResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgTimeout(): MsgTimeout { return { @@ -2488,6 +2661,15 @@ function createBaseMsgTimeout(): MsgTimeout { export const MsgTimeout = { typeUrl: "/ibc.core.channel.v1.MsgTimeout", aminoType: "cosmos-sdk/MsgTimeout", + is(o: any): o is MsgTimeout { + return o && (o.$typeUrl === MsgTimeout.typeUrl || Packet.is(o.packet) && (o.proofUnreceived instanceof Uint8Array || typeof o.proofUnreceived === "string") && Height.is(o.proofHeight) && typeof o.nextSequenceRecv === "bigint" && typeof o.signer === "string"); + }, + isSDK(o: any): o is MsgTimeoutSDKType { + return o && (o.$typeUrl === MsgTimeout.typeUrl || Packet.isSDK(o.packet) && (o.proof_unreceived instanceof Uint8Array || typeof o.proof_unreceived === "string") && Height.isSDK(o.proof_height) && typeof o.next_sequence_recv === "bigint" && typeof o.signer === "string"); + }, + isAmino(o: any): o is MsgTimeoutAmino { + return o && (o.$typeUrl === MsgTimeout.typeUrl || Packet.isAmino(o.packet) && (o.proof_unreceived instanceof Uint8Array || typeof o.proof_unreceived === "string") && Height.isAmino(o.proof_height) && typeof o.next_sequence_recv === "bigint" && typeof o.signer === "string"); + }, encode(message: MsgTimeout, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.packet !== undefined) { Packet.encode(message.packet, writer.uint32(10).fork()).ldelim(); @@ -2634,6 +2816,13 @@ export const MsgTimeout = { typeUrl: "/ibc.core.channel.v1.MsgTimeout", value: MsgTimeout.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgTimeout.typeUrl)) { + return; + } + Packet.registerTypeUrl(); + Height.registerTypeUrl(); } }; function createBaseMsgTimeoutResponse(): MsgTimeoutResponse { @@ -2648,6 +2837,15 @@ function createBaseMsgTimeoutResponse(): MsgTimeoutResponse { export const MsgTimeoutResponse = { typeUrl: "/ibc.core.channel.v1.MsgTimeoutResponse", aminoType: "cosmos-sdk/MsgTimeoutResponse", + is(o: any): o is MsgTimeoutResponse { + return o && o.$typeUrl === MsgTimeoutResponse.typeUrl; + }, + isSDK(o: any): o is MsgTimeoutResponseSDKType { + return o && o.$typeUrl === MsgTimeoutResponse.typeUrl; + }, + isAmino(o: any): o is MsgTimeoutResponseAmino { + return o && o.$typeUrl === MsgTimeoutResponse.typeUrl; + }, encode(_: MsgTimeoutResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -2712,7 +2910,8 @@ export const MsgTimeoutResponse = { typeUrl: "/ibc.core.channel.v1.MsgTimeoutResponse", value: MsgTimeoutResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgTimeoutOnClose(): MsgTimeoutOnClose { return { @@ -2733,6 +2932,15 @@ function createBaseMsgTimeoutOnClose(): MsgTimeoutOnClose { export const MsgTimeoutOnClose = { typeUrl: "/ibc.core.channel.v1.MsgTimeoutOnClose", aminoType: "cosmos-sdk/MsgTimeoutOnClose", + is(o: any): o is MsgTimeoutOnClose { + return o && (o.$typeUrl === MsgTimeoutOnClose.typeUrl || Packet.is(o.packet) && (o.proofUnreceived instanceof Uint8Array || typeof o.proofUnreceived === "string") && (o.proofClose instanceof Uint8Array || typeof o.proofClose === "string") && Height.is(o.proofHeight) && typeof o.nextSequenceRecv === "bigint" && typeof o.signer === "string"); + }, + isSDK(o: any): o is MsgTimeoutOnCloseSDKType { + return o && (o.$typeUrl === MsgTimeoutOnClose.typeUrl || Packet.isSDK(o.packet) && (o.proof_unreceived instanceof Uint8Array || typeof o.proof_unreceived === "string") && (o.proof_close instanceof Uint8Array || typeof o.proof_close === "string") && Height.isSDK(o.proof_height) && typeof o.next_sequence_recv === "bigint" && typeof o.signer === "string"); + }, + isAmino(o: any): o is MsgTimeoutOnCloseAmino { + return o && (o.$typeUrl === MsgTimeoutOnClose.typeUrl || Packet.isAmino(o.packet) && (o.proof_unreceived instanceof Uint8Array || typeof o.proof_unreceived === "string") && (o.proof_close instanceof Uint8Array || typeof o.proof_close === "string") && Height.isAmino(o.proof_height) && typeof o.next_sequence_recv === "bigint" && typeof o.signer === "string"); + }, encode(message: MsgTimeoutOnClose, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.packet !== undefined) { Packet.encode(message.packet, writer.uint32(10).fork()).ldelim(); @@ -2894,6 +3102,13 @@ export const MsgTimeoutOnClose = { typeUrl: "/ibc.core.channel.v1.MsgTimeoutOnClose", value: MsgTimeoutOnClose.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgTimeoutOnClose.typeUrl)) { + return; + } + Packet.registerTypeUrl(); + Height.registerTypeUrl(); } }; function createBaseMsgTimeoutOnCloseResponse(): MsgTimeoutOnCloseResponse { @@ -2908,6 +3123,15 @@ function createBaseMsgTimeoutOnCloseResponse(): MsgTimeoutOnCloseResponse { export const MsgTimeoutOnCloseResponse = { typeUrl: "/ibc.core.channel.v1.MsgTimeoutOnCloseResponse", aminoType: "cosmos-sdk/MsgTimeoutOnCloseResponse", + is(o: any): o is MsgTimeoutOnCloseResponse { + return o && o.$typeUrl === MsgTimeoutOnCloseResponse.typeUrl; + }, + isSDK(o: any): o is MsgTimeoutOnCloseResponseSDKType { + return o && o.$typeUrl === MsgTimeoutOnCloseResponse.typeUrl; + }, + isAmino(o: any): o is MsgTimeoutOnCloseResponseAmino { + return o && o.$typeUrl === MsgTimeoutOnCloseResponse.typeUrl; + }, encode(_: MsgTimeoutOnCloseResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -2972,7 +3196,8 @@ export const MsgTimeoutOnCloseResponse = { typeUrl: "/ibc.core.channel.v1.MsgTimeoutOnCloseResponse", value: MsgTimeoutOnCloseResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgAcknowledgement(): MsgAcknowledgement { return { @@ -2992,6 +3217,15 @@ function createBaseMsgAcknowledgement(): MsgAcknowledgement { export const MsgAcknowledgement = { typeUrl: "/ibc.core.channel.v1.MsgAcknowledgement", aminoType: "cosmos-sdk/MsgAcknowledgement", + is(o: any): o is MsgAcknowledgement { + return o && (o.$typeUrl === MsgAcknowledgement.typeUrl || Packet.is(o.packet) && (o.acknowledgement instanceof Uint8Array || typeof o.acknowledgement === "string") && (o.proofAcked instanceof Uint8Array || typeof o.proofAcked === "string") && Height.is(o.proofHeight) && typeof o.signer === "string"); + }, + isSDK(o: any): o is MsgAcknowledgementSDKType { + return o && (o.$typeUrl === MsgAcknowledgement.typeUrl || Packet.isSDK(o.packet) && (o.acknowledgement instanceof Uint8Array || typeof o.acknowledgement === "string") && (o.proof_acked instanceof Uint8Array || typeof o.proof_acked === "string") && Height.isSDK(o.proof_height) && typeof o.signer === "string"); + }, + isAmino(o: any): o is MsgAcknowledgementAmino { + return o && (o.$typeUrl === MsgAcknowledgement.typeUrl || Packet.isAmino(o.packet) && (o.acknowledgement instanceof Uint8Array || typeof o.acknowledgement === "string") && (o.proof_acked instanceof Uint8Array || typeof o.proof_acked === "string") && Height.isAmino(o.proof_height) && typeof o.signer === "string"); + }, encode(message: MsgAcknowledgement, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.packet !== undefined) { Packet.encode(message.packet, writer.uint32(10).fork()).ldelim(); @@ -3136,6 +3370,13 @@ export const MsgAcknowledgement = { typeUrl: "/ibc.core.channel.v1.MsgAcknowledgement", value: MsgAcknowledgement.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgAcknowledgement.typeUrl)) { + return; + } + Packet.registerTypeUrl(); + Height.registerTypeUrl(); } }; function createBaseMsgAcknowledgementResponse(): MsgAcknowledgementResponse { @@ -3150,6 +3391,15 @@ function createBaseMsgAcknowledgementResponse(): MsgAcknowledgementResponse { export const MsgAcknowledgementResponse = { typeUrl: "/ibc.core.channel.v1.MsgAcknowledgementResponse", aminoType: "cosmos-sdk/MsgAcknowledgementResponse", + is(o: any): o is MsgAcknowledgementResponse { + return o && o.$typeUrl === MsgAcknowledgementResponse.typeUrl; + }, + isSDK(o: any): o is MsgAcknowledgementResponseSDKType { + return o && o.$typeUrl === MsgAcknowledgementResponse.typeUrl; + }, + isAmino(o: any): o is MsgAcknowledgementResponseAmino { + return o && o.$typeUrl === MsgAcknowledgementResponse.typeUrl; + }, encode(_: MsgAcknowledgementResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -3214,5 +3464,6 @@ export const MsgAcknowledgementResponse = { typeUrl: "/ibc.core.channel.v1.MsgAcknowledgementResponse", value: MsgAcknowledgementResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/ibc/core/client/v1/client.ts b/__fixtures__/v-next/outputv2/ibc/core/client/v1/client.ts index 43eda3a60d..9cb3db0532 100644 --- a/__fixtures__/v-next/outputv2/ibc/core/client/v1/client.ts +++ b/__fixtures__/v-next/outputv2/ibc/core/client/v1/client.ts @@ -1,6 +1,7 @@ import { Any, AnyAmino, AnySDKType } from "../../../../google/protobuf/any"; import { Plan, PlanAmino, PlanSDKType } from "../../../../cosmos/upgrade/v1beta1/upgrade"; import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { GlobalDecoderRegistry } from "../../../../registry"; import { isSet, DeepPartial } from "../../../../helpers"; import { JsonSafe } from "../../../../json-safe"; export const protobufPackage = "ibc.core.client.v1"; @@ -443,6 +444,15 @@ function createBaseIdentifiedClientState(): IdentifiedClientState { export const IdentifiedClientState = { typeUrl: "/ibc.core.client.v1.IdentifiedClientState", aminoType: "cosmos-sdk/IdentifiedClientState", + is(o: any): o is IdentifiedClientState { + return o && (o.$typeUrl === IdentifiedClientState.typeUrl || typeof o.clientId === "string"); + }, + isSDK(o: any): o is IdentifiedClientStateSDKType { + return o && (o.$typeUrl === IdentifiedClientState.typeUrl || typeof o.client_id === "string"); + }, + isAmino(o: any): o is IdentifiedClientStateAmino { + return o && (o.$typeUrl === IdentifiedClientState.typeUrl || typeof o.client_id === "string"); + }, encode(message: IdentifiedClientState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.clientId !== "") { writer.uint32(10).string(message.clientId); @@ -540,7 +550,8 @@ export const IdentifiedClientState = { typeUrl: "/ibc.core.client.v1.IdentifiedClientState", value: IdentifiedClientState.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseConsensusStateWithHeight(): ConsensusStateWithHeight { return { @@ -558,6 +569,15 @@ function createBaseConsensusStateWithHeight(): ConsensusStateWithHeight { export const ConsensusStateWithHeight = { typeUrl: "/ibc.core.client.v1.ConsensusStateWithHeight", aminoType: "cosmos-sdk/ConsensusStateWithHeight", + is(o: any): o is ConsensusStateWithHeight { + return o && (o.$typeUrl === ConsensusStateWithHeight.typeUrl || Height.is(o.height)); + }, + isSDK(o: any): o is ConsensusStateWithHeightSDKType { + return o && (o.$typeUrl === ConsensusStateWithHeight.typeUrl || Height.isSDK(o.height)); + }, + isAmino(o: any): o is ConsensusStateWithHeightAmino { + return o && (o.$typeUrl === ConsensusStateWithHeight.typeUrl || Height.isAmino(o.height)); + }, encode(message: ConsensusStateWithHeight, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.height !== undefined) { Height.encode(message.height, writer.uint32(10).fork()).ldelim(); @@ -657,7 +677,8 @@ export const ConsensusStateWithHeight = { typeUrl: "/ibc.core.client.v1.ConsensusStateWithHeight", value: ConsensusStateWithHeight.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseClientConsensusStates(): ClientConsensusStates { return { @@ -675,6 +696,15 @@ function createBaseClientConsensusStates(): ClientConsensusStates { export const ClientConsensusStates = { typeUrl: "/ibc.core.client.v1.ClientConsensusStates", aminoType: "cosmos-sdk/ClientConsensusStates", + is(o: any): o is ClientConsensusStates { + return o && (o.$typeUrl === ClientConsensusStates.typeUrl || typeof o.clientId === "string" && Array.isArray(o.consensusStates) && (!o.consensusStates.length || ConsensusStateWithHeight.is(o.consensusStates[0]))); + }, + isSDK(o: any): o is ClientConsensusStatesSDKType { + return o && (o.$typeUrl === ClientConsensusStates.typeUrl || typeof o.client_id === "string" && Array.isArray(o.consensus_states) && (!o.consensus_states.length || ConsensusStateWithHeight.isSDK(o.consensus_states[0]))); + }, + isAmino(o: any): o is ClientConsensusStatesAmino { + return o && (o.$typeUrl === ClientConsensusStates.typeUrl || typeof o.client_id === "string" && Array.isArray(o.consensus_states) && (!o.consensus_states.length || ConsensusStateWithHeight.isAmino(o.consensus_states[0]))); + }, encode(message: ClientConsensusStates, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.clientId !== "") { writer.uint32(10).string(message.clientId); @@ -780,6 +810,12 @@ export const ClientConsensusStates = { typeUrl: "/ibc.core.client.v1.ClientConsensusStates", value: ClientConsensusStates.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ClientConsensusStates.typeUrl)) { + return; + } + ConsensusStateWithHeight.registerTypeUrl(); } }; function createBaseClientUpdateProposal(): ClientUpdateProposal { @@ -803,6 +839,15 @@ function createBaseClientUpdateProposal(): ClientUpdateProposal { export const ClientUpdateProposal = { typeUrl: "/ibc.core.client.v1.ClientUpdateProposal", aminoType: "cosmos-sdk/ClientUpdateProposal", + is(o: any): o is ClientUpdateProposal { + return o && (o.$typeUrl === ClientUpdateProposal.typeUrl || typeof o.title === "string" && typeof o.description === "string" && typeof o.subjectClientId === "string" && typeof o.substituteClientId === "string"); + }, + isSDK(o: any): o is ClientUpdateProposalSDKType { + return o && (o.$typeUrl === ClientUpdateProposal.typeUrl || typeof o.title === "string" && typeof o.description === "string" && typeof o.subject_client_id === "string" && typeof o.substitute_client_id === "string"); + }, + isAmino(o: any): o is ClientUpdateProposalAmino { + return o && (o.$typeUrl === ClientUpdateProposal.typeUrl || typeof o.title === "string" && typeof o.description === "string" && typeof o.subject_client_id === "string" && typeof o.substitute_client_id === "string"); + }, encode(message: ClientUpdateProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.title !== "") { writer.uint32(10).string(message.title); @@ -928,6 +973,13 @@ export const ClientUpdateProposal = { typeUrl: "/ibc.core.client.v1.ClientUpdateProposal", value: ClientUpdateProposal.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ClientUpdateProposal.typeUrl)) { + return; + } + GlobalDecoderRegistry.register(ClientUpdateProposal.typeUrl, ClientUpdateProposal); + GlobalDecoderRegistry.registerAminoProtoMapping(ClientUpdateProposal.aminoType, ClientUpdateProposal.typeUrl); } }; function createBaseUpgradeProposal(): UpgradeProposal { @@ -949,6 +1001,15 @@ function createBaseUpgradeProposal(): UpgradeProposal { export const UpgradeProposal = { typeUrl: "/ibc.core.client.v1.UpgradeProposal", aminoType: "cosmos-sdk/UpgradeProposal", + is(o: any): o is UpgradeProposal { + return o && (o.$typeUrl === UpgradeProposal.typeUrl || typeof o.title === "string" && typeof o.description === "string" && Plan.is(o.plan)); + }, + isSDK(o: any): o is UpgradeProposalSDKType { + return o && (o.$typeUrl === UpgradeProposal.typeUrl || typeof o.title === "string" && typeof o.description === "string" && Plan.isSDK(o.plan)); + }, + isAmino(o: any): o is UpgradeProposalAmino { + return o && (o.$typeUrl === UpgradeProposal.typeUrl || typeof o.title === "string" && typeof o.description === "string" && Plan.isAmino(o.plan)); + }, encode(message: UpgradeProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.title !== "") { writer.uint32(10).string(message.title); @@ -1078,6 +1139,13 @@ export const UpgradeProposal = { typeUrl: "/ibc.core.client.v1.UpgradeProposal", value: UpgradeProposal.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(UpgradeProposal.typeUrl)) { + return; + } + GlobalDecoderRegistry.register(UpgradeProposal.typeUrl, UpgradeProposal); + GlobalDecoderRegistry.registerAminoProtoMapping(UpgradeProposal.aminoType, UpgradeProposal.typeUrl); } }; function createBaseHeight(): Height { @@ -1104,6 +1172,15 @@ function createBaseHeight(): Height { export const Height = { typeUrl: "/ibc.core.client.v1.Height", aminoType: "cosmos-sdk/Height", + is(o: any): o is Height { + return o && (o.$typeUrl === Height.typeUrl || typeof o.revisionNumber === "bigint" && typeof o.revisionHeight === "bigint"); + }, + isSDK(o: any): o is HeightSDKType { + return o && (o.$typeUrl === Height.typeUrl || typeof o.revision_number === "bigint" && typeof o.revision_height === "bigint"); + }, + isAmino(o: any): o is HeightAmino { + return o && (o.$typeUrl === Height.typeUrl || typeof o.revision_number === "bigint" && typeof o.revision_height === "bigint"); + }, encode(message: Height, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.revisionNumber !== BigInt(0)) { writer.uint32(8).uint64(message.revisionNumber); @@ -1199,7 +1276,8 @@ export const Height = { typeUrl: "/ibc.core.client.v1.Height", value: Height.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseParams(): Params { return { @@ -1215,6 +1293,15 @@ function createBaseParams(): Params { export const Params = { typeUrl: "/ibc.core.client.v1.Params", aminoType: "cosmos-sdk/Params", + is(o: any): o is Params { + return o && (o.$typeUrl === Params.typeUrl || Array.isArray(o.allowedClients) && (!o.allowedClients.length || typeof o.allowedClients[0] === "string")); + }, + isSDK(o: any): o is ParamsSDKType { + return o && (o.$typeUrl === Params.typeUrl || Array.isArray(o.allowed_clients) && (!o.allowed_clients.length || typeof o.allowed_clients[0] === "string")); + }, + isAmino(o: any): o is ParamsAmino { + return o && (o.$typeUrl === Params.typeUrl || Array.isArray(o.allowed_clients) && (!o.allowed_clients.length || typeof o.allowed_clients[0] === "string")); + }, encode(message: Params, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.allowedClients) { writer.uint32(10).string(v!); @@ -1305,5 +1392,6 @@ export const Params = { typeUrl: "/ibc.core.client.v1.Params", value: Params.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/ibc/core/client/v1/genesis.ts b/__fixtures__/v-next/outputv2/ibc/core/client/v1/genesis.ts index ff996863c7..baf3069986 100644 --- a/__fixtures__/v-next/outputv2/ibc/core/client/v1/genesis.ts +++ b/__fixtures__/v-next/outputv2/ibc/core/client/v1/genesis.ts @@ -1,5 +1,6 @@ import { IdentifiedClientState, IdentifiedClientStateAmino, IdentifiedClientStateSDKType, ClientConsensusStates, ClientConsensusStatesAmino, ClientConsensusStatesSDKType, Params, ParamsAmino, ParamsSDKType } from "./client"; import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { GlobalDecoderRegistry } from "../../../../registry"; import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../../helpers"; import { JsonSafe } from "../../../../json-safe"; export const protobufPackage = "ibc.core.client.v1"; @@ -196,6 +197,15 @@ function createBaseGenesisState(): GenesisState { export const GenesisState = { typeUrl: "/ibc.core.client.v1.GenesisState", aminoType: "cosmos-sdk/GenesisState", + is(o: any): o is GenesisState { + return o && (o.$typeUrl === GenesisState.typeUrl || Array.isArray(o.clients) && (!o.clients.length || IdentifiedClientState.is(o.clients[0])) && Array.isArray(o.clientsConsensus) && (!o.clientsConsensus.length || ClientConsensusStates.is(o.clientsConsensus[0])) && Array.isArray(o.clientsMetadata) && (!o.clientsMetadata.length || IdentifiedGenesisMetadata.is(o.clientsMetadata[0])) && Params.is(o.params) && typeof o.createLocalhost === "boolean" && typeof o.nextClientSequence === "bigint"); + }, + isSDK(o: any): o is GenesisStateSDKType { + return o && (o.$typeUrl === GenesisState.typeUrl || Array.isArray(o.clients) && (!o.clients.length || IdentifiedClientState.isSDK(o.clients[0])) && Array.isArray(o.clients_consensus) && (!o.clients_consensus.length || ClientConsensusStates.isSDK(o.clients_consensus[0])) && Array.isArray(o.clients_metadata) && (!o.clients_metadata.length || IdentifiedGenesisMetadata.isSDK(o.clients_metadata[0])) && Params.isSDK(o.params) && typeof o.create_localhost === "boolean" && typeof o.next_client_sequence === "bigint"); + }, + isAmino(o: any): o is GenesisStateAmino { + return o && (o.$typeUrl === GenesisState.typeUrl || Array.isArray(o.clients) && (!o.clients.length || IdentifiedClientState.isAmino(o.clients[0])) && Array.isArray(o.clients_consensus) && (!o.clients_consensus.length || ClientConsensusStates.isAmino(o.clients_consensus[0])) && Array.isArray(o.clients_metadata) && (!o.clients_metadata.length || IdentifiedGenesisMetadata.isAmino(o.clients_metadata[0])) && Params.isAmino(o.params) && typeof o.create_localhost === "boolean" && typeof o.next_client_sequence === "bigint"); + }, encode(message: GenesisState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.clients) { IdentifiedClientState.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -385,6 +395,15 @@ export const GenesisState = { typeUrl: "/ibc.core.client.v1.GenesisState", value: GenesisState.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GenesisState.typeUrl)) { + return; + } + IdentifiedClientState.registerTypeUrl(); + ClientConsensusStates.registerTypeUrl(); + IdentifiedGenesisMetadata.registerTypeUrl(); + Params.registerTypeUrl(); } }; function createBaseGenesisMetadata(): GenesisMetadata { @@ -403,6 +422,15 @@ function createBaseGenesisMetadata(): GenesisMetadata { export const GenesisMetadata = { typeUrl: "/ibc.core.client.v1.GenesisMetadata", aminoType: "cosmos-sdk/GenesisMetadata", + is(o: any): o is GenesisMetadata { + return o && (o.$typeUrl === GenesisMetadata.typeUrl || (o.key instanceof Uint8Array || typeof o.key === "string") && (o.value instanceof Uint8Array || typeof o.value === "string")); + }, + isSDK(o: any): o is GenesisMetadataSDKType { + return o && (o.$typeUrl === GenesisMetadata.typeUrl || (o.key instanceof Uint8Array || typeof o.key === "string") && (o.value instanceof Uint8Array || typeof o.value === "string")); + }, + isAmino(o: any): o is GenesisMetadataAmino { + return o && (o.$typeUrl === GenesisMetadata.typeUrl || (o.key instanceof Uint8Array || typeof o.key === "string") && (o.value instanceof Uint8Array || typeof o.value === "string")); + }, encode(message: GenesisMetadata, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.key.length !== 0) { writer.uint32(10).bytes(message.key); @@ -498,7 +526,8 @@ export const GenesisMetadata = { typeUrl: "/ibc.core.client.v1.GenesisMetadata", value: GenesisMetadata.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseIdentifiedGenesisMetadata(): IdentifiedGenesisMetadata { return { @@ -516,6 +545,15 @@ function createBaseIdentifiedGenesisMetadata(): IdentifiedGenesisMetadata { export const IdentifiedGenesisMetadata = { typeUrl: "/ibc.core.client.v1.IdentifiedGenesisMetadata", aminoType: "cosmos-sdk/IdentifiedGenesisMetadata", + is(o: any): o is IdentifiedGenesisMetadata { + return o && (o.$typeUrl === IdentifiedGenesisMetadata.typeUrl || typeof o.clientId === "string" && Array.isArray(o.clientMetadata) && (!o.clientMetadata.length || GenesisMetadata.is(o.clientMetadata[0]))); + }, + isSDK(o: any): o is IdentifiedGenesisMetadataSDKType { + return o && (o.$typeUrl === IdentifiedGenesisMetadata.typeUrl || typeof o.client_id === "string" && Array.isArray(o.client_metadata) && (!o.client_metadata.length || GenesisMetadata.isSDK(o.client_metadata[0]))); + }, + isAmino(o: any): o is IdentifiedGenesisMetadataAmino { + return o && (o.$typeUrl === IdentifiedGenesisMetadata.typeUrl || typeof o.client_id === "string" && Array.isArray(o.client_metadata) && (!o.client_metadata.length || GenesisMetadata.isAmino(o.client_metadata[0]))); + }, encode(message: IdentifiedGenesisMetadata, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.clientId !== "") { writer.uint32(10).string(message.clientId); @@ -621,5 +659,11 @@ export const IdentifiedGenesisMetadata = { typeUrl: "/ibc.core.client.v1.IdentifiedGenesisMetadata", value: IdentifiedGenesisMetadata.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(IdentifiedGenesisMetadata.typeUrl)) { + return; + } + GenesisMetadata.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/ibc/core/client/v1/query.rpc.func.ts b/__fixtures__/v-next/outputv2/ibc/core/client/v1/query.rpc.func.ts new file mode 100644 index 0000000000..5eb6592f27 --- /dev/null +++ b/__fixtures__/v-next/outputv2/ibc/core/client/v1/query.rpc.func.ts @@ -0,0 +1,108 @@ +import { buildQuery } from "../../../../helper-func-types"; +import { QueryClientStateRequest, QueryClientStateResponse, QueryClientStatesRequest, QueryClientStatesResponse, QueryConsensusStateRequest, QueryConsensusStateResponse, QueryConsensusStatesRequest, QueryConsensusStatesResponse, QueryClientStatusRequest, QueryClientStatusResponse, QueryClientParamsRequest, QueryClientParamsResponse, QueryUpgradedClientStateRequest, QueryUpgradedClientStateResponse, QueryUpgradedConsensusStateRequest, QueryUpgradedConsensusStateResponse } from "./query"; +/** + * ClientState queries an IBC light client. + * @name getClientState + * @package ibc.core.client.v1 + * @see proto service: ibc.core.client.v1.ClientState + */ +export const getClientState = buildQuery({ + encode: QueryClientStateRequest.encode, + decode: QueryClientStateResponse.decode, + service: "ibc.core.client.v1.Query", + method: "ClientState", + deps: [QueryClientStateRequest, QueryClientStateResponse] +}); +/** + * ClientStates queries all the IBC light clients of a chain. + * @name getClientStates + * @package ibc.core.client.v1 + * @see proto service: ibc.core.client.v1.ClientStates + */ +export const getClientStates = buildQuery({ + encode: QueryClientStatesRequest.encode, + decode: QueryClientStatesResponse.decode, + service: "ibc.core.client.v1.Query", + method: "ClientStates", + deps: [QueryClientStatesRequest, QueryClientStatesResponse] +}); +/** + * ConsensusState queries a consensus state associated with a client state at + * a given height. + * @name getConsensusState + * @package ibc.core.client.v1 + * @see proto service: ibc.core.client.v1.ConsensusState + */ +export const getConsensusState = buildQuery({ + encode: QueryConsensusStateRequest.encode, + decode: QueryConsensusStateResponse.decode, + service: "ibc.core.client.v1.Query", + method: "ConsensusState", + deps: [QueryConsensusStateRequest, QueryConsensusStateResponse] +}); +/** + * ConsensusStates queries all the consensus state associated with a given + * client. + * @name getConsensusStates + * @package ibc.core.client.v1 + * @see proto service: ibc.core.client.v1.ConsensusStates + */ +export const getConsensusStates = buildQuery({ + encode: QueryConsensusStatesRequest.encode, + decode: QueryConsensusStatesResponse.decode, + service: "ibc.core.client.v1.Query", + method: "ConsensusStates", + deps: [QueryConsensusStatesRequest, QueryConsensusStatesResponse] +}); +/** + * Status queries the status of an IBC client. + * @name getClientStatus + * @package ibc.core.client.v1 + * @see proto service: ibc.core.client.v1.ClientStatus + */ +export const getClientStatus = buildQuery({ + encode: QueryClientStatusRequest.encode, + decode: QueryClientStatusResponse.decode, + service: "ibc.core.client.v1.Query", + method: "ClientStatus", + deps: [QueryClientStatusRequest, QueryClientStatusResponse] +}); +/** + * ClientParams queries all parameters of the ibc client. + * @name getClientParams + * @package ibc.core.client.v1 + * @see proto service: ibc.core.client.v1.ClientParams + */ +export const getClientParams = buildQuery({ + encode: QueryClientParamsRequest.encode, + decode: QueryClientParamsResponse.decode, + service: "ibc.core.client.v1.Query", + method: "ClientParams", + deps: [QueryClientParamsRequest, QueryClientParamsResponse] +}); +/** + * UpgradedClientState queries an Upgraded IBC light client. + * @name getUpgradedClientState + * @package ibc.core.client.v1 + * @see proto service: ibc.core.client.v1.UpgradedClientState + */ +export const getUpgradedClientState = buildQuery({ + encode: QueryUpgradedClientStateRequest.encode, + decode: QueryUpgradedClientStateResponse.decode, + service: "ibc.core.client.v1.Query", + method: "UpgradedClientState", + deps: [QueryUpgradedClientStateRequest, QueryUpgradedClientStateResponse] +}); +/** + * UpgradedConsensusState queries an Upgraded IBC consensus state. + * @name getUpgradedConsensusState + * @package ibc.core.client.v1 + * @see proto service: ibc.core.client.v1.UpgradedConsensusState + */ +export const getUpgradedConsensusState = buildQuery({ + encode: QueryUpgradedConsensusStateRequest.encode, + decode: QueryUpgradedConsensusStateResponse.decode, + service: "ibc.core.client.v1.Query", + method: "UpgradedConsensusState", + deps: [QueryUpgradedConsensusStateRequest, QueryUpgradedConsensusStateResponse] +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/ibc/core/client/v1/query.ts b/__fixtures__/v-next/outputv2/ibc/core/client/v1/query.ts index 1cf35c59fa..122713c6a2 100644 --- a/__fixtures__/v-next/outputv2/ibc/core/client/v1/query.ts +++ b/__fixtures__/v-next/outputv2/ibc/core/client/v1/query.ts @@ -4,6 +4,7 @@ import { Height, HeightAmino, HeightSDKType, IdentifiedClientState, IdentifiedCl import { BinaryReader, BinaryWriter } from "../../../../binary"; import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../../helpers"; import { JsonSafe } from "../../../../json-safe"; +import { GlobalDecoderRegistry } from "../../../../registry"; export const protobufPackage = "ibc.core.client.v1"; /** * QueryClientStateRequest is the request type for the Query/ClientState RPC @@ -780,6 +781,15 @@ function createBaseQueryClientStateRequest(): QueryClientStateRequest { export const QueryClientStateRequest = { typeUrl: "/ibc.core.client.v1.QueryClientStateRequest", aminoType: "cosmos-sdk/QueryClientStateRequest", + is(o: any): o is QueryClientStateRequest { + return o && (o.$typeUrl === QueryClientStateRequest.typeUrl || typeof o.clientId === "string"); + }, + isSDK(o: any): o is QueryClientStateRequestSDKType { + return o && (o.$typeUrl === QueryClientStateRequest.typeUrl || typeof o.client_id === "string"); + }, + isAmino(o: any): o is QueryClientStateRequestAmino { + return o && (o.$typeUrl === QueryClientStateRequest.typeUrl || typeof o.client_id === "string"); + }, encode(message: QueryClientStateRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.clientId !== "") { writer.uint32(10).string(message.clientId); @@ -860,7 +870,8 @@ export const QueryClientStateRequest = { typeUrl: "/ibc.core.client.v1.QueryClientStateRequest", value: QueryClientStateRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryClientStateResponse(): QueryClientStateResponse { return { @@ -880,6 +891,15 @@ function createBaseQueryClientStateResponse(): QueryClientStateResponse { export const QueryClientStateResponse = { typeUrl: "/ibc.core.client.v1.QueryClientStateResponse", aminoType: "cosmos-sdk/QueryClientStateResponse", + is(o: any): o is QueryClientStateResponse { + return o && (o.$typeUrl === QueryClientStateResponse.typeUrl || (o.proof instanceof Uint8Array || typeof o.proof === "string") && Height.is(o.proofHeight)); + }, + isSDK(o: any): o is QueryClientStateResponseSDKType { + return o && (o.$typeUrl === QueryClientStateResponse.typeUrl || (o.proof instanceof Uint8Array || typeof o.proof === "string") && Height.isSDK(o.proof_height)); + }, + isAmino(o: any): o is QueryClientStateResponseAmino { + return o && (o.$typeUrl === QueryClientStateResponse.typeUrl || (o.proof instanceof Uint8Array || typeof o.proof === "string") && Height.isAmino(o.proof_height)); + }, encode(message: QueryClientStateResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.clientState !== undefined) { Any.encode(message.clientState, writer.uint32(10).fork()).ldelim(); @@ -994,6 +1014,12 @@ export const QueryClientStateResponse = { typeUrl: "/ibc.core.client.v1.QueryClientStateResponse", value: QueryClientStateResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryClientStateResponse.typeUrl)) { + return; + } + Height.registerTypeUrl(); } }; function createBaseQueryClientStatesRequest(): QueryClientStatesRequest { @@ -1011,6 +1037,15 @@ function createBaseQueryClientStatesRequest(): QueryClientStatesRequest { export const QueryClientStatesRequest = { typeUrl: "/ibc.core.client.v1.QueryClientStatesRequest", aminoType: "cosmos-sdk/QueryClientStatesRequest", + is(o: any): o is QueryClientStatesRequest { + return o && o.$typeUrl === QueryClientStatesRequest.typeUrl; + }, + isSDK(o: any): o is QueryClientStatesRequestSDKType { + return o && o.$typeUrl === QueryClientStatesRequest.typeUrl; + }, + isAmino(o: any): o is QueryClientStatesRequestAmino { + return o && o.$typeUrl === QueryClientStatesRequest.typeUrl; + }, encode(message: QueryClientStatesRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.pagination !== undefined) { PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); @@ -1093,6 +1128,12 @@ export const QueryClientStatesRequest = { typeUrl: "/ibc.core.client.v1.QueryClientStatesRequest", value: QueryClientStatesRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryClientStatesRequest.typeUrl)) { + return; + } + PageRequest.registerTypeUrl(); } }; function createBaseQueryClientStatesResponse(): QueryClientStatesResponse { @@ -1111,6 +1152,15 @@ function createBaseQueryClientStatesResponse(): QueryClientStatesResponse { export const QueryClientStatesResponse = { typeUrl: "/ibc.core.client.v1.QueryClientStatesResponse", aminoType: "cosmos-sdk/QueryClientStatesResponse", + is(o: any): o is QueryClientStatesResponse { + return o && (o.$typeUrl === QueryClientStatesResponse.typeUrl || Array.isArray(o.clientStates) && (!o.clientStates.length || IdentifiedClientState.is(o.clientStates[0]))); + }, + isSDK(o: any): o is QueryClientStatesResponseSDKType { + return o && (o.$typeUrl === QueryClientStatesResponse.typeUrl || Array.isArray(o.client_states) && (!o.client_states.length || IdentifiedClientState.isSDK(o.client_states[0]))); + }, + isAmino(o: any): o is QueryClientStatesResponseAmino { + return o && (o.$typeUrl === QueryClientStatesResponse.typeUrl || Array.isArray(o.client_states) && (!o.client_states.length || IdentifiedClientState.isAmino(o.client_states[0]))); + }, encode(message: QueryClientStatesResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.clientStates) { IdentifiedClientState.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -1218,6 +1268,13 @@ export const QueryClientStatesResponse = { typeUrl: "/ibc.core.client.v1.QueryClientStatesResponse", value: QueryClientStatesResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryClientStatesResponse.typeUrl)) { + return; + } + IdentifiedClientState.registerTypeUrl(); + PageResponse.registerTypeUrl(); } }; function createBaseQueryConsensusStateRequest(): QueryConsensusStateRequest { @@ -1239,6 +1296,15 @@ function createBaseQueryConsensusStateRequest(): QueryConsensusStateRequest { export const QueryConsensusStateRequest = { typeUrl: "/ibc.core.client.v1.QueryConsensusStateRequest", aminoType: "cosmos-sdk/QueryConsensusStateRequest", + is(o: any): o is QueryConsensusStateRequest { + return o && (o.$typeUrl === QueryConsensusStateRequest.typeUrl || typeof o.clientId === "string" && typeof o.revisionNumber === "bigint" && typeof o.revisionHeight === "bigint" && typeof o.latestHeight === "boolean"); + }, + isSDK(o: any): o is QueryConsensusStateRequestSDKType { + return o && (o.$typeUrl === QueryConsensusStateRequest.typeUrl || typeof o.client_id === "string" && typeof o.revision_number === "bigint" && typeof o.revision_height === "bigint" && typeof o.latest_height === "boolean"); + }, + isAmino(o: any): o is QueryConsensusStateRequestAmino { + return o && (o.$typeUrl === QueryConsensusStateRequest.typeUrl || typeof o.client_id === "string" && typeof o.revision_number === "bigint" && typeof o.revision_height === "bigint" && typeof o.latest_height === "boolean"); + }, encode(message: QueryConsensusStateRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.clientId !== "") { writer.uint32(10).string(message.clientId); @@ -1368,7 +1434,8 @@ export const QueryConsensusStateRequest = { typeUrl: "/ibc.core.client.v1.QueryConsensusStateRequest", value: QueryConsensusStateRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryConsensusStateResponse(): QueryConsensusStateResponse { return { @@ -1387,6 +1454,15 @@ function createBaseQueryConsensusStateResponse(): QueryConsensusStateResponse { export const QueryConsensusStateResponse = { typeUrl: "/ibc.core.client.v1.QueryConsensusStateResponse", aminoType: "cosmos-sdk/QueryConsensusStateResponse", + is(o: any): o is QueryConsensusStateResponse { + return o && (o.$typeUrl === QueryConsensusStateResponse.typeUrl || (o.proof instanceof Uint8Array || typeof o.proof === "string") && Height.is(o.proofHeight)); + }, + isSDK(o: any): o is QueryConsensusStateResponseSDKType { + return o && (o.$typeUrl === QueryConsensusStateResponse.typeUrl || (o.proof instanceof Uint8Array || typeof o.proof === "string") && Height.isSDK(o.proof_height)); + }, + isAmino(o: any): o is QueryConsensusStateResponseAmino { + return o && (o.$typeUrl === QueryConsensusStateResponse.typeUrl || (o.proof instanceof Uint8Array || typeof o.proof === "string") && Height.isAmino(o.proof_height)); + }, encode(message: QueryConsensusStateResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.consensusState !== undefined) { Any.encode(message.consensusState, writer.uint32(10).fork()).ldelim(); @@ -1501,6 +1577,12 @@ export const QueryConsensusStateResponse = { typeUrl: "/ibc.core.client.v1.QueryConsensusStateResponse", value: QueryConsensusStateResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryConsensusStateResponse.typeUrl)) { + return; + } + Height.registerTypeUrl(); } }; function createBaseQueryConsensusStatesRequest(): QueryConsensusStatesRequest { @@ -1519,6 +1601,15 @@ function createBaseQueryConsensusStatesRequest(): QueryConsensusStatesRequest { export const QueryConsensusStatesRequest = { typeUrl: "/ibc.core.client.v1.QueryConsensusStatesRequest", aminoType: "cosmos-sdk/QueryConsensusStatesRequest", + is(o: any): o is QueryConsensusStatesRequest { + return o && (o.$typeUrl === QueryConsensusStatesRequest.typeUrl || typeof o.clientId === "string"); + }, + isSDK(o: any): o is QueryConsensusStatesRequestSDKType { + return o && (o.$typeUrl === QueryConsensusStatesRequest.typeUrl || typeof o.client_id === "string"); + }, + isAmino(o: any): o is QueryConsensusStatesRequestAmino { + return o && (o.$typeUrl === QueryConsensusStatesRequest.typeUrl || typeof o.client_id === "string"); + }, encode(message: QueryConsensusStatesRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.clientId !== "") { writer.uint32(10).string(message.clientId); @@ -1616,6 +1707,12 @@ export const QueryConsensusStatesRequest = { typeUrl: "/ibc.core.client.v1.QueryConsensusStatesRequest", value: QueryConsensusStatesRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryConsensusStatesRequest.typeUrl)) { + return; + } + PageRequest.registerTypeUrl(); } }; function createBaseQueryConsensusStatesResponse(): QueryConsensusStatesResponse { @@ -1634,6 +1731,15 @@ function createBaseQueryConsensusStatesResponse(): QueryConsensusStatesResponse export const QueryConsensusStatesResponse = { typeUrl: "/ibc.core.client.v1.QueryConsensusStatesResponse", aminoType: "cosmos-sdk/QueryConsensusStatesResponse", + is(o: any): o is QueryConsensusStatesResponse { + return o && (o.$typeUrl === QueryConsensusStatesResponse.typeUrl || Array.isArray(o.consensusStates) && (!o.consensusStates.length || ConsensusStateWithHeight.is(o.consensusStates[0]))); + }, + isSDK(o: any): o is QueryConsensusStatesResponseSDKType { + return o && (o.$typeUrl === QueryConsensusStatesResponse.typeUrl || Array.isArray(o.consensus_states) && (!o.consensus_states.length || ConsensusStateWithHeight.isSDK(o.consensus_states[0]))); + }, + isAmino(o: any): o is QueryConsensusStatesResponseAmino { + return o && (o.$typeUrl === QueryConsensusStatesResponse.typeUrl || Array.isArray(o.consensus_states) && (!o.consensus_states.length || ConsensusStateWithHeight.isAmino(o.consensus_states[0]))); + }, encode(message: QueryConsensusStatesResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.consensusStates) { ConsensusStateWithHeight.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -1741,6 +1847,13 @@ export const QueryConsensusStatesResponse = { typeUrl: "/ibc.core.client.v1.QueryConsensusStatesResponse", value: QueryConsensusStatesResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryConsensusStatesResponse.typeUrl)) { + return; + } + ConsensusStateWithHeight.registerTypeUrl(); + PageResponse.registerTypeUrl(); } }; function createBaseQueryClientStatusRequest(): QueryClientStatusRequest { @@ -1758,6 +1871,15 @@ function createBaseQueryClientStatusRequest(): QueryClientStatusRequest { export const QueryClientStatusRequest = { typeUrl: "/ibc.core.client.v1.QueryClientStatusRequest", aminoType: "cosmos-sdk/QueryClientStatusRequest", + is(o: any): o is QueryClientStatusRequest { + return o && (o.$typeUrl === QueryClientStatusRequest.typeUrl || typeof o.clientId === "string"); + }, + isSDK(o: any): o is QueryClientStatusRequestSDKType { + return o && (o.$typeUrl === QueryClientStatusRequest.typeUrl || typeof o.client_id === "string"); + }, + isAmino(o: any): o is QueryClientStatusRequestAmino { + return o && (o.$typeUrl === QueryClientStatusRequest.typeUrl || typeof o.client_id === "string"); + }, encode(message: QueryClientStatusRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.clientId !== "") { writer.uint32(10).string(message.clientId); @@ -1838,7 +1960,8 @@ export const QueryClientStatusRequest = { typeUrl: "/ibc.core.client.v1.QueryClientStatusRequest", value: QueryClientStatusRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryClientStatusResponse(): QueryClientStatusResponse { return { @@ -1855,6 +1978,15 @@ function createBaseQueryClientStatusResponse(): QueryClientStatusResponse { export const QueryClientStatusResponse = { typeUrl: "/ibc.core.client.v1.QueryClientStatusResponse", aminoType: "cosmos-sdk/QueryClientStatusResponse", + is(o: any): o is QueryClientStatusResponse { + return o && (o.$typeUrl === QueryClientStatusResponse.typeUrl || typeof o.status === "string"); + }, + isSDK(o: any): o is QueryClientStatusResponseSDKType { + return o && (o.$typeUrl === QueryClientStatusResponse.typeUrl || typeof o.status === "string"); + }, + isAmino(o: any): o is QueryClientStatusResponseAmino { + return o && (o.$typeUrl === QueryClientStatusResponse.typeUrl || typeof o.status === "string"); + }, encode(message: QueryClientStatusResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.status !== "") { writer.uint32(10).string(message.status); @@ -1935,7 +2067,8 @@ export const QueryClientStatusResponse = { typeUrl: "/ibc.core.client.v1.QueryClientStatusResponse", value: QueryClientStatusResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryClientParamsRequest(): QueryClientParamsRequest { return {}; @@ -1950,6 +2083,15 @@ function createBaseQueryClientParamsRequest(): QueryClientParamsRequest { export const QueryClientParamsRequest = { typeUrl: "/ibc.core.client.v1.QueryClientParamsRequest", aminoType: "cosmos-sdk/QueryClientParamsRequest", + is(o: any): o is QueryClientParamsRequest { + return o && o.$typeUrl === QueryClientParamsRequest.typeUrl; + }, + isSDK(o: any): o is QueryClientParamsRequestSDKType { + return o && o.$typeUrl === QueryClientParamsRequest.typeUrl; + }, + isAmino(o: any): o is QueryClientParamsRequestAmino { + return o && o.$typeUrl === QueryClientParamsRequest.typeUrl; + }, encode(_: QueryClientParamsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -2014,7 +2156,8 @@ export const QueryClientParamsRequest = { typeUrl: "/ibc.core.client.v1.QueryClientParamsRequest", value: QueryClientParamsRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryClientParamsResponse(): QueryClientParamsResponse { return { @@ -2031,6 +2174,15 @@ function createBaseQueryClientParamsResponse(): QueryClientParamsResponse { export const QueryClientParamsResponse = { typeUrl: "/ibc.core.client.v1.QueryClientParamsResponse", aminoType: "cosmos-sdk/QueryClientParamsResponse", + is(o: any): o is QueryClientParamsResponse { + return o && o.$typeUrl === QueryClientParamsResponse.typeUrl; + }, + isSDK(o: any): o is QueryClientParamsResponseSDKType { + return o && o.$typeUrl === QueryClientParamsResponse.typeUrl; + }, + isAmino(o: any): o is QueryClientParamsResponseAmino { + return o && o.$typeUrl === QueryClientParamsResponse.typeUrl; + }, encode(message: QueryClientParamsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.params !== undefined) { Params.encode(message.params, writer.uint32(10).fork()).ldelim(); @@ -2113,6 +2265,12 @@ export const QueryClientParamsResponse = { typeUrl: "/ibc.core.client.v1.QueryClientParamsResponse", value: QueryClientParamsResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryClientParamsResponse.typeUrl)) { + return; + } + Params.registerTypeUrl(); } }; function createBaseQueryUpgradedClientStateRequest(): QueryUpgradedClientStateRequest { @@ -2128,6 +2286,15 @@ function createBaseQueryUpgradedClientStateRequest(): QueryUpgradedClientStateRe export const QueryUpgradedClientStateRequest = { typeUrl: "/ibc.core.client.v1.QueryUpgradedClientStateRequest", aminoType: "cosmos-sdk/QueryUpgradedClientStateRequest", + is(o: any): o is QueryUpgradedClientStateRequest { + return o && o.$typeUrl === QueryUpgradedClientStateRequest.typeUrl; + }, + isSDK(o: any): o is QueryUpgradedClientStateRequestSDKType { + return o && o.$typeUrl === QueryUpgradedClientStateRequest.typeUrl; + }, + isAmino(o: any): o is QueryUpgradedClientStateRequestAmino { + return o && o.$typeUrl === QueryUpgradedClientStateRequest.typeUrl; + }, encode(_: QueryUpgradedClientStateRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -2192,7 +2359,8 @@ export const QueryUpgradedClientStateRequest = { typeUrl: "/ibc.core.client.v1.QueryUpgradedClientStateRequest", value: QueryUpgradedClientStateRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryUpgradedClientStateResponse(): QueryUpgradedClientStateResponse { return { @@ -2209,6 +2377,15 @@ function createBaseQueryUpgradedClientStateResponse(): QueryUpgradedClientStateR export const QueryUpgradedClientStateResponse = { typeUrl: "/ibc.core.client.v1.QueryUpgradedClientStateResponse", aminoType: "cosmos-sdk/QueryUpgradedClientStateResponse", + is(o: any): o is QueryUpgradedClientStateResponse { + return o && o.$typeUrl === QueryUpgradedClientStateResponse.typeUrl; + }, + isSDK(o: any): o is QueryUpgradedClientStateResponseSDKType { + return o && o.$typeUrl === QueryUpgradedClientStateResponse.typeUrl; + }, + isAmino(o: any): o is QueryUpgradedClientStateResponseAmino { + return o && o.$typeUrl === QueryUpgradedClientStateResponse.typeUrl; + }, encode(message: QueryUpgradedClientStateResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.upgradedClientState !== undefined) { Any.encode(message.upgradedClientState, writer.uint32(10).fork()).ldelim(); @@ -2291,7 +2468,8 @@ export const QueryUpgradedClientStateResponse = { typeUrl: "/ibc.core.client.v1.QueryUpgradedClientStateResponse", value: QueryUpgradedClientStateResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryUpgradedConsensusStateRequest(): QueryUpgradedConsensusStateRequest { return {}; @@ -2306,6 +2484,15 @@ function createBaseQueryUpgradedConsensusStateRequest(): QueryUpgradedConsensusS export const QueryUpgradedConsensusStateRequest = { typeUrl: "/ibc.core.client.v1.QueryUpgradedConsensusStateRequest", aminoType: "cosmos-sdk/QueryUpgradedConsensusStateRequest", + is(o: any): o is QueryUpgradedConsensusStateRequest { + return o && o.$typeUrl === QueryUpgradedConsensusStateRequest.typeUrl; + }, + isSDK(o: any): o is QueryUpgradedConsensusStateRequestSDKType { + return o && o.$typeUrl === QueryUpgradedConsensusStateRequest.typeUrl; + }, + isAmino(o: any): o is QueryUpgradedConsensusStateRequestAmino { + return o && o.$typeUrl === QueryUpgradedConsensusStateRequest.typeUrl; + }, encode(_: QueryUpgradedConsensusStateRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -2370,7 +2557,8 @@ export const QueryUpgradedConsensusStateRequest = { typeUrl: "/ibc.core.client.v1.QueryUpgradedConsensusStateRequest", value: QueryUpgradedConsensusStateRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryUpgradedConsensusStateResponse(): QueryUpgradedConsensusStateResponse { return { @@ -2387,6 +2575,15 @@ function createBaseQueryUpgradedConsensusStateResponse(): QueryUpgradedConsensus export const QueryUpgradedConsensusStateResponse = { typeUrl: "/ibc.core.client.v1.QueryUpgradedConsensusStateResponse", aminoType: "cosmos-sdk/QueryUpgradedConsensusStateResponse", + is(o: any): o is QueryUpgradedConsensusStateResponse { + return o && o.$typeUrl === QueryUpgradedConsensusStateResponse.typeUrl; + }, + isSDK(o: any): o is QueryUpgradedConsensusStateResponseSDKType { + return o && o.$typeUrl === QueryUpgradedConsensusStateResponse.typeUrl; + }, + isAmino(o: any): o is QueryUpgradedConsensusStateResponseAmino { + return o && o.$typeUrl === QueryUpgradedConsensusStateResponse.typeUrl; + }, encode(message: QueryUpgradedConsensusStateResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.upgradedConsensusState !== undefined) { Any.encode(message.upgradedConsensusState, writer.uint32(10).fork()).ldelim(); @@ -2469,5 +2666,6 @@ export const QueryUpgradedConsensusStateResponse = { typeUrl: "/ibc.core.client.v1.QueryUpgradedConsensusStateResponse", value: QueryUpgradedConsensusStateResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/ibc/core/client/v1/tx.registry.ts b/__fixtures__/v-next/outputv2/ibc/core/client/v1/tx.registry.ts index ade3b5b08c..84d2926812 100644 --- a/__fixtures__/v-next/outputv2/ibc/core/client/v1/tx.registry.ts +++ b/__fixtures__/v-next/outputv2/ibc/core/client/v1/tx.registry.ts @@ -1,11 +1,6 @@ -import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { TelescopeGeneratedType } from "../../../../types"; import { MsgCreateClient, MsgUpdateClient, MsgUpgradeClient, MsgSubmitMisbehaviour } from "./tx"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/ibc.core.client.v1.MsgCreateClient", MsgCreateClient], ["/ibc.core.client.v1.MsgUpdateClient", MsgUpdateClient], ["/ibc.core.client.v1.MsgUpgradeClient", MsgUpgradeClient], ["/ibc.core.client.v1.MsgSubmitMisbehaviour", MsgSubmitMisbehaviour]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/ibc.core.client.v1.MsgCreateClient", MsgCreateClient], ["/ibc.core.client.v1.MsgUpdateClient", MsgUpdateClient], ["/ibc.core.client.v1.MsgUpgradeClient", MsgUpgradeClient], ["/ibc.core.client.v1.MsgSubmitMisbehaviour", MsgSubmitMisbehaviour]]; export const MessageComposer = { encoded: { createClient(value: MsgCreateClient) { diff --git a/__fixtures__/v-next/outputv2/ibc/core/client/v1/tx.rpc.func.ts b/__fixtures__/v-next/outputv2/ibc/core/client/v1/tx.rpc.func.ts new file mode 100644 index 0000000000..38f9648cd4 --- /dev/null +++ b/__fixtures__/v-next/outputv2/ibc/core/client/v1/tx.rpc.func.ts @@ -0,0 +1,38 @@ +import { buildTx } from "../../../../helper-func-types"; +import { MsgCreateClient, MsgUpdateClient, MsgUpgradeClient, MsgSubmitMisbehaviour } from "./tx"; +/** + * CreateClient defines a rpc handler method for MsgCreateClient. + * @name createClient + * @package ibc.core.client.v1 + * @see proto service: ibc.core.client.v1.CreateClient + */ +export const createClient = buildTx({ + msg: MsgCreateClient +}); +/** + * UpdateClient defines a rpc handler method for MsgUpdateClient. + * @name updateClient + * @package ibc.core.client.v1 + * @see proto service: ibc.core.client.v1.UpdateClient + */ +export const updateClient = buildTx({ + msg: MsgUpdateClient +}); +/** + * UpgradeClient defines a rpc handler method for MsgUpgradeClient. + * @name upgradeClient + * @package ibc.core.client.v1 + * @see proto service: ibc.core.client.v1.UpgradeClient + */ +export const upgradeClient = buildTx({ + msg: MsgUpgradeClient +}); +/** + * SubmitMisbehaviour defines a rpc handler method for MsgSubmitMisbehaviour. + * @name submitMisbehaviour + * @package ibc.core.client.v1 + * @see proto service: ibc.core.client.v1.SubmitMisbehaviour + */ +export const submitMisbehaviour = buildTx({ + msg: MsgSubmitMisbehaviour +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/ibc/core/client/v1/tx.ts b/__fixtures__/v-next/outputv2/ibc/core/client/v1/tx.ts index 6c10a75c25..f606bb7667 100644 --- a/__fixtures__/v-next/outputv2/ibc/core/client/v1/tx.ts +++ b/__fixtures__/v-next/outputv2/ibc/core/client/v1/tx.ts @@ -414,6 +414,15 @@ function createBaseMsgCreateClient(): MsgCreateClient { export const MsgCreateClient = { typeUrl: "/ibc.core.client.v1.MsgCreateClient", aminoType: "cosmos-sdk/MsgCreateClient", + is(o: any): o is MsgCreateClient { + return o && (o.$typeUrl === MsgCreateClient.typeUrl || typeof o.signer === "string"); + }, + isSDK(o: any): o is MsgCreateClientSDKType { + return o && (o.$typeUrl === MsgCreateClient.typeUrl || typeof o.signer === "string"); + }, + isAmino(o: any): o is MsgCreateClientAmino { + return o && (o.$typeUrl === MsgCreateClient.typeUrl || typeof o.signer === "string"); + }, encode(message: MsgCreateClient, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.clientState !== undefined) { Any.encode(message.clientState, writer.uint32(10).fork()).ldelim(); @@ -528,7 +537,8 @@ export const MsgCreateClient = { typeUrl: "/ibc.core.client.v1.MsgCreateClient", value: MsgCreateClient.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgCreateClientResponse(): MsgCreateClientResponse { return {}; @@ -542,6 +552,15 @@ function createBaseMsgCreateClientResponse(): MsgCreateClientResponse { export const MsgCreateClientResponse = { typeUrl: "/ibc.core.client.v1.MsgCreateClientResponse", aminoType: "cosmos-sdk/MsgCreateClientResponse", + is(o: any): o is MsgCreateClientResponse { + return o && o.$typeUrl === MsgCreateClientResponse.typeUrl; + }, + isSDK(o: any): o is MsgCreateClientResponseSDKType { + return o && o.$typeUrl === MsgCreateClientResponse.typeUrl; + }, + isAmino(o: any): o is MsgCreateClientResponseAmino { + return o && o.$typeUrl === MsgCreateClientResponse.typeUrl; + }, encode(_: MsgCreateClientResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -606,7 +625,8 @@ export const MsgCreateClientResponse = { typeUrl: "/ibc.core.client.v1.MsgCreateClientResponse", value: MsgCreateClientResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgUpdateClient(): MsgUpdateClient { return { @@ -625,6 +645,15 @@ function createBaseMsgUpdateClient(): MsgUpdateClient { export const MsgUpdateClient = { typeUrl: "/ibc.core.client.v1.MsgUpdateClient", aminoType: "cosmos-sdk/MsgUpdateClient", + is(o: any): o is MsgUpdateClient { + return o && (o.$typeUrl === MsgUpdateClient.typeUrl || typeof o.clientId === "string" && typeof o.signer === "string"); + }, + isSDK(o: any): o is MsgUpdateClientSDKType { + return o && (o.$typeUrl === MsgUpdateClient.typeUrl || typeof o.client_id === "string" && typeof o.signer === "string"); + }, + isAmino(o: any): o is MsgUpdateClientAmino { + return o && (o.$typeUrl === MsgUpdateClient.typeUrl || typeof o.client_id === "string" && typeof o.signer === "string"); + }, encode(message: MsgUpdateClient, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.clientId !== "") { writer.uint32(10).string(message.clientId); @@ -737,7 +766,8 @@ export const MsgUpdateClient = { typeUrl: "/ibc.core.client.v1.MsgUpdateClient", value: MsgUpdateClient.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgUpdateClientResponse(): MsgUpdateClientResponse { return {}; @@ -751,6 +781,15 @@ function createBaseMsgUpdateClientResponse(): MsgUpdateClientResponse { export const MsgUpdateClientResponse = { typeUrl: "/ibc.core.client.v1.MsgUpdateClientResponse", aminoType: "cosmos-sdk/MsgUpdateClientResponse", + is(o: any): o is MsgUpdateClientResponse { + return o && o.$typeUrl === MsgUpdateClientResponse.typeUrl; + }, + isSDK(o: any): o is MsgUpdateClientResponseSDKType { + return o && o.$typeUrl === MsgUpdateClientResponse.typeUrl; + }, + isAmino(o: any): o is MsgUpdateClientResponseAmino { + return o && o.$typeUrl === MsgUpdateClientResponse.typeUrl; + }, encode(_: MsgUpdateClientResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -815,7 +854,8 @@ export const MsgUpdateClientResponse = { typeUrl: "/ibc.core.client.v1.MsgUpdateClientResponse", value: MsgUpdateClientResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgUpgradeClient(): MsgUpgradeClient { return { @@ -837,6 +877,15 @@ function createBaseMsgUpgradeClient(): MsgUpgradeClient { export const MsgUpgradeClient = { typeUrl: "/ibc.core.client.v1.MsgUpgradeClient", aminoType: "cosmos-sdk/MsgUpgradeClient", + is(o: any): o is MsgUpgradeClient { + return o && (o.$typeUrl === MsgUpgradeClient.typeUrl || typeof o.clientId === "string" && (o.proofUpgradeClient instanceof Uint8Array || typeof o.proofUpgradeClient === "string") && (o.proofUpgradeConsensusState instanceof Uint8Array || typeof o.proofUpgradeConsensusState === "string") && typeof o.signer === "string"); + }, + isSDK(o: any): o is MsgUpgradeClientSDKType { + return o && (o.$typeUrl === MsgUpgradeClient.typeUrl || typeof o.client_id === "string" && (o.proof_upgrade_client instanceof Uint8Array || typeof o.proof_upgrade_client === "string") && (o.proof_upgrade_consensus_state instanceof Uint8Array || typeof o.proof_upgrade_consensus_state === "string") && typeof o.signer === "string"); + }, + isAmino(o: any): o is MsgUpgradeClientAmino { + return o && (o.$typeUrl === MsgUpgradeClient.typeUrl || typeof o.client_id === "string" && (o.proof_upgrade_client instanceof Uint8Array || typeof o.proof_upgrade_client === "string") && (o.proof_upgrade_consensus_state instanceof Uint8Array || typeof o.proof_upgrade_consensus_state === "string") && typeof o.signer === "string"); + }, encode(message: MsgUpgradeClient, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.clientId !== "") { writer.uint32(10).string(message.clientId); @@ -996,7 +1045,8 @@ export const MsgUpgradeClient = { typeUrl: "/ibc.core.client.v1.MsgUpgradeClient", value: MsgUpgradeClient.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgUpgradeClientResponse(): MsgUpgradeClientResponse { return {}; @@ -1010,6 +1060,15 @@ function createBaseMsgUpgradeClientResponse(): MsgUpgradeClientResponse { export const MsgUpgradeClientResponse = { typeUrl: "/ibc.core.client.v1.MsgUpgradeClientResponse", aminoType: "cosmos-sdk/MsgUpgradeClientResponse", + is(o: any): o is MsgUpgradeClientResponse { + return o && o.$typeUrl === MsgUpgradeClientResponse.typeUrl; + }, + isSDK(o: any): o is MsgUpgradeClientResponseSDKType { + return o && o.$typeUrl === MsgUpgradeClientResponse.typeUrl; + }, + isAmino(o: any): o is MsgUpgradeClientResponseAmino { + return o && o.$typeUrl === MsgUpgradeClientResponse.typeUrl; + }, encode(_: MsgUpgradeClientResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -1074,7 +1133,8 @@ export const MsgUpgradeClientResponse = { typeUrl: "/ibc.core.client.v1.MsgUpgradeClientResponse", value: MsgUpgradeClientResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgSubmitMisbehaviour(): MsgSubmitMisbehaviour { return { @@ -1093,6 +1153,15 @@ function createBaseMsgSubmitMisbehaviour(): MsgSubmitMisbehaviour { export const MsgSubmitMisbehaviour = { typeUrl: "/ibc.core.client.v1.MsgSubmitMisbehaviour", aminoType: "cosmos-sdk/MsgSubmitMisbehaviour", + is(o: any): o is MsgSubmitMisbehaviour { + return o && (o.$typeUrl === MsgSubmitMisbehaviour.typeUrl || typeof o.clientId === "string" && typeof o.signer === "string"); + }, + isSDK(o: any): o is MsgSubmitMisbehaviourSDKType { + return o && (o.$typeUrl === MsgSubmitMisbehaviour.typeUrl || typeof o.client_id === "string" && typeof o.signer === "string"); + }, + isAmino(o: any): o is MsgSubmitMisbehaviourAmino { + return o && (o.$typeUrl === MsgSubmitMisbehaviour.typeUrl || typeof o.client_id === "string" && typeof o.signer === "string"); + }, encode(message: MsgSubmitMisbehaviour, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.clientId !== "") { writer.uint32(10).string(message.clientId); @@ -1205,7 +1274,8 @@ export const MsgSubmitMisbehaviour = { typeUrl: "/ibc.core.client.v1.MsgSubmitMisbehaviour", value: MsgSubmitMisbehaviour.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgSubmitMisbehaviourResponse(): MsgSubmitMisbehaviourResponse { return {}; @@ -1220,6 +1290,15 @@ function createBaseMsgSubmitMisbehaviourResponse(): MsgSubmitMisbehaviourRespons export const MsgSubmitMisbehaviourResponse = { typeUrl: "/ibc.core.client.v1.MsgSubmitMisbehaviourResponse", aminoType: "cosmos-sdk/MsgSubmitMisbehaviourResponse", + is(o: any): o is MsgSubmitMisbehaviourResponse { + return o && o.$typeUrl === MsgSubmitMisbehaviourResponse.typeUrl; + }, + isSDK(o: any): o is MsgSubmitMisbehaviourResponseSDKType { + return o && o.$typeUrl === MsgSubmitMisbehaviourResponse.typeUrl; + }, + isAmino(o: any): o is MsgSubmitMisbehaviourResponseAmino { + return o && o.$typeUrl === MsgSubmitMisbehaviourResponse.typeUrl; + }, encode(_: MsgSubmitMisbehaviourResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -1284,5 +1363,6 @@ export const MsgSubmitMisbehaviourResponse = { typeUrl: "/ibc.core.client.v1.MsgSubmitMisbehaviourResponse", value: MsgSubmitMisbehaviourResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/ibc/core/commitment/v1/commitment.ts b/__fixtures__/v-next/outputv2/ibc/core/commitment/v1/commitment.ts index 3ef44c46df..bf41942ab7 100644 --- a/__fixtures__/v-next/outputv2/ibc/core/commitment/v1/commitment.ts +++ b/__fixtures__/v-next/outputv2/ibc/core/commitment/v1/commitment.ts @@ -2,6 +2,7 @@ import { CommitmentProof, CommitmentProofAmino, CommitmentProofSDKType } from ". import { BinaryReader, BinaryWriter } from "../../../../binary"; import { isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../../../../helpers"; import { JsonSafe } from "../../../../json-safe"; +import { GlobalDecoderRegistry } from "../../../../registry"; export const protobufPackage = "ibc.core.commitment.v1"; /** * MerkleRoot defines a merkle root hash. @@ -185,6 +186,15 @@ function createBaseMerkleRoot(): MerkleRoot { export const MerkleRoot = { typeUrl: "/ibc.core.commitment.v1.MerkleRoot", aminoType: "cosmos-sdk/MerkleRoot", + is(o: any): o is MerkleRoot { + return o && (o.$typeUrl === MerkleRoot.typeUrl || o.hash instanceof Uint8Array || typeof o.hash === "string"); + }, + isSDK(o: any): o is MerkleRootSDKType { + return o && (o.$typeUrl === MerkleRoot.typeUrl || o.hash instanceof Uint8Array || typeof o.hash === "string"); + }, + isAmino(o: any): o is MerkleRootAmino { + return o && (o.$typeUrl === MerkleRoot.typeUrl || o.hash instanceof Uint8Array || typeof o.hash === "string"); + }, encode(message: MerkleRoot, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.hash.length !== 0) { writer.uint32(10).bytes(message.hash); @@ -265,7 +275,8 @@ export const MerkleRoot = { typeUrl: "/ibc.core.commitment.v1.MerkleRoot", value: MerkleRoot.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMerklePrefix(): MerklePrefix { return { @@ -283,6 +294,15 @@ function createBaseMerklePrefix(): MerklePrefix { export const MerklePrefix = { typeUrl: "/ibc.core.commitment.v1.MerklePrefix", aminoType: "cosmos-sdk/MerklePrefix", + is(o: any): o is MerklePrefix { + return o && (o.$typeUrl === MerklePrefix.typeUrl || o.keyPrefix instanceof Uint8Array || typeof o.keyPrefix === "string"); + }, + isSDK(o: any): o is MerklePrefixSDKType { + return o && (o.$typeUrl === MerklePrefix.typeUrl || o.key_prefix instanceof Uint8Array || typeof o.key_prefix === "string"); + }, + isAmino(o: any): o is MerklePrefixAmino { + return o && (o.$typeUrl === MerklePrefix.typeUrl || o.key_prefix instanceof Uint8Array || typeof o.key_prefix === "string"); + }, encode(message: MerklePrefix, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.keyPrefix.length !== 0) { writer.uint32(10).bytes(message.keyPrefix); @@ -363,7 +383,8 @@ export const MerklePrefix = { typeUrl: "/ibc.core.commitment.v1.MerklePrefix", value: MerklePrefix.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMerklePath(): MerklePath { return { @@ -381,6 +402,15 @@ function createBaseMerklePath(): MerklePath { export const MerklePath = { typeUrl: "/ibc.core.commitment.v1.MerklePath", aminoType: "cosmos-sdk/MerklePath", + is(o: any): o is MerklePath { + return o && (o.$typeUrl === MerklePath.typeUrl || Array.isArray(o.keyPath) && (!o.keyPath.length || typeof o.keyPath[0] === "string")); + }, + isSDK(o: any): o is MerklePathSDKType { + return o && (o.$typeUrl === MerklePath.typeUrl || Array.isArray(o.key_path) && (!o.key_path.length || typeof o.key_path[0] === "string")); + }, + isAmino(o: any): o is MerklePathAmino { + return o && (o.$typeUrl === MerklePath.typeUrl || Array.isArray(o.key_path) && (!o.key_path.length || typeof o.key_path[0] === "string")); + }, encode(message: MerklePath, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.keyPath) { writer.uint32(10).string(v!); @@ -471,7 +501,8 @@ export const MerklePath = { typeUrl: "/ibc.core.commitment.v1.MerklePath", value: MerklePath.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMerkleProof(): MerkleProof { return { @@ -491,6 +522,15 @@ function createBaseMerkleProof(): MerkleProof { export const MerkleProof = { typeUrl: "/ibc.core.commitment.v1.MerkleProof", aminoType: "cosmos-sdk/MerkleProof", + is(o: any): o is MerkleProof { + return o && (o.$typeUrl === MerkleProof.typeUrl || Array.isArray(o.proofs) && (!o.proofs.length || CommitmentProof.is(o.proofs[0]))); + }, + isSDK(o: any): o is MerkleProofSDKType { + return o && (o.$typeUrl === MerkleProof.typeUrl || Array.isArray(o.proofs) && (!o.proofs.length || CommitmentProof.isSDK(o.proofs[0]))); + }, + isAmino(o: any): o is MerkleProofAmino { + return o && (o.$typeUrl === MerkleProof.typeUrl || Array.isArray(o.proofs) && (!o.proofs.length || CommitmentProof.isAmino(o.proofs[0]))); + }, encode(message: MerkleProof, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.proofs) { CommitmentProof.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -581,5 +621,11 @@ export const MerkleProof = { typeUrl: "/ibc.core.commitment.v1.MerkleProof", value: MerkleProof.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MerkleProof.typeUrl)) { + return; + } + CommitmentProof.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/ibc/core/connection/v1/connection.ts b/__fixtures__/v-next/outputv2/ibc/core/connection/v1/connection.ts index 3a601e46b8..832aaf24e8 100644 --- a/__fixtures__/v-next/outputv2/ibc/core/connection/v1/connection.ts +++ b/__fixtures__/v-next/outputv2/ibc/core/connection/v1/connection.ts @@ -1,6 +1,7 @@ import { MerklePrefix, MerklePrefixAmino, MerklePrefixSDKType } from "../../commitment/v1/commitment"; -import { BinaryReader, BinaryWriter } from "../../../../binary"; import { isSet, DeepPartial } from "../../../../helpers"; +import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { GlobalDecoderRegistry } from "../../../../registry"; import { JsonSafe } from "../../../../json-safe"; export const protobufPackage = "ibc.core.connection.v1"; /** @@ -514,6 +515,15 @@ function createBaseConnectionEnd(): ConnectionEnd { export const ConnectionEnd = { typeUrl: "/ibc.core.connection.v1.ConnectionEnd", aminoType: "cosmos-sdk/ConnectionEnd", + is(o: any): o is ConnectionEnd { + return o && (o.$typeUrl === ConnectionEnd.typeUrl || typeof o.clientId === "string" && Array.isArray(o.versions) && (!o.versions.length || Version.is(o.versions[0])) && isSet(o.state) && Counterparty.is(o.counterparty) && typeof o.delayPeriod === "bigint"); + }, + isSDK(o: any): o is ConnectionEndSDKType { + return o && (o.$typeUrl === ConnectionEnd.typeUrl || typeof o.client_id === "string" && Array.isArray(o.versions) && (!o.versions.length || Version.isSDK(o.versions[0])) && isSet(o.state) && Counterparty.isSDK(o.counterparty) && typeof o.delay_period === "bigint"); + }, + isAmino(o: any): o is ConnectionEndAmino { + return o && (o.$typeUrl === ConnectionEnd.typeUrl || typeof o.client_id === "string" && Array.isArray(o.versions) && (!o.versions.length || Version.isAmino(o.versions[0])) && isSet(o.state) && Counterparty.isAmino(o.counterparty) && typeof o.delay_period === "bigint"); + }, encode(message: ConnectionEnd, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.clientId !== "") { writer.uint32(10).string(message.clientId); @@ -668,6 +678,13 @@ export const ConnectionEnd = { typeUrl: "/ibc.core.connection.v1.ConnectionEnd", value: ConnectionEnd.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ConnectionEnd.typeUrl)) { + return; + } + Version.registerTypeUrl(); + Counterparty.registerTypeUrl(); } }; function createBaseIdentifiedConnection(): IdentifiedConnection { @@ -690,6 +707,15 @@ function createBaseIdentifiedConnection(): IdentifiedConnection { export const IdentifiedConnection = { typeUrl: "/ibc.core.connection.v1.IdentifiedConnection", aminoType: "cosmos-sdk/IdentifiedConnection", + is(o: any): o is IdentifiedConnection { + return o && (o.$typeUrl === IdentifiedConnection.typeUrl || typeof o.id === "string" && typeof o.clientId === "string" && Array.isArray(o.versions) && (!o.versions.length || Version.is(o.versions[0])) && isSet(o.state) && Counterparty.is(o.counterparty) && typeof o.delayPeriod === "bigint"); + }, + isSDK(o: any): o is IdentifiedConnectionSDKType { + return o && (o.$typeUrl === IdentifiedConnection.typeUrl || typeof o.id === "string" && typeof o.client_id === "string" && Array.isArray(o.versions) && (!o.versions.length || Version.isSDK(o.versions[0])) && isSet(o.state) && Counterparty.isSDK(o.counterparty) && typeof o.delay_period === "bigint"); + }, + isAmino(o: any): o is IdentifiedConnectionAmino { + return o && (o.$typeUrl === IdentifiedConnection.typeUrl || typeof o.id === "string" && typeof o.client_id === "string" && Array.isArray(o.versions) && (!o.versions.length || Version.isAmino(o.versions[0])) && isSet(o.state) && Counterparty.isAmino(o.counterparty) && typeof o.delay_period === "bigint"); + }, encode(message: IdentifiedConnection, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.id !== "") { writer.uint32(10).string(message.id); @@ -859,6 +885,13 @@ export const IdentifiedConnection = { typeUrl: "/ibc.core.connection.v1.IdentifiedConnection", value: IdentifiedConnection.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(IdentifiedConnection.typeUrl)) { + return; + } + Version.registerTypeUrl(); + Counterparty.registerTypeUrl(); } }; function createBaseCounterparty(): Counterparty { @@ -877,6 +910,15 @@ function createBaseCounterparty(): Counterparty { export const Counterparty = { typeUrl: "/ibc.core.connection.v1.Counterparty", aminoType: "cosmos-sdk/Counterparty", + is(o: any): o is Counterparty { + return o && (o.$typeUrl === Counterparty.typeUrl || typeof o.clientId === "string" && typeof o.connectionId === "string" && MerklePrefix.is(o.prefix)); + }, + isSDK(o: any): o is CounterpartySDKType { + return o && (o.$typeUrl === Counterparty.typeUrl || typeof o.client_id === "string" && typeof o.connection_id === "string" && MerklePrefix.isSDK(o.prefix)); + }, + isAmino(o: any): o is CounterpartyAmino { + return o && (o.$typeUrl === Counterparty.typeUrl || typeof o.client_id === "string" && typeof o.connection_id === "string" && MerklePrefix.isAmino(o.prefix)); + }, encode(message: Counterparty, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.clientId !== "") { writer.uint32(10).string(message.clientId); @@ -989,6 +1031,12 @@ export const Counterparty = { typeUrl: "/ibc.core.connection.v1.Counterparty", value: Counterparty.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Counterparty.typeUrl)) { + return; + } + MerklePrefix.registerTypeUrl(); } }; function createBaseClientPaths(): ClientPaths { @@ -1005,6 +1053,15 @@ function createBaseClientPaths(): ClientPaths { export const ClientPaths = { typeUrl: "/ibc.core.connection.v1.ClientPaths", aminoType: "cosmos-sdk/ClientPaths", + is(o: any): o is ClientPaths { + return o && (o.$typeUrl === ClientPaths.typeUrl || Array.isArray(o.paths) && (!o.paths.length || typeof o.paths[0] === "string")); + }, + isSDK(o: any): o is ClientPathsSDKType { + return o && (o.$typeUrl === ClientPaths.typeUrl || Array.isArray(o.paths) && (!o.paths.length || typeof o.paths[0] === "string")); + }, + isAmino(o: any): o is ClientPathsAmino { + return o && (o.$typeUrl === ClientPaths.typeUrl || Array.isArray(o.paths) && (!o.paths.length || typeof o.paths[0] === "string")); + }, encode(message: ClientPaths, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.paths) { writer.uint32(10).string(v!); @@ -1095,7 +1152,8 @@ export const ClientPaths = { typeUrl: "/ibc.core.connection.v1.ClientPaths", value: ClientPaths.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseConnectionPaths(): ConnectionPaths { return { @@ -1112,6 +1170,15 @@ function createBaseConnectionPaths(): ConnectionPaths { export const ConnectionPaths = { typeUrl: "/ibc.core.connection.v1.ConnectionPaths", aminoType: "cosmos-sdk/ConnectionPaths", + is(o: any): o is ConnectionPaths { + return o && (o.$typeUrl === ConnectionPaths.typeUrl || typeof o.clientId === "string" && Array.isArray(o.paths) && (!o.paths.length || typeof o.paths[0] === "string")); + }, + isSDK(o: any): o is ConnectionPathsSDKType { + return o && (o.$typeUrl === ConnectionPaths.typeUrl || typeof o.client_id === "string" && Array.isArray(o.paths) && (!o.paths.length || typeof o.paths[0] === "string")); + }, + isAmino(o: any): o is ConnectionPathsAmino { + return o && (o.$typeUrl === ConnectionPaths.typeUrl || typeof o.client_id === "string" && Array.isArray(o.paths) && (!o.paths.length || typeof o.paths[0] === "string")); + }, encode(message: ConnectionPaths, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.clientId !== "") { writer.uint32(10).string(message.clientId); @@ -1217,7 +1284,8 @@ export const ConnectionPaths = { typeUrl: "/ibc.core.connection.v1.ConnectionPaths", value: ConnectionPaths.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseVersion(): Version { return { @@ -1235,6 +1303,15 @@ function createBaseVersion(): Version { export const Version = { typeUrl: "/ibc.core.connection.v1.Version", aminoType: "cosmos-sdk/Version", + is(o: any): o is Version { + return o && (o.$typeUrl === Version.typeUrl || typeof o.identifier === "string" && Array.isArray(o.features) && (!o.features.length || typeof o.features[0] === "string")); + }, + isSDK(o: any): o is VersionSDKType { + return o && (o.$typeUrl === Version.typeUrl || typeof o.identifier === "string" && Array.isArray(o.features) && (!o.features.length || typeof o.features[0] === "string")); + }, + isAmino(o: any): o is VersionAmino { + return o && (o.$typeUrl === Version.typeUrl || typeof o.identifier === "string" && Array.isArray(o.features) && (!o.features.length || typeof o.features[0] === "string")); + }, encode(message: Version, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.identifier !== "") { writer.uint32(10).string(message.identifier); @@ -1340,7 +1417,8 @@ export const Version = { typeUrl: "/ibc.core.connection.v1.Version", value: Version.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseParams(): Params { return { @@ -1356,6 +1434,15 @@ function createBaseParams(): Params { export const Params = { typeUrl: "/ibc.core.connection.v1.Params", aminoType: "cosmos-sdk/Params", + is(o: any): o is Params { + return o && (o.$typeUrl === Params.typeUrl || typeof o.maxExpectedTimePerBlock === "bigint"); + }, + isSDK(o: any): o is ParamsSDKType { + return o && (o.$typeUrl === Params.typeUrl || typeof o.max_expected_time_per_block === "bigint"); + }, + isAmino(o: any): o is ParamsAmino { + return o && (o.$typeUrl === Params.typeUrl || typeof o.max_expected_time_per_block === "bigint"); + }, encode(message: Params, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.maxExpectedTimePerBlock !== BigInt(0)) { writer.uint32(8).uint64(message.maxExpectedTimePerBlock); @@ -1438,5 +1525,6 @@ export const Params = { typeUrl: "/ibc.core.connection.v1.Params", value: Params.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/ibc/core/connection/v1/genesis.ts b/__fixtures__/v-next/outputv2/ibc/core/connection/v1/genesis.ts index d2f7e96270..603834c56d 100644 --- a/__fixtures__/v-next/outputv2/ibc/core/connection/v1/genesis.ts +++ b/__fixtures__/v-next/outputv2/ibc/core/connection/v1/genesis.ts @@ -1,5 +1,6 @@ import { IdentifiedConnection, IdentifiedConnectionAmino, IdentifiedConnectionSDKType, ConnectionPaths, ConnectionPathsAmino, ConnectionPathsSDKType, Params, ParamsAmino, ParamsSDKType } from "./connection"; import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { GlobalDecoderRegistry } from "../../../../registry"; import { isSet, DeepPartial } from "../../../../helpers"; import { JsonSafe } from "../../../../json-safe"; export const protobufPackage = "ibc.core.connection.v1"; @@ -70,6 +71,15 @@ function createBaseGenesisState(): GenesisState { export const GenesisState = { typeUrl: "/ibc.core.connection.v1.GenesisState", aminoType: "cosmos-sdk/GenesisState", + is(o: any): o is GenesisState { + return o && (o.$typeUrl === GenesisState.typeUrl || Array.isArray(o.connections) && (!o.connections.length || IdentifiedConnection.is(o.connections[0])) && Array.isArray(o.clientConnectionPaths) && (!o.clientConnectionPaths.length || ConnectionPaths.is(o.clientConnectionPaths[0])) && typeof o.nextConnectionSequence === "bigint" && Params.is(o.params)); + }, + isSDK(o: any): o is GenesisStateSDKType { + return o && (o.$typeUrl === GenesisState.typeUrl || Array.isArray(o.connections) && (!o.connections.length || IdentifiedConnection.isSDK(o.connections[0])) && Array.isArray(o.client_connection_paths) && (!o.client_connection_paths.length || ConnectionPaths.isSDK(o.client_connection_paths[0])) && typeof o.next_connection_sequence === "bigint" && Params.isSDK(o.params)); + }, + isAmino(o: any): o is GenesisStateAmino { + return o && (o.$typeUrl === GenesisState.typeUrl || Array.isArray(o.connections) && (!o.connections.length || IdentifiedConnection.isAmino(o.connections[0])) && Array.isArray(o.client_connection_paths) && (!o.client_connection_paths.length || ConnectionPaths.isAmino(o.client_connection_paths[0])) && typeof o.next_connection_sequence === "bigint" && Params.isAmino(o.params)); + }, encode(message: GenesisState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.connections) { IdentifiedConnection.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -219,5 +229,13 @@ export const GenesisState = { typeUrl: "/ibc.core.connection.v1.GenesisState", value: GenesisState.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GenesisState.typeUrl)) { + return; + } + IdentifiedConnection.registerTypeUrl(); + ConnectionPaths.registerTypeUrl(); + Params.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/ibc/core/connection/v1/query.rpc.func.ts b/__fixtures__/v-next/outputv2/ibc/core/connection/v1/query.rpc.func.ts new file mode 100644 index 0000000000..8c1aa413f5 --- /dev/null +++ b/__fixtures__/v-next/outputv2/ibc/core/connection/v1/query.rpc.func.ts @@ -0,0 +1,70 @@ +import { buildQuery } from "../../../../helper-func-types"; +import { QueryConnectionRequest, QueryConnectionResponse, QueryConnectionsRequest, QueryConnectionsResponse, QueryClientConnectionsRequest, QueryClientConnectionsResponse, QueryConnectionClientStateRequest, QueryConnectionClientStateResponse, QueryConnectionConsensusStateRequest, QueryConnectionConsensusStateResponse } from "./query"; +/** + * Connection queries an IBC connection end. + * @name getConnection + * @package ibc.core.connection.v1 + * @see proto service: ibc.core.connection.v1.Connection + */ +export const getConnection = buildQuery({ + encode: QueryConnectionRequest.encode, + decode: QueryConnectionResponse.decode, + service: "ibc.core.connection.v1.Query", + method: "Connection", + deps: [QueryConnectionRequest, QueryConnectionResponse] +}); +/** + * Connections queries all the IBC connections of a chain. + * @name getConnections + * @package ibc.core.connection.v1 + * @see proto service: ibc.core.connection.v1.Connections + */ +export const getConnections = buildQuery({ + encode: QueryConnectionsRequest.encode, + decode: QueryConnectionsResponse.decode, + service: "ibc.core.connection.v1.Query", + method: "Connections", + deps: [QueryConnectionsRequest, QueryConnectionsResponse] +}); +/** + * ClientConnections queries the connection paths associated with a client + * state. + * @name getClientConnections + * @package ibc.core.connection.v1 + * @see proto service: ibc.core.connection.v1.ClientConnections + */ +export const getClientConnections = buildQuery({ + encode: QueryClientConnectionsRequest.encode, + decode: QueryClientConnectionsResponse.decode, + service: "ibc.core.connection.v1.Query", + method: "ClientConnections", + deps: [QueryClientConnectionsRequest, QueryClientConnectionsResponse] +}); +/** + * ConnectionClientState queries the client state associated with the + * connection. + * @name getConnectionClientState + * @package ibc.core.connection.v1 + * @see proto service: ibc.core.connection.v1.ConnectionClientState + */ +export const getConnectionClientState = buildQuery({ + encode: QueryConnectionClientStateRequest.encode, + decode: QueryConnectionClientStateResponse.decode, + service: "ibc.core.connection.v1.Query", + method: "ConnectionClientState", + deps: [QueryConnectionClientStateRequest, QueryConnectionClientStateResponse] +}); +/** + * ConnectionConsensusState queries the consensus state associated with the + * connection. + * @name getConnectionConsensusState + * @package ibc.core.connection.v1 + * @see proto service: ibc.core.connection.v1.ConnectionConsensusState + */ +export const getConnectionConsensusState = buildQuery({ + encode: QueryConnectionConsensusStateRequest.encode, + decode: QueryConnectionConsensusStateResponse.decode, + service: "ibc.core.connection.v1.Query", + method: "ConnectionConsensusState", + deps: [QueryConnectionConsensusStateRequest, QueryConnectionConsensusStateResponse] +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/ibc/core/connection/v1/query.ts b/__fixtures__/v-next/outputv2/ibc/core/connection/v1/query.ts index a8a6b8a5fb..3a78993fac 100644 --- a/__fixtures__/v-next/outputv2/ibc/core/connection/v1/query.ts +++ b/__fixtures__/v-next/outputv2/ibc/core/connection/v1/query.ts @@ -5,6 +5,7 @@ import { Any, AnyAmino, AnySDKType } from "../../../../google/protobuf/any"; import { BinaryReader, BinaryWriter } from "../../../../binary"; import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../../helpers"; import { JsonSafe } from "../../../../json-safe"; +import { GlobalDecoderRegistry } from "../../../../registry"; export const protobufPackage = "ibc.core.connection.v1"; /** * QueryConnectionRequest is the request type for the Query/Connection RPC @@ -563,6 +564,15 @@ function createBaseQueryConnectionRequest(): QueryConnectionRequest { export const QueryConnectionRequest = { typeUrl: "/ibc.core.connection.v1.QueryConnectionRequest", aminoType: "cosmos-sdk/QueryConnectionRequest", + is(o: any): o is QueryConnectionRequest { + return o && (o.$typeUrl === QueryConnectionRequest.typeUrl || typeof o.connectionId === "string"); + }, + isSDK(o: any): o is QueryConnectionRequestSDKType { + return o && (o.$typeUrl === QueryConnectionRequest.typeUrl || typeof o.connection_id === "string"); + }, + isAmino(o: any): o is QueryConnectionRequestAmino { + return o && (o.$typeUrl === QueryConnectionRequest.typeUrl || typeof o.connection_id === "string"); + }, encode(message: QueryConnectionRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.connectionId !== "") { writer.uint32(10).string(message.connectionId); @@ -643,7 +653,8 @@ export const QueryConnectionRequest = { typeUrl: "/ibc.core.connection.v1.QueryConnectionRequest", value: QueryConnectionRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryConnectionResponse(): QueryConnectionResponse { return { @@ -663,6 +674,15 @@ function createBaseQueryConnectionResponse(): QueryConnectionResponse { export const QueryConnectionResponse = { typeUrl: "/ibc.core.connection.v1.QueryConnectionResponse", aminoType: "cosmos-sdk/QueryConnectionResponse", + is(o: any): o is QueryConnectionResponse { + return o && (o.$typeUrl === QueryConnectionResponse.typeUrl || (o.proof instanceof Uint8Array || typeof o.proof === "string") && Height.is(o.proofHeight)); + }, + isSDK(o: any): o is QueryConnectionResponseSDKType { + return o && (o.$typeUrl === QueryConnectionResponse.typeUrl || (o.proof instanceof Uint8Array || typeof o.proof === "string") && Height.isSDK(o.proof_height)); + }, + isAmino(o: any): o is QueryConnectionResponseAmino { + return o && (o.$typeUrl === QueryConnectionResponse.typeUrl || (o.proof instanceof Uint8Array || typeof o.proof === "string") && Height.isAmino(o.proof_height)); + }, encode(message: QueryConnectionResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.connection !== undefined) { ConnectionEnd.encode(message.connection, writer.uint32(10).fork()).ldelim(); @@ -777,6 +797,13 @@ export const QueryConnectionResponse = { typeUrl: "/ibc.core.connection.v1.QueryConnectionResponse", value: QueryConnectionResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryConnectionResponse.typeUrl)) { + return; + } + ConnectionEnd.registerTypeUrl(); + Height.registerTypeUrl(); } }; function createBaseQueryConnectionsRequest(): QueryConnectionsRequest { @@ -794,6 +821,15 @@ function createBaseQueryConnectionsRequest(): QueryConnectionsRequest { export const QueryConnectionsRequest = { typeUrl: "/ibc.core.connection.v1.QueryConnectionsRequest", aminoType: "cosmos-sdk/QueryConnectionsRequest", + is(o: any): o is QueryConnectionsRequest { + return o && o.$typeUrl === QueryConnectionsRequest.typeUrl; + }, + isSDK(o: any): o is QueryConnectionsRequestSDKType { + return o && o.$typeUrl === QueryConnectionsRequest.typeUrl; + }, + isAmino(o: any): o is QueryConnectionsRequestAmino { + return o && o.$typeUrl === QueryConnectionsRequest.typeUrl; + }, encode(message: QueryConnectionsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.pagination !== undefined) { PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); @@ -876,6 +912,12 @@ export const QueryConnectionsRequest = { typeUrl: "/ibc.core.connection.v1.QueryConnectionsRequest", value: QueryConnectionsRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryConnectionsRequest.typeUrl)) { + return; + } + PageRequest.registerTypeUrl(); } }; function createBaseQueryConnectionsResponse(): QueryConnectionsResponse { @@ -895,6 +937,15 @@ function createBaseQueryConnectionsResponse(): QueryConnectionsResponse { export const QueryConnectionsResponse = { typeUrl: "/ibc.core.connection.v1.QueryConnectionsResponse", aminoType: "cosmos-sdk/QueryConnectionsResponse", + is(o: any): o is QueryConnectionsResponse { + return o && (o.$typeUrl === QueryConnectionsResponse.typeUrl || Array.isArray(o.connections) && (!o.connections.length || IdentifiedConnection.is(o.connections[0])) && Height.is(o.height)); + }, + isSDK(o: any): o is QueryConnectionsResponseSDKType { + return o && (o.$typeUrl === QueryConnectionsResponse.typeUrl || Array.isArray(o.connections) && (!o.connections.length || IdentifiedConnection.isSDK(o.connections[0])) && Height.isSDK(o.height)); + }, + isAmino(o: any): o is QueryConnectionsResponseAmino { + return o && (o.$typeUrl === QueryConnectionsResponse.typeUrl || Array.isArray(o.connections) && (!o.connections.length || IdentifiedConnection.isAmino(o.connections[0])) && Height.isAmino(o.height)); + }, encode(message: QueryConnectionsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.connections) { IdentifiedConnection.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -1019,6 +1070,14 @@ export const QueryConnectionsResponse = { typeUrl: "/ibc.core.connection.v1.QueryConnectionsResponse", value: QueryConnectionsResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryConnectionsResponse.typeUrl)) { + return; + } + IdentifiedConnection.registerTypeUrl(); + PageResponse.registerTypeUrl(); + Height.registerTypeUrl(); } }; function createBaseQueryClientConnectionsRequest(): QueryClientConnectionsRequest { @@ -1036,6 +1095,15 @@ function createBaseQueryClientConnectionsRequest(): QueryClientConnectionsReques export const QueryClientConnectionsRequest = { typeUrl: "/ibc.core.connection.v1.QueryClientConnectionsRequest", aminoType: "cosmos-sdk/QueryClientConnectionsRequest", + is(o: any): o is QueryClientConnectionsRequest { + return o && (o.$typeUrl === QueryClientConnectionsRequest.typeUrl || typeof o.clientId === "string"); + }, + isSDK(o: any): o is QueryClientConnectionsRequestSDKType { + return o && (o.$typeUrl === QueryClientConnectionsRequest.typeUrl || typeof o.client_id === "string"); + }, + isAmino(o: any): o is QueryClientConnectionsRequestAmino { + return o && (o.$typeUrl === QueryClientConnectionsRequest.typeUrl || typeof o.client_id === "string"); + }, encode(message: QueryClientConnectionsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.clientId !== "") { writer.uint32(10).string(message.clientId); @@ -1116,7 +1184,8 @@ export const QueryClientConnectionsRequest = { typeUrl: "/ibc.core.connection.v1.QueryClientConnectionsRequest", value: QueryClientConnectionsRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryClientConnectionsResponse(): QueryClientConnectionsResponse { return { @@ -1135,6 +1204,15 @@ function createBaseQueryClientConnectionsResponse(): QueryClientConnectionsRespo export const QueryClientConnectionsResponse = { typeUrl: "/ibc.core.connection.v1.QueryClientConnectionsResponse", aminoType: "cosmos-sdk/QueryClientConnectionsResponse", + is(o: any): o is QueryClientConnectionsResponse { + return o && (o.$typeUrl === QueryClientConnectionsResponse.typeUrl || Array.isArray(o.connectionPaths) && (!o.connectionPaths.length || typeof o.connectionPaths[0] === "string") && (o.proof instanceof Uint8Array || typeof o.proof === "string") && Height.is(o.proofHeight)); + }, + isSDK(o: any): o is QueryClientConnectionsResponseSDKType { + return o && (o.$typeUrl === QueryClientConnectionsResponse.typeUrl || Array.isArray(o.connection_paths) && (!o.connection_paths.length || typeof o.connection_paths[0] === "string") && (o.proof instanceof Uint8Array || typeof o.proof === "string") && Height.isSDK(o.proof_height)); + }, + isAmino(o: any): o is QueryClientConnectionsResponseAmino { + return o && (o.$typeUrl === QueryClientConnectionsResponse.typeUrl || Array.isArray(o.connection_paths) && (!o.connection_paths.length || typeof o.connection_paths[0] === "string") && (o.proof instanceof Uint8Array || typeof o.proof === "string") && Height.isAmino(o.proof_height)); + }, encode(message: QueryClientConnectionsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.connectionPaths) { writer.uint32(10).string(v!); @@ -1257,6 +1335,12 @@ export const QueryClientConnectionsResponse = { typeUrl: "/ibc.core.connection.v1.QueryClientConnectionsResponse", value: QueryClientConnectionsResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryClientConnectionsResponse.typeUrl)) { + return; + } + Height.registerTypeUrl(); } }; function createBaseQueryConnectionClientStateRequest(): QueryConnectionClientStateRequest { @@ -1274,6 +1358,15 @@ function createBaseQueryConnectionClientStateRequest(): QueryConnectionClientSta export const QueryConnectionClientStateRequest = { typeUrl: "/ibc.core.connection.v1.QueryConnectionClientStateRequest", aminoType: "cosmos-sdk/QueryConnectionClientStateRequest", + is(o: any): o is QueryConnectionClientStateRequest { + return o && (o.$typeUrl === QueryConnectionClientStateRequest.typeUrl || typeof o.connectionId === "string"); + }, + isSDK(o: any): o is QueryConnectionClientStateRequestSDKType { + return o && (o.$typeUrl === QueryConnectionClientStateRequest.typeUrl || typeof o.connection_id === "string"); + }, + isAmino(o: any): o is QueryConnectionClientStateRequestAmino { + return o && (o.$typeUrl === QueryConnectionClientStateRequest.typeUrl || typeof o.connection_id === "string"); + }, encode(message: QueryConnectionClientStateRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.connectionId !== "") { writer.uint32(10).string(message.connectionId); @@ -1354,7 +1447,8 @@ export const QueryConnectionClientStateRequest = { typeUrl: "/ibc.core.connection.v1.QueryConnectionClientStateRequest", value: QueryConnectionClientStateRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryConnectionClientStateResponse(): QueryConnectionClientStateResponse { return { @@ -1373,6 +1467,15 @@ function createBaseQueryConnectionClientStateResponse(): QueryConnectionClientSt export const QueryConnectionClientStateResponse = { typeUrl: "/ibc.core.connection.v1.QueryConnectionClientStateResponse", aminoType: "cosmos-sdk/QueryConnectionClientStateResponse", + is(o: any): o is QueryConnectionClientStateResponse { + return o && (o.$typeUrl === QueryConnectionClientStateResponse.typeUrl || (o.proof instanceof Uint8Array || typeof o.proof === "string") && Height.is(o.proofHeight)); + }, + isSDK(o: any): o is QueryConnectionClientStateResponseSDKType { + return o && (o.$typeUrl === QueryConnectionClientStateResponse.typeUrl || (o.proof instanceof Uint8Array || typeof o.proof === "string") && Height.isSDK(o.proof_height)); + }, + isAmino(o: any): o is QueryConnectionClientStateResponseAmino { + return o && (o.$typeUrl === QueryConnectionClientStateResponse.typeUrl || (o.proof instanceof Uint8Array || typeof o.proof === "string") && Height.isAmino(o.proof_height)); + }, encode(message: QueryConnectionClientStateResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.identifiedClientState !== undefined) { IdentifiedClientState.encode(message.identifiedClientState, writer.uint32(10).fork()).ldelim(); @@ -1487,6 +1590,13 @@ export const QueryConnectionClientStateResponse = { typeUrl: "/ibc.core.connection.v1.QueryConnectionClientStateResponse", value: QueryConnectionClientStateResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryConnectionClientStateResponse.typeUrl)) { + return; + } + IdentifiedClientState.registerTypeUrl(); + Height.registerTypeUrl(); } }; function createBaseQueryConnectionConsensusStateRequest(): QueryConnectionConsensusStateRequest { @@ -1506,6 +1616,15 @@ function createBaseQueryConnectionConsensusStateRequest(): QueryConnectionConsen export const QueryConnectionConsensusStateRequest = { typeUrl: "/ibc.core.connection.v1.QueryConnectionConsensusStateRequest", aminoType: "cosmos-sdk/QueryConnectionConsensusStateRequest", + is(o: any): o is QueryConnectionConsensusStateRequest { + return o && (o.$typeUrl === QueryConnectionConsensusStateRequest.typeUrl || typeof o.connectionId === "string" && typeof o.revisionNumber === "bigint" && typeof o.revisionHeight === "bigint"); + }, + isSDK(o: any): o is QueryConnectionConsensusStateRequestSDKType { + return o && (o.$typeUrl === QueryConnectionConsensusStateRequest.typeUrl || typeof o.connection_id === "string" && typeof o.revision_number === "bigint" && typeof o.revision_height === "bigint"); + }, + isAmino(o: any): o is QueryConnectionConsensusStateRequestAmino { + return o && (o.$typeUrl === QueryConnectionConsensusStateRequest.typeUrl || typeof o.connection_id === "string" && typeof o.revision_number === "bigint" && typeof o.revision_height === "bigint"); + }, encode(message: QueryConnectionConsensusStateRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.connectionId !== "") { writer.uint32(10).string(message.connectionId); @@ -1620,7 +1739,8 @@ export const QueryConnectionConsensusStateRequest = { typeUrl: "/ibc.core.connection.v1.QueryConnectionConsensusStateRequest", value: QueryConnectionConsensusStateRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryConnectionConsensusStateResponse(): QueryConnectionConsensusStateResponse { return { @@ -1640,6 +1760,15 @@ function createBaseQueryConnectionConsensusStateResponse(): QueryConnectionConse export const QueryConnectionConsensusStateResponse = { typeUrl: "/ibc.core.connection.v1.QueryConnectionConsensusStateResponse", aminoType: "cosmos-sdk/QueryConnectionConsensusStateResponse", + is(o: any): o is QueryConnectionConsensusStateResponse { + return o && (o.$typeUrl === QueryConnectionConsensusStateResponse.typeUrl || typeof o.clientId === "string" && (o.proof instanceof Uint8Array || typeof o.proof === "string") && Height.is(o.proofHeight)); + }, + isSDK(o: any): o is QueryConnectionConsensusStateResponseSDKType { + return o && (o.$typeUrl === QueryConnectionConsensusStateResponse.typeUrl || typeof o.client_id === "string" && (o.proof instanceof Uint8Array || typeof o.proof === "string") && Height.isSDK(o.proof_height)); + }, + isAmino(o: any): o is QueryConnectionConsensusStateResponseAmino { + return o && (o.$typeUrl === QueryConnectionConsensusStateResponse.typeUrl || typeof o.client_id === "string" && (o.proof instanceof Uint8Array || typeof o.proof === "string") && Height.isAmino(o.proof_height)); + }, encode(message: QueryConnectionConsensusStateResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.consensusState !== undefined) { Any.encode(message.consensusState, writer.uint32(10).fork()).ldelim(); @@ -1769,5 +1898,11 @@ export const QueryConnectionConsensusStateResponse = { typeUrl: "/ibc.core.connection.v1.QueryConnectionConsensusStateResponse", value: QueryConnectionConsensusStateResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryConnectionConsensusStateResponse.typeUrl)) { + return; + } + Height.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/ibc/core/connection/v1/tx.registry.ts b/__fixtures__/v-next/outputv2/ibc/core/connection/v1/tx.registry.ts index 0348ea8474..e1161ecb54 100644 --- a/__fixtures__/v-next/outputv2/ibc/core/connection/v1/tx.registry.ts +++ b/__fixtures__/v-next/outputv2/ibc/core/connection/v1/tx.registry.ts @@ -1,11 +1,6 @@ -import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { TelescopeGeneratedType } from "../../../../types"; import { MsgConnectionOpenInit, MsgConnectionOpenTry, MsgConnectionOpenAck, MsgConnectionOpenConfirm } from "./tx"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/ibc.core.connection.v1.MsgConnectionOpenInit", MsgConnectionOpenInit], ["/ibc.core.connection.v1.MsgConnectionOpenTry", MsgConnectionOpenTry], ["/ibc.core.connection.v1.MsgConnectionOpenAck", MsgConnectionOpenAck], ["/ibc.core.connection.v1.MsgConnectionOpenConfirm", MsgConnectionOpenConfirm]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/ibc.core.connection.v1.MsgConnectionOpenInit", MsgConnectionOpenInit], ["/ibc.core.connection.v1.MsgConnectionOpenTry", MsgConnectionOpenTry], ["/ibc.core.connection.v1.MsgConnectionOpenAck", MsgConnectionOpenAck], ["/ibc.core.connection.v1.MsgConnectionOpenConfirm", MsgConnectionOpenConfirm]]; export const MessageComposer = { encoded: { connectionOpenInit(value: MsgConnectionOpenInit) { diff --git a/__fixtures__/v-next/outputv2/ibc/core/connection/v1/tx.rpc.func.ts b/__fixtures__/v-next/outputv2/ibc/core/connection/v1/tx.rpc.func.ts new file mode 100644 index 0000000000..e4368dc4b5 --- /dev/null +++ b/__fixtures__/v-next/outputv2/ibc/core/connection/v1/tx.rpc.func.ts @@ -0,0 +1,39 @@ +import { buildTx } from "../../../../helper-func-types"; +import { MsgConnectionOpenInit, MsgConnectionOpenTry, MsgConnectionOpenAck, MsgConnectionOpenConfirm } from "./tx"; +/** + * ConnectionOpenInit defines a rpc handler method for MsgConnectionOpenInit. + * @name connectionOpenInit + * @package ibc.core.connection.v1 + * @see proto service: ibc.core.connection.v1.ConnectionOpenInit + */ +export const connectionOpenInit = buildTx({ + msg: MsgConnectionOpenInit +}); +/** + * ConnectionOpenTry defines a rpc handler method for MsgConnectionOpenTry. + * @name connectionOpenTry + * @package ibc.core.connection.v1 + * @see proto service: ibc.core.connection.v1.ConnectionOpenTry + */ +export const connectionOpenTry = buildTx({ + msg: MsgConnectionOpenTry +}); +/** + * ConnectionOpenAck defines a rpc handler method for MsgConnectionOpenAck. + * @name connectionOpenAck + * @package ibc.core.connection.v1 + * @see proto service: ibc.core.connection.v1.ConnectionOpenAck + */ +export const connectionOpenAck = buildTx({ + msg: MsgConnectionOpenAck +}); +/** + * ConnectionOpenConfirm defines a rpc handler method for + * MsgConnectionOpenConfirm. + * @name connectionOpenConfirm + * @package ibc.core.connection.v1 + * @see proto service: ibc.core.connection.v1.ConnectionOpenConfirm + */ +export const connectionOpenConfirm = buildTx({ + msg: MsgConnectionOpenConfirm +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/ibc/core/connection/v1/tx.ts b/__fixtures__/v-next/outputv2/ibc/core/connection/v1/tx.ts index 3f222bd05c..80bc96e6ea 100644 --- a/__fixtures__/v-next/outputv2/ibc/core/connection/v1/tx.ts +++ b/__fixtures__/v-next/outputv2/ibc/core/connection/v1/tx.ts @@ -2,6 +2,7 @@ import { Counterparty, CounterpartyAmino, CounterpartySDKType, Version, VersionA import { Any, AnyAmino, AnySDKType } from "../../../../google/protobuf/any"; import { Height, HeightAmino, HeightSDKType } from "../../client/v1/client"; import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { GlobalDecoderRegistry } from "../../../../registry"; import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../../helpers"; import { JsonSafe } from "../../../../json-safe"; export const protobufPackage = "ibc.core.connection.v1"; @@ -433,6 +434,15 @@ function createBaseMsgConnectionOpenInit(): MsgConnectionOpenInit { export const MsgConnectionOpenInit = { typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenInit", aminoType: "cosmos-sdk/MsgConnectionOpenInit", + is(o: any): o is MsgConnectionOpenInit { + return o && (o.$typeUrl === MsgConnectionOpenInit.typeUrl || typeof o.clientId === "string" && Counterparty.is(o.counterparty) && typeof o.delayPeriod === "bigint" && typeof o.signer === "string"); + }, + isSDK(o: any): o is MsgConnectionOpenInitSDKType { + return o && (o.$typeUrl === MsgConnectionOpenInit.typeUrl || typeof o.client_id === "string" && Counterparty.isSDK(o.counterparty) && typeof o.delay_period === "bigint" && typeof o.signer === "string"); + }, + isAmino(o: any): o is MsgConnectionOpenInitAmino { + return o && (o.$typeUrl === MsgConnectionOpenInit.typeUrl || typeof o.client_id === "string" && Counterparty.isAmino(o.counterparty) && typeof o.delay_period === "bigint" && typeof o.signer === "string"); + }, encode(message: MsgConnectionOpenInit, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.clientId !== "") { writer.uint32(10).string(message.clientId); @@ -579,6 +589,13 @@ export const MsgConnectionOpenInit = { typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenInit", value: MsgConnectionOpenInit.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgConnectionOpenInit.typeUrl)) { + return; + } + Counterparty.registerTypeUrl(); + Version.registerTypeUrl(); } }; function createBaseMsgConnectionOpenInitResponse(): MsgConnectionOpenInitResponse { @@ -594,6 +611,15 @@ function createBaseMsgConnectionOpenInitResponse(): MsgConnectionOpenInitRespons export const MsgConnectionOpenInitResponse = { typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenInitResponse", aminoType: "cosmos-sdk/MsgConnectionOpenInitResponse", + is(o: any): o is MsgConnectionOpenInitResponse { + return o && o.$typeUrl === MsgConnectionOpenInitResponse.typeUrl; + }, + isSDK(o: any): o is MsgConnectionOpenInitResponseSDKType { + return o && o.$typeUrl === MsgConnectionOpenInitResponse.typeUrl; + }, + isAmino(o: any): o is MsgConnectionOpenInitResponseAmino { + return o && o.$typeUrl === MsgConnectionOpenInitResponse.typeUrl; + }, encode(_: MsgConnectionOpenInitResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -658,7 +684,8 @@ export const MsgConnectionOpenInitResponse = { typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenInitResponse", value: MsgConnectionOpenInitResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgConnectionOpenTry(): MsgConnectionOpenTry { return { @@ -686,6 +713,15 @@ function createBaseMsgConnectionOpenTry(): MsgConnectionOpenTry { export const MsgConnectionOpenTry = { typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenTry", aminoType: "cosmos-sdk/MsgConnectionOpenTry", + is(o: any): o is MsgConnectionOpenTry { + return o && (o.$typeUrl === MsgConnectionOpenTry.typeUrl || typeof o.clientId === "string" && typeof o.previousConnectionId === "string" && Counterparty.is(o.counterparty) && typeof o.delayPeriod === "bigint" && Array.isArray(o.counterpartyVersions) && (!o.counterpartyVersions.length || Version.is(o.counterpartyVersions[0])) && Height.is(o.proofHeight) && (o.proofInit instanceof Uint8Array || typeof o.proofInit === "string") && (o.proofClient instanceof Uint8Array || typeof o.proofClient === "string") && (o.proofConsensus instanceof Uint8Array || typeof o.proofConsensus === "string") && Height.is(o.consensusHeight) && typeof o.signer === "string"); + }, + isSDK(o: any): o is MsgConnectionOpenTrySDKType { + return o && (o.$typeUrl === MsgConnectionOpenTry.typeUrl || typeof o.client_id === "string" && typeof o.previous_connection_id === "string" && Counterparty.isSDK(o.counterparty) && typeof o.delay_period === "bigint" && Array.isArray(o.counterparty_versions) && (!o.counterparty_versions.length || Version.isSDK(o.counterparty_versions[0])) && Height.isSDK(o.proof_height) && (o.proof_init instanceof Uint8Array || typeof o.proof_init === "string") && (o.proof_client instanceof Uint8Array || typeof o.proof_client === "string") && (o.proof_consensus instanceof Uint8Array || typeof o.proof_consensus === "string") && Height.isSDK(o.consensus_height) && typeof o.signer === "string"); + }, + isAmino(o: any): o is MsgConnectionOpenTryAmino { + return o && (o.$typeUrl === MsgConnectionOpenTry.typeUrl || typeof o.client_id === "string" && typeof o.previous_connection_id === "string" && Counterparty.isAmino(o.counterparty) && typeof o.delay_period === "bigint" && Array.isArray(o.counterparty_versions) && (!o.counterparty_versions.length || Version.isAmino(o.counterparty_versions[0])) && Height.isAmino(o.proof_height) && (o.proof_init instanceof Uint8Array || typeof o.proof_init === "string") && (o.proof_client instanceof Uint8Array || typeof o.proof_client === "string") && (o.proof_consensus instanceof Uint8Array || typeof o.proof_consensus === "string") && Height.isAmino(o.consensus_height) && typeof o.signer === "string"); + }, encode(message: MsgConnectionOpenTry, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.clientId !== "") { writer.uint32(10).string(message.clientId); @@ -951,6 +987,14 @@ export const MsgConnectionOpenTry = { typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenTry", value: MsgConnectionOpenTry.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgConnectionOpenTry.typeUrl)) { + return; + } + Counterparty.registerTypeUrl(); + Version.registerTypeUrl(); + Height.registerTypeUrl(); } }; function createBaseMsgConnectionOpenTryResponse(): MsgConnectionOpenTryResponse { @@ -965,6 +1009,15 @@ function createBaseMsgConnectionOpenTryResponse(): MsgConnectionOpenTryResponse export const MsgConnectionOpenTryResponse = { typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenTryResponse", aminoType: "cosmos-sdk/MsgConnectionOpenTryResponse", + is(o: any): o is MsgConnectionOpenTryResponse { + return o && o.$typeUrl === MsgConnectionOpenTryResponse.typeUrl; + }, + isSDK(o: any): o is MsgConnectionOpenTryResponseSDKType { + return o && o.$typeUrl === MsgConnectionOpenTryResponse.typeUrl; + }, + isAmino(o: any): o is MsgConnectionOpenTryResponseAmino { + return o && o.$typeUrl === MsgConnectionOpenTryResponse.typeUrl; + }, encode(_: MsgConnectionOpenTryResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -1029,7 +1082,8 @@ export const MsgConnectionOpenTryResponse = { typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenTryResponse", value: MsgConnectionOpenTryResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgConnectionOpenAck(): MsgConnectionOpenAck { return { @@ -1055,6 +1109,15 @@ function createBaseMsgConnectionOpenAck(): MsgConnectionOpenAck { export const MsgConnectionOpenAck = { typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenAck", aminoType: "cosmos-sdk/MsgConnectionOpenAck", + is(o: any): o is MsgConnectionOpenAck { + return o && (o.$typeUrl === MsgConnectionOpenAck.typeUrl || typeof o.connectionId === "string" && typeof o.counterpartyConnectionId === "string" && Height.is(o.proofHeight) && (o.proofTry instanceof Uint8Array || typeof o.proofTry === "string") && (o.proofClient instanceof Uint8Array || typeof o.proofClient === "string") && (o.proofConsensus instanceof Uint8Array || typeof o.proofConsensus === "string") && Height.is(o.consensusHeight) && typeof o.signer === "string"); + }, + isSDK(o: any): o is MsgConnectionOpenAckSDKType { + return o && (o.$typeUrl === MsgConnectionOpenAck.typeUrl || typeof o.connection_id === "string" && typeof o.counterparty_connection_id === "string" && Height.isSDK(o.proof_height) && (o.proof_try instanceof Uint8Array || typeof o.proof_try === "string") && (o.proof_client instanceof Uint8Array || typeof o.proof_client === "string") && (o.proof_consensus instanceof Uint8Array || typeof o.proof_consensus === "string") && Height.isSDK(o.consensus_height) && typeof o.signer === "string"); + }, + isAmino(o: any): o is MsgConnectionOpenAckAmino { + return o && (o.$typeUrl === MsgConnectionOpenAck.typeUrl || typeof o.connection_id === "string" && typeof o.counterparty_connection_id === "string" && Height.isAmino(o.proof_height) && (o.proof_try instanceof Uint8Array || typeof o.proof_try === "string") && (o.proof_client instanceof Uint8Array || typeof o.proof_client === "string") && (o.proof_consensus instanceof Uint8Array || typeof o.proof_consensus === "string") && Height.isAmino(o.consensus_height) && typeof o.signer === "string"); + }, encode(message: MsgConnectionOpenAck, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.connectionId !== "") { writer.uint32(10).string(message.connectionId); @@ -1278,6 +1341,12 @@ export const MsgConnectionOpenAck = { typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenAck", value: MsgConnectionOpenAck.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgConnectionOpenAck.typeUrl)) { + return; + } + Height.registerTypeUrl(); } }; function createBaseMsgConnectionOpenAckResponse(): MsgConnectionOpenAckResponse { @@ -1292,6 +1361,15 @@ function createBaseMsgConnectionOpenAckResponse(): MsgConnectionOpenAckResponse export const MsgConnectionOpenAckResponse = { typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenAckResponse", aminoType: "cosmos-sdk/MsgConnectionOpenAckResponse", + is(o: any): o is MsgConnectionOpenAckResponse { + return o && o.$typeUrl === MsgConnectionOpenAckResponse.typeUrl; + }, + isSDK(o: any): o is MsgConnectionOpenAckResponseSDKType { + return o && o.$typeUrl === MsgConnectionOpenAckResponse.typeUrl; + }, + isAmino(o: any): o is MsgConnectionOpenAckResponseAmino { + return o && o.$typeUrl === MsgConnectionOpenAckResponse.typeUrl; + }, encode(_: MsgConnectionOpenAckResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -1356,7 +1434,8 @@ export const MsgConnectionOpenAckResponse = { typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenAckResponse", value: MsgConnectionOpenAckResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgConnectionOpenConfirm(): MsgConnectionOpenConfirm { return { @@ -1376,6 +1455,15 @@ function createBaseMsgConnectionOpenConfirm(): MsgConnectionOpenConfirm { export const MsgConnectionOpenConfirm = { typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenConfirm", aminoType: "cosmos-sdk/MsgConnectionOpenConfirm", + is(o: any): o is MsgConnectionOpenConfirm { + return o && (o.$typeUrl === MsgConnectionOpenConfirm.typeUrl || typeof o.connectionId === "string" && (o.proofAck instanceof Uint8Array || typeof o.proofAck === "string") && Height.is(o.proofHeight) && typeof o.signer === "string"); + }, + isSDK(o: any): o is MsgConnectionOpenConfirmSDKType { + return o && (o.$typeUrl === MsgConnectionOpenConfirm.typeUrl || typeof o.connection_id === "string" && (o.proof_ack instanceof Uint8Array || typeof o.proof_ack === "string") && Height.isSDK(o.proof_height) && typeof o.signer === "string"); + }, + isAmino(o: any): o is MsgConnectionOpenConfirmAmino { + return o && (o.$typeUrl === MsgConnectionOpenConfirm.typeUrl || typeof o.connection_id === "string" && (o.proof_ack instanceof Uint8Array || typeof o.proof_ack === "string") && Height.isAmino(o.proof_height) && typeof o.signer === "string"); + }, encode(message: MsgConnectionOpenConfirm, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.connectionId !== "") { writer.uint32(10).string(message.connectionId); @@ -1503,6 +1591,12 @@ export const MsgConnectionOpenConfirm = { typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenConfirm", value: MsgConnectionOpenConfirm.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgConnectionOpenConfirm.typeUrl)) { + return; + } + Height.registerTypeUrl(); } }; function createBaseMsgConnectionOpenConfirmResponse(): MsgConnectionOpenConfirmResponse { @@ -1518,6 +1612,15 @@ function createBaseMsgConnectionOpenConfirmResponse(): MsgConnectionOpenConfirmR export const MsgConnectionOpenConfirmResponse = { typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenConfirmResponse", aminoType: "cosmos-sdk/MsgConnectionOpenConfirmResponse", + is(o: any): o is MsgConnectionOpenConfirmResponse { + return o && o.$typeUrl === MsgConnectionOpenConfirmResponse.typeUrl; + }, + isSDK(o: any): o is MsgConnectionOpenConfirmResponseSDKType { + return o && o.$typeUrl === MsgConnectionOpenConfirmResponse.typeUrl; + }, + isAmino(o: any): o is MsgConnectionOpenConfirmResponseAmino { + return o && o.$typeUrl === MsgConnectionOpenConfirmResponse.typeUrl; + }, encode(_: MsgConnectionOpenConfirmResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -1582,5 +1685,6 @@ export const MsgConnectionOpenConfirmResponse = { typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenConfirmResponse", value: MsgConnectionOpenConfirmResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/ibc/core/port/v1/query.rpc.func.ts b/__fixtures__/v-next/outputv2/ibc/core/port/v1/query.rpc.func.ts new file mode 100644 index 0000000000..4572ff49f2 --- /dev/null +++ b/__fixtures__/v-next/outputv2/ibc/core/port/v1/query.rpc.func.ts @@ -0,0 +1,15 @@ +import { buildQuery } from "../../../../helper-func-types"; +import { QueryAppVersionRequest, QueryAppVersionResponse } from "./query"; +/** + * AppVersion queries an IBC Port and determines the appropriate application version to be used + * @name getAppVersion + * @package ibc.core.port.v1 + * @see proto service: ibc.core.port.v1.AppVersion + */ +export const getAppVersion = buildQuery({ + encode: QueryAppVersionRequest.encode, + decode: QueryAppVersionResponse.decode, + service: "ibc.core.port.v1.Query", + method: "AppVersion", + deps: [QueryAppVersionRequest, QueryAppVersionResponse] +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/ibc/core/port/v1/query.ts b/__fixtures__/v-next/outputv2/ibc/core/port/v1/query.ts index 9c20d18926..e37454d729 100644 --- a/__fixtures__/v-next/outputv2/ibc/core/port/v1/query.ts +++ b/__fixtures__/v-next/outputv2/ibc/core/port/v1/query.ts @@ -1,6 +1,7 @@ import { Order, Counterparty, CounterpartyAmino, CounterpartySDKType, orderFromJSON, orderToJSON } from "../../channel/v1/channel"; -import { BinaryReader, BinaryWriter } from "../../../../binary"; import { isSet, DeepPartial } from "../../../../helpers"; +import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { GlobalDecoderRegistry } from "../../../../registry"; import { JsonSafe } from "../../../../json-safe"; export const protobufPackage = "ibc.core.port.v1"; /** @@ -148,6 +149,15 @@ function createBaseQueryAppVersionRequest(): QueryAppVersionRequest { export const QueryAppVersionRequest = { typeUrl: "/ibc.core.port.v1.QueryAppVersionRequest", aminoType: "cosmos-sdk/QueryAppVersionRequest", + is(o: any): o is QueryAppVersionRequest { + return o && (o.$typeUrl === QueryAppVersionRequest.typeUrl || typeof o.portId === "string" && typeof o.connectionId === "string" && isSet(o.ordering) && typeof o.proposedVersion === "string"); + }, + isSDK(o: any): o is QueryAppVersionRequestSDKType { + return o && (o.$typeUrl === QueryAppVersionRequest.typeUrl || typeof o.port_id === "string" && typeof o.connection_id === "string" && isSet(o.ordering) && typeof o.proposed_version === "string"); + }, + isAmino(o: any): o is QueryAppVersionRequestAmino { + return o && (o.$typeUrl === QueryAppVersionRequest.typeUrl || typeof o.port_id === "string" && typeof o.connection_id === "string" && isSet(o.ordering) && typeof o.proposed_version === "string"); + }, encode(message: QueryAppVersionRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.portId !== "") { writer.uint32(10).string(message.portId); @@ -290,6 +300,12 @@ export const QueryAppVersionRequest = { typeUrl: "/ibc.core.port.v1.QueryAppVersionRequest", value: QueryAppVersionRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryAppVersionRequest.typeUrl)) { + return; + } + Counterparty.registerTypeUrl(); } }; function createBaseQueryAppVersionResponse(): QueryAppVersionResponse { @@ -307,6 +323,15 @@ function createBaseQueryAppVersionResponse(): QueryAppVersionResponse { export const QueryAppVersionResponse = { typeUrl: "/ibc.core.port.v1.QueryAppVersionResponse", aminoType: "cosmos-sdk/QueryAppVersionResponse", + is(o: any): o is QueryAppVersionResponse { + return o && (o.$typeUrl === QueryAppVersionResponse.typeUrl || typeof o.portId === "string" && typeof o.version === "string"); + }, + isSDK(o: any): o is QueryAppVersionResponseSDKType { + return o && (o.$typeUrl === QueryAppVersionResponse.typeUrl || typeof o.port_id === "string" && typeof o.version === "string"); + }, + isAmino(o: any): o is QueryAppVersionResponseAmino { + return o && (o.$typeUrl === QueryAppVersionResponse.typeUrl || typeof o.port_id === "string" && typeof o.version === "string"); + }, encode(message: QueryAppVersionResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.portId !== "") { writer.uint32(10).string(message.portId); @@ -402,5 +427,6 @@ export const QueryAppVersionResponse = { typeUrl: "/ibc.core.port.v1.QueryAppVersionResponse", value: QueryAppVersionResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/ibc/core/types/v1/genesis.ts b/__fixtures__/v-next/outputv2/ibc/core/types/v1/genesis.ts index 1105b10113..ecbf9e55f1 100644 --- a/__fixtures__/v-next/outputv2/ibc/core/types/v1/genesis.ts +++ b/__fixtures__/v-next/outputv2/ibc/core/types/v1/genesis.ts @@ -8,6 +8,7 @@ import { GenesisState as GenesisState3 } from "../../channel/v1/genesis"; import { GenesisStateAmino as GenesisState3Amino } from "../../channel/v1/genesis"; import { GenesisStateSDKType as GenesisState3SDKType } from "../../channel/v1/genesis"; import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { GlobalDecoderRegistry } from "../../../../registry"; import { isSet, DeepPartial } from "../../../../helpers"; import { JsonSafe } from "../../../../json-safe"; export const protobufPackage = "ibc.core.types.v1"; @@ -86,6 +87,15 @@ function createBaseGenesisState(): GenesisState { export const GenesisState = { typeUrl: "/ibc.core.types.v1.GenesisState", aminoType: "cosmos-sdk/GenesisState", + is(o: any): o is GenesisState { + return o && (o.$typeUrl === GenesisState.typeUrl || GenesisState1.is(o.clientGenesis) && GenesisState2.is(o.connectionGenesis) && GenesisState3.is(o.channelGenesis)); + }, + isSDK(o: any): o is GenesisStateSDKType { + return o && (o.$typeUrl === GenesisState.typeUrl || GenesisState1.isSDK(o.client_genesis) && GenesisState2.isSDK(o.connection_genesis) && GenesisState3.isSDK(o.channel_genesis)); + }, + isAmino(o: any): o is GenesisStateAmino { + return o && (o.$typeUrl === GenesisState.typeUrl || GenesisState1.isAmino(o.client_genesis) && GenesisState2.isAmino(o.connection_genesis) && GenesisState3.isAmino(o.channel_genesis)); + }, encode(message: GenesisState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.clientGenesis !== undefined) { GenesisState1.encode(message.clientGenesis, writer.uint32(10).fork()).ldelim(); @@ -202,5 +212,13 @@ export const GenesisState = { typeUrl: "/ibc.core.types.v1.GenesisState", value: GenesisState.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GenesisState.typeUrl)) { + return; + } + GenesisState1.registerTypeUrl(); + GenesisState2.registerTypeUrl(); + GenesisState3.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/ibc/lightclients/localhost/v1/localhost.ts b/__fixtures__/v-next/outputv2/ibc/lightclients/localhost/v1/localhost.ts index ab275eaa24..b115fd152b 100644 --- a/__fixtures__/v-next/outputv2/ibc/lightclients/localhost/v1/localhost.ts +++ b/__fixtures__/v-next/outputv2/ibc/lightclients/localhost/v1/localhost.ts @@ -1,5 +1,6 @@ import { Height, HeightAmino, HeightSDKType } from "../../../core/client/v1/client"; import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { GlobalDecoderRegistry } from "../../../../registry"; import { isSet, DeepPartial } from "../../../../helpers"; import { JsonSafe } from "../../../../json-safe"; export const protobufPackage = "ibc.lightclients.localhost.v1"; @@ -72,6 +73,15 @@ function createBaseClientState(): ClientState { export const ClientState = { typeUrl: "/ibc.lightclients.localhost.v1.ClientState", aminoType: "cosmos-sdk/ClientState", + is(o: any): o is ClientState { + return o && (o.$typeUrl === ClientState.typeUrl || typeof o.chainId === "string" && Height.is(o.height)); + }, + isSDK(o: any): o is ClientStateSDKType { + return o && (o.$typeUrl === ClientState.typeUrl || typeof o.chain_id === "string" && Height.isSDK(o.height)); + }, + isAmino(o: any): o is ClientStateAmino { + return o && (o.$typeUrl === ClientState.typeUrl || typeof o.chain_id === "string" && Height.isAmino(o.height)); + }, encode(message: ClientState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.chainId !== "") { writer.uint32(10).string(message.chainId); @@ -169,5 +179,11 @@ export const ClientState = { typeUrl: "/ibc.lightclients.localhost.v1.ClientState", value: ClientState.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ClientState.typeUrl)) { + return; + } + Height.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/ibc/lightclients/solomachine/v1/solomachine.ts b/__fixtures__/v-next/outputv2/ibc/lightclients/solomachine/v1/solomachine.ts index 76f9e35b6e..ac94153794 100644 --- a/__fixtures__/v-next/outputv2/ibc/lightclients/solomachine/v1/solomachine.ts +++ b/__fixtures__/v-next/outputv2/ibc/lightclients/solomachine/v1/solomachine.ts @@ -2,6 +2,7 @@ import { Any, AnyAmino, AnySDKType } from "../../../../google/protobuf/any"; import { ConnectionEnd, ConnectionEndAmino, ConnectionEndSDKType } from "../../../core/connection/v1/connection"; import { Channel, ChannelAmino, ChannelSDKType } from "../../../core/channel/v1/channel"; import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { GlobalDecoderRegistry } from "../../../../registry"; import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../../helpers"; import { JsonSafe } from "../../../../json-safe"; export const protobufPackage = "ibc.lightclients.solomachine.v1"; @@ -866,6 +867,15 @@ function createBaseClientState(): ClientState { export const ClientState = { typeUrl: "/ibc.lightclients.solomachine.v1.ClientState", aminoType: "cosmos-sdk/ClientState", + is(o: any): o is ClientState { + return o && (o.$typeUrl === ClientState.typeUrl || typeof o.sequence === "bigint" && typeof o.frozenSequence === "bigint" && typeof o.allowUpdateAfterProposal === "boolean"); + }, + isSDK(o: any): o is ClientStateSDKType { + return o && (o.$typeUrl === ClientState.typeUrl || typeof o.sequence === "bigint" && typeof o.frozen_sequence === "bigint" && typeof o.allow_update_after_proposal === "boolean"); + }, + isAmino(o: any): o is ClientStateAmino { + return o && (o.$typeUrl === ClientState.typeUrl || typeof o.sequence === "bigint" && typeof o.frozen_sequence === "bigint" && typeof o.allow_update_after_proposal === "boolean"); + }, encode(message: ClientState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.sequence !== BigInt(0)) { writer.uint32(8).uint64(message.sequence); @@ -997,6 +1007,12 @@ export const ClientState = { typeUrl: "/ibc.lightclients.solomachine.v1.ClientState", value: ClientState.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ClientState.typeUrl)) { + return; + } + ConsensusState.registerTypeUrl(); } }; function createBaseConsensusState(): ConsensusState { @@ -1017,6 +1033,15 @@ function createBaseConsensusState(): ConsensusState { export const ConsensusState = { typeUrl: "/ibc.lightclients.solomachine.v1.ConsensusState", aminoType: "cosmos-sdk/ConsensusState", + is(o: any): o is ConsensusState { + return o && (o.$typeUrl === ConsensusState.typeUrl || typeof o.diversifier === "string" && typeof o.timestamp === "bigint"); + }, + isSDK(o: any): o is ConsensusStateSDKType { + return o && (o.$typeUrl === ConsensusState.typeUrl || typeof o.diversifier === "string" && typeof o.timestamp === "bigint"); + }, + isAmino(o: any): o is ConsensusStateAmino { + return o && (o.$typeUrl === ConsensusState.typeUrl || typeof o.diversifier === "string" && typeof o.timestamp === "bigint"); + }, encode(message: ConsensusState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.publicKey !== undefined) { Any.encode(message.publicKey, writer.uint32(10).fork()).ldelim(); @@ -1131,7 +1156,8 @@ export const ConsensusState = { typeUrl: "/ibc.lightclients.solomachine.v1.ConsensusState", value: ConsensusState.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseHeader(): Header { return { @@ -1151,6 +1177,15 @@ function createBaseHeader(): Header { export const Header = { typeUrl: "/ibc.lightclients.solomachine.v1.Header", aminoType: "cosmos-sdk/Header", + is(o: any): o is Header { + return o && (o.$typeUrl === Header.typeUrl || typeof o.sequence === "bigint" && typeof o.timestamp === "bigint" && (o.signature instanceof Uint8Array || typeof o.signature === "string") && typeof o.newDiversifier === "string"); + }, + isSDK(o: any): o is HeaderSDKType { + return o && (o.$typeUrl === Header.typeUrl || typeof o.sequence === "bigint" && typeof o.timestamp === "bigint" && (o.signature instanceof Uint8Array || typeof o.signature === "string") && typeof o.new_diversifier === "string"); + }, + isAmino(o: any): o is HeaderAmino { + return o && (o.$typeUrl === Header.typeUrl || typeof o.sequence === "bigint" && typeof o.timestamp === "bigint" && (o.signature instanceof Uint8Array || typeof o.signature === "string") && typeof o.new_diversifier === "string"); + }, encode(message: Header, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.sequence !== BigInt(0)) { writer.uint32(8).uint64(message.sequence); @@ -1297,7 +1332,8 @@ export const Header = { typeUrl: "/ibc.lightclients.solomachine.v1.Header", value: Header.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMisbehaviour(): Misbehaviour { return { @@ -1317,6 +1353,15 @@ function createBaseMisbehaviour(): Misbehaviour { export const Misbehaviour = { typeUrl: "/ibc.lightclients.solomachine.v1.Misbehaviour", aminoType: "cosmos-sdk/Misbehaviour", + is(o: any): o is Misbehaviour { + return o && (o.$typeUrl === Misbehaviour.typeUrl || typeof o.clientId === "string" && typeof o.sequence === "bigint"); + }, + isSDK(o: any): o is MisbehaviourSDKType { + return o && (o.$typeUrl === Misbehaviour.typeUrl || typeof o.client_id === "string" && typeof o.sequence === "bigint"); + }, + isAmino(o: any): o is MisbehaviourAmino { + return o && (o.$typeUrl === Misbehaviour.typeUrl || typeof o.client_id === "string" && typeof o.sequence === "bigint"); + }, encode(message: Misbehaviour, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.clientId !== "") { writer.uint32(10).string(message.clientId); @@ -1448,6 +1493,12 @@ export const Misbehaviour = { typeUrl: "/ibc.lightclients.solomachine.v1.Misbehaviour", value: Misbehaviour.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Misbehaviour.typeUrl)) { + return; + } + SignatureAndData.registerTypeUrl(); } }; function createBaseSignatureAndData(): SignatureAndData { @@ -1468,6 +1519,15 @@ function createBaseSignatureAndData(): SignatureAndData { export const SignatureAndData = { typeUrl: "/ibc.lightclients.solomachine.v1.SignatureAndData", aminoType: "cosmos-sdk/SignatureAndData", + is(o: any): o is SignatureAndData { + return o && (o.$typeUrl === SignatureAndData.typeUrl || (o.signature instanceof Uint8Array || typeof o.signature === "string") && isSet(o.dataType) && (o.data instanceof Uint8Array || typeof o.data === "string") && typeof o.timestamp === "bigint"); + }, + isSDK(o: any): o is SignatureAndDataSDKType { + return o && (o.$typeUrl === SignatureAndData.typeUrl || (o.signature instanceof Uint8Array || typeof o.signature === "string") && isSet(o.data_type) && (o.data instanceof Uint8Array || typeof o.data === "string") && typeof o.timestamp === "bigint"); + }, + isAmino(o: any): o is SignatureAndDataAmino { + return o && (o.$typeUrl === SignatureAndData.typeUrl || (o.signature instanceof Uint8Array || typeof o.signature === "string") && isSet(o.data_type) && (o.data instanceof Uint8Array || typeof o.data === "string") && typeof o.timestamp === "bigint"); + }, encode(message: SignatureAndData, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.signature.length !== 0) { writer.uint32(10).bytes(message.signature); @@ -1595,7 +1655,8 @@ export const SignatureAndData = { typeUrl: "/ibc.lightclients.solomachine.v1.SignatureAndData", value: SignatureAndData.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseTimestampedSignatureData(): TimestampedSignatureData { return { @@ -1613,6 +1674,15 @@ function createBaseTimestampedSignatureData(): TimestampedSignatureData { export const TimestampedSignatureData = { typeUrl: "/ibc.lightclients.solomachine.v1.TimestampedSignatureData", aminoType: "cosmos-sdk/TimestampedSignatureData", + is(o: any): o is TimestampedSignatureData { + return o && (o.$typeUrl === TimestampedSignatureData.typeUrl || (o.signatureData instanceof Uint8Array || typeof o.signatureData === "string") && typeof o.timestamp === "bigint"); + }, + isSDK(o: any): o is TimestampedSignatureDataSDKType { + return o && (o.$typeUrl === TimestampedSignatureData.typeUrl || (o.signature_data instanceof Uint8Array || typeof o.signature_data === "string") && typeof o.timestamp === "bigint"); + }, + isAmino(o: any): o is TimestampedSignatureDataAmino { + return o && (o.$typeUrl === TimestampedSignatureData.typeUrl || (o.signature_data instanceof Uint8Array || typeof o.signature_data === "string") && typeof o.timestamp === "bigint"); + }, encode(message: TimestampedSignatureData, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.signatureData.length !== 0) { writer.uint32(10).bytes(message.signatureData); @@ -1710,7 +1780,8 @@ export const TimestampedSignatureData = { typeUrl: "/ibc.lightclients.solomachine.v1.TimestampedSignatureData", value: TimestampedSignatureData.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseSignBytes(): SignBytes { return { @@ -1730,6 +1801,15 @@ function createBaseSignBytes(): SignBytes { export const SignBytes = { typeUrl: "/ibc.lightclients.solomachine.v1.SignBytes", aminoType: "cosmos-sdk/SignBytes", + is(o: any): o is SignBytes { + return o && (o.$typeUrl === SignBytes.typeUrl || typeof o.sequence === "bigint" && typeof o.timestamp === "bigint" && typeof o.diversifier === "string" && isSet(o.dataType) && (o.data instanceof Uint8Array || typeof o.data === "string")); + }, + isSDK(o: any): o is SignBytesSDKType { + return o && (o.$typeUrl === SignBytes.typeUrl || typeof o.sequence === "bigint" && typeof o.timestamp === "bigint" && typeof o.diversifier === "string" && isSet(o.data_type) && (o.data instanceof Uint8Array || typeof o.data === "string")); + }, + isAmino(o: any): o is SignBytesAmino { + return o && (o.$typeUrl === SignBytes.typeUrl || typeof o.sequence === "bigint" && typeof o.timestamp === "bigint" && typeof o.diversifier === "string" && isSet(o.data_type) && (o.data instanceof Uint8Array || typeof o.data === "string")); + }, encode(message: SignBytes, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.sequence !== BigInt(0)) { writer.uint32(8).uint64(message.sequence); @@ -1874,7 +1954,8 @@ export const SignBytes = { typeUrl: "/ibc.lightclients.solomachine.v1.SignBytes", value: SignBytes.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseHeaderData(): HeaderData { return { @@ -1891,6 +1972,15 @@ function createBaseHeaderData(): HeaderData { export const HeaderData = { typeUrl: "/ibc.lightclients.solomachine.v1.HeaderData", aminoType: "cosmos-sdk/HeaderData", + is(o: any): o is HeaderData { + return o && (o.$typeUrl === HeaderData.typeUrl || typeof o.newDiversifier === "string"); + }, + isSDK(o: any): o is HeaderDataSDKType { + return o && (o.$typeUrl === HeaderData.typeUrl || typeof o.new_diversifier === "string"); + }, + isAmino(o: any): o is HeaderDataAmino { + return o && (o.$typeUrl === HeaderData.typeUrl || typeof o.new_diversifier === "string"); + }, encode(message: HeaderData, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.newPubKey !== undefined) { Any.encode(message.newPubKey, writer.uint32(10).fork()).ldelim(); @@ -1988,7 +2078,8 @@ export const HeaderData = { typeUrl: "/ibc.lightclients.solomachine.v1.HeaderData", value: HeaderData.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseClientStateData(): ClientStateData { return { @@ -2005,6 +2096,15 @@ function createBaseClientStateData(): ClientStateData { export const ClientStateData = { typeUrl: "/ibc.lightclients.solomachine.v1.ClientStateData", aminoType: "cosmos-sdk/ClientStateData", + is(o: any): o is ClientStateData { + return o && (o.$typeUrl === ClientStateData.typeUrl || o.path instanceof Uint8Array || typeof o.path === "string"); + }, + isSDK(o: any): o is ClientStateDataSDKType { + return o && (o.$typeUrl === ClientStateData.typeUrl || o.path instanceof Uint8Array || typeof o.path === "string"); + }, + isAmino(o: any): o is ClientStateDataAmino { + return o && (o.$typeUrl === ClientStateData.typeUrl || o.path instanceof Uint8Array || typeof o.path === "string"); + }, encode(message: ClientStateData, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.path.length !== 0) { writer.uint32(10).bytes(message.path); @@ -2102,7 +2202,8 @@ export const ClientStateData = { typeUrl: "/ibc.lightclients.solomachine.v1.ClientStateData", value: ClientStateData.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseConsensusStateData(): ConsensusStateData { return { @@ -2120,6 +2221,15 @@ function createBaseConsensusStateData(): ConsensusStateData { export const ConsensusStateData = { typeUrl: "/ibc.lightclients.solomachine.v1.ConsensusStateData", aminoType: "cosmos-sdk/ConsensusStateData", + is(o: any): o is ConsensusStateData { + return o && (o.$typeUrl === ConsensusStateData.typeUrl || o.path instanceof Uint8Array || typeof o.path === "string"); + }, + isSDK(o: any): o is ConsensusStateDataSDKType { + return o && (o.$typeUrl === ConsensusStateData.typeUrl || o.path instanceof Uint8Array || typeof o.path === "string"); + }, + isAmino(o: any): o is ConsensusStateDataAmino { + return o && (o.$typeUrl === ConsensusStateData.typeUrl || o.path instanceof Uint8Array || typeof o.path === "string"); + }, encode(message: ConsensusStateData, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.path.length !== 0) { writer.uint32(10).bytes(message.path); @@ -2217,7 +2327,8 @@ export const ConsensusStateData = { typeUrl: "/ibc.lightclients.solomachine.v1.ConsensusStateData", value: ConsensusStateData.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseConnectionStateData(): ConnectionStateData { return { @@ -2235,6 +2346,15 @@ function createBaseConnectionStateData(): ConnectionStateData { export const ConnectionStateData = { typeUrl: "/ibc.lightclients.solomachine.v1.ConnectionStateData", aminoType: "cosmos-sdk/ConnectionStateData", + is(o: any): o is ConnectionStateData { + return o && (o.$typeUrl === ConnectionStateData.typeUrl || o.path instanceof Uint8Array || typeof o.path === "string"); + }, + isSDK(o: any): o is ConnectionStateDataSDKType { + return o && (o.$typeUrl === ConnectionStateData.typeUrl || o.path instanceof Uint8Array || typeof o.path === "string"); + }, + isAmino(o: any): o is ConnectionStateDataAmino { + return o && (o.$typeUrl === ConnectionStateData.typeUrl || o.path instanceof Uint8Array || typeof o.path === "string"); + }, encode(message: ConnectionStateData, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.path.length !== 0) { writer.uint32(10).bytes(message.path); @@ -2332,6 +2452,12 @@ export const ConnectionStateData = { typeUrl: "/ibc.lightclients.solomachine.v1.ConnectionStateData", value: ConnectionStateData.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ConnectionStateData.typeUrl)) { + return; + } + ConnectionEnd.registerTypeUrl(); } }; function createBaseChannelStateData(): ChannelStateData { @@ -2350,6 +2476,15 @@ function createBaseChannelStateData(): ChannelStateData { export const ChannelStateData = { typeUrl: "/ibc.lightclients.solomachine.v1.ChannelStateData", aminoType: "cosmos-sdk/ChannelStateData", + is(o: any): o is ChannelStateData { + return o && (o.$typeUrl === ChannelStateData.typeUrl || o.path instanceof Uint8Array || typeof o.path === "string"); + }, + isSDK(o: any): o is ChannelStateDataSDKType { + return o && (o.$typeUrl === ChannelStateData.typeUrl || o.path instanceof Uint8Array || typeof o.path === "string"); + }, + isAmino(o: any): o is ChannelStateDataAmino { + return o && (o.$typeUrl === ChannelStateData.typeUrl || o.path instanceof Uint8Array || typeof o.path === "string"); + }, encode(message: ChannelStateData, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.path.length !== 0) { writer.uint32(10).bytes(message.path); @@ -2447,6 +2582,12 @@ export const ChannelStateData = { typeUrl: "/ibc.lightclients.solomachine.v1.ChannelStateData", value: ChannelStateData.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ChannelStateData.typeUrl)) { + return; + } + Channel.registerTypeUrl(); } }; function createBasePacketCommitmentData(): PacketCommitmentData { @@ -2465,6 +2606,15 @@ function createBasePacketCommitmentData(): PacketCommitmentData { export const PacketCommitmentData = { typeUrl: "/ibc.lightclients.solomachine.v1.PacketCommitmentData", aminoType: "cosmos-sdk/PacketCommitmentData", + is(o: any): o is PacketCommitmentData { + return o && (o.$typeUrl === PacketCommitmentData.typeUrl || (o.path instanceof Uint8Array || typeof o.path === "string") && (o.commitment instanceof Uint8Array || typeof o.commitment === "string")); + }, + isSDK(o: any): o is PacketCommitmentDataSDKType { + return o && (o.$typeUrl === PacketCommitmentData.typeUrl || (o.path instanceof Uint8Array || typeof o.path === "string") && (o.commitment instanceof Uint8Array || typeof o.commitment === "string")); + }, + isAmino(o: any): o is PacketCommitmentDataAmino { + return o && (o.$typeUrl === PacketCommitmentData.typeUrl || (o.path instanceof Uint8Array || typeof o.path === "string") && (o.commitment instanceof Uint8Array || typeof o.commitment === "string")); + }, encode(message: PacketCommitmentData, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.path.length !== 0) { writer.uint32(10).bytes(message.path); @@ -2560,7 +2710,8 @@ export const PacketCommitmentData = { typeUrl: "/ibc.lightclients.solomachine.v1.PacketCommitmentData", value: PacketCommitmentData.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBasePacketAcknowledgementData(): PacketAcknowledgementData { return { @@ -2578,6 +2729,15 @@ function createBasePacketAcknowledgementData(): PacketAcknowledgementData { export const PacketAcknowledgementData = { typeUrl: "/ibc.lightclients.solomachine.v1.PacketAcknowledgementData", aminoType: "cosmos-sdk/PacketAcknowledgementData", + is(o: any): o is PacketAcknowledgementData { + return o && (o.$typeUrl === PacketAcknowledgementData.typeUrl || (o.path instanceof Uint8Array || typeof o.path === "string") && (o.acknowledgement instanceof Uint8Array || typeof o.acknowledgement === "string")); + }, + isSDK(o: any): o is PacketAcknowledgementDataSDKType { + return o && (o.$typeUrl === PacketAcknowledgementData.typeUrl || (o.path instanceof Uint8Array || typeof o.path === "string") && (o.acknowledgement instanceof Uint8Array || typeof o.acknowledgement === "string")); + }, + isAmino(o: any): o is PacketAcknowledgementDataAmino { + return o && (o.$typeUrl === PacketAcknowledgementData.typeUrl || (o.path instanceof Uint8Array || typeof o.path === "string") && (o.acknowledgement instanceof Uint8Array || typeof o.acknowledgement === "string")); + }, encode(message: PacketAcknowledgementData, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.path.length !== 0) { writer.uint32(10).bytes(message.path); @@ -2673,7 +2833,8 @@ export const PacketAcknowledgementData = { typeUrl: "/ibc.lightclients.solomachine.v1.PacketAcknowledgementData", value: PacketAcknowledgementData.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBasePacketReceiptAbsenceData(): PacketReceiptAbsenceData { return { @@ -2690,6 +2851,15 @@ function createBasePacketReceiptAbsenceData(): PacketReceiptAbsenceData { export const PacketReceiptAbsenceData = { typeUrl: "/ibc.lightclients.solomachine.v1.PacketReceiptAbsenceData", aminoType: "cosmos-sdk/PacketReceiptAbsenceData", + is(o: any): o is PacketReceiptAbsenceData { + return o && (o.$typeUrl === PacketReceiptAbsenceData.typeUrl || o.path instanceof Uint8Array || typeof o.path === "string"); + }, + isSDK(o: any): o is PacketReceiptAbsenceDataSDKType { + return o && (o.$typeUrl === PacketReceiptAbsenceData.typeUrl || o.path instanceof Uint8Array || typeof o.path === "string"); + }, + isAmino(o: any): o is PacketReceiptAbsenceDataAmino { + return o && (o.$typeUrl === PacketReceiptAbsenceData.typeUrl || o.path instanceof Uint8Array || typeof o.path === "string"); + }, encode(message: PacketReceiptAbsenceData, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.path.length !== 0) { writer.uint32(10).bytes(message.path); @@ -2770,7 +2940,8 @@ export const PacketReceiptAbsenceData = { typeUrl: "/ibc.lightclients.solomachine.v1.PacketReceiptAbsenceData", value: PacketReceiptAbsenceData.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseNextSequenceRecvData(): NextSequenceRecvData { return { @@ -2788,6 +2959,15 @@ function createBaseNextSequenceRecvData(): NextSequenceRecvData { export const NextSequenceRecvData = { typeUrl: "/ibc.lightclients.solomachine.v1.NextSequenceRecvData", aminoType: "cosmos-sdk/NextSequenceRecvData", + is(o: any): o is NextSequenceRecvData { + return o && (o.$typeUrl === NextSequenceRecvData.typeUrl || (o.path instanceof Uint8Array || typeof o.path === "string") && typeof o.nextSeqRecv === "bigint"); + }, + isSDK(o: any): o is NextSequenceRecvDataSDKType { + return o && (o.$typeUrl === NextSequenceRecvData.typeUrl || (o.path instanceof Uint8Array || typeof o.path === "string") && typeof o.next_seq_recv === "bigint"); + }, + isAmino(o: any): o is NextSequenceRecvDataAmino { + return o && (o.$typeUrl === NextSequenceRecvData.typeUrl || (o.path instanceof Uint8Array || typeof o.path === "string") && typeof o.next_seq_recv === "bigint"); + }, encode(message: NextSequenceRecvData, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.path.length !== 0) { writer.uint32(10).bytes(message.path); @@ -2885,5 +3065,6 @@ export const NextSequenceRecvData = { typeUrl: "/ibc.lightclients.solomachine.v1.NextSequenceRecvData", value: NextSequenceRecvData.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/ibc/lightclients/solomachine/v2/solomachine.ts b/__fixtures__/v-next/outputv2/ibc/lightclients/solomachine/v2/solomachine.ts index dfeb85cb7d..5570f5abd9 100644 --- a/__fixtures__/v-next/outputv2/ibc/lightclients/solomachine/v2/solomachine.ts +++ b/__fixtures__/v-next/outputv2/ibc/lightclients/solomachine/v2/solomachine.ts @@ -2,6 +2,7 @@ import { Any, AnyAmino, AnySDKType } from "../../../../google/protobuf/any"; import { ConnectionEnd, ConnectionEndAmino, ConnectionEndSDKType } from "../../../core/connection/v1/connection"; import { Channel, ChannelAmino, ChannelSDKType } from "../../../core/channel/v1/channel"; import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { GlobalDecoderRegistry } from "../../../../registry"; import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../../helpers"; import { JsonSafe } from "../../../../json-safe"; export const protobufPackage = "ibc.lightclients.solomachine.v2"; @@ -866,6 +867,15 @@ function createBaseClientState(): ClientState { export const ClientState = { typeUrl: "/ibc.lightclients.solomachine.v2.ClientState", aminoType: "cosmos-sdk/ClientState", + is(o: any): o is ClientState { + return o && (o.$typeUrl === ClientState.typeUrl || typeof o.sequence === "bigint" && typeof o.isFrozen === "boolean" && typeof o.allowUpdateAfterProposal === "boolean"); + }, + isSDK(o: any): o is ClientStateSDKType { + return o && (o.$typeUrl === ClientState.typeUrl || typeof o.sequence === "bigint" && typeof o.is_frozen === "boolean" && typeof o.allow_update_after_proposal === "boolean"); + }, + isAmino(o: any): o is ClientStateAmino { + return o && (o.$typeUrl === ClientState.typeUrl || typeof o.sequence === "bigint" && typeof o.is_frozen === "boolean" && typeof o.allow_update_after_proposal === "boolean"); + }, encode(message: ClientState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.sequence !== BigInt(0)) { writer.uint32(8).uint64(message.sequence); @@ -995,6 +1005,12 @@ export const ClientState = { typeUrl: "/ibc.lightclients.solomachine.v2.ClientState", value: ClientState.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ClientState.typeUrl)) { + return; + } + ConsensusState.registerTypeUrl(); } }; function createBaseConsensusState(): ConsensusState { @@ -1015,6 +1031,15 @@ function createBaseConsensusState(): ConsensusState { export const ConsensusState = { typeUrl: "/ibc.lightclients.solomachine.v2.ConsensusState", aminoType: "cosmos-sdk/ConsensusState", + is(o: any): o is ConsensusState { + return o && (o.$typeUrl === ConsensusState.typeUrl || typeof o.diversifier === "string" && typeof o.timestamp === "bigint"); + }, + isSDK(o: any): o is ConsensusStateSDKType { + return o && (o.$typeUrl === ConsensusState.typeUrl || typeof o.diversifier === "string" && typeof o.timestamp === "bigint"); + }, + isAmino(o: any): o is ConsensusStateAmino { + return o && (o.$typeUrl === ConsensusState.typeUrl || typeof o.diversifier === "string" && typeof o.timestamp === "bigint"); + }, encode(message: ConsensusState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.publicKey !== undefined) { Any.encode(message.publicKey, writer.uint32(10).fork()).ldelim(); @@ -1129,7 +1154,8 @@ export const ConsensusState = { typeUrl: "/ibc.lightclients.solomachine.v2.ConsensusState", value: ConsensusState.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseHeader(): Header { return { @@ -1149,6 +1175,15 @@ function createBaseHeader(): Header { export const Header = { typeUrl: "/ibc.lightclients.solomachine.v2.Header", aminoType: "cosmos-sdk/Header", + is(o: any): o is Header { + return o && (o.$typeUrl === Header.typeUrl || typeof o.sequence === "bigint" && typeof o.timestamp === "bigint" && (o.signature instanceof Uint8Array || typeof o.signature === "string") && typeof o.newDiversifier === "string"); + }, + isSDK(o: any): o is HeaderSDKType { + return o && (o.$typeUrl === Header.typeUrl || typeof o.sequence === "bigint" && typeof o.timestamp === "bigint" && (o.signature instanceof Uint8Array || typeof o.signature === "string") && typeof o.new_diversifier === "string"); + }, + isAmino(o: any): o is HeaderAmino { + return o && (o.$typeUrl === Header.typeUrl || typeof o.sequence === "bigint" && typeof o.timestamp === "bigint" && (o.signature instanceof Uint8Array || typeof o.signature === "string") && typeof o.new_diversifier === "string"); + }, encode(message: Header, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.sequence !== BigInt(0)) { writer.uint32(8).uint64(message.sequence); @@ -1295,7 +1330,8 @@ export const Header = { typeUrl: "/ibc.lightclients.solomachine.v2.Header", value: Header.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMisbehaviour(): Misbehaviour { return { @@ -1315,6 +1351,15 @@ function createBaseMisbehaviour(): Misbehaviour { export const Misbehaviour = { typeUrl: "/ibc.lightclients.solomachine.v2.Misbehaviour", aminoType: "cosmos-sdk/Misbehaviour", + is(o: any): o is Misbehaviour { + return o && (o.$typeUrl === Misbehaviour.typeUrl || typeof o.clientId === "string" && typeof o.sequence === "bigint"); + }, + isSDK(o: any): o is MisbehaviourSDKType { + return o && (o.$typeUrl === Misbehaviour.typeUrl || typeof o.client_id === "string" && typeof o.sequence === "bigint"); + }, + isAmino(o: any): o is MisbehaviourAmino { + return o && (o.$typeUrl === Misbehaviour.typeUrl || typeof o.client_id === "string" && typeof o.sequence === "bigint"); + }, encode(message: Misbehaviour, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.clientId !== "") { writer.uint32(10).string(message.clientId); @@ -1446,6 +1491,12 @@ export const Misbehaviour = { typeUrl: "/ibc.lightclients.solomachine.v2.Misbehaviour", value: Misbehaviour.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Misbehaviour.typeUrl)) { + return; + } + SignatureAndData.registerTypeUrl(); } }; function createBaseSignatureAndData(): SignatureAndData { @@ -1466,6 +1517,15 @@ function createBaseSignatureAndData(): SignatureAndData { export const SignatureAndData = { typeUrl: "/ibc.lightclients.solomachine.v2.SignatureAndData", aminoType: "cosmos-sdk/SignatureAndData", + is(o: any): o is SignatureAndData { + return o && (o.$typeUrl === SignatureAndData.typeUrl || (o.signature instanceof Uint8Array || typeof o.signature === "string") && isSet(o.dataType) && (o.data instanceof Uint8Array || typeof o.data === "string") && typeof o.timestamp === "bigint"); + }, + isSDK(o: any): o is SignatureAndDataSDKType { + return o && (o.$typeUrl === SignatureAndData.typeUrl || (o.signature instanceof Uint8Array || typeof o.signature === "string") && isSet(o.data_type) && (o.data instanceof Uint8Array || typeof o.data === "string") && typeof o.timestamp === "bigint"); + }, + isAmino(o: any): o is SignatureAndDataAmino { + return o && (o.$typeUrl === SignatureAndData.typeUrl || (o.signature instanceof Uint8Array || typeof o.signature === "string") && isSet(o.data_type) && (o.data instanceof Uint8Array || typeof o.data === "string") && typeof o.timestamp === "bigint"); + }, encode(message: SignatureAndData, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.signature.length !== 0) { writer.uint32(10).bytes(message.signature); @@ -1593,7 +1653,8 @@ export const SignatureAndData = { typeUrl: "/ibc.lightclients.solomachine.v2.SignatureAndData", value: SignatureAndData.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseTimestampedSignatureData(): TimestampedSignatureData { return { @@ -1611,6 +1672,15 @@ function createBaseTimestampedSignatureData(): TimestampedSignatureData { export const TimestampedSignatureData = { typeUrl: "/ibc.lightclients.solomachine.v2.TimestampedSignatureData", aminoType: "cosmos-sdk/TimestampedSignatureData", + is(o: any): o is TimestampedSignatureData { + return o && (o.$typeUrl === TimestampedSignatureData.typeUrl || (o.signatureData instanceof Uint8Array || typeof o.signatureData === "string") && typeof o.timestamp === "bigint"); + }, + isSDK(o: any): o is TimestampedSignatureDataSDKType { + return o && (o.$typeUrl === TimestampedSignatureData.typeUrl || (o.signature_data instanceof Uint8Array || typeof o.signature_data === "string") && typeof o.timestamp === "bigint"); + }, + isAmino(o: any): o is TimestampedSignatureDataAmino { + return o && (o.$typeUrl === TimestampedSignatureData.typeUrl || (o.signature_data instanceof Uint8Array || typeof o.signature_data === "string") && typeof o.timestamp === "bigint"); + }, encode(message: TimestampedSignatureData, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.signatureData.length !== 0) { writer.uint32(10).bytes(message.signatureData); @@ -1708,7 +1778,8 @@ export const TimestampedSignatureData = { typeUrl: "/ibc.lightclients.solomachine.v2.TimestampedSignatureData", value: TimestampedSignatureData.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseSignBytes(): SignBytes { return { @@ -1728,6 +1799,15 @@ function createBaseSignBytes(): SignBytes { export const SignBytes = { typeUrl: "/ibc.lightclients.solomachine.v2.SignBytes", aminoType: "cosmos-sdk/SignBytes", + is(o: any): o is SignBytes { + return o && (o.$typeUrl === SignBytes.typeUrl || typeof o.sequence === "bigint" && typeof o.timestamp === "bigint" && typeof o.diversifier === "string" && isSet(o.dataType) && (o.data instanceof Uint8Array || typeof o.data === "string")); + }, + isSDK(o: any): o is SignBytesSDKType { + return o && (o.$typeUrl === SignBytes.typeUrl || typeof o.sequence === "bigint" && typeof o.timestamp === "bigint" && typeof o.diversifier === "string" && isSet(o.data_type) && (o.data instanceof Uint8Array || typeof o.data === "string")); + }, + isAmino(o: any): o is SignBytesAmino { + return o && (o.$typeUrl === SignBytes.typeUrl || typeof o.sequence === "bigint" && typeof o.timestamp === "bigint" && typeof o.diversifier === "string" && isSet(o.data_type) && (o.data instanceof Uint8Array || typeof o.data === "string")); + }, encode(message: SignBytes, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.sequence !== BigInt(0)) { writer.uint32(8).uint64(message.sequence); @@ -1872,7 +1952,8 @@ export const SignBytes = { typeUrl: "/ibc.lightclients.solomachine.v2.SignBytes", value: SignBytes.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseHeaderData(): HeaderData { return { @@ -1889,6 +1970,15 @@ function createBaseHeaderData(): HeaderData { export const HeaderData = { typeUrl: "/ibc.lightclients.solomachine.v2.HeaderData", aminoType: "cosmos-sdk/HeaderData", + is(o: any): o is HeaderData { + return o && (o.$typeUrl === HeaderData.typeUrl || typeof o.newDiversifier === "string"); + }, + isSDK(o: any): o is HeaderDataSDKType { + return o && (o.$typeUrl === HeaderData.typeUrl || typeof o.new_diversifier === "string"); + }, + isAmino(o: any): o is HeaderDataAmino { + return o && (o.$typeUrl === HeaderData.typeUrl || typeof o.new_diversifier === "string"); + }, encode(message: HeaderData, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.newPubKey !== undefined) { Any.encode(message.newPubKey, writer.uint32(10).fork()).ldelim(); @@ -1986,7 +2076,8 @@ export const HeaderData = { typeUrl: "/ibc.lightclients.solomachine.v2.HeaderData", value: HeaderData.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseClientStateData(): ClientStateData { return { @@ -2003,6 +2094,15 @@ function createBaseClientStateData(): ClientStateData { export const ClientStateData = { typeUrl: "/ibc.lightclients.solomachine.v2.ClientStateData", aminoType: "cosmos-sdk/ClientStateData", + is(o: any): o is ClientStateData { + return o && (o.$typeUrl === ClientStateData.typeUrl || o.path instanceof Uint8Array || typeof o.path === "string"); + }, + isSDK(o: any): o is ClientStateDataSDKType { + return o && (o.$typeUrl === ClientStateData.typeUrl || o.path instanceof Uint8Array || typeof o.path === "string"); + }, + isAmino(o: any): o is ClientStateDataAmino { + return o && (o.$typeUrl === ClientStateData.typeUrl || o.path instanceof Uint8Array || typeof o.path === "string"); + }, encode(message: ClientStateData, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.path.length !== 0) { writer.uint32(10).bytes(message.path); @@ -2100,7 +2200,8 @@ export const ClientStateData = { typeUrl: "/ibc.lightclients.solomachine.v2.ClientStateData", value: ClientStateData.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseConsensusStateData(): ConsensusStateData { return { @@ -2118,6 +2219,15 @@ function createBaseConsensusStateData(): ConsensusStateData { export const ConsensusStateData = { typeUrl: "/ibc.lightclients.solomachine.v2.ConsensusStateData", aminoType: "cosmos-sdk/ConsensusStateData", + is(o: any): o is ConsensusStateData { + return o && (o.$typeUrl === ConsensusStateData.typeUrl || o.path instanceof Uint8Array || typeof o.path === "string"); + }, + isSDK(o: any): o is ConsensusStateDataSDKType { + return o && (o.$typeUrl === ConsensusStateData.typeUrl || o.path instanceof Uint8Array || typeof o.path === "string"); + }, + isAmino(o: any): o is ConsensusStateDataAmino { + return o && (o.$typeUrl === ConsensusStateData.typeUrl || o.path instanceof Uint8Array || typeof o.path === "string"); + }, encode(message: ConsensusStateData, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.path.length !== 0) { writer.uint32(10).bytes(message.path); @@ -2215,7 +2325,8 @@ export const ConsensusStateData = { typeUrl: "/ibc.lightclients.solomachine.v2.ConsensusStateData", value: ConsensusStateData.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseConnectionStateData(): ConnectionStateData { return { @@ -2233,6 +2344,15 @@ function createBaseConnectionStateData(): ConnectionStateData { export const ConnectionStateData = { typeUrl: "/ibc.lightclients.solomachine.v2.ConnectionStateData", aminoType: "cosmos-sdk/ConnectionStateData", + is(o: any): o is ConnectionStateData { + return o && (o.$typeUrl === ConnectionStateData.typeUrl || o.path instanceof Uint8Array || typeof o.path === "string"); + }, + isSDK(o: any): o is ConnectionStateDataSDKType { + return o && (o.$typeUrl === ConnectionStateData.typeUrl || o.path instanceof Uint8Array || typeof o.path === "string"); + }, + isAmino(o: any): o is ConnectionStateDataAmino { + return o && (o.$typeUrl === ConnectionStateData.typeUrl || o.path instanceof Uint8Array || typeof o.path === "string"); + }, encode(message: ConnectionStateData, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.path.length !== 0) { writer.uint32(10).bytes(message.path); @@ -2330,6 +2450,12 @@ export const ConnectionStateData = { typeUrl: "/ibc.lightclients.solomachine.v2.ConnectionStateData", value: ConnectionStateData.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ConnectionStateData.typeUrl)) { + return; + } + ConnectionEnd.registerTypeUrl(); } }; function createBaseChannelStateData(): ChannelStateData { @@ -2348,6 +2474,15 @@ function createBaseChannelStateData(): ChannelStateData { export const ChannelStateData = { typeUrl: "/ibc.lightclients.solomachine.v2.ChannelStateData", aminoType: "cosmos-sdk/ChannelStateData", + is(o: any): o is ChannelStateData { + return o && (o.$typeUrl === ChannelStateData.typeUrl || o.path instanceof Uint8Array || typeof o.path === "string"); + }, + isSDK(o: any): o is ChannelStateDataSDKType { + return o && (o.$typeUrl === ChannelStateData.typeUrl || o.path instanceof Uint8Array || typeof o.path === "string"); + }, + isAmino(o: any): o is ChannelStateDataAmino { + return o && (o.$typeUrl === ChannelStateData.typeUrl || o.path instanceof Uint8Array || typeof o.path === "string"); + }, encode(message: ChannelStateData, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.path.length !== 0) { writer.uint32(10).bytes(message.path); @@ -2445,6 +2580,12 @@ export const ChannelStateData = { typeUrl: "/ibc.lightclients.solomachine.v2.ChannelStateData", value: ChannelStateData.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ChannelStateData.typeUrl)) { + return; + } + Channel.registerTypeUrl(); } }; function createBasePacketCommitmentData(): PacketCommitmentData { @@ -2463,6 +2604,15 @@ function createBasePacketCommitmentData(): PacketCommitmentData { export const PacketCommitmentData = { typeUrl: "/ibc.lightclients.solomachine.v2.PacketCommitmentData", aminoType: "cosmos-sdk/PacketCommitmentData", + is(o: any): o is PacketCommitmentData { + return o && (o.$typeUrl === PacketCommitmentData.typeUrl || (o.path instanceof Uint8Array || typeof o.path === "string") && (o.commitment instanceof Uint8Array || typeof o.commitment === "string")); + }, + isSDK(o: any): o is PacketCommitmentDataSDKType { + return o && (o.$typeUrl === PacketCommitmentData.typeUrl || (o.path instanceof Uint8Array || typeof o.path === "string") && (o.commitment instanceof Uint8Array || typeof o.commitment === "string")); + }, + isAmino(o: any): o is PacketCommitmentDataAmino { + return o && (o.$typeUrl === PacketCommitmentData.typeUrl || (o.path instanceof Uint8Array || typeof o.path === "string") && (o.commitment instanceof Uint8Array || typeof o.commitment === "string")); + }, encode(message: PacketCommitmentData, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.path.length !== 0) { writer.uint32(10).bytes(message.path); @@ -2558,7 +2708,8 @@ export const PacketCommitmentData = { typeUrl: "/ibc.lightclients.solomachine.v2.PacketCommitmentData", value: PacketCommitmentData.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBasePacketAcknowledgementData(): PacketAcknowledgementData { return { @@ -2576,6 +2727,15 @@ function createBasePacketAcknowledgementData(): PacketAcknowledgementData { export const PacketAcknowledgementData = { typeUrl: "/ibc.lightclients.solomachine.v2.PacketAcknowledgementData", aminoType: "cosmos-sdk/PacketAcknowledgementData", + is(o: any): o is PacketAcknowledgementData { + return o && (o.$typeUrl === PacketAcknowledgementData.typeUrl || (o.path instanceof Uint8Array || typeof o.path === "string") && (o.acknowledgement instanceof Uint8Array || typeof o.acknowledgement === "string")); + }, + isSDK(o: any): o is PacketAcknowledgementDataSDKType { + return o && (o.$typeUrl === PacketAcknowledgementData.typeUrl || (o.path instanceof Uint8Array || typeof o.path === "string") && (o.acknowledgement instanceof Uint8Array || typeof o.acknowledgement === "string")); + }, + isAmino(o: any): o is PacketAcknowledgementDataAmino { + return o && (o.$typeUrl === PacketAcknowledgementData.typeUrl || (o.path instanceof Uint8Array || typeof o.path === "string") && (o.acknowledgement instanceof Uint8Array || typeof o.acknowledgement === "string")); + }, encode(message: PacketAcknowledgementData, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.path.length !== 0) { writer.uint32(10).bytes(message.path); @@ -2671,7 +2831,8 @@ export const PacketAcknowledgementData = { typeUrl: "/ibc.lightclients.solomachine.v2.PacketAcknowledgementData", value: PacketAcknowledgementData.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBasePacketReceiptAbsenceData(): PacketReceiptAbsenceData { return { @@ -2688,6 +2849,15 @@ function createBasePacketReceiptAbsenceData(): PacketReceiptAbsenceData { export const PacketReceiptAbsenceData = { typeUrl: "/ibc.lightclients.solomachine.v2.PacketReceiptAbsenceData", aminoType: "cosmos-sdk/PacketReceiptAbsenceData", + is(o: any): o is PacketReceiptAbsenceData { + return o && (o.$typeUrl === PacketReceiptAbsenceData.typeUrl || o.path instanceof Uint8Array || typeof o.path === "string"); + }, + isSDK(o: any): o is PacketReceiptAbsenceDataSDKType { + return o && (o.$typeUrl === PacketReceiptAbsenceData.typeUrl || o.path instanceof Uint8Array || typeof o.path === "string"); + }, + isAmino(o: any): o is PacketReceiptAbsenceDataAmino { + return o && (o.$typeUrl === PacketReceiptAbsenceData.typeUrl || o.path instanceof Uint8Array || typeof o.path === "string"); + }, encode(message: PacketReceiptAbsenceData, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.path.length !== 0) { writer.uint32(10).bytes(message.path); @@ -2768,7 +2938,8 @@ export const PacketReceiptAbsenceData = { typeUrl: "/ibc.lightclients.solomachine.v2.PacketReceiptAbsenceData", value: PacketReceiptAbsenceData.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseNextSequenceRecvData(): NextSequenceRecvData { return { @@ -2786,6 +2957,15 @@ function createBaseNextSequenceRecvData(): NextSequenceRecvData { export const NextSequenceRecvData = { typeUrl: "/ibc.lightclients.solomachine.v2.NextSequenceRecvData", aminoType: "cosmos-sdk/NextSequenceRecvData", + is(o: any): o is NextSequenceRecvData { + return o && (o.$typeUrl === NextSequenceRecvData.typeUrl || (o.path instanceof Uint8Array || typeof o.path === "string") && typeof o.nextSeqRecv === "bigint"); + }, + isSDK(o: any): o is NextSequenceRecvDataSDKType { + return o && (o.$typeUrl === NextSequenceRecvData.typeUrl || (o.path instanceof Uint8Array || typeof o.path === "string") && typeof o.next_seq_recv === "bigint"); + }, + isAmino(o: any): o is NextSequenceRecvDataAmino { + return o && (o.$typeUrl === NextSequenceRecvData.typeUrl || (o.path instanceof Uint8Array || typeof o.path === "string") && typeof o.next_seq_recv === "bigint"); + }, encode(message: NextSequenceRecvData, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.path.length !== 0) { writer.uint32(10).bytes(message.path); @@ -2883,5 +3063,6 @@ export const NextSequenceRecvData = { typeUrl: "/ibc.lightclients.solomachine.v2.NextSequenceRecvData", value: NextSequenceRecvData.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/ibc/lightclients/tendermint/v1/tendermint.ts b/__fixtures__/v-next/outputv2/ibc/lightclients/tendermint/v1/tendermint.ts index ed00ad4614..4013ccfbfa 100644 --- a/__fixtures__/v-next/outputv2/ibc/lightclients/tendermint/v1/tendermint.ts +++ b/__fixtures__/v-next/outputv2/ibc/lightclients/tendermint/v1/tendermint.ts @@ -6,6 +6,7 @@ import { MerkleRoot, MerkleRootAmino, MerkleRootSDKType } from "../../../core/co import { SignedHeader, SignedHeaderAmino, SignedHeaderSDKType } from "../../../../tendermint/types/types"; import { ValidatorSet, ValidatorSetAmino, ValidatorSetSDKType } from "../../../../tendermint/types/validator"; import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { GlobalDecoderRegistry } from "../../../../registry"; import { isSet, DeepPartial, toTimestamp, fromTimestamp, bytesFromBase64, base64FromBytes } from "../../../../helpers"; import { JsonSafe } from "../../../../json-safe"; export const protobufPackage = "ibc.lightclients.tendermint.v1"; @@ -391,6 +392,15 @@ function createBaseClientState(): ClientState { export const ClientState = { typeUrl: "/ibc.lightclients.tendermint.v1.ClientState", aminoType: "cosmos-sdk/ClientState", + is(o: any): o is ClientState { + return o && (o.$typeUrl === ClientState.typeUrl || typeof o.chainId === "string" && Fraction.is(o.trustLevel) && Duration.is(o.trustingPeriod) && Duration.is(o.unbondingPeriod) && Duration.is(o.maxClockDrift) && Height.is(o.frozenHeight) && Height.is(o.latestHeight) && Array.isArray(o.proofSpecs) && (!o.proofSpecs.length || ProofSpec.is(o.proofSpecs[0])) && Array.isArray(o.upgradePath) && (!o.upgradePath.length || typeof o.upgradePath[0] === "string") && typeof o.allowUpdateAfterExpiry === "boolean" && typeof o.allowUpdateAfterMisbehaviour === "boolean"); + }, + isSDK(o: any): o is ClientStateSDKType { + return o && (o.$typeUrl === ClientState.typeUrl || typeof o.chain_id === "string" && Fraction.isSDK(o.trust_level) && Duration.isSDK(o.trusting_period) && Duration.isSDK(o.unbonding_period) && Duration.isSDK(o.max_clock_drift) && Height.isSDK(o.frozen_height) && Height.isSDK(o.latest_height) && Array.isArray(o.proof_specs) && (!o.proof_specs.length || ProofSpec.isSDK(o.proof_specs[0])) && Array.isArray(o.upgrade_path) && (!o.upgrade_path.length || typeof o.upgrade_path[0] === "string") && typeof o.allow_update_after_expiry === "boolean" && typeof o.allow_update_after_misbehaviour === "boolean"); + }, + isAmino(o: any): o is ClientStateAmino { + return o && (o.$typeUrl === ClientState.typeUrl || typeof o.chain_id === "string" && Fraction.isAmino(o.trust_level) && Duration.isAmino(o.trusting_period) && Duration.isAmino(o.unbonding_period) && Duration.isAmino(o.max_clock_drift) && Height.isAmino(o.frozen_height) && Height.isAmino(o.latest_height) && Array.isArray(o.proof_specs) && (!o.proof_specs.length || ProofSpec.isAmino(o.proof_specs[0])) && Array.isArray(o.upgrade_path) && (!o.upgrade_path.length || typeof o.upgrade_path[0] === "string") && typeof o.allow_update_after_expiry === "boolean" && typeof o.allow_update_after_misbehaviour === "boolean"); + }, encode(message: ClientState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.chainId !== "") { writer.uint32(10).string(message.chainId); @@ -653,6 +663,14 @@ export const ClientState = { typeUrl: "/ibc.lightclients.tendermint.v1.ClientState", value: ClientState.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ClientState.typeUrl)) { + return; + } + Fraction.registerTypeUrl(); + Height.registerTypeUrl(); + ProofSpec.registerTypeUrl(); } }; function createBaseConsensusState(): ConsensusState { @@ -671,6 +689,15 @@ function createBaseConsensusState(): ConsensusState { export const ConsensusState = { typeUrl: "/ibc.lightclients.tendermint.v1.ConsensusState", aminoType: "cosmos-sdk/ConsensusState", + is(o: any): o is ConsensusState { + return o && (o.$typeUrl === ConsensusState.typeUrl || Timestamp.is(o.timestamp) && MerkleRoot.is(o.root) && (o.nextValidatorsHash instanceof Uint8Array || typeof o.nextValidatorsHash === "string")); + }, + isSDK(o: any): o is ConsensusStateSDKType { + return o && (o.$typeUrl === ConsensusState.typeUrl || Timestamp.isSDK(o.timestamp) && MerkleRoot.isSDK(o.root) && (o.next_validators_hash instanceof Uint8Array || typeof o.next_validators_hash === "string")); + }, + isAmino(o: any): o is ConsensusStateAmino { + return o && (o.$typeUrl === ConsensusState.typeUrl || Timestamp.isAmino(o.timestamp) && MerkleRoot.isAmino(o.root) && (o.next_validators_hash instanceof Uint8Array || typeof o.next_validators_hash === "string")); + }, encode(message: ConsensusState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.timestamp !== undefined) { Timestamp.encode(toTimestamp(message.timestamp), writer.uint32(10).fork()).ldelim(); @@ -783,6 +810,12 @@ export const ConsensusState = { typeUrl: "/ibc.lightclients.tendermint.v1.ConsensusState", value: ConsensusState.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ConsensusState.typeUrl)) { + return; + } + MerkleRoot.registerTypeUrl(); } }; function createBaseMisbehaviour(): Misbehaviour { @@ -802,6 +835,15 @@ function createBaseMisbehaviour(): Misbehaviour { export const Misbehaviour = { typeUrl: "/ibc.lightclients.tendermint.v1.Misbehaviour", aminoType: "cosmos-sdk/Misbehaviour", + is(o: any): o is Misbehaviour { + return o && (o.$typeUrl === Misbehaviour.typeUrl || typeof o.clientId === "string"); + }, + isSDK(o: any): o is MisbehaviourSDKType { + return o && (o.$typeUrl === Misbehaviour.typeUrl || typeof o.client_id === "string"); + }, + isAmino(o: any): o is MisbehaviourAmino { + return o && (o.$typeUrl === Misbehaviour.typeUrl || typeof o.client_id === "string"); + }, encode(message: Misbehaviour, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.clientId !== "") { writer.uint32(10).string(message.clientId); @@ -916,6 +958,12 @@ export const Misbehaviour = { typeUrl: "/ibc.lightclients.tendermint.v1.Misbehaviour", value: Misbehaviour.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Misbehaviour.typeUrl)) { + return; + } + Header.registerTypeUrl(); } }; function createBaseHeader(): Header { @@ -946,6 +994,15 @@ function createBaseHeader(): Header { export const Header = { typeUrl: "/ibc.lightclients.tendermint.v1.Header", aminoType: "cosmos-sdk/Header", + is(o: any): o is Header { + return o && (o.$typeUrl === Header.typeUrl || Height.is(o.trustedHeight)); + }, + isSDK(o: any): o is HeaderSDKType { + return o && (o.$typeUrl === Header.typeUrl || Height.isSDK(o.trusted_height)); + }, + isAmino(o: any): o is HeaderAmino { + return o && (o.$typeUrl === Header.typeUrl || Height.isAmino(o.trusted_height)); + }, encode(message: Header, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.signedHeader !== undefined) { SignedHeader.encode(message.signedHeader, writer.uint32(10).fork()).ldelim(); @@ -1079,6 +1136,14 @@ export const Header = { typeUrl: "/ibc.lightclients.tendermint.v1.Header", value: Header.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Header.typeUrl)) { + return; + } + SignedHeader.registerTypeUrl(); + ValidatorSet.registerTypeUrl(); + Height.registerTypeUrl(); } }; function createBaseFraction(): Fraction { @@ -1097,6 +1162,15 @@ function createBaseFraction(): Fraction { export const Fraction = { typeUrl: "/ibc.lightclients.tendermint.v1.Fraction", aminoType: "cosmos-sdk/Fraction", + is(o: any): o is Fraction { + return o && (o.$typeUrl === Fraction.typeUrl || typeof o.numerator === "bigint" && typeof o.denominator === "bigint"); + }, + isSDK(o: any): o is FractionSDKType { + return o && (o.$typeUrl === Fraction.typeUrl || typeof o.numerator === "bigint" && typeof o.denominator === "bigint"); + }, + isAmino(o: any): o is FractionAmino { + return o && (o.$typeUrl === Fraction.typeUrl || typeof o.numerator === "bigint" && typeof o.denominator === "bigint"); + }, encode(message: Fraction, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.numerator !== BigInt(0)) { writer.uint32(8).uint64(message.numerator); @@ -1196,5 +1270,6 @@ export const Fraction = { typeUrl: "/ibc.lightclients.tendermint.v1.Fraction", value: Fraction.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/index.ts b/__fixtures__/v-next/outputv2/index.ts index 25a2d588d8..e44e946f3e 100644 --- a/__fixtures__/v-next/outputv2/index.ts +++ b/__fixtures__/v-next/outputv2/index.ts @@ -23,9 +23,12 @@ export * from "./osmosis/client"; export * from "./tendermint/bundle"; export * from "./hooks"; export * from "./extern"; +export * from "./helper-func-types"; export * from "./react-query"; export * from "./grpc-web"; export * from "./json-safe"; export * from "./varint"; export * from "./utf8"; -export * from "./binary"; \ No newline at end of file +export * from "./binary"; +export * from "./types"; +export * from "./registry"; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/osmosis/bundle.ts b/__fixtures__/v-next/outputv2/osmosis/bundle.ts index 36785310ef..d796fc0df2 100644 --- a/__fixtures__/v-next/outputv2/osmosis/bundle.ts +++ b/__fixtures__/v-next/outputv2/osmosis/bundle.ts @@ -49,56 +49,62 @@ import * as _301 from "./txfees/v1beta1/feetoken"; import * as _302 from "./txfees/v1beta1/genesis"; import * as _303 from "./txfees/v1beta1/gov"; import * as _304 from "./txfees/v1beta1/query"; -import * as _484 from "./gamm/pool-models/balancer/tx/tx.amino"; -import * as _485 from "./gamm/pool-models/stableswap/tx.amino"; -import * as _486 from "./gamm/v1beta1/tx.amino"; -import * as _487 from "./incentives/tx.amino"; -import * as _488 from "./lockup/tx.amino"; -import * as _489 from "./superfluid/tx.amino"; -import * as _490 from "./tokenfactory/v1beta1/tx.amino"; -import * as _491 from "./gamm/pool-models/balancer/tx/tx.registry"; -import * as _492 from "./gamm/pool-models/stableswap/tx.registry"; -import * as _493 from "./gamm/v1beta1/tx.registry"; -import * as _494 from "./incentives/tx.registry"; -import * as _495 from "./lockup/tx.registry"; -import * as _496 from "./superfluid/tx.registry"; -import * as _497 from "./tokenfactory/v1beta1/tx.registry"; -import * as _498 from "./claim/v1beta1/query.lcd"; -import * as _499 from "./epochs/query.lcd"; -import * as _500 from "./gamm/v1beta1/query.lcd"; -import * as _501 from "./gamm/v2/query.lcd"; -import * as _502 from "./ibc-rate-limit/v1beta1/query.lcd"; -import * as _503 from "./incentives/query.lcd"; -import * as _504 from "./lockup/query.lcd"; -import * as _505 from "./mint/v1beta1/query.lcd"; -import * as _506 from "./pool-incentives/v1beta1/query.lcd"; -import * as _507 from "./superfluid/query.lcd"; -import * as _508 from "./tokenfactory/v1beta1/query.lcd"; -import * as _509 from "./twap/v1beta1/query.lcd"; -import * as _510 from "./txfees/v1beta1/query.lcd"; -import * as _511 from "./claim/v1beta1/query.rpc.Query"; -import * as _512 from "./epochs/query.rpc.Query"; -import * as _513 from "./gamm/v1beta1/query.rpc.Query"; -import * as _514 from "./gamm/v2/query.rpc.Query"; -import * as _515 from "./ibc-rate-limit/v1beta1/query.rpc.Query"; -import * as _516 from "./incentives/query.rpc.Query"; -import * as _517 from "./lockup/query.rpc.Query"; -import * as _518 from "./mint/v1beta1/query.rpc.Query"; -import * as _519 from "./pool-incentives/v1beta1/query.rpc.Query"; -import * as _520 from "./superfluid/query.rpc.Query"; -import * as _521 from "./tokenfactory/v1beta1/query.rpc.Query"; -import * as _522 from "./twap/v1beta1/query.rpc.Query"; -import * as _523 from "./txfees/v1beta1/query.rpc.Query"; -import * as _524 from "./gamm/pool-models/balancer/tx/tx.rpc.msg"; -import * as _525 from "./gamm/pool-models/stableswap/tx.rpc.msg"; -import * as _526 from "./gamm/v1beta1/tx.rpc.msg"; -import * as _527 from "./incentives/tx.rpc.msg"; -import * as _528 from "./lockup/tx.rpc.msg"; -import * as _529 from "./superfluid/tx.rpc.msg"; -import * as _530 from "./tokenfactory/v1beta1/tx.rpc.msg"; -import * as _546 from "./lcd"; -import * as _547 from "./rpc.query"; -import * as _548 from "./rpc.tx"; +import * as _518 from "./gamm/pool-models/balancer/tx/tx.amino"; +import * as _519 from "./gamm/pool-models/stableswap/tx.amino"; +import * as _520 from "./gamm/v1beta1/tx.amino"; +import * as _521 from "./incentives/tx.amino"; +import * as _522 from "./lockup/tx.amino"; +import * as _523 from "./superfluid/tx.amino"; +import * as _524 from "./tokenfactory/v1beta1/tx.amino"; +import * as _525 from "./gamm/pool-models/balancer/tx/tx.registry"; +import * as _526 from "./gamm/pool-models/stableswap/tx.registry"; +import * as _527 from "./gamm/v1beta1/tx.registry"; +import * as _528 from "./incentives/tx.registry"; +import * as _529 from "./lockup/tx.registry"; +import * as _530 from "./superfluid/tx.registry"; +import * as _531 from "./tokenfactory/v1beta1/tx.registry"; +import * as _532 from "./claim/v1beta1/query.rpc.func"; +import * as _533 from "./epochs/query.rpc.func"; +import * as _534 from "./gamm/v1beta1/query.rpc.func"; +import * as _535 from "./gamm/v2/query.rpc.func"; +import * as _536 from "./ibc-rate-limit/v1beta1/query.rpc.func"; +import * as _537 from "./incentives/query.rpc.func"; +import * as _538 from "./lockup/query.rpc.func"; +import * as _539 from "./mint/v1beta1/query.rpc.func"; +import * as _540 from "./pool-incentives/v1beta1/query.rpc.func"; +import * as _541 from "./superfluid/query.rpc.func"; +import * as _542 from "./tokenfactory/v1beta1/query.rpc.func"; +import * as _543 from "./twap/v1beta1/query.rpc.func"; +import * as _544 from "./txfees/v1beta1/query.rpc.func"; +import * as _545 from "./claim/v1beta1/query.rpc.Query"; +import * as _546 from "./epochs/query.rpc.Query"; +import * as _547 from "./gamm/v1beta1/query.rpc.Query"; +import * as _548 from "./gamm/v2/query.rpc.Query"; +import * as _549 from "./ibc-rate-limit/v1beta1/query.rpc.Query"; +import * as _550 from "./incentives/query.rpc.Query"; +import * as _551 from "./lockup/query.rpc.Query"; +import * as _552 from "./mint/v1beta1/query.rpc.Query"; +import * as _553 from "./pool-incentives/v1beta1/query.rpc.Query"; +import * as _554 from "./superfluid/query.rpc.Query"; +import * as _555 from "./tokenfactory/v1beta1/query.rpc.Query"; +import * as _556 from "./twap/v1beta1/query.rpc.Query"; +import * as _557 from "./txfees/v1beta1/query.rpc.Query"; +import * as _558 from "./gamm/pool-models/balancer/tx/tx.rpc.func"; +import * as _559 from "./gamm/pool-models/stableswap/tx.rpc.func"; +import * as _560 from "./gamm/v1beta1/tx.rpc.func"; +import * as _561 from "./incentives/tx.rpc.func"; +import * as _562 from "./lockup/tx.rpc.func"; +import * as _563 from "./superfluid/tx.rpc.func"; +import * as _564 from "./tokenfactory/v1beta1/tx.rpc.func"; +import * as _565 from "./gamm/pool-models/balancer/tx/tx.rpc.msg"; +import * as _566 from "./gamm/pool-models/stableswap/tx.rpc.msg"; +import * as _567 from "./gamm/v1beta1/tx.rpc.msg"; +import * as _568 from "./incentives/tx.rpc.msg"; +import * as _569 from "./lockup/tx.rpc.msg"; +import * as _570 from "./superfluid/tx.rpc.msg"; +import * as _571 from "./tokenfactory/v1beta1/tx.rpc.msg"; +import * as _583 from "./rpc.query"; +import * as _584 from "./rpc.tx"; export namespace osmosis { export namespace claim { export const v1beta1 = { @@ -106,16 +112,16 @@ export namespace osmosis { ..._255, ..._256, ..._257, - ..._498, - ..._511 + ..._532, + ..._545 }; } export namespace epochs { export const v1beta1 = { ..._258, ..._259, - ..._499, - ..._512 + ..._533, + ..._546 }; } export namespace gamm { @@ -124,43 +130,46 @@ export namespace osmosis { ..._261, ..._262, ..._263, - ..._486, - ..._493, - ..._500, - ..._513, - ..._526 + ..._520, + ..._527, + ..._534, + ..._547, + ..._560, + ..._567 }; export namespace poolmodels { export namespace balancer { export const v1beta1 = { ..._264, - ..._484, - ..._491, - ..._524 + ..._518, + ..._525, + ..._558, + ..._565 }; } export namespace stableswap { export const v1beta1 = { ..._265, ..._266, - ..._485, - ..._492, - ..._525 + ..._519, + ..._526, + ..._559, + ..._566 }; } } export const v2 = { ..._267, - ..._501, - ..._514 + ..._535, + ..._548 }; } export namespace ibcratelimit { export const v1beta1 = { ..._268, ..._269, - ..._502, - ..._515 + ..._536, + ..._549 }; } export const incentives = { @@ -169,11 +178,12 @@ export namespace osmosis { ..._272, ..._273, ..._274, - ..._487, - ..._494, - ..._503, - ..._516, - ..._527 + ..._521, + ..._528, + ..._537, + ..._550, + ..._561, + ..._568 }; export const lockup = { ..._275, @@ -181,19 +191,20 @@ export namespace osmosis { ..._277, ..._278, ..._279, - ..._488, - ..._495, - ..._504, - ..._517, - ..._528 + ..._522, + ..._529, + ..._538, + ..._551, + ..._562, + ..._569 }; export namespace mint { export const v1beta1 = { ..._280, ..._281, ..._282, - ..._505, - ..._518 + ..._539, + ..._552 }; } export namespace poolincentives { @@ -202,8 +213,8 @@ export namespace osmosis { ..._284, ..._285, ..._286, - ..._506, - ..._519 + ..._540, + ..._553 }; } export namespace store { @@ -217,11 +228,12 @@ export namespace osmosis { ..._290, ..._291, ..._292, - ..._489, - ..._496, - ..._507, - ..._520, - ..._529 + ..._523, + ..._530, + ..._541, + ..._554, + ..._563, + ..._570 }; export namespace tokenfactory { export const v1beta1 = { @@ -230,11 +242,12 @@ export namespace osmosis { ..._295, ..._296, ..._297, - ..._490, - ..._497, - ..._508, - ..._521, - ..._530 + ..._524, + ..._531, + ..._542, + ..._555, + ..._564, + ..._571 }; } export namespace twap { @@ -242,8 +255,8 @@ export namespace osmosis { ..._298, ..._299, ..._300, - ..._509, - ..._522 + ..._543, + ..._556 }; } export namespace txfees { @@ -252,13 +265,12 @@ export namespace osmosis { ..._302, ..._303, ..._304, - ..._510, - ..._523 + ..._544, + ..._557 }; } export const ClientFactory = { - ..._546, - ..._547, - ..._548 + ..._583, + ..._584 }; } \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/osmosis/claim/v1beta1/claim.ts b/__fixtures__/v-next/outputv2/osmosis/claim/v1beta1/claim.ts index afb8037100..e01cc14f54 100644 --- a/__fixtures__/v-next/outputv2/osmosis/claim/v1beta1/claim.ts +++ b/__fixtures__/v-next/outputv2/osmosis/claim/v1beta1/claim.ts @@ -2,6 +2,7 @@ import { Coin, CoinAmino, CoinSDKType } from "../../../cosmos/base/v1beta1/coin" import { BinaryReader, BinaryWriter } from "../../../binary"; import { isSet, DeepPartial } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "osmosis.claim.v1beta1"; export enum Action { ActionAddLiquidity = 0, @@ -124,6 +125,15 @@ function createBaseClaimRecord(): ClaimRecord { export const ClaimRecord = { typeUrl: "/osmosis.claim.v1beta1.ClaimRecord", aminoType: "osmosis/claim/claim-record", + is(o: any): o is ClaimRecord { + return o && (o.$typeUrl === ClaimRecord.typeUrl || typeof o.address === "string" && Array.isArray(o.initialClaimableAmount) && (!o.initialClaimableAmount.length || Coin.is(o.initialClaimableAmount[0])) && Array.isArray(o.actionCompleted) && (!o.actionCompleted.length || typeof o.actionCompleted[0] === "boolean")); + }, + isSDK(o: any): o is ClaimRecordSDKType { + return o && (o.$typeUrl === ClaimRecord.typeUrl || typeof o.address === "string" && Array.isArray(o.initial_claimable_amount) && (!o.initial_claimable_amount.length || Coin.isSDK(o.initial_claimable_amount[0])) && Array.isArray(o.action_completed) && (!o.action_completed.length || typeof o.action_completed[0] === "boolean")); + }, + isAmino(o: any): o is ClaimRecordAmino { + return o && (o.$typeUrl === ClaimRecord.typeUrl || typeof o.address === "string" && Array.isArray(o.initial_claimable_amount) && (!o.initial_claimable_amount.length || Coin.isAmino(o.initial_claimable_amount[0])) && Array.isArray(o.action_completed) && (!o.action_completed.length || typeof o.action_completed[0] === "boolean")); + }, encode(message: ClaimRecord, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.address !== "") { writer.uint32(10).string(message.address); @@ -263,5 +273,11 @@ export const ClaimRecord = { typeUrl: "/osmosis.claim.v1beta1.ClaimRecord", value: ClaimRecord.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ClaimRecord.typeUrl)) { + return; + } + Coin.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/osmosis/claim/v1beta1/genesis.ts b/__fixtures__/v-next/outputv2/osmosis/claim/v1beta1/genesis.ts index cd570d2135..a36616d4a0 100644 --- a/__fixtures__/v-next/outputv2/osmosis/claim/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv2/osmosis/claim/v1beta1/genesis.ts @@ -2,6 +2,7 @@ import { Coin, CoinAmino, CoinSDKType } from "../../../cosmos/base/v1beta1/coin" import { Params, ParamsAmino, ParamsSDKType } from "./params"; import { ClaimRecord, ClaimRecordAmino, ClaimRecordSDKType } from "./claim"; import { BinaryReader, BinaryWriter } from "../../../binary"; +import { GlobalDecoderRegistry } from "../../../registry"; import { isSet, DeepPartial } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "osmosis.claim.v1beta1"; @@ -80,6 +81,15 @@ function createBaseGenesisState(): GenesisState { export const GenesisState = { typeUrl: "/osmosis.claim.v1beta1.GenesisState", aminoType: "osmosis/claim/genesis-state", + is(o: any): o is GenesisState { + return o && (o.$typeUrl === GenesisState.typeUrl || Coin.is(o.moduleAccountBalance) && Params.is(o.params) && Array.isArray(o.claimRecords) && (!o.claimRecords.length || ClaimRecord.is(o.claimRecords[0]))); + }, + isSDK(o: any): o is GenesisStateSDKType { + return o && (o.$typeUrl === GenesisState.typeUrl || Coin.isSDK(o.module_account_balance) && Params.isSDK(o.params) && Array.isArray(o.claim_records) && (!o.claim_records.length || ClaimRecord.isSDK(o.claim_records[0]))); + }, + isAmino(o: any): o is GenesisStateAmino { + return o && (o.$typeUrl === GenesisState.typeUrl || Coin.isAmino(o.module_account_balance) && Params.isAmino(o.params) && Array.isArray(o.claim_records) && (!o.claim_records.length || ClaimRecord.isAmino(o.claim_records[0]))); + }, encode(message: GenesisState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.moduleAccountBalance !== undefined) { Coin.encode(message.moduleAccountBalance, writer.uint32(10).fork()).ldelim(); @@ -204,5 +214,13 @@ export const GenesisState = { typeUrl: "/osmosis.claim.v1beta1.GenesisState", value: GenesisState.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GenesisState.typeUrl)) { + return; + } + Coin.registerTypeUrl(); + Params.registerTypeUrl(); + ClaimRecord.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/osmosis/claim/v1beta1/params.ts b/__fixtures__/v-next/outputv2/osmosis/claim/v1beta1/params.ts index 282bfdbc5b..fdb65b2e88 100644 --- a/__fixtures__/v-next/outputv2/osmosis/claim/v1beta1/params.ts +++ b/__fixtures__/v-next/outputv2/osmosis/claim/v1beta1/params.ts @@ -71,6 +71,15 @@ function createBaseParams(): Params { export const Params = { typeUrl: "/osmosis.claim.v1beta1.Params", aminoType: "osmosis/claim/params", + is(o: any): o is Params { + return o && (o.$typeUrl === Params.typeUrl || Timestamp.is(o.airdropStartTime) && Duration.is(o.durationUntilDecay) && Duration.is(o.durationOfDecay) && typeof o.claimDenom === "string"); + }, + isSDK(o: any): o is ParamsSDKType { + return o && (o.$typeUrl === Params.typeUrl || Timestamp.isSDK(o.airdrop_start_time) && Duration.isSDK(o.duration_until_decay) && Duration.isSDK(o.duration_of_decay) && typeof o.claim_denom === "string"); + }, + isAmino(o: any): o is ParamsAmino { + return o && (o.$typeUrl === Params.typeUrl || Timestamp.isAmino(o.airdrop_start_time) && Duration.isAmino(o.duration_until_decay) && Duration.isAmino(o.duration_of_decay) && typeof o.claim_denom === "string"); + }, encode(message: Params, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.airdropStartTime !== undefined) { Timestamp.encode(toTimestamp(message.airdropStartTime), writer.uint32(10).fork()).ldelim(); @@ -200,5 +209,6 @@ export const Params = { typeUrl: "/osmosis.claim.v1beta1.Params", value: Params.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/osmosis/claim/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputv2/osmosis/claim/v1beta1/query.rpc.func.ts new file mode 100644 index 0000000000..1de8c71ceb --- /dev/null +++ b/__fixtures__/v-next/outputv2/osmosis/claim/v1beta1/query.rpc.func.ts @@ -0,0 +1,62 @@ +import { buildQuery } from "../../../helper-func-types"; +import { QueryModuleAccountBalanceRequest, QueryModuleAccountBalanceResponse, QueryParamsRequest, QueryParamsResponse, QueryClaimRecordRequest, QueryClaimRecordResponse, QueryClaimableForActionRequest, QueryClaimableForActionResponse, QueryTotalClaimableRequest, QueryTotalClaimableResponse } from "./query"; +/** + * @name getModuleAccountBalance + * @package osmosis.claim.v1beta1 + * @see proto service: osmosis.claim.v1beta1.ModuleAccountBalance + */ +export const getModuleAccountBalance = buildQuery({ + encode: QueryModuleAccountBalanceRequest.encode, + decode: QueryModuleAccountBalanceResponse.decode, + service: "osmosis.claim.v1beta1.Query", + method: "ModuleAccountBalance", + deps: [QueryModuleAccountBalanceRequest, QueryModuleAccountBalanceResponse] +}); +/** + * @name getParams + * @package osmosis.claim.v1beta1 + * @see proto service: osmosis.claim.v1beta1.Params + */ +export const getParams = buildQuery({ + encode: QueryParamsRequest.encode, + decode: QueryParamsResponse.decode, + service: "osmosis.claim.v1beta1.Query", + method: "Params", + deps: [QueryParamsRequest, QueryParamsResponse] +}); +/** + * @name getClaimRecord + * @package osmosis.claim.v1beta1 + * @see proto service: osmosis.claim.v1beta1.ClaimRecord + */ +export const getClaimRecord = buildQuery({ + encode: QueryClaimRecordRequest.encode, + decode: QueryClaimRecordResponse.decode, + service: "osmosis.claim.v1beta1.Query", + method: "ClaimRecord", + deps: [QueryClaimRecordRequest, QueryClaimRecordResponse] +}); +/** + * @name getClaimableForAction + * @package osmosis.claim.v1beta1 + * @see proto service: osmosis.claim.v1beta1.ClaimableForAction + */ +export const getClaimableForAction = buildQuery({ + encode: QueryClaimableForActionRequest.encode, + decode: QueryClaimableForActionResponse.decode, + service: "osmosis.claim.v1beta1.Query", + method: "ClaimableForAction", + deps: [QueryClaimableForActionRequest, QueryClaimableForActionResponse] +}); +/** + * @name getTotalClaimable + * @package osmosis.claim.v1beta1 + * @see proto service: osmosis.claim.v1beta1.TotalClaimable + */ +export const getTotalClaimable = buildQuery({ + encode: QueryTotalClaimableRequest.encode, + decode: QueryTotalClaimableResponse.decode, + service: "osmosis.claim.v1beta1.Query", + method: "TotalClaimable", + deps: [QueryTotalClaimableRequest, QueryTotalClaimableResponse] +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/osmosis/claim/v1beta1/query.ts b/__fixtures__/v-next/outputv2/osmosis/claim/v1beta1/query.ts index 33eebee48f..04c2794693 100644 --- a/__fixtures__/v-next/outputv2/osmosis/claim/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv2/osmosis/claim/v1beta1/query.ts @@ -4,6 +4,7 @@ import { Params, ParamsAmino, ParamsSDKType } from "./params"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { JsonSafe } from "../../../json-safe"; import { DeepPartial, isSet } from "../../../helpers"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "osmosis.claim.v1beta1"; /** * QueryParamsRequest is the request type for the Query/Params RPC method. @@ -352,6 +353,15 @@ function createBaseQueryModuleAccountBalanceRequest(): QueryModuleAccountBalance export const QueryModuleAccountBalanceRequest = { typeUrl: "/osmosis.claim.v1beta1.QueryModuleAccountBalanceRequest", aminoType: "osmosis/claim/query-module-account-balance-request", + is(o: any): o is QueryModuleAccountBalanceRequest { + return o && o.$typeUrl === QueryModuleAccountBalanceRequest.typeUrl; + }, + isSDK(o: any): o is QueryModuleAccountBalanceRequestSDKType { + return o && o.$typeUrl === QueryModuleAccountBalanceRequest.typeUrl; + }, + isAmino(o: any): o is QueryModuleAccountBalanceRequestAmino { + return o && o.$typeUrl === QueryModuleAccountBalanceRequest.typeUrl; + }, encode(_: QueryModuleAccountBalanceRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -416,7 +426,8 @@ export const QueryModuleAccountBalanceRequest = { typeUrl: "/osmosis.claim.v1beta1.QueryModuleAccountBalanceRequest", value: QueryModuleAccountBalanceRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryModuleAccountBalanceResponse(): QueryModuleAccountBalanceResponse { return { @@ -432,6 +443,15 @@ function createBaseQueryModuleAccountBalanceResponse(): QueryModuleAccountBalanc export const QueryModuleAccountBalanceResponse = { typeUrl: "/osmosis.claim.v1beta1.QueryModuleAccountBalanceResponse", aminoType: "osmosis/claim/query-module-account-balance-response", + is(o: any): o is QueryModuleAccountBalanceResponse { + return o && (o.$typeUrl === QueryModuleAccountBalanceResponse.typeUrl || Array.isArray(o.moduleAccountBalance) && (!o.moduleAccountBalance.length || Coin.is(o.moduleAccountBalance[0]))); + }, + isSDK(o: any): o is QueryModuleAccountBalanceResponseSDKType { + return o && (o.$typeUrl === QueryModuleAccountBalanceResponse.typeUrl || Array.isArray(o.moduleAccountBalance) && (!o.moduleAccountBalance.length || Coin.isSDK(o.moduleAccountBalance[0]))); + }, + isAmino(o: any): o is QueryModuleAccountBalanceResponseAmino { + return o && (o.$typeUrl === QueryModuleAccountBalanceResponse.typeUrl || Array.isArray(o.moduleAccountBalance) && (!o.moduleAccountBalance.length || Coin.isAmino(o.moduleAccountBalance[0]))); + }, encode(message: QueryModuleAccountBalanceResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.moduleAccountBalance) { Coin.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -522,6 +542,12 @@ export const QueryModuleAccountBalanceResponse = { typeUrl: "/osmosis.claim.v1beta1.QueryModuleAccountBalanceResponse", value: QueryModuleAccountBalanceResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryModuleAccountBalanceResponse.typeUrl)) { + return; + } + Coin.registerTypeUrl(); } }; function createBaseQueryParamsRequest(): QueryParamsRequest { @@ -536,6 +562,15 @@ function createBaseQueryParamsRequest(): QueryParamsRequest { export const QueryParamsRequest = { typeUrl: "/osmosis.claim.v1beta1.QueryParamsRequest", aminoType: "osmosis/claim/query-params-request", + is(o: any): o is QueryParamsRequest { + return o && o.$typeUrl === QueryParamsRequest.typeUrl; + }, + isSDK(o: any): o is QueryParamsRequestSDKType { + return o && o.$typeUrl === QueryParamsRequest.typeUrl; + }, + isAmino(o: any): o is QueryParamsRequestAmino { + return o && o.$typeUrl === QueryParamsRequest.typeUrl; + }, encode(_: QueryParamsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -600,7 +635,8 @@ export const QueryParamsRequest = { typeUrl: "/osmosis.claim.v1beta1.QueryParamsRequest", value: QueryParamsRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryParamsResponse(): QueryParamsResponse { return { @@ -616,6 +652,15 @@ function createBaseQueryParamsResponse(): QueryParamsResponse { export const QueryParamsResponse = { typeUrl: "/osmosis.claim.v1beta1.QueryParamsResponse", aminoType: "osmosis/claim/query-params-response", + is(o: any): o is QueryParamsResponse { + return o && (o.$typeUrl === QueryParamsResponse.typeUrl || Params.is(o.params)); + }, + isSDK(o: any): o is QueryParamsResponseSDKType { + return o && (o.$typeUrl === QueryParamsResponse.typeUrl || Params.isSDK(o.params)); + }, + isAmino(o: any): o is QueryParamsResponseAmino { + return o && (o.$typeUrl === QueryParamsResponse.typeUrl || Params.isAmino(o.params)); + }, encode(message: QueryParamsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.params !== undefined) { Params.encode(message.params, writer.uint32(10).fork()).ldelim(); @@ -698,6 +743,12 @@ export const QueryParamsResponse = { typeUrl: "/osmosis.claim.v1beta1.QueryParamsResponse", value: QueryParamsResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryParamsResponse.typeUrl)) { + return; + } + Params.registerTypeUrl(); } }; function createBaseQueryClaimRecordRequest(): QueryClaimRecordRequest { @@ -713,6 +764,15 @@ function createBaseQueryClaimRecordRequest(): QueryClaimRecordRequest { export const QueryClaimRecordRequest = { typeUrl: "/osmosis.claim.v1beta1.QueryClaimRecordRequest", aminoType: "osmosis/claim/query-claim-record-request", + is(o: any): o is QueryClaimRecordRequest { + return o && (o.$typeUrl === QueryClaimRecordRequest.typeUrl || typeof o.address === "string"); + }, + isSDK(o: any): o is QueryClaimRecordRequestSDKType { + return o && (o.$typeUrl === QueryClaimRecordRequest.typeUrl || typeof o.address === "string"); + }, + isAmino(o: any): o is QueryClaimRecordRequestAmino { + return o && (o.$typeUrl === QueryClaimRecordRequest.typeUrl || typeof o.address === "string"); + }, encode(message: QueryClaimRecordRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.address !== "") { writer.uint32(10).string(message.address); @@ -793,7 +853,8 @@ export const QueryClaimRecordRequest = { typeUrl: "/osmosis.claim.v1beta1.QueryClaimRecordRequest", value: QueryClaimRecordRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryClaimRecordResponse(): QueryClaimRecordResponse { return { @@ -808,6 +869,15 @@ function createBaseQueryClaimRecordResponse(): QueryClaimRecordResponse { export const QueryClaimRecordResponse = { typeUrl: "/osmosis.claim.v1beta1.QueryClaimRecordResponse", aminoType: "osmosis/claim/query-claim-record-response", + is(o: any): o is QueryClaimRecordResponse { + return o && (o.$typeUrl === QueryClaimRecordResponse.typeUrl || ClaimRecord.is(o.claimRecord)); + }, + isSDK(o: any): o is QueryClaimRecordResponseSDKType { + return o && (o.$typeUrl === QueryClaimRecordResponse.typeUrl || ClaimRecord.isSDK(o.claim_record)); + }, + isAmino(o: any): o is QueryClaimRecordResponseAmino { + return o && (o.$typeUrl === QueryClaimRecordResponse.typeUrl || ClaimRecord.isAmino(o.claim_record)); + }, encode(message: QueryClaimRecordResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.claimRecord !== undefined) { ClaimRecord.encode(message.claimRecord, writer.uint32(10).fork()).ldelim(); @@ -890,6 +960,12 @@ export const QueryClaimRecordResponse = { typeUrl: "/osmosis.claim.v1beta1.QueryClaimRecordResponse", value: QueryClaimRecordResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryClaimRecordResponse.typeUrl)) { + return; + } + ClaimRecord.registerTypeUrl(); } }; function createBaseQueryClaimableForActionRequest(): QueryClaimableForActionRequest { @@ -906,6 +982,15 @@ function createBaseQueryClaimableForActionRequest(): QueryClaimableForActionRequ export const QueryClaimableForActionRequest = { typeUrl: "/osmosis.claim.v1beta1.QueryClaimableForActionRequest", aminoType: "osmosis/claim/query-claimable-for-action-request", + is(o: any): o is QueryClaimableForActionRequest { + return o && (o.$typeUrl === QueryClaimableForActionRequest.typeUrl || typeof o.address === "string" && isSet(o.action)); + }, + isSDK(o: any): o is QueryClaimableForActionRequestSDKType { + return o && (o.$typeUrl === QueryClaimableForActionRequest.typeUrl || typeof o.address === "string" && isSet(o.action)); + }, + isAmino(o: any): o is QueryClaimableForActionRequestAmino { + return o && (o.$typeUrl === QueryClaimableForActionRequest.typeUrl || typeof o.address === "string" && isSet(o.action)); + }, encode(message: QueryClaimableForActionRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.address !== "") { writer.uint32(10).string(message.address); @@ -1001,7 +1086,8 @@ export const QueryClaimableForActionRequest = { typeUrl: "/osmosis.claim.v1beta1.QueryClaimableForActionRequest", value: QueryClaimableForActionRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryClaimableForActionResponse(): QueryClaimableForActionResponse { return { @@ -1016,6 +1102,15 @@ function createBaseQueryClaimableForActionResponse(): QueryClaimableForActionRes export const QueryClaimableForActionResponse = { typeUrl: "/osmosis.claim.v1beta1.QueryClaimableForActionResponse", aminoType: "osmosis/claim/query-claimable-for-action-response", + is(o: any): o is QueryClaimableForActionResponse { + return o && (o.$typeUrl === QueryClaimableForActionResponse.typeUrl || Array.isArray(o.coins) && (!o.coins.length || Coin.is(o.coins[0]))); + }, + isSDK(o: any): o is QueryClaimableForActionResponseSDKType { + return o && (o.$typeUrl === QueryClaimableForActionResponse.typeUrl || Array.isArray(o.coins) && (!o.coins.length || Coin.isSDK(o.coins[0]))); + }, + isAmino(o: any): o is QueryClaimableForActionResponseAmino { + return o && (o.$typeUrl === QueryClaimableForActionResponse.typeUrl || Array.isArray(o.coins) && (!o.coins.length || Coin.isAmino(o.coins[0]))); + }, encode(message: QueryClaimableForActionResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.coins) { Coin.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -1106,6 +1201,12 @@ export const QueryClaimableForActionResponse = { typeUrl: "/osmosis.claim.v1beta1.QueryClaimableForActionResponse", value: QueryClaimableForActionResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryClaimableForActionResponse.typeUrl)) { + return; + } + Coin.registerTypeUrl(); } }; function createBaseQueryTotalClaimableRequest(): QueryTotalClaimableRequest { @@ -1121,6 +1222,15 @@ function createBaseQueryTotalClaimableRequest(): QueryTotalClaimableRequest { export const QueryTotalClaimableRequest = { typeUrl: "/osmosis.claim.v1beta1.QueryTotalClaimableRequest", aminoType: "osmosis/claim/query-total-claimable-request", + is(o: any): o is QueryTotalClaimableRequest { + return o && (o.$typeUrl === QueryTotalClaimableRequest.typeUrl || typeof o.address === "string"); + }, + isSDK(o: any): o is QueryTotalClaimableRequestSDKType { + return o && (o.$typeUrl === QueryTotalClaimableRequest.typeUrl || typeof o.address === "string"); + }, + isAmino(o: any): o is QueryTotalClaimableRequestAmino { + return o && (o.$typeUrl === QueryTotalClaimableRequest.typeUrl || typeof o.address === "string"); + }, encode(message: QueryTotalClaimableRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.address !== "") { writer.uint32(10).string(message.address); @@ -1201,7 +1311,8 @@ export const QueryTotalClaimableRequest = { typeUrl: "/osmosis.claim.v1beta1.QueryTotalClaimableRequest", value: QueryTotalClaimableRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryTotalClaimableResponse(): QueryTotalClaimableResponse { return { @@ -1216,6 +1327,15 @@ function createBaseQueryTotalClaimableResponse(): QueryTotalClaimableResponse { export const QueryTotalClaimableResponse = { typeUrl: "/osmosis.claim.v1beta1.QueryTotalClaimableResponse", aminoType: "osmosis/claim/query-total-claimable-response", + is(o: any): o is QueryTotalClaimableResponse { + return o && (o.$typeUrl === QueryTotalClaimableResponse.typeUrl || Array.isArray(o.coins) && (!o.coins.length || Coin.is(o.coins[0]))); + }, + isSDK(o: any): o is QueryTotalClaimableResponseSDKType { + return o && (o.$typeUrl === QueryTotalClaimableResponse.typeUrl || Array.isArray(o.coins) && (!o.coins.length || Coin.isSDK(o.coins[0]))); + }, + isAmino(o: any): o is QueryTotalClaimableResponseAmino { + return o && (o.$typeUrl === QueryTotalClaimableResponse.typeUrl || Array.isArray(o.coins) && (!o.coins.length || Coin.isAmino(o.coins[0]))); + }, encode(message: QueryTotalClaimableResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.coins) { Coin.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -1306,5 +1426,11 @@ export const QueryTotalClaimableResponse = { typeUrl: "/osmosis.claim.v1beta1.QueryTotalClaimableResponse", value: QueryTotalClaimableResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryTotalClaimableResponse.typeUrl)) { + return; + } + Coin.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/osmosis/epochs/genesis.ts b/__fixtures__/v-next/outputv2/osmosis/epochs/genesis.ts index 729b32d3a0..0716fe56b4 100644 --- a/__fixtures__/v-next/outputv2/osmosis/epochs/genesis.ts +++ b/__fixtures__/v-next/outputv2/osmosis/epochs/genesis.ts @@ -2,6 +2,7 @@ import { Timestamp } from "../../google/protobuf/timestamp"; import { Duration, DurationAmino, DurationSDKType } from "../../google/protobuf/duration"; import { BinaryReader, BinaryWriter } from "../../binary"; import { toTimestamp, fromTimestamp, isSet, DeepPartial } from "../../helpers"; +import { GlobalDecoderRegistry } from "../../registry"; import { JsonSafe } from "../../json-safe"; export const protobufPackage = "osmosis.epochs.v1beta1"; /** @@ -210,6 +211,15 @@ function createBaseEpochInfo(): EpochInfo { export const EpochInfo = { typeUrl: "/osmosis.epochs.v1beta1.EpochInfo", aminoType: "osmosis/epochs/epoch-info", + is(o: any): o is EpochInfo { + return o && (o.$typeUrl === EpochInfo.typeUrl || typeof o.identifier === "string" && Timestamp.is(o.startTime) && Duration.is(o.duration) && typeof o.currentEpoch === "bigint" && Timestamp.is(o.currentEpochStartTime) && typeof o.epochCountingStarted === "boolean" && typeof o.currentEpochStartHeight === "bigint"); + }, + isSDK(o: any): o is EpochInfoSDKType { + return o && (o.$typeUrl === EpochInfo.typeUrl || typeof o.identifier === "string" && Timestamp.isSDK(o.start_time) && Duration.isSDK(o.duration) && typeof o.current_epoch === "bigint" && Timestamp.isSDK(o.current_epoch_start_time) && typeof o.epoch_counting_started === "boolean" && typeof o.current_epoch_start_height === "bigint"); + }, + isAmino(o: any): o is EpochInfoAmino { + return o && (o.$typeUrl === EpochInfo.typeUrl || typeof o.identifier === "string" && Timestamp.isAmino(o.start_time) && Duration.isAmino(o.duration) && typeof o.current_epoch === "bigint" && Timestamp.isAmino(o.current_epoch_start_time) && typeof o.epoch_counting_started === "boolean" && typeof o.current_epoch_start_height === "bigint"); + }, encode(message: EpochInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.identifier !== "") { writer.uint32(10).string(message.identifier); @@ -386,7 +396,8 @@ export const EpochInfo = { typeUrl: "/osmosis.epochs.v1beta1.EpochInfo", value: EpochInfo.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseGenesisState(): GenesisState { return { @@ -402,6 +413,15 @@ function createBaseGenesisState(): GenesisState { export const GenesisState = { typeUrl: "/osmosis.epochs.v1beta1.GenesisState", aminoType: "osmosis/epochs/genesis-state", + is(o: any): o is GenesisState { + return o && (o.$typeUrl === GenesisState.typeUrl || Array.isArray(o.epochs) && (!o.epochs.length || EpochInfo.is(o.epochs[0]))); + }, + isSDK(o: any): o is GenesisStateSDKType { + return o && (o.$typeUrl === GenesisState.typeUrl || Array.isArray(o.epochs) && (!o.epochs.length || EpochInfo.isSDK(o.epochs[0]))); + }, + isAmino(o: any): o is GenesisStateAmino { + return o && (o.$typeUrl === GenesisState.typeUrl || Array.isArray(o.epochs) && (!o.epochs.length || EpochInfo.isAmino(o.epochs[0]))); + }, encode(message: GenesisState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.epochs) { EpochInfo.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -492,5 +512,11 @@ export const GenesisState = { typeUrl: "/osmosis.epochs.v1beta1.GenesisState", value: GenesisState.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GenesisState.typeUrl)) { + return; + } + EpochInfo.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/osmosis/epochs/query.rpc.func.ts b/__fixtures__/v-next/outputv2/osmosis/epochs/query.rpc.func.ts new file mode 100644 index 0000000000..24d64e7a4a --- /dev/null +++ b/__fixtures__/v-next/outputv2/osmosis/epochs/query.rpc.func.ts @@ -0,0 +1,28 @@ +import { buildQuery } from "../../helper-func-types"; +import { QueryEpochsInfoRequest, QueryEpochsInfoResponse, QueryCurrentEpochRequest, QueryCurrentEpochResponse } from "./query"; +/** + * EpochInfos provide running epochInfos + * @name getEpochInfos + * @package osmosis.epochs.v1beta1 + * @see proto service: osmosis.epochs.v1beta1.EpochInfos + */ +export const getEpochInfos = buildQuery({ + encode: QueryEpochsInfoRequest.encode, + decode: QueryEpochsInfoResponse.decode, + service: "osmosis.epochs.v1beta1.Query", + method: "EpochInfos", + deps: [QueryEpochsInfoRequest, QueryEpochsInfoResponse] +}); +/** + * CurrentEpoch provide current epoch of specified identifier + * @name getCurrentEpoch + * @package osmosis.epochs.v1beta1 + * @see proto service: osmosis.epochs.v1beta1.CurrentEpoch + */ +export const getCurrentEpoch = buildQuery({ + encode: QueryCurrentEpochRequest.encode, + decode: QueryCurrentEpochResponse.decode, + service: "osmosis.epochs.v1beta1.Query", + method: "CurrentEpoch", + deps: [QueryCurrentEpochRequest, QueryCurrentEpochResponse] +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/osmosis/epochs/query.ts b/__fixtures__/v-next/outputv2/osmosis/epochs/query.ts index eaf8f1669f..88cb238076 100644 --- a/__fixtures__/v-next/outputv2/osmosis/epochs/query.ts +++ b/__fixtures__/v-next/outputv2/osmosis/epochs/query.ts @@ -2,6 +2,7 @@ import { EpochInfo, EpochInfoAmino, EpochInfoSDKType } from "./genesis"; import { BinaryReader, BinaryWriter } from "../../binary"; import { JsonSafe } from "../../json-safe"; import { DeepPartial, isSet } from "../../helpers"; +import { GlobalDecoderRegistry } from "../../registry"; export const protobufPackage = "osmosis.epochs.v1beta1"; /** * @name QueryEpochsInfoRequest @@ -136,6 +137,15 @@ function createBaseQueryEpochsInfoRequest(): QueryEpochsInfoRequest { export const QueryEpochsInfoRequest = { typeUrl: "/osmosis.epochs.v1beta1.QueryEpochsInfoRequest", aminoType: "osmosis/epochs/query-epochs-info-request", + is(o: any): o is QueryEpochsInfoRequest { + return o && o.$typeUrl === QueryEpochsInfoRequest.typeUrl; + }, + isSDK(o: any): o is QueryEpochsInfoRequestSDKType { + return o && o.$typeUrl === QueryEpochsInfoRequest.typeUrl; + }, + isAmino(o: any): o is QueryEpochsInfoRequestAmino { + return o && o.$typeUrl === QueryEpochsInfoRequest.typeUrl; + }, encode(_: QueryEpochsInfoRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -200,7 +210,8 @@ export const QueryEpochsInfoRequest = { typeUrl: "/osmosis.epochs.v1beta1.QueryEpochsInfoRequest", value: QueryEpochsInfoRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryEpochsInfoResponse(): QueryEpochsInfoResponse { return { @@ -215,6 +226,15 @@ function createBaseQueryEpochsInfoResponse(): QueryEpochsInfoResponse { export const QueryEpochsInfoResponse = { typeUrl: "/osmosis.epochs.v1beta1.QueryEpochsInfoResponse", aminoType: "osmosis/epochs/query-epochs-info-response", + is(o: any): o is QueryEpochsInfoResponse { + return o && (o.$typeUrl === QueryEpochsInfoResponse.typeUrl || Array.isArray(o.epochs) && (!o.epochs.length || EpochInfo.is(o.epochs[0]))); + }, + isSDK(o: any): o is QueryEpochsInfoResponseSDKType { + return o && (o.$typeUrl === QueryEpochsInfoResponse.typeUrl || Array.isArray(o.epochs) && (!o.epochs.length || EpochInfo.isSDK(o.epochs[0]))); + }, + isAmino(o: any): o is QueryEpochsInfoResponseAmino { + return o && (o.$typeUrl === QueryEpochsInfoResponse.typeUrl || Array.isArray(o.epochs) && (!o.epochs.length || EpochInfo.isAmino(o.epochs[0]))); + }, encode(message: QueryEpochsInfoResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.epochs) { EpochInfo.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -305,6 +325,12 @@ export const QueryEpochsInfoResponse = { typeUrl: "/osmosis.epochs.v1beta1.QueryEpochsInfoResponse", value: QueryEpochsInfoResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryEpochsInfoResponse.typeUrl)) { + return; + } + EpochInfo.registerTypeUrl(); } }; function createBaseQueryCurrentEpochRequest(): QueryCurrentEpochRequest { @@ -320,6 +346,15 @@ function createBaseQueryCurrentEpochRequest(): QueryCurrentEpochRequest { export const QueryCurrentEpochRequest = { typeUrl: "/osmosis.epochs.v1beta1.QueryCurrentEpochRequest", aminoType: "osmosis/epochs/query-current-epoch-request", + is(o: any): o is QueryCurrentEpochRequest { + return o && (o.$typeUrl === QueryCurrentEpochRequest.typeUrl || typeof o.identifier === "string"); + }, + isSDK(o: any): o is QueryCurrentEpochRequestSDKType { + return o && (o.$typeUrl === QueryCurrentEpochRequest.typeUrl || typeof o.identifier === "string"); + }, + isAmino(o: any): o is QueryCurrentEpochRequestAmino { + return o && (o.$typeUrl === QueryCurrentEpochRequest.typeUrl || typeof o.identifier === "string"); + }, encode(message: QueryCurrentEpochRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.identifier !== "") { writer.uint32(10).string(message.identifier); @@ -400,7 +435,8 @@ export const QueryCurrentEpochRequest = { typeUrl: "/osmosis.epochs.v1beta1.QueryCurrentEpochRequest", value: QueryCurrentEpochRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryCurrentEpochResponse(): QueryCurrentEpochResponse { return { @@ -415,6 +451,15 @@ function createBaseQueryCurrentEpochResponse(): QueryCurrentEpochResponse { export const QueryCurrentEpochResponse = { typeUrl: "/osmosis.epochs.v1beta1.QueryCurrentEpochResponse", aminoType: "osmosis/epochs/query-current-epoch-response", + is(o: any): o is QueryCurrentEpochResponse { + return o && (o.$typeUrl === QueryCurrentEpochResponse.typeUrl || typeof o.currentEpoch === "bigint"); + }, + isSDK(o: any): o is QueryCurrentEpochResponseSDKType { + return o && (o.$typeUrl === QueryCurrentEpochResponse.typeUrl || typeof o.current_epoch === "bigint"); + }, + isAmino(o: any): o is QueryCurrentEpochResponseAmino { + return o && (o.$typeUrl === QueryCurrentEpochResponse.typeUrl || typeof o.current_epoch === "bigint"); + }, encode(message: QueryCurrentEpochResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.currentEpoch !== BigInt(0)) { writer.uint32(8).int64(message.currentEpoch); @@ -497,5 +542,6 @@ export const QueryCurrentEpochResponse = { typeUrl: "/osmosis.epochs.v1beta1.QueryCurrentEpochResponse", value: QueryCurrentEpochResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/osmosis/gamm/pool-models/balancer/balancerPool.ts b/__fixtures__/v-next/outputv2/osmosis/gamm/pool-models/balancer/balancerPool.ts index 77b61ff422..a525e76925 100644 --- a/__fixtures__/v-next/outputv2/osmosis/gamm/pool-models/balancer/balancerPool.ts +++ b/__fixtures__/v-next/outputv2/osmosis/gamm/pool-models/balancer/balancerPool.ts @@ -3,8 +3,9 @@ import { Duration, DurationAmino, DurationSDKType } from "../../../../google/pro import { Coin, CoinAmino, CoinSDKType } from "../../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../../binary"; import { toTimestamp, fromTimestamp, isSet, DeepPartial } from "../../../../helpers"; +import { GlobalDecoderRegistry } from "../../../../registry"; import { JsonSafe } from "../../../../json-safe"; -import { Decimal } from "@cosmjs/math"; +import { Decimal } from "@interchainjs/math"; export const protobufPackage = "osmosis.gamm.v1beta1"; /** * Parameters for changing the weights in a balancer pool smoothly from @@ -354,6 +355,15 @@ function createBaseSmoothWeightChangeParams(): SmoothWeightChangeParams { export const SmoothWeightChangeParams = { typeUrl: "/osmosis.gamm.v1beta1.SmoothWeightChangeParams", aminoType: "osmosis/gamm/smooth-weight-change-params", + is(o: any): o is SmoothWeightChangeParams { + return o && (o.$typeUrl === SmoothWeightChangeParams.typeUrl || Timestamp.is(o.startTime) && Duration.is(o.duration) && Array.isArray(o.initialPoolWeights) && (!o.initialPoolWeights.length || PoolAsset.is(o.initialPoolWeights[0])) && Array.isArray(o.targetPoolWeights) && (!o.targetPoolWeights.length || PoolAsset.is(o.targetPoolWeights[0]))); + }, + isSDK(o: any): o is SmoothWeightChangeParamsSDKType { + return o && (o.$typeUrl === SmoothWeightChangeParams.typeUrl || Timestamp.isSDK(o.start_time) && Duration.isSDK(o.duration) && Array.isArray(o.initial_pool_weights) && (!o.initial_pool_weights.length || PoolAsset.isSDK(o.initial_pool_weights[0])) && Array.isArray(o.target_pool_weights) && (!o.target_pool_weights.length || PoolAsset.isSDK(o.target_pool_weights[0]))); + }, + isAmino(o: any): o is SmoothWeightChangeParamsAmino { + return o && (o.$typeUrl === SmoothWeightChangeParams.typeUrl || Timestamp.isAmino(o.start_time) && Duration.isAmino(o.duration) && Array.isArray(o.initial_pool_weights) && (!o.initial_pool_weights.length || PoolAsset.isAmino(o.initial_pool_weights[0])) && Array.isArray(o.target_pool_weights) && (!o.target_pool_weights.length || PoolAsset.isAmino(o.target_pool_weights[0]))); + }, encode(message: SmoothWeightChangeParams, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.startTime !== undefined) { Timestamp.encode(toTimestamp(message.startTime), writer.uint32(10).fork()).ldelim(); @@ -501,6 +511,12 @@ export const SmoothWeightChangeParams = { typeUrl: "/osmosis.gamm.v1beta1.SmoothWeightChangeParams", value: SmoothWeightChangeParams.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(SmoothWeightChangeParams.typeUrl)) { + return; + } + PoolAsset.registerTypeUrl(); } }; function createBasePoolParams(): PoolParams { @@ -522,6 +538,15 @@ function createBasePoolParams(): PoolParams { export const PoolParams = { typeUrl: "/osmosis.gamm.v1beta1.PoolParams", aminoType: "osmosis/gamm/pool-params", + is(o: any): o is PoolParams { + return o && (o.$typeUrl === PoolParams.typeUrl || typeof o.swapFee === "string" && typeof o.exitFee === "string"); + }, + isSDK(o: any): o is PoolParamsSDKType { + return o && (o.$typeUrl === PoolParams.typeUrl || typeof o.swap_fee === "string" && typeof o.exit_fee === "string"); + }, + isAmino(o: any): o is PoolParamsAmino { + return o && (o.$typeUrl === PoolParams.typeUrl || typeof o.swap_fee === "string" && typeof o.exit_fee === "string"); + }, encode(message: PoolParams, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.swapFee !== "") { writer.uint32(10).string(Decimal.fromUserInput(message.swapFee, 18).atomics); @@ -609,8 +634,8 @@ export const PoolParams = { }, toAmino(message: PoolParams): PoolParamsAmino { const obj: any = {}; - obj.swap_fee = message.swapFee === "" ? undefined : message.swapFee; - obj.exit_fee = message.exitFee === "" ? undefined : message.exitFee; + obj.swap_fee = message.swapFee === "" ? undefined : Decimal.fromUserInput(message.swapFee, 18).atomics; + obj.exit_fee = message.exitFee === "" ? undefined : Decimal.fromUserInput(message.exitFee, 18).atomics; obj.smooth_weight_change_params = message.smoothWeightChangeParams ? SmoothWeightChangeParams.toAmino(message.smoothWeightChangeParams) : undefined; return obj; }, @@ -634,6 +659,12 @@ export const PoolParams = { typeUrl: "/osmosis.gamm.v1beta1.PoolParams", value: PoolParams.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(PoolParams.typeUrl)) { + return; + } + SmoothWeightChangeParams.registerTypeUrl(); } }; function createBasePoolAsset(): PoolAsset { @@ -654,6 +685,15 @@ function createBasePoolAsset(): PoolAsset { export const PoolAsset = { typeUrl: "/osmosis.gamm.v1beta1.PoolAsset", aminoType: "osmosis/gamm/pool-asset", + is(o: any): o is PoolAsset { + return o && (o.$typeUrl === PoolAsset.typeUrl || Coin.is(o.token) && typeof o.weight === "string"); + }, + isSDK(o: any): o is PoolAssetSDKType { + return o && (o.$typeUrl === PoolAsset.typeUrl || Coin.isSDK(o.token) && typeof o.weight === "string"); + }, + isAmino(o: any): o is PoolAssetAmino { + return o && (o.$typeUrl === PoolAsset.typeUrl || Coin.isAmino(o.token) && typeof o.weight === "string"); + }, encode(message: PoolAsset, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.token !== undefined) { Coin.encode(message.token, writer.uint32(10).fork()).ldelim(); @@ -751,6 +791,12 @@ export const PoolAsset = { typeUrl: "/osmosis.gamm.v1beta1.PoolAsset", value: PoolAsset.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(PoolAsset.typeUrl)) { + return; + } + Coin.registerTypeUrl(); } }; function createBasePool(): Pool { @@ -773,6 +819,15 @@ function createBasePool(): Pool { export const Pool = { typeUrl: "/osmosis.gamm.v1beta1.Pool", aminoType: "osmosis/gamm/pool", + is(o: any): o is Pool { + return o && (o.$typeUrl === Pool.typeUrl || typeof o.address === "string" && typeof o.id === "bigint" && PoolParams.is(o.poolParams) && typeof o.futurePoolGovernor === "string" && Coin.is(o.totalShares) && Array.isArray(o.poolAssets) && (!o.poolAssets.length || PoolAsset.is(o.poolAssets[0])) && typeof o.totalWeight === "string"); + }, + isSDK(o: any): o is PoolSDKType { + return o && (o.$typeUrl === Pool.typeUrl || typeof o.address === "string" && typeof o.id === "bigint" && PoolParams.isSDK(o.pool_params) && typeof o.future_pool_governor === "string" && Coin.isSDK(o.total_shares) && Array.isArray(o.pool_assets) && (!o.pool_assets.length || PoolAsset.isSDK(o.pool_assets[0])) && typeof o.total_weight === "string"); + }, + isAmino(o: any): o is PoolAmino { + return o && (o.$typeUrl === Pool.typeUrl || typeof o.address === "string" && typeof o.id === "bigint" && PoolParams.isAmino(o.pool_params) && typeof o.future_pool_governor === "string" && Coin.isAmino(o.total_shares) && Array.isArray(o.pool_assets) && (!o.pool_assets.length || PoolAsset.isAmino(o.pool_assets[0])) && typeof o.total_weight === "string"); + }, encode(message: Pool, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.address !== "") { writer.uint32(10).string(message.address); @@ -959,5 +1014,15 @@ export const Pool = { typeUrl: "/osmosis.gamm.v1beta1.Pool", value: Pool.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Pool.typeUrl)) { + return; + } + GlobalDecoderRegistry.register(Pool.typeUrl, Pool); + GlobalDecoderRegistry.registerAminoProtoMapping(Pool.aminoType, Pool.typeUrl); + PoolParams.registerTypeUrl(); + Coin.registerTypeUrl(); + PoolAsset.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/osmosis/gamm/pool-models/balancer/tx/tx.registry.ts b/__fixtures__/v-next/outputv2/osmosis/gamm/pool-models/balancer/tx/tx.registry.ts index 302d7509a1..e67af9e0c4 100644 --- a/__fixtures__/v-next/outputv2/osmosis/gamm/pool-models/balancer/tx/tx.registry.ts +++ b/__fixtures__/v-next/outputv2/osmosis/gamm/pool-models/balancer/tx/tx.registry.ts @@ -1,11 +1,6 @@ -import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { TelescopeGeneratedType } from "../../../../../types"; import { MsgCreateBalancerPool } from "./tx"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/osmosis.gamm.poolmodels.balancer.v1beta1.MsgCreateBalancerPool", MsgCreateBalancerPool]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/osmosis.gamm.poolmodels.balancer.v1beta1.MsgCreateBalancerPool", MsgCreateBalancerPool]]; export const MessageComposer = { encoded: { createBalancerPool(value: MsgCreateBalancerPool) { diff --git a/__fixtures__/v-next/outputv2/osmosis/gamm/pool-models/balancer/tx/tx.rpc.func.ts b/__fixtures__/v-next/outputv2/osmosis/gamm/pool-models/balancer/tx/tx.rpc.func.ts new file mode 100644 index 0000000000..806f9c2885 --- /dev/null +++ b/__fixtures__/v-next/outputv2/osmosis/gamm/pool-models/balancer/tx/tx.rpc.func.ts @@ -0,0 +1,10 @@ +import { buildTx } from "../../../../../helper-func-types"; +import { MsgCreateBalancerPool } from "./tx"; +/** + * @name createBalancerPool + * @package osmosis.gamm.poolmodels.balancer.v1beta1 + * @see proto service: osmosis.gamm.poolmodels.balancer.v1beta1.CreateBalancerPool + */ +export const createBalancerPool = buildTx({ + msg: MsgCreateBalancerPool +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/osmosis/gamm/pool-models/balancer/tx/tx.ts b/__fixtures__/v-next/outputv2/osmosis/gamm/pool-models/balancer/tx/tx.ts index 7f4cb3e128..da49c53026 100644 --- a/__fixtures__/v-next/outputv2/osmosis/gamm/pool-models/balancer/tx/tx.ts +++ b/__fixtures__/v-next/outputv2/osmosis/gamm/pool-models/balancer/tx/tx.ts @@ -1,5 +1,6 @@ import { PoolParams, PoolParamsAmino, PoolParamsSDKType, PoolAsset, PoolAssetAmino, PoolAssetSDKType } from "../balancerPool"; import { BinaryReader, BinaryWriter } from "../../../../../binary"; +import { GlobalDecoderRegistry } from "../../../../../registry"; import { isSet, DeepPartial } from "../../../../../helpers"; import { JsonSafe } from "../../../../../json-safe"; export const protobufPackage = "osmosis.gamm.poolmodels.balancer.v1beta1"; @@ -99,6 +100,15 @@ function createBaseMsgCreateBalancerPool(): MsgCreateBalancerPool { export const MsgCreateBalancerPool = { typeUrl: "/osmosis.gamm.poolmodels.balancer.v1beta1.MsgCreateBalancerPool", aminoType: "osmosis/gamm/poolmodels/balancer/create-balancer-pool", + is(o: any): o is MsgCreateBalancerPool { + return o && (o.$typeUrl === MsgCreateBalancerPool.typeUrl || typeof o.sender === "string" && Array.isArray(o.poolAssets) && (!o.poolAssets.length || PoolAsset.is(o.poolAssets[0])) && typeof o.futurePoolGovernor === "string"); + }, + isSDK(o: any): o is MsgCreateBalancerPoolSDKType { + return o && (o.$typeUrl === MsgCreateBalancerPool.typeUrl || typeof o.sender === "string" && Array.isArray(o.pool_assets) && (!o.pool_assets.length || PoolAsset.isSDK(o.pool_assets[0])) && typeof o.future_pool_governor === "string"); + }, + isAmino(o: any): o is MsgCreateBalancerPoolAmino { + return o && (o.$typeUrl === MsgCreateBalancerPool.typeUrl || typeof o.sender === "string" && Array.isArray(o.pool_assets) && (!o.pool_assets.length || PoolAsset.isAmino(o.pool_assets[0])) && typeof o.future_pool_governor === "string"); + }, encode(message: MsgCreateBalancerPool, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.sender !== "") { writer.uint32(10).string(message.sender); @@ -236,6 +246,13 @@ export const MsgCreateBalancerPool = { typeUrl: "/osmosis.gamm.poolmodels.balancer.v1beta1.MsgCreateBalancerPool", value: MsgCreateBalancerPool.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgCreateBalancerPool.typeUrl)) { + return; + } + PoolParams.registerTypeUrl(); + PoolAsset.registerTypeUrl(); } }; function createBaseMsgCreateBalancerPoolResponse(): MsgCreateBalancerPoolResponse { @@ -252,6 +269,15 @@ function createBaseMsgCreateBalancerPoolResponse(): MsgCreateBalancerPoolRespons export const MsgCreateBalancerPoolResponse = { typeUrl: "/osmosis.gamm.poolmodels.balancer.v1beta1.MsgCreateBalancerPoolResponse", aminoType: "osmosis/gamm/poolmodels/balancer/create-balancer-pool-response", + is(o: any): o is MsgCreateBalancerPoolResponse { + return o && (o.$typeUrl === MsgCreateBalancerPoolResponse.typeUrl || typeof o.poolId === "bigint"); + }, + isSDK(o: any): o is MsgCreateBalancerPoolResponseSDKType { + return o && (o.$typeUrl === MsgCreateBalancerPoolResponse.typeUrl || typeof o.pool_id === "bigint"); + }, + isAmino(o: any): o is MsgCreateBalancerPoolResponseAmino { + return o && (o.$typeUrl === MsgCreateBalancerPoolResponse.typeUrl || typeof o.pool_id === "bigint"); + }, encode(message: MsgCreateBalancerPoolResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.poolId !== BigInt(0)) { writer.uint32(8).uint64(message.poolId); @@ -334,5 +360,6 @@ export const MsgCreateBalancerPoolResponse = { typeUrl: "/osmosis.gamm.poolmodels.balancer.v1beta1.MsgCreateBalancerPoolResponse", value: MsgCreateBalancerPoolResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/osmosis/gamm/pool-models/stableswap/stableswap_pool.ts b/__fixtures__/v-next/outputv2/osmosis/gamm/pool-models/stableswap/stableswap_pool.ts index ee34858be7..cf67129fdc 100644 --- a/__fixtures__/v-next/outputv2/osmosis/gamm/pool-models/stableswap/stableswap_pool.ts +++ b/__fixtures__/v-next/outputv2/osmosis/gamm/pool-models/stableswap/stableswap_pool.ts @@ -1,8 +1,9 @@ import { Coin, CoinAmino, CoinSDKType } from "../../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { Decimal } from "@cosmjs/math"; +import { Decimal } from "@interchainjs/math"; import { isSet, DeepPartial } from "../../../../helpers"; import { JsonSafe } from "../../../../json-safe"; +import { GlobalDecoderRegistry } from "../../../../registry"; export const protobufPackage = "osmosis.gamm.poolmodels.stableswap.v1beta1"; /** * PoolParams defined the parameters that will be managed by the pool @@ -171,6 +172,15 @@ function createBasePoolParams(): PoolParams { export const PoolParams = { typeUrl: "/osmosis.gamm.poolmodels.stableswap.v1beta1.PoolParams", aminoType: "osmosis/gamm/pool-params", + is(o: any): o is PoolParams { + return o && (o.$typeUrl === PoolParams.typeUrl || typeof o.swapFee === "string" && typeof o.exitFee === "string"); + }, + isSDK(o: any): o is PoolParamsSDKType { + return o && (o.$typeUrl === PoolParams.typeUrl || typeof o.swap_fee === "string" && typeof o.exit_fee === "string"); + }, + isAmino(o: any): o is PoolParamsAmino { + return o && (o.$typeUrl === PoolParams.typeUrl || typeof o.swap_fee === "string" && typeof o.exit_fee === "string"); + }, encode(message: PoolParams, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.swapFee !== "") { writer.uint32(10).string(Decimal.fromUserInput(message.swapFee, 18).atomics); @@ -242,8 +252,8 @@ export const PoolParams = { }, toAmino(message: PoolParams): PoolParamsAmino { const obj: any = {}; - obj.swap_fee = message.swapFee === "" ? undefined : message.swapFee; - obj.exit_fee = message.exitFee === "" ? undefined : message.exitFee; + obj.swap_fee = message.swapFee === "" ? undefined : Decimal.fromUserInput(message.swapFee, 18).atomics; + obj.exit_fee = message.exitFee === "" ? undefined : Decimal.fromUserInput(message.exitFee, 18).atomics; return obj; }, fromAminoMsg(object: PoolParamsAminoMsg): PoolParams { @@ -266,7 +276,8 @@ export const PoolParams = { typeUrl: "/osmosis.gamm.poolmodels.stableswap.v1beta1.PoolParams", value: PoolParams.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBasePool(): Pool { return { @@ -290,6 +301,15 @@ function createBasePool(): Pool { export const Pool = { typeUrl: "/osmosis.gamm.poolmodels.stableswap.v1beta1.Pool", aminoType: "osmosis/gamm/pool", + is(o: any): o is Pool { + return o && (o.$typeUrl === Pool.typeUrl || typeof o.address === "string" && typeof o.id === "bigint" && PoolParams.is(o.poolParams) && typeof o.futurePoolGovernor === "string" && Coin.is(o.totalShares) && Array.isArray(o.poolLiquidity) && (!o.poolLiquidity.length || Coin.is(o.poolLiquidity[0])) && Array.isArray(o.scalingFactors) && (!o.scalingFactors.length || typeof o.scalingFactors[0] === "bigint") && typeof o.scalingFactorController === "string"); + }, + isSDK(o: any): o is PoolSDKType { + return o && (o.$typeUrl === Pool.typeUrl || typeof o.address === "string" && typeof o.id === "bigint" && PoolParams.isSDK(o.pool_params) && typeof o.future_pool_governor === "string" && Coin.isSDK(o.total_shares) && Array.isArray(o.pool_liquidity) && (!o.pool_liquidity.length || Coin.isSDK(o.pool_liquidity[0])) && Array.isArray(o.scaling_factors) && (!o.scaling_factors.length || typeof o.scaling_factors[0] === "bigint") && typeof o.scaling_factor_controller === "string"); + }, + isAmino(o: any): o is PoolAmino { + return o && (o.$typeUrl === Pool.typeUrl || typeof o.address === "string" && typeof o.id === "bigint" && PoolParams.isAmino(o.pool_params) && typeof o.future_pool_governor === "string" && Coin.isAmino(o.total_shares) && Array.isArray(o.pool_liquidity) && (!o.pool_liquidity.length || Coin.isAmino(o.pool_liquidity[0])) && Array.isArray(o.scaling_factors) && (!o.scaling_factors.length || typeof o.scaling_factors[0] === "bigint") && typeof o.scaling_factor_controller === "string"); + }, encode(message: Pool, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.address !== "") { writer.uint32(10).string(message.address); @@ -510,5 +530,14 @@ export const Pool = { typeUrl: "/osmosis.gamm.poolmodels.stableswap.v1beta1.Pool", value: Pool.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Pool.typeUrl)) { + return; + } + GlobalDecoderRegistry.register(Pool.typeUrl, Pool); + GlobalDecoderRegistry.registerAminoProtoMapping(Pool.aminoType, Pool.typeUrl); + PoolParams.registerTypeUrl(); + Coin.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/osmosis/gamm/pool-models/stableswap/tx.registry.ts b/__fixtures__/v-next/outputv2/osmosis/gamm/pool-models/stableswap/tx.registry.ts index 3484c54198..c8546096e0 100644 --- a/__fixtures__/v-next/outputv2/osmosis/gamm/pool-models/stableswap/tx.registry.ts +++ b/__fixtures__/v-next/outputv2/osmosis/gamm/pool-models/stableswap/tx.registry.ts @@ -1,11 +1,6 @@ -import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { TelescopeGeneratedType } from "../../../../types"; import { MsgCreateStableswapPool, MsgStableSwapAdjustScalingFactors } from "./tx"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/osmosis.gamm.poolmodels.stableswap.v1beta1.MsgCreateStableswapPool", MsgCreateStableswapPool], ["/osmosis.gamm.poolmodels.stableswap.v1beta1.MsgStableSwapAdjustScalingFactors", MsgStableSwapAdjustScalingFactors]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/osmosis.gamm.poolmodels.stableswap.v1beta1.MsgCreateStableswapPool", MsgCreateStableswapPool], ["/osmosis.gamm.poolmodels.stableswap.v1beta1.MsgStableSwapAdjustScalingFactors", MsgStableSwapAdjustScalingFactors]]; export const MessageComposer = { encoded: { createStableswapPool(value: MsgCreateStableswapPool) { diff --git a/__fixtures__/v-next/outputv2/osmosis/gamm/pool-models/stableswap/tx.rpc.func.ts b/__fixtures__/v-next/outputv2/osmosis/gamm/pool-models/stableswap/tx.rpc.func.ts new file mode 100644 index 0000000000..fdff5bb8bc --- /dev/null +++ b/__fixtures__/v-next/outputv2/osmosis/gamm/pool-models/stableswap/tx.rpc.func.ts @@ -0,0 +1,18 @@ +import { buildTx } from "../../../../helper-func-types"; +import { MsgCreateStableswapPool, MsgStableSwapAdjustScalingFactors } from "./tx"; +/** + * @name createStableswapPool + * @package osmosis.gamm.poolmodels.stableswap.v1beta1 + * @see proto service: osmosis.gamm.poolmodels.stableswap.v1beta1.CreateStableswapPool + */ +export const createStableswapPool = buildTx({ + msg: MsgCreateStableswapPool +}); +/** + * @name stableSwapAdjustScalingFactors + * @package osmosis.gamm.poolmodels.stableswap.v1beta1 + * @see proto service: osmosis.gamm.poolmodels.stableswap.v1beta1.StableSwapAdjustScalingFactors + */ +export const stableSwapAdjustScalingFactors = buildTx({ + msg: MsgStableSwapAdjustScalingFactors +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/osmosis/gamm/pool-models/stableswap/tx.ts b/__fixtures__/v-next/outputv2/osmosis/gamm/pool-models/stableswap/tx.ts index d9feb8577c..229b20c7b0 100644 --- a/__fixtures__/v-next/outputv2/osmosis/gamm/pool-models/stableswap/tx.ts +++ b/__fixtures__/v-next/outputv2/osmosis/gamm/pool-models/stableswap/tx.ts @@ -1,6 +1,7 @@ import { PoolParams, PoolParamsAmino, PoolParamsSDKType } from "./stableswap_pool"; import { Coin, CoinAmino, CoinSDKType } from "../../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { GlobalDecoderRegistry } from "../../../../registry"; import { isSet, DeepPartial } from "../../../../helpers"; import { JsonSafe } from "../../../../json-safe"; export const protobufPackage = "osmosis.gamm.poolmodels.stableswap.v1beta1"; @@ -178,6 +179,15 @@ function createBaseMsgCreateStableswapPool(): MsgCreateStableswapPool { export const MsgCreateStableswapPool = { typeUrl: "/osmosis.gamm.poolmodels.stableswap.v1beta1.MsgCreateStableswapPool", aminoType: "osmosis/gamm/create-stableswap-pool", + is(o: any): o is MsgCreateStableswapPool { + return o && (o.$typeUrl === MsgCreateStableswapPool.typeUrl || typeof o.sender === "string" && Array.isArray(o.initialPoolLiquidity) && (!o.initialPoolLiquidity.length || Coin.is(o.initialPoolLiquidity[0])) && Array.isArray(o.scalingFactors) && (!o.scalingFactors.length || typeof o.scalingFactors[0] === "bigint") && typeof o.futurePoolGovernor === "string" && typeof o.scalingFactorController === "string"); + }, + isSDK(o: any): o is MsgCreateStableswapPoolSDKType { + return o && (o.$typeUrl === MsgCreateStableswapPool.typeUrl || typeof o.sender === "string" && Array.isArray(o.initial_pool_liquidity) && (!o.initial_pool_liquidity.length || Coin.isSDK(o.initial_pool_liquidity[0])) && Array.isArray(o.scaling_factors) && (!o.scaling_factors.length || typeof o.scaling_factors[0] === "bigint") && typeof o.future_pool_governor === "string" && typeof o.scaling_factor_controller === "string"); + }, + isAmino(o: any): o is MsgCreateStableswapPoolAmino { + return o && (o.$typeUrl === MsgCreateStableswapPool.typeUrl || typeof o.sender === "string" && Array.isArray(o.initial_pool_liquidity) && (!o.initial_pool_liquidity.length || Coin.isAmino(o.initial_pool_liquidity[0])) && Array.isArray(o.scaling_factors) && (!o.scaling_factors.length || typeof o.scaling_factors[0] === "bigint") && typeof o.future_pool_governor === "string" && typeof o.scaling_factor_controller === "string"); + }, encode(message: MsgCreateStableswapPool, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.sender !== "") { writer.uint32(10).string(message.sender); @@ -364,6 +374,13 @@ export const MsgCreateStableswapPool = { typeUrl: "/osmosis.gamm.poolmodels.stableswap.v1beta1.MsgCreateStableswapPool", value: MsgCreateStableswapPool.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgCreateStableswapPool.typeUrl)) { + return; + } + PoolParams.registerTypeUrl(); + Coin.registerTypeUrl(); } }; function createBaseMsgCreateStableswapPoolResponse(): MsgCreateStableswapPoolResponse { @@ -380,6 +397,15 @@ function createBaseMsgCreateStableswapPoolResponse(): MsgCreateStableswapPoolRes export const MsgCreateStableswapPoolResponse = { typeUrl: "/osmosis.gamm.poolmodels.stableswap.v1beta1.MsgCreateStableswapPoolResponse", aminoType: "osmosis/gamm/create-stableswap-pool-response", + is(o: any): o is MsgCreateStableswapPoolResponse { + return o && (o.$typeUrl === MsgCreateStableswapPoolResponse.typeUrl || typeof o.poolId === "bigint"); + }, + isSDK(o: any): o is MsgCreateStableswapPoolResponseSDKType { + return o && (o.$typeUrl === MsgCreateStableswapPoolResponse.typeUrl || typeof o.pool_id === "bigint"); + }, + isAmino(o: any): o is MsgCreateStableswapPoolResponseAmino { + return o && (o.$typeUrl === MsgCreateStableswapPoolResponse.typeUrl || typeof o.pool_id === "bigint"); + }, encode(message: MsgCreateStableswapPoolResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.poolId !== BigInt(0)) { writer.uint32(8).uint64(message.poolId); @@ -462,7 +488,8 @@ export const MsgCreateStableswapPoolResponse = { typeUrl: "/osmosis.gamm.poolmodels.stableswap.v1beta1.MsgCreateStableswapPoolResponse", value: MsgCreateStableswapPoolResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgStableSwapAdjustScalingFactors(): MsgStableSwapAdjustScalingFactors { return { @@ -481,6 +508,15 @@ function createBaseMsgStableSwapAdjustScalingFactors(): MsgStableSwapAdjustScali export const MsgStableSwapAdjustScalingFactors = { typeUrl: "/osmosis.gamm.poolmodels.stableswap.v1beta1.MsgStableSwapAdjustScalingFactors", aminoType: "osmosis/gamm/stable-swap-adjust-scaling-factors", + is(o: any): o is MsgStableSwapAdjustScalingFactors { + return o && (o.$typeUrl === MsgStableSwapAdjustScalingFactors.typeUrl || typeof o.sender === "string" && typeof o.poolId === "bigint" && Array.isArray(o.scalingFactors) && (!o.scalingFactors.length || typeof o.scalingFactors[0] === "bigint")); + }, + isSDK(o: any): o is MsgStableSwapAdjustScalingFactorsSDKType { + return o && (o.$typeUrl === MsgStableSwapAdjustScalingFactors.typeUrl || typeof o.sender === "string" && typeof o.pool_id === "bigint" && Array.isArray(o.scaling_factors) && (!o.scaling_factors.length || typeof o.scaling_factors[0] === "bigint")); + }, + isAmino(o: any): o is MsgStableSwapAdjustScalingFactorsAmino { + return o && (o.$typeUrl === MsgStableSwapAdjustScalingFactors.typeUrl || typeof o.sender === "string" && typeof o.pool_id === "bigint" && Array.isArray(o.scaling_factors) && (!o.scaling_factors.length || typeof o.scaling_factors[0] === "bigint")); + }, encode(message: MsgStableSwapAdjustScalingFactors, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.sender !== "") { writer.uint32(10).string(message.sender); @@ -612,7 +648,8 @@ export const MsgStableSwapAdjustScalingFactors = { typeUrl: "/osmosis.gamm.poolmodels.stableswap.v1beta1.MsgStableSwapAdjustScalingFactors", value: MsgStableSwapAdjustScalingFactors.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgStableSwapAdjustScalingFactorsResponse(): MsgStableSwapAdjustScalingFactorsResponse { return {}; @@ -625,6 +662,15 @@ function createBaseMsgStableSwapAdjustScalingFactorsResponse(): MsgStableSwapAdj export const MsgStableSwapAdjustScalingFactorsResponse = { typeUrl: "/osmosis.gamm.poolmodels.stableswap.v1beta1.MsgStableSwapAdjustScalingFactorsResponse", aminoType: "osmosis/gamm/stable-swap-adjust-scaling-factors-response", + is(o: any): o is MsgStableSwapAdjustScalingFactorsResponse { + return o && o.$typeUrl === MsgStableSwapAdjustScalingFactorsResponse.typeUrl; + }, + isSDK(o: any): o is MsgStableSwapAdjustScalingFactorsResponseSDKType { + return o && o.$typeUrl === MsgStableSwapAdjustScalingFactorsResponse.typeUrl; + }, + isAmino(o: any): o is MsgStableSwapAdjustScalingFactorsResponseAmino { + return o && o.$typeUrl === MsgStableSwapAdjustScalingFactorsResponse.typeUrl; + }, encode(_: MsgStableSwapAdjustScalingFactorsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -689,5 +735,6 @@ export const MsgStableSwapAdjustScalingFactorsResponse = { typeUrl: "/osmosis.gamm.poolmodels.stableswap.v1beta1.MsgStableSwapAdjustScalingFactorsResponse", value: MsgStableSwapAdjustScalingFactorsResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/osmosis/gamm/v1beta1/genesis.ts b/__fixtures__/v-next/outputv2/osmosis/gamm/v1beta1/genesis.ts index 7f1edaecc2..84398c9fa5 100644 --- a/__fixtures__/v-next/outputv2/osmosis/gamm/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv2/osmosis/gamm/v1beta1/genesis.ts @@ -9,6 +9,7 @@ import { PoolSDKType as Pool2SDKType } from "../pool-models/stableswap/stableswa import { BinaryReader, BinaryWriter } from "../../../binary"; import { JsonSafe } from "../../../json-safe"; import { DeepPartial, isSet } from "../../../helpers"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "osmosis.gamm.v1beta1"; /** * Params holds parameters for the incentives module @@ -109,6 +110,15 @@ function createBaseParams(): Params { export const Params = { typeUrl: "/osmosis.gamm.v1beta1.Params", aminoType: "osmosis/gamm/params", + is(o: any): o is Params { + return o && (o.$typeUrl === Params.typeUrl || Array.isArray(o.poolCreationFee) && (!o.poolCreationFee.length || Coin.is(o.poolCreationFee[0]))); + }, + isSDK(o: any): o is ParamsSDKType { + return o && (o.$typeUrl === Params.typeUrl || Array.isArray(o.pool_creation_fee) && (!o.pool_creation_fee.length || Coin.isSDK(o.pool_creation_fee[0]))); + }, + isAmino(o: any): o is ParamsAmino { + return o && (o.$typeUrl === Params.typeUrl || Array.isArray(o.pool_creation_fee) && (!o.pool_creation_fee.length || Coin.isAmino(o.pool_creation_fee[0]))); + }, encode(message: Params, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.poolCreationFee) { Coin.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -199,6 +209,12 @@ export const Params = { typeUrl: "/osmosis.gamm.v1beta1.Params", value: Params.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Params.typeUrl)) { + return; + } + Coin.registerTypeUrl(); } }; function createBaseGenesisState(): GenesisState { @@ -217,9 +233,18 @@ function createBaseGenesisState(): GenesisState { export const GenesisState = { typeUrl: "/osmosis.gamm.v1beta1.GenesisState", aminoType: "osmosis/gamm/genesis-state", + is(o: any): o is GenesisState { + return o && (o.$typeUrl === GenesisState.typeUrl || Array.isArray(o.pools) && (!o.pools.length || Pool1.is(o.pools[0]) || Pool2.is(o.pools[0]) || Any.is(o.pools[0])) && typeof o.nextPoolNumber === "bigint" && Params.is(o.params)); + }, + isSDK(o: any): o is GenesisStateSDKType { + return o && (o.$typeUrl === GenesisState.typeUrl || Array.isArray(o.pools) && (!o.pools.length || Pool1.isSDK(o.pools[0]) || Pool2.isSDK(o.pools[0]) || Any.isSDK(o.pools[0])) && typeof o.next_pool_number === "bigint" && Params.isSDK(o.params)); + }, + isAmino(o: any): o is GenesisStateAmino { + return o && (o.$typeUrl === GenesisState.typeUrl || Array.isArray(o.pools) && (!o.pools.length || Pool1.isAmino(o.pools[0]) || Pool2.isAmino(o.pools[0]) || Any.isAmino(o.pools[0])) && typeof o.next_pool_number === "bigint" && Params.isAmino(o.params)); + }, encode(message: GenesisState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.pools) { - Any.encode((v! as Any), writer.uint32(10).fork()).ldelim(); + Any.encode(GlobalDecoderRegistry.wrapAny(v!), writer.uint32(10).fork()).ldelim(); } if (message.nextPoolNumber !== BigInt(0)) { writer.uint32(16).uint64(message.nextPoolNumber); @@ -237,7 +262,7 @@ export const GenesisState = { const tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.pools.push((Any.decode(reader, reader.uint32()) as Any)); + message.pools.push(GlobalDecoderRegistry.unwrapAny(reader)); break; case 2: message.nextPoolNumber = reader.uint64(); @@ -254,7 +279,7 @@ export const GenesisState = { }, fromJSON(object: any): GenesisState { const obj = createBaseGenesisState(); - if (Array.isArray(object?.pools)) obj.pools = object.pools.map((e: any) => Any.fromJSON(e)); + if (Array.isArray(object?.pools)) obj.pools = object.pools.map((e: any) => GlobalDecoderRegistry.fromJSON(e)); if (isSet(object.nextPoolNumber)) obj.nextPoolNumber = BigInt(object.nextPoolNumber.toString()); if (isSet(object.params)) obj.params = Params.fromJSON(object.params); return obj; @@ -262,7 +287,7 @@ export const GenesisState = { toJSON(message: GenesisState): JsonSafe { const obj: any = {}; if (message.pools) { - obj.pools = message.pools.map(e => e ? Any.toJSON(e) : undefined); + obj.pools = message.pools.map(e => e ? GlobalDecoderRegistry.toJSON(e) : undefined); } else { obj.pools = []; } @@ -272,7 +297,7 @@ export const GenesisState = { }, fromPartial(object: DeepPartial): GenesisState { const message = createBaseGenesisState(); - message.pools = object.pools?.map(e => Any.fromPartial(e)) || []; + message.pools = object.pools?.map(e => (GlobalDecoderRegistry.fromPartial(e) as any)) || []; if (object.nextPoolNumber !== undefined && object.nextPoolNumber !== null) { message.nextPoolNumber = BigInt(object.nextPoolNumber.toString()); } @@ -283,7 +308,7 @@ export const GenesisState = { }, fromSDK(object: GenesisStateSDKType): GenesisState { return { - pools: Array.isArray(object?.pools) ? object.pools.map((e: any) => Any.fromSDK(e)) : [], + pools: Array.isArray(object?.pools) ? object.pools.map((e: any) => GlobalDecoderRegistry.fromSDK(e)) : [], nextPoolNumber: object?.next_pool_number, params: object.params ? Params.fromSDK(object.params) : undefined }; @@ -291,7 +316,7 @@ export const GenesisState = { toSDK(message: GenesisState): GenesisStateSDKType { const obj: any = {}; if (message.pools) { - obj.pools = message.pools.map(e => e ? Any.toSDK(e) : undefined); + obj.pools = message.pools.map(e => e ? GlobalDecoderRegistry.toSDK(e) : undefined); } else { obj.pools = []; } @@ -301,7 +326,7 @@ export const GenesisState = { }, fromAmino(object: GenesisStateAmino): GenesisState { const message = createBaseGenesisState(); - message.pools = object.pools?.map(e => PoolI_FromAmino(e)) || []; + message.pools = object.pools?.map(e => GlobalDecoderRegistry.fromAminoMsg(e)) || []; if (object.next_pool_number !== undefined && object.next_pool_number !== null) { message.nextPoolNumber = BigInt(object.next_pool_number); } @@ -313,7 +338,7 @@ export const GenesisState = { toAmino(message: GenesisState): GenesisStateAmino { const obj: any = {}; if (message.pools) { - obj.pools = message.pools.map(e => e ? PoolI_ToAmino((e as Any)) : undefined); + obj.pools = message.pools.map(e => e ? GlobalDecoderRegistry.toAminoMsg(e) : undefined); } else { obj.pools = message.pools; } @@ -341,49 +366,13 @@ export const GenesisState = { typeUrl: "/osmosis.gamm.v1beta1.GenesisState", value: GenesisState.encode(message).finish() }; - } -}; -export const PoolI_InterfaceDecoder = (input: BinaryReader | Uint8Array): Pool1 | Pool2 | Any => { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - const data = Any.decode(reader, reader.uint32()); - switch (data.typeUrl) { - case "/osmosis.gamm.v1beta1.Pool": - return Pool1.decode(data.value); - case "/osmosis.gamm.poolmodels.stableswap.v1beta1.Pool": - return Pool2.decode(data.value); - default: - return data; - } -}; -export const PoolI_FromAmino = (content: AnyAmino): Any => { - switch (content.type) { - case "osmosis/gamm/pool": - return Any.fromPartial({ - typeUrl: "/osmosis.gamm.v1beta1.Pool", - value: Pool1.encode(Pool1.fromPartial(Pool1.fromAmino(content.value))).finish() - }); - case "osmosis/gamm/pool": - return Any.fromPartial({ - typeUrl: "/osmosis.gamm.poolmodels.stableswap.v1beta1.Pool", - value: Pool2.encode(Pool2.fromPartial(Pool2.fromAmino(content.value))).finish() - }); - default: - return Any.fromAmino(content); - } -}; -export const PoolI_ToAmino = (content: Any) => { - switch (content.typeUrl) { - case "/osmosis.gamm.v1beta1.Pool": - return { - type: "osmosis/gamm/pool", - value: Pool1.toAmino(Pool1.decode(content.value, undefined)) - }; - case "/osmosis.gamm.poolmodels.stableswap.v1beta1.Pool": - return { - type: "osmosis/gamm/pool", - value: Pool2.toAmino(Pool2.decode(content.value, undefined)) - }; - default: - return Any.toAmino(content); + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GenesisState.typeUrl)) { + return; + } + Pool1.registerTypeUrl(); + Pool2.registerTypeUrl(); + Params.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/osmosis/gamm/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputv2/osmosis/gamm/v1beta1/query.rpc.func.ts new file mode 100644 index 0000000000..0135c637f5 --- /dev/null +++ b/__fixtures__/v-next/outputv2/osmosis/gamm/v1beta1/query.rpc.func.ts @@ -0,0 +1,194 @@ +import { buildQuery } from "../../../helper-func-types"; +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"; +/** + * @name getPools + * @package osmosis.gamm.v1beta1 + * @see proto service: osmosis.gamm.v1beta1.Pools + */ +export const getPools = buildQuery({ + encode: QueryPoolsRequest.encode, + decode: QueryPoolsResponse.decode, + service: "osmosis.gamm.v1beta1.Query", + method: "Pools", + deps: [QueryPoolsRequest, QueryPoolsResponse] +}); +/** + * @name getNumPools + * @package osmosis.gamm.v1beta1 + * @see proto service: osmosis.gamm.v1beta1.NumPools + */ +export const getNumPools = buildQuery({ + encode: QueryNumPoolsRequest.encode, + decode: QueryNumPoolsResponse.decode, + service: "osmosis.gamm.v1beta1.Query", + method: "NumPools", + deps: [QueryNumPoolsRequest, QueryNumPoolsResponse] +}); +/** + * @name getTotalLiquidity + * @package osmosis.gamm.v1beta1 + * @see proto service: osmosis.gamm.v1beta1.TotalLiquidity + */ +export const getTotalLiquidity = buildQuery({ + encode: QueryTotalLiquidityRequest.encode, + decode: QueryTotalLiquidityResponse.decode, + service: "osmosis.gamm.v1beta1.Query", + method: "TotalLiquidity", + deps: [QueryTotalLiquidityRequest, QueryTotalLiquidityResponse] +}); +/** + * PoolsWithFilter allows you to query specific pools with requested + * parameters + * @name getPoolsWithFilter + * @package osmosis.gamm.v1beta1 + * @see proto service: osmosis.gamm.v1beta1.PoolsWithFilter + */ +export const getPoolsWithFilter = buildQuery({ + encode: QueryPoolsWithFilterRequest.encode, + decode: QueryPoolsWithFilterResponse.decode, + service: "osmosis.gamm.v1beta1.Query", + method: "PoolsWithFilter", + deps: [QueryPoolsWithFilterRequest, QueryPoolsWithFilterResponse] +}); +/** + * Per Pool gRPC Endpoints + * @name getPool + * @package osmosis.gamm.v1beta1 + * @see proto service: osmosis.gamm.v1beta1.Pool + */ +export const getPool = buildQuery({ + encode: QueryPoolRequest.encode, + decode: QueryPoolResponse.decode, + service: "osmosis.gamm.v1beta1.Query", + method: "Pool", + deps: [QueryPoolRequest, QueryPoolResponse] +}); +/** + * PoolType returns the type of the pool. + * Returns "Balancer" as a string literal when the pool is a balancer pool. + * Errors if the pool is failed to be type caseted. + * @name getPoolType + * @package osmosis.gamm.v1beta1 + * @see proto service: osmosis.gamm.v1beta1.PoolType + */ +export const getPoolType = buildQuery({ + encode: QueryPoolTypeRequest.encode, + decode: QueryPoolTypeResponse.decode, + service: "osmosis.gamm.v1beta1.Query", + method: "PoolType", + deps: [QueryPoolTypeRequest, QueryPoolTypeResponse] +}); +/** + * Simulates joining pool without a swap. Returns the amount of shares you'd + * get and tokens needed to provide + * @name getCalcJoinPoolNoSwapShares + * @package osmosis.gamm.v1beta1 + * @see proto service: osmosis.gamm.v1beta1.CalcJoinPoolNoSwapShares + */ +export const getCalcJoinPoolNoSwapShares = buildQuery({ + encode: QueryCalcJoinPoolNoSwapSharesRequest.encode, + decode: QueryCalcJoinPoolNoSwapSharesResponse.decode, + service: "osmosis.gamm.v1beta1.Query", + method: "CalcJoinPoolNoSwapShares", + deps: [QueryCalcJoinPoolNoSwapSharesRequest, QueryCalcJoinPoolNoSwapSharesResponse] +}); +/** + * @name getCalcJoinPoolShares + * @package osmosis.gamm.v1beta1 + * @see proto service: osmosis.gamm.v1beta1.CalcJoinPoolShares + */ +export const getCalcJoinPoolShares = buildQuery({ + encode: QueryCalcJoinPoolSharesRequest.encode, + decode: QueryCalcJoinPoolSharesResponse.decode, + service: "osmosis.gamm.v1beta1.Query", + method: "CalcJoinPoolShares", + deps: [QueryCalcJoinPoolSharesRequest, QueryCalcJoinPoolSharesResponse] +}); +/** + * @name getCalcExitPoolCoinsFromShares + * @package osmosis.gamm.v1beta1 + * @see proto service: osmosis.gamm.v1beta1.CalcExitPoolCoinsFromShares + */ +export const getCalcExitPoolCoinsFromShares = buildQuery({ + encode: QueryCalcExitPoolCoinsFromSharesRequest.encode, + decode: QueryCalcExitPoolCoinsFromSharesResponse.decode, + service: "osmosis.gamm.v1beta1.Query", + method: "CalcExitPoolCoinsFromShares", + deps: [QueryCalcExitPoolCoinsFromSharesRequest, QueryCalcExitPoolCoinsFromSharesResponse] +}); +/** + * @name getPoolParams + * @package osmosis.gamm.v1beta1 + * @see proto service: osmosis.gamm.v1beta1.PoolParams + */ +export const getPoolParams = buildQuery({ + encode: QueryPoolParamsRequest.encode, + decode: QueryPoolParamsResponse.decode, + service: "osmosis.gamm.v1beta1.Query", + method: "PoolParams", + deps: [QueryPoolParamsRequest, QueryPoolParamsResponse] +}); +/** + * @name getTotalPoolLiquidity + * @package osmosis.gamm.v1beta1 + * @see proto service: osmosis.gamm.v1beta1.TotalPoolLiquidity + */ +export const getTotalPoolLiquidity = buildQuery({ + encode: QueryTotalPoolLiquidityRequest.encode, + decode: QueryTotalPoolLiquidityResponse.decode, + service: "osmosis.gamm.v1beta1.Query", + method: "TotalPoolLiquidity", + deps: [QueryTotalPoolLiquidityRequest, QueryTotalPoolLiquidityResponse] +}); +/** + * @name getTotalShares + * @package osmosis.gamm.v1beta1 + * @see proto service: osmosis.gamm.v1beta1.TotalShares + */ +export const getTotalShares = buildQuery({ + encode: QueryTotalSharesRequest.encode, + decode: QueryTotalSharesResponse.decode, + service: "osmosis.gamm.v1beta1.Query", + method: "TotalShares", + deps: [QueryTotalSharesRequest, QueryTotalSharesResponse] +}); +/** + * SpotPrice defines a gRPC query handler that returns the spot price given + * a base denomination and a quote denomination. + * @name getSpotPrice + * @package osmosis.gamm.v1beta1 + * @see proto service: osmosis.gamm.v1beta1.SpotPrice + * @deprecated + */ +export const getSpotPrice = buildQuery({ + encode: QuerySpotPriceRequest.encode, + decode: QuerySpotPriceResponse.decode, + service: "osmosis.gamm.v1beta1.Query", + method: "SpotPrice", + deps: [QuerySpotPriceRequest, QuerySpotPriceResponse] +}); +/** + * Estimate the swap. + * @name getEstimateSwapExactAmountIn + * @package osmosis.gamm.v1beta1 + * @see proto service: osmosis.gamm.v1beta1.EstimateSwapExactAmountIn + */ +export const getEstimateSwapExactAmountIn = buildQuery({ + encode: QuerySwapExactAmountInRequest.encode, + decode: QuerySwapExactAmountInResponse.decode, + service: "osmosis.gamm.v1beta1.Query", + method: "EstimateSwapExactAmountIn", + deps: [QuerySwapExactAmountInRequest, QuerySwapExactAmountInResponse] +}); +/** + * @name getEstimateSwapExactAmountOut + * @package osmosis.gamm.v1beta1 + * @see proto service: osmosis.gamm.v1beta1.EstimateSwapExactAmountOut + */ +export const getEstimateSwapExactAmountOut = buildQuery({ + encode: QuerySwapExactAmountOutRequest.encode, + decode: QuerySwapExactAmountOutResponse.decode, + service: "osmosis.gamm.v1beta1.Query", + method: "EstimateSwapExactAmountOut", + deps: [QuerySwapExactAmountOutRequest, QuerySwapExactAmountOutResponse] +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/osmosis/gamm/v1beta1/query.ts b/__fixtures__/v-next/outputv2/osmosis/gamm/v1beta1/query.ts index f38c30894b..8e09f9ae1c 100644 --- a/__fixtures__/v-next/outputv2/osmosis/gamm/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv2/osmosis/gamm/v1beta1/query.ts @@ -11,6 +11,7 @@ import { PoolSDKType as Pool2SDKType } from "../pool-models/stableswap/stableswa import { BinaryReader, BinaryWriter } from "../../../binary"; import { isSet, DeepPartial } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "osmosis.gamm.v1beta1"; /** * =============================== Pool @@ -1124,6 +1125,15 @@ function createBaseQueryPoolRequest(): QueryPoolRequest { export const QueryPoolRequest = { typeUrl: "/osmosis.gamm.v1beta1.QueryPoolRequest", aminoType: "osmosis/gamm/query-pool-request", + is(o: any): o is QueryPoolRequest { + return o && (o.$typeUrl === QueryPoolRequest.typeUrl || typeof o.poolId === "bigint"); + }, + isSDK(o: any): o is QueryPoolRequestSDKType { + return o && (o.$typeUrl === QueryPoolRequest.typeUrl || typeof o.pool_id === "bigint"); + }, + isAmino(o: any): o is QueryPoolRequestAmino { + return o && (o.$typeUrl === QueryPoolRequest.typeUrl || typeof o.pool_id === "bigint"); + }, encode(message: QueryPoolRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.poolId !== BigInt(0)) { writer.uint32(8).uint64(message.poolId); @@ -1206,7 +1216,8 @@ export const QueryPoolRequest = { typeUrl: "/osmosis.gamm.v1beta1.QueryPoolRequest", value: QueryPoolRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryPoolResponse(): QueryPoolResponse { return { @@ -1221,9 +1232,18 @@ function createBaseQueryPoolResponse(): QueryPoolResponse { export const QueryPoolResponse = { typeUrl: "/osmosis.gamm.v1beta1.QueryPoolResponse", aminoType: "osmosis/gamm/query-pool-response", + is(o: any): o is QueryPoolResponse { + return o && o.$typeUrl === QueryPoolResponse.typeUrl; + }, + isSDK(o: any): o is QueryPoolResponseSDKType { + return o && o.$typeUrl === QueryPoolResponse.typeUrl; + }, + isAmino(o: any): o is QueryPoolResponseAmino { + return o && o.$typeUrl === QueryPoolResponse.typeUrl; + }, encode(message: QueryPoolResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.pool !== undefined) { - Any.encode((message.pool as Any), writer.uint32(10).fork()).ldelim(); + Any.encode(GlobalDecoderRegistry.wrapAny(message.pool), writer.uint32(10).fork()).ldelim(); } return writer; }, @@ -1235,7 +1255,7 @@ export const QueryPoolResponse = { const tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.pool = (PoolI_InterfaceDecoder(reader) as Any); + message.pool = GlobalDecoderRegistry.unwrapAny(reader); break; default: reader.skipType(tag & 7); @@ -1246,41 +1266,41 @@ export const QueryPoolResponse = { }, fromJSON(object: any): QueryPoolResponse { const obj = createBaseQueryPoolResponse(); - if (isSet(object.pool)) obj.pool = Any.fromJSON(object.pool); + if (isSet(object.pool)) obj.pool = GlobalDecoderRegistry.fromJSON(object.pool); return obj; }, toJSON(message: QueryPoolResponse): JsonSafe { const obj: any = {}; - message.pool !== undefined && (obj.pool = message.pool ? Any.toJSON(message.pool) : undefined); + message.pool !== undefined && (obj.pool = message.pool ? GlobalDecoderRegistry.toJSON(message.pool) : undefined); return obj; }, fromPartial(object: DeepPartial): QueryPoolResponse { const message = createBaseQueryPoolResponse(); if (object.pool !== undefined && object.pool !== null) { - message.pool = Any.fromPartial(object.pool); + message.pool = GlobalDecoderRegistry.fromPartial(object.pool); } return message; }, fromSDK(object: QueryPoolResponseSDKType): QueryPoolResponse { return { - pool: object.pool ? Any.fromSDK(object.pool) : undefined + pool: object.pool ? GlobalDecoderRegistry.fromSDK(object.pool) : undefined }; }, toSDK(message: QueryPoolResponse): QueryPoolResponseSDKType { const obj: any = {}; - message.pool !== undefined && (obj.pool = message.pool ? Any.toSDK(message.pool) : undefined); + message.pool !== undefined && (obj.pool = message.pool ? GlobalDecoderRegistry.toSDK(message.pool) : undefined); return obj; }, fromAmino(object: QueryPoolResponseAmino): QueryPoolResponse { const message = createBaseQueryPoolResponse(); if (object.pool !== undefined && object.pool !== null) { - message.pool = PoolI_FromAmino(object.pool); + message.pool = GlobalDecoderRegistry.fromAminoMsg(object.pool); } return message; }, toAmino(message: QueryPoolResponse): QueryPoolResponseAmino { const obj: any = {}; - obj.pool = message.pool ? PoolI_ToAmino((message.pool as Any)) : undefined; + obj.pool = message.pool ? GlobalDecoderRegistry.toAminoMsg(message.pool) : undefined; return obj; }, fromAminoMsg(object: QueryPoolResponseAminoMsg): QueryPoolResponse { @@ -1303,6 +1323,13 @@ export const QueryPoolResponse = { typeUrl: "/osmosis.gamm.v1beta1.QueryPoolResponse", value: QueryPoolResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryPoolResponse.typeUrl)) { + return; + } + Pool1.registerTypeUrl(); + Pool2.registerTypeUrl(); } }; function createBaseQueryPoolsRequest(): QueryPoolsRequest { @@ -1319,6 +1346,15 @@ function createBaseQueryPoolsRequest(): QueryPoolsRequest { export const QueryPoolsRequest = { typeUrl: "/osmosis.gamm.v1beta1.QueryPoolsRequest", aminoType: "osmosis/gamm/query-pools-request", + is(o: any): o is QueryPoolsRequest { + return o && o.$typeUrl === QueryPoolsRequest.typeUrl; + }, + isSDK(o: any): o is QueryPoolsRequestSDKType { + return o && o.$typeUrl === QueryPoolsRequest.typeUrl; + }, + isAmino(o: any): o is QueryPoolsRequestAmino { + return o && o.$typeUrl === QueryPoolsRequest.typeUrl; + }, encode(message: QueryPoolsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.pagination !== undefined) { PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); @@ -1401,6 +1437,12 @@ export const QueryPoolsRequest = { typeUrl: "/osmosis.gamm.v1beta1.QueryPoolsRequest", value: QueryPoolsRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryPoolsRequest.typeUrl)) { + return; + } + PageRequest.registerTypeUrl(); } }; function createBaseQueryPoolsResponse(): QueryPoolsResponse { @@ -1417,9 +1459,18 @@ function createBaseQueryPoolsResponse(): QueryPoolsResponse { export const QueryPoolsResponse = { typeUrl: "/osmosis.gamm.v1beta1.QueryPoolsResponse", aminoType: "osmosis/gamm/query-pools-response", + is(o: any): o is QueryPoolsResponse { + return o && (o.$typeUrl === QueryPoolsResponse.typeUrl || Array.isArray(o.pools) && (!o.pools.length || Pool1.is(o.pools[0]) || Pool2.is(o.pools[0]) || Any.is(o.pools[0]))); + }, + isSDK(o: any): o is QueryPoolsResponseSDKType { + return o && (o.$typeUrl === QueryPoolsResponse.typeUrl || Array.isArray(o.pools) && (!o.pools.length || Pool1.isSDK(o.pools[0]) || Pool2.isSDK(o.pools[0]) || Any.isSDK(o.pools[0]))); + }, + isAmino(o: any): o is QueryPoolsResponseAmino { + return o && (o.$typeUrl === QueryPoolsResponse.typeUrl || Array.isArray(o.pools) && (!o.pools.length || Pool1.isAmino(o.pools[0]) || Pool2.isAmino(o.pools[0]) || Any.isAmino(o.pools[0]))); + }, encode(message: QueryPoolsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.pools) { - Any.encode((v! as Any), writer.uint32(10).fork()).ldelim(); + Any.encode(GlobalDecoderRegistry.wrapAny(v!), writer.uint32(10).fork()).ldelim(); } if (message.pagination !== undefined) { PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); @@ -1434,7 +1485,7 @@ export const QueryPoolsResponse = { const tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.pools.push((Any.decode(reader, reader.uint32()) as Any)); + message.pools.push(GlobalDecoderRegistry.unwrapAny(reader)); break; case 2: message.pagination = PageResponse.decode(reader, reader.uint32()); @@ -1448,14 +1499,14 @@ export const QueryPoolsResponse = { }, fromJSON(object: any): QueryPoolsResponse { const obj = createBaseQueryPoolsResponse(); - if (Array.isArray(object?.pools)) obj.pools = object.pools.map((e: any) => Any.fromJSON(e)); + if (Array.isArray(object?.pools)) obj.pools = object.pools.map((e: any) => GlobalDecoderRegistry.fromJSON(e)); if (isSet(object.pagination)) obj.pagination = PageResponse.fromJSON(object.pagination); return obj; }, toJSON(message: QueryPoolsResponse): JsonSafe { const obj: any = {}; if (message.pools) { - obj.pools = message.pools.map(e => e ? Any.toJSON(e) : undefined); + obj.pools = message.pools.map(e => e ? GlobalDecoderRegistry.toJSON(e) : undefined); } else { obj.pools = []; } @@ -1464,7 +1515,7 @@ export const QueryPoolsResponse = { }, fromPartial(object: DeepPartial): QueryPoolsResponse { const message = createBaseQueryPoolsResponse(); - message.pools = object.pools?.map(e => Any.fromPartial(e)) || []; + message.pools = object.pools?.map(e => (GlobalDecoderRegistry.fromPartial(e) as any)) || []; if (object.pagination !== undefined && object.pagination !== null) { message.pagination = PageResponse.fromPartial(object.pagination); } @@ -1472,14 +1523,14 @@ export const QueryPoolsResponse = { }, fromSDK(object: QueryPoolsResponseSDKType): QueryPoolsResponse { return { - pools: Array.isArray(object?.pools) ? object.pools.map((e: any) => Any.fromSDK(e)) : [], + pools: Array.isArray(object?.pools) ? object.pools.map((e: any) => GlobalDecoderRegistry.fromSDK(e)) : [], pagination: object.pagination ? PageResponse.fromSDK(object.pagination) : undefined }; }, toSDK(message: QueryPoolsResponse): QueryPoolsResponseSDKType { const obj: any = {}; if (message.pools) { - obj.pools = message.pools.map(e => e ? Any.toSDK(e) : undefined); + obj.pools = message.pools.map(e => e ? GlobalDecoderRegistry.toSDK(e) : undefined); } else { obj.pools = []; } @@ -1488,7 +1539,7 @@ export const QueryPoolsResponse = { }, fromAmino(object: QueryPoolsResponseAmino): QueryPoolsResponse { const message = createBaseQueryPoolsResponse(); - message.pools = object.pools?.map(e => PoolI_FromAmino(e)) || []; + message.pools = object.pools?.map(e => GlobalDecoderRegistry.fromAminoMsg(e)) || []; if (object.pagination !== undefined && object.pagination !== null) { message.pagination = PageResponse.fromAmino(object.pagination); } @@ -1497,7 +1548,7 @@ export const QueryPoolsResponse = { toAmino(message: QueryPoolsResponse): QueryPoolsResponseAmino { const obj: any = {}; if (message.pools) { - obj.pools = message.pools.map(e => e ? PoolI_ToAmino((e as Any)) : undefined); + obj.pools = message.pools.map(e => e ? GlobalDecoderRegistry.toAminoMsg(e) : undefined); } else { obj.pools = message.pools; } @@ -1524,6 +1575,14 @@ export const QueryPoolsResponse = { typeUrl: "/osmosis.gamm.v1beta1.QueryPoolsResponse", value: QueryPoolsResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryPoolsResponse.typeUrl)) { + return; + } + Pool1.registerTypeUrl(); + Pool2.registerTypeUrl(); + PageResponse.registerTypeUrl(); } }; function createBaseQueryNumPoolsRequest(): QueryNumPoolsRequest { @@ -1538,6 +1597,15 @@ function createBaseQueryNumPoolsRequest(): QueryNumPoolsRequest { export const QueryNumPoolsRequest = { typeUrl: "/osmosis.gamm.v1beta1.QueryNumPoolsRequest", aminoType: "osmosis/gamm/query-num-pools-request", + is(o: any): o is QueryNumPoolsRequest { + return o && o.$typeUrl === QueryNumPoolsRequest.typeUrl; + }, + isSDK(o: any): o is QueryNumPoolsRequestSDKType { + return o && o.$typeUrl === QueryNumPoolsRequest.typeUrl; + }, + isAmino(o: any): o is QueryNumPoolsRequestAmino { + return o && o.$typeUrl === QueryNumPoolsRequest.typeUrl; + }, encode(_: QueryNumPoolsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -1602,7 +1670,8 @@ export const QueryNumPoolsRequest = { typeUrl: "/osmosis.gamm.v1beta1.QueryNumPoolsRequest", value: QueryNumPoolsRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryNumPoolsResponse(): QueryNumPoolsResponse { return { @@ -1617,6 +1686,15 @@ function createBaseQueryNumPoolsResponse(): QueryNumPoolsResponse { export const QueryNumPoolsResponse = { typeUrl: "/osmosis.gamm.v1beta1.QueryNumPoolsResponse", aminoType: "osmosis/gamm/query-num-pools-response", + is(o: any): o is QueryNumPoolsResponse { + return o && (o.$typeUrl === QueryNumPoolsResponse.typeUrl || typeof o.numPools === "bigint"); + }, + isSDK(o: any): o is QueryNumPoolsResponseSDKType { + return o && (o.$typeUrl === QueryNumPoolsResponse.typeUrl || typeof o.num_pools === "bigint"); + }, + isAmino(o: any): o is QueryNumPoolsResponseAmino { + return o && (o.$typeUrl === QueryNumPoolsResponse.typeUrl || typeof o.num_pools === "bigint"); + }, encode(message: QueryNumPoolsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.numPools !== BigInt(0)) { writer.uint32(8).uint64(message.numPools); @@ -1699,7 +1777,8 @@ export const QueryNumPoolsResponse = { typeUrl: "/osmosis.gamm.v1beta1.QueryNumPoolsResponse", value: QueryNumPoolsResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryPoolTypeRequest(): QueryPoolTypeRequest { return { @@ -1715,6 +1794,15 @@ function createBaseQueryPoolTypeRequest(): QueryPoolTypeRequest { export const QueryPoolTypeRequest = { typeUrl: "/osmosis.gamm.v1beta1.QueryPoolTypeRequest", aminoType: "osmosis/gamm/query-pool-type-request", + is(o: any): o is QueryPoolTypeRequest { + return o && (o.$typeUrl === QueryPoolTypeRequest.typeUrl || typeof o.poolId === "bigint"); + }, + isSDK(o: any): o is QueryPoolTypeRequestSDKType { + return o && (o.$typeUrl === QueryPoolTypeRequest.typeUrl || typeof o.pool_id === "bigint"); + }, + isAmino(o: any): o is QueryPoolTypeRequestAmino { + return o && (o.$typeUrl === QueryPoolTypeRequest.typeUrl || typeof o.pool_id === "bigint"); + }, encode(message: QueryPoolTypeRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.poolId !== BigInt(0)) { writer.uint32(8).uint64(message.poolId); @@ -1797,7 +1885,8 @@ export const QueryPoolTypeRequest = { typeUrl: "/osmosis.gamm.v1beta1.QueryPoolTypeRequest", value: QueryPoolTypeRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryPoolTypeResponse(): QueryPoolTypeResponse { return { @@ -1812,6 +1901,15 @@ function createBaseQueryPoolTypeResponse(): QueryPoolTypeResponse { export const QueryPoolTypeResponse = { typeUrl: "/osmosis.gamm.v1beta1.QueryPoolTypeResponse", aminoType: "osmosis/gamm/query-pool-type-response", + is(o: any): o is QueryPoolTypeResponse { + return o && (o.$typeUrl === QueryPoolTypeResponse.typeUrl || typeof o.poolType === "string"); + }, + isSDK(o: any): o is QueryPoolTypeResponseSDKType { + return o && (o.$typeUrl === QueryPoolTypeResponse.typeUrl || typeof o.pool_type === "string"); + }, + isAmino(o: any): o is QueryPoolTypeResponseAmino { + return o && (o.$typeUrl === QueryPoolTypeResponse.typeUrl || typeof o.pool_type === "string"); + }, encode(message: QueryPoolTypeResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.poolType !== "") { writer.uint32(10).string(message.poolType); @@ -1892,7 +1990,8 @@ export const QueryPoolTypeResponse = { typeUrl: "/osmosis.gamm.v1beta1.QueryPoolTypeResponse", value: QueryPoolTypeResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryCalcJoinPoolSharesRequest(): QueryCalcJoinPoolSharesRequest { return { @@ -1909,6 +2008,15 @@ function createBaseQueryCalcJoinPoolSharesRequest(): QueryCalcJoinPoolSharesRequ export const QueryCalcJoinPoolSharesRequest = { typeUrl: "/osmosis.gamm.v1beta1.QueryCalcJoinPoolSharesRequest", aminoType: "osmosis/gamm/query-calc-join-pool-shares-request", + is(o: any): o is QueryCalcJoinPoolSharesRequest { + return o && (o.$typeUrl === QueryCalcJoinPoolSharesRequest.typeUrl || typeof o.poolId === "bigint" && Array.isArray(o.tokensIn) && (!o.tokensIn.length || Coin.is(o.tokensIn[0]))); + }, + isSDK(o: any): o is QueryCalcJoinPoolSharesRequestSDKType { + return o && (o.$typeUrl === QueryCalcJoinPoolSharesRequest.typeUrl || typeof o.pool_id === "bigint" && Array.isArray(o.tokens_in) && (!o.tokens_in.length || Coin.isSDK(o.tokens_in[0]))); + }, + isAmino(o: any): o is QueryCalcJoinPoolSharesRequestAmino { + return o && (o.$typeUrl === QueryCalcJoinPoolSharesRequest.typeUrl || typeof o.pool_id === "bigint" && Array.isArray(o.tokens_in) && (!o.tokens_in.length || Coin.isAmino(o.tokens_in[0]))); + }, encode(message: QueryCalcJoinPoolSharesRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.poolId !== BigInt(0)) { writer.uint32(8).uint64(message.poolId); @@ -2016,6 +2124,12 @@ export const QueryCalcJoinPoolSharesRequest = { typeUrl: "/osmosis.gamm.v1beta1.QueryCalcJoinPoolSharesRequest", value: QueryCalcJoinPoolSharesRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryCalcJoinPoolSharesRequest.typeUrl)) { + return; + } + Coin.registerTypeUrl(); } }; function createBaseQueryCalcJoinPoolSharesResponse(): QueryCalcJoinPoolSharesResponse { @@ -2032,6 +2146,15 @@ function createBaseQueryCalcJoinPoolSharesResponse(): QueryCalcJoinPoolSharesRes export const QueryCalcJoinPoolSharesResponse = { typeUrl: "/osmosis.gamm.v1beta1.QueryCalcJoinPoolSharesResponse", aminoType: "osmosis/gamm/query-calc-join-pool-shares-response", + is(o: any): o is QueryCalcJoinPoolSharesResponse { + return o && (o.$typeUrl === QueryCalcJoinPoolSharesResponse.typeUrl || typeof o.shareOutAmount === "string" && Array.isArray(o.tokensOut) && (!o.tokensOut.length || Coin.is(o.tokensOut[0]))); + }, + isSDK(o: any): o is QueryCalcJoinPoolSharesResponseSDKType { + return o && (o.$typeUrl === QueryCalcJoinPoolSharesResponse.typeUrl || typeof o.share_out_amount === "string" && Array.isArray(o.tokens_out) && (!o.tokens_out.length || Coin.isSDK(o.tokens_out[0]))); + }, + isAmino(o: any): o is QueryCalcJoinPoolSharesResponseAmino { + return o && (o.$typeUrl === QueryCalcJoinPoolSharesResponse.typeUrl || typeof o.share_out_amount === "string" && Array.isArray(o.tokens_out) && (!o.tokens_out.length || Coin.isAmino(o.tokens_out[0]))); + }, encode(message: QueryCalcJoinPoolSharesResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.shareOutAmount !== "") { writer.uint32(10).string(message.shareOutAmount); @@ -2137,6 +2260,12 @@ export const QueryCalcJoinPoolSharesResponse = { typeUrl: "/osmosis.gamm.v1beta1.QueryCalcJoinPoolSharesResponse", value: QueryCalcJoinPoolSharesResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryCalcJoinPoolSharesResponse.typeUrl)) { + return; + } + Coin.registerTypeUrl(); } }; function createBaseQueryCalcExitPoolCoinsFromSharesRequest(): QueryCalcExitPoolCoinsFromSharesRequest { @@ -2154,6 +2283,15 @@ function createBaseQueryCalcExitPoolCoinsFromSharesRequest(): QueryCalcExitPoolC export const QueryCalcExitPoolCoinsFromSharesRequest = { typeUrl: "/osmosis.gamm.v1beta1.QueryCalcExitPoolCoinsFromSharesRequest", aminoType: "osmosis/gamm/query-calc-exit-pool-coins-from-shares-request", + is(o: any): o is QueryCalcExitPoolCoinsFromSharesRequest { + return o && (o.$typeUrl === QueryCalcExitPoolCoinsFromSharesRequest.typeUrl || typeof o.poolId === "bigint" && typeof o.shareInAmount === "string"); + }, + isSDK(o: any): o is QueryCalcExitPoolCoinsFromSharesRequestSDKType { + return o && (o.$typeUrl === QueryCalcExitPoolCoinsFromSharesRequest.typeUrl || typeof o.pool_id === "bigint" && typeof o.share_in_amount === "string"); + }, + isAmino(o: any): o is QueryCalcExitPoolCoinsFromSharesRequestAmino { + return o && (o.$typeUrl === QueryCalcExitPoolCoinsFromSharesRequest.typeUrl || typeof o.pool_id === "bigint" && typeof o.share_in_amount === "string"); + }, encode(message: QueryCalcExitPoolCoinsFromSharesRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.poolId !== BigInt(0)) { writer.uint32(8).uint64(message.poolId); @@ -2251,7 +2389,8 @@ export const QueryCalcExitPoolCoinsFromSharesRequest = { typeUrl: "/osmosis.gamm.v1beta1.QueryCalcExitPoolCoinsFromSharesRequest", value: QueryCalcExitPoolCoinsFromSharesRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryCalcExitPoolCoinsFromSharesResponse(): QueryCalcExitPoolCoinsFromSharesResponse { return { @@ -2266,6 +2405,15 @@ function createBaseQueryCalcExitPoolCoinsFromSharesResponse(): QueryCalcExitPool export const QueryCalcExitPoolCoinsFromSharesResponse = { typeUrl: "/osmosis.gamm.v1beta1.QueryCalcExitPoolCoinsFromSharesResponse", aminoType: "osmosis/gamm/query-calc-exit-pool-coins-from-shares-response", + is(o: any): o is QueryCalcExitPoolCoinsFromSharesResponse { + return o && (o.$typeUrl === QueryCalcExitPoolCoinsFromSharesResponse.typeUrl || Array.isArray(o.tokensOut) && (!o.tokensOut.length || Coin.is(o.tokensOut[0]))); + }, + isSDK(o: any): o is QueryCalcExitPoolCoinsFromSharesResponseSDKType { + return o && (o.$typeUrl === QueryCalcExitPoolCoinsFromSharesResponse.typeUrl || Array.isArray(o.tokens_out) && (!o.tokens_out.length || Coin.isSDK(o.tokens_out[0]))); + }, + isAmino(o: any): o is QueryCalcExitPoolCoinsFromSharesResponseAmino { + return o && (o.$typeUrl === QueryCalcExitPoolCoinsFromSharesResponse.typeUrl || Array.isArray(o.tokens_out) && (!o.tokens_out.length || Coin.isAmino(o.tokens_out[0]))); + }, encode(message: QueryCalcExitPoolCoinsFromSharesResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.tokensOut) { Coin.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -2356,6 +2504,12 @@ export const QueryCalcExitPoolCoinsFromSharesResponse = { typeUrl: "/osmosis.gamm.v1beta1.QueryCalcExitPoolCoinsFromSharesResponse", value: QueryCalcExitPoolCoinsFromSharesResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryCalcExitPoolCoinsFromSharesResponse.typeUrl)) { + return; + } + Coin.registerTypeUrl(); } }; function createBaseQueryPoolParamsRequest(): QueryPoolParamsRequest { @@ -2372,6 +2526,15 @@ function createBaseQueryPoolParamsRequest(): QueryPoolParamsRequest { export const QueryPoolParamsRequest = { typeUrl: "/osmosis.gamm.v1beta1.QueryPoolParamsRequest", aminoType: "osmosis/gamm/query-pool-params-request", + is(o: any): o is QueryPoolParamsRequest { + return o && (o.$typeUrl === QueryPoolParamsRequest.typeUrl || typeof o.poolId === "bigint"); + }, + isSDK(o: any): o is QueryPoolParamsRequestSDKType { + return o && (o.$typeUrl === QueryPoolParamsRequest.typeUrl || typeof o.pool_id === "bigint"); + }, + isAmino(o: any): o is QueryPoolParamsRequestAmino { + return o && (o.$typeUrl === QueryPoolParamsRequest.typeUrl || typeof o.pool_id === "bigint"); + }, encode(message: QueryPoolParamsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.poolId !== BigInt(0)) { writer.uint32(8).uint64(message.poolId); @@ -2454,7 +2617,8 @@ export const QueryPoolParamsRequest = { typeUrl: "/osmosis.gamm.v1beta1.QueryPoolParamsRequest", value: QueryPoolParamsRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryPoolParamsResponse(): QueryPoolParamsResponse { return { @@ -2469,6 +2633,15 @@ function createBaseQueryPoolParamsResponse(): QueryPoolParamsResponse { export const QueryPoolParamsResponse = { typeUrl: "/osmosis.gamm.v1beta1.QueryPoolParamsResponse", aminoType: "osmosis/gamm/query-pool-params-response", + is(o: any): o is QueryPoolParamsResponse { + return o && o.$typeUrl === QueryPoolParamsResponse.typeUrl; + }, + isSDK(o: any): o is QueryPoolParamsResponseSDKType { + return o && o.$typeUrl === QueryPoolParamsResponse.typeUrl; + }, + isAmino(o: any): o is QueryPoolParamsResponseAmino { + return o && o.$typeUrl === QueryPoolParamsResponse.typeUrl; + }, encode(message: QueryPoolParamsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.params !== undefined) { Any.encode(message.params, writer.uint32(10).fork()).ldelim(); @@ -2551,7 +2724,8 @@ export const QueryPoolParamsResponse = { typeUrl: "/osmosis.gamm.v1beta1.QueryPoolParamsResponse", value: QueryPoolParamsResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryTotalPoolLiquidityRequest(): QueryTotalPoolLiquidityRequest { return { @@ -2567,6 +2741,15 @@ function createBaseQueryTotalPoolLiquidityRequest(): QueryTotalPoolLiquidityRequ export const QueryTotalPoolLiquidityRequest = { typeUrl: "/osmosis.gamm.v1beta1.QueryTotalPoolLiquidityRequest", aminoType: "osmosis/gamm/query-total-pool-liquidity-request", + is(o: any): o is QueryTotalPoolLiquidityRequest { + return o && (o.$typeUrl === QueryTotalPoolLiquidityRequest.typeUrl || typeof o.poolId === "bigint"); + }, + isSDK(o: any): o is QueryTotalPoolLiquidityRequestSDKType { + return o && (o.$typeUrl === QueryTotalPoolLiquidityRequest.typeUrl || typeof o.pool_id === "bigint"); + }, + isAmino(o: any): o is QueryTotalPoolLiquidityRequestAmino { + return o && (o.$typeUrl === QueryTotalPoolLiquidityRequest.typeUrl || typeof o.pool_id === "bigint"); + }, encode(message: QueryTotalPoolLiquidityRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.poolId !== BigInt(0)) { writer.uint32(8).uint64(message.poolId); @@ -2649,7 +2832,8 @@ export const QueryTotalPoolLiquidityRequest = { typeUrl: "/osmosis.gamm.v1beta1.QueryTotalPoolLiquidityRequest", value: QueryTotalPoolLiquidityRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryTotalPoolLiquidityResponse(): QueryTotalPoolLiquidityResponse { return { @@ -2664,6 +2848,15 @@ function createBaseQueryTotalPoolLiquidityResponse(): QueryTotalPoolLiquidityRes export const QueryTotalPoolLiquidityResponse = { typeUrl: "/osmosis.gamm.v1beta1.QueryTotalPoolLiquidityResponse", aminoType: "osmosis/gamm/query-total-pool-liquidity-response", + is(o: any): o is QueryTotalPoolLiquidityResponse { + return o && (o.$typeUrl === QueryTotalPoolLiquidityResponse.typeUrl || Array.isArray(o.liquidity) && (!o.liquidity.length || Coin.is(o.liquidity[0]))); + }, + isSDK(o: any): o is QueryTotalPoolLiquidityResponseSDKType { + return o && (o.$typeUrl === QueryTotalPoolLiquidityResponse.typeUrl || Array.isArray(o.liquidity) && (!o.liquidity.length || Coin.isSDK(o.liquidity[0]))); + }, + isAmino(o: any): o is QueryTotalPoolLiquidityResponseAmino { + return o && (o.$typeUrl === QueryTotalPoolLiquidityResponse.typeUrl || Array.isArray(o.liquidity) && (!o.liquidity.length || Coin.isAmino(o.liquidity[0]))); + }, encode(message: QueryTotalPoolLiquidityResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.liquidity) { Coin.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -2754,6 +2947,12 @@ export const QueryTotalPoolLiquidityResponse = { typeUrl: "/osmosis.gamm.v1beta1.QueryTotalPoolLiquidityResponse", value: QueryTotalPoolLiquidityResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryTotalPoolLiquidityResponse.typeUrl)) { + return; + } + Coin.registerTypeUrl(); } }; function createBaseQueryTotalSharesRequest(): QueryTotalSharesRequest { @@ -2770,6 +2969,15 @@ function createBaseQueryTotalSharesRequest(): QueryTotalSharesRequest { export const QueryTotalSharesRequest = { typeUrl: "/osmosis.gamm.v1beta1.QueryTotalSharesRequest", aminoType: "osmosis/gamm/query-total-shares-request", + is(o: any): o is QueryTotalSharesRequest { + return o && (o.$typeUrl === QueryTotalSharesRequest.typeUrl || typeof o.poolId === "bigint"); + }, + isSDK(o: any): o is QueryTotalSharesRequestSDKType { + return o && (o.$typeUrl === QueryTotalSharesRequest.typeUrl || typeof o.pool_id === "bigint"); + }, + isAmino(o: any): o is QueryTotalSharesRequestAmino { + return o && (o.$typeUrl === QueryTotalSharesRequest.typeUrl || typeof o.pool_id === "bigint"); + }, encode(message: QueryTotalSharesRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.poolId !== BigInt(0)) { writer.uint32(8).uint64(message.poolId); @@ -2852,7 +3060,8 @@ export const QueryTotalSharesRequest = { typeUrl: "/osmosis.gamm.v1beta1.QueryTotalSharesRequest", value: QueryTotalSharesRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryTotalSharesResponse(): QueryTotalSharesResponse { return { @@ -2867,6 +3076,15 @@ function createBaseQueryTotalSharesResponse(): QueryTotalSharesResponse { export const QueryTotalSharesResponse = { typeUrl: "/osmosis.gamm.v1beta1.QueryTotalSharesResponse", aminoType: "osmosis/gamm/query-total-shares-response", + is(o: any): o is QueryTotalSharesResponse { + return o && (o.$typeUrl === QueryTotalSharesResponse.typeUrl || Coin.is(o.totalShares)); + }, + isSDK(o: any): o is QueryTotalSharesResponseSDKType { + return o && (o.$typeUrl === QueryTotalSharesResponse.typeUrl || Coin.isSDK(o.total_shares)); + }, + isAmino(o: any): o is QueryTotalSharesResponseAmino { + return o && (o.$typeUrl === QueryTotalSharesResponse.typeUrl || Coin.isAmino(o.total_shares)); + }, encode(message: QueryTotalSharesResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.totalShares !== undefined) { Coin.encode(message.totalShares, writer.uint32(10).fork()).ldelim(); @@ -2949,6 +3167,12 @@ export const QueryTotalSharesResponse = { typeUrl: "/osmosis.gamm.v1beta1.QueryTotalSharesResponse", value: QueryTotalSharesResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryTotalSharesResponse.typeUrl)) { + return; + } + Coin.registerTypeUrl(); } }; function createBaseQueryCalcJoinPoolNoSwapSharesRequest(): QueryCalcJoinPoolNoSwapSharesRequest { @@ -2966,6 +3190,15 @@ function createBaseQueryCalcJoinPoolNoSwapSharesRequest(): QueryCalcJoinPoolNoSw export const QueryCalcJoinPoolNoSwapSharesRequest = { typeUrl: "/osmosis.gamm.v1beta1.QueryCalcJoinPoolNoSwapSharesRequest", aminoType: "osmosis/gamm/query-calc-join-pool-no-swap-shares-request", + is(o: any): o is QueryCalcJoinPoolNoSwapSharesRequest { + return o && (o.$typeUrl === QueryCalcJoinPoolNoSwapSharesRequest.typeUrl || typeof o.poolId === "bigint" && Array.isArray(o.tokensIn) && (!o.tokensIn.length || Coin.is(o.tokensIn[0]))); + }, + isSDK(o: any): o is QueryCalcJoinPoolNoSwapSharesRequestSDKType { + return o && (o.$typeUrl === QueryCalcJoinPoolNoSwapSharesRequest.typeUrl || typeof o.pool_id === "bigint" && Array.isArray(o.tokens_in) && (!o.tokens_in.length || Coin.isSDK(o.tokens_in[0]))); + }, + isAmino(o: any): o is QueryCalcJoinPoolNoSwapSharesRequestAmino { + return o && (o.$typeUrl === QueryCalcJoinPoolNoSwapSharesRequest.typeUrl || typeof o.pool_id === "bigint" && Array.isArray(o.tokens_in) && (!o.tokens_in.length || Coin.isAmino(o.tokens_in[0]))); + }, encode(message: QueryCalcJoinPoolNoSwapSharesRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.poolId !== BigInt(0)) { writer.uint32(8).uint64(message.poolId); @@ -3073,6 +3306,12 @@ export const QueryCalcJoinPoolNoSwapSharesRequest = { typeUrl: "/osmosis.gamm.v1beta1.QueryCalcJoinPoolNoSwapSharesRequest", value: QueryCalcJoinPoolNoSwapSharesRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryCalcJoinPoolNoSwapSharesRequest.typeUrl)) { + return; + } + Coin.registerTypeUrl(); } }; function createBaseQueryCalcJoinPoolNoSwapSharesResponse(): QueryCalcJoinPoolNoSwapSharesResponse { @@ -3089,6 +3328,15 @@ function createBaseQueryCalcJoinPoolNoSwapSharesResponse(): QueryCalcJoinPoolNoS export const QueryCalcJoinPoolNoSwapSharesResponse = { typeUrl: "/osmosis.gamm.v1beta1.QueryCalcJoinPoolNoSwapSharesResponse", aminoType: "osmosis/gamm/query-calc-join-pool-no-swap-shares-response", + is(o: any): o is QueryCalcJoinPoolNoSwapSharesResponse { + return o && (o.$typeUrl === QueryCalcJoinPoolNoSwapSharesResponse.typeUrl || Array.isArray(o.tokensOut) && (!o.tokensOut.length || Coin.is(o.tokensOut[0])) && typeof o.sharesOut === "string"); + }, + isSDK(o: any): o is QueryCalcJoinPoolNoSwapSharesResponseSDKType { + return o && (o.$typeUrl === QueryCalcJoinPoolNoSwapSharesResponse.typeUrl || Array.isArray(o.tokens_out) && (!o.tokens_out.length || Coin.isSDK(o.tokens_out[0])) && typeof o.shares_out === "string"); + }, + isAmino(o: any): o is QueryCalcJoinPoolNoSwapSharesResponseAmino { + return o && (o.$typeUrl === QueryCalcJoinPoolNoSwapSharesResponse.typeUrl || Array.isArray(o.tokens_out) && (!o.tokens_out.length || Coin.isAmino(o.tokens_out[0])) && typeof o.shares_out === "string"); + }, encode(message: QueryCalcJoinPoolNoSwapSharesResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.tokensOut) { Coin.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -3194,6 +3442,12 @@ export const QueryCalcJoinPoolNoSwapSharesResponse = { typeUrl: "/osmosis.gamm.v1beta1.QueryCalcJoinPoolNoSwapSharesResponse", value: QueryCalcJoinPoolNoSwapSharesResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryCalcJoinPoolNoSwapSharesResponse.typeUrl)) { + return; + } + Coin.registerTypeUrl(); } }; function createBaseQuerySpotPriceRequest(): QuerySpotPriceRequest { @@ -3214,6 +3468,15 @@ function createBaseQuerySpotPriceRequest(): QuerySpotPriceRequest { export const QuerySpotPriceRequest = { typeUrl: "/osmosis.gamm.v1beta1.QuerySpotPriceRequest", aminoType: "osmosis/gamm/query-spot-price-request", + is(o: any): o is QuerySpotPriceRequest { + return o && (o.$typeUrl === QuerySpotPriceRequest.typeUrl || typeof o.poolId === "bigint" && typeof o.baseAssetDenom === "string" && typeof o.quoteAssetDenom === "string"); + }, + isSDK(o: any): o is QuerySpotPriceRequestSDKType { + return o && (o.$typeUrl === QuerySpotPriceRequest.typeUrl || typeof o.pool_id === "bigint" && typeof o.base_asset_denom === "string" && typeof o.quote_asset_denom === "string"); + }, + isAmino(o: any): o is QuerySpotPriceRequestAmino { + return o && (o.$typeUrl === QuerySpotPriceRequest.typeUrl || typeof o.pool_id === "bigint" && typeof o.base_asset_denom === "string" && typeof o.quote_asset_denom === "string"); + }, encode(message: QuerySpotPriceRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.poolId !== BigInt(0)) { writer.uint32(8).uint64(message.poolId); @@ -3326,7 +3589,8 @@ export const QuerySpotPriceRequest = { typeUrl: "/osmosis.gamm.v1beta1.QuerySpotPriceRequest", value: QuerySpotPriceRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryPoolsWithFilterRequest(): QueryPoolsWithFilterRequest { return { @@ -3343,6 +3607,15 @@ function createBaseQueryPoolsWithFilterRequest(): QueryPoolsWithFilterRequest { export const QueryPoolsWithFilterRequest = { typeUrl: "/osmosis.gamm.v1beta1.QueryPoolsWithFilterRequest", aminoType: "osmosis/gamm/query-pools-with-filter-request", + is(o: any): o is QueryPoolsWithFilterRequest { + return o && (o.$typeUrl === QueryPoolsWithFilterRequest.typeUrl || Array.isArray(o.minLiquidity) && (!o.minLiquidity.length || Coin.is(o.minLiquidity[0])) && typeof o.poolType === "string"); + }, + isSDK(o: any): o is QueryPoolsWithFilterRequestSDKType { + return o && (o.$typeUrl === QueryPoolsWithFilterRequest.typeUrl || Array.isArray(o.min_liquidity) && (!o.min_liquidity.length || Coin.isSDK(o.min_liquidity[0])) && typeof o.pool_type === "string"); + }, + isAmino(o: any): o is QueryPoolsWithFilterRequestAmino { + return o && (o.$typeUrl === QueryPoolsWithFilterRequest.typeUrl || Array.isArray(o.min_liquidity) && (!o.min_liquidity.length || Coin.isAmino(o.min_liquidity[0])) && typeof o.pool_type === "string"); + }, encode(message: QueryPoolsWithFilterRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.minLiquidity) { Coin.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -3465,6 +3738,13 @@ export const QueryPoolsWithFilterRequest = { typeUrl: "/osmosis.gamm.v1beta1.QueryPoolsWithFilterRequest", value: QueryPoolsWithFilterRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryPoolsWithFilterRequest.typeUrl)) { + return; + } + Coin.registerTypeUrl(); + PageRequest.registerTypeUrl(); } }; function createBaseQueryPoolsWithFilterResponse(): QueryPoolsWithFilterResponse { @@ -3481,9 +3761,18 @@ function createBaseQueryPoolsWithFilterResponse(): QueryPoolsWithFilterResponse export const QueryPoolsWithFilterResponse = { typeUrl: "/osmosis.gamm.v1beta1.QueryPoolsWithFilterResponse", aminoType: "osmosis/gamm/query-pools-with-filter-response", + is(o: any): o is QueryPoolsWithFilterResponse { + return o && (o.$typeUrl === QueryPoolsWithFilterResponse.typeUrl || Array.isArray(o.pools) && (!o.pools.length || Pool1.is(o.pools[0]) || Pool2.is(o.pools[0]) || Any.is(o.pools[0]))); + }, + isSDK(o: any): o is QueryPoolsWithFilterResponseSDKType { + return o && (o.$typeUrl === QueryPoolsWithFilterResponse.typeUrl || Array.isArray(o.pools) && (!o.pools.length || Pool1.isSDK(o.pools[0]) || Pool2.isSDK(o.pools[0]) || Any.isSDK(o.pools[0]))); + }, + isAmino(o: any): o is QueryPoolsWithFilterResponseAmino { + return o && (o.$typeUrl === QueryPoolsWithFilterResponse.typeUrl || Array.isArray(o.pools) && (!o.pools.length || Pool1.isAmino(o.pools[0]) || Pool2.isAmino(o.pools[0]) || Any.isAmino(o.pools[0]))); + }, encode(message: QueryPoolsWithFilterResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.pools) { - Any.encode((v! as Any), writer.uint32(10).fork()).ldelim(); + Any.encode(GlobalDecoderRegistry.wrapAny(v!), writer.uint32(10).fork()).ldelim(); } if (message.pagination !== undefined) { PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); @@ -3498,7 +3787,7 @@ export const QueryPoolsWithFilterResponse = { const tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.pools.push((Any.decode(reader, reader.uint32()) as Any)); + message.pools.push(GlobalDecoderRegistry.unwrapAny(reader)); break; case 2: message.pagination = PageResponse.decode(reader, reader.uint32()); @@ -3512,14 +3801,14 @@ export const QueryPoolsWithFilterResponse = { }, fromJSON(object: any): QueryPoolsWithFilterResponse { const obj = createBaseQueryPoolsWithFilterResponse(); - if (Array.isArray(object?.pools)) obj.pools = object.pools.map((e: any) => Any.fromJSON(e)); + if (Array.isArray(object?.pools)) obj.pools = object.pools.map((e: any) => GlobalDecoderRegistry.fromJSON(e)); if (isSet(object.pagination)) obj.pagination = PageResponse.fromJSON(object.pagination); return obj; }, toJSON(message: QueryPoolsWithFilterResponse): JsonSafe { const obj: any = {}; if (message.pools) { - obj.pools = message.pools.map(e => e ? Any.toJSON(e) : undefined); + obj.pools = message.pools.map(e => e ? GlobalDecoderRegistry.toJSON(e) : undefined); } else { obj.pools = []; } @@ -3528,7 +3817,7 @@ export const QueryPoolsWithFilterResponse = { }, fromPartial(object: DeepPartial): QueryPoolsWithFilterResponse { const message = createBaseQueryPoolsWithFilterResponse(); - message.pools = object.pools?.map(e => Any.fromPartial(e)) || []; + message.pools = object.pools?.map(e => (GlobalDecoderRegistry.fromPartial(e) as any)) || []; if (object.pagination !== undefined && object.pagination !== null) { message.pagination = PageResponse.fromPartial(object.pagination); } @@ -3536,14 +3825,14 @@ export const QueryPoolsWithFilterResponse = { }, fromSDK(object: QueryPoolsWithFilterResponseSDKType): QueryPoolsWithFilterResponse { return { - pools: Array.isArray(object?.pools) ? object.pools.map((e: any) => Any.fromSDK(e)) : [], + pools: Array.isArray(object?.pools) ? object.pools.map((e: any) => GlobalDecoderRegistry.fromSDK(e)) : [], pagination: object.pagination ? PageResponse.fromSDK(object.pagination) : undefined }; }, toSDK(message: QueryPoolsWithFilterResponse): QueryPoolsWithFilterResponseSDKType { const obj: any = {}; if (message.pools) { - obj.pools = message.pools.map(e => e ? Any.toSDK(e) : undefined); + obj.pools = message.pools.map(e => e ? GlobalDecoderRegistry.toSDK(e) : undefined); } else { obj.pools = []; } @@ -3552,7 +3841,7 @@ export const QueryPoolsWithFilterResponse = { }, fromAmino(object: QueryPoolsWithFilterResponseAmino): QueryPoolsWithFilterResponse { const message = createBaseQueryPoolsWithFilterResponse(); - message.pools = object.pools?.map(e => PoolI_FromAmino(e)) || []; + message.pools = object.pools?.map(e => GlobalDecoderRegistry.fromAminoMsg(e)) || []; if (object.pagination !== undefined && object.pagination !== null) { message.pagination = PageResponse.fromAmino(object.pagination); } @@ -3561,7 +3850,7 @@ export const QueryPoolsWithFilterResponse = { toAmino(message: QueryPoolsWithFilterResponse): QueryPoolsWithFilterResponseAmino { const obj: any = {}; if (message.pools) { - obj.pools = message.pools.map(e => e ? PoolI_ToAmino((e as Any)) : undefined); + obj.pools = message.pools.map(e => e ? GlobalDecoderRegistry.toAminoMsg(e) : undefined); } else { obj.pools = message.pools; } @@ -3588,6 +3877,14 @@ export const QueryPoolsWithFilterResponse = { typeUrl: "/osmosis.gamm.v1beta1.QueryPoolsWithFilterResponse", value: QueryPoolsWithFilterResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryPoolsWithFilterResponse.typeUrl)) { + return; + } + Pool1.registerTypeUrl(); + Pool2.registerTypeUrl(); + PageResponse.registerTypeUrl(); } }; function createBaseQuerySpotPriceResponse(): QuerySpotPriceResponse { @@ -3606,6 +3903,15 @@ function createBaseQuerySpotPriceResponse(): QuerySpotPriceResponse { export const QuerySpotPriceResponse = { typeUrl: "/osmosis.gamm.v1beta1.QuerySpotPriceResponse", aminoType: "osmosis/gamm/query-spot-price-response", + is(o: any): o is QuerySpotPriceResponse { + return o && (o.$typeUrl === QuerySpotPriceResponse.typeUrl || typeof o.spotPrice === "string"); + }, + isSDK(o: any): o is QuerySpotPriceResponseSDKType { + return o && (o.$typeUrl === QuerySpotPriceResponse.typeUrl || typeof o.spot_price === "string"); + }, + isAmino(o: any): o is QuerySpotPriceResponseAmino { + return o && (o.$typeUrl === QuerySpotPriceResponse.typeUrl || typeof o.spot_price === "string"); + }, encode(message: QuerySpotPriceResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.spotPrice !== "") { writer.uint32(10).string(message.spotPrice); @@ -3686,7 +3992,8 @@ export const QuerySpotPriceResponse = { typeUrl: "/osmosis.gamm.v1beta1.QuerySpotPriceResponse", value: QuerySpotPriceResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQuerySwapExactAmountInRequest(): QuerySwapExactAmountInRequest { return { @@ -3705,6 +4012,15 @@ function createBaseQuerySwapExactAmountInRequest(): QuerySwapExactAmountInReques export const QuerySwapExactAmountInRequest = { typeUrl: "/osmosis.gamm.v1beta1.QuerySwapExactAmountInRequest", aminoType: "osmosis/gamm/query-swap-exact-amount-in-request", + is(o: any): o is QuerySwapExactAmountInRequest { + return o && (o.$typeUrl === QuerySwapExactAmountInRequest.typeUrl || typeof o.sender === "string" && typeof o.poolId === "bigint" && typeof o.tokenIn === "string" && Array.isArray(o.routes) && (!o.routes.length || SwapAmountInRoute.is(o.routes[0]))); + }, + isSDK(o: any): o is QuerySwapExactAmountInRequestSDKType { + return o && (o.$typeUrl === QuerySwapExactAmountInRequest.typeUrl || typeof o.sender === "string" && typeof o.pool_id === "bigint" && typeof o.token_in === "string" && Array.isArray(o.routes) && (!o.routes.length || SwapAmountInRoute.isSDK(o.routes[0]))); + }, + isAmino(o: any): o is QuerySwapExactAmountInRequestAmino { + return o && (o.$typeUrl === QuerySwapExactAmountInRequest.typeUrl || typeof o.sender === "string" && typeof o.pool_id === "bigint" && typeof o.token_in === "string" && Array.isArray(o.routes) && (!o.routes.length || SwapAmountInRoute.isAmino(o.routes[0]))); + }, encode(message: QuerySwapExactAmountInRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.sender !== "") { writer.uint32(10).string(message.sender); @@ -3842,6 +4158,12 @@ export const QuerySwapExactAmountInRequest = { typeUrl: "/osmosis.gamm.v1beta1.QuerySwapExactAmountInRequest", value: QuerySwapExactAmountInRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QuerySwapExactAmountInRequest.typeUrl)) { + return; + } + SwapAmountInRoute.registerTypeUrl(); } }; function createBaseQuerySwapExactAmountInResponse(): QuerySwapExactAmountInResponse { @@ -3857,6 +4179,15 @@ function createBaseQuerySwapExactAmountInResponse(): QuerySwapExactAmountInRespo export const QuerySwapExactAmountInResponse = { typeUrl: "/osmosis.gamm.v1beta1.QuerySwapExactAmountInResponse", aminoType: "osmosis/gamm/query-swap-exact-amount-in-response", + is(o: any): o is QuerySwapExactAmountInResponse { + return o && (o.$typeUrl === QuerySwapExactAmountInResponse.typeUrl || typeof o.tokenOutAmount === "string"); + }, + isSDK(o: any): o is QuerySwapExactAmountInResponseSDKType { + return o && (o.$typeUrl === QuerySwapExactAmountInResponse.typeUrl || typeof o.token_out_amount === "string"); + }, + isAmino(o: any): o is QuerySwapExactAmountInResponseAmino { + return o && (o.$typeUrl === QuerySwapExactAmountInResponse.typeUrl || typeof o.token_out_amount === "string"); + }, encode(message: QuerySwapExactAmountInResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.tokenOutAmount !== "") { writer.uint32(10).string(message.tokenOutAmount); @@ -3937,7 +4268,8 @@ export const QuerySwapExactAmountInResponse = { typeUrl: "/osmosis.gamm.v1beta1.QuerySwapExactAmountInResponse", value: QuerySwapExactAmountInResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQuerySwapExactAmountOutRequest(): QuerySwapExactAmountOutRequest { return { @@ -3956,6 +4288,15 @@ function createBaseQuerySwapExactAmountOutRequest(): QuerySwapExactAmountOutRequ export const QuerySwapExactAmountOutRequest = { typeUrl: "/osmosis.gamm.v1beta1.QuerySwapExactAmountOutRequest", aminoType: "osmosis/gamm/query-swap-exact-amount-out-request", + is(o: any): o is QuerySwapExactAmountOutRequest { + return o && (o.$typeUrl === QuerySwapExactAmountOutRequest.typeUrl || typeof o.sender === "string" && typeof o.poolId === "bigint" && Array.isArray(o.routes) && (!o.routes.length || SwapAmountOutRoute.is(o.routes[0])) && typeof o.tokenOut === "string"); + }, + isSDK(o: any): o is QuerySwapExactAmountOutRequestSDKType { + return o && (o.$typeUrl === QuerySwapExactAmountOutRequest.typeUrl || typeof o.sender === "string" && typeof o.pool_id === "bigint" && Array.isArray(o.routes) && (!o.routes.length || SwapAmountOutRoute.isSDK(o.routes[0])) && typeof o.token_out === "string"); + }, + isAmino(o: any): o is QuerySwapExactAmountOutRequestAmino { + return o && (o.$typeUrl === QuerySwapExactAmountOutRequest.typeUrl || typeof o.sender === "string" && typeof o.pool_id === "bigint" && Array.isArray(o.routes) && (!o.routes.length || SwapAmountOutRoute.isAmino(o.routes[0])) && typeof o.token_out === "string"); + }, encode(message: QuerySwapExactAmountOutRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.sender !== "") { writer.uint32(10).string(message.sender); @@ -4093,6 +4434,12 @@ export const QuerySwapExactAmountOutRequest = { typeUrl: "/osmosis.gamm.v1beta1.QuerySwapExactAmountOutRequest", value: QuerySwapExactAmountOutRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QuerySwapExactAmountOutRequest.typeUrl)) { + return; + } + SwapAmountOutRoute.registerTypeUrl(); } }; function createBaseQuerySwapExactAmountOutResponse(): QuerySwapExactAmountOutResponse { @@ -4108,6 +4455,15 @@ function createBaseQuerySwapExactAmountOutResponse(): QuerySwapExactAmountOutRes export const QuerySwapExactAmountOutResponse = { typeUrl: "/osmosis.gamm.v1beta1.QuerySwapExactAmountOutResponse", aminoType: "osmosis/gamm/query-swap-exact-amount-out-response", + is(o: any): o is QuerySwapExactAmountOutResponse { + return o && (o.$typeUrl === QuerySwapExactAmountOutResponse.typeUrl || typeof o.tokenInAmount === "string"); + }, + isSDK(o: any): o is QuerySwapExactAmountOutResponseSDKType { + return o && (o.$typeUrl === QuerySwapExactAmountOutResponse.typeUrl || typeof o.token_in_amount === "string"); + }, + isAmino(o: any): o is QuerySwapExactAmountOutResponseAmino { + return o && (o.$typeUrl === QuerySwapExactAmountOutResponse.typeUrl || typeof o.token_in_amount === "string"); + }, encode(message: QuerySwapExactAmountOutResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.tokenInAmount !== "") { writer.uint32(10).string(message.tokenInAmount); @@ -4188,7 +4544,8 @@ export const QuerySwapExactAmountOutResponse = { typeUrl: "/osmosis.gamm.v1beta1.QuerySwapExactAmountOutResponse", value: QuerySwapExactAmountOutResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryTotalLiquidityRequest(): QueryTotalLiquidityRequest { return {}; @@ -4201,6 +4558,15 @@ function createBaseQueryTotalLiquidityRequest(): QueryTotalLiquidityRequest { export const QueryTotalLiquidityRequest = { typeUrl: "/osmosis.gamm.v1beta1.QueryTotalLiquidityRequest", aminoType: "osmosis/gamm/query-total-liquidity-request", + is(o: any): o is QueryTotalLiquidityRequest { + return o && o.$typeUrl === QueryTotalLiquidityRequest.typeUrl; + }, + isSDK(o: any): o is QueryTotalLiquidityRequestSDKType { + return o && o.$typeUrl === QueryTotalLiquidityRequest.typeUrl; + }, + isAmino(o: any): o is QueryTotalLiquidityRequestAmino { + return o && o.$typeUrl === QueryTotalLiquidityRequest.typeUrl; + }, encode(_: QueryTotalLiquidityRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -4265,7 +4631,8 @@ export const QueryTotalLiquidityRequest = { typeUrl: "/osmosis.gamm.v1beta1.QueryTotalLiquidityRequest", value: QueryTotalLiquidityRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryTotalLiquidityResponse(): QueryTotalLiquidityResponse { return { @@ -4280,6 +4647,15 @@ function createBaseQueryTotalLiquidityResponse(): QueryTotalLiquidityResponse { export const QueryTotalLiquidityResponse = { typeUrl: "/osmosis.gamm.v1beta1.QueryTotalLiquidityResponse", aminoType: "osmosis/gamm/query-total-liquidity-response", + is(o: any): o is QueryTotalLiquidityResponse { + return o && (o.$typeUrl === QueryTotalLiquidityResponse.typeUrl || Array.isArray(o.liquidity) && (!o.liquidity.length || Coin.is(o.liquidity[0]))); + }, + isSDK(o: any): o is QueryTotalLiquidityResponseSDKType { + return o && (o.$typeUrl === QueryTotalLiquidityResponse.typeUrl || Array.isArray(o.liquidity) && (!o.liquidity.length || Coin.isSDK(o.liquidity[0]))); + }, + isAmino(o: any): o is QueryTotalLiquidityResponseAmino { + return o && (o.$typeUrl === QueryTotalLiquidityResponse.typeUrl || Array.isArray(o.liquidity) && (!o.liquidity.length || Coin.isAmino(o.liquidity[0]))); + }, encode(message: QueryTotalLiquidityResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.liquidity) { Coin.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -4370,49 +4746,11 @@ export const QueryTotalLiquidityResponse = { typeUrl: "/osmosis.gamm.v1beta1.QueryTotalLiquidityResponse", value: QueryTotalLiquidityResponse.encode(message).finish() }; - } -}; -export const PoolI_InterfaceDecoder = (input: BinaryReader | Uint8Array): Pool1 | Pool2 | Any => { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - const data = Any.decode(reader, reader.uint32()); - switch (data.typeUrl) { - case "/osmosis.gamm.v1beta1.Pool": - return Pool1.decode(data.value); - case "/osmosis.gamm.poolmodels.stableswap.v1beta1.Pool": - return Pool2.decode(data.value); - default: - return data; - } -}; -export const PoolI_FromAmino = (content: AnyAmino): Any => { - switch (content.type) { - case "osmosis/gamm/pool": - return Any.fromPartial({ - typeUrl: "/osmosis.gamm.v1beta1.Pool", - value: Pool1.encode(Pool1.fromPartial(Pool1.fromAmino(content.value))).finish() - }); - case "osmosis/gamm/pool": - return Any.fromPartial({ - typeUrl: "/osmosis.gamm.poolmodels.stableswap.v1beta1.Pool", - value: Pool2.encode(Pool2.fromPartial(Pool2.fromAmino(content.value))).finish() - }); - default: - return Any.fromAmino(content); - } -}; -export const PoolI_ToAmino = (content: Any) => { - switch (content.typeUrl) { - case "/osmosis.gamm.v1beta1.Pool": - return { - type: "osmosis/gamm/pool", - value: Pool1.toAmino(Pool1.decode(content.value, undefined)) - }; - case "/osmosis.gamm.poolmodels.stableswap.v1beta1.Pool": - return { - type: "osmosis/gamm/pool", - value: Pool2.toAmino(Pool2.decode(content.value, undefined)) - }; - default: - return Any.toAmino(content); + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryTotalLiquidityResponse.typeUrl)) { + return; + } + Coin.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/osmosis/gamm/v1beta1/tx.registry.ts b/__fixtures__/v-next/outputv2/osmosis/gamm/v1beta1/tx.registry.ts index 0121c51c19..3148a9540b 100644 --- a/__fixtures__/v-next/outputv2/osmosis/gamm/v1beta1/tx.registry.ts +++ b/__fixtures__/v-next/outputv2/osmosis/gamm/v1beta1/tx.registry.ts @@ -1,11 +1,6 @@ -import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { TelescopeGeneratedType } from "../../../types"; import { MsgJoinPool, MsgExitPool, MsgSwapExactAmountIn, MsgSwapExactAmountOut, MsgJoinSwapExternAmountIn, MsgJoinSwapShareAmountOut, MsgExitSwapExternAmountOut, MsgExitSwapShareAmountIn } from "./tx"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/osmosis.gamm.v1beta1.MsgJoinPool", MsgJoinPool], ["/osmosis.gamm.v1beta1.MsgExitPool", MsgExitPool], ["/osmosis.gamm.v1beta1.MsgSwapExactAmountIn", MsgSwapExactAmountIn], ["/osmosis.gamm.v1beta1.MsgSwapExactAmountOut", MsgSwapExactAmountOut], ["/osmosis.gamm.v1beta1.MsgJoinSwapExternAmountIn", MsgJoinSwapExternAmountIn], ["/osmosis.gamm.v1beta1.MsgJoinSwapShareAmountOut", MsgJoinSwapShareAmountOut], ["/osmosis.gamm.v1beta1.MsgExitSwapExternAmountOut", MsgExitSwapExternAmountOut], ["/osmosis.gamm.v1beta1.MsgExitSwapShareAmountIn", MsgExitSwapShareAmountIn]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/osmosis.gamm.v1beta1.MsgJoinPool", MsgJoinPool], ["/osmosis.gamm.v1beta1.MsgExitPool", MsgExitPool], ["/osmosis.gamm.v1beta1.MsgSwapExactAmountIn", MsgSwapExactAmountIn], ["/osmosis.gamm.v1beta1.MsgSwapExactAmountOut", MsgSwapExactAmountOut], ["/osmosis.gamm.v1beta1.MsgJoinSwapExternAmountIn", MsgJoinSwapExternAmountIn], ["/osmosis.gamm.v1beta1.MsgJoinSwapShareAmountOut", MsgJoinSwapShareAmountOut], ["/osmosis.gamm.v1beta1.MsgExitSwapExternAmountOut", MsgExitSwapExternAmountOut], ["/osmosis.gamm.v1beta1.MsgExitSwapShareAmountIn", MsgExitSwapShareAmountIn]]; export const MessageComposer = { encoded: { joinPool(value: MsgJoinPool) { diff --git a/__fixtures__/v-next/outputv2/osmosis/gamm/v1beta1/tx.rpc.func.ts b/__fixtures__/v-next/outputv2/osmosis/gamm/v1beta1/tx.rpc.func.ts new file mode 100644 index 0000000000..77f35d2cd4 --- /dev/null +++ b/__fixtures__/v-next/outputv2/osmosis/gamm/v1beta1/tx.rpc.func.ts @@ -0,0 +1,66 @@ +import { buildTx } from "../../../helper-func-types"; +import { MsgJoinPool, MsgExitPool, MsgSwapExactAmountIn, MsgSwapExactAmountOut, MsgJoinSwapExternAmountIn, MsgJoinSwapShareAmountOut, MsgExitSwapExternAmountOut, MsgExitSwapShareAmountIn } from "./tx"; +/** + * @name joinPool + * @package osmosis.gamm.v1beta1 + * @see proto service: osmosis.gamm.v1beta1.JoinPool + */ +export const joinPool = buildTx({ + msg: MsgJoinPool +}); +/** + * @name exitPool + * @package osmosis.gamm.v1beta1 + * @see proto service: osmosis.gamm.v1beta1.ExitPool + */ +export const exitPool = buildTx({ + msg: MsgExitPool +}); +/** + * @name swapExactAmountIn + * @package osmosis.gamm.v1beta1 + * @see proto service: osmosis.gamm.v1beta1.SwapExactAmountIn + */ +export const swapExactAmountIn = buildTx({ + msg: MsgSwapExactAmountIn +}); +/** + * @name swapExactAmountOut + * @package osmosis.gamm.v1beta1 + * @see proto service: osmosis.gamm.v1beta1.SwapExactAmountOut + */ +export const swapExactAmountOut = buildTx({ + msg: MsgSwapExactAmountOut +}); +/** + * @name joinSwapExternAmountIn + * @package osmosis.gamm.v1beta1 + * @see proto service: osmosis.gamm.v1beta1.JoinSwapExternAmountIn + */ +export const joinSwapExternAmountIn = buildTx({ + msg: MsgJoinSwapExternAmountIn +}); +/** + * @name joinSwapShareAmountOut + * @package osmosis.gamm.v1beta1 + * @see proto service: osmosis.gamm.v1beta1.JoinSwapShareAmountOut + */ +export const joinSwapShareAmountOut = buildTx({ + msg: MsgJoinSwapShareAmountOut +}); +/** + * @name exitSwapExternAmountOut + * @package osmosis.gamm.v1beta1 + * @see proto service: osmosis.gamm.v1beta1.ExitSwapExternAmountOut + */ +export const exitSwapExternAmountOut = buildTx({ + msg: MsgExitSwapExternAmountOut +}); +/** + * @name exitSwapShareAmountIn + * @package osmosis.gamm.v1beta1 + * @see proto service: osmosis.gamm.v1beta1.ExitSwapShareAmountIn + */ +export const exitSwapShareAmountIn = buildTx({ + msg: MsgExitSwapShareAmountIn +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/osmosis/gamm/v1beta1/tx.ts b/__fixtures__/v-next/outputv2/osmosis/gamm/v1beta1/tx.ts index 42afcb670b..014494b515 100644 --- a/__fixtures__/v-next/outputv2/osmosis/gamm/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputv2/osmosis/gamm/v1beta1/tx.ts @@ -2,6 +2,7 @@ import { Coin, CoinAmino, CoinSDKType } from "../../../cosmos/base/v1beta1/coin" import { BinaryReader, BinaryWriter } from "../../../binary"; import { isSet, DeepPartial } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "osmosis.gamm.v1beta1"; /** * ===================== MsgJoinPool @@ -714,6 +715,15 @@ function createBaseMsgJoinPool(): MsgJoinPool { export const MsgJoinPool = { typeUrl: "/osmosis.gamm.v1beta1.MsgJoinPool", aminoType: "osmosis/gamm/join-pool", + is(o: any): o is MsgJoinPool { + return o && (o.$typeUrl === MsgJoinPool.typeUrl || typeof o.sender === "string" && typeof o.poolId === "bigint" && typeof o.shareOutAmount === "string" && Array.isArray(o.tokenInMaxs) && (!o.tokenInMaxs.length || Coin.is(o.tokenInMaxs[0]))); + }, + isSDK(o: any): o is MsgJoinPoolSDKType { + return o && (o.$typeUrl === MsgJoinPool.typeUrl || typeof o.sender === "string" && typeof o.pool_id === "bigint" && typeof o.share_out_amount === "string" && Array.isArray(o.token_in_maxs) && (!o.token_in_maxs.length || Coin.isSDK(o.token_in_maxs[0]))); + }, + isAmino(o: any): o is MsgJoinPoolAmino { + return o && (o.$typeUrl === MsgJoinPool.typeUrl || typeof o.sender === "string" && typeof o.pool_id === "bigint" && typeof o.share_out_amount === "string" && Array.isArray(o.token_in_maxs) && (!o.token_in_maxs.length || Coin.isAmino(o.token_in_maxs[0]))); + }, encode(message: MsgJoinPool, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.sender !== "") { writer.uint32(10).string(message.sender); @@ -851,6 +861,12 @@ export const MsgJoinPool = { typeUrl: "/osmosis.gamm.v1beta1.MsgJoinPool", value: MsgJoinPool.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgJoinPool.typeUrl)) { + return; + } + Coin.registerTypeUrl(); } }; function createBaseMsgJoinPoolResponse(): MsgJoinPoolResponse { @@ -867,6 +883,15 @@ function createBaseMsgJoinPoolResponse(): MsgJoinPoolResponse { export const MsgJoinPoolResponse = { typeUrl: "/osmosis.gamm.v1beta1.MsgJoinPoolResponse", aminoType: "osmosis/gamm/join-pool-response", + is(o: any): o is MsgJoinPoolResponse { + return o && (o.$typeUrl === MsgJoinPoolResponse.typeUrl || typeof o.shareOutAmount === "string" && Array.isArray(o.tokenIn) && (!o.tokenIn.length || Coin.is(o.tokenIn[0]))); + }, + isSDK(o: any): o is MsgJoinPoolResponseSDKType { + return o && (o.$typeUrl === MsgJoinPoolResponse.typeUrl || typeof o.share_out_amount === "string" && Array.isArray(o.token_in) && (!o.token_in.length || Coin.isSDK(o.token_in[0]))); + }, + isAmino(o: any): o is MsgJoinPoolResponseAmino { + return o && (o.$typeUrl === MsgJoinPoolResponse.typeUrl || typeof o.share_out_amount === "string" && Array.isArray(o.token_in) && (!o.token_in.length || Coin.isAmino(o.token_in[0]))); + }, encode(message: MsgJoinPoolResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.shareOutAmount !== "") { writer.uint32(10).string(message.shareOutAmount); @@ -972,6 +997,12 @@ export const MsgJoinPoolResponse = { typeUrl: "/osmosis.gamm.v1beta1.MsgJoinPoolResponse", value: MsgJoinPoolResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgJoinPoolResponse.typeUrl)) { + return; + } + Coin.registerTypeUrl(); } }; function createBaseMsgExitPool(): MsgExitPool { @@ -991,6 +1022,15 @@ function createBaseMsgExitPool(): MsgExitPool { export const MsgExitPool = { typeUrl: "/osmosis.gamm.v1beta1.MsgExitPool", aminoType: "osmosis/gamm/exit-pool", + is(o: any): o is MsgExitPool { + return o && (o.$typeUrl === MsgExitPool.typeUrl || typeof o.sender === "string" && typeof o.poolId === "bigint" && typeof o.shareInAmount === "string" && Array.isArray(o.tokenOutMins) && (!o.tokenOutMins.length || Coin.is(o.tokenOutMins[0]))); + }, + isSDK(o: any): o is MsgExitPoolSDKType { + return o && (o.$typeUrl === MsgExitPool.typeUrl || typeof o.sender === "string" && typeof o.pool_id === "bigint" && typeof o.share_in_amount === "string" && Array.isArray(o.token_out_mins) && (!o.token_out_mins.length || Coin.isSDK(o.token_out_mins[0]))); + }, + isAmino(o: any): o is MsgExitPoolAmino { + return o && (o.$typeUrl === MsgExitPool.typeUrl || typeof o.sender === "string" && typeof o.pool_id === "bigint" && typeof o.share_in_amount === "string" && Array.isArray(o.token_out_mins) && (!o.token_out_mins.length || Coin.isAmino(o.token_out_mins[0]))); + }, encode(message: MsgExitPool, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.sender !== "") { writer.uint32(10).string(message.sender); @@ -1128,6 +1168,12 @@ export const MsgExitPool = { typeUrl: "/osmosis.gamm.v1beta1.MsgExitPool", value: MsgExitPool.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgExitPool.typeUrl)) { + return; + } + Coin.registerTypeUrl(); } }; function createBaseMsgExitPoolResponse(): MsgExitPoolResponse { @@ -1143,6 +1189,15 @@ function createBaseMsgExitPoolResponse(): MsgExitPoolResponse { export const MsgExitPoolResponse = { typeUrl: "/osmosis.gamm.v1beta1.MsgExitPoolResponse", aminoType: "osmosis/gamm/exit-pool-response", + is(o: any): o is MsgExitPoolResponse { + return o && (o.$typeUrl === MsgExitPoolResponse.typeUrl || Array.isArray(o.tokenOut) && (!o.tokenOut.length || Coin.is(o.tokenOut[0]))); + }, + isSDK(o: any): o is MsgExitPoolResponseSDKType { + return o && (o.$typeUrl === MsgExitPoolResponse.typeUrl || Array.isArray(o.token_out) && (!o.token_out.length || Coin.isSDK(o.token_out[0]))); + }, + isAmino(o: any): o is MsgExitPoolResponseAmino { + return o && (o.$typeUrl === MsgExitPoolResponse.typeUrl || Array.isArray(o.token_out) && (!o.token_out.length || Coin.isAmino(o.token_out[0]))); + }, encode(message: MsgExitPoolResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.tokenOut) { Coin.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -1233,6 +1288,12 @@ export const MsgExitPoolResponse = { typeUrl: "/osmosis.gamm.v1beta1.MsgExitPoolResponse", value: MsgExitPoolResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgExitPoolResponse.typeUrl)) { + return; + } + Coin.registerTypeUrl(); } }; function createBaseSwapAmountInRoute(): SwapAmountInRoute { @@ -1250,6 +1311,15 @@ function createBaseSwapAmountInRoute(): SwapAmountInRoute { export const SwapAmountInRoute = { typeUrl: "/osmosis.gamm.v1beta1.SwapAmountInRoute", aminoType: "osmosis/gamm/swap-amount-in-route", + is(o: any): o is SwapAmountInRoute { + return o && (o.$typeUrl === SwapAmountInRoute.typeUrl || typeof o.poolId === "bigint" && typeof o.tokenOutDenom === "string"); + }, + isSDK(o: any): o is SwapAmountInRouteSDKType { + return o && (o.$typeUrl === SwapAmountInRoute.typeUrl || typeof o.pool_id === "bigint" && typeof o.token_out_denom === "string"); + }, + isAmino(o: any): o is SwapAmountInRouteAmino { + return o && (o.$typeUrl === SwapAmountInRoute.typeUrl || typeof o.pool_id === "bigint" && typeof o.token_out_denom === "string"); + }, encode(message: SwapAmountInRoute, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.poolId !== BigInt(0)) { writer.uint32(8).uint64(message.poolId); @@ -1347,7 +1417,8 @@ export const SwapAmountInRoute = { typeUrl: "/osmosis.gamm.v1beta1.SwapAmountInRoute", value: SwapAmountInRoute.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgSwapExactAmountIn(): MsgSwapExactAmountIn { return { @@ -1365,6 +1436,15 @@ function createBaseMsgSwapExactAmountIn(): MsgSwapExactAmountIn { export const MsgSwapExactAmountIn = { typeUrl: "/osmosis.gamm.v1beta1.MsgSwapExactAmountIn", aminoType: "osmosis/gamm/swap-exact-amount-in", + is(o: any): o is MsgSwapExactAmountIn { + return o && (o.$typeUrl === MsgSwapExactAmountIn.typeUrl || typeof o.sender === "string" && Array.isArray(o.routes) && (!o.routes.length || SwapAmountInRoute.is(o.routes[0])) && Coin.is(o.tokenIn) && typeof o.tokenOutMinAmount === "string"); + }, + isSDK(o: any): o is MsgSwapExactAmountInSDKType { + return o && (o.$typeUrl === MsgSwapExactAmountIn.typeUrl || typeof o.sender === "string" && Array.isArray(o.routes) && (!o.routes.length || SwapAmountInRoute.isSDK(o.routes[0])) && Coin.isSDK(o.token_in) && typeof o.token_out_min_amount === "string"); + }, + isAmino(o: any): o is MsgSwapExactAmountInAmino { + return o && (o.$typeUrl === MsgSwapExactAmountIn.typeUrl || typeof o.sender === "string" && Array.isArray(o.routes) && (!o.routes.length || SwapAmountInRoute.isAmino(o.routes[0])) && Coin.isAmino(o.token_in) && typeof o.token_out_min_amount === "string"); + }, encode(message: MsgSwapExactAmountIn, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.sender !== "") { writer.uint32(10).string(message.sender); @@ -1502,6 +1582,13 @@ export const MsgSwapExactAmountIn = { typeUrl: "/osmosis.gamm.v1beta1.MsgSwapExactAmountIn", value: MsgSwapExactAmountIn.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgSwapExactAmountIn.typeUrl)) { + return; + } + SwapAmountInRoute.registerTypeUrl(); + Coin.registerTypeUrl(); } }; function createBaseMsgSwapExactAmountInResponse(): MsgSwapExactAmountInResponse { @@ -1517,6 +1604,15 @@ function createBaseMsgSwapExactAmountInResponse(): MsgSwapExactAmountInResponse export const MsgSwapExactAmountInResponse = { typeUrl: "/osmosis.gamm.v1beta1.MsgSwapExactAmountInResponse", aminoType: "osmosis/gamm/swap-exact-amount-in-response", + is(o: any): o is MsgSwapExactAmountInResponse { + return o && (o.$typeUrl === MsgSwapExactAmountInResponse.typeUrl || typeof o.tokenOutAmount === "string"); + }, + isSDK(o: any): o is MsgSwapExactAmountInResponseSDKType { + return o && (o.$typeUrl === MsgSwapExactAmountInResponse.typeUrl || typeof o.token_out_amount === "string"); + }, + isAmino(o: any): o is MsgSwapExactAmountInResponseAmino { + return o && (o.$typeUrl === MsgSwapExactAmountInResponse.typeUrl || typeof o.token_out_amount === "string"); + }, encode(message: MsgSwapExactAmountInResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.tokenOutAmount !== "") { writer.uint32(10).string(message.tokenOutAmount); @@ -1597,7 +1693,8 @@ export const MsgSwapExactAmountInResponse = { typeUrl: "/osmosis.gamm.v1beta1.MsgSwapExactAmountInResponse", value: MsgSwapExactAmountInResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseSwapAmountOutRoute(): SwapAmountOutRoute { return { @@ -1614,6 +1711,15 @@ function createBaseSwapAmountOutRoute(): SwapAmountOutRoute { export const SwapAmountOutRoute = { typeUrl: "/osmosis.gamm.v1beta1.SwapAmountOutRoute", aminoType: "osmosis/gamm/swap-amount-out-route", + is(o: any): o is SwapAmountOutRoute { + return o && (o.$typeUrl === SwapAmountOutRoute.typeUrl || typeof o.poolId === "bigint" && typeof o.tokenInDenom === "string"); + }, + isSDK(o: any): o is SwapAmountOutRouteSDKType { + return o && (o.$typeUrl === SwapAmountOutRoute.typeUrl || typeof o.pool_id === "bigint" && typeof o.token_in_denom === "string"); + }, + isAmino(o: any): o is SwapAmountOutRouteAmino { + return o && (o.$typeUrl === SwapAmountOutRoute.typeUrl || typeof o.pool_id === "bigint" && typeof o.token_in_denom === "string"); + }, encode(message: SwapAmountOutRoute, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.poolId !== BigInt(0)) { writer.uint32(8).uint64(message.poolId); @@ -1711,7 +1817,8 @@ export const SwapAmountOutRoute = { typeUrl: "/osmosis.gamm.v1beta1.SwapAmountOutRoute", value: SwapAmountOutRoute.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgSwapExactAmountOut(): MsgSwapExactAmountOut { return { @@ -1729,6 +1836,15 @@ function createBaseMsgSwapExactAmountOut(): MsgSwapExactAmountOut { export const MsgSwapExactAmountOut = { typeUrl: "/osmosis.gamm.v1beta1.MsgSwapExactAmountOut", aminoType: "osmosis/gamm/swap-exact-amount-out", + is(o: any): o is MsgSwapExactAmountOut { + return o && (o.$typeUrl === MsgSwapExactAmountOut.typeUrl || typeof o.sender === "string" && Array.isArray(o.routes) && (!o.routes.length || SwapAmountOutRoute.is(o.routes[0])) && typeof o.tokenInMaxAmount === "string" && Coin.is(o.tokenOut)); + }, + isSDK(o: any): o is MsgSwapExactAmountOutSDKType { + return o && (o.$typeUrl === MsgSwapExactAmountOut.typeUrl || typeof o.sender === "string" && Array.isArray(o.routes) && (!o.routes.length || SwapAmountOutRoute.isSDK(o.routes[0])) && typeof o.token_in_max_amount === "string" && Coin.isSDK(o.token_out)); + }, + isAmino(o: any): o is MsgSwapExactAmountOutAmino { + return o && (o.$typeUrl === MsgSwapExactAmountOut.typeUrl || typeof o.sender === "string" && Array.isArray(o.routes) && (!o.routes.length || SwapAmountOutRoute.isAmino(o.routes[0])) && typeof o.token_in_max_amount === "string" && Coin.isAmino(o.token_out)); + }, encode(message: MsgSwapExactAmountOut, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.sender !== "") { writer.uint32(10).string(message.sender); @@ -1866,6 +1982,13 @@ export const MsgSwapExactAmountOut = { typeUrl: "/osmosis.gamm.v1beta1.MsgSwapExactAmountOut", value: MsgSwapExactAmountOut.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgSwapExactAmountOut.typeUrl)) { + return; + } + SwapAmountOutRoute.registerTypeUrl(); + Coin.registerTypeUrl(); } }; function createBaseMsgSwapExactAmountOutResponse(): MsgSwapExactAmountOutResponse { @@ -1881,6 +2004,15 @@ function createBaseMsgSwapExactAmountOutResponse(): MsgSwapExactAmountOutRespons export const MsgSwapExactAmountOutResponse = { typeUrl: "/osmosis.gamm.v1beta1.MsgSwapExactAmountOutResponse", aminoType: "osmosis/gamm/swap-exact-amount-out-response", + is(o: any): o is MsgSwapExactAmountOutResponse { + return o && (o.$typeUrl === MsgSwapExactAmountOutResponse.typeUrl || typeof o.tokenInAmount === "string"); + }, + isSDK(o: any): o is MsgSwapExactAmountOutResponseSDKType { + return o && (o.$typeUrl === MsgSwapExactAmountOutResponse.typeUrl || typeof o.token_in_amount === "string"); + }, + isAmino(o: any): o is MsgSwapExactAmountOutResponseAmino { + return o && (o.$typeUrl === MsgSwapExactAmountOutResponse.typeUrl || typeof o.token_in_amount === "string"); + }, encode(message: MsgSwapExactAmountOutResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.tokenInAmount !== "") { writer.uint32(10).string(message.tokenInAmount); @@ -1961,7 +2093,8 @@ export const MsgSwapExactAmountOutResponse = { typeUrl: "/osmosis.gamm.v1beta1.MsgSwapExactAmountOutResponse", value: MsgSwapExactAmountOutResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgJoinSwapExternAmountIn(): MsgJoinSwapExternAmountIn { return { @@ -1981,6 +2114,15 @@ function createBaseMsgJoinSwapExternAmountIn(): MsgJoinSwapExternAmountIn { export const MsgJoinSwapExternAmountIn = { typeUrl: "/osmosis.gamm.v1beta1.MsgJoinSwapExternAmountIn", aminoType: "osmosis/gamm/join-swap-extern-amount-in", + is(o: any): o is MsgJoinSwapExternAmountIn { + return o && (o.$typeUrl === MsgJoinSwapExternAmountIn.typeUrl || typeof o.sender === "string" && typeof o.poolId === "bigint" && Coin.is(o.tokenIn) && typeof o.shareOutMinAmount === "string"); + }, + isSDK(o: any): o is MsgJoinSwapExternAmountInSDKType { + return o && (o.$typeUrl === MsgJoinSwapExternAmountIn.typeUrl || typeof o.sender === "string" && typeof o.pool_id === "bigint" && Coin.isSDK(o.token_in) && typeof o.share_out_min_amount === "string"); + }, + isAmino(o: any): o is MsgJoinSwapExternAmountInAmino { + return o && (o.$typeUrl === MsgJoinSwapExternAmountIn.typeUrl || typeof o.sender === "string" && typeof o.pool_id === "bigint" && Coin.isAmino(o.token_in) && typeof o.share_out_min_amount === "string"); + }, encode(message: MsgJoinSwapExternAmountIn, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.sender !== "") { writer.uint32(10).string(message.sender); @@ -2110,6 +2252,12 @@ export const MsgJoinSwapExternAmountIn = { typeUrl: "/osmosis.gamm.v1beta1.MsgJoinSwapExternAmountIn", value: MsgJoinSwapExternAmountIn.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgJoinSwapExternAmountIn.typeUrl)) { + return; + } + Coin.registerTypeUrl(); } }; function createBaseMsgJoinSwapExternAmountInResponse(): MsgJoinSwapExternAmountInResponse { @@ -2125,6 +2273,15 @@ function createBaseMsgJoinSwapExternAmountInResponse(): MsgJoinSwapExternAmountI export const MsgJoinSwapExternAmountInResponse = { typeUrl: "/osmosis.gamm.v1beta1.MsgJoinSwapExternAmountInResponse", aminoType: "osmosis/gamm/join-swap-extern-amount-in-response", + is(o: any): o is MsgJoinSwapExternAmountInResponse { + return o && (o.$typeUrl === MsgJoinSwapExternAmountInResponse.typeUrl || typeof o.shareOutAmount === "string"); + }, + isSDK(o: any): o is MsgJoinSwapExternAmountInResponseSDKType { + return o && (o.$typeUrl === MsgJoinSwapExternAmountInResponse.typeUrl || typeof o.share_out_amount === "string"); + }, + isAmino(o: any): o is MsgJoinSwapExternAmountInResponseAmino { + return o && (o.$typeUrl === MsgJoinSwapExternAmountInResponse.typeUrl || typeof o.share_out_amount === "string"); + }, encode(message: MsgJoinSwapExternAmountInResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.shareOutAmount !== "") { writer.uint32(10).string(message.shareOutAmount); @@ -2205,7 +2362,8 @@ export const MsgJoinSwapExternAmountInResponse = { typeUrl: "/osmosis.gamm.v1beta1.MsgJoinSwapExternAmountInResponse", value: MsgJoinSwapExternAmountInResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgJoinSwapShareAmountOut(): MsgJoinSwapShareAmountOut { return { @@ -2225,6 +2383,15 @@ function createBaseMsgJoinSwapShareAmountOut(): MsgJoinSwapShareAmountOut { export const MsgJoinSwapShareAmountOut = { typeUrl: "/osmosis.gamm.v1beta1.MsgJoinSwapShareAmountOut", aminoType: "osmosis/gamm/join-swap-share-amount-out", + is(o: any): o is MsgJoinSwapShareAmountOut { + return o && (o.$typeUrl === MsgJoinSwapShareAmountOut.typeUrl || typeof o.sender === "string" && typeof o.poolId === "bigint" && typeof o.tokenInDenom === "string" && typeof o.shareOutAmount === "string" && typeof o.tokenInMaxAmount === "string"); + }, + isSDK(o: any): o is MsgJoinSwapShareAmountOutSDKType { + return o && (o.$typeUrl === MsgJoinSwapShareAmountOut.typeUrl || typeof o.sender === "string" && typeof o.pool_id === "bigint" && typeof o.token_in_denom === "string" && typeof o.share_out_amount === "string" && typeof o.token_in_max_amount === "string"); + }, + isAmino(o: any): o is MsgJoinSwapShareAmountOutAmino { + return o && (o.$typeUrl === MsgJoinSwapShareAmountOut.typeUrl || typeof o.sender === "string" && typeof o.pool_id === "bigint" && typeof o.token_in_denom === "string" && typeof o.share_out_amount === "string" && typeof o.token_in_max_amount === "string"); + }, encode(message: MsgJoinSwapShareAmountOut, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.sender !== "") { writer.uint32(10).string(message.sender); @@ -2367,7 +2534,8 @@ export const MsgJoinSwapShareAmountOut = { typeUrl: "/osmosis.gamm.v1beta1.MsgJoinSwapShareAmountOut", value: MsgJoinSwapShareAmountOut.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgJoinSwapShareAmountOutResponse(): MsgJoinSwapShareAmountOutResponse { return { @@ -2382,6 +2550,15 @@ function createBaseMsgJoinSwapShareAmountOutResponse(): MsgJoinSwapShareAmountOu export const MsgJoinSwapShareAmountOutResponse = { typeUrl: "/osmosis.gamm.v1beta1.MsgJoinSwapShareAmountOutResponse", aminoType: "osmosis/gamm/join-swap-share-amount-out-response", + is(o: any): o is MsgJoinSwapShareAmountOutResponse { + return o && (o.$typeUrl === MsgJoinSwapShareAmountOutResponse.typeUrl || typeof o.tokenInAmount === "string"); + }, + isSDK(o: any): o is MsgJoinSwapShareAmountOutResponseSDKType { + return o && (o.$typeUrl === MsgJoinSwapShareAmountOutResponse.typeUrl || typeof o.token_in_amount === "string"); + }, + isAmino(o: any): o is MsgJoinSwapShareAmountOutResponseAmino { + return o && (o.$typeUrl === MsgJoinSwapShareAmountOutResponse.typeUrl || typeof o.token_in_amount === "string"); + }, encode(message: MsgJoinSwapShareAmountOutResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.tokenInAmount !== "") { writer.uint32(10).string(message.tokenInAmount); @@ -2462,7 +2639,8 @@ export const MsgJoinSwapShareAmountOutResponse = { typeUrl: "/osmosis.gamm.v1beta1.MsgJoinSwapShareAmountOutResponse", value: MsgJoinSwapShareAmountOutResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgExitSwapShareAmountIn(): MsgExitSwapShareAmountIn { return { @@ -2482,6 +2660,15 @@ function createBaseMsgExitSwapShareAmountIn(): MsgExitSwapShareAmountIn { export const MsgExitSwapShareAmountIn = { typeUrl: "/osmosis.gamm.v1beta1.MsgExitSwapShareAmountIn", aminoType: "osmosis/gamm/exit-swap-share-amount-in", + is(o: any): o is MsgExitSwapShareAmountIn { + return o && (o.$typeUrl === MsgExitSwapShareAmountIn.typeUrl || typeof o.sender === "string" && typeof o.poolId === "bigint" && typeof o.tokenOutDenom === "string" && typeof o.shareInAmount === "string" && typeof o.tokenOutMinAmount === "string"); + }, + isSDK(o: any): o is MsgExitSwapShareAmountInSDKType { + return o && (o.$typeUrl === MsgExitSwapShareAmountIn.typeUrl || typeof o.sender === "string" && typeof o.pool_id === "bigint" && typeof o.token_out_denom === "string" && typeof o.share_in_amount === "string" && typeof o.token_out_min_amount === "string"); + }, + isAmino(o: any): o is MsgExitSwapShareAmountInAmino { + return o && (o.$typeUrl === MsgExitSwapShareAmountIn.typeUrl || typeof o.sender === "string" && typeof o.pool_id === "bigint" && typeof o.token_out_denom === "string" && typeof o.share_in_amount === "string" && typeof o.token_out_min_amount === "string"); + }, encode(message: MsgExitSwapShareAmountIn, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.sender !== "") { writer.uint32(10).string(message.sender); @@ -2624,7 +2811,8 @@ export const MsgExitSwapShareAmountIn = { typeUrl: "/osmosis.gamm.v1beta1.MsgExitSwapShareAmountIn", value: MsgExitSwapShareAmountIn.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgExitSwapShareAmountInResponse(): MsgExitSwapShareAmountInResponse { return { @@ -2639,6 +2827,15 @@ function createBaseMsgExitSwapShareAmountInResponse(): MsgExitSwapShareAmountInR export const MsgExitSwapShareAmountInResponse = { typeUrl: "/osmosis.gamm.v1beta1.MsgExitSwapShareAmountInResponse", aminoType: "osmosis/gamm/exit-swap-share-amount-in-response", + is(o: any): o is MsgExitSwapShareAmountInResponse { + return o && (o.$typeUrl === MsgExitSwapShareAmountInResponse.typeUrl || typeof o.tokenOutAmount === "string"); + }, + isSDK(o: any): o is MsgExitSwapShareAmountInResponseSDKType { + return o && (o.$typeUrl === MsgExitSwapShareAmountInResponse.typeUrl || typeof o.token_out_amount === "string"); + }, + isAmino(o: any): o is MsgExitSwapShareAmountInResponseAmino { + return o && (o.$typeUrl === MsgExitSwapShareAmountInResponse.typeUrl || typeof o.token_out_amount === "string"); + }, encode(message: MsgExitSwapShareAmountInResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.tokenOutAmount !== "") { writer.uint32(10).string(message.tokenOutAmount); @@ -2719,7 +2916,8 @@ export const MsgExitSwapShareAmountInResponse = { typeUrl: "/osmosis.gamm.v1beta1.MsgExitSwapShareAmountInResponse", value: MsgExitSwapShareAmountInResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgExitSwapExternAmountOut(): MsgExitSwapExternAmountOut { return { @@ -2738,6 +2936,15 @@ function createBaseMsgExitSwapExternAmountOut(): MsgExitSwapExternAmountOut { export const MsgExitSwapExternAmountOut = { typeUrl: "/osmosis.gamm.v1beta1.MsgExitSwapExternAmountOut", aminoType: "osmosis/gamm/exit-swap-extern-amount-out", + is(o: any): o is MsgExitSwapExternAmountOut { + return o && (o.$typeUrl === MsgExitSwapExternAmountOut.typeUrl || typeof o.sender === "string" && typeof o.poolId === "bigint" && Coin.is(o.tokenOut) && typeof o.shareInMaxAmount === "string"); + }, + isSDK(o: any): o is MsgExitSwapExternAmountOutSDKType { + return o && (o.$typeUrl === MsgExitSwapExternAmountOut.typeUrl || typeof o.sender === "string" && typeof o.pool_id === "bigint" && Coin.isSDK(o.token_out) && typeof o.share_in_max_amount === "string"); + }, + isAmino(o: any): o is MsgExitSwapExternAmountOutAmino { + return o && (o.$typeUrl === MsgExitSwapExternAmountOut.typeUrl || typeof o.sender === "string" && typeof o.pool_id === "bigint" && Coin.isAmino(o.token_out) && typeof o.share_in_max_amount === "string"); + }, encode(message: MsgExitSwapExternAmountOut, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.sender !== "") { writer.uint32(10).string(message.sender); @@ -2867,6 +3074,12 @@ export const MsgExitSwapExternAmountOut = { typeUrl: "/osmosis.gamm.v1beta1.MsgExitSwapExternAmountOut", value: MsgExitSwapExternAmountOut.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgExitSwapExternAmountOut.typeUrl)) { + return; + } + Coin.registerTypeUrl(); } }; function createBaseMsgExitSwapExternAmountOutResponse(): MsgExitSwapExternAmountOutResponse { @@ -2882,6 +3095,15 @@ function createBaseMsgExitSwapExternAmountOutResponse(): MsgExitSwapExternAmount export const MsgExitSwapExternAmountOutResponse = { typeUrl: "/osmosis.gamm.v1beta1.MsgExitSwapExternAmountOutResponse", aminoType: "osmosis/gamm/exit-swap-extern-amount-out-response", + is(o: any): o is MsgExitSwapExternAmountOutResponse { + return o && (o.$typeUrl === MsgExitSwapExternAmountOutResponse.typeUrl || typeof o.shareInAmount === "string"); + }, + isSDK(o: any): o is MsgExitSwapExternAmountOutResponseSDKType { + return o && (o.$typeUrl === MsgExitSwapExternAmountOutResponse.typeUrl || typeof o.share_in_amount === "string"); + }, + isAmino(o: any): o is MsgExitSwapExternAmountOutResponseAmino { + return o && (o.$typeUrl === MsgExitSwapExternAmountOutResponse.typeUrl || typeof o.share_in_amount === "string"); + }, encode(message: MsgExitSwapExternAmountOutResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.shareInAmount !== "") { writer.uint32(10).string(message.shareInAmount); @@ -2962,5 +3184,6 @@ export const MsgExitSwapExternAmountOutResponse = { typeUrl: "/osmosis.gamm.v1beta1.MsgExitSwapExternAmountOutResponse", value: MsgExitSwapExternAmountOutResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/osmosis/gamm/v2/query.rpc.func.ts b/__fixtures__/v-next/outputv2/osmosis/gamm/v2/query.rpc.func.ts new file mode 100644 index 0000000000..647b487eec --- /dev/null +++ b/__fixtures__/v-next/outputv2/osmosis/gamm/v2/query.rpc.func.ts @@ -0,0 +1,16 @@ +import { buildQuery } from "../../../helper-func-types"; +import { QuerySpotPriceRequest, QuerySpotPriceResponse } from "./query"; +/** + * SpotPrice defines a gRPC query handler that returns the spot price given + * a base denomination and a quote denomination. + * @name getSpotPrice + * @package osmosis.gamm.v2 + * @see proto service: osmosis.gamm.v2.SpotPrice + */ +export const getSpotPrice = buildQuery({ + encode: QuerySpotPriceRequest.encode, + decode: QuerySpotPriceResponse.decode, + service: "osmosis.gamm.v2.Query", + method: "SpotPrice", + deps: [QuerySpotPriceRequest, QuerySpotPriceResponse] +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/osmosis/gamm/v2/query.ts b/__fixtures__/v-next/outputv2/osmosis/gamm/v2/query.ts index 86ce2ae9b0..f0bc0bf789 100644 --- a/__fixtures__/v-next/outputv2/osmosis/gamm/v2/query.ts +++ b/__fixtures__/v-next/outputv2/osmosis/gamm/v2/query.ts @@ -107,6 +107,15 @@ function createBaseQuerySpotPriceRequest(): QuerySpotPriceRequest { export const QuerySpotPriceRequest = { typeUrl: "/osmosis.gamm.v2.QuerySpotPriceRequest", aminoType: "osmosis/gamm/v2/query-spot-price-request", + is(o: any): o is QuerySpotPriceRequest { + return o && (o.$typeUrl === QuerySpotPriceRequest.typeUrl || typeof o.poolId === "bigint" && typeof o.baseAssetDenom === "string" && typeof o.quoteAssetDenom === "string"); + }, + isSDK(o: any): o is QuerySpotPriceRequestSDKType { + return o && (o.$typeUrl === QuerySpotPriceRequest.typeUrl || typeof o.pool_id === "bigint" && typeof o.base_asset_denom === "string" && typeof o.quote_asset_denom === "string"); + }, + isAmino(o: any): o is QuerySpotPriceRequestAmino { + return o && (o.$typeUrl === QuerySpotPriceRequest.typeUrl || typeof o.pool_id === "bigint" && typeof o.base_asset_denom === "string" && typeof o.quote_asset_denom === "string"); + }, encode(message: QuerySpotPriceRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.poolId !== BigInt(0)) { writer.uint32(8).uint64(message.poolId); @@ -219,7 +228,8 @@ export const QuerySpotPriceRequest = { typeUrl: "/osmosis.gamm.v2.QuerySpotPriceRequest", value: QuerySpotPriceRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQuerySpotPriceResponse(): QuerySpotPriceResponse { return { @@ -236,6 +246,15 @@ function createBaseQuerySpotPriceResponse(): QuerySpotPriceResponse { export const QuerySpotPriceResponse = { typeUrl: "/osmosis.gamm.v2.QuerySpotPriceResponse", aminoType: "osmosis/gamm/v2/query-spot-price-response", + is(o: any): o is QuerySpotPriceResponse { + return o && (o.$typeUrl === QuerySpotPriceResponse.typeUrl || typeof o.spotPrice === "string"); + }, + isSDK(o: any): o is QuerySpotPriceResponseSDKType { + return o && (o.$typeUrl === QuerySpotPriceResponse.typeUrl || typeof o.spot_price === "string"); + }, + isAmino(o: any): o is QuerySpotPriceResponseAmino { + return o && (o.$typeUrl === QuerySpotPriceResponse.typeUrl || typeof o.spot_price === "string"); + }, encode(message: QuerySpotPriceResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.spotPrice !== "") { writer.uint32(10).string(message.spotPrice); @@ -316,5 +335,6 @@ export const QuerySpotPriceResponse = { typeUrl: "/osmosis.gamm.v2.QuerySpotPriceResponse", value: QuerySpotPriceResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/osmosis/ibc-rate-limit/v1beta1/params.ts b/__fixtures__/v-next/outputv2/osmosis/ibc-rate-limit/v1beta1/params.ts index d4a2740dab..d12a4a4cd3 100644 --- a/__fixtures__/v-next/outputv2/osmosis/ibc-rate-limit/v1beta1/params.ts +++ b/__fixtures__/v-next/outputv2/osmosis/ibc-rate-limit/v1beta1/params.ts @@ -51,6 +51,15 @@ function createBaseParams(): Params { export const Params = { typeUrl: "/osmosis.ibcratelimit.v1beta1.Params", aminoType: "osmosis/ibcratelimit/params", + is(o: any): o is Params { + return o && (o.$typeUrl === Params.typeUrl || typeof o.contractAddress === "string"); + }, + isSDK(o: any): o is ParamsSDKType { + return o && (o.$typeUrl === Params.typeUrl || typeof o.contract_address === "string"); + }, + isAmino(o: any): o is ParamsAmino { + return o && (o.$typeUrl === Params.typeUrl || typeof o.contract_address === "string"); + }, encode(message: Params, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.contractAddress !== "") { writer.uint32(10).string(message.contractAddress); @@ -131,5 +140,6 @@ export const Params = { typeUrl: "/osmosis.ibcratelimit.v1beta1.Params", value: Params.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/osmosis/ibc-rate-limit/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputv2/osmosis/ibc-rate-limit/v1beta1/query.rpc.func.ts new file mode 100644 index 0000000000..c1ff309e82 --- /dev/null +++ b/__fixtures__/v-next/outputv2/osmosis/ibc-rate-limit/v1beta1/query.rpc.func.ts @@ -0,0 +1,16 @@ +import { buildQuery } from "../../../helper-func-types"; +import { QueryParamsRequest, QueryParamsResponse } from "./query"; +/** + * Params defines a gRPC query method that returns the ibc-rate-limit module's + * parameters. + * @name getParams + * @package osmosis.ibcratelimit.v1beta1 + * @see proto service: osmosis.ibcratelimit.v1beta1.Params + */ +export const getParams = buildQuery({ + encode: QueryParamsRequest.encode, + decode: QueryParamsResponse.decode, + service: "osmosis.ibcratelimit.v1beta1.Query", + method: "Params", + deps: [QueryParamsRequest, QueryParamsResponse] +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/osmosis/ibc-rate-limit/v1beta1/query.ts b/__fixtures__/v-next/outputv2/osmosis/ibc-rate-limit/v1beta1/query.ts index 592ab93695..7c70b7ca5d 100644 --- a/__fixtures__/v-next/outputv2/osmosis/ibc-rate-limit/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv2/osmosis/ibc-rate-limit/v1beta1/query.ts @@ -2,6 +2,7 @@ import { Params, ParamsAmino, ParamsSDKType } from "./params"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { JsonSafe } from "../../../json-safe"; import { DeepPartial, isSet } from "../../../helpers"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "osmosis.ibcratelimit.v1beta1"; /** * QueryParamsRequest is the request type for the Query/Params RPC method. @@ -85,6 +86,15 @@ function createBaseQueryParamsRequest(): QueryParamsRequest { export const QueryParamsRequest = { typeUrl: "/osmosis.ibcratelimit.v1beta1.QueryParamsRequest", aminoType: "osmosis/ibcratelimit/query-params-request", + is(o: any): o is QueryParamsRequest { + return o && o.$typeUrl === QueryParamsRequest.typeUrl; + }, + isSDK(o: any): o is QueryParamsRequestSDKType { + return o && o.$typeUrl === QueryParamsRequest.typeUrl; + }, + isAmino(o: any): o is QueryParamsRequestAmino { + return o && o.$typeUrl === QueryParamsRequest.typeUrl; + }, encode(_: QueryParamsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -149,7 +159,8 @@ export const QueryParamsRequest = { typeUrl: "/osmosis.ibcratelimit.v1beta1.QueryParamsRequest", value: QueryParamsRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryParamsResponse(): QueryParamsResponse { return { @@ -165,6 +176,15 @@ function createBaseQueryParamsResponse(): QueryParamsResponse { export const QueryParamsResponse = { typeUrl: "/osmosis.ibcratelimit.v1beta1.QueryParamsResponse", aminoType: "osmosis/ibcratelimit/query-params-response", + is(o: any): o is QueryParamsResponse { + return o && (o.$typeUrl === QueryParamsResponse.typeUrl || Params.is(o.params)); + }, + isSDK(o: any): o is QueryParamsResponseSDKType { + return o && (o.$typeUrl === QueryParamsResponse.typeUrl || Params.isSDK(o.params)); + }, + isAmino(o: any): o is QueryParamsResponseAmino { + return o && (o.$typeUrl === QueryParamsResponse.typeUrl || Params.isAmino(o.params)); + }, encode(message: QueryParamsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.params !== undefined) { Params.encode(message.params, writer.uint32(10).fork()).ldelim(); @@ -247,5 +267,11 @@ export const QueryParamsResponse = { typeUrl: "/osmosis.ibcratelimit.v1beta1.QueryParamsResponse", value: QueryParamsResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryParamsResponse.typeUrl)) { + return; + } + Params.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/osmosis/incentives/gauge.ts b/__fixtures__/v-next/outputv2/osmosis/incentives/gauge.ts index 95b07aae7b..11d38d081f 100644 --- a/__fixtures__/v-next/outputv2/osmosis/incentives/gauge.ts +++ b/__fixtures__/v-next/outputv2/osmosis/incentives/gauge.ts @@ -3,6 +3,7 @@ import { Coin, CoinAmino, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; import { Timestamp } from "../../google/protobuf/timestamp"; import { Duration, DurationAmino, DurationSDKType } from "../../google/protobuf/duration"; import { BinaryReader, BinaryWriter } from "../../binary"; +import { GlobalDecoderRegistry } from "../../registry"; import { toTimestamp, fromTimestamp, isSet, DeepPartial } from "../../helpers"; import { JsonSafe } from "../../json-safe"; export const protobufPackage = "osmosis.incentives"; @@ -193,6 +194,15 @@ function createBaseGauge(): Gauge { export const Gauge = { typeUrl: "/osmosis.incentives.Gauge", aminoType: "osmosis/incentives/gauge", + is(o: any): o is Gauge { + return o && (o.$typeUrl === Gauge.typeUrl || typeof o.id === "bigint" && typeof o.isPerpetual === "boolean" && QueryCondition.is(o.distributeTo) && Array.isArray(o.coins) && (!o.coins.length || Coin.is(o.coins[0])) && Timestamp.is(o.startTime) && typeof o.numEpochsPaidOver === "bigint" && typeof o.filledEpochs === "bigint" && Array.isArray(o.distributedCoins) && (!o.distributedCoins.length || Coin.is(o.distributedCoins[0]))); + }, + isSDK(o: any): o is GaugeSDKType { + return o && (o.$typeUrl === Gauge.typeUrl || typeof o.id === "bigint" && typeof o.is_perpetual === "boolean" && QueryCondition.isSDK(o.distribute_to) && Array.isArray(o.coins) && (!o.coins.length || Coin.isSDK(o.coins[0])) && Timestamp.isSDK(o.start_time) && typeof o.num_epochs_paid_over === "bigint" && typeof o.filled_epochs === "bigint" && Array.isArray(o.distributed_coins) && (!o.distributed_coins.length || Coin.isSDK(o.distributed_coins[0]))); + }, + isAmino(o: any): o is GaugeAmino { + return o && (o.$typeUrl === Gauge.typeUrl || typeof o.id === "bigint" && typeof o.is_perpetual === "boolean" && QueryCondition.isAmino(o.distribute_to) && Array.isArray(o.coins) && (!o.coins.length || Coin.isAmino(o.coins[0])) && Timestamp.isAmino(o.start_time) && typeof o.num_epochs_paid_over === "bigint" && typeof o.filled_epochs === "bigint" && Array.isArray(o.distributed_coins) && (!o.distributed_coins.length || Coin.isAmino(o.distributed_coins[0]))); + }, encode(message: Gauge, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.id !== BigInt(0)) { writer.uint32(8).uint64(message.id); @@ -406,6 +416,13 @@ export const Gauge = { typeUrl: "/osmosis.incentives.Gauge", value: Gauge.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Gauge.typeUrl)) { + return; + } + QueryCondition.registerTypeUrl(); + Coin.registerTypeUrl(); } }; function createBaseLockableDurationsInfo(): LockableDurationsInfo { @@ -421,6 +438,15 @@ function createBaseLockableDurationsInfo(): LockableDurationsInfo { export const LockableDurationsInfo = { typeUrl: "/osmosis.incentives.LockableDurationsInfo", aminoType: "osmosis/incentives/lockable-durations-info", + is(o: any): o is LockableDurationsInfo { + return o && (o.$typeUrl === LockableDurationsInfo.typeUrl || Array.isArray(o.lockableDurations) && (!o.lockableDurations.length || Duration.is(o.lockableDurations[0]))); + }, + isSDK(o: any): o is LockableDurationsInfoSDKType { + return o && (o.$typeUrl === LockableDurationsInfo.typeUrl || Array.isArray(o.lockable_durations) && (!o.lockable_durations.length || Duration.isSDK(o.lockable_durations[0]))); + }, + isAmino(o: any): o is LockableDurationsInfoAmino { + return o && (o.$typeUrl === LockableDurationsInfo.typeUrl || Array.isArray(o.lockable_durations) && (!o.lockable_durations.length || Duration.isAmino(o.lockable_durations[0]))); + }, encode(message: LockableDurationsInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.lockableDurations) { Duration.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -511,5 +537,6 @@ export const LockableDurationsInfo = { typeUrl: "/osmosis.incentives.LockableDurationsInfo", value: LockableDurationsInfo.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/osmosis/incentives/genesis.ts b/__fixtures__/v-next/outputv2/osmosis/incentives/genesis.ts index e33d671515..624c2d774a 100644 --- a/__fixtures__/v-next/outputv2/osmosis/incentives/genesis.ts +++ b/__fixtures__/v-next/outputv2/osmosis/incentives/genesis.ts @@ -2,6 +2,7 @@ import { Params, ParamsAmino, ParamsSDKType } from "./params"; import { Gauge, GaugeAmino, GaugeSDKType } from "./gauge"; import { Duration, DurationAmino, DurationSDKType } from "../../google/protobuf/duration"; import { BinaryReader, BinaryWriter } from "../../binary"; +import { GlobalDecoderRegistry } from "../../registry"; import { isSet, DeepPartial } from "../../helpers"; import { JsonSafe } from "../../json-safe"; export const protobufPackage = "osmosis.incentives"; @@ -98,6 +99,15 @@ function createBaseGenesisState(): GenesisState { export const GenesisState = { typeUrl: "/osmosis.incentives.GenesisState", aminoType: "osmosis/incentives/genesis-state", + is(o: any): o is GenesisState { + return o && (o.$typeUrl === GenesisState.typeUrl || Params.is(o.params) && Array.isArray(o.gauges) && (!o.gauges.length || Gauge.is(o.gauges[0])) && Array.isArray(o.lockableDurations) && (!o.lockableDurations.length || Duration.is(o.lockableDurations[0])) && typeof o.lastGaugeId === "bigint"); + }, + isSDK(o: any): o is GenesisStateSDKType { + return o && (o.$typeUrl === GenesisState.typeUrl || Params.isSDK(o.params) && Array.isArray(o.gauges) && (!o.gauges.length || Gauge.isSDK(o.gauges[0])) && Array.isArray(o.lockable_durations) && (!o.lockable_durations.length || Duration.isSDK(o.lockable_durations[0])) && typeof o.last_gauge_id === "bigint"); + }, + isAmino(o: any): o is GenesisStateAmino { + return o && (o.$typeUrl === GenesisState.typeUrl || Params.isAmino(o.params) && Array.isArray(o.gauges) && (!o.gauges.length || Gauge.isAmino(o.gauges[0])) && Array.isArray(o.lockable_durations) && (!o.lockable_durations.length || Duration.isAmino(o.lockable_durations[0])) && typeof o.last_gauge_id === "bigint"); + }, encode(message: GenesisState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.params !== undefined) { Params.encode(message.params, writer.uint32(10).fork()).ldelim(); @@ -247,5 +257,12 @@ export const GenesisState = { typeUrl: "/osmosis.incentives.GenesisState", value: GenesisState.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GenesisState.typeUrl)) { + return; + } + Params.registerTypeUrl(); + Gauge.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/osmosis/incentives/params.ts b/__fixtures__/v-next/outputv2/osmosis/incentives/params.ts index 6d98e7f590..067f66be54 100644 --- a/__fixtures__/v-next/outputv2/osmosis/incentives/params.ts +++ b/__fixtures__/v-next/outputv2/osmosis/incentives/params.ts @@ -59,6 +59,15 @@ function createBaseParams(): Params { export const Params = { typeUrl: "/osmosis.incentives.Params", aminoType: "osmosis/incentives/params", + is(o: any): o is Params { + return o && (o.$typeUrl === Params.typeUrl || typeof o.distrEpochIdentifier === "string"); + }, + isSDK(o: any): o is ParamsSDKType { + return o && (o.$typeUrl === Params.typeUrl || typeof o.distr_epoch_identifier === "string"); + }, + isAmino(o: any): o is ParamsAmino { + return o && (o.$typeUrl === Params.typeUrl || typeof o.distr_epoch_identifier === "string"); + }, encode(message: Params, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.distrEpochIdentifier !== "") { writer.uint32(10).string(message.distrEpochIdentifier); @@ -139,5 +148,6 @@ export const Params = { typeUrl: "/osmosis.incentives.Params", value: Params.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/osmosis/incentives/query.rpc.func.ts b/__fixtures__/v-next/outputv2/osmosis/incentives/query.rpc.func.ts new file mode 100644 index 0000000000..63e0c2cc0a --- /dev/null +++ b/__fixtures__/v-next/outputv2/osmosis/incentives/query.rpc.func.ts @@ -0,0 +1,123 @@ +import { buildQuery } from "../../helper-func-types"; +import { ModuleToDistributeCoinsRequest, ModuleToDistributeCoinsResponse, GaugeByIDRequest, GaugeByIDResponse, GaugesRequest, GaugesResponse, ActiveGaugesRequest, ActiveGaugesResponse, ActiveGaugesPerDenomRequest, ActiveGaugesPerDenomResponse, UpcomingGaugesRequest, UpcomingGaugesResponse, UpcomingGaugesPerDenomRequest, UpcomingGaugesPerDenomResponse, RewardsEstRequest, RewardsEstResponse, QueryLockableDurationsRequest, QueryLockableDurationsResponse } from "./query"; +/** + * ModuleToDistributeCoins returns coins that are going to be distributed + * @name getModuleToDistributeCoins + * @package osmosis.incentives + * @see proto service: osmosis.incentives.ModuleToDistributeCoins + */ +export const getModuleToDistributeCoins = buildQuery({ + encode: ModuleToDistributeCoinsRequest.encode, + decode: ModuleToDistributeCoinsResponse.decode, + service: "osmosis.incentives.Query", + method: "ModuleToDistributeCoins", + deps: [ModuleToDistributeCoinsRequest, ModuleToDistributeCoinsResponse] +}); +/** + * GaugeByID returns gauges by their respective ID + * @name getGaugeByID + * @package osmosis.incentives + * @see proto service: osmosis.incentives.GaugeByID + */ +export const getGaugeByID = buildQuery({ + encode: GaugeByIDRequest.encode, + decode: GaugeByIDResponse.decode, + service: "osmosis.incentives.Query", + method: "GaugeByID", + deps: [GaugeByIDRequest, GaugeByIDResponse] +}); +/** + * Gauges returns both upcoming and active gauges + * @name getGauges + * @package osmosis.incentives + * @see proto service: osmosis.incentives.Gauges + */ +export const getGauges = buildQuery({ + encode: GaugesRequest.encode, + decode: GaugesResponse.decode, + service: "osmosis.incentives.Query", + method: "Gauges", + deps: [GaugesRequest, GaugesResponse] +}); +/** + * ActiveGauges returns active gauges + * @name getActiveGauges + * @package osmosis.incentives + * @see proto service: osmosis.incentives.ActiveGauges + */ +export const getActiveGauges = buildQuery({ + encode: ActiveGaugesRequest.encode, + decode: ActiveGaugesResponse.decode, + service: "osmosis.incentives.Query", + method: "ActiveGauges", + deps: [ActiveGaugesRequest, ActiveGaugesResponse] +}); +/** + * ActiveGaugesPerDenom returns active gauges by denom + * @name getActiveGaugesPerDenom + * @package osmosis.incentives + * @see proto service: osmosis.incentives.ActiveGaugesPerDenom + */ +export const getActiveGaugesPerDenom = buildQuery({ + encode: ActiveGaugesPerDenomRequest.encode, + decode: ActiveGaugesPerDenomResponse.decode, + service: "osmosis.incentives.Query", + method: "ActiveGaugesPerDenom", + deps: [ActiveGaugesPerDenomRequest, ActiveGaugesPerDenomResponse] +}); +/** + * Returns scheduled gauges that have not yet occured + * @name getUpcomingGauges + * @package osmosis.incentives + * @see proto service: osmosis.incentives.UpcomingGauges + */ +export const getUpcomingGauges = buildQuery({ + encode: UpcomingGaugesRequest.encode, + decode: UpcomingGaugesResponse.decode, + service: "osmosis.incentives.Query", + method: "UpcomingGauges", + deps: [UpcomingGaugesRequest, UpcomingGaugesResponse] +}); +/** + * UpcomingGaugesPerDenom returns scheduled gauges that have not yet occured + * by denom + * @name getUpcomingGaugesPerDenom + * @package osmosis.incentives + * @see proto service: osmosis.incentives.UpcomingGaugesPerDenom + */ +export const getUpcomingGaugesPerDenom = buildQuery({ + encode: UpcomingGaugesPerDenomRequest.encode, + decode: UpcomingGaugesPerDenomResponse.decode, + service: "osmosis.incentives.Query", + method: "UpcomingGaugesPerDenom", + deps: [UpcomingGaugesPerDenomRequest, UpcomingGaugesPerDenomResponse] +}); +/** + * RewardsEst returns an estimate of the rewards from now until a specified + * time in the future The querier either provides an address or a set of locks + * for which they want to find the associated rewards + * @name getRewardsEst + * @package osmosis.incentives + * @see proto service: osmosis.incentives.RewardsEst + */ +export const getRewardsEst = buildQuery({ + encode: RewardsEstRequest.encode, + decode: RewardsEstResponse.decode, + service: "osmosis.incentives.Query", + method: "RewardsEst", + deps: [RewardsEstRequest, RewardsEstResponse] +}); +/** + * LockableDurations returns lockable durations that are valid to distribute + * incentives for + * @name getLockableDurations + * @package osmosis.incentives + * @see proto service: osmosis.incentives.LockableDurations + */ +export const getLockableDurations = buildQuery({ + encode: QueryLockableDurationsRequest.encode, + decode: QueryLockableDurationsResponse.decode, + service: "osmosis.incentives.Query", + method: "LockableDurations", + deps: [QueryLockableDurationsRequest, QueryLockableDurationsResponse] +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/osmosis/incentives/query.ts b/__fixtures__/v-next/outputv2/osmosis/incentives/query.ts index 285e2ee644..c29ffa63d9 100644 --- a/__fixtures__/v-next/outputv2/osmosis/incentives/query.ts +++ b/__fixtures__/v-next/outputv2/osmosis/incentives/query.ts @@ -5,6 +5,7 @@ import { Duration, DurationAmino, DurationSDKType } from "../../google/protobuf/ import { BinaryReader, BinaryWriter } from "../../binary"; import { JsonSafe } from "../../json-safe"; import { DeepPartial, isSet } from "../../helpers"; +import { GlobalDecoderRegistry } from "../../registry"; export const protobufPackage = "osmosis.incentives"; /** * @name ModuleToDistributeCoinsRequest @@ -762,6 +763,15 @@ function createBaseModuleToDistributeCoinsRequest(): ModuleToDistributeCoinsRequ export const ModuleToDistributeCoinsRequest = { typeUrl: "/osmosis.incentives.ModuleToDistributeCoinsRequest", aminoType: "osmosis/incentives/module-to-distribute-coins-request", + is(o: any): o is ModuleToDistributeCoinsRequest { + return o && o.$typeUrl === ModuleToDistributeCoinsRequest.typeUrl; + }, + isSDK(o: any): o is ModuleToDistributeCoinsRequestSDKType { + return o && o.$typeUrl === ModuleToDistributeCoinsRequest.typeUrl; + }, + isAmino(o: any): o is ModuleToDistributeCoinsRequestAmino { + return o && o.$typeUrl === ModuleToDistributeCoinsRequest.typeUrl; + }, encode(_: ModuleToDistributeCoinsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -826,7 +836,8 @@ export const ModuleToDistributeCoinsRequest = { typeUrl: "/osmosis.incentives.ModuleToDistributeCoinsRequest", value: ModuleToDistributeCoinsRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseModuleToDistributeCoinsResponse(): ModuleToDistributeCoinsResponse { return { @@ -841,6 +852,15 @@ function createBaseModuleToDistributeCoinsResponse(): ModuleToDistributeCoinsRes export const ModuleToDistributeCoinsResponse = { typeUrl: "/osmosis.incentives.ModuleToDistributeCoinsResponse", aminoType: "osmosis/incentives/module-to-distribute-coins-response", + is(o: any): o is ModuleToDistributeCoinsResponse { + return o && (o.$typeUrl === ModuleToDistributeCoinsResponse.typeUrl || Array.isArray(o.coins) && (!o.coins.length || Coin.is(o.coins[0]))); + }, + isSDK(o: any): o is ModuleToDistributeCoinsResponseSDKType { + return o && (o.$typeUrl === ModuleToDistributeCoinsResponse.typeUrl || Array.isArray(o.coins) && (!o.coins.length || Coin.isSDK(o.coins[0]))); + }, + isAmino(o: any): o is ModuleToDistributeCoinsResponseAmino { + return o && (o.$typeUrl === ModuleToDistributeCoinsResponse.typeUrl || Array.isArray(o.coins) && (!o.coins.length || Coin.isAmino(o.coins[0]))); + }, encode(message: ModuleToDistributeCoinsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.coins) { Coin.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -931,6 +951,12 @@ export const ModuleToDistributeCoinsResponse = { typeUrl: "/osmosis.incentives.ModuleToDistributeCoinsResponse", value: ModuleToDistributeCoinsResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ModuleToDistributeCoinsResponse.typeUrl)) { + return; + } + Coin.registerTypeUrl(); } }; function createBaseGaugeByIDRequest(): GaugeByIDRequest { @@ -946,6 +972,15 @@ function createBaseGaugeByIDRequest(): GaugeByIDRequest { export const GaugeByIDRequest = { typeUrl: "/osmosis.incentives.GaugeByIDRequest", aminoType: "osmosis/incentives/gauge-by-id-request", + is(o: any): o is GaugeByIDRequest { + return o && (o.$typeUrl === GaugeByIDRequest.typeUrl || typeof o.id === "bigint"); + }, + isSDK(o: any): o is GaugeByIDRequestSDKType { + return o && (o.$typeUrl === GaugeByIDRequest.typeUrl || typeof o.id === "bigint"); + }, + isAmino(o: any): o is GaugeByIDRequestAmino { + return o && (o.$typeUrl === GaugeByIDRequest.typeUrl || typeof o.id === "bigint"); + }, encode(message: GaugeByIDRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.id !== BigInt(0)) { writer.uint32(8).uint64(message.id); @@ -1028,7 +1063,8 @@ export const GaugeByIDRequest = { typeUrl: "/osmosis.incentives.GaugeByIDRequest", value: GaugeByIDRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseGaugeByIDResponse(): GaugeByIDResponse { return { @@ -1043,6 +1079,15 @@ function createBaseGaugeByIDResponse(): GaugeByIDResponse { export const GaugeByIDResponse = { typeUrl: "/osmosis.incentives.GaugeByIDResponse", aminoType: "osmosis/incentives/gauge-by-id-response", + is(o: any): o is GaugeByIDResponse { + return o && o.$typeUrl === GaugeByIDResponse.typeUrl; + }, + isSDK(o: any): o is GaugeByIDResponseSDKType { + return o && o.$typeUrl === GaugeByIDResponse.typeUrl; + }, + isAmino(o: any): o is GaugeByIDResponseAmino { + return o && o.$typeUrl === GaugeByIDResponse.typeUrl; + }, encode(message: GaugeByIDResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.gauge !== undefined) { Gauge.encode(message.gauge, writer.uint32(10).fork()).ldelim(); @@ -1125,6 +1170,12 @@ export const GaugeByIDResponse = { typeUrl: "/osmosis.incentives.GaugeByIDResponse", value: GaugeByIDResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GaugeByIDResponse.typeUrl)) { + return; + } + Gauge.registerTypeUrl(); } }; function createBaseGaugesRequest(): GaugesRequest { @@ -1140,6 +1191,15 @@ function createBaseGaugesRequest(): GaugesRequest { export const GaugesRequest = { typeUrl: "/osmosis.incentives.GaugesRequest", aminoType: "osmosis/incentives/gauges-request", + is(o: any): o is GaugesRequest { + return o && o.$typeUrl === GaugesRequest.typeUrl; + }, + isSDK(o: any): o is GaugesRequestSDKType { + return o && o.$typeUrl === GaugesRequest.typeUrl; + }, + isAmino(o: any): o is GaugesRequestAmino { + return o && o.$typeUrl === GaugesRequest.typeUrl; + }, encode(message: GaugesRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.pagination !== undefined) { PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); @@ -1222,6 +1282,12 @@ export const GaugesRequest = { typeUrl: "/osmosis.incentives.GaugesRequest", value: GaugesRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GaugesRequest.typeUrl)) { + return; + } + PageRequest.registerTypeUrl(); } }; function createBaseGaugesResponse(): GaugesResponse { @@ -1238,6 +1304,15 @@ function createBaseGaugesResponse(): GaugesResponse { export const GaugesResponse = { typeUrl: "/osmosis.incentives.GaugesResponse", aminoType: "osmosis/incentives/gauges-response", + is(o: any): o is GaugesResponse { + return o && (o.$typeUrl === GaugesResponse.typeUrl || Array.isArray(o.data) && (!o.data.length || Gauge.is(o.data[0]))); + }, + isSDK(o: any): o is GaugesResponseSDKType { + return o && (o.$typeUrl === GaugesResponse.typeUrl || Array.isArray(o.data) && (!o.data.length || Gauge.isSDK(o.data[0]))); + }, + isAmino(o: any): o is GaugesResponseAmino { + return o && (o.$typeUrl === GaugesResponse.typeUrl || Array.isArray(o.data) && (!o.data.length || Gauge.isAmino(o.data[0]))); + }, encode(message: GaugesResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.data) { Gauge.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -1345,6 +1420,13 @@ export const GaugesResponse = { typeUrl: "/osmosis.incentives.GaugesResponse", value: GaugesResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GaugesResponse.typeUrl)) { + return; + } + Gauge.registerTypeUrl(); + PageResponse.registerTypeUrl(); } }; function createBaseActiveGaugesRequest(): ActiveGaugesRequest { @@ -1360,6 +1442,15 @@ function createBaseActiveGaugesRequest(): ActiveGaugesRequest { export const ActiveGaugesRequest = { typeUrl: "/osmosis.incentives.ActiveGaugesRequest", aminoType: "osmosis/incentives/active-gauges-request", + is(o: any): o is ActiveGaugesRequest { + return o && o.$typeUrl === ActiveGaugesRequest.typeUrl; + }, + isSDK(o: any): o is ActiveGaugesRequestSDKType { + return o && o.$typeUrl === ActiveGaugesRequest.typeUrl; + }, + isAmino(o: any): o is ActiveGaugesRequestAmino { + return o && o.$typeUrl === ActiveGaugesRequest.typeUrl; + }, encode(message: ActiveGaugesRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.pagination !== undefined) { PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); @@ -1442,6 +1533,12 @@ export const ActiveGaugesRequest = { typeUrl: "/osmosis.incentives.ActiveGaugesRequest", value: ActiveGaugesRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ActiveGaugesRequest.typeUrl)) { + return; + } + PageRequest.registerTypeUrl(); } }; function createBaseActiveGaugesResponse(): ActiveGaugesResponse { @@ -1458,6 +1555,15 @@ function createBaseActiveGaugesResponse(): ActiveGaugesResponse { export const ActiveGaugesResponse = { typeUrl: "/osmosis.incentives.ActiveGaugesResponse", aminoType: "osmosis/incentives/active-gauges-response", + is(o: any): o is ActiveGaugesResponse { + return o && (o.$typeUrl === ActiveGaugesResponse.typeUrl || Array.isArray(o.data) && (!o.data.length || Gauge.is(o.data[0]))); + }, + isSDK(o: any): o is ActiveGaugesResponseSDKType { + return o && (o.$typeUrl === ActiveGaugesResponse.typeUrl || Array.isArray(o.data) && (!o.data.length || Gauge.isSDK(o.data[0]))); + }, + isAmino(o: any): o is ActiveGaugesResponseAmino { + return o && (o.$typeUrl === ActiveGaugesResponse.typeUrl || Array.isArray(o.data) && (!o.data.length || Gauge.isAmino(o.data[0]))); + }, encode(message: ActiveGaugesResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.data) { Gauge.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -1565,6 +1671,13 @@ export const ActiveGaugesResponse = { typeUrl: "/osmosis.incentives.ActiveGaugesResponse", value: ActiveGaugesResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ActiveGaugesResponse.typeUrl)) { + return; + } + Gauge.registerTypeUrl(); + PageResponse.registerTypeUrl(); } }; function createBaseActiveGaugesPerDenomRequest(): ActiveGaugesPerDenomRequest { @@ -1581,6 +1694,15 @@ function createBaseActiveGaugesPerDenomRequest(): ActiveGaugesPerDenomRequest { export const ActiveGaugesPerDenomRequest = { typeUrl: "/osmosis.incentives.ActiveGaugesPerDenomRequest", aminoType: "osmosis/incentives/active-gauges-per-denom-request", + is(o: any): o is ActiveGaugesPerDenomRequest { + return o && (o.$typeUrl === ActiveGaugesPerDenomRequest.typeUrl || typeof o.denom === "string"); + }, + isSDK(o: any): o is ActiveGaugesPerDenomRequestSDKType { + return o && (o.$typeUrl === ActiveGaugesPerDenomRequest.typeUrl || typeof o.denom === "string"); + }, + isAmino(o: any): o is ActiveGaugesPerDenomRequestAmino { + return o && (o.$typeUrl === ActiveGaugesPerDenomRequest.typeUrl || typeof o.denom === "string"); + }, encode(message: ActiveGaugesPerDenomRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.denom !== "") { writer.uint32(10).string(message.denom); @@ -1678,6 +1800,12 @@ export const ActiveGaugesPerDenomRequest = { typeUrl: "/osmosis.incentives.ActiveGaugesPerDenomRequest", value: ActiveGaugesPerDenomRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ActiveGaugesPerDenomRequest.typeUrl)) { + return; + } + PageRequest.registerTypeUrl(); } }; function createBaseActiveGaugesPerDenomResponse(): ActiveGaugesPerDenomResponse { @@ -1694,6 +1822,15 @@ function createBaseActiveGaugesPerDenomResponse(): ActiveGaugesPerDenomResponse export const ActiveGaugesPerDenomResponse = { typeUrl: "/osmosis.incentives.ActiveGaugesPerDenomResponse", aminoType: "osmosis/incentives/active-gauges-per-denom-response", + is(o: any): o is ActiveGaugesPerDenomResponse { + return o && (o.$typeUrl === ActiveGaugesPerDenomResponse.typeUrl || Array.isArray(o.data) && (!o.data.length || Gauge.is(o.data[0]))); + }, + isSDK(o: any): o is ActiveGaugesPerDenomResponseSDKType { + return o && (o.$typeUrl === ActiveGaugesPerDenomResponse.typeUrl || Array.isArray(o.data) && (!o.data.length || Gauge.isSDK(o.data[0]))); + }, + isAmino(o: any): o is ActiveGaugesPerDenomResponseAmino { + return o && (o.$typeUrl === ActiveGaugesPerDenomResponse.typeUrl || Array.isArray(o.data) && (!o.data.length || Gauge.isAmino(o.data[0]))); + }, encode(message: ActiveGaugesPerDenomResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.data) { Gauge.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -1801,6 +1938,13 @@ export const ActiveGaugesPerDenomResponse = { typeUrl: "/osmosis.incentives.ActiveGaugesPerDenomResponse", value: ActiveGaugesPerDenomResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ActiveGaugesPerDenomResponse.typeUrl)) { + return; + } + Gauge.registerTypeUrl(); + PageResponse.registerTypeUrl(); } }; function createBaseUpcomingGaugesRequest(): UpcomingGaugesRequest { @@ -1816,6 +1960,15 @@ function createBaseUpcomingGaugesRequest(): UpcomingGaugesRequest { export const UpcomingGaugesRequest = { typeUrl: "/osmosis.incentives.UpcomingGaugesRequest", aminoType: "osmosis/incentives/upcoming-gauges-request", + is(o: any): o is UpcomingGaugesRequest { + return o && o.$typeUrl === UpcomingGaugesRequest.typeUrl; + }, + isSDK(o: any): o is UpcomingGaugesRequestSDKType { + return o && o.$typeUrl === UpcomingGaugesRequest.typeUrl; + }, + isAmino(o: any): o is UpcomingGaugesRequestAmino { + return o && o.$typeUrl === UpcomingGaugesRequest.typeUrl; + }, encode(message: UpcomingGaugesRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.pagination !== undefined) { PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); @@ -1898,6 +2051,12 @@ export const UpcomingGaugesRequest = { typeUrl: "/osmosis.incentives.UpcomingGaugesRequest", value: UpcomingGaugesRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(UpcomingGaugesRequest.typeUrl)) { + return; + } + PageRequest.registerTypeUrl(); } }; function createBaseUpcomingGaugesResponse(): UpcomingGaugesResponse { @@ -1914,6 +2073,15 @@ function createBaseUpcomingGaugesResponse(): UpcomingGaugesResponse { export const UpcomingGaugesResponse = { typeUrl: "/osmosis.incentives.UpcomingGaugesResponse", aminoType: "osmosis/incentives/upcoming-gauges-response", + is(o: any): o is UpcomingGaugesResponse { + return o && (o.$typeUrl === UpcomingGaugesResponse.typeUrl || Array.isArray(o.data) && (!o.data.length || Gauge.is(o.data[0]))); + }, + isSDK(o: any): o is UpcomingGaugesResponseSDKType { + return o && (o.$typeUrl === UpcomingGaugesResponse.typeUrl || Array.isArray(o.data) && (!o.data.length || Gauge.isSDK(o.data[0]))); + }, + isAmino(o: any): o is UpcomingGaugesResponseAmino { + return o && (o.$typeUrl === UpcomingGaugesResponse.typeUrl || Array.isArray(o.data) && (!o.data.length || Gauge.isAmino(o.data[0]))); + }, encode(message: UpcomingGaugesResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.data) { Gauge.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -2021,6 +2189,13 @@ export const UpcomingGaugesResponse = { typeUrl: "/osmosis.incentives.UpcomingGaugesResponse", value: UpcomingGaugesResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(UpcomingGaugesResponse.typeUrl)) { + return; + } + Gauge.registerTypeUrl(); + PageResponse.registerTypeUrl(); } }; function createBaseUpcomingGaugesPerDenomRequest(): UpcomingGaugesPerDenomRequest { @@ -2037,6 +2212,15 @@ function createBaseUpcomingGaugesPerDenomRequest(): UpcomingGaugesPerDenomReques export const UpcomingGaugesPerDenomRequest = { typeUrl: "/osmosis.incentives.UpcomingGaugesPerDenomRequest", aminoType: "osmosis/incentives/upcoming-gauges-per-denom-request", + is(o: any): o is UpcomingGaugesPerDenomRequest { + return o && (o.$typeUrl === UpcomingGaugesPerDenomRequest.typeUrl || typeof o.denom === "string"); + }, + isSDK(o: any): o is UpcomingGaugesPerDenomRequestSDKType { + return o && (o.$typeUrl === UpcomingGaugesPerDenomRequest.typeUrl || typeof o.denom === "string"); + }, + isAmino(o: any): o is UpcomingGaugesPerDenomRequestAmino { + return o && (o.$typeUrl === UpcomingGaugesPerDenomRequest.typeUrl || typeof o.denom === "string"); + }, encode(message: UpcomingGaugesPerDenomRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.denom !== "") { writer.uint32(10).string(message.denom); @@ -2134,6 +2318,12 @@ export const UpcomingGaugesPerDenomRequest = { typeUrl: "/osmosis.incentives.UpcomingGaugesPerDenomRequest", value: UpcomingGaugesPerDenomRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(UpcomingGaugesPerDenomRequest.typeUrl)) { + return; + } + PageRequest.registerTypeUrl(); } }; function createBaseUpcomingGaugesPerDenomResponse(): UpcomingGaugesPerDenomResponse { @@ -2150,6 +2340,15 @@ function createBaseUpcomingGaugesPerDenomResponse(): UpcomingGaugesPerDenomRespo export const UpcomingGaugesPerDenomResponse = { typeUrl: "/osmosis.incentives.UpcomingGaugesPerDenomResponse", aminoType: "osmosis/incentives/upcoming-gauges-per-denom-response", + is(o: any): o is UpcomingGaugesPerDenomResponse { + return o && (o.$typeUrl === UpcomingGaugesPerDenomResponse.typeUrl || Array.isArray(o.upcomingGauges) && (!o.upcomingGauges.length || Gauge.is(o.upcomingGauges[0]))); + }, + isSDK(o: any): o is UpcomingGaugesPerDenomResponseSDKType { + return o && (o.$typeUrl === UpcomingGaugesPerDenomResponse.typeUrl || Array.isArray(o.upcoming_gauges) && (!o.upcoming_gauges.length || Gauge.isSDK(o.upcoming_gauges[0]))); + }, + isAmino(o: any): o is UpcomingGaugesPerDenomResponseAmino { + return o && (o.$typeUrl === UpcomingGaugesPerDenomResponse.typeUrl || Array.isArray(o.upcoming_gauges) && (!o.upcoming_gauges.length || Gauge.isAmino(o.upcoming_gauges[0]))); + }, encode(message: UpcomingGaugesPerDenomResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.upcomingGauges) { Gauge.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -2257,6 +2456,13 @@ export const UpcomingGaugesPerDenomResponse = { typeUrl: "/osmosis.incentives.UpcomingGaugesPerDenomResponse", value: UpcomingGaugesPerDenomResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(UpcomingGaugesPerDenomResponse.typeUrl)) { + return; + } + Gauge.registerTypeUrl(); + PageResponse.registerTypeUrl(); } }; function createBaseRewardsEstRequest(): RewardsEstRequest { @@ -2274,6 +2480,15 @@ function createBaseRewardsEstRequest(): RewardsEstRequest { export const RewardsEstRequest = { typeUrl: "/osmosis.incentives.RewardsEstRequest", aminoType: "osmosis/incentives/rewards-est-request", + is(o: any): o is RewardsEstRequest { + return o && (o.$typeUrl === RewardsEstRequest.typeUrl || typeof o.owner === "string" && Array.isArray(o.lockIds) && (!o.lockIds.length || typeof o.lockIds[0] === "bigint") && typeof o.endEpoch === "bigint"); + }, + isSDK(o: any): o is RewardsEstRequestSDKType { + return o && (o.$typeUrl === RewardsEstRequest.typeUrl || typeof o.owner === "string" && Array.isArray(o.lock_ids) && (!o.lock_ids.length || typeof o.lock_ids[0] === "bigint") && typeof o.end_epoch === "bigint"); + }, + isAmino(o: any): o is RewardsEstRequestAmino { + return o && (o.$typeUrl === RewardsEstRequest.typeUrl || typeof o.owner === "string" && Array.isArray(o.lock_ids) && (!o.lock_ids.length || typeof o.lock_ids[0] === "bigint") && typeof o.end_epoch === "bigint"); + }, encode(message: RewardsEstRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.owner !== "") { writer.uint32(10).string(message.owner); @@ -2405,7 +2620,8 @@ export const RewardsEstRequest = { typeUrl: "/osmosis.incentives.RewardsEstRequest", value: RewardsEstRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseRewardsEstResponse(): RewardsEstResponse { return { @@ -2420,6 +2636,15 @@ function createBaseRewardsEstResponse(): RewardsEstResponse { export const RewardsEstResponse = { typeUrl: "/osmosis.incentives.RewardsEstResponse", aminoType: "osmosis/incentives/rewards-est-response", + is(o: any): o is RewardsEstResponse { + return o && (o.$typeUrl === RewardsEstResponse.typeUrl || Array.isArray(o.coins) && (!o.coins.length || Coin.is(o.coins[0]))); + }, + isSDK(o: any): o is RewardsEstResponseSDKType { + return o && (o.$typeUrl === RewardsEstResponse.typeUrl || Array.isArray(o.coins) && (!o.coins.length || Coin.isSDK(o.coins[0]))); + }, + isAmino(o: any): o is RewardsEstResponseAmino { + return o && (o.$typeUrl === RewardsEstResponse.typeUrl || Array.isArray(o.coins) && (!o.coins.length || Coin.isAmino(o.coins[0]))); + }, encode(message: RewardsEstResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.coins) { Coin.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -2510,6 +2735,12 @@ export const RewardsEstResponse = { typeUrl: "/osmosis.incentives.RewardsEstResponse", value: RewardsEstResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(RewardsEstResponse.typeUrl)) { + return; + } + Coin.registerTypeUrl(); } }; function createBaseQueryLockableDurationsRequest(): QueryLockableDurationsRequest { @@ -2523,6 +2754,15 @@ function createBaseQueryLockableDurationsRequest(): QueryLockableDurationsReques export const QueryLockableDurationsRequest = { typeUrl: "/osmosis.incentives.QueryLockableDurationsRequest", aminoType: "osmosis/incentives/query-lockable-durations-request", + is(o: any): o is QueryLockableDurationsRequest { + return o && o.$typeUrl === QueryLockableDurationsRequest.typeUrl; + }, + isSDK(o: any): o is QueryLockableDurationsRequestSDKType { + return o && o.$typeUrl === QueryLockableDurationsRequest.typeUrl; + }, + isAmino(o: any): o is QueryLockableDurationsRequestAmino { + return o && o.$typeUrl === QueryLockableDurationsRequest.typeUrl; + }, encode(_: QueryLockableDurationsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -2587,7 +2827,8 @@ export const QueryLockableDurationsRequest = { typeUrl: "/osmosis.incentives.QueryLockableDurationsRequest", value: QueryLockableDurationsRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryLockableDurationsResponse(): QueryLockableDurationsResponse { return { @@ -2602,6 +2843,15 @@ function createBaseQueryLockableDurationsResponse(): QueryLockableDurationsRespo export const QueryLockableDurationsResponse = { typeUrl: "/osmosis.incentives.QueryLockableDurationsResponse", aminoType: "osmosis/incentives/query-lockable-durations-response", + is(o: any): o is QueryLockableDurationsResponse { + return o && (o.$typeUrl === QueryLockableDurationsResponse.typeUrl || Array.isArray(o.lockableDurations) && (!o.lockableDurations.length || Duration.is(o.lockableDurations[0]))); + }, + isSDK(o: any): o is QueryLockableDurationsResponseSDKType { + return o && (o.$typeUrl === QueryLockableDurationsResponse.typeUrl || Array.isArray(o.lockable_durations) && (!o.lockable_durations.length || Duration.isSDK(o.lockable_durations[0]))); + }, + isAmino(o: any): o is QueryLockableDurationsResponseAmino { + return o && (o.$typeUrl === QueryLockableDurationsResponse.typeUrl || Array.isArray(o.lockable_durations) && (!o.lockable_durations.length || Duration.isAmino(o.lockable_durations[0]))); + }, encode(message: QueryLockableDurationsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.lockableDurations) { Duration.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -2692,5 +2942,6 @@ export const QueryLockableDurationsResponse = { typeUrl: "/osmosis.incentives.QueryLockableDurationsResponse", value: QueryLockableDurationsResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/osmosis/incentives/tx.registry.ts b/__fixtures__/v-next/outputv2/osmosis/incentives/tx.registry.ts index 9f1e031995..0adcbe6447 100644 --- a/__fixtures__/v-next/outputv2/osmosis/incentives/tx.registry.ts +++ b/__fixtures__/v-next/outputv2/osmosis/incentives/tx.registry.ts @@ -1,11 +1,6 @@ -import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { TelescopeGeneratedType } from "../../types"; import { MsgCreateGauge, MsgAddToGauge } from "./tx"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/osmosis.incentives.MsgCreateGauge", MsgCreateGauge], ["/osmosis.incentives.MsgAddToGauge", MsgAddToGauge]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/osmosis.incentives.MsgCreateGauge", MsgCreateGauge], ["/osmosis.incentives.MsgAddToGauge", MsgAddToGauge]]; export const MessageComposer = { encoded: { createGauge(value: MsgCreateGauge) { diff --git a/__fixtures__/v-next/outputv2/osmosis/incentives/tx.rpc.func.ts b/__fixtures__/v-next/outputv2/osmosis/incentives/tx.rpc.func.ts new file mode 100644 index 0000000000..48db9b68d2 --- /dev/null +++ b/__fixtures__/v-next/outputv2/osmosis/incentives/tx.rpc.func.ts @@ -0,0 +1,18 @@ +import { buildTx } from "../../helper-func-types"; +import { MsgCreateGauge, MsgAddToGauge } from "./tx"; +/** + * @name createGauge + * @package osmosis.incentives + * @see proto service: osmosis.incentives.CreateGauge + */ +export const createGauge = buildTx({ + msg: MsgCreateGauge +}); +/** + * @name addToGauge + * @package osmosis.incentives + * @see proto service: osmosis.incentives.AddToGauge + */ +export const addToGauge = buildTx({ + msg: MsgAddToGauge +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/osmosis/incentives/tx.ts b/__fixtures__/v-next/outputv2/osmosis/incentives/tx.ts index f10df47505..9dcb8fa030 100644 --- a/__fixtures__/v-next/outputv2/osmosis/incentives/tx.ts +++ b/__fixtures__/v-next/outputv2/osmosis/incentives/tx.ts @@ -2,6 +2,7 @@ import { QueryCondition, QueryConditionAmino, QueryConditionSDKType } from "../l import { Coin, CoinAmino, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; import { Timestamp } from "../../google/protobuf/timestamp"; import { BinaryReader, BinaryWriter } from "../../binary"; +import { GlobalDecoderRegistry } from "../../registry"; import { toTimestamp, fromTimestamp, isSet, DeepPartial } from "../../helpers"; import { JsonSafe } from "../../json-safe"; export const protobufPackage = "osmosis.incentives"; @@ -233,6 +234,15 @@ function createBaseMsgCreateGauge(): MsgCreateGauge { export const MsgCreateGauge = { typeUrl: "/osmosis.incentives.MsgCreateGauge", aminoType: "osmosis/incentives/create-gauge", + is(o: any): o is MsgCreateGauge { + return o && (o.$typeUrl === MsgCreateGauge.typeUrl || typeof o.isPerpetual === "boolean" && typeof o.owner === "string" && QueryCondition.is(o.distributeTo) && Array.isArray(o.coins) && (!o.coins.length || Coin.is(o.coins[0])) && Timestamp.is(o.startTime) && typeof o.numEpochsPaidOver === "bigint"); + }, + isSDK(o: any): o is MsgCreateGaugeSDKType { + return o && (o.$typeUrl === MsgCreateGauge.typeUrl || typeof o.is_perpetual === "boolean" && typeof o.owner === "string" && QueryCondition.isSDK(o.distribute_to) && Array.isArray(o.coins) && (!o.coins.length || Coin.isSDK(o.coins[0])) && Timestamp.isSDK(o.start_time) && typeof o.num_epochs_paid_over === "bigint"); + }, + isAmino(o: any): o is MsgCreateGaugeAmino { + return o && (o.$typeUrl === MsgCreateGauge.typeUrl || typeof o.is_perpetual === "boolean" && typeof o.owner === "string" && QueryCondition.isAmino(o.distribute_to) && Array.isArray(o.coins) && (!o.coins.length || Coin.isAmino(o.coins[0])) && Timestamp.isAmino(o.start_time) && typeof o.num_epochs_paid_over === "bigint"); + }, encode(message: MsgCreateGauge, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.isPerpetual === true) { writer.uint32(8).bool(message.isPerpetual); @@ -402,6 +412,13 @@ export const MsgCreateGauge = { typeUrl: "/osmosis.incentives.MsgCreateGauge", value: MsgCreateGauge.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgCreateGauge.typeUrl)) { + return; + } + QueryCondition.registerTypeUrl(); + Coin.registerTypeUrl(); } }; function createBaseMsgCreateGaugeResponse(): MsgCreateGaugeResponse { @@ -415,6 +432,15 @@ function createBaseMsgCreateGaugeResponse(): MsgCreateGaugeResponse { export const MsgCreateGaugeResponse = { typeUrl: "/osmosis.incentives.MsgCreateGaugeResponse", aminoType: "osmosis/incentives/create-gauge-response", + is(o: any): o is MsgCreateGaugeResponse { + return o && o.$typeUrl === MsgCreateGaugeResponse.typeUrl; + }, + isSDK(o: any): o is MsgCreateGaugeResponseSDKType { + return o && o.$typeUrl === MsgCreateGaugeResponse.typeUrl; + }, + isAmino(o: any): o is MsgCreateGaugeResponseAmino { + return o && o.$typeUrl === MsgCreateGaugeResponse.typeUrl; + }, encode(_: MsgCreateGaugeResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -479,7 +505,8 @@ export const MsgCreateGaugeResponse = { typeUrl: "/osmosis.incentives.MsgCreateGaugeResponse", value: MsgCreateGaugeResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgAddToGauge(): MsgAddToGauge { return { @@ -497,6 +524,15 @@ function createBaseMsgAddToGauge(): MsgAddToGauge { export const MsgAddToGauge = { typeUrl: "/osmosis.incentives.MsgAddToGauge", aminoType: "osmosis/incentives/add-to-gauge", + is(o: any): o is MsgAddToGauge { + return o && (o.$typeUrl === MsgAddToGauge.typeUrl || typeof o.owner === "string" && typeof o.gaugeId === "bigint" && Array.isArray(o.rewards) && (!o.rewards.length || Coin.is(o.rewards[0]))); + }, + isSDK(o: any): o is MsgAddToGaugeSDKType { + return o && (o.$typeUrl === MsgAddToGauge.typeUrl || typeof o.owner === "string" && typeof o.gauge_id === "bigint" && Array.isArray(o.rewards) && (!o.rewards.length || Coin.isSDK(o.rewards[0]))); + }, + isAmino(o: any): o is MsgAddToGaugeAmino { + return o && (o.$typeUrl === MsgAddToGauge.typeUrl || typeof o.owner === "string" && typeof o.gauge_id === "bigint" && Array.isArray(o.rewards) && (!o.rewards.length || Coin.isAmino(o.rewards[0]))); + }, encode(message: MsgAddToGauge, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.owner !== "") { writer.uint32(10).string(message.owner); @@ -619,6 +655,12 @@ export const MsgAddToGauge = { typeUrl: "/osmosis.incentives.MsgAddToGauge", value: MsgAddToGauge.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgAddToGauge.typeUrl)) { + return; + } + Coin.registerTypeUrl(); } }; function createBaseMsgAddToGaugeResponse(): MsgAddToGaugeResponse { @@ -632,6 +674,15 @@ function createBaseMsgAddToGaugeResponse(): MsgAddToGaugeResponse { export const MsgAddToGaugeResponse = { typeUrl: "/osmosis.incentives.MsgAddToGaugeResponse", aminoType: "osmosis/incentives/add-to-gauge-response", + is(o: any): o is MsgAddToGaugeResponse { + return o && o.$typeUrl === MsgAddToGaugeResponse.typeUrl; + }, + isSDK(o: any): o is MsgAddToGaugeResponseSDKType { + return o && o.$typeUrl === MsgAddToGaugeResponse.typeUrl; + }, + isAmino(o: any): o is MsgAddToGaugeResponseAmino { + return o && o.$typeUrl === MsgAddToGaugeResponse.typeUrl; + }, encode(_: MsgAddToGaugeResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -696,5 +747,6 @@ export const MsgAddToGaugeResponse = { typeUrl: "/osmosis.incentives.MsgAddToGaugeResponse", value: MsgAddToGaugeResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/osmosis/lockup/genesis.ts b/__fixtures__/v-next/outputv2/osmosis/lockup/genesis.ts index 4107293a87..dfbd9c22db 100644 --- a/__fixtures__/v-next/outputv2/osmosis/lockup/genesis.ts +++ b/__fixtures__/v-next/outputv2/osmosis/lockup/genesis.ts @@ -2,6 +2,7 @@ import { PeriodLock, PeriodLockAmino, PeriodLockSDKType, SyntheticLock, Syntheti import { BinaryReader, BinaryWriter } from "../../binary"; import { isSet, DeepPartial } from "../../helpers"; import { JsonSafe } from "../../json-safe"; +import { GlobalDecoderRegistry } from "../../registry"; export const protobufPackage = "osmosis.lockup"; /** * GenesisState defines the lockup module's genesis state. @@ -60,6 +61,15 @@ function createBaseGenesisState(): GenesisState { export const GenesisState = { typeUrl: "/osmosis.lockup.GenesisState", aminoType: "osmosis/lockup/genesis-state", + is(o: any): o is GenesisState { + return o && (o.$typeUrl === GenesisState.typeUrl || typeof o.lastLockId === "bigint" && Array.isArray(o.locks) && (!o.locks.length || PeriodLock.is(o.locks[0])) && Array.isArray(o.syntheticLocks) && (!o.syntheticLocks.length || SyntheticLock.is(o.syntheticLocks[0]))); + }, + isSDK(o: any): o is GenesisStateSDKType { + return o && (o.$typeUrl === GenesisState.typeUrl || typeof o.last_lock_id === "bigint" && Array.isArray(o.locks) && (!o.locks.length || PeriodLock.isSDK(o.locks[0])) && Array.isArray(o.synthetic_locks) && (!o.synthetic_locks.length || SyntheticLock.isSDK(o.synthetic_locks[0]))); + }, + isAmino(o: any): o is GenesisStateAmino { + return o && (o.$typeUrl === GenesisState.typeUrl || typeof o.last_lock_id === "bigint" && Array.isArray(o.locks) && (!o.locks.length || PeriodLock.isAmino(o.locks[0])) && Array.isArray(o.synthetic_locks) && (!o.synthetic_locks.length || SyntheticLock.isAmino(o.synthetic_locks[0]))); + }, encode(message: GenesisState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.lastLockId !== BigInt(0)) { writer.uint32(8).uint64(message.lastLockId); @@ -192,5 +202,12 @@ export const GenesisState = { typeUrl: "/osmosis.lockup.GenesisState", value: GenesisState.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GenesisState.typeUrl)) { + return; + } + PeriodLock.registerTypeUrl(); + SyntheticLock.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/osmosis/lockup/lock.ts b/__fixtures__/v-next/outputv2/osmosis/lockup/lock.ts index d779825812..54986d58e5 100644 --- a/__fixtures__/v-next/outputv2/osmosis/lockup/lock.ts +++ b/__fixtures__/v-next/outputv2/osmosis/lockup/lock.ts @@ -2,6 +2,7 @@ import { Duration, DurationAmino, DurationSDKType } from "../../google/protobuf/ import { Timestamp } from "../../google/protobuf/timestamp"; import { Coin, CoinAmino, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../binary"; +import { GlobalDecoderRegistry } from "../../registry"; import { toTimestamp, fromTimestamp, isSet, DeepPartial } from "../../helpers"; import { JsonSafe } from "../../json-safe"; export const protobufPackage = "osmosis.lockup"; @@ -331,6 +332,15 @@ function createBasePeriodLock(): PeriodLock { export const PeriodLock = { typeUrl: "/osmosis.lockup.PeriodLock", aminoType: "osmosis/lockup/period-lock", + is(o: any): o is PeriodLock { + return o && (o.$typeUrl === PeriodLock.typeUrl || typeof o.iD === "bigint" && typeof o.owner === "string" && Duration.is(o.duration) && Timestamp.is(o.endTime) && Array.isArray(o.coins) && (!o.coins.length || Coin.is(o.coins[0]))); + }, + isSDK(o: any): o is PeriodLockSDKType { + return o && (o.$typeUrl === PeriodLock.typeUrl || typeof o.ID === "bigint" && typeof o.owner === "string" && Duration.isSDK(o.duration) && Timestamp.isSDK(o.end_time) && Array.isArray(o.coins) && (!o.coins.length || Coin.isSDK(o.coins[0]))); + }, + isAmino(o: any): o is PeriodLockAmino { + return o && (o.$typeUrl === PeriodLock.typeUrl || typeof o.ID === "bigint" && typeof o.owner === "string" && Duration.isAmino(o.duration) && Timestamp.isAmino(o.end_time) && Array.isArray(o.coins) && (!o.coins.length || Coin.isAmino(o.coins[0]))); + }, encode(message: PeriodLock, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.iD !== BigInt(0)) { writer.uint32(8).uint64(message.iD); @@ -485,6 +495,12 @@ export const PeriodLock = { typeUrl: "/osmosis.lockup.PeriodLock", value: PeriodLock.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(PeriodLock.typeUrl)) { + return; + } + Coin.registerTypeUrl(); } }; function createBaseQueryCondition(): QueryCondition { @@ -506,6 +522,15 @@ function createBaseQueryCondition(): QueryCondition { export const QueryCondition = { typeUrl: "/osmosis.lockup.QueryCondition", aminoType: "osmosis/lockup/query-condition", + is(o: any): o is QueryCondition { + return o && (o.$typeUrl === QueryCondition.typeUrl || isSet(o.lockQueryType) && typeof o.denom === "string" && Duration.is(o.duration) && Timestamp.is(o.timestamp)); + }, + isSDK(o: any): o is QueryConditionSDKType { + return o && (o.$typeUrl === QueryCondition.typeUrl || isSet(o.lock_query_type) && typeof o.denom === "string" && Duration.isSDK(o.duration) && Timestamp.isSDK(o.timestamp)); + }, + isAmino(o: any): o is QueryConditionAmino { + return o && (o.$typeUrl === QueryCondition.typeUrl || isSet(o.lock_query_type) && typeof o.denom === "string" && Duration.isAmino(o.duration) && Timestamp.isAmino(o.timestamp)); + }, encode(message: QueryCondition, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.lockQueryType !== 0) { writer.uint32(8).int32(message.lockQueryType); @@ -633,7 +658,8 @@ export const QueryCondition = { typeUrl: "/osmosis.lockup.QueryCondition", value: QueryCondition.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseSyntheticLock(): SyntheticLock { return { @@ -655,6 +681,15 @@ function createBaseSyntheticLock(): SyntheticLock { export const SyntheticLock = { typeUrl: "/osmosis.lockup.SyntheticLock", aminoType: "osmosis/lockup/synthetic-lock", + is(o: any): o is SyntheticLock { + return o && (o.$typeUrl === SyntheticLock.typeUrl || typeof o.underlyingLockId === "bigint" && typeof o.synthDenom === "string" && Timestamp.is(o.endTime) && Duration.is(o.duration)); + }, + isSDK(o: any): o is SyntheticLockSDKType { + return o && (o.$typeUrl === SyntheticLock.typeUrl || typeof o.underlying_lock_id === "bigint" && typeof o.synth_denom === "string" && Timestamp.isSDK(o.end_time) && Duration.isSDK(o.duration)); + }, + isAmino(o: any): o is SyntheticLockAmino { + return o && (o.$typeUrl === SyntheticLock.typeUrl || typeof o.underlying_lock_id === "bigint" && typeof o.synth_denom === "string" && Timestamp.isAmino(o.end_time) && Duration.isAmino(o.duration)); + }, encode(message: SyntheticLock, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.underlyingLockId !== BigInt(0)) { writer.uint32(8).uint64(message.underlyingLockId); @@ -784,5 +819,6 @@ export const SyntheticLock = { typeUrl: "/osmosis.lockup.SyntheticLock", value: SyntheticLock.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/osmosis/lockup/params.ts b/__fixtures__/v-next/outputv2/osmosis/lockup/params.ts index 1621969895..8c6770538c 100644 --- a/__fixtures__/v-next/outputv2/osmosis/lockup/params.ts +++ b/__fixtures__/v-next/outputv2/osmosis/lockup/params.ts @@ -47,6 +47,15 @@ function createBaseParams(): Params { export const Params = { typeUrl: "/osmosis.lockup.Params", aminoType: "osmosis/lockup/params", + is(o: any): o is Params { + return o && (o.$typeUrl === Params.typeUrl || Array.isArray(o.forceUnlockAllowedAddresses) && (!o.forceUnlockAllowedAddresses.length || typeof o.forceUnlockAllowedAddresses[0] === "string")); + }, + isSDK(o: any): o is ParamsSDKType { + return o && (o.$typeUrl === Params.typeUrl || Array.isArray(o.force_unlock_allowed_addresses) && (!o.force_unlock_allowed_addresses.length || typeof o.force_unlock_allowed_addresses[0] === "string")); + }, + isAmino(o: any): o is ParamsAmino { + return o && (o.$typeUrl === Params.typeUrl || Array.isArray(o.force_unlock_allowed_addresses) && (!o.force_unlock_allowed_addresses.length || typeof o.force_unlock_allowed_addresses[0] === "string")); + }, encode(message: Params, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.forceUnlockAllowedAddresses) { writer.uint32(10).string(v!); @@ -137,5 +146,6 @@ export const Params = { typeUrl: "/osmosis.lockup.Params", value: Params.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/osmosis/lockup/query.rpc.func.ts b/__fixtures__/v-next/outputv2/osmosis/lockup/query.rpc.func.ts new file mode 100644 index 0000000000..c3e36b9c10 --- /dev/null +++ b/__fixtures__/v-next/outputv2/osmosis/lockup/query.rpc.func.ts @@ -0,0 +1,225 @@ +import { buildQuery } from "../../helper-func-types"; +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"; +/** + * Return full balance of the module + * @name getModuleBalance + * @package osmosis.lockup + * @see proto service: osmosis.lockup.ModuleBalance + */ +export const getModuleBalance = buildQuery({ + encode: ModuleBalanceRequest.encode, + decode: ModuleBalanceResponse.decode, + service: "osmosis.lockup.Query", + method: "ModuleBalance", + deps: [ModuleBalanceRequest, ModuleBalanceResponse] +}); +/** + * Return locked balance of the module + * @name getModuleLockedAmount + * @package osmosis.lockup + * @see proto service: osmosis.lockup.ModuleLockedAmount + */ +export const getModuleLockedAmount = buildQuery({ + encode: ModuleLockedAmountRequest.encode, + decode: ModuleLockedAmountResponse.decode, + service: "osmosis.lockup.Query", + method: "ModuleLockedAmount", + deps: [ModuleLockedAmountRequest, ModuleLockedAmountResponse] +}); +/** + * Returns unlockable coins which are not withdrawn yet + * @name getAccountUnlockableCoins + * @package osmosis.lockup + * @see proto service: osmosis.lockup.AccountUnlockableCoins + */ +export const getAccountUnlockableCoins = buildQuery({ + encode: AccountUnlockableCoinsRequest.encode, + decode: AccountUnlockableCoinsResponse.decode, + service: "osmosis.lockup.Query", + method: "AccountUnlockableCoins", + deps: [AccountUnlockableCoinsRequest, AccountUnlockableCoinsResponse] +}); +/** + * Returns unlocking coins + * @name getAccountUnlockingCoins + * @package osmosis.lockup + * @see proto service: osmosis.lockup.AccountUnlockingCoins + */ +export const getAccountUnlockingCoins = buildQuery({ + encode: AccountUnlockingCoinsRequest.encode, + decode: AccountUnlockingCoinsResponse.decode, + service: "osmosis.lockup.Query", + method: "AccountUnlockingCoins", + deps: [AccountUnlockingCoinsRequest, AccountUnlockingCoinsResponse] +}); +/** + * Return a locked coins that can't be withdrawn + * @name getAccountLockedCoins + * @package osmosis.lockup + * @see proto service: osmosis.lockup.AccountLockedCoins + */ +export const getAccountLockedCoins = buildQuery({ + encode: AccountLockedCoinsRequest.encode, + decode: AccountLockedCoinsResponse.decode, + service: "osmosis.lockup.Query", + method: "AccountLockedCoins", + deps: [AccountLockedCoinsRequest, AccountLockedCoinsResponse] +}); +/** + * Returns locked records of an account with unlock time beyond timestamp + * @name getAccountLockedPastTime + * @package osmosis.lockup + * @see proto service: osmosis.lockup.AccountLockedPastTime + */ +export const getAccountLockedPastTime = buildQuery({ + encode: AccountLockedPastTimeRequest.encode, + decode: AccountLockedPastTimeResponse.decode, + service: "osmosis.lockup.Query", + method: "AccountLockedPastTime", + deps: [AccountLockedPastTimeRequest, AccountLockedPastTimeResponse] +}); +/** + * Returns locked records of an account with unlock time beyond timestamp + * excluding tokens started unlocking + * @name getAccountLockedPastTimeNotUnlockingOnly + * @package osmosis.lockup + * @see proto service: osmosis.lockup.AccountLockedPastTimeNotUnlockingOnly + */ +export const getAccountLockedPastTimeNotUnlockingOnly = buildQuery({ + encode: AccountLockedPastTimeNotUnlockingOnlyRequest.encode, + decode: AccountLockedPastTimeNotUnlockingOnlyResponse.decode, + service: "osmosis.lockup.Query", + method: "AccountLockedPastTimeNotUnlockingOnly", + deps: [AccountLockedPastTimeNotUnlockingOnlyRequest, AccountLockedPastTimeNotUnlockingOnlyResponse] +}); +/** + * Returns unlocked records with unlock time before timestamp + * @name getAccountUnlockedBeforeTime + * @package osmosis.lockup + * @see proto service: osmosis.lockup.AccountUnlockedBeforeTime + */ +export const getAccountUnlockedBeforeTime = buildQuery({ + encode: AccountUnlockedBeforeTimeRequest.encode, + decode: AccountUnlockedBeforeTimeResponse.decode, + service: "osmosis.lockup.Query", + method: "AccountUnlockedBeforeTime", + deps: [AccountUnlockedBeforeTimeRequest, AccountUnlockedBeforeTimeResponse] +}); +/** + * Returns lock records by address, timestamp, denom + * @name getAccountLockedPastTimeDenom + * @package osmosis.lockup + * @see proto service: osmosis.lockup.AccountLockedPastTimeDenom + */ +export const getAccountLockedPastTimeDenom = buildQuery({ + encode: AccountLockedPastTimeDenomRequest.encode, + decode: AccountLockedPastTimeDenomResponse.decode, + service: "osmosis.lockup.Query", + method: "AccountLockedPastTimeDenom", + deps: [AccountLockedPastTimeDenomRequest, AccountLockedPastTimeDenomResponse] +}); +/** + * Returns total locked per denom with longer past given time + * @name getLockedDenom + * @package osmosis.lockup + * @see proto service: osmosis.lockup.LockedDenom + */ +export const getLockedDenom = buildQuery({ + encode: LockedDenomRequest.encode, + decode: LockedDenomResponse.decode, + service: "osmosis.lockup.Query", + method: "LockedDenom", + deps: [LockedDenomRequest, LockedDenomResponse] +}); +/** + * Returns lock record by id + * @name getLockedByID + * @package osmosis.lockup + * @see proto service: osmosis.lockup.LockedByID + */ +export const getLockedByID = buildQuery({ + encode: LockedRequest.encode, + decode: LockedResponse.decode, + service: "osmosis.lockup.Query", + method: "LockedByID", + deps: [LockedRequest, LockedResponse] +}); +/** + * Returns synthetic lockups by native lockup id + * @name getSyntheticLockupsByLockupID + * @package osmosis.lockup + * @see proto service: osmosis.lockup.SyntheticLockupsByLockupID + */ +export const getSyntheticLockupsByLockupID = buildQuery({ + encode: SyntheticLockupsByLockupIDRequest.encode, + decode: SyntheticLockupsByLockupIDResponse.decode, + service: "osmosis.lockup.Query", + method: "SyntheticLockupsByLockupID", + deps: [SyntheticLockupsByLockupIDRequest, SyntheticLockupsByLockupIDResponse] +}); +/** + * Returns account locked records with longer duration + * @name getAccountLockedLongerDuration + * @package osmosis.lockup + * @see proto service: osmosis.lockup.AccountLockedLongerDuration + */ +export const getAccountLockedLongerDuration = buildQuery({ + encode: AccountLockedLongerDurationRequest.encode, + decode: AccountLockedLongerDurationResponse.decode, + service: "osmosis.lockup.Query", + method: "AccountLockedLongerDuration", + deps: [AccountLockedLongerDurationRequest, AccountLockedLongerDurationResponse] +}); +/** + * Returns account locked records with a specific duration + * @name getAccountLockedDuration + * @package osmosis.lockup + * @see proto service: osmosis.lockup.AccountLockedDuration + */ +export const getAccountLockedDuration = buildQuery({ + encode: AccountLockedDurationRequest.encode, + decode: AccountLockedDurationResponse.decode, + service: "osmosis.lockup.Query", + method: "AccountLockedDuration", + deps: [AccountLockedDurationRequest, AccountLockedDurationResponse] +}); +/** + * Returns account locked records with longer duration excluding tokens + * started unlocking + * @name getAccountLockedLongerDurationNotUnlockingOnly + * @package osmosis.lockup + * @see proto service: osmosis.lockup.AccountLockedLongerDurationNotUnlockingOnly + */ +export const getAccountLockedLongerDurationNotUnlockingOnly = buildQuery({ + encode: AccountLockedLongerDurationNotUnlockingOnlyRequest.encode, + decode: AccountLockedLongerDurationNotUnlockingOnlyResponse.decode, + service: "osmosis.lockup.Query", + method: "AccountLockedLongerDurationNotUnlockingOnly", + deps: [AccountLockedLongerDurationNotUnlockingOnlyRequest, AccountLockedLongerDurationNotUnlockingOnlyResponse] +}); +/** + * Returns account's locked records for a denom with longer duration + * @name getAccountLockedLongerDurationDenom + * @package osmosis.lockup + * @see proto service: osmosis.lockup.AccountLockedLongerDurationDenom + */ +export const getAccountLockedLongerDurationDenom = buildQuery({ + encode: AccountLockedLongerDurationDenomRequest.encode, + decode: AccountLockedLongerDurationDenomResponse.decode, + service: "osmosis.lockup.Query", + method: "AccountLockedLongerDurationDenom", + deps: [AccountLockedLongerDurationDenomRequest, AccountLockedLongerDurationDenomResponse] +}); +/** + * Params returns lockup params. + * @name getParams + * @package osmosis.lockup + * @see proto service: osmosis.lockup.Params + */ +export const getParams = buildQuery({ + encode: QueryParamsRequest.encode, + decode: QueryParamsResponse.decode, + service: "osmosis.lockup.Query", + method: "Params", + deps: [QueryParamsRequest, QueryParamsResponse] +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/osmosis/lockup/query.ts b/__fixtures__/v-next/outputv2/osmosis/lockup/query.ts index 8aee0d9bbe..9a2b142435 100644 --- a/__fixtures__/v-next/outputv2/osmosis/lockup/query.ts +++ b/__fixtures__/v-next/outputv2/osmosis/lockup/query.ts @@ -6,6 +6,7 @@ import { Params, ParamsAmino, ParamsSDKType } from "./params"; import { BinaryReader, BinaryWriter } from "../../binary"; import { JsonSafe } from "../../json-safe"; import { DeepPartial, isSet, toTimestamp, fromTimestamp } from "../../helpers"; +import { GlobalDecoderRegistry } from "../../registry"; export const protobufPackage = "osmosis.lockup"; /** * @name ModuleBalanceRequest @@ -1121,6 +1122,15 @@ function createBaseModuleBalanceRequest(): ModuleBalanceRequest { export const ModuleBalanceRequest = { typeUrl: "/osmosis.lockup.ModuleBalanceRequest", aminoType: "osmosis/lockup/module-balance-request", + is(o: any): o is ModuleBalanceRequest { + return o && o.$typeUrl === ModuleBalanceRequest.typeUrl; + }, + isSDK(o: any): o is ModuleBalanceRequestSDKType { + return o && o.$typeUrl === ModuleBalanceRequest.typeUrl; + }, + isAmino(o: any): o is ModuleBalanceRequestAmino { + return o && o.$typeUrl === ModuleBalanceRequest.typeUrl; + }, encode(_: ModuleBalanceRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -1185,7 +1195,8 @@ export const ModuleBalanceRequest = { typeUrl: "/osmosis.lockup.ModuleBalanceRequest", value: ModuleBalanceRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseModuleBalanceResponse(): ModuleBalanceResponse { return { @@ -1200,6 +1211,15 @@ function createBaseModuleBalanceResponse(): ModuleBalanceResponse { export const ModuleBalanceResponse = { typeUrl: "/osmosis.lockup.ModuleBalanceResponse", aminoType: "osmosis/lockup/module-balance-response", + is(o: any): o is ModuleBalanceResponse { + return o && (o.$typeUrl === ModuleBalanceResponse.typeUrl || Array.isArray(o.coins) && (!o.coins.length || Coin.is(o.coins[0]))); + }, + isSDK(o: any): o is ModuleBalanceResponseSDKType { + return o && (o.$typeUrl === ModuleBalanceResponse.typeUrl || Array.isArray(o.coins) && (!o.coins.length || Coin.isSDK(o.coins[0]))); + }, + isAmino(o: any): o is ModuleBalanceResponseAmino { + return o && (o.$typeUrl === ModuleBalanceResponse.typeUrl || Array.isArray(o.coins) && (!o.coins.length || Coin.isAmino(o.coins[0]))); + }, encode(message: ModuleBalanceResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.coins) { Coin.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -1290,6 +1310,12 @@ export const ModuleBalanceResponse = { typeUrl: "/osmosis.lockup.ModuleBalanceResponse", value: ModuleBalanceResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ModuleBalanceResponse.typeUrl)) { + return; + } + Coin.registerTypeUrl(); } }; function createBaseModuleLockedAmountRequest(): ModuleLockedAmountRequest { @@ -1303,6 +1329,15 @@ function createBaseModuleLockedAmountRequest(): ModuleLockedAmountRequest { export const ModuleLockedAmountRequest = { typeUrl: "/osmosis.lockup.ModuleLockedAmountRequest", aminoType: "osmosis/lockup/module-locked-amount-request", + is(o: any): o is ModuleLockedAmountRequest { + return o && o.$typeUrl === ModuleLockedAmountRequest.typeUrl; + }, + isSDK(o: any): o is ModuleLockedAmountRequestSDKType { + return o && o.$typeUrl === ModuleLockedAmountRequest.typeUrl; + }, + isAmino(o: any): o is ModuleLockedAmountRequestAmino { + return o && o.$typeUrl === ModuleLockedAmountRequest.typeUrl; + }, encode(_: ModuleLockedAmountRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -1367,7 +1402,8 @@ export const ModuleLockedAmountRequest = { typeUrl: "/osmosis.lockup.ModuleLockedAmountRequest", value: ModuleLockedAmountRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseModuleLockedAmountResponse(): ModuleLockedAmountResponse { return { @@ -1382,6 +1418,15 @@ function createBaseModuleLockedAmountResponse(): ModuleLockedAmountResponse { export const ModuleLockedAmountResponse = { typeUrl: "/osmosis.lockup.ModuleLockedAmountResponse", aminoType: "osmosis/lockup/module-locked-amount-response", + is(o: any): o is ModuleLockedAmountResponse { + return o && (o.$typeUrl === ModuleLockedAmountResponse.typeUrl || Array.isArray(o.coins) && (!o.coins.length || Coin.is(o.coins[0]))); + }, + isSDK(o: any): o is ModuleLockedAmountResponseSDKType { + return o && (o.$typeUrl === ModuleLockedAmountResponse.typeUrl || Array.isArray(o.coins) && (!o.coins.length || Coin.isSDK(o.coins[0]))); + }, + isAmino(o: any): o is ModuleLockedAmountResponseAmino { + return o && (o.$typeUrl === ModuleLockedAmountResponse.typeUrl || Array.isArray(o.coins) && (!o.coins.length || Coin.isAmino(o.coins[0]))); + }, encode(message: ModuleLockedAmountResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.coins) { Coin.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -1472,6 +1517,12 @@ export const ModuleLockedAmountResponse = { typeUrl: "/osmosis.lockup.ModuleLockedAmountResponse", value: ModuleLockedAmountResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ModuleLockedAmountResponse.typeUrl)) { + return; + } + Coin.registerTypeUrl(); } }; function createBaseAccountUnlockableCoinsRequest(): AccountUnlockableCoinsRequest { @@ -1487,6 +1538,15 @@ function createBaseAccountUnlockableCoinsRequest(): AccountUnlockableCoinsReques export const AccountUnlockableCoinsRequest = { typeUrl: "/osmosis.lockup.AccountUnlockableCoinsRequest", aminoType: "osmosis/lockup/account-unlockable-coins-request", + is(o: any): o is AccountUnlockableCoinsRequest { + return o && (o.$typeUrl === AccountUnlockableCoinsRequest.typeUrl || typeof o.owner === "string"); + }, + isSDK(o: any): o is AccountUnlockableCoinsRequestSDKType { + return o && (o.$typeUrl === AccountUnlockableCoinsRequest.typeUrl || typeof o.owner === "string"); + }, + isAmino(o: any): o is AccountUnlockableCoinsRequestAmino { + return o && (o.$typeUrl === AccountUnlockableCoinsRequest.typeUrl || typeof o.owner === "string"); + }, encode(message: AccountUnlockableCoinsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.owner !== "") { writer.uint32(10).string(message.owner); @@ -1567,7 +1627,8 @@ export const AccountUnlockableCoinsRequest = { typeUrl: "/osmosis.lockup.AccountUnlockableCoinsRequest", value: AccountUnlockableCoinsRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseAccountUnlockableCoinsResponse(): AccountUnlockableCoinsResponse { return { @@ -1582,6 +1643,15 @@ function createBaseAccountUnlockableCoinsResponse(): AccountUnlockableCoinsRespo export const AccountUnlockableCoinsResponse = { typeUrl: "/osmosis.lockup.AccountUnlockableCoinsResponse", aminoType: "osmosis/lockup/account-unlockable-coins-response", + is(o: any): o is AccountUnlockableCoinsResponse { + return o && (o.$typeUrl === AccountUnlockableCoinsResponse.typeUrl || Array.isArray(o.coins) && (!o.coins.length || Coin.is(o.coins[0]))); + }, + isSDK(o: any): o is AccountUnlockableCoinsResponseSDKType { + return o && (o.$typeUrl === AccountUnlockableCoinsResponse.typeUrl || Array.isArray(o.coins) && (!o.coins.length || Coin.isSDK(o.coins[0]))); + }, + isAmino(o: any): o is AccountUnlockableCoinsResponseAmino { + return o && (o.$typeUrl === AccountUnlockableCoinsResponse.typeUrl || Array.isArray(o.coins) && (!o.coins.length || Coin.isAmino(o.coins[0]))); + }, encode(message: AccountUnlockableCoinsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.coins) { Coin.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -1672,6 +1742,12 @@ export const AccountUnlockableCoinsResponse = { typeUrl: "/osmosis.lockup.AccountUnlockableCoinsResponse", value: AccountUnlockableCoinsResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(AccountUnlockableCoinsResponse.typeUrl)) { + return; + } + Coin.registerTypeUrl(); } }; function createBaseAccountUnlockingCoinsRequest(): AccountUnlockingCoinsRequest { @@ -1687,6 +1763,15 @@ function createBaseAccountUnlockingCoinsRequest(): AccountUnlockingCoinsRequest export const AccountUnlockingCoinsRequest = { typeUrl: "/osmosis.lockup.AccountUnlockingCoinsRequest", aminoType: "osmosis/lockup/account-unlocking-coins-request", + is(o: any): o is AccountUnlockingCoinsRequest { + return o && (o.$typeUrl === AccountUnlockingCoinsRequest.typeUrl || typeof o.owner === "string"); + }, + isSDK(o: any): o is AccountUnlockingCoinsRequestSDKType { + return o && (o.$typeUrl === AccountUnlockingCoinsRequest.typeUrl || typeof o.owner === "string"); + }, + isAmino(o: any): o is AccountUnlockingCoinsRequestAmino { + return o && (o.$typeUrl === AccountUnlockingCoinsRequest.typeUrl || typeof o.owner === "string"); + }, encode(message: AccountUnlockingCoinsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.owner !== "") { writer.uint32(10).string(message.owner); @@ -1767,7 +1852,8 @@ export const AccountUnlockingCoinsRequest = { typeUrl: "/osmosis.lockup.AccountUnlockingCoinsRequest", value: AccountUnlockingCoinsRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseAccountUnlockingCoinsResponse(): AccountUnlockingCoinsResponse { return { @@ -1782,6 +1868,15 @@ function createBaseAccountUnlockingCoinsResponse(): AccountUnlockingCoinsRespons export const AccountUnlockingCoinsResponse = { typeUrl: "/osmosis.lockup.AccountUnlockingCoinsResponse", aminoType: "osmosis/lockup/account-unlocking-coins-response", + is(o: any): o is AccountUnlockingCoinsResponse { + return o && (o.$typeUrl === AccountUnlockingCoinsResponse.typeUrl || Array.isArray(o.coins) && (!o.coins.length || Coin.is(o.coins[0]))); + }, + isSDK(o: any): o is AccountUnlockingCoinsResponseSDKType { + return o && (o.$typeUrl === AccountUnlockingCoinsResponse.typeUrl || Array.isArray(o.coins) && (!o.coins.length || Coin.isSDK(o.coins[0]))); + }, + isAmino(o: any): o is AccountUnlockingCoinsResponseAmino { + return o && (o.$typeUrl === AccountUnlockingCoinsResponse.typeUrl || Array.isArray(o.coins) && (!o.coins.length || Coin.isAmino(o.coins[0]))); + }, encode(message: AccountUnlockingCoinsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.coins) { Coin.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -1872,6 +1967,12 @@ export const AccountUnlockingCoinsResponse = { typeUrl: "/osmosis.lockup.AccountUnlockingCoinsResponse", value: AccountUnlockingCoinsResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(AccountUnlockingCoinsResponse.typeUrl)) { + return; + } + Coin.registerTypeUrl(); } }; function createBaseAccountLockedCoinsRequest(): AccountLockedCoinsRequest { @@ -1887,6 +1988,15 @@ function createBaseAccountLockedCoinsRequest(): AccountLockedCoinsRequest { export const AccountLockedCoinsRequest = { typeUrl: "/osmosis.lockup.AccountLockedCoinsRequest", aminoType: "osmosis/lockup/account-locked-coins-request", + is(o: any): o is AccountLockedCoinsRequest { + return o && (o.$typeUrl === AccountLockedCoinsRequest.typeUrl || typeof o.owner === "string"); + }, + isSDK(o: any): o is AccountLockedCoinsRequestSDKType { + return o && (o.$typeUrl === AccountLockedCoinsRequest.typeUrl || typeof o.owner === "string"); + }, + isAmino(o: any): o is AccountLockedCoinsRequestAmino { + return o && (o.$typeUrl === AccountLockedCoinsRequest.typeUrl || typeof o.owner === "string"); + }, encode(message: AccountLockedCoinsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.owner !== "") { writer.uint32(10).string(message.owner); @@ -1967,7 +2077,8 @@ export const AccountLockedCoinsRequest = { typeUrl: "/osmosis.lockup.AccountLockedCoinsRequest", value: AccountLockedCoinsRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseAccountLockedCoinsResponse(): AccountLockedCoinsResponse { return { @@ -1982,6 +2093,15 @@ function createBaseAccountLockedCoinsResponse(): AccountLockedCoinsResponse { export const AccountLockedCoinsResponse = { typeUrl: "/osmosis.lockup.AccountLockedCoinsResponse", aminoType: "osmosis/lockup/account-locked-coins-response", + is(o: any): o is AccountLockedCoinsResponse { + return o && (o.$typeUrl === AccountLockedCoinsResponse.typeUrl || Array.isArray(o.coins) && (!o.coins.length || Coin.is(o.coins[0]))); + }, + isSDK(o: any): o is AccountLockedCoinsResponseSDKType { + return o && (o.$typeUrl === AccountLockedCoinsResponse.typeUrl || Array.isArray(o.coins) && (!o.coins.length || Coin.isSDK(o.coins[0]))); + }, + isAmino(o: any): o is AccountLockedCoinsResponseAmino { + return o && (o.$typeUrl === AccountLockedCoinsResponse.typeUrl || Array.isArray(o.coins) && (!o.coins.length || Coin.isAmino(o.coins[0]))); + }, encode(message: AccountLockedCoinsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.coins) { Coin.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -2072,6 +2192,12 @@ export const AccountLockedCoinsResponse = { typeUrl: "/osmosis.lockup.AccountLockedCoinsResponse", value: AccountLockedCoinsResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(AccountLockedCoinsResponse.typeUrl)) { + return; + } + Coin.registerTypeUrl(); } }; function createBaseAccountLockedPastTimeRequest(): AccountLockedPastTimeRequest { @@ -2088,6 +2214,15 @@ function createBaseAccountLockedPastTimeRequest(): AccountLockedPastTimeRequest export const AccountLockedPastTimeRequest = { typeUrl: "/osmosis.lockup.AccountLockedPastTimeRequest", aminoType: "osmosis/lockup/account-locked-past-time-request", + is(o: any): o is AccountLockedPastTimeRequest { + return o && (o.$typeUrl === AccountLockedPastTimeRequest.typeUrl || typeof o.owner === "string" && Timestamp.is(o.timestamp)); + }, + isSDK(o: any): o is AccountLockedPastTimeRequestSDKType { + return o && (o.$typeUrl === AccountLockedPastTimeRequest.typeUrl || typeof o.owner === "string" && Timestamp.isSDK(o.timestamp)); + }, + isAmino(o: any): o is AccountLockedPastTimeRequestAmino { + return o && (o.$typeUrl === AccountLockedPastTimeRequest.typeUrl || typeof o.owner === "string" && Timestamp.isAmino(o.timestamp)); + }, encode(message: AccountLockedPastTimeRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.owner !== "") { writer.uint32(10).string(message.owner); @@ -2183,7 +2318,8 @@ export const AccountLockedPastTimeRequest = { typeUrl: "/osmosis.lockup.AccountLockedPastTimeRequest", value: AccountLockedPastTimeRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseAccountLockedPastTimeResponse(): AccountLockedPastTimeResponse { return { @@ -2198,6 +2334,15 @@ function createBaseAccountLockedPastTimeResponse(): AccountLockedPastTimeRespons export const AccountLockedPastTimeResponse = { typeUrl: "/osmosis.lockup.AccountLockedPastTimeResponse", aminoType: "osmosis/lockup/account-locked-past-time-response", + is(o: any): o is AccountLockedPastTimeResponse { + return o && (o.$typeUrl === AccountLockedPastTimeResponse.typeUrl || Array.isArray(o.locks) && (!o.locks.length || PeriodLock.is(o.locks[0]))); + }, + isSDK(o: any): o is AccountLockedPastTimeResponseSDKType { + return o && (o.$typeUrl === AccountLockedPastTimeResponse.typeUrl || Array.isArray(o.locks) && (!o.locks.length || PeriodLock.isSDK(o.locks[0]))); + }, + isAmino(o: any): o is AccountLockedPastTimeResponseAmino { + return o && (o.$typeUrl === AccountLockedPastTimeResponse.typeUrl || Array.isArray(o.locks) && (!o.locks.length || PeriodLock.isAmino(o.locks[0]))); + }, encode(message: AccountLockedPastTimeResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.locks) { PeriodLock.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -2288,6 +2433,12 @@ export const AccountLockedPastTimeResponse = { typeUrl: "/osmosis.lockup.AccountLockedPastTimeResponse", value: AccountLockedPastTimeResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(AccountLockedPastTimeResponse.typeUrl)) { + return; + } + PeriodLock.registerTypeUrl(); } }; function createBaseAccountLockedPastTimeNotUnlockingOnlyRequest(): AccountLockedPastTimeNotUnlockingOnlyRequest { @@ -2304,6 +2455,15 @@ function createBaseAccountLockedPastTimeNotUnlockingOnlyRequest(): AccountLocked export const AccountLockedPastTimeNotUnlockingOnlyRequest = { typeUrl: "/osmosis.lockup.AccountLockedPastTimeNotUnlockingOnlyRequest", aminoType: "osmosis/lockup/account-locked-past-time-not-unlocking-only-request", + is(o: any): o is AccountLockedPastTimeNotUnlockingOnlyRequest { + return o && (o.$typeUrl === AccountLockedPastTimeNotUnlockingOnlyRequest.typeUrl || typeof o.owner === "string" && Timestamp.is(o.timestamp)); + }, + isSDK(o: any): o is AccountLockedPastTimeNotUnlockingOnlyRequestSDKType { + return o && (o.$typeUrl === AccountLockedPastTimeNotUnlockingOnlyRequest.typeUrl || typeof o.owner === "string" && Timestamp.isSDK(o.timestamp)); + }, + isAmino(o: any): o is AccountLockedPastTimeNotUnlockingOnlyRequestAmino { + return o && (o.$typeUrl === AccountLockedPastTimeNotUnlockingOnlyRequest.typeUrl || typeof o.owner === "string" && Timestamp.isAmino(o.timestamp)); + }, encode(message: AccountLockedPastTimeNotUnlockingOnlyRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.owner !== "") { writer.uint32(10).string(message.owner); @@ -2399,7 +2559,8 @@ export const AccountLockedPastTimeNotUnlockingOnlyRequest = { typeUrl: "/osmosis.lockup.AccountLockedPastTimeNotUnlockingOnlyRequest", value: AccountLockedPastTimeNotUnlockingOnlyRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseAccountLockedPastTimeNotUnlockingOnlyResponse(): AccountLockedPastTimeNotUnlockingOnlyResponse { return { @@ -2414,6 +2575,15 @@ function createBaseAccountLockedPastTimeNotUnlockingOnlyResponse(): AccountLocke export const AccountLockedPastTimeNotUnlockingOnlyResponse = { typeUrl: "/osmosis.lockup.AccountLockedPastTimeNotUnlockingOnlyResponse", aminoType: "osmosis/lockup/account-locked-past-time-not-unlocking-only-response", + is(o: any): o is AccountLockedPastTimeNotUnlockingOnlyResponse { + return o && (o.$typeUrl === AccountLockedPastTimeNotUnlockingOnlyResponse.typeUrl || Array.isArray(o.locks) && (!o.locks.length || PeriodLock.is(o.locks[0]))); + }, + isSDK(o: any): o is AccountLockedPastTimeNotUnlockingOnlyResponseSDKType { + return o && (o.$typeUrl === AccountLockedPastTimeNotUnlockingOnlyResponse.typeUrl || Array.isArray(o.locks) && (!o.locks.length || PeriodLock.isSDK(o.locks[0]))); + }, + isAmino(o: any): o is AccountLockedPastTimeNotUnlockingOnlyResponseAmino { + return o && (o.$typeUrl === AccountLockedPastTimeNotUnlockingOnlyResponse.typeUrl || Array.isArray(o.locks) && (!o.locks.length || PeriodLock.isAmino(o.locks[0]))); + }, encode(message: AccountLockedPastTimeNotUnlockingOnlyResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.locks) { PeriodLock.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -2504,6 +2674,12 @@ export const AccountLockedPastTimeNotUnlockingOnlyResponse = { typeUrl: "/osmosis.lockup.AccountLockedPastTimeNotUnlockingOnlyResponse", value: AccountLockedPastTimeNotUnlockingOnlyResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(AccountLockedPastTimeNotUnlockingOnlyResponse.typeUrl)) { + return; + } + PeriodLock.registerTypeUrl(); } }; function createBaseAccountUnlockedBeforeTimeRequest(): AccountUnlockedBeforeTimeRequest { @@ -2520,6 +2696,15 @@ function createBaseAccountUnlockedBeforeTimeRequest(): AccountUnlockedBeforeTime export const AccountUnlockedBeforeTimeRequest = { typeUrl: "/osmosis.lockup.AccountUnlockedBeforeTimeRequest", aminoType: "osmosis/lockup/account-unlocked-before-time-request", + is(o: any): o is AccountUnlockedBeforeTimeRequest { + return o && (o.$typeUrl === AccountUnlockedBeforeTimeRequest.typeUrl || typeof o.owner === "string" && Timestamp.is(o.timestamp)); + }, + isSDK(o: any): o is AccountUnlockedBeforeTimeRequestSDKType { + return o && (o.$typeUrl === AccountUnlockedBeforeTimeRequest.typeUrl || typeof o.owner === "string" && Timestamp.isSDK(o.timestamp)); + }, + isAmino(o: any): o is AccountUnlockedBeforeTimeRequestAmino { + return o && (o.$typeUrl === AccountUnlockedBeforeTimeRequest.typeUrl || typeof o.owner === "string" && Timestamp.isAmino(o.timestamp)); + }, encode(message: AccountUnlockedBeforeTimeRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.owner !== "") { writer.uint32(10).string(message.owner); @@ -2615,7 +2800,8 @@ export const AccountUnlockedBeforeTimeRequest = { typeUrl: "/osmosis.lockup.AccountUnlockedBeforeTimeRequest", value: AccountUnlockedBeforeTimeRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseAccountUnlockedBeforeTimeResponse(): AccountUnlockedBeforeTimeResponse { return { @@ -2630,6 +2816,15 @@ function createBaseAccountUnlockedBeforeTimeResponse(): AccountUnlockedBeforeTim export const AccountUnlockedBeforeTimeResponse = { typeUrl: "/osmosis.lockup.AccountUnlockedBeforeTimeResponse", aminoType: "osmosis/lockup/account-unlocked-before-time-response", + is(o: any): o is AccountUnlockedBeforeTimeResponse { + return o && (o.$typeUrl === AccountUnlockedBeforeTimeResponse.typeUrl || Array.isArray(o.locks) && (!o.locks.length || PeriodLock.is(o.locks[0]))); + }, + isSDK(o: any): o is AccountUnlockedBeforeTimeResponseSDKType { + return o && (o.$typeUrl === AccountUnlockedBeforeTimeResponse.typeUrl || Array.isArray(o.locks) && (!o.locks.length || PeriodLock.isSDK(o.locks[0]))); + }, + isAmino(o: any): o is AccountUnlockedBeforeTimeResponseAmino { + return o && (o.$typeUrl === AccountUnlockedBeforeTimeResponse.typeUrl || Array.isArray(o.locks) && (!o.locks.length || PeriodLock.isAmino(o.locks[0]))); + }, encode(message: AccountUnlockedBeforeTimeResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.locks) { PeriodLock.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -2720,6 +2915,12 @@ export const AccountUnlockedBeforeTimeResponse = { typeUrl: "/osmosis.lockup.AccountUnlockedBeforeTimeResponse", value: AccountUnlockedBeforeTimeResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(AccountUnlockedBeforeTimeResponse.typeUrl)) { + return; + } + PeriodLock.registerTypeUrl(); } }; function createBaseAccountLockedPastTimeDenomRequest(): AccountLockedPastTimeDenomRequest { @@ -2737,6 +2938,15 @@ function createBaseAccountLockedPastTimeDenomRequest(): AccountLockedPastTimeDen export const AccountLockedPastTimeDenomRequest = { typeUrl: "/osmosis.lockup.AccountLockedPastTimeDenomRequest", aminoType: "osmosis/lockup/account-locked-past-time-denom-request", + is(o: any): o is AccountLockedPastTimeDenomRequest { + return o && (o.$typeUrl === AccountLockedPastTimeDenomRequest.typeUrl || typeof o.owner === "string" && Timestamp.is(o.timestamp) && typeof o.denom === "string"); + }, + isSDK(o: any): o is AccountLockedPastTimeDenomRequestSDKType { + return o && (o.$typeUrl === AccountLockedPastTimeDenomRequest.typeUrl || typeof o.owner === "string" && Timestamp.isSDK(o.timestamp) && typeof o.denom === "string"); + }, + isAmino(o: any): o is AccountLockedPastTimeDenomRequestAmino { + return o && (o.$typeUrl === AccountLockedPastTimeDenomRequest.typeUrl || typeof o.owner === "string" && Timestamp.isAmino(o.timestamp) && typeof o.denom === "string"); + }, encode(message: AccountLockedPastTimeDenomRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.owner !== "") { writer.uint32(10).string(message.owner); @@ -2847,7 +3057,8 @@ export const AccountLockedPastTimeDenomRequest = { typeUrl: "/osmosis.lockup.AccountLockedPastTimeDenomRequest", value: AccountLockedPastTimeDenomRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseAccountLockedPastTimeDenomResponse(): AccountLockedPastTimeDenomResponse { return { @@ -2862,6 +3073,15 @@ function createBaseAccountLockedPastTimeDenomResponse(): AccountLockedPastTimeDe export const AccountLockedPastTimeDenomResponse = { typeUrl: "/osmosis.lockup.AccountLockedPastTimeDenomResponse", aminoType: "osmosis/lockup/account-locked-past-time-denom-response", + is(o: any): o is AccountLockedPastTimeDenomResponse { + return o && (o.$typeUrl === AccountLockedPastTimeDenomResponse.typeUrl || Array.isArray(o.locks) && (!o.locks.length || PeriodLock.is(o.locks[0]))); + }, + isSDK(o: any): o is AccountLockedPastTimeDenomResponseSDKType { + return o && (o.$typeUrl === AccountLockedPastTimeDenomResponse.typeUrl || Array.isArray(o.locks) && (!o.locks.length || PeriodLock.isSDK(o.locks[0]))); + }, + isAmino(o: any): o is AccountLockedPastTimeDenomResponseAmino { + return o && (o.$typeUrl === AccountLockedPastTimeDenomResponse.typeUrl || Array.isArray(o.locks) && (!o.locks.length || PeriodLock.isAmino(o.locks[0]))); + }, encode(message: AccountLockedPastTimeDenomResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.locks) { PeriodLock.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -2952,6 +3172,12 @@ export const AccountLockedPastTimeDenomResponse = { typeUrl: "/osmosis.lockup.AccountLockedPastTimeDenomResponse", value: AccountLockedPastTimeDenomResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(AccountLockedPastTimeDenomResponse.typeUrl)) { + return; + } + PeriodLock.registerTypeUrl(); } }; function createBaseLockedDenomRequest(): LockedDenomRequest { @@ -2968,6 +3194,15 @@ function createBaseLockedDenomRequest(): LockedDenomRequest { export const LockedDenomRequest = { typeUrl: "/osmosis.lockup.LockedDenomRequest", aminoType: "osmosis/lockup/locked-denom-request", + is(o: any): o is LockedDenomRequest { + return o && (o.$typeUrl === LockedDenomRequest.typeUrl || typeof o.denom === "string" && Duration.is(o.duration)); + }, + isSDK(o: any): o is LockedDenomRequestSDKType { + return o && (o.$typeUrl === LockedDenomRequest.typeUrl || typeof o.denom === "string" && Duration.isSDK(o.duration)); + }, + isAmino(o: any): o is LockedDenomRequestAmino { + return o && (o.$typeUrl === LockedDenomRequest.typeUrl || typeof o.denom === "string" && Duration.isAmino(o.duration)); + }, encode(message: LockedDenomRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.denom !== "") { writer.uint32(10).string(message.denom); @@ -3065,7 +3300,8 @@ export const LockedDenomRequest = { typeUrl: "/osmosis.lockup.LockedDenomRequest", value: LockedDenomRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseLockedDenomResponse(): LockedDenomResponse { return { @@ -3080,6 +3316,15 @@ function createBaseLockedDenomResponse(): LockedDenomResponse { export const LockedDenomResponse = { typeUrl: "/osmosis.lockup.LockedDenomResponse", aminoType: "osmosis/lockup/locked-denom-response", + is(o: any): o is LockedDenomResponse { + return o && (o.$typeUrl === LockedDenomResponse.typeUrl || typeof o.amount === "string"); + }, + isSDK(o: any): o is LockedDenomResponseSDKType { + return o && (o.$typeUrl === LockedDenomResponse.typeUrl || typeof o.amount === "string"); + }, + isAmino(o: any): o is LockedDenomResponseAmino { + return o && (o.$typeUrl === LockedDenomResponse.typeUrl || typeof o.amount === "string"); + }, encode(message: LockedDenomResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.amount !== "") { writer.uint32(10).string(message.amount); @@ -3160,7 +3405,8 @@ export const LockedDenomResponse = { typeUrl: "/osmosis.lockup.LockedDenomResponse", value: LockedDenomResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseLockedRequest(): LockedRequest { return { @@ -3175,6 +3421,15 @@ function createBaseLockedRequest(): LockedRequest { export const LockedRequest = { typeUrl: "/osmosis.lockup.LockedRequest", aminoType: "osmosis/lockup/locked-request", + is(o: any): o is LockedRequest { + return o && (o.$typeUrl === LockedRequest.typeUrl || typeof o.lockId === "bigint"); + }, + isSDK(o: any): o is LockedRequestSDKType { + return o && (o.$typeUrl === LockedRequest.typeUrl || typeof o.lock_id === "bigint"); + }, + isAmino(o: any): o is LockedRequestAmino { + return o && (o.$typeUrl === LockedRequest.typeUrl || typeof o.lock_id === "bigint"); + }, encode(message: LockedRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.lockId !== BigInt(0)) { writer.uint32(8).uint64(message.lockId); @@ -3257,7 +3512,8 @@ export const LockedRequest = { typeUrl: "/osmosis.lockup.LockedRequest", value: LockedRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseLockedResponse(): LockedResponse { return { @@ -3272,6 +3528,15 @@ function createBaseLockedResponse(): LockedResponse { export const LockedResponse = { typeUrl: "/osmosis.lockup.LockedResponse", aminoType: "osmosis/lockup/locked-response", + is(o: any): o is LockedResponse { + return o && o.$typeUrl === LockedResponse.typeUrl; + }, + isSDK(o: any): o is LockedResponseSDKType { + return o && o.$typeUrl === LockedResponse.typeUrl; + }, + isAmino(o: any): o is LockedResponseAmino { + return o && o.$typeUrl === LockedResponse.typeUrl; + }, encode(message: LockedResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.lock !== undefined) { PeriodLock.encode(message.lock, writer.uint32(10).fork()).ldelim(); @@ -3354,6 +3619,12 @@ export const LockedResponse = { typeUrl: "/osmosis.lockup.LockedResponse", value: LockedResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(LockedResponse.typeUrl)) { + return; + } + PeriodLock.registerTypeUrl(); } }; function createBaseSyntheticLockupsByLockupIDRequest(): SyntheticLockupsByLockupIDRequest { @@ -3369,6 +3640,15 @@ function createBaseSyntheticLockupsByLockupIDRequest(): SyntheticLockupsByLockup export const SyntheticLockupsByLockupIDRequest = { typeUrl: "/osmosis.lockup.SyntheticLockupsByLockupIDRequest", aminoType: "osmosis/lockup/synthetic-lockups-by-lockup-id-request", + is(o: any): o is SyntheticLockupsByLockupIDRequest { + return o && (o.$typeUrl === SyntheticLockupsByLockupIDRequest.typeUrl || typeof o.lockId === "bigint"); + }, + isSDK(o: any): o is SyntheticLockupsByLockupIDRequestSDKType { + return o && (o.$typeUrl === SyntheticLockupsByLockupIDRequest.typeUrl || typeof o.lock_id === "bigint"); + }, + isAmino(o: any): o is SyntheticLockupsByLockupIDRequestAmino { + return o && (o.$typeUrl === SyntheticLockupsByLockupIDRequest.typeUrl || typeof o.lock_id === "bigint"); + }, encode(message: SyntheticLockupsByLockupIDRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.lockId !== BigInt(0)) { writer.uint32(8).uint64(message.lockId); @@ -3451,7 +3731,8 @@ export const SyntheticLockupsByLockupIDRequest = { typeUrl: "/osmosis.lockup.SyntheticLockupsByLockupIDRequest", value: SyntheticLockupsByLockupIDRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseSyntheticLockupsByLockupIDResponse(): SyntheticLockupsByLockupIDResponse { return { @@ -3466,6 +3747,15 @@ function createBaseSyntheticLockupsByLockupIDResponse(): SyntheticLockupsByLocku export const SyntheticLockupsByLockupIDResponse = { typeUrl: "/osmosis.lockup.SyntheticLockupsByLockupIDResponse", aminoType: "osmosis/lockup/synthetic-lockups-by-lockup-id-response", + is(o: any): o is SyntheticLockupsByLockupIDResponse { + return o && (o.$typeUrl === SyntheticLockupsByLockupIDResponse.typeUrl || Array.isArray(o.syntheticLocks) && (!o.syntheticLocks.length || SyntheticLock.is(o.syntheticLocks[0]))); + }, + isSDK(o: any): o is SyntheticLockupsByLockupIDResponseSDKType { + return o && (o.$typeUrl === SyntheticLockupsByLockupIDResponse.typeUrl || Array.isArray(o.synthetic_locks) && (!o.synthetic_locks.length || SyntheticLock.isSDK(o.synthetic_locks[0]))); + }, + isAmino(o: any): o is SyntheticLockupsByLockupIDResponseAmino { + return o && (o.$typeUrl === SyntheticLockupsByLockupIDResponse.typeUrl || Array.isArray(o.synthetic_locks) && (!o.synthetic_locks.length || SyntheticLock.isAmino(o.synthetic_locks[0]))); + }, encode(message: SyntheticLockupsByLockupIDResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.syntheticLocks) { SyntheticLock.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -3556,6 +3846,12 @@ export const SyntheticLockupsByLockupIDResponse = { typeUrl: "/osmosis.lockup.SyntheticLockupsByLockupIDResponse", value: SyntheticLockupsByLockupIDResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(SyntheticLockupsByLockupIDResponse.typeUrl)) { + return; + } + SyntheticLock.registerTypeUrl(); } }; function createBaseAccountLockedLongerDurationRequest(): AccountLockedLongerDurationRequest { @@ -3572,6 +3868,15 @@ function createBaseAccountLockedLongerDurationRequest(): AccountLockedLongerDura export const AccountLockedLongerDurationRequest = { typeUrl: "/osmosis.lockup.AccountLockedLongerDurationRequest", aminoType: "osmosis/lockup/account-locked-longer-duration-request", + is(o: any): o is AccountLockedLongerDurationRequest { + return o && (o.$typeUrl === AccountLockedLongerDurationRequest.typeUrl || typeof o.owner === "string" && Duration.is(o.duration)); + }, + isSDK(o: any): o is AccountLockedLongerDurationRequestSDKType { + return o && (o.$typeUrl === AccountLockedLongerDurationRequest.typeUrl || typeof o.owner === "string" && Duration.isSDK(o.duration)); + }, + isAmino(o: any): o is AccountLockedLongerDurationRequestAmino { + return o && (o.$typeUrl === AccountLockedLongerDurationRequest.typeUrl || typeof o.owner === "string" && Duration.isAmino(o.duration)); + }, encode(message: AccountLockedLongerDurationRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.owner !== "") { writer.uint32(10).string(message.owner); @@ -3669,7 +3974,8 @@ export const AccountLockedLongerDurationRequest = { typeUrl: "/osmosis.lockup.AccountLockedLongerDurationRequest", value: AccountLockedLongerDurationRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseAccountLockedLongerDurationResponse(): AccountLockedLongerDurationResponse { return { @@ -3684,6 +3990,15 @@ function createBaseAccountLockedLongerDurationResponse(): AccountLockedLongerDur export const AccountLockedLongerDurationResponse = { typeUrl: "/osmosis.lockup.AccountLockedLongerDurationResponse", aminoType: "osmosis/lockup/account-locked-longer-duration-response", + is(o: any): o is AccountLockedLongerDurationResponse { + return o && (o.$typeUrl === AccountLockedLongerDurationResponse.typeUrl || Array.isArray(o.locks) && (!o.locks.length || PeriodLock.is(o.locks[0]))); + }, + isSDK(o: any): o is AccountLockedLongerDurationResponseSDKType { + return o && (o.$typeUrl === AccountLockedLongerDurationResponse.typeUrl || Array.isArray(o.locks) && (!o.locks.length || PeriodLock.isSDK(o.locks[0]))); + }, + isAmino(o: any): o is AccountLockedLongerDurationResponseAmino { + return o && (o.$typeUrl === AccountLockedLongerDurationResponse.typeUrl || Array.isArray(o.locks) && (!o.locks.length || PeriodLock.isAmino(o.locks[0]))); + }, encode(message: AccountLockedLongerDurationResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.locks) { PeriodLock.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -3774,6 +4089,12 @@ export const AccountLockedLongerDurationResponse = { typeUrl: "/osmosis.lockup.AccountLockedLongerDurationResponse", value: AccountLockedLongerDurationResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(AccountLockedLongerDurationResponse.typeUrl)) { + return; + } + PeriodLock.registerTypeUrl(); } }; function createBaseAccountLockedDurationRequest(): AccountLockedDurationRequest { @@ -3790,6 +4111,15 @@ function createBaseAccountLockedDurationRequest(): AccountLockedDurationRequest export const AccountLockedDurationRequest = { typeUrl: "/osmosis.lockup.AccountLockedDurationRequest", aminoType: "osmosis/lockup/account-locked-duration-request", + is(o: any): o is AccountLockedDurationRequest { + return o && (o.$typeUrl === AccountLockedDurationRequest.typeUrl || typeof o.owner === "string" && Duration.is(o.duration)); + }, + isSDK(o: any): o is AccountLockedDurationRequestSDKType { + return o && (o.$typeUrl === AccountLockedDurationRequest.typeUrl || typeof o.owner === "string" && Duration.isSDK(o.duration)); + }, + isAmino(o: any): o is AccountLockedDurationRequestAmino { + return o && (o.$typeUrl === AccountLockedDurationRequest.typeUrl || typeof o.owner === "string" && Duration.isAmino(o.duration)); + }, encode(message: AccountLockedDurationRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.owner !== "") { writer.uint32(10).string(message.owner); @@ -3887,7 +4217,8 @@ export const AccountLockedDurationRequest = { typeUrl: "/osmosis.lockup.AccountLockedDurationRequest", value: AccountLockedDurationRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseAccountLockedDurationResponse(): AccountLockedDurationResponse { return { @@ -3902,6 +4233,15 @@ function createBaseAccountLockedDurationResponse(): AccountLockedDurationRespons export const AccountLockedDurationResponse = { typeUrl: "/osmosis.lockup.AccountLockedDurationResponse", aminoType: "osmosis/lockup/account-locked-duration-response", + is(o: any): o is AccountLockedDurationResponse { + return o && (o.$typeUrl === AccountLockedDurationResponse.typeUrl || Array.isArray(o.locks) && (!o.locks.length || PeriodLock.is(o.locks[0]))); + }, + isSDK(o: any): o is AccountLockedDurationResponseSDKType { + return o && (o.$typeUrl === AccountLockedDurationResponse.typeUrl || Array.isArray(o.locks) && (!o.locks.length || PeriodLock.isSDK(o.locks[0]))); + }, + isAmino(o: any): o is AccountLockedDurationResponseAmino { + return o && (o.$typeUrl === AccountLockedDurationResponse.typeUrl || Array.isArray(o.locks) && (!o.locks.length || PeriodLock.isAmino(o.locks[0]))); + }, encode(message: AccountLockedDurationResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.locks) { PeriodLock.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -3992,6 +4332,12 @@ export const AccountLockedDurationResponse = { typeUrl: "/osmosis.lockup.AccountLockedDurationResponse", value: AccountLockedDurationResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(AccountLockedDurationResponse.typeUrl)) { + return; + } + PeriodLock.registerTypeUrl(); } }; function createBaseAccountLockedLongerDurationNotUnlockingOnlyRequest(): AccountLockedLongerDurationNotUnlockingOnlyRequest { @@ -4008,6 +4354,15 @@ function createBaseAccountLockedLongerDurationNotUnlockingOnlyRequest(): Account export const AccountLockedLongerDurationNotUnlockingOnlyRequest = { typeUrl: "/osmosis.lockup.AccountLockedLongerDurationNotUnlockingOnlyRequest", aminoType: "osmosis/lockup/account-locked-longer-duration-not-unlocking-only-request", + is(o: any): o is AccountLockedLongerDurationNotUnlockingOnlyRequest { + return o && (o.$typeUrl === AccountLockedLongerDurationNotUnlockingOnlyRequest.typeUrl || typeof o.owner === "string" && Duration.is(o.duration)); + }, + isSDK(o: any): o is AccountLockedLongerDurationNotUnlockingOnlyRequestSDKType { + return o && (o.$typeUrl === AccountLockedLongerDurationNotUnlockingOnlyRequest.typeUrl || typeof o.owner === "string" && Duration.isSDK(o.duration)); + }, + isAmino(o: any): o is AccountLockedLongerDurationNotUnlockingOnlyRequestAmino { + return o && (o.$typeUrl === AccountLockedLongerDurationNotUnlockingOnlyRequest.typeUrl || typeof o.owner === "string" && Duration.isAmino(o.duration)); + }, encode(message: AccountLockedLongerDurationNotUnlockingOnlyRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.owner !== "") { writer.uint32(10).string(message.owner); @@ -4105,7 +4460,8 @@ export const AccountLockedLongerDurationNotUnlockingOnlyRequest = { typeUrl: "/osmosis.lockup.AccountLockedLongerDurationNotUnlockingOnlyRequest", value: AccountLockedLongerDurationNotUnlockingOnlyRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseAccountLockedLongerDurationNotUnlockingOnlyResponse(): AccountLockedLongerDurationNotUnlockingOnlyResponse { return { @@ -4120,6 +4476,15 @@ function createBaseAccountLockedLongerDurationNotUnlockingOnlyResponse(): Accoun export const AccountLockedLongerDurationNotUnlockingOnlyResponse = { typeUrl: "/osmosis.lockup.AccountLockedLongerDurationNotUnlockingOnlyResponse", aminoType: "osmosis/lockup/account-locked-longer-duration-not-unlocking-only-response", + is(o: any): o is AccountLockedLongerDurationNotUnlockingOnlyResponse { + return o && (o.$typeUrl === AccountLockedLongerDurationNotUnlockingOnlyResponse.typeUrl || Array.isArray(o.locks) && (!o.locks.length || PeriodLock.is(o.locks[0]))); + }, + isSDK(o: any): o is AccountLockedLongerDurationNotUnlockingOnlyResponseSDKType { + return o && (o.$typeUrl === AccountLockedLongerDurationNotUnlockingOnlyResponse.typeUrl || Array.isArray(o.locks) && (!o.locks.length || PeriodLock.isSDK(o.locks[0]))); + }, + isAmino(o: any): o is AccountLockedLongerDurationNotUnlockingOnlyResponseAmino { + return o && (o.$typeUrl === AccountLockedLongerDurationNotUnlockingOnlyResponse.typeUrl || Array.isArray(o.locks) && (!o.locks.length || PeriodLock.isAmino(o.locks[0]))); + }, encode(message: AccountLockedLongerDurationNotUnlockingOnlyResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.locks) { PeriodLock.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -4210,6 +4575,12 @@ export const AccountLockedLongerDurationNotUnlockingOnlyResponse = { typeUrl: "/osmosis.lockup.AccountLockedLongerDurationNotUnlockingOnlyResponse", value: AccountLockedLongerDurationNotUnlockingOnlyResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(AccountLockedLongerDurationNotUnlockingOnlyResponse.typeUrl)) { + return; + } + PeriodLock.registerTypeUrl(); } }; function createBaseAccountLockedLongerDurationDenomRequest(): AccountLockedLongerDurationDenomRequest { @@ -4227,6 +4598,15 @@ function createBaseAccountLockedLongerDurationDenomRequest(): AccountLockedLonge export const AccountLockedLongerDurationDenomRequest = { typeUrl: "/osmosis.lockup.AccountLockedLongerDurationDenomRequest", aminoType: "osmosis/lockup/account-locked-longer-duration-denom-request", + is(o: any): o is AccountLockedLongerDurationDenomRequest { + return o && (o.$typeUrl === AccountLockedLongerDurationDenomRequest.typeUrl || typeof o.owner === "string" && Duration.is(o.duration) && typeof o.denom === "string"); + }, + isSDK(o: any): o is AccountLockedLongerDurationDenomRequestSDKType { + return o && (o.$typeUrl === AccountLockedLongerDurationDenomRequest.typeUrl || typeof o.owner === "string" && Duration.isSDK(o.duration) && typeof o.denom === "string"); + }, + isAmino(o: any): o is AccountLockedLongerDurationDenomRequestAmino { + return o && (o.$typeUrl === AccountLockedLongerDurationDenomRequest.typeUrl || typeof o.owner === "string" && Duration.isAmino(o.duration) && typeof o.denom === "string"); + }, encode(message: AccountLockedLongerDurationDenomRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.owner !== "") { writer.uint32(10).string(message.owner); @@ -4339,7 +4719,8 @@ export const AccountLockedLongerDurationDenomRequest = { typeUrl: "/osmosis.lockup.AccountLockedLongerDurationDenomRequest", value: AccountLockedLongerDurationDenomRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseAccountLockedLongerDurationDenomResponse(): AccountLockedLongerDurationDenomResponse { return { @@ -4354,6 +4735,15 @@ function createBaseAccountLockedLongerDurationDenomResponse(): AccountLockedLong export const AccountLockedLongerDurationDenomResponse = { typeUrl: "/osmosis.lockup.AccountLockedLongerDurationDenomResponse", aminoType: "osmosis/lockup/account-locked-longer-duration-denom-response", + is(o: any): o is AccountLockedLongerDurationDenomResponse { + return o && (o.$typeUrl === AccountLockedLongerDurationDenomResponse.typeUrl || Array.isArray(o.locks) && (!o.locks.length || PeriodLock.is(o.locks[0]))); + }, + isSDK(o: any): o is AccountLockedLongerDurationDenomResponseSDKType { + return o && (o.$typeUrl === AccountLockedLongerDurationDenomResponse.typeUrl || Array.isArray(o.locks) && (!o.locks.length || PeriodLock.isSDK(o.locks[0]))); + }, + isAmino(o: any): o is AccountLockedLongerDurationDenomResponseAmino { + return o && (o.$typeUrl === AccountLockedLongerDurationDenomResponse.typeUrl || Array.isArray(o.locks) && (!o.locks.length || PeriodLock.isAmino(o.locks[0]))); + }, encode(message: AccountLockedLongerDurationDenomResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.locks) { PeriodLock.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -4444,6 +4834,12 @@ export const AccountLockedLongerDurationDenomResponse = { typeUrl: "/osmosis.lockup.AccountLockedLongerDurationDenomResponse", value: AccountLockedLongerDurationDenomResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(AccountLockedLongerDurationDenomResponse.typeUrl)) { + return; + } + PeriodLock.registerTypeUrl(); } }; function createBaseQueryParamsRequest(): QueryParamsRequest { @@ -4457,6 +4853,15 @@ function createBaseQueryParamsRequest(): QueryParamsRequest { export const QueryParamsRequest = { typeUrl: "/osmosis.lockup.QueryParamsRequest", aminoType: "osmosis/lockup/query-params-request", + is(o: any): o is QueryParamsRequest { + return o && o.$typeUrl === QueryParamsRequest.typeUrl; + }, + isSDK(o: any): o is QueryParamsRequestSDKType { + return o && o.$typeUrl === QueryParamsRequest.typeUrl; + }, + isAmino(o: any): o is QueryParamsRequestAmino { + return o && o.$typeUrl === QueryParamsRequest.typeUrl; + }, encode(_: QueryParamsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -4521,7 +4926,8 @@ export const QueryParamsRequest = { typeUrl: "/osmosis.lockup.QueryParamsRequest", value: QueryParamsRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryParamsResponse(): QueryParamsResponse { return { @@ -4536,6 +4942,15 @@ function createBaseQueryParamsResponse(): QueryParamsResponse { export const QueryParamsResponse = { typeUrl: "/osmosis.lockup.QueryParamsResponse", aminoType: "osmosis/lockup/query-params-response", + is(o: any): o is QueryParamsResponse { + return o && (o.$typeUrl === QueryParamsResponse.typeUrl || Params.is(o.params)); + }, + isSDK(o: any): o is QueryParamsResponseSDKType { + return o && (o.$typeUrl === QueryParamsResponse.typeUrl || Params.isSDK(o.params)); + }, + isAmino(o: any): o is QueryParamsResponseAmino { + return o && (o.$typeUrl === QueryParamsResponse.typeUrl || Params.isAmino(o.params)); + }, encode(message: QueryParamsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.params !== undefined) { Params.encode(message.params, writer.uint32(10).fork()).ldelim(); @@ -4618,5 +5033,11 @@ export const QueryParamsResponse = { typeUrl: "/osmosis.lockup.QueryParamsResponse", value: QueryParamsResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryParamsResponse.typeUrl)) { + return; + } + Params.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/osmosis/lockup/tx.registry.ts b/__fixtures__/v-next/outputv2/osmosis/lockup/tx.registry.ts index 085e7bc6dd..b737707830 100644 --- a/__fixtures__/v-next/outputv2/osmosis/lockup/tx.registry.ts +++ b/__fixtures__/v-next/outputv2/osmosis/lockup/tx.registry.ts @@ -1,11 +1,6 @@ -import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { TelescopeGeneratedType } from "../../types"; import { MsgLockTokens, MsgBeginUnlockingAll, MsgBeginUnlocking, MsgExtendLockup, MsgForceUnlock } from "./tx"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/osmosis.lockup.MsgLockTokens", MsgLockTokens], ["/osmosis.lockup.MsgBeginUnlockingAll", MsgBeginUnlockingAll], ["/osmosis.lockup.MsgBeginUnlocking", MsgBeginUnlocking], ["/osmosis.lockup.MsgExtendLockup", MsgExtendLockup], ["/osmosis.lockup.MsgForceUnlock", MsgForceUnlock]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/osmosis.lockup.MsgLockTokens", MsgLockTokens], ["/osmosis.lockup.MsgBeginUnlockingAll", MsgBeginUnlockingAll], ["/osmosis.lockup.MsgBeginUnlocking", MsgBeginUnlocking], ["/osmosis.lockup.MsgExtendLockup", MsgExtendLockup], ["/osmosis.lockup.MsgForceUnlock", MsgForceUnlock]]; export const MessageComposer = { encoded: { lockTokens(value: MsgLockTokens) { diff --git a/__fixtures__/v-next/outputv2/osmosis/lockup/tx.rpc.func.ts b/__fixtures__/v-next/outputv2/osmosis/lockup/tx.rpc.func.ts new file mode 100644 index 0000000000..d1b8ec7f1c --- /dev/null +++ b/__fixtures__/v-next/outputv2/osmosis/lockup/tx.rpc.func.ts @@ -0,0 +1,46 @@ +import { buildTx } from "../../helper-func-types"; +import { MsgLockTokens, MsgBeginUnlockingAll, MsgBeginUnlocking, MsgExtendLockup, MsgForceUnlock } from "./tx"; +/** + * LockTokens lock tokens + * @name lockTokens + * @package osmosis.lockup + * @see proto service: osmosis.lockup.LockTokens + */ +export const lockTokens = buildTx({ + msg: MsgLockTokens +}); +/** + * BeginUnlockingAll begin unlocking all tokens + * @name beginUnlockingAll + * @package osmosis.lockup + * @see proto service: osmosis.lockup.BeginUnlockingAll + */ +export const beginUnlockingAll = buildTx({ + msg: MsgBeginUnlockingAll +}); +/** + * MsgBeginUnlocking begins unlocking tokens by lock ID + * @name beginUnlocking + * @package osmosis.lockup + * @see proto service: osmosis.lockup.BeginUnlocking + */ +export const beginUnlocking = buildTx({ + msg: MsgBeginUnlocking +}); +/** + * MsgEditLockup edits the existing lockups by lock ID + * @name extendLockup + * @package osmosis.lockup + * @see proto service: osmosis.lockup.ExtendLockup + */ +export const extendLockup = buildTx({ + msg: MsgExtendLockup +}); +/** + * @name forceUnlock + * @package osmosis.lockup + * @see proto service: osmosis.lockup.ForceUnlock + */ +export const forceUnlock = buildTx({ + msg: MsgForceUnlock +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/osmosis/lockup/tx.ts b/__fixtures__/v-next/outputv2/osmosis/lockup/tx.ts index 63beb8ec31..c9f85219ae 100644 --- a/__fixtures__/v-next/outputv2/osmosis/lockup/tx.ts +++ b/__fixtures__/v-next/outputv2/osmosis/lockup/tx.ts @@ -2,6 +2,7 @@ import { Duration, DurationAmino, DurationSDKType } from "../../google/protobuf/ import { Coin, CoinAmino, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; import { PeriodLock, PeriodLockAmino, PeriodLockSDKType } from "./lock"; import { BinaryReader, BinaryWriter } from "../../binary"; +import { GlobalDecoderRegistry } from "../../registry"; import { isSet, DeepPartial } from "../../helpers"; import { JsonSafe } from "../../json-safe"; export const protobufPackage = "osmosis.lockup"; @@ -396,6 +397,15 @@ function createBaseMsgLockTokens(): MsgLockTokens { export const MsgLockTokens = { typeUrl: "/osmosis.lockup.MsgLockTokens", aminoType: "osmosis/lockup/lock-tokens", + is(o: any): o is MsgLockTokens { + return o && (o.$typeUrl === MsgLockTokens.typeUrl || typeof o.owner === "string" && Duration.is(o.duration) && Array.isArray(o.coins) && (!o.coins.length || Coin.is(o.coins[0]))); + }, + isSDK(o: any): o is MsgLockTokensSDKType { + return o && (o.$typeUrl === MsgLockTokens.typeUrl || typeof o.owner === "string" && Duration.isSDK(o.duration) && Array.isArray(o.coins) && (!o.coins.length || Coin.isSDK(o.coins[0]))); + }, + isAmino(o: any): o is MsgLockTokensAmino { + return o && (o.$typeUrl === MsgLockTokens.typeUrl || typeof o.owner === "string" && Duration.isAmino(o.duration) && Array.isArray(o.coins) && (!o.coins.length || Coin.isAmino(o.coins[0]))); + }, encode(message: MsgLockTokens, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.owner !== "") { writer.uint32(10).string(message.owner); @@ -518,6 +528,12 @@ export const MsgLockTokens = { typeUrl: "/osmosis.lockup.MsgLockTokens", value: MsgLockTokens.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgLockTokens.typeUrl)) { + return; + } + Coin.registerTypeUrl(); } }; function createBaseMsgLockTokensResponse(): MsgLockTokensResponse { @@ -533,6 +549,15 @@ function createBaseMsgLockTokensResponse(): MsgLockTokensResponse { export const MsgLockTokensResponse = { typeUrl: "/osmosis.lockup.MsgLockTokensResponse", aminoType: "osmosis/lockup/lock-tokens-response", + is(o: any): o is MsgLockTokensResponse { + return o && (o.$typeUrl === MsgLockTokensResponse.typeUrl || typeof o.iD === "bigint"); + }, + isSDK(o: any): o is MsgLockTokensResponseSDKType { + return o && (o.$typeUrl === MsgLockTokensResponse.typeUrl || typeof o.ID === "bigint"); + }, + isAmino(o: any): o is MsgLockTokensResponseAmino { + return o && (o.$typeUrl === MsgLockTokensResponse.typeUrl || typeof o.ID === "bigint"); + }, encode(message: MsgLockTokensResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.iD !== BigInt(0)) { writer.uint32(8).uint64(message.iD); @@ -615,7 +640,8 @@ export const MsgLockTokensResponse = { typeUrl: "/osmosis.lockup.MsgLockTokensResponse", value: MsgLockTokensResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgBeginUnlockingAll(): MsgBeginUnlockingAll { return { @@ -630,6 +656,15 @@ function createBaseMsgBeginUnlockingAll(): MsgBeginUnlockingAll { export const MsgBeginUnlockingAll = { typeUrl: "/osmosis.lockup.MsgBeginUnlockingAll", aminoType: "osmosis/lockup/begin-unlock-tokens", + is(o: any): o is MsgBeginUnlockingAll { + return o && (o.$typeUrl === MsgBeginUnlockingAll.typeUrl || typeof o.owner === "string"); + }, + isSDK(o: any): o is MsgBeginUnlockingAllSDKType { + return o && (o.$typeUrl === MsgBeginUnlockingAll.typeUrl || typeof o.owner === "string"); + }, + isAmino(o: any): o is MsgBeginUnlockingAllAmino { + return o && (o.$typeUrl === MsgBeginUnlockingAll.typeUrl || typeof o.owner === "string"); + }, encode(message: MsgBeginUnlockingAll, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.owner !== "") { writer.uint32(10).string(message.owner); @@ -710,7 +745,8 @@ export const MsgBeginUnlockingAll = { typeUrl: "/osmosis.lockup.MsgBeginUnlockingAll", value: MsgBeginUnlockingAll.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgBeginUnlockingAllResponse(): MsgBeginUnlockingAllResponse { return { @@ -725,6 +761,15 @@ function createBaseMsgBeginUnlockingAllResponse(): MsgBeginUnlockingAllResponse export const MsgBeginUnlockingAllResponse = { typeUrl: "/osmosis.lockup.MsgBeginUnlockingAllResponse", aminoType: "osmosis/lockup/begin-unlocking-all-response", + is(o: any): o is MsgBeginUnlockingAllResponse { + return o && (o.$typeUrl === MsgBeginUnlockingAllResponse.typeUrl || Array.isArray(o.unlocks) && (!o.unlocks.length || PeriodLock.is(o.unlocks[0]))); + }, + isSDK(o: any): o is MsgBeginUnlockingAllResponseSDKType { + return o && (o.$typeUrl === MsgBeginUnlockingAllResponse.typeUrl || Array.isArray(o.unlocks) && (!o.unlocks.length || PeriodLock.isSDK(o.unlocks[0]))); + }, + isAmino(o: any): o is MsgBeginUnlockingAllResponseAmino { + return o && (o.$typeUrl === MsgBeginUnlockingAllResponse.typeUrl || Array.isArray(o.unlocks) && (!o.unlocks.length || PeriodLock.isAmino(o.unlocks[0]))); + }, encode(message: MsgBeginUnlockingAllResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.unlocks) { PeriodLock.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -815,6 +860,12 @@ export const MsgBeginUnlockingAllResponse = { typeUrl: "/osmosis.lockup.MsgBeginUnlockingAllResponse", value: MsgBeginUnlockingAllResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgBeginUnlockingAllResponse.typeUrl)) { + return; + } + PeriodLock.registerTypeUrl(); } }; function createBaseMsgBeginUnlocking(): MsgBeginUnlocking { @@ -832,6 +883,15 @@ function createBaseMsgBeginUnlocking(): MsgBeginUnlocking { export const MsgBeginUnlocking = { typeUrl: "/osmosis.lockup.MsgBeginUnlocking", aminoType: "osmosis/lockup/begin-unlock-period-lock", + is(o: any): o is MsgBeginUnlocking { + return o && (o.$typeUrl === MsgBeginUnlocking.typeUrl || typeof o.owner === "string" && typeof o.iD === "bigint" && Array.isArray(o.coins) && (!o.coins.length || Coin.is(o.coins[0]))); + }, + isSDK(o: any): o is MsgBeginUnlockingSDKType { + return o && (o.$typeUrl === MsgBeginUnlocking.typeUrl || typeof o.owner === "string" && typeof o.ID === "bigint" && Array.isArray(o.coins) && (!o.coins.length || Coin.isSDK(o.coins[0]))); + }, + isAmino(o: any): o is MsgBeginUnlockingAmino { + return o && (o.$typeUrl === MsgBeginUnlocking.typeUrl || typeof o.owner === "string" && typeof o.ID === "bigint" && Array.isArray(o.coins) && (!o.coins.length || Coin.isAmino(o.coins[0]))); + }, encode(message: MsgBeginUnlocking, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.owner !== "") { writer.uint32(10).string(message.owner); @@ -954,6 +1014,12 @@ export const MsgBeginUnlocking = { typeUrl: "/osmosis.lockup.MsgBeginUnlocking", value: MsgBeginUnlocking.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgBeginUnlocking.typeUrl)) { + return; + } + Coin.registerTypeUrl(); } }; function createBaseMsgBeginUnlockingResponse(): MsgBeginUnlockingResponse { @@ -969,6 +1035,15 @@ function createBaseMsgBeginUnlockingResponse(): MsgBeginUnlockingResponse { export const MsgBeginUnlockingResponse = { typeUrl: "/osmosis.lockup.MsgBeginUnlockingResponse", aminoType: "osmosis/lockup/begin-unlocking-response", + is(o: any): o is MsgBeginUnlockingResponse { + return o && (o.$typeUrl === MsgBeginUnlockingResponse.typeUrl || typeof o.success === "boolean"); + }, + isSDK(o: any): o is MsgBeginUnlockingResponseSDKType { + return o && (o.$typeUrl === MsgBeginUnlockingResponse.typeUrl || typeof o.success === "boolean"); + }, + isAmino(o: any): o is MsgBeginUnlockingResponseAmino { + return o && (o.$typeUrl === MsgBeginUnlockingResponse.typeUrl || typeof o.success === "boolean"); + }, encode(message: MsgBeginUnlockingResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.success === true) { writer.uint32(8).bool(message.success); @@ -1049,7 +1124,8 @@ export const MsgBeginUnlockingResponse = { typeUrl: "/osmosis.lockup.MsgBeginUnlockingResponse", value: MsgBeginUnlockingResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgExtendLockup(): MsgExtendLockup { return { @@ -1068,6 +1144,15 @@ function createBaseMsgExtendLockup(): MsgExtendLockup { export const MsgExtendLockup = { typeUrl: "/osmosis.lockup.MsgExtendLockup", aminoType: "osmosis/lockup/extend-lockup", + is(o: any): o is MsgExtendLockup { + return o && (o.$typeUrl === MsgExtendLockup.typeUrl || typeof o.owner === "string" && typeof o.iD === "bigint" && Duration.is(o.duration)); + }, + isSDK(o: any): o is MsgExtendLockupSDKType { + return o && (o.$typeUrl === MsgExtendLockup.typeUrl || typeof o.owner === "string" && typeof o.ID === "bigint" && Duration.isSDK(o.duration)); + }, + isAmino(o: any): o is MsgExtendLockupAmino { + return o && (o.$typeUrl === MsgExtendLockup.typeUrl || typeof o.owner === "string" && typeof o.ID === "bigint" && Duration.isAmino(o.duration)); + }, encode(message: MsgExtendLockup, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.owner !== "") { writer.uint32(10).string(message.owner); @@ -1182,7 +1267,8 @@ export const MsgExtendLockup = { typeUrl: "/osmosis.lockup.MsgExtendLockup", value: MsgExtendLockup.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgExtendLockupResponse(): MsgExtendLockupResponse { return { @@ -1197,6 +1283,15 @@ function createBaseMsgExtendLockupResponse(): MsgExtendLockupResponse { export const MsgExtendLockupResponse = { typeUrl: "/osmosis.lockup.MsgExtendLockupResponse", aminoType: "osmosis/lockup/extend-lockup-response", + is(o: any): o is MsgExtendLockupResponse { + return o && (o.$typeUrl === MsgExtendLockupResponse.typeUrl || typeof o.success === "boolean"); + }, + isSDK(o: any): o is MsgExtendLockupResponseSDKType { + return o && (o.$typeUrl === MsgExtendLockupResponse.typeUrl || typeof o.success === "boolean"); + }, + isAmino(o: any): o is MsgExtendLockupResponseAmino { + return o && (o.$typeUrl === MsgExtendLockupResponse.typeUrl || typeof o.success === "boolean"); + }, encode(message: MsgExtendLockupResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.success === true) { writer.uint32(8).bool(message.success); @@ -1277,7 +1372,8 @@ export const MsgExtendLockupResponse = { typeUrl: "/osmosis.lockup.MsgExtendLockupResponse", value: MsgExtendLockupResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgForceUnlock(): MsgForceUnlock { return { @@ -1296,6 +1392,15 @@ function createBaseMsgForceUnlock(): MsgForceUnlock { export const MsgForceUnlock = { typeUrl: "/osmosis.lockup.MsgForceUnlock", aminoType: "osmosis/lockup/force-unlock", + is(o: any): o is MsgForceUnlock { + return o && (o.$typeUrl === MsgForceUnlock.typeUrl || typeof o.owner === "string" && typeof o.iD === "bigint" && Array.isArray(o.coins) && (!o.coins.length || Coin.is(o.coins[0]))); + }, + isSDK(o: any): o is MsgForceUnlockSDKType { + return o && (o.$typeUrl === MsgForceUnlock.typeUrl || typeof o.owner === "string" && typeof o.ID === "bigint" && Array.isArray(o.coins) && (!o.coins.length || Coin.isSDK(o.coins[0]))); + }, + isAmino(o: any): o is MsgForceUnlockAmino { + return o && (o.$typeUrl === MsgForceUnlock.typeUrl || typeof o.owner === "string" && typeof o.ID === "bigint" && Array.isArray(o.coins) && (!o.coins.length || Coin.isAmino(o.coins[0]))); + }, encode(message: MsgForceUnlock, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.owner !== "") { writer.uint32(10).string(message.owner); @@ -1418,6 +1523,12 @@ export const MsgForceUnlock = { typeUrl: "/osmosis.lockup.MsgForceUnlock", value: MsgForceUnlock.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgForceUnlock.typeUrl)) { + return; + } + Coin.registerTypeUrl(); } }; function createBaseMsgForceUnlockResponse(): MsgForceUnlockResponse { @@ -1433,6 +1544,15 @@ function createBaseMsgForceUnlockResponse(): MsgForceUnlockResponse { export const MsgForceUnlockResponse = { typeUrl: "/osmosis.lockup.MsgForceUnlockResponse", aminoType: "osmosis/lockup/force-unlock-response", + is(o: any): o is MsgForceUnlockResponse { + return o && (o.$typeUrl === MsgForceUnlockResponse.typeUrl || typeof o.success === "boolean"); + }, + isSDK(o: any): o is MsgForceUnlockResponseSDKType { + return o && (o.$typeUrl === MsgForceUnlockResponse.typeUrl || typeof o.success === "boolean"); + }, + isAmino(o: any): o is MsgForceUnlockResponseAmino { + return o && (o.$typeUrl === MsgForceUnlockResponse.typeUrl || typeof o.success === "boolean"); + }, encode(message: MsgForceUnlockResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.success === true) { writer.uint32(8).bool(message.success); @@ -1513,5 +1633,6 @@ export const MsgForceUnlockResponse = { typeUrl: "/osmosis.lockup.MsgForceUnlockResponse", value: MsgForceUnlockResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/osmosis/mint/v1beta1/genesis.ts b/__fixtures__/v-next/outputv2/osmosis/mint/v1beta1/genesis.ts index dce18fabe4..9f170e9110 100644 --- a/__fixtures__/v-next/outputv2/osmosis/mint/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv2/osmosis/mint/v1beta1/genesis.ts @@ -1,5 +1,6 @@ import { Minter, MinterAmino, MinterSDKType, Params, ParamsAmino, ParamsSDKType } from "./mint"; import { BinaryReader, BinaryWriter } from "../../../binary"; +import { GlobalDecoderRegistry } from "../../../registry"; import { isSet, DeepPartial } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "osmosis.mint.v1beta1"; @@ -80,6 +81,15 @@ function createBaseGenesisState(): GenesisState { export const GenesisState = { typeUrl: "/osmosis.mint.v1beta1.GenesisState", aminoType: "osmosis/mint/genesis-state", + is(o: any): o is GenesisState { + return o && (o.$typeUrl === GenesisState.typeUrl || Minter.is(o.minter) && Params.is(o.params) && typeof o.reductionStartedEpoch === "bigint"); + }, + isSDK(o: any): o is GenesisStateSDKType { + return o && (o.$typeUrl === GenesisState.typeUrl || Minter.isSDK(o.minter) && Params.isSDK(o.params) && typeof o.reduction_started_epoch === "bigint"); + }, + isAmino(o: any): o is GenesisStateAmino { + return o && (o.$typeUrl === GenesisState.typeUrl || Minter.isAmino(o.minter) && Params.isAmino(o.params) && typeof o.reduction_started_epoch === "bigint"); + }, encode(message: GenesisState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.minter !== undefined) { Minter.encode(message.minter, writer.uint32(10).fork()).ldelim(); @@ -196,5 +206,12 @@ export const GenesisState = { typeUrl: "/osmosis.mint.v1beta1.GenesisState", value: GenesisState.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GenesisState.typeUrl)) { + return; + } + Minter.registerTypeUrl(); + Params.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/osmosis/mint/v1beta1/mint.ts b/__fixtures__/v-next/outputv2/osmosis/mint/v1beta1/mint.ts index 5e3a3919ba..33d5acff22 100644 --- a/__fixtures__/v-next/outputv2/osmosis/mint/v1beta1/mint.ts +++ b/__fixtures__/v-next/outputv2/osmosis/mint/v1beta1/mint.ts @@ -1,7 +1,8 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { Decimal } from "@cosmjs/math"; +import { Decimal } from "@interchainjs/math"; import { isSet, DeepPartial } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "osmosis.mint.v1beta1"; /** * Minter represents the minting state. @@ -304,6 +305,15 @@ function createBaseMinter(): Minter { export const Minter = { typeUrl: "/osmosis.mint.v1beta1.Minter", aminoType: "osmosis/mint/minter", + is(o: any): o is Minter { + return o && (o.$typeUrl === Minter.typeUrl || typeof o.epochProvisions === "string"); + }, + isSDK(o: any): o is MinterSDKType { + return o && (o.$typeUrl === Minter.typeUrl || typeof o.epoch_provisions === "string"); + }, + isAmino(o: any): o is MinterAmino { + return o && (o.$typeUrl === Minter.typeUrl || typeof o.epoch_provisions === "string"); + }, encode(message: Minter, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.epochProvisions !== "") { writer.uint32(10).string(Decimal.fromUserInput(message.epochProvisions, 18).atomics); @@ -361,7 +371,7 @@ export const Minter = { }, toAmino(message: Minter): MinterAmino { const obj: any = {}; - obj.epoch_provisions = message.epochProvisions === "" ? undefined : message.epochProvisions; + obj.epoch_provisions = message.epochProvisions === "" ? undefined : Decimal.fromUserInput(message.epochProvisions, 18).atomics; return obj; }, fromAminoMsg(object: MinterAminoMsg): Minter { @@ -384,7 +394,8 @@ export const Minter = { typeUrl: "/osmosis.mint.v1beta1.Minter", value: Minter.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseWeightedAddress(): WeightedAddress { return { @@ -403,6 +414,15 @@ function createBaseWeightedAddress(): WeightedAddress { export const WeightedAddress = { typeUrl: "/osmosis.mint.v1beta1.WeightedAddress", aminoType: "osmosis/mint/weighted-address", + is(o: any): o is WeightedAddress { + return o && (o.$typeUrl === WeightedAddress.typeUrl || typeof o.address === "string" && typeof o.weight === "string"); + }, + isSDK(o: any): o is WeightedAddressSDKType { + return o && (o.$typeUrl === WeightedAddress.typeUrl || typeof o.address === "string" && typeof o.weight === "string"); + }, + isAmino(o: any): o is WeightedAddressAmino { + return o && (o.$typeUrl === WeightedAddress.typeUrl || typeof o.address === "string" && typeof o.weight === "string"); + }, encode(message: WeightedAddress, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.address !== "") { writer.uint32(10).string(message.address); @@ -475,7 +495,7 @@ export const WeightedAddress = { toAmino(message: WeightedAddress): WeightedAddressAmino { const obj: any = {}; obj.address = message.address === "" ? undefined : message.address; - obj.weight = message.weight === "" ? undefined : message.weight; + obj.weight = message.weight === "" ? undefined : Decimal.fromUserInput(message.weight, 18).atomics; return obj; }, fromAminoMsg(object: WeightedAddressAminoMsg): WeightedAddress { @@ -498,7 +518,8 @@ export const WeightedAddress = { typeUrl: "/osmosis.mint.v1beta1.WeightedAddress", value: WeightedAddress.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseDistributionProportions(): DistributionProportions { return { @@ -519,6 +540,15 @@ function createBaseDistributionProportions(): DistributionProportions { export const DistributionProportions = { typeUrl: "/osmosis.mint.v1beta1.DistributionProportions", aminoType: "osmosis/mint/distribution-proportions", + is(o: any): o is DistributionProportions { + return o && (o.$typeUrl === DistributionProportions.typeUrl || typeof o.staking === "string" && typeof o.poolIncentives === "string" && typeof o.developerRewards === "string" && typeof o.communityPool === "string"); + }, + isSDK(o: any): o is DistributionProportionsSDKType { + return o && (o.$typeUrl === DistributionProportions.typeUrl || typeof o.staking === "string" && typeof o.pool_incentives === "string" && typeof o.developer_rewards === "string" && typeof o.community_pool === "string"); + }, + isAmino(o: any): o is DistributionProportionsAmino { + return o && (o.$typeUrl === DistributionProportions.typeUrl || typeof o.staking === "string" && typeof o.pool_incentives === "string" && typeof o.developer_rewards === "string" && typeof o.community_pool === "string"); + }, encode(message: DistributionProportions, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.staking !== "") { writer.uint32(10).string(Decimal.fromUserInput(message.staking, 18).atomics); @@ -618,10 +648,10 @@ export const DistributionProportions = { }, toAmino(message: DistributionProportions): DistributionProportionsAmino { const obj: any = {}; - obj.staking = message.staking === "" ? undefined : message.staking; - obj.pool_incentives = message.poolIncentives === "" ? undefined : message.poolIncentives; - obj.developer_rewards = message.developerRewards === "" ? undefined : message.developerRewards; - obj.community_pool = message.communityPool === "" ? undefined : message.communityPool; + obj.staking = message.staking === "" ? undefined : Decimal.fromUserInput(message.staking, 18).atomics; + obj.pool_incentives = message.poolIncentives === "" ? undefined : Decimal.fromUserInput(message.poolIncentives, 18).atomics; + obj.developer_rewards = message.developerRewards === "" ? undefined : Decimal.fromUserInput(message.developerRewards, 18).atomics; + obj.community_pool = message.communityPool === "" ? undefined : Decimal.fromUserInput(message.communityPool, 18).atomics; return obj; }, fromAminoMsg(object: DistributionProportionsAminoMsg): DistributionProportions { @@ -644,7 +674,8 @@ export const DistributionProportions = { typeUrl: "/osmosis.mint.v1beta1.DistributionProportions", value: DistributionProportions.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseParams(): Params { return { @@ -667,6 +698,15 @@ function createBaseParams(): Params { export const Params = { typeUrl: "/osmosis.mint.v1beta1.Params", aminoType: "osmosis/mint/params", + is(o: any): o is Params { + return o && (o.$typeUrl === Params.typeUrl || typeof o.mintDenom === "string" && typeof o.genesisEpochProvisions === "string" && typeof o.epochIdentifier === "string" && typeof o.reductionPeriodInEpochs === "bigint" && typeof o.reductionFactor === "string" && DistributionProportions.is(o.distributionProportions) && Array.isArray(o.weightedDeveloperRewardsReceivers) && (!o.weightedDeveloperRewardsReceivers.length || WeightedAddress.is(o.weightedDeveloperRewardsReceivers[0])) && typeof o.mintingRewardsDistributionStartEpoch === "bigint"); + }, + isSDK(o: any): o is ParamsSDKType { + return o && (o.$typeUrl === Params.typeUrl || typeof o.mint_denom === "string" && typeof o.genesis_epoch_provisions === "string" && typeof o.epoch_identifier === "string" && typeof o.reduction_period_in_epochs === "bigint" && typeof o.reduction_factor === "string" && DistributionProportions.isSDK(o.distribution_proportions) && Array.isArray(o.weighted_developer_rewards_receivers) && (!o.weighted_developer_rewards_receivers.length || WeightedAddress.isSDK(o.weighted_developer_rewards_receivers[0])) && typeof o.minting_rewards_distribution_start_epoch === "bigint"); + }, + isAmino(o: any): o is ParamsAmino { + return o && (o.$typeUrl === Params.typeUrl || typeof o.mint_denom === "string" && typeof o.genesis_epoch_provisions === "string" && typeof o.epoch_identifier === "string" && typeof o.reduction_period_in_epochs === "bigint" && typeof o.reduction_factor === "string" && DistributionProportions.isAmino(o.distribution_proportions) && Array.isArray(o.weighted_developer_rewards_receivers) && (!o.weighted_developer_rewards_receivers.length || WeightedAddress.isAmino(o.weighted_developer_rewards_receivers[0])) && typeof o.minting_rewards_distribution_start_epoch === "bigint"); + }, encode(message: Params, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.mintDenom !== "") { writer.uint32(10).string(message.mintDenom); @@ -835,10 +875,10 @@ export const Params = { toAmino(message: Params): ParamsAmino { const obj: any = {}; obj.mint_denom = message.mintDenom === "" ? undefined : message.mintDenom; - obj.genesis_epoch_provisions = message.genesisEpochProvisions === "" ? undefined : message.genesisEpochProvisions; + obj.genesis_epoch_provisions = message.genesisEpochProvisions === "" ? undefined : Decimal.fromUserInput(message.genesisEpochProvisions, 18).atomics; obj.epoch_identifier = message.epochIdentifier === "" ? undefined : message.epochIdentifier; obj.reduction_period_in_epochs = message.reductionPeriodInEpochs !== BigInt(0) ? message.reductionPeriodInEpochs?.toString() : undefined; - obj.reduction_factor = message.reductionFactor === "" ? undefined : message.reductionFactor; + obj.reduction_factor = message.reductionFactor === "" ? undefined : Decimal.fromUserInput(message.reductionFactor, 18).atomics; obj.distribution_proportions = message.distributionProportions ? DistributionProportions.toAmino(message.distributionProportions) : undefined; if (message.weightedDeveloperRewardsReceivers) { obj.weighted_developer_rewards_receivers = message.weightedDeveloperRewardsReceivers.map(e => e ? WeightedAddress.toAmino(e) : undefined); @@ -868,5 +908,12 @@ export const Params = { typeUrl: "/osmosis.mint.v1beta1.Params", value: Params.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Params.typeUrl)) { + return; + } + DistributionProportions.registerTypeUrl(); + WeightedAddress.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/osmosis/mint/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputv2/osmosis/mint/v1beta1/query.rpc.func.ts new file mode 100644 index 0000000000..a82c827bdf --- /dev/null +++ b/__fixtures__/v-next/outputv2/osmosis/mint/v1beta1/query.rpc.func.ts @@ -0,0 +1,28 @@ +import { buildQuery } from "../../../helper-func-types"; +import { QueryParamsRequest, QueryParamsResponse, QueryEpochProvisionsRequest, QueryEpochProvisionsResponse } from "./query"; +/** + * Params returns the total set of minting parameters. + * @name getParams + * @package osmosis.mint.v1beta1 + * @see proto service: osmosis.mint.v1beta1.Params + */ +export const getParams = buildQuery({ + encode: QueryParamsRequest.encode, + decode: QueryParamsResponse.decode, + service: "osmosis.mint.v1beta1.Query", + method: "Params", + deps: [QueryParamsRequest, QueryParamsResponse] +}); +/** + * EpochProvisions returns the current minting epoch provisions value. + * @name getEpochProvisions + * @package osmosis.mint.v1beta1 + * @see proto service: osmosis.mint.v1beta1.EpochProvisions + */ +export const getEpochProvisions = buildQuery({ + encode: QueryEpochProvisionsRequest.encode, + decode: QueryEpochProvisionsResponse.decode, + service: "osmosis.mint.v1beta1.Query", + method: "EpochProvisions", + deps: [QueryEpochProvisionsRequest, QueryEpochProvisionsResponse] +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/osmosis/mint/v1beta1/query.ts b/__fixtures__/v-next/outputv2/osmosis/mint/v1beta1/query.ts index 6abed30f80..5fe0e35760 100644 --- a/__fixtures__/v-next/outputv2/osmosis/mint/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv2/osmosis/mint/v1beta1/query.ts @@ -2,6 +2,7 @@ import { Params, ParamsAmino, ParamsSDKType } from "./mint"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { JsonSafe } from "../../../json-safe"; import { DeepPartial, isSet, bytesFromBase64, base64FromBytes } from "../../../helpers"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "osmosis.mint.v1beta1"; /** * QueryParamsRequest is the request type for the Query/Params RPC method. @@ -161,6 +162,15 @@ function createBaseQueryParamsRequest(): QueryParamsRequest { export const QueryParamsRequest = { typeUrl: "/osmosis.mint.v1beta1.QueryParamsRequest", aminoType: "osmosis/mint/query-params-request", + is(o: any): o is QueryParamsRequest { + return o && o.$typeUrl === QueryParamsRequest.typeUrl; + }, + isSDK(o: any): o is QueryParamsRequestSDKType { + return o && o.$typeUrl === QueryParamsRequest.typeUrl; + }, + isAmino(o: any): o is QueryParamsRequestAmino { + return o && o.$typeUrl === QueryParamsRequest.typeUrl; + }, encode(_: QueryParamsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -225,7 +235,8 @@ export const QueryParamsRequest = { typeUrl: "/osmosis.mint.v1beta1.QueryParamsRequest", value: QueryParamsRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryParamsResponse(): QueryParamsResponse { return { @@ -241,6 +252,15 @@ function createBaseQueryParamsResponse(): QueryParamsResponse { export const QueryParamsResponse = { typeUrl: "/osmosis.mint.v1beta1.QueryParamsResponse", aminoType: "osmosis/mint/query-params-response", + is(o: any): o is QueryParamsResponse { + return o && (o.$typeUrl === QueryParamsResponse.typeUrl || Params.is(o.params)); + }, + isSDK(o: any): o is QueryParamsResponseSDKType { + return o && (o.$typeUrl === QueryParamsResponse.typeUrl || Params.isSDK(o.params)); + }, + isAmino(o: any): o is QueryParamsResponseAmino { + return o && (o.$typeUrl === QueryParamsResponse.typeUrl || Params.isAmino(o.params)); + }, encode(message: QueryParamsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.params !== undefined) { Params.encode(message.params, writer.uint32(10).fork()).ldelim(); @@ -323,6 +343,12 @@ export const QueryParamsResponse = { typeUrl: "/osmosis.mint.v1beta1.QueryParamsResponse", value: QueryParamsResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryParamsResponse.typeUrl)) { + return; + } + Params.registerTypeUrl(); } }; function createBaseQueryEpochProvisionsRequest(): QueryEpochProvisionsRequest { @@ -338,6 +364,15 @@ function createBaseQueryEpochProvisionsRequest(): QueryEpochProvisionsRequest { export const QueryEpochProvisionsRequest = { typeUrl: "/osmosis.mint.v1beta1.QueryEpochProvisionsRequest", aminoType: "osmosis/mint/query-epoch-provisions-request", + is(o: any): o is QueryEpochProvisionsRequest { + return o && o.$typeUrl === QueryEpochProvisionsRequest.typeUrl; + }, + isSDK(o: any): o is QueryEpochProvisionsRequestSDKType { + return o && o.$typeUrl === QueryEpochProvisionsRequest.typeUrl; + }, + isAmino(o: any): o is QueryEpochProvisionsRequestAmino { + return o && o.$typeUrl === QueryEpochProvisionsRequest.typeUrl; + }, encode(_: QueryEpochProvisionsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -402,7 +437,8 @@ export const QueryEpochProvisionsRequest = { typeUrl: "/osmosis.mint.v1beta1.QueryEpochProvisionsRequest", value: QueryEpochProvisionsRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryEpochProvisionsResponse(): QueryEpochProvisionsResponse { return { @@ -419,6 +455,15 @@ function createBaseQueryEpochProvisionsResponse(): QueryEpochProvisionsResponse export const QueryEpochProvisionsResponse = { typeUrl: "/osmosis.mint.v1beta1.QueryEpochProvisionsResponse", aminoType: "osmosis/mint/query-epoch-provisions-response", + is(o: any): o is QueryEpochProvisionsResponse { + return o && (o.$typeUrl === QueryEpochProvisionsResponse.typeUrl || o.epochProvisions instanceof Uint8Array || typeof o.epochProvisions === "string"); + }, + isSDK(o: any): o is QueryEpochProvisionsResponseSDKType { + return o && (o.$typeUrl === QueryEpochProvisionsResponse.typeUrl || o.epoch_provisions instanceof Uint8Array || typeof o.epoch_provisions === "string"); + }, + isAmino(o: any): o is QueryEpochProvisionsResponseAmino { + return o && (o.$typeUrl === QueryEpochProvisionsResponse.typeUrl || o.epoch_provisions instanceof Uint8Array || typeof o.epoch_provisions === "string"); + }, encode(message: QueryEpochProvisionsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.epochProvisions.length !== 0) { writer.uint32(10).bytes(message.epochProvisions); @@ -499,5 +544,6 @@ export const QueryEpochProvisionsResponse = { typeUrl: "/osmosis.mint.v1beta1.QueryEpochProvisionsResponse", value: QueryEpochProvisionsResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/osmosis/pool-incentives/v1beta1/genesis.ts b/__fixtures__/v-next/outputv2/osmosis/pool-incentives/v1beta1/genesis.ts index 34fbe121ba..67e0c1c30f 100644 --- a/__fixtures__/v-next/outputv2/osmosis/pool-incentives/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv2/osmosis/pool-incentives/v1beta1/genesis.ts @@ -1,6 +1,7 @@ import { Params, ParamsAmino, ParamsSDKType, DistrInfo, DistrInfoAmino, DistrInfoSDKType, PoolToGauges, PoolToGaugesAmino, PoolToGaugesSDKType } from "./incentives"; import { Duration, DurationAmino, DurationSDKType } from "../../../google/protobuf/duration"; import { BinaryReader, BinaryWriter } from "../../../binary"; +import { GlobalDecoderRegistry } from "../../../registry"; import { isSet, DeepPartial } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "osmosis.poolincentives.v1beta1"; @@ -71,6 +72,15 @@ function createBaseGenesisState(): GenesisState { export const GenesisState = { typeUrl: "/osmosis.poolincentives.v1beta1.GenesisState", aminoType: "osmosis/poolincentives/genesis-state", + is(o: any): o is GenesisState { + return o && (o.$typeUrl === GenesisState.typeUrl || Params.is(o.params) && Array.isArray(o.lockableDurations) && (!o.lockableDurations.length || Duration.is(o.lockableDurations[0]))); + }, + isSDK(o: any): o is GenesisStateSDKType { + return o && (o.$typeUrl === GenesisState.typeUrl || Params.isSDK(o.params) && Array.isArray(o.lockable_durations) && (!o.lockable_durations.length || Duration.isSDK(o.lockable_durations[0]))); + }, + isAmino(o: any): o is GenesisStateAmino { + return o && (o.$typeUrl === GenesisState.typeUrl || Params.isAmino(o.params) && Array.isArray(o.lockable_durations) && (!o.lockable_durations.length || Duration.isAmino(o.lockable_durations[0]))); + }, encode(message: GenesisState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.params !== undefined) { Params.encode(message.params, writer.uint32(10).fork()).ldelim(); @@ -212,5 +222,13 @@ export const GenesisState = { typeUrl: "/osmosis.poolincentives.v1beta1.GenesisState", value: GenesisState.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GenesisState.typeUrl)) { + return; + } + Params.registerTypeUrl(); + DistrInfo.registerTypeUrl(); + PoolToGauges.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/osmosis/pool-incentives/v1beta1/gov.ts b/__fixtures__/v-next/outputv2/osmosis/pool-incentives/v1beta1/gov.ts index befa159f88..b444b35915 100644 --- a/__fixtures__/v-next/outputv2/osmosis/pool-incentives/v1beta1/gov.ts +++ b/__fixtures__/v-next/outputv2/osmosis/pool-incentives/v1beta1/gov.ts @@ -2,6 +2,7 @@ import { DistrRecord, DistrRecordAmino, DistrRecordSDKType } from "./incentives" import { BinaryReader, BinaryWriter } from "../../../binary"; import { isSet, DeepPartial } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "osmosis.poolincentives.v1beta1"; /** * ReplacePoolIncentivesProposal is a gov Content type for updating the pool @@ -148,6 +149,15 @@ function createBaseReplacePoolIncentivesProposal(): ReplacePoolIncentivesProposa export const ReplacePoolIncentivesProposal = { typeUrl: "/osmosis.poolincentives.v1beta1.ReplacePoolIncentivesProposal", aminoType: "osmosis/poolincentives/replace-pool-incentives-proposal", + is(o: any): o is ReplacePoolIncentivesProposal { + return o && (o.$typeUrl === ReplacePoolIncentivesProposal.typeUrl || typeof o.title === "string" && typeof o.description === "string" && Array.isArray(o.records) && (!o.records.length || DistrRecord.is(o.records[0]))); + }, + isSDK(o: any): o is ReplacePoolIncentivesProposalSDKType { + return o && (o.$typeUrl === ReplacePoolIncentivesProposal.typeUrl || typeof o.title === "string" && typeof o.description === "string" && Array.isArray(o.records) && (!o.records.length || DistrRecord.isSDK(o.records[0]))); + }, + isAmino(o: any): o is ReplacePoolIncentivesProposalAmino { + return o && (o.$typeUrl === ReplacePoolIncentivesProposal.typeUrl || typeof o.title === "string" && typeof o.description === "string" && Array.isArray(o.records) && (!o.records.length || DistrRecord.isAmino(o.records[0]))); + }, encode(message: ReplacePoolIncentivesProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.title !== "") { writer.uint32(10).string(message.title); @@ -268,6 +278,14 @@ export const ReplacePoolIncentivesProposal = { typeUrl: "/osmosis.poolincentives.v1beta1.ReplacePoolIncentivesProposal", value: ReplacePoolIncentivesProposal.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ReplacePoolIncentivesProposal.typeUrl)) { + return; + } + GlobalDecoderRegistry.register(ReplacePoolIncentivesProposal.typeUrl, ReplacePoolIncentivesProposal); + GlobalDecoderRegistry.registerAminoProtoMapping(ReplacePoolIncentivesProposal.aminoType, ReplacePoolIncentivesProposal.typeUrl); + DistrRecord.registerTypeUrl(); } }; function createBaseUpdatePoolIncentivesProposal(): UpdatePoolIncentivesProposal { @@ -293,6 +311,15 @@ function createBaseUpdatePoolIncentivesProposal(): UpdatePoolIncentivesProposal export const UpdatePoolIncentivesProposal = { typeUrl: "/osmosis.poolincentives.v1beta1.UpdatePoolIncentivesProposal", aminoType: "osmosis/poolincentives/update-pool-incentives-proposal", + is(o: any): o is UpdatePoolIncentivesProposal { + return o && (o.$typeUrl === UpdatePoolIncentivesProposal.typeUrl || typeof o.title === "string" && typeof o.description === "string" && Array.isArray(o.records) && (!o.records.length || DistrRecord.is(o.records[0]))); + }, + isSDK(o: any): o is UpdatePoolIncentivesProposalSDKType { + return o && (o.$typeUrl === UpdatePoolIncentivesProposal.typeUrl || typeof o.title === "string" && typeof o.description === "string" && Array.isArray(o.records) && (!o.records.length || DistrRecord.isSDK(o.records[0]))); + }, + isAmino(o: any): o is UpdatePoolIncentivesProposalAmino { + return o && (o.$typeUrl === UpdatePoolIncentivesProposal.typeUrl || typeof o.title === "string" && typeof o.description === "string" && Array.isArray(o.records) && (!o.records.length || DistrRecord.isAmino(o.records[0]))); + }, encode(message: UpdatePoolIncentivesProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.title !== "") { writer.uint32(10).string(message.title); @@ -413,5 +440,13 @@ export const UpdatePoolIncentivesProposal = { typeUrl: "/osmosis.poolincentives.v1beta1.UpdatePoolIncentivesProposal", value: UpdatePoolIncentivesProposal.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(UpdatePoolIncentivesProposal.typeUrl)) { + return; + } + GlobalDecoderRegistry.register(UpdatePoolIncentivesProposal.typeUrl, UpdatePoolIncentivesProposal); + GlobalDecoderRegistry.registerAminoProtoMapping(UpdatePoolIncentivesProposal.aminoType, UpdatePoolIncentivesProposal.typeUrl); + DistrRecord.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/osmosis/pool-incentives/v1beta1/incentives.ts b/__fixtures__/v-next/outputv2/osmosis/pool-incentives/v1beta1/incentives.ts index 59fb6d9516..754125b311 100644 --- a/__fixtures__/v-next/outputv2/osmosis/pool-incentives/v1beta1/incentives.ts +++ b/__fixtures__/v-next/outputv2/osmosis/pool-incentives/v1beta1/incentives.ts @@ -2,6 +2,7 @@ import { Duration, DurationAmino, DurationSDKType } from "../../../google/protob import { BinaryReader, BinaryWriter } from "../../../binary"; import { isSet, DeepPartial } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "osmosis.poolincentives.v1beta1"; /** * @name Params @@ -232,6 +233,15 @@ function createBaseParams(): Params { export const Params = { typeUrl: "/osmosis.poolincentives.v1beta1.Params", aminoType: "osmosis/poolincentives/params", + is(o: any): o is Params { + return o && (o.$typeUrl === Params.typeUrl || typeof o.mintedDenom === "string"); + }, + isSDK(o: any): o is ParamsSDKType { + return o && (o.$typeUrl === Params.typeUrl || typeof o.minted_denom === "string"); + }, + isAmino(o: any): o is ParamsAmino { + return o && (o.$typeUrl === Params.typeUrl || typeof o.minted_denom === "string"); + }, encode(message: Params, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.mintedDenom !== "") { writer.uint32(10).string(message.mintedDenom); @@ -312,7 +322,8 @@ export const Params = { typeUrl: "/osmosis.poolincentives.v1beta1.Params", value: Params.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseLockableDurationsInfo(): LockableDurationsInfo { return { @@ -327,6 +338,15 @@ function createBaseLockableDurationsInfo(): LockableDurationsInfo { export const LockableDurationsInfo = { typeUrl: "/osmosis.poolincentives.v1beta1.LockableDurationsInfo", aminoType: "osmosis/poolincentives/lockable-durations-info", + is(o: any): o is LockableDurationsInfo { + return o && (o.$typeUrl === LockableDurationsInfo.typeUrl || Array.isArray(o.lockableDurations) && (!o.lockableDurations.length || Duration.is(o.lockableDurations[0]))); + }, + isSDK(o: any): o is LockableDurationsInfoSDKType { + return o && (o.$typeUrl === LockableDurationsInfo.typeUrl || Array.isArray(o.lockable_durations) && (!o.lockable_durations.length || Duration.isSDK(o.lockable_durations[0]))); + }, + isAmino(o: any): o is LockableDurationsInfoAmino { + return o && (o.$typeUrl === LockableDurationsInfo.typeUrl || Array.isArray(o.lockable_durations) && (!o.lockable_durations.length || Duration.isAmino(o.lockable_durations[0]))); + }, encode(message: LockableDurationsInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.lockableDurations) { Duration.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -417,7 +437,8 @@ export const LockableDurationsInfo = { typeUrl: "/osmosis.poolincentives.v1beta1.LockableDurationsInfo", value: LockableDurationsInfo.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseDistrInfo(): DistrInfo { return { @@ -433,6 +454,15 @@ function createBaseDistrInfo(): DistrInfo { export const DistrInfo = { typeUrl: "/osmosis.poolincentives.v1beta1.DistrInfo", aminoType: "osmosis/poolincentives/distr-info", + is(o: any): o is DistrInfo { + return o && (o.$typeUrl === DistrInfo.typeUrl || typeof o.totalWeight === "string" && Array.isArray(o.records) && (!o.records.length || DistrRecord.is(o.records[0]))); + }, + isSDK(o: any): o is DistrInfoSDKType { + return o && (o.$typeUrl === DistrInfo.typeUrl || typeof o.total_weight === "string" && Array.isArray(o.records) && (!o.records.length || DistrRecord.isSDK(o.records[0]))); + }, + isAmino(o: any): o is DistrInfoAmino { + return o && (o.$typeUrl === DistrInfo.typeUrl || typeof o.total_weight === "string" && Array.isArray(o.records) && (!o.records.length || DistrRecord.isAmino(o.records[0]))); + }, encode(message: DistrInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.totalWeight !== "") { writer.uint32(10).string(message.totalWeight); @@ -538,6 +568,12 @@ export const DistrInfo = { typeUrl: "/osmosis.poolincentives.v1beta1.DistrInfo", value: DistrInfo.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(DistrInfo.typeUrl)) { + return; + } + DistrRecord.registerTypeUrl(); } }; function createBaseDistrRecord(): DistrRecord { @@ -554,6 +590,15 @@ function createBaseDistrRecord(): DistrRecord { export const DistrRecord = { typeUrl: "/osmosis.poolincentives.v1beta1.DistrRecord", aminoType: "osmosis/poolincentives/distr-record", + is(o: any): o is DistrRecord { + return o && (o.$typeUrl === DistrRecord.typeUrl || typeof o.gaugeId === "bigint" && typeof o.weight === "string"); + }, + isSDK(o: any): o is DistrRecordSDKType { + return o && (o.$typeUrl === DistrRecord.typeUrl || typeof o.gauge_id === "bigint" && typeof o.weight === "string"); + }, + isAmino(o: any): o is DistrRecordAmino { + return o && (o.$typeUrl === DistrRecord.typeUrl || typeof o.gauge_id === "bigint" && typeof o.weight === "string"); + }, encode(message: DistrRecord, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.gaugeId !== BigInt(0)) { writer.uint32(8).uint64(message.gaugeId); @@ -651,7 +696,8 @@ export const DistrRecord = { typeUrl: "/osmosis.poolincentives.v1beta1.DistrRecord", value: DistrRecord.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBasePoolToGauge(): PoolToGauge { return { @@ -668,6 +714,15 @@ function createBasePoolToGauge(): PoolToGauge { export const PoolToGauge = { typeUrl: "/osmosis.poolincentives.v1beta1.PoolToGauge", aminoType: "osmosis/poolincentives/pool-to-gauge", + is(o: any): o is PoolToGauge { + return o && (o.$typeUrl === PoolToGauge.typeUrl || typeof o.poolId === "bigint" && typeof o.gaugeId === "bigint" && Duration.is(o.duration)); + }, + isSDK(o: any): o is PoolToGaugeSDKType { + return o && (o.$typeUrl === PoolToGauge.typeUrl || typeof o.pool_id === "bigint" && typeof o.gauge_id === "bigint" && Duration.isSDK(o.duration)); + }, + isAmino(o: any): o is PoolToGaugeAmino { + return o && (o.$typeUrl === PoolToGauge.typeUrl || typeof o.pool_id === "bigint" && typeof o.gauge_id === "bigint" && Duration.isAmino(o.duration)); + }, encode(message: PoolToGauge, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.poolId !== BigInt(0)) { writer.uint32(8).uint64(message.poolId); @@ -784,7 +839,8 @@ export const PoolToGauge = { typeUrl: "/osmosis.poolincentives.v1beta1.PoolToGauge", value: PoolToGauge.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBasePoolToGauges(): PoolToGauges { return { @@ -799,6 +855,15 @@ function createBasePoolToGauges(): PoolToGauges { export const PoolToGauges = { typeUrl: "/osmosis.poolincentives.v1beta1.PoolToGauges", aminoType: "osmosis/poolincentives/pool-to-gauges", + is(o: any): o is PoolToGauges { + return o && (o.$typeUrl === PoolToGauges.typeUrl || Array.isArray(o.poolToGauge) && (!o.poolToGauge.length || PoolToGauge.is(o.poolToGauge[0]))); + }, + isSDK(o: any): o is PoolToGaugesSDKType { + return o && (o.$typeUrl === PoolToGauges.typeUrl || Array.isArray(o.pool_to_gauge) && (!o.pool_to_gauge.length || PoolToGauge.isSDK(o.pool_to_gauge[0]))); + }, + isAmino(o: any): o is PoolToGaugesAmino { + return o && (o.$typeUrl === PoolToGauges.typeUrl || Array.isArray(o.pool_to_gauge) && (!o.pool_to_gauge.length || PoolToGauge.isAmino(o.pool_to_gauge[0]))); + }, encode(message: PoolToGauges, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.poolToGauge) { PoolToGauge.encode(v!, writer.uint32(18).fork()).ldelim(); @@ -889,5 +954,11 @@ export const PoolToGauges = { typeUrl: "/osmosis.poolincentives.v1beta1.PoolToGauges", value: PoolToGauges.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(PoolToGauges.typeUrl)) { + return; + } + PoolToGauge.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/osmosis/pool-incentives/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputv2/osmosis/pool-incentives/v1beta1/query.rpc.func.ts new file mode 100644 index 0000000000..890aaeb71d --- /dev/null +++ b/__fixtures__/v-next/outputv2/osmosis/pool-incentives/v1beta1/query.rpc.func.ts @@ -0,0 +1,80 @@ +import { buildQuery } from "../../../helper-func-types"; +import { QueryGaugeIdsRequest, QueryGaugeIdsResponse, QueryDistrInfoRequest, QueryDistrInfoResponse, QueryParamsRequest, QueryParamsResponse, QueryLockableDurationsRequest, QueryLockableDurationsResponse, QueryIncentivizedPoolsRequest, QueryIncentivizedPoolsResponse, QueryExternalIncentiveGaugesRequest, QueryExternalIncentiveGaugesResponse } from "./query"; +/** + * GaugeIds takes the pool id and returns the matching gauge ids and durations + * @name getGaugeIds + * @package osmosis.poolincentives.v1beta1 + * @see proto service: osmosis.poolincentives.v1beta1.GaugeIds + */ +export const getGaugeIds = buildQuery({ + encode: QueryGaugeIdsRequest.encode, + decode: QueryGaugeIdsResponse.decode, + service: "osmosis.poolincentives.v1beta1.Query", + method: "GaugeIds", + deps: [QueryGaugeIdsRequest, QueryGaugeIdsResponse] +}); +/** + * DistrInfo returns the pool's matching gauge ids and weights. + * @name getDistrInfo + * @package osmosis.poolincentives.v1beta1 + * @see proto service: osmosis.poolincentives.v1beta1.DistrInfo + */ +export const getDistrInfo = buildQuery({ + encode: QueryDistrInfoRequest.encode, + decode: QueryDistrInfoResponse.decode, + service: "osmosis.poolincentives.v1beta1.Query", + method: "DistrInfo", + deps: [QueryDistrInfoRequest, QueryDistrInfoResponse] +}); +/** + * Params returns pool incentives params. + * @name getParams + * @package osmosis.poolincentives.v1beta1 + * @see proto service: osmosis.poolincentives.v1beta1.Params + */ +export const getParams = buildQuery({ + encode: QueryParamsRequest.encode, + decode: QueryParamsResponse.decode, + service: "osmosis.poolincentives.v1beta1.Query", + method: "Params", + deps: [QueryParamsRequest, QueryParamsResponse] +}); +/** + * LockableDurations returns lock durations for pools. + * @name getLockableDurations + * @package osmosis.poolincentives.v1beta1 + * @see proto service: osmosis.poolincentives.v1beta1.LockableDurations + */ +export const getLockableDurations = buildQuery({ + encode: QueryLockableDurationsRequest.encode, + decode: QueryLockableDurationsResponse.decode, + service: "osmosis.poolincentives.v1beta1.Query", + method: "LockableDurations", + deps: [QueryLockableDurationsRequest, QueryLockableDurationsResponse] +}); +/** + * IncentivizedPools returns currently incentivized pools + * @name getIncentivizedPools + * @package osmosis.poolincentives.v1beta1 + * @see proto service: osmosis.poolincentives.v1beta1.IncentivizedPools + */ +export const getIncentivizedPools = buildQuery({ + encode: QueryIncentivizedPoolsRequest.encode, + decode: QueryIncentivizedPoolsResponse.decode, + service: "osmosis.poolincentives.v1beta1.Query", + method: "IncentivizedPools", + deps: [QueryIncentivizedPoolsRequest, QueryIncentivizedPoolsResponse] +}); +/** + * ExternalIncentiveGauges returns external incentive gauges. + * @name getExternalIncentiveGauges + * @package osmosis.poolincentives.v1beta1 + * @see proto service: osmosis.poolincentives.v1beta1.ExternalIncentiveGauges + */ +export const getExternalIncentiveGauges = buildQuery({ + encode: QueryExternalIncentiveGaugesRequest.encode, + decode: QueryExternalIncentiveGaugesResponse.decode, + service: "osmosis.poolincentives.v1beta1.Query", + method: "ExternalIncentiveGauges", + deps: [QueryExternalIncentiveGaugesRequest, QueryExternalIncentiveGaugesResponse] +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/osmosis/pool-incentives/v1beta1/query.ts b/__fixtures__/v-next/outputv2/osmosis/pool-incentives/v1beta1/query.ts index 550d576ea7..a60a639c07 100644 --- a/__fixtures__/v-next/outputv2/osmosis/pool-incentives/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv2/osmosis/pool-incentives/v1beta1/query.ts @@ -4,6 +4,7 @@ import { Gauge, GaugeAmino, GaugeSDKType } from "../../incentives/gauge"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { isSet, DeepPartial } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "osmosis.poolincentives.v1beta1"; /** * @name QueryGaugeIdsRequest @@ -448,6 +449,15 @@ function createBaseQueryGaugeIdsRequest(): QueryGaugeIdsRequest { export const QueryGaugeIdsRequest = { typeUrl: "/osmosis.poolincentives.v1beta1.QueryGaugeIdsRequest", aminoType: "osmosis/poolincentives/query-gauge-ids-request", + is(o: any): o is QueryGaugeIdsRequest { + return o && (o.$typeUrl === QueryGaugeIdsRequest.typeUrl || typeof o.poolId === "bigint"); + }, + isSDK(o: any): o is QueryGaugeIdsRequestSDKType { + return o && (o.$typeUrl === QueryGaugeIdsRequest.typeUrl || typeof o.pool_id === "bigint"); + }, + isAmino(o: any): o is QueryGaugeIdsRequestAmino { + return o && (o.$typeUrl === QueryGaugeIdsRequest.typeUrl || typeof o.pool_id === "bigint"); + }, encode(message: QueryGaugeIdsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.poolId !== BigInt(0)) { writer.uint32(8).uint64(message.poolId); @@ -530,7 +540,8 @@ export const QueryGaugeIdsRequest = { typeUrl: "/osmosis.poolincentives.v1beta1.QueryGaugeIdsRequest", value: QueryGaugeIdsRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryGaugeIdsResponse(): QueryGaugeIdsResponse { return { @@ -545,6 +556,15 @@ function createBaseQueryGaugeIdsResponse(): QueryGaugeIdsResponse { export const QueryGaugeIdsResponse = { typeUrl: "/osmosis.poolincentives.v1beta1.QueryGaugeIdsResponse", aminoType: "osmosis/poolincentives/query-gauge-ids-response", + is(o: any): o is QueryGaugeIdsResponse { + return o && (o.$typeUrl === QueryGaugeIdsResponse.typeUrl || Array.isArray(o.gaugeIdsWithDuration) && (!o.gaugeIdsWithDuration.length || QueryGaugeIdsResponse_GaugeIdWithDuration.is(o.gaugeIdsWithDuration[0]))); + }, + isSDK(o: any): o is QueryGaugeIdsResponseSDKType { + return o && (o.$typeUrl === QueryGaugeIdsResponse.typeUrl || Array.isArray(o.gauge_ids_with_duration) && (!o.gauge_ids_with_duration.length || QueryGaugeIdsResponse_GaugeIdWithDuration.isSDK(o.gauge_ids_with_duration[0]))); + }, + isAmino(o: any): o is QueryGaugeIdsResponseAmino { + return o && (o.$typeUrl === QueryGaugeIdsResponse.typeUrl || Array.isArray(o.gauge_ids_with_duration) && (!o.gauge_ids_with_duration.length || QueryGaugeIdsResponse_GaugeIdWithDuration.isAmino(o.gauge_ids_with_duration[0]))); + }, encode(message: QueryGaugeIdsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.gaugeIdsWithDuration) { QueryGaugeIdsResponse_GaugeIdWithDuration.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -635,6 +655,12 @@ export const QueryGaugeIdsResponse = { typeUrl: "/osmosis.poolincentives.v1beta1.QueryGaugeIdsResponse", value: QueryGaugeIdsResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryGaugeIdsResponse.typeUrl)) { + return; + } + QueryGaugeIdsResponse_GaugeIdWithDuration.registerTypeUrl(); } }; function createBaseQueryGaugeIdsResponse_GaugeIdWithDuration(): QueryGaugeIdsResponse_GaugeIdWithDuration { @@ -652,6 +678,15 @@ function createBaseQueryGaugeIdsResponse_GaugeIdWithDuration(): QueryGaugeIdsRes export const QueryGaugeIdsResponse_GaugeIdWithDuration = { typeUrl: "/osmosis.poolincentives.v1beta1.GaugeIdWithDuration", aminoType: "osmosis/poolincentives/gauge-id-with-duration", + is(o: any): o is QueryGaugeIdsResponse_GaugeIdWithDuration { + return o && (o.$typeUrl === QueryGaugeIdsResponse_GaugeIdWithDuration.typeUrl || typeof o.gaugeId === "bigint" && Duration.is(o.duration) && typeof o.gaugeIncentivePercentage === "string"); + }, + isSDK(o: any): o is QueryGaugeIdsResponse_GaugeIdWithDurationSDKType { + return o && (o.$typeUrl === QueryGaugeIdsResponse_GaugeIdWithDuration.typeUrl || typeof o.gauge_id === "bigint" && Duration.isSDK(o.duration) && typeof o.gauge_incentive_percentage === "string"); + }, + isAmino(o: any): o is QueryGaugeIdsResponse_GaugeIdWithDurationAmino { + return o && (o.$typeUrl === QueryGaugeIdsResponse_GaugeIdWithDuration.typeUrl || typeof o.gauge_id === "bigint" && Duration.isAmino(o.duration) && typeof o.gauge_incentive_percentage === "string"); + }, encode(message: QueryGaugeIdsResponse_GaugeIdWithDuration, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.gaugeId !== BigInt(0)) { writer.uint32(8).uint64(message.gaugeId); @@ -766,7 +801,8 @@ export const QueryGaugeIdsResponse_GaugeIdWithDuration = { typeUrl: "/osmosis.poolincentives.v1beta1.GaugeIdWithDuration", value: QueryGaugeIdsResponse_GaugeIdWithDuration.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryDistrInfoRequest(): QueryDistrInfoRequest { return {}; @@ -779,6 +815,15 @@ function createBaseQueryDistrInfoRequest(): QueryDistrInfoRequest { export const QueryDistrInfoRequest = { typeUrl: "/osmosis.poolincentives.v1beta1.QueryDistrInfoRequest", aminoType: "osmosis/poolincentives/query-distr-info-request", + is(o: any): o is QueryDistrInfoRequest { + return o && o.$typeUrl === QueryDistrInfoRequest.typeUrl; + }, + isSDK(o: any): o is QueryDistrInfoRequestSDKType { + return o && o.$typeUrl === QueryDistrInfoRequest.typeUrl; + }, + isAmino(o: any): o is QueryDistrInfoRequestAmino { + return o && o.$typeUrl === QueryDistrInfoRequest.typeUrl; + }, encode(_: QueryDistrInfoRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -843,7 +888,8 @@ export const QueryDistrInfoRequest = { typeUrl: "/osmosis.poolincentives.v1beta1.QueryDistrInfoRequest", value: QueryDistrInfoRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryDistrInfoResponse(): QueryDistrInfoResponse { return { @@ -858,6 +904,15 @@ function createBaseQueryDistrInfoResponse(): QueryDistrInfoResponse { export const QueryDistrInfoResponse = { typeUrl: "/osmosis.poolincentives.v1beta1.QueryDistrInfoResponse", aminoType: "osmosis/poolincentives/query-distr-info-response", + is(o: any): o is QueryDistrInfoResponse { + return o && (o.$typeUrl === QueryDistrInfoResponse.typeUrl || DistrInfo.is(o.distrInfo)); + }, + isSDK(o: any): o is QueryDistrInfoResponseSDKType { + return o && (o.$typeUrl === QueryDistrInfoResponse.typeUrl || DistrInfo.isSDK(o.distr_info)); + }, + isAmino(o: any): o is QueryDistrInfoResponseAmino { + return o && (o.$typeUrl === QueryDistrInfoResponse.typeUrl || DistrInfo.isAmino(o.distr_info)); + }, encode(message: QueryDistrInfoResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.distrInfo !== undefined) { DistrInfo.encode(message.distrInfo, writer.uint32(10).fork()).ldelim(); @@ -940,6 +995,12 @@ export const QueryDistrInfoResponse = { typeUrl: "/osmosis.poolincentives.v1beta1.QueryDistrInfoResponse", value: QueryDistrInfoResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryDistrInfoResponse.typeUrl)) { + return; + } + DistrInfo.registerTypeUrl(); } }; function createBaseQueryParamsRequest(): QueryParamsRequest { @@ -953,6 +1014,15 @@ function createBaseQueryParamsRequest(): QueryParamsRequest { export const QueryParamsRequest = { typeUrl: "/osmosis.poolincentives.v1beta1.QueryParamsRequest", aminoType: "osmosis/poolincentives/query-params-request", + is(o: any): o is QueryParamsRequest { + return o && o.$typeUrl === QueryParamsRequest.typeUrl; + }, + isSDK(o: any): o is QueryParamsRequestSDKType { + return o && o.$typeUrl === QueryParamsRequest.typeUrl; + }, + isAmino(o: any): o is QueryParamsRequestAmino { + return o && o.$typeUrl === QueryParamsRequest.typeUrl; + }, encode(_: QueryParamsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -1017,7 +1087,8 @@ export const QueryParamsRequest = { typeUrl: "/osmosis.poolincentives.v1beta1.QueryParamsRequest", value: QueryParamsRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryParamsResponse(): QueryParamsResponse { return { @@ -1032,6 +1103,15 @@ function createBaseQueryParamsResponse(): QueryParamsResponse { export const QueryParamsResponse = { typeUrl: "/osmosis.poolincentives.v1beta1.QueryParamsResponse", aminoType: "osmosis/poolincentives/query-params-response", + is(o: any): o is QueryParamsResponse { + return o && (o.$typeUrl === QueryParamsResponse.typeUrl || Params.is(o.params)); + }, + isSDK(o: any): o is QueryParamsResponseSDKType { + return o && (o.$typeUrl === QueryParamsResponse.typeUrl || Params.isSDK(o.params)); + }, + isAmino(o: any): o is QueryParamsResponseAmino { + return o && (o.$typeUrl === QueryParamsResponse.typeUrl || Params.isAmino(o.params)); + }, encode(message: QueryParamsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.params !== undefined) { Params.encode(message.params, writer.uint32(10).fork()).ldelim(); @@ -1114,6 +1194,12 @@ export const QueryParamsResponse = { typeUrl: "/osmosis.poolincentives.v1beta1.QueryParamsResponse", value: QueryParamsResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryParamsResponse.typeUrl)) { + return; + } + Params.registerTypeUrl(); } }; function createBaseQueryLockableDurationsRequest(): QueryLockableDurationsRequest { @@ -1127,6 +1213,15 @@ function createBaseQueryLockableDurationsRequest(): QueryLockableDurationsReques export const QueryLockableDurationsRequest = { typeUrl: "/osmosis.poolincentives.v1beta1.QueryLockableDurationsRequest", aminoType: "osmosis/poolincentives/query-lockable-durations-request", + is(o: any): o is QueryLockableDurationsRequest { + return o && o.$typeUrl === QueryLockableDurationsRequest.typeUrl; + }, + isSDK(o: any): o is QueryLockableDurationsRequestSDKType { + return o && o.$typeUrl === QueryLockableDurationsRequest.typeUrl; + }, + isAmino(o: any): o is QueryLockableDurationsRequestAmino { + return o && o.$typeUrl === QueryLockableDurationsRequest.typeUrl; + }, encode(_: QueryLockableDurationsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -1191,7 +1286,8 @@ export const QueryLockableDurationsRequest = { typeUrl: "/osmosis.poolincentives.v1beta1.QueryLockableDurationsRequest", value: QueryLockableDurationsRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryLockableDurationsResponse(): QueryLockableDurationsResponse { return { @@ -1206,6 +1302,15 @@ function createBaseQueryLockableDurationsResponse(): QueryLockableDurationsRespo export const QueryLockableDurationsResponse = { typeUrl: "/osmosis.poolincentives.v1beta1.QueryLockableDurationsResponse", aminoType: "osmosis/poolincentives/query-lockable-durations-response", + is(o: any): o is QueryLockableDurationsResponse { + return o && (o.$typeUrl === QueryLockableDurationsResponse.typeUrl || Array.isArray(o.lockableDurations) && (!o.lockableDurations.length || Duration.is(o.lockableDurations[0]))); + }, + isSDK(o: any): o is QueryLockableDurationsResponseSDKType { + return o && (o.$typeUrl === QueryLockableDurationsResponse.typeUrl || Array.isArray(o.lockable_durations) && (!o.lockable_durations.length || Duration.isSDK(o.lockable_durations[0]))); + }, + isAmino(o: any): o is QueryLockableDurationsResponseAmino { + return o && (o.$typeUrl === QueryLockableDurationsResponse.typeUrl || Array.isArray(o.lockable_durations) && (!o.lockable_durations.length || Duration.isAmino(o.lockable_durations[0]))); + }, encode(message: QueryLockableDurationsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.lockableDurations) { Duration.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -1296,7 +1401,8 @@ export const QueryLockableDurationsResponse = { typeUrl: "/osmosis.poolincentives.v1beta1.QueryLockableDurationsResponse", value: QueryLockableDurationsResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryIncentivizedPoolsRequest(): QueryIncentivizedPoolsRequest { return {}; @@ -1309,6 +1415,15 @@ function createBaseQueryIncentivizedPoolsRequest(): QueryIncentivizedPoolsReques export const QueryIncentivizedPoolsRequest = { typeUrl: "/osmosis.poolincentives.v1beta1.QueryIncentivizedPoolsRequest", aminoType: "osmosis/poolincentives/query-incentivized-pools-request", + is(o: any): o is QueryIncentivizedPoolsRequest { + return o && o.$typeUrl === QueryIncentivizedPoolsRequest.typeUrl; + }, + isSDK(o: any): o is QueryIncentivizedPoolsRequestSDKType { + return o && o.$typeUrl === QueryIncentivizedPoolsRequest.typeUrl; + }, + isAmino(o: any): o is QueryIncentivizedPoolsRequestAmino { + return o && o.$typeUrl === QueryIncentivizedPoolsRequest.typeUrl; + }, encode(_: QueryIncentivizedPoolsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -1373,7 +1488,8 @@ export const QueryIncentivizedPoolsRequest = { typeUrl: "/osmosis.poolincentives.v1beta1.QueryIncentivizedPoolsRequest", value: QueryIncentivizedPoolsRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseIncentivizedPool(): IncentivizedPool { return { @@ -1390,6 +1506,15 @@ function createBaseIncentivizedPool(): IncentivizedPool { export const IncentivizedPool = { typeUrl: "/osmosis.poolincentives.v1beta1.IncentivizedPool", aminoType: "osmosis/poolincentives/incentivized-pool", + is(o: any): o is IncentivizedPool { + return o && (o.$typeUrl === IncentivizedPool.typeUrl || typeof o.poolId === "bigint" && Duration.is(o.lockableDuration) && typeof o.gaugeId === "bigint"); + }, + isSDK(o: any): o is IncentivizedPoolSDKType { + return o && (o.$typeUrl === IncentivizedPool.typeUrl || typeof o.pool_id === "bigint" && Duration.isSDK(o.lockable_duration) && typeof o.gauge_id === "bigint"); + }, + isAmino(o: any): o is IncentivizedPoolAmino { + return o && (o.$typeUrl === IncentivizedPool.typeUrl || typeof o.pool_id === "bigint" && Duration.isAmino(o.lockable_duration) && typeof o.gauge_id === "bigint"); + }, encode(message: IncentivizedPool, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.poolId !== BigInt(0)) { writer.uint32(8).uint64(message.poolId); @@ -1506,7 +1631,8 @@ export const IncentivizedPool = { typeUrl: "/osmosis.poolincentives.v1beta1.IncentivizedPool", value: IncentivizedPool.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryIncentivizedPoolsResponse(): QueryIncentivizedPoolsResponse { return { @@ -1521,6 +1647,15 @@ function createBaseQueryIncentivizedPoolsResponse(): QueryIncentivizedPoolsRespo export const QueryIncentivizedPoolsResponse = { typeUrl: "/osmosis.poolincentives.v1beta1.QueryIncentivizedPoolsResponse", aminoType: "osmosis/poolincentives/query-incentivized-pools-response", + is(o: any): o is QueryIncentivizedPoolsResponse { + return o && (o.$typeUrl === QueryIncentivizedPoolsResponse.typeUrl || Array.isArray(o.incentivizedPools) && (!o.incentivizedPools.length || IncentivizedPool.is(o.incentivizedPools[0]))); + }, + isSDK(o: any): o is QueryIncentivizedPoolsResponseSDKType { + return o && (o.$typeUrl === QueryIncentivizedPoolsResponse.typeUrl || Array.isArray(o.incentivized_pools) && (!o.incentivized_pools.length || IncentivizedPool.isSDK(o.incentivized_pools[0]))); + }, + isAmino(o: any): o is QueryIncentivizedPoolsResponseAmino { + return o && (o.$typeUrl === QueryIncentivizedPoolsResponse.typeUrl || Array.isArray(o.incentivized_pools) && (!o.incentivized_pools.length || IncentivizedPool.isAmino(o.incentivized_pools[0]))); + }, encode(message: QueryIncentivizedPoolsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.incentivizedPools) { IncentivizedPool.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -1611,6 +1746,12 @@ export const QueryIncentivizedPoolsResponse = { typeUrl: "/osmosis.poolincentives.v1beta1.QueryIncentivizedPoolsResponse", value: QueryIncentivizedPoolsResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryIncentivizedPoolsResponse.typeUrl)) { + return; + } + IncentivizedPool.registerTypeUrl(); } }; function createBaseQueryExternalIncentiveGaugesRequest(): QueryExternalIncentiveGaugesRequest { @@ -1624,6 +1765,15 @@ function createBaseQueryExternalIncentiveGaugesRequest(): QueryExternalIncentive export const QueryExternalIncentiveGaugesRequest = { typeUrl: "/osmosis.poolincentives.v1beta1.QueryExternalIncentiveGaugesRequest", aminoType: "osmosis/poolincentives/query-external-incentive-gauges-request", + is(o: any): o is QueryExternalIncentiveGaugesRequest { + return o && o.$typeUrl === QueryExternalIncentiveGaugesRequest.typeUrl; + }, + isSDK(o: any): o is QueryExternalIncentiveGaugesRequestSDKType { + return o && o.$typeUrl === QueryExternalIncentiveGaugesRequest.typeUrl; + }, + isAmino(o: any): o is QueryExternalIncentiveGaugesRequestAmino { + return o && o.$typeUrl === QueryExternalIncentiveGaugesRequest.typeUrl; + }, encode(_: QueryExternalIncentiveGaugesRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -1688,7 +1838,8 @@ export const QueryExternalIncentiveGaugesRequest = { typeUrl: "/osmosis.poolincentives.v1beta1.QueryExternalIncentiveGaugesRequest", value: QueryExternalIncentiveGaugesRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryExternalIncentiveGaugesResponse(): QueryExternalIncentiveGaugesResponse { return { @@ -1703,6 +1854,15 @@ function createBaseQueryExternalIncentiveGaugesResponse(): QueryExternalIncentiv export const QueryExternalIncentiveGaugesResponse = { typeUrl: "/osmosis.poolincentives.v1beta1.QueryExternalIncentiveGaugesResponse", aminoType: "osmosis/poolincentives/query-external-incentive-gauges-response", + is(o: any): o is QueryExternalIncentiveGaugesResponse { + return o && (o.$typeUrl === QueryExternalIncentiveGaugesResponse.typeUrl || Array.isArray(o.data) && (!o.data.length || Gauge.is(o.data[0]))); + }, + isSDK(o: any): o is QueryExternalIncentiveGaugesResponseSDKType { + return o && (o.$typeUrl === QueryExternalIncentiveGaugesResponse.typeUrl || Array.isArray(o.data) && (!o.data.length || Gauge.isSDK(o.data[0]))); + }, + isAmino(o: any): o is QueryExternalIncentiveGaugesResponseAmino { + return o && (o.$typeUrl === QueryExternalIncentiveGaugesResponse.typeUrl || Array.isArray(o.data) && (!o.data.length || Gauge.isAmino(o.data[0]))); + }, encode(message: QueryExternalIncentiveGaugesResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.data) { Gauge.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -1793,5 +1953,11 @@ export const QueryExternalIncentiveGaugesResponse = { typeUrl: "/osmosis.poolincentives.v1beta1.QueryExternalIncentiveGaugesResponse", value: QueryExternalIncentiveGaugesResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryExternalIncentiveGaugesResponse.typeUrl)) { + return; + } + Gauge.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/osmosis/sumtree/v1beta1/tree.ts b/__fixtures__/v-next/outputv2/osmosis/sumtree/v1beta1/tree.ts index 02db4bd45b..5de5fa41c0 100644 --- a/__fixtures__/v-next/outputv2/osmosis/sumtree/v1beta1/tree.ts +++ b/__fixtures__/v-next/outputv2/osmosis/sumtree/v1beta1/tree.ts @@ -1,6 +1,7 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; import { JsonSafe } from "../../../json-safe"; import { DeepPartial, isSet, bytesFromBase64, base64FromBytes } from "../../../helpers"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "osmosis.store.v1beta1"; /** * @name Node @@ -114,6 +115,15 @@ function createBaseNode(): Node { export const Node = { typeUrl: "/osmosis.store.v1beta1.Node", aminoType: "osmosis/store/node", + is(o: any): o is Node { + return o && (o.$typeUrl === Node.typeUrl || Array.isArray(o.children) && (!o.children.length || Child.is(o.children[0]))); + }, + isSDK(o: any): o is NodeSDKType { + return o && (o.$typeUrl === Node.typeUrl || Array.isArray(o.children) && (!o.children.length || Child.isSDK(o.children[0]))); + }, + isAmino(o: any): o is NodeAmino { + return o && (o.$typeUrl === Node.typeUrl || Array.isArray(o.children) && (!o.children.length || Child.isAmino(o.children[0]))); + }, encode(message: Node, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.children) { Child.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -204,6 +214,12 @@ export const Node = { typeUrl: "/osmosis.store.v1beta1.Node", value: Node.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Node.typeUrl)) { + return; + } + Child.registerTypeUrl(); } }; function createBaseChild(): Child { @@ -220,6 +236,15 @@ function createBaseChild(): Child { export const Child = { typeUrl: "/osmosis.store.v1beta1.Child", aminoType: "osmosis/store/child", + is(o: any): o is Child { + return o && (o.$typeUrl === Child.typeUrl || (o.index instanceof Uint8Array || typeof o.index === "string") && typeof o.accumulation === "string"); + }, + isSDK(o: any): o is ChildSDKType { + return o && (o.$typeUrl === Child.typeUrl || (o.index instanceof Uint8Array || typeof o.index === "string") && typeof o.accumulation === "string"); + }, + isAmino(o: any): o is ChildAmino { + return o && (o.$typeUrl === Child.typeUrl || (o.index instanceof Uint8Array || typeof o.index === "string") && typeof o.accumulation === "string"); + }, encode(message: Child, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.index.length !== 0) { writer.uint32(10).bytes(message.index); @@ -315,7 +340,8 @@ export const Child = { typeUrl: "/osmosis.store.v1beta1.Child", value: Child.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseLeaf(): Leaf { return { @@ -330,6 +356,15 @@ function createBaseLeaf(): Leaf { export const Leaf = { typeUrl: "/osmosis.store.v1beta1.Leaf", aminoType: "osmosis/store/leaf", + is(o: any): o is Leaf { + return o && o.$typeUrl === Leaf.typeUrl; + }, + isSDK(o: any): o is LeafSDKType { + return o && o.$typeUrl === Leaf.typeUrl; + }, + isAmino(o: any): o is LeafAmino { + return o && o.$typeUrl === Leaf.typeUrl; + }, encode(message: Leaf, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.leaf !== undefined) { Child.encode(message.leaf, writer.uint32(10).fork()).ldelim(); @@ -412,5 +447,11 @@ export const Leaf = { typeUrl: "/osmosis.store.v1beta1.Leaf", value: Leaf.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Leaf.typeUrl)) { + return; + } + Child.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/osmosis/superfluid/genesis.ts b/__fixtures__/v-next/outputv2/osmosis/superfluid/genesis.ts index 7c765331e1..73f2935815 100644 --- a/__fixtures__/v-next/outputv2/osmosis/superfluid/genesis.ts +++ b/__fixtures__/v-next/outputv2/osmosis/superfluid/genesis.ts @@ -1,6 +1,7 @@ import { Params, ParamsAmino, ParamsSDKType } from "./params"; import { SuperfluidAsset, SuperfluidAssetAmino, SuperfluidAssetSDKType, OsmoEquivalentMultiplierRecord, OsmoEquivalentMultiplierRecordAmino, OsmoEquivalentMultiplierRecordSDKType, SuperfluidIntermediaryAccount, SuperfluidIntermediaryAccountAmino, SuperfluidIntermediaryAccountSDKType, LockIdIntermediaryAccountConnection, LockIdIntermediaryAccountConnectionAmino, LockIdIntermediaryAccountConnectionSDKType } from "./superfluid"; import { BinaryReader, BinaryWriter } from "../../binary"; +import { GlobalDecoderRegistry } from "../../registry"; import { isSet, DeepPartial } from "../../helpers"; import { JsonSafe } from "../../json-safe"; export const protobufPackage = "osmosis.superfluid"; @@ -93,6 +94,15 @@ function createBaseGenesisState(): GenesisState { export const GenesisState = { typeUrl: "/osmosis.superfluid.GenesisState", aminoType: "osmosis/genesis-state", + is(o: any): o is GenesisState { + return o && (o.$typeUrl === GenesisState.typeUrl || Params.is(o.params) && Array.isArray(o.superfluidAssets) && (!o.superfluidAssets.length || SuperfluidAsset.is(o.superfluidAssets[0])) && Array.isArray(o.osmoEquivalentMultipliers) && (!o.osmoEquivalentMultipliers.length || OsmoEquivalentMultiplierRecord.is(o.osmoEquivalentMultipliers[0])) && Array.isArray(o.intermediaryAccounts) && (!o.intermediaryAccounts.length || SuperfluidIntermediaryAccount.is(o.intermediaryAccounts[0])) && Array.isArray(o.intemediaryAccountConnections) && (!o.intemediaryAccountConnections.length || LockIdIntermediaryAccountConnection.is(o.intemediaryAccountConnections[0]))); + }, + isSDK(o: any): o is GenesisStateSDKType { + return o && (o.$typeUrl === GenesisState.typeUrl || Params.isSDK(o.params) && Array.isArray(o.superfluid_assets) && (!o.superfluid_assets.length || SuperfluidAsset.isSDK(o.superfluid_assets[0])) && Array.isArray(o.osmo_equivalent_multipliers) && (!o.osmo_equivalent_multipliers.length || OsmoEquivalentMultiplierRecord.isSDK(o.osmo_equivalent_multipliers[0])) && Array.isArray(o.intermediary_accounts) && (!o.intermediary_accounts.length || SuperfluidIntermediaryAccount.isSDK(o.intermediary_accounts[0])) && Array.isArray(o.intemediary_account_connections) && (!o.intemediary_account_connections.length || LockIdIntermediaryAccountConnection.isSDK(o.intemediary_account_connections[0]))); + }, + isAmino(o: any): o is GenesisStateAmino { + return o && (o.$typeUrl === GenesisState.typeUrl || Params.isAmino(o.params) && Array.isArray(o.superfluid_assets) && (!o.superfluid_assets.length || SuperfluidAsset.isAmino(o.superfluid_assets[0])) && Array.isArray(o.osmo_equivalent_multipliers) && (!o.osmo_equivalent_multipliers.length || OsmoEquivalentMultiplierRecord.isAmino(o.osmo_equivalent_multipliers[0])) && Array.isArray(o.intermediary_accounts) && (!o.intermediary_accounts.length || SuperfluidIntermediaryAccount.isAmino(o.intermediary_accounts[0])) && Array.isArray(o.intemediary_account_connections) && (!o.intemediary_account_connections.length || LockIdIntermediaryAccountConnection.isAmino(o.intemediary_account_connections[0]))); + }, encode(message: GenesisState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.params !== undefined) { Params.encode(message.params, writer.uint32(10).fork()).ldelim(); @@ -275,5 +285,15 @@ export const GenesisState = { typeUrl: "/osmosis.superfluid.GenesisState", value: GenesisState.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GenesisState.typeUrl)) { + return; + } + Params.registerTypeUrl(); + SuperfluidAsset.registerTypeUrl(); + OsmoEquivalentMultiplierRecord.registerTypeUrl(); + SuperfluidIntermediaryAccount.registerTypeUrl(); + LockIdIntermediaryAccountConnection.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/osmosis/superfluid/params.ts b/__fixtures__/v-next/outputv2/osmosis/superfluid/params.ts index 955bef3e49..705791817c 100644 --- a/__fixtures__/v-next/outputv2/osmosis/superfluid/params.ts +++ b/__fixtures__/v-next/outputv2/osmosis/superfluid/params.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { Decimal } from "@cosmjs/math"; +import { Decimal } from "@interchainjs/math"; import { isSet, DeepPartial } from "../../helpers"; import { JsonSafe } from "../../json-safe"; export const protobufPackage = "osmosis.superfluid"; @@ -64,6 +64,15 @@ function createBaseParams(): Params { export const Params = { typeUrl: "/osmosis.superfluid.Params", aminoType: "osmosis/params", + is(o: any): o is Params { + return o && (o.$typeUrl === Params.typeUrl || typeof o.minimumRiskFactor === "string"); + }, + isSDK(o: any): o is ParamsSDKType { + return o && (o.$typeUrl === Params.typeUrl || typeof o.minimum_risk_factor === "string"); + }, + isAmino(o: any): o is ParamsAmino { + return o && (o.$typeUrl === Params.typeUrl || typeof o.minimum_risk_factor === "string"); + }, encode(message: Params, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.minimumRiskFactor !== "") { writer.uint32(10).string(Decimal.fromUserInput(message.minimumRiskFactor, 18).atomics); @@ -121,7 +130,7 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.minimum_risk_factor = message.minimumRiskFactor === "" ? undefined : message.minimumRiskFactor; + obj.minimum_risk_factor = message.minimumRiskFactor === "" ? undefined : Decimal.fromUserInput(message.minimumRiskFactor, 18).atomics; return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { @@ -144,5 +153,6 @@ export const Params = { typeUrl: "/osmosis.superfluid.Params", value: Params.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/osmosis/superfluid/query.rpc.func.ts b/__fixtures__/v-next/outputv2/osmosis/superfluid/query.rpc.func.ts new file mode 100644 index 0000000000..9d799ce245 --- /dev/null +++ b/__fixtures__/v-next/outputv2/osmosis/superfluid/query.rpc.func.ts @@ -0,0 +1,203 @@ +import { buildQuery } from "../../helper-func-types"; +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"; +/** + * Params returns the total set of superfluid parameters. + * @name getParams + * @package osmosis.superfluid + * @see proto service: osmosis.superfluid.Params + */ +export const getParams = buildQuery({ + encode: QueryParamsRequest.encode, + decode: QueryParamsResponse.decode, + service: "osmosis.superfluid.Query", + method: "Params", + deps: [QueryParamsRequest, QueryParamsResponse] +}); +/** + * Returns superfluid asset type, whether if it's a native asset or an lp + * share. + * @name getAssetType + * @package osmosis.superfluid + * @see proto service: osmosis.superfluid.AssetType + */ +export const getAssetType = buildQuery({ + encode: AssetTypeRequest.encode, + decode: AssetTypeResponse.decode, + service: "osmosis.superfluid.Query", + method: "AssetType", + deps: [AssetTypeRequest, AssetTypeResponse] +}); +/** + * Returns all registered superfluid assets. + * @name getAllAssets + * @package osmosis.superfluid + * @see proto service: osmosis.superfluid.AllAssets + */ +export const getAllAssets = buildQuery({ + encode: AllAssetsRequest.encode, + decode: AllAssetsResponse.decode, + service: "osmosis.superfluid.Query", + method: "AllAssets", + deps: [AllAssetsRequest, AllAssetsResponse] +}); +/** + * Returns the osmo equivalent multiplier used in the most recent epoch. + * @name getAssetMultiplier + * @package osmosis.superfluid + * @see proto service: osmosis.superfluid.AssetMultiplier + */ +export const getAssetMultiplier = buildQuery({ + encode: AssetMultiplierRequest.encode, + decode: AssetMultiplierResponse.decode, + service: "osmosis.superfluid.Query", + method: "AssetMultiplier", + deps: [AssetMultiplierRequest, AssetMultiplierResponse] +}); +/** + * Returns all superfluid intermediary accounts. + * @name getAllIntermediaryAccounts + * @package osmosis.superfluid + * @see proto service: osmosis.superfluid.AllIntermediaryAccounts + */ +export const getAllIntermediaryAccounts = buildQuery({ + encode: AllIntermediaryAccountsRequest.encode, + decode: AllIntermediaryAccountsResponse.decode, + service: "osmosis.superfluid.Query", + method: "AllIntermediaryAccounts", + deps: [AllIntermediaryAccountsRequest, AllIntermediaryAccountsResponse] +}); +/** + * Returns intermediary account connected to a superfluid staked lock by id + * @name getConnectedIntermediaryAccount + * @package osmosis.superfluid + * @see proto service: osmosis.superfluid.ConnectedIntermediaryAccount + */ +export const getConnectedIntermediaryAccount = buildQuery({ + encode: ConnectedIntermediaryAccountRequest.encode, + decode: ConnectedIntermediaryAccountResponse.decode, + service: "osmosis.superfluid.Query", + method: "ConnectedIntermediaryAccount", + deps: [ConnectedIntermediaryAccountRequest, ConnectedIntermediaryAccountResponse] +}); +/** + * Returns the amount of delegations of specific denom for all validators + * @name getTotalDelegationByValidatorForDenom + * @package osmosis.superfluid + * @see proto service: osmosis.superfluid.TotalDelegationByValidatorForDenom + */ +export const getTotalDelegationByValidatorForDenom = buildQuery({ + encode: QueryTotalDelegationByValidatorForDenomRequest.encode, + decode: QueryTotalDelegationByValidatorForDenomResponse.decode, + service: "osmosis.superfluid.Query", + method: "TotalDelegationByValidatorForDenom", + deps: [QueryTotalDelegationByValidatorForDenomRequest, QueryTotalDelegationByValidatorForDenomResponse] +}); +/** + * Returns the total amount of osmo superfluidly staked. + * Response is denominated in uosmo. + * @name getTotalSuperfluidDelegations + * @package osmosis.superfluid + * @see proto service: osmosis.superfluid.TotalSuperfluidDelegations + */ +export const getTotalSuperfluidDelegations = buildQuery({ + encode: TotalSuperfluidDelegationsRequest.encode, + decode: TotalSuperfluidDelegationsResponse.decode, + service: "osmosis.superfluid.Query", + method: "TotalSuperfluidDelegations", + deps: [TotalSuperfluidDelegationsRequest, TotalSuperfluidDelegationsResponse] +}); +/** + * Returns the coins superfluid delegated for the delegator, validator, denom + * triplet + * @name getSuperfluidDelegationAmount + * @package osmosis.superfluid + * @see proto service: osmosis.superfluid.SuperfluidDelegationAmount + */ +export const getSuperfluidDelegationAmount = buildQuery({ + encode: SuperfluidDelegationAmountRequest.encode, + decode: SuperfluidDelegationAmountResponse.decode, + service: "osmosis.superfluid.Query", + method: "SuperfluidDelegationAmount", + deps: [SuperfluidDelegationAmountRequest, SuperfluidDelegationAmountResponse] +}); +/** + * Returns all the delegated superfluid poistions for a specific delegator. + * @name getSuperfluidDelegationsByDelegator + * @package osmosis.superfluid + * @see proto service: osmosis.superfluid.SuperfluidDelegationsByDelegator + */ +export const getSuperfluidDelegationsByDelegator = buildQuery({ + encode: SuperfluidDelegationsByDelegatorRequest.encode, + decode: SuperfluidDelegationsByDelegatorResponse.decode, + service: "osmosis.superfluid.Query", + method: "SuperfluidDelegationsByDelegator", + deps: [SuperfluidDelegationsByDelegatorRequest, SuperfluidDelegationsByDelegatorResponse] +}); +/** + * Returns all the undelegating superfluid poistions for a specific delegator. + * @name getSuperfluidUndelegationsByDelegator + * @package osmosis.superfluid + * @see proto service: osmosis.superfluid.SuperfluidUndelegationsByDelegator + */ +export const getSuperfluidUndelegationsByDelegator = buildQuery({ + encode: SuperfluidUndelegationsByDelegatorRequest.encode, + decode: SuperfluidUndelegationsByDelegatorResponse.decode, + service: "osmosis.superfluid.Query", + method: "SuperfluidUndelegationsByDelegator", + deps: [SuperfluidUndelegationsByDelegatorRequest, SuperfluidUndelegationsByDelegatorResponse] +}); +/** + * Returns all the superfluid positions of a specific denom delegated to one + * validator + * @name getSuperfluidDelegationsByValidatorDenom + * @package osmosis.superfluid + * @see proto service: osmosis.superfluid.SuperfluidDelegationsByValidatorDenom + */ +export const getSuperfluidDelegationsByValidatorDenom = buildQuery({ + encode: SuperfluidDelegationsByValidatorDenomRequest.encode, + decode: SuperfluidDelegationsByValidatorDenomResponse.decode, + service: "osmosis.superfluid.Query", + method: "SuperfluidDelegationsByValidatorDenom", + deps: [SuperfluidDelegationsByValidatorDenomRequest, SuperfluidDelegationsByValidatorDenomResponse] +}); +/** + * Returns the amount of a specific denom delegated to a specific validator + * This is labeled an estimate, because the way it calculates the amount can + * lead rounding errors from the true delegated amount + * @name getEstimateSuperfluidDelegatedAmountByValidatorDenom + * @package osmosis.superfluid + * @see proto service: osmosis.superfluid.EstimateSuperfluidDelegatedAmountByValidatorDenom + */ +export const getEstimateSuperfluidDelegatedAmountByValidatorDenom = buildQuery({ + encode: EstimateSuperfluidDelegatedAmountByValidatorDenomRequest.encode, + decode: EstimateSuperfluidDelegatedAmountByValidatorDenomResponse.decode, + service: "osmosis.superfluid.Query", + method: "EstimateSuperfluidDelegatedAmountByValidatorDenom", + deps: [EstimateSuperfluidDelegatedAmountByValidatorDenomRequest, EstimateSuperfluidDelegatedAmountByValidatorDenomResponse] +}); +/** + * Returns the specified delegations for a specific delegator + * @name getTotalDelegationByDelegator + * @package osmosis.superfluid + * @see proto service: osmosis.superfluid.TotalDelegationByDelegator + */ +export const getTotalDelegationByDelegator = buildQuery({ + encode: QueryTotalDelegationByDelegatorRequest.encode, + decode: QueryTotalDelegationByDelegatorResponse.decode, + service: "osmosis.superfluid.Query", + method: "TotalDelegationByDelegator", + deps: [QueryTotalDelegationByDelegatorRequest, QueryTotalDelegationByDelegatorResponse] +}); +/** + * Returns a list of whitelisted pool ids to unpool. + * @name getUnpoolWhitelist + * @package osmosis.superfluid + * @see proto service: osmosis.superfluid.UnpoolWhitelist + */ +export const getUnpoolWhitelist = buildQuery({ + encode: QueryUnpoolWhitelistRequest.encode, + decode: QueryUnpoolWhitelistResponse.decode, + service: "osmosis.superfluid.Query", + method: "UnpoolWhitelist", + deps: [QueryUnpoolWhitelistRequest, QueryUnpoolWhitelistResponse] +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/osmosis/superfluid/query.ts b/__fixtures__/v-next/outputv2/osmosis/superfluid/query.ts index 30aceeb02e..35794a1500 100644 --- a/__fixtures__/v-next/outputv2/osmosis/superfluid/query.ts +++ b/__fixtures__/v-next/outputv2/osmosis/superfluid/query.ts @@ -7,6 +7,7 @@ import { DelegationResponse, DelegationResponseAmino, DelegationResponseSDKType import { BinaryReader, BinaryWriter } from "../../binary"; import { JsonSafe } from "../../json-safe"; import { DeepPartial, isSet } from "../../helpers"; +import { GlobalDecoderRegistry } from "../../registry"; export const protobufPackage = "osmosis.superfluid"; /** * @name QueryParamsRequest @@ -1079,6 +1080,15 @@ function createBaseQueryParamsRequest(): QueryParamsRequest { export const QueryParamsRequest = { typeUrl: "/osmosis.superfluid.QueryParamsRequest", aminoType: "osmosis/query-params-request", + is(o: any): o is QueryParamsRequest { + return o && o.$typeUrl === QueryParamsRequest.typeUrl; + }, + isSDK(o: any): o is QueryParamsRequestSDKType { + return o && o.$typeUrl === QueryParamsRequest.typeUrl; + }, + isAmino(o: any): o is QueryParamsRequestAmino { + return o && o.$typeUrl === QueryParamsRequest.typeUrl; + }, encode(_: QueryParamsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -1143,7 +1153,8 @@ export const QueryParamsRequest = { typeUrl: "/osmosis.superfluid.QueryParamsRequest", value: QueryParamsRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryParamsResponse(): QueryParamsResponse { return { @@ -1158,6 +1169,15 @@ function createBaseQueryParamsResponse(): QueryParamsResponse { export const QueryParamsResponse = { typeUrl: "/osmosis.superfluid.QueryParamsResponse", aminoType: "osmosis/query-params-response", + is(o: any): o is QueryParamsResponse { + return o && (o.$typeUrl === QueryParamsResponse.typeUrl || Params.is(o.params)); + }, + isSDK(o: any): o is QueryParamsResponseSDKType { + return o && (o.$typeUrl === QueryParamsResponse.typeUrl || Params.isSDK(o.params)); + }, + isAmino(o: any): o is QueryParamsResponseAmino { + return o && (o.$typeUrl === QueryParamsResponse.typeUrl || Params.isAmino(o.params)); + }, encode(message: QueryParamsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.params !== undefined) { Params.encode(message.params, writer.uint32(10).fork()).ldelim(); @@ -1240,6 +1260,12 @@ export const QueryParamsResponse = { typeUrl: "/osmosis.superfluid.QueryParamsResponse", value: QueryParamsResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryParamsResponse.typeUrl)) { + return; + } + Params.registerTypeUrl(); } }; function createBaseAssetTypeRequest(): AssetTypeRequest { @@ -1255,6 +1281,15 @@ function createBaseAssetTypeRequest(): AssetTypeRequest { export const AssetTypeRequest = { typeUrl: "/osmosis.superfluid.AssetTypeRequest", aminoType: "osmosis/asset-type-request", + is(o: any): o is AssetTypeRequest { + return o && (o.$typeUrl === AssetTypeRequest.typeUrl || typeof o.denom === "string"); + }, + isSDK(o: any): o is AssetTypeRequestSDKType { + return o && (o.$typeUrl === AssetTypeRequest.typeUrl || typeof o.denom === "string"); + }, + isAmino(o: any): o is AssetTypeRequestAmino { + return o && (o.$typeUrl === AssetTypeRequest.typeUrl || typeof o.denom === "string"); + }, encode(message: AssetTypeRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.denom !== "") { writer.uint32(10).string(message.denom); @@ -1335,7 +1370,8 @@ export const AssetTypeRequest = { typeUrl: "/osmosis.superfluid.AssetTypeRequest", value: AssetTypeRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseAssetTypeResponse(): AssetTypeResponse { return { @@ -1350,6 +1386,15 @@ function createBaseAssetTypeResponse(): AssetTypeResponse { export const AssetTypeResponse = { typeUrl: "/osmosis.superfluid.AssetTypeResponse", aminoType: "osmosis/asset-type-response", + is(o: any): o is AssetTypeResponse { + return o && (o.$typeUrl === AssetTypeResponse.typeUrl || isSet(o.assetType)); + }, + isSDK(o: any): o is AssetTypeResponseSDKType { + return o && (o.$typeUrl === AssetTypeResponse.typeUrl || isSet(o.asset_type)); + }, + isAmino(o: any): o is AssetTypeResponseAmino { + return o && (o.$typeUrl === AssetTypeResponse.typeUrl || isSet(o.asset_type)); + }, encode(message: AssetTypeResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.assetType !== 0) { writer.uint32(8).int32(message.assetType); @@ -1430,7 +1475,8 @@ export const AssetTypeResponse = { typeUrl: "/osmosis.superfluid.AssetTypeResponse", value: AssetTypeResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseAllAssetsRequest(): AllAssetsRequest { return {}; @@ -1443,6 +1489,15 @@ function createBaseAllAssetsRequest(): AllAssetsRequest { export const AllAssetsRequest = { typeUrl: "/osmosis.superfluid.AllAssetsRequest", aminoType: "osmosis/all-assets-request", + is(o: any): o is AllAssetsRequest { + return o && o.$typeUrl === AllAssetsRequest.typeUrl; + }, + isSDK(o: any): o is AllAssetsRequestSDKType { + return o && o.$typeUrl === AllAssetsRequest.typeUrl; + }, + isAmino(o: any): o is AllAssetsRequestAmino { + return o && o.$typeUrl === AllAssetsRequest.typeUrl; + }, encode(_: AllAssetsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -1507,7 +1562,8 @@ export const AllAssetsRequest = { typeUrl: "/osmosis.superfluid.AllAssetsRequest", value: AllAssetsRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseAllAssetsResponse(): AllAssetsResponse { return { @@ -1522,6 +1578,15 @@ function createBaseAllAssetsResponse(): AllAssetsResponse { export const AllAssetsResponse = { typeUrl: "/osmosis.superfluid.AllAssetsResponse", aminoType: "osmosis/all-assets-response", + is(o: any): o is AllAssetsResponse { + return o && (o.$typeUrl === AllAssetsResponse.typeUrl || Array.isArray(o.assets) && (!o.assets.length || SuperfluidAsset.is(o.assets[0]))); + }, + isSDK(o: any): o is AllAssetsResponseSDKType { + return o && (o.$typeUrl === AllAssetsResponse.typeUrl || Array.isArray(o.assets) && (!o.assets.length || SuperfluidAsset.isSDK(o.assets[0]))); + }, + isAmino(o: any): o is AllAssetsResponseAmino { + return o && (o.$typeUrl === AllAssetsResponse.typeUrl || Array.isArray(o.assets) && (!o.assets.length || SuperfluidAsset.isAmino(o.assets[0]))); + }, encode(message: AllAssetsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.assets) { SuperfluidAsset.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -1612,6 +1677,12 @@ export const AllAssetsResponse = { typeUrl: "/osmosis.superfluid.AllAssetsResponse", value: AllAssetsResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(AllAssetsResponse.typeUrl)) { + return; + } + SuperfluidAsset.registerTypeUrl(); } }; function createBaseAssetMultiplierRequest(): AssetMultiplierRequest { @@ -1627,6 +1698,15 @@ function createBaseAssetMultiplierRequest(): AssetMultiplierRequest { export const AssetMultiplierRequest = { typeUrl: "/osmosis.superfluid.AssetMultiplierRequest", aminoType: "osmosis/asset-multiplier-request", + is(o: any): o is AssetMultiplierRequest { + return o && (o.$typeUrl === AssetMultiplierRequest.typeUrl || typeof o.denom === "string"); + }, + isSDK(o: any): o is AssetMultiplierRequestSDKType { + return o && (o.$typeUrl === AssetMultiplierRequest.typeUrl || typeof o.denom === "string"); + }, + isAmino(o: any): o is AssetMultiplierRequestAmino { + return o && (o.$typeUrl === AssetMultiplierRequest.typeUrl || typeof o.denom === "string"); + }, encode(message: AssetMultiplierRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.denom !== "") { writer.uint32(10).string(message.denom); @@ -1707,7 +1787,8 @@ export const AssetMultiplierRequest = { typeUrl: "/osmosis.superfluid.AssetMultiplierRequest", value: AssetMultiplierRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseAssetMultiplierResponse(): AssetMultiplierResponse { return { @@ -1722,6 +1803,15 @@ function createBaseAssetMultiplierResponse(): AssetMultiplierResponse { export const AssetMultiplierResponse = { typeUrl: "/osmosis.superfluid.AssetMultiplierResponse", aminoType: "osmosis/asset-multiplier-response", + is(o: any): o is AssetMultiplierResponse { + return o && o.$typeUrl === AssetMultiplierResponse.typeUrl; + }, + isSDK(o: any): o is AssetMultiplierResponseSDKType { + return o && o.$typeUrl === AssetMultiplierResponse.typeUrl; + }, + isAmino(o: any): o is AssetMultiplierResponseAmino { + return o && o.$typeUrl === AssetMultiplierResponse.typeUrl; + }, encode(message: AssetMultiplierResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.osmoEquivalentMultiplier !== undefined) { OsmoEquivalentMultiplierRecord.encode(message.osmoEquivalentMultiplier, writer.uint32(10).fork()).ldelim(); @@ -1804,6 +1894,12 @@ export const AssetMultiplierResponse = { typeUrl: "/osmosis.superfluid.AssetMultiplierResponse", value: AssetMultiplierResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(AssetMultiplierResponse.typeUrl)) { + return; + } + OsmoEquivalentMultiplierRecord.registerTypeUrl(); } }; function createBaseSuperfluidIntermediaryAccountInfo(): SuperfluidIntermediaryAccountInfo { @@ -1822,6 +1918,15 @@ function createBaseSuperfluidIntermediaryAccountInfo(): SuperfluidIntermediaryAc export const SuperfluidIntermediaryAccountInfo = { typeUrl: "/osmosis.superfluid.SuperfluidIntermediaryAccountInfo", aminoType: "osmosis/superfluid-intermediary-account-info", + is(o: any): o is SuperfluidIntermediaryAccountInfo { + return o && (o.$typeUrl === SuperfluidIntermediaryAccountInfo.typeUrl || typeof o.denom === "string" && typeof o.valAddr === "string" && typeof o.gaugeId === "bigint" && typeof o.address === "string"); + }, + isSDK(o: any): o is SuperfluidIntermediaryAccountInfoSDKType { + return o && (o.$typeUrl === SuperfluidIntermediaryAccountInfo.typeUrl || typeof o.denom === "string" && typeof o.val_addr === "string" && typeof o.gauge_id === "bigint" && typeof o.address === "string"); + }, + isAmino(o: any): o is SuperfluidIntermediaryAccountInfoAmino { + return o && (o.$typeUrl === SuperfluidIntermediaryAccountInfo.typeUrl || typeof o.denom === "string" && typeof o.val_addr === "string" && typeof o.gauge_id === "bigint" && typeof o.address === "string"); + }, encode(message: SuperfluidIntermediaryAccountInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.denom !== "") { writer.uint32(10).string(message.denom); @@ -1949,7 +2054,8 @@ export const SuperfluidIntermediaryAccountInfo = { typeUrl: "/osmosis.superfluid.SuperfluidIntermediaryAccountInfo", value: SuperfluidIntermediaryAccountInfo.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseAllIntermediaryAccountsRequest(): AllIntermediaryAccountsRequest { return { @@ -1964,6 +2070,15 @@ function createBaseAllIntermediaryAccountsRequest(): AllIntermediaryAccountsRequ export const AllIntermediaryAccountsRequest = { typeUrl: "/osmosis.superfluid.AllIntermediaryAccountsRequest", aminoType: "osmosis/all-intermediary-accounts-request", + is(o: any): o is AllIntermediaryAccountsRequest { + return o && o.$typeUrl === AllIntermediaryAccountsRequest.typeUrl; + }, + isSDK(o: any): o is AllIntermediaryAccountsRequestSDKType { + return o && o.$typeUrl === AllIntermediaryAccountsRequest.typeUrl; + }, + isAmino(o: any): o is AllIntermediaryAccountsRequestAmino { + return o && o.$typeUrl === AllIntermediaryAccountsRequest.typeUrl; + }, encode(message: AllIntermediaryAccountsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.pagination !== undefined) { PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); @@ -2046,6 +2161,12 @@ export const AllIntermediaryAccountsRequest = { typeUrl: "/osmosis.superfluid.AllIntermediaryAccountsRequest", value: AllIntermediaryAccountsRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(AllIntermediaryAccountsRequest.typeUrl)) { + return; + } + PageRequest.registerTypeUrl(); } }; function createBaseAllIntermediaryAccountsResponse(): AllIntermediaryAccountsResponse { @@ -2062,6 +2183,15 @@ function createBaseAllIntermediaryAccountsResponse(): AllIntermediaryAccountsRes export const AllIntermediaryAccountsResponse = { typeUrl: "/osmosis.superfluid.AllIntermediaryAccountsResponse", aminoType: "osmosis/all-intermediary-accounts-response", + is(o: any): o is AllIntermediaryAccountsResponse { + return o && (o.$typeUrl === AllIntermediaryAccountsResponse.typeUrl || Array.isArray(o.accounts) && (!o.accounts.length || SuperfluidIntermediaryAccountInfo.is(o.accounts[0]))); + }, + isSDK(o: any): o is AllIntermediaryAccountsResponseSDKType { + return o && (o.$typeUrl === AllIntermediaryAccountsResponse.typeUrl || Array.isArray(o.accounts) && (!o.accounts.length || SuperfluidIntermediaryAccountInfo.isSDK(o.accounts[0]))); + }, + isAmino(o: any): o is AllIntermediaryAccountsResponseAmino { + return o && (o.$typeUrl === AllIntermediaryAccountsResponse.typeUrl || Array.isArray(o.accounts) && (!o.accounts.length || SuperfluidIntermediaryAccountInfo.isAmino(o.accounts[0]))); + }, encode(message: AllIntermediaryAccountsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.accounts) { SuperfluidIntermediaryAccountInfo.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -2169,6 +2299,13 @@ export const AllIntermediaryAccountsResponse = { typeUrl: "/osmosis.superfluid.AllIntermediaryAccountsResponse", value: AllIntermediaryAccountsResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(AllIntermediaryAccountsResponse.typeUrl)) { + return; + } + SuperfluidIntermediaryAccountInfo.registerTypeUrl(); + PageResponse.registerTypeUrl(); } }; function createBaseConnectedIntermediaryAccountRequest(): ConnectedIntermediaryAccountRequest { @@ -2184,6 +2321,15 @@ function createBaseConnectedIntermediaryAccountRequest(): ConnectedIntermediaryA export const ConnectedIntermediaryAccountRequest = { typeUrl: "/osmosis.superfluid.ConnectedIntermediaryAccountRequest", aminoType: "osmosis/connected-intermediary-account-request", + is(o: any): o is ConnectedIntermediaryAccountRequest { + return o && (o.$typeUrl === ConnectedIntermediaryAccountRequest.typeUrl || typeof o.lockId === "bigint"); + }, + isSDK(o: any): o is ConnectedIntermediaryAccountRequestSDKType { + return o && (o.$typeUrl === ConnectedIntermediaryAccountRequest.typeUrl || typeof o.lock_id === "bigint"); + }, + isAmino(o: any): o is ConnectedIntermediaryAccountRequestAmino { + return o && (o.$typeUrl === ConnectedIntermediaryAccountRequest.typeUrl || typeof o.lock_id === "bigint"); + }, encode(message: ConnectedIntermediaryAccountRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.lockId !== BigInt(0)) { writer.uint32(8).uint64(message.lockId); @@ -2266,7 +2412,8 @@ export const ConnectedIntermediaryAccountRequest = { typeUrl: "/osmosis.superfluid.ConnectedIntermediaryAccountRequest", value: ConnectedIntermediaryAccountRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseConnectedIntermediaryAccountResponse(): ConnectedIntermediaryAccountResponse { return { @@ -2281,6 +2428,15 @@ function createBaseConnectedIntermediaryAccountResponse(): ConnectedIntermediary export const ConnectedIntermediaryAccountResponse = { typeUrl: "/osmosis.superfluid.ConnectedIntermediaryAccountResponse", aminoType: "osmosis/connected-intermediary-account-response", + is(o: any): o is ConnectedIntermediaryAccountResponse { + return o && o.$typeUrl === ConnectedIntermediaryAccountResponse.typeUrl; + }, + isSDK(o: any): o is ConnectedIntermediaryAccountResponseSDKType { + return o && o.$typeUrl === ConnectedIntermediaryAccountResponse.typeUrl; + }, + isAmino(o: any): o is ConnectedIntermediaryAccountResponseAmino { + return o && o.$typeUrl === ConnectedIntermediaryAccountResponse.typeUrl; + }, encode(message: ConnectedIntermediaryAccountResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.account !== undefined) { SuperfluidIntermediaryAccountInfo.encode(message.account, writer.uint32(10).fork()).ldelim(); @@ -2363,6 +2519,12 @@ export const ConnectedIntermediaryAccountResponse = { typeUrl: "/osmosis.superfluid.ConnectedIntermediaryAccountResponse", value: ConnectedIntermediaryAccountResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ConnectedIntermediaryAccountResponse.typeUrl)) { + return; + } + SuperfluidIntermediaryAccountInfo.registerTypeUrl(); } }; function createBaseQueryTotalDelegationByValidatorForDenomRequest(): QueryTotalDelegationByValidatorForDenomRequest { @@ -2378,6 +2540,15 @@ function createBaseQueryTotalDelegationByValidatorForDenomRequest(): QueryTotalD export const QueryTotalDelegationByValidatorForDenomRequest = { typeUrl: "/osmosis.superfluid.QueryTotalDelegationByValidatorForDenomRequest", aminoType: "osmosis/query-total-delegation-by-validator-for-denom-request", + is(o: any): o is QueryTotalDelegationByValidatorForDenomRequest { + return o && (o.$typeUrl === QueryTotalDelegationByValidatorForDenomRequest.typeUrl || typeof o.denom === "string"); + }, + isSDK(o: any): o is QueryTotalDelegationByValidatorForDenomRequestSDKType { + return o && (o.$typeUrl === QueryTotalDelegationByValidatorForDenomRequest.typeUrl || typeof o.denom === "string"); + }, + isAmino(o: any): o is QueryTotalDelegationByValidatorForDenomRequestAmino { + return o && (o.$typeUrl === QueryTotalDelegationByValidatorForDenomRequest.typeUrl || typeof o.denom === "string"); + }, encode(message: QueryTotalDelegationByValidatorForDenomRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.denom !== "") { writer.uint32(10).string(message.denom); @@ -2458,7 +2629,8 @@ export const QueryTotalDelegationByValidatorForDenomRequest = { typeUrl: "/osmosis.superfluid.QueryTotalDelegationByValidatorForDenomRequest", value: QueryTotalDelegationByValidatorForDenomRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryTotalDelegationByValidatorForDenomResponse(): QueryTotalDelegationByValidatorForDenomResponse { return { @@ -2473,6 +2645,15 @@ function createBaseQueryTotalDelegationByValidatorForDenomResponse(): QueryTotal export const QueryTotalDelegationByValidatorForDenomResponse = { typeUrl: "/osmosis.superfluid.QueryTotalDelegationByValidatorForDenomResponse", aminoType: "osmosis/query-total-delegation-by-validator-for-denom-response", + is(o: any): o is QueryTotalDelegationByValidatorForDenomResponse { + return o && (o.$typeUrl === QueryTotalDelegationByValidatorForDenomResponse.typeUrl || Array.isArray(o.assets) && (!o.assets.length || Delegations.is(o.assets[0]))); + }, + isSDK(o: any): o is QueryTotalDelegationByValidatorForDenomResponseSDKType { + return o && (o.$typeUrl === QueryTotalDelegationByValidatorForDenomResponse.typeUrl || Array.isArray(o.assets) && (!o.assets.length || Delegations.isSDK(o.assets[0]))); + }, + isAmino(o: any): o is QueryTotalDelegationByValidatorForDenomResponseAmino { + return o && (o.$typeUrl === QueryTotalDelegationByValidatorForDenomResponse.typeUrl || Array.isArray(o.assets) && (!o.assets.length || Delegations.isAmino(o.assets[0]))); + }, encode(message: QueryTotalDelegationByValidatorForDenomResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.assets) { Delegations.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -2563,6 +2744,12 @@ export const QueryTotalDelegationByValidatorForDenomResponse = { typeUrl: "/osmosis.superfluid.QueryTotalDelegationByValidatorForDenomResponse", value: QueryTotalDelegationByValidatorForDenomResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryTotalDelegationByValidatorForDenomResponse.typeUrl)) { + return; + } + Delegations.registerTypeUrl(); } }; function createBaseDelegations(): Delegations { @@ -2580,6 +2767,15 @@ function createBaseDelegations(): Delegations { export const Delegations = { typeUrl: "/osmosis.superfluid.Delegations", aminoType: "osmosis/delegations", + is(o: any): o is Delegations { + return o && (o.$typeUrl === Delegations.typeUrl || typeof o.valAddr === "string" && typeof o.amountSfsd === "string" && typeof o.osmoEquivalent === "string"); + }, + isSDK(o: any): o is DelegationsSDKType { + return o && (o.$typeUrl === Delegations.typeUrl || typeof o.val_addr === "string" && typeof o.amount_sfsd === "string" && typeof o.osmo_equivalent === "string"); + }, + isAmino(o: any): o is DelegationsAmino { + return o && (o.$typeUrl === Delegations.typeUrl || typeof o.val_addr === "string" && typeof o.amount_sfsd === "string" && typeof o.osmo_equivalent === "string"); + }, encode(message: Delegations, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.valAddr !== "") { writer.uint32(10).string(message.valAddr); @@ -2690,7 +2886,8 @@ export const Delegations = { typeUrl: "/osmosis.superfluid.Delegations", value: Delegations.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseTotalSuperfluidDelegationsRequest(): TotalSuperfluidDelegationsRequest { return {}; @@ -2703,6 +2900,15 @@ function createBaseTotalSuperfluidDelegationsRequest(): TotalSuperfluidDelegatio export const TotalSuperfluidDelegationsRequest = { typeUrl: "/osmosis.superfluid.TotalSuperfluidDelegationsRequest", aminoType: "osmosis/total-superfluid-delegations-request", + is(o: any): o is TotalSuperfluidDelegationsRequest { + return o && o.$typeUrl === TotalSuperfluidDelegationsRequest.typeUrl; + }, + isSDK(o: any): o is TotalSuperfluidDelegationsRequestSDKType { + return o && o.$typeUrl === TotalSuperfluidDelegationsRequest.typeUrl; + }, + isAmino(o: any): o is TotalSuperfluidDelegationsRequestAmino { + return o && o.$typeUrl === TotalSuperfluidDelegationsRequest.typeUrl; + }, encode(_: TotalSuperfluidDelegationsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -2767,7 +2973,8 @@ export const TotalSuperfluidDelegationsRequest = { typeUrl: "/osmosis.superfluid.TotalSuperfluidDelegationsRequest", value: TotalSuperfluidDelegationsRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseTotalSuperfluidDelegationsResponse(): TotalSuperfluidDelegationsResponse { return { @@ -2782,6 +2989,15 @@ function createBaseTotalSuperfluidDelegationsResponse(): TotalSuperfluidDelegati export const TotalSuperfluidDelegationsResponse = { typeUrl: "/osmosis.superfluid.TotalSuperfluidDelegationsResponse", aminoType: "osmosis/total-superfluid-delegations-response", + is(o: any): o is TotalSuperfluidDelegationsResponse { + return o && (o.$typeUrl === TotalSuperfluidDelegationsResponse.typeUrl || typeof o.totalDelegations === "string"); + }, + isSDK(o: any): o is TotalSuperfluidDelegationsResponseSDKType { + return o && (o.$typeUrl === TotalSuperfluidDelegationsResponse.typeUrl || typeof o.total_delegations === "string"); + }, + isAmino(o: any): o is TotalSuperfluidDelegationsResponseAmino { + return o && (o.$typeUrl === TotalSuperfluidDelegationsResponse.typeUrl || typeof o.total_delegations === "string"); + }, encode(message: TotalSuperfluidDelegationsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.totalDelegations !== "") { writer.uint32(10).string(message.totalDelegations); @@ -2862,7 +3078,8 @@ export const TotalSuperfluidDelegationsResponse = { typeUrl: "/osmosis.superfluid.TotalSuperfluidDelegationsResponse", value: TotalSuperfluidDelegationsResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseSuperfluidDelegationAmountRequest(): SuperfluidDelegationAmountRequest { return { @@ -2879,6 +3096,15 @@ function createBaseSuperfluidDelegationAmountRequest(): SuperfluidDelegationAmou export const SuperfluidDelegationAmountRequest = { typeUrl: "/osmosis.superfluid.SuperfluidDelegationAmountRequest", aminoType: "osmosis/superfluid-delegation-amount-request", + is(o: any): o is SuperfluidDelegationAmountRequest { + return o && (o.$typeUrl === SuperfluidDelegationAmountRequest.typeUrl || typeof o.delegatorAddress === "string" && typeof o.validatorAddress === "string" && typeof o.denom === "string"); + }, + isSDK(o: any): o is SuperfluidDelegationAmountRequestSDKType { + return o && (o.$typeUrl === SuperfluidDelegationAmountRequest.typeUrl || typeof o.delegator_address === "string" && typeof o.validator_address === "string" && typeof o.denom === "string"); + }, + isAmino(o: any): o is SuperfluidDelegationAmountRequestAmino { + return o && (o.$typeUrl === SuperfluidDelegationAmountRequest.typeUrl || typeof o.delegator_address === "string" && typeof o.validator_address === "string" && typeof o.denom === "string"); + }, encode(message: SuperfluidDelegationAmountRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.delegatorAddress !== "") { writer.uint32(10).string(message.delegatorAddress); @@ -2989,7 +3215,8 @@ export const SuperfluidDelegationAmountRequest = { typeUrl: "/osmosis.superfluid.SuperfluidDelegationAmountRequest", value: SuperfluidDelegationAmountRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseSuperfluidDelegationAmountResponse(): SuperfluidDelegationAmountResponse { return { @@ -3004,6 +3231,15 @@ function createBaseSuperfluidDelegationAmountResponse(): SuperfluidDelegationAmo export const SuperfluidDelegationAmountResponse = { typeUrl: "/osmosis.superfluid.SuperfluidDelegationAmountResponse", aminoType: "osmosis/superfluid-delegation-amount-response", + is(o: any): o is SuperfluidDelegationAmountResponse { + return o && (o.$typeUrl === SuperfluidDelegationAmountResponse.typeUrl || Array.isArray(o.amount) && (!o.amount.length || Coin.is(o.amount[0]))); + }, + isSDK(o: any): o is SuperfluidDelegationAmountResponseSDKType { + return o && (o.$typeUrl === SuperfluidDelegationAmountResponse.typeUrl || Array.isArray(o.amount) && (!o.amount.length || Coin.isSDK(o.amount[0]))); + }, + isAmino(o: any): o is SuperfluidDelegationAmountResponseAmino { + return o && (o.$typeUrl === SuperfluidDelegationAmountResponse.typeUrl || Array.isArray(o.amount) && (!o.amount.length || Coin.isAmino(o.amount[0]))); + }, encode(message: SuperfluidDelegationAmountResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.amount) { Coin.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -3094,6 +3330,12 @@ export const SuperfluidDelegationAmountResponse = { typeUrl: "/osmosis.superfluid.SuperfluidDelegationAmountResponse", value: SuperfluidDelegationAmountResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(SuperfluidDelegationAmountResponse.typeUrl)) { + return; + } + Coin.registerTypeUrl(); } }; function createBaseSuperfluidDelegationsByDelegatorRequest(): SuperfluidDelegationsByDelegatorRequest { @@ -3109,6 +3351,15 @@ function createBaseSuperfluidDelegationsByDelegatorRequest(): SuperfluidDelegati export const SuperfluidDelegationsByDelegatorRequest = { typeUrl: "/osmosis.superfluid.SuperfluidDelegationsByDelegatorRequest", aminoType: "osmosis/superfluid-delegations-by-delegator-request", + is(o: any): o is SuperfluidDelegationsByDelegatorRequest { + return o && (o.$typeUrl === SuperfluidDelegationsByDelegatorRequest.typeUrl || typeof o.delegatorAddress === "string"); + }, + isSDK(o: any): o is SuperfluidDelegationsByDelegatorRequestSDKType { + return o && (o.$typeUrl === SuperfluidDelegationsByDelegatorRequest.typeUrl || typeof o.delegator_address === "string"); + }, + isAmino(o: any): o is SuperfluidDelegationsByDelegatorRequestAmino { + return o && (o.$typeUrl === SuperfluidDelegationsByDelegatorRequest.typeUrl || typeof o.delegator_address === "string"); + }, encode(message: SuperfluidDelegationsByDelegatorRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.delegatorAddress !== "") { writer.uint32(10).string(message.delegatorAddress); @@ -3189,7 +3440,8 @@ export const SuperfluidDelegationsByDelegatorRequest = { typeUrl: "/osmosis.superfluid.SuperfluidDelegationsByDelegatorRequest", value: SuperfluidDelegationsByDelegatorRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseSuperfluidDelegationsByDelegatorResponse(): SuperfluidDelegationsByDelegatorResponse { return { @@ -3206,6 +3458,15 @@ function createBaseSuperfluidDelegationsByDelegatorResponse(): SuperfluidDelegat export const SuperfluidDelegationsByDelegatorResponse = { typeUrl: "/osmosis.superfluid.SuperfluidDelegationsByDelegatorResponse", aminoType: "osmosis/superfluid-delegations-by-delegator-response", + is(o: any): o is SuperfluidDelegationsByDelegatorResponse { + return o && (o.$typeUrl === SuperfluidDelegationsByDelegatorResponse.typeUrl || Array.isArray(o.superfluidDelegationRecords) && (!o.superfluidDelegationRecords.length || SuperfluidDelegationRecord.is(o.superfluidDelegationRecords[0])) && Array.isArray(o.totalDelegatedCoins) && (!o.totalDelegatedCoins.length || Coin.is(o.totalDelegatedCoins[0])) && Coin.is(o.totalEquivalentStakedAmount)); + }, + isSDK(o: any): o is SuperfluidDelegationsByDelegatorResponseSDKType { + return o && (o.$typeUrl === SuperfluidDelegationsByDelegatorResponse.typeUrl || Array.isArray(o.superfluid_delegation_records) && (!o.superfluid_delegation_records.length || SuperfluidDelegationRecord.isSDK(o.superfluid_delegation_records[0])) && Array.isArray(o.total_delegated_coins) && (!o.total_delegated_coins.length || Coin.isSDK(o.total_delegated_coins[0])) && Coin.isSDK(o.total_equivalent_staked_amount)); + }, + isAmino(o: any): o is SuperfluidDelegationsByDelegatorResponseAmino { + return o && (o.$typeUrl === SuperfluidDelegationsByDelegatorResponse.typeUrl || Array.isArray(o.superfluid_delegation_records) && (!o.superfluid_delegation_records.length || SuperfluidDelegationRecord.isAmino(o.superfluid_delegation_records[0])) && Array.isArray(o.total_delegated_coins) && (!o.total_delegated_coins.length || Coin.isAmino(o.total_delegated_coins[0])) && Coin.isAmino(o.total_equivalent_staked_amount)); + }, encode(message: SuperfluidDelegationsByDelegatorResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.superfluidDelegationRecords) { SuperfluidDelegationRecord.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -3338,6 +3599,13 @@ export const SuperfluidDelegationsByDelegatorResponse = { typeUrl: "/osmosis.superfluid.SuperfluidDelegationsByDelegatorResponse", value: SuperfluidDelegationsByDelegatorResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(SuperfluidDelegationsByDelegatorResponse.typeUrl)) { + return; + } + SuperfluidDelegationRecord.registerTypeUrl(); + Coin.registerTypeUrl(); } }; function createBaseSuperfluidUndelegationsByDelegatorRequest(): SuperfluidUndelegationsByDelegatorRequest { @@ -3354,6 +3622,15 @@ function createBaseSuperfluidUndelegationsByDelegatorRequest(): SuperfluidUndele export const SuperfluidUndelegationsByDelegatorRequest = { typeUrl: "/osmosis.superfluid.SuperfluidUndelegationsByDelegatorRequest", aminoType: "osmosis/superfluid-undelegations-by-delegator-request", + is(o: any): o is SuperfluidUndelegationsByDelegatorRequest { + return o && (o.$typeUrl === SuperfluidUndelegationsByDelegatorRequest.typeUrl || typeof o.delegatorAddress === "string" && typeof o.denom === "string"); + }, + isSDK(o: any): o is SuperfluidUndelegationsByDelegatorRequestSDKType { + return o && (o.$typeUrl === SuperfluidUndelegationsByDelegatorRequest.typeUrl || typeof o.delegator_address === "string" && typeof o.denom === "string"); + }, + isAmino(o: any): o is SuperfluidUndelegationsByDelegatorRequestAmino { + return o && (o.$typeUrl === SuperfluidUndelegationsByDelegatorRequest.typeUrl || typeof o.delegator_address === "string" && typeof o.denom === "string"); + }, encode(message: SuperfluidUndelegationsByDelegatorRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.delegatorAddress !== "") { writer.uint32(10).string(message.delegatorAddress); @@ -3449,7 +3726,8 @@ export const SuperfluidUndelegationsByDelegatorRequest = { typeUrl: "/osmosis.superfluid.SuperfluidUndelegationsByDelegatorRequest", value: SuperfluidUndelegationsByDelegatorRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseSuperfluidUndelegationsByDelegatorResponse(): SuperfluidUndelegationsByDelegatorResponse { return { @@ -3466,6 +3744,15 @@ function createBaseSuperfluidUndelegationsByDelegatorResponse(): SuperfluidUndel export const SuperfluidUndelegationsByDelegatorResponse = { typeUrl: "/osmosis.superfluid.SuperfluidUndelegationsByDelegatorResponse", aminoType: "osmosis/superfluid-undelegations-by-delegator-response", + is(o: any): o is SuperfluidUndelegationsByDelegatorResponse { + return o && (o.$typeUrl === SuperfluidUndelegationsByDelegatorResponse.typeUrl || Array.isArray(o.superfluidDelegationRecords) && (!o.superfluidDelegationRecords.length || SuperfluidDelegationRecord.is(o.superfluidDelegationRecords[0])) && Array.isArray(o.totalUndelegatedCoins) && (!o.totalUndelegatedCoins.length || Coin.is(o.totalUndelegatedCoins[0])) && Array.isArray(o.syntheticLocks) && (!o.syntheticLocks.length || SyntheticLock.is(o.syntheticLocks[0]))); + }, + isSDK(o: any): o is SuperfluidUndelegationsByDelegatorResponseSDKType { + return o && (o.$typeUrl === SuperfluidUndelegationsByDelegatorResponse.typeUrl || Array.isArray(o.superfluid_delegation_records) && (!o.superfluid_delegation_records.length || SuperfluidDelegationRecord.isSDK(o.superfluid_delegation_records[0])) && Array.isArray(o.total_undelegated_coins) && (!o.total_undelegated_coins.length || Coin.isSDK(o.total_undelegated_coins[0])) && Array.isArray(o.synthetic_locks) && (!o.synthetic_locks.length || SyntheticLock.isSDK(o.synthetic_locks[0]))); + }, + isAmino(o: any): o is SuperfluidUndelegationsByDelegatorResponseAmino { + return o && (o.$typeUrl === SuperfluidUndelegationsByDelegatorResponse.typeUrl || Array.isArray(o.superfluid_delegation_records) && (!o.superfluid_delegation_records.length || SuperfluidDelegationRecord.isAmino(o.superfluid_delegation_records[0])) && Array.isArray(o.total_undelegated_coins) && (!o.total_undelegated_coins.length || Coin.isAmino(o.total_undelegated_coins[0])) && Array.isArray(o.synthetic_locks) && (!o.synthetic_locks.length || SyntheticLock.isAmino(o.synthetic_locks[0]))); + }, encode(message: SuperfluidUndelegationsByDelegatorResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.superfluidDelegationRecords) { SuperfluidDelegationRecord.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -3606,6 +3893,14 @@ export const SuperfluidUndelegationsByDelegatorResponse = { typeUrl: "/osmosis.superfluid.SuperfluidUndelegationsByDelegatorResponse", value: SuperfluidUndelegationsByDelegatorResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(SuperfluidUndelegationsByDelegatorResponse.typeUrl)) { + return; + } + SuperfluidDelegationRecord.registerTypeUrl(); + Coin.registerTypeUrl(); + SyntheticLock.registerTypeUrl(); } }; function createBaseSuperfluidDelegationsByValidatorDenomRequest(): SuperfluidDelegationsByValidatorDenomRequest { @@ -3622,6 +3917,15 @@ function createBaseSuperfluidDelegationsByValidatorDenomRequest(): SuperfluidDel export const SuperfluidDelegationsByValidatorDenomRequest = { typeUrl: "/osmosis.superfluid.SuperfluidDelegationsByValidatorDenomRequest", aminoType: "osmosis/superfluid-delegations-by-validator-denom-request", + is(o: any): o is SuperfluidDelegationsByValidatorDenomRequest { + return o && (o.$typeUrl === SuperfluidDelegationsByValidatorDenomRequest.typeUrl || typeof o.validatorAddress === "string" && typeof o.denom === "string"); + }, + isSDK(o: any): o is SuperfluidDelegationsByValidatorDenomRequestSDKType { + return o && (o.$typeUrl === SuperfluidDelegationsByValidatorDenomRequest.typeUrl || typeof o.validator_address === "string" && typeof o.denom === "string"); + }, + isAmino(o: any): o is SuperfluidDelegationsByValidatorDenomRequestAmino { + return o && (o.$typeUrl === SuperfluidDelegationsByValidatorDenomRequest.typeUrl || typeof o.validator_address === "string" && typeof o.denom === "string"); + }, encode(message: SuperfluidDelegationsByValidatorDenomRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.validatorAddress !== "") { writer.uint32(10).string(message.validatorAddress); @@ -3717,7 +4021,8 @@ export const SuperfluidDelegationsByValidatorDenomRequest = { typeUrl: "/osmosis.superfluid.SuperfluidDelegationsByValidatorDenomRequest", value: SuperfluidDelegationsByValidatorDenomRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseSuperfluidDelegationsByValidatorDenomResponse(): SuperfluidDelegationsByValidatorDenomResponse { return { @@ -3732,6 +4037,15 @@ function createBaseSuperfluidDelegationsByValidatorDenomResponse(): SuperfluidDe export const SuperfluidDelegationsByValidatorDenomResponse = { typeUrl: "/osmosis.superfluid.SuperfluidDelegationsByValidatorDenomResponse", aminoType: "osmosis/superfluid-delegations-by-validator-denom-response", + is(o: any): o is SuperfluidDelegationsByValidatorDenomResponse { + return o && (o.$typeUrl === SuperfluidDelegationsByValidatorDenomResponse.typeUrl || Array.isArray(o.superfluidDelegationRecords) && (!o.superfluidDelegationRecords.length || SuperfluidDelegationRecord.is(o.superfluidDelegationRecords[0]))); + }, + isSDK(o: any): o is SuperfluidDelegationsByValidatorDenomResponseSDKType { + return o && (o.$typeUrl === SuperfluidDelegationsByValidatorDenomResponse.typeUrl || Array.isArray(o.superfluid_delegation_records) && (!o.superfluid_delegation_records.length || SuperfluidDelegationRecord.isSDK(o.superfluid_delegation_records[0]))); + }, + isAmino(o: any): o is SuperfluidDelegationsByValidatorDenomResponseAmino { + return o && (o.$typeUrl === SuperfluidDelegationsByValidatorDenomResponse.typeUrl || Array.isArray(o.superfluid_delegation_records) && (!o.superfluid_delegation_records.length || SuperfluidDelegationRecord.isAmino(o.superfluid_delegation_records[0]))); + }, encode(message: SuperfluidDelegationsByValidatorDenomResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.superfluidDelegationRecords) { SuperfluidDelegationRecord.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -3822,6 +4136,12 @@ export const SuperfluidDelegationsByValidatorDenomResponse = { typeUrl: "/osmosis.superfluid.SuperfluidDelegationsByValidatorDenomResponse", value: SuperfluidDelegationsByValidatorDenomResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(SuperfluidDelegationsByValidatorDenomResponse.typeUrl)) { + return; + } + SuperfluidDelegationRecord.registerTypeUrl(); } }; function createBaseEstimateSuperfluidDelegatedAmountByValidatorDenomRequest(): EstimateSuperfluidDelegatedAmountByValidatorDenomRequest { @@ -3838,6 +4158,15 @@ function createBaseEstimateSuperfluidDelegatedAmountByValidatorDenomRequest(): E export const EstimateSuperfluidDelegatedAmountByValidatorDenomRequest = { typeUrl: "/osmosis.superfluid.EstimateSuperfluidDelegatedAmountByValidatorDenomRequest", aminoType: "osmosis/estimate-superfluid-delegated-amount-by-validator-denom-request", + is(o: any): o is EstimateSuperfluidDelegatedAmountByValidatorDenomRequest { + return o && (o.$typeUrl === EstimateSuperfluidDelegatedAmountByValidatorDenomRequest.typeUrl || typeof o.validatorAddress === "string" && typeof o.denom === "string"); + }, + isSDK(o: any): o is EstimateSuperfluidDelegatedAmountByValidatorDenomRequestSDKType { + return o && (o.$typeUrl === EstimateSuperfluidDelegatedAmountByValidatorDenomRequest.typeUrl || typeof o.validator_address === "string" && typeof o.denom === "string"); + }, + isAmino(o: any): o is EstimateSuperfluidDelegatedAmountByValidatorDenomRequestAmino { + return o && (o.$typeUrl === EstimateSuperfluidDelegatedAmountByValidatorDenomRequest.typeUrl || typeof o.validator_address === "string" && typeof o.denom === "string"); + }, encode(message: EstimateSuperfluidDelegatedAmountByValidatorDenomRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.validatorAddress !== "") { writer.uint32(10).string(message.validatorAddress); @@ -3933,7 +4262,8 @@ export const EstimateSuperfluidDelegatedAmountByValidatorDenomRequest = { typeUrl: "/osmosis.superfluid.EstimateSuperfluidDelegatedAmountByValidatorDenomRequest", value: EstimateSuperfluidDelegatedAmountByValidatorDenomRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseEstimateSuperfluidDelegatedAmountByValidatorDenomResponse(): EstimateSuperfluidDelegatedAmountByValidatorDenomResponse { return { @@ -3948,6 +4278,15 @@ function createBaseEstimateSuperfluidDelegatedAmountByValidatorDenomResponse(): export const EstimateSuperfluidDelegatedAmountByValidatorDenomResponse = { typeUrl: "/osmosis.superfluid.EstimateSuperfluidDelegatedAmountByValidatorDenomResponse", aminoType: "osmosis/estimate-superfluid-delegated-amount-by-validator-denom-response", + is(o: any): o is EstimateSuperfluidDelegatedAmountByValidatorDenomResponse { + return o && (o.$typeUrl === EstimateSuperfluidDelegatedAmountByValidatorDenomResponse.typeUrl || Array.isArray(o.totalDelegatedCoins) && (!o.totalDelegatedCoins.length || Coin.is(o.totalDelegatedCoins[0]))); + }, + isSDK(o: any): o is EstimateSuperfluidDelegatedAmountByValidatorDenomResponseSDKType { + return o && (o.$typeUrl === EstimateSuperfluidDelegatedAmountByValidatorDenomResponse.typeUrl || Array.isArray(o.total_delegated_coins) && (!o.total_delegated_coins.length || Coin.isSDK(o.total_delegated_coins[0]))); + }, + isAmino(o: any): o is EstimateSuperfluidDelegatedAmountByValidatorDenomResponseAmino { + return o && (o.$typeUrl === EstimateSuperfluidDelegatedAmountByValidatorDenomResponse.typeUrl || Array.isArray(o.total_delegated_coins) && (!o.total_delegated_coins.length || Coin.isAmino(o.total_delegated_coins[0]))); + }, encode(message: EstimateSuperfluidDelegatedAmountByValidatorDenomResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.totalDelegatedCoins) { Coin.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -4038,6 +4377,12 @@ export const EstimateSuperfluidDelegatedAmountByValidatorDenomResponse = { typeUrl: "/osmosis.superfluid.EstimateSuperfluidDelegatedAmountByValidatorDenomResponse", value: EstimateSuperfluidDelegatedAmountByValidatorDenomResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(EstimateSuperfluidDelegatedAmountByValidatorDenomResponse.typeUrl)) { + return; + } + Coin.registerTypeUrl(); } }; function createBaseQueryTotalDelegationByDelegatorRequest(): QueryTotalDelegationByDelegatorRequest { @@ -4053,6 +4398,15 @@ function createBaseQueryTotalDelegationByDelegatorRequest(): QueryTotalDelegatio export const QueryTotalDelegationByDelegatorRequest = { typeUrl: "/osmosis.superfluid.QueryTotalDelegationByDelegatorRequest", aminoType: "osmosis/query-total-delegation-by-delegator-request", + is(o: any): o is QueryTotalDelegationByDelegatorRequest { + return o && (o.$typeUrl === QueryTotalDelegationByDelegatorRequest.typeUrl || typeof o.delegatorAddress === "string"); + }, + isSDK(o: any): o is QueryTotalDelegationByDelegatorRequestSDKType { + return o && (o.$typeUrl === QueryTotalDelegationByDelegatorRequest.typeUrl || typeof o.delegator_address === "string"); + }, + isAmino(o: any): o is QueryTotalDelegationByDelegatorRequestAmino { + return o && (o.$typeUrl === QueryTotalDelegationByDelegatorRequest.typeUrl || typeof o.delegator_address === "string"); + }, encode(message: QueryTotalDelegationByDelegatorRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.delegatorAddress !== "") { writer.uint32(10).string(message.delegatorAddress); @@ -4133,7 +4487,8 @@ export const QueryTotalDelegationByDelegatorRequest = { typeUrl: "/osmosis.superfluid.QueryTotalDelegationByDelegatorRequest", value: QueryTotalDelegationByDelegatorRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryTotalDelegationByDelegatorResponse(): QueryTotalDelegationByDelegatorResponse { return { @@ -4151,6 +4506,15 @@ function createBaseQueryTotalDelegationByDelegatorResponse(): QueryTotalDelegati export const QueryTotalDelegationByDelegatorResponse = { typeUrl: "/osmosis.superfluid.QueryTotalDelegationByDelegatorResponse", aminoType: "osmosis/query-total-delegation-by-delegator-response", + is(o: any): o is QueryTotalDelegationByDelegatorResponse { + return o && (o.$typeUrl === QueryTotalDelegationByDelegatorResponse.typeUrl || Array.isArray(o.superfluidDelegationRecords) && (!o.superfluidDelegationRecords.length || SuperfluidDelegationRecord.is(o.superfluidDelegationRecords[0])) && Array.isArray(o.delegationResponse) && (!o.delegationResponse.length || DelegationResponse.is(o.delegationResponse[0])) && Array.isArray(o.totalDelegatedCoins) && (!o.totalDelegatedCoins.length || Coin.is(o.totalDelegatedCoins[0])) && Coin.is(o.totalEquivalentStakedAmount)); + }, + isSDK(o: any): o is QueryTotalDelegationByDelegatorResponseSDKType { + return o && (o.$typeUrl === QueryTotalDelegationByDelegatorResponse.typeUrl || Array.isArray(o.superfluid_delegation_records) && (!o.superfluid_delegation_records.length || SuperfluidDelegationRecord.isSDK(o.superfluid_delegation_records[0])) && Array.isArray(o.delegation_response) && (!o.delegation_response.length || DelegationResponse.isSDK(o.delegation_response[0])) && Array.isArray(o.total_delegated_coins) && (!o.total_delegated_coins.length || Coin.isSDK(o.total_delegated_coins[0])) && Coin.isSDK(o.total_equivalent_staked_amount)); + }, + isAmino(o: any): o is QueryTotalDelegationByDelegatorResponseAmino { + return o && (o.$typeUrl === QueryTotalDelegationByDelegatorResponse.typeUrl || Array.isArray(o.superfluid_delegation_records) && (!o.superfluid_delegation_records.length || SuperfluidDelegationRecord.isAmino(o.superfluid_delegation_records[0])) && Array.isArray(o.delegation_response) && (!o.delegation_response.length || DelegationResponse.isAmino(o.delegation_response[0])) && Array.isArray(o.total_delegated_coins) && (!o.total_delegated_coins.length || Coin.isAmino(o.total_delegated_coins[0])) && Coin.isAmino(o.total_equivalent_staked_amount)); + }, encode(message: QueryTotalDelegationByDelegatorResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.superfluidDelegationRecords) { SuperfluidDelegationRecord.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -4308,6 +4672,14 @@ export const QueryTotalDelegationByDelegatorResponse = { typeUrl: "/osmosis.superfluid.QueryTotalDelegationByDelegatorResponse", value: QueryTotalDelegationByDelegatorResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryTotalDelegationByDelegatorResponse.typeUrl)) { + return; + } + SuperfluidDelegationRecord.registerTypeUrl(); + DelegationResponse.registerTypeUrl(); + Coin.registerTypeUrl(); } }; function createBaseQueryUnpoolWhitelistRequest(): QueryUnpoolWhitelistRequest { @@ -4321,6 +4693,15 @@ function createBaseQueryUnpoolWhitelistRequest(): QueryUnpoolWhitelistRequest { export const QueryUnpoolWhitelistRequest = { typeUrl: "/osmosis.superfluid.QueryUnpoolWhitelistRequest", aminoType: "osmosis/query-unpool-whitelist-request", + is(o: any): o is QueryUnpoolWhitelistRequest { + return o && o.$typeUrl === QueryUnpoolWhitelistRequest.typeUrl; + }, + isSDK(o: any): o is QueryUnpoolWhitelistRequestSDKType { + return o && o.$typeUrl === QueryUnpoolWhitelistRequest.typeUrl; + }, + isAmino(o: any): o is QueryUnpoolWhitelistRequestAmino { + return o && o.$typeUrl === QueryUnpoolWhitelistRequest.typeUrl; + }, encode(_: QueryUnpoolWhitelistRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -4385,7 +4766,8 @@ export const QueryUnpoolWhitelistRequest = { typeUrl: "/osmosis.superfluid.QueryUnpoolWhitelistRequest", value: QueryUnpoolWhitelistRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryUnpoolWhitelistResponse(): QueryUnpoolWhitelistResponse { return { @@ -4400,6 +4782,15 @@ function createBaseQueryUnpoolWhitelistResponse(): QueryUnpoolWhitelistResponse export const QueryUnpoolWhitelistResponse = { typeUrl: "/osmosis.superfluid.QueryUnpoolWhitelistResponse", aminoType: "osmosis/query-unpool-whitelist-response", + is(o: any): o is QueryUnpoolWhitelistResponse { + return o && (o.$typeUrl === QueryUnpoolWhitelistResponse.typeUrl || Array.isArray(o.poolIds) && (!o.poolIds.length || typeof o.poolIds[0] === "bigint")); + }, + isSDK(o: any): o is QueryUnpoolWhitelistResponseSDKType { + return o && (o.$typeUrl === QueryUnpoolWhitelistResponse.typeUrl || Array.isArray(o.pool_ids) && (!o.pool_ids.length || typeof o.pool_ids[0] === "bigint")); + }, + isAmino(o: any): o is QueryUnpoolWhitelistResponseAmino { + return o && (o.$typeUrl === QueryUnpoolWhitelistResponse.typeUrl || Array.isArray(o.pool_ids) && (!o.pool_ids.length || typeof o.pool_ids[0] === "bigint")); + }, encode(message: QueryUnpoolWhitelistResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { writer.uint32(10).fork(); for (const v of message.poolIds) { @@ -4499,5 +4890,6 @@ export const QueryUnpoolWhitelistResponse = { typeUrl: "/osmosis.superfluid.QueryUnpoolWhitelistResponse", value: QueryUnpoolWhitelistResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/osmosis/superfluid/superfluid.ts b/__fixtures__/v-next/outputv2/osmosis/superfluid/superfluid.ts index 392553ae6b..6c6be372d1 100644 --- a/__fixtures__/v-next/outputv2/osmosis/superfluid/superfluid.ts +++ b/__fixtures__/v-next/outputv2/osmosis/superfluid/superfluid.ts @@ -1,8 +1,9 @@ import { Coin, CoinAmino, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; -import { BinaryReader, BinaryWriter } from "../../binary"; import { isSet, DeepPartial } from "../../helpers"; +import { BinaryReader, BinaryWriter } from "../../binary"; import { JsonSafe } from "../../json-safe"; -import { Decimal } from "@cosmjs/math"; +import { Decimal } from "@interchainjs/math"; +import { GlobalDecoderRegistry } from "../../registry"; export const protobufPackage = "osmosis.superfluid"; /** * SuperfluidAssetType indicates whether the superfluid asset is @@ -348,6 +349,15 @@ function createBaseSuperfluidAsset(): SuperfluidAsset { export const SuperfluidAsset = { typeUrl: "/osmosis.superfluid.SuperfluidAsset", aminoType: "osmosis/superfluid-asset", + is(o: any): o is SuperfluidAsset { + return o && (o.$typeUrl === SuperfluidAsset.typeUrl || typeof o.denom === "string" && isSet(o.assetType)); + }, + isSDK(o: any): o is SuperfluidAssetSDKType { + return o && (o.$typeUrl === SuperfluidAsset.typeUrl || typeof o.denom === "string" && isSet(o.asset_type)); + }, + isAmino(o: any): o is SuperfluidAssetAmino { + return o && (o.$typeUrl === SuperfluidAsset.typeUrl || typeof o.denom === "string" && isSet(o.asset_type)); + }, encode(message: SuperfluidAsset, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.denom !== "") { writer.uint32(10).string(message.denom); @@ -443,7 +453,8 @@ export const SuperfluidAsset = { typeUrl: "/osmosis.superfluid.SuperfluidAsset", value: SuperfluidAsset.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseSuperfluidIntermediaryAccount(): SuperfluidIntermediaryAccount { return { @@ -463,6 +474,15 @@ function createBaseSuperfluidIntermediaryAccount(): SuperfluidIntermediaryAccoun export const SuperfluidIntermediaryAccount = { typeUrl: "/osmosis.superfluid.SuperfluidIntermediaryAccount", aminoType: "osmosis/superfluid-intermediary-account", + is(o: any): o is SuperfluidIntermediaryAccount { + return o && (o.$typeUrl === SuperfluidIntermediaryAccount.typeUrl || typeof o.denom === "string" && typeof o.valAddr === "string" && typeof o.gaugeId === "bigint"); + }, + isSDK(o: any): o is SuperfluidIntermediaryAccountSDKType { + return o && (o.$typeUrl === SuperfluidIntermediaryAccount.typeUrl || typeof o.denom === "string" && typeof o.val_addr === "string" && typeof o.gauge_id === "bigint"); + }, + isAmino(o: any): o is SuperfluidIntermediaryAccountAmino { + return o && (o.$typeUrl === SuperfluidIntermediaryAccount.typeUrl || typeof o.denom === "string" && typeof o.val_addr === "string" && typeof o.gauge_id === "bigint"); + }, encode(message: SuperfluidIntermediaryAccount, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.denom !== "") { writer.uint32(10).string(message.denom); @@ -575,7 +595,8 @@ export const SuperfluidIntermediaryAccount = { typeUrl: "/osmosis.superfluid.SuperfluidIntermediaryAccount", value: SuperfluidIntermediaryAccount.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseOsmoEquivalentMultiplierRecord(): OsmoEquivalentMultiplierRecord { return { @@ -599,6 +620,15 @@ function createBaseOsmoEquivalentMultiplierRecord(): OsmoEquivalentMultiplierRec export const OsmoEquivalentMultiplierRecord = { typeUrl: "/osmosis.superfluid.OsmoEquivalentMultiplierRecord", aminoType: "osmosis/osmo-equivalent-multiplier-record", + is(o: any): o is OsmoEquivalentMultiplierRecord { + return o && (o.$typeUrl === OsmoEquivalentMultiplierRecord.typeUrl || typeof o.epochNumber === "bigint" && typeof o.denom === "string" && typeof o.multiplier === "string"); + }, + isSDK(o: any): o is OsmoEquivalentMultiplierRecordSDKType { + return o && (o.$typeUrl === OsmoEquivalentMultiplierRecord.typeUrl || typeof o.epoch_number === "bigint" && typeof o.denom === "string" && typeof o.multiplier === "string"); + }, + isAmino(o: any): o is OsmoEquivalentMultiplierRecordAmino { + return o && (o.$typeUrl === OsmoEquivalentMultiplierRecord.typeUrl || typeof o.epoch_number === "bigint" && typeof o.denom === "string" && typeof o.multiplier === "string"); + }, encode(message: OsmoEquivalentMultiplierRecord, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.epochNumber !== BigInt(0)) { writer.uint32(8).int64(message.epochNumber); @@ -688,7 +718,7 @@ export const OsmoEquivalentMultiplierRecord = { const obj: any = {}; obj.epoch_number = message.epochNumber !== BigInt(0) ? message.epochNumber?.toString() : undefined; obj.denom = message.denom === "" ? undefined : message.denom; - obj.multiplier = message.multiplier === "" ? undefined : message.multiplier; + obj.multiplier = message.multiplier === "" ? undefined : Decimal.fromUserInput(message.multiplier, 18).atomics; return obj; }, fromAminoMsg(object: OsmoEquivalentMultiplierRecordAminoMsg): OsmoEquivalentMultiplierRecord { @@ -711,7 +741,8 @@ export const OsmoEquivalentMultiplierRecord = { typeUrl: "/osmosis.superfluid.OsmoEquivalentMultiplierRecord", value: OsmoEquivalentMultiplierRecord.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseSuperfluidDelegationRecord(): SuperfluidDelegationRecord { return { @@ -731,6 +762,15 @@ function createBaseSuperfluidDelegationRecord(): SuperfluidDelegationRecord { export const SuperfluidDelegationRecord = { typeUrl: "/osmosis.superfluid.SuperfluidDelegationRecord", aminoType: "osmosis/superfluid-delegation-record", + is(o: any): o is SuperfluidDelegationRecord { + return o && (o.$typeUrl === SuperfluidDelegationRecord.typeUrl || typeof o.delegatorAddress === "string" && typeof o.validatorAddress === "string" && Coin.is(o.delegationAmount)); + }, + isSDK(o: any): o is SuperfluidDelegationRecordSDKType { + return o && (o.$typeUrl === SuperfluidDelegationRecord.typeUrl || typeof o.delegator_address === "string" && typeof o.validator_address === "string" && Coin.isSDK(o.delegation_amount)); + }, + isAmino(o: any): o is SuperfluidDelegationRecordAmino { + return o && (o.$typeUrl === SuperfluidDelegationRecord.typeUrl || typeof o.delegator_address === "string" && typeof o.validator_address === "string" && Coin.isAmino(o.delegation_amount)); + }, encode(message: SuperfluidDelegationRecord, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.delegatorAddress !== "") { writer.uint32(10).string(message.delegatorAddress); @@ -860,6 +900,12 @@ export const SuperfluidDelegationRecord = { typeUrl: "/osmosis.superfluid.SuperfluidDelegationRecord", value: SuperfluidDelegationRecord.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(SuperfluidDelegationRecord.typeUrl)) { + return; + } + Coin.registerTypeUrl(); } }; function createBaseLockIdIntermediaryAccountConnection(): LockIdIntermediaryAccountConnection { @@ -879,6 +925,15 @@ function createBaseLockIdIntermediaryAccountConnection(): LockIdIntermediaryAcco export const LockIdIntermediaryAccountConnection = { typeUrl: "/osmosis.superfluid.LockIdIntermediaryAccountConnection", aminoType: "osmosis/lock-id-intermediary-account-connection", + is(o: any): o is LockIdIntermediaryAccountConnection { + return o && (o.$typeUrl === LockIdIntermediaryAccountConnection.typeUrl || typeof o.lockId === "bigint" && typeof o.intermediaryAccount === "string"); + }, + isSDK(o: any): o is LockIdIntermediaryAccountConnectionSDKType { + return o && (o.$typeUrl === LockIdIntermediaryAccountConnection.typeUrl || typeof o.lock_id === "bigint" && typeof o.intermediary_account === "string"); + }, + isAmino(o: any): o is LockIdIntermediaryAccountConnectionAmino { + return o && (o.$typeUrl === LockIdIntermediaryAccountConnection.typeUrl || typeof o.lock_id === "bigint" && typeof o.intermediary_account === "string"); + }, encode(message: LockIdIntermediaryAccountConnection, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.lockId !== BigInt(0)) { writer.uint32(8).uint64(message.lockId); @@ -976,7 +1031,8 @@ export const LockIdIntermediaryAccountConnection = { typeUrl: "/osmosis.superfluid.LockIdIntermediaryAccountConnection", value: LockIdIntermediaryAccountConnection.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseUnpoolWhitelistedPools(): UnpoolWhitelistedPools { return { @@ -991,6 +1047,15 @@ function createBaseUnpoolWhitelistedPools(): UnpoolWhitelistedPools { export const UnpoolWhitelistedPools = { typeUrl: "/osmosis.superfluid.UnpoolWhitelistedPools", aminoType: "osmosis/unpool-whitelisted-pools", + is(o: any): o is UnpoolWhitelistedPools { + return o && (o.$typeUrl === UnpoolWhitelistedPools.typeUrl || Array.isArray(o.ids) && (!o.ids.length || typeof o.ids[0] === "bigint")); + }, + isSDK(o: any): o is UnpoolWhitelistedPoolsSDKType { + return o && (o.$typeUrl === UnpoolWhitelistedPools.typeUrl || Array.isArray(o.ids) && (!o.ids.length || typeof o.ids[0] === "bigint")); + }, + isAmino(o: any): o is UnpoolWhitelistedPoolsAmino { + return o && (o.$typeUrl === UnpoolWhitelistedPools.typeUrl || Array.isArray(o.ids) && (!o.ids.length || typeof o.ids[0] === "bigint")); + }, encode(message: UnpoolWhitelistedPools, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { writer.uint32(10).fork(); for (const v of message.ids) { @@ -1090,5 +1155,6 @@ export const UnpoolWhitelistedPools = { typeUrl: "/osmosis.superfluid.UnpoolWhitelistedPools", value: UnpoolWhitelistedPools.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/osmosis/superfluid/tx.registry.ts b/__fixtures__/v-next/outputv2/osmosis/superfluid/tx.registry.ts index 408840bd8c..c9738112cd 100644 --- a/__fixtures__/v-next/outputv2/osmosis/superfluid/tx.registry.ts +++ b/__fixtures__/v-next/outputv2/osmosis/superfluid/tx.registry.ts @@ -1,11 +1,6 @@ -import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { TelescopeGeneratedType } from "../../types"; import { MsgSuperfluidDelegate, MsgSuperfluidUndelegate, MsgSuperfluidUnbondLock, MsgLockAndSuperfluidDelegate, MsgUnPoolWhitelistedPool } from "./tx"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/osmosis.superfluid.MsgSuperfluidDelegate", MsgSuperfluidDelegate], ["/osmosis.superfluid.MsgSuperfluidUndelegate", MsgSuperfluidUndelegate], ["/osmosis.superfluid.MsgSuperfluidUnbondLock", MsgSuperfluidUnbondLock], ["/osmosis.superfluid.MsgLockAndSuperfluidDelegate", MsgLockAndSuperfluidDelegate], ["/osmosis.superfluid.MsgUnPoolWhitelistedPool", MsgUnPoolWhitelistedPool]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/osmosis.superfluid.MsgSuperfluidDelegate", MsgSuperfluidDelegate], ["/osmosis.superfluid.MsgSuperfluidUndelegate", MsgSuperfluidUndelegate], ["/osmosis.superfluid.MsgSuperfluidUnbondLock", MsgSuperfluidUnbondLock], ["/osmosis.superfluid.MsgLockAndSuperfluidDelegate", MsgLockAndSuperfluidDelegate], ["/osmosis.superfluid.MsgUnPoolWhitelistedPool", MsgUnPoolWhitelistedPool]]; export const MessageComposer = { encoded: { superfluidDelegate(value: MsgSuperfluidDelegate) { diff --git a/__fixtures__/v-next/outputv2/osmosis/superfluid/tx.rpc.func.ts b/__fixtures__/v-next/outputv2/osmosis/superfluid/tx.rpc.func.ts new file mode 100644 index 0000000000..616c24adc9 --- /dev/null +++ b/__fixtures__/v-next/outputv2/osmosis/superfluid/tx.rpc.func.ts @@ -0,0 +1,47 @@ +import { buildTx } from "../../helper-func-types"; +import { MsgSuperfluidDelegate, MsgSuperfluidUndelegate, MsgSuperfluidUnbondLock, MsgLockAndSuperfluidDelegate, MsgUnPoolWhitelistedPool } from "./tx"; +/** + * Execute superfluid delegation for a lockup + * @name superfluidDelegate + * @package osmosis.superfluid + * @see proto service: osmosis.superfluid.SuperfluidDelegate + */ +export const superfluidDelegate = buildTx({ + msg: MsgSuperfluidDelegate +}); +/** + * Execute superfluid undelegation for a lockup + * @name superfluidUndelegate + * @package osmosis.superfluid + * @see proto service: osmosis.superfluid.SuperfluidUndelegate + */ +export const superfluidUndelegate = buildTx({ + msg: MsgSuperfluidUndelegate +}); +/** + * For a given lock that is being superfluidly undelegated, + * also unbond the underlying lock. + * @name superfluidUnbondLock + * @package osmosis.superfluid + * @see proto service: osmosis.superfluid.SuperfluidUnbondLock + */ +export const superfluidUnbondLock = buildTx({ + msg: MsgSuperfluidUnbondLock +}); +/** + * Execute lockup lock and superfluid delegation in a single msg + * @name lockAndSuperfluidDelegate + * @package osmosis.superfluid + * @see proto service: osmosis.superfluid.LockAndSuperfluidDelegate + */ +export const lockAndSuperfluidDelegate = buildTx({ + msg: MsgLockAndSuperfluidDelegate +}); +/** + * @name unPoolWhitelistedPool + * @package osmosis.superfluid + * @see proto service: osmosis.superfluid.UnPoolWhitelistedPool + */ +export const unPoolWhitelistedPool = buildTx({ + msg: MsgUnPoolWhitelistedPool +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/osmosis/superfluid/tx.ts b/__fixtures__/v-next/outputv2/osmosis/superfluid/tx.ts index d70f3b55a4..5b9738346b 100644 --- a/__fixtures__/v-next/outputv2/osmosis/superfluid/tx.ts +++ b/__fixtures__/v-next/outputv2/osmosis/superfluid/tx.ts @@ -2,6 +2,7 @@ import { Coin, CoinAmino, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../binary"; import { isSet, DeepPartial } from "../../helpers"; import { JsonSafe } from "../../json-safe"; +import { GlobalDecoderRegistry } from "../../registry"; export const protobufPackage = "osmosis.superfluid"; /** * @name MsgSuperfluidDelegate @@ -374,6 +375,15 @@ function createBaseMsgSuperfluidDelegate(): MsgSuperfluidDelegate { export const MsgSuperfluidDelegate = { typeUrl: "/osmosis.superfluid.MsgSuperfluidDelegate", aminoType: "osmosis/superfluid-delegate", + is(o: any): o is MsgSuperfluidDelegate { + return o && (o.$typeUrl === MsgSuperfluidDelegate.typeUrl || typeof o.sender === "string" && typeof o.lockId === "bigint" && typeof o.valAddr === "string"); + }, + isSDK(o: any): o is MsgSuperfluidDelegateSDKType { + return o && (o.$typeUrl === MsgSuperfluidDelegate.typeUrl || typeof o.sender === "string" && typeof o.lock_id === "bigint" && typeof o.val_addr === "string"); + }, + isAmino(o: any): o is MsgSuperfluidDelegateAmino { + return o && (o.$typeUrl === MsgSuperfluidDelegate.typeUrl || typeof o.sender === "string" && typeof o.lock_id === "bigint" && typeof o.val_addr === "string"); + }, encode(message: MsgSuperfluidDelegate, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.sender !== "") { writer.uint32(10).string(message.sender); @@ -486,7 +496,8 @@ export const MsgSuperfluidDelegate = { typeUrl: "/osmosis.superfluid.MsgSuperfluidDelegate", value: MsgSuperfluidDelegate.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgSuperfluidDelegateResponse(): MsgSuperfluidDelegateResponse { return {}; @@ -499,6 +510,15 @@ function createBaseMsgSuperfluidDelegateResponse(): MsgSuperfluidDelegateRespons export const MsgSuperfluidDelegateResponse = { typeUrl: "/osmosis.superfluid.MsgSuperfluidDelegateResponse", aminoType: "osmosis/superfluid-delegate-response", + is(o: any): o is MsgSuperfluidDelegateResponse { + return o && o.$typeUrl === MsgSuperfluidDelegateResponse.typeUrl; + }, + isSDK(o: any): o is MsgSuperfluidDelegateResponseSDKType { + return o && o.$typeUrl === MsgSuperfluidDelegateResponse.typeUrl; + }, + isAmino(o: any): o is MsgSuperfluidDelegateResponseAmino { + return o && o.$typeUrl === MsgSuperfluidDelegateResponse.typeUrl; + }, encode(_: MsgSuperfluidDelegateResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -563,7 +583,8 @@ export const MsgSuperfluidDelegateResponse = { typeUrl: "/osmosis.superfluid.MsgSuperfluidDelegateResponse", value: MsgSuperfluidDelegateResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgSuperfluidUndelegate(): MsgSuperfluidUndelegate { return { @@ -579,6 +600,15 @@ function createBaseMsgSuperfluidUndelegate(): MsgSuperfluidUndelegate { export const MsgSuperfluidUndelegate = { typeUrl: "/osmosis.superfluid.MsgSuperfluidUndelegate", aminoType: "osmosis/superfluid-undelegate", + is(o: any): o is MsgSuperfluidUndelegate { + return o && (o.$typeUrl === MsgSuperfluidUndelegate.typeUrl || typeof o.sender === "string" && typeof o.lockId === "bigint"); + }, + isSDK(o: any): o is MsgSuperfluidUndelegateSDKType { + return o && (o.$typeUrl === MsgSuperfluidUndelegate.typeUrl || typeof o.sender === "string" && typeof o.lock_id === "bigint"); + }, + isAmino(o: any): o is MsgSuperfluidUndelegateAmino { + return o && (o.$typeUrl === MsgSuperfluidUndelegate.typeUrl || typeof o.sender === "string" && typeof o.lock_id === "bigint"); + }, encode(message: MsgSuperfluidUndelegate, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.sender !== "") { writer.uint32(10).string(message.sender); @@ -676,7 +706,8 @@ export const MsgSuperfluidUndelegate = { typeUrl: "/osmosis.superfluid.MsgSuperfluidUndelegate", value: MsgSuperfluidUndelegate.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgSuperfluidUndelegateResponse(): MsgSuperfluidUndelegateResponse { return {}; @@ -689,6 +720,15 @@ function createBaseMsgSuperfluidUndelegateResponse(): MsgSuperfluidUndelegateRes export const MsgSuperfluidUndelegateResponse = { typeUrl: "/osmosis.superfluid.MsgSuperfluidUndelegateResponse", aminoType: "osmosis/superfluid-undelegate-response", + is(o: any): o is MsgSuperfluidUndelegateResponse { + return o && o.$typeUrl === MsgSuperfluidUndelegateResponse.typeUrl; + }, + isSDK(o: any): o is MsgSuperfluidUndelegateResponseSDKType { + return o && o.$typeUrl === MsgSuperfluidUndelegateResponse.typeUrl; + }, + isAmino(o: any): o is MsgSuperfluidUndelegateResponseAmino { + return o && o.$typeUrl === MsgSuperfluidUndelegateResponse.typeUrl; + }, encode(_: MsgSuperfluidUndelegateResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -753,7 +793,8 @@ export const MsgSuperfluidUndelegateResponse = { typeUrl: "/osmosis.superfluid.MsgSuperfluidUndelegateResponse", value: MsgSuperfluidUndelegateResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgSuperfluidUnbondLock(): MsgSuperfluidUnbondLock { return { @@ -769,6 +810,15 @@ function createBaseMsgSuperfluidUnbondLock(): MsgSuperfluidUnbondLock { export const MsgSuperfluidUnbondLock = { typeUrl: "/osmosis.superfluid.MsgSuperfluidUnbondLock", aminoType: "osmosis/superfluid-unbond-lock", + is(o: any): o is MsgSuperfluidUnbondLock { + return o && (o.$typeUrl === MsgSuperfluidUnbondLock.typeUrl || typeof o.sender === "string" && typeof o.lockId === "bigint"); + }, + isSDK(o: any): o is MsgSuperfluidUnbondLockSDKType { + return o && (o.$typeUrl === MsgSuperfluidUnbondLock.typeUrl || typeof o.sender === "string" && typeof o.lock_id === "bigint"); + }, + isAmino(o: any): o is MsgSuperfluidUnbondLockAmino { + return o && (o.$typeUrl === MsgSuperfluidUnbondLock.typeUrl || typeof o.sender === "string" && typeof o.lock_id === "bigint"); + }, encode(message: MsgSuperfluidUnbondLock, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.sender !== "") { writer.uint32(10).string(message.sender); @@ -866,7 +916,8 @@ export const MsgSuperfluidUnbondLock = { typeUrl: "/osmosis.superfluid.MsgSuperfluidUnbondLock", value: MsgSuperfluidUnbondLock.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgSuperfluidUnbondLockResponse(): MsgSuperfluidUnbondLockResponse { return {}; @@ -879,6 +930,15 @@ function createBaseMsgSuperfluidUnbondLockResponse(): MsgSuperfluidUnbondLockRes export const MsgSuperfluidUnbondLockResponse = { typeUrl: "/osmosis.superfluid.MsgSuperfluidUnbondLockResponse", aminoType: "osmosis/superfluid-unbond-lock-response", + is(o: any): o is MsgSuperfluidUnbondLockResponse { + return o && o.$typeUrl === MsgSuperfluidUnbondLockResponse.typeUrl; + }, + isSDK(o: any): o is MsgSuperfluidUnbondLockResponseSDKType { + return o && o.$typeUrl === MsgSuperfluidUnbondLockResponse.typeUrl; + }, + isAmino(o: any): o is MsgSuperfluidUnbondLockResponseAmino { + return o && o.$typeUrl === MsgSuperfluidUnbondLockResponse.typeUrl; + }, encode(_: MsgSuperfluidUnbondLockResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -943,7 +1003,8 @@ export const MsgSuperfluidUnbondLockResponse = { typeUrl: "/osmosis.superfluid.MsgSuperfluidUnbondLockResponse", value: MsgSuperfluidUnbondLockResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgLockAndSuperfluidDelegate(): MsgLockAndSuperfluidDelegate { return { @@ -963,6 +1024,15 @@ function createBaseMsgLockAndSuperfluidDelegate(): MsgLockAndSuperfluidDelegate export const MsgLockAndSuperfluidDelegate = { typeUrl: "/osmosis.superfluid.MsgLockAndSuperfluidDelegate", aminoType: "osmosis/lock-and-superfluid-delegate", + is(o: any): o is MsgLockAndSuperfluidDelegate { + return o && (o.$typeUrl === MsgLockAndSuperfluidDelegate.typeUrl || typeof o.sender === "string" && Array.isArray(o.coins) && (!o.coins.length || Coin.is(o.coins[0])) && typeof o.valAddr === "string"); + }, + isSDK(o: any): o is MsgLockAndSuperfluidDelegateSDKType { + return o && (o.$typeUrl === MsgLockAndSuperfluidDelegate.typeUrl || typeof o.sender === "string" && Array.isArray(o.coins) && (!o.coins.length || Coin.isSDK(o.coins[0])) && typeof o.val_addr === "string"); + }, + isAmino(o: any): o is MsgLockAndSuperfluidDelegateAmino { + return o && (o.$typeUrl === MsgLockAndSuperfluidDelegate.typeUrl || typeof o.sender === "string" && Array.isArray(o.coins) && (!o.coins.length || Coin.isAmino(o.coins[0])) && typeof o.val_addr === "string"); + }, encode(message: MsgLockAndSuperfluidDelegate, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.sender !== "") { writer.uint32(10).string(message.sender); @@ -1083,6 +1153,12 @@ export const MsgLockAndSuperfluidDelegate = { typeUrl: "/osmosis.superfluid.MsgLockAndSuperfluidDelegate", value: MsgLockAndSuperfluidDelegate.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgLockAndSuperfluidDelegate.typeUrl)) { + return; + } + Coin.registerTypeUrl(); } }; function createBaseMsgLockAndSuperfluidDelegateResponse(): MsgLockAndSuperfluidDelegateResponse { @@ -1098,6 +1174,15 @@ function createBaseMsgLockAndSuperfluidDelegateResponse(): MsgLockAndSuperfluidD export const MsgLockAndSuperfluidDelegateResponse = { typeUrl: "/osmosis.superfluid.MsgLockAndSuperfluidDelegateResponse", aminoType: "osmosis/lock-and-superfluid-delegate-response", + is(o: any): o is MsgLockAndSuperfluidDelegateResponse { + return o && (o.$typeUrl === MsgLockAndSuperfluidDelegateResponse.typeUrl || typeof o.iD === "bigint"); + }, + isSDK(o: any): o is MsgLockAndSuperfluidDelegateResponseSDKType { + return o && (o.$typeUrl === MsgLockAndSuperfluidDelegateResponse.typeUrl || typeof o.ID === "bigint"); + }, + isAmino(o: any): o is MsgLockAndSuperfluidDelegateResponseAmino { + return o && (o.$typeUrl === MsgLockAndSuperfluidDelegateResponse.typeUrl || typeof o.ID === "bigint"); + }, encode(message: MsgLockAndSuperfluidDelegateResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.iD !== BigInt(0)) { writer.uint32(8).uint64(message.iD); @@ -1180,7 +1265,8 @@ export const MsgLockAndSuperfluidDelegateResponse = { typeUrl: "/osmosis.superfluid.MsgLockAndSuperfluidDelegateResponse", value: MsgLockAndSuperfluidDelegateResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgUnPoolWhitelistedPool(): MsgUnPoolWhitelistedPool { return { @@ -1204,6 +1290,15 @@ function createBaseMsgUnPoolWhitelistedPool(): MsgUnPoolWhitelistedPool { export const MsgUnPoolWhitelistedPool = { typeUrl: "/osmosis.superfluid.MsgUnPoolWhitelistedPool", aminoType: "osmosis/unpool-whitelisted-pool", + is(o: any): o is MsgUnPoolWhitelistedPool { + return o && (o.$typeUrl === MsgUnPoolWhitelistedPool.typeUrl || typeof o.sender === "string" && typeof o.poolId === "bigint"); + }, + isSDK(o: any): o is MsgUnPoolWhitelistedPoolSDKType { + return o && (o.$typeUrl === MsgUnPoolWhitelistedPool.typeUrl || typeof o.sender === "string" && typeof o.pool_id === "bigint"); + }, + isAmino(o: any): o is MsgUnPoolWhitelistedPoolAmino { + return o && (o.$typeUrl === MsgUnPoolWhitelistedPool.typeUrl || typeof o.sender === "string" && typeof o.pool_id === "bigint"); + }, encode(message: MsgUnPoolWhitelistedPool, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.sender !== "") { writer.uint32(10).string(message.sender); @@ -1301,7 +1396,8 @@ export const MsgUnPoolWhitelistedPool = { typeUrl: "/osmosis.superfluid.MsgUnPoolWhitelistedPool", value: MsgUnPoolWhitelistedPool.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgUnPoolWhitelistedPoolResponse(): MsgUnPoolWhitelistedPoolResponse { return { @@ -1316,6 +1412,15 @@ function createBaseMsgUnPoolWhitelistedPoolResponse(): MsgUnPoolWhitelistedPoolR export const MsgUnPoolWhitelistedPoolResponse = { typeUrl: "/osmosis.superfluid.MsgUnPoolWhitelistedPoolResponse", aminoType: "osmosis/un-pool-whitelisted-pool-response", + is(o: any): o is MsgUnPoolWhitelistedPoolResponse { + return o && (o.$typeUrl === MsgUnPoolWhitelistedPoolResponse.typeUrl || Array.isArray(o.exitedLockIds) && (!o.exitedLockIds.length || typeof o.exitedLockIds[0] === "bigint")); + }, + isSDK(o: any): o is MsgUnPoolWhitelistedPoolResponseSDKType { + return o && (o.$typeUrl === MsgUnPoolWhitelistedPoolResponse.typeUrl || Array.isArray(o.exited_lock_ids) && (!o.exited_lock_ids.length || typeof o.exited_lock_ids[0] === "bigint")); + }, + isAmino(o: any): o is MsgUnPoolWhitelistedPoolResponseAmino { + return o && (o.$typeUrl === MsgUnPoolWhitelistedPoolResponse.typeUrl || Array.isArray(o.exited_lock_ids) && (!o.exited_lock_ids.length || typeof o.exited_lock_ids[0] === "bigint")); + }, encode(message: MsgUnPoolWhitelistedPoolResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { writer.uint32(10).fork(); for (const v of message.exitedLockIds) { @@ -1415,5 +1520,6 @@ export const MsgUnPoolWhitelistedPoolResponse = { typeUrl: "/osmosis.superfluid.MsgUnPoolWhitelistedPoolResponse", value: MsgUnPoolWhitelistedPoolResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/osmosis/tokenfactory/v1beta1/authorityMetadata.ts b/__fixtures__/v-next/outputv2/osmosis/tokenfactory/v1beta1/authorityMetadata.ts index ac156c2e26..83fb7f0d09 100644 --- a/__fixtures__/v-next/outputv2/osmosis/tokenfactory/v1beta1/authorityMetadata.ts +++ b/__fixtures__/v-next/outputv2/osmosis/tokenfactory/v1beta1/authorityMetadata.ts @@ -65,6 +65,15 @@ function createBaseDenomAuthorityMetadata(): DenomAuthorityMetadata { export const DenomAuthorityMetadata = { typeUrl: "/osmosis.tokenfactory.v1beta1.DenomAuthorityMetadata", aminoType: "osmosis/tokenfactory/denom-authority-metadata", + is(o: any): o is DenomAuthorityMetadata { + return o && (o.$typeUrl === DenomAuthorityMetadata.typeUrl || typeof o.admin === "string"); + }, + isSDK(o: any): o is DenomAuthorityMetadataSDKType { + return o && (o.$typeUrl === DenomAuthorityMetadata.typeUrl || typeof o.admin === "string"); + }, + isAmino(o: any): o is DenomAuthorityMetadataAmino { + return o && (o.$typeUrl === DenomAuthorityMetadata.typeUrl || typeof o.admin === "string"); + }, encode(message: DenomAuthorityMetadata, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.admin !== "") { writer.uint32(10).string(message.admin); @@ -145,5 +154,6 @@ export const DenomAuthorityMetadata = { typeUrl: "/osmosis.tokenfactory.v1beta1.DenomAuthorityMetadata", value: DenomAuthorityMetadata.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/osmosis/tokenfactory/v1beta1/genesis.ts b/__fixtures__/v-next/outputv2/osmosis/tokenfactory/v1beta1/genesis.ts index 3cc83c3d12..dac6d622ae 100644 --- a/__fixtures__/v-next/outputv2/osmosis/tokenfactory/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv2/osmosis/tokenfactory/v1beta1/genesis.ts @@ -1,6 +1,7 @@ import { Params, ParamsAmino, ParamsSDKType } from "./params"; import { DenomAuthorityMetadata, DenomAuthorityMetadataAmino, DenomAuthorityMetadataSDKType } from "./authorityMetadata"; import { BinaryReader, BinaryWriter } from "../../../binary"; +import { GlobalDecoderRegistry } from "../../../registry"; import { isSet, DeepPartial } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "osmosis.tokenfactory.v1beta1"; @@ -107,6 +108,15 @@ function createBaseGenesisState(): GenesisState { export const GenesisState = { typeUrl: "/osmosis.tokenfactory.v1beta1.GenesisState", aminoType: "osmosis/tokenfactory/genesis-state", + is(o: any): o is GenesisState { + return o && (o.$typeUrl === GenesisState.typeUrl || Params.is(o.params) && Array.isArray(o.factoryDenoms) && (!o.factoryDenoms.length || GenesisDenom.is(o.factoryDenoms[0]))); + }, + isSDK(o: any): o is GenesisStateSDKType { + return o && (o.$typeUrl === GenesisState.typeUrl || Params.isSDK(o.params) && Array.isArray(o.factory_denoms) && (!o.factory_denoms.length || GenesisDenom.isSDK(o.factory_denoms[0]))); + }, + isAmino(o: any): o is GenesisStateAmino { + return o && (o.$typeUrl === GenesisState.typeUrl || Params.isAmino(o.params) && Array.isArray(o.factory_denoms) && (!o.factory_denoms.length || GenesisDenom.isAmino(o.factory_denoms[0]))); + }, encode(message: GenesisState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.params !== undefined) { Params.encode(message.params, writer.uint32(10).fork()).ldelim(); @@ -214,6 +224,13 @@ export const GenesisState = { typeUrl: "/osmosis.tokenfactory.v1beta1.GenesisState", value: GenesisState.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GenesisState.typeUrl)) { + return; + } + Params.registerTypeUrl(); + GenesisDenom.registerTypeUrl(); } }; function createBaseGenesisDenom(): GenesisDenom { @@ -233,6 +250,15 @@ function createBaseGenesisDenom(): GenesisDenom { export const GenesisDenom = { typeUrl: "/osmosis.tokenfactory.v1beta1.GenesisDenom", aminoType: "osmosis/tokenfactory/genesis-denom", + is(o: any): o is GenesisDenom { + return o && (o.$typeUrl === GenesisDenom.typeUrl || typeof o.denom === "string" && DenomAuthorityMetadata.is(o.authorityMetadata)); + }, + isSDK(o: any): o is GenesisDenomSDKType { + return o && (o.$typeUrl === GenesisDenom.typeUrl || typeof o.denom === "string" && DenomAuthorityMetadata.isSDK(o.authority_metadata)); + }, + isAmino(o: any): o is GenesisDenomAmino { + return o && (o.$typeUrl === GenesisDenom.typeUrl || typeof o.denom === "string" && DenomAuthorityMetadata.isAmino(o.authority_metadata)); + }, encode(message: GenesisDenom, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.denom !== "") { writer.uint32(10).string(message.denom); @@ -330,5 +356,11 @@ export const GenesisDenom = { typeUrl: "/osmosis.tokenfactory.v1beta1.GenesisDenom", value: GenesisDenom.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GenesisDenom.typeUrl)) { + return; + } + DenomAuthorityMetadata.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/osmosis/tokenfactory/v1beta1/params.ts b/__fixtures__/v-next/outputv2/osmosis/tokenfactory/v1beta1/params.ts index b5a3e84898..4c0dd7cf3d 100644 --- a/__fixtures__/v-next/outputv2/osmosis/tokenfactory/v1beta1/params.ts +++ b/__fixtures__/v-next/outputv2/osmosis/tokenfactory/v1beta1/params.ts @@ -2,6 +2,7 @@ import { Coin, CoinAmino, CoinSDKType } from "../../../cosmos/base/v1beta1/coin" import { BinaryReader, BinaryWriter } from "../../../binary"; import { JsonSafe } from "../../../json-safe"; import { DeepPartial } from "../../../helpers"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "osmosis.tokenfactory.v1beta1"; /** * Params defines the parameters for the tokenfactory module. @@ -52,6 +53,15 @@ function createBaseParams(): Params { export const Params = { typeUrl: "/osmosis.tokenfactory.v1beta1.Params", aminoType: "osmosis/tokenfactory/params", + is(o: any): o is Params { + return o && (o.$typeUrl === Params.typeUrl || Array.isArray(o.denomCreationFee) && (!o.denomCreationFee.length || Coin.is(o.denomCreationFee[0]))); + }, + isSDK(o: any): o is ParamsSDKType { + return o && (o.$typeUrl === Params.typeUrl || Array.isArray(o.denom_creation_fee) && (!o.denom_creation_fee.length || Coin.isSDK(o.denom_creation_fee[0]))); + }, + isAmino(o: any): o is ParamsAmino { + return o && (o.$typeUrl === Params.typeUrl || Array.isArray(o.denom_creation_fee) && (!o.denom_creation_fee.length || Coin.isAmino(o.denom_creation_fee[0]))); + }, encode(message: Params, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.denomCreationFee) { Coin.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -142,5 +152,11 @@ export const Params = { typeUrl: "/osmosis.tokenfactory.v1beta1.Params", value: Params.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Params.typeUrl)) { + return; + } + Coin.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/osmosis/tokenfactory/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputv2/osmosis/tokenfactory/v1beta1/query.rpc.func.ts new file mode 100644 index 0000000000..60aea17f2a --- /dev/null +++ b/__fixtures__/v-next/outputv2/osmosis/tokenfactory/v1beta1/query.rpc.func.ts @@ -0,0 +1,44 @@ +import { buildQuery } from "../../../helper-func-types"; +import { QueryParamsRequest, QueryParamsResponse, QueryDenomAuthorityMetadataRequest, QueryDenomAuthorityMetadataResponse, QueryDenomsFromCreatorRequest, QueryDenomsFromCreatorResponse } from "./query"; +/** + * Params defines a gRPC query method that returns the tokenfactory module's + * parameters. + * @name getParams + * @package osmosis.tokenfactory.v1beta1 + * @see proto service: osmosis.tokenfactory.v1beta1.Params + */ +export const getParams = buildQuery({ + encode: QueryParamsRequest.encode, + decode: QueryParamsResponse.decode, + service: "osmosis.tokenfactory.v1beta1.Query", + method: "Params", + deps: [QueryParamsRequest, QueryParamsResponse] +}); +/** + * DenomAuthorityMetadata defines a gRPC query method for fetching + * DenomAuthorityMetadata for a particular denom. + * @name getDenomAuthorityMetadata + * @package osmosis.tokenfactory.v1beta1 + * @see proto service: osmosis.tokenfactory.v1beta1.DenomAuthorityMetadata + */ +export const getDenomAuthorityMetadata = buildQuery({ + encode: QueryDenomAuthorityMetadataRequest.encode, + decode: QueryDenomAuthorityMetadataResponse.decode, + service: "osmosis.tokenfactory.v1beta1.Query", + method: "DenomAuthorityMetadata", + deps: [QueryDenomAuthorityMetadataRequest, QueryDenomAuthorityMetadataResponse] +}); +/** + * DenomsFromCreator defines a gRPC query method for fetching all + * denominations created by a specific admin/creator. + * @name getDenomsFromCreator + * @package osmosis.tokenfactory.v1beta1 + * @see proto service: osmosis.tokenfactory.v1beta1.DenomsFromCreator + */ +export const getDenomsFromCreator = buildQuery({ + encode: QueryDenomsFromCreatorRequest.encode, + decode: QueryDenomsFromCreatorResponse.decode, + service: "osmosis.tokenfactory.v1beta1.Query", + method: "DenomsFromCreator", + deps: [QueryDenomsFromCreatorRequest, QueryDenomsFromCreatorResponse] +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/osmosis/tokenfactory/v1beta1/query.ts b/__fixtures__/v-next/outputv2/osmosis/tokenfactory/v1beta1/query.ts index 6ef6ede59a..2c21f32373 100644 --- a/__fixtures__/v-next/outputv2/osmosis/tokenfactory/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv2/osmosis/tokenfactory/v1beta1/query.ts @@ -3,6 +3,7 @@ import { DenomAuthorityMetadata, DenomAuthorityMetadataAmino, DenomAuthorityMeta import { BinaryReader, BinaryWriter } from "../../../binary"; import { JsonSafe } from "../../../json-safe"; import { DeepPartial, isSet } from "../../../helpers"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "osmosis.tokenfactory.v1beta1"; /** * QueryParamsRequest is the request type for the Query/Params RPC method. @@ -238,6 +239,15 @@ function createBaseQueryParamsRequest(): QueryParamsRequest { export const QueryParamsRequest = { typeUrl: "/osmosis.tokenfactory.v1beta1.QueryParamsRequest", aminoType: "osmosis/tokenfactory/query-params-request", + is(o: any): o is QueryParamsRequest { + return o && o.$typeUrl === QueryParamsRequest.typeUrl; + }, + isSDK(o: any): o is QueryParamsRequestSDKType { + return o && o.$typeUrl === QueryParamsRequest.typeUrl; + }, + isAmino(o: any): o is QueryParamsRequestAmino { + return o && o.$typeUrl === QueryParamsRequest.typeUrl; + }, encode(_: QueryParamsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -302,7 +312,8 @@ export const QueryParamsRequest = { typeUrl: "/osmosis.tokenfactory.v1beta1.QueryParamsRequest", value: QueryParamsRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryParamsResponse(): QueryParamsResponse { return { @@ -318,6 +329,15 @@ function createBaseQueryParamsResponse(): QueryParamsResponse { export const QueryParamsResponse = { typeUrl: "/osmosis.tokenfactory.v1beta1.QueryParamsResponse", aminoType: "osmosis/tokenfactory/query-params-response", + is(o: any): o is QueryParamsResponse { + return o && (o.$typeUrl === QueryParamsResponse.typeUrl || Params.is(o.params)); + }, + isSDK(o: any): o is QueryParamsResponseSDKType { + return o && (o.$typeUrl === QueryParamsResponse.typeUrl || Params.isSDK(o.params)); + }, + isAmino(o: any): o is QueryParamsResponseAmino { + return o && (o.$typeUrl === QueryParamsResponse.typeUrl || Params.isAmino(o.params)); + }, encode(message: QueryParamsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.params !== undefined) { Params.encode(message.params, writer.uint32(10).fork()).ldelim(); @@ -400,6 +420,12 @@ export const QueryParamsResponse = { typeUrl: "/osmosis.tokenfactory.v1beta1.QueryParamsResponse", value: QueryParamsResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryParamsResponse.typeUrl)) { + return; + } + Params.registerTypeUrl(); } }; function createBaseQueryDenomAuthorityMetadataRequest(): QueryDenomAuthorityMetadataRequest { @@ -417,6 +443,15 @@ function createBaseQueryDenomAuthorityMetadataRequest(): QueryDenomAuthorityMeta export const QueryDenomAuthorityMetadataRequest = { typeUrl: "/osmosis.tokenfactory.v1beta1.QueryDenomAuthorityMetadataRequest", aminoType: "osmosis/tokenfactory/query-denom-authority-metadata-request", + is(o: any): o is QueryDenomAuthorityMetadataRequest { + return o && (o.$typeUrl === QueryDenomAuthorityMetadataRequest.typeUrl || typeof o.denom === "string"); + }, + isSDK(o: any): o is QueryDenomAuthorityMetadataRequestSDKType { + return o && (o.$typeUrl === QueryDenomAuthorityMetadataRequest.typeUrl || typeof o.denom === "string"); + }, + isAmino(o: any): o is QueryDenomAuthorityMetadataRequestAmino { + return o && (o.$typeUrl === QueryDenomAuthorityMetadataRequest.typeUrl || typeof o.denom === "string"); + }, encode(message: QueryDenomAuthorityMetadataRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.denom !== "") { writer.uint32(10).string(message.denom); @@ -497,7 +532,8 @@ export const QueryDenomAuthorityMetadataRequest = { typeUrl: "/osmosis.tokenfactory.v1beta1.QueryDenomAuthorityMetadataRequest", value: QueryDenomAuthorityMetadataRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryDenomAuthorityMetadataResponse(): QueryDenomAuthorityMetadataResponse { return { @@ -514,6 +550,15 @@ function createBaseQueryDenomAuthorityMetadataResponse(): QueryDenomAuthorityMet export const QueryDenomAuthorityMetadataResponse = { typeUrl: "/osmosis.tokenfactory.v1beta1.QueryDenomAuthorityMetadataResponse", aminoType: "osmosis/tokenfactory/query-denom-authority-metadata-response", + is(o: any): o is QueryDenomAuthorityMetadataResponse { + return o && (o.$typeUrl === QueryDenomAuthorityMetadataResponse.typeUrl || DenomAuthorityMetadata.is(o.authorityMetadata)); + }, + isSDK(o: any): o is QueryDenomAuthorityMetadataResponseSDKType { + return o && (o.$typeUrl === QueryDenomAuthorityMetadataResponse.typeUrl || DenomAuthorityMetadata.isSDK(o.authority_metadata)); + }, + isAmino(o: any): o is QueryDenomAuthorityMetadataResponseAmino { + return o && (o.$typeUrl === QueryDenomAuthorityMetadataResponse.typeUrl || DenomAuthorityMetadata.isAmino(o.authority_metadata)); + }, encode(message: QueryDenomAuthorityMetadataResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.authorityMetadata !== undefined) { DenomAuthorityMetadata.encode(message.authorityMetadata, writer.uint32(10).fork()).ldelim(); @@ -596,6 +641,12 @@ export const QueryDenomAuthorityMetadataResponse = { typeUrl: "/osmosis.tokenfactory.v1beta1.QueryDenomAuthorityMetadataResponse", value: QueryDenomAuthorityMetadataResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryDenomAuthorityMetadataResponse.typeUrl)) { + return; + } + DenomAuthorityMetadata.registerTypeUrl(); } }; function createBaseQueryDenomsFromCreatorRequest(): QueryDenomsFromCreatorRequest { @@ -613,6 +664,15 @@ function createBaseQueryDenomsFromCreatorRequest(): QueryDenomsFromCreatorReques export const QueryDenomsFromCreatorRequest = { typeUrl: "/osmosis.tokenfactory.v1beta1.QueryDenomsFromCreatorRequest", aminoType: "osmosis/tokenfactory/query-denoms-from-creator-request", + is(o: any): o is QueryDenomsFromCreatorRequest { + return o && (o.$typeUrl === QueryDenomsFromCreatorRequest.typeUrl || typeof o.creator === "string"); + }, + isSDK(o: any): o is QueryDenomsFromCreatorRequestSDKType { + return o && (o.$typeUrl === QueryDenomsFromCreatorRequest.typeUrl || typeof o.creator === "string"); + }, + isAmino(o: any): o is QueryDenomsFromCreatorRequestAmino { + return o && (o.$typeUrl === QueryDenomsFromCreatorRequest.typeUrl || typeof o.creator === "string"); + }, encode(message: QueryDenomsFromCreatorRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.creator !== "") { writer.uint32(10).string(message.creator); @@ -693,7 +753,8 @@ export const QueryDenomsFromCreatorRequest = { typeUrl: "/osmosis.tokenfactory.v1beta1.QueryDenomsFromCreatorRequest", value: QueryDenomsFromCreatorRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryDenomsFromCreatorResponse(): QueryDenomsFromCreatorResponse { return { @@ -710,6 +771,15 @@ function createBaseQueryDenomsFromCreatorResponse(): QueryDenomsFromCreatorRespo export const QueryDenomsFromCreatorResponse = { typeUrl: "/osmosis.tokenfactory.v1beta1.QueryDenomsFromCreatorResponse", aminoType: "osmosis/tokenfactory/query-denoms-from-creator-response", + is(o: any): o is QueryDenomsFromCreatorResponse { + return o && (o.$typeUrl === QueryDenomsFromCreatorResponse.typeUrl || Array.isArray(o.denoms) && (!o.denoms.length || typeof o.denoms[0] === "string")); + }, + isSDK(o: any): o is QueryDenomsFromCreatorResponseSDKType { + return o && (o.$typeUrl === QueryDenomsFromCreatorResponse.typeUrl || Array.isArray(o.denoms) && (!o.denoms.length || typeof o.denoms[0] === "string")); + }, + isAmino(o: any): o is QueryDenomsFromCreatorResponseAmino { + return o && (o.$typeUrl === QueryDenomsFromCreatorResponse.typeUrl || Array.isArray(o.denoms) && (!o.denoms.length || typeof o.denoms[0] === "string")); + }, encode(message: QueryDenomsFromCreatorResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.denoms) { writer.uint32(10).string(v!); @@ -800,5 +870,6 @@ export const QueryDenomsFromCreatorResponse = { typeUrl: "/osmosis.tokenfactory.v1beta1.QueryDenomsFromCreatorResponse", value: QueryDenomsFromCreatorResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/osmosis/tokenfactory/v1beta1/tx.registry.ts b/__fixtures__/v-next/outputv2/osmosis/tokenfactory/v1beta1/tx.registry.ts index 9a5bce9295..682bbf0294 100644 --- a/__fixtures__/v-next/outputv2/osmosis/tokenfactory/v1beta1/tx.registry.ts +++ b/__fixtures__/v-next/outputv2/osmosis/tokenfactory/v1beta1/tx.registry.ts @@ -1,11 +1,6 @@ -import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { TelescopeGeneratedType } from "../../../types"; import { MsgCreateDenom, MsgMint, MsgBurn, MsgChangeAdmin, MsgSetDenomMetadata } from "./tx"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/osmosis.tokenfactory.v1beta1.MsgCreateDenom", MsgCreateDenom], ["/osmosis.tokenfactory.v1beta1.MsgMint", MsgMint], ["/osmosis.tokenfactory.v1beta1.MsgBurn", MsgBurn], ["/osmosis.tokenfactory.v1beta1.MsgChangeAdmin", MsgChangeAdmin], ["/osmosis.tokenfactory.v1beta1.MsgSetDenomMetadata", MsgSetDenomMetadata]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/osmosis.tokenfactory.v1beta1.MsgCreateDenom", MsgCreateDenom], ["/osmosis.tokenfactory.v1beta1.MsgMint", MsgMint], ["/osmosis.tokenfactory.v1beta1.MsgBurn", MsgBurn], ["/osmosis.tokenfactory.v1beta1.MsgChangeAdmin", MsgChangeAdmin], ["/osmosis.tokenfactory.v1beta1.MsgSetDenomMetadata", MsgSetDenomMetadata]]; export const MessageComposer = { encoded: { createDenom(value: MsgCreateDenom) { diff --git a/__fixtures__/v-next/outputv2/osmosis/tokenfactory/v1beta1/tx.rpc.func.ts b/__fixtures__/v-next/outputv2/osmosis/tokenfactory/v1beta1/tx.rpc.func.ts new file mode 100644 index 0000000000..3597e8f09f --- /dev/null +++ b/__fixtures__/v-next/outputv2/osmosis/tokenfactory/v1beta1/tx.rpc.func.ts @@ -0,0 +1,42 @@ +import { buildTx } from "../../../helper-func-types"; +import { MsgCreateDenom, MsgMint, MsgBurn, MsgChangeAdmin, MsgSetDenomMetadata } from "./tx"; +/** + * @name createDenom + * @package osmosis.tokenfactory.v1beta1 + * @see proto service: osmosis.tokenfactory.v1beta1.CreateDenom + */ +export const createDenom = buildTx({ + msg: MsgCreateDenom +}); +/** + * @name mint + * @package osmosis.tokenfactory.v1beta1 + * @see proto service: osmosis.tokenfactory.v1beta1.Mint + */ +export const mint = buildTx({ + msg: MsgMint +}); +/** + * @name burn + * @package osmosis.tokenfactory.v1beta1 + * @see proto service: osmosis.tokenfactory.v1beta1.Burn + */ +export const burn = buildTx({ + msg: MsgBurn +}); +/** + * @name changeAdmin + * @package osmosis.tokenfactory.v1beta1 + * @see proto service: osmosis.tokenfactory.v1beta1.ChangeAdmin + */ +export const changeAdmin = buildTx({ + msg: MsgChangeAdmin +}); +/** + * @name setDenomMetadata + * @package osmosis.tokenfactory.v1beta1 + * @see proto service: osmosis.tokenfactory.v1beta1.SetDenomMetadata + */ +export const setDenomMetadata = buildTx({ + msg: MsgSetDenomMetadata +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/osmosis/tokenfactory/v1beta1/tx.ts b/__fixtures__/v-next/outputv2/osmosis/tokenfactory/v1beta1/tx.ts index 98ac9a8a55..40d96b69ec 100644 --- a/__fixtures__/v-next/outputv2/osmosis/tokenfactory/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputv2/osmosis/tokenfactory/v1beta1/tx.ts @@ -3,6 +3,7 @@ import { Metadata, MetadataAmino, MetadataSDKType } from "../../../cosmos/bank/v import { BinaryReader, BinaryWriter } from "../../../binary"; import { isSet, DeepPartial } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "osmosis.tokenfactory.v1beta1"; /** * MsgCreateDenom defines the message structure for the CreateDenom gRPC service @@ -416,6 +417,15 @@ function createBaseMsgCreateDenom(): MsgCreateDenom { export const MsgCreateDenom = { typeUrl: "/osmosis.tokenfactory.v1beta1.MsgCreateDenom", aminoType: "osmosis/tokenfactory/create-denom", + is(o: any): o is MsgCreateDenom { + return o && (o.$typeUrl === MsgCreateDenom.typeUrl || typeof o.sender === "string" && typeof o.subdenom === "string"); + }, + isSDK(o: any): o is MsgCreateDenomSDKType { + return o && (o.$typeUrl === MsgCreateDenom.typeUrl || typeof o.sender === "string" && typeof o.subdenom === "string"); + }, + isAmino(o: any): o is MsgCreateDenomAmino { + return o && (o.$typeUrl === MsgCreateDenom.typeUrl || typeof o.sender === "string" && typeof o.subdenom === "string"); + }, encode(message: MsgCreateDenom, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.sender !== "") { writer.uint32(10).string(message.sender); @@ -511,7 +521,8 @@ export const MsgCreateDenom = { typeUrl: "/osmosis.tokenfactory.v1beta1.MsgCreateDenom", value: MsgCreateDenom.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgCreateDenomResponse(): MsgCreateDenomResponse { return { @@ -528,6 +539,15 @@ function createBaseMsgCreateDenomResponse(): MsgCreateDenomResponse { export const MsgCreateDenomResponse = { typeUrl: "/osmosis.tokenfactory.v1beta1.MsgCreateDenomResponse", aminoType: "osmosis/tokenfactory/create-denom-response", + is(o: any): o is MsgCreateDenomResponse { + return o && (o.$typeUrl === MsgCreateDenomResponse.typeUrl || typeof o.newTokenDenom === "string"); + }, + isSDK(o: any): o is MsgCreateDenomResponseSDKType { + return o && (o.$typeUrl === MsgCreateDenomResponse.typeUrl || typeof o.new_token_denom === "string"); + }, + isAmino(o: any): o is MsgCreateDenomResponseAmino { + return o && (o.$typeUrl === MsgCreateDenomResponse.typeUrl || typeof o.new_token_denom === "string"); + }, encode(message: MsgCreateDenomResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.newTokenDenom !== "") { writer.uint32(10).string(message.newTokenDenom); @@ -608,7 +628,8 @@ export const MsgCreateDenomResponse = { typeUrl: "/osmosis.tokenfactory.v1beta1.MsgCreateDenomResponse", value: MsgCreateDenomResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgMint(): MsgMint { return { @@ -626,6 +647,15 @@ function createBaseMsgMint(): MsgMint { export const MsgMint = { typeUrl: "/osmosis.tokenfactory.v1beta1.MsgMint", aminoType: "osmosis/tokenfactory/mint", + is(o: any): o is MsgMint { + return o && (o.$typeUrl === MsgMint.typeUrl || typeof o.sender === "string" && Coin.is(o.amount)); + }, + isSDK(o: any): o is MsgMintSDKType { + return o && (o.$typeUrl === MsgMint.typeUrl || typeof o.sender === "string" && Coin.isSDK(o.amount)); + }, + isAmino(o: any): o is MsgMintAmino { + return o && (o.$typeUrl === MsgMint.typeUrl || typeof o.sender === "string" && Coin.isAmino(o.amount)); + }, encode(message: MsgMint, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.sender !== "") { writer.uint32(10).string(message.sender); @@ -723,6 +753,12 @@ export const MsgMint = { typeUrl: "/osmosis.tokenfactory.v1beta1.MsgMint", value: MsgMint.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgMint.typeUrl)) { + return; + } + Coin.registerTypeUrl(); } }; function createBaseMsgMintResponse(): MsgMintResponse { @@ -736,6 +772,15 @@ function createBaseMsgMintResponse(): MsgMintResponse { export const MsgMintResponse = { typeUrl: "/osmosis.tokenfactory.v1beta1.MsgMintResponse", aminoType: "osmosis/tokenfactory/mint-response", + is(o: any): o is MsgMintResponse { + return o && o.$typeUrl === MsgMintResponse.typeUrl; + }, + isSDK(o: any): o is MsgMintResponseSDKType { + return o && o.$typeUrl === MsgMintResponse.typeUrl; + }, + isAmino(o: any): o is MsgMintResponseAmino { + return o && o.$typeUrl === MsgMintResponse.typeUrl; + }, encode(_: MsgMintResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -800,7 +845,8 @@ export const MsgMintResponse = { typeUrl: "/osmosis.tokenfactory.v1beta1.MsgMintResponse", value: MsgMintResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgBurn(): MsgBurn { return { @@ -818,6 +864,15 @@ function createBaseMsgBurn(): MsgBurn { export const MsgBurn = { typeUrl: "/osmosis.tokenfactory.v1beta1.MsgBurn", aminoType: "osmosis/tokenfactory/burn", + is(o: any): o is MsgBurn { + return o && (o.$typeUrl === MsgBurn.typeUrl || typeof o.sender === "string" && Coin.is(o.amount)); + }, + isSDK(o: any): o is MsgBurnSDKType { + return o && (o.$typeUrl === MsgBurn.typeUrl || typeof o.sender === "string" && Coin.isSDK(o.amount)); + }, + isAmino(o: any): o is MsgBurnAmino { + return o && (o.$typeUrl === MsgBurn.typeUrl || typeof o.sender === "string" && Coin.isAmino(o.amount)); + }, encode(message: MsgBurn, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.sender !== "") { writer.uint32(10).string(message.sender); @@ -915,6 +970,12 @@ export const MsgBurn = { typeUrl: "/osmosis.tokenfactory.v1beta1.MsgBurn", value: MsgBurn.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgBurn.typeUrl)) { + return; + } + Coin.registerTypeUrl(); } }; function createBaseMsgBurnResponse(): MsgBurnResponse { @@ -928,6 +989,15 @@ function createBaseMsgBurnResponse(): MsgBurnResponse { export const MsgBurnResponse = { typeUrl: "/osmosis.tokenfactory.v1beta1.MsgBurnResponse", aminoType: "osmosis/tokenfactory/burn-response", + is(o: any): o is MsgBurnResponse { + return o && o.$typeUrl === MsgBurnResponse.typeUrl; + }, + isSDK(o: any): o is MsgBurnResponseSDKType { + return o && o.$typeUrl === MsgBurnResponse.typeUrl; + }, + isAmino(o: any): o is MsgBurnResponseAmino { + return o && o.$typeUrl === MsgBurnResponse.typeUrl; + }, encode(_: MsgBurnResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -992,7 +1062,8 @@ export const MsgBurnResponse = { typeUrl: "/osmosis.tokenfactory.v1beta1.MsgBurnResponse", value: MsgBurnResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgChangeAdmin(): MsgChangeAdmin { return { @@ -1011,6 +1082,15 @@ function createBaseMsgChangeAdmin(): MsgChangeAdmin { export const MsgChangeAdmin = { typeUrl: "/osmosis.tokenfactory.v1beta1.MsgChangeAdmin", aminoType: "osmosis/tokenfactory/change-admin", + is(o: any): o is MsgChangeAdmin { + return o && (o.$typeUrl === MsgChangeAdmin.typeUrl || typeof o.sender === "string" && typeof o.denom === "string" && typeof o.newAdmin === "string"); + }, + isSDK(o: any): o is MsgChangeAdminSDKType { + return o && (o.$typeUrl === MsgChangeAdmin.typeUrl || typeof o.sender === "string" && typeof o.denom === "string" && typeof o.new_admin === "string"); + }, + isAmino(o: any): o is MsgChangeAdminAmino { + return o && (o.$typeUrl === MsgChangeAdmin.typeUrl || typeof o.sender === "string" && typeof o.denom === "string" && typeof o.new_admin === "string"); + }, encode(message: MsgChangeAdmin, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.sender !== "") { writer.uint32(10).string(message.sender); @@ -1121,7 +1201,8 @@ export const MsgChangeAdmin = { typeUrl: "/osmosis.tokenfactory.v1beta1.MsgChangeAdmin", value: MsgChangeAdmin.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgChangeAdminResponse(): MsgChangeAdminResponse { return {}; @@ -1136,6 +1217,15 @@ function createBaseMsgChangeAdminResponse(): MsgChangeAdminResponse { export const MsgChangeAdminResponse = { typeUrl: "/osmosis.tokenfactory.v1beta1.MsgChangeAdminResponse", aminoType: "osmosis/tokenfactory/change-admin-response", + is(o: any): o is MsgChangeAdminResponse { + return o && o.$typeUrl === MsgChangeAdminResponse.typeUrl; + }, + isSDK(o: any): o is MsgChangeAdminResponseSDKType { + return o && o.$typeUrl === MsgChangeAdminResponse.typeUrl; + }, + isAmino(o: any): o is MsgChangeAdminResponseAmino { + return o && o.$typeUrl === MsgChangeAdminResponse.typeUrl; + }, encode(_: MsgChangeAdminResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -1200,7 +1290,8 @@ export const MsgChangeAdminResponse = { typeUrl: "/osmosis.tokenfactory.v1beta1.MsgChangeAdminResponse", value: MsgChangeAdminResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgSetDenomMetadata(): MsgSetDenomMetadata { return { @@ -1218,6 +1309,15 @@ function createBaseMsgSetDenomMetadata(): MsgSetDenomMetadata { export const MsgSetDenomMetadata = { typeUrl: "/osmosis.tokenfactory.v1beta1.MsgSetDenomMetadata", aminoType: "osmosis/tokenfactory/set-denom-metadata", + is(o: any): o is MsgSetDenomMetadata { + return o && (o.$typeUrl === MsgSetDenomMetadata.typeUrl || typeof o.sender === "string" && Metadata.is(o.metadata)); + }, + isSDK(o: any): o is MsgSetDenomMetadataSDKType { + return o && (o.$typeUrl === MsgSetDenomMetadata.typeUrl || typeof o.sender === "string" && Metadata.isSDK(o.metadata)); + }, + isAmino(o: any): o is MsgSetDenomMetadataAmino { + return o && (o.$typeUrl === MsgSetDenomMetadata.typeUrl || typeof o.sender === "string" && Metadata.isAmino(o.metadata)); + }, encode(message: MsgSetDenomMetadata, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.sender !== "") { writer.uint32(10).string(message.sender); @@ -1315,6 +1415,12 @@ export const MsgSetDenomMetadata = { typeUrl: "/osmosis.tokenfactory.v1beta1.MsgSetDenomMetadata", value: MsgSetDenomMetadata.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgSetDenomMetadata.typeUrl)) { + return; + } + Metadata.registerTypeUrl(); } }; function createBaseMsgSetDenomMetadataResponse(): MsgSetDenomMetadataResponse { @@ -1330,6 +1436,15 @@ function createBaseMsgSetDenomMetadataResponse(): MsgSetDenomMetadataResponse { export const MsgSetDenomMetadataResponse = { typeUrl: "/osmosis.tokenfactory.v1beta1.MsgSetDenomMetadataResponse", aminoType: "osmosis/tokenfactory/set-denom-metadata-response", + is(o: any): o is MsgSetDenomMetadataResponse { + return o && o.$typeUrl === MsgSetDenomMetadataResponse.typeUrl; + }, + isSDK(o: any): o is MsgSetDenomMetadataResponseSDKType { + return o && o.$typeUrl === MsgSetDenomMetadataResponse.typeUrl; + }, + isAmino(o: any): o is MsgSetDenomMetadataResponseAmino { + return o && o.$typeUrl === MsgSetDenomMetadataResponse.typeUrl; + }, encode(_: MsgSetDenomMetadataResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -1394,5 +1509,6 @@ export const MsgSetDenomMetadataResponse = { typeUrl: "/osmosis.tokenfactory.v1beta1.MsgSetDenomMetadataResponse", value: MsgSetDenomMetadataResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/osmosis/twap/v1beta1/genesis.ts b/__fixtures__/v-next/outputv2/osmosis/twap/v1beta1/genesis.ts index 877d0a64ec..0e41310e38 100644 --- a/__fixtures__/v-next/outputv2/osmosis/twap/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv2/osmosis/twap/v1beta1/genesis.ts @@ -1,6 +1,7 @@ import { Duration, DurationAmino, DurationSDKType } from "../../../google/protobuf/duration"; import { TwapRecord, TwapRecordAmino, TwapRecordSDKType } from "./twap_record"; import { BinaryReader, BinaryWriter } from "../../../binary"; +import { GlobalDecoderRegistry } from "../../../registry"; import { isSet, DeepPartial } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "osmosis.twap.v1beta1"; @@ -107,6 +108,15 @@ function createBaseParams(): Params { export const Params = { typeUrl: "/osmosis.twap.v1beta1.Params", aminoType: "osmosis/twap/params", + is(o: any): o is Params { + return o && (o.$typeUrl === Params.typeUrl || typeof o.pruneEpochIdentifier === "string" && Duration.is(o.recordHistoryKeepPeriod)); + }, + isSDK(o: any): o is ParamsSDKType { + return o && (o.$typeUrl === Params.typeUrl || typeof o.prune_epoch_identifier === "string" && Duration.isSDK(o.record_history_keep_period)); + }, + isAmino(o: any): o is ParamsAmino { + return o && (o.$typeUrl === Params.typeUrl || typeof o.prune_epoch_identifier === "string" && Duration.isAmino(o.record_history_keep_period)); + }, encode(message: Params, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.pruneEpochIdentifier !== "") { writer.uint32(10).string(message.pruneEpochIdentifier); @@ -204,7 +214,8 @@ export const Params = { typeUrl: "/osmosis.twap.v1beta1.Params", value: Params.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseGenesisState(): GenesisState { return { @@ -221,6 +232,15 @@ function createBaseGenesisState(): GenesisState { export const GenesisState = { typeUrl: "/osmosis.twap.v1beta1.GenesisState", aminoType: "osmosis/twap/genesis-state", + is(o: any): o is GenesisState { + return o && (o.$typeUrl === GenesisState.typeUrl || Array.isArray(o.twaps) && (!o.twaps.length || TwapRecord.is(o.twaps[0])) && Params.is(o.params)); + }, + isSDK(o: any): o is GenesisStateSDKType { + return o && (o.$typeUrl === GenesisState.typeUrl || Array.isArray(o.twaps) && (!o.twaps.length || TwapRecord.isSDK(o.twaps[0])) && Params.isSDK(o.params)); + }, + isAmino(o: any): o is GenesisStateAmino { + return o && (o.$typeUrl === GenesisState.typeUrl || Array.isArray(o.twaps) && (!o.twaps.length || TwapRecord.isAmino(o.twaps[0])) && Params.isAmino(o.params)); + }, encode(message: GenesisState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.twaps) { TwapRecord.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -328,5 +348,12 @@ export const GenesisState = { typeUrl: "/osmosis.twap.v1beta1.GenesisState", value: GenesisState.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GenesisState.typeUrl)) { + return; + } + TwapRecord.registerTypeUrl(); + Params.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/osmosis/twap/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputv2/osmosis/twap/v1beta1/query.rpc.func.ts new file mode 100644 index 0000000000..4b0c9ef2f5 --- /dev/null +++ b/__fixtures__/v-next/outputv2/osmosis/twap/v1beta1/query.rpc.func.ts @@ -0,0 +1,39 @@ +import { buildQuery } from "../../../helper-func-types"; +import { ParamsRequest, ParamsResponse, ArithmeticTwapRequest, ArithmeticTwapResponse, ArithmeticTwapToNowRequest, ArithmeticTwapToNowResponse } from "./query"; +/** + * @name getParams + * @package osmosis.twap.v1beta1 + * @see proto service: osmosis.twap.v1beta1.Params + */ +export const getParams = buildQuery({ + encode: ParamsRequest.encode, + decode: ParamsResponse.decode, + service: "osmosis.twap.v1beta1.Query", + method: "Params", + deps: [ParamsRequest, ParamsResponse] +}); +/** + * @name getArithmeticTwap + * @package osmosis.twap.v1beta1 + * @see proto service: osmosis.twap.v1beta1.ArithmeticTwap + */ +export const getArithmeticTwap = buildQuery({ + encode: ArithmeticTwapRequest.encode, + decode: ArithmeticTwapResponse.decode, + service: "osmosis.twap.v1beta1.Query", + method: "ArithmeticTwap", + deps: [ArithmeticTwapRequest, ArithmeticTwapResponse] +}); +/** + * @name getArithmeticTwapToNow + * @package osmosis.twap.v1beta1 + * @see proto service: osmosis.twap.v1beta1.ArithmeticTwapToNow + * @deprecated + */ +export const getArithmeticTwapToNow = buildQuery({ + encode: ArithmeticTwapToNowRequest.encode, + decode: ArithmeticTwapToNowResponse.decode, + service: "osmosis.twap.v1beta1.Query", + method: "ArithmeticTwapToNow", + deps: [ArithmeticTwapToNowRequest, ArithmeticTwapToNowResponse] +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/osmosis/twap/v1beta1/query.ts b/__fixtures__/v-next/outputv2/osmosis/twap/v1beta1/query.ts index cb4a2aaf56..1f3e4ea0a3 100644 --- a/__fixtures__/v-next/outputv2/osmosis/twap/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv2/osmosis/twap/v1beta1/query.ts @@ -3,7 +3,8 @@ import { Params, ParamsAmino, ParamsSDKType } from "./genesis"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { toTimestamp, fromTimestamp, isSet, DeepPartial } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; -import { Decimal } from "@cosmjs/math"; +import { Decimal } from "@interchainjs/math"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "osmosis.twap.v1beta1"; /** * @name ArithmeticTwapRequest @@ -229,6 +230,15 @@ function createBaseArithmeticTwapRequest(): ArithmeticTwapRequest { export const ArithmeticTwapRequest = { typeUrl: "/osmosis.twap.v1beta1.ArithmeticTwapRequest", aminoType: "osmosis/twap/arithmetic-twap-request", + is(o: any): o is ArithmeticTwapRequest { + return o && (o.$typeUrl === ArithmeticTwapRequest.typeUrl || typeof o.poolId === "bigint" && typeof o.baseAsset === "string" && typeof o.quoteAsset === "string" && Timestamp.is(o.startTime)); + }, + isSDK(o: any): o is ArithmeticTwapRequestSDKType { + return o && (o.$typeUrl === ArithmeticTwapRequest.typeUrl || typeof o.pool_id === "bigint" && typeof o.base_asset === "string" && typeof o.quote_asset === "string" && Timestamp.isSDK(o.start_time)); + }, + isAmino(o: any): o is ArithmeticTwapRequestAmino { + return o && (o.$typeUrl === ArithmeticTwapRequest.typeUrl || typeof o.pool_id === "bigint" && typeof o.base_asset === "string" && typeof o.quote_asset === "string" && Timestamp.isAmino(o.start_time)); + }, encode(message: ArithmeticTwapRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.poolId !== BigInt(0)) { writer.uint32(8).uint64(message.poolId); @@ -371,7 +381,8 @@ export const ArithmeticTwapRequest = { typeUrl: "/osmosis.twap.v1beta1.ArithmeticTwapRequest", value: ArithmeticTwapRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseArithmeticTwapResponse(): ArithmeticTwapResponse { return { @@ -386,6 +397,15 @@ function createBaseArithmeticTwapResponse(): ArithmeticTwapResponse { export const ArithmeticTwapResponse = { typeUrl: "/osmosis.twap.v1beta1.ArithmeticTwapResponse", aminoType: "osmosis/twap/arithmetic-twap-response", + is(o: any): o is ArithmeticTwapResponse { + return o && (o.$typeUrl === ArithmeticTwapResponse.typeUrl || typeof o.arithmeticTwap === "string"); + }, + isSDK(o: any): o is ArithmeticTwapResponseSDKType { + return o && (o.$typeUrl === ArithmeticTwapResponse.typeUrl || typeof o.arithmetic_twap === "string"); + }, + isAmino(o: any): o is ArithmeticTwapResponseAmino { + return o && (o.$typeUrl === ArithmeticTwapResponse.typeUrl || typeof o.arithmetic_twap === "string"); + }, encode(message: ArithmeticTwapResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.arithmeticTwap !== "") { writer.uint32(10).string(Decimal.fromUserInput(message.arithmeticTwap, 18).atomics); @@ -443,7 +463,7 @@ export const ArithmeticTwapResponse = { }, toAmino(message: ArithmeticTwapResponse): ArithmeticTwapResponseAmino { const obj: any = {}; - obj.arithmetic_twap = message.arithmeticTwap === "" ? undefined : message.arithmeticTwap; + obj.arithmetic_twap = message.arithmeticTwap === "" ? undefined : Decimal.fromUserInput(message.arithmeticTwap, 18).atomics; return obj; }, fromAminoMsg(object: ArithmeticTwapResponseAminoMsg): ArithmeticTwapResponse { @@ -466,7 +486,8 @@ export const ArithmeticTwapResponse = { typeUrl: "/osmosis.twap.v1beta1.ArithmeticTwapResponse", value: ArithmeticTwapResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseArithmeticTwapToNowRequest(): ArithmeticTwapToNowRequest { return { @@ -484,6 +505,15 @@ function createBaseArithmeticTwapToNowRequest(): ArithmeticTwapToNowRequest { export const ArithmeticTwapToNowRequest = { typeUrl: "/osmosis.twap.v1beta1.ArithmeticTwapToNowRequest", aminoType: "osmosis/twap/arithmetic-twap-to-now-request", + is(o: any): o is ArithmeticTwapToNowRequest { + return o && (o.$typeUrl === ArithmeticTwapToNowRequest.typeUrl || typeof o.poolId === "bigint" && typeof o.baseAsset === "string" && typeof o.quoteAsset === "string" && Timestamp.is(o.startTime)); + }, + isSDK(o: any): o is ArithmeticTwapToNowRequestSDKType { + return o && (o.$typeUrl === ArithmeticTwapToNowRequest.typeUrl || typeof o.pool_id === "bigint" && typeof o.base_asset === "string" && typeof o.quote_asset === "string" && Timestamp.isSDK(o.start_time)); + }, + isAmino(o: any): o is ArithmeticTwapToNowRequestAmino { + return o && (o.$typeUrl === ArithmeticTwapToNowRequest.typeUrl || typeof o.pool_id === "bigint" && typeof o.base_asset === "string" && typeof o.quote_asset === "string" && Timestamp.isAmino(o.start_time)); + }, encode(message: ArithmeticTwapToNowRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.poolId !== BigInt(0)) { writer.uint32(8).uint64(message.poolId); @@ -611,7 +641,8 @@ export const ArithmeticTwapToNowRequest = { typeUrl: "/osmosis.twap.v1beta1.ArithmeticTwapToNowRequest", value: ArithmeticTwapToNowRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseArithmeticTwapToNowResponse(): ArithmeticTwapToNowResponse { return { @@ -626,6 +657,15 @@ function createBaseArithmeticTwapToNowResponse(): ArithmeticTwapToNowResponse { export const ArithmeticTwapToNowResponse = { typeUrl: "/osmosis.twap.v1beta1.ArithmeticTwapToNowResponse", aminoType: "osmosis/twap/arithmetic-twap-to-now-response", + is(o: any): o is ArithmeticTwapToNowResponse { + return o && (o.$typeUrl === ArithmeticTwapToNowResponse.typeUrl || typeof o.arithmeticTwap === "string"); + }, + isSDK(o: any): o is ArithmeticTwapToNowResponseSDKType { + return o && (o.$typeUrl === ArithmeticTwapToNowResponse.typeUrl || typeof o.arithmetic_twap === "string"); + }, + isAmino(o: any): o is ArithmeticTwapToNowResponseAmino { + return o && (o.$typeUrl === ArithmeticTwapToNowResponse.typeUrl || typeof o.arithmetic_twap === "string"); + }, encode(message: ArithmeticTwapToNowResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.arithmeticTwap !== "") { writer.uint32(10).string(Decimal.fromUserInput(message.arithmeticTwap, 18).atomics); @@ -683,7 +723,7 @@ export const ArithmeticTwapToNowResponse = { }, toAmino(message: ArithmeticTwapToNowResponse): ArithmeticTwapToNowResponseAmino { const obj: any = {}; - obj.arithmetic_twap = message.arithmeticTwap === "" ? undefined : message.arithmeticTwap; + obj.arithmetic_twap = message.arithmeticTwap === "" ? undefined : Decimal.fromUserInput(message.arithmeticTwap, 18).atomics; return obj; }, fromAminoMsg(object: ArithmeticTwapToNowResponseAminoMsg): ArithmeticTwapToNowResponse { @@ -706,7 +746,8 @@ export const ArithmeticTwapToNowResponse = { typeUrl: "/osmosis.twap.v1beta1.ArithmeticTwapToNowResponse", value: ArithmeticTwapToNowResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseParamsRequest(): ParamsRequest { return {}; @@ -719,6 +760,15 @@ function createBaseParamsRequest(): ParamsRequest { export const ParamsRequest = { typeUrl: "/osmosis.twap.v1beta1.ParamsRequest", aminoType: "osmosis/twap/params-request", + is(o: any): o is ParamsRequest { + return o && o.$typeUrl === ParamsRequest.typeUrl; + }, + isSDK(o: any): o is ParamsRequestSDKType { + return o && o.$typeUrl === ParamsRequest.typeUrl; + }, + isAmino(o: any): o is ParamsRequestAmino { + return o && o.$typeUrl === ParamsRequest.typeUrl; + }, encode(_: ParamsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -783,7 +833,8 @@ export const ParamsRequest = { typeUrl: "/osmosis.twap.v1beta1.ParamsRequest", value: ParamsRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseParamsResponse(): ParamsResponse { return { @@ -798,6 +849,15 @@ function createBaseParamsResponse(): ParamsResponse { export const ParamsResponse = { typeUrl: "/osmosis.twap.v1beta1.ParamsResponse", aminoType: "osmosis/twap/params-response", + is(o: any): o is ParamsResponse { + return o && (o.$typeUrl === ParamsResponse.typeUrl || Params.is(o.params)); + }, + isSDK(o: any): o is ParamsResponseSDKType { + return o && (o.$typeUrl === ParamsResponse.typeUrl || Params.isSDK(o.params)); + }, + isAmino(o: any): o is ParamsResponseAmino { + return o && (o.$typeUrl === ParamsResponse.typeUrl || Params.isAmino(o.params)); + }, encode(message: ParamsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.params !== undefined) { Params.encode(message.params, writer.uint32(10).fork()).ldelim(); @@ -880,5 +940,11 @@ export const ParamsResponse = { typeUrl: "/osmosis.twap.v1beta1.ParamsResponse", value: ParamsResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ParamsResponse.typeUrl)) { + return; + } + Params.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/osmosis/twap/v1beta1/twap_record.ts b/__fixtures__/v-next/outputv2/osmosis/twap/v1beta1/twap_record.ts index 6874a0c5ec..bc021a8d86 100644 --- a/__fixtures__/v-next/outputv2/osmosis/twap/v1beta1/twap_record.ts +++ b/__fixtures__/v-next/outputv2/osmosis/twap/v1beta1/twap_record.ts @@ -1,7 +1,7 @@ import { Timestamp } from "../../../google/protobuf/timestamp"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { toTimestamp, fromTimestamp, isSet, DeepPartial } from "../../../helpers"; -import { Decimal } from "@cosmjs/math"; +import { Decimal } from "@interchainjs/math"; import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "osmosis.twap.v1beta1"; /** @@ -157,6 +157,15 @@ function createBaseTwapRecord(): TwapRecord { export const TwapRecord = { typeUrl: "/osmosis.twap.v1beta1.TwapRecord", aminoType: "osmosis/twap/twap-record", + is(o: any): o is TwapRecord { + return o && (o.$typeUrl === TwapRecord.typeUrl || typeof o.poolId === "bigint" && typeof o.asset0Denom === "string" && typeof o.asset1Denom === "string" && typeof o.height === "bigint" && Timestamp.is(o.time) && typeof o.p0LastSpotPrice === "string" && typeof o.p1LastSpotPrice === "string" && typeof o.p0ArithmeticTwapAccumulator === "string" && typeof o.p1ArithmeticTwapAccumulator === "string" && Timestamp.is(o.lastErrorTime)); + }, + isSDK(o: any): o is TwapRecordSDKType { + return o && (o.$typeUrl === TwapRecord.typeUrl || typeof o.pool_id === "bigint" && typeof o.asset0_denom === "string" && typeof o.asset1_denom === "string" && typeof o.height === "bigint" && Timestamp.isSDK(o.time) && typeof o.p0_last_spot_price === "string" && typeof o.p1_last_spot_price === "string" && typeof o.p0_arithmetic_twap_accumulator === "string" && typeof o.p1_arithmetic_twap_accumulator === "string" && Timestamp.isSDK(o.last_error_time)); + }, + isAmino(o: any): o is TwapRecordAmino { + return o && (o.$typeUrl === TwapRecord.typeUrl || typeof o.pool_id === "bigint" && typeof o.asset0_denom === "string" && typeof o.asset1_denom === "string" && typeof o.height === "bigint" && Timestamp.isAmino(o.time) && typeof o.p0_last_spot_price === "string" && typeof o.p1_last_spot_price === "string" && typeof o.p0_arithmetic_twap_accumulator === "string" && typeof o.p1_arithmetic_twap_accumulator === "string" && Timestamp.isAmino(o.last_error_time)); + }, encode(message: TwapRecord, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.poolId !== BigInt(0)) { writer.uint32(8).uint64(message.poolId); @@ -349,10 +358,10 @@ export const TwapRecord = { obj.asset1_denom = message.asset1Denom === "" ? undefined : message.asset1Denom; obj.height = message.height ? message.height?.toString() : "0"; obj.time = message.time ? Timestamp.toAmino(toTimestamp(message.time)) : undefined; - obj.p0_last_spot_price = message.p0LastSpotPrice === "" ? undefined : message.p0LastSpotPrice; - obj.p1_last_spot_price = message.p1LastSpotPrice === "" ? undefined : message.p1LastSpotPrice; - obj.p0_arithmetic_twap_accumulator = message.p0ArithmeticTwapAccumulator === "" ? undefined : message.p0ArithmeticTwapAccumulator; - obj.p1_arithmetic_twap_accumulator = message.p1ArithmeticTwapAccumulator === "" ? undefined : message.p1ArithmeticTwapAccumulator; + obj.p0_last_spot_price = message.p0LastSpotPrice === "" ? undefined : Decimal.fromUserInput(message.p0LastSpotPrice, 18).atomics; + obj.p1_last_spot_price = message.p1LastSpotPrice === "" ? undefined : Decimal.fromUserInput(message.p1LastSpotPrice, 18).atomics; + obj.p0_arithmetic_twap_accumulator = message.p0ArithmeticTwapAccumulator === "" ? undefined : Decimal.fromUserInput(message.p0ArithmeticTwapAccumulator, 18).atomics; + obj.p1_arithmetic_twap_accumulator = message.p1ArithmeticTwapAccumulator === "" ? undefined : Decimal.fromUserInput(message.p1ArithmeticTwapAccumulator, 18).atomics; obj.last_error_time = message.lastErrorTime ? Timestamp.toAmino(toTimestamp(message.lastErrorTime)) : undefined; return obj; }, @@ -376,5 +385,6 @@ export const TwapRecord = { typeUrl: "/osmosis.twap.v1beta1.TwapRecord", value: TwapRecord.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/osmosis/txfees/v1beta1/feetoken.ts b/__fixtures__/v-next/outputv2/osmosis/txfees/v1beta1/feetoken.ts index b91187ea9d..8e526919ea 100644 --- a/__fixtures__/v-next/outputv2/osmosis/txfees/v1beta1/feetoken.ts +++ b/__fixtures__/v-next/outputv2/osmosis/txfees/v1beta1/feetoken.ts @@ -67,6 +67,15 @@ function createBaseFeeToken(): FeeToken { export const FeeToken = { typeUrl: "/osmosis.txfees.v1beta1.FeeToken", aminoType: "osmosis/txfees/fee-token", + is(o: any): o is FeeToken { + return o && (o.$typeUrl === FeeToken.typeUrl || typeof o.denom === "string" && typeof o.poolID === "bigint"); + }, + isSDK(o: any): o is FeeTokenSDKType { + return o && (o.$typeUrl === FeeToken.typeUrl || typeof o.denom === "string" && typeof o.poolID === "bigint"); + }, + isAmino(o: any): o is FeeTokenAmino { + return o && (o.$typeUrl === FeeToken.typeUrl || typeof o.denom === "string" && typeof o.poolID === "bigint"); + }, encode(message: FeeToken, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.denom !== "") { writer.uint32(10).string(message.denom); @@ -164,5 +173,6 @@ export const FeeToken = { typeUrl: "/osmosis.txfees.v1beta1.FeeToken", value: FeeToken.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/osmosis/txfees/v1beta1/genesis.ts b/__fixtures__/v-next/outputv2/osmosis/txfees/v1beta1/genesis.ts index cd30a27f0f..7f7f4c62c3 100644 --- a/__fixtures__/v-next/outputv2/osmosis/txfees/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv2/osmosis/txfees/v1beta1/genesis.ts @@ -2,6 +2,7 @@ import { FeeToken, FeeTokenAmino, FeeTokenSDKType } from "./feetoken"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { isSet, DeepPartial } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "osmosis.txfees.v1beta1"; /** * GenesisState defines the txfees module's genesis state. @@ -56,6 +57,15 @@ function createBaseGenesisState(): GenesisState { export const GenesisState = { typeUrl: "/osmosis.txfees.v1beta1.GenesisState", aminoType: "osmosis/txfees/genesis-state", + is(o: any): o is GenesisState { + return o && (o.$typeUrl === GenesisState.typeUrl || typeof o.basedenom === "string" && Array.isArray(o.feetokens) && (!o.feetokens.length || FeeToken.is(o.feetokens[0]))); + }, + isSDK(o: any): o is GenesisStateSDKType { + return o && (o.$typeUrl === GenesisState.typeUrl || typeof o.basedenom === "string" && Array.isArray(o.feetokens) && (!o.feetokens.length || FeeToken.isSDK(o.feetokens[0]))); + }, + isAmino(o: any): o is GenesisStateAmino { + return o && (o.$typeUrl === GenesisState.typeUrl || typeof o.basedenom === "string" && Array.isArray(o.feetokens) && (!o.feetokens.length || FeeToken.isAmino(o.feetokens[0]))); + }, encode(message: GenesisState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.basedenom !== "") { writer.uint32(10).string(message.basedenom); @@ -161,5 +171,11 @@ export const GenesisState = { typeUrl: "/osmosis.txfees.v1beta1.GenesisState", value: GenesisState.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GenesisState.typeUrl)) { + return; + } + FeeToken.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/osmosis/txfees/v1beta1/gov.ts b/__fixtures__/v-next/outputv2/osmosis/txfees/v1beta1/gov.ts index 0ed78eb0f5..6086fecf37 100644 --- a/__fixtures__/v-next/outputv2/osmosis/txfees/v1beta1/gov.ts +++ b/__fixtures__/v-next/outputv2/osmosis/txfees/v1beta1/gov.ts @@ -1,5 +1,6 @@ import { FeeToken, FeeTokenAmino, FeeTokenSDKType } from "./feetoken"; import { BinaryReader, BinaryWriter } from "../../../binary"; +import { GlobalDecoderRegistry } from "../../../registry"; import { isSet, DeepPartial } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "osmosis.txfees.v1beta1"; @@ -79,6 +80,15 @@ function createBaseUpdateFeeTokenProposal(): UpdateFeeTokenProposal { export const UpdateFeeTokenProposal = { typeUrl: "/osmosis.txfees.v1beta1.UpdateFeeTokenProposal", aminoType: "osmosis/txfees/update-fee-token-proposal", + is(o: any): o is UpdateFeeTokenProposal { + return o && (o.$typeUrl === UpdateFeeTokenProposal.typeUrl || typeof o.title === "string" && typeof o.description === "string" && FeeToken.is(o.feetoken)); + }, + isSDK(o: any): o is UpdateFeeTokenProposalSDKType { + return o && (o.$typeUrl === UpdateFeeTokenProposal.typeUrl || typeof o.title === "string" && typeof o.description === "string" && FeeToken.isSDK(o.feetoken)); + }, + isAmino(o: any): o is UpdateFeeTokenProposalAmino { + return o && (o.$typeUrl === UpdateFeeTokenProposal.typeUrl || typeof o.title === "string" && typeof o.description === "string" && FeeToken.isAmino(o.feetoken)); + }, encode(message: UpdateFeeTokenProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.title !== "") { writer.uint32(10).string(message.title); @@ -191,5 +201,13 @@ export const UpdateFeeTokenProposal = { typeUrl: "/osmosis.txfees.v1beta1.UpdateFeeTokenProposal", value: UpdateFeeTokenProposal.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(UpdateFeeTokenProposal.typeUrl)) { + return; + } + GlobalDecoderRegistry.register(UpdateFeeTokenProposal.typeUrl, UpdateFeeTokenProposal); + GlobalDecoderRegistry.registerAminoProtoMapping(UpdateFeeTokenProposal.aminoType, UpdateFeeTokenProposal.typeUrl); + FeeToken.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/osmosis/txfees/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputv2/osmosis/txfees/v1beta1/query.rpc.func.ts new file mode 100644 index 0000000000..8c6c44845f --- /dev/null +++ b/__fixtures__/v-next/outputv2/osmosis/txfees/v1beta1/query.rpc.func.ts @@ -0,0 +1,56 @@ +import { buildQuery } from "../../../helper-func-types"; +import { QueryFeeTokensRequest, QueryFeeTokensResponse, QueryDenomSpotPriceRequest, QueryDenomSpotPriceResponse, QueryDenomPoolIdRequest, QueryDenomPoolIdResponse, QueryBaseDenomRequest, QueryBaseDenomResponse } from "./query"; +/** + * FeeTokens returns a list of all the whitelisted fee tokens and their + * corresponding pools. It does not include the BaseDenom, which has its own + * query endpoint + * @name getFeeTokens + * @package osmosis.txfees.v1beta1 + * @see proto service: osmosis.txfees.v1beta1.FeeTokens + */ +export const getFeeTokens = buildQuery({ + encode: QueryFeeTokensRequest.encode, + decode: QueryFeeTokensResponse.decode, + service: "osmosis.txfees.v1beta1.Query", + method: "FeeTokens", + deps: [QueryFeeTokensRequest, QueryFeeTokensResponse] +}); +/** + * DenomSpotPrice returns all spot prices by each registered token denom. + * @name getDenomSpotPrice + * @package osmosis.txfees.v1beta1 + * @see proto service: osmosis.txfees.v1beta1.DenomSpotPrice + */ +export const getDenomSpotPrice = buildQuery({ + encode: QueryDenomSpotPriceRequest.encode, + decode: QueryDenomSpotPriceResponse.decode, + service: "osmosis.txfees.v1beta1.Query", + method: "DenomSpotPrice", + deps: [QueryDenomSpotPriceRequest, QueryDenomSpotPriceResponse] +}); +/** + * Returns the poolID for a specified denom input. + * @name getDenomPoolId + * @package osmosis.txfees.v1beta1 + * @see proto service: osmosis.txfees.v1beta1.DenomPoolId + */ +export const getDenomPoolId = buildQuery({ + encode: QueryDenomPoolIdRequest.encode, + decode: QueryDenomPoolIdResponse.decode, + service: "osmosis.txfees.v1beta1.Query", + method: "DenomPoolId", + deps: [QueryDenomPoolIdRequest, QueryDenomPoolIdResponse] +}); +/** + * Returns a list of all base denom tokens and their corresponding pools. + * @name getBaseDenom + * @package osmosis.txfees.v1beta1 + * @see proto service: osmosis.txfees.v1beta1.BaseDenom + */ +export const getBaseDenom = buildQuery({ + encode: QueryBaseDenomRequest.encode, + decode: QueryBaseDenomResponse.decode, + service: "osmosis.txfees.v1beta1.Query", + method: "BaseDenom", + deps: [QueryBaseDenomRequest, QueryBaseDenomResponse] +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/osmosis/txfees/v1beta1/query.ts b/__fixtures__/v-next/outputv2/osmosis/txfees/v1beta1/query.ts index df87d8cfcb..2379d4f75d 100644 --- a/__fixtures__/v-next/outputv2/osmosis/txfees/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv2/osmosis/txfees/v1beta1/query.ts @@ -2,7 +2,8 @@ import { FeeToken, FeeTokenAmino, FeeTokenSDKType } from "./feetoken"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { JsonSafe } from "../../../json-safe"; import { DeepPartial, isSet } from "../../../helpers"; -import { Decimal } from "@cosmjs/math"; +import { GlobalDecoderRegistry } from "../../../registry"; +import { Decimal } from "@interchainjs/math"; export const protobufPackage = "osmosis.txfees.v1beta1"; /** * @name QueryFeeTokensRequest @@ -274,6 +275,15 @@ function createBaseQueryFeeTokensRequest(): QueryFeeTokensRequest { export const QueryFeeTokensRequest = { typeUrl: "/osmosis.txfees.v1beta1.QueryFeeTokensRequest", aminoType: "osmosis/txfees/query-fee-tokens-request", + is(o: any): o is QueryFeeTokensRequest { + return o && o.$typeUrl === QueryFeeTokensRequest.typeUrl; + }, + isSDK(o: any): o is QueryFeeTokensRequestSDKType { + return o && o.$typeUrl === QueryFeeTokensRequest.typeUrl; + }, + isAmino(o: any): o is QueryFeeTokensRequestAmino { + return o && o.$typeUrl === QueryFeeTokensRequest.typeUrl; + }, encode(_: QueryFeeTokensRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -338,7 +348,8 @@ export const QueryFeeTokensRequest = { typeUrl: "/osmosis.txfees.v1beta1.QueryFeeTokensRequest", value: QueryFeeTokensRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryFeeTokensResponse(): QueryFeeTokensResponse { return { @@ -353,6 +364,15 @@ function createBaseQueryFeeTokensResponse(): QueryFeeTokensResponse { export const QueryFeeTokensResponse = { typeUrl: "/osmosis.txfees.v1beta1.QueryFeeTokensResponse", aminoType: "osmosis/txfees/query-fee-tokens-response", + is(o: any): o is QueryFeeTokensResponse { + return o && (o.$typeUrl === QueryFeeTokensResponse.typeUrl || Array.isArray(o.feeTokens) && (!o.feeTokens.length || FeeToken.is(o.feeTokens[0]))); + }, + isSDK(o: any): o is QueryFeeTokensResponseSDKType { + return o && (o.$typeUrl === QueryFeeTokensResponse.typeUrl || Array.isArray(o.fee_tokens) && (!o.fee_tokens.length || FeeToken.isSDK(o.fee_tokens[0]))); + }, + isAmino(o: any): o is QueryFeeTokensResponseAmino { + return o && (o.$typeUrl === QueryFeeTokensResponse.typeUrl || Array.isArray(o.fee_tokens) && (!o.fee_tokens.length || FeeToken.isAmino(o.fee_tokens[0]))); + }, encode(message: QueryFeeTokensResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.feeTokens) { FeeToken.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -443,6 +463,12 @@ export const QueryFeeTokensResponse = { typeUrl: "/osmosis.txfees.v1beta1.QueryFeeTokensResponse", value: QueryFeeTokensResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryFeeTokensResponse.typeUrl)) { + return; + } + FeeToken.registerTypeUrl(); } }; function createBaseQueryDenomSpotPriceRequest(): QueryDenomSpotPriceRequest { @@ -460,6 +486,15 @@ function createBaseQueryDenomSpotPriceRequest(): QueryDenomSpotPriceRequest { export const QueryDenomSpotPriceRequest = { typeUrl: "/osmosis.txfees.v1beta1.QueryDenomSpotPriceRequest", aminoType: "osmosis/txfees/query-denom-spot-price-request", + is(o: any): o is QueryDenomSpotPriceRequest { + return o && (o.$typeUrl === QueryDenomSpotPriceRequest.typeUrl || typeof o.denom === "string"); + }, + isSDK(o: any): o is QueryDenomSpotPriceRequestSDKType { + return o && (o.$typeUrl === QueryDenomSpotPriceRequest.typeUrl || typeof o.denom === "string"); + }, + isAmino(o: any): o is QueryDenomSpotPriceRequestAmino { + return o && (o.$typeUrl === QueryDenomSpotPriceRequest.typeUrl || typeof o.denom === "string"); + }, encode(message: QueryDenomSpotPriceRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.denom !== "") { writer.uint32(10).string(message.denom); @@ -540,7 +575,8 @@ export const QueryDenomSpotPriceRequest = { typeUrl: "/osmosis.txfees.v1beta1.QueryDenomSpotPriceRequest", value: QueryDenomSpotPriceRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryDenomSpotPriceResponse(): QueryDenomSpotPriceResponse { return { @@ -558,6 +594,15 @@ function createBaseQueryDenomSpotPriceResponse(): QueryDenomSpotPriceResponse { export const QueryDenomSpotPriceResponse = { typeUrl: "/osmosis.txfees.v1beta1.QueryDenomSpotPriceResponse", aminoType: "osmosis/txfees/query-denom-spot-price-response", + is(o: any): o is QueryDenomSpotPriceResponse { + return o && (o.$typeUrl === QueryDenomSpotPriceResponse.typeUrl || typeof o.poolID === "bigint" && typeof o.spotPrice === "string"); + }, + isSDK(o: any): o is QueryDenomSpotPriceResponseSDKType { + return o && (o.$typeUrl === QueryDenomSpotPriceResponse.typeUrl || typeof o.poolID === "bigint" && typeof o.spot_price === "string"); + }, + isAmino(o: any): o is QueryDenomSpotPriceResponseAmino { + return o && (o.$typeUrl === QueryDenomSpotPriceResponse.typeUrl || typeof o.poolID === "bigint" && typeof o.spot_price === "string"); + }, encode(message: QueryDenomSpotPriceResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.poolID !== BigInt(0)) { writer.uint32(8).uint64(message.poolID); @@ -632,7 +677,7 @@ export const QueryDenomSpotPriceResponse = { toAmino(message: QueryDenomSpotPriceResponse): QueryDenomSpotPriceResponseAmino { const obj: any = {}; obj.poolID = message.poolID !== BigInt(0) ? message.poolID?.toString() : undefined; - obj.spot_price = message.spotPrice === "" ? undefined : message.spotPrice; + obj.spot_price = message.spotPrice === "" ? undefined : Decimal.fromUserInput(message.spotPrice, 18).atomics; return obj; }, fromAminoMsg(object: QueryDenomSpotPriceResponseAminoMsg): QueryDenomSpotPriceResponse { @@ -655,7 +700,8 @@ export const QueryDenomSpotPriceResponse = { typeUrl: "/osmosis.txfees.v1beta1.QueryDenomSpotPriceResponse", value: QueryDenomSpotPriceResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryDenomPoolIdRequest(): QueryDenomPoolIdRequest { return { @@ -670,6 +716,15 @@ function createBaseQueryDenomPoolIdRequest(): QueryDenomPoolIdRequest { export const QueryDenomPoolIdRequest = { typeUrl: "/osmosis.txfees.v1beta1.QueryDenomPoolIdRequest", aminoType: "osmosis/txfees/query-denom-pool-id-request", + is(o: any): o is QueryDenomPoolIdRequest { + return o && (o.$typeUrl === QueryDenomPoolIdRequest.typeUrl || typeof o.denom === "string"); + }, + isSDK(o: any): o is QueryDenomPoolIdRequestSDKType { + return o && (o.$typeUrl === QueryDenomPoolIdRequest.typeUrl || typeof o.denom === "string"); + }, + isAmino(o: any): o is QueryDenomPoolIdRequestAmino { + return o && (o.$typeUrl === QueryDenomPoolIdRequest.typeUrl || typeof o.denom === "string"); + }, encode(message: QueryDenomPoolIdRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.denom !== "") { writer.uint32(10).string(message.denom); @@ -750,7 +805,8 @@ export const QueryDenomPoolIdRequest = { typeUrl: "/osmosis.txfees.v1beta1.QueryDenomPoolIdRequest", value: QueryDenomPoolIdRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryDenomPoolIdResponse(): QueryDenomPoolIdResponse { return { @@ -765,6 +821,15 @@ function createBaseQueryDenomPoolIdResponse(): QueryDenomPoolIdResponse { export const QueryDenomPoolIdResponse = { typeUrl: "/osmosis.txfees.v1beta1.QueryDenomPoolIdResponse", aminoType: "osmosis/txfees/query-denom-pool-id-response", + is(o: any): o is QueryDenomPoolIdResponse { + return o && (o.$typeUrl === QueryDenomPoolIdResponse.typeUrl || typeof o.poolID === "bigint"); + }, + isSDK(o: any): o is QueryDenomPoolIdResponseSDKType { + return o && (o.$typeUrl === QueryDenomPoolIdResponse.typeUrl || typeof o.poolID === "bigint"); + }, + isAmino(o: any): o is QueryDenomPoolIdResponseAmino { + return o && (o.$typeUrl === QueryDenomPoolIdResponse.typeUrl || typeof o.poolID === "bigint"); + }, encode(message: QueryDenomPoolIdResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.poolID !== BigInt(0)) { writer.uint32(8).uint64(message.poolID); @@ -847,7 +912,8 @@ export const QueryDenomPoolIdResponse = { typeUrl: "/osmosis.txfees.v1beta1.QueryDenomPoolIdResponse", value: QueryDenomPoolIdResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryBaseDenomRequest(): QueryBaseDenomRequest { return {}; @@ -860,6 +926,15 @@ function createBaseQueryBaseDenomRequest(): QueryBaseDenomRequest { export const QueryBaseDenomRequest = { typeUrl: "/osmosis.txfees.v1beta1.QueryBaseDenomRequest", aminoType: "osmosis/txfees/query-base-denom-request", + is(o: any): o is QueryBaseDenomRequest { + return o && o.$typeUrl === QueryBaseDenomRequest.typeUrl; + }, + isSDK(o: any): o is QueryBaseDenomRequestSDKType { + return o && o.$typeUrl === QueryBaseDenomRequest.typeUrl; + }, + isAmino(o: any): o is QueryBaseDenomRequestAmino { + return o && o.$typeUrl === QueryBaseDenomRequest.typeUrl; + }, encode(_: QueryBaseDenomRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -924,7 +999,8 @@ export const QueryBaseDenomRequest = { typeUrl: "/osmosis.txfees.v1beta1.QueryBaseDenomRequest", value: QueryBaseDenomRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryBaseDenomResponse(): QueryBaseDenomResponse { return { @@ -939,6 +1015,15 @@ function createBaseQueryBaseDenomResponse(): QueryBaseDenomResponse { export const QueryBaseDenomResponse = { typeUrl: "/osmosis.txfees.v1beta1.QueryBaseDenomResponse", aminoType: "osmosis/txfees/query-base-denom-response", + is(o: any): o is QueryBaseDenomResponse { + return o && (o.$typeUrl === QueryBaseDenomResponse.typeUrl || typeof o.baseDenom === "string"); + }, + isSDK(o: any): o is QueryBaseDenomResponseSDKType { + return o && (o.$typeUrl === QueryBaseDenomResponse.typeUrl || typeof o.base_denom === "string"); + }, + isAmino(o: any): o is QueryBaseDenomResponseAmino { + return o && (o.$typeUrl === QueryBaseDenomResponse.typeUrl || typeof o.base_denom === "string"); + }, encode(message: QueryBaseDenomResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.baseDenom !== "") { writer.uint32(10).string(message.baseDenom); @@ -1019,5 +1104,6 @@ export const QueryBaseDenomResponse = { typeUrl: "/osmosis.txfees.v1beta1.QueryBaseDenomResponse", value: QueryBaseDenomResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/registry.ts b/__fixtures__/v-next/outputv2/registry.ts new file mode 100644 index 0000000000..181b82b40e --- /dev/null +++ b/__fixtures__/v-next/outputv2/registry.ts @@ -0,0 +1,228 @@ +/** +* This file and any referenced files were automatically generated by @hyperweb/telescope@latest +* DO NOT MODIFY BY HAND. Instead, download the latest proto files for your chain +* and run the transpile command or npm scripts command that is used to regenerate this bundle. +*/ + +import { BinaryReader } from "./binary"; +import { Any, AnyAmino } from "./google/protobuf/any"; +import { IProtoType, TelescopeGeneratedCodec } from "./types"; + +export class GlobalDecoderRegistry { + static registry: { + [key: string]: TelescopeGeneratedCodec; + } = {}; + + static aminoProtoMapping: { + [key: string]: string; + } = {}; + + static existingTypeUrls: string[] = []; + + static registerExistingTypeUrl(typeUrl: string): boolean { + if (GlobalDecoderRegistry.existingTypeUrls.includes(typeUrl)) { + return false; + } + GlobalDecoderRegistry.existingTypeUrls.push(typeUrl); + return true; + } + + static registerAminoProtoMapping(aminoType: string, typeUrl: string) { + GlobalDecoderRegistry.aminoProtoMapping[aminoType] = typeUrl; + } + + static register( + key: string, + decoder: TelescopeGeneratedCodec + ) { + GlobalDecoderRegistry.registry[key] = decoder; + } + static getDecoder( + key: string + ): TelescopeGeneratedCodec { + return GlobalDecoderRegistry.registry[key]; + } + static getDecoderByInstance( + obj: unknown + ): TelescopeGeneratedCodec | null { + if (obj === undefined || obj === null) { + return null; + } + const protoType = obj as IProtoType; + + if (protoType.$typeUrl) { + return GlobalDecoderRegistry.getDecoder( + protoType.$typeUrl + ); + } + + for (const key in GlobalDecoderRegistry.registry) { + if ( + Object.prototype.hasOwnProperty.call( + GlobalDecoderRegistry.registry, + key + ) + ) { + const element = GlobalDecoderRegistry.registry[key]; + + if (element.is!(obj)) { + return element; + } + + if (element.isSDK && element.isSDK(obj)) { + return element; + } + + if (element.isAmino && element.isAmino(obj)) { + return element; + } + } + } + + return null; + } + static getDecoderByAminoType( + type: string + ): TelescopeGeneratedCodec | null { + if (type === undefined || type === null) { + return null; + } + + const typeUrl = GlobalDecoderRegistry.aminoProtoMapping[type]; + + if (!typeUrl) { + return null; + } + + return GlobalDecoderRegistry.getDecoder(typeUrl); + } + static wrapAny(obj: unknown): Any { + if(Any.is(obj)){ + return obj; + } + + const decoder = getDecoderByInstance(obj); + + return { + typeUrl: decoder.typeUrl, + value: decoder.encode(obj).finish(), + }; + } + static unwrapAny(input: BinaryReader | Uint8Array | Any) { + let data; + + if (Any.is(input)) { + data = input; + } else { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + + data = Any.decode(reader, reader.uint32()); + } + + const decoder = GlobalDecoderRegistry.getDecoder( + data.typeUrl + ); + + if (!decoder) { + return data; + } + + return decoder.decode(data.value); + } + static fromJSON(object: any): T { + const decoder = getDecoderByInstance(object); + return decoder.fromJSON!(object); + } + static toJSON(message: T): any { + const decoder = getDecoderByInstance(message); + return decoder.toJSON!(message); + } + static fromPartial(object: unknown): T { + const decoder = getDecoderByInstance(object); + return decoder ? decoder.fromPartial(object) : (object as T); + } + static fromSDK(object: SDK): T { + const decoder = getDecoderByInstance(object); + return decoder.fromSDK!(object); + } + static fromSDKJSON(object: any): SDK { + const decoder = getDecoderByInstance(object); + return decoder.fromSDKJSON!(object); + } + static toSDK(object: T): SDK { + const decoder = getDecoderByInstance(object); + return decoder.toSDK!(object); + } + static fromAmino(object: Amino): T { + const decoder = getDecoderByInstance(object); + return decoder.fromAmino!(object); + } + static fromAminoMsg(object: AnyAmino): T { + const decoder = GlobalDecoderRegistry.getDecoderByAminoType< + T, + unknown, + Amino + >(object.type); + + if (!decoder) { + throw new Error(`There's no decoder for the amino type ${object.type}`); + } + + return decoder.fromAminoMsg!(object); + } + static toAmino(object: T): Amino { + let data: any; + let decoder: TelescopeGeneratedCodec; + if (Any.is(object)) { + data = GlobalDecoderRegistry.unwrapAny(object); + + decoder = GlobalDecoderRegistry.getDecoder(object.typeUrl); + + if (!decoder) { + decoder = Any; + } + } else { + data = object; + decoder = getDecoderByInstance(object); + } + + return decoder.toAmino!(data); + } + static toAminoMsg(object: T): AnyAmino { + let data: any; + let decoder: TelescopeGeneratedCodec; + if (Any.is(object)) { + data = GlobalDecoderRegistry.unwrapAny(object); + + decoder = GlobalDecoderRegistry.getDecoder(object.typeUrl); + + if (!decoder) { + decoder = Any; + } + } else { + data = object; + decoder = getDecoderByInstance(object); + } + + return decoder.toAminoMsg!(data); + } +} + +function getDecoderByInstance( + obj: unknown +): TelescopeGeneratedCodec { + const decoder = GlobalDecoderRegistry.getDecoderByInstance( + obj + ); + + if (!decoder) { + throw new Error( + `There's no decoder for the instance ${JSON.stringify(obj)}` + ); + } + + return decoder; +} + +GlobalDecoderRegistry.register(Any.typeUrl, Any); diff --git a/__fixtures__/v-next/outputv2/tendermint/abci/types.rpc.func.ts b/__fixtures__/v-next/outputv2/tendermint/abci/types.rpc.func.ts new file mode 100644 index 0000000000..8b611cc46c --- /dev/null +++ b/__fixtures__/v-next/outputv2/tendermint/abci/types.rpc.func.ts @@ -0,0 +1,182 @@ +import { buildQuery } from "../../helper-func-types"; +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"; +/** + * @name getEcho + * @package tendermint.abci + * @see proto service: tendermint.abci.Echo + */ +export const getEcho = buildQuery({ + encode: RequestEcho.encode, + decode: ResponseEcho.decode, + service: "tendermint.abci.ABCIApplication", + method: "Echo", + deps: [RequestEcho, ResponseEcho] +}); +/** + * @name getFlush + * @package tendermint.abci + * @see proto service: tendermint.abci.Flush + */ +export const getFlush = buildQuery({ + encode: RequestFlush.encode, + decode: ResponseFlush.decode, + service: "tendermint.abci.ABCIApplication", + method: "Flush", + deps: [RequestFlush, ResponseFlush] +}); +/** + * @name getInfo + * @package tendermint.abci + * @see proto service: tendermint.abci.Info + */ +export const getInfo = buildQuery({ + encode: RequestInfo.encode, + decode: ResponseInfo.decode, + service: "tendermint.abci.ABCIApplication", + method: "Info", + deps: [RequestInfo, ResponseInfo] +}); +/** + * @name getSetOption + * @package tendermint.abci + * @see proto service: tendermint.abci.SetOption + */ +export const getSetOption = buildQuery({ + encode: RequestSetOption.encode, + decode: ResponseSetOption.decode, + service: "tendermint.abci.ABCIApplication", + method: "SetOption", + deps: [RequestSetOption, ResponseSetOption] +}); +/** + * @name getDeliverTx + * @package tendermint.abci + * @see proto service: tendermint.abci.DeliverTx + */ +export const getDeliverTx = buildQuery({ + encode: RequestDeliverTx.encode, + decode: ResponseDeliverTx.decode, + service: "tendermint.abci.ABCIApplication", + method: "DeliverTx", + deps: [RequestDeliverTx, ResponseDeliverTx] +}); +/** + * @name getCheckTx + * @package tendermint.abci + * @see proto service: tendermint.abci.CheckTx + */ +export const getCheckTx = buildQuery({ + encode: RequestCheckTx.encode, + decode: ResponseCheckTx.decode, + service: "tendermint.abci.ABCIApplication", + method: "CheckTx", + deps: [RequestCheckTx, ResponseCheckTx] +}); +/** + * @name getQuery + * @package tendermint.abci + * @see proto service: tendermint.abci.Query + */ +export const getQuery = buildQuery({ + encode: RequestQuery.encode, + decode: ResponseQuery.decode, + service: "tendermint.abci.ABCIApplication", + method: "Query", + deps: [RequestQuery, ResponseQuery] +}); +/** + * @name getCommit + * @package tendermint.abci + * @see proto service: tendermint.abci.Commit + */ +export const getCommit = buildQuery({ + encode: RequestCommit.encode, + decode: ResponseCommit.decode, + service: "tendermint.abci.ABCIApplication", + method: "Commit", + deps: [RequestCommit, ResponseCommit] +}); +/** + * @name getInitChain + * @package tendermint.abci + * @see proto service: tendermint.abci.InitChain + */ +export const getInitChain = buildQuery({ + encode: RequestInitChain.encode, + decode: ResponseInitChain.decode, + service: "tendermint.abci.ABCIApplication", + method: "InitChain", + deps: [RequestInitChain, ResponseInitChain] +}); +/** + * @name getBeginBlock + * @package tendermint.abci + * @see proto service: tendermint.abci.BeginBlock + */ +export const getBeginBlock = buildQuery({ + encode: RequestBeginBlock.encode, + decode: ResponseBeginBlock.decode, + service: "tendermint.abci.ABCIApplication", + method: "BeginBlock", + deps: [RequestBeginBlock, ResponseBeginBlock] +}); +/** + * @name getEndBlock + * @package tendermint.abci + * @see proto service: tendermint.abci.EndBlock + */ +export const getEndBlock = buildQuery({ + encode: RequestEndBlock.encode, + decode: ResponseEndBlock.decode, + service: "tendermint.abci.ABCIApplication", + method: "EndBlock", + deps: [RequestEndBlock, ResponseEndBlock] +}); +/** + * @name getListSnapshots + * @package tendermint.abci + * @see proto service: tendermint.abci.ListSnapshots + */ +export const getListSnapshots = buildQuery({ + encode: RequestListSnapshots.encode, + decode: ResponseListSnapshots.decode, + service: "tendermint.abci.ABCIApplication", + method: "ListSnapshots", + deps: [RequestListSnapshots, ResponseListSnapshots] +}); +/** + * @name getOfferSnapshot + * @package tendermint.abci + * @see proto service: tendermint.abci.OfferSnapshot + */ +export const getOfferSnapshot = buildQuery({ + encode: RequestOfferSnapshot.encode, + decode: ResponseOfferSnapshot.decode, + service: "tendermint.abci.ABCIApplication", + method: "OfferSnapshot", + deps: [RequestOfferSnapshot, ResponseOfferSnapshot] +}); +/** + * @name getLoadSnapshotChunk + * @package tendermint.abci + * @see proto service: tendermint.abci.LoadSnapshotChunk + */ +export const getLoadSnapshotChunk = buildQuery({ + encode: RequestLoadSnapshotChunk.encode, + decode: ResponseLoadSnapshotChunk.decode, + service: "tendermint.abci.ABCIApplication", + method: "LoadSnapshotChunk", + deps: [RequestLoadSnapshotChunk, ResponseLoadSnapshotChunk] +}); +/** + * @name getApplySnapshotChunk + * @package tendermint.abci + * @see proto service: tendermint.abci.ApplySnapshotChunk + */ +export const getApplySnapshotChunk = buildQuery({ + encode: RequestApplySnapshotChunk.encode, + decode: ResponseApplySnapshotChunk.decode, + service: "tendermint.abci.ABCIApplication", + method: "ApplySnapshotChunk", + deps: [RequestApplySnapshotChunk, ResponseApplySnapshotChunk] +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/tendermint/abci/types.ts b/__fixtures__/v-next/outputv2/tendermint/abci/types.ts index 5d96a7ad80..79e0c8deb1 100644 --- a/__fixtures__/v-next/outputv2/tendermint/abci/types.ts +++ b/__fixtures__/v-next/outputv2/tendermint/abci/types.ts @@ -4,6 +4,7 @@ import { ProofOps, ProofOpsAmino, ProofOpsSDKType } from "../crypto/proof"; import { EvidenceParams, EvidenceParamsAmino, EvidenceParamsSDKType, ValidatorParams, ValidatorParamsAmino, ValidatorParamsSDKType, VersionParams, VersionParamsAmino, VersionParamsSDKType } from "../types/params"; import { PublicKey, PublicKeyAmino, PublicKeySDKType } from "../crypto/keys"; import { BinaryReader, BinaryWriter } from "../../binary"; +import { GlobalDecoderRegistry } from "../../registry"; import { isSet, DeepPartial, toTimestamp, fromTimestamp, bytesFromBase64, base64FromBytes } from "../../helpers"; import { JsonSafe } from "../../json-safe"; export const protobufPackage = "tendermint.abci"; @@ -2149,6 +2150,15 @@ function createBaseRequest(): Request { */ export const Request = { typeUrl: "/tendermint.abci.Request", + is(o: any): o is Request { + return o && o.$typeUrl === Request.typeUrl; + }, + isSDK(o: any): o is RequestSDKType { + return o && o.$typeUrl === Request.typeUrl; + }, + isAmino(o: any): o is RequestAmino { + return o && o.$typeUrl === Request.typeUrl; + }, encode(message: Request, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.echo !== undefined) { RequestEcho.encode(message.echo, writer.uint32(10).fork()).ldelim(); @@ -2463,6 +2473,26 @@ export const Request = { typeUrl: "/tendermint.abci.Request", value: Request.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Request.typeUrl)) { + return; + } + RequestEcho.registerTypeUrl(); + RequestFlush.registerTypeUrl(); + RequestInfo.registerTypeUrl(); + RequestSetOption.registerTypeUrl(); + RequestInitChain.registerTypeUrl(); + RequestQuery.registerTypeUrl(); + RequestBeginBlock.registerTypeUrl(); + RequestCheckTx.registerTypeUrl(); + RequestDeliverTx.registerTypeUrl(); + RequestEndBlock.registerTypeUrl(); + RequestCommit.registerTypeUrl(); + RequestListSnapshots.registerTypeUrl(); + RequestOfferSnapshot.registerTypeUrl(); + RequestLoadSnapshotChunk.registerTypeUrl(); + RequestApplySnapshotChunk.registerTypeUrl(); } }; function createBaseRequestEcho(): RequestEcho { @@ -2477,6 +2507,15 @@ function createBaseRequestEcho(): RequestEcho { */ export const RequestEcho = { typeUrl: "/tendermint.abci.RequestEcho", + is(o: any): o is RequestEcho { + return o && (o.$typeUrl === RequestEcho.typeUrl || typeof o.message === "string"); + }, + isSDK(o: any): o is RequestEchoSDKType { + return o && (o.$typeUrl === RequestEcho.typeUrl || typeof o.message === "string"); + }, + isAmino(o: any): o is RequestEchoAmino { + return o && (o.$typeUrl === RequestEcho.typeUrl || typeof o.message === "string"); + }, encode(message: RequestEcho, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.message !== "") { writer.uint32(10).string(message.message); @@ -2551,7 +2590,8 @@ export const RequestEcho = { typeUrl: "/tendermint.abci.RequestEcho", value: RequestEcho.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseRequestFlush(): RequestFlush { return {}; @@ -2563,6 +2603,15 @@ function createBaseRequestFlush(): RequestFlush { */ export const RequestFlush = { typeUrl: "/tendermint.abci.RequestFlush", + is(o: any): o is RequestFlush { + return o && o.$typeUrl === RequestFlush.typeUrl; + }, + isSDK(o: any): o is RequestFlushSDKType { + return o && o.$typeUrl === RequestFlush.typeUrl; + }, + isAmino(o: any): o is RequestFlushAmino { + return o && o.$typeUrl === RequestFlush.typeUrl; + }, encode(_: RequestFlush, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -2621,7 +2670,8 @@ export const RequestFlush = { typeUrl: "/tendermint.abci.RequestFlush", value: RequestFlush.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseRequestInfo(): RequestInfo { return { @@ -2637,6 +2687,15 @@ function createBaseRequestInfo(): RequestInfo { */ export const RequestInfo = { typeUrl: "/tendermint.abci.RequestInfo", + is(o: any): o is RequestInfo { + return o && (o.$typeUrl === RequestInfo.typeUrl || typeof o.version === "string" && typeof o.blockVersion === "bigint" && typeof o.p2pVersion === "bigint"); + }, + isSDK(o: any): o is RequestInfoSDKType { + return o && (o.$typeUrl === RequestInfo.typeUrl || typeof o.version === "string" && typeof o.block_version === "bigint" && typeof o.p2p_version === "bigint"); + }, + isAmino(o: any): o is RequestInfoAmino { + return o && (o.$typeUrl === RequestInfo.typeUrl || typeof o.version === "string" && typeof o.block_version === "bigint" && typeof o.p2p_version === "bigint"); + }, encode(message: RequestInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.version !== "") { writer.uint32(10).string(message.version); @@ -2745,7 +2804,8 @@ export const RequestInfo = { typeUrl: "/tendermint.abci.RequestInfo", value: RequestInfo.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseRequestSetOption(): RequestSetOption { return { @@ -2761,6 +2821,15 @@ function createBaseRequestSetOption(): RequestSetOption { */ export const RequestSetOption = { typeUrl: "/tendermint.abci.RequestSetOption", + is(o: any): o is RequestSetOption { + return o && (o.$typeUrl === RequestSetOption.typeUrl || typeof o.key === "string" && typeof o.value === "string"); + }, + isSDK(o: any): o is RequestSetOptionSDKType { + return o && (o.$typeUrl === RequestSetOption.typeUrl || typeof o.key === "string" && typeof o.value === "string"); + }, + isAmino(o: any): o is RequestSetOptionAmino { + return o && (o.$typeUrl === RequestSetOption.typeUrl || typeof o.key === "string" && typeof o.value === "string"); + }, encode(message: RequestSetOption, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.key !== "") { writer.uint32(10).string(message.key); @@ -2850,7 +2919,8 @@ export const RequestSetOption = { typeUrl: "/tendermint.abci.RequestSetOption", value: RequestSetOption.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseRequestInitChain(): RequestInitChain { return { @@ -2869,6 +2939,15 @@ function createBaseRequestInitChain(): RequestInitChain { */ export const RequestInitChain = { typeUrl: "/tendermint.abci.RequestInitChain", + is(o: any): o is RequestInitChain { + return o && (o.$typeUrl === RequestInitChain.typeUrl || Timestamp.is(o.time) && typeof o.chainId === "string" && Array.isArray(o.validators) && (!o.validators.length || ValidatorUpdate.is(o.validators[0])) && (o.appStateBytes instanceof Uint8Array || typeof o.appStateBytes === "string") && typeof o.initialHeight === "bigint"); + }, + isSDK(o: any): o is RequestInitChainSDKType { + return o && (o.$typeUrl === RequestInitChain.typeUrl || Timestamp.isSDK(o.time) && typeof o.chain_id === "string" && Array.isArray(o.validators) && (!o.validators.length || ValidatorUpdate.isSDK(o.validators[0])) && (o.app_state_bytes instanceof Uint8Array || typeof o.app_state_bytes === "string") && typeof o.initial_height === "bigint"); + }, + isAmino(o: any): o is RequestInitChainAmino { + return o && (o.$typeUrl === RequestInitChain.typeUrl || Timestamp.isAmino(o.time) && typeof o.chain_id === "string" && Array.isArray(o.validators) && (!o.validators.length || ValidatorUpdate.isAmino(o.validators[0])) && (o.app_state_bytes instanceof Uint8Array || typeof o.app_state_bytes === "string") && typeof o.initial_height === "bigint"); + }, encode(message: RequestInitChain, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.time !== undefined) { Timestamp.encode(toTimestamp(message.time), writer.uint32(10).fork()).ldelim(); @@ -3032,6 +3111,13 @@ export const RequestInitChain = { typeUrl: "/tendermint.abci.RequestInitChain", value: RequestInitChain.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(RequestInitChain.typeUrl)) { + return; + } + ConsensusParams.registerTypeUrl(); + ValidatorUpdate.registerTypeUrl(); } }; function createBaseRequestQuery(): RequestQuery { @@ -3049,6 +3135,15 @@ function createBaseRequestQuery(): RequestQuery { */ export const RequestQuery = { typeUrl: "/tendermint.abci.RequestQuery", + is(o: any): o is RequestQuery { + return o && (o.$typeUrl === RequestQuery.typeUrl || (o.data instanceof Uint8Array || typeof o.data === "string") && typeof o.path === "string" && typeof o.height === "bigint" && typeof o.prove === "boolean"); + }, + isSDK(o: any): o is RequestQuerySDKType { + return o && (o.$typeUrl === RequestQuery.typeUrl || (o.data instanceof Uint8Array || typeof o.data === "string") && typeof o.path === "string" && typeof o.height === "bigint" && typeof o.prove === "boolean"); + }, + isAmino(o: any): o is RequestQueryAmino { + return o && (o.$typeUrl === RequestQuery.typeUrl || (o.data instanceof Uint8Array || typeof o.data === "string") && typeof o.path === "string" && typeof o.height === "bigint" && typeof o.prove === "boolean"); + }, encode(message: RequestQuery, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.data.length !== 0) { writer.uint32(10).bytes(message.data); @@ -3170,7 +3265,8 @@ export const RequestQuery = { typeUrl: "/tendermint.abci.RequestQuery", value: RequestQuery.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseRequestBeginBlock(): RequestBeginBlock { return { @@ -3187,6 +3283,15 @@ function createBaseRequestBeginBlock(): RequestBeginBlock { */ export const RequestBeginBlock = { typeUrl: "/tendermint.abci.RequestBeginBlock", + is(o: any): o is RequestBeginBlock { + return o && (o.$typeUrl === RequestBeginBlock.typeUrl || (o.hash instanceof Uint8Array || typeof o.hash === "string") && Header.is(o.header) && LastCommitInfo.is(o.lastCommitInfo) && Array.isArray(o.byzantineValidators) && (!o.byzantineValidators.length || Evidence.is(o.byzantineValidators[0]))); + }, + isSDK(o: any): o is RequestBeginBlockSDKType { + return o && (o.$typeUrl === RequestBeginBlock.typeUrl || (o.hash instanceof Uint8Array || typeof o.hash === "string") && Header.isSDK(o.header) && LastCommitInfo.isSDK(o.last_commit_info) && Array.isArray(o.byzantine_validators) && (!o.byzantine_validators.length || Evidence.isSDK(o.byzantine_validators[0]))); + }, + isAmino(o: any): o is RequestBeginBlockAmino { + return o && (o.$typeUrl === RequestBeginBlock.typeUrl || (o.hash instanceof Uint8Array || typeof o.hash === "string") && Header.isAmino(o.header) && LastCommitInfo.isAmino(o.last_commit_info) && Array.isArray(o.byzantine_validators) && (!o.byzantine_validators.length || Evidence.isAmino(o.byzantine_validators[0]))); + }, encode(message: RequestBeginBlock, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.hash.length !== 0) { writer.uint32(10).bytes(message.hash); @@ -3320,6 +3425,14 @@ export const RequestBeginBlock = { typeUrl: "/tendermint.abci.RequestBeginBlock", value: RequestBeginBlock.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(RequestBeginBlock.typeUrl)) { + return; + } + Header.registerTypeUrl(); + LastCommitInfo.registerTypeUrl(); + Evidence.registerTypeUrl(); } }; function createBaseRequestCheckTx(): RequestCheckTx { @@ -3335,6 +3448,15 @@ function createBaseRequestCheckTx(): RequestCheckTx { */ export const RequestCheckTx = { typeUrl: "/tendermint.abci.RequestCheckTx", + is(o: any): o is RequestCheckTx { + return o && (o.$typeUrl === RequestCheckTx.typeUrl || (o.tx instanceof Uint8Array || typeof o.tx === "string") && isSet(o.type)); + }, + isSDK(o: any): o is RequestCheckTxSDKType { + return o && (o.$typeUrl === RequestCheckTx.typeUrl || (o.tx instanceof Uint8Array || typeof o.tx === "string") && isSet(o.type)); + }, + isAmino(o: any): o is RequestCheckTxAmino { + return o && (o.$typeUrl === RequestCheckTx.typeUrl || (o.tx instanceof Uint8Array || typeof o.tx === "string") && isSet(o.type)); + }, encode(message: RequestCheckTx, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.tx.length !== 0) { writer.uint32(10).bytes(message.tx); @@ -3424,7 +3546,8 @@ export const RequestCheckTx = { typeUrl: "/tendermint.abci.RequestCheckTx", value: RequestCheckTx.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseRequestDeliverTx(): RequestDeliverTx { return { @@ -3438,6 +3561,15 @@ function createBaseRequestDeliverTx(): RequestDeliverTx { */ export const RequestDeliverTx = { typeUrl: "/tendermint.abci.RequestDeliverTx", + is(o: any): o is RequestDeliverTx { + return o && (o.$typeUrl === RequestDeliverTx.typeUrl || o.tx instanceof Uint8Array || typeof o.tx === "string"); + }, + isSDK(o: any): o is RequestDeliverTxSDKType { + return o && (o.$typeUrl === RequestDeliverTx.typeUrl || o.tx instanceof Uint8Array || typeof o.tx === "string"); + }, + isAmino(o: any): o is RequestDeliverTxAmino { + return o && (o.$typeUrl === RequestDeliverTx.typeUrl || o.tx instanceof Uint8Array || typeof o.tx === "string"); + }, encode(message: RequestDeliverTx, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.tx.length !== 0) { writer.uint32(10).bytes(message.tx); @@ -3512,7 +3644,8 @@ export const RequestDeliverTx = { typeUrl: "/tendermint.abci.RequestDeliverTx", value: RequestDeliverTx.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseRequestEndBlock(): RequestEndBlock { return { @@ -3526,6 +3659,15 @@ function createBaseRequestEndBlock(): RequestEndBlock { */ export const RequestEndBlock = { typeUrl: "/tendermint.abci.RequestEndBlock", + is(o: any): o is RequestEndBlock { + return o && (o.$typeUrl === RequestEndBlock.typeUrl || typeof o.height === "bigint"); + }, + isSDK(o: any): o is RequestEndBlockSDKType { + return o && (o.$typeUrl === RequestEndBlock.typeUrl || typeof o.height === "bigint"); + }, + isAmino(o: any): o is RequestEndBlockAmino { + return o && (o.$typeUrl === RequestEndBlock.typeUrl || typeof o.height === "bigint"); + }, encode(message: RequestEndBlock, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.height !== BigInt(0)) { writer.uint32(8).int64(message.height); @@ -3602,7 +3744,8 @@ export const RequestEndBlock = { typeUrl: "/tendermint.abci.RequestEndBlock", value: RequestEndBlock.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseRequestCommit(): RequestCommit { return {}; @@ -3614,6 +3757,15 @@ function createBaseRequestCommit(): RequestCommit { */ export const RequestCommit = { typeUrl: "/tendermint.abci.RequestCommit", + is(o: any): o is RequestCommit { + return o && o.$typeUrl === RequestCommit.typeUrl; + }, + isSDK(o: any): o is RequestCommitSDKType { + return o && o.$typeUrl === RequestCommit.typeUrl; + }, + isAmino(o: any): o is RequestCommitAmino { + return o && o.$typeUrl === RequestCommit.typeUrl; + }, encode(_: RequestCommit, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -3672,7 +3824,8 @@ export const RequestCommit = { typeUrl: "/tendermint.abci.RequestCommit", value: RequestCommit.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseRequestListSnapshots(): RequestListSnapshots { return {}; @@ -3685,6 +3838,15 @@ function createBaseRequestListSnapshots(): RequestListSnapshots { */ export const RequestListSnapshots = { typeUrl: "/tendermint.abci.RequestListSnapshots", + is(o: any): o is RequestListSnapshots { + return o && o.$typeUrl === RequestListSnapshots.typeUrl; + }, + isSDK(o: any): o is RequestListSnapshotsSDKType { + return o && o.$typeUrl === RequestListSnapshots.typeUrl; + }, + isAmino(o: any): o is RequestListSnapshotsAmino { + return o && o.$typeUrl === RequestListSnapshots.typeUrl; + }, encode(_: RequestListSnapshots, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -3743,7 +3905,8 @@ export const RequestListSnapshots = { typeUrl: "/tendermint.abci.RequestListSnapshots", value: RequestListSnapshots.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseRequestOfferSnapshot(): RequestOfferSnapshot { return { @@ -3759,6 +3922,15 @@ function createBaseRequestOfferSnapshot(): RequestOfferSnapshot { */ export const RequestOfferSnapshot = { typeUrl: "/tendermint.abci.RequestOfferSnapshot", + is(o: any): o is RequestOfferSnapshot { + return o && (o.$typeUrl === RequestOfferSnapshot.typeUrl || o.appHash instanceof Uint8Array || typeof o.appHash === "string"); + }, + isSDK(o: any): o is RequestOfferSnapshotSDKType { + return o && (o.$typeUrl === RequestOfferSnapshot.typeUrl || o.app_hash instanceof Uint8Array || typeof o.app_hash === "string"); + }, + isAmino(o: any): o is RequestOfferSnapshotAmino { + return o && (o.$typeUrl === RequestOfferSnapshot.typeUrl || o.app_hash instanceof Uint8Array || typeof o.app_hash === "string"); + }, encode(message: RequestOfferSnapshot, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.snapshot !== undefined) { Snapshot.encode(message.snapshot, writer.uint32(10).fork()).ldelim(); @@ -3850,6 +4022,12 @@ export const RequestOfferSnapshot = { typeUrl: "/tendermint.abci.RequestOfferSnapshot", value: RequestOfferSnapshot.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(RequestOfferSnapshot.typeUrl)) { + return; + } + Snapshot.registerTypeUrl(); } }; function createBaseRequestLoadSnapshotChunk(): RequestLoadSnapshotChunk { @@ -3867,6 +4045,15 @@ function createBaseRequestLoadSnapshotChunk(): RequestLoadSnapshotChunk { */ export const RequestLoadSnapshotChunk = { typeUrl: "/tendermint.abci.RequestLoadSnapshotChunk", + is(o: any): o is RequestLoadSnapshotChunk { + return o && (o.$typeUrl === RequestLoadSnapshotChunk.typeUrl || typeof o.height === "bigint" && typeof o.format === "number" && typeof o.chunk === "number"); + }, + isSDK(o: any): o is RequestLoadSnapshotChunkSDKType { + return o && (o.$typeUrl === RequestLoadSnapshotChunk.typeUrl || typeof o.height === "bigint" && typeof o.format === "number" && typeof o.chunk === "number"); + }, + isAmino(o: any): o is RequestLoadSnapshotChunkAmino { + return o && (o.$typeUrl === RequestLoadSnapshotChunk.typeUrl || typeof o.height === "bigint" && typeof o.format === "number" && typeof o.chunk === "number"); + }, encode(message: RequestLoadSnapshotChunk, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.height !== BigInt(0)) { writer.uint32(8).uint64(message.height); @@ -3973,7 +4160,8 @@ export const RequestLoadSnapshotChunk = { typeUrl: "/tendermint.abci.RequestLoadSnapshotChunk", value: RequestLoadSnapshotChunk.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseRequestApplySnapshotChunk(): RequestApplySnapshotChunk { return { @@ -3990,6 +4178,15 @@ function createBaseRequestApplySnapshotChunk(): RequestApplySnapshotChunk { */ export const RequestApplySnapshotChunk = { typeUrl: "/tendermint.abci.RequestApplySnapshotChunk", + is(o: any): o is RequestApplySnapshotChunk { + return o && (o.$typeUrl === RequestApplySnapshotChunk.typeUrl || typeof o.index === "number" && (o.chunk instanceof Uint8Array || typeof o.chunk === "string") && typeof o.sender === "string"); + }, + isSDK(o: any): o is RequestApplySnapshotChunkSDKType { + return o && (o.$typeUrl === RequestApplySnapshotChunk.typeUrl || typeof o.index === "number" && (o.chunk instanceof Uint8Array || typeof o.chunk === "string") && typeof o.sender === "string"); + }, + isAmino(o: any): o is RequestApplySnapshotChunkAmino { + return o && (o.$typeUrl === RequestApplySnapshotChunk.typeUrl || typeof o.index === "number" && (o.chunk instanceof Uint8Array || typeof o.chunk === "string") && typeof o.sender === "string"); + }, encode(message: RequestApplySnapshotChunk, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.index !== 0) { writer.uint32(8).uint32(message.index); @@ -4094,7 +4291,8 @@ export const RequestApplySnapshotChunk = { typeUrl: "/tendermint.abci.RequestApplySnapshotChunk", value: RequestApplySnapshotChunk.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseResponse(): Response { return { @@ -4123,6 +4321,15 @@ function createBaseResponse(): Response { */ export const Response = { typeUrl: "/tendermint.abci.Response", + is(o: any): o is Response { + return o && o.$typeUrl === Response.typeUrl; + }, + isSDK(o: any): o is ResponseSDKType { + return o && o.$typeUrl === Response.typeUrl; + }, + isAmino(o: any): o is ResponseAmino { + return o && o.$typeUrl === Response.typeUrl; + }, encode(message: Response, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.exception !== undefined) { ResponseException.encode(message.exception, writer.uint32(10).fork()).ldelim(); @@ -4454,6 +4661,27 @@ export const Response = { typeUrl: "/tendermint.abci.Response", value: Response.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Response.typeUrl)) { + return; + } + ResponseException.registerTypeUrl(); + ResponseEcho.registerTypeUrl(); + ResponseFlush.registerTypeUrl(); + ResponseInfo.registerTypeUrl(); + ResponseSetOption.registerTypeUrl(); + ResponseInitChain.registerTypeUrl(); + ResponseQuery.registerTypeUrl(); + ResponseBeginBlock.registerTypeUrl(); + ResponseCheckTx.registerTypeUrl(); + ResponseDeliverTx.registerTypeUrl(); + ResponseEndBlock.registerTypeUrl(); + ResponseCommit.registerTypeUrl(); + ResponseListSnapshots.registerTypeUrl(); + ResponseOfferSnapshot.registerTypeUrl(); + ResponseLoadSnapshotChunk.registerTypeUrl(); + ResponseApplySnapshotChunk.registerTypeUrl(); } }; function createBaseResponseException(): ResponseException { @@ -4469,6 +4697,15 @@ function createBaseResponseException(): ResponseException { */ export const ResponseException = { typeUrl: "/tendermint.abci.ResponseException", + is(o: any): o is ResponseException { + return o && (o.$typeUrl === ResponseException.typeUrl || typeof o.error === "string"); + }, + isSDK(o: any): o is ResponseExceptionSDKType { + return o && (o.$typeUrl === ResponseException.typeUrl || typeof o.error === "string"); + }, + isAmino(o: any): o is ResponseExceptionAmino { + return o && (o.$typeUrl === ResponseException.typeUrl || typeof o.error === "string"); + }, encode(message: ResponseException, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.error !== "") { writer.uint32(10).string(message.error); @@ -4543,7 +4780,8 @@ export const ResponseException = { typeUrl: "/tendermint.abci.ResponseException", value: ResponseException.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseResponseEcho(): ResponseEcho { return { @@ -4557,6 +4795,15 @@ function createBaseResponseEcho(): ResponseEcho { */ export const ResponseEcho = { typeUrl: "/tendermint.abci.ResponseEcho", + is(o: any): o is ResponseEcho { + return o && (o.$typeUrl === ResponseEcho.typeUrl || typeof o.message === "string"); + }, + isSDK(o: any): o is ResponseEchoSDKType { + return o && (o.$typeUrl === ResponseEcho.typeUrl || typeof o.message === "string"); + }, + isAmino(o: any): o is ResponseEchoAmino { + return o && (o.$typeUrl === ResponseEcho.typeUrl || typeof o.message === "string"); + }, encode(message: ResponseEcho, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.message !== "") { writer.uint32(10).string(message.message); @@ -4631,7 +4878,8 @@ export const ResponseEcho = { typeUrl: "/tendermint.abci.ResponseEcho", value: ResponseEcho.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseResponseFlush(): ResponseFlush { return {}; @@ -4643,6 +4891,15 @@ function createBaseResponseFlush(): ResponseFlush { */ export const ResponseFlush = { typeUrl: "/tendermint.abci.ResponseFlush", + is(o: any): o is ResponseFlush { + return o && o.$typeUrl === ResponseFlush.typeUrl; + }, + isSDK(o: any): o is ResponseFlushSDKType { + return o && o.$typeUrl === ResponseFlush.typeUrl; + }, + isAmino(o: any): o is ResponseFlushAmino { + return o && o.$typeUrl === ResponseFlush.typeUrl; + }, encode(_: ResponseFlush, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -4701,7 +4958,8 @@ export const ResponseFlush = { typeUrl: "/tendermint.abci.ResponseFlush", value: ResponseFlush.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseResponseInfo(): ResponseInfo { return { @@ -4719,6 +4977,15 @@ function createBaseResponseInfo(): ResponseInfo { */ export const ResponseInfo = { typeUrl: "/tendermint.abci.ResponseInfo", + is(o: any): o is ResponseInfo { + return o && (o.$typeUrl === ResponseInfo.typeUrl || typeof o.data === "string" && typeof o.version === "string" && typeof o.appVersion === "bigint" && typeof o.lastBlockHeight === "bigint" && (o.lastBlockAppHash instanceof Uint8Array || typeof o.lastBlockAppHash === "string")); + }, + isSDK(o: any): o is ResponseInfoSDKType { + return o && (o.$typeUrl === ResponseInfo.typeUrl || typeof o.data === "string" && typeof o.version === "string" && typeof o.app_version === "bigint" && typeof o.last_block_height === "bigint" && (o.last_block_app_hash instanceof Uint8Array || typeof o.last_block_app_hash === "string")); + }, + isAmino(o: any): o is ResponseInfoAmino { + return o && (o.$typeUrl === ResponseInfo.typeUrl || typeof o.data === "string" && typeof o.version === "string" && typeof o.app_version === "bigint" && typeof o.last_block_height === "bigint" && (o.last_block_app_hash instanceof Uint8Array || typeof o.last_block_app_hash === "string")); + }, encode(message: ResponseInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.data !== "") { writer.uint32(10).string(message.data); @@ -4857,7 +5124,8 @@ export const ResponseInfo = { typeUrl: "/tendermint.abci.ResponseInfo", value: ResponseInfo.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseResponseSetOption(): ResponseSetOption { return { @@ -4874,6 +5142,15 @@ function createBaseResponseSetOption(): ResponseSetOption { */ export const ResponseSetOption = { typeUrl: "/tendermint.abci.ResponseSetOption", + is(o: any): o is ResponseSetOption { + return o && (o.$typeUrl === ResponseSetOption.typeUrl || typeof o.code === "number" && typeof o.log === "string" && typeof o.info === "string"); + }, + isSDK(o: any): o is ResponseSetOptionSDKType { + return o && (o.$typeUrl === ResponseSetOption.typeUrl || typeof o.code === "number" && typeof o.log === "string" && typeof o.info === "string"); + }, + isAmino(o: any): o is ResponseSetOptionAmino { + return o && (o.$typeUrl === ResponseSetOption.typeUrl || typeof o.code === "number" && typeof o.log === "string" && typeof o.info === "string"); + }, encode(message: ResponseSetOption, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.code !== 0) { writer.uint32(8).uint32(message.code); @@ -4978,7 +5255,8 @@ export const ResponseSetOption = { typeUrl: "/tendermint.abci.ResponseSetOption", value: ResponseSetOption.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseResponseInitChain(): ResponseInitChain { return { @@ -4994,6 +5272,15 @@ function createBaseResponseInitChain(): ResponseInitChain { */ export const ResponseInitChain = { typeUrl: "/tendermint.abci.ResponseInitChain", + is(o: any): o is ResponseInitChain { + return o && (o.$typeUrl === ResponseInitChain.typeUrl || Array.isArray(o.validators) && (!o.validators.length || ValidatorUpdate.is(o.validators[0])) && (o.appHash instanceof Uint8Array || typeof o.appHash === "string")); + }, + isSDK(o: any): o is ResponseInitChainSDKType { + return o && (o.$typeUrl === ResponseInitChain.typeUrl || Array.isArray(o.validators) && (!o.validators.length || ValidatorUpdate.isSDK(o.validators[0])) && (o.app_hash instanceof Uint8Array || typeof o.app_hash === "string")); + }, + isAmino(o: any): o is ResponseInitChainAmino { + return o && (o.$typeUrl === ResponseInitChain.typeUrl || Array.isArray(o.validators) && (!o.validators.length || ValidatorUpdate.isAmino(o.validators[0])) && (o.app_hash instanceof Uint8Array || typeof o.app_hash === "string")); + }, encode(message: ResponseInitChain, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.consensusParams !== undefined) { ConsensusParams.encode(message.consensusParams, writer.uint32(10).fork()).ldelim(); @@ -5110,6 +5397,13 @@ export const ResponseInitChain = { typeUrl: "/tendermint.abci.ResponseInitChain", value: ResponseInitChain.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ResponseInitChain.typeUrl)) { + return; + } + ConsensusParams.registerTypeUrl(); + ValidatorUpdate.registerTypeUrl(); } }; function createBaseResponseQuery(): ResponseQuery { @@ -5132,6 +5426,15 @@ function createBaseResponseQuery(): ResponseQuery { */ export const ResponseQuery = { typeUrl: "/tendermint.abci.ResponseQuery", + is(o: any): o is ResponseQuery { + return o && (o.$typeUrl === ResponseQuery.typeUrl || typeof o.code === "number" && typeof o.log === "string" && typeof o.info === "string" && typeof o.index === "bigint" && (o.key instanceof Uint8Array || typeof o.key === "string") && (o.value instanceof Uint8Array || typeof o.value === "string") && typeof o.height === "bigint" && typeof o.codespace === "string"); + }, + isSDK(o: any): o is ResponseQuerySDKType { + return o && (o.$typeUrl === ResponseQuery.typeUrl || typeof o.code === "number" && typeof o.log === "string" && typeof o.info === "string" && typeof o.index === "bigint" && (o.key instanceof Uint8Array || typeof o.key === "string") && (o.value instanceof Uint8Array || typeof o.value === "string") && typeof o.height === "bigint" && typeof o.codespace === "string"); + }, + isAmino(o: any): o is ResponseQueryAmino { + return o && (o.$typeUrl === ResponseQuery.typeUrl || typeof o.code === "number" && typeof o.log === "string" && typeof o.info === "string" && typeof o.index === "bigint" && (o.key instanceof Uint8Array || typeof o.key === "string") && (o.value instanceof Uint8Array || typeof o.value === "string") && typeof o.height === "bigint" && typeof o.codespace === "string"); + }, encode(message: ResponseQuery, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.code !== 0) { writer.uint32(8).uint32(message.code); @@ -5332,6 +5635,12 @@ export const ResponseQuery = { typeUrl: "/tendermint.abci.ResponseQuery", value: ResponseQuery.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ResponseQuery.typeUrl)) { + return; + } + ProofOps.registerTypeUrl(); } }; function createBaseResponseBeginBlock(): ResponseBeginBlock { @@ -5346,6 +5655,15 @@ function createBaseResponseBeginBlock(): ResponseBeginBlock { */ export const ResponseBeginBlock = { typeUrl: "/tendermint.abci.ResponseBeginBlock", + is(o: any): o is ResponseBeginBlock { + return o && (o.$typeUrl === ResponseBeginBlock.typeUrl || Array.isArray(o.events) && (!o.events.length || Event.is(o.events[0]))); + }, + isSDK(o: any): o is ResponseBeginBlockSDKType { + return o && (o.$typeUrl === ResponseBeginBlock.typeUrl || Array.isArray(o.events) && (!o.events.length || Event.isSDK(o.events[0]))); + }, + isAmino(o: any): o is ResponseBeginBlockAmino { + return o && (o.$typeUrl === ResponseBeginBlock.typeUrl || Array.isArray(o.events) && (!o.events.length || Event.isAmino(o.events[0]))); + }, encode(message: ResponseBeginBlock, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.events) { Event.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -5430,6 +5748,12 @@ export const ResponseBeginBlock = { typeUrl: "/tendermint.abci.ResponseBeginBlock", value: ResponseBeginBlock.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ResponseBeginBlock.typeUrl)) { + return; + } + Event.registerTypeUrl(); } }; function createBaseResponseCheckTx(): ResponseCheckTx { @@ -5451,6 +5775,15 @@ function createBaseResponseCheckTx(): ResponseCheckTx { */ export const ResponseCheckTx = { typeUrl: "/tendermint.abci.ResponseCheckTx", + is(o: any): o is ResponseCheckTx { + return o && (o.$typeUrl === ResponseCheckTx.typeUrl || typeof o.code === "number" && (o.data instanceof Uint8Array || typeof o.data === "string") && typeof o.log === "string" && typeof o.info === "string" && typeof o.gasWanted === "bigint" && typeof o.gasUsed === "bigint" && Array.isArray(o.events) && (!o.events.length || Event.is(o.events[0])) && typeof o.codespace === "string"); + }, + isSDK(o: any): o is ResponseCheckTxSDKType { + return o && (o.$typeUrl === ResponseCheckTx.typeUrl || typeof o.code === "number" && (o.data instanceof Uint8Array || typeof o.data === "string") && typeof o.log === "string" && typeof o.info === "string" && typeof o.gas_wanted === "bigint" && typeof o.gas_used === "bigint" && Array.isArray(o.events) && (!o.events.length || Event.isSDK(o.events[0])) && typeof o.codespace === "string"); + }, + isAmino(o: any): o is ResponseCheckTxAmino { + return o && (o.$typeUrl === ResponseCheckTx.typeUrl || typeof o.code === "number" && (o.data instanceof Uint8Array || typeof o.data === "string") && typeof o.log === "string" && typeof o.info === "string" && typeof o.gas_wanted === "bigint" && typeof o.gas_used === "bigint" && Array.isArray(o.events) && (!o.events.length || Event.isAmino(o.events[0])) && typeof o.codespace === "string"); + }, encode(message: ResponseCheckTx, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.code !== 0) { writer.uint32(8).uint32(message.code); @@ -5644,6 +5977,12 @@ export const ResponseCheckTx = { typeUrl: "/tendermint.abci.ResponseCheckTx", value: ResponseCheckTx.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ResponseCheckTx.typeUrl)) { + return; + } + Event.registerTypeUrl(); } }; function createBaseResponseDeliverTx(): ResponseDeliverTx { @@ -5665,6 +6004,15 @@ function createBaseResponseDeliverTx(): ResponseDeliverTx { */ export const ResponseDeliverTx = { typeUrl: "/tendermint.abci.ResponseDeliverTx", + is(o: any): o is ResponseDeliverTx { + return o && (o.$typeUrl === ResponseDeliverTx.typeUrl || typeof o.code === "number" && (o.data instanceof Uint8Array || typeof o.data === "string") && typeof o.log === "string" && typeof o.info === "string" && typeof o.gasWanted === "bigint" && typeof o.gasUsed === "bigint" && Array.isArray(o.events) && (!o.events.length || Event.is(o.events[0])) && typeof o.codespace === "string"); + }, + isSDK(o: any): o is ResponseDeliverTxSDKType { + return o && (o.$typeUrl === ResponseDeliverTx.typeUrl || typeof o.code === "number" && (o.data instanceof Uint8Array || typeof o.data === "string") && typeof o.log === "string" && typeof o.info === "string" && typeof o.gas_wanted === "bigint" && typeof o.gas_used === "bigint" && Array.isArray(o.events) && (!o.events.length || Event.isSDK(o.events[0])) && typeof o.codespace === "string"); + }, + isAmino(o: any): o is ResponseDeliverTxAmino { + return o && (o.$typeUrl === ResponseDeliverTx.typeUrl || typeof o.code === "number" && (o.data instanceof Uint8Array || typeof o.data === "string") && typeof o.log === "string" && typeof o.info === "string" && typeof o.gas_wanted === "bigint" && typeof o.gas_used === "bigint" && Array.isArray(o.events) && (!o.events.length || Event.isAmino(o.events[0])) && typeof o.codespace === "string"); + }, encode(message: ResponseDeliverTx, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.code !== 0) { writer.uint32(8).uint32(message.code); @@ -5858,6 +6206,12 @@ export const ResponseDeliverTx = { typeUrl: "/tendermint.abci.ResponseDeliverTx", value: ResponseDeliverTx.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ResponseDeliverTx.typeUrl)) { + return; + } + Event.registerTypeUrl(); } }; function createBaseResponseEndBlock(): ResponseEndBlock { @@ -5874,6 +6228,15 @@ function createBaseResponseEndBlock(): ResponseEndBlock { */ export const ResponseEndBlock = { typeUrl: "/tendermint.abci.ResponseEndBlock", + is(o: any): o is ResponseEndBlock { + return o && (o.$typeUrl === ResponseEndBlock.typeUrl || Array.isArray(o.validatorUpdates) && (!o.validatorUpdates.length || ValidatorUpdate.is(o.validatorUpdates[0])) && Array.isArray(o.events) && (!o.events.length || Event.is(o.events[0]))); + }, + isSDK(o: any): o is ResponseEndBlockSDKType { + return o && (o.$typeUrl === ResponseEndBlock.typeUrl || Array.isArray(o.validator_updates) && (!o.validator_updates.length || ValidatorUpdate.isSDK(o.validator_updates[0])) && Array.isArray(o.events) && (!o.events.length || Event.isSDK(o.events[0]))); + }, + isAmino(o: any): o is ResponseEndBlockAmino { + return o && (o.$typeUrl === ResponseEndBlock.typeUrl || Array.isArray(o.validator_updates) && (!o.validator_updates.length || ValidatorUpdate.isAmino(o.validator_updates[0])) && Array.isArray(o.events) && (!o.events.length || Event.isAmino(o.events[0]))); + }, encode(message: ResponseEndBlock, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.validatorUpdates) { ValidatorUpdate.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -6000,6 +6363,14 @@ export const ResponseEndBlock = { typeUrl: "/tendermint.abci.ResponseEndBlock", value: ResponseEndBlock.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ResponseEndBlock.typeUrl)) { + return; + } + ValidatorUpdate.registerTypeUrl(); + ConsensusParams.registerTypeUrl(); + Event.registerTypeUrl(); } }; function createBaseResponseCommit(): ResponseCommit { @@ -6015,6 +6386,15 @@ function createBaseResponseCommit(): ResponseCommit { */ export const ResponseCommit = { typeUrl: "/tendermint.abci.ResponseCommit", + is(o: any): o is ResponseCommit { + return o && (o.$typeUrl === ResponseCommit.typeUrl || (o.data instanceof Uint8Array || typeof o.data === "string") && typeof o.retainHeight === "bigint"); + }, + isSDK(o: any): o is ResponseCommitSDKType { + return o && (o.$typeUrl === ResponseCommit.typeUrl || (o.data instanceof Uint8Array || typeof o.data === "string") && typeof o.retain_height === "bigint"); + }, + isAmino(o: any): o is ResponseCommitAmino { + return o && (o.$typeUrl === ResponseCommit.typeUrl || (o.data instanceof Uint8Array || typeof o.data === "string") && typeof o.retain_height === "bigint"); + }, encode(message: ResponseCommit, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.data.length !== 0) { writer.uint32(18).bytes(message.data); @@ -6106,7 +6486,8 @@ export const ResponseCommit = { typeUrl: "/tendermint.abci.ResponseCommit", value: ResponseCommit.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseResponseListSnapshots(): ResponseListSnapshots { return { @@ -6120,6 +6501,15 @@ function createBaseResponseListSnapshots(): ResponseListSnapshots { */ export const ResponseListSnapshots = { typeUrl: "/tendermint.abci.ResponseListSnapshots", + is(o: any): o is ResponseListSnapshots { + return o && (o.$typeUrl === ResponseListSnapshots.typeUrl || Array.isArray(o.snapshots) && (!o.snapshots.length || Snapshot.is(o.snapshots[0]))); + }, + isSDK(o: any): o is ResponseListSnapshotsSDKType { + return o && (o.$typeUrl === ResponseListSnapshots.typeUrl || Array.isArray(o.snapshots) && (!o.snapshots.length || Snapshot.isSDK(o.snapshots[0]))); + }, + isAmino(o: any): o is ResponseListSnapshotsAmino { + return o && (o.$typeUrl === ResponseListSnapshots.typeUrl || Array.isArray(o.snapshots) && (!o.snapshots.length || Snapshot.isAmino(o.snapshots[0]))); + }, encode(message: ResponseListSnapshots, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.snapshots) { Snapshot.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -6204,6 +6594,12 @@ export const ResponseListSnapshots = { typeUrl: "/tendermint.abci.ResponseListSnapshots", value: ResponseListSnapshots.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ResponseListSnapshots.typeUrl)) { + return; + } + Snapshot.registerTypeUrl(); } }; function createBaseResponseOfferSnapshot(): ResponseOfferSnapshot { @@ -6218,6 +6614,15 @@ function createBaseResponseOfferSnapshot(): ResponseOfferSnapshot { */ export const ResponseOfferSnapshot = { typeUrl: "/tendermint.abci.ResponseOfferSnapshot", + is(o: any): o is ResponseOfferSnapshot { + return o && (o.$typeUrl === ResponseOfferSnapshot.typeUrl || isSet(o.result)); + }, + isSDK(o: any): o is ResponseOfferSnapshotSDKType { + return o && (o.$typeUrl === ResponseOfferSnapshot.typeUrl || isSet(o.result)); + }, + isAmino(o: any): o is ResponseOfferSnapshotAmino { + return o && (o.$typeUrl === ResponseOfferSnapshot.typeUrl || isSet(o.result)); + }, encode(message: ResponseOfferSnapshot, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.result !== 0) { writer.uint32(8).int32(message.result); @@ -6292,7 +6697,8 @@ export const ResponseOfferSnapshot = { typeUrl: "/tendermint.abci.ResponseOfferSnapshot", value: ResponseOfferSnapshot.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseResponseLoadSnapshotChunk(): ResponseLoadSnapshotChunk { return { @@ -6306,6 +6712,15 @@ function createBaseResponseLoadSnapshotChunk(): ResponseLoadSnapshotChunk { */ export const ResponseLoadSnapshotChunk = { typeUrl: "/tendermint.abci.ResponseLoadSnapshotChunk", + is(o: any): o is ResponseLoadSnapshotChunk { + return o && (o.$typeUrl === ResponseLoadSnapshotChunk.typeUrl || o.chunk instanceof Uint8Array || typeof o.chunk === "string"); + }, + isSDK(o: any): o is ResponseLoadSnapshotChunkSDKType { + return o && (o.$typeUrl === ResponseLoadSnapshotChunk.typeUrl || o.chunk instanceof Uint8Array || typeof o.chunk === "string"); + }, + isAmino(o: any): o is ResponseLoadSnapshotChunkAmino { + return o && (o.$typeUrl === ResponseLoadSnapshotChunk.typeUrl || o.chunk instanceof Uint8Array || typeof o.chunk === "string"); + }, encode(message: ResponseLoadSnapshotChunk, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.chunk.length !== 0) { writer.uint32(10).bytes(message.chunk); @@ -6380,7 +6795,8 @@ export const ResponseLoadSnapshotChunk = { typeUrl: "/tendermint.abci.ResponseLoadSnapshotChunk", value: ResponseLoadSnapshotChunk.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseResponseApplySnapshotChunk(): ResponseApplySnapshotChunk { return { @@ -6396,6 +6812,15 @@ function createBaseResponseApplySnapshotChunk(): ResponseApplySnapshotChunk { */ export const ResponseApplySnapshotChunk = { typeUrl: "/tendermint.abci.ResponseApplySnapshotChunk", + is(o: any): o is ResponseApplySnapshotChunk { + return o && (o.$typeUrl === ResponseApplySnapshotChunk.typeUrl || isSet(o.result) && Array.isArray(o.refetchChunks) && (!o.refetchChunks.length || typeof o.refetchChunks[0] === "number") && Array.isArray(o.rejectSenders) && (!o.rejectSenders.length || typeof o.rejectSenders[0] === "string")); + }, + isSDK(o: any): o is ResponseApplySnapshotChunkSDKType { + return o && (o.$typeUrl === ResponseApplySnapshotChunk.typeUrl || isSet(o.result) && Array.isArray(o.refetch_chunks) && (!o.refetch_chunks.length || typeof o.refetch_chunks[0] === "number") && Array.isArray(o.reject_senders) && (!o.reject_senders.length || typeof o.reject_senders[0] === "string")); + }, + isAmino(o: any): o is ResponseApplySnapshotChunkAmino { + return o && (o.$typeUrl === ResponseApplySnapshotChunk.typeUrl || isSet(o.result) && Array.isArray(o.refetch_chunks) && (!o.refetch_chunks.length || typeof o.refetch_chunks[0] === "number") && Array.isArray(o.reject_senders) && (!o.reject_senders.length || typeof o.reject_senders[0] === "string")); + }, encode(message: ResponseApplySnapshotChunk, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.result !== 0) { writer.uint32(8).int32(message.result); @@ -6529,7 +6954,8 @@ export const ResponseApplySnapshotChunk = { typeUrl: "/tendermint.abci.ResponseApplySnapshotChunk", value: ResponseApplySnapshotChunk.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseConsensusParams(): ConsensusParams { return { @@ -6548,6 +6974,15 @@ function createBaseConsensusParams(): ConsensusParams { */ export const ConsensusParams = { typeUrl: "/tendermint.abci.ConsensusParams", + is(o: any): o is ConsensusParams { + return o && o.$typeUrl === ConsensusParams.typeUrl; + }, + isSDK(o: any): o is ConsensusParamsSDKType { + return o && o.$typeUrl === ConsensusParams.typeUrl; + }, + isAmino(o: any): o is ConsensusParamsAmino { + return o && o.$typeUrl === ConsensusParams.typeUrl; + }, encode(message: ConsensusParams, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.block !== undefined) { BlockParams.encode(message.block, writer.uint32(10).fork()).ldelim(); @@ -6675,6 +7110,15 @@ export const ConsensusParams = { typeUrl: "/tendermint.abci.ConsensusParams", value: ConsensusParams.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ConsensusParams.typeUrl)) { + return; + } + BlockParams.registerTypeUrl(); + EvidenceParams.registerTypeUrl(); + ValidatorParams.registerTypeUrl(); + VersionParams.registerTypeUrl(); } }; function createBaseBlockParams(): BlockParams { @@ -6691,6 +7135,15 @@ function createBaseBlockParams(): BlockParams { */ export const BlockParams = { typeUrl: "/tendermint.abci.BlockParams", + is(o: any): o is BlockParams { + return o && (o.$typeUrl === BlockParams.typeUrl || typeof o.maxBytes === "bigint" && typeof o.maxGas === "bigint"); + }, + isSDK(o: any): o is BlockParamsSDKType { + return o && (o.$typeUrl === BlockParams.typeUrl || typeof o.max_bytes === "bigint" && typeof o.max_gas === "bigint"); + }, + isAmino(o: any): o is BlockParamsAmino { + return o && (o.$typeUrl === BlockParams.typeUrl || typeof o.max_bytes === "bigint" && typeof o.max_gas === "bigint"); + }, encode(message: BlockParams, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.maxBytes !== BigInt(0)) { writer.uint32(8).int64(message.maxBytes); @@ -6784,7 +7237,8 @@ export const BlockParams = { typeUrl: "/tendermint.abci.BlockParams", value: BlockParams.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseLastCommitInfo(): LastCommitInfo { return { @@ -6799,6 +7253,15 @@ function createBaseLastCommitInfo(): LastCommitInfo { */ export const LastCommitInfo = { typeUrl: "/tendermint.abci.LastCommitInfo", + is(o: any): o is LastCommitInfo { + return o && (o.$typeUrl === LastCommitInfo.typeUrl || typeof o.round === "number" && Array.isArray(o.votes) && (!o.votes.length || VoteInfo.is(o.votes[0]))); + }, + isSDK(o: any): o is LastCommitInfoSDKType { + return o && (o.$typeUrl === LastCommitInfo.typeUrl || typeof o.round === "number" && Array.isArray(o.votes) && (!o.votes.length || VoteInfo.isSDK(o.votes[0]))); + }, + isAmino(o: any): o is LastCommitInfoAmino { + return o && (o.$typeUrl === LastCommitInfo.typeUrl || typeof o.round === "number" && Array.isArray(o.votes) && (!o.votes.length || VoteInfo.isAmino(o.votes[0]))); + }, encode(message: LastCommitInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.round !== 0) { writer.uint32(8).int32(message.round); @@ -6898,6 +7361,12 @@ export const LastCommitInfo = { typeUrl: "/tendermint.abci.LastCommitInfo", value: LastCommitInfo.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(LastCommitInfo.typeUrl)) { + return; + } + VoteInfo.registerTypeUrl(); } }; function createBaseEvent(): Event { @@ -6916,6 +7385,15 @@ function createBaseEvent(): Event { */ export const Event = { typeUrl: "/tendermint.abci.Event", + is(o: any): o is Event { + return o && (o.$typeUrl === Event.typeUrl || typeof o.type === "string" && Array.isArray(o.attributes) && (!o.attributes.length || EventAttribute.is(o.attributes[0]))); + }, + isSDK(o: any): o is EventSDKType { + return o && (o.$typeUrl === Event.typeUrl || typeof o.type === "string" && Array.isArray(o.attributes) && (!o.attributes.length || EventAttribute.isSDK(o.attributes[0]))); + }, + isAmino(o: any): o is EventAmino { + return o && (o.$typeUrl === Event.typeUrl || typeof o.type === "string" && Array.isArray(o.attributes) && (!o.attributes.length || EventAttribute.isAmino(o.attributes[0]))); + }, encode(message: Event, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.type !== "") { writer.uint32(10).string(message.type); @@ -7015,6 +7493,12 @@ export const Event = { typeUrl: "/tendermint.abci.Event", value: Event.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Event.typeUrl)) { + return; + } + EventAttribute.registerTypeUrl(); } }; function createBaseEventAttribute(): EventAttribute { @@ -7032,6 +7516,15 @@ function createBaseEventAttribute(): EventAttribute { */ export const EventAttribute = { typeUrl: "/tendermint.abci.EventAttribute", + is(o: any): o is EventAttribute { + return o && (o.$typeUrl === EventAttribute.typeUrl || (o.key instanceof Uint8Array || typeof o.key === "string") && (o.value instanceof Uint8Array || typeof o.value === "string") && typeof o.index === "boolean"); + }, + isSDK(o: any): o is EventAttributeSDKType { + return o && (o.$typeUrl === EventAttribute.typeUrl || (o.key instanceof Uint8Array || typeof o.key === "string") && (o.value instanceof Uint8Array || typeof o.value === "string") && typeof o.index === "boolean"); + }, + isAmino(o: any): o is EventAttributeAmino { + return o && (o.$typeUrl === EventAttribute.typeUrl || (o.key instanceof Uint8Array || typeof o.key === "string") && (o.value instanceof Uint8Array || typeof o.value === "string") && typeof o.index === "boolean"); + }, encode(message: EventAttribute, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.key.length !== 0) { writer.uint32(10).bytes(message.key); @@ -7136,7 +7629,8 @@ export const EventAttribute = { typeUrl: "/tendermint.abci.EventAttribute", value: EventAttribute.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseTxResult(): TxResult { return { @@ -7156,6 +7650,15 @@ function createBaseTxResult(): TxResult { */ export const TxResult = { typeUrl: "/tendermint.abci.TxResult", + is(o: any): o is TxResult { + return o && (o.$typeUrl === TxResult.typeUrl || typeof o.height === "bigint" && typeof o.index === "number" && (o.tx instanceof Uint8Array || typeof o.tx === "string") && ResponseDeliverTx.is(o.result)); + }, + isSDK(o: any): o is TxResultSDKType { + return o && (o.$typeUrl === TxResult.typeUrl || typeof o.height === "bigint" && typeof o.index === "number" && (o.tx instanceof Uint8Array || typeof o.tx === "string") && ResponseDeliverTx.isSDK(o.result)); + }, + isAmino(o: any): o is TxResultAmino { + return o && (o.$typeUrl === TxResult.typeUrl || typeof o.height === "bigint" && typeof o.index === "number" && (o.tx instanceof Uint8Array || typeof o.tx === "string") && ResponseDeliverTx.isAmino(o.result)); + }, encode(message: TxResult, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.height !== BigInt(0)) { writer.uint32(8).int64(message.height); @@ -7279,6 +7782,12 @@ export const TxResult = { typeUrl: "/tendermint.abci.TxResult", value: TxResult.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(TxResult.typeUrl)) { + return; + } + ResponseDeliverTx.registerTypeUrl(); } }; function createBaseValidator(): Validator { @@ -7295,6 +7804,15 @@ function createBaseValidator(): Validator { */ export const Validator = { typeUrl: "/tendermint.abci.Validator", + is(o: any): o is Validator { + return o && (o.$typeUrl === Validator.typeUrl || (o.address instanceof Uint8Array || typeof o.address === "string") && typeof o.power === "bigint"); + }, + isSDK(o: any): o is ValidatorSDKType { + return o && (o.$typeUrl === Validator.typeUrl || (o.address instanceof Uint8Array || typeof o.address === "string") && typeof o.power === "bigint"); + }, + isAmino(o: any): o is ValidatorAmino { + return o && (o.$typeUrl === Validator.typeUrl || (o.address instanceof Uint8Array || typeof o.address === "string") && typeof o.power === "bigint"); + }, encode(message: Validator, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.address.length !== 0) { writer.uint32(10).bytes(message.address); @@ -7386,7 +7904,8 @@ export const Validator = { typeUrl: "/tendermint.abci.Validator", value: Validator.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseValidatorUpdate(): ValidatorUpdate { return { @@ -7402,6 +7921,15 @@ function createBaseValidatorUpdate(): ValidatorUpdate { */ export const ValidatorUpdate = { typeUrl: "/tendermint.abci.ValidatorUpdate", + is(o: any): o is ValidatorUpdate { + return o && (o.$typeUrl === ValidatorUpdate.typeUrl || PublicKey.is(o.pubKey) && typeof o.power === "bigint"); + }, + isSDK(o: any): o is ValidatorUpdateSDKType { + return o && (o.$typeUrl === ValidatorUpdate.typeUrl || PublicKey.isSDK(o.pub_key) && typeof o.power === "bigint"); + }, + isAmino(o: any): o is ValidatorUpdateAmino { + return o && (o.$typeUrl === ValidatorUpdate.typeUrl || PublicKey.isAmino(o.pub_key) && typeof o.power === "bigint"); + }, encode(message: ValidatorUpdate, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.pubKey !== undefined) { PublicKey.encode(message.pubKey, writer.uint32(10).fork()).ldelim(); @@ -7495,6 +8023,12 @@ export const ValidatorUpdate = { typeUrl: "/tendermint.abci.ValidatorUpdate", value: ValidatorUpdate.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ValidatorUpdate.typeUrl)) { + return; + } + PublicKey.registerTypeUrl(); } }; function createBaseVoteInfo(): VoteInfo { @@ -7511,6 +8045,15 @@ function createBaseVoteInfo(): VoteInfo { */ export const VoteInfo = { typeUrl: "/tendermint.abci.VoteInfo", + is(o: any): o is VoteInfo { + return o && (o.$typeUrl === VoteInfo.typeUrl || Validator.is(o.validator) && typeof o.signedLastBlock === "boolean"); + }, + isSDK(o: any): o is VoteInfoSDKType { + return o && (o.$typeUrl === VoteInfo.typeUrl || Validator.isSDK(o.validator) && typeof o.signed_last_block === "boolean"); + }, + isAmino(o: any): o is VoteInfoAmino { + return o && (o.$typeUrl === VoteInfo.typeUrl || Validator.isAmino(o.validator) && typeof o.signed_last_block === "boolean"); + }, encode(message: VoteInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.validator !== undefined) { Validator.encode(message.validator, writer.uint32(10).fork()).ldelim(); @@ -7602,6 +8145,12 @@ export const VoteInfo = { typeUrl: "/tendermint.abci.VoteInfo", value: VoteInfo.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(VoteInfo.typeUrl)) { + return; + } + Validator.registerTypeUrl(); } }; function createBaseEvidence(): Evidence { @@ -7620,6 +8169,15 @@ function createBaseEvidence(): Evidence { */ export const Evidence = { typeUrl: "/tendermint.abci.Evidence", + is(o: any): o is Evidence { + return o && (o.$typeUrl === Evidence.typeUrl || isSet(o.type) && Validator.is(o.validator) && typeof o.height === "bigint" && Timestamp.is(o.time) && typeof o.totalVotingPower === "bigint"); + }, + isSDK(o: any): o is EvidenceSDKType { + return o && (o.$typeUrl === Evidence.typeUrl || isSet(o.type) && Validator.isSDK(o.validator) && typeof o.height === "bigint" && Timestamp.isSDK(o.time) && typeof o.total_voting_power === "bigint"); + }, + isAmino(o: any): o is EvidenceAmino { + return o && (o.$typeUrl === Evidence.typeUrl || isSet(o.type) && Validator.isAmino(o.validator) && typeof o.height === "bigint" && Timestamp.isAmino(o.time) && typeof o.total_voting_power === "bigint"); + }, encode(message: Evidence, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.type !== 0) { writer.uint32(8).int32(message.type); @@ -7760,6 +8318,12 @@ export const Evidence = { typeUrl: "/tendermint.abci.Evidence", value: Evidence.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Evidence.typeUrl)) { + return; + } + Validator.registerTypeUrl(); } }; function createBaseSnapshot(): Snapshot { @@ -7778,6 +8342,15 @@ function createBaseSnapshot(): Snapshot { */ export const Snapshot = { typeUrl: "/tendermint.abci.Snapshot", + is(o: any): o is Snapshot { + return o && (o.$typeUrl === Snapshot.typeUrl || typeof o.height === "bigint" && typeof o.format === "number" && typeof o.chunks === "number" && (o.hash instanceof Uint8Array || typeof o.hash === "string") && (o.metadata instanceof Uint8Array || typeof o.metadata === "string")); + }, + isSDK(o: any): o is SnapshotSDKType { + return o && (o.$typeUrl === Snapshot.typeUrl || typeof o.height === "bigint" && typeof o.format === "number" && typeof o.chunks === "number" && (o.hash instanceof Uint8Array || typeof o.hash === "string") && (o.metadata instanceof Uint8Array || typeof o.metadata === "string")); + }, + isAmino(o: any): o is SnapshotAmino { + return o && (o.$typeUrl === Snapshot.typeUrl || typeof o.height === "bigint" && typeof o.format === "number" && typeof o.chunks === "number" && (o.hash instanceof Uint8Array || typeof o.hash === "string") && (o.metadata instanceof Uint8Array || typeof o.metadata === "string")); + }, encode(message: Snapshot, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.height !== BigInt(0)) { writer.uint32(8).uint64(message.height); @@ -7914,5 +8487,6 @@ export const Snapshot = { typeUrl: "/tendermint.abci.Snapshot", value: Snapshot.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/tendermint/bundle.ts b/__fixtures__/v-next/outputv2/tendermint/bundle.ts index 0c2edaadd1..0af45545e1 100644 --- a/__fixtures__/v-next/outputv2/tendermint/bundle.ts +++ b/__fixtures__/v-next/outputv2/tendermint/bundle.ts @@ -9,9 +9,11 @@ import * as _312 from "./types/params"; import * as _313 from "./types/types"; import * as _314 from "./types/validator"; import * as _315 from "./version/types"; +import * as _572 from "./abci/types.rpc.func"; export namespace tendermint { export const abci = { - ..._305 + ..._305, + ..._572 }; export const crypto = { ..._306, diff --git a/__fixtures__/v-next/outputv2/tendermint/crypto/keys.ts b/__fixtures__/v-next/outputv2/tendermint/crypto/keys.ts index 680f2576a0..010fd1f154 100644 --- a/__fixtures__/v-next/outputv2/tendermint/crypto/keys.ts +++ b/__fixtures__/v-next/outputv2/tendermint/crypto/keys.ts @@ -54,6 +54,15 @@ function createBasePublicKey(): PublicKey { */ export const PublicKey = { typeUrl: "/tendermint.crypto.PublicKey", + is(o: any): o is PublicKey { + return o && o.$typeUrl === PublicKey.typeUrl; + }, + isSDK(o: any): o is PublicKeySDKType { + return o && o.$typeUrl === PublicKey.typeUrl; + }, + isAmino(o: any): o is PublicKeyAmino { + return o && o.$typeUrl === PublicKey.typeUrl; + }, encode(message: PublicKey, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.ed25519 !== undefined) { writer.uint32(10).bytes(message.ed25519); @@ -143,5 +152,6 @@ export const PublicKey = { typeUrl: "/tendermint.crypto.PublicKey", value: PublicKey.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/tendermint/crypto/proof.ts b/__fixtures__/v-next/outputv2/tendermint/crypto/proof.ts index 92a194fb2e..93b5e6eaae 100644 --- a/__fixtures__/v-next/outputv2/tendermint/crypto/proof.ts +++ b/__fixtures__/v-next/outputv2/tendermint/crypto/proof.ts @@ -1,6 +1,7 @@ import { BinaryReader, BinaryWriter } from "../../binary"; import { isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../../helpers"; import { JsonSafe } from "../../json-safe"; +import { GlobalDecoderRegistry } from "../../registry"; export const protobufPackage = "tendermint.crypto"; /** * @name Proof @@ -225,6 +226,15 @@ function createBaseProof(): Proof { */ export const Proof = { typeUrl: "/tendermint.crypto.Proof", + is(o: any): o is Proof { + return o && (o.$typeUrl === Proof.typeUrl || typeof o.total === "bigint" && typeof o.index === "bigint" && (o.leafHash instanceof Uint8Array || typeof o.leafHash === "string") && Array.isArray(o.aunts) && (!o.aunts.length || o.aunts[0] instanceof Uint8Array || typeof o.aunts[0] === "string")); + }, + isSDK(o: any): o is ProofSDKType { + return o && (o.$typeUrl === Proof.typeUrl || typeof o.total === "bigint" && typeof o.index === "bigint" && (o.leaf_hash instanceof Uint8Array || typeof o.leaf_hash === "string") && Array.isArray(o.aunts) && (!o.aunts.length || o.aunts[0] instanceof Uint8Array || typeof o.aunts[0] === "string")); + }, + isAmino(o: any): o is ProofAmino { + return o && (o.$typeUrl === Proof.typeUrl || typeof o.total === "bigint" && typeof o.index === "bigint" && (o.leaf_hash instanceof Uint8Array || typeof o.leaf_hash === "string") && Array.isArray(o.aunts) && (!o.aunts.length || o.aunts[0] instanceof Uint8Array || typeof o.aunts[0] === "string")); + }, encode(message: Proof, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.total !== BigInt(0)) { writer.uint32(8).int64(message.total); @@ -358,7 +368,8 @@ export const Proof = { typeUrl: "/tendermint.crypto.Proof", value: Proof.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseValueOp(): ValueOp { return { @@ -373,6 +384,15 @@ function createBaseValueOp(): ValueOp { */ export const ValueOp = { typeUrl: "/tendermint.crypto.ValueOp", + is(o: any): o is ValueOp { + return o && (o.$typeUrl === ValueOp.typeUrl || o.key instanceof Uint8Array || typeof o.key === "string"); + }, + isSDK(o: any): o is ValueOpSDKType { + return o && (o.$typeUrl === ValueOp.typeUrl || o.key instanceof Uint8Array || typeof o.key === "string"); + }, + isAmino(o: any): o is ValueOpAmino { + return o && (o.$typeUrl === ValueOp.typeUrl || o.key instanceof Uint8Array || typeof o.key === "string"); + }, encode(message: ValueOp, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.key.length !== 0) { writer.uint32(10).bytes(message.key); @@ -464,6 +484,12 @@ export const ValueOp = { typeUrl: "/tendermint.crypto.ValueOp", value: ValueOp.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ValueOp.typeUrl)) { + return; + } + Proof.registerTypeUrl(); } }; function createBaseDominoOp(): DominoOp { @@ -480,6 +506,15 @@ function createBaseDominoOp(): DominoOp { */ export const DominoOp = { typeUrl: "/tendermint.crypto.DominoOp", + is(o: any): o is DominoOp { + return o && (o.$typeUrl === DominoOp.typeUrl || typeof o.key === "string" && typeof o.input === "string" && typeof o.output === "string"); + }, + isSDK(o: any): o is DominoOpSDKType { + return o && (o.$typeUrl === DominoOp.typeUrl || typeof o.key === "string" && typeof o.input === "string" && typeof o.output === "string"); + }, + isAmino(o: any): o is DominoOpAmino { + return o && (o.$typeUrl === DominoOp.typeUrl || typeof o.key === "string" && typeof o.input === "string" && typeof o.output === "string"); + }, encode(message: DominoOp, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.key !== "") { writer.uint32(10).string(message.key); @@ -584,7 +619,8 @@ export const DominoOp = { typeUrl: "/tendermint.crypto.DominoOp", value: DominoOp.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseProofOp(): ProofOp { return { @@ -603,6 +639,15 @@ function createBaseProofOp(): ProofOp { */ export const ProofOp = { typeUrl: "/tendermint.crypto.ProofOp", + is(o: any): o is ProofOp { + return o && (o.$typeUrl === ProofOp.typeUrl || typeof o.type === "string" && (o.key instanceof Uint8Array || typeof o.key === "string") && (o.data instanceof Uint8Array || typeof o.data === "string")); + }, + isSDK(o: any): o is ProofOpSDKType { + return o && (o.$typeUrl === ProofOp.typeUrl || typeof o.type === "string" && (o.key instanceof Uint8Array || typeof o.key === "string") && (o.data instanceof Uint8Array || typeof o.data === "string")); + }, + isAmino(o: any): o is ProofOpAmino { + return o && (o.$typeUrl === ProofOp.typeUrl || typeof o.type === "string" && (o.key instanceof Uint8Array || typeof o.key === "string") && (o.data instanceof Uint8Array || typeof o.data === "string")); + }, encode(message: ProofOp, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.type !== "") { writer.uint32(10).string(message.type); @@ -707,7 +752,8 @@ export const ProofOp = { typeUrl: "/tendermint.crypto.ProofOp", value: ProofOp.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseProofOps(): ProofOps { return { @@ -722,6 +768,15 @@ function createBaseProofOps(): ProofOps { */ export const ProofOps = { typeUrl: "/tendermint.crypto.ProofOps", + is(o: any): o is ProofOps { + return o && (o.$typeUrl === ProofOps.typeUrl || Array.isArray(o.ops) && (!o.ops.length || ProofOp.is(o.ops[0]))); + }, + isSDK(o: any): o is ProofOpsSDKType { + return o && (o.$typeUrl === ProofOps.typeUrl || Array.isArray(o.ops) && (!o.ops.length || ProofOp.isSDK(o.ops[0]))); + }, + isAmino(o: any): o is ProofOpsAmino { + return o && (o.$typeUrl === ProofOps.typeUrl || Array.isArray(o.ops) && (!o.ops.length || ProofOp.isAmino(o.ops[0]))); + }, encode(message: ProofOps, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.ops) { ProofOp.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -806,5 +861,11 @@ export const ProofOps = { typeUrl: "/tendermint.crypto.ProofOps", value: ProofOps.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ProofOps.typeUrl)) { + return; + } + ProofOp.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/tendermint/libs/bits/types.ts b/__fixtures__/v-next/outputv2/tendermint/libs/bits/types.ts index f3b114009b..601125e905 100644 --- a/__fixtures__/v-next/outputv2/tendermint/libs/bits/types.ts +++ b/__fixtures__/v-next/outputv2/tendermint/libs/bits/types.ts @@ -50,6 +50,15 @@ function createBaseBitArray(): BitArray { */ export const BitArray = { typeUrl: "/tendermint.libs.bits.BitArray", + is(o: any): o is BitArray { + return o && (o.$typeUrl === BitArray.typeUrl || typeof o.bits === "bigint" && Array.isArray(o.elems) && (!o.elems.length || typeof o.elems[0] === "bigint")); + }, + isSDK(o: any): o is BitArraySDKType { + return o && (o.$typeUrl === BitArray.typeUrl || typeof o.bits === "bigint" && Array.isArray(o.elems) && (!o.elems.length || typeof o.elems[0] === "bigint")); + }, + isAmino(o: any): o is BitArrayAmino { + return o && (o.$typeUrl === BitArray.typeUrl || typeof o.bits === "bigint" && Array.isArray(o.elems) && (!o.elems.length || typeof o.elems[0] === "bigint")); + }, encode(message: BitArray, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.bits !== BigInt(0)) { writer.uint32(8).int64(message.bits); @@ -160,5 +169,6 @@ export const BitArray = { typeUrl: "/tendermint.libs.bits.BitArray", value: BitArray.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/tendermint/p2p/types.ts b/__fixtures__/v-next/outputv2/tendermint/p2p/types.ts index e2080c5628..d5bb4b7cfd 100644 --- a/__fixtures__/v-next/outputv2/tendermint/p2p/types.ts +++ b/__fixtures__/v-next/outputv2/tendermint/p2p/types.ts @@ -2,6 +2,7 @@ import { Timestamp } from "../../google/protobuf/timestamp"; import { BinaryReader, BinaryWriter } from "../../binary"; import { isSet, DeepPartial, bytesFromBase64, base64FromBytes, toTimestamp, fromTimestamp } from "../../helpers"; import { JsonSafe } from "../../json-safe"; +import { GlobalDecoderRegistry } from "../../registry"; export const protobufPackage = "tendermint.p2p"; /** * @name ProtocolVersion @@ -222,6 +223,15 @@ function createBaseProtocolVersion(): ProtocolVersion { */ export const ProtocolVersion = { typeUrl: "/tendermint.p2p.ProtocolVersion", + is(o: any): o is ProtocolVersion { + return o && (o.$typeUrl === ProtocolVersion.typeUrl || typeof o.p2p === "bigint" && typeof o.block === "bigint" && typeof o.app === "bigint"); + }, + isSDK(o: any): o is ProtocolVersionSDKType { + return o && (o.$typeUrl === ProtocolVersion.typeUrl || typeof o.p2p === "bigint" && typeof o.block === "bigint" && typeof o.app === "bigint"); + }, + isAmino(o: any): o is ProtocolVersionAmino { + return o && (o.$typeUrl === ProtocolVersion.typeUrl || typeof o.p2p === "bigint" && typeof o.block === "bigint" && typeof o.app === "bigint"); + }, encode(message: ProtocolVersion, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.p2p !== BigInt(0)) { writer.uint32(8).uint64(message.p2p); @@ -332,7 +342,8 @@ export const ProtocolVersion = { typeUrl: "/tendermint.p2p.ProtocolVersion", value: ProtocolVersion.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseNodeInfo(): NodeInfo { return { @@ -353,6 +364,15 @@ function createBaseNodeInfo(): NodeInfo { */ export const NodeInfo = { typeUrl: "/tendermint.p2p.NodeInfo", + is(o: any): o is NodeInfo { + return o && (o.$typeUrl === NodeInfo.typeUrl || ProtocolVersion.is(o.protocolVersion) && typeof o.nodeId === "string" && typeof o.listenAddr === "string" && typeof o.network === "string" && typeof o.version === "string" && (o.channels instanceof Uint8Array || typeof o.channels === "string") && typeof o.moniker === "string" && NodeInfoOther.is(o.other)); + }, + isSDK(o: any): o is NodeInfoSDKType { + return o && (o.$typeUrl === NodeInfo.typeUrl || ProtocolVersion.isSDK(o.protocol_version) && typeof o.node_id === "string" && typeof o.listen_addr === "string" && typeof o.network === "string" && typeof o.version === "string" && (o.channels instanceof Uint8Array || typeof o.channels === "string") && typeof o.moniker === "string" && NodeInfoOther.isSDK(o.other)); + }, + isAmino(o: any): o is NodeInfoAmino { + return o && (o.$typeUrl === NodeInfo.typeUrl || ProtocolVersion.isAmino(o.protocol_version) && typeof o.node_id === "string" && typeof o.listen_addr === "string" && typeof o.network === "string" && typeof o.version === "string" && (o.channels instanceof Uint8Array || typeof o.channels === "string") && typeof o.moniker === "string" && NodeInfoOther.isAmino(o.other)); + }, encode(message: NodeInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.protocolVersion !== undefined) { ProtocolVersion.encode(message.protocolVersion, writer.uint32(10).fork()).ldelim(); @@ -536,6 +556,13 @@ export const NodeInfo = { typeUrl: "/tendermint.p2p.NodeInfo", value: NodeInfo.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(NodeInfo.typeUrl)) { + return; + } + ProtocolVersion.registerTypeUrl(); + NodeInfoOther.registerTypeUrl(); } }; function createBaseNodeInfoOther(): NodeInfoOther { @@ -551,6 +578,15 @@ function createBaseNodeInfoOther(): NodeInfoOther { */ export const NodeInfoOther = { typeUrl: "/tendermint.p2p.NodeInfoOther", + is(o: any): o is NodeInfoOther { + return o && (o.$typeUrl === NodeInfoOther.typeUrl || typeof o.txIndex === "string" && typeof o.rpcAddress === "string"); + }, + isSDK(o: any): o is NodeInfoOtherSDKType { + return o && (o.$typeUrl === NodeInfoOther.typeUrl || typeof o.tx_index === "string" && typeof o.rpc_address === "string"); + }, + isAmino(o: any): o is NodeInfoOtherAmino { + return o && (o.$typeUrl === NodeInfoOther.typeUrl || typeof o.tx_index === "string" && typeof o.rpc_address === "string"); + }, encode(message: NodeInfoOther, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.txIndex !== "") { writer.uint32(10).string(message.txIndex); @@ -640,7 +676,8 @@ export const NodeInfoOther = { typeUrl: "/tendermint.p2p.NodeInfoOther", value: NodeInfoOther.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBasePeerInfo(): PeerInfo { return { @@ -656,6 +693,15 @@ function createBasePeerInfo(): PeerInfo { */ export const PeerInfo = { typeUrl: "/tendermint.p2p.PeerInfo", + is(o: any): o is PeerInfo { + return o && (o.$typeUrl === PeerInfo.typeUrl || typeof o.id === "string" && Array.isArray(o.addressInfo) && (!o.addressInfo.length || PeerAddressInfo.is(o.addressInfo[0]))); + }, + isSDK(o: any): o is PeerInfoSDKType { + return o && (o.$typeUrl === PeerInfo.typeUrl || typeof o.id === "string" && Array.isArray(o.address_info) && (!o.address_info.length || PeerAddressInfo.isSDK(o.address_info[0]))); + }, + isAmino(o: any): o is PeerInfoAmino { + return o && (o.$typeUrl === PeerInfo.typeUrl || typeof o.id === "string" && Array.isArray(o.address_info) && (!o.address_info.length || PeerAddressInfo.isAmino(o.address_info[0]))); + }, encode(message: PeerInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.id !== "") { writer.uint32(10).string(message.id); @@ -770,6 +816,12 @@ export const PeerInfo = { typeUrl: "/tendermint.p2p.PeerInfo", value: PeerInfo.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(PeerInfo.typeUrl)) { + return; + } + PeerAddressInfo.registerTypeUrl(); } }; function createBasePeerAddressInfo(): PeerAddressInfo { @@ -787,6 +839,15 @@ function createBasePeerAddressInfo(): PeerAddressInfo { */ export const PeerAddressInfo = { typeUrl: "/tendermint.p2p.PeerAddressInfo", + is(o: any): o is PeerAddressInfo { + return o && (o.$typeUrl === PeerAddressInfo.typeUrl || typeof o.address === "string" && typeof o.dialFailures === "number"); + }, + isSDK(o: any): o is PeerAddressInfoSDKType { + return o && (o.$typeUrl === PeerAddressInfo.typeUrl || typeof o.address === "string" && typeof o.dial_failures === "number"); + }, + isAmino(o: any): o is PeerAddressInfoAmino { + return o && (o.$typeUrl === PeerAddressInfo.typeUrl || typeof o.address === "string" && typeof o.dial_failures === "number"); + }, encode(message: PeerAddressInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.address !== "") { writer.uint32(10).string(message.address); @@ -906,5 +967,6 @@ export const PeerAddressInfo = { typeUrl: "/tendermint.p2p.PeerAddressInfo", value: PeerAddressInfo.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/tendermint/types/block.ts b/__fixtures__/v-next/outputv2/tendermint/types/block.ts index 466b297acb..35259a5d0b 100644 --- a/__fixtures__/v-next/outputv2/tendermint/types/block.ts +++ b/__fixtures__/v-next/outputv2/tendermint/types/block.ts @@ -1,6 +1,7 @@ import { Header, HeaderAmino, HeaderSDKType, Data, DataAmino, DataSDKType, Commit, CommitAmino, CommitSDKType } from "./types"; import { EvidenceList, EvidenceListAmino, EvidenceListSDKType } from "./evidence"; import { BinaryReader, BinaryWriter } from "../../binary"; +import { GlobalDecoderRegistry } from "../../registry"; import { isSet, DeepPartial } from "../../helpers"; import { JsonSafe } from "../../json-safe"; export const protobufPackage = "tendermint.types"; @@ -60,6 +61,15 @@ function createBaseBlock(): Block { */ export const Block = { typeUrl: "/tendermint.types.Block", + is(o: any): o is Block { + return o && (o.$typeUrl === Block.typeUrl || Header.is(o.header) && Data.is(o.data) && EvidenceList.is(o.evidence)); + }, + isSDK(o: any): o is BlockSDKType { + return o && (o.$typeUrl === Block.typeUrl || Header.isSDK(o.header) && Data.isSDK(o.data) && EvidenceList.isSDK(o.evidence)); + }, + isAmino(o: any): o is BlockAmino { + return o && (o.$typeUrl === Block.typeUrl || Header.isAmino(o.header) && Data.isAmino(o.data) && EvidenceList.isAmino(o.evidence)); + }, encode(message: Block, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.header !== undefined) { Header.encode(message.header, writer.uint32(10).fork()).ldelim(); @@ -187,5 +197,14 @@ export const Block = { typeUrl: "/tendermint.types.Block", value: Block.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Block.typeUrl)) { + return; + } + Header.registerTypeUrl(); + Data.registerTypeUrl(); + EvidenceList.registerTypeUrl(); + Commit.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/tendermint/types/evidence.ts b/__fixtures__/v-next/outputv2/tendermint/types/evidence.ts index 7c27b18a1f..5d01d20e6d 100644 --- a/__fixtures__/v-next/outputv2/tendermint/types/evidence.ts +++ b/__fixtures__/v-next/outputv2/tendermint/types/evidence.ts @@ -2,6 +2,7 @@ import { Vote, VoteAmino, VoteSDKType, LightBlock, LightBlockAmino, LightBlockSD import { Timestamp } from "../../google/protobuf/timestamp"; import { Validator, ValidatorAmino, ValidatorSDKType } from "./validator"; import { BinaryReader, BinaryWriter } from "../../binary"; +import { GlobalDecoderRegistry } from "../../registry"; import { isSet, DeepPartial, toTimestamp, fromTimestamp } from "../../helpers"; import { JsonSafe } from "../../json-safe"; export const protobufPackage = "tendermint.types"; @@ -179,6 +180,15 @@ function createBaseEvidence(): Evidence { */ export const Evidence = { typeUrl: "/tendermint.types.Evidence", + is(o: any): o is Evidence { + return o && o.$typeUrl === Evidence.typeUrl; + }, + isSDK(o: any): o is EvidenceSDKType { + return o && o.$typeUrl === Evidence.typeUrl; + }, + isAmino(o: any): o is EvidenceAmino { + return o && o.$typeUrl === Evidence.typeUrl; + }, encode(message: Evidence, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.duplicateVoteEvidence !== undefined) { DuplicateVoteEvidence.encode(message.duplicateVoteEvidence, writer.uint32(10).fork()).ldelim(); @@ -272,6 +282,13 @@ export const Evidence = { typeUrl: "/tendermint.types.Evidence", value: Evidence.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Evidence.typeUrl)) { + return; + } + DuplicateVoteEvidence.registerTypeUrl(); + LightClientAttackEvidence.registerTypeUrl(); } }; function createBaseDuplicateVoteEvidence(): DuplicateVoteEvidence { @@ -291,6 +308,15 @@ function createBaseDuplicateVoteEvidence(): DuplicateVoteEvidence { */ export const DuplicateVoteEvidence = { typeUrl: "/tendermint.types.DuplicateVoteEvidence", + is(o: any): o is DuplicateVoteEvidence { + return o && (o.$typeUrl === DuplicateVoteEvidence.typeUrl || typeof o.totalVotingPower === "bigint" && typeof o.validatorPower === "bigint" && Timestamp.is(o.timestamp)); + }, + isSDK(o: any): o is DuplicateVoteEvidenceSDKType { + return o && (o.$typeUrl === DuplicateVoteEvidence.typeUrl || typeof o.total_voting_power === "bigint" && typeof o.validator_power === "bigint" && Timestamp.isSDK(o.timestamp)); + }, + isAmino(o: any): o is DuplicateVoteEvidenceAmino { + return o && (o.$typeUrl === DuplicateVoteEvidence.typeUrl || typeof o.total_voting_power === "bigint" && typeof o.validator_power === "bigint" && Timestamp.isAmino(o.timestamp)); + }, encode(message: DuplicateVoteEvidence, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.voteA !== undefined) { Vote.encode(message.voteA, writer.uint32(10).fork()).ldelim(); @@ -433,6 +459,12 @@ export const DuplicateVoteEvidence = { typeUrl: "/tendermint.types.DuplicateVoteEvidence", value: DuplicateVoteEvidence.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(DuplicateVoteEvidence.typeUrl)) { + return; + } + Vote.registerTypeUrl(); } }; function createBaseLightClientAttackEvidence(): LightClientAttackEvidence { @@ -452,6 +484,15 @@ function createBaseLightClientAttackEvidence(): LightClientAttackEvidence { */ export const LightClientAttackEvidence = { typeUrl: "/tendermint.types.LightClientAttackEvidence", + is(o: any): o is LightClientAttackEvidence { + return o && (o.$typeUrl === LightClientAttackEvidence.typeUrl || typeof o.commonHeight === "bigint" && Array.isArray(o.byzantineValidators) && (!o.byzantineValidators.length || Validator.is(o.byzantineValidators[0])) && typeof o.totalVotingPower === "bigint" && Timestamp.is(o.timestamp)); + }, + isSDK(o: any): o is LightClientAttackEvidenceSDKType { + return o && (o.$typeUrl === LightClientAttackEvidence.typeUrl || typeof o.common_height === "bigint" && Array.isArray(o.byzantine_validators) && (!o.byzantine_validators.length || Validator.isSDK(o.byzantine_validators[0])) && typeof o.total_voting_power === "bigint" && Timestamp.isSDK(o.timestamp)); + }, + isAmino(o: any): o is LightClientAttackEvidenceAmino { + return o && (o.$typeUrl === LightClientAttackEvidence.typeUrl || typeof o.common_height === "bigint" && Array.isArray(o.byzantine_validators) && (!o.byzantine_validators.length || Validator.isAmino(o.byzantine_validators[0])) && typeof o.total_voting_power === "bigint" && Timestamp.isAmino(o.timestamp)); + }, encode(message: LightClientAttackEvidence, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.conflictingBlock !== undefined) { LightBlock.encode(message.conflictingBlock, writer.uint32(10).fork()).ldelim(); @@ -602,6 +643,13 @@ export const LightClientAttackEvidence = { typeUrl: "/tendermint.types.LightClientAttackEvidence", value: LightClientAttackEvidence.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(LightClientAttackEvidence.typeUrl)) { + return; + } + LightBlock.registerTypeUrl(); + Validator.registerTypeUrl(); } }; function createBaseEvidenceList(): EvidenceList { @@ -616,6 +664,15 @@ function createBaseEvidenceList(): EvidenceList { */ export const EvidenceList = { typeUrl: "/tendermint.types.EvidenceList", + is(o: any): o is EvidenceList { + return o && (o.$typeUrl === EvidenceList.typeUrl || Array.isArray(o.evidence) && (!o.evidence.length || Evidence.is(o.evidence[0]))); + }, + isSDK(o: any): o is EvidenceListSDKType { + return o && (o.$typeUrl === EvidenceList.typeUrl || Array.isArray(o.evidence) && (!o.evidence.length || Evidence.isSDK(o.evidence[0]))); + }, + isAmino(o: any): o is EvidenceListAmino { + return o && (o.$typeUrl === EvidenceList.typeUrl || Array.isArray(o.evidence) && (!o.evidence.length || Evidence.isAmino(o.evidence[0]))); + }, encode(message: EvidenceList, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.evidence) { Evidence.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -700,5 +757,11 @@ export const EvidenceList = { typeUrl: "/tendermint.types.EvidenceList", value: EvidenceList.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(EvidenceList.typeUrl)) { + return; + } + Evidence.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/tendermint/types/params.ts b/__fixtures__/v-next/outputv2/tendermint/types/params.ts index 1cf3db3094..430a4da58f 100644 --- a/__fixtures__/v-next/outputv2/tendermint/types/params.ts +++ b/__fixtures__/v-next/outputv2/tendermint/types/params.ts @@ -1,5 +1,6 @@ import { Duration, DurationAmino, DurationSDKType } from "../../google/protobuf/duration"; import { BinaryReader, BinaryWriter } from "../../binary"; +import { GlobalDecoderRegistry } from "../../registry"; import { isSet, DeepPartial } from "../../helpers"; import { JsonSafe } from "../../json-safe"; export const protobufPackage = "tendermint.types"; @@ -330,6 +331,15 @@ function createBaseConsensusParams(): ConsensusParams { */ export const ConsensusParams = { typeUrl: "/tendermint.types.ConsensusParams", + is(o: any): o is ConsensusParams { + return o && (o.$typeUrl === ConsensusParams.typeUrl || BlockParams.is(o.block) && EvidenceParams.is(o.evidence) && ValidatorParams.is(o.validator) && VersionParams.is(o.version)); + }, + isSDK(o: any): o is ConsensusParamsSDKType { + return o && (o.$typeUrl === ConsensusParams.typeUrl || BlockParams.isSDK(o.block) && EvidenceParams.isSDK(o.evidence) && ValidatorParams.isSDK(o.validator) && VersionParams.isSDK(o.version)); + }, + isAmino(o: any): o is ConsensusParamsAmino { + return o && (o.$typeUrl === ConsensusParams.typeUrl || BlockParams.isAmino(o.block) && EvidenceParams.isAmino(o.evidence) && ValidatorParams.isAmino(o.validator) && VersionParams.isAmino(o.version)); + }, encode(message: ConsensusParams, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.block !== undefined) { BlockParams.encode(message.block, writer.uint32(10).fork()).ldelim(); @@ -457,6 +467,15 @@ export const ConsensusParams = { typeUrl: "/tendermint.types.ConsensusParams", value: ConsensusParams.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ConsensusParams.typeUrl)) { + return; + } + BlockParams.registerTypeUrl(); + EvidenceParams.registerTypeUrl(); + ValidatorParams.registerTypeUrl(); + VersionParams.registerTypeUrl(); } }; function createBaseBlockParams(): BlockParams { @@ -474,6 +493,15 @@ function createBaseBlockParams(): BlockParams { */ export const BlockParams = { typeUrl: "/tendermint.types.BlockParams", + is(o: any): o is BlockParams { + return o && (o.$typeUrl === BlockParams.typeUrl || typeof o.maxBytes === "bigint" && typeof o.maxGas === "bigint" && typeof o.timeIotaMs === "bigint"); + }, + isSDK(o: any): o is BlockParamsSDKType { + return o && (o.$typeUrl === BlockParams.typeUrl || typeof o.max_bytes === "bigint" && typeof o.max_gas === "bigint" && typeof o.time_iota_ms === "bigint"); + }, + isAmino(o: any): o is BlockParamsAmino { + return o && (o.$typeUrl === BlockParams.typeUrl || typeof o.max_bytes === "bigint" && typeof o.max_gas === "bigint" && typeof o.time_iota_ms === "bigint"); + }, encode(message: BlockParams, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.maxBytes !== BigInt(0)) { writer.uint32(8).int64(message.maxBytes); @@ -584,7 +612,8 @@ export const BlockParams = { typeUrl: "/tendermint.types.BlockParams", value: BlockParams.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseEvidenceParams(): EvidenceParams { return { @@ -601,6 +630,15 @@ function createBaseEvidenceParams(): EvidenceParams { */ export const EvidenceParams = { typeUrl: "/tendermint.types.EvidenceParams", + is(o: any): o is EvidenceParams { + return o && (o.$typeUrl === EvidenceParams.typeUrl || typeof o.maxAgeNumBlocks === "bigint" && Duration.is(o.maxAgeDuration) && typeof o.maxBytes === "bigint"); + }, + isSDK(o: any): o is EvidenceParamsSDKType { + return o && (o.$typeUrl === EvidenceParams.typeUrl || typeof o.max_age_num_blocks === "bigint" && Duration.isSDK(o.max_age_duration) && typeof o.max_bytes === "bigint"); + }, + isAmino(o: any): o is EvidenceParamsAmino { + return o && (o.$typeUrl === EvidenceParams.typeUrl || typeof o.max_age_num_blocks === "bigint" && Duration.isAmino(o.max_age_duration) && typeof o.max_bytes === "bigint"); + }, encode(message: EvidenceParams, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.maxAgeNumBlocks !== BigInt(0)) { writer.uint32(8).int64(message.maxAgeNumBlocks); @@ -711,7 +749,8 @@ export const EvidenceParams = { typeUrl: "/tendermint.types.EvidenceParams", value: EvidenceParams.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseValidatorParams(): ValidatorParams { return { @@ -727,6 +766,15 @@ function createBaseValidatorParams(): ValidatorParams { */ export const ValidatorParams = { typeUrl: "/tendermint.types.ValidatorParams", + is(o: any): o is ValidatorParams { + return o && (o.$typeUrl === ValidatorParams.typeUrl || Array.isArray(o.pubKeyTypes) && (!o.pubKeyTypes.length || typeof o.pubKeyTypes[0] === "string")); + }, + isSDK(o: any): o is ValidatorParamsSDKType { + return o && (o.$typeUrl === ValidatorParams.typeUrl || Array.isArray(o.pub_key_types) && (!o.pub_key_types.length || typeof o.pub_key_types[0] === "string")); + }, + isAmino(o: any): o is ValidatorParamsAmino { + return o && (o.$typeUrl === ValidatorParams.typeUrl || Array.isArray(o.pub_key_types) && (!o.pub_key_types.length || typeof o.pub_key_types[0] === "string")); + }, encode(message: ValidatorParams, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.pubKeyTypes) { writer.uint32(10).string(v!); @@ -811,7 +859,8 @@ export const ValidatorParams = { typeUrl: "/tendermint.types.ValidatorParams", value: ValidatorParams.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseVersionParams(): VersionParams { return { @@ -826,6 +875,15 @@ function createBaseVersionParams(): VersionParams { */ export const VersionParams = { typeUrl: "/tendermint.types.VersionParams", + is(o: any): o is VersionParams { + return o && (o.$typeUrl === VersionParams.typeUrl || typeof o.appVersion === "bigint"); + }, + isSDK(o: any): o is VersionParamsSDKType { + return o && (o.$typeUrl === VersionParams.typeUrl || typeof o.app_version === "bigint"); + }, + isAmino(o: any): o is VersionParamsAmino { + return o && (o.$typeUrl === VersionParams.typeUrl || typeof o.app_version === "bigint"); + }, encode(message: VersionParams, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.appVersion !== BigInt(0)) { writer.uint32(8).uint64(message.appVersion); @@ -902,7 +960,8 @@ export const VersionParams = { typeUrl: "/tendermint.types.VersionParams", value: VersionParams.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseHashedParams(): HashedParams { return { @@ -920,6 +979,15 @@ function createBaseHashedParams(): HashedParams { */ export const HashedParams = { typeUrl: "/tendermint.types.HashedParams", + is(o: any): o is HashedParams { + return o && (o.$typeUrl === HashedParams.typeUrl || typeof o.blockMaxBytes === "bigint" && typeof o.blockMaxGas === "bigint"); + }, + isSDK(o: any): o is HashedParamsSDKType { + return o && (o.$typeUrl === HashedParams.typeUrl || typeof o.block_max_bytes === "bigint" && typeof o.block_max_gas === "bigint"); + }, + isAmino(o: any): o is HashedParamsAmino { + return o && (o.$typeUrl === HashedParams.typeUrl || typeof o.block_max_bytes === "bigint" && typeof o.block_max_gas === "bigint"); + }, encode(message: HashedParams, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.blockMaxBytes !== BigInt(0)) { writer.uint32(8).int64(message.blockMaxBytes); @@ -1013,5 +1081,6 @@ export const HashedParams = { typeUrl: "/tendermint.types.HashedParams", value: HashedParams.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/tendermint/types/types.ts b/__fixtures__/v-next/outputv2/tendermint/types/types.ts index 4062e332ac..5211a01037 100644 --- a/__fixtures__/v-next/outputv2/tendermint/types/types.ts +++ b/__fixtures__/v-next/outputv2/tendermint/types/types.ts @@ -5,6 +5,7 @@ import { ValidatorSet, ValidatorSetAmino, ValidatorSetSDKType } from "./validato import { BinaryReader, BinaryWriter } from "../../binary"; import { isSet, bytesFromBase64, base64FromBytes, DeepPartial, toTimestamp, fromTimestamp } from "../../helpers"; import { JsonSafe } from "../../json-safe"; +import { GlobalDecoderRegistry } from "../../registry"; export const protobufPackage = "tendermint.types"; /** BlockIdFlag indicates which BlcokID the signature is for */ export enum BlockIDFlag { @@ -766,6 +767,15 @@ function createBasePartSetHeader(): PartSetHeader { */ export const PartSetHeader = { typeUrl: "/tendermint.types.PartSetHeader", + is(o: any): o is PartSetHeader { + return o && (o.$typeUrl === PartSetHeader.typeUrl || typeof o.total === "number" && (o.hash instanceof Uint8Array || typeof o.hash === "string")); + }, + isSDK(o: any): o is PartSetHeaderSDKType { + return o && (o.$typeUrl === PartSetHeader.typeUrl || typeof o.total === "number" && (o.hash instanceof Uint8Array || typeof o.hash === "string")); + }, + isAmino(o: any): o is PartSetHeaderAmino { + return o && (o.$typeUrl === PartSetHeader.typeUrl || typeof o.total === "number" && (o.hash instanceof Uint8Array || typeof o.hash === "string")); + }, encode(message: PartSetHeader, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.total !== 0) { writer.uint32(8).uint32(message.total); @@ -855,7 +865,8 @@ export const PartSetHeader = { typeUrl: "/tendermint.types.PartSetHeader", value: PartSetHeader.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBasePart(): Part { return { @@ -871,6 +882,15 @@ function createBasePart(): Part { */ export const Part = { typeUrl: "/tendermint.types.Part", + is(o: any): o is Part { + return o && (o.$typeUrl === Part.typeUrl || typeof o.index === "number" && (o.bytes instanceof Uint8Array || typeof o.bytes === "string") && Proof.is(o.proof)); + }, + isSDK(o: any): o is PartSDKType { + return o && (o.$typeUrl === Part.typeUrl || typeof o.index === "number" && (o.bytes instanceof Uint8Array || typeof o.bytes === "string") && Proof.isSDK(o.proof)); + }, + isAmino(o: any): o is PartAmino { + return o && (o.$typeUrl === Part.typeUrl || typeof o.index === "number" && (o.bytes instanceof Uint8Array || typeof o.bytes === "string") && Proof.isAmino(o.proof)); + }, encode(message: Part, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.index !== 0) { writer.uint32(8).uint32(message.index); @@ -977,6 +997,12 @@ export const Part = { typeUrl: "/tendermint.types.Part", value: Part.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Part.typeUrl)) { + return; + } + Proof.registerTypeUrl(); } }; function createBaseBlockID(): BlockID { @@ -993,6 +1019,15 @@ function createBaseBlockID(): BlockID { */ export const BlockID = { typeUrl: "/tendermint.types.BlockID", + is(o: any): o is BlockID { + return o && (o.$typeUrl === BlockID.typeUrl || (o.hash instanceof Uint8Array || typeof o.hash === "string") && PartSetHeader.is(o.partSetHeader)); + }, + isSDK(o: any): o is BlockIDSDKType { + return o && (o.$typeUrl === BlockID.typeUrl || (o.hash instanceof Uint8Array || typeof o.hash === "string") && PartSetHeader.isSDK(o.part_set_header)); + }, + isAmino(o: any): o is BlockIDAmino { + return o && (o.$typeUrl === BlockID.typeUrl || (o.hash instanceof Uint8Array || typeof o.hash === "string") && PartSetHeader.isAmino(o.part_set_header)); + }, encode(message: BlockID, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.hash.length !== 0) { writer.uint32(10).bytes(message.hash); @@ -1084,6 +1119,12 @@ export const BlockID = { typeUrl: "/tendermint.types.BlockID", value: BlockID.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(BlockID.typeUrl)) { + return; + } + PartSetHeader.registerTypeUrl(); } }; function createBaseHeader(): Header { @@ -1112,6 +1153,15 @@ function createBaseHeader(): Header { */ export const Header = { typeUrl: "/tendermint.types.Header", + is(o: any): o is Header { + return o && (o.$typeUrl === Header.typeUrl || Consensus.is(o.version) && typeof o.chainId === "string" && typeof o.height === "bigint" && Timestamp.is(o.time) && BlockID.is(o.lastBlockId) && (o.lastCommitHash instanceof Uint8Array || typeof o.lastCommitHash === "string") && (o.dataHash instanceof Uint8Array || typeof o.dataHash === "string") && (o.validatorsHash instanceof Uint8Array || typeof o.validatorsHash === "string") && (o.nextValidatorsHash instanceof Uint8Array || typeof o.nextValidatorsHash === "string") && (o.consensusHash instanceof Uint8Array || typeof o.consensusHash === "string") && (o.appHash instanceof Uint8Array || typeof o.appHash === "string") && (o.lastResultsHash instanceof Uint8Array || typeof o.lastResultsHash === "string") && (o.evidenceHash instanceof Uint8Array || typeof o.evidenceHash === "string") && (o.proposerAddress instanceof Uint8Array || typeof o.proposerAddress === "string")); + }, + isSDK(o: any): o is HeaderSDKType { + return o && (o.$typeUrl === Header.typeUrl || Consensus.isSDK(o.version) && typeof o.chain_id === "string" && typeof o.height === "bigint" && Timestamp.isSDK(o.time) && BlockID.isSDK(o.last_block_id) && (o.last_commit_hash instanceof Uint8Array || typeof o.last_commit_hash === "string") && (o.data_hash instanceof Uint8Array || typeof o.data_hash === "string") && (o.validators_hash instanceof Uint8Array || typeof o.validators_hash === "string") && (o.next_validators_hash instanceof Uint8Array || typeof o.next_validators_hash === "string") && (o.consensus_hash instanceof Uint8Array || typeof o.consensus_hash === "string") && (o.app_hash instanceof Uint8Array || typeof o.app_hash === "string") && (o.last_results_hash instanceof Uint8Array || typeof o.last_results_hash === "string") && (o.evidence_hash instanceof Uint8Array || typeof o.evidence_hash === "string") && (o.proposer_address instanceof Uint8Array || typeof o.proposer_address === "string")); + }, + isAmino(o: any): o is HeaderAmino { + return o && (o.$typeUrl === Header.typeUrl || Consensus.isAmino(o.version) && typeof o.chain_id === "string" && typeof o.height === "bigint" && Timestamp.isAmino(o.time) && BlockID.isAmino(o.last_block_id) && (o.last_commit_hash instanceof Uint8Array || typeof o.last_commit_hash === "string") && (o.data_hash instanceof Uint8Array || typeof o.data_hash === "string") && (o.validators_hash instanceof Uint8Array || typeof o.validators_hash === "string") && (o.next_validators_hash instanceof Uint8Array || typeof o.next_validators_hash === "string") && (o.consensus_hash instanceof Uint8Array || typeof o.consensus_hash === "string") && (o.app_hash instanceof Uint8Array || typeof o.app_hash === "string") && (o.last_results_hash instanceof Uint8Array || typeof o.last_results_hash === "string") && (o.evidence_hash instanceof Uint8Array || typeof o.evidence_hash === "string") && (o.proposer_address instanceof Uint8Array || typeof o.proposer_address === "string")); + }, encode(message: Header, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.version !== undefined) { Consensus.encode(message.version, writer.uint32(10).fork()).ldelim(); @@ -1387,6 +1437,13 @@ export const Header = { typeUrl: "/tendermint.types.Header", value: Header.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Header.typeUrl)) { + return; + } + Consensus.registerTypeUrl(); + BlockID.registerTypeUrl(); } }; function createBaseData(): Data { @@ -1402,6 +1459,15 @@ function createBaseData(): Data { */ export const Data = { typeUrl: "/tendermint.types.Data", + is(o: any): o is Data { + return o && (o.$typeUrl === Data.typeUrl || Array.isArray(o.txs) && (!o.txs.length || o.txs[0] instanceof Uint8Array || typeof o.txs[0] === "string")); + }, + isSDK(o: any): o is DataSDKType { + return o && (o.$typeUrl === Data.typeUrl || Array.isArray(o.txs) && (!o.txs.length || o.txs[0] instanceof Uint8Array || typeof o.txs[0] === "string")); + }, + isAmino(o: any): o is DataAmino { + return o && (o.$typeUrl === Data.typeUrl || Array.isArray(o.txs) && (!o.txs.length || o.txs[0] instanceof Uint8Array || typeof o.txs[0] === "string")); + }, encode(message: Data, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.txs) { writer.uint32(10).bytes(v!); @@ -1486,7 +1552,8 @@ export const Data = { typeUrl: "/tendermint.types.Data", value: Data.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseVote(): Vote { return { @@ -1509,6 +1576,15 @@ function createBaseVote(): Vote { */ export const Vote = { typeUrl: "/tendermint.types.Vote", + is(o: any): o is Vote { + return o && (o.$typeUrl === Vote.typeUrl || isSet(o.type) && typeof o.height === "bigint" && typeof o.round === "number" && BlockID.is(o.blockId) && Timestamp.is(o.timestamp) && (o.validatorAddress instanceof Uint8Array || typeof o.validatorAddress === "string") && typeof o.validatorIndex === "number" && (o.signature instanceof Uint8Array || typeof o.signature === "string")); + }, + isSDK(o: any): o is VoteSDKType { + return o && (o.$typeUrl === Vote.typeUrl || isSet(o.type) && typeof o.height === "bigint" && typeof o.round === "number" && BlockID.isSDK(o.block_id) && Timestamp.isSDK(o.timestamp) && (o.validator_address instanceof Uint8Array || typeof o.validator_address === "string") && typeof o.validator_index === "number" && (o.signature instanceof Uint8Array || typeof o.signature === "string")); + }, + isAmino(o: any): o is VoteAmino { + return o && (o.$typeUrl === Vote.typeUrl || isSet(o.type) && typeof o.height === "bigint" && typeof o.round === "number" && BlockID.isAmino(o.block_id) && Timestamp.isAmino(o.timestamp) && (o.validator_address instanceof Uint8Array || typeof o.validator_address === "string") && typeof o.validator_index === "number" && (o.signature instanceof Uint8Array || typeof o.signature === "string")); + }, encode(message: Vote, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.type !== 0) { writer.uint32(8).int32(message.type); @@ -1692,6 +1768,12 @@ export const Vote = { typeUrl: "/tendermint.types.Vote", value: Vote.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Vote.typeUrl)) { + return; + } + BlockID.registerTypeUrl(); } }; function createBaseCommit(): Commit { @@ -1710,6 +1792,15 @@ function createBaseCommit(): Commit { */ export const Commit = { typeUrl: "/tendermint.types.Commit", + is(o: any): o is Commit { + return o && (o.$typeUrl === Commit.typeUrl || typeof o.height === "bigint" && typeof o.round === "number" && BlockID.is(o.blockId) && Array.isArray(o.signatures) && (!o.signatures.length || CommitSig.is(o.signatures[0]))); + }, + isSDK(o: any): o is CommitSDKType { + return o && (o.$typeUrl === Commit.typeUrl || typeof o.height === "bigint" && typeof o.round === "number" && BlockID.isSDK(o.block_id) && Array.isArray(o.signatures) && (!o.signatures.length || CommitSig.isSDK(o.signatures[0]))); + }, + isAmino(o: any): o is CommitAmino { + return o && (o.$typeUrl === Commit.typeUrl || typeof o.height === "bigint" && typeof o.round === "number" && BlockID.isAmino(o.block_id) && Array.isArray(o.signatures) && (!o.signatures.length || CommitSig.isAmino(o.signatures[0]))); + }, encode(message: Commit, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.height !== BigInt(0)) { writer.uint32(8).int64(message.height); @@ -1843,6 +1934,13 @@ export const Commit = { typeUrl: "/tendermint.types.Commit", value: Commit.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Commit.typeUrl)) { + return; + } + BlockID.registerTypeUrl(); + CommitSig.registerTypeUrl(); } }; function createBaseCommitSig(): CommitSig { @@ -1861,6 +1959,15 @@ function createBaseCommitSig(): CommitSig { */ export const CommitSig = { typeUrl: "/tendermint.types.CommitSig", + is(o: any): o is CommitSig { + return o && (o.$typeUrl === CommitSig.typeUrl || isSet(o.blockIdFlag) && (o.validatorAddress instanceof Uint8Array || typeof o.validatorAddress === "string") && Timestamp.is(o.timestamp) && (o.signature instanceof Uint8Array || typeof o.signature === "string")); + }, + isSDK(o: any): o is CommitSigSDKType { + return o && (o.$typeUrl === CommitSig.typeUrl || isSet(o.block_id_flag) && (o.validator_address instanceof Uint8Array || typeof o.validator_address === "string") && Timestamp.isSDK(o.timestamp) && (o.signature instanceof Uint8Array || typeof o.signature === "string")); + }, + isAmino(o: any): o is CommitSigAmino { + return o && (o.$typeUrl === CommitSig.typeUrl || isSet(o.block_id_flag) && (o.validator_address instanceof Uint8Array || typeof o.validator_address === "string") && Timestamp.isAmino(o.timestamp) && (o.signature instanceof Uint8Array || typeof o.signature === "string")); + }, encode(message: CommitSig, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.blockIdFlag !== 0) { writer.uint32(8).int32(message.blockIdFlag); @@ -1980,7 +2087,8 @@ export const CommitSig = { typeUrl: "/tendermint.types.CommitSig", value: CommitSig.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseProposal(): Proposal { return { @@ -2000,6 +2108,15 @@ function createBaseProposal(): Proposal { */ export const Proposal = { typeUrl: "/tendermint.types.Proposal", + is(o: any): o is Proposal { + return o && (o.$typeUrl === Proposal.typeUrl || isSet(o.type) && typeof o.height === "bigint" && typeof o.round === "number" && typeof o.polRound === "number" && BlockID.is(o.blockId) && Timestamp.is(o.timestamp) && (o.signature instanceof Uint8Array || typeof o.signature === "string")); + }, + isSDK(o: any): o is ProposalSDKType { + return o && (o.$typeUrl === Proposal.typeUrl || isSet(o.type) && typeof o.height === "bigint" && typeof o.round === "number" && typeof o.pol_round === "number" && BlockID.isSDK(o.block_id) && Timestamp.isSDK(o.timestamp) && (o.signature instanceof Uint8Array || typeof o.signature === "string")); + }, + isAmino(o: any): o is ProposalAmino { + return o && (o.$typeUrl === Proposal.typeUrl || isSet(o.type) && typeof o.height === "bigint" && typeof o.round === "number" && typeof o.pol_round === "number" && BlockID.isAmino(o.block_id) && Timestamp.isAmino(o.timestamp) && (o.signature instanceof Uint8Array || typeof o.signature === "string")); + }, encode(message: Proposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.type !== 0) { writer.uint32(8).int32(message.type); @@ -2168,6 +2285,12 @@ export const Proposal = { typeUrl: "/tendermint.types.Proposal", value: Proposal.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Proposal.typeUrl)) { + return; + } + BlockID.registerTypeUrl(); } }; function createBaseSignedHeader(): SignedHeader { @@ -2183,6 +2306,15 @@ function createBaseSignedHeader(): SignedHeader { */ export const SignedHeader = { typeUrl: "/tendermint.types.SignedHeader", + is(o: any): o is SignedHeader { + return o && o.$typeUrl === SignedHeader.typeUrl; + }, + isSDK(o: any): o is SignedHeaderSDKType { + return o && o.$typeUrl === SignedHeader.typeUrl; + }, + isAmino(o: any): o is SignedHeaderAmino { + return o && o.$typeUrl === SignedHeader.typeUrl; + }, encode(message: SignedHeader, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.header !== undefined) { Header.encode(message.header, writer.uint32(10).fork()).ldelim(); @@ -2276,6 +2408,13 @@ export const SignedHeader = { typeUrl: "/tendermint.types.SignedHeader", value: SignedHeader.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(SignedHeader.typeUrl)) { + return; + } + Header.registerTypeUrl(); + Commit.registerTypeUrl(); } }; function createBaseLightBlock(): LightBlock { @@ -2291,6 +2430,15 @@ function createBaseLightBlock(): LightBlock { */ export const LightBlock = { typeUrl: "/tendermint.types.LightBlock", + is(o: any): o is LightBlock { + return o && o.$typeUrl === LightBlock.typeUrl; + }, + isSDK(o: any): o is LightBlockSDKType { + return o && o.$typeUrl === LightBlock.typeUrl; + }, + isAmino(o: any): o is LightBlockAmino { + return o && o.$typeUrl === LightBlock.typeUrl; + }, encode(message: LightBlock, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.signedHeader !== undefined) { SignedHeader.encode(message.signedHeader, writer.uint32(10).fork()).ldelim(); @@ -2384,6 +2532,13 @@ export const LightBlock = { typeUrl: "/tendermint.types.LightBlock", value: LightBlock.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(LightBlock.typeUrl)) { + return; + } + SignedHeader.registerTypeUrl(); + ValidatorSet.registerTypeUrl(); } }; function createBaseBlockMeta(): BlockMeta { @@ -2401,6 +2556,15 @@ function createBaseBlockMeta(): BlockMeta { */ export const BlockMeta = { typeUrl: "/tendermint.types.BlockMeta", + is(o: any): o is BlockMeta { + return o && (o.$typeUrl === BlockMeta.typeUrl || BlockID.is(o.blockId) && typeof o.blockSize === "bigint" && Header.is(o.header) && typeof o.numTxs === "bigint"); + }, + isSDK(o: any): o is BlockMetaSDKType { + return o && (o.$typeUrl === BlockMeta.typeUrl || BlockID.isSDK(o.block_id) && typeof o.block_size === "bigint" && Header.isSDK(o.header) && typeof o.num_txs === "bigint"); + }, + isAmino(o: any): o is BlockMetaAmino { + return o && (o.$typeUrl === BlockMeta.typeUrl || BlockID.isAmino(o.block_id) && typeof o.block_size === "bigint" && Header.isAmino(o.header) && typeof o.num_txs === "bigint"); + }, encode(message: BlockMeta, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.blockId !== undefined) { BlockID.encode(message.blockId, writer.uint32(10).fork()).ldelim(); @@ -2528,6 +2692,13 @@ export const BlockMeta = { typeUrl: "/tendermint.types.BlockMeta", value: BlockMeta.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(BlockMeta.typeUrl)) { + return; + } + BlockID.registerTypeUrl(); + Header.registerTypeUrl(); } }; function createBaseTxProof(): TxProof { @@ -2545,6 +2716,15 @@ function createBaseTxProof(): TxProof { */ export const TxProof = { typeUrl: "/tendermint.types.TxProof", + is(o: any): o is TxProof { + return o && (o.$typeUrl === TxProof.typeUrl || (o.rootHash instanceof Uint8Array || typeof o.rootHash === "string") && (o.data instanceof Uint8Array || typeof o.data === "string")); + }, + isSDK(o: any): o is TxProofSDKType { + return o && (o.$typeUrl === TxProof.typeUrl || (o.root_hash instanceof Uint8Array || typeof o.root_hash === "string") && (o.data instanceof Uint8Array || typeof o.data === "string")); + }, + isAmino(o: any): o is TxProofAmino { + return o && (o.$typeUrl === TxProof.typeUrl || (o.root_hash instanceof Uint8Array || typeof o.root_hash === "string") && (o.data instanceof Uint8Array || typeof o.data === "string")); + }, encode(message: TxProof, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.rootHash.length !== 0) { writer.uint32(10).bytes(message.rootHash); @@ -2651,5 +2831,11 @@ export const TxProof = { typeUrl: "/tendermint.types.TxProof", value: TxProof.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(TxProof.typeUrl)) { + return; + } + Proof.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/tendermint/types/validator.ts b/__fixtures__/v-next/outputv2/tendermint/types/validator.ts index 841b37e533..a68af15b17 100644 --- a/__fixtures__/v-next/outputv2/tendermint/types/validator.ts +++ b/__fixtures__/v-next/outputv2/tendermint/types/validator.ts @@ -1,5 +1,6 @@ import { PublicKey, PublicKeyAmino, PublicKeySDKType } from "../crypto/keys"; import { BinaryReader, BinaryWriter } from "../../binary"; +import { GlobalDecoderRegistry } from "../../registry"; import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../helpers"; import { JsonSafe } from "../../json-safe"; export const protobufPackage = "tendermint.types"; @@ -131,6 +132,15 @@ function createBaseValidatorSet(): ValidatorSet { */ export const ValidatorSet = { typeUrl: "/tendermint.types.ValidatorSet", + is(o: any): o is ValidatorSet { + return o && (o.$typeUrl === ValidatorSet.typeUrl || Array.isArray(o.validators) && (!o.validators.length || Validator.is(o.validators[0])) && typeof o.totalVotingPower === "bigint"); + }, + isSDK(o: any): o is ValidatorSetSDKType { + return o && (o.$typeUrl === ValidatorSet.typeUrl || Array.isArray(o.validators) && (!o.validators.length || Validator.isSDK(o.validators[0])) && typeof o.total_voting_power === "bigint"); + }, + isAmino(o: any): o is ValidatorSetAmino { + return o && (o.$typeUrl === ValidatorSet.typeUrl || Array.isArray(o.validators) && (!o.validators.length || Validator.isAmino(o.validators[0])) && typeof o.total_voting_power === "bigint"); + }, encode(message: ValidatorSet, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.validators) { Validator.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -249,6 +259,12 @@ export const ValidatorSet = { typeUrl: "/tendermint.types.ValidatorSet", value: ValidatorSet.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ValidatorSet.typeUrl)) { + return; + } + Validator.registerTypeUrl(); } }; function createBaseValidator(): Validator { @@ -266,6 +282,15 @@ function createBaseValidator(): Validator { */ export const Validator = { typeUrl: "/tendermint.types.Validator", + is(o: any): o is Validator { + return o && (o.$typeUrl === Validator.typeUrl || (o.address instanceof Uint8Array || typeof o.address === "string") && PublicKey.is(o.pubKey) && typeof o.votingPower === "bigint" && typeof o.proposerPriority === "bigint"); + }, + isSDK(o: any): o is ValidatorSDKType { + return o && (o.$typeUrl === Validator.typeUrl || (o.address instanceof Uint8Array || typeof o.address === "string") && PublicKey.isSDK(o.pub_key) && typeof o.voting_power === "bigint" && typeof o.proposer_priority === "bigint"); + }, + isAmino(o: any): o is ValidatorAmino { + return o && (o.$typeUrl === Validator.typeUrl || (o.address instanceof Uint8Array || typeof o.address === "string") && PublicKey.isAmino(o.pub_key) && typeof o.voting_power === "bigint" && typeof o.proposer_priority === "bigint"); + }, encode(message: Validator, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.address.length !== 0) { writer.uint32(10).bytes(message.address); @@ -391,6 +416,12 @@ export const Validator = { typeUrl: "/tendermint.types.Validator", value: Validator.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Validator.typeUrl)) { + return; + } + PublicKey.registerTypeUrl(); } }; function createBaseSimpleValidator(): SimpleValidator { @@ -406,6 +437,15 @@ function createBaseSimpleValidator(): SimpleValidator { */ export const SimpleValidator = { typeUrl: "/tendermint.types.SimpleValidator", + is(o: any): o is SimpleValidator { + return o && (o.$typeUrl === SimpleValidator.typeUrl || typeof o.votingPower === "bigint"); + }, + isSDK(o: any): o is SimpleValidatorSDKType { + return o && (o.$typeUrl === SimpleValidator.typeUrl || typeof o.voting_power === "bigint"); + }, + isAmino(o: any): o is SimpleValidatorAmino { + return o && (o.$typeUrl === SimpleValidator.typeUrl || typeof o.voting_power === "bigint"); + }, encode(message: SimpleValidator, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.pubKey !== undefined) { PublicKey.encode(message.pubKey, writer.uint32(10).fork()).ldelim(); @@ -499,5 +539,11 @@ export const SimpleValidator = { typeUrl: "/tendermint.types.SimpleValidator", value: SimpleValidator.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(SimpleValidator.typeUrl)) { + return; + } + PublicKey.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/tendermint/version/types.ts b/__fixtures__/v-next/outputv2/tendermint/version/types.ts index a398fbac3d..a23aaecb96 100644 --- a/__fixtures__/v-next/outputv2/tendermint/version/types.ts +++ b/__fixtures__/v-next/outputv2/tendermint/version/types.ts @@ -106,6 +106,15 @@ function createBaseApp(): App { */ export const App = { typeUrl: "/tendermint.version.App", + is(o: any): o is App { + return o && (o.$typeUrl === App.typeUrl || typeof o.protocol === "bigint" && typeof o.software === "string"); + }, + isSDK(o: any): o is AppSDKType { + return o && (o.$typeUrl === App.typeUrl || typeof o.protocol === "bigint" && typeof o.software === "string"); + }, + isAmino(o: any): o is AppAmino { + return o && (o.$typeUrl === App.typeUrl || typeof o.protocol === "bigint" && typeof o.software === "string"); + }, encode(message: App, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.protocol !== BigInt(0)) { writer.uint32(8).uint64(message.protocol); @@ -197,7 +206,8 @@ export const App = { typeUrl: "/tendermint.version.App", value: App.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseConsensus(): Consensus { return { @@ -215,6 +225,15 @@ function createBaseConsensus(): Consensus { */ export const Consensus = { typeUrl: "/tendermint.version.Consensus", + is(o: any): o is Consensus { + return o && (o.$typeUrl === Consensus.typeUrl || typeof o.block === "bigint" && typeof o.app === "bigint"); + }, + isSDK(o: any): o is ConsensusSDKType { + return o && (o.$typeUrl === Consensus.typeUrl || typeof o.block === "bigint" && typeof o.app === "bigint"); + }, + isAmino(o: any): o is ConsensusAmino { + return o && (o.$typeUrl === Consensus.typeUrl || typeof o.block === "bigint" && typeof o.app === "bigint"); + }, encode(message: Consensus, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.block !== BigInt(0)) { writer.uint32(8).uint64(message.block); @@ -308,5 +327,6 @@ export const Consensus = { typeUrl: "/tendermint.version.Consensus", value: Consensus.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv2/types.ts b/__fixtures__/v-next/outputv2/types.ts new file mode 100644 index 0000000000..1acee677e2 --- /dev/null +++ b/__fixtures__/v-next/outputv2/types.ts @@ -0,0 +1,109 @@ +/** +* This file and any referenced files were automatically generated by @hyperweb/telescope@latest +* DO NOT MODIFY BY HAND. Instead, download the latest proto files for your chain +* and run the transpile command or npm scripts command that is used to regenerate this bundle. +*/ + +import { IBinaryReader, IBinaryWriter } from "./binary"; +import { Any } from "./google/protobuf/any"; + +import { HttpEndpoint } from "@interchainjs/types"; + + +import { DeliverTxResponse, Event, Attribute } from "@interchainjs/types"; + +export { DeliverTxResponse } + + +export type ProtoMsg = Omit & { typeUrl: any }; + +export interface IAminoMsg { + type: any; + value: Amino; +} + +export interface IProtoType { + $typeUrl?: any; +} + +/** + * A type generated by Telescope 1.0. + */ +export interface TelescopeGeneratedCodec< + T = unknown, + SDK = unknown, + Amino = unknown +> { + readonly typeUrl: string; + readonly aminoType?: string; + is?(o: unknown): o is T; + isSDK?(o: unknown): o is SDK; + isAmino?(o: unknown): o is Amino; + encode: (message: T, writer?: IBinaryWriter | any) => IBinaryWriter | any; + decode: (input: IBinaryReader | Uint8Array | any, length?: number) => T; + fromPartial: (object: any) => T | any; + fromJSON?: (object: any) => T | any; + toJSON?: (message: T | any) => any; + fromSDK?: (sdk: SDK) => T; + fromSDKJSON?: (object: any) => SDK; + toSDK?: (message: T) => SDK; + fromAmino?: (amino: Amino) => T; + toAmino?: (message: T) => Amino; + fromAminoMsg?: (aminoMsg: IAminoMsg) => T; + toAminoMsg?: (message: T) => IAminoMsg; + toProto?: (message: T) => Uint8Array; + fromProtoMsg?: (message: ProtoMsg) => T; + toProtoMsg?: (message: T) => Any; + registerTypeUrl?: () => void; +} + +export type TelescopeGeneratedType< + T = unknown, + SDK = unknown, + Amino = unknown +> = TelescopeGeneratedCodec; + +export type GeneratedType = TelescopeGeneratedCodec; + +/** + * Coin defines a token with a denomination and an amount. + * + * NOTE: The amount field is an Int which implements the custom method + * signatures required by gogoproto. + */ +interface Coin { + denom: string; + amount: string; +} + +export type EncodeObject = Message; + +export interface Message { + typeUrl: string; + value: T; +} + +export interface StdFee { + amount: Coin[]; + gas: string; + /** The granter address that is used for paying with feegrants */ + granter?: string; + /** The fee payer address. The payer must have signed the transaction. */ + payer?: string; +} + + +export interface TxRpc { + request( + service: string, + method: string, + data: Uint8Array + ): Promise; + signAndBroadcast?( + signerAddress: string, + messages: EncodeObject[], + fee: StdFee | "auto" | number, + memo: string + ): Promise; +} + diff --git a/__fixtures__/v-next/outputv3/akash/audit/v1beta1/audit.registry.ts b/__fixtures__/v-next/outputv3/akash/audit/v1beta1/audit.registry.ts index 780f765520..7fd5f4324a 100644 --- a/__fixtures__/v-next/outputv3/akash/audit/v1beta1/audit.registry.ts +++ b/__fixtures__/v-next/outputv3/akash/audit/v1beta1/audit.registry.ts @@ -1,12 +1,7 @@ import { Attribute, AttributeSDKType } from "../../base/v1beta1/attribute"; -import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { TelescopeGeneratedType } from "../../../types"; import { MsgSignProviderAttributes, MsgSignProviderAttributesSDKType, MsgDeleteProviderAttributes, MsgDeleteProviderAttributesSDKType } from "./audit"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/akash.audit.v1beta1.MsgSignProviderAttributes", MsgSignProviderAttributes], ["/akash.audit.v1beta1.MsgDeleteProviderAttributes", MsgDeleteProviderAttributes]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/akash.audit.v1beta1.MsgSignProviderAttributes", MsgSignProviderAttributes], ["/akash.audit.v1beta1.MsgDeleteProviderAttributes", MsgDeleteProviderAttributes]]; export const MessageComposer = { encoded: { signProviderAttributes(value: MsgSignProviderAttributes) { diff --git a/__fixtures__/v-next/outputv3/akash/audit/v1beta1/audit.rpc.func.ts b/__fixtures__/v-next/outputv3/akash/audit/v1beta1/audit.rpc.func.ts new file mode 100644 index 0000000000..2c7f66ceab --- /dev/null +++ b/__fixtures__/v-next/outputv3/akash/audit/v1beta1/audit.rpc.func.ts @@ -0,0 +1,21 @@ +import { Attribute, AttributeSDKType } from "../../base/v1beta1/attribute"; +import { buildTx } from "../../../helper-func-types"; +import { MsgSignProviderAttributes, MsgSignProviderAttributesSDKType, MsgSignProviderAttributesResponse, MsgSignProviderAttributesResponseSDKType, MsgDeleteProviderAttributes, MsgDeleteProviderAttributesSDKType, MsgDeleteProviderAttributesResponse, MsgDeleteProviderAttributesResponseSDKType } from "./audit"; +/** + * SignProviderAttributes defines a method that signs provider attributes + * @name signProviderAttributes + * @package akash.audit.v1beta1 + * @see proto service: akash.audit.v1beta1.SignProviderAttributes + */ +export const signProviderAttributes = buildTx({ + msg: MsgSignProviderAttributes +}); +/** + * DeleteProviderAttributes defines a method that deletes provider attributes + * @name deleteProviderAttributes + * @package akash.audit.v1beta1 + * @see proto service: akash.audit.v1beta1.DeleteProviderAttributes + */ +export const deleteProviderAttributes = buildTx({ + msg: MsgDeleteProviderAttributes +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/akash/audit/v1beta1/audit.ts b/__fixtures__/v-next/outputv3/akash/audit/v1beta1/audit.ts index 787b587439..1a83e72abc 100644 --- a/__fixtures__/v-next/outputv3/akash/audit/v1beta1/audit.ts +++ b/__fixtures__/v-next/outputv3/akash/audit/v1beta1/audit.ts @@ -1,6 +1,7 @@ import { Attribute, AttributeAmino, AttributeSDKType } from "../../base/v1beta1/attribute"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { isSet, DeepPartial } from "../../../helpers"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "akash.audit.v1beta1"; /** * Provider stores owner auditor and attributes details @@ -280,6 +281,15 @@ function createBaseProvider(): Provider { */ export const Provider = { typeUrl: "/akash.audit.v1beta1.Provider", + is(o: any): o is Provider { + return o && (o.$typeUrl === Provider.typeUrl || typeof o.owner === "string" && typeof o.auditor === "string" && Array.isArray(o.attributes) && (!o.attributes.length || Attribute.is(o.attributes[0]))); + }, + isSDK(o: any): o is ProviderSDKType { + return o && (o.$typeUrl === Provider.typeUrl || typeof o.owner === "string" && typeof o.auditor === "string" && Array.isArray(o.attributes) && (!o.attributes.length || Attribute.isSDK(o.attributes[0]))); + }, + isAmino(o: any): o is ProviderAmino { + return o && (o.$typeUrl === Provider.typeUrl || typeof o.owner === "string" && typeof o.auditor === "string" && Array.isArray(o.attributes) && (!o.attributes.length || Attribute.isAmino(o.attributes[0]))); + }, encode(message: Provider, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.owner !== "") { writer.uint32(10).string(message.owner); @@ -380,6 +390,12 @@ export const Provider = { typeUrl: "/akash.audit.v1beta1.Provider", value: Provider.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Provider.typeUrl)) { + return; + } + Attribute.registerTypeUrl(); } }; function createBaseAuditedAttributes(): AuditedAttributes { @@ -397,6 +413,15 @@ function createBaseAuditedAttributes(): AuditedAttributes { */ export const AuditedAttributes = { typeUrl: "/akash.audit.v1beta1.AuditedAttributes", + is(o: any): o is AuditedAttributes { + return o && (o.$typeUrl === AuditedAttributes.typeUrl || typeof o.owner === "string" && typeof o.auditor === "string" && Array.isArray(o.attributes) && (!o.attributes.length || Attribute.is(o.attributes[0]))); + }, + isSDK(o: any): o is AuditedAttributesSDKType { + return o && (o.$typeUrl === AuditedAttributes.typeUrl || typeof o.owner === "string" && typeof o.auditor === "string" && Array.isArray(o.attributes) && (!o.attributes.length || Attribute.isSDK(o.attributes[0]))); + }, + isAmino(o: any): o is AuditedAttributesAmino { + return o && (o.$typeUrl === AuditedAttributes.typeUrl || typeof o.owner === "string" && typeof o.auditor === "string" && Array.isArray(o.attributes) && (!o.attributes.length || Attribute.isAmino(o.attributes[0]))); + }, encode(message: AuditedAttributes, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.owner !== "") { writer.uint32(10).string(message.owner); @@ -497,6 +522,12 @@ export const AuditedAttributes = { typeUrl: "/akash.audit.v1beta1.AuditedAttributes", value: AuditedAttributes.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(AuditedAttributes.typeUrl)) { + return; + } + Attribute.registerTypeUrl(); } }; function createBaseAttributesResponse(): AttributesResponse { @@ -512,6 +543,15 @@ function createBaseAttributesResponse(): AttributesResponse { */ export const AttributesResponse = { typeUrl: "/akash.audit.v1beta1.AttributesResponse", + is(o: any): o is AttributesResponse { + return o && (o.$typeUrl === AttributesResponse.typeUrl || Array.isArray(o.attributes) && (!o.attributes.length || AuditedAttributes.is(o.attributes[0]))); + }, + isSDK(o: any): o is AttributesResponseSDKType { + return o && (o.$typeUrl === AttributesResponse.typeUrl || Array.isArray(o.attributes) && (!o.attributes.length || AuditedAttributes.isSDK(o.attributes[0]))); + }, + isAmino(o: any): o is AttributesResponseAmino { + return o && (o.$typeUrl === AttributesResponse.typeUrl || Array.isArray(o.attributes) && (!o.attributes.length || AuditedAttributes.isAmino(o.attributes[0]))); + }, encode(message: AttributesResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.attributes) { AuditedAttributes.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -584,6 +624,12 @@ export const AttributesResponse = { typeUrl: "/akash.audit.v1beta1.AttributesResponse", value: AttributesResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(AttributesResponse.typeUrl)) { + return; + } + AuditedAttributes.registerTypeUrl(); } }; function createBaseAttributesFilters(): AttributesFilters { @@ -600,6 +646,15 @@ function createBaseAttributesFilters(): AttributesFilters { */ export const AttributesFilters = { typeUrl: "/akash.audit.v1beta1.AttributesFilters", + is(o: any): o is AttributesFilters { + return o && (o.$typeUrl === AttributesFilters.typeUrl || Array.isArray(o.auditors) && (!o.auditors.length || typeof o.auditors[0] === "string") && Array.isArray(o.owners) && (!o.owners.length || typeof o.owners[0] === "string")); + }, + isSDK(o: any): o is AttributesFiltersSDKType { + return o && (o.$typeUrl === AttributesFilters.typeUrl || Array.isArray(o.auditors) && (!o.auditors.length || typeof o.auditors[0] === "string") && Array.isArray(o.owners) && (!o.owners.length || typeof o.owners[0] === "string")); + }, + isAmino(o: any): o is AttributesFiltersAmino { + return o && (o.$typeUrl === AttributesFilters.typeUrl || Array.isArray(o.auditors) && (!o.auditors.length || typeof o.auditors[0] === "string") && Array.isArray(o.owners) && (!o.owners.length || typeof o.owners[0] === "string")); + }, encode(message: AttributesFilters, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.auditors) { writer.uint32(10).string(v!); @@ -692,7 +747,8 @@ export const AttributesFilters = { typeUrl: "/akash.audit.v1beta1.AttributesFilters", value: AttributesFilters.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgSignProviderAttributes(): MsgSignProviderAttributes { return { @@ -709,6 +765,15 @@ function createBaseMsgSignProviderAttributes(): MsgSignProviderAttributes { */ export const MsgSignProviderAttributes = { typeUrl: "/akash.audit.v1beta1.MsgSignProviderAttributes", + is(o: any): o is MsgSignProviderAttributes { + return o && (o.$typeUrl === MsgSignProviderAttributes.typeUrl || typeof o.owner === "string" && typeof o.auditor === "string" && Array.isArray(o.attributes) && (!o.attributes.length || Attribute.is(o.attributes[0]))); + }, + isSDK(o: any): o is MsgSignProviderAttributesSDKType { + return o && (o.$typeUrl === MsgSignProviderAttributes.typeUrl || typeof o.owner === "string" && typeof o.auditor === "string" && Array.isArray(o.attributes) && (!o.attributes.length || Attribute.isSDK(o.attributes[0]))); + }, + isAmino(o: any): o is MsgSignProviderAttributesAmino { + return o && (o.$typeUrl === MsgSignProviderAttributes.typeUrl || typeof o.owner === "string" && typeof o.auditor === "string" && Array.isArray(o.attributes) && (!o.attributes.length || Attribute.isAmino(o.attributes[0]))); + }, encode(message: MsgSignProviderAttributes, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.owner !== "") { writer.uint32(10).string(message.owner); @@ -809,6 +874,12 @@ export const MsgSignProviderAttributes = { typeUrl: "/akash.audit.v1beta1.MsgSignProviderAttributes", value: MsgSignProviderAttributes.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgSignProviderAttributes.typeUrl)) { + return; + } + Attribute.registerTypeUrl(); } }; function createBaseMsgSignProviderAttributesResponse(): MsgSignProviderAttributesResponse { @@ -822,6 +893,15 @@ function createBaseMsgSignProviderAttributesResponse(): MsgSignProviderAttribute */ export const MsgSignProviderAttributesResponse = { typeUrl: "/akash.audit.v1beta1.MsgSignProviderAttributesResponse", + is(o: any): o is MsgSignProviderAttributesResponse { + return o && o.$typeUrl === MsgSignProviderAttributesResponse.typeUrl; + }, + isSDK(o: any): o is MsgSignProviderAttributesResponseSDKType { + return o && o.$typeUrl === MsgSignProviderAttributesResponse.typeUrl; + }, + isAmino(o: any): o is MsgSignProviderAttributesResponseAmino { + return o && o.$typeUrl === MsgSignProviderAttributesResponse.typeUrl; + }, encode(_: MsgSignProviderAttributesResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -873,7 +953,8 @@ export const MsgSignProviderAttributesResponse = { typeUrl: "/akash.audit.v1beta1.MsgSignProviderAttributesResponse", value: MsgSignProviderAttributesResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgDeleteProviderAttributes(): MsgDeleteProviderAttributes { return { @@ -890,6 +971,15 @@ function createBaseMsgDeleteProviderAttributes(): MsgDeleteProviderAttributes { */ export const MsgDeleteProviderAttributes = { typeUrl: "/akash.audit.v1beta1.MsgDeleteProviderAttributes", + is(o: any): o is MsgDeleteProviderAttributes { + return o && (o.$typeUrl === MsgDeleteProviderAttributes.typeUrl || typeof o.owner === "string" && typeof o.auditor === "string" && Array.isArray(o.keys) && (!o.keys.length || typeof o.keys[0] === "string")); + }, + isSDK(o: any): o is MsgDeleteProviderAttributesSDKType { + return o && (o.$typeUrl === MsgDeleteProviderAttributes.typeUrl || typeof o.owner === "string" && typeof o.auditor === "string" && Array.isArray(o.keys) && (!o.keys.length || typeof o.keys[0] === "string")); + }, + isAmino(o: any): o is MsgDeleteProviderAttributesAmino { + return o && (o.$typeUrl === MsgDeleteProviderAttributes.typeUrl || typeof o.owner === "string" && typeof o.auditor === "string" && Array.isArray(o.keys) && (!o.keys.length || typeof o.keys[0] === "string")); + }, encode(message: MsgDeleteProviderAttributes, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.owner !== "") { writer.uint32(10).string(message.owner); @@ -990,7 +1080,8 @@ export const MsgDeleteProviderAttributes = { typeUrl: "/akash.audit.v1beta1.MsgDeleteProviderAttributes", value: MsgDeleteProviderAttributes.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgDeleteProviderAttributesResponse(): MsgDeleteProviderAttributesResponse { return {}; @@ -1003,6 +1094,15 @@ function createBaseMsgDeleteProviderAttributesResponse(): MsgDeleteProviderAttri */ export const MsgDeleteProviderAttributesResponse = { typeUrl: "/akash.audit.v1beta1.MsgDeleteProviderAttributesResponse", + is(o: any): o is MsgDeleteProviderAttributesResponse { + return o && o.$typeUrl === MsgDeleteProviderAttributesResponse.typeUrl; + }, + isSDK(o: any): o is MsgDeleteProviderAttributesResponseSDKType { + return o && o.$typeUrl === MsgDeleteProviderAttributesResponse.typeUrl; + }, + isAmino(o: any): o is MsgDeleteProviderAttributesResponseAmino { + return o && o.$typeUrl === MsgDeleteProviderAttributesResponse.typeUrl; + }, encode(_: MsgDeleteProviderAttributesResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -1054,5 +1154,6 @@ export const MsgDeleteProviderAttributesResponse = { typeUrl: "/akash.audit.v1beta1.MsgDeleteProviderAttributesResponse", value: MsgDeleteProviderAttributesResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/akash/audit/v1beta2/audit.registry.ts b/__fixtures__/v-next/outputv3/akash/audit/v1beta2/audit.registry.ts index e6a2bafcd2..a21a1e63d7 100644 --- a/__fixtures__/v-next/outputv3/akash/audit/v1beta2/audit.registry.ts +++ b/__fixtures__/v-next/outputv3/akash/audit/v1beta2/audit.registry.ts @@ -1,12 +1,7 @@ import { Attribute, AttributeSDKType } from "../../base/v1beta2/attribute"; -import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { TelescopeGeneratedType } from "../../../types"; import { MsgSignProviderAttributes, MsgSignProviderAttributesSDKType, MsgDeleteProviderAttributes, MsgDeleteProviderAttributesSDKType } from "./audit"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/akash.audit.v1beta2.MsgSignProviderAttributes", MsgSignProviderAttributes], ["/akash.audit.v1beta2.MsgDeleteProviderAttributes", MsgDeleteProviderAttributes]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/akash.audit.v1beta2.MsgSignProviderAttributes", MsgSignProviderAttributes], ["/akash.audit.v1beta2.MsgDeleteProviderAttributes", MsgDeleteProviderAttributes]]; export const MessageComposer = { encoded: { signProviderAttributes(value: MsgSignProviderAttributes) { diff --git a/__fixtures__/v-next/outputv3/akash/audit/v1beta2/audit.rpc.func.ts b/__fixtures__/v-next/outputv3/akash/audit/v1beta2/audit.rpc.func.ts new file mode 100644 index 0000000000..3e6236d47c --- /dev/null +++ b/__fixtures__/v-next/outputv3/akash/audit/v1beta2/audit.rpc.func.ts @@ -0,0 +1,21 @@ +import { Attribute, AttributeSDKType } from "../../base/v1beta2/attribute"; +import { buildTx } from "../../../helper-func-types"; +import { MsgSignProviderAttributes, MsgSignProviderAttributesSDKType, MsgSignProviderAttributesResponse, MsgSignProviderAttributesResponseSDKType, MsgDeleteProviderAttributes, MsgDeleteProviderAttributesSDKType, MsgDeleteProviderAttributesResponse, MsgDeleteProviderAttributesResponseSDKType } from "./audit"; +/** + * SignProviderAttributes defines a method that signs provider attributes + * @name signProviderAttributes + * @package akash.audit.v1beta2 + * @see proto service: akash.audit.v1beta2.SignProviderAttributes + */ +export const signProviderAttributes = buildTx({ + msg: MsgSignProviderAttributes +}); +/** + * DeleteProviderAttributes defines a method that deletes provider attributes + * @name deleteProviderAttributes + * @package akash.audit.v1beta2 + * @see proto service: akash.audit.v1beta2.DeleteProviderAttributes + */ +export const deleteProviderAttributes = buildTx({ + msg: MsgDeleteProviderAttributes +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/akash/audit/v1beta2/audit.ts b/__fixtures__/v-next/outputv3/akash/audit/v1beta2/audit.ts index 01dcb3cf9e..adda7c4ca0 100644 --- a/__fixtures__/v-next/outputv3/akash/audit/v1beta2/audit.ts +++ b/__fixtures__/v-next/outputv3/akash/audit/v1beta2/audit.ts @@ -1,6 +1,7 @@ import { Attribute, AttributeAmino, AttributeSDKType } from "../../base/v1beta2/attribute"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { isSet, DeepPartial } from "../../../helpers"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "akash.audit.v1beta2"; /** * Provider stores owner auditor and attributes details @@ -280,6 +281,15 @@ function createBaseProvider(): Provider { */ export const Provider = { typeUrl: "/akash.audit.v1beta2.Provider", + is(o: any): o is Provider { + return o && (o.$typeUrl === Provider.typeUrl || typeof o.owner === "string" && typeof o.auditor === "string" && Array.isArray(o.attributes) && (!o.attributes.length || Attribute.is(o.attributes[0]))); + }, + isSDK(o: any): o is ProviderSDKType { + return o && (o.$typeUrl === Provider.typeUrl || typeof o.owner === "string" && typeof o.auditor === "string" && Array.isArray(o.attributes) && (!o.attributes.length || Attribute.isSDK(o.attributes[0]))); + }, + isAmino(o: any): o is ProviderAmino { + return o && (o.$typeUrl === Provider.typeUrl || typeof o.owner === "string" && typeof o.auditor === "string" && Array.isArray(o.attributes) && (!o.attributes.length || Attribute.isAmino(o.attributes[0]))); + }, encode(message: Provider, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.owner !== "") { writer.uint32(10).string(message.owner); @@ -380,6 +390,12 @@ export const Provider = { typeUrl: "/akash.audit.v1beta2.Provider", value: Provider.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Provider.typeUrl)) { + return; + } + Attribute.registerTypeUrl(); } }; function createBaseAuditedAttributes(): AuditedAttributes { @@ -397,6 +413,15 @@ function createBaseAuditedAttributes(): AuditedAttributes { */ export const AuditedAttributes = { typeUrl: "/akash.audit.v1beta2.AuditedAttributes", + is(o: any): o is AuditedAttributes { + return o && (o.$typeUrl === AuditedAttributes.typeUrl || typeof o.owner === "string" && typeof o.auditor === "string" && Array.isArray(o.attributes) && (!o.attributes.length || Attribute.is(o.attributes[0]))); + }, + isSDK(o: any): o is AuditedAttributesSDKType { + return o && (o.$typeUrl === AuditedAttributes.typeUrl || typeof o.owner === "string" && typeof o.auditor === "string" && Array.isArray(o.attributes) && (!o.attributes.length || Attribute.isSDK(o.attributes[0]))); + }, + isAmino(o: any): o is AuditedAttributesAmino { + return o && (o.$typeUrl === AuditedAttributes.typeUrl || typeof o.owner === "string" && typeof o.auditor === "string" && Array.isArray(o.attributes) && (!o.attributes.length || Attribute.isAmino(o.attributes[0]))); + }, encode(message: AuditedAttributes, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.owner !== "") { writer.uint32(10).string(message.owner); @@ -497,6 +522,12 @@ export const AuditedAttributes = { typeUrl: "/akash.audit.v1beta2.AuditedAttributes", value: AuditedAttributes.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(AuditedAttributes.typeUrl)) { + return; + } + Attribute.registerTypeUrl(); } }; function createBaseAttributesResponse(): AttributesResponse { @@ -512,6 +543,15 @@ function createBaseAttributesResponse(): AttributesResponse { */ export const AttributesResponse = { typeUrl: "/akash.audit.v1beta2.AttributesResponse", + is(o: any): o is AttributesResponse { + return o && (o.$typeUrl === AttributesResponse.typeUrl || Array.isArray(o.attributes) && (!o.attributes.length || AuditedAttributes.is(o.attributes[0]))); + }, + isSDK(o: any): o is AttributesResponseSDKType { + return o && (o.$typeUrl === AttributesResponse.typeUrl || Array.isArray(o.attributes) && (!o.attributes.length || AuditedAttributes.isSDK(o.attributes[0]))); + }, + isAmino(o: any): o is AttributesResponseAmino { + return o && (o.$typeUrl === AttributesResponse.typeUrl || Array.isArray(o.attributes) && (!o.attributes.length || AuditedAttributes.isAmino(o.attributes[0]))); + }, encode(message: AttributesResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.attributes) { AuditedAttributes.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -584,6 +624,12 @@ export const AttributesResponse = { typeUrl: "/akash.audit.v1beta2.AttributesResponse", value: AttributesResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(AttributesResponse.typeUrl)) { + return; + } + AuditedAttributes.registerTypeUrl(); } }; function createBaseAttributesFilters(): AttributesFilters { @@ -600,6 +646,15 @@ function createBaseAttributesFilters(): AttributesFilters { */ export const AttributesFilters = { typeUrl: "/akash.audit.v1beta2.AttributesFilters", + is(o: any): o is AttributesFilters { + return o && (o.$typeUrl === AttributesFilters.typeUrl || Array.isArray(o.auditors) && (!o.auditors.length || typeof o.auditors[0] === "string") && Array.isArray(o.owners) && (!o.owners.length || typeof o.owners[0] === "string")); + }, + isSDK(o: any): o is AttributesFiltersSDKType { + return o && (o.$typeUrl === AttributesFilters.typeUrl || Array.isArray(o.auditors) && (!o.auditors.length || typeof o.auditors[0] === "string") && Array.isArray(o.owners) && (!o.owners.length || typeof o.owners[0] === "string")); + }, + isAmino(o: any): o is AttributesFiltersAmino { + return o && (o.$typeUrl === AttributesFilters.typeUrl || Array.isArray(o.auditors) && (!o.auditors.length || typeof o.auditors[0] === "string") && Array.isArray(o.owners) && (!o.owners.length || typeof o.owners[0] === "string")); + }, encode(message: AttributesFilters, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.auditors) { writer.uint32(10).string(v!); @@ -692,7 +747,8 @@ export const AttributesFilters = { typeUrl: "/akash.audit.v1beta2.AttributesFilters", value: AttributesFilters.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgSignProviderAttributes(): MsgSignProviderAttributes { return { @@ -709,6 +765,15 @@ function createBaseMsgSignProviderAttributes(): MsgSignProviderAttributes { */ export const MsgSignProviderAttributes = { typeUrl: "/akash.audit.v1beta2.MsgSignProviderAttributes", + is(o: any): o is MsgSignProviderAttributes { + return o && (o.$typeUrl === MsgSignProviderAttributes.typeUrl || typeof o.owner === "string" && typeof o.auditor === "string" && Array.isArray(o.attributes) && (!o.attributes.length || Attribute.is(o.attributes[0]))); + }, + isSDK(o: any): o is MsgSignProviderAttributesSDKType { + return o && (o.$typeUrl === MsgSignProviderAttributes.typeUrl || typeof o.owner === "string" && typeof o.auditor === "string" && Array.isArray(o.attributes) && (!o.attributes.length || Attribute.isSDK(o.attributes[0]))); + }, + isAmino(o: any): o is MsgSignProviderAttributesAmino { + return o && (o.$typeUrl === MsgSignProviderAttributes.typeUrl || typeof o.owner === "string" && typeof o.auditor === "string" && Array.isArray(o.attributes) && (!o.attributes.length || Attribute.isAmino(o.attributes[0]))); + }, encode(message: MsgSignProviderAttributes, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.owner !== "") { writer.uint32(10).string(message.owner); @@ -809,6 +874,12 @@ export const MsgSignProviderAttributes = { typeUrl: "/akash.audit.v1beta2.MsgSignProviderAttributes", value: MsgSignProviderAttributes.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgSignProviderAttributes.typeUrl)) { + return; + } + Attribute.registerTypeUrl(); } }; function createBaseMsgSignProviderAttributesResponse(): MsgSignProviderAttributesResponse { @@ -822,6 +893,15 @@ function createBaseMsgSignProviderAttributesResponse(): MsgSignProviderAttribute */ export const MsgSignProviderAttributesResponse = { typeUrl: "/akash.audit.v1beta2.MsgSignProviderAttributesResponse", + is(o: any): o is MsgSignProviderAttributesResponse { + return o && o.$typeUrl === MsgSignProviderAttributesResponse.typeUrl; + }, + isSDK(o: any): o is MsgSignProviderAttributesResponseSDKType { + return o && o.$typeUrl === MsgSignProviderAttributesResponse.typeUrl; + }, + isAmino(o: any): o is MsgSignProviderAttributesResponseAmino { + return o && o.$typeUrl === MsgSignProviderAttributesResponse.typeUrl; + }, encode(_: MsgSignProviderAttributesResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -873,7 +953,8 @@ export const MsgSignProviderAttributesResponse = { typeUrl: "/akash.audit.v1beta2.MsgSignProviderAttributesResponse", value: MsgSignProviderAttributesResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgDeleteProviderAttributes(): MsgDeleteProviderAttributes { return { @@ -890,6 +971,15 @@ function createBaseMsgDeleteProviderAttributes(): MsgDeleteProviderAttributes { */ export const MsgDeleteProviderAttributes = { typeUrl: "/akash.audit.v1beta2.MsgDeleteProviderAttributes", + is(o: any): o is MsgDeleteProviderAttributes { + return o && (o.$typeUrl === MsgDeleteProviderAttributes.typeUrl || typeof o.owner === "string" && typeof o.auditor === "string" && Array.isArray(o.keys) && (!o.keys.length || typeof o.keys[0] === "string")); + }, + isSDK(o: any): o is MsgDeleteProviderAttributesSDKType { + return o && (o.$typeUrl === MsgDeleteProviderAttributes.typeUrl || typeof o.owner === "string" && typeof o.auditor === "string" && Array.isArray(o.keys) && (!o.keys.length || typeof o.keys[0] === "string")); + }, + isAmino(o: any): o is MsgDeleteProviderAttributesAmino { + return o && (o.$typeUrl === MsgDeleteProviderAttributes.typeUrl || typeof o.owner === "string" && typeof o.auditor === "string" && Array.isArray(o.keys) && (!o.keys.length || typeof o.keys[0] === "string")); + }, encode(message: MsgDeleteProviderAttributes, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.owner !== "") { writer.uint32(10).string(message.owner); @@ -990,7 +1080,8 @@ export const MsgDeleteProviderAttributes = { typeUrl: "/akash.audit.v1beta2.MsgDeleteProviderAttributes", value: MsgDeleteProviderAttributes.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgDeleteProviderAttributesResponse(): MsgDeleteProviderAttributesResponse { return {}; @@ -1003,6 +1094,15 @@ function createBaseMsgDeleteProviderAttributesResponse(): MsgDeleteProviderAttri */ export const MsgDeleteProviderAttributesResponse = { typeUrl: "/akash.audit.v1beta2.MsgDeleteProviderAttributesResponse", + is(o: any): o is MsgDeleteProviderAttributesResponse { + return o && o.$typeUrl === MsgDeleteProviderAttributesResponse.typeUrl; + }, + isSDK(o: any): o is MsgDeleteProviderAttributesResponseSDKType { + return o && o.$typeUrl === MsgDeleteProviderAttributesResponse.typeUrl; + }, + isAmino(o: any): o is MsgDeleteProviderAttributesResponseAmino { + return o && o.$typeUrl === MsgDeleteProviderAttributesResponse.typeUrl; + }, encode(_: MsgDeleteProviderAttributesResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -1054,5 +1154,6 @@ export const MsgDeleteProviderAttributesResponse = { typeUrl: "/akash.audit.v1beta2.MsgDeleteProviderAttributesResponse", value: MsgDeleteProviderAttributesResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/akash/audit/v1beta2/genesis.ts b/__fixtures__/v-next/outputv3/akash/audit/v1beta2/genesis.ts index 33cf052122..f10ff978ae 100644 --- a/__fixtures__/v-next/outputv3/akash/audit/v1beta2/genesis.ts +++ b/__fixtures__/v-next/outputv3/akash/audit/v1beta2/genesis.ts @@ -1,6 +1,7 @@ import { AuditedAttributes, AuditedAttributesAmino, AuditedAttributesSDKType } from "./audit"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { DeepPartial } from "../../../helpers"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "akash.audit.v1beta2"; /** * GenesisState defines the basic genesis state used by audit module @@ -46,6 +47,15 @@ function createBaseGenesisState(): GenesisState { */ export const GenesisState = { typeUrl: "/akash.audit.v1beta2.GenesisState", + is(o: any): o is GenesisState { + return o && (o.$typeUrl === GenesisState.typeUrl || Array.isArray(o.attributes) && (!o.attributes.length || AuditedAttributes.is(o.attributes[0]))); + }, + isSDK(o: any): o is GenesisStateSDKType { + return o && (o.$typeUrl === GenesisState.typeUrl || Array.isArray(o.attributes) && (!o.attributes.length || AuditedAttributes.isSDK(o.attributes[0]))); + }, + isAmino(o: any): o is GenesisStateAmino { + return o && (o.$typeUrl === GenesisState.typeUrl || Array.isArray(o.attributes) && (!o.attributes.length || AuditedAttributes.isAmino(o.attributes[0]))); + }, encode(message: GenesisState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.attributes) { AuditedAttributes.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -118,5 +128,11 @@ export const GenesisState = { typeUrl: "/akash.audit.v1beta2.GenesisState", value: GenesisState.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GenesisState.typeUrl)) { + return; + } + AuditedAttributes.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/akash/audit/v1beta2/query.rpc.func.ts b/__fixtures__/v-next/outputv3/akash/audit/v1beta2/query.rpc.func.ts new file mode 100644 index 0000000000..18e7cdbe4e --- /dev/null +++ b/__fixtures__/v-next/outputv3/akash/audit/v1beta2/query.rpc.func.ts @@ -0,0 +1,64 @@ +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination"; +import { Provider, ProviderSDKType } from "./audit"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { QueryAllProvidersAttributesRequest, QueryAllProvidersAttributesRequestSDKType, QueryProvidersResponse, QueryProvidersResponseSDKType, QueryProviderAttributesRequest, QueryProviderAttributesRequestSDKType, QueryProviderAuditorRequest, QueryProviderAuditorRequestSDKType, QueryAuditorAttributesRequest, QueryAuditorAttributesRequestSDKType } from "./query"; +/** + * AllProvidersAttributes queries all providers + * buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE + * buf:lint:ignore RPC_RESPONSE_STANDARD_NAME + * @name getAllProvidersAttributes + * @package akash.audit.v1beta2 + * @see proto service: akash.audit.v1beta2.AllProvidersAttributes + */ +export const getAllProvidersAttributes = buildQuery({ + encode: QueryAllProvidersAttributesRequest.encode, + decode: QueryProvidersResponse.decode, + service: "akash.audit.v1beta2.Query", + method: "AllProvidersAttributes", + deps: [QueryAllProvidersAttributesRequest, QueryProvidersResponse] +}); +/** + * ProviderAttributes queries all provider signed attributes + * buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE + * buf:lint:ignore RPC_RESPONSE_STANDARD_NAME + * @name getProviderAttributes + * @package akash.audit.v1beta2 + * @see proto service: akash.audit.v1beta2.ProviderAttributes + */ +export const getProviderAttributes = buildQuery({ + encode: QueryProviderAttributesRequest.encode, + decode: QueryProvidersResponse.decode, + service: "akash.audit.v1beta2.Query", + method: "ProviderAttributes", + deps: [QueryProviderAttributesRequest, QueryProvidersResponse] +}); +/** + * ProviderAuditorAttributes queries provider signed attributes by specific auditor + * buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE + * buf:lint:ignore RPC_RESPONSE_STANDARD_NAME + * @name getProviderAuditorAttributes + * @package akash.audit.v1beta2 + * @see proto service: akash.audit.v1beta2.ProviderAuditorAttributes + */ +export const getProviderAuditorAttributes = buildQuery({ + encode: QueryProviderAuditorRequest.encode, + decode: QueryProvidersResponse.decode, + service: "akash.audit.v1beta2.Query", + method: "ProviderAuditorAttributes", + deps: [QueryProviderAuditorRequest, QueryProvidersResponse] +}); +/** + * AuditorAttributes queries all providers signed by this auditor + * buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE + * buf:lint:ignore RPC_RESPONSE_STANDARD_NAME + * @name getAuditorAttributes + * @package akash.audit.v1beta2 + * @see proto service: akash.audit.v1beta2.AuditorAttributes + */ +export const getAuditorAttributes = buildQuery({ + encode: QueryAuditorAttributesRequest.encode, + decode: QueryProvidersResponse.decode, + service: "akash.audit.v1beta2.Query", + method: "AuditorAttributes", + deps: [QueryAuditorAttributesRequest, QueryProvidersResponse] +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/akash/audit/v1beta2/query.ts b/__fixtures__/v-next/outputv3/akash/audit/v1beta2/query.ts index 19eeb1a260..19bf141db9 100644 --- a/__fixtures__/v-next/outputv3/akash/audit/v1beta2/query.ts +++ b/__fixtures__/v-next/outputv3/akash/audit/v1beta2/query.ts @@ -1,6 +1,7 @@ import { PageRequest, PageRequestAmino, PageRequestSDKType, PageResponse, PageResponseAmino, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination"; import { Provider, ProviderAmino, ProviderSDKType } from "./audit"; import { BinaryReader, BinaryWriter } from "../../../binary"; +import { GlobalDecoderRegistry } from "../../../registry"; import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "akash.audit.v1beta2"; /** @@ -218,6 +219,15 @@ function createBaseQueryProvidersResponse(): QueryProvidersResponse { */ export const QueryProvidersResponse = { typeUrl: "/akash.audit.v1beta2.QueryProvidersResponse", + is(o: any): o is QueryProvidersResponse { + return o && (o.$typeUrl === QueryProvidersResponse.typeUrl || Array.isArray(o.providers) && (!o.providers.length || Provider.is(o.providers[0]))); + }, + isSDK(o: any): o is QueryProvidersResponseSDKType { + return o && (o.$typeUrl === QueryProvidersResponse.typeUrl || Array.isArray(o.providers) && (!o.providers.length || Provider.isSDK(o.providers[0]))); + }, + isAmino(o: any): o is QueryProvidersResponseAmino { + return o && (o.$typeUrl === QueryProvidersResponse.typeUrl || Array.isArray(o.providers) && (!o.providers.length || Provider.isAmino(o.providers[0]))); + }, encode(message: QueryProvidersResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.providers) { Provider.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -306,6 +316,13 @@ export const QueryProvidersResponse = { typeUrl: "/akash.audit.v1beta2.QueryProvidersResponse", value: QueryProvidersResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryProvidersResponse.typeUrl)) { + return; + } + Provider.registerTypeUrl(); + PageResponse.registerTypeUrl(); } }; function createBaseQueryProviderRequest(): QueryProviderRequest { @@ -322,6 +339,15 @@ function createBaseQueryProviderRequest(): QueryProviderRequest { */ export const QueryProviderRequest = { typeUrl: "/akash.audit.v1beta2.QueryProviderRequest", + is(o: any): o is QueryProviderRequest { + return o && (o.$typeUrl === QueryProviderRequest.typeUrl || typeof o.auditor === "string" && typeof o.owner === "string"); + }, + isSDK(o: any): o is QueryProviderRequestSDKType { + return o && (o.$typeUrl === QueryProviderRequest.typeUrl || typeof o.auditor === "string" && typeof o.owner === "string"); + }, + isAmino(o: any): o is QueryProviderRequestAmino { + return o && (o.$typeUrl === QueryProviderRequest.typeUrl || typeof o.auditor === "string" && typeof o.owner === "string"); + }, encode(message: QueryProviderRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.auditor !== "") { writer.uint32(10).string(message.auditor); @@ -402,7 +428,8 @@ export const QueryProviderRequest = { typeUrl: "/akash.audit.v1beta2.QueryProviderRequest", value: QueryProviderRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryAllProvidersAttributesRequest(): QueryAllProvidersAttributesRequest { return { @@ -417,6 +444,15 @@ function createBaseQueryAllProvidersAttributesRequest(): QueryAllProvidersAttrib */ export const QueryAllProvidersAttributesRequest = { typeUrl: "/akash.audit.v1beta2.QueryAllProvidersAttributesRequest", + is(o: any): o is QueryAllProvidersAttributesRequest { + return o && o.$typeUrl === QueryAllProvidersAttributesRequest.typeUrl; + }, + isSDK(o: any): o is QueryAllProvidersAttributesRequestSDKType { + return o && o.$typeUrl === QueryAllProvidersAttributesRequest.typeUrl; + }, + isAmino(o: any): o is QueryAllProvidersAttributesRequestAmino { + return o && o.$typeUrl === QueryAllProvidersAttributesRequest.typeUrl; + }, encode(message: QueryAllProvidersAttributesRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.pagination !== undefined) { PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); @@ -485,6 +521,12 @@ export const QueryAllProvidersAttributesRequest = { typeUrl: "/akash.audit.v1beta2.QueryAllProvidersAttributesRequest", value: QueryAllProvidersAttributesRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryAllProvidersAttributesRequest.typeUrl)) { + return; + } + PageRequest.registerTypeUrl(); } }; function createBaseQueryProviderAttributesRequest(): QueryProviderAttributesRequest { @@ -501,6 +543,15 @@ function createBaseQueryProviderAttributesRequest(): QueryProviderAttributesRequ */ export const QueryProviderAttributesRequest = { typeUrl: "/akash.audit.v1beta2.QueryProviderAttributesRequest", + is(o: any): o is QueryProviderAttributesRequest { + return o && (o.$typeUrl === QueryProviderAttributesRequest.typeUrl || typeof o.owner === "string"); + }, + isSDK(o: any): o is QueryProviderAttributesRequestSDKType { + return o && (o.$typeUrl === QueryProviderAttributesRequest.typeUrl || typeof o.owner === "string"); + }, + isAmino(o: any): o is QueryProviderAttributesRequestAmino { + return o && (o.$typeUrl === QueryProviderAttributesRequest.typeUrl || typeof o.owner === "string"); + }, encode(message: QueryProviderAttributesRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.owner !== "") { writer.uint32(10).string(message.owner); @@ -583,6 +634,12 @@ export const QueryProviderAttributesRequest = { typeUrl: "/akash.audit.v1beta2.QueryProviderAttributesRequest", value: QueryProviderAttributesRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryProviderAttributesRequest.typeUrl)) { + return; + } + PageRequest.registerTypeUrl(); } }; function createBaseQueryProviderAuditorRequest(): QueryProviderAuditorRequest { @@ -599,6 +656,15 @@ function createBaseQueryProviderAuditorRequest(): QueryProviderAuditorRequest { */ export const QueryProviderAuditorRequest = { typeUrl: "/akash.audit.v1beta2.QueryProviderAuditorRequest", + is(o: any): o is QueryProviderAuditorRequest { + return o && (o.$typeUrl === QueryProviderAuditorRequest.typeUrl || typeof o.auditor === "string" && typeof o.owner === "string"); + }, + isSDK(o: any): o is QueryProviderAuditorRequestSDKType { + return o && (o.$typeUrl === QueryProviderAuditorRequest.typeUrl || typeof o.auditor === "string" && typeof o.owner === "string"); + }, + isAmino(o: any): o is QueryProviderAuditorRequestAmino { + return o && (o.$typeUrl === QueryProviderAuditorRequest.typeUrl || typeof o.auditor === "string" && typeof o.owner === "string"); + }, encode(message: QueryProviderAuditorRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.auditor !== "") { writer.uint32(10).string(message.auditor); @@ -679,7 +745,8 @@ export const QueryProviderAuditorRequest = { typeUrl: "/akash.audit.v1beta2.QueryProviderAuditorRequest", value: QueryProviderAuditorRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryAuditorAttributesRequest(): QueryAuditorAttributesRequest { return { @@ -695,6 +762,15 @@ function createBaseQueryAuditorAttributesRequest(): QueryAuditorAttributesReques */ export const QueryAuditorAttributesRequest = { typeUrl: "/akash.audit.v1beta2.QueryAuditorAttributesRequest", + is(o: any): o is QueryAuditorAttributesRequest { + return o && (o.$typeUrl === QueryAuditorAttributesRequest.typeUrl || typeof o.auditor === "string"); + }, + isSDK(o: any): o is QueryAuditorAttributesRequestSDKType { + return o && (o.$typeUrl === QueryAuditorAttributesRequest.typeUrl || typeof o.auditor === "string"); + }, + isAmino(o: any): o is QueryAuditorAttributesRequestAmino { + return o && (o.$typeUrl === QueryAuditorAttributesRequest.typeUrl || typeof o.auditor === "string"); + }, encode(message: QueryAuditorAttributesRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.auditor !== "") { writer.uint32(10).string(message.auditor); @@ -777,5 +853,11 @@ export const QueryAuditorAttributesRequest = { typeUrl: "/akash.audit.v1beta2.QueryAuditorAttributesRequest", value: QueryAuditorAttributesRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryAuditorAttributesRequest.typeUrl)) { + return; + } + PageRequest.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/akash/base/v1beta1/attribute.ts b/__fixtures__/v-next/outputv3/akash/base/v1beta1/attribute.ts index ffd6be3248..811defce19 100644 --- a/__fixtures__/v-next/outputv3/akash/base/v1beta1/attribute.ts +++ b/__fixtures__/v-next/outputv3/akash/base/v1beta1/attribute.ts @@ -1,5 +1,6 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; import { isSet, DeepPartial } from "../../../helpers"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "akash.base.v1beta1"; /** * Attribute represents key value pair @@ -150,6 +151,15 @@ function createBaseAttribute(): Attribute { */ export const Attribute = { typeUrl: "/akash.base.v1beta1.Attribute", + is(o: any): o is Attribute { + return o && (o.$typeUrl === Attribute.typeUrl || typeof o.key === "string" && typeof o.value === "string"); + }, + isSDK(o: any): o is AttributeSDKType { + return o && (o.$typeUrl === Attribute.typeUrl || typeof o.key === "string" && typeof o.value === "string"); + }, + isAmino(o: any): o is AttributeAmino { + return o && (o.$typeUrl === Attribute.typeUrl || typeof o.key === "string" && typeof o.value === "string"); + }, encode(message: Attribute, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.key !== "") { writer.uint32(10).string(message.key); @@ -230,7 +240,8 @@ export const Attribute = { typeUrl: "/akash.base.v1beta1.Attribute", value: Attribute.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseSignedBy(): SignedBy { return { @@ -249,6 +260,15 @@ function createBaseSignedBy(): SignedBy { */ export const SignedBy = { typeUrl: "/akash.base.v1beta1.SignedBy", + is(o: any): o is SignedBy { + return o && (o.$typeUrl === SignedBy.typeUrl || Array.isArray(o.allOf) && (!o.allOf.length || typeof o.allOf[0] === "string") && Array.isArray(o.anyOf) && (!o.anyOf.length || typeof o.anyOf[0] === "string")); + }, + isSDK(o: any): o is SignedBySDKType { + return o && (o.$typeUrl === SignedBy.typeUrl || Array.isArray(o.all_of) && (!o.all_of.length || typeof o.all_of[0] === "string") && Array.isArray(o.any_of) && (!o.any_of.length || typeof o.any_of[0] === "string")); + }, + isAmino(o: any): o is SignedByAmino { + return o && (o.$typeUrl === SignedBy.typeUrl || Array.isArray(o.all_of) && (!o.all_of.length || typeof o.all_of[0] === "string") && Array.isArray(o.any_of) && (!o.any_of.length || typeof o.any_of[0] === "string")); + }, encode(message: SignedBy, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.allOf) { writer.uint32(10).string(v!); @@ -341,7 +361,8 @@ export const SignedBy = { typeUrl: "/akash.base.v1beta1.SignedBy", value: SignedBy.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBasePlacementRequirements(): PlacementRequirements { return { @@ -357,6 +378,15 @@ function createBasePlacementRequirements(): PlacementRequirements { */ export const PlacementRequirements = { typeUrl: "/akash.base.v1beta1.PlacementRequirements", + is(o: any): o is PlacementRequirements { + return o && (o.$typeUrl === PlacementRequirements.typeUrl || SignedBy.is(o.signedBy) && Array.isArray(o.attributes) && (!o.attributes.length || Attribute.is(o.attributes[0]))); + }, + isSDK(o: any): o is PlacementRequirementsSDKType { + return o && (o.$typeUrl === PlacementRequirements.typeUrl || SignedBy.isSDK(o.signed_by) && Array.isArray(o.attributes) && (!o.attributes.length || Attribute.isSDK(o.attributes[0]))); + }, + isAmino(o: any): o is PlacementRequirementsAmino { + return o && (o.$typeUrl === PlacementRequirements.typeUrl || SignedBy.isAmino(o.signed_by) && Array.isArray(o.attributes) && (!o.attributes.length || Attribute.isAmino(o.attributes[0]))); + }, encode(message: PlacementRequirements, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.signedBy !== undefined) { SignedBy.encode(message.signedBy, writer.uint32(10).fork()).ldelim(); @@ -445,5 +475,12 @@ export const PlacementRequirements = { typeUrl: "/akash.base.v1beta1.PlacementRequirements", value: PlacementRequirements.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(PlacementRequirements.typeUrl)) { + return; + } + SignedBy.registerTypeUrl(); + Attribute.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/akash/base/v1beta1/endpoint.ts b/__fixtures__/v-next/outputv3/akash/base/v1beta1/endpoint.ts index 52c3481c2c..d39ab11cf9 100644 --- a/__fixtures__/v-next/outputv3/akash/base/v1beta1/endpoint.ts +++ b/__fixtures__/v-next/outputv3/akash/base/v1beta1/endpoint.ts @@ -1,5 +1,5 @@ -import { BinaryReader, BinaryWriter } from "../../../binary"; import { isSet, DeepPartial } from "../../../helpers"; +import { BinaryReader, BinaryWriter } from "../../../binary"; export const protobufPackage = "akash.base.v1beta1"; /** This describes how the endpoint is implemented when the lease is deployed */ export enum Endpoint_Kind { @@ -80,6 +80,15 @@ function createBaseEndpoint(): Endpoint { */ export const Endpoint = { typeUrl: "/akash.base.v1beta1.Endpoint", + is(o: any): o is Endpoint { + return o && (o.$typeUrl === Endpoint.typeUrl || isSet(o.kind)); + }, + isSDK(o: any): o is EndpointSDKType { + return o && (o.$typeUrl === Endpoint.typeUrl || isSet(o.kind)); + }, + isAmino(o: any): o is EndpointAmino { + return o && (o.$typeUrl === Endpoint.typeUrl || isSet(o.kind)); + }, encode(message: Endpoint, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.kind !== 0) { writer.uint32(8).int32(message.kind); @@ -146,5 +155,6 @@ export const Endpoint = { typeUrl: "/akash.base.v1beta1.Endpoint", value: Endpoint.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/akash/base/v1beta1/resource.ts b/__fixtures__/v-next/outputv3/akash/base/v1beta1/resource.ts index c09060283f..8ea70812da 100644 --- a/__fixtures__/v-next/outputv3/akash/base/v1beta1/resource.ts +++ b/__fixtures__/v-next/outputv3/akash/base/v1beta1/resource.ts @@ -2,6 +2,7 @@ import { ResourceValue, ResourceValueAmino, ResourceValueSDKType } from "./resou import { Attribute, AttributeAmino, AttributeSDKType } from "./attribute"; import { Endpoint, EndpointAmino, EndpointSDKType } from "./endpoint"; import { BinaryReader, BinaryWriter } from "../../../binary"; +import { GlobalDecoderRegistry } from "../../../registry"; import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "akash.base.v1beta1"; /** @@ -163,6 +164,15 @@ function createBaseCPU(): CPU { */ export const CPU = { typeUrl: "/akash.base.v1beta1.CPU", + is(o: any): o is CPU { + return o && (o.$typeUrl === CPU.typeUrl || ResourceValue.is(o.units) && Array.isArray(o.attributes) && (!o.attributes.length || Attribute.is(o.attributes[0]))); + }, + isSDK(o: any): o is CPUSDKType { + return o && (o.$typeUrl === CPU.typeUrl || ResourceValue.isSDK(o.units) && Array.isArray(o.attributes) && (!o.attributes.length || Attribute.isSDK(o.attributes[0]))); + }, + isAmino(o: any): o is CPUAmino { + return o && (o.$typeUrl === CPU.typeUrl || ResourceValue.isAmino(o.units) && Array.isArray(o.attributes) && (!o.attributes.length || Attribute.isAmino(o.attributes[0]))); + }, encode(message: CPU, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.units !== undefined) { ResourceValue.encode(message.units, writer.uint32(10).fork()).ldelim(); @@ -251,6 +261,13 @@ export const CPU = { typeUrl: "/akash.base.v1beta1.CPU", value: CPU.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(CPU.typeUrl)) { + return; + } + ResourceValue.registerTypeUrl(); + Attribute.registerTypeUrl(); } }; function createBaseMemory(): Memory { @@ -267,6 +284,15 @@ function createBaseMemory(): Memory { */ export const Memory = { typeUrl: "/akash.base.v1beta1.Memory", + is(o: any): o is Memory { + return o && (o.$typeUrl === Memory.typeUrl || ResourceValue.is(o.quantity) && Array.isArray(o.attributes) && (!o.attributes.length || Attribute.is(o.attributes[0]))); + }, + isSDK(o: any): o is MemorySDKType { + return o && (o.$typeUrl === Memory.typeUrl || ResourceValue.isSDK(o.quantity) && Array.isArray(o.attributes) && (!o.attributes.length || Attribute.isSDK(o.attributes[0]))); + }, + isAmino(o: any): o is MemoryAmino { + return o && (o.$typeUrl === Memory.typeUrl || ResourceValue.isAmino(o.quantity) && Array.isArray(o.attributes) && (!o.attributes.length || Attribute.isAmino(o.attributes[0]))); + }, encode(message: Memory, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.quantity !== undefined) { ResourceValue.encode(message.quantity, writer.uint32(10).fork()).ldelim(); @@ -355,6 +381,13 @@ export const Memory = { typeUrl: "/akash.base.v1beta1.Memory", value: Memory.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Memory.typeUrl)) { + return; + } + ResourceValue.registerTypeUrl(); + Attribute.registerTypeUrl(); } }; function createBaseStorage(): Storage { @@ -371,6 +404,15 @@ function createBaseStorage(): Storage { */ export const Storage = { typeUrl: "/akash.base.v1beta1.Storage", + is(o: any): o is Storage { + return o && (o.$typeUrl === Storage.typeUrl || ResourceValue.is(o.quantity) && Array.isArray(o.attributes) && (!o.attributes.length || Attribute.is(o.attributes[0]))); + }, + isSDK(o: any): o is StorageSDKType { + return o && (o.$typeUrl === Storage.typeUrl || ResourceValue.isSDK(o.quantity) && Array.isArray(o.attributes) && (!o.attributes.length || Attribute.isSDK(o.attributes[0]))); + }, + isAmino(o: any): o is StorageAmino { + return o && (o.$typeUrl === Storage.typeUrl || ResourceValue.isAmino(o.quantity) && Array.isArray(o.attributes) && (!o.attributes.length || Attribute.isAmino(o.attributes[0]))); + }, encode(message: Storage, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.quantity !== undefined) { ResourceValue.encode(message.quantity, writer.uint32(10).fork()).ldelim(); @@ -459,6 +501,13 @@ export const Storage = { typeUrl: "/akash.base.v1beta1.Storage", value: Storage.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Storage.typeUrl)) { + return; + } + ResourceValue.registerTypeUrl(); + Attribute.registerTypeUrl(); } }; function createBaseResourceUnits(): ResourceUnits { @@ -478,6 +527,15 @@ function createBaseResourceUnits(): ResourceUnits { */ export const ResourceUnits = { typeUrl: "/akash.base.v1beta1.ResourceUnits", + is(o: any): o is ResourceUnits { + return o && (o.$typeUrl === ResourceUnits.typeUrl || Array.isArray(o.endpoints) && (!o.endpoints.length || Endpoint.is(o.endpoints[0]))); + }, + isSDK(o: any): o is ResourceUnitsSDKType { + return o && (o.$typeUrl === ResourceUnits.typeUrl || Array.isArray(o.endpoints) && (!o.endpoints.length || Endpoint.isSDK(o.endpoints[0]))); + }, + isAmino(o: any): o is ResourceUnitsAmino { + return o && (o.$typeUrl === ResourceUnits.typeUrl || Array.isArray(o.endpoints) && (!o.endpoints.length || Endpoint.isAmino(o.endpoints[0]))); + }, encode(message: ResourceUnits, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.cpu !== undefined) { CPU.encode(message.cpu, writer.uint32(10).fork()).ldelim(); @@ -598,5 +656,14 @@ export const ResourceUnits = { typeUrl: "/akash.base.v1beta1.ResourceUnits", value: ResourceUnits.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ResourceUnits.typeUrl)) { + return; + } + CPU.registerTypeUrl(); + Memory.registerTypeUrl(); + Storage.registerTypeUrl(); + Endpoint.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/akash/base/v1beta1/resourcevalue.ts b/__fixtures__/v-next/outputv3/akash/base/v1beta1/resourcevalue.ts index e8c806b13a..491220a99f 100644 --- a/__fixtures__/v-next/outputv3/akash/base/v1beta1/resourcevalue.ts +++ b/__fixtures__/v-next/outputv3/akash/base/v1beta1/resourcevalue.ts @@ -45,6 +45,15 @@ function createBaseResourceValue(): ResourceValue { */ export const ResourceValue = { typeUrl: "/akash.base.v1beta1.ResourceValue", + is(o: any): o is ResourceValue { + return o && (o.$typeUrl === ResourceValue.typeUrl || o.val instanceof Uint8Array || typeof o.val === "string"); + }, + isSDK(o: any): o is ResourceValueSDKType { + return o && (o.$typeUrl === ResourceValue.typeUrl || o.val instanceof Uint8Array || typeof o.val === "string"); + }, + isAmino(o: any): o is ResourceValueAmino { + return o && (o.$typeUrl === ResourceValue.typeUrl || o.val instanceof Uint8Array || typeof o.val === "string"); + }, encode(message: ResourceValue, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.val.length !== 0) { writer.uint32(10).bytes(message.val); @@ -111,5 +120,6 @@ export const ResourceValue = { typeUrl: "/akash.base.v1beta1.ResourceValue", value: ResourceValue.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/akash/base/v1beta2/attribute.ts b/__fixtures__/v-next/outputv3/akash/base/v1beta2/attribute.ts index da366ffff9..544bb3b562 100644 --- a/__fixtures__/v-next/outputv3/akash/base/v1beta2/attribute.ts +++ b/__fixtures__/v-next/outputv3/akash/base/v1beta2/attribute.ts @@ -1,5 +1,6 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; import { isSet, DeepPartial } from "../../../helpers"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "akash.base.v1beta2"; /** * Attribute represents key value pair @@ -150,6 +151,15 @@ function createBaseAttribute(): Attribute { */ export const Attribute = { typeUrl: "/akash.base.v1beta2.Attribute", + is(o: any): o is Attribute { + return o && (o.$typeUrl === Attribute.typeUrl || typeof o.key === "string" && typeof o.value === "string"); + }, + isSDK(o: any): o is AttributeSDKType { + return o && (o.$typeUrl === Attribute.typeUrl || typeof o.key === "string" && typeof o.value === "string"); + }, + isAmino(o: any): o is AttributeAmino { + return o && (o.$typeUrl === Attribute.typeUrl || typeof o.key === "string" && typeof o.value === "string"); + }, encode(message: Attribute, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.key !== "") { writer.uint32(10).string(message.key); @@ -230,7 +240,8 @@ export const Attribute = { typeUrl: "/akash.base.v1beta2.Attribute", value: Attribute.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseSignedBy(): SignedBy { return { @@ -249,6 +260,15 @@ function createBaseSignedBy(): SignedBy { */ export const SignedBy = { typeUrl: "/akash.base.v1beta2.SignedBy", + is(o: any): o is SignedBy { + return o && (o.$typeUrl === SignedBy.typeUrl || Array.isArray(o.allOf) && (!o.allOf.length || typeof o.allOf[0] === "string") && Array.isArray(o.anyOf) && (!o.anyOf.length || typeof o.anyOf[0] === "string")); + }, + isSDK(o: any): o is SignedBySDKType { + return o && (o.$typeUrl === SignedBy.typeUrl || Array.isArray(o.all_of) && (!o.all_of.length || typeof o.all_of[0] === "string") && Array.isArray(o.any_of) && (!o.any_of.length || typeof o.any_of[0] === "string")); + }, + isAmino(o: any): o is SignedByAmino { + return o && (o.$typeUrl === SignedBy.typeUrl || Array.isArray(o.all_of) && (!o.all_of.length || typeof o.all_of[0] === "string") && Array.isArray(o.any_of) && (!o.any_of.length || typeof o.any_of[0] === "string")); + }, encode(message: SignedBy, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.allOf) { writer.uint32(10).string(v!); @@ -341,7 +361,8 @@ export const SignedBy = { typeUrl: "/akash.base.v1beta2.SignedBy", value: SignedBy.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBasePlacementRequirements(): PlacementRequirements { return { @@ -357,6 +378,15 @@ function createBasePlacementRequirements(): PlacementRequirements { */ export const PlacementRequirements = { typeUrl: "/akash.base.v1beta2.PlacementRequirements", + is(o: any): o is PlacementRequirements { + return o && (o.$typeUrl === PlacementRequirements.typeUrl || SignedBy.is(o.signedBy) && Array.isArray(o.attributes) && (!o.attributes.length || Attribute.is(o.attributes[0]))); + }, + isSDK(o: any): o is PlacementRequirementsSDKType { + return o && (o.$typeUrl === PlacementRequirements.typeUrl || SignedBy.isSDK(o.signed_by) && Array.isArray(o.attributes) && (!o.attributes.length || Attribute.isSDK(o.attributes[0]))); + }, + isAmino(o: any): o is PlacementRequirementsAmino { + return o && (o.$typeUrl === PlacementRequirements.typeUrl || SignedBy.isAmino(o.signed_by) && Array.isArray(o.attributes) && (!o.attributes.length || Attribute.isAmino(o.attributes[0]))); + }, encode(message: PlacementRequirements, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.signedBy !== undefined) { SignedBy.encode(message.signedBy, writer.uint32(10).fork()).ldelim(); @@ -445,5 +475,12 @@ export const PlacementRequirements = { typeUrl: "/akash.base.v1beta2.PlacementRequirements", value: PlacementRequirements.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(PlacementRequirements.typeUrl)) { + return; + } + SignedBy.registerTypeUrl(); + Attribute.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/akash/base/v1beta2/endpoint.ts b/__fixtures__/v-next/outputv3/akash/base/v1beta2/endpoint.ts index 4319edbc51..aaee0595c1 100644 --- a/__fixtures__/v-next/outputv3/akash/base/v1beta2/endpoint.ts +++ b/__fixtures__/v-next/outputv3/akash/base/v1beta2/endpoint.ts @@ -1,5 +1,5 @@ -import { BinaryReader, BinaryWriter } from "../../../binary"; import { isSet, DeepPartial } from "../../../helpers"; +import { BinaryReader, BinaryWriter } from "../../../binary"; export const protobufPackage = "akash.base.v1beta2"; /** This describes how the endpoint is implemented when the lease is deployed */ export enum Endpoint_Kind { @@ -91,6 +91,15 @@ function createBaseEndpoint(): Endpoint { */ export const Endpoint = { typeUrl: "/akash.base.v1beta2.Endpoint", + is(o: any): o is Endpoint { + return o && (o.$typeUrl === Endpoint.typeUrl || isSet(o.kind) && typeof o.sequenceNumber === "number"); + }, + isSDK(o: any): o is EndpointSDKType { + return o && (o.$typeUrl === Endpoint.typeUrl || isSet(o.kind) && typeof o.sequence_number === "number"); + }, + isAmino(o: any): o is EndpointAmino { + return o && (o.$typeUrl === Endpoint.typeUrl || isSet(o.kind) && typeof o.sequence_number === "number"); + }, encode(message: Endpoint, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.kind !== 0) { writer.uint32(8).int32(message.kind); @@ -171,5 +180,6 @@ export const Endpoint = { typeUrl: "/akash.base.v1beta2.Endpoint", value: Endpoint.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/akash/base/v1beta2/resource.ts b/__fixtures__/v-next/outputv3/akash/base/v1beta2/resource.ts index 3cf291434b..5ed3f952f1 100644 --- a/__fixtures__/v-next/outputv3/akash/base/v1beta2/resource.ts +++ b/__fixtures__/v-next/outputv3/akash/base/v1beta2/resource.ts @@ -1,6 +1,7 @@ import { ResourceValue, ResourceValueAmino, ResourceValueSDKType } from "./resourcevalue"; import { Attribute, AttributeAmino, AttributeSDKType } from "./attribute"; import { BinaryReader, BinaryWriter } from "../../../binary"; +import { GlobalDecoderRegistry } from "../../../registry"; import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "akash.base.v1beta2"; /** @@ -122,6 +123,15 @@ function createBaseCPU(): CPU { */ export const CPU = { typeUrl: "/akash.base.v1beta2.CPU", + is(o: any): o is CPU { + return o && (o.$typeUrl === CPU.typeUrl || ResourceValue.is(o.units) && Array.isArray(o.attributes) && (!o.attributes.length || Attribute.is(o.attributes[0]))); + }, + isSDK(o: any): o is CPUSDKType { + return o && (o.$typeUrl === CPU.typeUrl || ResourceValue.isSDK(o.units) && Array.isArray(o.attributes) && (!o.attributes.length || Attribute.isSDK(o.attributes[0]))); + }, + isAmino(o: any): o is CPUAmino { + return o && (o.$typeUrl === CPU.typeUrl || ResourceValue.isAmino(o.units) && Array.isArray(o.attributes) && (!o.attributes.length || Attribute.isAmino(o.attributes[0]))); + }, encode(message: CPU, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.units !== undefined) { ResourceValue.encode(message.units, writer.uint32(10).fork()).ldelim(); @@ -210,6 +220,13 @@ export const CPU = { typeUrl: "/akash.base.v1beta2.CPU", value: CPU.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(CPU.typeUrl)) { + return; + } + ResourceValue.registerTypeUrl(); + Attribute.registerTypeUrl(); } }; function createBaseMemory(): Memory { @@ -226,6 +243,15 @@ function createBaseMemory(): Memory { */ export const Memory = { typeUrl: "/akash.base.v1beta2.Memory", + is(o: any): o is Memory { + return o && (o.$typeUrl === Memory.typeUrl || ResourceValue.is(o.quantity) && Array.isArray(o.attributes) && (!o.attributes.length || Attribute.is(o.attributes[0]))); + }, + isSDK(o: any): o is MemorySDKType { + return o && (o.$typeUrl === Memory.typeUrl || ResourceValue.isSDK(o.quantity) && Array.isArray(o.attributes) && (!o.attributes.length || Attribute.isSDK(o.attributes[0]))); + }, + isAmino(o: any): o is MemoryAmino { + return o && (o.$typeUrl === Memory.typeUrl || ResourceValue.isAmino(o.quantity) && Array.isArray(o.attributes) && (!o.attributes.length || Attribute.isAmino(o.attributes[0]))); + }, encode(message: Memory, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.quantity !== undefined) { ResourceValue.encode(message.quantity, writer.uint32(10).fork()).ldelim(); @@ -314,6 +340,13 @@ export const Memory = { typeUrl: "/akash.base.v1beta2.Memory", value: Memory.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Memory.typeUrl)) { + return; + } + ResourceValue.registerTypeUrl(); + Attribute.registerTypeUrl(); } }; function createBaseStorage(): Storage { @@ -331,6 +364,15 @@ function createBaseStorage(): Storage { */ export const Storage = { typeUrl: "/akash.base.v1beta2.Storage", + is(o: any): o is Storage { + return o && (o.$typeUrl === Storage.typeUrl || typeof o.name === "string" && ResourceValue.is(o.quantity) && Array.isArray(o.attributes) && (!o.attributes.length || Attribute.is(o.attributes[0]))); + }, + isSDK(o: any): o is StorageSDKType { + return o && (o.$typeUrl === Storage.typeUrl || typeof o.name === "string" && ResourceValue.isSDK(o.quantity) && Array.isArray(o.attributes) && (!o.attributes.length || Attribute.isSDK(o.attributes[0]))); + }, + isAmino(o: any): o is StorageAmino { + return o && (o.$typeUrl === Storage.typeUrl || typeof o.name === "string" && ResourceValue.isAmino(o.quantity) && Array.isArray(o.attributes) && (!o.attributes.length || Attribute.isAmino(o.attributes[0]))); + }, encode(message: Storage, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -433,5 +475,12 @@ export const Storage = { typeUrl: "/akash.base.v1beta2.Storage", value: Storage.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Storage.typeUrl)) { + return; + } + ResourceValue.registerTypeUrl(); + Attribute.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/akash/base/v1beta2/resourceunits.ts b/__fixtures__/v-next/outputv3/akash/base/v1beta2/resourceunits.ts index 8c88050bb3..80923a4b1f 100644 --- a/__fixtures__/v-next/outputv3/akash/base/v1beta2/resourceunits.ts +++ b/__fixtures__/v-next/outputv3/akash/base/v1beta2/resourceunits.ts @@ -1,6 +1,7 @@ import { CPU, CPUAmino, CPUSDKType, Memory, MemoryAmino, MemorySDKType, Storage, StorageAmino, StorageSDKType } from "./resource"; import { Endpoint, EndpointAmino, EndpointSDKType } from "./endpoint"; import { BinaryReader, BinaryWriter } from "../../../binary"; +import { GlobalDecoderRegistry } from "../../../registry"; import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "akash.base.v1beta2"; /** @@ -63,6 +64,15 @@ function createBaseResourceUnits(): ResourceUnits { */ export const ResourceUnits = { typeUrl: "/akash.base.v1beta2.ResourceUnits", + is(o: any): o is ResourceUnits { + return o && (o.$typeUrl === ResourceUnits.typeUrl || Array.isArray(o.storage) && (!o.storage.length || Storage.is(o.storage[0])) && Array.isArray(o.endpoints) && (!o.endpoints.length || Endpoint.is(o.endpoints[0]))); + }, + isSDK(o: any): o is ResourceUnitsSDKType { + return o && (o.$typeUrl === ResourceUnits.typeUrl || Array.isArray(o.storage) && (!o.storage.length || Storage.isSDK(o.storage[0])) && Array.isArray(o.endpoints) && (!o.endpoints.length || Endpoint.isSDK(o.endpoints[0]))); + }, + isAmino(o: any): o is ResourceUnitsAmino { + return o && (o.$typeUrl === ResourceUnits.typeUrl || Array.isArray(o.storage) && (!o.storage.length || Storage.isAmino(o.storage[0])) && Array.isArray(o.endpoints) && (!o.endpoints.length || Endpoint.isAmino(o.endpoints[0]))); + }, encode(message: ResourceUnits, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.cpu !== undefined) { CPU.encode(message.cpu, writer.uint32(10).fork()).ldelim(); @@ -187,5 +197,14 @@ export const ResourceUnits = { typeUrl: "/akash.base.v1beta2.ResourceUnits", value: ResourceUnits.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ResourceUnits.typeUrl)) { + return; + } + CPU.registerTypeUrl(); + Memory.registerTypeUrl(); + Storage.registerTypeUrl(); + Endpoint.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/akash/base/v1beta2/resourcevalue.ts b/__fixtures__/v-next/outputv3/akash/base/v1beta2/resourcevalue.ts index 3377670da6..142d8b6e1c 100644 --- a/__fixtures__/v-next/outputv3/akash/base/v1beta2/resourcevalue.ts +++ b/__fixtures__/v-next/outputv3/akash/base/v1beta2/resourcevalue.ts @@ -45,6 +45,15 @@ function createBaseResourceValue(): ResourceValue { */ export const ResourceValue = { typeUrl: "/akash.base.v1beta2.ResourceValue", + is(o: any): o is ResourceValue { + return o && (o.$typeUrl === ResourceValue.typeUrl || o.val instanceof Uint8Array || typeof o.val === "string"); + }, + isSDK(o: any): o is ResourceValueSDKType { + return o && (o.$typeUrl === ResourceValue.typeUrl || o.val instanceof Uint8Array || typeof o.val === "string"); + }, + isAmino(o: any): o is ResourceValueAmino { + return o && (o.$typeUrl === ResourceValue.typeUrl || o.val instanceof Uint8Array || typeof o.val === "string"); + }, encode(message: ResourceValue, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.val.length !== 0) { writer.uint32(10).bytes(message.val); @@ -111,5 +120,6 @@ export const ResourceValue = { typeUrl: "/akash.base.v1beta2.ResourceValue", value: ResourceValue.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/akash/bundle.ts b/__fixtures__/v-next/outputv3/akash/bundle.ts index 1252e3e6c0..235f53792d 100644 --- a/__fixtures__/v-next/outputv3/akash/bundle.ts +++ b/__fixtures__/v-next/outputv3/akash/bundle.ts @@ -67,14 +67,14 @@ import * as _328 from "./deployment/v1beta2/service.registry"; import * as _329 from "./market/v1beta2/service.registry"; import * as _330 from "./provider/v1beta1/provider.registry"; import * as _331 from "./provider/v1beta2/provider.registry"; -import * as _332 from "./audit/v1beta2/query.lcd"; -import * as _333 from "./cert/v1beta2/query.lcd"; -import * as _334 from "./deployment/v1beta1/query.lcd"; -import * as _335 from "./deployment/v1beta2/query.lcd"; -import * as _336 from "./escrow/v1beta1/query.lcd"; -import * as _337 from "./escrow/v1beta2/query.lcd"; -import * as _338 from "./market/v1beta2/query.lcd"; -import * as _339 from "./provider/v1beta2/query.lcd"; +import * as _332 from "./audit/v1beta2/query.rpc.func"; +import * as _333 from "./cert/v1beta2/query.rpc.func"; +import * as _334 from "./deployment/v1beta1/query.rpc.func"; +import * as _335 from "./deployment/v1beta2/query.rpc.func"; +import * as _336 from "./escrow/v1beta1/query.rpc.func"; +import * as _337 from "./escrow/v1beta2/query.rpc.func"; +import * as _338 from "./market/v1beta2/query.rpc.func"; +import * as _339 from "./provider/v1beta2/query.rpc.func"; import * as _340 from "./audit/v1beta2/query.rpc.Query"; import * as _341 from "./cert/v1beta2/query.rpc.Query"; import * as _342 from "./deployment/v1beta1/query.rpc.Query"; @@ -83,24 +83,32 @@ import * as _344 from "./escrow/v1beta1/query.rpc.Query"; import * as _345 from "./escrow/v1beta2/query.rpc.Query"; import * as _346 from "./market/v1beta2/query.rpc.Query"; import * as _347 from "./provider/v1beta2/query.rpc.Query"; -import * as _348 from "./audit/v1beta1/audit.rpc.msg"; -import * as _349 from "./audit/v1beta2/audit.rpc.msg"; -import * as _350 from "./cert/v1beta2/cert.rpc.msg"; -import * as _351 from "./deployment/v1beta1/deployment.rpc.msg"; -import * as _352 from "./deployment/v1beta2/service.rpc.msg"; -import * as _353 from "./market/v1beta2/service.rpc.msg"; -import * as _354 from "./provider/v1beta1/provider.rpc.msg"; -import * as _355 from "./provider/v1beta2/provider.rpc.msg"; -import * as _531 from "./lcd"; -import * as _532 from "./rpc.query"; -import * as _533 from "./rpc.tx"; +import * as _348 from "./audit/v1beta1/audit.rpc.func"; +import * as _349 from "./audit/v1beta2/audit.rpc.func"; +import * as _350 from "./cert/v1beta2/cert.rpc.func"; +import * as _351 from "./deployment/v1beta1/deployment.rpc.func"; +import * as _352 from "./deployment/v1beta2/service.rpc.func"; +import * as _353 from "./market/v1beta2/service.rpc.func"; +import * as _354 from "./provider/v1beta1/provider.rpc.func"; +import * as _355 from "./provider/v1beta2/provider.rpc.func"; +import * as _356 from "./audit/v1beta1/audit.rpc.msg"; +import * as _357 from "./audit/v1beta2/audit.rpc.msg"; +import * as _358 from "./cert/v1beta2/cert.rpc.msg"; +import * as _359 from "./deployment/v1beta1/deployment.rpc.msg"; +import * as _360 from "./deployment/v1beta2/service.rpc.msg"; +import * as _361 from "./market/v1beta2/service.rpc.msg"; +import * as _362 from "./provider/v1beta1/provider.rpc.msg"; +import * as _363 from "./provider/v1beta2/provider.rpc.msg"; +import * as _573 from "./rpc.query"; +import * as _574 from "./rpc.tx"; export namespace akash { export namespace audit { export const v1beta1 = { ..._0, ..._316, ..._324, - ..._348 + ..._348, + ..._356 }; export const v1beta2 = { ..._1, @@ -110,7 +118,8 @@ export namespace akash { ..._325, ..._332, ..._340, - ..._349 + ..._349, + ..._357 }; } export namespace base { @@ -137,7 +146,8 @@ export namespace akash { ..._326, ..._333, ..._341, - ..._350 + ..._350, + ..._358 }; } export namespace deployment { @@ -152,7 +162,8 @@ export namespace akash { ..._327, ..._334, ..._342, - ..._351 + ..._351, + ..._359 }; export const v1beta2 = { ..._22, @@ -171,7 +182,8 @@ export namespace akash { ..._328, ..._335, ..._343, - ..._352 + ..._352, + ..._360 }; } export namespace escrow { @@ -209,7 +221,8 @@ export namespace akash { ..._329, ..._338, ..._346, - ..._353 + ..._353, + ..._361 }; } export namespace provider { @@ -217,7 +230,8 @@ export namespace akash { ..._49, ..._322, ..._330, - ..._354 + ..._354, + ..._362 }; export const v1beta2 = { ..._50, @@ -227,12 +241,12 @@ export namespace akash { ..._331, ..._339, ..._347, - ..._355 + ..._355, + ..._363 }; } export const ClientFactory = { - ..._531, - ..._532, - ..._533 + ..._573, + ..._574 }; } \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/akash/cert/v1beta2/cert.registry.ts b/__fixtures__/v-next/outputv3/akash/cert/v1beta2/cert.registry.ts index 6dc4a17919..bbdec5e38e 100644 --- a/__fixtures__/v-next/outputv3/akash/cert/v1beta2/cert.registry.ts +++ b/__fixtures__/v-next/outputv3/akash/cert/v1beta2/cert.registry.ts @@ -1,11 +1,6 @@ -import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { TelescopeGeneratedType } from "../../../types"; import { MsgCreateCertificate, MsgCreateCertificateSDKType, MsgRevokeCertificate, MsgRevokeCertificateSDKType } from "./cert"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/akash.cert.v1beta2.MsgCreateCertificate", MsgCreateCertificate], ["/akash.cert.v1beta2.MsgRevokeCertificate", MsgRevokeCertificate]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/akash.cert.v1beta2.MsgCreateCertificate", MsgCreateCertificate], ["/akash.cert.v1beta2.MsgRevokeCertificate", MsgRevokeCertificate]]; export const MessageComposer = { encoded: { createCertificate(value: MsgCreateCertificate) { diff --git a/__fixtures__/v-next/outputv3/akash/cert/v1beta2/cert.rpc.func.ts b/__fixtures__/v-next/outputv3/akash/cert/v1beta2/cert.rpc.func.ts new file mode 100644 index 0000000000..bd7aec965f --- /dev/null +++ b/__fixtures__/v-next/outputv3/akash/cert/v1beta2/cert.rpc.func.ts @@ -0,0 +1,20 @@ +import { buildTx } from "../../../helper-func-types"; +import { MsgCreateCertificate, MsgCreateCertificateSDKType, MsgCreateCertificateResponse, MsgCreateCertificateResponseSDKType, MsgRevokeCertificate, MsgRevokeCertificateSDKType, MsgRevokeCertificateResponse, MsgRevokeCertificateResponseSDKType } from "./cert"; +/** + * CreateCertificate defines a method to create new certificate given proper inputs. + * @name createCertificate + * @package akash.cert.v1beta2 + * @see proto service: akash.cert.v1beta2.CreateCertificate + */ +export const createCertificate = buildTx({ + msg: MsgCreateCertificate +}); +/** + * RevokeCertificate defines a method to revoke the certificate + * @name revokeCertificate + * @package akash.cert.v1beta2 + * @see proto service: akash.cert.v1beta2.RevokeCertificate + */ +export const revokeCertificate = buildTx({ + msg: MsgRevokeCertificate +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/akash/cert/v1beta2/cert.ts b/__fixtures__/v-next/outputv3/akash/cert/v1beta2/cert.ts index b148a92c1c..5ddb3ef7d5 100644 --- a/__fixtures__/v-next/outputv3/akash/cert/v1beta2/cert.ts +++ b/__fixtures__/v-next/outputv3/akash/cert/v1beta2/cert.ts @@ -1,5 +1,6 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../helpers"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "akash.cert.v1beta2"; /** State is an enum which refers to state of deployment */ export enum Certificate_State { @@ -283,6 +284,15 @@ function createBaseCertificateID(): CertificateID { */ export const CertificateID = { typeUrl: "/akash.cert.v1beta2.CertificateID", + is(o: any): o is CertificateID { + return o && (o.$typeUrl === CertificateID.typeUrl || typeof o.owner === "string" && typeof o.serial === "string"); + }, + isSDK(o: any): o is CertificateIDSDKType { + return o && (o.$typeUrl === CertificateID.typeUrl || typeof o.owner === "string" && typeof o.serial === "string"); + }, + isAmino(o: any): o is CertificateIDAmino { + return o && (o.$typeUrl === CertificateID.typeUrl || typeof o.owner === "string" && typeof o.serial === "string"); + }, encode(message: CertificateID, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.owner !== "") { writer.uint32(10).string(message.owner); @@ -363,7 +373,8 @@ export const CertificateID = { typeUrl: "/akash.cert.v1beta2.CertificateID", value: CertificateID.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseCertificate(): Certificate { return { @@ -380,6 +391,15 @@ function createBaseCertificate(): Certificate { */ export const Certificate = { typeUrl: "/akash.cert.v1beta2.Certificate", + is(o: any): o is Certificate { + return o && (o.$typeUrl === Certificate.typeUrl || isSet(o.state) && (o.cert instanceof Uint8Array || typeof o.cert === "string") && (o.pubkey instanceof Uint8Array || typeof o.pubkey === "string")); + }, + isSDK(o: any): o is CertificateSDKType { + return o && (o.$typeUrl === Certificate.typeUrl || isSet(o.state) && (o.cert instanceof Uint8Array || typeof o.cert === "string") && (o.pubkey instanceof Uint8Array || typeof o.pubkey === "string")); + }, + isAmino(o: any): o is CertificateAmino { + return o && (o.$typeUrl === Certificate.typeUrl || isSet(o.state) && (o.cert instanceof Uint8Array || typeof o.cert === "string") && (o.pubkey instanceof Uint8Array || typeof o.pubkey === "string")); + }, encode(message: Certificate, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.state !== 0) { writer.uint32(16).int32(message.state); @@ -474,7 +494,8 @@ export const Certificate = { typeUrl: "/akash.cert.v1beta2.Certificate", value: Certificate.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseCertificateFilter(): CertificateFilter { return { @@ -491,6 +512,15 @@ function createBaseCertificateFilter(): CertificateFilter { */ export const CertificateFilter = { typeUrl: "/akash.cert.v1beta2.CertificateFilter", + is(o: any): o is CertificateFilter { + return o && (o.$typeUrl === CertificateFilter.typeUrl || typeof o.owner === "string" && typeof o.serial === "string" && typeof o.state === "string"); + }, + isSDK(o: any): o is CertificateFilterSDKType { + return o && (o.$typeUrl === CertificateFilter.typeUrl || typeof o.owner === "string" && typeof o.serial === "string" && typeof o.state === "string"); + }, + isAmino(o: any): o is CertificateFilterAmino { + return o && (o.$typeUrl === CertificateFilter.typeUrl || typeof o.owner === "string" && typeof o.serial === "string" && typeof o.state === "string"); + }, encode(message: CertificateFilter, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.owner !== "") { writer.uint32(10).string(message.owner); @@ -585,7 +615,8 @@ export const CertificateFilter = { typeUrl: "/akash.cert.v1beta2.CertificateFilter", value: CertificateFilter.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgCreateCertificate(): MsgCreateCertificate { return { @@ -602,6 +633,15 @@ function createBaseMsgCreateCertificate(): MsgCreateCertificate { */ export const MsgCreateCertificate = { typeUrl: "/akash.cert.v1beta2.MsgCreateCertificate", + is(o: any): o is MsgCreateCertificate { + return o && (o.$typeUrl === MsgCreateCertificate.typeUrl || typeof o.owner === "string" && (o.cert instanceof Uint8Array || typeof o.cert === "string") && (o.pubkey instanceof Uint8Array || typeof o.pubkey === "string")); + }, + isSDK(o: any): o is MsgCreateCertificateSDKType { + return o && (o.$typeUrl === MsgCreateCertificate.typeUrl || typeof o.owner === "string" && (o.cert instanceof Uint8Array || typeof o.cert === "string") && (o.pubkey instanceof Uint8Array || typeof o.pubkey === "string")); + }, + isAmino(o: any): o is MsgCreateCertificateAmino { + return o && (o.$typeUrl === MsgCreateCertificate.typeUrl || typeof o.owner === "string" && (o.cert instanceof Uint8Array || typeof o.cert === "string") && (o.pubkey instanceof Uint8Array || typeof o.pubkey === "string")); + }, encode(message: MsgCreateCertificate, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.owner !== "") { writer.uint32(10).string(message.owner); @@ -696,7 +736,8 @@ export const MsgCreateCertificate = { typeUrl: "/akash.cert.v1beta2.MsgCreateCertificate", value: MsgCreateCertificate.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgCreateCertificateResponse(): MsgCreateCertificateResponse { return {}; @@ -709,6 +750,15 @@ function createBaseMsgCreateCertificateResponse(): MsgCreateCertificateResponse */ export const MsgCreateCertificateResponse = { typeUrl: "/akash.cert.v1beta2.MsgCreateCertificateResponse", + is(o: any): o is MsgCreateCertificateResponse { + return o && o.$typeUrl === MsgCreateCertificateResponse.typeUrl; + }, + isSDK(o: any): o is MsgCreateCertificateResponseSDKType { + return o && o.$typeUrl === MsgCreateCertificateResponse.typeUrl; + }, + isAmino(o: any): o is MsgCreateCertificateResponseAmino { + return o && o.$typeUrl === MsgCreateCertificateResponse.typeUrl; + }, encode(_: MsgCreateCertificateResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -760,7 +810,8 @@ export const MsgCreateCertificateResponse = { typeUrl: "/akash.cert.v1beta2.MsgCreateCertificateResponse", value: MsgCreateCertificateResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgRevokeCertificate(): MsgRevokeCertificate { return { @@ -775,6 +826,15 @@ function createBaseMsgRevokeCertificate(): MsgRevokeCertificate { */ export const MsgRevokeCertificate = { typeUrl: "/akash.cert.v1beta2.MsgRevokeCertificate", + is(o: any): o is MsgRevokeCertificate { + return o && (o.$typeUrl === MsgRevokeCertificate.typeUrl || CertificateID.is(o.id)); + }, + isSDK(o: any): o is MsgRevokeCertificateSDKType { + return o && (o.$typeUrl === MsgRevokeCertificate.typeUrl || CertificateID.isSDK(o.id)); + }, + isAmino(o: any): o is MsgRevokeCertificateAmino { + return o && (o.$typeUrl === MsgRevokeCertificate.typeUrl || CertificateID.isAmino(o.id)); + }, encode(message: MsgRevokeCertificate, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.id !== undefined) { CertificateID.encode(message.id, writer.uint32(10).fork()).ldelim(); @@ -843,6 +903,12 @@ export const MsgRevokeCertificate = { typeUrl: "/akash.cert.v1beta2.MsgRevokeCertificate", value: MsgRevokeCertificate.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgRevokeCertificate.typeUrl)) { + return; + } + CertificateID.registerTypeUrl(); } }; function createBaseMsgRevokeCertificateResponse(): MsgRevokeCertificateResponse { @@ -856,6 +922,15 @@ function createBaseMsgRevokeCertificateResponse(): MsgRevokeCertificateResponse */ export const MsgRevokeCertificateResponse = { typeUrl: "/akash.cert.v1beta2.MsgRevokeCertificateResponse", + is(o: any): o is MsgRevokeCertificateResponse { + return o && o.$typeUrl === MsgRevokeCertificateResponse.typeUrl; + }, + isSDK(o: any): o is MsgRevokeCertificateResponseSDKType { + return o && o.$typeUrl === MsgRevokeCertificateResponse.typeUrl; + }, + isAmino(o: any): o is MsgRevokeCertificateResponseAmino { + return o && o.$typeUrl === MsgRevokeCertificateResponse.typeUrl; + }, encode(_: MsgRevokeCertificateResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -907,5 +982,6 @@ export const MsgRevokeCertificateResponse = { typeUrl: "/akash.cert.v1beta2.MsgRevokeCertificateResponse", value: MsgRevokeCertificateResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/akash/cert/v1beta2/genesis.ts b/__fixtures__/v-next/outputv3/akash/cert/v1beta2/genesis.ts index c355ea18d3..8a54bf09d4 100644 --- a/__fixtures__/v-next/outputv3/akash/cert/v1beta2/genesis.ts +++ b/__fixtures__/v-next/outputv3/akash/cert/v1beta2/genesis.ts @@ -1,5 +1,6 @@ import { Certificate, CertificateAmino, CertificateSDKType } from "./cert"; import { BinaryReader, BinaryWriter } from "../../../binary"; +import { GlobalDecoderRegistry } from "../../../registry"; import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "akash.cert.v1beta2"; /** @@ -81,6 +82,15 @@ function createBaseGenesisCertificate(): GenesisCertificate { */ export const GenesisCertificate = { typeUrl: "/akash.cert.v1beta2.GenesisCertificate", + is(o: any): o is GenesisCertificate { + return o && (o.$typeUrl === GenesisCertificate.typeUrl || typeof o.owner === "string" && Certificate.is(o.certificate)); + }, + isSDK(o: any): o is GenesisCertificateSDKType { + return o && (o.$typeUrl === GenesisCertificate.typeUrl || typeof o.owner === "string" && Certificate.isSDK(o.certificate)); + }, + isAmino(o: any): o is GenesisCertificateAmino { + return o && (o.$typeUrl === GenesisCertificate.typeUrl || typeof o.owner === "string" && Certificate.isAmino(o.certificate)); + }, encode(message: GenesisCertificate, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.owner !== "") { writer.uint32(10).string(message.owner); @@ -163,6 +173,12 @@ export const GenesisCertificate = { typeUrl: "/akash.cert.v1beta2.GenesisCertificate", value: GenesisCertificate.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GenesisCertificate.typeUrl)) { + return; + } + Certificate.registerTypeUrl(); } }; function createBaseGenesisState(): GenesisState { @@ -178,6 +194,15 @@ function createBaseGenesisState(): GenesisState { */ export const GenesisState = { typeUrl: "/akash.cert.v1beta2.GenesisState", + is(o: any): o is GenesisState { + return o && (o.$typeUrl === GenesisState.typeUrl || Array.isArray(o.certificates) && (!o.certificates.length || GenesisCertificate.is(o.certificates[0]))); + }, + isSDK(o: any): o is GenesisStateSDKType { + return o && (o.$typeUrl === GenesisState.typeUrl || Array.isArray(o.certificates) && (!o.certificates.length || GenesisCertificate.isSDK(o.certificates[0]))); + }, + isAmino(o: any): o is GenesisStateAmino { + return o && (o.$typeUrl === GenesisState.typeUrl || Array.isArray(o.certificates) && (!o.certificates.length || GenesisCertificate.isAmino(o.certificates[0]))); + }, encode(message: GenesisState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.certificates) { GenesisCertificate.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -250,5 +275,11 @@ export const GenesisState = { typeUrl: "/akash.cert.v1beta2.GenesisState", value: GenesisState.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GenesisState.typeUrl)) { + return; + } + GenesisCertificate.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/akash/cert/v1beta2/query.rpc.func.ts b/__fixtures__/v-next/outputv3/akash/cert/v1beta2/query.rpc.func.ts new file mode 100644 index 0000000000..70274865cd --- /dev/null +++ b/__fixtures__/v-next/outputv3/akash/cert/v1beta2/query.rpc.func.ts @@ -0,0 +1,17 @@ +import { CertificateFilter, CertificateFilterSDKType, Certificate, CertificateSDKType } from "./cert"; +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { QueryCertificatesRequest, QueryCertificatesRequestSDKType, QueryCertificatesResponse, QueryCertificatesResponseSDKType } from "./query"; +/** + * Certificates queries certificates + * @name getCertificates + * @package akash.cert.v1beta2 + * @see proto service: akash.cert.v1beta2.Certificates + */ +export const getCertificates = buildQuery({ + encode: QueryCertificatesRequest.encode, + decode: QueryCertificatesResponse.decode, + service: "akash.cert.v1beta2.Query", + method: "Certificates", + deps: [QueryCertificatesRequest, QueryCertificatesResponse] +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/akash/cert/v1beta2/query.ts b/__fixtures__/v-next/outputv3/akash/cert/v1beta2/query.ts index 9840f45042..bd244e55b0 100644 --- a/__fixtures__/v-next/outputv3/akash/cert/v1beta2/query.ts +++ b/__fixtures__/v-next/outputv3/akash/cert/v1beta2/query.ts @@ -1,6 +1,7 @@ import { CertificateFilter, CertificateFilterAmino, CertificateFilterSDKType, Certificate, CertificateAmino, CertificateSDKType } from "./cert"; import { PageRequest, PageRequestAmino, PageRequestSDKType, PageResponse, PageResponseAmino, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination"; import { BinaryReader, BinaryWriter } from "../../../binary"; +import { GlobalDecoderRegistry } from "../../../registry"; import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "akash.cert.v1beta2"; /** @@ -119,6 +120,15 @@ function createBaseCertificateResponse(): CertificateResponse { */ export const CertificateResponse = { typeUrl: "/akash.cert.v1beta2.CertificateResponse", + is(o: any): o is CertificateResponse { + return o && (o.$typeUrl === CertificateResponse.typeUrl || Certificate.is(o.certificate) && typeof o.serial === "string"); + }, + isSDK(o: any): o is CertificateResponseSDKType { + return o && (o.$typeUrl === CertificateResponse.typeUrl || Certificate.isSDK(o.certificate) && typeof o.serial === "string"); + }, + isAmino(o: any): o is CertificateResponseAmino { + return o && (o.$typeUrl === CertificateResponse.typeUrl || Certificate.isAmino(o.certificate) && typeof o.serial === "string"); + }, encode(message: CertificateResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.certificate !== undefined) { Certificate.encode(message.certificate, writer.uint32(10).fork()).ldelim(); @@ -201,6 +211,12 @@ export const CertificateResponse = { typeUrl: "/akash.cert.v1beta2.CertificateResponse", value: CertificateResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(CertificateResponse.typeUrl)) { + return; + } + Certificate.registerTypeUrl(); } }; function createBaseQueryCertificatesRequest(): QueryCertificatesRequest { @@ -217,6 +233,15 @@ function createBaseQueryCertificatesRequest(): QueryCertificatesRequest { */ export const QueryCertificatesRequest = { typeUrl: "/akash.cert.v1beta2.QueryCertificatesRequest", + is(o: any): o is QueryCertificatesRequest { + return o && (o.$typeUrl === QueryCertificatesRequest.typeUrl || CertificateFilter.is(o.filter)); + }, + isSDK(o: any): o is QueryCertificatesRequestSDKType { + return o && (o.$typeUrl === QueryCertificatesRequest.typeUrl || CertificateFilter.isSDK(o.filter)); + }, + isAmino(o: any): o is QueryCertificatesRequestAmino { + return o && (o.$typeUrl === QueryCertificatesRequest.typeUrl || CertificateFilter.isAmino(o.filter)); + }, encode(message: QueryCertificatesRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.filter !== undefined) { CertificateFilter.encode(message.filter, writer.uint32(10).fork()).ldelim(); @@ -301,6 +326,13 @@ export const QueryCertificatesRequest = { typeUrl: "/akash.cert.v1beta2.QueryCertificatesRequest", value: QueryCertificatesRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryCertificatesRequest.typeUrl)) { + return; + } + CertificateFilter.registerTypeUrl(); + PageRequest.registerTypeUrl(); } }; function createBaseQueryCertificatesResponse(): QueryCertificatesResponse { @@ -317,6 +349,15 @@ function createBaseQueryCertificatesResponse(): QueryCertificatesResponse { */ export const QueryCertificatesResponse = { typeUrl: "/akash.cert.v1beta2.QueryCertificatesResponse", + is(o: any): o is QueryCertificatesResponse { + return o && (o.$typeUrl === QueryCertificatesResponse.typeUrl || Array.isArray(o.certificates) && (!o.certificates.length || CertificateResponse.is(o.certificates[0]))); + }, + isSDK(o: any): o is QueryCertificatesResponseSDKType { + return o && (o.$typeUrl === QueryCertificatesResponse.typeUrl || Array.isArray(o.certificates) && (!o.certificates.length || CertificateResponse.isSDK(o.certificates[0]))); + }, + isAmino(o: any): o is QueryCertificatesResponseAmino { + return o && (o.$typeUrl === QueryCertificatesResponse.typeUrl || Array.isArray(o.certificates) && (!o.certificates.length || CertificateResponse.isAmino(o.certificates[0]))); + }, encode(message: QueryCertificatesResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.certificates) { CertificateResponse.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -405,5 +446,12 @@ export const QueryCertificatesResponse = { typeUrl: "/akash.cert.v1beta2.QueryCertificatesResponse", value: QueryCertificatesResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryCertificatesResponse.typeUrl)) { + return; + } + CertificateResponse.registerTypeUrl(); + PageResponse.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/akash/deployment/v1beta1/authz.ts b/__fixtures__/v-next/outputv3/akash/deployment/v1beta1/authz.ts index 14e68f7c55..d1433a8f33 100644 --- a/__fixtures__/v-next/outputv3/akash/deployment/v1beta1/authz.ts +++ b/__fixtures__/v-next/outputv3/akash/deployment/v1beta1/authz.ts @@ -1,5 +1,6 @@ import { Coin, CoinAmino, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; +import { GlobalDecoderRegistry } from "../../../registry"; import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "akash.deployment.v1beta1"; /** @@ -61,6 +62,15 @@ function createBaseDepositDeploymentAuthorization(): DepositDeploymentAuthorizat */ export const DepositDeploymentAuthorization = { typeUrl: "/akash.deployment.v1beta1.DepositDeploymentAuthorization", + is(o: any): o is DepositDeploymentAuthorization { + return o && (o.$typeUrl === DepositDeploymentAuthorization.typeUrl || Coin.is(o.spendLimit)); + }, + isSDK(o: any): o is DepositDeploymentAuthorizationSDKType { + return o && (o.$typeUrl === DepositDeploymentAuthorization.typeUrl || Coin.isSDK(o.spend_limit)); + }, + isAmino(o: any): o is DepositDeploymentAuthorizationAmino { + return o && (o.$typeUrl === DepositDeploymentAuthorization.typeUrl || Coin.isAmino(o.spend_limit)); + }, encode(message: DepositDeploymentAuthorization, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.spendLimit !== undefined) { Coin.encode(message.spendLimit, writer.uint32(10).fork()).ldelim(); @@ -129,5 +139,12 @@ export const DepositDeploymentAuthorization = { typeUrl: "/akash.deployment.v1beta1.DepositDeploymentAuthorization", value: DepositDeploymentAuthorization.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(DepositDeploymentAuthorization.typeUrl)) { + return; + } + GlobalDecoderRegistry.register(DepositDeploymentAuthorization.typeUrl, DepositDeploymentAuthorization); + Coin.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/akash/deployment/v1beta1/deployment.registry.ts b/__fixtures__/v-next/outputv3/akash/deployment/v1beta1/deployment.registry.ts index c70b27ae5c..fb23834086 100644 --- a/__fixtures__/v-next/outputv3/akash/deployment/v1beta1/deployment.registry.ts +++ b/__fixtures__/v-next/outputv3/akash/deployment/v1beta1/deployment.registry.ts @@ -1,13 +1,8 @@ import { GroupSpec, GroupSpecSDKType, GroupID, GroupIDSDKType, MsgCloseGroup, MsgCloseGroupSDKType, MsgPauseGroup, MsgPauseGroupSDKType, MsgStartGroup, MsgStartGroupSDKType } from "./group"; import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; -import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { TelescopeGeneratedType } from "../../../types"; import { MsgCreateDeployment, MsgCreateDeploymentSDKType, MsgDepositDeployment, MsgDepositDeploymentSDKType, MsgUpdateDeployment, MsgUpdateDeploymentSDKType, MsgCloseDeployment, MsgCloseDeploymentSDKType } from "./deployment"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/akash.deployment.v1beta1.MsgCreateDeployment", MsgCreateDeployment], ["/akash.deployment.v1beta1.MsgDepositDeployment", MsgDepositDeployment], ["/akash.deployment.v1beta1.MsgUpdateDeployment", MsgUpdateDeployment], ["/akash.deployment.v1beta1.MsgCloseDeployment", MsgCloseDeployment], ["/akash.deployment.v1beta1.MsgCloseGroup", MsgCloseGroup], ["/akash.deployment.v1beta1.MsgPauseGroup", MsgPauseGroup], ["/akash.deployment.v1beta1.MsgStartGroup", MsgStartGroup]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/akash.deployment.v1beta1.MsgCreateDeployment", MsgCreateDeployment], ["/akash.deployment.v1beta1.MsgDepositDeployment", MsgDepositDeployment], ["/akash.deployment.v1beta1.MsgUpdateDeployment", MsgUpdateDeployment], ["/akash.deployment.v1beta1.MsgCloseDeployment", MsgCloseDeployment], ["/akash.deployment.v1beta1.MsgCloseGroup", MsgCloseGroup], ["/akash.deployment.v1beta1.MsgPauseGroup", MsgPauseGroup], ["/akash.deployment.v1beta1.MsgStartGroup", MsgStartGroup]]; export const MessageComposer = { encoded: { createDeployment(value: MsgCreateDeployment) { diff --git a/__fixtures__/v-next/outputv3/akash/deployment/v1beta1/deployment.rpc.func.ts b/__fixtures__/v-next/outputv3/akash/deployment/v1beta1/deployment.rpc.func.ts new file mode 100644 index 0000000000..74f7d60ba4 --- /dev/null +++ b/__fixtures__/v-next/outputv3/akash/deployment/v1beta1/deployment.rpc.func.ts @@ -0,0 +1,67 @@ +import { GroupSpec, GroupSpecSDKType, GroupID, GroupIDSDKType, MsgCloseGroup, MsgCloseGroupSDKType, MsgCloseGroupResponse, MsgCloseGroupResponseSDKType, MsgPauseGroup, MsgPauseGroupSDKType, MsgPauseGroupResponse, MsgPauseGroupResponseSDKType, MsgStartGroup, MsgStartGroupSDKType, MsgStartGroupResponse, MsgStartGroupResponseSDKType } from "./group"; +import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; +import { buildTx } from "../../../helper-func-types"; +import { MsgCreateDeployment, MsgCreateDeploymentSDKType, MsgCreateDeploymentResponse, MsgCreateDeploymentResponseSDKType, MsgDepositDeployment, MsgDepositDeploymentSDKType, MsgDepositDeploymentResponse, MsgDepositDeploymentResponseSDKType, MsgUpdateDeployment, MsgUpdateDeploymentSDKType, MsgUpdateDeploymentResponse, MsgUpdateDeploymentResponseSDKType, MsgCloseDeployment, MsgCloseDeploymentSDKType, MsgCloseDeploymentResponse, MsgCloseDeploymentResponseSDKType } from "./deployment"; +/** + * CreateDeployment defines a method to create new deployment given proper inputs. + * @name createDeployment + * @package akash.deployment.v1beta1 + * @see proto service: akash.deployment.v1beta1.CreateDeployment + */ +export const createDeployment = buildTx({ + msg: MsgCreateDeployment +}); +/** + * DepositDeployment deposits more funds into the deployment account + * @name depositDeployment + * @package akash.deployment.v1beta1 + * @see proto service: akash.deployment.v1beta1.DepositDeployment + */ +export const depositDeployment = buildTx({ + msg: MsgDepositDeployment +}); +/** + * UpdateDeployment defines a method to update a deployment given proper inputs. + * @name updateDeployment + * @package akash.deployment.v1beta1 + * @see proto service: akash.deployment.v1beta1.UpdateDeployment + */ +export const updateDeployment = buildTx({ + msg: MsgUpdateDeployment +}); +/** + * CloseDeployment defines a method to close a deployment given proper inputs. + * @name closeDeployment + * @package akash.deployment.v1beta1 + * @see proto service: akash.deployment.v1beta1.CloseDeployment + */ +export const closeDeployment = buildTx({ + msg: MsgCloseDeployment +}); +/** + * CloseGroup defines a method to close a group of a deployment given proper inputs. + * @name closeGroup + * @package akash.deployment.v1beta1 + * @see proto service: akash.deployment.v1beta1.CloseGroup + */ +export const closeGroup = buildTx({ + msg: MsgCloseGroup +}); +/** + * PauseGroup defines a method to close a group of a deployment given proper inputs. + * @name pauseGroup + * @package akash.deployment.v1beta1 + * @see proto service: akash.deployment.v1beta1.PauseGroup + */ +export const pauseGroup = buildTx({ + msg: MsgPauseGroup +}); +/** + * StartGroup defines a method to close a group of a deployment given proper inputs. + * @name startGroup + * @package akash.deployment.v1beta1 + * @see proto service: akash.deployment.v1beta1.StartGroup + */ +export const startGroup = buildTx({ + msg: MsgStartGroup +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/akash/deployment/v1beta1/deployment.ts b/__fixtures__/v-next/outputv3/akash/deployment/v1beta1/deployment.ts index 3d874bba26..16e0cbb245 100644 --- a/__fixtures__/v-next/outputv3/akash/deployment/v1beta1/deployment.ts +++ b/__fixtures__/v-next/outputv3/akash/deployment/v1beta1/deployment.ts @@ -3,6 +3,7 @@ import { GroupSpec, GroupSpecAmino, GroupSpecSDKType, GroupID, GroupIDSDKType } from "./group"; import { Coin, CoinAmino, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; +import { GlobalDecoderRegistry } from "../../../registry"; import { isSet, bytesFromBase64, DeepPartial, base64FromBytes } from "../../../helpers"; export const protobufPackage = "akash.deployment.v1beta1"; /** State is an enum which refers to state of deployment */ @@ -416,6 +417,15 @@ function createBaseMsgCreateDeployment(): MsgCreateDeployment { */ export const MsgCreateDeployment = { typeUrl: "/akash.deployment.v1beta1.MsgCreateDeployment", + is(o: any): o is MsgCreateDeployment { + return o && (o.$typeUrl === MsgCreateDeployment.typeUrl || DeploymentID.is(o.id) && Array.isArray(o.groups) && (!o.groups.length || GroupSpec.is(o.groups[0])) && (o.version instanceof Uint8Array || typeof o.version === "string") && Coin.is(o.deposit)); + }, + isSDK(o: any): o is MsgCreateDeploymentSDKType { + return o && (o.$typeUrl === MsgCreateDeployment.typeUrl || DeploymentID.isSDK(o.id) && Array.isArray(o.groups) && (!o.groups.length || GroupSpec.isSDK(o.groups[0])) && (o.version instanceof Uint8Array || typeof o.version === "string") && Coin.isSDK(o.deposit)); + }, + isAmino(o: any): o is MsgCreateDeploymentAmino { + return o && (o.$typeUrl === MsgCreateDeployment.typeUrl || DeploymentID.isAmino(o.id) && Array.isArray(o.groups) && (!o.groups.length || GroupSpec.isAmino(o.groups[0])) && (o.version instanceof Uint8Array || typeof o.version === "string") && Coin.isAmino(o.deposit)); + }, encode(message: MsgCreateDeployment, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.id !== undefined) { DeploymentID.encode(message.id, writer.uint32(10).fork()).ldelim(); @@ -534,6 +544,14 @@ export const MsgCreateDeployment = { typeUrl: "/akash.deployment.v1beta1.MsgCreateDeployment", value: MsgCreateDeployment.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgCreateDeployment.typeUrl)) { + return; + } + DeploymentID.registerTypeUrl(); + GroupSpec.registerTypeUrl(); + Coin.registerTypeUrl(); } }; function createBaseMsgCreateDeploymentResponse(): MsgCreateDeploymentResponse { @@ -547,6 +565,15 @@ function createBaseMsgCreateDeploymentResponse(): MsgCreateDeploymentResponse { */ export const MsgCreateDeploymentResponse = { typeUrl: "/akash.deployment.v1beta1.MsgCreateDeploymentResponse", + is(o: any): o is MsgCreateDeploymentResponse { + return o && o.$typeUrl === MsgCreateDeploymentResponse.typeUrl; + }, + isSDK(o: any): o is MsgCreateDeploymentResponseSDKType { + return o && o.$typeUrl === MsgCreateDeploymentResponse.typeUrl; + }, + isAmino(o: any): o is MsgCreateDeploymentResponseAmino { + return o && o.$typeUrl === MsgCreateDeploymentResponse.typeUrl; + }, encode(_: MsgCreateDeploymentResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -598,7 +625,8 @@ export const MsgCreateDeploymentResponse = { typeUrl: "/akash.deployment.v1beta1.MsgCreateDeploymentResponse", value: MsgCreateDeploymentResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgDepositDeployment(): MsgDepositDeployment { return { @@ -614,6 +642,15 @@ function createBaseMsgDepositDeployment(): MsgDepositDeployment { */ export const MsgDepositDeployment = { typeUrl: "/akash.deployment.v1beta1.MsgDepositDeployment", + is(o: any): o is MsgDepositDeployment { + return o && (o.$typeUrl === MsgDepositDeployment.typeUrl || DeploymentID.is(o.id) && Coin.is(o.amount)); + }, + isSDK(o: any): o is MsgDepositDeploymentSDKType { + return o && (o.$typeUrl === MsgDepositDeployment.typeUrl || DeploymentID.isSDK(o.id) && Coin.isSDK(o.amount)); + }, + isAmino(o: any): o is MsgDepositDeploymentAmino { + return o && (o.$typeUrl === MsgDepositDeployment.typeUrl || DeploymentID.isAmino(o.id) && Coin.isAmino(o.amount)); + }, encode(message: MsgDepositDeployment, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.id !== undefined) { DeploymentID.encode(message.id, writer.uint32(10).fork()).ldelim(); @@ -698,6 +735,13 @@ export const MsgDepositDeployment = { typeUrl: "/akash.deployment.v1beta1.MsgDepositDeployment", value: MsgDepositDeployment.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgDepositDeployment.typeUrl)) { + return; + } + DeploymentID.registerTypeUrl(); + Coin.registerTypeUrl(); } }; function createBaseMsgDepositDeploymentResponse(): MsgDepositDeploymentResponse { @@ -711,6 +755,15 @@ function createBaseMsgDepositDeploymentResponse(): MsgDepositDeploymentResponse */ export const MsgDepositDeploymentResponse = { typeUrl: "/akash.deployment.v1beta1.MsgDepositDeploymentResponse", + is(o: any): o is MsgDepositDeploymentResponse { + return o && o.$typeUrl === MsgDepositDeploymentResponse.typeUrl; + }, + isSDK(o: any): o is MsgDepositDeploymentResponseSDKType { + return o && o.$typeUrl === MsgDepositDeploymentResponse.typeUrl; + }, + isAmino(o: any): o is MsgDepositDeploymentResponseAmino { + return o && o.$typeUrl === MsgDepositDeploymentResponse.typeUrl; + }, encode(_: MsgDepositDeploymentResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -762,7 +815,8 @@ export const MsgDepositDeploymentResponse = { typeUrl: "/akash.deployment.v1beta1.MsgDepositDeploymentResponse", value: MsgDepositDeploymentResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgUpdateDeployment(): MsgUpdateDeployment { return { @@ -779,6 +833,15 @@ function createBaseMsgUpdateDeployment(): MsgUpdateDeployment { */ export const MsgUpdateDeployment = { typeUrl: "/akash.deployment.v1beta1.MsgUpdateDeployment", + is(o: any): o is MsgUpdateDeployment { + return o && (o.$typeUrl === MsgUpdateDeployment.typeUrl || DeploymentID.is(o.id) && Array.isArray(o.groups) && (!o.groups.length || GroupSpec.is(o.groups[0])) && (o.version instanceof Uint8Array || typeof o.version === "string")); + }, + isSDK(o: any): o is MsgUpdateDeploymentSDKType { + return o && (o.$typeUrl === MsgUpdateDeployment.typeUrl || DeploymentID.isSDK(o.id) && Array.isArray(o.groups) && (!o.groups.length || GroupSpec.isSDK(o.groups[0])) && (o.version instanceof Uint8Array || typeof o.version === "string")); + }, + isAmino(o: any): o is MsgUpdateDeploymentAmino { + return o && (o.$typeUrl === MsgUpdateDeployment.typeUrl || DeploymentID.isAmino(o.id) && Array.isArray(o.groups) && (!o.groups.length || GroupSpec.isAmino(o.groups[0])) && (o.version instanceof Uint8Array || typeof o.version === "string")); + }, encode(message: MsgUpdateDeployment, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.id !== undefined) { DeploymentID.encode(message.id, writer.uint32(10).fork()).ldelim(); @@ -881,6 +944,13 @@ export const MsgUpdateDeployment = { typeUrl: "/akash.deployment.v1beta1.MsgUpdateDeployment", value: MsgUpdateDeployment.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgUpdateDeployment.typeUrl)) { + return; + } + DeploymentID.registerTypeUrl(); + GroupSpec.registerTypeUrl(); } }; function createBaseMsgUpdateDeploymentResponse(): MsgUpdateDeploymentResponse { @@ -894,6 +964,15 @@ function createBaseMsgUpdateDeploymentResponse(): MsgUpdateDeploymentResponse { */ export const MsgUpdateDeploymentResponse = { typeUrl: "/akash.deployment.v1beta1.MsgUpdateDeploymentResponse", + is(o: any): o is MsgUpdateDeploymentResponse { + return o && o.$typeUrl === MsgUpdateDeploymentResponse.typeUrl; + }, + isSDK(o: any): o is MsgUpdateDeploymentResponseSDKType { + return o && o.$typeUrl === MsgUpdateDeploymentResponse.typeUrl; + }, + isAmino(o: any): o is MsgUpdateDeploymentResponseAmino { + return o && o.$typeUrl === MsgUpdateDeploymentResponse.typeUrl; + }, encode(_: MsgUpdateDeploymentResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -945,7 +1024,8 @@ export const MsgUpdateDeploymentResponse = { typeUrl: "/akash.deployment.v1beta1.MsgUpdateDeploymentResponse", value: MsgUpdateDeploymentResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgCloseDeployment(): MsgCloseDeployment { return { @@ -960,6 +1040,15 @@ function createBaseMsgCloseDeployment(): MsgCloseDeployment { */ export const MsgCloseDeployment = { typeUrl: "/akash.deployment.v1beta1.MsgCloseDeployment", + is(o: any): o is MsgCloseDeployment { + return o && (o.$typeUrl === MsgCloseDeployment.typeUrl || DeploymentID.is(o.id)); + }, + isSDK(o: any): o is MsgCloseDeploymentSDKType { + return o && (o.$typeUrl === MsgCloseDeployment.typeUrl || DeploymentID.isSDK(o.id)); + }, + isAmino(o: any): o is MsgCloseDeploymentAmino { + return o && (o.$typeUrl === MsgCloseDeployment.typeUrl || DeploymentID.isAmino(o.id)); + }, encode(message: MsgCloseDeployment, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.id !== undefined) { DeploymentID.encode(message.id, writer.uint32(10).fork()).ldelim(); @@ -1028,6 +1117,12 @@ export const MsgCloseDeployment = { typeUrl: "/akash.deployment.v1beta1.MsgCloseDeployment", value: MsgCloseDeployment.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgCloseDeployment.typeUrl)) { + return; + } + DeploymentID.registerTypeUrl(); } }; function createBaseMsgCloseDeploymentResponse(): MsgCloseDeploymentResponse { @@ -1041,6 +1136,15 @@ function createBaseMsgCloseDeploymentResponse(): MsgCloseDeploymentResponse { */ export const MsgCloseDeploymentResponse = { typeUrl: "/akash.deployment.v1beta1.MsgCloseDeploymentResponse", + is(o: any): o is MsgCloseDeploymentResponse { + return o && o.$typeUrl === MsgCloseDeploymentResponse.typeUrl; + }, + isSDK(o: any): o is MsgCloseDeploymentResponseSDKType { + return o && o.$typeUrl === MsgCloseDeploymentResponse.typeUrl; + }, + isAmino(o: any): o is MsgCloseDeploymentResponseAmino { + return o && o.$typeUrl === MsgCloseDeploymentResponse.typeUrl; + }, encode(_: MsgCloseDeploymentResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -1092,7 +1196,8 @@ export const MsgCloseDeploymentResponse = { typeUrl: "/akash.deployment.v1beta1.MsgCloseDeploymentResponse", value: MsgCloseDeploymentResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseDeploymentID(): DeploymentID { return { @@ -1108,6 +1213,15 @@ function createBaseDeploymentID(): DeploymentID { */ export const DeploymentID = { typeUrl: "/akash.deployment.v1beta1.DeploymentID", + is(o: any): o is DeploymentID { + return o && (o.$typeUrl === DeploymentID.typeUrl || typeof o.owner === "string" && typeof o.dseq === "bigint"); + }, + isSDK(o: any): o is DeploymentIDSDKType { + return o && (o.$typeUrl === DeploymentID.typeUrl || typeof o.owner === "string" && typeof o.dseq === "bigint"); + }, + isAmino(o: any): o is DeploymentIDAmino { + return o && (o.$typeUrl === DeploymentID.typeUrl || typeof o.owner === "string" && typeof o.dseq === "bigint"); + }, encode(message: DeploymentID, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.owner !== "") { writer.uint32(10).string(message.owner); @@ -1190,7 +1304,8 @@ export const DeploymentID = { typeUrl: "/akash.deployment.v1beta1.DeploymentID", value: DeploymentID.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseDeployment(): Deployment { return { @@ -1208,6 +1323,15 @@ function createBaseDeployment(): Deployment { */ export const Deployment = { typeUrl: "/akash.deployment.v1beta1.Deployment", + is(o: any): o is Deployment { + return o && (o.$typeUrl === Deployment.typeUrl || DeploymentID.is(o.deploymentId) && isSet(o.state) && (o.version instanceof Uint8Array || typeof o.version === "string") && typeof o.createdAt === "bigint"); + }, + isSDK(o: any): o is DeploymentSDKType { + return o && (o.$typeUrl === Deployment.typeUrl || DeploymentID.isSDK(o.deployment_id) && isSet(o.state) && (o.version instanceof Uint8Array || typeof o.version === "string") && typeof o.created_at === "bigint"); + }, + isAmino(o: any): o is DeploymentAmino { + return o && (o.$typeUrl === Deployment.typeUrl || DeploymentID.isAmino(o.deployment_id) && isSet(o.state) && (o.version instanceof Uint8Array || typeof o.version === "string") && typeof o.created_at === "bigint"); + }, encode(message: Deployment, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.deploymentId !== undefined) { DeploymentID.encode(message.deploymentId, writer.uint32(10).fork()).ldelim(); @@ -1320,6 +1444,12 @@ export const Deployment = { typeUrl: "/akash.deployment.v1beta1.Deployment", value: Deployment.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Deployment.typeUrl)) { + return; + } + DeploymentID.registerTypeUrl(); } }; function createBaseDeploymentFilters(): DeploymentFilters { @@ -1337,6 +1467,15 @@ function createBaseDeploymentFilters(): DeploymentFilters { */ export const DeploymentFilters = { typeUrl: "/akash.deployment.v1beta1.DeploymentFilters", + is(o: any): o is DeploymentFilters { + return o && (o.$typeUrl === DeploymentFilters.typeUrl || typeof o.owner === "string" && typeof o.dseq === "bigint" && typeof o.state === "string"); + }, + isSDK(o: any): o is DeploymentFiltersSDKType { + return o && (o.$typeUrl === DeploymentFilters.typeUrl || typeof o.owner === "string" && typeof o.dseq === "bigint" && typeof o.state === "string"); + }, + isAmino(o: any): o is DeploymentFiltersAmino { + return o && (o.$typeUrl === DeploymentFilters.typeUrl || typeof o.owner === "string" && typeof o.dseq === "bigint" && typeof o.state === "string"); + }, encode(message: DeploymentFilters, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.owner !== "") { writer.uint32(10).string(message.owner); @@ -1433,5 +1572,6 @@ export const DeploymentFilters = { typeUrl: "/akash.deployment.v1beta1.DeploymentFilters", value: DeploymentFilters.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/akash/deployment/v1beta1/genesis.ts b/__fixtures__/v-next/outputv3/akash/deployment/v1beta1/genesis.ts index e57c382579..9ddf1ea10a 100644 --- a/__fixtures__/v-next/outputv3/akash/deployment/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv3/akash/deployment/v1beta1/genesis.ts @@ -2,6 +2,7 @@ import { Deployment, DeploymentAmino, DeploymentSDKType } from "./deployment"; import { Group, GroupAmino, GroupSDKType } from "./group"; import { Params, ParamsAmino, ParamsSDKType } from "./params"; import { BinaryReader, BinaryWriter } from "../../../binary"; +import { GlobalDecoderRegistry } from "../../../registry"; import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "akash.deployment.v1beta1"; /** @@ -86,6 +87,15 @@ function createBaseGenesisDeployment(): GenesisDeployment { */ export const GenesisDeployment = { typeUrl: "/akash.deployment.v1beta1.GenesisDeployment", + is(o: any): o is GenesisDeployment { + return o && (o.$typeUrl === GenesisDeployment.typeUrl || Deployment.is(o.deployment) && Array.isArray(o.groups) && (!o.groups.length || Group.is(o.groups[0]))); + }, + isSDK(o: any): o is GenesisDeploymentSDKType { + return o && (o.$typeUrl === GenesisDeployment.typeUrl || Deployment.isSDK(o.deployment) && Array.isArray(o.groups) && (!o.groups.length || Group.isSDK(o.groups[0]))); + }, + isAmino(o: any): o is GenesisDeploymentAmino { + return o && (o.$typeUrl === GenesisDeployment.typeUrl || Deployment.isAmino(o.deployment) && Array.isArray(o.groups) && (!o.groups.length || Group.isAmino(o.groups[0]))); + }, encode(message: GenesisDeployment, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.deployment !== undefined) { Deployment.encode(message.deployment, writer.uint32(10).fork()).ldelim(); @@ -174,6 +184,13 @@ export const GenesisDeployment = { typeUrl: "/akash.deployment.v1beta1.GenesisDeployment", value: GenesisDeployment.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GenesisDeployment.typeUrl)) { + return; + } + Deployment.registerTypeUrl(); + Group.registerTypeUrl(); } }; function createBaseGenesisState(): GenesisState { @@ -190,6 +207,15 @@ function createBaseGenesisState(): GenesisState { */ export const GenesisState = { typeUrl: "/akash.deployment.v1beta1.GenesisState", + is(o: any): o is GenesisState { + return o && (o.$typeUrl === GenesisState.typeUrl || Array.isArray(o.deployments) && (!o.deployments.length || GenesisDeployment.is(o.deployments[0])) && Params.is(o.params)); + }, + isSDK(o: any): o is GenesisStateSDKType { + return o && (o.$typeUrl === GenesisState.typeUrl || Array.isArray(o.deployments) && (!o.deployments.length || GenesisDeployment.isSDK(o.deployments[0])) && Params.isSDK(o.params)); + }, + isAmino(o: any): o is GenesisStateAmino { + return o && (o.$typeUrl === GenesisState.typeUrl || Array.isArray(o.deployments) && (!o.deployments.length || GenesisDeployment.isAmino(o.deployments[0])) && Params.isAmino(o.params)); + }, encode(message: GenesisState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.deployments) { GenesisDeployment.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -278,5 +304,12 @@ export const GenesisState = { typeUrl: "/akash.deployment.v1beta1.GenesisState", value: GenesisState.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GenesisState.typeUrl)) { + return; + } + GenesisDeployment.registerTypeUrl(); + Params.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/akash/deployment/v1beta1/group.ts b/__fixtures__/v-next/outputv3/akash/deployment/v1beta1/group.ts index 447e80863c..0445786154 100644 --- a/__fixtures__/v-next/outputv3/akash/deployment/v1beta1/group.ts +++ b/__fixtures__/v-next/outputv3/akash/deployment/v1beta1/group.ts @@ -2,6 +2,7 @@ import { PlacementRequirements, PlacementRequirementsAmino, PlacementRequirement import { ResourceUnits, ResourceUnitsAmino, ResourceUnitsSDKType } from "../../base/v1beta1/resource"; import { Coin, CoinAmino, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; +import { GlobalDecoderRegistry } from "../../../registry"; import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "akash.deployment.v1beta1"; /** State is an enum which refers to state of group */ @@ -392,6 +393,15 @@ function createBaseMsgCloseGroup(): MsgCloseGroup { */ export const MsgCloseGroup = { typeUrl: "/akash.deployment.v1beta1.MsgCloseGroup", + is(o: any): o is MsgCloseGroup { + return o && (o.$typeUrl === MsgCloseGroup.typeUrl || GroupID.is(o.id)); + }, + isSDK(o: any): o is MsgCloseGroupSDKType { + return o && (o.$typeUrl === MsgCloseGroup.typeUrl || GroupID.isSDK(o.id)); + }, + isAmino(o: any): o is MsgCloseGroupAmino { + return o && (o.$typeUrl === MsgCloseGroup.typeUrl || GroupID.isAmino(o.id)); + }, encode(message: MsgCloseGroup, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.id !== undefined) { GroupID.encode(message.id, writer.uint32(10).fork()).ldelim(); @@ -460,6 +470,12 @@ export const MsgCloseGroup = { typeUrl: "/akash.deployment.v1beta1.MsgCloseGroup", value: MsgCloseGroup.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgCloseGroup.typeUrl)) { + return; + } + GroupID.registerTypeUrl(); } }; function createBaseMsgCloseGroupResponse(): MsgCloseGroupResponse { @@ -473,6 +489,15 @@ function createBaseMsgCloseGroupResponse(): MsgCloseGroupResponse { */ export const MsgCloseGroupResponse = { typeUrl: "/akash.deployment.v1beta1.MsgCloseGroupResponse", + is(o: any): o is MsgCloseGroupResponse { + return o && o.$typeUrl === MsgCloseGroupResponse.typeUrl; + }, + isSDK(o: any): o is MsgCloseGroupResponseSDKType { + return o && o.$typeUrl === MsgCloseGroupResponse.typeUrl; + }, + isAmino(o: any): o is MsgCloseGroupResponseAmino { + return o && o.$typeUrl === MsgCloseGroupResponse.typeUrl; + }, encode(_: MsgCloseGroupResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -524,7 +549,8 @@ export const MsgCloseGroupResponse = { typeUrl: "/akash.deployment.v1beta1.MsgCloseGroupResponse", value: MsgCloseGroupResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgPauseGroup(): MsgPauseGroup { return { @@ -539,6 +565,15 @@ function createBaseMsgPauseGroup(): MsgPauseGroup { */ export const MsgPauseGroup = { typeUrl: "/akash.deployment.v1beta1.MsgPauseGroup", + is(o: any): o is MsgPauseGroup { + return o && (o.$typeUrl === MsgPauseGroup.typeUrl || GroupID.is(o.id)); + }, + isSDK(o: any): o is MsgPauseGroupSDKType { + return o && (o.$typeUrl === MsgPauseGroup.typeUrl || GroupID.isSDK(o.id)); + }, + isAmino(o: any): o is MsgPauseGroupAmino { + return o && (o.$typeUrl === MsgPauseGroup.typeUrl || GroupID.isAmino(o.id)); + }, encode(message: MsgPauseGroup, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.id !== undefined) { GroupID.encode(message.id, writer.uint32(10).fork()).ldelim(); @@ -607,6 +642,12 @@ export const MsgPauseGroup = { typeUrl: "/akash.deployment.v1beta1.MsgPauseGroup", value: MsgPauseGroup.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgPauseGroup.typeUrl)) { + return; + } + GroupID.registerTypeUrl(); } }; function createBaseMsgPauseGroupResponse(): MsgPauseGroupResponse { @@ -620,6 +661,15 @@ function createBaseMsgPauseGroupResponse(): MsgPauseGroupResponse { */ export const MsgPauseGroupResponse = { typeUrl: "/akash.deployment.v1beta1.MsgPauseGroupResponse", + is(o: any): o is MsgPauseGroupResponse { + return o && o.$typeUrl === MsgPauseGroupResponse.typeUrl; + }, + isSDK(o: any): o is MsgPauseGroupResponseSDKType { + return o && o.$typeUrl === MsgPauseGroupResponse.typeUrl; + }, + isAmino(o: any): o is MsgPauseGroupResponseAmino { + return o && o.$typeUrl === MsgPauseGroupResponse.typeUrl; + }, encode(_: MsgPauseGroupResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -671,7 +721,8 @@ export const MsgPauseGroupResponse = { typeUrl: "/akash.deployment.v1beta1.MsgPauseGroupResponse", value: MsgPauseGroupResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgStartGroup(): MsgStartGroup { return { @@ -686,6 +737,15 @@ function createBaseMsgStartGroup(): MsgStartGroup { */ export const MsgStartGroup = { typeUrl: "/akash.deployment.v1beta1.MsgStartGroup", + is(o: any): o is MsgStartGroup { + return o && (o.$typeUrl === MsgStartGroup.typeUrl || GroupID.is(o.id)); + }, + isSDK(o: any): o is MsgStartGroupSDKType { + return o && (o.$typeUrl === MsgStartGroup.typeUrl || GroupID.isSDK(o.id)); + }, + isAmino(o: any): o is MsgStartGroupAmino { + return o && (o.$typeUrl === MsgStartGroup.typeUrl || GroupID.isAmino(o.id)); + }, encode(message: MsgStartGroup, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.id !== undefined) { GroupID.encode(message.id, writer.uint32(10).fork()).ldelim(); @@ -754,6 +814,12 @@ export const MsgStartGroup = { typeUrl: "/akash.deployment.v1beta1.MsgStartGroup", value: MsgStartGroup.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgStartGroup.typeUrl)) { + return; + } + GroupID.registerTypeUrl(); } }; function createBaseMsgStartGroupResponse(): MsgStartGroupResponse { @@ -767,6 +833,15 @@ function createBaseMsgStartGroupResponse(): MsgStartGroupResponse { */ export const MsgStartGroupResponse = { typeUrl: "/akash.deployment.v1beta1.MsgStartGroupResponse", + is(o: any): o is MsgStartGroupResponse { + return o && o.$typeUrl === MsgStartGroupResponse.typeUrl; + }, + isSDK(o: any): o is MsgStartGroupResponseSDKType { + return o && o.$typeUrl === MsgStartGroupResponse.typeUrl; + }, + isAmino(o: any): o is MsgStartGroupResponseAmino { + return o && o.$typeUrl === MsgStartGroupResponse.typeUrl; + }, encode(_: MsgStartGroupResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -818,7 +893,8 @@ export const MsgStartGroupResponse = { typeUrl: "/akash.deployment.v1beta1.MsgStartGroupResponse", value: MsgStartGroupResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseGroupID(): GroupID { return { @@ -835,6 +911,15 @@ function createBaseGroupID(): GroupID { */ export const GroupID = { typeUrl: "/akash.deployment.v1beta1.GroupID", + is(o: any): o is GroupID { + return o && (o.$typeUrl === GroupID.typeUrl || typeof o.owner === "string" && typeof o.dseq === "bigint" && typeof o.gseq === "number"); + }, + isSDK(o: any): o is GroupIDSDKType { + return o && (o.$typeUrl === GroupID.typeUrl || typeof o.owner === "string" && typeof o.dseq === "bigint" && typeof o.gseq === "number"); + }, + isAmino(o: any): o is GroupIDAmino { + return o && (o.$typeUrl === GroupID.typeUrl || typeof o.owner === "string" && typeof o.dseq === "bigint" && typeof o.gseq === "number"); + }, encode(message: GroupID, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.owner !== "") { writer.uint32(10).string(message.owner); @@ -931,7 +1016,8 @@ export const GroupID = { typeUrl: "/akash.deployment.v1beta1.GroupID", value: GroupID.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseGroupSpec(): GroupSpec { return { @@ -948,6 +1034,15 @@ function createBaseGroupSpec(): GroupSpec { */ export const GroupSpec = { typeUrl: "/akash.deployment.v1beta1.GroupSpec", + is(o: any): o is GroupSpec { + return o && (o.$typeUrl === GroupSpec.typeUrl || typeof o.name === "string" && PlacementRequirements.is(o.requirements) && Array.isArray(o.resources) && (!o.resources.length || Resource.is(o.resources[0]))); + }, + isSDK(o: any): o is GroupSpecSDKType { + return o && (o.$typeUrl === GroupSpec.typeUrl || typeof o.name === "string" && PlacementRequirements.isSDK(o.requirements) && Array.isArray(o.resources) && (!o.resources.length || Resource.isSDK(o.resources[0]))); + }, + isAmino(o: any): o is GroupSpecAmino { + return o && (o.$typeUrl === GroupSpec.typeUrl || typeof o.name === "string" && PlacementRequirements.isAmino(o.requirements) && Array.isArray(o.resources) && (!o.resources.length || Resource.isAmino(o.resources[0]))); + }, encode(message: GroupSpec, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -1050,6 +1145,13 @@ export const GroupSpec = { typeUrl: "/akash.deployment.v1beta1.GroupSpec", value: GroupSpec.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GroupSpec.typeUrl)) { + return; + } + PlacementRequirements.registerTypeUrl(); + Resource.registerTypeUrl(); } }; function createBaseGroup(): Group { @@ -1068,6 +1170,15 @@ function createBaseGroup(): Group { */ export const Group = { typeUrl: "/akash.deployment.v1beta1.Group", + is(o: any): o is Group { + return o && (o.$typeUrl === Group.typeUrl || GroupID.is(o.groupId) && isSet(o.state) && GroupSpec.is(o.groupSpec) && typeof o.createdAt === "bigint"); + }, + isSDK(o: any): o is GroupSDKType { + return o && (o.$typeUrl === Group.typeUrl || GroupID.isSDK(o.group_id) && isSet(o.state) && GroupSpec.isSDK(o.group_spec) && typeof o.created_at === "bigint"); + }, + isAmino(o: any): o is GroupAmino { + return o && (o.$typeUrl === Group.typeUrl || GroupID.isAmino(o.group_id) && isSet(o.state) && GroupSpec.isAmino(o.group_spec) && typeof o.created_at === "bigint"); + }, encode(message: Group, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.groupId !== undefined) { GroupID.encode(message.groupId, writer.uint32(10).fork()).ldelim(); @@ -1182,6 +1293,13 @@ export const Group = { typeUrl: "/akash.deployment.v1beta1.Group", value: Group.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Group.typeUrl)) { + return; + } + GroupID.registerTypeUrl(); + GroupSpec.registerTypeUrl(); } }; function createBaseResource(): Resource { @@ -1199,6 +1317,15 @@ function createBaseResource(): Resource { */ export const Resource = { typeUrl: "/akash.deployment.v1beta1.Resource", + is(o: any): o is Resource { + return o && (o.$typeUrl === Resource.typeUrl || ResourceUnits.is(o.resources) && typeof o.count === "number" && Coin.is(o.price)); + }, + isSDK(o: any): o is ResourceSDKType { + return o && (o.$typeUrl === Resource.typeUrl || ResourceUnits.isSDK(o.resources) && typeof o.count === "number" && Coin.isSDK(o.price)); + }, + isAmino(o: any): o is ResourceAmino { + return o && (o.$typeUrl === Resource.typeUrl || ResourceUnits.isAmino(o.resources) && typeof o.count === "number" && Coin.isAmino(o.price)); + }, encode(message: Resource, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.resources !== undefined) { ResourceUnits.encode(message.resources, writer.uint32(10).fork()).ldelim(); @@ -1297,5 +1424,12 @@ export const Resource = { typeUrl: "/akash.deployment.v1beta1.Resource", value: Resource.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Resource.typeUrl)) { + return; + } + ResourceUnits.registerTypeUrl(); + Coin.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/akash/deployment/v1beta1/params.ts b/__fixtures__/v-next/outputv3/akash/deployment/v1beta1/params.ts index b537bb0be4..ce0031fda2 100644 --- a/__fixtures__/v-next/outputv3/akash/deployment/v1beta1/params.ts +++ b/__fixtures__/v-next/outputv3/akash/deployment/v1beta1/params.ts @@ -1,5 +1,6 @@ import { Coin, CoinAmino, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; +import { GlobalDecoderRegistry } from "../../../registry"; import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "akash.deployment.v1beta1"; /** @@ -46,6 +47,15 @@ function createBaseParams(): Params { */ export const Params = { typeUrl: "/akash.deployment.v1beta1.Params", + is(o: any): o is Params { + return o && (o.$typeUrl === Params.typeUrl || Coin.is(o.deploymentMinDeposit)); + }, + isSDK(o: any): o is ParamsSDKType { + return o && (o.$typeUrl === Params.typeUrl || Coin.isSDK(o.deployment_min_deposit)); + }, + isAmino(o: any): o is ParamsAmino { + return o && (o.$typeUrl === Params.typeUrl || Coin.isAmino(o.deployment_min_deposit)); + }, encode(message: Params, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.deploymentMinDeposit !== undefined) { Coin.encode(message.deploymentMinDeposit, writer.uint32(10).fork()).ldelim(); @@ -114,5 +124,11 @@ export const Params = { typeUrl: "/akash.deployment.v1beta1.Params", value: Params.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Params.typeUrl)) { + return; + } + Coin.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/akash/deployment/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputv3/akash/deployment/v1beta1/query.rpc.func.ts new file mode 100644 index 0000000000..9f07290ed0 --- /dev/null +++ b/__fixtures__/v-next/outputv3/akash/deployment/v1beta1/query.rpc.func.ts @@ -0,0 +1,45 @@ +import { DeploymentFilters, DeploymentFiltersSDKType, DeploymentID, DeploymentIDSDKType, Deployment, DeploymentSDKType } from "./deployment"; +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination"; +import { GroupID, GroupIDSDKType, Group, GroupSDKType } from "./group"; +import { Account, AccountSDKType } from "../../escrow/v1beta1/types"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { QueryDeploymentsRequest, QueryDeploymentsRequestSDKType, QueryDeploymentsResponse, QueryDeploymentsResponseSDKType, QueryDeploymentRequest, QueryDeploymentRequestSDKType, QueryDeploymentResponse, QueryDeploymentResponseSDKType, QueryGroupRequest, QueryGroupRequestSDKType, QueryGroupResponse, QueryGroupResponseSDKType } from "./query"; +/** + * Deployments queries deployments + * @name getDeployments + * @package akash.deployment.v1beta1 + * @see proto service: akash.deployment.v1beta1.Deployments + */ +export const getDeployments = buildQuery({ + encode: QueryDeploymentsRequest.encode, + decode: QueryDeploymentsResponse.decode, + service: "akash.deployment.v1beta1.Query", + method: "Deployments", + deps: [QueryDeploymentsRequest, QueryDeploymentsResponse] +}); +/** + * Deployment queries deployment details + * @name getDeployment + * @package akash.deployment.v1beta1 + * @see proto service: akash.deployment.v1beta1.Deployment + */ +export const getDeployment = buildQuery({ + encode: QueryDeploymentRequest.encode, + decode: QueryDeploymentResponse.decode, + service: "akash.deployment.v1beta1.Query", + method: "Deployment", + deps: [QueryDeploymentRequest, QueryDeploymentResponse] +}); +/** + * Group queries group details + * @name getGroup + * @package akash.deployment.v1beta1 + * @see proto service: akash.deployment.v1beta1.Group + */ +export const getGroup = buildQuery({ + encode: QueryGroupRequest.encode, + decode: QueryGroupResponse.decode, + service: "akash.deployment.v1beta1.Query", + method: "Group", + deps: [QueryGroupRequest, QueryGroupResponse] +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/akash/deployment/v1beta1/query.ts b/__fixtures__/v-next/outputv3/akash/deployment/v1beta1/query.ts index b8d05aa7a4..d8dc2308de 100644 --- a/__fixtures__/v-next/outputv3/akash/deployment/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv3/akash/deployment/v1beta1/query.ts @@ -3,6 +3,7 @@ import { PageRequest, PageRequestAmino, PageRequestSDKType, PageResponse, PageRe import { GroupID, GroupIDAmino, GroupIDSDKType, Group, GroupAmino, GroupSDKType } from "./group"; import { Account, AccountAmino, AccountSDKType } from "../../escrow/v1beta1/types"; import { BinaryReader, BinaryWriter } from "../../../binary"; +import { GlobalDecoderRegistry } from "../../../registry"; import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "akash.deployment.v1beta1"; /** @@ -217,6 +218,15 @@ function createBaseQueryDeploymentsRequest(): QueryDeploymentsRequest { */ export const QueryDeploymentsRequest = { typeUrl: "/akash.deployment.v1beta1.QueryDeploymentsRequest", + is(o: any): o is QueryDeploymentsRequest { + return o && (o.$typeUrl === QueryDeploymentsRequest.typeUrl || DeploymentFilters.is(o.filters)); + }, + isSDK(o: any): o is QueryDeploymentsRequestSDKType { + return o && (o.$typeUrl === QueryDeploymentsRequest.typeUrl || DeploymentFilters.isSDK(o.filters)); + }, + isAmino(o: any): o is QueryDeploymentsRequestAmino { + return o && (o.$typeUrl === QueryDeploymentsRequest.typeUrl || DeploymentFilters.isAmino(o.filters)); + }, encode(message: QueryDeploymentsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.filters !== undefined) { DeploymentFilters.encode(message.filters, writer.uint32(10).fork()).ldelim(); @@ -301,6 +311,13 @@ export const QueryDeploymentsRequest = { typeUrl: "/akash.deployment.v1beta1.QueryDeploymentsRequest", value: QueryDeploymentsRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryDeploymentsRequest.typeUrl)) { + return; + } + DeploymentFilters.registerTypeUrl(); + PageRequest.registerTypeUrl(); } }; function createBaseQueryDeploymentsResponse(): QueryDeploymentsResponse { @@ -317,6 +334,15 @@ function createBaseQueryDeploymentsResponse(): QueryDeploymentsResponse { */ export const QueryDeploymentsResponse = { typeUrl: "/akash.deployment.v1beta1.QueryDeploymentsResponse", + is(o: any): o is QueryDeploymentsResponse { + return o && (o.$typeUrl === QueryDeploymentsResponse.typeUrl || Array.isArray(o.deployments) && (!o.deployments.length || QueryDeploymentResponse.is(o.deployments[0]))); + }, + isSDK(o: any): o is QueryDeploymentsResponseSDKType { + return o && (o.$typeUrl === QueryDeploymentsResponse.typeUrl || Array.isArray(o.deployments) && (!o.deployments.length || QueryDeploymentResponse.isSDK(o.deployments[0]))); + }, + isAmino(o: any): o is QueryDeploymentsResponseAmino { + return o && (o.$typeUrl === QueryDeploymentsResponse.typeUrl || Array.isArray(o.deployments) && (!o.deployments.length || QueryDeploymentResponse.isAmino(o.deployments[0]))); + }, encode(message: QueryDeploymentsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.deployments) { QueryDeploymentResponse.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -405,6 +431,13 @@ export const QueryDeploymentsResponse = { typeUrl: "/akash.deployment.v1beta1.QueryDeploymentsResponse", value: QueryDeploymentsResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryDeploymentsResponse.typeUrl)) { + return; + } + QueryDeploymentResponse.registerTypeUrl(); + PageResponse.registerTypeUrl(); } }; function createBaseQueryDeploymentRequest(): QueryDeploymentRequest { @@ -420,6 +453,15 @@ function createBaseQueryDeploymentRequest(): QueryDeploymentRequest { */ export const QueryDeploymentRequest = { typeUrl: "/akash.deployment.v1beta1.QueryDeploymentRequest", + is(o: any): o is QueryDeploymentRequest { + return o && (o.$typeUrl === QueryDeploymentRequest.typeUrl || DeploymentID.is(o.id)); + }, + isSDK(o: any): o is QueryDeploymentRequestSDKType { + return o && (o.$typeUrl === QueryDeploymentRequest.typeUrl || DeploymentID.isSDK(o.id)); + }, + isAmino(o: any): o is QueryDeploymentRequestAmino { + return o && (o.$typeUrl === QueryDeploymentRequest.typeUrl || DeploymentID.isAmino(o.id)); + }, encode(message: QueryDeploymentRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.id !== undefined) { DeploymentID.encode(message.id, writer.uint32(10).fork()).ldelim(); @@ -488,6 +530,12 @@ export const QueryDeploymentRequest = { typeUrl: "/akash.deployment.v1beta1.QueryDeploymentRequest", value: QueryDeploymentRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryDeploymentRequest.typeUrl)) { + return; + } + DeploymentID.registerTypeUrl(); } }; function createBaseQueryDeploymentResponse(): QueryDeploymentResponse { @@ -505,6 +553,15 @@ function createBaseQueryDeploymentResponse(): QueryDeploymentResponse { */ export const QueryDeploymentResponse = { typeUrl: "/akash.deployment.v1beta1.QueryDeploymentResponse", + is(o: any): o is QueryDeploymentResponse { + return o && (o.$typeUrl === QueryDeploymentResponse.typeUrl || Deployment.is(o.deployment) && Array.isArray(o.groups) && (!o.groups.length || Group.is(o.groups[0])) && Account.is(o.escrowAccount)); + }, + isSDK(o: any): o is QueryDeploymentResponseSDKType { + return o && (o.$typeUrl === QueryDeploymentResponse.typeUrl || Deployment.isSDK(o.deployment) && Array.isArray(o.groups) && (!o.groups.length || Group.isSDK(o.groups[0])) && Account.isSDK(o.escrow_account)); + }, + isAmino(o: any): o is QueryDeploymentResponseAmino { + return o && (o.$typeUrl === QueryDeploymentResponse.typeUrl || Deployment.isAmino(o.deployment) && Array.isArray(o.groups) && (!o.groups.length || Group.isAmino(o.groups[0])) && Account.isAmino(o.escrow_account)); + }, encode(message: QueryDeploymentResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.deployment !== undefined) { Deployment.encode(message.deployment, writer.uint32(10).fork()).ldelim(); @@ -609,6 +666,14 @@ export const QueryDeploymentResponse = { typeUrl: "/akash.deployment.v1beta1.QueryDeploymentResponse", value: QueryDeploymentResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryDeploymentResponse.typeUrl)) { + return; + } + Deployment.registerTypeUrl(); + Group.registerTypeUrl(); + Account.registerTypeUrl(); } }; function createBaseQueryGroupRequest(): QueryGroupRequest { @@ -624,6 +689,15 @@ function createBaseQueryGroupRequest(): QueryGroupRequest { */ export const QueryGroupRequest = { typeUrl: "/akash.deployment.v1beta1.QueryGroupRequest", + is(o: any): o is QueryGroupRequest { + return o && (o.$typeUrl === QueryGroupRequest.typeUrl || GroupID.is(o.id)); + }, + isSDK(o: any): o is QueryGroupRequestSDKType { + return o && (o.$typeUrl === QueryGroupRequest.typeUrl || GroupID.isSDK(o.id)); + }, + isAmino(o: any): o is QueryGroupRequestAmino { + return o && (o.$typeUrl === QueryGroupRequest.typeUrl || GroupID.isAmino(o.id)); + }, encode(message: QueryGroupRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.id !== undefined) { GroupID.encode(message.id, writer.uint32(10).fork()).ldelim(); @@ -692,6 +766,12 @@ export const QueryGroupRequest = { typeUrl: "/akash.deployment.v1beta1.QueryGroupRequest", value: QueryGroupRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryGroupRequest.typeUrl)) { + return; + } + GroupID.registerTypeUrl(); } }; function createBaseQueryGroupResponse(): QueryGroupResponse { @@ -707,6 +787,15 @@ function createBaseQueryGroupResponse(): QueryGroupResponse { */ export const QueryGroupResponse = { typeUrl: "/akash.deployment.v1beta1.QueryGroupResponse", + is(o: any): o is QueryGroupResponse { + return o && (o.$typeUrl === QueryGroupResponse.typeUrl || Group.is(o.group)); + }, + isSDK(o: any): o is QueryGroupResponseSDKType { + return o && (o.$typeUrl === QueryGroupResponse.typeUrl || Group.isSDK(o.group)); + }, + isAmino(o: any): o is QueryGroupResponseAmino { + return o && (o.$typeUrl === QueryGroupResponse.typeUrl || Group.isAmino(o.group)); + }, encode(message: QueryGroupResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.group !== undefined) { Group.encode(message.group, writer.uint32(10).fork()).ldelim(); @@ -775,5 +864,11 @@ export const QueryGroupResponse = { typeUrl: "/akash.deployment.v1beta1.QueryGroupResponse", value: QueryGroupResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryGroupResponse.typeUrl)) { + return; + } + Group.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/akash/deployment/v1beta2/authz.ts b/__fixtures__/v-next/outputv3/akash/deployment/v1beta2/authz.ts index e11d92ad83..d68fd3b010 100644 --- a/__fixtures__/v-next/outputv3/akash/deployment/v1beta2/authz.ts +++ b/__fixtures__/v-next/outputv3/akash/deployment/v1beta2/authz.ts @@ -1,5 +1,6 @@ import { Coin, CoinAmino, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; +import { GlobalDecoderRegistry } from "../../../registry"; import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "akash.deployment.v1beta2"; /** @@ -61,6 +62,15 @@ function createBaseDepositDeploymentAuthorization(): DepositDeploymentAuthorizat */ export const DepositDeploymentAuthorization = { typeUrl: "/akash.deployment.v1beta2.DepositDeploymentAuthorization", + is(o: any): o is DepositDeploymentAuthorization { + return o && (o.$typeUrl === DepositDeploymentAuthorization.typeUrl || Coin.is(o.spendLimit)); + }, + isSDK(o: any): o is DepositDeploymentAuthorizationSDKType { + return o && (o.$typeUrl === DepositDeploymentAuthorization.typeUrl || Coin.isSDK(o.spend_limit)); + }, + isAmino(o: any): o is DepositDeploymentAuthorizationAmino { + return o && (o.$typeUrl === DepositDeploymentAuthorization.typeUrl || Coin.isAmino(o.spend_limit)); + }, encode(message: DepositDeploymentAuthorization, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.spendLimit !== undefined) { Coin.encode(message.spendLimit, writer.uint32(10).fork()).ldelim(); @@ -129,5 +139,12 @@ export const DepositDeploymentAuthorization = { typeUrl: "/akash.deployment.v1beta2.DepositDeploymentAuthorization", value: DepositDeploymentAuthorization.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(DepositDeploymentAuthorization.typeUrl)) { + return; + } + GlobalDecoderRegistry.register(DepositDeploymentAuthorization.typeUrl, DepositDeploymentAuthorization); + Coin.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/akash/deployment/v1beta2/deployment.ts b/__fixtures__/v-next/outputv3/akash/deployment/v1beta2/deployment.ts index 9f0e493337..a116ee7b49 100644 --- a/__fixtures__/v-next/outputv3/akash/deployment/v1beta2/deployment.ts +++ b/__fixtures__/v-next/outputv3/akash/deployment/v1beta2/deployment.ts @@ -1,5 +1,6 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../helpers"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "akash.deployment.v1beta2"; /** State is an enum which refers to state of deployment */ export enum Deployment_State { @@ -168,6 +169,15 @@ function createBaseDeploymentID(): DeploymentID { */ export const DeploymentID = { typeUrl: "/akash.deployment.v1beta2.DeploymentID", + is(o: any): o is DeploymentID { + return o && (o.$typeUrl === DeploymentID.typeUrl || typeof o.owner === "string" && typeof o.dseq === "bigint"); + }, + isSDK(o: any): o is DeploymentIDSDKType { + return o && (o.$typeUrl === DeploymentID.typeUrl || typeof o.owner === "string" && typeof o.dseq === "bigint"); + }, + isAmino(o: any): o is DeploymentIDAmino { + return o && (o.$typeUrl === DeploymentID.typeUrl || typeof o.owner === "string" && typeof o.dseq === "bigint"); + }, encode(message: DeploymentID, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.owner !== "") { writer.uint32(10).string(message.owner); @@ -250,7 +260,8 @@ export const DeploymentID = { typeUrl: "/akash.deployment.v1beta2.DeploymentID", value: DeploymentID.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseDeployment(): Deployment { return { @@ -268,6 +279,15 @@ function createBaseDeployment(): Deployment { */ export const Deployment = { typeUrl: "/akash.deployment.v1beta2.Deployment", + is(o: any): o is Deployment { + return o && (o.$typeUrl === Deployment.typeUrl || DeploymentID.is(o.deploymentId) && isSet(o.state) && (o.version instanceof Uint8Array || typeof o.version === "string") && typeof o.createdAt === "bigint"); + }, + isSDK(o: any): o is DeploymentSDKType { + return o && (o.$typeUrl === Deployment.typeUrl || DeploymentID.isSDK(o.deployment_id) && isSet(o.state) && (o.version instanceof Uint8Array || typeof o.version === "string") && typeof o.created_at === "bigint"); + }, + isAmino(o: any): o is DeploymentAmino { + return o && (o.$typeUrl === Deployment.typeUrl || DeploymentID.isAmino(o.deployment_id) && isSet(o.state) && (o.version instanceof Uint8Array || typeof o.version === "string") && typeof o.created_at === "bigint"); + }, encode(message: Deployment, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.deploymentId !== undefined) { DeploymentID.encode(message.deploymentId, writer.uint32(10).fork()).ldelim(); @@ -380,6 +400,12 @@ export const Deployment = { typeUrl: "/akash.deployment.v1beta2.Deployment", value: Deployment.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Deployment.typeUrl)) { + return; + } + DeploymentID.registerTypeUrl(); } }; function createBaseDeploymentFilters(): DeploymentFilters { @@ -397,6 +423,15 @@ function createBaseDeploymentFilters(): DeploymentFilters { */ export const DeploymentFilters = { typeUrl: "/akash.deployment.v1beta2.DeploymentFilters", + is(o: any): o is DeploymentFilters { + return o && (o.$typeUrl === DeploymentFilters.typeUrl || typeof o.owner === "string" && typeof o.dseq === "bigint" && typeof o.state === "string"); + }, + isSDK(o: any): o is DeploymentFiltersSDKType { + return o && (o.$typeUrl === DeploymentFilters.typeUrl || typeof o.owner === "string" && typeof o.dseq === "bigint" && typeof o.state === "string"); + }, + isAmino(o: any): o is DeploymentFiltersAmino { + return o && (o.$typeUrl === DeploymentFilters.typeUrl || typeof o.owner === "string" && typeof o.dseq === "bigint" && typeof o.state === "string"); + }, encode(message: DeploymentFilters, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.owner !== "") { writer.uint32(10).string(message.owner); @@ -493,5 +528,6 @@ export const DeploymentFilters = { typeUrl: "/akash.deployment.v1beta2.DeploymentFilters", value: DeploymentFilters.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/akash/deployment/v1beta2/deploymentmsg.ts b/__fixtures__/v-next/outputv3/akash/deployment/v1beta2/deploymentmsg.ts index 7a9198748b..5fd84d3bd7 100644 --- a/__fixtures__/v-next/outputv3/akash/deployment/v1beta2/deploymentmsg.ts +++ b/__fixtures__/v-next/outputv3/akash/deployment/v1beta2/deploymentmsg.ts @@ -2,6 +2,7 @@ import { DeploymentID, DeploymentIDAmino, DeploymentIDSDKType } from "./deployme import { GroupSpec, GroupSpecAmino, GroupSpecSDKType } from "./groupspec"; import { Coin, CoinAmino, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; +import { GlobalDecoderRegistry } from "../../../registry"; import { isSet, bytesFromBase64, DeepPartial, base64FromBytes } from "../../../helpers"; export const protobufPackage = "akash.deployment.v1beta2"; /** @@ -278,6 +279,15 @@ function createBaseMsgCreateDeployment(): MsgCreateDeployment { */ export const MsgCreateDeployment = { typeUrl: "/akash.deployment.v1beta2.MsgCreateDeployment", + is(o: any): o is MsgCreateDeployment { + return o && (o.$typeUrl === MsgCreateDeployment.typeUrl || DeploymentID.is(o.id) && Array.isArray(o.groups) && (!o.groups.length || GroupSpec.is(o.groups[0])) && (o.version instanceof Uint8Array || typeof o.version === "string") && Coin.is(o.deposit) && typeof o.depositor === "string"); + }, + isSDK(o: any): o is MsgCreateDeploymentSDKType { + return o && (o.$typeUrl === MsgCreateDeployment.typeUrl || DeploymentID.isSDK(o.id) && Array.isArray(o.groups) && (!o.groups.length || GroupSpec.isSDK(o.groups[0])) && (o.version instanceof Uint8Array || typeof o.version === "string") && Coin.isSDK(o.deposit) && typeof o.depositor === "string"); + }, + isAmino(o: any): o is MsgCreateDeploymentAmino { + return o && (o.$typeUrl === MsgCreateDeployment.typeUrl || DeploymentID.isAmino(o.id) && Array.isArray(o.groups) && (!o.groups.length || GroupSpec.isAmino(o.groups[0])) && (o.version instanceof Uint8Array || typeof o.version === "string") && Coin.isAmino(o.deposit) && typeof o.depositor === "string"); + }, encode(message: MsgCreateDeployment, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.id !== undefined) { DeploymentID.encode(message.id, writer.uint32(10).fork()).ldelim(); @@ -410,6 +420,14 @@ export const MsgCreateDeployment = { typeUrl: "/akash.deployment.v1beta2.MsgCreateDeployment", value: MsgCreateDeployment.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgCreateDeployment.typeUrl)) { + return; + } + DeploymentID.registerTypeUrl(); + GroupSpec.registerTypeUrl(); + Coin.registerTypeUrl(); } }; function createBaseMsgCreateDeploymentResponse(): MsgCreateDeploymentResponse { @@ -423,6 +441,15 @@ function createBaseMsgCreateDeploymentResponse(): MsgCreateDeploymentResponse { */ export const MsgCreateDeploymentResponse = { typeUrl: "/akash.deployment.v1beta2.MsgCreateDeploymentResponse", + is(o: any): o is MsgCreateDeploymentResponse { + return o && o.$typeUrl === MsgCreateDeploymentResponse.typeUrl; + }, + isSDK(o: any): o is MsgCreateDeploymentResponseSDKType { + return o && o.$typeUrl === MsgCreateDeploymentResponse.typeUrl; + }, + isAmino(o: any): o is MsgCreateDeploymentResponseAmino { + return o && o.$typeUrl === MsgCreateDeploymentResponse.typeUrl; + }, encode(_: MsgCreateDeploymentResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -474,7 +501,8 @@ export const MsgCreateDeploymentResponse = { typeUrl: "/akash.deployment.v1beta2.MsgCreateDeploymentResponse", value: MsgCreateDeploymentResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgDepositDeployment(): MsgDepositDeployment { return { @@ -491,6 +519,15 @@ function createBaseMsgDepositDeployment(): MsgDepositDeployment { */ export const MsgDepositDeployment = { typeUrl: "/akash.deployment.v1beta2.MsgDepositDeployment", + is(o: any): o is MsgDepositDeployment { + return o && (o.$typeUrl === MsgDepositDeployment.typeUrl || DeploymentID.is(o.id) && Coin.is(o.amount) && typeof o.depositor === "string"); + }, + isSDK(o: any): o is MsgDepositDeploymentSDKType { + return o && (o.$typeUrl === MsgDepositDeployment.typeUrl || DeploymentID.isSDK(o.id) && Coin.isSDK(o.amount) && typeof o.depositor === "string"); + }, + isAmino(o: any): o is MsgDepositDeploymentAmino { + return o && (o.$typeUrl === MsgDepositDeployment.typeUrl || DeploymentID.isAmino(o.id) && Coin.isAmino(o.amount) && typeof o.depositor === "string"); + }, encode(message: MsgDepositDeployment, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.id !== undefined) { DeploymentID.encode(message.id, writer.uint32(10).fork()).ldelim(); @@ -589,6 +626,13 @@ export const MsgDepositDeployment = { typeUrl: "/akash.deployment.v1beta2.MsgDepositDeployment", value: MsgDepositDeployment.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgDepositDeployment.typeUrl)) { + return; + } + DeploymentID.registerTypeUrl(); + Coin.registerTypeUrl(); } }; function createBaseMsgDepositDeploymentResponse(): MsgDepositDeploymentResponse { @@ -602,6 +646,15 @@ function createBaseMsgDepositDeploymentResponse(): MsgDepositDeploymentResponse */ export const MsgDepositDeploymentResponse = { typeUrl: "/akash.deployment.v1beta2.MsgDepositDeploymentResponse", + is(o: any): o is MsgDepositDeploymentResponse { + return o && o.$typeUrl === MsgDepositDeploymentResponse.typeUrl; + }, + isSDK(o: any): o is MsgDepositDeploymentResponseSDKType { + return o && o.$typeUrl === MsgDepositDeploymentResponse.typeUrl; + }, + isAmino(o: any): o is MsgDepositDeploymentResponseAmino { + return o && o.$typeUrl === MsgDepositDeploymentResponse.typeUrl; + }, encode(_: MsgDepositDeploymentResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -653,7 +706,8 @@ export const MsgDepositDeploymentResponse = { typeUrl: "/akash.deployment.v1beta2.MsgDepositDeploymentResponse", value: MsgDepositDeploymentResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgUpdateDeployment(): MsgUpdateDeployment { return { @@ -669,6 +723,15 @@ function createBaseMsgUpdateDeployment(): MsgUpdateDeployment { */ export const MsgUpdateDeployment = { typeUrl: "/akash.deployment.v1beta2.MsgUpdateDeployment", + is(o: any): o is MsgUpdateDeployment { + return o && (o.$typeUrl === MsgUpdateDeployment.typeUrl || DeploymentID.is(o.id) && (o.version instanceof Uint8Array || typeof o.version === "string")); + }, + isSDK(o: any): o is MsgUpdateDeploymentSDKType { + return o && (o.$typeUrl === MsgUpdateDeployment.typeUrl || DeploymentID.isSDK(o.id) && (o.version instanceof Uint8Array || typeof o.version === "string")); + }, + isAmino(o: any): o is MsgUpdateDeploymentAmino { + return o && (o.$typeUrl === MsgUpdateDeployment.typeUrl || DeploymentID.isAmino(o.id) && (o.version instanceof Uint8Array || typeof o.version === "string")); + }, encode(message: MsgUpdateDeployment, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.id !== undefined) { DeploymentID.encode(message.id, writer.uint32(10).fork()).ldelim(); @@ -751,6 +814,12 @@ export const MsgUpdateDeployment = { typeUrl: "/akash.deployment.v1beta2.MsgUpdateDeployment", value: MsgUpdateDeployment.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgUpdateDeployment.typeUrl)) { + return; + } + DeploymentID.registerTypeUrl(); } }; function createBaseMsgUpdateDeploymentResponse(): MsgUpdateDeploymentResponse { @@ -764,6 +833,15 @@ function createBaseMsgUpdateDeploymentResponse(): MsgUpdateDeploymentResponse { */ export const MsgUpdateDeploymentResponse = { typeUrl: "/akash.deployment.v1beta2.MsgUpdateDeploymentResponse", + is(o: any): o is MsgUpdateDeploymentResponse { + return o && o.$typeUrl === MsgUpdateDeploymentResponse.typeUrl; + }, + isSDK(o: any): o is MsgUpdateDeploymentResponseSDKType { + return o && o.$typeUrl === MsgUpdateDeploymentResponse.typeUrl; + }, + isAmino(o: any): o is MsgUpdateDeploymentResponseAmino { + return o && o.$typeUrl === MsgUpdateDeploymentResponse.typeUrl; + }, encode(_: MsgUpdateDeploymentResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -815,7 +893,8 @@ export const MsgUpdateDeploymentResponse = { typeUrl: "/akash.deployment.v1beta2.MsgUpdateDeploymentResponse", value: MsgUpdateDeploymentResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgCloseDeployment(): MsgCloseDeployment { return { @@ -830,6 +909,15 @@ function createBaseMsgCloseDeployment(): MsgCloseDeployment { */ export const MsgCloseDeployment = { typeUrl: "/akash.deployment.v1beta2.MsgCloseDeployment", + is(o: any): o is MsgCloseDeployment { + return o && (o.$typeUrl === MsgCloseDeployment.typeUrl || DeploymentID.is(o.id)); + }, + isSDK(o: any): o is MsgCloseDeploymentSDKType { + return o && (o.$typeUrl === MsgCloseDeployment.typeUrl || DeploymentID.isSDK(o.id)); + }, + isAmino(o: any): o is MsgCloseDeploymentAmino { + return o && (o.$typeUrl === MsgCloseDeployment.typeUrl || DeploymentID.isAmino(o.id)); + }, encode(message: MsgCloseDeployment, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.id !== undefined) { DeploymentID.encode(message.id, writer.uint32(10).fork()).ldelim(); @@ -898,6 +986,12 @@ export const MsgCloseDeployment = { typeUrl: "/akash.deployment.v1beta2.MsgCloseDeployment", value: MsgCloseDeployment.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgCloseDeployment.typeUrl)) { + return; + } + DeploymentID.registerTypeUrl(); } }; function createBaseMsgCloseDeploymentResponse(): MsgCloseDeploymentResponse { @@ -911,6 +1005,15 @@ function createBaseMsgCloseDeploymentResponse(): MsgCloseDeploymentResponse { */ export const MsgCloseDeploymentResponse = { typeUrl: "/akash.deployment.v1beta2.MsgCloseDeploymentResponse", + is(o: any): o is MsgCloseDeploymentResponse { + return o && o.$typeUrl === MsgCloseDeploymentResponse.typeUrl; + }, + isSDK(o: any): o is MsgCloseDeploymentResponseSDKType { + return o && o.$typeUrl === MsgCloseDeploymentResponse.typeUrl; + }, + isAmino(o: any): o is MsgCloseDeploymentResponseAmino { + return o && o.$typeUrl === MsgCloseDeploymentResponse.typeUrl; + }, encode(_: MsgCloseDeploymentResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -962,5 +1065,6 @@ export const MsgCloseDeploymentResponse = { typeUrl: "/akash.deployment.v1beta2.MsgCloseDeploymentResponse", value: MsgCloseDeploymentResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/akash/deployment/v1beta2/genesis.ts b/__fixtures__/v-next/outputv3/akash/deployment/v1beta2/genesis.ts index dcba819eb7..bbeb6a98c4 100644 --- a/__fixtures__/v-next/outputv3/akash/deployment/v1beta2/genesis.ts +++ b/__fixtures__/v-next/outputv3/akash/deployment/v1beta2/genesis.ts @@ -2,6 +2,7 @@ import { Deployment, DeploymentAmino, DeploymentSDKType } from "./deployment"; import { Group, GroupAmino, GroupSDKType } from "./group"; import { Params, ParamsAmino, ParamsSDKType } from "./params"; import { BinaryReader, BinaryWriter } from "../../../binary"; +import { GlobalDecoderRegistry } from "../../../registry"; import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "akash.deployment.v1beta2"; /** @@ -86,6 +87,15 @@ function createBaseGenesisDeployment(): GenesisDeployment { */ export const GenesisDeployment = { typeUrl: "/akash.deployment.v1beta2.GenesisDeployment", + is(o: any): o is GenesisDeployment { + return o && (o.$typeUrl === GenesisDeployment.typeUrl || Deployment.is(o.deployment) && Array.isArray(o.groups) && (!o.groups.length || Group.is(o.groups[0]))); + }, + isSDK(o: any): o is GenesisDeploymentSDKType { + return o && (o.$typeUrl === GenesisDeployment.typeUrl || Deployment.isSDK(o.deployment) && Array.isArray(o.groups) && (!o.groups.length || Group.isSDK(o.groups[0]))); + }, + isAmino(o: any): o is GenesisDeploymentAmino { + return o && (o.$typeUrl === GenesisDeployment.typeUrl || Deployment.isAmino(o.deployment) && Array.isArray(o.groups) && (!o.groups.length || Group.isAmino(o.groups[0]))); + }, encode(message: GenesisDeployment, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.deployment !== undefined) { Deployment.encode(message.deployment, writer.uint32(10).fork()).ldelim(); @@ -174,6 +184,13 @@ export const GenesisDeployment = { typeUrl: "/akash.deployment.v1beta2.GenesisDeployment", value: GenesisDeployment.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GenesisDeployment.typeUrl)) { + return; + } + Deployment.registerTypeUrl(); + Group.registerTypeUrl(); } }; function createBaseGenesisState(): GenesisState { @@ -190,6 +207,15 @@ function createBaseGenesisState(): GenesisState { */ export const GenesisState = { typeUrl: "/akash.deployment.v1beta2.GenesisState", + is(o: any): o is GenesisState { + return o && (o.$typeUrl === GenesisState.typeUrl || Array.isArray(o.deployments) && (!o.deployments.length || GenesisDeployment.is(o.deployments[0])) && Params.is(o.params)); + }, + isSDK(o: any): o is GenesisStateSDKType { + return o && (o.$typeUrl === GenesisState.typeUrl || Array.isArray(o.deployments) && (!o.deployments.length || GenesisDeployment.isSDK(o.deployments[0])) && Params.isSDK(o.params)); + }, + isAmino(o: any): o is GenesisStateAmino { + return o && (o.$typeUrl === GenesisState.typeUrl || Array.isArray(o.deployments) && (!o.deployments.length || GenesisDeployment.isAmino(o.deployments[0])) && Params.isAmino(o.params)); + }, encode(message: GenesisState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.deployments) { GenesisDeployment.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -278,5 +304,12 @@ export const GenesisState = { typeUrl: "/akash.deployment.v1beta2.GenesisState", value: GenesisState.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GenesisState.typeUrl)) { + return; + } + GenesisDeployment.registerTypeUrl(); + Params.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/akash/deployment/v1beta2/group.ts b/__fixtures__/v-next/outputv3/akash/deployment/v1beta2/group.ts index 83b1d719b1..9b87f7042e 100644 --- a/__fixtures__/v-next/outputv3/akash/deployment/v1beta2/group.ts +++ b/__fixtures__/v-next/outputv3/akash/deployment/v1beta2/group.ts @@ -1,7 +1,8 @@ import { GroupID, GroupIDAmino, GroupIDSDKType } from "./groupid"; import { GroupSpec, GroupSpecAmino, GroupSpecSDKType } from "./groupspec"; -import { BinaryReader, BinaryWriter } from "../../../binary"; import { isSet, DeepPartial } from "../../../helpers"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "akash.deployment.v1beta2"; /** State is an enum which refers to state of group */ export enum Group_State { @@ -115,6 +116,15 @@ function createBaseGroup(): Group { */ export const Group = { typeUrl: "/akash.deployment.v1beta2.Group", + is(o: any): o is Group { + return o && (o.$typeUrl === Group.typeUrl || GroupID.is(o.groupId) && isSet(o.state) && GroupSpec.is(o.groupSpec) && typeof o.createdAt === "bigint"); + }, + isSDK(o: any): o is GroupSDKType { + return o && (o.$typeUrl === Group.typeUrl || GroupID.isSDK(o.group_id) && isSet(o.state) && GroupSpec.isSDK(o.group_spec) && typeof o.created_at === "bigint"); + }, + isAmino(o: any): o is GroupAmino { + return o && (o.$typeUrl === Group.typeUrl || GroupID.isAmino(o.group_id) && isSet(o.state) && GroupSpec.isAmino(o.group_spec) && typeof o.created_at === "bigint"); + }, encode(message: Group, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.groupId !== undefined) { GroupID.encode(message.groupId, writer.uint32(10).fork()).ldelim(); @@ -229,5 +239,12 @@ export const Group = { typeUrl: "/akash.deployment.v1beta2.Group", value: Group.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Group.typeUrl)) { + return; + } + GroupID.registerTypeUrl(); + GroupSpec.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/akash/deployment/v1beta2/groupid.ts b/__fixtures__/v-next/outputv3/akash/deployment/v1beta2/groupid.ts index 4de8c6c584..5d4da4f9ba 100644 --- a/__fixtures__/v-next/outputv3/akash/deployment/v1beta2/groupid.ts +++ b/__fixtures__/v-next/outputv3/akash/deployment/v1beta2/groupid.ts @@ -53,6 +53,15 @@ function createBaseGroupID(): GroupID { */ export const GroupID = { typeUrl: "/akash.deployment.v1beta2.GroupID", + is(o: any): o is GroupID { + return o && (o.$typeUrl === GroupID.typeUrl || typeof o.owner === "string" && typeof o.dseq === "bigint" && typeof o.gseq === "number"); + }, + isSDK(o: any): o is GroupIDSDKType { + return o && (o.$typeUrl === GroupID.typeUrl || typeof o.owner === "string" && typeof o.dseq === "bigint" && typeof o.gseq === "number"); + }, + isAmino(o: any): o is GroupIDAmino { + return o && (o.$typeUrl === GroupID.typeUrl || typeof o.owner === "string" && typeof o.dseq === "bigint" && typeof o.gseq === "number"); + }, encode(message: GroupID, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.owner !== "") { writer.uint32(10).string(message.owner); @@ -149,5 +158,6 @@ export const GroupID = { typeUrl: "/akash.deployment.v1beta2.GroupID", value: GroupID.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/akash/deployment/v1beta2/groupmsg.ts b/__fixtures__/v-next/outputv3/akash/deployment/v1beta2/groupmsg.ts index 69375939f1..8f802fe394 100644 --- a/__fixtures__/v-next/outputv3/akash/deployment/v1beta2/groupmsg.ts +++ b/__fixtures__/v-next/outputv3/akash/deployment/v1beta2/groupmsg.ts @@ -1,5 +1,6 @@ import { GroupID, GroupIDAmino, GroupIDSDKType } from "./groupid"; import { BinaryReader, BinaryWriter } from "../../../binary"; +import { GlobalDecoderRegistry } from "../../../registry"; import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "akash.deployment.v1beta2"; /** @@ -183,6 +184,15 @@ function createBaseMsgCloseGroup(): MsgCloseGroup { */ export const MsgCloseGroup = { typeUrl: "/akash.deployment.v1beta2.MsgCloseGroup", + is(o: any): o is MsgCloseGroup { + return o && (o.$typeUrl === MsgCloseGroup.typeUrl || GroupID.is(o.id)); + }, + isSDK(o: any): o is MsgCloseGroupSDKType { + return o && (o.$typeUrl === MsgCloseGroup.typeUrl || GroupID.isSDK(o.id)); + }, + isAmino(o: any): o is MsgCloseGroupAmino { + return o && (o.$typeUrl === MsgCloseGroup.typeUrl || GroupID.isAmino(o.id)); + }, encode(message: MsgCloseGroup, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.id !== undefined) { GroupID.encode(message.id, writer.uint32(10).fork()).ldelim(); @@ -251,6 +261,12 @@ export const MsgCloseGroup = { typeUrl: "/akash.deployment.v1beta2.MsgCloseGroup", value: MsgCloseGroup.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgCloseGroup.typeUrl)) { + return; + } + GroupID.registerTypeUrl(); } }; function createBaseMsgCloseGroupResponse(): MsgCloseGroupResponse { @@ -264,6 +280,15 @@ function createBaseMsgCloseGroupResponse(): MsgCloseGroupResponse { */ export const MsgCloseGroupResponse = { typeUrl: "/akash.deployment.v1beta2.MsgCloseGroupResponse", + is(o: any): o is MsgCloseGroupResponse { + return o && o.$typeUrl === MsgCloseGroupResponse.typeUrl; + }, + isSDK(o: any): o is MsgCloseGroupResponseSDKType { + return o && o.$typeUrl === MsgCloseGroupResponse.typeUrl; + }, + isAmino(o: any): o is MsgCloseGroupResponseAmino { + return o && o.$typeUrl === MsgCloseGroupResponse.typeUrl; + }, encode(_: MsgCloseGroupResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -315,7 +340,8 @@ export const MsgCloseGroupResponse = { typeUrl: "/akash.deployment.v1beta2.MsgCloseGroupResponse", value: MsgCloseGroupResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgPauseGroup(): MsgPauseGroup { return { @@ -330,6 +356,15 @@ function createBaseMsgPauseGroup(): MsgPauseGroup { */ export const MsgPauseGroup = { typeUrl: "/akash.deployment.v1beta2.MsgPauseGroup", + is(o: any): o is MsgPauseGroup { + return o && (o.$typeUrl === MsgPauseGroup.typeUrl || GroupID.is(o.id)); + }, + isSDK(o: any): o is MsgPauseGroupSDKType { + return o && (o.$typeUrl === MsgPauseGroup.typeUrl || GroupID.isSDK(o.id)); + }, + isAmino(o: any): o is MsgPauseGroupAmino { + return o && (o.$typeUrl === MsgPauseGroup.typeUrl || GroupID.isAmino(o.id)); + }, encode(message: MsgPauseGroup, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.id !== undefined) { GroupID.encode(message.id, writer.uint32(10).fork()).ldelim(); @@ -398,6 +433,12 @@ export const MsgPauseGroup = { typeUrl: "/akash.deployment.v1beta2.MsgPauseGroup", value: MsgPauseGroup.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgPauseGroup.typeUrl)) { + return; + } + GroupID.registerTypeUrl(); } }; function createBaseMsgPauseGroupResponse(): MsgPauseGroupResponse { @@ -411,6 +452,15 @@ function createBaseMsgPauseGroupResponse(): MsgPauseGroupResponse { */ export const MsgPauseGroupResponse = { typeUrl: "/akash.deployment.v1beta2.MsgPauseGroupResponse", + is(o: any): o is MsgPauseGroupResponse { + return o && o.$typeUrl === MsgPauseGroupResponse.typeUrl; + }, + isSDK(o: any): o is MsgPauseGroupResponseSDKType { + return o && o.$typeUrl === MsgPauseGroupResponse.typeUrl; + }, + isAmino(o: any): o is MsgPauseGroupResponseAmino { + return o && o.$typeUrl === MsgPauseGroupResponse.typeUrl; + }, encode(_: MsgPauseGroupResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -462,7 +512,8 @@ export const MsgPauseGroupResponse = { typeUrl: "/akash.deployment.v1beta2.MsgPauseGroupResponse", value: MsgPauseGroupResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgStartGroup(): MsgStartGroup { return { @@ -477,6 +528,15 @@ function createBaseMsgStartGroup(): MsgStartGroup { */ export const MsgStartGroup = { typeUrl: "/akash.deployment.v1beta2.MsgStartGroup", + is(o: any): o is MsgStartGroup { + return o && (o.$typeUrl === MsgStartGroup.typeUrl || GroupID.is(o.id)); + }, + isSDK(o: any): o is MsgStartGroupSDKType { + return o && (o.$typeUrl === MsgStartGroup.typeUrl || GroupID.isSDK(o.id)); + }, + isAmino(o: any): o is MsgStartGroupAmino { + return o && (o.$typeUrl === MsgStartGroup.typeUrl || GroupID.isAmino(o.id)); + }, encode(message: MsgStartGroup, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.id !== undefined) { GroupID.encode(message.id, writer.uint32(10).fork()).ldelim(); @@ -545,6 +605,12 @@ export const MsgStartGroup = { typeUrl: "/akash.deployment.v1beta2.MsgStartGroup", value: MsgStartGroup.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgStartGroup.typeUrl)) { + return; + } + GroupID.registerTypeUrl(); } }; function createBaseMsgStartGroupResponse(): MsgStartGroupResponse { @@ -558,6 +624,15 @@ function createBaseMsgStartGroupResponse(): MsgStartGroupResponse { */ export const MsgStartGroupResponse = { typeUrl: "/akash.deployment.v1beta2.MsgStartGroupResponse", + is(o: any): o is MsgStartGroupResponse { + return o && o.$typeUrl === MsgStartGroupResponse.typeUrl; + }, + isSDK(o: any): o is MsgStartGroupResponseSDKType { + return o && o.$typeUrl === MsgStartGroupResponse.typeUrl; + }, + isAmino(o: any): o is MsgStartGroupResponseAmino { + return o && o.$typeUrl === MsgStartGroupResponse.typeUrl; + }, encode(_: MsgStartGroupResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -609,5 +684,6 @@ export const MsgStartGroupResponse = { typeUrl: "/akash.deployment.v1beta2.MsgStartGroupResponse", value: MsgStartGroupResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/akash/deployment/v1beta2/groupspec.ts b/__fixtures__/v-next/outputv3/akash/deployment/v1beta2/groupspec.ts index 2923da189e..db2d7416ad 100644 --- a/__fixtures__/v-next/outputv3/akash/deployment/v1beta2/groupspec.ts +++ b/__fixtures__/v-next/outputv3/akash/deployment/v1beta2/groupspec.ts @@ -1,6 +1,7 @@ import { PlacementRequirements, PlacementRequirementsAmino, PlacementRequirementsSDKType } from "../../base/v1beta2/attribute"; import { Resource, ResourceAmino, ResourceSDKType } from "./resource"; import { BinaryReader, BinaryWriter } from "../../../binary"; +import { GlobalDecoderRegistry } from "../../../registry"; import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "akash.deployment.v1beta2"; /** @@ -55,6 +56,15 @@ function createBaseGroupSpec(): GroupSpec { */ export const GroupSpec = { typeUrl: "/akash.deployment.v1beta2.GroupSpec", + is(o: any): o is GroupSpec { + return o && (o.$typeUrl === GroupSpec.typeUrl || typeof o.name === "string" && PlacementRequirements.is(o.requirements) && Array.isArray(o.resources) && (!o.resources.length || Resource.is(o.resources[0]))); + }, + isSDK(o: any): o is GroupSpecSDKType { + return o && (o.$typeUrl === GroupSpec.typeUrl || typeof o.name === "string" && PlacementRequirements.isSDK(o.requirements) && Array.isArray(o.resources) && (!o.resources.length || Resource.isSDK(o.resources[0]))); + }, + isAmino(o: any): o is GroupSpecAmino { + return o && (o.$typeUrl === GroupSpec.typeUrl || typeof o.name === "string" && PlacementRequirements.isAmino(o.requirements) && Array.isArray(o.resources) && (!o.resources.length || Resource.isAmino(o.resources[0]))); + }, encode(message: GroupSpec, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -157,5 +167,12 @@ export const GroupSpec = { typeUrl: "/akash.deployment.v1beta2.GroupSpec", value: GroupSpec.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GroupSpec.typeUrl)) { + return; + } + PlacementRequirements.registerTypeUrl(); + Resource.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/akash/deployment/v1beta2/params.ts b/__fixtures__/v-next/outputv3/akash/deployment/v1beta2/params.ts index a6c6f7b801..3d78802940 100644 --- a/__fixtures__/v-next/outputv3/akash/deployment/v1beta2/params.ts +++ b/__fixtures__/v-next/outputv3/akash/deployment/v1beta2/params.ts @@ -1,5 +1,6 @@ import { Coin, CoinAmino, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; +import { GlobalDecoderRegistry } from "../../../registry"; import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "akash.deployment.v1beta2"; /** @@ -46,6 +47,15 @@ function createBaseParams(): Params { */ export const Params = { typeUrl: "/akash.deployment.v1beta2.Params", + is(o: any): o is Params { + return o && (o.$typeUrl === Params.typeUrl || Coin.is(o.deploymentMinDeposit)); + }, + isSDK(o: any): o is ParamsSDKType { + return o && (o.$typeUrl === Params.typeUrl || Coin.isSDK(o.deployment_min_deposit)); + }, + isAmino(o: any): o is ParamsAmino { + return o && (o.$typeUrl === Params.typeUrl || Coin.isAmino(o.deployment_min_deposit)); + }, encode(message: Params, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.deploymentMinDeposit !== undefined) { Coin.encode(message.deploymentMinDeposit, writer.uint32(10).fork()).ldelim(); @@ -114,5 +124,11 @@ export const Params = { typeUrl: "/akash.deployment.v1beta2.Params", value: Params.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Params.typeUrl)) { + return; + } + Coin.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/akash/deployment/v1beta2/query.rpc.func.ts b/__fixtures__/v-next/outputv3/akash/deployment/v1beta2/query.rpc.func.ts new file mode 100644 index 0000000000..7db84a9f92 --- /dev/null +++ b/__fixtures__/v-next/outputv3/akash/deployment/v1beta2/query.rpc.func.ts @@ -0,0 +1,46 @@ +import { DeploymentFilters, DeploymentFiltersSDKType, DeploymentID, DeploymentIDSDKType, Deployment, DeploymentSDKType } from "./deployment"; +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination"; +import { GroupID, GroupIDSDKType } from "./groupid"; +import { Group, GroupSDKType } from "./group"; +import { Account, AccountSDKType } from "../../escrow/v1beta2/types"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { QueryDeploymentsRequest, QueryDeploymentsRequestSDKType, QueryDeploymentsResponse, QueryDeploymentsResponseSDKType, QueryDeploymentRequest, QueryDeploymentRequestSDKType, QueryDeploymentResponse, QueryDeploymentResponseSDKType, QueryGroupRequest, QueryGroupRequestSDKType, QueryGroupResponse, QueryGroupResponseSDKType } from "./query"; +/** + * Deployments queries deployments + * @name getDeployments + * @package akash.deployment.v1beta2 + * @see proto service: akash.deployment.v1beta2.Deployments + */ +export const getDeployments = buildQuery({ + encode: QueryDeploymentsRequest.encode, + decode: QueryDeploymentsResponse.decode, + service: "akash.deployment.v1beta2.Query", + method: "Deployments", + deps: [QueryDeploymentsRequest, QueryDeploymentsResponse] +}); +/** + * Deployment queries deployment details + * @name getDeployment + * @package akash.deployment.v1beta2 + * @see proto service: akash.deployment.v1beta2.Deployment + */ +export const getDeployment = buildQuery({ + encode: QueryDeploymentRequest.encode, + decode: QueryDeploymentResponse.decode, + service: "akash.deployment.v1beta2.Query", + method: "Deployment", + deps: [QueryDeploymentRequest, QueryDeploymentResponse] +}); +/** + * Group queries group details + * @name getGroup + * @package akash.deployment.v1beta2 + * @see proto service: akash.deployment.v1beta2.Group + */ +export const getGroup = buildQuery({ + encode: QueryGroupRequest.encode, + decode: QueryGroupResponse.decode, + service: "akash.deployment.v1beta2.Query", + method: "Group", + deps: [QueryGroupRequest, QueryGroupResponse] +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/akash/deployment/v1beta2/query.ts b/__fixtures__/v-next/outputv3/akash/deployment/v1beta2/query.ts index e2c2bf3d6d..e396df20d6 100644 --- a/__fixtures__/v-next/outputv3/akash/deployment/v1beta2/query.ts +++ b/__fixtures__/v-next/outputv3/akash/deployment/v1beta2/query.ts @@ -4,6 +4,7 @@ import { GroupID, GroupIDAmino, GroupIDSDKType } from "./groupid"; import { Group, GroupAmino, GroupSDKType } from "./group"; import { Account, AccountAmino, AccountSDKType } from "../../escrow/v1beta2/types"; import { BinaryReader, BinaryWriter } from "../../../binary"; +import { GlobalDecoderRegistry } from "../../../registry"; import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "akash.deployment.v1beta2"; /** @@ -218,6 +219,15 @@ function createBaseQueryDeploymentsRequest(): QueryDeploymentsRequest { */ export const QueryDeploymentsRequest = { typeUrl: "/akash.deployment.v1beta2.QueryDeploymentsRequest", + is(o: any): o is QueryDeploymentsRequest { + return o && (o.$typeUrl === QueryDeploymentsRequest.typeUrl || DeploymentFilters.is(o.filters)); + }, + isSDK(o: any): o is QueryDeploymentsRequestSDKType { + return o && (o.$typeUrl === QueryDeploymentsRequest.typeUrl || DeploymentFilters.isSDK(o.filters)); + }, + isAmino(o: any): o is QueryDeploymentsRequestAmino { + return o && (o.$typeUrl === QueryDeploymentsRequest.typeUrl || DeploymentFilters.isAmino(o.filters)); + }, encode(message: QueryDeploymentsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.filters !== undefined) { DeploymentFilters.encode(message.filters, writer.uint32(10).fork()).ldelim(); @@ -302,6 +312,13 @@ export const QueryDeploymentsRequest = { typeUrl: "/akash.deployment.v1beta2.QueryDeploymentsRequest", value: QueryDeploymentsRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryDeploymentsRequest.typeUrl)) { + return; + } + DeploymentFilters.registerTypeUrl(); + PageRequest.registerTypeUrl(); } }; function createBaseQueryDeploymentsResponse(): QueryDeploymentsResponse { @@ -318,6 +335,15 @@ function createBaseQueryDeploymentsResponse(): QueryDeploymentsResponse { */ export const QueryDeploymentsResponse = { typeUrl: "/akash.deployment.v1beta2.QueryDeploymentsResponse", + is(o: any): o is QueryDeploymentsResponse { + return o && (o.$typeUrl === QueryDeploymentsResponse.typeUrl || Array.isArray(o.deployments) && (!o.deployments.length || QueryDeploymentResponse.is(o.deployments[0]))); + }, + isSDK(o: any): o is QueryDeploymentsResponseSDKType { + return o && (o.$typeUrl === QueryDeploymentsResponse.typeUrl || Array.isArray(o.deployments) && (!o.deployments.length || QueryDeploymentResponse.isSDK(o.deployments[0]))); + }, + isAmino(o: any): o is QueryDeploymentsResponseAmino { + return o && (o.$typeUrl === QueryDeploymentsResponse.typeUrl || Array.isArray(o.deployments) && (!o.deployments.length || QueryDeploymentResponse.isAmino(o.deployments[0]))); + }, encode(message: QueryDeploymentsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.deployments) { QueryDeploymentResponse.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -406,6 +432,13 @@ export const QueryDeploymentsResponse = { typeUrl: "/akash.deployment.v1beta2.QueryDeploymentsResponse", value: QueryDeploymentsResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryDeploymentsResponse.typeUrl)) { + return; + } + QueryDeploymentResponse.registerTypeUrl(); + PageResponse.registerTypeUrl(); } }; function createBaseQueryDeploymentRequest(): QueryDeploymentRequest { @@ -421,6 +454,15 @@ function createBaseQueryDeploymentRequest(): QueryDeploymentRequest { */ export const QueryDeploymentRequest = { typeUrl: "/akash.deployment.v1beta2.QueryDeploymentRequest", + is(o: any): o is QueryDeploymentRequest { + return o && (o.$typeUrl === QueryDeploymentRequest.typeUrl || DeploymentID.is(o.id)); + }, + isSDK(o: any): o is QueryDeploymentRequestSDKType { + return o && (o.$typeUrl === QueryDeploymentRequest.typeUrl || DeploymentID.isSDK(o.id)); + }, + isAmino(o: any): o is QueryDeploymentRequestAmino { + return o && (o.$typeUrl === QueryDeploymentRequest.typeUrl || DeploymentID.isAmino(o.id)); + }, encode(message: QueryDeploymentRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.id !== undefined) { DeploymentID.encode(message.id, writer.uint32(10).fork()).ldelim(); @@ -489,6 +531,12 @@ export const QueryDeploymentRequest = { typeUrl: "/akash.deployment.v1beta2.QueryDeploymentRequest", value: QueryDeploymentRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryDeploymentRequest.typeUrl)) { + return; + } + DeploymentID.registerTypeUrl(); } }; function createBaseQueryDeploymentResponse(): QueryDeploymentResponse { @@ -506,6 +554,15 @@ function createBaseQueryDeploymentResponse(): QueryDeploymentResponse { */ export const QueryDeploymentResponse = { typeUrl: "/akash.deployment.v1beta2.QueryDeploymentResponse", + is(o: any): o is QueryDeploymentResponse { + return o && (o.$typeUrl === QueryDeploymentResponse.typeUrl || Deployment.is(o.deployment) && Array.isArray(o.groups) && (!o.groups.length || Group.is(o.groups[0])) && Account.is(o.escrowAccount)); + }, + isSDK(o: any): o is QueryDeploymentResponseSDKType { + return o && (o.$typeUrl === QueryDeploymentResponse.typeUrl || Deployment.isSDK(o.deployment) && Array.isArray(o.groups) && (!o.groups.length || Group.isSDK(o.groups[0])) && Account.isSDK(o.escrow_account)); + }, + isAmino(o: any): o is QueryDeploymentResponseAmino { + return o && (o.$typeUrl === QueryDeploymentResponse.typeUrl || Deployment.isAmino(o.deployment) && Array.isArray(o.groups) && (!o.groups.length || Group.isAmino(o.groups[0])) && Account.isAmino(o.escrow_account)); + }, encode(message: QueryDeploymentResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.deployment !== undefined) { Deployment.encode(message.deployment, writer.uint32(10).fork()).ldelim(); @@ -610,6 +667,14 @@ export const QueryDeploymentResponse = { typeUrl: "/akash.deployment.v1beta2.QueryDeploymentResponse", value: QueryDeploymentResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryDeploymentResponse.typeUrl)) { + return; + } + Deployment.registerTypeUrl(); + Group.registerTypeUrl(); + Account.registerTypeUrl(); } }; function createBaseQueryGroupRequest(): QueryGroupRequest { @@ -625,6 +690,15 @@ function createBaseQueryGroupRequest(): QueryGroupRequest { */ export const QueryGroupRequest = { typeUrl: "/akash.deployment.v1beta2.QueryGroupRequest", + is(o: any): o is QueryGroupRequest { + return o && (o.$typeUrl === QueryGroupRequest.typeUrl || GroupID.is(o.id)); + }, + isSDK(o: any): o is QueryGroupRequestSDKType { + return o && (o.$typeUrl === QueryGroupRequest.typeUrl || GroupID.isSDK(o.id)); + }, + isAmino(o: any): o is QueryGroupRequestAmino { + return o && (o.$typeUrl === QueryGroupRequest.typeUrl || GroupID.isAmino(o.id)); + }, encode(message: QueryGroupRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.id !== undefined) { GroupID.encode(message.id, writer.uint32(10).fork()).ldelim(); @@ -693,6 +767,12 @@ export const QueryGroupRequest = { typeUrl: "/akash.deployment.v1beta2.QueryGroupRequest", value: QueryGroupRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryGroupRequest.typeUrl)) { + return; + } + GroupID.registerTypeUrl(); } }; function createBaseQueryGroupResponse(): QueryGroupResponse { @@ -708,6 +788,15 @@ function createBaseQueryGroupResponse(): QueryGroupResponse { */ export const QueryGroupResponse = { typeUrl: "/akash.deployment.v1beta2.QueryGroupResponse", + is(o: any): o is QueryGroupResponse { + return o && (o.$typeUrl === QueryGroupResponse.typeUrl || Group.is(o.group)); + }, + isSDK(o: any): o is QueryGroupResponseSDKType { + return o && (o.$typeUrl === QueryGroupResponse.typeUrl || Group.isSDK(o.group)); + }, + isAmino(o: any): o is QueryGroupResponseAmino { + return o && (o.$typeUrl === QueryGroupResponse.typeUrl || Group.isAmino(o.group)); + }, encode(message: QueryGroupResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.group !== undefined) { Group.encode(message.group, writer.uint32(10).fork()).ldelim(); @@ -776,5 +865,11 @@ export const QueryGroupResponse = { typeUrl: "/akash.deployment.v1beta2.QueryGroupResponse", value: QueryGroupResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryGroupResponse.typeUrl)) { + return; + } + Group.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/akash/deployment/v1beta2/resource.ts b/__fixtures__/v-next/outputv3/akash/deployment/v1beta2/resource.ts index cac57aaae1..124cb80e5f 100644 --- a/__fixtures__/v-next/outputv3/akash/deployment/v1beta2/resource.ts +++ b/__fixtures__/v-next/outputv3/akash/deployment/v1beta2/resource.ts @@ -1,6 +1,7 @@ import { ResourceUnits, ResourceUnitsAmino, ResourceUnitsSDKType } from "../../base/v1beta2/resourceunits"; import { DecCoin, DecCoinAmino, DecCoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; +import { GlobalDecoderRegistry } from "../../../registry"; import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "akash.deployment.v1beta2"; /** @@ -55,6 +56,15 @@ function createBaseResource(): Resource { */ export const Resource = { typeUrl: "/akash.deployment.v1beta2.Resource", + is(o: any): o is Resource { + return o && (o.$typeUrl === Resource.typeUrl || ResourceUnits.is(o.resources) && typeof o.count === "number" && DecCoin.is(o.price)); + }, + isSDK(o: any): o is ResourceSDKType { + return o && (o.$typeUrl === Resource.typeUrl || ResourceUnits.isSDK(o.resources) && typeof o.count === "number" && DecCoin.isSDK(o.price)); + }, + isAmino(o: any): o is ResourceAmino { + return o && (o.$typeUrl === Resource.typeUrl || ResourceUnits.isAmino(o.resources) && typeof o.count === "number" && DecCoin.isAmino(o.price)); + }, encode(message: Resource, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.resources !== undefined) { ResourceUnits.encode(message.resources, writer.uint32(10).fork()).ldelim(); @@ -153,5 +163,12 @@ export const Resource = { typeUrl: "/akash.deployment.v1beta2.Resource", value: Resource.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Resource.typeUrl)) { + return; + } + ResourceUnits.registerTypeUrl(); + DecCoin.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/akash/deployment/v1beta2/service.registry.ts b/__fixtures__/v-next/outputv3/akash/deployment/v1beta2/service.registry.ts index 5b52b82daf..33cece2065 100644 --- a/__fixtures__/v-next/outputv3/akash/deployment/v1beta2/service.registry.ts +++ b/__fixtures__/v-next/outputv3/akash/deployment/v1beta2/service.registry.ts @@ -2,15 +2,10 @@ import { DeploymentID, DeploymentIDSDKType } from "./deployment"; import { GroupSpec, GroupSpecSDKType } from "./groupspec"; import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { GroupID, GroupIDSDKType } from "./groupid"; -import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { TelescopeGeneratedType } from "../../../types"; import { MsgCreateDeployment, MsgCreateDeploymentSDKType, MsgDepositDeployment, MsgDepositDeploymentSDKType, MsgUpdateDeployment, MsgUpdateDeploymentSDKType, MsgCloseDeployment, MsgCloseDeploymentSDKType } from "./deploymentmsg"; import { MsgCloseGroup, MsgCloseGroupSDKType, MsgPauseGroup, MsgPauseGroupSDKType, MsgStartGroup, MsgStartGroupSDKType } from "./groupmsg"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/akash.deployment.v1beta2.MsgCreateDeployment", MsgCreateDeployment], ["/akash.deployment.v1beta2.MsgDepositDeployment", MsgDepositDeployment], ["/akash.deployment.v1beta2.MsgUpdateDeployment", MsgUpdateDeployment], ["/akash.deployment.v1beta2.MsgCloseDeployment", MsgCloseDeployment], ["/akash.deployment.v1beta2.MsgCloseGroup", MsgCloseGroup], ["/akash.deployment.v1beta2.MsgPauseGroup", MsgPauseGroup], ["/akash.deployment.v1beta2.MsgStartGroup", MsgStartGroup]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/akash.deployment.v1beta2.MsgCreateDeployment", MsgCreateDeployment], ["/akash.deployment.v1beta2.MsgDepositDeployment", MsgDepositDeployment], ["/akash.deployment.v1beta2.MsgUpdateDeployment", MsgUpdateDeployment], ["/akash.deployment.v1beta2.MsgCloseDeployment", MsgCloseDeployment], ["/akash.deployment.v1beta2.MsgCloseGroup", MsgCloseGroup], ["/akash.deployment.v1beta2.MsgPauseGroup", MsgPauseGroup], ["/akash.deployment.v1beta2.MsgStartGroup", MsgStartGroup]]; export const MessageComposer = { encoded: { createDeployment(value: MsgCreateDeployment) { diff --git a/__fixtures__/v-next/outputv3/akash/deployment/v1beta2/service.rpc.func.ts b/__fixtures__/v-next/outputv3/akash/deployment/v1beta2/service.rpc.func.ts new file mode 100644 index 0000000000..bd99b0050f --- /dev/null +++ b/__fixtures__/v-next/outputv3/akash/deployment/v1beta2/service.rpc.func.ts @@ -0,0 +1,70 @@ +import { DeploymentID, DeploymentIDSDKType } from "./deployment"; +import { GroupSpec, GroupSpecSDKType } from "./groupspec"; +import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; +import { GroupID, GroupIDSDKType } from "./groupid"; +import { buildTx } from "../../../helper-func-types"; +import { MsgCreateDeployment, MsgCreateDeploymentSDKType, MsgCreateDeploymentResponse, MsgCreateDeploymentResponseSDKType, MsgDepositDeployment, MsgDepositDeploymentSDKType, MsgDepositDeploymentResponse, MsgDepositDeploymentResponseSDKType, MsgUpdateDeployment, MsgUpdateDeploymentSDKType, MsgUpdateDeploymentResponse, MsgUpdateDeploymentResponseSDKType, MsgCloseDeployment, MsgCloseDeploymentSDKType, MsgCloseDeploymentResponse, MsgCloseDeploymentResponseSDKType } from "./deploymentmsg"; +import { MsgCloseGroup, MsgCloseGroupSDKType, MsgCloseGroupResponse, MsgCloseGroupResponseSDKType, MsgPauseGroup, MsgPauseGroupSDKType, MsgPauseGroupResponse, MsgPauseGroupResponseSDKType, MsgStartGroup, MsgStartGroupSDKType, MsgStartGroupResponse, MsgStartGroupResponseSDKType } from "./groupmsg"; +/** + * CreateDeployment defines a method to create new deployment given proper inputs. + * @name createDeployment + * @package akash.deployment.v1beta2 + * @see proto service: akash.deployment.v1beta2.CreateDeployment + */ +export const createDeployment = buildTx({ + msg: MsgCreateDeployment +}); +/** + * DepositDeployment deposits more funds into the deployment account + * @name depositDeployment + * @package akash.deployment.v1beta2 + * @see proto service: akash.deployment.v1beta2.DepositDeployment + */ +export const depositDeployment = buildTx({ + msg: MsgDepositDeployment +}); +/** + * UpdateDeployment defines a method to update a deployment given proper inputs. + * @name updateDeployment + * @package akash.deployment.v1beta2 + * @see proto service: akash.deployment.v1beta2.UpdateDeployment + */ +export const updateDeployment = buildTx({ + msg: MsgUpdateDeployment +}); +/** + * CloseDeployment defines a method to close a deployment given proper inputs. + * @name closeDeployment + * @package akash.deployment.v1beta2 + * @see proto service: akash.deployment.v1beta2.CloseDeployment + */ +export const closeDeployment = buildTx({ + msg: MsgCloseDeployment +}); +/** + * CloseGroup defines a method to close a group of a deployment given proper inputs. + * @name closeGroup + * @package akash.deployment.v1beta2 + * @see proto service: akash.deployment.v1beta2.CloseGroup + */ +export const closeGroup = buildTx({ + msg: MsgCloseGroup +}); +/** + * PauseGroup defines a method to close a group of a deployment given proper inputs. + * @name pauseGroup + * @package akash.deployment.v1beta2 + * @see proto service: akash.deployment.v1beta2.PauseGroup + */ +export const pauseGroup = buildTx({ + msg: MsgPauseGroup +}); +/** + * StartGroup defines a method to close a group of a deployment given proper inputs. + * @name startGroup + * @package akash.deployment.v1beta2 + * @see proto service: akash.deployment.v1beta2.StartGroup + */ +export const startGroup = buildTx({ + msg: MsgStartGroup +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/akash/escrow/v1beta1/genesis.ts b/__fixtures__/v-next/outputv3/akash/escrow/v1beta1/genesis.ts index b42f5b66e2..63311139fa 100644 --- a/__fixtures__/v-next/outputv3/akash/escrow/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv3/akash/escrow/v1beta1/genesis.ts @@ -1,6 +1,7 @@ import { Account, AccountAmino, AccountSDKType, Payment, PaymentAmino, PaymentSDKType } from "./types"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { DeepPartial } from "../../../helpers"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "akash.escrow.v1beta1"; /** * GenesisState defines the basic genesis state used by escrow module @@ -50,6 +51,15 @@ function createBaseGenesisState(): GenesisState { */ export const GenesisState = { typeUrl: "/akash.escrow.v1beta1.GenesisState", + is(o: any): o is GenesisState { + return o && (o.$typeUrl === GenesisState.typeUrl || Array.isArray(o.accounts) && (!o.accounts.length || Account.is(o.accounts[0])) && Array.isArray(o.payments) && (!o.payments.length || Payment.is(o.payments[0]))); + }, + isSDK(o: any): o is GenesisStateSDKType { + return o && (o.$typeUrl === GenesisState.typeUrl || Array.isArray(o.accounts) && (!o.accounts.length || Account.isSDK(o.accounts[0])) && Array.isArray(o.payments) && (!o.payments.length || Payment.isSDK(o.payments[0]))); + }, + isAmino(o: any): o is GenesisStateAmino { + return o && (o.$typeUrl === GenesisState.typeUrl || Array.isArray(o.accounts) && (!o.accounts.length || Account.isAmino(o.accounts[0])) && Array.isArray(o.payments) && (!o.payments.length || Payment.isAmino(o.payments[0]))); + }, encode(message: GenesisState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.accounts) { Account.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -142,5 +152,12 @@ export const GenesisState = { typeUrl: "/akash.escrow.v1beta1.GenesisState", value: GenesisState.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GenesisState.typeUrl)) { + return; + } + Account.registerTypeUrl(); + Payment.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/akash/escrow/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputv3/akash/escrow/v1beta1/query.rpc.func.ts new file mode 100644 index 0000000000..f576a35edb --- /dev/null +++ b/__fixtures__/v-next/outputv3/akash/escrow/v1beta1/query.rpc.func.ts @@ -0,0 +1,34 @@ +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination"; +import { Account, AccountSDKType, Payment, PaymentSDKType } from "./types"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { QueryAccountsRequest, QueryAccountsRequestSDKType, QueryAccountsResponse, QueryAccountsResponseSDKType, QueryPaymentsRequest, QueryPaymentsRequestSDKType, QueryPaymentsResponse, QueryPaymentsResponseSDKType } from "./query"; +/** + * buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE + * buf:lint:ignore RPC_RESPONSE_STANDARD_NAME + * Accounts queries all accounts + * @name getAccounts + * @package akash.escrow.v1beta1 + * @see proto service: akash.escrow.v1beta1.Accounts + */ +export const getAccounts = buildQuery({ + encode: QueryAccountsRequest.encode, + decode: QueryAccountsResponse.decode, + service: "akash.escrow.v1beta1.Query", + method: "Accounts", + deps: [QueryAccountsRequest, QueryAccountsResponse] +}); +/** + * buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE + * buf:lint:ignore RPC_RESPONSE_STANDARD_NAME + * Payments queries all payments + * @name getPayments + * @package akash.escrow.v1beta1 + * @see proto service: akash.escrow.v1beta1.Payments + */ +export const getPayments = buildQuery({ + encode: QueryPaymentsRequest.encode, + decode: QueryPaymentsResponse.decode, + service: "akash.escrow.v1beta1.Query", + method: "Payments", + deps: [QueryPaymentsRequest, QueryPaymentsResponse] +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/akash/escrow/v1beta1/query.ts b/__fixtures__/v-next/outputv3/akash/escrow/v1beta1/query.ts index 21c8c53451..ae549a85be 100644 --- a/__fixtures__/v-next/outputv3/akash/escrow/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv3/akash/escrow/v1beta1/query.ts @@ -1,6 +1,7 @@ import { PageRequest, PageRequestAmino, PageRequestSDKType, PageResponse, PageResponseAmino, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination"; import { Account, AccountAmino, AccountSDKType, Payment, PaymentAmino, PaymentSDKType } from "./types"; import { BinaryReader, BinaryWriter } from "../../../binary"; +import { GlobalDecoderRegistry } from "../../../registry"; import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "akash.escrow.v1beta1"; /** @@ -177,6 +178,15 @@ function createBaseQueryAccountsRequest(): QueryAccountsRequest { */ export const QueryAccountsRequest = { typeUrl: "/akash.escrow.v1beta1.QueryAccountsRequest", + is(o: any): o is QueryAccountsRequest { + return o && (o.$typeUrl === QueryAccountsRequest.typeUrl || typeof o.scope === "string" && typeof o.xid === "string" && typeof o.owner === "string" && typeof o.state === "string"); + }, + isSDK(o: any): o is QueryAccountsRequestSDKType { + return o && (o.$typeUrl === QueryAccountsRequest.typeUrl || typeof o.scope === "string" && typeof o.xid === "string" && typeof o.owner === "string" && typeof o.state === "string"); + }, + isAmino(o: any): o is QueryAccountsRequestAmino { + return o && (o.$typeUrl === QueryAccountsRequest.typeUrl || typeof o.scope === "string" && typeof o.xid === "string" && typeof o.owner === "string" && typeof o.state === "string"); + }, encode(message: QueryAccountsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.scope !== "") { writer.uint32(10).string(message.scope); @@ -301,6 +311,12 @@ export const QueryAccountsRequest = { typeUrl: "/akash.escrow.v1beta1.QueryAccountsRequest", value: QueryAccountsRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryAccountsRequest.typeUrl)) { + return; + } + PageRequest.registerTypeUrl(); } }; function createBaseQueryAccountsResponse(): QueryAccountsResponse { @@ -317,6 +333,15 @@ function createBaseQueryAccountsResponse(): QueryAccountsResponse { */ export const QueryAccountsResponse = { typeUrl: "/akash.escrow.v1beta1.QueryAccountsResponse", + is(o: any): o is QueryAccountsResponse { + return o && (o.$typeUrl === QueryAccountsResponse.typeUrl || Array.isArray(o.accounts) && (!o.accounts.length || Account.is(o.accounts[0]))); + }, + isSDK(o: any): o is QueryAccountsResponseSDKType { + return o && (o.$typeUrl === QueryAccountsResponse.typeUrl || Array.isArray(o.accounts) && (!o.accounts.length || Account.isSDK(o.accounts[0]))); + }, + isAmino(o: any): o is QueryAccountsResponseAmino { + return o && (o.$typeUrl === QueryAccountsResponse.typeUrl || Array.isArray(o.accounts) && (!o.accounts.length || Account.isAmino(o.accounts[0]))); + }, encode(message: QueryAccountsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.accounts) { Account.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -405,6 +430,13 @@ export const QueryAccountsResponse = { typeUrl: "/akash.escrow.v1beta1.QueryAccountsResponse", value: QueryAccountsResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryAccountsResponse.typeUrl)) { + return; + } + Account.registerTypeUrl(); + PageResponse.registerTypeUrl(); } }; function createBaseQueryPaymentsRequest(): QueryPaymentsRequest { @@ -425,6 +457,15 @@ function createBaseQueryPaymentsRequest(): QueryPaymentsRequest { */ export const QueryPaymentsRequest = { typeUrl: "/akash.escrow.v1beta1.QueryPaymentsRequest", + is(o: any): o is QueryPaymentsRequest { + return o && (o.$typeUrl === QueryPaymentsRequest.typeUrl || typeof o.scope === "string" && typeof o.xid === "string" && typeof o.id === "string" && typeof o.owner === "string" && typeof o.state === "string"); + }, + isSDK(o: any): o is QueryPaymentsRequestSDKType { + return o && (o.$typeUrl === QueryPaymentsRequest.typeUrl || typeof o.scope === "string" && typeof o.xid === "string" && typeof o.id === "string" && typeof o.owner === "string" && typeof o.state === "string"); + }, + isAmino(o: any): o is QueryPaymentsRequestAmino { + return o && (o.$typeUrl === QueryPaymentsRequest.typeUrl || typeof o.scope === "string" && typeof o.xid === "string" && typeof o.id === "string" && typeof o.owner === "string" && typeof o.state === "string"); + }, encode(message: QueryPaymentsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.scope !== "") { writer.uint32(10).string(message.scope); @@ -563,6 +604,12 @@ export const QueryPaymentsRequest = { typeUrl: "/akash.escrow.v1beta1.QueryPaymentsRequest", value: QueryPaymentsRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryPaymentsRequest.typeUrl)) { + return; + } + PageRequest.registerTypeUrl(); } }; function createBaseQueryPaymentsResponse(): QueryPaymentsResponse { @@ -579,6 +626,15 @@ function createBaseQueryPaymentsResponse(): QueryPaymentsResponse { */ export const QueryPaymentsResponse = { typeUrl: "/akash.escrow.v1beta1.QueryPaymentsResponse", + is(o: any): o is QueryPaymentsResponse { + return o && (o.$typeUrl === QueryPaymentsResponse.typeUrl || Array.isArray(o.payments) && (!o.payments.length || Payment.is(o.payments[0]))); + }, + isSDK(o: any): o is QueryPaymentsResponseSDKType { + return o && (o.$typeUrl === QueryPaymentsResponse.typeUrl || Array.isArray(o.payments) && (!o.payments.length || Payment.isSDK(o.payments[0]))); + }, + isAmino(o: any): o is QueryPaymentsResponseAmino { + return o && (o.$typeUrl === QueryPaymentsResponse.typeUrl || Array.isArray(o.payments) && (!o.payments.length || Payment.isAmino(o.payments[0]))); + }, encode(message: QueryPaymentsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.payments) { Payment.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -667,5 +723,12 @@ export const QueryPaymentsResponse = { typeUrl: "/akash.escrow.v1beta1.QueryPaymentsResponse", value: QueryPaymentsResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryPaymentsResponse.typeUrl)) { + return; + } + Payment.registerTypeUrl(); + PageResponse.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/akash/escrow/v1beta1/types.ts b/__fixtures__/v-next/outputv3/akash/escrow/v1beta1/types.ts index 85b8fb9061..875e4caaf5 100644 --- a/__fixtures__/v-next/outputv3/akash/escrow/v1beta1/types.ts +++ b/__fixtures__/v-next/outputv3/akash/escrow/v1beta1/types.ts @@ -1,6 +1,7 @@ import { Coin, CoinAmino, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { isSet, DeepPartial } from "../../../helpers"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "akash.escrow.v1beta1"; /** State stores state for an escrow account */ export enum Account_State { @@ -279,6 +280,15 @@ function createBaseAccountID(): AccountID { */ export const AccountID = { typeUrl: "/akash.escrow.v1beta1.AccountID", + is(o: any): o is AccountID { + return o && (o.$typeUrl === AccountID.typeUrl || typeof o.scope === "string" && typeof o.xid === "string"); + }, + isSDK(o: any): o is AccountIDSDKType { + return o && (o.$typeUrl === AccountID.typeUrl || typeof o.scope === "string" && typeof o.xid === "string"); + }, + isAmino(o: any): o is AccountIDAmino { + return o && (o.$typeUrl === AccountID.typeUrl || typeof o.scope === "string" && typeof o.xid === "string"); + }, encode(message: AccountID, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.scope !== "") { writer.uint32(10).string(message.scope); @@ -359,7 +369,8 @@ export const AccountID = { typeUrl: "/akash.escrow.v1beta1.AccountID", value: AccountID.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseAccount(): Account { return { @@ -379,6 +390,15 @@ function createBaseAccount(): Account { */ export const Account = { typeUrl: "/akash.escrow.v1beta1.Account", + is(o: any): o is Account { + return o && (o.$typeUrl === Account.typeUrl || AccountID.is(o.id) && typeof o.owner === "string" && isSet(o.state) && Coin.is(o.balance) && Coin.is(o.transferred) && typeof o.settledAt === "bigint"); + }, + isSDK(o: any): o is AccountSDKType { + return o && (o.$typeUrl === Account.typeUrl || AccountID.isSDK(o.id) && typeof o.owner === "string" && isSet(o.state) && Coin.isSDK(o.balance) && Coin.isSDK(o.transferred) && typeof o.settled_at === "bigint"); + }, + isAmino(o: any): o is AccountAmino { + return o && (o.$typeUrl === Account.typeUrl || AccountID.isAmino(o.id) && typeof o.owner === "string" && isSet(o.state) && Coin.isAmino(o.balance) && Coin.isAmino(o.transferred) && typeof o.settled_at === "bigint"); + }, encode(message: Account, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.id !== undefined) { AccountID.encode(message.id, writer.uint32(10).fork()).ldelim(); @@ -523,6 +543,13 @@ export const Account = { typeUrl: "/akash.escrow.v1beta1.Account", value: Account.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Account.typeUrl)) { + return; + } + AccountID.registerTypeUrl(); + Coin.registerTypeUrl(); } }; function createBasePayment(): Payment { @@ -544,6 +571,15 @@ function createBasePayment(): Payment { */ export const Payment = { typeUrl: "/akash.escrow.v1beta1.Payment", + is(o: any): o is Payment { + return o && (o.$typeUrl === Payment.typeUrl || AccountID.is(o.accountId) && typeof o.paymentId === "string" && typeof o.owner === "string" && isSet(o.state) && Coin.is(o.rate) && Coin.is(o.balance) && Coin.is(o.withdrawn)); + }, + isSDK(o: any): o is PaymentSDKType { + return o && (o.$typeUrl === Payment.typeUrl || AccountID.isSDK(o.account_id) && typeof o.payment_id === "string" && typeof o.owner === "string" && isSet(o.state) && Coin.isSDK(o.rate) && Coin.isSDK(o.balance) && Coin.isSDK(o.withdrawn)); + }, + isAmino(o: any): o is PaymentAmino { + return o && (o.$typeUrl === Payment.typeUrl || AccountID.isAmino(o.account_id) && typeof o.payment_id === "string" && typeof o.owner === "string" && isSet(o.state) && Coin.isAmino(o.rate) && Coin.isAmino(o.balance) && Coin.isAmino(o.withdrawn)); + }, encode(message: Payment, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.accountId !== undefined) { AccountID.encode(message.accountId, writer.uint32(10).fork()).ldelim(); @@ -702,5 +738,12 @@ export const Payment = { typeUrl: "/akash.escrow.v1beta1.Payment", value: Payment.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Payment.typeUrl)) { + return; + } + AccountID.registerTypeUrl(); + Coin.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/akash/escrow/v1beta2/genesis.ts b/__fixtures__/v-next/outputv3/akash/escrow/v1beta2/genesis.ts index e86d8ff042..e0822854b5 100644 --- a/__fixtures__/v-next/outputv3/akash/escrow/v1beta2/genesis.ts +++ b/__fixtures__/v-next/outputv3/akash/escrow/v1beta2/genesis.ts @@ -1,6 +1,7 @@ import { Account, AccountAmino, AccountSDKType, FractionalPayment, FractionalPaymentAmino, FractionalPaymentSDKType } from "./types"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { DeepPartial } from "../../../helpers"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "akash.escrow.v1beta2"; /** * GenesisState defines the basic genesis state used by escrow module @@ -50,6 +51,15 @@ function createBaseGenesisState(): GenesisState { */ export const GenesisState = { typeUrl: "/akash.escrow.v1beta2.GenesisState", + is(o: any): o is GenesisState { + return o && (o.$typeUrl === GenesisState.typeUrl || Array.isArray(o.accounts) && (!o.accounts.length || Account.is(o.accounts[0])) && Array.isArray(o.payments) && (!o.payments.length || FractionalPayment.is(o.payments[0]))); + }, + isSDK(o: any): o is GenesisStateSDKType { + return o && (o.$typeUrl === GenesisState.typeUrl || Array.isArray(o.accounts) && (!o.accounts.length || Account.isSDK(o.accounts[0])) && Array.isArray(o.payments) && (!o.payments.length || FractionalPayment.isSDK(o.payments[0]))); + }, + isAmino(o: any): o is GenesisStateAmino { + return o && (o.$typeUrl === GenesisState.typeUrl || Array.isArray(o.accounts) && (!o.accounts.length || Account.isAmino(o.accounts[0])) && Array.isArray(o.payments) && (!o.payments.length || FractionalPayment.isAmino(o.payments[0]))); + }, encode(message: GenesisState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.accounts) { Account.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -142,5 +152,12 @@ export const GenesisState = { typeUrl: "/akash.escrow.v1beta2.GenesisState", value: GenesisState.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GenesisState.typeUrl)) { + return; + } + Account.registerTypeUrl(); + FractionalPayment.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/akash/escrow/v1beta2/query.rpc.func.ts b/__fixtures__/v-next/outputv3/akash/escrow/v1beta2/query.rpc.func.ts new file mode 100644 index 0000000000..4a7d2641b0 --- /dev/null +++ b/__fixtures__/v-next/outputv3/akash/escrow/v1beta2/query.rpc.func.ts @@ -0,0 +1,34 @@ +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination"; +import { Account, AccountSDKType, FractionalPayment, FractionalPaymentSDKType } from "./types"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { QueryAccountsRequest, QueryAccountsRequestSDKType, QueryAccountsResponse, QueryAccountsResponseSDKType, QueryPaymentsRequest, QueryPaymentsRequestSDKType, QueryPaymentsResponse, QueryPaymentsResponseSDKType } from "./query"; +/** + * buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE + * buf:lint:ignore RPC_RESPONSE_STANDARD_NAME + * Accounts queries all accounts + * @name getAccounts + * @package akash.escrow.v1beta2 + * @see proto service: akash.escrow.v1beta2.Accounts + */ +export const getAccounts = buildQuery({ + encode: QueryAccountsRequest.encode, + decode: QueryAccountsResponse.decode, + service: "akash.escrow.v1beta2.Query", + method: "Accounts", + deps: [QueryAccountsRequest, QueryAccountsResponse] +}); +/** + * buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE + * buf:lint:ignore RPC_RESPONSE_STANDARD_NAME + * Payments queries all payments + * @name getPayments + * @package akash.escrow.v1beta2 + * @see proto service: akash.escrow.v1beta2.Payments + */ +export const getPayments = buildQuery({ + encode: QueryPaymentsRequest.encode, + decode: QueryPaymentsResponse.decode, + service: "akash.escrow.v1beta2.Query", + method: "Payments", + deps: [QueryPaymentsRequest, QueryPaymentsResponse] +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/akash/escrow/v1beta2/query.ts b/__fixtures__/v-next/outputv3/akash/escrow/v1beta2/query.ts index 2850dc2a80..6efc9e1668 100644 --- a/__fixtures__/v-next/outputv3/akash/escrow/v1beta2/query.ts +++ b/__fixtures__/v-next/outputv3/akash/escrow/v1beta2/query.ts @@ -1,6 +1,7 @@ import { PageRequest, PageRequestAmino, PageRequestSDKType, PageResponse, PageResponseAmino, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination"; import { Account, AccountAmino, AccountSDKType, FractionalPayment, FractionalPaymentAmino, FractionalPaymentSDKType } from "./types"; import { BinaryReader, BinaryWriter } from "../../../binary"; +import { GlobalDecoderRegistry } from "../../../registry"; import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "akash.escrow.v1beta2"; /** @@ -177,6 +178,15 @@ function createBaseQueryAccountsRequest(): QueryAccountsRequest { */ export const QueryAccountsRequest = { typeUrl: "/akash.escrow.v1beta2.QueryAccountsRequest", + is(o: any): o is QueryAccountsRequest { + return o && (o.$typeUrl === QueryAccountsRequest.typeUrl || typeof o.scope === "string" && typeof o.xid === "string" && typeof o.owner === "string" && typeof o.state === "string"); + }, + isSDK(o: any): o is QueryAccountsRequestSDKType { + return o && (o.$typeUrl === QueryAccountsRequest.typeUrl || typeof o.scope === "string" && typeof o.xid === "string" && typeof o.owner === "string" && typeof o.state === "string"); + }, + isAmino(o: any): o is QueryAccountsRequestAmino { + return o && (o.$typeUrl === QueryAccountsRequest.typeUrl || typeof o.scope === "string" && typeof o.xid === "string" && typeof o.owner === "string" && typeof o.state === "string"); + }, encode(message: QueryAccountsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.scope !== "") { writer.uint32(10).string(message.scope); @@ -301,6 +311,12 @@ export const QueryAccountsRequest = { typeUrl: "/akash.escrow.v1beta2.QueryAccountsRequest", value: QueryAccountsRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryAccountsRequest.typeUrl)) { + return; + } + PageRequest.registerTypeUrl(); } }; function createBaseQueryAccountsResponse(): QueryAccountsResponse { @@ -317,6 +333,15 @@ function createBaseQueryAccountsResponse(): QueryAccountsResponse { */ export const QueryAccountsResponse = { typeUrl: "/akash.escrow.v1beta2.QueryAccountsResponse", + is(o: any): o is QueryAccountsResponse { + return o && (o.$typeUrl === QueryAccountsResponse.typeUrl || Array.isArray(o.accounts) && (!o.accounts.length || Account.is(o.accounts[0]))); + }, + isSDK(o: any): o is QueryAccountsResponseSDKType { + return o && (o.$typeUrl === QueryAccountsResponse.typeUrl || Array.isArray(o.accounts) && (!o.accounts.length || Account.isSDK(o.accounts[0]))); + }, + isAmino(o: any): o is QueryAccountsResponseAmino { + return o && (o.$typeUrl === QueryAccountsResponse.typeUrl || Array.isArray(o.accounts) && (!o.accounts.length || Account.isAmino(o.accounts[0]))); + }, encode(message: QueryAccountsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.accounts) { Account.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -405,6 +430,13 @@ export const QueryAccountsResponse = { typeUrl: "/akash.escrow.v1beta2.QueryAccountsResponse", value: QueryAccountsResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryAccountsResponse.typeUrl)) { + return; + } + Account.registerTypeUrl(); + PageResponse.registerTypeUrl(); } }; function createBaseQueryPaymentsRequest(): QueryPaymentsRequest { @@ -425,6 +457,15 @@ function createBaseQueryPaymentsRequest(): QueryPaymentsRequest { */ export const QueryPaymentsRequest = { typeUrl: "/akash.escrow.v1beta2.QueryPaymentsRequest", + is(o: any): o is QueryPaymentsRequest { + return o && (o.$typeUrl === QueryPaymentsRequest.typeUrl || typeof o.scope === "string" && typeof o.xid === "string" && typeof o.id === "string" && typeof o.owner === "string" && typeof o.state === "string"); + }, + isSDK(o: any): o is QueryPaymentsRequestSDKType { + return o && (o.$typeUrl === QueryPaymentsRequest.typeUrl || typeof o.scope === "string" && typeof o.xid === "string" && typeof o.id === "string" && typeof o.owner === "string" && typeof o.state === "string"); + }, + isAmino(o: any): o is QueryPaymentsRequestAmino { + return o && (o.$typeUrl === QueryPaymentsRequest.typeUrl || typeof o.scope === "string" && typeof o.xid === "string" && typeof o.id === "string" && typeof o.owner === "string" && typeof o.state === "string"); + }, encode(message: QueryPaymentsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.scope !== "") { writer.uint32(10).string(message.scope); @@ -563,6 +604,12 @@ export const QueryPaymentsRequest = { typeUrl: "/akash.escrow.v1beta2.QueryPaymentsRequest", value: QueryPaymentsRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryPaymentsRequest.typeUrl)) { + return; + } + PageRequest.registerTypeUrl(); } }; function createBaseQueryPaymentsResponse(): QueryPaymentsResponse { @@ -579,6 +626,15 @@ function createBaseQueryPaymentsResponse(): QueryPaymentsResponse { */ export const QueryPaymentsResponse = { typeUrl: "/akash.escrow.v1beta2.QueryPaymentsResponse", + is(o: any): o is QueryPaymentsResponse { + return o && (o.$typeUrl === QueryPaymentsResponse.typeUrl || Array.isArray(o.payments) && (!o.payments.length || FractionalPayment.is(o.payments[0]))); + }, + isSDK(o: any): o is QueryPaymentsResponseSDKType { + return o && (o.$typeUrl === QueryPaymentsResponse.typeUrl || Array.isArray(o.payments) && (!o.payments.length || FractionalPayment.isSDK(o.payments[0]))); + }, + isAmino(o: any): o is QueryPaymentsResponseAmino { + return o && (o.$typeUrl === QueryPaymentsResponse.typeUrl || Array.isArray(o.payments) && (!o.payments.length || FractionalPayment.isAmino(o.payments[0]))); + }, encode(message: QueryPaymentsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.payments) { FractionalPayment.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -667,5 +723,12 @@ export const QueryPaymentsResponse = { typeUrl: "/akash.escrow.v1beta2.QueryPaymentsResponse", value: QueryPaymentsResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryPaymentsResponse.typeUrl)) { + return; + } + FractionalPayment.registerTypeUrl(); + PageResponse.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/akash/escrow/v1beta2/types.ts b/__fixtures__/v-next/outputv3/akash/escrow/v1beta2/types.ts index 8913d13f04..59618c47ac 100644 --- a/__fixtures__/v-next/outputv3/akash/escrow/v1beta2/types.ts +++ b/__fixtures__/v-next/outputv3/akash/escrow/v1beta2/types.ts @@ -1,6 +1,7 @@ import { DecCoin, DecCoinAmino, DecCoinSDKType, Coin, CoinAmino, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { isSet, DeepPartial } from "../../../helpers"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "akash.escrow.v1beta2"; /** State stores state for an escrow account */ export enum Account_State { @@ -303,6 +304,15 @@ function createBaseAccountID(): AccountID { */ export const AccountID = { typeUrl: "/akash.escrow.v1beta2.AccountID", + is(o: any): o is AccountID { + return o && (o.$typeUrl === AccountID.typeUrl || typeof o.scope === "string" && typeof o.xid === "string"); + }, + isSDK(o: any): o is AccountIDSDKType { + return o && (o.$typeUrl === AccountID.typeUrl || typeof o.scope === "string" && typeof o.xid === "string"); + }, + isAmino(o: any): o is AccountIDAmino { + return o && (o.$typeUrl === AccountID.typeUrl || typeof o.scope === "string" && typeof o.xid === "string"); + }, encode(message: AccountID, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.scope !== "") { writer.uint32(10).string(message.scope); @@ -383,7 +393,8 @@ export const AccountID = { typeUrl: "/akash.escrow.v1beta2.AccountID", value: AccountID.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseAccount(): Account { return { @@ -405,6 +416,15 @@ function createBaseAccount(): Account { */ export const Account = { typeUrl: "/akash.escrow.v1beta2.Account", + is(o: any): o is Account { + return o && (o.$typeUrl === Account.typeUrl || AccountID.is(o.id) && typeof o.owner === "string" && isSet(o.state) && DecCoin.is(o.balance) && DecCoin.is(o.transferred) && typeof o.settledAt === "bigint" && typeof o.depositor === "string" && DecCoin.is(o.funds)); + }, + isSDK(o: any): o is AccountSDKType { + return o && (o.$typeUrl === Account.typeUrl || AccountID.isSDK(o.id) && typeof o.owner === "string" && isSet(o.state) && DecCoin.isSDK(o.balance) && DecCoin.isSDK(o.transferred) && typeof o.settled_at === "bigint" && typeof o.depositor === "string" && DecCoin.isSDK(o.funds)); + }, + isAmino(o: any): o is AccountAmino { + return o && (o.$typeUrl === Account.typeUrl || AccountID.isAmino(o.id) && typeof o.owner === "string" && isSet(o.state) && DecCoin.isAmino(o.balance) && DecCoin.isAmino(o.transferred) && typeof o.settled_at === "bigint" && typeof o.depositor === "string" && DecCoin.isAmino(o.funds)); + }, encode(message: Account, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.id !== undefined) { AccountID.encode(message.id, writer.uint32(10).fork()).ldelim(); @@ -579,6 +599,13 @@ export const Account = { typeUrl: "/akash.escrow.v1beta2.Account", value: Account.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Account.typeUrl)) { + return; + } + AccountID.registerTypeUrl(); + DecCoin.registerTypeUrl(); } }; function createBaseFractionalPayment(): FractionalPayment { @@ -600,6 +627,15 @@ function createBaseFractionalPayment(): FractionalPayment { */ export const FractionalPayment = { typeUrl: "/akash.escrow.v1beta2.FractionalPayment", + is(o: any): o is FractionalPayment { + return o && (o.$typeUrl === FractionalPayment.typeUrl || AccountID.is(o.accountId) && typeof o.paymentId === "string" && typeof o.owner === "string" && isSet(o.state) && DecCoin.is(o.rate) && DecCoin.is(o.balance) && Coin.is(o.withdrawn)); + }, + isSDK(o: any): o is FractionalPaymentSDKType { + return o && (o.$typeUrl === FractionalPayment.typeUrl || AccountID.isSDK(o.account_id) && typeof o.payment_id === "string" && typeof o.owner === "string" && isSet(o.state) && DecCoin.isSDK(o.rate) && DecCoin.isSDK(o.balance) && Coin.isSDK(o.withdrawn)); + }, + isAmino(o: any): o is FractionalPaymentAmino { + return o && (o.$typeUrl === FractionalPayment.typeUrl || AccountID.isAmino(o.account_id) && typeof o.payment_id === "string" && typeof o.owner === "string" && isSet(o.state) && DecCoin.isAmino(o.rate) && DecCoin.isAmino(o.balance) && Coin.isAmino(o.withdrawn)); + }, encode(message: FractionalPayment, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.accountId !== undefined) { AccountID.encode(message.accountId, writer.uint32(10).fork()).ldelim(); @@ -758,5 +794,13 @@ export const FractionalPayment = { typeUrl: "/akash.escrow.v1beta2.FractionalPayment", value: FractionalPayment.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(FractionalPayment.typeUrl)) { + return; + } + AccountID.registerTypeUrl(); + DecCoin.registerTypeUrl(); + Coin.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/akash/inflation/v1beta2/genesis.ts b/__fixtures__/v-next/outputv3/akash/inflation/v1beta2/genesis.ts index 01fe7cc518..268a0a9de2 100644 --- a/__fixtures__/v-next/outputv3/akash/inflation/v1beta2/genesis.ts +++ b/__fixtures__/v-next/outputv3/akash/inflation/v1beta2/genesis.ts @@ -1,5 +1,6 @@ import { Params, ParamsAmino, ParamsSDKType } from "./params"; import { BinaryReader, BinaryWriter } from "../../../binary"; +import { GlobalDecoderRegistry } from "../../../registry"; import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "akash.inflation.v1beta2"; /** @@ -46,6 +47,15 @@ function createBaseGenesisState(): GenesisState { */ export const GenesisState = { typeUrl: "/akash.inflation.v1beta2.GenesisState", + is(o: any): o is GenesisState { + return o && (o.$typeUrl === GenesisState.typeUrl || Params.is(o.params)); + }, + isSDK(o: any): o is GenesisStateSDKType { + return o && (o.$typeUrl === GenesisState.typeUrl || Params.isSDK(o.params)); + }, + isAmino(o: any): o is GenesisStateAmino { + return o && (o.$typeUrl === GenesisState.typeUrl || Params.isAmino(o.params)); + }, encode(message: GenesisState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.params !== undefined) { Params.encode(message.params, writer.uint32(10).fork()).ldelim(); @@ -114,5 +124,11 @@ export const GenesisState = { typeUrl: "/akash.inflation.v1beta2.GenesisState", value: GenesisState.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GenesisState.typeUrl)) { + return; + } + Params.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/akash/inflation/v1beta2/params.ts b/__fixtures__/v-next/outputv3/akash/inflation/v1beta2/params.ts index 471913dbfd..d8b147c99e 100644 --- a/__fixtures__/v-next/outputv3/akash/inflation/v1beta2/params.ts +++ b/__fixtures__/v-next/outputv3/akash/inflation/v1beta2/params.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { Decimal } from "@cosmjs/math"; +import { Decimal } from "@interchainjs/math"; import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "akash.inflation.v1beta2"; /** @@ -76,6 +76,15 @@ function createBaseParams(): Params { */ export const Params = { typeUrl: "/akash.inflation.v1beta2.Params", + is(o: any): o is Params { + return o && (o.$typeUrl === Params.typeUrl || typeof o.inflationDecayFactor === "string" && typeof o.initialInflation === "string" && typeof o.variance === "string"); + }, + isSDK(o: any): o is ParamsSDKType { + return o && (o.$typeUrl === Params.typeUrl || typeof o.inflation_decay_factor === "string" && typeof o.initial_inflation === "string" && typeof o.variance === "string"); + }, + isAmino(o: any): o is ParamsAmino { + return o && (o.$typeUrl === Params.typeUrl || typeof o.inflation_decay_factor === "string" && typeof o.initial_inflation === "string" && typeof o.variance === "string"); + }, encode(message: Params, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.inflationDecayFactor !== "") { writer.uint32(10).string(Decimal.fromUserInput(message.inflationDecayFactor, 18).atomics); @@ -154,9 +163,9 @@ export const Params = { }, toAmino(message: Params, useInterfaces: boolean = true): ParamsAmino { const obj: any = {}; - obj.inflation_decay_factor = message.inflationDecayFactor ?? ""; - obj.initial_inflation = message.initialInflation ?? ""; - obj.variance = message.variance ?? ""; + obj.inflation_decay_factor = Decimal.fromUserInput(message.inflationDecayFactor, 18).atomics ?? ""; + obj.initial_inflation = Decimal.fromUserInput(message.initialInflation, 18).atomics ?? ""; + obj.variance = Decimal.fromUserInput(message.variance, 18).atomics ?? ""; return obj; }, fromProtoMsg(message: ParamsProtoMsg, useInterfaces: boolean = true): Params { @@ -170,5 +179,6 @@ export const Params = { typeUrl: "/akash.inflation.v1beta2.Params", value: Params.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/akash/market/v1beta2/bid.ts b/__fixtures__/v-next/outputv3/akash/market/v1beta2/bid.ts index 68e416ac99..3b97729f1b 100644 --- a/__fixtures__/v-next/outputv3/akash/market/v1beta2/bid.ts +++ b/__fixtures__/v-next/outputv3/akash/market/v1beta2/bid.ts @@ -1,6 +1,7 @@ import { OrderID, OrderIDAmino, OrderIDSDKType } from "./order"; import { DecCoin, DecCoinAmino, DecCoinSDKType, Coin, CoinAmino, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; +import { GlobalDecoderRegistry } from "../../../registry"; import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "akash.market.v1beta2"; /** State is an enum which refers to state of bid */ @@ -328,6 +329,15 @@ function createBaseMsgCreateBid(): MsgCreateBid { */ export const MsgCreateBid = { typeUrl: "/akash.market.v1beta2.MsgCreateBid", + is(o: any): o is MsgCreateBid { + return o && (o.$typeUrl === MsgCreateBid.typeUrl || OrderID.is(o.order) && typeof o.provider === "string" && DecCoin.is(o.price) && Coin.is(o.deposit)); + }, + isSDK(o: any): o is MsgCreateBidSDKType { + return o && (o.$typeUrl === MsgCreateBid.typeUrl || OrderID.isSDK(o.order) && typeof o.provider === "string" && DecCoin.isSDK(o.price) && Coin.isSDK(o.deposit)); + }, + isAmino(o: any): o is MsgCreateBidAmino { + return o && (o.$typeUrl === MsgCreateBid.typeUrl || OrderID.isAmino(o.order) && typeof o.provider === "string" && DecCoin.isAmino(o.price) && Coin.isAmino(o.deposit)); + }, encode(message: MsgCreateBid, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.order !== undefined) { OrderID.encode(message.order, writer.uint32(10).fork()).ldelim(); @@ -442,6 +452,14 @@ export const MsgCreateBid = { typeUrl: "/akash.market.v1beta2.MsgCreateBid", value: MsgCreateBid.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgCreateBid.typeUrl)) { + return; + } + OrderID.registerTypeUrl(); + DecCoin.registerTypeUrl(); + Coin.registerTypeUrl(); } }; function createBaseMsgCreateBidResponse(): MsgCreateBidResponse { @@ -455,6 +473,15 @@ function createBaseMsgCreateBidResponse(): MsgCreateBidResponse { */ export const MsgCreateBidResponse = { typeUrl: "/akash.market.v1beta2.MsgCreateBidResponse", + is(o: any): o is MsgCreateBidResponse { + return o && o.$typeUrl === MsgCreateBidResponse.typeUrl; + }, + isSDK(o: any): o is MsgCreateBidResponseSDKType { + return o && o.$typeUrl === MsgCreateBidResponse.typeUrl; + }, + isAmino(o: any): o is MsgCreateBidResponseAmino { + return o && o.$typeUrl === MsgCreateBidResponse.typeUrl; + }, encode(_: MsgCreateBidResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -506,7 +533,8 @@ export const MsgCreateBidResponse = { typeUrl: "/akash.market.v1beta2.MsgCreateBidResponse", value: MsgCreateBidResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgCloseBid(): MsgCloseBid { return { @@ -521,6 +549,15 @@ function createBaseMsgCloseBid(): MsgCloseBid { */ export const MsgCloseBid = { typeUrl: "/akash.market.v1beta2.MsgCloseBid", + is(o: any): o is MsgCloseBid { + return o && (o.$typeUrl === MsgCloseBid.typeUrl || BidID.is(o.bidId)); + }, + isSDK(o: any): o is MsgCloseBidSDKType { + return o && (o.$typeUrl === MsgCloseBid.typeUrl || BidID.isSDK(o.bid_id)); + }, + isAmino(o: any): o is MsgCloseBidAmino { + return o && (o.$typeUrl === MsgCloseBid.typeUrl || BidID.isAmino(o.bid_id)); + }, encode(message: MsgCloseBid, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.bidId !== undefined) { BidID.encode(message.bidId, writer.uint32(10).fork()).ldelim(); @@ -589,6 +626,12 @@ export const MsgCloseBid = { typeUrl: "/akash.market.v1beta2.MsgCloseBid", value: MsgCloseBid.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgCloseBid.typeUrl)) { + return; + } + BidID.registerTypeUrl(); } }; function createBaseMsgCloseBidResponse(): MsgCloseBidResponse { @@ -602,6 +645,15 @@ function createBaseMsgCloseBidResponse(): MsgCloseBidResponse { */ export const MsgCloseBidResponse = { typeUrl: "/akash.market.v1beta2.MsgCloseBidResponse", + is(o: any): o is MsgCloseBidResponse { + return o && o.$typeUrl === MsgCloseBidResponse.typeUrl; + }, + isSDK(o: any): o is MsgCloseBidResponseSDKType { + return o && o.$typeUrl === MsgCloseBidResponse.typeUrl; + }, + isAmino(o: any): o is MsgCloseBidResponseAmino { + return o && o.$typeUrl === MsgCloseBidResponse.typeUrl; + }, encode(_: MsgCloseBidResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -653,7 +705,8 @@ export const MsgCloseBidResponse = { typeUrl: "/akash.market.v1beta2.MsgCloseBidResponse", value: MsgCloseBidResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseBidID(): BidID { return { @@ -673,6 +726,15 @@ function createBaseBidID(): BidID { */ export const BidID = { typeUrl: "/akash.market.v1beta2.BidID", + is(o: any): o is BidID { + return o && (o.$typeUrl === BidID.typeUrl || typeof o.owner === "string" && typeof o.dseq === "bigint" && typeof o.gseq === "number" && typeof o.oseq === "number" && typeof o.provider === "string"); + }, + isSDK(o: any): o is BidIDSDKType { + return o && (o.$typeUrl === BidID.typeUrl || typeof o.owner === "string" && typeof o.dseq === "bigint" && typeof o.gseq === "number" && typeof o.oseq === "number" && typeof o.provider === "string"); + }, + isAmino(o: any): o is BidIDAmino { + return o && (o.$typeUrl === BidID.typeUrl || typeof o.owner === "string" && typeof o.dseq === "bigint" && typeof o.gseq === "number" && typeof o.oseq === "number" && typeof o.provider === "string"); + }, encode(message: BidID, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.owner !== "") { writer.uint32(10).string(message.owner); @@ -797,7 +859,8 @@ export const BidID = { typeUrl: "/akash.market.v1beta2.BidID", value: BidID.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseBid(): Bid { return { @@ -815,6 +878,15 @@ function createBaseBid(): Bid { */ export const Bid = { typeUrl: "/akash.market.v1beta2.Bid", + is(o: any): o is Bid { + return o && (o.$typeUrl === Bid.typeUrl || BidID.is(o.bidId) && isSet(o.state) && DecCoin.is(o.price) && typeof o.createdAt === "bigint"); + }, + isSDK(o: any): o is BidSDKType { + return o && (o.$typeUrl === Bid.typeUrl || BidID.isSDK(o.bid_id) && isSet(o.state) && DecCoin.isSDK(o.price) && typeof o.created_at === "bigint"); + }, + isAmino(o: any): o is BidAmino { + return o && (o.$typeUrl === Bid.typeUrl || BidID.isAmino(o.bid_id) && isSet(o.state) && DecCoin.isAmino(o.price) && typeof o.created_at === "bigint"); + }, encode(message: Bid, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.bidId !== undefined) { BidID.encode(message.bidId, writer.uint32(10).fork()).ldelim(); @@ -929,6 +1001,13 @@ export const Bid = { typeUrl: "/akash.market.v1beta2.Bid", value: Bid.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Bid.typeUrl)) { + return; + } + BidID.registerTypeUrl(); + DecCoin.registerTypeUrl(); } }; function createBaseBidFilters(): BidFilters { @@ -949,6 +1028,15 @@ function createBaseBidFilters(): BidFilters { */ export const BidFilters = { typeUrl: "/akash.market.v1beta2.BidFilters", + is(o: any): o is BidFilters { + return o && (o.$typeUrl === BidFilters.typeUrl || typeof o.owner === "string" && typeof o.dseq === "bigint" && typeof o.gseq === "number" && typeof o.oseq === "number" && typeof o.provider === "string" && typeof o.state === "string"); + }, + isSDK(o: any): o is BidFiltersSDKType { + return o && (o.$typeUrl === BidFilters.typeUrl || typeof o.owner === "string" && typeof o.dseq === "bigint" && typeof o.gseq === "number" && typeof o.oseq === "number" && typeof o.provider === "string" && typeof o.state === "string"); + }, + isAmino(o: any): o is BidFiltersAmino { + return o && (o.$typeUrl === BidFilters.typeUrl || typeof o.owner === "string" && typeof o.dseq === "bigint" && typeof o.gseq === "number" && typeof o.oseq === "number" && typeof o.provider === "string" && typeof o.state === "string"); + }, encode(message: BidFilters, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.owner !== "") { writer.uint32(10).string(message.owner); @@ -1087,5 +1175,6 @@ export const BidFilters = { typeUrl: "/akash.market.v1beta2.BidFilters", value: BidFilters.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/akash/market/v1beta2/genesis.ts b/__fixtures__/v-next/outputv3/akash/market/v1beta2/genesis.ts index 830adda323..cd454fa600 100644 --- a/__fixtures__/v-next/outputv3/akash/market/v1beta2/genesis.ts +++ b/__fixtures__/v-next/outputv3/akash/market/v1beta2/genesis.ts @@ -2,6 +2,7 @@ import { Order, OrderAmino, OrderSDKType } from "./order"; import { Lease, LeaseAmino, LeaseSDKType } from "./lease"; import { Params, ParamsAmino, ParamsSDKType } from "./params"; import { BinaryReader, BinaryWriter } from "../../../binary"; +import { GlobalDecoderRegistry } from "../../../registry"; import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "akash.market.v1beta2"; /** @@ -56,6 +57,15 @@ function createBaseGenesisState(): GenesisState { */ export const GenesisState = { typeUrl: "/akash.market.v1beta2.GenesisState", + is(o: any): o is GenesisState { + return o && (o.$typeUrl === GenesisState.typeUrl || Array.isArray(o.orders) && (!o.orders.length || Order.is(o.orders[0])) && Array.isArray(o.leases) && (!o.leases.length || Lease.is(o.leases[0])) && Params.is(o.params)); + }, + isSDK(o: any): o is GenesisStateSDKType { + return o && (o.$typeUrl === GenesisState.typeUrl || Array.isArray(o.orders) && (!o.orders.length || Order.isSDK(o.orders[0])) && Array.isArray(o.leases) && (!o.leases.length || Lease.isSDK(o.leases[0])) && Params.isSDK(o.params)); + }, + isAmino(o: any): o is GenesisStateAmino { + return o && (o.$typeUrl === GenesisState.typeUrl || Array.isArray(o.orders) && (!o.orders.length || Order.isAmino(o.orders[0])) && Array.isArray(o.leases) && (!o.leases.length || Lease.isAmino(o.leases[0])) && Params.isAmino(o.params)); + }, encode(message: GenesisState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.orders) { Order.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -164,5 +174,13 @@ export const GenesisState = { typeUrl: "/akash.market.v1beta2.GenesisState", value: GenesisState.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GenesisState.typeUrl)) { + return; + } + Order.registerTypeUrl(); + Lease.registerTypeUrl(); + Params.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/akash/market/v1beta2/lease.ts b/__fixtures__/v-next/outputv3/akash/market/v1beta2/lease.ts index 6b5cdf439c..50c5a9d1f7 100644 --- a/__fixtures__/v-next/outputv3/akash/market/v1beta2/lease.ts +++ b/__fixtures__/v-next/outputv3/akash/market/v1beta2/lease.ts @@ -2,6 +2,7 @@ import { DecCoin, DecCoinAmino, DecCoinSDKType } from "../../../cosmos/base/v1be import { BidID, BidIDAmino, BidIDSDKType } from "./bid"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { isSet, DeepPartial } from "../../../helpers"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "akash.market.v1beta2"; /** State is an enum which refers to state of lease */ export enum Lease_State { @@ -369,6 +370,15 @@ function createBaseLeaseID(): LeaseID { */ export const LeaseID = { typeUrl: "/akash.market.v1beta2.LeaseID", + is(o: any): o is LeaseID { + return o && (o.$typeUrl === LeaseID.typeUrl || typeof o.owner === "string" && typeof o.dseq === "bigint" && typeof o.gseq === "number" && typeof o.oseq === "number" && typeof o.provider === "string"); + }, + isSDK(o: any): o is LeaseIDSDKType { + return o && (o.$typeUrl === LeaseID.typeUrl || typeof o.owner === "string" && typeof o.dseq === "bigint" && typeof o.gseq === "number" && typeof o.oseq === "number" && typeof o.provider === "string"); + }, + isAmino(o: any): o is LeaseIDAmino { + return o && (o.$typeUrl === LeaseID.typeUrl || typeof o.owner === "string" && typeof o.dseq === "bigint" && typeof o.gseq === "number" && typeof o.oseq === "number" && typeof o.provider === "string"); + }, encode(message: LeaseID, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.owner !== "") { writer.uint32(10).string(message.owner); @@ -493,7 +503,8 @@ export const LeaseID = { typeUrl: "/akash.market.v1beta2.LeaseID", value: LeaseID.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseLease(): Lease { return { @@ -512,6 +523,15 @@ function createBaseLease(): Lease { */ export const Lease = { typeUrl: "/akash.market.v1beta2.Lease", + is(o: any): o is Lease { + return o && (o.$typeUrl === Lease.typeUrl || LeaseID.is(o.leaseId) && isSet(o.state) && DecCoin.is(o.price) && typeof o.createdAt === "bigint" && typeof o.closedOn === "bigint"); + }, + isSDK(o: any): o is LeaseSDKType { + return o && (o.$typeUrl === Lease.typeUrl || LeaseID.isSDK(o.lease_id) && isSet(o.state) && DecCoin.isSDK(o.price) && typeof o.created_at === "bigint" && typeof o.closed_on === "bigint"); + }, + isAmino(o: any): o is LeaseAmino { + return o && (o.$typeUrl === Lease.typeUrl || LeaseID.isAmino(o.lease_id) && isSet(o.state) && DecCoin.isAmino(o.price) && typeof o.created_at === "bigint" && typeof o.closed_on === "bigint"); + }, encode(message: Lease, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.leaseId !== undefined) { LeaseID.encode(message.leaseId, writer.uint32(10).fork()).ldelim(); @@ -642,6 +662,13 @@ export const Lease = { typeUrl: "/akash.market.v1beta2.Lease", value: Lease.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Lease.typeUrl)) { + return; + } + LeaseID.registerTypeUrl(); + DecCoin.registerTypeUrl(); } }; function createBaseLeaseFilters(): LeaseFilters { @@ -662,6 +689,15 @@ function createBaseLeaseFilters(): LeaseFilters { */ export const LeaseFilters = { typeUrl: "/akash.market.v1beta2.LeaseFilters", + is(o: any): o is LeaseFilters { + return o && (o.$typeUrl === LeaseFilters.typeUrl || typeof o.owner === "string" && typeof o.dseq === "bigint" && typeof o.gseq === "number" && typeof o.oseq === "number" && typeof o.provider === "string" && typeof o.state === "string"); + }, + isSDK(o: any): o is LeaseFiltersSDKType { + return o && (o.$typeUrl === LeaseFilters.typeUrl || typeof o.owner === "string" && typeof o.dseq === "bigint" && typeof o.gseq === "number" && typeof o.oseq === "number" && typeof o.provider === "string" && typeof o.state === "string"); + }, + isAmino(o: any): o is LeaseFiltersAmino { + return o && (o.$typeUrl === LeaseFilters.typeUrl || typeof o.owner === "string" && typeof o.dseq === "bigint" && typeof o.gseq === "number" && typeof o.oseq === "number" && typeof o.provider === "string" && typeof o.state === "string"); + }, encode(message: LeaseFilters, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.owner !== "") { writer.uint32(10).string(message.owner); @@ -800,7 +836,8 @@ export const LeaseFilters = { typeUrl: "/akash.market.v1beta2.LeaseFilters", value: LeaseFilters.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgCreateLease(): MsgCreateLease { return { @@ -815,6 +852,15 @@ function createBaseMsgCreateLease(): MsgCreateLease { */ export const MsgCreateLease = { typeUrl: "/akash.market.v1beta2.MsgCreateLease", + is(o: any): o is MsgCreateLease { + return o && (o.$typeUrl === MsgCreateLease.typeUrl || BidID.is(o.bidId)); + }, + isSDK(o: any): o is MsgCreateLeaseSDKType { + return o && (o.$typeUrl === MsgCreateLease.typeUrl || BidID.isSDK(o.bid_id)); + }, + isAmino(o: any): o is MsgCreateLeaseAmino { + return o && (o.$typeUrl === MsgCreateLease.typeUrl || BidID.isAmino(o.bid_id)); + }, encode(message: MsgCreateLease, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.bidId !== undefined) { BidID.encode(message.bidId, writer.uint32(10).fork()).ldelim(); @@ -883,6 +929,12 @@ export const MsgCreateLease = { typeUrl: "/akash.market.v1beta2.MsgCreateLease", value: MsgCreateLease.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgCreateLease.typeUrl)) { + return; + } + BidID.registerTypeUrl(); } }; function createBaseMsgCreateLeaseResponse(): MsgCreateLeaseResponse { @@ -896,6 +948,15 @@ function createBaseMsgCreateLeaseResponse(): MsgCreateLeaseResponse { */ export const MsgCreateLeaseResponse = { typeUrl: "/akash.market.v1beta2.MsgCreateLeaseResponse", + is(o: any): o is MsgCreateLeaseResponse { + return o && o.$typeUrl === MsgCreateLeaseResponse.typeUrl; + }, + isSDK(o: any): o is MsgCreateLeaseResponseSDKType { + return o && o.$typeUrl === MsgCreateLeaseResponse.typeUrl; + }, + isAmino(o: any): o is MsgCreateLeaseResponseAmino { + return o && o.$typeUrl === MsgCreateLeaseResponse.typeUrl; + }, encode(_: MsgCreateLeaseResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -947,7 +1008,8 @@ export const MsgCreateLeaseResponse = { typeUrl: "/akash.market.v1beta2.MsgCreateLeaseResponse", value: MsgCreateLeaseResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgWithdrawLease(): MsgWithdrawLease { return { @@ -962,6 +1024,15 @@ function createBaseMsgWithdrawLease(): MsgWithdrawLease { */ export const MsgWithdrawLease = { typeUrl: "/akash.market.v1beta2.MsgWithdrawLease", + is(o: any): o is MsgWithdrawLease { + return o && (o.$typeUrl === MsgWithdrawLease.typeUrl || LeaseID.is(o.bidId)); + }, + isSDK(o: any): o is MsgWithdrawLeaseSDKType { + return o && (o.$typeUrl === MsgWithdrawLease.typeUrl || LeaseID.isSDK(o.bid_id)); + }, + isAmino(o: any): o is MsgWithdrawLeaseAmino { + return o && (o.$typeUrl === MsgWithdrawLease.typeUrl || LeaseID.isAmino(o.bid_id)); + }, encode(message: MsgWithdrawLease, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.bidId !== undefined) { LeaseID.encode(message.bidId, writer.uint32(10).fork()).ldelim(); @@ -1030,6 +1101,12 @@ export const MsgWithdrawLease = { typeUrl: "/akash.market.v1beta2.MsgWithdrawLease", value: MsgWithdrawLease.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgWithdrawLease.typeUrl)) { + return; + } + LeaseID.registerTypeUrl(); } }; function createBaseMsgWithdrawLeaseResponse(): MsgWithdrawLeaseResponse { @@ -1043,6 +1120,15 @@ function createBaseMsgWithdrawLeaseResponse(): MsgWithdrawLeaseResponse { */ export const MsgWithdrawLeaseResponse = { typeUrl: "/akash.market.v1beta2.MsgWithdrawLeaseResponse", + is(o: any): o is MsgWithdrawLeaseResponse { + return o && o.$typeUrl === MsgWithdrawLeaseResponse.typeUrl; + }, + isSDK(o: any): o is MsgWithdrawLeaseResponseSDKType { + return o && o.$typeUrl === MsgWithdrawLeaseResponse.typeUrl; + }, + isAmino(o: any): o is MsgWithdrawLeaseResponseAmino { + return o && o.$typeUrl === MsgWithdrawLeaseResponse.typeUrl; + }, encode(_: MsgWithdrawLeaseResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -1094,7 +1180,8 @@ export const MsgWithdrawLeaseResponse = { typeUrl: "/akash.market.v1beta2.MsgWithdrawLeaseResponse", value: MsgWithdrawLeaseResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgCloseLease(): MsgCloseLease { return { @@ -1109,6 +1196,15 @@ function createBaseMsgCloseLease(): MsgCloseLease { */ export const MsgCloseLease = { typeUrl: "/akash.market.v1beta2.MsgCloseLease", + is(o: any): o is MsgCloseLease { + return o && (o.$typeUrl === MsgCloseLease.typeUrl || LeaseID.is(o.leaseId)); + }, + isSDK(o: any): o is MsgCloseLeaseSDKType { + return o && (o.$typeUrl === MsgCloseLease.typeUrl || LeaseID.isSDK(o.lease_id)); + }, + isAmino(o: any): o is MsgCloseLeaseAmino { + return o && (o.$typeUrl === MsgCloseLease.typeUrl || LeaseID.isAmino(o.lease_id)); + }, encode(message: MsgCloseLease, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.leaseId !== undefined) { LeaseID.encode(message.leaseId, writer.uint32(10).fork()).ldelim(); @@ -1177,6 +1273,12 @@ export const MsgCloseLease = { typeUrl: "/akash.market.v1beta2.MsgCloseLease", value: MsgCloseLease.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgCloseLease.typeUrl)) { + return; + } + LeaseID.registerTypeUrl(); } }; function createBaseMsgCloseLeaseResponse(): MsgCloseLeaseResponse { @@ -1190,6 +1292,15 @@ function createBaseMsgCloseLeaseResponse(): MsgCloseLeaseResponse { */ export const MsgCloseLeaseResponse = { typeUrl: "/akash.market.v1beta2.MsgCloseLeaseResponse", + is(o: any): o is MsgCloseLeaseResponse { + return o && o.$typeUrl === MsgCloseLeaseResponse.typeUrl; + }, + isSDK(o: any): o is MsgCloseLeaseResponseSDKType { + return o && o.$typeUrl === MsgCloseLeaseResponse.typeUrl; + }, + isAmino(o: any): o is MsgCloseLeaseResponseAmino { + return o && o.$typeUrl === MsgCloseLeaseResponse.typeUrl; + }, encode(_: MsgCloseLeaseResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -1241,5 +1352,6 @@ export const MsgCloseLeaseResponse = { typeUrl: "/akash.market.v1beta2.MsgCloseLeaseResponse", value: MsgCloseLeaseResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/akash/market/v1beta2/order.ts b/__fixtures__/v-next/outputv3/akash/market/v1beta2/order.ts index ec21415cc2..490416a726 100644 --- a/__fixtures__/v-next/outputv3/akash/market/v1beta2/order.ts +++ b/__fixtures__/v-next/outputv3/akash/market/v1beta2/order.ts @@ -1,6 +1,7 @@ import { GroupSpec, GroupSpecAmino, GroupSpecSDKType } from "../../deployment/v1beta2/groupspec"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { isSet, DeepPartial } from "../../../helpers"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "akash.market.v1beta2"; /** State is an enum which refers to state of order */ export enum Order_State { @@ -190,6 +191,15 @@ function createBaseOrderID(): OrderID { */ export const OrderID = { typeUrl: "/akash.market.v1beta2.OrderID", + is(o: any): o is OrderID { + return o && (o.$typeUrl === OrderID.typeUrl || typeof o.owner === "string" && typeof o.dseq === "bigint" && typeof o.gseq === "number" && typeof o.oseq === "number"); + }, + isSDK(o: any): o is OrderIDSDKType { + return o && (o.$typeUrl === OrderID.typeUrl || typeof o.owner === "string" && typeof o.dseq === "bigint" && typeof o.gseq === "number" && typeof o.oseq === "number"); + }, + isAmino(o: any): o is OrderIDAmino { + return o && (o.$typeUrl === OrderID.typeUrl || typeof o.owner === "string" && typeof o.dseq === "bigint" && typeof o.gseq === "number" && typeof o.oseq === "number"); + }, encode(message: OrderID, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.owner !== "") { writer.uint32(10).string(message.owner); @@ -300,7 +310,8 @@ export const OrderID = { typeUrl: "/akash.market.v1beta2.OrderID", value: OrderID.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseOrder(): Order { return { @@ -318,6 +329,15 @@ function createBaseOrder(): Order { */ export const Order = { typeUrl: "/akash.market.v1beta2.Order", + is(o: any): o is Order { + return o && (o.$typeUrl === Order.typeUrl || OrderID.is(o.orderId) && isSet(o.state) && GroupSpec.is(o.spec) && typeof o.createdAt === "bigint"); + }, + isSDK(o: any): o is OrderSDKType { + return o && (o.$typeUrl === Order.typeUrl || OrderID.isSDK(o.order_id) && isSet(o.state) && GroupSpec.isSDK(o.spec) && typeof o.created_at === "bigint"); + }, + isAmino(o: any): o is OrderAmino { + return o && (o.$typeUrl === Order.typeUrl || OrderID.isAmino(o.order_id) && isSet(o.state) && GroupSpec.isAmino(o.spec) && typeof o.created_at === "bigint"); + }, encode(message: Order, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.orderId !== undefined) { OrderID.encode(message.orderId, writer.uint32(10).fork()).ldelim(); @@ -432,6 +452,13 @@ export const Order = { typeUrl: "/akash.market.v1beta2.Order", value: Order.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Order.typeUrl)) { + return; + } + OrderID.registerTypeUrl(); + GroupSpec.registerTypeUrl(); } }; function createBaseOrderFilters(): OrderFilters { @@ -451,6 +478,15 @@ function createBaseOrderFilters(): OrderFilters { */ export const OrderFilters = { typeUrl: "/akash.market.v1beta2.OrderFilters", + is(o: any): o is OrderFilters { + return o && (o.$typeUrl === OrderFilters.typeUrl || typeof o.owner === "string" && typeof o.dseq === "bigint" && typeof o.gseq === "number" && typeof o.oseq === "number" && typeof o.state === "string"); + }, + isSDK(o: any): o is OrderFiltersSDKType { + return o && (o.$typeUrl === OrderFilters.typeUrl || typeof o.owner === "string" && typeof o.dseq === "bigint" && typeof o.gseq === "number" && typeof o.oseq === "number" && typeof o.state === "string"); + }, + isAmino(o: any): o is OrderFiltersAmino { + return o && (o.$typeUrl === OrderFilters.typeUrl || typeof o.owner === "string" && typeof o.dseq === "bigint" && typeof o.gseq === "number" && typeof o.oseq === "number" && typeof o.state === "string"); + }, encode(message: OrderFilters, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.owner !== "") { writer.uint32(10).string(message.owner); @@ -575,5 +611,6 @@ export const OrderFilters = { typeUrl: "/akash.market.v1beta2.OrderFilters", value: OrderFilters.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/akash/market/v1beta2/params.ts b/__fixtures__/v-next/outputv3/akash/market/v1beta2/params.ts index f6dd156b20..288b0426f1 100644 --- a/__fixtures__/v-next/outputv3/akash/market/v1beta2/params.ts +++ b/__fixtures__/v-next/outputv3/akash/market/v1beta2/params.ts @@ -1,5 +1,6 @@ import { Coin, CoinAmino, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; +import { GlobalDecoderRegistry } from "../../../registry"; import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "akash.market.v1beta2"; /** @@ -50,6 +51,15 @@ function createBaseParams(): Params { */ export const Params = { typeUrl: "/akash.market.v1beta2.Params", + is(o: any): o is Params { + return o && (o.$typeUrl === Params.typeUrl || Coin.is(o.bidMinDeposit) && typeof o.orderMaxBids === "number"); + }, + isSDK(o: any): o is ParamsSDKType { + return o && (o.$typeUrl === Params.typeUrl || Coin.isSDK(o.bid_min_deposit) && typeof o.order_max_bids === "number"); + }, + isAmino(o: any): o is ParamsAmino { + return o && (o.$typeUrl === Params.typeUrl || Coin.isAmino(o.bid_min_deposit) && typeof o.order_max_bids === "number"); + }, encode(message: Params, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.bidMinDeposit !== undefined) { Coin.encode(message.bidMinDeposit, writer.uint32(10).fork()).ldelim(); @@ -132,5 +142,11 @@ export const Params = { typeUrl: "/akash.market.v1beta2.Params", value: Params.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Params.typeUrl)) { + return; + } + Coin.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/akash/market/v1beta2/query.rpc.func.ts b/__fixtures__/v-next/outputv3/akash/market/v1beta2/query.rpc.func.ts new file mode 100644 index 0000000000..466eb10716 --- /dev/null +++ b/__fixtures__/v-next/outputv3/akash/market/v1beta2/query.rpc.func.ts @@ -0,0 +1,85 @@ +import { OrderFilters, OrderFiltersSDKType, OrderID, OrderIDSDKType, Order, OrderSDKType } from "./order"; +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination"; +import { BidFilters, BidFiltersSDKType, BidID, BidIDSDKType, Bid, BidSDKType } from "./bid"; +import { LeaseFilters, LeaseFiltersSDKType, LeaseID, LeaseIDSDKType, Lease, LeaseSDKType } from "./lease"; +import { Account, AccountSDKType, FractionalPayment, FractionalPaymentSDKType } from "../../escrow/v1beta2/types"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { QueryOrdersRequest, QueryOrdersRequestSDKType, QueryOrdersResponse, QueryOrdersResponseSDKType, QueryOrderRequest, QueryOrderRequestSDKType, QueryOrderResponse, QueryOrderResponseSDKType, QueryBidsRequest, QueryBidsRequestSDKType, QueryBidsResponse, QueryBidsResponseSDKType, QueryBidRequest, QueryBidRequestSDKType, QueryBidResponse, QueryBidResponseSDKType, QueryLeasesRequest, QueryLeasesRequestSDKType, QueryLeasesResponse, QueryLeasesResponseSDKType, QueryLeaseRequest, QueryLeaseRequestSDKType, QueryLeaseResponse, QueryLeaseResponseSDKType } from "./query"; +/** + * Orders queries orders with filters + * @name getOrders + * @package akash.market.v1beta2 + * @see proto service: akash.market.v1beta2.Orders + */ +export const getOrders = buildQuery({ + encode: QueryOrdersRequest.encode, + decode: QueryOrdersResponse.decode, + service: "akash.market.v1beta2.Query", + method: "Orders", + deps: [QueryOrdersRequest, QueryOrdersResponse] +}); +/** + * Order queries order details + * @name getOrder + * @package akash.market.v1beta2 + * @see proto service: akash.market.v1beta2.Order + */ +export const getOrder = buildQuery({ + encode: QueryOrderRequest.encode, + decode: QueryOrderResponse.decode, + service: "akash.market.v1beta2.Query", + method: "Order", + deps: [QueryOrderRequest, QueryOrderResponse] +}); +/** + * Bids queries bids with filters + * @name getBids + * @package akash.market.v1beta2 + * @see proto service: akash.market.v1beta2.Bids + */ +export const getBids = buildQuery({ + encode: QueryBidsRequest.encode, + decode: QueryBidsResponse.decode, + service: "akash.market.v1beta2.Query", + method: "Bids", + deps: [QueryBidsRequest, QueryBidsResponse] +}); +/** + * Bid queries bid details + * @name getBid + * @package akash.market.v1beta2 + * @see proto service: akash.market.v1beta2.Bid + */ +export const getBid = buildQuery({ + encode: QueryBidRequest.encode, + decode: QueryBidResponse.decode, + service: "akash.market.v1beta2.Query", + method: "Bid", + deps: [QueryBidRequest, QueryBidResponse] +}); +/** + * Leases queries leases with filters + * @name getLeases + * @package akash.market.v1beta2 + * @see proto service: akash.market.v1beta2.Leases + */ +export const getLeases = buildQuery({ + encode: QueryLeasesRequest.encode, + decode: QueryLeasesResponse.decode, + service: "akash.market.v1beta2.Query", + method: "Leases", + deps: [QueryLeasesRequest, QueryLeasesResponse] +}); +/** + * Lease queries lease details + * @name getLease + * @package akash.market.v1beta2 + * @see proto service: akash.market.v1beta2.Lease + */ +export const getLease = buildQuery({ + encode: QueryLeaseRequest.encode, + decode: QueryLeaseResponse.decode, + service: "akash.market.v1beta2.Query", + method: "Lease", + deps: [QueryLeaseRequest, QueryLeaseResponse] +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/akash/market/v1beta2/query.ts b/__fixtures__/v-next/outputv3/akash/market/v1beta2/query.ts index 259763590b..8be05195f0 100644 --- a/__fixtures__/v-next/outputv3/akash/market/v1beta2/query.ts +++ b/__fixtures__/v-next/outputv3/akash/market/v1beta2/query.ts @@ -4,6 +4,7 @@ import { BidFilters, BidFiltersAmino, BidFiltersSDKType, BidID, BidIDAmino, BidI import { LeaseFilters, LeaseFiltersAmino, LeaseFiltersSDKType, LeaseID, LeaseIDAmino, LeaseIDSDKType, Lease, LeaseAmino, LeaseSDKType } from "./lease"; import { Account, AccountAmino, AccountSDKType, FractionalPayment, FractionalPaymentAmino, FractionalPaymentSDKType } from "../../escrow/v1beta2/types"; import { BinaryReader, BinaryWriter } from "../../../binary"; +import { GlobalDecoderRegistry } from "../../../registry"; import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "akash.market.v1beta2"; /** @@ -416,6 +417,15 @@ function createBaseQueryOrdersRequest(): QueryOrdersRequest { */ export const QueryOrdersRequest = { typeUrl: "/akash.market.v1beta2.QueryOrdersRequest", + is(o: any): o is QueryOrdersRequest { + return o && (o.$typeUrl === QueryOrdersRequest.typeUrl || OrderFilters.is(o.filters)); + }, + isSDK(o: any): o is QueryOrdersRequestSDKType { + return o && (o.$typeUrl === QueryOrdersRequest.typeUrl || OrderFilters.isSDK(o.filters)); + }, + isAmino(o: any): o is QueryOrdersRequestAmino { + return o && (o.$typeUrl === QueryOrdersRequest.typeUrl || OrderFilters.isAmino(o.filters)); + }, encode(message: QueryOrdersRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.filters !== undefined) { OrderFilters.encode(message.filters, writer.uint32(10).fork()).ldelim(); @@ -500,6 +510,13 @@ export const QueryOrdersRequest = { typeUrl: "/akash.market.v1beta2.QueryOrdersRequest", value: QueryOrdersRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryOrdersRequest.typeUrl)) { + return; + } + OrderFilters.registerTypeUrl(); + PageRequest.registerTypeUrl(); } }; function createBaseQueryOrdersResponse(): QueryOrdersResponse { @@ -516,6 +533,15 @@ function createBaseQueryOrdersResponse(): QueryOrdersResponse { */ export const QueryOrdersResponse = { typeUrl: "/akash.market.v1beta2.QueryOrdersResponse", + is(o: any): o is QueryOrdersResponse { + return o && (o.$typeUrl === QueryOrdersResponse.typeUrl || Array.isArray(o.orders) && (!o.orders.length || Order.is(o.orders[0]))); + }, + isSDK(o: any): o is QueryOrdersResponseSDKType { + return o && (o.$typeUrl === QueryOrdersResponse.typeUrl || Array.isArray(o.orders) && (!o.orders.length || Order.isSDK(o.orders[0]))); + }, + isAmino(o: any): o is QueryOrdersResponseAmino { + return o && (o.$typeUrl === QueryOrdersResponse.typeUrl || Array.isArray(o.orders) && (!o.orders.length || Order.isAmino(o.orders[0]))); + }, encode(message: QueryOrdersResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.orders) { Order.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -604,6 +630,13 @@ export const QueryOrdersResponse = { typeUrl: "/akash.market.v1beta2.QueryOrdersResponse", value: QueryOrdersResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryOrdersResponse.typeUrl)) { + return; + } + Order.registerTypeUrl(); + PageResponse.registerTypeUrl(); } }; function createBaseQueryOrderRequest(): QueryOrderRequest { @@ -619,6 +652,15 @@ function createBaseQueryOrderRequest(): QueryOrderRequest { */ export const QueryOrderRequest = { typeUrl: "/akash.market.v1beta2.QueryOrderRequest", + is(o: any): o is QueryOrderRequest { + return o && (o.$typeUrl === QueryOrderRequest.typeUrl || OrderID.is(o.id)); + }, + isSDK(o: any): o is QueryOrderRequestSDKType { + return o && (o.$typeUrl === QueryOrderRequest.typeUrl || OrderID.isSDK(o.id)); + }, + isAmino(o: any): o is QueryOrderRequestAmino { + return o && (o.$typeUrl === QueryOrderRequest.typeUrl || OrderID.isAmino(o.id)); + }, encode(message: QueryOrderRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.id !== undefined) { OrderID.encode(message.id, writer.uint32(10).fork()).ldelim(); @@ -687,6 +729,12 @@ export const QueryOrderRequest = { typeUrl: "/akash.market.v1beta2.QueryOrderRequest", value: QueryOrderRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryOrderRequest.typeUrl)) { + return; + } + OrderID.registerTypeUrl(); } }; function createBaseQueryOrderResponse(): QueryOrderResponse { @@ -702,6 +750,15 @@ function createBaseQueryOrderResponse(): QueryOrderResponse { */ export const QueryOrderResponse = { typeUrl: "/akash.market.v1beta2.QueryOrderResponse", + is(o: any): o is QueryOrderResponse { + return o && (o.$typeUrl === QueryOrderResponse.typeUrl || Order.is(o.order)); + }, + isSDK(o: any): o is QueryOrderResponseSDKType { + return o && (o.$typeUrl === QueryOrderResponse.typeUrl || Order.isSDK(o.order)); + }, + isAmino(o: any): o is QueryOrderResponseAmino { + return o && (o.$typeUrl === QueryOrderResponse.typeUrl || Order.isAmino(o.order)); + }, encode(message: QueryOrderResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.order !== undefined) { Order.encode(message.order, writer.uint32(10).fork()).ldelim(); @@ -770,6 +827,12 @@ export const QueryOrderResponse = { typeUrl: "/akash.market.v1beta2.QueryOrderResponse", value: QueryOrderResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryOrderResponse.typeUrl)) { + return; + } + Order.registerTypeUrl(); } }; function createBaseQueryBidsRequest(): QueryBidsRequest { @@ -786,6 +849,15 @@ function createBaseQueryBidsRequest(): QueryBidsRequest { */ export const QueryBidsRequest = { typeUrl: "/akash.market.v1beta2.QueryBidsRequest", + is(o: any): o is QueryBidsRequest { + return o && (o.$typeUrl === QueryBidsRequest.typeUrl || BidFilters.is(o.filters)); + }, + isSDK(o: any): o is QueryBidsRequestSDKType { + return o && (o.$typeUrl === QueryBidsRequest.typeUrl || BidFilters.isSDK(o.filters)); + }, + isAmino(o: any): o is QueryBidsRequestAmino { + return o && (o.$typeUrl === QueryBidsRequest.typeUrl || BidFilters.isAmino(o.filters)); + }, encode(message: QueryBidsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.filters !== undefined) { BidFilters.encode(message.filters, writer.uint32(10).fork()).ldelim(); @@ -870,6 +942,13 @@ export const QueryBidsRequest = { typeUrl: "/akash.market.v1beta2.QueryBidsRequest", value: QueryBidsRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryBidsRequest.typeUrl)) { + return; + } + BidFilters.registerTypeUrl(); + PageRequest.registerTypeUrl(); } }; function createBaseQueryBidsResponse(): QueryBidsResponse { @@ -886,6 +965,15 @@ function createBaseQueryBidsResponse(): QueryBidsResponse { */ export const QueryBidsResponse = { typeUrl: "/akash.market.v1beta2.QueryBidsResponse", + is(o: any): o is QueryBidsResponse { + return o && (o.$typeUrl === QueryBidsResponse.typeUrl || Array.isArray(o.bids) && (!o.bids.length || QueryBidResponse.is(o.bids[0]))); + }, + isSDK(o: any): o is QueryBidsResponseSDKType { + return o && (o.$typeUrl === QueryBidsResponse.typeUrl || Array.isArray(o.bids) && (!o.bids.length || QueryBidResponse.isSDK(o.bids[0]))); + }, + isAmino(o: any): o is QueryBidsResponseAmino { + return o && (o.$typeUrl === QueryBidsResponse.typeUrl || Array.isArray(o.bids) && (!o.bids.length || QueryBidResponse.isAmino(o.bids[0]))); + }, encode(message: QueryBidsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.bids) { QueryBidResponse.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -974,6 +1062,13 @@ export const QueryBidsResponse = { typeUrl: "/akash.market.v1beta2.QueryBidsResponse", value: QueryBidsResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryBidsResponse.typeUrl)) { + return; + } + QueryBidResponse.registerTypeUrl(); + PageResponse.registerTypeUrl(); } }; function createBaseQueryBidRequest(): QueryBidRequest { @@ -989,6 +1084,15 @@ function createBaseQueryBidRequest(): QueryBidRequest { */ export const QueryBidRequest = { typeUrl: "/akash.market.v1beta2.QueryBidRequest", + is(o: any): o is QueryBidRequest { + return o && (o.$typeUrl === QueryBidRequest.typeUrl || BidID.is(o.id)); + }, + isSDK(o: any): o is QueryBidRequestSDKType { + return o && (o.$typeUrl === QueryBidRequest.typeUrl || BidID.isSDK(o.id)); + }, + isAmino(o: any): o is QueryBidRequestAmino { + return o && (o.$typeUrl === QueryBidRequest.typeUrl || BidID.isAmino(o.id)); + }, encode(message: QueryBidRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.id !== undefined) { BidID.encode(message.id, writer.uint32(10).fork()).ldelim(); @@ -1057,6 +1161,12 @@ export const QueryBidRequest = { typeUrl: "/akash.market.v1beta2.QueryBidRequest", value: QueryBidRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryBidRequest.typeUrl)) { + return; + } + BidID.registerTypeUrl(); } }; function createBaseQueryBidResponse(): QueryBidResponse { @@ -1073,6 +1183,15 @@ function createBaseQueryBidResponse(): QueryBidResponse { */ export const QueryBidResponse = { typeUrl: "/akash.market.v1beta2.QueryBidResponse", + is(o: any): o is QueryBidResponse { + return o && (o.$typeUrl === QueryBidResponse.typeUrl || Bid.is(o.bid) && Account.is(o.escrowAccount)); + }, + isSDK(o: any): o is QueryBidResponseSDKType { + return o && (o.$typeUrl === QueryBidResponse.typeUrl || Bid.isSDK(o.bid) && Account.isSDK(o.escrow_account)); + }, + isAmino(o: any): o is QueryBidResponseAmino { + return o && (o.$typeUrl === QueryBidResponse.typeUrl || Bid.isAmino(o.bid) && Account.isAmino(o.escrow_account)); + }, encode(message: QueryBidResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.bid !== undefined) { Bid.encode(message.bid, writer.uint32(10).fork()).ldelim(); @@ -1157,6 +1276,13 @@ export const QueryBidResponse = { typeUrl: "/akash.market.v1beta2.QueryBidResponse", value: QueryBidResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryBidResponse.typeUrl)) { + return; + } + Bid.registerTypeUrl(); + Account.registerTypeUrl(); } }; function createBaseQueryLeasesRequest(): QueryLeasesRequest { @@ -1173,6 +1299,15 @@ function createBaseQueryLeasesRequest(): QueryLeasesRequest { */ export const QueryLeasesRequest = { typeUrl: "/akash.market.v1beta2.QueryLeasesRequest", + is(o: any): o is QueryLeasesRequest { + return o && (o.$typeUrl === QueryLeasesRequest.typeUrl || LeaseFilters.is(o.filters)); + }, + isSDK(o: any): o is QueryLeasesRequestSDKType { + return o && (o.$typeUrl === QueryLeasesRequest.typeUrl || LeaseFilters.isSDK(o.filters)); + }, + isAmino(o: any): o is QueryLeasesRequestAmino { + return o && (o.$typeUrl === QueryLeasesRequest.typeUrl || LeaseFilters.isAmino(o.filters)); + }, encode(message: QueryLeasesRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.filters !== undefined) { LeaseFilters.encode(message.filters, writer.uint32(10).fork()).ldelim(); @@ -1257,6 +1392,13 @@ export const QueryLeasesRequest = { typeUrl: "/akash.market.v1beta2.QueryLeasesRequest", value: QueryLeasesRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryLeasesRequest.typeUrl)) { + return; + } + LeaseFilters.registerTypeUrl(); + PageRequest.registerTypeUrl(); } }; function createBaseQueryLeasesResponse(): QueryLeasesResponse { @@ -1273,6 +1415,15 @@ function createBaseQueryLeasesResponse(): QueryLeasesResponse { */ export const QueryLeasesResponse = { typeUrl: "/akash.market.v1beta2.QueryLeasesResponse", + is(o: any): o is QueryLeasesResponse { + return o && (o.$typeUrl === QueryLeasesResponse.typeUrl || Array.isArray(o.leases) && (!o.leases.length || QueryLeaseResponse.is(o.leases[0]))); + }, + isSDK(o: any): o is QueryLeasesResponseSDKType { + return o && (o.$typeUrl === QueryLeasesResponse.typeUrl || Array.isArray(o.leases) && (!o.leases.length || QueryLeaseResponse.isSDK(o.leases[0]))); + }, + isAmino(o: any): o is QueryLeasesResponseAmino { + return o && (o.$typeUrl === QueryLeasesResponse.typeUrl || Array.isArray(o.leases) && (!o.leases.length || QueryLeaseResponse.isAmino(o.leases[0]))); + }, encode(message: QueryLeasesResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.leases) { QueryLeaseResponse.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -1361,6 +1512,13 @@ export const QueryLeasesResponse = { typeUrl: "/akash.market.v1beta2.QueryLeasesResponse", value: QueryLeasesResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryLeasesResponse.typeUrl)) { + return; + } + QueryLeaseResponse.registerTypeUrl(); + PageResponse.registerTypeUrl(); } }; function createBaseQueryLeaseRequest(): QueryLeaseRequest { @@ -1376,6 +1534,15 @@ function createBaseQueryLeaseRequest(): QueryLeaseRequest { */ export const QueryLeaseRequest = { typeUrl: "/akash.market.v1beta2.QueryLeaseRequest", + is(o: any): o is QueryLeaseRequest { + return o && (o.$typeUrl === QueryLeaseRequest.typeUrl || LeaseID.is(o.id)); + }, + isSDK(o: any): o is QueryLeaseRequestSDKType { + return o && (o.$typeUrl === QueryLeaseRequest.typeUrl || LeaseID.isSDK(o.id)); + }, + isAmino(o: any): o is QueryLeaseRequestAmino { + return o && (o.$typeUrl === QueryLeaseRequest.typeUrl || LeaseID.isAmino(o.id)); + }, encode(message: QueryLeaseRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.id !== undefined) { LeaseID.encode(message.id, writer.uint32(10).fork()).ldelim(); @@ -1444,6 +1611,12 @@ export const QueryLeaseRequest = { typeUrl: "/akash.market.v1beta2.QueryLeaseRequest", value: QueryLeaseRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryLeaseRequest.typeUrl)) { + return; + } + LeaseID.registerTypeUrl(); } }; function createBaseQueryLeaseResponse(): QueryLeaseResponse { @@ -1460,6 +1633,15 @@ function createBaseQueryLeaseResponse(): QueryLeaseResponse { */ export const QueryLeaseResponse = { typeUrl: "/akash.market.v1beta2.QueryLeaseResponse", + is(o: any): o is QueryLeaseResponse { + return o && (o.$typeUrl === QueryLeaseResponse.typeUrl || Lease.is(o.lease) && FractionalPayment.is(o.escrowPayment)); + }, + isSDK(o: any): o is QueryLeaseResponseSDKType { + return o && (o.$typeUrl === QueryLeaseResponse.typeUrl || Lease.isSDK(o.lease) && FractionalPayment.isSDK(o.escrow_payment)); + }, + isAmino(o: any): o is QueryLeaseResponseAmino { + return o && (o.$typeUrl === QueryLeaseResponse.typeUrl || Lease.isAmino(o.lease) && FractionalPayment.isAmino(o.escrow_payment)); + }, encode(message: QueryLeaseResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.lease !== undefined) { Lease.encode(message.lease, writer.uint32(10).fork()).ldelim(); @@ -1544,5 +1726,12 @@ export const QueryLeaseResponse = { typeUrl: "/akash.market.v1beta2.QueryLeaseResponse", value: QueryLeaseResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryLeaseResponse.typeUrl)) { + return; + } + Lease.registerTypeUrl(); + FractionalPayment.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/akash/market/v1beta2/service.registry.ts b/__fixtures__/v-next/outputv3/akash/market/v1beta2/service.registry.ts index dbde03dafd..0632f66bc3 100644 --- a/__fixtures__/v-next/outputv3/akash/market/v1beta2/service.registry.ts +++ b/__fixtures__/v-next/outputv3/akash/market/v1beta2/service.registry.ts @@ -2,13 +2,8 @@ import { OrderID, OrderIDSDKType } from "./order"; import { DecCoin, DecCoinSDKType, Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { BidID, BidIDSDKType, MsgCreateBid, MsgCreateBidSDKType, MsgCloseBid, MsgCloseBidSDKType } from "./bid"; import { LeaseID, LeaseIDSDKType, MsgWithdrawLease, MsgWithdrawLeaseSDKType, MsgCreateLease, MsgCreateLeaseSDKType, MsgCloseLease, MsgCloseLeaseSDKType } from "./lease"; -import { GeneratedType, Registry } from "@cosmjs/proto-signing"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/akash.market.v1beta2.MsgCreateBid", MsgCreateBid], ["/akash.market.v1beta2.MsgCloseBid", MsgCloseBid], ["/akash.market.v1beta2.MsgWithdrawLease", MsgWithdrawLease], ["/akash.market.v1beta2.MsgCreateLease", MsgCreateLease], ["/akash.market.v1beta2.MsgCloseLease", MsgCloseLease]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; +import { TelescopeGeneratedType } from "../../../types"; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/akash.market.v1beta2.MsgCreateBid", MsgCreateBid], ["/akash.market.v1beta2.MsgCloseBid", MsgCloseBid], ["/akash.market.v1beta2.MsgWithdrawLease", MsgWithdrawLease], ["/akash.market.v1beta2.MsgCreateLease", MsgCreateLease], ["/akash.market.v1beta2.MsgCloseLease", MsgCloseLease]]; export const MessageComposer = { encoded: { createBid(value: MsgCreateBid) { diff --git a/__fixtures__/v-next/outputv3/akash/market/v1beta2/service.rpc.func.ts b/__fixtures__/v-next/outputv3/akash/market/v1beta2/service.rpc.func.ts new file mode 100644 index 0000000000..778aff6790 --- /dev/null +++ b/__fixtures__/v-next/outputv3/akash/market/v1beta2/service.rpc.func.ts @@ -0,0 +1,50 @@ +import { OrderID, OrderIDSDKType } from "./order"; +import { DecCoin, DecCoinSDKType, Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; +import { BidID, BidIDSDKType, MsgCreateBid, MsgCreateBidSDKType, MsgCreateBidResponse, MsgCreateBidResponseSDKType, MsgCloseBid, MsgCloseBidSDKType, MsgCloseBidResponse, MsgCloseBidResponseSDKType } from "./bid"; +import { LeaseID, LeaseIDSDKType, MsgWithdrawLease, MsgWithdrawLeaseSDKType, MsgWithdrawLeaseResponse, MsgWithdrawLeaseResponseSDKType, MsgCreateLease, MsgCreateLeaseSDKType, MsgCreateLeaseResponse, MsgCreateLeaseResponseSDKType, MsgCloseLease, MsgCloseLeaseSDKType, MsgCloseLeaseResponse, MsgCloseLeaseResponseSDKType } from "./lease"; +import { buildTx } from "../../../helper-func-types"; +/** + * CreateBid defines a method to create a bid given proper inputs. + * @name createBid + * @package akash.market.v1beta2 + * @see proto service: akash.market.v1beta2.CreateBid + */ +export const createBid = buildTx({ + msg: MsgCreateBid +}); +/** + * CloseBid defines a method to close a bid given proper inputs. + * @name closeBid + * @package akash.market.v1beta2 + * @see proto service: akash.market.v1beta2.CloseBid + */ +export const closeBid = buildTx({ + msg: MsgCloseBid +}); +/** + * WithdrawLease withdraws accrued funds from the lease payment + * @name withdrawLease + * @package akash.market.v1beta2 + * @see proto service: akash.market.v1beta2.WithdrawLease + */ +export const withdrawLease = buildTx({ + msg: MsgWithdrawLease +}); +/** + * CreateLease creates a new lease + * @name createLease + * @package akash.market.v1beta2 + * @see proto service: akash.market.v1beta2.CreateLease + */ +export const createLease = buildTx({ + msg: MsgCreateLease +}); +/** + * CloseLease defines a method to close an order given proper inputs. + * @name closeLease + * @package akash.market.v1beta2 + * @see proto service: akash.market.v1beta2.CloseLease + */ +export const closeLease = buildTx({ + msg: MsgCloseLease +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/akash/provider/v1beta1/provider.registry.ts b/__fixtures__/v-next/outputv3/akash/provider/v1beta1/provider.registry.ts index bfe427fab6..01c9c36b4a 100644 --- a/__fixtures__/v-next/outputv3/akash/provider/v1beta1/provider.registry.ts +++ b/__fixtures__/v-next/outputv3/akash/provider/v1beta1/provider.registry.ts @@ -1,12 +1,7 @@ import { Attribute, AttributeSDKType } from "../../base/v1beta1/attribute"; -import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { TelescopeGeneratedType } from "../../../types"; import { MsgCreateProvider, MsgCreateProviderSDKType, MsgUpdateProvider, MsgUpdateProviderSDKType, MsgDeleteProvider, MsgDeleteProviderSDKType } from "./provider"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/akash.provider.v1beta1.MsgCreateProvider", MsgCreateProvider], ["/akash.provider.v1beta1.MsgUpdateProvider", MsgUpdateProvider], ["/akash.provider.v1beta1.MsgDeleteProvider", MsgDeleteProvider]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/akash.provider.v1beta1.MsgCreateProvider", MsgCreateProvider], ["/akash.provider.v1beta1.MsgUpdateProvider", MsgUpdateProvider], ["/akash.provider.v1beta1.MsgDeleteProvider", MsgDeleteProvider]]; export const MessageComposer = { encoded: { createProvider(value: MsgCreateProvider) { diff --git a/__fixtures__/v-next/outputv3/akash/provider/v1beta1/provider.rpc.func.ts b/__fixtures__/v-next/outputv3/akash/provider/v1beta1/provider.rpc.func.ts new file mode 100644 index 0000000000..7f012148ff --- /dev/null +++ b/__fixtures__/v-next/outputv3/akash/provider/v1beta1/provider.rpc.func.ts @@ -0,0 +1,30 @@ +import { Attribute, AttributeSDKType } from "../../base/v1beta1/attribute"; +import { buildTx } from "../../../helper-func-types"; +import { MsgCreateProvider, MsgCreateProviderSDKType, MsgCreateProviderResponse, MsgCreateProviderResponseSDKType, MsgUpdateProvider, MsgUpdateProviderSDKType, MsgUpdateProviderResponse, MsgUpdateProviderResponseSDKType, MsgDeleteProvider, MsgDeleteProviderSDKType, MsgDeleteProviderResponse, MsgDeleteProviderResponseSDKType } from "./provider"; +/** + * CreateProvider defines a method that creates a provider given the proper inputs + * @name createProvider + * @package akash.provider.v1beta1 + * @see proto service: akash.provider.v1beta1.CreateProvider + */ +export const createProvider = buildTx({ + msg: MsgCreateProvider +}); +/** + * UpdateProvider defines a method that updates a provider given the proper inputs + * @name updateProvider + * @package akash.provider.v1beta1 + * @see proto service: akash.provider.v1beta1.UpdateProvider + */ +export const updateProvider = buildTx({ + msg: MsgUpdateProvider +}); +/** + * DeleteProvider defines a method that deletes a provider given the proper inputs + * @name deleteProvider + * @package akash.provider.v1beta1 + * @see proto service: akash.provider.v1beta1.DeleteProvider + */ +export const deleteProvider = buildTx({ + msg: MsgDeleteProvider +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/akash/provider/v1beta1/provider.ts b/__fixtures__/v-next/outputv3/akash/provider/v1beta1/provider.ts index 8824d11d80..3ccd60baad 100644 --- a/__fixtures__/v-next/outputv3/akash/provider/v1beta1/provider.ts +++ b/__fixtures__/v-next/outputv3/akash/provider/v1beta1/provider.ts @@ -1,6 +1,7 @@ import { Attribute, AttributeAmino, AttributeSDKType } from "../../base/v1beta1/attribute"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { isSet, DeepPartial } from "../../../helpers"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "akash.provider.v1beta1"; /** * ProviderInfo @@ -276,6 +277,15 @@ function createBaseProviderInfo(): ProviderInfo { */ export const ProviderInfo = { typeUrl: "/akash.provider.v1beta1.ProviderInfo", + is(o: any): o is ProviderInfo { + return o && (o.$typeUrl === ProviderInfo.typeUrl || typeof o.email === "string" && typeof o.website === "string"); + }, + isSDK(o: any): o is ProviderInfoSDKType { + return o && (o.$typeUrl === ProviderInfo.typeUrl || typeof o.email === "string" && typeof o.website === "string"); + }, + isAmino(o: any): o is ProviderInfoAmino { + return o && (o.$typeUrl === ProviderInfo.typeUrl || typeof o.email === "string" && typeof o.website === "string"); + }, encode(message: ProviderInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.email !== "") { writer.uint32(10).string(message.email); @@ -356,7 +366,8 @@ export const ProviderInfo = { typeUrl: "/akash.provider.v1beta1.ProviderInfo", value: ProviderInfo.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgCreateProvider(): MsgCreateProvider { return { @@ -374,6 +385,15 @@ function createBaseMsgCreateProvider(): MsgCreateProvider { */ export const MsgCreateProvider = { typeUrl: "/akash.provider.v1beta1.MsgCreateProvider", + is(o: any): o is MsgCreateProvider { + return o && (o.$typeUrl === MsgCreateProvider.typeUrl || typeof o.owner === "string" && typeof o.hostUri === "string" && Array.isArray(o.attributes) && (!o.attributes.length || Attribute.is(o.attributes[0])) && ProviderInfo.is(o.info)); + }, + isSDK(o: any): o is MsgCreateProviderSDKType { + return o && (o.$typeUrl === MsgCreateProvider.typeUrl || typeof o.owner === "string" && typeof o.host_uri === "string" && Array.isArray(o.attributes) && (!o.attributes.length || Attribute.isSDK(o.attributes[0])) && ProviderInfo.isSDK(o.info)); + }, + isAmino(o: any): o is MsgCreateProviderAmino { + return o && (o.$typeUrl === MsgCreateProvider.typeUrl || typeof o.owner === "string" && typeof o.host_uri === "string" && Array.isArray(o.attributes) && (!o.attributes.length || Attribute.isAmino(o.attributes[0])) && ProviderInfo.isAmino(o.info)); + }, encode(message: MsgCreateProvider, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.owner !== "") { writer.uint32(10).string(message.owner); @@ -490,6 +510,13 @@ export const MsgCreateProvider = { typeUrl: "/akash.provider.v1beta1.MsgCreateProvider", value: MsgCreateProvider.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgCreateProvider.typeUrl)) { + return; + } + Attribute.registerTypeUrl(); + ProviderInfo.registerTypeUrl(); } }; function createBaseMsgCreateProviderResponse(): MsgCreateProviderResponse { @@ -503,6 +530,15 @@ function createBaseMsgCreateProviderResponse(): MsgCreateProviderResponse { */ export const MsgCreateProviderResponse = { typeUrl: "/akash.provider.v1beta1.MsgCreateProviderResponse", + is(o: any): o is MsgCreateProviderResponse { + return o && o.$typeUrl === MsgCreateProviderResponse.typeUrl; + }, + isSDK(o: any): o is MsgCreateProviderResponseSDKType { + return o && o.$typeUrl === MsgCreateProviderResponse.typeUrl; + }, + isAmino(o: any): o is MsgCreateProviderResponseAmino { + return o && o.$typeUrl === MsgCreateProviderResponse.typeUrl; + }, encode(_: MsgCreateProviderResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -554,7 +590,8 @@ export const MsgCreateProviderResponse = { typeUrl: "/akash.provider.v1beta1.MsgCreateProviderResponse", value: MsgCreateProviderResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgUpdateProvider(): MsgUpdateProvider { return { @@ -572,6 +609,15 @@ function createBaseMsgUpdateProvider(): MsgUpdateProvider { */ export const MsgUpdateProvider = { typeUrl: "/akash.provider.v1beta1.MsgUpdateProvider", + is(o: any): o is MsgUpdateProvider { + return o && (o.$typeUrl === MsgUpdateProvider.typeUrl || typeof o.owner === "string" && typeof o.hostUri === "string" && Array.isArray(o.attributes) && (!o.attributes.length || Attribute.is(o.attributes[0])) && ProviderInfo.is(o.info)); + }, + isSDK(o: any): o is MsgUpdateProviderSDKType { + return o && (o.$typeUrl === MsgUpdateProvider.typeUrl || typeof o.owner === "string" && typeof o.host_uri === "string" && Array.isArray(o.attributes) && (!o.attributes.length || Attribute.isSDK(o.attributes[0])) && ProviderInfo.isSDK(o.info)); + }, + isAmino(o: any): o is MsgUpdateProviderAmino { + return o && (o.$typeUrl === MsgUpdateProvider.typeUrl || typeof o.owner === "string" && typeof o.host_uri === "string" && Array.isArray(o.attributes) && (!o.attributes.length || Attribute.isAmino(o.attributes[0])) && ProviderInfo.isAmino(o.info)); + }, encode(message: MsgUpdateProvider, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.owner !== "") { writer.uint32(10).string(message.owner); @@ -688,6 +734,13 @@ export const MsgUpdateProvider = { typeUrl: "/akash.provider.v1beta1.MsgUpdateProvider", value: MsgUpdateProvider.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgUpdateProvider.typeUrl)) { + return; + } + Attribute.registerTypeUrl(); + ProviderInfo.registerTypeUrl(); } }; function createBaseMsgUpdateProviderResponse(): MsgUpdateProviderResponse { @@ -701,6 +754,15 @@ function createBaseMsgUpdateProviderResponse(): MsgUpdateProviderResponse { */ export const MsgUpdateProviderResponse = { typeUrl: "/akash.provider.v1beta1.MsgUpdateProviderResponse", + is(o: any): o is MsgUpdateProviderResponse { + return o && o.$typeUrl === MsgUpdateProviderResponse.typeUrl; + }, + isSDK(o: any): o is MsgUpdateProviderResponseSDKType { + return o && o.$typeUrl === MsgUpdateProviderResponse.typeUrl; + }, + isAmino(o: any): o is MsgUpdateProviderResponseAmino { + return o && o.$typeUrl === MsgUpdateProviderResponse.typeUrl; + }, encode(_: MsgUpdateProviderResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -752,7 +814,8 @@ export const MsgUpdateProviderResponse = { typeUrl: "/akash.provider.v1beta1.MsgUpdateProviderResponse", value: MsgUpdateProviderResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgDeleteProvider(): MsgDeleteProvider { return { @@ -767,6 +830,15 @@ function createBaseMsgDeleteProvider(): MsgDeleteProvider { */ export const MsgDeleteProvider = { typeUrl: "/akash.provider.v1beta1.MsgDeleteProvider", + is(o: any): o is MsgDeleteProvider { + return o && (o.$typeUrl === MsgDeleteProvider.typeUrl || typeof o.owner === "string"); + }, + isSDK(o: any): o is MsgDeleteProviderSDKType { + return o && (o.$typeUrl === MsgDeleteProvider.typeUrl || typeof o.owner === "string"); + }, + isAmino(o: any): o is MsgDeleteProviderAmino { + return o && (o.$typeUrl === MsgDeleteProvider.typeUrl || typeof o.owner === "string"); + }, encode(message: MsgDeleteProvider, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.owner !== "") { writer.uint32(10).string(message.owner); @@ -833,7 +905,8 @@ export const MsgDeleteProvider = { typeUrl: "/akash.provider.v1beta1.MsgDeleteProvider", value: MsgDeleteProvider.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgDeleteProviderResponse(): MsgDeleteProviderResponse { return {}; @@ -846,6 +919,15 @@ function createBaseMsgDeleteProviderResponse(): MsgDeleteProviderResponse { */ export const MsgDeleteProviderResponse = { typeUrl: "/akash.provider.v1beta1.MsgDeleteProviderResponse", + is(o: any): o is MsgDeleteProviderResponse { + return o && o.$typeUrl === MsgDeleteProviderResponse.typeUrl; + }, + isSDK(o: any): o is MsgDeleteProviderResponseSDKType { + return o && o.$typeUrl === MsgDeleteProviderResponse.typeUrl; + }, + isAmino(o: any): o is MsgDeleteProviderResponseAmino { + return o && o.$typeUrl === MsgDeleteProviderResponse.typeUrl; + }, encode(_: MsgDeleteProviderResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -897,7 +979,8 @@ export const MsgDeleteProviderResponse = { typeUrl: "/akash.provider.v1beta1.MsgDeleteProviderResponse", value: MsgDeleteProviderResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseProvider(): Provider { return { @@ -915,6 +998,15 @@ function createBaseProvider(): Provider { */ export const Provider = { typeUrl: "/akash.provider.v1beta1.Provider", + is(o: any): o is Provider { + return o && (o.$typeUrl === Provider.typeUrl || typeof o.owner === "string" && typeof o.hostUri === "string" && Array.isArray(o.attributes) && (!o.attributes.length || Attribute.is(o.attributes[0])) && ProviderInfo.is(o.info)); + }, + isSDK(o: any): o is ProviderSDKType { + return o && (o.$typeUrl === Provider.typeUrl || typeof o.owner === "string" && typeof o.host_uri === "string" && Array.isArray(o.attributes) && (!o.attributes.length || Attribute.isSDK(o.attributes[0])) && ProviderInfo.isSDK(o.info)); + }, + isAmino(o: any): o is ProviderAmino { + return o && (o.$typeUrl === Provider.typeUrl || typeof o.owner === "string" && typeof o.host_uri === "string" && Array.isArray(o.attributes) && (!o.attributes.length || Attribute.isAmino(o.attributes[0])) && ProviderInfo.isAmino(o.info)); + }, encode(message: Provider, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.owner !== "") { writer.uint32(10).string(message.owner); @@ -1031,5 +1123,12 @@ export const Provider = { typeUrl: "/akash.provider.v1beta1.Provider", value: Provider.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Provider.typeUrl)) { + return; + } + Attribute.registerTypeUrl(); + ProviderInfo.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/akash/provider/v1beta2/genesis.ts b/__fixtures__/v-next/outputv3/akash/provider/v1beta2/genesis.ts index fc6ae50a31..cb10b552ed 100644 --- a/__fixtures__/v-next/outputv3/akash/provider/v1beta2/genesis.ts +++ b/__fixtures__/v-next/outputv3/akash/provider/v1beta2/genesis.ts @@ -1,6 +1,7 @@ import { Provider, ProviderAmino, ProviderSDKType } from "./provider"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { DeepPartial } from "../../../helpers"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "akash.provider.v1beta2"; /** * GenesisState defines the basic genesis state used by provider module @@ -46,6 +47,15 @@ function createBaseGenesisState(): GenesisState { */ export const GenesisState = { typeUrl: "/akash.provider.v1beta2.GenesisState", + is(o: any): o is GenesisState { + return o && (o.$typeUrl === GenesisState.typeUrl || Array.isArray(o.providers) && (!o.providers.length || Provider.is(o.providers[0]))); + }, + isSDK(o: any): o is GenesisStateSDKType { + return o && (o.$typeUrl === GenesisState.typeUrl || Array.isArray(o.providers) && (!o.providers.length || Provider.isSDK(o.providers[0]))); + }, + isAmino(o: any): o is GenesisStateAmino { + return o && (o.$typeUrl === GenesisState.typeUrl || Array.isArray(o.providers) && (!o.providers.length || Provider.isAmino(o.providers[0]))); + }, encode(message: GenesisState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.providers) { Provider.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -118,5 +128,11 @@ export const GenesisState = { typeUrl: "/akash.provider.v1beta2.GenesisState", value: GenesisState.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GenesisState.typeUrl)) { + return; + } + Provider.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/akash/provider/v1beta2/provider.registry.ts b/__fixtures__/v-next/outputv3/akash/provider/v1beta2/provider.registry.ts index 48afa1536c..39e5b172b2 100644 --- a/__fixtures__/v-next/outputv3/akash/provider/v1beta2/provider.registry.ts +++ b/__fixtures__/v-next/outputv3/akash/provider/v1beta2/provider.registry.ts @@ -1,12 +1,7 @@ import { Attribute, AttributeSDKType } from "../../base/v1beta2/attribute"; -import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { TelescopeGeneratedType } from "../../../types"; import { MsgCreateProvider, MsgCreateProviderSDKType, MsgUpdateProvider, MsgUpdateProviderSDKType, MsgDeleteProvider, MsgDeleteProviderSDKType } from "./provider"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/akash.provider.v1beta2.MsgCreateProvider", MsgCreateProvider], ["/akash.provider.v1beta2.MsgUpdateProvider", MsgUpdateProvider], ["/akash.provider.v1beta2.MsgDeleteProvider", MsgDeleteProvider]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/akash.provider.v1beta2.MsgCreateProvider", MsgCreateProvider], ["/akash.provider.v1beta2.MsgUpdateProvider", MsgUpdateProvider], ["/akash.provider.v1beta2.MsgDeleteProvider", MsgDeleteProvider]]; export const MessageComposer = { encoded: { createProvider(value: MsgCreateProvider) { diff --git a/__fixtures__/v-next/outputv3/akash/provider/v1beta2/provider.rpc.func.ts b/__fixtures__/v-next/outputv3/akash/provider/v1beta2/provider.rpc.func.ts new file mode 100644 index 0000000000..2bf0b72d01 --- /dev/null +++ b/__fixtures__/v-next/outputv3/akash/provider/v1beta2/provider.rpc.func.ts @@ -0,0 +1,30 @@ +import { Attribute, AttributeSDKType } from "../../base/v1beta2/attribute"; +import { buildTx } from "../../../helper-func-types"; +import { MsgCreateProvider, MsgCreateProviderSDKType, MsgCreateProviderResponse, MsgCreateProviderResponseSDKType, MsgUpdateProvider, MsgUpdateProviderSDKType, MsgUpdateProviderResponse, MsgUpdateProviderResponseSDKType, MsgDeleteProvider, MsgDeleteProviderSDKType, MsgDeleteProviderResponse, MsgDeleteProviderResponseSDKType } from "./provider"; +/** + * CreateProvider defines a method that creates a provider given the proper inputs + * @name createProvider + * @package akash.provider.v1beta2 + * @see proto service: akash.provider.v1beta2.CreateProvider + */ +export const createProvider = buildTx({ + msg: MsgCreateProvider +}); +/** + * UpdateProvider defines a method that updates a provider given the proper inputs + * @name updateProvider + * @package akash.provider.v1beta2 + * @see proto service: akash.provider.v1beta2.UpdateProvider + */ +export const updateProvider = buildTx({ + msg: MsgUpdateProvider +}); +/** + * DeleteProvider defines a method that deletes a provider given the proper inputs + * @name deleteProvider + * @package akash.provider.v1beta2 + * @see proto service: akash.provider.v1beta2.DeleteProvider + */ +export const deleteProvider = buildTx({ + msg: MsgDeleteProvider +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/akash/provider/v1beta2/provider.ts b/__fixtures__/v-next/outputv3/akash/provider/v1beta2/provider.ts index a434671d30..54d1df83d6 100644 --- a/__fixtures__/v-next/outputv3/akash/provider/v1beta2/provider.ts +++ b/__fixtures__/v-next/outputv3/akash/provider/v1beta2/provider.ts @@ -1,6 +1,7 @@ import { Attribute, AttributeAmino, AttributeSDKType } from "../../base/v1beta2/attribute"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { isSet, DeepPartial } from "../../../helpers"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "akash.provider.v1beta2"; /** * ProviderInfo @@ -276,6 +277,15 @@ function createBaseProviderInfo(): ProviderInfo { */ export const ProviderInfo = { typeUrl: "/akash.provider.v1beta2.ProviderInfo", + is(o: any): o is ProviderInfo { + return o && (o.$typeUrl === ProviderInfo.typeUrl || typeof o.email === "string" && typeof o.website === "string"); + }, + isSDK(o: any): o is ProviderInfoSDKType { + return o && (o.$typeUrl === ProviderInfo.typeUrl || typeof o.email === "string" && typeof o.website === "string"); + }, + isAmino(o: any): o is ProviderInfoAmino { + return o && (o.$typeUrl === ProviderInfo.typeUrl || typeof o.email === "string" && typeof o.website === "string"); + }, encode(message: ProviderInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.email !== "") { writer.uint32(10).string(message.email); @@ -356,7 +366,8 @@ export const ProviderInfo = { typeUrl: "/akash.provider.v1beta2.ProviderInfo", value: ProviderInfo.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgCreateProvider(): MsgCreateProvider { return { @@ -374,6 +385,15 @@ function createBaseMsgCreateProvider(): MsgCreateProvider { */ export const MsgCreateProvider = { typeUrl: "/akash.provider.v1beta2.MsgCreateProvider", + is(o: any): o is MsgCreateProvider { + return o && (o.$typeUrl === MsgCreateProvider.typeUrl || typeof o.owner === "string" && typeof o.hostUri === "string" && Array.isArray(o.attributes) && (!o.attributes.length || Attribute.is(o.attributes[0])) && ProviderInfo.is(o.info)); + }, + isSDK(o: any): o is MsgCreateProviderSDKType { + return o && (o.$typeUrl === MsgCreateProvider.typeUrl || typeof o.owner === "string" && typeof o.host_uri === "string" && Array.isArray(o.attributes) && (!o.attributes.length || Attribute.isSDK(o.attributes[0])) && ProviderInfo.isSDK(o.info)); + }, + isAmino(o: any): o is MsgCreateProviderAmino { + return o && (o.$typeUrl === MsgCreateProvider.typeUrl || typeof o.owner === "string" && typeof o.host_uri === "string" && Array.isArray(o.attributes) && (!o.attributes.length || Attribute.isAmino(o.attributes[0])) && ProviderInfo.isAmino(o.info)); + }, encode(message: MsgCreateProvider, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.owner !== "") { writer.uint32(10).string(message.owner); @@ -490,6 +510,13 @@ export const MsgCreateProvider = { typeUrl: "/akash.provider.v1beta2.MsgCreateProvider", value: MsgCreateProvider.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgCreateProvider.typeUrl)) { + return; + } + Attribute.registerTypeUrl(); + ProviderInfo.registerTypeUrl(); } }; function createBaseMsgCreateProviderResponse(): MsgCreateProviderResponse { @@ -503,6 +530,15 @@ function createBaseMsgCreateProviderResponse(): MsgCreateProviderResponse { */ export const MsgCreateProviderResponse = { typeUrl: "/akash.provider.v1beta2.MsgCreateProviderResponse", + is(o: any): o is MsgCreateProviderResponse { + return o && o.$typeUrl === MsgCreateProviderResponse.typeUrl; + }, + isSDK(o: any): o is MsgCreateProviderResponseSDKType { + return o && o.$typeUrl === MsgCreateProviderResponse.typeUrl; + }, + isAmino(o: any): o is MsgCreateProviderResponseAmino { + return o && o.$typeUrl === MsgCreateProviderResponse.typeUrl; + }, encode(_: MsgCreateProviderResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -554,7 +590,8 @@ export const MsgCreateProviderResponse = { typeUrl: "/akash.provider.v1beta2.MsgCreateProviderResponse", value: MsgCreateProviderResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgUpdateProvider(): MsgUpdateProvider { return { @@ -572,6 +609,15 @@ function createBaseMsgUpdateProvider(): MsgUpdateProvider { */ export const MsgUpdateProvider = { typeUrl: "/akash.provider.v1beta2.MsgUpdateProvider", + is(o: any): o is MsgUpdateProvider { + return o && (o.$typeUrl === MsgUpdateProvider.typeUrl || typeof o.owner === "string" && typeof o.hostUri === "string" && Array.isArray(o.attributes) && (!o.attributes.length || Attribute.is(o.attributes[0])) && ProviderInfo.is(o.info)); + }, + isSDK(o: any): o is MsgUpdateProviderSDKType { + return o && (o.$typeUrl === MsgUpdateProvider.typeUrl || typeof o.owner === "string" && typeof o.host_uri === "string" && Array.isArray(o.attributes) && (!o.attributes.length || Attribute.isSDK(o.attributes[0])) && ProviderInfo.isSDK(o.info)); + }, + isAmino(o: any): o is MsgUpdateProviderAmino { + return o && (o.$typeUrl === MsgUpdateProvider.typeUrl || typeof o.owner === "string" && typeof o.host_uri === "string" && Array.isArray(o.attributes) && (!o.attributes.length || Attribute.isAmino(o.attributes[0])) && ProviderInfo.isAmino(o.info)); + }, encode(message: MsgUpdateProvider, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.owner !== "") { writer.uint32(10).string(message.owner); @@ -688,6 +734,13 @@ export const MsgUpdateProvider = { typeUrl: "/akash.provider.v1beta2.MsgUpdateProvider", value: MsgUpdateProvider.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgUpdateProvider.typeUrl)) { + return; + } + Attribute.registerTypeUrl(); + ProviderInfo.registerTypeUrl(); } }; function createBaseMsgUpdateProviderResponse(): MsgUpdateProviderResponse { @@ -701,6 +754,15 @@ function createBaseMsgUpdateProviderResponse(): MsgUpdateProviderResponse { */ export const MsgUpdateProviderResponse = { typeUrl: "/akash.provider.v1beta2.MsgUpdateProviderResponse", + is(o: any): o is MsgUpdateProviderResponse { + return o && o.$typeUrl === MsgUpdateProviderResponse.typeUrl; + }, + isSDK(o: any): o is MsgUpdateProviderResponseSDKType { + return o && o.$typeUrl === MsgUpdateProviderResponse.typeUrl; + }, + isAmino(o: any): o is MsgUpdateProviderResponseAmino { + return o && o.$typeUrl === MsgUpdateProviderResponse.typeUrl; + }, encode(_: MsgUpdateProviderResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -752,7 +814,8 @@ export const MsgUpdateProviderResponse = { typeUrl: "/akash.provider.v1beta2.MsgUpdateProviderResponse", value: MsgUpdateProviderResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgDeleteProvider(): MsgDeleteProvider { return { @@ -767,6 +830,15 @@ function createBaseMsgDeleteProvider(): MsgDeleteProvider { */ export const MsgDeleteProvider = { typeUrl: "/akash.provider.v1beta2.MsgDeleteProvider", + is(o: any): o is MsgDeleteProvider { + return o && (o.$typeUrl === MsgDeleteProvider.typeUrl || typeof o.owner === "string"); + }, + isSDK(o: any): o is MsgDeleteProviderSDKType { + return o && (o.$typeUrl === MsgDeleteProvider.typeUrl || typeof o.owner === "string"); + }, + isAmino(o: any): o is MsgDeleteProviderAmino { + return o && (o.$typeUrl === MsgDeleteProvider.typeUrl || typeof o.owner === "string"); + }, encode(message: MsgDeleteProvider, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.owner !== "") { writer.uint32(10).string(message.owner); @@ -833,7 +905,8 @@ export const MsgDeleteProvider = { typeUrl: "/akash.provider.v1beta2.MsgDeleteProvider", value: MsgDeleteProvider.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgDeleteProviderResponse(): MsgDeleteProviderResponse { return {}; @@ -846,6 +919,15 @@ function createBaseMsgDeleteProviderResponse(): MsgDeleteProviderResponse { */ export const MsgDeleteProviderResponse = { typeUrl: "/akash.provider.v1beta2.MsgDeleteProviderResponse", + is(o: any): o is MsgDeleteProviderResponse { + return o && o.$typeUrl === MsgDeleteProviderResponse.typeUrl; + }, + isSDK(o: any): o is MsgDeleteProviderResponseSDKType { + return o && o.$typeUrl === MsgDeleteProviderResponse.typeUrl; + }, + isAmino(o: any): o is MsgDeleteProviderResponseAmino { + return o && o.$typeUrl === MsgDeleteProviderResponse.typeUrl; + }, encode(_: MsgDeleteProviderResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -897,7 +979,8 @@ export const MsgDeleteProviderResponse = { typeUrl: "/akash.provider.v1beta2.MsgDeleteProviderResponse", value: MsgDeleteProviderResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseProvider(): Provider { return { @@ -915,6 +998,15 @@ function createBaseProvider(): Provider { */ export const Provider = { typeUrl: "/akash.provider.v1beta2.Provider", + is(o: any): o is Provider { + return o && (o.$typeUrl === Provider.typeUrl || typeof o.owner === "string" && typeof o.hostUri === "string" && Array.isArray(o.attributes) && (!o.attributes.length || Attribute.is(o.attributes[0])) && ProviderInfo.is(o.info)); + }, + isSDK(o: any): o is ProviderSDKType { + return o && (o.$typeUrl === Provider.typeUrl || typeof o.owner === "string" && typeof o.host_uri === "string" && Array.isArray(o.attributes) && (!o.attributes.length || Attribute.isSDK(o.attributes[0])) && ProviderInfo.isSDK(o.info)); + }, + isAmino(o: any): o is ProviderAmino { + return o && (o.$typeUrl === Provider.typeUrl || typeof o.owner === "string" && typeof o.host_uri === "string" && Array.isArray(o.attributes) && (!o.attributes.length || Attribute.isAmino(o.attributes[0])) && ProviderInfo.isAmino(o.info)); + }, encode(message: Provider, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.owner !== "") { writer.uint32(10).string(message.owner); @@ -1031,5 +1123,12 @@ export const Provider = { typeUrl: "/akash.provider.v1beta2.Provider", value: Provider.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Provider.typeUrl)) { + return; + } + Attribute.registerTypeUrl(); + ProviderInfo.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/akash/provider/v1beta2/query.rpc.func.ts b/__fixtures__/v-next/outputv3/akash/provider/v1beta2/query.rpc.func.ts new file mode 100644 index 0000000000..08e00a736b --- /dev/null +++ b/__fixtures__/v-next/outputv3/akash/provider/v1beta2/query.rpc.func.ts @@ -0,0 +1,30 @@ +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination"; +import { Provider, ProviderSDKType } from "./provider"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { QueryProvidersRequest, QueryProvidersRequestSDKType, QueryProvidersResponse, QueryProvidersResponseSDKType, QueryProviderRequest, QueryProviderRequestSDKType, QueryProviderResponse, QueryProviderResponseSDKType } from "./query"; +/** + * Providers queries providers + * @name getProviders + * @package akash.provider.v1beta2 + * @see proto service: akash.provider.v1beta2.Providers + */ +export const getProviders = buildQuery({ + encode: QueryProvidersRequest.encode, + decode: QueryProvidersResponse.decode, + service: "akash.provider.v1beta2.Query", + method: "Providers", + deps: [QueryProvidersRequest, QueryProvidersResponse] +}); +/** + * Provider queries provider details + * @name getProvider + * @package akash.provider.v1beta2 + * @see proto service: akash.provider.v1beta2.Provider + */ +export const getProvider = buildQuery({ + encode: QueryProviderRequest.encode, + decode: QueryProviderResponse.decode, + service: "akash.provider.v1beta2.Query", + method: "Provider", + deps: [QueryProviderRequest, QueryProviderResponse] +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/akash/provider/v1beta2/query.ts b/__fixtures__/v-next/outputv3/akash/provider/v1beta2/query.ts index 91dfdbb313..758a834177 100644 --- a/__fixtures__/v-next/outputv3/akash/provider/v1beta2/query.ts +++ b/__fixtures__/v-next/outputv3/akash/provider/v1beta2/query.ts @@ -1,6 +1,7 @@ import { PageRequest, PageRequestAmino, PageRequestSDKType, PageResponse, PageResponseAmino, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination"; import { Provider, ProviderAmino, ProviderSDKType } from "./provider"; import { BinaryReader, BinaryWriter } from "../../../binary"; +import { GlobalDecoderRegistry } from "../../../registry"; import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "akash.provider.v1beta2"; /** @@ -143,6 +144,15 @@ function createBaseQueryProvidersRequest(): QueryProvidersRequest { */ export const QueryProvidersRequest = { typeUrl: "/akash.provider.v1beta2.QueryProvidersRequest", + is(o: any): o is QueryProvidersRequest { + return o && o.$typeUrl === QueryProvidersRequest.typeUrl; + }, + isSDK(o: any): o is QueryProvidersRequestSDKType { + return o && o.$typeUrl === QueryProvidersRequest.typeUrl; + }, + isAmino(o: any): o is QueryProvidersRequestAmino { + return o && o.$typeUrl === QueryProvidersRequest.typeUrl; + }, encode(message: QueryProvidersRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.pagination !== undefined) { PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); @@ -211,6 +221,12 @@ export const QueryProvidersRequest = { typeUrl: "/akash.provider.v1beta2.QueryProvidersRequest", value: QueryProvidersRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryProvidersRequest.typeUrl)) { + return; + } + PageRequest.registerTypeUrl(); } }; function createBaseQueryProvidersResponse(): QueryProvidersResponse { @@ -227,6 +243,15 @@ function createBaseQueryProvidersResponse(): QueryProvidersResponse { */ export const QueryProvidersResponse = { typeUrl: "/akash.provider.v1beta2.QueryProvidersResponse", + is(o: any): o is QueryProvidersResponse { + return o && (o.$typeUrl === QueryProvidersResponse.typeUrl || Array.isArray(o.providers) && (!o.providers.length || Provider.is(o.providers[0]))); + }, + isSDK(o: any): o is QueryProvidersResponseSDKType { + return o && (o.$typeUrl === QueryProvidersResponse.typeUrl || Array.isArray(o.providers) && (!o.providers.length || Provider.isSDK(o.providers[0]))); + }, + isAmino(o: any): o is QueryProvidersResponseAmino { + return o && (o.$typeUrl === QueryProvidersResponse.typeUrl || Array.isArray(o.providers) && (!o.providers.length || Provider.isAmino(o.providers[0]))); + }, encode(message: QueryProvidersResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.providers) { Provider.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -315,6 +340,13 @@ export const QueryProvidersResponse = { typeUrl: "/akash.provider.v1beta2.QueryProvidersResponse", value: QueryProvidersResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryProvidersResponse.typeUrl)) { + return; + } + Provider.registerTypeUrl(); + PageResponse.registerTypeUrl(); } }; function createBaseQueryProviderRequest(): QueryProviderRequest { @@ -330,6 +362,15 @@ function createBaseQueryProviderRequest(): QueryProviderRequest { */ export const QueryProviderRequest = { typeUrl: "/akash.provider.v1beta2.QueryProviderRequest", + is(o: any): o is QueryProviderRequest { + return o && (o.$typeUrl === QueryProviderRequest.typeUrl || typeof o.owner === "string"); + }, + isSDK(o: any): o is QueryProviderRequestSDKType { + return o && (o.$typeUrl === QueryProviderRequest.typeUrl || typeof o.owner === "string"); + }, + isAmino(o: any): o is QueryProviderRequestAmino { + return o && (o.$typeUrl === QueryProviderRequest.typeUrl || typeof o.owner === "string"); + }, encode(message: QueryProviderRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.owner !== "") { writer.uint32(10).string(message.owner); @@ -396,7 +437,8 @@ export const QueryProviderRequest = { typeUrl: "/akash.provider.v1beta2.QueryProviderRequest", value: QueryProviderRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryProviderResponse(): QueryProviderResponse { return { @@ -411,6 +453,15 @@ function createBaseQueryProviderResponse(): QueryProviderResponse { */ export const QueryProviderResponse = { typeUrl: "/akash.provider.v1beta2.QueryProviderResponse", + is(o: any): o is QueryProviderResponse { + return o && (o.$typeUrl === QueryProviderResponse.typeUrl || Provider.is(o.provider)); + }, + isSDK(o: any): o is QueryProviderResponseSDKType { + return o && (o.$typeUrl === QueryProviderResponse.typeUrl || Provider.isSDK(o.provider)); + }, + isAmino(o: any): o is QueryProviderResponseAmino { + return o && (o.$typeUrl === QueryProviderResponse.typeUrl || Provider.isAmino(o.provider)); + }, encode(message: QueryProviderResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.provider !== undefined) { Provider.encode(message.provider, writer.uint32(10).fork()).ldelim(); @@ -479,5 +530,11 @@ export const QueryProviderResponse = { typeUrl: "/akash.provider.v1beta2.QueryProviderResponse", value: QueryProviderResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryProviderResponse.typeUrl)) { + return; + } + Provider.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/confio/proofs.ts b/__fixtures__/v-next/outputv3/confio/proofs.ts index af54af6bfe..54b456aaac 100644 --- a/__fixtures__/v-next/outputv3/confio/proofs.ts +++ b/__fixtures__/v-next/outputv3/confio/proofs.ts @@ -1,4 +1,5 @@ import { BinaryReader, BinaryWriter } from "../binary"; +import { GlobalDecoderRegistry } from "../registry"; import { isSet, bytesFromBase64, DeepPartial, base64FromBytes } from "../helpers"; export const protobufPackage = "ics23"; export enum HashOp { @@ -923,6 +924,15 @@ function createBaseExistenceProof(): ExistenceProof { */ export const ExistenceProof = { typeUrl: "/ics23.ExistenceProof", + is(o: any): o is ExistenceProof { + return o && (o.$typeUrl === ExistenceProof.typeUrl || (o.key instanceof Uint8Array || typeof o.key === "string") && (o.value instanceof Uint8Array || typeof o.value === "string") && Array.isArray(o.path) && (!o.path.length || InnerOp.is(o.path[0]))); + }, + isSDK(o: any): o is ExistenceProofSDKType { + return o && (o.$typeUrl === ExistenceProof.typeUrl || (o.key instanceof Uint8Array || typeof o.key === "string") && (o.value instanceof Uint8Array || typeof o.value === "string") && Array.isArray(o.path) && (!o.path.length || InnerOp.isSDK(o.path[0]))); + }, + isAmino(o: any): o is ExistenceProofAmino { + return o && (o.$typeUrl === ExistenceProof.typeUrl || (o.key instanceof Uint8Array || typeof o.key === "string") && (o.value instanceof Uint8Array || typeof o.value === "string") && Array.isArray(o.path) && (!o.path.length || InnerOp.isAmino(o.path[0]))); + }, encode(message: ExistenceProof, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.key.length !== 0) { writer.uint32(10).bytes(message.key); @@ -1039,6 +1049,13 @@ export const ExistenceProof = { typeUrl: "/ics23.ExistenceProof", value: ExistenceProof.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ExistenceProof.typeUrl)) { + return; + } + LeafOp.registerTypeUrl(); + InnerOp.registerTypeUrl(); } }; function createBaseNonExistenceProof(): NonExistenceProof { @@ -1058,6 +1075,15 @@ function createBaseNonExistenceProof(): NonExistenceProof { */ export const NonExistenceProof = { typeUrl: "/ics23.NonExistenceProof", + is(o: any): o is NonExistenceProof { + return o && (o.$typeUrl === NonExistenceProof.typeUrl || o.key instanceof Uint8Array || typeof o.key === "string"); + }, + isSDK(o: any): o is NonExistenceProofSDKType { + return o && (o.$typeUrl === NonExistenceProof.typeUrl || o.key instanceof Uint8Array || typeof o.key === "string"); + }, + isAmino(o: any): o is NonExistenceProofAmino { + return o && (o.$typeUrl === NonExistenceProof.typeUrl || o.key instanceof Uint8Array || typeof o.key === "string"); + }, encode(message: NonExistenceProof, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.key.length !== 0) { writer.uint32(10).bytes(message.key); @@ -1156,6 +1182,12 @@ export const NonExistenceProof = { typeUrl: "/ics23.NonExistenceProof", value: NonExistenceProof.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(NonExistenceProof.typeUrl)) { + return; + } + ExistenceProof.registerTypeUrl(); } }; function createBaseCommitmentProof(): CommitmentProof { @@ -1174,6 +1206,15 @@ function createBaseCommitmentProof(): CommitmentProof { */ export const CommitmentProof = { typeUrl: "/ics23.CommitmentProof", + is(o: any): o is CommitmentProof { + return o && o.$typeUrl === CommitmentProof.typeUrl; + }, + isSDK(o: any): o is CommitmentProofSDKType { + return o && o.$typeUrl === CommitmentProof.typeUrl; + }, + isAmino(o: any): o is CommitmentProofAmino { + return o && o.$typeUrl === CommitmentProof.typeUrl; + }, encode(message: CommitmentProof, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.exist !== undefined) { ExistenceProof.encode(message.exist, writer.uint32(10).fork()).ldelim(); @@ -1290,6 +1331,15 @@ export const CommitmentProof = { typeUrl: "/ics23.CommitmentProof", value: CommitmentProof.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(CommitmentProof.typeUrl)) { + return; + } + ExistenceProof.registerTypeUrl(); + NonExistenceProof.registerTypeUrl(); + BatchProof.registerTypeUrl(); + CompressedBatchProof.registerTypeUrl(); } }; function createBaseLeafOp(): LeafOp { @@ -1322,6 +1372,15 @@ function createBaseLeafOp(): LeafOp { */ export const LeafOp = { typeUrl: "/ics23.LeafOp", + is(o: any): o is LeafOp { + return o && (o.$typeUrl === LeafOp.typeUrl || isSet(o.hash) && isSet(o.prehashKey) && isSet(o.prehashValue) && isSet(o.length) && (o.prefix instanceof Uint8Array || typeof o.prefix === "string")); + }, + isSDK(o: any): o is LeafOpSDKType { + return o && (o.$typeUrl === LeafOp.typeUrl || isSet(o.hash) && isSet(o.prehash_key) && isSet(o.prehash_value) && isSet(o.length) && (o.prefix instanceof Uint8Array || typeof o.prefix === "string")); + }, + isAmino(o: any): o is LeafOpAmino { + return o && (o.$typeUrl === LeafOp.typeUrl || isSet(o.hash) && isSet(o.prehash_key) && isSet(o.prehash_value) && isSet(o.length) && (o.prefix instanceof Uint8Array || typeof o.prefix === "string")); + }, encode(message: LeafOp, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.hash !== 0) { writer.uint32(8).int32(message.hash); @@ -1444,7 +1503,8 @@ export const LeafOp = { typeUrl: "/ics23.LeafOp", value: LeafOp.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseInnerOp(): InnerOp { return { @@ -1475,6 +1535,15 @@ function createBaseInnerOp(): InnerOp { */ export const InnerOp = { typeUrl: "/ics23.InnerOp", + is(o: any): o is InnerOp { + return o && (o.$typeUrl === InnerOp.typeUrl || isSet(o.hash) && (o.prefix instanceof Uint8Array || typeof o.prefix === "string") && (o.suffix instanceof Uint8Array || typeof o.suffix === "string")); + }, + isSDK(o: any): o is InnerOpSDKType { + return o && (o.$typeUrl === InnerOp.typeUrl || isSet(o.hash) && (o.prefix instanceof Uint8Array || typeof o.prefix === "string") && (o.suffix instanceof Uint8Array || typeof o.suffix === "string")); + }, + isAmino(o: any): o is InnerOpAmino { + return o && (o.$typeUrl === InnerOp.typeUrl || isSet(o.hash) && (o.prefix instanceof Uint8Array || typeof o.prefix === "string") && (o.suffix instanceof Uint8Array || typeof o.suffix === "string")); + }, encode(message: InnerOp, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.hash !== 0) { writer.uint32(8).int32(message.hash); @@ -1569,7 +1638,8 @@ export const InnerOp = { typeUrl: "/ics23.InnerOp", value: InnerOp.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseProofSpec(): ProofSpec { return { @@ -1596,6 +1666,15 @@ function createBaseProofSpec(): ProofSpec { */ export const ProofSpec = { typeUrl: "/ics23.ProofSpec", + is(o: any): o is ProofSpec { + return o && (o.$typeUrl === ProofSpec.typeUrl || typeof o.maxDepth === "number" && typeof o.minDepth === "number"); + }, + isSDK(o: any): o is ProofSpecSDKType { + return o && (o.$typeUrl === ProofSpec.typeUrl || typeof o.max_depth === "number" && typeof o.min_depth === "number"); + }, + isAmino(o: any): o is ProofSpecAmino { + return o && (o.$typeUrl === ProofSpec.typeUrl || typeof o.max_depth === "number" && typeof o.min_depth === "number"); + }, encode(message: ProofSpec, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.leafSpec !== undefined) { LeafOp.encode(message.leafSpec, writer.uint32(10).fork()).ldelim(); @@ -1708,6 +1787,13 @@ export const ProofSpec = { typeUrl: "/ics23.ProofSpec", value: ProofSpec.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ProofSpec.typeUrl)) { + return; + } + LeafOp.registerTypeUrl(); + InnerSpec.registerTypeUrl(); } }; function createBaseInnerSpec(): InnerSpec { @@ -1735,6 +1821,15 @@ function createBaseInnerSpec(): InnerSpec { */ export const InnerSpec = { typeUrl: "/ics23.InnerSpec", + is(o: any): o is InnerSpec { + return o && (o.$typeUrl === InnerSpec.typeUrl || Array.isArray(o.childOrder) && (!o.childOrder.length || typeof o.childOrder[0] === "number") && typeof o.childSize === "number" && typeof o.minPrefixLength === "number" && typeof o.maxPrefixLength === "number" && (o.emptyChild instanceof Uint8Array || typeof o.emptyChild === "string") && isSet(o.hash)); + }, + isSDK(o: any): o is InnerSpecSDKType { + return o && (o.$typeUrl === InnerSpec.typeUrl || Array.isArray(o.child_order) && (!o.child_order.length || typeof o.child_order[0] === "number") && typeof o.child_size === "number" && typeof o.min_prefix_length === "number" && typeof o.max_prefix_length === "number" && (o.empty_child instanceof Uint8Array || typeof o.empty_child === "string") && isSet(o.hash)); + }, + isAmino(o: any): o is InnerSpecAmino { + return o && (o.$typeUrl === InnerSpec.typeUrl || Array.isArray(o.child_order) && (!o.child_order.length || typeof o.child_order[0] === "number") && typeof o.child_size === "number" && typeof o.min_prefix_length === "number" && typeof o.max_prefix_length === "number" && (o.empty_child instanceof Uint8Array || typeof o.empty_child === "string") && isSet(o.hash)); + }, encode(message: InnerSpec, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { writer.uint32(10).fork(); for (const v of message.childOrder) { @@ -1886,7 +1981,8 @@ export const InnerSpec = { typeUrl: "/ics23.InnerSpec", value: InnerSpec.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseBatchProof(): BatchProof { return { @@ -1901,6 +1997,15 @@ function createBaseBatchProof(): BatchProof { */ export const BatchProof = { typeUrl: "/ics23.BatchProof", + is(o: any): o is BatchProof { + return o && (o.$typeUrl === BatchProof.typeUrl || Array.isArray(o.entries) && (!o.entries.length || BatchEntry.is(o.entries[0]))); + }, + isSDK(o: any): o is BatchProofSDKType { + return o && (o.$typeUrl === BatchProof.typeUrl || Array.isArray(o.entries) && (!o.entries.length || BatchEntry.isSDK(o.entries[0]))); + }, + isAmino(o: any): o is BatchProofAmino { + return o && (o.$typeUrl === BatchProof.typeUrl || Array.isArray(o.entries) && (!o.entries.length || BatchEntry.isAmino(o.entries[0]))); + }, encode(message: BatchProof, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.entries) { BatchEntry.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -1973,6 +2078,12 @@ export const BatchProof = { typeUrl: "/ics23.BatchProof", value: BatchProof.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(BatchProof.typeUrl)) { + return; + } + BatchEntry.registerTypeUrl(); } }; function createBaseBatchEntry(): BatchEntry { @@ -1989,6 +2100,15 @@ function createBaseBatchEntry(): BatchEntry { */ export const BatchEntry = { typeUrl: "/ics23.BatchEntry", + is(o: any): o is BatchEntry { + return o && o.$typeUrl === BatchEntry.typeUrl; + }, + isSDK(o: any): o is BatchEntrySDKType { + return o && o.$typeUrl === BatchEntry.typeUrl; + }, + isAmino(o: any): o is BatchEntryAmino { + return o && o.$typeUrl === BatchEntry.typeUrl; + }, encode(message: BatchEntry, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.exist !== undefined) { ExistenceProof.encode(message.exist, writer.uint32(10).fork()).ldelim(); @@ -2073,6 +2193,13 @@ export const BatchEntry = { typeUrl: "/ics23.BatchEntry", value: BatchEntry.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(BatchEntry.typeUrl)) { + return; + } + ExistenceProof.registerTypeUrl(); + NonExistenceProof.registerTypeUrl(); } }; function createBaseCompressedBatchProof(): CompressedBatchProof { @@ -2088,6 +2215,15 @@ function createBaseCompressedBatchProof(): CompressedBatchProof { */ export const CompressedBatchProof = { typeUrl: "/ics23.CompressedBatchProof", + is(o: any): o is CompressedBatchProof { + return o && (o.$typeUrl === CompressedBatchProof.typeUrl || Array.isArray(o.entries) && (!o.entries.length || CompressedBatchEntry.is(o.entries[0])) && Array.isArray(o.lookupInners) && (!o.lookupInners.length || InnerOp.is(o.lookupInners[0]))); + }, + isSDK(o: any): o is CompressedBatchProofSDKType { + return o && (o.$typeUrl === CompressedBatchProof.typeUrl || Array.isArray(o.entries) && (!o.entries.length || CompressedBatchEntry.isSDK(o.entries[0])) && Array.isArray(o.lookup_inners) && (!o.lookup_inners.length || InnerOp.isSDK(o.lookup_inners[0]))); + }, + isAmino(o: any): o is CompressedBatchProofAmino { + return o && (o.$typeUrl === CompressedBatchProof.typeUrl || Array.isArray(o.entries) && (!o.entries.length || CompressedBatchEntry.isAmino(o.entries[0])) && Array.isArray(o.lookup_inners) && (!o.lookup_inners.length || InnerOp.isAmino(o.lookup_inners[0]))); + }, encode(message: CompressedBatchProof, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.entries) { CompressedBatchEntry.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -2180,6 +2316,13 @@ export const CompressedBatchProof = { typeUrl: "/ics23.CompressedBatchProof", value: CompressedBatchProof.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(CompressedBatchProof.typeUrl)) { + return; + } + CompressedBatchEntry.registerTypeUrl(); + InnerOp.registerTypeUrl(); } }; function createBaseCompressedBatchEntry(): CompressedBatchEntry { @@ -2196,6 +2339,15 @@ function createBaseCompressedBatchEntry(): CompressedBatchEntry { */ export const CompressedBatchEntry = { typeUrl: "/ics23.CompressedBatchEntry", + is(o: any): o is CompressedBatchEntry { + return o && o.$typeUrl === CompressedBatchEntry.typeUrl; + }, + isSDK(o: any): o is CompressedBatchEntrySDKType { + return o && o.$typeUrl === CompressedBatchEntry.typeUrl; + }, + isAmino(o: any): o is CompressedBatchEntryAmino { + return o && o.$typeUrl === CompressedBatchEntry.typeUrl; + }, encode(message: CompressedBatchEntry, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.exist !== undefined) { CompressedExistenceProof.encode(message.exist, writer.uint32(10).fork()).ldelim(); @@ -2280,6 +2432,13 @@ export const CompressedBatchEntry = { typeUrl: "/ics23.CompressedBatchEntry", value: CompressedBatchEntry.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(CompressedBatchEntry.typeUrl)) { + return; + } + CompressedExistenceProof.registerTypeUrl(); + CompressedNonExistenceProof.registerTypeUrl(); } }; function createBaseCompressedExistenceProof(): CompressedExistenceProof { @@ -2297,6 +2456,15 @@ function createBaseCompressedExistenceProof(): CompressedExistenceProof { */ export const CompressedExistenceProof = { typeUrl: "/ics23.CompressedExistenceProof", + is(o: any): o is CompressedExistenceProof { + return o && (o.$typeUrl === CompressedExistenceProof.typeUrl || (o.key instanceof Uint8Array || typeof o.key === "string") && (o.value instanceof Uint8Array || typeof o.value === "string") && Array.isArray(o.path) && (!o.path.length || typeof o.path[0] === "number")); + }, + isSDK(o: any): o is CompressedExistenceProofSDKType { + return o && (o.$typeUrl === CompressedExistenceProof.typeUrl || (o.key instanceof Uint8Array || typeof o.key === "string") && (o.value instanceof Uint8Array || typeof o.value === "string") && Array.isArray(o.path) && (!o.path.length || typeof o.path[0] === "number")); + }, + isAmino(o: any): o is CompressedExistenceProofAmino { + return o && (o.$typeUrl === CompressedExistenceProof.typeUrl || (o.key instanceof Uint8Array || typeof o.key === "string") && (o.value instanceof Uint8Array || typeof o.value === "string") && Array.isArray(o.path) && (!o.path.length || typeof o.path[0] === "number")); + }, encode(message: CompressedExistenceProof, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.key.length !== 0) { writer.uint32(10).bytes(message.key); @@ -2422,6 +2590,12 @@ export const CompressedExistenceProof = { typeUrl: "/ics23.CompressedExistenceProof", value: CompressedExistenceProof.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(CompressedExistenceProof.typeUrl)) { + return; + } + LeafOp.registerTypeUrl(); } }; function createBaseCompressedNonExistenceProof(): CompressedNonExistenceProof { @@ -2438,6 +2612,15 @@ function createBaseCompressedNonExistenceProof(): CompressedNonExistenceProof { */ export const CompressedNonExistenceProof = { typeUrl: "/ics23.CompressedNonExistenceProof", + is(o: any): o is CompressedNonExistenceProof { + return o && (o.$typeUrl === CompressedNonExistenceProof.typeUrl || o.key instanceof Uint8Array || typeof o.key === "string"); + }, + isSDK(o: any): o is CompressedNonExistenceProofSDKType { + return o && (o.$typeUrl === CompressedNonExistenceProof.typeUrl || o.key instanceof Uint8Array || typeof o.key === "string"); + }, + isAmino(o: any): o is CompressedNonExistenceProofAmino { + return o && (o.$typeUrl === CompressedNonExistenceProof.typeUrl || o.key instanceof Uint8Array || typeof o.key === "string"); + }, encode(message: CompressedNonExistenceProof, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.key.length !== 0) { writer.uint32(10).bytes(message.key); @@ -2536,5 +2719,11 @@ export const CompressedNonExistenceProof = { typeUrl: "/ics23.CompressedNonExistenceProof", value: CompressedNonExistenceProof.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(CompressedNonExistenceProof.typeUrl)) { + return; + } + CompressedExistenceProof.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/cosmos/app/v1alpha1/config.ts b/__fixtures__/v-next/outputv3/cosmos/app/v1alpha1/config.ts index 1859039f6d..1afe224e96 100644 --- a/__fixtures__/v-next/outputv3/cosmos/app/v1alpha1/config.ts +++ b/__fixtures__/v-next/outputv3/cosmos/app/v1alpha1/config.ts @@ -1,6 +1,7 @@ import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../google/protobuf/any"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { DeepPartial, isSet } from "../../../helpers"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "cosmos.app.v1alpha1"; /** * Config represents the configuration for a Cosmos SDK ABCI app. @@ -143,6 +144,15 @@ function createBaseConfig(): Config { export const Config = { typeUrl: "/cosmos.app.v1alpha1.Config", aminoType: "cosmos-sdk/Config", + is(o: any): o is Config { + return o && (o.$typeUrl === Config.typeUrl || Array.isArray(o.modules) && (!o.modules.length || ModuleConfig.is(o.modules[0]))); + }, + isSDK(o: any): o is ConfigSDKType { + return o && (o.$typeUrl === Config.typeUrl || Array.isArray(o.modules) && (!o.modules.length || ModuleConfig.isSDK(o.modules[0]))); + }, + isAmino(o: any): o is ConfigAmino { + return o && (o.$typeUrl === Config.typeUrl || Array.isArray(o.modules) && (!o.modules.length || ModuleConfig.isAmino(o.modules[0]))); + }, encode(message: Config, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.modules) { ModuleConfig.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -215,6 +225,12 @@ export const Config = { typeUrl: "/cosmos.app.v1alpha1.Config", value: Config.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Config.typeUrl)) { + return; + } + ModuleConfig.registerTypeUrl(); } }; function createBaseModuleConfig(): ModuleConfig { @@ -232,6 +248,15 @@ function createBaseModuleConfig(): ModuleConfig { export const ModuleConfig = { typeUrl: "/cosmos.app.v1alpha1.ModuleConfig", aminoType: "cosmos-sdk/ModuleConfig", + is(o: any): o is ModuleConfig { + return o && (o.$typeUrl === ModuleConfig.typeUrl || typeof o.name === "string"); + }, + isSDK(o: any): o is ModuleConfigSDKType { + return o && (o.$typeUrl === ModuleConfig.typeUrl || typeof o.name === "string"); + }, + isAmino(o: any): o is ModuleConfigAmino { + return o && (o.$typeUrl === ModuleConfig.typeUrl || typeof o.name === "string"); + }, encode(message: ModuleConfig, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -314,5 +339,6 @@ export const ModuleConfig = { typeUrl: "/cosmos.app.v1alpha1.ModuleConfig", value: ModuleConfig.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/cosmos/app/v1alpha1/module.ts b/__fixtures__/v-next/outputv3/cosmos/app/v1alpha1/module.ts index 4e5e55e971..8188b08dda 100644 --- a/__fixtures__/v-next/outputv3/cosmos/app/v1alpha1/module.ts +++ b/__fixtures__/v-next/outputv3/cosmos/app/v1alpha1/module.ts @@ -1,5 +1,6 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; import { isSet, DeepPartial } from "../../../helpers"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "cosmos.app.v1alpha1"; /** * ModuleDescriptor describes an app module. @@ -254,6 +255,15 @@ function createBaseModuleDescriptor(): ModuleDescriptor { export const ModuleDescriptor = { typeUrl: "/cosmos.app.v1alpha1.ModuleDescriptor", aminoType: "cosmos-sdk/ModuleDescriptor", + is(o: any): o is ModuleDescriptor { + return o && (o.$typeUrl === ModuleDescriptor.typeUrl || typeof o.goImport === "string" && Array.isArray(o.usePackage) && (!o.usePackage.length || PackageReference.is(o.usePackage[0])) && Array.isArray(o.canMigrateFrom) && (!o.canMigrateFrom.length || MigrateFromInfo.is(o.canMigrateFrom[0]))); + }, + isSDK(o: any): o is ModuleDescriptorSDKType { + return o && (o.$typeUrl === ModuleDescriptor.typeUrl || typeof o.go_import === "string" && Array.isArray(o.use_package) && (!o.use_package.length || PackageReference.isSDK(o.use_package[0])) && Array.isArray(o.can_migrate_from) && (!o.can_migrate_from.length || MigrateFromInfo.isSDK(o.can_migrate_from[0]))); + }, + isAmino(o: any): o is ModuleDescriptorAmino { + return o && (o.$typeUrl === ModuleDescriptor.typeUrl || typeof o.go_import === "string" && Array.isArray(o.use_package) && (!o.use_package.length || PackageReference.isAmino(o.use_package[0])) && Array.isArray(o.can_migrate_from) && (!o.can_migrate_from.length || MigrateFromInfo.isAmino(o.can_migrate_from[0]))); + }, encode(message: ModuleDescriptor, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.goImport !== "") { writer.uint32(10).string(message.goImport); @@ -360,6 +370,13 @@ export const ModuleDescriptor = { typeUrl: "/cosmos.app.v1alpha1.ModuleDescriptor", value: ModuleDescriptor.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ModuleDescriptor.typeUrl)) { + return; + } + PackageReference.registerTypeUrl(); + MigrateFromInfo.registerTypeUrl(); } }; function createBasePackageReference(): PackageReference { @@ -377,6 +394,15 @@ function createBasePackageReference(): PackageReference { export const PackageReference = { typeUrl: "/cosmos.app.v1alpha1.PackageReference", aminoType: "cosmos-sdk/PackageReference", + is(o: any): o is PackageReference { + return o && (o.$typeUrl === PackageReference.typeUrl || typeof o.name === "string" && typeof o.revision === "number"); + }, + isSDK(o: any): o is PackageReferenceSDKType { + return o && (o.$typeUrl === PackageReference.typeUrl || typeof o.name === "string" && typeof o.revision === "number"); + }, + isAmino(o: any): o is PackageReferenceAmino { + return o && (o.$typeUrl === PackageReference.typeUrl || typeof o.name === "string" && typeof o.revision === "number"); + }, encode(message: PackageReference, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -457,7 +483,8 @@ export const PackageReference = { typeUrl: "/cosmos.app.v1alpha1.PackageReference", value: PackageReference.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMigrateFromInfo(): MigrateFromInfo { return { @@ -474,6 +501,15 @@ function createBaseMigrateFromInfo(): MigrateFromInfo { export const MigrateFromInfo = { typeUrl: "/cosmos.app.v1alpha1.MigrateFromInfo", aminoType: "cosmos-sdk/MigrateFromInfo", + is(o: any): o is MigrateFromInfo { + return o && (o.$typeUrl === MigrateFromInfo.typeUrl || typeof o.module === "string"); + }, + isSDK(o: any): o is MigrateFromInfoSDKType { + return o && (o.$typeUrl === MigrateFromInfo.typeUrl || typeof o.module === "string"); + }, + isAmino(o: any): o is MigrateFromInfoAmino { + return o && (o.$typeUrl === MigrateFromInfo.typeUrl || typeof o.module === "string"); + }, encode(message: MigrateFromInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.module !== "") { writer.uint32(10).string(message.module); @@ -540,5 +576,6 @@ export const MigrateFromInfo = { typeUrl: "/cosmos.app.v1alpha1.MigrateFromInfo", value: MigrateFromInfo.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/cosmos/app/v1alpha1/query.rpc.func.ts b/__fixtures__/v-next/outputv3/cosmos/app/v1alpha1/query.rpc.func.ts new file mode 100644 index 0000000000..9734ddc631 --- /dev/null +++ b/__fixtures__/v-next/outputv3/cosmos/app/v1alpha1/query.rpc.func.ts @@ -0,0 +1,16 @@ +import { Config, ConfigSDKType } from "./config"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { QueryConfigRequest, QueryConfigRequestSDKType, QueryConfigResponse, QueryConfigResponseSDKType } from "./query"; +/** + * Config returns the current app config. + * @name getConfig + * @package cosmos.app.v1alpha1 + * @see proto service: cosmos.app.v1alpha1.Config + */ +export const getConfig = buildQuery({ + encode: QueryConfigRequest.encode, + decode: QueryConfigResponse.decode, + service: "cosmos.app.v1alpha1.Query", + method: "Config", + deps: [QueryConfigRequest, QueryConfigResponse] +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/cosmos/app/v1alpha1/query.ts b/__fixtures__/v-next/outputv3/cosmos/app/v1alpha1/query.ts index e1cb2eb88c..f84dda87fb 100644 --- a/__fixtures__/v-next/outputv3/cosmos/app/v1alpha1/query.ts +++ b/__fixtures__/v-next/outputv3/cosmos/app/v1alpha1/query.ts @@ -1,6 +1,7 @@ import { Config, ConfigAmino, ConfigSDKType } from "./config"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { DeepPartial, isSet } from "../../../helpers"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "cosmos.app.v1alpha1"; /** * QueryConfigRequest is the Query/Config request type. @@ -76,6 +77,15 @@ function createBaseQueryConfigRequest(): QueryConfigRequest { export const QueryConfigRequest = { typeUrl: "/cosmos.app.v1alpha1.QueryConfigRequest", aminoType: "cosmos-sdk/QueryConfigRequest", + is(o: any): o is QueryConfigRequest { + return o && o.$typeUrl === QueryConfigRequest.typeUrl; + }, + isSDK(o: any): o is QueryConfigRequestSDKType { + return o && o.$typeUrl === QueryConfigRequest.typeUrl; + }, + isAmino(o: any): o is QueryConfigRequestAmino { + return o && o.$typeUrl === QueryConfigRequest.typeUrl; + }, encode(_: QueryConfigRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -127,7 +137,8 @@ export const QueryConfigRequest = { typeUrl: "/cosmos.app.v1alpha1.QueryConfigRequest", value: QueryConfigRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryConfigResponse(): QueryConfigResponse { return { @@ -143,6 +154,15 @@ function createBaseQueryConfigResponse(): QueryConfigResponse { export const QueryConfigResponse = { typeUrl: "/cosmos.app.v1alpha1.QueryConfigResponse", aminoType: "cosmos-sdk/QueryConfigResponse", + is(o: any): o is QueryConfigResponse { + return o && o.$typeUrl === QueryConfigResponse.typeUrl; + }, + isSDK(o: any): o is QueryConfigResponseSDKType { + return o && o.$typeUrl === QueryConfigResponse.typeUrl; + }, + isAmino(o: any): o is QueryConfigResponseAmino { + return o && o.$typeUrl === QueryConfigResponse.typeUrl; + }, encode(message: QueryConfigResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.config !== undefined) { Config.encode(message.config, writer.uint32(10).fork()).ldelim(); @@ -211,5 +231,11 @@ export const QueryConfigResponse = { typeUrl: "/cosmos.app.v1alpha1.QueryConfigResponse", value: QueryConfigResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryConfigResponse.typeUrl)) { + return; + } + Config.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/cosmos/auth/v1beta1/auth.ts b/__fixtures__/v-next/outputv3/cosmos/auth/v1beta1/auth.ts index 1e16fe487a..ef867de84f 100644 --- a/__fixtures__/v-next/outputv3/cosmos/auth/v1beta1/auth.ts +++ b/__fixtures__/v-next/outputv3/cosmos/auth/v1beta1/auth.ts @@ -1,5 +1,6 @@ import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../google/protobuf/any"; import { BinaryReader, BinaryWriter } from "../../../binary"; +import { GlobalDecoderRegistry } from "../../../registry"; import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "cosmos.auth.v1beta1"; /** @@ -152,6 +153,15 @@ function createBaseBaseAccount(): BaseAccount { export const BaseAccount = { typeUrl: "/cosmos.auth.v1beta1.BaseAccount", aminoType: "cosmos-sdk/BaseAccount", + is(o: any): o is BaseAccount { + return o && (o.$typeUrl === BaseAccount.typeUrl || typeof o.address === "string" && typeof o.accountNumber === "bigint" && typeof o.sequence === "bigint"); + }, + isSDK(o: any): o is BaseAccountSDKType { + return o && (o.$typeUrl === BaseAccount.typeUrl || typeof o.address === "string" && typeof o.account_number === "bigint" && typeof o.sequence === "bigint"); + }, + isAmino(o: any): o is BaseAccountAmino { + return o && (o.$typeUrl === BaseAccount.typeUrl || typeof o.address === "string" && typeof o.account_number === "bigint" && typeof o.sequence === "bigint"); + }, encode(message: BaseAccount, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.address !== "") { writer.uint32(10).string(message.address); @@ -266,6 +276,13 @@ export const BaseAccount = { typeUrl: "/cosmos.auth.v1beta1.BaseAccount", value: BaseAccount.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(BaseAccount.typeUrl)) { + return; + } + GlobalDecoderRegistry.register(BaseAccount.typeUrl, BaseAccount); + GlobalDecoderRegistry.registerAminoProtoMapping(BaseAccount.aminoType, BaseAccount.typeUrl); } }; function createBaseModuleAccount(): ModuleAccount { @@ -285,6 +302,15 @@ function createBaseModuleAccount(): ModuleAccount { export const ModuleAccount = { typeUrl: "/cosmos.auth.v1beta1.ModuleAccount", aminoType: "cosmos-sdk/ModuleAccount", + is(o: any): o is ModuleAccount { + return o && (o.$typeUrl === ModuleAccount.typeUrl || typeof o.name === "string" && Array.isArray(o.permissions) && (!o.permissions.length || typeof o.permissions[0] === "string")); + }, + isSDK(o: any): o is ModuleAccountSDKType { + return o && (o.$typeUrl === ModuleAccount.typeUrl || typeof o.name === "string" && Array.isArray(o.permissions) && (!o.permissions.length || typeof o.permissions[0] === "string")); + }, + isAmino(o: any): o is ModuleAccountAmino { + return o && (o.$typeUrl === ModuleAccount.typeUrl || typeof o.name === "string" && Array.isArray(o.permissions) && (!o.permissions.length || typeof o.permissions[0] === "string")); + }, encode(message: ModuleAccount, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.baseAccount !== undefined) { BaseAccount.encode(message.baseAccount, writer.uint32(10).fork()).ldelim(); @@ -387,6 +413,14 @@ export const ModuleAccount = { typeUrl: "/cosmos.auth.v1beta1.ModuleAccount", value: ModuleAccount.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ModuleAccount.typeUrl)) { + return; + } + GlobalDecoderRegistry.register(ModuleAccount.typeUrl, ModuleAccount); + GlobalDecoderRegistry.registerAminoProtoMapping(ModuleAccount.aminoType, ModuleAccount.typeUrl); + BaseAccount.registerTypeUrl(); } }; function createBaseParams(): Params { @@ -407,6 +441,15 @@ function createBaseParams(): Params { export const Params = { typeUrl: "/cosmos.auth.v1beta1.Params", aminoType: "cosmos-sdk/Params", + is(o: any): o is Params { + return o && (o.$typeUrl === Params.typeUrl || typeof o.maxMemoCharacters === "bigint" && typeof o.txSigLimit === "bigint" && typeof o.txSizeCostPerByte === "bigint" && typeof o.sigVerifyCostEd25519 === "bigint" && typeof o.sigVerifyCostSecp256k1 === "bigint"); + }, + isSDK(o: any): o is ParamsSDKType { + return o && (o.$typeUrl === Params.typeUrl || typeof o.max_memo_characters === "bigint" && typeof o.tx_sig_limit === "bigint" && typeof o.tx_size_cost_per_byte === "bigint" && typeof o.sig_verify_cost_ed25519 === "bigint" && typeof o.sig_verify_cost_secp256k1 === "bigint"); + }, + isAmino(o: any): o is ParamsAmino { + return o && (o.$typeUrl === Params.typeUrl || typeof o.max_memo_characters === "bigint" && typeof o.tx_sig_limit === "bigint" && typeof o.tx_size_cost_per_byte === "bigint" && typeof o.sig_verify_cost_ed25519 === "bigint" && typeof o.sig_verify_cost_secp256k1 === "bigint"); + }, encode(message: Params, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.maxMemoCharacters !== BigInt(0)) { writer.uint32(8).uint64(message.maxMemoCharacters); @@ -539,5 +582,6 @@ export const Params = { typeUrl: "/cosmos.auth.v1beta1.Params", value: Params.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/cosmos/auth/v1beta1/genesis.ts b/__fixtures__/v-next/outputv3/cosmos/auth/v1beta1/genesis.ts index 8f7b0cb503..fabe20cb69 100644 --- a/__fixtures__/v-next/outputv3/cosmos/auth/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv3/cosmos/auth/v1beta1/genesis.ts @@ -1,6 +1,7 @@ import { Params, ParamsAmino, ParamsSDKType } from "./auth"; import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../google/protobuf/any"; import { BinaryReader, BinaryWriter } from "../../../binary"; +import { GlobalDecoderRegistry } from "../../../registry"; import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "cosmos.auth.v1beta1"; /** @@ -64,6 +65,15 @@ function createBaseGenesisState(): GenesisState { export const GenesisState = { typeUrl: "/cosmos.auth.v1beta1.GenesisState", aminoType: "cosmos-sdk/GenesisState", + is(o: any): o is GenesisState { + return o && (o.$typeUrl === GenesisState.typeUrl || Params.is(o.params) && Array.isArray(o.accounts) && (!o.accounts.length || Any.is(o.accounts[0]))); + }, + isSDK(o: any): o is GenesisStateSDKType { + return o && (o.$typeUrl === GenesisState.typeUrl || Params.isSDK(o.params) && Array.isArray(o.accounts) && (!o.accounts.length || Any.isSDK(o.accounts[0]))); + }, + isAmino(o: any): o is GenesisStateAmino { + return o && (o.$typeUrl === GenesisState.typeUrl || Params.isAmino(o.params) && Array.isArray(o.accounts) && (!o.accounts.length || Any.isAmino(o.accounts[0]))); + }, encode(message: GenesisState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.params !== undefined) { Params.encode(message.params, writer.uint32(10).fork()).ldelim(); @@ -152,5 +162,6 @@ export const GenesisState = { typeUrl: "/cosmos.auth.v1beta1.GenesisState", value: GenesisState.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/cosmos/auth/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputv3/cosmos/auth/v1beta1/query.rpc.func.ts new file mode 100644 index 0000000000..c43d4aa8a6 --- /dev/null +++ b/__fixtures__/v-next/outputv3/cosmos/auth/v1beta1/query.rpc.func.ts @@ -0,0 +1,98 @@ +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; +import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../google/protobuf/any"; +import { Params, ParamsSDKType, BaseAccount, BaseAccountSDKType, ModuleAccount, ModuleAccountSDKType } from "./auth"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { QueryAccountsRequest, QueryAccountsRequestSDKType, QueryAccountsResponse, QueryAccountsResponseSDKType, QueryAccountRequest, QueryAccountRequestSDKType, QueryAccountResponse, QueryAccountResponseSDKType, QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, QueryModuleAccountsRequest, QueryModuleAccountsRequestSDKType, QueryModuleAccountsResponse, QueryModuleAccountsResponseSDKType, Bech32PrefixRequest, Bech32PrefixRequestSDKType, Bech32PrefixResponse, Bech32PrefixResponseSDKType, AddressBytesToStringRequest, AddressBytesToStringRequestSDKType, AddressBytesToStringResponse, AddressBytesToStringResponseSDKType, AddressStringToBytesRequest, AddressStringToBytesRequestSDKType, AddressStringToBytesResponse, AddressStringToBytesResponseSDKType } from "./query"; +/** + * Accounts returns all the existing accounts + * + * Since: cosmos-sdk 0.43 + * @name getAccounts + * @package cosmos.auth.v1beta1 + * @see proto service: cosmos.auth.v1beta1.Accounts + */ +export const getAccounts = buildQuery({ + encode: QueryAccountsRequest.encode, + decode: QueryAccountsResponse.decode, + service: "cosmos.auth.v1beta1.Query", + method: "Accounts", + deps: [QueryAccountsRequest, QueryAccountsResponse] +}); +/** + * Account returns account details based on address. + * @name getAccount + * @package cosmos.auth.v1beta1 + * @see proto service: cosmos.auth.v1beta1.Account + */ +export const getAccount = buildQuery({ + encode: QueryAccountRequest.encode, + decode: QueryAccountResponse.decode, + service: "cosmos.auth.v1beta1.Query", + method: "Account", + deps: [QueryAccountRequest, QueryAccountResponse] +}); +/** + * Params queries all parameters. + * @name getParams + * @package cosmos.auth.v1beta1 + * @see proto service: cosmos.auth.v1beta1.Params + */ +export const getParams = buildQuery({ + encode: QueryParamsRequest.encode, + decode: QueryParamsResponse.decode, + service: "cosmos.auth.v1beta1.Query", + method: "Params", + deps: [QueryParamsRequest, QueryParamsResponse] +}); +/** + * ModuleAccounts returns all the existing module accounts. + * @name getModuleAccounts + * @package cosmos.auth.v1beta1 + * @see proto service: cosmos.auth.v1beta1.ModuleAccounts + */ +export const getModuleAccounts = buildQuery({ + encode: QueryModuleAccountsRequest.encode, + decode: QueryModuleAccountsResponse.decode, + service: "cosmos.auth.v1beta1.Query", + method: "ModuleAccounts", + deps: [QueryModuleAccountsRequest, QueryModuleAccountsResponse] +}); +/** + * Bech32 queries bech32Prefix + * @name getBech32Prefix + * @package cosmos.auth.v1beta1 + * @see proto service: cosmos.auth.v1beta1.Bech32Prefix + */ +export const getBech32Prefix = buildQuery({ + encode: Bech32PrefixRequest.encode, + decode: Bech32PrefixResponse.decode, + service: "cosmos.auth.v1beta1.Query", + method: "Bech32Prefix", + deps: [Bech32PrefixRequest, Bech32PrefixResponse] +}); +/** + * AddressBytesToString converts Account Address bytes to string + * @name getAddressBytesToString + * @package cosmos.auth.v1beta1 + * @see proto service: cosmos.auth.v1beta1.AddressBytesToString + */ +export const getAddressBytesToString = buildQuery({ + encode: AddressBytesToStringRequest.encode, + decode: AddressBytesToStringResponse.decode, + service: "cosmos.auth.v1beta1.Query", + method: "AddressBytesToString", + deps: [AddressBytesToStringRequest, AddressBytesToStringResponse] +}); +/** + * AddressStringToBytes converts Address string to bytes + * @name getAddressStringToBytes + * @package cosmos.auth.v1beta1 + * @see proto service: cosmos.auth.v1beta1.AddressStringToBytes + */ +export const getAddressStringToBytes = buildQuery({ + encode: AddressStringToBytesRequest.encode, + decode: AddressStringToBytesResponse.decode, + service: "cosmos.auth.v1beta1.Query", + method: "AddressStringToBytes", + deps: [AddressStringToBytesRequest, AddressStringToBytesResponse] +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/cosmos/auth/v1beta1/query.ts b/__fixtures__/v-next/outputv3/cosmos/auth/v1beta1/query.ts index 6ae08aac26..06d98f5d15 100644 --- a/__fixtures__/v-next/outputv3/cosmos/auth/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv3/cosmos/auth/v1beta1/query.ts @@ -2,6 +2,7 @@ import { PageRequest, PageRequestAmino, PageRequestSDKType, PageResponse, PageRe import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../google/protobuf/any"; import { Params, ParamsAmino, ParamsSDKType, BaseAccount, BaseAccountProtoMsg, BaseAccountSDKType, ModuleAccount, ModuleAccountProtoMsg, ModuleAccountSDKType } from "./auth"; import { BinaryReader, BinaryWriter } from "../../../binary"; +import { GlobalDecoderRegistry } from "../../../registry"; import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../helpers"; export const protobufPackage = "cosmos.auth.v1beta1"; /** @@ -502,6 +503,15 @@ function createBaseQueryAccountsRequest(): QueryAccountsRequest { export const QueryAccountsRequest = { typeUrl: "/cosmos.auth.v1beta1.QueryAccountsRequest", aminoType: "cosmos-sdk/QueryAccountsRequest", + is(o: any): o is QueryAccountsRequest { + return o && o.$typeUrl === QueryAccountsRequest.typeUrl; + }, + isSDK(o: any): o is QueryAccountsRequestSDKType { + return o && o.$typeUrl === QueryAccountsRequest.typeUrl; + }, + isAmino(o: any): o is QueryAccountsRequestAmino { + return o && o.$typeUrl === QueryAccountsRequest.typeUrl; + }, encode(message: QueryAccountsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.pagination !== undefined) { PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); @@ -570,6 +580,12 @@ export const QueryAccountsRequest = { typeUrl: "/cosmos.auth.v1beta1.QueryAccountsRequest", value: QueryAccountsRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryAccountsRequest.typeUrl)) { + return; + } + PageRequest.registerTypeUrl(); } }; function createBaseQueryAccountsResponse(): QueryAccountsResponse { @@ -589,9 +605,18 @@ function createBaseQueryAccountsResponse(): QueryAccountsResponse { export const QueryAccountsResponse = { typeUrl: "/cosmos.auth.v1beta1.QueryAccountsResponse", aminoType: "cosmos-sdk/QueryAccountsResponse", + is(o: any): o is QueryAccountsResponse { + return o && (o.$typeUrl === QueryAccountsResponse.typeUrl || Array.isArray(o.accounts) && (!o.accounts.length || BaseAccount.is(o.accounts[0]) || Any.is(o.accounts[0]))); + }, + isSDK(o: any): o is QueryAccountsResponseSDKType { + return o && (o.$typeUrl === QueryAccountsResponse.typeUrl || Array.isArray(o.accounts) && (!o.accounts.length || BaseAccount.isSDK(o.accounts[0]) || Any.isSDK(o.accounts[0]))); + }, + isAmino(o: any): o is QueryAccountsResponseAmino { + return o && (o.$typeUrl === QueryAccountsResponse.typeUrl || Array.isArray(o.accounts) && (!o.accounts.length || BaseAccount.isAmino(o.accounts[0]) || Any.isAmino(o.accounts[0]))); + }, encode(message: QueryAccountsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.accounts) { - Any.encode((v! as Any), writer.uint32(10).fork()).ldelim(); + Any.encode(GlobalDecoderRegistry.wrapAny(v!), writer.uint32(10).fork()).ldelim(); } if (message.pagination !== undefined) { PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); @@ -606,7 +631,7 @@ export const QueryAccountsResponse = { const tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.accounts.push(useInterfaces ? (AccountI_InterfaceDecoder(reader) as Any) : Any.decode(reader, reader.uint32(), useInterfaces)); + message.accounts.push(GlobalDecoderRegistry.unwrapAny(reader)); break; case 2: message.pagination = PageResponse.decode(reader, reader.uint32(), useInterfaces); @@ -620,13 +645,13 @@ export const QueryAccountsResponse = { }, fromJSON(object: any): QueryAccountsResponse { const obj = createBaseQueryAccountsResponse(); - if (Array.isArray(object?.accounts)) obj.accounts = object.accounts.map((e: any) => Any.fromJSON(e)); + if (Array.isArray(object?.accounts)) obj.accounts = object.accounts.map((e: any) => GlobalDecoderRegistry.fromJSON(e)); if (isSet(object.pagination)) obj.pagination = PageResponse.fromJSON(object.pagination); return obj; }, fromPartial(object: DeepPartial): QueryAccountsResponse { const message = createBaseQueryAccountsResponse(); - message.accounts = object.accounts?.map(e => Any.fromPartial(e)) || []; + message.accounts = object.accounts?.map(e => (GlobalDecoderRegistry.fromPartial(e) as any)) || []; if (object.pagination !== undefined && object.pagination !== null) { message.pagination = PageResponse.fromPartial(object.pagination); } @@ -634,14 +659,14 @@ export const QueryAccountsResponse = { }, fromSDK(object: QueryAccountsResponseSDKType): QueryAccountsResponse { return { - accounts: Array.isArray(object?.accounts) ? object.accounts.map((e: any) => Any.fromSDK(e)) : [], + accounts: Array.isArray(object?.accounts) ? object.accounts.map((e: any) => GlobalDecoderRegistry.fromSDK(e)) : [], pagination: object.pagination ? PageResponse.fromSDK(object.pagination) : undefined }; }, toSDK(message: QueryAccountsResponse): QueryAccountsResponseSDKType { const obj: any = {}; if (message.accounts) { - obj.accounts = message.accounts.map(e => e ? Any.toSDK(e) : undefined); + obj.accounts = message.accounts.map(e => e ? GlobalDecoderRegistry.toSDK(e) : undefined); } else { obj.accounts = []; } @@ -650,7 +675,7 @@ export const QueryAccountsResponse = { }, fromAmino(object: QueryAccountsResponseAmino): QueryAccountsResponse { const message = createBaseQueryAccountsResponse(); - message.accounts = object.accounts?.map(e => AccountI_FromAmino(e)) || []; + message.accounts = object.accounts?.map(e => GlobalDecoderRegistry.fromAminoMsg(e)) || []; if (object.pagination !== undefined && object.pagination !== null) { message.pagination = PageResponse.fromAmino(object.pagination); } @@ -659,7 +684,7 @@ export const QueryAccountsResponse = { toAmino(message: QueryAccountsResponse, useInterfaces: boolean = true): QueryAccountsResponseAmino { const obj: any = {}; if (message.accounts) { - obj.accounts = message.accounts.map(e => e ? AccountI_ToAmino((e as Any), useInterfaces) : undefined); + obj.accounts = message.accounts.map(e => e ? GlobalDecoderRegistry.toAminoMsg(e) : undefined); } else { obj.accounts = message.accounts; } @@ -677,6 +702,13 @@ export const QueryAccountsResponse = { typeUrl: "/cosmos.auth.v1beta1.QueryAccountsResponse", value: QueryAccountsResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryAccountsResponse.typeUrl)) { + return; + } + BaseAccount.registerTypeUrl(); + PageResponse.registerTypeUrl(); } }; function createBaseQueryAccountRequest(): QueryAccountRequest { @@ -693,6 +725,15 @@ function createBaseQueryAccountRequest(): QueryAccountRequest { export const QueryAccountRequest = { typeUrl: "/cosmos.auth.v1beta1.QueryAccountRequest", aminoType: "cosmos-sdk/QueryAccountRequest", + is(o: any): o is QueryAccountRequest { + return o && (o.$typeUrl === QueryAccountRequest.typeUrl || typeof o.address === "string"); + }, + isSDK(o: any): o is QueryAccountRequestSDKType { + return o && (o.$typeUrl === QueryAccountRequest.typeUrl || typeof o.address === "string"); + }, + isAmino(o: any): o is QueryAccountRequestAmino { + return o && (o.$typeUrl === QueryAccountRequest.typeUrl || typeof o.address === "string"); + }, encode(message: QueryAccountRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.address !== "") { writer.uint32(10).string(message.address); @@ -759,7 +800,8 @@ export const QueryAccountRequest = { typeUrl: "/cosmos.auth.v1beta1.QueryAccountRequest", value: QueryAccountRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryModuleAccountsRequest(): QueryModuleAccountsRequest { return {}; @@ -773,6 +815,15 @@ function createBaseQueryModuleAccountsRequest(): QueryModuleAccountsRequest { export const QueryModuleAccountsRequest = { typeUrl: "/cosmos.auth.v1beta1.QueryModuleAccountsRequest", aminoType: "cosmos-sdk/QueryModuleAccountsRequest", + is(o: any): o is QueryModuleAccountsRequest { + return o && o.$typeUrl === QueryModuleAccountsRequest.typeUrl; + }, + isSDK(o: any): o is QueryModuleAccountsRequestSDKType { + return o && o.$typeUrl === QueryModuleAccountsRequest.typeUrl; + }, + isAmino(o: any): o is QueryModuleAccountsRequestAmino { + return o && o.$typeUrl === QueryModuleAccountsRequest.typeUrl; + }, encode(_: QueryModuleAccountsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -824,7 +875,8 @@ export const QueryModuleAccountsRequest = { typeUrl: "/cosmos.auth.v1beta1.QueryModuleAccountsRequest", value: QueryModuleAccountsRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryParamsResponse(): QueryParamsResponse { return { @@ -840,6 +892,15 @@ function createBaseQueryParamsResponse(): QueryParamsResponse { export const QueryParamsResponse = { typeUrl: "/cosmos.auth.v1beta1.QueryParamsResponse", aminoType: "cosmos-sdk/QueryParamsResponse", + is(o: any): o is QueryParamsResponse { + return o && (o.$typeUrl === QueryParamsResponse.typeUrl || Params.is(o.params)); + }, + isSDK(o: any): o is QueryParamsResponseSDKType { + return o && (o.$typeUrl === QueryParamsResponse.typeUrl || Params.isSDK(o.params)); + }, + isAmino(o: any): o is QueryParamsResponseAmino { + return o && (o.$typeUrl === QueryParamsResponse.typeUrl || Params.isAmino(o.params)); + }, encode(message: QueryParamsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.params !== undefined) { Params.encode(message.params, writer.uint32(10).fork()).ldelim(); @@ -908,6 +969,12 @@ export const QueryParamsResponse = { typeUrl: "/cosmos.auth.v1beta1.QueryParamsResponse", value: QueryParamsResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryParamsResponse.typeUrl)) { + return; + } + Params.registerTypeUrl(); } }; function createBaseQueryAccountResponse(): QueryAccountResponse { @@ -924,9 +991,18 @@ function createBaseQueryAccountResponse(): QueryAccountResponse { export const QueryAccountResponse = { typeUrl: "/cosmos.auth.v1beta1.QueryAccountResponse", aminoType: "cosmos-sdk/QueryAccountResponse", + is(o: any): o is QueryAccountResponse { + return o && o.$typeUrl === QueryAccountResponse.typeUrl; + }, + isSDK(o: any): o is QueryAccountResponseSDKType { + return o && o.$typeUrl === QueryAccountResponse.typeUrl; + }, + isAmino(o: any): o is QueryAccountResponseAmino { + return o && o.$typeUrl === QueryAccountResponse.typeUrl; + }, encode(message: QueryAccountResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.account !== undefined) { - Any.encode((message.account as Any), writer.uint32(10).fork()).ldelim(); + Any.encode(GlobalDecoderRegistry.wrapAny(message.account), writer.uint32(10).fork()).ldelim(); } return writer; }, @@ -938,7 +1014,7 @@ export const QueryAccountResponse = { const tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.account = useInterfaces ? (AccountI_InterfaceDecoder(reader) as Any) : Any.decode(reader, reader.uint32(), useInterfaces); + message.account = GlobalDecoderRegistry.unwrapAny(reader); break; default: reader.skipType(tag & 7); @@ -949,36 +1025,36 @@ export const QueryAccountResponse = { }, fromJSON(object: any): QueryAccountResponse { const obj = createBaseQueryAccountResponse(); - if (isSet(object.account)) obj.account = Any.fromJSON(object.account); + if (isSet(object.account)) obj.account = GlobalDecoderRegistry.fromJSON(object.account); return obj; }, fromPartial(object: DeepPartial): QueryAccountResponse { const message = createBaseQueryAccountResponse(); if (object.account !== undefined && object.account !== null) { - message.account = Any.fromPartial(object.account); + message.account = GlobalDecoderRegistry.fromPartial(object.account); } return message; }, fromSDK(object: QueryAccountResponseSDKType): QueryAccountResponse { return { - account: object.account ? Any.fromSDK(object.account) : undefined + account: object.account ? GlobalDecoderRegistry.fromSDK(object.account) : undefined }; }, toSDK(message: QueryAccountResponse): QueryAccountResponseSDKType { const obj: any = {}; - message.account !== undefined && (obj.account = message.account ? Any.toSDK(message.account) : undefined); + message.account !== undefined && (obj.account = message.account ? GlobalDecoderRegistry.toSDK(message.account) : undefined); return obj; }, fromAmino(object: QueryAccountResponseAmino): QueryAccountResponse { const message = createBaseQueryAccountResponse(); if (object.account !== undefined && object.account !== null) { - message.account = AccountI_FromAmino(object.account); + message.account = GlobalDecoderRegistry.fromAminoMsg(object.account); } return message; }, toAmino(message: QueryAccountResponse, useInterfaces: boolean = true): QueryAccountResponseAmino { const obj: any = {}; - obj.account = message.account ? AccountI_ToAmino((message.account as Any), useInterfaces) : undefined; + obj.account = message.account ? GlobalDecoderRegistry.toAminoMsg(message.account) : undefined; return obj; }, fromProtoMsg(message: QueryAccountResponseProtoMsg, useInterfaces: boolean = true): QueryAccountResponse { @@ -992,6 +1068,12 @@ export const QueryAccountResponse = { typeUrl: "/cosmos.auth.v1beta1.QueryAccountResponse", value: QueryAccountResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryAccountResponse.typeUrl)) { + return; + } + BaseAccount.registerTypeUrl(); } }; function createBaseQueryParamsRequest(): QueryParamsRequest { @@ -1006,6 +1088,15 @@ function createBaseQueryParamsRequest(): QueryParamsRequest { export const QueryParamsRequest = { typeUrl: "/cosmos.auth.v1beta1.QueryParamsRequest", aminoType: "cosmos-sdk/QueryParamsRequest", + is(o: any): o is QueryParamsRequest { + return o && o.$typeUrl === QueryParamsRequest.typeUrl; + }, + isSDK(o: any): o is QueryParamsRequestSDKType { + return o && o.$typeUrl === QueryParamsRequest.typeUrl; + }, + isAmino(o: any): o is QueryParamsRequestAmino { + return o && o.$typeUrl === QueryParamsRequest.typeUrl; + }, encode(_: QueryParamsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -1057,7 +1148,8 @@ export const QueryParamsRequest = { typeUrl: "/cosmos.auth.v1beta1.QueryParamsRequest", value: QueryParamsRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryModuleAccountsResponse(): QueryModuleAccountsResponse { return { @@ -1073,9 +1165,18 @@ function createBaseQueryModuleAccountsResponse(): QueryModuleAccountsResponse { export const QueryModuleAccountsResponse = { typeUrl: "/cosmos.auth.v1beta1.QueryModuleAccountsResponse", aminoType: "cosmos-sdk/QueryModuleAccountsResponse", + is(o: any): o is QueryModuleAccountsResponse { + return o && (o.$typeUrl === QueryModuleAccountsResponse.typeUrl || Array.isArray(o.accounts) && (!o.accounts.length || ModuleAccount.is(o.accounts[0]) || Any.is(o.accounts[0]))); + }, + isSDK(o: any): o is QueryModuleAccountsResponseSDKType { + return o && (o.$typeUrl === QueryModuleAccountsResponse.typeUrl || Array.isArray(o.accounts) && (!o.accounts.length || ModuleAccount.isSDK(o.accounts[0]) || Any.isSDK(o.accounts[0]))); + }, + isAmino(o: any): o is QueryModuleAccountsResponseAmino { + return o && (o.$typeUrl === QueryModuleAccountsResponse.typeUrl || Array.isArray(o.accounts) && (!o.accounts.length || ModuleAccount.isAmino(o.accounts[0]) || Any.isAmino(o.accounts[0]))); + }, encode(message: QueryModuleAccountsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.accounts) { - Any.encode((v! as Any), writer.uint32(10).fork()).ldelim(); + Any.encode(GlobalDecoderRegistry.wrapAny(v!), writer.uint32(10).fork()).ldelim(); } return writer; }, @@ -1087,7 +1188,7 @@ export const QueryModuleAccountsResponse = { const tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.accounts.push(useInterfaces ? (ModuleAccountI_InterfaceDecoder(reader) as Any) : Any.decode(reader, reader.uint32(), useInterfaces)); + message.accounts.push(GlobalDecoderRegistry.unwrapAny(reader)); break; default: reader.skipType(tag & 7); @@ -1098,23 +1199,23 @@ export const QueryModuleAccountsResponse = { }, fromJSON(object: any): QueryModuleAccountsResponse { const obj = createBaseQueryModuleAccountsResponse(); - if (Array.isArray(object?.accounts)) obj.accounts = object.accounts.map((e: any) => Any.fromJSON(e)); + if (Array.isArray(object?.accounts)) obj.accounts = object.accounts.map((e: any) => GlobalDecoderRegistry.fromJSON(e)); return obj; }, fromPartial(object: DeepPartial): QueryModuleAccountsResponse { const message = createBaseQueryModuleAccountsResponse(); - message.accounts = object.accounts?.map(e => Any.fromPartial(e)) || []; + message.accounts = object.accounts?.map(e => (GlobalDecoderRegistry.fromPartial(e) as any)) || []; return message; }, fromSDK(object: QueryModuleAccountsResponseSDKType): QueryModuleAccountsResponse { return { - accounts: Array.isArray(object?.accounts) ? object.accounts.map((e: any) => Any.fromSDK(e)) : [] + accounts: Array.isArray(object?.accounts) ? object.accounts.map((e: any) => GlobalDecoderRegistry.fromSDK(e)) : [] }; }, toSDK(message: QueryModuleAccountsResponse): QueryModuleAccountsResponseSDKType { const obj: any = {}; if (message.accounts) { - obj.accounts = message.accounts.map(e => e ? Any.toSDK(e) : undefined); + obj.accounts = message.accounts.map(e => e ? GlobalDecoderRegistry.toSDK(e) : undefined); } else { obj.accounts = []; } @@ -1122,13 +1223,13 @@ export const QueryModuleAccountsResponse = { }, fromAmino(object: QueryModuleAccountsResponseAmino): QueryModuleAccountsResponse { const message = createBaseQueryModuleAccountsResponse(); - message.accounts = object.accounts?.map(e => ModuleAccountI_FromAmino(e)) || []; + message.accounts = object.accounts?.map(e => GlobalDecoderRegistry.fromAminoMsg(e)) || []; return message; }, toAmino(message: QueryModuleAccountsResponse, useInterfaces: boolean = true): QueryModuleAccountsResponseAmino { const obj: any = {}; if (message.accounts) { - obj.accounts = message.accounts.map(e => e ? ModuleAccountI_ToAmino((e as Any), useInterfaces) : undefined); + obj.accounts = message.accounts.map(e => e ? GlobalDecoderRegistry.toAminoMsg(e) : undefined); } else { obj.accounts = message.accounts; } @@ -1145,6 +1246,12 @@ export const QueryModuleAccountsResponse = { typeUrl: "/cosmos.auth.v1beta1.QueryModuleAccountsResponse", value: QueryModuleAccountsResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryModuleAccountsResponse.typeUrl)) { + return; + } + ModuleAccount.registerTypeUrl(); } }; function createBaseBech32PrefixRequest(): Bech32PrefixRequest { @@ -1159,6 +1266,15 @@ function createBaseBech32PrefixRequest(): Bech32PrefixRequest { export const Bech32PrefixRequest = { typeUrl: "/cosmos.auth.v1beta1.Bech32PrefixRequest", aminoType: "cosmos-sdk/Bech32PrefixRequest", + is(o: any): o is Bech32PrefixRequest { + return o && o.$typeUrl === Bech32PrefixRequest.typeUrl; + }, + isSDK(o: any): o is Bech32PrefixRequestSDKType { + return o && o.$typeUrl === Bech32PrefixRequest.typeUrl; + }, + isAmino(o: any): o is Bech32PrefixRequestAmino { + return o && o.$typeUrl === Bech32PrefixRequest.typeUrl; + }, encode(_: Bech32PrefixRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -1210,7 +1326,8 @@ export const Bech32PrefixRequest = { typeUrl: "/cosmos.auth.v1beta1.Bech32PrefixRequest", value: Bech32PrefixRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseBech32PrefixResponse(): Bech32PrefixResponse { return { @@ -1226,6 +1343,15 @@ function createBaseBech32PrefixResponse(): Bech32PrefixResponse { export const Bech32PrefixResponse = { typeUrl: "/cosmos.auth.v1beta1.Bech32PrefixResponse", aminoType: "cosmos-sdk/Bech32PrefixResponse", + is(o: any): o is Bech32PrefixResponse { + return o && (o.$typeUrl === Bech32PrefixResponse.typeUrl || typeof o.bech32Prefix === "string"); + }, + isSDK(o: any): o is Bech32PrefixResponseSDKType { + return o && (o.$typeUrl === Bech32PrefixResponse.typeUrl || typeof o.bech32_prefix === "string"); + }, + isAmino(o: any): o is Bech32PrefixResponseAmino { + return o && (o.$typeUrl === Bech32PrefixResponse.typeUrl || typeof o.bech32_prefix === "string"); + }, encode(message: Bech32PrefixResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.bech32Prefix !== "") { writer.uint32(10).string(message.bech32Prefix); @@ -1292,7 +1418,8 @@ export const Bech32PrefixResponse = { typeUrl: "/cosmos.auth.v1beta1.Bech32PrefixResponse", value: Bech32PrefixResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseAddressBytesToStringRequest(): AddressBytesToStringRequest { return { @@ -1308,6 +1435,15 @@ function createBaseAddressBytesToStringRequest(): AddressBytesToStringRequest { export const AddressBytesToStringRequest = { typeUrl: "/cosmos.auth.v1beta1.AddressBytesToStringRequest", aminoType: "cosmos-sdk/AddressBytesToStringRequest", + is(o: any): o is AddressBytesToStringRequest { + return o && (o.$typeUrl === AddressBytesToStringRequest.typeUrl || o.addressBytes instanceof Uint8Array || typeof o.addressBytes === "string"); + }, + isSDK(o: any): o is AddressBytesToStringRequestSDKType { + return o && (o.$typeUrl === AddressBytesToStringRequest.typeUrl || o.address_bytes instanceof Uint8Array || typeof o.address_bytes === "string"); + }, + isAmino(o: any): o is AddressBytesToStringRequestAmino { + return o && (o.$typeUrl === AddressBytesToStringRequest.typeUrl || o.address_bytes instanceof Uint8Array || typeof o.address_bytes === "string"); + }, encode(message: AddressBytesToStringRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.addressBytes.length !== 0) { writer.uint32(10).bytes(message.addressBytes); @@ -1374,7 +1510,8 @@ export const AddressBytesToStringRequest = { typeUrl: "/cosmos.auth.v1beta1.AddressBytesToStringRequest", value: AddressBytesToStringRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseAddressBytesToStringResponse(): AddressBytesToStringResponse { return { @@ -1390,6 +1527,15 @@ function createBaseAddressBytesToStringResponse(): AddressBytesToStringResponse export const AddressBytesToStringResponse = { typeUrl: "/cosmos.auth.v1beta1.AddressBytesToStringResponse", aminoType: "cosmos-sdk/AddressBytesToStringResponse", + is(o: any): o is AddressBytesToStringResponse { + return o && (o.$typeUrl === AddressBytesToStringResponse.typeUrl || typeof o.addressString === "string"); + }, + isSDK(o: any): o is AddressBytesToStringResponseSDKType { + return o && (o.$typeUrl === AddressBytesToStringResponse.typeUrl || typeof o.address_string === "string"); + }, + isAmino(o: any): o is AddressBytesToStringResponseAmino { + return o && (o.$typeUrl === AddressBytesToStringResponse.typeUrl || typeof o.address_string === "string"); + }, encode(message: AddressBytesToStringResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.addressString !== "") { writer.uint32(10).string(message.addressString); @@ -1456,7 +1602,8 @@ export const AddressBytesToStringResponse = { typeUrl: "/cosmos.auth.v1beta1.AddressBytesToStringResponse", value: AddressBytesToStringResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseAddressStringToBytesRequest(): AddressStringToBytesRequest { return { @@ -1472,6 +1619,15 @@ function createBaseAddressStringToBytesRequest(): AddressStringToBytesRequest { export const AddressStringToBytesRequest = { typeUrl: "/cosmos.auth.v1beta1.AddressStringToBytesRequest", aminoType: "cosmos-sdk/AddressStringToBytesRequest", + is(o: any): o is AddressStringToBytesRequest { + return o && (o.$typeUrl === AddressStringToBytesRequest.typeUrl || typeof o.addressString === "string"); + }, + isSDK(o: any): o is AddressStringToBytesRequestSDKType { + return o && (o.$typeUrl === AddressStringToBytesRequest.typeUrl || typeof o.address_string === "string"); + }, + isAmino(o: any): o is AddressStringToBytesRequestAmino { + return o && (o.$typeUrl === AddressStringToBytesRequest.typeUrl || typeof o.address_string === "string"); + }, encode(message: AddressStringToBytesRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.addressString !== "") { writer.uint32(10).string(message.addressString); @@ -1538,7 +1694,8 @@ export const AddressStringToBytesRequest = { typeUrl: "/cosmos.auth.v1beta1.AddressStringToBytesRequest", value: AddressStringToBytesRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseAddressStringToBytesResponse(): AddressStringToBytesResponse { return { @@ -1554,6 +1711,15 @@ function createBaseAddressStringToBytesResponse(): AddressStringToBytesResponse export const AddressStringToBytesResponse = { typeUrl: "/cosmos.auth.v1beta1.AddressStringToBytesResponse", aminoType: "cosmos-sdk/AddressStringToBytesResponse", + is(o: any): o is AddressStringToBytesResponse { + return o && (o.$typeUrl === AddressStringToBytesResponse.typeUrl || o.addressBytes instanceof Uint8Array || typeof o.addressBytes === "string"); + }, + isSDK(o: any): o is AddressStringToBytesResponseSDKType { + return o && (o.$typeUrl === AddressStringToBytesResponse.typeUrl || o.address_bytes instanceof Uint8Array || typeof o.address_bytes === "string"); + }, + isAmino(o: any): o is AddressStringToBytesResponseAmino { + return o && (o.$typeUrl === AddressStringToBytesResponse.typeUrl || o.address_bytes instanceof Uint8Array || typeof o.address_bytes === "string"); + }, encode(message: AddressStringToBytesResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.addressBytes.length !== 0) { writer.uint32(10).bytes(message.addressBytes); @@ -1620,69 +1786,6 @@ export const AddressStringToBytesResponse = { typeUrl: "/cosmos.auth.v1beta1.AddressStringToBytesResponse", value: AddressStringToBytesResponse.encode(message).finish() }; - } -}; -export const AccountI_InterfaceDecoder = (input: BinaryReader | Uint8Array): BaseAccount | Any => { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - const data = Any.decode(reader, reader.uint32(), true); - switch (data.typeUrl) { - case "/cosmos.auth.v1beta1.BaseAccount": - return BaseAccount.decode(data.value, undefined, true); - default: - return data; - } -}; -export const AccountI_FromAmino = (content: AnyAmino): Any => { - switch (content.type) { - case "cosmos-sdk/BaseAccount": - return Any.fromPartial({ - typeUrl: "/cosmos.auth.v1beta1.BaseAccount", - value: BaseAccount.encode(BaseAccount.fromPartial(BaseAccount.fromAmino(content.value))).finish() - }); - default: - return Any.fromAmino(content); - } -}; -export const AccountI_ToAmino = (content: Any, useInterfaces: boolean = true) => { - switch (content.typeUrl) { - case "/cosmos.auth.v1beta1.BaseAccount": - return { - type: "cosmos-sdk/BaseAccount", - value: BaseAccount.toAmino(BaseAccount.decode(content.value, undefined, useInterfaces), useInterfaces) - }; - default: - return Any.toAmino(content, useInterfaces); - } -}; -export const ModuleAccountI_InterfaceDecoder = (input: BinaryReader | Uint8Array): ModuleAccount | Any => { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - const data = Any.decode(reader, reader.uint32(), true); - switch (data.typeUrl) { - case "/cosmos.auth.v1beta1.ModuleAccount": - return ModuleAccount.decode(data.value, undefined, true); - default: - return data; - } -}; -export const ModuleAccountI_FromAmino = (content: AnyAmino): Any => { - switch (content.type) { - case "cosmos-sdk/ModuleAccount": - return Any.fromPartial({ - typeUrl: "/cosmos.auth.v1beta1.ModuleAccount", - value: ModuleAccount.encode(ModuleAccount.fromPartial(ModuleAccount.fromAmino(content.value))).finish() - }); - default: - return Any.fromAmino(content); - } -}; -export const ModuleAccountI_ToAmino = (content: Any, useInterfaces: boolean = true) => { - switch (content.typeUrl) { - case "/cosmos.auth.v1beta1.ModuleAccount": - return { - type: "cosmos-sdk/ModuleAccount", - value: ModuleAccount.toAmino(ModuleAccount.decode(content.value, undefined, useInterfaces), useInterfaces) - }; - default: - return Any.toAmino(content, useInterfaces); - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/cosmos/authz/v1beta1/authz.ts b/__fixtures__/v-next/outputv3/cosmos/authz/v1beta1/authz.ts index d8f488c904..9bf7848f92 100644 --- a/__fixtures__/v-next/outputv3/cosmos/authz/v1beta1/authz.ts +++ b/__fixtures__/v-next/outputv3/cosmos/authz/v1beta1/authz.ts @@ -10,6 +10,7 @@ import { SendAuthorization, SendAuthorizationProtoMsg, SendAuthorizationSDKType import { StakeAuthorization, StakeAuthorizationProtoMsg, StakeAuthorizationSDKType } from "../../staking/v1beta1/authz"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { isSet, DeepPartial, toTimestamp, fromTimestamp } from "../../../helpers"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "cosmos.authz.v1beta1"; /** * GenericAuthorization gives the grantee unrestricted permissions to execute @@ -202,6 +203,15 @@ function createBaseGenericAuthorization(): GenericAuthorization { export const GenericAuthorization = { typeUrl: "/cosmos.authz.v1beta1.GenericAuthorization", aminoType: "cosmos-sdk/GenericAuthorization", + is(o: any): o is GenericAuthorization { + return o && (o.$typeUrl === GenericAuthorization.typeUrl || typeof o.msg === "string"); + }, + isSDK(o: any): o is GenericAuthorizationSDKType { + return o && (o.$typeUrl === GenericAuthorization.typeUrl || typeof o.msg === "string"); + }, + isAmino(o: any): o is GenericAuthorizationAmino { + return o && (o.$typeUrl === GenericAuthorization.typeUrl || typeof o.msg === "string"); + }, encode(message: GenericAuthorization, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.msg !== "") { writer.uint32(10).string(message.msg); @@ -268,6 +278,13 @@ export const GenericAuthorization = { typeUrl: "/cosmos.authz.v1beta1.GenericAuthorization", value: GenericAuthorization.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GenericAuthorization.typeUrl)) { + return; + } + GlobalDecoderRegistry.register(GenericAuthorization.typeUrl, GenericAuthorization); + GlobalDecoderRegistry.registerAminoProtoMapping(GenericAuthorization.aminoType, GenericAuthorization.typeUrl); } }; function createBaseGrant(): Grant { @@ -286,9 +303,18 @@ function createBaseGrant(): Grant { export const Grant = { typeUrl: "/cosmos.authz.v1beta1.Grant", aminoType: "cosmos-sdk/Grant", + is(o: any): o is Grant { + return o && o.$typeUrl === Grant.typeUrl; + }, + isSDK(o: any): o is GrantSDKType { + return o && o.$typeUrl === Grant.typeUrl; + }, + isAmino(o: any): o is GrantAmino { + return o && o.$typeUrl === Grant.typeUrl; + }, encode(message: Grant, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.authorization !== undefined) { - Any.encode((message.authorization as Any), writer.uint32(10).fork()).ldelim(); + Any.encode(GlobalDecoderRegistry.wrapAny(message.authorization), writer.uint32(10).fork()).ldelim(); } if (message.expiration !== undefined) { Timestamp.encode(toTimestamp(message.expiration), writer.uint32(18).fork()).ldelim(); @@ -303,7 +329,7 @@ export const Grant = { const tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.authorization = useInterfaces ? (Authorization_InterfaceDecoder(reader) as Any) : Any.decode(reader, reader.uint32(), useInterfaces); + message.authorization = GlobalDecoderRegistry.unwrapAny(reader); break; case 2: message.expiration = fromTimestamp(Timestamp.decode(reader, reader.uint32())); @@ -317,34 +343,34 @@ export const Grant = { }, fromJSON(object: any): Grant { const obj = createBaseGrant(); - if (isSet(object.authorization)) obj.authorization = Any.fromJSON(object.authorization); + if (isSet(object.authorization)) obj.authorization = GlobalDecoderRegistry.fromJSON(object.authorization); if (isSet(object.expiration)) obj.expiration = new Date(object.expiration); return obj; }, fromPartial(object: DeepPartial): Grant { const message = createBaseGrant(); if (object.authorization !== undefined && object.authorization !== null) { - message.authorization = Any.fromPartial(object.authorization); + message.authorization = GlobalDecoderRegistry.fromPartial(object.authorization); } message.expiration = object.expiration ?? undefined; return message; }, fromSDK(object: GrantSDKType): Grant { return { - authorization: object.authorization ? Any.fromSDK(object.authorization) : undefined, + authorization: object.authorization ? GlobalDecoderRegistry.fromSDK(object.authorization) : undefined, expiration: object.expiration ?? undefined }; }, toSDK(message: Grant): GrantSDKType { const obj: any = {}; - message.authorization !== undefined && (obj.authorization = message.authorization ? Any.toSDK(message.authorization) : undefined); + message.authorization !== undefined && (obj.authorization = message.authorization ? GlobalDecoderRegistry.toSDK(message.authorization) : undefined); message.expiration !== undefined && (obj.expiration = message.expiration ?? undefined); return obj; }, fromAmino(object: GrantAmino): Grant { const message = createBaseGrant(); if (object.authorization !== undefined && object.authorization !== null) { - message.authorization = Authorization_FromAmino(object.authorization); + message.authorization = GlobalDecoderRegistry.fromAminoMsg(object.authorization); } if (object.expiration !== undefined && object.expiration !== null) { message.expiration = fromTimestamp(Timestamp.fromAmino(object.expiration)); @@ -353,7 +379,7 @@ export const Grant = { }, toAmino(message: Grant, useInterfaces: boolean = true): GrantAmino { const obj: any = {}; - obj.authorization = message.authorization ? Authorization_ToAmino((message.authorization as Any), useInterfaces) : undefined; + obj.authorization = message.authorization ? GlobalDecoderRegistry.toAminoMsg(message.authorization) : undefined; obj.expiration = message.expiration ? Timestamp.toAmino(toTimestamp(message.expiration)) : undefined; return obj; }, @@ -368,6 +394,16 @@ export const Grant = { typeUrl: "/cosmos.authz.v1beta1.Grant", value: Grant.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Grant.typeUrl)) { + return; + } + GenericAuthorization.registerTypeUrl(); + DepositDeploymentAuthorization1.registerTypeUrl(); + DepositDeploymentAuthorization2.registerTypeUrl(); + SendAuthorization.registerTypeUrl(); + StakeAuthorization.registerTypeUrl(); } }; function createBaseGrantAuthorization(): GrantAuthorization { @@ -388,6 +424,15 @@ function createBaseGrantAuthorization(): GrantAuthorization { export const GrantAuthorization = { typeUrl: "/cosmos.authz.v1beta1.GrantAuthorization", aminoType: "cosmos-sdk/GrantAuthorization", + is(o: any): o is GrantAuthorization { + return o && (o.$typeUrl === GrantAuthorization.typeUrl || typeof o.granter === "string" && typeof o.grantee === "string"); + }, + isSDK(o: any): o is GrantAuthorizationSDKType { + return o && (o.$typeUrl === GrantAuthorization.typeUrl || typeof o.granter === "string" && typeof o.grantee === "string"); + }, + isAmino(o: any): o is GrantAuthorizationAmino { + return o && (o.$typeUrl === GrantAuthorization.typeUrl || typeof o.granter === "string" && typeof o.grantee === "string"); + }, encode(message: GrantAuthorization, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.granter !== "") { writer.uint32(10).string(message.granter); @@ -396,7 +441,7 @@ export const GrantAuthorization = { writer.uint32(18).string(message.grantee); } if (message.authorization !== undefined) { - Any.encode((message.authorization as Any), writer.uint32(26).fork()).ldelim(); + Any.encode(GlobalDecoderRegistry.wrapAny(message.authorization), writer.uint32(26).fork()).ldelim(); } if (message.expiration !== undefined) { Timestamp.encode(toTimestamp(message.expiration), writer.uint32(34).fork()).ldelim(); @@ -417,7 +462,7 @@ export const GrantAuthorization = { message.grantee = reader.string(); break; case 3: - message.authorization = useInterfaces ? (Authorization_InterfaceDecoder(reader) as Any) : Any.decode(reader, reader.uint32(), useInterfaces); + message.authorization = GlobalDecoderRegistry.unwrapAny(reader); break; case 4: message.expiration = fromTimestamp(Timestamp.decode(reader, reader.uint32())); @@ -433,7 +478,7 @@ export const GrantAuthorization = { const obj = createBaseGrantAuthorization(); if (isSet(object.granter)) obj.granter = String(object.granter); if (isSet(object.grantee)) obj.grantee = String(object.grantee); - if (isSet(object.authorization)) obj.authorization = Any.fromJSON(object.authorization); + if (isSet(object.authorization)) obj.authorization = GlobalDecoderRegistry.fromJSON(object.authorization); if (isSet(object.expiration)) obj.expiration = new Date(object.expiration); return obj; }, @@ -442,7 +487,7 @@ export const GrantAuthorization = { message.granter = object.granter ?? ""; message.grantee = object.grantee ?? ""; if (object.authorization !== undefined && object.authorization !== null) { - message.authorization = Any.fromPartial(object.authorization); + message.authorization = GlobalDecoderRegistry.fromPartial(object.authorization); } message.expiration = object.expiration ?? undefined; return message; @@ -451,7 +496,7 @@ export const GrantAuthorization = { return { granter: object?.granter, grantee: object?.grantee, - authorization: object.authorization ? Any.fromSDK(object.authorization) : undefined, + authorization: object.authorization ? GlobalDecoderRegistry.fromSDK(object.authorization) : undefined, expiration: object.expiration ?? undefined }; }, @@ -459,7 +504,7 @@ export const GrantAuthorization = { const obj: any = {}; obj.granter = message.granter; obj.grantee = message.grantee; - message.authorization !== undefined && (obj.authorization = message.authorization ? Any.toSDK(message.authorization) : undefined); + message.authorization !== undefined && (obj.authorization = message.authorization ? GlobalDecoderRegistry.toSDK(message.authorization) : undefined); message.expiration !== undefined && (obj.expiration = message.expiration ?? undefined); return obj; }, @@ -472,7 +517,7 @@ export const GrantAuthorization = { message.grantee = object.grantee; } if (object.authorization !== undefined && object.authorization !== null) { - message.authorization = Authorization_FromAmino(object.authorization); + message.authorization = GlobalDecoderRegistry.fromAminoMsg(object.authorization); } if (object.expiration !== undefined && object.expiration !== null) { message.expiration = fromTimestamp(Timestamp.fromAmino(object.expiration)); @@ -483,7 +528,7 @@ export const GrantAuthorization = { const obj: any = {}; obj.granter = message.granter === "" ? undefined : message.granter; obj.grantee = message.grantee === "" ? undefined : message.grantee; - obj.authorization = message.authorization ? Authorization_ToAmino((message.authorization as Any), useInterfaces) : undefined; + obj.authorization = message.authorization ? GlobalDecoderRegistry.toAminoMsg(message.authorization) : undefined; obj.expiration = message.expiration ? Timestamp.toAmino(toTimestamp(message.expiration)) : undefined; return obj; }, @@ -498,6 +543,16 @@ export const GrantAuthorization = { typeUrl: "/cosmos.authz.v1beta1.GrantAuthorization", value: GrantAuthorization.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GrantAuthorization.typeUrl)) { + return; + } + GenericAuthorization.registerTypeUrl(); + DepositDeploymentAuthorization1.registerTypeUrl(); + DepositDeploymentAuthorization2.registerTypeUrl(); + SendAuthorization.registerTypeUrl(); + StakeAuthorization.registerTypeUrl(); } }; function createBaseGrantQueueItem(): GrantQueueItem { @@ -514,6 +569,15 @@ function createBaseGrantQueueItem(): GrantQueueItem { export const GrantQueueItem = { typeUrl: "/cosmos.authz.v1beta1.GrantQueueItem", aminoType: "cosmos-sdk/GrantQueueItem", + is(o: any): o is GrantQueueItem { + return o && (o.$typeUrl === GrantQueueItem.typeUrl || Array.isArray(o.msgTypeUrls) && (!o.msgTypeUrls.length || typeof o.msgTypeUrls[0] === "string")); + }, + isSDK(o: any): o is GrantQueueItemSDKType { + return o && (o.$typeUrl === GrantQueueItem.typeUrl || Array.isArray(o.msg_type_urls) && (!o.msg_type_urls.length || typeof o.msg_type_urls[0] === "string")); + }, + isAmino(o: any): o is GrantQueueItemAmino { + return o && (o.$typeUrl === GrantQueueItem.typeUrl || Array.isArray(o.msg_type_urls) && (!o.msg_type_urls.length || typeof o.msg_type_urls[0] === "string")); + }, encode(message: GrantQueueItem, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.msgTypeUrls) { writer.uint32(10).string(v!); @@ -586,85 +650,6 @@ export const GrantQueueItem = { typeUrl: "/cosmos.authz.v1beta1.GrantQueueItem", value: GrantQueueItem.encode(message).finish() }; - } -}; -export const Authorization_InterfaceDecoder = (input: BinaryReader | Uint8Array): DepositDeploymentAuthorization1 | DepositDeploymentAuthorization2 | GenericAuthorization | SendAuthorization | StakeAuthorization | Any => { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - const data = Any.decode(reader, reader.uint32(), true); - switch (data.typeUrl) { - case "/akash.deployment.v1beta1.DepositDeploymentAuthorization": - return DepositDeploymentAuthorization1.decode(data.value, undefined, true); - case "/akash.deployment.v1beta2.DepositDeploymentAuthorization": - return DepositDeploymentAuthorization2.decode(data.value, undefined, true); - case "/cosmos.authz.v1beta1.GenericAuthorization": - return GenericAuthorization.decode(data.value, undefined, true); - case "/cosmos.bank.v1beta1.SendAuthorization": - return SendAuthorization.decode(data.value, undefined, true); - case "/cosmos.staking.v1beta1.StakeAuthorization": - return StakeAuthorization.decode(data.value, undefined, true); - default: - return data; - } -}; -export const Authorization_FromAmino = (content: AnyAmino): Any => { - switch (content.type) { - case "/akash.deployment.v1beta1.DepositDeploymentAuthorization": - return Any.fromPartial({ - typeUrl: "/akash.deployment.v1beta1.DepositDeploymentAuthorization", - value: DepositDeploymentAuthorization1.encode(DepositDeploymentAuthorization1.fromPartial(DepositDeploymentAuthorization1.fromAmino(content.value))).finish() - }); - case "/akash.deployment.v1beta2.DepositDeploymentAuthorization": - return Any.fromPartial({ - typeUrl: "/akash.deployment.v1beta2.DepositDeploymentAuthorization", - value: DepositDeploymentAuthorization2.encode(DepositDeploymentAuthorization2.fromPartial(DepositDeploymentAuthorization2.fromAmino(content.value))).finish() - }); - case "cosmos-sdk/GenericAuthorization": - return Any.fromPartial({ - typeUrl: "/cosmos.authz.v1beta1.GenericAuthorization", - value: GenericAuthorization.encode(GenericAuthorization.fromPartial(GenericAuthorization.fromAmino(content.value))).finish() - }); - case "cosmos-sdk/SendAuthorization": - return Any.fromPartial({ - typeUrl: "/cosmos.bank.v1beta1.SendAuthorization", - value: SendAuthorization.encode(SendAuthorization.fromPartial(SendAuthorization.fromAmino(content.value))).finish() - }); - case "cosmos-sdk/StakeAuthorization": - return Any.fromPartial({ - typeUrl: "/cosmos.staking.v1beta1.StakeAuthorization", - value: StakeAuthorization.encode(StakeAuthorization.fromPartial(StakeAuthorization.fromAmino(content.value))).finish() - }); - default: - return Any.fromAmino(content); - } -}; -export const Authorization_ToAmino = (content: Any, useInterfaces: boolean = true) => { - switch (content.typeUrl) { - case "/akash.deployment.v1beta1.DepositDeploymentAuthorization": - return { - type: "/akash.deployment.v1beta1.DepositDeploymentAuthorization", - value: DepositDeploymentAuthorization1.toAmino(DepositDeploymentAuthorization1.decode(content.value, undefined, useInterfaces), useInterfaces) - }; - case "/akash.deployment.v1beta2.DepositDeploymentAuthorization": - return { - type: "/akash.deployment.v1beta2.DepositDeploymentAuthorization", - value: DepositDeploymentAuthorization2.toAmino(DepositDeploymentAuthorization2.decode(content.value, undefined, useInterfaces), useInterfaces) - }; - case "/cosmos.authz.v1beta1.GenericAuthorization": - return { - type: "cosmos-sdk/GenericAuthorization", - value: GenericAuthorization.toAmino(GenericAuthorization.decode(content.value, undefined, useInterfaces), useInterfaces) - }; - case "/cosmos.bank.v1beta1.SendAuthorization": - return { - type: "cosmos-sdk/SendAuthorization", - value: SendAuthorization.toAmino(SendAuthorization.decode(content.value, undefined, useInterfaces), useInterfaces) - }; - case "/cosmos.staking.v1beta1.StakeAuthorization": - return { - type: "cosmos-sdk/StakeAuthorization", - value: StakeAuthorization.toAmino(StakeAuthorization.decode(content.value, undefined, useInterfaces), useInterfaces) - }; - default: - return Any.toAmino(content, useInterfaces); - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/cosmos/authz/v1beta1/genesis.ts b/__fixtures__/v-next/outputv3/cosmos/authz/v1beta1/genesis.ts index fcade25c19..426715b455 100644 --- a/__fixtures__/v-next/outputv3/cosmos/authz/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv3/cosmos/authz/v1beta1/genesis.ts @@ -1,6 +1,7 @@ import { GrantAuthorization, GrantAuthorizationAmino, GrantAuthorizationSDKType } from "./authz"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { DeepPartial } from "../../../helpers"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "cosmos.authz.v1beta1"; /** * GenesisState defines the authz module's genesis state. @@ -47,6 +48,15 @@ function createBaseGenesisState(): GenesisState { export const GenesisState = { typeUrl: "/cosmos.authz.v1beta1.GenesisState", aminoType: "cosmos-sdk/GenesisState", + is(o: any): o is GenesisState { + return o && (o.$typeUrl === GenesisState.typeUrl || Array.isArray(o.authorization) && (!o.authorization.length || GrantAuthorization.is(o.authorization[0]))); + }, + isSDK(o: any): o is GenesisStateSDKType { + return o && (o.$typeUrl === GenesisState.typeUrl || Array.isArray(o.authorization) && (!o.authorization.length || GrantAuthorization.isSDK(o.authorization[0]))); + }, + isAmino(o: any): o is GenesisStateAmino { + return o && (o.$typeUrl === GenesisState.typeUrl || Array.isArray(o.authorization) && (!o.authorization.length || GrantAuthorization.isAmino(o.authorization[0]))); + }, encode(message: GenesisState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.authorization) { GrantAuthorization.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -119,5 +129,11 @@ export const GenesisState = { typeUrl: "/cosmos.authz.v1beta1.GenesisState", value: GenesisState.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GenesisState.typeUrl)) { + return; + } + GrantAuthorization.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/cosmos/authz/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputv3/cosmos/authz/v1beta1/query.rpc.func.ts new file mode 100644 index 0000000000..5202cd24db --- /dev/null +++ b/__fixtures__/v-next/outputv3/cosmos/authz/v1beta1/query.rpc.func.ts @@ -0,0 +1,47 @@ +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; +import { Grant, GrantSDKType, GrantAuthorization, GrantAuthorizationSDKType } from "./authz"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { QueryGrantsRequest, QueryGrantsRequestSDKType, QueryGrantsResponse, QueryGrantsResponseSDKType, QueryGranterGrantsRequest, QueryGranterGrantsRequestSDKType, QueryGranterGrantsResponse, QueryGranterGrantsResponseSDKType, QueryGranteeGrantsRequest, QueryGranteeGrantsRequestSDKType, QueryGranteeGrantsResponse, QueryGranteeGrantsResponseSDKType } from "./query"; +/** + * Returns list of `Authorization`, granted to the grantee by the granter. + * @name getGrants + * @package cosmos.authz.v1beta1 + * @see proto service: cosmos.authz.v1beta1.Grants + */ +export const getGrants = buildQuery({ + encode: QueryGrantsRequest.encode, + decode: QueryGrantsResponse.decode, + service: "cosmos.authz.v1beta1.Query", + method: "Grants", + deps: [QueryGrantsRequest, QueryGrantsResponse] +}); +/** + * GranterGrants returns list of `GrantAuthorization`, granted by granter. + * + * Since: cosmos-sdk 0.46 + * @name getGranterGrants + * @package cosmos.authz.v1beta1 + * @see proto service: cosmos.authz.v1beta1.GranterGrants + */ +export const getGranterGrants = buildQuery({ + encode: QueryGranterGrantsRequest.encode, + decode: QueryGranterGrantsResponse.decode, + service: "cosmos.authz.v1beta1.Query", + method: "GranterGrants", + deps: [QueryGranterGrantsRequest, QueryGranterGrantsResponse] +}); +/** + * GranteeGrants returns a list of `GrantAuthorization` by grantee. + * + * Since: cosmos-sdk 0.46 + * @name getGranteeGrants + * @package cosmos.authz.v1beta1 + * @see proto service: cosmos.authz.v1beta1.GranteeGrants + */ +export const getGranteeGrants = buildQuery({ + encode: QueryGranteeGrantsRequest.encode, + decode: QueryGranteeGrantsResponse.decode, + service: "cosmos.authz.v1beta1.Query", + method: "GranteeGrants", + deps: [QueryGranteeGrantsRequest, QueryGranteeGrantsResponse] +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/cosmos/authz/v1beta1/query.ts b/__fixtures__/v-next/outputv3/cosmos/authz/v1beta1/query.ts index 4cbd16849c..06560a8031 100644 --- a/__fixtures__/v-next/outputv3/cosmos/authz/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv3/cosmos/authz/v1beta1/query.ts @@ -1,6 +1,7 @@ import { PageRequest, PageRequestAmino, PageRequestSDKType, PageResponse, PageResponseAmino, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; import { Grant, GrantAmino, GrantSDKType, GrantAuthorization, GrantAuthorizationAmino, GrantAuthorizationSDKType } from "./authz"; import { BinaryReader, BinaryWriter } from "../../../binary"; +import { GlobalDecoderRegistry } from "../../../registry"; import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "cosmos.authz.v1beta1"; /** @@ -290,6 +291,15 @@ function createBaseQueryGrantsRequest(): QueryGrantsRequest { export const QueryGrantsRequest = { typeUrl: "/cosmos.authz.v1beta1.QueryGrantsRequest", aminoType: "cosmos-sdk/QueryGrantsRequest", + is(o: any): o is QueryGrantsRequest { + return o && (o.$typeUrl === QueryGrantsRequest.typeUrl || typeof o.granter === "string" && typeof o.grantee === "string" && typeof o.msgTypeUrl === "string"); + }, + isSDK(o: any): o is QueryGrantsRequestSDKType { + return o && (o.$typeUrl === QueryGrantsRequest.typeUrl || typeof o.granter === "string" && typeof o.grantee === "string" && typeof o.msg_type_url === "string"); + }, + isAmino(o: any): o is QueryGrantsRequestAmino { + return o && (o.$typeUrl === QueryGrantsRequest.typeUrl || typeof o.granter === "string" && typeof o.grantee === "string" && typeof o.msg_type_url === "string"); + }, encode(message: QueryGrantsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.granter !== "") { writer.uint32(10).string(message.granter); @@ -400,6 +410,12 @@ export const QueryGrantsRequest = { typeUrl: "/cosmos.authz.v1beta1.QueryGrantsRequest", value: QueryGrantsRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryGrantsRequest.typeUrl)) { + return; + } + PageRequest.registerTypeUrl(); } }; function createBaseQueryGrantsResponse(): QueryGrantsResponse { @@ -417,6 +433,15 @@ function createBaseQueryGrantsResponse(): QueryGrantsResponse { export const QueryGrantsResponse = { typeUrl: "/cosmos.authz.v1beta1.QueryGrantsResponse", aminoType: "cosmos-sdk/QueryGrantsResponse", + is(o: any): o is QueryGrantsResponse { + return o && (o.$typeUrl === QueryGrantsResponse.typeUrl || Array.isArray(o.grants) && (!o.grants.length || Grant.is(o.grants[0]))); + }, + isSDK(o: any): o is QueryGrantsResponseSDKType { + return o && (o.$typeUrl === QueryGrantsResponse.typeUrl || Array.isArray(o.grants) && (!o.grants.length || Grant.isSDK(o.grants[0]))); + }, + isAmino(o: any): o is QueryGrantsResponseAmino { + return o && (o.$typeUrl === QueryGrantsResponse.typeUrl || Array.isArray(o.grants) && (!o.grants.length || Grant.isAmino(o.grants[0]))); + }, encode(message: QueryGrantsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.grants) { Grant.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -505,6 +530,13 @@ export const QueryGrantsResponse = { typeUrl: "/cosmos.authz.v1beta1.QueryGrantsResponse", value: QueryGrantsResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryGrantsResponse.typeUrl)) { + return; + } + Grant.registerTypeUrl(); + PageResponse.registerTypeUrl(); } }; function createBaseQueryGranterGrantsRequest(): QueryGranterGrantsRequest { @@ -522,6 +554,15 @@ function createBaseQueryGranterGrantsRequest(): QueryGranterGrantsRequest { export const QueryGranterGrantsRequest = { typeUrl: "/cosmos.authz.v1beta1.QueryGranterGrantsRequest", aminoType: "cosmos-sdk/QueryGranterGrantsRequest", + is(o: any): o is QueryGranterGrantsRequest { + return o && (o.$typeUrl === QueryGranterGrantsRequest.typeUrl || typeof o.granter === "string"); + }, + isSDK(o: any): o is QueryGranterGrantsRequestSDKType { + return o && (o.$typeUrl === QueryGranterGrantsRequest.typeUrl || typeof o.granter === "string"); + }, + isAmino(o: any): o is QueryGranterGrantsRequestAmino { + return o && (o.$typeUrl === QueryGranterGrantsRequest.typeUrl || typeof o.granter === "string"); + }, encode(message: QueryGranterGrantsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.granter !== "") { writer.uint32(10).string(message.granter); @@ -604,6 +645,12 @@ export const QueryGranterGrantsRequest = { typeUrl: "/cosmos.authz.v1beta1.QueryGranterGrantsRequest", value: QueryGranterGrantsRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryGranterGrantsRequest.typeUrl)) { + return; + } + PageRequest.registerTypeUrl(); } }; function createBaseQueryGranterGrantsResponse(): QueryGranterGrantsResponse { @@ -621,6 +668,15 @@ function createBaseQueryGranterGrantsResponse(): QueryGranterGrantsResponse { export const QueryGranterGrantsResponse = { typeUrl: "/cosmos.authz.v1beta1.QueryGranterGrantsResponse", aminoType: "cosmos-sdk/QueryGranterGrantsResponse", + is(o: any): o is QueryGranterGrantsResponse { + return o && (o.$typeUrl === QueryGranterGrantsResponse.typeUrl || Array.isArray(o.grants) && (!o.grants.length || GrantAuthorization.is(o.grants[0]))); + }, + isSDK(o: any): o is QueryGranterGrantsResponseSDKType { + return o && (o.$typeUrl === QueryGranterGrantsResponse.typeUrl || Array.isArray(o.grants) && (!o.grants.length || GrantAuthorization.isSDK(o.grants[0]))); + }, + isAmino(o: any): o is QueryGranterGrantsResponseAmino { + return o && (o.$typeUrl === QueryGranterGrantsResponse.typeUrl || Array.isArray(o.grants) && (!o.grants.length || GrantAuthorization.isAmino(o.grants[0]))); + }, encode(message: QueryGranterGrantsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.grants) { GrantAuthorization.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -709,6 +765,13 @@ export const QueryGranterGrantsResponse = { typeUrl: "/cosmos.authz.v1beta1.QueryGranterGrantsResponse", value: QueryGranterGrantsResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryGranterGrantsResponse.typeUrl)) { + return; + } + GrantAuthorization.registerTypeUrl(); + PageResponse.registerTypeUrl(); } }; function createBaseQueryGranteeGrantsRequest(): QueryGranteeGrantsRequest { @@ -726,6 +789,15 @@ function createBaseQueryGranteeGrantsRequest(): QueryGranteeGrantsRequest { export const QueryGranteeGrantsRequest = { typeUrl: "/cosmos.authz.v1beta1.QueryGranteeGrantsRequest", aminoType: "cosmos-sdk/QueryGranteeGrantsRequest", + is(o: any): o is QueryGranteeGrantsRequest { + return o && (o.$typeUrl === QueryGranteeGrantsRequest.typeUrl || typeof o.grantee === "string"); + }, + isSDK(o: any): o is QueryGranteeGrantsRequestSDKType { + return o && (o.$typeUrl === QueryGranteeGrantsRequest.typeUrl || typeof o.grantee === "string"); + }, + isAmino(o: any): o is QueryGranteeGrantsRequestAmino { + return o && (o.$typeUrl === QueryGranteeGrantsRequest.typeUrl || typeof o.grantee === "string"); + }, encode(message: QueryGranteeGrantsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.grantee !== "") { writer.uint32(10).string(message.grantee); @@ -808,6 +880,12 @@ export const QueryGranteeGrantsRequest = { typeUrl: "/cosmos.authz.v1beta1.QueryGranteeGrantsRequest", value: QueryGranteeGrantsRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryGranteeGrantsRequest.typeUrl)) { + return; + } + PageRequest.registerTypeUrl(); } }; function createBaseQueryGranteeGrantsResponse(): QueryGranteeGrantsResponse { @@ -825,6 +903,15 @@ function createBaseQueryGranteeGrantsResponse(): QueryGranteeGrantsResponse { export const QueryGranteeGrantsResponse = { typeUrl: "/cosmos.authz.v1beta1.QueryGranteeGrantsResponse", aminoType: "cosmos-sdk/QueryGranteeGrantsResponse", + is(o: any): o is QueryGranteeGrantsResponse { + return o && (o.$typeUrl === QueryGranteeGrantsResponse.typeUrl || Array.isArray(o.grants) && (!o.grants.length || GrantAuthorization.is(o.grants[0]))); + }, + isSDK(o: any): o is QueryGranteeGrantsResponseSDKType { + return o && (o.$typeUrl === QueryGranteeGrantsResponse.typeUrl || Array.isArray(o.grants) && (!o.grants.length || GrantAuthorization.isSDK(o.grants[0]))); + }, + isAmino(o: any): o is QueryGranteeGrantsResponseAmino { + return o && (o.$typeUrl === QueryGranteeGrantsResponse.typeUrl || Array.isArray(o.grants) && (!o.grants.length || GrantAuthorization.isAmino(o.grants[0]))); + }, encode(message: QueryGranteeGrantsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.grants) { GrantAuthorization.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -913,5 +1000,12 @@ export const QueryGranteeGrantsResponse = { typeUrl: "/cosmos.authz.v1beta1.QueryGranteeGrantsResponse", value: QueryGranteeGrantsResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryGranteeGrantsResponse.typeUrl)) { + return; + } + GrantAuthorization.registerTypeUrl(); + PageResponse.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/cosmos/authz/v1beta1/tx.registry.ts b/__fixtures__/v-next/outputv3/cosmos/authz/v1beta1/tx.registry.ts index f2f3151df4..2cff0cf4c7 100644 --- a/__fixtures__/v-next/outputv3/cosmos/authz/v1beta1/tx.registry.ts +++ b/__fixtures__/v-next/outputv3/cosmos/authz/v1beta1/tx.registry.ts @@ -1,13 +1,8 @@ import { Grant, GrantSDKType } from "./authz"; import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../google/protobuf/any"; -import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { TelescopeGeneratedType } from "../../../types"; import { MsgGrant, MsgGrantSDKType, MsgExec, MsgExecSDKType, MsgRevoke, MsgRevokeSDKType } from "./tx"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/cosmos.authz.v1beta1.MsgGrant", MsgGrant], ["/cosmos.authz.v1beta1.MsgExec", MsgExec], ["/cosmos.authz.v1beta1.MsgRevoke", MsgRevoke]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/cosmos.authz.v1beta1.MsgGrant", MsgGrant], ["/cosmos.authz.v1beta1.MsgExec", MsgExec], ["/cosmos.authz.v1beta1.MsgRevoke", MsgRevoke]]; export const MessageComposer = { encoded: { grant(value: MsgGrant) { diff --git a/__fixtures__/v-next/outputv3/cosmos/authz/v1beta1/tx.rpc.func.ts b/__fixtures__/v-next/outputv3/cosmos/authz/v1beta1/tx.rpc.func.ts new file mode 100644 index 0000000000..c4ddbc1be9 --- /dev/null +++ b/__fixtures__/v-next/outputv3/cosmos/authz/v1beta1/tx.rpc.func.ts @@ -0,0 +1,37 @@ +import { Grant, GrantSDKType } from "./authz"; +import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../google/protobuf/any"; +import { buildTx } from "../../../helper-func-types"; +import { MsgGrant, MsgGrantSDKType, MsgGrantResponse, MsgGrantResponseSDKType, MsgExec, MsgExecSDKType, MsgExecResponse, MsgExecResponseSDKType, MsgRevoke, MsgRevokeSDKType, MsgRevokeResponse, MsgRevokeResponseSDKType } from "./tx"; +/** + * Grant grants the provided authorization to the grantee on the granter's + * account with the provided expiration time. If there is already a grant + * for the given (granter, grantee, Authorization) triple, then the grant + * will be overwritten. + * @name grant + * @package cosmos.authz.v1beta1 + * @see proto service: cosmos.authz.v1beta1.Grant + */ +export const grant = buildTx({ + msg: MsgGrant +}); +/** + * Exec attempts to execute the provided messages using + * authorizations granted to the grantee. Each message should have only + * one signer corresponding to the granter of the authorization. + * @name exec + * @package cosmos.authz.v1beta1 + * @see proto service: cosmos.authz.v1beta1.Exec + */ +export const exec = buildTx({ + msg: MsgExec +}); +/** + * Revoke revokes any authorization corresponding to the provided method name on the + * granter's account that has been granted to the grantee. + * @name revoke + * @package cosmos.authz.v1beta1 + * @see proto service: cosmos.authz.v1beta1.Revoke + */ +export const revoke = buildTx({ + msg: MsgRevoke +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/cosmos/authz/v1beta1/tx.ts b/__fixtures__/v-next/outputv3/cosmos/authz/v1beta1/tx.ts index 8bbd97bd05..5ca8f6a6b6 100644 --- a/__fixtures__/v-next/outputv3/cosmos/authz/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputv3/cosmos/authz/v1beta1/tx.ts @@ -1,6 +1,7 @@ import { Grant, GrantAmino, GrantSDKType } from "./authz"; import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../google/protobuf/any"; import { BinaryReader, BinaryWriter } from "../../../binary"; +import { GlobalDecoderRegistry } from "../../../registry"; import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../helpers"; export const protobufPackage = "cosmos.authz.v1beta1"; /** @@ -239,6 +240,15 @@ function createBaseMsgGrant(): MsgGrant { export const MsgGrant = { typeUrl: "/cosmos.authz.v1beta1.MsgGrant", aminoType: "cosmos-sdk/MsgGrant", + is(o: any): o is MsgGrant { + return o && (o.$typeUrl === MsgGrant.typeUrl || typeof o.granter === "string" && typeof o.grantee === "string" && Grant.is(o.grant)); + }, + isSDK(o: any): o is MsgGrantSDKType { + return o && (o.$typeUrl === MsgGrant.typeUrl || typeof o.granter === "string" && typeof o.grantee === "string" && Grant.isSDK(o.grant)); + }, + isAmino(o: any): o is MsgGrantAmino { + return o && (o.$typeUrl === MsgGrant.typeUrl || typeof o.granter === "string" && typeof o.grantee === "string" && Grant.isAmino(o.grant)); + }, encode(message: MsgGrant, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.granter !== "") { writer.uint32(10).string(message.granter); @@ -335,6 +345,12 @@ export const MsgGrant = { typeUrl: "/cosmos.authz.v1beta1.MsgGrant", value: MsgGrant.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgGrant.typeUrl)) { + return; + } + Grant.registerTypeUrl(); } }; function createBaseMsgExecResponse(): MsgExecResponse { @@ -351,6 +367,15 @@ function createBaseMsgExecResponse(): MsgExecResponse { export const MsgExecResponse = { typeUrl: "/cosmos.authz.v1beta1.MsgExecResponse", aminoType: "cosmos-sdk/MsgExecResponse", + is(o: any): o is MsgExecResponse { + return o && (o.$typeUrl === MsgExecResponse.typeUrl || Array.isArray(o.results) && (!o.results.length || o.results[0] instanceof Uint8Array || typeof o.results[0] === "string")); + }, + isSDK(o: any): o is MsgExecResponseSDKType { + return o && (o.$typeUrl === MsgExecResponse.typeUrl || Array.isArray(o.results) && (!o.results.length || o.results[0] instanceof Uint8Array || typeof o.results[0] === "string")); + }, + isAmino(o: any): o is MsgExecResponseAmino { + return o && (o.$typeUrl === MsgExecResponse.typeUrl || Array.isArray(o.results) && (!o.results.length || o.results[0] instanceof Uint8Array || typeof o.results[0] === "string")); + }, encode(message: MsgExecResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.results) { writer.uint32(10).bytes(v!); @@ -423,7 +448,8 @@ export const MsgExecResponse = { typeUrl: "/cosmos.authz.v1beta1.MsgExecResponse", value: MsgExecResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgExec(): MsgExec { return { @@ -442,12 +468,21 @@ function createBaseMsgExec(): MsgExec { export const MsgExec = { typeUrl: "/cosmos.authz.v1beta1.MsgExec", aminoType: "cosmos-sdk/MsgExec", + is(o: any): o is MsgExec { + return o && (o.$typeUrl === MsgExec.typeUrl || typeof o.grantee === "string" && Array.isArray(o.msgs) && (!o.msgs.length || Any.is(o.msgs[0]))); + }, + isSDK(o: any): o is MsgExecSDKType { + return o && (o.$typeUrl === MsgExec.typeUrl || typeof o.grantee === "string" && Array.isArray(o.msgs) && (!o.msgs.length || Any.isSDK(o.msgs[0]))); + }, + isAmino(o: any): o is MsgExecAmino { + return o && (o.$typeUrl === MsgExec.typeUrl || typeof o.grantee === "string" && Array.isArray(o.msgs) && (!o.msgs.length || Any.isAmino(o.msgs[0]))); + }, encode(message: MsgExec, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.grantee !== "") { writer.uint32(10).string(message.grantee); } for (const v of message.msgs) { - Any.encode((v! as Any), writer.uint32(18).fork()).ldelim(); + Any.encode(GlobalDecoderRegistry.wrapAny(v!), writer.uint32(18).fork()).ldelim(); } return writer; }, @@ -462,7 +497,7 @@ export const MsgExec = { message.grantee = reader.string(); break; case 2: - message.msgs.push(useInterfaces ? (Sdk_MsgauthzAuthorization_InterfaceDecoder(reader) as Any) : Any.decode(reader, reader.uint32(), useInterfaces)); + message.msgs.push(GlobalDecoderRegistry.unwrapAny(reader)); break; default: reader.skipType(tag & 7); @@ -474,26 +509,26 @@ export const MsgExec = { fromJSON(object: any): MsgExec { const obj = createBaseMsgExec(); if (isSet(object.grantee)) obj.grantee = String(object.grantee); - if (Array.isArray(object?.msgs)) obj.msgs = object.msgs.map((e: any) => Any.fromJSON(e)); + if (Array.isArray(object?.msgs)) obj.msgs = object.msgs.map((e: any) => GlobalDecoderRegistry.fromJSON(e)); return obj; }, fromPartial(object: DeepPartial): MsgExec { const message = createBaseMsgExec(); message.grantee = object.grantee ?? ""; - message.msgs = object.msgs?.map(e => Any.fromPartial(e)) || []; + message.msgs = object.msgs?.map(e => (GlobalDecoderRegistry.fromPartial(e) as any)) || []; return message; }, fromSDK(object: MsgExecSDKType): MsgExec { return { grantee: object?.grantee, - msgs: Array.isArray(object?.msgs) ? object.msgs.map((e: any) => Any.fromSDK(e)) : [] + msgs: Array.isArray(object?.msgs) ? object.msgs.map((e: any) => GlobalDecoderRegistry.fromSDK(e)) : [] }; }, toSDK(message: MsgExec): MsgExecSDKType { const obj: any = {}; obj.grantee = message.grantee; if (message.msgs) { - obj.msgs = message.msgs.map(e => e ? Any.toSDK(e) : undefined); + obj.msgs = message.msgs.map(e => e ? GlobalDecoderRegistry.toSDK(e) : undefined); } else { obj.msgs = []; } @@ -504,14 +539,14 @@ export const MsgExec = { if (object.grantee !== undefined && object.grantee !== null) { message.grantee = object.grantee; } - message.msgs = object.msgs?.map(e => Sdk_Msg_FromAmino(e)) || []; + message.msgs = object.msgs?.map(e => GlobalDecoderRegistry.fromAminoMsg(e)) || []; return message; }, toAmino(message: MsgExec, useInterfaces: boolean = true): MsgExecAmino { const obj: any = {}; obj.grantee = message.grantee === "" ? undefined : message.grantee; if (message.msgs) { - obj.msgs = message.msgs.map(e => e ? Sdk_Msg_ToAmino((e as Any), useInterfaces) : undefined); + obj.msgs = message.msgs.map(e => e ? GlobalDecoderRegistry.toAminoMsg(e) : undefined); } else { obj.msgs = message.msgs; } @@ -528,7 +563,8 @@ export const MsgExec = { typeUrl: "/cosmos.authz.v1beta1.MsgExec", value: MsgExec.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgGrantResponse(): MsgGrantResponse { return {}; @@ -542,6 +578,15 @@ function createBaseMsgGrantResponse(): MsgGrantResponse { export const MsgGrantResponse = { typeUrl: "/cosmos.authz.v1beta1.MsgGrantResponse", aminoType: "cosmos-sdk/MsgGrantResponse", + is(o: any): o is MsgGrantResponse { + return o && o.$typeUrl === MsgGrantResponse.typeUrl; + }, + isSDK(o: any): o is MsgGrantResponseSDKType { + return o && o.$typeUrl === MsgGrantResponse.typeUrl; + }, + isAmino(o: any): o is MsgGrantResponseAmino { + return o && o.$typeUrl === MsgGrantResponse.typeUrl; + }, encode(_: MsgGrantResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -593,7 +638,8 @@ export const MsgGrantResponse = { typeUrl: "/cosmos.authz.v1beta1.MsgGrantResponse", value: MsgGrantResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgRevoke(): MsgRevoke { return { @@ -612,6 +658,15 @@ function createBaseMsgRevoke(): MsgRevoke { export const MsgRevoke = { typeUrl: "/cosmos.authz.v1beta1.MsgRevoke", aminoType: "cosmos-sdk/MsgRevoke", + is(o: any): o is MsgRevoke { + return o && (o.$typeUrl === MsgRevoke.typeUrl || typeof o.granter === "string" && typeof o.grantee === "string" && typeof o.msgTypeUrl === "string"); + }, + isSDK(o: any): o is MsgRevokeSDKType { + return o && (o.$typeUrl === MsgRevoke.typeUrl || typeof o.granter === "string" && typeof o.grantee === "string" && typeof o.msg_type_url === "string"); + }, + isAmino(o: any): o is MsgRevokeAmino { + return o && (o.$typeUrl === MsgRevoke.typeUrl || typeof o.granter === "string" && typeof o.grantee === "string" && typeof o.msg_type_url === "string"); + }, encode(message: MsgRevoke, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.granter !== "") { writer.uint32(10).string(message.granter); @@ -706,7 +761,8 @@ export const MsgRevoke = { typeUrl: "/cosmos.authz.v1beta1.MsgRevoke", value: MsgRevoke.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgRevokeResponse(): MsgRevokeResponse { return {}; @@ -720,6 +776,15 @@ function createBaseMsgRevokeResponse(): MsgRevokeResponse { export const MsgRevokeResponse = { typeUrl: "/cosmos.authz.v1beta1.MsgRevokeResponse", aminoType: "cosmos-sdk/MsgRevokeResponse", + is(o: any): o is MsgRevokeResponse { + return o && o.$typeUrl === MsgRevokeResponse.typeUrl; + }, + isSDK(o: any): o is MsgRevokeResponseSDKType { + return o && o.$typeUrl === MsgRevokeResponse.typeUrl; + }, + isAmino(o: any): o is MsgRevokeResponseAmino { + return o && o.$typeUrl === MsgRevokeResponse.typeUrl; + }, encode(_: MsgRevokeResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -771,33 +836,6 @@ export const MsgRevokeResponse = { typeUrl: "/cosmos.authz.v1beta1.MsgRevokeResponse", value: MsgRevokeResponse.encode(message).finish() }; - } -}; -export const Sdk_Msg_InterfaceDecoder = (input: BinaryReader | Uint8Array): Any => { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - const data = Any.decode(reader, reader.uint32(), true); - switch (data.typeUrl) { - default: - return data; - } -}; -export const Sdk_Msg_FromAmino = (content: AnyAmino): Any => { - return Any.fromAmino(content); -}; -export const Sdk_Msg_ToAmino = (content: Any, useInterfaces: boolean = true) => { - return Any.toAmino(content, useInterfaces); -}; -export const Authz_Authorization_InterfaceDecoder = (input: BinaryReader | Uint8Array): Any => { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - const data = Any.decode(reader, reader.uint32(), true); - switch (data.typeUrl) { - default: - return data; - } -}; -export const Authz_Authorization_FromAmino = (content: AnyAmino): Any => { - return Any.fromAmino(content); -}; -export const Authz_Authorization_ToAmino = (content: Any, useInterfaces: boolean = true) => { - return Any.toAmino(content, useInterfaces); + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/cosmos/bank/v1beta1/authz.ts b/__fixtures__/v-next/outputv3/cosmos/bank/v1beta1/authz.ts index 01c0c7c0ab..ac8b3e0bb5 100644 --- a/__fixtures__/v-next/outputv3/cosmos/bank/v1beta1/authz.ts +++ b/__fixtures__/v-next/outputv3/cosmos/bank/v1beta1/authz.ts @@ -1,6 +1,7 @@ import { Coin, CoinAmino, CoinSDKType } from "../../base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { DeepPartial } from "../../../helpers"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "cosmos.bank.v1beta1"; /** * SendAuthorization allows the grantee to spend up to spend_limit coins from @@ -62,6 +63,15 @@ function createBaseSendAuthorization(): SendAuthorization { export const SendAuthorization = { typeUrl: "/cosmos.bank.v1beta1.SendAuthorization", aminoType: "cosmos-sdk/SendAuthorization", + is(o: any): o is SendAuthorization { + return o && (o.$typeUrl === SendAuthorization.typeUrl || Array.isArray(o.spendLimit) && (!o.spendLimit.length || Coin.is(o.spendLimit[0]))); + }, + isSDK(o: any): o is SendAuthorizationSDKType { + return o && (o.$typeUrl === SendAuthorization.typeUrl || Array.isArray(o.spend_limit) && (!o.spend_limit.length || Coin.isSDK(o.spend_limit[0]))); + }, + isAmino(o: any): o is SendAuthorizationAmino { + return o && (o.$typeUrl === SendAuthorization.typeUrl || Array.isArray(o.spend_limit) && (!o.spend_limit.length || Coin.isAmino(o.spend_limit[0]))); + }, encode(message: SendAuthorization, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.spendLimit) { Coin.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -134,5 +144,13 @@ export const SendAuthorization = { typeUrl: "/cosmos.bank.v1beta1.SendAuthorization", value: SendAuthorization.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(SendAuthorization.typeUrl)) { + return; + } + GlobalDecoderRegistry.register(SendAuthorization.typeUrl, SendAuthorization); + GlobalDecoderRegistry.registerAminoProtoMapping(SendAuthorization.aminoType, SendAuthorization.typeUrl); + Coin.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/cosmos/bank/v1beta1/bank.ts b/__fixtures__/v-next/outputv3/cosmos/bank/v1beta1/bank.ts index ad7e73e478..1c8ec8fa37 100644 --- a/__fixtures__/v-next/outputv3/cosmos/bank/v1beta1/bank.ts +++ b/__fixtures__/v-next/outputv3/cosmos/bank/v1beta1/bank.ts @@ -1,6 +1,7 @@ import { Coin, CoinAmino, CoinSDKType } from "../../base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { isSet, DeepPartial } from "../../../helpers"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "cosmos.bank.v1beta1"; /** * Params defines the parameters for the bank module. @@ -383,6 +384,15 @@ function createBaseParams(): Params { export const Params = { typeUrl: "/cosmos.bank.v1beta1.Params", aminoType: "cosmos-sdk/Params", + is(o: any): o is Params { + return o && (o.$typeUrl === Params.typeUrl || Array.isArray(o.sendEnabled) && (!o.sendEnabled.length || SendEnabled.is(o.sendEnabled[0])) && typeof o.defaultSendEnabled === "boolean"); + }, + isSDK(o: any): o is ParamsSDKType { + return o && (o.$typeUrl === Params.typeUrl || Array.isArray(o.send_enabled) && (!o.send_enabled.length || SendEnabled.isSDK(o.send_enabled[0])) && typeof o.default_send_enabled === "boolean"); + }, + isAmino(o: any): o is ParamsAmino { + return o && (o.$typeUrl === Params.typeUrl || Array.isArray(o.send_enabled) && (!o.send_enabled.length || SendEnabled.isAmino(o.send_enabled[0])) && typeof o.default_send_enabled === "boolean"); + }, encode(message: Params, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.sendEnabled) { SendEnabled.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -469,6 +479,12 @@ export const Params = { typeUrl: "/cosmos.bank.v1beta1.Params", value: Params.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Params.typeUrl)) { + return; + } + SendEnabled.registerTypeUrl(); } }; function createBaseSendEnabled(): SendEnabled { @@ -487,6 +503,15 @@ function createBaseSendEnabled(): SendEnabled { export const SendEnabled = { typeUrl: "/cosmos.bank.v1beta1.SendEnabled", aminoType: "cosmos-sdk/SendEnabled", + is(o: any): o is SendEnabled { + return o && (o.$typeUrl === SendEnabled.typeUrl || typeof o.denom === "string" && typeof o.enabled === "boolean"); + }, + isSDK(o: any): o is SendEnabledSDKType { + return o && (o.$typeUrl === SendEnabled.typeUrl || typeof o.denom === "string" && typeof o.enabled === "boolean"); + }, + isAmino(o: any): o is SendEnabledAmino { + return o && (o.$typeUrl === SendEnabled.typeUrl || typeof o.denom === "string" && typeof o.enabled === "boolean"); + }, encode(message: SendEnabled, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.denom !== "") { writer.uint32(10).string(message.denom); @@ -567,7 +592,8 @@ export const SendEnabled = { typeUrl: "/cosmos.bank.v1beta1.SendEnabled", value: SendEnabled.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseInput(): Input { return { @@ -584,6 +610,15 @@ function createBaseInput(): Input { export const Input = { typeUrl: "/cosmos.bank.v1beta1.Input", aminoType: "cosmos-sdk/Input", + is(o: any): o is Input { + return o && (o.$typeUrl === Input.typeUrl || typeof o.address === "string" && Array.isArray(o.coins) && (!o.coins.length || Coin.is(o.coins[0]))); + }, + isSDK(o: any): o is InputSDKType { + return o && (o.$typeUrl === Input.typeUrl || typeof o.address === "string" && Array.isArray(o.coins) && (!o.coins.length || Coin.isSDK(o.coins[0]))); + }, + isAmino(o: any): o is InputAmino { + return o && (o.$typeUrl === Input.typeUrl || typeof o.address === "string" && Array.isArray(o.coins) && (!o.coins.length || Coin.isAmino(o.coins[0]))); + }, encode(message: Input, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.address !== "") { writer.uint32(10).string(message.address); @@ -670,6 +705,12 @@ export const Input = { typeUrl: "/cosmos.bank.v1beta1.Input", value: Input.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Input.typeUrl)) { + return; + } + Coin.registerTypeUrl(); } }; function createBaseOutput(): Output { @@ -687,6 +728,15 @@ function createBaseOutput(): Output { export const Output = { typeUrl: "/cosmos.bank.v1beta1.Output", aminoType: "cosmos-sdk/Output", + is(o: any): o is Output { + return o && (o.$typeUrl === Output.typeUrl || typeof o.address === "string" && Array.isArray(o.coins) && (!o.coins.length || Coin.is(o.coins[0]))); + }, + isSDK(o: any): o is OutputSDKType { + return o && (o.$typeUrl === Output.typeUrl || typeof o.address === "string" && Array.isArray(o.coins) && (!o.coins.length || Coin.isSDK(o.coins[0]))); + }, + isAmino(o: any): o is OutputAmino { + return o && (o.$typeUrl === Output.typeUrl || typeof o.address === "string" && Array.isArray(o.coins) && (!o.coins.length || Coin.isAmino(o.coins[0]))); + }, encode(message: Output, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.address !== "") { writer.uint32(10).string(message.address); @@ -773,6 +823,12 @@ export const Output = { typeUrl: "/cosmos.bank.v1beta1.Output", value: Output.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Output.typeUrl)) { + return; + } + Coin.registerTypeUrl(); } }; function createBaseSupply(): Supply { @@ -793,6 +849,15 @@ function createBaseSupply(): Supply { export const Supply = { typeUrl: "/cosmos.bank.v1beta1.Supply", aminoType: "cosmos-sdk/Supply", + is(o: any): o is Supply { + return o && (o.$typeUrl === Supply.typeUrl || Array.isArray(o.total) && (!o.total.length || Coin.is(o.total[0]))); + }, + isSDK(o: any): o is SupplySDKType { + return o && (o.$typeUrl === Supply.typeUrl || Array.isArray(o.total) && (!o.total.length || Coin.isSDK(o.total[0]))); + }, + isAmino(o: any): o is SupplyAmino { + return o && (o.$typeUrl === Supply.typeUrl || Array.isArray(o.total) && (!o.total.length || Coin.isAmino(o.total[0]))); + }, encode(message: Supply, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.total) { Coin.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -865,6 +930,14 @@ export const Supply = { typeUrl: "/cosmos.bank.v1beta1.Supply", value: Supply.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Supply.typeUrl)) { + return; + } + GlobalDecoderRegistry.register(Supply.typeUrl, Supply); + GlobalDecoderRegistry.registerAminoProtoMapping(Supply.aminoType, Supply.typeUrl); + Coin.registerTypeUrl(); } }; function createBaseDenomUnit(): DenomUnit { @@ -884,6 +957,15 @@ function createBaseDenomUnit(): DenomUnit { export const DenomUnit = { typeUrl: "/cosmos.bank.v1beta1.DenomUnit", aminoType: "cosmos-sdk/DenomUnit", + is(o: any): o is DenomUnit { + return o && (o.$typeUrl === DenomUnit.typeUrl || typeof o.denom === "string" && typeof o.exponent === "number" && Array.isArray(o.aliases) && (!o.aliases.length || typeof o.aliases[0] === "string")); + }, + isSDK(o: any): o is DenomUnitSDKType { + return o && (o.$typeUrl === DenomUnit.typeUrl || typeof o.denom === "string" && typeof o.exponent === "number" && Array.isArray(o.aliases) && (!o.aliases.length || typeof o.aliases[0] === "string")); + }, + isAmino(o: any): o is DenomUnitAmino { + return o && (o.$typeUrl === DenomUnit.typeUrl || typeof o.denom === "string" && typeof o.exponent === "number" && Array.isArray(o.aliases) && (!o.aliases.length || typeof o.aliases[0] === "string")); + }, encode(message: DenomUnit, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.denom !== "") { writer.uint32(10).string(message.denom); @@ -984,7 +1066,8 @@ export const DenomUnit = { typeUrl: "/cosmos.bank.v1beta1.DenomUnit", value: DenomUnit.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMetadata(): Metadata { return { @@ -1008,6 +1091,15 @@ function createBaseMetadata(): Metadata { export const Metadata = { typeUrl: "/cosmos.bank.v1beta1.Metadata", aminoType: "cosmos-sdk/Metadata", + is(o: any): o is Metadata { + return o && (o.$typeUrl === Metadata.typeUrl || typeof o.description === "string" && Array.isArray(o.denomUnits) && (!o.denomUnits.length || DenomUnit.is(o.denomUnits[0])) && typeof o.base === "string" && typeof o.display === "string" && typeof o.name === "string" && typeof o.symbol === "string" && typeof o.uri === "string" && typeof o.uriHash === "string"); + }, + isSDK(o: any): o is MetadataSDKType { + return o && (o.$typeUrl === Metadata.typeUrl || typeof o.description === "string" && Array.isArray(o.denom_units) && (!o.denom_units.length || DenomUnit.isSDK(o.denom_units[0])) && typeof o.base === "string" && typeof o.display === "string" && typeof o.name === "string" && typeof o.symbol === "string" && typeof o.uri === "string" && typeof o.uri_hash === "string"); + }, + isAmino(o: any): o is MetadataAmino { + return o && (o.$typeUrl === Metadata.typeUrl || typeof o.description === "string" && Array.isArray(o.denom_units) && (!o.denom_units.length || DenomUnit.isAmino(o.denom_units[0])) && typeof o.base === "string" && typeof o.display === "string" && typeof o.name === "string" && typeof o.symbol === "string" && typeof o.uri === "string" && typeof o.uri_hash === "string"); + }, encode(message: Metadata, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.description !== "") { writer.uint32(10).string(message.description); @@ -1178,5 +1270,11 @@ export const Metadata = { typeUrl: "/cosmos.bank.v1beta1.Metadata", value: Metadata.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Metadata.typeUrl)) { + return; + } + DenomUnit.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/cosmos/bank/v1beta1/genesis.ts b/__fixtures__/v-next/outputv3/cosmos/bank/v1beta1/genesis.ts index c1745397cb..721355eed7 100644 --- a/__fixtures__/v-next/outputv3/cosmos/bank/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv3/cosmos/bank/v1beta1/genesis.ts @@ -1,6 +1,7 @@ import { Params, ParamsAmino, ParamsSDKType, Metadata, MetadataAmino, MetadataSDKType } from "./bank"; import { Coin, CoinAmino, CoinSDKType } from "../../base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; +import { GlobalDecoderRegistry } from "../../../registry"; import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "cosmos.bank.v1beta1"; /** @@ -135,6 +136,15 @@ function createBaseGenesisState(): GenesisState { export const GenesisState = { typeUrl: "/cosmos.bank.v1beta1.GenesisState", aminoType: "cosmos-sdk/GenesisState", + is(o: any): o is GenesisState { + return o && (o.$typeUrl === GenesisState.typeUrl || Params.is(o.params) && Array.isArray(o.balances) && (!o.balances.length || Balance.is(o.balances[0])) && Array.isArray(o.supply) && (!o.supply.length || Coin.is(o.supply[0])) && Array.isArray(o.denomMetadata) && (!o.denomMetadata.length || Metadata.is(o.denomMetadata[0]))); + }, + isSDK(o: any): o is GenesisStateSDKType { + return o && (o.$typeUrl === GenesisState.typeUrl || Params.isSDK(o.params) && Array.isArray(o.balances) && (!o.balances.length || Balance.isSDK(o.balances[0])) && Array.isArray(o.supply) && (!o.supply.length || Coin.isSDK(o.supply[0])) && Array.isArray(o.denom_metadata) && (!o.denom_metadata.length || Metadata.isSDK(o.denom_metadata[0]))); + }, + isAmino(o: any): o is GenesisStateAmino { + return o && (o.$typeUrl === GenesisState.typeUrl || Params.isAmino(o.params) && Array.isArray(o.balances) && (!o.balances.length || Balance.isAmino(o.balances[0])) && Array.isArray(o.supply) && (!o.supply.length || Coin.isAmino(o.supply[0])) && Array.isArray(o.denom_metadata) && (!o.denom_metadata.length || Metadata.isAmino(o.denom_metadata[0]))); + }, encode(message: GenesisState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.params !== undefined) { Params.encode(message.params, writer.uint32(10).fork()).ldelim(); @@ -263,6 +273,15 @@ export const GenesisState = { typeUrl: "/cosmos.bank.v1beta1.GenesisState", value: GenesisState.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GenesisState.typeUrl)) { + return; + } + Params.registerTypeUrl(); + Balance.registerTypeUrl(); + Coin.registerTypeUrl(); + Metadata.registerTypeUrl(); } }; function createBaseBalance(): Balance { @@ -281,6 +300,15 @@ function createBaseBalance(): Balance { export const Balance = { typeUrl: "/cosmos.bank.v1beta1.Balance", aminoType: "cosmos-sdk/Balance", + is(o: any): o is Balance { + return o && (o.$typeUrl === Balance.typeUrl || typeof o.address === "string" && Array.isArray(o.coins) && (!o.coins.length || Coin.is(o.coins[0]))); + }, + isSDK(o: any): o is BalanceSDKType { + return o && (o.$typeUrl === Balance.typeUrl || typeof o.address === "string" && Array.isArray(o.coins) && (!o.coins.length || Coin.isSDK(o.coins[0]))); + }, + isAmino(o: any): o is BalanceAmino { + return o && (o.$typeUrl === Balance.typeUrl || typeof o.address === "string" && Array.isArray(o.coins) && (!o.coins.length || Coin.isAmino(o.coins[0]))); + }, encode(message: Balance, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.address !== "") { writer.uint32(10).string(message.address); @@ -367,5 +395,11 @@ export const Balance = { typeUrl: "/cosmos.bank.v1beta1.Balance", value: Balance.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Balance.typeUrl)) { + return; + } + Coin.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/cosmos/bank/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputv3/cosmos/bank/v1beta1/query.rpc.func.ts new file mode 100644 index 0000000000..de0c85bd50 --- /dev/null +++ b/__fixtures__/v-next/outputv3/cosmos/bank/v1beta1/query.rpc.func.ts @@ -0,0 +1,125 @@ +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; +import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; +import { Params, ParamsSDKType, Metadata, MetadataSDKType } from "./bank"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { QueryBalanceRequest, QueryBalanceRequestSDKType, QueryBalanceResponse, QueryBalanceResponseSDKType, QueryAllBalancesRequest, QueryAllBalancesRequestSDKType, QueryAllBalancesResponse, QueryAllBalancesResponseSDKType, QuerySpendableBalancesRequest, QuerySpendableBalancesRequestSDKType, QuerySpendableBalancesResponse, QuerySpendableBalancesResponseSDKType, QueryTotalSupplyRequest, QueryTotalSupplyRequestSDKType, QueryTotalSupplyResponse, QueryTotalSupplyResponseSDKType, QuerySupplyOfRequest, QuerySupplyOfRequestSDKType, QuerySupplyOfResponse, QuerySupplyOfResponseSDKType, QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, QueryDenomMetadataRequest, QueryDenomMetadataRequestSDKType, QueryDenomMetadataResponse, QueryDenomMetadataResponseSDKType, QueryDenomsMetadataRequest, QueryDenomsMetadataRequestSDKType, QueryDenomsMetadataResponse, QueryDenomsMetadataResponseSDKType, QueryDenomOwnersRequest, QueryDenomOwnersRequestSDKType, QueryDenomOwnersResponse, QueryDenomOwnersResponseSDKType } from "./query"; +/** + * Balance queries the balance of a single coin for a single account. + * @name getBalance + * @package cosmos.bank.v1beta1 + * @see proto service: cosmos.bank.v1beta1.Balance + */ +export const getBalance = buildQuery({ + encode: QueryBalanceRequest.encode, + decode: QueryBalanceResponse.decode, + service: "cosmos.bank.v1beta1.Query", + method: "Balance", + deps: [QueryBalanceRequest, QueryBalanceResponse] +}); +/** + * AllBalances queries the balance of all coins for a single account. + * @name getAllBalances + * @package cosmos.bank.v1beta1 + * @see proto service: cosmos.bank.v1beta1.AllBalances + */ +export const getAllBalances = buildQuery({ + encode: QueryAllBalancesRequest.encode, + decode: QueryAllBalancesResponse.decode, + service: "cosmos.bank.v1beta1.Query", + method: "AllBalances", + deps: [QueryAllBalancesRequest, QueryAllBalancesResponse] +}); +/** + * SpendableBalances queries the spenable balance of all coins for a single + * account. + * @name getSpendableBalances + * @package cosmos.bank.v1beta1 + * @see proto service: cosmos.bank.v1beta1.SpendableBalances + */ +export const getSpendableBalances = buildQuery({ + encode: QuerySpendableBalancesRequest.encode, + decode: QuerySpendableBalancesResponse.decode, + service: "cosmos.bank.v1beta1.Query", + method: "SpendableBalances", + deps: [QuerySpendableBalancesRequest, QuerySpendableBalancesResponse] +}); +/** + * TotalSupply queries the total supply of all coins. + * @name getTotalSupply + * @package cosmos.bank.v1beta1 + * @see proto service: cosmos.bank.v1beta1.TotalSupply + */ +export const getTotalSupply = buildQuery({ + encode: QueryTotalSupplyRequest.encode, + decode: QueryTotalSupplyResponse.decode, + service: "cosmos.bank.v1beta1.Query", + method: "TotalSupply", + deps: [QueryTotalSupplyRequest, QueryTotalSupplyResponse] +}); +/** + * SupplyOf queries the supply of a single coin. + * @name getSupplyOf + * @package cosmos.bank.v1beta1 + * @see proto service: cosmos.bank.v1beta1.SupplyOf + */ +export const getSupplyOf = buildQuery({ + encode: QuerySupplyOfRequest.encode, + decode: QuerySupplyOfResponse.decode, + service: "cosmos.bank.v1beta1.Query", + method: "SupplyOf", + deps: [QuerySupplyOfRequest, QuerySupplyOfResponse] +}); +/** + * Params queries the parameters of x/bank module. + * @name getParams + * @package cosmos.bank.v1beta1 + * @see proto service: cosmos.bank.v1beta1.Params + */ +export const getParams = buildQuery({ + encode: QueryParamsRequest.encode, + decode: QueryParamsResponse.decode, + service: "cosmos.bank.v1beta1.Query", + method: "Params", + deps: [QueryParamsRequest, QueryParamsResponse] +}); +/** + * DenomsMetadata queries the client metadata of a given coin denomination. + * @name getDenomMetadata + * @package cosmos.bank.v1beta1 + * @see proto service: cosmos.bank.v1beta1.DenomMetadata + */ +export const getDenomMetadata = buildQuery({ + encode: QueryDenomMetadataRequest.encode, + decode: QueryDenomMetadataResponse.decode, + service: "cosmos.bank.v1beta1.Query", + method: "DenomMetadata", + deps: [QueryDenomMetadataRequest, QueryDenomMetadataResponse] +}); +/** + * DenomsMetadata queries the client metadata for all registered coin + * denominations. + * @name getDenomsMetadata + * @package cosmos.bank.v1beta1 + * @see proto service: cosmos.bank.v1beta1.DenomsMetadata + */ +export const getDenomsMetadata = buildQuery({ + encode: QueryDenomsMetadataRequest.encode, + decode: QueryDenomsMetadataResponse.decode, + service: "cosmos.bank.v1beta1.Query", + method: "DenomsMetadata", + deps: [QueryDenomsMetadataRequest, QueryDenomsMetadataResponse] +}); +/** + * DenomOwners queries for all account addresses that own a particular token + * denomination. + * @name getDenomOwners + * @package cosmos.bank.v1beta1 + * @see proto service: cosmos.bank.v1beta1.DenomOwners + */ +export const getDenomOwners = buildQuery({ + encode: QueryDenomOwnersRequest.encode, + decode: QueryDenomOwnersResponse.decode, + service: "cosmos.bank.v1beta1.Query", + method: "DenomOwners", + deps: [QueryDenomOwnersRequest, QueryDenomOwnersResponse] +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/cosmos/bank/v1beta1/query.ts b/__fixtures__/v-next/outputv3/cosmos/bank/v1beta1/query.ts index a6cd478e1b..ee988a6766 100644 --- a/__fixtures__/v-next/outputv3/cosmos/bank/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv3/cosmos/bank/v1beta1/query.ts @@ -3,6 +3,7 @@ import { Coin, CoinAmino, CoinSDKType } from "../../base/v1beta1/coin"; import { Params, ParamsAmino, ParamsSDKType, Metadata, MetadataAmino, MetadataSDKType } from "./bank"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { isSet, DeepPartial } from "../../../helpers"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "cosmos.bank.v1beta1"; /** * QueryBalanceRequest is the request type for the Query/Balance RPC method. @@ -829,6 +830,15 @@ function createBaseQueryBalanceRequest(): QueryBalanceRequest { export const QueryBalanceRequest = { typeUrl: "/cosmos.bank.v1beta1.QueryBalanceRequest", aminoType: "cosmos-sdk/QueryBalanceRequest", + is(o: any): o is QueryBalanceRequest { + return o && (o.$typeUrl === QueryBalanceRequest.typeUrl || typeof o.address === "string" && typeof o.denom === "string"); + }, + isSDK(o: any): o is QueryBalanceRequestSDKType { + return o && (o.$typeUrl === QueryBalanceRequest.typeUrl || typeof o.address === "string" && typeof o.denom === "string"); + }, + isAmino(o: any): o is QueryBalanceRequestAmino { + return o && (o.$typeUrl === QueryBalanceRequest.typeUrl || typeof o.address === "string" && typeof o.denom === "string"); + }, encode(message: QueryBalanceRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.address !== "") { writer.uint32(10).string(message.address); @@ -909,7 +919,8 @@ export const QueryBalanceRequest = { typeUrl: "/cosmos.bank.v1beta1.QueryBalanceRequest", value: QueryBalanceRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryBalanceResponse(): QueryBalanceResponse { return { @@ -925,6 +936,15 @@ function createBaseQueryBalanceResponse(): QueryBalanceResponse { export const QueryBalanceResponse = { typeUrl: "/cosmos.bank.v1beta1.QueryBalanceResponse", aminoType: "cosmos-sdk/QueryBalanceResponse", + is(o: any): o is QueryBalanceResponse { + return o && o.$typeUrl === QueryBalanceResponse.typeUrl; + }, + isSDK(o: any): o is QueryBalanceResponseSDKType { + return o && o.$typeUrl === QueryBalanceResponse.typeUrl; + }, + isAmino(o: any): o is QueryBalanceResponseAmino { + return o && o.$typeUrl === QueryBalanceResponse.typeUrl; + }, encode(message: QueryBalanceResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.balance !== undefined) { Coin.encode(message.balance, writer.uint32(10).fork()).ldelim(); @@ -993,6 +1013,12 @@ export const QueryBalanceResponse = { typeUrl: "/cosmos.bank.v1beta1.QueryBalanceResponse", value: QueryBalanceResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryBalanceResponse.typeUrl)) { + return; + } + Coin.registerTypeUrl(); } }; function createBaseQueryAllBalancesRequest(): QueryAllBalancesRequest { @@ -1010,6 +1036,15 @@ function createBaseQueryAllBalancesRequest(): QueryAllBalancesRequest { export const QueryAllBalancesRequest = { typeUrl: "/cosmos.bank.v1beta1.QueryAllBalancesRequest", aminoType: "cosmos-sdk/QueryAllBalancesRequest", + is(o: any): o is QueryAllBalancesRequest { + return o && (o.$typeUrl === QueryAllBalancesRequest.typeUrl || typeof o.address === "string"); + }, + isSDK(o: any): o is QueryAllBalancesRequestSDKType { + return o && (o.$typeUrl === QueryAllBalancesRequest.typeUrl || typeof o.address === "string"); + }, + isAmino(o: any): o is QueryAllBalancesRequestAmino { + return o && (o.$typeUrl === QueryAllBalancesRequest.typeUrl || typeof o.address === "string"); + }, encode(message: QueryAllBalancesRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.address !== "") { writer.uint32(10).string(message.address); @@ -1092,6 +1127,12 @@ export const QueryAllBalancesRequest = { typeUrl: "/cosmos.bank.v1beta1.QueryAllBalancesRequest", value: QueryAllBalancesRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryAllBalancesRequest.typeUrl)) { + return; + } + PageRequest.registerTypeUrl(); } }; function createBaseQueryAllBalancesResponse(): QueryAllBalancesResponse { @@ -1110,6 +1151,15 @@ function createBaseQueryAllBalancesResponse(): QueryAllBalancesResponse { export const QueryAllBalancesResponse = { typeUrl: "/cosmos.bank.v1beta1.QueryAllBalancesResponse", aminoType: "cosmos-sdk/QueryAllBalancesResponse", + is(o: any): o is QueryAllBalancesResponse { + return o && (o.$typeUrl === QueryAllBalancesResponse.typeUrl || Array.isArray(o.balances) && (!o.balances.length || Coin.is(o.balances[0]))); + }, + isSDK(o: any): o is QueryAllBalancesResponseSDKType { + return o && (o.$typeUrl === QueryAllBalancesResponse.typeUrl || Array.isArray(o.balances) && (!o.balances.length || Coin.isSDK(o.balances[0]))); + }, + isAmino(o: any): o is QueryAllBalancesResponseAmino { + return o && (o.$typeUrl === QueryAllBalancesResponse.typeUrl || Array.isArray(o.balances) && (!o.balances.length || Coin.isAmino(o.balances[0]))); + }, encode(message: QueryAllBalancesResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.balances) { Coin.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -1198,6 +1248,13 @@ export const QueryAllBalancesResponse = { typeUrl: "/cosmos.bank.v1beta1.QueryAllBalancesResponse", value: QueryAllBalancesResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryAllBalancesResponse.typeUrl)) { + return; + } + Coin.registerTypeUrl(); + PageResponse.registerTypeUrl(); } }; function createBaseQuerySpendableBalancesRequest(): QuerySpendableBalancesRequest { @@ -1216,6 +1273,15 @@ function createBaseQuerySpendableBalancesRequest(): QuerySpendableBalancesReques export const QuerySpendableBalancesRequest = { typeUrl: "/cosmos.bank.v1beta1.QuerySpendableBalancesRequest", aminoType: "cosmos-sdk/QuerySpendableBalancesRequest", + is(o: any): o is QuerySpendableBalancesRequest { + return o && (o.$typeUrl === QuerySpendableBalancesRequest.typeUrl || typeof o.address === "string"); + }, + isSDK(o: any): o is QuerySpendableBalancesRequestSDKType { + return o && (o.$typeUrl === QuerySpendableBalancesRequest.typeUrl || typeof o.address === "string"); + }, + isAmino(o: any): o is QuerySpendableBalancesRequestAmino { + return o && (o.$typeUrl === QuerySpendableBalancesRequest.typeUrl || typeof o.address === "string"); + }, encode(message: QuerySpendableBalancesRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.address !== "") { writer.uint32(10).string(message.address); @@ -1298,6 +1364,12 @@ export const QuerySpendableBalancesRequest = { typeUrl: "/cosmos.bank.v1beta1.QuerySpendableBalancesRequest", value: QuerySpendableBalancesRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QuerySpendableBalancesRequest.typeUrl)) { + return; + } + PageRequest.registerTypeUrl(); } }; function createBaseQuerySpendableBalancesResponse(): QuerySpendableBalancesResponse { @@ -1316,6 +1388,15 @@ function createBaseQuerySpendableBalancesResponse(): QuerySpendableBalancesRespo export const QuerySpendableBalancesResponse = { typeUrl: "/cosmos.bank.v1beta1.QuerySpendableBalancesResponse", aminoType: "cosmos-sdk/QuerySpendableBalancesResponse", + is(o: any): o is QuerySpendableBalancesResponse { + return o && (o.$typeUrl === QuerySpendableBalancesResponse.typeUrl || Array.isArray(o.balances) && (!o.balances.length || Coin.is(o.balances[0]))); + }, + isSDK(o: any): o is QuerySpendableBalancesResponseSDKType { + return o && (o.$typeUrl === QuerySpendableBalancesResponse.typeUrl || Array.isArray(o.balances) && (!o.balances.length || Coin.isSDK(o.balances[0]))); + }, + isAmino(o: any): o is QuerySpendableBalancesResponseAmino { + return o && (o.$typeUrl === QuerySpendableBalancesResponse.typeUrl || Array.isArray(o.balances) && (!o.balances.length || Coin.isAmino(o.balances[0]))); + }, encode(message: QuerySpendableBalancesResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.balances) { Coin.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -1404,6 +1485,13 @@ export const QuerySpendableBalancesResponse = { typeUrl: "/cosmos.bank.v1beta1.QuerySpendableBalancesResponse", value: QuerySpendableBalancesResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QuerySpendableBalancesResponse.typeUrl)) { + return; + } + Coin.registerTypeUrl(); + PageResponse.registerTypeUrl(); } }; function createBaseQueryTotalSupplyRequest(): QueryTotalSupplyRequest { @@ -1421,6 +1509,15 @@ function createBaseQueryTotalSupplyRequest(): QueryTotalSupplyRequest { export const QueryTotalSupplyRequest = { typeUrl: "/cosmos.bank.v1beta1.QueryTotalSupplyRequest", aminoType: "cosmos-sdk/QueryTotalSupplyRequest", + is(o: any): o is QueryTotalSupplyRequest { + return o && o.$typeUrl === QueryTotalSupplyRequest.typeUrl; + }, + isSDK(o: any): o is QueryTotalSupplyRequestSDKType { + return o && o.$typeUrl === QueryTotalSupplyRequest.typeUrl; + }, + isAmino(o: any): o is QueryTotalSupplyRequestAmino { + return o && o.$typeUrl === QueryTotalSupplyRequest.typeUrl; + }, encode(message: QueryTotalSupplyRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.pagination !== undefined) { PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); @@ -1489,6 +1586,12 @@ export const QueryTotalSupplyRequest = { typeUrl: "/cosmos.bank.v1beta1.QueryTotalSupplyRequest", value: QueryTotalSupplyRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryTotalSupplyRequest.typeUrl)) { + return; + } + PageRequest.registerTypeUrl(); } }; function createBaseQueryTotalSupplyResponse(): QueryTotalSupplyResponse { @@ -1507,6 +1610,15 @@ function createBaseQueryTotalSupplyResponse(): QueryTotalSupplyResponse { export const QueryTotalSupplyResponse = { typeUrl: "/cosmos.bank.v1beta1.QueryTotalSupplyResponse", aminoType: "cosmos-sdk/QueryTotalSupplyResponse", + is(o: any): o is QueryTotalSupplyResponse { + return o && (o.$typeUrl === QueryTotalSupplyResponse.typeUrl || Array.isArray(o.supply) && (!o.supply.length || Coin.is(o.supply[0]))); + }, + isSDK(o: any): o is QueryTotalSupplyResponseSDKType { + return o && (o.$typeUrl === QueryTotalSupplyResponse.typeUrl || Array.isArray(o.supply) && (!o.supply.length || Coin.isSDK(o.supply[0]))); + }, + isAmino(o: any): o is QueryTotalSupplyResponseAmino { + return o && (o.$typeUrl === QueryTotalSupplyResponse.typeUrl || Array.isArray(o.supply) && (!o.supply.length || Coin.isAmino(o.supply[0]))); + }, encode(message: QueryTotalSupplyResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.supply) { Coin.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -1595,6 +1707,13 @@ export const QueryTotalSupplyResponse = { typeUrl: "/cosmos.bank.v1beta1.QueryTotalSupplyResponse", value: QueryTotalSupplyResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryTotalSupplyResponse.typeUrl)) { + return; + } + Coin.registerTypeUrl(); + PageResponse.registerTypeUrl(); } }; function createBaseQuerySupplyOfRequest(): QuerySupplyOfRequest { @@ -1611,6 +1730,15 @@ function createBaseQuerySupplyOfRequest(): QuerySupplyOfRequest { export const QuerySupplyOfRequest = { typeUrl: "/cosmos.bank.v1beta1.QuerySupplyOfRequest", aminoType: "cosmos-sdk/QuerySupplyOfRequest", + is(o: any): o is QuerySupplyOfRequest { + return o && (o.$typeUrl === QuerySupplyOfRequest.typeUrl || typeof o.denom === "string"); + }, + isSDK(o: any): o is QuerySupplyOfRequestSDKType { + return o && (o.$typeUrl === QuerySupplyOfRequest.typeUrl || typeof o.denom === "string"); + }, + isAmino(o: any): o is QuerySupplyOfRequestAmino { + return o && (o.$typeUrl === QuerySupplyOfRequest.typeUrl || typeof o.denom === "string"); + }, encode(message: QuerySupplyOfRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.denom !== "") { writer.uint32(10).string(message.denom); @@ -1677,7 +1805,8 @@ export const QuerySupplyOfRequest = { typeUrl: "/cosmos.bank.v1beta1.QuerySupplyOfRequest", value: QuerySupplyOfRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQuerySupplyOfResponse(): QuerySupplyOfResponse { return { @@ -1693,6 +1822,15 @@ function createBaseQuerySupplyOfResponse(): QuerySupplyOfResponse { export const QuerySupplyOfResponse = { typeUrl: "/cosmos.bank.v1beta1.QuerySupplyOfResponse", aminoType: "cosmos-sdk/QuerySupplyOfResponse", + is(o: any): o is QuerySupplyOfResponse { + return o && (o.$typeUrl === QuerySupplyOfResponse.typeUrl || Coin.is(o.amount)); + }, + isSDK(o: any): o is QuerySupplyOfResponseSDKType { + return o && (o.$typeUrl === QuerySupplyOfResponse.typeUrl || Coin.isSDK(o.amount)); + }, + isAmino(o: any): o is QuerySupplyOfResponseAmino { + return o && (o.$typeUrl === QuerySupplyOfResponse.typeUrl || Coin.isAmino(o.amount)); + }, encode(message: QuerySupplyOfResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.amount !== undefined) { Coin.encode(message.amount, writer.uint32(10).fork()).ldelim(); @@ -1761,6 +1899,12 @@ export const QuerySupplyOfResponse = { typeUrl: "/cosmos.bank.v1beta1.QuerySupplyOfResponse", value: QuerySupplyOfResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QuerySupplyOfResponse.typeUrl)) { + return; + } + Coin.registerTypeUrl(); } }; function createBaseQueryParamsRequest(): QueryParamsRequest { @@ -1775,6 +1919,15 @@ function createBaseQueryParamsRequest(): QueryParamsRequest { export const QueryParamsRequest = { typeUrl: "/cosmos.bank.v1beta1.QueryParamsRequest", aminoType: "cosmos-sdk/QueryParamsRequest", + is(o: any): o is QueryParamsRequest { + return o && o.$typeUrl === QueryParamsRequest.typeUrl; + }, + isSDK(o: any): o is QueryParamsRequestSDKType { + return o && o.$typeUrl === QueryParamsRequest.typeUrl; + }, + isAmino(o: any): o is QueryParamsRequestAmino { + return o && o.$typeUrl === QueryParamsRequest.typeUrl; + }, encode(_: QueryParamsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -1826,7 +1979,8 @@ export const QueryParamsRequest = { typeUrl: "/cosmos.bank.v1beta1.QueryParamsRequest", value: QueryParamsRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryParamsResponse(): QueryParamsResponse { return { @@ -1842,6 +1996,15 @@ function createBaseQueryParamsResponse(): QueryParamsResponse { export const QueryParamsResponse = { typeUrl: "/cosmos.bank.v1beta1.QueryParamsResponse", aminoType: "cosmos-sdk/QueryParamsResponse", + is(o: any): o is QueryParamsResponse { + return o && (o.$typeUrl === QueryParamsResponse.typeUrl || Params.is(o.params)); + }, + isSDK(o: any): o is QueryParamsResponseSDKType { + return o && (o.$typeUrl === QueryParamsResponse.typeUrl || Params.isSDK(o.params)); + }, + isAmino(o: any): o is QueryParamsResponseAmino { + return o && (o.$typeUrl === QueryParamsResponse.typeUrl || Params.isAmino(o.params)); + }, encode(message: QueryParamsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.params !== undefined) { Params.encode(message.params, writer.uint32(10).fork()).ldelim(); @@ -1910,6 +2073,12 @@ export const QueryParamsResponse = { typeUrl: "/cosmos.bank.v1beta1.QueryParamsResponse", value: QueryParamsResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryParamsResponse.typeUrl)) { + return; + } + Params.registerTypeUrl(); } }; function createBaseQueryDenomsMetadataRequest(): QueryDenomsMetadataRequest { @@ -1926,6 +2095,15 @@ function createBaseQueryDenomsMetadataRequest(): QueryDenomsMetadataRequest { export const QueryDenomsMetadataRequest = { typeUrl: "/cosmos.bank.v1beta1.QueryDenomsMetadataRequest", aminoType: "cosmos-sdk/QueryDenomsMetadataRequest", + is(o: any): o is QueryDenomsMetadataRequest { + return o && o.$typeUrl === QueryDenomsMetadataRequest.typeUrl; + }, + isSDK(o: any): o is QueryDenomsMetadataRequestSDKType { + return o && o.$typeUrl === QueryDenomsMetadataRequest.typeUrl; + }, + isAmino(o: any): o is QueryDenomsMetadataRequestAmino { + return o && o.$typeUrl === QueryDenomsMetadataRequest.typeUrl; + }, encode(message: QueryDenomsMetadataRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.pagination !== undefined) { PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); @@ -1994,6 +2172,12 @@ export const QueryDenomsMetadataRequest = { typeUrl: "/cosmos.bank.v1beta1.QueryDenomsMetadataRequest", value: QueryDenomsMetadataRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryDenomsMetadataRequest.typeUrl)) { + return; + } + PageRequest.registerTypeUrl(); } }; function createBaseQueryDenomsMetadataResponse(): QueryDenomsMetadataResponse { @@ -2012,6 +2196,15 @@ function createBaseQueryDenomsMetadataResponse(): QueryDenomsMetadataResponse { export const QueryDenomsMetadataResponse = { typeUrl: "/cosmos.bank.v1beta1.QueryDenomsMetadataResponse", aminoType: "cosmos-sdk/QueryDenomsMetadataResponse", + is(o: any): o is QueryDenomsMetadataResponse { + return o && (o.$typeUrl === QueryDenomsMetadataResponse.typeUrl || Array.isArray(o.metadatas) && (!o.metadatas.length || Metadata.is(o.metadatas[0]))); + }, + isSDK(o: any): o is QueryDenomsMetadataResponseSDKType { + return o && (o.$typeUrl === QueryDenomsMetadataResponse.typeUrl || Array.isArray(o.metadatas) && (!o.metadatas.length || Metadata.isSDK(o.metadatas[0]))); + }, + isAmino(o: any): o is QueryDenomsMetadataResponseAmino { + return o && (o.$typeUrl === QueryDenomsMetadataResponse.typeUrl || Array.isArray(o.metadatas) && (!o.metadatas.length || Metadata.isAmino(o.metadatas[0]))); + }, encode(message: QueryDenomsMetadataResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.metadatas) { Metadata.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -2100,6 +2293,13 @@ export const QueryDenomsMetadataResponse = { typeUrl: "/cosmos.bank.v1beta1.QueryDenomsMetadataResponse", value: QueryDenomsMetadataResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryDenomsMetadataResponse.typeUrl)) { + return; + } + Metadata.registerTypeUrl(); + PageResponse.registerTypeUrl(); } }; function createBaseQueryDenomMetadataRequest(): QueryDenomMetadataRequest { @@ -2116,6 +2316,15 @@ function createBaseQueryDenomMetadataRequest(): QueryDenomMetadataRequest { export const QueryDenomMetadataRequest = { typeUrl: "/cosmos.bank.v1beta1.QueryDenomMetadataRequest", aminoType: "cosmos-sdk/QueryDenomMetadataRequest", + is(o: any): o is QueryDenomMetadataRequest { + return o && (o.$typeUrl === QueryDenomMetadataRequest.typeUrl || typeof o.denom === "string"); + }, + isSDK(o: any): o is QueryDenomMetadataRequestSDKType { + return o && (o.$typeUrl === QueryDenomMetadataRequest.typeUrl || typeof o.denom === "string"); + }, + isAmino(o: any): o is QueryDenomMetadataRequestAmino { + return o && (o.$typeUrl === QueryDenomMetadataRequest.typeUrl || typeof o.denom === "string"); + }, encode(message: QueryDenomMetadataRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.denom !== "") { writer.uint32(10).string(message.denom); @@ -2182,7 +2391,8 @@ export const QueryDenomMetadataRequest = { typeUrl: "/cosmos.bank.v1beta1.QueryDenomMetadataRequest", value: QueryDenomMetadataRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryDenomMetadataResponse(): QueryDenomMetadataResponse { return { @@ -2199,6 +2409,15 @@ function createBaseQueryDenomMetadataResponse(): QueryDenomMetadataResponse { export const QueryDenomMetadataResponse = { typeUrl: "/cosmos.bank.v1beta1.QueryDenomMetadataResponse", aminoType: "cosmos-sdk/QueryDenomMetadataResponse", + is(o: any): o is QueryDenomMetadataResponse { + return o && (o.$typeUrl === QueryDenomMetadataResponse.typeUrl || Metadata.is(o.metadata)); + }, + isSDK(o: any): o is QueryDenomMetadataResponseSDKType { + return o && (o.$typeUrl === QueryDenomMetadataResponse.typeUrl || Metadata.isSDK(o.metadata)); + }, + isAmino(o: any): o is QueryDenomMetadataResponseAmino { + return o && (o.$typeUrl === QueryDenomMetadataResponse.typeUrl || Metadata.isAmino(o.metadata)); + }, encode(message: QueryDenomMetadataResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.metadata !== undefined) { Metadata.encode(message.metadata, writer.uint32(10).fork()).ldelim(); @@ -2267,6 +2486,12 @@ export const QueryDenomMetadataResponse = { typeUrl: "/cosmos.bank.v1beta1.QueryDenomMetadataResponse", value: QueryDenomMetadataResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryDenomMetadataResponse.typeUrl)) { + return; + } + Metadata.registerTypeUrl(); } }; function createBaseQueryDenomOwnersRequest(): QueryDenomOwnersRequest { @@ -2286,6 +2511,15 @@ function createBaseQueryDenomOwnersRequest(): QueryDenomOwnersRequest { export const QueryDenomOwnersRequest = { typeUrl: "/cosmos.bank.v1beta1.QueryDenomOwnersRequest", aminoType: "cosmos-sdk/QueryDenomOwnersRequest", + is(o: any): o is QueryDenomOwnersRequest { + return o && (o.$typeUrl === QueryDenomOwnersRequest.typeUrl || typeof o.denom === "string"); + }, + isSDK(o: any): o is QueryDenomOwnersRequestSDKType { + return o && (o.$typeUrl === QueryDenomOwnersRequest.typeUrl || typeof o.denom === "string"); + }, + isAmino(o: any): o is QueryDenomOwnersRequestAmino { + return o && (o.$typeUrl === QueryDenomOwnersRequest.typeUrl || typeof o.denom === "string"); + }, encode(message: QueryDenomOwnersRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.denom !== "") { writer.uint32(10).string(message.denom); @@ -2368,6 +2602,12 @@ export const QueryDenomOwnersRequest = { typeUrl: "/cosmos.bank.v1beta1.QueryDenomOwnersRequest", value: QueryDenomOwnersRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryDenomOwnersRequest.typeUrl)) { + return; + } + PageRequest.registerTypeUrl(); } }; function createBaseDenomOwner(): DenomOwner { @@ -2387,6 +2627,15 @@ function createBaseDenomOwner(): DenomOwner { export const DenomOwner = { typeUrl: "/cosmos.bank.v1beta1.DenomOwner", aminoType: "cosmos-sdk/DenomOwner", + is(o: any): o is DenomOwner { + return o && (o.$typeUrl === DenomOwner.typeUrl || typeof o.address === "string" && Coin.is(o.balance)); + }, + isSDK(o: any): o is DenomOwnerSDKType { + return o && (o.$typeUrl === DenomOwner.typeUrl || typeof o.address === "string" && Coin.isSDK(o.balance)); + }, + isAmino(o: any): o is DenomOwnerAmino { + return o && (o.$typeUrl === DenomOwner.typeUrl || typeof o.address === "string" && Coin.isAmino(o.balance)); + }, encode(message: DenomOwner, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.address !== "") { writer.uint32(10).string(message.address); @@ -2469,6 +2718,12 @@ export const DenomOwner = { typeUrl: "/cosmos.bank.v1beta1.DenomOwner", value: DenomOwner.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(DenomOwner.typeUrl)) { + return; + } + Coin.registerTypeUrl(); } }; function createBaseQueryDenomOwnersResponse(): QueryDenomOwnersResponse { @@ -2486,6 +2741,15 @@ function createBaseQueryDenomOwnersResponse(): QueryDenomOwnersResponse { export const QueryDenomOwnersResponse = { typeUrl: "/cosmos.bank.v1beta1.QueryDenomOwnersResponse", aminoType: "cosmos-sdk/QueryDenomOwnersResponse", + is(o: any): o is QueryDenomOwnersResponse { + return o && (o.$typeUrl === QueryDenomOwnersResponse.typeUrl || Array.isArray(o.denomOwners) && (!o.denomOwners.length || DenomOwner.is(o.denomOwners[0]))); + }, + isSDK(o: any): o is QueryDenomOwnersResponseSDKType { + return o && (o.$typeUrl === QueryDenomOwnersResponse.typeUrl || Array.isArray(o.denom_owners) && (!o.denom_owners.length || DenomOwner.isSDK(o.denom_owners[0]))); + }, + isAmino(o: any): o is QueryDenomOwnersResponseAmino { + return o && (o.$typeUrl === QueryDenomOwnersResponse.typeUrl || Array.isArray(o.denom_owners) && (!o.denom_owners.length || DenomOwner.isAmino(o.denom_owners[0]))); + }, encode(message: QueryDenomOwnersResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.denomOwners) { DenomOwner.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -2574,5 +2838,12 @@ export const QueryDenomOwnersResponse = { typeUrl: "/cosmos.bank.v1beta1.QueryDenomOwnersResponse", value: QueryDenomOwnersResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryDenomOwnersResponse.typeUrl)) { + return; + } + DenomOwner.registerTypeUrl(); + PageResponse.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/cosmos/bank/v1beta1/tx.registry.ts b/__fixtures__/v-next/outputv3/cosmos/bank/v1beta1/tx.registry.ts index 26ab9e5355..6a401233e9 100644 --- a/__fixtures__/v-next/outputv3/cosmos/bank/v1beta1/tx.registry.ts +++ b/__fixtures__/v-next/outputv3/cosmos/bank/v1beta1/tx.registry.ts @@ -1,13 +1,8 @@ import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; import { Input, InputSDKType, Output, OutputSDKType } from "./bank"; -import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { TelescopeGeneratedType } from "../../../types"; import { MsgSend, MsgSendSDKType, MsgMultiSend, MsgMultiSendSDKType } from "./tx"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/cosmos.bank.v1beta1.MsgSend", MsgSend], ["/cosmos.bank.v1beta1.MsgMultiSend", MsgMultiSend]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/cosmos.bank.v1beta1.MsgSend", MsgSend], ["/cosmos.bank.v1beta1.MsgMultiSend", MsgMultiSend]]; export const MessageComposer = { encoded: { send(value: MsgSend) { diff --git a/__fixtures__/v-next/outputv3/cosmos/bank/v1beta1/tx.rpc.func.ts b/__fixtures__/v-next/outputv3/cosmos/bank/v1beta1/tx.rpc.func.ts new file mode 100644 index 0000000000..3c274e156d --- /dev/null +++ b/__fixtures__/v-next/outputv3/cosmos/bank/v1beta1/tx.rpc.func.ts @@ -0,0 +1,22 @@ +import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; +import { Input, InputSDKType, Output, OutputSDKType } from "./bank"; +import { buildTx } from "../../../helper-func-types"; +import { MsgSend, MsgSendSDKType, MsgSendResponse, MsgSendResponseSDKType, MsgMultiSend, MsgMultiSendSDKType, MsgMultiSendResponse, MsgMultiSendResponseSDKType } from "./tx"; +/** + * Send defines a method for sending coins from one account to another account. + * @name send + * @package cosmos.bank.v1beta1 + * @see proto service: cosmos.bank.v1beta1.Send + */ +export const send = buildTx({ + msg: MsgSend +}); +/** + * MultiSend defines a method for sending coins from some accounts to other accounts. + * @name multiSend + * @package cosmos.bank.v1beta1 + * @see proto service: cosmos.bank.v1beta1.MultiSend + */ +export const multiSend = buildTx({ + msg: MsgMultiSend +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/cosmos/bank/v1beta1/tx.ts b/__fixtures__/v-next/outputv3/cosmos/bank/v1beta1/tx.ts index f37d076c7d..4900cf66cb 100644 --- a/__fixtures__/v-next/outputv3/cosmos/bank/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputv3/cosmos/bank/v1beta1/tx.ts @@ -2,6 +2,7 @@ import { Coin, CoinAmino, CoinSDKType } from "../../base/v1beta1/coin"; import { Input, InputAmino, InputSDKType, Output, OutputAmino, OutputSDKType } from "./bank"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { isSet, DeepPartial } from "../../../helpers"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "cosmos.bank.v1beta1"; /** * MsgSend represents a message to send coins from one account to another. @@ -140,6 +141,15 @@ function createBaseMsgSend(): MsgSend { export const MsgSend = { typeUrl: "/cosmos.bank.v1beta1.MsgSend", aminoType: "cosmos-sdk/MsgSend", + is(o: any): o is MsgSend { + return o && (o.$typeUrl === MsgSend.typeUrl || typeof o.fromAddress === "string" && typeof o.toAddress === "string" && Array.isArray(o.amount) && (!o.amount.length || Coin.is(o.amount[0]))); + }, + isSDK(o: any): o is MsgSendSDKType { + return o && (o.$typeUrl === MsgSend.typeUrl || typeof o.from_address === "string" && typeof o.to_address === "string" && Array.isArray(o.amount) && (!o.amount.length || Coin.isSDK(o.amount[0]))); + }, + isAmino(o: any): o is MsgSendAmino { + return o && (o.$typeUrl === MsgSend.typeUrl || typeof o.from_address === "string" && typeof o.to_address === "string" && Array.isArray(o.amount) && (!o.amount.length || Coin.isAmino(o.amount[0]))); + }, encode(message: MsgSend, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.fromAddress !== "") { writer.uint32(10).string(message.fromAddress); @@ -240,6 +250,12 @@ export const MsgSend = { typeUrl: "/cosmos.bank.v1beta1.MsgSend", value: MsgSend.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgSend.typeUrl)) { + return; + } + Coin.registerTypeUrl(); } }; function createBaseMsgSendResponse(): MsgSendResponse { @@ -254,6 +270,15 @@ function createBaseMsgSendResponse(): MsgSendResponse { export const MsgSendResponse = { typeUrl: "/cosmos.bank.v1beta1.MsgSendResponse", aminoType: "cosmos-sdk/MsgSendResponse", + is(o: any): o is MsgSendResponse { + return o && o.$typeUrl === MsgSendResponse.typeUrl; + }, + isSDK(o: any): o is MsgSendResponseSDKType { + return o && o.$typeUrl === MsgSendResponse.typeUrl; + }, + isAmino(o: any): o is MsgSendResponseAmino { + return o && o.$typeUrl === MsgSendResponse.typeUrl; + }, encode(_: MsgSendResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -305,7 +330,8 @@ export const MsgSendResponse = { typeUrl: "/cosmos.bank.v1beta1.MsgSendResponse", value: MsgSendResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgMultiSend(): MsgMultiSend { return { @@ -322,6 +348,15 @@ function createBaseMsgMultiSend(): MsgMultiSend { export const MsgMultiSend = { typeUrl: "/cosmos.bank.v1beta1.MsgMultiSend", aminoType: "cosmos-sdk/MsgMultiSend", + is(o: any): o is MsgMultiSend { + return o && (o.$typeUrl === MsgMultiSend.typeUrl || Array.isArray(o.inputs) && (!o.inputs.length || Input.is(o.inputs[0])) && Array.isArray(o.outputs) && (!o.outputs.length || Output.is(o.outputs[0]))); + }, + isSDK(o: any): o is MsgMultiSendSDKType { + return o && (o.$typeUrl === MsgMultiSend.typeUrl || Array.isArray(o.inputs) && (!o.inputs.length || Input.isSDK(o.inputs[0])) && Array.isArray(o.outputs) && (!o.outputs.length || Output.isSDK(o.outputs[0]))); + }, + isAmino(o: any): o is MsgMultiSendAmino { + return o && (o.$typeUrl === MsgMultiSend.typeUrl || Array.isArray(o.inputs) && (!o.inputs.length || Input.isAmino(o.inputs[0])) && Array.isArray(o.outputs) && (!o.outputs.length || Output.isAmino(o.outputs[0]))); + }, encode(message: MsgMultiSend, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.inputs) { Input.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -414,6 +449,13 @@ export const MsgMultiSend = { typeUrl: "/cosmos.bank.v1beta1.MsgMultiSend", value: MsgMultiSend.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgMultiSend.typeUrl)) { + return; + } + Input.registerTypeUrl(); + Output.registerTypeUrl(); } }; function createBaseMsgMultiSendResponse(): MsgMultiSendResponse { @@ -428,6 +470,15 @@ function createBaseMsgMultiSendResponse(): MsgMultiSendResponse { export const MsgMultiSendResponse = { typeUrl: "/cosmos.bank.v1beta1.MsgMultiSendResponse", aminoType: "cosmos-sdk/MsgMultiSendResponse", + is(o: any): o is MsgMultiSendResponse { + return o && o.$typeUrl === MsgMultiSendResponse.typeUrl; + }, + isSDK(o: any): o is MsgMultiSendResponseSDKType { + return o && o.$typeUrl === MsgMultiSendResponse.typeUrl; + }, + isAmino(o: any): o is MsgMultiSendResponseAmino { + return o && o.$typeUrl === MsgMultiSendResponse.typeUrl; + }, encode(_: MsgMultiSendResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -479,5 +530,6 @@ export const MsgMultiSendResponse = { typeUrl: "/cosmos.bank.v1beta1.MsgMultiSendResponse", value: MsgMultiSendResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/cosmos/base/abci/v1beta1/abci.ts b/__fixtures__/v-next/outputv3/cosmos/base/abci/v1beta1/abci.ts index 13773429c4..6e322e93ce 100644 --- a/__fixtures__/v-next/outputv3/cosmos/base/abci/v1beta1/abci.ts +++ b/__fixtures__/v-next/outputv3/cosmos/base/abci/v1beta1/abci.ts @@ -1,6 +1,7 @@ import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../../google/protobuf/any"; import { Event, EventAmino, EventSDKType } from "../../../../tendermint/abci/types"; import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { GlobalDecoderRegistry } from "../../../../registry"; import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../../helpers"; export const protobufPackage = "cosmos.base.abci.v1beta1"; /** @@ -657,6 +658,15 @@ function createBaseTxResponse(): TxResponse { export const TxResponse = { typeUrl: "/cosmos.base.abci.v1beta1.TxResponse", aminoType: "cosmos-sdk/TxResponse", + is(o: any): o is TxResponse { + return o && (o.$typeUrl === TxResponse.typeUrl || typeof o.height === "bigint" && typeof o.txhash === "string" && typeof o.codespace === "string" && typeof o.code === "number" && typeof o.data === "string" && typeof o.rawLog === "string" && Array.isArray(o.logs) && (!o.logs.length || ABCIMessageLog.is(o.logs[0])) && typeof o.info === "string" && typeof o.gasWanted === "bigint" && typeof o.gasUsed === "bigint" && typeof o.timestamp === "string" && Array.isArray(o.events) && (!o.events.length || Event.is(o.events[0]))); + }, + isSDK(o: any): o is TxResponseSDKType { + return o && (o.$typeUrl === TxResponse.typeUrl || typeof o.height === "bigint" && typeof o.txhash === "string" && typeof o.codespace === "string" && typeof o.code === "number" && typeof o.data === "string" && typeof o.raw_log === "string" && Array.isArray(o.logs) && (!o.logs.length || ABCIMessageLog.isSDK(o.logs[0])) && typeof o.info === "string" && typeof o.gas_wanted === "bigint" && typeof o.gas_used === "bigint" && typeof o.timestamp === "string" && Array.isArray(o.events) && (!o.events.length || Event.isSDK(o.events[0]))); + }, + isAmino(o: any): o is TxResponseAmino { + return o && (o.$typeUrl === TxResponse.typeUrl || typeof o.height === "bigint" && typeof o.txhash === "string" && typeof o.codespace === "string" && typeof o.code === "number" && typeof o.data === "string" && typeof o.raw_log === "string" && Array.isArray(o.logs) && (!o.logs.length || ABCIMessageLog.isAmino(o.logs[0])) && typeof o.info === "string" && typeof o.gas_wanted === "bigint" && typeof o.gas_used === "bigint" && typeof o.timestamp === "string" && Array.isArray(o.events) && (!o.events.length || Event.isAmino(o.events[0]))); + }, encode(message: TxResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.height !== BigInt(0)) { writer.uint32(8).int64(message.height); @@ -911,6 +921,12 @@ export const TxResponse = { typeUrl: "/cosmos.base.abci.v1beta1.TxResponse", value: TxResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(TxResponse.typeUrl)) { + return; + } + Event.registerTypeUrl(); } }; function createBaseABCIMessageLog(): ABCIMessageLog { @@ -929,6 +945,15 @@ function createBaseABCIMessageLog(): ABCIMessageLog { export const ABCIMessageLog = { typeUrl: "/cosmos.base.abci.v1beta1.ABCIMessageLog", aminoType: "cosmos-sdk/ABCIMessageLog", + is(o: any): o is ABCIMessageLog { + return o && (o.$typeUrl === ABCIMessageLog.typeUrl || typeof o.msgIndex === "number" && typeof o.log === "string" && Array.isArray(o.events) && (!o.events.length || StringEvent.is(o.events[0]))); + }, + isSDK(o: any): o is ABCIMessageLogSDKType { + return o && (o.$typeUrl === ABCIMessageLog.typeUrl || typeof o.msg_index === "number" && typeof o.log === "string" && Array.isArray(o.events) && (!o.events.length || StringEvent.isSDK(o.events[0]))); + }, + isAmino(o: any): o is ABCIMessageLogAmino { + return o && (o.$typeUrl === ABCIMessageLog.typeUrl || typeof o.msg_index === "number" && typeof o.log === "string" && Array.isArray(o.events) && (!o.events.length || StringEvent.isAmino(o.events[0]))); + }, encode(message: ABCIMessageLog, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.msgIndex !== 0) { writer.uint32(8).uint32(message.msgIndex); @@ -1029,6 +1054,12 @@ export const ABCIMessageLog = { typeUrl: "/cosmos.base.abci.v1beta1.ABCIMessageLog", value: ABCIMessageLog.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ABCIMessageLog.typeUrl)) { + return; + } + StringEvent.registerTypeUrl(); } }; function createBaseStringEvent(): StringEvent { @@ -1047,6 +1078,15 @@ function createBaseStringEvent(): StringEvent { export const StringEvent = { typeUrl: "/cosmos.base.abci.v1beta1.StringEvent", aminoType: "cosmos-sdk/StringEvent", + is(o: any): o is StringEvent { + return o && (o.$typeUrl === StringEvent.typeUrl || typeof o.type === "string" && Array.isArray(o.attributes) && (!o.attributes.length || Attribute.is(o.attributes[0]))); + }, + isSDK(o: any): o is StringEventSDKType { + return o && (o.$typeUrl === StringEvent.typeUrl || typeof o.type === "string" && Array.isArray(o.attributes) && (!o.attributes.length || Attribute.isSDK(o.attributes[0]))); + }, + isAmino(o: any): o is StringEventAmino { + return o && (o.$typeUrl === StringEvent.typeUrl || typeof o.type === "string" && Array.isArray(o.attributes) && (!o.attributes.length || Attribute.isAmino(o.attributes[0]))); + }, encode(message: StringEvent, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.type !== "") { writer.uint32(10).string(message.type); @@ -1133,6 +1173,12 @@ export const StringEvent = { typeUrl: "/cosmos.base.abci.v1beta1.StringEvent", value: StringEvent.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(StringEvent.typeUrl)) { + return; + } + Attribute.registerTypeUrl(); } }; function createBaseAttribute(): Attribute { @@ -1151,6 +1197,15 @@ function createBaseAttribute(): Attribute { export const Attribute = { typeUrl: "/cosmos.base.abci.v1beta1.Attribute", aminoType: "cosmos-sdk/Attribute", + is(o: any): o is Attribute { + return o && (o.$typeUrl === Attribute.typeUrl || typeof o.key === "string" && typeof o.value === "string"); + }, + isSDK(o: any): o is AttributeSDKType { + return o && (o.$typeUrl === Attribute.typeUrl || typeof o.key === "string" && typeof o.value === "string"); + }, + isAmino(o: any): o is AttributeAmino { + return o && (o.$typeUrl === Attribute.typeUrl || typeof o.key === "string" && typeof o.value === "string"); + }, encode(message: Attribute, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.key !== "") { writer.uint32(10).string(message.key); @@ -1231,7 +1286,8 @@ export const Attribute = { typeUrl: "/cosmos.base.abci.v1beta1.Attribute", value: Attribute.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseGasInfo(): GasInfo { return { @@ -1248,6 +1304,15 @@ function createBaseGasInfo(): GasInfo { export const GasInfo = { typeUrl: "/cosmos.base.abci.v1beta1.GasInfo", aminoType: "cosmos-sdk/GasInfo", + is(o: any): o is GasInfo { + return o && (o.$typeUrl === GasInfo.typeUrl || typeof o.gasWanted === "bigint" && typeof o.gasUsed === "bigint"); + }, + isSDK(o: any): o is GasInfoSDKType { + return o && (o.$typeUrl === GasInfo.typeUrl || typeof o.gas_wanted === "bigint" && typeof o.gas_used === "bigint"); + }, + isAmino(o: any): o is GasInfoAmino { + return o && (o.$typeUrl === GasInfo.typeUrl || typeof o.gas_wanted === "bigint" && typeof o.gas_used === "bigint"); + }, encode(message: GasInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.gasWanted !== BigInt(0)) { writer.uint32(8).uint64(message.gasWanted); @@ -1332,7 +1397,8 @@ export const GasInfo = { typeUrl: "/cosmos.base.abci.v1beta1.GasInfo", value: GasInfo.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseResult(): Result { return { @@ -1351,6 +1417,15 @@ function createBaseResult(): Result { export const Result = { typeUrl: "/cosmos.base.abci.v1beta1.Result", aminoType: "cosmos-sdk/Result", + is(o: any): o is Result { + return o && (o.$typeUrl === Result.typeUrl || (o.data instanceof Uint8Array || typeof o.data === "string") && typeof o.log === "string" && Array.isArray(o.events) && (!o.events.length || Event.is(o.events[0])) && Array.isArray(o.msgResponses) && (!o.msgResponses.length || Any.is(o.msgResponses[0]))); + }, + isSDK(o: any): o is ResultSDKType { + return o && (o.$typeUrl === Result.typeUrl || (o.data instanceof Uint8Array || typeof o.data === "string") && typeof o.log === "string" && Array.isArray(o.events) && (!o.events.length || Event.isSDK(o.events[0])) && Array.isArray(o.msg_responses) && (!o.msg_responses.length || Any.isSDK(o.msg_responses[0]))); + }, + isAmino(o: any): o is ResultAmino { + return o && (o.$typeUrl === Result.typeUrl || (o.data instanceof Uint8Array || typeof o.data === "string") && typeof o.log === "string" && Array.isArray(o.events) && (!o.events.length || Event.isAmino(o.events[0])) && Array.isArray(o.msg_responses) && (!o.msg_responses.length || Any.isAmino(o.msg_responses[0]))); + }, encode(message: Result, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.data.length !== 0) { writer.uint32(10).bytes(message.data); @@ -1471,7 +1546,8 @@ export const Result = { typeUrl: "/cosmos.base.abci.v1beta1.Result", value: Result.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseSimulationResponse(): SimulationResponse { return { @@ -1489,6 +1565,15 @@ function createBaseSimulationResponse(): SimulationResponse { export const SimulationResponse = { typeUrl: "/cosmos.base.abci.v1beta1.SimulationResponse", aminoType: "cosmos-sdk/SimulationResponse", + is(o: any): o is SimulationResponse { + return o && (o.$typeUrl === SimulationResponse.typeUrl || GasInfo.is(o.gasInfo)); + }, + isSDK(o: any): o is SimulationResponseSDKType { + return o && (o.$typeUrl === SimulationResponse.typeUrl || GasInfo.isSDK(o.gas_info)); + }, + isAmino(o: any): o is SimulationResponseAmino { + return o && (o.$typeUrl === SimulationResponse.typeUrl || GasInfo.isAmino(o.gas_info)); + }, encode(message: SimulationResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.gasInfo !== undefined) { GasInfo.encode(message.gasInfo, writer.uint32(10).fork()).ldelim(); @@ -1573,6 +1658,13 @@ export const SimulationResponse = { typeUrl: "/cosmos.base.abci.v1beta1.SimulationResponse", value: SimulationResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(SimulationResponse.typeUrl)) { + return; + } + GasInfo.registerTypeUrl(); + Result.registerTypeUrl(); } }; function createBaseMsgData(): MsgData { @@ -1592,6 +1684,15 @@ function createBaseMsgData(): MsgData { export const MsgData = { typeUrl: "/cosmos.base.abci.v1beta1.MsgData", aminoType: "cosmos-sdk/MsgData", + is(o: any): o is MsgData { + return o && (o.$typeUrl === MsgData.typeUrl || typeof o.msgType === "string" && (o.data instanceof Uint8Array || typeof o.data === "string")); + }, + isSDK(o: any): o is MsgDataSDKType { + return o && (o.$typeUrl === MsgData.typeUrl || typeof o.msg_type === "string" && (o.data instanceof Uint8Array || typeof o.data === "string")); + }, + isAmino(o: any): o is MsgDataAmino { + return o && (o.$typeUrl === MsgData.typeUrl || typeof o.msg_type === "string" && (o.data instanceof Uint8Array || typeof o.data === "string")); + }, encode(message: MsgData, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.msgType !== "") { writer.uint32(10).string(message.msgType); @@ -1672,7 +1773,8 @@ export const MsgData = { typeUrl: "/cosmos.base.abci.v1beta1.MsgData", value: MsgData.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseTxMsgData(): TxMsgData { return { @@ -1690,6 +1792,15 @@ function createBaseTxMsgData(): TxMsgData { export const TxMsgData = { typeUrl: "/cosmos.base.abci.v1beta1.TxMsgData", aminoType: "cosmos-sdk/TxMsgData", + is(o: any): o is TxMsgData { + return o && (o.$typeUrl === TxMsgData.typeUrl || Array.isArray(o.data) && (!o.data.length || MsgData.is(o.data[0])) && Array.isArray(o.msgResponses) && (!o.msgResponses.length || Any.is(o.msgResponses[0]))); + }, + isSDK(o: any): o is TxMsgDataSDKType { + return o && (o.$typeUrl === TxMsgData.typeUrl || Array.isArray(o.data) && (!o.data.length || MsgData.isSDK(o.data[0])) && Array.isArray(o.msg_responses) && (!o.msg_responses.length || Any.isSDK(o.msg_responses[0]))); + }, + isAmino(o: any): o is TxMsgDataAmino { + return o && (o.$typeUrl === TxMsgData.typeUrl || Array.isArray(o.data) && (!o.data.length || MsgData.isAmino(o.data[0])) && Array.isArray(o.msg_responses) && (!o.msg_responses.length || Any.isAmino(o.msg_responses[0]))); + }, encode(message: TxMsgData, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.data) { MsgData.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -1782,7 +1893,8 @@ export const TxMsgData = { typeUrl: "/cosmos.base.abci.v1beta1.TxMsgData", value: TxMsgData.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseSearchTxsResult(): SearchTxsResult { return { @@ -1803,6 +1915,15 @@ function createBaseSearchTxsResult(): SearchTxsResult { export const SearchTxsResult = { typeUrl: "/cosmos.base.abci.v1beta1.SearchTxsResult", aminoType: "cosmos-sdk/SearchTxsResult", + is(o: any): o is SearchTxsResult { + return o && (o.$typeUrl === SearchTxsResult.typeUrl || typeof o.totalCount === "bigint" && typeof o.count === "bigint" && typeof o.pageNumber === "bigint" && typeof o.pageTotal === "bigint" && typeof o.limit === "bigint" && Array.isArray(o.txs) && (!o.txs.length || TxResponse.is(o.txs[0]))); + }, + isSDK(o: any): o is SearchTxsResultSDKType { + return o && (o.$typeUrl === SearchTxsResult.typeUrl || typeof o.total_count === "bigint" && typeof o.count === "bigint" && typeof o.page_number === "bigint" && typeof o.page_total === "bigint" && typeof o.limit === "bigint" && Array.isArray(o.txs) && (!o.txs.length || TxResponse.isSDK(o.txs[0]))); + }, + isAmino(o: any): o is SearchTxsResultAmino { + return o && (o.$typeUrl === SearchTxsResult.typeUrl || typeof o.total_count === "bigint" && typeof o.count === "bigint" && typeof o.page_number === "bigint" && typeof o.page_total === "bigint" && typeof o.limit === "bigint" && Array.isArray(o.txs) && (!o.txs.length || TxResponse.isAmino(o.txs[0]))); + }, encode(message: SearchTxsResult, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.totalCount !== BigInt(0)) { writer.uint32(8).uint64(message.totalCount); @@ -1955,5 +2076,11 @@ export const SearchTxsResult = { typeUrl: "/cosmos.base.abci.v1beta1.SearchTxsResult", value: SearchTxsResult.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(SearchTxsResult.typeUrl)) { + return; + } + TxResponse.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/cosmos/base/kv/v1beta1/kv.ts b/__fixtures__/v-next/outputv3/cosmos/base/kv/v1beta1/kv.ts index 173d643e0c..ecb2cb3328 100644 --- a/__fixtures__/v-next/outputv3/cosmos/base/kv/v1beta1/kv.ts +++ b/__fixtures__/v-next/outputv3/cosmos/base/kv/v1beta1/kv.ts @@ -1,5 +1,6 @@ import { BinaryReader, BinaryWriter } from "../../../../binary"; import { DeepPartial, isSet, bytesFromBase64, base64FromBytes } from "../../../../helpers"; +import { GlobalDecoderRegistry } from "../../../../registry"; export const protobufPackage = "cosmos.base.kv.v1beta1"; /** * Pairs defines a repeated slice of Pair objects. @@ -80,6 +81,15 @@ function createBasePairs(): Pairs { export const Pairs = { typeUrl: "/cosmos.base.kv.v1beta1.Pairs", aminoType: "cosmos-sdk/Pairs", + is(o: any): o is Pairs { + return o && (o.$typeUrl === Pairs.typeUrl || Array.isArray(o.pairs) && (!o.pairs.length || Pair.is(o.pairs[0]))); + }, + isSDK(o: any): o is PairsSDKType { + return o && (o.$typeUrl === Pairs.typeUrl || Array.isArray(o.pairs) && (!o.pairs.length || Pair.isSDK(o.pairs[0]))); + }, + isAmino(o: any): o is PairsAmino { + return o && (o.$typeUrl === Pairs.typeUrl || Array.isArray(o.pairs) && (!o.pairs.length || Pair.isAmino(o.pairs[0]))); + }, encode(message: Pairs, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.pairs) { Pair.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -152,6 +162,12 @@ export const Pairs = { typeUrl: "/cosmos.base.kv.v1beta1.Pairs", value: Pairs.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Pairs.typeUrl)) { + return; + } + Pair.registerTypeUrl(); } }; function createBasePair(): Pair { @@ -169,6 +185,15 @@ function createBasePair(): Pair { export const Pair = { typeUrl: "/cosmos.base.kv.v1beta1.Pair", aminoType: "cosmos-sdk/Pair", + is(o: any): o is Pair { + return o && (o.$typeUrl === Pair.typeUrl || (o.key instanceof Uint8Array || typeof o.key === "string") && (o.value instanceof Uint8Array || typeof o.value === "string")); + }, + isSDK(o: any): o is PairSDKType { + return o && (o.$typeUrl === Pair.typeUrl || (o.key instanceof Uint8Array || typeof o.key === "string") && (o.value instanceof Uint8Array || typeof o.value === "string")); + }, + isAmino(o: any): o is PairAmino { + return o && (o.$typeUrl === Pair.typeUrl || (o.key instanceof Uint8Array || typeof o.key === "string") && (o.value instanceof Uint8Array || typeof o.value === "string")); + }, encode(message: Pair, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.key.length !== 0) { writer.uint32(10).bytes(message.key); @@ -249,5 +274,6 @@ export const Pair = { typeUrl: "/cosmos.base.kv.v1beta1.Pair", value: Pair.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/cosmos/base/query/v1beta1/pagination.ts b/__fixtures__/v-next/outputv3/cosmos/base/query/v1beta1/pagination.ts index 7d0ed59a7f..ae44cbeee6 100644 --- a/__fixtures__/v-next/outputv3/cosmos/base/query/v1beta1/pagination.ts +++ b/__fixtures__/v-next/outputv3/cosmos/base/query/v1beta1/pagination.ts @@ -206,6 +206,15 @@ function createBasePageRequest(): PageRequest { export const PageRequest = { typeUrl: "/cosmos.base.query.v1beta1.PageRequest", aminoType: "cosmos-sdk/PageRequest", + is(o: any): o is PageRequest { + return o && (o.$typeUrl === PageRequest.typeUrl || (o.key instanceof Uint8Array || typeof o.key === "string") && typeof o.offset === "bigint" && typeof o.limit === "bigint" && typeof o.countTotal === "boolean" && typeof o.reverse === "boolean"); + }, + isSDK(o: any): o is PageRequestSDKType { + return o && (o.$typeUrl === PageRequest.typeUrl || (o.key instanceof Uint8Array || typeof o.key === "string") && typeof o.offset === "bigint" && typeof o.limit === "bigint" && typeof o.count_total === "boolean" && typeof o.reverse === "boolean"); + }, + isAmino(o: any): o is PageRequestAmino { + return o && (o.$typeUrl === PageRequest.typeUrl || (o.key instanceof Uint8Array || typeof o.key === "string") && typeof o.offset === "bigint" && typeof o.limit === "bigint" && typeof o.count_total === "boolean" && typeof o.reverse === "boolean"); + }, encode(message: PageRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.key.length !== 0) { writer.uint32(10).bytes(message.key); @@ -332,7 +341,8 @@ export const PageRequest = { typeUrl: "/cosmos.base.query.v1beta1.PageRequest", value: PageRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBasePageResponse(): PageResponse { return { @@ -355,6 +365,15 @@ function createBasePageResponse(): PageResponse { export const PageResponse = { typeUrl: "/cosmos.base.query.v1beta1.PageResponse", aminoType: "cosmos-sdk/PageResponse", + is(o: any): o is PageResponse { + return o && (o.$typeUrl === PageResponse.typeUrl || (o.nextKey instanceof Uint8Array || typeof o.nextKey === "string") && typeof o.total === "bigint"); + }, + isSDK(o: any): o is PageResponseSDKType { + return o && (o.$typeUrl === PageResponse.typeUrl || (o.next_key instanceof Uint8Array || typeof o.next_key === "string") && typeof o.total === "bigint"); + }, + isAmino(o: any): o is PageResponseAmino { + return o && (o.$typeUrl === PageResponse.typeUrl || (o.next_key instanceof Uint8Array || typeof o.next_key === "string") && typeof o.total === "bigint"); + }, encode(message: PageResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.nextKey.length !== 0) { writer.uint32(10).bytes(message.nextKey); @@ -437,5 +456,6 @@ export const PageResponse = { typeUrl: "/cosmos.base.query.v1beta1.PageResponse", value: PageResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/cosmos/base/reflection/v1beta1/reflection.rpc.func.ts b/__fixtures__/v-next/outputv3/cosmos/base/reflection/v1beta1/reflection.rpc.func.ts new file mode 100644 index 0000000000..c8ff07aa09 --- /dev/null +++ b/__fixtures__/v-next/outputv3/cosmos/base/reflection/v1beta1/reflection.rpc.func.ts @@ -0,0 +1,30 @@ +import { EndpointOrRpc, buildQuery } from "../../../../helper-func-types"; +import { ListAllInterfacesRequest, ListAllInterfacesRequestSDKType, ListAllInterfacesResponse, ListAllInterfacesResponseSDKType, ListImplementationsRequest, ListImplementationsRequestSDKType, ListImplementationsResponse, ListImplementationsResponseSDKType } from "./reflection"; +/** + * ListAllInterfaces lists all the interfaces registered in the interface + * registry. + * @name getListAllInterfaces + * @package cosmos.base.reflection.v1beta1 + * @see proto service: cosmos.base.reflection.v1beta1.ListAllInterfaces + */ +export const getListAllInterfaces = buildQuery({ + encode: ListAllInterfacesRequest.encode, + decode: ListAllInterfacesResponse.decode, + service: "cosmos.base.reflection.v1beta1.ReflectionService", + method: "ListAllInterfaces", + deps: [ListAllInterfacesRequest, ListAllInterfacesResponse] +}); +/** + * ListImplementations list all the concrete types that implement a given + * interface. + * @name getListImplementations + * @package cosmos.base.reflection.v1beta1 + * @see proto service: cosmos.base.reflection.v1beta1.ListImplementations + */ +export const getListImplementations = buildQuery({ + encode: ListImplementationsRequest.encode, + decode: ListImplementationsResponse.decode, + service: "cosmos.base.reflection.v1beta1.ReflectionService", + method: "ListImplementations", + deps: [ListImplementationsRequest, ListImplementationsResponse] +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/cosmos/base/reflection/v1beta1/reflection.ts b/__fixtures__/v-next/outputv3/cosmos/base/reflection/v1beta1/reflection.ts index 1b57700324..1ded6bc052 100644 --- a/__fixtures__/v-next/outputv3/cosmos/base/reflection/v1beta1/reflection.ts +++ b/__fixtures__/v-next/outputv3/cosmos/base/reflection/v1beta1/reflection.ts @@ -149,6 +149,15 @@ function createBaseListAllInterfacesRequest(): ListAllInterfacesRequest { export const ListAllInterfacesRequest = { typeUrl: "/cosmos.base.reflection.v1beta1.ListAllInterfacesRequest", aminoType: "cosmos-sdk/ListAllInterfacesRequest", + is(o: any): o is ListAllInterfacesRequest { + return o && o.$typeUrl === ListAllInterfacesRequest.typeUrl; + }, + isSDK(o: any): o is ListAllInterfacesRequestSDKType { + return o && o.$typeUrl === ListAllInterfacesRequest.typeUrl; + }, + isAmino(o: any): o is ListAllInterfacesRequestAmino { + return o && o.$typeUrl === ListAllInterfacesRequest.typeUrl; + }, encode(_: ListAllInterfacesRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -200,7 +209,8 @@ export const ListAllInterfacesRequest = { typeUrl: "/cosmos.base.reflection.v1beta1.ListAllInterfacesRequest", value: ListAllInterfacesRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseListAllInterfacesResponse(): ListAllInterfacesResponse { return { @@ -216,6 +226,15 @@ function createBaseListAllInterfacesResponse(): ListAllInterfacesResponse { export const ListAllInterfacesResponse = { typeUrl: "/cosmos.base.reflection.v1beta1.ListAllInterfacesResponse", aminoType: "cosmos-sdk/ListAllInterfacesResponse", + is(o: any): o is ListAllInterfacesResponse { + return o && (o.$typeUrl === ListAllInterfacesResponse.typeUrl || Array.isArray(o.interfaceNames) && (!o.interfaceNames.length || typeof o.interfaceNames[0] === "string")); + }, + isSDK(o: any): o is ListAllInterfacesResponseSDKType { + return o && (o.$typeUrl === ListAllInterfacesResponse.typeUrl || Array.isArray(o.interface_names) && (!o.interface_names.length || typeof o.interface_names[0] === "string")); + }, + isAmino(o: any): o is ListAllInterfacesResponseAmino { + return o && (o.$typeUrl === ListAllInterfacesResponse.typeUrl || Array.isArray(o.interface_names) && (!o.interface_names.length || typeof o.interface_names[0] === "string")); + }, encode(message: ListAllInterfacesResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.interfaceNames) { writer.uint32(10).string(v!); @@ -288,7 +307,8 @@ export const ListAllInterfacesResponse = { typeUrl: "/cosmos.base.reflection.v1beta1.ListAllInterfacesResponse", value: ListAllInterfacesResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseListImplementationsRequest(): ListImplementationsRequest { return { @@ -305,6 +325,15 @@ function createBaseListImplementationsRequest(): ListImplementationsRequest { export const ListImplementationsRequest = { typeUrl: "/cosmos.base.reflection.v1beta1.ListImplementationsRequest", aminoType: "cosmos-sdk/ListImplementationsRequest", + is(o: any): o is ListImplementationsRequest { + return o && (o.$typeUrl === ListImplementationsRequest.typeUrl || typeof o.interfaceName === "string"); + }, + isSDK(o: any): o is ListImplementationsRequestSDKType { + return o && (o.$typeUrl === ListImplementationsRequest.typeUrl || typeof o.interface_name === "string"); + }, + isAmino(o: any): o is ListImplementationsRequestAmino { + return o && (o.$typeUrl === ListImplementationsRequest.typeUrl || typeof o.interface_name === "string"); + }, encode(message: ListImplementationsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.interfaceName !== "") { writer.uint32(10).string(message.interfaceName); @@ -371,7 +400,8 @@ export const ListImplementationsRequest = { typeUrl: "/cosmos.base.reflection.v1beta1.ListImplementationsRequest", value: ListImplementationsRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseListImplementationsResponse(): ListImplementationsResponse { return { @@ -388,6 +418,15 @@ function createBaseListImplementationsResponse(): ListImplementationsResponse { export const ListImplementationsResponse = { typeUrl: "/cosmos.base.reflection.v1beta1.ListImplementationsResponse", aminoType: "cosmos-sdk/ListImplementationsResponse", + is(o: any): o is ListImplementationsResponse { + return o && (o.$typeUrl === ListImplementationsResponse.typeUrl || Array.isArray(o.implementationMessageNames) && (!o.implementationMessageNames.length || typeof o.implementationMessageNames[0] === "string")); + }, + isSDK(o: any): o is ListImplementationsResponseSDKType { + return o && (o.$typeUrl === ListImplementationsResponse.typeUrl || Array.isArray(o.implementation_message_names) && (!o.implementation_message_names.length || typeof o.implementation_message_names[0] === "string")); + }, + isAmino(o: any): o is ListImplementationsResponseAmino { + return o && (o.$typeUrl === ListImplementationsResponse.typeUrl || Array.isArray(o.implementation_message_names) && (!o.implementation_message_names.length || typeof o.implementation_message_names[0] === "string")); + }, encode(message: ListImplementationsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.implementationMessageNames) { writer.uint32(10).string(v!); @@ -460,5 +499,6 @@ export const ListImplementationsResponse = { typeUrl: "/cosmos.base.reflection.v1beta1.ListImplementationsResponse", value: ListImplementationsResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/cosmos/base/reflection/v2alpha1/reflection.rpc.func.ts b/__fixtures__/v-next/outputv3/cosmos/base/reflection/v2alpha1/reflection.rpc.func.ts new file mode 100644 index 0000000000..a27dc56ec2 --- /dev/null +++ b/__fixtures__/v-next/outputv3/cosmos/base/reflection/v2alpha1/reflection.rpc.func.ts @@ -0,0 +1,82 @@ +import { EndpointOrRpc, buildQuery } from "../../../../helper-func-types"; +import { GetAuthnDescriptorRequest, GetAuthnDescriptorRequestSDKType, GetAuthnDescriptorResponse, GetAuthnDescriptorResponseSDKType, GetChainDescriptorRequest, GetChainDescriptorRequestSDKType, GetChainDescriptorResponse, GetChainDescriptorResponseSDKType, GetCodecDescriptorRequest, GetCodecDescriptorRequestSDKType, GetCodecDescriptorResponse, GetCodecDescriptorResponseSDKType, GetConfigurationDescriptorRequest, GetConfigurationDescriptorRequestSDKType, GetConfigurationDescriptorResponse, GetConfigurationDescriptorResponseSDKType, GetQueryServicesDescriptorRequest, GetQueryServicesDescriptorRequestSDKType, GetQueryServicesDescriptorResponse, GetQueryServicesDescriptorResponseSDKType, GetTxDescriptorRequest, GetTxDescriptorRequestSDKType, GetTxDescriptorResponse, GetTxDescriptorResponseSDKType } from "./reflection"; +/** + * GetAuthnDescriptor returns information on how to authenticate transactions in the application + * NOTE: this RPC is still experimental and might be subject to breaking changes or removal in + * future releases of the cosmos-sdk. + * @name getGetAuthnDescriptor + * @package cosmos.base.reflection.v2alpha1 + * @see proto service: cosmos.base.reflection.v2alpha1.GetAuthnDescriptor + */ +export const getGetAuthnDescriptor = buildQuery({ + encode: GetAuthnDescriptorRequest.encode, + decode: GetAuthnDescriptorResponse.decode, + service: "cosmos.base.reflection.v2alpha1.ReflectionService", + method: "GetAuthnDescriptor", + deps: [GetAuthnDescriptorRequest, GetAuthnDescriptorResponse] +}); +/** + * GetChainDescriptor returns the description of the chain + * @name getGetChainDescriptor + * @package cosmos.base.reflection.v2alpha1 + * @see proto service: cosmos.base.reflection.v2alpha1.GetChainDescriptor + */ +export const getGetChainDescriptor = buildQuery({ + encode: GetChainDescriptorRequest.encode, + decode: GetChainDescriptorResponse.decode, + service: "cosmos.base.reflection.v2alpha1.ReflectionService", + method: "GetChainDescriptor", + deps: [GetChainDescriptorRequest, GetChainDescriptorResponse] +}); +/** + * GetCodecDescriptor returns the descriptor of the codec of the application + * @name getGetCodecDescriptor + * @package cosmos.base.reflection.v2alpha1 + * @see proto service: cosmos.base.reflection.v2alpha1.GetCodecDescriptor + */ +export const getGetCodecDescriptor = buildQuery({ + encode: GetCodecDescriptorRequest.encode, + decode: GetCodecDescriptorResponse.decode, + service: "cosmos.base.reflection.v2alpha1.ReflectionService", + method: "GetCodecDescriptor", + deps: [GetCodecDescriptorRequest, GetCodecDescriptorResponse] +}); +/** + * GetConfigurationDescriptor returns the descriptor for the sdk.Config of the application + * @name getGetConfigurationDescriptor + * @package cosmos.base.reflection.v2alpha1 + * @see proto service: cosmos.base.reflection.v2alpha1.GetConfigurationDescriptor + */ +export const getGetConfigurationDescriptor = buildQuery({ + encode: GetConfigurationDescriptorRequest.encode, + decode: GetConfigurationDescriptorResponse.decode, + service: "cosmos.base.reflection.v2alpha1.ReflectionService", + method: "GetConfigurationDescriptor", + deps: [GetConfigurationDescriptorRequest, GetConfigurationDescriptorResponse] +}); +/** + * GetQueryServicesDescriptor returns the available gRPC queryable services of the application + * @name getGetQueryServicesDescriptor + * @package cosmos.base.reflection.v2alpha1 + * @see proto service: cosmos.base.reflection.v2alpha1.GetQueryServicesDescriptor + */ +export const getGetQueryServicesDescriptor = buildQuery({ + encode: GetQueryServicesDescriptorRequest.encode, + decode: GetQueryServicesDescriptorResponse.decode, + service: "cosmos.base.reflection.v2alpha1.ReflectionService", + method: "GetQueryServicesDescriptor", + deps: [GetQueryServicesDescriptorRequest, GetQueryServicesDescriptorResponse] +}); +/** + * GetTxDescriptor returns information on the used transaction object and available msgs that can be used + * @name getGetTxDescriptor + * @package cosmos.base.reflection.v2alpha1 + * @see proto service: cosmos.base.reflection.v2alpha1.GetTxDescriptor + */ +export const getGetTxDescriptor = buildQuery({ + encode: GetTxDescriptorRequest.encode, + decode: GetTxDescriptorResponse.decode, + service: "cosmos.base.reflection.v2alpha1.ReflectionService", + method: "GetTxDescriptor", + deps: [GetTxDescriptorRequest, GetTxDescriptorResponse] +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/cosmos/base/reflection/v2alpha1/reflection.ts b/__fixtures__/v-next/outputv3/cosmos/base/reflection/v2alpha1/reflection.ts index 81bb1c1c2f..952b4ee5ba 100644 --- a/__fixtures__/v-next/outputv3/cosmos/base/reflection/v2alpha1/reflection.ts +++ b/__fixtures__/v-next/outputv3/cosmos/base/reflection/v2alpha1/reflection.ts @@ -1,4 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { GlobalDecoderRegistry } from "../../../../registry"; import { isSet, DeepPartial } from "../../../../helpers"; export const protobufPackage = "cosmos.base.reflection.v2alpha1"; /** @@ -1090,6 +1091,15 @@ function createBaseAppDescriptor(): AppDescriptor { export const AppDescriptor = { typeUrl: "/cosmos.base.reflection.v2alpha1.AppDescriptor", aminoType: "cosmos-sdk/AppDescriptor", + is(o: any): o is AppDescriptor { + return o && o.$typeUrl === AppDescriptor.typeUrl; + }, + isSDK(o: any): o is AppDescriptorSDKType { + return o && o.$typeUrl === AppDescriptor.typeUrl; + }, + isAmino(o: any): o is AppDescriptorAmino { + return o && o.$typeUrl === AppDescriptor.typeUrl; + }, encode(message: AppDescriptor, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.authn !== undefined) { AuthnDescriptor.encode(message.authn, writer.uint32(10).fork()).ldelim(); @@ -1238,6 +1248,17 @@ export const AppDescriptor = { typeUrl: "/cosmos.base.reflection.v2alpha1.AppDescriptor", value: AppDescriptor.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(AppDescriptor.typeUrl)) { + return; + } + AuthnDescriptor.registerTypeUrl(); + ChainDescriptor.registerTypeUrl(); + CodecDescriptor.registerTypeUrl(); + ConfigurationDescriptor.registerTypeUrl(); + QueryServicesDescriptor.registerTypeUrl(); + TxDescriptor.registerTypeUrl(); } }; function createBaseTxDescriptor(): TxDescriptor { @@ -1255,6 +1276,15 @@ function createBaseTxDescriptor(): TxDescriptor { export const TxDescriptor = { typeUrl: "/cosmos.base.reflection.v2alpha1.TxDescriptor", aminoType: "cosmos-sdk/TxDescriptor", + is(o: any): o is TxDescriptor { + return o && (o.$typeUrl === TxDescriptor.typeUrl || typeof o.fullname === "string" && Array.isArray(o.msgs) && (!o.msgs.length || MsgDescriptor.is(o.msgs[0]))); + }, + isSDK(o: any): o is TxDescriptorSDKType { + return o && (o.$typeUrl === TxDescriptor.typeUrl || typeof o.fullname === "string" && Array.isArray(o.msgs) && (!o.msgs.length || MsgDescriptor.isSDK(o.msgs[0]))); + }, + isAmino(o: any): o is TxDescriptorAmino { + return o && (o.$typeUrl === TxDescriptor.typeUrl || typeof o.fullname === "string" && Array.isArray(o.msgs) && (!o.msgs.length || MsgDescriptor.isAmino(o.msgs[0]))); + }, encode(message: TxDescriptor, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.fullname !== "") { writer.uint32(10).string(message.fullname); @@ -1341,6 +1371,12 @@ export const TxDescriptor = { typeUrl: "/cosmos.base.reflection.v2alpha1.TxDescriptor", value: TxDescriptor.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(TxDescriptor.typeUrl)) { + return; + } + MsgDescriptor.registerTypeUrl(); } }; function createBaseAuthnDescriptor(): AuthnDescriptor { @@ -1358,6 +1394,15 @@ function createBaseAuthnDescriptor(): AuthnDescriptor { export const AuthnDescriptor = { typeUrl: "/cosmos.base.reflection.v2alpha1.AuthnDescriptor", aminoType: "cosmos-sdk/AuthnDescriptor", + is(o: any): o is AuthnDescriptor { + return o && (o.$typeUrl === AuthnDescriptor.typeUrl || Array.isArray(o.signModes) && (!o.signModes.length || SigningModeDescriptor.is(o.signModes[0]))); + }, + isSDK(o: any): o is AuthnDescriptorSDKType { + return o && (o.$typeUrl === AuthnDescriptor.typeUrl || Array.isArray(o.sign_modes) && (!o.sign_modes.length || SigningModeDescriptor.isSDK(o.sign_modes[0]))); + }, + isAmino(o: any): o is AuthnDescriptorAmino { + return o && (o.$typeUrl === AuthnDescriptor.typeUrl || Array.isArray(o.sign_modes) && (!o.sign_modes.length || SigningModeDescriptor.isAmino(o.sign_modes[0]))); + }, encode(message: AuthnDescriptor, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.signModes) { SigningModeDescriptor.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -1430,6 +1475,12 @@ export const AuthnDescriptor = { typeUrl: "/cosmos.base.reflection.v2alpha1.AuthnDescriptor", value: AuthnDescriptor.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(AuthnDescriptor.typeUrl)) { + return; + } + SigningModeDescriptor.registerTypeUrl(); } }; function createBaseSigningModeDescriptor(): SigningModeDescriptor { @@ -1451,6 +1502,15 @@ function createBaseSigningModeDescriptor(): SigningModeDescriptor { export const SigningModeDescriptor = { typeUrl: "/cosmos.base.reflection.v2alpha1.SigningModeDescriptor", aminoType: "cosmos-sdk/SigningModeDescriptor", + is(o: any): o is SigningModeDescriptor { + return o && (o.$typeUrl === SigningModeDescriptor.typeUrl || typeof o.name === "string" && typeof o.number === "number" && typeof o.authnInfoProviderMethodFullname === "string"); + }, + isSDK(o: any): o is SigningModeDescriptorSDKType { + return o && (o.$typeUrl === SigningModeDescriptor.typeUrl || typeof o.name === "string" && typeof o.number === "number" && typeof o.authn_info_provider_method_fullname === "string"); + }, + isAmino(o: any): o is SigningModeDescriptorAmino { + return o && (o.$typeUrl === SigningModeDescriptor.typeUrl || typeof o.name === "string" && typeof o.number === "number" && typeof o.authn_info_provider_method_fullname === "string"); + }, encode(message: SigningModeDescriptor, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -1545,7 +1605,8 @@ export const SigningModeDescriptor = { typeUrl: "/cosmos.base.reflection.v2alpha1.SigningModeDescriptor", value: SigningModeDescriptor.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseChainDescriptor(): ChainDescriptor { return { @@ -1561,6 +1622,15 @@ function createBaseChainDescriptor(): ChainDescriptor { export const ChainDescriptor = { typeUrl: "/cosmos.base.reflection.v2alpha1.ChainDescriptor", aminoType: "cosmos-sdk/ChainDescriptor", + is(o: any): o is ChainDescriptor { + return o && (o.$typeUrl === ChainDescriptor.typeUrl || typeof o.id === "string"); + }, + isSDK(o: any): o is ChainDescriptorSDKType { + return o && (o.$typeUrl === ChainDescriptor.typeUrl || typeof o.id === "string"); + }, + isAmino(o: any): o is ChainDescriptorAmino { + return o && (o.$typeUrl === ChainDescriptor.typeUrl || typeof o.id === "string"); + }, encode(message: ChainDescriptor, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.id !== "") { writer.uint32(10).string(message.id); @@ -1627,7 +1697,8 @@ export const ChainDescriptor = { typeUrl: "/cosmos.base.reflection.v2alpha1.ChainDescriptor", value: ChainDescriptor.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseCodecDescriptor(): CodecDescriptor { return { @@ -1643,6 +1714,15 @@ function createBaseCodecDescriptor(): CodecDescriptor { export const CodecDescriptor = { typeUrl: "/cosmos.base.reflection.v2alpha1.CodecDescriptor", aminoType: "cosmos-sdk/CodecDescriptor", + is(o: any): o is CodecDescriptor { + return o && (o.$typeUrl === CodecDescriptor.typeUrl || Array.isArray(o.interfaces) && (!o.interfaces.length || InterfaceDescriptor.is(o.interfaces[0]))); + }, + isSDK(o: any): o is CodecDescriptorSDKType { + return o && (o.$typeUrl === CodecDescriptor.typeUrl || Array.isArray(o.interfaces) && (!o.interfaces.length || InterfaceDescriptor.isSDK(o.interfaces[0]))); + }, + isAmino(o: any): o is CodecDescriptorAmino { + return o && (o.$typeUrl === CodecDescriptor.typeUrl || Array.isArray(o.interfaces) && (!o.interfaces.length || InterfaceDescriptor.isAmino(o.interfaces[0]))); + }, encode(message: CodecDescriptor, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.interfaces) { InterfaceDescriptor.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -1715,6 +1795,12 @@ export const CodecDescriptor = { typeUrl: "/cosmos.base.reflection.v2alpha1.CodecDescriptor", value: CodecDescriptor.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(CodecDescriptor.typeUrl)) { + return; + } + InterfaceDescriptor.registerTypeUrl(); } }; function createBaseInterfaceDescriptor(): InterfaceDescriptor { @@ -1733,6 +1819,15 @@ function createBaseInterfaceDescriptor(): InterfaceDescriptor { export const InterfaceDescriptor = { typeUrl: "/cosmos.base.reflection.v2alpha1.InterfaceDescriptor", aminoType: "cosmos-sdk/InterfaceDescriptor", + is(o: any): o is InterfaceDescriptor { + return o && (o.$typeUrl === InterfaceDescriptor.typeUrl || typeof o.fullname === "string" && Array.isArray(o.interfaceAcceptingMessages) && (!o.interfaceAcceptingMessages.length || InterfaceAcceptingMessageDescriptor.is(o.interfaceAcceptingMessages[0])) && Array.isArray(o.interfaceImplementers) && (!o.interfaceImplementers.length || InterfaceImplementerDescriptor.is(o.interfaceImplementers[0]))); + }, + isSDK(o: any): o is InterfaceDescriptorSDKType { + return o && (o.$typeUrl === InterfaceDescriptor.typeUrl || typeof o.fullname === "string" && Array.isArray(o.interface_accepting_messages) && (!o.interface_accepting_messages.length || InterfaceAcceptingMessageDescriptor.isSDK(o.interface_accepting_messages[0])) && Array.isArray(o.interface_implementers) && (!o.interface_implementers.length || InterfaceImplementerDescriptor.isSDK(o.interface_implementers[0]))); + }, + isAmino(o: any): o is InterfaceDescriptorAmino { + return o && (o.$typeUrl === InterfaceDescriptor.typeUrl || typeof o.fullname === "string" && Array.isArray(o.interface_accepting_messages) && (!o.interface_accepting_messages.length || InterfaceAcceptingMessageDescriptor.isAmino(o.interface_accepting_messages[0])) && Array.isArray(o.interface_implementers) && (!o.interface_implementers.length || InterfaceImplementerDescriptor.isAmino(o.interface_implementers[0]))); + }, encode(message: InterfaceDescriptor, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.fullname !== "") { writer.uint32(10).string(message.fullname); @@ -1839,6 +1934,13 @@ export const InterfaceDescriptor = { typeUrl: "/cosmos.base.reflection.v2alpha1.InterfaceDescriptor", value: InterfaceDescriptor.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(InterfaceDescriptor.typeUrl)) { + return; + } + InterfaceAcceptingMessageDescriptor.registerTypeUrl(); + InterfaceImplementerDescriptor.registerTypeUrl(); } }; function createBaseInterfaceImplementerDescriptor(): InterfaceImplementerDescriptor { @@ -1856,6 +1958,15 @@ function createBaseInterfaceImplementerDescriptor(): InterfaceImplementerDescrip export const InterfaceImplementerDescriptor = { typeUrl: "/cosmos.base.reflection.v2alpha1.InterfaceImplementerDescriptor", aminoType: "cosmos-sdk/InterfaceImplementerDescriptor", + is(o: any): o is InterfaceImplementerDescriptor { + return o && (o.$typeUrl === InterfaceImplementerDescriptor.typeUrl || typeof o.fullname === "string" && typeof o.typeUrl === "string"); + }, + isSDK(o: any): o is InterfaceImplementerDescriptorSDKType { + return o && (o.$typeUrl === InterfaceImplementerDescriptor.typeUrl || typeof o.fullname === "string" && typeof o.type_url === "string"); + }, + isAmino(o: any): o is InterfaceImplementerDescriptorAmino { + return o && (o.$typeUrl === InterfaceImplementerDescriptor.typeUrl || typeof o.fullname === "string" && typeof o.type_url === "string"); + }, encode(message: InterfaceImplementerDescriptor, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.fullname !== "") { writer.uint32(10).string(message.fullname); @@ -1936,7 +2047,8 @@ export const InterfaceImplementerDescriptor = { typeUrl: "/cosmos.base.reflection.v2alpha1.InterfaceImplementerDescriptor", value: InterfaceImplementerDescriptor.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseInterfaceAcceptingMessageDescriptor(): InterfaceAcceptingMessageDescriptor { return { @@ -1954,6 +2066,15 @@ function createBaseInterfaceAcceptingMessageDescriptor(): InterfaceAcceptingMess export const InterfaceAcceptingMessageDescriptor = { typeUrl: "/cosmos.base.reflection.v2alpha1.InterfaceAcceptingMessageDescriptor", aminoType: "cosmos-sdk/InterfaceAcceptingMessageDescriptor", + is(o: any): o is InterfaceAcceptingMessageDescriptor { + return o && (o.$typeUrl === InterfaceAcceptingMessageDescriptor.typeUrl || typeof o.fullname === "string" && Array.isArray(o.fieldDescriptorNames) && (!o.fieldDescriptorNames.length || typeof o.fieldDescriptorNames[0] === "string")); + }, + isSDK(o: any): o is InterfaceAcceptingMessageDescriptorSDKType { + return o && (o.$typeUrl === InterfaceAcceptingMessageDescriptor.typeUrl || typeof o.fullname === "string" && Array.isArray(o.field_descriptor_names) && (!o.field_descriptor_names.length || typeof o.field_descriptor_names[0] === "string")); + }, + isAmino(o: any): o is InterfaceAcceptingMessageDescriptorAmino { + return o && (o.$typeUrl === InterfaceAcceptingMessageDescriptor.typeUrl || typeof o.fullname === "string" && Array.isArray(o.field_descriptor_names) && (!o.field_descriptor_names.length || typeof o.field_descriptor_names[0] === "string")); + }, encode(message: InterfaceAcceptingMessageDescriptor, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.fullname !== "") { writer.uint32(10).string(message.fullname); @@ -2040,7 +2161,8 @@ export const InterfaceAcceptingMessageDescriptor = { typeUrl: "/cosmos.base.reflection.v2alpha1.InterfaceAcceptingMessageDescriptor", value: InterfaceAcceptingMessageDescriptor.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseConfigurationDescriptor(): ConfigurationDescriptor { return { @@ -2056,6 +2178,15 @@ function createBaseConfigurationDescriptor(): ConfigurationDescriptor { export const ConfigurationDescriptor = { typeUrl: "/cosmos.base.reflection.v2alpha1.ConfigurationDescriptor", aminoType: "cosmos-sdk/ConfigurationDescriptor", + is(o: any): o is ConfigurationDescriptor { + return o && (o.$typeUrl === ConfigurationDescriptor.typeUrl || typeof o.bech32AccountAddressPrefix === "string"); + }, + isSDK(o: any): o is ConfigurationDescriptorSDKType { + return o && (o.$typeUrl === ConfigurationDescriptor.typeUrl || typeof o.bech32_account_address_prefix === "string"); + }, + isAmino(o: any): o is ConfigurationDescriptorAmino { + return o && (o.$typeUrl === ConfigurationDescriptor.typeUrl || typeof o.bech32_account_address_prefix === "string"); + }, encode(message: ConfigurationDescriptor, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.bech32AccountAddressPrefix !== "") { writer.uint32(10).string(message.bech32AccountAddressPrefix); @@ -2122,7 +2253,8 @@ export const ConfigurationDescriptor = { typeUrl: "/cosmos.base.reflection.v2alpha1.ConfigurationDescriptor", value: ConfigurationDescriptor.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgDescriptor(): MsgDescriptor { return { @@ -2138,6 +2270,15 @@ function createBaseMsgDescriptor(): MsgDescriptor { export const MsgDescriptor = { typeUrl: "/cosmos.base.reflection.v2alpha1.MsgDescriptor", aminoType: "cosmos-sdk/MsgDescriptor", + is(o: any): o is MsgDescriptor { + return o && (o.$typeUrl === MsgDescriptor.typeUrl || typeof o.msgTypeUrl === "string"); + }, + isSDK(o: any): o is MsgDescriptorSDKType { + return o && (o.$typeUrl === MsgDescriptor.typeUrl || typeof o.msg_type_url === "string"); + }, + isAmino(o: any): o is MsgDescriptorAmino { + return o && (o.$typeUrl === MsgDescriptor.typeUrl || typeof o.msg_type_url === "string"); + }, encode(message: MsgDescriptor, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.msgTypeUrl !== "") { writer.uint32(10).string(message.msgTypeUrl); @@ -2204,7 +2345,8 @@ export const MsgDescriptor = { typeUrl: "/cosmos.base.reflection.v2alpha1.MsgDescriptor", value: MsgDescriptor.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseGetAuthnDescriptorRequest(): GetAuthnDescriptorRequest { return {}; @@ -2218,6 +2360,15 @@ function createBaseGetAuthnDescriptorRequest(): GetAuthnDescriptorRequest { export const GetAuthnDescriptorRequest = { typeUrl: "/cosmos.base.reflection.v2alpha1.GetAuthnDescriptorRequest", aminoType: "cosmos-sdk/GetAuthnDescriptorRequest", + is(o: any): o is GetAuthnDescriptorRequest { + return o && o.$typeUrl === GetAuthnDescriptorRequest.typeUrl; + }, + isSDK(o: any): o is GetAuthnDescriptorRequestSDKType { + return o && o.$typeUrl === GetAuthnDescriptorRequest.typeUrl; + }, + isAmino(o: any): o is GetAuthnDescriptorRequestAmino { + return o && o.$typeUrl === GetAuthnDescriptorRequest.typeUrl; + }, encode(_: GetAuthnDescriptorRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -2269,7 +2420,8 @@ export const GetAuthnDescriptorRequest = { typeUrl: "/cosmos.base.reflection.v2alpha1.GetAuthnDescriptorRequest", value: GetAuthnDescriptorRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseGetAuthnDescriptorResponse(): GetAuthnDescriptorResponse { return { @@ -2285,6 +2437,15 @@ function createBaseGetAuthnDescriptorResponse(): GetAuthnDescriptorResponse { export const GetAuthnDescriptorResponse = { typeUrl: "/cosmos.base.reflection.v2alpha1.GetAuthnDescriptorResponse", aminoType: "cosmos-sdk/GetAuthnDescriptorResponse", + is(o: any): o is GetAuthnDescriptorResponse { + return o && o.$typeUrl === GetAuthnDescriptorResponse.typeUrl; + }, + isSDK(o: any): o is GetAuthnDescriptorResponseSDKType { + return o && o.$typeUrl === GetAuthnDescriptorResponse.typeUrl; + }, + isAmino(o: any): o is GetAuthnDescriptorResponseAmino { + return o && o.$typeUrl === GetAuthnDescriptorResponse.typeUrl; + }, encode(message: GetAuthnDescriptorResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.authn !== undefined) { AuthnDescriptor.encode(message.authn, writer.uint32(10).fork()).ldelim(); @@ -2353,6 +2514,12 @@ export const GetAuthnDescriptorResponse = { typeUrl: "/cosmos.base.reflection.v2alpha1.GetAuthnDescriptorResponse", value: GetAuthnDescriptorResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GetAuthnDescriptorResponse.typeUrl)) { + return; + } + AuthnDescriptor.registerTypeUrl(); } }; function createBaseGetChainDescriptorRequest(): GetChainDescriptorRequest { @@ -2367,6 +2534,15 @@ function createBaseGetChainDescriptorRequest(): GetChainDescriptorRequest { export const GetChainDescriptorRequest = { typeUrl: "/cosmos.base.reflection.v2alpha1.GetChainDescriptorRequest", aminoType: "cosmos-sdk/GetChainDescriptorRequest", + is(o: any): o is GetChainDescriptorRequest { + return o && o.$typeUrl === GetChainDescriptorRequest.typeUrl; + }, + isSDK(o: any): o is GetChainDescriptorRequestSDKType { + return o && o.$typeUrl === GetChainDescriptorRequest.typeUrl; + }, + isAmino(o: any): o is GetChainDescriptorRequestAmino { + return o && o.$typeUrl === GetChainDescriptorRequest.typeUrl; + }, encode(_: GetChainDescriptorRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -2418,7 +2594,8 @@ export const GetChainDescriptorRequest = { typeUrl: "/cosmos.base.reflection.v2alpha1.GetChainDescriptorRequest", value: GetChainDescriptorRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseGetChainDescriptorResponse(): GetChainDescriptorResponse { return { @@ -2434,6 +2611,15 @@ function createBaseGetChainDescriptorResponse(): GetChainDescriptorResponse { export const GetChainDescriptorResponse = { typeUrl: "/cosmos.base.reflection.v2alpha1.GetChainDescriptorResponse", aminoType: "cosmos-sdk/GetChainDescriptorResponse", + is(o: any): o is GetChainDescriptorResponse { + return o && o.$typeUrl === GetChainDescriptorResponse.typeUrl; + }, + isSDK(o: any): o is GetChainDescriptorResponseSDKType { + return o && o.$typeUrl === GetChainDescriptorResponse.typeUrl; + }, + isAmino(o: any): o is GetChainDescriptorResponseAmino { + return o && o.$typeUrl === GetChainDescriptorResponse.typeUrl; + }, encode(message: GetChainDescriptorResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.chain !== undefined) { ChainDescriptor.encode(message.chain, writer.uint32(10).fork()).ldelim(); @@ -2502,6 +2688,12 @@ export const GetChainDescriptorResponse = { typeUrl: "/cosmos.base.reflection.v2alpha1.GetChainDescriptorResponse", value: GetChainDescriptorResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GetChainDescriptorResponse.typeUrl)) { + return; + } + ChainDescriptor.registerTypeUrl(); } }; function createBaseGetCodecDescriptorRequest(): GetCodecDescriptorRequest { @@ -2516,6 +2708,15 @@ function createBaseGetCodecDescriptorRequest(): GetCodecDescriptorRequest { export const GetCodecDescriptorRequest = { typeUrl: "/cosmos.base.reflection.v2alpha1.GetCodecDescriptorRequest", aminoType: "cosmos-sdk/GetCodecDescriptorRequest", + is(o: any): o is GetCodecDescriptorRequest { + return o && o.$typeUrl === GetCodecDescriptorRequest.typeUrl; + }, + isSDK(o: any): o is GetCodecDescriptorRequestSDKType { + return o && o.$typeUrl === GetCodecDescriptorRequest.typeUrl; + }, + isAmino(o: any): o is GetCodecDescriptorRequestAmino { + return o && o.$typeUrl === GetCodecDescriptorRequest.typeUrl; + }, encode(_: GetCodecDescriptorRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -2567,7 +2768,8 @@ export const GetCodecDescriptorRequest = { typeUrl: "/cosmos.base.reflection.v2alpha1.GetCodecDescriptorRequest", value: GetCodecDescriptorRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseGetCodecDescriptorResponse(): GetCodecDescriptorResponse { return { @@ -2583,6 +2785,15 @@ function createBaseGetCodecDescriptorResponse(): GetCodecDescriptorResponse { export const GetCodecDescriptorResponse = { typeUrl: "/cosmos.base.reflection.v2alpha1.GetCodecDescriptorResponse", aminoType: "cosmos-sdk/GetCodecDescriptorResponse", + is(o: any): o is GetCodecDescriptorResponse { + return o && o.$typeUrl === GetCodecDescriptorResponse.typeUrl; + }, + isSDK(o: any): o is GetCodecDescriptorResponseSDKType { + return o && o.$typeUrl === GetCodecDescriptorResponse.typeUrl; + }, + isAmino(o: any): o is GetCodecDescriptorResponseAmino { + return o && o.$typeUrl === GetCodecDescriptorResponse.typeUrl; + }, encode(message: GetCodecDescriptorResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.codec !== undefined) { CodecDescriptor.encode(message.codec, writer.uint32(10).fork()).ldelim(); @@ -2651,6 +2862,12 @@ export const GetCodecDescriptorResponse = { typeUrl: "/cosmos.base.reflection.v2alpha1.GetCodecDescriptorResponse", value: GetCodecDescriptorResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GetCodecDescriptorResponse.typeUrl)) { + return; + } + CodecDescriptor.registerTypeUrl(); } }; function createBaseGetConfigurationDescriptorRequest(): GetConfigurationDescriptorRequest { @@ -2665,6 +2882,15 @@ function createBaseGetConfigurationDescriptorRequest(): GetConfigurationDescript export const GetConfigurationDescriptorRequest = { typeUrl: "/cosmos.base.reflection.v2alpha1.GetConfigurationDescriptorRequest", aminoType: "cosmos-sdk/GetConfigurationDescriptorRequest", + is(o: any): o is GetConfigurationDescriptorRequest { + return o && o.$typeUrl === GetConfigurationDescriptorRequest.typeUrl; + }, + isSDK(o: any): o is GetConfigurationDescriptorRequestSDKType { + return o && o.$typeUrl === GetConfigurationDescriptorRequest.typeUrl; + }, + isAmino(o: any): o is GetConfigurationDescriptorRequestAmino { + return o && o.$typeUrl === GetConfigurationDescriptorRequest.typeUrl; + }, encode(_: GetConfigurationDescriptorRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -2716,7 +2942,8 @@ export const GetConfigurationDescriptorRequest = { typeUrl: "/cosmos.base.reflection.v2alpha1.GetConfigurationDescriptorRequest", value: GetConfigurationDescriptorRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseGetConfigurationDescriptorResponse(): GetConfigurationDescriptorResponse { return { @@ -2732,6 +2959,15 @@ function createBaseGetConfigurationDescriptorResponse(): GetConfigurationDescrip export const GetConfigurationDescriptorResponse = { typeUrl: "/cosmos.base.reflection.v2alpha1.GetConfigurationDescriptorResponse", aminoType: "cosmos-sdk/GetConfigurationDescriptorResponse", + is(o: any): o is GetConfigurationDescriptorResponse { + return o && o.$typeUrl === GetConfigurationDescriptorResponse.typeUrl; + }, + isSDK(o: any): o is GetConfigurationDescriptorResponseSDKType { + return o && o.$typeUrl === GetConfigurationDescriptorResponse.typeUrl; + }, + isAmino(o: any): o is GetConfigurationDescriptorResponseAmino { + return o && o.$typeUrl === GetConfigurationDescriptorResponse.typeUrl; + }, encode(message: GetConfigurationDescriptorResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.config !== undefined) { ConfigurationDescriptor.encode(message.config, writer.uint32(10).fork()).ldelim(); @@ -2800,6 +3036,12 @@ export const GetConfigurationDescriptorResponse = { typeUrl: "/cosmos.base.reflection.v2alpha1.GetConfigurationDescriptorResponse", value: GetConfigurationDescriptorResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GetConfigurationDescriptorResponse.typeUrl)) { + return; + } + ConfigurationDescriptor.registerTypeUrl(); } }; function createBaseGetQueryServicesDescriptorRequest(): GetQueryServicesDescriptorRequest { @@ -2814,6 +3056,15 @@ function createBaseGetQueryServicesDescriptorRequest(): GetQueryServicesDescript export const GetQueryServicesDescriptorRequest = { typeUrl: "/cosmos.base.reflection.v2alpha1.GetQueryServicesDescriptorRequest", aminoType: "cosmos-sdk/GetQueryServicesDescriptorRequest", + is(o: any): o is GetQueryServicesDescriptorRequest { + return o && o.$typeUrl === GetQueryServicesDescriptorRequest.typeUrl; + }, + isSDK(o: any): o is GetQueryServicesDescriptorRequestSDKType { + return o && o.$typeUrl === GetQueryServicesDescriptorRequest.typeUrl; + }, + isAmino(o: any): o is GetQueryServicesDescriptorRequestAmino { + return o && o.$typeUrl === GetQueryServicesDescriptorRequest.typeUrl; + }, encode(_: GetQueryServicesDescriptorRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -2865,7 +3116,8 @@ export const GetQueryServicesDescriptorRequest = { typeUrl: "/cosmos.base.reflection.v2alpha1.GetQueryServicesDescriptorRequest", value: GetQueryServicesDescriptorRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseGetQueryServicesDescriptorResponse(): GetQueryServicesDescriptorResponse { return { @@ -2881,6 +3133,15 @@ function createBaseGetQueryServicesDescriptorResponse(): GetQueryServicesDescrip export const GetQueryServicesDescriptorResponse = { typeUrl: "/cosmos.base.reflection.v2alpha1.GetQueryServicesDescriptorResponse", aminoType: "cosmos-sdk/GetQueryServicesDescriptorResponse", + is(o: any): o is GetQueryServicesDescriptorResponse { + return o && o.$typeUrl === GetQueryServicesDescriptorResponse.typeUrl; + }, + isSDK(o: any): o is GetQueryServicesDescriptorResponseSDKType { + return o && o.$typeUrl === GetQueryServicesDescriptorResponse.typeUrl; + }, + isAmino(o: any): o is GetQueryServicesDescriptorResponseAmino { + return o && o.$typeUrl === GetQueryServicesDescriptorResponse.typeUrl; + }, encode(message: GetQueryServicesDescriptorResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.queries !== undefined) { QueryServicesDescriptor.encode(message.queries, writer.uint32(10).fork()).ldelim(); @@ -2949,6 +3210,12 @@ export const GetQueryServicesDescriptorResponse = { typeUrl: "/cosmos.base.reflection.v2alpha1.GetQueryServicesDescriptorResponse", value: GetQueryServicesDescriptorResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GetQueryServicesDescriptorResponse.typeUrl)) { + return; + } + QueryServicesDescriptor.registerTypeUrl(); } }; function createBaseGetTxDescriptorRequest(): GetTxDescriptorRequest { @@ -2963,6 +3230,15 @@ function createBaseGetTxDescriptorRequest(): GetTxDescriptorRequest { export const GetTxDescriptorRequest = { typeUrl: "/cosmos.base.reflection.v2alpha1.GetTxDescriptorRequest", aminoType: "cosmos-sdk/GetTxDescriptorRequest", + is(o: any): o is GetTxDescriptorRequest { + return o && o.$typeUrl === GetTxDescriptorRequest.typeUrl; + }, + isSDK(o: any): o is GetTxDescriptorRequestSDKType { + return o && o.$typeUrl === GetTxDescriptorRequest.typeUrl; + }, + isAmino(o: any): o is GetTxDescriptorRequestAmino { + return o && o.$typeUrl === GetTxDescriptorRequest.typeUrl; + }, encode(_: GetTxDescriptorRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -3014,7 +3290,8 @@ export const GetTxDescriptorRequest = { typeUrl: "/cosmos.base.reflection.v2alpha1.GetTxDescriptorRequest", value: GetTxDescriptorRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseGetTxDescriptorResponse(): GetTxDescriptorResponse { return { @@ -3030,6 +3307,15 @@ function createBaseGetTxDescriptorResponse(): GetTxDescriptorResponse { export const GetTxDescriptorResponse = { typeUrl: "/cosmos.base.reflection.v2alpha1.GetTxDescriptorResponse", aminoType: "cosmos-sdk/GetTxDescriptorResponse", + is(o: any): o is GetTxDescriptorResponse { + return o && o.$typeUrl === GetTxDescriptorResponse.typeUrl; + }, + isSDK(o: any): o is GetTxDescriptorResponseSDKType { + return o && o.$typeUrl === GetTxDescriptorResponse.typeUrl; + }, + isAmino(o: any): o is GetTxDescriptorResponseAmino { + return o && o.$typeUrl === GetTxDescriptorResponse.typeUrl; + }, encode(message: GetTxDescriptorResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.tx !== undefined) { TxDescriptor.encode(message.tx, writer.uint32(10).fork()).ldelim(); @@ -3098,6 +3384,12 @@ export const GetTxDescriptorResponse = { typeUrl: "/cosmos.base.reflection.v2alpha1.GetTxDescriptorResponse", value: GetTxDescriptorResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GetTxDescriptorResponse.typeUrl)) { + return; + } + TxDescriptor.registerTypeUrl(); } }; function createBaseQueryServicesDescriptor(): QueryServicesDescriptor { @@ -3114,6 +3406,15 @@ function createBaseQueryServicesDescriptor(): QueryServicesDescriptor { export const QueryServicesDescriptor = { typeUrl: "/cosmos.base.reflection.v2alpha1.QueryServicesDescriptor", aminoType: "cosmos-sdk/QueryServicesDescriptor", + is(o: any): o is QueryServicesDescriptor { + return o && (o.$typeUrl === QueryServicesDescriptor.typeUrl || Array.isArray(o.queryServices) && (!o.queryServices.length || QueryServiceDescriptor.is(o.queryServices[0]))); + }, + isSDK(o: any): o is QueryServicesDescriptorSDKType { + return o && (o.$typeUrl === QueryServicesDescriptor.typeUrl || Array.isArray(o.query_services) && (!o.query_services.length || QueryServiceDescriptor.isSDK(o.query_services[0]))); + }, + isAmino(o: any): o is QueryServicesDescriptorAmino { + return o && (o.$typeUrl === QueryServicesDescriptor.typeUrl || Array.isArray(o.query_services) && (!o.query_services.length || QueryServiceDescriptor.isAmino(o.query_services[0]))); + }, encode(message: QueryServicesDescriptor, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.queryServices) { QueryServiceDescriptor.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -3186,6 +3487,12 @@ export const QueryServicesDescriptor = { typeUrl: "/cosmos.base.reflection.v2alpha1.QueryServicesDescriptor", value: QueryServicesDescriptor.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryServicesDescriptor.typeUrl)) { + return; + } + QueryServiceDescriptor.registerTypeUrl(); } }; function createBaseQueryServiceDescriptor(): QueryServiceDescriptor { @@ -3204,6 +3511,15 @@ function createBaseQueryServiceDescriptor(): QueryServiceDescriptor { export const QueryServiceDescriptor = { typeUrl: "/cosmos.base.reflection.v2alpha1.QueryServiceDescriptor", aminoType: "cosmos-sdk/QueryServiceDescriptor", + is(o: any): o is QueryServiceDescriptor { + return o && (o.$typeUrl === QueryServiceDescriptor.typeUrl || typeof o.fullname === "string" && typeof o.isModule === "boolean" && Array.isArray(o.methods) && (!o.methods.length || QueryMethodDescriptor.is(o.methods[0]))); + }, + isSDK(o: any): o is QueryServiceDescriptorSDKType { + return o && (o.$typeUrl === QueryServiceDescriptor.typeUrl || typeof o.fullname === "string" && typeof o.is_module === "boolean" && Array.isArray(o.methods) && (!o.methods.length || QueryMethodDescriptor.isSDK(o.methods[0]))); + }, + isAmino(o: any): o is QueryServiceDescriptorAmino { + return o && (o.$typeUrl === QueryServiceDescriptor.typeUrl || typeof o.fullname === "string" && typeof o.is_module === "boolean" && Array.isArray(o.methods) && (!o.methods.length || QueryMethodDescriptor.isAmino(o.methods[0]))); + }, encode(message: QueryServiceDescriptor, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.fullname !== "") { writer.uint32(10).string(message.fullname); @@ -3304,6 +3620,12 @@ export const QueryServiceDescriptor = { typeUrl: "/cosmos.base.reflection.v2alpha1.QueryServiceDescriptor", value: QueryServiceDescriptor.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryServiceDescriptor.typeUrl)) { + return; + } + QueryMethodDescriptor.registerTypeUrl(); } }; function createBaseQueryMethodDescriptor(): QueryMethodDescriptor { @@ -3323,6 +3645,15 @@ function createBaseQueryMethodDescriptor(): QueryMethodDescriptor { export const QueryMethodDescriptor = { typeUrl: "/cosmos.base.reflection.v2alpha1.QueryMethodDescriptor", aminoType: "cosmos-sdk/QueryMethodDescriptor", + is(o: any): o is QueryMethodDescriptor { + return o && (o.$typeUrl === QueryMethodDescriptor.typeUrl || typeof o.name === "string" && typeof o.fullQueryPath === "string"); + }, + isSDK(o: any): o is QueryMethodDescriptorSDKType { + return o && (o.$typeUrl === QueryMethodDescriptor.typeUrl || typeof o.name === "string" && typeof o.full_query_path === "string"); + }, + isAmino(o: any): o is QueryMethodDescriptorAmino { + return o && (o.$typeUrl === QueryMethodDescriptor.typeUrl || typeof o.name === "string" && typeof o.full_query_path === "string"); + }, encode(message: QueryMethodDescriptor, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -3403,5 +3734,6 @@ export const QueryMethodDescriptor = { typeUrl: "/cosmos.base.reflection.v2alpha1.QueryMethodDescriptor", value: QueryMethodDescriptor.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/cosmos/base/snapshots/v1beta1/snapshot.ts b/__fixtures__/v-next/outputv3/cosmos/base/snapshots/v1beta1/snapshot.ts index 707c6cc55f..5ff35a1df0 100644 --- a/__fixtures__/v-next/outputv3/cosmos/base/snapshots/v1beta1/snapshot.ts +++ b/__fixtures__/v-next/outputv3/cosmos/base/snapshots/v1beta1/snapshot.ts @@ -1,4 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { GlobalDecoderRegistry } from "../../../../registry"; import { isSet, bytesFromBase64, DeepPartial, base64FromBytes } from "../../../../helpers"; export const protobufPackage = "cosmos.base.snapshots.v1beta1"; /** @@ -358,6 +359,15 @@ function createBaseSnapshot(): Snapshot { export const Snapshot = { typeUrl: "/cosmos.base.snapshots.v1beta1.Snapshot", aminoType: "cosmos-sdk/Snapshot", + is(o: any): o is Snapshot { + return o && (o.$typeUrl === Snapshot.typeUrl || typeof o.height === "bigint" && typeof o.format === "number" && typeof o.chunks === "number" && (o.hash instanceof Uint8Array || typeof o.hash === "string") && Metadata.is(o.metadata)); + }, + isSDK(o: any): o is SnapshotSDKType { + return o && (o.$typeUrl === Snapshot.typeUrl || typeof o.height === "bigint" && typeof o.format === "number" && typeof o.chunks === "number" && (o.hash instanceof Uint8Array || typeof o.hash === "string") && Metadata.isSDK(o.metadata)); + }, + isAmino(o: any): o is SnapshotAmino { + return o && (o.$typeUrl === Snapshot.typeUrl || typeof o.height === "bigint" && typeof o.format === "number" && typeof o.chunks === "number" && (o.hash instanceof Uint8Array || typeof o.hash === "string") && Metadata.isAmino(o.metadata)); + }, encode(message: Snapshot, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.height !== BigInt(0)) { writer.uint32(8).uint64(message.height); @@ -484,6 +494,12 @@ export const Snapshot = { typeUrl: "/cosmos.base.snapshots.v1beta1.Snapshot", value: Snapshot.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Snapshot.typeUrl)) { + return; + } + Metadata.registerTypeUrl(); } }; function createBaseMetadata(): Metadata { @@ -500,6 +516,15 @@ function createBaseMetadata(): Metadata { export const Metadata = { typeUrl: "/cosmos.base.snapshots.v1beta1.Metadata", aminoType: "cosmos-sdk/Metadata", + is(o: any): o is Metadata { + return o && (o.$typeUrl === Metadata.typeUrl || Array.isArray(o.chunkHashes) && (!o.chunkHashes.length || o.chunkHashes[0] instanceof Uint8Array || typeof o.chunkHashes[0] === "string")); + }, + isSDK(o: any): o is MetadataSDKType { + return o && (o.$typeUrl === Metadata.typeUrl || Array.isArray(o.chunk_hashes) && (!o.chunk_hashes.length || o.chunk_hashes[0] instanceof Uint8Array || typeof o.chunk_hashes[0] === "string")); + }, + isAmino(o: any): o is MetadataAmino { + return o && (o.$typeUrl === Metadata.typeUrl || Array.isArray(o.chunk_hashes) && (!o.chunk_hashes.length || o.chunk_hashes[0] instanceof Uint8Array || typeof o.chunk_hashes[0] === "string")); + }, encode(message: Metadata, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.chunkHashes) { writer.uint32(10).bytes(v!); @@ -572,7 +597,8 @@ export const Metadata = { typeUrl: "/cosmos.base.snapshots.v1beta1.Metadata", value: Metadata.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseSnapshotItem(): SnapshotItem { return { @@ -593,6 +619,15 @@ function createBaseSnapshotItem(): SnapshotItem { export const SnapshotItem = { typeUrl: "/cosmos.base.snapshots.v1beta1.SnapshotItem", aminoType: "cosmos-sdk/SnapshotItem", + is(o: any): o is SnapshotItem { + return o && o.$typeUrl === SnapshotItem.typeUrl; + }, + isSDK(o: any): o is SnapshotItemSDKType { + return o && o.$typeUrl === SnapshotItem.typeUrl; + }, + isAmino(o: any): o is SnapshotItemAmino { + return o && o.$typeUrl === SnapshotItem.typeUrl; + }, encode(message: SnapshotItem, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.store !== undefined) { SnapshotStoreItem.encode(message.store, writer.uint32(10).fork()).ldelim(); @@ -741,6 +776,17 @@ export const SnapshotItem = { typeUrl: "/cosmos.base.snapshots.v1beta1.SnapshotItem", value: SnapshotItem.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(SnapshotItem.typeUrl)) { + return; + } + SnapshotStoreItem.registerTypeUrl(); + SnapshotIAVLItem.registerTypeUrl(); + SnapshotExtensionMeta.registerTypeUrl(); + SnapshotExtensionPayload.registerTypeUrl(); + SnapshotKVItem.registerTypeUrl(); + SnapshotSchema.registerTypeUrl(); } }; function createBaseSnapshotStoreItem(): SnapshotStoreItem { @@ -757,6 +803,15 @@ function createBaseSnapshotStoreItem(): SnapshotStoreItem { export const SnapshotStoreItem = { typeUrl: "/cosmos.base.snapshots.v1beta1.SnapshotStoreItem", aminoType: "cosmos-sdk/SnapshotStoreItem", + is(o: any): o is SnapshotStoreItem { + return o && (o.$typeUrl === SnapshotStoreItem.typeUrl || typeof o.name === "string"); + }, + isSDK(o: any): o is SnapshotStoreItemSDKType { + return o && (o.$typeUrl === SnapshotStoreItem.typeUrl || typeof o.name === "string"); + }, + isAmino(o: any): o is SnapshotStoreItemAmino { + return o && (o.$typeUrl === SnapshotStoreItem.typeUrl || typeof o.name === "string"); + }, encode(message: SnapshotStoreItem, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -823,7 +878,8 @@ export const SnapshotStoreItem = { typeUrl: "/cosmos.base.snapshots.v1beta1.SnapshotStoreItem", value: SnapshotStoreItem.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseSnapshotIAVLItem(): SnapshotIAVLItem { return { @@ -842,6 +898,15 @@ function createBaseSnapshotIAVLItem(): SnapshotIAVLItem { export const SnapshotIAVLItem = { typeUrl: "/cosmos.base.snapshots.v1beta1.SnapshotIAVLItem", aminoType: "cosmos-sdk/SnapshotIAVLItem", + is(o: any): o is SnapshotIAVLItem { + return o && (o.$typeUrl === SnapshotIAVLItem.typeUrl || (o.key instanceof Uint8Array || typeof o.key === "string") && (o.value instanceof Uint8Array || typeof o.value === "string") && typeof o.version === "bigint" && typeof o.height === "number"); + }, + isSDK(o: any): o is SnapshotIAVLItemSDKType { + return o && (o.$typeUrl === SnapshotIAVLItem.typeUrl || (o.key instanceof Uint8Array || typeof o.key === "string") && (o.value instanceof Uint8Array || typeof o.value === "string") && typeof o.version === "bigint" && typeof o.height === "number"); + }, + isAmino(o: any): o is SnapshotIAVLItemAmino { + return o && (o.$typeUrl === SnapshotIAVLItem.typeUrl || (o.key instanceof Uint8Array || typeof o.key === "string") && (o.value instanceof Uint8Array || typeof o.value === "string") && typeof o.version === "bigint" && typeof o.height === "number"); + }, encode(message: SnapshotIAVLItem, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.key.length !== 0) { writer.uint32(10).bytes(message.key); @@ -952,7 +1017,8 @@ export const SnapshotIAVLItem = { typeUrl: "/cosmos.base.snapshots.v1beta1.SnapshotIAVLItem", value: SnapshotIAVLItem.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseSnapshotExtensionMeta(): SnapshotExtensionMeta { return { @@ -969,6 +1035,15 @@ function createBaseSnapshotExtensionMeta(): SnapshotExtensionMeta { export const SnapshotExtensionMeta = { typeUrl: "/cosmos.base.snapshots.v1beta1.SnapshotExtensionMeta", aminoType: "cosmos-sdk/SnapshotExtensionMeta", + is(o: any): o is SnapshotExtensionMeta { + return o && (o.$typeUrl === SnapshotExtensionMeta.typeUrl || typeof o.name === "string" && typeof o.format === "number"); + }, + isSDK(o: any): o is SnapshotExtensionMetaSDKType { + return o && (o.$typeUrl === SnapshotExtensionMeta.typeUrl || typeof o.name === "string" && typeof o.format === "number"); + }, + isAmino(o: any): o is SnapshotExtensionMetaAmino { + return o && (o.$typeUrl === SnapshotExtensionMeta.typeUrl || typeof o.name === "string" && typeof o.format === "number"); + }, encode(message: SnapshotExtensionMeta, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -1049,7 +1124,8 @@ export const SnapshotExtensionMeta = { typeUrl: "/cosmos.base.snapshots.v1beta1.SnapshotExtensionMeta", value: SnapshotExtensionMeta.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseSnapshotExtensionPayload(): SnapshotExtensionPayload { return { @@ -1065,6 +1141,15 @@ function createBaseSnapshotExtensionPayload(): SnapshotExtensionPayload { export const SnapshotExtensionPayload = { typeUrl: "/cosmos.base.snapshots.v1beta1.SnapshotExtensionPayload", aminoType: "cosmos-sdk/SnapshotExtensionPayload", + is(o: any): o is SnapshotExtensionPayload { + return o && (o.$typeUrl === SnapshotExtensionPayload.typeUrl || o.payload instanceof Uint8Array || typeof o.payload === "string"); + }, + isSDK(o: any): o is SnapshotExtensionPayloadSDKType { + return o && (o.$typeUrl === SnapshotExtensionPayload.typeUrl || o.payload instanceof Uint8Array || typeof o.payload === "string"); + }, + isAmino(o: any): o is SnapshotExtensionPayloadAmino { + return o && (o.$typeUrl === SnapshotExtensionPayload.typeUrl || o.payload instanceof Uint8Array || typeof o.payload === "string"); + }, encode(message: SnapshotExtensionPayload, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.payload.length !== 0) { writer.uint32(10).bytes(message.payload); @@ -1131,7 +1216,8 @@ export const SnapshotExtensionPayload = { typeUrl: "/cosmos.base.snapshots.v1beta1.SnapshotExtensionPayload", value: SnapshotExtensionPayload.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseSnapshotKVItem(): SnapshotKVItem { return { @@ -1148,6 +1234,15 @@ function createBaseSnapshotKVItem(): SnapshotKVItem { export const SnapshotKVItem = { typeUrl: "/cosmos.base.snapshots.v1beta1.SnapshotKVItem", aminoType: "cosmos-sdk/SnapshotKVItem", + is(o: any): o is SnapshotKVItem { + return o && (o.$typeUrl === SnapshotKVItem.typeUrl || (o.key instanceof Uint8Array || typeof o.key === "string") && (o.value instanceof Uint8Array || typeof o.value === "string")); + }, + isSDK(o: any): o is SnapshotKVItemSDKType { + return o && (o.$typeUrl === SnapshotKVItem.typeUrl || (o.key instanceof Uint8Array || typeof o.key === "string") && (o.value instanceof Uint8Array || typeof o.value === "string")); + }, + isAmino(o: any): o is SnapshotKVItemAmino { + return o && (o.$typeUrl === SnapshotKVItem.typeUrl || (o.key instanceof Uint8Array || typeof o.key === "string") && (o.value instanceof Uint8Array || typeof o.value === "string")); + }, encode(message: SnapshotKVItem, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.key.length !== 0) { writer.uint32(10).bytes(message.key); @@ -1228,7 +1323,8 @@ export const SnapshotKVItem = { typeUrl: "/cosmos.base.snapshots.v1beta1.SnapshotKVItem", value: SnapshotKVItem.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseSnapshotSchema(): SnapshotSchema { return { @@ -1244,6 +1340,15 @@ function createBaseSnapshotSchema(): SnapshotSchema { export const SnapshotSchema = { typeUrl: "/cosmos.base.snapshots.v1beta1.SnapshotSchema", aminoType: "cosmos-sdk/SnapshotSchema", + is(o: any): o is SnapshotSchema { + return o && (o.$typeUrl === SnapshotSchema.typeUrl || Array.isArray(o.keys) && (!o.keys.length || o.keys[0] instanceof Uint8Array || typeof o.keys[0] === "string")); + }, + isSDK(o: any): o is SnapshotSchemaSDKType { + return o && (o.$typeUrl === SnapshotSchema.typeUrl || Array.isArray(o.keys) && (!o.keys.length || o.keys[0] instanceof Uint8Array || typeof o.keys[0] === "string")); + }, + isAmino(o: any): o is SnapshotSchemaAmino { + return o && (o.$typeUrl === SnapshotSchema.typeUrl || Array.isArray(o.keys) && (!o.keys.length || o.keys[0] instanceof Uint8Array || typeof o.keys[0] === "string")); + }, encode(message: SnapshotSchema, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.keys) { writer.uint32(10).bytes(v!); @@ -1316,5 +1421,6 @@ export const SnapshotSchema = { typeUrl: "/cosmos.base.snapshots.v1beta1.SnapshotSchema", value: SnapshotSchema.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/cosmos/base/store/v1beta1/commit_info.ts b/__fixtures__/v-next/outputv3/cosmos/base/store/v1beta1/commit_info.ts index e05fa2ffe7..723d9185ac 100644 --- a/__fixtures__/v-next/outputv3/cosmos/base/store/v1beta1/commit_info.ts +++ b/__fixtures__/v-next/outputv3/cosmos/base/store/v1beta1/commit_info.ts @@ -1,5 +1,6 @@ import { BinaryReader, BinaryWriter } from "../../../../binary"; import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../../helpers"; +import { GlobalDecoderRegistry } from "../../../../registry"; export const protobufPackage = "cosmos.base.store.v1beta1"; /** * CommitInfo defines commit information used by the multi-store when committing @@ -128,6 +129,15 @@ function createBaseCommitInfo(): CommitInfo { export const CommitInfo = { typeUrl: "/cosmos.base.store.v1beta1.CommitInfo", aminoType: "cosmos-sdk/CommitInfo", + is(o: any): o is CommitInfo { + return o && (o.$typeUrl === CommitInfo.typeUrl || typeof o.version === "bigint" && Array.isArray(o.storeInfos) && (!o.storeInfos.length || StoreInfo.is(o.storeInfos[0]))); + }, + isSDK(o: any): o is CommitInfoSDKType { + return o && (o.$typeUrl === CommitInfo.typeUrl || typeof o.version === "bigint" && Array.isArray(o.store_infos) && (!o.store_infos.length || StoreInfo.isSDK(o.store_infos[0]))); + }, + isAmino(o: any): o is CommitInfoAmino { + return o && (o.$typeUrl === CommitInfo.typeUrl || typeof o.version === "bigint" && Array.isArray(o.store_infos) && (!o.store_infos.length || StoreInfo.isAmino(o.store_infos[0]))); + }, encode(message: CommitInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.version !== BigInt(0)) { writer.uint32(8).int64(message.version); @@ -216,6 +226,12 @@ export const CommitInfo = { typeUrl: "/cosmos.base.store.v1beta1.CommitInfo", value: CommitInfo.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(CommitInfo.typeUrl)) { + return; + } + StoreInfo.registerTypeUrl(); } }; function createBaseStoreInfo(): StoreInfo { @@ -234,6 +250,15 @@ function createBaseStoreInfo(): StoreInfo { export const StoreInfo = { typeUrl: "/cosmos.base.store.v1beta1.StoreInfo", aminoType: "cosmos-sdk/StoreInfo", + is(o: any): o is StoreInfo { + return o && (o.$typeUrl === StoreInfo.typeUrl || typeof o.name === "string" && CommitID.is(o.commitId)); + }, + isSDK(o: any): o is StoreInfoSDKType { + return o && (o.$typeUrl === StoreInfo.typeUrl || typeof o.name === "string" && CommitID.isSDK(o.commit_id)); + }, + isAmino(o: any): o is StoreInfoAmino { + return o && (o.$typeUrl === StoreInfo.typeUrl || typeof o.name === "string" && CommitID.isAmino(o.commit_id)); + }, encode(message: StoreInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -316,6 +341,12 @@ export const StoreInfo = { typeUrl: "/cosmos.base.store.v1beta1.StoreInfo", value: StoreInfo.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(StoreInfo.typeUrl)) { + return; + } + CommitID.registerTypeUrl(); } }; function createBaseCommitID(): CommitID { @@ -334,6 +365,15 @@ function createBaseCommitID(): CommitID { export const CommitID = { typeUrl: "/cosmos.base.store.v1beta1.CommitID", aminoType: "cosmos-sdk/CommitID", + is(o: any): o is CommitID { + return o && (o.$typeUrl === CommitID.typeUrl || typeof o.version === "bigint" && (o.hash instanceof Uint8Array || typeof o.hash === "string")); + }, + isSDK(o: any): o is CommitIDSDKType { + return o && (o.$typeUrl === CommitID.typeUrl || typeof o.version === "bigint" && (o.hash instanceof Uint8Array || typeof o.hash === "string")); + }, + isAmino(o: any): o is CommitIDAmino { + return o && (o.$typeUrl === CommitID.typeUrl || typeof o.version === "bigint" && (o.hash instanceof Uint8Array || typeof o.hash === "string")); + }, encode(message: CommitID, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.version !== BigInt(0)) { writer.uint32(8).int64(message.version); @@ -416,5 +456,6 @@ export const CommitID = { typeUrl: "/cosmos.base.store.v1beta1.CommitID", value: CommitID.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/cosmos/base/store/v1beta1/listening.ts b/__fixtures__/v-next/outputv3/cosmos/base/store/v1beta1/listening.ts index c65802157a..5ef2ee2f23 100644 --- a/__fixtures__/v-next/outputv3/cosmos/base/store/v1beta1/listening.ts +++ b/__fixtures__/v-next/outputv3/cosmos/base/store/v1beta1/listening.ts @@ -86,6 +86,15 @@ function createBaseStoreKVPair(): StoreKVPair { export const StoreKVPair = { typeUrl: "/cosmos.base.store.v1beta1.StoreKVPair", aminoType: "cosmos-sdk/StoreKVPair", + is(o: any): o is StoreKVPair { + return o && (o.$typeUrl === StoreKVPair.typeUrl || typeof o.storeKey === "string" && typeof o.delete === "boolean" && (o.key instanceof Uint8Array || typeof o.key === "string") && (o.value instanceof Uint8Array || typeof o.value === "string")); + }, + isSDK(o: any): o is StoreKVPairSDKType { + return o && (o.$typeUrl === StoreKVPair.typeUrl || typeof o.store_key === "string" && typeof o.delete === "boolean" && (o.key instanceof Uint8Array || typeof o.key === "string") && (o.value instanceof Uint8Array || typeof o.value === "string")); + }, + isAmino(o: any): o is StoreKVPairAmino { + return o && (o.$typeUrl === StoreKVPair.typeUrl || typeof o.store_key === "string" && typeof o.delete === "boolean" && (o.key instanceof Uint8Array || typeof o.key === "string") && (o.value instanceof Uint8Array || typeof o.value === "string")); + }, encode(message: StoreKVPair, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.storeKey !== "") { writer.uint32(10).string(message.storeKey); @@ -194,5 +203,6 @@ export const StoreKVPair = { typeUrl: "/cosmos.base.store.v1beta1.StoreKVPair", value: StoreKVPair.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/cosmos/base/tendermint/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputv3/cosmos/base/tendermint/v1beta1/query.rpc.func.ts new file mode 100644 index 0000000000..173d97e0b3 --- /dev/null +++ b/__fixtures__/v-next/outputv3/cosmos/base/tendermint/v1beta1/query.rpc.func.ts @@ -0,0 +1,85 @@ +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../query/v1beta1/pagination"; +import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../../google/protobuf/any"; +import { BlockID, BlockIDSDKType } from "../../../../tendermint/types/types"; +import { Block, BlockSDKType } from "../../../../tendermint/types/block"; +import { NodeInfo, NodeInfoSDKType } from "../../../../tendermint/p2p/types"; +import { EndpointOrRpc, buildQuery } from "../../../../helper-func-types"; +import { GetNodeInfoRequest, GetNodeInfoRequestSDKType, GetNodeInfoResponse, GetNodeInfoResponseSDKType, GetSyncingRequest, GetSyncingRequestSDKType, GetSyncingResponse, GetSyncingResponseSDKType, GetLatestBlockRequest, GetLatestBlockRequestSDKType, GetLatestBlockResponse, GetLatestBlockResponseSDKType, GetBlockByHeightRequest, GetBlockByHeightRequestSDKType, GetBlockByHeightResponse, GetBlockByHeightResponseSDKType, GetLatestValidatorSetRequest, GetLatestValidatorSetRequestSDKType, GetLatestValidatorSetResponse, GetLatestValidatorSetResponseSDKType, GetValidatorSetByHeightRequest, GetValidatorSetByHeightRequestSDKType, GetValidatorSetByHeightResponse, GetValidatorSetByHeightResponseSDKType } from "./query"; +/** + * GetNodeInfo queries the current node info. + * @name getGetNodeInfo + * @package cosmos.base.tendermint.v1beta1 + * @see proto service: cosmos.base.tendermint.v1beta1.GetNodeInfo + */ +export const getGetNodeInfo = buildQuery({ + encode: GetNodeInfoRequest.encode, + decode: GetNodeInfoResponse.decode, + service: "cosmos.base.tendermint.v1beta1.Service", + method: "GetNodeInfo", + deps: [GetNodeInfoRequest, GetNodeInfoResponse] +}); +/** + * GetSyncing queries node syncing. + * @name getGetSyncing + * @package cosmos.base.tendermint.v1beta1 + * @see proto service: cosmos.base.tendermint.v1beta1.GetSyncing + */ +export const getGetSyncing = buildQuery({ + encode: GetSyncingRequest.encode, + decode: GetSyncingResponse.decode, + service: "cosmos.base.tendermint.v1beta1.Service", + method: "GetSyncing", + deps: [GetSyncingRequest, GetSyncingResponse] +}); +/** + * GetLatestBlock returns the latest block. + * @name getGetLatestBlock + * @package cosmos.base.tendermint.v1beta1 + * @see proto service: cosmos.base.tendermint.v1beta1.GetLatestBlock + */ +export const getGetLatestBlock = buildQuery({ + encode: GetLatestBlockRequest.encode, + decode: GetLatestBlockResponse.decode, + service: "cosmos.base.tendermint.v1beta1.Service", + method: "GetLatestBlock", + deps: [GetLatestBlockRequest, GetLatestBlockResponse] +}); +/** + * GetBlockByHeight queries block for given height. + * @name getGetBlockByHeight + * @package cosmos.base.tendermint.v1beta1 + * @see proto service: cosmos.base.tendermint.v1beta1.GetBlockByHeight + */ +export const getGetBlockByHeight = buildQuery({ + encode: GetBlockByHeightRequest.encode, + decode: GetBlockByHeightResponse.decode, + service: "cosmos.base.tendermint.v1beta1.Service", + method: "GetBlockByHeight", + deps: [GetBlockByHeightRequest, GetBlockByHeightResponse] +}); +/** + * GetLatestValidatorSet queries latest validator-set. + * @name getGetLatestValidatorSet + * @package cosmos.base.tendermint.v1beta1 + * @see proto service: cosmos.base.tendermint.v1beta1.GetLatestValidatorSet + */ +export const getGetLatestValidatorSet = buildQuery({ + encode: GetLatestValidatorSetRequest.encode, + decode: GetLatestValidatorSetResponse.decode, + service: "cosmos.base.tendermint.v1beta1.Service", + method: "GetLatestValidatorSet", + deps: [GetLatestValidatorSetRequest, GetLatestValidatorSetResponse] +}); +/** + * GetValidatorSetByHeight queries validator-set at a given height. + * @name getGetValidatorSetByHeight + * @package cosmos.base.tendermint.v1beta1 + * @see proto service: cosmos.base.tendermint.v1beta1.GetValidatorSetByHeight + */ +export const getGetValidatorSetByHeight = buildQuery({ + encode: GetValidatorSetByHeightRequest.encode, + decode: GetValidatorSetByHeightResponse.decode, + service: "cosmos.base.tendermint.v1beta1.Service", + method: "GetValidatorSetByHeight", + deps: [GetValidatorSetByHeightRequest, GetValidatorSetByHeightResponse] +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/cosmos/base/tendermint/v1beta1/query.ts b/__fixtures__/v-next/outputv3/cosmos/base/tendermint/v1beta1/query.ts index 25020b0cef..92a516c0b3 100644 --- a/__fixtures__/v-next/outputv3/cosmos/base/tendermint/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv3/cosmos/base/tendermint/v1beta1/query.ts @@ -4,6 +4,7 @@ import { BlockID, BlockIDAmino, BlockIDSDKType } from "../../../../tendermint/ty import { Block, BlockAmino, BlockSDKType } from "../../../../tendermint/types/block"; import { NodeInfo, NodeInfoAmino, NodeInfoSDKType } from "../../../../tendermint/p2p/types"; import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { GlobalDecoderRegistry } from "../../../../registry"; import { isSet, DeepPartial } from "../../../../helpers"; export const protobufPackage = "cosmos.base.tendermint.v1beta1"; /** @@ -576,6 +577,15 @@ function createBaseGetValidatorSetByHeightRequest(): GetValidatorSetByHeightRequ export const GetValidatorSetByHeightRequest = { typeUrl: "/cosmos.base.tendermint.v1beta1.GetValidatorSetByHeightRequest", aminoType: "cosmos-sdk/GetValidatorSetByHeightRequest", + is(o: any): o is GetValidatorSetByHeightRequest { + return o && (o.$typeUrl === GetValidatorSetByHeightRequest.typeUrl || typeof o.height === "bigint"); + }, + isSDK(o: any): o is GetValidatorSetByHeightRequestSDKType { + return o && (o.$typeUrl === GetValidatorSetByHeightRequest.typeUrl || typeof o.height === "bigint"); + }, + isAmino(o: any): o is GetValidatorSetByHeightRequestAmino { + return o && (o.$typeUrl === GetValidatorSetByHeightRequest.typeUrl || typeof o.height === "bigint"); + }, encode(message: GetValidatorSetByHeightRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.height !== BigInt(0)) { writer.uint32(8).int64(message.height); @@ -660,6 +670,12 @@ export const GetValidatorSetByHeightRequest = { typeUrl: "/cosmos.base.tendermint.v1beta1.GetValidatorSetByHeightRequest", value: GetValidatorSetByHeightRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GetValidatorSetByHeightRequest.typeUrl)) { + return; + } + PageRequest.registerTypeUrl(); } }; function createBaseGetValidatorSetByHeightResponse(): GetValidatorSetByHeightResponse { @@ -678,6 +694,15 @@ function createBaseGetValidatorSetByHeightResponse(): GetValidatorSetByHeightRes export const GetValidatorSetByHeightResponse = { typeUrl: "/cosmos.base.tendermint.v1beta1.GetValidatorSetByHeightResponse", aminoType: "cosmos-sdk/GetValidatorSetByHeightResponse", + is(o: any): o is GetValidatorSetByHeightResponse { + return o && (o.$typeUrl === GetValidatorSetByHeightResponse.typeUrl || typeof o.blockHeight === "bigint" && Array.isArray(o.validators) && (!o.validators.length || Validator.is(o.validators[0]))); + }, + isSDK(o: any): o is GetValidatorSetByHeightResponseSDKType { + return o && (o.$typeUrl === GetValidatorSetByHeightResponse.typeUrl || typeof o.block_height === "bigint" && Array.isArray(o.validators) && (!o.validators.length || Validator.isSDK(o.validators[0]))); + }, + isAmino(o: any): o is GetValidatorSetByHeightResponseAmino { + return o && (o.$typeUrl === GetValidatorSetByHeightResponse.typeUrl || typeof o.block_height === "bigint" && Array.isArray(o.validators) && (!o.validators.length || Validator.isAmino(o.validators[0]))); + }, encode(message: GetValidatorSetByHeightResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.blockHeight !== BigInt(0)) { writer.uint32(8).int64(message.blockHeight); @@ -782,6 +807,13 @@ export const GetValidatorSetByHeightResponse = { typeUrl: "/cosmos.base.tendermint.v1beta1.GetValidatorSetByHeightResponse", value: GetValidatorSetByHeightResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GetValidatorSetByHeightResponse.typeUrl)) { + return; + } + Validator.registerTypeUrl(); + PageResponse.registerTypeUrl(); } }; function createBaseGetLatestValidatorSetRequest(): GetLatestValidatorSetRequest { @@ -798,6 +830,15 @@ function createBaseGetLatestValidatorSetRequest(): GetLatestValidatorSetRequest export const GetLatestValidatorSetRequest = { typeUrl: "/cosmos.base.tendermint.v1beta1.GetLatestValidatorSetRequest", aminoType: "cosmos-sdk/GetLatestValidatorSetRequest", + is(o: any): o is GetLatestValidatorSetRequest { + return o && o.$typeUrl === GetLatestValidatorSetRequest.typeUrl; + }, + isSDK(o: any): o is GetLatestValidatorSetRequestSDKType { + return o && o.$typeUrl === GetLatestValidatorSetRequest.typeUrl; + }, + isAmino(o: any): o is GetLatestValidatorSetRequestAmino { + return o && o.$typeUrl === GetLatestValidatorSetRequest.typeUrl; + }, encode(message: GetLatestValidatorSetRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.pagination !== undefined) { PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); @@ -866,6 +907,12 @@ export const GetLatestValidatorSetRequest = { typeUrl: "/cosmos.base.tendermint.v1beta1.GetLatestValidatorSetRequest", value: GetLatestValidatorSetRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GetLatestValidatorSetRequest.typeUrl)) { + return; + } + PageRequest.registerTypeUrl(); } }; function createBaseGetLatestValidatorSetResponse(): GetLatestValidatorSetResponse { @@ -884,6 +931,15 @@ function createBaseGetLatestValidatorSetResponse(): GetLatestValidatorSetRespons export const GetLatestValidatorSetResponse = { typeUrl: "/cosmos.base.tendermint.v1beta1.GetLatestValidatorSetResponse", aminoType: "cosmos-sdk/GetLatestValidatorSetResponse", + is(o: any): o is GetLatestValidatorSetResponse { + return o && (o.$typeUrl === GetLatestValidatorSetResponse.typeUrl || typeof o.blockHeight === "bigint" && Array.isArray(o.validators) && (!o.validators.length || Validator.is(o.validators[0]))); + }, + isSDK(o: any): o is GetLatestValidatorSetResponseSDKType { + return o && (o.$typeUrl === GetLatestValidatorSetResponse.typeUrl || typeof o.block_height === "bigint" && Array.isArray(o.validators) && (!o.validators.length || Validator.isSDK(o.validators[0]))); + }, + isAmino(o: any): o is GetLatestValidatorSetResponseAmino { + return o && (o.$typeUrl === GetLatestValidatorSetResponse.typeUrl || typeof o.block_height === "bigint" && Array.isArray(o.validators) && (!o.validators.length || Validator.isAmino(o.validators[0]))); + }, encode(message: GetLatestValidatorSetResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.blockHeight !== BigInt(0)) { writer.uint32(8).int64(message.blockHeight); @@ -988,6 +1044,13 @@ export const GetLatestValidatorSetResponse = { typeUrl: "/cosmos.base.tendermint.v1beta1.GetLatestValidatorSetResponse", value: GetLatestValidatorSetResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GetLatestValidatorSetResponse.typeUrl)) { + return; + } + Validator.registerTypeUrl(); + PageResponse.registerTypeUrl(); } }; function createBaseValidator(): Validator { @@ -1007,6 +1070,15 @@ function createBaseValidator(): Validator { export const Validator = { typeUrl: "/cosmos.base.tendermint.v1beta1.Validator", aminoType: "cosmos-sdk/Validator", + is(o: any): o is Validator { + return o && (o.$typeUrl === Validator.typeUrl || typeof o.address === "string" && typeof o.votingPower === "bigint" && typeof o.proposerPriority === "bigint"); + }, + isSDK(o: any): o is ValidatorSDKType { + return o && (o.$typeUrl === Validator.typeUrl || typeof o.address === "string" && typeof o.voting_power === "bigint" && typeof o.proposer_priority === "bigint"); + }, + isAmino(o: any): o is ValidatorAmino { + return o && (o.$typeUrl === Validator.typeUrl || typeof o.address === "string" && typeof o.voting_power === "bigint" && typeof o.proposer_priority === "bigint"); + }, encode(message: Validator, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.address !== "") { writer.uint32(10).string(message.address); @@ -1121,7 +1193,8 @@ export const Validator = { typeUrl: "/cosmos.base.tendermint.v1beta1.Validator", value: Validator.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseGetBlockByHeightRequest(): GetBlockByHeightRequest { return { @@ -1137,6 +1210,15 @@ function createBaseGetBlockByHeightRequest(): GetBlockByHeightRequest { export const GetBlockByHeightRequest = { typeUrl: "/cosmos.base.tendermint.v1beta1.GetBlockByHeightRequest", aminoType: "cosmos-sdk/GetBlockByHeightRequest", + is(o: any): o is GetBlockByHeightRequest { + return o && (o.$typeUrl === GetBlockByHeightRequest.typeUrl || typeof o.height === "bigint"); + }, + isSDK(o: any): o is GetBlockByHeightRequestSDKType { + return o && (o.$typeUrl === GetBlockByHeightRequest.typeUrl || typeof o.height === "bigint"); + }, + isAmino(o: any): o is GetBlockByHeightRequestAmino { + return o && (o.$typeUrl === GetBlockByHeightRequest.typeUrl || typeof o.height === "bigint"); + }, encode(message: GetBlockByHeightRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.height !== BigInt(0)) { writer.uint32(8).int64(message.height); @@ -1205,7 +1287,8 @@ export const GetBlockByHeightRequest = { typeUrl: "/cosmos.base.tendermint.v1beta1.GetBlockByHeightRequest", value: GetBlockByHeightRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseGetBlockByHeightResponse(): GetBlockByHeightResponse { return { @@ -1222,6 +1305,15 @@ function createBaseGetBlockByHeightResponse(): GetBlockByHeightResponse { export const GetBlockByHeightResponse = { typeUrl: "/cosmos.base.tendermint.v1beta1.GetBlockByHeightResponse", aminoType: "cosmos-sdk/GetBlockByHeightResponse", + is(o: any): o is GetBlockByHeightResponse { + return o && o.$typeUrl === GetBlockByHeightResponse.typeUrl; + }, + isSDK(o: any): o is GetBlockByHeightResponseSDKType { + return o && o.$typeUrl === GetBlockByHeightResponse.typeUrl; + }, + isAmino(o: any): o is GetBlockByHeightResponseAmino { + return o && o.$typeUrl === GetBlockByHeightResponse.typeUrl; + }, encode(message: GetBlockByHeightResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.blockId !== undefined) { BlockID.encode(message.blockId, writer.uint32(10).fork()).ldelim(); @@ -1306,6 +1398,13 @@ export const GetBlockByHeightResponse = { typeUrl: "/cosmos.base.tendermint.v1beta1.GetBlockByHeightResponse", value: GetBlockByHeightResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GetBlockByHeightResponse.typeUrl)) { + return; + } + BlockID.registerTypeUrl(); + Block.registerTypeUrl(); } }; function createBaseGetLatestBlockRequest(): GetLatestBlockRequest { @@ -1320,6 +1419,15 @@ function createBaseGetLatestBlockRequest(): GetLatestBlockRequest { export const GetLatestBlockRequest = { typeUrl: "/cosmos.base.tendermint.v1beta1.GetLatestBlockRequest", aminoType: "cosmos-sdk/GetLatestBlockRequest", + is(o: any): o is GetLatestBlockRequest { + return o && o.$typeUrl === GetLatestBlockRequest.typeUrl; + }, + isSDK(o: any): o is GetLatestBlockRequestSDKType { + return o && o.$typeUrl === GetLatestBlockRequest.typeUrl; + }, + isAmino(o: any): o is GetLatestBlockRequestAmino { + return o && o.$typeUrl === GetLatestBlockRequest.typeUrl; + }, encode(_: GetLatestBlockRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -1371,7 +1479,8 @@ export const GetLatestBlockRequest = { typeUrl: "/cosmos.base.tendermint.v1beta1.GetLatestBlockRequest", value: GetLatestBlockRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseGetLatestBlockResponse(): GetLatestBlockResponse { return { @@ -1388,6 +1497,15 @@ function createBaseGetLatestBlockResponse(): GetLatestBlockResponse { export const GetLatestBlockResponse = { typeUrl: "/cosmos.base.tendermint.v1beta1.GetLatestBlockResponse", aminoType: "cosmos-sdk/GetLatestBlockResponse", + is(o: any): o is GetLatestBlockResponse { + return o && o.$typeUrl === GetLatestBlockResponse.typeUrl; + }, + isSDK(o: any): o is GetLatestBlockResponseSDKType { + return o && o.$typeUrl === GetLatestBlockResponse.typeUrl; + }, + isAmino(o: any): o is GetLatestBlockResponseAmino { + return o && o.$typeUrl === GetLatestBlockResponse.typeUrl; + }, encode(message: GetLatestBlockResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.blockId !== undefined) { BlockID.encode(message.blockId, writer.uint32(10).fork()).ldelim(); @@ -1472,6 +1590,13 @@ export const GetLatestBlockResponse = { typeUrl: "/cosmos.base.tendermint.v1beta1.GetLatestBlockResponse", value: GetLatestBlockResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GetLatestBlockResponse.typeUrl)) { + return; + } + BlockID.registerTypeUrl(); + Block.registerTypeUrl(); } }; function createBaseGetSyncingRequest(): GetSyncingRequest { @@ -1486,6 +1611,15 @@ function createBaseGetSyncingRequest(): GetSyncingRequest { export const GetSyncingRequest = { typeUrl: "/cosmos.base.tendermint.v1beta1.GetSyncingRequest", aminoType: "cosmos-sdk/GetSyncingRequest", + is(o: any): o is GetSyncingRequest { + return o && o.$typeUrl === GetSyncingRequest.typeUrl; + }, + isSDK(o: any): o is GetSyncingRequestSDKType { + return o && o.$typeUrl === GetSyncingRequest.typeUrl; + }, + isAmino(o: any): o is GetSyncingRequestAmino { + return o && o.$typeUrl === GetSyncingRequest.typeUrl; + }, encode(_: GetSyncingRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -1537,7 +1671,8 @@ export const GetSyncingRequest = { typeUrl: "/cosmos.base.tendermint.v1beta1.GetSyncingRequest", value: GetSyncingRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseGetSyncingResponse(): GetSyncingResponse { return { @@ -1553,6 +1688,15 @@ function createBaseGetSyncingResponse(): GetSyncingResponse { export const GetSyncingResponse = { typeUrl: "/cosmos.base.tendermint.v1beta1.GetSyncingResponse", aminoType: "cosmos-sdk/GetSyncingResponse", + is(o: any): o is GetSyncingResponse { + return o && (o.$typeUrl === GetSyncingResponse.typeUrl || typeof o.syncing === "boolean"); + }, + isSDK(o: any): o is GetSyncingResponseSDKType { + return o && (o.$typeUrl === GetSyncingResponse.typeUrl || typeof o.syncing === "boolean"); + }, + isAmino(o: any): o is GetSyncingResponseAmino { + return o && (o.$typeUrl === GetSyncingResponse.typeUrl || typeof o.syncing === "boolean"); + }, encode(message: GetSyncingResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.syncing === true) { writer.uint32(8).bool(message.syncing); @@ -1619,7 +1763,8 @@ export const GetSyncingResponse = { typeUrl: "/cosmos.base.tendermint.v1beta1.GetSyncingResponse", value: GetSyncingResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseGetNodeInfoRequest(): GetNodeInfoRequest { return {}; @@ -1633,6 +1778,15 @@ function createBaseGetNodeInfoRequest(): GetNodeInfoRequest { export const GetNodeInfoRequest = { typeUrl: "/cosmos.base.tendermint.v1beta1.GetNodeInfoRequest", aminoType: "cosmos-sdk/GetNodeInfoRequest", + is(o: any): o is GetNodeInfoRequest { + return o && o.$typeUrl === GetNodeInfoRequest.typeUrl; + }, + isSDK(o: any): o is GetNodeInfoRequestSDKType { + return o && o.$typeUrl === GetNodeInfoRequest.typeUrl; + }, + isAmino(o: any): o is GetNodeInfoRequestAmino { + return o && o.$typeUrl === GetNodeInfoRequest.typeUrl; + }, encode(_: GetNodeInfoRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -1684,7 +1838,8 @@ export const GetNodeInfoRequest = { typeUrl: "/cosmos.base.tendermint.v1beta1.GetNodeInfoRequest", value: GetNodeInfoRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseGetNodeInfoResponse(): GetNodeInfoResponse { return { @@ -1701,6 +1856,15 @@ function createBaseGetNodeInfoResponse(): GetNodeInfoResponse { export const GetNodeInfoResponse = { typeUrl: "/cosmos.base.tendermint.v1beta1.GetNodeInfoResponse", aminoType: "cosmos-sdk/GetNodeInfoResponse", + is(o: any): o is GetNodeInfoResponse { + return o && o.$typeUrl === GetNodeInfoResponse.typeUrl; + }, + isSDK(o: any): o is GetNodeInfoResponseSDKType { + return o && o.$typeUrl === GetNodeInfoResponse.typeUrl; + }, + isAmino(o: any): o is GetNodeInfoResponseAmino { + return o && o.$typeUrl === GetNodeInfoResponse.typeUrl; + }, encode(message: GetNodeInfoResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.nodeInfo !== undefined) { NodeInfo.encode(message.nodeInfo, writer.uint32(10).fork()).ldelim(); @@ -1785,6 +1949,13 @@ export const GetNodeInfoResponse = { typeUrl: "/cosmos.base.tendermint.v1beta1.GetNodeInfoResponse", value: GetNodeInfoResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GetNodeInfoResponse.typeUrl)) { + return; + } + NodeInfo.registerTypeUrl(); + VersionInfo.registerTypeUrl(); } }; function createBaseVersionInfo(): VersionInfo { @@ -1808,6 +1979,15 @@ function createBaseVersionInfo(): VersionInfo { export const VersionInfo = { typeUrl: "/cosmos.base.tendermint.v1beta1.VersionInfo", aminoType: "cosmos-sdk/VersionInfo", + is(o: any): o is VersionInfo { + return o && (o.$typeUrl === VersionInfo.typeUrl || typeof o.name === "string" && typeof o.appName === "string" && typeof o.version === "string" && typeof o.gitCommit === "string" && typeof o.buildTags === "string" && typeof o.goVersion === "string" && Array.isArray(o.buildDeps) && (!o.buildDeps.length || Module.is(o.buildDeps[0])) && typeof o.cosmosSdkVersion === "string"); + }, + isSDK(o: any): o is VersionInfoSDKType { + return o && (o.$typeUrl === VersionInfo.typeUrl || typeof o.name === "string" && typeof o.app_name === "string" && typeof o.version === "string" && typeof o.git_commit === "string" && typeof o.build_tags === "string" && typeof o.go_version === "string" && Array.isArray(o.build_deps) && (!o.build_deps.length || Module.isSDK(o.build_deps[0])) && typeof o.cosmos_sdk_version === "string"); + }, + isAmino(o: any): o is VersionInfoAmino { + return o && (o.$typeUrl === VersionInfo.typeUrl || typeof o.name === "string" && typeof o.app_name === "string" && typeof o.version === "string" && typeof o.git_commit === "string" && typeof o.build_tags === "string" && typeof o.go_version === "string" && Array.isArray(o.build_deps) && (!o.build_deps.length || Module.isAmino(o.build_deps[0])) && typeof o.cosmos_sdk_version === "string"); + }, encode(message: VersionInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -1978,6 +2158,12 @@ export const VersionInfo = { typeUrl: "/cosmos.base.tendermint.v1beta1.VersionInfo", value: VersionInfo.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(VersionInfo.typeUrl)) { + return; + } + Module.registerTypeUrl(); } }; function createBaseModule(): Module { @@ -1996,6 +2182,15 @@ function createBaseModule(): Module { export const Module = { typeUrl: "/cosmos.base.tendermint.v1beta1.Module", aminoType: "cosmos-sdk/Module", + is(o: any): o is Module { + return o && (o.$typeUrl === Module.typeUrl || typeof o.path === "string" && typeof o.version === "string" && typeof o.sum === "string"); + }, + isSDK(o: any): o is ModuleSDKType { + return o && (o.$typeUrl === Module.typeUrl || typeof o.path === "string" && typeof o.version === "string" && typeof o.sum === "string"); + }, + isAmino(o: any): o is ModuleAmino { + return o && (o.$typeUrl === Module.typeUrl || typeof o.path === "string" && typeof o.version === "string" && typeof o.sum === "string"); + }, encode(message: Module, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.path !== "") { writer.uint32(10).string(message.path); @@ -2090,5 +2285,6 @@ export const Module = { typeUrl: "/cosmos.base.tendermint.v1beta1.Module", value: Module.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/cosmos/base/v1beta1/coin.ts b/__fixtures__/v-next/outputv3/cosmos/base/v1beta1/coin.ts index b4f24c7696..6dd97c0213 100644 --- a/__fixtures__/v-next/outputv3/cosmos/base/v1beta1/coin.ts +++ b/__fixtures__/v-next/outputv3/cosmos/base/v1beta1/coin.ts @@ -1,6 +1,6 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; import { isSet, DeepPartial } from "../../../helpers"; -import { Decimal } from "@cosmjs/math"; +import { Decimal } from "@interchainjs/math"; export const protobufPackage = "cosmos.base.v1beta1"; /** * Coin defines a token with a denomination and an amount. @@ -168,6 +168,15 @@ function createBaseCoin(): Coin { export const Coin = { typeUrl: "/cosmos.base.v1beta1.Coin", aminoType: "cosmos-sdk/Coin", + is(o: any): o is Coin { + return o && (o.$typeUrl === Coin.typeUrl || typeof o.denom === "string" && typeof o.amount === "string"); + }, + isSDK(o: any): o is CoinSDKType { + return o && (o.$typeUrl === Coin.typeUrl || typeof o.denom === "string" && typeof o.amount === "string"); + }, + isAmino(o: any): o is CoinAmino { + return o && (o.$typeUrl === Coin.typeUrl || typeof o.denom === "string" && typeof o.amount === "string"); + }, encode(message: Coin, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.denom !== "") { writer.uint32(10).string(message.denom); @@ -248,7 +257,8 @@ export const Coin = { typeUrl: "/cosmos.base.v1beta1.Coin", value: Coin.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseDecCoin(): DecCoin { return { @@ -268,6 +278,15 @@ function createBaseDecCoin(): DecCoin { export const DecCoin = { typeUrl: "/cosmos.base.v1beta1.DecCoin", aminoType: "cosmos-sdk/DecCoin", + is(o: any): o is DecCoin { + return o && (o.$typeUrl === DecCoin.typeUrl || typeof o.denom === "string" && typeof o.amount === "string"); + }, + isSDK(o: any): o is DecCoinSDKType { + return o && (o.$typeUrl === DecCoin.typeUrl || typeof o.denom === "string" && typeof o.amount === "string"); + }, + isAmino(o: any): o is DecCoinAmino { + return o && (o.$typeUrl === DecCoin.typeUrl || typeof o.denom === "string" && typeof o.amount === "string"); + }, encode(message: DecCoin, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.denom !== "") { writer.uint32(10).string(message.denom); @@ -334,7 +353,7 @@ export const DecCoin = { toAmino(message: DecCoin, useInterfaces: boolean = true): DecCoinAmino { const obj: any = {}; obj.denom = message.denom === "" ? undefined : message.denom; - obj.amount = message.amount === "" ? undefined : message.amount; + obj.amount = message.amount === "" ? undefined : Decimal.fromUserInput(message.amount, 18).atomics; return obj; }, fromProtoMsg(message: DecCoinProtoMsg, useInterfaces: boolean = true): DecCoin { @@ -348,7 +367,8 @@ export const DecCoin = { typeUrl: "/cosmos.base.v1beta1.DecCoin", value: DecCoin.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseIntProto(): IntProto { return { @@ -364,6 +384,15 @@ function createBaseIntProto(): IntProto { export const IntProto = { typeUrl: "/cosmos.base.v1beta1.IntProto", aminoType: "cosmos-sdk/IntProto", + is(o: any): o is IntProto { + return o && (o.$typeUrl === IntProto.typeUrl || typeof o.int === "string"); + }, + isSDK(o: any): o is IntProtoSDKType { + return o && (o.$typeUrl === IntProto.typeUrl || typeof o.int === "string"); + }, + isAmino(o: any): o is IntProtoAmino { + return o && (o.$typeUrl === IntProto.typeUrl || typeof o.int === "string"); + }, encode(message: IntProto, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.int !== "") { writer.uint32(10).string(message.int); @@ -430,7 +459,8 @@ export const IntProto = { typeUrl: "/cosmos.base.v1beta1.IntProto", value: IntProto.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseDecProto(): DecProto { return { @@ -446,6 +476,15 @@ function createBaseDecProto(): DecProto { export const DecProto = { typeUrl: "/cosmos.base.v1beta1.DecProto", aminoType: "cosmos-sdk/DecProto", + is(o: any): o is DecProto { + return o && (o.$typeUrl === DecProto.typeUrl || typeof o.dec === "string"); + }, + isSDK(o: any): o is DecProtoSDKType { + return o && (o.$typeUrl === DecProto.typeUrl || typeof o.dec === "string"); + }, + isAmino(o: any): o is DecProtoAmino { + return o && (o.$typeUrl === DecProto.typeUrl || typeof o.dec === "string"); + }, encode(message: DecProto, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.dec !== "") { writer.uint32(10).string(Decimal.fromUserInput(message.dec, 18).atomics); @@ -498,7 +537,7 @@ export const DecProto = { }, toAmino(message: DecProto, useInterfaces: boolean = true): DecProtoAmino { const obj: any = {}; - obj.dec = message.dec === "" ? undefined : message.dec; + obj.dec = message.dec === "" ? undefined : Decimal.fromUserInput(message.dec, 18).atomics; return obj; }, fromProtoMsg(message: DecProtoProtoMsg, useInterfaces: boolean = true): DecProto { @@ -512,5 +551,6 @@ export const DecProto = { typeUrl: "/cosmos.base.v1beta1.DecProto", value: DecProto.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/cosmos/bundle.ts b/__fixtures__/v-next/outputv3/cosmos/bundle.ts index 3e3032cd75..3fed9ab940 100644 --- a/__fixtures__/v-next/outputv3/cosmos/bundle.ts +++ b/__fixtures__/v-next/outputv3/cosmos/bundle.ts @@ -90,93 +90,110 @@ import * as _143 from "./upgrade/v1beta1/tx"; import * as _144 from "./upgrade/v1beta1/upgrade"; import * as _145 from "./vesting/v1beta1/tx"; import * as _146 from "./vesting/v1beta1/vesting"; -import * as _356 from "./authz/v1beta1/tx.amino"; -import * as _357 from "./bank/v1beta1/tx.amino"; -import * as _358 from "./crisis/v1beta1/tx.amino"; -import * as _359 from "./distribution/v1beta1/tx.amino"; -import * as _360 from "./evidence/v1beta1/tx.amino"; -import * as _361 from "./feegrant/v1beta1/tx.amino"; -import * as _362 from "./gov/v1/tx.amino"; -import * as _363 from "./gov/v1beta1/tx.amino"; -import * as _364 from "./group/v1/tx.amino"; -import * as _365 from "./nft/v1beta1/tx.amino"; -import * as _366 from "./slashing/v1beta1/tx.amino"; -import * as _367 from "./staking/v1beta1/tx.amino"; -import * as _368 from "./upgrade/v1beta1/tx.amino"; -import * as _369 from "./vesting/v1beta1/tx.amino"; -import * as _370 from "./authz/v1beta1/tx.registry"; -import * as _371 from "./bank/v1beta1/tx.registry"; -import * as _372 from "./crisis/v1beta1/tx.registry"; -import * as _373 from "./distribution/v1beta1/tx.registry"; -import * as _374 from "./evidence/v1beta1/tx.registry"; -import * as _375 from "./feegrant/v1beta1/tx.registry"; -import * as _376 from "./gov/v1/tx.registry"; -import * as _377 from "./gov/v1beta1/tx.registry"; -import * as _378 from "./group/v1/tx.registry"; -import * as _379 from "./nft/v1beta1/tx.registry"; -import * as _380 from "./slashing/v1beta1/tx.registry"; -import * as _381 from "./staking/v1beta1/tx.registry"; -import * as _382 from "./upgrade/v1beta1/tx.registry"; -import * as _383 from "./vesting/v1beta1/tx.registry"; -import * as _384 from "./auth/v1beta1/query.lcd"; -import * as _385 from "./authz/v1beta1/query.lcd"; -import * as _386 from "./bank/v1beta1/query.lcd"; -import * as _387 from "./base/tendermint/v1beta1/query.lcd"; -import * as _388 from "./distribution/v1beta1/query.lcd"; -import * as _389 from "./evidence/v1beta1/query.lcd"; -import * as _390 from "./feegrant/v1beta1/query.lcd"; -import * as _391 from "./gov/v1/query.lcd"; -import * as _392 from "./gov/v1beta1/query.lcd"; -import * as _393 from "./group/v1/query.lcd"; -import * as _394 from "./mint/v1beta1/query.lcd"; -import * as _395 from "./nft/v1beta1/query.lcd"; -import * as _396 from "./params/v1beta1/query.lcd"; -import * as _397 from "./slashing/v1beta1/query.lcd"; -import * as _398 from "./staking/v1beta1/query.lcd"; -import * as _399 from "./tx/v1beta1/service.lcd"; -import * as _400 from "./upgrade/v1beta1/query.lcd"; -import * as _401 from "./app/v1alpha1/query.rpc.Query"; -import * as _402 from "./auth/v1beta1/query.rpc.Query"; -import * as _403 from "./authz/v1beta1/query.rpc.Query"; -import * as _404 from "./bank/v1beta1/query.rpc.Query"; -import * as _405 from "./base/tendermint/v1beta1/query.rpc.Service"; -import * as _406 from "./distribution/v1beta1/query.rpc.Query"; -import * as _407 from "./evidence/v1beta1/query.rpc.Query"; -import * as _408 from "./feegrant/v1beta1/query.rpc.Query"; -import * as _409 from "./gov/v1/query.rpc.Query"; -import * as _410 from "./gov/v1beta1/query.rpc.Query"; -import * as _411 from "./group/v1/query.rpc.Query"; -import * as _412 from "./mint/v1beta1/query.rpc.Query"; -import * as _413 from "./nft/v1beta1/query.rpc.Query"; -import * as _414 from "./params/v1beta1/query.rpc.Query"; -import * as _415 from "./slashing/v1beta1/query.rpc.Query"; -import * as _416 from "./staking/v1beta1/query.rpc.Query"; -import * as _417 from "./tx/v1beta1/service.rpc.Service"; -import * as _418 from "./upgrade/v1beta1/query.rpc.Query"; -import * as _419 from "./authz/v1beta1/tx.rpc.msg"; -import * as _420 from "./bank/v1beta1/tx.rpc.msg"; -import * as _421 from "./crisis/v1beta1/tx.rpc.msg"; -import * as _422 from "./distribution/v1beta1/tx.rpc.msg"; -import * as _423 from "./evidence/v1beta1/tx.rpc.msg"; -import * as _424 from "./feegrant/v1beta1/tx.rpc.msg"; -import * as _425 from "./gov/v1/tx.rpc.msg"; -import * as _426 from "./gov/v1beta1/tx.rpc.msg"; -import * as _427 from "./group/v1/tx.rpc.msg"; -import * as _428 from "./nft/v1beta1/tx.rpc.msg"; -import * as _429 from "./slashing/v1beta1/tx.rpc.msg"; -import * as _430 from "./staking/v1beta1/tx.rpc.msg"; -import * as _431 from "./upgrade/v1beta1/tx.rpc.msg"; -import * as _432 from "./vesting/v1beta1/tx.rpc.msg"; -import * as _534 from "./lcd"; -import * as _535 from "./rpc.query"; -import * as _536 from "./rpc.tx"; +import * as _364 from "./authz/v1beta1/tx.amino"; +import * as _365 from "./bank/v1beta1/tx.amino"; +import * as _366 from "./crisis/v1beta1/tx.amino"; +import * as _367 from "./distribution/v1beta1/tx.amino"; +import * as _368 from "./evidence/v1beta1/tx.amino"; +import * as _369 from "./feegrant/v1beta1/tx.amino"; +import * as _370 from "./gov/v1/tx.amino"; +import * as _371 from "./gov/v1beta1/tx.amino"; +import * as _372 from "./group/v1/tx.amino"; +import * as _373 from "./nft/v1beta1/tx.amino"; +import * as _374 from "./slashing/v1beta1/tx.amino"; +import * as _375 from "./staking/v1beta1/tx.amino"; +import * as _376 from "./upgrade/v1beta1/tx.amino"; +import * as _377 from "./vesting/v1beta1/tx.amino"; +import * as _378 from "./authz/v1beta1/tx.registry"; +import * as _379 from "./bank/v1beta1/tx.registry"; +import * as _380 from "./crisis/v1beta1/tx.registry"; +import * as _381 from "./distribution/v1beta1/tx.registry"; +import * as _382 from "./evidence/v1beta1/tx.registry"; +import * as _383 from "./feegrant/v1beta1/tx.registry"; +import * as _384 from "./gov/v1/tx.registry"; +import * as _385 from "./gov/v1beta1/tx.registry"; +import * as _386 from "./group/v1/tx.registry"; +import * as _387 from "./nft/v1beta1/tx.registry"; +import * as _388 from "./slashing/v1beta1/tx.registry"; +import * as _389 from "./staking/v1beta1/tx.registry"; +import * as _390 from "./upgrade/v1beta1/tx.registry"; +import * as _391 from "./vesting/v1beta1/tx.registry"; +import * as _392 from "./app/v1alpha1/query.rpc.func"; +import * as _393 from "./auth/v1beta1/query.rpc.func"; +import * as _394 from "./authz/v1beta1/query.rpc.func"; +import * as _395 from "./bank/v1beta1/query.rpc.func"; +import * as _396 from "./base/reflection/v1beta1/reflection.rpc.func"; +import * as _397 from "./base/reflection/v2alpha1/reflection.rpc.func"; +import * as _398 from "./base/tendermint/v1beta1/query.rpc.func"; +import * as _399 from "./distribution/v1beta1/query.rpc.func"; +import * as _400 from "./evidence/v1beta1/query.rpc.func"; +import * as _401 from "./feegrant/v1beta1/query.rpc.func"; +import * as _402 from "./gov/v1/query.rpc.func"; +import * as _403 from "./gov/v1beta1/query.rpc.func"; +import * as _404 from "./group/v1/query.rpc.func"; +import * as _405 from "./mint/v1beta1/query.rpc.func"; +import * as _406 from "./nft/v1beta1/query.rpc.func"; +import * as _407 from "./params/v1beta1/query.rpc.func"; +import * as _408 from "./slashing/v1beta1/query.rpc.func"; +import * as _409 from "./staking/v1beta1/query.rpc.func"; +import * as _410 from "./tx/v1beta1/service.rpc.func"; +import * as _411 from "./upgrade/v1beta1/query.rpc.func"; +import * as _412 from "./app/v1alpha1/query.rpc.Query"; +import * as _413 from "./auth/v1beta1/query.rpc.Query"; +import * as _414 from "./authz/v1beta1/query.rpc.Query"; +import * as _415 from "./bank/v1beta1/query.rpc.Query"; +import * as _416 from "./base/tendermint/v1beta1/query.rpc.Service"; +import * as _417 from "./distribution/v1beta1/query.rpc.Query"; +import * as _418 from "./evidence/v1beta1/query.rpc.Query"; +import * as _419 from "./feegrant/v1beta1/query.rpc.Query"; +import * as _420 from "./gov/v1/query.rpc.Query"; +import * as _421 from "./gov/v1beta1/query.rpc.Query"; +import * as _422 from "./group/v1/query.rpc.Query"; +import * as _423 from "./mint/v1beta1/query.rpc.Query"; +import * as _424 from "./nft/v1beta1/query.rpc.Query"; +import * as _425 from "./params/v1beta1/query.rpc.Query"; +import * as _426 from "./slashing/v1beta1/query.rpc.Query"; +import * as _427 from "./staking/v1beta1/query.rpc.Query"; +import * as _428 from "./tx/v1beta1/service.rpc.Service"; +import * as _429 from "./upgrade/v1beta1/query.rpc.Query"; +import * as _430 from "./authz/v1beta1/tx.rpc.func"; +import * as _431 from "./bank/v1beta1/tx.rpc.func"; +import * as _432 from "./crisis/v1beta1/tx.rpc.func"; +import * as _433 from "./distribution/v1beta1/tx.rpc.func"; +import * as _434 from "./evidence/v1beta1/tx.rpc.func"; +import * as _435 from "./feegrant/v1beta1/tx.rpc.func"; +import * as _436 from "./gov/v1/tx.rpc.func"; +import * as _437 from "./gov/v1beta1/tx.rpc.func"; +import * as _438 from "./group/v1/tx.rpc.func"; +import * as _439 from "./nft/v1beta1/tx.rpc.func"; +import * as _440 from "./slashing/v1beta1/tx.rpc.func"; +import * as _441 from "./staking/v1beta1/tx.rpc.func"; +import * as _442 from "./upgrade/v1beta1/tx.rpc.func"; +import * as _443 from "./vesting/v1beta1/tx.rpc.func"; +import * as _444 from "./authz/v1beta1/tx.rpc.msg"; +import * as _445 from "./bank/v1beta1/tx.rpc.msg"; +import * as _446 from "./crisis/v1beta1/tx.rpc.msg"; +import * as _447 from "./distribution/v1beta1/tx.rpc.msg"; +import * as _448 from "./evidence/v1beta1/tx.rpc.msg"; +import * as _449 from "./feegrant/v1beta1/tx.rpc.msg"; +import * as _450 from "./gov/v1/tx.rpc.msg"; +import * as _451 from "./gov/v1beta1/tx.rpc.msg"; +import * as _452 from "./group/v1/tx.rpc.msg"; +import * as _453 from "./nft/v1beta1/tx.rpc.msg"; +import * as _454 from "./slashing/v1beta1/tx.rpc.msg"; +import * as _455 from "./staking/v1beta1/tx.rpc.msg"; +import * as _456 from "./upgrade/v1beta1/tx.rpc.msg"; +import * as _457 from "./vesting/v1beta1/tx.rpc.msg"; +import * as _575 from "./rpc.query"; +import * as _576 from "./rpc.tx"; export namespace cosmos { export namespace app { export const v1alpha1 = { ..._55, ..._56, ..._57, - ..._401 + ..._392, + ..._412 }; } export namespace auth { @@ -184,8 +201,8 @@ export namespace cosmos { ..._58, ..._59, ..._60, - ..._384, - ..._402 + ..._393, + ..._413 }; } export namespace authz { @@ -194,11 +211,12 @@ export namespace cosmos { ..._62, ..._63, ..._64, - ..._356, - ..._370, - ..._385, - ..._403, - ..._419 + ..._364, + ..._378, + ..._394, + ..._414, + ..._430, + ..._444 }; } export namespace bank { @@ -208,11 +226,12 @@ export namespace cosmos { ..._67, ..._68, ..._69, - ..._357, - ..._371, - ..._386, - ..._404, - ..._420 + ..._365, + ..._379, + ..._395, + ..._415, + ..._431, + ..._445 }; } export namespace base { @@ -233,10 +252,12 @@ export namespace cosmos { } export namespace reflection { export const v1beta1 = { - ..._73 + ..._73, + ..._396 }; export const v2alpha1 = { - ..._74 + ..._74, + ..._397 }; } export namespace snapshots { @@ -253,8 +274,8 @@ export namespace cosmos { export namespace tendermint { export const v1beta1 = { ..._78, - ..._387, - ..._405 + ..._398, + ..._416 }; } export const v1beta1 = { @@ -271,9 +292,10 @@ export namespace cosmos { export const v1beta1 = { ..._82, ..._83, - ..._358, - ..._372, - ..._421 + ..._366, + ..._380, + ..._432, + ..._446 }; } export namespace crypto { @@ -306,11 +328,12 @@ export namespace cosmos { ..._91, ..._92, ..._93, - ..._359, - ..._373, - ..._388, - ..._406, - ..._422 + ..._367, + ..._381, + ..._399, + ..._417, + ..._433, + ..._447 }; } export namespace evidence { @@ -319,11 +342,12 @@ export namespace cosmos { ..._95, ..._96, ..._97, - ..._360, - ..._374, - ..._389, - ..._407, - ..._423 + ..._368, + ..._382, + ..._400, + ..._418, + ..._434, + ..._448 }; } export namespace feegrant { @@ -332,11 +356,12 @@ export namespace cosmos { ..._99, ..._100, ..._101, - ..._361, - ..._375, - ..._390, - ..._408, - ..._424 + ..._369, + ..._383, + ..._401, + ..._419, + ..._435, + ..._449 }; } export namespace genutil { @@ -350,22 +375,24 @@ export namespace cosmos { ..._104, ..._105, ..._106, - ..._362, - ..._376, - ..._391, - ..._409, - ..._425 + ..._370, + ..._384, + ..._402, + ..._420, + ..._436, + ..._450 }; export const v1beta1 = { ..._107, ..._108, ..._109, ..._110, - ..._363, - ..._377, - ..._392, - ..._410, - ..._426 + ..._371, + ..._385, + ..._403, + ..._421, + ..._437, + ..._451 }; } export namespace group { @@ -375,11 +402,12 @@ export namespace cosmos { ..._113, ..._114, ..._115, - ..._364, - ..._378, - ..._393, - ..._411, - ..._427 + ..._372, + ..._386, + ..._404, + ..._422, + ..._438, + ..._452 }; } export namespace mint { @@ -387,8 +415,8 @@ export namespace cosmos { ..._116, ..._117, ..._118, - ..._394, - ..._412 + ..._405, + ..._423 }; } export namespace msg { @@ -403,11 +431,12 @@ export namespace cosmos { ..._122, ..._123, ..._124, - ..._365, - ..._379, - ..._395, - ..._413, - ..._428 + ..._373, + ..._387, + ..._406, + ..._424, + ..._439, + ..._453 }; } export namespace orm { @@ -427,8 +456,8 @@ export namespace cosmos { export const v1beta1 = { ..._128, ..._129, - ..._396, - ..._414 + ..._407, + ..._425 }; } export namespace slashing { @@ -437,11 +466,12 @@ export namespace cosmos { ..._131, ..._132, ..._133, - ..._366, - ..._380, - ..._397, - ..._415, - ..._429 + ..._374, + ..._388, + ..._408, + ..._426, + ..._440, + ..._454 }; } export namespace staking { @@ -451,11 +481,12 @@ export namespace cosmos { ..._136, ..._137, ..._138, - ..._367, - ..._381, - ..._398, - ..._416, - ..._430 + ..._375, + ..._389, + ..._409, + ..._427, + ..._441, + ..._455 }; } export namespace tx { @@ -467,8 +498,8 @@ export namespace cosmos { export const v1beta1 = { ..._140, ..._141, - ..._399, - ..._417 + ..._410, + ..._428 }; } export namespace upgrade { @@ -476,25 +507,26 @@ export namespace cosmos { ..._142, ..._143, ..._144, - ..._368, - ..._382, - ..._400, - ..._418, - ..._431 + ..._376, + ..._390, + ..._411, + ..._429, + ..._442, + ..._456 }; } export namespace vesting { export const v1beta1 = { ..._145, ..._146, - ..._369, - ..._383, - ..._432 + ..._377, + ..._391, + ..._443, + ..._457 }; } export const ClientFactory = { - ..._534, - ..._535, - ..._536 + ..._575, + ..._576 }; } \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/cosmos/capability/v1beta1/capability.ts b/__fixtures__/v-next/outputv3/cosmos/capability/v1beta1/capability.ts index 2b17bb18f5..ed73687636 100644 --- a/__fixtures__/v-next/outputv3/cosmos/capability/v1beta1/capability.ts +++ b/__fixtures__/v-next/outputv3/cosmos/capability/v1beta1/capability.ts @@ -1,5 +1,6 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; import { isSet, DeepPartial } from "../../../helpers"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "cosmos.capability.v1beta1"; /** * Capability defines an implementation of an object capability. The index @@ -121,6 +122,15 @@ function createBaseCapability(): Capability { export const Capability = { typeUrl: "/cosmos.capability.v1beta1.Capability", aminoType: "cosmos-sdk/Capability", + is(o: any): o is Capability { + return o && (o.$typeUrl === Capability.typeUrl || typeof o.index === "bigint"); + }, + isSDK(o: any): o is CapabilitySDKType { + return o && (o.$typeUrl === Capability.typeUrl || typeof o.index === "bigint"); + }, + isAmino(o: any): o is CapabilityAmino { + return o && (o.$typeUrl === Capability.typeUrl || typeof o.index === "bigint"); + }, encode(message: Capability, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.index !== BigInt(0)) { writer.uint32(8).uint64(message.index); @@ -189,7 +199,8 @@ export const Capability = { typeUrl: "/cosmos.capability.v1beta1.Capability", value: Capability.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseOwner(): Owner { return { @@ -207,6 +218,15 @@ function createBaseOwner(): Owner { export const Owner = { typeUrl: "/cosmos.capability.v1beta1.Owner", aminoType: "cosmos-sdk/Owner", + is(o: any): o is Owner { + return o && (o.$typeUrl === Owner.typeUrl || typeof o.module === "string" && typeof o.name === "string"); + }, + isSDK(o: any): o is OwnerSDKType { + return o && (o.$typeUrl === Owner.typeUrl || typeof o.module === "string" && typeof o.name === "string"); + }, + isAmino(o: any): o is OwnerAmino { + return o && (o.$typeUrl === Owner.typeUrl || typeof o.module === "string" && typeof o.name === "string"); + }, encode(message: Owner, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.module !== "") { writer.uint32(10).string(message.module); @@ -287,7 +307,8 @@ export const Owner = { typeUrl: "/cosmos.capability.v1beta1.Owner", value: Owner.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseCapabilityOwners(): CapabilityOwners { return { @@ -304,6 +325,15 @@ function createBaseCapabilityOwners(): CapabilityOwners { export const CapabilityOwners = { typeUrl: "/cosmos.capability.v1beta1.CapabilityOwners", aminoType: "cosmos-sdk/CapabilityOwners", + is(o: any): o is CapabilityOwners { + return o && (o.$typeUrl === CapabilityOwners.typeUrl || Array.isArray(o.owners) && (!o.owners.length || Owner.is(o.owners[0]))); + }, + isSDK(o: any): o is CapabilityOwnersSDKType { + return o && (o.$typeUrl === CapabilityOwners.typeUrl || Array.isArray(o.owners) && (!o.owners.length || Owner.isSDK(o.owners[0]))); + }, + isAmino(o: any): o is CapabilityOwnersAmino { + return o && (o.$typeUrl === CapabilityOwners.typeUrl || Array.isArray(o.owners) && (!o.owners.length || Owner.isAmino(o.owners[0]))); + }, encode(message: CapabilityOwners, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.owners) { Owner.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -376,5 +406,11 @@ export const CapabilityOwners = { typeUrl: "/cosmos.capability.v1beta1.CapabilityOwners", value: CapabilityOwners.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(CapabilityOwners.typeUrl)) { + return; + } + Owner.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/cosmos/capability/v1beta1/genesis.ts b/__fixtures__/v-next/outputv3/cosmos/capability/v1beta1/genesis.ts index a3be4e61ca..1edcaf69e5 100644 --- a/__fixtures__/v-next/outputv3/cosmos/capability/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv3/cosmos/capability/v1beta1/genesis.ts @@ -1,5 +1,6 @@ import { CapabilityOwners, CapabilityOwnersAmino, CapabilityOwnersSDKType } from "./capability"; import { BinaryReader, BinaryWriter } from "../../../binary"; +import { GlobalDecoderRegistry } from "../../../registry"; import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "cosmos.capability.v1beta1"; /** @@ -111,6 +112,15 @@ function createBaseGenesisOwners(): GenesisOwners { export const GenesisOwners = { typeUrl: "/cosmos.capability.v1beta1.GenesisOwners", aminoType: "cosmos-sdk/GenesisOwners", + is(o: any): o is GenesisOwners { + return o && (o.$typeUrl === GenesisOwners.typeUrl || typeof o.index === "bigint" && CapabilityOwners.is(o.indexOwners)); + }, + isSDK(o: any): o is GenesisOwnersSDKType { + return o && (o.$typeUrl === GenesisOwners.typeUrl || typeof o.index === "bigint" && CapabilityOwners.isSDK(o.index_owners)); + }, + isAmino(o: any): o is GenesisOwnersAmino { + return o && (o.$typeUrl === GenesisOwners.typeUrl || typeof o.index === "bigint" && CapabilityOwners.isAmino(o.index_owners)); + }, encode(message: GenesisOwners, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.index !== BigInt(0)) { writer.uint32(8).uint64(message.index); @@ -195,6 +205,12 @@ export const GenesisOwners = { typeUrl: "/cosmos.capability.v1beta1.GenesisOwners", value: GenesisOwners.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GenesisOwners.typeUrl)) { + return; + } + CapabilityOwners.registerTypeUrl(); } }; function createBaseGenesisState(): GenesisState { @@ -212,6 +228,15 @@ function createBaseGenesisState(): GenesisState { export const GenesisState = { typeUrl: "/cosmos.capability.v1beta1.GenesisState", aminoType: "cosmos-sdk/GenesisState", + is(o: any): o is GenesisState { + return o && (o.$typeUrl === GenesisState.typeUrl || typeof o.index === "bigint" && Array.isArray(o.owners) && (!o.owners.length || GenesisOwners.is(o.owners[0]))); + }, + isSDK(o: any): o is GenesisStateSDKType { + return o && (o.$typeUrl === GenesisState.typeUrl || typeof o.index === "bigint" && Array.isArray(o.owners) && (!o.owners.length || GenesisOwners.isSDK(o.owners[0]))); + }, + isAmino(o: any): o is GenesisStateAmino { + return o && (o.$typeUrl === GenesisState.typeUrl || typeof o.index === "bigint" && Array.isArray(o.owners) && (!o.owners.length || GenesisOwners.isAmino(o.owners[0]))); + }, encode(message: GenesisState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.index !== BigInt(0)) { writer.uint32(8).uint64(message.index); @@ -300,5 +325,11 @@ export const GenesisState = { typeUrl: "/cosmos.capability.v1beta1.GenesisState", value: GenesisState.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GenesisState.typeUrl)) { + return; + } + GenesisOwners.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/cosmos/crisis/v1beta1/genesis.ts b/__fixtures__/v-next/outputv3/cosmos/crisis/v1beta1/genesis.ts index 9daf8ae475..d47b932ec2 100644 --- a/__fixtures__/v-next/outputv3/cosmos/crisis/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv3/cosmos/crisis/v1beta1/genesis.ts @@ -1,5 +1,6 @@ import { Coin, CoinAmino, CoinSDKType } from "../../base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; +import { GlobalDecoderRegistry } from "../../../registry"; import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "cosmos.crisis.v1beta1"; /** @@ -55,6 +56,15 @@ function createBaseGenesisState(): GenesisState { export const GenesisState = { typeUrl: "/cosmos.crisis.v1beta1.GenesisState", aminoType: "cosmos-sdk/GenesisState", + is(o: any): o is GenesisState { + return o && (o.$typeUrl === GenesisState.typeUrl || Coin.is(o.constantFee)); + }, + isSDK(o: any): o is GenesisStateSDKType { + return o && (o.$typeUrl === GenesisState.typeUrl || Coin.isSDK(o.constant_fee)); + }, + isAmino(o: any): o is GenesisStateAmino { + return o && (o.$typeUrl === GenesisState.typeUrl || Coin.isAmino(o.constant_fee)); + }, encode(message: GenesisState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.constantFee !== undefined) { Coin.encode(message.constantFee, writer.uint32(26).fork()).ldelim(); @@ -123,5 +133,11 @@ export const GenesisState = { typeUrl: "/cosmos.crisis.v1beta1.GenesisState", value: GenesisState.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GenesisState.typeUrl)) { + return; + } + Coin.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/cosmos/crisis/v1beta1/tx.registry.ts b/__fixtures__/v-next/outputv3/cosmos/crisis/v1beta1/tx.registry.ts index ce81f2df32..17d3ce901f 100644 --- a/__fixtures__/v-next/outputv3/cosmos/crisis/v1beta1/tx.registry.ts +++ b/__fixtures__/v-next/outputv3/cosmos/crisis/v1beta1/tx.registry.ts @@ -1,11 +1,6 @@ -import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { TelescopeGeneratedType } from "../../../types"; import { MsgVerifyInvariant, MsgVerifyInvariantSDKType } from "./tx"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/cosmos.crisis.v1beta1.MsgVerifyInvariant", MsgVerifyInvariant]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/cosmos.crisis.v1beta1.MsgVerifyInvariant", MsgVerifyInvariant]]; export const MessageComposer = { encoded: { verifyInvariant(value: MsgVerifyInvariant) { diff --git a/__fixtures__/v-next/outputv3/cosmos/crisis/v1beta1/tx.rpc.func.ts b/__fixtures__/v-next/outputv3/cosmos/crisis/v1beta1/tx.rpc.func.ts new file mode 100644 index 0000000000..da292c9a67 --- /dev/null +++ b/__fixtures__/v-next/outputv3/cosmos/crisis/v1beta1/tx.rpc.func.ts @@ -0,0 +1,11 @@ +import { buildTx } from "../../../helper-func-types"; +import { MsgVerifyInvariant, MsgVerifyInvariantSDKType, MsgVerifyInvariantResponse, MsgVerifyInvariantResponseSDKType } from "./tx"; +/** + * VerifyInvariant defines a method to verify a particular invariance. + * @name verifyInvariant + * @package cosmos.crisis.v1beta1 + * @see proto service: cosmos.crisis.v1beta1.VerifyInvariant + */ +export const verifyInvariant = buildTx({ + msg: MsgVerifyInvariant +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/cosmos/crisis/v1beta1/tx.ts b/__fixtures__/v-next/outputv3/cosmos/crisis/v1beta1/tx.ts index ca46066a6c..2620c9e062 100644 --- a/__fixtures__/v-next/outputv3/cosmos/crisis/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputv3/cosmos/crisis/v1beta1/tx.ts @@ -79,6 +79,15 @@ function createBaseMsgVerifyInvariant(): MsgVerifyInvariant { export const MsgVerifyInvariant = { typeUrl: "/cosmos.crisis.v1beta1.MsgVerifyInvariant", aminoType: "cosmos-sdk/MsgVerifyInvariant", + is(o: any): o is MsgVerifyInvariant { + return o && (o.$typeUrl === MsgVerifyInvariant.typeUrl || typeof o.sender === "string" && typeof o.invariantModuleName === "string" && typeof o.invariantRoute === "string"); + }, + isSDK(o: any): o is MsgVerifyInvariantSDKType { + return o && (o.$typeUrl === MsgVerifyInvariant.typeUrl || typeof o.sender === "string" && typeof o.invariant_module_name === "string" && typeof o.invariant_route === "string"); + }, + isAmino(o: any): o is MsgVerifyInvariantAmino { + return o && (o.$typeUrl === MsgVerifyInvariant.typeUrl || typeof o.sender === "string" && typeof o.invariant_module_name === "string" && typeof o.invariant_route === "string"); + }, encode(message: MsgVerifyInvariant, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.sender !== "") { writer.uint32(10).string(message.sender); @@ -173,7 +182,8 @@ export const MsgVerifyInvariant = { typeUrl: "/cosmos.crisis.v1beta1.MsgVerifyInvariant", value: MsgVerifyInvariant.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgVerifyInvariantResponse(): MsgVerifyInvariantResponse { return {}; @@ -187,6 +197,15 @@ function createBaseMsgVerifyInvariantResponse(): MsgVerifyInvariantResponse { export const MsgVerifyInvariantResponse = { typeUrl: "/cosmos.crisis.v1beta1.MsgVerifyInvariantResponse", aminoType: "cosmos-sdk/MsgVerifyInvariantResponse", + is(o: any): o is MsgVerifyInvariantResponse { + return o && o.$typeUrl === MsgVerifyInvariantResponse.typeUrl; + }, + isSDK(o: any): o is MsgVerifyInvariantResponseSDKType { + return o && o.$typeUrl === MsgVerifyInvariantResponse.typeUrl; + }, + isAmino(o: any): o is MsgVerifyInvariantResponseAmino { + return o && o.$typeUrl === MsgVerifyInvariantResponse.typeUrl; + }, encode(_: MsgVerifyInvariantResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -238,5 +257,6 @@ export const MsgVerifyInvariantResponse = { typeUrl: "/cosmos.crisis.v1beta1.MsgVerifyInvariantResponse", value: MsgVerifyInvariantResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/cosmos/crypto/ed25519/keys.ts b/__fixtures__/v-next/outputv3/cosmos/crypto/ed25519/keys.ts index 7ed6d13f6b..62862abd5c 100644 --- a/__fixtures__/v-next/outputv3/cosmos/crypto/ed25519/keys.ts +++ b/__fixtures__/v-next/outputv3/cosmos/crypto/ed25519/keys.ts @@ -96,6 +96,15 @@ function createBasePubKey(): PubKey { export const PubKey = { typeUrl: "/cosmos.crypto.ed25519.PubKey", aminoType: "cosmos-sdk/PubKey", + is(o: any): o is PubKey { + return o && (o.$typeUrl === PubKey.typeUrl || o.key instanceof Uint8Array || typeof o.key === "string"); + }, + isSDK(o: any): o is PubKeySDKType { + return o && (o.$typeUrl === PubKey.typeUrl || o.key instanceof Uint8Array || typeof o.key === "string"); + }, + isAmino(o: any): o is PubKeyAmino { + return o && (o.$typeUrl === PubKey.typeUrl || o.key instanceof Uint8Array || typeof o.key === "string"); + }, encode(message: PubKey, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.key.length !== 0) { writer.uint32(10).bytes(message.key); @@ -162,7 +171,8 @@ export const PubKey = { typeUrl: "/cosmos.crypto.ed25519.PubKey", value: PubKey.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBasePrivKey(): PrivKey { return { @@ -179,6 +189,15 @@ function createBasePrivKey(): PrivKey { export const PrivKey = { typeUrl: "/cosmos.crypto.ed25519.PrivKey", aminoType: "cosmos-sdk/PrivKey", + is(o: any): o is PrivKey { + return o && (o.$typeUrl === PrivKey.typeUrl || o.key instanceof Uint8Array || typeof o.key === "string"); + }, + isSDK(o: any): o is PrivKeySDKType { + return o && (o.$typeUrl === PrivKey.typeUrl || o.key instanceof Uint8Array || typeof o.key === "string"); + }, + isAmino(o: any): o is PrivKeyAmino { + return o && (o.$typeUrl === PrivKey.typeUrl || o.key instanceof Uint8Array || typeof o.key === "string"); + }, encode(message: PrivKey, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.key.length !== 0) { writer.uint32(10).bytes(message.key); @@ -245,5 +264,6 @@ export const PrivKey = { typeUrl: "/cosmos.crypto.ed25519.PrivKey", value: PrivKey.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/cosmos/crypto/hd/v1/hd.ts b/__fixtures__/v-next/outputv3/cosmos/crypto/hd/v1/hd.ts index 8456b10033..027550f27a 100644 --- a/__fixtures__/v-next/outputv3/cosmos/crypto/hd/v1/hd.ts +++ b/__fixtures__/v-next/outputv3/cosmos/crypto/hd/v1/hd.ts @@ -94,6 +94,15 @@ function createBaseBIP44Params(): BIP44Params { export const BIP44Params = { typeUrl: "/cosmos.crypto.hd.v1.BIP44Params", aminoType: "cosmos-sdk/BIP44Params", + is(o: any): o is BIP44Params { + return o && (o.$typeUrl === BIP44Params.typeUrl || typeof o.purpose === "number" && typeof o.coinType === "number" && typeof o.account === "number" && typeof o.change === "boolean" && typeof o.addressIndex === "number"); + }, + isSDK(o: any): o is BIP44ParamsSDKType { + return o && (o.$typeUrl === BIP44Params.typeUrl || typeof o.purpose === "number" && typeof o.coin_type === "number" && typeof o.account === "number" && typeof o.change === "boolean" && typeof o.address_index === "number"); + }, + isAmino(o: any): o is BIP44ParamsAmino { + return o && (o.$typeUrl === BIP44Params.typeUrl || typeof o.purpose === "number" && typeof o.coin_type === "number" && typeof o.account === "number" && typeof o.change === "boolean" && typeof o.address_index === "number"); + }, encode(message: BIP44Params, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.purpose !== 0) { writer.uint32(8).uint32(message.purpose); @@ -216,5 +225,6 @@ export const BIP44Params = { typeUrl: "/cosmos.crypto.hd.v1.BIP44Params", value: BIP44Params.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/cosmos/crypto/keyring/v1/record.ts b/__fixtures__/v-next/outputv3/cosmos/crypto/keyring/v1/record.ts index 03b1a7dbe1..3d0388bfe3 100644 --- a/__fixtures__/v-next/outputv3/cosmos/crypto/keyring/v1/record.ts +++ b/__fixtures__/v-next/outputv3/cosmos/crypto/keyring/v1/record.ts @@ -1,6 +1,7 @@ import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../../google/protobuf/any"; import { BIP44Params, BIP44ParamsAmino, BIP44ParamsSDKType } from "../../hd/v1/hd"; import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { GlobalDecoderRegistry } from "../../../../registry"; import { isSet, DeepPartial } from "../../../../helpers"; export const protobufPackage = "cosmos.crypto.keyring.v1"; /** @@ -222,6 +223,15 @@ function createBaseRecord(): Record { export const Record = { typeUrl: "/cosmos.crypto.keyring.v1.Record", aminoType: "cosmos-sdk/Record", + is(o: any): o is Record { + return o && (o.$typeUrl === Record.typeUrl || typeof o.name === "string"); + }, + isSDK(o: any): o is RecordSDKType { + return o && (o.$typeUrl === Record.typeUrl || typeof o.name === "string"); + }, + isAmino(o: any): o is RecordAmino { + return o && (o.$typeUrl === Record.typeUrl || typeof o.name === "string"); + }, encode(message: Record, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -368,6 +378,15 @@ export const Record = { typeUrl: "/cosmos.crypto.keyring.v1.Record", value: Record.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Record.typeUrl)) { + return; + } + Record_Local.registerTypeUrl(); + Record_Ledger.registerTypeUrl(); + Record_Multi.registerTypeUrl(); + Record_Offline.registerTypeUrl(); } }; function createBaseRecord_Local(): Record_Local { @@ -386,6 +405,15 @@ function createBaseRecord_Local(): Record_Local { export const Record_Local = { typeUrl: "/cosmos.crypto.keyring.v1.Local", aminoType: "cosmos-sdk/Local", + is(o: any): o is Record_Local { + return o && (o.$typeUrl === Record_Local.typeUrl || typeof o.privKeyType === "string"); + }, + isSDK(o: any): o is Record_LocalSDKType { + return o && (o.$typeUrl === Record_Local.typeUrl || typeof o.priv_key_type === "string"); + }, + isAmino(o: any): o is Record_LocalAmino { + return o && (o.$typeUrl === Record_Local.typeUrl || typeof o.priv_key_type === "string"); + }, encode(message: Record_Local, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.privKey !== undefined) { Any.encode(message.privKey, writer.uint32(10).fork()).ldelim(); @@ -468,7 +496,8 @@ export const Record_Local = { typeUrl: "/cosmos.crypto.keyring.v1.Local", value: Record_Local.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseRecord_Ledger(): Record_Ledger { return { @@ -484,6 +513,15 @@ function createBaseRecord_Ledger(): Record_Ledger { export const Record_Ledger = { typeUrl: "/cosmos.crypto.keyring.v1.Ledger", aminoType: "cosmos-sdk/Ledger", + is(o: any): o is Record_Ledger { + return o && o.$typeUrl === Record_Ledger.typeUrl; + }, + isSDK(o: any): o is Record_LedgerSDKType { + return o && o.$typeUrl === Record_Ledger.typeUrl; + }, + isAmino(o: any): o is Record_LedgerAmino { + return o && o.$typeUrl === Record_Ledger.typeUrl; + }, encode(message: Record_Ledger, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.path !== undefined) { BIP44Params.encode(message.path, writer.uint32(10).fork()).ldelim(); @@ -552,6 +590,12 @@ export const Record_Ledger = { typeUrl: "/cosmos.crypto.keyring.v1.Ledger", value: Record_Ledger.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Record_Ledger.typeUrl)) { + return; + } + BIP44Params.registerTypeUrl(); } }; function createBaseRecord_Multi(): Record_Multi { @@ -566,6 +610,15 @@ function createBaseRecord_Multi(): Record_Multi { export const Record_Multi = { typeUrl: "/cosmos.crypto.keyring.v1.Multi", aminoType: "cosmos-sdk/Multi", + is(o: any): o is Record_Multi { + return o && o.$typeUrl === Record_Multi.typeUrl; + }, + isSDK(o: any): o is Record_MultiSDKType { + return o && o.$typeUrl === Record_Multi.typeUrl; + }, + isAmino(o: any): o is Record_MultiAmino { + return o && o.$typeUrl === Record_Multi.typeUrl; + }, encode(_: Record_Multi, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -617,7 +670,8 @@ export const Record_Multi = { typeUrl: "/cosmos.crypto.keyring.v1.Multi", value: Record_Multi.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseRecord_Offline(): Record_Offline { return {}; @@ -631,6 +685,15 @@ function createBaseRecord_Offline(): Record_Offline { export const Record_Offline = { typeUrl: "/cosmos.crypto.keyring.v1.Offline", aminoType: "cosmos-sdk/Offline", + is(o: any): o is Record_Offline { + return o && o.$typeUrl === Record_Offline.typeUrl; + }, + isSDK(o: any): o is Record_OfflineSDKType { + return o && o.$typeUrl === Record_Offline.typeUrl; + }, + isAmino(o: any): o is Record_OfflineAmino { + return o && o.$typeUrl === Record_Offline.typeUrl; + }, encode(_: Record_Offline, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -682,5 +745,6 @@ export const Record_Offline = { typeUrl: "/cosmos.crypto.keyring.v1.Offline", value: Record_Offline.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/cosmos/crypto/multisig/keys.ts b/__fixtures__/v-next/outputv3/cosmos/crypto/multisig/keys.ts index 507a26c544..266fe59531 100644 --- a/__fixtures__/v-next/outputv3/cosmos/crypto/multisig/keys.ts +++ b/__fixtures__/v-next/outputv3/cosmos/crypto/multisig/keys.ts @@ -59,6 +59,15 @@ function createBaseLegacyAminoPubKey(): LegacyAminoPubKey { export const LegacyAminoPubKey = { typeUrl: "/cosmos.crypto.multisig.LegacyAminoPubKey", aminoType: "cosmos-sdk/LegacyAminoPubKey", + is(o: any): o is LegacyAminoPubKey { + return o && (o.$typeUrl === LegacyAminoPubKey.typeUrl || typeof o.threshold === "number" && Array.isArray(o.publicKeys) && (!o.publicKeys.length || Any.is(o.publicKeys[0]))); + }, + isSDK(o: any): o is LegacyAminoPubKeySDKType { + return o && (o.$typeUrl === LegacyAminoPubKey.typeUrl || typeof o.threshold === "number" && Array.isArray(o.public_keys) && (!o.public_keys.length || Any.isSDK(o.public_keys[0]))); + }, + isAmino(o: any): o is LegacyAminoPubKeyAmino { + return o && (o.$typeUrl === LegacyAminoPubKey.typeUrl || typeof o.threshold === "number" && Array.isArray(o.public_keys) && (!o.public_keys.length || Any.isAmino(o.public_keys[0]))); + }, encode(message: LegacyAminoPubKey, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.threshold !== 0) { writer.uint32(8).uint32(message.threshold); @@ -145,5 +154,6 @@ export const LegacyAminoPubKey = { typeUrl: "/cosmos.crypto.multisig.LegacyAminoPubKey", value: LegacyAminoPubKey.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/cosmos/crypto/multisig/v1beta1/multisig.ts b/__fixtures__/v-next/outputv3/cosmos/crypto/multisig/v1beta1/multisig.ts index 9f8eeb99ee..4ee082917d 100644 --- a/__fixtures__/v-next/outputv3/cosmos/crypto/multisig/v1beta1/multisig.ts +++ b/__fixtures__/v-next/outputv3/cosmos/crypto/multisig/v1beta1/multisig.ts @@ -97,6 +97,15 @@ function createBaseMultiSignature(): MultiSignature { export const MultiSignature = { typeUrl: "/cosmos.crypto.multisig.v1beta1.MultiSignature", aminoType: "cosmos-sdk/MultiSignature", + is(o: any): o is MultiSignature { + return o && (o.$typeUrl === MultiSignature.typeUrl || Array.isArray(o.signatures) && (!o.signatures.length || o.signatures[0] instanceof Uint8Array || typeof o.signatures[0] === "string")); + }, + isSDK(o: any): o is MultiSignatureSDKType { + return o && (o.$typeUrl === MultiSignature.typeUrl || Array.isArray(o.signatures) && (!o.signatures.length || o.signatures[0] instanceof Uint8Array || typeof o.signatures[0] === "string")); + }, + isAmino(o: any): o is MultiSignatureAmino { + return o && (o.$typeUrl === MultiSignature.typeUrl || Array.isArray(o.signatures) && (!o.signatures.length || o.signatures[0] instanceof Uint8Array || typeof o.signatures[0] === "string")); + }, encode(message: MultiSignature, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.signatures) { writer.uint32(10).bytes(v!); @@ -169,7 +178,8 @@ export const MultiSignature = { typeUrl: "/cosmos.crypto.multisig.v1beta1.MultiSignature", value: MultiSignature.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseCompactBitArray(): CompactBitArray { return { @@ -189,6 +199,15 @@ function createBaseCompactBitArray(): CompactBitArray { export const CompactBitArray = { typeUrl: "/cosmos.crypto.multisig.v1beta1.CompactBitArray", aminoType: "cosmos-sdk/CompactBitArray", + is(o: any): o is CompactBitArray { + return o && (o.$typeUrl === CompactBitArray.typeUrl || typeof o.extraBitsStored === "number" && (o.elems instanceof Uint8Array || typeof o.elems === "string")); + }, + isSDK(o: any): o is CompactBitArraySDKType { + return o && (o.$typeUrl === CompactBitArray.typeUrl || typeof o.extra_bits_stored === "number" && (o.elems instanceof Uint8Array || typeof o.elems === "string")); + }, + isAmino(o: any): o is CompactBitArrayAmino { + return o && (o.$typeUrl === CompactBitArray.typeUrl || typeof o.extra_bits_stored === "number" && (o.elems instanceof Uint8Array || typeof o.elems === "string")); + }, encode(message: CompactBitArray, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.extraBitsStored !== 0) { writer.uint32(8).uint32(message.extraBitsStored); @@ -269,5 +288,6 @@ export const CompactBitArray = { typeUrl: "/cosmos.crypto.multisig.v1beta1.CompactBitArray", value: CompactBitArray.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/cosmos/crypto/secp256k1/keys.ts b/__fixtures__/v-next/outputv3/cosmos/crypto/secp256k1/keys.ts index 1f06f9e0f3..76223dc1fc 100644 --- a/__fixtures__/v-next/outputv3/cosmos/crypto/secp256k1/keys.ts +++ b/__fixtures__/v-next/outputv3/cosmos/crypto/secp256k1/keys.ts @@ -93,6 +93,15 @@ function createBasePubKey(): PubKey { export const PubKey = { typeUrl: "/cosmos.crypto.secp256k1.PubKey", aminoType: "cosmos-sdk/PubKey", + is(o: any): o is PubKey { + return o && (o.$typeUrl === PubKey.typeUrl || o.key instanceof Uint8Array || typeof o.key === "string"); + }, + isSDK(o: any): o is PubKeySDKType { + return o && (o.$typeUrl === PubKey.typeUrl || o.key instanceof Uint8Array || typeof o.key === "string"); + }, + isAmino(o: any): o is PubKeyAmino { + return o && (o.$typeUrl === PubKey.typeUrl || o.key instanceof Uint8Array || typeof o.key === "string"); + }, encode(message: PubKey, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.key.length !== 0) { writer.uint32(10).bytes(message.key); @@ -159,7 +168,8 @@ export const PubKey = { typeUrl: "/cosmos.crypto.secp256k1.PubKey", value: PubKey.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBasePrivKey(): PrivKey { return { @@ -175,6 +185,15 @@ function createBasePrivKey(): PrivKey { export const PrivKey = { typeUrl: "/cosmos.crypto.secp256k1.PrivKey", aminoType: "cosmos-sdk/PrivKey", + is(o: any): o is PrivKey { + return o && (o.$typeUrl === PrivKey.typeUrl || o.key instanceof Uint8Array || typeof o.key === "string"); + }, + isSDK(o: any): o is PrivKeySDKType { + return o && (o.$typeUrl === PrivKey.typeUrl || o.key instanceof Uint8Array || typeof o.key === "string"); + }, + isAmino(o: any): o is PrivKeyAmino { + return o && (o.$typeUrl === PrivKey.typeUrl || o.key instanceof Uint8Array || typeof o.key === "string"); + }, encode(message: PrivKey, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.key.length !== 0) { writer.uint32(10).bytes(message.key); @@ -241,5 +260,6 @@ export const PrivKey = { typeUrl: "/cosmos.crypto.secp256k1.PrivKey", value: PrivKey.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/cosmos/crypto/secp256r1/keys.ts b/__fixtures__/v-next/outputv3/cosmos/crypto/secp256r1/keys.ts index 2c8eb7935a..6c0a3cf8cc 100644 --- a/__fixtures__/v-next/outputv3/cosmos/crypto/secp256r1/keys.ts +++ b/__fixtures__/v-next/outputv3/cosmos/crypto/secp256r1/keys.ts @@ -91,6 +91,15 @@ function createBasePubKey(): PubKey { export const PubKey = { typeUrl: "/cosmos.crypto.secp256r1.PubKey", aminoType: "cosmos-sdk/PubKey", + is(o: any): o is PubKey { + return o && (o.$typeUrl === PubKey.typeUrl || o.key instanceof Uint8Array || typeof o.key === "string"); + }, + isSDK(o: any): o is PubKeySDKType { + return o && (o.$typeUrl === PubKey.typeUrl || o.key instanceof Uint8Array || typeof o.key === "string"); + }, + isAmino(o: any): o is PubKeyAmino { + return o && (o.$typeUrl === PubKey.typeUrl || o.key instanceof Uint8Array || typeof o.key === "string"); + }, encode(message: PubKey, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.key.length !== 0) { writer.uint32(10).bytes(message.key); @@ -157,7 +166,8 @@ export const PubKey = { typeUrl: "/cosmos.crypto.secp256r1.PubKey", value: PubKey.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBasePrivKey(): PrivKey { return { @@ -173,6 +183,15 @@ function createBasePrivKey(): PrivKey { export const PrivKey = { typeUrl: "/cosmos.crypto.secp256r1.PrivKey", aminoType: "cosmos-sdk/PrivKey", + is(o: any): o is PrivKey { + return o && (o.$typeUrl === PrivKey.typeUrl || o.secret instanceof Uint8Array || typeof o.secret === "string"); + }, + isSDK(o: any): o is PrivKeySDKType { + return o && (o.$typeUrl === PrivKey.typeUrl || o.secret instanceof Uint8Array || typeof o.secret === "string"); + }, + isAmino(o: any): o is PrivKeyAmino { + return o && (o.$typeUrl === PrivKey.typeUrl || o.secret instanceof Uint8Array || typeof o.secret === "string"); + }, encode(message: PrivKey, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.secret.length !== 0) { writer.uint32(10).bytes(message.secret); @@ -239,5 +258,6 @@ export const PrivKey = { typeUrl: "/cosmos.crypto.secp256r1.PrivKey", value: PrivKey.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/cosmos/distribution/v1beta1/distribution.ts b/__fixtures__/v-next/outputv3/cosmos/distribution/v1beta1/distribution.ts index 368243c814..fc2b444517 100644 --- a/__fixtures__/v-next/outputv3/cosmos/distribution/v1beta1/distribution.ts +++ b/__fixtures__/v-next/outputv3/cosmos/distribution/v1beta1/distribution.ts @@ -1,7 +1,8 @@ import { DecCoin, DecCoinAmino, DecCoinSDKType, Coin, CoinAmino, CoinSDKType } from "../../base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { Decimal } from "@cosmjs/math"; +import { Decimal } from "@interchainjs/math"; import { isSet, DeepPartial } from "../../../helpers"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "cosmos.distribution.v1beta1"; /** * Params defines the set of params for the distribution module. @@ -521,6 +522,15 @@ function createBaseParams(): Params { export const Params = { typeUrl: "/cosmos.distribution.v1beta1.Params", aminoType: "cosmos-sdk/Params", + is(o: any): o is Params { + return o && (o.$typeUrl === Params.typeUrl || typeof o.communityTax === "string" && typeof o.baseProposerReward === "string" && typeof o.bonusProposerReward === "string" && typeof o.withdrawAddrEnabled === "boolean"); + }, + isSDK(o: any): o is ParamsSDKType { + return o && (o.$typeUrl === Params.typeUrl || typeof o.community_tax === "string" && typeof o.base_proposer_reward === "string" && typeof o.bonus_proposer_reward === "string" && typeof o.withdraw_addr_enabled === "boolean"); + }, + isAmino(o: any): o is ParamsAmino { + return o && (o.$typeUrl === Params.typeUrl || typeof o.community_tax === "string" && typeof o.base_proposer_reward === "string" && typeof o.bonus_proposer_reward === "string" && typeof o.withdraw_addr_enabled === "boolean"); + }, encode(message: Params, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.communityTax !== "") { writer.uint32(10).string(Decimal.fromUserInput(message.communityTax, 18).atomics); @@ -612,9 +622,9 @@ export const Params = { }, toAmino(message: Params, useInterfaces: boolean = true): ParamsAmino { const obj: any = {}; - obj.community_tax = message.communityTax === "" ? undefined : message.communityTax; - obj.base_proposer_reward = message.baseProposerReward === "" ? undefined : message.baseProposerReward; - obj.bonus_proposer_reward = message.bonusProposerReward === "" ? undefined : message.bonusProposerReward; + obj.community_tax = message.communityTax === "" ? undefined : Decimal.fromUserInput(message.communityTax, 18).atomics; + obj.base_proposer_reward = message.baseProposerReward === "" ? undefined : Decimal.fromUserInput(message.baseProposerReward, 18).atomics; + obj.bonus_proposer_reward = message.bonusProposerReward === "" ? undefined : Decimal.fromUserInput(message.bonusProposerReward, 18).atomics; obj.withdraw_addr_enabled = message.withdrawAddrEnabled === false ? undefined : message.withdrawAddrEnabled; return obj; }, @@ -629,7 +639,8 @@ export const Params = { typeUrl: "/cosmos.distribution.v1beta1.Params", value: Params.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseValidatorHistoricalRewards(): ValidatorHistoricalRewards { return { @@ -657,6 +668,15 @@ function createBaseValidatorHistoricalRewards(): ValidatorHistoricalRewards { export const ValidatorHistoricalRewards = { typeUrl: "/cosmos.distribution.v1beta1.ValidatorHistoricalRewards", aminoType: "cosmos-sdk/ValidatorHistoricalRewards", + is(o: any): o is ValidatorHistoricalRewards { + return o && (o.$typeUrl === ValidatorHistoricalRewards.typeUrl || Array.isArray(o.cumulativeRewardRatio) && (!o.cumulativeRewardRatio.length || DecCoin.is(o.cumulativeRewardRatio[0])) && typeof o.referenceCount === "number"); + }, + isSDK(o: any): o is ValidatorHistoricalRewardsSDKType { + return o && (o.$typeUrl === ValidatorHistoricalRewards.typeUrl || Array.isArray(o.cumulative_reward_ratio) && (!o.cumulative_reward_ratio.length || DecCoin.isSDK(o.cumulative_reward_ratio[0])) && typeof o.reference_count === "number"); + }, + isAmino(o: any): o is ValidatorHistoricalRewardsAmino { + return o && (o.$typeUrl === ValidatorHistoricalRewards.typeUrl || Array.isArray(o.cumulative_reward_ratio) && (!o.cumulative_reward_ratio.length || DecCoin.isAmino(o.cumulative_reward_ratio[0])) && typeof o.reference_count === "number"); + }, encode(message: ValidatorHistoricalRewards, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.cumulativeRewardRatio) { DecCoin.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -743,6 +763,12 @@ export const ValidatorHistoricalRewards = { typeUrl: "/cosmos.distribution.v1beta1.ValidatorHistoricalRewards", value: ValidatorHistoricalRewards.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ValidatorHistoricalRewards.typeUrl)) { + return; + } + DecCoin.registerTypeUrl(); } }; function createBaseValidatorCurrentRewards(): ValidatorCurrentRewards { @@ -762,6 +788,15 @@ function createBaseValidatorCurrentRewards(): ValidatorCurrentRewards { export const ValidatorCurrentRewards = { typeUrl: "/cosmos.distribution.v1beta1.ValidatorCurrentRewards", aminoType: "cosmos-sdk/ValidatorCurrentRewards", + is(o: any): o is ValidatorCurrentRewards { + return o && (o.$typeUrl === ValidatorCurrentRewards.typeUrl || Array.isArray(o.rewards) && (!o.rewards.length || DecCoin.is(o.rewards[0])) && typeof o.period === "bigint"); + }, + isSDK(o: any): o is ValidatorCurrentRewardsSDKType { + return o && (o.$typeUrl === ValidatorCurrentRewards.typeUrl || Array.isArray(o.rewards) && (!o.rewards.length || DecCoin.isSDK(o.rewards[0])) && typeof o.period === "bigint"); + }, + isAmino(o: any): o is ValidatorCurrentRewardsAmino { + return o && (o.$typeUrl === ValidatorCurrentRewards.typeUrl || Array.isArray(o.rewards) && (!o.rewards.length || DecCoin.isAmino(o.rewards[0])) && typeof o.period === "bigint"); + }, encode(message: ValidatorCurrentRewards, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.rewards) { DecCoin.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -850,6 +885,12 @@ export const ValidatorCurrentRewards = { typeUrl: "/cosmos.distribution.v1beta1.ValidatorCurrentRewards", value: ValidatorCurrentRewards.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ValidatorCurrentRewards.typeUrl)) { + return; + } + DecCoin.registerTypeUrl(); } }; function createBaseValidatorAccumulatedCommission(): ValidatorAccumulatedCommission { @@ -867,6 +908,15 @@ function createBaseValidatorAccumulatedCommission(): ValidatorAccumulatedCommiss export const ValidatorAccumulatedCommission = { typeUrl: "/cosmos.distribution.v1beta1.ValidatorAccumulatedCommission", aminoType: "cosmos-sdk/ValidatorAccumulatedCommission", + is(o: any): o is ValidatorAccumulatedCommission { + return o && (o.$typeUrl === ValidatorAccumulatedCommission.typeUrl || Array.isArray(o.commission) && (!o.commission.length || DecCoin.is(o.commission[0]))); + }, + isSDK(o: any): o is ValidatorAccumulatedCommissionSDKType { + return o && (o.$typeUrl === ValidatorAccumulatedCommission.typeUrl || Array.isArray(o.commission) && (!o.commission.length || DecCoin.isSDK(o.commission[0]))); + }, + isAmino(o: any): o is ValidatorAccumulatedCommissionAmino { + return o && (o.$typeUrl === ValidatorAccumulatedCommission.typeUrl || Array.isArray(o.commission) && (!o.commission.length || DecCoin.isAmino(o.commission[0]))); + }, encode(message: ValidatorAccumulatedCommission, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.commission) { DecCoin.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -939,6 +989,12 @@ export const ValidatorAccumulatedCommission = { typeUrl: "/cosmos.distribution.v1beta1.ValidatorAccumulatedCommission", value: ValidatorAccumulatedCommission.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ValidatorAccumulatedCommission.typeUrl)) { + return; + } + DecCoin.registerTypeUrl(); } }; function createBaseValidatorOutstandingRewards(): ValidatorOutstandingRewards { @@ -956,6 +1012,15 @@ function createBaseValidatorOutstandingRewards(): ValidatorOutstandingRewards { export const ValidatorOutstandingRewards = { typeUrl: "/cosmos.distribution.v1beta1.ValidatorOutstandingRewards", aminoType: "cosmos-sdk/ValidatorOutstandingRewards", + is(o: any): o is ValidatorOutstandingRewards { + return o && (o.$typeUrl === ValidatorOutstandingRewards.typeUrl || Array.isArray(o.rewards) && (!o.rewards.length || DecCoin.is(o.rewards[0]))); + }, + isSDK(o: any): o is ValidatorOutstandingRewardsSDKType { + return o && (o.$typeUrl === ValidatorOutstandingRewards.typeUrl || Array.isArray(o.rewards) && (!o.rewards.length || DecCoin.isSDK(o.rewards[0]))); + }, + isAmino(o: any): o is ValidatorOutstandingRewardsAmino { + return o && (o.$typeUrl === ValidatorOutstandingRewards.typeUrl || Array.isArray(o.rewards) && (!o.rewards.length || DecCoin.isAmino(o.rewards[0]))); + }, encode(message: ValidatorOutstandingRewards, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.rewards) { DecCoin.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -1028,6 +1093,12 @@ export const ValidatorOutstandingRewards = { typeUrl: "/cosmos.distribution.v1beta1.ValidatorOutstandingRewards", value: ValidatorOutstandingRewards.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ValidatorOutstandingRewards.typeUrl)) { + return; + } + DecCoin.registerTypeUrl(); } }; function createBaseValidatorSlashEvent(): ValidatorSlashEvent { @@ -1048,6 +1119,15 @@ function createBaseValidatorSlashEvent(): ValidatorSlashEvent { export const ValidatorSlashEvent = { typeUrl: "/cosmos.distribution.v1beta1.ValidatorSlashEvent", aminoType: "cosmos-sdk/ValidatorSlashEvent", + is(o: any): o is ValidatorSlashEvent { + return o && (o.$typeUrl === ValidatorSlashEvent.typeUrl || typeof o.validatorPeriod === "bigint" && typeof o.fraction === "string"); + }, + isSDK(o: any): o is ValidatorSlashEventSDKType { + return o && (o.$typeUrl === ValidatorSlashEvent.typeUrl || typeof o.validator_period === "bigint" && typeof o.fraction === "string"); + }, + isAmino(o: any): o is ValidatorSlashEventAmino { + return o && (o.$typeUrl === ValidatorSlashEvent.typeUrl || typeof o.validator_period === "bigint" && typeof o.fraction === "string"); + }, encode(message: ValidatorSlashEvent, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.validatorPeriod !== BigInt(0)) { writer.uint32(8).uint64(message.validatorPeriod); @@ -1116,7 +1196,7 @@ export const ValidatorSlashEvent = { toAmino(message: ValidatorSlashEvent, useInterfaces: boolean = true): ValidatorSlashEventAmino { const obj: any = {}; obj.validator_period = message.validatorPeriod !== BigInt(0) ? message.validatorPeriod?.toString() : undefined; - obj.fraction = message.fraction === "" ? undefined : message.fraction; + obj.fraction = message.fraction === "" ? undefined : Decimal.fromUserInput(message.fraction, 18).atomics; return obj; }, fromProtoMsg(message: ValidatorSlashEventProtoMsg, useInterfaces: boolean = true): ValidatorSlashEvent { @@ -1130,7 +1210,8 @@ export const ValidatorSlashEvent = { typeUrl: "/cosmos.distribution.v1beta1.ValidatorSlashEvent", value: ValidatorSlashEvent.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseValidatorSlashEvents(): ValidatorSlashEvents { return { @@ -1146,6 +1227,15 @@ function createBaseValidatorSlashEvents(): ValidatorSlashEvents { export const ValidatorSlashEvents = { typeUrl: "/cosmos.distribution.v1beta1.ValidatorSlashEvents", aminoType: "cosmos-sdk/ValidatorSlashEvents", + is(o: any): o is ValidatorSlashEvents { + return o && (o.$typeUrl === ValidatorSlashEvents.typeUrl || Array.isArray(o.validatorSlashEvents) && (!o.validatorSlashEvents.length || ValidatorSlashEvent.is(o.validatorSlashEvents[0]))); + }, + isSDK(o: any): o is ValidatorSlashEventsSDKType { + return o && (o.$typeUrl === ValidatorSlashEvents.typeUrl || Array.isArray(o.validator_slash_events) && (!o.validator_slash_events.length || ValidatorSlashEvent.isSDK(o.validator_slash_events[0]))); + }, + isAmino(o: any): o is ValidatorSlashEventsAmino { + return o && (o.$typeUrl === ValidatorSlashEvents.typeUrl || Array.isArray(o.validator_slash_events) && (!o.validator_slash_events.length || ValidatorSlashEvent.isAmino(o.validator_slash_events[0]))); + }, encode(message: ValidatorSlashEvents, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.validatorSlashEvents) { ValidatorSlashEvent.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -1218,6 +1308,12 @@ export const ValidatorSlashEvents = { typeUrl: "/cosmos.distribution.v1beta1.ValidatorSlashEvents", value: ValidatorSlashEvents.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ValidatorSlashEvents.typeUrl)) { + return; + } + ValidatorSlashEvent.registerTypeUrl(); } }; function createBaseFeePool(): FeePool { @@ -1234,6 +1330,15 @@ function createBaseFeePool(): FeePool { export const FeePool = { typeUrl: "/cosmos.distribution.v1beta1.FeePool", aminoType: "cosmos-sdk/FeePool", + is(o: any): o is FeePool { + return o && (o.$typeUrl === FeePool.typeUrl || Array.isArray(o.communityPool) && (!o.communityPool.length || DecCoin.is(o.communityPool[0]))); + }, + isSDK(o: any): o is FeePoolSDKType { + return o && (o.$typeUrl === FeePool.typeUrl || Array.isArray(o.community_pool) && (!o.community_pool.length || DecCoin.isSDK(o.community_pool[0]))); + }, + isAmino(o: any): o is FeePoolAmino { + return o && (o.$typeUrl === FeePool.typeUrl || Array.isArray(o.community_pool) && (!o.community_pool.length || DecCoin.isAmino(o.community_pool[0]))); + }, encode(message: FeePool, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.communityPool) { DecCoin.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -1306,6 +1411,12 @@ export const FeePool = { typeUrl: "/cosmos.distribution.v1beta1.FeePool", value: FeePool.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(FeePool.typeUrl)) { + return; + } + DecCoin.registerTypeUrl(); } }; function createBaseCommunityPoolSpendProposal(): CommunityPoolSpendProposal { @@ -1327,6 +1438,15 @@ function createBaseCommunityPoolSpendProposal(): CommunityPoolSpendProposal { export const CommunityPoolSpendProposal = { typeUrl: "/cosmos.distribution.v1beta1.CommunityPoolSpendProposal", aminoType: "cosmos-sdk/CommunityPoolSpendProposal", + is(o: any): o is CommunityPoolSpendProposal { + return o && (o.$typeUrl === CommunityPoolSpendProposal.typeUrl || typeof o.title === "string" && typeof o.description === "string" && typeof o.recipient === "string" && Array.isArray(o.amount) && (!o.amount.length || Coin.is(o.amount[0]))); + }, + isSDK(o: any): o is CommunityPoolSpendProposalSDKType { + return o && (o.$typeUrl === CommunityPoolSpendProposal.typeUrl || typeof o.title === "string" && typeof o.description === "string" && typeof o.recipient === "string" && Array.isArray(o.amount) && (!o.amount.length || Coin.isSDK(o.amount[0]))); + }, + isAmino(o: any): o is CommunityPoolSpendProposalAmino { + return o && (o.$typeUrl === CommunityPoolSpendProposal.typeUrl || typeof o.title === "string" && typeof o.description === "string" && typeof o.recipient === "string" && Array.isArray(o.amount) && (!o.amount.length || Coin.isAmino(o.amount[0]))); + }, encode(message: CommunityPoolSpendProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.title !== "") { writer.uint32(10).string(message.title); @@ -1441,6 +1561,12 @@ export const CommunityPoolSpendProposal = { typeUrl: "/cosmos.distribution.v1beta1.CommunityPoolSpendProposal", value: CommunityPoolSpendProposal.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(CommunityPoolSpendProposal.typeUrl)) { + return; + } + Coin.registerTypeUrl(); } }; function createBaseDelegatorStartingInfo(): DelegatorStartingInfo { @@ -1464,6 +1590,15 @@ function createBaseDelegatorStartingInfo(): DelegatorStartingInfo { export const DelegatorStartingInfo = { typeUrl: "/cosmos.distribution.v1beta1.DelegatorStartingInfo", aminoType: "cosmos-sdk/DelegatorStartingInfo", + is(o: any): o is DelegatorStartingInfo { + return o && (o.$typeUrl === DelegatorStartingInfo.typeUrl || typeof o.previousPeriod === "bigint" && typeof o.stake === "string" && typeof o.height === "bigint"); + }, + isSDK(o: any): o is DelegatorStartingInfoSDKType { + return o && (o.$typeUrl === DelegatorStartingInfo.typeUrl || typeof o.previous_period === "bigint" && typeof o.stake === "string" && typeof o.height === "bigint"); + }, + isAmino(o: any): o is DelegatorStartingInfoAmino { + return o && (o.$typeUrl === DelegatorStartingInfo.typeUrl || typeof o.previous_period === "bigint" && typeof o.stake === "string" && typeof o.height === "bigint"); + }, encode(message: DelegatorStartingInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.previousPeriod !== BigInt(0)) { writer.uint32(8).uint64(message.previousPeriod); @@ -1547,7 +1682,7 @@ export const DelegatorStartingInfo = { toAmino(message: DelegatorStartingInfo, useInterfaces: boolean = true): DelegatorStartingInfoAmino { const obj: any = {}; obj.previous_period = message.previousPeriod !== BigInt(0) ? message.previousPeriod?.toString() : undefined; - obj.stake = message.stake === "" ? undefined : message.stake; + obj.stake = message.stake === "" ? undefined : Decimal.fromUserInput(message.stake, 18).atomics; obj.height = message.height ? message.height?.toString() : "0"; return obj; }, @@ -1562,7 +1697,8 @@ export const DelegatorStartingInfo = { typeUrl: "/cosmos.distribution.v1beta1.DelegatorStartingInfo", value: DelegatorStartingInfo.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseDelegationDelegatorReward(): DelegationDelegatorReward { return { @@ -1580,6 +1716,15 @@ function createBaseDelegationDelegatorReward(): DelegationDelegatorReward { export const DelegationDelegatorReward = { typeUrl: "/cosmos.distribution.v1beta1.DelegationDelegatorReward", aminoType: "cosmos-sdk/DelegationDelegatorReward", + is(o: any): o is DelegationDelegatorReward { + return o && (o.$typeUrl === DelegationDelegatorReward.typeUrl || typeof o.validatorAddress === "string" && Array.isArray(o.reward) && (!o.reward.length || DecCoin.is(o.reward[0]))); + }, + isSDK(o: any): o is DelegationDelegatorRewardSDKType { + return o && (o.$typeUrl === DelegationDelegatorReward.typeUrl || typeof o.validator_address === "string" && Array.isArray(o.reward) && (!o.reward.length || DecCoin.isSDK(o.reward[0]))); + }, + isAmino(o: any): o is DelegationDelegatorRewardAmino { + return o && (o.$typeUrl === DelegationDelegatorReward.typeUrl || typeof o.validator_address === "string" && Array.isArray(o.reward) && (!o.reward.length || DecCoin.isAmino(o.reward[0]))); + }, encode(message: DelegationDelegatorReward, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.validatorAddress !== "") { writer.uint32(10).string(message.validatorAddress); @@ -1666,6 +1811,12 @@ export const DelegationDelegatorReward = { typeUrl: "/cosmos.distribution.v1beta1.DelegationDelegatorReward", value: DelegationDelegatorReward.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(DelegationDelegatorReward.typeUrl)) { + return; + } + DecCoin.registerTypeUrl(); } }; function createBaseCommunityPoolSpendProposalWithDeposit(): CommunityPoolSpendProposalWithDeposit { @@ -1687,6 +1838,15 @@ function createBaseCommunityPoolSpendProposalWithDeposit(): CommunityPoolSpendPr export const CommunityPoolSpendProposalWithDeposit = { typeUrl: "/cosmos.distribution.v1beta1.CommunityPoolSpendProposalWithDeposit", aminoType: "cosmos-sdk/CommunityPoolSpendProposalWithDeposit", + is(o: any): o is CommunityPoolSpendProposalWithDeposit { + return o && (o.$typeUrl === CommunityPoolSpendProposalWithDeposit.typeUrl || typeof o.title === "string" && typeof o.description === "string" && typeof o.recipient === "string" && typeof o.amount === "string" && typeof o.deposit === "string"); + }, + isSDK(o: any): o is CommunityPoolSpendProposalWithDepositSDKType { + return o && (o.$typeUrl === CommunityPoolSpendProposalWithDeposit.typeUrl || typeof o.title === "string" && typeof o.description === "string" && typeof o.recipient === "string" && typeof o.amount === "string" && typeof o.deposit === "string"); + }, + isAmino(o: any): o is CommunityPoolSpendProposalWithDepositAmino { + return o && (o.$typeUrl === CommunityPoolSpendProposalWithDeposit.typeUrl || typeof o.title === "string" && typeof o.description === "string" && typeof o.recipient === "string" && typeof o.amount === "string" && typeof o.deposit === "string"); + }, encode(message: CommunityPoolSpendProposalWithDeposit, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.title !== "") { writer.uint32(10).string(message.title); @@ -1809,5 +1969,6 @@ export const CommunityPoolSpendProposalWithDeposit = { typeUrl: "/cosmos.distribution.v1beta1.CommunityPoolSpendProposalWithDeposit", value: CommunityPoolSpendProposalWithDeposit.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/cosmos/distribution/v1beta1/genesis.ts b/__fixtures__/v-next/outputv3/cosmos/distribution/v1beta1/genesis.ts index 235b64e6ee..faa18ad2de 100644 --- a/__fixtures__/v-next/outputv3/cosmos/distribution/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv3/cosmos/distribution/v1beta1/genesis.ts @@ -2,6 +2,7 @@ import { DecCoin, DecCoinAmino, DecCoinSDKType } from "../../base/v1beta1/coin"; import { ValidatorAccumulatedCommission, ValidatorAccumulatedCommissionAmino, ValidatorAccumulatedCommissionSDKType, ValidatorHistoricalRewards, ValidatorHistoricalRewardsAmino, ValidatorHistoricalRewardsSDKType, ValidatorCurrentRewards, ValidatorCurrentRewardsAmino, ValidatorCurrentRewardsSDKType, DelegatorStartingInfo, DelegatorStartingInfoAmino, DelegatorStartingInfoSDKType, ValidatorSlashEvent, ValidatorSlashEventAmino, ValidatorSlashEventSDKType, Params, ParamsAmino, ParamsSDKType, FeePool, FeePoolAmino, FeePoolSDKType } from "./distribution"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { isSet, DeepPartial } from "../../../helpers"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "cosmos.distribution.v1beta1"; /** * DelegatorWithdrawInfo is the address for where distributions rewards are @@ -508,6 +509,15 @@ function createBaseDelegatorWithdrawInfo(): DelegatorWithdrawInfo { export const DelegatorWithdrawInfo = { typeUrl: "/cosmos.distribution.v1beta1.DelegatorWithdrawInfo", aminoType: "cosmos-sdk/DelegatorWithdrawInfo", + is(o: any): o is DelegatorWithdrawInfo { + return o && (o.$typeUrl === DelegatorWithdrawInfo.typeUrl || typeof o.delegatorAddress === "string" && typeof o.withdrawAddress === "string"); + }, + isSDK(o: any): o is DelegatorWithdrawInfoSDKType { + return o && (o.$typeUrl === DelegatorWithdrawInfo.typeUrl || typeof o.delegator_address === "string" && typeof o.withdraw_address === "string"); + }, + isAmino(o: any): o is DelegatorWithdrawInfoAmino { + return o && (o.$typeUrl === DelegatorWithdrawInfo.typeUrl || typeof o.delegator_address === "string" && typeof o.withdraw_address === "string"); + }, encode(message: DelegatorWithdrawInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.delegatorAddress !== "") { writer.uint32(10).string(message.delegatorAddress); @@ -588,7 +598,8 @@ export const DelegatorWithdrawInfo = { typeUrl: "/cosmos.distribution.v1beta1.DelegatorWithdrawInfo", value: DelegatorWithdrawInfo.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseValidatorOutstandingRewardsRecord(): ValidatorOutstandingRewardsRecord { return { @@ -605,6 +616,15 @@ function createBaseValidatorOutstandingRewardsRecord(): ValidatorOutstandingRewa export const ValidatorOutstandingRewardsRecord = { typeUrl: "/cosmos.distribution.v1beta1.ValidatorOutstandingRewardsRecord", aminoType: "cosmos-sdk/ValidatorOutstandingRewardsRecord", + is(o: any): o is ValidatorOutstandingRewardsRecord { + return o && (o.$typeUrl === ValidatorOutstandingRewardsRecord.typeUrl || typeof o.validatorAddress === "string" && Array.isArray(o.outstandingRewards) && (!o.outstandingRewards.length || DecCoin.is(o.outstandingRewards[0]))); + }, + isSDK(o: any): o is ValidatorOutstandingRewardsRecordSDKType { + return o && (o.$typeUrl === ValidatorOutstandingRewardsRecord.typeUrl || typeof o.validator_address === "string" && Array.isArray(o.outstanding_rewards) && (!o.outstanding_rewards.length || DecCoin.isSDK(o.outstanding_rewards[0]))); + }, + isAmino(o: any): o is ValidatorOutstandingRewardsRecordAmino { + return o && (o.$typeUrl === ValidatorOutstandingRewardsRecord.typeUrl || typeof o.validator_address === "string" && Array.isArray(o.outstanding_rewards) && (!o.outstanding_rewards.length || DecCoin.isAmino(o.outstanding_rewards[0]))); + }, encode(message: ValidatorOutstandingRewardsRecord, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.validatorAddress !== "") { writer.uint32(10).string(message.validatorAddress); @@ -691,6 +711,12 @@ export const ValidatorOutstandingRewardsRecord = { typeUrl: "/cosmos.distribution.v1beta1.ValidatorOutstandingRewardsRecord", value: ValidatorOutstandingRewardsRecord.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ValidatorOutstandingRewardsRecord.typeUrl)) { + return; + } + DecCoin.registerTypeUrl(); } }; function createBaseValidatorAccumulatedCommissionRecord(): ValidatorAccumulatedCommissionRecord { @@ -709,6 +735,15 @@ function createBaseValidatorAccumulatedCommissionRecord(): ValidatorAccumulatedC export const ValidatorAccumulatedCommissionRecord = { typeUrl: "/cosmos.distribution.v1beta1.ValidatorAccumulatedCommissionRecord", aminoType: "cosmos-sdk/ValidatorAccumulatedCommissionRecord", + is(o: any): o is ValidatorAccumulatedCommissionRecord { + return o && (o.$typeUrl === ValidatorAccumulatedCommissionRecord.typeUrl || typeof o.validatorAddress === "string" && ValidatorAccumulatedCommission.is(o.accumulated)); + }, + isSDK(o: any): o is ValidatorAccumulatedCommissionRecordSDKType { + return o && (o.$typeUrl === ValidatorAccumulatedCommissionRecord.typeUrl || typeof o.validator_address === "string" && ValidatorAccumulatedCommission.isSDK(o.accumulated)); + }, + isAmino(o: any): o is ValidatorAccumulatedCommissionRecordAmino { + return o && (o.$typeUrl === ValidatorAccumulatedCommissionRecord.typeUrl || typeof o.validator_address === "string" && ValidatorAccumulatedCommission.isAmino(o.accumulated)); + }, encode(message: ValidatorAccumulatedCommissionRecord, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.validatorAddress !== "") { writer.uint32(10).string(message.validatorAddress); @@ -791,6 +826,12 @@ export const ValidatorAccumulatedCommissionRecord = { typeUrl: "/cosmos.distribution.v1beta1.ValidatorAccumulatedCommissionRecord", value: ValidatorAccumulatedCommissionRecord.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ValidatorAccumulatedCommissionRecord.typeUrl)) { + return; + } + ValidatorAccumulatedCommission.registerTypeUrl(); } }; function createBaseValidatorHistoricalRewardsRecord(): ValidatorHistoricalRewardsRecord { @@ -810,6 +851,15 @@ function createBaseValidatorHistoricalRewardsRecord(): ValidatorHistoricalReward export const ValidatorHistoricalRewardsRecord = { typeUrl: "/cosmos.distribution.v1beta1.ValidatorHistoricalRewardsRecord", aminoType: "cosmos-sdk/ValidatorHistoricalRewardsRecord", + is(o: any): o is ValidatorHistoricalRewardsRecord { + return o && (o.$typeUrl === ValidatorHistoricalRewardsRecord.typeUrl || typeof o.validatorAddress === "string" && typeof o.period === "bigint" && ValidatorHistoricalRewards.is(o.rewards)); + }, + isSDK(o: any): o is ValidatorHistoricalRewardsRecordSDKType { + return o && (o.$typeUrl === ValidatorHistoricalRewardsRecord.typeUrl || typeof o.validator_address === "string" && typeof o.period === "bigint" && ValidatorHistoricalRewards.isSDK(o.rewards)); + }, + isAmino(o: any): o is ValidatorHistoricalRewardsRecordAmino { + return o && (o.$typeUrl === ValidatorHistoricalRewardsRecord.typeUrl || typeof o.validator_address === "string" && typeof o.period === "bigint" && ValidatorHistoricalRewards.isAmino(o.rewards)); + }, encode(message: ValidatorHistoricalRewardsRecord, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.validatorAddress !== "") { writer.uint32(10).string(message.validatorAddress); @@ -908,6 +958,12 @@ export const ValidatorHistoricalRewardsRecord = { typeUrl: "/cosmos.distribution.v1beta1.ValidatorHistoricalRewardsRecord", value: ValidatorHistoricalRewardsRecord.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ValidatorHistoricalRewardsRecord.typeUrl)) { + return; + } + ValidatorHistoricalRewards.registerTypeUrl(); } }; function createBaseValidatorCurrentRewardsRecord(): ValidatorCurrentRewardsRecord { @@ -925,6 +981,15 @@ function createBaseValidatorCurrentRewardsRecord(): ValidatorCurrentRewardsRecor export const ValidatorCurrentRewardsRecord = { typeUrl: "/cosmos.distribution.v1beta1.ValidatorCurrentRewardsRecord", aminoType: "cosmos-sdk/ValidatorCurrentRewardsRecord", + is(o: any): o is ValidatorCurrentRewardsRecord { + return o && (o.$typeUrl === ValidatorCurrentRewardsRecord.typeUrl || typeof o.validatorAddress === "string" && ValidatorCurrentRewards.is(o.rewards)); + }, + isSDK(o: any): o is ValidatorCurrentRewardsRecordSDKType { + return o && (o.$typeUrl === ValidatorCurrentRewardsRecord.typeUrl || typeof o.validator_address === "string" && ValidatorCurrentRewards.isSDK(o.rewards)); + }, + isAmino(o: any): o is ValidatorCurrentRewardsRecordAmino { + return o && (o.$typeUrl === ValidatorCurrentRewardsRecord.typeUrl || typeof o.validator_address === "string" && ValidatorCurrentRewards.isAmino(o.rewards)); + }, encode(message: ValidatorCurrentRewardsRecord, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.validatorAddress !== "") { writer.uint32(10).string(message.validatorAddress); @@ -1007,6 +1072,12 @@ export const ValidatorCurrentRewardsRecord = { typeUrl: "/cosmos.distribution.v1beta1.ValidatorCurrentRewardsRecord", value: ValidatorCurrentRewardsRecord.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ValidatorCurrentRewardsRecord.typeUrl)) { + return; + } + ValidatorCurrentRewards.registerTypeUrl(); } }; function createBaseDelegatorStartingInfoRecord(): DelegatorStartingInfoRecord { @@ -1025,6 +1096,15 @@ function createBaseDelegatorStartingInfoRecord(): DelegatorStartingInfoRecord { export const DelegatorStartingInfoRecord = { typeUrl: "/cosmos.distribution.v1beta1.DelegatorStartingInfoRecord", aminoType: "cosmos-sdk/DelegatorStartingInfoRecord", + is(o: any): o is DelegatorStartingInfoRecord { + return o && (o.$typeUrl === DelegatorStartingInfoRecord.typeUrl || typeof o.delegatorAddress === "string" && typeof o.validatorAddress === "string" && DelegatorStartingInfo.is(o.startingInfo)); + }, + isSDK(o: any): o is DelegatorStartingInfoRecordSDKType { + return o && (o.$typeUrl === DelegatorStartingInfoRecord.typeUrl || typeof o.delegator_address === "string" && typeof o.validator_address === "string" && DelegatorStartingInfo.isSDK(o.starting_info)); + }, + isAmino(o: any): o is DelegatorStartingInfoRecordAmino { + return o && (o.$typeUrl === DelegatorStartingInfoRecord.typeUrl || typeof o.delegator_address === "string" && typeof o.validator_address === "string" && DelegatorStartingInfo.isAmino(o.starting_info)); + }, encode(message: DelegatorStartingInfoRecord, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.delegatorAddress !== "") { writer.uint32(10).string(message.delegatorAddress); @@ -1121,6 +1201,12 @@ export const DelegatorStartingInfoRecord = { typeUrl: "/cosmos.distribution.v1beta1.DelegatorStartingInfoRecord", value: DelegatorStartingInfoRecord.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(DelegatorStartingInfoRecord.typeUrl)) { + return; + } + DelegatorStartingInfo.registerTypeUrl(); } }; function createBaseValidatorSlashEventRecord(): ValidatorSlashEventRecord { @@ -1140,6 +1226,15 @@ function createBaseValidatorSlashEventRecord(): ValidatorSlashEventRecord { export const ValidatorSlashEventRecord = { typeUrl: "/cosmos.distribution.v1beta1.ValidatorSlashEventRecord", aminoType: "cosmos-sdk/ValidatorSlashEventRecord", + is(o: any): o is ValidatorSlashEventRecord { + return o && (o.$typeUrl === ValidatorSlashEventRecord.typeUrl || typeof o.validatorAddress === "string" && typeof o.height === "bigint" && typeof o.period === "bigint" && ValidatorSlashEvent.is(o.validatorSlashEvent)); + }, + isSDK(o: any): o is ValidatorSlashEventRecordSDKType { + return o && (o.$typeUrl === ValidatorSlashEventRecord.typeUrl || typeof o.validator_address === "string" && typeof o.height === "bigint" && typeof o.period === "bigint" && ValidatorSlashEvent.isSDK(o.validator_slash_event)); + }, + isAmino(o: any): o is ValidatorSlashEventRecordAmino { + return o && (o.$typeUrl === ValidatorSlashEventRecord.typeUrl || typeof o.validator_address === "string" && typeof o.height === "bigint" && typeof o.period === "bigint" && ValidatorSlashEvent.isAmino(o.validator_slash_event)); + }, encode(message: ValidatorSlashEventRecord, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.validatorAddress !== "") { writer.uint32(10).string(message.validatorAddress); @@ -1254,6 +1349,12 @@ export const ValidatorSlashEventRecord = { typeUrl: "/cosmos.distribution.v1beta1.ValidatorSlashEventRecord", value: ValidatorSlashEventRecord.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ValidatorSlashEventRecord.typeUrl)) { + return; + } + ValidatorSlashEvent.registerTypeUrl(); } }; function createBaseGenesisState(): GenesisState { @@ -1279,6 +1380,15 @@ function createBaseGenesisState(): GenesisState { export const GenesisState = { typeUrl: "/cosmos.distribution.v1beta1.GenesisState", aminoType: "cosmos-sdk/GenesisState", + is(o: any): o is GenesisState { + return o && (o.$typeUrl === GenesisState.typeUrl || Params.is(o.params) && FeePool.is(o.feePool) && Array.isArray(o.delegatorWithdrawInfos) && (!o.delegatorWithdrawInfos.length || DelegatorWithdrawInfo.is(o.delegatorWithdrawInfos[0])) && typeof o.previousProposer === "string" && Array.isArray(o.outstandingRewards) && (!o.outstandingRewards.length || ValidatorOutstandingRewardsRecord.is(o.outstandingRewards[0])) && Array.isArray(o.validatorAccumulatedCommissions) && (!o.validatorAccumulatedCommissions.length || ValidatorAccumulatedCommissionRecord.is(o.validatorAccumulatedCommissions[0])) && Array.isArray(o.validatorHistoricalRewards) && (!o.validatorHistoricalRewards.length || ValidatorHistoricalRewardsRecord.is(o.validatorHistoricalRewards[0])) && Array.isArray(o.validatorCurrentRewards) && (!o.validatorCurrentRewards.length || ValidatorCurrentRewardsRecord.is(o.validatorCurrentRewards[0])) && Array.isArray(o.delegatorStartingInfos) && (!o.delegatorStartingInfos.length || DelegatorStartingInfoRecord.is(o.delegatorStartingInfos[0])) && Array.isArray(o.validatorSlashEvents) && (!o.validatorSlashEvents.length || ValidatorSlashEventRecord.is(o.validatorSlashEvents[0]))); + }, + isSDK(o: any): o is GenesisStateSDKType { + return o && (o.$typeUrl === GenesisState.typeUrl || Params.isSDK(o.params) && FeePool.isSDK(o.fee_pool) && Array.isArray(o.delegator_withdraw_infos) && (!o.delegator_withdraw_infos.length || DelegatorWithdrawInfo.isSDK(o.delegator_withdraw_infos[0])) && typeof o.previous_proposer === "string" && Array.isArray(o.outstanding_rewards) && (!o.outstanding_rewards.length || ValidatorOutstandingRewardsRecord.isSDK(o.outstanding_rewards[0])) && Array.isArray(o.validator_accumulated_commissions) && (!o.validator_accumulated_commissions.length || ValidatorAccumulatedCommissionRecord.isSDK(o.validator_accumulated_commissions[0])) && Array.isArray(o.validator_historical_rewards) && (!o.validator_historical_rewards.length || ValidatorHistoricalRewardsRecord.isSDK(o.validator_historical_rewards[0])) && Array.isArray(o.validator_current_rewards) && (!o.validator_current_rewards.length || ValidatorCurrentRewardsRecord.isSDK(o.validator_current_rewards[0])) && Array.isArray(o.delegator_starting_infos) && (!o.delegator_starting_infos.length || DelegatorStartingInfoRecord.isSDK(o.delegator_starting_infos[0])) && Array.isArray(o.validator_slash_events) && (!o.validator_slash_events.length || ValidatorSlashEventRecord.isSDK(o.validator_slash_events[0]))); + }, + isAmino(o: any): o is GenesisStateAmino { + return o && (o.$typeUrl === GenesisState.typeUrl || Params.isAmino(o.params) && FeePool.isAmino(o.fee_pool) && Array.isArray(o.delegator_withdraw_infos) && (!o.delegator_withdraw_infos.length || DelegatorWithdrawInfo.isAmino(o.delegator_withdraw_infos[0])) && typeof o.previous_proposer === "string" && Array.isArray(o.outstanding_rewards) && (!o.outstanding_rewards.length || ValidatorOutstandingRewardsRecord.isAmino(o.outstanding_rewards[0])) && Array.isArray(o.validator_accumulated_commissions) && (!o.validator_accumulated_commissions.length || ValidatorAccumulatedCommissionRecord.isAmino(o.validator_accumulated_commissions[0])) && Array.isArray(o.validator_historical_rewards) && (!o.validator_historical_rewards.length || ValidatorHistoricalRewardsRecord.isAmino(o.validator_historical_rewards[0])) && Array.isArray(o.validator_current_rewards) && (!o.validator_current_rewards.length || ValidatorCurrentRewardsRecord.isAmino(o.validator_current_rewards[0])) && Array.isArray(o.delegator_starting_infos) && (!o.delegator_starting_infos.length || DelegatorStartingInfoRecord.isAmino(o.delegator_starting_infos[0])) && Array.isArray(o.validator_slash_events) && (!o.validator_slash_events.length || ValidatorSlashEventRecord.isAmino(o.validator_slash_events[0]))); + }, encode(message: GenesisState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.params !== undefined) { Params.encode(message.params, writer.uint32(10).fork()).ldelim(); @@ -1517,5 +1627,19 @@ export const GenesisState = { typeUrl: "/cosmos.distribution.v1beta1.GenesisState", value: GenesisState.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GenesisState.typeUrl)) { + return; + } + Params.registerTypeUrl(); + FeePool.registerTypeUrl(); + DelegatorWithdrawInfo.registerTypeUrl(); + ValidatorOutstandingRewardsRecord.registerTypeUrl(); + ValidatorAccumulatedCommissionRecord.registerTypeUrl(); + ValidatorHistoricalRewardsRecord.registerTypeUrl(); + ValidatorCurrentRewardsRecord.registerTypeUrl(); + DelegatorStartingInfoRecord.registerTypeUrl(); + ValidatorSlashEventRecord.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/cosmos/distribution/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputv3/cosmos/distribution/v1beta1/query.rpc.func.ts new file mode 100644 index 0000000000..96e45b07b4 --- /dev/null +++ b/__fixtures__/v-next/outputv3/cosmos/distribution/v1beta1/query.rpc.func.ts @@ -0,0 +1,123 @@ +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; +import { Params, ParamsSDKType, ValidatorOutstandingRewards, ValidatorOutstandingRewardsSDKType, ValidatorAccumulatedCommission, ValidatorAccumulatedCommissionSDKType, ValidatorSlashEvent, ValidatorSlashEventSDKType, DelegationDelegatorReward, DelegationDelegatorRewardSDKType } from "./distribution"; +import { DecCoin, DecCoinSDKType } from "../../base/v1beta1/coin"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, QueryValidatorOutstandingRewardsRequest, QueryValidatorOutstandingRewardsRequestSDKType, QueryValidatorOutstandingRewardsResponse, QueryValidatorOutstandingRewardsResponseSDKType, QueryValidatorCommissionRequest, QueryValidatorCommissionRequestSDKType, QueryValidatorCommissionResponse, QueryValidatorCommissionResponseSDKType, QueryValidatorSlashesRequest, QueryValidatorSlashesRequestSDKType, QueryValidatorSlashesResponse, QueryValidatorSlashesResponseSDKType, QueryDelegationRewardsRequest, QueryDelegationRewardsRequestSDKType, QueryDelegationRewardsResponse, QueryDelegationRewardsResponseSDKType, QueryDelegationTotalRewardsRequest, QueryDelegationTotalRewardsRequestSDKType, QueryDelegationTotalRewardsResponse, QueryDelegationTotalRewardsResponseSDKType, QueryDelegatorValidatorsRequest, QueryDelegatorValidatorsRequestSDKType, QueryDelegatorValidatorsResponse, QueryDelegatorValidatorsResponseSDKType, QueryDelegatorWithdrawAddressRequest, QueryDelegatorWithdrawAddressRequestSDKType, QueryDelegatorWithdrawAddressResponse, QueryDelegatorWithdrawAddressResponseSDKType, QueryCommunityPoolRequest, QueryCommunityPoolRequestSDKType, QueryCommunityPoolResponse, QueryCommunityPoolResponseSDKType } from "./query"; +/** + * Params queries params of the distribution module. + * @name getParams + * @package cosmos.distribution.v1beta1 + * @see proto service: cosmos.distribution.v1beta1.Params + */ +export const getParams = buildQuery({ + encode: QueryParamsRequest.encode, + decode: QueryParamsResponse.decode, + service: "cosmos.distribution.v1beta1.Query", + method: "Params", + deps: [QueryParamsRequest, QueryParamsResponse] +}); +/** + * ValidatorOutstandingRewards queries rewards of a validator address. + * @name getValidatorOutstandingRewards + * @package cosmos.distribution.v1beta1 + * @see proto service: cosmos.distribution.v1beta1.ValidatorOutstandingRewards + */ +export const getValidatorOutstandingRewards = buildQuery({ + encode: QueryValidatorOutstandingRewardsRequest.encode, + decode: QueryValidatorOutstandingRewardsResponse.decode, + service: "cosmos.distribution.v1beta1.Query", + method: "ValidatorOutstandingRewards", + deps: [QueryValidatorOutstandingRewardsRequest, QueryValidatorOutstandingRewardsResponse] +}); +/** + * ValidatorCommission queries accumulated commission for a validator. + * @name getValidatorCommission + * @package cosmos.distribution.v1beta1 + * @see proto service: cosmos.distribution.v1beta1.ValidatorCommission + */ +export const getValidatorCommission = buildQuery({ + encode: QueryValidatorCommissionRequest.encode, + decode: QueryValidatorCommissionResponse.decode, + service: "cosmos.distribution.v1beta1.Query", + method: "ValidatorCommission", + deps: [QueryValidatorCommissionRequest, QueryValidatorCommissionResponse] +}); +/** + * ValidatorSlashes queries slash events of a validator. + * @name getValidatorSlashes + * @package cosmos.distribution.v1beta1 + * @see proto service: cosmos.distribution.v1beta1.ValidatorSlashes + */ +export const getValidatorSlashes = buildQuery({ + encode: QueryValidatorSlashesRequest.encode, + decode: QueryValidatorSlashesResponse.decode, + service: "cosmos.distribution.v1beta1.Query", + method: "ValidatorSlashes", + deps: [QueryValidatorSlashesRequest, QueryValidatorSlashesResponse] +}); +/** + * DelegationRewards queries the total rewards accrued by a delegation. + * @name getDelegationRewards + * @package cosmos.distribution.v1beta1 + * @see proto service: cosmos.distribution.v1beta1.DelegationRewards + */ +export const getDelegationRewards = buildQuery({ + encode: QueryDelegationRewardsRequest.encode, + decode: QueryDelegationRewardsResponse.decode, + service: "cosmos.distribution.v1beta1.Query", + method: "DelegationRewards", + deps: [QueryDelegationRewardsRequest, QueryDelegationRewardsResponse] +}); +/** + * DelegationTotalRewards queries the total rewards accrued by a each + * validator. + * @name getDelegationTotalRewards + * @package cosmos.distribution.v1beta1 + * @see proto service: cosmos.distribution.v1beta1.DelegationTotalRewards + */ +export const getDelegationTotalRewards = buildQuery({ + encode: QueryDelegationTotalRewardsRequest.encode, + decode: QueryDelegationTotalRewardsResponse.decode, + service: "cosmos.distribution.v1beta1.Query", + method: "DelegationTotalRewards", + deps: [QueryDelegationTotalRewardsRequest, QueryDelegationTotalRewardsResponse] +}); +/** + * DelegatorValidators queries the validators of a delegator. + * @name getDelegatorValidators + * @package cosmos.distribution.v1beta1 + * @see proto service: cosmos.distribution.v1beta1.DelegatorValidators + */ +export const getDelegatorValidators = buildQuery({ + encode: QueryDelegatorValidatorsRequest.encode, + decode: QueryDelegatorValidatorsResponse.decode, + service: "cosmos.distribution.v1beta1.Query", + method: "DelegatorValidators", + deps: [QueryDelegatorValidatorsRequest, QueryDelegatorValidatorsResponse] +}); +/** + * DelegatorWithdrawAddress queries withdraw address of a delegator. + * @name getDelegatorWithdrawAddress + * @package cosmos.distribution.v1beta1 + * @see proto service: cosmos.distribution.v1beta1.DelegatorWithdrawAddress + */ +export const getDelegatorWithdrawAddress = buildQuery({ + encode: QueryDelegatorWithdrawAddressRequest.encode, + decode: QueryDelegatorWithdrawAddressResponse.decode, + service: "cosmos.distribution.v1beta1.Query", + method: "DelegatorWithdrawAddress", + deps: [QueryDelegatorWithdrawAddressRequest, QueryDelegatorWithdrawAddressResponse] +}); +/** + * CommunityPool queries the community pool coins. + * @name getCommunityPool + * @package cosmos.distribution.v1beta1 + * @see proto service: cosmos.distribution.v1beta1.CommunityPool + */ +export const getCommunityPool = buildQuery({ + encode: QueryCommunityPoolRequest.encode, + decode: QueryCommunityPoolResponse.decode, + service: "cosmos.distribution.v1beta1.Query", + method: "CommunityPool", + deps: [QueryCommunityPoolRequest, QueryCommunityPoolResponse] +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/cosmos/distribution/v1beta1/query.ts b/__fixtures__/v-next/outputv3/cosmos/distribution/v1beta1/query.ts index d6ecabe3f6..6b785f55e2 100644 --- a/__fixtures__/v-next/outputv3/cosmos/distribution/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv3/cosmos/distribution/v1beta1/query.ts @@ -3,6 +3,7 @@ import { Params, ParamsAmino, ParamsSDKType, ValidatorOutstandingRewards, Valida import { DecCoin, DecCoinAmino, DecCoinSDKType } from "../../base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { DeepPartial, isSet } from "../../../helpers"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "cosmos.distribution.v1beta1"; /** * QueryParamsRequest is the request type for the Query/Params RPC method. @@ -754,6 +755,15 @@ function createBaseQueryParamsRequest(): QueryParamsRequest { export const QueryParamsRequest = { typeUrl: "/cosmos.distribution.v1beta1.QueryParamsRequest", aminoType: "cosmos-sdk/QueryParamsRequest", + is(o: any): o is QueryParamsRequest { + return o && o.$typeUrl === QueryParamsRequest.typeUrl; + }, + isSDK(o: any): o is QueryParamsRequestSDKType { + return o && o.$typeUrl === QueryParamsRequest.typeUrl; + }, + isAmino(o: any): o is QueryParamsRequestAmino { + return o && o.$typeUrl === QueryParamsRequest.typeUrl; + }, encode(_: QueryParamsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -805,7 +815,8 @@ export const QueryParamsRequest = { typeUrl: "/cosmos.distribution.v1beta1.QueryParamsRequest", value: QueryParamsRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryParamsResponse(): QueryParamsResponse { return { @@ -821,6 +832,15 @@ function createBaseQueryParamsResponse(): QueryParamsResponse { export const QueryParamsResponse = { typeUrl: "/cosmos.distribution.v1beta1.QueryParamsResponse", aminoType: "cosmos-sdk/QueryParamsResponse", + is(o: any): o is QueryParamsResponse { + return o && (o.$typeUrl === QueryParamsResponse.typeUrl || Params.is(o.params)); + }, + isSDK(o: any): o is QueryParamsResponseSDKType { + return o && (o.$typeUrl === QueryParamsResponse.typeUrl || Params.isSDK(o.params)); + }, + isAmino(o: any): o is QueryParamsResponseAmino { + return o && (o.$typeUrl === QueryParamsResponse.typeUrl || Params.isAmino(o.params)); + }, encode(message: QueryParamsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.params !== undefined) { Params.encode(message.params, writer.uint32(10).fork()).ldelim(); @@ -889,6 +909,12 @@ export const QueryParamsResponse = { typeUrl: "/cosmos.distribution.v1beta1.QueryParamsResponse", value: QueryParamsResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryParamsResponse.typeUrl)) { + return; + } + Params.registerTypeUrl(); } }; function createBaseQueryValidatorOutstandingRewardsRequest(): QueryValidatorOutstandingRewardsRequest { @@ -906,6 +932,15 @@ function createBaseQueryValidatorOutstandingRewardsRequest(): QueryValidatorOuts export const QueryValidatorOutstandingRewardsRequest = { typeUrl: "/cosmos.distribution.v1beta1.QueryValidatorOutstandingRewardsRequest", aminoType: "cosmos-sdk/QueryValidatorOutstandingRewardsRequest", + is(o: any): o is QueryValidatorOutstandingRewardsRequest { + return o && (o.$typeUrl === QueryValidatorOutstandingRewardsRequest.typeUrl || typeof o.validatorAddress === "string"); + }, + isSDK(o: any): o is QueryValidatorOutstandingRewardsRequestSDKType { + return o && (o.$typeUrl === QueryValidatorOutstandingRewardsRequest.typeUrl || typeof o.validator_address === "string"); + }, + isAmino(o: any): o is QueryValidatorOutstandingRewardsRequestAmino { + return o && (o.$typeUrl === QueryValidatorOutstandingRewardsRequest.typeUrl || typeof o.validator_address === "string"); + }, encode(message: QueryValidatorOutstandingRewardsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.validatorAddress !== "") { writer.uint32(10).string(message.validatorAddress); @@ -972,7 +1007,8 @@ export const QueryValidatorOutstandingRewardsRequest = { typeUrl: "/cosmos.distribution.v1beta1.QueryValidatorOutstandingRewardsRequest", value: QueryValidatorOutstandingRewardsRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryValidatorOutstandingRewardsResponse(): QueryValidatorOutstandingRewardsResponse { return { @@ -989,6 +1025,15 @@ function createBaseQueryValidatorOutstandingRewardsResponse(): QueryValidatorOut export const QueryValidatorOutstandingRewardsResponse = { typeUrl: "/cosmos.distribution.v1beta1.QueryValidatorOutstandingRewardsResponse", aminoType: "cosmos-sdk/QueryValidatorOutstandingRewardsResponse", + is(o: any): o is QueryValidatorOutstandingRewardsResponse { + return o && (o.$typeUrl === QueryValidatorOutstandingRewardsResponse.typeUrl || ValidatorOutstandingRewards.is(o.rewards)); + }, + isSDK(o: any): o is QueryValidatorOutstandingRewardsResponseSDKType { + return o && (o.$typeUrl === QueryValidatorOutstandingRewardsResponse.typeUrl || ValidatorOutstandingRewards.isSDK(o.rewards)); + }, + isAmino(o: any): o is QueryValidatorOutstandingRewardsResponseAmino { + return o && (o.$typeUrl === QueryValidatorOutstandingRewardsResponse.typeUrl || ValidatorOutstandingRewards.isAmino(o.rewards)); + }, encode(message: QueryValidatorOutstandingRewardsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.rewards !== undefined) { ValidatorOutstandingRewards.encode(message.rewards, writer.uint32(10).fork()).ldelim(); @@ -1057,6 +1102,12 @@ export const QueryValidatorOutstandingRewardsResponse = { typeUrl: "/cosmos.distribution.v1beta1.QueryValidatorOutstandingRewardsResponse", value: QueryValidatorOutstandingRewardsResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryValidatorOutstandingRewardsResponse.typeUrl)) { + return; + } + ValidatorOutstandingRewards.registerTypeUrl(); } }; function createBaseQueryValidatorCommissionRequest(): QueryValidatorCommissionRequest { @@ -1074,6 +1125,15 @@ function createBaseQueryValidatorCommissionRequest(): QueryValidatorCommissionRe export const QueryValidatorCommissionRequest = { typeUrl: "/cosmos.distribution.v1beta1.QueryValidatorCommissionRequest", aminoType: "cosmos-sdk/QueryValidatorCommissionRequest", + is(o: any): o is QueryValidatorCommissionRequest { + return o && (o.$typeUrl === QueryValidatorCommissionRequest.typeUrl || typeof o.validatorAddress === "string"); + }, + isSDK(o: any): o is QueryValidatorCommissionRequestSDKType { + return o && (o.$typeUrl === QueryValidatorCommissionRequest.typeUrl || typeof o.validator_address === "string"); + }, + isAmino(o: any): o is QueryValidatorCommissionRequestAmino { + return o && (o.$typeUrl === QueryValidatorCommissionRequest.typeUrl || typeof o.validator_address === "string"); + }, encode(message: QueryValidatorCommissionRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.validatorAddress !== "") { writer.uint32(10).string(message.validatorAddress); @@ -1140,7 +1200,8 @@ export const QueryValidatorCommissionRequest = { typeUrl: "/cosmos.distribution.v1beta1.QueryValidatorCommissionRequest", value: QueryValidatorCommissionRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryValidatorCommissionResponse(): QueryValidatorCommissionResponse { return { @@ -1157,6 +1218,15 @@ function createBaseQueryValidatorCommissionResponse(): QueryValidatorCommissionR export const QueryValidatorCommissionResponse = { typeUrl: "/cosmos.distribution.v1beta1.QueryValidatorCommissionResponse", aminoType: "cosmos-sdk/QueryValidatorCommissionResponse", + is(o: any): o is QueryValidatorCommissionResponse { + return o && (o.$typeUrl === QueryValidatorCommissionResponse.typeUrl || ValidatorAccumulatedCommission.is(o.commission)); + }, + isSDK(o: any): o is QueryValidatorCommissionResponseSDKType { + return o && (o.$typeUrl === QueryValidatorCommissionResponse.typeUrl || ValidatorAccumulatedCommission.isSDK(o.commission)); + }, + isAmino(o: any): o is QueryValidatorCommissionResponseAmino { + return o && (o.$typeUrl === QueryValidatorCommissionResponse.typeUrl || ValidatorAccumulatedCommission.isAmino(o.commission)); + }, encode(message: QueryValidatorCommissionResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.commission !== undefined) { ValidatorAccumulatedCommission.encode(message.commission, writer.uint32(10).fork()).ldelim(); @@ -1225,6 +1295,12 @@ export const QueryValidatorCommissionResponse = { typeUrl: "/cosmos.distribution.v1beta1.QueryValidatorCommissionResponse", value: QueryValidatorCommissionResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryValidatorCommissionResponse.typeUrl)) { + return; + } + ValidatorAccumulatedCommission.registerTypeUrl(); } }; function createBaseQueryValidatorSlashesRequest(): QueryValidatorSlashesRequest { @@ -1245,6 +1321,15 @@ function createBaseQueryValidatorSlashesRequest(): QueryValidatorSlashesRequest export const QueryValidatorSlashesRequest = { typeUrl: "/cosmos.distribution.v1beta1.QueryValidatorSlashesRequest", aminoType: "cosmos-sdk/QueryValidatorSlashesRequest", + is(o: any): o is QueryValidatorSlashesRequest { + return o && (o.$typeUrl === QueryValidatorSlashesRequest.typeUrl || typeof o.validatorAddress === "string" && typeof o.startingHeight === "bigint" && typeof o.endingHeight === "bigint"); + }, + isSDK(o: any): o is QueryValidatorSlashesRequestSDKType { + return o && (o.$typeUrl === QueryValidatorSlashesRequest.typeUrl || typeof o.validator_address === "string" && typeof o.starting_height === "bigint" && typeof o.ending_height === "bigint"); + }, + isAmino(o: any): o is QueryValidatorSlashesRequestAmino { + return o && (o.$typeUrl === QueryValidatorSlashesRequest.typeUrl || typeof o.validator_address === "string" && typeof o.starting_height === "bigint" && typeof o.ending_height === "bigint"); + }, encode(message: QueryValidatorSlashesRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.validatorAddress !== "") { writer.uint32(10).string(message.validatorAddress); @@ -1359,6 +1444,12 @@ export const QueryValidatorSlashesRequest = { typeUrl: "/cosmos.distribution.v1beta1.QueryValidatorSlashesRequest", value: QueryValidatorSlashesRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryValidatorSlashesRequest.typeUrl)) { + return; + } + PageRequest.registerTypeUrl(); } }; function createBaseQueryValidatorSlashesResponse(): QueryValidatorSlashesResponse { @@ -1377,6 +1468,15 @@ function createBaseQueryValidatorSlashesResponse(): QueryValidatorSlashesRespons export const QueryValidatorSlashesResponse = { typeUrl: "/cosmos.distribution.v1beta1.QueryValidatorSlashesResponse", aminoType: "cosmos-sdk/QueryValidatorSlashesResponse", + is(o: any): o is QueryValidatorSlashesResponse { + return o && (o.$typeUrl === QueryValidatorSlashesResponse.typeUrl || Array.isArray(o.slashes) && (!o.slashes.length || ValidatorSlashEvent.is(o.slashes[0]))); + }, + isSDK(o: any): o is QueryValidatorSlashesResponseSDKType { + return o && (o.$typeUrl === QueryValidatorSlashesResponse.typeUrl || Array.isArray(o.slashes) && (!o.slashes.length || ValidatorSlashEvent.isSDK(o.slashes[0]))); + }, + isAmino(o: any): o is QueryValidatorSlashesResponseAmino { + return o && (o.$typeUrl === QueryValidatorSlashesResponse.typeUrl || Array.isArray(o.slashes) && (!o.slashes.length || ValidatorSlashEvent.isAmino(o.slashes[0]))); + }, encode(message: QueryValidatorSlashesResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.slashes) { ValidatorSlashEvent.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -1465,6 +1565,13 @@ export const QueryValidatorSlashesResponse = { typeUrl: "/cosmos.distribution.v1beta1.QueryValidatorSlashesResponse", value: QueryValidatorSlashesResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryValidatorSlashesResponse.typeUrl)) { + return; + } + ValidatorSlashEvent.registerTypeUrl(); + PageResponse.registerTypeUrl(); } }; function createBaseQueryDelegationRewardsRequest(): QueryDelegationRewardsRequest { @@ -1483,6 +1590,15 @@ function createBaseQueryDelegationRewardsRequest(): QueryDelegationRewardsReques export const QueryDelegationRewardsRequest = { typeUrl: "/cosmos.distribution.v1beta1.QueryDelegationRewardsRequest", aminoType: "cosmos-sdk/QueryDelegationRewardsRequest", + is(o: any): o is QueryDelegationRewardsRequest { + return o && (o.$typeUrl === QueryDelegationRewardsRequest.typeUrl || typeof o.delegatorAddress === "string" && typeof o.validatorAddress === "string"); + }, + isSDK(o: any): o is QueryDelegationRewardsRequestSDKType { + return o && (o.$typeUrl === QueryDelegationRewardsRequest.typeUrl || typeof o.delegator_address === "string" && typeof o.validator_address === "string"); + }, + isAmino(o: any): o is QueryDelegationRewardsRequestAmino { + return o && (o.$typeUrl === QueryDelegationRewardsRequest.typeUrl || typeof o.delegator_address === "string" && typeof o.validator_address === "string"); + }, encode(message: QueryDelegationRewardsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.delegatorAddress !== "") { writer.uint32(10).string(message.delegatorAddress); @@ -1563,7 +1679,8 @@ export const QueryDelegationRewardsRequest = { typeUrl: "/cosmos.distribution.v1beta1.QueryDelegationRewardsRequest", value: QueryDelegationRewardsRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryDelegationRewardsResponse(): QueryDelegationRewardsResponse { return { @@ -1580,6 +1697,15 @@ function createBaseQueryDelegationRewardsResponse(): QueryDelegationRewardsRespo export const QueryDelegationRewardsResponse = { typeUrl: "/cosmos.distribution.v1beta1.QueryDelegationRewardsResponse", aminoType: "cosmos-sdk/QueryDelegationRewardsResponse", + is(o: any): o is QueryDelegationRewardsResponse { + return o && (o.$typeUrl === QueryDelegationRewardsResponse.typeUrl || Array.isArray(o.rewards) && (!o.rewards.length || DecCoin.is(o.rewards[0]))); + }, + isSDK(o: any): o is QueryDelegationRewardsResponseSDKType { + return o && (o.$typeUrl === QueryDelegationRewardsResponse.typeUrl || Array.isArray(o.rewards) && (!o.rewards.length || DecCoin.isSDK(o.rewards[0]))); + }, + isAmino(o: any): o is QueryDelegationRewardsResponseAmino { + return o && (o.$typeUrl === QueryDelegationRewardsResponse.typeUrl || Array.isArray(o.rewards) && (!o.rewards.length || DecCoin.isAmino(o.rewards[0]))); + }, encode(message: QueryDelegationRewardsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.rewards) { DecCoin.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -1652,6 +1778,12 @@ export const QueryDelegationRewardsResponse = { typeUrl: "/cosmos.distribution.v1beta1.QueryDelegationRewardsResponse", value: QueryDelegationRewardsResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryDelegationRewardsResponse.typeUrl)) { + return; + } + DecCoin.registerTypeUrl(); } }; function createBaseQueryDelegationTotalRewardsRequest(): QueryDelegationTotalRewardsRequest { @@ -1669,6 +1801,15 @@ function createBaseQueryDelegationTotalRewardsRequest(): QueryDelegationTotalRew export const QueryDelegationTotalRewardsRequest = { typeUrl: "/cosmos.distribution.v1beta1.QueryDelegationTotalRewardsRequest", aminoType: "cosmos-sdk/QueryDelegationTotalRewardsRequest", + is(o: any): o is QueryDelegationTotalRewardsRequest { + return o && (o.$typeUrl === QueryDelegationTotalRewardsRequest.typeUrl || typeof o.delegatorAddress === "string"); + }, + isSDK(o: any): o is QueryDelegationTotalRewardsRequestSDKType { + return o && (o.$typeUrl === QueryDelegationTotalRewardsRequest.typeUrl || typeof o.delegator_address === "string"); + }, + isAmino(o: any): o is QueryDelegationTotalRewardsRequestAmino { + return o && (o.$typeUrl === QueryDelegationTotalRewardsRequest.typeUrl || typeof o.delegator_address === "string"); + }, encode(message: QueryDelegationTotalRewardsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.delegatorAddress !== "") { writer.uint32(10).string(message.delegatorAddress); @@ -1735,7 +1876,8 @@ export const QueryDelegationTotalRewardsRequest = { typeUrl: "/cosmos.distribution.v1beta1.QueryDelegationTotalRewardsRequest", value: QueryDelegationTotalRewardsRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryDelegationTotalRewardsResponse(): QueryDelegationTotalRewardsResponse { return { @@ -1753,6 +1895,15 @@ function createBaseQueryDelegationTotalRewardsResponse(): QueryDelegationTotalRe export const QueryDelegationTotalRewardsResponse = { typeUrl: "/cosmos.distribution.v1beta1.QueryDelegationTotalRewardsResponse", aminoType: "cosmos-sdk/QueryDelegationTotalRewardsResponse", + is(o: any): o is QueryDelegationTotalRewardsResponse { + return o && (o.$typeUrl === QueryDelegationTotalRewardsResponse.typeUrl || Array.isArray(o.rewards) && (!o.rewards.length || DelegationDelegatorReward.is(o.rewards[0])) && Array.isArray(o.total) && (!o.total.length || DecCoin.is(o.total[0]))); + }, + isSDK(o: any): o is QueryDelegationTotalRewardsResponseSDKType { + return o && (o.$typeUrl === QueryDelegationTotalRewardsResponse.typeUrl || Array.isArray(o.rewards) && (!o.rewards.length || DelegationDelegatorReward.isSDK(o.rewards[0])) && Array.isArray(o.total) && (!o.total.length || DecCoin.isSDK(o.total[0]))); + }, + isAmino(o: any): o is QueryDelegationTotalRewardsResponseAmino { + return o && (o.$typeUrl === QueryDelegationTotalRewardsResponse.typeUrl || Array.isArray(o.rewards) && (!o.rewards.length || DelegationDelegatorReward.isAmino(o.rewards[0])) && Array.isArray(o.total) && (!o.total.length || DecCoin.isAmino(o.total[0]))); + }, encode(message: QueryDelegationTotalRewardsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.rewards) { DelegationDelegatorReward.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -1845,6 +1996,13 @@ export const QueryDelegationTotalRewardsResponse = { typeUrl: "/cosmos.distribution.v1beta1.QueryDelegationTotalRewardsResponse", value: QueryDelegationTotalRewardsResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryDelegationTotalRewardsResponse.typeUrl)) { + return; + } + DelegationDelegatorReward.registerTypeUrl(); + DecCoin.registerTypeUrl(); } }; function createBaseQueryDelegatorValidatorsRequest(): QueryDelegatorValidatorsRequest { @@ -1862,6 +2020,15 @@ function createBaseQueryDelegatorValidatorsRequest(): QueryDelegatorValidatorsRe export const QueryDelegatorValidatorsRequest = { typeUrl: "/cosmos.distribution.v1beta1.QueryDelegatorValidatorsRequest", aminoType: "cosmos-sdk/QueryDelegatorValidatorsRequest", + is(o: any): o is QueryDelegatorValidatorsRequest { + return o && (o.$typeUrl === QueryDelegatorValidatorsRequest.typeUrl || typeof o.delegatorAddress === "string"); + }, + isSDK(o: any): o is QueryDelegatorValidatorsRequestSDKType { + return o && (o.$typeUrl === QueryDelegatorValidatorsRequest.typeUrl || typeof o.delegator_address === "string"); + }, + isAmino(o: any): o is QueryDelegatorValidatorsRequestAmino { + return o && (o.$typeUrl === QueryDelegatorValidatorsRequest.typeUrl || typeof o.delegator_address === "string"); + }, encode(message: QueryDelegatorValidatorsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.delegatorAddress !== "") { writer.uint32(10).string(message.delegatorAddress); @@ -1928,7 +2095,8 @@ export const QueryDelegatorValidatorsRequest = { typeUrl: "/cosmos.distribution.v1beta1.QueryDelegatorValidatorsRequest", value: QueryDelegatorValidatorsRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryDelegatorValidatorsResponse(): QueryDelegatorValidatorsResponse { return { @@ -1945,6 +2113,15 @@ function createBaseQueryDelegatorValidatorsResponse(): QueryDelegatorValidatorsR export const QueryDelegatorValidatorsResponse = { typeUrl: "/cosmos.distribution.v1beta1.QueryDelegatorValidatorsResponse", aminoType: "cosmos-sdk/QueryDelegatorValidatorsResponse", + is(o: any): o is QueryDelegatorValidatorsResponse { + return o && (o.$typeUrl === QueryDelegatorValidatorsResponse.typeUrl || Array.isArray(o.validators) && (!o.validators.length || typeof o.validators[0] === "string")); + }, + isSDK(o: any): o is QueryDelegatorValidatorsResponseSDKType { + return o && (o.$typeUrl === QueryDelegatorValidatorsResponse.typeUrl || Array.isArray(o.validators) && (!o.validators.length || typeof o.validators[0] === "string")); + }, + isAmino(o: any): o is QueryDelegatorValidatorsResponseAmino { + return o && (o.$typeUrl === QueryDelegatorValidatorsResponse.typeUrl || Array.isArray(o.validators) && (!o.validators.length || typeof o.validators[0] === "string")); + }, encode(message: QueryDelegatorValidatorsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.validators) { writer.uint32(10).string(v!); @@ -2017,7 +2194,8 @@ export const QueryDelegatorValidatorsResponse = { typeUrl: "/cosmos.distribution.v1beta1.QueryDelegatorValidatorsResponse", value: QueryDelegatorValidatorsResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryDelegatorWithdrawAddressRequest(): QueryDelegatorWithdrawAddressRequest { return { @@ -2034,6 +2212,15 @@ function createBaseQueryDelegatorWithdrawAddressRequest(): QueryDelegatorWithdra export const QueryDelegatorWithdrawAddressRequest = { typeUrl: "/cosmos.distribution.v1beta1.QueryDelegatorWithdrawAddressRequest", aminoType: "cosmos-sdk/QueryDelegatorWithdrawAddressRequest", + is(o: any): o is QueryDelegatorWithdrawAddressRequest { + return o && (o.$typeUrl === QueryDelegatorWithdrawAddressRequest.typeUrl || typeof o.delegatorAddress === "string"); + }, + isSDK(o: any): o is QueryDelegatorWithdrawAddressRequestSDKType { + return o && (o.$typeUrl === QueryDelegatorWithdrawAddressRequest.typeUrl || typeof o.delegator_address === "string"); + }, + isAmino(o: any): o is QueryDelegatorWithdrawAddressRequestAmino { + return o && (o.$typeUrl === QueryDelegatorWithdrawAddressRequest.typeUrl || typeof o.delegator_address === "string"); + }, encode(message: QueryDelegatorWithdrawAddressRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.delegatorAddress !== "") { writer.uint32(10).string(message.delegatorAddress); @@ -2100,7 +2287,8 @@ export const QueryDelegatorWithdrawAddressRequest = { typeUrl: "/cosmos.distribution.v1beta1.QueryDelegatorWithdrawAddressRequest", value: QueryDelegatorWithdrawAddressRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryDelegatorWithdrawAddressResponse(): QueryDelegatorWithdrawAddressResponse { return { @@ -2117,6 +2305,15 @@ function createBaseQueryDelegatorWithdrawAddressResponse(): QueryDelegatorWithdr export const QueryDelegatorWithdrawAddressResponse = { typeUrl: "/cosmos.distribution.v1beta1.QueryDelegatorWithdrawAddressResponse", aminoType: "cosmos-sdk/QueryDelegatorWithdrawAddressResponse", + is(o: any): o is QueryDelegatorWithdrawAddressResponse { + return o && (o.$typeUrl === QueryDelegatorWithdrawAddressResponse.typeUrl || typeof o.withdrawAddress === "string"); + }, + isSDK(o: any): o is QueryDelegatorWithdrawAddressResponseSDKType { + return o && (o.$typeUrl === QueryDelegatorWithdrawAddressResponse.typeUrl || typeof o.withdraw_address === "string"); + }, + isAmino(o: any): o is QueryDelegatorWithdrawAddressResponseAmino { + return o && (o.$typeUrl === QueryDelegatorWithdrawAddressResponse.typeUrl || typeof o.withdraw_address === "string"); + }, encode(message: QueryDelegatorWithdrawAddressResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.withdrawAddress !== "") { writer.uint32(10).string(message.withdrawAddress); @@ -2183,7 +2380,8 @@ export const QueryDelegatorWithdrawAddressResponse = { typeUrl: "/cosmos.distribution.v1beta1.QueryDelegatorWithdrawAddressResponse", value: QueryDelegatorWithdrawAddressResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryCommunityPoolRequest(): QueryCommunityPoolRequest { return {}; @@ -2198,6 +2396,15 @@ function createBaseQueryCommunityPoolRequest(): QueryCommunityPoolRequest { export const QueryCommunityPoolRequest = { typeUrl: "/cosmos.distribution.v1beta1.QueryCommunityPoolRequest", aminoType: "cosmos-sdk/QueryCommunityPoolRequest", + is(o: any): o is QueryCommunityPoolRequest { + return o && o.$typeUrl === QueryCommunityPoolRequest.typeUrl; + }, + isSDK(o: any): o is QueryCommunityPoolRequestSDKType { + return o && o.$typeUrl === QueryCommunityPoolRequest.typeUrl; + }, + isAmino(o: any): o is QueryCommunityPoolRequestAmino { + return o && o.$typeUrl === QueryCommunityPoolRequest.typeUrl; + }, encode(_: QueryCommunityPoolRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -2249,7 +2456,8 @@ export const QueryCommunityPoolRequest = { typeUrl: "/cosmos.distribution.v1beta1.QueryCommunityPoolRequest", value: QueryCommunityPoolRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryCommunityPoolResponse(): QueryCommunityPoolResponse { return { @@ -2266,6 +2474,15 @@ function createBaseQueryCommunityPoolResponse(): QueryCommunityPoolResponse { export const QueryCommunityPoolResponse = { typeUrl: "/cosmos.distribution.v1beta1.QueryCommunityPoolResponse", aminoType: "cosmos-sdk/QueryCommunityPoolResponse", + is(o: any): o is QueryCommunityPoolResponse { + return o && (o.$typeUrl === QueryCommunityPoolResponse.typeUrl || Array.isArray(o.pool) && (!o.pool.length || DecCoin.is(o.pool[0]))); + }, + isSDK(o: any): o is QueryCommunityPoolResponseSDKType { + return o && (o.$typeUrl === QueryCommunityPoolResponse.typeUrl || Array.isArray(o.pool) && (!o.pool.length || DecCoin.isSDK(o.pool[0]))); + }, + isAmino(o: any): o is QueryCommunityPoolResponseAmino { + return o && (o.$typeUrl === QueryCommunityPoolResponse.typeUrl || Array.isArray(o.pool) && (!o.pool.length || DecCoin.isAmino(o.pool[0]))); + }, encode(message: QueryCommunityPoolResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.pool) { DecCoin.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -2338,5 +2555,11 @@ export const QueryCommunityPoolResponse = { typeUrl: "/cosmos.distribution.v1beta1.QueryCommunityPoolResponse", value: QueryCommunityPoolResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryCommunityPoolResponse.typeUrl)) { + return; + } + DecCoin.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/cosmos/distribution/v1beta1/tx.registry.ts b/__fixtures__/v-next/outputv3/cosmos/distribution/v1beta1/tx.registry.ts index 0d22afc2ff..97eb0932a5 100644 --- a/__fixtures__/v-next/outputv3/cosmos/distribution/v1beta1/tx.registry.ts +++ b/__fixtures__/v-next/outputv3/cosmos/distribution/v1beta1/tx.registry.ts @@ -1,12 +1,7 @@ import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; -import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { TelescopeGeneratedType } from "../../../types"; import { MsgSetWithdrawAddress, MsgSetWithdrawAddressSDKType, MsgWithdrawDelegatorReward, MsgWithdrawDelegatorRewardSDKType, MsgWithdrawValidatorCommission, MsgWithdrawValidatorCommissionSDKType, MsgFundCommunityPool, MsgFundCommunityPoolSDKType } from "./tx"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/cosmos.distribution.v1beta1.MsgSetWithdrawAddress", MsgSetWithdrawAddress], ["/cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward", MsgWithdrawDelegatorReward], ["/cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission", MsgWithdrawValidatorCommission], ["/cosmos.distribution.v1beta1.MsgFundCommunityPool", MsgFundCommunityPool]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/cosmos.distribution.v1beta1.MsgSetWithdrawAddress", MsgSetWithdrawAddress], ["/cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward", MsgWithdrawDelegatorReward], ["/cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission", MsgWithdrawValidatorCommission], ["/cosmos.distribution.v1beta1.MsgFundCommunityPool", MsgFundCommunityPool]]; export const MessageComposer = { encoded: { setWithdrawAddress(value: MsgSetWithdrawAddress) { diff --git a/__fixtures__/v-next/outputv3/cosmos/distribution/v1beta1/tx.rpc.func.ts b/__fixtures__/v-next/outputv3/cosmos/distribution/v1beta1/tx.rpc.func.ts new file mode 100644 index 0000000000..27ee8a8714 --- /dev/null +++ b/__fixtures__/v-next/outputv3/cosmos/distribution/v1beta1/tx.rpc.func.ts @@ -0,0 +1,43 @@ +import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; +import { buildTx } from "../../../helper-func-types"; +import { MsgSetWithdrawAddress, MsgSetWithdrawAddressSDKType, MsgSetWithdrawAddressResponse, MsgSetWithdrawAddressResponseSDKType, MsgWithdrawDelegatorReward, MsgWithdrawDelegatorRewardSDKType, MsgWithdrawDelegatorRewardResponse, MsgWithdrawDelegatorRewardResponseSDKType, MsgWithdrawValidatorCommission, MsgWithdrawValidatorCommissionSDKType, MsgWithdrawValidatorCommissionResponse, MsgWithdrawValidatorCommissionResponseSDKType, MsgFundCommunityPool, MsgFundCommunityPoolSDKType, MsgFundCommunityPoolResponse, MsgFundCommunityPoolResponseSDKType } from "./tx"; +/** + * SetWithdrawAddress defines a method to change the withdraw address + * for a delegator (or validator self-delegation). + * @name setWithdrawAddress + * @package cosmos.distribution.v1beta1 + * @see proto service: cosmos.distribution.v1beta1.SetWithdrawAddress + */ +export const setWithdrawAddress = buildTx({ + msg: MsgSetWithdrawAddress +}); +/** + * WithdrawDelegatorReward defines a method to withdraw rewards of delegator + * from a single validator. + * @name withdrawDelegatorReward + * @package cosmos.distribution.v1beta1 + * @see proto service: cosmos.distribution.v1beta1.WithdrawDelegatorReward + */ +export const withdrawDelegatorReward = buildTx({ + msg: MsgWithdrawDelegatorReward +}); +/** + * WithdrawValidatorCommission defines a method to withdraw the + * full commission to the validator address. + * @name withdrawValidatorCommission + * @package cosmos.distribution.v1beta1 + * @see proto service: cosmos.distribution.v1beta1.WithdrawValidatorCommission + */ +export const withdrawValidatorCommission = buildTx({ + msg: MsgWithdrawValidatorCommission +}); +/** + * FundCommunityPool defines a method to allow an account to directly + * fund the community pool. + * @name fundCommunityPool + * @package cosmos.distribution.v1beta1 + * @see proto service: cosmos.distribution.v1beta1.FundCommunityPool + */ +export const fundCommunityPool = buildTx({ + msg: MsgFundCommunityPool +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/cosmos/distribution/v1beta1/tx.ts b/__fixtures__/v-next/outputv3/cosmos/distribution/v1beta1/tx.ts index 811bb74804..4a30054a9e 100644 --- a/__fixtures__/v-next/outputv3/cosmos/distribution/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputv3/cosmos/distribution/v1beta1/tx.ts @@ -1,6 +1,7 @@ import { Coin, CoinAmino, CoinSDKType } from "../../base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { isSet, DeepPartial } from "../../../helpers"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "cosmos.distribution.v1beta1"; /** * MsgSetWithdrawAddress sets the withdraw address for @@ -275,6 +276,15 @@ function createBaseMsgSetWithdrawAddress(): MsgSetWithdrawAddress { export const MsgSetWithdrawAddress = { typeUrl: "/cosmos.distribution.v1beta1.MsgSetWithdrawAddress", aminoType: "cosmos-sdk/MsgModifyWithdrawAddress", + is(o: any): o is MsgSetWithdrawAddress { + return o && (o.$typeUrl === MsgSetWithdrawAddress.typeUrl || typeof o.delegatorAddress === "string" && typeof o.withdrawAddress === "string"); + }, + isSDK(o: any): o is MsgSetWithdrawAddressSDKType { + return o && (o.$typeUrl === MsgSetWithdrawAddress.typeUrl || typeof o.delegator_address === "string" && typeof o.withdraw_address === "string"); + }, + isAmino(o: any): o is MsgSetWithdrawAddressAmino { + return o && (o.$typeUrl === MsgSetWithdrawAddress.typeUrl || typeof o.delegator_address === "string" && typeof o.withdraw_address === "string"); + }, encode(message: MsgSetWithdrawAddress, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.delegatorAddress !== "") { writer.uint32(10).string(message.delegatorAddress); @@ -355,7 +365,8 @@ export const MsgSetWithdrawAddress = { typeUrl: "/cosmos.distribution.v1beta1.MsgSetWithdrawAddress", value: MsgSetWithdrawAddress.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgSetWithdrawAddressResponse(): MsgSetWithdrawAddressResponse { return {}; @@ -369,6 +380,15 @@ function createBaseMsgSetWithdrawAddressResponse(): MsgSetWithdrawAddressRespons export const MsgSetWithdrawAddressResponse = { typeUrl: "/cosmos.distribution.v1beta1.MsgSetWithdrawAddressResponse", aminoType: "cosmos-sdk/MsgSetWithdrawAddressResponse", + is(o: any): o is MsgSetWithdrawAddressResponse { + return o && o.$typeUrl === MsgSetWithdrawAddressResponse.typeUrl; + }, + isSDK(o: any): o is MsgSetWithdrawAddressResponseSDKType { + return o && o.$typeUrl === MsgSetWithdrawAddressResponse.typeUrl; + }, + isAmino(o: any): o is MsgSetWithdrawAddressResponseAmino { + return o && o.$typeUrl === MsgSetWithdrawAddressResponse.typeUrl; + }, encode(_: MsgSetWithdrawAddressResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -420,7 +440,8 @@ export const MsgSetWithdrawAddressResponse = { typeUrl: "/cosmos.distribution.v1beta1.MsgSetWithdrawAddressResponse", value: MsgSetWithdrawAddressResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgWithdrawDelegatorReward(): MsgWithdrawDelegatorReward { return { @@ -438,6 +459,15 @@ function createBaseMsgWithdrawDelegatorReward(): MsgWithdrawDelegatorReward { export const MsgWithdrawDelegatorReward = { typeUrl: "/cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward", aminoType: "cosmos-sdk/MsgWithdrawDelegationReward", + is(o: any): o is MsgWithdrawDelegatorReward { + return o && (o.$typeUrl === MsgWithdrawDelegatorReward.typeUrl || typeof o.delegatorAddress === "string" && typeof o.validatorAddress === "string"); + }, + isSDK(o: any): o is MsgWithdrawDelegatorRewardSDKType { + return o && (o.$typeUrl === MsgWithdrawDelegatorReward.typeUrl || typeof o.delegator_address === "string" && typeof o.validator_address === "string"); + }, + isAmino(o: any): o is MsgWithdrawDelegatorRewardAmino { + return o && (o.$typeUrl === MsgWithdrawDelegatorReward.typeUrl || typeof o.delegator_address === "string" && typeof o.validator_address === "string"); + }, encode(message: MsgWithdrawDelegatorReward, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.delegatorAddress !== "") { writer.uint32(10).string(message.delegatorAddress); @@ -518,7 +548,8 @@ export const MsgWithdrawDelegatorReward = { typeUrl: "/cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward", value: MsgWithdrawDelegatorReward.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgWithdrawDelegatorRewardResponse(): MsgWithdrawDelegatorRewardResponse { return { @@ -534,6 +565,15 @@ function createBaseMsgWithdrawDelegatorRewardResponse(): MsgWithdrawDelegatorRew export const MsgWithdrawDelegatorRewardResponse = { typeUrl: "/cosmos.distribution.v1beta1.MsgWithdrawDelegatorRewardResponse", aminoType: "cosmos-sdk/MsgWithdrawDelegatorRewardResponse", + is(o: any): o is MsgWithdrawDelegatorRewardResponse { + return o && (o.$typeUrl === MsgWithdrawDelegatorRewardResponse.typeUrl || Array.isArray(o.amount) && (!o.amount.length || Coin.is(o.amount[0]))); + }, + isSDK(o: any): o is MsgWithdrawDelegatorRewardResponseSDKType { + return o && (o.$typeUrl === MsgWithdrawDelegatorRewardResponse.typeUrl || Array.isArray(o.amount) && (!o.amount.length || Coin.isSDK(o.amount[0]))); + }, + isAmino(o: any): o is MsgWithdrawDelegatorRewardResponseAmino { + return o && (o.$typeUrl === MsgWithdrawDelegatorRewardResponse.typeUrl || Array.isArray(o.amount) && (!o.amount.length || Coin.isAmino(o.amount[0]))); + }, encode(message: MsgWithdrawDelegatorRewardResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.amount) { Coin.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -606,6 +646,12 @@ export const MsgWithdrawDelegatorRewardResponse = { typeUrl: "/cosmos.distribution.v1beta1.MsgWithdrawDelegatorRewardResponse", value: MsgWithdrawDelegatorRewardResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgWithdrawDelegatorRewardResponse.typeUrl)) { + return; + } + Coin.registerTypeUrl(); } }; function createBaseMsgWithdrawValidatorCommission(): MsgWithdrawValidatorCommission { @@ -623,6 +669,15 @@ function createBaseMsgWithdrawValidatorCommission(): MsgWithdrawValidatorCommiss export const MsgWithdrawValidatorCommission = { typeUrl: "/cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission", aminoType: "cosmos-sdk/MsgWithdrawValidatorCommission", + is(o: any): o is MsgWithdrawValidatorCommission { + return o && (o.$typeUrl === MsgWithdrawValidatorCommission.typeUrl || typeof o.validatorAddress === "string"); + }, + isSDK(o: any): o is MsgWithdrawValidatorCommissionSDKType { + return o && (o.$typeUrl === MsgWithdrawValidatorCommission.typeUrl || typeof o.validator_address === "string"); + }, + isAmino(o: any): o is MsgWithdrawValidatorCommissionAmino { + return o && (o.$typeUrl === MsgWithdrawValidatorCommission.typeUrl || typeof o.validator_address === "string"); + }, encode(message: MsgWithdrawValidatorCommission, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.validatorAddress !== "") { writer.uint32(10).string(message.validatorAddress); @@ -689,7 +744,8 @@ export const MsgWithdrawValidatorCommission = { typeUrl: "/cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission", value: MsgWithdrawValidatorCommission.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgWithdrawValidatorCommissionResponse(): MsgWithdrawValidatorCommissionResponse { return { @@ -705,6 +761,15 @@ function createBaseMsgWithdrawValidatorCommissionResponse(): MsgWithdrawValidato export const MsgWithdrawValidatorCommissionResponse = { typeUrl: "/cosmos.distribution.v1beta1.MsgWithdrawValidatorCommissionResponse", aminoType: "cosmos-sdk/MsgWithdrawValidatorCommissionResponse", + is(o: any): o is MsgWithdrawValidatorCommissionResponse { + return o && (o.$typeUrl === MsgWithdrawValidatorCommissionResponse.typeUrl || Array.isArray(o.amount) && (!o.amount.length || Coin.is(o.amount[0]))); + }, + isSDK(o: any): o is MsgWithdrawValidatorCommissionResponseSDKType { + return o && (o.$typeUrl === MsgWithdrawValidatorCommissionResponse.typeUrl || Array.isArray(o.amount) && (!o.amount.length || Coin.isSDK(o.amount[0]))); + }, + isAmino(o: any): o is MsgWithdrawValidatorCommissionResponseAmino { + return o && (o.$typeUrl === MsgWithdrawValidatorCommissionResponse.typeUrl || Array.isArray(o.amount) && (!o.amount.length || Coin.isAmino(o.amount[0]))); + }, encode(message: MsgWithdrawValidatorCommissionResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.amount) { Coin.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -777,6 +842,12 @@ export const MsgWithdrawValidatorCommissionResponse = { typeUrl: "/cosmos.distribution.v1beta1.MsgWithdrawValidatorCommissionResponse", value: MsgWithdrawValidatorCommissionResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgWithdrawValidatorCommissionResponse.typeUrl)) { + return; + } + Coin.registerTypeUrl(); } }; function createBaseMsgFundCommunityPool(): MsgFundCommunityPool { @@ -795,6 +866,15 @@ function createBaseMsgFundCommunityPool(): MsgFundCommunityPool { export const MsgFundCommunityPool = { typeUrl: "/cosmos.distribution.v1beta1.MsgFundCommunityPool", aminoType: "cosmos-sdk/MsgFundCommunityPool", + is(o: any): o is MsgFundCommunityPool { + return o && (o.$typeUrl === MsgFundCommunityPool.typeUrl || Array.isArray(o.amount) && (!o.amount.length || Coin.is(o.amount[0])) && typeof o.depositor === "string"); + }, + isSDK(o: any): o is MsgFundCommunityPoolSDKType { + return o && (o.$typeUrl === MsgFundCommunityPool.typeUrl || Array.isArray(o.amount) && (!o.amount.length || Coin.isSDK(o.amount[0])) && typeof o.depositor === "string"); + }, + isAmino(o: any): o is MsgFundCommunityPoolAmino { + return o && (o.$typeUrl === MsgFundCommunityPool.typeUrl || Array.isArray(o.amount) && (!o.amount.length || Coin.isAmino(o.amount[0])) && typeof o.depositor === "string"); + }, encode(message: MsgFundCommunityPool, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.amount) { Coin.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -881,6 +961,12 @@ export const MsgFundCommunityPool = { typeUrl: "/cosmos.distribution.v1beta1.MsgFundCommunityPool", value: MsgFundCommunityPool.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgFundCommunityPool.typeUrl)) { + return; + } + Coin.registerTypeUrl(); } }; function createBaseMsgFundCommunityPoolResponse(): MsgFundCommunityPoolResponse { @@ -895,6 +981,15 @@ function createBaseMsgFundCommunityPoolResponse(): MsgFundCommunityPoolResponse export const MsgFundCommunityPoolResponse = { typeUrl: "/cosmos.distribution.v1beta1.MsgFundCommunityPoolResponse", aminoType: "cosmos-sdk/MsgFundCommunityPoolResponse", + is(o: any): o is MsgFundCommunityPoolResponse { + return o && o.$typeUrl === MsgFundCommunityPoolResponse.typeUrl; + }, + isSDK(o: any): o is MsgFundCommunityPoolResponseSDKType { + return o && o.$typeUrl === MsgFundCommunityPoolResponse.typeUrl; + }, + isAmino(o: any): o is MsgFundCommunityPoolResponseAmino { + return o && o.$typeUrl === MsgFundCommunityPoolResponse.typeUrl; + }, encode(_: MsgFundCommunityPoolResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -946,5 +1041,6 @@ export const MsgFundCommunityPoolResponse = { typeUrl: "/cosmos.distribution.v1beta1.MsgFundCommunityPoolResponse", value: MsgFundCommunityPoolResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/cosmos/evidence/v1beta1/evidence.ts b/__fixtures__/v-next/outputv3/cosmos/evidence/v1beta1/evidence.ts index 6a9c322b13..d2656b7f08 100644 --- a/__fixtures__/v-next/outputv3/cosmos/evidence/v1beta1/evidence.ts +++ b/__fixtures__/v-next/outputv3/cosmos/evidence/v1beta1/evidence.ts @@ -63,6 +63,15 @@ function createBaseEquivocation(): Equivocation { export const Equivocation = { typeUrl: "/cosmos.evidence.v1beta1.Equivocation", aminoType: "cosmos-sdk/Equivocation", + is(o: any): o is Equivocation { + return o && (o.$typeUrl === Equivocation.typeUrl || typeof o.height === "bigint" && Timestamp.is(o.time) && typeof o.power === "bigint" && typeof o.consensusAddress === "string"); + }, + isSDK(o: any): o is EquivocationSDKType { + return o && (o.$typeUrl === Equivocation.typeUrl || typeof o.height === "bigint" && Timestamp.isSDK(o.time) && typeof o.power === "bigint" && typeof o.consensus_address === "string"); + }, + isAmino(o: any): o is EquivocationAmino { + return o && (o.$typeUrl === Equivocation.typeUrl || typeof o.height === "bigint" && Timestamp.isAmino(o.time) && typeof o.power === "bigint" && typeof o.consensus_address === "string"); + }, encode(message: Equivocation, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.height !== BigInt(0)) { writer.uint32(8).int64(message.height); @@ -175,5 +184,6 @@ export const Equivocation = { typeUrl: "/cosmos.evidence.v1beta1.Equivocation", value: Equivocation.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/cosmos/evidence/v1beta1/genesis.ts b/__fixtures__/v-next/outputv3/cosmos/evidence/v1beta1/genesis.ts index bf537b7394..5a5b1a1634 100644 --- a/__fixtures__/v-next/outputv3/cosmos/evidence/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv3/cosmos/evidence/v1beta1/genesis.ts @@ -53,6 +53,15 @@ function createBaseGenesisState(): GenesisState { export const GenesisState = { typeUrl: "/cosmos.evidence.v1beta1.GenesisState", aminoType: "cosmos-sdk/GenesisState", + is(o: any): o is GenesisState { + return o && (o.$typeUrl === GenesisState.typeUrl || Array.isArray(o.evidence) && (!o.evidence.length || Any.is(o.evidence[0]))); + }, + isSDK(o: any): o is GenesisStateSDKType { + return o && (o.$typeUrl === GenesisState.typeUrl || Array.isArray(o.evidence) && (!o.evidence.length || Any.isSDK(o.evidence[0]))); + }, + isAmino(o: any): o is GenesisStateAmino { + return o && (o.$typeUrl === GenesisState.typeUrl || Array.isArray(o.evidence) && (!o.evidence.length || Any.isAmino(o.evidence[0]))); + }, encode(message: GenesisState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.evidence) { Any.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -125,5 +134,6 @@ export const GenesisState = { typeUrl: "/cosmos.evidence.v1beta1.GenesisState", value: GenesisState.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/cosmos/evidence/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputv3/cosmos/evidence/v1beta1/query.rpc.func.ts new file mode 100644 index 0000000000..a69ec1a9a0 --- /dev/null +++ b/__fixtures__/v-next/outputv3/cosmos/evidence/v1beta1/query.rpc.func.ts @@ -0,0 +1,30 @@ +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; +import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../google/protobuf/any"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { QueryEvidenceRequest, QueryEvidenceRequestSDKType, QueryEvidenceResponse, QueryEvidenceResponseSDKType, QueryAllEvidenceRequest, QueryAllEvidenceRequestSDKType, QueryAllEvidenceResponse, QueryAllEvidenceResponseSDKType } from "./query"; +/** + * Evidence queries evidence based on evidence hash. + * @name getEvidence + * @package cosmos.evidence.v1beta1 + * @see proto service: cosmos.evidence.v1beta1.Evidence + */ +export const getEvidence = buildQuery({ + encode: QueryEvidenceRequest.encode, + decode: QueryEvidenceResponse.decode, + service: "cosmos.evidence.v1beta1.Query", + method: "Evidence", + deps: [QueryEvidenceRequest, QueryEvidenceResponse] +}); +/** + * AllEvidence queries all evidence. + * @name getAllEvidence + * @package cosmos.evidence.v1beta1 + * @see proto service: cosmos.evidence.v1beta1.AllEvidence + */ +export const getAllEvidence = buildQuery({ + encode: QueryAllEvidenceRequest.encode, + decode: QueryAllEvidenceResponse.decode, + service: "cosmos.evidence.v1beta1.Query", + method: "AllEvidence", + deps: [QueryAllEvidenceRequest, QueryAllEvidenceResponse] +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/cosmos/evidence/v1beta1/query.ts b/__fixtures__/v-next/outputv3/cosmos/evidence/v1beta1/query.ts index 5694616e65..b805e9ecc6 100644 --- a/__fixtures__/v-next/outputv3/cosmos/evidence/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv3/cosmos/evidence/v1beta1/query.ts @@ -2,6 +2,7 @@ import { PageRequest, PageRequestAmino, PageRequestSDKType, PageResponse, PageRe import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../google/protobuf/any"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { isSet, bytesFromBase64, DeepPartial, base64FromBytes } from "../../../helpers"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "cosmos.evidence.v1beta1"; /** * QueryEvidenceRequest is the request type for the Query/Evidence RPC method. @@ -180,6 +181,15 @@ function createBaseQueryEvidenceRequest(): QueryEvidenceRequest { export const QueryEvidenceRequest = { typeUrl: "/cosmos.evidence.v1beta1.QueryEvidenceRequest", aminoType: "cosmos-sdk/QueryEvidenceRequest", + is(o: any): o is QueryEvidenceRequest { + return o && (o.$typeUrl === QueryEvidenceRequest.typeUrl || o.evidenceHash instanceof Uint8Array || typeof o.evidenceHash === "string"); + }, + isSDK(o: any): o is QueryEvidenceRequestSDKType { + return o && (o.$typeUrl === QueryEvidenceRequest.typeUrl || o.evidence_hash instanceof Uint8Array || typeof o.evidence_hash === "string"); + }, + isAmino(o: any): o is QueryEvidenceRequestAmino { + return o && (o.$typeUrl === QueryEvidenceRequest.typeUrl || o.evidence_hash instanceof Uint8Array || typeof o.evidence_hash === "string"); + }, encode(message: QueryEvidenceRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.evidenceHash.length !== 0) { writer.uint32(10).bytes(message.evidenceHash); @@ -246,7 +256,8 @@ export const QueryEvidenceRequest = { typeUrl: "/cosmos.evidence.v1beta1.QueryEvidenceRequest", value: QueryEvidenceRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryEvidenceResponse(): QueryEvidenceResponse { return { @@ -262,6 +273,15 @@ function createBaseQueryEvidenceResponse(): QueryEvidenceResponse { export const QueryEvidenceResponse = { typeUrl: "/cosmos.evidence.v1beta1.QueryEvidenceResponse", aminoType: "cosmos-sdk/QueryEvidenceResponse", + is(o: any): o is QueryEvidenceResponse { + return o && o.$typeUrl === QueryEvidenceResponse.typeUrl; + }, + isSDK(o: any): o is QueryEvidenceResponseSDKType { + return o && o.$typeUrl === QueryEvidenceResponse.typeUrl; + }, + isAmino(o: any): o is QueryEvidenceResponseAmino { + return o && o.$typeUrl === QueryEvidenceResponse.typeUrl; + }, encode(message: QueryEvidenceResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.evidence !== undefined) { Any.encode(message.evidence, writer.uint32(10).fork()).ldelim(); @@ -330,7 +350,8 @@ export const QueryEvidenceResponse = { typeUrl: "/cosmos.evidence.v1beta1.QueryEvidenceResponse", value: QueryEvidenceResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryAllEvidenceRequest(): QueryAllEvidenceRequest { return { @@ -347,6 +368,15 @@ function createBaseQueryAllEvidenceRequest(): QueryAllEvidenceRequest { export const QueryAllEvidenceRequest = { typeUrl: "/cosmos.evidence.v1beta1.QueryAllEvidenceRequest", aminoType: "cosmos-sdk/QueryAllEvidenceRequest", + is(o: any): o is QueryAllEvidenceRequest { + return o && o.$typeUrl === QueryAllEvidenceRequest.typeUrl; + }, + isSDK(o: any): o is QueryAllEvidenceRequestSDKType { + return o && o.$typeUrl === QueryAllEvidenceRequest.typeUrl; + }, + isAmino(o: any): o is QueryAllEvidenceRequestAmino { + return o && o.$typeUrl === QueryAllEvidenceRequest.typeUrl; + }, encode(message: QueryAllEvidenceRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.pagination !== undefined) { PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); @@ -415,6 +445,12 @@ export const QueryAllEvidenceRequest = { typeUrl: "/cosmos.evidence.v1beta1.QueryAllEvidenceRequest", value: QueryAllEvidenceRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryAllEvidenceRequest.typeUrl)) { + return; + } + PageRequest.registerTypeUrl(); } }; function createBaseQueryAllEvidenceResponse(): QueryAllEvidenceResponse { @@ -433,6 +469,15 @@ function createBaseQueryAllEvidenceResponse(): QueryAllEvidenceResponse { export const QueryAllEvidenceResponse = { typeUrl: "/cosmos.evidence.v1beta1.QueryAllEvidenceResponse", aminoType: "cosmos-sdk/QueryAllEvidenceResponse", + is(o: any): o is QueryAllEvidenceResponse { + return o && (o.$typeUrl === QueryAllEvidenceResponse.typeUrl || Array.isArray(o.evidence) && (!o.evidence.length || Any.is(o.evidence[0]))); + }, + isSDK(o: any): o is QueryAllEvidenceResponseSDKType { + return o && (o.$typeUrl === QueryAllEvidenceResponse.typeUrl || Array.isArray(o.evidence) && (!o.evidence.length || Any.isSDK(o.evidence[0]))); + }, + isAmino(o: any): o is QueryAllEvidenceResponseAmino { + return o && (o.$typeUrl === QueryAllEvidenceResponse.typeUrl || Array.isArray(o.evidence) && (!o.evidence.length || Any.isAmino(o.evidence[0]))); + }, encode(message: QueryAllEvidenceResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.evidence) { Any.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -521,5 +566,11 @@ export const QueryAllEvidenceResponse = { typeUrl: "/cosmos.evidence.v1beta1.QueryAllEvidenceResponse", value: QueryAllEvidenceResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryAllEvidenceResponse.typeUrl)) { + return; + } + PageResponse.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/cosmos/evidence/v1beta1/tx.registry.ts b/__fixtures__/v-next/outputv3/cosmos/evidence/v1beta1/tx.registry.ts index 1c3d20f623..f6fe3faebb 100644 --- a/__fixtures__/v-next/outputv3/cosmos/evidence/v1beta1/tx.registry.ts +++ b/__fixtures__/v-next/outputv3/cosmos/evidence/v1beta1/tx.registry.ts @@ -1,12 +1,7 @@ import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../google/protobuf/any"; -import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { TelescopeGeneratedType } from "../../../types"; import { MsgSubmitEvidence, MsgSubmitEvidenceSDKType } from "./tx"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/cosmos.evidence.v1beta1.MsgSubmitEvidence", MsgSubmitEvidence]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/cosmos.evidence.v1beta1.MsgSubmitEvidence", MsgSubmitEvidence]]; export const MessageComposer = { encoded: { submitEvidence(value: MsgSubmitEvidence) { diff --git a/__fixtures__/v-next/outputv3/cosmos/evidence/v1beta1/tx.rpc.func.ts b/__fixtures__/v-next/outputv3/cosmos/evidence/v1beta1/tx.rpc.func.ts new file mode 100644 index 0000000000..8bfbb783fc --- /dev/null +++ b/__fixtures__/v-next/outputv3/cosmos/evidence/v1beta1/tx.rpc.func.ts @@ -0,0 +1,13 @@ +import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../google/protobuf/any"; +import { buildTx } from "../../../helper-func-types"; +import { MsgSubmitEvidence, MsgSubmitEvidenceSDKType, MsgSubmitEvidenceResponse, MsgSubmitEvidenceResponseSDKType } from "./tx"; +/** + * SubmitEvidence submits an arbitrary Evidence of misbehavior such as equivocation or + * counterfactual signing. + * @name submitEvidence + * @package cosmos.evidence.v1beta1 + * @see proto service: cosmos.evidence.v1beta1.SubmitEvidence + */ +export const submitEvidence = buildTx({ + msg: MsgSubmitEvidence +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/cosmos/evidence/v1beta1/tx.ts b/__fixtures__/v-next/outputv3/cosmos/evidence/v1beta1/tx.ts index 43e85e73a6..ff1daa0241 100644 --- a/__fixtures__/v-next/outputv3/cosmos/evidence/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputv3/cosmos/evidence/v1beta1/tx.ts @@ -1,5 +1,6 @@ import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../google/protobuf/any"; import { BinaryReader, BinaryWriter } from "../../../binary"; +import { GlobalDecoderRegistry } from "../../../registry"; import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../helpers"; export const protobufPackage = "cosmos.evidence.v1beta1"; /** @@ -95,12 +96,21 @@ function createBaseMsgSubmitEvidence(): MsgSubmitEvidence { export const MsgSubmitEvidence = { typeUrl: "/cosmos.evidence.v1beta1.MsgSubmitEvidence", aminoType: "cosmos-sdk/MsgSubmitEvidence", + is(o: any): o is MsgSubmitEvidence { + return o && (o.$typeUrl === MsgSubmitEvidence.typeUrl || typeof o.submitter === "string"); + }, + isSDK(o: any): o is MsgSubmitEvidenceSDKType { + return o && (o.$typeUrl === MsgSubmitEvidence.typeUrl || typeof o.submitter === "string"); + }, + isAmino(o: any): o is MsgSubmitEvidenceAmino { + return o && (o.$typeUrl === MsgSubmitEvidence.typeUrl || typeof o.submitter === "string"); + }, encode(message: MsgSubmitEvidence, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.submitter !== "") { writer.uint32(10).string(message.submitter); } if (message.evidence !== undefined) { - Any.encode((message.evidence as Any), writer.uint32(18).fork()).ldelim(); + Any.encode(GlobalDecoderRegistry.wrapAny(message.evidence), writer.uint32(18).fork()).ldelim(); } return writer; }, @@ -115,7 +125,7 @@ export const MsgSubmitEvidence = { message.submitter = reader.string(); break; case 2: - message.evidence = useInterfaces ? (Evidence_InterfaceDecoder(reader) as Any) : Any.decode(reader, reader.uint32(), useInterfaces); + message.evidence = GlobalDecoderRegistry.unwrapAny(reader); break; default: reader.skipType(tag & 7); @@ -127,27 +137,27 @@ export const MsgSubmitEvidence = { fromJSON(object: any): MsgSubmitEvidence { const obj = createBaseMsgSubmitEvidence(); if (isSet(object.submitter)) obj.submitter = String(object.submitter); - if (isSet(object.evidence)) obj.evidence = Any.fromJSON(object.evidence); + if (isSet(object.evidence)) obj.evidence = GlobalDecoderRegistry.fromJSON(object.evidence); return obj; }, fromPartial(object: DeepPartial): MsgSubmitEvidence { const message = createBaseMsgSubmitEvidence(); message.submitter = object.submitter ?? ""; if (object.evidence !== undefined && object.evidence !== null) { - message.evidence = Any.fromPartial(object.evidence); + message.evidence = GlobalDecoderRegistry.fromPartial(object.evidence); } return message; }, fromSDK(object: MsgSubmitEvidenceSDKType): MsgSubmitEvidence { return { submitter: object?.submitter, - evidence: object.evidence ? Any.fromSDK(object.evidence) : undefined + evidence: object.evidence ? GlobalDecoderRegistry.fromSDK(object.evidence) : undefined }; }, toSDK(message: MsgSubmitEvidence): MsgSubmitEvidenceSDKType { const obj: any = {}; obj.submitter = message.submitter; - message.evidence !== undefined && (obj.evidence = message.evidence ? Any.toSDK(message.evidence) : undefined); + message.evidence !== undefined && (obj.evidence = message.evidence ? GlobalDecoderRegistry.toSDK(message.evidence) : undefined); return obj; }, fromAmino(object: MsgSubmitEvidenceAmino): MsgSubmitEvidence { @@ -156,14 +166,14 @@ export const MsgSubmitEvidence = { message.submitter = object.submitter; } if (object.evidence !== undefined && object.evidence !== null) { - message.evidence = Evidence_FromAmino(object.evidence); + message.evidence = GlobalDecoderRegistry.fromAminoMsg(object.evidence); } return message; }, toAmino(message: MsgSubmitEvidence, useInterfaces: boolean = true): MsgSubmitEvidenceAmino { const obj: any = {}; obj.submitter = message.submitter === "" ? undefined : message.submitter; - obj.evidence = message.evidence ? Evidence_ToAmino((message.evidence as Any), useInterfaces) : undefined; + obj.evidence = message.evidence ? GlobalDecoderRegistry.toAminoMsg(message.evidence) : undefined; return obj; }, fromProtoMsg(message: MsgSubmitEvidenceProtoMsg, useInterfaces: boolean = true): MsgSubmitEvidence { @@ -177,7 +187,8 @@ export const MsgSubmitEvidence = { typeUrl: "/cosmos.evidence.v1beta1.MsgSubmitEvidence", value: MsgSubmitEvidence.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgSubmitEvidenceResponse(): MsgSubmitEvidenceResponse { return { @@ -193,6 +204,15 @@ function createBaseMsgSubmitEvidenceResponse(): MsgSubmitEvidenceResponse { export const MsgSubmitEvidenceResponse = { typeUrl: "/cosmos.evidence.v1beta1.MsgSubmitEvidenceResponse", aminoType: "cosmos-sdk/MsgSubmitEvidenceResponse", + is(o: any): o is MsgSubmitEvidenceResponse { + return o && (o.$typeUrl === MsgSubmitEvidenceResponse.typeUrl || o.hash instanceof Uint8Array || typeof o.hash === "string"); + }, + isSDK(o: any): o is MsgSubmitEvidenceResponseSDKType { + return o && (o.$typeUrl === MsgSubmitEvidenceResponse.typeUrl || o.hash instanceof Uint8Array || typeof o.hash === "string"); + }, + isAmino(o: any): o is MsgSubmitEvidenceResponseAmino { + return o && (o.$typeUrl === MsgSubmitEvidenceResponse.typeUrl || o.hash instanceof Uint8Array || typeof o.hash === "string"); + }, encode(message: MsgSubmitEvidenceResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.hash.length !== 0) { writer.uint32(34).bytes(message.hash); @@ -259,19 +279,6 @@ export const MsgSubmitEvidenceResponse = { typeUrl: "/cosmos.evidence.v1beta1.MsgSubmitEvidenceResponse", value: MsgSubmitEvidenceResponse.encode(message).finish() }; - } -}; -export const Evidence_InterfaceDecoder = (input: BinaryReader | Uint8Array): Any => { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - const data = Any.decode(reader, reader.uint32(), true); - switch (data.typeUrl) { - default: - return data; - } -}; -export const Evidence_FromAmino = (content: AnyAmino): Any => { - return Any.fromAmino(content); -}; -export const Evidence_ToAmino = (content: Any, useInterfaces: boolean = true) => { - return Any.toAmino(content, useInterfaces); + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/cosmos/feegrant/v1beta1/feegrant.ts b/__fixtures__/v-next/outputv3/cosmos/feegrant/v1beta1/feegrant.ts index 4102a224eb..57396bb803 100644 --- a/__fixtures__/v-next/outputv3/cosmos/feegrant/v1beta1/feegrant.ts +++ b/__fixtures__/v-next/outputv3/cosmos/feegrant/v1beta1/feegrant.ts @@ -4,6 +4,7 @@ import { Duration, DurationAmino, DurationSDKType } from "../../../google/protob import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../google/protobuf/any"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { toTimestamp, fromTimestamp, isSet, DeepPartial } from "../../../helpers"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "cosmos.feegrant.v1beta1"; /** * BasicAllowance implements Allowance with a one-time grant of tokens @@ -278,6 +279,15 @@ function createBaseBasicAllowance(): BasicAllowance { export const BasicAllowance = { typeUrl: "/cosmos.feegrant.v1beta1.BasicAllowance", aminoType: "cosmos-sdk/BasicAllowance", + is(o: any): o is BasicAllowance { + return o && (o.$typeUrl === BasicAllowance.typeUrl || Array.isArray(o.spendLimit) && (!o.spendLimit.length || Coin.is(o.spendLimit[0]))); + }, + isSDK(o: any): o is BasicAllowanceSDKType { + return o && (o.$typeUrl === BasicAllowance.typeUrl || Array.isArray(o.spend_limit) && (!o.spend_limit.length || Coin.isSDK(o.spend_limit[0]))); + }, + isAmino(o: any): o is BasicAllowanceAmino { + return o && (o.$typeUrl === BasicAllowance.typeUrl || Array.isArray(o.spend_limit) && (!o.spend_limit.length || Coin.isAmino(o.spend_limit[0]))); + }, encode(message: BasicAllowance, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.spendLimit) { Coin.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -364,6 +374,14 @@ export const BasicAllowance = { typeUrl: "/cosmos.feegrant.v1beta1.BasicAllowance", value: BasicAllowance.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(BasicAllowance.typeUrl)) { + return; + } + GlobalDecoderRegistry.register(BasicAllowance.typeUrl, BasicAllowance); + GlobalDecoderRegistry.registerAminoProtoMapping(BasicAllowance.aminoType, BasicAllowance.typeUrl); + Coin.registerTypeUrl(); } }; function createBasePeriodicAllowance(): PeriodicAllowance { @@ -386,6 +404,15 @@ function createBasePeriodicAllowance(): PeriodicAllowance { export const PeriodicAllowance = { typeUrl: "/cosmos.feegrant.v1beta1.PeriodicAllowance", aminoType: "cosmos-sdk/PeriodicAllowance", + is(o: any): o is PeriodicAllowance { + return o && (o.$typeUrl === PeriodicAllowance.typeUrl || BasicAllowance.is(o.basic) && Duration.is(o.period) && Array.isArray(o.periodSpendLimit) && (!o.periodSpendLimit.length || Coin.is(o.periodSpendLimit[0])) && Array.isArray(o.periodCanSpend) && (!o.periodCanSpend.length || Coin.is(o.periodCanSpend[0])) && Timestamp.is(o.periodReset)); + }, + isSDK(o: any): o is PeriodicAllowanceSDKType { + return o && (o.$typeUrl === PeriodicAllowance.typeUrl || BasicAllowance.isSDK(o.basic) && Duration.isSDK(o.period) && Array.isArray(o.period_spend_limit) && (!o.period_spend_limit.length || Coin.isSDK(o.period_spend_limit[0])) && Array.isArray(o.period_can_spend) && (!o.period_can_spend.length || Coin.isSDK(o.period_can_spend[0])) && Timestamp.isSDK(o.period_reset)); + }, + isAmino(o: any): o is PeriodicAllowanceAmino { + return o && (o.$typeUrl === PeriodicAllowance.typeUrl || BasicAllowance.isAmino(o.basic) && Duration.isAmino(o.period) && Array.isArray(o.period_spend_limit) && (!o.period_spend_limit.length || Coin.isAmino(o.period_spend_limit[0])) && Array.isArray(o.period_can_spend) && (!o.period_can_spend.length || Coin.isAmino(o.period_can_spend[0])) && Timestamp.isAmino(o.period_reset)); + }, encode(message: PeriodicAllowance, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.basic !== undefined) { BasicAllowance.encode(message.basic, writer.uint32(10).fork()).ldelim(); @@ -524,6 +551,15 @@ export const PeriodicAllowance = { typeUrl: "/cosmos.feegrant.v1beta1.PeriodicAllowance", value: PeriodicAllowance.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(PeriodicAllowance.typeUrl)) { + return; + } + GlobalDecoderRegistry.register(PeriodicAllowance.typeUrl, PeriodicAllowance); + GlobalDecoderRegistry.registerAminoProtoMapping(PeriodicAllowance.aminoType, PeriodicAllowance.typeUrl); + BasicAllowance.registerTypeUrl(); + Coin.registerTypeUrl(); } }; function createBaseAllowedMsgAllowance(): AllowedMsgAllowance { @@ -542,9 +578,18 @@ function createBaseAllowedMsgAllowance(): AllowedMsgAllowance { export const AllowedMsgAllowance = { typeUrl: "/cosmos.feegrant.v1beta1.AllowedMsgAllowance", aminoType: "cosmos-sdk/AllowedMsgAllowance", + is(o: any): o is AllowedMsgAllowance { + return o && (o.$typeUrl === AllowedMsgAllowance.typeUrl || Array.isArray(o.allowedMessages) && (!o.allowedMessages.length || typeof o.allowedMessages[0] === "string")); + }, + isSDK(o: any): o is AllowedMsgAllowanceSDKType { + return o && (o.$typeUrl === AllowedMsgAllowance.typeUrl || Array.isArray(o.allowed_messages) && (!o.allowed_messages.length || typeof o.allowed_messages[0] === "string")); + }, + isAmino(o: any): o is AllowedMsgAllowanceAmino { + return o && (o.$typeUrl === AllowedMsgAllowance.typeUrl || Array.isArray(o.allowed_messages) && (!o.allowed_messages.length || typeof o.allowed_messages[0] === "string")); + }, encode(message: AllowedMsgAllowance, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.allowance !== undefined) { - Any.encode((message.allowance as Any), writer.uint32(10).fork()).ldelim(); + Any.encode(GlobalDecoderRegistry.wrapAny(message.allowance), writer.uint32(10).fork()).ldelim(); } for (const v of message.allowedMessages) { writer.uint32(18).string(v!); @@ -559,7 +604,7 @@ export const AllowedMsgAllowance = { const tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.allowance = useInterfaces ? (FeeAllowanceI_InterfaceDecoder(reader) as Any) : Any.decode(reader, reader.uint32(), useInterfaces); + message.allowance = GlobalDecoderRegistry.unwrapAny(reader); break; case 2: message.allowedMessages.push(reader.string()); @@ -573,27 +618,27 @@ export const AllowedMsgAllowance = { }, fromJSON(object: any): AllowedMsgAllowance { const obj = createBaseAllowedMsgAllowance(); - if (isSet(object.allowance)) obj.allowance = Any.fromJSON(object.allowance); + if (isSet(object.allowance)) obj.allowance = GlobalDecoderRegistry.fromJSON(object.allowance); if (Array.isArray(object?.allowedMessages)) obj.allowedMessages = object.allowedMessages.map((e: any) => String(e)); return obj; }, fromPartial(object: DeepPartial): AllowedMsgAllowance { const message = createBaseAllowedMsgAllowance(); if (object.allowance !== undefined && object.allowance !== null) { - message.allowance = Any.fromPartial(object.allowance); + message.allowance = GlobalDecoderRegistry.fromPartial(object.allowance); } message.allowedMessages = object.allowedMessages?.map(e => e) || []; return message; }, fromSDK(object: AllowedMsgAllowanceSDKType): AllowedMsgAllowance { return { - allowance: object.allowance ? Any.fromSDK(object.allowance) : undefined, + allowance: object.allowance ? GlobalDecoderRegistry.fromSDK(object.allowance) : undefined, allowedMessages: Array.isArray(object?.allowed_messages) ? object.allowed_messages.map((e: any) => e) : [] }; }, toSDK(message: AllowedMsgAllowance): AllowedMsgAllowanceSDKType { const obj: any = {}; - message.allowance !== undefined && (obj.allowance = message.allowance ? Any.toSDK(message.allowance) : undefined); + message.allowance !== undefined && (obj.allowance = message.allowance ? GlobalDecoderRegistry.toSDK(message.allowance) : undefined); if (message.allowedMessages) { obj.allowed_messages = message.allowedMessages.map(e => e); } else { @@ -604,14 +649,14 @@ export const AllowedMsgAllowance = { fromAmino(object: AllowedMsgAllowanceAmino): AllowedMsgAllowance { const message = createBaseAllowedMsgAllowance(); if (object.allowance !== undefined && object.allowance !== null) { - message.allowance = FeeAllowanceI_FromAmino(object.allowance); + message.allowance = GlobalDecoderRegistry.fromAminoMsg(object.allowance); } message.allowedMessages = object.allowed_messages?.map(e => e) || []; return message; }, toAmino(message: AllowedMsgAllowance, useInterfaces: boolean = true): AllowedMsgAllowanceAmino { const obj: any = {}; - obj.allowance = message.allowance ? FeeAllowanceI_ToAmino((message.allowance as Any), useInterfaces) : undefined; + obj.allowance = message.allowance ? GlobalDecoderRegistry.toAminoMsg(message.allowance) : undefined; if (message.allowedMessages) { obj.allowed_messages = message.allowedMessages.map(e => e); } else { @@ -630,6 +675,16 @@ export const AllowedMsgAllowance = { typeUrl: "/cosmos.feegrant.v1beta1.AllowedMsgAllowance", value: AllowedMsgAllowance.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(AllowedMsgAllowance.typeUrl)) { + return; + } + GlobalDecoderRegistry.register(AllowedMsgAllowance.typeUrl, AllowedMsgAllowance); + GlobalDecoderRegistry.registerAminoProtoMapping(AllowedMsgAllowance.aminoType, AllowedMsgAllowance.typeUrl); + BasicAllowance.registerTypeUrl(); + PeriodicAllowance.registerTypeUrl(); + AllowedMsgAllowance.registerTypeUrl(); } }; function createBaseGrant(): Grant { @@ -648,6 +703,15 @@ function createBaseGrant(): Grant { export const Grant = { typeUrl: "/cosmos.feegrant.v1beta1.Grant", aminoType: "cosmos-sdk/Grant", + is(o: any): o is Grant { + return o && (o.$typeUrl === Grant.typeUrl || typeof o.granter === "string" && typeof o.grantee === "string"); + }, + isSDK(o: any): o is GrantSDKType { + return o && (o.$typeUrl === Grant.typeUrl || typeof o.granter === "string" && typeof o.grantee === "string"); + }, + isAmino(o: any): o is GrantAmino { + return o && (o.$typeUrl === Grant.typeUrl || typeof o.granter === "string" && typeof o.grantee === "string"); + }, encode(message: Grant, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.granter !== "") { writer.uint32(10).string(message.granter); @@ -656,7 +720,7 @@ export const Grant = { writer.uint32(18).string(message.grantee); } if (message.allowance !== undefined) { - Any.encode((message.allowance as Any), writer.uint32(26).fork()).ldelim(); + Any.encode(GlobalDecoderRegistry.wrapAny(message.allowance), writer.uint32(26).fork()).ldelim(); } return writer; }, @@ -674,7 +738,7 @@ export const Grant = { message.grantee = reader.string(); break; case 3: - message.allowance = useInterfaces ? (FeeAllowanceI_InterfaceDecoder(reader) as Any) : Any.decode(reader, reader.uint32(), useInterfaces); + message.allowance = GlobalDecoderRegistry.unwrapAny(reader); break; default: reader.skipType(tag & 7); @@ -687,7 +751,7 @@ export const Grant = { const obj = createBaseGrant(); if (isSet(object.granter)) obj.granter = String(object.granter); if (isSet(object.grantee)) obj.grantee = String(object.grantee); - if (isSet(object.allowance)) obj.allowance = Any.fromJSON(object.allowance); + if (isSet(object.allowance)) obj.allowance = GlobalDecoderRegistry.fromJSON(object.allowance); return obj; }, fromPartial(object: DeepPartial): Grant { @@ -695,7 +759,7 @@ export const Grant = { message.granter = object.granter ?? ""; message.grantee = object.grantee ?? ""; if (object.allowance !== undefined && object.allowance !== null) { - message.allowance = Any.fromPartial(object.allowance); + message.allowance = GlobalDecoderRegistry.fromPartial(object.allowance); } return message; }, @@ -703,14 +767,14 @@ export const Grant = { return { granter: object?.granter, grantee: object?.grantee, - allowance: object.allowance ? Any.fromSDK(object.allowance) : undefined + allowance: object.allowance ? GlobalDecoderRegistry.fromSDK(object.allowance) : undefined }; }, toSDK(message: Grant): GrantSDKType { const obj: any = {}; obj.granter = message.granter; obj.grantee = message.grantee; - message.allowance !== undefined && (obj.allowance = message.allowance ? Any.toSDK(message.allowance) : undefined); + message.allowance !== undefined && (obj.allowance = message.allowance ? GlobalDecoderRegistry.toSDK(message.allowance) : undefined); return obj; }, fromAmino(object: GrantAmino): Grant { @@ -722,7 +786,7 @@ export const Grant = { message.grantee = object.grantee; } if (object.allowance !== undefined && object.allowance !== null) { - message.allowance = FeeAllowanceI_FromAmino(object.allowance); + message.allowance = GlobalDecoderRegistry.fromAminoMsg(object.allowance); } return message; }, @@ -730,7 +794,7 @@ export const Grant = { const obj: any = {}; obj.granter = message.granter === "" ? undefined : message.granter; obj.grantee = message.grantee === "" ? undefined : message.grantee; - obj.allowance = message.allowance ? FeeAllowanceI_ToAmino((message.allowance as Any), useInterfaces) : undefined; + obj.allowance = message.allowance ? GlobalDecoderRegistry.toAminoMsg(message.allowance) : undefined; return obj; }, fromProtoMsg(message: GrantProtoMsg, useInterfaces: boolean = true): Grant { @@ -744,61 +808,13 @@ export const Grant = { typeUrl: "/cosmos.feegrant.v1beta1.Grant", value: Grant.encode(message).finish() }; - } -}; -export const FeeAllowanceI_InterfaceDecoder = (input: BinaryReader | Uint8Array): BasicAllowance | PeriodicAllowance | AllowedMsgAllowance | Any => { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - const data = Any.decode(reader, reader.uint32(), true); - switch (data.typeUrl) { - case "/cosmos.feegrant.v1beta1.BasicAllowance": - return BasicAllowance.decode(data.value, undefined, true); - case "/cosmos.feegrant.v1beta1.PeriodicAllowance": - return PeriodicAllowance.decode(data.value, undefined, true); - case "/cosmos.feegrant.v1beta1.AllowedMsgAllowance": - return AllowedMsgAllowance.decode(data.value, undefined, true); - default: - return data; - } -}; -export const FeeAllowanceI_FromAmino = (content: AnyAmino): Any => { - switch (content.type) { - case "cosmos-sdk/BasicAllowance": - return Any.fromPartial({ - typeUrl: "/cosmos.feegrant.v1beta1.BasicAllowance", - value: BasicAllowance.encode(BasicAllowance.fromPartial(BasicAllowance.fromAmino(content.value))).finish() - }); - case "cosmos-sdk/PeriodicAllowance": - return Any.fromPartial({ - typeUrl: "/cosmos.feegrant.v1beta1.PeriodicAllowance", - value: PeriodicAllowance.encode(PeriodicAllowance.fromPartial(PeriodicAllowance.fromAmino(content.value))).finish() - }); - case "cosmos-sdk/AllowedMsgAllowance": - return Any.fromPartial({ - typeUrl: "/cosmos.feegrant.v1beta1.AllowedMsgAllowance", - value: AllowedMsgAllowance.encode(AllowedMsgAllowance.fromPartial(AllowedMsgAllowance.fromAmino(content.value))).finish() - }); - default: - return Any.fromAmino(content); - } -}; -export const FeeAllowanceI_ToAmino = (content: Any, useInterfaces: boolean = true) => { - switch (content.typeUrl) { - case "/cosmos.feegrant.v1beta1.BasicAllowance": - return { - type: "cosmos-sdk/BasicAllowance", - value: BasicAllowance.toAmino(BasicAllowance.decode(content.value, undefined, useInterfaces), useInterfaces) - }; - case "/cosmos.feegrant.v1beta1.PeriodicAllowance": - return { - type: "cosmos-sdk/PeriodicAllowance", - value: PeriodicAllowance.toAmino(PeriodicAllowance.decode(content.value, undefined, useInterfaces), useInterfaces) - }; - case "/cosmos.feegrant.v1beta1.AllowedMsgAllowance": - return { - type: "cosmos-sdk/AllowedMsgAllowance", - value: AllowedMsgAllowance.toAmino(AllowedMsgAllowance.decode(content.value, undefined, useInterfaces), useInterfaces) - }; - default: - return Any.toAmino(content, useInterfaces); + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Grant.typeUrl)) { + return; + } + BasicAllowance.registerTypeUrl(); + PeriodicAllowance.registerTypeUrl(); + AllowedMsgAllowance.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/cosmos/feegrant/v1beta1/genesis.ts b/__fixtures__/v-next/outputv3/cosmos/feegrant/v1beta1/genesis.ts index fdfa2e5b93..b0b0569fe8 100644 --- a/__fixtures__/v-next/outputv3/cosmos/feegrant/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv3/cosmos/feegrant/v1beta1/genesis.ts @@ -1,6 +1,7 @@ import { Grant, GrantAmino, GrantSDKType } from "./feegrant"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { DeepPartial } from "../../../helpers"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "cosmos.feegrant.v1beta1"; /** * GenesisState contains a set of fee allowances, persisted from the store @@ -47,6 +48,15 @@ function createBaseGenesisState(): GenesisState { export const GenesisState = { typeUrl: "/cosmos.feegrant.v1beta1.GenesisState", aminoType: "cosmos-sdk/GenesisState", + is(o: any): o is GenesisState { + return o && (o.$typeUrl === GenesisState.typeUrl || Array.isArray(o.allowances) && (!o.allowances.length || Grant.is(o.allowances[0]))); + }, + isSDK(o: any): o is GenesisStateSDKType { + return o && (o.$typeUrl === GenesisState.typeUrl || Array.isArray(o.allowances) && (!o.allowances.length || Grant.isSDK(o.allowances[0]))); + }, + isAmino(o: any): o is GenesisStateAmino { + return o && (o.$typeUrl === GenesisState.typeUrl || Array.isArray(o.allowances) && (!o.allowances.length || Grant.isAmino(o.allowances[0]))); + }, encode(message: GenesisState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.allowances) { Grant.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -119,5 +129,11 @@ export const GenesisState = { typeUrl: "/cosmos.feegrant.v1beta1.GenesisState", value: GenesisState.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GenesisState.typeUrl)) { + return; + } + Grant.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/cosmos/feegrant/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputv3/cosmos/feegrant/v1beta1/query.rpc.func.ts new file mode 100644 index 0000000000..67ad29d7ec --- /dev/null +++ b/__fixtures__/v-next/outputv3/cosmos/feegrant/v1beta1/query.rpc.func.ts @@ -0,0 +1,44 @@ +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; +import { Grant, GrantSDKType } from "./feegrant"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { QueryAllowanceRequest, QueryAllowanceRequestSDKType, QueryAllowanceResponse, QueryAllowanceResponseSDKType, QueryAllowancesRequest, QueryAllowancesRequestSDKType, QueryAllowancesResponse, QueryAllowancesResponseSDKType, QueryAllowancesByGranterRequest, QueryAllowancesByGranterRequestSDKType, QueryAllowancesByGranterResponse, QueryAllowancesByGranterResponseSDKType } from "./query"; +/** + * Allowance returns fee granted to the grantee by the granter. + * @name getAllowance + * @package cosmos.feegrant.v1beta1 + * @see proto service: cosmos.feegrant.v1beta1.Allowance + */ +export const getAllowance = buildQuery({ + encode: QueryAllowanceRequest.encode, + decode: QueryAllowanceResponse.decode, + service: "cosmos.feegrant.v1beta1.Query", + method: "Allowance", + deps: [QueryAllowanceRequest, QueryAllowanceResponse] +}); +/** + * Allowances returns all the grants for address. + * @name getAllowances + * @package cosmos.feegrant.v1beta1 + * @see proto service: cosmos.feegrant.v1beta1.Allowances + */ +export const getAllowances = buildQuery({ + encode: QueryAllowancesRequest.encode, + decode: QueryAllowancesResponse.decode, + service: "cosmos.feegrant.v1beta1.Query", + method: "Allowances", + deps: [QueryAllowancesRequest, QueryAllowancesResponse] +}); +/** + * AllowancesByGranter returns all the grants given by an address + * Since v0.46 + * @name getAllowancesByGranter + * @package cosmos.feegrant.v1beta1 + * @see proto service: cosmos.feegrant.v1beta1.AllowancesByGranter + */ +export const getAllowancesByGranter = buildQuery({ + encode: QueryAllowancesByGranterRequest.encode, + decode: QueryAllowancesByGranterResponse.decode, + service: "cosmos.feegrant.v1beta1.Query", + method: "AllowancesByGranter", + deps: [QueryAllowancesByGranterRequest, QueryAllowancesByGranterResponse] +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/cosmos/feegrant/v1beta1/query.ts b/__fixtures__/v-next/outputv3/cosmos/feegrant/v1beta1/query.ts index 63ba124d72..c6a470ec65 100644 --- a/__fixtures__/v-next/outputv3/cosmos/feegrant/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv3/cosmos/feegrant/v1beta1/query.ts @@ -2,6 +2,7 @@ import { PageRequest, PageRequestAmino, PageRequestSDKType, PageResponse, PageRe import { Grant, GrantAmino, GrantSDKType } from "./feegrant"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { isSet, DeepPartial } from "../../../helpers"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "cosmos.feegrant.v1beta1"; /** * QueryAllowanceRequest is the request type for the Query/Allowance RPC method. @@ -273,6 +274,15 @@ function createBaseQueryAllowanceRequest(): QueryAllowanceRequest { export const QueryAllowanceRequest = { typeUrl: "/cosmos.feegrant.v1beta1.QueryAllowanceRequest", aminoType: "cosmos-sdk/QueryAllowanceRequest", + is(o: any): o is QueryAllowanceRequest { + return o && (o.$typeUrl === QueryAllowanceRequest.typeUrl || typeof o.granter === "string" && typeof o.grantee === "string"); + }, + isSDK(o: any): o is QueryAllowanceRequestSDKType { + return o && (o.$typeUrl === QueryAllowanceRequest.typeUrl || typeof o.granter === "string" && typeof o.grantee === "string"); + }, + isAmino(o: any): o is QueryAllowanceRequestAmino { + return o && (o.$typeUrl === QueryAllowanceRequest.typeUrl || typeof o.granter === "string" && typeof o.grantee === "string"); + }, encode(message: QueryAllowanceRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.granter !== "") { writer.uint32(10).string(message.granter); @@ -353,7 +363,8 @@ export const QueryAllowanceRequest = { typeUrl: "/cosmos.feegrant.v1beta1.QueryAllowanceRequest", value: QueryAllowanceRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryAllowanceResponse(): QueryAllowanceResponse { return { @@ -369,6 +380,15 @@ function createBaseQueryAllowanceResponse(): QueryAllowanceResponse { export const QueryAllowanceResponse = { typeUrl: "/cosmos.feegrant.v1beta1.QueryAllowanceResponse", aminoType: "cosmos-sdk/QueryAllowanceResponse", + is(o: any): o is QueryAllowanceResponse { + return o && o.$typeUrl === QueryAllowanceResponse.typeUrl; + }, + isSDK(o: any): o is QueryAllowanceResponseSDKType { + return o && o.$typeUrl === QueryAllowanceResponse.typeUrl; + }, + isAmino(o: any): o is QueryAllowanceResponseAmino { + return o && o.$typeUrl === QueryAllowanceResponse.typeUrl; + }, encode(message: QueryAllowanceResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.allowance !== undefined) { Grant.encode(message.allowance, writer.uint32(10).fork()).ldelim(); @@ -437,6 +457,12 @@ export const QueryAllowanceResponse = { typeUrl: "/cosmos.feegrant.v1beta1.QueryAllowanceResponse", value: QueryAllowanceResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryAllowanceResponse.typeUrl)) { + return; + } + Grant.registerTypeUrl(); } }; function createBaseQueryAllowancesRequest(): QueryAllowancesRequest { @@ -454,6 +480,15 @@ function createBaseQueryAllowancesRequest(): QueryAllowancesRequest { export const QueryAllowancesRequest = { typeUrl: "/cosmos.feegrant.v1beta1.QueryAllowancesRequest", aminoType: "cosmos-sdk/QueryAllowancesRequest", + is(o: any): o is QueryAllowancesRequest { + return o && (o.$typeUrl === QueryAllowancesRequest.typeUrl || typeof o.grantee === "string"); + }, + isSDK(o: any): o is QueryAllowancesRequestSDKType { + return o && (o.$typeUrl === QueryAllowancesRequest.typeUrl || typeof o.grantee === "string"); + }, + isAmino(o: any): o is QueryAllowancesRequestAmino { + return o && (o.$typeUrl === QueryAllowancesRequest.typeUrl || typeof o.grantee === "string"); + }, encode(message: QueryAllowancesRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.grantee !== "") { writer.uint32(10).string(message.grantee); @@ -536,6 +571,12 @@ export const QueryAllowancesRequest = { typeUrl: "/cosmos.feegrant.v1beta1.QueryAllowancesRequest", value: QueryAllowancesRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryAllowancesRequest.typeUrl)) { + return; + } + PageRequest.registerTypeUrl(); } }; function createBaseQueryAllowancesResponse(): QueryAllowancesResponse { @@ -553,6 +594,15 @@ function createBaseQueryAllowancesResponse(): QueryAllowancesResponse { export const QueryAllowancesResponse = { typeUrl: "/cosmos.feegrant.v1beta1.QueryAllowancesResponse", aminoType: "cosmos-sdk/QueryAllowancesResponse", + is(o: any): o is QueryAllowancesResponse { + return o && (o.$typeUrl === QueryAllowancesResponse.typeUrl || Array.isArray(o.allowances) && (!o.allowances.length || Grant.is(o.allowances[0]))); + }, + isSDK(o: any): o is QueryAllowancesResponseSDKType { + return o && (o.$typeUrl === QueryAllowancesResponse.typeUrl || Array.isArray(o.allowances) && (!o.allowances.length || Grant.isSDK(o.allowances[0]))); + }, + isAmino(o: any): o is QueryAllowancesResponseAmino { + return o && (o.$typeUrl === QueryAllowancesResponse.typeUrl || Array.isArray(o.allowances) && (!o.allowances.length || Grant.isAmino(o.allowances[0]))); + }, encode(message: QueryAllowancesResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.allowances) { Grant.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -641,6 +691,13 @@ export const QueryAllowancesResponse = { typeUrl: "/cosmos.feegrant.v1beta1.QueryAllowancesResponse", value: QueryAllowancesResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryAllowancesResponse.typeUrl)) { + return; + } + Grant.registerTypeUrl(); + PageResponse.registerTypeUrl(); } }; function createBaseQueryAllowancesByGranterRequest(): QueryAllowancesByGranterRequest { @@ -658,6 +715,15 @@ function createBaseQueryAllowancesByGranterRequest(): QueryAllowancesByGranterRe export const QueryAllowancesByGranterRequest = { typeUrl: "/cosmos.feegrant.v1beta1.QueryAllowancesByGranterRequest", aminoType: "cosmos-sdk/QueryAllowancesByGranterRequest", + is(o: any): o is QueryAllowancesByGranterRequest { + return o && (o.$typeUrl === QueryAllowancesByGranterRequest.typeUrl || typeof o.granter === "string"); + }, + isSDK(o: any): o is QueryAllowancesByGranterRequestSDKType { + return o && (o.$typeUrl === QueryAllowancesByGranterRequest.typeUrl || typeof o.granter === "string"); + }, + isAmino(o: any): o is QueryAllowancesByGranterRequestAmino { + return o && (o.$typeUrl === QueryAllowancesByGranterRequest.typeUrl || typeof o.granter === "string"); + }, encode(message: QueryAllowancesByGranterRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.granter !== "") { writer.uint32(10).string(message.granter); @@ -740,6 +806,12 @@ export const QueryAllowancesByGranterRequest = { typeUrl: "/cosmos.feegrant.v1beta1.QueryAllowancesByGranterRequest", value: QueryAllowancesByGranterRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryAllowancesByGranterRequest.typeUrl)) { + return; + } + PageRequest.registerTypeUrl(); } }; function createBaseQueryAllowancesByGranterResponse(): QueryAllowancesByGranterResponse { @@ -757,6 +829,15 @@ function createBaseQueryAllowancesByGranterResponse(): QueryAllowancesByGranterR export const QueryAllowancesByGranterResponse = { typeUrl: "/cosmos.feegrant.v1beta1.QueryAllowancesByGranterResponse", aminoType: "cosmos-sdk/QueryAllowancesByGranterResponse", + is(o: any): o is QueryAllowancesByGranterResponse { + return o && (o.$typeUrl === QueryAllowancesByGranterResponse.typeUrl || Array.isArray(o.allowances) && (!o.allowances.length || Grant.is(o.allowances[0]))); + }, + isSDK(o: any): o is QueryAllowancesByGranterResponseSDKType { + return o && (o.$typeUrl === QueryAllowancesByGranterResponse.typeUrl || Array.isArray(o.allowances) && (!o.allowances.length || Grant.isSDK(o.allowances[0]))); + }, + isAmino(o: any): o is QueryAllowancesByGranterResponseAmino { + return o && (o.$typeUrl === QueryAllowancesByGranterResponse.typeUrl || Array.isArray(o.allowances) && (!o.allowances.length || Grant.isAmino(o.allowances[0]))); + }, encode(message: QueryAllowancesByGranterResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.allowances) { Grant.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -845,5 +926,12 @@ export const QueryAllowancesByGranterResponse = { typeUrl: "/cosmos.feegrant.v1beta1.QueryAllowancesByGranterResponse", value: QueryAllowancesByGranterResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryAllowancesByGranterResponse.typeUrl)) { + return; + } + Grant.registerTypeUrl(); + PageResponse.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/cosmos/feegrant/v1beta1/tx.registry.ts b/__fixtures__/v-next/outputv3/cosmos/feegrant/v1beta1/tx.registry.ts index f39f3435df..661aab26df 100644 --- a/__fixtures__/v-next/outputv3/cosmos/feegrant/v1beta1/tx.registry.ts +++ b/__fixtures__/v-next/outputv3/cosmos/feegrant/v1beta1/tx.registry.ts @@ -1,13 +1,8 @@ import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../google/protobuf/any"; import { BasicAllowance, BasicAllowanceSDKType, PeriodicAllowance, PeriodicAllowanceSDKType, AllowedMsgAllowance, AllowedMsgAllowanceSDKType } from "./feegrant"; -import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { TelescopeGeneratedType } from "../../../types"; import { MsgGrantAllowance, MsgGrantAllowanceSDKType, MsgRevokeAllowance, MsgRevokeAllowanceSDKType } from "./tx"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/cosmos.feegrant.v1beta1.MsgGrantAllowance", MsgGrantAllowance], ["/cosmos.feegrant.v1beta1.MsgRevokeAllowance", MsgRevokeAllowance]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/cosmos.feegrant.v1beta1.MsgGrantAllowance", MsgGrantAllowance], ["/cosmos.feegrant.v1beta1.MsgRevokeAllowance", MsgRevokeAllowance]]; export const MessageComposer = { encoded: { grantAllowance(value: MsgGrantAllowance) { diff --git a/__fixtures__/v-next/outputv3/cosmos/feegrant/v1beta1/tx.rpc.func.ts b/__fixtures__/v-next/outputv3/cosmos/feegrant/v1beta1/tx.rpc.func.ts new file mode 100644 index 0000000000..c611f1ec46 --- /dev/null +++ b/__fixtures__/v-next/outputv3/cosmos/feegrant/v1beta1/tx.rpc.func.ts @@ -0,0 +1,24 @@ +import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../google/protobuf/any"; +import { BasicAllowance, BasicAllowanceSDKType, PeriodicAllowance, PeriodicAllowanceSDKType, AllowedMsgAllowance, AllowedMsgAllowanceSDKType } from "./feegrant"; +import { buildTx } from "../../../helper-func-types"; +import { MsgGrantAllowance, MsgGrantAllowanceSDKType, MsgGrantAllowanceResponse, MsgGrantAllowanceResponseSDKType, MsgRevokeAllowance, MsgRevokeAllowanceSDKType, MsgRevokeAllowanceResponse, MsgRevokeAllowanceResponseSDKType } from "./tx"; +/** + * GrantAllowance grants fee allowance to the grantee on the granter's + * account with the provided expiration time. + * @name grantAllowance + * @package cosmos.feegrant.v1beta1 + * @see proto service: cosmos.feegrant.v1beta1.GrantAllowance + */ +export const grantAllowance = buildTx({ + msg: MsgGrantAllowance +}); +/** + * RevokeAllowance revokes any fee allowance of granter's account that + * has been granted to the grantee. + * @name revokeAllowance + * @package cosmos.feegrant.v1beta1 + * @see proto service: cosmos.feegrant.v1beta1.RevokeAllowance + */ +export const revokeAllowance = buildTx({ + msg: MsgRevokeAllowance +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/cosmos/feegrant/v1beta1/tx.ts b/__fixtures__/v-next/outputv3/cosmos/feegrant/v1beta1/tx.ts index 0ba3cb0927..31a58cbc8a 100644 --- a/__fixtures__/v-next/outputv3/cosmos/feegrant/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputv3/cosmos/feegrant/v1beta1/tx.ts @@ -1,6 +1,7 @@ import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../google/protobuf/any"; import { BasicAllowance, BasicAllowanceProtoMsg, BasicAllowanceSDKType, PeriodicAllowance, PeriodicAllowanceProtoMsg, PeriodicAllowanceSDKType, AllowedMsgAllowance, AllowedMsgAllowanceProtoMsg, AllowedMsgAllowanceSDKType } from "./feegrant"; import { BinaryReader, BinaryWriter } from "../../../binary"; +import { GlobalDecoderRegistry } from "../../../registry"; import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "cosmos.feegrant.v1beta1"; /** @@ -180,6 +181,15 @@ function createBaseMsgGrantAllowance(): MsgGrantAllowance { export const MsgGrantAllowance = { typeUrl: "/cosmos.feegrant.v1beta1.MsgGrantAllowance", aminoType: "cosmos-sdk/MsgGrantAllowance", + is(o: any): o is MsgGrantAllowance { + return o && (o.$typeUrl === MsgGrantAllowance.typeUrl || typeof o.granter === "string" && typeof o.grantee === "string"); + }, + isSDK(o: any): o is MsgGrantAllowanceSDKType { + return o && (o.$typeUrl === MsgGrantAllowance.typeUrl || typeof o.granter === "string" && typeof o.grantee === "string"); + }, + isAmino(o: any): o is MsgGrantAllowanceAmino { + return o && (o.$typeUrl === MsgGrantAllowance.typeUrl || typeof o.granter === "string" && typeof o.grantee === "string"); + }, encode(message: MsgGrantAllowance, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.granter !== "") { writer.uint32(10).string(message.granter); @@ -188,7 +198,7 @@ export const MsgGrantAllowance = { writer.uint32(18).string(message.grantee); } if (message.allowance !== undefined) { - Any.encode((message.allowance as Any), writer.uint32(26).fork()).ldelim(); + Any.encode(GlobalDecoderRegistry.wrapAny(message.allowance), writer.uint32(26).fork()).ldelim(); } return writer; }, @@ -206,7 +216,7 @@ export const MsgGrantAllowance = { message.grantee = reader.string(); break; case 3: - message.allowance = useInterfaces ? (FeeAllowanceI_InterfaceDecoder(reader) as Any) : Any.decode(reader, reader.uint32(), useInterfaces); + message.allowance = GlobalDecoderRegistry.unwrapAny(reader); break; default: reader.skipType(tag & 7); @@ -219,7 +229,7 @@ export const MsgGrantAllowance = { const obj = createBaseMsgGrantAllowance(); if (isSet(object.granter)) obj.granter = String(object.granter); if (isSet(object.grantee)) obj.grantee = String(object.grantee); - if (isSet(object.allowance)) obj.allowance = Any.fromJSON(object.allowance); + if (isSet(object.allowance)) obj.allowance = GlobalDecoderRegistry.fromJSON(object.allowance); return obj; }, fromPartial(object: DeepPartial): MsgGrantAllowance { @@ -227,7 +237,7 @@ export const MsgGrantAllowance = { message.granter = object.granter ?? ""; message.grantee = object.grantee ?? ""; if (object.allowance !== undefined && object.allowance !== null) { - message.allowance = Any.fromPartial(object.allowance); + message.allowance = GlobalDecoderRegistry.fromPartial(object.allowance); } return message; }, @@ -235,14 +245,14 @@ export const MsgGrantAllowance = { return { granter: object?.granter, grantee: object?.grantee, - allowance: object.allowance ? Any.fromSDK(object.allowance) : undefined + allowance: object.allowance ? GlobalDecoderRegistry.fromSDK(object.allowance) : undefined }; }, toSDK(message: MsgGrantAllowance): MsgGrantAllowanceSDKType { const obj: any = {}; obj.granter = message.granter; obj.grantee = message.grantee; - message.allowance !== undefined && (obj.allowance = message.allowance ? Any.toSDK(message.allowance) : undefined); + message.allowance !== undefined && (obj.allowance = message.allowance ? GlobalDecoderRegistry.toSDK(message.allowance) : undefined); return obj; }, fromAmino(object: MsgGrantAllowanceAmino): MsgGrantAllowance { @@ -254,7 +264,7 @@ export const MsgGrantAllowance = { message.grantee = object.grantee; } if (object.allowance !== undefined && object.allowance !== null) { - message.allowance = FeeAllowanceI_FromAmino(object.allowance); + message.allowance = GlobalDecoderRegistry.fromAminoMsg(object.allowance); } return message; }, @@ -262,7 +272,7 @@ export const MsgGrantAllowance = { const obj: any = {}; obj.granter = message.granter === "" ? undefined : message.granter; obj.grantee = message.grantee === "" ? undefined : message.grantee; - obj.allowance = message.allowance ? FeeAllowanceI_ToAmino((message.allowance as Any), useInterfaces) : undefined; + obj.allowance = message.allowance ? GlobalDecoderRegistry.toAminoMsg(message.allowance) : undefined; return obj; }, fromProtoMsg(message: MsgGrantAllowanceProtoMsg, useInterfaces: boolean = true): MsgGrantAllowance { @@ -276,6 +286,14 @@ export const MsgGrantAllowance = { typeUrl: "/cosmos.feegrant.v1beta1.MsgGrantAllowance", value: MsgGrantAllowance.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgGrantAllowance.typeUrl)) { + return; + } + BasicAllowance.registerTypeUrl(); + PeriodicAllowance.registerTypeUrl(); + AllowedMsgAllowance.registerTypeUrl(); } }; function createBaseMsgGrantAllowanceResponse(): MsgGrantAllowanceResponse { @@ -290,6 +308,15 @@ function createBaseMsgGrantAllowanceResponse(): MsgGrantAllowanceResponse { export const MsgGrantAllowanceResponse = { typeUrl: "/cosmos.feegrant.v1beta1.MsgGrantAllowanceResponse", aminoType: "cosmos-sdk/MsgGrantAllowanceResponse", + is(o: any): o is MsgGrantAllowanceResponse { + return o && o.$typeUrl === MsgGrantAllowanceResponse.typeUrl; + }, + isSDK(o: any): o is MsgGrantAllowanceResponseSDKType { + return o && o.$typeUrl === MsgGrantAllowanceResponse.typeUrl; + }, + isAmino(o: any): o is MsgGrantAllowanceResponseAmino { + return o && o.$typeUrl === MsgGrantAllowanceResponse.typeUrl; + }, encode(_: MsgGrantAllowanceResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -341,7 +368,8 @@ export const MsgGrantAllowanceResponse = { typeUrl: "/cosmos.feegrant.v1beta1.MsgGrantAllowanceResponse", value: MsgGrantAllowanceResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgRevokeAllowance(): MsgRevokeAllowance { return { @@ -358,6 +386,15 @@ function createBaseMsgRevokeAllowance(): MsgRevokeAllowance { export const MsgRevokeAllowance = { typeUrl: "/cosmos.feegrant.v1beta1.MsgRevokeAllowance", aminoType: "cosmos-sdk/MsgRevokeAllowance", + is(o: any): o is MsgRevokeAllowance { + return o && (o.$typeUrl === MsgRevokeAllowance.typeUrl || typeof o.granter === "string" && typeof o.grantee === "string"); + }, + isSDK(o: any): o is MsgRevokeAllowanceSDKType { + return o && (o.$typeUrl === MsgRevokeAllowance.typeUrl || typeof o.granter === "string" && typeof o.grantee === "string"); + }, + isAmino(o: any): o is MsgRevokeAllowanceAmino { + return o && (o.$typeUrl === MsgRevokeAllowance.typeUrl || typeof o.granter === "string" && typeof o.grantee === "string"); + }, encode(message: MsgRevokeAllowance, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.granter !== "") { writer.uint32(10).string(message.granter); @@ -438,7 +475,8 @@ export const MsgRevokeAllowance = { typeUrl: "/cosmos.feegrant.v1beta1.MsgRevokeAllowance", value: MsgRevokeAllowance.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgRevokeAllowanceResponse(): MsgRevokeAllowanceResponse { return {}; @@ -452,6 +490,15 @@ function createBaseMsgRevokeAllowanceResponse(): MsgRevokeAllowanceResponse { export const MsgRevokeAllowanceResponse = { typeUrl: "/cosmos.feegrant.v1beta1.MsgRevokeAllowanceResponse", aminoType: "cosmos-sdk/MsgRevokeAllowanceResponse", + is(o: any): o is MsgRevokeAllowanceResponse { + return o && o.$typeUrl === MsgRevokeAllowanceResponse.typeUrl; + }, + isSDK(o: any): o is MsgRevokeAllowanceResponseSDKType { + return o && o.$typeUrl === MsgRevokeAllowanceResponse.typeUrl; + }, + isAmino(o: any): o is MsgRevokeAllowanceResponseAmino { + return o && o.$typeUrl === MsgRevokeAllowanceResponse.typeUrl; + }, encode(_: MsgRevokeAllowanceResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -503,61 +550,6 @@ export const MsgRevokeAllowanceResponse = { typeUrl: "/cosmos.feegrant.v1beta1.MsgRevokeAllowanceResponse", value: MsgRevokeAllowanceResponse.encode(message).finish() }; - } -}; -export const FeeAllowanceI_InterfaceDecoder = (input: BinaryReader | Uint8Array): BasicAllowance | PeriodicAllowance | AllowedMsgAllowance | Any => { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - const data = Any.decode(reader, reader.uint32(), true); - switch (data.typeUrl) { - case "/cosmos.feegrant.v1beta1.BasicAllowance": - return BasicAllowance.decode(data.value, undefined, true); - case "/cosmos.feegrant.v1beta1.PeriodicAllowance": - return PeriodicAllowance.decode(data.value, undefined, true); - case "/cosmos.feegrant.v1beta1.AllowedMsgAllowance": - return AllowedMsgAllowance.decode(data.value, undefined, true); - default: - return data; - } -}; -export const FeeAllowanceI_FromAmino = (content: AnyAmino): Any => { - switch (content.type) { - case "cosmos-sdk/BasicAllowance": - return Any.fromPartial({ - typeUrl: "/cosmos.feegrant.v1beta1.BasicAllowance", - value: BasicAllowance.encode(BasicAllowance.fromPartial(BasicAllowance.fromAmino(content.value))).finish() - }); - case "cosmos-sdk/PeriodicAllowance": - return Any.fromPartial({ - typeUrl: "/cosmos.feegrant.v1beta1.PeriodicAllowance", - value: PeriodicAllowance.encode(PeriodicAllowance.fromPartial(PeriodicAllowance.fromAmino(content.value))).finish() - }); - case "cosmos-sdk/AllowedMsgAllowance": - return Any.fromPartial({ - typeUrl: "/cosmos.feegrant.v1beta1.AllowedMsgAllowance", - value: AllowedMsgAllowance.encode(AllowedMsgAllowance.fromPartial(AllowedMsgAllowance.fromAmino(content.value))).finish() - }); - default: - return Any.fromAmino(content); - } -}; -export const FeeAllowanceI_ToAmino = (content: Any, useInterfaces: boolean = true) => { - switch (content.typeUrl) { - case "/cosmos.feegrant.v1beta1.BasicAllowance": - return { - type: "cosmos-sdk/BasicAllowance", - value: BasicAllowance.toAmino(BasicAllowance.decode(content.value, undefined, useInterfaces), useInterfaces) - }; - case "/cosmos.feegrant.v1beta1.PeriodicAllowance": - return { - type: "cosmos-sdk/PeriodicAllowance", - value: PeriodicAllowance.toAmino(PeriodicAllowance.decode(content.value, undefined, useInterfaces), useInterfaces) - }; - case "/cosmos.feegrant.v1beta1.AllowedMsgAllowance": - return { - type: "cosmos-sdk/AllowedMsgAllowance", - value: AllowedMsgAllowance.toAmino(AllowedMsgAllowance.decode(content.value, undefined, useInterfaces), useInterfaces) - }; - default: - return Any.toAmino(content, useInterfaces); - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/cosmos/genutil/v1beta1/genesis.ts b/__fixtures__/v-next/outputv3/cosmos/genutil/v1beta1/genesis.ts index d7eb85a7c7..1b04f496ed 100644 --- a/__fixtures__/v-next/outputv3/cosmos/genutil/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv3/cosmos/genutil/v1beta1/genesis.ts @@ -52,6 +52,15 @@ function createBaseGenesisState(): GenesisState { export const GenesisState = { typeUrl: "/cosmos.genutil.v1beta1.GenesisState", aminoType: "cosmos-sdk/GenesisState", + is(o: any): o is GenesisState { + return o && (o.$typeUrl === GenesisState.typeUrl || Array.isArray(o.genTxs) && (!o.genTxs.length || o.genTxs[0] instanceof Uint8Array || typeof o.genTxs[0] === "string")); + }, + isSDK(o: any): o is GenesisStateSDKType { + return o && (o.$typeUrl === GenesisState.typeUrl || Array.isArray(o.gen_txs) && (!o.gen_txs.length || o.gen_txs[0] instanceof Uint8Array || typeof o.gen_txs[0] === "string")); + }, + isAmino(o: any): o is GenesisStateAmino { + return o && (o.$typeUrl === GenesisState.typeUrl || Array.isArray(o.gen_txs) && (!o.gen_txs.length || o.gen_txs[0] instanceof Uint8Array || typeof o.gen_txs[0] === "string")); + }, encode(message: GenesisState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.genTxs) { writer.uint32(10).bytes(v!); @@ -124,5 +133,6 @@ export const GenesisState = { typeUrl: "/cosmos.genutil.v1beta1.GenesisState", value: GenesisState.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/cosmos/gov/v1/genesis.ts b/__fixtures__/v-next/outputv3/cosmos/gov/v1/genesis.ts index 70b27f51d1..76cac82ec9 100644 --- a/__fixtures__/v-next/outputv3/cosmos/gov/v1/genesis.ts +++ b/__fixtures__/v-next/outputv3/cosmos/gov/v1/genesis.ts @@ -1,5 +1,6 @@ import { Deposit, DepositAmino, DepositSDKType, Vote, VoteAmino, VoteSDKType, Proposal, ProposalAmino, ProposalSDKType, DepositParams, DepositParamsAmino, DepositParamsSDKType, VotingParams, VotingParamsAmino, VotingParamsSDKType, TallyParams, TallyParamsAmino, TallyParamsSDKType } from "./gov"; import { BinaryReader, BinaryWriter } from "../../../binary"; +import { GlobalDecoderRegistry } from "../../../registry"; import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "cosmos.gov.v1"; /** @@ -113,6 +114,15 @@ function createBaseGenesisState(): GenesisState { export const GenesisState = { typeUrl: "/cosmos.gov.v1.GenesisState", aminoType: "cosmos-sdk/v1/GenesisState", + is(o: any): o is GenesisState { + return o && (o.$typeUrl === GenesisState.typeUrl || typeof o.startingProposalId === "bigint" && Array.isArray(o.deposits) && (!o.deposits.length || Deposit.is(o.deposits[0])) && Array.isArray(o.votes) && (!o.votes.length || Vote.is(o.votes[0])) && Array.isArray(o.proposals) && (!o.proposals.length || Proposal.is(o.proposals[0]))); + }, + isSDK(o: any): o is GenesisStateSDKType { + return o && (o.$typeUrl === GenesisState.typeUrl || typeof o.starting_proposal_id === "bigint" && Array.isArray(o.deposits) && (!o.deposits.length || Deposit.isSDK(o.deposits[0])) && Array.isArray(o.votes) && (!o.votes.length || Vote.isSDK(o.votes[0])) && Array.isArray(o.proposals) && (!o.proposals.length || Proposal.isSDK(o.proposals[0]))); + }, + isAmino(o: any): o is GenesisStateAmino { + return o && (o.$typeUrl === GenesisState.typeUrl || typeof o.starting_proposal_id === "bigint" && Array.isArray(o.deposits) && (!o.deposits.length || Deposit.isAmino(o.deposits[0])) && Array.isArray(o.votes) && (!o.votes.length || Vote.isAmino(o.votes[0])) && Array.isArray(o.proposals) && (!o.proposals.length || Proposal.isAmino(o.proposals[0]))); + }, encode(message: GenesisState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.startingProposalId !== BigInt(0)) { writer.uint32(8).uint64(message.startingProposalId); @@ -289,5 +299,16 @@ export const GenesisState = { typeUrl: "/cosmos.gov.v1.GenesisState", value: GenesisState.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GenesisState.typeUrl)) { + return; + } + Deposit.registerTypeUrl(); + Vote.registerTypeUrl(); + Proposal.registerTypeUrl(); + DepositParams.registerTypeUrl(); + VotingParams.registerTypeUrl(); + TallyParams.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/cosmos/gov/v1/gov.ts b/__fixtures__/v-next/outputv3/cosmos/gov/v1/gov.ts index 3bcddbf9d0..592e3cb78a 100644 --- a/__fixtures__/v-next/outputv3/cosmos/gov/v1/gov.ts +++ b/__fixtures__/v-next/outputv3/cosmos/gov/v1/gov.ts @@ -2,8 +2,9 @@ import { Coin, CoinAmino, CoinSDKType } from "../../base/v1beta1/coin"; import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../google/protobuf/any"; import { Timestamp, TimestampAmino, TimestampSDKType } from "../../../google/protobuf/timestamp"; import { Duration, DurationAmino, DurationSDKType } from "../../../google/protobuf/duration"; -import { BinaryReader, BinaryWriter } from "../../../binary"; import { isSet, DeepPartial, toTimestamp, fromTimestamp } from "../../../helpers"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "cosmos.gov.v1"; /** VoteOption enumerates the valid vote options for a given governance proposal. */ export enum VoteOption { @@ -535,6 +536,15 @@ function createBaseWeightedVoteOption(): WeightedVoteOption { export const WeightedVoteOption = { typeUrl: "/cosmos.gov.v1.WeightedVoteOption", aminoType: "cosmos-sdk/v1/WeightedVoteOption", + is(o: any): o is WeightedVoteOption { + return o && (o.$typeUrl === WeightedVoteOption.typeUrl || isSet(o.option) && typeof o.weight === "string"); + }, + isSDK(o: any): o is WeightedVoteOptionSDKType { + return o && (o.$typeUrl === WeightedVoteOption.typeUrl || isSet(o.option) && typeof o.weight === "string"); + }, + isAmino(o: any): o is WeightedVoteOptionAmino { + return o && (o.$typeUrl === WeightedVoteOption.typeUrl || isSet(o.option) && typeof o.weight === "string"); + }, encode(message: WeightedVoteOption, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.option !== 0) { writer.uint32(8).int32(message.option); @@ -615,7 +625,8 @@ export const WeightedVoteOption = { typeUrl: "/cosmos.gov.v1.WeightedVoteOption", value: WeightedVoteOption.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseDeposit(): Deposit { return { @@ -634,6 +645,15 @@ function createBaseDeposit(): Deposit { export const Deposit = { typeUrl: "/cosmos.gov.v1.Deposit", aminoType: "cosmos-sdk/v1/Deposit", + is(o: any): o is Deposit { + return o && (o.$typeUrl === Deposit.typeUrl || typeof o.proposalId === "bigint" && typeof o.depositor === "string" && Array.isArray(o.amount) && (!o.amount.length || Coin.is(o.amount[0]))); + }, + isSDK(o: any): o is DepositSDKType { + return o && (o.$typeUrl === Deposit.typeUrl || typeof o.proposal_id === "bigint" && typeof o.depositor === "string" && Array.isArray(o.amount) && (!o.amount.length || Coin.isSDK(o.amount[0]))); + }, + isAmino(o: any): o is DepositAmino { + return o && (o.$typeUrl === Deposit.typeUrl || typeof o.proposal_id === "bigint" && typeof o.depositor === "string" && Array.isArray(o.amount) && (!o.amount.length || Coin.isAmino(o.amount[0]))); + }, encode(message: Deposit, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.proposalId !== BigInt(0)) { writer.uint32(8).uint64(message.proposalId); @@ -736,6 +756,12 @@ export const Deposit = { typeUrl: "/cosmos.gov.v1.Deposit", value: Deposit.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Deposit.typeUrl)) { + return; + } + Coin.registerTypeUrl(); } }; function createBaseProposal(): Proposal { @@ -761,6 +787,15 @@ function createBaseProposal(): Proposal { export const Proposal = { typeUrl: "/cosmos.gov.v1.Proposal", aminoType: "cosmos-sdk/v1/Proposal", + is(o: any): o is Proposal { + return o && (o.$typeUrl === Proposal.typeUrl || typeof o.id === "bigint" && Array.isArray(o.messages) && (!o.messages.length || Any.is(o.messages[0])) && isSet(o.status) && Array.isArray(o.totalDeposit) && (!o.totalDeposit.length || Coin.is(o.totalDeposit[0])) && typeof o.metadata === "string"); + }, + isSDK(o: any): o is ProposalSDKType { + return o && (o.$typeUrl === Proposal.typeUrl || typeof o.id === "bigint" && Array.isArray(o.messages) && (!o.messages.length || Any.isSDK(o.messages[0])) && isSet(o.status) && Array.isArray(o.total_deposit) && (!o.total_deposit.length || Coin.isSDK(o.total_deposit[0])) && typeof o.metadata === "string"); + }, + isAmino(o: any): o is ProposalAmino { + return o && (o.$typeUrl === Proposal.typeUrl || typeof o.id === "bigint" && Array.isArray(o.messages) && (!o.messages.length || Any.isAmino(o.messages[0])) && isSet(o.status) && Array.isArray(o.total_deposit) && (!o.total_deposit.length || Coin.isAmino(o.total_deposit[0])) && typeof o.metadata === "string"); + }, encode(message: Proposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.id !== BigInt(0)) { writer.uint32(8).uint64(message.id); @@ -969,6 +1004,13 @@ export const Proposal = { typeUrl: "/cosmos.gov.v1.Proposal", value: Proposal.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Proposal.typeUrl)) { + return; + } + TallyResult.registerTypeUrl(); + Coin.registerTypeUrl(); } }; function createBaseTallyResult(): TallyResult { @@ -988,6 +1030,15 @@ function createBaseTallyResult(): TallyResult { export const TallyResult = { typeUrl: "/cosmos.gov.v1.TallyResult", aminoType: "cosmos-sdk/v1/TallyResult", + is(o: any): o is TallyResult { + return o && (o.$typeUrl === TallyResult.typeUrl || typeof o.yesCount === "string" && typeof o.abstainCount === "string" && typeof o.noCount === "string" && typeof o.noWithVetoCount === "string"); + }, + isSDK(o: any): o is TallyResultSDKType { + return o && (o.$typeUrl === TallyResult.typeUrl || typeof o.yes_count === "string" && typeof o.abstain_count === "string" && typeof o.no_count === "string" && typeof o.no_with_veto_count === "string"); + }, + isAmino(o: any): o is TallyResultAmino { + return o && (o.$typeUrl === TallyResult.typeUrl || typeof o.yes_count === "string" && typeof o.abstain_count === "string" && typeof o.no_count === "string" && typeof o.no_with_veto_count === "string"); + }, encode(message: TallyResult, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.yesCount !== "") { writer.uint32(10).string(message.yesCount); @@ -1096,7 +1147,8 @@ export const TallyResult = { typeUrl: "/cosmos.gov.v1.TallyResult", value: TallyResult.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseVote(): Vote { return { @@ -1116,6 +1168,15 @@ function createBaseVote(): Vote { export const Vote = { typeUrl: "/cosmos.gov.v1.Vote", aminoType: "cosmos-sdk/v1/Vote", + is(o: any): o is Vote { + return o && (o.$typeUrl === Vote.typeUrl || typeof o.proposalId === "bigint" && typeof o.voter === "string" && Array.isArray(o.options) && (!o.options.length || WeightedVoteOption.is(o.options[0])) && typeof o.metadata === "string"); + }, + isSDK(o: any): o is VoteSDKType { + return o && (o.$typeUrl === Vote.typeUrl || typeof o.proposal_id === "bigint" && typeof o.voter === "string" && Array.isArray(o.options) && (!o.options.length || WeightedVoteOption.isSDK(o.options[0])) && typeof o.metadata === "string"); + }, + isAmino(o: any): o is VoteAmino { + return o && (o.$typeUrl === Vote.typeUrl || typeof o.proposal_id === "bigint" && typeof o.voter === "string" && Array.isArray(o.options) && (!o.options.length || WeightedVoteOption.isAmino(o.options[0])) && typeof o.metadata === "string"); + }, encode(message: Vote, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.proposalId !== BigInt(0)) { writer.uint32(8).uint64(message.proposalId); @@ -1232,6 +1293,12 @@ export const Vote = { typeUrl: "/cosmos.gov.v1.Vote", value: Vote.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Vote.typeUrl)) { + return; + } + WeightedVoteOption.registerTypeUrl(); } }; function createBaseDepositParams(): DepositParams { @@ -1249,6 +1316,15 @@ function createBaseDepositParams(): DepositParams { export const DepositParams = { typeUrl: "/cosmos.gov.v1.DepositParams", aminoType: "cosmos-sdk/v1/DepositParams", + is(o: any): o is DepositParams { + return o && (o.$typeUrl === DepositParams.typeUrl || Array.isArray(o.minDeposit) && (!o.minDeposit.length || Coin.is(o.minDeposit[0]))); + }, + isSDK(o: any): o is DepositParamsSDKType { + return o && (o.$typeUrl === DepositParams.typeUrl || Array.isArray(o.min_deposit) && (!o.min_deposit.length || Coin.isSDK(o.min_deposit[0]))); + }, + isAmino(o: any): o is DepositParamsAmino { + return o && (o.$typeUrl === DepositParams.typeUrl || Array.isArray(o.min_deposit) && (!o.min_deposit.length || Coin.isAmino(o.min_deposit[0]))); + }, encode(message: DepositParams, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.minDeposit) { Coin.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -1337,6 +1413,12 @@ export const DepositParams = { typeUrl: "/cosmos.gov.v1.DepositParams", value: DepositParams.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(DepositParams.typeUrl)) { + return; + } + Coin.registerTypeUrl(); } }; function createBaseVotingParams(): VotingParams { @@ -1353,6 +1435,15 @@ function createBaseVotingParams(): VotingParams { export const VotingParams = { typeUrl: "/cosmos.gov.v1.VotingParams", aminoType: "cosmos-sdk/v1/VotingParams", + is(o: any): o is VotingParams { + return o && o.$typeUrl === VotingParams.typeUrl; + }, + isSDK(o: any): o is VotingParamsSDKType { + return o && o.$typeUrl === VotingParams.typeUrl; + }, + isAmino(o: any): o is VotingParamsAmino { + return o && o.$typeUrl === VotingParams.typeUrl; + }, encode(message: VotingParams, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.votingPeriod !== undefined) { Duration.encode(message.votingPeriod, writer.uint32(10).fork()).ldelim(); @@ -1421,7 +1512,8 @@ export const VotingParams = { typeUrl: "/cosmos.gov.v1.VotingParams", value: VotingParams.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseTallyParams(): TallyParams { return { @@ -1439,6 +1531,15 @@ function createBaseTallyParams(): TallyParams { export const TallyParams = { typeUrl: "/cosmos.gov.v1.TallyParams", aminoType: "cosmos-sdk/v1/TallyParams", + is(o: any): o is TallyParams { + return o && (o.$typeUrl === TallyParams.typeUrl || typeof o.quorum === "string" && typeof o.threshold === "string" && typeof o.vetoThreshold === "string"); + }, + isSDK(o: any): o is TallyParamsSDKType { + return o && (o.$typeUrl === TallyParams.typeUrl || typeof o.quorum === "string" && typeof o.threshold === "string" && typeof o.veto_threshold === "string"); + }, + isAmino(o: any): o is TallyParamsAmino { + return o && (o.$typeUrl === TallyParams.typeUrl || typeof o.quorum === "string" && typeof o.threshold === "string" && typeof o.veto_threshold === "string"); + }, encode(message: TallyParams, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.quorum !== "") { writer.uint32(10).string(message.quorum); @@ -1533,5 +1634,6 @@ export const TallyParams = { typeUrl: "/cosmos.gov.v1.TallyParams", value: TallyParams.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/cosmos/gov/v1/query.rpc.func.ts b/__fixtures__/v-next/outputv3/cosmos/gov/v1/query.rpc.func.ts new file mode 100644 index 0000000000..2b58ecf424 --- /dev/null +++ b/__fixtures__/v-next/outputv3/cosmos/gov/v1/query.rpc.func.ts @@ -0,0 +1,108 @@ +import { ProposalStatus, ProposalStatusSDKType, Proposal, ProposalSDKType, Vote, VoteSDKType, VotingParams, VotingParamsSDKType, DepositParams, DepositParamsSDKType, TallyParams, TallyParamsSDKType, Deposit, DepositSDKType, TallyResult, TallyResultSDKType } from "./gov"; +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +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"; +/** + * Proposal queries proposal details based on ProposalID. + * @name getProposal + * @package cosmos.gov.v1 + * @see proto service: cosmos.gov.v1.Proposal + */ +export const getProposal = buildQuery({ + encode: QueryProposalRequest.encode, + decode: QueryProposalResponse.decode, + service: "cosmos.gov.v1.Query", + method: "Proposal", + deps: [QueryProposalRequest, QueryProposalResponse] +}); +/** + * Proposals queries all proposals based on given status. + * @name getProposals + * @package cosmos.gov.v1 + * @see proto service: cosmos.gov.v1.Proposals + */ +export const getProposals = buildQuery({ + encode: QueryProposalsRequest.encode, + decode: QueryProposalsResponse.decode, + service: "cosmos.gov.v1.Query", + method: "Proposals", + deps: [QueryProposalsRequest, QueryProposalsResponse] +}); +/** + * Vote queries voted information based on proposalID, voterAddr. + * @name getVote + * @package cosmos.gov.v1 + * @see proto service: cosmos.gov.v1.Vote + */ +export const getVote = buildQuery({ + encode: QueryVoteRequest.encode, + decode: QueryVoteResponse.decode, + service: "cosmos.gov.v1.Query", + method: "Vote", + deps: [QueryVoteRequest, QueryVoteResponse] +}); +/** + * Votes queries votes of a given proposal. + * @name getVotes + * @package cosmos.gov.v1 + * @see proto service: cosmos.gov.v1.Votes + */ +export const getVotes = buildQuery({ + encode: QueryVotesRequest.encode, + decode: QueryVotesResponse.decode, + service: "cosmos.gov.v1.Query", + method: "Votes", + deps: [QueryVotesRequest, QueryVotesResponse] +}); +/** + * Params queries all parameters of the gov module. + * @name getParams + * @package cosmos.gov.v1 + * @see proto service: cosmos.gov.v1.Params + */ +export const getParams = buildQuery({ + encode: QueryParamsRequest.encode, + decode: QueryParamsResponse.decode, + service: "cosmos.gov.v1.Query", + method: "Params", + deps: [QueryParamsRequest, QueryParamsResponse] +}); +/** + * Deposit queries single deposit information based proposalID, depositAddr. + * @name getDeposit + * @package cosmos.gov.v1 + * @see proto service: cosmos.gov.v1.Deposit + */ +export const getDeposit = buildQuery({ + encode: QueryDepositRequest.encode, + decode: QueryDepositResponse.decode, + service: "cosmos.gov.v1.Query", + method: "Deposit", + deps: [QueryDepositRequest, QueryDepositResponse] +}); +/** + * Deposits queries all deposits of a single proposal. + * @name getDeposits + * @package cosmos.gov.v1 + * @see proto service: cosmos.gov.v1.Deposits + */ +export const getDeposits = buildQuery({ + encode: QueryDepositsRequest.encode, + decode: QueryDepositsResponse.decode, + service: "cosmos.gov.v1.Query", + method: "Deposits", + deps: [QueryDepositsRequest, QueryDepositsResponse] +}); +/** + * TallyResult queries the tally of a proposal vote. + * @name getTallyResult + * @package cosmos.gov.v1 + * @see proto service: cosmos.gov.v1.TallyResult + */ +export const getTallyResult = buildQuery({ + encode: QueryTallyResultRequest.encode, + decode: QueryTallyResultResponse.decode, + service: "cosmos.gov.v1.Query", + method: "TallyResult", + deps: [QueryTallyResultRequest, QueryTallyResultResponse] +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/cosmos/gov/v1/query.ts b/__fixtures__/v-next/outputv3/cosmos/gov/v1/query.ts index 2e3c49fb67..2fb74f5d1e 100644 --- a/__fixtures__/v-next/outputv3/cosmos/gov/v1/query.ts +++ b/__fixtures__/v-next/outputv3/cosmos/gov/v1/query.ts @@ -2,6 +2,7 @@ import { ProposalStatus, ProposalStatusSDKType, Proposal, ProposalAmino, Proposa import { PageRequest, PageRequestAmino, PageRequestSDKType, PageResponse, PageResponseAmino, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { isSet, DeepPartial } from "../../../helpers"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "cosmos.gov.v1"; /** * QueryProposalRequest is the request type for the Query/Proposal RPC method. @@ -704,6 +705,15 @@ function createBaseQueryProposalRequest(): QueryProposalRequest { export const QueryProposalRequest = { typeUrl: "/cosmos.gov.v1.QueryProposalRequest", aminoType: "cosmos-sdk/v1/QueryProposalRequest", + is(o: any): o is QueryProposalRequest { + return o && (o.$typeUrl === QueryProposalRequest.typeUrl || typeof o.proposalId === "bigint"); + }, + isSDK(o: any): o is QueryProposalRequestSDKType { + return o && (o.$typeUrl === QueryProposalRequest.typeUrl || typeof o.proposal_id === "bigint"); + }, + isAmino(o: any): o is QueryProposalRequestAmino { + return o && (o.$typeUrl === QueryProposalRequest.typeUrl || typeof o.proposal_id === "bigint"); + }, encode(message: QueryProposalRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.proposalId !== BigInt(0)) { writer.uint32(8).uint64(message.proposalId); @@ -772,7 +782,8 @@ export const QueryProposalRequest = { typeUrl: "/cosmos.gov.v1.QueryProposalRequest", value: QueryProposalRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryProposalResponse(): QueryProposalResponse { return { @@ -788,6 +799,15 @@ function createBaseQueryProposalResponse(): QueryProposalResponse { export const QueryProposalResponse = { typeUrl: "/cosmos.gov.v1.QueryProposalResponse", aminoType: "cosmos-sdk/v1/QueryProposalResponse", + is(o: any): o is QueryProposalResponse { + return o && o.$typeUrl === QueryProposalResponse.typeUrl; + }, + isSDK(o: any): o is QueryProposalResponseSDKType { + return o && o.$typeUrl === QueryProposalResponse.typeUrl; + }, + isAmino(o: any): o is QueryProposalResponseAmino { + return o && o.$typeUrl === QueryProposalResponse.typeUrl; + }, encode(message: QueryProposalResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.proposal !== undefined) { Proposal.encode(message.proposal, writer.uint32(10).fork()).ldelim(); @@ -856,6 +876,12 @@ export const QueryProposalResponse = { typeUrl: "/cosmos.gov.v1.QueryProposalResponse", value: QueryProposalResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryProposalResponse.typeUrl)) { + return; + } + Proposal.registerTypeUrl(); } }; function createBaseQueryProposalsRequest(): QueryProposalsRequest { @@ -875,6 +901,15 @@ function createBaseQueryProposalsRequest(): QueryProposalsRequest { export const QueryProposalsRequest = { typeUrl: "/cosmos.gov.v1.QueryProposalsRequest", aminoType: "cosmos-sdk/v1/QueryProposalsRequest", + is(o: any): o is QueryProposalsRequest { + return o && (o.$typeUrl === QueryProposalsRequest.typeUrl || isSet(o.proposalStatus) && typeof o.voter === "string" && typeof o.depositor === "string"); + }, + isSDK(o: any): o is QueryProposalsRequestSDKType { + return o && (o.$typeUrl === QueryProposalsRequest.typeUrl || isSet(o.proposal_status) && typeof o.voter === "string" && typeof o.depositor === "string"); + }, + isAmino(o: any): o is QueryProposalsRequestAmino { + return o && (o.$typeUrl === QueryProposalsRequest.typeUrl || isSet(o.proposal_status) && typeof o.voter === "string" && typeof o.depositor === "string"); + }, encode(message: QueryProposalsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.proposalStatus !== 0) { writer.uint32(8).int32(message.proposalStatus); @@ -985,6 +1020,12 @@ export const QueryProposalsRequest = { typeUrl: "/cosmos.gov.v1.QueryProposalsRequest", value: QueryProposalsRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryProposalsRequest.typeUrl)) { + return; + } + PageRequest.registerTypeUrl(); } }; function createBaseQueryProposalsResponse(): QueryProposalsResponse { @@ -1003,6 +1044,15 @@ function createBaseQueryProposalsResponse(): QueryProposalsResponse { export const QueryProposalsResponse = { typeUrl: "/cosmos.gov.v1.QueryProposalsResponse", aminoType: "cosmos-sdk/v1/QueryProposalsResponse", + is(o: any): o is QueryProposalsResponse { + return o && (o.$typeUrl === QueryProposalsResponse.typeUrl || Array.isArray(o.proposals) && (!o.proposals.length || Proposal.is(o.proposals[0]))); + }, + isSDK(o: any): o is QueryProposalsResponseSDKType { + return o && (o.$typeUrl === QueryProposalsResponse.typeUrl || Array.isArray(o.proposals) && (!o.proposals.length || Proposal.isSDK(o.proposals[0]))); + }, + isAmino(o: any): o is QueryProposalsResponseAmino { + return o && (o.$typeUrl === QueryProposalsResponse.typeUrl || Array.isArray(o.proposals) && (!o.proposals.length || Proposal.isAmino(o.proposals[0]))); + }, encode(message: QueryProposalsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.proposals) { Proposal.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -1091,6 +1141,13 @@ export const QueryProposalsResponse = { typeUrl: "/cosmos.gov.v1.QueryProposalsResponse", value: QueryProposalsResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryProposalsResponse.typeUrl)) { + return; + } + Proposal.registerTypeUrl(); + PageResponse.registerTypeUrl(); } }; function createBaseQueryVoteRequest(): QueryVoteRequest { @@ -1108,6 +1165,15 @@ function createBaseQueryVoteRequest(): QueryVoteRequest { export const QueryVoteRequest = { typeUrl: "/cosmos.gov.v1.QueryVoteRequest", aminoType: "cosmos-sdk/v1/QueryVoteRequest", + is(o: any): o is QueryVoteRequest { + return o && (o.$typeUrl === QueryVoteRequest.typeUrl || typeof o.proposalId === "bigint" && typeof o.voter === "string"); + }, + isSDK(o: any): o is QueryVoteRequestSDKType { + return o && (o.$typeUrl === QueryVoteRequest.typeUrl || typeof o.proposal_id === "bigint" && typeof o.voter === "string"); + }, + isAmino(o: any): o is QueryVoteRequestAmino { + return o && (o.$typeUrl === QueryVoteRequest.typeUrl || typeof o.proposal_id === "bigint" && typeof o.voter === "string"); + }, encode(message: QueryVoteRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.proposalId !== BigInt(0)) { writer.uint32(8).uint64(message.proposalId); @@ -1190,7 +1256,8 @@ export const QueryVoteRequest = { typeUrl: "/cosmos.gov.v1.QueryVoteRequest", value: QueryVoteRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryVoteResponse(): QueryVoteResponse { return { @@ -1206,6 +1273,15 @@ function createBaseQueryVoteResponse(): QueryVoteResponse { export const QueryVoteResponse = { typeUrl: "/cosmos.gov.v1.QueryVoteResponse", aminoType: "cosmos-sdk/v1/QueryVoteResponse", + is(o: any): o is QueryVoteResponse { + return o && o.$typeUrl === QueryVoteResponse.typeUrl; + }, + isSDK(o: any): o is QueryVoteResponseSDKType { + return o && o.$typeUrl === QueryVoteResponse.typeUrl; + }, + isAmino(o: any): o is QueryVoteResponseAmino { + return o && o.$typeUrl === QueryVoteResponse.typeUrl; + }, encode(message: QueryVoteResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.vote !== undefined) { Vote.encode(message.vote, writer.uint32(10).fork()).ldelim(); @@ -1274,6 +1350,12 @@ export const QueryVoteResponse = { typeUrl: "/cosmos.gov.v1.QueryVoteResponse", value: QueryVoteResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryVoteResponse.typeUrl)) { + return; + } + Vote.registerTypeUrl(); } }; function createBaseQueryVotesRequest(): QueryVotesRequest { @@ -1291,6 +1373,15 @@ function createBaseQueryVotesRequest(): QueryVotesRequest { export const QueryVotesRequest = { typeUrl: "/cosmos.gov.v1.QueryVotesRequest", aminoType: "cosmos-sdk/v1/QueryVotesRequest", + is(o: any): o is QueryVotesRequest { + return o && (o.$typeUrl === QueryVotesRequest.typeUrl || typeof o.proposalId === "bigint"); + }, + isSDK(o: any): o is QueryVotesRequestSDKType { + return o && (o.$typeUrl === QueryVotesRequest.typeUrl || typeof o.proposal_id === "bigint"); + }, + isAmino(o: any): o is QueryVotesRequestAmino { + return o && (o.$typeUrl === QueryVotesRequest.typeUrl || typeof o.proposal_id === "bigint"); + }, encode(message: QueryVotesRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.proposalId !== BigInt(0)) { writer.uint32(8).uint64(message.proposalId); @@ -1375,6 +1466,12 @@ export const QueryVotesRequest = { typeUrl: "/cosmos.gov.v1.QueryVotesRequest", value: QueryVotesRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryVotesRequest.typeUrl)) { + return; + } + PageRequest.registerTypeUrl(); } }; function createBaseQueryVotesResponse(): QueryVotesResponse { @@ -1392,6 +1489,15 @@ function createBaseQueryVotesResponse(): QueryVotesResponse { export const QueryVotesResponse = { typeUrl: "/cosmos.gov.v1.QueryVotesResponse", aminoType: "cosmos-sdk/v1/QueryVotesResponse", + is(o: any): o is QueryVotesResponse { + return o && (o.$typeUrl === QueryVotesResponse.typeUrl || Array.isArray(o.votes) && (!o.votes.length || Vote.is(o.votes[0]))); + }, + isSDK(o: any): o is QueryVotesResponseSDKType { + return o && (o.$typeUrl === QueryVotesResponse.typeUrl || Array.isArray(o.votes) && (!o.votes.length || Vote.isSDK(o.votes[0]))); + }, + isAmino(o: any): o is QueryVotesResponseAmino { + return o && (o.$typeUrl === QueryVotesResponse.typeUrl || Array.isArray(o.votes) && (!o.votes.length || Vote.isAmino(o.votes[0]))); + }, encode(message: QueryVotesResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.votes) { Vote.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -1480,6 +1586,13 @@ export const QueryVotesResponse = { typeUrl: "/cosmos.gov.v1.QueryVotesResponse", value: QueryVotesResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryVotesResponse.typeUrl)) { + return; + } + Vote.registerTypeUrl(); + PageResponse.registerTypeUrl(); } }; function createBaseQueryParamsRequest(): QueryParamsRequest { @@ -1496,6 +1609,15 @@ function createBaseQueryParamsRequest(): QueryParamsRequest { export const QueryParamsRequest = { typeUrl: "/cosmos.gov.v1.QueryParamsRequest", aminoType: "cosmos-sdk/v1/QueryParamsRequest", + is(o: any): o is QueryParamsRequest { + return o && (o.$typeUrl === QueryParamsRequest.typeUrl || typeof o.paramsType === "string"); + }, + isSDK(o: any): o is QueryParamsRequestSDKType { + return o && (o.$typeUrl === QueryParamsRequest.typeUrl || typeof o.params_type === "string"); + }, + isAmino(o: any): o is QueryParamsRequestAmino { + return o && (o.$typeUrl === QueryParamsRequest.typeUrl || typeof o.params_type === "string"); + }, encode(message: QueryParamsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.paramsType !== "") { writer.uint32(10).string(message.paramsType); @@ -1562,7 +1684,8 @@ export const QueryParamsRequest = { typeUrl: "/cosmos.gov.v1.QueryParamsRequest", value: QueryParamsRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryParamsResponse(): QueryParamsResponse { return { @@ -1580,6 +1703,15 @@ function createBaseQueryParamsResponse(): QueryParamsResponse { export const QueryParamsResponse = { typeUrl: "/cosmos.gov.v1.QueryParamsResponse", aminoType: "cosmos-sdk/v1/QueryParamsResponse", + is(o: any): o is QueryParamsResponse { + return o && o.$typeUrl === QueryParamsResponse.typeUrl; + }, + isSDK(o: any): o is QueryParamsResponseSDKType { + return o && o.$typeUrl === QueryParamsResponse.typeUrl; + }, + isAmino(o: any): o is QueryParamsResponseAmino { + return o && o.$typeUrl === QueryParamsResponse.typeUrl; + }, encode(message: QueryParamsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.votingParams !== undefined) { VotingParams.encode(message.votingParams, writer.uint32(10).fork()).ldelim(); @@ -1680,6 +1812,14 @@ export const QueryParamsResponse = { typeUrl: "/cosmos.gov.v1.QueryParamsResponse", value: QueryParamsResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryParamsResponse.typeUrl)) { + return; + } + VotingParams.registerTypeUrl(); + DepositParams.registerTypeUrl(); + TallyParams.registerTypeUrl(); } }; function createBaseQueryDepositRequest(): QueryDepositRequest { @@ -1697,6 +1837,15 @@ function createBaseQueryDepositRequest(): QueryDepositRequest { export const QueryDepositRequest = { typeUrl: "/cosmos.gov.v1.QueryDepositRequest", aminoType: "cosmos-sdk/v1/QueryDepositRequest", + is(o: any): o is QueryDepositRequest { + return o && (o.$typeUrl === QueryDepositRequest.typeUrl || typeof o.proposalId === "bigint" && typeof o.depositor === "string"); + }, + isSDK(o: any): o is QueryDepositRequestSDKType { + return o && (o.$typeUrl === QueryDepositRequest.typeUrl || typeof o.proposal_id === "bigint" && typeof o.depositor === "string"); + }, + isAmino(o: any): o is QueryDepositRequestAmino { + return o && (o.$typeUrl === QueryDepositRequest.typeUrl || typeof o.proposal_id === "bigint" && typeof o.depositor === "string"); + }, encode(message: QueryDepositRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.proposalId !== BigInt(0)) { writer.uint32(8).uint64(message.proposalId); @@ -1779,7 +1928,8 @@ export const QueryDepositRequest = { typeUrl: "/cosmos.gov.v1.QueryDepositRequest", value: QueryDepositRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryDepositResponse(): QueryDepositResponse { return { @@ -1795,6 +1945,15 @@ function createBaseQueryDepositResponse(): QueryDepositResponse { export const QueryDepositResponse = { typeUrl: "/cosmos.gov.v1.QueryDepositResponse", aminoType: "cosmos-sdk/v1/QueryDepositResponse", + is(o: any): o is QueryDepositResponse { + return o && o.$typeUrl === QueryDepositResponse.typeUrl; + }, + isSDK(o: any): o is QueryDepositResponseSDKType { + return o && o.$typeUrl === QueryDepositResponse.typeUrl; + }, + isAmino(o: any): o is QueryDepositResponseAmino { + return o && o.$typeUrl === QueryDepositResponse.typeUrl; + }, encode(message: QueryDepositResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.deposit !== undefined) { Deposit.encode(message.deposit, writer.uint32(10).fork()).ldelim(); @@ -1863,6 +2022,12 @@ export const QueryDepositResponse = { typeUrl: "/cosmos.gov.v1.QueryDepositResponse", value: QueryDepositResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryDepositResponse.typeUrl)) { + return; + } + Deposit.registerTypeUrl(); } }; function createBaseQueryDepositsRequest(): QueryDepositsRequest { @@ -1880,6 +2045,15 @@ function createBaseQueryDepositsRequest(): QueryDepositsRequest { export const QueryDepositsRequest = { typeUrl: "/cosmos.gov.v1.QueryDepositsRequest", aminoType: "cosmos-sdk/v1/QueryDepositsRequest", + is(o: any): o is QueryDepositsRequest { + return o && (o.$typeUrl === QueryDepositsRequest.typeUrl || typeof o.proposalId === "bigint"); + }, + isSDK(o: any): o is QueryDepositsRequestSDKType { + return o && (o.$typeUrl === QueryDepositsRequest.typeUrl || typeof o.proposal_id === "bigint"); + }, + isAmino(o: any): o is QueryDepositsRequestAmino { + return o && (o.$typeUrl === QueryDepositsRequest.typeUrl || typeof o.proposal_id === "bigint"); + }, encode(message: QueryDepositsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.proposalId !== BigInt(0)) { writer.uint32(8).uint64(message.proposalId); @@ -1964,6 +2138,12 @@ export const QueryDepositsRequest = { typeUrl: "/cosmos.gov.v1.QueryDepositsRequest", value: QueryDepositsRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryDepositsRequest.typeUrl)) { + return; + } + PageRequest.registerTypeUrl(); } }; function createBaseQueryDepositsResponse(): QueryDepositsResponse { @@ -1981,6 +2161,15 @@ function createBaseQueryDepositsResponse(): QueryDepositsResponse { export const QueryDepositsResponse = { typeUrl: "/cosmos.gov.v1.QueryDepositsResponse", aminoType: "cosmos-sdk/v1/QueryDepositsResponse", + is(o: any): o is QueryDepositsResponse { + return o && (o.$typeUrl === QueryDepositsResponse.typeUrl || Array.isArray(o.deposits) && (!o.deposits.length || Deposit.is(o.deposits[0]))); + }, + isSDK(o: any): o is QueryDepositsResponseSDKType { + return o && (o.$typeUrl === QueryDepositsResponse.typeUrl || Array.isArray(o.deposits) && (!o.deposits.length || Deposit.isSDK(o.deposits[0]))); + }, + isAmino(o: any): o is QueryDepositsResponseAmino { + return o && (o.$typeUrl === QueryDepositsResponse.typeUrl || Array.isArray(o.deposits) && (!o.deposits.length || Deposit.isAmino(o.deposits[0]))); + }, encode(message: QueryDepositsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.deposits) { Deposit.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -2069,6 +2258,13 @@ export const QueryDepositsResponse = { typeUrl: "/cosmos.gov.v1.QueryDepositsResponse", value: QueryDepositsResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryDepositsResponse.typeUrl)) { + return; + } + Deposit.registerTypeUrl(); + PageResponse.registerTypeUrl(); } }; function createBaseQueryTallyResultRequest(): QueryTallyResultRequest { @@ -2085,6 +2281,15 @@ function createBaseQueryTallyResultRequest(): QueryTallyResultRequest { export const QueryTallyResultRequest = { typeUrl: "/cosmos.gov.v1.QueryTallyResultRequest", aminoType: "cosmos-sdk/v1/QueryTallyResultRequest", + is(o: any): o is QueryTallyResultRequest { + return o && (o.$typeUrl === QueryTallyResultRequest.typeUrl || typeof o.proposalId === "bigint"); + }, + isSDK(o: any): o is QueryTallyResultRequestSDKType { + return o && (o.$typeUrl === QueryTallyResultRequest.typeUrl || typeof o.proposal_id === "bigint"); + }, + isAmino(o: any): o is QueryTallyResultRequestAmino { + return o && (o.$typeUrl === QueryTallyResultRequest.typeUrl || typeof o.proposal_id === "bigint"); + }, encode(message: QueryTallyResultRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.proposalId !== BigInt(0)) { writer.uint32(8).uint64(message.proposalId); @@ -2153,7 +2358,8 @@ export const QueryTallyResultRequest = { typeUrl: "/cosmos.gov.v1.QueryTallyResultRequest", value: QueryTallyResultRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryTallyResultResponse(): QueryTallyResultResponse { return { @@ -2169,6 +2375,15 @@ function createBaseQueryTallyResultResponse(): QueryTallyResultResponse { export const QueryTallyResultResponse = { typeUrl: "/cosmos.gov.v1.QueryTallyResultResponse", aminoType: "cosmos-sdk/v1/QueryTallyResultResponse", + is(o: any): o is QueryTallyResultResponse { + return o && o.$typeUrl === QueryTallyResultResponse.typeUrl; + }, + isSDK(o: any): o is QueryTallyResultResponseSDKType { + return o && o.$typeUrl === QueryTallyResultResponse.typeUrl; + }, + isAmino(o: any): o is QueryTallyResultResponseAmino { + return o && o.$typeUrl === QueryTallyResultResponse.typeUrl; + }, encode(message: QueryTallyResultResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.tally !== undefined) { TallyResult.encode(message.tally, writer.uint32(10).fork()).ldelim(); @@ -2237,5 +2452,11 @@ export const QueryTallyResultResponse = { typeUrl: "/cosmos.gov.v1.QueryTallyResultResponse", value: QueryTallyResultResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryTallyResultResponse.typeUrl)) { + return; + } + TallyResult.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/cosmos/gov/v1/tx.registry.ts b/__fixtures__/v-next/outputv3/cosmos/gov/v1/tx.registry.ts index afb3cfcd33..c182aae898 100644 --- a/__fixtures__/v-next/outputv3/cosmos/gov/v1/tx.registry.ts +++ b/__fixtures__/v-next/outputv3/cosmos/gov/v1/tx.registry.ts @@ -7,14 +7,9 @@ import { ClientUpdateProposal, ClientUpdateProposalSDKType, UpgradeProposal, Upg import { ReplacePoolIncentivesProposal, ReplacePoolIncentivesProposalSDKType, UpdatePoolIncentivesProposal, UpdatePoolIncentivesProposalSDKType } from "../../../osmosis/pool-incentives/v1beta1/gov"; import { SetSuperfluidAssetsProposal, SetSuperfluidAssetsProposalSDKType, RemoveSuperfluidAssetsProposal, RemoveSuperfluidAssetsProposalSDKType, UpdateUnpoolWhiteListProposal, UpdateUnpoolWhiteListProposalSDKType } from "../../../osmosis/superfluid/v1beta1/gov"; import { UpdateFeeTokenProposal, UpdateFeeTokenProposalSDKType } from "../../../osmosis/txfees/v1beta1/gov"; -import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { TelescopeGeneratedType } from "../../../types"; import { MsgSubmitProposal, MsgSubmitProposalSDKType, MsgExecLegacyContent, MsgExecLegacyContentSDKType, MsgVote, MsgVoteSDKType, MsgVoteWeighted, MsgVoteWeightedSDKType, MsgDeposit, MsgDepositSDKType } from "./tx"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/cosmos.gov.v1.MsgSubmitProposal", MsgSubmitProposal], ["/cosmos.gov.v1.MsgExecLegacyContent", MsgExecLegacyContent], ["/cosmos.gov.v1.MsgVote", MsgVote], ["/cosmos.gov.v1.MsgVoteWeighted", MsgVoteWeighted], ["/cosmos.gov.v1.MsgDeposit", MsgDeposit]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/cosmos.gov.v1.MsgSubmitProposal", MsgSubmitProposal], ["/cosmos.gov.v1.MsgExecLegacyContent", MsgExecLegacyContent], ["/cosmos.gov.v1.MsgVote", MsgVote], ["/cosmos.gov.v1.MsgVoteWeighted", MsgVoteWeighted], ["/cosmos.gov.v1.MsgDeposit", MsgDeposit]]; export const MessageComposer = { encoded: { submitProposal(value: MsgSubmitProposal) { diff --git a/__fixtures__/v-next/outputv3/cosmos/gov/v1/tx.rpc.func.ts b/__fixtures__/v-next/outputv3/cosmos/gov/v1/tx.rpc.func.ts new file mode 100644 index 0000000000..07723594b5 --- /dev/null +++ b/__fixtures__/v-next/outputv3/cosmos/gov/v1/tx.rpc.func.ts @@ -0,0 +1,57 @@ +import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../google/protobuf/any"; +import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; +import { VoteOption, VoteOptionSDKType, WeightedVoteOption, WeightedVoteOptionSDKType } from "./gov"; +import { TextProposal, TextProposalSDKType } from "../v1beta1/gov"; +import { RegisterIncentiveProposal, RegisterIncentiveProposalSDKType } from "../../../evmos/incentives/v1/incentives"; +import { ClientUpdateProposal, ClientUpdateProposalSDKType, UpgradeProposal, UpgradeProposalSDKType } from "../../../ibc/core/client/v1/client"; +import { ReplacePoolIncentivesProposal, ReplacePoolIncentivesProposalSDKType, UpdatePoolIncentivesProposal, UpdatePoolIncentivesProposalSDKType } from "../../../osmosis/pool-incentives/v1beta1/gov"; +import { SetSuperfluidAssetsProposal, SetSuperfluidAssetsProposalSDKType, RemoveSuperfluidAssetsProposal, RemoveSuperfluidAssetsProposalSDKType, UpdateUnpoolWhiteListProposal, UpdateUnpoolWhiteListProposalSDKType } from "../../../osmosis/superfluid/v1beta1/gov"; +import { UpdateFeeTokenProposal, UpdateFeeTokenProposalSDKType } from "../../../osmosis/txfees/v1beta1/gov"; +import { buildTx } from "../../../helper-func-types"; +import { MsgSubmitProposal, MsgSubmitProposalSDKType, MsgSubmitProposalResponse, MsgSubmitProposalResponseSDKType, MsgExecLegacyContent, MsgExecLegacyContentSDKType, MsgExecLegacyContentResponse, MsgExecLegacyContentResponseSDKType, MsgVote, MsgVoteSDKType, MsgVoteResponse, MsgVoteResponseSDKType, MsgVoteWeighted, MsgVoteWeightedSDKType, MsgVoteWeightedResponse, MsgVoteWeightedResponseSDKType, MsgDeposit, MsgDepositSDKType, MsgDepositResponse, MsgDepositResponseSDKType } from "./tx"; +/** + * SubmitProposal defines a method to create new proposal given a content. + * @name submitProposal + * @package cosmos.gov.v1 + * @see proto service: cosmos.gov.v1.SubmitProposal + */ +export const submitProposal = buildTx({ + msg: MsgSubmitProposal +}); +/** + * ExecLegacyContent defines a Msg to be in included in a MsgSubmitProposal + * to execute a legacy content-based proposal. + * @name execLegacyContent + * @package cosmos.gov.v1 + * @see proto service: cosmos.gov.v1.ExecLegacyContent + */ +export const execLegacyContent = buildTx({ + msg: MsgExecLegacyContent +}); +/** + * Vote defines a method to add a vote on a specific proposal. + * @name vote + * @package cosmos.gov.v1 + * @see proto service: cosmos.gov.v1.Vote + */ +export const vote = buildTx({ + msg: MsgVote +}); +/** + * VoteWeighted defines a method to add a weighted vote on a specific proposal. + * @name voteWeighted + * @package cosmos.gov.v1 + * @see proto service: cosmos.gov.v1.VoteWeighted + */ +export const voteWeighted = buildTx({ + msg: MsgVoteWeighted +}); +/** + * Deposit defines a method to add deposit on a specific proposal. + * @name deposit + * @package cosmos.gov.v1 + * @see proto service: cosmos.gov.v1.Deposit + */ +export const deposit = buildTx({ + msg: MsgDeposit +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/cosmos/gov/v1/tx.ts b/__fixtures__/v-next/outputv3/cosmos/gov/v1/tx.ts index 97c65d56c3..2e4eaa2251 100644 --- a/__fixtures__/v-next/outputv3/cosmos/gov/v1/tx.ts +++ b/__fixtures__/v-next/outputv3/cosmos/gov/v1/tx.ts @@ -9,6 +9,7 @@ import { SetSuperfluidAssetsProposal, SetSuperfluidAssetsProposalProtoMsg, SetSu import { UpdateFeeTokenProposal, UpdateFeeTokenProposalProtoMsg, UpdateFeeTokenProposalSDKType } from "../../../osmosis/txfees/v1beta1/gov"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { isSet, DeepPartial } from "../../../helpers"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "cosmos.gov.v1"; /** * MsgSubmitProposal defines an sdk.Msg type that supports submitting arbitrary @@ -383,9 +384,18 @@ function createBaseMsgSubmitProposal(): MsgSubmitProposal { export const MsgSubmitProposal = { typeUrl: "/cosmos.gov.v1.MsgSubmitProposal", aminoType: "cosmos-sdk/v1/MsgSubmitProposal", + is(o: any): o is MsgSubmitProposal { + return o && (o.$typeUrl === MsgSubmitProposal.typeUrl || Array.isArray(o.messages) && (!o.messages.length || TextProposal.is(o.messages[0]) || RegisterIncentiveProposal.is(o.messages[0]) || ClientUpdateProposal.is(o.messages[0]) || UpgradeProposal.is(o.messages[0]) || ReplacePoolIncentivesProposal.is(o.messages[0]) || UpdatePoolIncentivesProposal.is(o.messages[0]) || SetSuperfluidAssetsProposal.is(o.messages[0]) || RemoveSuperfluidAssetsProposal.is(o.messages[0]) || UpdateUnpoolWhiteListProposal.is(o.messages[0]) || UpdateFeeTokenProposal.is(o.messages[0]) || Any.is(o.messages[0])) && Array.isArray(o.initialDeposit) && (!o.initialDeposit.length || Coin.is(o.initialDeposit[0])) && typeof o.proposer === "string" && typeof o.metadata === "string"); + }, + isSDK(o: any): o is MsgSubmitProposalSDKType { + return o && (o.$typeUrl === MsgSubmitProposal.typeUrl || Array.isArray(o.messages) && (!o.messages.length || TextProposal.isSDK(o.messages[0]) || RegisterIncentiveProposal.isSDK(o.messages[0]) || ClientUpdateProposal.isSDK(o.messages[0]) || UpgradeProposal.isSDK(o.messages[0]) || ReplacePoolIncentivesProposal.isSDK(o.messages[0]) || UpdatePoolIncentivesProposal.isSDK(o.messages[0]) || SetSuperfluidAssetsProposal.isSDK(o.messages[0]) || RemoveSuperfluidAssetsProposal.isSDK(o.messages[0]) || UpdateUnpoolWhiteListProposal.isSDK(o.messages[0]) || UpdateFeeTokenProposal.isSDK(o.messages[0]) || Any.isSDK(o.messages[0])) && Array.isArray(o.initial_deposit) && (!o.initial_deposit.length || Coin.isSDK(o.initial_deposit[0])) && typeof o.proposer === "string" && typeof o.metadata === "string"); + }, + isAmino(o: any): o is MsgSubmitProposalAmino { + return o && (o.$typeUrl === MsgSubmitProposal.typeUrl || Array.isArray(o.messages) && (!o.messages.length || TextProposal.isAmino(o.messages[0]) || RegisterIncentiveProposal.isAmino(o.messages[0]) || ClientUpdateProposal.isAmino(o.messages[0]) || UpgradeProposal.isAmino(o.messages[0]) || ReplacePoolIncentivesProposal.isAmino(o.messages[0]) || UpdatePoolIncentivesProposal.isAmino(o.messages[0]) || SetSuperfluidAssetsProposal.isAmino(o.messages[0]) || RemoveSuperfluidAssetsProposal.isAmino(o.messages[0]) || UpdateUnpoolWhiteListProposal.isAmino(o.messages[0]) || UpdateFeeTokenProposal.isAmino(o.messages[0]) || Any.isAmino(o.messages[0])) && Array.isArray(o.initial_deposit) && (!o.initial_deposit.length || Coin.isAmino(o.initial_deposit[0])) && typeof o.proposer === "string" && typeof o.metadata === "string"); + }, encode(message: MsgSubmitProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.messages) { - Any.encode((v! as Any), writer.uint32(10).fork()).ldelim(); + Any.encode(GlobalDecoderRegistry.wrapAny(v!), writer.uint32(10).fork()).ldelim(); } for (const v of message.initialDeposit) { Coin.encode(v!, writer.uint32(18).fork()).ldelim(); @@ -406,7 +416,7 @@ export const MsgSubmitProposal = { const tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.messages.push(useInterfaces ? (ProposalContentI_InterfaceDecoder(reader) as Any) : Any.decode(reader, reader.uint32(), useInterfaces)); + message.messages.push(GlobalDecoderRegistry.unwrapAny(reader)); break; case 2: message.initialDeposit.push(Coin.decode(reader, reader.uint32(), useInterfaces)); @@ -426,7 +436,7 @@ export const MsgSubmitProposal = { }, fromJSON(object: any): MsgSubmitProposal { const obj = createBaseMsgSubmitProposal(); - if (Array.isArray(object?.messages)) obj.messages = object.messages.map((e: any) => Any.fromJSON(e)); + if (Array.isArray(object?.messages)) obj.messages = object.messages.map((e: any) => GlobalDecoderRegistry.fromJSON(e)); if (Array.isArray(object?.initialDeposit)) obj.initialDeposit = object.initialDeposit.map((e: any) => Coin.fromJSON(e)); if (isSet(object.proposer)) obj.proposer = String(object.proposer); if (isSet(object.metadata)) obj.metadata = String(object.metadata); @@ -434,7 +444,7 @@ export const MsgSubmitProposal = { }, fromPartial(object: DeepPartial): MsgSubmitProposal { const message = createBaseMsgSubmitProposal(); - message.messages = object.messages?.map(e => Any.fromPartial(e)) || []; + message.messages = object.messages?.map(e => (GlobalDecoderRegistry.fromPartial(e) as any)) || []; message.initialDeposit = object.initialDeposit?.map(e => Coin.fromPartial(e)) || []; message.proposer = object.proposer ?? ""; message.metadata = object.metadata ?? ""; @@ -442,7 +452,7 @@ export const MsgSubmitProposal = { }, fromSDK(object: MsgSubmitProposalSDKType): MsgSubmitProposal { return { - messages: Array.isArray(object?.messages) ? object.messages.map((e: any) => Any.fromSDK(e)) : [], + messages: Array.isArray(object?.messages) ? object.messages.map((e: any) => GlobalDecoderRegistry.fromSDK(e)) : [], initialDeposit: Array.isArray(object?.initial_deposit) ? object.initial_deposit.map((e: any) => Coin.fromSDK(e)) : [], proposer: object?.proposer, metadata: object?.metadata @@ -451,7 +461,7 @@ export const MsgSubmitProposal = { toSDK(message: MsgSubmitProposal): MsgSubmitProposalSDKType { const obj: any = {}; if (message.messages) { - obj.messages = message.messages.map(e => e ? Any.toSDK(e) : undefined); + obj.messages = message.messages.map(e => e ? GlobalDecoderRegistry.toSDK(e) : undefined); } else { obj.messages = []; } @@ -466,7 +476,7 @@ export const MsgSubmitProposal = { }, fromAmino(object: MsgSubmitProposalAmino): MsgSubmitProposal { const message = createBaseMsgSubmitProposal(); - message.messages = object.messages?.map(e => ProposalContentI_FromAmino(e)) || []; + message.messages = object.messages?.map(e => GlobalDecoderRegistry.fromAminoMsg(e)) || []; message.initialDeposit = object.initial_deposit?.map(e => Coin.fromAmino(e)) || []; if (object.proposer !== undefined && object.proposer !== null) { message.proposer = object.proposer; @@ -479,7 +489,7 @@ export const MsgSubmitProposal = { toAmino(message: MsgSubmitProposal, useInterfaces: boolean = true): MsgSubmitProposalAmino { const obj: any = {}; if (message.messages) { - obj.messages = message.messages.map(e => e ? ProposalContentI_ToAmino((e as Any), useInterfaces) : undefined); + obj.messages = message.messages.map(e => e ? GlobalDecoderRegistry.toAminoMsg(e) : undefined); } else { obj.messages = message.messages; } @@ -503,6 +513,22 @@ export const MsgSubmitProposal = { typeUrl: "/cosmos.gov.v1.MsgSubmitProposal", value: MsgSubmitProposal.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgSubmitProposal.typeUrl)) { + return; + } + TextProposal.registerTypeUrl(); + RegisterIncentiveProposal.registerTypeUrl(); + ClientUpdateProposal.registerTypeUrl(); + UpgradeProposal.registerTypeUrl(); + ReplacePoolIncentivesProposal.registerTypeUrl(); + UpdatePoolIncentivesProposal.registerTypeUrl(); + SetSuperfluidAssetsProposal.registerTypeUrl(); + RemoveSuperfluidAssetsProposal.registerTypeUrl(); + UpdateUnpoolWhiteListProposal.registerTypeUrl(); + UpdateFeeTokenProposal.registerTypeUrl(); + Coin.registerTypeUrl(); } }; function createBaseMsgSubmitProposalResponse(): MsgSubmitProposalResponse { @@ -519,6 +545,15 @@ function createBaseMsgSubmitProposalResponse(): MsgSubmitProposalResponse { export const MsgSubmitProposalResponse = { typeUrl: "/cosmos.gov.v1.MsgSubmitProposalResponse", aminoType: "cosmos-sdk/v1/MsgSubmitProposalResponse", + is(o: any): o is MsgSubmitProposalResponse { + return o && (o.$typeUrl === MsgSubmitProposalResponse.typeUrl || typeof o.proposalId === "bigint"); + }, + isSDK(o: any): o is MsgSubmitProposalResponseSDKType { + return o && (o.$typeUrl === MsgSubmitProposalResponse.typeUrl || typeof o.proposal_id === "bigint"); + }, + isAmino(o: any): o is MsgSubmitProposalResponseAmino { + return o && (o.$typeUrl === MsgSubmitProposalResponse.typeUrl || typeof o.proposal_id === "bigint"); + }, encode(message: MsgSubmitProposalResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.proposalId !== BigInt(0)) { writer.uint32(8).uint64(message.proposalId); @@ -587,7 +622,8 @@ export const MsgSubmitProposalResponse = { typeUrl: "/cosmos.gov.v1.MsgSubmitProposalResponse", value: MsgSubmitProposalResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgExecLegacyContent(): MsgExecLegacyContent { return { @@ -605,9 +641,18 @@ function createBaseMsgExecLegacyContent(): MsgExecLegacyContent { export const MsgExecLegacyContent = { typeUrl: "/cosmos.gov.v1.MsgExecLegacyContent", aminoType: "cosmos-sdk/v1/MsgExecLegacyContent", + is(o: any): o is MsgExecLegacyContent { + return o && (o.$typeUrl === MsgExecLegacyContent.typeUrl || typeof o.authority === "string"); + }, + isSDK(o: any): o is MsgExecLegacyContentSDKType { + return o && (o.$typeUrl === MsgExecLegacyContent.typeUrl || typeof o.authority === "string"); + }, + isAmino(o: any): o is MsgExecLegacyContentAmino { + return o && (o.$typeUrl === MsgExecLegacyContent.typeUrl || typeof o.authority === "string"); + }, encode(message: MsgExecLegacyContent, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.content !== undefined) { - Any.encode((message.content as Any), writer.uint32(10).fork()).ldelim(); + Any.encode(GlobalDecoderRegistry.wrapAny(message.content), writer.uint32(10).fork()).ldelim(); } if (message.authority !== "") { writer.uint32(18).string(message.authority); @@ -622,7 +667,7 @@ export const MsgExecLegacyContent = { const tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.content = useInterfaces ? (ProposalContentI_InterfaceDecoder(reader) as Any) : Any.decode(reader, reader.uint32(), useInterfaces); + message.content = GlobalDecoderRegistry.unwrapAny(reader); break; case 2: message.authority = reader.string(); @@ -636,34 +681,34 @@ export const MsgExecLegacyContent = { }, fromJSON(object: any): MsgExecLegacyContent { const obj = createBaseMsgExecLegacyContent(); - if (isSet(object.content)) obj.content = Any.fromJSON(object.content); + if (isSet(object.content)) obj.content = GlobalDecoderRegistry.fromJSON(object.content); if (isSet(object.authority)) obj.authority = String(object.authority); return obj; }, fromPartial(object: DeepPartial): MsgExecLegacyContent { const message = createBaseMsgExecLegacyContent(); if (object.content !== undefined && object.content !== null) { - message.content = Any.fromPartial(object.content); + message.content = GlobalDecoderRegistry.fromPartial(object.content); } message.authority = object.authority ?? ""; return message; }, fromSDK(object: MsgExecLegacyContentSDKType): MsgExecLegacyContent { return { - content: object.content ? Any.fromSDK(object.content) : undefined, + content: object.content ? GlobalDecoderRegistry.fromSDK(object.content) : undefined, authority: object?.authority }; }, toSDK(message: MsgExecLegacyContent): MsgExecLegacyContentSDKType { const obj: any = {}; - message.content !== undefined && (obj.content = message.content ? Any.toSDK(message.content) : undefined); + message.content !== undefined && (obj.content = message.content ? GlobalDecoderRegistry.toSDK(message.content) : undefined); obj.authority = message.authority; return obj; }, fromAmino(object: MsgExecLegacyContentAmino): MsgExecLegacyContent { const message = createBaseMsgExecLegacyContent(); if (object.content !== undefined && object.content !== null) { - message.content = ProposalContentI_FromAmino(object.content); + message.content = GlobalDecoderRegistry.fromAminoMsg(object.content); } if (object.authority !== undefined && object.authority !== null) { message.authority = object.authority; @@ -672,7 +717,7 @@ export const MsgExecLegacyContent = { }, toAmino(message: MsgExecLegacyContent, useInterfaces: boolean = true): MsgExecLegacyContentAmino { const obj: any = {}; - obj.content = message.content ? ProposalContentI_ToAmino((message.content as Any), useInterfaces) : undefined; + obj.content = message.content ? GlobalDecoderRegistry.toAminoMsg(message.content) : undefined; obj.authority = message.authority === "" ? undefined : message.authority; return obj; }, @@ -687,6 +732,21 @@ export const MsgExecLegacyContent = { typeUrl: "/cosmos.gov.v1.MsgExecLegacyContent", value: MsgExecLegacyContent.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgExecLegacyContent.typeUrl)) { + return; + } + TextProposal.registerTypeUrl(); + RegisterIncentiveProposal.registerTypeUrl(); + ClientUpdateProposal.registerTypeUrl(); + UpgradeProposal.registerTypeUrl(); + ReplacePoolIncentivesProposal.registerTypeUrl(); + UpdatePoolIncentivesProposal.registerTypeUrl(); + SetSuperfluidAssetsProposal.registerTypeUrl(); + RemoveSuperfluidAssetsProposal.registerTypeUrl(); + UpdateUnpoolWhiteListProposal.registerTypeUrl(); + UpdateFeeTokenProposal.registerTypeUrl(); } }; function createBaseMsgExecLegacyContentResponse(): MsgExecLegacyContentResponse { @@ -701,6 +761,15 @@ function createBaseMsgExecLegacyContentResponse(): MsgExecLegacyContentResponse export const MsgExecLegacyContentResponse = { typeUrl: "/cosmos.gov.v1.MsgExecLegacyContentResponse", aminoType: "cosmos-sdk/v1/MsgExecLegacyContentResponse", + is(o: any): o is MsgExecLegacyContentResponse { + return o && o.$typeUrl === MsgExecLegacyContentResponse.typeUrl; + }, + isSDK(o: any): o is MsgExecLegacyContentResponseSDKType { + return o && o.$typeUrl === MsgExecLegacyContentResponse.typeUrl; + }, + isAmino(o: any): o is MsgExecLegacyContentResponseAmino { + return o && o.$typeUrl === MsgExecLegacyContentResponse.typeUrl; + }, encode(_: MsgExecLegacyContentResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -752,7 +821,8 @@ export const MsgExecLegacyContentResponse = { typeUrl: "/cosmos.gov.v1.MsgExecLegacyContentResponse", value: MsgExecLegacyContentResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgVote(): MsgVote { return { @@ -771,6 +841,15 @@ function createBaseMsgVote(): MsgVote { export const MsgVote = { typeUrl: "/cosmos.gov.v1.MsgVote", aminoType: "cosmos-sdk/v1/MsgVote", + is(o: any): o is MsgVote { + return o && (o.$typeUrl === MsgVote.typeUrl || typeof o.proposalId === "bigint" && typeof o.voter === "string" && isSet(o.option) && typeof o.metadata === "string"); + }, + isSDK(o: any): o is MsgVoteSDKType { + return o && (o.$typeUrl === MsgVote.typeUrl || typeof o.proposal_id === "bigint" && typeof o.voter === "string" && isSet(o.option) && typeof o.metadata === "string"); + }, + isAmino(o: any): o is MsgVoteAmino { + return o && (o.$typeUrl === MsgVote.typeUrl || typeof o.proposal_id === "bigint" && typeof o.voter === "string" && isSet(o.option) && typeof o.metadata === "string"); + }, encode(message: MsgVote, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.proposalId !== BigInt(0)) { writer.uint32(8).uint64(message.proposalId); @@ -881,7 +960,8 @@ export const MsgVote = { typeUrl: "/cosmos.gov.v1.MsgVote", value: MsgVote.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgVoteResponse(): MsgVoteResponse { return {}; @@ -895,6 +975,15 @@ function createBaseMsgVoteResponse(): MsgVoteResponse { export const MsgVoteResponse = { typeUrl: "/cosmos.gov.v1.MsgVoteResponse", aminoType: "cosmos-sdk/v1/MsgVoteResponse", + is(o: any): o is MsgVoteResponse { + return o && o.$typeUrl === MsgVoteResponse.typeUrl; + }, + isSDK(o: any): o is MsgVoteResponseSDKType { + return o && o.$typeUrl === MsgVoteResponse.typeUrl; + }, + isAmino(o: any): o is MsgVoteResponseAmino { + return o && o.$typeUrl === MsgVoteResponse.typeUrl; + }, encode(_: MsgVoteResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -946,7 +1035,8 @@ export const MsgVoteResponse = { typeUrl: "/cosmos.gov.v1.MsgVoteResponse", value: MsgVoteResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgVoteWeighted(): MsgVoteWeighted { return { @@ -965,6 +1055,15 @@ function createBaseMsgVoteWeighted(): MsgVoteWeighted { export const MsgVoteWeighted = { typeUrl: "/cosmos.gov.v1.MsgVoteWeighted", aminoType: "cosmos-sdk/v1/MsgVoteWeighted", + is(o: any): o is MsgVoteWeighted { + return o && (o.$typeUrl === MsgVoteWeighted.typeUrl || typeof o.proposalId === "bigint" && typeof o.voter === "string" && Array.isArray(o.options) && (!o.options.length || WeightedVoteOption.is(o.options[0])) && typeof o.metadata === "string"); + }, + isSDK(o: any): o is MsgVoteWeightedSDKType { + return o && (o.$typeUrl === MsgVoteWeighted.typeUrl || typeof o.proposal_id === "bigint" && typeof o.voter === "string" && Array.isArray(o.options) && (!o.options.length || WeightedVoteOption.isSDK(o.options[0])) && typeof o.metadata === "string"); + }, + isAmino(o: any): o is MsgVoteWeightedAmino { + return o && (o.$typeUrl === MsgVoteWeighted.typeUrl || typeof o.proposal_id === "bigint" && typeof o.voter === "string" && Array.isArray(o.options) && (!o.options.length || WeightedVoteOption.isAmino(o.options[0])) && typeof o.metadata === "string"); + }, encode(message: MsgVoteWeighted, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.proposalId !== BigInt(0)) { writer.uint32(8).uint64(message.proposalId); @@ -1081,6 +1180,12 @@ export const MsgVoteWeighted = { typeUrl: "/cosmos.gov.v1.MsgVoteWeighted", value: MsgVoteWeighted.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgVoteWeighted.typeUrl)) { + return; + } + WeightedVoteOption.registerTypeUrl(); } }; function createBaseMsgVoteWeightedResponse(): MsgVoteWeightedResponse { @@ -1095,6 +1200,15 @@ function createBaseMsgVoteWeightedResponse(): MsgVoteWeightedResponse { export const MsgVoteWeightedResponse = { typeUrl: "/cosmos.gov.v1.MsgVoteWeightedResponse", aminoType: "cosmos-sdk/v1/MsgVoteWeightedResponse", + is(o: any): o is MsgVoteWeightedResponse { + return o && o.$typeUrl === MsgVoteWeightedResponse.typeUrl; + }, + isSDK(o: any): o is MsgVoteWeightedResponseSDKType { + return o && o.$typeUrl === MsgVoteWeightedResponse.typeUrl; + }, + isAmino(o: any): o is MsgVoteWeightedResponseAmino { + return o && o.$typeUrl === MsgVoteWeightedResponse.typeUrl; + }, encode(_: MsgVoteWeightedResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -1146,7 +1260,8 @@ export const MsgVoteWeightedResponse = { typeUrl: "/cosmos.gov.v1.MsgVoteWeightedResponse", value: MsgVoteWeightedResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgDeposit(): MsgDeposit { return { @@ -1164,6 +1279,15 @@ function createBaseMsgDeposit(): MsgDeposit { export const MsgDeposit = { typeUrl: "/cosmos.gov.v1.MsgDeposit", aminoType: "cosmos-sdk/v1/MsgDeposit", + is(o: any): o is MsgDeposit { + return o && (o.$typeUrl === MsgDeposit.typeUrl || typeof o.proposalId === "bigint" && typeof o.depositor === "string" && Array.isArray(o.amount) && (!o.amount.length || Coin.is(o.amount[0]))); + }, + isSDK(o: any): o is MsgDepositSDKType { + return o && (o.$typeUrl === MsgDeposit.typeUrl || typeof o.proposal_id === "bigint" && typeof o.depositor === "string" && Array.isArray(o.amount) && (!o.amount.length || Coin.isSDK(o.amount[0]))); + }, + isAmino(o: any): o is MsgDepositAmino { + return o && (o.$typeUrl === MsgDeposit.typeUrl || typeof o.proposal_id === "bigint" && typeof o.depositor === "string" && Array.isArray(o.amount) && (!o.amount.length || Coin.isAmino(o.amount[0]))); + }, encode(message: MsgDeposit, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.proposalId !== BigInt(0)) { writer.uint32(8).uint64(message.proposalId); @@ -1266,6 +1390,12 @@ export const MsgDeposit = { typeUrl: "/cosmos.gov.v1.MsgDeposit", value: MsgDeposit.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgDeposit.typeUrl)) { + return; + } + Coin.registerTypeUrl(); } }; function createBaseMsgDepositResponse(): MsgDepositResponse { @@ -1280,6 +1410,15 @@ function createBaseMsgDepositResponse(): MsgDepositResponse { export const MsgDepositResponse = { typeUrl: "/cosmos.gov.v1.MsgDepositResponse", aminoType: "cosmos-sdk/v1/MsgDepositResponse", + is(o: any): o is MsgDepositResponse { + return o && o.$typeUrl === MsgDepositResponse.typeUrl; + }, + isSDK(o: any): o is MsgDepositResponseSDKType { + return o && o.$typeUrl === MsgDepositResponse.typeUrl; + }, + isAmino(o: any): o is MsgDepositResponseAmino { + return o && o.$typeUrl === MsgDepositResponse.typeUrl; + }, encode(_: MsgDepositResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -1331,145 +1470,6 @@ export const MsgDepositResponse = { typeUrl: "/cosmos.gov.v1.MsgDepositResponse", value: MsgDepositResponse.encode(message).finish() }; - } -}; -export const ProposalContentI_InterfaceDecoder = (input: BinaryReader | Uint8Array): TextProposal | RegisterIncentiveProposal | ClientUpdateProposal | UpgradeProposal | ReplacePoolIncentivesProposal | UpdatePoolIncentivesProposal | SetSuperfluidAssetsProposal | RemoveSuperfluidAssetsProposal | UpdateUnpoolWhiteListProposal | UpdateFeeTokenProposal | Any => { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - const data = Any.decode(reader, reader.uint32(), true); - switch (data.typeUrl) { - case "/cosmos.gov.v1beta1.TextProposal": - return TextProposal.decode(data.value, undefined, true); - case "/evmos.incentives.v1.RegisterIncentiveProposal": - return RegisterIncentiveProposal.decode(data.value, undefined, true); - case "/ibc.core.client.v1.ClientUpdateProposal": - return ClientUpdateProposal.decode(data.value, undefined, true); - case "/ibc.core.client.v1.UpgradeProposal": - return UpgradeProposal.decode(data.value, undefined, true); - case "/osmosis.poolincentives.v1beta1.ReplacePoolIncentivesProposal": - return ReplacePoolIncentivesProposal.decode(data.value, undefined, true); - case "/osmosis.poolincentives.v1beta1.UpdatePoolIncentivesProposal": - return UpdatePoolIncentivesProposal.decode(data.value, undefined, true); - case "/osmosis.superfluid.v1beta1.SetSuperfluidAssetsProposal": - return SetSuperfluidAssetsProposal.decode(data.value, undefined, true); - case "/osmosis.superfluid.v1beta1.RemoveSuperfluidAssetsProposal": - return RemoveSuperfluidAssetsProposal.decode(data.value, undefined, true); - case "/osmosis.superfluid.v1beta1.UpdateUnpoolWhiteListProposal": - return UpdateUnpoolWhiteListProposal.decode(data.value, undefined, true); - case "/osmosis.txfees.v1beta1.UpdateFeeTokenProposal": - return UpdateFeeTokenProposal.decode(data.value, undefined, true); - default: - return data; - } -}; -export const ProposalContentI_FromAmino = (content: AnyAmino): Any => { - switch (content.type) { - case "cosmos-sdk/v1/TextProposal": - return Any.fromPartial({ - typeUrl: "/cosmos.gov.v1beta1.TextProposal", - value: TextProposal.encode(TextProposal.fromPartial(TextProposal.fromAmino(content.value))).finish() - }); - case "/evmos.incentives.v1.RegisterIncentiveProposal": - return Any.fromPartial({ - typeUrl: "/evmos.incentives.v1.RegisterIncentiveProposal", - value: RegisterIncentiveProposal.encode(RegisterIncentiveProposal.fromPartial(RegisterIncentiveProposal.fromAmino(content.value))).finish() - }); - case "cosmos-sdk/ClientUpdateProposal": - return Any.fromPartial({ - typeUrl: "/ibc.core.client.v1.ClientUpdateProposal", - value: ClientUpdateProposal.encode(ClientUpdateProposal.fromPartial(ClientUpdateProposal.fromAmino(content.value))).finish() - }); - case "cosmos-sdk/UpgradeProposal": - return Any.fromPartial({ - typeUrl: "/ibc.core.client.v1.UpgradeProposal", - value: UpgradeProposal.encode(UpgradeProposal.fromPartial(UpgradeProposal.fromAmino(content.value))).finish() - }); - case "osmosis/poolincentives/replace-pool-incentives-proposal": - return Any.fromPartial({ - typeUrl: "/osmosis.poolincentives.v1beta1.ReplacePoolIncentivesProposal", - value: ReplacePoolIncentivesProposal.encode(ReplacePoolIncentivesProposal.fromPartial(ReplacePoolIncentivesProposal.fromAmino(content.value))).finish() - }); - case "osmosis/poolincentives/update-pool-incentives-proposal": - return Any.fromPartial({ - typeUrl: "/osmosis.poolincentives.v1beta1.UpdatePoolIncentivesProposal", - value: UpdatePoolIncentivesProposal.encode(UpdatePoolIncentivesProposal.fromPartial(UpdatePoolIncentivesProposal.fromAmino(content.value))).finish() - }); - case "osmosis/v1beta1/set-superfluid-assets-proposal": - return Any.fromPartial({ - typeUrl: "/osmosis.superfluid.v1beta1.SetSuperfluidAssetsProposal", - value: SetSuperfluidAssetsProposal.encode(SetSuperfluidAssetsProposal.fromPartial(SetSuperfluidAssetsProposal.fromAmino(content.value))).finish() - }); - case "osmosis/v1beta1/remove-superfluid-assets-proposal": - return Any.fromPartial({ - typeUrl: "/osmosis.superfluid.v1beta1.RemoveSuperfluidAssetsProposal", - value: RemoveSuperfluidAssetsProposal.encode(RemoveSuperfluidAssetsProposal.fromPartial(RemoveSuperfluidAssetsProposal.fromAmino(content.value))).finish() - }); - case "osmosis/v1beta1/update-unpool-white-list-proposal": - return Any.fromPartial({ - typeUrl: "/osmosis.superfluid.v1beta1.UpdateUnpoolWhiteListProposal", - value: UpdateUnpoolWhiteListProposal.encode(UpdateUnpoolWhiteListProposal.fromPartial(UpdateUnpoolWhiteListProposal.fromAmino(content.value))).finish() - }); - case "osmosis/txfees/update-fee-token-proposal": - return Any.fromPartial({ - typeUrl: "/osmosis.txfees.v1beta1.UpdateFeeTokenProposal", - value: UpdateFeeTokenProposal.encode(UpdateFeeTokenProposal.fromPartial(UpdateFeeTokenProposal.fromAmino(content.value))).finish() - }); - default: - return Any.fromAmino(content); - } -}; -export const ProposalContentI_ToAmino = (content: Any, useInterfaces: boolean = true) => { - switch (content.typeUrl) { - case "/cosmos.gov.v1beta1.TextProposal": - return { - type: "cosmos-sdk/v1/TextProposal", - value: TextProposal.toAmino(TextProposal.decode(content.value, undefined, useInterfaces), useInterfaces) - }; - case "/evmos.incentives.v1.RegisterIncentiveProposal": - return { - type: "/evmos.incentives.v1.RegisterIncentiveProposal", - value: RegisterIncentiveProposal.toAmino(RegisterIncentiveProposal.decode(content.value, undefined, useInterfaces), useInterfaces) - }; - case "/ibc.core.client.v1.ClientUpdateProposal": - return { - type: "cosmos-sdk/ClientUpdateProposal", - value: ClientUpdateProposal.toAmino(ClientUpdateProposal.decode(content.value, undefined, useInterfaces), useInterfaces) - }; - case "/ibc.core.client.v1.UpgradeProposal": - return { - type: "cosmos-sdk/UpgradeProposal", - value: UpgradeProposal.toAmino(UpgradeProposal.decode(content.value, undefined, useInterfaces), useInterfaces) - }; - case "/osmosis.poolincentives.v1beta1.ReplacePoolIncentivesProposal": - return { - type: "osmosis/poolincentives/replace-pool-incentives-proposal", - value: ReplacePoolIncentivesProposal.toAmino(ReplacePoolIncentivesProposal.decode(content.value, undefined, useInterfaces), useInterfaces) - }; - case "/osmosis.poolincentives.v1beta1.UpdatePoolIncentivesProposal": - return { - type: "osmosis/poolincentives/update-pool-incentives-proposal", - value: UpdatePoolIncentivesProposal.toAmino(UpdatePoolIncentivesProposal.decode(content.value, undefined, useInterfaces), useInterfaces) - }; - case "/osmosis.superfluid.v1beta1.SetSuperfluidAssetsProposal": - return { - type: "osmosis/v1beta1/set-superfluid-assets-proposal", - value: SetSuperfluidAssetsProposal.toAmino(SetSuperfluidAssetsProposal.decode(content.value, undefined, useInterfaces), useInterfaces) - }; - case "/osmosis.superfluid.v1beta1.RemoveSuperfluidAssetsProposal": - return { - type: "osmosis/v1beta1/remove-superfluid-assets-proposal", - value: RemoveSuperfluidAssetsProposal.toAmino(RemoveSuperfluidAssetsProposal.decode(content.value, undefined, useInterfaces), useInterfaces) - }; - case "/osmosis.superfluid.v1beta1.UpdateUnpoolWhiteListProposal": - return { - type: "osmosis/v1beta1/update-unpool-white-list-proposal", - value: UpdateUnpoolWhiteListProposal.toAmino(UpdateUnpoolWhiteListProposal.decode(content.value, undefined, useInterfaces), useInterfaces) - }; - case "/osmosis.txfees.v1beta1.UpdateFeeTokenProposal": - return { - type: "osmosis/txfees/update-fee-token-proposal", - value: UpdateFeeTokenProposal.toAmino(UpdateFeeTokenProposal.decode(content.value, undefined, useInterfaces), useInterfaces) - }; - default: - return Any.toAmino(content, useInterfaces); - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/cosmos/gov/v1beta1/genesis.ts b/__fixtures__/v-next/outputv3/cosmos/gov/v1beta1/genesis.ts index 9296d32978..e414e780f2 100644 --- a/__fixtures__/v-next/outputv3/cosmos/gov/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv3/cosmos/gov/v1beta1/genesis.ts @@ -1,5 +1,6 @@ import { Deposit, DepositAmino, DepositSDKType, Vote, VoteAmino, VoteSDKType, Proposal, ProposalAmino, ProposalSDKType, DepositParams, DepositParamsAmino, DepositParamsSDKType, VotingParams, VotingParamsAmino, VotingParamsSDKType, TallyParams, TallyParamsAmino, TallyParamsSDKType } from "./gov"; import { BinaryReader, BinaryWriter } from "../../../binary"; +import { GlobalDecoderRegistry } from "../../../registry"; import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "cosmos.gov.v1beta1"; /** @@ -113,6 +114,15 @@ function createBaseGenesisState(): GenesisState { export const GenesisState = { typeUrl: "/cosmos.gov.v1beta1.GenesisState", aminoType: "cosmos-sdk/GenesisState", + is(o: any): o is GenesisState { + return o && (o.$typeUrl === GenesisState.typeUrl || typeof o.startingProposalId === "bigint" && Array.isArray(o.deposits) && (!o.deposits.length || Deposit.is(o.deposits[0])) && Array.isArray(o.votes) && (!o.votes.length || Vote.is(o.votes[0])) && Array.isArray(o.proposals) && (!o.proposals.length || Proposal.is(o.proposals[0])) && DepositParams.is(o.depositParams) && VotingParams.is(o.votingParams) && TallyParams.is(o.tallyParams)); + }, + isSDK(o: any): o is GenesisStateSDKType { + return o && (o.$typeUrl === GenesisState.typeUrl || typeof o.starting_proposal_id === "bigint" && Array.isArray(o.deposits) && (!o.deposits.length || Deposit.isSDK(o.deposits[0])) && Array.isArray(o.votes) && (!o.votes.length || Vote.isSDK(o.votes[0])) && Array.isArray(o.proposals) && (!o.proposals.length || Proposal.isSDK(o.proposals[0])) && DepositParams.isSDK(o.deposit_params) && VotingParams.isSDK(o.voting_params) && TallyParams.isSDK(o.tally_params)); + }, + isAmino(o: any): o is GenesisStateAmino { + return o && (o.$typeUrl === GenesisState.typeUrl || typeof o.starting_proposal_id === "bigint" && Array.isArray(o.deposits) && (!o.deposits.length || Deposit.isAmino(o.deposits[0])) && Array.isArray(o.votes) && (!o.votes.length || Vote.isAmino(o.votes[0])) && Array.isArray(o.proposals) && (!o.proposals.length || Proposal.isAmino(o.proposals[0])) && DepositParams.isAmino(o.deposit_params) && VotingParams.isAmino(o.voting_params) && TallyParams.isAmino(o.tally_params)); + }, encode(message: GenesisState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.startingProposalId !== BigInt(0)) { writer.uint32(8).uint64(message.startingProposalId); @@ -289,5 +299,16 @@ export const GenesisState = { typeUrl: "/cosmos.gov.v1beta1.GenesisState", value: GenesisState.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GenesisState.typeUrl)) { + return; + } + Deposit.registerTypeUrl(); + Vote.registerTypeUrl(); + Proposal.registerTypeUrl(); + DepositParams.registerTypeUrl(); + VotingParams.registerTypeUrl(); + TallyParams.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/cosmos/gov/v1beta1/gov.ts b/__fixtures__/v-next/outputv3/cosmos/gov/v1beta1/gov.ts index ca7d1575f4..01f57052af 100644 --- a/__fixtures__/v-next/outputv3/cosmos/gov/v1beta1/gov.ts +++ b/__fixtures__/v-next/outputv3/cosmos/gov/v1beta1/gov.ts @@ -7,9 +7,10 @@ import { ClientUpdateProposal, ClientUpdateProposalProtoMsg, ClientUpdateProposa import { ReplacePoolIncentivesProposal, ReplacePoolIncentivesProposalProtoMsg, ReplacePoolIncentivesProposalSDKType, UpdatePoolIncentivesProposal, UpdatePoolIncentivesProposalProtoMsg, UpdatePoolIncentivesProposalSDKType } from "../../../osmosis/pool-incentives/v1beta1/gov"; import { SetSuperfluidAssetsProposal, SetSuperfluidAssetsProposalProtoMsg, SetSuperfluidAssetsProposalSDKType, RemoveSuperfluidAssetsProposal, RemoveSuperfluidAssetsProposalProtoMsg, RemoveSuperfluidAssetsProposalSDKType, UpdateUnpoolWhiteListProposal, UpdateUnpoolWhiteListProposalProtoMsg, UpdateUnpoolWhiteListProposalSDKType } from "../../../osmosis/superfluid/v1beta1/gov"; import { UpdateFeeTokenProposal, UpdateFeeTokenProposalProtoMsg, UpdateFeeTokenProposalSDKType } from "../../../osmosis/txfees/v1beta1/gov"; -import { BinaryReader, BinaryWriter } from "../../../binary"; -import { Decimal } from "@cosmjs/math"; import { isSet, DeepPartial, toTimestamp, fromTimestamp, bytesFromBase64, base64FromBytes } from "../../../helpers"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { Decimal } from "@interchainjs/math"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "cosmos.gov.v1beta1"; /** VoteOption enumerates the valid vote options for a given governance proposal. */ export enum VoteOption { @@ -597,6 +598,15 @@ function createBaseWeightedVoteOption(): WeightedVoteOption { export const WeightedVoteOption = { typeUrl: "/cosmos.gov.v1beta1.WeightedVoteOption", aminoType: "cosmos-sdk/WeightedVoteOption", + is(o: any): o is WeightedVoteOption { + return o && (o.$typeUrl === WeightedVoteOption.typeUrl || isSet(o.option) && typeof o.weight === "string"); + }, + isSDK(o: any): o is WeightedVoteOptionSDKType { + return o && (o.$typeUrl === WeightedVoteOption.typeUrl || isSet(o.option) && typeof o.weight === "string"); + }, + isAmino(o: any): o is WeightedVoteOptionAmino { + return o && (o.$typeUrl === WeightedVoteOption.typeUrl || isSet(o.option) && typeof o.weight === "string"); + }, encode(message: WeightedVoteOption, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.option !== 0) { writer.uint32(8).int32(message.option); @@ -663,7 +673,7 @@ export const WeightedVoteOption = { toAmino(message: WeightedVoteOption, useInterfaces: boolean = true): WeightedVoteOptionAmino { const obj: any = {}; obj.option = message.option === 0 ? undefined : message.option; - obj.weight = message.weight === "" ? undefined : message.weight; + obj.weight = message.weight === "" ? undefined : Decimal.fromUserInput(message.weight, 18).atomics; return obj; }, fromProtoMsg(message: WeightedVoteOptionProtoMsg, useInterfaces: boolean = true): WeightedVoteOption { @@ -677,7 +687,8 @@ export const WeightedVoteOption = { typeUrl: "/cosmos.gov.v1beta1.WeightedVoteOption", value: WeightedVoteOption.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseTextProposal(): TextProposal { return { @@ -696,6 +707,15 @@ function createBaseTextProposal(): TextProposal { export const TextProposal = { typeUrl: "/cosmos.gov.v1beta1.TextProposal", aminoType: "cosmos-sdk/TextProposal", + is(o: any): o is TextProposal { + return o && (o.$typeUrl === TextProposal.typeUrl || typeof o.title === "string" && typeof o.description === "string"); + }, + isSDK(o: any): o is TextProposalSDKType { + return o && (o.$typeUrl === TextProposal.typeUrl || typeof o.title === "string" && typeof o.description === "string"); + }, + isAmino(o: any): o is TextProposalAmino { + return o && (o.$typeUrl === TextProposal.typeUrl || typeof o.title === "string" && typeof o.description === "string"); + }, encode(message: TextProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.title !== "") { writer.uint32(10).string(message.title); @@ -776,6 +796,13 @@ export const TextProposal = { typeUrl: "/cosmos.gov.v1beta1.TextProposal", value: TextProposal.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(TextProposal.typeUrl)) { + return; + } + GlobalDecoderRegistry.register(TextProposal.typeUrl, TextProposal); + GlobalDecoderRegistry.registerAminoProtoMapping(TextProposal.aminoType, TextProposal.typeUrl); } }; function createBaseDeposit(): Deposit { @@ -795,6 +822,15 @@ function createBaseDeposit(): Deposit { export const Deposit = { typeUrl: "/cosmos.gov.v1beta1.Deposit", aminoType: "cosmos-sdk/Deposit", + is(o: any): o is Deposit { + return o && (o.$typeUrl === Deposit.typeUrl || typeof o.proposalId === "bigint" && typeof o.depositor === "string" && Array.isArray(o.amount) && (!o.amount.length || Coin.is(o.amount[0]))); + }, + isSDK(o: any): o is DepositSDKType { + return o && (o.$typeUrl === Deposit.typeUrl || typeof o.proposal_id === "bigint" && typeof o.depositor === "string" && Array.isArray(o.amount) && (!o.amount.length || Coin.isSDK(o.amount[0]))); + }, + isAmino(o: any): o is DepositAmino { + return o && (o.$typeUrl === Deposit.typeUrl || typeof o.proposal_id === "bigint" && typeof o.depositor === "string" && Array.isArray(o.amount) && (!o.amount.length || Coin.isAmino(o.amount[0]))); + }, encode(message: Deposit, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.proposalId !== BigInt(0)) { writer.uint32(8).uint64(message.proposalId); @@ -897,6 +933,12 @@ export const Deposit = { typeUrl: "/cosmos.gov.v1beta1.Deposit", value: Deposit.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Deposit.typeUrl)) { + return; + } + Coin.registerTypeUrl(); } }; function createBaseProposal(): Proposal { @@ -921,12 +963,21 @@ function createBaseProposal(): Proposal { export const Proposal = { typeUrl: "/cosmos.gov.v1beta1.Proposal", aminoType: "cosmos-sdk/Proposal", + is(o: any): o is Proposal { + return o && (o.$typeUrl === Proposal.typeUrl || typeof o.proposalId === "bigint" && isSet(o.status) && TallyResult.is(o.finalTallyResult) && Timestamp.is(o.submitTime) && Timestamp.is(o.depositEndTime) && Array.isArray(o.totalDeposit) && (!o.totalDeposit.length || Coin.is(o.totalDeposit[0])) && Timestamp.is(o.votingStartTime) && Timestamp.is(o.votingEndTime)); + }, + isSDK(o: any): o is ProposalSDKType { + return o && (o.$typeUrl === Proposal.typeUrl || typeof o.proposal_id === "bigint" && isSet(o.status) && TallyResult.isSDK(o.final_tally_result) && Timestamp.isSDK(o.submit_time) && Timestamp.isSDK(o.deposit_end_time) && Array.isArray(o.total_deposit) && (!o.total_deposit.length || Coin.isSDK(o.total_deposit[0])) && Timestamp.isSDK(o.voting_start_time) && Timestamp.isSDK(o.voting_end_time)); + }, + isAmino(o: any): o is ProposalAmino { + return o && (o.$typeUrl === Proposal.typeUrl || typeof o.proposal_id === "bigint" && isSet(o.status) && TallyResult.isAmino(o.final_tally_result) && Timestamp.isAmino(o.submit_time) && Timestamp.isAmino(o.deposit_end_time) && Array.isArray(o.total_deposit) && (!o.total_deposit.length || Coin.isAmino(o.total_deposit[0])) && Timestamp.isAmino(o.voting_start_time) && Timestamp.isAmino(o.voting_end_time)); + }, encode(message: Proposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.proposalId !== BigInt(0)) { writer.uint32(8).uint64(message.proposalId); } if (message.content !== undefined) { - Any.encode((message.content as Any), writer.uint32(18).fork()).ldelim(); + Any.encode(GlobalDecoderRegistry.wrapAny(message.content), writer.uint32(18).fork()).ldelim(); } if (message.status !== 0) { writer.uint32(24).int32(message.status); @@ -962,7 +1013,7 @@ export const Proposal = { message.proposalId = reader.uint64(); break; case 2: - message.content = useInterfaces ? (ProposalContentI_InterfaceDecoder(reader) as Any) : Any.decode(reader, reader.uint32(), useInterfaces); + message.content = GlobalDecoderRegistry.unwrapAny(reader); break; case 3: message.status = (reader.int32() as any); @@ -995,7 +1046,7 @@ export const Proposal = { fromJSON(object: any): Proposal { const obj = createBaseProposal(); if (isSet(object.proposalId)) obj.proposalId = BigInt(object.proposalId.toString()); - if (isSet(object.content)) obj.content = Any.fromJSON(object.content); + if (isSet(object.content)) obj.content = GlobalDecoderRegistry.fromJSON(object.content); if (isSet(object.status)) obj.status = proposalStatusFromJSON(object.status); if (isSet(object.finalTallyResult)) obj.finalTallyResult = TallyResult.fromJSON(object.finalTallyResult); if (isSet(object.submitTime)) obj.submitTime = new Date(object.submitTime); @@ -1011,7 +1062,7 @@ export const Proposal = { message.proposalId = BigInt(object.proposalId.toString()); } if (object.content !== undefined && object.content !== null) { - message.content = Any.fromPartial(object.content); + message.content = GlobalDecoderRegistry.fromPartial(object.content); } message.status = object.status ?? 0; if (object.finalTallyResult !== undefined && object.finalTallyResult !== null) { @@ -1027,7 +1078,7 @@ export const Proposal = { fromSDK(object: ProposalSDKType): Proposal { return { proposalId: object?.proposal_id, - content: object.content ? Any.fromSDK(object.content) : undefined, + content: object.content ? GlobalDecoderRegistry.fromSDK(object.content) : undefined, status: isSet(object.status) ? proposalStatusFromJSON(object.status) : -1, finalTallyResult: object.final_tally_result ? TallyResult.fromSDK(object.final_tally_result) : undefined, submitTime: object.submit_time ?? undefined, @@ -1040,7 +1091,7 @@ export const Proposal = { toSDK(message: Proposal): ProposalSDKType { const obj: any = {}; obj.proposal_id = message.proposalId; - message.content !== undefined && (obj.content = message.content ? Any.toSDK(message.content) : undefined); + message.content !== undefined && (obj.content = message.content ? GlobalDecoderRegistry.toSDK(message.content) : undefined); message.status !== undefined && (obj.status = proposalStatusToJSON(message.status)); message.finalTallyResult !== undefined && (obj.final_tally_result = message.finalTallyResult ? TallyResult.toSDK(message.finalTallyResult) : undefined); message.submitTime !== undefined && (obj.submit_time = message.submitTime ?? undefined); @@ -1060,7 +1111,7 @@ export const Proposal = { message.proposalId = BigInt(object.proposal_id); } if (object.content !== undefined && object.content !== null) { - message.content = ProposalContentI_FromAmino(object.content); + message.content = GlobalDecoderRegistry.fromAminoMsg(object.content); } if (object.status !== undefined && object.status !== null) { message.status = object.status; @@ -1086,7 +1137,7 @@ export const Proposal = { toAmino(message: Proposal, useInterfaces: boolean = true): ProposalAmino { const obj: any = {}; obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId?.toString() : undefined; - obj.content = message.content ? ProposalContentI_ToAmino((message.content as Any), useInterfaces) : undefined; + obj.content = message.content ? GlobalDecoderRegistry.toAminoMsg(message.content) : undefined; obj.status = message.status === 0 ? undefined : message.status; obj.final_tally_result = message.finalTallyResult ? TallyResult.toAmino(message.finalTallyResult, useInterfaces) : undefined; obj.submit_time = message.submitTime ? Timestamp.toAmino(toTimestamp(message.submitTime)) : undefined; @@ -1111,6 +1162,23 @@ export const Proposal = { typeUrl: "/cosmos.gov.v1beta1.Proposal", value: Proposal.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Proposal.typeUrl)) { + return; + } + TextProposal.registerTypeUrl(); + RegisterIncentiveProposal.registerTypeUrl(); + ClientUpdateProposal.registerTypeUrl(); + UpgradeProposal.registerTypeUrl(); + ReplacePoolIncentivesProposal.registerTypeUrl(); + UpdatePoolIncentivesProposal.registerTypeUrl(); + SetSuperfluidAssetsProposal.registerTypeUrl(); + RemoveSuperfluidAssetsProposal.registerTypeUrl(); + UpdateUnpoolWhiteListProposal.registerTypeUrl(); + UpdateFeeTokenProposal.registerTypeUrl(); + TallyResult.registerTypeUrl(); + Coin.registerTypeUrl(); } }; function createBaseTallyResult(): TallyResult { @@ -1130,6 +1198,15 @@ function createBaseTallyResult(): TallyResult { export const TallyResult = { typeUrl: "/cosmos.gov.v1beta1.TallyResult", aminoType: "cosmos-sdk/TallyResult", + is(o: any): o is TallyResult { + return o && (o.$typeUrl === TallyResult.typeUrl || typeof o.yes === "string" && typeof o.abstain === "string" && typeof o.no === "string" && typeof o.noWithVeto === "string"); + }, + isSDK(o: any): o is TallyResultSDKType { + return o && (o.$typeUrl === TallyResult.typeUrl || typeof o.yes === "string" && typeof o.abstain === "string" && typeof o.no === "string" && typeof o.no_with_veto === "string"); + }, + isAmino(o: any): o is TallyResultAmino { + return o && (o.$typeUrl === TallyResult.typeUrl || typeof o.yes === "string" && typeof o.abstain === "string" && typeof o.no === "string" && typeof o.no_with_veto === "string"); + }, encode(message: TallyResult, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.yes !== "") { writer.uint32(10).string(message.yes); @@ -1238,7 +1315,8 @@ export const TallyResult = { typeUrl: "/cosmos.gov.v1beta1.TallyResult", value: TallyResult.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseVote(): Vote { return { @@ -1258,6 +1336,15 @@ function createBaseVote(): Vote { export const Vote = { typeUrl: "/cosmos.gov.v1beta1.Vote", aminoType: "cosmos-sdk/Vote", + is(o: any): o is Vote { + return o && (o.$typeUrl === Vote.typeUrl || typeof o.proposalId === "bigint" && typeof o.voter === "string" && isSet(o.option) && Array.isArray(o.options) && (!o.options.length || WeightedVoteOption.is(o.options[0]))); + }, + isSDK(o: any): o is VoteSDKType { + return o && (o.$typeUrl === Vote.typeUrl || typeof o.proposal_id === "bigint" && typeof o.voter === "string" && isSet(o.option) && Array.isArray(o.options) && (!o.options.length || WeightedVoteOption.isSDK(o.options[0]))); + }, + isAmino(o: any): o is VoteAmino { + return o && (o.$typeUrl === Vote.typeUrl || typeof o.proposal_id === "bigint" && typeof o.voter === "string" && isSet(o.option) && Array.isArray(o.options) && (!o.options.length || WeightedVoteOption.isAmino(o.options[0]))); + }, encode(message: Vote, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.proposalId !== BigInt(0)) { writer.uint32(8).uint64(message.proposalId); @@ -1374,6 +1461,12 @@ export const Vote = { typeUrl: "/cosmos.gov.v1beta1.Vote", value: Vote.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Vote.typeUrl)) { + return; + } + WeightedVoteOption.registerTypeUrl(); } }; function createBaseDepositParams(): DepositParams { @@ -1391,6 +1484,15 @@ function createBaseDepositParams(): DepositParams { export const DepositParams = { typeUrl: "/cosmos.gov.v1beta1.DepositParams", aminoType: "cosmos-sdk/DepositParams", + is(o: any): o is DepositParams { + return o && (o.$typeUrl === DepositParams.typeUrl || Array.isArray(o.minDeposit) && (!o.minDeposit.length || Coin.is(o.minDeposit[0])) && Duration.is(o.maxDepositPeriod)); + }, + isSDK(o: any): o is DepositParamsSDKType { + return o && (o.$typeUrl === DepositParams.typeUrl || Array.isArray(o.min_deposit) && (!o.min_deposit.length || Coin.isSDK(o.min_deposit[0])) && Duration.isSDK(o.max_deposit_period)); + }, + isAmino(o: any): o is DepositParamsAmino { + return o && (o.$typeUrl === DepositParams.typeUrl || Array.isArray(o.min_deposit) && (!o.min_deposit.length || Coin.isAmino(o.min_deposit[0])) && Duration.isAmino(o.max_deposit_period)); + }, encode(message: DepositParams, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.minDeposit) { Coin.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -1479,6 +1581,12 @@ export const DepositParams = { typeUrl: "/cosmos.gov.v1beta1.DepositParams", value: DepositParams.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(DepositParams.typeUrl)) { + return; + } + Coin.registerTypeUrl(); } }; function createBaseVotingParams(): VotingParams { @@ -1495,6 +1603,15 @@ function createBaseVotingParams(): VotingParams { export const VotingParams = { typeUrl: "/cosmos.gov.v1beta1.VotingParams", aminoType: "cosmos-sdk/VotingParams", + is(o: any): o is VotingParams { + return o && (o.$typeUrl === VotingParams.typeUrl || Duration.is(o.votingPeriod)); + }, + isSDK(o: any): o is VotingParamsSDKType { + return o && (o.$typeUrl === VotingParams.typeUrl || Duration.isSDK(o.voting_period)); + }, + isAmino(o: any): o is VotingParamsAmino { + return o && (o.$typeUrl === VotingParams.typeUrl || Duration.isAmino(o.voting_period)); + }, encode(message: VotingParams, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.votingPeriod !== undefined) { Duration.encode(message.votingPeriod, writer.uint32(10).fork()).ldelim(); @@ -1563,7 +1680,8 @@ export const VotingParams = { typeUrl: "/cosmos.gov.v1beta1.VotingParams", value: VotingParams.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseTallyParams(): TallyParams { return { @@ -1581,6 +1699,15 @@ function createBaseTallyParams(): TallyParams { export const TallyParams = { typeUrl: "/cosmos.gov.v1beta1.TallyParams", aminoType: "cosmos-sdk/TallyParams", + is(o: any): o is TallyParams { + return o && (o.$typeUrl === TallyParams.typeUrl || (o.quorum instanceof Uint8Array || typeof o.quorum === "string") && (o.threshold instanceof Uint8Array || typeof o.threshold === "string") && (o.vetoThreshold instanceof Uint8Array || typeof o.vetoThreshold === "string")); + }, + isSDK(o: any): o is TallyParamsSDKType { + return o && (o.$typeUrl === TallyParams.typeUrl || (o.quorum instanceof Uint8Array || typeof o.quorum === "string") && (o.threshold instanceof Uint8Array || typeof o.threshold === "string") && (o.veto_threshold instanceof Uint8Array || typeof o.veto_threshold === "string")); + }, + isAmino(o: any): o is TallyParamsAmino { + return o && (o.$typeUrl === TallyParams.typeUrl || (o.quorum instanceof Uint8Array || typeof o.quorum === "string") && (o.threshold instanceof Uint8Array || typeof o.threshold === "string") && (o.veto_threshold instanceof Uint8Array || typeof o.veto_threshold === "string")); + }, encode(message: TallyParams, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.quorum.length !== 0) { writer.uint32(10).bytes(message.quorum); @@ -1675,145 +1802,6 @@ export const TallyParams = { typeUrl: "/cosmos.gov.v1beta1.TallyParams", value: TallyParams.encode(message).finish() }; - } -}; -export const ProposalContentI_InterfaceDecoder = (input: BinaryReader | Uint8Array): TextProposal | RegisterIncentiveProposal | ClientUpdateProposal | UpgradeProposal | ReplacePoolIncentivesProposal | UpdatePoolIncentivesProposal | SetSuperfluidAssetsProposal | RemoveSuperfluidAssetsProposal | UpdateUnpoolWhiteListProposal | UpdateFeeTokenProposal | Any => { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - const data = Any.decode(reader, reader.uint32(), true); - switch (data.typeUrl) { - case "/cosmos.gov.v1beta1.TextProposal": - return TextProposal.decode(data.value, undefined, true); - case "/evmos.incentives.v1.RegisterIncentiveProposal": - return RegisterIncentiveProposal.decode(data.value, undefined, true); - case "/ibc.core.client.v1.ClientUpdateProposal": - return ClientUpdateProposal.decode(data.value, undefined, true); - case "/ibc.core.client.v1.UpgradeProposal": - return UpgradeProposal.decode(data.value, undefined, true); - case "/osmosis.poolincentives.v1beta1.ReplacePoolIncentivesProposal": - return ReplacePoolIncentivesProposal.decode(data.value, undefined, true); - case "/osmosis.poolincentives.v1beta1.UpdatePoolIncentivesProposal": - return UpdatePoolIncentivesProposal.decode(data.value, undefined, true); - case "/osmosis.superfluid.v1beta1.SetSuperfluidAssetsProposal": - return SetSuperfluidAssetsProposal.decode(data.value, undefined, true); - case "/osmosis.superfluid.v1beta1.RemoveSuperfluidAssetsProposal": - return RemoveSuperfluidAssetsProposal.decode(data.value, undefined, true); - case "/osmosis.superfluid.v1beta1.UpdateUnpoolWhiteListProposal": - return UpdateUnpoolWhiteListProposal.decode(data.value, undefined, true); - case "/osmosis.txfees.v1beta1.UpdateFeeTokenProposal": - return UpdateFeeTokenProposal.decode(data.value, undefined, true); - default: - return data; - } -}; -export const ProposalContentI_FromAmino = (content: AnyAmino): Any => { - switch (content.type) { - case "cosmos-sdk/TextProposal": - return Any.fromPartial({ - typeUrl: "/cosmos.gov.v1beta1.TextProposal", - value: TextProposal.encode(TextProposal.fromPartial(TextProposal.fromAmino(content.value))).finish() - }); - case "/evmos.incentives.v1.RegisterIncentiveProposal": - return Any.fromPartial({ - typeUrl: "/evmos.incentives.v1.RegisterIncentiveProposal", - value: RegisterIncentiveProposal.encode(RegisterIncentiveProposal.fromPartial(RegisterIncentiveProposal.fromAmino(content.value))).finish() - }); - case "cosmos-sdk/ClientUpdateProposal": - return Any.fromPartial({ - typeUrl: "/ibc.core.client.v1.ClientUpdateProposal", - value: ClientUpdateProposal.encode(ClientUpdateProposal.fromPartial(ClientUpdateProposal.fromAmino(content.value))).finish() - }); - case "cosmos-sdk/UpgradeProposal": - return Any.fromPartial({ - typeUrl: "/ibc.core.client.v1.UpgradeProposal", - value: UpgradeProposal.encode(UpgradeProposal.fromPartial(UpgradeProposal.fromAmino(content.value))).finish() - }); - case "osmosis/poolincentives/replace-pool-incentives-proposal": - return Any.fromPartial({ - typeUrl: "/osmosis.poolincentives.v1beta1.ReplacePoolIncentivesProposal", - value: ReplacePoolIncentivesProposal.encode(ReplacePoolIncentivesProposal.fromPartial(ReplacePoolIncentivesProposal.fromAmino(content.value))).finish() - }); - case "osmosis/poolincentives/update-pool-incentives-proposal": - return Any.fromPartial({ - typeUrl: "/osmosis.poolincentives.v1beta1.UpdatePoolIncentivesProposal", - value: UpdatePoolIncentivesProposal.encode(UpdatePoolIncentivesProposal.fromPartial(UpdatePoolIncentivesProposal.fromAmino(content.value))).finish() - }); - case "osmosis/v1beta1/set-superfluid-assets-proposal": - return Any.fromPartial({ - typeUrl: "/osmosis.superfluid.v1beta1.SetSuperfluidAssetsProposal", - value: SetSuperfluidAssetsProposal.encode(SetSuperfluidAssetsProposal.fromPartial(SetSuperfluidAssetsProposal.fromAmino(content.value))).finish() - }); - case "osmosis/v1beta1/remove-superfluid-assets-proposal": - return Any.fromPartial({ - typeUrl: "/osmosis.superfluid.v1beta1.RemoveSuperfluidAssetsProposal", - value: RemoveSuperfluidAssetsProposal.encode(RemoveSuperfluidAssetsProposal.fromPartial(RemoveSuperfluidAssetsProposal.fromAmino(content.value))).finish() - }); - case "osmosis/v1beta1/update-unpool-white-list-proposal": - return Any.fromPartial({ - typeUrl: "/osmosis.superfluid.v1beta1.UpdateUnpoolWhiteListProposal", - value: UpdateUnpoolWhiteListProposal.encode(UpdateUnpoolWhiteListProposal.fromPartial(UpdateUnpoolWhiteListProposal.fromAmino(content.value))).finish() - }); - case "osmosis/txfees/update-fee-token-proposal": - return Any.fromPartial({ - typeUrl: "/osmosis.txfees.v1beta1.UpdateFeeTokenProposal", - value: UpdateFeeTokenProposal.encode(UpdateFeeTokenProposal.fromPartial(UpdateFeeTokenProposal.fromAmino(content.value))).finish() - }); - default: - return Any.fromAmino(content); - } -}; -export const ProposalContentI_ToAmino = (content: Any, useInterfaces: boolean = true) => { - switch (content.typeUrl) { - case "/cosmos.gov.v1beta1.TextProposal": - return { - type: "cosmos-sdk/TextProposal", - value: TextProposal.toAmino(TextProposal.decode(content.value, undefined, useInterfaces), useInterfaces) - }; - case "/evmos.incentives.v1.RegisterIncentiveProposal": - return { - type: "/evmos.incentives.v1.RegisterIncentiveProposal", - value: RegisterIncentiveProposal.toAmino(RegisterIncentiveProposal.decode(content.value, undefined, useInterfaces), useInterfaces) - }; - case "/ibc.core.client.v1.ClientUpdateProposal": - return { - type: "cosmos-sdk/ClientUpdateProposal", - value: ClientUpdateProposal.toAmino(ClientUpdateProposal.decode(content.value, undefined, useInterfaces), useInterfaces) - }; - case "/ibc.core.client.v1.UpgradeProposal": - return { - type: "cosmos-sdk/UpgradeProposal", - value: UpgradeProposal.toAmino(UpgradeProposal.decode(content.value, undefined, useInterfaces), useInterfaces) - }; - case "/osmosis.poolincentives.v1beta1.ReplacePoolIncentivesProposal": - return { - type: "osmosis/poolincentives/replace-pool-incentives-proposal", - value: ReplacePoolIncentivesProposal.toAmino(ReplacePoolIncentivesProposal.decode(content.value, undefined, useInterfaces), useInterfaces) - }; - case "/osmosis.poolincentives.v1beta1.UpdatePoolIncentivesProposal": - return { - type: "osmosis/poolincentives/update-pool-incentives-proposal", - value: UpdatePoolIncentivesProposal.toAmino(UpdatePoolIncentivesProposal.decode(content.value, undefined, useInterfaces), useInterfaces) - }; - case "/osmosis.superfluid.v1beta1.SetSuperfluidAssetsProposal": - return { - type: "osmosis/v1beta1/set-superfluid-assets-proposal", - value: SetSuperfluidAssetsProposal.toAmino(SetSuperfluidAssetsProposal.decode(content.value, undefined, useInterfaces), useInterfaces) - }; - case "/osmosis.superfluid.v1beta1.RemoveSuperfluidAssetsProposal": - return { - type: "osmosis/v1beta1/remove-superfluid-assets-proposal", - value: RemoveSuperfluidAssetsProposal.toAmino(RemoveSuperfluidAssetsProposal.decode(content.value, undefined, useInterfaces), useInterfaces) - }; - case "/osmosis.superfluid.v1beta1.UpdateUnpoolWhiteListProposal": - return { - type: "osmosis/v1beta1/update-unpool-white-list-proposal", - value: UpdateUnpoolWhiteListProposal.toAmino(UpdateUnpoolWhiteListProposal.decode(content.value, undefined, useInterfaces), useInterfaces) - }; - case "/osmosis.txfees.v1beta1.UpdateFeeTokenProposal": - return { - type: "osmosis/txfees/update-fee-token-proposal", - value: UpdateFeeTokenProposal.toAmino(UpdateFeeTokenProposal.decode(content.value, undefined, useInterfaces), useInterfaces) - }; - default: - return Any.toAmino(content, useInterfaces); - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/cosmos/gov/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputv3/cosmos/gov/v1beta1/query.rpc.func.ts new file mode 100644 index 0000000000..82c36af15b --- /dev/null +++ b/__fixtures__/v-next/outputv3/cosmos/gov/v1beta1/query.rpc.func.ts @@ -0,0 +1,108 @@ +import { ProposalStatus, ProposalStatusSDKType, Proposal, ProposalSDKType, Vote, VoteSDKType, VotingParams, VotingParamsSDKType, DepositParams, DepositParamsSDKType, TallyParams, TallyParamsSDKType, Deposit, DepositSDKType, TallyResult, TallyResultSDKType } from "./gov"; +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +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"; +/** + * Proposal queries proposal details based on ProposalID. + * @name getProposal + * @package cosmos.gov.v1beta1 + * @see proto service: cosmos.gov.v1beta1.Proposal + */ +export const getProposal = buildQuery({ + encode: QueryProposalRequest.encode, + decode: QueryProposalResponse.decode, + service: "cosmos.gov.v1beta1.Query", + method: "Proposal", + deps: [QueryProposalRequest, QueryProposalResponse] +}); +/** + * Proposals queries all proposals based on given status. + * @name getProposals + * @package cosmos.gov.v1beta1 + * @see proto service: cosmos.gov.v1beta1.Proposals + */ +export const getProposals = buildQuery({ + encode: QueryProposalsRequest.encode, + decode: QueryProposalsResponse.decode, + service: "cosmos.gov.v1beta1.Query", + method: "Proposals", + deps: [QueryProposalsRequest, QueryProposalsResponse] +}); +/** + * Vote queries voted information based on proposalID, voterAddr. + * @name getVote + * @package cosmos.gov.v1beta1 + * @see proto service: cosmos.gov.v1beta1.Vote + */ +export const getVote = buildQuery({ + encode: QueryVoteRequest.encode, + decode: QueryVoteResponse.decode, + service: "cosmos.gov.v1beta1.Query", + method: "Vote", + deps: [QueryVoteRequest, QueryVoteResponse] +}); +/** + * Votes queries votes of a given proposal. + * @name getVotes + * @package cosmos.gov.v1beta1 + * @see proto service: cosmos.gov.v1beta1.Votes + */ +export const getVotes = buildQuery({ + encode: QueryVotesRequest.encode, + decode: QueryVotesResponse.decode, + service: "cosmos.gov.v1beta1.Query", + method: "Votes", + deps: [QueryVotesRequest, QueryVotesResponse] +}); +/** + * Params queries all parameters of the gov module. + * @name getParams + * @package cosmos.gov.v1beta1 + * @see proto service: cosmos.gov.v1beta1.Params + */ +export const getParams = buildQuery({ + encode: QueryParamsRequest.encode, + decode: QueryParamsResponse.decode, + service: "cosmos.gov.v1beta1.Query", + method: "Params", + deps: [QueryParamsRequest, QueryParamsResponse] +}); +/** + * Deposit queries single deposit information based proposalID, depositAddr. + * @name getDeposit + * @package cosmos.gov.v1beta1 + * @see proto service: cosmos.gov.v1beta1.Deposit + */ +export const getDeposit = buildQuery({ + encode: QueryDepositRequest.encode, + decode: QueryDepositResponse.decode, + service: "cosmos.gov.v1beta1.Query", + method: "Deposit", + deps: [QueryDepositRequest, QueryDepositResponse] +}); +/** + * Deposits queries all deposits of a single proposal. + * @name getDeposits + * @package cosmos.gov.v1beta1 + * @see proto service: cosmos.gov.v1beta1.Deposits + */ +export const getDeposits = buildQuery({ + encode: QueryDepositsRequest.encode, + decode: QueryDepositsResponse.decode, + service: "cosmos.gov.v1beta1.Query", + method: "Deposits", + deps: [QueryDepositsRequest, QueryDepositsResponse] +}); +/** + * TallyResult queries the tally of a proposal vote. + * @name getTallyResult + * @package cosmos.gov.v1beta1 + * @see proto service: cosmos.gov.v1beta1.TallyResult + */ +export const getTallyResult = buildQuery({ + encode: QueryTallyResultRequest.encode, + decode: QueryTallyResultResponse.decode, + service: "cosmos.gov.v1beta1.Query", + method: "TallyResult", + deps: [QueryTallyResultRequest, QueryTallyResultResponse] +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/cosmos/gov/v1beta1/query.ts b/__fixtures__/v-next/outputv3/cosmos/gov/v1beta1/query.ts index 3981931615..6ce1f9095d 100644 --- a/__fixtures__/v-next/outputv3/cosmos/gov/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv3/cosmos/gov/v1beta1/query.ts @@ -2,6 +2,7 @@ import { ProposalStatus, ProposalStatusSDKType, Proposal, ProposalAmino, Proposa import { PageRequest, PageRequestAmino, PageRequestSDKType, PageResponse, PageResponseAmino, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { isSet, DeepPartial } from "../../../helpers"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "cosmos.gov.v1beta1"; /** * QueryProposalRequest is the request type for the Query/Proposal RPC method. @@ -704,6 +705,15 @@ function createBaseQueryProposalRequest(): QueryProposalRequest { export const QueryProposalRequest = { typeUrl: "/cosmos.gov.v1beta1.QueryProposalRequest", aminoType: "cosmos-sdk/QueryProposalRequest", + is(o: any): o is QueryProposalRequest { + return o && (o.$typeUrl === QueryProposalRequest.typeUrl || typeof o.proposalId === "bigint"); + }, + isSDK(o: any): o is QueryProposalRequestSDKType { + return o && (o.$typeUrl === QueryProposalRequest.typeUrl || typeof o.proposal_id === "bigint"); + }, + isAmino(o: any): o is QueryProposalRequestAmino { + return o && (o.$typeUrl === QueryProposalRequest.typeUrl || typeof o.proposal_id === "bigint"); + }, encode(message: QueryProposalRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.proposalId !== BigInt(0)) { writer.uint32(8).uint64(message.proposalId); @@ -772,7 +782,8 @@ export const QueryProposalRequest = { typeUrl: "/cosmos.gov.v1beta1.QueryProposalRequest", value: QueryProposalRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryProposalResponse(): QueryProposalResponse { return { @@ -788,6 +799,15 @@ function createBaseQueryProposalResponse(): QueryProposalResponse { export const QueryProposalResponse = { typeUrl: "/cosmos.gov.v1beta1.QueryProposalResponse", aminoType: "cosmos-sdk/QueryProposalResponse", + is(o: any): o is QueryProposalResponse { + return o && (o.$typeUrl === QueryProposalResponse.typeUrl || Proposal.is(o.proposal)); + }, + isSDK(o: any): o is QueryProposalResponseSDKType { + return o && (o.$typeUrl === QueryProposalResponse.typeUrl || Proposal.isSDK(o.proposal)); + }, + isAmino(o: any): o is QueryProposalResponseAmino { + return o && (o.$typeUrl === QueryProposalResponse.typeUrl || Proposal.isAmino(o.proposal)); + }, encode(message: QueryProposalResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.proposal !== undefined) { Proposal.encode(message.proposal, writer.uint32(10).fork()).ldelim(); @@ -856,6 +876,12 @@ export const QueryProposalResponse = { typeUrl: "/cosmos.gov.v1beta1.QueryProposalResponse", value: QueryProposalResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryProposalResponse.typeUrl)) { + return; + } + Proposal.registerTypeUrl(); } }; function createBaseQueryProposalsRequest(): QueryProposalsRequest { @@ -875,6 +901,15 @@ function createBaseQueryProposalsRequest(): QueryProposalsRequest { export const QueryProposalsRequest = { typeUrl: "/cosmos.gov.v1beta1.QueryProposalsRequest", aminoType: "cosmos-sdk/QueryProposalsRequest", + is(o: any): o is QueryProposalsRequest { + return o && (o.$typeUrl === QueryProposalsRequest.typeUrl || isSet(o.proposalStatus) && typeof o.voter === "string" && typeof o.depositor === "string"); + }, + isSDK(o: any): o is QueryProposalsRequestSDKType { + return o && (o.$typeUrl === QueryProposalsRequest.typeUrl || isSet(o.proposal_status) && typeof o.voter === "string" && typeof o.depositor === "string"); + }, + isAmino(o: any): o is QueryProposalsRequestAmino { + return o && (o.$typeUrl === QueryProposalsRequest.typeUrl || isSet(o.proposal_status) && typeof o.voter === "string" && typeof o.depositor === "string"); + }, encode(message: QueryProposalsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.proposalStatus !== 0) { writer.uint32(8).int32(message.proposalStatus); @@ -985,6 +1020,12 @@ export const QueryProposalsRequest = { typeUrl: "/cosmos.gov.v1beta1.QueryProposalsRequest", value: QueryProposalsRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryProposalsRequest.typeUrl)) { + return; + } + PageRequest.registerTypeUrl(); } }; function createBaseQueryProposalsResponse(): QueryProposalsResponse { @@ -1003,6 +1044,15 @@ function createBaseQueryProposalsResponse(): QueryProposalsResponse { export const QueryProposalsResponse = { typeUrl: "/cosmos.gov.v1beta1.QueryProposalsResponse", aminoType: "cosmos-sdk/QueryProposalsResponse", + is(o: any): o is QueryProposalsResponse { + return o && (o.$typeUrl === QueryProposalsResponse.typeUrl || Array.isArray(o.proposals) && (!o.proposals.length || Proposal.is(o.proposals[0]))); + }, + isSDK(o: any): o is QueryProposalsResponseSDKType { + return o && (o.$typeUrl === QueryProposalsResponse.typeUrl || Array.isArray(o.proposals) && (!o.proposals.length || Proposal.isSDK(o.proposals[0]))); + }, + isAmino(o: any): o is QueryProposalsResponseAmino { + return o && (o.$typeUrl === QueryProposalsResponse.typeUrl || Array.isArray(o.proposals) && (!o.proposals.length || Proposal.isAmino(o.proposals[0]))); + }, encode(message: QueryProposalsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.proposals) { Proposal.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -1091,6 +1141,13 @@ export const QueryProposalsResponse = { typeUrl: "/cosmos.gov.v1beta1.QueryProposalsResponse", value: QueryProposalsResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryProposalsResponse.typeUrl)) { + return; + } + Proposal.registerTypeUrl(); + PageResponse.registerTypeUrl(); } }; function createBaseQueryVoteRequest(): QueryVoteRequest { @@ -1108,6 +1165,15 @@ function createBaseQueryVoteRequest(): QueryVoteRequest { export const QueryVoteRequest = { typeUrl: "/cosmos.gov.v1beta1.QueryVoteRequest", aminoType: "cosmos-sdk/QueryVoteRequest", + is(o: any): o is QueryVoteRequest { + return o && (o.$typeUrl === QueryVoteRequest.typeUrl || typeof o.proposalId === "bigint" && typeof o.voter === "string"); + }, + isSDK(o: any): o is QueryVoteRequestSDKType { + return o && (o.$typeUrl === QueryVoteRequest.typeUrl || typeof o.proposal_id === "bigint" && typeof o.voter === "string"); + }, + isAmino(o: any): o is QueryVoteRequestAmino { + return o && (o.$typeUrl === QueryVoteRequest.typeUrl || typeof o.proposal_id === "bigint" && typeof o.voter === "string"); + }, encode(message: QueryVoteRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.proposalId !== BigInt(0)) { writer.uint32(8).uint64(message.proposalId); @@ -1190,7 +1256,8 @@ export const QueryVoteRequest = { typeUrl: "/cosmos.gov.v1beta1.QueryVoteRequest", value: QueryVoteRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryVoteResponse(): QueryVoteResponse { return { @@ -1206,6 +1273,15 @@ function createBaseQueryVoteResponse(): QueryVoteResponse { export const QueryVoteResponse = { typeUrl: "/cosmos.gov.v1beta1.QueryVoteResponse", aminoType: "cosmos-sdk/QueryVoteResponse", + is(o: any): o is QueryVoteResponse { + return o && (o.$typeUrl === QueryVoteResponse.typeUrl || Vote.is(o.vote)); + }, + isSDK(o: any): o is QueryVoteResponseSDKType { + return o && (o.$typeUrl === QueryVoteResponse.typeUrl || Vote.isSDK(o.vote)); + }, + isAmino(o: any): o is QueryVoteResponseAmino { + return o && (o.$typeUrl === QueryVoteResponse.typeUrl || Vote.isAmino(o.vote)); + }, encode(message: QueryVoteResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.vote !== undefined) { Vote.encode(message.vote, writer.uint32(10).fork()).ldelim(); @@ -1274,6 +1350,12 @@ export const QueryVoteResponse = { typeUrl: "/cosmos.gov.v1beta1.QueryVoteResponse", value: QueryVoteResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryVoteResponse.typeUrl)) { + return; + } + Vote.registerTypeUrl(); } }; function createBaseQueryVotesRequest(): QueryVotesRequest { @@ -1291,6 +1373,15 @@ function createBaseQueryVotesRequest(): QueryVotesRequest { export const QueryVotesRequest = { typeUrl: "/cosmos.gov.v1beta1.QueryVotesRequest", aminoType: "cosmos-sdk/QueryVotesRequest", + is(o: any): o is QueryVotesRequest { + return o && (o.$typeUrl === QueryVotesRequest.typeUrl || typeof o.proposalId === "bigint"); + }, + isSDK(o: any): o is QueryVotesRequestSDKType { + return o && (o.$typeUrl === QueryVotesRequest.typeUrl || typeof o.proposal_id === "bigint"); + }, + isAmino(o: any): o is QueryVotesRequestAmino { + return o && (o.$typeUrl === QueryVotesRequest.typeUrl || typeof o.proposal_id === "bigint"); + }, encode(message: QueryVotesRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.proposalId !== BigInt(0)) { writer.uint32(8).uint64(message.proposalId); @@ -1375,6 +1466,12 @@ export const QueryVotesRequest = { typeUrl: "/cosmos.gov.v1beta1.QueryVotesRequest", value: QueryVotesRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryVotesRequest.typeUrl)) { + return; + } + PageRequest.registerTypeUrl(); } }; function createBaseQueryVotesResponse(): QueryVotesResponse { @@ -1392,6 +1489,15 @@ function createBaseQueryVotesResponse(): QueryVotesResponse { export const QueryVotesResponse = { typeUrl: "/cosmos.gov.v1beta1.QueryVotesResponse", aminoType: "cosmos-sdk/QueryVotesResponse", + is(o: any): o is QueryVotesResponse { + return o && (o.$typeUrl === QueryVotesResponse.typeUrl || Array.isArray(o.votes) && (!o.votes.length || Vote.is(o.votes[0]))); + }, + isSDK(o: any): o is QueryVotesResponseSDKType { + return o && (o.$typeUrl === QueryVotesResponse.typeUrl || Array.isArray(o.votes) && (!o.votes.length || Vote.isSDK(o.votes[0]))); + }, + isAmino(o: any): o is QueryVotesResponseAmino { + return o && (o.$typeUrl === QueryVotesResponse.typeUrl || Array.isArray(o.votes) && (!o.votes.length || Vote.isAmino(o.votes[0]))); + }, encode(message: QueryVotesResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.votes) { Vote.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -1480,6 +1586,13 @@ export const QueryVotesResponse = { typeUrl: "/cosmos.gov.v1beta1.QueryVotesResponse", value: QueryVotesResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryVotesResponse.typeUrl)) { + return; + } + Vote.registerTypeUrl(); + PageResponse.registerTypeUrl(); } }; function createBaseQueryParamsRequest(): QueryParamsRequest { @@ -1496,6 +1609,15 @@ function createBaseQueryParamsRequest(): QueryParamsRequest { export const QueryParamsRequest = { typeUrl: "/cosmos.gov.v1beta1.QueryParamsRequest", aminoType: "cosmos-sdk/QueryParamsRequest", + is(o: any): o is QueryParamsRequest { + return o && (o.$typeUrl === QueryParamsRequest.typeUrl || typeof o.paramsType === "string"); + }, + isSDK(o: any): o is QueryParamsRequestSDKType { + return o && (o.$typeUrl === QueryParamsRequest.typeUrl || typeof o.params_type === "string"); + }, + isAmino(o: any): o is QueryParamsRequestAmino { + return o && (o.$typeUrl === QueryParamsRequest.typeUrl || typeof o.params_type === "string"); + }, encode(message: QueryParamsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.paramsType !== "") { writer.uint32(10).string(message.paramsType); @@ -1562,7 +1684,8 @@ export const QueryParamsRequest = { typeUrl: "/cosmos.gov.v1beta1.QueryParamsRequest", value: QueryParamsRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryParamsResponse(): QueryParamsResponse { return { @@ -1580,6 +1703,15 @@ function createBaseQueryParamsResponse(): QueryParamsResponse { export const QueryParamsResponse = { typeUrl: "/cosmos.gov.v1beta1.QueryParamsResponse", aminoType: "cosmos-sdk/QueryParamsResponse", + is(o: any): o is QueryParamsResponse { + return o && (o.$typeUrl === QueryParamsResponse.typeUrl || VotingParams.is(o.votingParams) && DepositParams.is(o.depositParams) && TallyParams.is(o.tallyParams)); + }, + isSDK(o: any): o is QueryParamsResponseSDKType { + return o && (o.$typeUrl === QueryParamsResponse.typeUrl || VotingParams.isSDK(o.voting_params) && DepositParams.isSDK(o.deposit_params) && TallyParams.isSDK(o.tally_params)); + }, + isAmino(o: any): o is QueryParamsResponseAmino { + return o && (o.$typeUrl === QueryParamsResponse.typeUrl || VotingParams.isAmino(o.voting_params) && DepositParams.isAmino(o.deposit_params) && TallyParams.isAmino(o.tally_params)); + }, encode(message: QueryParamsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.votingParams !== undefined) { VotingParams.encode(message.votingParams, writer.uint32(10).fork()).ldelim(); @@ -1680,6 +1812,14 @@ export const QueryParamsResponse = { typeUrl: "/cosmos.gov.v1beta1.QueryParamsResponse", value: QueryParamsResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryParamsResponse.typeUrl)) { + return; + } + VotingParams.registerTypeUrl(); + DepositParams.registerTypeUrl(); + TallyParams.registerTypeUrl(); } }; function createBaseQueryDepositRequest(): QueryDepositRequest { @@ -1697,6 +1837,15 @@ function createBaseQueryDepositRequest(): QueryDepositRequest { export const QueryDepositRequest = { typeUrl: "/cosmos.gov.v1beta1.QueryDepositRequest", aminoType: "cosmos-sdk/QueryDepositRequest", + is(o: any): o is QueryDepositRequest { + return o && (o.$typeUrl === QueryDepositRequest.typeUrl || typeof o.proposalId === "bigint" && typeof o.depositor === "string"); + }, + isSDK(o: any): o is QueryDepositRequestSDKType { + return o && (o.$typeUrl === QueryDepositRequest.typeUrl || typeof o.proposal_id === "bigint" && typeof o.depositor === "string"); + }, + isAmino(o: any): o is QueryDepositRequestAmino { + return o && (o.$typeUrl === QueryDepositRequest.typeUrl || typeof o.proposal_id === "bigint" && typeof o.depositor === "string"); + }, encode(message: QueryDepositRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.proposalId !== BigInt(0)) { writer.uint32(8).uint64(message.proposalId); @@ -1779,7 +1928,8 @@ export const QueryDepositRequest = { typeUrl: "/cosmos.gov.v1beta1.QueryDepositRequest", value: QueryDepositRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryDepositResponse(): QueryDepositResponse { return { @@ -1795,6 +1945,15 @@ function createBaseQueryDepositResponse(): QueryDepositResponse { export const QueryDepositResponse = { typeUrl: "/cosmos.gov.v1beta1.QueryDepositResponse", aminoType: "cosmos-sdk/QueryDepositResponse", + is(o: any): o is QueryDepositResponse { + return o && (o.$typeUrl === QueryDepositResponse.typeUrl || Deposit.is(o.deposit)); + }, + isSDK(o: any): o is QueryDepositResponseSDKType { + return o && (o.$typeUrl === QueryDepositResponse.typeUrl || Deposit.isSDK(o.deposit)); + }, + isAmino(o: any): o is QueryDepositResponseAmino { + return o && (o.$typeUrl === QueryDepositResponse.typeUrl || Deposit.isAmino(o.deposit)); + }, encode(message: QueryDepositResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.deposit !== undefined) { Deposit.encode(message.deposit, writer.uint32(10).fork()).ldelim(); @@ -1863,6 +2022,12 @@ export const QueryDepositResponse = { typeUrl: "/cosmos.gov.v1beta1.QueryDepositResponse", value: QueryDepositResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryDepositResponse.typeUrl)) { + return; + } + Deposit.registerTypeUrl(); } }; function createBaseQueryDepositsRequest(): QueryDepositsRequest { @@ -1880,6 +2045,15 @@ function createBaseQueryDepositsRequest(): QueryDepositsRequest { export const QueryDepositsRequest = { typeUrl: "/cosmos.gov.v1beta1.QueryDepositsRequest", aminoType: "cosmos-sdk/QueryDepositsRequest", + is(o: any): o is QueryDepositsRequest { + return o && (o.$typeUrl === QueryDepositsRequest.typeUrl || typeof o.proposalId === "bigint"); + }, + isSDK(o: any): o is QueryDepositsRequestSDKType { + return o && (o.$typeUrl === QueryDepositsRequest.typeUrl || typeof o.proposal_id === "bigint"); + }, + isAmino(o: any): o is QueryDepositsRequestAmino { + return o && (o.$typeUrl === QueryDepositsRequest.typeUrl || typeof o.proposal_id === "bigint"); + }, encode(message: QueryDepositsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.proposalId !== BigInt(0)) { writer.uint32(8).uint64(message.proposalId); @@ -1964,6 +2138,12 @@ export const QueryDepositsRequest = { typeUrl: "/cosmos.gov.v1beta1.QueryDepositsRequest", value: QueryDepositsRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryDepositsRequest.typeUrl)) { + return; + } + PageRequest.registerTypeUrl(); } }; function createBaseQueryDepositsResponse(): QueryDepositsResponse { @@ -1981,6 +2161,15 @@ function createBaseQueryDepositsResponse(): QueryDepositsResponse { export const QueryDepositsResponse = { typeUrl: "/cosmos.gov.v1beta1.QueryDepositsResponse", aminoType: "cosmos-sdk/QueryDepositsResponse", + is(o: any): o is QueryDepositsResponse { + return o && (o.$typeUrl === QueryDepositsResponse.typeUrl || Array.isArray(o.deposits) && (!o.deposits.length || Deposit.is(o.deposits[0]))); + }, + isSDK(o: any): o is QueryDepositsResponseSDKType { + return o && (o.$typeUrl === QueryDepositsResponse.typeUrl || Array.isArray(o.deposits) && (!o.deposits.length || Deposit.isSDK(o.deposits[0]))); + }, + isAmino(o: any): o is QueryDepositsResponseAmino { + return o && (o.$typeUrl === QueryDepositsResponse.typeUrl || Array.isArray(o.deposits) && (!o.deposits.length || Deposit.isAmino(o.deposits[0]))); + }, encode(message: QueryDepositsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.deposits) { Deposit.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -2069,6 +2258,13 @@ export const QueryDepositsResponse = { typeUrl: "/cosmos.gov.v1beta1.QueryDepositsResponse", value: QueryDepositsResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryDepositsResponse.typeUrl)) { + return; + } + Deposit.registerTypeUrl(); + PageResponse.registerTypeUrl(); } }; function createBaseQueryTallyResultRequest(): QueryTallyResultRequest { @@ -2085,6 +2281,15 @@ function createBaseQueryTallyResultRequest(): QueryTallyResultRequest { export const QueryTallyResultRequest = { typeUrl: "/cosmos.gov.v1beta1.QueryTallyResultRequest", aminoType: "cosmos-sdk/QueryTallyResultRequest", + is(o: any): o is QueryTallyResultRequest { + return o && (o.$typeUrl === QueryTallyResultRequest.typeUrl || typeof o.proposalId === "bigint"); + }, + isSDK(o: any): o is QueryTallyResultRequestSDKType { + return o && (o.$typeUrl === QueryTallyResultRequest.typeUrl || typeof o.proposal_id === "bigint"); + }, + isAmino(o: any): o is QueryTallyResultRequestAmino { + return o && (o.$typeUrl === QueryTallyResultRequest.typeUrl || typeof o.proposal_id === "bigint"); + }, encode(message: QueryTallyResultRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.proposalId !== BigInt(0)) { writer.uint32(8).uint64(message.proposalId); @@ -2153,7 +2358,8 @@ export const QueryTallyResultRequest = { typeUrl: "/cosmos.gov.v1beta1.QueryTallyResultRequest", value: QueryTallyResultRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryTallyResultResponse(): QueryTallyResultResponse { return { @@ -2169,6 +2375,15 @@ function createBaseQueryTallyResultResponse(): QueryTallyResultResponse { export const QueryTallyResultResponse = { typeUrl: "/cosmos.gov.v1beta1.QueryTallyResultResponse", aminoType: "cosmos-sdk/QueryTallyResultResponse", + is(o: any): o is QueryTallyResultResponse { + return o && (o.$typeUrl === QueryTallyResultResponse.typeUrl || TallyResult.is(o.tally)); + }, + isSDK(o: any): o is QueryTallyResultResponseSDKType { + return o && (o.$typeUrl === QueryTallyResultResponse.typeUrl || TallyResult.isSDK(o.tally)); + }, + isAmino(o: any): o is QueryTallyResultResponseAmino { + return o && (o.$typeUrl === QueryTallyResultResponse.typeUrl || TallyResult.isAmino(o.tally)); + }, encode(message: QueryTallyResultResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.tally !== undefined) { TallyResult.encode(message.tally, writer.uint32(10).fork()).ldelim(); @@ -2237,5 +2452,11 @@ export const QueryTallyResultResponse = { typeUrl: "/cosmos.gov.v1beta1.QueryTallyResultResponse", value: QueryTallyResultResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryTallyResultResponse.typeUrl)) { + return; + } + TallyResult.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/cosmos/gov/v1beta1/tx.registry.ts b/__fixtures__/v-next/outputv3/cosmos/gov/v1beta1/tx.registry.ts index f2379ed7a1..a40a844bcc 100644 --- a/__fixtures__/v-next/outputv3/cosmos/gov/v1beta1/tx.registry.ts +++ b/__fixtures__/v-next/outputv3/cosmos/gov/v1beta1/tx.registry.ts @@ -6,14 +6,9 @@ import { ClientUpdateProposal, ClientUpdateProposalSDKType, UpgradeProposal, Upg import { ReplacePoolIncentivesProposal, ReplacePoolIncentivesProposalSDKType, UpdatePoolIncentivesProposal, UpdatePoolIncentivesProposalSDKType } from "../../../osmosis/pool-incentives/v1beta1/gov"; import { SetSuperfluidAssetsProposal, SetSuperfluidAssetsProposalSDKType, RemoveSuperfluidAssetsProposal, RemoveSuperfluidAssetsProposalSDKType, UpdateUnpoolWhiteListProposal, UpdateUnpoolWhiteListProposalSDKType } from "../../../osmosis/superfluid/v1beta1/gov"; import { UpdateFeeTokenProposal, UpdateFeeTokenProposalSDKType } from "../../../osmosis/txfees/v1beta1/gov"; -import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { TelescopeGeneratedType } from "../../../types"; import { MsgSubmitProposal, MsgSubmitProposalSDKType, MsgVote, MsgVoteSDKType, MsgVoteWeighted, MsgVoteWeightedSDKType, MsgDeposit, MsgDepositSDKType } from "./tx"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/cosmos.gov.v1beta1.MsgSubmitProposal", MsgSubmitProposal], ["/cosmos.gov.v1beta1.MsgVote", MsgVote], ["/cosmos.gov.v1beta1.MsgVoteWeighted", MsgVoteWeighted], ["/cosmos.gov.v1beta1.MsgDeposit", MsgDeposit]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/cosmos.gov.v1beta1.MsgSubmitProposal", MsgSubmitProposal], ["/cosmos.gov.v1beta1.MsgVote", MsgVote], ["/cosmos.gov.v1beta1.MsgVoteWeighted", MsgVoteWeighted], ["/cosmos.gov.v1beta1.MsgDeposit", MsgDeposit]]; export const MessageComposer = { encoded: { submitProposal(value: MsgSubmitProposal) { diff --git a/__fixtures__/v-next/outputv3/cosmos/gov/v1beta1/tx.rpc.func.ts b/__fixtures__/v-next/outputv3/cosmos/gov/v1beta1/tx.rpc.func.ts new file mode 100644 index 0000000000..cdcb765417 --- /dev/null +++ b/__fixtures__/v-next/outputv3/cosmos/gov/v1beta1/tx.rpc.func.ts @@ -0,0 +1,48 @@ +import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../google/protobuf/any"; +import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; +import { VoteOption, VoteOptionSDKType, WeightedVoteOption, WeightedVoteOptionSDKType, TextProposal, TextProposalSDKType } from "./gov"; +import { RegisterIncentiveProposal, RegisterIncentiveProposalSDKType } from "../../../evmos/incentives/v1/incentives"; +import { ClientUpdateProposal, ClientUpdateProposalSDKType, UpgradeProposal, UpgradeProposalSDKType } from "../../../ibc/core/client/v1/client"; +import { ReplacePoolIncentivesProposal, ReplacePoolIncentivesProposalSDKType, UpdatePoolIncentivesProposal, UpdatePoolIncentivesProposalSDKType } from "../../../osmosis/pool-incentives/v1beta1/gov"; +import { SetSuperfluidAssetsProposal, SetSuperfluidAssetsProposalSDKType, RemoveSuperfluidAssetsProposal, RemoveSuperfluidAssetsProposalSDKType, UpdateUnpoolWhiteListProposal, UpdateUnpoolWhiteListProposalSDKType } from "../../../osmosis/superfluid/v1beta1/gov"; +import { UpdateFeeTokenProposal, UpdateFeeTokenProposalSDKType } from "../../../osmosis/txfees/v1beta1/gov"; +import { buildTx } from "../../../helper-func-types"; +import { MsgSubmitProposal, MsgSubmitProposalSDKType, MsgSubmitProposalResponse, MsgSubmitProposalResponseSDKType, MsgVote, MsgVoteSDKType, MsgVoteResponse, MsgVoteResponseSDKType, MsgVoteWeighted, MsgVoteWeightedSDKType, MsgVoteWeightedResponse, MsgVoteWeightedResponseSDKType, MsgDeposit, MsgDepositSDKType, MsgDepositResponse, MsgDepositResponseSDKType } from "./tx"; +/** + * SubmitProposal defines a method to create new proposal given a content. + * @name submitProposal + * @package cosmos.gov.v1beta1 + * @see proto service: cosmos.gov.v1beta1.SubmitProposal + */ +export const submitProposal = buildTx({ + msg: MsgSubmitProposal +}); +/** + * Vote defines a method to add a vote on a specific proposal. + * @name vote + * @package cosmos.gov.v1beta1 + * @see proto service: cosmos.gov.v1beta1.Vote + */ +export const vote = buildTx({ + msg: MsgVote +}); +/** + * VoteWeighted defines a method to add a weighted vote on a specific proposal. + * + * Since: cosmos-sdk 0.43 + * @name voteWeighted + * @package cosmos.gov.v1beta1 + * @see proto service: cosmos.gov.v1beta1.VoteWeighted + */ +export const voteWeighted = buildTx({ + msg: MsgVoteWeighted +}); +/** + * Deposit defines a method to add deposit on a specific proposal. + * @name deposit + * @package cosmos.gov.v1beta1 + * @see proto service: cosmos.gov.v1beta1.Deposit + */ +export const deposit = buildTx({ + msg: MsgDeposit +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/cosmos/gov/v1beta1/tx.ts b/__fixtures__/v-next/outputv3/cosmos/gov/v1beta1/tx.ts index 534d3022dc..f46142d0de 100644 --- a/__fixtures__/v-next/outputv3/cosmos/gov/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputv3/cosmos/gov/v1beta1/tx.ts @@ -7,6 +7,7 @@ import { ReplacePoolIncentivesProposal, ReplacePoolIncentivesProposalProtoMsg, R import { SetSuperfluidAssetsProposal, SetSuperfluidAssetsProposalProtoMsg, SetSuperfluidAssetsProposalSDKType, RemoveSuperfluidAssetsProposal, RemoveSuperfluidAssetsProposalProtoMsg, RemoveSuperfluidAssetsProposalSDKType, UpdateUnpoolWhiteListProposal, UpdateUnpoolWhiteListProposalProtoMsg, UpdateUnpoolWhiteListProposalSDKType } from "../../../osmosis/superfluid/v1beta1/gov"; import { UpdateFeeTokenProposal, UpdateFeeTokenProposalProtoMsg, UpdateFeeTokenProposalSDKType } from "../../../osmosis/txfees/v1beta1/gov"; import { BinaryReader, BinaryWriter } from "../../../binary"; +import { GlobalDecoderRegistry } from "../../../registry"; import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "cosmos.gov.v1beta1"; /** @@ -298,9 +299,18 @@ function createBaseMsgSubmitProposal(): MsgSubmitProposal { export const MsgSubmitProposal = { typeUrl: "/cosmos.gov.v1beta1.MsgSubmitProposal", aminoType: "cosmos-sdk/MsgSubmitProposal", + is(o: any): o is MsgSubmitProposal { + return o && (o.$typeUrl === MsgSubmitProposal.typeUrl || Array.isArray(o.initialDeposit) && (!o.initialDeposit.length || Coin.is(o.initialDeposit[0])) && typeof o.proposer === "string"); + }, + isSDK(o: any): o is MsgSubmitProposalSDKType { + return o && (o.$typeUrl === MsgSubmitProposal.typeUrl || Array.isArray(o.initial_deposit) && (!o.initial_deposit.length || Coin.isSDK(o.initial_deposit[0])) && typeof o.proposer === "string"); + }, + isAmino(o: any): o is MsgSubmitProposalAmino { + return o && (o.$typeUrl === MsgSubmitProposal.typeUrl || Array.isArray(o.initial_deposit) && (!o.initial_deposit.length || Coin.isAmino(o.initial_deposit[0])) && typeof o.proposer === "string"); + }, encode(message: MsgSubmitProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.content !== undefined) { - Any.encode((message.content as Any), writer.uint32(10).fork()).ldelim(); + Any.encode(GlobalDecoderRegistry.wrapAny(message.content), writer.uint32(10).fork()).ldelim(); } for (const v of message.initialDeposit) { Coin.encode(v!, writer.uint32(18).fork()).ldelim(); @@ -318,7 +328,7 @@ export const MsgSubmitProposal = { const tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.content = useInterfaces ? (ProposalContentI_InterfaceDecoder(reader) as Any) : Any.decode(reader, reader.uint32(), useInterfaces); + message.content = GlobalDecoderRegistry.unwrapAny(reader); break; case 2: message.initialDeposit.push(Coin.decode(reader, reader.uint32(), useInterfaces)); @@ -335,7 +345,7 @@ export const MsgSubmitProposal = { }, fromJSON(object: any): MsgSubmitProposal { const obj = createBaseMsgSubmitProposal(); - if (isSet(object.content)) obj.content = Any.fromJSON(object.content); + if (isSet(object.content)) obj.content = GlobalDecoderRegistry.fromJSON(object.content); if (Array.isArray(object?.initialDeposit)) obj.initialDeposit = object.initialDeposit.map((e: any) => Coin.fromJSON(e)); if (isSet(object.proposer)) obj.proposer = String(object.proposer); return obj; @@ -343,7 +353,7 @@ export const MsgSubmitProposal = { fromPartial(object: DeepPartial): MsgSubmitProposal { const message = createBaseMsgSubmitProposal(); if (object.content !== undefined && object.content !== null) { - message.content = Any.fromPartial(object.content); + message.content = GlobalDecoderRegistry.fromPartial(object.content); } message.initialDeposit = object.initialDeposit?.map(e => Coin.fromPartial(e)) || []; message.proposer = object.proposer ?? ""; @@ -351,14 +361,14 @@ export const MsgSubmitProposal = { }, fromSDK(object: MsgSubmitProposalSDKType): MsgSubmitProposal { return { - content: object.content ? Any.fromSDK(object.content) : undefined, + content: object.content ? GlobalDecoderRegistry.fromSDK(object.content) : undefined, initialDeposit: Array.isArray(object?.initial_deposit) ? object.initial_deposit.map((e: any) => Coin.fromSDK(e)) : [], proposer: object?.proposer }; }, toSDK(message: MsgSubmitProposal): MsgSubmitProposalSDKType { const obj: any = {}; - message.content !== undefined && (obj.content = message.content ? Any.toSDK(message.content) : undefined); + message.content !== undefined && (obj.content = message.content ? GlobalDecoderRegistry.toSDK(message.content) : undefined); if (message.initialDeposit) { obj.initial_deposit = message.initialDeposit.map(e => e ? Coin.toSDK(e) : undefined); } else { @@ -370,7 +380,7 @@ export const MsgSubmitProposal = { fromAmino(object: MsgSubmitProposalAmino): MsgSubmitProposal { const message = createBaseMsgSubmitProposal(); if (object.content !== undefined && object.content !== null) { - message.content = ProposalContentI_FromAmino(object.content); + message.content = GlobalDecoderRegistry.fromAminoMsg(object.content); } message.initialDeposit = object.initial_deposit?.map(e => Coin.fromAmino(e)) || []; if (object.proposer !== undefined && object.proposer !== null) { @@ -380,7 +390,7 @@ export const MsgSubmitProposal = { }, toAmino(message: MsgSubmitProposal, useInterfaces: boolean = true): MsgSubmitProposalAmino { const obj: any = {}; - obj.content = message.content ? ProposalContentI_ToAmino((message.content as Any), useInterfaces) : undefined; + obj.content = message.content ? GlobalDecoderRegistry.toAminoMsg(message.content) : undefined; if (message.initialDeposit) { obj.initial_deposit = message.initialDeposit.map(e => e ? Coin.toAmino(e, useInterfaces) : undefined); } else { @@ -400,6 +410,22 @@ export const MsgSubmitProposal = { typeUrl: "/cosmos.gov.v1beta1.MsgSubmitProposal", value: MsgSubmitProposal.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgSubmitProposal.typeUrl)) { + return; + } + TextProposal.registerTypeUrl(); + RegisterIncentiveProposal.registerTypeUrl(); + ClientUpdateProposal.registerTypeUrl(); + UpgradeProposal.registerTypeUrl(); + ReplacePoolIncentivesProposal.registerTypeUrl(); + UpdatePoolIncentivesProposal.registerTypeUrl(); + SetSuperfluidAssetsProposal.registerTypeUrl(); + RemoveSuperfluidAssetsProposal.registerTypeUrl(); + UpdateUnpoolWhiteListProposal.registerTypeUrl(); + UpdateFeeTokenProposal.registerTypeUrl(); + Coin.registerTypeUrl(); } }; function createBaseMsgSubmitProposalResponse(): MsgSubmitProposalResponse { @@ -416,6 +442,15 @@ function createBaseMsgSubmitProposalResponse(): MsgSubmitProposalResponse { export const MsgSubmitProposalResponse = { typeUrl: "/cosmos.gov.v1beta1.MsgSubmitProposalResponse", aminoType: "cosmos-sdk/MsgSubmitProposalResponse", + is(o: any): o is MsgSubmitProposalResponse { + return o && (o.$typeUrl === MsgSubmitProposalResponse.typeUrl || typeof o.proposalId === "bigint"); + }, + isSDK(o: any): o is MsgSubmitProposalResponseSDKType { + return o && (o.$typeUrl === MsgSubmitProposalResponse.typeUrl || typeof o.proposal_id === "bigint"); + }, + isAmino(o: any): o is MsgSubmitProposalResponseAmino { + return o && (o.$typeUrl === MsgSubmitProposalResponse.typeUrl || typeof o.proposal_id === "bigint"); + }, encode(message: MsgSubmitProposalResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.proposalId !== BigInt(0)) { writer.uint32(8).uint64(message.proposalId); @@ -484,7 +519,8 @@ export const MsgSubmitProposalResponse = { typeUrl: "/cosmos.gov.v1beta1.MsgSubmitProposalResponse", value: MsgSubmitProposalResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgVote(): MsgVote { return { @@ -502,6 +538,15 @@ function createBaseMsgVote(): MsgVote { export const MsgVote = { typeUrl: "/cosmos.gov.v1beta1.MsgVote", aminoType: "cosmos-sdk/MsgVote", + is(o: any): o is MsgVote { + return o && (o.$typeUrl === MsgVote.typeUrl || typeof o.proposalId === "bigint" && typeof o.voter === "string" && isSet(o.option)); + }, + isSDK(o: any): o is MsgVoteSDKType { + return o && (o.$typeUrl === MsgVote.typeUrl || typeof o.proposal_id === "bigint" && typeof o.voter === "string" && isSet(o.option)); + }, + isAmino(o: any): o is MsgVoteAmino { + return o && (o.$typeUrl === MsgVote.typeUrl || typeof o.proposal_id === "bigint" && typeof o.voter === "string" && isSet(o.option)); + }, encode(message: MsgVote, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.proposalId !== BigInt(0)) { writer.uint32(8).uint64(message.proposalId); @@ -598,7 +643,8 @@ export const MsgVote = { typeUrl: "/cosmos.gov.v1beta1.MsgVote", value: MsgVote.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgVoteResponse(): MsgVoteResponse { return {}; @@ -612,6 +658,15 @@ function createBaseMsgVoteResponse(): MsgVoteResponse { export const MsgVoteResponse = { typeUrl: "/cosmos.gov.v1beta1.MsgVoteResponse", aminoType: "cosmos-sdk/MsgVoteResponse", + is(o: any): o is MsgVoteResponse { + return o && o.$typeUrl === MsgVoteResponse.typeUrl; + }, + isSDK(o: any): o is MsgVoteResponseSDKType { + return o && o.$typeUrl === MsgVoteResponse.typeUrl; + }, + isAmino(o: any): o is MsgVoteResponseAmino { + return o && o.$typeUrl === MsgVoteResponse.typeUrl; + }, encode(_: MsgVoteResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -663,7 +718,8 @@ export const MsgVoteResponse = { typeUrl: "/cosmos.gov.v1beta1.MsgVoteResponse", value: MsgVoteResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgVoteWeighted(): MsgVoteWeighted { return { @@ -683,6 +739,15 @@ function createBaseMsgVoteWeighted(): MsgVoteWeighted { export const MsgVoteWeighted = { typeUrl: "/cosmos.gov.v1beta1.MsgVoteWeighted", aminoType: "cosmos-sdk/MsgVoteWeighted", + is(o: any): o is MsgVoteWeighted { + return o && (o.$typeUrl === MsgVoteWeighted.typeUrl || typeof o.proposalId === "bigint" && typeof o.voter === "string" && Array.isArray(o.options) && (!o.options.length || WeightedVoteOption.is(o.options[0]))); + }, + isSDK(o: any): o is MsgVoteWeightedSDKType { + return o && (o.$typeUrl === MsgVoteWeighted.typeUrl || typeof o.proposal_id === "bigint" && typeof o.voter === "string" && Array.isArray(o.options) && (!o.options.length || WeightedVoteOption.isSDK(o.options[0]))); + }, + isAmino(o: any): o is MsgVoteWeightedAmino { + return o && (o.$typeUrl === MsgVoteWeighted.typeUrl || typeof o.proposal_id === "bigint" && typeof o.voter === "string" && Array.isArray(o.options) && (!o.options.length || WeightedVoteOption.isAmino(o.options[0]))); + }, encode(message: MsgVoteWeighted, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.proposalId !== BigInt(0)) { writer.uint32(8).uint64(message.proposalId); @@ -785,6 +850,12 @@ export const MsgVoteWeighted = { typeUrl: "/cosmos.gov.v1beta1.MsgVoteWeighted", value: MsgVoteWeighted.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgVoteWeighted.typeUrl)) { + return; + } + WeightedVoteOption.registerTypeUrl(); } }; function createBaseMsgVoteWeightedResponse(): MsgVoteWeightedResponse { @@ -801,6 +872,15 @@ function createBaseMsgVoteWeightedResponse(): MsgVoteWeightedResponse { export const MsgVoteWeightedResponse = { typeUrl: "/cosmos.gov.v1beta1.MsgVoteWeightedResponse", aminoType: "cosmos-sdk/MsgVoteWeightedResponse", + is(o: any): o is MsgVoteWeightedResponse { + return o && o.$typeUrl === MsgVoteWeightedResponse.typeUrl; + }, + isSDK(o: any): o is MsgVoteWeightedResponseSDKType { + return o && o.$typeUrl === MsgVoteWeightedResponse.typeUrl; + }, + isAmino(o: any): o is MsgVoteWeightedResponseAmino { + return o && o.$typeUrl === MsgVoteWeightedResponse.typeUrl; + }, encode(_: MsgVoteWeightedResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -852,7 +932,8 @@ export const MsgVoteWeightedResponse = { typeUrl: "/cosmos.gov.v1beta1.MsgVoteWeightedResponse", value: MsgVoteWeightedResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgDeposit(): MsgDeposit { return { @@ -870,6 +951,15 @@ function createBaseMsgDeposit(): MsgDeposit { export const MsgDeposit = { typeUrl: "/cosmos.gov.v1beta1.MsgDeposit", aminoType: "cosmos-sdk/MsgDeposit", + is(o: any): o is MsgDeposit { + return o && (o.$typeUrl === MsgDeposit.typeUrl || typeof o.proposalId === "bigint" && typeof o.depositor === "string" && Array.isArray(o.amount) && (!o.amount.length || Coin.is(o.amount[0]))); + }, + isSDK(o: any): o is MsgDepositSDKType { + return o && (o.$typeUrl === MsgDeposit.typeUrl || typeof o.proposal_id === "bigint" && typeof o.depositor === "string" && Array.isArray(o.amount) && (!o.amount.length || Coin.isSDK(o.amount[0]))); + }, + isAmino(o: any): o is MsgDepositAmino { + return o && (o.$typeUrl === MsgDeposit.typeUrl || typeof o.proposal_id === "bigint" && typeof o.depositor === "string" && Array.isArray(o.amount) && (!o.amount.length || Coin.isAmino(o.amount[0]))); + }, encode(message: MsgDeposit, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.proposalId !== BigInt(0)) { writer.uint32(8).uint64(message.proposalId); @@ -972,6 +1062,12 @@ export const MsgDeposit = { typeUrl: "/cosmos.gov.v1beta1.MsgDeposit", value: MsgDeposit.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgDeposit.typeUrl)) { + return; + } + Coin.registerTypeUrl(); } }; function createBaseMsgDepositResponse(): MsgDepositResponse { @@ -986,6 +1082,15 @@ function createBaseMsgDepositResponse(): MsgDepositResponse { export const MsgDepositResponse = { typeUrl: "/cosmos.gov.v1beta1.MsgDepositResponse", aminoType: "cosmos-sdk/MsgDepositResponse", + is(o: any): o is MsgDepositResponse { + return o && o.$typeUrl === MsgDepositResponse.typeUrl; + }, + isSDK(o: any): o is MsgDepositResponseSDKType { + return o && o.$typeUrl === MsgDepositResponse.typeUrl; + }, + isAmino(o: any): o is MsgDepositResponseAmino { + return o && o.$typeUrl === MsgDepositResponse.typeUrl; + }, encode(_: MsgDepositResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -1037,145 +1142,6 @@ export const MsgDepositResponse = { typeUrl: "/cosmos.gov.v1beta1.MsgDepositResponse", value: MsgDepositResponse.encode(message).finish() }; - } -}; -export const ProposalContentI_InterfaceDecoder = (input: BinaryReader | Uint8Array): TextProposal | RegisterIncentiveProposal | ClientUpdateProposal | UpgradeProposal | ReplacePoolIncentivesProposal | UpdatePoolIncentivesProposal | SetSuperfluidAssetsProposal | RemoveSuperfluidAssetsProposal | UpdateUnpoolWhiteListProposal | UpdateFeeTokenProposal | Any => { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - const data = Any.decode(reader, reader.uint32(), true); - switch (data.typeUrl) { - case "/cosmos.gov.v1beta1.TextProposal": - return TextProposal.decode(data.value, undefined, true); - case "/evmos.incentives.v1.RegisterIncentiveProposal": - return RegisterIncentiveProposal.decode(data.value, undefined, true); - case "/ibc.core.client.v1.ClientUpdateProposal": - return ClientUpdateProposal.decode(data.value, undefined, true); - case "/ibc.core.client.v1.UpgradeProposal": - return UpgradeProposal.decode(data.value, undefined, true); - case "/osmosis.poolincentives.v1beta1.ReplacePoolIncentivesProposal": - return ReplacePoolIncentivesProposal.decode(data.value, undefined, true); - case "/osmosis.poolincentives.v1beta1.UpdatePoolIncentivesProposal": - return UpdatePoolIncentivesProposal.decode(data.value, undefined, true); - case "/osmosis.superfluid.v1beta1.SetSuperfluidAssetsProposal": - return SetSuperfluidAssetsProposal.decode(data.value, undefined, true); - case "/osmosis.superfluid.v1beta1.RemoveSuperfluidAssetsProposal": - return RemoveSuperfluidAssetsProposal.decode(data.value, undefined, true); - case "/osmosis.superfluid.v1beta1.UpdateUnpoolWhiteListProposal": - return UpdateUnpoolWhiteListProposal.decode(data.value, undefined, true); - case "/osmosis.txfees.v1beta1.UpdateFeeTokenProposal": - return UpdateFeeTokenProposal.decode(data.value, undefined, true); - default: - return data; - } -}; -export const ProposalContentI_FromAmino = (content: AnyAmino): Any => { - switch (content.type) { - case "cosmos-sdk/TextProposal": - return Any.fromPartial({ - typeUrl: "/cosmos.gov.v1beta1.TextProposal", - value: TextProposal.encode(TextProposal.fromPartial(TextProposal.fromAmino(content.value))).finish() - }); - case "/evmos.incentives.v1.RegisterIncentiveProposal": - return Any.fromPartial({ - typeUrl: "/evmos.incentives.v1.RegisterIncentiveProposal", - value: RegisterIncentiveProposal.encode(RegisterIncentiveProposal.fromPartial(RegisterIncentiveProposal.fromAmino(content.value))).finish() - }); - case "cosmos-sdk/ClientUpdateProposal": - return Any.fromPartial({ - typeUrl: "/ibc.core.client.v1.ClientUpdateProposal", - value: ClientUpdateProposal.encode(ClientUpdateProposal.fromPartial(ClientUpdateProposal.fromAmino(content.value))).finish() - }); - case "cosmos-sdk/UpgradeProposal": - return Any.fromPartial({ - typeUrl: "/ibc.core.client.v1.UpgradeProposal", - value: UpgradeProposal.encode(UpgradeProposal.fromPartial(UpgradeProposal.fromAmino(content.value))).finish() - }); - case "osmosis/poolincentives/replace-pool-incentives-proposal": - return Any.fromPartial({ - typeUrl: "/osmosis.poolincentives.v1beta1.ReplacePoolIncentivesProposal", - value: ReplacePoolIncentivesProposal.encode(ReplacePoolIncentivesProposal.fromPartial(ReplacePoolIncentivesProposal.fromAmino(content.value))).finish() - }); - case "osmosis/poolincentives/update-pool-incentives-proposal": - return Any.fromPartial({ - typeUrl: "/osmosis.poolincentives.v1beta1.UpdatePoolIncentivesProposal", - value: UpdatePoolIncentivesProposal.encode(UpdatePoolIncentivesProposal.fromPartial(UpdatePoolIncentivesProposal.fromAmino(content.value))).finish() - }); - case "osmosis/v1beta1/set-superfluid-assets-proposal": - return Any.fromPartial({ - typeUrl: "/osmosis.superfluid.v1beta1.SetSuperfluidAssetsProposal", - value: SetSuperfluidAssetsProposal.encode(SetSuperfluidAssetsProposal.fromPartial(SetSuperfluidAssetsProposal.fromAmino(content.value))).finish() - }); - case "osmosis/v1beta1/remove-superfluid-assets-proposal": - return Any.fromPartial({ - typeUrl: "/osmosis.superfluid.v1beta1.RemoveSuperfluidAssetsProposal", - value: RemoveSuperfluidAssetsProposal.encode(RemoveSuperfluidAssetsProposal.fromPartial(RemoveSuperfluidAssetsProposal.fromAmino(content.value))).finish() - }); - case "osmosis/v1beta1/update-unpool-white-list-proposal": - return Any.fromPartial({ - typeUrl: "/osmosis.superfluid.v1beta1.UpdateUnpoolWhiteListProposal", - value: UpdateUnpoolWhiteListProposal.encode(UpdateUnpoolWhiteListProposal.fromPartial(UpdateUnpoolWhiteListProposal.fromAmino(content.value))).finish() - }); - case "osmosis/txfees/update-fee-token-proposal": - return Any.fromPartial({ - typeUrl: "/osmosis.txfees.v1beta1.UpdateFeeTokenProposal", - value: UpdateFeeTokenProposal.encode(UpdateFeeTokenProposal.fromPartial(UpdateFeeTokenProposal.fromAmino(content.value))).finish() - }); - default: - return Any.fromAmino(content); - } -}; -export const ProposalContentI_ToAmino = (content: Any, useInterfaces: boolean = true) => { - switch (content.typeUrl) { - case "/cosmos.gov.v1beta1.TextProposal": - return { - type: "cosmos-sdk/TextProposal", - value: TextProposal.toAmino(TextProposal.decode(content.value, undefined, useInterfaces), useInterfaces) - }; - case "/evmos.incentives.v1.RegisterIncentiveProposal": - return { - type: "/evmos.incentives.v1.RegisterIncentiveProposal", - value: RegisterIncentiveProposal.toAmino(RegisterIncentiveProposal.decode(content.value, undefined, useInterfaces), useInterfaces) - }; - case "/ibc.core.client.v1.ClientUpdateProposal": - return { - type: "cosmos-sdk/ClientUpdateProposal", - value: ClientUpdateProposal.toAmino(ClientUpdateProposal.decode(content.value, undefined, useInterfaces), useInterfaces) - }; - case "/ibc.core.client.v1.UpgradeProposal": - return { - type: "cosmos-sdk/UpgradeProposal", - value: UpgradeProposal.toAmino(UpgradeProposal.decode(content.value, undefined, useInterfaces), useInterfaces) - }; - case "/osmosis.poolincentives.v1beta1.ReplacePoolIncentivesProposal": - return { - type: "osmosis/poolincentives/replace-pool-incentives-proposal", - value: ReplacePoolIncentivesProposal.toAmino(ReplacePoolIncentivesProposal.decode(content.value, undefined, useInterfaces), useInterfaces) - }; - case "/osmosis.poolincentives.v1beta1.UpdatePoolIncentivesProposal": - return { - type: "osmosis/poolincentives/update-pool-incentives-proposal", - value: UpdatePoolIncentivesProposal.toAmino(UpdatePoolIncentivesProposal.decode(content.value, undefined, useInterfaces), useInterfaces) - }; - case "/osmosis.superfluid.v1beta1.SetSuperfluidAssetsProposal": - return { - type: "osmosis/v1beta1/set-superfluid-assets-proposal", - value: SetSuperfluidAssetsProposal.toAmino(SetSuperfluidAssetsProposal.decode(content.value, undefined, useInterfaces), useInterfaces) - }; - case "/osmosis.superfluid.v1beta1.RemoveSuperfluidAssetsProposal": - return { - type: "osmosis/v1beta1/remove-superfluid-assets-proposal", - value: RemoveSuperfluidAssetsProposal.toAmino(RemoveSuperfluidAssetsProposal.decode(content.value, undefined, useInterfaces), useInterfaces) - }; - case "/osmosis.superfluid.v1beta1.UpdateUnpoolWhiteListProposal": - return { - type: "osmosis/v1beta1/update-unpool-white-list-proposal", - value: UpdateUnpoolWhiteListProposal.toAmino(UpdateUnpoolWhiteListProposal.decode(content.value, undefined, useInterfaces), useInterfaces) - }; - case "/osmosis.txfees.v1beta1.UpdateFeeTokenProposal": - return { - type: "osmosis/txfees/update-fee-token-proposal", - value: UpdateFeeTokenProposal.toAmino(UpdateFeeTokenProposal.decode(content.value, undefined, useInterfaces), useInterfaces) - }; - default: - return Any.toAmino(content, useInterfaces); - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/cosmos/group/v1/events.ts b/__fixtures__/v-next/outputv3/cosmos/group/v1/events.ts index eb3c5b5640..e0a4d95ca6 100644 --- a/__fixtures__/v-next/outputv3/cosmos/group/v1/events.ts +++ b/__fixtures__/v-next/outputv3/cosmos/group/v1/events.ts @@ -367,6 +367,15 @@ function createBaseEventCreateGroup(): EventCreateGroup { export const EventCreateGroup = { typeUrl: "/cosmos.group.v1.EventCreateGroup", aminoType: "cosmos-sdk/EventCreateGroup", + is(o: any): o is EventCreateGroup { + return o && (o.$typeUrl === EventCreateGroup.typeUrl || typeof o.groupId === "bigint"); + }, + isSDK(o: any): o is EventCreateGroupSDKType { + return o && (o.$typeUrl === EventCreateGroup.typeUrl || typeof o.group_id === "bigint"); + }, + isAmino(o: any): o is EventCreateGroupAmino { + return o && (o.$typeUrl === EventCreateGroup.typeUrl || typeof o.group_id === "bigint"); + }, encode(message: EventCreateGroup, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.groupId !== BigInt(0)) { writer.uint32(8).uint64(message.groupId); @@ -435,7 +444,8 @@ export const EventCreateGroup = { typeUrl: "/cosmos.group.v1.EventCreateGroup", value: EventCreateGroup.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseEventUpdateGroup(): EventUpdateGroup { return { @@ -451,6 +461,15 @@ function createBaseEventUpdateGroup(): EventUpdateGroup { export const EventUpdateGroup = { typeUrl: "/cosmos.group.v1.EventUpdateGroup", aminoType: "cosmos-sdk/EventUpdateGroup", + is(o: any): o is EventUpdateGroup { + return o && (o.$typeUrl === EventUpdateGroup.typeUrl || typeof o.groupId === "bigint"); + }, + isSDK(o: any): o is EventUpdateGroupSDKType { + return o && (o.$typeUrl === EventUpdateGroup.typeUrl || typeof o.group_id === "bigint"); + }, + isAmino(o: any): o is EventUpdateGroupAmino { + return o && (o.$typeUrl === EventUpdateGroup.typeUrl || typeof o.group_id === "bigint"); + }, encode(message: EventUpdateGroup, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.groupId !== BigInt(0)) { writer.uint32(8).uint64(message.groupId); @@ -519,7 +538,8 @@ export const EventUpdateGroup = { typeUrl: "/cosmos.group.v1.EventUpdateGroup", value: EventUpdateGroup.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseEventCreateGroupPolicy(): EventCreateGroupPolicy { return { @@ -535,6 +555,15 @@ function createBaseEventCreateGroupPolicy(): EventCreateGroupPolicy { export const EventCreateGroupPolicy = { typeUrl: "/cosmos.group.v1.EventCreateGroupPolicy", aminoType: "cosmos-sdk/EventCreateGroupPolicy", + is(o: any): o is EventCreateGroupPolicy { + return o && (o.$typeUrl === EventCreateGroupPolicy.typeUrl || typeof o.address === "string"); + }, + isSDK(o: any): o is EventCreateGroupPolicySDKType { + return o && (o.$typeUrl === EventCreateGroupPolicy.typeUrl || typeof o.address === "string"); + }, + isAmino(o: any): o is EventCreateGroupPolicyAmino { + return o && (o.$typeUrl === EventCreateGroupPolicy.typeUrl || typeof o.address === "string"); + }, encode(message: EventCreateGroupPolicy, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.address !== "") { writer.uint32(10).string(message.address); @@ -601,7 +630,8 @@ export const EventCreateGroupPolicy = { typeUrl: "/cosmos.group.v1.EventCreateGroupPolicy", value: EventCreateGroupPolicy.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseEventUpdateGroupPolicy(): EventUpdateGroupPolicy { return { @@ -617,6 +647,15 @@ function createBaseEventUpdateGroupPolicy(): EventUpdateGroupPolicy { export const EventUpdateGroupPolicy = { typeUrl: "/cosmos.group.v1.EventUpdateGroupPolicy", aminoType: "cosmos-sdk/EventUpdateGroupPolicy", + is(o: any): o is EventUpdateGroupPolicy { + return o && (o.$typeUrl === EventUpdateGroupPolicy.typeUrl || typeof o.address === "string"); + }, + isSDK(o: any): o is EventUpdateGroupPolicySDKType { + return o && (o.$typeUrl === EventUpdateGroupPolicy.typeUrl || typeof o.address === "string"); + }, + isAmino(o: any): o is EventUpdateGroupPolicyAmino { + return o && (o.$typeUrl === EventUpdateGroupPolicy.typeUrl || typeof o.address === "string"); + }, encode(message: EventUpdateGroupPolicy, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.address !== "") { writer.uint32(10).string(message.address); @@ -683,7 +722,8 @@ export const EventUpdateGroupPolicy = { typeUrl: "/cosmos.group.v1.EventUpdateGroupPolicy", value: EventUpdateGroupPolicy.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseEventSubmitProposal(): EventSubmitProposal { return { @@ -699,6 +739,15 @@ function createBaseEventSubmitProposal(): EventSubmitProposal { export const EventSubmitProposal = { typeUrl: "/cosmos.group.v1.EventSubmitProposal", aminoType: "cosmos-sdk/EventSubmitProposal", + is(o: any): o is EventSubmitProposal { + return o && (o.$typeUrl === EventSubmitProposal.typeUrl || typeof o.proposalId === "bigint"); + }, + isSDK(o: any): o is EventSubmitProposalSDKType { + return o && (o.$typeUrl === EventSubmitProposal.typeUrl || typeof o.proposal_id === "bigint"); + }, + isAmino(o: any): o is EventSubmitProposalAmino { + return o && (o.$typeUrl === EventSubmitProposal.typeUrl || typeof o.proposal_id === "bigint"); + }, encode(message: EventSubmitProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.proposalId !== BigInt(0)) { writer.uint32(8).uint64(message.proposalId); @@ -767,7 +816,8 @@ export const EventSubmitProposal = { typeUrl: "/cosmos.group.v1.EventSubmitProposal", value: EventSubmitProposal.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseEventWithdrawProposal(): EventWithdrawProposal { return { @@ -783,6 +833,15 @@ function createBaseEventWithdrawProposal(): EventWithdrawProposal { export const EventWithdrawProposal = { typeUrl: "/cosmos.group.v1.EventWithdrawProposal", aminoType: "cosmos-sdk/EventWithdrawProposal", + is(o: any): o is EventWithdrawProposal { + return o && (o.$typeUrl === EventWithdrawProposal.typeUrl || typeof o.proposalId === "bigint"); + }, + isSDK(o: any): o is EventWithdrawProposalSDKType { + return o && (o.$typeUrl === EventWithdrawProposal.typeUrl || typeof o.proposal_id === "bigint"); + }, + isAmino(o: any): o is EventWithdrawProposalAmino { + return o && (o.$typeUrl === EventWithdrawProposal.typeUrl || typeof o.proposal_id === "bigint"); + }, encode(message: EventWithdrawProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.proposalId !== BigInt(0)) { writer.uint32(8).uint64(message.proposalId); @@ -851,7 +910,8 @@ export const EventWithdrawProposal = { typeUrl: "/cosmos.group.v1.EventWithdrawProposal", value: EventWithdrawProposal.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseEventVote(): EventVote { return { @@ -867,6 +927,15 @@ function createBaseEventVote(): EventVote { export const EventVote = { typeUrl: "/cosmos.group.v1.EventVote", aminoType: "cosmos-sdk/EventVote", + is(o: any): o is EventVote { + return o && (o.$typeUrl === EventVote.typeUrl || typeof o.proposalId === "bigint"); + }, + isSDK(o: any): o is EventVoteSDKType { + return o && (o.$typeUrl === EventVote.typeUrl || typeof o.proposal_id === "bigint"); + }, + isAmino(o: any): o is EventVoteAmino { + return o && (o.$typeUrl === EventVote.typeUrl || typeof o.proposal_id === "bigint"); + }, encode(message: EventVote, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.proposalId !== BigInt(0)) { writer.uint32(8).uint64(message.proposalId); @@ -935,7 +1004,8 @@ export const EventVote = { typeUrl: "/cosmos.group.v1.EventVote", value: EventVote.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseEventExec(): EventExec { return { @@ -952,6 +1022,15 @@ function createBaseEventExec(): EventExec { export const EventExec = { typeUrl: "/cosmos.group.v1.EventExec", aminoType: "cosmos-sdk/EventExec", + is(o: any): o is EventExec { + return o && (o.$typeUrl === EventExec.typeUrl || typeof o.proposalId === "bigint" && isSet(o.result)); + }, + isSDK(o: any): o is EventExecSDKType { + return o && (o.$typeUrl === EventExec.typeUrl || typeof o.proposal_id === "bigint" && isSet(o.result)); + }, + isAmino(o: any): o is EventExecAmino { + return o && (o.$typeUrl === EventExec.typeUrl || typeof o.proposal_id === "bigint" && isSet(o.result)); + }, encode(message: EventExec, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.proposalId !== BigInt(0)) { writer.uint32(8).uint64(message.proposalId); @@ -1034,7 +1113,8 @@ export const EventExec = { typeUrl: "/cosmos.group.v1.EventExec", value: EventExec.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseEventLeaveGroup(): EventLeaveGroup { return { @@ -1051,6 +1131,15 @@ function createBaseEventLeaveGroup(): EventLeaveGroup { export const EventLeaveGroup = { typeUrl: "/cosmos.group.v1.EventLeaveGroup", aminoType: "cosmos-sdk/EventLeaveGroup", + is(o: any): o is EventLeaveGroup { + return o && (o.$typeUrl === EventLeaveGroup.typeUrl || typeof o.groupId === "bigint" && typeof o.address === "string"); + }, + isSDK(o: any): o is EventLeaveGroupSDKType { + return o && (o.$typeUrl === EventLeaveGroup.typeUrl || typeof o.group_id === "bigint" && typeof o.address === "string"); + }, + isAmino(o: any): o is EventLeaveGroupAmino { + return o && (o.$typeUrl === EventLeaveGroup.typeUrl || typeof o.group_id === "bigint" && typeof o.address === "string"); + }, encode(message: EventLeaveGroup, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.groupId !== BigInt(0)) { writer.uint32(8).uint64(message.groupId); @@ -1133,5 +1222,6 @@ export const EventLeaveGroup = { typeUrl: "/cosmos.group.v1.EventLeaveGroup", value: EventLeaveGroup.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/cosmos/group/v1/genesis.ts b/__fixtures__/v-next/outputv3/cosmos/group/v1/genesis.ts index f46c062a3e..51dd42fba2 100644 --- a/__fixtures__/v-next/outputv3/cosmos/group/v1/genesis.ts +++ b/__fixtures__/v-next/outputv3/cosmos/group/v1/genesis.ts @@ -1,6 +1,7 @@ import { GroupInfo, GroupInfoAmino, GroupInfoSDKType, GroupMember, GroupMemberAmino, GroupMemberSDKType, GroupPolicyInfo, GroupPolicyInfoAmino, GroupPolicyInfoSDKType, Proposal, ProposalAmino, ProposalSDKType, Vote, VoteAmino, VoteSDKType } from "./types"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { isSet, DeepPartial } from "../../../helpers"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "cosmos.group.v1"; /** * GenesisState defines the group module's genesis state. @@ -129,6 +130,15 @@ function createBaseGenesisState(): GenesisState { export const GenesisState = { typeUrl: "/cosmos.group.v1.GenesisState", aminoType: "cosmos-sdk/GenesisState", + is(o: any): o is GenesisState { + return o && (o.$typeUrl === GenesisState.typeUrl || typeof o.groupSeq === "bigint" && Array.isArray(o.groups) && (!o.groups.length || GroupInfo.is(o.groups[0])) && Array.isArray(o.groupMembers) && (!o.groupMembers.length || GroupMember.is(o.groupMembers[0])) && typeof o.groupPolicySeq === "bigint" && Array.isArray(o.groupPolicies) && (!o.groupPolicies.length || GroupPolicyInfo.is(o.groupPolicies[0])) && typeof o.proposalSeq === "bigint" && Array.isArray(o.proposals) && (!o.proposals.length || Proposal.is(o.proposals[0])) && Array.isArray(o.votes) && (!o.votes.length || Vote.is(o.votes[0]))); + }, + isSDK(o: any): o is GenesisStateSDKType { + return o && (o.$typeUrl === GenesisState.typeUrl || typeof o.group_seq === "bigint" && Array.isArray(o.groups) && (!o.groups.length || GroupInfo.isSDK(o.groups[0])) && Array.isArray(o.group_members) && (!o.group_members.length || GroupMember.isSDK(o.group_members[0])) && typeof o.group_policy_seq === "bigint" && Array.isArray(o.group_policies) && (!o.group_policies.length || GroupPolicyInfo.isSDK(o.group_policies[0])) && typeof o.proposal_seq === "bigint" && Array.isArray(o.proposals) && (!o.proposals.length || Proposal.isSDK(o.proposals[0])) && Array.isArray(o.votes) && (!o.votes.length || Vote.isSDK(o.votes[0]))); + }, + isAmino(o: any): o is GenesisStateAmino { + return o && (o.$typeUrl === GenesisState.typeUrl || typeof o.group_seq === "bigint" && Array.isArray(o.groups) && (!o.groups.length || GroupInfo.isAmino(o.groups[0])) && Array.isArray(o.group_members) && (!o.group_members.length || GroupMember.isAmino(o.group_members[0])) && typeof o.group_policy_seq === "bigint" && Array.isArray(o.group_policies) && (!o.group_policies.length || GroupPolicyInfo.isAmino(o.group_policies[0])) && typeof o.proposal_seq === "bigint" && Array.isArray(o.proposals) && (!o.proposals.length || Proposal.isAmino(o.proposals[0])) && Array.isArray(o.votes) && (!o.votes.length || Vote.isAmino(o.votes[0]))); + }, encode(message: GenesisState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.groupSeq !== BigInt(0)) { writer.uint32(8).uint64(message.groupSeq); @@ -329,5 +339,15 @@ export const GenesisState = { typeUrl: "/cosmos.group.v1.GenesisState", value: GenesisState.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GenesisState.typeUrl)) { + return; + } + GroupInfo.registerTypeUrl(); + GroupMember.registerTypeUrl(); + GroupPolicyInfo.registerTypeUrl(); + Proposal.registerTypeUrl(); + Vote.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/cosmos/group/v1/query.rpc.func.ts b/__fixtures__/v-next/outputv3/cosmos/group/v1/query.rpc.func.ts new file mode 100644 index 0000000000..ad8d52c011 --- /dev/null +++ b/__fixtures__/v-next/outputv3/cosmos/group/v1/query.rpc.func.ts @@ -0,0 +1,173 @@ +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; +import { GroupInfo, GroupInfoSDKType, GroupPolicyInfo, GroupPolicyInfoSDKType, GroupMember, GroupMemberSDKType, Proposal, ProposalSDKType, Vote, VoteSDKType, TallyResult, TallyResultSDKType } from "./types"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { QueryGroupInfoRequest, QueryGroupInfoRequestSDKType, QueryGroupInfoResponse, QueryGroupInfoResponseSDKType, QueryGroupPolicyInfoRequest, QueryGroupPolicyInfoRequestSDKType, QueryGroupPolicyInfoResponse, QueryGroupPolicyInfoResponseSDKType, QueryGroupMembersRequest, QueryGroupMembersRequestSDKType, QueryGroupMembersResponse, QueryGroupMembersResponseSDKType, QueryGroupsByAdminRequest, QueryGroupsByAdminRequestSDKType, QueryGroupsByAdminResponse, QueryGroupsByAdminResponseSDKType, QueryGroupPoliciesByGroupRequest, QueryGroupPoliciesByGroupRequestSDKType, QueryGroupPoliciesByGroupResponse, QueryGroupPoliciesByGroupResponseSDKType, QueryGroupPoliciesByAdminRequest, QueryGroupPoliciesByAdminRequestSDKType, QueryGroupPoliciesByAdminResponse, QueryGroupPoliciesByAdminResponseSDKType, QueryProposalRequest, QueryProposalRequestSDKType, QueryProposalResponse, QueryProposalResponseSDKType, QueryProposalsByGroupPolicyRequest, QueryProposalsByGroupPolicyRequestSDKType, QueryProposalsByGroupPolicyResponse, QueryProposalsByGroupPolicyResponseSDKType, QueryVoteByProposalVoterRequest, QueryVoteByProposalVoterRequestSDKType, QueryVoteByProposalVoterResponse, QueryVoteByProposalVoterResponseSDKType, QueryVotesByProposalRequest, QueryVotesByProposalRequestSDKType, QueryVotesByProposalResponse, QueryVotesByProposalResponseSDKType, QueryVotesByVoterRequest, QueryVotesByVoterRequestSDKType, QueryVotesByVoterResponse, QueryVotesByVoterResponseSDKType, QueryGroupsByMemberRequest, QueryGroupsByMemberRequestSDKType, QueryGroupsByMemberResponse, QueryGroupsByMemberResponseSDKType, QueryTallyResultRequest, QueryTallyResultRequestSDKType, QueryTallyResultResponse, QueryTallyResultResponseSDKType } from "./query"; +/** + * GroupInfo queries group info based on group id. + * @name getGroupInfo + * @package cosmos.group.v1 + * @see proto service: cosmos.group.v1.GroupInfo + */ +export const getGroupInfo = buildQuery({ + encode: QueryGroupInfoRequest.encode, + decode: QueryGroupInfoResponse.decode, + service: "cosmos.group.v1.Query", + method: "GroupInfo", + deps: [QueryGroupInfoRequest, QueryGroupInfoResponse] +}); +/** + * GroupPolicyInfo queries group policy info based on account address of group policy. + * @name getGroupPolicyInfo + * @package cosmos.group.v1 + * @see proto service: cosmos.group.v1.GroupPolicyInfo + */ +export const getGroupPolicyInfo = buildQuery({ + encode: QueryGroupPolicyInfoRequest.encode, + decode: QueryGroupPolicyInfoResponse.decode, + service: "cosmos.group.v1.Query", + method: "GroupPolicyInfo", + deps: [QueryGroupPolicyInfoRequest, QueryGroupPolicyInfoResponse] +}); +/** + * GroupMembers queries members of a group + * @name getGroupMembers + * @package cosmos.group.v1 + * @see proto service: cosmos.group.v1.GroupMembers + */ +export const getGroupMembers = buildQuery({ + encode: QueryGroupMembersRequest.encode, + decode: QueryGroupMembersResponse.decode, + service: "cosmos.group.v1.Query", + method: "GroupMembers", + deps: [QueryGroupMembersRequest, QueryGroupMembersResponse] +}); +/** + * GroupsByAdmin queries groups by admin address. + * @name getGroupsByAdmin + * @package cosmos.group.v1 + * @see proto service: cosmos.group.v1.GroupsByAdmin + */ +export const getGroupsByAdmin = buildQuery({ + encode: QueryGroupsByAdminRequest.encode, + decode: QueryGroupsByAdminResponse.decode, + service: "cosmos.group.v1.Query", + method: "GroupsByAdmin", + deps: [QueryGroupsByAdminRequest, QueryGroupsByAdminResponse] +}); +/** + * GroupPoliciesByGroup queries group policies by group id. + * @name getGroupPoliciesByGroup + * @package cosmos.group.v1 + * @see proto service: cosmos.group.v1.GroupPoliciesByGroup + */ +export const getGroupPoliciesByGroup = buildQuery({ + encode: QueryGroupPoliciesByGroupRequest.encode, + decode: QueryGroupPoliciesByGroupResponse.decode, + service: "cosmos.group.v1.Query", + method: "GroupPoliciesByGroup", + deps: [QueryGroupPoliciesByGroupRequest, QueryGroupPoliciesByGroupResponse] +}); +/** + * GroupsByAdmin queries group policies by admin address. + * @name getGroupPoliciesByAdmin + * @package cosmos.group.v1 + * @see proto service: cosmos.group.v1.GroupPoliciesByAdmin + */ +export const getGroupPoliciesByAdmin = buildQuery({ + encode: QueryGroupPoliciesByAdminRequest.encode, + decode: QueryGroupPoliciesByAdminResponse.decode, + service: "cosmos.group.v1.Query", + method: "GroupPoliciesByAdmin", + deps: [QueryGroupPoliciesByAdminRequest, QueryGroupPoliciesByAdminResponse] +}); +/** + * Proposal queries a proposal based on proposal id. + * @name getProposal + * @package cosmos.group.v1 + * @see proto service: cosmos.group.v1.Proposal + */ +export const getProposal = buildQuery({ + encode: QueryProposalRequest.encode, + decode: QueryProposalResponse.decode, + service: "cosmos.group.v1.Query", + method: "Proposal", + deps: [QueryProposalRequest, QueryProposalResponse] +}); +/** + * ProposalsByGroupPolicy queries proposals based on account address of group policy. + * @name getProposalsByGroupPolicy + * @package cosmos.group.v1 + * @see proto service: cosmos.group.v1.ProposalsByGroupPolicy + */ +export const getProposalsByGroupPolicy = buildQuery({ + encode: QueryProposalsByGroupPolicyRequest.encode, + decode: QueryProposalsByGroupPolicyResponse.decode, + service: "cosmos.group.v1.Query", + method: "ProposalsByGroupPolicy", + deps: [QueryProposalsByGroupPolicyRequest, QueryProposalsByGroupPolicyResponse] +}); +/** + * VoteByProposalVoter queries a vote by proposal id and voter. + * @name getVoteByProposalVoter + * @package cosmos.group.v1 + * @see proto service: cosmos.group.v1.VoteByProposalVoter + */ +export const getVoteByProposalVoter = buildQuery({ + encode: QueryVoteByProposalVoterRequest.encode, + decode: QueryVoteByProposalVoterResponse.decode, + service: "cosmos.group.v1.Query", + method: "VoteByProposalVoter", + deps: [QueryVoteByProposalVoterRequest, QueryVoteByProposalVoterResponse] +}); +/** + * VotesByProposal queries a vote by proposal. + * @name getVotesByProposal + * @package cosmos.group.v1 + * @see proto service: cosmos.group.v1.VotesByProposal + */ +export const getVotesByProposal = buildQuery({ + encode: QueryVotesByProposalRequest.encode, + decode: QueryVotesByProposalResponse.decode, + service: "cosmos.group.v1.Query", + method: "VotesByProposal", + deps: [QueryVotesByProposalRequest, QueryVotesByProposalResponse] +}); +/** + * VotesByVoter queries a vote by voter. + * @name getVotesByVoter + * @package cosmos.group.v1 + * @see proto service: cosmos.group.v1.VotesByVoter + */ +export const getVotesByVoter = buildQuery({ + encode: QueryVotesByVoterRequest.encode, + decode: QueryVotesByVoterResponse.decode, + service: "cosmos.group.v1.Query", + method: "VotesByVoter", + deps: [QueryVotesByVoterRequest, QueryVotesByVoterResponse] +}); +/** + * GroupsByMember queries groups by member address. + * @name getGroupsByMember + * @package cosmos.group.v1 + * @see proto service: cosmos.group.v1.GroupsByMember + */ +export const getGroupsByMember = buildQuery({ + encode: QueryGroupsByMemberRequest.encode, + decode: QueryGroupsByMemberResponse.decode, + service: "cosmos.group.v1.Query", + method: "GroupsByMember", + deps: [QueryGroupsByMemberRequest, QueryGroupsByMemberResponse] +}); +/** + * TallyResult queries the tally of a proposal votes. + * @name getTallyResult + * @package cosmos.group.v1 + * @see proto service: cosmos.group.v1.TallyResult + */ +export const getTallyResult = buildQuery({ + encode: QueryTallyResultRequest.encode, + decode: QueryTallyResultResponse.decode, + service: "cosmos.group.v1.Query", + method: "TallyResult", + deps: [QueryTallyResultRequest, QueryTallyResultResponse] +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/cosmos/group/v1/query.ts b/__fixtures__/v-next/outputv3/cosmos/group/v1/query.ts index b77b8dc98a..f6ca7ff403 100644 --- a/__fixtures__/v-next/outputv3/cosmos/group/v1/query.ts +++ b/__fixtures__/v-next/outputv3/cosmos/group/v1/query.ts @@ -2,6 +2,7 @@ import { PageRequest, PageRequestAmino, PageRequestSDKType, PageResponse, PageRe import { GroupInfo, GroupInfoAmino, GroupInfoSDKType, GroupPolicyInfo, GroupPolicyInfoAmino, GroupPolicyInfoSDKType, GroupMember, GroupMemberAmino, GroupMemberSDKType, Proposal, ProposalAmino, ProposalSDKType, Vote, VoteAmino, VoteSDKType, TallyResult, TallyResultAmino, TallyResultSDKType } from "./types"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { isSet, DeepPartial } from "../../../helpers"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "cosmos.group.v1"; /** * QueryGroupInfoRequest is the Query/GroupInfo request type. @@ -1132,6 +1133,15 @@ function createBaseQueryGroupInfoRequest(): QueryGroupInfoRequest { export const QueryGroupInfoRequest = { typeUrl: "/cosmos.group.v1.QueryGroupInfoRequest", aminoType: "cosmos-sdk/QueryGroupInfoRequest", + is(o: any): o is QueryGroupInfoRequest { + return o && (o.$typeUrl === QueryGroupInfoRequest.typeUrl || typeof o.groupId === "bigint"); + }, + isSDK(o: any): o is QueryGroupInfoRequestSDKType { + return o && (o.$typeUrl === QueryGroupInfoRequest.typeUrl || typeof o.group_id === "bigint"); + }, + isAmino(o: any): o is QueryGroupInfoRequestAmino { + return o && (o.$typeUrl === QueryGroupInfoRequest.typeUrl || typeof o.group_id === "bigint"); + }, encode(message: QueryGroupInfoRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.groupId !== BigInt(0)) { writer.uint32(8).uint64(message.groupId); @@ -1200,7 +1210,8 @@ export const QueryGroupInfoRequest = { typeUrl: "/cosmos.group.v1.QueryGroupInfoRequest", value: QueryGroupInfoRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryGroupInfoResponse(): QueryGroupInfoResponse { return { @@ -1216,6 +1227,15 @@ function createBaseQueryGroupInfoResponse(): QueryGroupInfoResponse { export const QueryGroupInfoResponse = { typeUrl: "/cosmos.group.v1.QueryGroupInfoResponse", aminoType: "cosmos-sdk/QueryGroupInfoResponse", + is(o: any): o is QueryGroupInfoResponse { + return o && o.$typeUrl === QueryGroupInfoResponse.typeUrl; + }, + isSDK(o: any): o is QueryGroupInfoResponseSDKType { + return o && o.$typeUrl === QueryGroupInfoResponse.typeUrl; + }, + isAmino(o: any): o is QueryGroupInfoResponseAmino { + return o && o.$typeUrl === QueryGroupInfoResponse.typeUrl; + }, encode(message: QueryGroupInfoResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.info !== undefined) { GroupInfo.encode(message.info, writer.uint32(10).fork()).ldelim(); @@ -1284,6 +1304,12 @@ export const QueryGroupInfoResponse = { typeUrl: "/cosmos.group.v1.QueryGroupInfoResponse", value: QueryGroupInfoResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryGroupInfoResponse.typeUrl)) { + return; + } + GroupInfo.registerTypeUrl(); } }; function createBaseQueryGroupPolicyInfoRequest(): QueryGroupPolicyInfoRequest { @@ -1300,6 +1326,15 @@ function createBaseQueryGroupPolicyInfoRequest(): QueryGroupPolicyInfoRequest { export const QueryGroupPolicyInfoRequest = { typeUrl: "/cosmos.group.v1.QueryGroupPolicyInfoRequest", aminoType: "cosmos-sdk/QueryGroupPolicyInfoRequest", + is(o: any): o is QueryGroupPolicyInfoRequest { + return o && (o.$typeUrl === QueryGroupPolicyInfoRequest.typeUrl || typeof o.address === "string"); + }, + isSDK(o: any): o is QueryGroupPolicyInfoRequestSDKType { + return o && (o.$typeUrl === QueryGroupPolicyInfoRequest.typeUrl || typeof o.address === "string"); + }, + isAmino(o: any): o is QueryGroupPolicyInfoRequestAmino { + return o && (o.$typeUrl === QueryGroupPolicyInfoRequest.typeUrl || typeof o.address === "string"); + }, encode(message: QueryGroupPolicyInfoRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.address !== "") { writer.uint32(10).string(message.address); @@ -1366,7 +1401,8 @@ export const QueryGroupPolicyInfoRequest = { typeUrl: "/cosmos.group.v1.QueryGroupPolicyInfoRequest", value: QueryGroupPolicyInfoRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryGroupPolicyInfoResponse(): QueryGroupPolicyInfoResponse { return { @@ -1382,6 +1418,15 @@ function createBaseQueryGroupPolicyInfoResponse(): QueryGroupPolicyInfoResponse export const QueryGroupPolicyInfoResponse = { typeUrl: "/cosmos.group.v1.QueryGroupPolicyInfoResponse", aminoType: "cosmos-sdk/QueryGroupPolicyInfoResponse", + is(o: any): o is QueryGroupPolicyInfoResponse { + return o && o.$typeUrl === QueryGroupPolicyInfoResponse.typeUrl; + }, + isSDK(o: any): o is QueryGroupPolicyInfoResponseSDKType { + return o && o.$typeUrl === QueryGroupPolicyInfoResponse.typeUrl; + }, + isAmino(o: any): o is QueryGroupPolicyInfoResponseAmino { + return o && o.$typeUrl === QueryGroupPolicyInfoResponse.typeUrl; + }, encode(message: QueryGroupPolicyInfoResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.info !== undefined) { GroupPolicyInfo.encode(message.info, writer.uint32(10).fork()).ldelim(); @@ -1450,6 +1495,12 @@ export const QueryGroupPolicyInfoResponse = { typeUrl: "/cosmos.group.v1.QueryGroupPolicyInfoResponse", value: QueryGroupPolicyInfoResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryGroupPolicyInfoResponse.typeUrl)) { + return; + } + GroupPolicyInfo.registerTypeUrl(); } }; function createBaseQueryGroupMembersRequest(): QueryGroupMembersRequest { @@ -1467,6 +1518,15 @@ function createBaseQueryGroupMembersRequest(): QueryGroupMembersRequest { export const QueryGroupMembersRequest = { typeUrl: "/cosmos.group.v1.QueryGroupMembersRequest", aminoType: "cosmos-sdk/QueryGroupMembersRequest", + is(o: any): o is QueryGroupMembersRequest { + return o && (o.$typeUrl === QueryGroupMembersRequest.typeUrl || typeof o.groupId === "bigint"); + }, + isSDK(o: any): o is QueryGroupMembersRequestSDKType { + return o && (o.$typeUrl === QueryGroupMembersRequest.typeUrl || typeof o.group_id === "bigint"); + }, + isAmino(o: any): o is QueryGroupMembersRequestAmino { + return o && (o.$typeUrl === QueryGroupMembersRequest.typeUrl || typeof o.group_id === "bigint"); + }, encode(message: QueryGroupMembersRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.groupId !== BigInt(0)) { writer.uint32(8).uint64(message.groupId); @@ -1551,6 +1611,12 @@ export const QueryGroupMembersRequest = { typeUrl: "/cosmos.group.v1.QueryGroupMembersRequest", value: QueryGroupMembersRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryGroupMembersRequest.typeUrl)) { + return; + } + PageRequest.registerTypeUrl(); } }; function createBaseQueryGroupMembersResponse(): QueryGroupMembersResponse { @@ -1568,6 +1634,15 @@ function createBaseQueryGroupMembersResponse(): QueryGroupMembersResponse { export const QueryGroupMembersResponse = { typeUrl: "/cosmos.group.v1.QueryGroupMembersResponse", aminoType: "cosmos-sdk/QueryGroupMembersResponse", + is(o: any): o is QueryGroupMembersResponse { + return o && (o.$typeUrl === QueryGroupMembersResponse.typeUrl || Array.isArray(o.members) && (!o.members.length || GroupMember.is(o.members[0]))); + }, + isSDK(o: any): o is QueryGroupMembersResponseSDKType { + return o && (o.$typeUrl === QueryGroupMembersResponse.typeUrl || Array.isArray(o.members) && (!o.members.length || GroupMember.isSDK(o.members[0]))); + }, + isAmino(o: any): o is QueryGroupMembersResponseAmino { + return o && (o.$typeUrl === QueryGroupMembersResponse.typeUrl || Array.isArray(o.members) && (!o.members.length || GroupMember.isAmino(o.members[0]))); + }, encode(message: QueryGroupMembersResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.members) { GroupMember.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -1656,6 +1731,13 @@ export const QueryGroupMembersResponse = { typeUrl: "/cosmos.group.v1.QueryGroupMembersResponse", value: QueryGroupMembersResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryGroupMembersResponse.typeUrl)) { + return; + } + GroupMember.registerTypeUrl(); + PageResponse.registerTypeUrl(); } }; function createBaseQueryGroupsByAdminRequest(): QueryGroupsByAdminRequest { @@ -1673,6 +1755,15 @@ function createBaseQueryGroupsByAdminRequest(): QueryGroupsByAdminRequest { export const QueryGroupsByAdminRequest = { typeUrl: "/cosmos.group.v1.QueryGroupsByAdminRequest", aminoType: "cosmos-sdk/QueryGroupsByAdminRequest", + is(o: any): o is QueryGroupsByAdminRequest { + return o && (o.$typeUrl === QueryGroupsByAdminRequest.typeUrl || typeof o.admin === "string"); + }, + isSDK(o: any): o is QueryGroupsByAdminRequestSDKType { + return o && (o.$typeUrl === QueryGroupsByAdminRequest.typeUrl || typeof o.admin === "string"); + }, + isAmino(o: any): o is QueryGroupsByAdminRequestAmino { + return o && (o.$typeUrl === QueryGroupsByAdminRequest.typeUrl || typeof o.admin === "string"); + }, encode(message: QueryGroupsByAdminRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.admin !== "") { writer.uint32(10).string(message.admin); @@ -1755,6 +1846,12 @@ export const QueryGroupsByAdminRequest = { typeUrl: "/cosmos.group.v1.QueryGroupsByAdminRequest", value: QueryGroupsByAdminRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryGroupsByAdminRequest.typeUrl)) { + return; + } + PageRequest.registerTypeUrl(); } }; function createBaseQueryGroupsByAdminResponse(): QueryGroupsByAdminResponse { @@ -1772,6 +1869,15 @@ function createBaseQueryGroupsByAdminResponse(): QueryGroupsByAdminResponse { export const QueryGroupsByAdminResponse = { typeUrl: "/cosmos.group.v1.QueryGroupsByAdminResponse", aminoType: "cosmos-sdk/QueryGroupsByAdminResponse", + is(o: any): o is QueryGroupsByAdminResponse { + return o && (o.$typeUrl === QueryGroupsByAdminResponse.typeUrl || Array.isArray(o.groups) && (!o.groups.length || GroupInfo.is(o.groups[0]))); + }, + isSDK(o: any): o is QueryGroupsByAdminResponseSDKType { + return o && (o.$typeUrl === QueryGroupsByAdminResponse.typeUrl || Array.isArray(o.groups) && (!o.groups.length || GroupInfo.isSDK(o.groups[0]))); + }, + isAmino(o: any): o is QueryGroupsByAdminResponseAmino { + return o && (o.$typeUrl === QueryGroupsByAdminResponse.typeUrl || Array.isArray(o.groups) && (!o.groups.length || GroupInfo.isAmino(o.groups[0]))); + }, encode(message: QueryGroupsByAdminResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.groups) { GroupInfo.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -1860,6 +1966,13 @@ export const QueryGroupsByAdminResponse = { typeUrl: "/cosmos.group.v1.QueryGroupsByAdminResponse", value: QueryGroupsByAdminResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryGroupsByAdminResponse.typeUrl)) { + return; + } + GroupInfo.registerTypeUrl(); + PageResponse.registerTypeUrl(); } }; function createBaseQueryGroupPoliciesByGroupRequest(): QueryGroupPoliciesByGroupRequest { @@ -1877,6 +1990,15 @@ function createBaseQueryGroupPoliciesByGroupRequest(): QueryGroupPoliciesByGroup export const QueryGroupPoliciesByGroupRequest = { typeUrl: "/cosmos.group.v1.QueryGroupPoliciesByGroupRequest", aminoType: "cosmos-sdk/QueryGroupPoliciesByGroupRequest", + is(o: any): o is QueryGroupPoliciesByGroupRequest { + return o && (o.$typeUrl === QueryGroupPoliciesByGroupRequest.typeUrl || typeof o.groupId === "bigint"); + }, + isSDK(o: any): o is QueryGroupPoliciesByGroupRequestSDKType { + return o && (o.$typeUrl === QueryGroupPoliciesByGroupRequest.typeUrl || typeof o.group_id === "bigint"); + }, + isAmino(o: any): o is QueryGroupPoliciesByGroupRequestAmino { + return o && (o.$typeUrl === QueryGroupPoliciesByGroupRequest.typeUrl || typeof o.group_id === "bigint"); + }, encode(message: QueryGroupPoliciesByGroupRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.groupId !== BigInt(0)) { writer.uint32(8).uint64(message.groupId); @@ -1961,6 +2083,12 @@ export const QueryGroupPoliciesByGroupRequest = { typeUrl: "/cosmos.group.v1.QueryGroupPoliciesByGroupRequest", value: QueryGroupPoliciesByGroupRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryGroupPoliciesByGroupRequest.typeUrl)) { + return; + } + PageRequest.registerTypeUrl(); } }; function createBaseQueryGroupPoliciesByGroupResponse(): QueryGroupPoliciesByGroupResponse { @@ -1978,6 +2106,15 @@ function createBaseQueryGroupPoliciesByGroupResponse(): QueryGroupPoliciesByGrou export const QueryGroupPoliciesByGroupResponse = { typeUrl: "/cosmos.group.v1.QueryGroupPoliciesByGroupResponse", aminoType: "cosmos-sdk/QueryGroupPoliciesByGroupResponse", + is(o: any): o is QueryGroupPoliciesByGroupResponse { + return o && (o.$typeUrl === QueryGroupPoliciesByGroupResponse.typeUrl || Array.isArray(o.groupPolicies) && (!o.groupPolicies.length || GroupPolicyInfo.is(o.groupPolicies[0]))); + }, + isSDK(o: any): o is QueryGroupPoliciesByGroupResponseSDKType { + return o && (o.$typeUrl === QueryGroupPoliciesByGroupResponse.typeUrl || Array.isArray(o.group_policies) && (!o.group_policies.length || GroupPolicyInfo.isSDK(o.group_policies[0]))); + }, + isAmino(o: any): o is QueryGroupPoliciesByGroupResponseAmino { + return o && (o.$typeUrl === QueryGroupPoliciesByGroupResponse.typeUrl || Array.isArray(o.group_policies) && (!o.group_policies.length || GroupPolicyInfo.isAmino(o.group_policies[0]))); + }, encode(message: QueryGroupPoliciesByGroupResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.groupPolicies) { GroupPolicyInfo.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -2066,6 +2203,13 @@ export const QueryGroupPoliciesByGroupResponse = { typeUrl: "/cosmos.group.v1.QueryGroupPoliciesByGroupResponse", value: QueryGroupPoliciesByGroupResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryGroupPoliciesByGroupResponse.typeUrl)) { + return; + } + GroupPolicyInfo.registerTypeUrl(); + PageResponse.registerTypeUrl(); } }; function createBaseQueryGroupPoliciesByAdminRequest(): QueryGroupPoliciesByAdminRequest { @@ -2083,6 +2227,15 @@ function createBaseQueryGroupPoliciesByAdminRequest(): QueryGroupPoliciesByAdmin export const QueryGroupPoliciesByAdminRequest = { typeUrl: "/cosmos.group.v1.QueryGroupPoliciesByAdminRequest", aminoType: "cosmos-sdk/QueryGroupPoliciesByAdminRequest", + is(o: any): o is QueryGroupPoliciesByAdminRequest { + return o && (o.$typeUrl === QueryGroupPoliciesByAdminRequest.typeUrl || typeof o.admin === "string"); + }, + isSDK(o: any): o is QueryGroupPoliciesByAdminRequestSDKType { + return o && (o.$typeUrl === QueryGroupPoliciesByAdminRequest.typeUrl || typeof o.admin === "string"); + }, + isAmino(o: any): o is QueryGroupPoliciesByAdminRequestAmino { + return o && (o.$typeUrl === QueryGroupPoliciesByAdminRequest.typeUrl || typeof o.admin === "string"); + }, encode(message: QueryGroupPoliciesByAdminRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.admin !== "") { writer.uint32(10).string(message.admin); @@ -2165,6 +2318,12 @@ export const QueryGroupPoliciesByAdminRequest = { typeUrl: "/cosmos.group.v1.QueryGroupPoliciesByAdminRequest", value: QueryGroupPoliciesByAdminRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryGroupPoliciesByAdminRequest.typeUrl)) { + return; + } + PageRequest.registerTypeUrl(); } }; function createBaseQueryGroupPoliciesByAdminResponse(): QueryGroupPoliciesByAdminResponse { @@ -2182,6 +2341,15 @@ function createBaseQueryGroupPoliciesByAdminResponse(): QueryGroupPoliciesByAdmi export const QueryGroupPoliciesByAdminResponse = { typeUrl: "/cosmos.group.v1.QueryGroupPoliciesByAdminResponse", aminoType: "cosmos-sdk/QueryGroupPoliciesByAdminResponse", + is(o: any): o is QueryGroupPoliciesByAdminResponse { + return o && (o.$typeUrl === QueryGroupPoliciesByAdminResponse.typeUrl || Array.isArray(o.groupPolicies) && (!o.groupPolicies.length || GroupPolicyInfo.is(o.groupPolicies[0]))); + }, + isSDK(o: any): o is QueryGroupPoliciesByAdminResponseSDKType { + return o && (o.$typeUrl === QueryGroupPoliciesByAdminResponse.typeUrl || Array.isArray(o.group_policies) && (!o.group_policies.length || GroupPolicyInfo.isSDK(o.group_policies[0]))); + }, + isAmino(o: any): o is QueryGroupPoliciesByAdminResponseAmino { + return o && (o.$typeUrl === QueryGroupPoliciesByAdminResponse.typeUrl || Array.isArray(o.group_policies) && (!o.group_policies.length || GroupPolicyInfo.isAmino(o.group_policies[0]))); + }, encode(message: QueryGroupPoliciesByAdminResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.groupPolicies) { GroupPolicyInfo.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -2270,6 +2438,13 @@ export const QueryGroupPoliciesByAdminResponse = { typeUrl: "/cosmos.group.v1.QueryGroupPoliciesByAdminResponse", value: QueryGroupPoliciesByAdminResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryGroupPoliciesByAdminResponse.typeUrl)) { + return; + } + GroupPolicyInfo.registerTypeUrl(); + PageResponse.registerTypeUrl(); } }; function createBaseQueryProposalRequest(): QueryProposalRequest { @@ -2286,6 +2461,15 @@ function createBaseQueryProposalRequest(): QueryProposalRequest { export const QueryProposalRequest = { typeUrl: "/cosmos.group.v1.QueryProposalRequest", aminoType: "cosmos-sdk/QueryProposalRequest", + is(o: any): o is QueryProposalRequest { + return o && (o.$typeUrl === QueryProposalRequest.typeUrl || typeof o.proposalId === "bigint"); + }, + isSDK(o: any): o is QueryProposalRequestSDKType { + return o && (o.$typeUrl === QueryProposalRequest.typeUrl || typeof o.proposal_id === "bigint"); + }, + isAmino(o: any): o is QueryProposalRequestAmino { + return o && (o.$typeUrl === QueryProposalRequest.typeUrl || typeof o.proposal_id === "bigint"); + }, encode(message: QueryProposalRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.proposalId !== BigInt(0)) { writer.uint32(8).uint64(message.proposalId); @@ -2354,7 +2538,8 @@ export const QueryProposalRequest = { typeUrl: "/cosmos.group.v1.QueryProposalRequest", value: QueryProposalRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryProposalResponse(): QueryProposalResponse { return { @@ -2370,6 +2555,15 @@ function createBaseQueryProposalResponse(): QueryProposalResponse { export const QueryProposalResponse = { typeUrl: "/cosmos.group.v1.QueryProposalResponse", aminoType: "cosmos-sdk/QueryProposalResponse", + is(o: any): o is QueryProposalResponse { + return o && o.$typeUrl === QueryProposalResponse.typeUrl; + }, + isSDK(o: any): o is QueryProposalResponseSDKType { + return o && o.$typeUrl === QueryProposalResponse.typeUrl; + }, + isAmino(o: any): o is QueryProposalResponseAmino { + return o && o.$typeUrl === QueryProposalResponse.typeUrl; + }, encode(message: QueryProposalResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.proposal !== undefined) { Proposal.encode(message.proposal, writer.uint32(10).fork()).ldelim(); @@ -2438,6 +2632,12 @@ export const QueryProposalResponse = { typeUrl: "/cosmos.group.v1.QueryProposalResponse", value: QueryProposalResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryProposalResponse.typeUrl)) { + return; + } + Proposal.registerTypeUrl(); } }; function createBaseQueryProposalsByGroupPolicyRequest(): QueryProposalsByGroupPolicyRequest { @@ -2455,6 +2655,15 @@ function createBaseQueryProposalsByGroupPolicyRequest(): QueryProposalsByGroupPo export const QueryProposalsByGroupPolicyRequest = { typeUrl: "/cosmos.group.v1.QueryProposalsByGroupPolicyRequest", aminoType: "cosmos-sdk/QueryProposalsByGroupPolicyRequest", + is(o: any): o is QueryProposalsByGroupPolicyRequest { + return o && (o.$typeUrl === QueryProposalsByGroupPolicyRequest.typeUrl || typeof o.address === "string"); + }, + isSDK(o: any): o is QueryProposalsByGroupPolicyRequestSDKType { + return o && (o.$typeUrl === QueryProposalsByGroupPolicyRequest.typeUrl || typeof o.address === "string"); + }, + isAmino(o: any): o is QueryProposalsByGroupPolicyRequestAmino { + return o && (o.$typeUrl === QueryProposalsByGroupPolicyRequest.typeUrl || typeof o.address === "string"); + }, encode(message: QueryProposalsByGroupPolicyRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.address !== "") { writer.uint32(10).string(message.address); @@ -2537,6 +2746,12 @@ export const QueryProposalsByGroupPolicyRequest = { typeUrl: "/cosmos.group.v1.QueryProposalsByGroupPolicyRequest", value: QueryProposalsByGroupPolicyRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryProposalsByGroupPolicyRequest.typeUrl)) { + return; + } + PageRequest.registerTypeUrl(); } }; function createBaseQueryProposalsByGroupPolicyResponse(): QueryProposalsByGroupPolicyResponse { @@ -2554,6 +2769,15 @@ function createBaseQueryProposalsByGroupPolicyResponse(): QueryProposalsByGroupP export const QueryProposalsByGroupPolicyResponse = { typeUrl: "/cosmos.group.v1.QueryProposalsByGroupPolicyResponse", aminoType: "cosmos-sdk/QueryProposalsByGroupPolicyResponse", + is(o: any): o is QueryProposalsByGroupPolicyResponse { + return o && (o.$typeUrl === QueryProposalsByGroupPolicyResponse.typeUrl || Array.isArray(o.proposals) && (!o.proposals.length || Proposal.is(o.proposals[0]))); + }, + isSDK(o: any): o is QueryProposalsByGroupPolicyResponseSDKType { + return o && (o.$typeUrl === QueryProposalsByGroupPolicyResponse.typeUrl || Array.isArray(o.proposals) && (!o.proposals.length || Proposal.isSDK(o.proposals[0]))); + }, + isAmino(o: any): o is QueryProposalsByGroupPolicyResponseAmino { + return o && (o.$typeUrl === QueryProposalsByGroupPolicyResponse.typeUrl || Array.isArray(o.proposals) && (!o.proposals.length || Proposal.isAmino(o.proposals[0]))); + }, encode(message: QueryProposalsByGroupPolicyResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.proposals) { Proposal.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -2642,6 +2866,13 @@ export const QueryProposalsByGroupPolicyResponse = { typeUrl: "/cosmos.group.v1.QueryProposalsByGroupPolicyResponse", value: QueryProposalsByGroupPolicyResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryProposalsByGroupPolicyResponse.typeUrl)) { + return; + } + Proposal.registerTypeUrl(); + PageResponse.registerTypeUrl(); } }; function createBaseQueryVoteByProposalVoterRequest(): QueryVoteByProposalVoterRequest { @@ -2659,6 +2890,15 @@ function createBaseQueryVoteByProposalVoterRequest(): QueryVoteByProposalVoterRe export const QueryVoteByProposalVoterRequest = { typeUrl: "/cosmos.group.v1.QueryVoteByProposalVoterRequest", aminoType: "cosmos-sdk/QueryVoteByProposalVoterRequest", + is(o: any): o is QueryVoteByProposalVoterRequest { + return o && (o.$typeUrl === QueryVoteByProposalVoterRequest.typeUrl || typeof o.proposalId === "bigint" && typeof o.voter === "string"); + }, + isSDK(o: any): o is QueryVoteByProposalVoterRequestSDKType { + return o && (o.$typeUrl === QueryVoteByProposalVoterRequest.typeUrl || typeof o.proposal_id === "bigint" && typeof o.voter === "string"); + }, + isAmino(o: any): o is QueryVoteByProposalVoterRequestAmino { + return o && (o.$typeUrl === QueryVoteByProposalVoterRequest.typeUrl || typeof o.proposal_id === "bigint" && typeof o.voter === "string"); + }, encode(message: QueryVoteByProposalVoterRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.proposalId !== BigInt(0)) { writer.uint32(8).uint64(message.proposalId); @@ -2741,7 +2981,8 @@ export const QueryVoteByProposalVoterRequest = { typeUrl: "/cosmos.group.v1.QueryVoteByProposalVoterRequest", value: QueryVoteByProposalVoterRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryVoteByProposalVoterResponse(): QueryVoteByProposalVoterResponse { return { @@ -2757,6 +2998,15 @@ function createBaseQueryVoteByProposalVoterResponse(): QueryVoteByProposalVoterR export const QueryVoteByProposalVoterResponse = { typeUrl: "/cosmos.group.v1.QueryVoteByProposalVoterResponse", aminoType: "cosmos-sdk/QueryVoteByProposalVoterResponse", + is(o: any): o is QueryVoteByProposalVoterResponse { + return o && o.$typeUrl === QueryVoteByProposalVoterResponse.typeUrl; + }, + isSDK(o: any): o is QueryVoteByProposalVoterResponseSDKType { + return o && o.$typeUrl === QueryVoteByProposalVoterResponse.typeUrl; + }, + isAmino(o: any): o is QueryVoteByProposalVoterResponseAmino { + return o && o.$typeUrl === QueryVoteByProposalVoterResponse.typeUrl; + }, encode(message: QueryVoteByProposalVoterResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.vote !== undefined) { Vote.encode(message.vote, writer.uint32(10).fork()).ldelim(); @@ -2825,6 +3075,12 @@ export const QueryVoteByProposalVoterResponse = { typeUrl: "/cosmos.group.v1.QueryVoteByProposalVoterResponse", value: QueryVoteByProposalVoterResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryVoteByProposalVoterResponse.typeUrl)) { + return; + } + Vote.registerTypeUrl(); } }; function createBaseQueryVotesByProposalRequest(): QueryVotesByProposalRequest { @@ -2842,6 +3098,15 @@ function createBaseQueryVotesByProposalRequest(): QueryVotesByProposalRequest { export const QueryVotesByProposalRequest = { typeUrl: "/cosmos.group.v1.QueryVotesByProposalRequest", aminoType: "cosmos-sdk/QueryVotesByProposalRequest", + is(o: any): o is QueryVotesByProposalRequest { + return o && (o.$typeUrl === QueryVotesByProposalRequest.typeUrl || typeof o.proposalId === "bigint"); + }, + isSDK(o: any): o is QueryVotesByProposalRequestSDKType { + return o && (o.$typeUrl === QueryVotesByProposalRequest.typeUrl || typeof o.proposal_id === "bigint"); + }, + isAmino(o: any): o is QueryVotesByProposalRequestAmino { + return o && (o.$typeUrl === QueryVotesByProposalRequest.typeUrl || typeof o.proposal_id === "bigint"); + }, encode(message: QueryVotesByProposalRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.proposalId !== BigInt(0)) { writer.uint32(8).uint64(message.proposalId); @@ -2926,6 +3191,12 @@ export const QueryVotesByProposalRequest = { typeUrl: "/cosmos.group.v1.QueryVotesByProposalRequest", value: QueryVotesByProposalRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryVotesByProposalRequest.typeUrl)) { + return; + } + PageRequest.registerTypeUrl(); } }; function createBaseQueryVotesByProposalResponse(): QueryVotesByProposalResponse { @@ -2943,6 +3214,15 @@ function createBaseQueryVotesByProposalResponse(): QueryVotesByProposalResponse export const QueryVotesByProposalResponse = { typeUrl: "/cosmos.group.v1.QueryVotesByProposalResponse", aminoType: "cosmos-sdk/QueryVotesByProposalResponse", + is(o: any): o is QueryVotesByProposalResponse { + return o && (o.$typeUrl === QueryVotesByProposalResponse.typeUrl || Array.isArray(o.votes) && (!o.votes.length || Vote.is(o.votes[0]))); + }, + isSDK(o: any): o is QueryVotesByProposalResponseSDKType { + return o && (o.$typeUrl === QueryVotesByProposalResponse.typeUrl || Array.isArray(o.votes) && (!o.votes.length || Vote.isSDK(o.votes[0]))); + }, + isAmino(o: any): o is QueryVotesByProposalResponseAmino { + return o && (o.$typeUrl === QueryVotesByProposalResponse.typeUrl || Array.isArray(o.votes) && (!o.votes.length || Vote.isAmino(o.votes[0]))); + }, encode(message: QueryVotesByProposalResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.votes) { Vote.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -3031,6 +3311,13 @@ export const QueryVotesByProposalResponse = { typeUrl: "/cosmos.group.v1.QueryVotesByProposalResponse", value: QueryVotesByProposalResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryVotesByProposalResponse.typeUrl)) { + return; + } + Vote.registerTypeUrl(); + PageResponse.registerTypeUrl(); } }; function createBaseQueryVotesByVoterRequest(): QueryVotesByVoterRequest { @@ -3048,6 +3335,15 @@ function createBaseQueryVotesByVoterRequest(): QueryVotesByVoterRequest { export const QueryVotesByVoterRequest = { typeUrl: "/cosmos.group.v1.QueryVotesByVoterRequest", aminoType: "cosmos-sdk/QueryVotesByVoterRequest", + is(o: any): o is QueryVotesByVoterRequest { + return o && (o.$typeUrl === QueryVotesByVoterRequest.typeUrl || typeof o.voter === "string"); + }, + isSDK(o: any): o is QueryVotesByVoterRequestSDKType { + return o && (o.$typeUrl === QueryVotesByVoterRequest.typeUrl || typeof o.voter === "string"); + }, + isAmino(o: any): o is QueryVotesByVoterRequestAmino { + return o && (o.$typeUrl === QueryVotesByVoterRequest.typeUrl || typeof o.voter === "string"); + }, encode(message: QueryVotesByVoterRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.voter !== "") { writer.uint32(10).string(message.voter); @@ -3130,6 +3426,12 @@ export const QueryVotesByVoterRequest = { typeUrl: "/cosmos.group.v1.QueryVotesByVoterRequest", value: QueryVotesByVoterRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryVotesByVoterRequest.typeUrl)) { + return; + } + PageRequest.registerTypeUrl(); } }; function createBaseQueryVotesByVoterResponse(): QueryVotesByVoterResponse { @@ -3147,6 +3449,15 @@ function createBaseQueryVotesByVoterResponse(): QueryVotesByVoterResponse { export const QueryVotesByVoterResponse = { typeUrl: "/cosmos.group.v1.QueryVotesByVoterResponse", aminoType: "cosmos-sdk/QueryVotesByVoterResponse", + is(o: any): o is QueryVotesByVoterResponse { + return o && (o.$typeUrl === QueryVotesByVoterResponse.typeUrl || Array.isArray(o.votes) && (!o.votes.length || Vote.is(o.votes[0]))); + }, + isSDK(o: any): o is QueryVotesByVoterResponseSDKType { + return o && (o.$typeUrl === QueryVotesByVoterResponse.typeUrl || Array.isArray(o.votes) && (!o.votes.length || Vote.isSDK(o.votes[0]))); + }, + isAmino(o: any): o is QueryVotesByVoterResponseAmino { + return o && (o.$typeUrl === QueryVotesByVoterResponse.typeUrl || Array.isArray(o.votes) && (!o.votes.length || Vote.isAmino(o.votes[0]))); + }, encode(message: QueryVotesByVoterResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.votes) { Vote.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -3235,6 +3546,13 @@ export const QueryVotesByVoterResponse = { typeUrl: "/cosmos.group.v1.QueryVotesByVoterResponse", value: QueryVotesByVoterResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryVotesByVoterResponse.typeUrl)) { + return; + } + Vote.registerTypeUrl(); + PageResponse.registerTypeUrl(); } }; function createBaseQueryGroupsByMemberRequest(): QueryGroupsByMemberRequest { @@ -3252,6 +3570,15 @@ function createBaseQueryGroupsByMemberRequest(): QueryGroupsByMemberRequest { export const QueryGroupsByMemberRequest = { typeUrl: "/cosmos.group.v1.QueryGroupsByMemberRequest", aminoType: "cosmos-sdk/QueryGroupsByMemberRequest", + is(o: any): o is QueryGroupsByMemberRequest { + return o && (o.$typeUrl === QueryGroupsByMemberRequest.typeUrl || typeof o.address === "string"); + }, + isSDK(o: any): o is QueryGroupsByMemberRequestSDKType { + return o && (o.$typeUrl === QueryGroupsByMemberRequest.typeUrl || typeof o.address === "string"); + }, + isAmino(o: any): o is QueryGroupsByMemberRequestAmino { + return o && (o.$typeUrl === QueryGroupsByMemberRequest.typeUrl || typeof o.address === "string"); + }, encode(message: QueryGroupsByMemberRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.address !== "") { writer.uint32(10).string(message.address); @@ -3334,6 +3661,12 @@ export const QueryGroupsByMemberRequest = { typeUrl: "/cosmos.group.v1.QueryGroupsByMemberRequest", value: QueryGroupsByMemberRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryGroupsByMemberRequest.typeUrl)) { + return; + } + PageRequest.registerTypeUrl(); } }; function createBaseQueryGroupsByMemberResponse(): QueryGroupsByMemberResponse { @@ -3351,6 +3684,15 @@ function createBaseQueryGroupsByMemberResponse(): QueryGroupsByMemberResponse { export const QueryGroupsByMemberResponse = { typeUrl: "/cosmos.group.v1.QueryGroupsByMemberResponse", aminoType: "cosmos-sdk/QueryGroupsByMemberResponse", + is(o: any): o is QueryGroupsByMemberResponse { + return o && (o.$typeUrl === QueryGroupsByMemberResponse.typeUrl || Array.isArray(o.groups) && (!o.groups.length || GroupInfo.is(o.groups[0]))); + }, + isSDK(o: any): o is QueryGroupsByMemberResponseSDKType { + return o && (o.$typeUrl === QueryGroupsByMemberResponse.typeUrl || Array.isArray(o.groups) && (!o.groups.length || GroupInfo.isSDK(o.groups[0]))); + }, + isAmino(o: any): o is QueryGroupsByMemberResponseAmino { + return o && (o.$typeUrl === QueryGroupsByMemberResponse.typeUrl || Array.isArray(o.groups) && (!o.groups.length || GroupInfo.isAmino(o.groups[0]))); + }, encode(message: QueryGroupsByMemberResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.groups) { GroupInfo.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -3439,6 +3781,13 @@ export const QueryGroupsByMemberResponse = { typeUrl: "/cosmos.group.v1.QueryGroupsByMemberResponse", value: QueryGroupsByMemberResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryGroupsByMemberResponse.typeUrl)) { + return; + } + GroupInfo.registerTypeUrl(); + PageResponse.registerTypeUrl(); } }; function createBaseQueryTallyResultRequest(): QueryTallyResultRequest { @@ -3455,6 +3804,15 @@ function createBaseQueryTallyResultRequest(): QueryTallyResultRequest { export const QueryTallyResultRequest = { typeUrl: "/cosmos.group.v1.QueryTallyResultRequest", aminoType: "cosmos-sdk/QueryTallyResultRequest", + is(o: any): o is QueryTallyResultRequest { + return o && (o.$typeUrl === QueryTallyResultRequest.typeUrl || typeof o.proposalId === "bigint"); + }, + isSDK(o: any): o is QueryTallyResultRequestSDKType { + return o && (o.$typeUrl === QueryTallyResultRequest.typeUrl || typeof o.proposal_id === "bigint"); + }, + isAmino(o: any): o is QueryTallyResultRequestAmino { + return o && (o.$typeUrl === QueryTallyResultRequest.typeUrl || typeof o.proposal_id === "bigint"); + }, encode(message: QueryTallyResultRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.proposalId !== BigInt(0)) { writer.uint32(8).uint64(message.proposalId); @@ -3523,7 +3881,8 @@ export const QueryTallyResultRequest = { typeUrl: "/cosmos.group.v1.QueryTallyResultRequest", value: QueryTallyResultRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryTallyResultResponse(): QueryTallyResultResponse { return { @@ -3539,6 +3898,15 @@ function createBaseQueryTallyResultResponse(): QueryTallyResultResponse { export const QueryTallyResultResponse = { typeUrl: "/cosmos.group.v1.QueryTallyResultResponse", aminoType: "cosmos-sdk/QueryTallyResultResponse", + is(o: any): o is QueryTallyResultResponse { + return o && (o.$typeUrl === QueryTallyResultResponse.typeUrl || TallyResult.is(o.tally)); + }, + isSDK(o: any): o is QueryTallyResultResponseSDKType { + return o && (o.$typeUrl === QueryTallyResultResponse.typeUrl || TallyResult.isSDK(o.tally)); + }, + isAmino(o: any): o is QueryTallyResultResponseAmino { + return o && (o.$typeUrl === QueryTallyResultResponse.typeUrl || TallyResult.isAmino(o.tally)); + }, encode(message: QueryTallyResultResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.tally !== undefined) { TallyResult.encode(message.tally, writer.uint32(10).fork()).ldelim(); @@ -3607,5 +3975,11 @@ export const QueryTallyResultResponse = { typeUrl: "/cosmos.group.v1.QueryTallyResultResponse", value: QueryTallyResultResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryTallyResultResponse.typeUrl)) { + return; + } + TallyResult.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/cosmos/group/v1/tx.registry.ts b/__fixtures__/v-next/outputv3/cosmos/group/v1/tx.registry.ts index 891aa57eb8..9aa1691460 100644 --- a/__fixtures__/v-next/outputv3/cosmos/group/v1/tx.registry.ts +++ b/__fixtures__/v-next/outputv3/cosmos/group/v1/tx.registry.ts @@ -1,13 +1,8 @@ import { Member, MemberSDKType, VoteOption, VoteOptionSDKType, ThresholdDecisionPolicy, ThresholdDecisionPolicySDKType, PercentageDecisionPolicy, PercentageDecisionPolicySDKType } from "./types"; import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../google/protobuf/any"; -import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { TelescopeGeneratedType } from "../../../types"; import { MsgCreateGroup, MsgCreateGroupSDKType, MsgUpdateGroupMembers, MsgUpdateGroupMembersSDKType, MsgUpdateGroupAdmin, MsgUpdateGroupAdminSDKType, MsgUpdateGroupMetadata, MsgUpdateGroupMetadataSDKType, MsgCreateGroupPolicy, MsgCreateGroupPolicySDKType, MsgCreateGroupWithPolicy, MsgCreateGroupWithPolicySDKType, MsgUpdateGroupPolicyAdmin, MsgUpdateGroupPolicyAdminSDKType, MsgUpdateGroupPolicyDecisionPolicy, MsgUpdateGroupPolicyDecisionPolicySDKType, MsgUpdateGroupPolicyMetadata, MsgUpdateGroupPolicyMetadataSDKType, MsgSubmitProposal, MsgSubmitProposalSDKType, MsgWithdrawProposal, MsgWithdrawProposalSDKType, MsgVote, MsgVoteSDKType, MsgExec, MsgExecSDKType, MsgLeaveGroup, MsgLeaveGroupSDKType } from "./tx"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/cosmos.group.v1.MsgCreateGroup", MsgCreateGroup], ["/cosmos.group.v1.MsgUpdateGroupMembers", MsgUpdateGroupMembers], ["/cosmos.group.v1.MsgUpdateGroupAdmin", MsgUpdateGroupAdmin], ["/cosmos.group.v1.MsgUpdateGroupMetadata", MsgUpdateGroupMetadata], ["/cosmos.group.v1.MsgCreateGroupPolicy", MsgCreateGroupPolicy], ["/cosmos.group.v1.MsgCreateGroupWithPolicy", MsgCreateGroupWithPolicy], ["/cosmos.group.v1.MsgUpdateGroupPolicyAdmin", MsgUpdateGroupPolicyAdmin], ["/cosmos.group.v1.MsgUpdateGroupPolicyDecisionPolicy", MsgUpdateGroupPolicyDecisionPolicy], ["/cosmos.group.v1.MsgUpdateGroupPolicyMetadata", MsgUpdateGroupPolicyMetadata], ["/cosmos.group.v1.MsgSubmitProposal", MsgSubmitProposal], ["/cosmos.group.v1.MsgWithdrawProposal", MsgWithdrawProposal], ["/cosmos.group.v1.MsgVote", MsgVote], ["/cosmos.group.v1.MsgExec", MsgExec], ["/cosmos.group.v1.MsgLeaveGroup", MsgLeaveGroup]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/cosmos.group.v1.MsgCreateGroup", MsgCreateGroup], ["/cosmos.group.v1.MsgUpdateGroupMembers", MsgUpdateGroupMembers], ["/cosmos.group.v1.MsgUpdateGroupAdmin", MsgUpdateGroupAdmin], ["/cosmos.group.v1.MsgUpdateGroupMetadata", MsgUpdateGroupMetadata], ["/cosmos.group.v1.MsgCreateGroupPolicy", MsgCreateGroupPolicy], ["/cosmos.group.v1.MsgCreateGroupWithPolicy", MsgCreateGroupWithPolicy], ["/cosmos.group.v1.MsgUpdateGroupPolicyAdmin", MsgUpdateGroupPolicyAdmin], ["/cosmos.group.v1.MsgUpdateGroupPolicyDecisionPolicy", MsgUpdateGroupPolicyDecisionPolicy], ["/cosmos.group.v1.MsgUpdateGroupPolicyMetadata", MsgUpdateGroupPolicyMetadata], ["/cosmos.group.v1.MsgSubmitProposal", MsgSubmitProposal], ["/cosmos.group.v1.MsgWithdrawProposal", MsgWithdrawProposal], ["/cosmos.group.v1.MsgVote", MsgVote], ["/cosmos.group.v1.MsgExec", MsgExec], ["/cosmos.group.v1.MsgLeaveGroup", MsgLeaveGroup]]; export const MessageComposer = { encoded: { createGroup(value: MsgCreateGroup) { diff --git a/__fixtures__/v-next/outputv3/cosmos/group/v1/tx.rpc.func.ts b/__fixtures__/v-next/outputv3/cosmos/group/v1/tx.rpc.func.ts new file mode 100644 index 0000000000..7fa4debac3 --- /dev/null +++ b/__fixtures__/v-next/outputv3/cosmos/group/v1/tx.rpc.func.ts @@ -0,0 +1,130 @@ +import { Member, MemberSDKType, VoteOption, VoteOptionSDKType, ThresholdDecisionPolicy, ThresholdDecisionPolicySDKType, PercentageDecisionPolicy, PercentageDecisionPolicySDKType } from "./types"; +import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../google/protobuf/any"; +import { buildTx } from "../../../helper-func-types"; +import { MsgCreateGroup, MsgCreateGroupSDKType, MsgCreateGroupResponse, MsgCreateGroupResponseSDKType, MsgUpdateGroupMembers, MsgUpdateGroupMembersSDKType, MsgUpdateGroupMembersResponse, MsgUpdateGroupMembersResponseSDKType, MsgUpdateGroupAdmin, MsgUpdateGroupAdminSDKType, MsgUpdateGroupAdminResponse, MsgUpdateGroupAdminResponseSDKType, MsgUpdateGroupMetadata, MsgUpdateGroupMetadataSDKType, MsgUpdateGroupMetadataResponse, MsgUpdateGroupMetadataResponseSDKType, MsgCreateGroupPolicy, MsgCreateGroupPolicySDKType, MsgCreateGroupPolicyResponse, MsgCreateGroupPolicyResponseSDKType, MsgCreateGroupWithPolicy, MsgCreateGroupWithPolicySDKType, MsgCreateGroupWithPolicyResponse, MsgCreateGroupWithPolicyResponseSDKType, MsgUpdateGroupPolicyAdmin, MsgUpdateGroupPolicyAdminSDKType, MsgUpdateGroupPolicyAdminResponse, MsgUpdateGroupPolicyAdminResponseSDKType, MsgUpdateGroupPolicyDecisionPolicy, MsgUpdateGroupPolicyDecisionPolicySDKType, MsgUpdateGroupPolicyDecisionPolicyResponse, MsgUpdateGroupPolicyDecisionPolicyResponseSDKType, MsgUpdateGroupPolicyMetadata, MsgUpdateGroupPolicyMetadataSDKType, MsgUpdateGroupPolicyMetadataResponse, MsgUpdateGroupPolicyMetadataResponseSDKType, MsgSubmitProposal, MsgSubmitProposalSDKType, MsgSubmitProposalResponse, MsgSubmitProposalResponseSDKType, MsgWithdrawProposal, MsgWithdrawProposalSDKType, MsgWithdrawProposalResponse, MsgWithdrawProposalResponseSDKType, MsgVote, MsgVoteSDKType, MsgVoteResponse, MsgVoteResponseSDKType, MsgExec, MsgExecSDKType, MsgExecResponse, MsgExecResponseSDKType, MsgLeaveGroup, MsgLeaveGroupSDKType, MsgLeaveGroupResponse, MsgLeaveGroupResponseSDKType } from "./tx"; +/** + * CreateGroup creates a new group with an admin account address, a list of members and some optional metadata. + * @name createGroup + * @package cosmos.group.v1 + * @see proto service: cosmos.group.v1.CreateGroup + */ +export const createGroup = buildTx({ + msg: MsgCreateGroup +}); +/** + * UpdateGroupMembers updates the group members with given group id and admin address. + * @name updateGroupMembers + * @package cosmos.group.v1 + * @see proto service: cosmos.group.v1.UpdateGroupMembers + */ +export const updateGroupMembers = buildTx({ + msg: MsgUpdateGroupMembers +}); +/** + * UpdateGroupAdmin updates the group admin with given group id and previous admin address. + * @name updateGroupAdmin + * @package cosmos.group.v1 + * @see proto service: cosmos.group.v1.UpdateGroupAdmin + */ +export const updateGroupAdmin = buildTx({ + msg: MsgUpdateGroupAdmin +}); +/** + * UpdateGroupMetadata updates the group metadata with given group id and admin address. + * @name updateGroupMetadata + * @package cosmos.group.v1 + * @see proto service: cosmos.group.v1.UpdateGroupMetadata + */ +export const updateGroupMetadata = buildTx({ + msg: MsgUpdateGroupMetadata +}); +/** + * CreateGroupPolicy creates a new group policy using given DecisionPolicy. + * @name createGroupPolicy + * @package cosmos.group.v1 + * @see proto service: cosmos.group.v1.CreateGroupPolicy + */ +export const createGroupPolicy = buildTx({ + msg: MsgCreateGroupPolicy +}); +/** + * CreateGroupWithPolicy creates a new group with policy. + * @name createGroupWithPolicy + * @package cosmos.group.v1 + * @see proto service: cosmos.group.v1.CreateGroupWithPolicy + */ +export const createGroupWithPolicy = buildTx({ + msg: MsgCreateGroupWithPolicy +}); +/** + * UpdateGroupPolicyAdmin updates a group policy admin. + * @name updateGroupPolicyAdmin + * @package cosmos.group.v1 + * @see proto service: cosmos.group.v1.UpdateGroupPolicyAdmin + */ +export const updateGroupPolicyAdmin = buildTx({ + msg: MsgUpdateGroupPolicyAdmin +}); +/** + * UpdateGroupPolicyDecisionPolicy allows a group policy's decision policy to be updated. + * @name updateGroupPolicyDecisionPolicy + * @package cosmos.group.v1 + * @see proto service: cosmos.group.v1.UpdateGroupPolicyDecisionPolicy + */ +export const updateGroupPolicyDecisionPolicy = buildTx({ + msg: MsgUpdateGroupPolicyDecisionPolicy +}); +/** + * UpdateGroupPolicyMetadata updates a group policy metadata. + * @name updateGroupPolicyMetadata + * @package cosmos.group.v1 + * @see proto service: cosmos.group.v1.UpdateGroupPolicyMetadata + */ +export const updateGroupPolicyMetadata = buildTx({ + msg: MsgUpdateGroupPolicyMetadata +}); +/** + * SubmitProposal submits a new proposal. + * @name submitProposal + * @package cosmos.group.v1 + * @see proto service: cosmos.group.v1.SubmitProposal + */ +export const submitProposal = buildTx({ + msg: MsgSubmitProposal +}); +/** + * WithdrawProposal aborts a proposal. + * @name withdrawProposal + * @package cosmos.group.v1 + * @see proto service: cosmos.group.v1.WithdrawProposal + */ +export const withdrawProposal = buildTx({ + msg: MsgWithdrawProposal +}); +/** + * Vote allows a voter to vote on a proposal. + * @name vote + * @package cosmos.group.v1 + * @see proto service: cosmos.group.v1.Vote + */ +export const vote = buildTx({ + msg: MsgVote +}); +/** + * Exec executes a proposal. + * @name exec + * @package cosmos.group.v1 + * @see proto service: cosmos.group.v1.Exec + */ +export const exec = buildTx({ + msg: MsgExec +}); +/** + * LeaveGroup allows a group member to leave the group. + * @name leaveGroup + * @package cosmos.group.v1 + * @see proto service: cosmos.group.v1.LeaveGroup + */ +export const leaveGroup = buildTx({ + msg: MsgLeaveGroup +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/cosmos/group/v1/tx.ts b/__fixtures__/v-next/outputv3/cosmos/group/v1/tx.ts index b5dfc7be63..a64edb9b9b 100644 --- a/__fixtures__/v-next/outputv3/cosmos/group/v1/tx.ts +++ b/__fixtures__/v-next/outputv3/cosmos/group/v1/tx.ts @@ -2,6 +2,7 @@ import { Member, MemberAmino, MemberSDKType, VoteOption, VoteOptionSDKType, Thre import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../google/protobuf/any"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { isSet, DeepPartial } from "../../../helpers"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "cosmos.group.v1"; /** Exec defines modes of execution of a proposal on creation or on new vote. */ export enum Exec { @@ -1312,6 +1313,15 @@ function createBaseMsgCreateGroup(): MsgCreateGroup { export const MsgCreateGroup = { typeUrl: "/cosmos.group.v1.MsgCreateGroup", aminoType: "cosmos-sdk/MsgCreateGroup", + is(o: any): o is MsgCreateGroup { + return o && (o.$typeUrl === MsgCreateGroup.typeUrl || typeof o.admin === "string" && Array.isArray(o.members) && (!o.members.length || Member.is(o.members[0])) && typeof o.metadata === "string"); + }, + isSDK(o: any): o is MsgCreateGroupSDKType { + return o && (o.$typeUrl === MsgCreateGroup.typeUrl || typeof o.admin === "string" && Array.isArray(o.members) && (!o.members.length || Member.isSDK(o.members[0])) && typeof o.metadata === "string"); + }, + isAmino(o: any): o is MsgCreateGroupAmino { + return o && (o.$typeUrl === MsgCreateGroup.typeUrl || typeof o.admin === "string" && Array.isArray(o.members) && (!o.members.length || Member.isAmino(o.members[0])) && typeof o.metadata === "string"); + }, encode(message: MsgCreateGroup, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.admin !== "") { writer.uint32(10).string(message.admin); @@ -1412,6 +1422,12 @@ export const MsgCreateGroup = { typeUrl: "/cosmos.group.v1.MsgCreateGroup", value: MsgCreateGroup.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgCreateGroup.typeUrl)) { + return; + } + Member.registerTypeUrl(); } }; function createBaseMsgCreateGroupResponse(): MsgCreateGroupResponse { @@ -1428,6 +1444,15 @@ function createBaseMsgCreateGroupResponse(): MsgCreateGroupResponse { export const MsgCreateGroupResponse = { typeUrl: "/cosmos.group.v1.MsgCreateGroupResponse", aminoType: "cosmos-sdk/MsgCreateGroupResponse", + is(o: any): o is MsgCreateGroupResponse { + return o && (o.$typeUrl === MsgCreateGroupResponse.typeUrl || typeof o.groupId === "bigint"); + }, + isSDK(o: any): o is MsgCreateGroupResponseSDKType { + return o && (o.$typeUrl === MsgCreateGroupResponse.typeUrl || typeof o.group_id === "bigint"); + }, + isAmino(o: any): o is MsgCreateGroupResponseAmino { + return o && (o.$typeUrl === MsgCreateGroupResponse.typeUrl || typeof o.group_id === "bigint"); + }, encode(message: MsgCreateGroupResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.groupId !== BigInt(0)) { writer.uint32(8).uint64(message.groupId); @@ -1496,7 +1521,8 @@ export const MsgCreateGroupResponse = { typeUrl: "/cosmos.group.v1.MsgCreateGroupResponse", value: MsgCreateGroupResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgUpdateGroupMembers(): MsgUpdateGroupMembers { return { @@ -1514,6 +1540,15 @@ function createBaseMsgUpdateGroupMembers(): MsgUpdateGroupMembers { export const MsgUpdateGroupMembers = { typeUrl: "/cosmos.group.v1.MsgUpdateGroupMembers", aminoType: "cosmos-sdk/MsgUpdateGroupMembers", + is(o: any): o is MsgUpdateGroupMembers { + return o && (o.$typeUrl === MsgUpdateGroupMembers.typeUrl || typeof o.admin === "string" && typeof o.groupId === "bigint" && Array.isArray(o.memberUpdates) && (!o.memberUpdates.length || Member.is(o.memberUpdates[0]))); + }, + isSDK(o: any): o is MsgUpdateGroupMembersSDKType { + return o && (o.$typeUrl === MsgUpdateGroupMembers.typeUrl || typeof o.admin === "string" && typeof o.group_id === "bigint" && Array.isArray(o.member_updates) && (!o.member_updates.length || Member.isSDK(o.member_updates[0]))); + }, + isAmino(o: any): o is MsgUpdateGroupMembersAmino { + return o && (o.$typeUrl === MsgUpdateGroupMembers.typeUrl || typeof o.admin === "string" && typeof o.group_id === "bigint" && Array.isArray(o.member_updates) && (!o.member_updates.length || Member.isAmino(o.member_updates[0]))); + }, encode(message: MsgUpdateGroupMembers, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.admin !== "") { writer.uint32(10).string(message.admin); @@ -1616,6 +1651,12 @@ export const MsgUpdateGroupMembers = { typeUrl: "/cosmos.group.v1.MsgUpdateGroupMembers", value: MsgUpdateGroupMembers.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgUpdateGroupMembers.typeUrl)) { + return; + } + Member.registerTypeUrl(); } }; function createBaseMsgUpdateGroupMembersResponse(): MsgUpdateGroupMembersResponse { @@ -1630,6 +1671,15 @@ function createBaseMsgUpdateGroupMembersResponse(): MsgUpdateGroupMembersRespons export const MsgUpdateGroupMembersResponse = { typeUrl: "/cosmos.group.v1.MsgUpdateGroupMembersResponse", aminoType: "cosmos-sdk/MsgUpdateGroupMembersResponse", + is(o: any): o is MsgUpdateGroupMembersResponse { + return o && o.$typeUrl === MsgUpdateGroupMembersResponse.typeUrl; + }, + isSDK(o: any): o is MsgUpdateGroupMembersResponseSDKType { + return o && o.$typeUrl === MsgUpdateGroupMembersResponse.typeUrl; + }, + isAmino(o: any): o is MsgUpdateGroupMembersResponseAmino { + return o && o.$typeUrl === MsgUpdateGroupMembersResponse.typeUrl; + }, encode(_: MsgUpdateGroupMembersResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -1681,7 +1731,8 @@ export const MsgUpdateGroupMembersResponse = { typeUrl: "/cosmos.group.v1.MsgUpdateGroupMembersResponse", value: MsgUpdateGroupMembersResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgUpdateGroupAdmin(): MsgUpdateGroupAdmin { return { @@ -1699,6 +1750,15 @@ function createBaseMsgUpdateGroupAdmin(): MsgUpdateGroupAdmin { export const MsgUpdateGroupAdmin = { typeUrl: "/cosmos.group.v1.MsgUpdateGroupAdmin", aminoType: "cosmos-sdk/MsgUpdateGroupAdmin", + is(o: any): o is MsgUpdateGroupAdmin { + return o && (o.$typeUrl === MsgUpdateGroupAdmin.typeUrl || typeof o.admin === "string" && typeof o.groupId === "bigint" && typeof o.newAdmin === "string"); + }, + isSDK(o: any): o is MsgUpdateGroupAdminSDKType { + return o && (o.$typeUrl === MsgUpdateGroupAdmin.typeUrl || typeof o.admin === "string" && typeof o.group_id === "bigint" && typeof o.new_admin === "string"); + }, + isAmino(o: any): o is MsgUpdateGroupAdminAmino { + return o && (o.$typeUrl === MsgUpdateGroupAdmin.typeUrl || typeof o.admin === "string" && typeof o.group_id === "bigint" && typeof o.new_admin === "string"); + }, encode(message: MsgUpdateGroupAdmin, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.admin !== "") { writer.uint32(10).string(message.admin); @@ -1795,7 +1855,8 @@ export const MsgUpdateGroupAdmin = { typeUrl: "/cosmos.group.v1.MsgUpdateGroupAdmin", value: MsgUpdateGroupAdmin.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgUpdateGroupAdminResponse(): MsgUpdateGroupAdminResponse { return {}; @@ -1809,6 +1870,15 @@ function createBaseMsgUpdateGroupAdminResponse(): MsgUpdateGroupAdminResponse { export const MsgUpdateGroupAdminResponse = { typeUrl: "/cosmos.group.v1.MsgUpdateGroupAdminResponse", aminoType: "cosmos-sdk/MsgUpdateGroupAdminResponse", + is(o: any): o is MsgUpdateGroupAdminResponse { + return o && o.$typeUrl === MsgUpdateGroupAdminResponse.typeUrl; + }, + isSDK(o: any): o is MsgUpdateGroupAdminResponseSDKType { + return o && o.$typeUrl === MsgUpdateGroupAdminResponse.typeUrl; + }, + isAmino(o: any): o is MsgUpdateGroupAdminResponseAmino { + return o && o.$typeUrl === MsgUpdateGroupAdminResponse.typeUrl; + }, encode(_: MsgUpdateGroupAdminResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -1860,7 +1930,8 @@ export const MsgUpdateGroupAdminResponse = { typeUrl: "/cosmos.group.v1.MsgUpdateGroupAdminResponse", value: MsgUpdateGroupAdminResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgUpdateGroupMetadata(): MsgUpdateGroupMetadata { return { @@ -1878,6 +1949,15 @@ function createBaseMsgUpdateGroupMetadata(): MsgUpdateGroupMetadata { export const MsgUpdateGroupMetadata = { typeUrl: "/cosmos.group.v1.MsgUpdateGroupMetadata", aminoType: "cosmos-sdk/MsgUpdateGroupMetadata", + is(o: any): o is MsgUpdateGroupMetadata { + return o && (o.$typeUrl === MsgUpdateGroupMetadata.typeUrl || typeof o.admin === "string" && typeof o.groupId === "bigint" && typeof o.metadata === "string"); + }, + isSDK(o: any): o is MsgUpdateGroupMetadataSDKType { + return o && (o.$typeUrl === MsgUpdateGroupMetadata.typeUrl || typeof o.admin === "string" && typeof o.group_id === "bigint" && typeof o.metadata === "string"); + }, + isAmino(o: any): o is MsgUpdateGroupMetadataAmino { + return o && (o.$typeUrl === MsgUpdateGroupMetadata.typeUrl || typeof o.admin === "string" && typeof o.group_id === "bigint" && typeof o.metadata === "string"); + }, encode(message: MsgUpdateGroupMetadata, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.admin !== "") { writer.uint32(10).string(message.admin); @@ -1974,7 +2054,8 @@ export const MsgUpdateGroupMetadata = { typeUrl: "/cosmos.group.v1.MsgUpdateGroupMetadata", value: MsgUpdateGroupMetadata.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgUpdateGroupMetadataResponse(): MsgUpdateGroupMetadataResponse { return {}; @@ -1988,6 +2069,15 @@ function createBaseMsgUpdateGroupMetadataResponse(): MsgUpdateGroupMetadataRespo export const MsgUpdateGroupMetadataResponse = { typeUrl: "/cosmos.group.v1.MsgUpdateGroupMetadataResponse", aminoType: "cosmos-sdk/MsgUpdateGroupMetadataResponse", + is(o: any): o is MsgUpdateGroupMetadataResponse { + return o && o.$typeUrl === MsgUpdateGroupMetadataResponse.typeUrl; + }, + isSDK(o: any): o is MsgUpdateGroupMetadataResponseSDKType { + return o && o.$typeUrl === MsgUpdateGroupMetadataResponse.typeUrl; + }, + isAmino(o: any): o is MsgUpdateGroupMetadataResponseAmino { + return o && o.$typeUrl === MsgUpdateGroupMetadataResponse.typeUrl; + }, encode(_: MsgUpdateGroupMetadataResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -2039,7 +2129,8 @@ export const MsgUpdateGroupMetadataResponse = { typeUrl: "/cosmos.group.v1.MsgUpdateGroupMetadataResponse", value: MsgUpdateGroupMetadataResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgCreateGroupPolicy(): MsgCreateGroupPolicy { return { @@ -2058,6 +2149,15 @@ function createBaseMsgCreateGroupPolicy(): MsgCreateGroupPolicy { export const MsgCreateGroupPolicy = { typeUrl: "/cosmos.group.v1.MsgCreateGroupPolicy", aminoType: "cosmos-sdk/MsgCreateGroupPolicy", + is(o: any): o is MsgCreateGroupPolicy { + return o && (o.$typeUrl === MsgCreateGroupPolicy.typeUrl || typeof o.admin === "string" && typeof o.groupId === "bigint" && typeof o.metadata === "string"); + }, + isSDK(o: any): o is MsgCreateGroupPolicySDKType { + return o && (o.$typeUrl === MsgCreateGroupPolicy.typeUrl || typeof o.admin === "string" && typeof o.group_id === "bigint" && typeof o.metadata === "string"); + }, + isAmino(o: any): o is MsgCreateGroupPolicyAmino { + return o && (o.$typeUrl === MsgCreateGroupPolicy.typeUrl || typeof o.admin === "string" && typeof o.group_id === "bigint" && typeof o.metadata === "string"); + }, encode(message: MsgCreateGroupPolicy, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.admin !== "") { writer.uint32(10).string(message.admin); @@ -2069,7 +2169,7 @@ export const MsgCreateGroupPolicy = { writer.uint32(26).string(message.metadata); } if (message.decisionPolicy !== undefined) { - Any.encode((message.decisionPolicy as Any), writer.uint32(34).fork()).ldelim(); + Any.encode(GlobalDecoderRegistry.wrapAny(message.decisionPolicy), writer.uint32(34).fork()).ldelim(); } return writer; }, @@ -2090,7 +2190,7 @@ export const MsgCreateGroupPolicy = { message.metadata = reader.string(); break; case 4: - message.decisionPolicy = useInterfaces ? (DecisionPolicy_InterfaceDecoder(reader) as Any) : Any.decode(reader, reader.uint32(), useInterfaces); + message.decisionPolicy = GlobalDecoderRegistry.unwrapAny(reader); break; default: reader.skipType(tag & 7); @@ -2104,7 +2204,7 @@ export const MsgCreateGroupPolicy = { if (isSet(object.admin)) obj.admin = String(object.admin); if (isSet(object.groupId)) obj.groupId = BigInt(object.groupId.toString()); if (isSet(object.metadata)) obj.metadata = String(object.metadata); - if (isSet(object.decisionPolicy)) obj.decisionPolicy = Any.fromJSON(object.decisionPolicy); + if (isSet(object.decisionPolicy)) obj.decisionPolicy = GlobalDecoderRegistry.fromJSON(object.decisionPolicy); return obj; }, fromPartial(object: DeepPartial): MsgCreateGroupPolicy { @@ -2115,7 +2215,7 @@ export const MsgCreateGroupPolicy = { } message.metadata = object.metadata ?? ""; if (object.decisionPolicy !== undefined && object.decisionPolicy !== null) { - message.decisionPolicy = Any.fromPartial(object.decisionPolicy); + message.decisionPolicy = GlobalDecoderRegistry.fromPartial(object.decisionPolicy); } return message; }, @@ -2124,7 +2224,7 @@ export const MsgCreateGroupPolicy = { admin: object?.admin, groupId: object?.group_id, metadata: object?.metadata, - decisionPolicy: object.decision_policy ? Any.fromSDK(object.decision_policy) : undefined + decisionPolicy: object.decision_policy ? GlobalDecoderRegistry.fromSDK(object.decision_policy) : undefined }; }, toSDK(message: MsgCreateGroupPolicy): MsgCreateGroupPolicySDKType { @@ -2132,7 +2232,7 @@ export const MsgCreateGroupPolicy = { obj.admin = message.admin; obj.group_id = message.groupId; obj.metadata = message.metadata; - message.decisionPolicy !== undefined && (obj.decision_policy = message.decisionPolicy ? Any.toSDK(message.decisionPolicy) : undefined); + message.decisionPolicy !== undefined && (obj.decision_policy = message.decisionPolicy ? GlobalDecoderRegistry.toSDK(message.decisionPolicy) : undefined); return obj; }, fromAmino(object: MsgCreateGroupPolicyAmino): MsgCreateGroupPolicy { @@ -2147,7 +2247,7 @@ export const MsgCreateGroupPolicy = { message.metadata = object.metadata; } if (object.decision_policy !== undefined && object.decision_policy !== null) { - message.decisionPolicy = DecisionPolicy_FromAmino(object.decision_policy); + message.decisionPolicy = GlobalDecoderRegistry.fromAminoMsg(object.decision_policy); } return message; }, @@ -2156,7 +2256,7 @@ export const MsgCreateGroupPolicy = { obj.admin = message.admin === "" ? undefined : message.admin; obj.group_id = message.groupId !== BigInt(0) ? message.groupId?.toString() : undefined; obj.metadata = message.metadata === "" ? undefined : message.metadata; - obj.decision_policy = message.decisionPolicy ? DecisionPolicy_ToAmino((message.decisionPolicy as Any), useInterfaces) : undefined; + obj.decision_policy = message.decisionPolicy ? GlobalDecoderRegistry.toAminoMsg(message.decisionPolicy) : undefined; return obj; }, fromProtoMsg(message: MsgCreateGroupPolicyProtoMsg, useInterfaces: boolean = true): MsgCreateGroupPolicy { @@ -2170,6 +2270,13 @@ export const MsgCreateGroupPolicy = { typeUrl: "/cosmos.group.v1.MsgCreateGroupPolicy", value: MsgCreateGroupPolicy.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgCreateGroupPolicy.typeUrl)) { + return; + } + ThresholdDecisionPolicy.registerTypeUrl(); + PercentageDecisionPolicy.registerTypeUrl(); } }; function createBaseMsgCreateGroupPolicyResponse(): MsgCreateGroupPolicyResponse { @@ -2186,6 +2293,15 @@ function createBaseMsgCreateGroupPolicyResponse(): MsgCreateGroupPolicyResponse export const MsgCreateGroupPolicyResponse = { typeUrl: "/cosmos.group.v1.MsgCreateGroupPolicyResponse", aminoType: "cosmos-sdk/MsgCreateGroupPolicyResponse", + is(o: any): o is MsgCreateGroupPolicyResponse { + return o && (o.$typeUrl === MsgCreateGroupPolicyResponse.typeUrl || typeof o.address === "string"); + }, + isSDK(o: any): o is MsgCreateGroupPolicyResponseSDKType { + return o && (o.$typeUrl === MsgCreateGroupPolicyResponse.typeUrl || typeof o.address === "string"); + }, + isAmino(o: any): o is MsgCreateGroupPolicyResponseAmino { + return o && (o.$typeUrl === MsgCreateGroupPolicyResponse.typeUrl || typeof o.address === "string"); + }, encode(message: MsgCreateGroupPolicyResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.address !== "") { writer.uint32(10).string(message.address); @@ -2252,7 +2368,8 @@ export const MsgCreateGroupPolicyResponse = { typeUrl: "/cosmos.group.v1.MsgCreateGroupPolicyResponse", value: MsgCreateGroupPolicyResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgUpdateGroupPolicyAdmin(): MsgUpdateGroupPolicyAdmin { return { @@ -2270,6 +2387,15 @@ function createBaseMsgUpdateGroupPolicyAdmin(): MsgUpdateGroupPolicyAdmin { export const MsgUpdateGroupPolicyAdmin = { typeUrl: "/cosmos.group.v1.MsgUpdateGroupPolicyAdmin", aminoType: "cosmos-sdk/MsgUpdateGroupPolicyAdmin", + is(o: any): o is MsgUpdateGroupPolicyAdmin { + return o && (o.$typeUrl === MsgUpdateGroupPolicyAdmin.typeUrl || typeof o.admin === "string" && typeof o.address === "string" && typeof o.newAdmin === "string"); + }, + isSDK(o: any): o is MsgUpdateGroupPolicyAdminSDKType { + return o && (o.$typeUrl === MsgUpdateGroupPolicyAdmin.typeUrl || typeof o.admin === "string" && typeof o.address === "string" && typeof o.new_admin === "string"); + }, + isAmino(o: any): o is MsgUpdateGroupPolicyAdminAmino { + return o && (o.$typeUrl === MsgUpdateGroupPolicyAdmin.typeUrl || typeof o.admin === "string" && typeof o.address === "string" && typeof o.new_admin === "string"); + }, encode(message: MsgUpdateGroupPolicyAdmin, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.admin !== "") { writer.uint32(10).string(message.admin); @@ -2364,7 +2490,8 @@ export const MsgUpdateGroupPolicyAdmin = { typeUrl: "/cosmos.group.v1.MsgUpdateGroupPolicyAdmin", value: MsgUpdateGroupPolicyAdmin.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgCreateGroupWithPolicy(): MsgCreateGroupWithPolicy { return { @@ -2385,6 +2512,15 @@ function createBaseMsgCreateGroupWithPolicy(): MsgCreateGroupWithPolicy { export const MsgCreateGroupWithPolicy = { typeUrl: "/cosmos.group.v1.MsgCreateGroupWithPolicy", aminoType: "cosmos-sdk/MsgCreateGroupWithPolicy", + is(o: any): o is MsgCreateGroupWithPolicy { + return o && (o.$typeUrl === MsgCreateGroupWithPolicy.typeUrl || typeof o.admin === "string" && Array.isArray(o.members) && (!o.members.length || Member.is(o.members[0])) && typeof o.groupMetadata === "string" && typeof o.groupPolicyMetadata === "string" && typeof o.groupPolicyAsAdmin === "boolean"); + }, + isSDK(o: any): o is MsgCreateGroupWithPolicySDKType { + return o && (o.$typeUrl === MsgCreateGroupWithPolicy.typeUrl || typeof o.admin === "string" && Array.isArray(o.members) && (!o.members.length || Member.isSDK(o.members[0])) && typeof o.group_metadata === "string" && typeof o.group_policy_metadata === "string" && typeof o.group_policy_as_admin === "boolean"); + }, + isAmino(o: any): o is MsgCreateGroupWithPolicyAmino { + return o && (o.$typeUrl === MsgCreateGroupWithPolicy.typeUrl || typeof o.admin === "string" && Array.isArray(o.members) && (!o.members.length || Member.isAmino(o.members[0])) && typeof o.group_metadata === "string" && typeof o.group_policy_metadata === "string" && typeof o.group_policy_as_admin === "boolean"); + }, encode(message: MsgCreateGroupWithPolicy, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.admin !== "") { writer.uint32(10).string(message.admin); @@ -2402,7 +2538,7 @@ export const MsgCreateGroupWithPolicy = { writer.uint32(40).bool(message.groupPolicyAsAdmin); } if (message.decisionPolicy !== undefined) { - Any.encode((message.decisionPolicy as Any), writer.uint32(50).fork()).ldelim(); + Any.encode(GlobalDecoderRegistry.wrapAny(message.decisionPolicy), writer.uint32(50).fork()).ldelim(); } return writer; }, @@ -2429,7 +2565,7 @@ export const MsgCreateGroupWithPolicy = { message.groupPolicyAsAdmin = reader.bool(); break; case 6: - message.decisionPolicy = useInterfaces ? (DecisionPolicy_InterfaceDecoder(reader) as Any) : Any.decode(reader, reader.uint32(), useInterfaces); + message.decisionPolicy = GlobalDecoderRegistry.unwrapAny(reader); break; default: reader.skipType(tag & 7); @@ -2445,7 +2581,7 @@ export const MsgCreateGroupWithPolicy = { if (isSet(object.groupMetadata)) obj.groupMetadata = String(object.groupMetadata); if (isSet(object.groupPolicyMetadata)) obj.groupPolicyMetadata = String(object.groupPolicyMetadata); if (isSet(object.groupPolicyAsAdmin)) obj.groupPolicyAsAdmin = Boolean(object.groupPolicyAsAdmin); - if (isSet(object.decisionPolicy)) obj.decisionPolicy = Any.fromJSON(object.decisionPolicy); + if (isSet(object.decisionPolicy)) obj.decisionPolicy = GlobalDecoderRegistry.fromJSON(object.decisionPolicy); return obj; }, fromPartial(object: DeepPartial): MsgCreateGroupWithPolicy { @@ -2456,7 +2592,7 @@ export const MsgCreateGroupWithPolicy = { message.groupPolicyMetadata = object.groupPolicyMetadata ?? ""; message.groupPolicyAsAdmin = object.groupPolicyAsAdmin ?? false; if (object.decisionPolicy !== undefined && object.decisionPolicy !== null) { - message.decisionPolicy = Any.fromPartial(object.decisionPolicy); + message.decisionPolicy = GlobalDecoderRegistry.fromPartial(object.decisionPolicy); } return message; }, @@ -2467,7 +2603,7 @@ export const MsgCreateGroupWithPolicy = { groupMetadata: object?.group_metadata, groupPolicyMetadata: object?.group_policy_metadata, groupPolicyAsAdmin: object?.group_policy_as_admin, - decisionPolicy: object.decision_policy ? Any.fromSDK(object.decision_policy) : undefined + decisionPolicy: object.decision_policy ? GlobalDecoderRegistry.fromSDK(object.decision_policy) : undefined }; }, toSDK(message: MsgCreateGroupWithPolicy): MsgCreateGroupWithPolicySDKType { @@ -2481,7 +2617,7 @@ export const MsgCreateGroupWithPolicy = { obj.group_metadata = message.groupMetadata; obj.group_policy_metadata = message.groupPolicyMetadata; obj.group_policy_as_admin = message.groupPolicyAsAdmin; - message.decisionPolicy !== undefined && (obj.decision_policy = message.decisionPolicy ? Any.toSDK(message.decisionPolicy) : undefined); + message.decisionPolicy !== undefined && (obj.decision_policy = message.decisionPolicy ? GlobalDecoderRegistry.toSDK(message.decisionPolicy) : undefined); return obj; }, fromAmino(object: MsgCreateGroupWithPolicyAmino): MsgCreateGroupWithPolicy { @@ -2500,7 +2636,7 @@ export const MsgCreateGroupWithPolicy = { message.groupPolicyAsAdmin = object.group_policy_as_admin; } if (object.decision_policy !== undefined && object.decision_policy !== null) { - message.decisionPolicy = DecisionPolicy_FromAmino(object.decision_policy); + message.decisionPolicy = GlobalDecoderRegistry.fromAminoMsg(object.decision_policy); } return message; }, @@ -2515,7 +2651,7 @@ export const MsgCreateGroupWithPolicy = { obj.group_metadata = message.groupMetadata === "" ? undefined : message.groupMetadata; obj.group_policy_metadata = message.groupPolicyMetadata === "" ? undefined : message.groupPolicyMetadata; obj.group_policy_as_admin = message.groupPolicyAsAdmin === false ? undefined : message.groupPolicyAsAdmin; - obj.decision_policy = message.decisionPolicy ? DecisionPolicy_ToAmino((message.decisionPolicy as Any), useInterfaces) : undefined; + obj.decision_policy = message.decisionPolicy ? GlobalDecoderRegistry.toAminoMsg(message.decisionPolicy) : undefined; return obj; }, fromProtoMsg(message: MsgCreateGroupWithPolicyProtoMsg, useInterfaces: boolean = true): MsgCreateGroupWithPolicy { @@ -2529,6 +2665,13 @@ export const MsgCreateGroupWithPolicy = { typeUrl: "/cosmos.group.v1.MsgCreateGroupWithPolicy", value: MsgCreateGroupWithPolicy.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgCreateGroupWithPolicy.typeUrl)) { + return; + } + ThresholdDecisionPolicy.registerTypeUrl(); + PercentageDecisionPolicy.registerTypeUrl(); } }; function createBaseMsgCreateGroupWithPolicyResponse(): MsgCreateGroupWithPolicyResponse { @@ -2546,6 +2689,15 @@ function createBaseMsgCreateGroupWithPolicyResponse(): MsgCreateGroupWithPolicyR export const MsgCreateGroupWithPolicyResponse = { typeUrl: "/cosmos.group.v1.MsgCreateGroupWithPolicyResponse", aminoType: "cosmos-sdk/MsgCreateGroupWithPolicyResponse", + is(o: any): o is MsgCreateGroupWithPolicyResponse { + return o && (o.$typeUrl === MsgCreateGroupWithPolicyResponse.typeUrl || typeof o.groupId === "bigint" && typeof o.groupPolicyAddress === "string"); + }, + isSDK(o: any): o is MsgCreateGroupWithPolicyResponseSDKType { + return o && (o.$typeUrl === MsgCreateGroupWithPolicyResponse.typeUrl || typeof o.group_id === "bigint" && typeof o.group_policy_address === "string"); + }, + isAmino(o: any): o is MsgCreateGroupWithPolicyResponseAmino { + return o && (o.$typeUrl === MsgCreateGroupWithPolicyResponse.typeUrl || typeof o.group_id === "bigint" && typeof o.group_policy_address === "string"); + }, encode(message: MsgCreateGroupWithPolicyResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.groupId !== BigInt(0)) { writer.uint32(8).uint64(message.groupId); @@ -2628,7 +2780,8 @@ export const MsgCreateGroupWithPolicyResponse = { typeUrl: "/cosmos.group.v1.MsgCreateGroupWithPolicyResponse", value: MsgCreateGroupWithPolicyResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgUpdateGroupPolicyAdminResponse(): MsgUpdateGroupPolicyAdminResponse { return {}; @@ -2642,6 +2795,15 @@ function createBaseMsgUpdateGroupPolicyAdminResponse(): MsgUpdateGroupPolicyAdmi export const MsgUpdateGroupPolicyAdminResponse = { typeUrl: "/cosmos.group.v1.MsgUpdateGroupPolicyAdminResponse", aminoType: "cosmos-sdk/MsgUpdateGroupPolicyAdminResponse", + is(o: any): o is MsgUpdateGroupPolicyAdminResponse { + return o && o.$typeUrl === MsgUpdateGroupPolicyAdminResponse.typeUrl; + }, + isSDK(o: any): o is MsgUpdateGroupPolicyAdminResponseSDKType { + return o && o.$typeUrl === MsgUpdateGroupPolicyAdminResponse.typeUrl; + }, + isAmino(o: any): o is MsgUpdateGroupPolicyAdminResponseAmino { + return o && o.$typeUrl === MsgUpdateGroupPolicyAdminResponse.typeUrl; + }, encode(_: MsgUpdateGroupPolicyAdminResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -2693,7 +2855,8 @@ export const MsgUpdateGroupPolicyAdminResponse = { typeUrl: "/cosmos.group.v1.MsgUpdateGroupPolicyAdminResponse", value: MsgUpdateGroupPolicyAdminResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgUpdateGroupPolicyDecisionPolicy(): MsgUpdateGroupPolicyDecisionPolicy { return { @@ -2711,6 +2874,15 @@ function createBaseMsgUpdateGroupPolicyDecisionPolicy(): MsgUpdateGroupPolicyDec export const MsgUpdateGroupPolicyDecisionPolicy = { typeUrl: "/cosmos.group.v1.MsgUpdateGroupPolicyDecisionPolicy", aminoType: "cosmos-sdk/MsgUpdateGroupPolicyDecisionPolicy", + is(o: any): o is MsgUpdateGroupPolicyDecisionPolicy { + return o && (o.$typeUrl === MsgUpdateGroupPolicyDecisionPolicy.typeUrl || typeof o.admin === "string" && typeof o.address === "string"); + }, + isSDK(o: any): o is MsgUpdateGroupPolicyDecisionPolicySDKType { + return o && (o.$typeUrl === MsgUpdateGroupPolicyDecisionPolicy.typeUrl || typeof o.admin === "string" && typeof o.address === "string"); + }, + isAmino(o: any): o is MsgUpdateGroupPolicyDecisionPolicyAmino { + return o && (o.$typeUrl === MsgUpdateGroupPolicyDecisionPolicy.typeUrl || typeof o.admin === "string" && typeof o.address === "string"); + }, encode(message: MsgUpdateGroupPolicyDecisionPolicy, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.admin !== "") { writer.uint32(10).string(message.admin); @@ -2719,7 +2891,7 @@ export const MsgUpdateGroupPolicyDecisionPolicy = { writer.uint32(18).string(message.address); } if (message.decisionPolicy !== undefined) { - Any.encode((message.decisionPolicy as Any), writer.uint32(26).fork()).ldelim(); + Any.encode(GlobalDecoderRegistry.wrapAny(message.decisionPolicy), writer.uint32(26).fork()).ldelim(); } return writer; }, @@ -2737,7 +2909,7 @@ export const MsgUpdateGroupPolicyDecisionPolicy = { message.address = reader.string(); break; case 3: - message.decisionPolicy = useInterfaces ? (DecisionPolicy_InterfaceDecoder(reader) as Any) : Any.decode(reader, reader.uint32(), useInterfaces); + message.decisionPolicy = GlobalDecoderRegistry.unwrapAny(reader); break; default: reader.skipType(tag & 7); @@ -2750,7 +2922,7 @@ export const MsgUpdateGroupPolicyDecisionPolicy = { const obj = createBaseMsgUpdateGroupPolicyDecisionPolicy(); if (isSet(object.admin)) obj.admin = String(object.admin); if (isSet(object.address)) obj.address = String(object.address); - if (isSet(object.decisionPolicy)) obj.decisionPolicy = Any.fromJSON(object.decisionPolicy); + if (isSet(object.decisionPolicy)) obj.decisionPolicy = GlobalDecoderRegistry.fromJSON(object.decisionPolicy); return obj; }, fromPartial(object: DeepPartial): MsgUpdateGroupPolicyDecisionPolicy { @@ -2758,7 +2930,7 @@ export const MsgUpdateGroupPolicyDecisionPolicy = { message.admin = object.admin ?? ""; message.address = object.address ?? ""; if (object.decisionPolicy !== undefined && object.decisionPolicy !== null) { - message.decisionPolicy = Any.fromPartial(object.decisionPolicy); + message.decisionPolicy = GlobalDecoderRegistry.fromPartial(object.decisionPolicy); } return message; }, @@ -2766,14 +2938,14 @@ export const MsgUpdateGroupPolicyDecisionPolicy = { return { admin: object?.admin, address: object?.address, - decisionPolicy: object.decision_policy ? Any.fromSDK(object.decision_policy) : undefined + decisionPolicy: object.decision_policy ? GlobalDecoderRegistry.fromSDK(object.decision_policy) : undefined }; }, toSDK(message: MsgUpdateGroupPolicyDecisionPolicy): MsgUpdateGroupPolicyDecisionPolicySDKType { const obj: any = {}; obj.admin = message.admin; obj.address = message.address; - message.decisionPolicy !== undefined && (obj.decision_policy = message.decisionPolicy ? Any.toSDK(message.decisionPolicy) : undefined); + message.decisionPolicy !== undefined && (obj.decision_policy = message.decisionPolicy ? GlobalDecoderRegistry.toSDK(message.decisionPolicy) : undefined); return obj; }, fromAmino(object: MsgUpdateGroupPolicyDecisionPolicyAmino): MsgUpdateGroupPolicyDecisionPolicy { @@ -2785,7 +2957,7 @@ export const MsgUpdateGroupPolicyDecisionPolicy = { message.address = object.address; } if (object.decision_policy !== undefined && object.decision_policy !== null) { - message.decisionPolicy = DecisionPolicy_FromAmino(object.decision_policy); + message.decisionPolicy = GlobalDecoderRegistry.fromAminoMsg(object.decision_policy); } return message; }, @@ -2793,7 +2965,7 @@ export const MsgUpdateGroupPolicyDecisionPolicy = { const obj: any = {}; obj.admin = message.admin === "" ? undefined : message.admin; obj.address = message.address === "" ? undefined : message.address; - obj.decision_policy = message.decisionPolicy ? DecisionPolicy_ToAmino((message.decisionPolicy as Any), useInterfaces) : undefined; + obj.decision_policy = message.decisionPolicy ? GlobalDecoderRegistry.toAminoMsg(message.decisionPolicy) : undefined; return obj; }, fromProtoMsg(message: MsgUpdateGroupPolicyDecisionPolicyProtoMsg, useInterfaces: boolean = true): MsgUpdateGroupPolicyDecisionPolicy { @@ -2807,6 +2979,13 @@ export const MsgUpdateGroupPolicyDecisionPolicy = { typeUrl: "/cosmos.group.v1.MsgUpdateGroupPolicyDecisionPolicy", value: MsgUpdateGroupPolicyDecisionPolicy.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgUpdateGroupPolicyDecisionPolicy.typeUrl)) { + return; + } + ThresholdDecisionPolicy.registerTypeUrl(); + PercentageDecisionPolicy.registerTypeUrl(); } }; function createBaseMsgUpdateGroupPolicyDecisionPolicyResponse(): MsgUpdateGroupPolicyDecisionPolicyResponse { @@ -2821,6 +3000,15 @@ function createBaseMsgUpdateGroupPolicyDecisionPolicyResponse(): MsgUpdateGroupP export const MsgUpdateGroupPolicyDecisionPolicyResponse = { typeUrl: "/cosmos.group.v1.MsgUpdateGroupPolicyDecisionPolicyResponse", aminoType: "cosmos-sdk/MsgUpdateGroupPolicyDecisionPolicyResponse", + is(o: any): o is MsgUpdateGroupPolicyDecisionPolicyResponse { + return o && o.$typeUrl === MsgUpdateGroupPolicyDecisionPolicyResponse.typeUrl; + }, + isSDK(o: any): o is MsgUpdateGroupPolicyDecisionPolicyResponseSDKType { + return o && o.$typeUrl === MsgUpdateGroupPolicyDecisionPolicyResponse.typeUrl; + }, + isAmino(o: any): o is MsgUpdateGroupPolicyDecisionPolicyResponseAmino { + return o && o.$typeUrl === MsgUpdateGroupPolicyDecisionPolicyResponse.typeUrl; + }, encode(_: MsgUpdateGroupPolicyDecisionPolicyResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -2872,7 +3060,8 @@ export const MsgUpdateGroupPolicyDecisionPolicyResponse = { typeUrl: "/cosmos.group.v1.MsgUpdateGroupPolicyDecisionPolicyResponse", value: MsgUpdateGroupPolicyDecisionPolicyResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgUpdateGroupPolicyMetadata(): MsgUpdateGroupPolicyMetadata { return { @@ -2890,6 +3079,15 @@ function createBaseMsgUpdateGroupPolicyMetadata(): MsgUpdateGroupPolicyMetadata export const MsgUpdateGroupPolicyMetadata = { typeUrl: "/cosmos.group.v1.MsgUpdateGroupPolicyMetadata", aminoType: "cosmos-sdk/MsgUpdateGroupPolicyMetadata", + is(o: any): o is MsgUpdateGroupPolicyMetadata { + return o && (o.$typeUrl === MsgUpdateGroupPolicyMetadata.typeUrl || typeof o.admin === "string" && typeof o.address === "string" && typeof o.metadata === "string"); + }, + isSDK(o: any): o is MsgUpdateGroupPolicyMetadataSDKType { + return o && (o.$typeUrl === MsgUpdateGroupPolicyMetadata.typeUrl || typeof o.admin === "string" && typeof o.address === "string" && typeof o.metadata === "string"); + }, + isAmino(o: any): o is MsgUpdateGroupPolicyMetadataAmino { + return o && (o.$typeUrl === MsgUpdateGroupPolicyMetadata.typeUrl || typeof o.admin === "string" && typeof o.address === "string" && typeof o.metadata === "string"); + }, encode(message: MsgUpdateGroupPolicyMetadata, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.admin !== "") { writer.uint32(10).string(message.admin); @@ -2984,7 +3182,8 @@ export const MsgUpdateGroupPolicyMetadata = { typeUrl: "/cosmos.group.v1.MsgUpdateGroupPolicyMetadata", value: MsgUpdateGroupPolicyMetadata.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgUpdateGroupPolicyMetadataResponse(): MsgUpdateGroupPolicyMetadataResponse { return {}; @@ -2998,6 +3197,15 @@ function createBaseMsgUpdateGroupPolicyMetadataResponse(): MsgUpdateGroupPolicyM export const MsgUpdateGroupPolicyMetadataResponse = { typeUrl: "/cosmos.group.v1.MsgUpdateGroupPolicyMetadataResponse", aminoType: "cosmos-sdk/MsgUpdateGroupPolicyMetadataResponse", + is(o: any): o is MsgUpdateGroupPolicyMetadataResponse { + return o && o.$typeUrl === MsgUpdateGroupPolicyMetadataResponse.typeUrl; + }, + isSDK(o: any): o is MsgUpdateGroupPolicyMetadataResponseSDKType { + return o && o.$typeUrl === MsgUpdateGroupPolicyMetadataResponse.typeUrl; + }, + isAmino(o: any): o is MsgUpdateGroupPolicyMetadataResponseAmino { + return o && o.$typeUrl === MsgUpdateGroupPolicyMetadataResponse.typeUrl; + }, encode(_: MsgUpdateGroupPolicyMetadataResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -3049,7 +3257,8 @@ export const MsgUpdateGroupPolicyMetadataResponse = { typeUrl: "/cosmos.group.v1.MsgUpdateGroupPolicyMetadataResponse", value: MsgUpdateGroupPolicyMetadataResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgSubmitProposal(): MsgSubmitProposal { return { @@ -3069,6 +3278,15 @@ function createBaseMsgSubmitProposal(): MsgSubmitProposal { export const MsgSubmitProposal = { typeUrl: "/cosmos.group.v1.MsgSubmitProposal", aminoType: "cosmos-sdk/group/MsgSubmitProposal", + is(o: any): o is MsgSubmitProposal { + return o && (o.$typeUrl === MsgSubmitProposal.typeUrl || typeof o.address === "string" && Array.isArray(o.proposers) && (!o.proposers.length || typeof o.proposers[0] === "string") && typeof o.metadata === "string" && Array.isArray(o.messages) && (!o.messages.length || Any.is(o.messages[0])) && isSet(o.exec)); + }, + isSDK(o: any): o is MsgSubmitProposalSDKType { + return o && (o.$typeUrl === MsgSubmitProposal.typeUrl || typeof o.address === "string" && Array.isArray(o.proposers) && (!o.proposers.length || typeof o.proposers[0] === "string") && typeof o.metadata === "string" && Array.isArray(o.messages) && (!o.messages.length || Any.isSDK(o.messages[0])) && isSet(o.exec)); + }, + isAmino(o: any): o is MsgSubmitProposalAmino { + return o && (o.$typeUrl === MsgSubmitProposal.typeUrl || typeof o.address === "string" && Array.isArray(o.proposers) && (!o.proposers.length || typeof o.proposers[0] === "string") && typeof o.metadata === "string" && Array.isArray(o.messages) && (!o.messages.length || Any.isAmino(o.messages[0])) && isSet(o.exec)); + }, encode(message: MsgSubmitProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.address !== "") { writer.uint32(10).string(message.address); @@ -3203,7 +3421,8 @@ export const MsgSubmitProposal = { typeUrl: "/cosmos.group.v1.MsgSubmitProposal", value: MsgSubmitProposal.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgSubmitProposalResponse(): MsgSubmitProposalResponse { return { @@ -3219,6 +3438,15 @@ function createBaseMsgSubmitProposalResponse(): MsgSubmitProposalResponse { export const MsgSubmitProposalResponse = { typeUrl: "/cosmos.group.v1.MsgSubmitProposalResponse", aminoType: "cosmos-sdk/MsgSubmitProposalResponse", + is(o: any): o is MsgSubmitProposalResponse { + return o && (o.$typeUrl === MsgSubmitProposalResponse.typeUrl || typeof o.proposalId === "bigint"); + }, + isSDK(o: any): o is MsgSubmitProposalResponseSDKType { + return o && (o.$typeUrl === MsgSubmitProposalResponse.typeUrl || typeof o.proposal_id === "bigint"); + }, + isAmino(o: any): o is MsgSubmitProposalResponseAmino { + return o && (o.$typeUrl === MsgSubmitProposalResponse.typeUrl || typeof o.proposal_id === "bigint"); + }, encode(message: MsgSubmitProposalResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.proposalId !== BigInt(0)) { writer.uint32(8).uint64(message.proposalId); @@ -3287,7 +3515,8 @@ export const MsgSubmitProposalResponse = { typeUrl: "/cosmos.group.v1.MsgSubmitProposalResponse", value: MsgSubmitProposalResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgWithdrawProposal(): MsgWithdrawProposal { return { @@ -3304,6 +3533,15 @@ function createBaseMsgWithdrawProposal(): MsgWithdrawProposal { export const MsgWithdrawProposal = { typeUrl: "/cosmos.group.v1.MsgWithdrawProposal", aminoType: "cosmos-sdk/group/MsgWithdrawProposal", + is(o: any): o is MsgWithdrawProposal { + return o && (o.$typeUrl === MsgWithdrawProposal.typeUrl || typeof o.proposalId === "bigint" && typeof o.address === "string"); + }, + isSDK(o: any): o is MsgWithdrawProposalSDKType { + return o && (o.$typeUrl === MsgWithdrawProposal.typeUrl || typeof o.proposal_id === "bigint" && typeof o.address === "string"); + }, + isAmino(o: any): o is MsgWithdrawProposalAmino { + return o && (o.$typeUrl === MsgWithdrawProposal.typeUrl || typeof o.proposal_id === "bigint" && typeof o.address === "string"); + }, encode(message: MsgWithdrawProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.proposalId !== BigInt(0)) { writer.uint32(8).uint64(message.proposalId); @@ -3386,7 +3624,8 @@ export const MsgWithdrawProposal = { typeUrl: "/cosmos.group.v1.MsgWithdrawProposal", value: MsgWithdrawProposal.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgWithdrawProposalResponse(): MsgWithdrawProposalResponse { return {}; @@ -3400,6 +3639,15 @@ function createBaseMsgWithdrawProposalResponse(): MsgWithdrawProposalResponse { export const MsgWithdrawProposalResponse = { typeUrl: "/cosmos.group.v1.MsgWithdrawProposalResponse", aminoType: "cosmos-sdk/MsgWithdrawProposalResponse", + is(o: any): o is MsgWithdrawProposalResponse { + return o && o.$typeUrl === MsgWithdrawProposalResponse.typeUrl; + }, + isSDK(o: any): o is MsgWithdrawProposalResponseSDKType { + return o && o.$typeUrl === MsgWithdrawProposalResponse.typeUrl; + }, + isAmino(o: any): o is MsgWithdrawProposalResponseAmino { + return o && o.$typeUrl === MsgWithdrawProposalResponse.typeUrl; + }, encode(_: MsgWithdrawProposalResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -3451,7 +3699,8 @@ export const MsgWithdrawProposalResponse = { typeUrl: "/cosmos.group.v1.MsgWithdrawProposalResponse", value: MsgWithdrawProposalResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgVote(): MsgVote { return { @@ -3471,6 +3720,15 @@ function createBaseMsgVote(): MsgVote { export const MsgVote = { typeUrl: "/cosmos.group.v1.MsgVote", aminoType: "cosmos-sdk/group/MsgVote", + is(o: any): o is MsgVote { + return o && (o.$typeUrl === MsgVote.typeUrl || typeof o.proposalId === "bigint" && typeof o.voter === "string" && isSet(o.option) && typeof o.metadata === "string" && isSet(o.exec)); + }, + isSDK(o: any): o is MsgVoteSDKType { + return o && (o.$typeUrl === MsgVote.typeUrl || typeof o.proposal_id === "bigint" && typeof o.voter === "string" && isSet(o.option) && typeof o.metadata === "string" && isSet(o.exec)); + }, + isAmino(o: any): o is MsgVoteAmino { + return o && (o.$typeUrl === MsgVote.typeUrl || typeof o.proposal_id === "bigint" && typeof o.voter === "string" && isSet(o.option) && typeof o.metadata === "string" && isSet(o.exec)); + }, encode(message: MsgVote, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.proposalId !== BigInt(0)) { writer.uint32(8).uint64(message.proposalId); @@ -3595,7 +3853,8 @@ export const MsgVote = { typeUrl: "/cosmos.group.v1.MsgVote", value: MsgVote.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgVoteResponse(): MsgVoteResponse { return {}; @@ -3609,6 +3868,15 @@ function createBaseMsgVoteResponse(): MsgVoteResponse { export const MsgVoteResponse = { typeUrl: "/cosmos.group.v1.MsgVoteResponse", aminoType: "cosmos-sdk/MsgVoteResponse", + is(o: any): o is MsgVoteResponse { + return o && o.$typeUrl === MsgVoteResponse.typeUrl; + }, + isSDK(o: any): o is MsgVoteResponseSDKType { + return o && o.$typeUrl === MsgVoteResponse.typeUrl; + }, + isAmino(o: any): o is MsgVoteResponseAmino { + return o && o.$typeUrl === MsgVoteResponse.typeUrl; + }, encode(_: MsgVoteResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -3660,7 +3928,8 @@ export const MsgVoteResponse = { typeUrl: "/cosmos.group.v1.MsgVoteResponse", value: MsgVoteResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgExec(): MsgExec { return { @@ -3677,6 +3946,15 @@ function createBaseMsgExec(): MsgExec { export const MsgExec = { typeUrl: "/cosmos.group.v1.MsgExec", aminoType: "cosmos-sdk/group/MsgExec", + is(o: any): o is MsgExec { + return o && (o.$typeUrl === MsgExec.typeUrl || typeof o.proposalId === "bigint" && typeof o.signer === "string"); + }, + isSDK(o: any): o is MsgExecSDKType { + return o && (o.$typeUrl === MsgExec.typeUrl || typeof o.proposal_id === "bigint" && typeof o.signer === "string"); + }, + isAmino(o: any): o is MsgExecAmino { + return o && (o.$typeUrl === MsgExec.typeUrl || typeof o.proposal_id === "bigint" && typeof o.signer === "string"); + }, encode(message: MsgExec, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.proposalId !== BigInt(0)) { writer.uint32(8).uint64(message.proposalId); @@ -3759,7 +4037,8 @@ export const MsgExec = { typeUrl: "/cosmos.group.v1.MsgExec", value: MsgExec.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgExecResponse(): MsgExecResponse { return {}; @@ -3773,6 +4052,15 @@ function createBaseMsgExecResponse(): MsgExecResponse { export const MsgExecResponse = { typeUrl: "/cosmos.group.v1.MsgExecResponse", aminoType: "cosmos-sdk/MsgExecResponse", + is(o: any): o is MsgExecResponse { + return o && o.$typeUrl === MsgExecResponse.typeUrl; + }, + isSDK(o: any): o is MsgExecResponseSDKType { + return o && o.$typeUrl === MsgExecResponse.typeUrl; + }, + isAmino(o: any): o is MsgExecResponseAmino { + return o && o.$typeUrl === MsgExecResponse.typeUrl; + }, encode(_: MsgExecResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -3824,7 +4112,8 @@ export const MsgExecResponse = { typeUrl: "/cosmos.group.v1.MsgExecResponse", value: MsgExecResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgLeaveGroup(): MsgLeaveGroup { return { @@ -3841,6 +4130,15 @@ function createBaseMsgLeaveGroup(): MsgLeaveGroup { export const MsgLeaveGroup = { typeUrl: "/cosmos.group.v1.MsgLeaveGroup", aminoType: "cosmos-sdk/group/MsgLeaveGroup", + is(o: any): o is MsgLeaveGroup { + return o && (o.$typeUrl === MsgLeaveGroup.typeUrl || typeof o.address === "string" && typeof o.groupId === "bigint"); + }, + isSDK(o: any): o is MsgLeaveGroupSDKType { + return o && (o.$typeUrl === MsgLeaveGroup.typeUrl || typeof o.address === "string" && typeof o.group_id === "bigint"); + }, + isAmino(o: any): o is MsgLeaveGroupAmino { + return o && (o.$typeUrl === MsgLeaveGroup.typeUrl || typeof o.address === "string" && typeof o.group_id === "bigint"); + }, encode(message: MsgLeaveGroup, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.address !== "") { writer.uint32(10).string(message.address); @@ -3923,7 +4221,8 @@ export const MsgLeaveGroup = { typeUrl: "/cosmos.group.v1.MsgLeaveGroup", value: MsgLeaveGroup.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgLeaveGroupResponse(): MsgLeaveGroupResponse { return {}; @@ -3937,6 +4236,15 @@ function createBaseMsgLeaveGroupResponse(): MsgLeaveGroupResponse { export const MsgLeaveGroupResponse = { typeUrl: "/cosmos.group.v1.MsgLeaveGroupResponse", aminoType: "cosmos-sdk/MsgLeaveGroupResponse", + is(o: any): o is MsgLeaveGroupResponse { + return o && o.$typeUrl === MsgLeaveGroupResponse.typeUrl; + }, + isSDK(o: any): o is MsgLeaveGroupResponseSDKType { + return o && o.$typeUrl === MsgLeaveGroupResponse.typeUrl; + }, + isAmino(o: any): o is MsgLeaveGroupResponseAmino { + return o && o.$typeUrl === MsgLeaveGroupResponse.typeUrl; + }, encode(_: MsgLeaveGroupResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -3988,49 +4296,6 @@ export const MsgLeaveGroupResponse = { typeUrl: "/cosmos.group.v1.MsgLeaveGroupResponse", value: MsgLeaveGroupResponse.encode(message).finish() }; - } -}; -export const DecisionPolicy_InterfaceDecoder = (input: BinaryReader | Uint8Array): ThresholdDecisionPolicy | PercentageDecisionPolicy | Any => { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - const data = Any.decode(reader, reader.uint32(), true); - switch (data.typeUrl) { - case "/cosmos.group.v1.ThresholdDecisionPolicy": - return ThresholdDecisionPolicy.decode(data.value, undefined, true); - case "/cosmos.group.v1.PercentageDecisionPolicy": - return PercentageDecisionPolicy.decode(data.value, undefined, true); - default: - return data; - } -}; -export const DecisionPolicy_FromAmino = (content: AnyAmino): Any => { - switch (content.type) { - case "cosmos-sdk/ThresholdDecisionPolicy": - return Any.fromPartial({ - typeUrl: "/cosmos.group.v1.ThresholdDecisionPolicy", - value: ThresholdDecisionPolicy.encode(ThresholdDecisionPolicy.fromPartial(ThresholdDecisionPolicy.fromAmino(content.value))).finish() - }); - case "cosmos-sdk/PercentageDecisionPolicy": - return Any.fromPartial({ - typeUrl: "/cosmos.group.v1.PercentageDecisionPolicy", - value: PercentageDecisionPolicy.encode(PercentageDecisionPolicy.fromPartial(PercentageDecisionPolicy.fromAmino(content.value))).finish() - }); - default: - return Any.fromAmino(content); - } -}; -export const DecisionPolicy_ToAmino = (content: Any, useInterfaces: boolean = true) => { - switch (content.typeUrl) { - case "/cosmos.group.v1.ThresholdDecisionPolicy": - return { - type: "cosmos-sdk/ThresholdDecisionPolicy", - value: ThresholdDecisionPolicy.toAmino(ThresholdDecisionPolicy.decode(content.value, undefined, useInterfaces), useInterfaces) - }; - case "/cosmos.group.v1.PercentageDecisionPolicy": - return { - type: "cosmos-sdk/PercentageDecisionPolicy", - value: PercentageDecisionPolicy.toAmino(PercentageDecisionPolicy.decode(content.value, undefined, useInterfaces), useInterfaces) - }; - default: - return Any.toAmino(content, useInterfaces); - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/cosmos/group/v1/types.ts b/__fixtures__/v-next/outputv3/cosmos/group/v1/types.ts index 4bab6ca6de..c8c183d5ec 100644 --- a/__fixtures__/v-next/outputv3/cosmos/group/v1/types.ts +++ b/__fixtures__/v-next/outputv3/cosmos/group/v1/types.ts @@ -3,6 +3,7 @@ import { Duration, DurationAmino, DurationSDKType } from "../../../google/protob import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../google/protobuf/any"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { toTimestamp, fromTimestamp, isSet, DeepPartial } from "../../../helpers"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "cosmos.group.v1"; /** VoteOption enumerates the valid vote options for a given proposal. */ export enum VoteOption { @@ -1047,6 +1048,15 @@ function createBaseMember(): Member { export const Member = { typeUrl: "/cosmos.group.v1.Member", aminoType: "cosmos-sdk/Member", + is(o: any): o is Member { + return o && (o.$typeUrl === Member.typeUrl || typeof o.address === "string" && typeof o.weight === "string" && typeof o.metadata === "string" && Timestamp.is(o.addedAt)); + }, + isSDK(o: any): o is MemberSDKType { + return o && (o.$typeUrl === Member.typeUrl || typeof o.address === "string" && typeof o.weight === "string" && typeof o.metadata === "string" && Timestamp.isSDK(o.added_at)); + }, + isAmino(o: any): o is MemberAmino { + return o && (o.$typeUrl === Member.typeUrl || typeof o.address === "string" && typeof o.weight === "string" && typeof o.metadata === "string" && Timestamp.isAmino(o.added_at)); + }, encode(message: Member, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.address !== "") { writer.uint32(10).string(message.address); @@ -1155,7 +1165,8 @@ export const Member = { typeUrl: "/cosmos.group.v1.Member", value: Member.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMembers(): Members { return { @@ -1171,6 +1182,15 @@ function createBaseMembers(): Members { export const Members = { typeUrl: "/cosmos.group.v1.Members", aminoType: "cosmos-sdk/Members", + is(o: any): o is Members { + return o && (o.$typeUrl === Members.typeUrl || Array.isArray(o.members) && (!o.members.length || Member.is(o.members[0]))); + }, + isSDK(o: any): o is MembersSDKType { + return o && (o.$typeUrl === Members.typeUrl || Array.isArray(o.members) && (!o.members.length || Member.isSDK(o.members[0]))); + }, + isAmino(o: any): o is MembersAmino { + return o && (o.$typeUrl === Members.typeUrl || Array.isArray(o.members) && (!o.members.length || Member.isAmino(o.members[0]))); + }, encode(message: Members, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.members) { Member.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -1243,6 +1263,12 @@ export const Members = { typeUrl: "/cosmos.group.v1.Members", value: Members.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Members.typeUrl)) { + return; + } + Member.registerTypeUrl(); } }; function createBaseThresholdDecisionPolicy(): ThresholdDecisionPolicy { @@ -1261,6 +1287,15 @@ function createBaseThresholdDecisionPolicy(): ThresholdDecisionPolicy { export const ThresholdDecisionPolicy = { typeUrl: "/cosmos.group.v1.ThresholdDecisionPolicy", aminoType: "cosmos-sdk/ThresholdDecisionPolicy", + is(o: any): o is ThresholdDecisionPolicy { + return o && (o.$typeUrl === ThresholdDecisionPolicy.typeUrl || typeof o.threshold === "string"); + }, + isSDK(o: any): o is ThresholdDecisionPolicySDKType { + return o && (o.$typeUrl === ThresholdDecisionPolicy.typeUrl || typeof o.threshold === "string"); + }, + isAmino(o: any): o is ThresholdDecisionPolicyAmino { + return o && (o.$typeUrl === ThresholdDecisionPolicy.typeUrl || typeof o.threshold === "string"); + }, encode(message: ThresholdDecisionPolicy, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.threshold !== "") { writer.uint32(10).string(message.threshold); @@ -1343,6 +1378,14 @@ export const ThresholdDecisionPolicy = { typeUrl: "/cosmos.group.v1.ThresholdDecisionPolicy", value: ThresholdDecisionPolicy.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ThresholdDecisionPolicy.typeUrl)) { + return; + } + GlobalDecoderRegistry.register(ThresholdDecisionPolicy.typeUrl, ThresholdDecisionPolicy); + GlobalDecoderRegistry.registerAminoProtoMapping(ThresholdDecisionPolicy.aminoType, ThresholdDecisionPolicy.typeUrl); + DecisionPolicyWindows.registerTypeUrl(); } }; function createBasePercentageDecisionPolicy(): PercentageDecisionPolicy { @@ -1361,6 +1404,15 @@ function createBasePercentageDecisionPolicy(): PercentageDecisionPolicy { export const PercentageDecisionPolicy = { typeUrl: "/cosmos.group.v1.PercentageDecisionPolicy", aminoType: "cosmos-sdk/PercentageDecisionPolicy", + is(o: any): o is PercentageDecisionPolicy { + return o && (o.$typeUrl === PercentageDecisionPolicy.typeUrl || typeof o.percentage === "string"); + }, + isSDK(o: any): o is PercentageDecisionPolicySDKType { + return o && (o.$typeUrl === PercentageDecisionPolicy.typeUrl || typeof o.percentage === "string"); + }, + isAmino(o: any): o is PercentageDecisionPolicyAmino { + return o && (o.$typeUrl === PercentageDecisionPolicy.typeUrl || typeof o.percentage === "string"); + }, encode(message: PercentageDecisionPolicy, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.percentage !== "") { writer.uint32(10).string(message.percentage); @@ -1443,6 +1495,14 @@ export const PercentageDecisionPolicy = { typeUrl: "/cosmos.group.v1.PercentageDecisionPolicy", value: PercentageDecisionPolicy.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(PercentageDecisionPolicy.typeUrl)) { + return; + } + GlobalDecoderRegistry.register(PercentageDecisionPolicy.typeUrl, PercentageDecisionPolicy); + GlobalDecoderRegistry.registerAminoProtoMapping(PercentageDecisionPolicy.aminoType, PercentageDecisionPolicy.typeUrl); + DecisionPolicyWindows.registerTypeUrl(); } }; function createBaseDecisionPolicyWindows(): DecisionPolicyWindows { @@ -1460,6 +1520,15 @@ function createBaseDecisionPolicyWindows(): DecisionPolicyWindows { export const DecisionPolicyWindows = { typeUrl: "/cosmos.group.v1.DecisionPolicyWindows", aminoType: "cosmos-sdk/DecisionPolicyWindows", + is(o: any): o is DecisionPolicyWindows { + return o && (o.$typeUrl === DecisionPolicyWindows.typeUrl || Duration.is(o.votingPeriod) && Duration.is(o.minExecutionPeriod)); + }, + isSDK(o: any): o is DecisionPolicyWindowsSDKType { + return o && (o.$typeUrl === DecisionPolicyWindows.typeUrl || Duration.isSDK(o.voting_period) && Duration.isSDK(o.min_execution_period)); + }, + isAmino(o: any): o is DecisionPolicyWindowsAmino { + return o && (o.$typeUrl === DecisionPolicyWindows.typeUrl || Duration.isAmino(o.voting_period) && Duration.isAmino(o.min_execution_period)); + }, encode(message: DecisionPolicyWindows, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.votingPeriod !== undefined) { Duration.encode(message.votingPeriod, writer.uint32(10).fork()).ldelim(); @@ -1544,7 +1613,8 @@ export const DecisionPolicyWindows = { typeUrl: "/cosmos.group.v1.DecisionPolicyWindows", value: DecisionPolicyWindows.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseGroupInfo(): GroupInfo { return { @@ -1565,6 +1635,15 @@ function createBaseGroupInfo(): GroupInfo { export const GroupInfo = { typeUrl: "/cosmos.group.v1.GroupInfo", aminoType: "cosmos-sdk/GroupInfo", + is(o: any): o is GroupInfo { + return o && (o.$typeUrl === GroupInfo.typeUrl || typeof o.id === "bigint" && typeof o.admin === "string" && typeof o.metadata === "string" && typeof o.version === "bigint" && typeof o.totalWeight === "string" && Timestamp.is(o.createdAt)); + }, + isSDK(o: any): o is GroupInfoSDKType { + return o && (o.$typeUrl === GroupInfo.typeUrl || typeof o.id === "bigint" && typeof o.admin === "string" && typeof o.metadata === "string" && typeof o.version === "bigint" && typeof o.total_weight === "string" && Timestamp.isSDK(o.created_at)); + }, + isAmino(o: any): o is GroupInfoAmino { + return o && (o.$typeUrl === GroupInfo.typeUrl || typeof o.id === "bigint" && typeof o.admin === "string" && typeof o.metadata === "string" && typeof o.version === "bigint" && typeof o.total_weight === "string" && Timestamp.isAmino(o.created_at)); + }, encode(message: GroupInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.id !== BigInt(0)) { writer.uint32(8).uint64(message.id); @@ -1705,7 +1784,8 @@ export const GroupInfo = { typeUrl: "/cosmos.group.v1.GroupInfo", value: GroupInfo.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseGroupMember(): GroupMember { return { @@ -1722,6 +1802,15 @@ function createBaseGroupMember(): GroupMember { export const GroupMember = { typeUrl: "/cosmos.group.v1.GroupMember", aminoType: "cosmos-sdk/GroupMember", + is(o: any): o is GroupMember { + return o && (o.$typeUrl === GroupMember.typeUrl || typeof o.groupId === "bigint"); + }, + isSDK(o: any): o is GroupMemberSDKType { + return o && (o.$typeUrl === GroupMember.typeUrl || typeof o.group_id === "bigint"); + }, + isAmino(o: any): o is GroupMemberAmino { + return o && (o.$typeUrl === GroupMember.typeUrl || typeof o.group_id === "bigint"); + }, encode(message: GroupMember, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.groupId !== BigInt(0)) { writer.uint32(8).uint64(message.groupId); @@ -1806,6 +1895,12 @@ export const GroupMember = { typeUrl: "/cosmos.group.v1.GroupMember", value: GroupMember.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GroupMember.typeUrl)) { + return; + } + Member.registerTypeUrl(); } }; function createBaseGroupPolicyInfo(): GroupPolicyInfo { @@ -1828,6 +1923,15 @@ function createBaseGroupPolicyInfo(): GroupPolicyInfo { export const GroupPolicyInfo = { typeUrl: "/cosmos.group.v1.GroupPolicyInfo", aminoType: "cosmos-sdk/GroupPolicyInfo", + is(o: any): o is GroupPolicyInfo { + return o && (o.$typeUrl === GroupPolicyInfo.typeUrl || typeof o.address === "string" && typeof o.groupId === "bigint" && typeof o.admin === "string" && typeof o.metadata === "string" && typeof o.version === "bigint" && Timestamp.is(o.createdAt)); + }, + isSDK(o: any): o is GroupPolicyInfoSDKType { + return o && (o.$typeUrl === GroupPolicyInfo.typeUrl || typeof o.address === "string" && typeof o.group_id === "bigint" && typeof o.admin === "string" && typeof o.metadata === "string" && typeof o.version === "bigint" && Timestamp.isSDK(o.created_at)); + }, + isAmino(o: any): o is GroupPolicyInfoAmino { + return o && (o.$typeUrl === GroupPolicyInfo.typeUrl || typeof o.address === "string" && typeof o.group_id === "bigint" && typeof o.admin === "string" && typeof o.metadata === "string" && typeof o.version === "bigint" && Timestamp.isAmino(o.created_at)); + }, encode(message: GroupPolicyInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.address !== "") { writer.uint32(10).string(message.address); @@ -1845,7 +1949,7 @@ export const GroupPolicyInfo = { writer.uint32(40).uint64(message.version); } if (message.decisionPolicy !== undefined) { - Any.encode((message.decisionPolicy as Any), writer.uint32(50).fork()).ldelim(); + Any.encode(GlobalDecoderRegistry.wrapAny(message.decisionPolicy), writer.uint32(50).fork()).ldelim(); } if (message.createdAt !== undefined) { Timestamp.encode(toTimestamp(message.createdAt), writer.uint32(58).fork()).ldelim(); @@ -1875,7 +1979,7 @@ export const GroupPolicyInfo = { message.version = reader.uint64(); break; case 6: - message.decisionPolicy = useInterfaces ? (DecisionPolicy_InterfaceDecoder(reader) as Any) : Any.decode(reader, reader.uint32(), useInterfaces); + message.decisionPolicy = GlobalDecoderRegistry.unwrapAny(reader); break; case 7: message.createdAt = fromTimestamp(Timestamp.decode(reader, reader.uint32())); @@ -1894,7 +1998,7 @@ export const GroupPolicyInfo = { if (isSet(object.admin)) obj.admin = String(object.admin); if (isSet(object.metadata)) obj.metadata = String(object.metadata); if (isSet(object.version)) obj.version = BigInt(object.version.toString()); - if (isSet(object.decisionPolicy)) obj.decisionPolicy = Any.fromJSON(object.decisionPolicy); + if (isSet(object.decisionPolicy)) obj.decisionPolicy = GlobalDecoderRegistry.fromJSON(object.decisionPolicy); if (isSet(object.createdAt)) obj.createdAt = new Date(object.createdAt); return obj; }, @@ -1910,7 +2014,7 @@ export const GroupPolicyInfo = { message.version = BigInt(object.version.toString()); } if (object.decisionPolicy !== undefined && object.decisionPolicy !== null) { - message.decisionPolicy = Any.fromPartial(object.decisionPolicy); + message.decisionPolicy = GlobalDecoderRegistry.fromPartial(object.decisionPolicy); } message.createdAt = object.createdAt ?? undefined; return message; @@ -1922,7 +2026,7 @@ export const GroupPolicyInfo = { admin: object?.admin, metadata: object?.metadata, version: object?.version, - decisionPolicy: object.decision_policy ? Any.fromSDK(object.decision_policy) : undefined, + decisionPolicy: object.decision_policy ? GlobalDecoderRegistry.fromSDK(object.decision_policy) : undefined, createdAt: object.created_at ?? undefined }; }, @@ -1933,7 +2037,7 @@ export const GroupPolicyInfo = { obj.admin = message.admin; obj.metadata = message.metadata; obj.version = message.version; - message.decisionPolicy !== undefined && (obj.decision_policy = message.decisionPolicy ? Any.toSDK(message.decisionPolicy) : undefined); + message.decisionPolicy !== undefined && (obj.decision_policy = message.decisionPolicy ? GlobalDecoderRegistry.toSDK(message.decisionPolicy) : undefined); message.createdAt !== undefined && (obj.created_at = message.createdAt ?? undefined); return obj; }, @@ -1955,7 +2059,7 @@ export const GroupPolicyInfo = { message.version = BigInt(object.version); } if (object.decision_policy !== undefined && object.decision_policy !== null) { - message.decisionPolicy = DecisionPolicy_FromAmino(object.decision_policy); + message.decisionPolicy = GlobalDecoderRegistry.fromAminoMsg(object.decision_policy); } if (object.created_at !== undefined && object.created_at !== null) { message.createdAt = fromTimestamp(Timestamp.fromAmino(object.created_at)); @@ -1969,7 +2073,7 @@ export const GroupPolicyInfo = { obj.admin = message.admin === "" ? undefined : message.admin; obj.metadata = message.metadata === "" ? undefined : message.metadata; obj.version = message.version !== BigInt(0) ? message.version?.toString() : undefined; - obj.decision_policy = message.decisionPolicy ? DecisionPolicy_ToAmino((message.decisionPolicy as Any), useInterfaces) : undefined; + obj.decision_policy = message.decisionPolicy ? GlobalDecoderRegistry.toAminoMsg(message.decisionPolicy) : undefined; obj.created_at = message.createdAt ? Timestamp.toAmino(toTimestamp(message.createdAt)) : undefined; return obj; }, @@ -1984,6 +2088,13 @@ export const GroupPolicyInfo = { typeUrl: "/cosmos.group.v1.GroupPolicyInfo", value: GroupPolicyInfo.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GroupPolicyInfo.typeUrl)) { + return; + } + ThresholdDecisionPolicy.registerTypeUrl(); + PercentageDecisionPolicy.registerTypeUrl(); } }; function createBaseProposal(): Proposal { @@ -2015,6 +2126,15 @@ function createBaseProposal(): Proposal { export const Proposal = { typeUrl: "/cosmos.group.v1.Proposal", aminoType: "cosmos-sdk/Proposal", + is(o: any): o is Proposal { + return o && (o.$typeUrl === Proposal.typeUrl || typeof o.id === "bigint" && typeof o.address === "string" && typeof o.metadata === "string" && Array.isArray(o.proposers) && (!o.proposers.length || typeof o.proposers[0] === "string") && Timestamp.is(o.submitTime) && typeof o.groupVersion === "bigint" && typeof o.groupPolicyVersion === "bigint" && isSet(o.status) && isSet(o.result) && TallyResult.is(o.finalTallyResult) && Timestamp.is(o.votingPeriodEnd) && isSet(o.executorResult) && Array.isArray(o.messages) && (!o.messages.length || Any.is(o.messages[0]))); + }, + isSDK(o: any): o is ProposalSDKType { + return o && (o.$typeUrl === Proposal.typeUrl || typeof o.id === "bigint" && typeof o.address === "string" && typeof o.metadata === "string" && Array.isArray(o.proposers) && (!o.proposers.length || typeof o.proposers[0] === "string") && Timestamp.isSDK(o.submit_time) && typeof o.group_version === "bigint" && typeof o.group_policy_version === "bigint" && isSet(o.status) && isSet(o.result) && TallyResult.isSDK(o.final_tally_result) && Timestamp.isSDK(o.voting_period_end) && isSet(o.executor_result) && Array.isArray(o.messages) && (!o.messages.length || Any.isSDK(o.messages[0]))); + }, + isAmino(o: any): o is ProposalAmino { + return o && (o.$typeUrl === Proposal.typeUrl || typeof o.id === "bigint" && typeof o.address === "string" && typeof o.metadata === "string" && Array.isArray(o.proposers) && (!o.proposers.length || typeof o.proposers[0] === "string") && Timestamp.isAmino(o.submit_time) && typeof o.group_version === "bigint" && typeof o.group_policy_version === "bigint" && isSet(o.status) && isSet(o.result) && TallyResult.isAmino(o.final_tally_result) && Timestamp.isAmino(o.voting_period_end) && isSet(o.executor_result) && Array.isArray(o.messages) && (!o.messages.length || Any.isAmino(o.messages[0]))); + }, encode(message: Proposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.id !== BigInt(0)) { writer.uint32(8).uint64(message.id); @@ -2269,7 +2389,8 @@ export const Proposal = { typeUrl: "/cosmos.group.v1.Proposal", value: Proposal.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseTallyResult(): TallyResult { return { @@ -2288,6 +2409,15 @@ function createBaseTallyResult(): TallyResult { export const TallyResult = { typeUrl: "/cosmos.group.v1.TallyResult", aminoType: "cosmos-sdk/TallyResult", + is(o: any): o is TallyResult { + return o && (o.$typeUrl === TallyResult.typeUrl || typeof o.yesCount === "string" && typeof o.abstainCount === "string" && typeof o.noCount === "string" && typeof o.noWithVetoCount === "string"); + }, + isSDK(o: any): o is TallyResultSDKType { + return o && (o.$typeUrl === TallyResult.typeUrl || typeof o.yes_count === "string" && typeof o.abstain_count === "string" && typeof o.no_count === "string" && typeof o.no_with_veto_count === "string"); + }, + isAmino(o: any): o is TallyResultAmino { + return o && (o.$typeUrl === TallyResult.typeUrl || typeof o.yes_count === "string" && typeof o.abstain_count === "string" && typeof o.no_count === "string" && typeof o.no_with_veto_count === "string"); + }, encode(message: TallyResult, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.yesCount !== "") { writer.uint32(10).string(message.yesCount); @@ -2396,7 +2526,8 @@ export const TallyResult = { typeUrl: "/cosmos.group.v1.TallyResult", value: TallyResult.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseVote(): Vote { return { @@ -2416,6 +2547,15 @@ function createBaseVote(): Vote { export const Vote = { typeUrl: "/cosmos.group.v1.Vote", aminoType: "cosmos-sdk/Vote", + is(o: any): o is Vote { + return o && (o.$typeUrl === Vote.typeUrl || typeof o.proposalId === "bigint" && typeof o.voter === "string" && isSet(o.option) && typeof o.metadata === "string" && Timestamp.is(o.submitTime)); + }, + isSDK(o: any): o is VoteSDKType { + return o && (o.$typeUrl === Vote.typeUrl || typeof o.proposal_id === "bigint" && typeof o.voter === "string" && isSet(o.option) && typeof o.metadata === "string" && Timestamp.isSDK(o.submit_time)); + }, + isAmino(o: any): o is VoteAmino { + return o && (o.$typeUrl === Vote.typeUrl || typeof o.proposal_id === "bigint" && typeof o.voter === "string" && isSet(o.option) && typeof o.metadata === "string" && Timestamp.isAmino(o.submit_time)); + }, encode(message: Vote, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.proposalId !== BigInt(0)) { writer.uint32(8).uint64(message.proposalId); @@ -2540,49 +2680,6 @@ export const Vote = { typeUrl: "/cosmos.group.v1.Vote", value: Vote.encode(message).finish() }; - } -}; -export const DecisionPolicy_InterfaceDecoder = (input: BinaryReader | Uint8Array): ThresholdDecisionPolicy | PercentageDecisionPolicy | Any => { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - const data = Any.decode(reader, reader.uint32(), true); - switch (data.typeUrl) { - case "/cosmos.group.v1.ThresholdDecisionPolicy": - return ThresholdDecisionPolicy.decode(data.value, undefined, true); - case "/cosmos.group.v1.PercentageDecisionPolicy": - return PercentageDecisionPolicy.decode(data.value, undefined, true); - default: - return data; - } -}; -export const DecisionPolicy_FromAmino = (content: AnyAmino): Any => { - switch (content.type) { - case "cosmos-sdk/ThresholdDecisionPolicy": - return Any.fromPartial({ - typeUrl: "/cosmos.group.v1.ThresholdDecisionPolicy", - value: ThresholdDecisionPolicy.encode(ThresholdDecisionPolicy.fromPartial(ThresholdDecisionPolicy.fromAmino(content.value))).finish() - }); - case "cosmos-sdk/PercentageDecisionPolicy": - return Any.fromPartial({ - typeUrl: "/cosmos.group.v1.PercentageDecisionPolicy", - value: PercentageDecisionPolicy.encode(PercentageDecisionPolicy.fromPartial(PercentageDecisionPolicy.fromAmino(content.value))).finish() - }); - default: - return Any.fromAmino(content); - } -}; -export const DecisionPolicy_ToAmino = (content: Any, useInterfaces: boolean = true) => { - switch (content.typeUrl) { - case "/cosmos.group.v1.ThresholdDecisionPolicy": - return { - type: "cosmos-sdk/ThresholdDecisionPolicy", - value: ThresholdDecisionPolicy.toAmino(ThresholdDecisionPolicy.decode(content.value, undefined, useInterfaces), useInterfaces) - }; - case "/cosmos.group.v1.PercentageDecisionPolicy": - return { - type: "cosmos-sdk/PercentageDecisionPolicy", - value: PercentageDecisionPolicy.toAmino(PercentageDecisionPolicy.decode(content.value, undefined, useInterfaces), useInterfaces) - }; - default: - return Any.toAmino(content, useInterfaces); - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/cosmos/mint/v1beta1/genesis.ts b/__fixtures__/v-next/outputv3/cosmos/mint/v1beta1/genesis.ts index f8ec0fbece..697a4b18d1 100644 --- a/__fixtures__/v-next/outputv3/cosmos/mint/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv3/cosmos/mint/v1beta1/genesis.ts @@ -1,5 +1,6 @@ import { Minter, MinterAmino, MinterSDKType, Params, ParamsAmino, ParamsSDKType } from "./mint"; import { BinaryReader, BinaryWriter } from "../../../binary"; +import { GlobalDecoderRegistry } from "../../../registry"; import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "cosmos.mint.v1beta1"; /** @@ -63,6 +64,15 @@ function createBaseGenesisState(): GenesisState { export const GenesisState = { typeUrl: "/cosmos.mint.v1beta1.GenesisState", aminoType: "cosmos-sdk/GenesisState", + is(o: any): o is GenesisState { + return o && (o.$typeUrl === GenesisState.typeUrl || Minter.is(o.minter) && Params.is(o.params)); + }, + isSDK(o: any): o is GenesisStateSDKType { + return o && (o.$typeUrl === GenesisState.typeUrl || Minter.isSDK(o.minter) && Params.isSDK(o.params)); + }, + isAmino(o: any): o is GenesisStateAmino { + return o && (o.$typeUrl === GenesisState.typeUrl || Minter.isAmino(o.minter) && Params.isAmino(o.params)); + }, encode(message: GenesisState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.minter !== undefined) { Minter.encode(message.minter, writer.uint32(10).fork()).ldelim(); @@ -147,5 +157,12 @@ export const GenesisState = { typeUrl: "/cosmos.mint.v1beta1.GenesisState", value: GenesisState.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GenesisState.typeUrl)) { + return; + } + Minter.registerTypeUrl(); + Params.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/cosmos/mint/v1beta1/mint.ts b/__fixtures__/v-next/outputv3/cosmos/mint/v1beta1/mint.ts index 89f2376b59..d127d8f056 100644 --- a/__fixtures__/v-next/outputv3/cosmos/mint/v1beta1/mint.ts +++ b/__fixtures__/v-next/outputv3/cosmos/mint/v1beta1/mint.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { Decimal } from "@cosmjs/math"; +import { Decimal } from "@interchainjs/math"; import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "cosmos.mint.v1beta1"; /** @@ -145,6 +145,15 @@ function createBaseMinter(): Minter { export const Minter = { typeUrl: "/cosmos.mint.v1beta1.Minter", aminoType: "cosmos-sdk/Minter", + is(o: any): o is Minter { + return o && (o.$typeUrl === Minter.typeUrl || typeof o.inflation === "string" && typeof o.annualProvisions === "string"); + }, + isSDK(o: any): o is MinterSDKType { + return o && (o.$typeUrl === Minter.typeUrl || typeof o.inflation === "string" && typeof o.annual_provisions === "string"); + }, + isAmino(o: any): o is MinterAmino { + return o && (o.$typeUrl === Minter.typeUrl || typeof o.inflation === "string" && typeof o.annual_provisions === "string"); + }, encode(message: Minter, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.inflation !== "") { writer.uint32(10).string(Decimal.fromUserInput(message.inflation, 18).atomics); @@ -210,8 +219,8 @@ export const Minter = { }, toAmino(message: Minter, useInterfaces: boolean = true): MinterAmino { const obj: any = {}; - obj.inflation = message.inflation === "" ? undefined : message.inflation; - obj.annual_provisions = message.annualProvisions === "" ? undefined : message.annualProvisions; + obj.inflation = message.inflation === "" ? undefined : Decimal.fromUserInput(message.inflation, 18).atomics; + obj.annual_provisions = message.annualProvisions === "" ? undefined : Decimal.fromUserInput(message.annualProvisions, 18).atomics; return obj; }, fromProtoMsg(message: MinterProtoMsg, useInterfaces: boolean = true): Minter { @@ -225,7 +234,8 @@ export const Minter = { typeUrl: "/cosmos.mint.v1beta1.Minter", value: Minter.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseParams(): Params { return { @@ -246,6 +256,15 @@ function createBaseParams(): Params { export const Params = { typeUrl: "/cosmos.mint.v1beta1.Params", aminoType: "cosmos-sdk/Params", + is(o: any): o is Params { + return o && (o.$typeUrl === Params.typeUrl || typeof o.mintDenom === "string" && typeof o.inflationRateChange === "string" && typeof o.inflationMax === "string" && typeof o.inflationMin === "string" && typeof o.goalBonded === "string" && typeof o.blocksPerYear === "bigint"); + }, + isSDK(o: any): o is ParamsSDKType { + return o && (o.$typeUrl === Params.typeUrl || typeof o.mint_denom === "string" && typeof o.inflation_rate_change === "string" && typeof o.inflation_max === "string" && typeof o.inflation_min === "string" && typeof o.goal_bonded === "string" && typeof o.blocks_per_year === "bigint"); + }, + isAmino(o: any): o is ParamsAmino { + return o && (o.$typeUrl === Params.typeUrl || typeof o.mint_denom === "string" && typeof o.inflation_rate_change === "string" && typeof o.inflation_max === "string" && typeof o.inflation_min === "string" && typeof o.goal_bonded === "string" && typeof o.blocks_per_year === "bigint"); + }, encode(message: Params, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.mintDenom !== "") { writer.uint32(10).string(message.mintDenom); @@ -366,10 +385,10 @@ export const Params = { toAmino(message: Params, useInterfaces: boolean = true): ParamsAmino { const obj: any = {}; obj.mint_denom = message.mintDenom === "" ? undefined : message.mintDenom; - obj.inflation_rate_change = message.inflationRateChange === "" ? undefined : message.inflationRateChange; - obj.inflation_max = message.inflationMax === "" ? undefined : message.inflationMax; - obj.inflation_min = message.inflationMin === "" ? undefined : message.inflationMin; - obj.goal_bonded = message.goalBonded === "" ? undefined : message.goalBonded; + obj.inflation_rate_change = message.inflationRateChange === "" ? undefined : Decimal.fromUserInput(message.inflationRateChange, 18).atomics; + obj.inflation_max = message.inflationMax === "" ? undefined : Decimal.fromUserInput(message.inflationMax, 18).atomics; + obj.inflation_min = message.inflationMin === "" ? undefined : Decimal.fromUserInput(message.inflationMin, 18).atomics; + obj.goal_bonded = message.goalBonded === "" ? undefined : Decimal.fromUserInput(message.goalBonded, 18).atomics; obj.blocks_per_year = message.blocksPerYear !== BigInt(0) ? message.blocksPerYear?.toString() : undefined; return obj; }, @@ -384,5 +403,6 @@ export const Params = { typeUrl: "/cosmos.mint.v1beta1.Params", value: Params.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/cosmos/mint/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputv3/cosmos/mint/v1beta1/query.rpc.func.ts new file mode 100644 index 0000000000..ec8aaa7244 --- /dev/null +++ b/__fixtures__/v-next/outputv3/cosmos/mint/v1beta1/query.rpc.func.ts @@ -0,0 +1,42 @@ +import { Params, ParamsSDKType } from "./mint"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, QueryInflationRequest, QueryInflationRequestSDKType, QueryInflationResponse, QueryInflationResponseSDKType, QueryAnnualProvisionsRequest, QueryAnnualProvisionsRequestSDKType, QueryAnnualProvisionsResponse, QueryAnnualProvisionsResponseSDKType } from "./query"; +/** + * Params returns the total set of minting parameters. + * @name getParams + * @package cosmos.mint.v1beta1 + * @see proto service: cosmos.mint.v1beta1.Params + */ +export const getParams = buildQuery({ + encode: QueryParamsRequest.encode, + decode: QueryParamsResponse.decode, + service: "cosmos.mint.v1beta1.Query", + method: "Params", + deps: [QueryParamsRequest, QueryParamsResponse] +}); +/** + * Inflation returns the current minting inflation value. + * @name getInflation + * @package cosmos.mint.v1beta1 + * @see proto service: cosmos.mint.v1beta1.Inflation + */ +export const getInflation = buildQuery({ + encode: QueryInflationRequest.encode, + decode: QueryInflationResponse.decode, + service: "cosmos.mint.v1beta1.Query", + method: "Inflation", + deps: [QueryInflationRequest, QueryInflationResponse] +}); +/** + * AnnualProvisions current minting annual provisions value. + * @name getAnnualProvisions + * @package cosmos.mint.v1beta1 + * @see proto service: cosmos.mint.v1beta1.AnnualProvisions + */ +export const getAnnualProvisions = buildQuery({ + encode: QueryAnnualProvisionsRequest.encode, + decode: QueryAnnualProvisionsResponse.decode, + service: "cosmos.mint.v1beta1.Query", + method: "AnnualProvisions", + deps: [QueryAnnualProvisionsRequest, QueryAnnualProvisionsResponse] +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/cosmos/mint/v1beta1/query.ts b/__fixtures__/v-next/outputv3/cosmos/mint/v1beta1/query.ts index 4d890286eb..08ae292a86 100644 --- a/__fixtures__/v-next/outputv3/cosmos/mint/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv3/cosmos/mint/v1beta1/query.ts @@ -1,6 +1,7 @@ import { Params, ParamsAmino, ParamsSDKType } from "./mint"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { DeepPartial, isSet, bytesFromBase64, base64FromBytes } from "../../../helpers"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "cosmos.mint.v1beta1"; /** * QueryParamsRequest is the request type for the Query/Params RPC method. @@ -209,6 +210,15 @@ function createBaseQueryParamsRequest(): QueryParamsRequest { export const QueryParamsRequest = { typeUrl: "/cosmos.mint.v1beta1.QueryParamsRequest", aminoType: "cosmos-sdk/QueryParamsRequest", + is(o: any): o is QueryParamsRequest { + return o && o.$typeUrl === QueryParamsRequest.typeUrl; + }, + isSDK(o: any): o is QueryParamsRequestSDKType { + return o && o.$typeUrl === QueryParamsRequest.typeUrl; + }, + isAmino(o: any): o is QueryParamsRequestAmino { + return o && o.$typeUrl === QueryParamsRequest.typeUrl; + }, encode(_: QueryParamsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -260,7 +270,8 @@ export const QueryParamsRequest = { typeUrl: "/cosmos.mint.v1beta1.QueryParamsRequest", value: QueryParamsRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryParamsResponse(): QueryParamsResponse { return { @@ -276,6 +287,15 @@ function createBaseQueryParamsResponse(): QueryParamsResponse { export const QueryParamsResponse = { typeUrl: "/cosmos.mint.v1beta1.QueryParamsResponse", aminoType: "cosmos-sdk/QueryParamsResponse", + is(o: any): o is QueryParamsResponse { + return o && (o.$typeUrl === QueryParamsResponse.typeUrl || Params.is(o.params)); + }, + isSDK(o: any): o is QueryParamsResponseSDKType { + return o && (o.$typeUrl === QueryParamsResponse.typeUrl || Params.isSDK(o.params)); + }, + isAmino(o: any): o is QueryParamsResponseAmino { + return o && (o.$typeUrl === QueryParamsResponse.typeUrl || Params.isAmino(o.params)); + }, encode(message: QueryParamsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.params !== undefined) { Params.encode(message.params, writer.uint32(10).fork()).ldelim(); @@ -344,6 +364,12 @@ export const QueryParamsResponse = { typeUrl: "/cosmos.mint.v1beta1.QueryParamsResponse", value: QueryParamsResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryParamsResponse.typeUrl)) { + return; + } + Params.registerTypeUrl(); } }; function createBaseQueryInflationRequest(): QueryInflationRequest { @@ -358,6 +384,15 @@ function createBaseQueryInflationRequest(): QueryInflationRequest { export const QueryInflationRequest = { typeUrl: "/cosmos.mint.v1beta1.QueryInflationRequest", aminoType: "cosmos-sdk/QueryInflationRequest", + is(o: any): o is QueryInflationRequest { + return o && o.$typeUrl === QueryInflationRequest.typeUrl; + }, + isSDK(o: any): o is QueryInflationRequestSDKType { + return o && o.$typeUrl === QueryInflationRequest.typeUrl; + }, + isAmino(o: any): o is QueryInflationRequestAmino { + return o && o.$typeUrl === QueryInflationRequest.typeUrl; + }, encode(_: QueryInflationRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -409,7 +444,8 @@ export const QueryInflationRequest = { typeUrl: "/cosmos.mint.v1beta1.QueryInflationRequest", value: QueryInflationRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryInflationResponse(): QueryInflationResponse { return { @@ -426,6 +462,15 @@ function createBaseQueryInflationResponse(): QueryInflationResponse { export const QueryInflationResponse = { typeUrl: "/cosmos.mint.v1beta1.QueryInflationResponse", aminoType: "cosmos-sdk/QueryInflationResponse", + is(o: any): o is QueryInflationResponse { + return o && (o.$typeUrl === QueryInflationResponse.typeUrl || o.inflation instanceof Uint8Array || typeof o.inflation === "string"); + }, + isSDK(o: any): o is QueryInflationResponseSDKType { + return o && (o.$typeUrl === QueryInflationResponse.typeUrl || o.inflation instanceof Uint8Array || typeof o.inflation === "string"); + }, + isAmino(o: any): o is QueryInflationResponseAmino { + return o && (o.$typeUrl === QueryInflationResponse.typeUrl || o.inflation instanceof Uint8Array || typeof o.inflation === "string"); + }, encode(message: QueryInflationResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.inflation.length !== 0) { writer.uint32(10).bytes(message.inflation); @@ -492,7 +537,8 @@ export const QueryInflationResponse = { typeUrl: "/cosmos.mint.v1beta1.QueryInflationResponse", value: QueryInflationResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryAnnualProvisionsRequest(): QueryAnnualProvisionsRequest { return {}; @@ -507,6 +553,15 @@ function createBaseQueryAnnualProvisionsRequest(): QueryAnnualProvisionsRequest export const QueryAnnualProvisionsRequest = { typeUrl: "/cosmos.mint.v1beta1.QueryAnnualProvisionsRequest", aminoType: "cosmos-sdk/QueryAnnualProvisionsRequest", + is(o: any): o is QueryAnnualProvisionsRequest { + return o && o.$typeUrl === QueryAnnualProvisionsRequest.typeUrl; + }, + isSDK(o: any): o is QueryAnnualProvisionsRequestSDKType { + return o && o.$typeUrl === QueryAnnualProvisionsRequest.typeUrl; + }, + isAmino(o: any): o is QueryAnnualProvisionsRequestAmino { + return o && o.$typeUrl === QueryAnnualProvisionsRequest.typeUrl; + }, encode(_: QueryAnnualProvisionsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -558,7 +613,8 @@ export const QueryAnnualProvisionsRequest = { typeUrl: "/cosmos.mint.v1beta1.QueryAnnualProvisionsRequest", value: QueryAnnualProvisionsRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryAnnualProvisionsResponse(): QueryAnnualProvisionsResponse { return { @@ -575,6 +631,15 @@ function createBaseQueryAnnualProvisionsResponse(): QueryAnnualProvisionsRespons export const QueryAnnualProvisionsResponse = { typeUrl: "/cosmos.mint.v1beta1.QueryAnnualProvisionsResponse", aminoType: "cosmos-sdk/QueryAnnualProvisionsResponse", + is(o: any): o is QueryAnnualProvisionsResponse { + return o && (o.$typeUrl === QueryAnnualProvisionsResponse.typeUrl || o.annualProvisions instanceof Uint8Array || typeof o.annualProvisions === "string"); + }, + isSDK(o: any): o is QueryAnnualProvisionsResponseSDKType { + return o && (o.$typeUrl === QueryAnnualProvisionsResponse.typeUrl || o.annual_provisions instanceof Uint8Array || typeof o.annual_provisions === "string"); + }, + isAmino(o: any): o is QueryAnnualProvisionsResponseAmino { + return o && (o.$typeUrl === QueryAnnualProvisionsResponse.typeUrl || o.annual_provisions instanceof Uint8Array || typeof o.annual_provisions === "string"); + }, encode(message: QueryAnnualProvisionsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.annualProvisions.length !== 0) { writer.uint32(10).bytes(message.annualProvisions); @@ -641,5 +706,6 @@ export const QueryAnnualProvisionsResponse = { typeUrl: "/cosmos.mint.v1beta1.QueryAnnualProvisionsResponse", value: QueryAnnualProvisionsResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/cosmos/nft/v1beta1/event.ts b/__fixtures__/v-next/outputv3/cosmos/nft/v1beta1/event.ts index 7cf111bd2a..a175772a04 100644 --- a/__fixtures__/v-next/outputv3/cosmos/nft/v1beta1/event.ts +++ b/__fixtures__/v-next/outputv3/cosmos/nft/v1beta1/event.ts @@ -132,6 +132,15 @@ function createBaseEventSend(): EventSend { export const EventSend = { typeUrl: "/cosmos.nft.v1beta1.EventSend", aminoType: "cosmos-sdk/EventSend", + is(o: any): o is EventSend { + return o && (o.$typeUrl === EventSend.typeUrl || typeof o.classId === "string" && typeof o.id === "string" && typeof o.sender === "string" && typeof o.receiver === "string"); + }, + isSDK(o: any): o is EventSendSDKType { + return o && (o.$typeUrl === EventSend.typeUrl || typeof o.class_id === "string" && typeof o.id === "string" && typeof o.sender === "string" && typeof o.receiver === "string"); + }, + isAmino(o: any): o is EventSendAmino { + return o && (o.$typeUrl === EventSend.typeUrl || typeof o.class_id === "string" && typeof o.id === "string" && typeof o.sender === "string" && typeof o.receiver === "string"); + }, encode(message: EventSend, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.classId !== "") { writer.uint32(10).string(message.classId); @@ -240,7 +249,8 @@ export const EventSend = { typeUrl: "/cosmos.nft.v1beta1.EventSend", value: EventSend.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseEventMint(): EventMint { return { @@ -258,6 +268,15 @@ function createBaseEventMint(): EventMint { export const EventMint = { typeUrl: "/cosmos.nft.v1beta1.EventMint", aminoType: "cosmos-sdk/EventMint", + is(o: any): o is EventMint { + return o && (o.$typeUrl === EventMint.typeUrl || typeof o.classId === "string" && typeof o.id === "string" && typeof o.owner === "string"); + }, + isSDK(o: any): o is EventMintSDKType { + return o && (o.$typeUrl === EventMint.typeUrl || typeof o.class_id === "string" && typeof o.id === "string" && typeof o.owner === "string"); + }, + isAmino(o: any): o is EventMintAmino { + return o && (o.$typeUrl === EventMint.typeUrl || typeof o.class_id === "string" && typeof o.id === "string" && typeof o.owner === "string"); + }, encode(message: EventMint, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.classId !== "") { writer.uint32(10).string(message.classId); @@ -352,7 +371,8 @@ export const EventMint = { typeUrl: "/cosmos.nft.v1beta1.EventMint", value: EventMint.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseEventBurn(): EventBurn { return { @@ -370,6 +390,15 @@ function createBaseEventBurn(): EventBurn { export const EventBurn = { typeUrl: "/cosmos.nft.v1beta1.EventBurn", aminoType: "cosmos-sdk/EventBurn", + is(o: any): o is EventBurn { + return o && (o.$typeUrl === EventBurn.typeUrl || typeof o.classId === "string" && typeof o.id === "string" && typeof o.owner === "string"); + }, + isSDK(o: any): o is EventBurnSDKType { + return o && (o.$typeUrl === EventBurn.typeUrl || typeof o.class_id === "string" && typeof o.id === "string" && typeof o.owner === "string"); + }, + isAmino(o: any): o is EventBurnAmino { + return o && (o.$typeUrl === EventBurn.typeUrl || typeof o.class_id === "string" && typeof o.id === "string" && typeof o.owner === "string"); + }, encode(message: EventBurn, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.classId !== "") { writer.uint32(10).string(message.classId); @@ -464,5 +493,6 @@ export const EventBurn = { typeUrl: "/cosmos.nft.v1beta1.EventBurn", value: EventBurn.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/cosmos/nft/v1beta1/genesis.ts b/__fixtures__/v-next/outputv3/cosmos/nft/v1beta1/genesis.ts index 3ce60564b5..6d84ee32a5 100644 --- a/__fixtures__/v-next/outputv3/cosmos/nft/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv3/cosmos/nft/v1beta1/genesis.ts @@ -1,6 +1,7 @@ import { Class, ClassAmino, ClassSDKType, NFT, NFTAmino, NFTSDKType } from "./nft"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { DeepPartial, isSet } from "../../../helpers"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "cosmos.nft.v1beta1"; /** * GenesisState defines the nft module's genesis state. @@ -103,6 +104,15 @@ function createBaseGenesisState(): GenesisState { export const GenesisState = { typeUrl: "/cosmos.nft.v1beta1.GenesisState", aminoType: "cosmos-sdk/GenesisState", + is(o: any): o is GenesisState { + return o && (o.$typeUrl === GenesisState.typeUrl || Array.isArray(o.classes) && (!o.classes.length || Class.is(o.classes[0])) && Array.isArray(o.entries) && (!o.entries.length || Entry.is(o.entries[0]))); + }, + isSDK(o: any): o is GenesisStateSDKType { + return o && (o.$typeUrl === GenesisState.typeUrl || Array.isArray(o.classes) && (!o.classes.length || Class.isSDK(o.classes[0])) && Array.isArray(o.entries) && (!o.entries.length || Entry.isSDK(o.entries[0]))); + }, + isAmino(o: any): o is GenesisStateAmino { + return o && (o.$typeUrl === GenesisState.typeUrl || Array.isArray(o.classes) && (!o.classes.length || Class.isAmino(o.classes[0])) && Array.isArray(o.entries) && (!o.entries.length || Entry.isAmino(o.entries[0]))); + }, encode(message: GenesisState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.classes) { Class.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -195,6 +205,13 @@ export const GenesisState = { typeUrl: "/cosmos.nft.v1beta1.GenesisState", value: GenesisState.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GenesisState.typeUrl)) { + return; + } + Class.registerTypeUrl(); + Entry.registerTypeUrl(); } }; function createBaseEntry(): Entry { @@ -212,6 +229,15 @@ function createBaseEntry(): Entry { export const Entry = { typeUrl: "/cosmos.nft.v1beta1.Entry", aminoType: "cosmos-sdk/Entry", + is(o: any): o is Entry { + return o && (o.$typeUrl === Entry.typeUrl || typeof o.owner === "string" && Array.isArray(o.nfts) && (!o.nfts.length || NFT.is(o.nfts[0]))); + }, + isSDK(o: any): o is EntrySDKType { + return o && (o.$typeUrl === Entry.typeUrl || typeof o.owner === "string" && Array.isArray(o.nfts) && (!o.nfts.length || NFT.isSDK(o.nfts[0]))); + }, + isAmino(o: any): o is EntryAmino { + return o && (o.$typeUrl === Entry.typeUrl || typeof o.owner === "string" && Array.isArray(o.nfts) && (!o.nfts.length || NFT.isAmino(o.nfts[0]))); + }, encode(message: Entry, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.owner !== "") { writer.uint32(10).string(message.owner); @@ -298,5 +324,11 @@ export const Entry = { typeUrl: "/cosmos.nft.v1beta1.Entry", value: Entry.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Entry.typeUrl)) { + return; + } + NFT.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/cosmos/nft/v1beta1/nft.ts b/__fixtures__/v-next/outputv3/cosmos/nft/v1beta1/nft.ts index 7ab1d238a0..66f20b62b1 100644 --- a/__fixtures__/v-next/outputv3/cosmos/nft/v1beta1/nft.ts +++ b/__fixtures__/v-next/outputv3/cosmos/nft/v1beta1/nft.ts @@ -1,5 +1,6 @@ import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../google/protobuf/any"; import { BinaryReader, BinaryWriter } from "../../../binary"; +import { GlobalDecoderRegistry } from "../../../registry"; import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "cosmos.nft.v1beta1"; /** @@ -186,6 +187,15 @@ function createBaseClass(): Class { export const Class = { typeUrl: "/cosmos.nft.v1beta1.Class", aminoType: "cosmos-sdk/Class", + is(o: any): o is Class { + return o && (o.$typeUrl === Class.typeUrl || typeof o.id === "string" && typeof o.name === "string" && typeof o.symbol === "string" && typeof o.description === "string" && typeof o.uri === "string" && typeof o.uriHash === "string"); + }, + isSDK(o: any): o is ClassSDKType { + return o && (o.$typeUrl === Class.typeUrl || typeof o.id === "string" && typeof o.name === "string" && typeof o.symbol === "string" && typeof o.description === "string" && typeof o.uri === "string" && typeof o.uri_hash === "string"); + }, + isAmino(o: any): o is ClassAmino { + return o && (o.$typeUrl === Class.typeUrl || typeof o.id === "string" && typeof o.name === "string" && typeof o.symbol === "string" && typeof o.description === "string" && typeof o.uri === "string" && typeof o.uri_hash === "string"); + }, encode(message: Class, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.id !== "") { writer.uint32(10).string(message.id); @@ -338,7 +348,8 @@ export const Class = { typeUrl: "/cosmos.nft.v1beta1.Class", value: Class.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseNFT(): NFT { return { @@ -358,6 +369,15 @@ function createBaseNFT(): NFT { export const NFT = { typeUrl: "/cosmos.nft.v1beta1.NFT", aminoType: "cosmos-sdk/NFT", + is(o: any): o is NFT { + return o && (o.$typeUrl === NFT.typeUrl || typeof o.classId === "string" && typeof o.id === "string" && typeof o.uri === "string" && typeof o.uriHash === "string"); + }, + isSDK(o: any): o is NFTSDKType { + return o && (o.$typeUrl === NFT.typeUrl || typeof o.class_id === "string" && typeof o.id === "string" && typeof o.uri === "string" && typeof o.uri_hash === "string"); + }, + isAmino(o: any): o is NFTAmino { + return o && (o.$typeUrl === NFT.typeUrl || typeof o.class_id === "string" && typeof o.id === "string" && typeof o.uri === "string" && typeof o.uri_hash === "string"); + }, encode(message: NFT, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.classId !== "") { writer.uint32(10).string(message.classId); @@ -482,5 +502,6 @@ export const NFT = { typeUrl: "/cosmos.nft.v1beta1.NFT", value: NFT.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/cosmos/nft/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputv3/cosmos/nft/v1beta1/query.rpc.func.ts new file mode 100644 index 0000000000..a15bf05547 --- /dev/null +++ b/__fixtures__/v-next/outputv3/cosmos/nft/v1beta1/query.rpc.func.ts @@ -0,0 +1,96 @@ +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; +import { NFT, NFTSDKType, Class, ClassSDKType } from "./nft"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { QueryBalanceRequest, QueryBalanceRequestSDKType, QueryBalanceResponse, QueryBalanceResponseSDKType, QueryOwnerRequest, QueryOwnerRequestSDKType, QueryOwnerResponse, QueryOwnerResponseSDKType, QuerySupplyRequest, QuerySupplyRequestSDKType, QuerySupplyResponse, QuerySupplyResponseSDKType, QueryNFTsRequest, QueryNFTsRequestSDKType, QueryNFTsResponse, QueryNFTsResponseSDKType, QueryNFTRequest, QueryNFTRequestSDKType, QueryNFTResponse, QueryNFTResponseSDKType, QueryClassRequest, QueryClassRequestSDKType, QueryClassResponse, QueryClassResponseSDKType, QueryClassesRequest, QueryClassesRequestSDKType, QueryClassesResponse, QueryClassesResponseSDKType } from "./query"; +/** + * Balance queries the number of NFTs of a given class owned by the owner, same as balanceOf in ERC721 + * @name getBalance + * @package cosmos.nft.v1beta1 + * @see proto service: cosmos.nft.v1beta1.Balance + */ +export const getBalance = buildQuery({ + encode: QueryBalanceRequest.encode, + decode: QueryBalanceResponse.decode, + service: "cosmos.nft.v1beta1.Query", + method: "Balance", + deps: [QueryBalanceRequest, QueryBalanceResponse] +}); +/** + * Owner queries the owner of the NFT based on its class and id, same as ownerOf in ERC721 + * @name getOwner + * @package cosmos.nft.v1beta1 + * @see proto service: cosmos.nft.v1beta1.Owner + */ +export const getOwner = buildQuery({ + encode: QueryOwnerRequest.encode, + decode: QueryOwnerResponse.decode, + service: "cosmos.nft.v1beta1.Query", + method: "Owner", + deps: [QueryOwnerRequest, QueryOwnerResponse] +}); +/** + * Supply queries the number of NFTs from the given class, same as totalSupply of ERC721. + * @name getSupply + * @package cosmos.nft.v1beta1 + * @see proto service: cosmos.nft.v1beta1.Supply + */ +export const getSupply = buildQuery({ + encode: QuerySupplyRequest.encode, + decode: QuerySupplyResponse.decode, + service: "cosmos.nft.v1beta1.Query", + method: "Supply", + deps: [QuerySupplyRequest, QuerySupplyResponse] +}); +/** + * NFTs queries all NFTs of a given class or owner,choose at least one of the two, similar to tokenByIndex in + * ERC721Enumerable + * @name getNFTs + * @package cosmos.nft.v1beta1 + * @see proto service: cosmos.nft.v1beta1.NFTs + */ +export const getNFTs = buildQuery({ + encode: QueryNFTsRequest.encode, + decode: QueryNFTsResponse.decode, + service: "cosmos.nft.v1beta1.Query", + method: "NFTs", + deps: [QueryNFTsRequest, QueryNFTsResponse] +}); +/** + * NFT queries an NFT based on its class and id. + * @name getNFT + * @package cosmos.nft.v1beta1 + * @see proto service: cosmos.nft.v1beta1.NFT + */ +export const getNFT = buildQuery({ + encode: QueryNFTRequest.encode, + decode: QueryNFTResponse.decode, + service: "cosmos.nft.v1beta1.Query", + method: "NFT", + deps: [QueryNFTRequest, QueryNFTResponse] +}); +/** + * Class queries an NFT class based on its id + * @name getClass + * @package cosmos.nft.v1beta1 + * @see proto service: cosmos.nft.v1beta1.Class + */ +export const getClass = buildQuery({ + encode: QueryClassRequest.encode, + decode: QueryClassResponse.decode, + service: "cosmos.nft.v1beta1.Query", + method: "Class", + deps: [QueryClassRequest, QueryClassResponse] +}); +/** + * Classes queries all NFT classes + * @name getClasses + * @package cosmos.nft.v1beta1 + * @see proto service: cosmos.nft.v1beta1.Classes + */ +export const getClasses = buildQuery({ + encode: QueryClassesRequest.encode, + decode: QueryClassesResponse.decode, + service: "cosmos.nft.v1beta1.Query", + method: "Classes", + deps: [QueryClassesRequest, QueryClassesResponse] +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/cosmos/nft/v1beta1/query.ts b/__fixtures__/v-next/outputv3/cosmos/nft/v1beta1/query.ts index 0f02d84c20..708f8f3399 100644 --- a/__fixtures__/v-next/outputv3/cosmos/nft/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv3/cosmos/nft/v1beta1/query.ts @@ -2,6 +2,7 @@ import { PageRequest, PageRequestAmino, PageRequestSDKType, PageResponse, PageRe import { NFT, NFTAmino, NFTSDKType, Class, ClassAmino, ClassSDKType } from "./nft"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { isSet, DeepPartial } from "../../../helpers"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "cosmos.nft.v1beta1"; /** * QueryBalanceRequest is the request type for the Query/Balance RPC method @@ -479,6 +480,15 @@ function createBaseQueryBalanceRequest(): QueryBalanceRequest { export const QueryBalanceRequest = { typeUrl: "/cosmos.nft.v1beta1.QueryBalanceRequest", aminoType: "cosmos-sdk/QueryBalanceRequest", + is(o: any): o is QueryBalanceRequest { + return o && (o.$typeUrl === QueryBalanceRequest.typeUrl || typeof o.classId === "string" && typeof o.owner === "string"); + }, + isSDK(o: any): o is QueryBalanceRequestSDKType { + return o && (o.$typeUrl === QueryBalanceRequest.typeUrl || typeof o.class_id === "string" && typeof o.owner === "string"); + }, + isAmino(o: any): o is QueryBalanceRequestAmino { + return o && (o.$typeUrl === QueryBalanceRequest.typeUrl || typeof o.class_id === "string" && typeof o.owner === "string"); + }, encode(message: QueryBalanceRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.classId !== "") { writer.uint32(10).string(message.classId); @@ -559,7 +569,8 @@ export const QueryBalanceRequest = { typeUrl: "/cosmos.nft.v1beta1.QueryBalanceRequest", value: QueryBalanceRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryBalanceResponse(): QueryBalanceResponse { return { @@ -575,6 +586,15 @@ function createBaseQueryBalanceResponse(): QueryBalanceResponse { export const QueryBalanceResponse = { typeUrl: "/cosmos.nft.v1beta1.QueryBalanceResponse", aminoType: "cosmos-sdk/QueryBalanceResponse", + is(o: any): o is QueryBalanceResponse { + return o && (o.$typeUrl === QueryBalanceResponse.typeUrl || typeof o.amount === "bigint"); + }, + isSDK(o: any): o is QueryBalanceResponseSDKType { + return o && (o.$typeUrl === QueryBalanceResponse.typeUrl || typeof o.amount === "bigint"); + }, + isAmino(o: any): o is QueryBalanceResponseAmino { + return o && (o.$typeUrl === QueryBalanceResponse.typeUrl || typeof o.amount === "bigint"); + }, encode(message: QueryBalanceResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.amount !== BigInt(0)) { writer.uint32(8).uint64(message.amount); @@ -643,7 +663,8 @@ export const QueryBalanceResponse = { typeUrl: "/cosmos.nft.v1beta1.QueryBalanceResponse", value: QueryBalanceResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryOwnerRequest(): QueryOwnerRequest { return { @@ -660,6 +681,15 @@ function createBaseQueryOwnerRequest(): QueryOwnerRequest { export const QueryOwnerRequest = { typeUrl: "/cosmos.nft.v1beta1.QueryOwnerRequest", aminoType: "cosmos-sdk/QueryOwnerRequest", + is(o: any): o is QueryOwnerRequest { + return o && (o.$typeUrl === QueryOwnerRequest.typeUrl || typeof o.classId === "string" && typeof o.id === "string"); + }, + isSDK(o: any): o is QueryOwnerRequestSDKType { + return o && (o.$typeUrl === QueryOwnerRequest.typeUrl || typeof o.class_id === "string" && typeof o.id === "string"); + }, + isAmino(o: any): o is QueryOwnerRequestAmino { + return o && (o.$typeUrl === QueryOwnerRequest.typeUrl || typeof o.class_id === "string" && typeof o.id === "string"); + }, encode(message: QueryOwnerRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.classId !== "") { writer.uint32(10).string(message.classId); @@ -740,7 +770,8 @@ export const QueryOwnerRequest = { typeUrl: "/cosmos.nft.v1beta1.QueryOwnerRequest", value: QueryOwnerRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryOwnerResponse(): QueryOwnerResponse { return { @@ -756,6 +787,15 @@ function createBaseQueryOwnerResponse(): QueryOwnerResponse { export const QueryOwnerResponse = { typeUrl: "/cosmos.nft.v1beta1.QueryOwnerResponse", aminoType: "cosmos-sdk/QueryOwnerResponse", + is(o: any): o is QueryOwnerResponse { + return o && (o.$typeUrl === QueryOwnerResponse.typeUrl || typeof o.owner === "string"); + }, + isSDK(o: any): o is QueryOwnerResponseSDKType { + return o && (o.$typeUrl === QueryOwnerResponse.typeUrl || typeof o.owner === "string"); + }, + isAmino(o: any): o is QueryOwnerResponseAmino { + return o && (o.$typeUrl === QueryOwnerResponse.typeUrl || typeof o.owner === "string"); + }, encode(message: QueryOwnerResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.owner !== "") { writer.uint32(10).string(message.owner); @@ -822,7 +862,8 @@ export const QueryOwnerResponse = { typeUrl: "/cosmos.nft.v1beta1.QueryOwnerResponse", value: QueryOwnerResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQuerySupplyRequest(): QuerySupplyRequest { return { @@ -838,6 +879,15 @@ function createBaseQuerySupplyRequest(): QuerySupplyRequest { export const QuerySupplyRequest = { typeUrl: "/cosmos.nft.v1beta1.QuerySupplyRequest", aminoType: "cosmos-sdk/QuerySupplyRequest", + is(o: any): o is QuerySupplyRequest { + return o && (o.$typeUrl === QuerySupplyRequest.typeUrl || typeof o.classId === "string"); + }, + isSDK(o: any): o is QuerySupplyRequestSDKType { + return o && (o.$typeUrl === QuerySupplyRequest.typeUrl || typeof o.class_id === "string"); + }, + isAmino(o: any): o is QuerySupplyRequestAmino { + return o && (o.$typeUrl === QuerySupplyRequest.typeUrl || typeof o.class_id === "string"); + }, encode(message: QuerySupplyRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.classId !== "") { writer.uint32(10).string(message.classId); @@ -904,7 +954,8 @@ export const QuerySupplyRequest = { typeUrl: "/cosmos.nft.v1beta1.QuerySupplyRequest", value: QuerySupplyRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQuerySupplyResponse(): QuerySupplyResponse { return { @@ -920,6 +971,15 @@ function createBaseQuerySupplyResponse(): QuerySupplyResponse { export const QuerySupplyResponse = { typeUrl: "/cosmos.nft.v1beta1.QuerySupplyResponse", aminoType: "cosmos-sdk/QuerySupplyResponse", + is(o: any): o is QuerySupplyResponse { + return o && (o.$typeUrl === QuerySupplyResponse.typeUrl || typeof o.amount === "bigint"); + }, + isSDK(o: any): o is QuerySupplyResponseSDKType { + return o && (o.$typeUrl === QuerySupplyResponse.typeUrl || typeof o.amount === "bigint"); + }, + isAmino(o: any): o is QuerySupplyResponseAmino { + return o && (o.$typeUrl === QuerySupplyResponse.typeUrl || typeof o.amount === "bigint"); + }, encode(message: QuerySupplyResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.amount !== BigInt(0)) { writer.uint32(8).uint64(message.amount); @@ -988,7 +1048,8 @@ export const QuerySupplyResponse = { typeUrl: "/cosmos.nft.v1beta1.QuerySupplyResponse", value: QuerySupplyResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryNFTsRequest(): QueryNFTsRequest { return { @@ -1006,6 +1067,15 @@ function createBaseQueryNFTsRequest(): QueryNFTsRequest { export const QueryNFTsRequest = { typeUrl: "/cosmos.nft.v1beta1.QueryNFTsRequest", aminoType: "cosmos-sdk/QueryNFTsRequest", + is(o: any): o is QueryNFTsRequest { + return o && (o.$typeUrl === QueryNFTsRequest.typeUrl || typeof o.classId === "string" && typeof o.owner === "string"); + }, + isSDK(o: any): o is QueryNFTsRequestSDKType { + return o && (o.$typeUrl === QueryNFTsRequest.typeUrl || typeof o.class_id === "string" && typeof o.owner === "string"); + }, + isAmino(o: any): o is QueryNFTsRequestAmino { + return o && (o.$typeUrl === QueryNFTsRequest.typeUrl || typeof o.class_id === "string" && typeof o.owner === "string"); + }, encode(message: QueryNFTsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.classId !== "") { writer.uint32(10).string(message.classId); @@ -1102,6 +1172,12 @@ export const QueryNFTsRequest = { typeUrl: "/cosmos.nft.v1beta1.QueryNFTsRequest", value: QueryNFTsRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryNFTsRequest.typeUrl)) { + return; + } + PageRequest.registerTypeUrl(); } }; function createBaseQueryNFTsResponse(): QueryNFTsResponse { @@ -1119,6 +1195,15 @@ function createBaseQueryNFTsResponse(): QueryNFTsResponse { export const QueryNFTsResponse = { typeUrl: "/cosmos.nft.v1beta1.QueryNFTsResponse", aminoType: "cosmos-sdk/QueryNFTsResponse", + is(o: any): o is QueryNFTsResponse { + return o && (o.$typeUrl === QueryNFTsResponse.typeUrl || Array.isArray(o.nfts) && (!o.nfts.length || NFT.is(o.nfts[0]))); + }, + isSDK(o: any): o is QueryNFTsResponseSDKType { + return o && (o.$typeUrl === QueryNFTsResponse.typeUrl || Array.isArray(o.nfts) && (!o.nfts.length || NFT.isSDK(o.nfts[0]))); + }, + isAmino(o: any): o is QueryNFTsResponseAmino { + return o && (o.$typeUrl === QueryNFTsResponse.typeUrl || Array.isArray(o.nfts) && (!o.nfts.length || NFT.isAmino(o.nfts[0]))); + }, encode(message: QueryNFTsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.nfts) { NFT.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -1207,6 +1292,13 @@ export const QueryNFTsResponse = { typeUrl: "/cosmos.nft.v1beta1.QueryNFTsResponse", value: QueryNFTsResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryNFTsResponse.typeUrl)) { + return; + } + NFT.registerTypeUrl(); + PageResponse.registerTypeUrl(); } }; function createBaseQueryNFTRequest(): QueryNFTRequest { @@ -1224,6 +1316,15 @@ function createBaseQueryNFTRequest(): QueryNFTRequest { export const QueryNFTRequest = { typeUrl: "/cosmos.nft.v1beta1.QueryNFTRequest", aminoType: "cosmos-sdk/QueryNFTRequest", + is(o: any): o is QueryNFTRequest { + return o && (o.$typeUrl === QueryNFTRequest.typeUrl || typeof o.classId === "string" && typeof o.id === "string"); + }, + isSDK(o: any): o is QueryNFTRequestSDKType { + return o && (o.$typeUrl === QueryNFTRequest.typeUrl || typeof o.class_id === "string" && typeof o.id === "string"); + }, + isAmino(o: any): o is QueryNFTRequestAmino { + return o && (o.$typeUrl === QueryNFTRequest.typeUrl || typeof o.class_id === "string" && typeof o.id === "string"); + }, encode(message: QueryNFTRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.classId !== "") { writer.uint32(10).string(message.classId); @@ -1304,7 +1405,8 @@ export const QueryNFTRequest = { typeUrl: "/cosmos.nft.v1beta1.QueryNFTRequest", value: QueryNFTRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryNFTResponse(): QueryNFTResponse { return { @@ -1320,6 +1422,15 @@ function createBaseQueryNFTResponse(): QueryNFTResponse { export const QueryNFTResponse = { typeUrl: "/cosmos.nft.v1beta1.QueryNFTResponse", aminoType: "cosmos-sdk/QueryNFTResponse", + is(o: any): o is QueryNFTResponse { + return o && o.$typeUrl === QueryNFTResponse.typeUrl; + }, + isSDK(o: any): o is QueryNFTResponseSDKType { + return o && o.$typeUrl === QueryNFTResponse.typeUrl; + }, + isAmino(o: any): o is QueryNFTResponseAmino { + return o && o.$typeUrl === QueryNFTResponse.typeUrl; + }, encode(message: QueryNFTResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.nft !== undefined) { NFT.encode(message.nft, writer.uint32(10).fork()).ldelim(); @@ -1388,6 +1499,12 @@ export const QueryNFTResponse = { typeUrl: "/cosmos.nft.v1beta1.QueryNFTResponse", value: QueryNFTResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryNFTResponse.typeUrl)) { + return; + } + NFT.registerTypeUrl(); } }; function createBaseQueryClassRequest(): QueryClassRequest { @@ -1404,6 +1521,15 @@ function createBaseQueryClassRequest(): QueryClassRequest { export const QueryClassRequest = { typeUrl: "/cosmos.nft.v1beta1.QueryClassRequest", aminoType: "cosmos-sdk/QueryClassRequest", + is(o: any): o is QueryClassRequest { + return o && (o.$typeUrl === QueryClassRequest.typeUrl || typeof o.classId === "string"); + }, + isSDK(o: any): o is QueryClassRequestSDKType { + return o && (o.$typeUrl === QueryClassRequest.typeUrl || typeof o.class_id === "string"); + }, + isAmino(o: any): o is QueryClassRequestAmino { + return o && (o.$typeUrl === QueryClassRequest.typeUrl || typeof o.class_id === "string"); + }, encode(message: QueryClassRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.classId !== "") { writer.uint32(10).string(message.classId); @@ -1470,7 +1596,8 @@ export const QueryClassRequest = { typeUrl: "/cosmos.nft.v1beta1.QueryClassRequest", value: QueryClassRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryClassResponse(): QueryClassResponse { return { @@ -1486,6 +1613,15 @@ function createBaseQueryClassResponse(): QueryClassResponse { export const QueryClassResponse = { typeUrl: "/cosmos.nft.v1beta1.QueryClassResponse", aminoType: "cosmos-sdk/QueryClassResponse", + is(o: any): o is QueryClassResponse { + return o && o.$typeUrl === QueryClassResponse.typeUrl; + }, + isSDK(o: any): o is QueryClassResponseSDKType { + return o && o.$typeUrl === QueryClassResponse.typeUrl; + }, + isAmino(o: any): o is QueryClassResponseAmino { + return o && o.$typeUrl === QueryClassResponse.typeUrl; + }, encode(message: QueryClassResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.class !== undefined) { Class.encode(message.class, writer.uint32(10).fork()).ldelim(); @@ -1554,6 +1690,12 @@ export const QueryClassResponse = { typeUrl: "/cosmos.nft.v1beta1.QueryClassResponse", value: QueryClassResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryClassResponse.typeUrl)) { + return; + } + Class.registerTypeUrl(); } }; function createBaseQueryClassesRequest(): QueryClassesRequest { @@ -1570,6 +1712,15 @@ function createBaseQueryClassesRequest(): QueryClassesRequest { export const QueryClassesRequest = { typeUrl: "/cosmos.nft.v1beta1.QueryClassesRequest", aminoType: "cosmos-sdk/QueryClassesRequest", + is(o: any): o is QueryClassesRequest { + return o && o.$typeUrl === QueryClassesRequest.typeUrl; + }, + isSDK(o: any): o is QueryClassesRequestSDKType { + return o && o.$typeUrl === QueryClassesRequest.typeUrl; + }, + isAmino(o: any): o is QueryClassesRequestAmino { + return o && o.$typeUrl === QueryClassesRequest.typeUrl; + }, encode(message: QueryClassesRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.pagination !== undefined) { PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); @@ -1638,6 +1789,12 @@ export const QueryClassesRequest = { typeUrl: "/cosmos.nft.v1beta1.QueryClassesRequest", value: QueryClassesRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryClassesRequest.typeUrl)) { + return; + } + PageRequest.registerTypeUrl(); } }; function createBaseQueryClassesResponse(): QueryClassesResponse { @@ -1655,6 +1812,15 @@ function createBaseQueryClassesResponse(): QueryClassesResponse { export const QueryClassesResponse = { typeUrl: "/cosmos.nft.v1beta1.QueryClassesResponse", aminoType: "cosmos-sdk/QueryClassesResponse", + is(o: any): o is QueryClassesResponse { + return o && (o.$typeUrl === QueryClassesResponse.typeUrl || Array.isArray(o.classes) && (!o.classes.length || Class.is(o.classes[0]))); + }, + isSDK(o: any): o is QueryClassesResponseSDKType { + return o && (o.$typeUrl === QueryClassesResponse.typeUrl || Array.isArray(o.classes) && (!o.classes.length || Class.isSDK(o.classes[0]))); + }, + isAmino(o: any): o is QueryClassesResponseAmino { + return o && (o.$typeUrl === QueryClassesResponse.typeUrl || Array.isArray(o.classes) && (!o.classes.length || Class.isAmino(o.classes[0]))); + }, encode(message: QueryClassesResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.classes) { Class.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -1743,5 +1909,12 @@ export const QueryClassesResponse = { typeUrl: "/cosmos.nft.v1beta1.QueryClassesResponse", value: QueryClassesResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryClassesResponse.typeUrl)) { + return; + } + Class.registerTypeUrl(); + PageResponse.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/cosmos/nft/v1beta1/tx.registry.ts b/__fixtures__/v-next/outputv3/cosmos/nft/v1beta1/tx.registry.ts index dd47464598..23f67afb51 100644 --- a/__fixtures__/v-next/outputv3/cosmos/nft/v1beta1/tx.registry.ts +++ b/__fixtures__/v-next/outputv3/cosmos/nft/v1beta1/tx.registry.ts @@ -1,11 +1,6 @@ -import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { TelescopeGeneratedType } from "../../../types"; import { MsgSend, MsgSendSDKType } from "./tx"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/cosmos.nft.v1beta1.MsgSend", MsgSend]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/cosmos.nft.v1beta1.MsgSend", MsgSend]]; export const MessageComposer = { encoded: { send(value: MsgSend) { diff --git a/__fixtures__/v-next/outputv3/cosmos/nft/v1beta1/tx.rpc.func.ts b/__fixtures__/v-next/outputv3/cosmos/nft/v1beta1/tx.rpc.func.ts new file mode 100644 index 0000000000..770b6c79e4 --- /dev/null +++ b/__fixtures__/v-next/outputv3/cosmos/nft/v1beta1/tx.rpc.func.ts @@ -0,0 +1,11 @@ +import { buildTx } from "../../../helper-func-types"; +import { MsgSend, MsgSendSDKType, MsgSendResponse, MsgSendResponseSDKType } from "./tx"; +/** + * Send defines a method to send a nft from one account to another account. + * @name send + * @package cosmos.nft.v1beta1 + * @see proto service: cosmos.nft.v1beta1.Send + */ +export const send = buildTx({ + msg: MsgSend +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/cosmos/nft/v1beta1/tx.ts b/__fixtures__/v-next/outputv3/cosmos/nft/v1beta1/tx.ts index 1eca5f8ecd..727892885a 100644 --- a/__fixtures__/v-next/outputv3/cosmos/nft/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputv3/cosmos/nft/v1beta1/tx.ts @@ -107,6 +107,15 @@ function createBaseMsgSend(): MsgSend { export const MsgSend = { typeUrl: "/cosmos.nft.v1beta1.MsgSend", aminoType: "cosmos-sdk/MsgNFTSend", + is(o: any): o is MsgSend { + return o && (o.$typeUrl === MsgSend.typeUrl || typeof o.classId === "string" && typeof o.id === "string" && typeof o.sender === "string" && typeof o.receiver === "string"); + }, + isSDK(o: any): o is MsgSendSDKType { + return o && (o.$typeUrl === MsgSend.typeUrl || typeof o.class_id === "string" && typeof o.id === "string" && typeof o.sender === "string" && typeof o.receiver === "string"); + }, + isAmino(o: any): o is MsgSendAmino { + return o && (o.$typeUrl === MsgSend.typeUrl || typeof o.class_id === "string" && typeof o.id === "string" && typeof o.sender === "string" && typeof o.receiver === "string"); + }, encode(message: MsgSend, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.classId !== "") { writer.uint32(10).string(message.classId); @@ -215,7 +224,8 @@ export const MsgSend = { typeUrl: "/cosmos.nft.v1beta1.MsgSend", value: MsgSend.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgSendResponse(): MsgSendResponse { return {}; @@ -229,6 +239,15 @@ function createBaseMsgSendResponse(): MsgSendResponse { export const MsgSendResponse = { typeUrl: "/cosmos.nft.v1beta1.MsgSendResponse", aminoType: "cosmos-sdk/MsgSendResponse", + is(o: any): o is MsgSendResponse { + return o && o.$typeUrl === MsgSendResponse.typeUrl; + }, + isSDK(o: any): o is MsgSendResponseSDKType { + return o && o.$typeUrl === MsgSendResponse.typeUrl; + }, + isAmino(o: any): o is MsgSendResponseAmino { + return o && o.$typeUrl === MsgSendResponse.typeUrl; + }, encode(_: MsgSendResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -280,5 +299,6 @@ export const MsgSendResponse = { typeUrl: "/cosmos.nft.v1beta1.MsgSendResponse", value: MsgSendResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/cosmos/orm/module/v1alpha1/module.ts b/__fixtures__/v-next/outputv3/cosmos/orm/module/v1alpha1/module.ts index f438c22d7d..2e6b843f77 100644 --- a/__fixtures__/v-next/outputv3/cosmos/orm/module/v1alpha1/module.ts +++ b/__fixtures__/v-next/outputv3/cosmos/orm/module/v1alpha1/module.ts @@ -46,6 +46,15 @@ function createBaseModule(): Module { export const Module = { typeUrl: "/cosmos.orm.module.v1alpha1.Module", aminoType: "cosmos-sdk/Module", + is(o: any): o is Module { + return o && o.$typeUrl === Module.typeUrl; + }, + isSDK(o: any): o is ModuleSDKType { + return o && o.$typeUrl === Module.typeUrl; + }, + isAmino(o: any): o is ModuleAmino { + return o && o.$typeUrl === Module.typeUrl; + }, encode(_: Module, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -97,5 +106,6 @@ export const Module = { typeUrl: "/cosmos.orm.module.v1alpha1.Module", value: Module.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/cosmos/orm/v1/orm.ts b/__fixtures__/v-next/outputv3/cosmos/orm/v1/orm.ts index 748d81cab8..615701479d 100644 --- a/__fixtures__/v-next/outputv3/cosmos/orm/v1/orm.ts +++ b/__fixtures__/v-next/outputv3/cosmos/orm/v1/orm.ts @@ -1,4 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; +import { GlobalDecoderRegistry } from "../../../registry"; import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "cosmos.orm.v1"; /** @@ -300,6 +301,15 @@ function createBaseTableDescriptor(): TableDescriptor { export const TableDescriptor = { typeUrl: "/cosmos.orm.v1.TableDescriptor", aminoType: "cosmos-sdk/TableDescriptor", + is(o: any): o is TableDescriptor { + return o && (o.$typeUrl === TableDescriptor.typeUrl || Array.isArray(o.index) && (!o.index.length || SecondaryIndexDescriptor.is(o.index[0])) && typeof o.id === "number"); + }, + isSDK(o: any): o is TableDescriptorSDKType { + return o && (o.$typeUrl === TableDescriptor.typeUrl || Array.isArray(o.index) && (!o.index.length || SecondaryIndexDescriptor.isSDK(o.index[0])) && typeof o.id === "number"); + }, + isAmino(o: any): o is TableDescriptorAmino { + return o && (o.$typeUrl === TableDescriptor.typeUrl || Array.isArray(o.index) && (!o.index.length || SecondaryIndexDescriptor.isAmino(o.index[0])) && typeof o.id === "number"); + }, encode(message: TableDescriptor, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.primaryKey !== undefined) { PrimaryKeyDescriptor.encode(message.primaryKey, writer.uint32(10).fork()).ldelim(); @@ -402,6 +412,13 @@ export const TableDescriptor = { typeUrl: "/cosmos.orm.v1.TableDescriptor", value: TableDescriptor.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(TableDescriptor.typeUrl)) { + return; + } + PrimaryKeyDescriptor.registerTypeUrl(); + SecondaryIndexDescriptor.registerTypeUrl(); } }; function createBasePrimaryKeyDescriptor(): PrimaryKeyDescriptor { @@ -419,6 +436,15 @@ function createBasePrimaryKeyDescriptor(): PrimaryKeyDescriptor { export const PrimaryKeyDescriptor = { typeUrl: "/cosmos.orm.v1.PrimaryKeyDescriptor", aminoType: "cosmos-sdk/PrimaryKeyDescriptor", + is(o: any): o is PrimaryKeyDescriptor { + return o && (o.$typeUrl === PrimaryKeyDescriptor.typeUrl || typeof o.fields === "string" && typeof o.autoIncrement === "boolean"); + }, + isSDK(o: any): o is PrimaryKeyDescriptorSDKType { + return o && (o.$typeUrl === PrimaryKeyDescriptor.typeUrl || typeof o.fields === "string" && typeof o.auto_increment === "boolean"); + }, + isAmino(o: any): o is PrimaryKeyDescriptorAmino { + return o && (o.$typeUrl === PrimaryKeyDescriptor.typeUrl || typeof o.fields === "string" && typeof o.auto_increment === "boolean"); + }, encode(message: PrimaryKeyDescriptor, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.fields !== "") { writer.uint32(10).string(message.fields); @@ -499,7 +525,8 @@ export const PrimaryKeyDescriptor = { typeUrl: "/cosmos.orm.v1.PrimaryKeyDescriptor", value: PrimaryKeyDescriptor.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseSecondaryIndexDescriptor(): SecondaryIndexDescriptor { return { @@ -517,6 +544,15 @@ function createBaseSecondaryIndexDescriptor(): SecondaryIndexDescriptor { export const SecondaryIndexDescriptor = { typeUrl: "/cosmos.orm.v1.SecondaryIndexDescriptor", aminoType: "cosmos-sdk/SecondaryIndexDescriptor", + is(o: any): o is SecondaryIndexDescriptor { + return o && (o.$typeUrl === SecondaryIndexDescriptor.typeUrl || typeof o.fields === "string" && typeof o.id === "number" && typeof o.unique === "boolean"); + }, + isSDK(o: any): o is SecondaryIndexDescriptorSDKType { + return o && (o.$typeUrl === SecondaryIndexDescriptor.typeUrl || typeof o.fields === "string" && typeof o.id === "number" && typeof o.unique === "boolean"); + }, + isAmino(o: any): o is SecondaryIndexDescriptorAmino { + return o && (o.$typeUrl === SecondaryIndexDescriptor.typeUrl || typeof o.fields === "string" && typeof o.id === "number" && typeof o.unique === "boolean"); + }, encode(message: SecondaryIndexDescriptor, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.fields !== "") { writer.uint32(10).string(message.fields); @@ -611,7 +647,8 @@ export const SecondaryIndexDescriptor = { typeUrl: "/cosmos.orm.v1.SecondaryIndexDescriptor", value: SecondaryIndexDescriptor.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseSingletonDescriptor(): SingletonDescriptor { return { @@ -627,6 +664,15 @@ function createBaseSingletonDescriptor(): SingletonDescriptor { export const SingletonDescriptor = { typeUrl: "/cosmos.orm.v1.SingletonDescriptor", aminoType: "cosmos-sdk/SingletonDescriptor", + is(o: any): o is SingletonDescriptor { + return o && (o.$typeUrl === SingletonDescriptor.typeUrl || typeof o.id === "number"); + }, + isSDK(o: any): o is SingletonDescriptorSDKType { + return o && (o.$typeUrl === SingletonDescriptor.typeUrl || typeof o.id === "number"); + }, + isAmino(o: any): o is SingletonDescriptorAmino { + return o && (o.$typeUrl === SingletonDescriptor.typeUrl || typeof o.id === "number"); + }, encode(message: SingletonDescriptor, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.id !== 0) { writer.uint32(8).uint32(message.id); @@ -693,5 +739,6 @@ export const SingletonDescriptor = { typeUrl: "/cosmos.orm.v1.SingletonDescriptor", value: SingletonDescriptor.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/cosmos/orm/v1alpha1/schema.ts b/__fixtures__/v-next/outputv3/cosmos/orm/v1alpha1/schema.ts index b24837b503..534fd34de4 100644 --- a/__fixtures__/v-next/outputv3/cosmos/orm/v1alpha1/schema.ts +++ b/__fixtures__/v-next/outputv3/cosmos/orm/v1alpha1/schema.ts @@ -1,5 +1,6 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; import { isSet, bytesFromBase64, DeepPartial, base64FromBytes } from "../../../helpers"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "cosmos.orm.v1alpha1"; /** StorageType */ export enum StorageType { @@ -208,6 +209,15 @@ function createBaseModuleSchemaDescriptor(): ModuleSchemaDescriptor { export const ModuleSchemaDescriptor = { typeUrl: "/cosmos.orm.v1alpha1.ModuleSchemaDescriptor", aminoType: "cosmos-sdk/ModuleSchemaDescriptor", + is(o: any): o is ModuleSchemaDescriptor { + return o && (o.$typeUrl === ModuleSchemaDescriptor.typeUrl || Array.isArray(o.schemaFile) && (!o.schemaFile.length || ModuleSchemaDescriptor_FileEntry.is(o.schemaFile[0])) && (o.prefix instanceof Uint8Array || typeof o.prefix === "string")); + }, + isSDK(o: any): o is ModuleSchemaDescriptorSDKType { + return o && (o.$typeUrl === ModuleSchemaDescriptor.typeUrl || Array.isArray(o.schema_file) && (!o.schema_file.length || ModuleSchemaDescriptor_FileEntry.isSDK(o.schema_file[0])) && (o.prefix instanceof Uint8Array || typeof o.prefix === "string")); + }, + isAmino(o: any): o is ModuleSchemaDescriptorAmino { + return o && (o.$typeUrl === ModuleSchemaDescriptor.typeUrl || Array.isArray(o.schema_file) && (!o.schema_file.length || ModuleSchemaDescriptor_FileEntry.isAmino(o.schema_file[0])) && (o.prefix instanceof Uint8Array || typeof o.prefix === "string")); + }, encode(message: ModuleSchemaDescriptor, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.schemaFile) { ModuleSchemaDescriptor_FileEntry.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -294,6 +304,12 @@ export const ModuleSchemaDescriptor = { typeUrl: "/cosmos.orm.v1alpha1.ModuleSchemaDescriptor", value: ModuleSchemaDescriptor.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ModuleSchemaDescriptor.typeUrl)) { + return; + } + ModuleSchemaDescriptor_FileEntry.registerTypeUrl(); } }; function createBaseModuleSchemaDescriptor_FileEntry(): ModuleSchemaDescriptor_FileEntry { @@ -312,6 +328,15 @@ function createBaseModuleSchemaDescriptor_FileEntry(): ModuleSchemaDescriptor_Fi export const ModuleSchemaDescriptor_FileEntry = { typeUrl: "/cosmos.orm.v1alpha1.FileEntry", aminoType: "cosmos-sdk/FileEntry", + is(o: any): o is ModuleSchemaDescriptor_FileEntry { + return o && (o.$typeUrl === ModuleSchemaDescriptor_FileEntry.typeUrl || typeof o.id === "number" && typeof o.protoFileName === "string" && isSet(o.storageType)); + }, + isSDK(o: any): o is ModuleSchemaDescriptor_FileEntrySDKType { + return o && (o.$typeUrl === ModuleSchemaDescriptor_FileEntry.typeUrl || typeof o.id === "number" && typeof o.proto_file_name === "string" && isSet(o.storage_type)); + }, + isAmino(o: any): o is ModuleSchemaDescriptor_FileEntryAmino { + return o && (o.$typeUrl === ModuleSchemaDescriptor_FileEntry.typeUrl || typeof o.id === "number" && typeof o.proto_file_name === "string" && isSet(o.storage_type)); + }, encode(message: ModuleSchemaDescriptor_FileEntry, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.id !== 0) { writer.uint32(8).uint32(message.id); @@ -406,5 +431,6 @@ export const ModuleSchemaDescriptor_FileEntry = { typeUrl: "/cosmos.orm.v1alpha1.FileEntry", value: ModuleSchemaDescriptor_FileEntry.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/cosmos/params/v1beta1/params.ts b/__fixtures__/v-next/outputv3/cosmos/params/v1beta1/params.ts index 0f5c6a3600..971c727d6c 100644 --- a/__fixtures__/v-next/outputv3/cosmos/params/v1beta1/params.ts +++ b/__fixtures__/v-next/outputv3/cosmos/params/v1beta1/params.ts @@ -1,5 +1,6 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; import { isSet, DeepPartial } from "../../../helpers"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "cosmos.params.v1beta1"; /** * ParameterChangeProposal defines a proposal to change one or more parameters. @@ -94,6 +95,15 @@ function createBaseParameterChangeProposal(): ParameterChangeProposal { export const ParameterChangeProposal = { typeUrl: "/cosmos.params.v1beta1.ParameterChangeProposal", aminoType: "cosmos-sdk/ParameterChangeProposal", + is(o: any): o is ParameterChangeProposal { + return o && (o.$typeUrl === ParameterChangeProposal.typeUrl || typeof o.title === "string" && typeof o.description === "string" && Array.isArray(o.changes) && (!o.changes.length || ParamChange.is(o.changes[0]))); + }, + isSDK(o: any): o is ParameterChangeProposalSDKType { + return o && (o.$typeUrl === ParameterChangeProposal.typeUrl || typeof o.title === "string" && typeof o.description === "string" && Array.isArray(o.changes) && (!o.changes.length || ParamChange.isSDK(o.changes[0]))); + }, + isAmino(o: any): o is ParameterChangeProposalAmino { + return o && (o.$typeUrl === ParameterChangeProposal.typeUrl || typeof o.title === "string" && typeof o.description === "string" && Array.isArray(o.changes) && (!o.changes.length || ParamChange.isAmino(o.changes[0]))); + }, encode(message: ParameterChangeProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.title !== "") { writer.uint32(10).string(message.title); @@ -194,6 +204,12 @@ export const ParameterChangeProposal = { typeUrl: "/cosmos.params.v1beta1.ParameterChangeProposal", value: ParameterChangeProposal.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ParameterChangeProposal.typeUrl)) { + return; + } + ParamChange.registerTypeUrl(); } }; function createBaseParamChange(): ParamChange { @@ -213,6 +229,15 @@ function createBaseParamChange(): ParamChange { export const ParamChange = { typeUrl: "/cosmos.params.v1beta1.ParamChange", aminoType: "cosmos-sdk/ParamChange", + is(o: any): o is ParamChange { + return o && (o.$typeUrl === ParamChange.typeUrl || typeof o.subspace === "string" && typeof o.key === "string" && typeof o.value === "string"); + }, + isSDK(o: any): o is ParamChangeSDKType { + return o && (o.$typeUrl === ParamChange.typeUrl || typeof o.subspace === "string" && typeof o.key === "string" && typeof o.value === "string"); + }, + isAmino(o: any): o is ParamChangeAmino { + return o && (o.$typeUrl === ParamChange.typeUrl || typeof o.subspace === "string" && typeof o.key === "string" && typeof o.value === "string"); + }, encode(message: ParamChange, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.subspace !== "") { writer.uint32(10).string(message.subspace); @@ -307,5 +332,6 @@ export const ParamChange = { typeUrl: "/cosmos.params.v1beta1.ParamChange", value: ParamChange.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/cosmos/params/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputv3/cosmos/params/v1beta1/query.rpc.func.ts new file mode 100644 index 0000000000..a60b8fc1cd --- /dev/null +++ b/__fixtures__/v-next/outputv3/cosmos/params/v1beta1/query.rpc.func.ts @@ -0,0 +1,30 @@ +import { ParamChange, ParamChangeSDKType } from "./params"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, QuerySubspacesRequest, QuerySubspacesRequestSDKType, QuerySubspacesResponse, QuerySubspacesResponseSDKType } from "./query"; +/** + * Params queries a specific parameter of a module, given its subspace and + * key. + * @name getParams + * @package cosmos.params.v1beta1 + * @see proto service: cosmos.params.v1beta1.Params + */ +export const getParams = buildQuery({ + encode: QueryParamsRequest.encode, + decode: QueryParamsResponse.decode, + service: "cosmos.params.v1beta1.Query", + method: "Params", + deps: [QueryParamsRequest, QueryParamsResponse] +}); +/** + * Subspaces queries for all registered subspaces and all keys for a subspace. + * @name getSubspaces + * @package cosmos.params.v1beta1 + * @see proto service: cosmos.params.v1beta1.Subspaces + */ +export const getSubspaces = buildQuery({ + encode: QuerySubspacesRequest.encode, + decode: QuerySubspacesResponse.decode, + service: "cosmos.params.v1beta1.Query", + method: "Subspaces", + deps: [QuerySubspacesRequest, QuerySubspacesResponse] +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/cosmos/params/v1beta1/query.ts b/__fixtures__/v-next/outputv3/cosmos/params/v1beta1/query.ts index 0a88e66ed5..4fe6e0fe13 100644 --- a/__fixtures__/v-next/outputv3/cosmos/params/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv3/cosmos/params/v1beta1/query.ts @@ -1,6 +1,7 @@ import { ParamChange, ParamChangeAmino, ParamChangeSDKType } from "./params"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { isSet, DeepPartial } from "../../../helpers"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "cosmos.params.v1beta1"; /** * QueryParamsRequest is request type for the Query/Params RPC method. @@ -199,6 +200,15 @@ function createBaseQueryParamsRequest(): QueryParamsRequest { export const QueryParamsRequest = { typeUrl: "/cosmos.params.v1beta1.QueryParamsRequest", aminoType: "cosmos-sdk/QueryParamsRequest", + is(o: any): o is QueryParamsRequest { + return o && (o.$typeUrl === QueryParamsRequest.typeUrl || typeof o.subspace === "string" && typeof o.key === "string"); + }, + isSDK(o: any): o is QueryParamsRequestSDKType { + return o && (o.$typeUrl === QueryParamsRequest.typeUrl || typeof o.subspace === "string" && typeof o.key === "string"); + }, + isAmino(o: any): o is QueryParamsRequestAmino { + return o && (o.$typeUrl === QueryParamsRequest.typeUrl || typeof o.subspace === "string" && typeof o.key === "string"); + }, encode(message: QueryParamsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.subspace !== "") { writer.uint32(10).string(message.subspace); @@ -279,7 +289,8 @@ export const QueryParamsRequest = { typeUrl: "/cosmos.params.v1beta1.QueryParamsRequest", value: QueryParamsRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryParamsResponse(): QueryParamsResponse { return { @@ -295,6 +306,15 @@ function createBaseQueryParamsResponse(): QueryParamsResponse { export const QueryParamsResponse = { typeUrl: "/cosmos.params.v1beta1.QueryParamsResponse", aminoType: "cosmos-sdk/QueryParamsResponse", + is(o: any): o is QueryParamsResponse { + return o && (o.$typeUrl === QueryParamsResponse.typeUrl || ParamChange.is(o.param)); + }, + isSDK(o: any): o is QueryParamsResponseSDKType { + return o && (o.$typeUrl === QueryParamsResponse.typeUrl || ParamChange.isSDK(o.param)); + }, + isAmino(o: any): o is QueryParamsResponseAmino { + return o && (o.$typeUrl === QueryParamsResponse.typeUrl || ParamChange.isAmino(o.param)); + }, encode(message: QueryParamsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.param !== undefined) { ParamChange.encode(message.param, writer.uint32(10).fork()).ldelim(); @@ -363,6 +383,12 @@ export const QueryParamsResponse = { typeUrl: "/cosmos.params.v1beta1.QueryParamsResponse", value: QueryParamsResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryParamsResponse.typeUrl)) { + return; + } + ParamChange.registerTypeUrl(); } }; function createBaseQuerySubspacesRequest(): QuerySubspacesRequest { @@ -378,6 +404,15 @@ function createBaseQuerySubspacesRequest(): QuerySubspacesRequest { export const QuerySubspacesRequest = { typeUrl: "/cosmos.params.v1beta1.QuerySubspacesRequest", aminoType: "cosmos-sdk/QuerySubspacesRequest", + is(o: any): o is QuerySubspacesRequest { + return o && o.$typeUrl === QuerySubspacesRequest.typeUrl; + }, + isSDK(o: any): o is QuerySubspacesRequestSDKType { + return o && o.$typeUrl === QuerySubspacesRequest.typeUrl; + }, + isAmino(o: any): o is QuerySubspacesRequestAmino { + return o && o.$typeUrl === QuerySubspacesRequest.typeUrl; + }, encode(_: QuerySubspacesRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -429,7 +464,8 @@ export const QuerySubspacesRequest = { typeUrl: "/cosmos.params.v1beta1.QuerySubspacesRequest", value: QuerySubspacesRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQuerySubspacesResponse(): QuerySubspacesResponse { return { @@ -446,6 +482,15 @@ function createBaseQuerySubspacesResponse(): QuerySubspacesResponse { export const QuerySubspacesResponse = { typeUrl: "/cosmos.params.v1beta1.QuerySubspacesResponse", aminoType: "cosmos-sdk/QuerySubspacesResponse", + is(o: any): o is QuerySubspacesResponse { + return o && (o.$typeUrl === QuerySubspacesResponse.typeUrl || Array.isArray(o.subspaces) && (!o.subspaces.length || Subspace.is(o.subspaces[0]))); + }, + isSDK(o: any): o is QuerySubspacesResponseSDKType { + return o && (o.$typeUrl === QuerySubspacesResponse.typeUrl || Array.isArray(o.subspaces) && (!o.subspaces.length || Subspace.isSDK(o.subspaces[0]))); + }, + isAmino(o: any): o is QuerySubspacesResponseAmino { + return o && (o.$typeUrl === QuerySubspacesResponse.typeUrl || Array.isArray(o.subspaces) && (!o.subspaces.length || Subspace.isAmino(o.subspaces[0]))); + }, encode(message: QuerySubspacesResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.subspaces) { Subspace.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -518,6 +563,12 @@ export const QuerySubspacesResponse = { typeUrl: "/cosmos.params.v1beta1.QuerySubspacesResponse", value: QuerySubspacesResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QuerySubspacesResponse.typeUrl)) { + return; + } + Subspace.registerTypeUrl(); } }; function createBaseSubspace(): Subspace { @@ -536,6 +587,15 @@ function createBaseSubspace(): Subspace { export const Subspace = { typeUrl: "/cosmos.params.v1beta1.Subspace", aminoType: "cosmos-sdk/Subspace", + is(o: any): o is Subspace { + return o && (o.$typeUrl === Subspace.typeUrl || typeof o.subspace === "string" && Array.isArray(o.keys) && (!o.keys.length || typeof o.keys[0] === "string")); + }, + isSDK(o: any): o is SubspaceSDKType { + return o && (o.$typeUrl === Subspace.typeUrl || typeof o.subspace === "string" && Array.isArray(o.keys) && (!o.keys.length || typeof o.keys[0] === "string")); + }, + isAmino(o: any): o is SubspaceAmino { + return o && (o.$typeUrl === Subspace.typeUrl || typeof o.subspace === "string" && Array.isArray(o.keys) && (!o.keys.length || typeof o.keys[0] === "string")); + }, encode(message: Subspace, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.subspace !== "") { writer.uint32(10).string(message.subspace); @@ -622,5 +682,6 @@ export const Subspace = { typeUrl: "/cosmos.params.v1beta1.Subspace", value: Subspace.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/cosmos/slashing/v1beta1/genesis.ts b/__fixtures__/v-next/outputv3/cosmos/slashing/v1beta1/genesis.ts index cbe6f7943d..cf23e4f430 100644 --- a/__fixtures__/v-next/outputv3/cosmos/slashing/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv3/cosmos/slashing/v1beta1/genesis.ts @@ -1,5 +1,6 @@ import { Params, ParamsAmino, ParamsSDKType, ValidatorSigningInfo, ValidatorSigningInfoAmino, ValidatorSigningInfoSDKType } from "./slashing"; import { BinaryReader, BinaryWriter } from "../../../binary"; +import { GlobalDecoderRegistry } from "../../../registry"; import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "cosmos.slashing.v1beta1"; /** @@ -218,6 +219,15 @@ function createBaseGenesisState(): GenesisState { export const GenesisState = { typeUrl: "/cosmos.slashing.v1beta1.GenesisState", aminoType: "cosmos-sdk/GenesisState", + is(o: any): o is GenesisState { + return o && (o.$typeUrl === GenesisState.typeUrl || Params.is(o.params) && Array.isArray(o.signingInfos) && (!o.signingInfos.length || SigningInfo.is(o.signingInfos[0])) && Array.isArray(o.missedBlocks) && (!o.missedBlocks.length || ValidatorMissedBlocks.is(o.missedBlocks[0]))); + }, + isSDK(o: any): o is GenesisStateSDKType { + return o && (o.$typeUrl === GenesisState.typeUrl || Params.isSDK(o.params) && Array.isArray(o.signing_infos) && (!o.signing_infos.length || SigningInfo.isSDK(o.signing_infos[0])) && Array.isArray(o.missed_blocks) && (!o.missed_blocks.length || ValidatorMissedBlocks.isSDK(o.missed_blocks[0]))); + }, + isAmino(o: any): o is GenesisStateAmino { + return o && (o.$typeUrl === GenesisState.typeUrl || Params.isAmino(o.params) && Array.isArray(o.signing_infos) && (!o.signing_infos.length || SigningInfo.isAmino(o.signing_infos[0])) && Array.isArray(o.missed_blocks) && (!o.missed_blocks.length || ValidatorMissedBlocks.isAmino(o.missed_blocks[0]))); + }, encode(message: GenesisState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.params !== undefined) { Params.encode(message.params, writer.uint32(10).fork()).ldelim(); @@ -326,6 +336,14 @@ export const GenesisState = { typeUrl: "/cosmos.slashing.v1beta1.GenesisState", value: GenesisState.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GenesisState.typeUrl)) { + return; + } + Params.registerTypeUrl(); + SigningInfo.registerTypeUrl(); + ValidatorMissedBlocks.registerTypeUrl(); } }; function createBaseSigningInfo(): SigningInfo { @@ -343,6 +361,15 @@ function createBaseSigningInfo(): SigningInfo { export const SigningInfo = { typeUrl: "/cosmos.slashing.v1beta1.SigningInfo", aminoType: "cosmos-sdk/SigningInfo", + is(o: any): o is SigningInfo { + return o && (o.$typeUrl === SigningInfo.typeUrl || typeof o.address === "string" && ValidatorSigningInfo.is(o.validatorSigningInfo)); + }, + isSDK(o: any): o is SigningInfoSDKType { + return o && (o.$typeUrl === SigningInfo.typeUrl || typeof o.address === "string" && ValidatorSigningInfo.isSDK(o.validator_signing_info)); + }, + isAmino(o: any): o is SigningInfoAmino { + return o && (o.$typeUrl === SigningInfo.typeUrl || typeof o.address === "string" && ValidatorSigningInfo.isAmino(o.validator_signing_info)); + }, encode(message: SigningInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.address !== "") { writer.uint32(10).string(message.address); @@ -425,6 +452,12 @@ export const SigningInfo = { typeUrl: "/cosmos.slashing.v1beta1.SigningInfo", value: SigningInfo.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(SigningInfo.typeUrl)) { + return; + } + ValidatorSigningInfo.registerTypeUrl(); } }; function createBaseValidatorMissedBlocks(): ValidatorMissedBlocks { @@ -443,6 +476,15 @@ function createBaseValidatorMissedBlocks(): ValidatorMissedBlocks { export const ValidatorMissedBlocks = { typeUrl: "/cosmos.slashing.v1beta1.ValidatorMissedBlocks", aminoType: "cosmos-sdk/ValidatorMissedBlocks", + is(o: any): o is ValidatorMissedBlocks { + return o && (o.$typeUrl === ValidatorMissedBlocks.typeUrl || typeof o.address === "string" && Array.isArray(o.missedBlocks) && (!o.missedBlocks.length || MissedBlock.is(o.missedBlocks[0]))); + }, + isSDK(o: any): o is ValidatorMissedBlocksSDKType { + return o && (o.$typeUrl === ValidatorMissedBlocks.typeUrl || typeof o.address === "string" && Array.isArray(o.missed_blocks) && (!o.missed_blocks.length || MissedBlock.isSDK(o.missed_blocks[0]))); + }, + isAmino(o: any): o is ValidatorMissedBlocksAmino { + return o && (o.$typeUrl === ValidatorMissedBlocks.typeUrl || typeof o.address === "string" && Array.isArray(o.missed_blocks) && (!o.missed_blocks.length || MissedBlock.isAmino(o.missed_blocks[0]))); + }, encode(message: ValidatorMissedBlocks, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.address !== "") { writer.uint32(10).string(message.address); @@ -529,6 +571,12 @@ export const ValidatorMissedBlocks = { typeUrl: "/cosmos.slashing.v1beta1.ValidatorMissedBlocks", value: ValidatorMissedBlocks.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ValidatorMissedBlocks.typeUrl)) { + return; + } + MissedBlock.registerTypeUrl(); } }; function createBaseMissedBlock(): MissedBlock { @@ -546,6 +594,15 @@ function createBaseMissedBlock(): MissedBlock { export const MissedBlock = { typeUrl: "/cosmos.slashing.v1beta1.MissedBlock", aminoType: "cosmos-sdk/MissedBlock", + is(o: any): o is MissedBlock { + return o && (o.$typeUrl === MissedBlock.typeUrl || typeof o.index === "bigint" && typeof o.missed === "boolean"); + }, + isSDK(o: any): o is MissedBlockSDKType { + return o && (o.$typeUrl === MissedBlock.typeUrl || typeof o.index === "bigint" && typeof o.missed === "boolean"); + }, + isAmino(o: any): o is MissedBlockAmino { + return o && (o.$typeUrl === MissedBlock.typeUrl || typeof o.index === "bigint" && typeof o.missed === "boolean"); + }, encode(message: MissedBlock, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.index !== BigInt(0)) { writer.uint32(8).int64(message.index); @@ -628,5 +685,6 @@ export const MissedBlock = { typeUrl: "/cosmos.slashing.v1beta1.MissedBlock", value: MissedBlock.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/cosmos/slashing/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputv3/cosmos/slashing/v1beta1/query.rpc.func.ts new file mode 100644 index 0000000000..7ac5bd9dc5 --- /dev/null +++ b/__fixtures__/v-next/outputv3/cosmos/slashing/v1beta1/query.rpc.func.ts @@ -0,0 +1,43 @@ +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; +import { Params, ParamsSDKType, ValidatorSigningInfo, ValidatorSigningInfoSDKType } from "./slashing"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, QuerySigningInfoRequest, QuerySigningInfoRequestSDKType, QuerySigningInfoResponse, QuerySigningInfoResponseSDKType, QuerySigningInfosRequest, QuerySigningInfosRequestSDKType, QuerySigningInfosResponse, QuerySigningInfosResponseSDKType } from "./query"; +/** + * Params queries the parameters of slashing module + * @name getParams + * @package cosmos.slashing.v1beta1 + * @see proto service: cosmos.slashing.v1beta1.Params + */ +export const getParams = buildQuery({ + encode: QueryParamsRequest.encode, + decode: QueryParamsResponse.decode, + service: "cosmos.slashing.v1beta1.Query", + method: "Params", + deps: [QueryParamsRequest, QueryParamsResponse] +}); +/** + * SigningInfo queries the signing info of given cons address + * @name getSigningInfo + * @package cosmos.slashing.v1beta1 + * @see proto service: cosmos.slashing.v1beta1.SigningInfo + */ +export const getSigningInfo = buildQuery({ + encode: QuerySigningInfoRequest.encode, + decode: QuerySigningInfoResponse.decode, + service: "cosmos.slashing.v1beta1.Query", + method: "SigningInfo", + deps: [QuerySigningInfoRequest, QuerySigningInfoResponse] +}); +/** + * SigningInfos queries signing info of all validators + * @name getSigningInfos + * @package cosmos.slashing.v1beta1 + * @see proto service: cosmos.slashing.v1beta1.SigningInfos + */ +export const getSigningInfos = buildQuery({ + encode: QuerySigningInfosRequest.encode, + decode: QuerySigningInfosResponse.decode, + service: "cosmos.slashing.v1beta1.Query", + method: "SigningInfos", + deps: [QuerySigningInfosRequest, QuerySigningInfosResponse] +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/cosmos/slashing/v1beta1/query.ts b/__fixtures__/v-next/outputv3/cosmos/slashing/v1beta1/query.ts index a250d5397d..4a262891b7 100644 --- a/__fixtures__/v-next/outputv3/cosmos/slashing/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv3/cosmos/slashing/v1beta1/query.ts @@ -2,6 +2,7 @@ import { PageRequest, PageRequestAmino, PageRequestSDKType, PageResponse, PageRe import { Params, ParamsAmino, ParamsSDKType, ValidatorSigningInfo, ValidatorSigningInfoAmino, ValidatorSigningInfoSDKType } from "./slashing"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { DeepPartial, isSet } from "../../../helpers"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "cosmos.slashing.v1beta1"; /** * QueryParamsRequest is the request type for the Query/Params RPC method @@ -228,6 +229,15 @@ function createBaseQueryParamsRequest(): QueryParamsRequest { export const QueryParamsRequest = { typeUrl: "/cosmos.slashing.v1beta1.QueryParamsRequest", aminoType: "cosmos-sdk/QueryParamsRequest", + is(o: any): o is QueryParamsRequest { + return o && o.$typeUrl === QueryParamsRequest.typeUrl; + }, + isSDK(o: any): o is QueryParamsRequestSDKType { + return o && o.$typeUrl === QueryParamsRequest.typeUrl; + }, + isAmino(o: any): o is QueryParamsRequestAmino { + return o && o.$typeUrl === QueryParamsRequest.typeUrl; + }, encode(_: QueryParamsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -279,7 +289,8 @@ export const QueryParamsRequest = { typeUrl: "/cosmos.slashing.v1beta1.QueryParamsRequest", value: QueryParamsRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryParamsResponse(): QueryParamsResponse { return { @@ -295,6 +306,15 @@ function createBaseQueryParamsResponse(): QueryParamsResponse { export const QueryParamsResponse = { typeUrl: "/cosmos.slashing.v1beta1.QueryParamsResponse", aminoType: "cosmos-sdk/QueryParamsResponse", + is(o: any): o is QueryParamsResponse { + return o && (o.$typeUrl === QueryParamsResponse.typeUrl || Params.is(o.params)); + }, + isSDK(o: any): o is QueryParamsResponseSDKType { + return o && (o.$typeUrl === QueryParamsResponse.typeUrl || Params.isSDK(o.params)); + }, + isAmino(o: any): o is QueryParamsResponseAmino { + return o && (o.$typeUrl === QueryParamsResponse.typeUrl || Params.isAmino(o.params)); + }, encode(message: QueryParamsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.params !== undefined) { Params.encode(message.params, writer.uint32(10).fork()).ldelim(); @@ -363,6 +383,12 @@ export const QueryParamsResponse = { typeUrl: "/cosmos.slashing.v1beta1.QueryParamsResponse", value: QueryParamsResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryParamsResponse.typeUrl)) { + return; + } + Params.registerTypeUrl(); } }; function createBaseQuerySigningInfoRequest(): QuerySigningInfoRequest { @@ -380,6 +406,15 @@ function createBaseQuerySigningInfoRequest(): QuerySigningInfoRequest { export const QuerySigningInfoRequest = { typeUrl: "/cosmos.slashing.v1beta1.QuerySigningInfoRequest", aminoType: "cosmos-sdk/QuerySigningInfoRequest", + is(o: any): o is QuerySigningInfoRequest { + return o && (o.$typeUrl === QuerySigningInfoRequest.typeUrl || typeof o.consAddress === "string"); + }, + isSDK(o: any): o is QuerySigningInfoRequestSDKType { + return o && (o.$typeUrl === QuerySigningInfoRequest.typeUrl || typeof o.cons_address === "string"); + }, + isAmino(o: any): o is QuerySigningInfoRequestAmino { + return o && (o.$typeUrl === QuerySigningInfoRequest.typeUrl || typeof o.cons_address === "string"); + }, encode(message: QuerySigningInfoRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.consAddress !== "") { writer.uint32(10).string(message.consAddress); @@ -446,7 +481,8 @@ export const QuerySigningInfoRequest = { typeUrl: "/cosmos.slashing.v1beta1.QuerySigningInfoRequest", value: QuerySigningInfoRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQuerySigningInfoResponse(): QuerySigningInfoResponse { return { @@ -463,6 +499,15 @@ function createBaseQuerySigningInfoResponse(): QuerySigningInfoResponse { export const QuerySigningInfoResponse = { typeUrl: "/cosmos.slashing.v1beta1.QuerySigningInfoResponse", aminoType: "cosmos-sdk/QuerySigningInfoResponse", + is(o: any): o is QuerySigningInfoResponse { + return o && (o.$typeUrl === QuerySigningInfoResponse.typeUrl || ValidatorSigningInfo.is(o.valSigningInfo)); + }, + isSDK(o: any): o is QuerySigningInfoResponseSDKType { + return o && (o.$typeUrl === QuerySigningInfoResponse.typeUrl || ValidatorSigningInfo.isSDK(o.val_signing_info)); + }, + isAmino(o: any): o is QuerySigningInfoResponseAmino { + return o && (o.$typeUrl === QuerySigningInfoResponse.typeUrl || ValidatorSigningInfo.isAmino(o.val_signing_info)); + }, encode(message: QuerySigningInfoResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.valSigningInfo !== undefined) { ValidatorSigningInfo.encode(message.valSigningInfo, writer.uint32(10).fork()).ldelim(); @@ -531,6 +576,12 @@ export const QuerySigningInfoResponse = { typeUrl: "/cosmos.slashing.v1beta1.QuerySigningInfoResponse", value: QuerySigningInfoResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QuerySigningInfoResponse.typeUrl)) { + return; + } + ValidatorSigningInfo.registerTypeUrl(); } }; function createBaseQuerySigningInfosRequest(): QuerySigningInfosRequest { @@ -548,6 +599,15 @@ function createBaseQuerySigningInfosRequest(): QuerySigningInfosRequest { export const QuerySigningInfosRequest = { typeUrl: "/cosmos.slashing.v1beta1.QuerySigningInfosRequest", aminoType: "cosmos-sdk/QuerySigningInfosRequest", + is(o: any): o is QuerySigningInfosRequest { + return o && o.$typeUrl === QuerySigningInfosRequest.typeUrl; + }, + isSDK(o: any): o is QuerySigningInfosRequestSDKType { + return o && o.$typeUrl === QuerySigningInfosRequest.typeUrl; + }, + isAmino(o: any): o is QuerySigningInfosRequestAmino { + return o && o.$typeUrl === QuerySigningInfosRequest.typeUrl; + }, encode(message: QuerySigningInfosRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.pagination !== undefined) { PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); @@ -616,6 +676,12 @@ export const QuerySigningInfosRequest = { typeUrl: "/cosmos.slashing.v1beta1.QuerySigningInfosRequest", value: QuerySigningInfosRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QuerySigningInfosRequest.typeUrl)) { + return; + } + PageRequest.registerTypeUrl(); } }; function createBaseQuerySigningInfosResponse(): QuerySigningInfosResponse { @@ -634,6 +700,15 @@ function createBaseQuerySigningInfosResponse(): QuerySigningInfosResponse { export const QuerySigningInfosResponse = { typeUrl: "/cosmos.slashing.v1beta1.QuerySigningInfosResponse", aminoType: "cosmos-sdk/QuerySigningInfosResponse", + is(o: any): o is QuerySigningInfosResponse { + return o && (o.$typeUrl === QuerySigningInfosResponse.typeUrl || Array.isArray(o.info) && (!o.info.length || ValidatorSigningInfo.is(o.info[0]))); + }, + isSDK(o: any): o is QuerySigningInfosResponseSDKType { + return o && (o.$typeUrl === QuerySigningInfosResponse.typeUrl || Array.isArray(o.info) && (!o.info.length || ValidatorSigningInfo.isSDK(o.info[0]))); + }, + isAmino(o: any): o is QuerySigningInfosResponseAmino { + return o && (o.$typeUrl === QuerySigningInfosResponse.typeUrl || Array.isArray(o.info) && (!o.info.length || ValidatorSigningInfo.isAmino(o.info[0]))); + }, encode(message: QuerySigningInfosResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.info) { ValidatorSigningInfo.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -722,5 +797,12 @@ export const QuerySigningInfosResponse = { typeUrl: "/cosmos.slashing.v1beta1.QuerySigningInfosResponse", value: QuerySigningInfosResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QuerySigningInfosResponse.typeUrl)) { + return; + } + ValidatorSigningInfo.registerTypeUrl(); + PageResponse.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/cosmos/slashing/v1beta1/slashing.ts b/__fixtures__/v-next/outputv3/cosmos/slashing/v1beta1/slashing.ts index 252798537c..70d23884ac 100644 --- a/__fixtures__/v-next/outputv3/cosmos/slashing/v1beta1/slashing.ts +++ b/__fixtures__/v-next/outputv3/cosmos/slashing/v1beta1/slashing.ts @@ -2,6 +2,7 @@ import { Timestamp, TimestampAmino, TimestampSDKType } from "../../../google/pro import { Duration, DurationAmino, DurationSDKType } from "../../../google/protobuf/duration"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { toTimestamp, fromTimestamp, isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../helpers"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "cosmos.slashing.v1beta1"; /** * ValidatorSigningInfo defines a validator's signing info for monitoring their @@ -153,6 +154,15 @@ function createBaseValidatorSigningInfo(): ValidatorSigningInfo { export const ValidatorSigningInfo = { typeUrl: "/cosmos.slashing.v1beta1.ValidatorSigningInfo", aminoType: "cosmos-sdk/ValidatorSigningInfo", + is(o: any): o is ValidatorSigningInfo { + return o && (o.$typeUrl === ValidatorSigningInfo.typeUrl || typeof o.address === "string" && typeof o.startHeight === "bigint" && typeof o.indexOffset === "bigint" && Timestamp.is(o.jailedUntil) && typeof o.tombstoned === "boolean" && typeof o.missedBlocksCounter === "bigint"); + }, + isSDK(o: any): o is ValidatorSigningInfoSDKType { + return o && (o.$typeUrl === ValidatorSigningInfo.typeUrl || typeof o.address === "string" && typeof o.start_height === "bigint" && typeof o.index_offset === "bigint" && Timestamp.isSDK(o.jailed_until) && typeof o.tombstoned === "boolean" && typeof o.missed_blocks_counter === "bigint"); + }, + isAmino(o: any): o is ValidatorSigningInfoAmino { + return o && (o.$typeUrl === ValidatorSigningInfo.typeUrl || typeof o.address === "string" && typeof o.start_height === "bigint" && typeof o.index_offset === "bigint" && Timestamp.isAmino(o.jailed_until) && typeof o.tombstoned === "boolean" && typeof o.missed_blocks_counter === "bigint"); + }, encode(message: ValidatorSigningInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.address !== "") { writer.uint32(10).string(message.address); @@ -295,7 +305,8 @@ export const ValidatorSigningInfo = { typeUrl: "/cosmos.slashing.v1beta1.ValidatorSigningInfo", value: ValidatorSigningInfo.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseParams(): Params { return { @@ -315,6 +326,15 @@ function createBaseParams(): Params { export const Params = { typeUrl: "/cosmos.slashing.v1beta1.Params", aminoType: "cosmos-sdk/Params", + is(o: any): o is Params { + return o && (o.$typeUrl === Params.typeUrl || typeof o.signedBlocksWindow === "bigint" && (o.minSignedPerWindow instanceof Uint8Array || typeof o.minSignedPerWindow === "string") && Duration.is(o.downtimeJailDuration) && (o.slashFractionDoubleSign instanceof Uint8Array || typeof o.slashFractionDoubleSign === "string") && (o.slashFractionDowntime instanceof Uint8Array || typeof o.slashFractionDowntime === "string")); + }, + isSDK(o: any): o is ParamsSDKType { + return o && (o.$typeUrl === Params.typeUrl || typeof o.signed_blocks_window === "bigint" && (o.min_signed_per_window instanceof Uint8Array || typeof o.min_signed_per_window === "string") && Duration.isSDK(o.downtime_jail_duration) && (o.slash_fraction_double_sign instanceof Uint8Array || typeof o.slash_fraction_double_sign === "string") && (o.slash_fraction_downtime instanceof Uint8Array || typeof o.slash_fraction_downtime === "string")); + }, + isAmino(o: any): o is ParamsAmino { + return o && (o.$typeUrl === Params.typeUrl || typeof o.signed_blocks_window === "bigint" && (o.min_signed_per_window instanceof Uint8Array || typeof o.min_signed_per_window === "string") && Duration.isAmino(o.downtime_jail_duration) && (o.slash_fraction_double_sign instanceof Uint8Array || typeof o.slash_fraction_double_sign === "string") && (o.slash_fraction_downtime instanceof Uint8Array || typeof o.slash_fraction_downtime === "string")); + }, encode(message: Params, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.signedBlocksWindow !== BigInt(0)) { writer.uint32(8).int64(message.signedBlocksWindow); @@ -441,5 +461,6 @@ export const Params = { typeUrl: "/cosmos.slashing.v1beta1.Params", value: Params.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/cosmos/slashing/v1beta1/tx.registry.ts b/__fixtures__/v-next/outputv3/cosmos/slashing/v1beta1/tx.registry.ts index 96df9e3a1e..202e463f4f 100644 --- a/__fixtures__/v-next/outputv3/cosmos/slashing/v1beta1/tx.registry.ts +++ b/__fixtures__/v-next/outputv3/cosmos/slashing/v1beta1/tx.registry.ts @@ -1,11 +1,6 @@ -import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { TelescopeGeneratedType } from "../../../types"; import { MsgUnjail, MsgUnjailSDKType } from "./tx"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/cosmos.slashing.v1beta1.MsgUnjail", MsgUnjail]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/cosmos.slashing.v1beta1.MsgUnjail", MsgUnjail]]; export const MessageComposer = { encoded: { unjail(value: MsgUnjail) { diff --git a/__fixtures__/v-next/outputv3/cosmos/slashing/v1beta1/tx.rpc.func.ts b/__fixtures__/v-next/outputv3/cosmos/slashing/v1beta1/tx.rpc.func.ts new file mode 100644 index 0000000000..175d9272fa --- /dev/null +++ b/__fixtures__/v-next/outputv3/cosmos/slashing/v1beta1/tx.rpc.func.ts @@ -0,0 +1,13 @@ +import { buildTx } from "../../../helper-func-types"; +import { MsgUnjail, MsgUnjailSDKType, MsgUnjailResponse, MsgUnjailResponseSDKType } from "./tx"; +/** + * Unjail defines a method for unjailing a jailed validator, thus returning + * them into the bonded validator set, so they can begin receiving provisions + * and rewards again. + * @name unjail + * @package cosmos.slashing.v1beta1 + * @see proto service: cosmos.slashing.v1beta1.Unjail + */ +export const unjail = buildTx({ + msg: MsgUnjail +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/cosmos/slashing/v1beta1/tx.ts b/__fixtures__/v-next/outputv3/cosmos/slashing/v1beta1/tx.ts index f470bf7986..13fb47a546 100644 --- a/__fixtures__/v-next/outputv3/cosmos/slashing/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputv3/cosmos/slashing/v1beta1/tx.ts @@ -71,6 +71,15 @@ function createBaseMsgUnjail(): MsgUnjail { export const MsgUnjail = { typeUrl: "/cosmos.slashing.v1beta1.MsgUnjail", aminoType: "cosmos-sdk/MsgUnjail", + is(o: any): o is MsgUnjail { + return o && (o.$typeUrl === MsgUnjail.typeUrl || typeof o.validatorAddr === "string"); + }, + isSDK(o: any): o is MsgUnjailSDKType { + return o && (o.$typeUrl === MsgUnjail.typeUrl || typeof o.validator_addr === "string"); + }, + isAmino(o: any): o is MsgUnjailAmino { + return o && (o.$typeUrl === MsgUnjail.typeUrl || typeof o.validator_addr === "string"); + }, encode(message: MsgUnjail, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.validatorAddr !== "") { writer.uint32(10).string(message.validatorAddr); @@ -137,7 +146,8 @@ export const MsgUnjail = { typeUrl: "/cosmos.slashing.v1beta1.MsgUnjail", value: MsgUnjail.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgUnjailResponse(): MsgUnjailResponse { return {}; @@ -151,6 +161,15 @@ function createBaseMsgUnjailResponse(): MsgUnjailResponse { export const MsgUnjailResponse = { typeUrl: "/cosmos.slashing.v1beta1.MsgUnjailResponse", aminoType: "cosmos-sdk/MsgUnjailResponse", + is(o: any): o is MsgUnjailResponse { + return o && o.$typeUrl === MsgUnjailResponse.typeUrl; + }, + isSDK(o: any): o is MsgUnjailResponseSDKType { + return o && o.$typeUrl === MsgUnjailResponse.typeUrl; + }, + isAmino(o: any): o is MsgUnjailResponseAmino { + return o && o.$typeUrl === MsgUnjailResponse.typeUrl; + }, encode(_: MsgUnjailResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -202,5 +221,6 @@ export const MsgUnjailResponse = { typeUrl: "/cosmos.slashing.v1beta1.MsgUnjailResponse", value: MsgUnjailResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/cosmos/staking/v1beta1/authz.ts b/__fixtures__/v-next/outputv3/cosmos/staking/v1beta1/authz.ts index 40c0875528..3cee0054e7 100644 --- a/__fixtures__/v-next/outputv3/cosmos/staking/v1beta1/authz.ts +++ b/__fixtures__/v-next/outputv3/cosmos/staking/v1beta1/authz.ts @@ -1,6 +1,7 @@ import { Coin, CoinAmino, CoinSDKType } from "../../base/v1beta1/coin"; -import { BinaryReader, BinaryWriter } from "../../../binary"; import { isSet, DeepPartial } from "../../../helpers"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "cosmos.staking.v1beta1"; /** * AuthorizationType defines the type of staking module authorization type @@ -182,6 +183,15 @@ function createBaseStakeAuthorization(): StakeAuthorization { export const StakeAuthorization = { typeUrl: "/cosmos.staking.v1beta1.StakeAuthorization", aminoType: "cosmos-sdk/StakeAuthorization", + is(o: any): o is StakeAuthorization { + return o && (o.$typeUrl === StakeAuthorization.typeUrl || isSet(o.authorizationType)); + }, + isSDK(o: any): o is StakeAuthorizationSDKType { + return o && (o.$typeUrl === StakeAuthorization.typeUrl || isSet(o.authorization_type)); + }, + isAmino(o: any): o is StakeAuthorizationAmino { + return o && (o.$typeUrl === StakeAuthorization.typeUrl || isSet(o.authorization_type)); + }, encode(message: StakeAuthorization, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.maxTokens !== undefined) { Coin.encode(message.maxTokens, writer.uint32(10).fork()).ldelim(); @@ -296,6 +306,15 @@ export const StakeAuthorization = { typeUrl: "/cosmos.staking.v1beta1.StakeAuthorization", value: StakeAuthorization.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(StakeAuthorization.typeUrl)) { + return; + } + GlobalDecoderRegistry.register(StakeAuthorization.typeUrl, StakeAuthorization); + GlobalDecoderRegistry.registerAminoProtoMapping(StakeAuthorization.aminoType, StakeAuthorization.typeUrl); + Coin.registerTypeUrl(); + StakeAuthorization_Validators.registerTypeUrl(); } }; function createBaseStakeAuthorization_Validators(): StakeAuthorization_Validators { @@ -312,6 +331,15 @@ function createBaseStakeAuthorization_Validators(): StakeAuthorization_Validator export const StakeAuthorization_Validators = { typeUrl: "/cosmos.staking.v1beta1.Validators", aminoType: "cosmos-sdk/Validators", + is(o: any): o is StakeAuthorization_Validators { + return o && (o.$typeUrl === StakeAuthorization_Validators.typeUrl || Array.isArray(o.address) && (!o.address.length || typeof o.address[0] === "string")); + }, + isSDK(o: any): o is StakeAuthorization_ValidatorsSDKType { + return o && (o.$typeUrl === StakeAuthorization_Validators.typeUrl || Array.isArray(o.address) && (!o.address.length || typeof o.address[0] === "string")); + }, + isAmino(o: any): o is StakeAuthorization_ValidatorsAmino { + return o && (o.$typeUrl === StakeAuthorization_Validators.typeUrl || Array.isArray(o.address) && (!o.address.length || typeof o.address[0] === "string")); + }, encode(message: StakeAuthorization_Validators, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.address) { writer.uint32(10).string(v!); @@ -384,5 +412,6 @@ export const StakeAuthorization_Validators = { typeUrl: "/cosmos.staking.v1beta1.Validators", value: StakeAuthorization_Validators.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/cosmos/staking/v1beta1/genesis.ts b/__fixtures__/v-next/outputv3/cosmos/staking/v1beta1/genesis.ts index 30cec3b463..3faa1ffbea 100644 --- a/__fixtures__/v-next/outputv3/cosmos/staking/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv3/cosmos/staking/v1beta1/genesis.ts @@ -1,5 +1,6 @@ import { Params, ParamsAmino, ParamsSDKType, Validator, ValidatorAmino, ValidatorSDKType, Delegation, DelegationAmino, DelegationSDKType, UnbondingDelegation, UnbondingDelegationAmino, UnbondingDelegationSDKType, Redelegation, RedelegationAmino, RedelegationSDKType } from "./staking"; import { BinaryReader, BinaryWriter } from "../../../binary"; +import { GlobalDecoderRegistry } from "../../../registry"; import { isSet, bytesFromBase64, DeepPartial, base64FromBytes } from "../../../helpers"; export const protobufPackage = "cosmos.staking.v1beta1"; /** @@ -167,6 +168,15 @@ function createBaseGenesisState(): GenesisState { export const GenesisState = { typeUrl: "/cosmos.staking.v1beta1.GenesisState", aminoType: "cosmos-sdk/GenesisState", + is(o: any): o is GenesisState { + return o && (o.$typeUrl === GenesisState.typeUrl || Params.is(o.params) && (o.lastTotalPower instanceof Uint8Array || typeof o.lastTotalPower === "string") && Array.isArray(o.lastValidatorPowers) && (!o.lastValidatorPowers.length || LastValidatorPower.is(o.lastValidatorPowers[0])) && Array.isArray(o.validators) && (!o.validators.length || Validator.is(o.validators[0])) && Array.isArray(o.delegations) && (!o.delegations.length || Delegation.is(o.delegations[0])) && Array.isArray(o.unbondingDelegations) && (!o.unbondingDelegations.length || UnbondingDelegation.is(o.unbondingDelegations[0])) && Array.isArray(o.redelegations) && (!o.redelegations.length || Redelegation.is(o.redelegations[0])) && typeof o.exported === "boolean"); + }, + isSDK(o: any): o is GenesisStateSDKType { + return o && (o.$typeUrl === GenesisState.typeUrl || Params.isSDK(o.params) && (o.last_total_power instanceof Uint8Array || typeof o.last_total_power === "string") && Array.isArray(o.last_validator_powers) && (!o.last_validator_powers.length || LastValidatorPower.isSDK(o.last_validator_powers[0])) && Array.isArray(o.validators) && (!o.validators.length || Validator.isSDK(o.validators[0])) && Array.isArray(o.delegations) && (!o.delegations.length || Delegation.isSDK(o.delegations[0])) && Array.isArray(o.unbonding_delegations) && (!o.unbonding_delegations.length || UnbondingDelegation.isSDK(o.unbonding_delegations[0])) && Array.isArray(o.redelegations) && (!o.redelegations.length || Redelegation.isSDK(o.redelegations[0])) && typeof o.exported === "boolean"); + }, + isAmino(o: any): o is GenesisStateAmino { + return o && (o.$typeUrl === GenesisState.typeUrl || Params.isAmino(o.params) && (o.last_total_power instanceof Uint8Array || typeof o.last_total_power === "string") && Array.isArray(o.last_validator_powers) && (!o.last_validator_powers.length || LastValidatorPower.isAmino(o.last_validator_powers[0])) && Array.isArray(o.validators) && (!o.validators.length || Validator.isAmino(o.validators[0])) && Array.isArray(o.delegations) && (!o.delegations.length || Delegation.isAmino(o.delegations[0])) && Array.isArray(o.unbonding_delegations) && (!o.unbonding_delegations.length || UnbondingDelegation.isAmino(o.unbonding_delegations[0])) && Array.isArray(o.redelegations) && (!o.redelegations.length || Redelegation.isAmino(o.redelegations[0])) && typeof o.exported === "boolean"); + }, encode(message: GenesisState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.params !== undefined) { Params.encode(message.params, writer.uint32(10).fork()).ldelim(); @@ -363,6 +373,17 @@ export const GenesisState = { typeUrl: "/cosmos.staking.v1beta1.GenesisState", value: GenesisState.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GenesisState.typeUrl)) { + return; + } + Params.registerTypeUrl(); + LastValidatorPower.registerTypeUrl(); + Validator.registerTypeUrl(); + Delegation.registerTypeUrl(); + UnbondingDelegation.registerTypeUrl(); + Redelegation.registerTypeUrl(); } }; function createBaseLastValidatorPower(): LastValidatorPower { @@ -380,6 +401,15 @@ function createBaseLastValidatorPower(): LastValidatorPower { export const LastValidatorPower = { typeUrl: "/cosmos.staking.v1beta1.LastValidatorPower", aminoType: "cosmos-sdk/LastValidatorPower", + is(o: any): o is LastValidatorPower { + return o && (o.$typeUrl === LastValidatorPower.typeUrl || typeof o.address === "string" && typeof o.power === "bigint"); + }, + isSDK(o: any): o is LastValidatorPowerSDKType { + return o && (o.$typeUrl === LastValidatorPower.typeUrl || typeof o.address === "string" && typeof o.power === "bigint"); + }, + isAmino(o: any): o is LastValidatorPowerAmino { + return o && (o.$typeUrl === LastValidatorPower.typeUrl || typeof o.address === "string" && typeof o.power === "bigint"); + }, encode(message: LastValidatorPower, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.address !== "") { writer.uint32(10).string(message.address); @@ -462,5 +492,6 @@ export const LastValidatorPower = { typeUrl: "/cosmos.staking.v1beta1.LastValidatorPower", value: LastValidatorPower.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/cosmos/staking/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputv3/cosmos/staking/v1beta1/query.rpc.func.ts new file mode 100644 index 0000000000..5bd1f623ca --- /dev/null +++ b/__fixtures__/v-next/outputv3/cosmos/staking/v1beta1/query.rpc.func.ts @@ -0,0 +1,190 @@ +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; +import { Validator, ValidatorSDKType, DelegationResponse, DelegationResponseSDKType, UnbondingDelegation, UnbondingDelegationSDKType, RedelegationResponse, RedelegationResponseSDKType, HistoricalInfo, HistoricalInfoSDKType, Pool, PoolSDKType, Params, ParamsSDKType } from "./staking"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { QueryValidatorsRequest, QueryValidatorsRequestSDKType, QueryValidatorsResponse, QueryValidatorsResponseSDKType, QueryValidatorRequest, QueryValidatorRequestSDKType, QueryValidatorResponse, QueryValidatorResponseSDKType, QueryValidatorDelegationsRequest, QueryValidatorDelegationsRequestSDKType, QueryValidatorDelegationsResponse, QueryValidatorDelegationsResponseSDKType, QueryValidatorUnbondingDelegationsRequest, QueryValidatorUnbondingDelegationsRequestSDKType, QueryValidatorUnbondingDelegationsResponse, QueryValidatorUnbondingDelegationsResponseSDKType, QueryDelegationRequest, QueryDelegationRequestSDKType, QueryDelegationResponse, QueryDelegationResponseSDKType, QueryUnbondingDelegationRequest, QueryUnbondingDelegationRequestSDKType, QueryUnbondingDelegationResponse, QueryUnbondingDelegationResponseSDKType, QueryDelegatorDelegationsRequest, QueryDelegatorDelegationsRequestSDKType, QueryDelegatorDelegationsResponse, QueryDelegatorDelegationsResponseSDKType, QueryDelegatorUnbondingDelegationsRequest, QueryDelegatorUnbondingDelegationsRequestSDKType, QueryDelegatorUnbondingDelegationsResponse, QueryDelegatorUnbondingDelegationsResponseSDKType, QueryRedelegationsRequest, QueryRedelegationsRequestSDKType, QueryRedelegationsResponse, QueryRedelegationsResponseSDKType, QueryDelegatorValidatorsRequest, QueryDelegatorValidatorsRequestSDKType, QueryDelegatorValidatorsResponse, QueryDelegatorValidatorsResponseSDKType, QueryDelegatorValidatorRequest, QueryDelegatorValidatorRequestSDKType, QueryDelegatorValidatorResponse, QueryDelegatorValidatorResponseSDKType, QueryHistoricalInfoRequest, QueryHistoricalInfoRequestSDKType, QueryHistoricalInfoResponse, QueryHistoricalInfoResponseSDKType, QueryPoolRequest, QueryPoolRequestSDKType, QueryPoolResponse, QueryPoolResponseSDKType, QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType } from "./query"; +/** + * Validators queries all validators that match the given status. + * @name getValidators + * @package cosmos.staking.v1beta1 + * @see proto service: cosmos.staking.v1beta1.Validators + */ +export const getValidators = buildQuery({ + encode: QueryValidatorsRequest.encode, + decode: QueryValidatorsResponse.decode, + service: "cosmos.staking.v1beta1.Query", + method: "Validators", + deps: [QueryValidatorsRequest, QueryValidatorsResponse] +}); +/** + * Validator queries validator info for given validator address. + * @name getValidator + * @package cosmos.staking.v1beta1 + * @see proto service: cosmos.staking.v1beta1.Validator + */ +export const getValidator = buildQuery({ + encode: QueryValidatorRequest.encode, + decode: QueryValidatorResponse.decode, + service: "cosmos.staking.v1beta1.Query", + method: "Validator", + deps: [QueryValidatorRequest, QueryValidatorResponse] +}); +/** + * ValidatorDelegations queries delegate info for given validator. + * @name getValidatorDelegations + * @package cosmos.staking.v1beta1 + * @see proto service: cosmos.staking.v1beta1.ValidatorDelegations + */ +export const getValidatorDelegations = buildQuery({ + encode: QueryValidatorDelegationsRequest.encode, + decode: QueryValidatorDelegationsResponse.decode, + service: "cosmos.staking.v1beta1.Query", + method: "ValidatorDelegations", + deps: [QueryValidatorDelegationsRequest, QueryValidatorDelegationsResponse] +}); +/** + * ValidatorUnbondingDelegations queries unbonding delegations of a validator. + * @name getValidatorUnbondingDelegations + * @package cosmos.staking.v1beta1 + * @see proto service: cosmos.staking.v1beta1.ValidatorUnbondingDelegations + */ +export const getValidatorUnbondingDelegations = buildQuery({ + encode: QueryValidatorUnbondingDelegationsRequest.encode, + decode: QueryValidatorUnbondingDelegationsResponse.decode, + service: "cosmos.staking.v1beta1.Query", + method: "ValidatorUnbondingDelegations", + deps: [QueryValidatorUnbondingDelegationsRequest, QueryValidatorUnbondingDelegationsResponse] +}); +/** + * Delegation queries delegate info for given validator delegator pair. + * @name getDelegation + * @package cosmos.staking.v1beta1 + * @see proto service: cosmos.staking.v1beta1.Delegation + */ +export const getDelegation = buildQuery({ + encode: QueryDelegationRequest.encode, + decode: QueryDelegationResponse.decode, + service: "cosmos.staking.v1beta1.Query", + method: "Delegation", + deps: [QueryDelegationRequest, QueryDelegationResponse] +}); +/** + * UnbondingDelegation queries unbonding info for given validator delegator + * pair. + * @name getUnbondingDelegation + * @package cosmos.staking.v1beta1 + * @see proto service: cosmos.staking.v1beta1.UnbondingDelegation + */ +export const getUnbondingDelegation = buildQuery({ + encode: QueryUnbondingDelegationRequest.encode, + decode: QueryUnbondingDelegationResponse.decode, + service: "cosmos.staking.v1beta1.Query", + method: "UnbondingDelegation", + deps: [QueryUnbondingDelegationRequest, QueryUnbondingDelegationResponse] +}); +/** + * DelegatorDelegations queries all delegations of a given delegator address. + * @name getDelegatorDelegations + * @package cosmos.staking.v1beta1 + * @see proto service: cosmos.staking.v1beta1.DelegatorDelegations + */ +export const getDelegatorDelegations = buildQuery({ + encode: QueryDelegatorDelegationsRequest.encode, + decode: QueryDelegatorDelegationsResponse.decode, + service: "cosmos.staking.v1beta1.Query", + method: "DelegatorDelegations", + deps: [QueryDelegatorDelegationsRequest, QueryDelegatorDelegationsResponse] +}); +/** + * DelegatorUnbondingDelegations queries all unbonding delegations of a given + * delegator address. + * @name getDelegatorUnbondingDelegations + * @package cosmos.staking.v1beta1 + * @see proto service: cosmos.staking.v1beta1.DelegatorUnbondingDelegations + */ +export const getDelegatorUnbondingDelegations = buildQuery({ + encode: QueryDelegatorUnbondingDelegationsRequest.encode, + decode: QueryDelegatorUnbondingDelegationsResponse.decode, + service: "cosmos.staking.v1beta1.Query", + method: "DelegatorUnbondingDelegations", + deps: [QueryDelegatorUnbondingDelegationsRequest, QueryDelegatorUnbondingDelegationsResponse] +}); +/** + * Redelegations queries redelegations of given address. + * @name getRedelegations + * @package cosmos.staking.v1beta1 + * @see proto service: cosmos.staking.v1beta1.Redelegations + */ +export const getRedelegations = buildQuery({ + encode: QueryRedelegationsRequest.encode, + decode: QueryRedelegationsResponse.decode, + service: "cosmos.staking.v1beta1.Query", + method: "Redelegations", + deps: [QueryRedelegationsRequest, QueryRedelegationsResponse] +}); +/** + * DelegatorValidators queries all validators info for given delegator + * address. + * @name getDelegatorValidators + * @package cosmos.staking.v1beta1 + * @see proto service: cosmos.staking.v1beta1.DelegatorValidators + */ +export const getDelegatorValidators = buildQuery({ + encode: QueryDelegatorValidatorsRequest.encode, + decode: QueryDelegatorValidatorsResponse.decode, + service: "cosmos.staking.v1beta1.Query", + method: "DelegatorValidators", + deps: [QueryDelegatorValidatorsRequest, QueryDelegatorValidatorsResponse] +}); +/** + * DelegatorValidator queries validator info for given delegator validator + * pair. + * @name getDelegatorValidator + * @package cosmos.staking.v1beta1 + * @see proto service: cosmos.staking.v1beta1.DelegatorValidator + */ +export const getDelegatorValidator = buildQuery({ + encode: QueryDelegatorValidatorRequest.encode, + decode: QueryDelegatorValidatorResponse.decode, + service: "cosmos.staking.v1beta1.Query", + method: "DelegatorValidator", + deps: [QueryDelegatorValidatorRequest, QueryDelegatorValidatorResponse] +}); +/** + * HistoricalInfo queries the historical info for given height. + * @name getHistoricalInfo + * @package cosmos.staking.v1beta1 + * @see proto service: cosmos.staking.v1beta1.HistoricalInfo + */ +export const getHistoricalInfo = buildQuery({ + encode: QueryHistoricalInfoRequest.encode, + decode: QueryHistoricalInfoResponse.decode, + service: "cosmos.staking.v1beta1.Query", + method: "HistoricalInfo", + deps: [QueryHistoricalInfoRequest, QueryHistoricalInfoResponse] +}); +/** + * Pool queries the pool info. + * @name getPool + * @package cosmos.staking.v1beta1 + * @see proto service: cosmos.staking.v1beta1.Pool + */ +export const getPool = buildQuery({ + encode: QueryPoolRequest.encode, + decode: QueryPoolResponse.decode, + service: "cosmos.staking.v1beta1.Query", + method: "Pool", + deps: [QueryPoolRequest, QueryPoolResponse] +}); +/** + * Parameters queries the staking parameters. + * @name getParams + * @package cosmos.staking.v1beta1 + * @see proto service: cosmos.staking.v1beta1.Params + */ +export const getParams = buildQuery({ + encode: QueryParamsRequest.encode, + decode: QueryParamsResponse.decode, + service: "cosmos.staking.v1beta1.Query", + method: "Params", + deps: [QueryParamsRequest, QueryParamsResponse] +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/cosmos/staking/v1beta1/query.ts b/__fixtures__/v-next/outputv3/cosmos/staking/v1beta1/query.ts index 141601532a..18d019521c 100644 --- a/__fixtures__/v-next/outputv3/cosmos/staking/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv3/cosmos/staking/v1beta1/query.ts @@ -1,6 +1,7 @@ import { PageRequest, PageRequestAmino, PageRequestSDKType, PageResponse, PageResponseAmino, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; import { Validator, ValidatorAmino, ValidatorSDKType, DelegationResponse, DelegationResponseAmino, DelegationResponseSDKType, UnbondingDelegation, UnbondingDelegationAmino, UnbondingDelegationSDKType, RedelegationResponse, RedelegationResponseAmino, RedelegationResponseSDKType, HistoricalInfo, HistoricalInfoAmino, HistoricalInfoSDKType, Pool, PoolAmino, PoolSDKType, Params, ParamsAmino, ParamsSDKType } from "./staking"; import { BinaryReader, BinaryWriter } from "../../../binary"; +import { GlobalDecoderRegistry } from "../../../registry"; import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "cosmos.staking.v1beta1"; /** @@ -1231,6 +1232,15 @@ function createBaseQueryValidatorsRequest(): QueryValidatorsRequest { export const QueryValidatorsRequest = { typeUrl: "/cosmos.staking.v1beta1.QueryValidatorsRequest", aminoType: "cosmos-sdk/QueryValidatorsRequest", + is(o: any): o is QueryValidatorsRequest { + return o && (o.$typeUrl === QueryValidatorsRequest.typeUrl || typeof o.status === "string"); + }, + isSDK(o: any): o is QueryValidatorsRequestSDKType { + return o && (o.$typeUrl === QueryValidatorsRequest.typeUrl || typeof o.status === "string"); + }, + isAmino(o: any): o is QueryValidatorsRequestAmino { + return o && (o.$typeUrl === QueryValidatorsRequest.typeUrl || typeof o.status === "string"); + }, encode(message: QueryValidatorsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.status !== "") { writer.uint32(10).string(message.status); @@ -1313,6 +1323,12 @@ export const QueryValidatorsRequest = { typeUrl: "/cosmos.staking.v1beta1.QueryValidatorsRequest", value: QueryValidatorsRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryValidatorsRequest.typeUrl)) { + return; + } + PageRequest.registerTypeUrl(); } }; function createBaseQueryValidatorsResponse(): QueryValidatorsResponse { @@ -1330,6 +1346,15 @@ function createBaseQueryValidatorsResponse(): QueryValidatorsResponse { export const QueryValidatorsResponse = { typeUrl: "/cosmos.staking.v1beta1.QueryValidatorsResponse", aminoType: "cosmos-sdk/QueryValidatorsResponse", + is(o: any): o is QueryValidatorsResponse { + return o && (o.$typeUrl === QueryValidatorsResponse.typeUrl || Array.isArray(o.validators) && (!o.validators.length || Validator.is(o.validators[0]))); + }, + isSDK(o: any): o is QueryValidatorsResponseSDKType { + return o && (o.$typeUrl === QueryValidatorsResponse.typeUrl || Array.isArray(o.validators) && (!o.validators.length || Validator.isSDK(o.validators[0]))); + }, + isAmino(o: any): o is QueryValidatorsResponseAmino { + return o && (o.$typeUrl === QueryValidatorsResponse.typeUrl || Array.isArray(o.validators) && (!o.validators.length || Validator.isAmino(o.validators[0]))); + }, encode(message: QueryValidatorsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.validators) { Validator.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -1418,6 +1443,13 @@ export const QueryValidatorsResponse = { typeUrl: "/cosmos.staking.v1beta1.QueryValidatorsResponse", value: QueryValidatorsResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryValidatorsResponse.typeUrl)) { + return; + } + Validator.registerTypeUrl(); + PageResponse.registerTypeUrl(); } }; function createBaseQueryValidatorRequest(): QueryValidatorRequest { @@ -1434,6 +1466,15 @@ function createBaseQueryValidatorRequest(): QueryValidatorRequest { export const QueryValidatorRequest = { typeUrl: "/cosmos.staking.v1beta1.QueryValidatorRequest", aminoType: "cosmos-sdk/QueryValidatorRequest", + is(o: any): o is QueryValidatorRequest { + return o && (o.$typeUrl === QueryValidatorRequest.typeUrl || typeof o.validatorAddr === "string"); + }, + isSDK(o: any): o is QueryValidatorRequestSDKType { + return o && (o.$typeUrl === QueryValidatorRequest.typeUrl || typeof o.validator_addr === "string"); + }, + isAmino(o: any): o is QueryValidatorRequestAmino { + return o && (o.$typeUrl === QueryValidatorRequest.typeUrl || typeof o.validator_addr === "string"); + }, encode(message: QueryValidatorRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.validatorAddr !== "") { writer.uint32(10).string(message.validatorAddr); @@ -1500,7 +1541,8 @@ export const QueryValidatorRequest = { typeUrl: "/cosmos.staking.v1beta1.QueryValidatorRequest", value: QueryValidatorRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryValidatorResponse(): QueryValidatorResponse { return { @@ -1516,6 +1558,15 @@ function createBaseQueryValidatorResponse(): QueryValidatorResponse { export const QueryValidatorResponse = { typeUrl: "/cosmos.staking.v1beta1.QueryValidatorResponse", aminoType: "cosmos-sdk/QueryValidatorResponse", + is(o: any): o is QueryValidatorResponse { + return o && (o.$typeUrl === QueryValidatorResponse.typeUrl || Validator.is(o.validator)); + }, + isSDK(o: any): o is QueryValidatorResponseSDKType { + return o && (o.$typeUrl === QueryValidatorResponse.typeUrl || Validator.isSDK(o.validator)); + }, + isAmino(o: any): o is QueryValidatorResponseAmino { + return o && (o.$typeUrl === QueryValidatorResponse.typeUrl || Validator.isAmino(o.validator)); + }, encode(message: QueryValidatorResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.validator !== undefined) { Validator.encode(message.validator, writer.uint32(10).fork()).ldelim(); @@ -1584,6 +1635,12 @@ export const QueryValidatorResponse = { typeUrl: "/cosmos.staking.v1beta1.QueryValidatorResponse", value: QueryValidatorResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryValidatorResponse.typeUrl)) { + return; + } + Validator.registerTypeUrl(); } }; function createBaseQueryValidatorDelegationsRequest(): QueryValidatorDelegationsRequest { @@ -1602,6 +1659,15 @@ function createBaseQueryValidatorDelegationsRequest(): QueryValidatorDelegations export const QueryValidatorDelegationsRequest = { typeUrl: "/cosmos.staking.v1beta1.QueryValidatorDelegationsRequest", aminoType: "cosmos-sdk/QueryValidatorDelegationsRequest", + is(o: any): o is QueryValidatorDelegationsRequest { + return o && (o.$typeUrl === QueryValidatorDelegationsRequest.typeUrl || typeof o.validatorAddr === "string"); + }, + isSDK(o: any): o is QueryValidatorDelegationsRequestSDKType { + return o && (o.$typeUrl === QueryValidatorDelegationsRequest.typeUrl || typeof o.validator_addr === "string"); + }, + isAmino(o: any): o is QueryValidatorDelegationsRequestAmino { + return o && (o.$typeUrl === QueryValidatorDelegationsRequest.typeUrl || typeof o.validator_addr === "string"); + }, encode(message: QueryValidatorDelegationsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.validatorAddr !== "") { writer.uint32(10).string(message.validatorAddr); @@ -1684,6 +1750,12 @@ export const QueryValidatorDelegationsRequest = { typeUrl: "/cosmos.staking.v1beta1.QueryValidatorDelegationsRequest", value: QueryValidatorDelegationsRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryValidatorDelegationsRequest.typeUrl)) { + return; + } + PageRequest.registerTypeUrl(); } }; function createBaseQueryValidatorDelegationsResponse(): QueryValidatorDelegationsResponse { @@ -1702,6 +1774,15 @@ function createBaseQueryValidatorDelegationsResponse(): QueryValidatorDelegation export const QueryValidatorDelegationsResponse = { typeUrl: "/cosmos.staking.v1beta1.QueryValidatorDelegationsResponse", aminoType: "cosmos-sdk/QueryValidatorDelegationsResponse", + is(o: any): o is QueryValidatorDelegationsResponse { + return o && (o.$typeUrl === QueryValidatorDelegationsResponse.typeUrl || Array.isArray(o.delegationResponses) && (!o.delegationResponses.length || DelegationResponse.is(o.delegationResponses[0]))); + }, + isSDK(o: any): o is QueryValidatorDelegationsResponseSDKType { + return o && (o.$typeUrl === QueryValidatorDelegationsResponse.typeUrl || Array.isArray(o.delegation_responses) && (!o.delegation_responses.length || DelegationResponse.isSDK(o.delegation_responses[0]))); + }, + isAmino(o: any): o is QueryValidatorDelegationsResponseAmino { + return o && (o.$typeUrl === QueryValidatorDelegationsResponse.typeUrl || Array.isArray(o.delegation_responses) && (!o.delegation_responses.length || DelegationResponse.isAmino(o.delegation_responses[0]))); + }, encode(message: QueryValidatorDelegationsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.delegationResponses) { DelegationResponse.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -1790,6 +1871,13 @@ export const QueryValidatorDelegationsResponse = { typeUrl: "/cosmos.staking.v1beta1.QueryValidatorDelegationsResponse", value: QueryValidatorDelegationsResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryValidatorDelegationsResponse.typeUrl)) { + return; + } + DelegationResponse.registerTypeUrl(); + PageResponse.registerTypeUrl(); } }; function createBaseQueryValidatorUnbondingDelegationsRequest(): QueryValidatorUnbondingDelegationsRequest { @@ -1808,6 +1896,15 @@ function createBaseQueryValidatorUnbondingDelegationsRequest(): QueryValidatorUn export const QueryValidatorUnbondingDelegationsRequest = { typeUrl: "/cosmos.staking.v1beta1.QueryValidatorUnbondingDelegationsRequest", aminoType: "cosmos-sdk/QueryValidatorUnbondingDelegationsRequest", + is(o: any): o is QueryValidatorUnbondingDelegationsRequest { + return o && (o.$typeUrl === QueryValidatorUnbondingDelegationsRequest.typeUrl || typeof o.validatorAddr === "string"); + }, + isSDK(o: any): o is QueryValidatorUnbondingDelegationsRequestSDKType { + return o && (o.$typeUrl === QueryValidatorUnbondingDelegationsRequest.typeUrl || typeof o.validator_addr === "string"); + }, + isAmino(o: any): o is QueryValidatorUnbondingDelegationsRequestAmino { + return o && (o.$typeUrl === QueryValidatorUnbondingDelegationsRequest.typeUrl || typeof o.validator_addr === "string"); + }, encode(message: QueryValidatorUnbondingDelegationsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.validatorAddr !== "") { writer.uint32(10).string(message.validatorAddr); @@ -1890,6 +1987,12 @@ export const QueryValidatorUnbondingDelegationsRequest = { typeUrl: "/cosmos.staking.v1beta1.QueryValidatorUnbondingDelegationsRequest", value: QueryValidatorUnbondingDelegationsRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryValidatorUnbondingDelegationsRequest.typeUrl)) { + return; + } + PageRequest.registerTypeUrl(); } }; function createBaseQueryValidatorUnbondingDelegationsResponse(): QueryValidatorUnbondingDelegationsResponse { @@ -1908,6 +2011,15 @@ function createBaseQueryValidatorUnbondingDelegationsResponse(): QueryValidatorU export const QueryValidatorUnbondingDelegationsResponse = { typeUrl: "/cosmos.staking.v1beta1.QueryValidatorUnbondingDelegationsResponse", aminoType: "cosmos-sdk/QueryValidatorUnbondingDelegationsResponse", + is(o: any): o is QueryValidatorUnbondingDelegationsResponse { + return o && (o.$typeUrl === QueryValidatorUnbondingDelegationsResponse.typeUrl || Array.isArray(o.unbondingResponses) && (!o.unbondingResponses.length || UnbondingDelegation.is(o.unbondingResponses[0]))); + }, + isSDK(o: any): o is QueryValidatorUnbondingDelegationsResponseSDKType { + return o && (o.$typeUrl === QueryValidatorUnbondingDelegationsResponse.typeUrl || Array.isArray(o.unbonding_responses) && (!o.unbonding_responses.length || UnbondingDelegation.isSDK(o.unbonding_responses[0]))); + }, + isAmino(o: any): o is QueryValidatorUnbondingDelegationsResponseAmino { + return o && (o.$typeUrl === QueryValidatorUnbondingDelegationsResponse.typeUrl || Array.isArray(o.unbonding_responses) && (!o.unbonding_responses.length || UnbondingDelegation.isAmino(o.unbonding_responses[0]))); + }, encode(message: QueryValidatorUnbondingDelegationsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.unbondingResponses) { UnbondingDelegation.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -1996,6 +2108,13 @@ export const QueryValidatorUnbondingDelegationsResponse = { typeUrl: "/cosmos.staking.v1beta1.QueryValidatorUnbondingDelegationsResponse", value: QueryValidatorUnbondingDelegationsResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryValidatorUnbondingDelegationsResponse.typeUrl)) { + return; + } + UnbondingDelegation.registerTypeUrl(); + PageResponse.registerTypeUrl(); } }; function createBaseQueryDelegationRequest(): QueryDelegationRequest { @@ -2013,6 +2132,15 @@ function createBaseQueryDelegationRequest(): QueryDelegationRequest { export const QueryDelegationRequest = { typeUrl: "/cosmos.staking.v1beta1.QueryDelegationRequest", aminoType: "cosmos-sdk/QueryDelegationRequest", + is(o: any): o is QueryDelegationRequest { + return o && (o.$typeUrl === QueryDelegationRequest.typeUrl || typeof o.delegatorAddr === "string" && typeof o.validatorAddr === "string"); + }, + isSDK(o: any): o is QueryDelegationRequestSDKType { + return o && (o.$typeUrl === QueryDelegationRequest.typeUrl || typeof o.delegator_addr === "string" && typeof o.validator_addr === "string"); + }, + isAmino(o: any): o is QueryDelegationRequestAmino { + return o && (o.$typeUrl === QueryDelegationRequest.typeUrl || typeof o.delegator_addr === "string" && typeof o.validator_addr === "string"); + }, encode(message: QueryDelegationRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.delegatorAddr !== "") { writer.uint32(10).string(message.delegatorAddr); @@ -2093,7 +2221,8 @@ export const QueryDelegationRequest = { typeUrl: "/cosmos.staking.v1beta1.QueryDelegationRequest", value: QueryDelegationRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryDelegationResponse(): QueryDelegationResponse { return { @@ -2109,6 +2238,15 @@ function createBaseQueryDelegationResponse(): QueryDelegationResponse { export const QueryDelegationResponse = { typeUrl: "/cosmos.staking.v1beta1.QueryDelegationResponse", aminoType: "cosmos-sdk/QueryDelegationResponse", + is(o: any): o is QueryDelegationResponse { + return o && o.$typeUrl === QueryDelegationResponse.typeUrl; + }, + isSDK(o: any): o is QueryDelegationResponseSDKType { + return o && o.$typeUrl === QueryDelegationResponse.typeUrl; + }, + isAmino(o: any): o is QueryDelegationResponseAmino { + return o && o.$typeUrl === QueryDelegationResponse.typeUrl; + }, encode(message: QueryDelegationResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.delegationResponse !== undefined) { DelegationResponse.encode(message.delegationResponse, writer.uint32(10).fork()).ldelim(); @@ -2177,6 +2315,12 @@ export const QueryDelegationResponse = { typeUrl: "/cosmos.staking.v1beta1.QueryDelegationResponse", value: QueryDelegationResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryDelegationResponse.typeUrl)) { + return; + } + DelegationResponse.registerTypeUrl(); } }; function createBaseQueryUnbondingDelegationRequest(): QueryUnbondingDelegationRequest { @@ -2195,6 +2339,15 @@ function createBaseQueryUnbondingDelegationRequest(): QueryUnbondingDelegationRe export const QueryUnbondingDelegationRequest = { typeUrl: "/cosmos.staking.v1beta1.QueryUnbondingDelegationRequest", aminoType: "cosmos-sdk/QueryUnbondingDelegationRequest", + is(o: any): o is QueryUnbondingDelegationRequest { + return o && (o.$typeUrl === QueryUnbondingDelegationRequest.typeUrl || typeof o.delegatorAddr === "string" && typeof o.validatorAddr === "string"); + }, + isSDK(o: any): o is QueryUnbondingDelegationRequestSDKType { + return o && (o.$typeUrl === QueryUnbondingDelegationRequest.typeUrl || typeof o.delegator_addr === "string" && typeof o.validator_addr === "string"); + }, + isAmino(o: any): o is QueryUnbondingDelegationRequestAmino { + return o && (o.$typeUrl === QueryUnbondingDelegationRequest.typeUrl || typeof o.delegator_addr === "string" && typeof o.validator_addr === "string"); + }, encode(message: QueryUnbondingDelegationRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.delegatorAddr !== "") { writer.uint32(10).string(message.delegatorAddr); @@ -2275,7 +2428,8 @@ export const QueryUnbondingDelegationRequest = { typeUrl: "/cosmos.staking.v1beta1.QueryUnbondingDelegationRequest", value: QueryUnbondingDelegationRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryUnbondingDelegationResponse(): QueryUnbondingDelegationResponse { return { @@ -2292,6 +2446,15 @@ function createBaseQueryUnbondingDelegationResponse(): QueryUnbondingDelegationR export const QueryUnbondingDelegationResponse = { typeUrl: "/cosmos.staking.v1beta1.QueryUnbondingDelegationResponse", aminoType: "cosmos-sdk/QueryUnbondingDelegationResponse", + is(o: any): o is QueryUnbondingDelegationResponse { + return o && (o.$typeUrl === QueryUnbondingDelegationResponse.typeUrl || UnbondingDelegation.is(o.unbond)); + }, + isSDK(o: any): o is QueryUnbondingDelegationResponseSDKType { + return o && (o.$typeUrl === QueryUnbondingDelegationResponse.typeUrl || UnbondingDelegation.isSDK(o.unbond)); + }, + isAmino(o: any): o is QueryUnbondingDelegationResponseAmino { + return o && (o.$typeUrl === QueryUnbondingDelegationResponse.typeUrl || UnbondingDelegation.isAmino(o.unbond)); + }, encode(message: QueryUnbondingDelegationResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.unbond !== undefined) { UnbondingDelegation.encode(message.unbond, writer.uint32(10).fork()).ldelim(); @@ -2360,6 +2523,12 @@ export const QueryUnbondingDelegationResponse = { typeUrl: "/cosmos.staking.v1beta1.QueryUnbondingDelegationResponse", value: QueryUnbondingDelegationResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryUnbondingDelegationResponse.typeUrl)) { + return; + } + UnbondingDelegation.registerTypeUrl(); } }; function createBaseQueryDelegatorDelegationsRequest(): QueryDelegatorDelegationsRequest { @@ -2378,6 +2547,15 @@ function createBaseQueryDelegatorDelegationsRequest(): QueryDelegatorDelegations export const QueryDelegatorDelegationsRequest = { typeUrl: "/cosmos.staking.v1beta1.QueryDelegatorDelegationsRequest", aminoType: "cosmos-sdk/QueryDelegatorDelegationsRequest", + is(o: any): o is QueryDelegatorDelegationsRequest { + return o && (o.$typeUrl === QueryDelegatorDelegationsRequest.typeUrl || typeof o.delegatorAddr === "string"); + }, + isSDK(o: any): o is QueryDelegatorDelegationsRequestSDKType { + return o && (o.$typeUrl === QueryDelegatorDelegationsRequest.typeUrl || typeof o.delegator_addr === "string"); + }, + isAmino(o: any): o is QueryDelegatorDelegationsRequestAmino { + return o && (o.$typeUrl === QueryDelegatorDelegationsRequest.typeUrl || typeof o.delegator_addr === "string"); + }, encode(message: QueryDelegatorDelegationsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.delegatorAddr !== "") { writer.uint32(10).string(message.delegatorAddr); @@ -2460,6 +2638,12 @@ export const QueryDelegatorDelegationsRequest = { typeUrl: "/cosmos.staking.v1beta1.QueryDelegatorDelegationsRequest", value: QueryDelegatorDelegationsRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryDelegatorDelegationsRequest.typeUrl)) { + return; + } + PageRequest.registerTypeUrl(); } }; function createBaseQueryDelegatorDelegationsResponse(): QueryDelegatorDelegationsResponse { @@ -2478,6 +2662,15 @@ function createBaseQueryDelegatorDelegationsResponse(): QueryDelegatorDelegation export const QueryDelegatorDelegationsResponse = { typeUrl: "/cosmos.staking.v1beta1.QueryDelegatorDelegationsResponse", aminoType: "cosmos-sdk/QueryDelegatorDelegationsResponse", + is(o: any): o is QueryDelegatorDelegationsResponse { + return o && (o.$typeUrl === QueryDelegatorDelegationsResponse.typeUrl || Array.isArray(o.delegationResponses) && (!o.delegationResponses.length || DelegationResponse.is(o.delegationResponses[0]))); + }, + isSDK(o: any): o is QueryDelegatorDelegationsResponseSDKType { + return o && (o.$typeUrl === QueryDelegatorDelegationsResponse.typeUrl || Array.isArray(o.delegation_responses) && (!o.delegation_responses.length || DelegationResponse.isSDK(o.delegation_responses[0]))); + }, + isAmino(o: any): o is QueryDelegatorDelegationsResponseAmino { + return o && (o.$typeUrl === QueryDelegatorDelegationsResponse.typeUrl || Array.isArray(o.delegation_responses) && (!o.delegation_responses.length || DelegationResponse.isAmino(o.delegation_responses[0]))); + }, encode(message: QueryDelegatorDelegationsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.delegationResponses) { DelegationResponse.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -2566,6 +2759,13 @@ export const QueryDelegatorDelegationsResponse = { typeUrl: "/cosmos.staking.v1beta1.QueryDelegatorDelegationsResponse", value: QueryDelegatorDelegationsResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryDelegatorDelegationsResponse.typeUrl)) { + return; + } + DelegationResponse.registerTypeUrl(); + PageResponse.registerTypeUrl(); } }; function createBaseQueryDelegatorUnbondingDelegationsRequest(): QueryDelegatorUnbondingDelegationsRequest { @@ -2584,6 +2784,15 @@ function createBaseQueryDelegatorUnbondingDelegationsRequest(): QueryDelegatorUn export const QueryDelegatorUnbondingDelegationsRequest = { typeUrl: "/cosmos.staking.v1beta1.QueryDelegatorUnbondingDelegationsRequest", aminoType: "cosmos-sdk/QueryDelegatorUnbondingDelegationsRequest", + is(o: any): o is QueryDelegatorUnbondingDelegationsRequest { + return o && (o.$typeUrl === QueryDelegatorUnbondingDelegationsRequest.typeUrl || typeof o.delegatorAddr === "string"); + }, + isSDK(o: any): o is QueryDelegatorUnbondingDelegationsRequestSDKType { + return o && (o.$typeUrl === QueryDelegatorUnbondingDelegationsRequest.typeUrl || typeof o.delegator_addr === "string"); + }, + isAmino(o: any): o is QueryDelegatorUnbondingDelegationsRequestAmino { + return o && (o.$typeUrl === QueryDelegatorUnbondingDelegationsRequest.typeUrl || typeof o.delegator_addr === "string"); + }, encode(message: QueryDelegatorUnbondingDelegationsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.delegatorAddr !== "") { writer.uint32(10).string(message.delegatorAddr); @@ -2666,6 +2875,12 @@ export const QueryDelegatorUnbondingDelegationsRequest = { typeUrl: "/cosmos.staking.v1beta1.QueryDelegatorUnbondingDelegationsRequest", value: QueryDelegatorUnbondingDelegationsRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryDelegatorUnbondingDelegationsRequest.typeUrl)) { + return; + } + PageRequest.registerTypeUrl(); } }; function createBaseQueryDelegatorUnbondingDelegationsResponse(): QueryDelegatorUnbondingDelegationsResponse { @@ -2684,6 +2899,15 @@ function createBaseQueryDelegatorUnbondingDelegationsResponse(): QueryDelegatorU export const QueryDelegatorUnbondingDelegationsResponse = { typeUrl: "/cosmos.staking.v1beta1.QueryDelegatorUnbondingDelegationsResponse", aminoType: "cosmos-sdk/QueryDelegatorUnbondingDelegationsResponse", + is(o: any): o is QueryDelegatorUnbondingDelegationsResponse { + return o && (o.$typeUrl === QueryDelegatorUnbondingDelegationsResponse.typeUrl || Array.isArray(o.unbondingResponses) && (!o.unbondingResponses.length || UnbondingDelegation.is(o.unbondingResponses[0]))); + }, + isSDK(o: any): o is QueryDelegatorUnbondingDelegationsResponseSDKType { + return o && (o.$typeUrl === QueryDelegatorUnbondingDelegationsResponse.typeUrl || Array.isArray(o.unbonding_responses) && (!o.unbonding_responses.length || UnbondingDelegation.isSDK(o.unbonding_responses[0]))); + }, + isAmino(o: any): o is QueryDelegatorUnbondingDelegationsResponseAmino { + return o && (o.$typeUrl === QueryDelegatorUnbondingDelegationsResponse.typeUrl || Array.isArray(o.unbonding_responses) && (!o.unbonding_responses.length || UnbondingDelegation.isAmino(o.unbonding_responses[0]))); + }, encode(message: QueryDelegatorUnbondingDelegationsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.unbondingResponses) { UnbondingDelegation.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -2772,6 +2996,13 @@ export const QueryDelegatorUnbondingDelegationsResponse = { typeUrl: "/cosmos.staking.v1beta1.QueryDelegatorUnbondingDelegationsResponse", value: QueryDelegatorUnbondingDelegationsResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryDelegatorUnbondingDelegationsResponse.typeUrl)) { + return; + } + UnbondingDelegation.registerTypeUrl(); + PageResponse.registerTypeUrl(); } }; function createBaseQueryRedelegationsRequest(): QueryRedelegationsRequest { @@ -2792,6 +3023,15 @@ function createBaseQueryRedelegationsRequest(): QueryRedelegationsRequest { export const QueryRedelegationsRequest = { typeUrl: "/cosmos.staking.v1beta1.QueryRedelegationsRequest", aminoType: "cosmos-sdk/QueryRedelegationsRequest", + is(o: any): o is QueryRedelegationsRequest { + return o && (o.$typeUrl === QueryRedelegationsRequest.typeUrl || typeof o.delegatorAddr === "string" && typeof o.srcValidatorAddr === "string" && typeof o.dstValidatorAddr === "string"); + }, + isSDK(o: any): o is QueryRedelegationsRequestSDKType { + return o && (o.$typeUrl === QueryRedelegationsRequest.typeUrl || typeof o.delegator_addr === "string" && typeof o.src_validator_addr === "string" && typeof o.dst_validator_addr === "string"); + }, + isAmino(o: any): o is QueryRedelegationsRequestAmino { + return o && (o.$typeUrl === QueryRedelegationsRequest.typeUrl || typeof o.delegator_addr === "string" && typeof o.src_validator_addr === "string" && typeof o.dst_validator_addr === "string"); + }, encode(message: QueryRedelegationsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.delegatorAddr !== "") { writer.uint32(10).string(message.delegatorAddr); @@ -2902,6 +3142,12 @@ export const QueryRedelegationsRequest = { typeUrl: "/cosmos.staking.v1beta1.QueryRedelegationsRequest", value: QueryRedelegationsRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryRedelegationsRequest.typeUrl)) { + return; + } + PageRequest.registerTypeUrl(); } }; function createBaseQueryRedelegationsResponse(): QueryRedelegationsResponse { @@ -2920,6 +3166,15 @@ function createBaseQueryRedelegationsResponse(): QueryRedelegationsResponse { export const QueryRedelegationsResponse = { typeUrl: "/cosmos.staking.v1beta1.QueryRedelegationsResponse", aminoType: "cosmos-sdk/QueryRedelegationsResponse", + is(o: any): o is QueryRedelegationsResponse { + return o && (o.$typeUrl === QueryRedelegationsResponse.typeUrl || Array.isArray(o.redelegationResponses) && (!o.redelegationResponses.length || RedelegationResponse.is(o.redelegationResponses[0]))); + }, + isSDK(o: any): o is QueryRedelegationsResponseSDKType { + return o && (o.$typeUrl === QueryRedelegationsResponse.typeUrl || Array.isArray(o.redelegation_responses) && (!o.redelegation_responses.length || RedelegationResponse.isSDK(o.redelegation_responses[0]))); + }, + isAmino(o: any): o is QueryRedelegationsResponseAmino { + return o && (o.$typeUrl === QueryRedelegationsResponse.typeUrl || Array.isArray(o.redelegation_responses) && (!o.redelegation_responses.length || RedelegationResponse.isAmino(o.redelegation_responses[0]))); + }, encode(message: QueryRedelegationsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.redelegationResponses) { RedelegationResponse.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -3008,6 +3263,13 @@ export const QueryRedelegationsResponse = { typeUrl: "/cosmos.staking.v1beta1.QueryRedelegationsResponse", value: QueryRedelegationsResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryRedelegationsResponse.typeUrl)) { + return; + } + RedelegationResponse.registerTypeUrl(); + PageResponse.registerTypeUrl(); } }; function createBaseQueryDelegatorValidatorsRequest(): QueryDelegatorValidatorsRequest { @@ -3026,6 +3288,15 @@ function createBaseQueryDelegatorValidatorsRequest(): QueryDelegatorValidatorsRe export const QueryDelegatorValidatorsRequest = { typeUrl: "/cosmos.staking.v1beta1.QueryDelegatorValidatorsRequest", aminoType: "cosmos-sdk/QueryDelegatorValidatorsRequest", + is(o: any): o is QueryDelegatorValidatorsRequest { + return o && (o.$typeUrl === QueryDelegatorValidatorsRequest.typeUrl || typeof o.delegatorAddr === "string"); + }, + isSDK(o: any): o is QueryDelegatorValidatorsRequestSDKType { + return o && (o.$typeUrl === QueryDelegatorValidatorsRequest.typeUrl || typeof o.delegator_addr === "string"); + }, + isAmino(o: any): o is QueryDelegatorValidatorsRequestAmino { + return o && (o.$typeUrl === QueryDelegatorValidatorsRequest.typeUrl || typeof o.delegator_addr === "string"); + }, encode(message: QueryDelegatorValidatorsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.delegatorAddr !== "") { writer.uint32(10).string(message.delegatorAddr); @@ -3108,6 +3379,12 @@ export const QueryDelegatorValidatorsRequest = { typeUrl: "/cosmos.staking.v1beta1.QueryDelegatorValidatorsRequest", value: QueryDelegatorValidatorsRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryDelegatorValidatorsRequest.typeUrl)) { + return; + } + PageRequest.registerTypeUrl(); } }; function createBaseQueryDelegatorValidatorsResponse(): QueryDelegatorValidatorsResponse { @@ -3126,6 +3403,15 @@ function createBaseQueryDelegatorValidatorsResponse(): QueryDelegatorValidatorsR export const QueryDelegatorValidatorsResponse = { typeUrl: "/cosmos.staking.v1beta1.QueryDelegatorValidatorsResponse", aminoType: "cosmos-sdk/QueryDelegatorValidatorsResponse", + is(o: any): o is QueryDelegatorValidatorsResponse { + return o && (o.$typeUrl === QueryDelegatorValidatorsResponse.typeUrl || Array.isArray(o.validators) && (!o.validators.length || Validator.is(o.validators[0]))); + }, + isSDK(o: any): o is QueryDelegatorValidatorsResponseSDKType { + return o && (o.$typeUrl === QueryDelegatorValidatorsResponse.typeUrl || Array.isArray(o.validators) && (!o.validators.length || Validator.isSDK(o.validators[0]))); + }, + isAmino(o: any): o is QueryDelegatorValidatorsResponseAmino { + return o && (o.$typeUrl === QueryDelegatorValidatorsResponse.typeUrl || Array.isArray(o.validators) && (!o.validators.length || Validator.isAmino(o.validators[0]))); + }, encode(message: QueryDelegatorValidatorsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.validators) { Validator.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -3214,6 +3500,13 @@ export const QueryDelegatorValidatorsResponse = { typeUrl: "/cosmos.staking.v1beta1.QueryDelegatorValidatorsResponse", value: QueryDelegatorValidatorsResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryDelegatorValidatorsResponse.typeUrl)) { + return; + } + Validator.registerTypeUrl(); + PageResponse.registerTypeUrl(); } }; function createBaseQueryDelegatorValidatorRequest(): QueryDelegatorValidatorRequest { @@ -3232,6 +3525,15 @@ function createBaseQueryDelegatorValidatorRequest(): QueryDelegatorValidatorRequ export const QueryDelegatorValidatorRequest = { typeUrl: "/cosmos.staking.v1beta1.QueryDelegatorValidatorRequest", aminoType: "cosmos-sdk/QueryDelegatorValidatorRequest", + is(o: any): o is QueryDelegatorValidatorRequest { + return o && (o.$typeUrl === QueryDelegatorValidatorRequest.typeUrl || typeof o.delegatorAddr === "string" && typeof o.validatorAddr === "string"); + }, + isSDK(o: any): o is QueryDelegatorValidatorRequestSDKType { + return o && (o.$typeUrl === QueryDelegatorValidatorRequest.typeUrl || typeof o.delegator_addr === "string" && typeof o.validator_addr === "string"); + }, + isAmino(o: any): o is QueryDelegatorValidatorRequestAmino { + return o && (o.$typeUrl === QueryDelegatorValidatorRequest.typeUrl || typeof o.delegator_addr === "string" && typeof o.validator_addr === "string"); + }, encode(message: QueryDelegatorValidatorRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.delegatorAddr !== "") { writer.uint32(10).string(message.delegatorAddr); @@ -3312,7 +3614,8 @@ export const QueryDelegatorValidatorRequest = { typeUrl: "/cosmos.staking.v1beta1.QueryDelegatorValidatorRequest", value: QueryDelegatorValidatorRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryDelegatorValidatorResponse(): QueryDelegatorValidatorResponse { return { @@ -3329,6 +3632,15 @@ function createBaseQueryDelegatorValidatorResponse(): QueryDelegatorValidatorRes export const QueryDelegatorValidatorResponse = { typeUrl: "/cosmos.staking.v1beta1.QueryDelegatorValidatorResponse", aminoType: "cosmos-sdk/QueryDelegatorValidatorResponse", + is(o: any): o is QueryDelegatorValidatorResponse { + return o && (o.$typeUrl === QueryDelegatorValidatorResponse.typeUrl || Validator.is(o.validator)); + }, + isSDK(o: any): o is QueryDelegatorValidatorResponseSDKType { + return o && (o.$typeUrl === QueryDelegatorValidatorResponse.typeUrl || Validator.isSDK(o.validator)); + }, + isAmino(o: any): o is QueryDelegatorValidatorResponseAmino { + return o && (o.$typeUrl === QueryDelegatorValidatorResponse.typeUrl || Validator.isAmino(o.validator)); + }, encode(message: QueryDelegatorValidatorResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.validator !== undefined) { Validator.encode(message.validator, writer.uint32(10).fork()).ldelim(); @@ -3397,6 +3709,12 @@ export const QueryDelegatorValidatorResponse = { typeUrl: "/cosmos.staking.v1beta1.QueryDelegatorValidatorResponse", value: QueryDelegatorValidatorResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryDelegatorValidatorResponse.typeUrl)) { + return; + } + Validator.registerTypeUrl(); } }; function createBaseQueryHistoricalInfoRequest(): QueryHistoricalInfoRequest { @@ -3414,6 +3732,15 @@ function createBaseQueryHistoricalInfoRequest(): QueryHistoricalInfoRequest { export const QueryHistoricalInfoRequest = { typeUrl: "/cosmos.staking.v1beta1.QueryHistoricalInfoRequest", aminoType: "cosmos-sdk/QueryHistoricalInfoRequest", + is(o: any): o is QueryHistoricalInfoRequest { + return o && (o.$typeUrl === QueryHistoricalInfoRequest.typeUrl || typeof o.height === "bigint"); + }, + isSDK(o: any): o is QueryHistoricalInfoRequestSDKType { + return o && (o.$typeUrl === QueryHistoricalInfoRequest.typeUrl || typeof o.height === "bigint"); + }, + isAmino(o: any): o is QueryHistoricalInfoRequestAmino { + return o && (o.$typeUrl === QueryHistoricalInfoRequest.typeUrl || typeof o.height === "bigint"); + }, encode(message: QueryHistoricalInfoRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.height !== BigInt(0)) { writer.uint32(8).int64(message.height); @@ -3482,7 +3809,8 @@ export const QueryHistoricalInfoRequest = { typeUrl: "/cosmos.staking.v1beta1.QueryHistoricalInfoRequest", value: QueryHistoricalInfoRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryHistoricalInfoResponse(): QueryHistoricalInfoResponse { return { @@ -3499,6 +3827,15 @@ function createBaseQueryHistoricalInfoResponse(): QueryHistoricalInfoResponse { export const QueryHistoricalInfoResponse = { typeUrl: "/cosmos.staking.v1beta1.QueryHistoricalInfoResponse", aminoType: "cosmos-sdk/QueryHistoricalInfoResponse", + is(o: any): o is QueryHistoricalInfoResponse { + return o && o.$typeUrl === QueryHistoricalInfoResponse.typeUrl; + }, + isSDK(o: any): o is QueryHistoricalInfoResponseSDKType { + return o && o.$typeUrl === QueryHistoricalInfoResponse.typeUrl; + }, + isAmino(o: any): o is QueryHistoricalInfoResponseAmino { + return o && o.$typeUrl === QueryHistoricalInfoResponse.typeUrl; + }, encode(message: QueryHistoricalInfoResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.hist !== undefined) { HistoricalInfo.encode(message.hist, writer.uint32(10).fork()).ldelim(); @@ -3567,6 +3904,12 @@ export const QueryHistoricalInfoResponse = { typeUrl: "/cosmos.staking.v1beta1.QueryHistoricalInfoResponse", value: QueryHistoricalInfoResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryHistoricalInfoResponse.typeUrl)) { + return; + } + HistoricalInfo.registerTypeUrl(); } }; function createBaseQueryPoolRequest(): QueryPoolRequest { @@ -3581,6 +3924,15 @@ function createBaseQueryPoolRequest(): QueryPoolRequest { export const QueryPoolRequest = { typeUrl: "/cosmos.staking.v1beta1.QueryPoolRequest", aminoType: "cosmos-sdk/QueryPoolRequest", + is(o: any): o is QueryPoolRequest { + return o && o.$typeUrl === QueryPoolRequest.typeUrl; + }, + isSDK(o: any): o is QueryPoolRequestSDKType { + return o && o.$typeUrl === QueryPoolRequest.typeUrl; + }, + isAmino(o: any): o is QueryPoolRequestAmino { + return o && o.$typeUrl === QueryPoolRequest.typeUrl; + }, encode(_: QueryPoolRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -3632,7 +3984,8 @@ export const QueryPoolRequest = { typeUrl: "/cosmos.staking.v1beta1.QueryPoolRequest", value: QueryPoolRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryPoolResponse(): QueryPoolResponse { return { @@ -3648,6 +4001,15 @@ function createBaseQueryPoolResponse(): QueryPoolResponse { export const QueryPoolResponse = { typeUrl: "/cosmos.staking.v1beta1.QueryPoolResponse", aminoType: "cosmos-sdk/QueryPoolResponse", + is(o: any): o is QueryPoolResponse { + return o && (o.$typeUrl === QueryPoolResponse.typeUrl || Pool.is(o.pool)); + }, + isSDK(o: any): o is QueryPoolResponseSDKType { + return o && (o.$typeUrl === QueryPoolResponse.typeUrl || Pool.isSDK(o.pool)); + }, + isAmino(o: any): o is QueryPoolResponseAmino { + return o && (o.$typeUrl === QueryPoolResponse.typeUrl || Pool.isAmino(o.pool)); + }, encode(message: QueryPoolResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.pool !== undefined) { Pool.encode(message.pool, writer.uint32(10).fork()).ldelim(); @@ -3716,6 +4078,12 @@ export const QueryPoolResponse = { typeUrl: "/cosmos.staking.v1beta1.QueryPoolResponse", value: QueryPoolResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryPoolResponse.typeUrl)) { + return; + } + Pool.registerTypeUrl(); } }; function createBaseQueryParamsRequest(): QueryParamsRequest { @@ -3730,6 +4098,15 @@ function createBaseQueryParamsRequest(): QueryParamsRequest { export const QueryParamsRequest = { typeUrl: "/cosmos.staking.v1beta1.QueryParamsRequest", aminoType: "cosmos-sdk/QueryParamsRequest", + is(o: any): o is QueryParamsRequest { + return o && o.$typeUrl === QueryParamsRequest.typeUrl; + }, + isSDK(o: any): o is QueryParamsRequestSDKType { + return o && o.$typeUrl === QueryParamsRequest.typeUrl; + }, + isAmino(o: any): o is QueryParamsRequestAmino { + return o && o.$typeUrl === QueryParamsRequest.typeUrl; + }, encode(_: QueryParamsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -3781,7 +4158,8 @@ export const QueryParamsRequest = { typeUrl: "/cosmos.staking.v1beta1.QueryParamsRequest", value: QueryParamsRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryParamsResponse(): QueryParamsResponse { return { @@ -3797,6 +4175,15 @@ function createBaseQueryParamsResponse(): QueryParamsResponse { export const QueryParamsResponse = { typeUrl: "/cosmos.staking.v1beta1.QueryParamsResponse", aminoType: "cosmos-sdk/QueryParamsResponse", + is(o: any): o is QueryParamsResponse { + return o && (o.$typeUrl === QueryParamsResponse.typeUrl || Params.is(o.params)); + }, + isSDK(o: any): o is QueryParamsResponseSDKType { + return o && (o.$typeUrl === QueryParamsResponse.typeUrl || Params.isSDK(o.params)); + }, + isAmino(o: any): o is QueryParamsResponseAmino { + return o && (o.$typeUrl === QueryParamsResponse.typeUrl || Params.isAmino(o.params)); + }, encode(message: QueryParamsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.params !== undefined) { Params.encode(message.params, writer.uint32(10).fork()).ldelim(); @@ -3865,5 +4252,11 @@ export const QueryParamsResponse = { typeUrl: "/cosmos.staking.v1beta1.QueryParamsResponse", value: QueryParamsResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryParamsResponse.typeUrl)) { + return; + } + Params.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/cosmos/staking/v1beta1/staking.ts b/__fixtures__/v-next/outputv3/cosmos/staking/v1beta1/staking.ts index ae9d613d5e..07bf37a67d 100644 --- a/__fixtures__/v-next/outputv3/cosmos/staking/v1beta1/staking.ts +++ b/__fixtures__/v-next/outputv3/cosmos/staking/v1beta1/staking.ts @@ -4,10 +4,10 @@ import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../google/protobuf import { Duration, DurationAmino, DurationSDKType } from "../../../google/protobuf/duration"; import { Coin, CoinAmino, CoinSDKType } from "../../base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; +import { GlobalDecoderRegistry } from "../../../registry"; import { isSet, DeepPartial, toTimestamp, fromTimestamp } from "../../../helpers"; -import { Decimal } from "@cosmjs/math"; -import { encodePubkey, decodePubkey } from "@cosmjs/proto-signing"; -import { Pubkey } from "@cosmjs/amino"; +import { Decimal } from "@interchainjs/math"; +import { encodePubkey, decodePubkey } from "@interchainjs/pubkey"; export const protobufPackage = "cosmos.staking.v1beta1"; /** BondStatus is the status of a validator. */ export enum BondStatus { @@ -1179,6 +1179,15 @@ function createBaseHistoricalInfo(): HistoricalInfo { export const HistoricalInfo = { typeUrl: "/cosmos.staking.v1beta1.HistoricalInfo", aminoType: "cosmos-sdk/HistoricalInfo", + is(o: any): o is HistoricalInfo { + return o && (o.$typeUrl === HistoricalInfo.typeUrl || Header.is(o.header) && Array.isArray(o.valset) && (!o.valset.length || Validator.is(o.valset[0]))); + }, + isSDK(o: any): o is HistoricalInfoSDKType { + return o && (o.$typeUrl === HistoricalInfo.typeUrl || Header.isSDK(o.header) && Array.isArray(o.valset) && (!o.valset.length || Validator.isSDK(o.valset[0]))); + }, + isAmino(o: any): o is HistoricalInfoAmino { + return o && (o.$typeUrl === HistoricalInfo.typeUrl || Header.isAmino(o.header) && Array.isArray(o.valset) && (!o.valset.length || Validator.isAmino(o.valset[0]))); + }, encode(message: HistoricalInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.header !== undefined) { Header.encode(message.header, writer.uint32(10).fork()).ldelim(); @@ -1267,6 +1276,13 @@ export const HistoricalInfo = { typeUrl: "/cosmos.staking.v1beta1.HistoricalInfo", value: HistoricalInfo.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(HistoricalInfo.typeUrl)) { + return; + } + Header.registerTypeUrl(); + Validator.registerTypeUrl(); } }; function createBaseCommissionRates(): CommissionRates { @@ -1286,6 +1302,15 @@ function createBaseCommissionRates(): CommissionRates { export const CommissionRates = { typeUrl: "/cosmos.staking.v1beta1.CommissionRates", aminoType: "cosmos-sdk/CommissionRates", + is(o: any): o is CommissionRates { + return o && (o.$typeUrl === CommissionRates.typeUrl || typeof o.rate === "string" && typeof o.maxRate === "string" && typeof o.maxChangeRate === "string"); + }, + isSDK(o: any): o is CommissionRatesSDKType { + return o && (o.$typeUrl === CommissionRates.typeUrl || typeof o.rate === "string" && typeof o.max_rate === "string" && typeof o.max_change_rate === "string"); + }, + isAmino(o: any): o is CommissionRatesAmino { + return o && (o.$typeUrl === CommissionRates.typeUrl || typeof o.rate === "string" && typeof o.max_rate === "string" && typeof o.max_change_rate === "string"); + }, encode(message: CommissionRates, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.rate !== "") { writer.uint32(10).string(Decimal.fromUserInput(message.rate, 18).atomics); @@ -1364,9 +1389,9 @@ export const CommissionRates = { }, toAmino(message: CommissionRates, useInterfaces: boolean = true): CommissionRatesAmino { const obj: any = {}; - obj.rate = message.rate === "" ? undefined : message.rate; - obj.max_rate = message.maxRate === "" ? undefined : message.maxRate; - obj.max_change_rate = message.maxChangeRate === "" ? undefined : message.maxChangeRate; + obj.rate = message.rate === "" ? undefined : Decimal.fromUserInput(message.rate, 18).atomics; + obj.max_rate = message.maxRate === "" ? undefined : Decimal.fromUserInput(message.maxRate, 18).atomics; + obj.max_change_rate = message.maxChangeRate === "" ? undefined : Decimal.fromUserInput(message.maxChangeRate, 18).atomics; return obj; }, fromProtoMsg(message: CommissionRatesProtoMsg, useInterfaces: boolean = true): CommissionRates { @@ -1380,7 +1405,8 @@ export const CommissionRates = { typeUrl: "/cosmos.staking.v1beta1.CommissionRates", value: CommissionRates.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseCommission(): Commission { return { @@ -1397,6 +1423,15 @@ function createBaseCommission(): Commission { export const Commission = { typeUrl: "/cosmos.staking.v1beta1.Commission", aminoType: "cosmos-sdk/Commission", + is(o: any): o is Commission { + return o && (o.$typeUrl === Commission.typeUrl || CommissionRates.is(o.commissionRates) && Timestamp.is(o.updateTime)); + }, + isSDK(o: any): o is CommissionSDKType { + return o && (o.$typeUrl === Commission.typeUrl || CommissionRates.isSDK(o.commission_rates) && Timestamp.isSDK(o.update_time)); + }, + isAmino(o: any): o is CommissionAmino { + return o && (o.$typeUrl === Commission.typeUrl || CommissionRates.isAmino(o.commission_rates) && Timestamp.isAmino(o.update_time)); + }, encode(message: Commission, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.commissionRates !== undefined) { CommissionRates.encode(message.commissionRates, writer.uint32(10).fork()).ldelim(); @@ -1479,6 +1514,12 @@ export const Commission = { typeUrl: "/cosmos.staking.v1beta1.Commission", value: Commission.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Commission.typeUrl)) { + return; + } + CommissionRates.registerTypeUrl(); } }; function createBaseDescription(): Description { @@ -1499,6 +1540,15 @@ function createBaseDescription(): Description { export const Description = { typeUrl: "/cosmos.staking.v1beta1.Description", aminoType: "cosmos-sdk/Description", + is(o: any): o is Description { + return o && (o.$typeUrl === Description.typeUrl || typeof o.moniker === "string" && typeof o.identity === "string" && typeof o.website === "string" && typeof o.securityContact === "string" && typeof o.details === "string"); + }, + isSDK(o: any): o is DescriptionSDKType { + return o && (o.$typeUrl === Description.typeUrl || typeof o.moniker === "string" && typeof o.identity === "string" && typeof o.website === "string" && typeof o.security_contact === "string" && typeof o.details === "string"); + }, + isAmino(o: any): o is DescriptionAmino { + return o && (o.$typeUrl === Description.typeUrl || typeof o.moniker === "string" && typeof o.identity === "string" && typeof o.website === "string" && typeof o.security_contact === "string" && typeof o.details === "string"); + }, encode(message: Description, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.moniker !== "") { writer.uint32(10).string(message.moniker); @@ -1621,7 +1671,8 @@ export const Description = { typeUrl: "/cosmos.staking.v1beta1.Description", value: Description.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseValidator(): Validator { return { @@ -1654,12 +1705,21 @@ function createBaseValidator(): Validator { export const Validator = { typeUrl: "/cosmos.staking.v1beta1.Validator", aminoType: "cosmos-sdk/Validator", + is(o: any): o is Validator { + return o && (o.$typeUrl === Validator.typeUrl || typeof o.operatorAddress === "string" && typeof o.jailed === "boolean" && isSet(o.status) && typeof o.tokens === "string" && typeof o.delegatorShares === "string" && Description.is(o.description) && typeof o.unbondingHeight === "bigint" && Timestamp.is(o.unbondingTime) && Commission.is(o.commission) && typeof o.minSelfDelegation === "string"); + }, + isSDK(o: any): o is ValidatorSDKType { + return o && (o.$typeUrl === Validator.typeUrl || typeof o.operator_address === "string" && typeof o.jailed === "boolean" && isSet(o.status) && typeof o.tokens === "string" && typeof o.delegator_shares === "string" && Description.isSDK(o.description) && typeof o.unbonding_height === "bigint" && Timestamp.isSDK(o.unbonding_time) && Commission.isSDK(o.commission) && typeof o.min_self_delegation === "string"); + }, + isAmino(o: any): o is ValidatorAmino { + return o && (o.$typeUrl === Validator.typeUrl || typeof o.operator_address === "string" && typeof o.jailed === "boolean" && isSet(o.status) && typeof o.tokens === "string" && typeof o.delegator_shares === "string" && Description.isAmino(o.description) && typeof o.unbonding_height === "bigint" && Timestamp.isAmino(o.unbonding_time) && Commission.isAmino(o.commission) && typeof o.min_self_delegation === "string"); + }, encode(message: Validator, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.operatorAddress !== "") { writer.uint32(10).string(message.operatorAddress); } if (message.consensusPubkey !== undefined) { - Any.encode((message.consensusPubkey as Any), writer.uint32(18).fork()).ldelim(); + Any.encode(GlobalDecoderRegistry.wrapAny(message.consensusPubkey), writer.uint32(18).fork()).ldelim(); } if (message.jailed === true) { writer.uint32(24).bool(message.jailed); @@ -1701,7 +1761,7 @@ export const Validator = { message.operatorAddress = reader.string(); break; case 2: - message.consensusPubkey = useInterfaces ? (Cosmos_cryptoPubKey_InterfaceDecoder(reader) as Any) : Any.decode(reader, reader.uint32(), useInterfaces); + message.consensusPubkey = GlobalDecoderRegistry.unwrapAny(reader); break; case 3: message.jailed = reader.bool(); @@ -1740,7 +1800,7 @@ export const Validator = { fromJSON(object: any): Validator { const obj = createBaseValidator(); if (isSet(object.operatorAddress)) obj.operatorAddress = String(object.operatorAddress); - if (isSet(object.consensusPubkey)) obj.consensusPubkey = Any.fromJSON(object.consensusPubkey); + if (isSet(object.consensusPubkey)) obj.consensusPubkey = GlobalDecoderRegistry.fromJSON(object.consensusPubkey); if (isSet(object.jailed)) obj.jailed = Boolean(object.jailed); if (isSet(object.status)) obj.status = bondStatusFromJSON(object.status); if (isSet(object.tokens)) obj.tokens = String(object.tokens); @@ -1756,7 +1816,7 @@ export const Validator = { const message = createBaseValidator(); message.operatorAddress = object.operatorAddress ?? ""; if (object.consensusPubkey !== undefined && object.consensusPubkey !== null) { - message.consensusPubkey = Any.fromPartial(object.consensusPubkey); + message.consensusPubkey = GlobalDecoderRegistry.fromPartial(object.consensusPubkey); } message.jailed = object.jailed ?? false; message.status = object.status ?? 0; @@ -1778,7 +1838,7 @@ export const Validator = { fromSDK(object: ValidatorSDKType): Validator { return { operatorAddress: object?.operator_address, - consensusPubkey: object.consensus_pubkey ? Any.fromSDK(object.consensus_pubkey) : undefined, + consensusPubkey: object.consensus_pubkey ? GlobalDecoderRegistry.fromSDK(object.consensus_pubkey) : undefined, jailed: object?.jailed, status: isSet(object.status) ? bondStatusFromJSON(object.status) : -1, tokens: object?.tokens, @@ -1793,7 +1853,7 @@ export const Validator = { toSDK(message: Validator): ValidatorSDKType { const obj: any = {}; obj.operator_address = message.operatorAddress; - message.consensusPubkey !== undefined && (obj.consensus_pubkey = message.consensusPubkey ? Any.toSDK(message.consensusPubkey) : undefined); + message.consensusPubkey !== undefined && (obj.consensus_pubkey = message.consensusPubkey ? GlobalDecoderRegistry.toSDK(message.consensusPubkey) : undefined); obj.jailed = message.jailed; message.status !== undefined && (obj.status = bondStatusToJSON(message.status)); obj.tokens = message.tokens; @@ -1849,7 +1909,7 @@ export const Validator = { obj.jailed = message.jailed === false ? undefined : message.jailed; obj.status = message.status === 0 ? undefined : message.status; obj.tokens = message.tokens === "" ? undefined : message.tokens; - obj.delegator_shares = message.delegatorShares === "" ? undefined : message.delegatorShares; + obj.delegator_shares = message.delegatorShares === "" ? undefined : Decimal.fromUserInput(message.delegatorShares, 18).atomics; obj.description = message.description ? Description.toAmino(message.description, useInterfaces) : undefined; obj.unbonding_height = message.unbondingHeight !== BigInt(0) ? message.unbondingHeight?.toString() : undefined; obj.unbonding_time = message.unbondingTime ? Timestamp.toAmino(toTimestamp(message.unbondingTime)) : undefined; @@ -1868,6 +1928,13 @@ export const Validator = { typeUrl: "/cosmos.staking.v1beta1.Validator", value: Validator.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Validator.typeUrl)) { + return; + } + Description.registerTypeUrl(); + Commission.registerTypeUrl(); } }; function createBaseValAddresses(): ValAddresses { @@ -1884,6 +1951,15 @@ function createBaseValAddresses(): ValAddresses { export const ValAddresses = { typeUrl: "/cosmos.staking.v1beta1.ValAddresses", aminoType: "cosmos-sdk/ValAddresses", + is(o: any): o is ValAddresses { + return o && (o.$typeUrl === ValAddresses.typeUrl || Array.isArray(o.addresses) && (!o.addresses.length || typeof o.addresses[0] === "string")); + }, + isSDK(o: any): o is ValAddressesSDKType { + return o && (o.$typeUrl === ValAddresses.typeUrl || Array.isArray(o.addresses) && (!o.addresses.length || typeof o.addresses[0] === "string")); + }, + isAmino(o: any): o is ValAddressesAmino { + return o && (o.$typeUrl === ValAddresses.typeUrl || Array.isArray(o.addresses) && (!o.addresses.length || typeof o.addresses[0] === "string")); + }, encode(message: ValAddresses, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.addresses) { writer.uint32(10).string(v!); @@ -1956,7 +2032,8 @@ export const ValAddresses = { typeUrl: "/cosmos.staking.v1beta1.ValAddresses", value: ValAddresses.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseDVPair(): DVPair { return { @@ -1975,6 +2052,15 @@ function createBaseDVPair(): DVPair { export const DVPair = { typeUrl: "/cosmos.staking.v1beta1.DVPair", aminoType: "cosmos-sdk/DVPair", + is(o: any): o is DVPair { + return o && (o.$typeUrl === DVPair.typeUrl || typeof o.delegatorAddress === "string" && typeof o.validatorAddress === "string"); + }, + isSDK(o: any): o is DVPairSDKType { + return o && (o.$typeUrl === DVPair.typeUrl || typeof o.delegator_address === "string" && typeof o.validator_address === "string"); + }, + isAmino(o: any): o is DVPairAmino { + return o && (o.$typeUrl === DVPair.typeUrl || typeof o.delegator_address === "string" && typeof o.validator_address === "string"); + }, encode(message: DVPair, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.delegatorAddress !== "") { writer.uint32(10).string(message.delegatorAddress); @@ -2055,7 +2141,8 @@ export const DVPair = { typeUrl: "/cosmos.staking.v1beta1.DVPair", value: DVPair.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseDVPairs(): DVPairs { return { @@ -2071,6 +2158,15 @@ function createBaseDVPairs(): DVPairs { export const DVPairs = { typeUrl: "/cosmos.staking.v1beta1.DVPairs", aminoType: "cosmos-sdk/DVPairs", + is(o: any): o is DVPairs { + return o && (o.$typeUrl === DVPairs.typeUrl || Array.isArray(o.pairs) && (!o.pairs.length || DVPair.is(o.pairs[0]))); + }, + isSDK(o: any): o is DVPairsSDKType { + return o && (o.$typeUrl === DVPairs.typeUrl || Array.isArray(o.pairs) && (!o.pairs.length || DVPair.isSDK(o.pairs[0]))); + }, + isAmino(o: any): o is DVPairsAmino { + return o && (o.$typeUrl === DVPairs.typeUrl || Array.isArray(o.pairs) && (!o.pairs.length || DVPair.isAmino(o.pairs[0]))); + }, encode(message: DVPairs, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.pairs) { DVPair.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -2143,6 +2239,12 @@ export const DVPairs = { typeUrl: "/cosmos.staking.v1beta1.DVPairs", value: DVPairs.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(DVPairs.typeUrl)) { + return; + } + DVPair.registerTypeUrl(); } }; function createBaseDVVTriplet(): DVVTriplet { @@ -2164,6 +2266,15 @@ function createBaseDVVTriplet(): DVVTriplet { export const DVVTriplet = { typeUrl: "/cosmos.staking.v1beta1.DVVTriplet", aminoType: "cosmos-sdk/DVVTriplet", + is(o: any): o is DVVTriplet { + return o && (o.$typeUrl === DVVTriplet.typeUrl || typeof o.delegatorAddress === "string" && typeof o.validatorSrcAddress === "string" && typeof o.validatorDstAddress === "string"); + }, + isSDK(o: any): o is DVVTripletSDKType { + return o && (o.$typeUrl === DVVTriplet.typeUrl || typeof o.delegator_address === "string" && typeof o.validator_src_address === "string" && typeof o.validator_dst_address === "string"); + }, + isAmino(o: any): o is DVVTripletAmino { + return o && (o.$typeUrl === DVVTriplet.typeUrl || typeof o.delegator_address === "string" && typeof o.validator_src_address === "string" && typeof o.validator_dst_address === "string"); + }, encode(message: DVVTriplet, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.delegatorAddress !== "") { writer.uint32(10).string(message.delegatorAddress); @@ -2258,7 +2369,8 @@ export const DVVTriplet = { typeUrl: "/cosmos.staking.v1beta1.DVVTriplet", value: DVVTriplet.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseDVVTriplets(): DVVTriplets { return { @@ -2274,6 +2386,15 @@ function createBaseDVVTriplets(): DVVTriplets { export const DVVTriplets = { typeUrl: "/cosmos.staking.v1beta1.DVVTriplets", aminoType: "cosmos-sdk/DVVTriplets", + is(o: any): o is DVVTriplets { + return o && (o.$typeUrl === DVVTriplets.typeUrl || Array.isArray(o.triplets) && (!o.triplets.length || DVVTriplet.is(o.triplets[0]))); + }, + isSDK(o: any): o is DVVTripletsSDKType { + return o && (o.$typeUrl === DVVTriplets.typeUrl || Array.isArray(o.triplets) && (!o.triplets.length || DVVTriplet.isSDK(o.triplets[0]))); + }, + isAmino(o: any): o is DVVTripletsAmino { + return o && (o.$typeUrl === DVVTriplets.typeUrl || Array.isArray(o.triplets) && (!o.triplets.length || DVVTriplet.isAmino(o.triplets[0]))); + }, encode(message: DVVTriplets, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.triplets) { DVVTriplet.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -2346,6 +2467,12 @@ export const DVVTriplets = { typeUrl: "/cosmos.staking.v1beta1.DVVTriplets", value: DVVTriplets.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(DVVTriplets.typeUrl)) { + return; + } + DVVTriplet.registerTypeUrl(); } }; function createBaseDelegation(): Delegation { @@ -2366,6 +2493,15 @@ function createBaseDelegation(): Delegation { export const Delegation = { typeUrl: "/cosmos.staking.v1beta1.Delegation", aminoType: "cosmos-sdk/Delegation", + is(o: any): o is Delegation { + return o && (o.$typeUrl === Delegation.typeUrl || typeof o.delegatorAddress === "string" && typeof o.validatorAddress === "string" && typeof o.shares === "string"); + }, + isSDK(o: any): o is DelegationSDKType { + return o && (o.$typeUrl === Delegation.typeUrl || typeof o.delegator_address === "string" && typeof o.validator_address === "string" && typeof o.shares === "string"); + }, + isAmino(o: any): o is DelegationAmino { + return o && (o.$typeUrl === Delegation.typeUrl || typeof o.delegator_address === "string" && typeof o.validator_address === "string" && typeof o.shares === "string"); + }, encode(message: Delegation, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.delegatorAddress !== "") { writer.uint32(10).string(message.delegatorAddress); @@ -2446,7 +2582,7 @@ export const Delegation = { const obj: any = {}; obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; - obj.shares = message.shares === "" ? undefined : message.shares; + obj.shares = message.shares === "" ? undefined : Decimal.fromUserInput(message.shares, 18).atomics; return obj; }, fromProtoMsg(message: DelegationProtoMsg, useInterfaces: boolean = true): Delegation { @@ -2460,7 +2596,8 @@ export const Delegation = { typeUrl: "/cosmos.staking.v1beta1.Delegation", value: Delegation.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseUnbondingDelegation(): UnbondingDelegation { return { @@ -2479,6 +2616,15 @@ function createBaseUnbondingDelegation(): UnbondingDelegation { export const UnbondingDelegation = { typeUrl: "/cosmos.staking.v1beta1.UnbondingDelegation", aminoType: "cosmos-sdk/UnbondingDelegation", + is(o: any): o is UnbondingDelegation { + return o && (o.$typeUrl === UnbondingDelegation.typeUrl || typeof o.delegatorAddress === "string" && typeof o.validatorAddress === "string" && Array.isArray(o.entries) && (!o.entries.length || UnbondingDelegationEntry.is(o.entries[0]))); + }, + isSDK(o: any): o is UnbondingDelegationSDKType { + return o && (o.$typeUrl === UnbondingDelegation.typeUrl || typeof o.delegator_address === "string" && typeof o.validator_address === "string" && Array.isArray(o.entries) && (!o.entries.length || UnbondingDelegationEntry.isSDK(o.entries[0]))); + }, + isAmino(o: any): o is UnbondingDelegationAmino { + return o && (o.$typeUrl === UnbondingDelegation.typeUrl || typeof o.delegator_address === "string" && typeof o.validator_address === "string" && Array.isArray(o.entries) && (!o.entries.length || UnbondingDelegationEntry.isAmino(o.entries[0]))); + }, encode(message: UnbondingDelegation, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.delegatorAddress !== "") { writer.uint32(10).string(message.delegatorAddress); @@ -2579,6 +2725,12 @@ export const UnbondingDelegation = { typeUrl: "/cosmos.staking.v1beta1.UnbondingDelegation", value: UnbondingDelegation.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(UnbondingDelegation.typeUrl)) { + return; + } + UnbondingDelegationEntry.registerTypeUrl(); } }; function createBaseUnbondingDelegationEntry(): UnbondingDelegationEntry { @@ -2598,6 +2750,15 @@ function createBaseUnbondingDelegationEntry(): UnbondingDelegationEntry { export const UnbondingDelegationEntry = { typeUrl: "/cosmos.staking.v1beta1.UnbondingDelegationEntry", aminoType: "cosmos-sdk/UnbondingDelegationEntry", + is(o: any): o is UnbondingDelegationEntry { + return o && (o.$typeUrl === UnbondingDelegationEntry.typeUrl || typeof o.creationHeight === "bigint" && Timestamp.is(o.completionTime) && typeof o.initialBalance === "string" && typeof o.balance === "string"); + }, + isSDK(o: any): o is UnbondingDelegationEntrySDKType { + return o && (o.$typeUrl === UnbondingDelegationEntry.typeUrl || typeof o.creation_height === "bigint" && Timestamp.isSDK(o.completion_time) && typeof o.initial_balance === "string" && typeof o.balance === "string"); + }, + isAmino(o: any): o is UnbondingDelegationEntryAmino { + return o && (o.$typeUrl === UnbondingDelegationEntry.typeUrl || typeof o.creation_height === "bigint" && Timestamp.isAmino(o.completion_time) && typeof o.initial_balance === "string" && typeof o.balance === "string"); + }, encode(message: UnbondingDelegationEntry, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.creationHeight !== BigInt(0)) { writer.uint32(8).int64(message.creationHeight); @@ -2708,7 +2869,8 @@ export const UnbondingDelegationEntry = { typeUrl: "/cosmos.staking.v1beta1.UnbondingDelegationEntry", value: UnbondingDelegationEntry.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseRedelegationEntry(): RedelegationEntry { return { @@ -2727,6 +2889,15 @@ function createBaseRedelegationEntry(): RedelegationEntry { export const RedelegationEntry = { typeUrl: "/cosmos.staking.v1beta1.RedelegationEntry", aminoType: "cosmos-sdk/RedelegationEntry", + is(o: any): o is RedelegationEntry { + return o && (o.$typeUrl === RedelegationEntry.typeUrl || typeof o.creationHeight === "bigint" && Timestamp.is(o.completionTime) && typeof o.initialBalance === "string" && typeof o.sharesDst === "string"); + }, + isSDK(o: any): o is RedelegationEntrySDKType { + return o && (o.$typeUrl === RedelegationEntry.typeUrl || typeof o.creation_height === "bigint" && Timestamp.isSDK(o.completion_time) && typeof o.initial_balance === "string" && typeof o.shares_dst === "string"); + }, + isAmino(o: any): o is RedelegationEntryAmino { + return o && (o.$typeUrl === RedelegationEntry.typeUrl || typeof o.creation_height === "bigint" && Timestamp.isAmino(o.completion_time) && typeof o.initial_balance === "string" && typeof o.shares_dst === "string"); + }, encode(message: RedelegationEntry, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.creationHeight !== BigInt(0)) { writer.uint32(8).int64(message.creationHeight); @@ -2823,7 +2994,7 @@ export const RedelegationEntry = { obj.creation_height = message.creationHeight !== BigInt(0) ? message.creationHeight?.toString() : undefined; obj.completion_time = message.completionTime ? Timestamp.toAmino(toTimestamp(message.completionTime)) : undefined; obj.initial_balance = message.initialBalance === "" ? undefined : message.initialBalance; - obj.shares_dst = message.sharesDst === "" ? undefined : message.sharesDst; + obj.shares_dst = message.sharesDst === "" ? undefined : Decimal.fromUserInput(message.sharesDst, 18).atomics; return obj; }, fromProtoMsg(message: RedelegationEntryProtoMsg, useInterfaces: boolean = true): RedelegationEntry { @@ -2837,7 +3008,8 @@ export const RedelegationEntry = { typeUrl: "/cosmos.staking.v1beta1.RedelegationEntry", value: RedelegationEntry.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseRedelegation(): Redelegation { return { @@ -2857,6 +3029,15 @@ function createBaseRedelegation(): Redelegation { export const Redelegation = { typeUrl: "/cosmos.staking.v1beta1.Redelegation", aminoType: "cosmos-sdk/Redelegation", + is(o: any): o is Redelegation { + return o && (o.$typeUrl === Redelegation.typeUrl || typeof o.delegatorAddress === "string" && typeof o.validatorSrcAddress === "string" && typeof o.validatorDstAddress === "string" && Array.isArray(o.entries) && (!o.entries.length || RedelegationEntry.is(o.entries[0]))); + }, + isSDK(o: any): o is RedelegationSDKType { + return o && (o.$typeUrl === Redelegation.typeUrl || typeof o.delegator_address === "string" && typeof o.validator_src_address === "string" && typeof o.validator_dst_address === "string" && Array.isArray(o.entries) && (!o.entries.length || RedelegationEntry.isSDK(o.entries[0]))); + }, + isAmino(o: any): o is RedelegationAmino { + return o && (o.$typeUrl === Redelegation.typeUrl || typeof o.delegator_address === "string" && typeof o.validator_src_address === "string" && typeof o.validator_dst_address === "string" && Array.isArray(o.entries) && (!o.entries.length || RedelegationEntry.isAmino(o.entries[0]))); + }, encode(message: Redelegation, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.delegatorAddress !== "") { writer.uint32(10).string(message.delegatorAddress); @@ -2971,6 +3152,12 @@ export const Redelegation = { typeUrl: "/cosmos.staking.v1beta1.Redelegation", value: Redelegation.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Redelegation.typeUrl)) { + return; + } + RedelegationEntry.registerTypeUrl(); } }; function createBaseParams(): Params { @@ -2992,6 +3179,15 @@ function createBaseParams(): Params { export const Params = { typeUrl: "/cosmos.staking.v1beta1.Params", aminoType: "cosmos-sdk/Params", + is(o: any): o is Params { + return o && (o.$typeUrl === Params.typeUrl || Duration.is(o.unbondingTime) && typeof o.maxValidators === "number" && typeof o.maxEntries === "number" && typeof o.historicalEntries === "number" && typeof o.bondDenom === "string" && typeof o.minCommissionRate === "string"); + }, + isSDK(o: any): o is ParamsSDKType { + return o && (o.$typeUrl === Params.typeUrl || Duration.isSDK(o.unbonding_time) && typeof o.max_validators === "number" && typeof o.max_entries === "number" && typeof o.historical_entries === "number" && typeof o.bond_denom === "string" && typeof o.min_commission_rate === "string"); + }, + isAmino(o: any): o is ParamsAmino { + return o && (o.$typeUrl === Params.typeUrl || Duration.isAmino(o.unbonding_time) && typeof o.max_validators === "number" && typeof o.max_entries === "number" && typeof o.historical_entries === "number" && typeof o.bond_denom === "string" && typeof o.min_commission_rate === "string"); + }, encode(message: Params, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.unbondingTime !== undefined) { Duration.encode(message.unbondingTime, writer.uint32(10).fork()).ldelim(); @@ -3116,7 +3312,7 @@ export const Params = { obj.max_entries = message.maxEntries === 0 ? undefined : message.maxEntries; obj.historical_entries = message.historicalEntries === 0 ? undefined : message.historicalEntries; obj.bond_denom = message.bondDenom === "" ? undefined : message.bondDenom; - obj.min_commission_rate = message.minCommissionRate === "" ? undefined : message.minCommissionRate; + obj.min_commission_rate = message.minCommissionRate === "" ? undefined : Decimal.fromUserInput(message.minCommissionRate, 18).atomics; return obj; }, fromProtoMsg(message: ParamsProtoMsg, useInterfaces: boolean = true): Params { @@ -3130,7 +3326,8 @@ export const Params = { typeUrl: "/cosmos.staking.v1beta1.Params", value: Params.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseDelegationResponse(): DelegationResponse { return { @@ -3148,6 +3345,15 @@ function createBaseDelegationResponse(): DelegationResponse { export const DelegationResponse = { typeUrl: "/cosmos.staking.v1beta1.DelegationResponse", aminoType: "cosmos-sdk/DelegationResponse", + is(o: any): o is DelegationResponse { + return o && (o.$typeUrl === DelegationResponse.typeUrl || Delegation.is(o.delegation) && Coin.is(o.balance)); + }, + isSDK(o: any): o is DelegationResponseSDKType { + return o && (o.$typeUrl === DelegationResponse.typeUrl || Delegation.isSDK(o.delegation) && Coin.isSDK(o.balance)); + }, + isAmino(o: any): o is DelegationResponseAmino { + return o && (o.$typeUrl === DelegationResponse.typeUrl || Delegation.isAmino(o.delegation) && Coin.isAmino(o.balance)); + }, encode(message: DelegationResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.delegation !== undefined) { Delegation.encode(message.delegation, writer.uint32(10).fork()).ldelim(); @@ -3232,6 +3438,13 @@ export const DelegationResponse = { typeUrl: "/cosmos.staking.v1beta1.DelegationResponse", value: DelegationResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(DelegationResponse.typeUrl)) { + return; + } + Delegation.registerTypeUrl(); + Coin.registerTypeUrl(); } }; function createBaseRedelegationEntryResponse(): RedelegationEntryResponse { @@ -3251,6 +3464,15 @@ function createBaseRedelegationEntryResponse(): RedelegationEntryResponse { export const RedelegationEntryResponse = { typeUrl: "/cosmos.staking.v1beta1.RedelegationEntryResponse", aminoType: "cosmos-sdk/RedelegationEntryResponse", + is(o: any): o is RedelegationEntryResponse { + return o && (o.$typeUrl === RedelegationEntryResponse.typeUrl || RedelegationEntry.is(o.redelegationEntry) && typeof o.balance === "string"); + }, + isSDK(o: any): o is RedelegationEntryResponseSDKType { + return o && (o.$typeUrl === RedelegationEntryResponse.typeUrl || RedelegationEntry.isSDK(o.redelegation_entry) && typeof o.balance === "string"); + }, + isAmino(o: any): o is RedelegationEntryResponseAmino { + return o && (o.$typeUrl === RedelegationEntryResponse.typeUrl || RedelegationEntry.isAmino(o.redelegation_entry) && typeof o.balance === "string"); + }, encode(message: RedelegationEntryResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.redelegationEntry !== undefined) { RedelegationEntry.encode(message.redelegationEntry, writer.uint32(10).fork()).ldelim(); @@ -3333,6 +3555,12 @@ export const RedelegationEntryResponse = { typeUrl: "/cosmos.staking.v1beta1.RedelegationEntryResponse", value: RedelegationEntryResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(RedelegationEntryResponse.typeUrl)) { + return; + } + RedelegationEntry.registerTypeUrl(); } }; function createBaseRedelegationResponse(): RedelegationResponse { @@ -3352,6 +3580,15 @@ function createBaseRedelegationResponse(): RedelegationResponse { export const RedelegationResponse = { typeUrl: "/cosmos.staking.v1beta1.RedelegationResponse", aminoType: "cosmos-sdk/RedelegationResponse", + is(o: any): o is RedelegationResponse { + return o && (o.$typeUrl === RedelegationResponse.typeUrl || Redelegation.is(o.redelegation) && Array.isArray(o.entries) && (!o.entries.length || RedelegationEntryResponse.is(o.entries[0]))); + }, + isSDK(o: any): o is RedelegationResponseSDKType { + return o && (o.$typeUrl === RedelegationResponse.typeUrl || Redelegation.isSDK(o.redelegation) && Array.isArray(o.entries) && (!o.entries.length || RedelegationEntryResponse.isSDK(o.entries[0]))); + }, + isAmino(o: any): o is RedelegationResponseAmino { + return o && (o.$typeUrl === RedelegationResponse.typeUrl || Redelegation.isAmino(o.redelegation) && Array.isArray(o.entries) && (!o.entries.length || RedelegationEntryResponse.isAmino(o.entries[0]))); + }, encode(message: RedelegationResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.redelegation !== undefined) { Redelegation.encode(message.redelegation, writer.uint32(10).fork()).ldelim(); @@ -3440,6 +3677,13 @@ export const RedelegationResponse = { typeUrl: "/cosmos.staking.v1beta1.RedelegationResponse", value: RedelegationResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(RedelegationResponse.typeUrl)) { + return; + } + Redelegation.registerTypeUrl(); + RedelegationEntryResponse.registerTypeUrl(); } }; function createBasePool(): Pool { @@ -3458,6 +3702,15 @@ function createBasePool(): Pool { export const Pool = { typeUrl: "/cosmos.staking.v1beta1.Pool", aminoType: "cosmos-sdk/Pool", + is(o: any): o is Pool { + return o && (o.$typeUrl === Pool.typeUrl || typeof o.notBondedTokens === "string" && typeof o.bondedTokens === "string"); + }, + isSDK(o: any): o is PoolSDKType { + return o && (o.$typeUrl === Pool.typeUrl || typeof o.not_bonded_tokens === "string" && typeof o.bonded_tokens === "string"); + }, + isAmino(o: any): o is PoolAmino { + return o && (o.$typeUrl === Pool.typeUrl || typeof o.not_bonded_tokens === "string" && typeof o.bonded_tokens === "string"); + }, encode(message: Pool, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.notBondedTokens !== "") { writer.uint32(10).string(message.notBondedTokens); @@ -3538,19 +3791,6 @@ export const Pool = { typeUrl: "/cosmos.staking.v1beta1.Pool", value: Pool.encode(message).finish() }; - } -}; -export const Cosmos_cryptoPubKey_InterfaceDecoder = (input: BinaryReader | Uint8Array): Any => { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - const data = Any.decode(reader, reader.uint32(), true); - switch (data.typeUrl) { - default: - return data; - } -}; -export const Cosmos_cryptoPubKey_FromAmino = (content: AnyAmino): Any => { - return encodePubkey(content); -}; -export const Cosmos_cryptoPubKey_ToAmino = (content: Any, useInterfaces: boolean = true): Pubkey | null => { - return decodePubkey(content); + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/cosmos/staking/v1beta1/tx.registry.ts b/__fixtures__/v-next/outputv3/cosmos/staking/v1beta1/tx.registry.ts index 725110d2da..be2f8b5902 100644 --- a/__fixtures__/v-next/outputv3/cosmos/staking/v1beta1/tx.registry.ts +++ b/__fixtures__/v-next/outputv3/cosmos/staking/v1beta1/tx.registry.ts @@ -2,14 +2,9 @@ import { Description, DescriptionSDKType, CommissionRates, CommissionRatesSDKTyp import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../google/protobuf/any"; import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; import { Timestamp, TimestampSDKType } from "../../../google/protobuf/timestamp"; -import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { TelescopeGeneratedType } from "../../../types"; import { MsgCreateValidator, MsgCreateValidatorSDKType, MsgEditValidator, MsgEditValidatorSDKType, MsgDelegate, MsgDelegateSDKType, MsgBeginRedelegate, MsgBeginRedelegateSDKType, MsgUndelegate, MsgUndelegateSDKType } from "./tx"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/cosmos.staking.v1beta1.MsgCreateValidator", MsgCreateValidator], ["/cosmos.staking.v1beta1.MsgEditValidator", MsgEditValidator], ["/cosmos.staking.v1beta1.MsgDelegate", MsgDelegate], ["/cosmos.staking.v1beta1.MsgBeginRedelegate", MsgBeginRedelegate], ["/cosmos.staking.v1beta1.MsgUndelegate", MsgUndelegate]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/cosmos.staking.v1beta1.MsgCreateValidator", MsgCreateValidator], ["/cosmos.staking.v1beta1.MsgEditValidator", MsgEditValidator], ["/cosmos.staking.v1beta1.MsgDelegate", MsgDelegate], ["/cosmos.staking.v1beta1.MsgBeginRedelegate", MsgBeginRedelegate], ["/cosmos.staking.v1beta1.MsgUndelegate", MsgUndelegate]]; export const MessageComposer = { encoded: { createValidator(value: MsgCreateValidator) { diff --git a/__fixtures__/v-next/outputv3/cosmos/staking/v1beta1/tx.rpc.func.ts b/__fixtures__/v-next/outputv3/cosmos/staking/v1beta1/tx.rpc.func.ts new file mode 100644 index 0000000000..e16fa812df --- /dev/null +++ b/__fixtures__/v-next/outputv3/cosmos/staking/v1beta1/tx.rpc.func.ts @@ -0,0 +1,54 @@ +import { Description, DescriptionSDKType, CommissionRates, CommissionRatesSDKType } from "./staking"; +import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../google/protobuf/any"; +import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; +import { Timestamp, TimestampSDKType } from "../../../google/protobuf/timestamp"; +import { buildTx } from "../../../helper-func-types"; +import { MsgCreateValidator, MsgCreateValidatorSDKType, MsgCreateValidatorResponse, MsgCreateValidatorResponseSDKType, MsgEditValidator, MsgEditValidatorSDKType, MsgEditValidatorResponse, MsgEditValidatorResponseSDKType, MsgDelegate, MsgDelegateSDKType, MsgDelegateResponse, MsgDelegateResponseSDKType, MsgBeginRedelegate, MsgBeginRedelegateSDKType, MsgBeginRedelegateResponse, MsgBeginRedelegateResponseSDKType, MsgUndelegate, MsgUndelegateSDKType, MsgUndelegateResponse, MsgUndelegateResponseSDKType } from "./tx"; +/** + * CreateValidator defines a method for creating a new validator. + * @name createValidator + * @package cosmos.staking.v1beta1 + * @see proto service: cosmos.staking.v1beta1.CreateValidator + */ +export const createValidator = buildTx({ + msg: MsgCreateValidator +}); +/** + * EditValidator defines a method for editing an existing validator. + * @name editValidator + * @package cosmos.staking.v1beta1 + * @see proto service: cosmos.staking.v1beta1.EditValidator + */ +export const editValidator = buildTx({ + msg: MsgEditValidator +}); +/** + * Delegate defines a method for performing a delegation of coins + * from a delegator to a validator. + * @name delegate + * @package cosmos.staking.v1beta1 + * @see proto service: cosmos.staking.v1beta1.Delegate + */ +export const delegate = buildTx({ + msg: MsgDelegate +}); +/** + * BeginRedelegate defines a method for performing a redelegation + * of coins from a delegator and source validator to a destination validator. + * @name beginRedelegate + * @package cosmos.staking.v1beta1 + * @see proto service: cosmos.staking.v1beta1.BeginRedelegate + */ +export const beginRedelegate = buildTx({ + msg: MsgBeginRedelegate +}); +/** + * Undelegate defines a method for performing an undelegation from a + * delegate and a validator. + * @name undelegate + * @package cosmos.staking.v1beta1 + * @see proto service: cosmos.staking.v1beta1.Undelegate + */ +export const undelegate = buildTx({ + msg: MsgUndelegate +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/cosmos/staking/v1beta1/tx.ts b/__fixtures__/v-next/outputv3/cosmos/staking/v1beta1/tx.ts index 09c86357d9..6abd3244ec 100644 --- a/__fixtures__/v-next/outputv3/cosmos/staking/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputv3/cosmos/staking/v1beta1/tx.ts @@ -3,10 +3,10 @@ import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../google/protobuf import { Coin, CoinAmino, CoinSDKType } from "../../base/v1beta1/coin"; import { Timestamp, TimestampAmino, TimestampSDKType } from "../../../google/protobuf/timestamp"; import { BinaryReader, BinaryWriter } from "../../../binary"; +import { GlobalDecoderRegistry } from "../../../registry"; import { isSet, DeepPartial, toTimestamp, fromTimestamp } from "../../../helpers"; -import { encodePubkey, decodePubkey } from "@cosmjs/proto-signing"; -import { Decimal } from "@cosmjs/math"; -import { Pubkey } from "@cosmjs/amino"; +import { encodePubkey, decodePubkey } from "@interchainjs/pubkey"; +import { Decimal } from "@interchainjs/math"; export const protobufPackage = "cosmos.staking.v1beta1"; /** * MsgCreateValidator defines a SDK message for creating a new validator. @@ -392,6 +392,15 @@ function createBaseMsgCreateValidator(): MsgCreateValidator { export const MsgCreateValidator = { typeUrl: "/cosmos.staking.v1beta1.MsgCreateValidator", aminoType: "cosmos-sdk/MsgCreateValidator", + is(o: any): o is MsgCreateValidator { + return o && (o.$typeUrl === MsgCreateValidator.typeUrl || Description.is(o.description) && CommissionRates.is(o.commission) && typeof o.minSelfDelegation === "string" && typeof o.delegatorAddress === "string" && typeof o.validatorAddress === "string" && Coin.is(o.value)); + }, + isSDK(o: any): o is MsgCreateValidatorSDKType { + return o && (o.$typeUrl === MsgCreateValidator.typeUrl || Description.isSDK(o.description) && CommissionRates.isSDK(o.commission) && typeof o.min_self_delegation === "string" && typeof o.delegator_address === "string" && typeof o.validator_address === "string" && Coin.isSDK(o.value)); + }, + isAmino(o: any): o is MsgCreateValidatorAmino { + return o && (o.$typeUrl === MsgCreateValidator.typeUrl || Description.isAmino(o.description) && CommissionRates.isAmino(o.commission) && typeof o.min_self_delegation === "string" && typeof o.delegator_address === "string" && typeof o.validator_address === "string" && Coin.isAmino(o.value)); + }, encode(message: MsgCreateValidator, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.description !== undefined) { Description.encode(message.description, writer.uint32(10).fork()).ldelim(); @@ -409,7 +418,7 @@ export const MsgCreateValidator = { writer.uint32(42).string(message.validatorAddress); } if (message.pubkey !== undefined) { - Any.encode((message.pubkey as Any), writer.uint32(50).fork()).ldelim(); + Any.encode(GlobalDecoderRegistry.wrapAny(message.pubkey), writer.uint32(50).fork()).ldelim(); } if (message.value !== undefined) { Coin.encode(message.value, writer.uint32(58).fork()).ldelim(); @@ -439,7 +448,7 @@ export const MsgCreateValidator = { message.validatorAddress = reader.string(); break; case 6: - message.pubkey = useInterfaces ? (Cosmos_cryptoPubKey_InterfaceDecoder(reader) as Any) : Any.decode(reader, reader.uint32(), useInterfaces); + message.pubkey = GlobalDecoderRegistry.unwrapAny(reader); break; case 7: message.value = Coin.decode(reader, reader.uint32(), useInterfaces); @@ -458,7 +467,7 @@ export const MsgCreateValidator = { if (isSet(object.minSelfDelegation)) obj.minSelfDelegation = String(object.minSelfDelegation); if (isSet(object.delegatorAddress)) obj.delegatorAddress = String(object.delegatorAddress); if (isSet(object.validatorAddress)) obj.validatorAddress = String(object.validatorAddress); - if (isSet(object.pubkey)) obj.pubkey = Any.fromJSON(object.pubkey); + if (isSet(object.pubkey)) obj.pubkey = GlobalDecoderRegistry.fromJSON(object.pubkey); if (isSet(object.value)) obj.value = Coin.fromJSON(object.value); return obj; }, @@ -474,7 +483,7 @@ export const MsgCreateValidator = { message.delegatorAddress = object.delegatorAddress ?? ""; message.validatorAddress = object.validatorAddress ?? ""; if (object.pubkey !== undefined && object.pubkey !== null) { - message.pubkey = Any.fromPartial(object.pubkey); + message.pubkey = GlobalDecoderRegistry.fromPartial(object.pubkey); } if (object.value !== undefined && object.value !== null) { message.value = Coin.fromPartial(object.value); @@ -488,7 +497,7 @@ export const MsgCreateValidator = { minSelfDelegation: object?.min_self_delegation, delegatorAddress: object?.delegator_address, validatorAddress: object?.validator_address, - pubkey: object.pubkey ? Any.fromSDK(object.pubkey) : undefined, + pubkey: object.pubkey ? GlobalDecoderRegistry.fromSDK(object.pubkey) : undefined, value: object.value ? Coin.fromSDK(object.value) : undefined }; }, @@ -499,7 +508,7 @@ export const MsgCreateValidator = { obj.min_self_delegation = message.minSelfDelegation; obj.delegator_address = message.delegatorAddress; obj.validator_address = message.validatorAddress; - message.pubkey !== undefined && (obj.pubkey = message.pubkey ? Any.toSDK(message.pubkey) : undefined); + message.pubkey !== undefined && (obj.pubkey = message.pubkey ? GlobalDecoderRegistry.toSDK(message.pubkey) : undefined); message.value !== undefined && (obj.value = message.value ? Coin.toSDK(message.value) : undefined); return obj; }, @@ -550,6 +559,12 @@ export const MsgCreateValidator = { typeUrl: "/cosmos.staking.v1beta1.MsgCreateValidator", value: MsgCreateValidator.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgCreateValidator.typeUrl)) { + return; + } + Coin.registerTypeUrl(); } }; function createBaseMsgCreateValidatorResponse(): MsgCreateValidatorResponse { @@ -564,6 +579,15 @@ function createBaseMsgCreateValidatorResponse(): MsgCreateValidatorResponse { export const MsgCreateValidatorResponse = { typeUrl: "/cosmos.staking.v1beta1.MsgCreateValidatorResponse", aminoType: "cosmos-sdk/MsgCreateValidatorResponse", + is(o: any): o is MsgCreateValidatorResponse { + return o && o.$typeUrl === MsgCreateValidatorResponse.typeUrl; + }, + isSDK(o: any): o is MsgCreateValidatorResponseSDKType { + return o && o.$typeUrl === MsgCreateValidatorResponse.typeUrl; + }, + isAmino(o: any): o is MsgCreateValidatorResponseAmino { + return o && o.$typeUrl === MsgCreateValidatorResponse.typeUrl; + }, encode(_: MsgCreateValidatorResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -615,7 +639,8 @@ export const MsgCreateValidatorResponse = { typeUrl: "/cosmos.staking.v1beta1.MsgCreateValidatorResponse", value: MsgCreateValidatorResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgEditValidator(): MsgEditValidator { return { @@ -634,6 +659,15 @@ function createBaseMsgEditValidator(): MsgEditValidator { export const MsgEditValidator = { typeUrl: "/cosmos.staking.v1beta1.MsgEditValidator", aminoType: "cosmos-sdk/MsgEditValidator", + is(o: any): o is MsgEditValidator { + return o && (o.$typeUrl === MsgEditValidator.typeUrl || Description.is(o.description) && typeof o.validatorAddress === "string" && typeof o.commissionRate === "string" && typeof o.minSelfDelegation === "string"); + }, + isSDK(o: any): o is MsgEditValidatorSDKType { + return o && (o.$typeUrl === MsgEditValidator.typeUrl || Description.isSDK(o.description) && typeof o.validator_address === "string" && typeof o.commission_rate === "string" && typeof o.min_self_delegation === "string"); + }, + isAmino(o: any): o is MsgEditValidatorAmino { + return o && (o.$typeUrl === MsgEditValidator.typeUrl || Description.isAmino(o.description) && typeof o.validator_address === "string" && typeof o.commission_rate === "string" && typeof o.min_self_delegation === "string"); + }, encode(message: MsgEditValidator, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.description !== undefined) { Description.encode(message.description, writer.uint32(10).fork()).ldelim(); @@ -729,7 +763,7 @@ export const MsgEditValidator = { const obj: any = {}; obj.description = message.description ? Description.toAmino(message.description, useInterfaces) : undefined; obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; - obj.commission_rate = message.commissionRate === "" ? undefined : message.commissionRate; + obj.commission_rate = message.commissionRate === "" ? undefined : Decimal.fromUserInput(message.commissionRate, 18).atomics; obj.min_self_delegation = message.minSelfDelegation === "" ? undefined : message.minSelfDelegation; return obj; }, @@ -744,6 +778,12 @@ export const MsgEditValidator = { typeUrl: "/cosmos.staking.v1beta1.MsgEditValidator", value: MsgEditValidator.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgEditValidator.typeUrl)) { + return; + } + Description.registerTypeUrl(); } }; function createBaseMsgEditValidatorResponse(): MsgEditValidatorResponse { @@ -758,6 +798,15 @@ function createBaseMsgEditValidatorResponse(): MsgEditValidatorResponse { export const MsgEditValidatorResponse = { typeUrl: "/cosmos.staking.v1beta1.MsgEditValidatorResponse", aminoType: "cosmos-sdk/MsgEditValidatorResponse", + is(o: any): o is MsgEditValidatorResponse { + return o && o.$typeUrl === MsgEditValidatorResponse.typeUrl; + }, + isSDK(o: any): o is MsgEditValidatorResponseSDKType { + return o && o.$typeUrl === MsgEditValidatorResponse.typeUrl; + }, + isAmino(o: any): o is MsgEditValidatorResponseAmino { + return o && o.$typeUrl === MsgEditValidatorResponse.typeUrl; + }, encode(_: MsgEditValidatorResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -809,7 +858,8 @@ export const MsgEditValidatorResponse = { typeUrl: "/cosmos.staking.v1beta1.MsgEditValidatorResponse", value: MsgEditValidatorResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgDelegate(): MsgDelegate { return { @@ -828,6 +878,15 @@ function createBaseMsgDelegate(): MsgDelegate { export const MsgDelegate = { typeUrl: "/cosmos.staking.v1beta1.MsgDelegate", aminoType: "cosmos-sdk/MsgDelegate", + is(o: any): o is MsgDelegate { + return o && (o.$typeUrl === MsgDelegate.typeUrl || typeof o.delegatorAddress === "string" && typeof o.validatorAddress === "string" && Coin.is(o.amount)); + }, + isSDK(o: any): o is MsgDelegateSDKType { + return o && (o.$typeUrl === MsgDelegate.typeUrl || typeof o.delegator_address === "string" && typeof o.validator_address === "string" && Coin.isSDK(o.amount)); + }, + isAmino(o: any): o is MsgDelegateAmino { + return o && (o.$typeUrl === MsgDelegate.typeUrl || typeof o.delegator_address === "string" && typeof o.validator_address === "string" && Coin.isAmino(o.amount)); + }, encode(message: MsgDelegate, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.delegatorAddress !== "") { writer.uint32(10).string(message.delegatorAddress); @@ -924,6 +983,12 @@ export const MsgDelegate = { typeUrl: "/cosmos.staking.v1beta1.MsgDelegate", value: MsgDelegate.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgDelegate.typeUrl)) { + return; + } + Coin.registerTypeUrl(); } }; function createBaseMsgDelegateResponse(): MsgDelegateResponse { @@ -938,6 +1003,15 @@ function createBaseMsgDelegateResponse(): MsgDelegateResponse { export const MsgDelegateResponse = { typeUrl: "/cosmos.staking.v1beta1.MsgDelegateResponse", aminoType: "cosmos-sdk/MsgDelegateResponse", + is(o: any): o is MsgDelegateResponse { + return o && o.$typeUrl === MsgDelegateResponse.typeUrl; + }, + isSDK(o: any): o is MsgDelegateResponseSDKType { + return o && o.$typeUrl === MsgDelegateResponse.typeUrl; + }, + isAmino(o: any): o is MsgDelegateResponseAmino { + return o && o.$typeUrl === MsgDelegateResponse.typeUrl; + }, encode(_: MsgDelegateResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -989,7 +1063,8 @@ export const MsgDelegateResponse = { typeUrl: "/cosmos.staking.v1beta1.MsgDelegateResponse", value: MsgDelegateResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgBeginRedelegate(): MsgBeginRedelegate { return { @@ -1009,6 +1084,15 @@ function createBaseMsgBeginRedelegate(): MsgBeginRedelegate { export const MsgBeginRedelegate = { typeUrl: "/cosmos.staking.v1beta1.MsgBeginRedelegate", aminoType: "cosmos-sdk/MsgBeginRedelegate", + is(o: any): o is MsgBeginRedelegate { + return o && (o.$typeUrl === MsgBeginRedelegate.typeUrl || typeof o.delegatorAddress === "string" && typeof o.validatorSrcAddress === "string" && typeof o.validatorDstAddress === "string" && Coin.is(o.amount)); + }, + isSDK(o: any): o is MsgBeginRedelegateSDKType { + return o && (o.$typeUrl === MsgBeginRedelegate.typeUrl || typeof o.delegator_address === "string" && typeof o.validator_src_address === "string" && typeof o.validator_dst_address === "string" && Coin.isSDK(o.amount)); + }, + isAmino(o: any): o is MsgBeginRedelegateAmino { + return o && (o.$typeUrl === MsgBeginRedelegate.typeUrl || typeof o.delegator_address === "string" && typeof o.validator_src_address === "string" && typeof o.validator_dst_address === "string" && Coin.isAmino(o.amount)); + }, encode(message: MsgBeginRedelegate, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.delegatorAddress !== "") { writer.uint32(10).string(message.delegatorAddress); @@ -1119,6 +1203,12 @@ export const MsgBeginRedelegate = { typeUrl: "/cosmos.staking.v1beta1.MsgBeginRedelegate", value: MsgBeginRedelegate.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgBeginRedelegate.typeUrl)) { + return; + } + Coin.registerTypeUrl(); } }; function createBaseMsgBeginRedelegateResponse(): MsgBeginRedelegateResponse { @@ -1135,6 +1225,15 @@ function createBaseMsgBeginRedelegateResponse(): MsgBeginRedelegateResponse { export const MsgBeginRedelegateResponse = { typeUrl: "/cosmos.staking.v1beta1.MsgBeginRedelegateResponse", aminoType: "cosmos-sdk/MsgBeginRedelegateResponse", + is(o: any): o is MsgBeginRedelegateResponse { + return o && (o.$typeUrl === MsgBeginRedelegateResponse.typeUrl || Timestamp.is(o.completionTime)); + }, + isSDK(o: any): o is MsgBeginRedelegateResponseSDKType { + return o && (o.$typeUrl === MsgBeginRedelegateResponse.typeUrl || Timestamp.isSDK(o.completion_time)); + }, + isAmino(o: any): o is MsgBeginRedelegateResponseAmino { + return o && (o.$typeUrl === MsgBeginRedelegateResponse.typeUrl || Timestamp.isAmino(o.completion_time)); + }, encode(message: MsgBeginRedelegateResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.completionTime !== undefined) { Timestamp.encode(toTimestamp(message.completionTime), writer.uint32(10).fork()).ldelim(); @@ -1201,7 +1300,8 @@ export const MsgBeginRedelegateResponse = { typeUrl: "/cosmos.staking.v1beta1.MsgBeginRedelegateResponse", value: MsgBeginRedelegateResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgUndelegate(): MsgUndelegate { return { @@ -1220,6 +1320,15 @@ function createBaseMsgUndelegate(): MsgUndelegate { export const MsgUndelegate = { typeUrl: "/cosmos.staking.v1beta1.MsgUndelegate", aminoType: "cosmos-sdk/MsgUndelegate", + is(o: any): o is MsgUndelegate { + return o && (o.$typeUrl === MsgUndelegate.typeUrl || typeof o.delegatorAddress === "string" && typeof o.validatorAddress === "string" && Coin.is(o.amount)); + }, + isSDK(o: any): o is MsgUndelegateSDKType { + return o && (o.$typeUrl === MsgUndelegate.typeUrl || typeof o.delegator_address === "string" && typeof o.validator_address === "string" && Coin.isSDK(o.amount)); + }, + isAmino(o: any): o is MsgUndelegateAmino { + return o && (o.$typeUrl === MsgUndelegate.typeUrl || typeof o.delegator_address === "string" && typeof o.validator_address === "string" && Coin.isAmino(o.amount)); + }, encode(message: MsgUndelegate, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.delegatorAddress !== "") { writer.uint32(10).string(message.delegatorAddress); @@ -1316,6 +1425,12 @@ export const MsgUndelegate = { typeUrl: "/cosmos.staking.v1beta1.MsgUndelegate", value: MsgUndelegate.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgUndelegate.typeUrl)) { + return; + } + Coin.registerTypeUrl(); } }; function createBaseMsgUndelegateResponse(): MsgUndelegateResponse { @@ -1332,6 +1447,15 @@ function createBaseMsgUndelegateResponse(): MsgUndelegateResponse { export const MsgUndelegateResponse = { typeUrl: "/cosmos.staking.v1beta1.MsgUndelegateResponse", aminoType: "cosmos-sdk/MsgUndelegateResponse", + is(o: any): o is MsgUndelegateResponse { + return o && (o.$typeUrl === MsgUndelegateResponse.typeUrl || Timestamp.is(o.completionTime)); + }, + isSDK(o: any): o is MsgUndelegateResponseSDKType { + return o && (o.$typeUrl === MsgUndelegateResponse.typeUrl || Timestamp.isSDK(o.completion_time)); + }, + isAmino(o: any): o is MsgUndelegateResponseAmino { + return o && (o.$typeUrl === MsgUndelegateResponse.typeUrl || Timestamp.isAmino(o.completion_time)); + }, encode(message: MsgUndelegateResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.completionTime !== undefined) { Timestamp.encode(toTimestamp(message.completionTime), writer.uint32(10).fork()).ldelim(); @@ -1398,19 +1522,6 @@ export const MsgUndelegateResponse = { typeUrl: "/cosmos.staking.v1beta1.MsgUndelegateResponse", value: MsgUndelegateResponse.encode(message).finish() }; - } -}; -export const Cosmos_cryptoPubKey_InterfaceDecoder = (input: BinaryReader | Uint8Array): Any => { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - const data = Any.decode(reader, reader.uint32(), true); - switch (data.typeUrl) { - default: - return data; - } -}; -export const Cosmos_cryptoPubKey_FromAmino = (content: AnyAmino): Any => { - return encodePubkey(content); -}; -export const Cosmos_cryptoPubKey_ToAmino = (content: Any, useInterfaces: boolean = true): Pubkey | null => { - return decodePubkey(content); + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/cosmos/tx/signing/v1beta1/signing.ts b/__fixtures__/v-next/outputv3/cosmos/tx/signing/v1beta1/signing.ts index 9b88ab80a7..7f26e51211 100644 --- a/__fixtures__/v-next/outputv3/cosmos/tx/signing/v1beta1/signing.ts +++ b/__fixtures__/v-next/outputv3/cosmos/tx/signing/v1beta1/signing.ts @@ -2,6 +2,7 @@ import { CompactBitArray, CompactBitArrayAmino, CompactBitArraySDKType } from ". import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../../google/protobuf/any"; import { BinaryReader, BinaryWriter } from "../../../../binary"; import { DeepPartial, isSet, bytesFromBase64, base64FromBytes } from "../../../../helpers"; +import { GlobalDecoderRegistry } from "../../../../registry"; export const protobufPackage = "cosmos.tx.signing.v1beta1"; /** * SignMode represents a signing mode with its own security guarantees. @@ -339,6 +340,15 @@ function createBaseSignatureDescriptors(): SignatureDescriptors { export const SignatureDescriptors = { typeUrl: "/cosmos.tx.signing.v1beta1.SignatureDescriptors", aminoType: "cosmos-sdk/SignatureDescriptors", + is(o: any): o is SignatureDescriptors { + return o && (o.$typeUrl === SignatureDescriptors.typeUrl || Array.isArray(o.signatures) && (!o.signatures.length || SignatureDescriptor.is(o.signatures[0]))); + }, + isSDK(o: any): o is SignatureDescriptorsSDKType { + return o && (o.$typeUrl === SignatureDescriptors.typeUrl || Array.isArray(o.signatures) && (!o.signatures.length || SignatureDescriptor.isSDK(o.signatures[0]))); + }, + isAmino(o: any): o is SignatureDescriptorsAmino { + return o && (o.$typeUrl === SignatureDescriptors.typeUrl || Array.isArray(o.signatures) && (!o.signatures.length || SignatureDescriptor.isAmino(o.signatures[0]))); + }, encode(message: SignatureDescriptors, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.signatures) { SignatureDescriptor.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -411,6 +421,12 @@ export const SignatureDescriptors = { typeUrl: "/cosmos.tx.signing.v1beta1.SignatureDescriptors", value: SignatureDescriptors.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(SignatureDescriptors.typeUrl)) { + return; + } + SignatureDescriptor.registerTypeUrl(); } }; function createBaseSignatureDescriptor(): SignatureDescriptor { @@ -432,6 +448,15 @@ function createBaseSignatureDescriptor(): SignatureDescriptor { export const SignatureDescriptor = { typeUrl: "/cosmos.tx.signing.v1beta1.SignatureDescriptor", aminoType: "cosmos-sdk/SignatureDescriptor", + is(o: any): o is SignatureDescriptor { + return o && (o.$typeUrl === SignatureDescriptor.typeUrl || typeof o.sequence === "bigint"); + }, + isSDK(o: any): o is SignatureDescriptorSDKType { + return o && (o.$typeUrl === SignatureDescriptor.typeUrl || typeof o.sequence === "bigint"); + }, + isAmino(o: any): o is SignatureDescriptorAmino { + return o && (o.$typeUrl === SignatureDescriptor.typeUrl || typeof o.sequence === "bigint"); + }, encode(message: SignatureDescriptor, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.publicKey !== undefined) { Any.encode(message.publicKey, writer.uint32(10).fork()).ldelim(); @@ -532,6 +557,12 @@ export const SignatureDescriptor = { typeUrl: "/cosmos.tx.signing.v1beta1.SignatureDescriptor", value: SignatureDescriptor.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(SignatureDescriptor.typeUrl)) { + return; + } + SignatureDescriptor_Data.registerTypeUrl(); } }; function createBaseSignatureDescriptor_Data(): SignatureDescriptor_Data { @@ -549,6 +580,15 @@ function createBaseSignatureDescriptor_Data(): SignatureDescriptor_Data { export const SignatureDescriptor_Data = { typeUrl: "/cosmos.tx.signing.v1beta1.Data", aminoType: "cosmos-sdk/Data", + is(o: any): o is SignatureDescriptor_Data { + return o && o.$typeUrl === SignatureDescriptor_Data.typeUrl; + }, + isSDK(o: any): o is SignatureDescriptor_DataSDKType { + return o && o.$typeUrl === SignatureDescriptor_Data.typeUrl; + }, + isAmino(o: any): o is SignatureDescriptor_DataAmino { + return o && o.$typeUrl === SignatureDescriptor_Data.typeUrl; + }, encode(message: SignatureDescriptor_Data, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.single !== undefined) { SignatureDescriptor_Data_Single.encode(message.single, writer.uint32(10).fork()).ldelim(); @@ -633,6 +673,13 @@ export const SignatureDescriptor_Data = { typeUrl: "/cosmos.tx.signing.v1beta1.Data", value: SignatureDescriptor_Data.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(SignatureDescriptor_Data.typeUrl)) { + return; + } + SignatureDescriptor_Data_Single.registerTypeUrl(); + SignatureDescriptor_Data_Multi.registerTypeUrl(); } }; function createBaseSignatureDescriptor_Data_Single(): SignatureDescriptor_Data_Single { @@ -650,6 +697,15 @@ function createBaseSignatureDescriptor_Data_Single(): SignatureDescriptor_Data_S export const SignatureDescriptor_Data_Single = { typeUrl: "/cosmos.tx.signing.v1beta1.Single", aminoType: "cosmos-sdk/Single", + is(o: any): o is SignatureDescriptor_Data_Single { + return o && (o.$typeUrl === SignatureDescriptor_Data_Single.typeUrl || isSet(o.mode) && (o.signature instanceof Uint8Array || typeof o.signature === "string")); + }, + isSDK(o: any): o is SignatureDescriptor_Data_SingleSDKType { + return o && (o.$typeUrl === SignatureDescriptor_Data_Single.typeUrl || isSet(o.mode) && (o.signature instanceof Uint8Array || typeof o.signature === "string")); + }, + isAmino(o: any): o is SignatureDescriptor_Data_SingleAmino { + return o && (o.$typeUrl === SignatureDescriptor_Data_Single.typeUrl || isSet(o.mode) && (o.signature instanceof Uint8Array || typeof o.signature === "string")); + }, encode(message: SignatureDescriptor_Data_Single, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.mode !== 0) { writer.uint32(8).int32(message.mode); @@ -730,7 +786,8 @@ export const SignatureDescriptor_Data_Single = { typeUrl: "/cosmos.tx.signing.v1beta1.Single", value: SignatureDescriptor_Data_Single.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseSignatureDescriptor_Data_Multi(): SignatureDescriptor_Data_Multi { return { @@ -747,6 +804,15 @@ function createBaseSignatureDescriptor_Data_Multi(): SignatureDescriptor_Data_Mu export const SignatureDescriptor_Data_Multi = { typeUrl: "/cosmos.tx.signing.v1beta1.Multi", aminoType: "cosmos-sdk/Multi", + is(o: any): o is SignatureDescriptor_Data_Multi { + return o && (o.$typeUrl === SignatureDescriptor_Data_Multi.typeUrl || Array.isArray(o.signatures) && (!o.signatures.length || SignatureDescriptor_Data.is(o.signatures[0]))); + }, + isSDK(o: any): o is SignatureDescriptor_Data_MultiSDKType { + return o && (o.$typeUrl === SignatureDescriptor_Data_Multi.typeUrl || Array.isArray(o.signatures) && (!o.signatures.length || SignatureDescriptor_Data.isSDK(o.signatures[0]))); + }, + isAmino(o: any): o is SignatureDescriptor_Data_MultiAmino { + return o && (o.$typeUrl === SignatureDescriptor_Data_Multi.typeUrl || Array.isArray(o.signatures) && (!o.signatures.length || SignatureDescriptor_Data.isAmino(o.signatures[0]))); + }, encode(message: SignatureDescriptor_Data_Multi, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.bitarray !== undefined) { CompactBitArray.encode(message.bitarray, writer.uint32(10).fork()).ldelim(); @@ -835,5 +901,12 @@ export const SignatureDescriptor_Data_Multi = { typeUrl: "/cosmos.tx.signing.v1beta1.Multi", value: SignatureDescriptor_Data_Multi.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(SignatureDescriptor_Data_Multi.typeUrl)) { + return; + } + CompactBitArray.registerTypeUrl(); + SignatureDescriptor_Data.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/cosmos/tx/v1beta1/service.rpc.func.ts b/__fixtures__/v-next/outputv3/cosmos/tx/v1beta1/service.rpc.func.ts new file mode 100644 index 0000000000..63841511bc --- /dev/null +++ b/__fixtures__/v-next/outputv3/cosmos/tx/v1beta1/service.rpc.func.ts @@ -0,0 +1,74 @@ +import { Tx, TxSDKType } from "./tx"; +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; +import { TxResponse, TxResponseSDKType, GasInfo, GasInfoSDKType, Result, ResultSDKType } from "../../base/abci/v1beta1/abci"; +import { BlockID, BlockIDSDKType } from "../../../tendermint/types/types"; +import { Block, BlockSDKType } from "../../../tendermint/types/block"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { SimulateRequest, SimulateRequestSDKType, SimulateResponse, SimulateResponseSDKType, GetTxRequest, GetTxRequestSDKType, GetTxResponse, GetTxResponseSDKType, BroadcastTxRequest, BroadcastTxRequestSDKType, BroadcastTxResponse, BroadcastTxResponseSDKType, GetTxsEventRequest, GetTxsEventRequestSDKType, GetTxsEventResponse, GetTxsEventResponseSDKType, GetBlockWithTxsRequest, GetBlockWithTxsRequestSDKType, GetBlockWithTxsResponse, GetBlockWithTxsResponseSDKType } from "./service"; +/** + * Simulate simulates executing a transaction for estimating gas usage. + * @name getSimulate + * @package cosmos.tx.v1beta1 + * @see proto service: cosmos.tx.v1beta1.Simulate + */ +export const getSimulate = buildQuery({ + encode: SimulateRequest.encode, + decode: SimulateResponse.decode, + service: "cosmos.tx.v1beta1.Service", + method: "Simulate", + deps: [SimulateRequest, SimulateResponse] +}); +/** + * GetTx fetches a tx by hash. + * @name getGetTx + * @package cosmos.tx.v1beta1 + * @see proto service: cosmos.tx.v1beta1.GetTx + */ +export const getGetTx = buildQuery({ + encode: GetTxRequest.encode, + decode: GetTxResponse.decode, + service: "cosmos.tx.v1beta1.Service", + method: "GetTx", + deps: [GetTxRequest, GetTxResponse] +}); +/** + * BroadcastTx broadcast transaction. + * @name getBroadcastTx + * @package cosmos.tx.v1beta1 + * @see proto service: cosmos.tx.v1beta1.BroadcastTx + */ +export const getBroadcastTx = buildQuery({ + encode: BroadcastTxRequest.encode, + decode: BroadcastTxResponse.decode, + service: "cosmos.tx.v1beta1.Service", + method: "BroadcastTx", + deps: [BroadcastTxRequest, BroadcastTxResponse] +}); +/** + * GetTxsEvent fetches txs by event. + * @name getGetTxsEvent + * @package cosmos.tx.v1beta1 + * @see proto service: cosmos.tx.v1beta1.GetTxsEvent + */ +export const getGetTxsEvent = buildQuery({ + encode: GetTxsEventRequest.encode, + decode: GetTxsEventResponse.decode, + service: "cosmos.tx.v1beta1.Service", + method: "GetTxsEvent", + deps: [GetTxsEventRequest, GetTxsEventResponse] +}); +/** + * GetBlockWithTxs fetches a block with decoded txs. + * + * Since: cosmos-sdk 0.45.2 + * @name getGetBlockWithTxs + * @package cosmos.tx.v1beta1 + * @see proto service: cosmos.tx.v1beta1.GetBlockWithTxs + */ +export const getGetBlockWithTxs = buildQuery({ + encode: GetBlockWithTxsRequest.encode, + decode: GetBlockWithTxsResponse.decode, + service: "cosmos.tx.v1beta1.Service", + method: "GetBlockWithTxs", + deps: [GetBlockWithTxsRequest, GetBlockWithTxsResponse] +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/cosmos/tx/v1beta1/service.ts b/__fixtures__/v-next/outputv3/cosmos/tx/v1beta1/service.ts index c64b428a85..3769164637 100644 --- a/__fixtures__/v-next/outputv3/cosmos/tx/v1beta1/service.ts +++ b/__fixtures__/v-next/outputv3/cosmos/tx/v1beta1/service.ts @@ -3,8 +3,9 @@ import { PageRequest, PageRequestAmino, PageRequestSDKType, PageResponse, PageRe import { TxResponse, TxResponseAmino, TxResponseSDKType, GasInfo, GasInfoAmino, GasInfoSDKType, Result, ResultAmino, ResultSDKType } from "../../base/abci/v1beta1/abci"; import { BlockID, BlockIDAmino, BlockIDSDKType } from "../../../tendermint/types/types"; import { Block, BlockAmino, BlockSDKType } from "../../../tendermint/types/block"; -import { BinaryReader, BinaryWriter } from "../../../binary"; import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../helpers"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "cosmos.tx.v1beta1"; /** OrderBy defines the sorting order */ export enum OrderBy { @@ -624,6 +625,15 @@ function createBaseGetTxsEventRequest(): GetTxsEventRequest { export const GetTxsEventRequest = { typeUrl: "/cosmos.tx.v1beta1.GetTxsEventRequest", aminoType: "cosmos-sdk/GetTxsEventRequest", + is(o: any): o is GetTxsEventRequest { + return o && (o.$typeUrl === GetTxsEventRequest.typeUrl || Array.isArray(o.events) && (!o.events.length || typeof o.events[0] === "string") && isSet(o.orderBy)); + }, + isSDK(o: any): o is GetTxsEventRequestSDKType { + return o && (o.$typeUrl === GetTxsEventRequest.typeUrl || Array.isArray(o.events) && (!o.events.length || typeof o.events[0] === "string") && isSet(o.order_by)); + }, + isAmino(o: any): o is GetTxsEventRequestAmino { + return o && (o.$typeUrl === GetTxsEventRequest.typeUrl || Array.isArray(o.events) && (!o.events.length || typeof o.events[0] === "string") && isSet(o.order_by)); + }, encode(message: GetTxsEventRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.events) { writer.uint32(10).string(v!); @@ -726,6 +736,12 @@ export const GetTxsEventRequest = { typeUrl: "/cosmos.tx.v1beta1.GetTxsEventRequest", value: GetTxsEventRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GetTxsEventRequest.typeUrl)) { + return; + } + PageRequest.registerTypeUrl(); } }; function createBaseGetTxsEventResponse(): GetTxsEventResponse { @@ -745,6 +761,15 @@ function createBaseGetTxsEventResponse(): GetTxsEventResponse { export const GetTxsEventResponse = { typeUrl: "/cosmos.tx.v1beta1.GetTxsEventResponse", aminoType: "cosmos-sdk/GetTxsEventResponse", + is(o: any): o is GetTxsEventResponse { + return o && (o.$typeUrl === GetTxsEventResponse.typeUrl || Array.isArray(o.txs) && (!o.txs.length || Tx.is(o.txs[0])) && Array.isArray(o.txResponses) && (!o.txResponses.length || TxResponse.is(o.txResponses[0]))); + }, + isSDK(o: any): o is GetTxsEventResponseSDKType { + return o && (o.$typeUrl === GetTxsEventResponse.typeUrl || Array.isArray(o.txs) && (!o.txs.length || Tx.isSDK(o.txs[0])) && Array.isArray(o.tx_responses) && (!o.tx_responses.length || TxResponse.isSDK(o.tx_responses[0]))); + }, + isAmino(o: any): o is GetTxsEventResponseAmino { + return o && (o.$typeUrl === GetTxsEventResponse.typeUrl || Array.isArray(o.txs) && (!o.txs.length || Tx.isAmino(o.txs[0])) && Array.isArray(o.tx_responses) && (!o.tx_responses.length || TxResponse.isAmino(o.tx_responses[0]))); + }, encode(message: GetTxsEventResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.txs) { Tx.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -853,6 +878,14 @@ export const GetTxsEventResponse = { typeUrl: "/cosmos.tx.v1beta1.GetTxsEventResponse", value: GetTxsEventResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GetTxsEventResponse.typeUrl)) { + return; + } + Tx.registerTypeUrl(); + TxResponse.registerTypeUrl(); + PageResponse.registerTypeUrl(); } }; function createBaseBroadcastTxRequest(): BroadcastTxRequest { @@ -871,6 +904,15 @@ function createBaseBroadcastTxRequest(): BroadcastTxRequest { export const BroadcastTxRequest = { typeUrl: "/cosmos.tx.v1beta1.BroadcastTxRequest", aminoType: "cosmos-sdk/BroadcastTxRequest", + is(o: any): o is BroadcastTxRequest { + return o && (o.$typeUrl === BroadcastTxRequest.typeUrl || (o.txBytes instanceof Uint8Array || typeof o.txBytes === "string") && isSet(o.mode)); + }, + isSDK(o: any): o is BroadcastTxRequestSDKType { + return o && (o.$typeUrl === BroadcastTxRequest.typeUrl || (o.tx_bytes instanceof Uint8Array || typeof o.tx_bytes === "string") && isSet(o.mode)); + }, + isAmino(o: any): o is BroadcastTxRequestAmino { + return o && (o.$typeUrl === BroadcastTxRequest.typeUrl || (o.tx_bytes instanceof Uint8Array || typeof o.tx_bytes === "string") && isSet(o.mode)); + }, encode(message: BroadcastTxRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.txBytes.length !== 0) { writer.uint32(10).bytes(message.txBytes); @@ -951,7 +993,8 @@ export const BroadcastTxRequest = { typeUrl: "/cosmos.tx.v1beta1.BroadcastTxRequest", value: BroadcastTxRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseBroadcastTxResponse(): BroadcastTxResponse { return { @@ -968,6 +1011,15 @@ function createBaseBroadcastTxResponse(): BroadcastTxResponse { export const BroadcastTxResponse = { typeUrl: "/cosmos.tx.v1beta1.BroadcastTxResponse", aminoType: "cosmos-sdk/BroadcastTxResponse", + is(o: any): o is BroadcastTxResponse { + return o && o.$typeUrl === BroadcastTxResponse.typeUrl; + }, + isSDK(o: any): o is BroadcastTxResponseSDKType { + return o && o.$typeUrl === BroadcastTxResponse.typeUrl; + }, + isAmino(o: any): o is BroadcastTxResponseAmino { + return o && o.$typeUrl === BroadcastTxResponse.typeUrl; + }, encode(message: BroadcastTxResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.txResponse !== undefined) { TxResponse.encode(message.txResponse, writer.uint32(10).fork()).ldelim(); @@ -1036,6 +1088,12 @@ export const BroadcastTxResponse = { typeUrl: "/cosmos.tx.v1beta1.BroadcastTxResponse", value: BroadcastTxResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(BroadcastTxResponse.typeUrl)) { + return; + } + TxResponse.registerTypeUrl(); } }; function createBaseSimulateRequest(): SimulateRequest { @@ -1054,6 +1112,15 @@ function createBaseSimulateRequest(): SimulateRequest { export const SimulateRequest = { typeUrl: "/cosmos.tx.v1beta1.SimulateRequest", aminoType: "cosmos-sdk/SimulateRequest", + is(o: any): o is SimulateRequest { + return o && (o.$typeUrl === SimulateRequest.typeUrl || o.txBytes instanceof Uint8Array || typeof o.txBytes === "string"); + }, + isSDK(o: any): o is SimulateRequestSDKType { + return o && (o.$typeUrl === SimulateRequest.typeUrl || o.tx_bytes instanceof Uint8Array || typeof o.tx_bytes === "string"); + }, + isAmino(o: any): o is SimulateRequestAmino { + return o && (o.$typeUrl === SimulateRequest.typeUrl || o.tx_bytes instanceof Uint8Array || typeof o.tx_bytes === "string"); + }, encode(message: SimulateRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.tx !== undefined) { Tx.encode(message.tx, writer.uint32(10).fork()).ldelim(); @@ -1136,6 +1203,12 @@ export const SimulateRequest = { typeUrl: "/cosmos.tx.v1beta1.SimulateRequest", value: SimulateRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(SimulateRequest.typeUrl)) { + return; + } + Tx.registerTypeUrl(); } }; function createBaseSimulateResponse(): SimulateResponse { @@ -1154,6 +1227,15 @@ function createBaseSimulateResponse(): SimulateResponse { export const SimulateResponse = { typeUrl: "/cosmos.tx.v1beta1.SimulateResponse", aminoType: "cosmos-sdk/SimulateResponse", + is(o: any): o is SimulateResponse { + return o && o.$typeUrl === SimulateResponse.typeUrl; + }, + isSDK(o: any): o is SimulateResponseSDKType { + return o && o.$typeUrl === SimulateResponse.typeUrl; + }, + isAmino(o: any): o is SimulateResponseAmino { + return o && o.$typeUrl === SimulateResponse.typeUrl; + }, encode(message: SimulateResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.gasInfo !== undefined) { GasInfo.encode(message.gasInfo, writer.uint32(10).fork()).ldelim(); @@ -1238,6 +1320,13 @@ export const SimulateResponse = { typeUrl: "/cosmos.tx.v1beta1.SimulateResponse", value: SimulateResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(SimulateResponse.typeUrl)) { + return; + } + GasInfo.registerTypeUrl(); + Result.registerTypeUrl(); } }; function createBaseGetTxRequest(): GetTxRequest { @@ -1255,6 +1344,15 @@ function createBaseGetTxRequest(): GetTxRequest { export const GetTxRequest = { typeUrl: "/cosmos.tx.v1beta1.GetTxRequest", aminoType: "cosmos-sdk/GetTxRequest", + is(o: any): o is GetTxRequest { + return o && (o.$typeUrl === GetTxRequest.typeUrl || typeof o.hash === "string"); + }, + isSDK(o: any): o is GetTxRequestSDKType { + return o && (o.$typeUrl === GetTxRequest.typeUrl || typeof o.hash === "string"); + }, + isAmino(o: any): o is GetTxRequestAmino { + return o && (o.$typeUrl === GetTxRequest.typeUrl || typeof o.hash === "string"); + }, encode(message: GetTxRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.hash !== "") { writer.uint32(10).string(message.hash); @@ -1321,7 +1419,8 @@ export const GetTxRequest = { typeUrl: "/cosmos.tx.v1beta1.GetTxRequest", value: GetTxRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseGetTxResponse(): GetTxResponse { return { @@ -1338,6 +1437,15 @@ function createBaseGetTxResponse(): GetTxResponse { export const GetTxResponse = { typeUrl: "/cosmos.tx.v1beta1.GetTxResponse", aminoType: "cosmos-sdk/GetTxResponse", + is(o: any): o is GetTxResponse { + return o && o.$typeUrl === GetTxResponse.typeUrl; + }, + isSDK(o: any): o is GetTxResponseSDKType { + return o && o.$typeUrl === GetTxResponse.typeUrl; + }, + isAmino(o: any): o is GetTxResponseAmino { + return o && o.$typeUrl === GetTxResponse.typeUrl; + }, encode(message: GetTxResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.tx !== undefined) { Tx.encode(message.tx, writer.uint32(10).fork()).ldelim(); @@ -1422,6 +1530,13 @@ export const GetTxResponse = { typeUrl: "/cosmos.tx.v1beta1.GetTxResponse", value: GetTxResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GetTxResponse.typeUrl)) { + return; + } + Tx.registerTypeUrl(); + TxResponse.registerTypeUrl(); } }; function createBaseGetBlockWithTxsRequest(): GetBlockWithTxsRequest { @@ -1442,6 +1557,15 @@ function createBaseGetBlockWithTxsRequest(): GetBlockWithTxsRequest { export const GetBlockWithTxsRequest = { typeUrl: "/cosmos.tx.v1beta1.GetBlockWithTxsRequest", aminoType: "cosmos-sdk/GetBlockWithTxsRequest", + is(o: any): o is GetBlockWithTxsRequest { + return o && (o.$typeUrl === GetBlockWithTxsRequest.typeUrl || typeof o.height === "bigint"); + }, + isSDK(o: any): o is GetBlockWithTxsRequestSDKType { + return o && (o.$typeUrl === GetBlockWithTxsRequest.typeUrl || typeof o.height === "bigint"); + }, + isAmino(o: any): o is GetBlockWithTxsRequestAmino { + return o && (o.$typeUrl === GetBlockWithTxsRequest.typeUrl || typeof o.height === "bigint"); + }, encode(message: GetBlockWithTxsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.height !== BigInt(0)) { writer.uint32(8).int64(message.height); @@ -1526,6 +1650,12 @@ export const GetBlockWithTxsRequest = { typeUrl: "/cosmos.tx.v1beta1.GetBlockWithTxsRequest", value: GetBlockWithTxsRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GetBlockWithTxsRequest.typeUrl)) { + return; + } + PageRequest.registerTypeUrl(); } }; function createBaseGetBlockWithTxsResponse(): GetBlockWithTxsResponse { @@ -1547,6 +1677,15 @@ function createBaseGetBlockWithTxsResponse(): GetBlockWithTxsResponse { export const GetBlockWithTxsResponse = { typeUrl: "/cosmos.tx.v1beta1.GetBlockWithTxsResponse", aminoType: "cosmos-sdk/GetBlockWithTxsResponse", + is(o: any): o is GetBlockWithTxsResponse { + return o && (o.$typeUrl === GetBlockWithTxsResponse.typeUrl || Array.isArray(o.txs) && (!o.txs.length || Tx.is(o.txs[0]))); + }, + isSDK(o: any): o is GetBlockWithTxsResponseSDKType { + return o && (o.$typeUrl === GetBlockWithTxsResponse.typeUrl || Array.isArray(o.txs) && (!o.txs.length || Tx.isSDK(o.txs[0]))); + }, + isAmino(o: any): o is GetBlockWithTxsResponseAmino { + return o && (o.$typeUrl === GetBlockWithTxsResponse.typeUrl || Array.isArray(o.txs) && (!o.txs.length || Tx.isAmino(o.txs[0]))); + }, encode(message: GetBlockWithTxsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.txs) { Tx.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -1667,5 +1806,14 @@ export const GetBlockWithTxsResponse = { typeUrl: "/cosmos.tx.v1beta1.GetBlockWithTxsResponse", value: GetBlockWithTxsResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GetBlockWithTxsResponse.typeUrl)) { + return; + } + Tx.registerTypeUrl(); + BlockID.registerTypeUrl(); + Block.registerTypeUrl(); + PageResponse.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/cosmos/tx/v1beta1/tx.ts b/__fixtures__/v-next/outputv3/cosmos/tx/v1beta1/tx.ts index 4042504c30..5a7c672682 100644 --- a/__fixtures__/v-next/outputv3/cosmos/tx/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputv3/cosmos/tx/v1beta1/tx.ts @@ -3,6 +3,7 @@ import { SignMode, SignModeSDKType, signModeFromJSON, signModeToJSON } from "../ import { CompactBitArray, CompactBitArrayAmino, CompactBitArraySDKType } from "../../crypto/multisig/v1beta1/multisig"; import { Coin, CoinAmino, CoinSDKType } from "../../base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; +import { GlobalDecoderRegistry } from "../../../registry"; import { isSet, bytesFromBase64, DeepPartial, base64FromBytes } from "../../../helpers"; export const protobufPackage = "cosmos.tx.v1beta1"; /** @@ -925,6 +926,15 @@ function createBaseTx(): Tx { export const Tx = { typeUrl: "/cosmos.tx.v1beta1.Tx", aminoType: "cosmos-sdk/Tx", + is(o: any): o is Tx { + return o && (o.$typeUrl === Tx.typeUrl || Array.isArray(o.signatures) && (!o.signatures.length || o.signatures[0] instanceof Uint8Array || typeof o.signatures[0] === "string")); + }, + isSDK(o: any): o is TxSDKType { + return o && (o.$typeUrl === Tx.typeUrl || Array.isArray(o.signatures) && (!o.signatures.length || o.signatures[0] instanceof Uint8Array || typeof o.signatures[0] === "string")); + }, + isAmino(o: any): o is TxAmino { + return o && (o.$typeUrl === Tx.typeUrl || Array.isArray(o.signatures) && (!o.signatures.length || o.signatures[0] instanceof Uint8Array || typeof o.signatures[0] === "string")); + }, encode(message: Tx, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.body !== undefined) { TxBody.encode(message.body, writer.uint32(10).fork()).ldelim(); @@ -1029,6 +1039,13 @@ export const Tx = { typeUrl: "/cosmos.tx.v1beta1.Tx", value: Tx.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Tx.typeUrl)) { + return; + } + TxBody.registerTypeUrl(); + AuthInfo.registerTypeUrl(); } }; function createBaseTxRaw(): TxRaw { @@ -1051,6 +1068,15 @@ function createBaseTxRaw(): TxRaw { export const TxRaw = { typeUrl: "/cosmos.tx.v1beta1.TxRaw", aminoType: "cosmos-sdk/TxRaw", + is(o: any): o is TxRaw { + return o && (o.$typeUrl === TxRaw.typeUrl || (o.bodyBytes instanceof Uint8Array || typeof o.bodyBytes === "string") && (o.authInfoBytes instanceof Uint8Array || typeof o.authInfoBytes === "string") && Array.isArray(o.signatures) && (!o.signatures.length || o.signatures[0] instanceof Uint8Array || typeof o.signatures[0] === "string")); + }, + isSDK(o: any): o is TxRawSDKType { + return o && (o.$typeUrl === TxRaw.typeUrl || (o.body_bytes instanceof Uint8Array || typeof o.body_bytes === "string") && (o.auth_info_bytes instanceof Uint8Array || typeof o.auth_info_bytes === "string") && Array.isArray(o.signatures) && (!o.signatures.length || o.signatures[0] instanceof Uint8Array || typeof o.signatures[0] === "string")); + }, + isAmino(o: any): o is TxRawAmino { + return o && (o.$typeUrl === TxRaw.typeUrl || (o.body_bytes instanceof Uint8Array || typeof o.body_bytes === "string") && (o.auth_info_bytes instanceof Uint8Array || typeof o.auth_info_bytes === "string") && Array.isArray(o.signatures) && (!o.signatures.length || o.signatures[0] instanceof Uint8Array || typeof o.signatures[0] === "string")); + }, encode(message: TxRaw, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.bodyBytes.length !== 0) { writer.uint32(10).bytes(message.bodyBytes); @@ -1151,7 +1177,8 @@ export const TxRaw = { typeUrl: "/cosmos.tx.v1beta1.TxRaw", value: TxRaw.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseSignDoc(): SignDoc { return { @@ -1170,6 +1197,15 @@ function createBaseSignDoc(): SignDoc { export const SignDoc = { typeUrl: "/cosmos.tx.v1beta1.SignDoc", aminoType: "cosmos-sdk/SignDoc", + is(o: any): o is SignDoc { + return o && (o.$typeUrl === SignDoc.typeUrl || (o.bodyBytes instanceof Uint8Array || typeof o.bodyBytes === "string") && (o.authInfoBytes instanceof Uint8Array || typeof o.authInfoBytes === "string") && typeof o.chainId === "string" && typeof o.accountNumber === "bigint"); + }, + isSDK(o: any): o is SignDocSDKType { + return o && (o.$typeUrl === SignDoc.typeUrl || (o.body_bytes instanceof Uint8Array || typeof o.body_bytes === "string") && (o.auth_info_bytes instanceof Uint8Array || typeof o.auth_info_bytes === "string") && typeof o.chain_id === "string" && typeof o.account_number === "bigint"); + }, + isAmino(o: any): o is SignDocAmino { + return o && (o.$typeUrl === SignDoc.typeUrl || (o.body_bytes instanceof Uint8Array || typeof o.body_bytes === "string") && (o.auth_info_bytes instanceof Uint8Array || typeof o.auth_info_bytes === "string") && typeof o.chain_id === "string" && typeof o.account_number === "bigint"); + }, encode(message: SignDoc, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.bodyBytes.length !== 0) { writer.uint32(10).bytes(message.bodyBytes); @@ -1280,7 +1316,8 @@ export const SignDoc = { typeUrl: "/cosmos.tx.v1beta1.SignDoc", value: SignDoc.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseSignDocDirectAux(): SignDocDirectAux { return { @@ -1304,6 +1341,15 @@ function createBaseSignDocDirectAux(): SignDocDirectAux { export const SignDocDirectAux = { typeUrl: "/cosmos.tx.v1beta1.SignDocDirectAux", aminoType: "cosmos-sdk/SignDocDirectAux", + is(o: any): o is SignDocDirectAux { + return o && (o.$typeUrl === SignDocDirectAux.typeUrl || (o.bodyBytes instanceof Uint8Array || typeof o.bodyBytes === "string") && typeof o.chainId === "string" && typeof o.accountNumber === "bigint" && typeof o.sequence === "bigint"); + }, + isSDK(o: any): o is SignDocDirectAuxSDKType { + return o && (o.$typeUrl === SignDocDirectAux.typeUrl || (o.body_bytes instanceof Uint8Array || typeof o.body_bytes === "string") && typeof o.chain_id === "string" && typeof o.account_number === "bigint" && typeof o.sequence === "bigint"); + }, + isAmino(o: any): o is SignDocDirectAuxAmino { + return o && (o.$typeUrl === SignDocDirectAux.typeUrl || (o.body_bytes instanceof Uint8Array || typeof o.body_bytes === "string") && typeof o.chain_id === "string" && typeof o.account_number === "bigint" && typeof o.sequence === "bigint"); + }, encode(message: SignDocDirectAux, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.bodyBytes.length !== 0) { writer.uint32(10).bytes(message.bodyBytes); @@ -1448,6 +1494,12 @@ export const SignDocDirectAux = { typeUrl: "/cosmos.tx.v1beta1.SignDocDirectAux", value: SignDocDirectAux.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(SignDocDirectAux.typeUrl)) { + return; + } + Tip.registerTypeUrl(); } }; function createBaseTxBody(): TxBody { @@ -1468,6 +1520,15 @@ function createBaseTxBody(): TxBody { export const TxBody = { typeUrl: "/cosmos.tx.v1beta1.TxBody", aminoType: "cosmos-sdk/TxBody", + is(o: any): o is TxBody { + return o && (o.$typeUrl === TxBody.typeUrl || Array.isArray(o.messages) && (!o.messages.length || Any.is(o.messages[0])) && typeof o.memo === "string" && typeof o.timeoutHeight === "bigint" && Array.isArray(o.extensionOptions) && (!o.extensionOptions.length || Any.is(o.extensionOptions[0])) && Array.isArray(o.nonCriticalExtensionOptions) && (!o.nonCriticalExtensionOptions.length || Any.is(o.nonCriticalExtensionOptions[0]))); + }, + isSDK(o: any): o is TxBodySDKType { + return o && (o.$typeUrl === TxBody.typeUrl || Array.isArray(o.messages) && (!o.messages.length || Any.isSDK(o.messages[0])) && typeof o.memo === "string" && typeof o.timeout_height === "bigint" && Array.isArray(o.extension_options) && (!o.extension_options.length || Any.isSDK(o.extension_options[0])) && Array.isArray(o.non_critical_extension_options) && (!o.non_critical_extension_options.length || Any.isSDK(o.non_critical_extension_options[0]))); + }, + isAmino(o: any): o is TxBodyAmino { + return o && (o.$typeUrl === TxBody.typeUrl || Array.isArray(o.messages) && (!o.messages.length || Any.isAmino(o.messages[0])) && typeof o.memo === "string" && typeof o.timeout_height === "bigint" && Array.isArray(o.extension_options) && (!o.extension_options.length || Any.isAmino(o.extension_options[0])) && Array.isArray(o.non_critical_extension_options) && (!o.non_critical_extension_options.length || Any.isAmino(o.non_critical_extension_options[0]))); + }, encode(message: TxBody, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.messages) { Any.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -1610,7 +1671,8 @@ export const TxBody = { typeUrl: "/cosmos.tx.v1beta1.TxBody", value: TxBody.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseAuthInfo(): AuthInfo { return { @@ -1629,6 +1691,15 @@ function createBaseAuthInfo(): AuthInfo { export const AuthInfo = { typeUrl: "/cosmos.tx.v1beta1.AuthInfo", aminoType: "cosmos-sdk/AuthInfo", + is(o: any): o is AuthInfo { + return o && (o.$typeUrl === AuthInfo.typeUrl || Array.isArray(o.signerInfos) && (!o.signerInfos.length || SignerInfo.is(o.signerInfos[0]))); + }, + isSDK(o: any): o is AuthInfoSDKType { + return o && (o.$typeUrl === AuthInfo.typeUrl || Array.isArray(o.signer_infos) && (!o.signer_infos.length || SignerInfo.isSDK(o.signer_infos[0]))); + }, + isAmino(o: any): o is AuthInfoAmino { + return o && (o.$typeUrl === AuthInfo.typeUrl || Array.isArray(o.signer_infos) && (!o.signer_infos.length || SignerInfo.isAmino(o.signer_infos[0]))); + }, encode(message: AuthInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.signerInfos) { SignerInfo.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -1733,6 +1804,14 @@ export const AuthInfo = { typeUrl: "/cosmos.tx.v1beta1.AuthInfo", value: AuthInfo.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(AuthInfo.typeUrl)) { + return; + } + SignerInfo.registerTypeUrl(); + Fee.registerTypeUrl(); + Tip.registerTypeUrl(); } }; function createBaseSignerInfo(): SignerInfo { @@ -1752,6 +1831,15 @@ function createBaseSignerInfo(): SignerInfo { export const SignerInfo = { typeUrl: "/cosmos.tx.v1beta1.SignerInfo", aminoType: "cosmos-sdk/SignerInfo", + is(o: any): o is SignerInfo { + return o && (o.$typeUrl === SignerInfo.typeUrl || typeof o.sequence === "bigint"); + }, + isSDK(o: any): o is SignerInfoSDKType { + return o && (o.$typeUrl === SignerInfo.typeUrl || typeof o.sequence === "bigint"); + }, + isAmino(o: any): o is SignerInfoAmino { + return o && (o.$typeUrl === SignerInfo.typeUrl || typeof o.sequence === "bigint"); + }, encode(message: SignerInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.publicKey !== undefined) { Any.encode(message.publicKey, writer.uint32(10).fork()).ldelim(); @@ -1852,6 +1940,12 @@ export const SignerInfo = { typeUrl: "/cosmos.tx.v1beta1.SignerInfo", value: SignerInfo.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(SignerInfo.typeUrl)) { + return; + } + ModeInfo.registerTypeUrl(); } }; function createBaseModeInfo(): ModeInfo { @@ -1869,6 +1963,15 @@ function createBaseModeInfo(): ModeInfo { export const ModeInfo = { typeUrl: "/cosmos.tx.v1beta1.ModeInfo", aminoType: "cosmos-sdk/ModeInfo", + is(o: any): o is ModeInfo { + return o && o.$typeUrl === ModeInfo.typeUrl; + }, + isSDK(o: any): o is ModeInfoSDKType { + return o && o.$typeUrl === ModeInfo.typeUrl; + }, + isAmino(o: any): o is ModeInfoAmino { + return o && o.$typeUrl === ModeInfo.typeUrl; + }, encode(message: ModeInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.single !== undefined) { ModeInfo_Single.encode(message.single, writer.uint32(10).fork()).ldelim(); @@ -1953,6 +2056,13 @@ export const ModeInfo = { typeUrl: "/cosmos.tx.v1beta1.ModeInfo", value: ModeInfo.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ModeInfo.typeUrl)) { + return; + } + ModeInfo_Single.registerTypeUrl(); + ModeInfo_Multi.registerTypeUrl(); } }; function createBaseModeInfo_Single(): ModeInfo_Single { @@ -1971,6 +2081,15 @@ function createBaseModeInfo_Single(): ModeInfo_Single { export const ModeInfo_Single = { typeUrl: "/cosmos.tx.v1beta1.Single", aminoType: "cosmos-sdk/Single", + is(o: any): o is ModeInfo_Single { + return o && (o.$typeUrl === ModeInfo_Single.typeUrl || isSet(o.mode)); + }, + isSDK(o: any): o is ModeInfo_SingleSDKType { + return o && (o.$typeUrl === ModeInfo_Single.typeUrl || isSet(o.mode)); + }, + isAmino(o: any): o is ModeInfo_SingleAmino { + return o && (o.$typeUrl === ModeInfo_Single.typeUrl || isSet(o.mode)); + }, encode(message: ModeInfo_Single, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.mode !== 0) { writer.uint32(8).int32(message.mode); @@ -2037,7 +2156,8 @@ export const ModeInfo_Single = { typeUrl: "/cosmos.tx.v1beta1.Single", value: ModeInfo_Single.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseModeInfo_Multi(): ModeInfo_Multi { return { @@ -2054,6 +2174,15 @@ function createBaseModeInfo_Multi(): ModeInfo_Multi { export const ModeInfo_Multi = { typeUrl: "/cosmos.tx.v1beta1.Multi", aminoType: "cosmos-sdk/Multi", + is(o: any): o is ModeInfo_Multi { + return o && (o.$typeUrl === ModeInfo_Multi.typeUrl || Array.isArray(o.modeInfos) && (!o.modeInfos.length || ModeInfo.is(o.modeInfos[0]))); + }, + isSDK(o: any): o is ModeInfo_MultiSDKType { + return o && (o.$typeUrl === ModeInfo_Multi.typeUrl || Array.isArray(o.mode_infos) && (!o.mode_infos.length || ModeInfo.isSDK(o.mode_infos[0]))); + }, + isAmino(o: any): o is ModeInfo_MultiAmino { + return o && (o.$typeUrl === ModeInfo_Multi.typeUrl || Array.isArray(o.mode_infos) && (!o.mode_infos.length || ModeInfo.isAmino(o.mode_infos[0]))); + }, encode(message: ModeInfo_Multi, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.bitarray !== undefined) { CompactBitArray.encode(message.bitarray, writer.uint32(10).fork()).ldelim(); @@ -2142,6 +2271,13 @@ export const ModeInfo_Multi = { typeUrl: "/cosmos.tx.v1beta1.Multi", value: ModeInfo_Multi.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ModeInfo_Multi.typeUrl)) { + return; + } + CompactBitArray.registerTypeUrl(); + ModeInfo.registerTypeUrl(); } }; function createBaseFee(): Fee { @@ -2163,6 +2299,15 @@ function createBaseFee(): Fee { export const Fee = { typeUrl: "/cosmos.tx.v1beta1.Fee", aminoType: "cosmos-sdk/Fee", + is(o: any): o is Fee { + return o && (o.$typeUrl === Fee.typeUrl || Array.isArray(o.amount) && (!o.amount.length || Coin.is(o.amount[0])) && typeof o.gasLimit === "bigint" && typeof o.payer === "string" && typeof o.granter === "string"); + }, + isSDK(o: any): o is FeeSDKType { + return o && (o.$typeUrl === Fee.typeUrl || Array.isArray(o.amount) && (!o.amount.length || Coin.isSDK(o.amount[0])) && typeof o.gas_limit === "bigint" && typeof o.payer === "string" && typeof o.granter === "string"); + }, + isAmino(o: any): o is FeeAmino { + return o && (o.$typeUrl === Fee.typeUrl || Array.isArray(o.amount) && (!o.amount.length || Coin.isAmino(o.amount[0])) && typeof o.gas_limit === "bigint" && typeof o.payer === "string" && typeof o.granter === "string"); + }, encode(message: Fee, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.amount) { Coin.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -2279,6 +2424,12 @@ export const Fee = { typeUrl: "/cosmos.tx.v1beta1.Fee", value: Fee.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Fee.typeUrl)) { + return; + } + Coin.registerTypeUrl(); } }; function createBaseTip(): Tip { @@ -2298,6 +2449,15 @@ function createBaseTip(): Tip { export const Tip = { typeUrl: "/cosmos.tx.v1beta1.Tip", aminoType: "cosmos-sdk/Tip", + is(o: any): o is Tip { + return o && (o.$typeUrl === Tip.typeUrl || Array.isArray(o.amount) && (!o.amount.length || Coin.is(o.amount[0])) && typeof o.tipper === "string"); + }, + isSDK(o: any): o is TipSDKType { + return o && (o.$typeUrl === Tip.typeUrl || Array.isArray(o.amount) && (!o.amount.length || Coin.isSDK(o.amount[0])) && typeof o.tipper === "string"); + }, + isAmino(o: any): o is TipAmino { + return o && (o.$typeUrl === Tip.typeUrl || Array.isArray(o.amount) && (!o.amount.length || Coin.isAmino(o.amount[0])) && typeof o.tipper === "string"); + }, encode(message: Tip, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.amount) { Coin.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -2384,6 +2544,12 @@ export const Tip = { typeUrl: "/cosmos.tx.v1beta1.Tip", value: Tip.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Tip.typeUrl)) { + return; + } + Coin.registerTypeUrl(); } }; function createBaseAuxSignerData(): AuxSignerData { @@ -2408,6 +2574,15 @@ function createBaseAuxSignerData(): AuxSignerData { export const AuxSignerData = { typeUrl: "/cosmos.tx.v1beta1.AuxSignerData", aminoType: "cosmos-sdk/AuxSignerData", + is(o: any): o is AuxSignerData { + return o && (o.$typeUrl === AuxSignerData.typeUrl || typeof o.address === "string" && isSet(o.mode) && (o.sig instanceof Uint8Array || typeof o.sig === "string")); + }, + isSDK(o: any): o is AuxSignerDataSDKType { + return o && (o.$typeUrl === AuxSignerData.typeUrl || typeof o.address === "string" && isSet(o.mode) && (o.sig instanceof Uint8Array || typeof o.sig === "string")); + }, + isAmino(o: any): o is AuxSignerDataAmino { + return o && (o.$typeUrl === AuxSignerData.typeUrl || typeof o.address === "string" && isSet(o.mode) && (o.sig instanceof Uint8Array || typeof o.sig === "string")); + }, encode(message: AuxSignerData, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.address !== "") { writer.uint32(10).string(message.address); @@ -2518,5 +2693,11 @@ export const AuxSignerData = { typeUrl: "/cosmos.tx.v1beta1.AuxSignerData", value: AuxSignerData.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(AuxSignerData.typeUrl)) { + return; + } + SignDocDirectAux.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/cosmos/upgrade/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputv3/cosmos/upgrade/v1beta1/query.rpc.func.ts new file mode 100644 index 0000000000..82d1ae05b1 --- /dev/null +++ b/__fixtures__/v-next/outputv3/cosmos/upgrade/v1beta1/query.rpc.func.ts @@ -0,0 +1,76 @@ +import { Plan, PlanSDKType, ModuleVersion, ModuleVersionSDKType } from "./upgrade"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { QueryCurrentPlanRequest, QueryCurrentPlanRequestSDKType, QueryCurrentPlanResponse, QueryCurrentPlanResponseSDKType, QueryAppliedPlanRequest, QueryAppliedPlanRequestSDKType, QueryAppliedPlanResponse, QueryAppliedPlanResponseSDKType, QueryUpgradedConsensusStateRequest, QueryUpgradedConsensusStateRequestSDKType, QueryUpgradedConsensusStateResponse, QueryUpgradedConsensusStateResponseSDKType, QueryModuleVersionsRequest, QueryModuleVersionsRequestSDKType, QueryModuleVersionsResponse, QueryModuleVersionsResponseSDKType, QueryAuthorityRequest, QueryAuthorityRequestSDKType, QueryAuthorityResponse, QueryAuthorityResponseSDKType } from "./query"; +/** + * CurrentPlan queries the current upgrade plan. + * @name getCurrentPlan + * @package cosmos.upgrade.v1beta1 + * @see proto service: cosmos.upgrade.v1beta1.CurrentPlan + */ +export const getCurrentPlan = buildQuery({ + encode: QueryCurrentPlanRequest.encode, + decode: QueryCurrentPlanResponse.decode, + service: "cosmos.upgrade.v1beta1.Query", + method: "CurrentPlan", + deps: [QueryCurrentPlanRequest, QueryCurrentPlanResponse] +}); +/** + * AppliedPlan queries a previously applied upgrade plan by its name. + * @name getAppliedPlan + * @package cosmos.upgrade.v1beta1 + * @see proto service: cosmos.upgrade.v1beta1.AppliedPlan + */ +export const getAppliedPlan = buildQuery({ + encode: QueryAppliedPlanRequest.encode, + decode: QueryAppliedPlanResponse.decode, + service: "cosmos.upgrade.v1beta1.Query", + method: "AppliedPlan", + deps: [QueryAppliedPlanRequest, QueryAppliedPlanResponse] +}); +/** + * UpgradedConsensusState queries the consensus state that will serve + * as a trusted kernel for the next version of this chain. It will only be + * stored at the last height of this chain. + * UpgradedConsensusState RPC not supported with legacy querier + * This rpc is deprecated now that IBC has its own replacement + * (https://github.com/cosmos/ibc-go/blob/2c880a22e9f9cc75f62b527ca94aa75ce1106001/proto/ibc/core/client/v1/query.proto#L54) + * @name getUpgradedConsensusState + * @package cosmos.upgrade.v1beta1 + * @see proto service: cosmos.upgrade.v1beta1.UpgradedConsensusState + * @deprecated + */ +export const getUpgradedConsensusState = buildQuery({ + encode: QueryUpgradedConsensusStateRequest.encode, + decode: QueryUpgradedConsensusStateResponse.decode, + service: "cosmos.upgrade.v1beta1.Query", + method: "UpgradedConsensusState", + deps: [QueryUpgradedConsensusStateRequest, QueryUpgradedConsensusStateResponse] +}); +/** + * ModuleVersions queries the list of module versions from state. + * + * Since: cosmos-sdk 0.43 + * @name getModuleVersions + * @package cosmos.upgrade.v1beta1 + * @see proto service: cosmos.upgrade.v1beta1.ModuleVersions + */ +export const getModuleVersions = buildQuery({ + encode: QueryModuleVersionsRequest.encode, + decode: QueryModuleVersionsResponse.decode, + service: "cosmos.upgrade.v1beta1.Query", + method: "ModuleVersions", + deps: [QueryModuleVersionsRequest, QueryModuleVersionsResponse] +}); +/** + * Returns the account with authority to conduct upgrades + * @name getAuthority + * @package cosmos.upgrade.v1beta1 + * @see proto service: cosmos.upgrade.v1beta1.Authority + */ +export const getAuthority = buildQuery({ + encode: QueryAuthorityRequest.encode, + decode: QueryAuthorityResponse.decode, + service: "cosmos.upgrade.v1beta1.Query", + method: "Authority", + deps: [QueryAuthorityRequest, QueryAuthorityResponse] +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/cosmos/upgrade/v1beta1/query.ts b/__fixtures__/v-next/outputv3/cosmos/upgrade/v1beta1/query.ts index 500ed784f7..1d2ddd2842 100644 --- a/__fixtures__/v-next/outputv3/cosmos/upgrade/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv3/cosmos/upgrade/v1beta1/query.ts @@ -1,6 +1,7 @@ import { Plan, PlanAmino, PlanSDKType, ModuleVersion, ModuleVersionAmino, ModuleVersionSDKType } from "./upgrade"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { DeepPartial, isSet, bytesFromBase64, base64FromBytes } from "../../../helpers"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "cosmos.upgrade.v1beta1"; /** * QueryCurrentPlanRequest is the request type for the Query/CurrentPlan RPC @@ -415,6 +416,15 @@ function createBaseQueryCurrentPlanRequest(): QueryCurrentPlanRequest { export const QueryCurrentPlanRequest = { typeUrl: "/cosmos.upgrade.v1beta1.QueryCurrentPlanRequest", aminoType: "cosmos-sdk/QueryCurrentPlanRequest", + is(o: any): o is QueryCurrentPlanRequest { + return o && o.$typeUrl === QueryCurrentPlanRequest.typeUrl; + }, + isSDK(o: any): o is QueryCurrentPlanRequestSDKType { + return o && o.$typeUrl === QueryCurrentPlanRequest.typeUrl; + }, + isAmino(o: any): o is QueryCurrentPlanRequestAmino { + return o && o.$typeUrl === QueryCurrentPlanRequest.typeUrl; + }, encode(_: QueryCurrentPlanRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -466,7 +476,8 @@ export const QueryCurrentPlanRequest = { typeUrl: "/cosmos.upgrade.v1beta1.QueryCurrentPlanRequest", value: QueryCurrentPlanRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryCurrentPlanResponse(): QueryCurrentPlanResponse { return { @@ -483,6 +494,15 @@ function createBaseQueryCurrentPlanResponse(): QueryCurrentPlanResponse { export const QueryCurrentPlanResponse = { typeUrl: "/cosmos.upgrade.v1beta1.QueryCurrentPlanResponse", aminoType: "cosmos-sdk/QueryCurrentPlanResponse", + is(o: any): o is QueryCurrentPlanResponse { + return o && o.$typeUrl === QueryCurrentPlanResponse.typeUrl; + }, + isSDK(o: any): o is QueryCurrentPlanResponseSDKType { + return o && o.$typeUrl === QueryCurrentPlanResponse.typeUrl; + }, + isAmino(o: any): o is QueryCurrentPlanResponseAmino { + return o && o.$typeUrl === QueryCurrentPlanResponse.typeUrl; + }, encode(message: QueryCurrentPlanResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.plan !== undefined) { Plan.encode(message.plan, writer.uint32(10).fork()).ldelim(); @@ -551,6 +571,12 @@ export const QueryCurrentPlanResponse = { typeUrl: "/cosmos.upgrade.v1beta1.QueryCurrentPlanResponse", value: QueryCurrentPlanResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryCurrentPlanResponse.typeUrl)) { + return; + } + Plan.registerTypeUrl(); } }; function createBaseQueryAppliedPlanRequest(): QueryAppliedPlanRequest { @@ -568,6 +594,15 @@ function createBaseQueryAppliedPlanRequest(): QueryAppliedPlanRequest { export const QueryAppliedPlanRequest = { typeUrl: "/cosmos.upgrade.v1beta1.QueryAppliedPlanRequest", aminoType: "cosmos-sdk/QueryAppliedPlanRequest", + is(o: any): o is QueryAppliedPlanRequest { + return o && (o.$typeUrl === QueryAppliedPlanRequest.typeUrl || typeof o.name === "string"); + }, + isSDK(o: any): o is QueryAppliedPlanRequestSDKType { + return o && (o.$typeUrl === QueryAppliedPlanRequest.typeUrl || typeof o.name === "string"); + }, + isAmino(o: any): o is QueryAppliedPlanRequestAmino { + return o && (o.$typeUrl === QueryAppliedPlanRequest.typeUrl || typeof o.name === "string"); + }, encode(message: QueryAppliedPlanRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -634,7 +669,8 @@ export const QueryAppliedPlanRequest = { typeUrl: "/cosmos.upgrade.v1beta1.QueryAppliedPlanRequest", value: QueryAppliedPlanRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryAppliedPlanResponse(): QueryAppliedPlanResponse { return { @@ -651,6 +687,15 @@ function createBaseQueryAppliedPlanResponse(): QueryAppliedPlanResponse { export const QueryAppliedPlanResponse = { typeUrl: "/cosmos.upgrade.v1beta1.QueryAppliedPlanResponse", aminoType: "cosmos-sdk/QueryAppliedPlanResponse", + is(o: any): o is QueryAppliedPlanResponse { + return o && (o.$typeUrl === QueryAppliedPlanResponse.typeUrl || typeof o.height === "bigint"); + }, + isSDK(o: any): o is QueryAppliedPlanResponseSDKType { + return o && (o.$typeUrl === QueryAppliedPlanResponse.typeUrl || typeof o.height === "bigint"); + }, + isAmino(o: any): o is QueryAppliedPlanResponseAmino { + return o && (o.$typeUrl === QueryAppliedPlanResponse.typeUrl || typeof o.height === "bigint"); + }, encode(message: QueryAppliedPlanResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.height !== BigInt(0)) { writer.uint32(8).int64(message.height); @@ -719,7 +764,8 @@ export const QueryAppliedPlanResponse = { typeUrl: "/cosmos.upgrade.v1beta1.QueryAppliedPlanResponse", value: QueryAppliedPlanResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryUpgradedConsensusStateRequest(): QueryUpgradedConsensusStateRequest { return { @@ -737,6 +783,15 @@ function createBaseQueryUpgradedConsensusStateRequest(): QueryUpgradedConsensusS export const QueryUpgradedConsensusStateRequest = { typeUrl: "/cosmos.upgrade.v1beta1.QueryUpgradedConsensusStateRequest", aminoType: "cosmos-sdk/QueryUpgradedConsensusStateRequest", + is(o: any): o is QueryUpgradedConsensusStateRequest { + return o && (o.$typeUrl === QueryUpgradedConsensusStateRequest.typeUrl || typeof o.lastHeight === "bigint"); + }, + isSDK(o: any): o is QueryUpgradedConsensusStateRequestSDKType { + return o && (o.$typeUrl === QueryUpgradedConsensusStateRequest.typeUrl || typeof o.last_height === "bigint"); + }, + isAmino(o: any): o is QueryUpgradedConsensusStateRequestAmino { + return o && (o.$typeUrl === QueryUpgradedConsensusStateRequest.typeUrl || typeof o.last_height === "bigint"); + }, encode(message: QueryUpgradedConsensusStateRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.lastHeight !== BigInt(0)) { writer.uint32(8).int64(message.lastHeight); @@ -805,7 +860,8 @@ export const QueryUpgradedConsensusStateRequest = { typeUrl: "/cosmos.upgrade.v1beta1.QueryUpgradedConsensusStateRequest", value: QueryUpgradedConsensusStateRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryUpgradedConsensusStateResponse(): QueryUpgradedConsensusStateResponse { return { @@ -823,6 +879,15 @@ function createBaseQueryUpgradedConsensusStateResponse(): QueryUpgradedConsensus export const QueryUpgradedConsensusStateResponse = { typeUrl: "/cosmos.upgrade.v1beta1.QueryUpgradedConsensusStateResponse", aminoType: "cosmos-sdk/QueryUpgradedConsensusStateResponse", + is(o: any): o is QueryUpgradedConsensusStateResponse { + return o && (o.$typeUrl === QueryUpgradedConsensusStateResponse.typeUrl || o.upgradedConsensusState instanceof Uint8Array || typeof o.upgradedConsensusState === "string"); + }, + isSDK(o: any): o is QueryUpgradedConsensusStateResponseSDKType { + return o && (o.$typeUrl === QueryUpgradedConsensusStateResponse.typeUrl || o.upgraded_consensus_state instanceof Uint8Array || typeof o.upgraded_consensus_state === "string"); + }, + isAmino(o: any): o is QueryUpgradedConsensusStateResponseAmino { + return o && (o.$typeUrl === QueryUpgradedConsensusStateResponse.typeUrl || o.upgraded_consensus_state instanceof Uint8Array || typeof o.upgraded_consensus_state === "string"); + }, encode(message: QueryUpgradedConsensusStateResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.upgradedConsensusState.length !== 0) { writer.uint32(18).bytes(message.upgradedConsensusState); @@ -889,7 +954,8 @@ export const QueryUpgradedConsensusStateResponse = { typeUrl: "/cosmos.upgrade.v1beta1.QueryUpgradedConsensusStateResponse", value: QueryUpgradedConsensusStateResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryModuleVersionsRequest(): QueryModuleVersionsRequest { return { @@ -908,6 +974,15 @@ function createBaseQueryModuleVersionsRequest(): QueryModuleVersionsRequest { export const QueryModuleVersionsRequest = { typeUrl: "/cosmos.upgrade.v1beta1.QueryModuleVersionsRequest", aminoType: "cosmos-sdk/QueryModuleVersionsRequest", + is(o: any): o is QueryModuleVersionsRequest { + return o && (o.$typeUrl === QueryModuleVersionsRequest.typeUrl || typeof o.moduleName === "string"); + }, + isSDK(o: any): o is QueryModuleVersionsRequestSDKType { + return o && (o.$typeUrl === QueryModuleVersionsRequest.typeUrl || typeof o.module_name === "string"); + }, + isAmino(o: any): o is QueryModuleVersionsRequestAmino { + return o && (o.$typeUrl === QueryModuleVersionsRequest.typeUrl || typeof o.module_name === "string"); + }, encode(message: QueryModuleVersionsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.moduleName !== "") { writer.uint32(10).string(message.moduleName); @@ -974,7 +1049,8 @@ export const QueryModuleVersionsRequest = { typeUrl: "/cosmos.upgrade.v1beta1.QueryModuleVersionsRequest", value: QueryModuleVersionsRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryModuleVersionsResponse(): QueryModuleVersionsResponse { return { @@ -993,6 +1069,15 @@ function createBaseQueryModuleVersionsResponse(): QueryModuleVersionsResponse { export const QueryModuleVersionsResponse = { typeUrl: "/cosmos.upgrade.v1beta1.QueryModuleVersionsResponse", aminoType: "cosmos-sdk/QueryModuleVersionsResponse", + is(o: any): o is QueryModuleVersionsResponse { + return o && (o.$typeUrl === QueryModuleVersionsResponse.typeUrl || Array.isArray(o.moduleVersions) && (!o.moduleVersions.length || ModuleVersion.is(o.moduleVersions[0]))); + }, + isSDK(o: any): o is QueryModuleVersionsResponseSDKType { + return o && (o.$typeUrl === QueryModuleVersionsResponse.typeUrl || Array.isArray(o.module_versions) && (!o.module_versions.length || ModuleVersion.isSDK(o.module_versions[0]))); + }, + isAmino(o: any): o is QueryModuleVersionsResponseAmino { + return o && (o.$typeUrl === QueryModuleVersionsResponse.typeUrl || Array.isArray(o.module_versions) && (!o.module_versions.length || ModuleVersion.isAmino(o.module_versions[0]))); + }, encode(message: QueryModuleVersionsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.moduleVersions) { ModuleVersion.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -1065,6 +1150,12 @@ export const QueryModuleVersionsResponse = { typeUrl: "/cosmos.upgrade.v1beta1.QueryModuleVersionsResponse", value: QueryModuleVersionsResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryModuleVersionsResponse.typeUrl)) { + return; + } + ModuleVersion.registerTypeUrl(); } }; function createBaseQueryAuthorityRequest(): QueryAuthorityRequest { @@ -1081,6 +1172,15 @@ function createBaseQueryAuthorityRequest(): QueryAuthorityRequest { export const QueryAuthorityRequest = { typeUrl: "/cosmos.upgrade.v1beta1.QueryAuthorityRequest", aminoType: "cosmos-sdk/QueryAuthorityRequest", + is(o: any): o is QueryAuthorityRequest { + return o && o.$typeUrl === QueryAuthorityRequest.typeUrl; + }, + isSDK(o: any): o is QueryAuthorityRequestSDKType { + return o && o.$typeUrl === QueryAuthorityRequest.typeUrl; + }, + isAmino(o: any): o is QueryAuthorityRequestAmino { + return o && o.$typeUrl === QueryAuthorityRequest.typeUrl; + }, encode(_: QueryAuthorityRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -1132,7 +1232,8 @@ export const QueryAuthorityRequest = { typeUrl: "/cosmos.upgrade.v1beta1.QueryAuthorityRequest", value: QueryAuthorityRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryAuthorityResponse(): QueryAuthorityResponse { return { @@ -1150,6 +1251,15 @@ function createBaseQueryAuthorityResponse(): QueryAuthorityResponse { export const QueryAuthorityResponse = { typeUrl: "/cosmos.upgrade.v1beta1.QueryAuthorityResponse", aminoType: "cosmos-sdk/QueryAuthorityResponse", + is(o: any): o is QueryAuthorityResponse { + return o && (o.$typeUrl === QueryAuthorityResponse.typeUrl || typeof o.address === "string"); + }, + isSDK(o: any): o is QueryAuthorityResponseSDKType { + return o && (o.$typeUrl === QueryAuthorityResponse.typeUrl || typeof o.address === "string"); + }, + isAmino(o: any): o is QueryAuthorityResponseAmino { + return o && (o.$typeUrl === QueryAuthorityResponse.typeUrl || typeof o.address === "string"); + }, encode(message: QueryAuthorityResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.address !== "") { writer.uint32(10).string(message.address); @@ -1216,5 +1326,6 @@ export const QueryAuthorityResponse = { typeUrl: "/cosmos.upgrade.v1beta1.QueryAuthorityResponse", value: QueryAuthorityResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/cosmos/upgrade/v1beta1/tx.registry.ts b/__fixtures__/v-next/outputv3/cosmos/upgrade/v1beta1/tx.registry.ts index ec0c86b487..fcf2f6e54a 100644 --- a/__fixtures__/v-next/outputv3/cosmos/upgrade/v1beta1/tx.registry.ts +++ b/__fixtures__/v-next/outputv3/cosmos/upgrade/v1beta1/tx.registry.ts @@ -1,12 +1,7 @@ import { Plan, PlanSDKType } from "./upgrade"; -import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { TelescopeGeneratedType } from "../../../types"; import { MsgSoftwareUpgrade, MsgSoftwareUpgradeSDKType, MsgCancelUpgrade, MsgCancelUpgradeSDKType } from "./tx"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/cosmos.upgrade.v1beta1.MsgSoftwareUpgrade", MsgSoftwareUpgrade], ["/cosmos.upgrade.v1beta1.MsgCancelUpgrade", MsgCancelUpgrade]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/cosmos.upgrade.v1beta1.MsgSoftwareUpgrade", MsgSoftwareUpgrade], ["/cosmos.upgrade.v1beta1.MsgCancelUpgrade", MsgCancelUpgrade]]; export const MessageComposer = { encoded: { softwareUpgrade(value: MsgSoftwareUpgrade) { diff --git a/__fixtures__/v-next/outputv3/cosmos/upgrade/v1beta1/tx.rpc.func.ts b/__fixtures__/v-next/outputv3/cosmos/upgrade/v1beta1/tx.rpc.func.ts new file mode 100644 index 0000000000..ad84eeefb9 --- /dev/null +++ b/__fixtures__/v-next/outputv3/cosmos/upgrade/v1beta1/tx.rpc.func.ts @@ -0,0 +1,26 @@ +import { Plan, PlanSDKType } from "./upgrade"; +import { buildTx } from "../../../helper-func-types"; +import { MsgSoftwareUpgrade, MsgSoftwareUpgradeSDKType, MsgSoftwareUpgradeResponse, MsgSoftwareUpgradeResponseSDKType, MsgCancelUpgrade, MsgCancelUpgradeSDKType, MsgCancelUpgradeResponse, MsgCancelUpgradeResponseSDKType } from "./tx"; +/** + * SoftwareUpgrade is a governance operation for initiating a software upgrade. + * + * Since: cosmos-sdk 0.46 + * @name softwareUpgrade + * @package cosmos.upgrade.v1beta1 + * @see proto service: cosmos.upgrade.v1beta1.SoftwareUpgrade + */ +export const softwareUpgrade = buildTx({ + msg: MsgSoftwareUpgrade +}); +/** + * CancelUpgrade is a governance operation for cancelling a previously + * approvid software upgrade. + * + * Since: cosmos-sdk 0.46 + * @name cancelUpgrade + * @package cosmos.upgrade.v1beta1 + * @see proto service: cosmos.upgrade.v1beta1.CancelUpgrade + */ +export const cancelUpgrade = buildTx({ + msg: MsgCancelUpgrade +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/cosmos/upgrade/v1beta1/tx.ts b/__fixtures__/v-next/outputv3/cosmos/upgrade/v1beta1/tx.ts index 5079498a55..39d70b41a5 100644 --- a/__fixtures__/v-next/outputv3/cosmos/upgrade/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputv3/cosmos/upgrade/v1beta1/tx.ts @@ -1,5 +1,6 @@ import { Plan, PlanAmino, PlanSDKType } from "./upgrade"; import { BinaryReader, BinaryWriter } from "../../../binary"; +import { GlobalDecoderRegistry } from "../../../registry"; import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "cosmos.upgrade.v1beta1"; /** @@ -176,6 +177,15 @@ function createBaseMsgSoftwareUpgrade(): MsgSoftwareUpgrade { export const MsgSoftwareUpgrade = { typeUrl: "/cosmos.upgrade.v1beta1.MsgSoftwareUpgrade", aminoType: "cosmos-sdk/MsgSoftwareUpgrade", + is(o: any): o is MsgSoftwareUpgrade { + return o && (o.$typeUrl === MsgSoftwareUpgrade.typeUrl || typeof o.authority === "string" && Plan.is(o.plan)); + }, + isSDK(o: any): o is MsgSoftwareUpgradeSDKType { + return o && (o.$typeUrl === MsgSoftwareUpgrade.typeUrl || typeof o.authority === "string" && Plan.isSDK(o.plan)); + }, + isAmino(o: any): o is MsgSoftwareUpgradeAmino { + return o && (o.$typeUrl === MsgSoftwareUpgrade.typeUrl || typeof o.authority === "string" && Plan.isAmino(o.plan)); + }, encode(message: MsgSoftwareUpgrade, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.authority !== "") { writer.uint32(10).string(message.authority); @@ -258,6 +268,12 @@ export const MsgSoftwareUpgrade = { typeUrl: "/cosmos.upgrade.v1beta1.MsgSoftwareUpgrade", value: MsgSoftwareUpgrade.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgSoftwareUpgrade.typeUrl)) { + return; + } + Plan.registerTypeUrl(); } }; function createBaseMsgSoftwareUpgradeResponse(): MsgSoftwareUpgradeResponse { @@ -274,6 +290,15 @@ function createBaseMsgSoftwareUpgradeResponse(): MsgSoftwareUpgradeResponse { export const MsgSoftwareUpgradeResponse = { typeUrl: "/cosmos.upgrade.v1beta1.MsgSoftwareUpgradeResponse", aminoType: "cosmos-sdk/MsgSoftwareUpgradeResponse", + is(o: any): o is MsgSoftwareUpgradeResponse { + return o && o.$typeUrl === MsgSoftwareUpgradeResponse.typeUrl; + }, + isSDK(o: any): o is MsgSoftwareUpgradeResponseSDKType { + return o && o.$typeUrl === MsgSoftwareUpgradeResponse.typeUrl; + }, + isAmino(o: any): o is MsgSoftwareUpgradeResponseAmino { + return o && o.$typeUrl === MsgSoftwareUpgradeResponse.typeUrl; + }, encode(_: MsgSoftwareUpgradeResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -325,7 +350,8 @@ export const MsgSoftwareUpgradeResponse = { typeUrl: "/cosmos.upgrade.v1beta1.MsgSoftwareUpgradeResponse", value: MsgSoftwareUpgradeResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgCancelUpgrade(): MsgCancelUpgrade { return { @@ -343,6 +369,15 @@ function createBaseMsgCancelUpgrade(): MsgCancelUpgrade { export const MsgCancelUpgrade = { typeUrl: "/cosmos.upgrade.v1beta1.MsgCancelUpgrade", aminoType: "cosmos-sdk/MsgCancelUpgrade", + is(o: any): o is MsgCancelUpgrade { + return o && (o.$typeUrl === MsgCancelUpgrade.typeUrl || typeof o.authority === "string"); + }, + isSDK(o: any): o is MsgCancelUpgradeSDKType { + return o && (o.$typeUrl === MsgCancelUpgrade.typeUrl || typeof o.authority === "string"); + }, + isAmino(o: any): o is MsgCancelUpgradeAmino { + return o && (o.$typeUrl === MsgCancelUpgrade.typeUrl || typeof o.authority === "string"); + }, encode(message: MsgCancelUpgrade, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.authority !== "") { writer.uint32(10).string(message.authority); @@ -409,7 +444,8 @@ export const MsgCancelUpgrade = { typeUrl: "/cosmos.upgrade.v1beta1.MsgCancelUpgrade", value: MsgCancelUpgrade.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgCancelUpgradeResponse(): MsgCancelUpgradeResponse { return {}; @@ -425,6 +461,15 @@ function createBaseMsgCancelUpgradeResponse(): MsgCancelUpgradeResponse { export const MsgCancelUpgradeResponse = { typeUrl: "/cosmos.upgrade.v1beta1.MsgCancelUpgradeResponse", aminoType: "cosmos-sdk/MsgCancelUpgradeResponse", + is(o: any): o is MsgCancelUpgradeResponse { + return o && o.$typeUrl === MsgCancelUpgradeResponse.typeUrl; + }, + isSDK(o: any): o is MsgCancelUpgradeResponseSDKType { + return o && o.$typeUrl === MsgCancelUpgradeResponse.typeUrl; + }, + isAmino(o: any): o is MsgCancelUpgradeResponseAmino { + return o && o.$typeUrl === MsgCancelUpgradeResponse.typeUrl; + }, encode(_: MsgCancelUpgradeResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -476,5 +521,6 @@ export const MsgCancelUpgradeResponse = { typeUrl: "/cosmos.upgrade.v1beta1.MsgCancelUpgradeResponse", value: MsgCancelUpgradeResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/cosmos/upgrade/v1beta1/upgrade.ts b/__fixtures__/v-next/outputv3/cosmos/upgrade/v1beta1/upgrade.ts index e9ee1feeca..24985f652e 100644 --- a/__fixtures__/v-next/outputv3/cosmos/upgrade/v1beta1/upgrade.ts +++ b/__fixtures__/v-next/outputv3/cosmos/upgrade/v1beta1/upgrade.ts @@ -2,6 +2,7 @@ import { Timestamp, TimestampAmino, TimestampSDKType } from "../../../google/pro import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../google/protobuf/any"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { toTimestamp, fromTimestamp, isSet, DeepPartial } from "../../../helpers"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "cosmos.upgrade.v1beta1"; /** * Plan specifies information about a planned upgrade and when it should occur. @@ -275,6 +276,15 @@ function createBasePlan(): Plan { export const Plan = { typeUrl: "/cosmos.upgrade.v1beta1.Plan", aminoType: "cosmos-sdk/Plan", + is(o: any): o is Plan { + return o && (o.$typeUrl === Plan.typeUrl || typeof o.name === "string" && Timestamp.is(o.time) && typeof o.height === "bigint" && typeof o.info === "string"); + }, + isSDK(o: any): o is PlanSDKType { + return o && (o.$typeUrl === Plan.typeUrl || typeof o.name === "string" && Timestamp.isSDK(o.time) && typeof o.height === "bigint" && typeof o.info === "string"); + }, + isAmino(o: any): o is PlanAmino { + return o && (o.$typeUrl === Plan.typeUrl || typeof o.name === "string" && Timestamp.isAmino(o.time) && typeof o.height === "bigint" && typeof o.info === "string"); + }, encode(message: Plan, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -401,7 +411,8 @@ export const Plan = { typeUrl: "/cosmos.upgrade.v1beta1.Plan", value: Plan.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseSoftwareUpgradeProposal(): SoftwareUpgradeProposal { return { @@ -423,6 +434,15 @@ function createBaseSoftwareUpgradeProposal(): SoftwareUpgradeProposal { export const SoftwareUpgradeProposal = { typeUrl: "/cosmos.upgrade.v1beta1.SoftwareUpgradeProposal", aminoType: "cosmos-sdk/SoftwareUpgradeProposal", + is(o: any): o is SoftwareUpgradeProposal { + return o && (o.$typeUrl === SoftwareUpgradeProposal.typeUrl || typeof o.title === "string" && typeof o.description === "string" && Plan.is(o.plan)); + }, + isSDK(o: any): o is SoftwareUpgradeProposalSDKType { + return o && (o.$typeUrl === SoftwareUpgradeProposal.typeUrl || typeof o.title === "string" && typeof o.description === "string" && Plan.isSDK(o.plan)); + }, + isAmino(o: any): o is SoftwareUpgradeProposalAmino { + return o && (o.$typeUrl === SoftwareUpgradeProposal.typeUrl || typeof o.title === "string" && typeof o.description === "string" && Plan.isAmino(o.plan)); + }, encode(message: SoftwareUpgradeProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.title !== "") { writer.uint32(10).string(message.title); @@ -519,6 +539,12 @@ export const SoftwareUpgradeProposal = { typeUrl: "/cosmos.upgrade.v1beta1.SoftwareUpgradeProposal", value: SoftwareUpgradeProposal.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(SoftwareUpgradeProposal.typeUrl)) { + return; + } + Plan.registerTypeUrl(); } }; function createBaseCancelSoftwareUpgradeProposal(): CancelSoftwareUpgradeProposal { @@ -540,6 +566,15 @@ function createBaseCancelSoftwareUpgradeProposal(): CancelSoftwareUpgradeProposa export const CancelSoftwareUpgradeProposal = { typeUrl: "/cosmos.upgrade.v1beta1.CancelSoftwareUpgradeProposal", aminoType: "cosmos-sdk/CancelSoftwareUpgradeProposal", + is(o: any): o is CancelSoftwareUpgradeProposal { + return o && (o.$typeUrl === CancelSoftwareUpgradeProposal.typeUrl || typeof o.title === "string" && typeof o.description === "string"); + }, + isSDK(o: any): o is CancelSoftwareUpgradeProposalSDKType { + return o && (o.$typeUrl === CancelSoftwareUpgradeProposal.typeUrl || typeof o.title === "string" && typeof o.description === "string"); + }, + isAmino(o: any): o is CancelSoftwareUpgradeProposalAmino { + return o && (o.$typeUrl === CancelSoftwareUpgradeProposal.typeUrl || typeof o.title === "string" && typeof o.description === "string"); + }, encode(message: CancelSoftwareUpgradeProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.title !== "") { writer.uint32(10).string(message.title); @@ -620,7 +655,8 @@ export const CancelSoftwareUpgradeProposal = { typeUrl: "/cosmos.upgrade.v1beta1.CancelSoftwareUpgradeProposal", value: CancelSoftwareUpgradeProposal.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseModuleVersion(): ModuleVersion { return { @@ -639,6 +675,15 @@ function createBaseModuleVersion(): ModuleVersion { export const ModuleVersion = { typeUrl: "/cosmos.upgrade.v1beta1.ModuleVersion", aminoType: "cosmos-sdk/ModuleVersion", + is(o: any): o is ModuleVersion { + return o && (o.$typeUrl === ModuleVersion.typeUrl || typeof o.name === "string" && typeof o.version === "bigint"); + }, + isSDK(o: any): o is ModuleVersionSDKType { + return o && (o.$typeUrl === ModuleVersion.typeUrl || typeof o.name === "string" && typeof o.version === "bigint"); + }, + isAmino(o: any): o is ModuleVersionAmino { + return o && (o.$typeUrl === ModuleVersion.typeUrl || typeof o.name === "string" && typeof o.version === "bigint"); + }, encode(message: ModuleVersion, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -721,5 +766,6 @@ export const ModuleVersion = { typeUrl: "/cosmos.upgrade.v1beta1.ModuleVersion", value: ModuleVersion.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/cosmos/vesting/v1beta1/tx.registry.ts b/__fixtures__/v-next/outputv3/cosmos/vesting/v1beta1/tx.registry.ts index 484383b031..7d5e626f9d 100644 --- a/__fixtures__/v-next/outputv3/cosmos/vesting/v1beta1/tx.registry.ts +++ b/__fixtures__/v-next/outputv3/cosmos/vesting/v1beta1/tx.registry.ts @@ -1,13 +1,8 @@ import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; import { Period, PeriodSDKType } from "./vesting"; -import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { TelescopeGeneratedType } from "../../../types"; import { MsgCreateVestingAccount, MsgCreateVestingAccountSDKType, MsgCreatePermanentLockedAccount, MsgCreatePermanentLockedAccountSDKType, MsgCreatePeriodicVestingAccount, MsgCreatePeriodicVestingAccountSDKType } from "./tx"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/cosmos.vesting.v1beta1.MsgCreateVestingAccount", MsgCreateVestingAccount], ["/cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccount", MsgCreatePermanentLockedAccount], ["/cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccount", MsgCreatePeriodicVestingAccount]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/cosmos.vesting.v1beta1.MsgCreateVestingAccount", MsgCreateVestingAccount], ["/cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccount", MsgCreatePermanentLockedAccount], ["/cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccount", MsgCreatePeriodicVestingAccount]]; export const MessageComposer = { encoded: { createVestingAccount(value: MsgCreateVestingAccount) { diff --git a/__fixtures__/v-next/outputv3/cosmos/vesting/v1beta1/tx.rpc.func.ts b/__fixtures__/v-next/outputv3/cosmos/vesting/v1beta1/tx.rpc.func.ts new file mode 100644 index 0000000000..1e5c552640 --- /dev/null +++ b/__fixtures__/v-next/outputv3/cosmos/vesting/v1beta1/tx.rpc.func.ts @@ -0,0 +1,34 @@ +import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; +import { Period, PeriodSDKType } from "./vesting"; +import { buildTx } from "../../../helper-func-types"; +import { MsgCreateVestingAccount, MsgCreateVestingAccountSDKType, MsgCreateVestingAccountResponse, MsgCreateVestingAccountResponseSDKType, MsgCreatePermanentLockedAccount, MsgCreatePermanentLockedAccountSDKType, MsgCreatePermanentLockedAccountResponse, MsgCreatePermanentLockedAccountResponseSDKType, MsgCreatePeriodicVestingAccount, MsgCreatePeriodicVestingAccountSDKType, MsgCreatePeriodicVestingAccountResponse, MsgCreatePeriodicVestingAccountResponseSDKType } from "./tx"; +/** + * CreateVestingAccount defines a method that enables creating a vesting + * account. + * @name createVestingAccount + * @package cosmos.vesting.v1beta1 + * @see proto service: cosmos.vesting.v1beta1.CreateVestingAccount + */ +export const createVestingAccount = buildTx({ + msg: MsgCreateVestingAccount +}); +/** + * CreatePermanentLockedAccount defines a method that enables creating a permanent + * locked account. + * @name createPermanentLockedAccount + * @package cosmos.vesting.v1beta1 + * @see proto service: cosmos.vesting.v1beta1.CreatePermanentLockedAccount + */ +export const createPermanentLockedAccount = buildTx({ + msg: MsgCreatePermanentLockedAccount +}); +/** + * CreatePeriodicVestingAccount defines a method that enables creating a + * periodic vesting account. + * @name createPeriodicVestingAccount + * @package cosmos.vesting.v1beta1 + * @see proto service: cosmos.vesting.v1beta1.CreatePeriodicVestingAccount + */ +export const createPeriodicVestingAccount = buildTx({ + msg: MsgCreatePeriodicVestingAccount +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/cosmos/vesting/v1beta1/tx.ts b/__fixtures__/v-next/outputv3/cosmos/vesting/v1beta1/tx.ts index 01a4dbbe59..f08b0289cf 100644 --- a/__fixtures__/v-next/outputv3/cosmos/vesting/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputv3/cosmos/vesting/v1beta1/tx.ts @@ -2,6 +2,7 @@ import { Coin, CoinAmino, CoinSDKType } from "../../base/v1beta1/coin"; import { Period, PeriodAmino, PeriodSDKType } from "./vesting"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { isSet, DeepPartial } from "../../../helpers"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "cosmos.vesting.v1beta1"; /** * MsgCreateVestingAccount defines a message that enables creating a vesting @@ -229,6 +230,15 @@ function createBaseMsgCreateVestingAccount(): MsgCreateVestingAccount { export const MsgCreateVestingAccount = { typeUrl: "/cosmos.vesting.v1beta1.MsgCreateVestingAccount", aminoType: "cosmos-sdk/MsgCreateVestingAccount", + is(o: any): o is MsgCreateVestingAccount { + return o && (o.$typeUrl === MsgCreateVestingAccount.typeUrl || typeof o.fromAddress === "string" && typeof o.toAddress === "string" && Array.isArray(o.amount) && (!o.amount.length || Coin.is(o.amount[0])) && typeof o.endTime === "bigint" && typeof o.delayed === "boolean"); + }, + isSDK(o: any): o is MsgCreateVestingAccountSDKType { + return o && (o.$typeUrl === MsgCreateVestingAccount.typeUrl || typeof o.from_address === "string" && typeof o.to_address === "string" && Array.isArray(o.amount) && (!o.amount.length || Coin.isSDK(o.amount[0])) && typeof o.end_time === "bigint" && typeof o.delayed === "boolean"); + }, + isAmino(o: any): o is MsgCreateVestingAccountAmino { + return o && (o.$typeUrl === MsgCreateVestingAccount.typeUrl || typeof o.from_address === "string" && typeof o.to_address === "string" && Array.isArray(o.amount) && (!o.amount.length || Coin.isAmino(o.amount[0])) && typeof o.end_time === "bigint" && typeof o.delayed === "boolean"); + }, encode(message: MsgCreateVestingAccount, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.fromAddress !== "") { writer.uint32(10).string(message.fromAddress); @@ -359,6 +369,12 @@ export const MsgCreateVestingAccount = { typeUrl: "/cosmos.vesting.v1beta1.MsgCreateVestingAccount", value: MsgCreateVestingAccount.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgCreateVestingAccount.typeUrl)) { + return; + } + Coin.registerTypeUrl(); } }; function createBaseMsgCreateVestingAccountResponse(): MsgCreateVestingAccountResponse { @@ -373,6 +389,15 @@ function createBaseMsgCreateVestingAccountResponse(): MsgCreateVestingAccountRes export const MsgCreateVestingAccountResponse = { typeUrl: "/cosmos.vesting.v1beta1.MsgCreateVestingAccountResponse", aminoType: "cosmos-sdk/MsgCreateVestingAccountResponse", + is(o: any): o is MsgCreateVestingAccountResponse { + return o && o.$typeUrl === MsgCreateVestingAccountResponse.typeUrl; + }, + isSDK(o: any): o is MsgCreateVestingAccountResponseSDKType { + return o && o.$typeUrl === MsgCreateVestingAccountResponse.typeUrl; + }, + isAmino(o: any): o is MsgCreateVestingAccountResponseAmino { + return o && o.$typeUrl === MsgCreateVestingAccountResponse.typeUrl; + }, encode(_: MsgCreateVestingAccountResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -424,7 +449,8 @@ export const MsgCreateVestingAccountResponse = { typeUrl: "/cosmos.vesting.v1beta1.MsgCreateVestingAccountResponse", value: MsgCreateVestingAccountResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgCreatePermanentLockedAccount(): MsgCreatePermanentLockedAccount { return { @@ -443,6 +469,15 @@ function createBaseMsgCreatePermanentLockedAccount(): MsgCreatePermanentLockedAc export const MsgCreatePermanentLockedAccount = { typeUrl: "/cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccount", aminoType: "cosmos-sdk/MsgCreatePermanentLockedAccount", + is(o: any): o is MsgCreatePermanentLockedAccount { + return o && (o.$typeUrl === MsgCreatePermanentLockedAccount.typeUrl || typeof o.fromAddress === "string" && typeof o.toAddress === "string" && Array.isArray(o.amount) && (!o.amount.length || Coin.is(o.amount[0]))); + }, + isSDK(o: any): o is MsgCreatePermanentLockedAccountSDKType { + return o && (o.$typeUrl === MsgCreatePermanentLockedAccount.typeUrl || typeof o.from_address === "string" && typeof o.to_address === "string" && Array.isArray(o.amount) && (!o.amount.length || Coin.isSDK(o.amount[0]))); + }, + isAmino(o: any): o is MsgCreatePermanentLockedAccountAmino { + return o && (o.$typeUrl === MsgCreatePermanentLockedAccount.typeUrl || typeof o.from_address === "string" && typeof o.to_address === "string" && Array.isArray(o.amount) && (!o.amount.length || Coin.isAmino(o.amount[0]))); + }, encode(message: MsgCreatePermanentLockedAccount, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.fromAddress !== "") { writer.uint32(10).string(message.fromAddress); @@ -543,6 +578,12 @@ export const MsgCreatePermanentLockedAccount = { typeUrl: "/cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccount", value: MsgCreatePermanentLockedAccount.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgCreatePermanentLockedAccount.typeUrl)) { + return; + } + Coin.registerTypeUrl(); } }; function createBaseMsgCreatePermanentLockedAccountResponse(): MsgCreatePermanentLockedAccountResponse { @@ -557,6 +598,15 @@ function createBaseMsgCreatePermanentLockedAccountResponse(): MsgCreatePermanent export const MsgCreatePermanentLockedAccountResponse = { typeUrl: "/cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccountResponse", aminoType: "cosmos-sdk/MsgCreatePermanentLockedAccountResponse", + is(o: any): o is MsgCreatePermanentLockedAccountResponse { + return o && o.$typeUrl === MsgCreatePermanentLockedAccountResponse.typeUrl; + }, + isSDK(o: any): o is MsgCreatePermanentLockedAccountResponseSDKType { + return o && o.$typeUrl === MsgCreatePermanentLockedAccountResponse.typeUrl; + }, + isAmino(o: any): o is MsgCreatePermanentLockedAccountResponseAmino { + return o && o.$typeUrl === MsgCreatePermanentLockedAccountResponse.typeUrl; + }, encode(_: MsgCreatePermanentLockedAccountResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -608,7 +658,8 @@ export const MsgCreatePermanentLockedAccountResponse = { typeUrl: "/cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccountResponse", value: MsgCreatePermanentLockedAccountResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgCreatePeriodicVestingAccount(): MsgCreatePeriodicVestingAccount { return { @@ -628,6 +679,15 @@ function createBaseMsgCreatePeriodicVestingAccount(): MsgCreatePeriodicVestingAc export const MsgCreatePeriodicVestingAccount = { typeUrl: "/cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccount", aminoType: "cosmos-sdk/MsgCreatePeriodicVestingAccount", + is(o: any): o is MsgCreatePeriodicVestingAccount { + return o && (o.$typeUrl === MsgCreatePeriodicVestingAccount.typeUrl || typeof o.fromAddress === "string" && typeof o.toAddress === "string" && typeof o.startTime === "bigint" && Array.isArray(o.vestingPeriods) && (!o.vestingPeriods.length || Period.is(o.vestingPeriods[0]))); + }, + isSDK(o: any): o is MsgCreatePeriodicVestingAccountSDKType { + return o && (o.$typeUrl === MsgCreatePeriodicVestingAccount.typeUrl || typeof o.from_address === "string" && typeof o.to_address === "string" && typeof o.start_time === "bigint" && Array.isArray(o.vesting_periods) && (!o.vesting_periods.length || Period.isSDK(o.vesting_periods[0]))); + }, + isAmino(o: any): o is MsgCreatePeriodicVestingAccountAmino { + return o && (o.$typeUrl === MsgCreatePeriodicVestingAccount.typeUrl || typeof o.from_address === "string" && typeof o.to_address === "string" && typeof o.start_time === "bigint" && Array.isArray(o.vesting_periods) && (!o.vesting_periods.length || Period.isAmino(o.vesting_periods[0]))); + }, encode(message: MsgCreatePeriodicVestingAccount, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.fromAddress !== "") { writer.uint32(10).string(message.fromAddress); @@ -744,6 +804,12 @@ export const MsgCreatePeriodicVestingAccount = { typeUrl: "/cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccount", value: MsgCreatePeriodicVestingAccount.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgCreatePeriodicVestingAccount.typeUrl)) { + return; + } + Period.registerTypeUrl(); } }; function createBaseMsgCreatePeriodicVestingAccountResponse(): MsgCreatePeriodicVestingAccountResponse { @@ -759,6 +825,15 @@ function createBaseMsgCreatePeriodicVestingAccountResponse(): MsgCreatePeriodicV export const MsgCreatePeriodicVestingAccountResponse = { typeUrl: "/cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccountResponse", aminoType: "cosmos-sdk/MsgCreatePeriodicVestingAccountResponse", + is(o: any): o is MsgCreatePeriodicVestingAccountResponse { + return o && o.$typeUrl === MsgCreatePeriodicVestingAccountResponse.typeUrl; + }, + isSDK(o: any): o is MsgCreatePeriodicVestingAccountResponseSDKType { + return o && o.$typeUrl === MsgCreatePeriodicVestingAccountResponse.typeUrl; + }, + isAmino(o: any): o is MsgCreatePeriodicVestingAccountResponseAmino { + return o && o.$typeUrl === MsgCreatePeriodicVestingAccountResponse.typeUrl; + }, encode(_: MsgCreatePeriodicVestingAccountResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -810,5 +885,6 @@ export const MsgCreatePeriodicVestingAccountResponse = { typeUrl: "/cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccountResponse", value: MsgCreatePeriodicVestingAccountResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/cosmos/vesting/v1beta1/vesting.ts b/__fixtures__/v-next/outputv3/cosmos/vesting/v1beta1/vesting.ts index 26c70f7877..2536c443a3 100644 --- a/__fixtures__/v-next/outputv3/cosmos/vesting/v1beta1/vesting.ts +++ b/__fixtures__/v-next/outputv3/cosmos/vesting/v1beta1/vesting.ts @@ -1,6 +1,7 @@ import { BaseAccount, BaseAccountAmino, BaseAccountSDKType } from "../../auth/v1beta1/auth"; import { Coin, CoinAmino, CoinSDKType } from "../../base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; +import { GlobalDecoderRegistry } from "../../../registry"; import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "cosmos.vesting.v1beta1"; /** @@ -259,6 +260,15 @@ function createBaseBaseVestingAccount(): BaseVestingAccount { export const BaseVestingAccount = { typeUrl: "/cosmos.vesting.v1beta1.BaseVestingAccount", aminoType: "cosmos-sdk/BaseVestingAccount", + is(o: any): o is BaseVestingAccount { + return o && (o.$typeUrl === BaseVestingAccount.typeUrl || Array.isArray(o.originalVesting) && (!o.originalVesting.length || Coin.is(o.originalVesting[0])) && Array.isArray(o.delegatedFree) && (!o.delegatedFree.length || Coin.is(o.delegatedFree[0])) && Array.isArray(o.delegatedVesting) && (!o.delegatedVesting.length || Coin.is(o.delegatedVesting[0])) && typeof o.endTime === "bigint"); + }, + isSDK(o: any): o is BaseVestingAccountSDKType { + return o && (o.$typeUrl === BaseVestingAccount.typeUrl || Array.isArray(o.original_vesting) && (!o.original_vesting.length || Coin.isSDK(o.original_vesting[0])) && Array.isArray(o.delegated_free) && (!o.delegated_free.length || Coin.isSDK(o.delegated_free[0])) && Array.isArray(o.delegated_vesting) && (!o.delegated_vesting.length || Coin.isSDK(o.delegated_vesting[0])) && typeof o.end_time === "bigint"); + }, + isAmino(o: any): o is BaseVestingAccountAmino { + return o && (o.$typeUrl === BaseVestingAccount.typeUrl || Array.isArray(o.original_vesting) && (!o.original_vesting.length || Coin.isAmino(o.original_vesting[0])) && Array.isArray(o.delegated_free) && (!o.delegated_free.length || Coin.isAmino(o.delegated_free[0])) && Array.isArray(o.delegated_vesting) && (!o.delegated_vesting.length || Coin.isAmino(o.delegated_vesting[0])) && typeof o.end_time === "bigint"); + }, encode(message: BaseVestingAccount, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.baseAccount !== undefined) { BaseAccount.encode(message.baseAccount, writer.uint32(10).fork()).ldelim(); @@ -403,6 +413,13 @@ export const BaseVestingAccount = { typeUrl: "/cosmos.vesting.v1beta1.BaseVestingAccount", value: BaseVestingAccount.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(BaseVestingAccount.typeUrl)) { + return; + } + BaseAccount.registerTypeUrl(); + Coin.registerTypeUrl(); } }; function createBaseContinuousVestingAccount(): ContinuousVestingAccount { @@ -421,6 +438,15 @@ function createBaseContinuousVestingAccount(): ContinuousVestingAccount { export const ContinuousVestingAccount = { typeUrl: "/cosmos.vesting.v1beta1.ContinuousVestingAccount", aminoType: "cosmos-sdk/ContinuousVestingAccount", + is(o: any): o is ContinuousVestingAccount { + return o && (o.$typeUrl === ContinuousVestingAccount.typeUrl || typeof o.startTime === "bigint"); + }, + isSDK(o: any): o is ContinuousVestingAccountSDKType { + return o && (o.$typeUrl === ContinuousVestingAccount.typeUrl || typeof o.start_time === "bigint"); + }, + isAmino(o: any): o is ContinuousVestingAccountAmino { + return o && (o.$typeUrl === ContinuousVestingAccount.typeUrl || typeof o.start_time === "bigint"); + }, encode(message: ContinuousVestingAccount, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.baseVestingAccount !== undefined) { BaseVestingAccount.encode(message.baseVestingAccount, writer.uint32(10).fork()).ldelim(); @@ -505,6 +531,12 @@ export const ContinuousVestingAccount = { typeUrl: "/cosmos.vesting.v1beta1.ContinuousVestingAccount", value: ContinuousVestingAccount.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ContinuousVestingAccount.typeUrl)) { + return; + } + BaseVestingAccount.registerTypeUrl(); } }; function createBaseDelayedVestingAccount(): DelayedVestingAccount { @@ -523,6 +555,15 @@ function createBaseDelayedVestingAccount(): DelayedVestingAccount { export const DelayedVestingAccount = { typeUrl: "/cosmos.vesting.v1beta1.DelayedVestingAccount", aminoType: "cosmos-sdk/DelayedVestingAccount", + is(o: any): o is DelayedVestingAccount { + return o && o.$typeUrl === DelayedVestingAccount.typeUrl; + }, + isSDK(o: any): o is DelayedVestingAccountSDKType { + return o && o.$typeUrl === DelayedVestingAccount.typeUrl; + }, + isAmino(o: any): o is DelayedVestingAccountAmino { + return o && o.$typeUrl === DelayedVestingAccount.typeUrl; + }, encode(message: DelayedVestingAccount, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.baseVestingAccount !== undefined) { BaseVestingAccount.encode(message.baseVestingAccount, writer.uint32(10).fork()).ldelim(); @@ -591,6 +632,12 @@ export const DelayedVestingAccount = { typeUrl: "/cosmos.vesting.v1beta1.DelayedVestingAccount", value: DelayedVestingAccount.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(DelayedVestingAccount.typeUrl)) { + return; + } + BaseVestingAccount.registerTypeUrl(); } }; function createBasePeriod(): Period { @@ -608,6 +655,15 @@ function createBasePeriod(): Period { export const Period = { typeUrl: "/cosmos.vesting.v1beta1.Period", aminoType: "cosmos-sdk/Period", + is(o: any): o is Period { + return o && (o.$typeUrl === Period.typeUrl || typeof o.length === "bigint" && Array.isArray(o.amount) && (!o.amount.length || Coin.is(o.amount[0]))); + }, + isSDK(o: any): o is PeriodSDKType { + return o && (o.$typeUrl === Period.typeUrl || typeof o.length === "bigint" && Array.isArray(o.amount) && (!o.amount.length || Coin.isSDK(o.amount[0]))); + }, + isAmino(o: any): o is PeriodAmino { + return o && (o.$typeUrl === Period.typeUrl || typeof o.length === "bigint" && Array.isArray(o.amount) && (!o.amount.length || Coin.isAmino(o.amount[0]))); + }, encode(message: Period, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.length !== BigInt(0)) { writer.uint32(8).int64(message.length); @@ -696,6 +752,12 @@ export const Period = { typeUrl: "/cosmos.vesting.v1beta1.Period", value: Period.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Period.typeUrl)) { + return; + } + Coin.registerTypeUrl(); } }; function createBasePeriodicVestingAccount(): PeriodicVestingAccount { @@ -715,6 +777,15 @@ function createBasePeriodicVestingAccount(): PeriodicVestingAccount { export const PeriodicVestingAccount = { typeUrl: "/cosmos.vesting.v1beta1.PeriodicVestingAccount", aminoType: "cosmos-sdk/PeriodicVestingAccount", + is(o: any): o is PeriodicVestingAccount { + return o && (o.$typeUrl === PeriodicVestingAccount.typeUrl || typeof o.startTime === "bigint" && Array.isArray(o.vestingPeriods) && (!o.vestingPeriods.length || Period.is(o.vestingPeriods[0]))); + }, + isSDK(o: any): o is PeriodicVestingAccountSDKType { + return o && (o.$typeUrl === PeriodicVestingAccount.typeUrl || typeof o.start_time === "bigint" && Array.isArray(o.vesting_periods) && (!o.vesting_periods.length || Period.isSDK(o.vesting_periods[0]))); + }, + isAmino(o: any): o is PeriodicVestingAccountAmino { + return o && (o.$typeUrl === PeriodicVestingAccount.typeUrl || typeof o.start_time === "bigint" && Array.isArray(o.vesting_periods) && (!o.vesting_periods.length || Period.isAmino(o.vesting_periods[0]))); + }, encode(message: PeriodicVestingAccount, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.baseVestingAccount !== undefined) { BaseVestingAccount.encode(message.baseVestingAccount, writer.uint32(10).fork()).ldelim(); @@ -819,6 +890,13 @@ export const PeriodicVestingAccount = { typeUrl: "/cosmos.vesting.v1beta1.PeriodicVestingAccount", value: PeriodicVestingAccount.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(PeriodicVestingAccount.typeUrl)) { + return; + } + BaseVestingAccount.registerTypeUrl(); + Period.registerTypeUrl(); } }; function createBasePermanentLockedAccount(): PermanentLockedAccount { @@ -839,6 +917,15 @@ function createBasePermanentLockedAccount(): PermanentLockedAccount { export const PermanentLockedAccount = { typeUrl: "/cosmos.vesting.v1beta1.PermanentLockedAccount", aminoType: "cosmos-sdk/PermanentLockedAccount", + is(o: any): o is PermanentLockedAccount { + return o && o.$typeUrl === PermanentLockedAccount.typeUrl; + }, + isSDK(o: any): o is PermanentLockedAccountSDKType { + return o && o.$typeUrl === PermanentLockedAccount.typeUrl; + }, + isAmino(o: any): o is PermanentLockedAccountAmino { + return o && o.$typeUrl === PermanentLockedAccount.typeUrl; + }, encode(message: PermanentLockedAccount, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.baseVestingAccount !== undefined) { BaseVestingAccount.encode(message.baseVestingAccount, writer.uint32(10).fork()).ldelim(); @@ -907,5 +994,11 @@ export const PermanentLockedAccount = { typeUrl: "/cosmos.vesting.v1beta1.PermanentLockedAccount", value: PermanentLockedAccount.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(PermanentLockedAccount.typeUrl)) { + return; + } + BaseVestingAccount.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/cosmos_proto/cosmos.ts b/__fixtures__/v-next/outputv3/cosmos_proto/cosmos.ts index 4da83561bd..dc16def22e 100644 --- a/__fixtures__/v-next/outputv3/cosmos_proto/cosmos.ts +++ b/__fixtures__/v-next/outputv3/cosmos_proto/cosmos.ts @@ -200,6 +200,15 @@ function createBaseInterfaceDescriptor(): InterfaceDescriptor { */ export const InterfaceDescriptor = { typeUrl: "/cosmos_proto.InterfaceDescriptor", + is(o: any): o is InterfaceDescriptor { + return o && (o.$typeUrl === InterfaceDescriptor.typeUrl || typeof o.name === "string" && typeof o.description === "string"); + }, + isSDK(o: any): o is InterfaceDescriptorSDKType { + return o && (o.$typeUrl === InterfaceDescriptor.typeUrl || typeof o.name === "string" && typeof o.description === "string"); + }, + isAmino(o: any): o is InterfaceDescriptorAmino { + return o && (o.$typeUrl === InterfaceDescriptor.typeUrl || typeof o.name === "string" && typeof o.description === "string"); + }, encode(message: InterfaceDescriptor, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -280,7 +289,8 @@ export const InterfaceDescriptor = { typeUrl: "/cosmos_proto.InterfaceDescriptor", value: InterfaceDescriptor.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseScalarDescriptor(): ScalarDescriptor { return { @@ -303,6 +313,15 @@ function createBaseScalarDescriptor(): ScalarDescriptor { */ export const ScalarDescriptor = { typeUrl: "/cosmos_proto.ScalarDescriptor", + is(o: any): o is ScalarDescriptor { + return o && (o.$typeUrl === ScalarDescriptor.typeUrl || typeof o.name === "string" && typeof o.description === "string" && Array.isArray(o.fieldType)); + }, + isSDK(o: any): o is ScalarDescriptorSDKType { + return o && (o.$typeUrl === ScalarDescriptor.typeUrl || typeof o.name === "string" && typeof o.description === "string" && Array.isArray(o.field_type)); + }, + isAmino(o: any): o is ScalarDescriptorAmino { + return o && (o.$typeUrl === ScalarDescriptor.typeUrl || typeof o.name === "string" && typeof o.description === "string" && Array.isArray(o.field_type)); + }, encode(message: ScalarDescriptor, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -412,5 +431,6 @@ export const ScalarDescriptor = { typeUrl: "/cosmos_proto.ScalarDescriptor", value: ScalarDescriptor.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/cosmwasm/bundle.ts b/__fixtures__/v-next/outputv3/cosmwasm/bundle.ts index 9a437d296c..f55e61295c 100644 --- a/__fixtures__/v-next/outputv3/cosmwasm/bundle.ts +++ b/__fixtures__/v-next/outputv3/cosmwasm/bundle.ts @@ -4,14 +4,14 @@ import * as _149 from "./wasm/v1/proposal"; import * as _150 from "./wasm/v1/query"; import * as _151 from "./wasm/v1/tx"; import * as _152 from "./wasm/v1/types"; -import * as _433 from "./wasm/v1/tx.amino"; -import * as _434 from "./wasm/v1/tx.registry"; -import * as _435 from "./wasm/v1/query.lcd"; -import * as _436 from "./wasm/v1/query.rpc.Query"; -import * as _437 from "./wasm/v1/tx.rpc.msg"; -import * as _537 from "./lcd"; -import * as _538 from "./rpc.query"; -import * as _539 from "./rpc.tx"; +import * as _458 from "./wasm/v1/tx.amino"; +import * as _459 from "./wasm/v1/tx.registry"; +import * as _460 from "./wasm/v1/query.rpc.func"; +import * as _461 from "./wasm/v1/query.rpc.Query"; +import * as _462 from "./wasm/v1/tx.rpc.func"; +import * as _463 from "./wasm/v1/tx.rpc.msg"; +import * as _577 from "./rpc.query"; +import * as _578 from "./rpc.tx"; export namespace cosmwasm { export namespace wasm { export const v1 = { @@ -21,16 +21,16 @@ export namespace cosmwasm { ..._150, ..._151, ..._152, - ..._433, - ..._434, - ..._435, - ..._436, - ..._437 + ..._458, + ..._459, + ..._460, + ..._461, + ..._462, + ..._463 }; } export const ClientFactory = { - ..._537, - ..._538, - ..._539 + ..._577, + ..._578 }; } \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/cosmwasm/wasm/v1/genesis.ts b/__fixtures__/v-next/outputv3/cosmwasm/wasm/v1/genesis.ts index b84450ef9c..08a993013e 100644 --- a/__fixtures__/v-next/outputv3/cosmwasm/wasm/v1/genesis.ts +++ b/__fixtures__/v-next/outputv3/cosmwasm/wasm/v1/genesis.ts @@ -1,6 +1,7 @@ import { MsgStoreCode, MsgStoreCodeAmino, MsgStoreCodeSDKType, MsgInstantiateContract, MsgInstantiateContractAmino, MsgInstantiateContractSDKType, MsgExecuteContract, MsgExecuteContractAmino, MsgExecuteContractSDKType } from "./tx"; import { Params, ParamsAmino, ParamsSDKType, CodeInfo, CodeInfoAmino, CodeInfoSDKType, ContractInfo, ContractInfoAmino, ContractInfoSDKType, Model, ModelAmino, ModelSDKType } from "./types"; import { BinaryReader, BinaryWriter } from "../../../binary"; +import { GlobalDecoderRegistry } from "../../../registry"; import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../helpers"; export const protobufPackage = "cosmwasm.wasm.v1"; /** @@ -221,6 +222,15 @@ function createBaseGenesisState(): GenesisState { export const GenesisState = { typeUrl: "/cosmwasm.wasm.v1.GenesisState", aminoType: "wasm/GenesisState", + is(o: any): o is GenesisState { + return o && (o.$typeUrl === GenesisState.typeUrl || Params.is(o.params) && Array.isArray(o.codes) && (!o.codes.length || Code.is(o.codes[0])) && Array.isArray(o.contracts) && (!o.contracts.length || Contract.is(o.contracts[0])) && Array.isArray(o.sequences) && (!o.sequences.length || Sequence.is(o.sequences[0])) && Array.isArray(o.genMsgs) && (!o.genMsgs.length || GenesisState_GenMsgs.is(o.genMsgs[0]))); + }, + isSDK(o: any): o is GenesisStateSDKType { + return o && (o.$typeUrl === GenesisState.typeUrl || Params.isSDK(o.params) && Array.isArray(o.codes) && (!o.codes.length || Code.isSDK(o.codes[0])) && Array.isArray(o.contracts) && (!o.contracts.length || Contract.isSDK(o.contracts[0])) && Array.isArray(o.sequences) && (!o.sequences.length || Sequence.isSDK(o.sequences[0])) && Array.isArray(o.gen_msgs) && (!o.gen_msgs.length || GenesisState_GenMsgs.isSDK(o.gen_msgs[0]))); + }, + isAmino(o: any): o is GenesisStateAmino { + return o && (o.$typeUrl === GenesisState.typeUrl || Params.isAmino(o.params) && Array.isArray(o.codes) && (!o.codes.length || Code.isAmino(o.codes[0])) && Array.isArray(o.contracts) && (!o.contracts.length || Contract.isAmino(o.contracts[0])) && Array.isArray(o.sequences) && (!o.sequences.length || Sequence.isAmino(o.sequences[0])) && Array.isArray(o.gen_msgs) && (!o.gen_msgs.length || GenesisState_GenMsgs.isAmino(o.gen_msgs[0]))); + }, encode(message: GenesisState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.params !== undefined) { Params.encode(message.params, writer.uint32(10).fork()).ldelim(); @@ -369,6 +379,16 @@ export const GenesisState = { typeUrl: "/cosmwasm.wasm.v1.GenesisState", value: GenesisState.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GenesisState.typeUrl)) { + return; + } + Params.registerTypeUrl(); + Code.registerTypeUrl(); + Contract.registerTypeUrl(); + Sequence.registerTypeUrl(); + GenesisState_GenMsgs.registerTypeUrl(); } }; function createBaseGenesisState_GenMsgs(): GenesisState_GenMsgs { @@ -388,6 +408,15 @@ function createBaseGenesisState_GenMsgs(): GenesisState_GenMsgs { export const GenesisState_GenMsgs = { typeUrl: "/cosmwasm.wasm.v1.GenMsgs", aminoType: "wasm/GenMsgs", + is(o: any): o is GenesisState_GenMsgs { + return o && o.$typeUrl === GenesisState_GenMsgs.typeUrl; + }, + isSDK(o: any): o is GenesisState_GenMsgsSDKType { + return o && o.$typeUrl === GenesisState_GenMsgs.typeUrl; + }, + isAmino(o: any): o is GenesisState_GenMsgsAmino { + return o && o.$typeUrl === GenesisState_GenMsgs.typeUrl; + }, encode(message: GenesisState_GenMsgs, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.storeCode !== undefined) { MsgStoreCode.encode(message.storeCode, writer.uint32(10).fork()).ldelim(); @@ -488,6 +517,14 @@ export const GenesisState_GenMsgs = { typeUrl: "/cosmwasm.wasm.v1.GenMsgs", value: GenesisState_GenMsgs.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GenesisState_GenMsgs.typeUrl)) { + return; + } + MsgStoreCode.registerTypeUrl(); + MsgInstantiateContract.registerTypeUrl(); + MsgExecuteContract.registerTypeUrl(); } }; function createBaseCode(): Code { @@ -507,6 +544,15 @@ function createBaseCode(): Code { export const Code = { typeUrl: "/cosmwasm.wasm.v1.Code", aminoType: "wasm/Code", + is(o: any): o is Code { + return o && (o.$typeUrl === Code.typeUrl || typeof o.codeId === "bigint" && CodeInfo.is(o.codeInfo) && (o.codeBytes instanceof Uint8Array || typeof o.codeBytes === "string") && typeof o.pinned === "boolean"); + }, + isSDK(o: any): o is CodeSDKType { + return o && (o.$typeUrl === Code.typeUrl || typeof o.code_id === "bigint" && CodeInfo.isSDK(o.code_info) && (o.code_bytes instanceof Uint8Array || typeof o.code_bytes === "string") && typeof o.pinned === "boolean"); + }, + isAmino(o: any): o is CodeAmino { + return o && (o.$typeUrl === Code.typeUrl || typeof o.code_id === "bigint" && CodeInfo.isAmino(o.code_info) && (o.code_bytes instanceof Uint8Array || typeof o.code_bytes === "string") && typeof o.pinned === "boolean"); + }, encode(message: Code, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.codeId !== BigInt(0)) { writer.uint32(8).uint64(message.codeId); @@ -619,6 +665,12 @@ export const Code = { typeUrl: "/cosmwasm.wasm.v1.Code", value: Code.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Code.typeUrl)) { + return; + } + CodeInfo.registerTypeUrl(); } }; function createBaseContract(): Contract { @@ -637,6 +689,15 @@ function createBaseContract(): Contract { export const Contract = { typeUrl: "/cosmwasm.wasm.v1.Contract", aminoType: "wasm/Contract", + is(o: any): o is Contract { + return o && (o.$typeUrl === Contract.typeUrl || typeof o.contractAddress === "string" && ContractInfo.is(o.contractInfo) && Array.isArray(o.contractState) && (!o.contractState.length || Model.is(o.contractState[0]))); + }, + isSDK(o: any): o is ContractSDKType { + return o && (o.$typeUrl === Contract.typeUrl || typeof o.contract_address === "string" && ContractInfo.isSDK(o.contract_info) && Array.isArray(o.contract_state) && (!o.contract_state.length || Model.isSDK(o.contract_state[0]))); + }, + isAmino(o: any): o is ContractAmino { + return o && (o.$typeUrl === Contract.typeUrl || typeof o.contract_address === "string" && ContractInfo.isAmino(o.contract_info) && Array.isArray(o.contract_state) && (!o.contract_state.length || Model.isAmino(o.contract_state[0]))); + }, encode(message: Contract, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.contractAddress !== "") { writer.uint32(10).string(message.contractAddress); @@ -739,6 +800,13 @@ export const Contract = { typeUrl: "/cosmwasm.wasm.v1.Contract", value: Contract.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Contract.typeUrl)) { + return; + } + ContractInfo.registerTypeUrl(); + Model.registerTypeUrl(); } }; function createBaseSequence(): Sequence { @@ -756,6 +824,15 @@ function createBaseSequence(): Sequence { export const Sequence = { typeUrl: "/cosmwasm.wasm.v1.Sequence", aminoType: "wasm/Sequence", + is(o: any): o is Sequence { + return o && (o.$typeUrl === Sequence.typeUrl || (o.idKey instanceof Uint8Array || typeof o.idKey === "string") && typeof o.value === "bigint"); + }, + isSDK(o: any): o is SequenceSDKType { + return o && (o.$typeUrl === Sequence.typeUrl || (o.id_key instanceof Uint8Array || typeof o.id_key === "string") && typeof o.value === "bigint"); + }, + isAmino(o: any): o is SequenceAmino { + return o && (o.$typeUrl === Sequence.typeUrl || (o.id_key instanceof Uint8Array || typeof o.id_key === "string") && typeof o.value === "bigint"); + }, encode(message: Sequence, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.idKey.length !== 0) { writer.uint32(10).bytes(message.idKey); @@ -838,5 +915,6 @@ export const Sequence = { typeUrl: "/cosmwasm.wasm.v1.Sequence", value: Sequence.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/cosmwasm/wasm/v1/ibc.ts b/__fixtures__/v-next/outputv3/cosmwasm/wasm/v1/ibc.ts index 3d6355fd5a..6d1c3ea254 100644 --- a/__fixtures__/v-next/outputv3/cosmwasm/wasm/v1/ibc.ts +++ b/__fixtures__/v-next/outputv3/cosmwasm/wasm/v1/ibc.ts @@ -119,6 +119,15 @@ function createBaseMsgIBCSend(): MsgIBCSend { export const MsgIBCSend = { typeUrl: "/cosmwasm.wasm.v1.MsgIBCSend", aminoType: "wasm/MsgIBCSend", + is(o: any): o is MsgIBCSend { + return o && (o.$typeUrl === MsgIBCSend.typeUrl || typeof o.channel === "string" && typeof o.timeoutHeight === "bigint" && typeof o.timeoutTimestamp === "bigint" && (o.data instanceof Uint8Array || typeof o.data === "string")); + }, + isSDK(o: any): o is MsgIBCSendSDKType { + return o && (o.$typeUrl === MsgIBCSend.typeUrl || typeof o.channel === "string" && typeof o.timeout_height === "bigint" && typeof o.timeout_timestamp === "bigint" && (o.data instanceof Uint8Array || typeof o.data === "string")); + }, + isAmino(o: any): o is MsgIBCSendAmino { + return o && (o.$typeUrl === MsgIBCSend.typeUrl || typeof o.channel === "string" && typeof o.timeout_height === "bigint" && typeof o.timeout_timestamp === "bigint" && (o.data instanceof Uint8Array || typeof o.data === "string")); + }, encode(message: MsgIBCSend, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.channel !== "") { writer.uint32(18).string(message.channel); @@ -231,7 +240,8 @@ export const MsgIBCSend = { typeUrl: "/cosmwasm.wasm.v1.MsgIBCSend", value: MsgIBCSend.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgIBCCloseChannel(): MsgIBCCloseChannel { return { @@ -247,6 +257,15 @@ function createBaseMsgIBCCloseChannel(): MsgIBCCloseChannel { export const MsgIBCCloseChannel = { typeUrl: "/cosmwasm.wasm.v1.MsgIBCCloseChannel", aminoType: "wasm/MsgIBCCloseChannel", + is(o: any): o is MsgIBCCloseChannel { + return o && (o.$typeUrl === MsgIBCCloseChannel.typeUrl || typeof o.channel === "string"); + }, + isSDK(o: any): o is MsgIBCCloseChannelSDKType { + return o && (o.$typeUrl === MsgIBCCloseChannel.typeUrl || typeof o.channel === "string"); + }, + isAmino(o: any): o is MsgIBCCloseChannelAmino { + return o && (o.$typeUrl === MsgIBCCloseChannel.typeUrl || typeof o.channel === "string"); + }, encode(message: MsgIBCCloseChannel, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.channel !== "") { writer.uint32(18).string(message.channel); @@ -313,5 +332,6 @@ export const MsgIBCCloseChannel = { typeUrl: "/cosmwasm.wasm.v1.MsgIBCCloseChannel", value: MsgIBCCloseChannel.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/cosmwasm/wasm/v1/proposal.ts b/__fixtures__/v-next/outputv3/cosmwasm/wasm/v1/proposal.ts index b165cbb44c..5815bbadac 100644 --- a/__fixtures__/v-next/outputv3/cosmwasm/wasm/v1/proposal.ts +++ b/__fixtures__/v-next/outputv3/cosmwasm/wasm/v1/proposal.ts @@ -1,8 +1,9 @@ import { AccessConfig, AccessConfigAmino, AccessConfigSDKType } from "./types"; import { Coin, CoinAmino, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; +import { GlobalDecoderRegistry } from "../../../registry"; import { isSet, bytesFromBase64, DeepPartial } from "../../../helpers"; -import { fromBase64, toBase64, toUtf8, fromUtf8 } from "@cosmjs/encoding"; +import { fromBase64, toBase64, toUtf8, fromUtf8 } from "@interchainjs/encoding"; export const protobufPackage = "cosmwasm.wasm.v1"; /** * StoreCodeProposal gov proposal content type to submit WASM code to the system @@ -658,6 +659,15 @@ function createBaseStoreCodeProposal(): StoreCodeProposal { export const StoreCodeProposal = { typeUrl: "/cosmwasm.wasm.v1.StoreCodeProposal", aminoType: "wasm/StoreCodeProposal", + is(o: any): o is StoreCodeProposal { + return o && (o.$typeUrl === StoreCodeProposal.typeUrl || typeof o.title === "string" && typeof o.description === "string" && typeof o.runAs === "string" && (o.wasmByteCode instanceof Uint8Array || typeof o.wasmByteCode === "string")); + }, + isSDK(o: any): o is StoreCodeProposalSDKType { + return o && (o.$typeUrl === StoreCodeProposal.typeUrl || typeof o.title === "string" && typeof o.description === "string" && typeof o.run_as === "string" && (o.wasm_byte_code instanceof Uint8Array || typeof o.wasm_byte_code === "string")); + }, + isAmino(o: any): o is StoreCodeProposalAmino { + return o && (o.$typeUrl === StoreCodeProposal.typeUrl || typeof o.title === "string" && typeof o.description === "string" && typeof o.run_as === "string" && (o.wasm_byte_code instanceof Uint8Array || typeof o.wasm_byte_code === "string")); + }, encode(message: StoreCodeProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.title !== "") { writer.uint32(10).string(message.title); @@ -782,6 +792,12 @@ export const StoreCodeProposal = { typeUrl: "/cosmwasm.wasm.v1.StoreCodeProposal", value: StoreCodeProposal.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(StoreCodeProposal.typeUrl)) { + return; + } + AccessConfig.registerTypeUrl(); } }; function createBaseInstantiateContractProposal(): InstantiateContractProposal { @@ -806,6 +822,15 @@ function createBaseInstantiateContractProposal(): InstantiateContractProposal { export const InstantiateContractProposal = { typeUrl: "/cosmwasm.wasm.v1.InstantiateContractProposal", aminoType: "wasm/InstantiateContractProposal", + is(o: any): o is InstantiateContractProposal { + return o && (o.$typeUrl === InstantiateContractProposal.typeUrl || typeof o.title === "string" && typeof o.description === "string" && typeof o.runAs === "string" && typeof o.admin === "string" && typeof o.codeId === "bigint" && typeof o.label === "string" && (o.msg instanceof Uint8Array || typeof o.msg === "string") && Array.isArray(o.funds) && (!o.funds.length || Coin.is(o.funds[0]))); + }, + isSDK(o: any): o is InstantiateContractProposalSDKType { + return o && (o.$typeUrl === InstantiateContractProposal.typeUrl || typeof o.title === "string" && typeof o.description === "string" && typeof o.run_as === "string" && typeof o.admin === "string" && typeof o.code_id === "bigint" && typeof o.label === "string" && (o.msg instanceof Uint8Array || typeof o.msg === "string") && Array.isArray(o.funds) && (!o.funds.length || Coin.isSDK(o.funds[0]))); + }, + isAmino(o: any): o is InstantiateContractProposalAmino { + return o && (o.$typeUrl === InstantiateContractProposal.typeUrl || typeof o.title === "string" && typeof o.description === "string" && typeof o.run_as === "string" && typeof o.admin === "string" && typeof o.code_id === "bigint" && typeof o.label === "string" && (o.msg instanceof Uint8Array || typeof o.msg === "string") && Array.isArray(o.funds) && (!o.funds.length || Coin.isAmino(o.funds[0]))); + }, encode(message: InstantiateContractProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.title !== "") { writer.uint32(10).string(message.title); @@ -978,6 +1003,12 @@ export const InstantiateContractProposal = { typeUrl: "/cosmwasm.wasm.v1.InstantiateContractProposal", value: InstantiateContractProposal.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(InstantiateContractProposal.typeUrl)) { + return; + } + Coin.registerTypeUrl(); } }; function createBaseMigrateContractProposal(): MigrateContractProposal { @@ -998,6 +1029,15 @@ function createBaseMigrateContractProposal(): MigrateContractProposal { export const MigrateContractProposal = { typeUrl: "/cosmwasm.wasm.v1.MigrateContractProposal", aminoType: "wasm/MigrateContractProposal", + is(o: any): o is MigrateContractProposal { + return o && (o.$typeUrl === MigrateContractProposal.typeUrl || typeof o.title === "string" && typeof o.description === "string" && typeof o.contract === "string" && typeof o.codeId === "bigint" && (o.msg instanceof Uint8Array || typeof o.msg === "string")); + }, + isSDK(o: any): o is MigrateContractProposalSDKType { + return o && (o.$typeUrl === MigrateContractProposal.typeUrl || typeof o.title === "string" && typeof o.description === "string" && typeof o.contract === "string" && typeof o.code_id === "bigint" && (o.msg instanceof Uint8Array || typeof o.msg === "string")); + }, + isAmino(o: any): o is MigrateContractProposalAmino { + return o && (o.$typeUrl === MigrateContractProposal.typeUrl || typeof o.title === "string" && typeof o.description === "string" && typeof o.contract === "string" && typeof o.code_id === "bigint" && (o.msg instanceof Uint8Array || typeof o.msg === "string")); + }, encode(message: MigrateContractProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.title !== "") { writer.uint32(10).string(message.title); @@ -1122,7 +1162,8 @@ export const MigrateContractProposal = { typeUrl: "/cosmwasm.wasm.v1.MigrateContractProposal", value: MigrateContractProposal.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseSudoContractProposal(): SudoContractProposal { return { @@ -1141,6 +1182,15 @@ function createBaseSudoContractProposal(): SudoContractProposal { export const SudoContractProposal = { typeUrl: "/cosmwasm.wasm.v1.SudoContractProposal", aminoType: "wasm/SudoContractProposal", + is(o: any): o is SudoContractProposal { + return o && (o.$typeUrl === SudoContractProposal.typeUrl || typeof o.title === "string" && typeof o.description === "string" && typeof o.contract === "string" && (o.msg instanceof Uint8Array || typeof o.msg === "string")); + }, + isSDK(o: any): o is SudoContractProposalSDKType { + return o && (o.$typeUrl === SudoContractProposal.typeUrl || typeof o.title === "string" && typeof o.description === "string" && typeof o.contract === "string" && (o.msg instanceof Uint8Array || typeof o.msg === "string")); + }, + isAmino(o: any): o is SudoContractProposalAmino { + return o && (o.$typeUrl === SudoContractProposal.typeUrl || typeof o.title === "string" && typeof o.description === "string" && typeof o.contract === "string" && (o.msg instanceof Uint8Array || typeof o.msg === "string")); + }, encode(message: SudoContractProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.title !== "") { writer.uint32(10).string(message.title); @@ -1249,7 +1299,8 @@ export const SudoContractProposal = { typeUrl: "/cosmwasm.wasm.v1.SudoContractProposal", value: SudoContractProposal.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseExecuteContractProposal(): ExecuteContractProposal { return { @@ -1271,6 +1322,15 @@ function createBaseExecuteContractProposal(): ExecuteContractProposal { export const ExecuteContractProposal = { typeUrl: "/cosmwasm.wasm.v1.ExecuteContractProposal", aminoType: "wasm/ExecuteContractProposal", + is(o: any): o is ExecuteContractProposal { + return o && (o.$typeUrl === ExecuteContractProposal.typeUrl || typeof o.title === "string" && typeof o.description === "string" && typeof o.runAs === "string" && typeof o.contract === "string" && (o.msg instanceof Uint8Array || typeof o.msg === "string") && Array.isArray(o.funds) && (!o.funds.length || Coin.is(o.funds[0]))); + }, + isSDK(o: any): o is ExecuteContractProposalSDKType { + return o && (o.$typeUrl === ExecuteContractProposal.typeUrl || typeof o.title === "string" && typeof o.description === "string" && typeof o.run_as === "string" && typeof o.contract === "string" && (o.msg instanceof Uint8Array || typeof o.msg === "string") && Array.isArray(o.funds) && (!o.funds.length || Coin.isSDK(o.funds[0]))); + }, + isAmino(o: any): o is ExecuteContractProposalAmino { + return o && (o.$typeUrl === ExecuteContractProposal.typeUrl || typeof o.title === "string" && typeof o.description === "string" && typeof o.run_as === "string" && typeof o.contract === "string" && (o.msg instanceof Uint8Array || typeof o.msg === "string") && Array.isArray(o.funds) && (!o.funds.length || Coin.isAmino(o.funds[0]))); + }, encode(message: ExecuteContractProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.title !== "") { writer.uint32(10).string(message.title); @@ -1413,6 +1473,12 @@ export const ExecuteContractProposal = { typeUrl: "/cosmwasm.wasm.v1.ExecuteContractProposal", value: ExecuteContractProposal.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ExecuteContractProposal.typeUrl)) { + return; + } + Coin.registerTypeUrl(); } }; function createBaseUpdateAdminProposal(): UpdateAdminProposal { @@ -1432,6 +1498,15 @@ function createBaseUpdateAdminProposal(): UpdateAdminProposal { export const UpdateAdminProposal = { typeUrl: "/cosmwasm.wasm.v1.UpdateAdminProposal", aminoType: "wasm/UpdateAdminProposal", + is(o: any): o is UpdateAdminProposal { + return o && (o.$typeUrl === UpdateAdminProposal.typeUrl || typeof o.title === "string" && typeof o.description === "string" && typeof o.newAdmin === "string" && typeof o.contract === "string"); + }, + isSDK(o: any): o is UpdateAdminProposalSDKType { + return o && (o.$typeUrl === UpdateAdminProposal.typeUrl || typeof o.title === "string" && typeof o.description === "string" && typeof o.new_admin === "string" && typeof o.contract === "string"); + }, + isAmino(o: any): o is UpdateAdminProposalAmino { + return o && (o.$typeUrl === UpdateAdminProposal.typeUrl || typeof o.title === "string" && typeof o.description === "string" && typeof o.new_admin === "string" && typeof o.contract === "string"); + }, encode(message: UpdateAdminProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.title !== "") { writer.uint32(10).string(message.title); @@ -1540,7 +1615,8 @@ export const UpdateAdminProposal = { typeUrl: "/cosmwasm.wasm.v1.UpdateAdminProposal", value: UpdateAdminProposal.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseClearAdminProposal(): ClearAdminProposal { return { @@ -1559,6 +1635,15 @@ function createBaseClearAdminProposal(): ClearAdminProposal { export const ClearAdminProposal = { typeUrl: "/cosmwasm.wasm.v1.ClearAdminProposal", aminoType: "wasm/ClearAdminProposal", + is(o: any): o is ClearAdminProposal { + return o && (o.$typeUrl === ClearAdminProposal.typeUrl || typeof o.title === "string" && typeof o.description === "string" && typeof o.contract === "string"); + }, + isSDK(o: any): o is ClearAdminProposalSDKType { + return o && (o.$typeUrl === ClearAdminProposal.typeUrl || typeof o.title === "string" && typeof o.description === "string" && typeof o.contract === "string"); + }, + isAmino(o: any): o is ClearAdminProposalAmino { + return o && (o.$typeUrl === ClearAdminProposal.typeUrl || typeof o.title === "string" && typeof o.description === "string" && typeof o.contract === "string"); + }, encode(message: ClearAdminProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.title !== "") { writer.uint32(10).string(message.title); @@ -1653,7 +1738,8 @@ export const ClearAdminProposal = { typeUrl: "/cosmwasm.wasm.v1.ClearAdminProposal", value: ClearAdminProposal.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBasePinCodesProposal(): PinCodesProposal { return { @@ -1672,6 +1758,15 @@ function createBasePinCodesProposal(): PinCodesProposal { export const PinCodesProposal = { typeUrl: "/cosmwasm.wasm.v1.PinCodesProposal", aminoType: "wasm/PinCodesProposal", + is(o: any): o is PinCodesProposal { + return o && (o.$typeUrl === PinCodesProposal.typeUrl || typeof o.title === "string" && typeof o.description === "string" && Array.isArray(o.codeIds) && (!o.codeIds.length || typeof o.codeIds[0] === "bigint")); + }, + isSDK(o: any): o is PinCodesProposalSDKType { + return o && (o.$typeUrl === PinCodesProposal.typeUrl || typeof o.title === "string" && typeof o.description === "string" && Array.isArray(o.code_ids) && (!o.code_ids.length || typeof o.code_ids[0] === "bigint")); + }, + isAmino(o: any): o is PinCodesProposalAmino { + return o && (o.$typeUrl === PinCodesProposal.typeUrl || typeof o.title === "string" && typeof o.description === "string" && Array.isArray(o.code_ids) && (!o.code_ids.length || typeof o.code_ids[0] === "bigint")); + }, encode(message: PinCodesProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.title !== "") { writer.uint32(10).string(message.title); @@ -1781,7 +1876,8 @@ export const PinCodesProposal = { typeUrl: "/cosmwasm.wasm.v1.PinCodesProposal", value: PinCodesProposal.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseUnpinCodesProposal(): UnpinCodesProposal { return { @@ -1800,6 +1896,15 @@ function createBaseUnpinCodesProposal(): UnpinCodesProposal { export const UnpinCodesProposal = { typeUrl: "/cosmwasm.wasm.v1.UnpinCodesProposal", aminoType: "wasm/UnpinCodesProposal", + is(o: any): o is UnpinCodesProposal { + return o && (o.$typeUrl === UnpinCodesProposal.typeUrl || typeof o.title === "string" && typeof o.description === "string" && Array.isArray(o.codeIds) && (!o.codeIds.length || typeof o.codeIds[0] === "bigint")); + }, + isSDK(o: any): o is UnpinCodesProposalSDKType { + return o && (o.$typeUrl === UnpinCodesProposal.typeUrl || typeof o.title === "string" && typeof o.description === "string" && Array.isArray(o.code_ids) && (!o.code_ids.length || typeof o.code_ids[0] === "bigint")); + }, + isAmino(o: any): o is UnpinCodesProposalAmino { + return o && (o.$typeUrl === UnpinCodesProposal.typeUrl || typeof o.title === "string" && typeof o.description === "string" && Array.isArray(o.code_ids) && (!o.code_ids.length || typeof o.code_ids[0] === "bigint")); + }, encode(message: UnpinCodesProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.title !== "") { writer.uint32(10).string(message.title); @@ -1909,5 +2014,6 @@ export const UnpinCodesProposal = { typeUrl: "/cosmwasm.wasm.v1.UnpinCodesProposal", value: UnpinCodesProposal.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/cosmwasm/wasm/v1/query.rpc.func.ts b/__fixtures__/v-next/outputv3/cosmwasm/wasm/v1/query.rpc.func.ts new file mode 100644 index 0000000000..bb820d5f6a --- /dev/null +++ b/__fixtures__/v-next/outputv3/cosmwasm/wasm/v1/query.rpc.func.ts @@ -0,0 +1,121 @@ +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination"; +import { ContractInfo, ContractInfoSDKType, ContractCodeHistoryEntry, ContractCodeHistoryEntrySDKType, Model, ModelSDKType } from "./types"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { QueryContractInfoRequest, QueryContractInfoRequestSDKType, QueryContractInfoResponse, QueryContractInfoResponseSDKType, QueryContractHistoryRequest, QueryContractHistoryRequestSDKType, QueryContractHistoryResponse, QueryContractHistoryResponseSDKType, QueryContractsByCodeRequest, QueryContractsByCodeRequestSDKType, QueryContractsByCodeResponse, QueryContractsByCodeResponseSDKType, QueryAllContractStateRequest, QueryAllContractStateRequestSDKType, QueryAllContractStateResponse, QueryAllContractStateResponseSDKType, QueryRawContractStateRequest, QueryRawContractStateRequestSDKType, QueryRawContractStateResponse, QueryRawContractStateResponseSDKType, QuerySmartContractStateRequest, QuerySmartContractStateRequestSDKType, QuerySmartContractStateResponse, QuerySmartContractStateResponseSDKType, QueryCodeRequest, QueryCodeRequestSDKType, QueryCodeResponse, QueryCodeResponseSDKType, QueryCodesRequest, QueryCodesRequestSDKType, QueryCodesResponse, QueryCodesResponseSDKType, QueryPinnedCodesRequest, QueryPinnedCodesRequestSDKType, QueryPinnedCodesResponse, QueryPinnedCodesResponseSDKType } from "./query"; +/** + * ContractInfo gets the contract meta data + * @name getContractInfo + * @package cosmwasm.wasm.v1 + * @see proto service: cosmwasm.wasm.v1.ContractInfo + */ +export const getContractInfo = buildQuery({ + encode: QueryContractInfoRequest.encode, + decode: QueryContractInfoResponse.decode, + service: "cosmwasm.wasm.v1.Query", + method: "ContractInfo", + deps: [QueryContractInfoRequest, QueryContractInfoResponse] +}); +/** + * ContractHistory gets the contract code history + * @name getContractHistory + * @package cosmwasm.wasm.v1 + * @see proto service: cosmwasm.wasm.v1.ContractHistory + */ +export const getContractHistory = buildQuery({ + encode: QueryContractHistoryRequest.encode, + decode: QueryContractHistoryResponse.decode, + service: "cosmwasm.wasm.v1.Query", + method: "ContractHistory", + deps: [QueryContractHistoryRequest, QueryContractHistoryResponse] +}); +/** + * ContractsByCode lists all smart contracts for a code id + * @name getContractsByCode + * @package cosmwasm.wasm.v1 + * @see proto service: cosmwasm.wasm.v1.ContractsByCode + */ +export const getContractsByCode = buildQuery({ + encode: QueryContractsByCodeRequest.encode, + decode: QueryContractsByCodeResponse.decode, + service: "cosmwasm.wasm.v1.Query", + method: "ContractsByCode", + deps: [QueryContractsByCodeRequest, QueryContractsByCodeResponse] +}); +/** + * AllContractState gets all raw store data for a single contract + * @name getAllContractState + * @package cosmwasm.wasm.v1 + * @see proto service: cosmwasm.wasm.v1.AllContractState + */ +export const getAllContractState = buildQuery({ + encode: QueryAllContractStateRequest.encode, + decode: QueryAllContractStateResponse.decode, + service: "cosmwasm.wasm.v1.Query", + method: "AllContractState", + deps: [QueryAllContractStateRequest, QueryAllContractStateResponse] +}); +/** + * RawContractState gets single key from the raw store data of a contract + * @name getRawContractState + * @package cosmwasm.wasm.v1 + * @see proto service: cosmwasm.wasm.v1.RawContractState + */ +export const getRawContractState = buildQuery({ + encode: QueryRawContractStateRequest.encode, + decode: QueryRawContractStateResponse.decode, + service: "cosmwasm.wasm.v1.Query", + method: "RawContractState", + deps: [QueryRawContractStateRequest, QueryRawContractStateResponse] +}); +/** + * SmartContractState get smart query result from the contract + * @name getSmartContractState + * @package cosmwasm.wasm.v1 + * @see proto service: cosmwasm.wasm.v1.SmartContractState + */ +export const getSmartContractState = buildQuery({ + encode: QuerySmartContractStateRequest.encode, + decode: QuerySmartContractStateResponse.decode, + service: "cosmwasm.wasm.v1.Query", + method: "SmartContractState", + deps: [QuerySmartContractStateRequest, QuerySmartContractStateResponse] +}); +/** + * Code gets the binary code and metadata for a singe wasm code + * @name getCode + * @package cosmwasm.wasm.v1 + * @see proto service: cosmwasm.wasm.v1.Code + */ +export const getCode = buildQuery({ + encode: QueryCodeRequest.encode, + decode: QueryCodeResponse.decode, + service: "cosmwasm.wasm.v1.Query", + method: "Code", + deps: [QueryCodeRequest, QueryCodeResponse] +}); +/** + * Codes gets the metadata for all stored wasm codes + * @name getCodes + * @package cosmwasm.wasm.v1 + * @see proto service: cosmwasm.wasm.v1.Codes + */ +export const getCodes = buildQuery({ + encode: QueryCodesRequest.encode, + decode: QueryCodesResponse.decode, + service: "cosmwasm.wasm.v1.Query", + method: "Codes", + deps: [QueryCodesRequest, QueryCodesResponse] +}); +/** + * PinnedCodes gets the pinned code ids + * @name getPinnedCodes + * @package cosmwasm.wasm.v1 + * @see proto service: cosmwasm.wasm.v1.PinnedCodes + */ +export const getPinnedCodes = buildQuery({ + encode: QueryPinnedCodesRequest.encode, + decode: QueryPinnedCodesResponse.decode, + service: "cosmwasm.wasm.v1.Query", + method: "PinnedCodes", + deps: [QueryPinnedCodesRequest, QueryPinnedCodesResponse] +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/cosmwasm/wasm/v1/query.ts b/__fixtures__/v-next/outputv3/cosmwasm/wasm/v1/query.ts index e5eb6d2e95..e889c58c77 100644 --- a/__fixtures__/v-next/outputv3/cosmwasm/wasm/v1/query.ts +++ b/__fixtures__/v-next/outputv3/cosmwasm/wasm/v1/query.ts @@ -2,7 +2,8 @@ import { PageRequest, PageRequestAmino, PageRequestSDKType, PageResponse, PageRe import { ContractInfo, ContractInfoAmino, ContractInfoSDKType, ContractCodeHistoryEntry, ContractCodeHistoryEntryAmino, ContractCodeHistoryEntrySDKType, Model, ModelAmino, ModelSDKType } from "./types"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../helpers"; -import { toUtf8, fromUtf8 } from "@cosmjs/encoding"; +import { GlobalDecoderRegistry } from "../../../registry"; +import { toUtf8, fromUtf8 } from "@interchainjs/encoding"; export const protobufPackage = "cosmwasm.wasm.v1"; /** * QueryContractInfoRequest is the request type for the Query/ContractInfo RPC @@ -824,6 +825,15 @@ function createBaseQueryContractInfoRequest(): QueryContractInfoRequest { export const QueryContractInfoRequest = { typeUrl: "/cosmwasm.wasm.v1.QueryContractInfoRequest", aminoType: "wasm/QueryContractInfoRequest", + is(o: any): o is QueryContractInfoRequest { + return o && (o.$typeUrl === QueryContractInfoRequest.typeUrl || typeof o.address === "string"); + }, + isSDK(o: any): o is QueryContractInfoRequestSDKType { + return o && (o.$typeUrl === QueryContractInfoRequest.typeUrl || typeof o.address === "string"); + }, + isAmino(o: any): o is QueryContractInfoRequestAmino { + return o && (o.$typeUrl === QueryContractInfoRequest.typeUrl || typeof o.address === "string"); + }, encode(message: QueryContractInfoRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.address !== "") { writer.uint32(10).string(message.address); @@ -890,7 +900,8 @@ export const QueryContractInfoRequest = { typeUrl: "/cosmwasm.wasm.v1.QueryContractInfoRequest", value: QueryContractInfoRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryContractInfoResponse(): QueryContractInfoResponse { return { @@ -908,6 +919,15 @@ function createBaseQueryContractInfoResponse(): QueryContractInfoResponse { export const QueryContractInfoResponse = { typeUrl: "/cosmwasm.wasm.v1.QueryContractInfoResponse", aminoType: "wasm/QueryContractInfoResponse", + is(o: any): o is QueryContractInfoResponse { + return o && (o.$typeUrl === QueryContractInfoResponse.typeUrl || typeof o.address === "string" && ContractInfo.is(o.contractInfo)); + }, + isSDK(o: any): o is QueryContractInfoResponseSDKType { + return o && (o.$typeUrl === QueryContractInfoResponse.typeUrl || typeof o.address === "string" && ContractInfo.isSDK(o.contract_info)); + }, + isAmino(o: any): o is QueryContractInfoResponseAmino { + return o && (o.$typeUrl === QueryContractInfoResponse.typeUrl || typeof o.address === "string" && ContractInfo.isAmino(o.contract_info)); + }, encode(message: QueryContractInfoResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.address !== "") { writer.uint32(10).string(message.address); @@ -990,6 +1010,12 @@ export const QueryContractInfoResponse = { typeUrl: "/cosmwasm.wasm.v1.QueryContractInfoResponse", value: QueryContractInfoResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryContractInfoResponse.typeUrl)) { + return; + } + ContractInfo.registerTypeUrl(); } }; function createBaseQueryContractHistoryRequest(): QueryContractHistoryRequest { @@ -1008,6 +1034,15 @@ function createBaseQueryContractHistoryRequest(): QueryContractHistoryRequest { export const QueryContractHistoryRequest = { typeUrl: "/cosmwasm.wasm.v1.QueryContractHistoryRequest", aminoType: "wasm/QueryContractHistoryRequest", + is(o: any): o is QueryContractHistoryRequest { + return o && (o.$typeUrl === QueryContractHistoryRequest.typeUrl || typeof o.address === "string"); + }, + isSDK(o: any): o is QueryContractHistoryRequestSDKType { + return o && (o.$typeUrl === QueryContractHistoryRequest.typeUrl || typeof o.address === "string"); + }, + isAmino(o: any): o is QueryContractHistoryRequestAmino { + return o && (o.$typeUrl === QueryContractHistoryRequest.typeUrl || typeof o.address === "string"); + }, encode(message: QueryContractHistoryRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.address !== "") { writer.uint32(10).string(message.address); @@ -1090,6 +1125,12 @@ export const QueryContractHistoryRequest = { typeUrl: "/cosmwasm.wasm.v1.QueryContractHistoryRequest", value: QueryContractHistoryRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryContractHistoryRequest.typeUrl)) { + return; + } + PageRequest.registerTypeUrl(); } }; function createBaseQueryContractHistoryResponse(): QueryContractHistoryResponse { @@ -1108,6 +1149,15 @@ function createBaseQueryContractHistoryResponse(): QueryContractHistoryResponse export const QueryContractHistoryResponse = { typeUrl: "/cosmwasm.wasm.v1.QueryContractHistoryResponse", aminoType: "wasm/QueryContractHistoryResponse", + is(o: any): o is QueryContractHistoryResponse { + return o && (o.$typeUrl === QueryContractHistoryResponse.typeUrl || Array.isArray(o.entries) && (!o.entries.length || ContractCodeHistoryEntry.is(o.entries[0]))); + }, + isSDK(o: any): o is QueryContractHistoryResponseSDKType { + return o && (o.$typeUrl === QueryContractHistoryResponse.typeUrl || Array.isArray(o.entries) && (!o.entries.length || ContractCodeHistoryEntry.isSDK(o.entries[0]))); + }, + isAmino(o: any): o is QueryContractHistoryResponseAmino { + return o && (o.$typeUrl === QueryContractHistoryResponse.typeUrl || Array.isArray(o.entries) && (!o.entries.length || ContractCodeHistoryEntry.isAmino(o.entries[0]))); + }, encode(message: QueryContractHistoryResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.entries) { ContractCodeHistoryEntry.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -1196,6 +1246,13 @@ export const QueryContractHistoryResponse = { typeUrl: "/cosmwasm.wasm.v1.QueryContractHistoryResponse", value: QueryContractHistoryResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryContractHistoryResponse.typeUrl)) { + return; + } + ContractCodeHistoryEntry.registerTypeUrl(); + PageResponse.registerTypeUrl(); } }; function createBaseQueryContractsByCodeRequest(): QueryContractsByCodeRequest { @@ -1214,6 +1271,15 @@ function createBaseQueryContractsByCodeRequest(): QueryContractsByCodeRequest { export const QueryContractsByCodeRequest = { typeUrl: "/cosmwasm.wasm.v1.QueryContractsByCodeRequest", aminoType: "wasm/QueryContractsByCodeRequest", + is(o: any): o is QueryContractsByCodeRequest { + return o && (o.$typeUrl === QueryContractsByCodeRequest.typeUrl || typeof o.codeId === "bigint"); + }, + isSDK(o: any): o is QueryContractsByCodeRequestSDKType { + return o && (o.$typeUrl === QueryContractsByCodeRequest.typeUrl || typeof o.code_id === "bigint"); + }, + isAmino(o: any): o is QueryContractsByCodeRequestAmino { + return o && (o.$typeUrl === QueryContractsByCodeRequest.typeUrl || typeof o.code_id === "bigint"); + }, encode(message: QueryContractsByCodeRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.codeId !== BigInt(0)) { writer.uint32(8).uint64(message.codeId); @@ -1298,6 +1364,12 @@ export const QueryContractsByCodeRequest = { typeUrl: "/cosmwasm.wasm.v1.QueryContractsByCodeRequest", value: QueryContractsByCodeRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryContractsByCodeRequest.typeUrl)) { + return; + } + PageRequest.registerTypeUrl(); } }; function createBaseQueryContractsByCodeResponse(): QueryContractsByCodeResponse { @@ -1316,6 +1388,15 @@ function createBaseQueryContractsByCodeResponse(): QueryContractsByCodeResponse export const QueryContractsByCodeResponse = { typeUrl: "/cosmwasm.wasm.v1.QueryContractsByCodeResponse", aminoType: "wasm/QueryContractsByCodeResponse", + is(o: any): o is QueryContractsByCodeResponse { + return o && (o.$typeUrl === QueryContractsByCodeResponse.typeUrl || Array.isArray(o.contracts) && (!o.contracts.length || typeof o.contracts[0] === "string")); + }, + isSDK(o: any): o is QueryContractsByCodeResponseSDKType { + return o && (o.$typeUrl === QueryContractsByCodeResponse.typeUrl || Array.isArray(o.contracts) && (!o.contracts.length || typeof o.contracts[0] === "string")); + }, + isAmino(o: any): o is QueryContractsByCodeResponseAmino { + return o && (o.$typeUrl === QueryContractsByCodeResponse.typeUrl || Array.isArray(o.contracts) && (!o.contracts.length || typeof o.contracts[0] === "string")); + }, encode(message: QueryContractsByCodeResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.contracts) { writer.uint32(10).string(v!); @@ -1404,6 +1485,12 @@ export const QueryContractsByCodeResponse = { typeUrl: "/cosmwasm.wasm.v1.QueryContractsByCodeResponse", value: QueryContractsByCodeResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryContractsByCodeResponse.typeUrl)) { + return; + } + PageResponse.registerTypeUrl(); } }; function createBaseQueryAllContractStateRequest(): QueryAllContractStateRequest { @@ -1422,6 +1509,15 @@ function createBaseQueryAllContractStateRequest(): QueryAllContractStateRequest export const QueryAllContractStateRequest = { typeUrl: "/cosmwasm.wasm.v1.QueryAllContractStateRequest", aminoType: "wasm/QueryAllContractStateRequest", + is(o: any): o is QueryAllContractStateRequest { + return o && (o.$typeUrl === QueryAllContractStateRequest.typeUrl || typeof o.address === "string"); + }, + isSDK(o: any): o is QueryAllContractStateRequestSDKType { + return o && (o.$typeUrl === QueryAllContractStateRequest.typeUrl || typeof o.address === "string"); + }, + isAmino(o: any): o is QueryAllContractStateRequestAmino { + return o && (o.$typeUrl === QueryAllContractStateRequest.typeUrl || typeof o.address === "string"); + }, encode(message: QueryAllContractStateRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.address !== "") { writer.uint32(10).string(message.address); @@ -1504,6 +1600,12 @@ export const QueryAllContractStateRequest = { typeUrl: "/cosmwasm.wasm.v1.QueryAllContractStateRequest", value: QueryAllContractStateRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryAllContractStateRequest.typeUrl)) { + return; + } + PageRequest.registerTypeUrl(); } }; function createBaseQueryAllContractStateResponse(): QueryAllContractStateResponse { @@ -1522,6 +1624,15 @@ function createBaseQueryAllContractStateResponse(): QueryAllContractStateRespons export const QueryAllContractStateResponse = { typeUrl: "/cosmwasm.wasm.v1.QueryAllContractStateResponse", aminoType: "wasm/QueryAllContractStateResponse", + is(o: any): o is QueryAllContractStateResponse { + return o && (o.$typeUrl === QueryAllContractStateResponse.typeUrl || Array.isArray(o.models) && (!o.models.length || Model.is(o.models[0]))); + }, + isSDK(o: any): o is QueryAllContractStateResponseSDKType { + return o && (o.$typeUrl === QueryAllContractStateResponse.typeUrl || Array.isArray(o.models) && (!o.models.length || Model.isSDK(o.models[0]))); + }, + isAmino(o: any): o is QueryAllContractStateResponseAmino { + return o && (o.$typeUrl === QueryAllContractStateResponse.typeUrl || Array.isArray(o.models) && (!o.models.length || Model.isAmino(o.models[0]))); + }, encode(message: QueryAllContractStateResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.models) { Model.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -1610,6 +1721,13 @@ export const QueryAllContractStateResponse = { typeUrl: "/cosmwasm.wasm.v1.QueryAllContractStateResponse", value: QueryAllContractStateResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryAllContractStateResponse.typeUrl)) { + return; + } + Model.registerTypeUrl(); + PageResponse.registerTypeUrl(); } }; function createBaseQueryRawContractStateRequest(): QueryRawContractStateRequest { @@ -1628,6 +1746,15 @@ function createBaseQueryRawContractStateRequest(): QueryRawContractStateRequest export const QueryRawContractStateRequest = { typeUrl: "/cosmwasm.wasm.v1.QueryRawContractStateRequest", aminoType: "wasm/QueryRawContractStateRequest", + is(o: any): o is QueryRawContractStateRequest { + return o && (o.$typeUrl === QueryRawContractStateRequest.typeUrl || typeof o.address === "string" && (o.queryData instanceof Uint8Array || typeof o.queryData === "string")); + }, + isSDK(o: any): o is QueryRawContractStateRequestSDKType { + return o && (o.$typeUrl === QueryRawContractStateRequest.typeUrl || typeof o.address === "string" && (o.query_data instanceof Uint8Array || typeof o.query_data === "string")); + }, + isAmino(o: any): o is QueryRawContractStateRequestAmino { + return o && (o.$typeUrl === QueryRawContractStateRequest.typeUrl || typeof o.address === "string" && (o.query_data instanceof Uint8Array || typeof o.query_data === "string")); + }, encode(message: QueryRawContractStateRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.address !== "") { writer.uint32(10).string(message.address); @@ -1708,7 +1835,8 @@ export const QueryRawContractStateRequest = { typeUrl: "/cosmwasm.wasm.v1.QueryRawContractStateRequest", value: QueryRawContractStateRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryRawContractStateResponse(): QueryRawContractStateResponse { return { @@ -1725,6 +1853,15 @@ function createBaseQueryRawContractStateResponse(): QueryRawContractStateRespons export const QueryRawContractStateResponse = { typeUrl: "/cosmwasm.wasm.v1.QueryRawContractStateResponse", aminoType: "wasm/QueryRawContractStateResponse", + is(o: any): o is QueryRawContractStateResponse { + return o && (o.$typeUrl === QueryRawContractStateResponse.typeUrl || o.data instanceof Uint8Array || typeof o.data === "string"); + }, + isSDK(o: any): o is QueryRawContractStateResponseSDKType { + return o && (o.$typeUrl === QueryRawContractStateResponse.typeUrl || o.data instanceof Uint8Array || typeof o.data === "string"); + }, + isAmino(o: any): o is QueryRawContractStateResponseAmino { + return o && (o.$typeUrl === QueryRawContractStateResponse.typeUrl || o.data instanceof Uint8Array || typeof o.data === "string"); + }, encode(message: QueryRawContractStateResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.data.length !== 0) { writer.uint32(10).bytes(message.data); @@ -1791,7 +1928,8 @@ export const QueryRawContractStateResponse = { typeUrl: "/cosmwasm.wasm.v1.QueryRawContractStateResponse", value: QueryRawContractStateResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQuerySmartContractStateRequest(): QuerySmartContractStateRequest { return { @@ -1809,6 +1947,15 @@ function createBaseQuerySmartContractStateRequest(): QuerySmartContractStateRequ export const QuerySmartContractStateRequest = { typeUrl: "/cosmwasm.wasm.v1.QuerySmartContractStateRequest", aminoType: "wasm/QuerySmartContractStateRequest", + is(o: any): o is QuerySmartContractStateRequest { + return o && (o.$typeUrl === QuerySmartContractStateRequest.typeUrl || typeof o.address === "string" && (o.queryData instanceof Uint8Array || typeof o.queryData === "string")); + }, + isSDK(o: any): o is QuerySmartContractStateRequestSDKType { + return o && (o.$typeUrl === QuerySmartContractStateRequest.typeUrl || typeof o.address === "string" && (o.query_data instanceof Uint8Array || typeof o.query_data === "string")); + }, + isAmino(o: any): o is QuerySmartContractStateRequestAmino { + return o && (o.$typeUrl === QuerySmartContractStateRequest.typeUrl || typeof o.address === "string" && (o.query_data instanceof Uint8Array || typeof o.query_data === "string")); + }, encode(message: QuerySmartContractStateRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.address !== "") { writer.uint32(10).string(message.address); @@ -1889,7 +2036,8 @@ export const QuerySmartContractStateRequest = { typeUrl: "/cosmwasm.wasm.v1.QuerySmartContractStateRequest", value: QuerySmartContractStateRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQuerySmartContractStateResponse(): QuerySmartContractStateResponse { return { @@ -1906,6 +2054,15 @@ function createBaseQuerySmartContractStateResponse(): QuerySmartContractStateRes export const QuerySmartContractStateResponse = { typeUrl: "/cosmwasm.wasm.v1.QuerySmartContractStateResponse", aminoType: "wasm/QuerySmartContractStateResponse", + is(o: any): o is QuerySmartContractStateResponse { + return o && (o.$typeUrl === QuerySmartContractStateResponse.typeUrl || o.data instanceof Uint8Array || typeof o.data === "string"); + }, + isSDK(o: any): o is QuerySmartContractStateResponseSDKType { + return o && (o.$typeUrl === QuerySmartContractStateResponse.typeUrl || o.data instanceof Uint8Array || typeof o.data === "string"); + }, + isAmino(o: any): o is QuerySmartContractStateResponseAmino { + return o && (o.$typeUrl === QuerySmartContractStateResponse.typeUrl || o.data instanceof Uint8Array || typeof o.data === "string"); + }, encode(message: QuerySmartContractStateResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.data.length !== 0) { writer.uint32(10).bytes(message.data); @@ -1972,7 +2129,8 @@ export const QuerySmartContractStateResponse = { typeUrl: "/cosmwasm.wasm.v1.QuerySmartContractStateResponse", value: QuerySmartContractStateResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryCodeRequest(): QueryCodeRequest { return { @@ -1988,6 +2146,15 @@ function createBaseQueryCodeRequest(): QueryCodeRequest { export const QueryCodeRequest = { typeUrl: "/cosmwasm.wasm.v1.QueryCodeRequest", aminoType: "wasm/QueryCodeRequest", + is(o: any): o is QueryCodeRequest { + return o && (o.$typeUrl === QueryCodeRequest.typeUrl || typeof o.codeId === "bigint"); + }, + isSDK(o: any): o is QueryCodeRequestSDKType { + return o && (o.$typeUrl === QueryCodeRequest.typeUrl || typeof o.code_id === "bigint"); + }, + isAmino(o: any): o is QueryCodeRequestAmino { + return o && (o.$typeUrl === QueryCodeRequest.typeUrl || typeof o.code_id === "bigint"); + }, encode(message: QueryCodeRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.codeId !== BigInt(0)) { writer.uint32(8).uint64(message.codeId); @@ -2056,7 +2223,8 @@ export const QueryCodeRequest = { typeUrl: "/cosmwasm.wasm.v1.QueryCodeRequest", value: QueryCodeRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseCodeInfoResponse(): CodeInfoResponse { return { @@ -2074,6 +2242,15 @@ function createBaseCodeInfoResponse(): CodeInfoResponse { export const CodeInfoResponse = { typeUrl: "/cosmwasm.wasm.v1.CodeInfoResponse", aminoType: "wasm/CodeInfoResponse", + is(o: any): o is CodeInfoResponse { + return o && (o.$typeUrl === CodeInfoResponse.typeUrl || typeof o.codeId === "bigint" && typeof o.creator === "string" && (o.dataHash instanceof Uint8Array || typeof o.dataHash === "string")); + }, + isSDK(o: any): o is CodeInfoResponseSDKType { + return o && (o.$typeUrl === CodeInfoResponse.typeUrl || typeof o.code_id === "bigint" && typeof o.creator === "string" && (o.data_hash instanceof Uint8Array || typeof o.data_hash === "string")); + }, + isAmino(o: any): o is CodeInfoResponseAmino { + return o && (o.$typeUrl === CodeInfoResponse.typeUrl || typeof o.code_id === "bigint" && typeof o.creator === "string" && (o.data_hash instanceof Uint8Array || typeof o.data_hash === "string")); + }, encode(message: CodeInfoResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.codeId !== BigInt(0)) { writer.uint32(8).uint64(message.codeId); @@ -2170,7 +2347,8 @@ export const CodeInfoResponse = { typeUrl: "/cosmwasm.wasm.v1.CodeInfoResponse", value: CodeInfoResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryCodeResponse(): QueryCodeResponse { return { @@ -2187,6 +2365,15 @@ function createBaseQueryCodeResponse(): QueryCodeResponse { export const QueryCodeResponse = { typeUrl: "/cosmwasm.wasm.v1.QueryCodeResponse", aminoType: "wasm/QueryCodeResponse", + is(o: any): o is QueryCodeResponse { + return o && (o.$typeUrl === QueryCodeResponse.typeUrl || o.data instanceof Uint8Array || typeof o.data === "string"); + }, + isSDK(o: any): o is QueryCodeResponseSDKType { + return o && (o.$typeUrl === QueryCodeResponse.typeUrl || o.data instanceof Uint8Array || typeof o.data === "string"); + }, + isAmino(o: any): o is QueryCodeResponseAmino { + return o && (o.$typeUrl === QueryCodeResponse.typeUrl || o.data instanceof Uint8Array || typeof o.data === "string"); + }, encode(message: QueryCodeResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.codeInfo !== undefined) { CodeInfoResponse.encode(message.codeInfo, writer.uint32(10).fork()).ldelim(); @@ -2269,6 +2456,12 @@ export const QueryCodeResponse = { typeUrl: "/cosmwasm.wasm.v1.QueryCodeResponse", value: QueryCodeResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryCodeResponse.typeUrl)) { + return; + } + CodeInfoResponse.registerTypeUrl(); } }; function createBaseQueryCodesRequest(): QueryCodesRequest { @@ -2285,6 +2478,15 @@ function createBaseQueryCodesRequest(): QueryCodesRequest { export const QueryCodesRequest = { typeUrl: "/cosmwasm.wasm.v1.QueryCodesRequest", aminoType: "wasm/QueryCodesRequest", + is(o: any): o is QueryCodesRequest { + return o && o.$typeUrl === QueryCodesRequest.typeUrl; + }, + isSDK(o: any): o is QueryCodesRequestSDKType { + return o && o.$typeUrl === QueryCodesRequest.typeUrl; + }, + isAmino(o: any): o is QueryCodesRequestAmino { + return o && o.$typeUrl === QueryCodesRequest.typeUrl; + }, encode(message: QueryCodesRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.pagination !== undefined) { PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); @@ -2353,6 +2555,12 @@ export const QueryCodesRequest = { typeUrl: "/cosmwasm.wasm.v1.QueryCodesRequest", value: QueryCodesRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryCodesRequest.typeUrl)) { + return; + } + PageRequest.registerTypeUrl(); } }; function createBaseQueryCodesResponse(): QueryCodesResponse { @@ -2370,6 +2578,15 @@ function createBaseQueryCodesResponse(): QueryCodesResponse { export const QueryCodesResponse = { typeUrl: "/cosmwasm.wasm.v1.QueryCodesResponse", aminoType: "wasm/QueryCodesResponse", + is(o: any): o is QueryCodesResponse { + return o && (o.$typeUrl === QueryCodesResponse.typeUrl || Array.isArray(o.codeInfos) && (!o.codeInfos.length || CodeInfoResponse.is(o.codeInfos[0]))); + }, + isSDK(o: any): o is QueryCodesResponseSDKType { + return o && (o.$typeUrl === QueryCodesResponse.typeUrl || Array.isArray(o.code_infos) && (!o.code_infos.length || CodeInfoResponse.isSDK(o.code_infos[0]))); + }, + isAmino(o: any): o is QueryCodesResponseAmino { + return o && (o.$typeUrl === QueryCodesResponse.typeUrl || Array.isArray(o.code_infos) && (!o.code_infos.length || CodeInfoResponse.isAmino(o.code_infos[0]))); + }, encode(message: QueryCodesResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.codeInfos) { CodeInfoResponse.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -2458,6 +2675,13 @@ export const QueryCodesResponse = { typeUrl: "/cosmwasm.wasm.v1.QueryCodesResponse", value: QueryCodesResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryCodesResponse.typeUrl)) { + return; + } + CodeInfoResponse.registerTypeUrl(); + PageResponse.registerTypeUrl(); } }; function createBaseQueryPinnedCodesRequest(): QueryPinnedCodesRequest { @@ -2475,6 +2699,15 @@ function createBaseQueryPinnedCodesRequest(): QueryPinnedCodesRequest { export const QueryPinnedCodesRequest = { typeUrl: "/cosmwasm.wasm.v1.QueryPinnedCodesRequest", aminoType: "wasm/QueryPinnedCodesRequest", + is(o: any): o is QueryPinnedCodesRequest { + return o && o.$typeUrl === QueryPinnedCodesRequest.typeUrl; + }, + isSDK(o: any): o is QueryPinnedCodesRequestSDKType { + return o && o.$typeUrl === QueryPinnedCodesRequest.typeUrl; + }, + isAmino(o: any): o is QueryPinnedCodesRequestAmino { + return o && o.$typeUrl === QueryPinnedCodesRequest.typeUrl; + }, encode(message: QueryPinnedCodesRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.pagination !== undefined) { PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); @@ -2543,6 +2776,12 @@ export const QueryPinnedCodesRequest = { typeUrl: "/cosmwasm.wasm.v1.QueryPinnedCodesRequest", value: QueryPinnedCodesRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryPinnedCodesRequest.typeUrl)) { + return; + } + PageRequest.registerTypeUrl(); } }; function createBaseQueryPinnedCodesResponse(): QueryPinnedCodesResponse { @@ -2561,6 +2800,15 @@ function createBaseQueryPinnedCodesResponse(): QueryPinnedCodesResponse { export const QueryPinnedCodesResponse = { typeUrl: "/cosmwasm.wasm.v1.QueryPinnedCodesResponse", aminoType: "wasm/QueryPinnedCodesResponse", + is(o: any): o is QueryPinnedCodesResponse { + return o && (o.$typeUrl === QueryPinnedCodesResponse.typeUrl || Array.isArray(o.codeIds) && (!o.codeIds.length || typeof o.codeIds[0] === "bigint")); + }, + isSDK(o: any): o is QueryPinnedCodesResponseSDKType { + return o && (o.$typeUrl === QueryPinnedCodesResponse.typeUrl || Array.isArray(o.code_ids) && (!o.code_ids.length || typeof o.code_ids[0] === "bigint")); + }, + isAmino(o: any): o is QueryPinnedCodesResponseAmino { + return o && (o.$typeUrl === QueryPinnedCodesResponse.typeUrl || Array.isArray(o.code_ids) && (!o.code_ids.length || typeof o.code_ids[0] === "bigint")); + }, encode(message: QueryPinnedCodesResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { writer.uint32(10).fork(); for (const v of message.codeIds) { @@ -2658,5 +2906,11 @@ export const QueryPinnedCodesResponse = { typeUrl: "/cosmwasm.wasm.v1.QueryPinnedCodesResponse", value: QueryPinnedCodesResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryPinnedCodesResponse.typeUrl)) { + return; + } + PageResponse.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/cosmwasm/wasm/v1/tx.registry.ts b/__fixtures__/v-next/outputv3/cosmwasm/wasm/v1/tx.registry.ts index 7cac5d6358..630240b335 100644 --- a/__fixtures__/v-next/outputv3/cosmwasm/wasm/v1/tx.registry.ts +++ b/__fixtures__/v-next/outputv3/cosmwasm/wasm/v1/tx.registry.ts @@ -1,13 +1,8 @@ import { AccessConfig, AccessConfigSDKType } from "./types"; import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; -import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { TelescopeGeneratedType } from "../../../types"; import { MsgStoreCode, MsgStoreCodeSDKType, MsgInstantiateContract, MsgInstantiateContractSDKType, MsgExecuteContract, MsgExecuteContractSDKType, MsgMigrateContract, MsgMigrateContractSDKType, MsgUpdateAdmin, MsgUpdateAdminSDKType, MsgClearAdmin, MsgClearAdminSDKType } from "./tx"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/cosmwasm.wasm.v1.MsgStoreCode", MsgStoreCode], ["/cosmwasm.wasm.v1.MsgInstantiateContract", MsgInstantiateContract], ["/cosmwasm.wasm.v1.MsgExecuteContract", MsgExecuteContract], ["/cosmwasm.wasm.v1.MsgMigrateContract", MsgMigrateContract], ["/cosmwasm.wasm.v1.MsgUpdateAdmin", MsgUpdateAdmin], ["/cosmwasm.wasm.v1.MsgClearAdmin", MsgClearAdmin]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/cosmwasm.wasm.v1.MsgStoreCode", MsgStoreCode], ["/cosmwasm.wasm.v1.MsgInstantiateContract", MsgInstantiateContract], ["/cosmwasm.wasm.v1.MsgExecuteContract", MsgExecuteContract], ["/cosmwasm.wasm.v1.MsgMigrateContract", MsgMigrateContract], ["/cosmwasm.wasm.v1.MsgUpdateAdmin", MsgUpdateAdmin], ["/cosmwasm.wasm.v1.MsgClearAdmin", MsgClearAdmin]]; export const MessageComposer = { encoded: { storeCode(value: MsgStoreCode) { diff --git a/__fixtures__/v-next/outputv3/cosmwasm/wasm/v1/tx.rpc.func.ts b/__fixtures__/v-next/outputv3/cosmwasm/wasm/v1/tx.rpc.func.ts new file mode 100644 index 0000000000..1faf1de1bf --- /dev/null +++ b/__fixtures__/v-next/outputv3/cosmwasm/wasm/v1/tx.rpc.func.ts @@ -0,0 +1,58 @@ +import { AccessConfig, AccessConfigSDKType } from "./types"; +import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; +import { buildTx } from "../../../helper-func-types"; +import { MsgStoreCode, MsgStoreCodeSDKType, MsgStoreCodeResponse, MsgStoreCodeResponseSDKType, MsgInstantiateContract, MsgInstantiateContractSDKType, MsgInstantiateContractResponse, MsgInstantiateContractResponseSDKType, MsgExecuteContract, MsgExecuteContractSDKType, MsgExecuteContractResponse, MsgExecuteContractResponseSDKType, MsgMigrateContract, MsgMigrateContractSDKType, MsgMigrateContractResponse, MsgMigrateContractResponseSDKType, MsgUpdateAdmin, MsgUpdateAdminSDKType, MsgUpdateAdminResponse, MsgUpdateAdminResponseSDKType, MsgClearAdmin, MsgClearAdminSDKType, MsgClearAdminResponse, MsgClearAdminResponseSDKType } from "./tx"; +/** + * StoreCode to submit Wasm code to the system + * @name storeCode + * @package cosmwasm.wasm.v1 + * @see proto service: cosmwasm.wasm.v1.StoreCode + */ +export const storeCode = buildTx({ + msg: MsgStoreCode +}); +/** + * Instantiate creates a new smart contract instance for the given code id. + * @name instantiateContract + * @package cosmwasm.wasm.v1 + * @see proto service: cosmwasm.wasm.v1.InstantiateContract + */ +export const instantiateContract = buildTx({ + msg: MsgInstantiateContract +}); +/** + * Execute submits the given message data to a smart contract + * @name executeContract + * @package cosmwasm.wasm.v1 + * @see proto service: cosmwasm.wasm.v1.ExecuteContract + */ +export const executeContract = buildTx({ + msg: MsgExecuteContract +}); +/** + * Migrate runs a code upgrade/ downgrade for a smart contract + * @name migrateContract + * @package cosmwasm.wasm.v1 + * @see proto service: cosmwasm.wasm.v1.MigrateContract + */ +export const migrateContract = buildTx({ + msg: MsgMigrateContract +}); +/** + * UpdateAdmin sets a new admin for a smart contract + * @name updateAdmin + * @package cosmwasm.wasm.v1 + * @see proto service: cosmwasm.wasm.v1.UpdateAdmin + */ +export const updateAdmin = buildTx({ + msg: MsgUpdateAdmin +}); +/** + * ClearAdmin removes any admin stored for a smart contract + * @name clearAdmin + * @package cosmwasm.wasm.v1 + * @see proto service: cosmwasm.wasm.v1.ClearAdmin + */ +export const clearAdmin = buildTx({ + msg: MsgClearAdmin +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/cosmwasm/wasm/v1/tx.ts b/__fixtures__/v-next/outputv3/cosmwasm/wasm/v1/tx.ts index c5b389dc1c..6ee987dbe5 100644 --- a/__fixtures__/v-next/outputv3/cosmwasm/wasm/v1/tx.ts +++ b/__fixtures__/v-next/outputv3/cosmwasm/wasm/v1/tx.ts @@ -1,8 +1,9 @@ import { AccessConfig, AccessConfigAmino, AccessConfigSDKType } from "./types"; import { Coin, CoinAmino, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; +import { GlobalDecoderRegistry } from "../../../registry"; import { isSet, bytesFromBase64, DeepPartial, base64FromBytes } from "../../../helpers"; -import { fromBase64, toBase64, toUtf8, fromUtf8 } from "@cosmjs/encoding"; +import { fromBase64, toBase64, toUtf8, fromUtf8 } from "@interchainjs/encoding"; export const protobufPackage = "cosmwasm.wasm.v1"; /** * MsgStoreCode submit Wasm code to the system @@ -600,6 +601,15 @@ function createBaseMsgStoreCode(): MsgStoreCode { export const MsgStoreCode = { typeUrl: "/cosmwasm.wasm.v1.MsgStoreCode", aminoType: "wasm/MsgStoreCode", + is(o: any): o is MsgStoreCode { + return o && (o.$typeUrl === MsgStoreCode.typeUrl || typeof o.sender === "string" && (o.wasmByteCode instanceof Uint8Array || typeof o.wasmByteCode === "string")); + }, + isSDK(o: any): o is MsgStoreCodeSDKType { + return o && (o.$typeUrl === MsgStoreCode.typeUrl || typeof o.sender === "string" && (o.wasm_byte_code instanceof Uint8Array || typeof o.wasm_byte_code === "string")); + }, + isAmino(o: any): o is MsgStoreCodeAmino { + return o && (o.$typeUrl === MsgStoreCode.typeUrl || typeof o.sender === "string" && (o.wasm_byte_code instanceof Uint8Array || typeof o.wasm_byte_code === "string")); + }, encode(message: MsgStoreCode, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.sender !== "") { writer.uint32(10).string(message.sender); @@ -696,6 +706,12 @@ export const MsgStoreCode = { typeUrl: "/cosmwasm.wasm.v1.MsgStoreCode", value: MsgStoreCode.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgStoreCode.typeUrl)) { + return; + } + AccessConfig.registerTypeUrl(); } }; function createBaseMsgStoreCodeResponse(): MsgStoreCodeResponse { @@ -712,6 +728,15 @@ function createBaseMsgStoreCodeResponse(): MsgStoreCodeResponse { export const MsgStoreCodeResponse = { typeUrl: "/cosmwasm.wasm.v1.MsgStoreCodeResponse", aminoType: "wasm/MsgStoreCodeResponse", + is(o: any): o is MsgStoreCodeResponse { + return o && (o.$typeUrl === MsgStoreCodeResponse.typeUrl || typeof o.codeId === "bigint"); + }, + isSDK(o: any): o is MsgStoreCodeResponseSDKType { + return o && (o.$typeUrl === MsgStoreCodeResponse.typeUrl || typeof o.code_id === "bigint"); + }, + isAmino(o: any): o is MsgStoreCodeResponseAmino { + return o && (o.$typeUrl === MsgStoreCodeResponse.typeUrl || typeof o.code_id === "bigint"); + }, encode(message: MsgStoreCodeResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.codeId !== BigInt(0)) { writer.uint32(8).uint64(message.codeId); @@ -780,7 +805,8 @@ export const MsgStoreCodeResponse = { typeUrl: "/cosmwasm.wasm.v1.MsgStoreCodeResponse", value: MsgStoreCodeResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgInstantiateContract(): MsgInstantiateContract { return { @@ -802,6 +828,15 @@ function createBaseMsgInstantiateContract(): MsgInstantiateContract { export const MsgInstantiateContract = { typeUrl: "/cosmwasm.wasm.v1.MsgInstantiateContract", aminoType: "wasm/MsgInstantiateContract", + is(o: any): o is MsgInstantiateContract { + return o && (o.$typeUrl === MsgInstantiateContract.typeUrl || typeof o.sender === "string" && typeof o.admin === "string" && typeof o.codeId === "bigint" && typeof o.label === "string" && (o.msg instanceof Uint8Array || typeof o.msg === "string") && Array.isArray(o.funds) && (!o.funds.length || Coin.is(o.funds[0]))); + }, + isSDK(o: any): o is MsgInstantiateContractSDKType { + return o && (o.$typeUrl === MsgInstantiateContract.typeUrl || typeof o.sender === "string" && typeof o.admin === "string" && typeof o.code_id === "bigint" && typeof o.label === "string" && (o.msg instanceof Uint8Array || typeof o.msg === "string") && Array.isArray(o.funds) && (!o.funds.length || Coin.isSDK(o.funds[0]))); + }, + isAmino(o: any): o is MsgInstantiateContractAmino { + return o && (o.$typeUrl === MsgInstantiateContract.typeUrl || typeof o.sender === "string" && typeof o.admin === "string" && typeof o.code_id === "bigint" && typeof o.label === "string" && (o.msg instanceof Uint8Array || typeof o.msg === "string") && Array.isArray(o.funds) && (!o.funds.length || Coin.isAmino(o.funds[0]))); + }, encode(message: MsgInstantiateContract, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.sender !== "") { writer.uint32(10).string(message.sender); @@ -946,6 +981,12 @@ export const MsgInstantiateContract = { typeUrl: "/cosmwasm.wasm.v1.MsgInstantiateContract", value: MsgInstantiateContract.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgInstantiateContract.typeUrl)) { + return; + } + Coin.registerTypeUrl(); } }; function createBaseMsgInstantiateContractResponse(): MsgInstantiateContractResponse { @@ -963,6 +1004,15 @@ function createBaseMsgInstantiateContractResponse(): MsgInstantiateContractRespo export const MsgInstantiateContractResponse = { typeUrl: "/cosmwasm.wasm.v1.MsgInstantiateContractResponse", aminoType: "wasm/MsgInstantiateContractResponse", + is(o: any): o is MsgInstantiateContractResponse { + return o && (o.$typeUrl === MsgInstantiateContractResponse.typeUrl || typeof o.address === "string" && (o.data instanceof Uint8Array || typeof o.data === "string")); + }, + isSDK(o: any): o is MsgInstantiateContractResponseSDKType { + return o && (o.$typeUrl === MsgInstantiateContractResponse.typeUrl || typeof o.address === "string" && (o.data instanceof Uint8Array || typeof o.data === "string")); + }, + isAmino(o: any): o is MsgInstantiateContractResponseAmino { + return o && (o.$typeUrl === MsgInstantiateContractResponse.typeUrl || typeof o.address === "string" && (o.data instanceof Uint8Array || typeof o.data === "string")); + }, encode(message: MsgInstantiateContractResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.address !== "") { writer.uint32(10).string(message.address); @@ -1043,7 +1093,8 @@ export const MsgInstantiateContractResponse = { typeUrl: "/cosmwasm.wasm.v1.MsgInstantiateContractResponse", value: MsgInstantiateContractResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgExecuteContract(): MsgExecuteContract { return { @@ -1062,6 +1113,15 @@ function createBaseMsgExecuteContract(): MsgExecuteContract { export const MsgExecuteContract = { typeUrl: "/cosmwasm.wasm.v1.MsgExecuteContract", aminoType: "wasm/MsgExecuteContract", + is(o: any): o is MsgExecuteContract { + return o && (o.$typeUrl === MsgExecuteContract.typeUrl || typeof o.sender === "string" && typeof o.contract === "string" && (o.msg instanceof Uint8Array || typeof o.msg === "string") && Array.isArray(o.funds) && (!o.funds.length || Coin.is(o.funds[0]))); + }, + isSDK(o: any): o is MsgExecuteContractSDKType { + return o && (o.$typeUrl === MsgExecuteContract.typeUrl || typeof o.sender === "string" && typeof o.contract === "string" && (o.msg instanceof Uint8Array || typeof o.msg === "string") && Array.isArray(o.funds) && (!o.funds.length || Coin.isSDK(o.funds[0]))); + }, + isAmino(o: any): o is MsgExecuteContractAmino { + return o && (o.$typeUrl === MsgExecuteContract.typeUrl || typeof o.sender === "string" && typeof o.contract === "string" && (o.msg instanceof Uint8Array || typeof o.msg === "string") && Array.isArray(o.funds) && (!o.funds.length || Coin.isAmino(o.funds[0]))); + }, encode(message: MsgExecuteContract, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.sender !== "") { writer.uint32(10).string(message.sender); @@ -1176,6 +1236,12 @@ export const MsgExecuteContract = { typeUrl: "/cosmwasm.wasm.v1.MsgExecuteContract", value: MsgExecuteContract.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgExecuteContract.typeUrl)) { + return; + } + Coin.registerTypeUrl(); } }; function createBaseMsgExecuteContractResponse(): MsgExecuteContractResponse { @@ -1192,6 +1258,15 @@ function createBaseMsgExecuteContractResponse(): MsgExecuteContractResponse { export const MsgExecuteContractResponse = { typeUrl: "/cosmwasm.wasm.v1.MsgExecuteContractResponse", aminoType: "wasm/MsgExecuteContractResponse", + is(o: any): o is MsgExecuteContractResponse { + return o && (o.$typeUrl === MsgExecuteContractResponse.typeUrl || o.data instanceof Uint8Array || typeof o.data === "string"); + }, + isSDK(o: any): o is MsgExecuteContractResponseSDKType { + return o && (o.$typeUrl === MsgExecuteContractResponse.typeUrl || o.data instanceof Uint8Array || typeof o.data === "string"); + }, + isAmino(o: any): o is MsgExecuteContractResponseAmino { + return o && (o.$typeUrl === MsgExecuteContractResponse.typeUrl || o.data instanceof Uint8Array || typeof o.data === "string"); + }, encode(message: MsgExecuteContractResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.data.length !== 0) { writer.uint32(10).bytes(message.data); @@ -1258,7 +1333,8 @@ export const MsgExecuteContractResponse = { typeUrl: "/cosmwasm.wasm.v1.MsgExecuteContractResponse", value: MsgExecuteContractResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgMigrateContract(): MsgMigrateContract { return { @@ -1277,6 +1353,15 @@ function createBaseMsgMigrateContract(): MsgMigrateContract { export const MsgMigrateContract = { typeUrl: "/cosmwasm.wasm.v1.MsgMigrateContract", aminoType: "wasm/MsgMigrateContract", + is(o: any): o is MsgMigrateContract { + return o && (o.$typeUrl === MsgMigrateContract.typeUrl || typeof o.sender === "string" && typeof o.contract === "string" && typeof o.codeId === "bigint" && (o.msg instanceof Uint8Array || typeof o.msg === "string")); + }, + isSDK(o: any): o is MsgMigrateContractSDKType { + return o && (o.$typeUrl === MsgMigrateContract.typeUrl || typeof o.sender === "string" && typeof o.contract === "string" && typeof o.code_id === "bigint" && (o.msg instanceof Uint8Array || typeof o.msg === "string")); + }, + isAmino(o: any): o is MsgMigrateContractAmino { + return o && (o.$typeUrl === MsgMigrateContract.typeUrl || typeof o.sender === "string" && typeof o.contract === "string" && typeof o.code_id === "bigint" && (o.msg instanceof Uint8Array || typeof o.msg === "string")); + }, encode(message: MsgMigrateContract, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.sender !== "") { writer.uint32(10).string(message.sender); @@ -1387,7 +1472,8 @@ export const MsgMigrateContract = { typeUrl: "/cosmwasm.wasm.v1.MsgMigrateContract", value: MsgMigrateContract.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgMigrateContractResponse(): MsgMigrateContractResponse { return { @@ -1403,6 +1489,15 @@ function createBaseMsgMigrateContractResponse(): MsgMigrateContractResponse { export const MsgMigrateContractResponse = { typeUrl: "/cosmwasm.wasm.v1.MsgMigrateContractResponse", aminoType: "wasm/MsgMigrateContractResponse", + is(o: any): o is MsgMigrateContractResponse { + return o && (o.$typeUrl === MsgMigrateContractResponse.typeUrl || o.data instanceof Uint8Array || typeof o.data === "string"); + }, + isSDK(o: any): o is MsgMigrateContractResponseSDKType { + return o && (o.$typeUrl === MsgMigrateContractResponse.typeUrl || o.data instanceof Uint8Array || typeof o.data === "string"); + }, + isAmino(o: any): o is MsgMigrateContractResponseAmino { + return o && (o.$typeUrl === MsgMigrateContractResponse.typeUrl || o.data instanceof Uint8Array || typeof o.data === "string"); + }, encode(message: MsgMigrateContractResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.data.length !== 0) { writer.uint32(10).bytes(message.data); @@ -1469,7 +1564,8 @@ export const MsgMigrateContractResponse = { typeUrl: "/cosmwasm.wasm.v1.MsgMigrateContractResponse", value: MsgMigrateContractResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgUpdateAdmin(): MsgUpdateAdmin { return { @@ -1487,6 +1583,15 @@ function createBaseMsgUpdateAdmin(): MsgUpdateAdmin { export const MsgUpdateAdmin = { typeUrl: "/cosmwasm.wasm.v1.MsgUpdateAdmin", aminoType: "wasm/MsgUpdateAdmin", + is(o: any): o is MsgUpdateAdmin { + return o && (o.$typeUrl === MsgUpdateAdmin.typeUrl || typeof o.sender === "string" && typeof o.newAdmin === "string" && typeof o.contract === "string"); + }, + isSDK(o: any): o is MsgUpdateAdminSDKType { + return o && (o.$typeUrl === MsgUpdateAdmin.typeUrl || typeof o.sender === "string" && typeof o.new_admin === "string" && typeof o.contract === "string"); + }, + isAmino(o: any): o is MsgUpdateAdminAmino { + return o && (o.$typeUrl === MsgUpdateAdmin.typeUrl || typeof o.sender === "string" && typeof o.new_admin === "string" && typeof o.contract === "string"); + }, encode(message: MsgUpdateAdmin, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.sender !== "") { writer.uint32(10).string(message.sender); @@ -1581,7 +1686,8 @@ export const MsgUpdateAdmin = { typeUrl: "/cosmwasm.wasm.v1.MsgUpdateAdmin", value: MsgUpdateAdmin.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgUpdateAdminResponse(): MsgUpdateAdminResponse { return {}; @@ -1595,6 +1701,15 @@ function createBaseMsgUpdateAdminResponse(): MsgUpdateAdminResponse { export const MsgUpdateAdminResponse = { typeUrl: "/cosmwasm.wasm.v1.MsgUpdateAdminResponse", aminoType: "wasm/MsgUpdateAdminResponse", + is(o: any): o is MsgUpdateAdminResponse { + return o && o.$typeUrl === MsgUpdateAdminResponse.typeUrl; + }, + isSDK(o: any): o is MsgUpdateAdminResponseSDKType { + return o && o.$typeUrl === MsgUpdateAdminResponse.typeUrl; + }, + isAmino(o: any): o is MsgUpdateAdminResponseAmino { + return o && o.$typeUrl === MsgUpdateAdminResponse.typeUrl; + }, encode(_: MsgUpdateAdminResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -1646,7 +1761,8 @@ export const MsgUpdateAdminResponse = { typeUrl: "/cosmwasm.wasm.v1.MsgUpdateAdminResponse", value: MsgUpdateAdminResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgClearAdmin(): MsgClearAdmin { return { @@ -1663,6 +1779,15 @@ function createBaseMsgClearAdmin(): MsgClearAdmin { export const MsgClearAdmin = { typeUrl: "/cosmwasm.wasm.v1.MsgClearAdmin", aminoType: "wasm/MsgClearAdmin", + is(o: any): o is MsgClearAdmin { + return o && (o.$typeUrl === MsgClearAdmin.typeUrl || typeof o.sender === "string" && typeof o.contract === "string"); + }, + isSDK(o: any): o is MsgClearAdminSDKType { + return o && (o.$typeUrl === MsgClearAdmin.typeUrl || typeof o.sender === "string" && typeof o.contract === "string"); + }, + isAmino(o: any): o is MsgClearAdminAmino { + return o && (o.$typeUrl === MsgClearAdmin.typeUrl || typeof o.sender === "string" && typeof o.contract === "string"); + }, encode(message: MsgClearAdmin, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.sender !== "") { writer.uint32(10).string(message.sender); @@ -1743,7 +1868,8 @@ export const MsgClearAdmin = { typeUrl: "/cosmwasm.wasm.v1.MsgClearAdmin", value: MsgClearAdmin.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgClearAdminResponse(): MsgClearAdminResponse { return {}; @@ -1757,6 +1883,15 @@ function createBaseMsgClearAdminResponse(): MsgClearAdminResponse { export const MsgClearAdminResponse = { typeUrl: "/cosmwasm.wasm.v1.MsgClearAdminResponse", aminoType: "wasm/MsgClearAdminResponse", + is(o: any): o is MsgClearAdminResponse { + return o && o.$typeUrl === MsgClearAdminResponse.typeUrl; + }, + isSDK(o: any): o is MsgClearAdminResponseSDKType { + return o && o.$typeUrl === MsgClearAdminResponse.typeUrl; + }, + isAmino(o: any): o is MsgClearAdminResponseAmino { + return o && o.$typeUrl === MsgClearAdminResponse.typeUrl; + }, encode(_: MsgClearAdminResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -1808,5 +1943,6 @@ export const MsgClearAdminResponse = { typeUrl: "/cosmwasm.wasm.v1.MsgClearAdminResponse", value: MsgClearAdminResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/cosmwasm/wasm/v1/types.ts b/__fixtures__/v-next/outputv3/cosmwasm/wasm/v1/types.ts index 0dad75d158..4b9e038e3e 100644 --- a/__fixtures__/v-next/outputv3/cosmwasm/wasm/v1/types.ts +++ b/__fixtures__/v-next/outputv3/cosmwasm/wasm/v1/types.ts @@ -1,7 +1,8 @@ import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../google/protobuf/any"; -import { BinaryReader, BinaryWriter } from "../../../binary"; import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../helpers"; -import { toUtf8, fromUtf8 } from "@cosmjs/encoding"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { GlobalDecoderRegistry } from "../../../registry"; +import { toUtf8, fromUtf8 } from "@interchainjs/encoding"; export const protobufPackage = "cosmwasm.wasm.v1"; /** AccessType permission types */ export enum AccessType { @@ -519,6 +520,15 @@ function createBaseAccessTypeParam(): AccessTypeParam { export const AccessTypeParam = { typeUrl: "/cosmwasm.wasm.v1.AccessTypeParam", aminoType: "wasm/AccessTypeParam", + is(o: any): o is AccessTypeParam { + return o && (o.$typeUrl === AccessTypeParam.typeUrl || isSet(o.value)); + }, + isSDK(o: any): o is AccessTypeParamSDKType { + return o && (o.$typeUrl === AccessTypeParam.typeUrl || isSet(o.value)); + }, + isAmino(o: any): o is AccessTypeParamAmino { + return o && (o.$typeUrl === AccessTypeParam.typeUrl || isSet(o.value)); + }, encode(message: AccessTypeParam, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.value !== 0) { writer.uint32(8).int32(message.value); @@ -585,7 +595,8 @@ export const AccessTypeParam = { typeUrl: "/cosmwasm.wasm.v1.AccessTypeParam", value: AccessTypeParam.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseAccessConfig(): AccessConfig { return { @@ -602,6 +613,15 @@ function createBaseAccessConfig(): AccessConfig { export const AccessConfig = { typeUrl: "/cosmwasm.wasm.v1.AccessConfig", aminoType: "wasm/AccessConfig", + is(o: any): o is AccessConfig { + return o && (o.$typeUrl === AccessConfig.typeUrl || isSet(o.permission) && typeof o.address === "string"); + }, + isSDK(o: any): o is AccessConfigSDKType { + return o && (o.$typeUrl === AccessConfig.typeUrl || isSet(o.permission) && typeof o.address === "string"); + }, + isAmino(o: any): o is AccessConfigAmino { + return o && (o.$typeUrl === AccessConfig.typeUrl || isSet(o.permission) && typeof o.address === "string"); + }, encode(message: AccessConfig, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.permission !== 0) { writer.uint32(8).int32(message.permission); @@ -682,7 +702,8 @@ export const AccessConfig = { typeUrl: "/cosmwasm.wasm.v1.AccessConfig", value: AccessConfig.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseParams(): Params { return { @@ -700,6 +721,15 @@ function createBaseParams(): Params { export const Params = { typeUrl: "/cosmwasm.wasm.v1.Params", aminoType: "wasm/Params", + is(o: any): o is Params { + return o && (o.$typeUrl === Params.typeUrl || AccessConfig.is(o.codeUploadAccess) && isSet(o.instantiateDefaultPermission) && typeof o.maxWasmCodeSize === "bigint"); + }, + isSDK(o: any): o is ParamsSDKType { + return o && (o.$typeUrl === Params.typeUrl || AccessConfig.isSDK(o.code_upload_access) && isSet(o.instantiate_default_permission) && typeof o.max_wasm_code_size === "bigint"); + }, + isAmino(o: any): o is ParamsAmino { + return o && (o.$typeUrl === Params.typeUrl || AccessConfig.isAmino(o.code_upload_access) && isSet(o.instantiate_default_permission) && typeof o.max_wasm_code_size === "bigint"); + }, encode(message: Params, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.codeUploadAccess !== undefined) { AccessConfig.encode(message.codeUploadAccess, writer.uint32(10).fork()).ldelim(); @@ -798,6 +828,12 @@ export const Params = { typeUrl: "/cosmwasm.wasm.v1.Params", value: Params.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Params.typeUrl)) { + return; + } + AccessConfig.registerTypeUrl(); } }; function createBaseCodeInfo(): CodeInfo { @@ -816,6 +852,15 @@ function createBaseCodeInfo(): CodeInfo { export const CodeInfo = { typeUrl: "/cosmwasm.wasm.v1.CodeInfo", aminoType: "wasm/CodeInfo", + is(o: any): o is CodeInfo { + return o && (o.$typeUrl === CodeInfo.typeUrl || (o.codeHash instanceof Uint8Array || typeof o.codeHash === "string") && typeof o.creator === "string" && AccessConfig.is(o.instantiateConfig)); + }, + isSDK(o: any): o is CodeInfoSDKType { + return o && (o.$typeUrl === CodeInfo.typeUrl || (o.code_hash instanceof Uint8Array || typeof o.code_hash === "string") && typeof o.creator === "string" && AccessConfig.isSDK(o.instantiate_config)); + }, + isAmino(o: any): o is CodeInfoAmino { + return o && (o.$typeUrl === CodeInfo.typeUrl || (o.code_hash instanceof Uint8Array || typeof o.code_hash === "string") && typeof o.creator === "string" && AccessConfig.isAmino(o.instantiate_config)); + }, encode(message: CodeInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.codeHash.length !== 0) { writer.uint32(10).bytes(message.codeHash); @@ -912,6 +957,12 @@ export const CodeInfo = { typeUrl: "/cosmwasm.wasm.v1.CodeInfo", value: CodeInfo.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(CodeInfo.typeUrl)) { + return; + } + AccessConfig.registerTypeUrl(); } }; function createBaseContractInfo(): ContractInfo { @@ -934,6 +985,15 @@ function createBaseContractInfo(): ContractInfo { export const ContractInfo = { typeUrl: "/cosmwasm.wasm.v1.ContractInfo", aminoType: "wasm/ContractInfo", + is(o: any): o is ContractInfo { + return o && (o.$typeUrl === ContractInfo.typeUrl || typeof o.codeId === "bigint" && typeof o.creator === "string" && typeof o.admin === "string" && typeof o.label === "string" && typeof o.ibcPortId === "string"); + }, + isSDK(o: any): o is ContractInfoSDKType { + return o && (o.$typeUrl === ContractInfo.typeUrl || typeof o.code_id === "bigint" && typeof o.creator === "string" && typeof o.admin === "string" && typeof o.label === "string" && typeof o.ibc_port_id === "string"); + }, + isAmino(o: any): o is ContractInfoAmino { + return o && (o.$typeUrl === ContractInfo.typeUrl || typeof o.code_id === "bigint" && typeof o.creator === "string" && typeof o.admin === "string" && typeof o.label === "string" && typeof o.ibc_port_id === "string"); + }, encode(message: ContractInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.codeId !== BigInt(0)) { writer.uint32(8).uint64(message.codeId); @@ -954,7 +1014,7 @@ export const ContractInfo = { writer.uint32(50).string(message.ibcPortId); } if (message.extension !== undefined) { - Any.encode((message.extension as Any), writer.uint32(58).fork()).ldelim(); + Any.encode(GlobalDecoderRegistry.wrapAny(message.extension), writer.uint32(58).fork()).ldelim(); } return writer; }, @@ -984,7 +1044,7 @@ export const ContractInfo = { message.ibcPortId = reader.string(); break; case 7: - message.extension = useInterfaces ? (ContractInfoExtension_InterfaceDecoder(reader) as Any) : Any.decode(reader, reader.uint32(), useInterfaces); + message.extension = GlobalDecoderRegistry.unwrapAny(reader); break; default: reader.skipType(tag & 7); @@ -1001,7 +1061,7 @@ export const ContractInfo = { if (isSet(object.label)) obj.label = String(object.label); if (isSet(object.created)) obj.created = AbsoluteTxPosition.fromJSON(object.created); if (isSet(object.ibcPortId)) obj.ibcPortId = String(object.ibcPortId); - if (isSet(object.extension)) obj.extension = Any.fromJSON(object.extension); + if (isSet(object.extension)) obj.extension = GlobalDecoderRegistry.fromJSON(object.extension); return obj; }, fromPartial(object: DeepPartial): ContractInfo { @@ -1017,7 +1077,7 @@ export const ContractInfo = { } message.ibcPortId = object.ibcPortId ?? ""; if (object.extension !== undefined && object.extension !== null) { - message.extension = Any.fromPartial(object.extension); + message.extension = GlobalDecoderRegistry.fromPartial(object.extension); } return message; }, @@ -1029,7 +1089,7 @@ export const ContractInfo = { label: object?.label, created: object.created ? AbsoluteTxPosition.fromSDK(object.created) : undefined, ibcPortId: object?.ibc_port_id, - extension: object.extension ? Any.fromSDK(object.extension) : undefined + extension: object.extension ? GlobalDecoderRegistry.fromSDK(object.extension) : undefined }; }, toSDK(message: ContractInfo): ContractInfoSDKType { @@ -1040,7 +1100,7 @@ export const ContractInfo = { obj.label = message.label; message.created !== undefined && (obj.created = message.created ? AbsoluteTxPosition.toSDK(message.created) : undefined); obj.ibc_port_id = message.ibcPortId; - message.extension !== undefined && (obj.extension = message.extension ? Any.toSDK(message.extension) : undefined); + message.extension !== undefined && (obj.extension = message.extension ? GlobalDecoderRegistry.toSDK(message.extension) : undefined); return obj; }, fromAmino(object: ContractInfoAmino): ContractInfo { @@ -1064,7 +1124,7 @@ export const ContractInfo = { message.ibcPortId = object.ibc_port_id; } if (object.extension !== undefined && object.extension !== null) { - message.extension = ContractInfoExtension_FromAmino(object.extension); + message.extension = GlobalDecoderRegistry.fromAminoMsg(object.extension); } return message; }, @@ -1076,7 +1136,7 @@ export const ContractInfo = { obj.label = message.label === "" ? undefined : message.label; obj.created = message.created ? AbsoluteTxPosition.toAmino(message.created, useInterfaces) : undefined; obj.ibc_port_id = message.ibcPortId === "" ? undefined : message.ibcPortId; - obj.extension = message.extension ? ContractInfoExtension_ToAmino((message.extension as Any), useInterfaces) : undefined; + obj.extension = message.extension ? GlobalDecoderRegistry.toAminoMsg(message.extension) : undefined; return obj; }, fromProtoMsg(message: ContractInfoProtoMsg, useInterfaces: boolean = true): ContractInfo { @@ -1090,7 +1150,8 @@ export const ContractInfo = { typeUrl: "/cosmwasm.wasm.v1.ContractInfo", value: ContractInfo.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseContractCodeHistoryEntry(): ContractCodeHistoryEntry { return { @@ -1109,6 +1170,15 @@ function createBaseContractCodeHistoryEntry(): ContractCodeHistoryEntry { export const ContractCodeHistoryEntry = { typeUrl: "/cosmwasm.wasm.v1.ContractCodeHistoryEntry", aminoType: "wasm/ContractCodeHistoryEntry", + is(o: any): o is ContractCodeHistoryEntry { + return o && (o.$typeUrl === ContractCodeHistoryEntry.typeUrl || isSet(o.operation) && typeof o.codeId === "bigint" && (o.msg instanceof Uint8Array || typeof o.msg === "string")); + }, + isSDK(o: any): o is ContractCodeHistoryEntrySDKType { + return o && (o.$typeUrl === ContractCodeHistoryEntry.typeUrl || isSet(o.operation) && typeof o.code_id === "bigint" && (o.msg instanceof Uint8Array || typeof o.msg === "string")); + }, + isAmino(o: any): o is ContractCodeHistoryEntryAmino { + return o && (o.$typeUrl === ContractCodeHistoryEntry.typeUrl || isSet(o.operation) && typeof o.code_id === "bigint" && (o.msg instanceof Uint8Array || typeof o.msg === "string")); + }, encode(message: ContractCodeHistoryEntry, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.operation !== 0) { writer.uint32(8).int32(message.operation); @@ -1221,6 +1291,12 @@ export const ContractCodeHistoryEntry = { typeUrl: "/cosmwasm.wasm.v1.ContractCodeHistoryEntry", value: ContractCodeHistoryEntry.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ContractCodeHistoryEntry.typeUrl)) { + return; + } + AbsoluteTxPosition.registerTypeUrl(); } }; function createBaseAbsoluteTxPosition(): AbsoluteTxPosition { @@ -1239,6 +1315,15 @@ function createBaseAbsoluteTxPosition(): AbsoluteTxPosition { export const AbsoluteTxPosition = { typeUrl: "/cosmwasm.wasm.v1.AbsoluteTxPosition", aminoType: "wasm/AbsoluteTxPosition", + is(o: any): o is AbsoluteTxPosition { + return o && (o.$typeUrl === AbsoluteTxPosition.typeUrl || typeof o.blockHeight === "bigint" && typeof o.txIndex === "bigint"); + }, + isSDK(o: any): o is AbsoluteTxPositionSDKType { + return o && (o.$typeUrl === AbsoluteTxPosition.typeUrl || typeof o.block_height === "bigint" && typeof o.tx_index === "bigint"); + }, + isAmino(o: any): o is AbsoluteTxPositionAmino { + return o && (o.$typeUrl === AbsoluteTxPosition.typeUrl || typeof o.block_height === "bigint" && typeof o.tx_index === "bigint"); + }, encode(message: AbsoluteTxPosition, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.blockHeight !== BigInt(0)) { writer.uint32(8).uint64(message.blockHeight); @@ -1323,7 +1408,8 @@ export const AbsoluteTxPosition = { typeUrl: "/cosmwasm.wasm.v1.AbsoluteTxPosition", value: AbsoluteTxPosition.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseModel(): Model { return { @@ -1340,6 +1426,15 @@ function createBaseModel(): Model { export const Model = { typeUrl: "/cosmwasm.wasm.v1.Model", aminoType: "wasm/Model", + is(o: any): o is Model { + return o && (o.$typeUrl === Model.typeUrl || (o.key instanceof Uint8Array || typeof o.key === "string") && (o.value instanceof Uint8Array || typeof o.value === "string")); + }, + isSDK(o: any): o is ModelSDKType { + return o && (o.$typeUrl === Model.typeUrl || (o.key instanceof Uint8Array || typeof o.key === "string") && (o.value instanceof Uint8Array || typeof o.value === "string")); + }, + isAmino(o: any): o is ModelAmino { + return o && (o.$typeUrl === Model.typeUrl || (o.key instanceof Uint8Array || typeof o.key === "string") && (o.value instanceof Uint8Array || typeof o.value === "string")); + }, encode(message: Model, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.key.length !== 0) { writer.uint32(10).bytes(message.key); @@ -1420,19 +1515,6 @@ export const Model = { typeUrl: "/cosmwasm.wasm.v1.Model", value: Model.encode(message).finish() }; - } -}; -export const ContractInfoExtension_InterfaceDecoder = (input: BinaryReader | Uint8Array): Any => { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - const data = Any.decode(reader, reader.uint32(), true); - switch (data.typeUrl) { - default: - return data; - } -}; -export const ContractInfoExtension_FromAmino = (content: AnyAmino): Any => { - return Any.fromAmino(content); -}; -export const ContractInfoExtension_ToAmino = (content: Any, useInterfaces: boolean = true) => { - return Any.toAmino(content, useInterfaces); + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/evmos/bundle.ts b/__fixtures__/v-next/outputv3/evmos/bundle.ts index 9490653068..835402f42f 100644 --- a/__fixtures__/v-next/outputv3/evmos/bundle.ts +++ b/__fixtures__/v-next/outputv3/evmos/bundle.ts @@ -22,50 +22,52 @@ import * as _173 from "./recovery/v1/query"; import * as _174 from "./vesting/v1/query"; import * as _175 from "./vesting/v1/tx"; import * as _176 from "./vesting/v1/vesting"; -import * as _438 from "./erc20/v1/tx.amino"; -import * as _439 from "./fees/v1/tx.amino"; -import * as _440 from "./vesting/v1/tx.amino"; -import * as _441 from "./erc20/v1/tx.registry"; -import * as _442 from "./fees/v1/tx.registry"; -import * as _443 from "./vesting/v1/tx.registry"; -import * as _444 from "./claims/v1/query.lcd"; -import * as _445 from "./epochs/v1/query.lcd"; -import * as _446 from "./erc20/v1/query.lcd"; -import * as _447 from "./fees/v1/query.lcd"; -import * as _448 from "./incentives/v1/query.lcd"; -import * as _449 from "./inflation/v1/query.lcd"; -import * as _450 from "./recovery/v1/query.lcd"; -import * as _451 from "./vesting/v1/query.lcd"; -import * as _452 from "./claims/v1/query.rpc.Query"; -import * as _453 from "./epochs/v1/query.rpc.Query"; -import * as _454 from "./erc20/v1/query.rpc.Query"; -import * as _455 from "./fees/v1/query.rpc.Query"; -import * as _456 from "./incentives/v1/query.rpc.Query"; -import * as _457 from "./inflation/v1/query.rpc.Query"; -import * as _458 from "./recovery/v1/query.rpc.Query"; -import * as _459 from "./vesting/v1/query.rpc.Query"; -import * as _460 from "./erc20/v1/tx.rpc.msg"; -import * as _461 from "./fees/v1/tx.rpc.msg"; -import * as _462 from "./vesting/v1/tx.rpc.msg"; -import * as _540 from "./lcd"; -import * as _541 from "./rpc.query"; -import * as _542 from "./rpc.tx"; +import * as _464 from "./erc20/v1/tx.amino"; +import * as _465 from "./fees/v1/tx.amino"; +import * as _466 from "./vesting/v1/tx.amino"; +import * as _467 from "./erc20/v1/tx.registry"; +import * as _468 from "./fees/v1/tx.registry"; +import * as _469 from "./vesting/v1/tx.registry"; +import * as _470 from "./claims/v1/query.rpc.func"; +import * as _471 from "./epochs/v1/query.rpc.func"; +import * as _472 from "./erc20/v1/query.rpc.func"; +import * as _473 from "./fees/v1/query.rpc.func"; +import * as _474 from "./incentives/v1/query.rpc.func"; +import * as _475 from "./inflation/v1/query.rpc.func"; +import * as _476 from "./recovery/v1/query.rpc.func"; +import * as _477 from "./vesting/v1/query.rpc.func"; +import * as _478 from "./claims/v1/query.rpc.Query"; +import * as _479 from "./epochs/v1/query.rpc.Query"; +import * as _480 from "./erc20/v1/query.rpc.Query"; +import * as _481 from "./fees/v1/query.rpc.Query"; +import * as _482 from "./incentives/v1/query.rpc.Query"; +import * as _483 from "./inflation/v1/query.rpc.Query"; +import * as _484 from "./recovery/v1/query.rpc.Query"; +import * as _485 from "./vesting/v1/query.rpc.Query"; +import * as _486 from "./erc20/v1/tx.rpc.func"; +import * as _487 from "./fees/v1/tx.rpc.func"; +import * as _488 from "./vesting/v1/tx.rpc.func"; +import * as _489 from "./erc20/v1/tx.rpc.msg"; +import * as _490 from "./fees/v1/tx.rpc.msg"; +import * as _491 from "./vesting/v1/tx.rpc.msg"; +import * as _579 from "./rpc.query"; +import * as _580 from "./rpc.tx"; export namespace evmos { export namespace claims { export const v1 = { ..._153, ..._154, ..._155, - ..._444, - ..._452 + ..._470, + ..._478 }; } export namespace epochs { export const v1 = { ..._156, ..._157, - ..._445, - ..._453 + ..._471, + ..._479 }; } export namespace erc20 { @@ -74,11 +76,12 @@ export namespace evmos { ..._159, ..._160, ..._161, - ..._438, - ..._441, - ..._446, - ..._454, - ..._460 + ..._464, + ..._467, + ..._472, + ..._480, + ..._486, + ..._489 }; } export namespace fees { @@ -87,11 +90,12 @@ export namespace evmos { ..._163, ..._164, ..._165, - ..._439, - ..._442, - ..._447, - ..._455, - ..._461 + ..._465, + ..._468, + ..._473, + ..._481, + ..._487, + ..._490 }; } export namespace incentives { @@ -99,8 +103,8 @@ export namespace evmos { ..._166, ..._167, ..._168, - ..._448, - ..._456 + ..._474, + ..._482 }; } export namespace inflation { @@ -108,16 +112,16 @@ export namespace evmos { ..._169, ..._170, ..._171, - ..._449, - ..._457 + ..._475, + ..._483 }; } export namespace recovery { export const v1 = { ..._172, ..._173, - ..._450, - ..._458 + ..._476, + ..._484 }; } export namespace vesting { @@ -125,16 +129,16 @@ export namespace evmos { ..._174, ..._175, ..._176, - ..._440, - ..._443, - ..._451, - ..._459, - ..._462 + ..._466, + ..._469, + ..._477, + ..._485, + ..._488, + ..._491 }; } export const ClientFactory = { - ..._540, - ..._541, - ..._542 + ..._579, + ..._580 }; } \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/evmos/claims/v1/claims.ts b/__fixtures__/v-next/outputv3/evmos/claims/v1/claims.ts index 2473e948ea..010942d3ea 100644 --- a/__fixtures__/v-next/outputv3/evmos/claims/v1/claims.ts +++ b/__fixtures__/v-next/outputv3/evmos/claims/v1/claims.ts @@ -1,5 +1,5 @@ -import { BinaryReader, BinaryWriter } from "../../../binary"; import { isSet, DeepPartial } from "../../../helpers"; +import { BinaryReader, BinaryWriter } from "../../../binary"; export const protobufPackage = "evmos.claims.v1"; /** Action defines the list of available actions to claim the airdrop tokens. */ export enum Action { @@ -235,6 +235,15 @@ function createBaseClaim(): Claim { */ export const Claim = { typeUrl: "/evmos.claims.v1.Claim", + is(o: any): o is Claim { + return o && (o.$typeUrl === Claim.typeUrl || isSet(o.action) && typeof o.completed === "boolean" && typeof o.claimableAmount === "string"); + }, + isSDK(o: any): o is ClaimSDKType { + return o && (o.$typeUrl === Claim.typeUrl || isSet(o.action) && typeof o.completed === "boolean" && typeof o.claimable_amount === "string"); + }, + isAmino(o: any): o is ClaimAmino { + return o && (o.$typeUrl === Claim.typeUrl || isSet(o.action) && typeof o.completed === "boolean" && typeof o.claimable_amount === "string"); + }, encode(message: Claim, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.action !== 0) { writer.uint32(8).int32(message.action); @@ -329,7 +338,8 @@ export const Claim = { typeUrl: "/evmos.claims.v1.Claim", value: Claim.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseClaimsRecordAddress(): ClaimsRecordAddress { return { @@ -346,6 +356,15 @@ function createBaseClaimsRecordAddress(): ClaimsRecordAddress { */ export const ClaimsRecordAddress = { typeUrl: "/evmos.claims.v1.ClaimsRecordAddress", + is(o: any): o is ClaimsRecordAddress { + return o && (o.$typeUrl === ClaimsRecordAddress.typeUrl || typeof o.address === "string" && typeof o.initialClaimableAmount === "string" && Array.isArray(o.actionsCompleted) && (!o.actionsCompleted.length || typeof o.actionsCompleted[0] === "boolean")); + }, + isSDK(o: any): o is ClaimsRecordAddressSDKType { + return o && (o.$typeUrl === ClaimsRecordAddress.typeUrl || typeof o.address === "string" && typeof o.initial_claimable_amount === "string" && Array.isArray(o.actions_completed) && (!o.actions_completed.length || typeof o.actions_completed[0] === "boolean")); + }, + isAmino(o: any): o is ClaimsRecordAddressAmino { + return o && (o.$typeUrl === ClaimsRecordAddress.typeUrl || typeof o.address === "string" && typeof o.initial_claimable_amount === "string" && Array.isArray(o.actions_completed) && (!o.actions_completed.length || typeof o.actions_completed[0] === "boolean")); + }, encode(message: ClaimsRecordAddress, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.address !== "") { writer.uint32(10).string(message.address); @@ -455,7 +474,8 @@ export const ClaimsRecordAddress = { typeUrl: "/evmos.claims.v1.ClaimsRecordAddress", value: ClaimsRecordAddress.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseClaimsRecord(): ClaimsRecord { return { @@ -472,6 +492,15 @@ function createBaseClaimsRecord(): ClaimsRecord { */ export const ClaimsRecord = { typeUrl: "/evmos.claims.v1.ClaimsRecord", + is(o: any): o is ClaimsRecord { + return o && (o.$typeUrl === ClaimsRecord.typeUrl || typeof o.initialClaimableAmount === "string" && Array.isArray(o.actionsCompleted) && (!o.actionsCompleted.length || typeof o.actionsCompleted[0] === "boolean")); + }, + isSDK(o: any): o is ClaimsRecordSDKType { + return o && (o.$typeUrl === ClaimsRecord.typeUrl || typeof o.initial_claimable_amount === "string" && Array.isArray(o.actions_completed) && (!o.actions_completed.length || typeof o.actions_completed[0] === "boolean")); + }, + isAmino(o: any): o is ClaimsRecordAmino { + return o && (o.$typeUrl === ClaimsRecord.typeUrl || typeof o.initial_claimable_amount === "string" && Array.isArray(o.actions_completed) && (!o.actions_completed.length || typeof o.actions_completed[0] === "boolean")); + }, encode(message: ClaimsRecord, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.initialClaimableAmount !== "") { writer.uint32(10).string(message.initialClaimableAmount); @@ -567,5 +596,6 @@ export const ClaimsRecord = { typeUrl: "/evmos.claims.v1.ClaimsRecord", value: ClaimsRecord.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/evmos/claims/v1/genesis.ts b/__fixtures__/v-next/outputv3/evmos/claims/v1/genesis.ts index 049dc22308..42bf48b7c5 100644 --- a/__fixtures__/v-next/outputv3/evmos/claims/v1/genesis.ts +++ b/__fixtures__/v-next/outputv3/evmos/claims/v1/genesis.ts @@ -2,6 +2,7 @@ import { ClaimsRecordAddress, ClaimsRecordAddressAmino, ClaimsRecordAddressSDKTy import { Timestamp, TimestampAmino, TimestampSDKType } from "../../../google/protobuf/timestamp"; import { Duration, DurationAmino, DurationSDKType } from "../../../google/protobuf/duration"; import { BinaryReader, BinaryWriter } from "../../../binary"; +import { GlobalDecoderRegistry } from "../../../registry"; import { isSet, DeepPartial, toTimestamp, fromTimestamp } from "../../../helpers"; export const protobufPackage = "evmos.claims.v1"; /** @@ -157,6 +158,15 @@ function createBaseGenesisState(): GenesisState { */ export const GenesisState = { typeUrl: "/evmos.claims.v1.GenesisState", + is(o: any): o is GenesisState { + return o && (o.$typeUrl === GenesisState.typeUrl || Params.is(o.params) && Array.isArray(o.claimsRecords) && (!o.claimsRecords.length || ClaimsRecordAddress.is(o.claimsRecords[0]))); + }, + isSDK(o: any): o is GenesisStateSDKType { + return o && (o.$typeUrl === GenesisState.typeUrl || Params.isSDK(o.params) && Array.isArray(o.claims_records) && (!o.claims_records.length || ClaimsRecordAddress.isSDK(o.claims_records[0]))); + }, + isAmino(o: any): o is GenesisStateAmino { + return o && (o.$typeUrl === GenesisState.typeUrl || Params.isAmino(o.params) && Array.isArray(o.claims_records) && (!o.claims_records.length || ClaimsRecordAddress.isAmino(o.claims_records[0]))); + }, encode(message: GenesisState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.params !== undefined) { Params.encode(message.params, writer.uint32(10).fork()).ldelim(); @@ -245,6 +255,13 @@ export const GenesisState = { typeUrl: "/evmos.claims.v1.GenesisState", value: GenesisState.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GenesisState.typeUrl)) { + return; + } + Params.registerTypeUrl(); + ClaimsRecordAddress.registerTypeUrl(); } }; function createBaseParams(): Params { @@ -266,6 +283,15 @@ function createBaseParams(): Params { */ export const Params = { typeUrl: "/evmos.claims.v1.Params", + is(o: any): o is Params { + return o && (o.$typeUrl === Params.typeUrl || typeof o.enableClaims === "boolean" && Timestamp.is(o.airdropStartTime) && Duration.is(o.durationUntilDecay) && Duration.is(o.durationOfDecay) && typeof o.claimsDenom === "string" && Array.isArray(o.authorizedChannels) && (!o.authorizedChannels.length || typeof o.authorizedChannels[0] === "string") && Array.isArray(o.evmChannels) && (!o.evmChannels.length || typeof o.evmChannels[0] === "string")); + }, + isSDK(o: any): o is ParamsSDKType { + return o && (o.$typeUrl === Params.typeUrl || typeof o.enable_claims === "boolean" && Timestamp.isSDK(o.airdrop_start_time) && Duration.isSDK(o.duration_until_decay) && Duration.isSDK(o.duration_of_decay) && typeof o.claims_denom === "string" && Array.isArray(o.authorized_channels) && (!o.authorized_channels.length || typeof o.authorized_channels[0] === "string") && Array.isArray(o.evm_channels) && (!o.evm_channels.length || typeof o.evm_channels[0] === "string")); + }, + isAmino(o: any): o is ParamsAmino { + return o && (o.$typeUrl === Params.typeUrl || typeof o.enable_claims === "boolean" && Timestamp.isAmino(o.airdrop_start_time) && Duration.isAmino(o.duration_until_decay) && Duration.isAmino(o.duration_of_decay) && typeof o.claims_denom === "string" && Array.isArray(o.authorized_channels) && (!o.authorized_channels.length || typeof o.authorized_channels[0] === "string") && Array.isArray(o.evm_channels) && (!o.evm_channels.length || typeof o.evm_channels[0] === "string")); + }, encode(message: Params, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.enableClaims === true) { writer.uint32(8).bool(message.enableClaims); @@ -432,5 +458,6 @@ export const Params = { typeUrl: "/evmos.claims.v1.Params", value: Params.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/evmos/claims/v1/query.rpc.func.ts b/__fixtures__/v-next/outputv3/evmos/claims/v1/query.rpc.func.ts new file mode 100644 index 0000000000..d7cc6943d6 --- /dev/null +++ b/__fixtures__/v-next/outputv3/evmos/claims/v1/query.rpc.func.ts @@ -0,0 +1,58 @@ +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination"; +import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; +import { Params, ParamsSDKType } from "./genesis"; +import { ClaimsRecordAddress, ClaimsRecordAddressSDKType, Claim, ClaimSDKType } from "./claims"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { QueryTotalUnclaimedRequest, QueryTotalUnclaimedRequestSDKType, QueryTotalUnclaimedResponse, QueryTotalUnclaimedResponseSDKType, QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, QueryClaimsRecordsRequest, QueryClaimsRecordsRequestSDKType, QueryClaimsRecordsResponse, QueryClaimsRecordsResponseSDKType, QueryClaimsRecordRequest, QueryClaimsRecordRequestSDKType, QueryClaimsRecordResponse, QueryClaimsRecordResponseSDKType } from "./query"; +/** + * TotalUnclaimed queries the total unclaimed tokens from the airdrop + * @name getTotalUnclaimed + * @package evmos.claims.v1 + * @see proto service: evmos.claims.v1.TotalUnclaimed + */ +export const getTotalUnclaimed = buildQuery({ + encode: QueryTotalUnclaimedRequest.encode, + decode: QueryTotalUnclaimedResponse.decode, + service: "evmos.claims.v1.Query", + method: "TotalUnclaimed", + deps: [QueryTotalUnclaimedRequest, QueryTotalUnclaimedResponse] +}); +/** + * Params returns the claims module parameters + * @name getParams + * @package evmos.claims.v1 + * @see proto service: evmos.claims.v1.Params + */ +export const getParams = buildQuery({ + encode: QueryParamsRequest.encode, + decode: QueryParamsResponse.decode, + service: "evmos.claims.v1.Query", + method: "Params", + deps: [QueryParamsRequest, QueryParamsResponse] +}); +/** + * ClaimsRecords returns all claims records + * @name getClaimsRecords + * @package evmos.claims.v1 + * @see proto service: evmos.claims.v1.ClaimsRecords + */ +export const getClaimsRecords = buildQuery({ + encode: QueryClaimsRecordsRequest.encode, + decode: QueryClaimsRecordsResponse.decode, + service: "evmos.claims.v1.Query", + method: "ClaimsRecords", + deps: [QueryClaimsRecordsRequest, QueryClaimsRecordsResponse] +}); +/** + * ClaimsRecord returns the claims record for a given address + * @name getClaimsRecord + * @package evmos.claims.v1 + * @see proto service: evmos.claims.v1.ClaimsRecord + */ +export const getClaimsRecord = buildQuery({ + encode: QueryClaimsRecordRequest.encode, + decode: QueryClaimsRecordResponse.decode, + service: "evmos.claims.v1.Query", + method: "ClaimsRecord", + deps: [QueryClaimsRecordRequest, QueryClaimsRecordResponse] +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/evmos/claims/v1/query.ts b/__fixtures__/v-next/outputv3/evmos/claims/v1/query.ts index a766ca2a77..6e3ca71d5e 100644 --- a/__fixtures__/v-next/outputv3/evmos/claims/v1/query.ts +++ b/__fixtures__/v-next/outputv3/evmos/claims/v1/query.ts @@ -4,6 +4,7 @@ import { Params, ParamsAmino, ParamsSDKType } from "./genesis"; import { ClaimsRecordAddress, ClaimsRecordAddressAmino, ClaimsRecordAddressSDKType, Claim, ClaimAmino, ClaimSDKType } from "./claims"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { DeepPartial, isSet } from "../../../helpers"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "evmos.claims.v1"; /** * QueryTotalUnclaimedRequest is the request type for the Query/TotalUnclaimed @@ -325,6 +326,15 @@ function createBaseQueryTotalUnclaimedRequest(): QueryTotalUnclaimedRequest { */ export const QueryTotalUnclaimedRequest = { typeUrl: "/evmos.claims.v1.QueryTotalUnclaimedRequest", + is(o: any): o is QueryTotalUnclaimedRequest { + return o && o.$typeUrl === QueryTotalUnclaimedRequest.typeUrl; + }, + isSDK(o: any): o is QueryTotalUnclaimedRequestSDKType { + return o && o.$typeUrl === QueryTotalUnclaimedRequest.typeUrl; + }, + isAmino(o: any): o is QueryTotalUnclaimedRequestAmino { + return o && o.$typeUrl === QueryTotalUnclaimedRequest.typeUrl; + }, encode(_: QueryTotalUnclaimedRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -376,7 +386,8 @@ export const QueryTotalUnclaimedRequest = { typeUrl: "/evmos.claims.v1.QueryTotalUnclaimedRequest", value: QueryTotalUnclaimedRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryTotalUnclaimedResponse(): QueryTotalUnclaimedResponse { return { @@ -392,6 +403,15 @@ function createBaseQueryTotalUnclaimedResponse(): QueryTotalUnclaimedResponse { */ export const QueryTotalUnclaimedResponse = { typeUrl: "/evmos.claims.v1.QueryTotalUnclaimedResponse", + is(o: any): o is QueryTotalUnclaimedResponse { + return o && (o.$typeUrl === QueryTotalUnclaimedResponse.typeUrl || Array.isArray(o.coins) && (!o.coins.length || Coin.is(o.coins[0]))); + }, + isSDK(o: any): o is QueryTotalUnclaimedResponseSDKType { + return o && (o.$typeUrl === QueryTotalUnclaimedResponse.typeUrl || Array.isArray(o.coins) && (!o.coins.length || Coin.isSDK(o.coins[0]))); + }, + isAmino(o: any): o is QueryTotalUnclaimedResponseAmino { + return o && (o.$typeUrl === QueryTotalUnclaimedResponse.typeUrl || Array.isArray(o.coins) && (!o.coins.length || Coin.isAmino(o.coins[0]))); + }, encode(message: QueryTotalUnclaimedResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.coins) { Coin.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -464,6 +484,12 @@ export const QueryTotalUnclaimedResponse = { typeUrl: "/evmos.claims.v1.QueryTotalUnclaimedResponse", value: QueryTotalUnclaimedResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryTotalUnclaimedResponse.typeUrl)) { + return; + } + Coin.registerTypeUrl(); } }; function createBaseQueryParamsRequest(): QueryParamsRequest { @@ -477,6 +503,15 @@ function createBaseQueryParamsRequest(): QueryParamsRequest { */ export const QueryParamsRequest = { typeUrl: "/evmos.claims.v1.QueryParamsRequest", + is(o: any): o is QueryParamsRequest { + return o && o.$typeUrl === QueryParamsRequest.typeUrl; + }, + isSDK(o: any): o is QueryParamsRequestSDKType { + return o && o.$typeUrl === QueryParamsRequest.typeUrl; + }, + isAmino(o: any): o is QueryParamsRequestAmino { + return o && o.$typeUrl === QueryParamsRequest.typeUrl; + }, encode(_: QueryParamsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -528,7 +563,8 @@ export const QueryParamsRequest = { typeUrl: "/evmos.claims.v1.QueryParamsRequest", value: QueryParamsRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryParamsResponse(): QueryParamsResponse { return { @@ -543,6 +579,15 @@ function createBaseQueryParamsResponse(): QueryParamsResponse { */ export const QueryParamsResponse = { typeUrl: "/evmos.claims.v1.QueryParamsResponse", + is(o: any): o is QueryParamsResponse { + return o && (o.$typeUrl === QueryParamsResponse.typeUrl || Params.is(o.params)); + }, + isSDK(o: any): o is QueryParamsResponseSDKType { + return o && (o.$typeUrl === QueryParamsResponse.typeUrl || Params.isSDK(o.params)); + }, + isAmino(o: any): o is QueryParamsResponseAmino { + return o && (o.$typeUrl === QueryParamsResponse.typeUrl || Params.isAmino(o.params)); + }, encode(message: QueryParamsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.params !== undefined) { Params.encode(message.params, writer.uint32(10).fork()).ldelim(); @@ -611,6 +656,12 @@ export const QueryParamsResponse = { typeUrl: "/evmos.claims.v1.QueryParamsResponse", value: QueryParamsResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryParamsResponse.typeUrl)) { + return; + } + Params.registerTypeUrl(); } }; function createBaseQueryClaimsRecordsRequest(): QueryClaimsRecordsRequest { @@ -627,6 +678,15 @@ function createBaseQueryClaimsRecordsRequest(): QueryClaimsRecordsRequest { */ export const QueryClaimsRecordsRequest = { typeUrl: "/evmos.claims.v1.QueryClaimsRecordsRequest", + is(o: any): o is QueryClaimsRecordsRequest { + return o && o.$typeUrl === QueryClaimsRecordsRequest.typeUrl; + }, + isSDK(o: any): o is QueryClaimsRecordsRequestSDKType { + return o && o.$typeUrl === QueryClaimsRecordsRequest.typeUrl; + }, + isAmino(o: any): o is QueryClaimsRecordsRequestAmino { + return o && o.$typeUrl === QueryClaimsRecordsRequest.typeUrl; + }, encode(message: QueryClaimsRecordsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.pagination !== undefined) { PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); @@ -695,6 +755,12 @@ export const QueryClaimsRecordsRequest = { typeUrl: "/evmos.claims.v1.QueryClaimsRecordsRequest", value: QueryClaimsRecordsRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryClaimsRecordsRequest.typeUrl)) { + return; + } + PageRequest.registerTypeUrl(); } }; function createBaseQueryClaimsRecordsResponse(): QueryClaimsRecordsResponse { @@ -712,6 +778,15 @@ function createBaseQueryClaimsRecordsResponse(): QueryClaimsRecordsResponse { */ export const QueryClaimsRecordsResponse = { typeUrl: "/evmos.claims.v1.QueryClaimsRecordsResponse", + is(o: any): o is QueryClaimsRecordsResponse { + return o && (o.$typeUrl === QueryClaimsRecordsResponse.typeUrl || Array.isArray(o.claims) && (!o.claims.length || ClaimsRecordAddress.is(o.claims[0]))); + }, + isSDK(o: any): o is QueryClaimsRecordsResponseSDKType { + return o && (o.$typeUrl === QueryClaimsRecordsResponse.typeUrl || Array.isArray(o.claims) && (!o.claims.length || ClaimsRecordAddress.isSDK(o.claims[0]))); + }, + isAmino(o: any): o is QueryClaimsRecordsResponseAmino { + return o && (o.$typeUrl === QueryClaimsRecordsResponse.typeUrl || Array.isArray(o.claims) && (!o.claims.length || ClaimsRecordAddress.isAmino(o.claims[0]))); + }, encode(message: QueryClaimsRecordsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.claims) { ClaimsRecordAddress.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -800,6 +875,13 @@ export const QueryClaimsRecordsResponse = { typeUrl: "/evmos.claims.v1.QueryClaimsRecordsResponse", value: QueryClaimsRecordsResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryClaimsRecordsResponse.typeUrl)) { + return; + } + ClaimsRecordAddress.registerTypeUrl(); + PageResponse.registerTypeUrl(); } }; function createBaseQueryClaimsRecordRequest(): QueryClaimsRecordRequest { @@ -816,6 +898,15 @@ function createBaseQueryClaimsRecordRequest(): QueryClaimsRecordRequest { */ export const QueryClaimsRecordRequest = { typeUrl: "/evmos.claims.v1.QueryClaimsRecordRequest", + is(o: any): o is QueryClaimsRecordRequest { + return o && (o.$typeUrl === QueryClaimsRecordRequest.typeUrl || typeof o.address === "string"); + }, + isSDK(o: any): o is QueryClaimsRecordRequestSDKType { + return o && (o.$typeUrl === QueryClaimsRecordRequest.typeUrl || typeof o.address === "string"); + }, + isAmino(o: any): o is QueryClaimsRecordRequestAmino { + return o && (o.$typeUrl === QueryClaimsRecordRequest.typeUrl || typeof o.address === "string"); + }, encode(message: QueryClaimsRecordRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.address !== "") { writer.uint32(10).string(message.address); @@ -882,7 +973,8 @@ export const QueryClaimsRecordRequest = { typeUrl: "/evmos.claims.v1.QueryClaimsRecordRequest", value: QueryClaimsRecordRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryClaimsRecordResponse(): QueryClaimsRecordResponse { return { @@ -899,6 +991,15 @@ function createBaseQueryClaimsRecordResponse(): QueryClaimsRecordResponse { */ export const QueryClaimsRecordResponse = { typeUrl: "/evmos.claims.v1.QueryClaimsRecordResponse", + is(o: any): o is QueryClaimsRecordResponse { + return o && (o.$typeUrl === QueryClaimsRecordResponse.typeUrl || typeof o.initialClaimableAmount === "string" && Array.isArray(o.claims) && (!o.claims.length || Claim.is(o.claims[0]))); + }, + isSDK(o: any): o is QueryClaimsRecordResponseSDKType { + return o && (o.$typeUrl === QueryClaimsRecordResponse.typeUrl || typeof o.initial_claimable_amount === "string" && Array.isArray(o.claims) && (!o.claims.length || Claim.isSDK(o.claims[0]))); + }, + isAmino(o: any): o is QueryClaimsRecordResponseAmino { + return o && (o.$typeUrl === QueryClaimsRecordResponse.typeUrl || typeof o.initial_claimable_amount === "string" && Array.isArray(o.claims) && (!o.claims.length || Claim.isAmino(o.claims[0]))); + }, encode(message: QueryClaimsRecordResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.initialClaimableAmount !== "") { writer.uint32(10).string(message.initialClaimableAmount); @@ -985,5 +1086,11 @@ export const QueryClaimsRecordResponse = { typeUrl: "/evmos.claims.v1.QueryClaimsRecordResponse", value: QueryClaimsRecordResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryClaimsRecordResponse.typeUrl)) { + return; + } + Claim.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/evmos/epochs/v1/genesis.ts b/__fixtures__/v-next/outputv3/evmos/epochs/v1/genesis.ts index 772ebd6dda..cb12d7398a 100644 --- a/__fixtures__/v-next/outputv3/evmos/epochs/v1/genesis.ts +++ b/__fixtures__/v-next/outputv3/evmos/epochs/v1/genesis.ts @@ -2,6 +2,7 @@ import { Timestamp, TimestampAmino, TimestampSDKType } from "../../../google/pro import { Duration, DurationAmino, DurationSDKType } from "../../../google/protobuf/duration"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { toTimestamp, fromTimestamp, isSet, DeepPartial } from "../../../helpers"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "evmos.epochs.v1"; /** * @name EpochInfo @@ -98,6 +99,15 @@ function createBaseEpochInfo(): EpochInfo { */ export const EpochInfo = { typeUrl: "/evmos.epochs.v1.EpochInfo", + is(o: any): o is EpochInfo { + return o && (o.$typeUrl === EpochInfo.typeUrl || typeof o.identifier === "string" && Timestamp.is(o.startTime) && Duration.is(o.duration) && typeof o.currentEpoch === "bigint" && Timestamp.is(o.currentEpochStartTime) && typeof o.epochCountingStarted === "boolean" && typeof o.currentEpochStartHeight === "bigint"); + }, + isSDK(o: any): o is EpochInfoSDKType { + return o && (o.$typeUrl === EpochInfo.typeUrl || typeof o.identifier === "string" && Timestamp.isSDK(o.start_time) && Duration.isSDK(o.duration) && typeof o.current_epoch === "bigint" && Timestamp.isSDK(o.current_epoch_start_time) && typeof o.epoch_counting_started === "boolean" && typeof o.current_epoch_start_height === "bigint"); + }, + isAmino(o: any): o is EpochInfoAmino { + return o && (o.$typeUrl === EpochInfo.typeUrl || typeof o.identifier === "string" && Timestamp.isAmino(o.start_time) && Duration.isAmino(o.duration) && typeof o.current_epoch === "bigint" && Timestamp.isAmino(o.current_epoch_start_time) && typeof o.epoch_counting_started === "boolean" && typeof o.current_epoch_start_height === "bigint"); + }, encode(message: EpochInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.identifier !== "") { writer.uint32(10).string(message.identifier); @@ -254,7 +264,8 @@ export const EpochInfo = { typeUrl: "/evmos.epochs.v1.EpochInfo", value: EpochInfo.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseGenesisState(): GenesisState { return { @@ -269,6 +280,15 @@ function createBaseGenesisState(): GenesisState { */ export const GenesisState = { typeUrl: "/evmos.epochs.v1.GenesisState", + is(o: any): o is GenesisState { + return o && (o.$typeUrl === GenesisState.typeUrl || Array.isArray(o.epochs) && (!o.epochs.length || EpochInfo.is(o.epochs[0]))); + }, + isSDK(o: any): o is GenesisStateSDKType { + return o && (o.$typeUrl === GenesisState.typeUrl || Array.isArray(o.epochs) && (!o.epochs.length || EpochInfo.isSDK(o.epochs[0]))); + }, + isAmino(o: any): o is GenesisStateAmino { + return o && (o.$typeUrl === GenesisState.typeUrl || Array.isArray(o.epochs) && (!o.epochs.length || EpochInfo.isAmino(o.epochs[0]))); + }, encode(message: GenesisState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.epochs) { EpochInfo.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -341,5 +361,11 @@ export const GenesisState = { typeUrl: "/evmos.epochs.v1.GenesisState", value: GenesisState.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GenesisState.typeUrl)) { + return; + } + EpochInfo.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/evmos/epochs/v1/query.rpc.func.ts b/__fixtures__/v-next/outputv3/evmos/epochs/v1/query.rpc.func.ts new file mode 100644 index 0000000000..536aadbc56 --- /dev/null +++ b/__fixtures__/v-next/outputv3/evmos/epochs/v1/query.rpc.func.ts @@ -0,0 +1,30 @@ +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination"; +import { EpochInfo, EpochInfoSDKType } from "./genesis"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { QueryEpochsInfoRequest, QueryEpochsInfoRequestSDKType, QueryEpochsInfoResponse, QueryEpochsInfoResponseSDKType, QueryCurrentEpochRequest, QueryCurrentEpochRequestSDKType, QueryCurrentEpochResponse, QueryCurrentEpochResponseSDKType } from "./query"; +/** + * EpochInfos provide running epochInfos + * @name getEpochInfos + * @package evmos.epochs.v1 + * @see proto service: evmos.epochs.v1.EpochInfos + */ +export const getEpochInfos = buildQuery({ + encode: QueryEpochsInfoRequest.encode, + decode: QueryEpochsInfoResponse.decode, + service: "evmos.epochs.v1.Query", + method: "EpochInfos", + deps: [QueryEpochsInfoRequest, QueryEpochsInfoResponse] +}); +/** + * CurrentEpoch provide current epoch of specified identifier + * @name getCurrentEpoch + * @package evmos.epochs.v1 + * @see proto service: evmos.epochs.v1.CurrentEpoch + */ +export const getCurrentEpoch = buildQuery({ + encode: QueryCurrentEpochRequest.encode, + decode: QueryCurrentEpochResponse.decode, + service: "evmos.epochs.v1.Query", + method: "CurrentEpoch", + deps: [QueryCurrentEpochRequest, QueryCurrentEpochResponse] +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/evmos/epochs/v1/query.ts b/__fixtures__/v-next/outputv3/evmos/epochs/v1/query.ts index 2e2b6202a9..a5a6b93dbe 100644 --- a/__fixtures__/v-next/outputv3/evmos/epochs/v1/query.ts +++ b/__fixtures__/v-next/outputv3/evmos/epochs/v1/query.ts @@ -1,6 +1,7 @@ import { PageRequest, PageRequestAmino, PageRequestSDKType, PageResponse, PageResponseAmino, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination"; import { EpochInfo, EpochInfoAmino, EpochInfoSDKType } from "./genesis"; import { BinaryReader, BinaryWriter } from "../../../binary"; +import { GlobalDecoderRegistry } from "../../../registry"; import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "evmos.epochs.v1"; /** @@ -130,6 +131,15 @@ function createBaseQueryEpochsInfoRequest(): QueryEpochsInfoRequest { */ export const QueryEpochsInfoRequest = { typeUrl: "/evmos.epochs.v1.QueryEpochsInfoRequest", + is(o: any): o is QueryEpochsInfoRequest { + return o && o.$typeUrl === QueryEpochsInfoRequest.typeUrl; + }, + isSDK(o: any): o is QueryEpochsInfoRequestSDKType { + return o && o.$typeUrl === QueryEpochsInfoRequest.typeUrl; + }, + isAmino(o: any): o is QueryEpochsInfoRequestAmino { + return o && o.$typeUrl === QueryEpochsInfoRequest.typeUrl; + }, encode(message: QueryEpochsInfoRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.pagination !== undefined) { PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); @@ -198,6 +208,12 @@ export const QueryEpochsInfoRequest = { typeUrl: "/evmos.epochs.v1.QueryEpochsInfoRequest", value: QueryEpochsInfoRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryEpochsInfoRequest.typeUrl)) { + return; + } + PageRequest.registerTypeUrl(); } }; function createBaseQueryEpochsInfoResponse(): QueryEpochsInfoResponse { @@ -213,6 +229,15 @@ function createBaseQueryEpochsInfoResponse(): QueryEpochsInfoResponse { */ export const QueryEpochsInfoResponse = { typeUrl: "/evmos.epochs.v1.QueryEpochsInfoResponse", + is(o: any): o is QueryEpochsInfoResponse { + return o && (o.$typeUrl === QueryEpochsInfoResponse.typeUrl || Array.isArray(o.epochs) && (!o.epochs.length || EpochInfo.is(o.epochs[0]))); + }, + isSDK(o: any): o is QueryEpochsInfoResponseSDKType { + return o && (o.$typeUrl === QueryEpochsInfoResponse.typeUrl || Array.isArray(o.epochs) && (!o.epochs.length || EpochInfo.isSDK(o.epochs[0]))); + }, + isAmino(o: any): o is QueryEpochsInfoResponseAmino { + return o && (o.$typeUrl === QueryEpochsInfoResponse.typeUrl || Array.isArray(o.epochs) && (!o.epochs.length || EpochInfo.isAmino(o.epochs[0]))); + }, encode(message: QueryEpochsInfoResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.epochs) { EpochInfo.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -301,6 +326,13 @@ export const QueryEpochsInfoResponse = { typeUrl: "/evmos.epochs.v1.QueryEpochsInfoResponse", value: QueryEpochsInfoResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryEpochsInfoResponse.typeUrl)) { + return; + } + EpochInfo.registerTypeUrl(); + PageResponse.registerTypeUrl(); } }; function createBaseQueryCurrentEpochRequest(): QueryCurrentEpochRequest { @@ -315,6 +347,15 @@ function createBaseQueryCurrentEpochRequest(): QueryCurrentEpochRequest { */ export const QueryCurrentEpochRequest = { typeUrl: "/evmos.epochs.v1.QueryCurrentEpochRequest", + is(o: any): o is QueryCurrentEpochRequest { + return o && (o.$typeUrl === QueryCurrentEpochRequest.typeUrl || typeof o.identifier === "string"); + }, + isSDK(o: any): o is QueryCurrentEpochRequestSDKType { + return o && (o.$typeUrl === QueryCurrentEpochRequest.typeUrl || typeof o.identifier === "string"); + }, + isAmino(o: any): o is QueryCurrentEpochRequestAmino { + return o && (o.$typeUrl === QueryCurrentEpochRequest.typeUrl || typeof o.identifier === "string"); + }, encode(message: QueryCurrentEpochRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.identifier !== "") { writer.uint32(10).string(message.identifier); @@ -381,7 +422,8 @@ export const QueryCurrentEpochRequest = { typeUrl: "/evmos.epochs.v1.QueryCurrentEpochRequest", value: QueryCurrentEpochRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryCurrentEpochResponse(): QueryCurrentEpochResponse { return { @@ -395,6 +437,15 @@ function createBaseQueryCurrentEpochResponse(): QueryCurrentEpochResponse { */ export const QueryCurrentEpochResponse = { typeUrl: "/evmos.epochs.v1.QueryCurrentEpochResponse", + is(o: any): o is QueryCurrentEpochResponse { + return o && (o.$typeUrl === QueryCurrentEpochResponse.typeUrl || typeof o.currentEpoch === "bigint"); + }, + isSDK(o: any): o is QueryCurrentEpochResponseSDKType { + return o && (o.$typeUrl === QueryCurrentEpochResponse.typeUrl || typeof o.current_epoch === "bigint"); + }, + isAmino(o: any): o is QueryCurrentEpochResponseAmino { + return o && (o.$typeUrl === QueryCurrentEpochResponse.typeUrl || typeof o.current_epoch === "bigint"); + }, encode(message: QueryCurrentEpochResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.currentEpoch !== BigInt(0)) { writer.uint32(8).int64(message.currentEpoch); @@ -463,5 +514,6 @@ export const QueryCurrentEpochResponse = { typeUrl: "/evmos.epochs.v1.QueryCurrentEpochResponse", value: QueryCurrentEpochResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/evmos/erc20/v1/erc20.ts b/__fixtures__/v-next/outputv3/evmos/erc20/v1/erc20.ts index d882db75a3..59cb77913a 100644 --- a/__fixtures__/v-next/outputv3/evmos/erc20/v1/erc20.ts +++ b/__fixtures__/v-next/outputv3/evmos/erc20/v1/erc20.ts @@ -1,6 +1,7 @@ import { Metadata, MetadataAmino, MetadataSDKType } from "../../../cosmos/bank/v1beta1/bank"; -import { BinaryReader, BinaryWriter } from "../../../binary"; import { isSet, DeepPartial } from "../../../helpers"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "evmos.erc20.v1"; /** Owner enumerates the ownership of a ERC20 contract. */ export enum Owner { @@ -304,6 +305,15 @@ function createBaseTokenPair(): TokenPair { */ export const TokenPair = { typeUrl: "/evmos.erc20.v1.TokenPair", + is(o: any): o is TokenPair { + return o && (o.$typeUrl === TokenPair.typeUrl || typeof o.erc20Address === "string" && typeof o.denom === "string" && typeof o.enabled === "boolean" && isSet(o.contractOwner)); + }, + isSDK(o: any): o is TokenPairSDKType { + return o && (o.$typeUrl === TokenPair.typeUrl || typeof o.erc20_address === "string" && typeof o.denom === "string" && typeof o.enabled === "boolean" && isSet(o.contract_owner)); + }, + isAmino(o: any): o is TokenPairAmino { + return o && (o.$typeUrl === TokenPair.typeUrl || typeof o.erc20_address === "string" && typeof o.denom === "string" && typeof o.enabled === "boolean" && isSet(o.contract_owner)); + }, encode(message: TokenPair, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.erc20Address !== "") { writer.uint32(10).string(message.erc20Address); @@ -412,7 +422,8 @@ export const TokenPair = { typeUrl: "/evmos.erc20.v1.TokenPair", value: TokenPair.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseRegisterCoinProposal(): RegisterCoinProposal { return { @@ -430,6 +441,15 @@ function createBaseRegisterCoinProposal(): RegisterCoinProposal { */ export const RegisterCoinProposal = { typeUrl: "/evmos.erc20.v1.RegisterCoinProposal", + is(o: any): o is RegisterCoinProposal { + return o && (o.$typeUrl === RegisterCoinProposal.typeUrl || typeof o.title === "string" && typeof o.description === "string" && Metadata.is(o.metadata)); + }, + isSDK(o: any): o is RegisterCoinProposalSDKType { + return o && (o.$typeUrl === RegisterCoinProposal.typeUrl || typeof o.title === "string" && typeof o.description === "string" && Metadata.isSDK(o.metadata)); + }, + isAmino(o: any): o is RegisterCoinProposalAmino { + return o && (o.$typeUrl === RegisterCoinProposal.typeUrl || typeof o.title === "string" && typeof o.description === "string" && Metadata.isAmino(o.metadata)); + }, encode(message: RegisterCoinProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.title !== "") { writer.uint32(10).string(message.title); @@ -526,6 +546,12 @@ export const RegisterCoinProposal = { typeUrl: "/evmos.erc20.v1.RegisterCoinProposal", value: RegisterCoinProposal.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(RegisterCoinProposal.typeUrl)) { + return; + } + Metadata.registerTypeUrl(); } }; function createBaseRegisterERC20Proposal(): RegisterERC20Proposal { @@ -544,6 +570,15 @@ function createBaseRegisterERC20Proposal(): RegisterERC20Proposal { */ export const RegisterERC20Proposal = { typeUrl: "/evmos.erc20.v1.RegisterERC20Proposal", + is(o: any): o is RegisterERC20Proposal { + return o && (o.$typeUrl === RegisterERC20Proposal.typeUrl || typeof o.title === "string" && typeof o.description === "string" && typeof o.erc20address === "string"); + }, + isSDK(o: any): o is RegisterERC20ProposalSDKType { + return o && (o.$typeUrl === RegisterERC20Proposal.typeUrl || typeof o.title === "string" && typeof o.description === "string" && typeof o.erc20address === "string"); + }, + isAmino(o: any): o is RegisterERC20ProposalAmino { + return o && (o.$typeUrl === RegisterERC20Proposal.typeUrl || typeof o.title === "string" && typeof o.description === "string" && typeof o.erc20address === "string"); + }, encode(message: RegisterERC20Proposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.title !== "") { writer.uint32(10).string(message.title); @@ -638,7 +673,8 @@ export const RegisterERC20Proposal = { typeUrl: "/evmos.erc20.v1.RegisterERC20Proposal", value: RegisterERC20Proposal.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseToggleTokenConversionProposal(): ToggleTokenConversionProposal { return { @@ -656,6 +692,15 @@ function createBaseToggleTokenConversionProposal(): ToggleTokenConversionProposa */ export const ToggleTokenConversionProposal = { typeUrl: "/evmos.erc20.v1.ToggleTokenConversionProposal", + is(o: any): o is ToggleTokenConversionProposal { + return o && (o.$typeUrl === ToggleTokenConversionProposal.typeUrl || typeof o.title === "string" && typeof o.description === "string" && typeof o.token === "string"); + }, + isSDK(o: any): o is ToggleTokenConversionProposalSDKType { + return o && (o.$typeUrl === ToggleTokenConversionProposal.typeUrl || typeof o.title === "string" && typeof o.description === "string" && typeof o.token === "string"); + }, + isAmino(o: any): o is ToggleTokenConversionProposalAmino { + return o && (o.$typeUrl === ToggleTokenConversionProposal.typeUrl || typeof o.title === "string" && typeof o.description === "string" && typeof o.token === "string"); + }, encode(message: ToggleTokenConversionProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.title !== "") { writer.uint32(10).string(message.title); @@ -750,5 +795,6 @@ export const ToggleTokenConversionProposal = { typeUrl: "/evmos.erc20.v1.ToggleTokenConversionProposal", value: ToggleTokenConversionProposal.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/evmos/erc20/v1/genesis.ts b/__fixtures__/v-next/outputv3/evmos/erc20/v1/genesis.ts index 3555c12ddb..df35d770cf 100644 --- a/__fixtures__/v-next/outputv3/evmos/erc20/v1/genesis.ts +++ b/__fixtures__/v-next/outputv3/evmos/erc20/v1/genesis.ts @@ -1,5 +1,6 @@ import { TokenPair, TokenPairAmino, TokenPairSDKType } from "./erc20"; import { BinaryReader, BinaryWriter } from "../../../binary"; +import { GlobalDecoderRegistry } from "../../../registry"; import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "evmos.erc20.v1"; /** @@ -112,6 +113,15 @@ function createBaseGenesisState(): GenesisState { */ export const GenesisState = { typeUrl: "/evmos.erc20.v1.GenesisState", + is(o: any): o is GenesisState { + return o && (o.$typeUrl === GenesisState.typeUrl || Params.is(o.params) && Array.isArray(o.tokenPairs) && (!o.tokenPairs.length || TokenPair.is(o.tokenPairs[0]))); + }, + isSDK(o: any): o is GenesisStateSDKType { + return o && (o.$typeUrl === GenesisState.typeUrl || Params.isSDK(o.params) && Array.isArray(o.token_pairs) && (!o.token_pairs.length || TokenPair.isSDK(o.token_pairs[0]))); + }, + isAmino(o: any): o is GenesisStateAmino { + return o && (o.$typeUrl === GenesisState.typeUrl || Params.isAmino(o.params) && Array.isArray(o.token_pairs) && (!o.token_pairs.length || TokenPair.isAmino(o.token_pairs[0]))); + }, encode(message: GenesisState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.params !== undefined) { Params.encode(message.params, writer.uint32(10).fork()).ldelim(); @@ -200,6 +210,13 @@ export const GenesisState = { typeUrl: "/evmos.erc20.v1.GenesisState", value: GenesisState.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GenesisState.typeUrl)) { + return; + } + Params.registerTypeUrl(); + TokenPair.registerTypeUrl(); } }; function createBaseParams(): Params { @@ -216,6 +233,15 @@ function createBaseParams(): Params { */ export const Params = { typeUrl: "/evmos.erc20.v1.Params", + is(o: any): o is Params { + return o && (o.$typeUrl === Params.typeUrl || typeof o.enableErc20 === "boolean" && typeof o.enableEvmHook === "boolean"); + }, + isSDK(o: any): o is ParamsSDKType { + return o && (o.$typeUrl === Params.typeUrl || typeof o.enable_erc20 === "boolean" && typeof o.enable_evm_hook === "boolean"); + }, + isAmino(o: any): o is ParamsAmino { + return o && (o.$typeUrl === Params.typeUrl || typeof o.enable_erc20 === "boolean" && typeof o.enable_evm_hook === "boolean"); + }, encode(message: Params, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.enableErc20 === true) { writer.uint32(8).bool(message.enableErc20); @@ -296,5 +322,6 @@ export const Params = { typeUrl: "/evmos.erc20.v1.Params", value: Params.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/evmos/erc20/v1/query.rpc.func.ts b/__fixtures__/v-next/outputv3/evmos/erc20/v1/query.rpc.func.ts new file mode 100644 index 0000000000..9d2bacdaa6 --- /dev/null +++ b/__fixtures__/v-next/outputv3/evmos/erc20/v1/query.rpc.func.ts @@ -0,0 +1,44 @@ +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination"; +import { TokenPair, TokenPairSDKType } from "./erc20"; +import { Params, ParamsSDKType } from "./genesis"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { QueryTokenPairsRequest, QueryTokenPairsRequestSDKType, QueryTokenPairsResponse, QueryTokenPairsResponseSDKType, QueryTokenPairRequest, QueryTokenPairRequestSDKType, QueryTokenPairResponse, QueryTokenPairResponseSDKType, QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType } from "./query"; +/** + * TokenPairs retrieves registered token pairs + * @name getTokenPairs + * @package evmos.erc20.v1 + * @see proto service: evmos.erc20.v1.TokenPairs + */ +export const getTokenPairs = buildQuery({ + encode: QueryTokenPairsRequest.encode, + decode: QueryTokenPairsResponse.decode, + service: "evmos.erc20.v1.Query", + method: "TokenPairs", + deps: [QueryTokenPairsRequest, QueryTokenPairsResponse] +}); +/** + * TokenPair retrieves a registered token pair + * @name getTokenPair + * @package evmos.erc20.v1 + * @see proto service: evmos.erc20.v1.TokenPair + */ +export const getTokenPair = buildQuery({ + encode: QueryTokenPairRequest.encode, + decode: QueryTokenPairResponse.decode, + service: "evmos.erc20.v1.Query", + method: "TokenPair", + deps: [QueryTokenPairRequest, QueryTokenPairResponse] +}); +/** + * Params retrieves the erc20 module params + * @name getParams + * @package evmos.erc20.v1 + * @see proto service: evmos.erc20.v1.Params + */ +export const getParams = buildQuery({ + encode: QueryParamsRequest.encode, + decode: QueryParamsResponse.decode, + service: "evmos.erc20.v1.Query", + method: "Params", + deps: [QueryParamsRequest, QueryParamsResponse] +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/evmos/erc20/v1/query.ts b/__fixtures__/v-next/outputv3/evmos/erc20/v1/query.ts index e54cf434f3..d92207bc30 100644 --- a/__fixtures__/v-next/outputv3/evmos/erc20/v1/query.ts +++ b/__fixtures__/v-next/outputv3/evmos/erc20/v1/query.ts @@ -2,6 +2,7 @@ import { PageRequest, PageRequestAmino, PageRequestSDKType, PageResponse, PageRe import { TokenPair, TokenPairAmino, TokenPairSDKType } from "./erc20"; import { Params, ParamsAmino, ParamsSDKType } from "./genesis"; import { BinaryReader, BinaryWriter } from "../../../binary"; +import { GlobalDecoderRegistry } from "../../../registry"; import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "evmos.erc20.v1"; /** @@ -233,6 +234,15 @@ function createBaseQueryTokenPairsRequest(): QueryTokenPairsRequest { */ export const QueryTokenPairsRequest = { typeUrl: "/evmos.erc20.v1.QueryTokenPairsRequest", + is(o: any): o is QueryTokenPairsRequest { + return o && o.$typeUrl === QueryTokenPairsRequest.typeUrl; + }, + isSDK(o: any): o is QueryTokenPairsRequestSDKType { + return o && o.$typeUrl === QueryTokenPairsRequest.typeUrl; + }, + isAmino(o: any): o is QueryTokenPairsRequestAmino { + return o && o.$typeUrl === QueryTokenPairsRequest.typeUrl; + }, encode(message: QueryTokenPairsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.pagination !== undefined) { PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); @@ -301,6 +311,12 @@ export const QueryTokenPairsRequest = { typeUrl: "/evmos.erc20.v1.QueryTokenPairsRequest", value: QueryTokenPairsRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryTokenPairsRequest.typeUrl)) { + return; + } + PageRequest.registerTypeUrl(); } }; function createBaseQueryTokenPairsResponse(): QueryTokenPairsResponse { @@ -318,6 +334,15 @@ function createBaseQueryTokenPairsResponse(): QueryTokenPairsResponse { */ export const QueryTokenPairsResponse = { typeUrl: "/evmos.erc20.v1.QueryTokenPairsResponse", + is(o: any): o is QueryTokenPairsResponse { + return o && (o.$typeUrl === QueryTokenPairsResponse.typeUrl || Array.isArray(o.tokenPairs) && (!o.tokenPairs.length || TokenPair.is(o.tokenPairs[0]))); + }, + isSDK(o: any): o is QueryTokenPairsResponseSDKType { + return o && (o.$typeUrl === QueryTokenPairsResponse.typeUrl || Array.isArray(o.token_pairs) && (!o.token_pairs.length || TokenPair.isSDK(o.token_pairs[0]))); + }, + isAmino(o: any): o is QueryTokenPairsResponseAmino { + return o && (o.$typeUrl === QueryTokenPairsResponse.typeUrl || Array.isArray(o.token_pairs) && (!o.token_pairs.length || TokenPair.isAmino(o.token_pairs[0]))); + }, encode(message: QueryTokenPairsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.tokenPairs) { TokenPair.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -406,6 +431,13 @@ export const QueryTokenPairsResponse = { typeUrl: "/evmos.erc20.v1.QueryTokenPairsResponse", value: QueryTokenPairsResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryTokenPairsResponse.typeUrl)) { + return; + } + TokenPair.registerTypeUrl(); + PageResponse.registerTypeUrl(); } }; function createBaseQueryTokenPairRequest(): QueryTokenPairRequest { @@ -421,6 +453,15 @@ function createBaseQueryTokenPairRequest(): QueryTokenPairRequest { */ export const QueryTokenPairRequest = { typeUrl: "/evmos.erc20.v1.QueryTokenPairRequest", + is(o: any): o is QueryTokenPairRequest { + return o && (o.$typeUrl === QueryTokenPairRequest.typeUrl || typeof o.token === "string"); + }, + isSDK(o: any): o is QueryTokenPairRequestSDKType { + return o && (o.$typeUrl === QueryTokenPairRequest.typeUrl || typeof o.token === "string"); + }, + isAmino(o: any): o is QueryTokenPairRequestAmino { + return o && (o.$typeUrl === QueryTokenPairRequest.typeUrl || typeof o.token === "string"); + }, encode(message: QueryTokenPairRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.token !== "") { writer.uint32(10).string(message.token); @@ -487,7 +528,8 @@ export const QueryTokenPairRequest = { typeUrl: "/evmos.erc20.v1.QueryTokenPairRequest", value: QueryTokenPairRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryTokenPairResponse(): QueryTokenPairResponse { return { @@ -503,6 +545,15 @@ function createBaseQueryTokenPairResponse(): QueryTokenPairResponse { */ export const QueryTokenPairResponse = { typeUrl: "/evmos.erc20.v1.QueryTokenPairResponse", + is(o: any): o is QueryTokenPairResponse { + return o && (o.$typeUrl === QueryTokenPairResponse.typeUrl || TokenPair.is(o.tokenPair)); + }, + isSDK(o: any): o is QueryTokenPairResponseSDKType { + return o && (o.$typeUrl === QueryTokenPairResponse.typeUrl || TokenPair.isSDK(o.token_pair)); + }, + isAmino(o: any): o is QueryTokenPairResponseAmino { + return o && (o.$typeUrl === QueryTokenPairResponse.typeUrl || TokenPair.isAmino(o.token_pair)); + }, encode(message: QueryTokenPairResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.tokenPair !== undefined) { TokenPair.encode(message.tokenPair, writer.uint32(10).fork()).ldelim(); @@ -571,6 +622,12 @@ export const QueryTokenPairResponse = { typeUrl: "/evmos.erc20.v1.QueryTokenPairResponse", value: QueryTokenPairResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryTokenPairResponse.typeUrl)) { + return; + } + TokenPair.registerTypeUrl(); } }; function createBaseQueryParamsRequest(): QueryParamsRequest { @@ -584,6 +641,15 @@ function createBaseQueryParamsRequest(): QueryParamsRequest { */ export const QueryParamsRequest = { typeUrl: "/evmos.erc20.v1.QueryParamsRequest", + is(o: any): o is QueryParamsRequest { + return o && o.$typeUrl === QueryParamsRequest.typeUrl; + }, + isSDK(o: any): o is QueryParamsRequestSDKType { + return o && o.$typeUrl === QueryParamsRequest.typeUrl; + }, + isAmino(o: any): o is QueryParamsRequestAmino { + return o && o.$typeUrl === QueryParamsRequest.typeUrl; + }, encode(_: QueryParamsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -635,7 +701,8 @@ export const QueryParamsRequest = { typeUrl: "/evmos.erc20.v1.QueryParamsRequest", value: QueryParamsRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryParamsResponse(): QueryParamsResponse { return { @@ -651,6 +718,15 @@ function createBaseQueryParamsResponse(): QueryParamsResponse { */ export const QueryParamsResponse = { typeUrl: "/evmos.erc20.v1.QueryParamsResponse", + is(o: any): o is QueryParamsResponse { + return o && (o.$typeUrl === QueryParamsResponse.typeUrl || Params.is(o.params)); + }, + isSDK(o: any): o is QueryParamsResponseSDKType { + return o && (o.$typeUrl === QueryParamsResponse.typeUrl || Params.isSDK(o.params)); + }, + isAmino(o: any): o is QueryParamsResponseAmino { + return o && (o.$typeUrl === QueryParamsResponse.typeUrl || Params.isAmino(o.params)); + }, encode(message: QueryParamsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.params !== undefined) { Params.encode(message.params, writer.uint32(10).fork()).ldelim(); @@ -719,5 +795,11 @@ export const QueryParamsResponse = { typeUrl: "/evmos.erc20.v1.QueryParamsResponse", value: QueryParamsResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryParamsResponse.typeUrl)) { + return; + } + Params.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/evmos/erc20/v1/tx.registry.ts b/__fixtures__/v-next/outputv3/evmos/erc20/v1/tx.registry.ts index f51520624b..b7f8c151cb 100644 --- a/__fixtures__/v-next/outputv3/evmos/erc20/v1/tx.registry.ts +++ b/__fixtures__/v-next/outputv3/evmos/erc20/v1/tx.registry.ts @@ -1,12 +1,7 @@ import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; -import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { TelescopeGeneratedType } from "../../../types"; import { MsgConvertCoin, MsgConvertCoinSDKType, MsgConvertERC20, MsgConvertERC20SDKType } from "./tx"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/evmos.erc20.v1.MsgConvertCoin", MsgConvertCoin], ["/evmos.erc20.v1.MsgConvertERC20", MsgConvertERC20]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/evmos.erc20.v1.MsgConvertCoin", MsgConvertCoin], ["/evmos.erc20.v1.MsgConvertERC20", MsgConvertERC20]]; export const MessageComposer = { encoded: { convertCoin(value: MsgConvertCoin) { diff --git a/__fixtures__/v-next/outputv3/evmos/erc20/v1/tx.rpc.func.ts b/__fixtures__/v-next/outputv3/evmos/erc20/v1/tx.rpc.func.ts new file mode 100644 index 0000000000..98c71c793d --- /dev/null +++ b/__fixtures__/v-next/outputv3/evmos/erc20/v1/tx.rpc.func.ts @@ -0,0 +1,23 @@ +import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; +import { buildTx } from "../../../helper-func-types"; +import { MsgConvertCoin, MsgConvertCoinSDKType, MsgConvertCoinResponse, MsgConvertCoinResponseSDKType, MsgConvertERC20, MsgConvertERC20SDKType, MsgConvertERC20Response, MsgConvertERC20ResponseSDKType } from "./tx"; +/** + * ConvertCoin mints a ERC20 representation of the native Cosmos coin denom + * that is registered on the token mapping. + * @name convertCoin + * @package evmos.erc20.v1 + * @see proto service: evmos.erc20.v1.ConvertCoin + */ +export const convertCoin = buildTx({ + msg: MsgConvertCoin +}); +/** + * ConvertERC20 mints a native Cosmos coin representation of the ERC20 token + * contract that is registered on the token mapping. + * @name convertERC20 + * @package evmos.erc20.v1 + * @see proto service: evmos.erc20.v1.ConvertERC20 + */ +export const convertERC20 = buildTx({ + msg: MsgConvertERC20 +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/evmos/erc20/v1/tx.ts b/__fixtures__/v-next/outputv3/evmos/erc20/v1/tx.ts index badfd4fd71..5f04d67812 100644 --- a/__fixtures__/v-next/outputv3/evmos/erc20/v1/tx.ts +++ b/__fixtures__/v-next/outputv3/evmos/erc20/v1/tx.ts @@ -1,5 +1,6 @@ import { Coin, CoinAmino, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; +import { GlobalDecoderRegistry } from "../../../registry"; import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "evmos.erc20.v1"; /** @@ -191,6 +192,15 @@ function createBaseMsgConvertCoin(): MsgConvertCoin { */ export const MsgConvertCoin = { typeUrl: "/evmos.erc20.v1.MsgConvertCoin", + is(o: any): o is MsgConvertCoin { + return o && (o.$typeUrl === MsgConvertCoin.typeUrl || Coin.is(o.coin) && typeof o.receiver === "string" && typeof o.sender === "string"); + }, + isSDK(o: any): o is MsgConvertCoinSDKType { + return o && (o.$typeUrl === MsgConvertCoin.typeUrl || Coin.isSDK(o.coin) && typeof o.receiver === "string" && typeof o.sender === "string"); + }, + isAmino(o: any): o is MsgConvertCoinAmino { + return o && (o.$typeUrl === MsgConvertCoin.typeUrl || Coin.isAmino(o.coin) && typeof o.receiver === "string" && typeof o.sender === "string"); + }, encode(message: MsgConvertCoin, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.coin !== undefined) { Coin.encode(message.coin, writer.uint32(10).fork()).ldelim(); @@ -287,6 +297,12 @@ export const MsgConvertCoin = { typeUrl: "/evmos.erc20.v1.MsgConvertCoin", value: MsgConvertCoin.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgConvertCoin.typeUrl)) { + return; + } + Coin.registerTypeUrl(); } }; function createBaseMsgConvertCoinResponse(): MsgConvertCoinResponse { @@ -300,6 +316,15 @@ function createBaseMsgConvertCoinResponse(): MsgConvertCoinResponse { */ export const MsgConvertCoinResponse = { typeUrl: "/evmos.erc20.v1.MsgConvertCoinResponse", + is(o: any): o is MsgConvertCoinResponse { + return o && o.$typeUrl === MsgConvertCoinResponse.typeUrl; + }, + isSDK(o: any): o is MsgConvertCoinResponseSDKType { + return o && o.$typeUrl === MsgConvertCoinResponse.typeUrl; + }, + isAmino(o: any): o is MsgConvertCoinResponseAmino { + return o && o.$typeUrl === MsgConvertCoinResponse.typeUrl; + }, encode(_: MsgConvertCoinResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -351,7 +376,8 @@ export const MsgConvertCoinResponse = { typeUrl: "/evmos.erc20.v1.MsgConvertCoinResponse", value: MsgConvertCoinResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgConvertERC20(): MsgConvertERC20 { return { @@ -370,6 +396,15 @@ function createBaseMsgConvertERC20(): MsgConvertERC20 { */ export const MsgConvertERC20 = { typeUrl: "/evmos.erc20.v1.MsgConvertERC20", + is(o: any): o is MsgConvertERC20 { + return o && (o.$typeUrl === MsgConvertERC20.typeUrl || typeof o.contractAddress === "string" && typeof o.amount === "string" && typeof o.receiver === "string" && typeof o.sender === "string"); + }, + isSDK(o: any): o is MsgConvertERC20SDKType { + return o && (o.$typeUrl === MsgConvertERC20.typeUrl || typeof o.contract_address === "string" && typeof o.amount === "string" && typeof o.receiver === "string" && typeof o.sender === "string"); + }, + isAmino(o: any): o is MsgConvertERC20Amino { + return o && (o.$typeUrl === MsgConvertERC20.typeUrl || typeof o.contract_address === "string" && typeof o.amount === "string" && typeof o.receiver === "string" && typeof o.sender === "string"); + }, encode(message: MsgConvertERC20, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.contractAddress !== "") { writer.uint32(10).string(message.contractAddress); @@ -478,7 +513,8 @@ export const MsgConvertERC20 = { typeUrl: "/evmos.erc20.v1.MsgConvertERC20", value: MsgConvertERC20.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgConvertERC20Response(): MsgConvertERC20Response { return {}; @@ -491,6 +527,15 @@ function createBaseMsgConvertERC20Response(): MsgConvertERC20Response { */ export const MsgConvertERC20Response = { typeUrl: "/evmos.erc20.v1.MsgConvertERC20Response", + is(o: any): o is MsgConvertERC20Response { + return o && o.$typeUrl === MsgConvertERC20Response.typeUrl; + }, + isSDK(o: any): o is MsgConvertERC20ResponseSDKType { + return o && o.$typeUrl === MsgConvertERC20Response.typeUrl; + }, + isAmino(o: any): o is MsgConvertERC20ResponseAmino { + return o && o.$typeUrl === MsgConvertERC20Response.typeUrl; + }, encode(_: MsgConvertERC20Response, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -542,5 +587,6 @@ export const MsgConvertERC20Response = { typeUrl: "/evmos.erc20.v1.MsgConvertERC20Response", value: MsgConvertERC20Response.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/evmos/fees/v1/fees.ts b/__fixtures__/v-next/outputv3/evmos/fees/v1/fees.ts index c8324cccf9..d68a59259e 100644 --- a/__fixtures__/v-next/outputv3/evmos/fees/v1/fees.ts +++ b/__fixtures__/v-next/outputv3/evmos/fees/v1/fees.ts @@ -77,6 +77,15 @@ function createBaseDevFeeInfo(): DevFeeInfo { */ export const DevFeeInfo = { typeUrl: "/evmos.fees.v1.DevFeeInfo", + is(o: any): o is DevFeeInfo { + return o && (o.$typeUrl === DevFeeInfo.typeUrl || typeof o.contractAddress === "string" && typeof o.deployerAddress === "string" && typeof o.withdrawAddress === "string"); + }, + isSDK(o: any): o is DevFeeInfoSDKType { + return o && (o.$typeUrl === DevFeeInfo.typeUrl || typeof o.contract_address === "string" && typeof o.deployer_address === "string" && typeof o.withdraw_address === "string"); + }, + isAmino(o: any): o is DevFeeInfoAmino { + return o && (o.$typeUrl === DevFeeInfo.typeUrl || typeof o.contract_address === "string" && typeof o.deployer_address === "string" && typeof o.withdraw_address === "string"); + }, encode(message: DevFeeInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.contractAddress !== "") { writer.uint32(10).string(message.contractAddress); @@ -171,5 +180,6 @@ export const DevFeeInfo = { typeUrl: "/evmos.fees.v1.DevFeeInfo", value: DevFeeInfo.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/evmos/fees/v1/genesis.ts b/__fixtures__/v-next/outputv3/evmos/fees/v1/genesis.ts index 7a1f54e59e..f44d50f46a 100644 --- a/__fixtures__/v-next/outputv3/evmos/fees/v1/genesis.ts +++ b/__fixtures__/v-next/outputv3/evmos/fees/v1/genesis.ts @@ -1,7 +1,8 @@ import { DevFeeInfo, DevFeeInfoAmino, DevFeeInfoSDKType } from "./fees"; import { BinaryReader, BinaryWriter } from "../../../binary"; +import { GlobalDecoderRegistry } from "../../../registry"; import { isSet, DeepPartial } from "../../../helpers"; -import { Decimal } from "@cosmjs/math"; +import { Decimal } from "@interchainjs/math"; export const protobufPackage = "evmos.fees.v1"; /** * GenesisState defines the module's genesis state. @@ -142,6 +143,15 @@ function createBaseGenesisState(): GenesisState { */ export const GenesisState = { typeUrl: "/evmos.fees.v1.GenesisState", + is(o: any): o is GenesisState { + return o && (o.$typeUrl === GenesisState.typeUrl || Params.is(o.params) && Array.isArray(o.devFeeInfos) && (!o.devFeeInfos.length || DevFeeInfo.is(o.devFeeInfos[0]))); + }, + isSDK(o: any): o is GenesisStateSDKType { + return o && (o.$typeUrl === GenesisState.typeUrl || Params.isSDK(o.params) && Array.isArray(o.dev_fee_infos) && (!o.dev_fee_infos.length || DevFeeInfo.isSDK(o.dev_fee_infos[0]))); + }, + isAmino(o: any): o is GenesisStateAmino { + return o && (o.$typeUrl === GenesisState.typeUrl || Params.isAmino(o.params) && Array.isArray(o.dev_fee_infos) && (!o.dev_fee_infos.length || DevFeeInfo.isAmino(o.dev_fee_infos[0]))); + }, encode(message: GenesisState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.params !== undefined) { Params.encode(message.params, writer.uint32(10).fork()).ldelim(); @@ -230,6 +240,13 @@ export const GenesisState = { typeUrl: "/evmos.fees.v1.GenesisState", value: GenesisState.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GenesisState.typeUrl)) { + return; + } + Params.registerTypeUrl(); + DevFeeInfo.registerTypeUrl(); } }; function createBaseParams(): Params { @@ -249,6 +266,15 @@ function createBaseParams(): Params { */ export const Params = { typeUrl: "/evmos.fees.v1.Params", + is(o: any): o is Params { + return o && (o.$typeUrl === Params.typeUrl || typeof o.enableFees === "boolean" && typeof o.developerShares === "string" && typeof o.validatorShares === "string" && typeof o.addrDerivationCostCreate === "bigint" && typeof o.minGasPrice === "string"); + }, + isSDK(o: any): o is ParamsSDKType { + return o && (o.$typeUrl === Params.typeUrl || typeof o.enable_fees === "boolean" && typeof o.developer_shares === "string" && typeof o.validator_shares === "string" && typeof o.addr_derivation_cost_create === "bigint" && typeof o.min_gas_price === "string"); + }, + isAmino(o: any): o is ParamsAmino { + return o && (o.$typeUrl === Params.typeUrl || typeof o.enable_fees === "boolean" && typeof o.developer_shares === "string" && typeof o.validator_shares === "string" && typeof o.addr_derivation_cost_create === "bigint" && typeof o.min_gas_price === "string"); + }, encode(message: Params, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.enableFees === true) { writer.uint32(8).bool(message.enableFees); @@ -356,10 +382,10 @@ export const Params = { toAmino(message: Params, useInterfaces: boolean = true): ParamsAmino { const obj: any = {}; obj.enable_fees = message.enableFees === false ? undefined : message.enableFees; - obj.developer_shares = message.developerShares === "" ? undefined : message.developerShares; - obj.validator_shares = message.validatorShares === "" ? undefined : message.validatorShares; + obj.developer_shares = message.developerShares === "" ? undefined : Decimal.fromUserInput(message.developerShares, 18).atomics; + obj.validator_shares = message.validatorShares === "" ? undefined : Decimal.fromUserInput(message.validatorShares, 18).atomics; obj.addr_derivation_cost_create = message.addrDerivationCostCreate !== BigInt(0) ? message.addrDerivationCostCreate?.toString() : undefined; - obj.min_gas_price = message.minGasPrice === "" ? undefined : message.minGasPrice; + obj.min_gas_price = message.minGasPrice === "" ? undefined : Decimal.fromUserInput(message.minGasPrice, 18).atomics; return obj; }, fromProtoMsg(message: ParamsProtoMsg, useInterfaces: boolean = true): Params { @@ -373,5 +399,6 @@ export const Params = { typeUrl: "/evmos.fees.v1.Params", value: Params.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/evmos/fees/v1/query.rpc.func.ts b/__fixtures__/v-next/outputv3/evmos/fees/v1/query.rpc.func.ts new file mode 100644 index 0000000000..9dac303619 --- /dev/null +++ b/__fixtures__/v-next/outputv3/evmos/fees/v1/query.rpc.func.ts @@ -0,0 +1,58 @@ +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination"; +import { DevFeeInfo, DevFeeInfoSDKType } from "./fees"; +import { Params, ParamsSDKType } from "./genesis"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { QueryDevFeeInfosRequest, QueryDevFeeInfosRequestSDKType, QueryDevFeeInfosResponse, QueryDevFeeInfosResponseSDKType, QueryDevFeeInfoRequest, QueryDevFeeInfoRequestSDKType, QueryDevFeeInfoResponse, QueryDevFeeInfoResponseSDKType, QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, QueryDevFeeInfosPerDeployerRequest, QueryDevFeeInfosPerDeployerRequestSDKType, QueryDevFeeInfosPerDeployerResponse, QueryDevFeeInfosPerDeployerResponseSDKType } from "./query"; +/** + * DevFeeInfos retrieves all registered contracts for fee distribution + * @name getDevFeeInfos + * @package evmos.fees.v1 + * @see proto service: evmos.fees.v1.DevFeeInfos + */ +export const getDevFeeInfos = buildQuery({ + encode: QueryDevFeeInfosRequest.encode, + decode: QueryDevFeeInfosResponse.decode, + service: "evmos.fees.v1.Query", + method: "DevFeeInfos", + deps: [QueryDevFeeInfosRequest, QueryDevFeeInfosResponse] +}); +/** + * DevFeeInfo retrieves a registered contract for fee distribution + * @name getDevFeeInfo + * @package evmos.fees.v1 + * @see proto service: evmos.fees.v1.DevFeeInfo + */ +export const getDevFeeInfo = buildQuery({ + encode: QueryDevFeeInfoRequest.encode, + decode: QueryDevFeeInfoResponse.decode, + service: "evmos.fees.v1.Query", + method: "DevFeeInfo", + deps: [QueryDevFeeInfoRequest, QueryDevFeeInfoResponse] +}); +/** + * Params retrieves the fees module params + * @name getParams + * @package evmos.fees.v1 + * @see proto service: evmos.fees.v1.Params + */ +export const getParams = buildQuery({ + encode: QueryParamsRequest.encode, + decode: QueryParamsResponse.decode, + service: "evmos.fees.v1.Query", + method: "Params", + deps: [QueryParamsRequest, QueryParamsResponse] +}); +/** + * DevFeeInfosPerDeployer retrieves all contracts that a deployer has + * registered for fee distribution + * @name getDevFeeInfosPerDeployer + * @package evmos.fees.v1 + * @see proto service: evmos.fees.v1.DevFeeInfosPerDeployer + */ +export const getDevFeeInfosPerDeployer = buildQuery({ + encode: QueryDevFeeInfosPerDeployerRequest.encode, + decode: QueryDevFeeInfosPerDeployerResponse.decode, + service: "evmos.fees.v1.Query", + method: "DevFeeInfosPerDeployer", + deps: [QueryDevFeeInfosPerDeployerRequest, QueryDevFeeInfosPerDeployerResponse] +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/evmos/fees/v1/query.ts b/__fixtures__/v-next/outputv3/evmos/fees/v1/query.ts index 8d9ee502ce..5d6808f402 100644 --- a/__fixtures__/v-next/outputv3/evmos/fees/v1/query.ts +++ b/__fixtures__/v-next/outputv3/evmos/fees/v1/query.ts @@ -2,6 +2,7 @@ import { PageRequest, PageRequestAmino, PageRequestSDKType, PageResponse, PageRe import { DevFeeInfo, DevFeeInfoAmino, DevFeeInfoSDKType } from "./fees"; import { Params, ParamsAmino, ParamsSDKType } from "./genesis"; import { BinaryReader, BinaryWriter } from "../../../binary"; +import { GlobalDecoderRegistry } from "../../../registry"; import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "evmos.fees.v1"; /** @@ -326,6 +327,15 @@ function createBaseQueryDevFeeInfosRequest(): QueryDevFeeInfosRequest { */ export const QueryDevFeeInfosRequest = { typeUrl: "/evmos.fees.v1.QueryDevFeeInfosRequest", + is(o: any): o is QueryDevFeeInfosRequest { + return o && o.$typeUrl === QueryDevFeeInfosRequest.typeUrl; + }, + isSDK(o: any): o is QueryDevFeeInfosRequestSDKType { + return o && o.$typeUrl === QueryDevFeeInfosRequest.typeUrl; + }, + isAmino(o: any): o is QueryDevFeeInfosRequestAmino { + return o && o.$typeUrl === QueryDevFeeInfosRequest.typeUrl; + }, encode(message: QueryDevFeeInfosRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.pagination !== undefined) { PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); @@ -394,6 +404,12 @@ export const QueryDevFeeInfosRequest = { typeUrl: "/evmos.fees.v1.QueryDevFeeInfosRequest", value: QueryDevFeeInfosRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryDevFeeInfosRequest.typeUrl)) { + return; + } + PageRequest.registerTypeUrl(); } }; function createBaseQueryDevFeeInfosResponse(): QueryDevFeeInfosResponse { @@ -411,6 +427,15 @@ function createBaseQueryDevFeeInfosResponse(): QueryDevFeeInfosResponse { */ export const QueryDevFeeInfosResponse = { typeUrl: "/evmos.fees.v1.QueryDevFeeInfosResponse", + is(o: any): o is QueryDevFeeInfosResponse { + return o && (o.$typeUrl === QueryDevFeeInfosResponse.typeUrl || Array.isArray(o.fees) && (!o.fees.length || DevFeeInfo.is(o.fees[0]))); + }, + isSDK(o: any): o is QueryDevFeeInfosResponseSDKType { + return o && (o.$typeUrl === QueryDevFeeInfosResponse.typeUrl || Array.isArray(o.fees) && (!o.fees.length || DevFeeInfo.isSDK(o.fees[0]))); + }, + isAmino(o: any): o is QueryDevFeeInfosResponseAmino { + return o && (o.$typeUrl === QueryDevFeeInfosResponse.typeUrl || Array.isArray(o.fees) && (!o.fees.length || DevFeeInfo.isAmino(o.fees[0]))); + }, encode(message: QueryDevFeeInfosResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.fees) { DevFeeInfo.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -499,6 +524,13 @@ export const QueryDevFeeInfosResponse = { typeUrl: "/evmos.fees.v1.QueryDevFeeInfosResponse", value: QueryDevFeeInfosResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryDevFeeInfosResponse.typeUrl)) { + return; + } + DevFeeInfo.registerTypeUrl(); + PageResponse.registerTypeUrl(); } }; function createBaseQueryDevFeeInfoRequest(): QueryDevFeeInfoRequest { @@ -515,6 +547,15 @@ function createBaseQueryDevFeeInfoRequest(): QueryDevFeeInfoRequest { */ export const QueryDevFeeInfoRequest = { typeUrl: "/evmos.fees.v1.QueryDevFeeInfoRequest", + is(o: any): o is QueryDevFeeInfoRequest { + return o && (o.$typeUrl === QueryDevFeeInfoRequest.typeUrl || typeof o.contractAddress === "string"); + }, + isSDK(o: any): o is QueryDevFeeInfoRequestSDKType { + return o && (o.$typeUrl === QueryDevFeeInfoRequest.typeUrl || typeof o.contract_address === "string"); + }, + isAmino(o: any): o is QueryDevFeeInfoRequestAmino { + return o && (o.$typeUrl === QueryDevFeeInfoRequest.typeUrl || typeof o.contract_address === "string"); + }, encode(message: QueryDevFeeInfoRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.contractAddress !== "") { writer.uint32(10).string(message.contractAddress); @@ -581,7 +622,8 @@ export const QueryDevFeeInfoRequest = { typeUrl: "/evmos.fees.v1.QueryDevFeeInfoRequest", value: QueryDevFeeInfoRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryDevFeeInfoResponse(): QueryDevFeeInfoResponse { return { @@ -597,6 +639,15 @@ function createBaseQueryDevFeeInfoResponse(): QueryDevFeeInfoResponse { */ export const QueryDevFeeInfoResponse = { typeUrl: "/evmos.fees.v1.QueryDevFeeInfoResponse", + is(o: any): o is QueryDevFeeInfoResponse { + return o && (o.$typeUrl === QueryDevFeeInfoResponse.typeUrl || DevFeeInfo.is(o.fee)); + }, + isSDK(o: any): o is QueryDevFeeInfoResponseSDKType { + return o && (o.$typeUrl === QueryDevFeeInfoResponse.typeUrl || DevFeeInfo.isSDK(o.fee)); + }, + isAmino(o: any): o is QueryDevFeeInfoResponseAmino { + return o && (o.$typeUrl === QueryDevFeeInfoResponse.typeUrl || DevFeeInfo.isAmino(o.fee)); + }, encode(message: QueryDevFeeInfoResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.fee !== undefined) { DevFeeInfo.encode(message.fee, writer.uint32(10).fork()).ldelim(); @@ -665,6 +716,12 @@ export const QueryDevFeeInfoResponse = { typeUrl: "/evmos.fees.v1.QueryDevFeeInfoResponse", value: QueryDevFeeInfoResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryDevFeeInfoResponse.typeUrl)) { + return; + } + DevFeeInfo.registerTypeUrl(); } }; function createBaseQueryParamsRequest(): QueryParamsRequest { @@ -678,6 +735,15 @@ function createBaseQueryParamsRequest(): QueryParamsRequest { */ export const QueryParamsRequest = { typeUrl: "/evmos.fees.v1.QueryParamsRequest", + is(o: any): o is QueryParamsRequest { + return o && o.$typeUrl === QueryParamsRequest.typeUrl; + }, + isSDK(o: any): o is QueryParamsRequestSDKType { + return o && o.$typeUrl === QueryParamsRequest.typeUrl; + }, + isAmino(o: any): o is QueryParamsRequestAmino { + return o && o.$typeUrl === QueryParamsRequest.typeUrl; + }, encode(_: QueryParamsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -729,7 +795,8 @@ export const QueryParamsRequest = { typeUrl: "/evmos.fees.v1.QueryParamsRequest", value: QueryParamsRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryParamsResponse(): QueryParamsResponse { return { @@ -745,6 +812,15 @@ function createBaseQueryParamsResponse(): QueryParamsResponse { */ export const QueryParamsResponse = { typeUrl: "/evmos.fees.v1.QueryParamsResponse", + is(o: any): o is QueryParamsResponse { + return o && (o.$typeUrl === QueryParamsResponse.typeUrl || Params.is(o.params)); + }, + isSDK(o: any): o is QueryParamsResponseSDKType { + return o && (o.$typeUrl === QueryParamsResponse.typeUrl || Params.isSDK(o.params)); + }, + isAmino(o: any): o is QueryParamsResponseAmino { + return o && (o.$typeUrl === QueryParamsResponse.typeUrl || Params.isAmino(o.params)); + }, encode(message: QueryParamsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.params !== undefined) { Params.encode(message.params, writer.uint32(10).fork()).ldelim(); @@ -813,6 +889,12 @@ export const QueryParamsResponse = { typeUrl: "/evmos.fees.v1.QueryParamsResponse", value: QueryParamsResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryParamsResponse.typeUrl)) { + return; + } + Params.registerTypeUrl(); } }; function createBaseQueryDevFeeInfosPerDeployerRequest(): QueryDevFeeInfosPerDeployerRequest { @@ -830,6 +912,15 @@ function createBaseQueryDevFeeInfosPerDeployerRequest(): QueryDevFeeInfosPerDepl */ export const QueryDevFeeInfosPerDeployerRequest = { typeUrl: "/evmos.fees.v1.QueryDevFeeInfosPerDeployerRequest", + is(o: any): o is QueryDevFeeInfosPerDeployerRequest { + return o && (o.$typeUrl === QueryDevFeeInfosPerDeployerRequest.typeUrl || typeof o.deployerAddress === "string"); + }, + isSDK(o: any): o is QueryDevFeeInfosPerDeployerRequestSDKType { + return o && (o.$typeUrl === QueryDevFeeInfosPerDeployerRequest.typeUrl || typeof o.deployer_address === "string"); + }, + isAmino(o: any): o is QueryDevFeeInfosPerDeployerRequestAmino { + return o && (o.$typeUrl === QueryDevFeeInfosPerDeployerRequest.typeUrl || typeof o.deployer_address === "string"); + }, encode(message: QueryDevFeeInfosPerDeployerRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.deployerAddress !== "") { writer.uint32(10).string(message.deployerAddress); @@ -912,6 +1003,12 @@ export const QueryDevFeeInfosPerDeployerRequest = { typeUrl: "/evmos.fees.v1.QueryDevFeeInfosPerDeployerRequest", value: QueryDevFeeInfosPerDeployerRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryDevFeeInfosPerDeployerRequest.typeUrl)) { + return; + } + PageRequest.registerTypeUrl(); } }; function createBaseQueryDevFeeInfosPerDeployerResponse(): QueryDevFeeInfosPerDeployerResponse { @@ -929,6 +1026,15 @@ function createBaseQueryDevFeeInfosPerDeployerResponse(): QueryDevFeeInfosPerDep */ export const QueryDevFeeInfosPerDeployerResponse = { typeUrl: "/evmos.fees.v1.QueryDevFeeInfosPerDeployerResponse", + is(o: any): o is QueryDevFeeInfosPerDeployerResponse { + return o && (o.$typeUrl === QueryDevFeeInfosPerDeployerResponse.typeUrl || Array.isArray(o.fees) && (!o.fees.length || DevFeeInfo.is(o.fees[0]))); + }, + isSDK(o: any): o is QueryDevFeeInfosPerDeployerResponseSDKType { + return o && (o.$typeUrl === QueryDevFeeInfosPerDeployerResponse.typeUrl || Array.isArray(o.fees) && (!o.fees.length || DevFeeInfo.isSDK(o.fees[0]))); + }, + isAmino(o: any): o is QueryDevFeeInfosPerDeployerResponseAmino { + return o && (o.$typeUrl === QueryDevFeeInfosPerDeployerResponse.typeUrl || Array.isArray(o.fees) && (!o.fees.length || DevFeeInfo.isAmino(o.fees[0]))); + }, encode(message: QueryDevFeeInfosPerDeployerResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.fees) { DevFeeInfo.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -1017,5 +1123,12 @@ export const QueryDevFeeInfosPerDeployerResponse = { typeUrl: "/evmos.fees.v1.QueryDevFeeInfosPerDeployerResponse", value: QueryDevFeeInfosPerDeployerResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryDevFeeInfosPerDeployerResponse.typeUrl)) { + return; + } + DevFeeInfo.registerTypeUrl(); + PageResponse.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/evmos/fees/v1/tx.registry.ts b/__fixtures__/v-next/outputv3/evmos/fees/v1/tx.registry.ts index 2c46ebde49..00502ccf54 100644 --- a/__fixtures__/v-next/outputv3/evmos/fees/v1/tx.registry.ts +++ b/__fixtures__/v-next/outputv3/evmos/fees/v1/tx.registry.ts @@ -1,11 +1,6 @@ -import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { TelescopeGeneratedType } from "../../../types"; import { MsgRegisterDevFeeInfo, MsgRegisterDevFeeInfoSDKType, MsgCancelDevFeeInfo, MsgCancelDevFeeInfoSDKType, MsgUpdateDevFeeInfo, MsgUpdateDevFeeInfoSDKType } from "./tx"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/evmos.fees.v1.MsgRegisterDevFeeInfo", MsgRegisterDevFeeInfo], ["/evmos.fees.v1.MsgCancelDevFeeInfo", MsgCancelDevFeeInfo], ["/evmos.fees.v1.MsgUpdateDevFeeInfo", MsgUpdateDevFeeInfo]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/evmos.fees.v1.MsgRegisterDevFeeInfo", MsgRegisterDevFeeInfo], ["/evmos.fees.v1.MsgCancelDevFeeInfo", MsgCancelDevFeeInfo], ["/evmos.fees.v1.MsgUpdateDevFeeInfo", MsgUpdateDevFeeInfo]]; export const MessageComposer = { encoded: { registerDevFeeInfo(value: MsgRegisterDevFeeInfo) { diff --git a/__fixtures__/v-next/outputv3/evmos/fees/v1/tx.rpc.func.ts b/__fixtures__/v-next/outputv3/evmos/fees/v1/tx.rpc.func.ts new file mode 100644 index 0000000000..150928bee9 --- /dev/null +++ b/__fixtures__/v-next/outputv3/evmos/fees/v1/tx.rpc.func.ts @@ -0,0 +1,31 @@ +import { buildTx } from "../../../helper-func-types"; +import { MsgRegisterDevFeeInfo, MsgRegisterDevFeeInfoSDKType, MsgRegisterDevFeeInfoResponse, MsgRegisterDevFeeInfoResponseSDKType, MsgCancelDevFeeInfo, MsgCancelDevFeeInfoSDKType, MsgCancelDevFeeInfoResponse, MsgCancelDevFeeInfoResponseSDKType, MsgUpdateDevFeeInfo, MsgUpdateDevFeeInfoSDKType, MsgUpdateDevFeeInfoResponse, MsgUpdateDevFeeInfoResponseSDKType } from "./tx"; +/** + * RegisterDevFeeInfo is used by a deployer to register a new contract for + * receiving transaction fees + * @name registerDevFeeInfo + * @package evmos.fees.v1 + * @see proto service: evmos.fees.v1.RegisterDevFeeInfo + */ +export const registerDevFeeInfo = buildTx({ + msg: MsgRegisterDevFeeInfo +}); +/** + * CancelDevFeeInfo is used by a deployer to cancel a registered contract + * and stop receiving transaction fees + * @name cancelDevFeeInfo + * @package evmos.fees.v1 + * @see proto service: evmos.fees.v1.CancelDevFeeInfo + */ +export const cancelDevFeeInfo = buildTx({ + msg: MsgCancelDevFeeInfo +}); +/** + * UpdateDevFeeInfo is used by a deployer to update the withdraw address + * @name updateDevFeeInfo + * @package evmos.fees.v1 + * @see proto service: evmos.fees.v1.UpdateDevFeeInfo + */ +export const updateDevFeeInfo = buildTx({ + msg: MsgUpdateDevFeeInfo +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/evmos/fees/v1/tx.ts b/__fixtures__/v-next/outputv3/evmos/fees/v1/tx.ts index e20be06819..f407157503 100644 --- a/__fixtures__/v-next/outputv3/evmos/fees/v1/tx.ts +++ b/__fixtures__/v-next/outputv3/evmos/fees/v1/tx.ts @@ -272,6 +272,15 @@ function createBaseMsgRegisterDevFeeInfo(): MsgRegisterDevFeeInfo { */ export const MsgRegisterDevFeeInfo = { typeUrl: "/evmos.fees.v1.MsgRegisterDevFeeInfo", + is(o: any): o is MsgRegisterDevFeeInfo { + return o && (o.$typeUrl === MsgRegisterDevFeeInfo.typeUrl || typeof o.contractAddress === "string" && typeof o.deployerAddress === "string" && typeof o.withdrawAddress === "string" && Array.isArray(o.nonces) && (!o.nonces.length || typeof o.nonces[0] === "bigint")); + }, + isSDK(o: any): o is MsgRegisterDevFeeInfoSDKType { + return o && (o.$typeUrl === MsgRegisterDevFeeInfo.typeUrl || typeof o.contract_address === "string" && typeof o.deployer_address === "string" && typeof o.withdraw_address === "string" && Array.isArray(o.nonces) && (!o.nonces.length || typeof o.nonces[0] === "bigint")); + }, + isAmino(o: any): o is MsgRegisterDevFeeInfoAmino { + return o && (o.$typeUrl === MsgRegisterDevFeeInfo.typeUrl || typeof o.contract_address === "string" && typeof o.deployer_address === "string" && typeof o.withdraw_address === "string" && Array.isArray(o.nonces) && (!o.nonces.length || typeof o.nonces[0] === "bigint")); + }, encode(message: MsgRegisterDevFeeInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.contractAddress !== "") { writer.uint32(10).string(message.contractAddress); @@ -395,7 +404,8 @@ export const MsgRegisterDevFeeInfo = { typeUrl: "/evmos.fees.v1.MsgRegisterDevFeeInfo", value: MsgRegisterDevFeeInfo.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgRegisterDevFeeInfoResponse(): MsgRegisterDevFeeInfoResponse { return {}; @@ -409,6 +419,15 @@ function createBaseMsgRegisterDevFeeInfoResponse(): MsgRegisterDevFeeInfoRespons */ export const MsgRegisterDevFeeInfoResponse = { typeUrl: "/evmos.fees.v1.MsgRegisterDevFeeInfoResponse", + is(o: any): o is MsgRegisterDevFeeInfoResponse { + return o && o.$typeUrl === MsgRegisterDevFeeInfoResponse.typeUrl; + }, + isSDK(o: any): o is MsgRegisterDevFeeInfoResponseSDKType { + return o && o.$typeUrl === MsgRegisterDevFeeInfoResponse.typeUrl; + }, + isAmino(o: any): o is MsgRegisterDevFeeInfoResponseAmino { + return o && o.$typeUrl === MsgRegisterDevFeeInfoResponse.typeUrl; + }, encode(_: MsgRegisterDevFeeInfoResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -460,7 +479,8 @@ export const MsgRegisterDevFeeInfoResponse = { typeUrl: "/evmos.fees.v1.MsgRegisterDevFeeInfoResponse", value: MsgRegisterDevFeeInfoResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgCancelDevFeeInfo(): MsgCancelDevFeeInfo { return { @@ -477,6 +497,15 @@ function createBaseMsgCancelDevFeeInfo(): MsgCancelDevFeeInfo { */ export const MsgCancelDevFeeInfo = { typeUrl: "/evmos.fees.v1.MsgCancelDevFeeInfo", + is(o: any): o is MsgCancelDevFeeInfo { + return o && (o.$typeUrl === MsgCancelDevFeeInfo.typeUrl || typeof o.contractAddress === "string" && typeof o.deployerAddress === "string"); + }, + isSDK(o: any): o is MsgCancelDevFeeInfoSDKType { + return o && (o.$typeUrl === MsgCancelDevFeeInfo.typeUrl || typeof o.contract_address === "string" && typeof o.deployer_address === "string"); + }, + isAmino(o: any): o is MsgCancelDevFeeInfoAmino { + return o && (o.$typeUrl === MsgCancelDevFeeInfo.typeUrl || typeof o.contract_address === "string" && typeof o.deployer_address === "string"); + }, encode(message: MsgCancelDevFeeInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.contractAddress !== "") { writer.uint32(10).string(message.contractAddress); @@ -557,7 +586,8 @@ export const MsgCancelDevFeeInfo = { typeUrl: "/evmos.fees.v1.MsgCancelDevFeeInfo", value: MsgCancelDevFeeInfo.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgCancelDevFeeInfoResponse(): MsgCancelDevFeeInfoResponse { return {}; @@ -570,6 +600,15 @@ function createBaseMsgCancelDevFeeInfoResponse(): MsgCancelDevFeeInfoResponse { */ export const MsgCancelDevFeeInfoResponse = { typeUrl: "/evmos.fees.v1.MsgCancelDevFeeInfoResponse", + is(o: any): o is MsgCancelDevFeeInfoResponse { + return o && o.$typeUrl === MsgCancelDevFeeInfoResponse.typeUrl; + }, + isSDK(o: any): o is MsgCancelDevFeeInfoResponseSDKType { + return o && o.$typeUrl === MsgCancelDevFeeInfoResponse.typeUrl; + }, + isAmino(o: any): o is MsgCancelDevFeeInfoResponseAmino { + return o && o.$typeUrl === MsgCancelDevFeeInfoResponse.typeUrl; + }, encode(_: MsgCancelDevFeeInfoResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -621,7 +660,8 @@ export const MsgCancelDevFeeInfoResponse = { typeUrl: "/evmos.fees.v1.MsgCancelDevFeeInfoResponse", value: MsgCancelDevFeeInfoResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgUpdateDevFeeInfo(): MsgUpdateDevFeeInfo { return { @@ -639,6 +679,15 @@ function createBaseMsgUpdateDevFeeInfo(): MsgUpdateDevFeeInfo { */ export const MsgUpdateDevFeeInfo = { typeUrl: "/evmos.fees.v1.MsgUpdateDevFeeInfo", + is(o: any): o is MsgUpdateDevFeeInfo { + return o && (o.$typeUrl === MsgUpdateDevFeeInfo.typeUrl || typeof o.contractAddress === "string" && typeof o.deployerAddress === "string" && typeof o.withdrawAddress === "string"); + }, + isSDK(o: any): o is MsgUpdateDevFeeInfoSDKType { + return o && (o.$typeUrl === MsgUpdateDevFeeInfo.typeUrl || typeof o.contract_address === "string" && typeof o.deployer_address === "string" && typeof o.withdraw_address === "string"); + }, + isAmino(o: any): o is MsgUpdateDevFeeInfoAmino { + return o && (o.$typeUrl === MsgUpdateDevFeeInfo.typeUrl || typeof o.contract_address === "string" && typeof o.deployer_address === "string" && typeof o.withdraw_address === "string"); + }, encode(message: MsgUpdateDevFeeInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.contractAddress !== "") { writer.uint32(10).string(message.contractAddress); @@ -733,7 +782,8 @@ export const MsgUpdateDevFeeInfo = { typeUrl: "/evmos.fees.v1.MsgUpdateDevFeeInfo", value: MsgUpdateDevFeeInfo.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgUpdateDevFeeInfoResponse(): MsgUpdateDevFeeInfoResponse { return {}; @@ -746,6 +796,15 @@ function createBaseMsgUpdateDevFeeInfoResponse(): MsgUpdateDevFeeInfoResponse { */ export const MsgUpdateDevFeeInfoResponse = { typeUrl: "/evmos.fees.v1.MsgUpdateDevFeeInfoResponse", + is(o: any): o is MsgUpdateDevFeeInfoResponse { + return o && o.$typeUrl === MsgUpdateDevFeeInfoResponse.typeUrl; + }, + isSDK(o: any): o is MsgUpdateDevFeeInfoResponseSDKType { + return o && o.$typeUrl === MsgUpdateDevFeeInfoResponse.typeUrl; + }, + isAmino(o: any): o is MsgUpdateDevFeeInfoResponseAmino { + return o && o.$typeUrl === MsgUpdateDevFeeInfoResponse.typeUrl; + }, encode(_: MsgUpdateDevFeeInfoResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -797,5 +856,6 @@ export const MsgUpdateDevFeeInfoResponse = { typeUrl: "/evmos.fees.v1.MsgUpdateDevFeeInfoResponse", value: MsgUpdateDevFeeInfoResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/evmos/incentives/v1/genesis.ts b/__fixtures__/v-next/outputv3/evmos/incentives/v1/genesis.ts index 766d94f2b8..bb14a22709 100644 --- a/__fixtures__/v-next/outputv3/evmos/incentives/v1/genesis.ts +++ b/__fixtures__/v-next/outputv3/evmos/incentives/v1/genesis.ts @@ -1,7 +1,8 @@ import { Incentive, IncentiveAmino, IncentiveSDKType, GasMeter, GasMeterAmino, GasMeterSDKType } from "./incentives"; import { BinaryReader, BinaryWriter } from "../../../binary"; +import { GlobalDecoderRegistry } from "../../../registry"; import { isSet, DeepPartial } from "../../../helpers"; -import { Decimal } from "@cosmjs/math"; +import { Decimal } from "@interchainjs/math"; export const protobufPackage = "evmos.incentives.v1"; /** * GenesisState defines the module's genesis state. @@ -137,6 +138,15 @@ function createBaseGenesisState(): GenesisState { */ export const GenesisState = { typeUrl: "/evmos.incentives.v1.GenesisState", + is(o: any): o is GenesisState { + return o && (o.$typeUrl === GenesisState.typeUrl || Params.is(o.params) && Array.isArray(o.incentives) && (!o.incentives.length || Incentive.is(o.incentives[0])) && Array.isArray(o.gasMeters) && (!o.gasMeters.length || GasMeter.is(o.gasMeters[0]))); + }, + isSDK(o: any): o is GenesisStateSDKType { + return o && (o.$typeUrl === GenesisState.typeUrl || Params.isSDK(o.params) && Array.isArray(o.incentives) && (!o.incentives.length || Incentive.isSDK(o.incentives[0])) && Array.isArray(o.gas_meters) && (!o.gas_meters.length || GasMeter.isSDK(o.gas_meters[0]))); + }, + isAmino(o: any): o is GenesisStateAmino { + return o && (o.$typeUrl === GenesisState.typeUrl || Params.isAmino(o.params) && Array.isArray(o.incentives) && (!o.incentives.length || Incentive.isAmino(o.incentives[0])) && Array.isArray(o.gas_meters) && (!o.gas_meters.length || GasMeter.isAmino(o.gas_meters[0]))); + }, encode(message: GenesisState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.params !== undefined) { Params.encode(message.params, writer.uint32(10).fork()).ldelim(); @@ -245,6 +255,14 @@ export const GenesisState = { typeUrl: "/evmos.incentives.v1.GenesisState", value: GenesisState.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GenesisState.typeUrl)) { + return; + } + Params.registerTypeUrl(); + Incentive.registerTypeUrl(); + GasMeter.registerTypeUrl(); } }; function createBaseParams(): Params { @@ -263,6 +281,15 @@ function createBaseParams(): Params { */ export const Params = { typeUrl: "/evmos.incentives.v1.Params", + is(o: any): o is Params { + return o && (o.$typeUrl === Params.typeUrl || typeof o.enableIncentives === "boolean" && typeof o.allocationLimit === "string" && typeof o.incentivesEpochIdentifier === "string" && typeof o.rewardScaler === "string"); + }, + isSDK(o: any): o is ParamsSDKType { + return o && (o.$typeUrl === Params.typeUrl || typeof o.enable_incentives === "boolean" && typeof o.allocation_limit === "string" && typeof o.incentives_epoch_identifier === "string" && typeof o.reward_scaler === "string"); + }, + isAmino(o: any): o is ParamsAmino { + return o && (o.$typeUrl === Params.typeUrl || typeof o.enable_incentives === "boolean" && typeof o.allocation_limit === "string" && typeof o.incentives_epoch_identifier === "string" && typeof o.reward_scaler === "string"); + }, encode(message: Params, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.enableIncentives === true) { writer.uint32(8).bool(message.enableIncentives); @@ -355,9 +382,9 @@ export const Params = { toAmino(message: Params, useInterfaces: boolean = true): ParamsAmino { const obj: any = {}; obj.enable_incentives = message.enableIncentives === false ? undefined : message.enableIncentives; - obj.allocation_limit = message.allocationLimit === "" ? undefined : message.allocationLimit; + obj.allocation_limit = message.allocationLimit === "" ? undefined : Decimal.fromUserInput(message.allocationLimit, 18).atomics; obj.incentives_epoch_identifier = message.incentivesEpochIdentifier === "" ? undefined : message.incentivesEpochIdentifier; - obj.reward_scaler = message.rewardScaler === "" ? undefined : message.rewardScaler; + obj.reward_scaler = message.rewardScaler === "" ? undefined : Decimal.fromUserInput(message.rewardScaler, 18).atomics; return obj; }, fromProtoMsg(message: ParamsProtoMsg, useInterfaces: boolean = true): Params { @@ -371,5 +398,6 @@ export const Params = { typeUrl: "/evmos.incentives.v1.Params", value: Params.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/evmos/incentives/v1/incentives.ts b/__fixtures__/v-next/outputv3/evmos/incentives/v1/incentives.ts index cb17480c00..25304818fd 100644 --- a/__fixtures__/v-next/outputv3/evmos/incentives/v1/incentives.ts +++ b/__fixtures__/v-next/outputv3/evmos/incentives/v1/incentives.ts @@ -2,6 +2,7 @@ import { DecCoin, DecCoinAmino, DecCoinSDKType } from "../../../cosmos/base/v1be import { Timestamp, TimestampAmino, TimestampSDKType } from "../../../google/protobuf/timestamp"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { toTimestamp, fromTimestamp, isSet, DeepPartial } from "../../../helpers"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "evmos.incentives.v1"; /** * Incentive defines an instance that organizes distribution conditions for a @@ -282,6 +283,15 @@ function createBaseIncentive(): Incentive { */ export const Incentive = { typeUrl: "/evmos.incentives.v1.Incentive", + is(o: any): o is Incentive { + return o && (o.$typeUrl === Incentive.typeUrl || typeof o.contract === "string" && Array.isArray(o.allocations) && (!o.allocations.length || DecCoin.is(o.allocations[0])) && typeof o.epochs === "number" && Timestamp.is(o.startTime) && typeof o.totalGas === "bigint"); + }, + isSDK(o: any): o is IncentiveSDKType { + return o && (o.$typeUrl === Incentive.typeUrl || typeof o.contract === "string" && Array.isArray(o.allocations) && (!o.allocations.length || DecCoin.isSDK(o.allocations[0])) && typeof o.epochs === "number" && Timestamp.isSDK(o.start_time) && typeof o.total_gas === "bigint"); + }, + isAmino(o: any): o is IncentiveAmino { + return o && (o.$typeUrl === Incentive.typeUrl || typeof o.contract === "string" && Array.isArray(o.allocations) && (!o.allocations.length || DecCoin.isAmino(o.allocations[0])) && typeof o.epochs === "number" && Timestamp.isAmino(o.start_time) && typeof o.total_gas === "bigint"); + }, encode(message: Incentive, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.contract !== "") { writer.uint32(10).string(message.contract); @@ -412,6 +422,12 @@ export const Incentive = { typeUrl: "/evmos.incentives.v1.Incentive", value: Incentive.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Incentive.typeUrl)) { + return; + } + DecCoin.registerTypeUrl(); } }; function createBaseGasMeter(): GasMeter { @@ -429,6 +445,15 @@ function createBaseGasMeter(): GasMeter { */ export const GasMeter = { typeUrl: "/evmos.incentives.v1.GasMeter", + is(o: any): o is GasMeter { + return o && (o.$typeUrl === GasMeter.typeUrl || typeof o.contract === "string" && typeof o.participant === "string" && typeof o.cumulativeGas === "bigint"); + }, + isSDK(o: any): o is GasMeterSDKType { + return o && (o.$typeUrl === GasMeter.typeUrl || typeof o.contract === "string" && typeof o.participant === "string" && typeof o.cumulative_gas === "bigint"); + }, + isAmino(o: any): o is GasMeterAmino { + return o && (o.$typeUrl === GasMeter.typeUrl || typeof o.contract === "string" && typeof o.participant === "string" && typeof o.cumulative_gas === "bigint"); + }, encode(message: GasMeter, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.contract !== "") { writer.uint32(10).string(message.contract); @@ -525,7 +550,8 @@ export const GasMeter = { typeUrl: "/evmos.incentives.v1.GasMeter", value: GasMeter.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseRegisterIncentiveProposal(): RegisterIncentiveProposal { return { @@ -545,6 +571,15 @@ function createBaseRegisterIncentiveProposal(): RegisterIncentiveProposal { */ export const RegisterIncentiveProposal = { typeUrl: "/evmos.incentives.v1.RegisterIncentiveProposal", + is(o: any): o is RegisterIncentiveProposal { + return o && (o.$typeUrl === RegisterIncentiveProposal.typeUrl || typeof o.title === "string" && typeof o.description === "string" && typeof o.contract === "string" && Array.isArray(o.allocations) && (!o.allocations.length || DecCoin.is(o.allocations[0])) && typeof o.epochs === "number"); + }, + isSDK(o: any): o is RegisterIncentiveProposalSDKType { + return o && (o.$typeUrl === RegisterIncentiveProposal.typeUrl || typeof o.title === "string" && typeof o.description === "string" && typeof o.contract === "string" && Array.isArray(o.allocations) && (!o.allocations.length || DecCoin.isSDK(o.allocations[0])) && typeof o.epochs === "number"); + }, + isAmino(o: any): o is RegisterIncentiveProposalAmino { + return o && (o.$typeUrl === RegisterIncentiveProposal.typeUrl || typeof o.title === "string" && typeof o.description === "string" && typeof o.contract === "string" && Array.isArray(o.allocations) && (!o.allocations.length || DecCoin.isAmino(o.allocations[0])) && typeof o.epochs === "number"); + }, encode(message: RegisterIncentiveProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.title !== "") { writer.uint32(10).string(message.title); @@ -673,6 +708,13 @@ export const RegisterIncentiveProposal = { typeUrl: "/evmos.incentives.v1.RegisterIncentiveProposal", value: RegisterIncentiveProposal.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(RegisterIncentiveProposal.typeUrl)) { + return; + } + GlobalDecoderRegistry.register(RegisterIncentiveProposal.typeUrl, RegisterIncentiveProposal); + DecCoin.registerTypeUrl(); } }; function createBaseCancelIncentiveProposal(): CancelIncentiveProposal { @@ -690,6 +732,15 @@ function createBaseCancelIncentiveProposal(): CancelIncentiveProposal { */ export const CancelIncentiveProposal = { typeUrl: "/evmos.incentives.v1.CancelIncentiveProposal", + is(o: any): o is CancelIncentiveProposal { + return o && (o.$typeUrl === CancelIncentiveProposal.typeUrl || typeof o.title === "string" && typeof o.description === "string" && typeof o.contract === "string"); + }, + isSDK(o: any): o is CancelIncentiveProposalSDKType { + return o && (o.$typeUrl === CancelIncentiveProposal.typeUrl || typeof o.title === "string" && typeof o.description === "string" && typeof o.contract === "string"); + }, + isAmino(o: any): o is CancelIncentiveProposalAmino { + return o && (o.$typeUrl === CancelIncentiveProposal.typeUrl || typeof o.title === "string" && typeof o.description === "string" && typeof o.contract === "string"); + }, encode(message: CancelIncentiveProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.title !== "") { writer.uint32(10).string(message.title); @@ -784,5 +835,6 @@ export const CancelIncentiveProposal = { typeUrl: "/evmos.incentives.v1.CancelIncentiveProposal", value: CancelIncentiveProposal.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/evmos/incentives/v1/query.rpc.func.ts b/__fixtures__/v-next/outputv3/evmos/incentives/v1/query.rpc.func.ts new file mode 100644 index 0000000000..5d3e366c43 --- /dev/null +++ b/__fixtures__/v-next/outputv3/evmos/incentives/v1/query.rpc.func.ts @@ -0,0 +1,98 @@ +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination"; +import { Incentive, IncentiveSDKType, GasMeter, GasMeterSDKType } from "./incentives"; +import { DecCoin, DecCoinSDKType } from "../../../cosmos/base/v1beta1/coin"; +import { Params, ParamsSDKType } from "./genesis"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { QueryIncentivesRequest, QueryIncentivesRequestSDKType, QueryIncentivesResponse, QueryIncentivesResponseSDKType, QueryIncentiveRequest, QueryIncentiveRequestSDKType, QueryIncentiveResponse, QueryIncentiveResponseSDKType, QueryGasMetersRequest, QueryGasMetersRequestSDKType, QueryGasMetersResponse, QueryGasMetersResponseSDKType, QueryGasMeterRequest, QueryGasMeterRequestSDKType, QueryGasMeterResponse, QueryGasMeterResponseSDKType, QueryAllocationMetersRequest, QueryAllocationMetersRequestSDKType, QueryAllocationMetersResponse, QueryAllocationMetersResponseSDKType, QueryAllocationMeterRequest, QueryAllocationMeterRequestSDKType, QueryAllocationMeterResponse, QueryAllocationMeterResponseSDKType, QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType } from "./query"; +/** + * Incentives retrieves registered incentives + * @name getIncentives + * @package evmos.incentives.v1 + * @see proto service: evmos.incentives.v1.Incentives + */ +export const getIncentives = buildQuery({ + encode: QueryIncentivesRequest.encode, + decode: QueryIncentivesResponse.decode, + service: "evmos.incentives.v1.Query", + method: "Incentives", + deps: [QueryIncentivesRequest, QueryIncentivesResponse] +}); +/** + * Incentive retrieves a registered incentive + * @name getIncentive + * @package evmos.incentives.v1 + * @see proto service: evmos.incentives.v1.Incentive + */ +export const getIncentive = buildQuery({ + encode: QueryIncentiveRequest.encode, + decode: QueryIncentiveResponse.decode, + service: "evmos.incentives.v1.Query", + method: "Incentive", + deps: [QueryIncentiveRequest, QueryIncentiveResponse] +}); +/** + * GasMeters retrieves active gas meters for a given contract + * @name getGasMeters + * @package evmos.incentives.v1 + * @see proto service: evmos.incentives.v1.GasMeters + */ +export const getGasMeters = buildQuery({ + encode: QueryGasMetersRequest.encode, + decode: QueryGasMetersResponse.decode, + service: "evmos.incentives.v1.Query", + method: "GasMeters", + deps: [QueryGasMetersRequest, QueryGasMetersResponse] +}); +/** + * GasMeter Retrieves a active gas meter + * @name getGasMeter + * @package evmos.incentives.v1 + * @see proto service: evmos.incentives.v1.GasMeter + */ +export const getGasMeter = buildQuery({ + encode: QueryGasMeterRequest.encode, + decode: QueryGasMeterResponse.decode, + service: "evmos.incentives.v1.Query", + method: "GasMeter", + deps: [QueryGasMeterRequest, QueryGasMeterResponse] +}); +/** + * AllocationMeters retrieves active allocation meters for a given + * denomination + * @name getAllocationMeters + * @package evmos.incentives.v1 + * @see proto service: evmos.incentives.v1.AllocationMeters + */ +export const getAllocationMeters = buildQuery({ + encode: QueryAllocationMetersRequest.encode, + decode: QueryAllocationMetersResponse.decode, + service: "evmos.incentives.v1.Query", + method: "AllocationMeters", + deps: [QueryAllocationMetersRequest, QueryAllocationMetersResponse] +}); +/** + * AllocationMeter Retrieves a active gas meter + * @name getAllocationMeter + * @package evmos.incentives.v1 + * @see proto service: evmos.incentives.v1.AllocationMeter + */ +export const getAllocationMeter = buildQuery({ + encode: QueryAllocationMeterRequest.encode, + decode: QueryAllocationMeterResponse.decode, + service: "evmos.incentives.v1.Query", + method: "AllocationMeter", + deps: [QueryAllocationMeterRequest, QueryAllocationMeterResponse] +}); +/** + * Params retrieves the incentives module params + * @name getParams + * @package evmos.incentives.v1 + * @see proto service: evmos.incentives.v1.Params + */ +export const getParams = buildQuery({ + encode: QueryParamsRequest.encode, + decode: QueryParamsResponse.decode, + service: "evmos.incentives.v1.Query", + method: "Params", + deps: [QueryParamsRequest, QueryParamsResponse] +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/evmos/incentives/v1/query.ts b/__fixtures__/v-next/outputv3/evmos/incentives/v1/query.ts index cf97167b86..251294448e 100644 --- a/__fixtures__/v-next/outputv3/evmos/incentives/v1/query.ts +++ b/__fixtures__/v-next/outputv3/evmos/incentives/v1/query.ts @@ -3,6 +3,7 @@ import { Incentive, IncentiveAmino, IncentiveSDKType, GasMeter, GasMeterAmino, G import { DecCoin, DecCoinAmino, DecCoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { Params, ParamsAmino, ParamsSDKType } from "./genesis"; import { BinaryReader, BinaryWriter } from "../../../binary"; +import { GlobalDecoderRegistry } from "../../../registry"; import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "evmos.incentives.v1"; /** @@ -561,6 +562,15 @@ function createBaseQueryIncentivesRequest(): QueryIncentivesRequest { */ export const QueryIncentivesRequest = { typeUrl: "/evmos.incentives.v1.QueryIncentivesRequest", + is(o: any): o is QueryIncentivesRequest { + return o && o.$typeUrl === QueryIncentivesRequest.typeUrl; + }, + isSDK(o: any): o is QueryIncentivesRequestSDKType { + return o && o.$typeUrl === QueryIncentivesRequest.typeUrl; + }, + isAmino(o: any): o is QueryIncentivesRequestAmino { + return o && o.$typeUrl === QueryIncentivesRequest.typeUrl; + }, encode(message: QueryIncentivesRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.pagination !== undefined) { PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); @@ -629,6 +639,12 @@ export const QueryIncentivesRequest = { typeUrl: "/evmos.incentives.v1.QueryIncentivesRequest", value: QueryIncentivesRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryIncentivesRequest.typeUrl)) { + return; + } + PageRequest.registerTypeUrl(); } }; function createBaseQueryIncentivesResponse(): QueryIncentivesResponse { @@ -646,6 +662,15 @@ function createBaseQueryIncentivesResponse(): QueryIncentivesResponse { */ export const QueryIncentivesResponse = { typeUrl: "/evmos.incentives.v1.QueryIncentivesResponse", + is(o: any): o is QueryIncentivesResponse { + return o && (o.$typeUrl === QueryIncentivesResponse.typeUrl || Array.isArray(o.incentives) && (!o.incentives.length || Incentive.is(o.incentives[0]))); + }, + isSDK(o: any): o is QueryIncentivesResponseSDKType { + return o && (o.$typeUrl === QueryIncentivesResponse.typeUrl || Array.isArray(o.incentives) && (!o.incentives.length || Incentive.isSDK(o.incentives[0]))); + }, + isAmino(o: any): o is QueryIncentivesResponseAmino { + return o && (o.$typeUrl === QueryIncentivesResponse.typeUrl || Array.isArray(o.incentives) && (!o.incentives.length || Incentive.isAmino(o.incentives[0]))); + }, encode(message: QueryIncentivesResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.incentives) { Incentive.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -734,6 +759,13 @@ export const QueryIncentivesResponse = { typeUrl: "/evmos.incentives.v1.QueryIncentivesResponse", value: QueryIncentivesResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryIncentivesResponse.typeUrl)) { + return; + } + Incentive.registerTypeUrl(); + PageResponse.registerTypeUrl(); } }; function createBaseQueryIncentiveRequest(): QueryIncentiveRequest { @@ -749,6 +781,15 @@ function createBaseQueryIncentiveRequest(): QueryIncentiveRequest { */ export const QueryIncentiveRequest = { typeUrl: "/evmos.incentives.v1.QueryIncentiveRequest", + is(o: any): o is QueryIncentiveRequest { + return o && (o.$typeUrl === QueryIncentiveRequest.typeUrl || typeof o.contract === "string"); + }, + isSDK(o: any): o is QueryIncentiveRequestSDKType { + return o && (o.$typeUrl === QueryIncentiveRequest.typeUrl || typeof o.contract === "string"); + }, + isAmino(o: any): o is QueryIncentiveRequestAmino { + return o && (o.$typeUrl === QueryIncentiveRequest.typeUrl || typeof o.contract === "string"); + }, encode(message: QueryIncentiveRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.contract !== "") { writer.uint32(10).string(message.contract); @@ -815,7 +856,8 @@ export const QueryIncentiveRequest = { typeUrl: "/evmos.incentives.v1.QueryIncentiveRequest", value: QueryIncentiveRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryIncentiveResponse(): QueryIncentiveResponse { return { @@ -831,6 +873,15 @@ function createBaseQueryIncentiveResponse(): QueryIncentiveResponse { */ export const QueryIncentiveResponse = { typeUrl: "/evmos.incentives.v1.QueryIncentiveResponse", + is(o: any): o is QueryIncentiveResponse { + return o && (o.$typeUrl === QueryIncentiveResponse.typeUrl || Incentive.is(o.incentive)); + }, + isSDK(o: any): o is QueryIncentiveResponseSDKType { + return o && (o.$typeUrl === QueryIncentiveResponse.typeUrl || Incentive.isSDK(o.incentive)); + }, + isAmino(o: any): o is QueryIncentiveResponseAmino { + return o && (o.$typeUrl === QueryIncentiveResponse.typeUrl || Incentive.isAmino(o.incentive)); + }, encode(message: QueryIncentiveResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.incentive !== undefined) { Incentive.encode(message.incentive, writer.uint32(10).fork()).ldelim(); @@ -899,6 +950,12 @@ export const QueryIncentiveResponse = { typeUrl: "/evmos.incentives.v1.QueryIncentiveResponse", value: QueryIncentiveResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryIncentiveResponse.typeUrl)) { + return; + } + Incentive.registerTypeUrl(); } }; function createBaseQueryGasMetersRequest(): QueryGasMetersRequest { @@ -916,6 +973,15 @@ function createBaseQueryGasMetersRequest(): QueryGasMetersRequest { */ export const QueryGasMetersRequest = { typeUrl: "/evmos.incentives.v1.QueryGasMetersRequest", + is(o: any): o is QueryGasMetersRequest { + return o && (o.$typeUrl === QueryGasMetersRequest.typeUrl || typeof o.contract === "string"); + }, + isSDK(o: any): o is QueryGasMetersRequestSDKType { + return o && (o.$typeUrl === QueryGasMetersRequest.typeUrl || typeof o.contract === "string"); + }, + isAmino(o: any): o is QueryGasMetersRequestAmino { + return o && (o.$typeUrl === QueryGasMetersRequest.typeUrl || typeof o.contract === "string"); + }, encode(message: QueryGasMetersRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.contract !== "") { writer.uint32(10).string(message.contract); @@ -998,6 +1064,12 @@ export const QueryGasMetersRequest = { typeUrl: "/evmos.incentives.v1.QueryGasMetersRequest", value: QueryGasMetersRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryGasMetersRequest.typeUrl)) { + return; + } + PageRequest.registerTypeUrl(); } }; function createBaseQueryGasMetersResponse(): QueryGasMetersResponse { @@ -1015,6 +1087,15 @@ function createBaseQueryGasMetersResponse(): QueryGasMetersResponse { */ export const QueryGasMetersResponse = { typeUrl: "/evmos.incentives.v1.QueryGasMetersResponse", + is(o: any): o is QueryGasMetersResponse { + return o && (o.$typeUrl === QueryGasMetersResponse.typeUrl || Array.isArray(o.gasMeters) && (!o.gasMeters.length || GasMeter.is(o.gasMeters[0]))); + }, + isSDK(o: any): o is QueryGasMetersResponseSDKType { + return o && (o.$typeUrl === QueryGasMetersResponse.typeUrl || Array.isArray(o.gas_meters) && (!o.gas_meters.length || GasMeter.isSDK(o.gas_meters[0]))); + }, + isAmino(o: any): o is QueryGasMetersResponseAmino { + return o && (o.$typeUrl === QueryGasMetersResponse.typeUrl || Array.isArray(o.gas_meters) && (!o.gas_meters.length || GasMeter.isAmino(o.gas_meters[0]))); + }, encode(message: QueryGasMetersResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.gasMeters) { GasMeter.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -1103,6 +1184,13 @@ export const QueryGasMetersResponse = { typeUrl: "/evmos.incentives.v1.QueryGasMetersResponse", value: QueryGasMetersResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryGasMetersResponse.typeUrl)) { + return; + } + GasMeter.registerTypeUrl(); + PageResponse.registerTypeUrl(); } }; function createBaseQueryGasMeterRequest(): QueryGasMeterRequest { @@ -1119,6 +1207,15 @@ function createBaseQueryGasMeterRequest(): QueryGasMeterRequest { */ export const QueryGasMeterRequest = { typeUrl: "/evmos.incentives.v1.QueryGasMeterRequest", + is(o: any): o is QueryGasMeterRequest { + return o && (o.$typeUrl === QueryGasMeterRequest.typeUrl || typeof o.contract === "string" && typeof o.participant === "string"); + }, + isSDK(o: any): o is QueryGasMeterRequestSDKType { + return o && (o.$typeUrl === QueryGasMeterRequest.typeUrl || typeof o.contract === "string" && typeof o.participant === "string"); + }, + isAmino(o: any): o is QueryGasMeterRequestAmino { + return o && (o.$typeUrl === QueryGasMeterRequest.typeUrl || typeof o.contract === "string" && typeof o.participant === "string"); + }, encode(message: QueryGasMeterRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.contract !== "") { writer.uint32(10).string(message.contract); @@ -1199,7 +1296,8 @@ export const QueryGasMeterRequest = { typeUrl: "/evmos.incentives.v1.QueryGasMeterRequest", value: QueryGasMeterRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryGasMeterResponse(): QueryGasMeterResponse { return { @@ -1215,6 +1313,15 @@ function createBaseQueryGasMeterResponse(): QueryGasMeterResponse { */ export const QueryGasMeterResponse = { typeUrl: "/evmos.incentives.v1.QueryGasMeterResponse", + is(o: any): o is QueryGasMeterResponse { + return o && (o.$typeUrl === QueryGasMeterResponse.typeUrl || typeof o.gasMeter === "bigint"); + }, + isSDK(o: any): o is QueryGasMeterResponseSDKType { + return o && (o.$typeUrl === QueryGasMeterResponse.typeUrl || typeof o.gas_meter === "bigint"); + }, + isAmino(o: any): o is QueryGasMeterResponseAmino { + return o && (o.$typeUrl === QueryGasMeterResponse.typeUrl || typeof o.gas_meter === "bigint"); + }, encode(message: QueryGasMeterResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.gasMeter !== BigInt(0)) { writer.uint32(8).uint64(message.gasMeter); @@ -1283,7 +1390,8 @@ export const QueryGasMeterResponse = { typeUrl: "/evmos.incentives.v1.QueryGasMeterResponse", value: QueryGasMeterResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryAllocationMetersRequest(): QueryAllocationMetersRequest { return { @@ -1299,6 +1407,15 @@ function createBaseQueryAllocationMetersRequest(): QueryAllocationMetersRequest */ export const QueryAllocationMetersRequest = { typeUrl: "/evmos.incentives.v1.QueryAllocationMetersRequest", + is(o: any): o is QueryAllocationMetersRequest { + return o && o.$typeUrl === QueryAllocationMetersRequest.typeUrl; + }, + isSDK(o: any): o is QueryAllocationMetersRequestSDKType { + return o && o.$typeUrl === QueryAllocationMetersRequest.typeUrl; + }, + isAmino(o: any): o is QueryAllocationMetersRequestAmino { + return o && o.$typeUrl === QueryAllocationMetersRequest.typeUrl; + }, encode(message: QueryAllocationMetersRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.pagination !== undefined) { PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); @@ -1367,6 +1484,12 @@ export const QueryAllocationMetersRequest = { typeUrl: "/evmos.incentives.v1.QueryAllocationMetersRequest", value: QueryAllocationMetersRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryAllocationMetersRequest.typeUrl)) { + return; + } + PageRequest.registerTypeUrl(); } }; function createBaseQueryAllocationMetersResponse(): QueryAllocationMetersResponse { @@ -1384,6 +1507,15 @@ function createBaseQueryAllocationMetersResponse(): QueryAllocationMetersRespons */ export const QueryAllocationMetersResponse = { typeUrl: "/evmos.incentives.v1.QueryAllocationMetersResponse", + is(o: any): o is QueryAllocationMetersResponse { + return o && (o.$typeUrl === QueryAllocationMetersResponse.typeUrl || Array.isArray(o.allocationMeters) && (!o.allocationMeters.length || DecCoin.is(o.allocationMeters[0]))); + }, + isSDK(o: any): o is QueryAllocationMetersResponseSDKType { + return o && (o.$typeUrl === QueryAllocationMetersResponse.typeUrl || Array.isArray(o.allocation_meters) && (!o.allocation_meters.length || DecCoin.isSDK(o.allocation_meters[0]))); + }, + isAmino(o: any): o is QueryAllocationMetersResponseAmino { + return o && (o.$typeUrl === QueryAllocationMetersResponse.typeUrl || Array.isArray(o.allocation_meters) && (!o.allocation_meters.length || DecCoin.isAmino(o.allocation_meters[0]))); + }, encode(message: QueryAllocationMetersResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.allocationMeters) { DecCoin.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -1472,6 +1604,13 @@ export const QueryAllocationMetersResponse = { typeUrl: "/evmos.incentives.v1.QueryAllocationMetersResponse", value: QueryAllocationMetersResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryAllocationMetersResponse.typeUrl)) { + return; + } + DecCoin.registerTypeUrl(); + PageResponse.registerTypeUrl(); } }; function createBaseQueryAllocationMeterRequest(): QueryAllocationMeterRequest { @@ -1488,6 +1627,15 @@ function createBaseQueryAllocationMeterRequest(): QueryAllocationMeterRequest { */ export const QueryAllocationMeterRequest = { typeUrl: "/evmos.incentives.v1.QueryAllocationMeterRequest", + is(o: any): o is QueryAllocationMeterRequest { + return o && (o.$typeUrl === QueryAllocationMeterRequest.typeUrl || typeof o.denom === "string"); + }, + isSDK(o: any): o is QueryAllocationMeterRequestSDKType { + return o && (o.$typeUrl === QueryAllocationMeterRequest.typeUrl || typeof o.denom === "string"); + }, + isAmino(o: any): o is QueryAllocationMeterRequestAmino { + return o && (o.$typeUrl === QueryAllocationMeterRequest.typeUrl || typeof o.denom === "string"); + }, encode(message: QueryAllocationMeterRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.denom !== "") { writer.uint32(10).string(message.denom); @@ -1554,7 +1702,8 @@ export const QueryAllocationMeterRequest = { typeUrl: "/evmos.incentives.v1.QueryAllocationMeterRequest", value: QueryAllocationMeterRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryAllocationMeterResponse(): QueryAllocationMeterResponse { return { @@ -1570,6 +1719,15 @@ function createBaseQueryAllocationMeterResponse(): QueryAllocationMeterResponse */ export const QueryAllocationMeterResponse = { typeUrl: "/evmos.incentives.v1.QueryAllocationMeterResponse", + is(o: any): o is QueryAllocationMeterResponse { + return o && (o.$typeUrl === QueryAllocationMeterResponse.typeUrl || DecCoin.is(o.allocationMeter)); + }, + isSDK(o: any): o is QueryAllocationMeterResponseSDKType { + return o && (o.$typeUrl === QueryAllocationMeterResponse.typeUrl || DecCoin.isSDK(o.allocation_meter)); + }, + isAmino(o: any): o is QueryAllocationMeterResponseAmino { + return o && (o.$typeUrl === QueryAllocationMeterResponse.typeUrl || DecCoin.isAmino(o.allocation_meter)); + }, encode(message: QueryAllocationMeterResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.allocationMeter !== undefined) { DecCoin.encode(message.allocationMeter, writer.uint32(10).fork()).ldelim(); @@ -1638,6 +1796,12 @@ export const QueryAllocationMeterResponse = { typeUrl: "/evmos.incentives.v1.QueryAllocationMeterResponse", value: QueryAllocationMeterResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryAllocationMeterResponse.typeUrl)) { + return; + } + DecCoin.registerTypeUrl(); } }; function createBaseQueryParamsRequest(): QueryParamsRequest { @@ -1651,6 +1815,15 @@ function createBaseQueryParamsRequest(): QueryParamsRequest { */ export const QueryParamsRequest = { typeUrl: "/evmos.incentives.v1.QueryParamsRequest", + is(o: any): o is QueryParamsRequest { + return o && o.$typeUrl === QueryParamsRequest.typeUrl; + }, + isSDK(o: any): o is QueryParamsRequestSDKType { + return o && o.$typeUrl === QueryParamsRequest.typeUrl; + }, + isAmino(o: any): o is QueryParamsRequestAmino { + return o && o.$typeUrl === QueryParamsRequest.typeUrl; + }, encode(_: QueryParamsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -1702,7 +1875,8 @@ export const QueryParamsRequest = { typeUrl: "/evmos.incentives.v1.QueryParamsRequest", value: QueryParamsRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryParamsResponse(): QueryParamsResponse { return { @@ -1718,6 +1892,15 @@ function createBaseQueryParamsResponse(): QueryParamsResponse { */ export const QueryParamsResponse = { typeUrl: "/evmos.incentives.v1.QueryParamsResponse", + is(o: any): o is QueryParamsResponse { + return o && (o.$typeUrl === QueryParamsResponse.typeUrl || Params.is(o.params)); + }, + isSDK(o: any): o is QueryParamsResponseSDKType { + return o && (o.$typeUrl === QueryParamsResponse.typeUrl || Params.isSDK(o.params)); + }, + isAmino(o: any): o is QueryParamsResponseAmino { + return o && (o.$typeUrl === QueryParamsResponse.typeUrl || Params.isAmino(o.params)); + }, encode(message: QueryParamsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.params !== undefined) { Params.encode(message.params, writer.uint32(10).fork()).ldelim(); @@ -1786,5 +1969,11 @@ export const QueryParamsResponse = { typeUrl: "/evmos.incentives.v1.QueryParamsResponse", value: QueryParamsResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryParamsResponse.typeUrl)) { + return; + } + Params.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/evmos/inflation/v1/genesis.ts b/__fixtures__/v-next/outputv3/evmos/inflation/v1/genesis.ts index 7f08b20d63..6f74028515 100644 --- a/__fixtures__/v-next/outputv3/evmos/inflation/v1/genesis.ts +++ b/__fixtures__/v-next/outputv3/evmos/inflation/v1/genesis.ts @@ -1,5 +1,6 @@ import { ExponentialCalculation, ExponentialCalculationAmino, ExponentialCalculationSDKType, InflationDistribution, InflationDistributionAmino, InflationDistributionSDKType } from "./inflation"; import { BinaryReader, BinaryWriter } from "../../../binary"; +import { GlobalDecoderRegistry } from "../../../registry"; import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "evmos.inflation.v1"; /** @@ -156,6 +157,15 @@ function createBaseGenesisState(): GenesisState { */ export const GenesisState = { typeUrl: "/evmos.inflation.v1.GenesisState", + is(o: any): o is GenesisState { + return o && (o.$typeUrl === GenesisState.typeUrl || Params.is(o.params) && typeof o.period === "bigint" && typeof o.epochIdentifier === "string" && typeof o.epochsPerPeriod === "bigint" && typeof o.skippedEpochs === "bigint"); + }, + isSDK(o: any): o is GenesisStateSDKType { + return o && (o.$typeUrl === GenesisState.typeUrl || Params.isSDK(o.params) && typeof o.period === "bigint" && typeof o.epoch_identifier === "string" && typeof o.epochs_per_period === "bigint" && typeof o.skipped_epochs === "bigint"); + }, + isAmino(o: any): o is GenesisStateAmino { + return o && (o.$typeUrl === GenesisState.typeUrl || Params.isAmino(o.params) && typeof o.period === "bigint" && typeof o.epoch_identifier === "string" && typeof o.epochs_per_period === "bigint" && typeof o.skipped_epochs === "bigint"); + }, encode(message: GenesisState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.params !== undefined) { Params.encode(message.params, writer.uint32(10).fork()).ldelim(); @@ -286,6 +296,12 @@ export const GenesisState = { typeUrl: "/evmos.inflation.v1.GenesisState", value: GenesisState.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GenesisState.typeUrl)) { + return; + } + Params.registerTypeUrl(); } }; function createBaseParams(): Params { @@ -304,6 +320,15 @@ function createBaseParams(): Params { */ export const Params = { typeUrl: "/evmos.inflation.v1.Params", + is(o: any): o is Params { + return o && (o.$typeUrl === Params.typeUrl || typeof o.mintDenom === "string" && ExponentialCalculation.is(o.exponentialCalculation) && InflationDistribution.is(o.inflationDistribution) && typeof o.enableInflation === "boolean"); + }, + isSDK(o: any): o is ParamsSDKType { + return o && (o.$typeUrl === Params.typeUrl || typeof o.mint_denom === "string" && ExponentialCalculation.isSDK(o.exponential_calculation) && InflationDistribution.isSDK(o.inflation_distribution) && typeof o.enable_inflation === "boolean"); + }, + isAmino(o: any): o is ParamsAmino { + return o && (o.$typeUrl === Params.typeUrl || typeof o.mint_denom === "string" && ExponentialCalculation.isAmino(o.exponential_calculation) && InflationDistribution.isAmino(o.inflation_distribution) && typeof o.enable_inflation === "boolean"); + }, encode(message: Params, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.mintDenom !== "") { writer.uint32(10).string(message.mintDenom); @@ -416,5 +441,12 @@ export const Params = { typeUrl: "/evmos.inflation.v1.Params", value: Params.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Params.typeUrl)) { + return; + } + ExponentialCalculation.registerTypeUrl(); + InflationDistribution.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/evmos/inflation/v1/inflation.ts b/__fixtures__/v-next/outputv3/evmos/inflation/v1/inflation.ts index 14241bf359..b779bf7e29 100644 --- a/__fixtures__/v-next/outputv3/evmos/inflation/v1/inflation.ts +++ b/__fixtures__/v-next/outputv3/evmos/inflation/v1/inflation.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { Decimal } from "@cosmjs/math"; +import { Decimal } from "@interchainjs/math"; import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "evmos.inflation.v1"; /** @@ -187,6 +187,15 @@ function createBaseInflationDistribution(): InflationDistribution { */ export const InflationDistribution = { typeUrl: "/evmos.inflation.v1.InflationDistribution", + is(o: any): o is InflationDistribution { + return o && (o.$typeUrl === InflationDistribution.typeUrl || typeof o.stakingRewards === "string" && typeof o.usageIncentives === "string" && typeof o.communityPool === "string"); + }, + isSDK(o: any): o is InflationDistributionSDKType { + return o && (o.$typeUrl === InflationDistribution.typeUrl || typeof o.staking_rewards === "string" && typeof o.usage_incentives === "string" && typeof o.community_pool === "string"); + }, + isAmino(o: any): o is InflationDistributionAmino { + return o && (o.$typeUrl === InflationDistribution.typeUrl || typeof o.staking_rewards === "string" && typeof o.usage_incentives === "string" && typeof o.community_pool === "string"); + }, encode(message: InflationDistribution, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.stakingRewards !== "") { writer.uint32(10).string(Decimal.fromUserInput(message.stakingRewards, 18).atomics); @@ -265,9 +274,9 @@ export const InflationDistribution = { }, toAmino(message: InflationDistribution, useInterfaces: boolean = true): InflationDistributionAmino { const obj: any = {}; - obj.staking_rewards = message.stakingRewards === "" ? undefined : message.stakingRewards; - obj.usage_incentives = message.usageIncentives === "" ? undefined : message.usageIncentives; - obj.community_pool = message.communityPool === "" ? undefined : message.communityPool; + obj.staking_rewards = message.stakingRewards === "" ? undefined : Decimal.fromUserInput(message.stakingRewards, 18).atomics; + obj.usage_incentives = message.usageIncentives === "" ? undefined : Decimal.fromUserInput(message.usageIncentives, 18).atomics; + obj.community_pool = message.communityPool === "" ? undefined : Decimal.fromUserInput(message.communityPool, 18).atomics; return obj; }, fromProtoMsg(message: InflationDistributionProtoMsg, useInterfaces: boolean = true): InflationDistribution { @@ -281,7 +290,8 @@ export const InflationDistribution = { typeUrl: "/evmos.inflation.v1.InflationDistribution", value: InflationDistribution.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseExponentialCalculation(): ExponentialCalculation { return { @@ -304,6 +314,15 @@ function createBaseExponentialCalculation(): ExponentialCalculation { */ export const ExponentialCalculation = { typeUrl: "/evmos.inflation.v1.ExponentialCalculation", + is(o: any): o is ExponentialCalculation { + return o && (o.$typeUrl === ExponentialCalculation.typeUrl || typeof o.a === "string" && typeof o.r === "string" && typeof o.c === "string" && typeof o.bondingTarget === "string" && typeof o.maxVariance === "string"); + }, + isSDK(o: any): o is ExponentialCalculationSDKType { + return o && (o.$typeUrl === ExponentialCalculation.typeUrl || typeof o.a === "string" && typeof o.r === "string" && typeof o.c === "string" && typeof o.bonding_target === "string" && typeof o.max_variance === "string"); + }, + isAmino(o: any): o is ExponentialCalculationAmino { + return o && (o.$typeUrl === ExponentialCalculation.typeUrl || typeof o.a === "string" && typeof o.r === "string" && typeof o.c === "string" && typeof o.bonding_target === "string" && typeof o.max_variance === "string"); + }, encode(message: ExponentialCalculation, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.a !== "") { writer.uint32(10).string(Decimal.fromUserInput(message.a, 18).atomics); @@ -408,11 +427,11 @@ export const ExponentialCalculation = { }, toAmino(message: ExponentialCalculation, useInterfaces: boolean = true): ExponentialCalculationAmino { const obj: any = {}; - obj.a = message.a === "" ? undefined : message.a; - obj.r = message.r === "" ? undefined : message.r; - obj.c = message.c === "" ? undefined : message.c; - obj.bonding_target = message.bondingTarget === "" ? undefined : message.bondingTarget; - obj.max_variance = message.maxVariance === "" ? undefined : message.maxVariance; + obj.a = message.a === "" ? undefined : Decimal.fromUserInput(message.a, 18).atomics; + obj.r = message.r === "" ? undefined : Decimal.fromUserInput(message.r, 18).atomics; + obj.c = message.c === "" ? undefined : Decimal.fromUserInput(message.c, 18).atomics; + obj.bonding_target = message.bondingTarget === "" ? undefined : Decimal.fromUserInput(message.bondingTarget, 18).atomics; + obj.max_variance = message.maxVariance === "" ? undefined : Decimal.fromUserInput(message.maxVariance, 18).atomics; return obj; }, fromProtoMsg(message: ExponentialCalculationProtoMsg, useInterfaces: boolean = true): ExponentialCalculation { @@ -426,5 +445,6 @@ export const ExponentialCalculation = { typeUrl: "/evmos.inflation.v1.ExponentialCalculation", value: ExponentialCalculation.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/evmos/inflation/v1/query.rpc.func.ts b/__fixtures__/v-next/outputv3/evmos/inflation/v1/query.rpc.func.ts new file mode 100644 index 0000000000..690005a1c4 --- /dev/null +++ b/__fixtures__/v-next/outputv3/evmos/inflation/v1/query.rpc.func.ts @@ -0,0 +1,83 @@ +import { DecCoin, DecCoinSDKType } from "../../../cosmos/base/v1beta1/coin"; +import { Params, ParamsSDKType } from "./genesis"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { QueryPeriodRequest, QueryPeriodRequestSDKType, QueryPeriodResponse, QueryPeriodResponseSDKType, QueryEpochMintProvisionRequest, QueryEpochMintProvisionRequestSDKType, QueryEpochMintProvisionResponse, QueryEpochMintProvisionResponseSDKType, QuerySkippedEpochsRequest, QuerySkippedEpochsRequestSDKType, QuerySkippedEpochsResponse, QuerySkippedEpochsResponseSDKType, QueryCirculatingSupplyRequest, QueryCirculatingSupplyRequestSDKType, QueryCirculatingSupplyResponse, QueryCirculatingSupplyResponseSDKType, QueryInflationRateRequest, QueryInflationRateRequestSDKType, QueryInflationRateResponse, QueryInflationRateResponseSDKType, QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType } from "./query"; +/** + * Period retrieves current period. + * @name getPeriod + * @package evmos.inflation.v1 + * @see proto service: evmos.inflation.v1.Period + */ +export const getPeriod = buildQuery({ + encode: QueryPeriodRequest.encode, + decode: QueryPeriodResponse.decode, + service: "evmos.inflation.v1.Query", + method: "Period", + deps: [QueryPeriodRequest, QueryPeriodResponse] +}); +/** + * EpochMintProvision retrieves current minting epoch provision value. + * @name getEpochMintProvision + * @package evmos.inflation.v1 + * @see proto service: evmos.inflation.v1.EpochMintProvision + */ +export const getEpochMintProvision = buildQuery({ + encode: QueryEpochMintProvisionRequest.encode, + decode: QueryEpochMintProvisionResponse.decode, + service: "evmos.inflation.v1.Query", + method: "EpochMintProvision", + deps: [QueryEpochMintProvisionRequest, QueryEpochMintProvisionResponse] +}); +/** + * SkippedEpochs retrieves the total number of skipped epochs. + * @name getSkippedEpochs + * @package evmos.inflation.v1 + * @see proto service: evmos.inflation.v1.SkippedEpochs + */ +export const getSkippedEpochs = buildQuery({ + encode: QuerySkippedEpochsRequest.encode, + decode: QuerySkippedEpochsResponse.decode, + service: "evmos.inflation.v1.Query", + method: "SkippedEpochs", + deps: [QuerySkippedEpochsRequest, QuerySkippedEpochsResponse] +}); +/** + * CirculatingSupply retrieves the total number of tokens that are in + * circulation (i.e. excluding unvested tokens). + * @name getCirculatingSupply + * @package evmos.inflation.v1 + * @see proto service: evmos.inflation.v1.CirculatingSupply + */ +export const getCirculatingSupply = buildQuery({ + encode: QueryCirculatingSupplyRequest.encode, + decode: QueryCirculatingSupplyResponse.decode, + service: "evmos.inflation.v1.Query", + method: "CirculatingSupply", + deps: [QueryCirculatingSupplyRequest, QueryCirculatingSupplyResponse] +}); +/** + * InflationRate retrieves the inflation rate of the current period. + * @name getInflationRate + * @package evmos.inflation.v1 + * @see proto service: evmos.inflation.v1.InflationRate + */ +export const getInflationRate = buildQuery({ + encode: QueryInflationRateRequest.encode, + decode: QueryInflationRateResponse.decode, + service: "evmos.inflation.v1.Query", + method: "InflationRate", + deps: [QueryInflationRateRequest, QueryInflationRateResponse] +}); +/** + * Params retrieves the total set of minting parameters. + * @name getParams + * @package evmos.inflation.v1 + * @see proto service: evmos.inflation.v1.Params + */ +export const getParams = buildQuery({ + encode: QueryParamsRequest.encode, + decode: QueryParamsResponse.decode, + service: "evmos.inflation.v1.Query", + method: "Params", + deps: [QueryParamsRequest, QueryParamsResponse] +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/evmos/inflation/v1/query.ts b/__fixtures__/v-next/outputv3/evmos/inflation/v1/query.ts index 2434a96d59..5c340d13d6 100644 --- a/__fixtures__/v-next/outputv3/evmos/inflation/v1/query.ts +++ b/__fixtures__/v-next/outputv3/evmos/inflation/v1/query.ts @@ -2,7 +2,8 @@ import { DecCoin, DecCoinAmino, DecCoinSDKType } from "../../../cosmos/base/v1be import { Params, ParamsAmino, ParamsSDKType } from "./genesis"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { DeepPartial, isSet } from "../../../helpers"; -import { Decimal } from "@cosmjs/math"; +import { GlobalDecoderRegistry } from "../../../registry"; +import { Decimal } from "@interchainjs/math"; export const protobufPackage = "evmos.inflation.v1"; /** * QueryPeriodRequest is the request type for the Query/Period RPC method. @@ -411,6 +412,15 @@ function createBaseQueryPeriodRequest(): QueryPeriodRequest { */ export const QueryPeriodRequest = { typeUrl: "/evmos.inflation.v1.QueryPeriodRequest", + is(o: any): o is QueryPeriodRequest { + return o && o.$typeUrl === QueryPeriodRequest.typeUrl; + }, + isSDK(o: any): o is QueryPeriodRequestSDKType { + return o && o.$typeUrl === QueryPeriodRequest.typeUrl; + }, + isAmino(o: any): o is QueryPeriodRequestAmino { + return o && o.$typeUrl === QueryPeriodRequest.typeUrl; + }, encode(_: QueryPeriodRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -462,7 +472,8 @@ export const QueryPeriodRequest = { typeUrl: "/evmos.inflation.v1.QueryPeriodRequest", value: QueryPeriodRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryPeriodResponse(): QueryPeriodResponse { return { @@ -477,6 +488,15 @@ function createBaseQueryPeriodResponse(): QueryPeriodResponse { */ export const QueryPeriodResponse = { typeUrl: "/evmos.inflation.v1.QueryPeriodResponse", + is(o: any): o is QueryPeriodResponse { + return o && (o.$typeUrl === QueryPeriodResponse.typeUrl || typeof o.period === "bigint"); + }, + isSDK(o: any): o is QueryPeriodResponseSDKType { + return o && (o.$typeUrl === QueryPeriodResponse.typeUrl || typeof o.period === "bigint"); + }, + isAmino(o: any): o is QueryPeriodResponseAmino { + return o && (o.$typeUrl === QueryPeriodResponse.typeUrl || typeof o.period === "bigint"); + }, encode(message: QueryPeriodResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.period !== BigInt(0)) { writer.uint32(8).uint64(message.period); @@ -545,7 +565,8 @@ export const QueryPeriodResponse = { typeUrl: "/evmos.inflation.v1.QueryPeriodResponse", value: QueryPeriodResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryEpochMintProvisionRequest(): QueryEpochMintProvisionRequest { return {}; @@ -559,6 +580,15 @@ function createBaseQueryEpochMintProvisionRequest(): QueryEpochMintProvisionRequ */ export const QueryEpochMintProvisionRequest = { typeUrl: "/evmos.inflation.v1.QueryEpochMintProvisionRequest", + is(o: any): o is QueryEpochMintProvisionRequest { + return o && o.$typeUrl === QueryEpochMintProvisionRequest.typeUrl; + }, + isSDK(o: any): o is QueryEpochMintProvisionRequestSDKType { + return o && o.$typeUrl === QueryEpochMintProvisionRequest.typeUrl; + }, + isAmino(o: any): o is QueryEpochMintProvisionRequestAmino { + return o && o.$typeUrl === QueryEpochMintProvisionRequest.typeUrl; + }, encode(_: QueryEpochMintProvisionRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -610,7 +640,8 @@ export const QueryEpochMintProvisionRequest = { typeUrl: "/evmos.inflation.v1.QueryEpochMintProvisionRequest", value: QueryEpochMintProvisionRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryEpochMintProvisionResponse(): QueryEpochMintProvisionResponse { return { @@ -626,6 +657,15 @@ function createBaseQueryEpochMintProvisionResponse(): QueryEpochMintProvisionRes */ export const QueryEpochMintProvisionResponse = { typeUrl: "/evmos.inflation.v1.QueryEpochMintProvisionResponse", + is(o: any): o is QueryEpochMintProvisionResponse { + return o && (o.$typeUrl === QueryEpochMintProvisionResponse.typeUrl || DecCoin.is(o.epochMintProvision)); + }, + isSDK(o: any): o is QueryEpochMintProvisionResponseSDKType { + return o && (o.$typeUrl === QueryEpochMintProvisionResponse.typeUrl || DecCoin.isSDK(o.epoch_mint_provision)); + }, + isAmino(o: any): o is QueryEpochMintProvisionResponseAmino { + return o && (o.$typeUrl === QueryEpochMintProvisionResponse.typeUrl || DecCoin.isAmino(o.epoch_mint_provision)); + }, encode(message: QueryEpochMintProvisionResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.epochMintProvision !== undefined) { DecCoin.encode(message.epochMintProvision, writer.uint32(10).fork()).ldelim(); @@ -694,6 +734,12 @@ export const QueryEpochMintProvisionResponse = { typeUrl: "/evmos.inflation.v1.QueryEpochMintProvisionResponse", value: QueryEpochMintProvisionResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryEpochMintProvisionResponse.typeUrl)) { + return; + } + DecCoin.registerTypeUrl(); } }; function createBaseQuerySkippedEpochsRequest(): QuerySkippedEpochsRequest { @@ -708,6 +754,15 @@ function createBaseQuerySkippedEpochsRequest(): QuerySkippedEpochsRequest { */ export const QuerySkippedEpochsRequest = { typeUrl: "/evmos.inflation.v1.QuerySkippedEpochsRequest", + is(o: any): o is QuerySkippedEpochsRequest { + return o && o.$typeUrl === QuerySkippedEpochsRequest.typeUrl; + }, + isSDK(o: any): o is QuerySkippedEpochsRequestSDKType { + return o && o.$typeUrl === QuerySkippedEpochsRequest.typeUrl; + }, + isAmino(o: any): o is QuerySkippedEpochsRequestAmino { + return o && o.$typeUrl === QuerySkippedEpochsRequest.typeUrl; + }, encode(_: QuerySkippedEpochsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -759,7 +814,8 @@ export const QuerySkippedEpochsRequest = { typeUrl: "/evmos.inflation.v1.QuerySkippedEpochsRequest", value: QuerySkippedEpochsRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQuerySkippedEpochsResponse(): QuerySkippedEpochsResponse { return { @@ -775,6 +831,15 @@ function createBaseQuerySkippedEpochsResponse(): QuerySkippedEpochsResponse { */ export const QuerySkippedEpochsResponse = { typeUrl: "/evmos.inflation.v1.QuerySkippedEpochsResponse", + is(o: any): o is QuerySkippedEpochsResponse { + return o && (o.$typeUrl === QuerySkippedEpochsResponse.typeUrl || typeof o.skippedEpochs === "bigint"); + }, + isSDK(o: any): o is QuerySkippedEpochsResponseSDKType { + return o && (o.$typeUrl === QuerySkippedEpochsResponse.typeUrl || typeof o.skipped_epochs === "bigint"); + }, + isAmino(o: any): o is QuerySkippedEpochsResponseAmino { + return o && (o.$typeUrl === QuerySkippedEpochsResponse.typeUrl || typeof o.skipped_epochs === "bigint"); + }, encode(message: QuerySkippedEpochsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.skippedEpochs !== BigInt(0)) { writer.uint32(8).uint64(message.skippedEpochs); @@ -843,7 +908,8 @@ export const QuerySkippedEpochsResponse = { typeUrl: "/evmos.inflation.v1.QuerySkippedEpochsResponse", value: QuerySkippedEpochsResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryCirculatingSupplyRequest(): QueryCirculatingSupplyRequest { return {}; @@ -857,6 +923,15 @@ function createBaseQueryCirculatingSupplyRequest(): QueryCirculatingSupplyReques */ export const QueryCirculatingSupplyRequest = { typeUrl: "/evmos.inflation.v1.QueryCirculatingSupplyRequest", + is(o: any): o is QueryCirculatingSupplyRequest { + return o && o.$typeUrl === QueryCirculatingSupplyRequest.typeUrl; + }, + isSDK(o: any): o is QueryCirculatingSupplyRequestSDKType { + return o && o.$typeUrl === QueryCirculatingSupplyRequest.typeUrl; + }, + isAmino(o: any): o is QueryCirculatingSupplyRequestAmino { + return o && o.$typeUrl === QueryCirculatingSupplyRequest.typeUrl; + }, encode(_: QueryCirculatingSupplyRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -908,7 +983,8 @@ export const QueryCirculatingSupplyRequest = { typeUrl: "/evmos.inflation.v1.QueryCirculatingSupplyRequest", value: QueryCirculatingSupplyRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryCirculatingSupplyResponse(): QueryCirculatingSupplyResponse { return { @@ -924,6 +1000,15 @@ function createBaseQueryCirculatingSupplyResponse(): QueryCirculatingSupplyRespo */ export const QueryCirculatingSupplyResponse = { typeUrl: "/evmos.inflation.v1.QueryCirculatingSupplyResponse", + is(o: any): o is QueryCirculatingSupplyResponse { + return o && (o.$typeUrl === QueryCirculatingSupplyResponse.typeUrl || DecCoin.is(o.circulatingSupply)); + }, + isSDK(o: any): o is QueryCirculatingSupplyResponseSDKType { + return o && (o.$typeUrl === QueryCirculatingSupplyResponse.typeUrl || DecCoin.isSDK(o.circulating_supply)); + }, + isAmino(o: any): o is QueryCirculatingSupplyResponseAmino { + return o && (o.$typeUrl === QueryCirculatingSupplyResponse.typeUrl || DecCoin.isAmino(o.circulating_supply)); + }, encode(message: QueryCirculatingSupplyResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.circulatingSupply !== undefined) { DecCoin.encode(message.circulatingSupply, writer.uint32(10).fork()).ldelim(); @@ -992,6 +1077,12 @@ export const QueryCirculatingSupplyResponse = { typeUrl: "/evmos.inflation.v1.QueryCirculatingSupplyResponse", value: QueryCirculatingSupplyResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryCirculatingSupplyResponse.typeUrl)) { + return; + } + DecCoin.registerTypeUrl(); } }; function createBaseQueryInflationRateRequest(): QueryInflationRateRequest { @@ -1006,6 +1097,15 @@ function createBaseQueryInflationRateRequest(): QueryInflationRateRequest { */ export const QueryInflationRateRequest = { typeUrl: "/evmos.inflation.v1.QueryInflationRateRequest", + is(o: any): o is QueryInflationRateRequest { + return o && o.$typeUrl === QueryInflationRateRequest.typeUrl; + }, + isSDK(o: any): o is QueryInflationRateRequestSDKType { + return o && o.$typeUrl === QueryInflationRateRequest.typeUrl; + }, + isAmino(o: any): o is QueryInflationRateRequestAmino { + return o && o.$typeUrl === QueryInflationRateRequest.typeUrl; + }, encode(_: QueryInflationRateRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -1057,7 +1157,8 @@ export const QueryInflationRateRequest = { typeUrl: "/evmos.inflation.v1.QueryInflationRateRequest", value: QueryInflationRateRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryInflationRateResponse(): QueryInflationRateResponse { return { @@ -1073,6 +1174,15 @@ function createBaseQueryInflationRateResponse(): QueryInflationRateResponse { */ export const QueryInflationRateResponse = { typeUrl: "/evmos.inflation.v1.QueryInflationRateResponse", + is(o: any): o is QueryInflationRateResponse { + return o && (o.$typeUrl === QueryInflationRateResponse.typeUrl || typeof o.inflationRate === "string"); + }, + isSDK(o: any): o is QueryInflationRateResponseSDKType { + return o && (o.$typeUrl === QueryInflationRateResponse.typeUrl || typeof o.inflation_rate === "string"); + }, + isAmino(o: any): o is QueryInflationRateResponseAmino { + return o && (o.$typeUrl === QueryInflationRateResponse.typeUrl || typeof o.inflation_rate === "string"); + }, encode(message: QueryInflationRateResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.inflationRate !== "") { writer.uint32(10).string(Decimal.fromUserInput(message.inflationRate, 18).atomics); @@ -1125,7 +1235,7 @@ export const QueryInflationRateResponse = { }, toAmino(message: QueryInflationRateResponse, useInterfaces: boolean = true): QueryInflationRateResponseAmino { const obj: any = {}; - obj.inflation_rate = message.inflationRate === "" ? undefined : message.inflationRate; + obj.inflation_rate = message.inflationRate === "" ? undefined : Decimal.fromUserInput(message.inflationRate, 18).atomics; return obj; }, fromProtoMsg(message: QueryInflationRateResponseProtoMsg, useInterfaces: boolean = true): QueryInflationRateResponse { @@ -1139,7 +1249,8 @@ export const QueryInflationRateResponse = { typeUrl: "/evmos.inflation.v1.QueryInflationRateResponse", value: QueryInflationRateResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryParamsRequest(): QueryParamsRequest { return {}; @@ -1152,6 +1263,15 @@ function createBaseQueryParamsRequest(): QueryParamsRequest { */ export const QueryParamsRequest = { typeUrl: "/evmos.inflation.v1.QueryParamsRequest", + is(o: any): o is QueryParamsRequest { + return o && o.$typeUrl === QueryParamsRequest.typeUrl; + }, + isSDK(o: any): o is QueryParamsRequestSDKType { + return o && o.$typeUrl === QueryParamsRequest.typeUrl; + }, + isAmino(o: any): o is QueryParamsRequestAmino { + return o && o.$typeUrl === QueryParamsRequest.typeUrl; + }, encode(_: QueryParamsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -1203,7 +1323,8 @@ export const QueryParamsRequest = { typeUrl: "/evmos.inflation.v1.QueryParamsRequest", value: QueryParamsRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryParamsResponse(): QueryParamsResponse { return { @@ -1218,6 +1339,15 @@ function createBaseQueryParamsResponse(): QueryParamsResponse { */ export const QueryParamsResponse = { typeUrl: "/evmos.inflation.v1.QueryParamsResponse", + is(o: any): o is QueryParamsResponse { + return o && (o.$typeUrl === QueryParamsResponse.typeUrl || Params.is(o.params)); + }, + isSDK(o: any): o is QueryParamsResponseSDKType { + return o && (o.$typeUrl === QueryParamsResponse.typeUrl || Params.isSDK(o.params)); + }, + isAmino(o: any): o is QueryParamsResponseAmino { + return o && (o.$typeUrl === QueryParamsResponse.typeUrl || Params.isAmino(o.params)); + }, encode(message: QueryParamsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.params !== undefined) { Params.encode(message.params, writer.uint32(10).fork()).ldelim(); @@ -1286,5 +1416,11 @@ export const QueryParamsResponse = { typeUrl: "/evmos.inflation.v1.QueryParamsResponse", value: QueryParamsResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryParamsResponse.typeUrl)) { + return; + } + Params.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/evmos/recovery/v1/genesis.ts b/__fixtures__/v-next/outputv3/evmos/recovery/v1/genesis.ts index 910512a39e..d1c162b08c 100644 --- a/__fixtures__/v-next/outputv3/evmos/recovery/v1/genesis.ts +++ b/__fixtures__/v-next/outputv3/evmos/recovery/v1/genesis.ts @@ -1,5 +1,6 @@ import { Duration, DurationAmino, DurationSDKType } from "../../../google/protobuf/duration"; import { BinaryReader, BinaryWriter } from "../../../binary"; +import { GlobalDecoderRegistry } from "../../../registry"; import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "evmos.recovery.v1"; /** @@ -98,6 +99,15 @@ function createBaseGenesisState(): GenesisState { */ export const GenesisState = { typeUrl: "/evmos.recovery.v1.GenesisState", + is(o: any): o is GenesisState { + return o && (o.$typeUrl === GenesisState.typeUrl || Params.is(o.params)); + }, + isSDK(o: any): o is GenesisStateSDKType { + return o && (o.$typeUrl === GenesisState.typeUrl || Params.isSDK(o.params)); + }, + isAmino(o: any): o is GenesisStateAmino { + return o && (o.$typeUrl === GenesisState.typeUrl || Params.isAmino(o.params)); + }, encode(message: GenesisState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.params !== undefined) { Params.encode(message.params, writer.uint32(10).fork()).ldelim(); @@ -166,6 +176,12 @@ export const GenesisState = { typeUrl: "/evmos.recovery.v1.GenesisState", value: GenesisState.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GenesisState.typeUrl)) { + return; + } + Params.registerTypeUrl(); } }; function createBaseParams(): Params { @@ -182,6 +198,15 @@ function createBaseParams(): Params { */ export const Params = { typeUrl: "/evmos.recovery.v1.Params", + is(o: any): o is Params { + return o && (o.$typeUrl === Params.typeUrl || typeof o.enableRecovery === "boolean" && Duration.is(o.packetTimeoutDuration)); + }, + isSDK(o: any): o is ParamsSDKType { + return o && (o.$typeUrl === Params.typeUrl || typeof o.enable_recovery === "boolean" && Duration.isSDK(o.packet_timeout_duration)); + }, + isAmino(o: any): o is ParamsAmino { + return o && (o.$typeUrl === Params.typeUrl || typeof o.enable_recovery === "boolean" && Duration.isAmino(o.packet_timeout_duration)); + }, encode(message: Params, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.enableRecovery === true) { writer.uint32(8).bool(message.enableRecovery); @@ -264,5 +289,6 @@ export const Params = { typeUrl: "/evmos.recovery.v1.Params", value: Params.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/evmos/recovery/v1/query.rpc.func.ts b/__fixtures__/v-next/outputv3/evmos/recovery/v1/query.rpc.func.ts new file mode 100644 index 0000000000..d830b92e4b --- /dev/null +++ b/__fixtures__/v-next/outputv3/evmos/recovery/v1/query.rpc.func.ts @@ -0,0 +1,16 @@ +import { Params, ParamsSDKType } from "./genesis"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType } from "./query"; +/** + * Params retrieves the total set of recovery parameters. + * @name getParams + * @package evmos.recovery.v1 + * @see proto service: evmos.recovery.v1.Params + */ +export const getParams = buildQuery({ + encode: QueryParamsRequest.encode, + decode: QueryParamsResponse.decode, + service: "evmos.recovery.v1.Query", + method: "Params", + deps: [QueryParamsRequest, QueryParamsResponse] +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/evmos/recovery/v1/query.ts b/__fixtures__/v-next/outputv3/evmos/recovery/v1/query.ts index e863445b43..bdd74702ff 100644 --- a/__fixtures__/v-next/outputv3/evmos/recovery/v1/query.ts +++ b/__fixtures__/v-next/outputv3/evmos/recovery/v1/query.ts @@ -1,6 +1,7 @@ import { Params, ParamsAmino, ParamsSDKType } from "./genesis"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { DeepPartial, isSet } from "../../../helpers"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "evmos.recovery.v1"; /** * QueryParamsRequest is the request type for the Query/Params RPC method. @@ -75,6 +76,15 @@ function createBaseQueryParamsRequest(): QueryParamsRequest { */ export const QueryParamsRequest = { typeUrl: "/evmos.recovery.v1.QueryParamsRequest", + is(o: any): o is QueryParamsRequest { + return o && o.$typeUrl === QueryParamsRequest.typeUrl; + }, + isSDK(o: any): o is QueryParamsRequestSDKType { + return o && o.$typeUrl === QueryParamsRequest.typeUrl; + }, + isAmino(o: any): o is QueryParamsRequestAmino { + return o && o.$typeUrl === QueryParamsRequest.typeUrl; + }, encode(_: QueryParamsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -126,7 +136,8 @@ export const QueryParamsRequest = { typeUrl: "/evmos.recovery.v1.QueryParamsRequest", value: QueryParamsRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryParamsResponse(): QueryParamsResponse { return { @@ -141,6 +152,15 @@ function createBaseQueryParamsResponse(): QueryParamsResponse { */ export const QueryParamsResponse = { typeUrl: "/evmos.recovery.v1.QueryParamsResponse", + is(o: any): o is QueryParamsResponse { + return o && (o.$typeUrl === QueryParamsResponse.typeUrl || Params.is(o.params)); + }, + isSDK(o: any): o is QueryParamsResponseSDKType { + return o && (o.$typeUrl === QueryParamsResponse.typeUrl || Params.isSDK(o.params)); + }, + isAmino(o: any): o is QueryParamsResponseAmino { + return o && (o.$typeUrl === QueryParamsResponse.typeUrl || Params.isAmino(o.params)); + }, encode(message: QueryParamsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.params !== undefined) { Params.encode(message.params, writer.uint32(10).fork()).ldelim(); @@ -209,5 +229,11 @@ export const QueryParamsResponse = { typeUrl: "/evmos.recovery.v1.QueryParamsResponse", value: QueryParamsResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryParamsResponse.typeUrl)) { + return; + } + Params.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/evmos/vesting/v1/query.rpc.func.ts b/__fixtures__/v-next/outputv3/evmos/vesting/v1/query.rpc.func.ts new file mode 100644 index 0000000000..1b7afe13ea --- /dev/null +++ b/__fixtures__/v-next/outputv3/evmos/vesting/v1/query.rpc.func.ts @@ -0,0 +1,16 @@ +import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { QueryBalancesRequest, QueryBalancesRequestSDKType, QueryBalancesResponse, QueryBalancesResponseSDKType } from "./query"; +/** + * Retrieves the unvested, vested and locked tokens for a vesting account + * @name getBalances + * @package evmos.vesting.v1 + * @see proto service: evmos.vesting.v1.Balances + */ +export const getBalances = buildQuery({ + encode: QueryBalancesRequest.encode, + decode: QueryBalancesResponse.decode, + service: "evmos.vesting.v1.Query", + method: "Balances", + deps: [QueryBalancesRequest, QueryBalancesResponse] +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/evmos/vesting/v1/query.ts b/__fixtures__/v-next/outputv3/evmos/vesting/v1/query.ts index 184c5a5b9c..c4fe9fa844 100644 --- a/__fixtures__/v-next/outputv3/evmos/vesting/v1/query.ts +++ b/__fixtures__/v-next/outputv3/evmos/vesting/v1/query.ts @@ -1,6 +1,7 @@ import { Coin, CoinAmino, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { isSet, DeepPartial } from "../../../helpers"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "evmos.vesting.v1"; /** * QueryBalancesRequest is the request type for the Query/Balances RPC method. @@ -110,6 +111,15 @@ function createBaseQueryBalancesRequest(): QueryBalancesRequest { */ export const QueryBalancesRequest = { typeUrl: "/evmos.vesting.v1.QueryBalancesRequest", + is(o: any): o is QueryBalancesRequest { + return o && (o.$typeUrl === QueryBalancesRequest.typeUrl || typeof o.address === "string"); + }, + isSDK(o: any): o is QueryBalancesRequestSDKType { + return o && (o.$typeUrl === QueryBalancesRequest.typeUrl || typeof o.address === "string"); + }, + isAmino(o: any): o is QueryBalancesRequestAmino { + return o && (o.$typeUrl === QueryBalancesRequest.typeUrl || typeof o.address === "string"); + }, encode(message: QueryBalancesRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.address !== "") { writer.uint32(10).string(message.address); @@ -176,7 +186,8 @@ export const QueryBalancesRequest = { typeUrl: "/evmos.vesting.v1.QueryBalancesRequest", value: QueryBalancesRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryBalancesResponse(): QueryBalancesResponse { return { @@ -194,6 +205,15 @@ function createBaseQueryBalancesResponse(): QueryBalancesResponse { */ export const QueryBalancesResponse = { typeUrl: "/evmos.vesting.v1.QueryBalancesResponse", + is(o: any): o is QueryBalancesResponse { + return o && (o.$typeUrl === QueryBalancesResponse.typeUrl || Array.isArray(o.locked) && (!o.locked.length || Coin.is(o.locked[0])) && Array.isArray(o.unvested) && (!o.unvested.length || Coin.is(o.unvested[0])) && Array.isArray(o.vested) && (!o.vested.length || Coin.is(o.vested[0]))); + }, + isSDK(o: any): o is QueryBalancesResponseSDKType { + return o && (o.$typeUrl === QueryBalancesResponse.typeUrl || Array.isArray(o.locked) && (!o.locked.length || Coin.isSDK(o.locked[0])) && Array.isArray(o.unvested) && (!o.unvested.length || Coin.isSDK(o.unvested[0])) && Array.isArray(o.vested) && (!o.vested.length || Coin.isSDK(o.vested[0]))); + }, + isAmino(o: any): o is QueryBalancesResponseAmino { + return o && (o.$typeUrl === QueryBalancesResponse.typeUrl || Array.isArray(o.locked) && (!o.locked.length || Coin.isAmino(o.locked[0])) && Array.isArray(o.unvested) && (!o.unvested.length || Coin.isAmino(o.unvested[0])) && Array.isArray(o.vested) && (!o.vested.length || Coin.isAmino(o.vested[0]))); + }, encode(message: QueryBalancesResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.locked) { Coin.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -306,5 +326,11 @@ export const QueryBalancesResponse = { typeUrl: "/evmos.vesting.v1.QueryBalancesResponse", value: QueryBalancesResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryBalancesResponse.typeUrl)) { + return; + } + Coin.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/evmos/vesting/v1/tx.registry.ts b/__fixtures__/v-next/outputv3/evmos/vesting/v1/tx.registry.ts index 0fc9576eed..f288e1c1fd 100644 --- a/__fixtures__/v-next/outputv3/evmos/vesting/v1/tx.registry.ts +++ b/__fixtures__/v-next/outputv3/evmos/vesting/v1/tx.registry.ts @@ -1,13 +1,8 @@ import { Timestamp, TimestampSDKType } from "../../../google/protobuf/timestamp"; import { Period, PeriodSDKType } from "../../../cosmos/vesting/v1beta1/vesting"; -import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { TelescopeGeneratedType } from "../../../types"; import { MsgCreateClawbackVestingAccount, MsgCreateClawbackVestingAccountSDKType, MsgClawback, MsgClawbackSDKType } from "./tx"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/evmos.vesting.v1.MsgCreateClawbackVestingAccount", MsgCreateClawbackVestingAccount], ["/evmos.vesting.v1.MsgClawback", MsgClawback]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/evmos.vesting.v1.MsgCreateClawbackVestingAccount", MsgCreateClawbackVestingAccount], ["/evmos.vesting.v1.MsgClawback", MsgClawback]]; export const MessageComposer = { encoded: { createClawbackVestingAccount(value: MsgCreateClawbackVestingAccount) { diff --git a/__fixtures__/v-next/outputv3/evmos/vesting/v1/tx.rpc.func.ts b/__fixtures__/v-next/outputv3/evmos/vesting/v1/tx.rpc.func.ts new file mode 100644 index 0000000000..a00219b97b --- /dev/null +++ b/__fixtures__/v-next/outputv3/evmos/vesting/v1/tx.rpc.func.ts @@ -0,0 +1,23 @@ +import { Timestamp, TimestampSDKType } from "../../../google/protobuf/timestamp"; +import { Period, PeriodSDKType } from "../../../cosmos/vesting/v1beta1/vesting"; +import { buildTx } from "../../../helper-func-types"; +import { MsgCreateClawbackVestingAccount, MsgCreateClawbackVestingAccountSDKType, MsgCreateClawbackVestingAccountResponse, MsgCreateClawbackVestingAccountResponseSDKType, MsgClawback, MsgClawbackSDKType, MsgClawbackResponse, MsgClawbackResponseSDKType } from "./tx"; +/** + * CreateClawbackVestingAccount creats a vesting account that is subject to + * clawback and the configuration of vesting and lockup schedules. + * @name createClawbackVestingAccount + * @package evmos.vesting.v1 + * @see proto service: evmos.vesting.v1.CreateClawbackVestingAccount + */ +export const createClawbackVestingAccount = buildTx({ + msg: MsgCreateClawbackVestingAccount +}); +/** + * Clawback removes the unvested tokens from a ClawbackVestingAccount. + * @name clawback + * @package evmos.vesting.v1 + * @see proto service: evmos.vesting.v1.Clawback + */ +export const clawback = buildTx({ + msg: MsgClawback +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/evmos/vesting/v1/tx.ts b/__fixtures__/v-next/outputv3/evmos/vesting/v1/tx.ts index a86bfd3ce7..1dc922cba5 100644 --- a/__fixtures__/v-next/outputv3/evmos/vesting/v1/tx.ts +++ b/__fixtures__/v-next/outputv3/evmos/vesting/v1/tx.ts @@ -2,6 +2,7 @@ import { Timestamp, TimestampAmino, TimestampSDKType } from "../../../google/pro import { Period, PeriodAmino, PeriodSDKType } from "../../../cosmos/vesting/v1beta1/vesting"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { toTimestamp, fromTimestamp, isSet, DeepPartial } from "../../../helpers"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "evmos.vesting.v1"; /** * MsgCreateClawbackVestingAccount defines a message that enables creating a ClawbackVestingAccount. @@ -228,6 +229,15 @@ function createBaseMsgCreateClawbackVestingAccount(): MsgCreateClawbackVestingAc */ export const MsgCreateClawbackVestingAccount = { typeUrl: "/evmos.vesting.v1.MsgCreateClawbackVestingAccount", + is(o: any): o is MsgCreateClawbackVestingAccount { + return o && (o.$typeUrl === MsgCreateClawbackVestingAccount.typeUrl || typeof o.fromAddress === "string" && typeof o.toAddress === "string" && Timestamp.is(o.startTime) && Array.isArray(o.lockupPeriods) && (!o.lockupPeriods.length || Period.is(o.lockupPeriods[0])) && Array.isArray(o.vestingPeriods) && (!o.vestingPeriods.length || Period.is(o.vestingPeriods[0])) && typeof o.merge === "boolean"); + }, + isSDK(o: any): o is MsgCreateClawbackVestingAccountSDKType { + return o && (o.$typeUrl === MsgCreateClawbackVestingAccount.typeUrl || typeof o.from_address === "string" && typeof o.to_address === "string" && Timestamp.isSDK(o.start_time) && Array.isArray(o.lockup_periods) && (!o.lockup_periods.length || Period.isSDK(o.lockup_periods[0])) && Array.isArray(o.vesting_periods) && (!o.vesting_periods.length || Period.isSDK(o.vesting_periods[0])) && typeof o.merge === "boolean"); + }, + isAmino(o: any): o is MsgCreateClawbackVestingAccountAmino { + return o && (o.$typeUrl === MsgCreateClawbackVestingAccount.typeUrl || typeof o.from_address === "string" && typeof o.to_address === "string" && Timestamp.isAmino(o.start_time) && Array.isArray(o.lockup_periods) && (!o.lockup_periods.length || Period.isAmino(o.lockup_periods[0])) && Array.isArray(o.vesting_periods) && (!o.vesting_periods.length || Period.isAmino(o.vesting_periods[0])) && typeof o.merge === "boolean"); + }, encode(message: MsgCreateClawbackVestingAccount, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.fromAddress !== "") { writer.uint32(10).string(message.fromAddress); @@ -376,6 +386,12 @@ export const MsgCreateClawbackVestingAccount = { typeUrl: "/evmos.vesting.v1.MsgCreateClawbackVestingAccount", value: MsgCreateClawbackVestingAccount.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgCreateClawbackVestingAccount.typeUrl)) { + return; + } + Period.registerTypeUrl(); } }; function createBaseMsgCreateClawbackVestingAccountResponse(): MsgCreateClawbackVestingAccountResponse { @@ -390,6 +406,15 @@ function createBaseMsgCreateClawbackVestingAccountResponse(): MsgCreateClawbackV */ export const MsgCreateClawbackVestingAccountResponse = { typeUrl: "/evmos.vesting.v1.MsgCreateClawbackVestingAccountResponse", + is(o: any): o is MsgCreateClawbackVestingAccountResponse { + return o && o.$typeUrl === MsgCreateClawbackVestingAccountResponse.typeUrl; + }, + isSDK(o: any): o is MsgCreateClawbackVestingAccountResponseSDKType { + return o && o.$typeUrl === MsgCreateClawbackVestingAccountResponse.typeUrl; + }, + isAmino(o: any): o is MsgCreateClawbackVestingAccountResponseAmino { + return o && o.$typeUrl === MsgCreateClawbackVestingAccountResponse.typeUrl; + }, encode(_: MsgCreateClawbackVestingAccountResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -441,7 +466,8 @@ export const MsgCreateClawbackVestingAccountResponse = { typeUrl: "/evmos.vesting.v1.MsgCreateClawbackVestingAccountResponse", value: MsgCreateClawbackVestingAccountResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgClawback(): MsgClawback { return { @@ -459,6 +485,15 @@ function createBaseMsgClawback(): MsgClawback { */ export const MsgClawback = { typeUrl: "/evmos.vesting.v1.MsgClawback", + is(o: any): o is MsgClawback { + return o && (o.$typeUrl === MsgClawback.typeUrl || typeof o.funderAddress === "string" && typeof o.accountAddress === "string" && typeof o.destAddress === "string"); + }, + isSDK(o: any): o is MsgClawbackSDKType { + return o && (o.$typeUrl === MsgClawback.typeUrl || typeof o.funder_address === "string" && typeof o.account_address === "string" && typeof o.dest_address === "string"); + }, + isAmino(o: any): o is MsgClawbackAmino { + return o && (o.$typeUrl === MsgClawback.typeUrl || typeof o.funder_address === "string" && typeof o.account_address === "string" && typeof o.dest_address === "string"); + }, encode(message: MsgClawback, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.funderAddress !== "") { writer.uint32(10).string(message.funderAddress); @@ -553,7 +588,8 @@ export const MsgClawback = { typeUrl: "/evmos.vesting.v1.MsgClawback", value: MsgClawback.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgClawbackResponse(): MsgClawbackResponse { return {}; @@ -566,6 +602,15 @@ function createBaseMsgClawbackResponse(): MsgClawbackResponse { */ export const MsgClawbackResponse = { typeUrl: "/evmos.vesting.v1.MsgClawbackResponse", + is(o: any): o is MsgClawbackResponse { + return o && o.$typeUrl === MsgClawbackResponse.typeUrl; + }, + isSDK(o: any): o is MsgClawbackResponseSDKType { + return o && o.$typeUrl === MsgClawbackResponse.typeUrl; + }, + isAmino(o: any): o is MsgClawbackResponseAmino { + return o && o.$typeUrl === MsgClawbackResponse.typeUrl; + }, encode(_: MsgClawbackResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -617,5 +662,6 @@ export const MsgClawbackResponse = { typeUrl: "/evmos.vesting.v1.MsgClawbackResponse", value: MsgClawbackResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/evmos/vesting/v1/vesting.ts b/__fixtures__/v-next/outputv3/evmos/vesting/v1/vesting.ts index 42fc2b021f..233b68b503 100644 --- a/__fixtures__/v-next/outputv3/evmos/vesting/v1/vesting.ts +++ b/__fixtures__/v-next/outputv3/evmos/vesting/v1/vesting.ts @@ -1,6 +1,7 @@ import { BaseVestingAccount, BaseVestingAccountAmino, BaseVestingAccountSDKType, Period, PeriodAmino, PeriodSDKType } from "../../../cosmos/vesting/v1beta1/vesting"; import { Timestamp, TimestampAmino, TimestampSDKType } from "../../../google/protobuf/timestamp"; import { BinaryReader, BinaryWriter } from "../../../binary"; +import { GlobalDecoderRegistry } from "../../../registry"; import { toTimestamp, fromTimestamp, isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "evmos.vesting.v1"; /** @@ -107,6 +108,15 @@ function createBaseClawbackVestingAccount(): ClawbackVestingAccount { */ export const ClawbackVestingAccount = { typeUrl: "/evmos.vesting.v1.ClawbackVestingAccount", + is(o: any): o is ClawbackVestingAccount { + return o && (o.$typeUrl === ClawbackVestingAccount.typeUrl || typeof o.funderAddress === "string" && Timestamp.is(o.startTime) && Array.isArray(o.lockupPeriods) && (!o.lockupPeriods.length || Period.is(o.lockupPeriods[0])) && Array.isArray(o.vestingPeriods) && (!o.vestingPeriods.length || Period.is(o.vestingPeriods[0]))); + }, + isSDK(o: any): o is ClawbackVestingAccountSDKType { + return o && (o.$typeUrl === ClawbackVestingAccount.typeUrl || typeof o.funder_address === "string" && Timestamp.isSDK(o.start_time) && Array.isArray(o.lockup_periods) && (!o.lockup_periods.length || Period.isSDK(o.lockup_periods[0])) && Array.isArray(o.vesting_periods) && (!o.vesting_periods.length || Period.isSDK(o.vesting_periods[0]))); + }, + isAmino(o: any): o is ClawbackVestingAccountAmino { + return o && (o.$typeUrl === ClawbackVestingAccount.typeUrl || typeof o.funder_address === "string" && Timestamp.isAmino(o.start_time) && Array.isArray(o.lockup_periods) && (!o.lockup_periods.length || Period.isAmino(o.lockup_periods[0])) && Array.isArray(o.vesting_periods) && (!o.vesting_periods.length || Period.isAmino(o.vesting_periods[0]))); + }, encode(message: ClawbackVestingAccount, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.baseVestingAccount !== undefined) { BaseVestingAccount.encode(message.baseVestingAccount, writer.uint32(10).fork()).ldelim(); @@ -243,5 +253,12 @@ export const ClawbackVestingAccount = { typeUrl: "/evmos.vesting.v1.ClawbackVestingAccount", value: ClawbackVestingAccount.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ClawbackVestingAccount.typeUrl)) { + return; + } + BaseVestingAccount.registerTypeUrl(); + Period.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/extern.ts b/__fixtures__/v-next/outputv3/extern.ts new file mode 100644 index 0000000000..83d6864ae2 --- /dev/null +++ b/__fixtures__/v-next/outputv3/extern.ts @@ -0,0 +1,48 @@ +/** +* This file and any referenced files were automatically generated by @hyperweb/telescope@latest +* DO NOT MODIFY BY HAND. Instead, download the latest proto files for your chain +* and run the transpile command or npm scripts command that is used to regenerate this bundle. +*/ + + +import { HttpEndpoint } from "@interchainjs/types"; +import { Rpc } from "./helpers"; +import { ClientOptions, createCosmosQueryClient } from "@interchainjs/cosmos"; + +const _rpcClients: Record = {}; + +export const getRpcEndpointKey = (rpcEndpoint: string | HttpEndpoint) => { + if (typeof rpcEndpoint === 'string') { + return rpcEndpoint; + } else if (!!rpcEndpoint) { + //@ts-ignore + return rpcEndpoint.url; + } +} + +export const getRpcClient = async (rpcEndpoint: string | HttpEndpoint) => { + const key = getRpcEndpointKey(rpcEndpoint); + if (!key) return; + if (_rpcClients.hasOwnProperty(key)) { + return _rpcClients[key]; + } + const rpc = await createRpcClient(rpcEndpoint); + _rpcClients[key] = rpc; + return rpc; +} + +export const createRpcClient = async (rpcEndpoint: string | HttpEndpoint, + options?: ClientOptions +) => { + if (typeof rpcEndpoint === 'string') { + return createCosmosQueryClient(rpcEndpoint, options); + } else { + const endpointStr = rpcEndpoint.url; + const clientOptions = { + ...options, + headers: rpcEndpoint.headers + }; + + return createCosmosQueryClient(endpointStr, clientOptions); + } +} diff --git a/__fixtures__/v-next/outputv3/google/api/auth.ts b/__fixtures__/v-next/outputv3/google/api/auth.ts index d226547b90..e0f70068e9 100644 --- a/__fixtures__/v-next/outputv3/google/api/auth.ts +++ b/__fixtures__/v-next/outputv3/google/api/auth.ts @@ -1,5 +1,6 @@ import { BinaryReader, BinaryWriter } from "../../binary"; import { DeepPartial, isSet } from "../../helpers"; +import { GlobalDecoderRegistry } from "../../registry"; export const protobufPackage = "google.api"; /** * `Authentication` defines the authentication configuration for API methods @@ -678,6 +679,15 @@ function createBaseAuthentication(): Authentication { */ export const Authentication = { typeUrl: "/google.api.Authentication", + is(o: any): o is Authentication { + return o && (o.$typeUrl === Authentication.typeUrl || Array.isArray(o.rules) && (!o.rules.length || AuthenticationRule.is(o.rules[0])) && Array.isArray(o.providers) && (!o.providers.length || AuthProvider.is(o.providers[0]))); + }, + isSDK(o: any): o is AuthenticationSDKType { + return o && (o.$typeUrl === Authentication.typeUrl || Array.isArray(o.rules) && (!o.rules.length || AuthenticationRule.isSDK(o.rules[0])) && Array.isArray(o.providers) && (!o.providers.length || AuthProvider.isSDK(o.providers[0]))); + }, + isAmino(o: any): o is AuthenticationAmino { + return o && (o.$typeUrl === Authentication.typeUrl || Array.isArray(o.rules) && (!o.rules.length || AuthenticationRule.isAmino(o.rules[0])) && Array.isArray(o.providers) && (!o.providers.length || AuthProvider.isAmino(o.providers[0]))); + }, encode(message: Authentication, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.rules) { AuthenticationRule.encode(v!, writer.uint32(26).fork()).ldelim(); @@ -770,6 +780,13 @@ export const Authentication = { typeUrl: "/google.api.Authentication", value: Authentication.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Authentication.typeUrl)) { + return; + } + AuthenticationRule.registerTypeUrl(); + AuthProvider.registerTypeUrl(); } }; function createBaseAuthenticationRule(): AuthenticationRule { @@ -796,6 +813,15 @@ function createBaseAuthenticationRule(): AuthenticationRule { */ export const AuthenticationRule = { typeUrl: "/google.api.AuthenticationRule", + is(o: any): o is AuthenticationRule { + return o && (o.$typeUrl === AuthenticationRule.typeUrl || typeof o.selector === "string" && typeof o.allowWithoutCredential === "boolean" && Array.isArray(o.requirements) && (!o.requirements.length || AuthRequirement.is(o.requirements[0]))); + }, + isSDK(o: any): o is AuthenticationRuleSDKType { + return o && (o.$typeUrl === AuthenticationRule.typeUrl || typeof o.selector === "string" && typeof o.allow_without_credential === "boolean" && Array.isArray(o.requirements) && (!o.requirements.length || AuthRequirement.isSDK(o.requirements[0]))); + }, + isAmino(o: any): o is AuthenticationRuleAmino { + return o && (o.$typeUrl === AuthenticationRule.typeUrl || typeof o.selector === "string" && typeof o.allow_without_credential === "boolean" && Array.isArray(o.requirements) && (!o.requirements.length || AuthRequirement.isAmino(o.requirements[0]))); + }, encode(message: AuthenticationRule, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.selector !== "") { writer.uint32(10).string(message.selector); @@ -912,6 +938,13 @@ export const AuthenticationRule = { typeUrl: "/google.api.AuthenticationRule", value: AuthenticationRule.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(AuthenticationRule.typeUrl)) { + return; + } + OAuthRequirements.registerTypeUrl(); + AuthRequirement.registerTypeUrl(); } }; function createBaseJwtLocation(): JwtLocation { @@ -929,6 +962,15 @@ function createBaseJwtLocation(): JwtLocation { */ export const JwtLocation = { typeUrl: "/google.api.JwtLocation", + is(o: any): o is JwtLocation { + return o && (o.$typeUrl === JwtLocation.typeUrl || typeof o.valuePrefix === "string"); + }, + isSDK(o: any): o is JwtLocationSDKType { + return o && (o.$typeUrl === JwtLocation.typeUrl || typeof o.value_prefix === "string"); + }, + isAmino(o: any): o is JwtLocationAmino { + return o && (o.$typeUrl === JwtLocation.typeUrl || typeof o.value_prefix === "string"); + }, encode(message: JwtLocation, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.header !== undefined) { writer.uint32(10).string(message.header); @@ -1023,7 +1065,8 @@ export const JwtLocation = { typeUrl: "/google.api.JwtLocation", value: JwtLocation.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseAuthProvider(): AuthProvider { return { @@ -1045,6 +1088,15 @@ function createBaseAuthProvider(): AuthProvider { */ export const AuthProvider = { typeUrl: "/google.api.AuthProvider", + is(o: any): o is AuthProvider { + return o && (o.$typeUrl === AuthProvider.typeUrl || typeof o.id === "string" && typeof o.issuer === "string" && typeof o.jwksUri === "string" && typeof o.audiences === "string" && typeof o.authorizationUrl === "string" && Array.isArray(o.jwtLocations) && (!o.jwtLocations.length || JwtLocation.is(o.jwtLocations[0]))); + }, + isSDK(o: any): o is AuthProviderSDKType { + return o && (o.$typeUrl === AuthProvider.typeUrl || typeof o.id === "string" && typeof o.issuer === "string" && typeof o.jwks_uri === "string" && typeof o.audiences === "string" && typeof o.authorization_url === "string" && Array.isArray(o.jwt_locations) && (!o.jwt_locations.length || JwtLocation.isSDK(o.jwt_locations[0]))); + }, + isAmino(o: any): o is AuthProviderAmino { + return o && (o.$typeUrl === AuthProvider.typeUrl || typeof o.id === "string" && typeof o.issuer === "string" && typeof o.jwks_uri === "string" && typeof o.audiences === "string" && typeof o.authorization_url === "string" && Array.isArray(o.jwt_locations) && (!o.jwt_locations.length || JwtLocation.isAmino(o.jwt_locations[0]))); + }, encode(message: AuthProvider, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.id !== "") { writer.uint32(10).string(message.id); @@ -1187,6 +1239,12 @@ export const AuthProvider = { typeUrl: "/google.api.AuthProvider", value: AuthProvider.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(AuthProvider.typeUrl)) { + return; + } + JwtLocation.registerTypeUrl(); } }; function createBaseOAuthRequirements(): OAuthRequirements { @@ -1219,6 +1277,15 @@ function createBaseOAuthRequirements(): OAuthRequirements { */ export const OAuthRequirements = { typeUrl: "/google.api.OAuthRequirements", + is(o: any): o is OAuthRequirements { + return o && (o.$typeUrl === OAuthRequirements.typeUrl || typeof o.canonicalScopes === "string"); + }, + isSDK(o: any): o is OAuthRequirementsSDKType { + return o && (o.$typeUrl === OAuthRequirements.typeUrl || typeof o.canonical_scopes === "string"); + }, + isAmino(o: any): o is OAuthRequirementsAmino { + return o && (o.$typeUrl === OAuthRequirements.typeUrl || typeof o.canonical_scopes === "string"); + }, encode(message: OAuthRequirements, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.canonicalScopes !== "") { writer.uint32(10).string(message.canonicalScopes); @@ -1285,7 +1352,8 @@ export const OAuthRequirements = { typeUrl: "/google.api.OAuthRequirements", value: OAuthRequirements.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseAuthRequirement(): AuthRequirement { return { @@ -1303,6 +1371,15 @@ function createBaseAuthRequirement(): AuthRequirement { */ export const AuthRequirement = { typeUrl: "/google.api.AuthRequirement", + is(o: any): o is AuthRequirement { + return o && (o.$typeUrl === AuthRequirement.typeUrl || typeof o.providerId === "string" && typeof o.audiences === "string"); + }, + isSDK(o: any): o is AuthRequirementSDKType { + return o && (o.$typeUrl === AuthRequirement.typeUrl || typeof o.provider_id === "string" && typeof o.audiences === "string"); + }, + isAmino(o: any): o is AuthRequirementAmino { + return o && (o.$typeUrl === AuthRequirement.typeUrl || typeof o.provider_id === "string" && typeof o.audiences === "string"); + }, encode(message: AuthRequirement, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.providerId !== "") { writer.uint32(10).string(message.providerId); @@ -1383,5 +1460,6 @@ export const AuthRequirement = { typeUrl: "/google.api.AuthRequirement", value: AuthRequirement.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/google/api/backend.ts b/__fixtures__/v-next/outputv3/google/api/backend.ts index bb657e2b2b..0b64ebbec5 100644 --- a/__fixtures__/v-next/outputv3/google/api/backend.ts +++ b/__fixtures__/v-next/outputv3/google/api/backend.ts @@ -1,5 +1,6 @@ import { BinaryReader, BinaryWriter } from "../../binary"; import { DeepPartial, isSet } from "../../helpers"; +import { GlobalDecoderRegistry } from "../../registry"; export const protobufPackage = "google.api"; /** * Path Translation specifies how to combine the backend address with the @@ -349,6 +350,15 @@ function createBaseBackend(): Backend { */ export const Backend = { typeUrl: "/google.api.Backend", + is(o: any): o is Backend { + return o && (o.$typeUrl === Backend.typeUrl || Array.isArray(o.rules) && (!o.rules.length || BackendRule.is(o.rules[0]))); + }, + isSDK(o: any): o is BackendSDKType { + return o && (o.$typeUrl === Backend.typeUrl || Array.isArray(o.rules) && (!o.rules.length || BackendRule.isSDK(o.rules[0]))); + }, + isAmino(o: any): o is BackendAmino { + return o && (o.$typeUrl === Backend.typeUrl || Array.isArray(o.rules) && (!o.rules.length || BackendRule.isAmino(o.rules[0]))); + }, encode(message: Backend, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.rules) { BackendRule.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -421,6 +431,12 @@ export const Backend = { typeUrl: "/google.api.Backend", value: Backend.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Backend.typeUrl)) { + return; + } + BackendRule.registerTypeUrl(); } }; function createBaseBackendRule(): BackendRule { @@ -444,6 +460,15 @@ function createBaseBackendRule(): BackendRule { */ export const BackendRule = { typeUrl: "/google.api.BackendRule", + is(o: any): o is BackendRule { + return o && (o.$typeUrl === BackendRule.typeUrl || typeof o.selector === "string" && typeof o.address === "string" && typeof o.deadline === "number" && typeof o.minDeadline === "number" && typeof o.operationDeadline === "number" && isSet(o.pathTranslation) && typeof o.protocol === "string"); + }, + isSDK(o: any): o is BackendRuleSDKType { + return o && (o.$typeUrl === BackendRule.typeUrl || typeof o.selector === "string" && typeof o.address === "string" && typeof o.deadline === "number" && typeof o.min_deadline === "number" && typeof o.operation_deadline === "number" && isSet(o.path_translation) && typeof o.protocol === "string"); + }, + isAmino(o: any): o is BackendRuleAmino { + return o && (o.$typeUrl === BackendRule.typeUrl || typeof o.selector === "string" && typeof o.address === "string" && typeof o.deadline === "number" && typeof o.min_deadline === "number" && typeof o.operation_deadline === "number" && isSet(o.path_translation) && typeof o.protocol === "string"); + }, encode(message: BackendRule, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.selector !== "") { writer.uint32(10).string(message.selector); @@ -622,5 +647,6 @@ export const BackendRule = { typeUrl: "/google.api.BackendRule", value: BackendRule.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/google/api/billing.ts b/__fixtures__/v-next/outputv3/google/api/billing.ts index c3ce67919c..16f9dc62d7 100644 --- a/__fixtures__/v-next/outputv3/google/api/billing.ts +++ b/__fixtures__/v-next/outputv3/google/api/billing.ts @@ -1,5 +1,6 @@ import { BinaryReader, BinaryWriter } from "../../binary"; import { DeepPartial, isSet } from "../../helpers"; +import { GlobalDecoderRegistry } from "../../registry"; export const protobufPackage = "google.api"; /** * Billing related configuration of the service. @@ -234,6 +235,15 @@ function createBaseBilling(): Billing { */ export const Billing = { typeUrl: "/google.api.Billing", + is(o: any): o is Billing { + return o && (o.$typeUrl === Billing.typeUrl || Array.isArray(o.consumerDestinations) && (!o.consumerDestinations.length || Billing_BillingDestination.is(o.consumerDestinations[0]))); + }, + isSDK(o: any): o is BillingSDKType { + return o && (o.$typeUrl === Billing.typeUrl || Array.isArray(o.consumer_destinations) && (!o.consumer_destinations.length || Billing_BillingDestination.isSDK(o.consumer_destinations[0]))); + }, + isAmino(o: any): o is BillingAmino { + return o && (o.$typeUrl === Billing.typeUrl || Array.isArray(o.consumer_destinations) && (!o.consumer_destinations.length || Billing_BillingDestination.isAmino(o.consumer_destinations[0]))); + }, encode(message: Billing, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.consumerDestinations) { Billing_BillingDestination.encode(v!, writer.uint32(66).fork()).ldelim(); @@ -306,6 +316,12 @@ export const Billing = { typeUrl: "/google.api.Billing", value: Billing.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Billing.typeUrl)) { + return; + } + Billing_BillingDestination.registerTypeUrl(); } }; function createBaseBilling_BillingDestination(): Billing_BillingDestination { @@ -323,6 +339,15 @@ function createBaseBilling_BillingDestination(): Billing_BillingDestination { */ export const Billing_BillingDestination = { typeUrl: "/google.api.BillingDestination", + is(o: any): o is Billing_BillingDestination { + return o && (o.$typeUrl === Billing_BillingDestination.typeUrl || typeof o.monitoredResource === "string" && Array.isArray(o.metrics) && (!o.metrics.length || typeof o.metrics[0] === "string")); + }, + isSDK(o: any): o is Billing_BillingDestinationSDKType { + return o && (o.$typeUrl === Billing_BillingDestination.typeUrl || typeof o.monitored_resource === "string" && Array.isArray(o.metrics) && (!o.metrics.length || typeof o.metrics[0] === "string")); + }, + isAmino(o: any): o is Billing_BillingDestinationAmino { + return o && (o.$typeUrl === Billing_BillingDestination.typeUrl || typeof o.monitored_resource === "string" && Array.isArray(o.metrics) && (!o.metrics.length || typeof o.metrics[0] === "string")); + }, encode(message: Billing_BillingDestination, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.monitoredResource !== "") { writer.uint32(10).string(message.monitoredResource); @@ -409,5 +434,6 @@ export const Billing_BillingDestination = { typeUrl: "/google.api.BillingDestination", value: Billing_BillingDestination.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/google/api/config_change.ts b/__fixtures__/v-next/outputv3/google/api/config_change.ts index 7beb312144..766950f7be 100644 --- a/__fixtures__/v-next/outputv3/google/api/config_change.ts +++ b/__fixtures__/v-next/outputv3/google/api/config_change.ts @@ -1,5 +1,6 @@ -import { BinaryReader, BinaryWriter } from "../../binary"; import { isSet, DeepPartial } from "../../helpers"; +import { BinaryReader, BinaryWriter } from "../../binary"; +import { GlobalDecoderRegistry } from "../../registry"; export const protobufPackage = "google.api"; /** * Classifies set of possible modifications to an object in the service @@ -236,6 +237,15 @@ function createBaseConfigChange(): ConfigChange { */ export const ConfigChange = { typeUrl: "/google.api.ConfigChange", + is(o: any): o is ConfigChange { + return o && (o.$typeUrl === ConfigChange.typeUrl || typeof o.element === "string" && typeof o.oldValue === "string" && typeof o.newValue === "string" && isSet(o.changeType) && Array.isArray(o.advices) && (!o.advices.length || Advice.is(o.advices[0]))); + }, + isSDK(o: any): o is ConfigChangeSDKType { + return o && (o.$typeUrl === ConfigChange.typeUrl || typeof o.element === "string" && typeof o.old_value === "string" && typeof o.new_value === "string" && isSet(o.change_type) && Array.isArray(o.advices) && (!o.advices.length || Advice.isSDK(o.advices[0]))); + }, + isAmino(o: any): o is ConfigChangeAmino { + return o && (o.$typeUrl === ConfigChange.typeUrl || typeof o.element === "string" && typeof o.old_value === "string" && typeof o.new_value === "string" && isSet(o.change_type) && Array.isArray(o.advices) && (!o.advices.length || Advice.isAmino(o.advices[0]))); + }, encode(message: ConfigChange, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.element !== "") { writer.uint32(10).string(message.element); @@ -364,6 +374,12 @@ export const ConfigChange = { typeUrl: "/google.api.ConfigChange", value: ConfigChange.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ConfigChange.typeUrl)) { + return; + } + Advice.registerTypeUrl(); } }; function createBaseAdvice(): Advice { @@ -380,6 +396,15 @@ function createBaseAdvice(): Advice { */ export const Advice = { typeUrl: "/google.api.Advice", + is(o: any): o is Advice { + return o && (o.$typeUrl === Advice.typeUrl || typeof o.description === "string"); + }, + isSDK(o: any): o is AdviceSDKType { + return o && (o.$typeUrl === Advice.typeUrl || typeof o.description === "string"); + }, + isAmino(o: any): o is AdviceAmino { + return o && (o.$typeUrl === Advice.typeUrl || typeof o.description === "string"); + }, encode(message: Advice, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.description !== "") { writer.uint32(18).string(message.description); @@ -446,5 +471,6 @@ export const Advice = { typeUrl: "/google.api.Advice", value: Advice.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/google/api/consumer.ts b/__fixtures__/v-next/outputv3/google/api/consumer.ts index 99fcbbd685..8ce346b289 100644 --- a/__fixtures__/v-next/outputv3/google/api/consumer.ts +++ b/__fixtures__/v-next/outputv3/google/api/consumer.ts @@ -1,5 +1,6 @@ import { BinaryReader, BinaryWriter } from "../../binary"; import { DeepPartial, isSet } from "../../helpers"; +import { GlobalDecoderRegistry } from "../../registry"; export const protobufPackage = "google.api"; /** Supported data type of the property values */ export enum Property_PropertyType { @@ -249,6 +250,15 @@ function createBaseProjectProperties(): ProjectProperties { */ export const ProjectProperties = { typeUrl: "/google.api.ProjectProperties", + is(o: any): o is ProjectProperties { + return o && (o.$typeUrl === ProjectProperties.typeUrl || Array.isArray(o.properties) && (!o.properties.length || Property.is(o.properties[0]))); + }, + isSDK(o: any): o is ProjectPropertiesSDKType { + return o && (o.$typeUrl === ProjectProperties.typeUrl || Array.isArray(o.properties) && (!o.properties.length || Property.isSDK(o.properties[0]))); + }, + isAmino(o: any): o is ProjectPropertiesAmino { + return o && (o.$typeUrl === ProjectProperties.typeUrl || Array.isArray(o.properties) && (!o.properties.length || Property.isAmino(o.properties[0]))); + }, encode(message: ProjectProperties, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.properties) { Property.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -321,6 +331,12 @@ export const ProjectProperties = { typeUrl: "/google.api.ProjectProperties", value: ProjectProperties.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ProjectProperties.typeUrl)) { + return; + } + Property.registerTypeUrl(); } }; function createBaseProperty(): Property { @@ -347,6 +363,15 @@ function createBaseProperty(): Property { */ export const Property = { typeUrl: "/google.api.Property", + is(o: any): o is Property { + return o && (o.$typeUrl === Property.typeUrl || typeof o.name === "string" && isSet(o.type) && typeof o.description === "string"); + }, + isSDK(o: any): o is PropertySDKType { + return o && (o.$typeUrl === Property.typeUrl || typeof o.name === "string" && isSet(o.type) && typeof o.description === "string"); + }, + isAmino(o: any): o is PropertyAmino { + return o && (o.$typeUrl === Property.typeUrl || typeof o.name === "string" && isSet(o.type) && typeof o.description === "string"); + }, encode(message: Property, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -441,5 +466,6 @@ export const Property = { typeUrl: "/google.api.Property", value: Property.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/google/api/context.ts b/__fixtures__/v-next/outputv3/google/api/context.ts index 6df51d7a6f..139b8bd53b 100644 --- a/__fixtures__/v-next/outputv3/google/api/context.ts +++ b/__fixtures__/v-next/outputv3/google/api/context.ts @@ -1,5 +1,6 @@ import { BinaryReader, BinaryWriter } from "../../binary"; import { DeepPartial, isSet } from "../../helpers"; +import { GlobalDecoderRegistry } from "../../registry"; export const protobufPackage = "google.api"; /** * `Context` defines which contexts an API requests. @@ -279,6 +280,15 @@ function createBaseContext(): Context { */ export const Context = { typeUrl: "/google.api.Context", + is(o: any): o is Context { + return o && (o.$typeUrl === Context.typeUrl || Array.isArray(o.rules) && (!o.rules.length || ContextRule.is(o.rules[0]))); + }, + isSDK(o: any): o is ContextSDKType { + return o && (o.$typeUrl === Context.typeUrl || Array.isArray(o.rules) && (!o.rules.length || ContextRule.isSDK(o.rules[0]))); + }, + isAmino(o: any): o is ContextAmino { + return o && (o.$typeUrl === Context.typeUrl || Array.isArray(o.rules) && (!o.rules.length || ContextRule.isAmino(o.rules[0]))); + }, encode(message: Context, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.rules) { ContextRule.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -351,6 +361,12 @@ export const Context = { typeUrl: "/google.api.Context", value: Context.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Context.typeUrl)) { + return; + } + ContextRule.registerTypeUrl(); } }; function createBaseContextRule(): ContextRule { @@ -371,6 +387,15 @@ function createBaseContextRule(): ContextRule { */ export const ContextRule = { typeUrl: "/google.api.ContextRule", + is(o: any): o is ContextRule { + return o && (o.$typeUrl === ContextRule.typeUrl || typeof o.selector === "string" && Array.isArray(o.requested) && (!o.requested.length || typeof o.requested[0] === "string") && Array.isArray(o.provided) && (!o.provided.length || typeof o.provided[0] === "string") && Array.isArray(o.allowedRequestExtensions) && (!o.allowedRequestExtensions.length || typeof o.allowedRequestExtensions[0] === "string") && Array.isArray(o.allowedResponseExtensions) && (!o.allowedResponseExtensions.length || typeof o.allowedResponseExtensions[0] === "string")); + }, + isSDK(o: any): o is ContextRuleSDKType { + return o && (o.$typeUrl === ContextRule.typeUrl || typeof o.selector === "string" && Array.isArray(o.requested) && (!o.requested.length || typeof o.requested[0] === "string") && Array.isArray(o.provided) && (!o.provided.length || typeof o.provided[0] === "string") && Array.isArray(o.allowed_request_extensions) && (!o.allowed_request_extensions.length || typeof o.allowed_request_extensions[0] === "string") && Array.isArray(o.allowed_response_extensions) && (!o.allowed_response_extensions.length || typeof o.allowed_response_extensions[0] === "string")); + }, + isAmino(o: any): o is ContextRuleAmino { + return o && (o.$typeUrl === ContextRule.typeUrl || typeof o.selector === "string" && Array.isArray(o.requested) && (!o.requested.length || typeof o.requested[0] === "string") && Array.isArray(o.provided) && (!o.provided.length || typeof o.provided[0] === "string") && Array.isArray(o.allowed_request_extensions) && (!o.allowed_request_extensions.length || typeof o.allowed_request_extensions[0] === "string") && Array.isArray(o.allowed_response_extensions) && (!o.allowed_response_extensions.length || typeof o.allowed_response_extensions[0] === "string")); + }, encode(message: ContextRule, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.selector !== "") { writer.uint32(10).string(message.selector); @@ -517,5 +542,6 @@ export const ContextRule = { typeUrl: "/google.api.ContextRule", value: ContextRule.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/google/api/control.ts b/__fixtures__/v-next/outputv3/google/api/control.ts index c8b0627bff..161420343d 100644 --- a/__fixtures__/v-next/outputv3/google/api/control.ts +++ b/__fixtures__/v-next/outputv3/google/api/control.ts @@ -61,6 +61,15 @@ function createBaseControl(): Control { */ export const Control = { typeUrl: "/google.api.Control", + is(o: any): o is Control { + return o && (o.$typeUrl === Control.typeUrl || typeof o.environment === "string"); + }, + isSDK(o: any): o is ControlSDKType { + return o && (o.$typeUrl === Control.typeUrl || typeof o.environment === "string"); + }, + isAmino(o: any): o is ControlAmino { + return o && (o.$typeUrl === Control.typeUrl || typeof o.environment === "string"); + }, encode(message: Control, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.environment !== "") { writer.uint32(10).string(message.environment); @@ -127,5 +136,6 @@ export const Control = { typeUrl: "/google.api.Control", value: Control.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/google/api/distribution.ts b/__fixtures__/v-next/outputv3/google/api/distribution.ts index c5c80315f3..7b47d157f5 100644 --- a/__fixtures__/v-next/outputv3/google/api/distribution.ts +++ b/__fixtures__/v-next/outputv3/google/api/distribution.ts @@ -1,6 +1,7 @@ import { Timestamp, TimestampAmino, TimestampSDKType } from "../protobuf/timestamp"; import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../protobuf/any"; import { BinaryReader, BinaryWriter } from "../../binary"; +import { GlobalDecoderRegistry } from "../../registry"; import { isSet, DeepPartial, toTimestamp, fromTimestamp } from "../../helpers"; export const protobufPackage = "google.api"; /** @@ -676,6 +677,15 @@ function createBaseDistribution(): Distribution { */ export const Distribution = { typeUrl: "/google.api.Distribution", + is(o: any): o is Distribution { + return o && (o.$typeUrl === Distribution.typeUrl || typeof o.count === "bigint" && typeof o.mean === "number" && typeof o.sumOfSquaredDeviation === "number" && Array.isArray(o.bucketCounts) && (!o.bucketCounts.length || typeof o.bucketCounts[0] === "bigint") && Array.isArray(o.exemplars) && (!o.exemplars.length || Distribution_Exemplar.is(o.exemplars[0]))); + }, + isSDK(o: any): o is DistributionSDKType { + return o && (o.$typeUrl === Distribution.typeUrl || typeof o.count === "bigint" && typeof o.mean === "number" && typeof o.sum_of_squared_deviation === "number" && Array.isArray(o.bucket_counts) && (!o.bucket_counts.length || typeof o.bucket_counts[0] === "bigint") && Array.isArray(o.exemplars) && (!o.exemplars.length || Distribution_Exemplar.isSDK(o.exemplars[0]))); + }, + isAmino(o: any): o is DistributionAmino { + return o && (o.$typeUrl === Distribution.typeUrl || typeof o.count === "bigint" && typeof o.mean === "number" && typeof o.sum_of_squared_deviation === "number" && Array.isArray(o.bucket_counts) && (!o.bucket_counts.length || typeof o.bucket_counts[0] === "bigint") && Array.isArray(o.exemplars) && (!o.exemplars.length || Distribution_Exemplar.isAmino(o.exemplars[0]))); + }, encode(message: Distribution, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.count !== BigInt(0)) { writer.uint32(8).int64(message.count); @@ -853,6 +863,14 @@ export const Distribution = { typeUrl: "/google.api.Distribution", value: Distribution.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Distribution.typeUrl)) { + return; + } + Distribution_Range.registerTypeUrl(); + Distribution_BucketOptions.registerTypeUrl(); + Distribution_Exemplar.registerTypeUrl(); } }; function createBaseDistribution_Range(): Distribution_Range { @@ -869,6 +887,15 @@ function createBaseDistribution_Range(): Distribution_Range { */ export const Distribution_Range = { typeUrl: "/google.api.Range", + is(o: any): o is Distribution_Range { + return o && (o.$typeUrl === Distribution_Range.typeUrl || typeof o.min === "number" && typeof o.max === "number"); + }, + isSDK(o: any): o is Distribution_RangeSDKType { + return o && (o.$typeUrl === Distribution_Range.typeUrl || typeof o.min === "number" && typeof o.max === "number"); + }, + isAmino(o: any): o is Distribution_RangeAmino { + return o && (o.$typeUrl === Distribution_Range.typeUrl || typeof o.min === "number" && typeof o.max === "number"); + }, encode(message: Distribution_Range, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.min !== 0) { writer.uint32(9).double(message.min); @@ -949,7 +976,8 @@ export const Distribution_Range = { typeUrl: "/google.api.Range", value: Distribution_Range.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseDistribution_BucketOptions(): Distribution_BucketOptions { return { @@ -980,6 +1008,15 @@ function createBaseDistribution_BucketOptions(): Distribution_BucketOptions { */ export const Distribution_BucketOptions = { typeUrl: "/google.api.BucketOptions", + is(o: any): o is Distribution_BucketOptions { + return o && o.$typeUrl === Distribution_BucketOptions.typeUrl; + }, + isSDK(o: any): o is Distribution_BucketOptionsSDKType { + return o && o.$typeUrl === Distribution_BucketOptions.typeUrl; + }, + isAmino(o: any): o is Distribution_BucketOptionsAmino { + return o && o.$typeUrl === Distribution_BucketOptions.typeUrl; + }, encode(message: Distribution_BucketOptions, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.linearBuckets !== undefined) { Distribution_BucketOptions_Linear.encode(message.linearBuckets, writer.uint32(10).fork()).ldelim(); @@ -1080,6 +1117,14 @@ export const Distribution_BucketOptions = { typeUrl: "/google.api.BucketOptions", value: Distribution_BucketOptions.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Distribution_BucketOptions.typeUrl)) { + return; + } + Distribution_BucketOptions_Linear.registerTypeUrl(); + Distribution_BucketOptions_Exponential.registerTypeUrl(); + Distribution_BucketOptions_Explicit.registerTypeUrl(); } }; function createBaseDistribution_BucketOptions_Linear(): Distribution_BucketOptions_Linear { @@ -1105,6 +1150,15 @@ function createBaseDistribution_BucketOptions_Linear(): Distribution_BucketOptio */ export const Distribution_BucketOptions_Linear = { typeUrl: "/google.api.Linear", + is(o: any): o is Distribution_BucketOptions_Linear { + return o && (o.$typeUrl === Distribution_BucketOptions_Linear.typeUrl || typeof o.numFiniteBuckets === "number" && typeof o.width === "number" && typeof o.offset === "number"); + }, + isSDK(o: any): o is Distribution_BucketOptions_LinearSDKType { + return o && (o.$typeUrl === Distribution_BucketOptions_Linear.typeUrl || typeof o.num_finite_buckets === "number" && typeof o.width === "number" && typeof o.offset === "number"); + }, + isAmino(o: any): o is Distribution_BucketOptions_LinearAmino { + return o && (o.$typeUrl === Distribution_BucketOptions_Linear.typeUrl || typeof o.num_finite_buckets === "number" && typeof o.width === "number" && typeof o.offset === "number"); + }, encode(message: Distribution_BucketOptions_Linear, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.numFiniteBuckets !== 0) { writer.uint32(8).int32(message.numFiniteBuckets); @@ -1199,7 +1253,8 @@ export const Distribution_BucketOptions_Linear = { typeUrl: "/google.api.Linear", value: Distribution_BucketOptions_Linear.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseDistribution_BucketOptions_Exponential(): Distribution_BucketOptions_Exponential { return { @@ -1224,6 +1279,15 @@ function createBaseDistribution_BucketOptions_Exponential(): Distribution_Bucket */ export const Distribution_BucketOptions_Exponential = { typeUrl: "/google.api.Exponential", + is(o: any): o is Distribution_BucketOptions_Exponential { + return o && (o.$typeUrl === Distribution_BucketOptions_Exponential.typeUrl || typeof o.numFiniteBuckets === "number" && typeof o.growthFactor === "number" && typeof o.scale === "number"); + }, + isSDK(o: any): o is Distribution_BucketOptions_ExponentialSDKType { + return o && (o.$typeUrl === Distribution_BucketOptions_Exponential.typeUrl || typeof o.num_finite_buckets === "number" && typeof o.growth_factor === "number" && typeof o.scale === "number"); + }, + isAmino(o: any): o is Distribution_BucketOptions_ExponentialAmino { + return o && (o.$typeUrl === Distribution_BucketOptions_Exponential.typeUrl || typeof o.num_finite_buckets === "number" && typeof o.growth_factor === "number" && typeof o.scale === "number"); + }, encode(message: Distribution_BucketOptions_Exponential, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.numFiniteBuckets !== 0) { writer.uint32(8).int32(message.numFiniteBuckets); @@ -1318,7 +1382,8 @@ export const Distribution_BucketOptions_Exponential = { typeUrl: "/google.api.Exponential", value: Distribution_BucketOptions_Exponential.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseDistribution_BucketOptions_Explicit(): Distribution_BucketOptions_Explicit { return { @@ -1343,6 +1408,15 @@ function createBaseDistribution_BucketOptions_Explicit(): Distribution_BucketOpt */ export const Distribution_BucketOptions_Explicit = { typeUrl: "/google.api.Explicit", + is(o: any): o is Distribution_BucketOptions_Explicit { + return o && (o.$typeUrl === Distribution_BucketOptions_Explicit.typeUrl || Array.isArray(o.bounds) && (!o.bounds.length || typeof o.bounds[0] === "number")); + }, + isSDK(o: any): o is Distribution_BucketOptions_ExplicitSDKType { + return o && (o.$typeUrl === Distribution_BucketOptions_Explicit.typeUrl || Array.isArray(o.bounds) && (!o.bounds.length || typeof o.bounds[0] === "number")); + }, + isAmino(o: any): o is Distribution_BucketOptions_ExplicitAmino { + return o && (o.$typeUrl === Distribution_BucketOptions_Explicit.typeUrl || Array.isArray(o.bounds) && (!o.bounds.length || typeof o.bounds[0] === "number")); + }, encode(message: Distribution_BucketOptions_Explicit, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { writer.uint32(10).fork(); for (const v of message.bounds) { @@ -1424,7 +1498,8 @@ export const Distribution_BucketOptions_Explicit = { typeUrl: "/google.api.Explicit", value: Distribution_BucketOptions_Explicit.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseDistribution_Exemplar(): Distribution_Exemplar { return { @@ -1445,6 +1520,15 @@ function createBaseDistribution_Exemplar(): Distribution_Exemplar { */ export const Distribution_Exemplar = { typeUrl: "/google.api.Exemplar", + is(o: any): o is Distribution_Exemplar { + return o && (o.$typeUrl === Distribution_Exemplar.typeUrl || typeof o.value === "number" && Array.isArray(o.attachments) && (!o.attachments.length || Any.is(o.attachments[0]))); + }, + isSDK(o: any): o is Distribution_ExemplarSDKType { + return o && (o.$typeUrl === Distribution_Exemplar.typeUrl || typeof o.value === "number" && Array.isArray(o.attachments) && (!o.attachments.length || Any.isSDK(o.attachments[0]))); + }, + isAmino(o: any): o is Distribution_ExemplarAmino { + return o && (o.$typeUrl === Distribution_Exemplar.typeUrl || typeof o.value === "number" && Array.isArray(o.attachments) && (!o.attachments.length || Any.isAmino(o.attachments[0]))); + }, encode(message: Distribution_Exemplar, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.value !== 0) { writer.uint32(9).double(message.value); @@ -1545,5 +1629,6 @@ export const Distribution_Exemplar = { typeUrl: "/google.api.Exemplar", value: Distribution_Exemplar.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/google/api/documentation.ts b/__fixtures__/v-next/outputv3/google/api/documentation.ts index cc33684fbd..bfc84a8140 100644 --- a/__fixtures__/v-next/outputv3/google/api/documentation.ts +++ b/__fixtures__/v-next/outputv3/google/api/documentation.ts @@ -1,5 +1,6 @@ import { BinaryReader, BinaryWriter } from "../../binary"; import { isSet, DeepPartial } from "../../helpers"; +import { GlobalDecoderRegistry } from "../../registry"; export const protobufPackage = "google.api"; /** * `Documentation` provides the information for describing a service. @@ -508,6 +509,15 @@ function createBaseDocumentation(): Documentation { */ export const Documentation = { typeUrl: "/google.api.Documentation", + is(o: any): o is Documentation { + return o && (o.$typeUrl === Documentation.typeUrl || typeof o.summary === "string" && Array.isArray(o.pages) && (!o.pages.length || Page.is(o.pages[0])) && Array.isArray(o.rules) && (!o.rules.length || DocumentationRule.is(o.rules[0])) && typeof o.documentationRootUrl === "string" && typeof o.serviceRootUrl === "string" && typeof o.overview === "string"); + }, + isSDK(o: any): o is DocumentationSDKType { + return o && (o.$typeUrl === Documentation.typeUrl || typeof o.summary === "string" && Array.isArray(o.pages) && (!o.pages.length || Page.isSDK(o.pages[0])) && Array.isArray(o.rules) && (!o.rules.length || DocumentationRule.isSDK(o.rules[0])) && typeof o.documentation_root_url === "string" && typeof o.service_root_url === "string" && typeof o.overview === "string"); + }, + isAmino(o: any): o is DocumentationAmino { + return o && (o.$typeUrl === Documentation.typeUrl || typeof o.summary === "string" && Array.isArray(o.pages) && (!o.pages.length || Page.isAmino(o.pages[0])) && Array.isArray(o.rules) && (!o.rules.length || DocumentationRule.isAmino(o.rules[0])) && typeof o.documentation_root_url === "string" && typeof o.service_root_url === "string" && typeof o.overview === "string"); + }, encode(message: Documentation, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.summary !== "") { writer.uint32(10).string(message.summary); @@ -656,6 +666,13 @@ export const Documentation = { typeUrl: "/google.api.Documentation", value: Documentation.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Documentation.typeUrl)) { + return; + } + Page.registerTypeUrl(); + DocumentationRule.registerTypeUrl(); } }; function createBaseDocumentationRule(): DocumentationRule { @@ -673,6 +690,15 @@ function createBaseDocumentationRule(): DocumentationRule { */ export const DocumentationRule = { typeUrl: "/google.api.DocumentationRule", + is(o: any): o is DocumentationRule { + return o && (o.$typeUrl === DocumentationRule.typeUrl || typeof o.selector === "string" && typeof o.description === "string" && typeof o.deprecationDescription === "string"); + }, + isSDK(o: any): o is DocumentationRuleSDKType { + return o && (o.$typeUrl === DocumentationRule.typeUrl || typeof o.selector === "string" && typeof o.description === "string" && typeof o.deprecation_description === "string"); + }, + isAmino(o: any): o is DocumentationRuleAmino { + return o && (o.$typeUrl === DocumentationRule.typeUrl || typeof o.selector === "string" && typeof o.description === "string" && typeof o.deprecation_description === "string"); + }, encode(message: DocumentationRule, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.selector !== "") { writer.uint32(10).string(message.selector); @@ -767,7 +793,8 @@ export const DocumentationRule = { typeUrl: "/google.api.DocumentationRule", value: DocumentationRule.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBasePage(): Page { return { @@ -785,6 +812,15 @@ function createBasePage(): Page { */ export const Page = { typeUrl: "/google.api.Page", + is(o: any): o is Page { + return o && (o.$typeUrl === Page.typeUrl || typeof o.name === "string" && typeof o.content === "string" && Array.isArray(o.subpages) && (!o.subpages.length || Page.is(o.subpages[0]))); + }, + isSDK(o: any): o is PageSDKType { + return o && (o.$typeUrl === Page.typeUrl || typeof o.name === "string" && typeof o.content === "string" && Array.isArray(o.subpages) && (!o.subpages.length || Page.isSDK(o.subpages[0]))); + }, + isAmino(o: any): o is PageAmino { + return o && (o.$typeUrl === Page.typeUrl || typeof o.name === "string" && typeof o.content === "string" && Array.isArray(o.subpages) && (!o.subpages.length || Page.isAmino(o.subpages[0]))); + }, encode(message: Page, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -885,5 +921,11 @@ export const Page = { typeUrl: "/google.api.Page", value: Page.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Page.typeUrl)) { + return; + } + Page.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/google/api/endpoint.ts b/__fixtures__/v-next/outputv3/google/api/endpoint.ts index 7253464a8d..38d50184b2 100644 --- a/__fixtures__/v-next/outputv3/google/api/endpoint.ts +++ b/__fixtures__/v-next/outputv3/google/api/endpoint.ts @@ -176,6 +176,15 @@ function createBaseEndpoint(): Endpoint { */ export const Endpoint = { typeUrl: "/google.api.Endpoint", + is(o: any): o is Endpoint { + return o && (o.$typeUrl === Endpoint.typeUrl || typeof o.name === "string" && Array.isArray(o.aliases) && (!o.aliases.length || typeof o.aliases[0] === "string") && typeof o.target === "string" && typeof o.allowCors === "boolean"); + }, + isSDK(o: any): o is EndpointSDKType { + return o && (o.$typeUrl === Endpoint.typeUrl || typeof o.name === "string" && Array.isArray(o.aliases) && (!o.aliases.length || typeof o.aliases[0] === "string") && typeof o.target === "string" && typeof o.allow_cors === "boolean"); + }, + isAmino(o: any): o is EndpointAmino { + return o && (o.$typeUrl === Endpoint.typeUrl || typeof o.name === "string" && Array.isArray(o.aliases) && (!o.aliases.length || typeof o.aliases[0] === "string") && typeof o.target === "string" && typeof o.allow_cors === "boolean"); + }, encode(message: Endpoint, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -290,5 +299,6 @@ export const Endpoint = { typeUrl: "/google.api.Endpoint", value: Endpoint.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/google/api/expr/conformance/v1alpha1/conformance_service.ts b/__fixtures__/v-next/outputv3/google/api/expr/conformance/v1alpha1/conformance_service.ts index 1ef8c40a37..a4ac9d44db 100644 --- a/__fixtures__/v-next/outputv3/google/api/expr/conformance/v1alpha1/conformance_service.ts +++ b/__fixtures__/v-next/outputv3/google/api/expr/conformance/v1alpha1/conformance_service.ts @@ -4,6 +4,7 @@ import { ExprValue, ExprValueAmino, ExprValueSDKType } from "../../v1alpha1/eval import { Status, StatusAmino, StatusSDKType } from "../../../../rpc/status"; import { BinaryReader, BinaryWriter } from "../../../../../binary"; import { isSet, DeepPartial, isObject } from "../../../../../helpers"; +import { GlobalDecoderRegistry } from "../../../../../registry"; export const protobufPackage = "google.api.expr.conformance.v1alpha1"; /** Severities of issues. */ export enum IssueDetails_Severity { @@ -519,6 +520,15 @@ function createBaseParseRequest(): ParseRequest { */ export const ParseRequest = { typeUrl: "/google.api.expr.conformance.v1alpha1.ParseRequest", + is(o: any): o is ParseRequest { + return o && (o.$typeUrl === ParseRequest.typeUrl || typeof o.celSource === "string" && typeof o.syntaxVersion === "string" && typeof o.sourceLocation === "string" && typeof o.disableMacros === "boolean"); + }, + isSDK(o: any): o is ParseRequestSDKType { + return o && (o.$typeUrl === ParseRequest.typeUrl || typeof o.cel_source === "string" && typeof o.syntax_version === "string" && typeof o.source_location === "string" && typeof o.disable_macros === "boolean"); + }, + isAmino(o: any): o is ParseRequestAmino { + return o && (o.$typeUrl === ParseRequest.typeUrl || typeof o.cel_source === "string" && typeof o.syntax_version === "string" && typeof o.source_location === "string" && typeof o.disable_macros === "boolean"); + }, encode(message: ParseRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.celSource !== "") { writer.uint32(10).string(message.celSource); @@ -627,7 +637,8 @@ export const ParseRequest = { typeUrl: "/google.api.expr.conformance.v1alpha1.ParseRequest", value: ParseRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseParseResponse(): ParseResponse { return { @@ -643,6 +654,15 @@ function createBaseParseResponse(): ParseResponse { */ export const ParseResponse = { typeUrl: "/google.api.expr.conformance.v1alpha1.ParseResponse", + is(o: any): o is ParseResponse { + return o && (o.$typeUrl === ParseResponse.typeUrl || Array.isArray(o.issues) && (!o.issues.length || Status.is(o.issues[0]))); + }, + isSDK(o: any): o is ParseResponseSDKType { + return o && (o.$typeUrl === ParseResponse.typeUrl || Array.isArray(o.issues) && (!o.issues.length || Status.isSDK(o.issues[0]))); + }, + isAmino(o: any): o is ParseResponseAmino { + return o && (o.$typeUrl === ParseResponse.typeUrl || Array.isArray(o.issues) && (!o.issues.length || Status.isAmino(o.issues[0]))); + }, encode(message: ParseResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.parsedExpr !== undefined) { ParsedExpr.encode(message.parsedExpr, writer.uint32(10).fork()).ldelim(); @@ -731,6 +751,13 @@ export const ParseResponse = { typeUrl: "/google.api.expr.conformance.v1alpha1.ParseResponse", value: ParseResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ParseResponse.typeUrl)) { + return; + } + ParsedExpr.registerTypeUrl(); + Status.registerTypeUrl(); } }; function createBaseCheckRequest(): CheckRequest { @@ -749,6 +776,15 @@ function createBaseCheckRequest(): CheckRequest { */ export const CheckRequest = { typeUrl: "/google.api.expr.conformance.v1alpha1.CheckRequest", + is(o: any): o is CheckRequest { + return o && (o.$typeUrl === CheckRequest.typeUrl || Array.isArray(o.typeEnv) && (!o.typeEnv.length || Decl.is(o.typeEnv[0])) && typeof o.container === "string" && typeof o.noStdEnv === "boolean"); + }, + isSDK(o: any): o is CheckRequestSDKType { + return o && (o.$typeUrl === CheckRequest.typeUrl || Array.isArray(o.type_env) && (!o.type_env.length || Decl.isSDK(o.type_env[0])) && typeof o.container === "string" && typeof o.no_std_env === "boolean"); + }, + isAmino(o: any): o is CheckRequestAmino { + return o && (o.$typeUrl === CheckRequest.typeUrl || Array.isArray(o.type_env) && (!o.type_env.length || Decl.isAmino(o.type_env[0])) && typeof o.container === "string" && typeof o.no_std_env === "boolean"); + }, encode(message: CheckRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.parsedExpr !== undefined) { ParsedExpr.encode(message.parsedExpr, writer.uint32(10).fork()).ldelim(); @@ -865,6 +901,13 @@ export const CheckRequest = { typeUrl: "/google.api.expr.conformance.v1alpha1.CheckRequest", value: CheckRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(CheckRequest.typeUrl)) { + return; + } + ParsedExpr.registerTypeUrl(); + Decl.registerTypeUrl(); } }; function createBaseCheckResponse(): CheckResponse { @@ -881,6 +924,15 @@ function createBaseCheckResponse(): CheckResponse { */ export const CheckResponse = { typeUrl: "/google.api.expr.conformance.v1alpha1.CheckResponse", + is(o: any): o is CheckResponse { + return o && (o.$typeUrl === CheckResponse.typeUrl || Array.isArray(o.issues) && (!o.issues.length || Status.is(o.issues[0]))); + }, + isSDK(o: any): o is CheckResponseSDKType { + return o && (o.$typeUrl === CheckResponse.typeUrl || Array.isArray(o.issues) && (!o.issues.length || Status.isSDK(o.issues[0]))); + }, + isAmino(o: any): o is CheckResponseAmino { + return o && (o.$typeUrl === CheckResponse.typeUrl || Array.isArray(o.issues) && (!o.issues.length || Status.isAmino(o.issues[0]))); + }, encode(message: CheckResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.checkedExpr !== undefined) { CheckedExpr.encode(message.checkedExpr, writer.uint32(10).fork()).ldelim(); @@ -969,6 +1021,13 @@ export const CheckResponse = { typeUrl: "/google.api.expr.conformance.v1alpha1.CheckResponse", value: CheckResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(CheckResponse.typeUrl)) { + return; + } + CheckedExpr.registerTypeUrl(); + Status.registerTypeUrl(); } }; function createBaseEvalRequest_BindingsEntry(): EvalRequest_BindingsEntry { @@ -1059,6 +1118,9 @@ export const EvalRequest_BindingsEntry = { }, toProto(message: EvalRequest_BindingsEntry): Uint8Array { return EvalRequest_BindingsEntry.encode(message).finish(); + }, + registerTypeUrl() { + ExprValue.registerTypeUrl(); } }; function createBaseEvalRequest(): EvalRequest { @@ -1077,6 +1139,15 @@ function createBaseEvalRequest(): EvalRequest { */ export const EvalRequest = { typeUrl: "/google.api.expr.conformance.v1alpha1.EvalRequest", + is(o: any): o is EvalRequest { + return o && (o.$typeUrl === EvalRequest.typeUrl || isSet(o.bindings) && typeof o.container === "string"); + }, + isSDK(o: any): o is EvalRequestSDKType { + return o && (o.$typeUrl === EvalRequest.typeUrl || isSet(o.bindings) && typeof o.container === "string"); + }, + isAmino(o: any): o is EvalRequestAmino { + return o && (o.$typeUrl === EvalRequest.typeUrl || isSet(o.bindings) && typeof o.container === "string"); + }, encode(message: EvalRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.parsedExpr !== undefined) { ParsedExpr.encode(message.parsedExpr, writer.uint32(10).fork()).ldelim(); @@ -1227,6 +1298,14 @@ export const EvalRequest = { typeUrl: "/google.api.expr.conformance.v1alpha1.EvalRequest", value: EvalRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(EvalRequest.typeUrl)) { + return; + } + ParsedExpr.registerTypeUrl(); + CheckedExpr.registerTypeUrl(); + ExprValue.registerTypeUrl(); } }; function createBaseEvalResponse(): EvalResponse { @@ -1243,6 +1322,15 @@ function createBaseEvalResponse(): EvalResponse { */ export const EvalResponse = { typeUrl: "/google.api.expr.conformance.v1alpha1.EvalResponse", + is(o: any): o is EvalResponse { + return o && (o.$typeUrl === EvalResponse.typeUrl || Array.isArray(o.issues) && (!o.issues.length || Status.is(o.issues[0]))); + }, + isSDK(o: any): o is EvalResponseSDKType { + return o && (o.$typeUrl === EvalResponse.typeUrl || Array.isArray(o.issues) && (!o.issues.length || Status.isSDK(o.issues[0]))); + }, + isAmino(o: any): o is EvalResponseAmino { + return o && (o.$typeUrl === EvalResponse.typeUrl || Array.isArray(o.issues) && (!o.issues.length || Status.isAmino(o.issues[0]))); + }, encode(message: EvalResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.result !== undefined) { ExprValue.encode(message.result, writer.uint32(10).fork()).ldelim(); @@ -1331,6 +1419,13 @@ export const EvalResponse = { typeUrl: "/google.api.expr.conformance.v1alpha1.EvalResponse", value: EvalResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(EvalResponse.typeUrl)) { + return; + } + ExprValue.registerTypeUrl(); + Status.registerTypeUrl(); } }; function createBaseIssueDetails(): IssueDetails { @@ -1350,6 +1445,15 @@ function createBaseIssueDetails(): IssueDetails { */ export const IssueDetails = { typeUrl: "/google.api.expr.conformance.v1alpha1.IssueDetails", + is(o: any): o is IssueDetails { + return o && (o.$typeUrl === IssueDetails.typeUrl || isSet(o.severity) && typeof o.id === "bigint"); + }, + isSDK(o: any): o is IssueDetailsSDKType { + return o && (o.$typeUrl === IssueDetails.typeUrl || isSet(o.severity) && typeof o.id === "bigint"); + }, + isAmino(o: any): o is IssueDetailsAmino { + return o && (o.$typeUrl === IssueDetails.typeUrl || isSet(o.severity) && typeof o.id === "bigint"); + }, encode(message: IssueDetails, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.severity !== 0) { writer.uint32(8).int32(message.severity); @@ -1448,5 +1552,11 @@ export const IssueDetails = { typeUrl: "/google.api.expr.conformance.v1alpha1.IssueDetails", value: IssueDetails.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(IssueDetails.typeUrl)) { + return; + } + SourcePosition.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/google/api/expr/v1alpha1/checked.ts b/__fixtures__/v-next/outputv3/google/api/expr/v1alpha1/checked.ts index 944778bdf2..fab1d5ac5f 100644 --- a/__fixtures__/v-next/outputv3/google/api/expr/v1alpha1/checked.ts +++ b/__fixtures__/v-next/outputv3/google/api/expr/v1alpha1/checked.ts @@ -2,6 +2,7 @@ import { SourceInfo, SourceInfoAmino, SourceInfoSDKType, Expr, ExprAmino, ExprSD import { Empty, EmptyAmino, EmptySDKType } from "../../../protobuf/empty"; import { NullValue, NullValueSDKType, nullValueFromJSON, nullValueToJSON } from "../../../protobuf/struct"; import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { GlobalDecoderRegistry } from "../../../../registry"; import { isSet, DeepPartial, isObject } from "../../../../helpers"; export const protobufPackage = "google.api.expr.v1alpha1"; /** CEL primitive types. */ @@ -1199,6 +1200,9 @@ export const CheckedExpr_ReferenceMapEntry = { }, toProto(message: CheckedExpr_ReferenceMapEntry): Uint8Array { return CheckedExpr_ReferenceMapEntry.encode(message).finish(); + }, + registerTypeUrl() { + Reference.registerTypeUrl(); } }; function createBaseCheckedExpr_TypeMapEntry(): CheckedExpr_TypeMapEntry { @@ -1291,6 +1295,9 @@ export const CheckedExpr_TypeMapEntry = { }, toProto(message: CheckedExpr_TypeMapEntry): Uint8Array { return CheckedExpr_TypeMapEntry.encode(message).finish(); + }, + registerTypeUrl() { + Type.registerTypeUrl(); } }; function createBaseCheckedExpr(): CheckedExpr { @@ -1310,6 +1317,15 @@ function createBaseCheckedExpr(): CheckedExpr { */ export const CheckedExpr = { typeUrl: "/google.api.expr.v1alpha1.CheckedExpr", + is(o: any): o is CheckedExpr { + return o && (o.$typeUrl === CheckedExpr.typeUrl || isSet(o.referenceMap) && isSet(o.typeMap) && typeof o.exprVersion === "string"); + }, + isSDK(o: any): o is CheckedExprSDKType { + return o && (o.$typeUrl === CheckedExpr.typeUrl || isSet(o.reference_map) && isSet(o.type_map) && typeof o.expr_version === "string"); + }, + isAmino(o: any): o is CheckedExprAmino { + return o && (o.$typeUrl === CheckedExpr.typeUrl || isSet(o.reference_map) && isSet(o.type_map) && typeof o.expr_version === "string"); + }, encode(message: CheckedExpr, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { Object.entries(message.referenceMap).forEach(([key, value]) => { CheckedExpr_ReferenceMapEntry.encode({ @@ -1512,6 +1528,15 @@ export const CheckedExpr = { typeUrl: "/google.api.expr.v1alpha1.CheckedExpr", value: CheckedExpr.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(CheckedExpr.typeUrl)) { + return; + } + Reference.registerTypeUrl(); + Type.registerTypeUrl(); + SourceInfo.registerTypeUrl(); + Expr.registerTypeUrl(); } }; function createBaseType(): Type { @@ -1539,6 +1564,15 @@ function createBaseType(): Type { */ export const Type = { typeUrl: "/google.api.expr.v1alpha1.Type", + is(o: any): o is Type { + return o && o.$typeUrl === Type.typeUrl; + }, + isSDK(o: any): o is TypeSDKType { + return o && o.$typeUrl === Type.typeUrl; + }, + isAmino(o: any): o is TypeAmino { + return o && o.$typeUrl === Type.typeUrl; + }, encode(message: Type, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.dyn !== undefined) { Empty.encode(message.dyn, writer.uint32(10).fork()).ldelim(); @@ -1787,6 +1821,17 @@ export const Type = { typeUrl: "/google.api.expr.v1alpha1.Type", value: Type.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Type.typeUrl)) { + return; + } + Empty.registerTypeUrl(); + Type_ListType.registerTypeUrl(); + Type_MapType.registerTypeUrl(); + Type_FunctionType.registerTypeUrl(); + Type.registerTypeUrl(); + Type_AbstractType.registerTypeUrl(); } }; function createBaseType_ListType(): Type_ListType { @@ -1802,6 +1847,15 @@ function createBaseType_ListType(): Type_ListType { */ export const Type_ListType = { typeUrl: "/google.api.expr.v1alpha1.ListType", + is(o: any): o is Type_ListType { + return o && o.$typeUrl === Type_ListType.typeUrl; + }, + isSDK(o: any): o is Type_ListTypeSDKType { + return o && o.$typeUrl === Type_ListType.typeUrl; + }, + isAmino(o: any): o is Type_ListTypeAmino { + return o && o.$typeUrl === Type_ListType.typeUrl; + }, encode(message: Type_ListType, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.elemType !== undefined) { Type.encode(message.elemType, writer.uint32(10).fork()).ldelim(); @@ -1870,6 +1924,12 @@ export const Type_ListType = { typeUrl: "/google.api.expr.v1alpha1.ListType", value: Type_ListType.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Type_ListType.typeUrl)) { + return; + } + Type.registerTypeUrl(); } }; function createBaseType_MapType(): Type_MapType { @@ -1886,6 +1946,15 @@ function createBaseType_MapType(): Type_MapType { */ export const Type_MapType = { typeUrl: "/google.api.expr.v1alpha1.MapType", + is(o: any): o is Type_MapType { + return o && o.$typeUrl === Type_MapType.typeUrl; + }, + isSDK(o: any): o is Type_MapTypeSDKType { + return o && o.$typeUrl === Type_MapType.typeUrl; + }, + isAmino(o: any): o is Type_MapTypeAmino { + return o && o.$typeUrl === Type_MapType.typeUrl; + }, encode(message: Type_MapType, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.keyType !== undefined) { Type.encode(message.keyType, writer.uint32(10).fork()).ldelim(); @@ -1970,6 +2039,12 @@ export const Type_MapType = { typeUrl: "/google.api.expr.v1alpha1.MapType", value: Type_MapType.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Type_MapType.typeUrl)) { + return; + } + Type.registerTypeUrl(); } }; function createBaseType_FunctionType(): Type_FunctionType { @@ -1986,6 +2061,15 @@ function createBaseType_FunctionType(): Type_FunctionType { */ export const Type_FunctionType = { typeUrl: "/google.api.expr.v1alpha1.FunctionType", + is(o: any): o is Type_FunctionType { + return o && (o.$typeUrl === Type_FunctionType.typeUrl || Array.isArray(o.argTypes) && (!o.argTypes.length || Type.is(o.argTypes[0]))); + }, + isSDK(o: any): o is Type_FunctionTypeSDKType { + return o && (o.$typeUrl === Type_FunctionType.typeUrl || Array.isArray(o.arg_types) && (!o.arg_types.length || Type.isSDK(o.arg_types[0]))); + }, + isAmino(o: any): o is Type_FunctionTypeAmino { + return o && (o.$typeUrl === Type_FunctionType.typeUrl || Array.isArray(o.arg_types) && (!o.arg_types.length || Type.isAmino(o.arg_types[0]))); + }, encode(message: Type_FunctionType, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.resultType !== undefined) { Type.encode(message.resultType, writer.uint32(10).fork()).ldelim(); @@ -2074,6 +2158,12 @@ export const Type_FunctionType = { typeUrl: "/google.api.expr.v1alpha1.FunctionType", value: Type_FunctionType.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Type_FunctionType.typeUrl)) { + return; + } + Type.registerTypeUrl(); } }; function createBaseType_AbstractType(): Type_AbstractType { @@ -2090,6 +2180,15 @@ function createBaseType_AbstractType(): Type_AbstractType { */ export const Type_AbstractType = { typeUrl: "/google.api.expr.v1alpha1.AbstractType", + is(o: any): o is Type_AbstractType { + return o && (o.$typeUrl === Type_AbstractType.typeUrl || typeof o.name === "string" && Array.isArray(o.parameterTypes) && (!o.parameterTypes.length || Type.is(o.parameterTypes[0]))); + }, + isSDK(o: any): o is Type_AbstractTypeSDKType { + return o && (o.$typeUrl === Type_AbstractType.typeUrl || typeof o.name === "string" && Array.isArray(o.parameter_types) && (!o.parameter_types.length || Type.isSDK(o.parameter_types[0]))); + }, + isAmino(o: any): o is Type_AbstractTypeAmino { + return o && (o.$typeUrl === Type_AbstractType.typeUrl || typeof o.name === "string" && Array.isArray(o.parameter_types) && (!o.parameter_types.length || Type.isAmino(o.parameter_types[0]))); + }, encode(message: Type_AbstractType, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -2176,6 +2275,12 @@ export const Type_AbstractType = { typeUrl: "/google.api.expr.v1alpha1.AbstractType", value: Type_AbstractType.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Type_AbstractType.typeUrl)) { + return; + } + Type.registerTypeUrl(); } }; function createBaseDecl(): Decl { @@ -2196,6 +2301,15 @@ function createBaseDecl(): Decl { */ export const Decl = { typeUrl: "/google.api.expr.v1alpha1.Decl", + is(o: any): o is Decl { + return o && (o.$typeUrl === Decl.typeUrl || typeof o.name === "string"); + }, + isSDK(o: any): o is DeclSDKType { + return o && (o.$typeUrl === Decl.typeUrl || typeof o.name === "string"); + }, + isAmino(o: any): o is DeclAmino { + return o && (o.$typeUrl === Decl.typeUrl || typeof o.name === "string"); + }, encode(message: Decl, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -2294,6 +2408,13 @@ export const Decl = { typeUrl: "/google.api.expr.v1alpha1.Decl", value: Decl.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Decl.typeUrl)) { + return; + } + Decl_IdentDecl.registerTypeUrl(); + Decl_FunctionDecl.registerTypeUrl(); } }; function createBaseDecl_IdentDecl(): Decl_IdentDecl { @@ -2316,6 +2437,15 @@ function createBaseDecl_IdentDecl(): Decl_IdentDecl { */ export const Decl_IdentDecl = { typeUrl: "/google.api.expr.v1alpha1.IdentDecl", + is(o: any): o is Decl_IdentDecl { + return o && (o.$typeUrl === Decl_IdentDecl.typeUrl || typeof o.doc === "string"); + }, + isSDK(o: any): o is Decl_IdentDeclSDKType { + return o && (o.$typeUrl === Decl_IdentDecl.typeUrl || typeof o.doc === "string"); + }, + isAmino(o: any): o is Decl_IdentDeclAmino { + return o && (o.$typeUrl === Decl_IdentDecl.typeUrl || typeof o.doc === "string"); + }, encode(message: Decl_IdentDecl, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.type !== undefined) { Type.encode(message.type, writer.uint32(10).fork()).ldelim(); @@ -2414,6 +2544,13 @@ export const Decl_IdentDecl = { typeUrl: "/google.api.expr.v1alpha1.IdentDecl", value: Decl_IdentDecl.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Decl_IdentDecl.typeUrl)) { + return; + } + Type.registerTypeUrl(); + Constant.registerTypeUrl(); } }; function createBaseDecl_FunctionDecl(): Decl_FunctionDecl { @@ -2433,6 +2570,15 @@ function createBaseDecl_FunctionDecl(): Decl_FunctionDecl { */ export const Decl_FunctionDecl = { typeUrl: "/google.api.expr.v1alpha1.FunctionDecl", + is(o: any): o is Decl_FunctionDecl { + return o && (o.$typeUrl === Decl_FunctionDecl.typeUrl || Array.isArray(o.overloads) && (!o.overloads.length || Decl_FunctionDecl_Overload.is(o.overloads[0]))); + }, + isSDK(o: any): o is Decl_FunctionDeclSDKType { + return o && (o.$typeUrl === Decl_FunctionDecl.typeUrl || Array.isArray(o.overloads) && (!o.overloads.length || Decl_FunctionDecl_Overload.isSDK(o.overloads[0]))); + }, + isAmino(o: any): o is Decl_FunctionDeclAmino { + return o && (o.$typeUrl === Decl_FunctionDecl.typeUrl || Array.isArray(o.overloads) && (!o.overloads.length || Decl_FunctionDecl_Overload.isAmino(o.overloads[0]))); + }, encode(message: Decl_FunctionDecl, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.overloads) { Decl_FunctionDecl_Overload.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -2505,6 +2651,12 @@ export const Decl_FunctionDecl = { typeUrl: "/google.api.expr.v1alpha1.FunctionDecl", value: Decl_FunctionDecl.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Decl_FunctionDecl.typeUrl)) { + return; + } + Decl_FunctionDecl_Overload.registerTypeUrl(); } }; function createBaseDecl_FunctionDecl_Overload(): Decl_FunctionDecl_Overload { @@ -2534,6 +2686,15 @@ function createBaseDecl_FunctionDecl_Overload(): Decl_FunctionDecl_Overload { */ export const Decl_FunctionDecl_Overload = { typeUrl: "/google.api.expr.v1alpha1.Overload", + is(o: any): o is Decl_FunctionDecl_Overload { + return o && (o.$typeUrl === Decl_FunctionDecl_Overload.typeUrl || typeof o.overloadId === "string" && Array.isArray(o.params) && (!o.params.length || Type.is(o.params[0])) && Array.isArray(o.typeParams) && (!o.typeParams.length || typeof o.typeParams[0] === "string") && typeof o.isInstanceFunction === "boolean" && typeof o.doc === "string"); + }, + isSDK(o: any): o is Decl_FunctionDecl_OverloadSDKType { + return o && (o.$typeUrl === Decl_FunctionDecl_Overload.typeUrl || typeof o.overload_id === "string" && Array.isArray(o.params) && (!o.params.length || Type.isSDK(o.params[0])) && Array.isArray(o.type_params) && (!o.type_params.length || typeof o.type_params[0] === "string") && typeof o.is_instance_function === "boolean" && typeof o.doc === "string"); + }, + isAmino(o: any): o is Decl_FunctionDecl_OverloadAmino { + return o && (o.$typeUrl === Decl_FunctionDecl_Overload.typeUrl || typeof o.overload_id === "string" && Array.isArray(o.params) && (!o.params.length || Type.isAmino(o.params[0])) && Array.isArray(o.type_params) && (!o.type_params.length || typeof o.type_params[0] === "string") && typeof o.is_instance_function === "boolean" && typeof o.doc === "string"); + }, encode(message: Decl_FunctionDecl_Overload, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.overloadId !== "") { writer.uint32(10).string(message.overloadId); @@ -2684,6 +2845,12 @@ export const Decl_FunctionDecl_Overload = { typeUrl: "/google.api.expr.v1alpha1.Overload", value: Decl_FunctionDecl_Overload.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Decl_FunctionDecl_Overload.typeUrl)) { + return; + } + Type.registerTypeUrl(); } }; function createBaseReference(): Reference { @@ -2701,6 +2868,15 @@ function createBaseReference(): Reference { */ export const Reference = { typeUrl: "/google.api.expr.v1alpha1.Reference", + is(o: any): o is Reference { + return o && (o.$typeUrl === Reference.typeUrl || typeof o.name === "string" && Array.isArray(o.overloadId) && (!o.overloadId.length || typeof o.overloadId[0] === "string")); + }, + isSDK(o: any): o is ReferenceSDKType { + return o && (o.$typeUrl === Reference.typeUrl || typeof o.name === "string" && Array.isArray(o.overload_id) && (!o.overload_id.length || typeof o.overload_id[0] === "string")); + }, + isAmino(o: any): o is ReferenceAmino { + return o && (o.$typeUrl === Reference.typeUrl || typeof o.name === "string" && Array.isArray(o.overload_id) && (!o.overload_id.length || typeof o.overload_id[0] === "string")); + }, encode(message: Reference, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -2803,5 +2979,11 @@ export const Reference = { typeUrl: "/google.api.expr.v1alpha1.Reference", value: Reference.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Reference.typeUrl)) { + return; + } + Constant.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/google/api/expr/v1alpha1/eval.ts b/__fixtures__/v-next/outputv3/google/api/expr/v1alpha1/eval.ts index 6817724720..08c84b448b 100644 --- a/__fixtures__/v-next/outputv3/google/api/expr/v1alpha1/eval.ts +++ b/__fixtures__/v-next/outputv3/google/api/expr/v1alpha1/eval.ts @@ -2,6 +2,7 @@ import { Value, ValueAmino, ValueSDKType } from "./value"; import { Status, StatusAmino, StatusSDKType } from "../../../rpc/status"; import { BinaryReader, BinaryWriter } from "../../../../binary"; import { DeepPartial, isSet } from "../../../../helpers"; +import { GlobalDecoderRegistry } from "../../../../registry"; export const protobufPackage = "google.api.expr.v1alpha1"; /** * The state of an evaluation. @@ -340,6 +341,15 @@ function createBaseEvalState(): EvalState { */ export const EvalState = { typeUrl: "/google.api.expr.v1alpha1.EvalState", + is(o: any): o is EvalState { + return o && (o.$typeUrl === EvalState.typeUrl || Array.isArray(o.values) && (!o.values.length || ExprValue.is(o.values[0])) && Array.isArray(o.results) && (!o.results.length || EvalState_Result.is(o.results[0]))); + }, + isSDK(o: any): o is EvalStateSDKType { + return o && (o.$typeUrl === EvalState.typeUrl || Array.isArray(o.values) && (!o.values.length || ExprValue.isSDK(o.values[0])) && Array.isArray(o.results) && (!o.results.length || EvalState_Result.isSDK(o.results[0]))); + }, + isAmino(o: any): o is EvalStateAmino { + return o && (o.$typeUrl === EvalState.typeUrl || Array.isArray(o.values) && (!o.values.length || ExprValue.isAmino(o.values[0])) && Array.isArray(o.results) && (!o.results.length || EvalState_Result.isAmino(o.results[0]))); + }, encode(message: EvalState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.values) { ExprValue.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -432,6 +442,13 @@ export const EvalState = { typeUrl: "/google.api.expr.v1alpha1.EvalState", value: EvalState.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(EvalState.typeUrl)) { + return; + } + ExprValue.registerTypeUrl(); + EvalState_Result.registerTypeUrl(); } }; function createBaseEvalState_Result(): EvalState_Result { @@ -448,6 +465,15 @@ function createBaseEvalState_Result(): EvalState_Result { */ export const EvalState_Result = { typeUrl: "/google.api.expr.v1alpha1.Result", + is(o: any): o is EvalState_Result { + return o && (o.$typeUrl === EvalState_Result.typeUrl || typeof o.expr === "bigint" && typeof o.value === "bigint"); + }, + isSDK(o: any): o is EvalState_ResultSDKType { + return o && (o.$typeUrl === EvalState_Result.typeUrl || typeof o.expr === "bigint" && typeof o.value === "bigint"); + }, + isAmino(o: any): o is EvalState_ResultAmino { + return o && (o.$typeUrl === EvalState_Result.typeUrl || typeof o.expr === "bigint" && typeof o.value === "bigint"); + }, encode(message: EvalState_Result, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.expr !== BigInt(0)) { writer.uint32(8).int64(message.expr); @@ -532,7 +558,8 @@ export const EvalState_Result = { typeUrl: "/google.api.expr.v1alpha1.Result", value: EvalState_Result.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseExprValue(): ExprValue { return { @@ -549,6 +576,15 @@ function createBaseExprValue(): ExprValue { */ export const ExprValue = { typeUrl: "/google.api.expr.v1alpha1.ExprValue", + is(o: any): o is ExprValue { + return o && o.$typeUrl === ExprValue.typeUrl; + }, + isSDK(o: any): o is ExprValueSDKType { + return o && o.$typeUrl === ExprValue.typeUrl; + }, + isAmino(o: any): o is ExprValueAmino { + return o && o.$typeUrl === ExprValue.typeUrl; + }, encode(message: ExprValue, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.value !== undefined) { Value.encode(message.value, writer.uint32(10).fork()).ldelim(); @@ -649,6 +685,14 @@ export const ExprValue = { typeUrl: "/google.api.expr.v1alpha1.ExprValue", value: ExprValue.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ExprValue.typeUrl)) { + return; + } + Value.registerTypeUrl(); + ErrorSet.registerTypeUrl(); + UnknownSet.registerTypeUrl(); } }; function createBaseErrorSet(): ErrorSet { @@ -666,6 +710,15 @@ function createBaseErrorSet(): ErrorSet { */ export const ErrorSet = { typeUrl: "/google.api.expr.v1alpha1.ErrorSet", + is(o: any): o is ErrorSet { + return o && (o.$typeUrl === ErrorSet.typeUrl || Array.isArray(o.errors) && (!o.errors.length || Status.is(o.errors[0]))); + }, + isSDK(o: any): o is ErrorSetSDKType { + return o && (o.$typeUrl === ErrorSet.typeUrl || Array.isArray(o.errors) && (!o.errors.length || Status.isSDK(o.errors[0]))); + }, + isAmino(o: any): o is ErrorSetAmino { + return o && (o.$typeUrl === ErrorSet.typeUrl || Array.isArray(o.errors) && (!o.errors.length || Status.isAmino(o.errors[0]))); + }, encode(message: ErrorSet, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.errors) { Status.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -738,6 +791,12 @@ export const ErrorSet = { typeUrl: "/google.api.expr.v1alpha1.ErrorSet", value: ErrorSet.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ErrorSet.typeUrl)) { + return; + } + Status.registerTypeUrl(); } }; function createBaseUnknownSet(): UnknownSet { @@ -755,6 +814,15 @@ function createBaseUnknownSet(): UnknownSet { */ export const UnknownSet = { typeUrl: "/google.api.expr.v1alpha1.UnknownSet", + is(o: any): o is UnknownSet { + return o && (o.$typeUrl === UnknownSet.typeUrl || Array.isArray(o.exprs) && (!o.exprs.length || typeof o.exprs[0] === "bigint")); + }, + isSDK(o: any): o is UnknownSetSDKType { + return o && (o.$typeUrl === UnknownSet.typeUrl || Array.isArray(o.exprs) && (!o.exprs.length || typeof o.exprs[0] === "bigint")); + }, + isAmino(o: any): o is UnknownSetAmino { + return o && (o.$typeUrl === UnknownSet.typeUrl || Array.isArray(o.exprs) && (!o.exprs.length || typeof o.exprs[0] === "bigint")); + }, encode(message: UnknownSet, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { writer.uint32(10).fork(); for (const v of message.exprs) { @@ -836,5 +904,6 @@ export const UnknownSet = { typeUrl: "/google.api.expr.v1alpha1.UnknownSet", value: UnknownSet.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/google/api/expr/v1alpha1/explain.ts b/__fixtures__/v-next/outputv3/google/api/expr/v1alpha1/explain.ts index e37483f3f4..82f01f4afa 100644 --- a/__fixtures__/v-next/outputv3/google/api/expr/v1alpha1/explain.ts +++ b/__fixtures__/v-next/outputv3/google/api/expr/v1alpha1/explain.ts @@ -1,6 +1,7 @@ import { Value, ValueAmino, ValueSDKType } from "./value"; import { BinaryReader, BinaryWriter } from "../../../../binary"; import { DeepPartial, isSet } from "../../../../helpers"; +import { GlobalDecoderRegistry } from "../../../../registry"; export const protobufPackage = "google.api.expr.v1alpha1"; /** * Values of intermediate expressions produced when evaluating expression. @@ -130,6 +131,15 @@ function createBaseExplain(): Explain { */ export const Explain = { typeUrl: "/google.api.expr.v1alpha1.Explain", + is(o: any): o is Explain { + return o && (o.$typeUrl === Explain.typeUrl || Array.isArray(o.values) && (!o.values.length || Value.is(o.values[0])) && Array.isArray(o.exprSteps) && (!o.exprSteps.length || Explain_ExprStep.is(o.exprSteps[0]))); + }, + isSDK(o: any): o is ExplainSDKType { + return o && (o.$typeUrl === Explain.typeUrl || Array.isArray(o.values) && (!o.values.length || Value.isSDK(o.values[0])) && Array.isArray(o.expr_steps) && (!o.expr_steps.length || Explain_ExprStep.isSDK(o.expr_steps[0]))); + }, + isAmino(o: any): o is ExplainAmino { + return o && (o.$typeUrl === Explain.typeUrl || Array.isArray(o.values) && (!o.values.length || Value.isAmino(o.values[0])) && Array.isArray(o.expr_steps) && (!o.expr_steps.length || Explain_ExprStep.isAmino(o.expr_steps[0]))); + }, encode(message: Explain, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.values) { Value.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -222,6 +232,13 @@ export const Explain = { typeUrl: "/google.api.expr.v1alpha1.Explain", value: Explain.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Explain.typeUrl)) { + return; + } + Value.registerTypeUrl(); + Explain_ExprStep.registerTypeUrl(); } }; function createBaseExplain_ExprStep(): Explain_ExprStep { @@ -238,6 +255,15 @@ function createBaseExplain_ExprStep(): Explain_ExprStep { */ export const Explain_ExprStep = { typeUrl: "/google.api.expr.v1alpha1.ExprStep", + is(o: any): o is Explain_ExprStep { + return o && (o.$typeUrl === Explain_ExprStep.typeUrl || typeof o.id === "bigint" && typeof o.valueIndex === "number"); + }, + isSDK(o: any): o is Explain_ExprStepSDKType { + return o && (o.$typeUrl === Explain_ExprStep.typeUrl || typeof o.id === "bigint" && typeof o.value_index === "number"); + }, + isAmino(o: any): o is Explain_ExprStepAmino { + return o && (o.$typeUrl === Explain_ExprStep.typeUrl || typeof o.id === "bigint" && typeof o.value_index === "number"); + }, encode(message: Explain_ExprStep, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.id !== BigInt(0)) { writer.uint32(8).int64(message.id); @@ -320,5 +346,6 @@ export const Explain_ExprStep = { typeUrl: "/google.api.expr.v1alpha1.ExprStep", value: Explain_ExprStep.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/google/api/expr/v1alpha1/syntax.ts b/__fixtures__/v-next/outputv3/google/api/expr/v1alpha1/syntax.ts index 356daef6df..e1e879bc5c 100644 --- a/__fixtures__/v-next/outputv3/google/api/expr/v1alpha1/syntax.ts +++ b/__fixtures__/v-next/outputv3/google/api/expr/v1alpha1/syntax.ts @@ -2,6 +2,7 @@ import { NullValue, NullValueSDKType, nullValueFromJSON, nullValueToJSON } from import { Duration, DurationAmino, DurationSDKType } from "../../../protobuf/duration"; import { Timestamp, TimestampAmino, TimestampSDKType } from "../../../protobuf/timestamp"; import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { GlobalDecoderRegistry } from "../../../../registry"; import { isSet, DeepPartial, toTimestamp, fromTimestamp, bytesFromBase64, base64FromBytes, isObject } from "../../../../helpers"; export const protobufPackage = "google.api.expr.v1alpha1"; /** @@ -1153,6 +1154,15 @@ function createBaseParsedExpr(): ParsedExpr { */ export const ParsedExpr = { typeUrl: "/google.api.expr.v1alpha1.ParsedExpr", + is(o: any): o is ParsedExpr { + return o && o.$typeUrl === ParsedExpr.typeUrl; + }, + isSDK(o: any): o is ParsedExprSDKType { + return o && o.$typeUrl === ParsedExpr.typeUrl; + }, + isAmino(o: any): o is ParsedExprAmino { + return o && o.$typeUrl === ParsedExpr.typeUrl; + }, encode(message: ParsedExpr, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.expr !== undefined) { Expr.encode(message.expr, writer.uint32(18).fork()).ldelim(); @@ -1237,6 +1247,13 @@ export const ParsedExpr = { typeUrl: "/google.api.expr.v1alpha1.ParsedExpr", value: ParsedExpr.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ParsedExpr.typeUrl)) { + return; + } + Expr.registerTypeUrl(); + SourceInfo.registerTypeUrl(); } }; function createBaseExpr(): Expr { @@ -1273,6 +1290,15 @@ function createBaseExpr(): Expr { */ export const Expr = { typeUrl: "/google.api.expr.v1alpha1.Expr", + is(o: any): o is Expr { + return o && (o.$typeUrl === Expr.typeUrl || typeof o.id === "bigint"); + }, + isSDK(o: any): o is ExprSDKType { + return o && (o.$typeUrl === Expr.typeUrl || typeof o.id === "bigint"); + }, + isAmino(o: any): o is ExprAmino { + return o && (o.$typeUrl === Expr.typeUrl || typeof o.id === "bigint"); + }, encode(message: Expr, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.id !== BigInt(0)) { writer.uint32(16).int64(message.id); @@ -1453,6 +1479,18 @@ export const Expr = { typeUrl: "/google.api.expr.v1alpha1.Expr", value: Expr.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Expr.typeUrl)) { + return; + } + Constant.registerTypeUrl(); + Expr_Ident.registerTypeUrl(); + Expr_Select.registerTypeUrl(); + Expr_Call.registerTypeUrl(); + Expr_CreateList.registerTypeUrl(); + Expr_CreateStruct.registerTypeUrl(); + Expr_Comprehension.registerTypeUrl(); } }; function createBaseExpr_Ident(): Expr_Ident { @@ -1468,6 +1506,15 @@ function createBaseExpr_Ident(): Expr_Ident { */ export const Expr_Ident = { typeUrl: "/google.api.expr.v1alpha1.Ident", + is(o: any): o is Expr_Ident { + return o && (o.$typeUrl === Expr_Ident.typeUrl || typeof o.name === "string"); + }, + isSDK(o: any): o is Expr_IdentSDKType { + return o && (o.$typeUrl === Expr_Ident.typeUrl || typeof o.name === "string"); + }, + isAmino(o: any): o is Expr_IdentAmino { + return o && (o.$typeUrl === Expr_Ident.typeUrl || typeof o.name === "string"); + }, encode(message: Expr_Ident, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -1534,7 +1581,8 @@ export const Expr_Ident = { typeUrl: "/google.api.expr.v1alpha1.Ident", value: Expr_Ident.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseExpr_Select(): Expr_Select { return { @@ -1551,6 +1599,15 @@ function createBaseExpr_Select(): Expr_Select { */ export const Expr_Select = { typeUrl: "/google.api.expr.v1alpha1.Select", + is(o: any): o is Expr_Select { + return o && (o.$typeUrl === Expr_Select.typeUrl || typeof o.field === "string" && typeof o.testOnly === "boolean"); + }, + isSDK(o: any): o is Expr_SelectSDKType { + return o && (o.$typeUrl === Expr_Select.typeUrl || typeof o.field === "string" && typeof o.test_only === "boolean"); + }, + isAmino(o: any): o is Expr_SelectAmino { + return o && (o.$typeUrl === Expr_Select.typeUrl || typeof o.field === "string" && typeof o.test_only === "boolean"); + }, encode(message: Expr_Select, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.operand !== undefined) { Expr.encode(message.operand, writer.uint32(10).fork()).ldelim(); @@ -1647,6 +1704,12 @@ export const Expr_Select = { typeUrl: "/google.api.expr.v1alpha1.Select", value: Expr_Select.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Expr_Select.typeUrl)) { + return; + } + Expr.registerTypeUrl(); } }; function createBaseExpr_Call(): Expr_Call { @@ -1666,6 +1729,15 @@ function createBaseExpr_Call(): Expr_Call { */ export const Expr_Call = { typeUrl: "/google.api.expr.v1alpha1.Call", + is(o: any): o is Expr_Call { + return o && (o.$typeUrl === Expr_Call.typeUrl || typeof o.function === "string" && Array.isArray(o.args) && (!o.args.length || Expr.is(o.args[0]))); + }, + isSDK(o: any): o is Expr_CallSDKType { + return o && (o.$typeUrl === Expr_Call.typeUrl || typeof o.function === "string" && Array.isArray(o.args) && (!o.args.length || Expr.isSDK(o.args[0]))); + }, + isAmino(o: any): o is Expr_CallAmino { + return o && (o.$typeUrl === Expr_Call.typeUrl || typeof o.function === "string" && Array.isArray(o.args) && (!o.args.length || Expr.isAmino(o.args[0]))); + }, encode(message: Expr_Call, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.target !== undefined) { Expr.encode(message.target, writer.uint32(10).fork()).ldelim(); @@ -1768,6 +1840,12 @@ export const Expr_Call = { typeUrl: "/google.api.expr.v1alpha1.Call", value: Expr_Call.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Expr_Call.typeUrl)) { + return; + } + Expr.registerTypeUrl(); } }; function createBaseExpr_CreateList(): Expr_CreateList { @@ -1786,6 +1864,15 @@ function createBaseExpr_CreateList(): Expr_CreateList { */ export const Expr_CreateList = { typeUrl: "/google.api.expr.v1alpha1.CreateList", + is(o: any): o is Expr_CreateList { + return o && (o.$typeUrl === Expr_CreateList.typeUrl || Array.isArray(o.elements) && (!o.elements.length || Expr.is(o.elements[0]))); + }, + isSDK(o: any): o is Expr_CreateListSDKType { + return o && (o.$typeUrl === Expr_CreateList.typeUrl || Array.isArray(o.elements) && (!o.elements.length || Expr.isSDK(o.elements[0]))); + }, + isAmino(o: any): o is Expr_CreateListAmino { + return o && (o.$typeUrl === Expr_CreateList.typeUrl || Array.isArray(o.elements) && (!o.elements.length || Expr.isAmino(o.elements[0]))); + }, encode(message: Expr_CreateList, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.elements) { Expr.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -1858,6 +1945,12 @@ export const Expr_CreateList = { typeUrl: "/google.api.expr.v1alpha1.CreateList", value: Expr_CreateList.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Expr_CreateList.typeUrl)) { + return; + } + Expr.registerTypeUrl(); } }; function createBaseExpr_CreateStruct(): Expr_CreateStruct { @@ -1878,6 +1971,15 @@ function createBaseExpr_CreateStruct(): Expr_CreateStruct { */ export const Expr_CreateStruct = { typeUrl: "/google.api.expr.v1alpha1.CreateStruct", + is(o: any): o is Expr_CreateStruct { + return o && (o.$typeUrl === Expr_CreateStruct.typeUrl || typeof o.messageName === "string" && Array.isArray(o.entries) && (!o.entries.length || Expr_CreateStruct_Entry.is(o.entries[0]))); + }, + isSDK(o: any): o is Expr_CreateStructSDKType { + return o && (o.$typeUrl === Expr_CreateStruct.typeUrl || typeof o.message_name === "string" && Array.isArray(o.entries) && (!o.entries.length || Expr_CreateStruct_Entry.isSDK(o.entries[0]))); + }, + isAmino(o: any): o is Expr_CreateStructAmino { + return o && (o.$typeUrl === Expr_CreateStruct.typeUrl || typeof o.message_name === "string" && Array.isArray(o.entries) && (!o.entries.length || Expr_CreateStruct_Entry.isAmino(o.entries[0]))); + }, encode(message: Expr_CreateStruct, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.messageName !== "") { writer.uint32(10).string(message.messageName); @@ -1964,6 +2066,12 @@ export const Expr_CreateStruct = { typeUrl: "/google.api.expr.v1alpha1.CreateStruct", value: Expr_CreateStruct.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Expr_CreateStruct.typeUrl)) { + return; + } + Expr_CreateStruct_Entry.registerTypeUrl(); } }; function createBaseExpr_CreateStruct_Entry(): Expr_CreateStruct_Entry { @@ -1982,6 +2090,15 @@ function createBaseExpr_CreateStruct_Entry(): Expr_CreateStruct_Entry { */ export const Expr_CreateStruct_Entry = { typeUrl: "/google.api.expr.v1alpha1.Entry", + is(o: any): o is Expr_CreateStruct_Entry { + return o && (o.$typeUrl === Expr_CreateStruct_Entry.typeUrl || typeof o.id === "bigint"); + }, + isSDK(o: any): o is Expr_CreateStruct_EntrySDKType { + return o && (o.$typeUrl === Expr_CreateStruct_Entry.typeUrl || typeof o.id === "bigint"); + }, + isAmino(o: any): o is Expr_CreateStruct_EntryAmino { + return o && (o.$typeUrl === Expr_CreateStruct_Entry.typeUrl || typeof o.id === "bigint"); + }, encode(message: Expr_CreateStruct_Entry, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.id !== BigInt(0)) { writer.uint32(8).int64(message.id); @@ -2096,6 +2213,12 @@ export const Expr_CreateStruct_Entry = { typeUrl: "/google.api.expr.v1alpha1.Entry", value: Expr_CreateStruct_Entry.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Expr_CreateStruct_Entry.typeUrl)) { + return; + } + Expr.registerTypeUrl(); } }; function createBaseExpr_Comprehension(): Expr_Comprehension { @@ -2142,6 +2265,15 @@ function createBaseExpr_Comprehension(): Expr_Comprehension { */ export const Expr_Comprehension = { typeUrl: "/google.api.expr.v1alpha1.Comprehension", + is(o: any): o is Expr_Comprehension { + return o && (o.$typeUrl === Expr_Comprehension.typeUrl || typeof o.iterVar === "string" && typeof o.accuVar === "string"); + }, + isSDK(o: any): o is Expr_ComprehensionSDKType { + return o && (o.$typeUrl === Expr_Comprehension.typeUrl || typeof o.iter_var === "string" && typeof o.accu_var === "string"); + }, + isAmino(o: any): o is Expr_ComprehensionAmino { + return o && (o.$typeUrl === Expr_Comprehension.typeUrl || typeof o.iter_var === "string" && typeof o.accu_var === "string"); + }, encode(message: Expr_Comprehension, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.iterVar !== "") { writer.uint32(10).string(message.iterVar); @@ -2302,6 +2434,12 @@ export const Expr_Comprehension = { typeUrl: "/google.api.expr.v1alpha1.Comprehension", value: Expr_Comprehension.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Expr_Comprehension.typeUrl)) { + return; + } + Expr.registerTypeUrl(); } }; function createBaseConstant(): Constant { @@ -2337,6 +2475,15 @@ function createBaseConstant(): Constant { */ export const Constant = { typeUrl: "/google.api.expr.v1alpha1.Constant", + is(o: any): o is Constant { + return o && o.$typeUrl === Constant.typeUrl; + }, + isSDK(o: any): o is ConstantSDKType { + return o && o.$typeUrl === Constant.typeUrl; + }, + isAmino(o: any): o is ConstantAmino { + return o && o.$typeUrl === Constant.typeUrl; + }, encode(message: Constant, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.nullValue !== undefined) { writer.uint32(8).int32(message.nullValue); @@ -2521,7 +2668,8 @@ export const Constant = { typeUrl: "/google.api.expr.v1alpha1.Constant", value: Constant.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseSourceInfo_PositionsEntry(): SourceInfo_PositionsEntry { return { @@ -2611,7 +2759,8 @@ export const SourceInfo_PositionsEntry = { }, toProto(message: SourceInfo_PositionsEntry): Uint8Array { return SourceInfo_PositionsEntry.encode(message).finish(); - } + }, + registerTypeUrl() {} }; function createBaseSourceInfo_MacroCallsEntry(): SourceInfo_MacroCallsEntry { return { @@ -2703,6 +2852,9 @@ export const SourceInfo_MacroCallsEntry = { }, toProto(message: SourceInfo_MacroCallsEntry): Uint8Array { return SourceInfo_MacroCallsEntry.encode(message).finish(); + }, + registerTypeUrl() { + Expr.registerTypeUrl(); } }; function createBaseSourceInfo(): SourceInfo { @@ -2722,6 +2874,15 @@ function createBaseSourceInfo(): SourceInfo { */ export const SourceInfo = { typeUrl: "/google.api.expr.v1alpha1.SourceInfo", + is(o: any): o is SourceInfo { + return o && (o.$typeUrl === SourceInfo.typeUrl || typeof o.syntaxVersion === "string" && typeof o.location === "string" && Array.isArray(o.lineOffsets) && (!o.lineOffsets.length || typeof o.lineOffsets[0] === "number") && isSet(o.positions) && isSet(o.macroCalls)); + }, + isSDK(o: any): o is SourceInfoSDKType { + return o && (o.$typeUrl === SourceInfo.typeUrl || typeof o.syntax_version === "string" && typeof o.location === "string" && Array.isArray(o.line_offsets) && (!o.line_offsets.length || typeof o.line_offsets[0] === "number") && isSet(o.positions) && isSet(o.macro_calls)); + }, + isAmino(o: any): o is SourceInfoAmino { + return o && (o.$typeUrl === SourceInfo.typeUrl || typeof o.syntax_version === "string" && typeof o.location === "string" && Array.isArray(o.line_offsets) && (!o.line_offsets.length || typeof o.line_offsets[0] === "number") && isSet(o.positions) && isSet(o.macro_calls)); + }, encode(message: SourceInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.syntaxVersion !== "") { writer.uint32(10).string(message.syntaxVersion); @@ -2935,6 +3096,12 @@ export const SourceInfo = { typeUrl: "/google.api.expr.v1alpha1.SourceInfo", value: SourceInfo.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(SourceInfo.typeUrl)) { + return; + } + Expr.registerTypeUrl(); } }; function createBaseSourcePosition(): SourcePosition { @@ -2953,6 +3120,15 @@ function createBaseSourcePosition(): SourcePosition { */ export const SourcePosition = { typeUrl: "/google.api.expr.v1alpha1.SourcePosition", + is(o: any): o is SourcePosition { + return o && (o.$typeUrl === SourcePosition.typeUrl || typeof o.location === "string" && typeof o.offset === "number" && typeof o.line === "number" && typeof o.column === "number"); + }, + isSDK(o: any): o is SourcePositionSDKType { + return o && (o.$typeUrl === SourcePosition.typeUrl || typeof o.location === "string" && typeof o.offset === "number" && typeof o.line === "number" && typeof o.column === "number"); + }, + isAmino(o: any): o is SourcePositionAmino { + return o && (o.$typeUrl === SourcePosition.typeUrl || typeof o.location === "string" && typeof o.offset === "number" && typeof o.line === "number" && typeof o.column === "number"); + }, encode(message: SourcePosition, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.location !== "") { writer.uint32(10).string(message.location); @@ -3061,5 +3237,6 @@ export const SourcePosition = { typeUrl: "/google.api.expr.v1alpha1.SourcePosition", value: SourcePosition.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/google/api/expr/v1alpha1/value.ts b/__fixtures__/v-next/outputv3/google/api/expr/v1alpha1/value.ts index ab518f8fd0..e79992d404 100644 --- a/__fixtures__/v-next/outputv3/google/api/expr/v1alpha1/value.ts +++ b/__fixtures__/v-next/outputv3/google/api/expr/v1alpha1/value.ts @@ -1,6 +1,7 @@ import { NullValue, NullValueSDKType, nullValueFromJSON, nullValueToJSON } from "../../../protobuf/struct"; import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../protobuf/any"; import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { GlobalDecoderRegistry } from "../../../../registry"; import { isSet, bytesFromBase64, DeepPartial, base64FromBytes } from "../../../../helpers"; export const protobufPackage = "google.api.expr.v1alpha1"; /** @@ -371,6 +372,15 @@ function createBaseValue(): Value { */ export const Value = { typeUrl: "/google.api.expr.v1alpha1.Value", + is(o: any): o is Value { + return o && o.$typeUrl === Value.typeUrl; + }, + isSDK(o: any): o is ValueSDKType { + return o && o.$typeUrl === Value.typeUrl; + }, + isAmino(o: any): o is ValueAmino { + return o && o.$typeUrl === Value.typeUrl; + }, encode(message: Value, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.nullValue !== undefined) { writer.uint32(8).int32(message.nullValue); @@ -603,6 +613,13 @@ export const Value = { typeUrl: "/google.api.expr.v1alpha1.Value", value: Value.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Value.typeUrl)) { + return; + } + MapValue.registerTypeUrl(); + ListValue.registerTypeUrl(); } }; function createBaseEnumValue(): EnumValue { @@ -619,6 +636,15 @@ function createBaseEnumValue(): EnumValue { */ export const EnumValue = { typeUrl: "/google.api.expr.v1alpha1.EnumValue", + is(o: any): o is EnumValue { + return o && (o.$typeUrl === EnumValue.typeUrl || typeof o.type === "string" && typeof o.value === "number"); + }, + isSDK(o: any): o is EnumValueSDKType { + return o && (o.$typeUrl === EnumValue.typeUrl || typeof o.type === "string" && typeof o.value === "number"); + }, + isAmino(o: any): o is EnumValueAmino { + return o && (o.$typeUrl === EnumValue.typeUrl || typeof o.type === "string" && typeof o.value === "number"); + }, encode(message: EnumValue, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.type !== "") { writer.uint32(10).string(message.type); @@ -699,7 +725,8 @@ export const EnumValue = { typeUrl: "/google.api.expr.v1alpha1.EnumValue", value: EnumValue.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseListValue(): ListValue { return { @@ -717,6 +744,15 @@ function createBaseListValue(): ListValue { */ export const ListValue = { typeUrl: "/google.api.expr.v1alpha1.ListValue", + is(o: any): o is ListValue { + return o && (o.$typeUrl === ListValue.typeUrl || Array.isArray(o.values) && (!o.values.length || Value.is(o.values[0]))); + }, + isSDK(o: any): o is ListValueSDKType { + return o && (o.$typeUrl === ListValue.typeUrl || Array.isArray(o.values) && (!o.values.length || Value.isSDK(o.values[0]))); + }, + isAmino(o: any): o is ListValueAmino { + return o && (o.$typeUrl === ListValue.typeUrl || Array.isArray(o.values) && (!o.values.length || Value.isAmino(o.values[0]))); + }, encode(message: ListValue, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.values) { Value.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -789,6 +825,12 @@ export const ListValue = { typeUrl: "/google.api.expr.v1alpha1.ListValue", value: ListValue.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ListValue.typeUrl)) { + return; + } + Value.registerTypeUrl(); } }; function createBaseMapValue(): MapValue { @@ -807,6 +849,15 @@ function createBaseMapValue(): MapValue { */ export const MapValue = { typeUrl: "/google.api.expr.v1alpha1.MapValue", + is(o: any): o is MapValue { + return o && (o.$typeUrl === MapValue.typeUrl || Array.isArray(o.entries) && (!o.entries.length || MapValue_Entry.is(o.entries[0]))); + }, + isSDK(o: any): o is MapValueSDKType { + return o && (o.$typeUrl === MapValue.typeUrl || Array.isArray(o.entries) && (!o.entries.length || MapValue_Entry.isSDK(o.entries[0]))); + }, + isAmino(o: any): o is MapValueAmino { + return o && (o.$typeUrl === MapValue.typeUrl || Array.isArray(o.entries) && (!o.entries.length || MapValue_Entry.isAmino(o.entries[0]))); + }, encode(message: MapValue, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.entries) { MapValue_Entry.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -879,6 +930,12 @@ export const MapValue = { typeUrl: "/google.api.expr.v1alpha1.MapValue", value: MapValue.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MapValue.typeUrl)) { + return; + } + MapValue_Entry.registerTypeUrl(); } }; function createBaseMapValue_Entry(): MapValue_Entry { @@ -895,6 +952,15 @@ function createBaseMapValue_Entry(): MapValue_Entry { */ export const MapValue_Entry = { typeUrl: "/google.api.expr.v1alpha1.Entry", + is(o: any): o is MapValue_Entry { + return o && o.$typeUrl === MapValue_Entry.typeUrl; + }, + isSDK(o: any): o is MapValue_EntrySDKType { + return o && o.$typeUrl === MapValue_Entry.typeUrl; + }, + isAmino(o: any): o is MapValue_EntryAmino { + return o && o.$typeUrl === MapValue_Entry.typeUrl; + }, encode(message: MapValue_Entry, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.key !== undefined) { Value.encode(message.key, writer.uint32(10).fork()).ldelim(); @@ -979,5 +1045,11 @@ export const MapValue_Entry = { typeUrl: "/google.api.expr.v1alpha1.Entry", value: MapValue_Entry.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MapValue_Entry.typeUrl)) { + return; + } + Value.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/google/api/expr/v1beta1/decl.ts b/__fixtures__/v-next/outputv3/google/api/expr/v1beta1/decl.ts index 11da19ef1e..0aa609696d 100644 --- a/__fixtures__/v-next/outputv3/google/api/expr/v1beta1/decl.ts +++ b/__fixtures__/v-next/outputv3/google/api/expr/v1beta1/decl.ts @@ -1,5 +1,6 @@ import { Expr, ExprAmino, ExprSDKType } from "./expr"; import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { GlobalDecoderRegistry } from "../../../../registry"; import { isSet, DeepPartial } from "../../../../helpers"; export const protobufPackage = "google.api.expr.v1beta1"; /** @@ -259,6 +260,15 @@ function createBaseDecl(): Decl { */ export const Decl = { typeUrl: "/google.api.expr.v1beta1.Decl", + is(o: any): o is Decl { + return o && (o.$typeUrl === Decl.typeUrl || typeof o.id === "number" && typeof o.name === "string" && typeof o.doc === "string"); + }, + isSDK(o: any): o is DeclSDKType { + return o && (o.$typeUrl === Decl.typeUrl || typeof o.id === "number" && typeof o.name === "string" && typeof o.doc === "string"); + }, + isAmino(o: any): o is DeclAmino { + return o && (o.$typeUrl === Decl.typeUrl || typeof o.id === "number" && typeof o.name === "string" && typeof o.doc === "string"); + }, encode(message: Decl, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.id !== 0) { writer.uint32(8).int32(message.id); @@ -385,6 +395,13 @@ export const Decl = { typeUrl: "/google.api.expr.v1beta1.Decl", value: Decl.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Decl.typeUrl)) { + return; + } + IdentDecl.registerTypeUrl(); + FunctionDecl.registerTypeUrl(); } }; function createBaseDeclType(): DeclType { @@ -405,6 +422,15 @@ function createBaseDeclType(): DeclType { */ export const DeclType = { typeUrl: "/google.api.expr.v1beta1.DeclType", + is(o: any): o is DeclType { + return o && (o.$typeUrl === DeclType.typeUrl || typeof o.id === "number" && typeof o.type === "string" && Array.isArray(o.typeParams) && (!o.typeParams.length || DeclType.is(o.typeParams[0]))); + }, + isSDK(o: any): o is DeclTypeSDKType { + return o && (o.$typeUrl === DeclType.typeUrl || typeof o.id === "number" && typeof o.type === "string" && Array.isArray(o.type_params) && (!o.type_params.length || DeclType.isSDK(o.type_params[0]))); + }, + isAmino(o: any): o is DeclTypeAmino { + return o && (o.$typeUrl === DeclType.typeUrl || typeof o.id === "number" && typeof o.type === "string" && Array.isArray(o.type_params) && (!o.type_params.length || DeclType.isAmino(o.type_params[0]))); + }, encode(message: DeclType, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.id !== 0) { writer.uint32(8).int32(message.id); @@ -505,6 +531,12 @@ export const DeclType = { typeUrl: "/google.api.expr.v1beta1.DeclType", value: DeclType.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(DeclType.typeUrl)) { + return; + } + DeclType.registerTypeUrl(); } }; function createBaseIdentDecl(): IdentDecl { @@ -521,6 +553,15 @@ function createBaseIdentDecl(): IdentDecl { */ export const IdentDecl = { typeUrl: "/google.api.expr.v1beta1.IdentDecl", + is(o: any): o is IdentDecl { + return o && o.$typeUrl === IdentDecl.typeUrl; + }, + isSDK(o: any): o is IdentDeclSDKType { + return o && o.$typeUrl === IdentDecl.typeUrl; + }, + isAmino(o: any): o is IdentDeclAmino { + return o && o.$typeUrl === IdentDecl.typeUrl; + }, encode(message: IdentDecl, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.type !== undefined) { DeclType.encode(message.type, writer.uint32(26).fork()).ldelim(); @@ -605,6 +646,13 @@ export const IdentDecl = { typeUrl: "/google.api.expr.v1beta1.IdentDecl", value: IdentDecl.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(IdentDecl.typeUrl)) { + return; + } + DeclType.registerTypeUrl(); + Expr.registerTypeUrl(); } }; function createBaseFunctionDecl(): FunctionDecl { @@ -622,6 +670,15 @@ function createBaseFunctionDecl(): FunctionDecl { */ export const FunctionDecl = { typeUrl: "/google.api.expr.v1beta1.FunctionDecl", + is(o: any): o is FunctionDecl { + return o && (o.$typeUrl === FunctionDecl.typeUrl || Array.isArray(o.args) && (!o.args.length || IdentDecl.is(o.args[0])) && typeof o.receiverFunction === "boolean"); + }, + isSDK(o: any): o is FunctionDeclSDKType { + return o && (o.$typeUrl === FunctionDecl.typeUrl || Array.isArray(o.args) && (!o.args.length || IdentDecl.isSDK(o.args[0])) && typeof o.receiver_function === "boolean"); + }, + isAmino(o: any): o is FunctionDeclAmino { + return o && (o.$typeUrl === FunctionDecl.typeUrl || Array.isArray(o.args) && (!o.args.length || IdentDecl.isAmino(o.args[0])) && typeof o.receiver_function === "boolean"); + }, encode(message: FunctionDecl, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.args) { IdentDecl.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -724,5 +781,12 @@ export const FunctionDecl = { typeUrl: "/google.api.expr.v1beta1.FunctionDecl", value: FunctionDecl.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(FunctionDecl.typeUrl)) { + return; + } + IdentDecl.registerTypeUrl(); + DeclType.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/google/api/expr/v1beta1/eval.ts b/__fixtures__/v-next/outputv3/google/api/expr/v1beta1/eval.ts index 0a91c2d672..a76aa562ce 100644 --- a/__fixtures__/v-next/outputv3/google/api/expr/v1beta1/eval.ts +++ b/__fixtures__/v-next/outputv3/google/api/expr/v1beta1/eval.ts @@ -2,6 +2,7 @@ import { Value, ValueAmino, ValueSDKType } from "./value"; import { Status, StatusAmino, StatusSDKType } from "../../../rpc/status"; import { BinaryReader, BinaryWriter } from "../../../../binary"; import { DeepPartial, isSet } from "../../../../helpers"; +import { GlobalDecoderRegistry } from "../../../../registry"; export const protobufPackage = "google.api.expr.v1beta1"; /** * The state of an evaluation. @@ -377,6 +378,15 @@ function createBaseEvalState(): EvalState { */ export const EvalState = { typeUrl: "/google.api.expr.v1beta1.EvalState", + is(o: any): o is EvalState { + return o && (o.$typeUrl === EvalState.typeUrl || Array.isArray(o.values) && (!o.values.length || ExprValue.is(o.values[0])) && Array.isArray(o.results) && (!o.results.length || EvalState_Result.is(o.results[0]))); + }, + isSDK(o: any): o is EvalStateSDKType { + return o && (o.$typeUrl === EvalState.typeUrl || Array.isArray(o.values) && (!o.values.length || ExprValue.isSDK(o.values[0])) && Array.isArray(o.results) && (!o.results.length || EvalState_Result.isSDK(o.results[0]))); + }, + isAmino(o: any): o is EvalStateAmino { + return o && (o.$typeUrl === EvalState.typeUrl || Array.isArray(o.values) && (!o.values.length || ExprValue.isAmino(o.values[0])) && Array.isArray(o.results) && (!o.results.length || EvalState_Result.isAmino(o.results[0]))); + }, encode(message: EvalState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.values) { ExprValue.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -469,6 +479,13 @@ export const EvalState = { typeUrl: "/google.api.expr.v1beta1.EvalState", value: EvalState.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(EvalState.typeUrl)) { + return; + } + ExprValue.registerTypeUrl(); + EvalState_Result.registerTypeUrl(); } }; function createBaseEvalState_Result(): EvalState_Result { @@ -485,6 +502,15 @@ function createBaseEvalState_Result(): EvalState_Result { */ export const EvalState_Result = { typeUrl: "/google.api.expr.v1beta1.Result", + is(o: any): o is EvalState_Result { + return o && (o.$typeUrl === EvalState_Result.typeUrl || typeof o.value === "number"); + }, + isSDK(o: any): o is EvalState_ResultSDKType { + return o && (o.$typeUrl === EvalState_Result.typeUrl || typeof o.value === "number"); + }, + isAmino(o: any): o is EvalState_ResultAmino { + return o && (o.$typeUrl === EvalState_Result.typeUrl || typeof o.value === "number"); + }, encode(message: EvalState_Result, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.expr !== undefined) { IdRef.encode(message.expr, writer.uint32(10).fork()).ldelim(); @@ -567,6 +593,12 @@ export const EvalState_Result = { typeUrl: "/google.api.expr.v1beta1.Result", value: EvalState_Result.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(EvalState_Result.typeUrl)) { + return; + } + IdRef.registerTypeUrl(); } }; function createBaseExprValue(): ExprValue { @@ -584,6 +616,15 @@ function createBaseExprValue(): ExprValue { */ export const ExprValue = { typeUrl: "/google.api.expr.v1beta1.ExprValue", + is(o: any): o is ExprValue { + return o && o.$typeUrl === ExprValue.typeUrl; + }, + isSDK(o: any): o is ExprValueSDKType { + return o && o.$typeUrl === ExprValue.typeUrl; + }, + isAmino(o: any): o is ExprValueAmino { + return o && o.$typeUrl === ExprValue.typeUrl; + }, encode(message: ExprValue, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.value !== undefined) { Value.encode(message.value, writer.uint32(10).fork()).ldelim(); @@ -684,6 +725,14 @@ export const ExprValue = { typeUrl: "/google.api.expr.v1beta1.ExprValue", value: ExprValue.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ExprValue.typeUrl)) { + return; + } + Value.registerTypeUrl(); + ErrorSet.registerTypeUrl(); + UnknownSet.registerTypeUrl(); } }; function createBaseErrorSet(): ErrorSet { @@ -701,6 +750,15 @@ function createBaseErrorSet(): ErrorSet { */ export const ErrorSet = { typeUrl: "/google.api.expr.v1beta1.ErrorSet", + is(o: any): o is ErrorSet { + return o && (o.$typeUrl === ErrorSet.typeUrl || Array.isArray(o.errors) && (!o.errors.length || Status.is(o.errors[0]))); + }, + isSDK(o: any): o is ErrorSetSDKType { + return o && (o.$typeUrl === ErrorSet.typeUrl || Array.isArray(o.errors) && (!o.errors.length || Status.isSDK(o.errors[0]))); + }, + isAmino(o: any): o is ErrorSetAmino { + return o && (o.$typeUrl === ErrorSet.typeUrl || Array.isArray(o.errors) && (!o.errors.length || Status.isAmino(o.errors[0]))); + }, encode(message: ErrorSet, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.errors) { Status.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -773,6 +831,12 @@ export const ErrorSet = { typeUrl: "/google.api.expr.v1beta1.ErrorSet", value: ErrorSet.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ErrorSet.typeUrl)) { + return; + } + Status.registerTypeUrl(); } }; function createBaseUnknownSet(): UnknownSet { @@ -790,6 +854,15 @@ function createBaseUnknownSet(): UnknownSet { */ export const UnknownSet = { typeUrl: "/google.api.expr.v1beta1.UnknownSet", + is(o: any): o is UnknownSet { + return o && (o.$typeUrl === UnknownSet.typeUrl || Array.isArray(o.exprs) && (!o.exprs.length || IdRef.is(o.exprs[0]))); + }, + isSDK(o: any): o is UnknownSetSDKType { + return o && (o.$typeUrl === UnknownSet.typeUrl || Array.isArray(o.exprs) && (!o.exprs.length || IdRef.isSDK(o.exprs[0]))); + }, + isAmino(o: any): o is UnknownSetAmino { + return o && (o.$typeUrl === UnknownSet.typeUrl || Array.isArray(o.exprs) && (!o.exprs.length || IdRef.isAmino(o.exprs[0]))); + }, encode(message: UnknownSet, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.exprs) { IdRef.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -862,6 +935,12 @@ export const UnknownSet = { typeUrl: "/google.api.expr.v1beta1.UnknownSet", value: UnknownSet.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(UnknownSet.typeUrl)) { + return; + } + IdRef.registerTypeUrl(); } }; function createBaseIdRef(): IdRef { @@ -877,6 +956,15 @@ function createBaseIdRef(): IdRef { */ export const IdRef = { typeUrl: "/google.api.expr.v1beta1.IdRef", + is(o: any): o is IdRef { + return o && (o.$typeUrl === IdRef.typeUrl || typeof o.id === "number"); + }, + isSDK(o: any): o is IdRefSDKType { + return o && (o.$typeUrl === IdRef.typeUrl || typeof o.id === "number"); + }, + isAmino(o: any): o is IdRefAmino { + return o && (o.$typeUrl === IdRef.typeUrl || typeof o.id === "number"); + }, encode(message: IdRef, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.id !== 0) { writer.uint32(8).int32(message.id); @@ -943,5 +1031,6 @@ export const IdRef = { typeUrl: "/google.api.expr.v1beta1.IdRef", value: IdRef.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/google/api/expr/v1beta1/expr.ts b/__fixtures__/v-next/outputv3/google/api/expr/v1beta1/expr.ts index b33da61787..c78f317fbc 100644 --- a/__fixtures__/v-next/outputv3/google/api/expr/v1beta1/expr.ts +++ b/__fixtures__/v-next/outputv3/google/api/expr/v1beta1/expr.ts @@ -1,6 +1,7 @@ import { SourceInfo, SourceInfoAmino, SourceInfoSDKType } from "./source"; import { NullValue, NullValueSDKType, nullValueFromJSON, nullValueToJSON } from "../../../protobuf/struct"; import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { GlobalDecoderRegistry } from "../../../../registry"; import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../../helpers"; export const protobufPackage = "google.api.expr.v1beta1"; /** @@ -871,6 +872,15 @@ function createBaseParsedExpr(): ParsedExpr { */ export const ParsedExpr = { typeUrl: "/google.api.expr.v1beta1.ParsedExpr", + is(o: any): o is ParsedExpr { + return o && (o.$typeUrl === ParsedExpr.typeUrl || typeof o.syntaxVersion === "string"); + }, + isSDK(o: any): o is ParsedExprSDKType { + return o && (o.$typeUrl === ParsedExpr.typeUrl || typeof o.syntax_version === "string"); + }, + isAmino(o: any): o is ParsedExprAmino { + return o && (o.$typeUrl === ParsedExpr.typeUrl || typeof o.syntax_version === "string"); + }, encode(message: ParsedExpr, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.expr !== undefined) { Expr.encode(message.expr, writer.uint32(18).fork()).ldelim(); @@ -969,6 +979,13 @@ export const ParsedExpr = { typeUrl: "/google.api.expr.v1beta1.ParsedExpr", value: ParsedExpr.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ParsedExpr.typeUrl)) { + return; + } + Expr.registerTypeUrl(); + SourceInfo.registerTypeUrl(); } }; function createBaseExpr(): Expr { @@ -1005,6 +1022,15 @@ function createBaseExpr(): Expr { */ export const Expr = { typeUrl: "/google.api.expr.v1beta1.Expr", + is(o: any): o is Expr { + return o && (o.$typeUrl === Expr.typeUrl || typeof o.id === "number"); + }, + isSDK(o: any): o is ExprSDKType { + return o && (o.$typeUrl === Expr.typeUrl || typeof o.id === "number"); + }, + isAmino(o: any): o is ExprAmino { + return o && (o.$typeUrl === Expr.typeUrl || typeof o.id === "number"); + }, encode(message: Expr, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.id !== 0) { writer.uint32(16).int32(message.id); @@ -1183,6 +1209,18 @@ export const Expr = { typeUrl: "/google.api.expr.v1beta1.Expr", value: Expr.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Expr.typeUrl)) { + return; + } + Literal.registerTypeUrl(); + Expr_Ident.registerTypeUrl(); + Expr_Select.registerTypeUrl(); + Expr_Call.registerTypeUrl(); + Expr_CreateList.registerTypeUrl(); + Expr_CreateStruct.registerTypeUrl(); + Expr_Comprehension.registerTypeUrl(); } }; function createBaseExpr_Ident(): Expr_Ident { @@ -1198,6 +1236,15 @@ function createBaseExpr_Ident(): Expr_Ident { */ export const Expr_Ident = { typeUrl: "/google.api.expr.v1beta1.Ident", + is(o: any): o is Expr_Ident { + return o && (o.$typeUrl === Expr_Ident.typeUrl || typeof o.name === "string"); + }, + isSDK(o: any): o is Expr_IdentSDKType { + return o && (o.$typeUrl === Expr_Ident.typeUrl || typeof o.name === "string"); + }, + isAmino(o: any): o is Expr_IdentAmino { + return o && (o.$typeUrl === Expr_Ident.typeUrl || typeof o.name === "string"); + }, encode(message: Expr_Ident, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -1264,7 +1311,8 @@ export const Expr_Ident = { typeUrl: "/google.api.expr.v1beta1.Ident", value: Expr_Ident.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseExpr_Select(): Expr_Select { return { @@ -1281,6 +1329,15 @@ function createBaseExpr_Select(): Expr_Select { */ export const Expr_Select = { typeUrl: "/google.api.expr.v1beta1.Select", + is(o: any): o is Expr_Select { + return o && (o.$typeUrl === Expr_Select.typeUrl || typeof o.field === "string" && typeof o.testOnly === "boolean"); + }, + isSDK(o: any): o is Expr_SelectSDKType { + return o && (o.$typeUrl === Expr_Select.typeUrl || typeof o.field === "string" && typeof o.test_only === "boolean"); + }, + isAmino(o: any): o is Expr_SelectAmino { + return o && (o.$typeUrl === Expr_Select.typeUrl || typeof o.field === "string" && typeof o.test_only === "boolean"); + }, encode(message: Expr_Select, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.operand !== undefined) { Expr.encode(message.operand, writer.uint32(10).fork()).ldelim(); @@ -1377,6 +1434,12 @@ export const Expr_Select = { typeUrl: "/google.api.expr.v1beta1.Select", value: Expr_Select.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Expr_Select.typeUrl)) { + return; + } + Expr.registerTypeUrl(); } }; function createBaseExpr_Call(): Expr_Call { @@ -1396,6 +1459,15 @@ function createBaseExpr_Call(): Expr_Call { */ export const Expr_Call = { typeUrl: "/google.api.expr.v1beta1.Call", + is(o: any): o is Expr_Call { + return o && (o.$typeUrl === Expr_Call.typeUrl || typeof o.function === "string" && Array.isArray(o.args) && (!o.args.length || Expr.is(o.args[0]))); + }, + isSDK(o: any): o is Expr_CallSDKType { + return o && (o.$typeUrl === Expr_Call.typeUrl || typeof o.function === "string" && Array.isArray(o.args) && (!o.args.length || Expr.isSDK(o.args[0]))); + }, + isAmino(o: any): o is Expr_CallAmino { + return o && (o.$typeUrl === Expr_Call.typeUrl || typeof o.function === "string" && Array.isArray(o.args) && (!o.args.length || Expr.isAmino(o.args[0]))); + }, encode(message: Expr_Call, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.target !== undefined) { Expr.encode(message.target, writer.uint32(10).fork()).ldelim(); @@ -1498,6 +1570,12 @@ export const Expr_Call = { typeUrl: "/google.api.expr.v1beta1.Call", value: Expr_Call.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Expr_Call.typeUrl)) { + return; + } + Expr.registerTypeUrl(); } }; function createBaseExpr_CreateList(): Expr_CreateList { @@ -1516,6 +1594,15 @@ function createBaseExpr_CreateList(): Expr_CreateList { */ export const Expr_CreateList = { typeUrl: "/google.api.expr.v1beta1.CreateList", + is(o: any): o is Expr_CreateList { + return o && (o.$typeUrl === Expr_CreateList.typeUrl || Array.isArray(o.elements) && (!o.elements.length || Expr.is(o.elements[0]))); + }, + isSDK(o: any): o is Expr_CreateListSDKType { + return o && (o.$typeUrl === Expr_CreateList.typeUrl || Array.isArray(o.elements) && (!o.elements.length || Expr.isSDK(o.elements[0]))); + }, + isAmino(o: any): o is Expr_CreateListAmino { + return o && (o.$typeUrl === Expr_CreateList.typeUrl || Array.isArray(o.elements) && (!o.elements.length || Expr.isAmino(o.elements[0]))); + }, encode(message: Expr_CreateList, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.elements) { Expr.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -1588,6 +1675,12 @@ export const Expr_CreateList = { typeUrl: "/google.api.expr.v1beta1.CreateList", value: Expr_CreateList.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Expr_CreateList.typeUrl)) { + return; + } + Expr.registerTypeUrl(); } }; function createBaseExpr_CreateStruct(): Expr_CreateStruct { @@ -1608,6 +1701,15 @@ function createBaseExpr_CreateStruct(): Expr_CreateStruct { */ export const Expr_CreateStruct = { typeUrl: "/google.api.expr.v1beta1.CreateStruct", + is(o: any): o is Expr_CreateStruct { + return o && (o.$typeUrl === Expr_CreateStruct.typeUrl || typeof o.type === "string" && Array.isArray(o.entries) && (!o.entries.length || Expr_CreateStruct_Entry.is(o.entries[0]))); + }, + isSDK(o: any): o is Expr_CreateStructSDKType { + return o && (o.$typeUrl === Expr_CreateStruct.typeUrl || typeof o.type === "string" && Array.isArray(o.entries) && (!o.entries.length || Expr_CreateStruct_Entry.isSDK(o.entries[0]))); + }, + isAmino(o: any): o is Expr_CreateStructAmino { + return o && (o.$typeUrl === Expr_CreateStruct.typeUrl || typeof o.type === "string" && Array.isArray(o.entries) && (!o.entries.length || Expr_CreateStruct_Entry.isAmino(o.entries[0]))); + }, encode(message: Expr_CreateStruct, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.type !== "") { writer.uint32(10).string(message.type); @@ -1694,6 +1796,12 @@ export const Expr_CreateStruct = { typeUrl: "/google.api.expr.v1beta1.CreateStruct", value: Expr_CreateStruct.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Expr_CreateStruct.typeUrl)) { + return; + } + Expr_CreateStruct_Entry.registerTypeUrl(); } }; function createBaseExpr_CreateStruct_Entry(): Expr_CreateStruct_Entry { @@ -1712,6 +1820,15 @@ function createBaseExpr_CreateStruct_Entry(): Expr_CreateStruct_Entry { */ export const Expr_CreateStruct_Entry = { typeUrl: "/google.api.expr.v1beta1.Entry", + is(o: any): o is Expr_CreateStruct_Entry { + return o && (o.$typeUrl === Expr_CreateStruct_Entry.typeUrl || typeof o.id === "number"); + }, + isSDK(o: any): o is Expr_CreateStruct_EntrySDKType { + return o && (o.$typeUrl === Expr_CreateStruct_Entry.typeUrl || typeof o.id === "number"); + }, + isAmino(o: any): o is Expr_CreateStruct_EntryAmino { + return o && (o.$typeUrl === Expr_CreateStruct_Entry.typeUrl || typeof o.id === "number"); + }, encode(message: Expr_CreateStruct_Entry, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.id !== 0) { writer.uint32(8).int32(message.id); @@ -1824,6 +1941,12 @@ export const Expr_CreateStruct_Entry = { typeUrl: "/google.api.expr.v1beta1.Entry", value: Expr_CreateStruct_Entry.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Expr_CreateStruct_Entry.typeUrl)) { + return; + } + Expr.registerTypeUrl(); } }; function createBaseExpr_Comprehension(): Expr_Comprehension { @@ -1870,6 +1993,15 @@ function createBaseExpr_Comprehension(): Expr_Comprehension { */ export const Expr_Comprehension = { typeUrl: "/google.api.expr.v1beta1.Comprehension", + is(o: any): o is Expr_Comprehension { + return o && (o.$typeUrl === Expr_Comprehension.typeUrl || typeof o.iterVar === "string" && typeof o.accuVar === "string"); + }, + isSDK(o: any): o is Expr_ComprehensionSDKType { + return o && (o.$typeUrl === Expr_Comprehension.typeUrl || typeof o.iter_var === "string" && typeof o.accu_var === "string"); + }, + isAmino(o: any): o is Expr_ComprehensionAmino { + return o && (o.$typeUrl === Expr_Comprehension.typeUrl || typeof o.iter_var === "string" && typeof o.accu_var === "string"); + }, encode(message: Expr_Comprehension, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.iterVar !== "") { writer.uint32(10).string(message.iterVar); @@ -2030,6 +2162,12 @@ export const Expr_Comprehension = { typeUrl: "/google.api.expr.v1beta1.Comprehension", value: Expr_Comprehension.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Expr_Comprehension.typeUrl)) { + return; + } + Expr.registerTypeUrl(); } }; function createBaseLiteral(): Literal { @@ -2061,6 +2199,15 @@ function createBaseLiteral(): Literal { */ export const Literal = { typeUrl: "/google.api.expr.v1beta1.Literal", + is(o: any): o is Literal { + return o && o.$typeUrl === Literal.typeUrl; + }, + isSDK(o: any): o is LiteralSDKType { + return o && o.$typeUrl === Literal.typeUrl; + }, + isAmino(o: any): o is LiteralAmino { + return o && o.$typeUrl === Literal.typeUrl; + }, encode(message: Literal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.nullValue !== undefined) { writer.uint32(8).int32(message.nullValue); @@ -2215,5 +2362,6 @@ export const Literal = { typeUrl: "/google.api.expr.v1beta1.Literal", value: Literal.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/google/api/expr/v1beta1/source.ts b/__fixtures__/v-next/outputv3/google/api/expr/v1beta1/source.ts index 0bf72a5d9c..741d112ada 100644 --- a/__fixtures__/v-next/outputv3/google/api/expr/v1beta1/source.ts +++ b/__fixtures__/v-next/outputv3/google/api/expr/v1beta1/source.ts @@ -265,7 +265,8 @@ export const SourceInfo_PositionsEntry = { }, toProto(message: SourceInfo_PositionsEntry): Uint8Array { return SourceInfo_PositionsEntry.encode(message).finish(); - } + }, + registerTypeUrl() {} }; function createBaseSourceInfo(): SourceInfo { return { @@ -282,6 +283,15 @@ function createBaseSourceInfo(): SourceInfo { */ export const SourceInfo = { typeUrl: "/google.api.expr.v1beta1.SourceInfo", + is(o: any): o is SourceInfo { + return o && (o.$typeUrl === SourceInfo.typeUrl || typeof o.location === "string" && Array.isArray(o.lineOffsets) && (!o.lineOffsets.length || typeof o.lineOffsets[0] === "number") && isSet(o.positions)); + }, + isSDK(o: any): o is SourceInfoSDKType { + return o && (o.$typeUrl === SourceInfo.typeUrl || typeof o.location === "string" && Array.isArray(o.line_offsets) && (!o.line_offsets.length || typeof o.line_offsets[0] === "number") && isSet(o.positions)); + }, + isAmino(o: any): o is SourceInfoAmino { + return o && (o.$typeUrl === SourceInfo.typeUrl || typeof o.location === "string" && Array.isArray(o.line_offsets) && (!o.line_offsets.length || typeof o.line_offsets[0] === "number") && isSet(o.positions)); + }, encode(message: SourceInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.location !== "") { writer.uint32(18).string(message.location); @@ -429,7 +439,8 @@ export const SourceInfo = { typeUrl: "/google.api.expr.v1beta1.SourceInfo", value: SourceInfo.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseSourcePosition(): SourcePosition { return { @@ -447,6 +458,15 @@ function createBaseSourcePosition(): SourcePosition { */ export const SourcePosition = { typeUrl: "/google.api.expr.v1beta1.SourcePosition", + is(o: any): o is SourcePosition { + return o && (o.$typeUrl === SourcePosition.typeUrl || typeof o.location === "string" && typeof o.offset === "number" && typeof o.line === "number" && typeof o.column === "number"); + }, + isSDK(o: any): o is SourcePositionSDKType { + return o && (o.$typeUrl === SourcePosition.typeUrl || typeof o.location === "string" && typeof o.offset === "number" && typeof o.line === "number" && typeof o.column === "number"); + }, + isAmino(o: any): o is SourcePositionAmino { + return o && (o.$typeUrl === SourcePosition.typeUrl || typeof o.location === "string" && typeof o.offset === "number" && typeof o.line === "number" && typeof o.column === "number"); + }, encode(message: SourcePosition, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.location !== "") { writer.uint32(10).string(message.location); @@ -555,5 +575,6 @@ export const SourcePosition = { typeUrl: "/google.api.expr.v1beta1.SourcePosition", value: SourcePosition.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/google/api/expr/v1beta1/value.ts b/__fixtures__/v-next/outputv3/google/api/expr/v1beta1/value.ts index 9bba5137ed..b062a2787a 100644 --- a/__fixtures__/v-next/outputv3/google/api/expr/v1beta1/value.ts +++ b/__fixtures__/v-next/outputv3/google/api/expr/v1beta1/value.ts @@ -1,6 +1,7 @@ import { NullValue, NullValueSDKType, nullValueFromJSON, nullValueToJSON } from "../../../protobuf/struct"; import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../protobuf/any"; import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { GlobalDecoderRegistry } from "../../../../registry"; import { isSet, bytesFromBase64, DeepPartial, base64FromBytes } from "../../../../helpers"; export const protobufPackage = "google.api.expr.v1beta1"; /** @@ -371,6 +372,15 @@ function createBaseValue(): Value { */ export const Value = { typeUrl: "/google.api.expr.v1beta1.Value", + is(o: any): o is Value { + return o && o.$typeUrl === Value.typeUrl; + }, + isSDK(o: any): o is ValueSDKType { + return o && o.$typeUrl === Value.typeUrl; + }, + isAmino(o: any): o is ValueAmino { + return o && o.$typeUrl === Value.typeUrl; + }, encode(message: Value, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.nullValue !== undefined) { writer.uint32(8).int32(message.nullValue); @@ -603,6 +613,13 @@ export const Value = { typeUrl: "/google.api.expr.v1beta1.Value", value: Value.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Value.typeUrl)) { + return; + } + MapValue.registerTypeUrl(); + ListValue.registerTypeUrl(); } }; function createBaseEnumValue(): EnumValue { @@ -619,6 +636,15 @@ function createBaseEnumValue(): EnumValue { */ export const EnumValue = { typeUrl: "/google.api.expr.v1beta1.EnumValue", + is(o: any): o is EnumValue { + return o && (o.$typeUrl === EnumValue.typeUrl || typeof o.type === "string" && typeof o.value === "number"); + }, + isSDK(o: any): o is EnumValueSDKType { + return o && (o.$typeUrl === EnumValue.typeUrl || typeof o.type === "string" && typeof o.value === "number"); + }, + isAmino(o: any): o is EnumValueAmino { + return o && (o.$typeUrl === EnumValue.typeUrl || typeof o.type === "string" && typeof o.value === "number"); + }, encode(message: EnumValue, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.type !== "") { writer.uint32(10).string(message.type); @@ -699,7 +725,8 @@ export const EnumValue = { typeUrl: "/google.api.expr.v1beta1.EnumValue", value: EnumValue.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseListValue(): ListValue { return { @@ -717,6 +744,15 @@ function createBaseListValue(): ListValue { */ export const ListValue = { typeUrl: "/google.api.expr.v1beta1.ListValue", + is(o: any): o is ListValue { + return o && (o.$typeUrl === ListValue.typeUrl || Array.isArray(o.values) && (!o.values.length || Value.is(o.values[0]))); + }, + isSDK(o: any): o is ListValueSDKType { + return o && (o.$typeUrl === ListValue.typeUrl || Array.isArray(o.values) && (!o.values.length || Value.isSDK(o.values[0]))); + }, + isAmino(o: any): o is ListValueAmino { + return o && (o.$typeUrl === ListValue.typeUrl || Array.isArray(o.values) && (!o.values.length || Value.isAmino(o.values[0]))); + }, encode(message: ListValue, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.values) { Value.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -789,6 +825,12 @@ export const ListValue = { typeUrl: "/google.api.expr.v1beta1.ListValue", value: ListValue.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ListValue.typeUrl)) { + return; + } + Value.registerTypeUrl(); } }; function createBaseMapValue(): MapValue { @@ -807,6 +849,15 @@ function createBaseMapValue(): MapValue { */ export const MapValue = { typeUrl: "/google.api.expr.v1beta1.MapValue", + is(o: any): o is MapValue { + return o && (o.$typeUrl === MapValue.typeUrl || Array.isArray(o.entries) && (!o.entries.length || MapValue_Entry.is(o.entries[0]))); + }, + isSDK(o: any): o is MapValueSDKType { + return o && (o.$typeUrl === MapValue.typeUrl || Array.isArray(o.entries) && (!o.entries.length || MapValue_Entry.isSDK(o.entries[0]))); + }, + isAmino(o: any): o is MapValueAmino { + return o && (o.$typeUrl === MapValue.typeUrl || Array.isArray(o.entries) && (!o.entries.length || MapValue_Entry.isAmino(o.entries[0]))); + }, encode(message: MapValue, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.entries) { MapValue_Entry.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -879,6 +930,12 @@ export const MapValue = { typeUrl: "/google.api.expr.v1beta1.MapValue", value: MapValue.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MapValue.typeUrl)) { + return; + } + MapValue_Entry.registerTypeUrl(); } }; function createBaseMapValue_Entry(): MapValue_Entry { @@ -895,6 +952,15 @@ function createBaseMapValue_Entry(): MapValue_Entry { */ export const MapValue_Entry = { typeUrl: "/google.api.expr.v1beta1.Entry", + is(o: any): o is MapValue_Entry { + return o && o.$typeUrl === MapValue_Entry.typeUrl; + }, + isSDK(o: any): o is MapValue_EntrySDKType { + return o && o.$typeUrl === MapValue_Entry.typeUrl; + }, + isAmino(o: any): o is MapValue_EntryAmino { + return o && o.$typeUrl === MapValue_Entry.typeUrl; + }, encode(message: MapValue_Entry, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.key !== undefined) { Value.encode(message.key, writer.uint32(10).fork()).ldelim(); @@ -979,5 +1045,11 @@ export const MapValue_Entry = { typeUrl: "/google.api.expr.v1beta1.Entry", value: MapValue_Entry.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MapValue_Entry.typeUrl)) { + return; + } + Value.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/google/api/http.ts b/__fixtures__/v-next/outputv3/google/api/http.ts index e15acdb4bf..3ba6a184e8 100644 --- a/__fixtures__/v-next/outputv3/google/api/http.ts +++ b/__fixtures__/v-next/outputv3/google/api/http.ts @@ -1,5 +1,6 @@ import { BinaryReader, BinaryWriter } from "../../binary"; import { isSet, DeepPartial } from "../../helpers"; +import { GlobalDecoderRegistry } from "../../registry"; export const protobufPackage = "google.api"; /** * Defines the HTTP configuration for an API service. It contains a list of @@ -1087,6 +1088,15 @@ function createBaseHttp(): Http { */ export const Http = { typeUrl: "/google.api.Http", + is(o: any): o is Http { + return o && (o.$typeUrl === Http.typeUrl || Array.isArray(o.rules) && (!o.rules.length || HttpRule.is(o.rules[0])) && typeof o.fullyDecodeReservedExpansion === "boolean"); + }, + isSDK(o: any): o is HttpSDKType { + return o && (o.$typeUrl === Http.typeUrl || Array.isArray(o.rules) && (!o.rules.length || HttpRule.isSDK(o.rules[0])) && typeof o.fully_decode_reserved_expansion === "boolean"); + }, + isAmino(o: any): o is HttpAmino { + return o && (o.$typeUrl === Http.typeUrl || Array.isArray(o.rules) && (!o.rules.length || HttpRule.isAmino(o.rules[0])) && typeof o.fully_decode_reserved_expansion === "boolean"); + }, encode(message: Http, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.rules) { HttpRule.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -1173,6 +1183,12 @@ export const Http = { typeUrl: "/google.api.Http", value: Http.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Http.typeUrl)) { + return; + } + HttpRule.registerTypeUrl(); } }; function createBaseHttpRule(): HttpRule { @@ -1465,6 +1481,15 @@ function createBaseHttpRule(): HttpRule { */ export const HttpRule = { typeUrl: "/google.api.HttpRule", + is(o: any): o is HttpRule { + return o && (o.$typeUrl === HttpRule.typeUrl || typeof o.selector === "string" && typeof o.body === "string" && typeof o.responseBody === "string" && Array.isArray(o.additionalBindings) && (!o.additionalBindings.length || HttpRule.is(o.additionalBindings[0]))); + }, + isSDK(o: any): o is HttpRuleSDKType { + return o && (o.$typeUrl === HttpRule.typeUrl || typeof o.selector === "string" && typeof o.body === "string" && typeof o.response_body === "string" && Array.isArray(o.additional_bindings) && (!o.additional_bindings.length || HttpRule.isSDK(o.additional_bindings[0]))); + }, + isAmino(o: any): o is HttpRuleAmino { + return o && (o.$typeUrl === HttpRule.typeUrl || typeof o.selector === "string" && typeof o.body === "string" && typeof o.response_body === "string" && Array.isArray(o.additional_bindings) && (!o.additional_bindings.length || HttpRule.isAmino(o.additional_bindings[0]))); + }, encode(message: HttpRule, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.selector !== "") { writer.uint32(10).string(message.selector); @@ -1665,6 +1690,13 @@ export const HttpRule = { typeUrl: "/google.api.HttpRule", value: HttpRule.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(HttpRule.typeUrl)) { + return; + } + CustomHttpPattern.registerTypeUrl(); + HttpRule.registerTypeUrl(); } }; function createBaseCustomHttpPattern(): CustomHttpPattern { @@ -1681,6 +1713,15 @@ function createBaseCustomHttpPattern(): CustomHttpPattern { */ export const CustomHttpPattern = { typeUrl: "/google.api.CustomHttpPattern", + is(o: any): o is CustomHttpPattern { + return o && (o.$typeUrl === CustomHttpPattern.typeUrl || typeof o.kind === "string" && typeof o.path === "string"); + }, + isSDK(o: any): o is CustomHttpPatternSDKType { + return o && (o.$typeUrl === CustomHttpPattern.typeUrl || typeof o.kind === "string" && typeof o.path === "string"); + }, + isAmino(o: any): o is CustomHttpPatternAmino { + return o && (o.$typeUrl === CustomHttpPattern.typeUrl || typeof o.kind === "string" && typeof o.path === "string"); + }, encode(message: CustomHttpPattern, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.kind !== "") { writer.uint32(10).string(message.kind); @@ -1761,5 +1802,6 @@ export const CustomHttpPattern = { typeUrl: "/google.api.CustomHttpPattern", value: CustomHttpPattern.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/google/api/httpbody.ts b/__fixtures__/v-next/outputv3/google/api/httpbody.ts index 1c63232462..0a1e4c6fae 100644 --- a/__fixtures__/v-next/outputv3/google/api/httpbody.ts +++ b/__fixtures__/v-next/outputv3/google/api/httpbody.ts @@ -242,6 +242,15 @@ function createBaseHttpBody(): HttpBody { */ export const HttpBody = { typeUrl: "/google.api.HttpBody", + is(o: any): o is HttpBody { + return o && (o.$typeUrl === HttpBody.typeUrl || typeof o.contentType === "string" && (o.data instanceof Uint8Array || typeof o.data === "string") && Array.isArray(o.extensions) && (!o.extensions.length || Any.is(o.extensions[0]))); + }, + isSDK(o: any): o is HttpBodySDKType { + return o && (o.$typeUrl === HttpBody.typeUrl || typeof o.content_type === "string" && (o.data instanceof Uint8Array || typeof o.data === "string") && Array.isArray(o.extensions) && (!o.extensions.length || Any.isSDK(o.extensions[0]))); + }, + isAmino(o: any): o is HttpBodyAmino { + return o && (o.$typeUrl === HttpBody.typeUrl || typeof o.content_type === "string" && (o.data instanceof Uint8Array || typeof o.data === "string") && Array.isArray(o.extensions) && (!o.extensions.length || Any.isAmino(o.extensions[0]))); + }, encode(message: HttpBody, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.contentType !== "") { writer.uint32(10).string(message.contentType); @@ -342,5 +351,6 @@ export const HttpBody = { typeUrl: "/google.api.HttpBody", value: HttpBody.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/google/api/label.ts b/__fixtures__/v-next/outputv3/google/api/label.ts index 20a7128da0..4e95fd44e8 100644 --- a/__fixtures__/v-next/outputv3/google/api/label.ts +++ b/__fixtures__/v-next/outputv3/google/api/label.ts @@ -1,5 +1,5 @@ -import { BinaryReader, BinaryWriter } from "../../binary"; import { isSet, DeepPartial } from "../../helpers"; +import { BinaryReader, BinaryWriter } from "../../binary"; export const protobufPackage = "google.api"; /** Value types that can be used as label values. */ export enum LabelDescriptor_ValueType { @@ -113,6 +113,15 @@ function createBaseLabelDescriptor(): LabelDescriptor { */ export const LabelDescriptor = { typeUrl: "/google.api.LabelDescriptor", + is(o: any): o is LabelDescriptor { + return o && (o.$typeUrl === LabelDescriptor.typeUrl || typeof o.key === "string" && isSet(o.valueType) && typeof o.description === "string"); + }, + isSDK(o: any): o is LabelDescriptorSDKType { + return o && (o.$typeUrl === LabelDescriptor.typeUrl || typeof o.key === "string" && isSet(o.value_type) && typeof o.description === "string"); + }, + isAmino(o: any): o is LabelDescriptorAmino { + return o && (o.$typeUrl === LabelDescriptor.typeUrl || typeof o.key === "string" && isSet(o.value_type) && typeof o.description === "string"); + }, encode(message: LabelDescriptor, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.key !== "") { writer.uint32(10).string(message.key); @@ -207,5 +216,6 @@ export const LabelDescriptor = { typeUrl: "/google.api.LabelDescriptor", value: LabelDescriptor.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/google/api/log.ts b/__fixtures__/v-next/outputv3/google/api/log.ts index 87e069ec8e..55dfd1a647 100644 --- a/__fixtures__/v-next/outputv3/google/api/log.ts +++ b/__fixtures__/v-next/outputv3/google/api/log.ts @@ -1,6 +1,7 @@ import { LabelDescriptor, LabelDescriptorAmino, LabelDescriptorSDKType } from "./label"; import { BinaryReader, BinaryWriter } from "../../binary"; import { isSet, DeepPartial } from "../../helpers"; +import { GlobalDecoderRegistry } from "../../registry"; export const protobufPackage = "google.api"; /** * A description of a log type. Example in YAML format: @@ -124,6 +125,15 @@ function createBaseLogDescriptor(): LogDescriptor { */ export const LogDescriptor = { typeUrl: "/google.api.LogDescriptor", + is(o: any): o is LogDescriptor { + return o && (o.$typeUrl === LogDescriptor.typeUrl || typeof o.name === "string" && Array.isArray(o.labels) && (!o.labels.length || LabelDescriptor.is(o.labels[0])) && typeof o.description === "string" && typeof o.displayName === "string"); + }, + isSDK(o: any): o is LogDescriptorSDKType { + return o && (o.$typeUrl === LogDescriptor.typeUrl || typeof o.name === "string" && Array.isArray(o.labels) && (!o.labels.length || LabelDescriptor.isSDK(o.labels[0])) && typeof o.description === "string" && typeof o.display_name === "string"); + }, + isAmino(o: any): o is LogDescriptorAmino { + return o && (o.$typeUrl === LogDescriptor.typeUrl || typeof o.name === "string" && Array.isArray(o.labels) && (!o.labels.length || LabelDescriptor.isAmino(o.labels[0])) && typeof o.description === "string" && typeof o.display_name === "string"); + }, encode(message: LogDescriptor, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -238,5 +248,11 @@ export const LogDescriptor = { typeUrl: "/google.api.LogDescriptor", value: LogDescriptor.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(LogDescriptor.typeUrl)) { + return; + } + LabelDescriptor.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/google/api/logging.ts b/__fixtures__/v-next/outputv3/google/api/logging.ts index 034181b33c..f198b583d9 100644 --- a/__fixtures__/v-next/outputv3/google/api/logging.ts +++ b/__fixtures__/v-next/outputv3/google/api/logging.ts @@ -1,5 +1,6 @@ import { BinaryReader, BinaryWriter } from "../../binary"; import { DeepPartial, isSet } from "../../helpers"; +import { GlobalDecoderRegistry } from "../../registry"; export const protobufPackage = "google.api"; /** * Logging configuration of the service. @@ -242,6 +243,15 @@ function createBaseLogging(): Logging { */ export const Logging = { typeUrl: "/google.api.Logging", + is(o: any): o is Logging { + return o && (o.$typeUrl === Logging.typeUrl || Array.isArray(o.producerDestinations) && (!o.producerDestinations.length || Logging_LoggingDestination.is(o.producerDestinations[0])) && Array.isArray(o.consumerDestinations) && (!o.consumerDestinations.length || Logging_LoggingDestination.is(o.consumerDestinations[0]))); + }, + isSDK(o: any): o is LoggingSDKType { + return o && (o.$typeUrl === Logging.typeUrl || Array.isArray(o.producer_destinations) && (!o.producer_destinations.length || Logging_LoggingDestination.isSDK(o.producer_destinations[0])) && Array.isArray(o.consumer_destinations) && (!o.consumer_destinations.length || Logging_LoggingDestination.isSDK(o.consumer_destinations[0]))); + }, + isAmino(o: any): o is LoggingAmino { + return o && (o.$typeUrl === Logging.typeUrl || Array.isArray(o.producer_destinations) && (!o.producer_destinations.length || Logging_LoggingDestination.isAmino(o.producer_destinations[0])) && Array.isArray(o.consumer_destinations) && (!o.consumer_destinations.length || Logging_LoggingDestination.isAmino(o.consumer_destinations[0]))); + }, encode(message: Logging, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.producerDestinations) { Logging_LoggingDestination.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -334,6 +344,12 @@ export const Logging = { typeUrl: "/google.api.Logging", value: Logging.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Logging.typeUrl)) { + return; + } + Logging_LoggingDestination.registerTypeUrl(); } }; function createBaseLogging_LoggingDestination(): Logging_LoggingDestination { @@ -351,6 +367,15 @@ function createBaseLogging_LoggingDestination(): Logging_LoggingDestination { */ export const Logging_LoggingDestination = { typeUrl: "/google.api.LoggingDestination", + is(o: any): o is Logging_LoggingDestination { + return o && (o.$typeUrl === Logging_LoggingDestination.typeUrl || typeof o.monitoredResource === "string" && Array.isArray(o.logs) && (!o.logs.length || typeof o.logs[0] === "string")); + }, + isSDK(o: any): o is Logging_LoggingDestinationSDKType { + return o && (o.$typeUrl === Logging_LoggingDestination.typeUrl || typeof o.monitored_resource === "string" && Array.isArray(o.logs) && (!o.logs.length || typeof o.logs[0] === "string")); + }, + isAmino(o: any): o is Logging_LoggingDestinationAmino { + return o && (o.$typeUrl === Logging_LoggingDestination.typeUrl || typeof o.monitored_resource === "string" && Array.isArray(o.logs) && (!o.logs.length || typeof o.logs[0] === "string")); + }, encode(message: Logging_LoggingDestination, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.monitoredResource !== "") { writer.uint32(26).string(message.monitoredResource); @@ -437,5 +462,6 @@ export const Logging_LoggingDestination = { typeUrl: "/google.api.LoggingDestination", value: Logging_LoggingDestination.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/google/api/metric.ts b/__fixtures__/v-next/outputv3/google/api/metric.ts index 0bb5866d7d..f2580d661c 100644 --- a/__fixtures__/v-next/outputv3/google/api/metric.ts +++ b/__fixtures__/v-next/outputv3/google/api/metric.ts @@ -1,8 +1,9 @@ import { LaunchStage, LaunchStageSDKType, launchStageFromJSON, launchStageToJSON } from "./launch_stage"; import { Duration, DurationAmino, DurationSDKType } from "../protobuf/duration"; import { LabelDescriptor, LabelDescriptorAmino, LabelDescriptorSDKType } from "./label"; -import { BinaryReader, BinaryWriter } from "../../binary"; import { isSet, DeepPartial, isObject } from "../../helpers"; +import { BinaryReader, BinaryWriter } from "../../binary"; +import { GlobalDecoderRegistry } from "../../registry"; export const protobufPackage = "google.api"; /** * The kind of measurement. It describes how the data is reported. @@ -701,6 +702,15 @@ function createBaseMetricDescriptor(): MetricDescriptor { */ export const MetricDescriptor = { typeUrl: "/google.api.MetricDescriptor", + is(o: any): o is MetricDescriptor { + return o && (o.$typeUrl === MetricDescriptor.typeUrl || typeof o.name === "string" && typeof o.type === "string" && Array.isArray(o.labels) && (!o.labels.length || LabelDescriptor.is(o.labels[0])) && isSet(o.metricKind) && isSet(o.valueType) && typeof o.unit === "string" && typeof o.description === "string" && typeof o.displayName === "string" && isSet(o.launchStage) && Array.isArray(o.monitoredResourceTypes) && (!o.monitoredResourceTypes.length || typeof o.monitoredResourceTypes[0] === "string")); + }, + isSDK(o: any): o is MetricDescriptorSDKType { + return o && (o.$typeUrl === MetricDescriptor.typeUrl || typeof o.name === "string" && typeof o.type === "string" && Array.isArray(o.labels) && (!o.labels.length || LabelDescriptor.isSDK(o.labels[0])) && isSet(o.metric_kind) && isSet(o.value_type) && typeof o.unit === "string" && typeof o.description === "string" && typeof o.display_name === "string" && isSet(o.launch_stage) && Array.isArray(o.monitored_resource_types) && (!o.monitored_resource_types.length || typeof o.monitored_resource_types[0] === "string")); + }, + isAmino(o: any): o is MetricDescriptorAmino { + return o && (o.$typeUrl === MetricDescriptor.typeUrl || typeof o.name === "string" && typeof o.type === "string" && Array.isArray(o.labels) && (!o.labels.length || LabelDescriptor.isAmino(o.labels[0])) && isSet(o.metric_kind) && isSet(o.value_type) && typeof o.unit === "string" && typeof o.description === "string" && typeof o.display_name === "string" && isSet(o.launch_stage) && Array.isArray(o.monitored_resource_types) && (!o.monitored_resource_types.length || typeof o.monitored_resource_types[0] === "string")); + }, encode(message: MetricDescriptor, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -921,6 +931,13 @@ export const MetricDescriptor = { typeUrl: "/google.api.MetricDescriptor", value: MetricDescriptor.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MetricDescriptor.typeUrl)) { + return; + } + LabelDescriptor.registerTypeUrl(); + MetricDescriptor_MetricDescriptorMetadata.registerTypeUrl(); } }; function createBaseMetricDescriptor_MetricDescriptorMetadata(): MetricDescriptor_MetricDescriptorMetadata { @@ -938,6 +955,15 @@ function createBaseMetricDescriptor_MetricDescriptorMetadata(): MetricDescriptor */ export const MetricDescriptor_MetricDescriptorMetadata = { typeUrl: "/google.api.MetricDescriptorMetadata", + is(o: any): o is MetricDescriptor_MetricDescriptorMetadata { + return o && (o.$typeUrl === MetricDescriptor_MetricDescriptorMetadata.typeUrl || isSet(o.launchStage)); + }, + isSDK(o: any): o is MetricDescriptor_MetricDescriptorMetadataSDKType { + return o && (o.$typeUrl === MetricDescriptor_MetricDescriptorMetadata.typeUrl || isSet(o.launch_stage)); + }, + isAmino(o: any): o is MetricDescriptor_MetricDescriptorMetadataAmino { + return o && (o.$typeUrl === MetricDescriptor_MetricDescriptorMetadata.typeUrl || isSet(o.launch_stage)); + }, encode(message: MetricDescriptor_MetricDescriptorMetadata, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.launchStage !== 0) { writer.uint32(8).int32(message.launchStage); @@ -1036,7 +1062,8 @@ export const MetricDescriptor_MetricDescriptorMetadata = { typeUrl: "/google.api.MetricDescriptorMetadata", value: MetricDescriptor_MetricDescriptorMetadata.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMetric_LabelsEntry(): Metric_LabelsEntry { return { @@ -1124,7 +1151,8 @@ export const Metric_LabelsEntry = { }, toProto(message: Metric_LabelsEntry): Uint8Array { return Metric_LabelsEntry.encode(message).finish(); - } + }, + registerTypeUrl() {} }; function createBaseMetric(): Metric { return { @@ -1141,6 +1169,15 @@ function createBaseMetric(): Metric { */ export const Metric = { typeUrl: "/google.api.Metric", + is(o: any): o is Metric { + return o && (o.$typeUrl === Metric.typeUrl || typeof o.type === "string" && isSet(o.labels)); + }, + isSDK(o: any): o is MetricSDKType { + return o && (o.$typeUrl === Metric.typeUrl || typeof o.type === "string" && isSet(o.labels)); + }, + isAmino(o: any): o is MetricAmino { + return o && (o.$typeUrl === Metric.typeUrl || typeof o.type === "string" && isSet(o.labels)); + }, encode(message: Metric, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.type !== "") { writer.uint32(26).string(message.type); @@ -1259,5 +1296,6 @@ export const Metric = { typeUrl: "/google.api.Metric", value: Metric.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/google/api/monitored_resource.ts b/__fixtures__/v-next/outputv3/google/api/monitored_resource.ts index 3fe0ba00c1..c5e7b550bd 100644 --- a/__fixtures__/v-next/outputv3/google/api/monitored_resource.ts +++ b/__fixtures__/v-next/outputv3/google/api/monitored_resource.ts @@ -1,8 +1,9 @@ import { LabelDescriptor, LabelDescriptorAmino, LabelDescriptorSDKType } from "./label"; import { LaunchStage, LaunchStageSDKType, launchStageFromJSON, launchStageToJSON } from "./launch_stage"; import { Struct, StructAmino, StructSDKType } from "../protobuf/struct"; -import { BinaryReader, BinaryWriter } from "../../binary"; import { isSet, DeepPartial, isObject } from "../../helpers"; +import { BinaryReader, BinaryWriter } from "../../binary"; +import { GlobalDecoderRegistry } from "../../registry"; export const protobufPackage = "google.api"; /** * An object that describes the schema of a [MonitoredResource][google.api.MonitoredResource] object using a @@ -403,6 +404,15 @@ function createBaseMonitoredResourceDescriptor(): MonitoredResourceDescriptor { */ export const MonitoredResourceDescriptor = { typeUrl: "/google.api.MonitoredResourceDescriptor", + is(o: any): o is MonitoredResourceDescriptor { + return o && (o.$typeUrl === MonitoredResourceDescriptor.typeUrl || typeof o.name === "string" && typeof o.type === "string" && typeof o.displayName === "string" && typeof o.description === "string" && Array.isArray(o.labels) && (!o.labels.length || LabelDescriptor.is(o.labels[0])) && isSet(o.launchStage)); + }, + isSDK(o: any): o is MonitoredResourceDescriptorSDKType { + return o && (o.$typeUrl === MonitoredResourceDescriptor.typeUrl || typeof o.name === "string" && typeof o.type === "string" && typeof o.display_name === "string" && typeof o.description === "string" && Array.isArray(o.labels) && (!o.labels.length || LabelDescriptor.isSDK(o.labels[0])) && isSet(o.launch_stage)); + }, + isAmino(o: any): o is MonitoredResourceDescriptorAmino { + return o && (o.$typeUrl === MonitoredResourceDescriptor.typeUrl || typeof o.name === "string" && typeof o.type === "string" && typeof o.display_name === "string" && typeof o.description === "string" && Array.isArray(o.labels) && (!o.labels.length || LabelDescriptor.isAmino(o.labels[0])) && isSet(o.launch_stage)); + }, encode(message: MonitoredResourceDescriptor, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(42).string(message.name); @@ -545,6 +555,12 @@ export const MonitoredResourceDescriptor = { typeUrl: "/google.api.MonitoredResourceDescriptor", value: MonitoredResourceDescriptor.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MonitoredResourceDescriptor.typeUrl)) { + return; + } + LabelDescriptor.registerTypeUrl(); } }; function createBaseMonitoredResource_LabelsEntry(): MonitoredResource_LabelsEntry { @@ -633,7 +649,8 @@ export const MonitoredResource_LabelsEntry = { }, toProto(message: MonitoredResource_LabelsEntry): Uint8Array { return MonitoredResource_LabelsEntry.encode(message).finish(); - } + }, + registerTypeUrl() {} }; function createBaseMonitoredResource(): MonitoredResource { return { @@ -661,6 +678,15 @@ function createBaseMonitoredResource(): MonitoredResource { */ export const MonitoredResource = { typeUrl: "/google.api.MonitoredResource", + is(o: any): o is MonitoredResource { + return o && (o.$typeUrl === MonitoredResource.typeUrl || typeof o.type === "string" && isSet(o.labels)); + }, + isSDK(o: any): o is MonitoredResourceSDKType { + return o && (o.$typeUrl === MonitoredResource.typeUrl || typeof o.type === "string" && isSet(o.labels)); + }, + isAmino(o: any): o is MonitoredResourceAmino { + return o && (o.$typeUrl === MonitoredResource.typeUrl || typeof o.type === "string" && isSet(o.labels)); + }, encode(message: MonitoredResource, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.type !== "") { writer.uint32(10).string(message.type); @@ -779,7 +805,8 @@ export const MonitoredResource = { typeUrl: "/google.api.MonitoredResource", value: MonitoredResource.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMonitoredResourceMetadata_UserLabelsEntry(): MonitoredResourceMetadata_UserLabelsEntry { return { @@ -867,7 +894,8 @@ export const MonitoredResourceMetadata_UserLabelsEntry = { }, toProto(message: MonitoredResourceMetadata_UserLabelsEntry): Uint8Array { return MonitoredResourceMetadata_UserLabelsEntry.encode(message).finish(); - } + }, + registerTypeUrl() {} }; function createBaseMonitoredResourceMetadata(): MonitoredResourceMetadata { return { @@ -888,6 +916,15 @@ function createBaseMonitoredResourceMetadata(): MonitoredResourceMetadata { */ export const MonitoredResourceMetadata = { typeUrl: "/google.api.MonitoredResourceMetadata", + is(o: any): o is MonitoredResourceMetadata { + return o && (o.$typeUrl === MonitoredResourceMetadata.typeUrl || isSet(o.userLabels)); + }, + isSDK(o: any): o is MonitoredResourceMetadataSDKType { + return o && (o.$typeUrl === MonitoredResourceMetadata.typeUrl || isSet(o.user_labels)); + }, + isAmino(o: any): o is MonitoredResourceMetadataAmino { + return o && (o.$typeUrl === MonitoredResourceMetadata.typeUrl || isSet(o.user_labels)); + }, encode(message: MonitoredResourceMetadata, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.systemLabels !== undefined) { Struct.encode(message.systemLabels, writer.uint32(10).fork()).ldelim(); @@ -1008,5 +1045,11 @@ export const MonitoredResourceMetadata = { typeUrl: "/google.api.MonitoredResourceMetadata", value: MonitoredResourceMetadata.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MonitoredResourceMetadata.typeUrl)) { + return; + } + Struct.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/google/api/monitoring.ts b/__fixtures__/v-next/outputv3/google/api/monitoring.ts index a9d66735d3..39193e9641 100644 --- a/__fixtures__/v-next/outputv3/google/api/monitoring.ts +++ b/__fixtures__/v-next/outputv3/google/api/monitoring.ts @@ -1,5 +1,6 @@ import { BinaryReader, BinaryWriter } from "../../binary"; import { DeepPartial, isSet } from "../../helpers"; +import { GlobalDecoderRegistry } from "../../registry"; export const protobufPackage = "google.api"; /** * Monitoring configuration of the service. @@ -338,6 +339,15 @@ function createBaseMonitoring(): Monitoring { */ export const Monitoring = { typeUrl: "/google.api.Monitoring", + is(o: any): o is Monitoring { + return o && (o.$typeUrl === Monitoring.typeUrl || Array.isArray(o.producerDestinations) && (!o.producerDestinations.length || Monitoring_MonitoringDestination.is(o.producerDestinations[0])) && Array.isArray(o.consumerDestinations) && (!o.consumerDestinations.length || Monitoring_MonitoringDestination.is(o.consumerDestinations[0]))); + }, + isSDK(o: any): o is MonitoringSDKType { + return o && (o.$typeUrl === Monitoring.typeUrl || Array.isArray(o.producer_destinations) && (!o.producer_destinations.length || Monitoring_MonitoringDestination.isSDK(o.producer_destinations[0])) && Array.isArray(o.consumer_destinations) && (!o.consumer_destinations.length || Monitoring_MonitoringDestination.isSDK(o.consumer_destinations[0]))); + }, + isAmino(o: any): o is MonitoringAmino { + return o && (o.$typeUrl === Monitoring.typeUrl || Array.isArray(o.producer_destinations) && (!o.producer_destinations.length || Monitoring_MonitoringDestination.isAmino(o.producer_destinations[0])) && Array.isArray(o.consumer_destinations) && (!o.consumer_destinations.length || Monitoring_MonitoringDestination.isAmino(o.consumer_destinations[0]))); + }, encode(message: Monitoring, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.producerDestinations) { Monitoring_MonitoringDestination.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -430,6 +440,12 @@ export const Monitoring = { typeUrl: "/google.api.Monitoring", value: Monitoring.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Monitoring.typeUrl)) { + return; + } + Monitoring_MonitoringDestination.registerTypeUrl(); } }; function createBaseMonitoring_MonitoringDestination(): Monitoring_MonitoringDestination { @@ -447,6 +463,15 @@ function createBaseMonitoring_MonitoringDestination(): Monitoring_MonitoringDest */ export const Monitoring_MonitoringDestination = { typeUrl: "/google.api.MonitoringDestination", + is(o: any): o is Monitoring_MonitoringDestination { + return o && (o.$typeUrl === Monitoring_MonitoringDestination.typeUrl || typeof o.monitoredResource === "string" && Array.isArray(o.metrics) && (!o.metrics.length || typeof o.metrics[0] === "string")); + }, + isSDK(o: any): o is Monitoring_MonitoringDestinationSDKType { + return o && (o.$typeUrl === Monitoring_MonitoringDestination.typeUrl || typeof o.monitored_resource === "string" && Array.isArray(o.metrics) && (!o.metrics.length || typeof o.metrics[0] === "string")); + }, + isAmino(o: any): o is Monitoring_MonitoringDestinationAmino { + return o && (o.$typeUrl === Monitoring_MonitoringDestination.typeUrl || typeof o.monitored_resource === "string" && Array.isArray(o.metrics) && (!o.metrics.length || typeof o.metrics[0] === "string")); + }, encode(message: Monitoring_MonitoringDestination, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.monitoredResource !== "") { writer.uint32(10).string(message.monitoredResource); @@ -533,5 +558,6 @@ export const Monitoring_MonitoringDestination = { typeUrl: "/google.api.MonitoringDestination", value: Monitoring_MonitoringDestination.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/google/api/quota.ts b/__fixtures__/v-next/outputv3/google/api/quota.ts index 3af5b61e56..cffe82ac00 100644 --- a/__fixtures__/v-next/outputv3/google/api/quota.ts +++ b/__fixtures__/v-next/outputv3/google/api/quota.ts @@ -1,5 +1,6 @@ import { BinaryReader, BinaryWriter } from "../../binary"; import { DeepPartial, isSet, isObject } from "../../helpers"; +import { GlobalDecoderRegistry } from "../../registry"; export const protobufPackage = "google.api"; /** * Quota configuration helps to achieve fairness and budgeting in service @@ -612,6 +613,15 @@ function createBaseQuota(): Quota { */ export const Quota = { typeUrl: "/google.api.Quota", + is(o: any): o is Quota { + return o && (o.$typeUrl === Quota.typeUrl || Array.isArray(o.limits) && (!o.limits.length || QuotaLimit.is(o.limits[0])) && Array.isArray(o.metricRules) && (!o.metricRules.length || MetricRule.is(o.metricRules[0]))); + }, + isSDK(o: any): o is QuotaSDKType { + return o && (o.$typeUrl === Quota.typeUrl || Array.isArray(o.limits) && (!o.limits.length || QuotaLimit.isSDK(o.limits[0])) && Array.isArray(o.metric_rules) && (!o.metric_rules.length || MetricRule.isSDK(o.metric_rules[0]))); + }, + isAmino(o: any): o is QuotaAmino { + return o && (o.$typeUrl === Quota.typeUrl || Array.isArray(o.limits) && (!o.limits.length || QuotaLimit.isAmino(o.limits[0])) && Array.isArray(o.metric_rules) && (!o.metric_rules.length || MetricRule.isAmino(o.metric_rules[0]))); + }, encode(message: Quota, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.limits) { QuotaLimit.encode(v!, writer.uint32(26).fork()).ldelim(); @@ -704,6 +714,13 @@ export const Quota = { typeUrl: "/google.api.Quota", value: Quota.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Quota.typeUrl)) { + return; + } + QuotaLimit.registerTypeUrl(); + MetricRule.registerTypeUrl(); } }; function createBaseMetricRule_MetricCostsEntry(): MetricRule_MetricCostsEntry { @@ -794,7 +811,8 @@ export const MetricRule_MetricCostsEntry = { }, toProto(message: MetricRule_MetricCostsEntry): Uint8Array { return MetricRule_MetricCostsEntry.encode(message).finish(); - } + }, + registerTypeUrl() {} }; function createBaseMetricRule(): MetricRule { return { @@ -811,6 +829,15 @@ function createBaseMetricRule(): MetricRule { */ export const MetricRule = { typeUrl: "/google.api.MetricRule", + is(o: any): o is MetricRule { + return o && (o.$typeUrl === MetricRule.typeUrl || typeof o.selector === "string" && isSet(o.metricCosts)); + }, + isSDK(o: any): o is MetricRuleSDKType { + return o && (o.$typeUrl === MetricRule.typeUrl || typeof o.selector === "string" && isSet(o.metric_costs)); + }, + isAmino(o: any): o is MetricRuleAmino { + return o && (o.$typeUrl === MetricRule.typeUrl || typeof o.selector === "string" && isSet(o.metric_costs)); + }, encode(message: MetricRule, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.selector !== "") { writer.uint32(10).string(message.selector); @@ -929,7 +956,8 @@ export const MetricRule = { typeUrl: "/google.api.MetricRule", value: MetricRule.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQuotaLimit_ValuesEntry(): QuotaLimit_ValuesEntry { return { @@ -1019,7 +1047,8 @@ export const QuotaLimit_ValuesEntry = { }, toProto(message: QuotaLimit_ValuesEntry): Uint8Array { return QuotaLimit_ValuesEntry.encode(message).finish(); - } + }, + registerTypeUrl() {} }; function createBaseQuotaLimit(): QuotaLimit { return { @@ -1045,6 +1074,15 @@ function createBaseQuotaLimit(): QuotaLimit { */ export const QuotaLimit = { typeUrl: "/google.api.QuotaLimit", + is(o: any): o is QuotaLimit { + return o && (o.$typeUrl === QuotaLimit.typeUrl || typeof o.name === "string" && typeof o.description === "string" && typeof o.defaultLimit === "bigint" && typeof o.maxLimit === "bigint" && typeof o.freeTier === "bigint" && typeof o.duration === "string" && typeof o.metric === "string" && typeof o.unit === "string" && isSet(o.values) && typeof o.displayName === "string"); + }, + isSDK(o: any): o is QuotaLimitSDKType { + return o && (o.$typeUrl === QuotaLimit.typeUrl || typeof o.name === "string" && typeof o.description === "string" && typeof o.default_limit === "bigint" && typeof o.max_limit === "bigint" && typeof o.free_tier === "bigint" && typeof o.duration === "string" && typeof o.metric === "string" && typeof o.unit === "string" && isSet(o.values) && typeof o.display_name === "string"); + }, + isAmino(o: any): o is QuotaLimitAmino { + return o && (o.$typeUrl === QuotaLimit.typeUrl || typeof o.name === "string" && typeof o.description === "string" && typeof o.default_limit === "bigint" && typeof o.max_limit === "bigint" && typeof o.free_tier === "bigint" && typeof o.duration === "string" && typeof o.metric === "string" && typeof o.unit === "string" && isSet(o.values) && typeof o.display_name === "string"); + }, encode(message: QuotaLimit, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(50).string(message.name); @@ -1281,5 +1319,6 @@ export const QuotaLimit = { typeUrl: "/google.api.QuotaLimit", value: QuotaLimit.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/google/api/resource.ts b/__fixtures__/v-next/outputv3/google/api/resource.ts index 73e615ef26..cd8749c6f0 100644 --- a/__fixtures__/v-next/outputv3/google/api/resource.ts +++ b/__fixtures__/v-next/outputv3/google/api/resource.ts @@ -1,5 +1,5 @@ -import { BinaryReader, BinaryWriter } from "../../binary"; import { isSet, DeepPartial } from "../../helpers"; +import { BinaryReader, BinaryWriter } from "../../binary"; export const protobufPackage = "google.api"; /** * A description of the historical or future-looking state of the @@ -604,6 +604,15 @@ function createBaseResourceDescriptor(): ResourceDescriptor { */ export const ResourceDescriptor = { typeUrl: "/google.api.ResourceDescriptor", + is(o: any): o is ResourceDescriptor { + return o && (o.$typeUrl === ResourceDescriptor.typeUrl || typeof o.type === "string" && Array.isArray(o.pattern) && (!o.pattern.length || typeof o.pattern[0] === "string") && typeof o.nameField === "string" && isSet(o.history) && typeof o.plural === "string" && typeof o.singular === "string" && Array.isArray(o.style)); + }, + isSDK(o: any): o is ResourceDescriptorSDKType { + return o && (o.$typeUrl === ResourceDescriptor.typeUrl || typeof o.type === "string" && Array.isArray(o.pattern) && (!o.pattern.length || typeof o.pattern[0] === "string") && typeof o.name_field === "string" && isSet(o.history) && typeof o.plural === "string" && typeof o.singular === "string" && Array.isArray(o.style)); + }, + isAmino(o: any): o is ResourceDescriptorAmino { + return o && (o.$typeUrl === ResourceDescriptor.typeUrl || typeof o.type === "string" && Array.isArray(o.pattern) && (!o.pattern.length || typeof o.pattern[0] === "string") && typeof o.name_field === "string" && isSet(o.history) && typeof o.plural === "string" && typeof o.singular === "string" && Array.isArray(o.style)); + }, encode(message: ResourceDescriptor, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.type !== "") { writer.uint32(10).string(message.type); @@ -775,7 +784,8 @@ export const ResourceDescriptor = { typeUrl: "/google.api.ResourceDescriptor", value: ResourceDescriptor.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseResourceReference(): ResourceReference { return { @@ -792,6 +802,15 @@ function createBaseResourceReference(): ResourceReference { */ export const ResourceReference = { typeUrl: "/google.api.ResourceReference", + is(o: any): o is ResourceReference { + return o && (o.$typeUrl === ResourceReference.typeUrl || typeof o.type === "string" && typeof o.childType === "string"); + }, + isSDK(o: any): o is ResourceReferenceSDKType { + return o && (o.$typeUrl === ResourceReference.typeUrl || typeof o.type === "string" && typeof o.child_type === "string"); + }, + isAmino(o: any): o is ResourceReferenceAmino { + return o && (o.$typeUrl === ResourceReference.typeUrl || typeof o.type === "string" && typeof o.child_type === "string"); + }, encode(message: ResourceReference, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.type !== "") { writer.uint32(10).string(message.type); @@ -872,5 +891,6 @@ export const ResourceReference = { typeUrl: "/google.api.ResourceReference", value: ResourceReference.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/google/api/routing.ts b/__fixtures__/v-next/outputv3/google/api/routing.ts index 57dfcf51f6..11cd419d07 100644 --- a/__fixtures__/v-next/outputv3/google/api/routing.ts +++ b/__fixtures__/v-next/outputv3/google/api/routing.ts @@ -1,5 +1,6 @@ import { BinaryReader, BinaryWriter } from "../../binary"; import { DeepPartial, isSet } from "../../helpers"; +import { GlobalDecoderRegistry } from "../../registry"; export const protobufPackage = "google.api"; /** * Specifies the routing information that should be sent along with the request @@ -1645,6 +1646,15 @@ function createBaseRoutingRule(): RoutingRule { */ export const RoutingRule = { typeUrl: "/google.api.RoutingRule", + is(o: any): o is RoutingRule { + return o && (o.$typeUrl === RoutingRule.typeUrl || Array.isArray(o.routingParameters) && (!o.routingParameters.length || RoutingParameter.is(o.routingParameters[0]))); + }, + isSDK(o: any): o is RoutingRuleSDKType { + return o && (o.$typeUrl === RoutingRule.typeUrl || Array.isArray(o.routing_parameters) && (!o.routing_parameters.length || RoutingParameter.isSDK(o.routing_parameters[0]))); + }, + isAmino(o: any): o is RoutingRuleAmino { + return o && (o.$typeUrl === RoutingRule.typeUrl || Array.isArray(o.routing_parameters) && (!o.routing_parameters.length || RoutingParameter.isAmino(o.routing_parameters[0]))); + }, encode(message: RoutingRule, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.routingParameters) { RoutingParameter.encode(v!, writer.uint32(18).fork()).ldelim(); @@ -1717,6 +1727,12 @@ export const RoutingRule = { typeUrl: "/google.api.RoutingRule", value: RoutingRule.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(RoutingRule.typeUrl)) { + return; + } + RoutingParameter.registerTypeUrl(); } }; function createBaseRoutingParameter(): RoutingParameter { @@ -1733,6 +1749,15 @@ function createBaseRoutingParameter(): RoutingParameter { */ export const RoutingParameter = { typeUrl: "/google.api.RoutingParameter", + is(o: any): o is RoutingParameter { + return o && (o.$typeUrl === RoutingParameter.typeUrl || typeof o.field === "string" && typeof o.pathTemplate === "string"); + }, + isSDK(o: any): o is RoutingParameterSDKType { + return o && (o.$typeUrl === RoutingParameter.typeUrl || typeof o.field === "string" && typeof o.path_template === "string"); + }, + isAmino(o: any): o is RoutingParameterAmino { + return o && (o.$typeUrl === RoutingParameter.typeUrl || typeof o.field === "string" && typeof o.path_template === "string"); + }, encode(message: RoutingParameter, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.field !== "") { writer.uint32(10).string(message.field); @@ -1813,5 +1838,6 @@ export const RoutingParameter = { typeUrl: "/google.api.RoutingParameter", value: RoutingParameter.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/google/api/service.ts b/__fixtures__/v-next/outputv3/google/api/service.ts index 3d654194cc..ee2225a18d 100644 --- a/__fixtures__/v-next/outputv3/google/api/service.ts +++ b/__fixtures__/v-next/outputv3/google/api/service.ts @@ -19,6 +19,7 @@ import { SystemParameters, SystemParametersAmino, SystemParametersSDKType } from import { SourceInfo, SourceInfoAmino, SourceInfoSDKType } from "./source_info"; import { UInt32Value, UInt32ValueAmino, UInt32ValueSDKType } from "../protobuf/wrappers"; import { BinaryReader, BinaryWriter } from "../../binary"; +import { GlobalDecoderRegistry } from "../../registry"; import { isSet, DeepPartial } from "../../helpers"; export const protobufPackage = "google.api"; /** @@ -458,6 +459,15 @@ function createBaseService(): Service { */ export const Service = { typeUrl: "/google.api.Service", + is(o: any): o is Service { + return o && (o.$typeUrl === Service.typeUrl || typeof o.name === "string" && typeof o.title === "string" && typeof o.producerProjectId === "string" && typeof o.id === "string" && Array.isArray(o.apis) && (!o.apis.length || Api.is(o.apis[0])) && Array.isArray(o.types) && (!o.types.length || Type.is(o.types[0])) && Array.isArray(o.enums) && (!o.enums.length || Enum.is(o.enums[0])) && Array.isArray(o.endpoints) && (!o.endpoints.length || Endpoint.is(o.endpoints[0])) && Array.isArray(o.logs) && (!o.logs.length || LogDescriptor.is(o.logs[0])) && Array.isArray(o.metrics) && (!o.metrics.length || MetricDescriptor.is(o.metrics[0])) && Array.isArray(o.monitoredResources) && (!o.monitoredResources.length || MonitoredResourceDescriptor.is(o.monitoredResources[0]))); + }, + isSDK(o: any): o is ServiceSDKType { + return o && (o.$typeUrl === Service.typeUrl || typeof o.name === "string" && typeof o.title === "string" && typeof o.producer_project_id === "string" && typeof o.id === "string" && Array.isArray(o.apis) && (!o.apis.length || Api.isSDK(o.apis[0])) && Array.isArray(o.types) && (!o.types.length || Type.isSDK(o.types[0])) && Array.isArray(o.enums) && (!o.enums.length || Enum.isSDK(o.enums[0])) && Array.isArray(o.endpoints) && (!o.endpoints.length || Endpoint.isSDK(o.endpoints[0])) && Array.isArray(o.logs) && (!o.logs.length || LogDescriptor.isSDK(o.logs[0])) && Array.isArray(o.metrics) && (!o.metrics.length || MetricDescriptor.isSDK(o.metrics[0])) && Array.isArray(o.monitored_resources) && (!o.monitored_resources.length || MonitoredResourceDescriptor.isSDK(o.monitored_resources[0]))); + }, + isAmino(o: any): o is ServiceAmino { + return o && (o.$typeUrl === Service.typeUrl || typeof o.name === "string" && typeof o.title === "string" && typeof o.producer_project_id === "string" && typeof o.id === "string" && Array.isArray(o.apis) && (!o.apis.length || Api.isAmino(o.apis[0])) && Array.isArray(o.types) && (!o.types.length || Type.isAmino(o.types[0])) && Array.isArray(o.enums) && (!o.enums.length || Enum.isAmino(o.enums[0])) && Array.isArray(o.endpoints) && (!o.endpoints.length || Endpoint.isAmino(o.endpoints[0])) && Array.isArray(o.logs) && (!o.logs.length || LogDescriptor.isAmino(o.logs[0])) && Array.isArray(o.metrics) && (!o.metrics.length || MetricDescriptor.isAmino(o.metrics[0])) && Array.isArray(o.monitored_resources) && (!o.monitored_resources.length || MonitoredResourceDescriptor.isAmino(o.monitored_resources[0]))); + }, encode(message: Service, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -930,5 +940,31 @@ export const Service = { typeUrl: "/google.api.Service", value: Service.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Service.typeUrl)) { + return; + } + Api.registerTypeUrl(); + Type.registerTypeUrl(); + Enum.registerTypeUrl(); + Documentation.registerTypeUrl(); + Backend.registerTypeUrl(); + Http.registerTypeUrl(); + Quota.registerTypeUrl(); + Authentication.registerTypeUrl(); + Context.registerTypeUrl(); + Usage.registerTypeUrl(); + Endpoint.registerTypeUrl(); + Control.registerTypeUrl(); + LogDescriptor.registerTypeUrl(); + MetricDescriptor.registerTypeUrl(); + MonitoredResourceDescriptor.registerTypeUrl(); + Billing.registerTypeUrl(); + Logging.registerTypeUrl(); + Monitoring.registerTypeUrl(); + SystemParameters.registerTypeUrl(); + SourceInfo.registerTypeUrl(); + UInt32Value.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/google/api/servicecontrol/v1/check_error.ts b/__fixtures__/v-next/outputv3/google/api/servicecontrol/v1/check_error.ts index 51673d1c36..0ebc322200 100644 --- a/__fixtures__/v-next/outputv3/google/api/servicecontrol/v1/check_error.ts +++ b/__fixtures__/v-next/outputv3/google/api/servicecontrol/v1/check_error.ts @@ -1,6 +1,7 @@ import { Status, StatusAmino, StatusSDKType } from "../../../rpc/status"; -import { BinaryReader, BinaryWriter } from "../../../../binary"; import { isSet, DeepPartial } from "../../../../helpers"; +import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { GlobalDecoderRegistry } from "../../../../registry"; export const protobufPackage = "google.api.servicecontrol.v1"; /** Error codes for Check responses. */ export enum CheckError_Code { @@ -289,6 +290,15 @@ function createBaseCheckError(): CheckError { */ export const CheckError = { typeUrl: "/google.api.servicecontrol.v1.CheckError", + is(o: any): o is CheckError { + return o && (o.$typeUrl === CheckError.typeUrl || isSet(o.code) && typeof o.subject === "string" && typeof o.detail === "string"); + }, + isSDK(o: any): o is CheckErrorSDKType { + return o && (o.$typeUrl === CheckError.typeUrl || isSet(o.code) && typeof o.subject === "string" && typeof o.detail === "string"); + }, + isAmino(o: any): o is CheckErrorAmino { + return o && (o.$typeUrl === CheckError.typeUrl || isSet(o.code) && typeof o.subject === "string" && typeof o.detail === "string"); + }, encode(message: CheckError, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.code !== 0) { writer.uint32(8).int32(message.code); @@ -399,5 +409,11 @@ export const CheckError = { typeUrl: "/google.api.servicecontrol.v1.CheckError", value: CheckError.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(CheckError.typeUrl)) { + return; + } + Status.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/google/api/servicecontrol/v1/distribution.ts b/__fixtures__/v-next/outputv3/google/api/servicecontrol/v1/distribution.ts index cf9da7fff9..943170ea2f 100644 --- a/__fixtures__/v-next/outputv3/google/api/servicecontrol/v1/distribution.ts +++ b/__fixtures__/v-next/outputv3/google/api/servicecontrol/v1/distribution.ts @@ -1,5 +1,6 @@ import { Distribution_Exemplar, Distribution_ExemplarAmino, Distribution_ExemplarSDKType } from "../../distribution"; import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { GlobalDecoderRegistry } from "../../../../registry"; import { isSet, DeepPartial } from "../../../../helpers"; export const protobufPackage = "google.api.servicecontrol.v1"; /** @@ -403,6 +404,15 @@ function createBaseDistribution(): Distribution { */ export const Distribution = { typeUrl: "/google.api.servicecontrol.v1.Distribution", + is(o: any): o is Distribution { + return o && (o.$typeUrl === Distribution.typeUrl || typeof o.count === "bigint" && typeof o.mean === "number" && typeof o.minimum === "number" && typeof o.maximum === "number" && typeof o.sumOfSquaredDeviation === "number" && Array.isArray(o.bucketCounts) && (!o.bucketCounts.length || typeof o.bucketCounts[0] === "bigint") && Array.isArray(o.exemplars) && (!o.exemplars.length || Distribution_Exemplar.is(o.exemplars[0]))); + }, + isSDK(o: any): o is DistributionSDKType { + return o && (o.$typeUrl === Distribution.typeUrl || typeof o.count === "bigint" && typeof o.mean === "number" && typeof o.minimum === "number" && typeof o.maximum === "number" && typeof o.sum_of_squared_deviation === "number" && Array.isArray(o.bucket_counts) && (!o.bucket_counts.length || typeof o.bucket_counts[0] === "bigint") && Array.isArray(o.exemplars) && (!o.exemplars.length || Distribution_Exemplar.isSDK(o.exemplars[0]))); + }, + isAmino(o: any): o is DistributionAmino { + return o && (o.$typeUrl === Distribution.typeUrl || typeof o.count === "bigint" && typeof o.mean === "number" && typeof o.minimum === "number" && typeof o.maximum === "number" && typeof o.sum_of_squared_deviation === "number" && Array.isArray(o.bucket_counts) && (!o.bucket_counts.length || typeof o.bucket_counts[0] === "bigint") && Array.isArray(o.exemplars) && (!o.exemplars.length || Distribution_Exemplar.isAmino(o.exemplars[0]))); + }, encode(message: Distribution, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.count !== BigInt(0)) { writer.uint32(8).int64(message.count); @@ -624,6 +634,15 @@ export const Distribution = { typeUrl: "/google.api.servicecontrol.v1.Distribution", value: Distribution.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Distribution.typeUrl)) { + return; + } + Distribution_LinearBuckets.registerTypeUrl(); + Distribution_ExponentialBuckets.registerTypeUrl(); + Distribution_ExplicitBuckets.registerTypeUrl(); + Distribution_Exemplar.registerTypeUrl(); } }; function createBaseDistribution_LinearBuckets(): Distribution_LinearBuckets { @@ -641,6 +660,15 @@ function createBaseDistribution_LinearBuckets(): Distribution_LinearBuckets { */ export const Distribution_LinearBuckets = { typeUrl: "/google.api.servicecontrol.v1.LinearBuckets", + is(o: any): o is Distribution_LinearBuckets { + return o && (o.$typeUrl === Distribution_LinearBuckets.typeUrl || typeof o.numFiniteBuckets === "number" && typeof o.width === "number" && typeof o.offset === "number"); + }, + isSDK(o: any): o is Distribution_LinearBucketsSDKType { + return o && (o.$typeUrl === Distribution_LinearBuckets.typeUrl || typeof o.num_finite_buckets === "number" && typeof o.width === "number" && typeof o.offset === "number"); + }, + isAmino(o: any): o is Distribution_LinearBucketsAmino { + return o && (o.$typeUrl === Distribution_LinearBuckets.typeUrl || typeof o.num_finite_buckets === "number" && typeof o.width === "number" && typeof o.offset === "number"); + }, encode(message: Distribution_LinearBuckets, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.numFiniteBuckets !== 0) { writer.uint32(8).int32(message.numFiniteBuckets); @@ -735,7 +763,8 @@ export const Distribution_LinearBuckets = { typeUrl: "/google.api.servicecontrol.v1.LinearBuckets", value: Distribution_LinearBuckets.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseDistribution_ExponentialBuckets(): Distribution_ExponentialBuckets { return { @@ -752,6 +781,15 @@ function createBaseDistribution_ExponentialBuckets(): Distribution_ExponentialBu */ export const Distribution_ExponentialBuckets = { typeUrl: "/google.api.servicecontrol.v1.ExponentialBuckets", + is(o: any): o is Distribution_ExponentialBuckets { + return o && (o.$typeUrl === Distribution_ExponentialBuckets.typeUrl || typeof o.numFiniteBuckets === "number" && typeof o.growthFactor === "number" && typeof o.scale === "number"); + }, + isSDK(o: any): o is Distribution_ExponentialBucketsSDKType { + return o && (o.$typeUrl === Distribution_ExponentialBuckets.typeUrl || typeof o.num_finite_buckets === "number" && typeof o.growth_factor === "number" && typeof o.scale === "number"); + }, + isAmino(o: any): o is Distribution_ExponentialBucketsAmino { + return o && (o.$typeUrl === Distribution_ExponentialBuckets.typeUrl || typeof o.num_finite_buckets === "number" && typeof o.growth_factor === "number" && typeof o.scale === "number"); + }, encode(message: Distribution_ExponentialBuckets, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.numFiniteBuckets !== 0) { writer.uint32(8).int32(message.numFiniteBuckets); @@ -846,7 +884,8 @@ export const Distribution_ExponentialBuckets = { typeUrl: "/google.api.servicecontrol.v1.ExponentialBuckets", value: Distribution_ExponentialBuckets.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseDistribution_ExplicitBuckets(): Distribution_ExplicitBuckets { return { @@ -861,6 +900,15 @@ function createBaseDistribution_ExplicitBuckets(): Distribution_ExplicitBuckets */ export const Distribution_ExplicitBuckets = { typeUrl: "/google.api.servicecontrol.v1.ExplicitBuckets", + is(o: any): o is Distribution_ExplicitBuckets { + return o && (o.$typeUrl === Distribution_ExplicitBuckets.typeUrl || Array.isArray(o.bounds) && (!o.bounds.length || typeof o.bounds[0] === "number")); + }, + isSDK(o: any): o is Distribution_ExplicitBucketsSDKType { + return o && (o.$typeUrl === Distribution_ExplicitBuckets.typeUrl || Array.isArray(o.bounds) && (!o.bounds.length || typeof o.bounds[0] === "number")); + }, + isAmino(o: any): o is Distribution_ExplicitBucketsAmino { + return o && (o.$typeUrl === Distribution_ExplicitBuckets.typeUrl || Array.isArray(o.bounds) && (!o.bounds.length || typeof o.bounds[0] === "number")); + }, encode(message: Distribution_ExplicitBuckets, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { writer.uint32(10).fork(); for (const v of message.bounds) { @@ -942,5 +990,6 @@ export const Distribution_ExplicitBuckets = { typeUrl: "/google.api.servicecontrol.v1.ExplicitBuckets", value: Distribution_ExplicitBuckets.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/google/api/servicecontrol/v1/http_request.ts b/__fixtures__/v-next/outputv3/google/api/servicecontrol/v1/http_request.ts index 166162ef2f..adb10cc8db 100644 --- a/__fixtures__/v-next/outputv3/google/api/servicecontrol/v1/http_request.ts +++ b/__fixtures__/v-next/outputv3/google/api/servicecontrol/v1/http_request.ts @@ -1,5 +1,6 @@ import { Duration, DurationAmino, DurationSDKType } from "../../../protobuf/duration"; import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { GlobalDecoderRegistry } from "../../../../registry"; import { isSet, DeepPartial } from "../../../../helpers"; export const protobufPackage = "google.api.servicecontrol.v1"; /** @@ -232,6 +233,15 @@ function createBaseHttpRequest(): HttpRequest { */ export const HttpRequest = { typeUrl: "/google.api.servicecontrol.v1.HttpRequest", + is(o: any): o is HttpRequest { + return o && (o.$typeUrl === HttpRequest.typeUrl || typeof o.requestMethod === "string" && typeof o.requestUrl === "string" && typeof o.requestSize === "bigint" && typeof o.status === "number" && typeof o.responseSize === "bigint" && typeof o.userAgent === "string" && typeof o.remoteIp === "string" && typeof o.serverIp === "string" && typeof o.referer === "string" && typeof o.cacheLookup === "boolean" && typeof o.cacheHit === "boolean" && typeof o.cacheValidatedWithOriginServer === "boolean" && typeof o.cacheFillBytes === "bigint" && typeof o.protocol === "string"); + }, + isSDK(o: any): o is HttpRequestSDKType { + return o && (o.$typeUrl === HttpRequest.typeUrl || typeof o.request_method === "string" && typeof o.request_url === "string" && typeof o.request_size === "bigint" && typeof o.status === "number" && typeof o.response_size === "bigint" && typeof o.user_agent === "string" && typeof o.remote_ip === "string" && typeof o.server_ip === "string" && typeof o.referer === "string" && typeof o.cache_lookup === "boolean" && typeof o.cache_hit === "boolean" && typeof o.cache_validated_with_origin_server === "boolean" && typeof o.cache_fill_bytes === "bigint" && typeof o.protocol === "string"); + }, + isAmino(o: any): o is HttpRequestAmino { + return o && (o.$typeUrl === HttpRequest.typeUrl || typeof o.request_method === "string" && typeof o.request_url === "string" && typeof o.request_size === "bigint" && typeof o.status === "number" && typeof o.response_size === "bigint" && typeof o.user_agent === "string" && typeof o.remote_ip === "string" && typeof o.server_ip === "string" && typeof o.referer === "string" && typeof o.cache_lookup === "boolean" && typeof o.cache_hit === "boolean" && typeof o.cache_validated_with_origin_server === "boolean" && typeof o.cache_fill_bytes === "bigint" && typeof o.protocol === "string"); + }, encode(message: HttpRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.requestMethod !== "") { writer.uint32(10).string(message.requestMethod); @@ -502,5 +512,6 @@ export const HttpRequest = { typeUrl: "/google.api.servicecontrol.v1.HttpRequest", value: HttpRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/google/api/servicecontrol/v1/log_entry.ts b/__fixtures__/v-next/outputv3/google/api/servicecontrol/v1/log_entry.ts index 14c7259be4..e8fdaf6131 100644 --- a/__fixtures__/v-next/outputv3/google/api/servicecontrol/v1/log_entry.ts +++ b/__fixtures__/v-next/outputv3/google/api/servicecontrol/v1/log_entry.ts @@ -5,6 +5,7 @@ import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../protobuf/any"; import { Struct, StructAmino, StructSDKType } from "../../../protobuf/struct"; import { BinaryReader, BinaryWriter } from "../../../../binary"; import { isSet, DeepPartial, toTimestamp, fromTimestamp, isObject } from "../../../../helpers"; +import { GlobalDecoderRegistry } from "../../../../registry"; export const protobufPackage = "google.api.servicecontrol.v1"; /** * @name LogEntry_LabelsEntry @@ -438,7 +439,8 @@ export const LogEntry_LabelsEntry = { }, toProto(message: LogEntry_LabelsEntry): Uint8Array { return LogEntry_LabelsEntry.encode(message).finish(); - } + }, + registerTypeUrl() {} }; function createBaseLogEntry(): LogEntry { return { @@ -464,6 +466,15 @@ function createBaseLogEntry(): LogEntry { */ export const LogEntry = { typeUrl: "/google.api.servicecontrol.v1.LogEntry", + is(o: any): o is LogEntry { + return o && (o.$typeUrl === LogEntry.typeUrl || typeof o.name === "string" && isSet(o.severity) && typeof o.trace === "string" && typeof o.insertId === "string" && isSet(o.labels)); + }, + isSDK(o: any): o is LogEntrySDKType { + return o && (o.$typeUrl === LogEntry.typeUrl || typeof o.name === "string" && isSet(o.severity) && typeof o.trace === "string" && typeof o.insert_id === "string" && isSet(o.labels)); + }, + isAmino(o: any): o is LogEntryAmino { + return o && (o.$typeUrl === LogEntry.typeUrl || typeof o.name === "string" && isSet(o.severity) && typeof o.trace === "string" && typeof o.insert_id === "string" && isSet(o.labels)); + }, encode(message: LogEntry, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(82).string(message.name); @@ -732,6 +743,14 @@ export const LogEntry = { typeUrl: "/google.api.servicecontrol.v1.LogEntry", value: LogEntry.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(LogEntry.typeUrl)) { + return; + } + Struct.registerTypeUrl(); + LogEntryOperation.registerTypeUrl(); + LogEntrySourceLocation.registerTypeUrl(); } }; function createBaseLogEntryOperation(): LogEntryOperation { @@ -751,6 +770,15 @@ function createBaseLogEntryOperation(): LogEntryOperation { */ export const LogEntryOperation = { typeUrl: "/google.api.servicecontrol.v1.LogEntryOperation", + is(o: any): o is LogEntryOperation { + return o && (o.$typeUrl === LogEntryOperation.typeUrl || typeof o.id === "string" && typeof o.producer === "string" && typeof o.first === "boolean" && typeof o.last === "boolean"); + }, + isSDK(o: any): o is LogEntryOperationSDKType { + return o && (o.$typeUrl === LogEntryOperation.typeUrl || typeof o.id === "string" && typeof o.producer === "string" && typeof o.first === "boolean" && typeof o.last === "boolean"); + }, + isAmino(o: any): o is LogEntryOperationAmino { + return o && (o.$typeUrl === LogEntryOperation.typeUrl || typeof o.id === "string" && typeof o.producer === "string" && typeof o.first === "boolean" && typeof o.last === "boolean"); + }, encode(message: LogEntryOperation, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.id !== "") { writer.uint32(10).string(message.id); @@ -859,7 +887,8 @@ export const LogEntryOperation = { typeUrl: "/google.api.servicecontrol.v1.LogEntryOperation", value: LogEntryOperation.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseLogEntrySourceLocation(): LogEntrySourceLocation { return { @@ -877,6 +906,15 @@ function createBaseLogEntrySourceLocation(): LogEntrySourceLocation { */ export const LogEntrySourceLocation = { typeUrl: "/google.api.servicecontrol.v1.LogEntrySourceLocation", + is(o: any): o is LogEntrySourceLocation { + return o && (o.$typeUrl === LogEntrySourceLocation.typeUrl || typeof o.file === "string" && typeof o.line === "bigint" && typeof o.function === "string"); + }, + isSDK(o: any): o is LogEntrySourceLocationSDKType { + return o && (o.$typeUrl === LogEntrySourceLocation.typeUrl || typeof o.file === "string" && typeof o.line === "bigint" && typeof o.function === "string"); + }, + isAmino(o: any): o is LogEntrySourceLocationAmino { + return o && (o.$typeUrl === LogEntrySourceLocation.typeUrl || typeof o.file === "string" && typeof o.line === "bigint" && typeof o.function === "string"); + }, encode(message: LogEntrySourceLocation, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.file !== "") { writer.uint32(10).string(message.file); @@ -973,5 +1011,6 @@ export const LogEntrySourceLocation = { typeUrl: "/google.api.servicecontrol.v1.LogEntrySourceLocation", value: LogEntrySourceLocation.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/google/api/servicecontrol/v1/metric_value.ts b/__fixtures__/v-next/outputv3/google/api/servicecontrol/v1/metric_value.ts index 9ee54ebc28..782184aa44 100644 --- a/__fixtures__/v-next/outputv3/google/api/servicecontrol/v1/metric_value.ts +++ b/__fixtures__/v-next/outputv3/google/api/servicecontrol/v1/metric_value.ts @@ -2,6 +2,7 @@ import { Timestamp, TimestampAmino, TimestampSDKType } from "../../../protobuf/t import { Distribution, DistributionAmino, DistributionSDKType } from "./distribution"; import { BinaryReader, BinaryWriter } from "../../../../binary"; import { isSet, DeepPartial, toTimestamp, fromTimestamp, isObject } from "../../../../helpers"; +import { GlobalDecoderRegistry } from "../../../../registry"; export const protobufPackage = "google.api.servicecontrol.v1"; /** * @name MetricValue_LabelsEntry @@ -296,7 +297,8 @@ export const MetricValue_LabelsEntry = { }, toProto(message: MetricValue_LabelsEntry): Uint8Array { return MetricValue_LabelsEntry.encode(message).finish(); - } + }, + registerTypeUrl() {} }; function createBaseMetricValue(): MetricValue { return { @@ -318,6 +320,15 @@ function createBaseMetricValue(): MetricValue { */ export const MetricValue = { typeUrl: "/google.api.servicecontrol.v1.MetricValue", + is(o: any): o is MetricValue { + return o && (o.$typeUrl === MetricValue.typeUrl || isSet(o.labels)); + }, + isSDK(o: any): o is MetricValueSDKType { + return o && (o.$typeUrl === MetricValue.typeUrl || isSet(o.labels)); + }, + isAmino(o: any): o is MetricValueAmino { + return o && (o.$typeUrl === MetricValue.typeUrl || isSet(o.labels)); + }, encode(message: MetricValue, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { Object.entries(message.labels).forEach(([key, value]) => { MetricValue_LabelsEntry.encode({ @@ -524,6 +535,12 @@ export const MetricValue = { typeUrl: "/google.api.servicecontrol.v1.MetricValue", value: MetricValue.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MetricValue.typeUrl)) { + return; + } + Distribution.registerTypeUrl(); } }; function createBaseMetricValueSet(): MetricValueSet { @@ -542,6 +559,15 @@ function createBaseMetricValueSet(): MetricValueSet { */ export const MetricValueSet = { typeUrl: "/google.api.servicecontrol.v1.MetricValueSet", + is(o: any): o is MetricValueSet { + return o && (o.$typeUrl === MetricValueSet.typeUrl || typeof o.metricName === "string" && Array.isArray(o.metricValues) && (!o.metricValues.length || MetricValue.is(o.metricValues[0]))); + }, + isSDK(o: any): o is MetricValueSetSDKType { + return o && (o.$typeUrl === MetricValueSet.typeUrl || typeof o.metric_name === "string" && Array.isArray(o.metric_values) && (!o.metric_values.length || MetricValue.isSDK(o.metric_values[0]))); + }, + isAmino(o: any): o is MetricValueSetAmino { + return o && (o.$typeUrl === MetricValueSet.typeUrl || typeof o.metric_name === "string" && Array.isArray(o.metric_values) && (!o.metric_values.length || MetricValue.isAmino(o.metric_values[0]))); + }, encode(message: MetricValueSet, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.metricName !== "") { writer.uint32(10).string(message.metricName); @@ -628,5 +654,11 @@ export const MetricValueSet = { typeUrl: "/google.api.servicecontrol.v1.MetricValueSet", value: MetricValueSet.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MetricValueSet.typeUrl)) { + return; + } + MetricValue.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/google/api/servicecontrol/v1/operation.ts b/__fixtures__/v-next/outputv3/google/api/servicecontrol/v1/operation.ts index ea47aeae07..eefc70102d 100644 --- a/__fixtures__/v-next/outputv3/google/api/servicecontrol/v1/operation.ts +++ b/__fixtures__/v-next/outputv3/google/api/servicecontrol/v1/operation.ts @@ -382,7 +382,8 @@ export const Operation_LabelsEntry = { }, toProto(message: Operation_LabelsEntry): Uint8Array { return Operation_LabelsEntry.encode(message).finish(); - } + }, + registerTypeUrl() {} }; function createBaseOperation(): Operation { return { @@ -406,6 +407,15 @@ function createBaseOperation(): Operation { */ export const Operation = { typeUrl: "/google.api.servicecontrol.v1.Operation", + is(o: any): o is Operation { + return o && (o.$typeUrl === Operation.typeUrl || typeof o.operationId === "string" && typeof o.operationName === "string" && typeof o.consumerId === "string" && isSet(o.labels) && Array.isArray(o.metricValueSets) && (!o.metricValueSets.length || MetricValueSet.is(o.metricValueSets[0])) && Array.isArray(o.logEntries) && (!o.logEntries.length || LogEntry.is(o.logEntries[0])) && isSet(o.importance) && Array.isArray(o.extensions) && (!o.extensions.length || Any.is(o.extensions[0]))); + }, + isSDK(o: any): o is OperationSDKType { + return o && (o.$typeUrl === Operation.typeUrl || typeof o.operation_id === "string" && typeof o.operation_name === "string" && typeof o.consumer_id === "string" && isSet(o.labels) && Array.isArray(o.metric_value_sets) && (!o.metric_value_sets.length || MetricValueSet.isSDK(o.metric_value_sets[0])) && Array.isArray(o.log_entries) && (!o.log_entries.length || LogEntry.isSDK(o.log_entries[0])) && isSet(o.importance) && Array.isArray(o.extensions) && (!o.extensions.length || Any.isSDK(o.extensions[0]))); + }, + isAmino(o: any): o is OperationAmino { + return o && (o.$typeUrl === Operation.typeUrl || typeof o.operation_id === "string" && typeof o.operation_name === "string" && typeof o.consumer_id === "string" && isSet(o.labels) && Array.isArray(o.metric_value_sets) && (!o.metric_value_sets.length || MetricValueSet.isAmino(o.metric_value_sets[0])) && Array.isArray(o.log_entries) && (!o.log_entries.length || LogEntry.isAmino(o.log_entries[0])) && isSet(o.importance) && Array.isArray(o.extensions) && (!o.extensions.length || Any.isAmino(o.extensions[0]))); + }, encode(message: Operation, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.operationId !== "") { writer.uint32(10).string(message.operationId); @@ -654,5 +664,6 @@ export const Operation = { typeUrl: "/google.api.servicecontrol.v1.Operation", value: Operation.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/google/api/servicecontrol/v1/quota_controller.ts b/__fixtures__/v-next/outputv3/google/api/servicecontrol/v1/quota_controller.ts index 276e985906..b9d82e1a73 100644 --- a/__fixtures__/v-next/outputv3/google/api/servicecontrol/v1/quota_controller.ts +++ b/__fixtures__/v-next/outputv3/google/api/servicecontrol/v1/quota_controller.ts @@ -1,6 +1,7 @@ import { MetricValueSet, MetricValueSetAmino, MetricValueSetSDKType } from "./metric_value"; import { Status, StatusAmino, StatusSDKType } from "../../../rpc/status"; import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { GlobalDecoderRegistry } from "../../../../registry"; import { isSet, DeepPartial, isObject } from "../../../../helpers"; export const protobufPackage = "google.api.servicecontrol.v1"; /** Supported quota modes. */ @@ -594,6 +595,15 @@ function createBaseAllocateQuotaRequest(): AllocateQuotaRequest { */ export const AllocateQuotaRequest = { typeUrl: "/google.api.servicecontrol.v1.AllocateQuotaRequest", + is(o: any): o is AllocateQuotaRequest { + return o && (o.$typeUrl === AllocateQuotaRequest.typeUrl || typeof o.serviceName === "string" && typeof o.serviceConfigId === "string"); + }, + isSDK(o: any): o is AllocateQuotaRequestSDKType { + return o && (o.$typeUrl === AllocateQuotaRequest.typeUrl || typeof o.service_name === "string" && typeof o.service_config_id === "string"); + }, + isAmino(o: any): o is AllocateQuotaRequestAmino { + return o && (o.$typeUrl === AllocateQuotaRequest.typeUrl || typeof o.service_name === "string" && typeof o.service_config_id === "string"); + }, encode(message: AllocateQuotaRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.serviceName !== "") { writer.uint32(10).string(message.serviceName); @@ -690,6 +700,12 @@ export const AllocateQuotaRequest = { typeUrl: "/google.api.servicecontrol.v1.AllocateQuotaRequest", value: AllocateQuotaRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(AllocateQuotaRequest.typeUrl)) { + return; + } + QuotaOperation.registerTypeUrl(); } }; function createBaseQuotaOperation_LabelsEntry(): QuotaOperation_LabelsEntry { @@ -778,7 +794,8 @@ export const QuotaOperation_LabelsEntry = { }, toProto(message: QuotaOperation_LabelsEntry): Uint8Array { return QuotaOperation_LabelsEntry.encode(message).finish(); - } + }, + registerTypeUrl() {} }; function createBaseQuotaOperation(): QuotaOperation { return { @@ -798,6 +815,15 @@ function createBaseQuotaOperation(): QuotaOperation { */ export const QuotaOperation = { typeUrl: "/google.api.servicecontrol.v1.QuotaOperation", + is(o: any): o is QuotaOperation { + return o && (o.$typeUrl === QuotaOperation.typeUrl || typeof o.operationId === "string" && typeof o.methodName === "string" && typeof o.consumerId === "string" && isSet(o.labels) && Array.isArray(o.quotaMetrics) && (!o.quotaMetrics.length || MetricValueSet.is(o.quotaMetrics[0])) && isSet(o.quotaMode)); + }, + isSDK(o: any): o is QuotaOperationSDKType { + return o && (o.$typeUrl === QuotaOperation.typeUrl || typeof o.operation_id === "string" && typeof o.method_name === "string" && typeof o.consumer_id === "string" && isSet(o.labels) && Array.isArray(o.quota_metrics) && (!o.quota_metrics.length || MetricValueSet.isSDK(o.quota_metrics[0])) && isSet(o.quota_mode)); + }, + isAmino(o: any): o is QuotaOperationAmino { + return o && (o.$typeUrl === QuotaOperation.typeUrl || typeof o.operation_id === "string" && typeof o.method_name === "string" && typeof o.consumer_id === "string" && isSet(o.labels) && Array.isArray(o.quota_metrics) && (!o.quota_metrics.length || MetricValueSet.isAmino(o.quota_metrics[0])) && isSet(o.quota_mode)); + }, encode(message: QuotaOperation, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.operationId !== "") { writer.uint32(10).string(message.operationId); @@ -978,6 +1004,12 @@ export const QuotaOperation = { typeUrl: "/google.api.servicecontrol.v1.QuotaOperation", value: QuotaOperation.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QuotaOperation.typeUrl)) { + return; + } + MetricValueSet.registerTypeUrl(); } }; function createBaseAllocateQuotaResponse(): AllocateQuotaResponse { @@ -996,6 +1028,15 @@ function createBaseAllocateQuotaResponse(): AllocateQuotaResponse { */ export const AllocateQuotaResponse = { typeUrl: "/google.api.servicecontrol.v1.AllocateQuotaResponse", + is(o: any): o is AllocateQuotaResponse { + return o && (o.$typeUrl === AllocateQuotaResponse.typeUrl || typeof o.operationId === "string" && Array.isArray(o.allocateErrors) && (!o.allocateErrors.length || QuotaError.is(o.allocateErrors[0])) && Array.isArray(o.quotaMetrics) && (!o.quotaMetrics.length || MetricValueSet.is(o.quotaMetrics[0])) && typeof o.serviceConfigId === "string"); + }, + isSDK(o: any): o is AllocateQuotaResponseSDKType { + return o && (o.$typeUrl === AllocateQuotaResponse.typeUrl || typeof o.operation_id === "string" && Array.isArray(o.allocate_errors) && (!o.allocate_errors.length || QuotaError.isSDK(o.allocate_errors[0])) && Array.isArray(o.quota_metrics) && (!o.quota_metrics.length || MetricValueSet.isSDK(o.quota_metrics[0])) && typeof o.service_config_id === "string"); + }, + isAmino(o: any): o is AllocateQuotaResponseAmino { + return o && (o.$typeUrl === AllocateQuotaResponse.typeUrl || typeof o.operation_id === "string" && Array.isArray(o.allocate_errors) && (!o.allocate_errors.length || QuotaError.isAmino(o.allocate_errors[0])) && Array.isArray(o.quota_metrics) && (!o.quota_metrics.length || MetricValueSet.isAmino(o.quota_metrics[0])) && typeof o.service_config_id === "string"); + }, encode(message: AllocateQuotaResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.operationId !== "") { writer.uint32(10).string(message.operationId); @@ -1116,6 +1157,13 @@ export const AllocateQuotaResponse = { typeUrl: "/google.api.servicecontrol.v1.AllocateQuotaResponse", value: AllocateQuotaResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(AllocateQuotaResponse.typeUrl)) { + return; + } + QuotaError.registerTypeUrl(); + MetricValueSet.registerTypeUrl(); } }; function createBaseQuotaError(): QuotaError { @@ -1134,6 +1182,15 @@ function createBaseQuotaError(): QuotaError { */ export const QuotaError = { typeUrl: "/google.api.servicecontrol.v1.QuotaError", + is(o: any): o is QuotaError { + return o && (o.$typeUrl === QuotaError.typeUrl || isSet(o.code) && typeof o.subject === "string" && typeof o.description === "string"); + }, + isSDK(o: any): o is QuotaErrorSDKType { + return o && (o.$typeUrl === QuotaError.typeUrl || isSet(o.code) && typeof o.subject === "string" && typeof o.description === "string"); + }, + isAmino(o: any): o is QuotaErrorAmino { + return o && (o.$typeUrl === QuotaError.typeUrl || isSet(o.code) && typeof o.subject === "string" && typeof o.description === "string"); + }, encode(message: QuotaError, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.code !== 0) { writer.uint32(8).int32(message.code); @@ -1244,5 +1301,11 @@ export const QuotaError = { typeUrl: "/google.api.servicecontrol.v1.QuotaError", value: QuotaError.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QuotaError.typeUrl)) { + return; + } + Status.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/google/api/servicecontrol/v1/service_controller.ts b/__fixtures__/v-next/outputv3/google/api/servicecontrol/v1/service_controller.ts index 091f5111a6..495e6b3125 100644 --- a/__fixtures__/v-next/outputv3/google/api/servicecontrol/v1/service_controller.ts +++ b/__fixtures__/v-next/outputv3/google/api/servicecontrol/v1/service_controller.ts @@ -2,6 +2,7 @@ import { Operation, OperationAmino, OperationSDKType } from "./operation"; import { CheckError, CheckErrorAmino, CheckErrorSDKType } from "./check_error"; import { Status, StatusAmino, StatusSDKType } from "../../../rpc/status"; import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { GlobalDecoderRegistry } from "../../../../registry"; import { isSet, DeepPartial } from "../../../../helpers"; export const protobufPackage = "google.api.servicecontrol.v1"; /** @@ -588,6 +589,15 @@ function createBaseCheckRequest(): CheckRequest { */ export const CheckRequest = { typeUrl: "/google.api.servicecontrol.v1.CheckRequest", + is(o: any): o is CheckRequest { + return o && (o.$typeUrl === CheckRequest.typeUrl || typeof o.serviceName === "string" && typeof o.serviceConfigId === "string"); + }, + isSDK(o: any): o is CheckRequestSDKType { + return o && (o.$typeUrl === CheckRequest.typeUrl || typeof o.service_name === "string" && typeof o.service_config_id === "string"); + }, + isAmino(o: any): o is CheckRequestAmino { + return o && (o.$typeUrl === CheckRequest.typeUrl || typeof o.service_name === "string" && typeof o.service_config_id === "string"); + }, encode(message: CheckRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.serviceName !== "") { writer.uint32(10).string(message.serviceName); @@ -684,6 +694,12 @@ export const CheckRequest = { typeUrl: "/google.api.servicecontrol.v1.CheckRequest", value: CheckRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(CheckRequest.typeUrl)) { + return; + } + Operation.registerTypeUrl(); } }; function createBaseCheckResponse(): CheckResponse { @@ -703,6 +719,15 @@ function createBaseCheckResponse(): CheckResponse { */ export const CheckResponse = { typeUrl: "/google.api.servicecontrol.v1.CheckResponse", + is(o: any): o is CheckResponse { + return o && (o.$typeUrl === CheckResponse.typeUrl || typeof o.operationId === "string" && Array.isArray(o.checkErrors) && (!o.checkErrors.length || CheckError.is(o.checkErrors[0])) && typeof o.serviceConfigId === "string" && typeof o.serviceRolloutId === "string"); + }, + isSDK(o: any): o is CheckResponseSDKType { + return o && (o.$typeUrl === CheckResponse.typeUrl || typeof o.operation_id === "string" && Array.isArray(o.check_errors) && (!o.check_errors.length || CheckError.isSDK(o.check_errors[0])) && typeof o.service_config_id === "string" && typeof o.service_rollout_id === "string"); + }, + isAmino(o: any): o is CheckResponseAmino { + return o && (o.$typeUrl === CheckResponse.typeUrl || typeof o.operation_id === "string" && Array.isArray(o.check_errors) && (!o.check_errors.length || CheckError.isAmino(o.check_errors[0])) && typeof o.service_config_id === "string" && typeof o.service_rollout_id === "string"); + }, encode(message: CheckResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.operationId !== "") { writer.uint32(10).string(message.operationId); @@ -833,6 +858,13 @@ export const CheckResponse = { typeUrl: "/google.api.servicecontrol.v1.CheckResponse", value: CheckResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(CheckResponse.typeUrl)) { + return; + } + CheckError.registerTypeUrl(); + CheckResponse_CheckInfo.registerTypeUrl(); } }; function createBaseCheckResponse_CheckInfo(): CheckResponse_CheckInfo { @@ -849,6 +881,15 @@ function createBaseCheckResponse_CheckInfo(): CheckResponse_CheckInfo { */ export const CheckResponse_CheckInfo = { typeUrl: "/google.api.servicecontrol.v1.CheckInfo", + is(o: any): o is CheckResponse_CheckInfo { + return o && (o.$typeUrl === CheckResponse_CheckInfo.typeUrl || Array.isArray(o.unusedArguments) && (!o.unusedArguments.length || typeof o.unusedArguments[0] === "string")); + }, + isSDK(o: any): o is CheckResponse_CheckInfoSDKType { + return o && (o.$typeUrl === CheckResponse_CheckInfo.typeUrl || Array.isArray(o.unused_arguments) && (!o.unused_arguments.length || typeof o.unused_arguments[0] === "string")); + }, + isAmino(o: any): o is CheckResponse_CheckInfoAmino { + return o && (o.$typeUrl === CheckResponse_CheckInfo.typeUrl || Array.isArray(o.unused_arguments) && (!o.unused_arguments.length || typeof o.unused_arguments[0] === "string")); + }, encode(message: CheckResponse_CheckInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.unusedArguments) { writer.uint32(10).string(v!); @@ -937,6 +978,12 @@ export const CheckResponse_CheckInfo = { typeUrl: "/google.api.servicecontrol.v1.CheckInfo", value: CheckResponse_CheckInfo.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(CheckResponse_CheckInfo.typeUrl)) { + return; + } + CheckResponse_ConsumerInfo.registerTypeUrl(); } }; function createBaseCheckResponse_ConsumerInfo(): CheckResponse_ConsumerInfo { @@ -954,6 +1001,15 @@ function createBaseCheckResponse_ConsumerInfo(): CheckResponse_ConsumerInfo { */ export const CheckResponse_ConsumerInfo = { typeUrl: "/google.api.servicecontrol.v1.ConsumerInfo", + is(o: any): o is CheckResponse_ConsumerInfo { + return o && (o.$typeUrl === CheckResponse_ConsumerInfo.typeUrl || typeof o.projectNumber === "bigint" && isSet(o.type) && typeof o.consumerNumber === "bigint"); + }, + isSDK(o: any): o is CheckResponse_ConsumerInfoSDKType { + return o && (o.$typeUrl === CheckResponse_ConsumerInfo.typeUrl || typeof o.project_number === "bigint" && isSet(o.type) && typeof o.consumer_number === "bigint"); + }, + isAmino(o: any): o is CheckResponse_ConsumerInfoAmino { + return o && (o.$typeUrl === CheckResponse_ConsumerInfo.typeUrl || typeof o.project_number === "bigint" && isSet(o.type) && typeof o.consumer_number === "bigint"); + }, encode(message: CheckResponse_ConsumerInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.projectNumber !== BigInt(0)) { writer.uint32(8).int64(message.projectNumber); @@ -1052,7 +1108,8 @@ export const CheckResponse_ConsumerInfo = { typeUrl: "/google.api.servicecontrol.v1.ConsumerInfo", value: CheckResponse_ConsumerInfo.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseReportRequest(): ReportRequest { return { @@ -1069,6 +1126,15 @@ function createBaseReportRequest(): ReportRequest { */ export const ReportRequest = { typeUrl: "/google.api.servicecontrol.v1.ReportRequest", + is(o: any): o is ReportRequest { + return o && (o.$typeUrl === ReportRequest.typeUrl || typeof o.serviceName === "string" && Array.isArray(o.operations) && (!o.operations.length || Operation.is(o.operations[0])) && typeof o.serviceConfigId === "string"); + }, + isSDK(o: any): o is ReportRequestSDKType { + return o && (o.$typeUrl === ReportRequest.typeUrl || typeof o.service_name === "string" && Array.isArray(o.operations) && (!o.operations.length || Operation.isSDK(o.operations[0])) && typeof o.service_config_id === "string"); + }, + isAmino(o: any): o is ReportRequestAmino { + return o && (o.$typeUrl === ReportRequest.typeUrl || typeof o.service_name === "string" && Array.isArray(o.operations) && (!o.operations.length || Operation.isAmino(o.operations[0])) && typeof o.service_config_id === "string"); + }, encode(message: ReportRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.serviceName !== "") { writer.uint32(10).string(message.serviceName); @@ -1169,6 +1235,12 @@ export const ReportRequest = { typeUrl: "/google.api.servicecontrol.v1.ReportRequest", value: ReportRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ReportRequest.typeUrl)) { + return; + } + Operation.registerTypeUrl(); } }; function createBaseReportResponse(): ReportResponse { @@ -1186,6 +1258,15 @@ function createBaseReportResponse(): ReportResponse { */ export const ReportResponse = { typeUrl: "/google.api.servicecontrol.v1.ReportResponse", + is(o: any): o is ReportResponse { + return o && (o.$typeUrl === ReportResponse.typeUrl || Array.isArray(o.reportErrors) && (!o.reportErrors.length || ReportResponse_ReportError.is(o.reportErrors[0])) && typeof o.serviceConfigId === "string" && typeof o.serviceRolloutId === "string"); + }, + isSDK(o: any): o is ReportResponseSDKType { + return o && (o.$typeUrl === ReportResponse.typeUrl || Array.isArray(o.report_errors) && (!o.report_errors.length || ReportResponse_ReportError.isSDK(o.report_errors[0])) && typeof o.service_config_id === "string" && typeof o.service_rollout_id === "string"); + }, + isAmino(o: any): o is ReportResponseAmino { + return o && (o.$typeUrl === ReportResponse.typeUrl || Array.isArray(o.report_errors) && (!o.report_errors.length || ReportResponse_ReportError.isAmino(o.report_errors[0])) && typeof o.service_config_id === "string" && typeof o.service_rollout_id === "string"); + }, encode(message: ReportResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.reportErrors) { ReportResponse_ReportError.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -1286,6 +1367,12 @@ export const ReportResponse = { typeUrl: "/google.api.servicecontrol.v1.ReportResponse", value: ReportResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ReportResponse.typeUrl)) { + return; + } + ReportResponse_ReportError.registerTypeUrl(); } }; function createBaseReportResponse_ReportError(): ReportResponse_ReportError { @@ -1303,6 +1390,15 @@ function createBaseReportResponse_ReportError(): ReportResponse_ReportError { */ export const ReportResponse_ReportError = { typeUrl: "/google.api.servicecontrol.v1.ReportError", + is(o: any): o is ReportResponse_ReportError { + return o && (o.$typeUrl === ReportResponse_ReportError.typeUrl || typeof o.operationId === "string"); + }, + isSDK(o: any): o is ReportResponse_ReportErrorSDKType { + return o && (o.$typeUrl === ReportResponse_ReportError.typeUrl || typeof o.operation_id === "string"); + }, + isAmino(o: any): o is ReportResponse_ReportErrorAmino { + return o && (o.$typeUrl === ReportResponse_ReportError.typeUrl || typeof o.operation_id === "string"); + }, encode(message: ReportResponse_ReportError, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.operationId !== "") { writer.uint32(10).string(message.operationId); @@ -1385,5 +1481,11 @@ export const ReportResponse_ReportError = { typeUrl: "/google.api.servicecontrol.v1.ReportError", value: ReportResponse_ReportError.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ReportResponse_ReportError.typeUrl)) { + return; + } + Status.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/google/api/servicecontrol/v2/service_controller.ts b/__fixtures__/v-next/outputv3/google/api/servicecontrol/v2/service_controller.ts index 7ae37ae0fe..bcb5d189a9 100644 --- a/__fixtures__/v-next/outputv3/google/api/servicecontrol/v2/service_controller.ts +++ b/__fixtures__/v-next/outputv3/google/api/servicecontrol/v2/service_controller.ts @@ -1,6 +1,7 @@ import { AttributeContext, AttributeContextAmino, AttributeContextSDKType } from "../../../rpc/context/attribute_context"; import { Status, StatusAmino, StatusSDKType } from "../../../rpc/status"; import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { GlobalDecoderRegistry } from "../../../../registry"; import { isSet, DeepPartial, isObject } from "../../../../helpers"; export const protobufPackage = "google.api.servicecontrol.v2"; /** @@ -388,6 +389,15 @@ function createBaseCheckRequest(): CheckRequest { */ export const CheckRequest = { typeUrl: "/google.api.servicecontrol.v2.CheckRequest", + is(o: any): o is CheckRequest { + return o && (o.$typeUrl === CheckRequest.typeUrl || typeof o.serviceName === "string" && typeof o.serviceConfigId === "string" && Array.isArray(o.resources) && (!o.resources.length || ResourceInfo.is(o.resources[0])) && typeof o.flags === "string"); + }, + isSDK(o: any): o is CheckRequestSDKType { + return o && (o.$typeUrl === CheckRequest.typeUrl || typeof o.service_name === "string" && typeof o.service_config_id === "string" && Array.isArray(o.resources) && (!o.resources.length || ResourceInfo.isSDK(o.resources[0])) && typeof o.flags === "string"); + }, + isAmino(o: any): o is CheckRequestAmino { + return o && (o.$typeUrl === CheckRequest.typeUrl || typeof o.service_name === "string" && typeof o.service_config_id === "string" && Array.isArray(o.resources) && (!o.resources.length || ResourceInfo.isAmino(o.resources[0])) && typeof o.flags === "string"); + }, encode(message: CheckRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.serviceName !== "") { writer.uint32(10).string(message.serviceName); @@ -518,6 +528,13 @@ export const CheckRequest = { typeUrl: "/google.api.servicecontrol.v2.CheckRequest", value: CheckRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(CheckRequest.typeUrl)) { + return; + } + AttributeContext.registerTypeUrl(); + ResourceInfo.registerTypeUrl(); } }; function createBaseResourceInfo(): ResourceInfo { @@ -537,6 +554,15 @@ function createBaseResourceInfo(): ResourceInfo { */ export const ResourceInfo = { typeUrl: "/google.api.servicecontrol.v2.ResourceInfo", + is(o: any): o is ResourceInfo { + return o && (o.$typeUrl === ResourceInfo.typeUrl || typeof o.name === "string" && typeof o.type === "string" && typeof o.permission === "string" && typeof o.container === "string" && typeof o.location === "string"); + }, + isSDK(o: any): o is ResourceInfoSDKType { + return o && (o.$typeUrl === ResourceInfo.typeUrl || typeof o.name === "string" && typeof o.type === "string" && typeof o.permission === "string" && typeof o.container === "string" && typeof o.location === "string"); + }, + isAmino(o: any): o is ResourceInfoAmino { + return o && (o.$typeUrl === ResourceInfo.typeUrl || typeof o.name === "string" && typeof o.type === "string" && typeof o.permission === "string" && typeof o.container === "string" && typeof o.location === "string"); + }, encode(message: ResourceInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -659,7 +685,8 @@ export const ResourceInfo = { typeUrl: "/google.api.servicecontrol.v2.ResourceInfo", value: ResourceInfo.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseCheckResponse_HeadersEntry(): CheckResponse_HeadersEntry { return { @@ -747,7 +774,8 @@ export const CheckResponse_HeadersEntry = { }, toProto(message: CheckResponse_HeadersEntry): Uint8Array { return CheckResponse_HeadersEntry.encode(message).finish(); - } + }, + registerTypeUrl() {} }; function createBaseCheckResponse(): CheckResponse { return { @@ -763,6 +791,15 @@ function createBaseCheckResponse(): CheckResponse { */ export const CheckResponse = { typeUrl: "/google.api.servicecontrol.v2.CheckResponse", + is(o: any): o is CheckResponse { + return o && (o.$typeUrl === CheckResponse.typeUrl || isSet(o.headers)); + }, + isSDK(o: any): o is CheckResponseSDKType { + return o && (o.$typeUrl === CheckResponse.typeUrl || isSet(o.headers)); + }, + isAmino(o: any): o is CheckResponseAmino { + return o && (o.$typeUrl === CheckResponse.typeUrl || isSet(o.headers)); + }, encode(message: CheckResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.status !== undefined) { Status.encode(message.status, writer.uint32(10).fork()).ldelim(); @@ -883,6 +920,12 @@ export const CheckResponse = { typeUrl: "/google.api.servicecontrol.v2.CheckResponse", value: CheckResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(CheckResponse.typeUrl)) { + return; + } + Status.registerTypeUrl(); } }; function createBaseReportRequest(): ReportRequest { @@ -900,6 +943,15 @@ function createBaseReportRequest(): ReportRequest { */ export const ReportRequest = { typeUrl: "/google.api.servicecontrol.v2.ReportRequest", + is(o: any): o is ReportRequest { + return o && (o.$typeUrl === ReportRequest.typeUrl || typeof o.serviceName === "string" && typeof o.serviceConfigId === "string" && Array.isArray(o.operations) && (!o.operations.length || AttributeContext.is(o.operations[0]))); + }, + isSDK(o: any): o is ReportRequestSDKType { + return o && (o.$typeUrl === ReportRequest.typeUrl || typeof o.service_name === "string" && typeof o.service_config_id === "string" && Array.isArray(o.operations) && (!o.operations.length || AttributeContext.isSDK(o.operations[0]))); + }, + isAmino(o: any): o is ReportRequestAmino { + return o && (o.$typeUrl === ReportRequest.typeUrl || typeof o.service_name === "string" && typeof o.service_config_id === "string" && Array.isArray(o.operations) && (!o.operations.length || AttributeContext.isAmino(o.operations[0]))); + }, encode(message: ReportRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.serviceName !== "") { writer.uint32(10).string(message.serviceName); @@ -1000,6 +1052,12 @@ export const ReportRequest = { typeUrl: "/google.api.servicecontrol.v2.ReportRequest", value: ReportRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ReportRequest.typeUrl)) { + return; + } + AttributeContext.registerTypeUrl(); } }; function createBaseReportResponse(): ReportResponse { @@ -1014,6 +1072,15 @@ function createBaseReportResponse(): ReportResponse { */ export const ReportResponse = { typeUrl: "/google.api.servicecontrol.v2.ReportResponse", + is(o: any): o is ReportResponse { + return o && o.$typeUrl === ReportResponse.typeUrl; + }, + isSDK(o: any): o is ReportResponseSDKType { + return o && o.$typeUrl === ReportResponse.typeUrl; + }, + isAmino(o: any): o is ReportResponseAmino { + return o && o.$typeUrl === ReportResponse.typeUrl; + }, encode(_: ReportResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -1065,5 +1132,6 @@ export const ReportResponse = { typeUrl: "/google.api.servicecontrol.v2.ReportResponse", value: ReportResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/google/api/servicemanagement/v1/resources.ts b/__fixtures__/v-next/outputv3/google/api/servicemanagement/v1/resources.ts index 54405c8390..25cd8685ef 100644 --- a/__fixtures__/v-next/outputv3/google/api/servicemanagement/v1/resources.ts +++ b/__fixtures__/v-next/outputv3/google/api/servicemanagement/v1/resources.ts @@ -2,6 +2,7 @@ import { Timestamp, TimestampAmino, TimestampSDKType } from "../../../protobuf/t import { ConfigChange, ConfigChangeAmino, ConfigChangeSDKType } from "../../config_change"; import { BinaryReader, BinaryWriter } from "../../../../binary"; import { isSet, DeepPartial, toTimestamp, fromTimestamp, bytesFromBase64, base64FromBytes, isObject } from "../../../../helpers"; +import { GlobalDecoderRegistry } from "../../../../registry"; export const protobufPackage = "google.api.servicemanagement.v1"; /** Code describes the status of the operation (or one of its steps). */ export enum OperationMetadata_Status { @@ -1004,6 +1005,15 @@ function createBaseManagedService(): ManagedService { */ export const ManagedService = { typeUrl: "/google.api.servicemanagement.v1.ManagedService", + is(o: any): o is ManagedService { + return o && (o.$typeUrl === ManagedService.typeUrl || typeof o.serviceName === "string" && typeof o.producerProjectId === "string"); + }, + isSDK(o: any): o is ManagedServiceSDKType { + return o && (o.$typeUrl === ManagedService.typeUrl || typeof o.service_name === "string" && typeof o.producer_project_id === "string"); + }, + isAmino(o: any): o is ManagedServiceAmino { + return o && (o.$typeUrl === ManagedService.typeUrl || typeof o.service_name === "string" && typeof o.producer_project_id === "string"); + }, encode(message: ManagedService, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.serviceName !== "") { writer.uint32(18).string(message.serviceName); @@ -1084,7 +1094,8 @@ export const ManagedService = { typeUrl: "/google.api.servicemanagement.v1.ManagedService", value: ManagedService.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseOperationMetadata(): OperationMetadata { return { @@ -1102,6 +1113,15 @@ function createBaseOperationMetadata(): OperationMetadata { */ export const OperationMetadata = { typeUrl: "/google.api.servicemanagement.v1.OperationMetadata", + is(o: any): o is OperationMetadata { + return o && (o.$typeUrl === OperationMetadata.typeUrl || Array.isArray(o.resourceNames) && (!o.resourceNames.length || typeof o.resourceNames[0] === "string") && Array.isArray(o.steps) && (!o.steps.length || OperationMetadata_Step.is(o.steps[0])) && typeof o.progressPercentage === "number"); + }, + isSDK(o: any): o is OperationMetadataSDKType { + return o && (o.$typeUrl === OperationMetadata.typeUrl || Array.isArray(o.resource_names) && (!o.resource_names.length || typeof o.resource_names[0] === "string") && Array.isArray(o.steps) && (!o.steps.length || OperationMetadata_Step.isSDK(o.steps[0])) && typeof o.progress_percentage === "number"); + }, + isAmino(o: any): o is OperationMetadataAmino { + return o && (o.$typeUrl === OperationMetadata.typeUrl || Array.isArray(o.resource_names) && (!o.resource_names.length || typeof o.resource_names[0] === "string") && Array.isArray(o.steps) && (!o.steps.length || OperationMetadata_Step.isAmino(o.steps[0])) && typeof o.progress_percentage === "number"); + }, encode(message: OperationMetadata, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.resourceNames) { writer.uint32(10).string(v!); @@ -1222,6 +1242,12 @@ export const OperationMetadata = { typeUrl: "/google.api.servicemanagement.v1.OperationMetadata", value: OperationMetadata.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(OperationMetadata.typeUrl)) { + return; + } + OperationMetadata_Step.registerTypeUrl(); } }; function createBaseOperationMetadata_Step(): OperationMetadata_Step { @@ -1238,6 +1264,15 @@ function createBaseOperationMetadata_Step(): OperationMetadata_Step { */ export const OperationMetadata_Step = { typeUrl: "/google.api.servicemanagement.v1.Step", + is(o: any): o is OperationMetadata_Step { + return o && (o.$typeUrl === OperationMetadata_Step.typeUrl || typeof o.description === "string" && isSet(o.status)); + }, + isSDK(o: any): o is OperationMetadata_StepSDKType { + return o && (o.$typeUrl === OperationMetadata_Step.typeUrl || typeof o.description === "string" && isSet(o.status)); + }, + isAmino(o: any): o is OperationMetadata_StepAmino { + return o && (o.$typeUrl === OperationMetadata_Step.typeUrl || typeof o.description === "string" && isSet(o.status)); + }, encode(message: OperationMetadata_Step, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.description !== "") { writer.uint32(18).string(message.description); @@ -1318,7 +1353,8 @@ export const OperationMetadata_Step = { typeUrl: "/google.api.servicemanagement.v1.Step", value: OperationMetadata_Step.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseDiagnostic(): Diagnostic { return { @@ -1335,6 +1371,15 @@ function createBaseDiagnostic(): Diagnostic { */ export const Diagnostic = { typeUrl: "/google.api.servicemanagement.v1.Diagnostic", + is(o: any): o is Diagnostic { + return o && (o.$typeUrl === Diagnostic.typeUrl || typeof o.location === "string" && isSet(o.kind) && typeof o.message === "string"); + }, + isSDK(o: any): o is DiagnosticSDKType { + return o && (o.$typeUrl === Diagnostic.typeUrl || typeof o.location === "string" && isSet(o.kind) && typeof o.message === "string"); + }, + isAmino(o: any): o is DiagnosticAmino { + return o && (o.$typeUrl === Diagnostic.typeUrl || typeof o.location === "string" && isSet(o.kind) && typeof o.message === "string"); + }, encode(message: Diagnostic, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.location !== "") { writer.uint32(10).string(message.location); @@ -1429,7 +1474,8 @@ export const Diagnostic = { typeUrl: "/google.api.servicemanagement.v1.Diagnostic", value: Diagnostic.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseConfigSource(): ConfigSource { return { @@ -1446,6 +1492,15 @@ function createBaseConfigSource(): ConfigSource { */ export const ConfigSource = { typeUrl: "/google.api.servicemanagement.v1.ConfigSource", + is(o: any): o is ConfigSource { + return o && (o.$typeUrl === ConfigSource.typeUrl || typeof o.id === "string" && Array.isArray(o.files) && (!o.files.length || ConfigFile.is(o.files[0]))); + }, + isSDK(o: any): o is ConfigSourceSDKType { + return o && (o.$typeUrl === ConfigSource.typeUrl || typeof o.id === "string" && Array.isArray(o.files) && (!o.files.length || ConfigFile.isSDK(o.files[0]))); + }, + isAmino(o: any): o is ConfigSourceAmino { + return o && (o.$typeUrl === ConfigSource.typeUrl || typeof o.id === "string" && Array.isArray(o.files) && (!o.files.length || ConfigFile.isAmino(o.files[0]))); + }, encode(message: ConfigSource, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.id !== "") { writer.uint32(42).string(message.id); @@ -1532,6 +1587,12 @@ export const ConfigSource = { typeUrl: "/google.api.servicemanagement.v1.ConfigSource", value: ConfigSource.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ConfigSource.typeUrl)) { + return; + } + ConfigFile.registerTypeUrl(); } }; function createBaseConfigFile(): ConfigFile { @@ -1549,6 +1610,15 @@ function createBaseConfigFile(): ConfigFile { */ export const ConfigFile = { typeUrl: "/google.api.servicemanagement.v1.ConfigFile", + is(o: any): o is ConfigFile { + return o && (o.$typeUrl === ConfigFile.typeUrl || typeof o.filePath === "string" && (o.fileContents instanceof Uint8Array || typeof o.fileContents === "string") && isSet(o.fileType)); + }, + isSDK(o: any): o is ConfigFileSDKType { + return o && (o.$typeUrl === ConfigFile.typeUrl || typeof o.file_path === "string" && (o.file_contents instanceof Uint8Array || typeof o.file_contents === "string") && isSet(o.file_type)); + }, + isAmino(o: any): o is ConfigFileAmino { + return o && (o.$typeUrl === ConfigFile.typeUrl || typeof o.file_path === "string" && (o.file_contents instanceof Uint8Array || typeof o.file_contents === "string") && isSet(o.file_type)); + }, encode(message: ConfigFile, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.filePath !== "") { writer.uint32(10).string(message.filePath); @@ -1643,7 +1713,8 @@ export const ConfigFile = { typeUrl: "/google.api.servicemanagement.v1.ConfigFile", value: ConfigFile.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseConfigRef(): ConfigRef { return { @@ -1658,6 +1729,15 @@ function createBaseConfigRef(): ConfigRef { */ export const ConfigRef = { typeUrl: "/google.api.servicemanagement.v1.ConfigRef", + is(o: any): o is ConfigRef { + return o && (o.$typeUrl === ConfigRef.typeUrl || typeof o.name === "string"); + }, + isSDK(o: any): o is ConfigRefSDKType { + return o && (o.$typeUrl === ConfigRef.typeUrl || typeof o.name === "string"); + }, + isAmino(o: any): o is ConfigRefAmino { + return o && (o.$typeUrl === ConfigRef.typeUrl || typeof o.name === "string"); + }, encode(message: ConfigRef, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -1724,7 +1804,8 @@ export const ConfigRef = { typeUrl: "/google.api.servicemanagement.v1.ConfigRef", value: ConfigRef.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseChangeReport(): ChangeReport { return { @@ -1742,6 +1823,15 @@ function createBaseChangeReport(): ChangeReport { */ export const ChangeReport = { typeUrl: "/google.api.servicemanagement.v1.ChangeReport", + is(o: any): o is ChangeReport { + return o && (o.$typeUrl === ChangeReport.typeUrl || Array.isArray(o.configChanges) && (!o.configChanges.length || ConfigChange.is(o.configChanges[0]))); + }, + isSDK(o: any): o is ChangeReportSDKType { + return o && (o.$typeUrl === ChangeReport.typeUrl || Array.isArray(o.config_changes) && (!o.config_changes.length || ConfigChange.isSDK(o.config_changes[0]))); + }, + isAmino(o: any): o is ChangeReportAmino { + return o && (o.$typeUrl === ChangeReport.typeUrl || Array.isArray(o.config_changes) && (!o.config_changes.length || ConfigChange.isAmino(o.config_changes[0]))); + }, encode(message: ChangeReport, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.configChanges) { ConfigChange.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -1814,6 +1904,12 @@ export const ChangeReport = { typeUrl: "/google.api.servicemanagement.v1.ChangeReport", value: ChangeReport.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ChangeReport.typeUrl)) { + return; + } + ConfigChange.registerTypeUrl(); } }; function createBaseRollout(): Rollout { @@ -1837,6 +1933,15 @@ function createBaseRollout(): Rollout { */ export const Rollout = { typeUrl: "/google.api.servicemanagement.v1.Rollout", + is(o: any): o is Rollout { + return o && (o.$typeUrl === Rollout.typeUrl || typeof o.rolloutId === "string" && typeof o.createdBy === "string" && isSet(o.status) && typeof o.serviceName === "string"); + }, + isSDK(o: any): o is RolloutSDKType { + return o && (o.$typeUrl === Rollout.typeUrl || typeof o.rollout_id === "string" && typeof o.created_by === "string" && isSet(o.status) && typeof o.service_name === "string"); + }, + isAmino(o: any): o is RolloutAmino { + return o && (o.$typeUrl === Rollout.typeUrl || typeof o.rollout_id === "string" && typeof o.created_by === "string" && isSet(o.status) && typeof o.service_name === "string"); + }, encode(message: Rollout, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.rolloutId !== "") { writer.uint32(10).string(message.rolloutId); @@ -1991,6 +2096,13 @@ export const Rollout = { typeUrl: "/google.api.servicemanagement.v1.Rollout", value: Rollout.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Rollout.typeUrl)) { + return; + } + Rollout_TrafficPercentStrategy.registerTypeUrl(); + Rollout_DeleteServiceStrategy.registerTypeUrl(); } }; function createBaseRollout_TrafficPercentStrategy_PercentagesEntry(): Rollout_TrafficPercentStrategy_PercentagesEntry { @@ -2079,7 +2191,8 @@ export const Rollout_TrafficPercentStrategy_PercentagesEntry = { }, toProto(message: Rollout_TrafficPercentStrategy_PercentagesEntry): Uint8Array { return Rollout_TrafficPercentStrategy_PercentagesEntry.encode(message).finish(); - } + }, + registerTypeUrl() {} }; function createBaseRollout_TrafficPercentStrategy(): Rollout_TrafficPercentStrategy { return { @@ -2123,6 +2236,15 @@ function createBaseRollout_TrafficPercentStrategy(): Rollout_TrafficPercentStrat */ export const Rollout_TrafficPercentStrategy = { typeUrl: "/google.api.servicemanagement.v1.TrafficPercentStrategy", + is(o: any): o is Rollout_TrafficPercentStrategy { + return o && (o.$typeUrl === Rollout_TrafficPercentStrategy.typeUrl || isSet(o.percentages)); + }, + isSDK(o: any): o is Rollout_TrafficPercentStrategySDKType { + return o && (o.$typeUrl === Rollout_TrafficPercentStrategy.typeUrl || isSet(o.percentages)); + }, + isAmino(o: any): o is Rollout_TrafficPercentStrategyAmino { + return o && (o.$typeUrl === Rollout_TrafficPercentStrategy.typeUrl || isSet(o.percentages)); + }, encode(message: Rollout_TrafficPercentStrategy, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { Object.entries(message.percentages).forEach(([key, value]) => { Rollout_TrafficPercentStrategy_PercentagesEntry.encode({ @@ -2227,7 +2349,8 @@ export const Rollout_TrafficPercentStrategy = { typeUrl: "/google.api.servicemanagement.v1.TrafficPercentStrategy", value: Rollout_TrafficPercentStrategy.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseRollout_DeleteServiceStrategy(): Rollout_DeleteServiceStrategy { return {}; @@ -2241,6 +2364,15 @@ function createBaseRollout_DeleteServiceStrategy(): Rollout_DeleteServiceStrateg */ export const Rollout_DeleteServiceStrategy = { typeUrl: "/google.api.servicemanagement.v1.DeleteServiceStrategy", + is(o: any): o is Rollout_DeleteServiceStrategy { + return o && o.$typeUrl === Rollout_DeleteServiceStrategy.typeUrl; + }, + isSDK(o: any): o is Rollout_DeleteServiceStrategySDKType { + return o && o.$typeUrl === Rollout_DeleteServiceStrategy.typeUrl; + }, + isAmino(o: any): o is Rollout_DeleteServiceStrategyAmino { + return o && o.$typeUrl === Rollout_DeleteServiceStrategy.typeUrl; + }, encode(_: Rollout_DeleteServiceStrategy, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -2292,5 +2424,6 @@ export const Rollout_DeleteServiceStrategy = { typeUrl: "/google.api.servicemanagement.v1.DeleteServiceStrategy", value: Rollout_DeleteServiceStrategy.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/google/api/servicemanagement/v1/servicemanager.ts b/__fixtures__/v-next/outputv3/google/api/servicemanagement/v1/servicemanager.ts index e0d2e0d21c..9c38334b0f 100644 --- a/__fixtures__/v-next/outputv3/google/api/servicemanagement/v1/servicemanager.ts +++ b/__fixtures__/v-next/outputv3/google/api/servicemanagement/v1/servicemanager.ts @@ -3,6 +3,7 @@ import { Service, ServiceAmino, ServiceSDKType } from "../../service"; import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../protobuf/any"; import { BinaryReader, BinaryWriter } from "../../../../binary"; import { isSet, DeepPartial } from "../../../../helpers"; +import { GlobalDecoderRegistry } from "../../../../registry"; export const protobufPackage = "google.api.servicemanagement.v1"; export enum GetServiceConfigRequest_ConfigView { /** BASIC - Server response includes all fields except SourceInfo. */ @@ -1049,6 +1050,15 @@ function createBaseListServicesRequest(): ListServicesRequest { */ export const ListServicesRequest = { typeUrl: "/google.api.servicemanagement.v1.ListServicesRequest", + is(o: any): o is ListServicesRequest { + return o && (o.$typeUrl === ListServicesRequest.typeUrl || typeof o.producerProjectId === "string" && typeof o.pageSize === "number" && typeof o.pageToken === "string" && typeof o.consumerId === "string"); + }, + isSDK(o: any): o is ListServicesRequestSDKType { + return o && (o.$typeUrl === ListServicesRequest.typeUrl || typeof o.producer_project_id === "string" && typeof o.page_size === "number" && typeof o.page_token === "string" && typeof o.consumer_id === "string"); + }, + isAmino(o: any): o is ListServicesRequestAmino { + return o && (o.$typeUrl === ListServicesRequest.typeUrl || typeof o.producer_project_id === "string" && typeof o.page_size === "number" && typeof o.page_token === "string" && typeof o.consumer_id === "string"); + }, encode(message: ListServicesRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.producerProjectId !== "") { writer.uint32(10).string(message.producerProjectId); @@ -1157,7 +1167,8 @@ export const ListServicesRequest = { typeUrl: "/google.api.servicemanagement.v1.ListServicesRequest", value: ListServicesRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseListServicesResponse(): ListServicesResponse { return { @@ -1173,6 +1184,15 @@ function createBaseListServicesResponse(): ListServicesResponse { */ export const ListServicesResponse = { typeUrl: "/google.api.servicemanagement.v1.ListServicesResponse", + is(o: any): o is ListServicesResponse { + return o && (o.$typeUrl === ListServicesResponse.typeUrl || Array.isArray(o.services) && (!o.services.length || ManagedService.is(o.services[0])) && typeof o.nextPageToken === "string"); + }, + isSDK(o: any): o is ListServicesResponseSDKType { + return o && (o.$typeUrl === ListServicesResponse.typeUrl || Array.isArray(o.services) && (!o.services.length || ManagedService.isSDK(o.services[0])) && typeof o.next_page_token === "string"); + }, + isAmino(o: any): o is ListServicesResponseAmino { + return o && (o.$typeUrl === ListServicesResponse.typeUrl || Array.isArray(o.services) && (!o.services.length || ManagedService.isAmino(o.services[0])) && typeof o.next_page_token === "string"); + }, encode(message: ListServicesResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.services) { ManagedService.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -1259,6 +1279,12 @@ export const ListServicesResponse = { typeUrl: "/google.api.servicemanagement.v1.ListServicesResponse", value: ListServicesResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ListServicesResponse.typeUrl)) { + return; + } + ManagedService.registerTypeUrl(); } }; function createBaseGetServiceRequest(): GetServiceRequest { @@ -1274,6 +1300,15 @@ function createBaseGetServiceRequest(): GetServiceRequest { */ export const GetServiceRequest = { typeUrl: "/google.api.servicemanagement.v1.GetServiceRequest", + is(o: any): o is GetServiceRequest { + return o && (o.$typeUrl === GetServiceRequest.typeUrl || typeof o.serviceName === "string"); + }, + isSDK(o: any): o is GetServiceRequestSDKType { + return o && (o.$typeUrl === GetServiceRequest.typeUrl || typeof o.service_name === "string"); + }, + isAmino(o: any): o is GetServiceRequestAmino { + return o && (o.$typeUrl === GetServiceRequest.typeUrl || typeof o.service_name === "string"); + }, encode(message: GetServiceRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.serviceName !== "") { writer.uint32(10).string(message.serviceName); @@ -1340,7 +1375,8 @@ export const GetServiceRequest = { typeUrl: "/google.api.servicemanagement.v1.GetServiceRequest", value: GetServiceRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseCreateServiceRequest(): CreateServiceRequest { return { @@ -1355,6 +1391,15 @@ function createBaseCreateServiceRequest(): CreateServiceRequest { */ export const CreateServiceRequest = { typeUrl: "/google.api.servicemanagement.v1.CreateServiceRequest", + is(o: any): o is CreateServiceRequest { + return o && o.$typeUrl === CreateServiceRequest.typeUrl; + }, + isSDK(o: any): o is CreateServiceRequestSDKType { + return o && o.$typeUrl === CreateServiceRequest.typeUrl; + }, + isAmino(o: any): o is CreateServiceRequestAmino { + return o && o.$typeUrl === CreateServiceRequest.typeUrl; + }, encode(message: CreateServiceRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.service !== undefined) { ManagedService.encode(message.service, writer.uint32(10).fork()).ldelim(); @@ -1423,6 +1468,12 @@ export const CreateServiceRequest = { typeUrl: "/google.api.servicemanagement.v1.CreateServiceRequest", value: CreateServiceRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(CreateServiceRequest.typeUrl)) { + return; + } + ManagedService.registerTypeUrl(); } }; function createBaseDeleteServiceRequest(): DeleteServiceRequest { @@ -1438,6 +1489,15 @@ function createBaseDeleteServiceRequest(): DeleteServiceRequest { */ export const DeleteServiceRequest = { typeUrl: "/google.api.servicemanagement.v1.DeleteServiceRequest", + is(o: any): o is DeleteServiceRequest { + return o && (o.$typeUrl === DeleteServiceRequest.typeUrl || typeof o.serviceName === "string"); + }, + isSDK(o: any): o is DeleteServiceRequestSDKType { + return o && (o.$typeUrl === DeleteServiceRequest.typeUrl || typeof o.service_name === "string"); + }, + isAmino(o: any): o is DeleteServiceRequestAmino { + return o && (o.$typeUrl === DeleteServiceRequest.typeUrl || typeof o.service_name === "string"); + }, encode(message: DeleteServiceRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.serviceName !== "") { writer.uint32(10).string(message.serviceName); @@ -1504,7 +1564,8 @@ export const DeleteServiceRequest = { typeUrl: "/google.api.servicemanagement.v1.DeleteServiceRequest", value: DeleteServiceRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseUndeleteServiceRequest(): UndeleteServiceRequest { return { @@ -1519,6 +1580,15 @@ function createBaseUndeleteServiceRequest(): UndeleteServiceRequest { */ export const UndeleteServiceRequest = { typeUrl: "/google.api.servicemanagement.v1.UndeleteServiceRequest", + is(o: any): o is UndeleteServiceRequest { + return o && (o.$typeUrl === UndeleteServiceRequest.typeUrl || typeof o.serviceName === "string"); + }, + isSDK(o: any): o is UndeleteServiceRequestSDKType { + return o && (o.$typeUrl === UndeleteServiceRequest.typeUrl || typeof o.service_name === "string"); + }, + isAmino(o: any): o is UndeleteServiceRequestAmino { + return o && (o.$typeUrl === UndeleteServiceRequest.typeUrl || typeof o.service_name === "string"); + }, encode(message: UndeleteServiceRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.serviceName !== "") { writer.uint32(10).string(message.serviceName); @@ -1585,7 +1655,8 @@ export const UndeleteServiceRequest = { typeUrl: "/google.api.servicemanagement.v1.UndeleteServiceRequest", value: UndeleteServiceRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseUndeleteServiceResponse(): UndeleteServiceResponse { return { @@ -1600,6 +1671,15 @@ function createBaseUndeleteServiceResponse(): UndeleteServiceResponse { */ export const UndeleteServiceResponse = { typeUrl: "/google.api.servicemanagement.v1.UndeleteServiceResponse", + is(o: any): o is UndeleteServiceResponse { + return o && o.$typeUrl === UndeleteServiceResponse.typeUrl; + }, + isSDK(o: any): o is UndeleteServiceResponseSDKType { + return o && o.$typeUrl === UndeleteServiceResponse.typeUrl; + }, + isAmino(o: any): o is UndeleteServiceResponseAmino { + return o && o.$typeUrl === UndeleteServiceResponse.typeUrl; + }, encode(message: UndeleteServiceResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.service !== undefined) { ManagedService.encode(message.service, writer.uint32(10).fork()).ldelim(); @@ -1668,6 +1748,12 @@ export const UndeleteServiceResponse = { typeUrl: "/google.api.servicemanagement.v1.UndeleteServiceResponse", value: UndeleteServiceResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(UndeleteServiceResponse.typeUrl)) { + return; + } + ManagedService.registerTypeUrl(); } }; function createBaseGetServiceConfigRequest(): GetServiceConfigRequest { @@ -1685,6 +1771,15 @@ function createBaseGetServiceConfigRequest(): GetServiceConfigRequest { */ export const GetServiceConfigRequest = { typeUrl: "/google.api.servicemanagement.v1.GetServiceConfigRequest", + is(o: any): o is GetServiceConfigRequest { + return o && (o.$typeUrl === GetServiceConfigRequest.typeUrl || typeof o.serviceName === "string" && typeof o.configId === "string" && isSet(o.view)); + }, + isSDK(o: any): o is GetServiceConfigRequestSDKType { + return o && (o.$typeUrl === GetServiceConfigRequest.typeUrl || typeof o.service_name === "string" && typeof o.config_id === "string" && isSet(o.view)); + }, + isAmino(o: any): o is GetServiceConfigRequestAmino { + return o && (o.$typeUrl === GetServiceConfigRequest.typeUrl || typeof o.service_name === "string" && typeof o.config_id === "string" && isSet(o.view)); + }, encode(message: GetServiceConfigRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.serviceName !== "") { writer.uint32(10).string(message.serviceName); @@ -1779,7 +1874,8 @@ export const GetServiceConfigRequest = { typeUrl: "/google.api.servicemanagement.v1.GetServiceConfigRequest", value: GetServiceConfigRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseListServiceConfigsRequest(): ListServiceConfigsRequest { return { @@ -1796,6 +1892,15 @@ function createBaseListServiceConfigsRequest(): ListServiceConfigsRequest { */ export const ListServiceConfigsRequest = { typeUrl: "/google.api.servicemanagement.v1.ListServiceConfigsRequest", + is(o: any): o is ListServiceConfigsRequest { + return o && (o.$typeUrl === ListServiceConfigsRequest.typeUrl || typeof o.serviceName === "string" && typeof o.pageToken === "string" && typeof o.pageSize === "number"); + }, + isSDK(o: any): o is ListServiceConfigsRequestSDKType { + return o && (o.$typeUrl === ListServiceConfigsRequest.typeUrl || typeof o.service_name === "string" && typeof o.page_token === "string" && typeof o.page_size === "number"); + }, + isAmino(o: any): o is ListServiceConfigsRequestAmino { + return o && (o.$typeUrl === ListServiceConfigsRequest.typeUrl || typeof o.service_name === "string" && typeof o.page_token === "string" && typeof o.page_size === "number"); + }, encode(message: ListServiceConfigsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.serviceName !== "") { writer.uint32(10).string(message.serviceName); @@ -1890,7 +1995,8 @@ export const ListServiceConfigsRequest = { typeUrl: "/google.api.servicemanagement.v1.ListServiceConfigsRequest", value: ListServiceConfigsRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseListServiceConfigsResponse(): ListServiceConfigsResponse { return { @@ -1906,6 +2012,15 @@ function createBaseListServiceConfigsResponse(): ListServiceConfigsResponse { */ export const ListServiceConfigsResponse = { typeUrl: "/google.api.servicemanagement.v1.ListServiceConfigsResponse", + is(o: any): o is ListServiceConfigsResponse { + return o && (o.$typeUrl === ListServiceConfigsResponse.typeUrl || Array.isArray(o.serviceConfigs) && (!o.serviceConfigs.length || Service.is(o.serviceConfigs[0])) && typeof o.nextPageToken === "string"); + }, + isSDK(o: any): o is ListServiceConfigsResponseSDKType { + return o && (o.$typeUrl === ListServiceConfigsResponse.typeUrl || Array.isArray(o.service_configs) && (!o.service_configs.length || Service.isSDK(o.service_configs[0])) && typeof o.next_page_token === "string"); + }, + isAmino(o: any): o is ListServiceConfigsResponseAmino { + return o && (o.$typeUrl === ListServiceConfigsResponse.typeUrl || Array.isArray(o.service_configs) && (!o.service_configs.length || Service.isAmino(o.service_configs[0])) && typeof o.next_page_token === "string"); + }, encode(message: ListServiceConfigsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.serviceConfigs) { Service.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -1992,6 +2107,12 @@ export const ListServiceConfigsResponse = { typeUrl: "/google.api.servicemanagement.v1.ListServiceConfigsResponse", value: ListServiceConfigsResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ListServiceConfigsResponse.typeUrl)) { + return; + } + Service.registerTypeUrl(); } }; function createBaseCreateServiceConfigRequest(): CreateServiceConfigRequest { @@ -2008,6 +2129,15 @@ function createBaseCreateServiceConfigRequest(): CreateServiceConfigRequest { */ export const CreateServiceConfigRequest = { typeUrl: "/google.api.servicemanagement.v1.CreateServiceConfigRequest", + is(o: any): o is CreateServiceConfigRequest { + return o && (o.$typeUrl === CreateServiceConfigRequest.typeUrl || typeof o.serviceName === "string"); + }, + isSDK(o: any): o is CreateServiceConfigRequestSDKType { + return o && (o.$typeUrl === CreateServiceConfigRequest.typeUrl || typeof o.service_name === "string"); + }, + isAmino(o: any): o is CreateServiceConfigRequestAmino { + return o && (o.$typeUrl === CreateServiceConfigRequest.typeUrl || typeof o.service_name === "string"); + }, encode(message: CreateServiceConfigRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.serviceName !== "") { writer.uint32(10).string(message.serviceName); @@ -2090,6 +2220,12 @@ export const CreateServiceConfigRequest = { typeUrl: "/google.api.servicemanagement.v1.CreateServiceConfigRequest", value: CreateServiceConfigRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(CreateServiceConfigRequest.typeUrl)) { + return; + } + Service.registerTypeUrl(); } }; function createBaseSubmitConfigSourceRequest(): SubmitConfigSourceRequest { @@ -2107,6 +2243,15 @@ function createBaseSubmitConfigSourceRequest(): SubmitConfigSourceRequest { */ export const SubmitConfigSourceRequest = { typeUrl: "/google.api.servicemanagement.v1.SubmitConfigSourceRequest", + is(o: any): o is SubmitConfigSourceRequest { + return o && (o.$typeUrl === SubmitConfigSourceRequest.typeUrl || typeof o.serviceName === "string" && typeof o.validateOnly === "boolean"); + }, + isSDK(o: any): o is SubmitConfigSourceRequestSDKType { + return o && (o.$typeUrl === SubmitConfigSourceRequest.typeUrl || typeof o.service_name === "string" && typeof o.validate_only === "boolean"); + }, + isAmino(o: any): o is SubmitConfigSourceRequestAmino { + return o && (o.$typeUrl === SubmitConfigSourceRequest.typeUrl || typeof o.service_name === "string" && typeof o.validate_only === "boolean"); + }, encode(message: SubmitConfigSourceRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.serviceName !== "") { writer.uint32(10).string(message.serviceName); @@ -2203,6 +2348,12 @@ export const SubmitConfigSourceRequest = { typeUrl: "/google.api.servicemanagement.v1.SubmitConfigSourceRequest", value: SubmitConfigSourceRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(SubmitConfigSourceRequest.typeUrl)) { + return; + } + ConfigSource.registerTypeUrl(); } }; function createBaseSubmitConfigSourceResponse(): SubmitConfigSourceResponse { @@ -2218,6 +2369,15 @@ function createBaseSubmitConfigSourceResponse(): SubmitConfigSourceResponse { */ export const SubmitConfigSourceResponse = { typeUrl: "/google.api.servicemanagement.v1.SubmitConfigSourceResponse", + is(o: any): o is SubmitConfigSourceResponse { + return o && o.$typeUrl === SubmitConfigSourceResponse.typeUrl; + }, + isSDK(o: any): o is SubmitConfigSourceResponseSDKType { + return o && o.$typeUrl === SubmitConfigSourceResponse.typeUrl; + }, + isAmino(o: any): o is SubmitConfigSourceResponseAmino { + return o && o.$typeUrl === SubmitConfigSourceResponse.typeUrl; + }, encode(message: SubmitConfigSourceResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.serviceConfig !== undefined) { Service.encode(message.serviceConfig, writer.uint32(10).fork()).ldelim(); @@ -2286,6 +2446,12 @@ export const SubmitConfigSourceResponse = { typeUrl: "/google.api.servicemanagement.v1.SubmitConfigSourceResponse", value: SubmitConfigSourceResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(SubmitConfigSourceResponse.typeUrl)) { + return; + } + Service.registerTypeUrl(); } }; function createBaseCreateServiceRolloutRequest(): CreateServiceRolloutRequest { @@ -2302,6 +2468,15 @@ function createBaseCreateServiceRolloutRequest(): CreateServiceRolloutRequest { */ export const CreateServiceRolloutRequest = { typeUrl: "/google.api.servicemanagement.v1.CreateServiceRolloutRequest", + is(o: any): o is CreateServiceRolloutRequest { + return o && (o.$typeUrl === CreateServiceRolloutRequest.typeUrl || typeof o.serviceName === "string"); + }, + isSDK(o: any): o is CreateServiceRolloutRequestSDKType { + return o && (o.$typeUrl === CreateServiceRolloutRequest.typeUrl || typeof o.service_name === "string"); + }, + isAmino(o: any): o is CreateServiceRolloutRequestAmino { + return o && (o.$typeUrl === CreateServiceRolloutRequest.typeUrl || typeof o.service_name === "string"); + }, encode(message: CreateServiceRolloutRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.serviceName !== "") { writer.uint32(10).string(message.serviceName); @@ -2384,6 +2559,12 @@ export const CreateServiceRolloutRequest = { typeUrl: "/google.api.servicemanagement.v1.CreateServiceRolloutRequest", value: CreateServiceRolloutRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(CreateServiceRolloutRequest.typeUrl)) { + return; + } + Rollout.registerTypeUrl(); } }; function createBaseListServiceRolloutsRequest(): ListServiceRolloutsRequest { @@ -2402,6 +2583,15 @@ function createBaseListServiceRolloutsRequest(): ListServiceRolloutsRequest { */ export const ListServiceRolloutsRequest = { typeUrl: "/google.api.servicemanagement.v1.ListServiceRolloutsRequest", + is(o: any): o is ListServiceRolloutsRequest { + return o && (o.$typeUrl === ListServiceRolloutsRequest.typeUrl || typeof o.serviceName === "string" && typeof o.pageToken === "string" && typeof o.pageSize === "number" && typeof o.filter === "string"); + }, + isSDK(o: any): o is ListServiceRolloutsRequestSDKType { + return o && (o.$typeUrl === ListServiceRolloutsRequest.typeUrl || typeof o.service_name === "string" && typeof o.page_token === "string" && typeof o.page_size === "number" && typeof o.filter === "string"); + }, + isAmino(o: any): o is ListServiceRolloutsRequestAmino { + return o && (o.$typeUrl === ListServiceRolloutsRequest.typeUrl || typeof o.service_name === "string" && typeof o.page_token === "string" && typeof o.page_size === "number" && typeof o.filter === "string"); + }, encode(message: ListServiceRolloutsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.serviceName !== "") { writer.uint32(10).string(message.serviceName); @@ -2510,7 +2700,8 @@ export const ListServiceRolloutsRequest = { typeUrl: "/google.api.servicemanagement.v1.ListServiceRolloutsRequest", value: ListServiceRolloutsRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseListServiceRolloutsResponse(): ListServiceRolloutsResponse { return { @@ -2526,6 +2717,15 @@ function createBaseListServiceRolloutsResponse(): ListServiceRolloutsResponse { */ export const ListServiceRolloutsResponse = { typeUrl: "/google.api.servicemanagement.v1.ListServiceRolloutsResponse", + is(o: any): o is ListServiceRolloutsResponse { + return o && (o.$typeUrl === ListServiceRolloutsResponse.typeUrl || Array.isArray(o.rollouts) && (!o.rollouts.length || Rollout.is(o.rollouts[0])) && typeof o.nextPageToken === "string"); + }, + isSDK(o: any): o is ListServiceRolloutsResponseSDKType { + return o && (o.$typeUrl === ListServiceRolloutsResponse.typeUrl || Array.isArray(o.rollouts) && (!o.rollouts.length || Rollout.isSDK(o.rollouts[0])) && typeof o.next_page_token === "string"); + }, + isAmino(o: any): o is ListServiceRolloutsResponseAmino { + return o && (o.$typeUrl === ListServiceRolloutsResponse.typeUrl || Array.isArray(o.rollouts) && (!o.rollouts.length || Rollout.isAmino(o.rollouts[0])) && typeof o.next_page_token === "string"); + }, encode(message: ListServiceRolloutsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.rollouts) { Rollout.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -2612,6 +2812,12 @@ export const ListServiceRolloutsResponse = { typeUrl: "/google.api.servicemanagement.v1.ListServiceRolloutsResponse", value: ListServiceRolloutsResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ListServiceRolloutsResponse.typeUrl)) { + return; + } + Rollout.registerTypeUrl(); } }; function createBaseGetServiceRolloutRequest(): GetServiceRolloutRequest { @@ -2628,6 +2834,15 @@ function createBaseGetServiceRolloutRequest(): GetServiceRolloutRequest { */ export const GetServiceRolloutRequest = { typeUrl: "/google.api.servicemanagement.v1.GetServiceRolloutRequest", + is(o: any): o is GetServiceRolloutRequest { + return o && (o.$typeUrl === GetServiceRolloutRequest.typeUrl || typeof o.serviceName === "string" && typeof o.rolloutId === "string"); + }, + isSDK(o: any): o is GetServiceRolloutRequestSDKType { + return o && (o.$typeUrl === GetServiceRolloutRequest.typeUrl || typeof o.service_name === "string" && typeof o.rollout_id === "string"); + }, + isAmino(o: any): o is GetServiceRolloutRequestAmino { + return o && (o.$typeUrl === GetServiceRolloutRequest.typeUrl || typeof o.service_name === "string" && typeof o.rollout_id === "string"); + }, encode(message: GetServiceRolloutRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.serviceName !== "") { writer.uint32(10).string(message.serviceName); @@ -2708,7 +2923,8 @@ export const GetServiceRolloutRequest = { typeUrl: "/google.api.servicemanagement.v1.GetServiceRolloutRequest", value: GetServiceRolloutRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseGenerateConfigReportRequest(): GenerateConfigReportRequest { return { @@ -2724,6 +2940,15 @@ function createBaseGenerateConfigReportRequest(): GenerateConfigReportRequest { */ export const GenerateConfigReportRequest = { typeUrl: "/google.api.servicemanagement.v1.GenerateConfigReportRequest", + is(o: any): o is GenerateConfigReportRequest { + return o && o.$typeUrl === GenerateConfigReportRequest.typeUrl; + }, + isSDK(o: any): o is GenerateConfigReportRequestSDKType { + return o && o.$typeUrl === GenerateConfigReportRequest.typeUrl; + }, + isAmino(o: any): o is GenerateConfigReportRequestAmino { + return o && o.$typeUrl === GenerateConfigReportRequest.typeUrl; + }, encode(message: GenerateConfigReportRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.newConfig !== undefined) { Any.encode(message.newConfig, writer.uint32(10).fork()).ldelim(); @@ -2808,7 +3033,8 @@ export const GenerateConfigReportRequest = { typeUrl: "/google.api.servicemanagement.v1.GenerateConfigReportRequest", value: GenerateConfigReportRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseGenerateConfigReportResponse(): GenerateConfigReportResponse { return { @@ -2826,6 +3052,15 @@ function createBaseGenerateConfigReportResponse(): GenerateConfigReportResponse */ export const GenerateConfigReportResponse = { typeUrl: "/google.api.servicemanagement.v1.GenerateConfigReportResponse", + is(o: any): o is GenerateConfigReportResponse { + return o && (o.$typeUrl === GenerateConfigReportResponse.typeUrl || typeof o.serviceName === "string" && typeof o.id === "string" && Array.isArray(o.changeReports) && (!o.changeReports.length || ChangeReport.is(o.changeReports[0])) && Array.isArray(o.diagnostics) && (!o.diagnostics.length || Diagnostic.is(o.diagnostics[0]))); + }, + isSDK(o: any): o is GenerateConfigReportResponseSDKType { + return o && (o.$typeUrl === GenerateConfigReportResponse.typeUrl || typeof o.service_name === "string" && typeof o.id === "string" && Array.isArray(o.change_reports) && (!o.change_reports.length || ChangeReport.isSDK(o.change_reports[0])) && Array.isArray(o.diagnostics) && (!o.diagnostics.length || Diagnostic.isSDK(o.diagnostics[0]))); + }, + isAmino(o: any): o is GenerateConfigReportResponseAmino { + return o && (o.$typeUrl === GenerateConfigReportResponse.typeUrl || typeof o.service_name === "string" && typeof o.id === "string" && Array.isArray(o.change_reports) && (!o.change_reports.length || ChangeReport.isAmino(o.change_reports[0])) && Array.isArray(o.diagnostics) && (!o.diagnostics.length || Diagnostic.isAmino(o.diagnostics[0]))); + }, encode(message: GenerateConfigReportResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.serviceName !== "") { writer.uint32(10).string(message.serviceName); @@ -2946,5 +3181,12 @@ export const GenerateConfigReportResponse = { typeUrl: "/google.api.servicemanagement.v1.GenerateConfigReportResponse", value: GenerateConfigReportResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GenerateConfigReportResponse.typeUrl)) { + return; + } + ChangeReport.registerTypeUrl(); + Diagnostic.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/google/api/serviceusage/v1/resources.ts b/__fixtures__/v-next/outputv3/google/api/serviceusage/v1/resources.ts index f3f1c97902..7c0f949d32 100644 --- a/__fixtures__/v-next/outputv3/google/api/serviceusage/v1/resources.ts +++ b/__fixtures__/v-next/outputv3/google/api/serviceusage/v1/resources.ts @@ -6,8 +6,9 @@ import { Usage, UsageAmino, UsageSDKType } from "../../usage"; import { Endpoint, EndpointAmino, EndpointSDKType } from "../../endpoint"; import { MonitoredResourceDescriptor, MonitoredResourceDescriptorAmino, MonitoredResourceDescriptorSDKType } from "../../monitored_resource"; import { Monitoring, MonitoringAmino, MonitoringSDKType } from "../../monitoring"; -import { BinaryReader, BinaryWriter } from "../../../../binary"; import { isSet, DeepPartial } from "../../../../helpers"; +import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { GlobalDecoderRegistry } from "../../../../registry"; export const protobufPackage = "google.api.serviceusage.v1"; /** Whether or not a service has been enabled for use by a consumer. */ export enum State { @@ -329,6 +330,15 @@ function createBaseService(): Service { */ export const Service = { typeUrl: "/google.api.serviceusage.v1.Service", + is(o: any): o is Service { + return o && (o.$typeUrl === Service.typeUrl || typeof o.name === "string" && typeof o.parent === "string" && isSet(o.state)); + }, + isSDK(o: any): o is ServiceSDKType { + return o && (o.$typeUrl === Service.typeUrl || typeof o.name === "string" && typeof o.parent === "string" && isSet(o.state)); + }, + isAmino(o: any): o is ServiceAmino { + return o && (o.$typeUrl === Service.typeUrl || typeof o.name === "string" && typeof o.parent === "string" && isSet(o.state)); + }, encode(message: Service, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -439,6 +449,12 @@ export const Service = { typeUrl: "/google.api.serviceusage.v1.Service", value: Service.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Service.typeUrl)) { + return; + } + ServiceConfig.registerTypeUrl(); } }; function createBaseServiceConfig(): ServiceConfig { @@ -463,6 +479,15 @@ function createBaseServiceConfig(): ServiceConfig { */ export const ServiceConfig = { typeUrl: "/google.api.serviceusage.v1.ServiceConfig", + is(o: any): o is ServiceConfig { + return o && (o.$typeUrl === ServiceConfig.typeUrl || typeof o.name === "string" && typeof o.title === "string" && Array.isArray(o.apis) && (!o.apis.length || Api.is(o.apis[0])) && Array.isArray(o.endpoints) && (!o.endpoints.length || Endpoint.is(o.endpoints[0])) && Array.isArray(o.monitoredResources) && (!o.monitoredResources.length || MonitoredResourceDescriptor.is(o.monitoredResources[0]))); + }, + isSDK(o: any): o is ServiceConfigSDKType { + return o && (o.$typeUrl === ServiceConfig.typeUrl || typeof o.name === "string" && typeof o.title === "string" && Array.isArray(o.apis) && (!o.apis.length || Api.isSDK(o.apis[0])) && Array.isArray(o.endpoints) && (!o.endpoints.length || Endpoint.isSDK(o.endpoints[0])) && Array.isArray(o.monitored_resources) && (!o.monitored_resources.length || MonitoredResourceDescriptor.isSDK(o.monitored_resources[0]))); + }, + isAmino(o: any): o is ServiceConfigAmino { + return o && (o.$typeUrl === ServiceConfig.typeUrl || typeof o.name === "string" && typeof o.title === "string" && Array.isArray(o.apis) && (!o.apis.length || Api.isAmino(o.apis[0])) && Array.isArray(o.endpoints) && (!o.endpoints.length || Endpoint.isAmino(o.endpoints[0])) && Array.isArray(o.monitored_resources) && (!o.monitored_resources.length || MonitoredResourceDescriptor.isAmino(o.monitored_resources[0]))); + }, encode(message: ServiceConfig, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -683,6 +708,19 @@ export const ServiceConfig = { typeUrl: "/google.api.serviceusage.v1.ServiceConfig", value: ServiceConfig.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ServiceConfig.typeUrl)) { + return; + } + Api.registerTypeUrl(); + Documentation.registerTypeUrl(); + Quota.registerTypeUrl(); + Authentication.registerTypeUrl(); + Usage.registerTypeUrl(); + Endpoint.registerTypeUrl(); + MonitoredResourceDescriptor.registerTypeUrl(); + Monitoring.registerTypeUrl(); } }; function createBaseOperationMetadata(): OperationMetadata { @@ -698,6 +736,15 @@ function createBaseOperationMetadata(): OperationMetadata { */ export const OperationMetadata = { typeUrl: "/google.api.serviceusage.v1.OperationMetadata", + is(o: any): o is OperationMetadata { + return o && (o.$typeUrl === OperationMetadata.typeUrl || Array.isArray(o.resourceNames) && (!o.resourceNames.length || typeof o.resourceNames[0] === "string")); + }, + isSDK(o: any): o is OperationMetadataSDKType { + return o && (o.$typeUrl === OperationMetadata.typeUrl || Array.isArray(o.resource_names) && (!o.resource_names.length || typeof o.resource_names[0] === "string")); + }, + isAmino(o: any): o is OperationMetadataAmino { + return o && (o.$typeUrl === OperationMetadata.typeUrl || Array.isArray(o.resource_names) && (!o.resource_names.length || typeof o.resource_names[0] === "string")); + }, encode(message: OperationMetadata, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.resourceNames) { writer.uint32(18).string(v!); @@ -770,5 +817,6 @@ export const OperationMetadata = { typeUrl: "/google.api.serviceusage.v1.OperationMetadata", value: OperationMetadata.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/google/api/serviceusage/v1/serviceusage.ts b/__fixtures__/v-next/outputv3/google/api/serviceusage/v1/serviceusage.ts index 29861cc1de..319e9c97c2 100644 --- a/__fixtures__/v-next/outputv3/google/api/serviceusage/v1/serviceusage.ts +++ b/__fixtures__/v-next/outputv3/google/api/serviceusage/v1/serviceusage.ts @@ -1,6 +1,7 @@ import { Service, ServiceAmino, ServiceSDKType } from "./resources"; import { BinaryReader, BinaryWriter } from "../../../../binary"; import { isSet, DeepPartial } from "../../../../helpers"; +import { GlobalDecoderRegistry } from "../../../../registry"; export const protobufPackage = "google.api.serviceusage.v1"; /** * Enum to determine if service usage should be checked when disabling a @@ -730,6 +731,15 @@ function createBaseEnableServiceRequest(): EnableServiceRequest { */ export const EnableServiceRequest = { typeUrl: "/google.api.serviceusage.v1.EnableServiceRequest", + is(o: any): o is EnableServiceRequest { + return o && (o.$typeUrl === EnableServiceRequest.typeUrl || typeof o.name === "string"); + }, + isSDK(o: any): o is EnableServiceRequestSDKType { + return o && (o.$typeUrl === EnableServiceRequest.typeUrl || typeof o.name === "string"); + }, + isAmino(o: any): o is EnableServiceRequestAmino { + return o && (o.$typeUrl === EnableServiceRequest.typeUrl || typeof o.name === "string"); + }, encode(message: EnableServiceRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -796,7 +806,8 @@ export const EnableServiceRequest = { typeUrl: "/google.api.serviceusage.v1.EnableServiceRequest", value: EnableServiceRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseEnableServiceResponse(): EnableServiceResponse { return { @@ -813,6 +824,15 @@ function createBaseEnableServiceResponse(): EnableServiceResponse { */ export const EnableServiceResponse = { typeUrl: "/google.api.serviceusage.v1.EnableServiceResponse", + is(o: any): o is EnableServiceResponse { + return o && o.$typeUrl === EnableServiceResponse.typeUrl; + }, + isSDK(o: any): o is EnableServiceResponseSDKType { + return o && o.$typeUrl === EnableServiceResponse.typeUrl; + }, + isAmino(o: any): o is EnableServiceResponseAmino { + return o && o.$typeUrl === EnableServiceResponse.typeUrl; + }, encode(message: EnableServiceResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.service !== undefined) { Service.encode(message.service, writer.uint32(10).fork()).ldelim(); @@ -881,6 +901,12 @@ export const EnableServiceResponse = { typeUrl: "/google.api.serviceusage.v1.EnableServiceResponse", value: EnableServiceResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(EnableServiceResponse.typeUrl)) { + return; + } + Service.registerTypeUrl(); } }; function createBaseDisableServiceRequest(): DisableServiceRequest { @@ -898,6 +924,15 @@ function createBaseDisableServiceRequest(): DisableServiceRequest { */ export const DisableServiceRequest = { typeUrl: "/google.api.serviceusage.v1.DisableServiceRequest", + is(o: any): o is DisableServiceRequest { + return o && (o.$typeUrl === DisableServiceRequest.typeUrl || typeof o.name === "string" && typeof o.disableDependentServices === "boolean" && isSet(o.checkIfServiceHasUsage)); + }, + isSDK(o: any): o is DisableServiceRequestSDKType { + return o && (o.$typeUrl === DisableServiceRequest.typeUrl || typeof o.name === "string" && typeof o.disable_dependent_services === "boolean" && isSet(o.check_if_service_has_usage)); + }, + isAmino(o: any): o is DisableServiceRequestAmino { + return o && (o.$typeUrl === DisableServiceRequest.typeUrl || typeof o.name === "string" && typeof o.disable_dependent_services === "boolean" && isSet(o.check_if_service_has_usage)); + }, encode(message: DisableServiceRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -992,7 +1027,8 @@ export const DisableServiceRequest = { typeUrl: "/google.api.serviceusage.v1.DisableServiceRequest", value: DisableServiceRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseDisableServiceResponse(): DisableServiceResponse { return { @@ -1009,6 +1045,15 @@ function createBaseDisableServiceResponse(): DisableServiceResponse { */ export const DisableServiceResponse = { typeUrl: "/google.api.serviceusage.v1.DisableServiceResponse", + is(o: any): o is DisableServiceResponse { + return o && o.$typeUrl === DisableServiceResponse.typeUrl; + }, + isSDK(o: any): o is DisableServiceResponseSDKType { + return o && o.$typeUrl === DisableServiceResponse.typeUrl; + }, + isAmino(o: any): o is DisableServiceResponseAmino { + return o && o.$typeUrl === DisableServiceResponse.typeUrl; + }, encode(message: DisableServiceResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.service !== undefined) { Service.encode(message.service, writer.uint32(10).fork()).ldelim(); @@ -1077,6 +1122,12 @@ export const DisableServiceResponse = { typeUrl: "/google.api.serviceusage.v1.DisableServiceResponse", value: DisableServiceResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(DisableServiceResponse.typeUrl)) { + return; + } + Service.registerTypeUrl(); } }; function createBaseGetServiceRequest(): GetServiceRequest { @@ -1092,6 +1143,15 @@ function createBaseGetServiceRequest(): GetServiceRequest { */ export const GetServiceRequest = { typeUrl: "/google.api.serviceusage.v1.GetServiceRequest", + is(o: any): o is GetServiceRequest { + return o && (o.$typeUrl === GetServiceRequest.typeUrl || typeof o.name === "string"); + }, + isSDK(o: any): o is GetServiceRequestSDKType { + return o && (o.$typeUrl === GetServiceRequest.typeUrl || typeof o.name === "string"); + }, + isAmino(o: any): o is GetServiceRequestAmino { + return o && (o.$typeUrl === GetServiceRequest.typeUrl || typeof o.name === "string"); + }, encode(message: GetServiceRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -1158,7 +1218,8 @@ export const GetServiceRequest = { typeUrl: "/google.api.serviceusage.v1.GetServiceRequest", value: GetServiceRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseListServicesRequest(): ListServicesRequest { return { @@ -1176,6 +1237,15 @@ function createBaseListServicesRequest(): ListServicesRequest { */ export const ListServicesRequest = { typeUrl: "/google.api.serviceusage.v1.ListServicesRequest", + is(o: any): o is ListServicesRequest { + return o && (o.$typeUrl === ListServicesRequest.typeUrl || typeof o.parent === "string" && typeof o.pageSize === "number" && typeof o.pageToken === "string" && typeof o.filter === "string"); + }, + isSDK(o: any): o is ListServicesRequestSDKType { + return o && (o.$typeUrl === ListServicesRequest.typeUrl || typeof o.parent === "string" && typeof o.page_size === "number" && typeof o.page_token === "string" && typeof o.filter === "string"); + }, + isAmino(o: any): o is ListServicesRequestAmino { + return o && (o.$typeUrl === ListServicesRequest.typeUrl || typeof o.parent === "string" && typeof o.page_size === "number" && typeof o.page_token === "string" && typeof o.filter === "string"); + }, encode(message: ListServicesRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.parent !== "") { writer.uint32(10).string(message.parent); @@ -1284,7 +1354,8 @@ export const ListServicesRequest = { typeUrl: "/google.api.serviceusage.v1.ListServicesRequest", value: ListServicesRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseListServicesResponse(): ListServicesResponse { return { @@ -1300,6 +1371,15 @@ function createBaseListServicesResponse(): ListServicesResponse { */ export const ListServicesResponse = { typeUrl: "/google.api.serviceusage.v1.ListServicesResponse", + is(o: any): o is ListServicesResponse { + return o && (o.$typeUrl === ListServicesResponse.typeUrl || Array.isArray(o.services) && (!o.services.length || Service.is(o.services[0])) && typeof o.nextPageToken === "string"); + }, + isSDK(o: any): o is ListServicesResponseSDKType { + return o && (o.$typeUrl === ListServicesResponse.typeUrl || Array.isArray(o.services) && (!o.services.length || Service.isSDK(o.services[0])) && typeof o.next_page_token === "string"); + }, + isAmino(o: any): o is ListServicesResponseAmino { + return o && (o.$typeUrl === ListServicesResponse.typeUrl || Array.isArray(o.services) && (!o.services.length || Service.isAmino(o.services[0])) && typeof o.next_page_token === "string"); + }, encode(message: ListServicesResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.services) { Service.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -1386,6 +1466,12 @@ export const ListServicesResponse = { typeUrl: "/google.api.serviceusage.v1.ListServicesResponse", value: ListServicesResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ListServicesResponse.typeUrl)) { + return; + } + Service.registerTypeUrl(); } }; function createBaseBatchEnableServicesRequest(): BatchEnableServicesRequest { @@ -1402,6 +1488,15 @@ function createBaseBatchEnableServicesRequest(): BatchEnableServicesRequest { */ export const BatchEnableServicesRequest = { typeUrl: "/google.api.serviceusage.v1.BatchEnableServicesRequest", + is(o: any): o is BatchEnableServicesRequest { + return o && (o.$typeUrl === BatchEnableServicesRequest.typeUrl || typeof o.parent === "string" && Array.isArray(o.serviceIds) && (!o.serviceIds.length || typeof o.serviceIds[0] === "string")); + }, + isSDK(o: any): o is BatchEnableServicesRequestSDKType { + return o && (o.$typeUrl === BatchEnableServicesRequest.typeUrl || typeof o.parent === "string" && Array.isArray(o.service_ids) && (!o.service_ids.length || typeof o.service_ids[0] === "string")); + }, + isAmino(o: any): o is BatchEnableServicesRequestAmino { + return o && (o.$typeUrl === BatchEnableServicesRequest.typeUrl || typeof o.parent === "string" && Array.isArray(o.service_ids) && (!o.service_ids.length || typeof o.service_ids[0] === "string")); + }, encode(message: BatchEnableServicesRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.parent !== "") { writer.uint32(10).string(message.parent); @@ -1488,7 +1583,8 @@ export const BatchEnableServicesRequest = { typeUrl: "/google.api.serviceusage.v1.BatchEnableServicesRequest", value: BatchEnableServicesRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseBatchEnableServicesResponse(): BatchEnableServicesResponse { return { @@ -1506,6 +1602,15 @@ function createBaseBatchEnableServicesResponse(): BatchEnableServicesResponse { */ export const BatchEnableServicesResponse = { typeUrl: "/google.api.serviceusage.v1.BatchEnableServicesResponse", + is(o: any): o is BatchEnableServicesResponse { + return o && (o.$typeUrl === BatchEnableServicesResponse.typeUrl || Array.isArray(o.services) && (!o.services.length || Service.is(o.services[0])) && Array.isArray(o.failures) && (!o.failures.length || BatchEnableServicesResponse_EnableFailure.is(o.failures[0]))); + }, + isSDK(o: any): o is BatchEnableServicesResponseSDKType { + return o && (o.$typeUrl === BatchEnableServicesResponse.typeUrl || Array.isArray(o.services) && (!o.services.length || Service.isSDK(o.services[0])) && Array.isArray(o.failures) && (!o.failures.length || BatchEnableServicesResponse_EnableFailure.isSDK(o.failures[0]))); + }, + isAmino(o: any): o is BatchEnableServicesResponseAmino { + return o && (o.$typeUrl === BatchEnableServicesResponse.typeUrl || Array.isArray(o.services) && (!o.services.length || Service.isAmino(o.services[0])) && Array.isArray(o.failures) && (!o.failures.length || BatchEnableServicesResponse_EnableFailure.isAmino(o.failures[0]))); + }, encode(message: BatchEnableServicesResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.services) { Service.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -1598,6 +1703,13 @@ export const BatchEnableServicesResponse = { typeUrl: "/google.api.serviceusage.v1.BatchEnableServicesResponse", value: BatchEnableServicesResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(BatchEnableServicesResponse.typeUrl)) { + return; + } + Service.registerTypeUrl(); + BatchEnableServicesResponse_EnableFailure.registerTypeUrl(); } }; function createBaseBatchEnableServicesResponse_EnableFailure(): BatchEnableServicesResponse_EnableFailure { @@ -1614,6 +1726,15 @@ function createBaseBatchEnableServicesResponse_EnableFailure(): BatchEnableServi */ export const BatchEnableServicesResponse_EnableFailure = { typeUrl: "/google.api.serviceusage.v1.EnableFailure", + is(o: any): o is BatchEnableServicesResponse_EnableFailure { + return o && (o.$typeUrl === BatchEnableServicesResponse_EnableFailure.typeUrl || typeof o.serviceId === "string" && typeof o.errorMessage === "string"); + }, + isSDK(o: any): o is BatchEnableServicesResponse_EnableFailureSDKType { + return o && (o.$typeUrl === BatchEnableServicesResponse_EnableFailure.typeUrl || typeof o.service_id === "string" && typeof o.error_message === "string"); + }, + isAmino(o: any): o is BatchEnableServicesResponse_EnableFailureAmino { + return o && (o.$typeUrl === BatchEnableServicesResponse_EnableFailure.typeUrl || typeof o.service_id === "string" && typeof o.error_message === "string"); + }, encode(message: BatchEnableServicesResponse_EnableFailure, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.serviceId !== "") { writer.uint32(10).string(message.serviceId); @@ -1694,7 +1815,8 @@ export const BatchEnableServicesResponse_EnableFailure = { typeUrl: "/google.api.serviceusage.v1.EnableFailure", value: BatchEnableServicesResponse_EnableFailure.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseBatchGetServicesRequest(): BatchGetServicesRequest { return { @@ -1710,6 +1832,15 @@ function createBaseBatchGetServicesRequest(): BatchGetServicesRequest { */ export const BatchGetServicesRequest = { typeUrl: "/google.api.serviceusage.v1.BatchGetServicesRequest", + is(o: any): o is BatchGetServicesRequest { + return o && (o.$typeUrl === BatchGetServicesRequest.typeUrl || typeof o.parent === "string" && Array.isArray(o.names) && (!o.names.length || typeof o.names[0] === "string")); + }, + isSDK(o: any): o is BatchGetServicesRequestSDKType { + return o && (o.$typeUrl === BatchGetServicesRequest.typeUrl || typeof o.parent === "string" && Array.isArray(o.names) && (!o.names.length || typeof o.names[0] === "string")); + }, + isAmino(o: any): o is BatchGetServicesRequestAmino { + return o && (o.$typeUrl === BatchGetServicesRequest.typeUrl || typeof o.parent === "string" && Array.isArray(o.names) && (!o.names.length || typeof o.names[0] === "string")); + }, encode(message: BatchGetServicesRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.parent !== "") { writer.uint32(10).string(message.parent); @@ -1796,7 +1927,8 @@ export const BatchGetServicesRequest = { typeUrl: "/google.api.serviceusage.v1.BatchGetServicesRequest", value: BatchGetServicesRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseBatchGetServicesResponse(): BatchGetServicesResponse { return { @@ -1811,6 +1943,15 @@ function createBaseBatchGetServicesResponse(): BatchGetServicesResponse { */ export const BatchGetServicesResponse = { typeUrl: "/google.api.serviceusage.v1.BatchGetServicesResponse", + is(o: any): o is BatchGetServicesResponse { + return o && (o.$typeUrl === BatchGetServicesResponse.typeUrl || Array.isArray(o.services) && (!o.services.length || Service.is(o.services[0]))); + }, + isSDK(o: any): o is BatchGetServicesResponseSDKType { + return o && (o.$typeUrl === BatchGetServicesResponse.typeUrl || Array.isArray(o.services) && (!o.services.length || Service.isSDK(o.services[0]))); + }, + isAmino(o: any): o is BatchGetServicesResponseAmino { + return o && (o.$typeUrl === BatchGetServicesResponse.typeUrl || Array.isArray(o.services) && (!o.services.length || Service.isAmino(o.services[0]))); + }, encode(message: BatchGetServicesResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.services) { Service.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -1883,5 +2024,11 @@ export const BatchGetServicesResponse = { typeUrl: "/google.api.serviceusage.v1.BatchGetServicesResponse", value: BatchGetServicesResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(BatchGetServicesResponse.typeUrl)) { + return; + } + Service.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/google/api/serviceusage/v1beta1/resources.ts b/__fixtures__/v-next/outputv3/google/api/serviceusage/v1beta1/resources.ts index 66c754b985..a615b3bf71 100644 --- a/__fixtures__/v-next/outputv3/google/api/serviceusage/v1beta1/resources.ts +++ b/__fixtures__/v-next/outputv3/google/api/serviceusage/v1beta1/resources.ts @@ -6,8 +6,9 @@ import { Usage, UsageAmino, UsageSDKType } from "../../usage"; import { Endpoint, EndpointAmino, EndpointSDKType } from "../../endpoint"; import { MonitoredResourceDescriptor, MonitoredResourceDescriptorAmino, MonitoredResourceDescriptorSDKType } from "../../monitored_resource"; import { Monitoring, MonitoringAmino, MonitoringSDKType } from "../../monitoring"; -import { BinaryReader, BinaryWriter } from "../../../../binary"; import { isSet, DeepPartial, isObject } from "../../../../helpers"; +import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { GlobalDecoderRegistry } from "../../../../registry"; export const protobufPackage = "google.api.serviceusage.v1beta1"; /** Whether or not a service has been enabled for use by a consumer. */ export enum State { @@ -1275,6 +1276,15 @@ function createBaseService(): Service { */ export const Service = { typeUrl: "/google.api.serviceusage.v1beta1.Service", + is(o: any): o is Service { + return o && (o.$typeUrl === Service.typeUrl || typeof o.name === "string" && typeof o.parent === "string" && isSet(o.state)); + }, + isSDK(o: any): o is ServiceSDKType { + return o && (o.$typeUrl === Service.typeUrl || typeof o.name === "string" && typeof o.parent === "string" && isSet(o.state)); + }, + isAmino(o: any): o is ServiceAmino { + return o && (o.$typeUrl === Service.typeUrl || typeof o.name === "string" && typeof o.parent === "string" && isSet(o.state)); + }, encode(message: Service, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -1385,6 +1395,12 @@ export const Service = { typeUrl: "/google.api.serviceusage.v1beta1.Service", value: Service.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Service.typeUrl)) { + return; + } + ServiceConfig.registerTypeUrl(); } }; function createBaseServiceConfig(): ServiceConfig { @@ -1409,6 +1425,15 @@ function createBaseServiceConfig(): ServiceConfig { */ export const ServiceConfig = { typeUrl: "/google.api.serviceusage.v1beta1.ServiceConfig", + is(o: any): o is ServiceConfig { + return o && (o.$typeUrl === ServiceConfig.typeUrl || typeof o.name === "string" && typeof o.title === "string" && Array.isArray(o.apis) && (!o.apis.length || Api.is(o.apis[0])) && Array.isArray(o.endpoints) && (!o.endpoints.length || Endpoint.is(o.endpoints[0])) && Array.isArray(o.monitoredResources) && (!o.monitoredResources.length || MonitoredResourceDescriptor.is(o.monitoredResources[0]))); + }, + isSDK(o: any): o is ServiceConfigSDKType { + return o && (o.$typeUrl === ServiceConfig.typeUrl || typeof o.name === "string" && typeof o.title === "string" && Array.isArray(o.apis) && (!o.apis.length || Api.isSDK(o.apis[0])) && Array.isArray(o.endpoints) && (!o.endpoints.length || Endpoint.isSDK(o.endpoints[0])) && Array.isArray(o.monitored_resources) && (!o.monitored_resources.length || MonitoredResourceDescriptor.isSDK(o.monitored_resources[0]))); + }, + isAmino(o: any): o is ServiceConfigAmino { + return o && (o.$typeUrl === ServiceConfig.typeUrl || typeof o.name === "string" && typeof o.title === "string" && Array.isArray(o.apis) && (!o.apis.length || Api.isAmino(o.apis[0])) && Array.isArray(o.endpoints) && (!o.endpoints.length || Endpoint.isAmino(o.endpoints[0])) && Array.isArray(o.monitored_resources) && (!o.monitored_resources.length || MonitoredResourceDescriptor.isAmino(o.monitored_resources[0]))); + }, encode(message: ServiceConfig, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -1629,6 +1654,19 @@ export const ServiceConfig = { typeUrl: "/google.api.serviceusage.v1beta1.ServiceConfig", value: ServiceConfig.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ServiceConfig.typeUrl)) { + return; + } + Api.registerTypeUrl(); + Documentation.registerTypeUrl(); + Quota.registerTypeUrl(); + Authentication.registerTypeUrl(); + Usage.registerTypeUrl(); + Endpoint.registerTypeUrl(); + MonitoredResourceDescriptor.registerTypeUrl(); + Monitoring.registerTypeUrl(); } }; function createBaseOperationMetadata(): OperationMetadata { @@ -1644,6 +1682,15 @@ function createBaseOperationMetadata(): OperationMetadata { */ export const OperationMetadata = { typeUrl: "/google.api.serviceusage.v1beta1.OperationMetadata", + is(o: any): o is OperationMetadata { + return o && (o.$typeUrl === OperationMetadata.typeUrl || Array.isArray(o.resourceNames) && (!o.resourceNames.length || typeof o.resourceNames[0] === "string")); + }, + isSDK(o: any): o is OperationMetadataSDKType { + return o && (o.$typeUrl === OperationMetadata.typeUrl || Array.isArray(o.resource_names) && (!o.resource_names.length || typeof o.resource_names[0] === "string")); + }, + isAmino(o: any): o is OperationMetadataAmino { + return o && (o.$typeUrl === OperationMetadata.typeUrl || Array.isArray(o.resource_names) && (!o.resource_names.length || typeof o.resource_names[0] === "string")); + }, encode(message: OperationMetadata, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.resourceNames) { writer.uint32(18).string(v!); @@ -1716,7 +1763,8 @@ export const OperationMetadata = { typeUrl: "/google.api.serviceusage.v1beta1.OperationMetadata", value: OperationMetadata.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseConsumerQuotaMetric(): ConsumerQuotaMetric { return { @@ -1736,6 +1784,15 @@ function createBaseConsumerQuotaMetric(): ConsumerQuotaMetric { */ export const ConsumerQuotaMetric = { typeUrl: "/google.api.serviceusage.v1beta1.ConsumerQuotaMetric", + is(o: any): o is ConsumerQuotaMetric { + return o && (o.$typeUrl === ConsumerQuotaMetric.typeUrl || typeof o.name === "string" && typeof o.metric === "string" && typeof o.displayName === "string" && Array.isArray(o.consumerQuotaLimits) && (!o.consumerQuotaLimits.length || ConsumerQuotaLimit.is(o.consumerQuotaLimits[0])) && Array.isArray(o.descendantConsumerQuotaLimits) && (!o.descendantConsumerQuotaLimits.length || ConsumerQuotaLimit.is(o.descendantConsumerQuotaLimits[0])) && typeof o.unit === "string"); + }, + isSDK(o: any): o is ConsumerQuotaMetricSDKType { + return o && (o.$typeUrl === ConsumerQuotaMetric.typeUrl || typeof o.name === "string" && typeof o.metric === "string" && typeof o.display_name === "string" && Array.isArray(o.consumer_quota_limits) && (!o.consumer_quota_limits.length || ConsumerQuotaLimit.isSDK(o.consumer_quota_limits[0])) && Array.isArray(o.descendant_consumer_quota_limits) && (!o.descendant_consumer_quota_limits.length || ConsumerQuotaLimit.isSDK(o.descendant_consumer_quota_limits[0])) && typeof o.unit === "string"); + }, + isAmino(o: any): o is ConsumerQuotaMetricAmino { + return o && (o.$typeUrl === ConsumerQuotaMetric.typeUrl || typeof o.name === "string" && typeof o.metric === "string" && typeof o.display_name === "string" && Array.isArray(o.consumer_quota_limits) && (!o.consumer_quota_limits.length || ConsumerQuotaLimit.isAmino(o.consumer_quota_limits[0])) && Array.isArray(o.descendant_consumer_quota_limits) && (!o.descendant_consumer_quota_limits.length || ConsumerQuotaLimit.isAmino(o.descendant_consumer_quota_limits[0])) && typeof o.unit === "string"); + }, encode(message: ConsumerQuotaMetric, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -1884,6 +1941,12 @@ export const ConsumerQuotaMetric = { typeUrl: "/google.api.serviceusage.v1beta1.ConsumerQuotaMetric", value: ConsumerQuotaMetric.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ConsumerQuotaMetric.typeUrl)) { + return; + } + ConsumerQuotaLimit.registerTypeUrl(); } }; function createBaseConsumerQuotaLimit(): ConsumerQuotaLimit { @@ -1904,6 +1967,15 @@ function createBaseConsumerQuotaLimit(): ConsumerQuotaLimit { */ export const ConsumerQuotaLimit = { typeUrl: "/google.api.serviceusage.v1beta1.ConsumerQuotaLimit", + is(o: any): o is ConsumerQuotaLimit { + return o && (o.$typeUrl === ConsumerQuotaLimit.typeUrl || typeof o.name === "string" && typeof o.metric === "string" && typeof o.unit === "string" && typeof o.isPrecise === "boolean" && typeof o.allowsAdminOverrides === "boolean" && Array.isArray(o.quotaBuckets) && (!o.quotaBuckets.length || QuotaBucket.is(o.quotaBuckets[0]))); + }, + isSDK(o: any): o is ConsumerQuotaLimitSDKType { + return o && (o.$typeUrl === ConsumerQuotaLimit.typeUrl || typeof o.name === "string" && typeof o.metric === "string" && typeof o.unit === "string" && typeof o.is_precise === "boolean" && typeof o.allows_admin_overrides === "boolean" && Array.isArray(o.quota_buckets) && (!o.quota_buckets.length || QuotaBucket.isSDK(o.quota_buckets[0]))); + }, + isAmino(o: any): o is ConsumerQuotaLimitAmino { + return o && (o.$typeUrl === ConsumerQuotaLimit.typeUrl || typeof o.name === "string" && typeof o.metric === "string" && typeof o.unit === "string" && typeof o.is_precise === "boolean" && typeof o.allows_admin_overrides === "boolean" && Array.isArray(o.quota_buckets) && (!o.quota_buckets.length || QuotaBucket.isAmino(o.quota_buckets[0]))); + }, encode(message: ConsumerQuotaLimit, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -2046,6 +2118,12 @@ export const ConsumerQuotaLimit = { typeUrl: "/google.api.serviceusage.v1beta1.ConsumerQuotaLimit", value: ConsumerQuotaLimit.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ConsumerQuotaLimit.typeUrl)) { + return; + } + QuotaBucket.registerTypeUrl(); } }; function createBaseQuotaBucket_DimensionsEntry(): QuotaBucket_DimensionsEntry { @@ -2134,7 +2212,8 @@ export const QuotaBucket_DimensionsEntry = { }, toProto(message: QuotaBucket_DimensionsEntry): Uint8Array { return QuotaBucket_DimensionsEntry.encode(message).finish(); - } + }, + registerTypeUrl() {} }; function createBaseQuotaBucket(): QuotaBucket { return { @@ -2154,6 +2233,15 @@ function createBaseQuotaBucket(): QuotaBucket { */ export const QuotaBucket = { typeUrl: "/google.api.serviceusage.v1beta1.QuotaBucket", + is(o: any): o is QuotaBucket { + return o && (o.$typeUrl === QuotaBucket.typeUrl || typeof o.effectiveLimit === "bigint" && typeof o.defaultLimit === "bigint" && isSet(o.dimensions)); + }, + isSDK(o: any): o is QuotaBucketSDKType { + return o && (o.$typeUrl === QuotaBucket.typeUrl || typeof o.effective_limit === "bigint" && typeof o.default_limit === "bigint" && isSet(o.dimensions)); + }, + isAmino(o: any): o is QuotaBucketAmino { + return o && (o.$typeUrl === QuotaBucket.typeUrl || typeof o.effective_limit === "bigint" && typeof o.default_limit === "bigint" && isSet(o.dimensions)); + }, encode(message: QuotaBucket, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.effectiveLimit !== BigInt(0)) { writer.uint32(8).int64(message.effectiveLimit); @@ -2338,6 +2426,12 @@ export const QuotaBucket = { typeUrl: "/google.api.serviceusage.v1beta1.QuotaBucket", value: QuotaBucket.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QuotaBucket.typeUrl)) { + return; + } + QuotaOverride.registerTypeUrl(); } }; function createBaseQuotaOverride_DimensionsEntry(): QuotaOverride_DimensionsEntry { @@ -2426,7 +2520,8 @@ export const QuotaOverride_DimensionsEntry = { }, toProto(message: QuotaOverride_DimensionsEntry): Uint8Array { return QuotaOverride_DimensionsEntry.encode(message).finish(); - } + }, + registerTypeUrl() {} }; function createBaseQuotaOverride(): QuotaOverride { return { @@ -2446,6 +2541,15 @@ function createBaseQuotaOverride(): QuotaOverride { */ export const QuotaOverride = { typeUrl: "/google.api.serviceusage.v1beta1.QuotaOverride", + is(o: any): o is QuotaOverride { + return o && (o.$typeUrl === QuotaOverride.typeUrl || typeof o.name === "string" && typeof o.overrideValue === "bigint" && isSet(o.dimensions) && typeof o.metric === "string" && typeof o.unit === "string" && typeof o.adminOverrideAncestor === "string"); + }, + isSDK(o: any): o is QuotaOverrideSDKType { + return o && (o.$typeUrl === QuotaOverride.typeUrl || typeof o.name === "string" && typeof o.override_value === "bigint" && isSet(o.dimensions) && typeof o.metric === "string" && typeof o.unit === "string" && typeof o.admin_override_ancestor === "string"); + }, + isAmino(o: any): o is QuotaOverrideAmino { + return o && (o.$typeUrl === QuotaOverride.typeUrl || typeof o.name === "string" && typeof o.override_value === "bigint" && isSet(o.dimensions) && typeof o.metric === "string" && typeof o.unit === "string" && typeof o.admin_override_ancestor === "string"); + }, encode(message: QuotaOverride, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -2622,7 +2726,8 @@ export const QuotaOverride = { typeUrl: "/google.api.serviceusage.v1beta1.QuotaOverride", value: QuotaOverride.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseOverrideInlineSource(): OverrideInlineSource { return { @@ -2637,6 +2742,15 @@ function createBaseOverrideInlineSource(): OverrideInlineSource { */ export const OverrideInlineSource = { typeUrl: "/google.api.serviceusage.v1beta1.OverrideInlineSource", + is(o: any): o is OverrideInlineSource { + return o && (o.$typeUrl === OverrideInlineSource.typeUrl || Array.isArray(o.overrides) && (!o.overrides.length || QuotaOverride.is(o.overrides[0]))); + }, + isSDK(o: any): o is OverrideInlineSourceSDKType { + return o && (o.$typeUrl === OverrideInlineSource.typeUrl || Array.isArray(o.overrides) && (!o.overrides.length || QuotaOverride.isSDK(o.overrides[0]))); + }, + isAmino(o: any): o is OverrideInlineSourceAmino { + return o && (o.$typeUrl === OverrideInlineSource.typeUrl || Array.isArray(o.overrides) && (!o.overrides.length || QuotaOverride.isAmino(o.overrides[0]))); + }, encode(message: OverrideInlineSource, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.overrides) { QuotaOverride.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -2709,6 +2823,12 @@ export const OverrideInlineSource = { typeUrl: "/google.api.serviceusage.v1beta1.OverrideInlineSource", value: OverrideInlineSource.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(OverrideInlineSource.typeUrl)) { + return; + } + QuotaOverride.registerTypeUrl(); } }; function createBaseAdminQuotaPolicy_DimensionsEntry(): AdminQuotaPolicy_DimensionsEntry { @@ -2797,7 +2917,8 @@ export const AdminQuotaPolicy_DimensionsEntry = { }, toProto(message: AdminQuotaPolicy_DimensionsEntry): Uint8Array { return AdminQuotaPolicy_DimensionsEntry.encode(message).finish(); - } + }, + registerTypeUrl() {} }; function createBaseAdminQuotaPolicy(): AdminQuotaPolicy { return { @@ -2817,6 +2938,15 @@ function createBaseAdminQuotaPolicy(): AdminQuotaPolicy { */ export const AdminQuotaPolicy = { typeUrl: "/google.api.serviceusage.v1beta1.AdminQuotaPolicy", + is(o: any): o is AdminQuotaPolicy { + return o && (o.$typeUrl === AdminQuotaPolicy.typeUrl || typeof o.name === "string" && typeof o.policyValue === "bigint" && isSet(o.dimensions) && typeof o.metric === "string" && typeof o.unit === "string" && typeof o.container === "string"); + }, + isSDK(o: any): o is AdminQuotaPolicySDKType { + return o && (o.$typeUrl === AdminQuotaPolicy.typeUrl || typeof o.name === "string" && typeof o.policy_value === "bigint" && isSet(o.dimensions) && typeof o.metric === "string" && typeof o.unit === "string" && typeof o.container === "string"); + }, + isAmino(o: any): o is AdminQuotaPolicyAmino { + return o && (o.$typeUrl === AdminQuotaPolicy.typeUrl || typeof o.name === "string" && typeof o.policy_value === "bigint" && isSet(o.dimensions) && typeof o.metric === "string" && typeof o.unit === "string" && typeof o.container === "string"); + }, encode(message: AdminQuotaPolicy, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -2993,7 +3123,8 @@ export const AdminQuotaPolicy = { typeUrl: "/google.api.serviceusage.v1beta1.AdminQuotaPolicy", value: AdminQuotaPolicy.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseServiceIdentity(): ServiceIdentity { return { @@ -3010,6 +3141,15 @@ function createBaseServiceIdentity(): ServiceIdentity { */ export const ServiceIdentity = { typeUrl: "/google.api.serviceusage.v1beta1.ServiceIdentity", + is(o: any): o is ServiceIdentity { + return o && (o.$typeUrl === ServiceIdentity.typeUrl || typeof o.email === "string" && typeof o.uniqueId === "string"); + }, + isSDK(o: any): o is ServiceIdentitySDKType { + return o && (o.$typeUrl === ServiceIdentity.typeUrl || typeof o.email === "string" && typeof o.unique_id === "string"); + }, + isAmino(o: any): o is ServiceIdentityAmino { + return o && (o.$typeUrl === ServiceIdentity.typeUrl || typeof o.email === "string" && typeof o.unique_id === "string"); + }, encode(message: ServiceIdentity, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.email !== "") { writer.uint32(10).string(message.email); @@ -3090,5 +3230,6 @@ export const ServiceIdentity = { typeUrl: "/google.api.serviceusage.v1beta1.ServiceIdentity", value: ServiceIdentity.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/google/api/serviceusage/v1beta1/serviceusage.ts b/__fixtures__/v-next/outputv3/google/api/serviceusage/v1beta1/serviceusage.ts index a4c458c05f..8a3d72f265 100644 --- a/__fixtures__/v-next/outputv3/google/api/serviceusage/v1beta1/serviceusage.ts +++ b/__fixtures__/v-next/outputv3/google/api/serviceusage/v1beta1/serviceusage.ts @@ -2,6 +2,7 @@ import { QuotaView, QuotaViewSDKType, QuotaOverride, QuotaOverrideAmino, QuotaOv import { FieldMask, FieldMaskAmino, FieldMaskSDKType } from "../../../protobuf/field_mask"; import { BinaryReader, BinaryWriter } from "../../../../binary"; import { isSet, DeepPartial } from "../../../../helpers"; +import { GlobalDecoderRegistry } from "../../../../registry"; export const protobufPackage = "google.api.serviceusage.v1beta1"; /** Enum for service identity state. */ export enum GetServiceIdentityResponse_IdentityState { @@ -2018,6 +2019,15 @@ function createBaseEnableServiceRequest(): EnableServiceRequest { */ export const EnableServiceRequest = { typeUrl: "/google.api.serviceusage.v1beta1.EnableServiceRequest", + is(o: any): o is EnableServiceRequest { + return o && (o.$typeUrl === EnableServiceRequest.typeUrl || typeof o.name === "string"); + }, + isSDK(o: any): o is EnableServiceRequestSDKType { + return o && (o.$typeUrl === EnableServiceRequest.typeUrl || typeof o.name === "string"); + }, + isAmino(o: any): o is EnableServiceRequestAmino { + return o && (o.$typeUrl === EnableServiceRequest.typeUrl || typeof o.name === "string"); + }, encode(message: EnableServiceRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -2084,7 +2094,8 @@ export const EnableServiceRequest = { typeUrl: "/google.api.serviceusage.v1beta1.EnableServiceRequest", value: EnableServiceRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseDisableServiceRequest(): DisableServiceRequest { return { @@ -2099,6 +2110,15 @@ function createBaseDisableServiceRequest(): DisableServiceRequest { */ export const DisableServiceRequest = { typeUrl: "/google.api.serviceusage.v1beta1.DisableServiceRequest", + is(o: any): o is DisableServiceRequest { + return o && (o.$typeUrl === DisableServiceRequest.typeUrl || typeof o.name === "string"); + }, + isSDK(o: any): o is DisableServiceRequestSDKType { + return o && (o.$typeUrl === DisableServiceRequest.typeUrl || typeof o.name === "string"); + }, + isAmino(o: any): o is DisableServiceRequestAmino { + return o && (o.$typeUrl === DisableServiceRequest.typeUrl || typeof o.name === "string"); + }, encode(message: DisableServiceRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -2165,7 +2185,8 @@ export const DisableServiceRequest = { typeUrl: "/google.api.serviceusage.v1beta1.DisableServiceRequest", value: DisableServiceRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseGetServiceRequest(): GetServiceRequest { return { @@ -2180,6 +2201,15 @@ function createBaseGetServiceRequest(): GetServiceRequest { */ export const GetServiceRequest = { typeUrl: "/google.api.serviceusage.v1beta1.GetServiceRequest", + is(o: any): o is GetServiceRequest { + return o && (o.$typeUrl === GetServiceRequest.typeUrl || typeof o.name === "string"); + }, + isSDK(o: any): o is GetServiceRequestSDKType { + return o && (o.$typeUrl === GetServiceRequest.typeUrl || typeof o.name === "string"); + }, + isAmino(o: any): o is GetServiceRequestAmino { + return o && (o.$typeUrl === GetServiceRequest.typeUrl || typeof o.name === "string"); + }, encode(message: GetServiceRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -2246,7 +2276,8 @@ export const GetServiceRequest = { typeUrl: "/google.api.serviceusage.v1beta1.GetServiceRequest", value: GetServiceRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseListServicesRequest(): ListServicesRequest { return { @@ -2264,6 +2295,15 @@ function createBaseListServicesRequest(): ListServicesRequest { */ export const ListServicesRequest = { typeUrl: "/google.api.serviceusage.v1beta1.ListServicesRequest", + is(o: any): o is ListServicesRequest { + return o && (o.$typeUrl === ListServicesRequest.typeUrl || typeof o.parent === "string" && typeof o.pageSize === "number" && typeof o.pageToken === "string" && typeof o.filter === "string"); + }, + isSDK(o: any): o is ListServicesRequestSDKType { + return o && (o.$typeUrl === ListServicesRequest.typeUrl || typeof o.parent === "string" && typeof o.page_size === "number" && typeof o.page_token === "string" && typeof o.filter === "string"); + }, + isAmino(o: any): o is ListServicesRequestAmino { + return o && (o.$typeUrl === ListServicesRequest.typeUrl || typeof o.parent === "string" && typeof o.page_size === "number" && typeof o.page_token === "string" && typeof o.filter === "string"); + }, encode(message: ListServicesRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.parent !== "") { writer.uint32(10).string(message.parent); @@ -2372,7 +2412,8 @@ export const ListServicesRequest = { typeUrl: "/google.api.serviceusage.v1beta1.ListServicesRequest", value: ListServicesRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseListServicesResponse(): ListServicesResponse { return { @@ -2388,6 +2429,15 @@ function createBaseListServicesResponse(): ListServicesResponse { */ export const ListServicesResponse = { typeUrl: "/google.api.serviceusage.v1beta1.ListServicesResponse", + is(o: any): o is ListServicesResponse { + return o && (o.$typeUrl === ListServicesResponse.typeUrl || Array.isArray(o.services) && (!o.services.length || Service.is(o.services[0])) && typeof o.nextPageToken === "string"); + }, + isSDK(o: any): o is ListServicesResponseSDKType { + return o && (o.$typeUrl === ListServicesResponse.typeUrl || Array.isArray(o.services) && (!o.services.length || Service.isSDK(o.services[0])) && typeof o.next_page_token === "string"); + }, + isAmino(o: any): o is ListServicesResponseAmino { + return o && (o.$typeUrl === ListServicesResponse.typeUrl || Array.isArray(o.services) && (!o.services.length || Service.isAmino(o.services[0])) && typeof o.next_page_token === "string"); + }, encode(message: ListServicesResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.services) { Service.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -2474,6 +2524,12 @@ export const ListServicesResponse = { typeUrl: "/google.api.serviceusage.v1beta1.ListServicesResponse", value: ListServicesResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ListServicesResponse.typeUrl)) { + return; + } + Service.registerTypeUrl(); } }; function createBaseBatchEnableServicesRequest(): BatchEnableServicesRequest { @@ -2490,6 +2546,15 @@ function createBaseBatchEnableServicesRequest(): BatchEnableServicesRequest { */ export const BatchEnableServicesRequest = { typeUrl: "/google.api.serviceusage.v1beta1.BatchEnableServicesRequest", + is(o: any): o is BatchEnableServicesRequest { + return o && (o.$typeUrl === BatchEnableServicesRequest.typeUrl || typeof o.parent === "string" && Array.isArray(o.serviceIds) && (!o.serviceIds.length || typeof o.serviceIds[0] === "string")); + }, + isSDK(o: any): o is BatchEnableServicesRequestSDKType { + return o && (o.$typeUrl === BatchEnableServicesRequest.typeUrl || typeof o.parent === "string" && Array.isArray(o.service_ids) && (!o.service_ids.length || typeof o.service_ids[0] === "string")); + }, + isAmino(o: any): o is BatchEnableServicesRequestAmino { + return o && (o.$typeUrl === BatchEnableServicesRequest.typeUrl || typeof o.parent === "string" && Array.isArray(o.service_ids) && (!o.service_ids.length || typeof o.service_ids[0] === "string")); + }, encode(message: BatchEnableServicesRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.parent !== "") { writer.uint32(10).string(message.parent); @@ -2576,7 +2641,8 @@ export const BatchEnableServicesRequest = { typeUrl: "/google.api.serviceusage.v1beta1.BatchEnableServicesRequest", value: BatchEnableServicesRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseListConsumerQuotaMetricsRequest(): ListConsumerQuotaMetricsRequest { return { @@ -2594,6 +2660,15 @@ function createBaseListConsumerQuotaMetricsRequest(): ListConsumerQuotaMetricsRe */ export const ListConsumerQuotaMetricsRequest = { typeUrl: "/google.api.serviceusage.v1beta1.ListConsumerQuotaMetricsRequest", + is(o: any): o is ListConsumerQuotaMetricsRequest { + return o && (o.$typeUrl === ListConsumerQuotaMetricsRequest.typeUrl || typeof o.parent === "string" && typeof o.pageSize === "number" && typeof o.pageToken === "string" && isSet(o.view)); + }, + isSDK(o: any): o is ListConsumerQuotaMetricsRequestSDKType { + return o && (o.$typeUrl === ListConsumerQuotaMetricsRequest.typeUrl || typeof o.parent === "string" && typeof o.page_size === "number" && typeof o.page_token === "string" && isSet(o.view)); + }, + isAmino(o: any): o is ListConsumerQuotaMetricsRequestAmino { + return o && (o.$typeUrl === ListConsumerQuotaMetricsRequest.typeUrl || typeof o.parent === "string" && typeof o.page_size === "number" && typeof o.page_token === "string" && isSet(o.view)); + }, encode(message: ListConsumerQuotaMetricsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.parent !== "") { writer.uint32(10).string(message.parent); @@ -2702,7 +2777,8 @@ export const ListConsumerQuotaMetricsRequest = { typeUrl: "/google.api.serviceusage.v1beta1.ListConsumerQuotaMetricsRequest", value: ListConsumerQuotaMetricsRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseListConsumerQuotaMetricsResponse(): ListConsumerQuotaMetricsResponse { return { @@ -2718,6 +2794,15 @@ function createBaseListConsumerQuotaMetricsResponse(): ListConsumerQuotaMetricsR */ export const ListConsumerQuotaMetricsResponse = { typeUrl: "/google.api.serviceusage.v1beta1.ListConsumerQuotaMetricsResponse", + is(o: any): o is ListConsumerQuotaMetricsResponse { + return o && (o.$typeUrl === ListConsumerQuotaMetricsResponse.typeUrl || Array.isArray(o.metrics) && (!o.metrics.length || ConsumerQuotaMetric.is(o.metrics[0])) && typeof o.nextPageToken === "string"); + }, + isSDK(o: any): o is ListConsumerQuotaMetricsResponseSDKType { + return o && (o.$typeUrl === ListConsumerQuotaMetricsResponse.typeUrl || Array.isArray(o.metrics) && (!o.metrics.length || ConsumerQuotaMetric.isSDK(o.metrics[0])) && typeof o.next_page_token === "string"); + }, + isAmino(o: any): o is ListConsumerQuotaMetricsResponseAmino { + return o && (o.$typeUrl === ListConsumerQuotaMetricsResponse.typeUrl || Array.isArray(o.metrics) && (!o.metrics.length || ConsumerQuotaMetric.isAmino(o.metrics[0])) && typeof o.next_page_token === "string"); + }, encode(message: ListConsumerQuotaMetricsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.metrics) { ConsumerQuotaMetric.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -2804,6 +2889,12 @@ export const ListConsumerQuotaMetricsResponse = { typeUrl: "/google.api.serviceusage.v1beta1.ListConsumerQuotaMetricsResponse", value: ListConsumerQuotaMetricsResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ListConsumerQuotaMetricsResponse.typeUrl)) { + return; + } + ConsumerQuotaMetric.registerTypeUrl(); } }; function createBaseGetConsumerQuotaMetricRequest(): GetConsumerQuotaMetricRequest { @@ -2820,6 +2911,15 @@ function createBaseGetConsumerQuotaMetricRequest(): GetConsumerQuotaMetricReques */ export const GetConsumerQuotaMetricRequest = { typeUrl: "/google.api.serviceusage.v1beta1.GetConsumerQuotaMetricRequest", + is(o: any): o is GetConsumerQuotaMetricRequest { + return o && (o.$typeUrl === GetConsumerQuotaMetricRequest.typeUrl || typeof o.name === "string" && isSet(o.view)); + }, + isSDK(o: any): o is GetConsumerQuotaMetricRequestSDKType { + return o && (o.$typeUrl === GetConsumerQuotaMetricRequest.typeUrl || typeof o.name === "string" && isSet(o.view)); + }, + isAmino(o: any): o is GetConsumerQuotaMetricRequestAmino { + return o && (o.$typeUrl === GetConsumerQuotaMetricRequest.typeUrl || typeof o.name === "string" && isSet(o.view)); + }, encode(message: GetConsumerQuotaMetricRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -2900,7 +3000,8 @@ export const GetConsumerQuotaMetricRequest = { typeUrl: "/google.api.serviceusage.v1beta1.GetConsumerQuotaMetricRequest", value: GetConsumerQuotaMetricRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseGetConsumerQuotaLimitRequest(): GetConsumerQuotaLimitRequest { return { @@ -2916,6 +3017,15 @@ function createBaseGetConsumerQuotaLimitRequest(): GetConsumerQuotaLimitRequest */ export const GetConsumerQuotaLimitRequest = { typeUrl: "/google.api.serviceusage.v1beta1.GetConsumerQuotaLimitRequest", + is(o: any): o is GetConsumerQuotaLimitRequest { + return o && (o.$typeUrl === GetConsumerQuotaLimitRequest.typeUrl || typeof o.name === "string" && isSet(o.view)); + }, + isSDK(o: any): o is GetConsumerQuotaLimitRequestSDKType { + return o && (o.$typeUrl === GetConsumerQuotaLimitRequest.typeUrl || typeof o.name === "string" && isSet(o.view)); + }, + isAmino(o: any): o is GetConsumerQuotaLimitRequestAmino { + return o && (o.$typeUrl === GetConsumerQuotaLimitRequest.typeUrl || typeof o.name === "string" && isSet(o.view)); + }, encode(message: GetConsumerQuotaLimitRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -2996,7 +3106,8 @@ export const GetConsumerQuotaLimitRequest = { typeUrl: "/google.api.serviceusage.v1beta1.GetConsumerQuotaLimitRequest", value: GetConsumerQuotaLimitRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseCreateAdminOverrideRequest(): CreateAdminOverrideRequest { return { @@ -3014,6 +3125,15 @@ function createBaseCreateAdminOverrideRequest(): CreateAdminOverrideRequest { */ export const CreateAdminOverrideRequest = { typeUrl: "/google.api.serviceusage.v1beta1.CreateAdminOverrideRequest", + is(o: any): o is CreateAdminOverrideRequest { + return o && (o.$typeUrl === CreateAdminOverrideRequest.typeUrl || typeof o.parent === "string" && typeof o.force === "boolean" && Array.isArray(o.forceOnly)); + }, + isSDK(o: any): o is CreateAdminOverrideRequestSDKType { + return o && (o.$typeUrl === CreateAdminOverrideRequest.typeUrl || typeof o.parent === "string" && typeof o.force === "boolean" && Array.isArray(o.force_only)); + }, + isAmino(o: any): o is CreateAdminOverrideRequestAmino { + return o && (o.$typeUrl === CreateAdminOverrideRequest.typeUrl || typeof o.parent === "string" && typeof o.force === "boolean" && Array.isArray(o.force_only)); + }, encode(message: CreateAdminOverrideRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.parent !== "") { writer.uint32(10).string(message.parent); @@ -3139,6 +3259,12 @@ export const CreateAdminOverrideRequest = { typeUrl: "/google.api.serviceusage.v1beta1.CreateAdminOverrideRequest", value: CreateAdminOverrideRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(CreateAdminOverrideRequest.typeUrl)) { + return; + } + QuotaOverride.registerTypeUrl(); } }; function createBaseUpdateAdminOverrideRequest(): UpdateAdminOverrideRequest { @@ -3158,6 +3284,15 @@ function createBaseUpdateAdminOverrideRequest(): UpdateAdminOverrideRequest { */ export const UpdateAdminOverrideRequest = { typeUrl: "/google.api.serviceusage.v1beta1.UpdateAdminOverrideRequest", + is(o: any): o is UpdateAdminOverrideRequest { + return o && (o.$typeUrl === UpdateAdminOverrideRequest.typeUrl || typeof o.name === "string" && typeof o.force === "boolean" && Array.isArray(o.forceOnly)); + }, + isSDK(o: any): o is UpdateAdminOverrideRequestSDKType { + return o && (o.$typeUrl === UpdateAdminOverrideRequest.typeUrl || typeof o.name === "string" && typeof o.force === "boolean" && Array.isArray(o.force_only)); + }, + isAmino(o: any): o is UpdateAdminOverrideRequestAmino { + return o && (o.$typeUrl === UpdateAdminOverrideRequest.typeUrl || typeof o.name === "string" && typeof o.force === "boolean" && Array.isArray(o.force_only)); + }, encode(message: UpdateAdminOverrideRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -3299,6 +3434,13 @@ export const UpdateAdminOverrideRequest = { typeUrl: "/google.api.serviceusage.v1beta1.UpdateAdminOverrideRequest", value: UpdateAdminOverrideRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(UpdateAdminOverrideRequest.typeUrl)) { + return; + } + QuotaOverride.registerTypeUrl(); + FieldMask.registerTypeUrl(); } }; function createBaseDeleteAdminOverrideRequest(): DeleteAdminOverrideRequest { @@ -3316,6 +3458,15 @@ function createBaseDeleteAdminOverrideRequest(): DeleteAdminOverrideRequest { */ export const DeleteAdminOverrideRequest = { typeUrl: "/google.api.serviceusage.v1beta1.DeleteAdminOverrideRequest", + is(o: any): o is DeleteAdminOverrideRequest { + return o && (o.$typeUrl === DeleteAdminOverrideRequest.typeUrl || typeof o.name === "string" && typeof o.force === "boolean" && Array.isArray(o.forceOnly)); + }, + isSDK(o: any): o is DeleteAdminOverrideRequestSDKType { + return o && (o.$typeUrl === DeleteAdminOverrideRequest.typeUrl || typeof o.name === "string" && typeof o.force === "boolean" && Array.isArray(o.force_only)); + }, + isAmino(o: any): o is DeleteAdminOverrideRequestAmino { + return o && (o.$typeUrl === DeleteAdminOverrideRequest.typeUrl || typeof o.name === "string" && typeof o.force === "boolean" && Array.isArray(o.force_only)); + }, encode(message: DeleteAdminOverrideRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -3425,7 +3576,8 @@ export const DeleteAdminOverrideRequest = { typeUrl: "/google.api.serviceusage.v1beta1.DeleteAdminOverrideRequest", value: DeleteAdminOverrideRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseListAdminOverridesRequest(): ListAdminOverridesRequest { return { @@ -3442,6 +3594,15 @@ function createBaseListAdminOverridesRequest(): ListAdminOverridesRequest { */ export const ListAdminOverridesRequest = { typeUrl: "/google.api.serviceusage.v1beta1.ListAdminOverridesRequest", + is(o: any): o is ListAdminOverridesRequest { + return o && (o.$typeUrl === ListAdminOverridesRequest.typeUrl || typeof o.parent === "string" && typeof o.pageSize === "number" && typeof o.pageToken === "string"); + }, + isSDK(o: any): o is ListAdminOverridesRequestSDKType { + return o && (o.$typeUrl === ListAdminOverridesRequest.typeUrl || typeof o.parent === "string" && typeof o.page_size === "number" && typeof o.page_token === "string"); + }, + isAmino(o: any): o is ListAdminOverridesRequestAmino { + return o && (o.$typeUrl === ListAdminOverridesRequest.typeUrl || typeof o.parent === "string" && typeof o.page_size === "number" && typeof o.page_token === "string"); + }, encode(message: ListAdminOverridesRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.parent !== "") { writer.uint32(10).string(message.parent); @@ -3536,7 +3697,8 @@ export const ListAdminOverridesRequest = { typeUrl: "/google.api.serviceusage.v1beta1.ListAdminOverridesRequest", value: ListAdminOverridesRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseListAdminOverridesResponse(): ListAdminOverridesResponse { return { @@ -3552,6 +3714,15 @@ function createBaseListAdminOverridesResponse(): ListAdminOverridesResponse { */ export const ListAdminOverridesResponse = { typeUrl: "/google.api.serviceusage.v1beta1.ListAdminOverridesResponse", + is(o: any): o is ListAdminOverridesResponse { + return o && (o.$typeUrl === ListAdminOverridesResponse.typeUrl || Array.isArray(o.overrides) && (!o.overrides.length || QuotaOverride.is(o.overrides[0])) && typeof o.nextPageToken === "string"); + }, + isSDK(o: any): o is ListAdminOverridesResponseSDKType { + return o && (o.$typeUrl === ListAdminOverridesResponse.typeUrl || Array.isArray(o.overrides) && (!o.overrides.length || QuotaOverride.isSDK(o.overrides[0])) && typeof o.next_page_token === "string"); + }, + isAmino(o: any): o is ListAdminOverridesResponseAmino { + return o && (o.$typeUrl === ListAdminOverridesResponse.typeUrl || Array.isArray(o.overrides) && (!o.overrides.length || QuotaOverride.isAmino(o.overrides[0])) && typeof o.next_page_token === "string"); + }, encode(message: ListAdminOverridesResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.overrides) { QuotaOverride.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -3638,6 +3809,12 @@ export const ListAdminOverridesResponse = { typeUrl: "/google.api.serviceusage.v1beta1.ListAdminOverridesResponse", value: ListAdminOverridesResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ListAdminOverridesResponse.typeUrl)) { + return; + } + QuotaOverride.registerTypeUrl(); } }; function createBaseBatchCreateAdminOverridesResponse(): BatchCreateAdminOverridesResponse { @@ -3653,6 +3830,15 @@ function createBaseBatchCreateAdminOverridesResponse(): BatchCreateAdminOverride */ export const BatchCreateAdminOverridesResponse = { typeUrl: "/google.api.serviceusage.v1beta1.BatchCreateAdminOverridesResponse", + is(o: any): o is BatchCreateAdminOverridesResponse { + return o && (o.$typeUrl === BatchCreateAdminOverridesResponse.typeUrl || Array.isArray(o.overrides) && (!o.overrides.length || QuotaOverride.is(o.overrides[0]))); + }, + isSDK(o: any): o is BatchCreateAdminOverridesResponseSDKType { + return o && (o.$typeUrl === BatchCreateAdminOverridesResponse.typeUrl || Array.isArray(o.overrides) && (!o.overrides.length || QuotaOverride.isSDK(o.overrides[0]))); + }, + isAmino(o: any): o is BatchCreateAdminOverridesResponseAmino { + return o && (o.$typeUrl === BatchCreateAdminOverridesResponse.typeUrl || Array.isArray(o.overrides) && (!o.overrides.length || QuotaOverride.isAmino(o.overrides[0]))); + }, encode(message: BatchCreateAdminOverridesResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.overrides) { QuotaOverride.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -3725,6 +3911,12 @@ export const BatchCreateAdminOverridesResponse = { typeUrl: "/google.api.serviceusage.v1beta1.BatchCreateAdminOverridesResponse", value: BatchCreateAdminOverridesResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(BatchCreateAdminOverridesResponse.typeUrl)) { + return; + } + QuotaOverride.registerTypeUrl(); } }; function createBaseImportAdminOverridesRequest(): ImportAdminOverridesRequest { @@ -3743,6 +3935,15 @@ function createBaseImportAdminOverridesRequest(): ImportAdminOverridesRequest { */ export const ImportAdminOverridesRequest = { typeUrl: "/google.api.serviceusage.v1beta1.ImportAdminOverridesRequest", + is(o: any): o is ImportAdminOverridesRequest { + return o && (o.$typeUrl === ImportAdminOverridesRequest.typeUrl || typeof o.parent === "string" && typeof o.force === "boolean" && Array.isArray(o.forceOnly)); + }, + isSDK(o: any): o is ImportAdminOverridesRequestSDKType { + return o && (o.$typeUrl === ImportAdminOverridesRequest.typeUrl || typeof o.parent === "string" && typeof o.force === "boolean" && Array.isArray(o.force_only)); + }, + isAmino(o: any): o is ImportAdminOverridesRequestAmino { + return o && (o.$typeUrl === ImportAdminOverridesRequest.typeUrl || typeof o.parent === "string" && typeof o.force === "boolean" && Array.isArray(o.force_only)); + }, encode(message: ImportAdminOverridesRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.parent !== "") { writer.uint32(10).string(message.parent); @@ -3868,6 +4069,12 @@ export const ImportAdminOverridesRequest = { typeUrl: "/google.api.serviceusage.v1beta1.ImportAdminOverridesRequest", value: ImportAdminOverridesRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ImportAdminOverridesRequest.typeUrl)) { + return; + } + OverrideInlineSource.registerTypeUrl(); } }; function createBaseImportAdminOverridesResponse(): ImportAdminOverridesResponse { @@ -3883,6 +4090,15 @@ function createBaseImportAdminOverridesResponse(): ImportAdminOverridesResponse */ export const ImportAdminOverridesResponse = { typeUrl: "/google.api.serviceusage.v1beta1.ImportAdminOverridesResponse", + is(o: any): o is ImportAdminOverridesResponse { + return o && (o.$typeUrl === ImportAdminOverridesResponse.typeUrl || Array.isArray(o.overrides) && (!o.overrides.length || QuotaOverride.is(o.overrides[0]))); + }, + isSDK(o: any): o is ImportAdminOverridesResponseSDKType { + return o && (o.$typeUrl === ImportAdminOverridesResponse.typeUrl || Array.isArray(o.overrides) && (!o.overrides.length || QuotaOverride.isSDK(o.overrides[0]))); + }, + isAmino(o: any): o is ImportAdminOverridesResponseAmino { + return o && (o.$typeUrl === ImportAdminOverridesResponse.typeUrl || Array.isArray(o.overrides) && (!o.overrides.length || QuotaOverride.isAmino(o.overrides[0]))); + }, encode(message: ImportAdminOverridesResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.overrides) { QuotaOverride.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -3955,6 +4171,12 @@ export const ImportAdminOverridesResponse = { typeUrl: "/google.api.serviceusage.v1beta1.ImportAdminOverridesResponse", value: ImportAdminOverridesResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ImportAdminOverridesResponse.typeUrl)) { + return; + } + QuotaOverride.registerTypeUrl(); } }; function createBaseImportAdminOverridesMetadata(): ImportAdminOverridesMetadata { @@ -3970,6 +4192,15 @@ function createBaseImportAdminOverridesMetadata(): ImportAdminOverridesMetadata */ export const ImportAdminOverridesMetadata = { typeUrl: "/google.api.serviceusage.v1beta1.ImportAdminOverridesMetadata", + is(o: any): o is ImportAdminOverridesMetadata { + return o && o.$typeUrl === ImportAdminOverridesMetadata.typeUrl; + }, + isSDK(o: any): o is ImportAdminOverridesMetadataSDKType { + return o && o.$typeUrl === ImportAdminOverridesMetadata.typeUrl; + }, + isAmino(o: any): o is ImportAdminOverridesMetadataAmino { + return o && o.$typeUrl === ImportAdminOverridesMetadata.typeUrl; + }, encode(_: ImportAdminOverridesMetadata, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -4021,7 +4252,8 @@ export const ImportAdminOverridesMetadata = { typeUrl: "/google.api.serviceusage.v1beta1.ImportAdminOverridesMetadata", value: ImportAdminOverridesMetadata.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseCreateConsumerOverrideRequest(): CreateConsumerOverrideRequest { return { @@ -4039,6 +4271,15 @@ function createBaseCreateConsumerOverrideRequest(): CreateConsumerOverrideReques */ export const CreateConsumerOverrideRequest = { typeUrl: "/google.api.serviceusage.v1beta1.CreateConsumerOverrideRequest", + is(o: any): o is CreateConsumerOverrideRequest { + return o && (o.$typeUrl === CreateConsumerOverrideRequest.typeUrl || typeof o.parent === "string" && typeof o.force === "boolean" && Array.isArray(o.forceOnly)); + }, + isSDK(o: any): o is CreateConsumerOverrideRequestSDKType { + return o && (o.$typeUrl === CreateConsumerOverrideRequest.typeUrl || typeof o.parent === "string" && typeof o.force === "boolean" && Array.isArray(o.force_only)); + }, + isAmino(o: any): o is CreateConsumerOverrideRequestAmino { + return o && (o.$typeUrl === CreateConsumerOverrideRequest.typeUrl || typeof o.parent === "string" && typeof o.force === "boolean" && Array.isArray(o.force_only)); + }, encode(message: CreateConsumerOverrideRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.parent !== "") { writer.uint32(10).string(message.parent); @@ -4164,6 +4405,12 @@ export const CreateConsumerOverrideRequest = { typeUrl: "/google.api.serviceusage.v1beta1.CreateConsumerOverrideRequest", value: CreateConsumerOverrideRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(CreateConsumerOverrideRequest.typeUrl)) { + return; + } + QuotaOverride.registerTypeUrl(); } }; function createBaseUpdateConsumerOverrideRequest(): UpdateConsumerOverrideRequest { @@ -4183,6 +4430,15 @@ function createBaseUpdateConsumerOverrideRequest(): UpdateConsumerOverrideReques */ export const UpdateConsumerOverrideRequest = { typeUrl: "/google.api.serviceusage.v1beta1.UpdateConsumerOverrideRequest", + is(o: any): o is UpdateConsumerOverrideRequest { + return o && (o.$typeUrl === UpdateConsumerOverrideRequest.typeUrl || typeof o.name === "string" && typeof o.force === "boolean" && Array.isArray(o.forceOnly)); + }, + isSDK(o: any): o is UpdateConsumerOverrideRequestSDKType { + return o && (o.$typeUrl === UpdateConsumerOverrideRequest.typeUrl || typeof o.name === "string" && typeof o.force === "boolean" && Array.isArray(o.force_only)); + }, + isAmino(o: any): o is UpdateConsumerOverrideRequestAmino { + return o && (o.$typeUrl === UpdateConsumerOverrideRequest.typeUrl || typeof o.name === "string" && typeof o.force === "boolean" && Array.isArray(o.force_only)); + }, encode(message: UpdateConsumerOverrideRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -4324,6 +4580,13 @@ export const UpdateConsumerOverrideRequest = { typeUrl: "/google.api.serviceusage.v1beta1.UpdateConsumerOverrideRequest", value: UpdateConsumerOverrideRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(UpdateConsumerOverrideRequest.typeUrl)) { + return; + } + QuotaOverride.registerTypeUrl(); + FieldMask.registerTypeUrl(); } }; function createBaseDeleteConsumerOverrideRequest(): DeleteConsumerOverrideRequest { @@ -4341,6 +4604,15 @@ function createBaseDeleteConsumerOverrideRequest(): DeleteConsumerOverrideReques */ export const DeleteConsumerOverrideRequest = { typeUrl: "/google.api.serviceusage.v1beta1.DeleteConsumerOverrideRequest", + is(o: any): o is DeleteConsumerOverrideRequest { + return o && (o.$typeUrl === DeleteConsumerOverrideRequest.typeUrl || typeof o.name === "string" && typeof o.force === "boolean" && Array.isArray(o.forceOnly)); + }, + isSDK(o: any): o is DeleteConsumerOverrideRequestSDKType { + return o && (o.$typeUrl === DeleteConsumerOverrideRequest.typeUrl || typeof o.name === "string" && typeof o.force === "boolean" && Array.isArray(o.force_only)); + }, + isAmino(o: any): o is DeleteConsumerOverrideRequestAmino { + return o && (o.$typeUrl === DeleteConsumerOverrideRequest.typeUrl || typeof o.name === "string" && typeof o.force === "boolean" && Array.isArray(o.force_only)); + }, encode(message: DeleteConsumerOverrideRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -4450,7 +4722,8 @@ export const DeleteConsumerOverrideRequest = { typeUrl: "/google.api.serviceusage.v1beta1.DeleteConsumerOverrideRequest", value: DeleteConsumerOverrideRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseListConsumerOverridesRequest(): ListConsumerOverridesRequest { return { @@ -4467,6 +4740,15 @@ function createBaseListConsumerOverridesRequest(): ListConsumerOverridesRequest */ export const ListConsumerOverridesRequest = { typeUrl: "/google.api.serviceusage.v1beta1.ListConsumerOverridesRequest", + is(o: any): o is ListConsumerOverridesRequest { + return o && (o.$typeUrl === ListConsumerOverridesRequest.typeUrl || typeof o.parent === "string" && typeof o.pageSize === "number" && typeof o.pageToken === "string"); + }, + isSDK(o: any): o is ListConsumerOverridesRequestSDKType { + return o && (o.$typeUrl === ListConsumerOverridesRequest.typeUrl || typeof o.parent === "string" && typeof o.page_size === "number" && typeof o.page_token === "string"); + }, + isAmino(o: any): o is ListConsumerOverridesRequestAmino { + return o && (o.$typeUrl === ListConsumerOverridesRequest.typeUrl || typeof o.parent === "string" && typeof o.page_size === "number" && typeof o.page_token === "string"); + }, encode(message: ListConsumerOverridesRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.parent !== "") { writer.uint32(10).string(message.parent); @@ -4561,7 +4843,8 @@ export const ListConsumerOverridesRequest = { typeUrl: "/google.api.serviceusage.v1beta1.ListConsumerOverridesRequest", value: ListConsumerOverridesRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseListConsumerOverridesResponse(): ListConsumerOverridesResponse { return { @@ -4577,6 +4860,15 @@ function createBaseListConsumerOverridesResponse(): ListConsumerOverridesRespons */ export const ListConsumerOverridesResponse = { typeUrl: "/google.api.serviceusage.v1beta1.ListConsumerOverridesResponse", + is(o: any): o is ListConsumerOverridesResponse { + return o && (o.$typeUrl === ListConsumerOverridesResponse.typeUrl || Array.isArray(o.overrides) && (!o.overrides.length || QuotaOverride.is(o.overrides[0])) && typeof o.nextPageToken === "string"); + }, + isSDK(o: any): o is ListConsumerOverridesResponseSDKType { + return o && (o.$typeUrl === ListConsumerOverridesResponse.typeUrl || Array.isArray(o.overrides) && (!o.overrides.length || QuotaOverride.isSDK(o.overrides[0])) && typeof o.next_page_token === "string"); + }, + isAmino(o: any): o is ListConsumerOverridesResponseAmino { + return o && (o.$typeUrl === ListConsumerOverridesResponse.typeUrl || Array.isArray(o.overrides) && (!o.overrides.length || QuotaOverride.isAmino(o.overrides[0])) && typeof o.next_page_token === "string"); + }, encode(message: ListConsumerOverridesResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.overrides) { QuotaOverride.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -4663,6 +4955,12 @@ export const ListConsumerOverridesResponse = { typeUrl: "/google.api.serviceusage.v1beta1.ListConsumerOverridesResponse", value: ListConsumerOverridesResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ListConsumerOverridesResponse.typeUrl)) { + return; + } + QuotaOverride.registerTypeUrl(); } }; function createBaseBatchCreateConsumerOverridesResponse(): BatchCreateConsumerOverridesResponse { @@ -4678,6 +4976,15 @@ function createBaseBatchCreateConsumerOverridesResponse(): BatchCreateConsumerOv */ export const BatchCreateConsumerOverridesResponse = { typeUrl: "/google.api.serviceusage.v1beta1.BatchCreateConsumerOverridesResponse", + is(o: any): o is BatchCreateConsumerOverridesResponse { + return o && (o.$typeUrl === BatchCreateConsumerOverridesResponse.typeUrl || Array.isArray(o.overrides) && (!o.overrides.length || QuotaOverride.is(o.overrides[0]))); + }, + isSDK(o: any): o is BatchCreateConsumerOverridesResponseSDKType { + return o && (o.$typeUrl === BatchCreateConsumerOverridesResponse.typeUrl || Array.isArray(o.overrides) && (!o.overrides.length || QuotaOverride.isSDK(o.overrides[0]))); + }, + isAmino(o: any): o is BatchCreateConsumerOverridesResponseAmino { + return o && (o.$typeUrl === BatchCreateConsumerOverridesResponse.typeUrl || Array.isArray(o.overrides) && (!o.overrides.length || QuotaOverride.isAmino(o.overrides[0]))); + }, encode(message: BatchCreateConsumerOverridesResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.overrides) { QuotaOverride.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -4750,6 +5057,12 @@ export const BatchCreateConsumerOverridesResponse = { typeUrl: "/google.api.serviceusage.v1beta1.BatchCreateConsumerOverridesResponse", value: BatchCreateConsumerOverridesResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(BatchCreateConsumerOverridesResponse.typeUrl)) { + return; + } + QuotaOverride.registerTypeUrl(); } }; function createBaseImportConsumerOverridesRequest(): ImportConsumerOverridesRequest { @@ -4768,6 +5081,15 @@ function createBaseImportConsumerOverridesRequest(): ImportConsumerOverridesRequ */ export const ImportConsumerOverridesRequest = { typeUrl: "/google.api.serviceusage.v1beta1.ImportConsumerOverridesRequest", + is(o: any): o is ImportConsumerOverridesRequest { + return o && (o.$typeUrl === ImportConsumerOverridesRequest.typeUrl || typeof o.parent === "string" && typeof o.force === "boolean" && Array.isArray(o.forceOnly)); + }, + isSDK(o: any): o is ImportConsumerOverridesRequestSDKType { + return o && (o.$typeUrl === ImportConsumerOverridesRequest.typeUrl || typeof o.parent === "string" && typeof o.force === "boolean" && Array.isArray(o.force_only)); + }, + isAmino(o: any): o is ImportConsumerOverridesRequestAmino { + return o && (o.$typeUrl === ImportConsumerOverridesRequest.typeUrl || typeof o.parent === "string" && typeof o.force === "boolean" && Array.isArray(o.force_only)); + }, encode(message: ImportConsumerOverridesRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.parent !== "") { writer.uint32(10).string(message.parent); @@ -4893,6 +5215,12 @@ export const ImportConsumerOverridesRequest = { typeUrl: "/google.api.serviceusage.v1beta1.ImportConsumerOverridesRequest", value: ImportConsumerOverridesRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ImportConsumerOverridesRequest.typeUrl)) { + return; + } + OverrideInlineSource.registerTypeUrl(); } }; function createBaseImportConsumerOverridesResponse(): ImportConsumerOverridesResponse { @@ -4908,6 +5236,15 @@ function createBaseImportConsumerOverridesResponse(): ImportConsumerOverridesRes */ export const ImportConsumerOverridesResponse = { typeUrl: "/google.api.serviceusage.v1beta1.ImportConsumerOverridesResponse", + is(o: any): o is ImportConsumerOverridesResponse { + return o && (o.$typeUrl === ImportConsumerOverridesResponse.typeUrl || Array.isArray(o.overrides) && (!o.overrides.length || QuotaOverride.is(o.overrides[0]))); + }, + isSDK(o: any): o is ImportConsumerOverridesResponseSDKType { + return o && (o.$typeUrl === ImportConsumerOverridesResponse.typeUrl || Array.isArray(o.overrides) && (!o.overrides.length || QuotaOverride.isSDK(o.overrides[0]))); + }, + isAmino(o: any): o is ImportConsumerOverridesResponseAmino { + return o && (o.$typeUrl === ImportConsumerOverridesResponse.typeUrl || Array.isArray(o.overrides) && (!o.overrides.length || QuotaOverride.isAmino(o.overrides[0]))); + }, encode(message: ImportConsumerOverridesResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.overrides) { QuotaOverride.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -4980,6 +5317,12 @@ export const ImportConsumerOverridesResponse = { typeUrl: "/google.api.serviceusage.v1beta1.ImportConsumerOverridesResponse", value: ImportConsumerOverridesResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ImportConsumerOverridesResponse.typeUrl)) { + return; + } + QuotaOverride.registerTypeUrl(); } }; function createBaseImportConsumerOverridesMetadata(): ImportConsumerOverridesMetadata { @@ -4995,6 +5338,15 @@ function createBaseImportConsumerOverridesMetadata(): ImportConsumerOverridesMet */ export const ImportConsumerOverridesMetadata = { typeUrl: "/google.api.serviceusage.v1beta1.ImportConsumerOverridesMetadata", + is(o: any): o is ImportConsumerOverridesMetadata { + return o && o.$typeUrl === ImportConsumerOverridesMetadata.typeUrl; + }, + isSDK(o: any): o is ImportConsumerOverridesMetadataSDKType { + return o && o.$typeUrl === ImportConsumerOverridesMetadata.typeUrl; + }, + isAmino(o: any): o is ImportConsumerOverridesMetadataAmino { + return o && o.$typeUrl === ImportConsumerOverridesMetadata.typeUrl; + }, encode(_: ImportConsumerOverridesMetadata, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -5046,7 +5398,8 @@ export const ImportConsumerOverridesMetadata = { typeUrl: "/google.api.serviceusage.v1beta1.ImportConsumerOverridesMetadata", value: ImportConsumerOverridesMetadata.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseImportAdminQuotaPoliciesResponse(): ImportAdminQuotaPoliciesResponse { return { @@ -5061,6 +5414,15 @@ function createBaseImportAdminQuotaPoliciesResponse(): ImportAdminQuotaPoliciesR */ export const ImportAdminQuotaPoliciesResponse = { typeUrl: "/google.api.serviceusage.v1beta1.ImportAdminQuotaPoliciesResponse", + is(o: any): o is ImportAdminQuotaPoliciesResponse { + return o && (o.$typeUrl === ImportAdminQuotaPoliciesResponse.typeUrl || Array.isArray(o.policies) && (!o.policies.length || AdminQuotaPolicy.is(o.policies[0]))); + }, + isSDK(o: any): o is ImportAdminQuotaPoliciesResponseSDKType { + return o && (o.$typeUrl === ImportAdminQuotaPoliciesResponse.typeUrl || Array.isArray(o.policies) && (!o.policies.length || AdminQuotaPolicy.isSDK(o.policies[0]))); + }, + isAmino(o: any): o is ImportAdminQuotaPoliciesResponseAmino { + return o && (o.$typeUrl === ImportAdminQuotaPoliciesResponse.typeUrl || Array.isArray(o.policies) && (!o.policies.length || AdminQuotaPolicy.isAmino(o.policies[0]))); + }, encode(message: ImportAdminQuotaPoliciesResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.policies) { AdminQuotaPolicy.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -5133,6 +5495,12 @@ export const ImportAdminQuotaPoliciesResponse = { typeUrl: "/google.api.serviceusage.v1beta1.ImportAdminQuotaPoliciesResponse", value: ImportAdminQuotaPoliciesResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ImportAdminQuotaPoliciesResponse.typeUrl)) { + return; + } + AdminQuotaPolicy.registerTypeUrl(); } }; function createBaseImportAdminQuotaPoliciesMetadata(): ImportAdminQuotaPoliciesMetadata { @@ -5148,6 +5516,15 @@ function createBaseImportAdminQuotaPoliciesMetadata(): ImportAdminQuotaPoliciesM */ export const ImportAdminQuotaPoliciesMetadata = { typeUrl: "/google.api.serviceusage.v1beta1.ImportAdminQuotaPoliciesMetadata", + is(o: any): o is ImportAdminQuotaPoliciesMetadata { + return o && o.$typeUrl === ImportAdminQuotaPoliciesMetadata.typeUrl; + }, + isSDK(o: any): o is ImportAdminQuotaPoliciesMetadataSDKType { + return o && o.$typeUrl === ImportAdminQuotaPoliciesMetadata.typeUrl; + }, + isAmino(o: any): o is ImportAdminQuotaPoliciesMetadataAmino { + return o && o.$typeUrl === ImportAdminQuotaPoliciesMetadata.typeUrl; + }, encode(_: ImportAdminQuotaPoliciesMetadata, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -5199,7 +5576,8 @@ export const ImportAdminQuotaPoliciesMetadata = { typeUrl: "/google.api.serviceusage.v1beta1.ImportAdminQuotaPoliciesMetadata", value: ImportAdminQuotaPoliciesMetadata.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseCreateAdminQuotaPolicyMetadata(): CreateAdminQuotaPolicyMetadata { return {}; @@ -5214,6 +5592,15 @@ function createBaseCreateAdminQuotaPolicyMetadata(): CreateAdminQuotaPolicyMetad */ export const CreateAdminQuotaPolicyMetadata = { typeUrl: "/google.api.serviceusage.v1beta1.CreateAdminQuotaPolicyMetadata", + is(o: any): o is CreateAdminQuotaPolicyMetadata { + return o && o.$typeUrl === CreateAdminQuotaPolicyMetadata.typeUrl; + }, + isSDK(o: any): o is CreateAdminQuotaPolicyMetadataSDKType { + return o && o.$typeUrl === CreateAdminQuotaPolicyMetadata.typeUrl; + }, + isAmino(o: any): o is CreateAdminQuotaPolicyMetadataAmino { + return o && o.$typeUrl === CreateAdminQuotaPolicyMetadata.typeUrl; + }, encode(_: CreateAdminQuotaPolicyMetadata, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -5265,7 +5652,8 @@ export const CreateAdminQuotaPolicyMetadata = { typeUrl: "/google.api.serviceusage.v1beta1.CreateAdminQuotaPolicyMetadata", value: CreateAdminQuotaPolicyMetadata.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseUpdateAdminQuotaPolicyMetadata(): UpdateAdminQuotaPolicyMetadata { return {}; @@ -5280,6 +5668,15 @@ function createBaseUpdateAdminQuotaPolicyMetadata(): UpdateAdminQuotaPolicyMetad */ export const UpdateAdminQuotaPolicyMetadata = { typeUrl: "/google.api.serviceusage.v1beta1.UpdateAdminQuotaPolicyMetadata", + is(o: any): o is UpdateAdminQuotaPolicyMetadata { + return o && o.$typeUrl === UpdateAdminQuotaPolicyMetadata.typeUrl; + }, + isSDK(o: any): o is UpdateAdminQuotaPolicyMetadataSDKType { + return o && o.$typeUrl === UpdateAdminQuotaPolicyMetadata.typeUrl; + }, + isAmino(o: any): o is UpdateAdminQuotaPolicyMetadataAmino { + return o && o.$typeUrl === UpdateAdminQuotaPolicyMetadata.typeUrl; + }, encode(_: UpdateAdminQuotaPolicyMetadata, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -5331,7 +5728,8 @@ export const UpdateAdminQuotaPolicyMetadata = { typeUrl: "/google.api.serviceusage.v1beta1.UpdateAdminQuotaPolicyMetadata", value: UpdateAdminQuotaPolicyMetadata.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseDeleteAdminQuotaPolicyMetadata(): DeleteAdminQuotaPolicyMetadata { return {}; @@ -5346,6 +5744,15 @@ function createBaseDeleteAdminQuotaPolicyMetadata(): DeleteAdminQuotaPolicyMetad */ export const DeleteAdminQuotaPolicyMetadata = { typeUrl: "/google.api.serviceusage.v1beta1.DeleteAdminQuotaPolicyMetadata", + is(o: any): o is DeleteAdminQuotaPolicyMetadata { + return o && o.$typeUrl === DeleteAdminQuotaPolicyMetadata.typeUrl; + }, + isSDK(o: any): o is DeleteAdminQuotaPolicyMetadataSDKType { + return o && o.$typeUrl === DeleteAdminQuotaPolicyMetadata.typeUrl; + }, + isAmino(o: any): o is DeleteAdminQuotaPolicyMetadataAmino { + return o && o.$typeUrl === DeleteAdminQuotaPolicyMetadata.typeUrl; + }, encode(_: DeleteAdminQuotaPolicyMetadata, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -5397,7 +5804,8 @@ export const DeleteAdminQuotaPolicyMetadata = { typeUrl: "/google.api.serviceusage.v1beta1.DeleteAdminQuotaPolicyMetadata", value: DeleteAdminQuotaPolicyMetadata.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseGenerateServiceIdentityRequest(): GenerateServiceIdentityRequest { return { @@ -5412,6 +5820,15 @@ function createBaseGenerateServiceIdentityRequest(): GenerateServiceIdentityRequ */ export const GenerateServiceIdentityRequest = { typeUrl: "/google.api.serviceusage.v1beta1.GenerateServiceIdentityRequest", + is(o: any): o is GenerateServiceIdentityRequest { + return o && (o.$typeUrl === GenerateServiceIdentityRequest.typeUrl || typeof o.parent === "string"); + }, + isSDK(o: any): o is GenerateServiceIdentityRequestSDKType { + return o && (o.$typeUrl === GenerateServiceIdentityRequest.typeUrl || typeof o.parent === "string"); + }, + isAmino(o: any): o is GenerateServiceIdentityRequestAmino { + return o && (o.$typeUrl === GenerateServiceIdentityRequest.typeUrl || typeof o.parent === "string"); + }, encode(message: GenerateServiceIdentityRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.parent !== "") { writer.uint32(10).string(message.parent); @@ -5478,7 +5895,8 @@ export const GenerateServiceIdentityRequest = { typeUrl: "/google.api.serviceusage.v1beta1.GenerateServiceIdentityRequest", value: GenerateServiceIdentityRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseGetServiceIdentityResponse(): GetServiceIdentityResponse { return { @@ -5494,6 +5912,15 @@ function createBaseGetServiceIdentityResponse(): GetServiceIdentityResponse { */ export const GetServiceIdentityResponse = { typeUrl: "/google.api.serviceusage.v1beta1.GetServiceIdentityResponse", + is(o: any): o is GetServiceIdentityResponse { + return o && (o.$typeUrl === GetServiceIdentityResponse.typeUrl || isSet(o.state)); + }, + isSDK(o: any): o is GetServiceIdentityResponseSDKType { + return o && (o.$typeUrl === GetServiceIdentityResponse.typeUrl || isSet(o.state)); + }, + isAmino(o: any): o is GetServiceIdentityResponseAmino { + return o && (o.$typeUrl === GetServiceIdentityResponse.typeUrl || isSet(o.state)); + }, encode(message: GetServiceIdentityResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.identity !== undefined) { ServiceIdentity.encode(message.identity, writer.uint32(10).fork()).ldelim(); @@ -5576,6 +6003,12 @@ export const GetServiceIdentityResponse = { typeUrl: "/google.api.serviceusage.v1beta1.GetServiceIdentityResponse", value: GetServiceIdentityResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GetServiceIdentityResponse.typeUrl)) { + return; + } + ServiceIdentity.registerTypeUrl(); } }; function createBaseGetServiceIdentityMetadata(): GetServiceIdentityMetadata { @@ -5589,6 +6022,15 @@ function createBaseGetServiceIdentityMetadata(): GetServiceIdentityMetadata { */ export const GetServiceIdentityMetadata = { typeUrl: "/google.api.serviceusage.v1beta1.GetServiceIdentityMetadata", + is(o: any): o is GetServiceIdentityMetadata { + return o && o.$typeUrl === GetServiceIdentityMetadata.typeUrl; + }, + isSDK(o: any): o is GetServiceIdentityMetadataSDKType { + return o && o.$typeUrl === GetServiceIdentityMetadata.typeUrl; + }, + isAmino(o: any): o is GetServiceIdentityMetadataAmino { + return o && o.$typeUrl === GetServiceIdentityMetadata.typeUrl; + }, encode(_: GetServiceIdentityMetadata, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -5640,5 +6082,6 @@ export const GetServiceIdentityMetadata = { typeUrl: "/google.api.serviceusage.v1beta1.GetServiceIdentityMetadata", value: GetServiceIdentityMetadata.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/google/api/source_info.ts b/__fixtures__/v-next/outputv3/google/api/source_info.ts index f713c89d81..266f880574 100644 --- a/__fixtures__/v-next/outputv3/google/api/source_info.ts +++ b/__fixtures__/v-next/outputv3/google/api/source_info.ts @@ -52,6 +52,15 @@ function createBaseSourceInfo(): SourceInfo { */ export const SourceInfo = { typeUrl: "/google.api.SourceInfo", + is(o: any): o is SourceInfo { + return o && (o.$typeUrl === SourceInfo.typeUrl || Array.isArray(o.sourceFiles) && (!o.sourceFiles.length || Any.is(o.sourceFiles[0]))); + }, + isSDK(o: any): o is SourceInfoSDKType { + return o && (o.$typeUrl === SourceInfo.typeUrl || Array.isArray(o.source_files) && (!o.source_files.length || Any.isSDK(o.source_files[0]))); + }, + isAmino(o: any): o is SourceInfoAmino { + return o && (o.$typeUrl === SourceInfo.typeUrl || Array.isArray(o.source_files) && (!o.source_files.length || Any.isAmino(o.source_files[0]))); + }, encode(message: SourceInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.sourceFiles) { Any.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -124,5 +133,6 @@ export const SourceInfo = { typeUrl: "/google.api.SourceInfo", value: SourceInfo.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/google/api/system_parameter.ts b/__fixtures__/v-next/outputv3/google/api/system_parameter.ts index 4d5373bd97..957703e4ba 100644 --- a/__fixtures__/v-next/outputv3/google/api/system_parameter.ts +++ b/__fixtures__/v-next/outputv3/google/api/system_parameter.ts @@ -1,5 +1,6 @@ import { BinaryReader, BinaryWriter } from "../../binary"; import { DeepPartial, isSet } from "../../helpers"; +import { GlobalDecoderRegistry } from "../../registry"; export const protobufPackage = "google.api"; /** * ### System parameter configuration @@ -255,6 +256,15 @@ function createBaseSystemParameters(): SystemParameters { */ export const SystemParameters = { typeUrl: "/google.api.SystemParameters", + is(o: any): o is SystemParameters { + return o && (o.$typeUrl === SystemParameters.typeUrl || Array.isArray(o.rules) && (!o.rules.length || SystemParameterRule.is(o.rules[0]))); + }, + isSDK(o: any): o is SystemParametersSDKType { + return o && (o.$typeUrl === SystemParameters.typeUrl || Array.isArray(o.rules) && (!o.rules.length || SystemParameterRule.isSDK(o.rules[0]))); + }, + isAmino(o: any): o is SystemParametersAmino { + return o && (o.$typeUrl === SystemParameters.typeUrl || Array.isArray(o.rules) && (!o.rules.length || SystemParameterRule.isAmino(o.rules[0]))); + }, encode(message: SystemParameters, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.rules) { SystemParameterRule.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -327,6 +337,12 @@ export const SystemParameters = { typeUrl: "/google.api.SystemParameters", value: SystemParameters.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(SystemParameters.typeUrl)) { + return; + } + SystemParameterRule.registerTypeUrl(); } }; function createBaseSystemParameterRule(): SystemParameterRule { @@ -344,6 +360,15 @@ function createBaseSystemParameterRule(): SystemParameterRule { */ export const SystemParameterRule = { typeUrl: "/google.api.SystemParameterRule", + is(o: any): o is SystemParameterRule { + return o && (o.$typeUrl === SystemParameterRule.typeUrl || typeof o.selector === "string" && Array.isArray(o.parameters) && (!o.parameters.length || SystemParameter.is(o.parameters[0]))); + }, + isSDK(o: any): o is SystemParameterRuleSDKType { + return o && (o.$typeUrl === SystemParameterRule.typeUrl || typeof o.selector === "string" && Array.isArray(o.parameters) && (!o.parameters.length || SystemParameter.isSDK(o.parameters[0]))); + }, + isAmino(o: any): o is SystemParameterRuleAmino { + return o && (o.$typeUrl === SystemParameterRule.typeUrl || typeof o.selector === "string" && Array.isArray(o.parameters) && (!o.parameters.length || SystemParameter.isAmino(o.parameters[0]))); + }, encode(message: SystemParameterRule, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.selector !== "") { writer.uint32(10).string(message.selector); @@ -430,6 +455,12 @@ export const SystemParameterRule = { typeUrl: "/google.api.SystemParameterRule", value: SystemParameterRule.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(SystemParameterRule.typeUrl)) { + return; + } + SystemParameter.registerTypeUrl(); } }; function createBaseSystemParameter(): SystemParameter { @@ -449,6 +480,15 @@ function createBaseSystemParameter(): SystemParameter { */ export const SystemParameter = { typeUrl: "/google.api.SystemParameter", + is(o: any): o is SystemParameter { + return o && (o.$typeUrl === SystemParameter.typeUrl || typeof o.name === "string" && typeof o.httpHeader === "string" && typeof o.urlQueryParameter === "string"); + }, + isSDK(o: any): o is SystemParameterSDKType { + return o && (o.$typeUrl === SystemParameter.typeUrl || typeof o.name === "string" && typeof o.http_header === "string" && typeof o.url_query_parameter === "string"); + }, + isAmino(o: any): o is SystemParameterAmino { + return o && (o.$typeUrl === SystemParameter.typeUrl || typeof o.name === "string" && typeof o.http_header === "string" && typeof o.url_query_parameter === "string"); + }, encode(message: SystemParameter, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -543,5 +583,6 @@ export const SystemParameter = { typeUrl: "/google.api.SystemParameter", value: SystemParameter.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/google/api/usage.ts b/__fixtures__/v-next/outputv3/google/api/usage.ts index 10e1a7d0c7..5339fd2a50 100644 --- a/__fixtures__/v-next/outputv3/google/api/usage.ts +++ b/__fixtures__/v-next/outputv3/google/api/usage.ts @@ -1,5 +1,6 @@ import { BinaryReader, BinaryWriter } from "../../binary"; import { isSet, DeepPartial } from "../../helpers"; +import { GlobalDecoderRegistry } from "../../registry"; export const protobufPackage = "google.api"; /** * Configuration controlling usage of a service. @@ -246,6 +247,15 @@ function createBaseUsage(): Usage { */ export const Usage = { typeUrl: "/google.api.Usage", + is(o: any): o is Usage { + return o && (o.$typeUrl === Usage.typeUrl || Array.isArray(o.requirements) && (!o.requirements.length || typeof o.requirements[0] === "string") && Array.isArray(o.rules) && (!o.rules.length || UsageRule.is(o.rules[0])) && typeof o.producerNotificationChannel === "string"); + }, + isSDK(o: any): o is UsageSDKType { + return o && (o.$typeUrl === Usage.typeUrl || Array.isArray(o.requirements) && (!o.requirements.length || typeof o.requirements[0] === "string") && Array.isArray(o.rules) && (!o.rules.length || UsageRule.isSDK(o.rules[0])) && typeof o.producer_notification_channel === "string"); + }, + isAmino(o: any): o is UsageAmino { + return o && (o.$typeUrl === Usage.typeUrl || Array.isArray(o.requirements) && (!o.requirements.length || typeof o.requirements[0] === "string") && Array.isArray(o.rules) && (!o.rules.length || UsageRule.isAmino(o.rules[0])) && typeof o.producer_notification_channel === "string"); + }, encode(message: Usage, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.requirements) { writer.uint32(10).string(v!); @@ -352,6 +362,12 @@ export const Usage = { typeUrl: "/google.api.Usage", value: Usage.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Usage.typeUrl)) { + return; + } + UsageRule.registerTypeUrl(); } }; function createBaseUsageRule(): UsageRule { @@ -393,6 +409,15 @@ function createBaseUsageRule(): UsageRule { */ export const UsageRule = { typeUrl: "/google.api.UsageRule", + is(o: any): o is UsageRule { + return o && (o.$typeUrl === UsageRule.typeUrl || typeof o.selector === "string" && typeof o.allowUnregisteredCalls === "boolean" && typeof o.skipServiceControl === "boolean"); + }, + isSDK(o: any): o is UsageRuleSDKType { + return o && (o.$typeUrl === UsageRule.typeUrl || typeof o.selector === "string" && typeof o.allow_unregistered_calls === "boolean" && typeof o.skip_service_control === "boolean"); + }, + isAmino(o: any): o is UsageRuleAmino { + return o && (o.$typeUrl === UsageRule.typeUrl || typeof o.selector === "string" && typeof o.allow_unregistered_calls === "boolean" && typeof o.skip_service_control === "boolean"); + }, encode(message: UsageRule, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.selector !== "") { writer.uint32(10).string(message.selector); @@ -487,5 +512,6 @@ export const UsageRule = { typeUrl: "/google.api.UsageRule", value: UsageRule.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/google/api/visibility.ts b/__fixtures__/v-next/outputv3/google/api/visibility.ts index 68c48bfc44..5bcc871feb 100644 --- a/__fixtures__/v-next/outputv3/google/api/visibility.ts +++ b/__fixtures__/v-next/outputv3/google/api/visibility.ts @@ -1,5 +1,6 @@ import { BinaryReader, BinaryWriter } from "../../binary"; import { DeepPartial, isSet } from "../../helpers"; +import { GlobalDecoderRegistry } from "../../registry"; export const protobufPackage = "google.api"; /** * `Visibility` defines restrictions for the visibility of service @@ -220,6 +221,15 @@ function createBaseVisibility(): Visibility { */ export const Visibility = { typeUrl: "/google.api.Visibility", + is(o: any): o is Visibility { + return o && (o.$typeUrl === Visibility.typeUrl || Array.isArray(o.rules) && (!o.rules.length || VisibilityRule.is(o.rules[0]))); + }, + isSDK(o: any): o is VisibilitySDKType { + return o && (o.$typeUrl === Visibility.typeUrl || Array.isArray(o.rules) && (!o.rules.length || VisibilityRule.isSDK(o.rules[0]))); + }, + isAmino(o: any): o is VisibilityAmino { + return o && (o.$typeUrl === Visibility.typeUrl || Array.isArray(o.rules) && (!o.rules.length || VisibilityRule.isAmino(o.rules[0]))); + }, encode(message: Visibility, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.rules) { VisibilityRule.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -292,6 +302,12 @@ export const Visibility = { typeUrl: "/google.api.Visibility", value: Visibility.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Visibility.typeUrl)) { + return; + } + VisibilityRule.registerTypeUrl(); } }; function createBaseVisibilityRule(): VisibilityRule { @@ -309,6 +325,15 @@ function createBaseVisibilityRule(): VisibilityRule { */ export const VisibilityRule = { typeUrl: "/google.api.VisibilityRule", + is(o: any): o is VisibilityRule { + return o && (o.$typeUrl === VisibilityRule.typeUrl || typeof o.selector === "string" && typeof o.restriction === "string"); + }, + isSDK(o: any): o is VisibilityRuleSDKType { + return o && (o.$typeUrl === VisibilityRule.typeUrl || typeof o.selector === "string" && typeof o.restriction === "string"); + }, + isAmino(o: any): o is VisibilityRuleAmino { + return o && (o.$typeUrl === VisibilityRule.typeUrl || typeof o.selector === "string" && typeof o.restriction === "string"); + }, encode(message: VisibilityRule, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.selector !== "") { writer.uint32(10).string(message.selector); @@ -389,5 +414,6 @@ export const VisibilityRule = { typeUrl: "/google.api.VisibilityRule", value: VisibilityRule.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/google/logging/type/http_request.ts b/__fixtures__/v-next/outputv3/google/logging/type/http_request.ts index bc8e8c2e39..c9750f6e49 100644 --- a/__fixtures__/v-next/outputv3/google/logging/type/http_request.ts +++ b/__fixtures__/v-next/outputv3/google/logging/type/http_request.ts @@ -1,5 +1,6 @@ import { Duration, DurationAmino, DurationSDKType } from "../../protobuf/duration"; import { BinaryReader, BinaryWriter } from "../../../binary"; +import { GlobalDecoderRegistry } from "../../../registry"; import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "google.logging.type"; /** @@ -236,6 +237,15 @@ function createBaseHttpRequest(): HttpRequest { */ export const HttpRequest = { typeUrl: "/google.logging.type.HttpRequest", + is(o: any): o is HttpRequest { + return o && (o.$typeUrl === HttpRequest.typeUrl || typeof o.requestMethod === "string" && typeof o.requestUrl === "string" && typeof o.requestSize === "bigint" && typeof o.status === "number" && typeof o.responseSize === "bigint" && typeof o.userAgent === "string" && typeof o.remoteIp === "string" && typeof o.serverIp === "string" && typeof o.referer === "string" && typeof o.cacheLookup === "boolean" && typeof o.cacheHit === "boolean" && typeof o.cacheValidatedWithOriginServer === "boolean" && typeof o.cacheFillBytes === "bigint" && typeof o.protocol === "string"); + }, + isSDK(o: any): o is HttpRequestSDKType { + return o && (o.$typeUrl === HttpRequest.typeUrl || typeof o.request_method === "string" && typeof o.request_url === "string" && typeof o.request_size === "bigint" && typeof o.status === "number" && typeof o.response_size === "bigint" && typeof o.user_agent === "string" && typeof o.remote_ip === "string" && typeof o.server_ip === "string" && typeof o.referer === "string" && typeof o.cache_lookup === "boolean" && typeof o.cache_hit === "boolean" && typeof o.cache_validated_with_origin_server === "boolean" && typeof o.cache_fill_bytes === "bigint" && typeof o.protocol === "string"); + }, + isAmino(o: any): o is HttpRequestAmino { + return o && (o.$typeUrl === HttpRequest.typeUrl || typeof o.request_method === "string" && typeof o.request_url === "string" && typeof o.request_size === "bigint" && typeof o.status === "number" && typeof o.response_size === "bigint" && typeof o.user_agent === "string" && typeof o.remote_ip === "string" && typeof o.server_ip === "string" && typeof o.referer === "string" && typeof o.cache_lookup === "boolean" && typeof o.cache_hit === "boolean" && typeof o.cache_validated_with_origin_server === "boolean" && typeof o.cache_fill_bytes === "bigint" && typeof o.protocol === "string"); + }, encode(message: HttpRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.requestMethod !== "") { writer.uint32(10).string(message.requestMethod); @@ -506,5 +516,6 @@ export const HttpRequest = { typeUrl: "/google.logging.type.HttpRequest", value: HttpRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/google/logging/v2/log_entry.ts b/__fixtures__/v-next/outputv3/google/logging/v2/log_entry.ts index 838cf836ea..b08077c257 100644 --- a/__fixtures__/v-next/outputv3/google/logging/v2/log_entry.ts +++ b/__fixtures__/v-next/outputv3/google/logging/v2/log_entry.ts @@ -6,6 +6,7 @@ import { LogSeverity, LogSeveritySDKType, logSeverityFromJSON, logSeverityToJSON import { HttpRequest, HttpRequestAmino, HttpRequestSDKType } from "../type/http_request"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { isSet, DeepPartial, toTimestamp, fromTimestamp, isObject } from "../../../helpers"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "google.logging.v2"; /** * @name LogEntry_LabelsEntry @@ -691,7 +692,8 @@ export const LogEntry_LabelsEntry = { }, toProto(message: LogEntry_LabelsEntry): Uint8Array { return LogEntry_LabelsEntry.encode(message).finish(); - } + }, + registerTypeUrl() {} }; function createBaseLogEntry(): LogEntry { return { @@ -722,6 +724,15 @@ function createBaseLogEntry(): LogEntry { */ export const LogEntry = { typeUrl: "/google.logging.v2.LogEntry", + is(o: any): o is LogEntry { + return o && (o.$typeUrl === LogEntry.typeUrl || typeof o.logName === "string" && isSet(o.severity) && typeof o.insertId === "string" && isSet(o.labels) && typeof o.trace === "string" && typeof o.spanId === "string" && typeof o.traceSampled === "boolean"); + }, + isSDK(o: any): o is LogEntrySDKType { + return o && (o.$typeUrl === LogEntry.typeUrl || typeof o.log_name === "string" && isSet(o.severity) && typeof o.insert_id === "string" && isSet(o.labels) && typeof o.trace === "string" && typeof o.span_id === "string" && typeof o.trace_sampled === "boolean"); + }, + isAmino(o: any): o is LogEntryAmino { + return o && (o.$typeUrl === LogEntry.typeUrl || typeof o.log_name === "string" && isSet(o.severity) && typeof o.insert_id === "string" && isSet(o.labels) && typeof o.trace === "string" && typeof o.span_id === "string" && typeof o.trace_sampled === "boolean"); + }, encode(message: LogEntry, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.logName !== "") { writer.uint32(98).string(message.logName); @@ -1064,6 +1075,16 @@ export const LogEntry = { typeUrl: "/google.logging.v2.LogEntry", value: LogEntry.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(LogEntry.typeUrl)) { + return; + } + Struct.registerTypeUrl(); + HttpRequest.registerTypeUrl(); + LogEntryOperation.registerTypeUrl(); + LogEntrySourceLocation.registerTypeUrl(); + LogSplit.registerTypeUrl(); } }; function createBaseLogEntryOperation(): LogEntryOperation { @@ -1083,6 +1104,15 @@ function createBaseLogEntryOperation(): LogEntryOperation { */ export const LogEntryOperation = { typeUrl: "/google.logging.v2.LogEntryOperation", + is(o: any): o is LogEntryOperation { + return o && (o.$typeUrl === LogEntryOperation.typeUrl || typeof o.id === "string" && typeof o.producer === "string" && typeof o.first === "boolean" && typeof o.last === "boolean"); + }, + isSDK(o: any): o is LogEntryOperationSDKType { + return o && (o.$typeUrl === LogEntryOperation.typeUrl || typeof o.id === "string" && typeof o.producer === "string" && typeof o.first === "boolean" && typeof o.last === "boolean"); + }, + isAmino(o: any): o is LogEntryOperationAmino { + return o && (o.$typeUrl === LogEntryOperation.typeUrl || typeof o.id === "string" && typeof o.producer === "string" && typeof o.first === "boolean" && typeof o.last === "boolean"); + }, encode(message: LogEntryOperation, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.id !== "") { writer.uint32(10).string(message.id); @@ -1191,7 +1221,8 @@ export const LogEntryOperation = { typeUrl: "/google.logging.v2.LogEntryOperation", value: LogEntryOperation.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseLogEntrySourceLocation(): LogEntrySourceLocation { return { @@ -1209,6 +1240,15 @@ function createBaseLogEntrySourceLocation(): LogEntrySourceLocation { */ export const LogEntrySourceLocation = { typeUrl: "/google.logging.v2.LogEntrySourceLocation", + is(o: any): o is LogEntrySourceLocation { + return o && (o.$typeUrl === LogEntrySourceLocation.typeUrl || typeof o.file === "string" && typeof o.line === "bigint" && typeof o.function === "string"); + }, + isSDK(o: any): o is LogEntrySourceLocationSDKType { + return o && (o.$typeUrl === LogEntrySourceLocation.typeUrl || typeof o.file === "string" && typeof o.line === "bigint" && typeof o.function === "string"); + }, + isAmino(o: any): o is LogEntrySourceLocationAmino { + return o && (o.$typeUrl === LogEntrySourceLocation.typeUrl || typeof o.file === "string" && typeof o.line === "bigint" && typeof o.function === "string"); + }, encode(message: LogEntrySourceLocation, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.file !== "") { writer.uint32(10).string(message.file); @@ -1305,7 +1345,8 @@ export const LogEntrySourceLocation = { typeUrl: "/google.logging.v2.LogEntrySourceLocation", value: LogEntrySourceLocation.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseLogSplit(): LogSplit { return { @@ -1324,6 +1365,15 @@ function createBaseLogSplit(): LogSplit { */ export const LogSplit = { typeUrl: "/google.logging.v2.LogSplit", + is(o: any): o is LogSplit { + return o && (o.$typeUrl === LogSplit.typeUrl || typeof o.uid === "string" && typeof o.index === "number" && typeof o.totalSplits === "number"); + }, + isSDK(o: any): o is LogSplitSDKType { + return o && (o.$typeUrl === LogSplit.typeUrl || typeof o.uid === "string" && typeof o.index === "number" && typeof o.total_splits === "number"); + }, + isAmino(o: any): o is LogSplitAmino { + return o && (o.$typeUrl === LogSplit.typeUrl || typeof o.uid === "string" && typeof o.index === "number" && typeof o.total_splits === "number"); + }, encode(message: LogSplit, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.uid !== "") { writer.uint32(10).string(message.uid); @@ -1418,5 +1468,6 @@ export const LogSplit = { typeUrl: "/google.logging.v2.LogSplit", value: LogSplit.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/google/logging/v2/logging.ts b/__fixtures__/v-next/outputv3/google/logging/v2/logging.ts index 1edf847553..048b3695d3 100644 --- a/__fixtures__/v-next/outputv3/google/logging/v2/logging.ts +++ b/__fixtures__/v-next/outputv3/google/logging/v2/logging.ts @@ -4,6 +4,7 @@ import { Duration, DurationAmino, DurationSDKType } from "../../protobuf/duratio import { Status, StatusAmino, StatusSDKType } from "../../rpc/status"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { isSet, DeepPartial, isObject } from "../../../helpers"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "google.logging.v2"; /** An indicator of why entries were omitted. */ export enum TailLogEntriesResponse_SuppressionInfo_Reason { @@ -1141,6 +1142,15 @@ function createBaseDeleteLogRequest(): DeleteLogRequest { */ export const DeleteLogRequest = { typeUrl: "/google.logging.v2.DeleteLogRequest", + is(o: any): o is DeleteLogRequest { + return o && (o.$typeUrl === DeleteLogRequest.typeUrl || typeof o.logName === "string"); + }, + isSDK(o: any): o is DeleteLogRequestSDKType { + return o && (o.$typeUrl === DeleteLogRequest.typeUrl || typeof o.log_name === "string"); + }, + isAmino(o: any): o is DeleteLogRequestAmino { + return o && (o.$typeUrl === DeleteLogRequest.typeUrl || typeof o.log_name === "string"); + }, encode(message: DeleteLogRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.logName !== "") { writer.uint32(10).string(message.logName); @@ -1207,7 +1217,8 @@ export const DeleteLogRequest = { typeUrl: "/google.logging.v2.DeleteLogRequest", value: DeleteLogRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseWriteLogEntriesRequest_LabelsEntry(): WriteLogEntriesRequest_LabelsEntry { return { @@ -1295,7 +1306,8 @@ export const WriteLogEntriesRequest_LabelsEntry = { }, toProto(message: WriteLogEntriesRequest_LabelsEntry): Uint8Array { return WriteLogEntriesRequest_LabelsEntry.encode(message).finish(); - } + }, + registerTypeUrl() {} }; function createBaseWriteLogEntriesRequest(): WriteLogEntriesRequest { return { @@ -1315,6 +1327,15 @@ function createBaseWriteLogEntriesRequest(): WriteLogEntriesRequest { */ export const WriteLogEntriesRequest = { typeUrl: "/google.logging.v2.WriteLogEntriesRequest", + is(o: any): o is WriteLogEntriesRequest { + return o && (o.$typeUrl === WriteLogEntriesRequest.typeUrl || typeof o.logName === "string" && isSet(o.labels) && Array.isArray(o.entries) && (!o.entries.length || LogEntry.is(o.entries[0])) && typeof o.partialSuccess === "boolean" && typeof o.dryRun === "boolean"); + }, + isSDK(o: any): o is WriteLogEntriesRequestSDKType { + return o && (o.$typeUrl === WriteLogEntriesRequest.typeUrl || typeof o.log_name === "string" && isSet(o.labels) && Array.isArray(o.entries) && (!o.entries.length || LogEntry.isSDK(o.entries[0])) && typeof o.partial_success === "boolean" && typeof o.dry_run === "boolean"); + }, + isAmino(o: any): o is WriteLogEntriesRequestAmino { + return o && (o.$typeUrl === WriteLogEntriesRequest.typeUrl || typeof o.log_name === "string" && isSet(o.labels) && Array.isArray(o.entries) && (!o.entries.length || LogEntry.isAmino(o.entries[0])) && typeof o.partial_success === "boolean" && typeof o.dry_run === "boolean"); + }, encode(message: WriteLogEntriesRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.logName !== "") { writer.uint32(10).string(message.logName); @@ -1497,6 +1518,13 @@ export const WriteLogEntriesRequest = { typeUrl: "/google.logging.v2.WriteLogEntriesRequest", value: WriteLogEntriesRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(WriteLogEntriesRequest.typeUrl)) { + return; + } + MonitoredResource.registerTypeUrl(); + LogEntry.registerTypeUrl(); } }; function createBaseWriteLogEntriesResponse(): WriteLogEntriesResponse { @@ -1510,6 +1538,15 @@ function createBaseWriteLogEntriesResponse(): WriteLogEntriesResponse { */ export const WriteLogEntriesResponse = { typeUrl: "/google.logging.v2.WriteLogEntriesResponse", + is(o: any): o is WriteLogEntriesResponse { + return o && o.$typeUrl === WriteLogEntriesResponse.typeUrl; + }, + isSDK(o: any): o is WriteLogEntriesResponseSDKType { + return o && o.$typeUrl === WriteLogEntriesResponse.typeUrl; + }, + isAmino(o: any): o is WriteLogEntriesResponseAmino { + return o && o.$typeUrl === WriteLogEntriesResponse.typeUrl; + }, encode(_: WriteLogEntriesResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -1561,7 +1598,8 @@ export const WriteLogEntriesResponse = { typeUrl: "/google.logging.v2.WriteLogEntriesResponse", value: WriteLogEntriesResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseWriteLogEntriesPartialErrors_LogEntryErrorsEntry(): WriteLogEntriesPartialErrors_LogEntryErrorsEntry { return { @@ -1651,6 +1689,9 @@ export const WriteLogEntriesPartialErrors_LogEntryErrorsEntry = { }, toProto(message: WriteLogEntriesPartialErrors_LogEntryErrorsEntry): Uint8Array { return WriteLogEntriesPartialErrors_LogEntryErrorsEntry.encode(message).finish(); + }, + registerTypeUrl() { + Status.registerTypeUrl(); } }; function createBaseWriteLogEntriesPartialErrors(): WriteLogEntriesPartialErrors { @@ -1666,6 +1707,15 @@ function createBaseWriteLogEntriesPartialErrors(): WriteLogEntriesPartialErrors */ export const WriteLogEntriesPartialErrors = { typeUrl: "/google.logging.v2.WriteLogEntriesPartialErrors", + is(o: any): o is WriteLogEntriesPartialErrors { + return o && (o.$typeUrl === WriteLogEntriesPartialErrors.typeUrl || isSet(o.logEntryErrors)); + }, + isSDK(o: any): o is WriteLogEntriesPartialErrorsSDKType { + return o && (o.$typeUrl === WriteLogEntriesPartialErrors.typeUrl || isSet(o.log_entry_errors)); + }, + isAmino(o: any): o is WriteLogEntriesPartialErrorsAmino { + return o && (o.$typeUrl === WriteLogEntriesPartialErrors.typeUrl || isSet(o.log_entry_errors)); + }, encode(message: WriteLogEntriesPartialErrors, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { Object.entries(message.logEntryErrors).forEach(([key, value]) => { WriteLogEntriesPartialErrors_LogEntryErrorsEntry.encode({ @@ -1770,6 +1820,12 @@ export const WriteLogEntriesPartialErrors = { typeUrl: "/google.logging.v2.WriteLogEntriesPartialErrors", value: WriteLogEntriesPartialErrors.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(WriteLogEntriesPartialErrors.typeUrl)) { + return; + } + Status.registerTypeUrl(); } }; function createBaseListLogEntriesRequest(): ListLogEntriesRequest { @@ -1789,6 +1845,15 @@ function createBaseListLogEntriesRequest(): ListLogEntriesRequest { */ export const ListLogEntriesRequest = { typeUrl: "/google.logging.v2.ListLogEntriesRequest", + is(o: any): o is ListLogEntriesRequest { + return o && (o.$typeUrl === ListLogEntriesRequest.typeUrl || Array.isArray(o.resourceNames) && (!o.resourceNames.length || typeof o.resourceNames[0] === "string") && typeof o.filter === "string" && typeof o.orderBy === "string" && typeof o.pageSize === "number" && typeof o.pageToken === "string"); + }, + isSDK(o: any): o is ListLogEntriesRequestSDKType { + return o && (o.$typeUrl === ListLogEntriesRequest.typeUrl || Array.isArray(o.resource_names) && (!o.resource_names.length || typeof o.resource_names[0] === "string") && typeof o.filter === "string" && typeof o.order_by === "string" && typeof o.page_size === "number" && typeof o.page_token === "string"); + }, + isAmino(o: any): o is ListLogEntriesRequestAmino { + return o && (o.$typeUrl === ListLogEntriesRequest.typeUrl || Array.isArray(o.resource_names) && (!o.resource_names.length || typeof o.resource_names[0] === "string") && typeof o.filter === "string" && typeof o.order_by === "string" && typeof o.page_size === "number" && typeof o.page_token === "string"); + }, encode(message: ListLogEntriesRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.resourceNames) { writer.uint32(66).string(v!); @@ -1917,7 +1982,8 @@ export const ListLogEntriesRequest = { typeUrl: "/google.logging.v2.ListLogEntriesRequest", value: ListLogEntriesRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseListLogEntriesResponse(): ListLogEntriesResponse { return { @@ -1933,6 +1999,15 @@ function createBaseListLogEntriesResponse(): ListLogEntriesResponse { */ export const ListLogEntriesResponse = { typeUrl: "/google.logging.v2.ListLogEntriesResponse", + is(o: any): o is ListLogEntriesResponse { + return o && (o.$typeUrl === ListLogEntriesResponse.typeUrl || Array.isArray(o.entries) && (!o.entries.length || LogEntry.is(o.entries[0])) && typeof o.nextPageToken === "string"); + }, + isSDK(o: any): o is ListLogEntriesResponseSDKType { + return o && (o.$typeUrl === ListLogEntriesResponse.typeUrl || Array.isArray(o.entries) && (!o.entries.length || LogEntry.isSDK(o.entries[0])) && typeof o.next_page_token === "string"); + }, + isAmino(o: any): o is ListLogEntriesResponseAmino { + return o && (o.$typeUrl === ListLogEntriesResponse.typeUrl || Array.isArray(o.entries) && (!o.entries.length || LogEntry.isAmino(o.entries[0])) && typeof o.next_page_token === "string"); + }, encode(message: ListLogEntriesResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.entries) { LogEntry.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -2019,6 +2094,12 @@ export const ListLogEntriesResponse = { typeUrl: "/google.logging.v2.ListLogEntriesResponse", value: ListLogEntriesResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ListLogEntriesResponse.typeUrl)) { + return; + } + LogEntry.registerTypeUrl(); } }; function createBaseListMonitoredResourceDescriptorsRequest(): ListMonitoredResourceDescriptorsRequest { @@ -2035,6 +2116,15 @@ function createBaseListMonitoredResourceDescriptorsRequest(): ListMonitoredResou */ export const ListMonitoredResourceDescriptorsRequest = { typeUrl: "/google.logging.v2.ListMonitoredResourceDescriptorsRequest", + is(o: any): o is ListMonitoredResourceDescriptorsRequest { + return o && (o.$typeUrl === ListMonitoredResourceDescriptorsRequest.typeUrl || typeof o.pageSize === "number" && typeof o.pageToken === "string"); + }, + isSDK(o: any): o is ListMonitoredResourceDescriptorsRequestSDKType { + return o && (o.$typeUrl === ListMonitoredResourceDescriptorsRequest.typeUrl || typeof o.page_size === "number" && typeof o.page_token === "string"); + }, + isAmino(o: any): o is ListMonitoredResourceDescriptorsRequestAmino { + return o && (o.$typeUrl === ListMonitoredResourceDescriptorsRequest.typeUrl || typeof o.page_size === "number" && typeof o.page_token === "string"); + }, encode(message: ListMonitoredResourceDescriptorsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.pageSize !== 0) { writer.uint32(8).int32(message.pageSize); @@ -2115,7 +2205,8 @@ export const ListMonitoredResourceDescriptorsRequest = { typeUrl: "/google.logging.v2.ListMonitoredResourceDescriptorsRequest", value: ListMonitoredResourceDescriptorsRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseListMonitoredResourceDescriptorsResponse(): ListMonitoredResourceDescriptorsResponse { return { @@ -2131,6 +2222,15 @@ function createBaseListMonitoredResourceDescriptorsResponse(): ListMonitoredReso */ export const ListMonitoredResourceDescriptorsResponse = { typeUrl: "/google.logging.v2.ListMonitoredResourceDescriptorsResponse", + is(o: any): o is ListMonitoredResourceDescriptorsResponse { + return o && (o.$typeUrl === ListMonitoredResourceDescriptorsResponse.typeUrl || Array.isArray(o.resourceDescriptors) && (!o.resourceDescriptors.length || MonitoredResourceDescriptor.is(o.resourceDescriptors[0])) && typeof o.nextPageToken === "string"); + }, + isSDK(o: any): o is ListMonitoredResourceDescriptorsResponseSDKType { + return o && (o.$typeUrl === ListMonitoredResourceDescriptorsResponse.typeUrl || Array.isArray(o.resource_descriptors) && (!o.resource_descriptors.length || MonitoredResourceDescriptor.isSDK(o.resource_descriptors[0])) && typeof o.next_page_token === "string"); + }, + isAmino(o: any): o is ListMonitoredResourceDescriptorsResponseAmino { + return o && (o.$typeUrl === ListMonitoredResourceDescriptorsResponse.typeUrl || Array.isArray(o.resource_descriptors) && (!o.resource_descriptors.length || MonitoredResourceDescriptor.isAmino(o.resource_descriptors[0])) && typeof o.next_page_token === "string"); + }, encode(message: ListMonitoredResourceDescriptorsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.resourceDescriptors) { MonitoredResourceDescriptor.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -2217,6 +2317,12 @@ export const ListMonitoredResourceDescriptorsResponse = { typeUrl: "/google.logging.v2.ListMonitoredResourceDescriptorsResponse", value: ListMonitoredResourceDescriptorsResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ListMonitoredResourceDescriptorsResponse.typeUrl)) { + return; + } + MonitoredResourceDescriptor.registerTypeUrl(); } }; function createBaseListLogsRequest(): ListLogsRequest { @@ -2235,6 +2341,15 @@ function createBaseListLogsRequest(): ListLogsRequest { */ export const ListLogsRequest = { typeUrl: "/google.logging.v2.ListLogsRequest", + is(o: any): o is ListLogsRequest { + return o && (o.$typeUrl === ListLogsRequest.typeUrl || typeof o.parent === "string" && typeof o.pageSize === "number" && typeof o.pageToken === "string" && Array.isArray(o.resourceNames) && (!o.resourceNames.length || typeof o.resourceNames[0] === "string")); + }, + isSDK(o: any): o is ListLogsRequestSDKType { + return o && (o.$typeUrl === ListLogsRequest.typeUrl || typeof o.parent === "string" && typeof o.page_size === "number" && typeof o.page_token === "string" && Array.isArray(o.resource_names) && (!o.resource_names.length || typeof o.resource_names[0] === "string")); + }, + isAmino(o: any): o is ListLogsRequestAmino { + return o && (o.$typeUrl === ListLogsRequest.typeUrl || typeof o.parent === "string" && typeof o.page_size === "number" && typeof o.page_token === "string" && Array.isArray(o.resource_names) && (!o.resource_names.length || typeof o.resource_names[0] === "string")); + }, encode(message: ListLogsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.parent !== "") { writer.uint32(10).string(message.parent); @@ -2349,7 +2464,8 @@ export const ListLogsRequest = { typeUrl: "/google.logging.v2.ListLogsRequest", value: ListLogsRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseListLogsResponse(): ListLogsResponse { return { @@ -2365,6 +2481,15 @@ function createBaseListLogsResponse(): ListLogsResponse { */ export const ListLogsResponse = { typeUrl: "/google.logging.v2.ListLogsResponse", + is(o: any): o is ListLogsResponse { + return o && (o.$typeUrl === ListLogsResponse.typeUrl || Array.isArray(o.logNames) && (!o.logNames.length || typeof o.logNames[0] === "string") && typeof o.nextPageToken === "string"); + }, + isSDK(o: any): o is ListLogsResponseSDKType { + return o && (o.$typeUrl === ListLogsResponse.typeUrl || Array.isArray(o.log_names) && (!o.log_names.length || typeof o.log_names[0] === "string") && typeof o.next_page_token === "string"); + }, + isAmino(o: any): o is ListLogsResponseAmino { + return o && (o.$typeUrl === ListLogsResponse.typeUrl || Array.isArray(o.log_names) && (!o.log_names.length || typeof o.log_names[0] === "string") && typeof o.next_page_token === "string"); + }, encode(message: ListLogsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.logNames) { writer.uint32(26).string(v!); @@ -2451,7 +2576,8 @@ export const ListLogsResponse = { typeUrl: "/google.logging.v2.ListLogsResponse", value: ListLogsResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseTailLogEntriesRequest(): TailLogEntriesRequest { return { @@ -2468,6 +2594,15 @@ function createBaseTailLogEntriesRequest(): TailLogEntriesRequest { */ export const TailLogEntriesRequest = { typeUrl: "/google.logging.v2.TailLogEntriesRequest", + is(o: any): o is TailLogEntriesRequest { + return o && (o.$typeUrl === TailLogEntriesRequest.typeUrl || Array.isArray(o.resourceNames) && (!o.resourceNames.length || typeof o.resourceNames[0] === "string") && typeof o.filter === "string"); + }, + isSDK(o: any): o is TailLogEntriesRequestSDKType { + return o && (o.$typeUrl === TailLogEntriesRequest.typeUrl || Array.isArray(o.resource_names) && (!o.resource_names.length || typeof o.resource_names[0] === "string") && typeof o.filter === "string"); + }, + isAmino(o: any): o is TailLogEntriesRequestAmino { + return o && (o.$typeUrl === TailLogEntriesRequest.typeUrl || Array.isArray(o.resource_names) && (!o.resource_names.length || typeof o.resource_names[0] === "string") && typeof o.filter === "string"); + }, encode(message: TailLogEntriesRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.resourceNames) { writer.uint32(10).string(v!); @@ -2570,7 +2705,8 @@ export const TailLogEntriesRequest = { typeUrl: "/google.logging.v2.TailLogEntriesRequest", value: TailLogEntriesRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseTailLogEntriesResponse(): TailLogEntriesResponse { return { @@ -2586,6 +2722,15 @@ function createBaseTailLogEntriesResponse(): TailLogEntriesResponse { */ export const TailLogEntriesResponse = { typeUrl: "/google.logging.v2.TailLogEntriesResponse", + is(o: any): o is TailLogEntriesResponse { + return o && (o.$typeUrl === TailLogEntriesResponse.typeUrl || Array.isArray(o.entries) && (!o.entries.length || LogEntry.is(o.entries[0])) && Array.isArray(o.suppressionInfo) && (!o.suppressionInfo.length || TailLogEntriesResponse_SuppressionInfo.is(o.suppressionInfo[0]))); + }, + isSDK(o: any): o is TailLogEntriesResponseSDKType { + return o && (o.$typeUrl === TailLogEntriesResponse.typeUrl || Array.isArray(o.entries) && (!o.entries.length || LogEntry.isSDK(o.entries[0])) && Array.isArray(o.suppression_info) && (!o.suppression_info.length || TailLogEntriesResponse_SuppressionInfo.isSDK(o.suppression_info[0]))); + }, + isAmino(o: any): o is TailLogEntriesResponseAmino { + return o && (o.$typeUrl === TailLogEntriesResponse.typeUrl || Array.isArray(o.entries) && (!o.entries.length || LogEntry.isAmino(o.entries[0])) && Array.isArray(o.suppression_info) && (!o.suppression_info.length || TailLogEntriesResponse_SuppressionInfo.isAmino(o.suppression_info[0]))); + }, encode(message: TailLogEntriesResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.entries) { LogEntry.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -2678,6 +2823,13 @@ export const TailLogEntriesResponse = { typeUrl: "/google.logging.v2.TailLogEntriesResponse", value: TailLogEntriesResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(TailLogEntriesResponse.typeUrl)) { + return; + } + LogEntry.registerTypeUrl(); + TailLogEntriesResponse_SuppressionInfo.registerTypeUrl(); } }; function createBaseTailLogEntriesResponse_SuppressionInfo(): TailLogEntriesResponse_SuppressionInfo { @@ -2694,6 +2846,15 @@ function createBaseTailLogEntriesResponse_SuppressionInfo(): TailLogEntriesRespo */ export const TailLogEntriesResponse_SuppressionInfo = { typeUrl: "/google.logging.v2.SuppressionInfo", + is(o: any): o is TailLogEntriesResponse_SuppressionInfo { + return o && (o.$typeUrl === TailLogEntriesResponse_SuppressionInfo.typeUrl || isSet(o.reason) && typeof o.suppressedCount === "number"); + }, + isSDK(o: any): o is TailLogEntriesResponse_SuppressionInfoSDKType { + return o && (o.$typeUrl === TailLogEntriesResponse_SuppressionInfo.typeUrl || isSet(o.reason) && typeof o.suppressed_count === "number"); + }, + isAmino(o: any): o is TailLogEntriesResponse_SuppressionInfoAmino { + return o && (o.$typeUrl === TailLogEntriesResponse_SuppressionInfo.typeUrl || isSet(o.reason) && typeof o.suppressed_count === "number"); + }, encode(message: TailLogEntriesResponse_SuppressionInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.reason !== 0) { writer.uint32(8).int32(message.reason); @@ -2774,5 +2935,6 @@ export const TailLogEntriesResponse_SuppressionInfo = { typeUrl: "/google.logging.v2.SuppressionInfo", value: TailLogEntriesResponse_SuppressionInfo.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/google/logging/v2/logging_config.ts b/__fixtures__/v-next/outputv3/google/logging/v2/logging_config.ts index e0b85d8554..4c8af407d2 100644 --- a/__fixtures__/v-next/outputv3/google/logging/v2/logging_config.ts +++ b/__fixtures__/v-next/outputv3/google/logging/v2/logging_config.ts @@ -1,7 +1,8 @@ import { FieldMask, FieldMaskAmino, FieldMaskSDKType } from "../../protobuf/field_mask"; import { Timestamp, TimestampAmino, TimestampSDKType } from "../../protobuf/timestamp"; +import { isSet, toTimestamp, fromTimestamp, DeepPartial } from "../../../helpers"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { toTimestamp, fromTimestamp, isSet, DeepPartial } from "../../../helpers"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "google.logging.v2"; /** Deprecated. This is unused. */ export enum LogSink_VersionFormat { @@ -3545,6 +3546,15 @@ function createBaseLogBucket(): LogBucket { */ export const LogBucket = { typeUrl: "/google.logging.v2.LogBucket", + is(o: any): o is LogBucket { + return o && (o.$typeUrl === LogBucket.typeUrl || typeof o.name === "string" && typeof o.description === "string" && typeof o.retentionDays === "number" && typeof o.locked === "boolean" && isSet(o.lifecycleState) && Array.isArray(o.restrictedFields) && (!o.restrictedFields.length || typeof o.restrictedFields[0] === "string")); + }, + isSDK(o: any): o is LogBucketSDKType { + return o && (o.$typeUrl === LogBucket.typeUrl || typeof o.name === "string" && typeof o.description === "string" && typeof o.retention_days === "number" && typeof o.locked === "boolean" && isSet(o.lifecycle_state) && Array.isArray(o.restricted_fields) && (!o.restricted_fields.length || typeof o.restricted_fields[0] === "string")); + }, + isAmino(o: any): o is LogBucketAmino { + return o && (o.$typeUrl === LogBucket.typeUrl || typeof o.name === "string" && typeof o.description === "string" && typeof o.retention_days === "number" && typeof o.locked === "boolean" && isSet(o.lifecycle_state) && Array.isArray(o.restricted_fields) && (!o.restricted_fields.length || typeof o.restricted_fields[0] === "string")); + }, encode(message: LogBucket, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -3731,6 +3741,12 @@ export const LogBucket = { typeUrl: "/google.logging.v2.LogBucket", value: LogBucket.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(LogBucket.typeUrl)) { + return; + } + CmekSettings.registerTypeUrl(); } }; function createBaseLogView(): LogView { @@ -3750,6 +3766,15 @@ function createBaseLogView(): LogView { */ export const LogView = { typeUrl: "/google.logging.v2.LogView", + is(o: any): o is LogView { + return o && (o.$typeUrl === LogView.typeUrl || typeof o.name === "string" && typeof o.description === "string" && typeof o.filter === "string"); + }, + isSDK(o: any): o is LogViewSDKType { + return o && (o.$typeUrl === LogView.typeUrl || typeof o.name === "string" && typeof o.description === "string" && typeof o.filter === "string"); + }, + isAmino(o: any): o is LogViewAmino { + return o && (o.$typeUrl === LogView.typeUrl || typeof o.name === "string" && typeof o.description === "string" && typeof o.filter === "string"); + }, encode(message: LogView, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -3872,7 +3897,8 @@ export const LogView = { typeUrl: "/google.logging.v2.LogView", value: LogView.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseLogSink(): LogSink { return { @@ -3902,6 +3928,15 @@ function createBaseLogSink(): LogSink { */ export const LogSink = { typeUrl: "/google.logging.v2.LogSink", + is(o: any): o is LogSink { + return o && (o.$typeUrl === LogSink.typeUrl || typeof o.name === "string" && typeof o.destination === "string" && typeof o.filter === "string" && typeof o.description === "string" && typeof o.disabled === "boolean" && Array.isArray(o.exclusions) && (!o.exclusions.length || LogExclusion.is(o.exclusions[0])) && isSet(o.outputVersionFormat) && typeof o.writerIdentity === "string" && typeof o.includeChildren === "boolean"); + }, + isSDK(o: any): o is LogSinkSDKType { + return o && (o.$typeUrl === LogSink.typeUrl || typeof o.name === "string" && typeof o.destination === "string" && typeof o.filter === "string" && typeof o.description === "string" && typeof o.disabled === "boolean" && Array.isArray(o.exclusions) && (!o.exclusions.length || LogExclusion.isSDK(o.exclusions[0])) && isSet(o.output_version_format) && typeof o.writer_identity === "string" && typeof o.include_children === "boolean"); + }, + isAmino(o: any): o is LogSinkAmino { + return o && (o.$typeUrl === LogSink.typeUrl || typeof o.name === "string" && typeof o.destination === "string" && typeof o.filter === "string" && typeof o.description === "string" && typeof o.disabled === "boolean" && Array.isArray(o.exclusions) && (!o.exclusions.length || LogExclusion.isAmino(o.exclusions[0])) && isSet(o.output_version_format) && typeof o.writer_identity === "string" && typeof o.include_children === "boolean"); + }, encode(message: LogSink, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -4130,6 +4165,13 @@ export const LogSink = { typeUrl: "/google.logging.v2.LogSink", value: LogSink.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(LogSink.typeUrl)) { + return; + } + LogExclusion.registerTypeUrl(); + BigQueryOptions.registerTypeUrl(); } }; function createBaseBigQueryOptions(): BigQueryOptions { @@ -4146,6 +4188,15 @@ function createBaseBigQueryOptions(): BigQueryOptions { */ export const BigQueryOptions = { typeUrl: "/google.logging.v2.BigQueryOptions", + is(o: any): o is BigQueryOptions { + return o && (o.$typeUrl === BigQueryOptions.typeUrl || typeof o.usePartitionedTables === "boolean" && typeof o.usesTimestampColumnPartitioning === "boolean"); + }, + isSDK(o: any): o is BigQueryOptionsSDKType { + return o && (o.$typeUrl === BigQueryOptions.typeUrl || typeof o.use_partitioned_tables === "boolean" && typeof o.uses_timestamp_column_partitioning === "boolean"); + }, + isAmino(o: any): o is BigQueryOptionsAmino { + return o && (o.$typeUrl === BigQueryOptions.typeUrl || typeof o.use_partitioned_tables === "boolean" && typeof o.uses_timestamp_column_partitioning === "boolean"); + }, encode(message: BigQueryOptions, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.usePartitionedTables === true) { writer.uint32(8).bool(message.usePartitionedTables); @@ -4226,7 +4277,8 @@ export const BigQueryOptions = { typeUrl: "/google.logging.v2.BigQueryOptions", value: BigQueryOptions.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseListBucketsRequest(): ListBucketsRequest { return { @@ -4243,6 +4295,15 @@ function createBaseListBucketsRequest(): ListBucketsRequest { */ export const ListBucketsRequest = { typeUrl: "/google.logging.v2.ListBucketsRequest", + is(o: any): o is ListBucketsRequest { + return o && (o.$typeUrl === ListBucketsRequest.typeUrl || typeof o.parent === "string" && typeof o.pageToken === "string" && typeof o.pageSize === "number"); + }, + isSDK(o: any): o is ListBucketsRequestSDKType { + return o && (o.$typeUrl === ListBucketsRequest.typeUrl || typeof o.parent === "string" && typeof o.page_token === "string" && typeof o.page_size === "number"); + }, + isAmino(o: any): o is ListBucketsRequestAmino { + return o && (o.$typeUrl === ListBucketsRequest.typeUrl || typeof o.parent === "string" && typeof o.page_token === "string" && typeof o.page_size === "number"); + }, encode(message: ListBucketsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.parent !== "") { writer.uint32(10).string(message.parent); @@ -4337,7 +4398,8 @@ export const ListBucketsRequest = { typeUrl: "/google.logging.v2.ListBucketsRequest", value: ListBucketsRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseListBucketsResponse(): ListBucketsResponse { return { @@ -4353,6 +4415,15 @@ function createBaseListBucketsResponse(): ListBucketsResponse { */ export const ListBucketsResponse = { typeUrl: "/google.logging.v2.ListBucketsResponse", + is(o: any): o is ListBucketsResponse { + return o && (o.$typeUrl === ListBucketsResponse.typeUrl || Array.isArray(o.buckets) && (!o.buckets.length || LogBucket.is(o.buckets[0])) && typeof o.nextPageToken === "string"); + }, + isSDK(o: any): o is ListBucketsResponseSDKType { + return o && (o.$typeUrl === ListBucketsResponse.typeUrl || Array.isArray(o.buckets) && (!o.buckets.length || LogBucket.isSDK(o.buckets[0])) && typeof o.next_page_token === "string"); + }, + isAmino(o: any): o is ListBucketsResponseAmino { + return o && (o.$typeUrl === ListBucketsResponse.typeUrl || Array.isArray(o.buckets) && (!o.buckets.length || LogBucket.isAmino(o.buckets[0])) && typeof o.next_page_token === "string"); + }, encode(message: ListBucketsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.buckets) { LogBucket.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -4439,6 +4510,12 @@ export const ListBucketsResponse = { typeUrl: "/google.logging.v2.ListBucketsResponse", value: ListBucketsResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ListBucketsResponse.typeUrl)) { + return; + } + LogBucket.registerTypeUrl(); } }; function createBaseCreateBucketRequest(): CreateBucketRequest { @@ -4456,6 +4533,15 @@ function createBaseCreateBucketRequest(): CreateBucketRequest { */ export const CreateBucketRequest = { typeUrl: "/google.logging.v2.CreateBucketRequest", + is(o: any): o is CreateBucketRequest { + return o && (o.$typeUrl === CreateBucketRequest.typeUrl || typeof o.parent === "string" && typeof o.bucketId === "string"); + }, + isSDK(o: any): o is CreateBucketRequestSDKType { + return o && (o.$typeUrl === CreateBucketRequest.typeUrl || typeof o.parent === "string" && typeof o.bucket_id === "string"); + }, + isAmino(o: any): o is CreateBucketRequestAmino { + return o && (o.$typeUrl === CreateBucketRequest.typeUrl || typeof o.parent === "string" && typeof o.bucket_id === "string"); + }, encode(message: CreateBucketRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.parent !== "") { writer.uint32(10).string(message.parent); @@ -4552,6 +4638,12 @@ export const CreateBucketRequest = { typeUrl: "/google.logging.v2.CreateBucketRequest", value: CreateBucketRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(CreateBucketRequest.typeUrl)) { + return; + } + LogBucket.registerTypeUrl(); } }; function createBaseUpdateBucketRequest(): UpdateBucketRequest { @@ -4569,6 +4661,15 @@ function createBaseUpdateBucketRequest(): UpdateBucketRequest { */ export const UpdateBucketRequest = { typeUrl: "/google.logging.v2.UpdateBucketRequest", + is(o: any): o is UpdateBucketRequest { + return o && (o.$typeUrl === UpdateBucketRequest.typeUrl || typeof o.name === "string"); + }, + isSDK(o: any): o is UpdateBucketRequestSDKType { + return o && (o.$typeUrl === UpdateBucketRequest.typeUrl || typeof o.name === "string"); + }, + isAmino(o: any): o is UpdateBucketRequestAmino { + return o && (o.$typeUrl === UpdateBucketRequest.typeUrl || typeof o.name === "string"); + }, encode(message: UpdateBucketRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -4667,6 +4768,13 @@ export const UpdateBucketRequest = { typeUrl: "/google.logging.v2.UpdateBucketRequest", value: UpdateBucketRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(UpdateBucketRequest.typeUrl)) { + return; + } + LogBucket.registerTypeUrl(); + FieldMask.registerTypeUrl(); } }; function createBaseGetBucketRequest(): GetBucketRequest { @@ -4682,6 +4790,15 @@ function createBaseGetBucketRequest(): GetBucketRequest { */ export const GetBucketRequest = { typeUrl: "/google.logging.v2.GetBucketRequest", + is(o: any): o is GetBucketRequest { + return o && (o.$typeUrl === GetBucketRequest.typeUrl || typeof o.name === "string"); + }, + isSDK(o: any): o is GetBucketRequestSDKType { + return o && (o.$typeUrl === GetBucketRequest.typeUrl || typeof o.name === "string"); + }, + isAmino(o: any): o is GetBucketRequestAmino { + return o && (o.$typeUrl === GetBucketRequest.typeUrl || typeof o.name === "string"); + }, encode(message: GetBucketRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -4748,7 +4865,8 @@ export const GetBucketRequest = { typeUrl: "/google.logging.v2.GetBucketRequest", value: GetBucketRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseDeleteBucketRequest(): DeleteBucketRequest { return { @@ -4763,6 +4881,15 @@ function createBaseDeleteBucketRequest(): DeleteBucketRequest { */ export const DeleteBucketRequest = { typeUrl: "/google.logging.v2.DeleteBucketRequest", + is(o: any): o is DeleteBucketRequest { + return o && (o.$typeUrl === DeleteBucketRequest.typeUrl || typeof o.name === "string"); + }, + isSDK(o: any): o is DeleteBucketRequestSDKType { + return o && (o.$typeUrl === DeleteBucketRequest.typeUrl || typeof o.name === "string"); + }, + isAmino(o: any): o is DeleteBucketRequestAmino { + return o && (o.$typeUrl === DeleteBucketRequest.typeUrl || typeof o.name === "string"); + }, encode(message: DeleteBucketRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -4829,7 +4956,8 @@ export const DeleteBucketRequest = { typeUrl: "/google.logging.v2.DeleteBucketRequest", value: DeleteBucketRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseUndeleteBucketRequest(): UndeleteBucketRequest { return { @@ -4844,6 +4972,15 @@ function createBaseUndeleteBucketRequest(): UndeleteBucketRequest { */ export const UndeleteBucketRequest = { typeUrl: "/google.logging.v2.UndeleteBucketRequest", + is(o: any): o is UndeleteBucketRequest { + return o && (o.$typeUrl === UndeleteBucketRequest.typeUrl || typeof o.name === "string"); + }, + isSDK(o: any): o is UndeleteBucketRequestSDKType { + return o && (o.$typeUrl === UndeleteBucketRequest.typeUrl || typeof o.name === "string"); + }, + isAmino(o: any): o is UndeleteBucketRequestAmino { + return o && (o.$typeUrl === UndeleteBucketRequest.typeUrl || typeof o.name === "string"); + }, encode(message: UndeleteBucketRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -4910,7 +5047,8 @@ export const UndeleteBucketRequest = { typeUrl: "/google.logging.v2.UndeleteBucketRequest", value: UndeleteBucketRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseListViewsRequest(): ListViewsRequest { return { @@ -4927,6 +5065,15 @@ function createBaseListViewsRequest(): ListViewsRequest { */ export const ListViewsRequest = { typeUrl: "/google.logging.v2.ListViewsRequest", + is(o: any): o is ListViewsRequest { + return o && (o.$typeUrl === ListViewsRequest.typeUrl || typeof o.parent === "string" && typeof o.pageToken === "string" && typeof o.pageSize === "number"); + }, + isSDK(o: any): o is ListViewsRequestSDKType { + return o && (o.$typeUrl === ListViewsRequest.typeUrl || typeof o.parent === "string" && typeof o.page_token === "string" && typeof o.page_size === "number"); + }, + isAmino(o: any): o is ListViewsRequestAmino { + return o && (o.$typeUrl === ListViewsRequest.typeUrl || typeof o.parent === "string" && typeof o.page_token === "string" && typeof o.page_size === "number"); + }, encode(message: ListViewsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.parent !== "") { writer.uint32(10).string(message.parent); @@ -5021,7 +5168,8 @@ export const ListViewsRequest = { typeUrl: "/google.logging.v2.ListViewsRequest", value: ListViewsRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseListViewsResponse(): ListViewsResponse { return { @@ -5037,6 +5185,15 @@ function createBaseListViewsResponse(): ListViewsResponse { */ export const ListViewsResponse = { typeUrl: "/google.logging.v2.ListViewsResponse", + is(o: any): o is ListViewsResponse { + return o && (o.$typeUrl === ListViewsResponse.typeUrl || Array.isArray(o.views) && (!o.views.length || LogView.is(o.views[0])) && typeof o.nextPageToken === "string"); + }, + isSDK(o: any): o is ListViewsResponseSDKType { + return o && (o.$typeUrl === ListViewsResponse.typeUrl || Array.isArray(o.views) && (!o.views.length || LogView.isSDK(o.views[0])) && typeof o.next_page_token === "string"); + }, + isAmino(o: any): o is ListViewsResponseAmino { + return o && (o.$typeUrl === ListViewsResponse.typeUrl || Array.isArray(o.views) && (!o.views.length || LogView.isAmino(o.views[0])) && typeof o.next_page_token === "string"); + }, encode(message: ListViewsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.views) { LogView.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -5123,6 +5280,12 @@ export const ListViewsResponse = { typeUrl: "/google.logging.v2.ListViewsResponse", value: ListViewsResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ListViewsResponse.typeUrl)) { + return; + } + LogView.registerTypeUrl(); } }; function createBaseCreateViewRequest(): CreateViewRequest { @@ -5140,6 +5303,15 @@ function createBaseCreateViewRequest(): CreateViewRequest { */ export const CreateViewRequest = { typeUrl: "/google.logging.v2.CreateViewRequest", + is(o: any): o is CreateViewRequest { + return o && (o.$typeUrl === CreateViewRequest.typeUrl || typeof o.parent === "string" && typeof o.viewId === "string"); + }, + isSDK(o: any): o is CreateViewRequestSDKType { + return o && (o.$typeUrl === CreateViewRequest.typeUrl || typeof o.parent === "string" && typeof o.view_id === "string"); + }, + isAmino(o: any): o is CreateViewRequestAmino { + return o && (o.$typeUrl === CreateViewRequest.typeUrl || typeof o.parent === "string" && typeof o.view_id === "string"); + }, encode(message: CreateViewRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.parent !== "") { writer.uint32(10).string(message.parent); @@ -5236,6 +5408,12 @@ export const CreateViewRequest = { typeUrl: "/google.logging.v2.CreateViewRequest", value: CreateViewRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(CreateViewRequest.typeUrl)) { + return; + } + LogView.registerTypeUrl(); } }; function createBaseUpdateViewRequest(): UpdateViewRequest { @@ -5253,6 +5431,15 @@ function createBaseUpdateViewRequest(): UpdateViewRequest { */ export const UpdateViewRequest = { typeUrl: "/google.logging.v2.UpdateViewRequest", + is(o: any): o is UpdateViewRequest { + return o && (o.$typeUrl === UpdateViewRequest.typeUrl || typeof o.name === "string"); + }, + isSDK(o: any): o is UpdateViewRequestSDKType { + return o && (o.$typeUrl === UpdateViewRequest.typeUrl || typeof o.name === "string"); + }, + isAmino(o: any): o is UpdateViewRequestAmino { + return o && (o.$typeUrl === UpdateViewRequest.typeUrl || typeof o.name === "string"); + }, encode(message: UpdateViewRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -5351,6 +5538,13 @@ export const UpdateViewRequest = { typeUrl: "/google.logging.v2.UpdateViewRequest", value: UpdateViewRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(UpdateViewRequest.typeUrl)) { + return; + } + LogView.registerTypeUrl(); + FieldMask.registerTypeUrl(); } }; function createBaseGetViewRequest(): GetViewRequest { @@ -5366,6 +5560,15 @@ function createBaseGetViewRequest(): GetViewRequest { */ export const GetViewRequest = { typeUrl: "/google.logging.v2.GetViewRequest", + is(o: any): o is GetViewRequest { + return o && (o.$typeUrl === GetViewRequest.typeUrl || typeof o.name === "string"); + }, + isSDK(o: any): o is GetViewRequestSDKType { + return o && (o.$typeUrl === GetViewRequest.typeUrl || typeof o.name === "string"); + }, + isAmino(o: any): o is GetViewRequestAmino { + return o && (o.$typeUrl === GetViewRequest.typeUrl || typeof o.name === "string"); + }, encode(message: GetViewRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -5432,7 +5635,8 @@ export const GetViewRequest = { typeUrl: "/google.logging.v2.GetViewRequest", value: GetViewRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseDeleteViewRequest(): DeleteViewRequest { return { @@ -5447,6 +5651,15 @@ function createBaseDeleteViewRequest(): DeleteViewRequest { */ export const DeleteViewRequest = { typeUrl: "/google.logging.v2.DeleteViewRequest", + is(o: any): o is DeleteViewRequest { + return o && (o.$typeUrl === DeleteViewRequest.typeUrl || typeof o.name === "string"); + }, + isSDK(o: any): o is DeleteViewRequestSDKType { + return o && (o.$typeUrl === DeleteViewRequest.typeUrl || typeof o.name === "string"); + }, + isAmino(o: any): o is DeleteViewRequestAmino { + return o && (o.$typeUrl === DeleteViewRequest.typeUrl || typeof o.name === "string"); + }, encode(message: DeleteViewRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -5513,7 +5726,8 @@ export const DeleteViewRequest = { typeUrl: "/google.logging.v2.DeleteViewRequest", value: DeleteViewRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseListSinksRequest(): ListSinksRequest { return { @@ -5530,6 +5744,15 @@ function createBaseListSinksRequest(): ListSinksRequest { */ export const ListSinksRequest = { typeUrl: "/google.logging.v2.ListSinksRequest", + is(o: any): o is ListSinksRequest { + return o && (o.$typeUrl === ListSinksRequest.typeUrl || typeof o.parent === "string" && typeof o.pageToken === "string" && typeof o.pageSize === "number"); + }, + isSDK(o: any): o is ListSinksRequestSDKType { + return o && (o.$typeUrl === ListSinksRequest.typeUrl || typeof o.parent === "string" && typeof o.page_token === "string" && typeof o.page_size === "number"); + }, + isAmino(o: any): o is ListSinksRequestAmino { + return o && (o.$typeUrl === ListSinksRequest.typeUrl || typeof o.parent === "string" && typeof o.page_token === "string" && typeof o.page_size === "number"); + }, encode(message: ListSinksRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.parent !== "") { writer.uint32(10).string(message.parent); @@ -5624,7 +5847,8 @@ export const ListSinksRequest = { typeUrl: "/google.logging.v2.ListSinksRequest", value: ListSinksRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseListSinksResponse(): ListSinksResponse { return { @@ -5640,6 +5864,15 @@ function createBaseListSinksResponse(): ListSinksResponse { */ export const ListSinksResponse = { typeUrl: "/google.logging.v2.ListSinksResponse", + is(o: any): o is ListSinksResponse { + return o && (o.$typeUrl === ListSinksResponse.typeUrl || Array.isArray(o.sinks) && (!o.sinks.length || LogSink.is(o.sinks[0])) && typeof o.nextPageToken === "string"); + }, + isSDK(o: any): o is ListSinksResponseSDKType { + return o && (o.$typeUrl === ListSinksResponse.typeUrl || Array.isArray(o.sinks) && (!o.sinks.length || LogSink.isSDK(o.sinks[0])) && typeof o.next_page_token === "string"); + }, + isAmino(o: any): o is ListSinksResponseAmino { + return o && (o.$typeUrl === ListSinksResponse.typeUrl || Array.isArray(o.sinks) && (!o.sinks.length || LogSink.isAmino(o.sinks[0])) && typeof o.next_page_token === "string"); + }, encode(message: ListSinksResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.sinks) { LogSink.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -5726,6 +5959,12 @@ export const ListSinksResponse = { typeUrl: "/google.logging.v2.ListSinksResponse", value: ListSinksResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ListSinksResponse.typeUrl)) { + return; + } + LogSink.registerTypeUrl(); } }; function createBaseGetSinkRequest(): GetSinkRequest { @@ -5741,6 +5980,15 @@ function createBaseGetSinkRequest(): GetSinkRequest { */ export const GetSinkRequest = { typeUrl: "/google.logging.v2.GetSinkRequest", + is(o: any): o is GetSinkRequest { + return o && (o.$typeUrl === GetSinkRequest.typeUrl || typeof o.sinkName === "string"); + }, + isSDK(o: any): o is GetSinkRequestSDKType { + return o && (o.$typeUrl === GetSinkRequest.typeUrl || typeof o.sink_name === "string"); + }, + isAmino(o: any): o is GetSinkRequestAmino { + return o && (o.$typeUrl === GetSinkRequest.typeUrl || typeof o.sink_name === "string"); + }, encode(message: GetSinkRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.sinkName !== "") { writer.uint32(10).string(message.sinkName); @@ -5807,7 +6055,8 @@ export const GetSinkRequest = { typeUrl: "/google.logging.v2.GetSinkRequest", value: GetSinkRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseCreateSinkRequest(): CreateSinkRequest { return { @@ -5824,6 +6073,15 @@ function createBaseCreateSinkRequest(): CreateSinkRequest { */ export const CreateSinkRequest = { typeUrl: "/google.logging.v2.CreateSinkRequest", + is(o: any): o is CreateSinkRequest { + return o && (o.$typeUrl === CreateSinkRequest.typeUrl || typeof o.parent === "string" && typeof o.uniqueWriterIdentity === "boolean"); + }, + isSDK(o: any): o is CreateSinkRequestSDKType { + return o && (o.$typeUrl === CreateSinkRequest.typeUrl || typeof o.parent === "string" && typeof o.unique_writer_identity === "boolean"); + }, + isAmino(o: any): o is CreateSinkRequestAmino { + return o && (o.$typeUrl === CreateSinkRequest.typeUrl || typeof o.parent === "string" && typeof o.unique_writer_identity === "boolean"); + }, encode(message: CreateSinkRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.parent !== "") { writer.uint32(10).string(message.parent); @@ -5920,6 +6178,12 @@ export const CreateSinkRequest = { typeUrl: "/google.logging.v2.CreateSinkRequest", value: CreateSinkRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(CreateSinkRequest.typeUrl)) { + return; + } + LogSink.registerTypeUrl(); } }; function createBaseUpdateSinkRequest(): UpdateSinkRequest { @@ -5938,6 +6202,15 @@ function createBaseUpdateSinkRequest(): UpdateSinkRequest { */ export const UpdateSinkRequest = { typeUrl: "/google.logging.v2.UpdateSinkRequest", + is(o: any): o is UpdateSinkRequest { + return o && (o.$typeUrl === UpdateSinkRequest.typeUrl || typeof o.sinkName === "string" && typeof o.uniqueWriterIdentity === "boolean"); + }, + isSDK(o: any): o is UpdateSinkRequestSDKType { + return o && (o.$typeUrl === UpdateSinkRequest.typeUrl || typeof o.sink_name === "string" && typeof o.unique_writer_identity === "boolean"); + }, + isAmino(o: any): o is UpdateSinkRequestAmino { + return o && (o.$typeUrl === UpdateSinkRequest.typeUrl || typeof o.sink_name === "string" && typeof o.unique_writer_identity === "boolean"); + }, encode(message: UpdateSinkRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.sinkName !== "") { writer.uint32(10).string(message.sinkName); @@ -6050,6 +6323,13 @@ export const UpdateSinkRequest = { typeUrl: "/google.logging.v2.UpdateSinkRequest", value: UpdateSinkRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(UpdateSinkRequest.typeUrl)) { + return; + } + LogSink.registerTypeUrl(); + FieldMask.registerTypeUrl(); } }; function createBaseDeleteSinkRequest(): DeleteSinkRequest { @@ -6065,6 +6345,15 @@ function createBaseDeleteSinkRequest(): DeleteSinkRequest { */ export const DeleteSinkRequest = { typeUrl: "/google.logging.v2.DeleteSinkRequest", + is(o: any): o is DeleteSinkRequest { + return o && (o.$typeUrl === DeleteSinkRequest.typeUrl || typeof o.sinkName === "string"); + }, + isSDK(o: any): o is DeleteSinkRequestSDKType { + return o && (o.$typeUrl === DeleteSinkRequest.typeUrl || typeof o.sink_name === "string"); + }, + isAmino(o: any): o is DeleteSinkRequestAmino { + return o && (o.$typeUrl === DeleteSinkRequest.typeUrl || typeof o.sink_name === "string"); + }, encode(message: DeleteSinkRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.sinkName !== "") { writer.uint32(10).string(message.sinkName); @@ -6131,7 +6420,8 @@ export const DeleteSinkRequest = { typeUrl: "/google.logging.v2.DeleteSinkRequest", value: DeleteSinkRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseLogExclusion(): LogExclusion { return { @@ -6155,6 +6445,15 @@ function createBaseLogExclusion(): LogExclusion { */ export const LogExclusion = { typeUrl: "/google.logging.v2.LogExclusion", + is(o: any): o is LogExclusion { + return o && (o.$typeUrl === LogExclusion.typeUrl || typeof o.name === "string" && typeof o.description === "string" && typeof o.filter === "string" && typeof o.disabled === "boolean"); + }, + isSDK(o: any): o is LogExclusionSDKType { + return o && (o.$typeUrl === LogExclusion.typeUrl || typeof o.name === "string" && typeof o.description === "string" && typeof o.filter === "string" && typeof o.disabled === "boolean"); + }, + isAmino(o: any): o is LogExclusionAmino { + return o && (o.$typeUrl === LogExclusion.typeUrl || typeof o.name === "string" && typeof o.description === "string" && typeof o.filter === "string" && typeof o.disabled === "boolean"); + }, encode(message: LogExclusion, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -6291,7 +6590,8 @@ export const LogExclusion = { typeUrl: "/google.logging.v2.LogExclusion", value: LogExclusion.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseListExclusionsRequest(): ListExclusionsRequest { return { @@ -6308,6 +6608,15 @@ function createBaseListExclusionsRequest(): ListExclusionsRequest { */ export const ListExclusionsRequest = { typeUrl: "/google.logging.v2.ListExclusionsRequest", + is(o: any): o is ListExclusionsRequest { + return o && (o.$typeUrl === ListExclusionsRequest.typeUrl || typeof o.parent === "string" && typeof o.pageToken === "string" && typeof o.pageSize === "number"); + }, + isSDK(o: any): o is ListExclusionsRequestSDKType { + return o && (o.$typeUrl === ListExclusionsRequest.typeUrl || typeof o.parent === "string" && typeof o.page_token === "string" && typeof o.page_size === "number"); + }, + isAmino(o: any): o is ListExclusionsRequestAmino { + return o && (o.$typeUrl === ListExclusionsRequest.typeUrl || typeof o.parent === "string" && typeof o.page_token === "string" && typeof o.page_size === "number"); + }, encode(message: ListExclusionsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.parent !== "") { writer.uint32(10).string(message.parent); @@ -6402,7 +6711,8 @@ export const ListExclusionsRequest = { typeUrl: "/google.logging.v2.ListExclusionsRequest", value: ListExclusionsRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseListExclusionsResponse(): ListExclusionsResponse { return { @@ -6418,6 +6728,15 @@ function createBaseListExclusionsResponse(): ListExclusionsResponse { */ export const ListExclusionsResponse = { typeUrl: "/google.logging.v2.ListExclusionsResponse", + is(o: any): o is ListExclusionsResponse { + return o && (o.$typeUrl === ListExclusionsResponse.typeUrl || Array.isArray(o.exclusions) && (!o.exclusions.length || LogExclusion.is(o.exclusions[0])) && typeof o.nextPageToken === "string"); + }, + isSDK(o: any): o is ListExclusionsResponseSDKType { + return o && (o.$typeUrl === ListExclusionsResponse.typeUrl || Array.isArray(o.exclusions) && (!o.exclusions.length || LogExclusion.isSDK(o.exclusions[0])) && typeof o.next_page_token === "string"); + }, + isAmino(o: any): o is ListExclusionsResponseAmino { + return o && (o.$typeUrl === ListExclusionsResponse.typeUrl || Array.isArray(o.exclusions) && (!o.exclusions.length || LogExclusion.isAmino(o.exclusions[0])) && typeof o.next_page_token === "string"); + }, encode(message: ListExclusionsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.exclusions) { LogExclusion.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -6504,6 +6823,12 @@ export const ListExclusionsResponse = { typeUrl: "/google.logging.v2.ListExclusionsResponse", value: ListExclusionsResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ListExclusionsResponse.typeUrl)) { + return; + } + LogExclusion.registerTypeUrl(); } }; function createBaseGetExclusionRequest(): GetExclusionRequest { @@ -6519,6 +6844,15 @@ function createBaseGetExclusionRequest(): GetExclusionRequest { */ export const GetExclusionRequest = { typeUrl: "/google.logging.v2.GetExclusionRequest", + is(o: any): o is GetExclusionRequest { + return o && (o.$typeUrl === GetExclusionRequest.typeUrl || typeof o.name === "string"); + }, + isSDK(o: any): o is GetExclusionRequestSDKType { + return o && (o.$typeUrl === GetExclusionRequest.typeUrl || typeof o.name === "string"); + }, + isAmino(o: any): o is GetExclusionRequestAmino { + return o && (o.$typeUrl === GetExclusionRequest.typeUrl || typeof o.name === "string"); + }, encode(message: GetExclusionRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -6585,7 +6919,8 @@ export const GetExclusionRequest = { typeUrl: "/google.logging.v2.GetExclusionRequest", value: GetExclusionRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseCreateExclusionRequest(): CreateExclusionRequest { return { @@ -6601,6 +6936,15 @@ function createBaseCreateExclusionRequest(): CreateExclusionRequest { */ export const CreateExclusionRequest = { typeUrl: "/google.logging.v2.CreateExclusionRequest", + is(o: any): o is CreateExclusionRequest { + return o && (o.$typeUrl === CreateExclusionRequest.typeUrl || typeof o.parent === "string"); + }, + isSDK(o: any): o is CreateExclusionRequestSDKType { + return o && (o.$typeUrl === CreateExclusionRequest.typeUrl || typeof o.parent === "string"); + }, + isAmino(o: any): o is CreateExclusionRequestAmino { + return o && (o.$typeUrl === CreateExclusionRequest.typeUrl || typeof o.parent === "string"); + }, encode(message: CreateExclusionRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.parent !== "") { writer.uint32(10).string(message.parent); @@ -6683,6 +7027,12 @@ export const CreateExclusionRequest = { typeUrl: "/google.logging.v2.CreateExclusionRequest", value: CreateExclusionRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(CreateExclusionRequest.typeUrl)) { + return; + } + LogExclusion.registerTypeUrl(); } }; function createBaseUpdateExclusionRequest(): UpdateExclusionRequest { @@ -6700,6 +7050,15 @@ function createBaseUpdateExclusionRequest(): UpdateExclusionRequest { */ export const UpdateExclusionRequest = { typeUrl: "/google.logging.v2.UpdateExclusionRequest", + is(o: any): o is UpdateExclusionRequest { + return o && (o.$typeUrl === UpdateExclusionRequest.typeUrl || typeof o.name === "string"); + }, + isSDK(o: any): o is UpdateExclusionRequestSDKType { + return o && (o.$typeUrl === UpdateExclusionRequest.typeUrl || typeof o.name === "string"); + }, + isAmino(o: any): o is UpdateExclusionRequestAmino { + return o && (o.$typeUrl === UpdateExclusionRequest.typeUrl || typeof o.name === "string"); + }, encode(message: UpdateExclusionRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -6798,6 +7157,13 @@ export const UpdateExclusionRequest = { typeUrl: "/google.logging.v2.UpdateExclusionRequest", value: UpdateExclusionRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(UpdateExclusionRequest.typeUrl)) { + return; + } + LogExclusion.registerTypeUrl(); + FieldMask.registerTypeUrl(); } }; function createBaseDeleteExclusionRequest(): DeleteExclusionRequest { @@ -6813,6 +7179,15 @@ function createBaseDeleteExclusionRequest(): DeleteExclusionRequest { */ export const DeleteExclusionRequest = { typeUrl: "/google.logging.v2.DeleteExclusionRequest", + is(o: any): o is DeleteExclusionRequest { + return o && (o.$typeUrl === DeleteExclusionRequest.typeUrl || typeof o.name === "string"); + }, + isSDK(o: any): o is DeleteExclusionRequestSDKType { + return o && (o.$typeUrl === DeleteExclusionRequest.typeUrl || typeof o.name === "string"); + }, + isAmino(o: any): o is DeleteExclusionRequestAmino { + return o && (o.$typeUrl === DeleteExclusionRequest.typeUrl || typeof o.name === "string"); + }, encode(message: DeleteExclusionRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -6879,7 +7254,8 @@ export const DeleteExclusionRequest = { typeUrl: "/google.logging.v2.DeleteExclusionRequest", value: DeleteExclusionRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseGetCmekSettingsRequest(): GetCmekSettingsRequest { return { @@ -6899,6 +7275,15 @@ function createBaseGetCmekSettingsRequest(): GetCmekSettingsRequest { */ export const GetCmekSettingsRequest = { typeUrl: "/google.logging.v2.GetCmekSettingsRequest", + is(o: any): o is GetCmekSettingsRequest { + return o && (o.$typeUrl === GetCmekSettingsRequest.typeUrl || typeof o.name === "string"); + }, + isSDK(o: any): o is GetCmekSettingsRequestSDKType { + return o && (o.$typeUrl === GetCmekSettingsRequest.typeUrl || typeof o.name === "string"); + }, + isAmino(o: any): o is GetCmekSettingsRequestAmino { + return o && (o.$typeUrl === GetCmekSettingsRequest.typeUrl || typeof o.name === "string"); + }, encode(message: GetCmekSettingsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -6965,7 +7350,8 @@ export const GetCmekSettingsRequest = { typeUrl: "/google.logging.v2.GetCmekSettingsRequest", value: GetCmekSettingsRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseUpdateCmekSettingsRequest(): UpdateCmekSettingsRequest { return { @@ -6987,6 +7373,15 @@ function createBaseUpdateCmekSettingsRequest(): UpdateCmekSettingsRequest { */ export const UpdateCmekSettingsRequest = { typeUrl: "/google.logging.v2.UpdateCmekSettingsRequest", + is(o: any): o is UpdateCmekSettingsRequest { + return o && (o.$typeUrl === UpdateCmekSettingsRequest.typeUrl || typeof o.name === "string"); + }, + isSDK(o: any): o is UpdateCmekSettingsRequestSDKType { + return o && (o.$typeUrl === UpdateCmekSettingsRequest.typeUrl || typeof o.name === "string"); + }, + isAmino(o: any): o is UpdateCmekSettingsRequestAmino { + return o && (o.$typeUrl === UpdateCmekSettingsRequest.typeUrl || typeof o.name === "string"); + }, encode(message: UpdateCmekSettingsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -7085,6 +7480,13 @@ export const UpdateCmekSettingsRequest = { typeUrl: "/google.logging.v2.UpdateCmekSettingsRequest", value: UpdateCmekSettingsRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(UpdateCmekSettingsRequest.typeUrl)) { + return; + } + CmekSettings.registerTypeUrl(); + FieldMask.registerTypeUrl(); } }; function createBaseCmekSettings(): CmekSettings { @@ -7111,6 +7513,15 @@ function createBaseCmekSettings(): CmekSettings { */ export const CmekSettings = { typeUrl: "/google.logging.v2.CmekSettings", + is(o: any): o is CmekSettings { + return o && (o.$typeUrl === CmekSettings.typeUrl || typeof o.name === "string" && typeof o.kmsKeyName === "string" && typeof o.serviceAccountId === "string"); + }, + isSDK(o: any): o is CmekSettingsSDKType { + return o && (o.$typeUrl === CmekSettings.typeUrl || typeof o.name === "string" && typeof o.kms_key_name === "string" && typeof o.service_account_id === "string"); + }, + isAmino(o: any): o is CmekSettingsAmino { + return o && (o.$typeUrl === CmekSettings.typeUrl || typeof o.name === "string" && typeof o.kms_key_name === "string" && typeof o.service_account_id === "string"); + }, encode(message: CmekSettings, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -7205,7 +7616,8 @@ export const CmekSettings = { typeUrl: "/google.logging.v2.CmekSettings", value: CmekSettings.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseGetSettingsRequest(): GetSettingsRequest { return { @@ -7225,6 +7637,15 @@ function createBaseGetSettingsRequest(): GetSettingsRequest { */ export const GetSettingsRequest = { typeUrl: "/google.logging.v2.GetSettingsRequest", + is(o: any): o is GetSettingsRequest { + return o && (o.$typeUrl === GetSettingsRequest.typeUrl || typeof o.name === "string"); + }, + isSDK(o: any): o is GetSettingsRequestSDKType { + return o && (o.$typeUrl === GetSettingsRequest.typeUrl || typeof o.name === "string"); + }, + isAmino(o: any): o is GetSettingsRequestAmino { + return o && (o.$typeUrl === GetSettingsRequest.typeUrl || typeof o.name === "string"); + }, encode(message: GetSettingsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -7291,7 +7712,8 @@ export const GetSettingsRequest = { typeUrl: "/google.logging.v2.GetSettingsRequest", value: GetSettingsRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseUpdateSettingsRequest(): UpdateSettingsRequest { return { @@ -7313,6 +7735,15 @@ function createBaseUpdateSettingsRequest(): UpdateSettingsRequest { */ export const UpdateSettingsRequest = { typeUrl: "/google.logging.v2.UpdateSettingsRequest", + is(o: any): o is UpdateSettingsRequest { + return o && (o.$typeUrl === UpdateSettingsRequest.typeUrl || typeof o.name === "string"); + }, + isSDK(o: any): o is UpdateSettingsRequestSDKType { + return o && (o.$typeUrl === UpdateSettingsRequest.typeUrl || typeof o.name === "string"); + }, + isAmino(o: any): o is UpdateSettingsRequestAmino { + return o && (o.$typeUrl === UpdateSettingsRequest.typeUrl || typeof o.name === "string"); + }, encode(message: UpdateSettingsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -7411,6 +7842,13 @@ export const UpdateSettingsRequest = { typeUrl: "/google.logging.v2.UpdateSettingsRequest", value: UpdateSettingsRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(UpdateSettingsRequest.typeUrl)) { + return; + } + Settings.registerTypeUrl(); + FieldMask.registerTypeUrl(); } }; function createBaseSettings(): Settings { @@ -7431,6 +7869,15 @@ function createBaseSettings(): Settings { */ export const Settings = { typeUrl: "/google.logging.v2.Settings", + is(o: any): o is Settings { + return o && (o.$typeUrl === Settings.typeUrl || typeof o.name === "string" && typeof o.kmsKeyName === "string" && typeof o.kmsServiceAccountId === "string" && typeof o.storageLocation === "string" && typeof o.disableDefaultSink === "boolean"); + }, + isSDK(o: any): o is SettingsSDKType { + return o && (o.$typeUrl === Settings.typeUrl || typeof o.name === "string" && typeof o.kms_key_name === "string" && typeof o.kms_service_account_id === "string" && typeof o.storage_location === "string" && typeof o.disable_default_sink === "boolean"); + }, + isAmino(o: any): o is SettingsAmino { + return o && (o.$typeUrl === Settings.typeUrl || typeof o.name === "string" && typeof o.kms_key_name === "string" && typeof o.kms_service_account_id === "string" && typeof o.storage_location === "string" && typeof o.disable_default_sink === "boolean"); + }, encode(message: Settings, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -7553,7 +8000,8 @@ export const Settings = { typeUrl: "/google.logging.v2.Settings", value: Settings.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseCopyLogEntriesRequest(): CopyLogEntriesRequest { return { @@ -7570,6 +8018,15 @@ function createBaseCopyLogEntriesRequest(): CopyLogEntriesRequest { */ export const CopyLogEntriesRequest = { typeUrl: "/google.logging.v2.CopyLogEntriesRequest", + is(o: any): o is CopyLogEntriesRequest { + return o && (o.$typeUrl === CopyLogEntriesRequest.typeUrl || typeof o.name === "string" && typeof o.filter === "string" && typeof o.destination === "string"); + }, + isSDK(o: any): o is CopyLogEntriesRequestSDKType { + return o && (o.$typeUrl === CopyLogEntriesRequest.typeUrl || typeof o.name === "string" && typeof o.filter === "string" && typeof o.destination === "string"); + }, + isAmino(o: any): o is CopyLogEntriesRequestAmino { + return o && (o.$typeUrl === CopyLogEntriesRequest.typeUrl || typeof o.name === "string" && typeof o.filter === "string" && typeof o.destination === "string"); + }, encode(message: CopyLogEntriesRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -7664,7 +8121,8 @@ export const CopyLogEntriesRequest = { typeUrl: "/google.logging.v2.CopyLogEntriesRequest", value: CopyLogEntriesRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseCopyLogEntriesMetadata(): CopyLogEntriesMetadata { return { @@ -7685,6 +8143,15 @@ function createBaseCopyLogEntriesMetadata(): CopyLogEntriesMetadata { */ export const CopyLogEntriesMetadata = { typeUrl: "/google.logging.v2.CopyLogEntriesMetadata", + is(o: any): o is CopyLogEntriesMetadata { + return o && (o.$typeUrl === CopyLogEntriesMetadata.typeUrl || isSet(o.state) && typeof o.cancellationRequested === "boolean" && typeof o.progress === "number" && typeof o.writerIdentity === "string"); + }, + isSDK(o: any): o is CopyLogEntriesMetadataSDKType { + return o && (o.$typeUrl === CopyLogEntriesMetadata.typeUrl || isSet(o.state) && typeof o.cancellation_requested === "boolean" && typeof o.progress === "number" && typeof o.writer_identity === "string"); + }, + isAmino(o: any): o is CopyLogEntriesMetadataAmino { + return o && (o.$typeUrl === CopyLogEntriesMetadata.typeUrl || isSet(o.state) && typeof o.cancellation_requested === "boolean" && typeof o.progress === "number" && typeof o.writer_identity === "string"); + }, encode(message: CopyLogEntriesMetadata, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.startTime !== undefined) { Timestamp.encode(toTimestamp(message.startTime), writer.uint32(10).fork()).ldelim(); @@ -7837,6 +8304,12 @@ export const CopyLogEntriesMetadata = { typeUrl: "/google.logging.v2.CopyLogEntriesMetadata", value: CopyLogEntriesMetadata.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(CopyLogEntriesMetadata.typeUrl)) { + return; + } + CopyLogEntriesRequest.registerTypeUrl(); } }; function createBaseCopyLogEntriesResponse(): CopyLogEntriesResponse { @@ -7852,6 +8325,15 @@ function createBaseCopyLogEntriesResponse(): CopyLogEntriesResponse { */ export const CopyLogEntriesResponse = { typeUrl: "/google.logging.v2.CopyLogEntriesResponse", + is(o: any): o is CopyLogEntriesResponse { + return o && (o.$typeUrl === CopyLogEntriesResponse.typeUrl || typeof o.logEntriesCopiedCount === "bigint"); + }, + isSDK(o: any): o is CopyLogEntriesResponseSDKType { + return o && (o.$typeUrl === CopyLogEntriesResponse.typeUrl || typeof o.log_entries_copied_count === "bigint"); + }, + isAmino(o: any): o is CopyLogEntriesResponseAmino { + return o && (o.$typeUrl === CopyLogEntriesResponse.typeUrl || typeof o.log_entries_copied_count === "bigint"); + }, encode(message: CopyLogEntriesResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.logEntriesCopiedCount !== BigInt(0)) { writer.uint32(8).int64(message.logEntriesCopiedCount); @@ -7920,5 +8402,6 @@ export const CopyLogEntriesResponse = { typeUrl: "/google.logging.v2.CopyLogEntriesResponse", value: CopyLogEntriesResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/google/logging/v2/logging_metrics.ts b/__fixtures__/v-next/outputv3/google/logging/v2/logging_metrics.ts index 7fdc5cc88e..e17bb12dcf 100644 --- a/__fixtures__/v-next/outputv3/google/logging/v2/logging_metrics.ts +++ b/__fixtures__/v-next/outputv3/google/logging/v2/logging_metrics.ts @@ -3,6 +3,7 @@ import { Distribution_BucketOptions, Distribution_BucketOptionsAmino, Distributi import { Timestamp, TimestampAmino, TimestampSDKType } from "../../protobuf/timestamp"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { isSet, DeepPartial, toTimestamp, fromTimestamp, isObject } from "../../../helpers"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "google.logging.v2"; /** Logging API version. */ export enum LogMetric_ApiVersion { @@ -783,7 +784,8 @@ export const LogMetric_LabelExtractorsEntry = { }, toProto(message: LogMetric_LabelExtractorsEntry): Uint8Array { return LogMetric_LabelExtractorsEntry.encode(message).finish(); - } + }, + registerTypeUrl() {} }; function createBaseLogMetric(): LogMetric { return { @@ -814,6 +816,15 @@ function createBaseLogMetric(): LogMetric { */ export const LogMetric = { typeUrl: "/google.logging.v2.LogMetric", + is(o: any): o is LogMetric { + return o && (o.$typeUrl === LogMetric.typeUrl || typeof o.name === "string" && typeof o.description === "string" && typeof o.filter === "string" && typeof o.disabled === "boolean" && typeof o.valueExtractor === "string" && isSet(o.labelExtractors) && isSet(o.version)); + }, + isSDK(o: any): o is LogMetricSDKType { + return o && (o.$typeUrl === LogMetric.typeUrl || typeof o.name === "string" && typeof o.description === "string" && typeof o.filter === "string" && typeof o.disabled === "boolean" && typeof o.value_extractor === "string" && isSet(o.label_extractors) && isSet(o.version)); + }, + isAmino(o: any): o is LogMetricAmino { + return o && (o.$typeUrl === LogMetric.typeUrl || typeof o.name === "string" && typeof o.description === "string" && typeof o.filter === "string" && typeof o.disabled === "boolean" && typeof o.value_extractor === "string" && isSet(o.label_extractors) && isSet(o.version)); + }, encode(message: LogMetric, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -1062,6 +1073,13 @@ export const LogMetric = { typeUrl: "/google.logging.v2.LogMetric", value: LogMetric.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(LogMetric.typeUrl)) { + return; + } + MetricDescriptor.registerTypeUrl(); + Distribution_BucketOptions.registerTypeUrl(); } }; function createBaseListLogMetricsRequest(): ListLogMetricsRequest { @@ -1079,6 +1097,15 @@ function createBaseListLogMetricsRequest(): ListLogMetricsRequest { */ export const ListLogMetricsRequest = { typeUrl: "/google.logging.v2.ListLogMetricsRequest", + is(o: any): o is ListLogMetricsRequest { + return o && (o.$typeUrl === ListLogMetricsRequest.typeUrl || typeof o.parent === "string" && typeof o.pageToken === "string" && typeof o.pageSize === "number"); + }, + isSDK(o: any): o is ListLogMetricsRequestSDKType { + return o && (o.$typeUrl === ListLogMetricsRequest.typeUrl || typeof o.parent === "string" && typeof o.page_token === "string" && typeof o.page_size === "number"); + }, + isAmino(o: any): o is ListLogMetricsRequestAmino { + return o && (o.$typeUrl === ListLogMetricsRequest.typeUrl || typeof o.parent === "string" && typeof o.page_token === "string" && typeof o.page_size === "number"); + }, encode(message: ListLogMetricsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.parent !== "") { writer.uint32(10).string(message.parent); @@ -1173,7 +1200,8 @@ export const ListLogMetricsRequest = { typeUrl: "/google.logging.v2.ListLogMetricsRequest", value: ListLogMetricsRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseListLogMetricsResponse(): ListLogMetricsResponse { return { @@ -1189,6 +1217,15 @@ function createBaseListLogMetricsResponse(): ListLogMetricsResponse { */ export const ListLogMetricsResponse = { typeUrl: "/google.logging.v2.ListLogMetricsResponse", + is(o: any): o is ListLogMetricsResponse { + return o && (o.$typeUrl === ListLogMetricsResponse.typeUrl || Array.isArray(o.metrics) && (!o.metrics.length || LogMetric.is(o.metrics[0])) && typeof o.nextPageToken === "string"); + }, + isSDK(o: any): o is ListLogMetricsResponseSDKType { + return o && (o.$typeUrl === ListLogMetricsResponse.typeUrl || Array.isArray(o.metrics) && (!o.metrics.length || LogMetric.isSDK(o.metrics[0])) && typeof o.next_page_token === "string"); + }, + isAmino(o: any): o is ListLogMetricsResponseAmino { + return o && (o.$typeUrl === ListLogMetricsResponse.typeUrl || Array.isArray(o.metrics) && (!o.metrics.length || LogMetric.isAmino(o.metrics[0])) && typeof o.next_page_token === "string"); + }, encode(message: ListLogMetricsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.metrics) { LogMetric.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -1275,6 +1312,12 @@ export const ListLogMetricsResponse = { typeUrl: "/google.logging.v2.ListLogMetricsResponse", value: ListLogMetricsResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ListLogMetricsResponse.typeUrl)) { + return; + } + LogMetric.registerTypeUrl(); } }; function createBaseGetLogMetricRequest(): GetLogMetricRequest { @@ -1290,6 +1333,15 @@ function createBaseGetLogMetricRequest(): GetLogMetricRequest { */ export const GetLogMetricRequest = { typeUrl: "/google.logging.v2.GetLogMetricRequest", + is(o: any): o is GetLogMetricRequest { + return o && (o.$typeUrl === GetLogMetricRequest.typeUrl || typeof o.metricName === "string"); + }, + isSDK(o: any): o is GetLogMetricRequestSDKType { + return o && (o.$typeUrl === GetLogMetricRequest.typeUrl || typeof o.metric_name === "string"); + }, + isAmino(o: any): o is GetLogMetricRequestAmino { + return o && (o.$typeUrl === GetLogMetricRequest.typeUrl || typeof o.metric_name === "string"); + }, encode(message: GetLogMetricRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.metricName !== "") { writer.uint32(10).string(message.metricName); @@ -1356,7 +1408,8 @@ export const GetLogMetricRequest = { typeUrl: "/google.logging.v2.GetLogMetricRequest", value: GetLogMetricRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseCreateLogMetricRequest(): CreateLogMetricRequest { return { @@ -1372,6 +1425,15 @@ function createBaseCreateLogMetricRequest(): CreateLogMetricRequest { */ export const CreateLogMetricRequest = { typeUrl: "/google.logging.v2.CreateLogMetricRequest", + is(o: any): o is CreateLogMetricRequest { + return o && (o.$typeUrl === CreateLogMetricRequest.typeUrl || typeof o.parent === "string"); + }, + isSDK(o: any): o is CreateLogMetricRequestSDKType { + return o && (o.$typeUrl === CreateLogMetricRequest.typeUrl || typeof o.parent === "string"); + }, + isAmino(o: any): o is CreateLogMetricRequestAmino { + return o && (o.$typeUrl === CreateLogMetricRequest.typeUrl || typeof o.parent === "string"); + }, encode(message: CreateLogMetricRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.parent !== "") { writer.uint32(10).string(message.parent); @@ -1454,6 +1516,12 @@ export const CreateLogMetricRequest = { typeUrl: "/google.logging.v2.CreateLogMetricRequest", value: CreateLogMetricRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(CreateLogMetricRequest.typeUrl)) { + return; + } + LogMetric.registerTypeUrl(); } }; function createBaseUpdateLogMetricRequest(): UpdateLogMetricRequest { @@ -1470,6 +1538,15 @@ function createBaseUpdateLogMetricRequest(): UpdateLogMetricRequest { */ export const UpdateLogMetricRequest = { typeUrl: "/google.logging.v2.UpdateLogMetricRequest", + is(o: any): o is UpdateLogMetricRequest { + return o && (o.$typeUrl === UpdateLogMetricRequest.typeUrl || typeof o.metricName === "string"); + }, + isSDK(o: any): o is UpdateLogMetricRequestSDKType { + return o && (o.$typeUrl === UpdateLogMetricRequest.typeUrl || typeof o.metric_name === "string"); + }, + isAmino(o: any): o is UpdateLogMetricRequestAmino { + return o && (o.$typeUrl === UpdateLogMetricRequest.typeUrl || typeof o.metric_name === "string"); + }, encode(message: UpdateLogMetricRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.metricName !== "") { writer.uint32(10).string(message.metricName); @@ -1552,6 +1629,12 @@ export const UpdateLogMetricRequest = { typeUrl: "/google.logging.v2.UpdateLogMetricRequest", value: UpdateLogMetricRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(UpdateLogMetricRequest.typeUrl)) { + return; + } + LogMetric.registerTypeUrl(); } }; function createBaseDeleteLogMetricRequest(): DeleteLogMetricRequest { @@ -1567,6 +1650,15 @@ function createBaseDeleteLogMetricRequest(): DeleteLogMetricRequest { */ export const DeleteLogMetricRequest = { typeUrl: "/google.logging.v2.DeleteLogMetricRequest", + is(o: any): o is DeleteLogMetricRequest { + return o && (o.$typeUrl === DeleteLogMetricRequest.typeUrl || typeof o.metricName === "string"); + }, + isSDK(o: any): o is DeleteLogMetricRequestSDKType { + return o && (o.$typeUrl === DeleteLogMetricRequest.typeUrl || typeof o.metric_name === "string"); + }, + isAmino(o: any): o is DeleteLogMetricRequestAmino { + return o && (o.$typeUrl === DeleteLogMetricRequest.typeUrl || typeof o.metric_name === "string"); + }, encode(message: DeleteLogMetricRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.metricName !== "") { writer.uint32(10).string(message.metricName); @@ -1633,5 +1725,6 @@ export const DeleteLogMetricRequest = { typeUrl: "/google.logging.v2.DeleteLogMetricRequest", value: DeleteLogMetricRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/google/longrunning/operations.ts b/__fixtures__/v-next/outputv3/google/longrunning/operations.ts index 7edc049df6..672bf15fee 100644 --- a/__fixtures__/v-next/outputv3/google/longrunning/operations.ts +++ b/__fixtures__/v-next/outputv3/google/longrunning/operations.ts @@ -2,6 +2,7 @@ import { Duration, DurationAmino, DurationSDKType } from "../protobuf/duration"; import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../protobuf/any"; import { Status, StatusAmino, StatusSDKType } from "../rpc/status"; import { BinaryReader, BinaryWriter } from "../../binary"; +import { GlobalDecoderRegistry } from "../../registry"; import { isSet, DeepPartial } from "../../helpers"; export const protobufPackage = "google.longrunning"; /** @@ -499,6 +500,15 @@ function createBaseOperation(): Operation { */ export const Operation = { typeUrl: "/google.longrunning.Operation", + is(o: any): o is Operation { + return o && (o.$typeUrl === Operation.typeUrl || typeof o.name === "string" && typeof o.done === "boolean"); + }, + isSDK(o: any): o is OperationSDKType { + return o && (o.$typeUrl === Operation.typeUrl || typeof o.name === "string" && typeof o.done === "boolean"); + }, + isAmino(o: any): o is OperationAmino { + return o && (o.$typeUrl === Operation.typeUrl || typeof o.name === "string" && typeof o.done === "boolean"); + }, encode(message: Operation, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -627,7 +637,8 @@ export const Operation = { typeUrl: "/google.longrunning.Operation", value: Operation.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseGetOperationRequest(): GetOperationRequest { return { @@ -642,6 +653,15 @@ function createBaseGetOperationRequest(): GetOperationRequest { */ export const GetOperationRequest = { typeUrl: "/google.longrunning.GetOperationRequest", + is(o: any): o is GetOperationRequest { + return o && (o.$typeUrl === GetOperationRequest.typeUrl || typeof o.name === "string"); + }, + isSDK(o: any): o is GetOperationRequestSDKType { + return o && (o.$typeUrl === GetOperationRequest.typeUrl || typeof o.name === "string"); + }, + isAmino(o: any): o is GetOperationRequestAmino { + return o && (o.$typeUrl === GetOperationRequest.typeUrl || typeof o.name === "string"); + }, encode(message: GetOperationRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -708,7 +728,8 @@ export const GetOperationRequest = { typeUrl: "/google.longrunning.GetOperationRequest", value: GetOperationRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseListOperationsRequest(): ListOperationsRequest { return { @@ -726,6 +747,15 @@ function createBaseListOperationsRequest(): ListOperationsRequest { */ export const ListOperationsRequest = { typeUrl: "/google.longrunning.ListOperationsRequest", + is(o: any): o is ListOperationsRequest { + return o && (o.$typeUrl === ListOperationsRequest.typeUrl || typeof o.name === "string" && typeof o.filter === "string" && typeof o.pageSize === "number" && typeof o.pageToken === "string"); + }, + isSDK(o: any): o is ListOperationsRequestSDKType { + return o && (o.$typeUrl === ListOperationsRequest.typeUrl || typeof o.name === "string" && typeof o.filter === "string" && typeof o.page_size === "number" && typeof o.page_token === "string"); + }, + isAmino(o: any): o is ListOperationsRequestAmino { + return o && (o.$typeUrl === ListOperationsRequest.typeUrl || typeof o.name === "string" && typeof o.filter === "string" && typeof o.page_size === "number" && typeof o.page_token === "string"); + }, encode(message: ListOperationsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(34).string(message.name); @@ -834,7 +864,8 @@ export const ListOperationsRequest = { typeUrl: "/google.longrunning.ListOperationsRequest", value: ListOperationsRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseListOperationsResponse(): ListOperationsResponse { return { @@ -850,6 +881,15 @@ function createBaseListOperationsResponse(): ListOperationsResponse { */ export const ListOperationsResponse = { typeUrl: "/google.longrunning.ListOperationsResponse", + is(o: any): o is ListOperationsResponse { + return o && (o.$typeUrl === ListOperationsResponse.typeUrl || Array.isArray(o.operations) && (!o.operations.length || Operation.is(o.operations[0])) && typeof o.nextPageToken === "string"); + }, + isSDK(o: any): o is ListOperationsResponseSDKType { + return o && (o.$typeUrl === ListOperationsResponse.typeUrl || Array.isArray(o.operations) && (!o.operations.length || Operation.isSDK(o.operations[0])) && typeof o.next_page_token === "string"); + }, + isAmino(o: any): o is ListOperationsResponseAmino { + return o && (o.$typeUrl === ListOperationsResponse.typeUrl || Array.isArray(o.operations) && (!o.operations.length || Operation.isAmino(o.operations[0])) && typeof o.next_page_token === "string"); + }, encode(message: ListOperationsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.operations) { Operation.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -936,6 +976,12 @@ export const ListOperationsResponse = { typeUrl: "/google.longrunning.ListOperationsResponse", value: ListOperationsResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ListOperationsResponse.typeUrl)) { + return; + } + Operation.registerTypeUrl(); } }; function createBaseCancelOperationRequest(): CancelOperationRequest { @@ -951,6 +997,15 @@ function createBaseCancelOperationRequest(): CancelOperationRequest { */ export const CancelOperationRequest = { typeUrl: "/google.longrunning.CancelOperationRequest", + is(o: any): o is CancelOperationRequest { + return o && (o.$typeUrl === CancelOperationRequest.typeUrl || typeof o.name === "string"); + }, + isSDK(o: any): o is CancelOperationRequestSDKType { + return o && (o.$typeUrl === CancelOperationRequest.typeUrl || typeof o.name === "string"); + }, + isAmino(o: any): o is CancelOperationRequestAmino { + return o && (o.$typeUrl === CancelOperationRequest.typeUrl || typeof o.name === "string"); + }, encode(message: CancelOperationRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -1017,7 +1072,8 @@ export const CancelOperationRequest = { typeUrl: "/google.longrunning.CancelOperationRequest", value: CancelOperationRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseDeleteOperationRequest(): DeleteOperationRequest { return { @@ -1032,6 +1088,15 @@ function createBaseDeleteOperationRequest(): DeleteOperationRequest { */ export const DeleteOperationRequest = { typeUrl: "/google.longrunning.DeleteOperationRequest", + is(o: any): o is DeleteOperationRequest { + return o && (o.$typeUrl === DeleteOperationRequest.typeUrl || typeof o.name === "string"); + }, + isSDK(o: any): o is DeleteOperationRequestSDKType { + return o && (o.$typeUrl === DeleteOperationRequest.typeUrl || typeof o.name === "string"); + }, + isAmino(o: any): o is DeleteOperationRequestAmino { + return o && (o.$typeUrl === DeleteOperationRequest.typeUrl || typeof o.name === "string"); + }, encode(message: DeleteOperationRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -1098,7 +1163,8 @@ export const DeleteOperationRequest = { typeUrl: "/google.longrunning.DeleteOperationRequest", value: DeleteOperationRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseWaitOperationRequest(): WaitOperationRequest { return { @@ -1114,6 +1180,15 @@ function createBaseWaitOperationRequest(): WaitOperationRequest { */ export const WaitOperationRequest = { typeUrl: "/google.longrunning.WaitOperationRequest", + is(o: any): o is WaitOperationRequest { + return o && (o.$typeUrl === WaitOperationRequest.typeUrl || typeof o.name === "string"); + }, + isSDK(o: any): o is WaitOperationRequestSDKType { + return o && (o.$typeUrl === WaitOperationRequest.typeUrl || typeof o.name === "string"); + }, + isAmino(o: any): o is WaitOperationRequestAmino { + return o && (o.$typeUrl === WaitOperationRequest.typeUrl || typeof o.name === "string"); + }, encode(message: WaitOperationRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -1196,7 +1271,8 @@ export const WaitOperationRequest = { typeUrl: "/google.longrunning.WaitOperationRequest", value: WaitOperationRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseOperationInfo(): OperationInfo { return { @@ -1222,6 +1298,15 @@ function createBaseOperationInfo(): OperationInfo { */ export const OperationInfo = { typeUrl: "/google.longrunning.OperationInfo", + is(o: any): o is OperationInfo { + return o && (o.$typeUrl === OperationInfo.typeUrl || typeof o.responseType === "string" && typeof o.metadataType === "string"); + }, + isSDK(o: any): o is OperationInfoSDKType { + return o && (o.$typeUrl === OperationInfo.typeUrl || typeof o.response_type === "string" && typeof o.metadata_type === "string"); + }, + isAmino(o: any): o is OperationInfoAmino { + return o && (o.$typeUrl === OperationInfo.typeUrl || typeof o.response_type === "string" && typeof o.metadata_type === "string"); + }, encode(message: OperationInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.responseType !== "") { writer.uint32(10).string(message.responseType); @@ -1302,5 +1387,6 @@ export const OperationInfo = { typeUrl: "/google.longrunning.OperationInfo", value: OperationInfo.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/google/protobuf/any.ts b/__fixtures__/v-next/outputv3/google/protobuf/any.ts index bcabe14ed2..9d5a437e5e 100644 --- a/__fixtures__/v-next/outputv3/google/protobuf/any.ts +++ b/__fixtures__/v-next/outputv3/google/protobuf/any.ts @@ -428,6 +428,15 @@ function createBaseAny(): Any { */ export const Any = { typeUrl: "/google.protobuf.Any", + is(o: any): o is Any { + return o && (o.$typeUrl === Any.typeUrl || typeof o.typeUrl === "string" && (o.value instanceof Uint8Array || typeof o.value === "string")); + }, + isSDK(o: any): o is AnySDKType { + return o && (o.$typeUrl === Any.typeUrl || typeof o.type_url === "string" && (o.value instanceof Uint8Array || typeof o.value === "string")); + }, + isAmino(o: any): o is AnyAmino { + return o && (o.$typeUrl === Any.typeUrl || typeof o.type === "string" && (o.value instanceof Uint8Array || typeof o.value === "string")); + }, encode(message: Any, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.typeUrl !== "") { writer.uint32(10).string(message.typeUrl); @@ -504,5 +513,6 @@ export const Any = { typeUrl: "/google.protobuf.Any", value: Any.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/google/protobuf/api.ts b/__fixtures__/v-next/outputv3/google/protobuf/api.ts index ab4d202b9c..90cfde633e 100644 --- a/__fixtures__/v-next/outputv3/google/protobuf/api.ts +++ b/__fixtures__/v-next/outputv3/google/protobuf/api.ts @@ -1,7 +1,8 @@ import { Option, OptionAmino, OptionSDKType, Syntax, SyntaxSDKType, syntaxFromJSON, syntaxToJSON } from "./type"; import { SourceContext, SourceContextAmino, SourceContextSDKType } from "./source_context"; -import { BinaryReader, BinaryWriter } from "../../binary"; import { isSet, DeepPartial } from "../../helpers"; +import { BinaryReader, BinaryWriter } from "../../binary"; +import { GlobalDecoderRegistry } from "../../registry"; export const protobufPackage = "google.protobuf"; /** * Api is a light-weight descriptor for an API Interface. @@ -555,6 +556,15 @@ function createBaseApi(): Api { */ export const Api = { typeUrl: "/google.protobuf.Api", + is(o: any): o is Api { + return o && (o.$typeUrl === Api.typeUrl || typeof o.name === "string" && Array.isArray(o.methods) && (!o.methods.length || Method.is(o.methods[0])) && Array.isArray(o.options) && (!o.options.length || Option.is(o.options[0])) && typeof o.version === "string" && Array.isArray(o.mixins) && (!o.mixins.length || Mixin.is(o.mixins[0])) && isSet(o.syntax)); + }, + isSDK(o: any): o is ApiSDKType { + return o && (o.$typeUrl === Api.typeUrl || typeof o.name === "string" && Array.isArray(o.methods) && (!o.methods.length || Method.isSDK(o.methods[0])) && Array.isArray(o.options) && (!o.options.length || Option.isSDK(o.options[0])) && typeof o.version === "string" && Array.isArray(o.mixins) && (!o.mixins.length || Mixin.isSDK(o.mixins[0])) && isSet(o.syntax)); + }, + isAmino(o: any): o is ApiAmino { + return o && (o.$typeUrl === Api.typeUrl || typeof o.name === "string" && Array.isArray(o.methods) && (!o.methods.length || Method.isAmino(o.methods[0])) && Array.isArray(o.options) && (!o.options.length || Option.isAmino(o.options[0])) && typeof o.version === "string" && Array.isArray(o.mixins) && (!o.mixins.length || Mixin.isAmino(o.mixins[0])) && isSet(o.syntax)); + }, encode(message: Api, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -725,6 +735,15 @@ export const Api = { typeUrl: "/google.protobuf.Api", value: Api.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Api.typeUrl)) { + return; + } + Method.registerTypeUrl(); + Option.registerTypeUrl(); + SourceContext.registerTypeUrl(); + Mixin.registerTypeUrl(); } }; function createBaseMethod(): Method { @@ -746,6 +765,15 @@ function createBaseMethod(): Method { */ export const Method = { typeUrl: "/google.protobuf.Method", + is(o: any): o is Method { + return o && (o.$typeUrl === Method.typeUrl || typeof o.name === "string" && typeof o.requestTypeUrl === "string" && typeof o.requestStreaming === "boolean" && typeof o.responseTypeUrl === "string" && typeof o.responseStreaming === "boolean" && Array.isArray(o.options) && (!o.options.length || Option.is(o.options[0])) && isSet(o.syntax)); + }, + isSDK(o: any): o is MethodSDKType { + return o && (o.$typeUrl === Method.typeUrl || typeof o.name === "string" && typeof o.request_type_url === "string" && typeof o.request_streaming === "boolean" && typeof o.response_type_url === "string" && typeof o.response_streaming === "boolean" && Array.isArray(o.options) && (!o.options.length || Option.isSDK(o.options[0])) && isSet(o.syntax)); + }, + isAmino(o: any): o is MethodAmino { + return o && (o.$typeUrl === Method.typeUrl || typeof o.name === "string" && typeof o.request_type_url === "string" && typeof o.request_streaming === "boolean" && typeof o.response_type_url === "string" && typeof o.response_streaming === "boolean" && Array.isArray(o.options) && (!o.options.length || Option.isAmino(o.options[0])) && isSet(o.syntax)); + }, encode(message: Method, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -902,6 +930,12 @@ export const Method = { typeUrl: "/google.protobuf.Method", value: Method.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Method.typeUrl)) { + return; + } + Option.registerTypeUrl(); } }; function createBaseMixin(): Mixin { @@ -995,6 +1029,15 @@ function createBaseMixin(): Mixin { */ export const Mixin = { typeUrl: "/google.protobuf.Mixin", + is(o: any): o is Mixin { + return o && (o.$typeUrl === Mixin.typeUrl || typeof o.name === "string" && typeof o.root === "string"); + }, + isSDK(o: any): o is MixinSDKType { + return o && (o.$typeUrl === Mixin.typeUrl || typeof o.name === "string" && typeof o.root === "string"); + }, + isAmino(o: any): o is MixinAmino { + return o && (o.$typeUrl === Mixin.typeUrl || typeof o.name === "string" && typeof o.root === "string"); + }, encode(message: Mixin, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -1075,5 +1118,6 @@ export const Mixin = { typeUrl: "/google.protobuf.Mixin", value: Mixin.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/google/protobuf/compiler/plugin.ts b/__fixtures__/v-next/outputv3/google/protobuf/compiler/plugin.ts index e164816ebf..4a1a55a12b 100644 --- a/__fixtures__/v-next/outputv3/google/protobuf/compiler/plugin.ts +++ b/__fixtures__/v-next/outputv3/google/protobuf/compiler/plugin.ts @@ -1,6 +1,7 @@ import { FileDescriptorProto, FileDescriptorProtoAmino, FileDescriptorProtoSDKType } from "../descriptor"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { isSet, DeepPartial } from "../../../helpers"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "google.protobuf.compiler"; /** * The version number of protocol compiler. @@ -361,6 +362,15 @@ function createBaseVersion(): Version { */ export const Version = { typeUrl: "/google.protobuf.compiler.Version", + is(o: any): o is Version { + return o && (o.$typeUrl === Version.typeUrl || typeof o.major === "number" && typeof o.minor === "number" && typeof o.patch === "number" && typeof o.suffix === "string"); + }, + isSDK(o: any): o is VersionSDKType { + return o && (o.$typeUrl === Version.typeUrl || typeof o.major === "number" && typeof o.minor === "number" && typeof o.patch === "number" && typeof o.suffix === "string"); + }, + isAmino(o: any): o is VersionAmino { + return o && (o.$typeUrl === Version.typeUrl || typeof o.major === "number" && typeof o.minor === "number" && typeof o.patch === "number" && typeof o.suffix === "string"); + }, encode(message: Version, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.major !== 0) { writer.uint32(8).int32(message.major); @@ -469,7 +479,8 @@ export const Version = { typeUrl: "/google.protobuf.compiler.Version", value: Version.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseCodeGeneratorRequest(): CodeGeneratorRequest { return { @@ -487,6 +498,15 @@ function createBaseCodeGeneratorRequest(): CodeGeneratorRequest { */ export const CodeGeneratorRequest = { typeUrl: "/google.protobuf.compiler.CodeGeneratorRequest", + is(o: any): o is CodeGeneratorRequest { + return o && (o.$typeUrl === CodeGeneratorRequest.typeUrl || Array.isArray(o.fileToGenerate) && (!o.fileToGenerate.length || typeof o.fileToGenerate[0] === "string") && typeof o.parameter === "string" && Array.isArray(o.protoFile) && (!o.protoFile.length || FileDescriptorProto.is(o.protoFile[0]))); + }, + isSDK(o: any): o is CodeGeneratorRequestSDKType { + return o && (o.$typeUrl === CodeGeneratorRequest.typeUrl || Array.isArray(o.file_to_generate) && (!o.file_to_generate.length || typeof o.file_to_generate[0] === "string") && typeof o.parameter === "string" && Array.isArray(o.proto_file) && (!o.proto_file.length || FileDescriptorProto.isSDK(o.proto_file[0]))); + }, + isAmino(o: any): o is CodeGeneratorRequestAmino { + return o && (o.$typeUrl === CodeGeneratorRequest.typeUrl || Array.isArray(o.file_to_generate) && (!o.file_to_generate.length || typeof o.file_to_generate[0] === "string") && typeof o.parameter === "string" && Array.isArray(o.proto_file) && (!o.proto_file.length || FileDescriptorProto.isAmino(o.proto_file[0]))); + }, encode(message: CodeGeneratorRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.fileToGenerate) { writer.uint32(10).string(v!); @@ -609,6 +629,13 @@ export const CodeGeneratorRequest = { typeUrl: "/google.protobuf.compiler.CodeGeneratorRequest", value: CodeGeneratorRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(CodeGeneratorRequest.typeUrl)) { + return; + } + FileDescriptorProto.registerTypeUrl(); + Version.registerTypeUrl(); } }; function createBaseCodeGeneratorResponse(): CodeGeneratorResponse { @@ -625,6 +652,15 @@ function createBaseCodeGeneratorResponse(): CodeGeneratorResponse { */ export const CodeGeneratorResponse = { typeUrl: "/google.protobuf.compiler.CodeGeneratorResponse", + is(o: any): o is CodeGeneratorResponse { + return o && (o.$typeUrl === CodeGeneratorResponse.typeUrl || typeof o.error === "string" && Array.isArray(o.file) && (!o.file.length || CodeGeneratorResponse_File.is(o.file[0]))); + }, + isSDK(o: any): o is CodeGeneratorResponseSDKType { + return o && (o.$typeUrl === CodeGeneratorResponse.typeUrl || typeof o.error === "string" && Array.isArray(o.file) && (!o.file.length || CodeGeneratorResponse_File.isSDK(o.file[0]))); + }, + isAmino(o: any): o is CodeGeneratorResponseAmino { + return o && (o.$typeUrl === CodeGeneratorResponse.typeUrl || typeof o.error === "string" && Array.isArray(o.file) && (!o.file.length || CodeGeneratorResponse_File.isAmino(o.file[0]))); + }, encode(message: CodeGeneratorResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.error !== "") { writer.uint32(10).string(message.error); @@ -711,6 +747,12 @@ export const CodeGeneratorResponse = { typeUrl: "/google.protobuf.compiler.CodeGeneratorResponse", value: CodeGeneratorResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(CodeGeneratorResponse.typeUrl)) { + return; + } + CodeGeneratorResponse_File.registerTypeUrl(); } }; function createBaseCodeGeneratorResponse_File(): CodeGeneratorResponse_File { @@ -728,6 +770,15 @@ function createBaseCodeGeneratorResponse_File(): CodeGeneratorResponse_File { */ export const CodeGeneratorResponse_File = { typeUrl: "/google.protobuf.compiler.File", + is(o: any): o is CodeGeneratorResponse_File { + return o && (o.$typeUrl === CodeGeneratorResponse_File.typeUrl || typeof o.name === "string" && typeof o.insertionPoint === "string" && typeof o.content === "string"); + }, + isSDK(o: any): o is CodeGeneratorResponse_FileSDKType { + return o && (o.$typeUrl === CodeGeneratorResponse_File.typeUrl || typeof o.name === "string" && typeof o.insertion_point === "string" && typeof o.content === "string"); + }, + isAmino(o: any): o is CodeGeneratorResponse_FileAmino { + return o && (o.$typeUrl === CodeGeneratorResponse_File.typeUrl || typeof o.name === "string" && typeof o.insertion_point === "string" && typeof o.content === "string"); + }, encode(message: CodeGeneratorResponse_File, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -822,5 +873,6 @@ export const CodeGeneratorResponse_File = { typeUrl: "/google.protobuf.compiler.File", value: CodeGeneratorResponse_File.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/google/protobuf/descriptor.ts b/__fixtures__/v-next/outputv3/google/protobuf/descriptor.ts index f0eeb289ee..3176220065 100644 --- a/__fixtures__/v-next/outputv3/google/protobuf/descriptor.ts +++ b/__fixtures__/v-next/outputv3/google/protobuf/descriptor.ts @@ -1,5 +1,6 @@ import { BinaryReader, BinaryWriter } from "../../binary"; import { DeepPartial, isSet, bytesFromBase64, base64FromBytes } from "../../helpers"; +import { GlobalDecoderRegistry } from "../../registry"; export const protobufPackage = "google.protobuf"; export enum FieldDescriptorProto_Type { /** @@ -2568,6 +2569,15 @@ function createBaseFileDescriptorSet(): FileDescriptorSet { */ export const FileDescriptorSet = { typeUrl: "/google.protobuf.FileDescriptorSet", + is(o: any): o is FileDescriptorSet { + return o && (o.$typeUrl === FileDescriptorSet.typeUrl || Array.isArray(o.file) && (!o.file.length || FileDescriptorProto.is(o.file[0]))); + }, + isSDK(o: any): o is FileDescriptorSetSDKType { + return o && (o.$typeUrl === FileDescriptorSet.typeUrl || Array.isArray(o.file) && (!o.file.length || FileDescriptorProto.isSDK(o.file[0]))); + }, + isAmino(o: any): o is FileDescriptorSetAmino { + return o && (o.$typeUrl === FileDescriptorSet.typeUrl || Array.isArray(o.file) && (!o.file.length || FileDescriptorProto.isAmino(o.file[0]))); + }, encode(message: FileDescriptorSet, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.file) { FileDescriptorProto.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -2640,6 +2650,12 @@ export const FileDescriptorSet = { typeUrl: "/google.protobuf.FileDescriptorSet", value: FileDescriptorSet.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(FileDescriptorSet.typeUrl)) { + return; + } + FileDescriptorProto.registerTypeUrl(); } }; function createBaseFileDescriptorProto(): FileDescriptorProto { @@ -2666,6 +2682,15 @@ function createBaseFileDescriptorProto(): FileDescriptorProto { */ export const FileDescriptorProto = { typeUrl: "/google.protobuf.FileDescriptorProto", + is(o: any): o is FileDescriptorProto { + return o && (o.$typeUrl === FileDescriptorProto.typeUrl || typeof o.name === "string" && typeof o.package === "string" && Array.isArray(o.dependency) && (!o.dependency.length || typeof o.dependency[0] === "string") && Array.isArray(o.publicDependency) && (!o.publicDependency.length || typeof o.publicDependency[0] === "number") && Array.isArray(o.weakDependency) && (!o.weakDependency.length || typeof o.weakDependency[0] === "number") && Array.isArray(o.messageType) && (!o.messageType.length || DescriptorProto.is(o.messageType[0])) && Array.isArray(o.enumType) && (!o.enumType.length || EnumDescriptorProto.is(o.enumType[0])) && Array.isArray(o.service) && (!o.service.length || ServiceDescriptorProto.is(o.service[0])) && Array.isArray(o.extension) && (!o.extension.length || FieldDescriptorProto.is(o.extension[0])) && typeof o.syntax === "string"); + }, + isSDK(o: any): o is FileDescriptorProtoSDKType { + return o && (o.$typeUrl === FileDescriptorProto.typeUrl || typeof o.name === "string" && typeof o.package === "string" && Array.isArray(o.dependency) && (!o.dependency.length || typeof o.dependency[0] === "string") && Array.isArray(o.public_dependency) && (!o.public_dependency.length || typeof o.public_dependency[0] === "number") && Array.isArray(o.weak_dependency) && (!o.weak_dependency.length || typeof o.weak_dependency[0] === "number") && Array.isArray(o.message_type) && (!o.message_type.length || DescriptorProto.isSDK(o.message_type[0])) && Array.isArray(o.enum_type) && (!o.enum_type.length || EnumDescriptorProto.isSDK(o.enum_type[0])) && Array.isArray(o.service) && (!o.service.length || ServiceDescriptorProto.isSDK(o.service[0])) && Array.isArray(o.extension) && (!o.extension.length || FieldDescriptorProto.isSDK(o.extension[0])) && typeof o.syntax === "string"); + }, + isAmino(o: any): o is FileDescriptorProtoAmino { + return o && (o.$typeUrl === FileDescriptorProto.typeUrl || typeof o.name === "string" && typeof o.package === "string" && Array.isArray(o.dependency) && (!o.dependency.length || typeof o.dependency[0] === "string") && Array.isArray(o.public_dependency) && (!o.public_dependency.length || typeof o.public_dependency[0] === "number") && Array.isArray(o.weak_dependency) && (!o.weak_dependency.length || typeof o.weak_dependency[0] === "number") && Array.isArray(o.message_type) && (!o.message_type.length || DescriptorProto.isAmino(o.message_type[0])) && Array.isArray(o.enum_type) && (!o.enum_type.length || EnumDescriptorProto.isAmino(o.enum_type[0])) && Array.isArray(o.service) && (!o.service.length || ServiceDescriptorProto.isAmino(o.service[0])) && Array.isArray(o.extension) && (!o.extension.length || FieldDescriptorProto.isAmino(o.extension[0])) && typeof o.syntax === "string"); + }, encode(message: FileDescriptorProto, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -2950,6 +2975,17 @@ export const FileDescriptorProto = { typeUrl: "/google.protobuf.FileDescriptorProto", value: FileDescriptorProto.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(FileDescriptorProto.typeUrl)) { + return; + } + DescriptorProto.registerTypeUrl(); + EnumDescriptorProto.registerTypeUrl(); + ServiceDescriptorProto.registerTypeUrl(); + FieldDescriptorProto.registerTypeUrl(); + FileOptions.registerTypeUrl(); + SourceCodeInfo.registerTypeUrl(); } }; function createBaseDescriptorProto(): DescriptorProto { @@ -2974,6 +3010,15 @@ function createBaseDescriptorProto(): DescriptorProto { */ export const DescriptorProto = { typeUrl: "/google.protobuf.DescriptorProto", + is(o: any): o is DescriptorProto { + return o && (o.$typeUrl === DescriptorProto.typeUrl || typeof o.name === "string" && Array.isArray(o.field) && (!o.field.length || FieldDescriptorProto.is(o.field[0])) && Array.isArray(o.extension) && (!o.extension.length || FieldDescriptorProto.is(o.extension[0])) && Array.isArray(o.nestedType) && (!o.nestedType.length || DescriptorProto.is(o.nestedType[0])) && Array.isArray(o.enumType) && (!o.enumType.length || EnumDescriptorProto.is(o.enumType[0])) && Array.isArray(o.extensionRange) && (!o.extensionRange.length || DescriptorProto_ExtensionRange.is(o.extensionRange[0])) && Array.isArray(o.oneofDecl) && (!o.oneofDecl.length || OneofDescriptorProto.is(o.oneofDecl[0])) && Array.isArray(o.reservedRange) && (!o.reservedRange.length || DescriptorProto_ReservedRange.is(o.reservedRange[0])) && Array.isArray(o.reservedName) && (!o.reservedName.length || typeof o.reservedName[0] === "string")); + }, + isSDK(o: any): o is DescriptorProtoSDKType { + return o && (o.$typeUrl === DescriptorProto.typeUrl || typeof o.name === "string" && Array.isArray(o.field) && (!o.field.length || FieldDescriptorProto.isSDK(o.field[0])) && Array.isArray(o.extension) && (!o.extension.length || FieldDescriptorProto.isSDK(o.extension[0])) && Array.isArray(o.nested_type) && (!o.nested_type.length || DescriptorProto.isSDK(o.nested_type[0])) && Array.isArray(o.enum_type) && (!o.enum_type.length || EnumDescriptorProto.isSDK(o.enum_type[0])) && Array.isArray(o.extension_range) && (!o.extension_range.length || DescriptorProto_ExtensionRange.isSDK(o.extension_range[0])) && Array.isArray(o.oneof_decl) && (!o.oneof_decl.length || OneofDescriptorProto.isSDK(o.oneof_decl[0])) && Array.isArray(o.reserved_range) && (!o.reserved_range.length || DescriptorProto_ReservedRange.isSDK(o.reserved_range[0])) && Array.isArray(o.reserved_name) && (!o.reserved_name.length || typeof o.reserved_name[0] === "string")); + }, + isAmino(o: any): o is DescriptorProtoAmino { + return o && (o.$typeUrl === DescriptorProto.typeUrl || typeof o.name === "string" && Array.isArray(o.field) && (!o.field.length || FieldDescriptorProto.isAmino(o.field[0])) && Array.isArray(o.extension) && (!o.extension.length || FieldDescriptorProto.isAmino(o.extension[0])) && Array.isArray(o.nested_type) && (!o.nested_type.length || DescriptorProto.isAmino(o.nested_type[0])) && Array.isArray(o.enum_type) && (!o.enum_type.length || EnumDescriptorProto.isAmino(o.enum_type[0])) && Array.isArray(o.extension_range) && (!o.extension_range.length || DescriptorProto_ExtensionRange.isAmino(o.extension_range[0])) && Array.isArray(o.oneof_decl) && (!o.oneof_decl.length || OneofDescriptorProto.isAmino(o.oneof_decl[0])) && Array.isArray(o.reserved_range) && (!o.reserved_range.length || DescriptorProto_ReservedRange.isAmino(o.reserved_range[0])) && Array.isArray(o.reserved_name) && (!o.reserved_name.length || typeof o.reserved_name[0] === "string")); + }, encode(message: DescriptorProto, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -3216,6 +3261,18 @@ export const DescriptorProto = { typeUrl: "/google.protobuf.DescriptorProto", value: DescriptorProto.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(DescriptorProto.typeUrl)) { + return; + } + FieldDescriptorProto.registerTypeUrl(); + DescriptorProto.registerTypeUrl(); + EnumDescriptorProto.registerTypeUrl(); + DescriptorProto_ExtensionRange.registerTypeUrl(); + OneofDescriptorProto.registerTypeUrl(); + MessageOptions.registerTypeUrl(); + DescriptorProto_ReservedRange.registerTypeUrl(); } }; function createBaseDescriptorProto_ExtensionRange(): DescriptorProto_ExtensionRange { @@ -3232,6 +3289,15 @@ function createBaseDescriptorProto_ExtensionRange(): DescriptorProto_ExtensionRa */ export const DescriptorProto_ExtensionRange = { typeUrl: "/google.protobuf.ExtensionRange", + is(o: any): o is DescriptorProto_ExtensionRange { + return o && (o.$typeUrl === DescriptorProto_ExtensionRange.typeUrl || typeof o.start === "number" && typeof o.end === "number"); + }, + isSDK(o: any): o is DescriptorProto_ExtensionRangeSDKType { + return o && (o.$typeUrl === DescriptorProto_ExtensionRange.typeUrl || typeof o.start === "number" && typeof o.end === "number"); + }, + isAmino(o: any): o is DescriptorProto_ExtensionRangeAmino { + return o && (o.$typeUrl === DescriptorProto_ExtensionRange.typeUrl || typeof o.start === "number" && typeof o.end === "number"); + }, encode(message: DescriptorProto_ExtensionRange, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.start !== 0) { writer.uint32(8).int32(message.start); @@ -3328,6 +3394,12 @@ export const DescriptorProto_ExtensionRange = { typeUrl: "/google.protobuf.ExtensionRange", value: DescriptorProto_ExtensionRange.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(DescriptorProto_ExtensionRange.typeUrl)) { + return; + } + ExtensionRangeOptions.registerTypeUrl(); } }; function createBaseDescriptorProto_ReservedRange(): DescriptorProto_ReservedRange { @@ -3346,6 +3418,15 @@ function createBaseDescriptorProto_ReservedRange(): DescriptorProto_ReservedRang */ export const DescriptorProto_ReservedRange = { typeUrl: "/google.protobuf.ReservedRange", + is(o: any): o is DescriptorProto_ReservedRange { + return o && (o.$typeUrl === DescriptorProto_ReservedRange.typeUrl || typeof o.start === "number" && typeof o.end === "number"); + }, + isSDK(o: any): o is DescriptorProto_ReservedRangeSDKType { + return o && (o.$typeUrl === DescriptorProto_ReservedRange.typeUrl || typeof o.start === "number" && typeof o.end === "number"); + }, + isAmino(o: any): o is DescriptorProto_ReservedRangeAmino { + return o && (o.$typeUrl === DescriptorProto_ReservedRange.typeUrl || typeof o.start === "number" && typeof o.end === "number"); + }, encode(message: DescriptorProto_ReservedRange, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.start !== 0) { writer.uint32(8).int32(message.start); @@ -3426,7 +3507,8 @@ export const DescriptorProto_ReservedRange = { typeUrl: "/google.protobuf.ReservedRange", value: DescriptorProto_ReservedRange.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseExtensionRangeOptions(): ExtensionRangeOptions { return { @@ -3440,6 +3522,15 @@ function createBaseExtensionRangeOptions(): ExtensionRangeOptions { */ export const ExtensionRangeOptions = { typeUrl: "/google.protobuf.ExtensionRangeOptions", + is(o: any): o is ExtensionRangeOptions { + return o && (o.$typeUrl === ExtensionRangeOptions.typeUrl || Array.isArray(o.uninterpretedOption) && (!o.uninterpretedOption.length || UninterpretedOption.is(o.uninterpretedOption[0]))); + }, + isSDK(o: any): o is ExtensionRangeOptionsSDKType { + return o && (o.$typeUrl === ExtensionRangeOptions.typeUrl || Array.isArray(o.uninterpreted_option) && (!o.uninterpreted_option.length || UninterpretedOption.isSDK(o.uninterpreted_option[0]))); + }, + isAmino(o: any): o is ExtensionRangeOptionsAmino { + return o && (o.$typeUrl === ExtensionRangeOptions.typeUrl || Array.isArray(o.uninterpreted_option) && (!o.uninterpreted_option.length || UninterpretedOption.isAmino(o.uninterpreted_option[0]))); + }, encode(message: ExtensionRangeOptions, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.uninterpretedOption) { UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); @@ -3512,6 +3603,12 @@ export const ExtensionRangeOptions = { typeUrl: "/google.protobuf.ExtensionRangeOptions", value: ExtensionRangeOptions.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ExtensionRangeOptions.typeUrl)) { + return; + } + UninterpretedOption.registerTypeUrl(); } }; function createBaseFieldDescriptorProto(): FieldDescriptorProto { @@ -3536,6 +3633,15 @@ function createBaseFieldDescriptorProto(): FieldDescriptorProto { */ export const FieldDescriptorProto = { typeUrl: "/google.protobuf.FieldDescriptorProto", + is(o: any): o is FieldDescriptorProto { + return o && (o.$typeUrl === FieldDescriptorProto.typeUrl || typeof o.name === "string" && typeof o.number === "number" && isSet(o.label) && isSet(o.type) && typeof o.typeName === "string" && typeof o.extendee === "string" && typeof o.defaultValue === "string" && typeof o.oneofIndex === "number" && typeof o.jsonName === "string"); + }, + isSDK(o: any): o is FieldDescriptorProtoSDKType { + return o && (o.$typeUrl === FieldDescriptorProto.typeUrl || typeof o.name === "string" && typeof o.number === "number" && isSet(o.label) && isSet(o.type) && typeof o.type_name === "string" && typeof o.extendee === "string" && typeof o.default_value === "string" && typeof o.oneof_index === "number" && typeof o.json_name === "string"); + }, + isAmino(o: any): o is FieldDescriptorProtoAmino { + return o && (o.$typeUrl === FieldDescriptorProto.typeUrl || typeof o.name === "string" && typeof o.number === "number" && isSet(o.label) && isSet(o.type) && typeof o.type_name === "string" && typeof o.extendee === "string" && typeof o.default_value === "string" && typeof o.oneof_index === "number" && typeof o.json_name === "string"); + }, encode(message: FieldDescriptorProto, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -3730,6 +3836,12 @@ export const FieldDescriptorProto = { typeUrl: "/google.protobuf.FieldDescriptorProto", value: FieldDescriptorProto.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(FieldDescriptorProto.typeUrl)) { + return; + } + FieldOptions.registerTypeUrl(); } }; function createBaseOneofDescriptorProto(): OneofDescriptorProto { @@ -3746,6 +3858,15 @@ function createBaseOneofDescriptorProto(): OneofDescriptorProto { */ export const OneofDescriptorProto = { typeUrl: "/google.protobuf.OneofDescriptorProto", + is(o: any): o is OneofDescriptorProto { + return o && (o.$typeUrl === OneofDescriptorProto.typeUrl || typeof o.name === "string"); + }, + isSDK(o: any): o is OneofDescriptorProtoSDKType { + return o && (o.$typeUrl === OneofDescriptorProto.typeUrl || typeof o.name === "string"); + }, + isAmino(o: any): o is OneofDescriptorProtoAmino { + return o && (o.$typeUrl === OneofDescriptorProto.typeUrl || typeof o.name === "string"); + }, encode(message: OneofDescriptorProto, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -3828,6 +3949,12 @@ export const OneofDescriptorProto = { typeUrl: "/google.protobuf.OneofDescriptorProto", value: OneofDescriptorProto.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(OneofDescriptorProto.typeUrl)) { + return; + } + OneofOptions.registerTypeUrl(); } }; function createBaseEnumDescriptorProto(): EnumDescriptorProto { @@ -3847,6 +3974,15 @@ function createBaseEnumDescriptorProto(): EnumDescriptorProto { */ export const EnumDescriptorProto = { typeUrl: "/google.protobuf.EnumDescriptorProto", + is(o: any): o is EnumDescriptorProto { + return o && (o.$typeUrl === EnumDescriptorProto.typeUrl || typeof o.name === "string" && Array.isArray(o.value) && (!o.value.length || EnumValueDescriptorProto.is(o.value[0])) && Array.isArray(o.reservedRange) && (!o.reservedRange.length || EnumDescriptorProto_EnumReservedRange.is(o.reservedRange[0])) && Array.isArray(o.reservedName) && (!o.reservedName.length || typeof o.reservedName[0] === "string")); + }, + isSDK(o: any): o is EnumDescriptorProtoSDKType { + return o && (o.$typeUrl === EnumDescriptorProto.typeUrl || typeof o.name === "string" && Array.isArray(o.value) && (!o.value.length || EnumValueDescriptorProto.isSDK(o.value[0])) && Array.isArray(o.reserved_range) && (!o.reserved_range.length || EnumDescriptorProto_EnumReservedRange.isSDK(o.reserved_range[0])) && Array.isArray(o.reserved_name) && (!o.reserved_name.length || typeof o.reserved_name[0] === "string")); + }, + isAmino(o: any): o is EnumDescriptorProtoAmino { + return o && (o.$typeUrl === EnumDescriptorProto.typeUrl || typeof o.name === "string" && Array.isArray(o.value) && (!o.value.length || EnumValueDescriptorProto.isAmino(o.value[0])) && Array.isArray(o.reserved_range) && (!o.reserved_range.length || EnumDescriptorProto_EnumReservedRange.isAmino(o.reserved_range[0])) && Array.isArray(o.reserved_name) && (!o.reserved_name.length || typeof o.reserved_name[0] === "string")); + }, encode(message: EnumDescriptorProto, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -3989,6 +4125,14 @@ export const EnumDescriptorProto = { typeUrl: "/google.protobuf.EnumDescriptorProto", value: EnumDescriptorProto.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(EnumDescriptorProto.typeUrl)) { + return; + } + EnumValueDescriptorProto.registerTypeUrl(); + EnumOptions.registerTypeUrl(); + EnumDescriptorProto_EnumReservedRange.registerTypeUrl(); } }; function createBaseEnumDescriptorProto_EnumReservedRange(): EnumDescriptorProto_EnumReservedRange { @@ -4010,6 +4154,15 @@ function createBaseEnumDescriptorProto_EnumReservedRange(): EnumDescriptorProto_ */ export const EnumDescriptorProto_EnumReservedRange = { typeUrl: "/google.protobuf.EnumReservedRange", + is(o: any): o is EnumDescriptorProto_EnumReservedRange { + return o && (o.$typeUrl === EnumDescriptorProto_EnumReservedRange.typeUrl || typeof o.start === "number" && typeof o.end === "number"); + }, + isSDK(o: any): o is EnumDescriptorProto_EnumReservedRangeSDKType { + return o && (o.$typeUrl === EnumDescriptorProto_EnumReservedRange.typeUrl || typeof o.start === "number" && typeof o.end === "number"); + }, + isAmino(o: any): o is EnumDescriptorProto_EnumReservedRangeAmino { + return o && (o.$typeUrl === EnumDescriptorProto_EnumReservedRange.typeUrl || typeof o.start === "number" && typeof o.end === "number"); + }, encode(message: EnumDescriptorProto_EnumReservedRange, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.start !== 0) { writer.uint32(8).int32(message.start); @@ -4090,7 +4243,8 @@ export const EnumDescriptorProto_EnumReservedRange = { typeUrl: "/google.protobuf.EnumReservedRange", value: EnumDescriptorProto_EnumReservedRange.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseEnumValueDescriptorProto(): EnumValueDescriptorProto { return { @@ -4107,6 +4261,15 @@ function createBaseEnumValueDescriptorProto(): EnumValueDescriptorProto { */ export const EnumValueDescriptorProto = { typeUrl: "/google.protobuf.EnumValueDescriptorProto", + is(o: any): o is EnumValueDescriptorProto { + return o && (o.$typeUrl === EnumValueDescriptorProto.typeUrl || typeof o.name === "string" && typeof o.number === "number"); + }, + isSDK(o: any): o is EnumValueDescriptorProtoSDKType { + return o && (o.$typeUrl === EnumValueDescriptorProto.typeUrl || typeof o.name === "string" && typeof o.number === "number"); + }, + isAmino(o: any): o is EnumValueDescriptorProtoAmino { + return o && (o.$typeUrl === EnumValueDescriptorProto.typeUrl || typeof o.name === "string" && typeof o.number === "number"); + }, encode(message: EnumValueDescriptorProto, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -4203,6 +4366,12 @@ export const EnumValueDescriptorProto = { typeUrl: "/google.protobuf.EnumValueDescriptorProto", value: EnumValueDescriptorProto.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(EnumValueDescriptorProto.typeUrl)) { + return; + } + EnumValueOptions.registerTypeUrl(); } }; function createBaseServiceDescriptorProto(): ServiceDescriptorProto { @@ -4220,6 +4389,15 @@ function createBaseServiceDescriptorProto(): ServiceDescriptorProto { */ export const ServiceDescriptorProto = { typeUrl: "/google.protobuf.ServiceDescriptorProto", + is(o: any): o is ServiceDescriptorProto { + return o && (o.$typeUrl === ServiceDescriptorProto.typeUrl || typeof o.name === "string" && Array.isArray(o.method) && (!o.method.length || MethodDescriptorProto.is(o.method[0]))); + }, + isSDK(o: any): o is ServiceDescriptorProtoSDKType { + return o && (o.$typeUrl === ServiceDescriptorProto.typeUrl || typeof o.name === "string" && Array.isArray(o.method) && (!o.method.length || MethodDescriptorProto.isSDK(o.method[0]))); + }, + isAmino(o: any): o is ServiceDescriptorProtoAmino { + return o && (o.$typeUrl === ServiceDescriptorProto.typeUrl || typeof o.name === "string" && Array.isArray(o.method) && (!o.method.length || MethodDescriptorProto.isAmino(o.method[0]))); + }, encode(message: ServiceDescriptorProto, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -4322,6 +4500,13 @@ export const ServiceDescriptorProto = { typeUrl: "/google.protobuf.ServiceDescriptorProto", value: ServiceDescriptorProto.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ServiceDescriptorProto.typeUrl)) { + return; + } + MethodDescriptorProto.registerTypeUrl(); + ServiceOptions.registerTypeUrl(); } }; function createBaseMethodDescriptorProto(): MethodDescriptorProto { @@ -4342,6 +4527,15 @@ function createBaseMethodDescriptorProto(): MethodDescriptorProto { */ export const MethodDescriptorProto = { typeUrl: "/google.protobuf.MethodDescriptorProto", + is(o: any): o is MethodDescriptorProto { + return o && (o.$typeUrl === MethodDescriptorProto.typeUrl || typeof o.name === "string" && typeof o.inputType === "string" && typeof o.outputType === "string" && typeof o.clientStreaming === "boolean" && typeof o.serverStreaming === "boolean"); + }, + isSDK(o: any): o is MethodDescriptorProtoSDKType { + return o && (o.$typeUrl === MethodDescriptorProto.typeUrl || typeof o.name === "string" && typeof o.input_type === "string" && typeof o.output_type === "string" && typeof o.client_streaming === "boolean" && typeof o.server_streaming === "boolean"); + }, + isAmino(o: any): o is MethodDescriptorProtoAmino { + return o && (o.$typeUrl === MethodDescriptorProto.typeUrl || typeof o.name === "string" && typeof o.input_type === "string" && typeof o.output_type === "string" && typeof o.client_streaming === "boolean" && typeof o.server_streaming === "boolean"); + }, encode(message: MethodDescriptorProto, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -4480,6 +4674,12 @@ export const MethodDescriptorProto = { typeUrl: "/google.protobuf.MethodDescriptorProto", value: MethodDescriptorProto.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MethodDescriptorProto.typeUrl)) { + return; + } + MethodOptions.registerTypeUrl(); } }; function createBaseFileOptions(): FileOptions { @@ -4514,6 +4714,15 @@ function createBaseFileOptions(): FileOptions { */ export const FileOptions = { typeUrl: "/google.protobuf.FileOptions", + is(o: any): o is FileOptions { + return o && (o.$typeUrl === FileOptions.typeUrl || typeof o.javaPackage === "string" && typeof o.javaOuterClassname === "string" && typeof o.javaMultipleFiles === "boolean" && typeof o.javaGenerateEqualsAndHash === "boolean" && typeof o.javaStringCheckUtf8 === "boolean" && isSet(o.optimizeFor) && typeof o.goPackage === "string" && typeof o.ccGenericServices === "boolean" && typeof o.javaGenericServices === "boolean" && typeof o.pyGenericServices === "boolean" && typeof o.phpGenericServices === "boolean" && typeof o.deprecated === "boolean" && typeof o.ccEnableArenas === "boolean" && typeof o.objcClassPrefix === "string" && typeof o.csharpNamespace === "string" && typeof o.swiftPrefix === "string" && typeof o.phpClassPrefix === "string" && typeof o.phpNamespace === "string" && typeof o.phpMetadataNamespace === "string" && typeof o.rubyPackage === "string" && Array.isArray(o.uninterpretedOption) && (!o.uninterpretedOption.length || UninterpretedOption.is(o.uninterpretedOption[0]))); + }, + isSDK(o: any): o is FileOptionsSDKType { + return o && (o.$typeUrl === FileOptions.typeUrl || typeof o.java_package === "string" && typeof o.java_outer_classname === "string" && typeof o.java_multiple_files === "boolean" && typeof o.java_generate_equals_and_hash === "boolean" && typeof o.java_string_check_utf8 === "boolean" && isSet(o.optimize_for) && typeof o.go_package === "string" && typeof o.cc_generic_services === "boolean" && typeof o.java_generic_services === "boolean" && typeof o.py_generic_services === "boolean" && typeof o.php_generic_services === "boolean" && typeof o.deprecated === "boolean" && typeof o.cc_enable_arenas === "boolean" && typeof o.objc_class_prefix === "string" && typeof o.csharp_namespace === "string" && typeof o.swift_prefix === "string" && typeof o.php_class_prefix === "string" && typeof o.php_namespace === "string" && typeof o.php_metadata_namespace === "string" && typeof o.ruby_package === "string" && Array.isArray(o.uninterpreted_option) && (!o.uninterpreted_option.length || UninterpretedOption.isSDK(o.uninterpreted_option[0]))); + }, + isAmino(o: any): o is FileOptionsAmino { + return o && (o.$typeUrl === FileOptions.typeUrl || typeof o.java_package === "string" && typeof o.java_outer_classname === "string" && typeof o.java_multiple_files === "boolean" && typeof o.java_generate_equals_and_hash === "boolean" && typeof o.java_string_check_utf8 === "boolean" && isSet(o.optimize_for) && typeof o.go_package === "string" && typeof o.cc_generic_services === "boolean" && typeof o.java_generic_services === "boolean" && typeof o.py_generic_services === "boolean" && typeof o.php_generic_services === "boolean" && typeof o.deprecated === "boolean" && typeof o.cc_enable_arenas === "boolean" && typeof o.objc_class_prefix === "string" && typeof o.csharp_namespace === "string" && typeof o.swift_prefix === "string" && typeof o.php_class_prefix === "string" && typeof o.php_namespace === "string" && typeof o.php_metadata_namespace === "string" && typeof o.ruby_package === "string" && Array.isArray(o.uninterpreted_option) && (!o.uninterpreted_option.length || UninterpretedOption.isAmino(o.uninterpreted_option[0]))); + }, encode(message: FileOptions, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.javaPackage !== "") { writer.uint32(10).string(message.javaPackage); @@ -4866,6 +5075,12 @@ export const FileOptions = { typeUrl: "/google.protobuf.FileOptions", value: FileOptions.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(FileOptions.typeUrl)) { + return; + } + UninterpretedOption.registerTypeUrl(); } }; function createBaseMessageOptions(): MessageOptions { @@ -4884,6 +5099,15 @@ function createBaseMessageOptions(): MessageOptions { */ export const MessageOptions = { typeUrl: "/google.protobuf.MessageOptions", + is(o: any): o is MessageOptions { + return o && (o.$typeUrl === MessageOptions.typeUrl || typeof o.messageSetWireFormat === "boolean" && typeof o.noStandardDescriptorAccessor === "boolean" && typeof o.deprecated === "boolean" && typeof o.mapEntry === "boolean" && Array.isArray(o.uninterpretedOption) && (!o.uninterpretedOption.length || UninterpretedOption.is(o.uninterpretedOption[0]))); + }, + isSDK(o: any): o is MessageOptionsSDKType { + return o && (o.$typeUrl === MessageOptions.typeUrl || typeof o.message_set_wire_format === "boolean" && typeof o.no_standard_descriptor_accessor === "boolean" && typeof o.deprecated === "boolean" && typeof o.map_entry === "boolean" && Array.isArray(o.uninterpreted_option) && (!o.uninterpreted_option.length || UninterpretedOption.isSDK(o.uninterpreted_option[0]))); + }, + isAmino(o: any): o is MessageOptionsAmino { + return o && (o.$typeUrl === MessageOptions.typeUrl || typeof o.message_set_wire_format === "boolean" && typeof o.no_standard_descriptor_accessor === "boolean" && typeof o.deprecated === "boolean" && typeof o.map_entry === "boolean" && Array.isArray(o.uninterpreted_option) && (!o.uninterpreted_option.length || UninterpretedOption.isAmino(o.uninterpreted_option[0]))); + }, encode(message: MessageOptions, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.messageSetWireFormat === true) { writer.uint32(8).bool(message.messageSetWireFormat); @@ -5012,6 +5236,12 @@ export const MessageOptions = { typeUrl: "/google.protobuf.MessageOptions", value: MessageOptions.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MessageOptions.typeUrl)) { + return; + } + UninterpretedOption.registerTypeUrl(); } }; function createBaseFieldOptions(): FieldOptions { @@ -5032,6 +5262,15 @@ function createBaseFieldOptions(): FieldOptions { */ export const FieldOptions = { typeUrl: "/google.protobuf.FieldOptions", + is(o: any): o is FieldOptions { + return o && (o.$typeUrl === FieldOptions.typeUrl || isSet(o.ctype) && typeof o.packed === "boolean" && isSet(o.jstype) && typeof o.lazy === "boolean" && typeof o.deprecated === "boolean" && typeof o.weak === "boolean" && Array.isArray(o.uninterpretedOption) && (!o.uninterpretedOption.length || UninterpretedOption.is(o.uninterpretedOption[0]))); + }, + isSDK(o: any): o is FieldOptionsSDKType { + return o && (o.$typeUrl === FieldOptions.typeUrl || isSet(o.ctype) && typeof o.packed === "boolean" && isSet(o.jstype) && typeof o.lazy === "boolean" && typeof o.deprecated === "boolean" && typeof o.weak === "boolean" && Array.isArray(o.uninterpreted_option) && (!o.uninterpreted_option.length || UninterpretedOption.isSDK(o.uninterpreted_option[0]))); + }, + isAmino(o: any): o is FieldOptionsAmino { + return o && (o.$typeUrl === FieldOptions.typeUrl || isSet(o.ctype) && typeof o.packed === "boolean" && isSet(o.jstype) && typeof o.lazy === "boolean" && typeof o.deprecated === "boolean" && typeof o.weak === "boolean" && Array.isArray(o.uninterpreted_option) && (!o.uninterpreted_option.length || UninterpretedOption.isAmino(o.uninterpreted_option[0]))); + }, encode(message: FieldOptions, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.ctype !== 1) { writer.uint32(8).int32(message.ctype); @@ -5188,6 +5427,12 @@ export const FieldOptions = { typeUrl: "/google.protobuf.FieldOptions", value: FieldOptions.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(FieldOptions.typeUrl)) { + return; + } + UninterpretedOption.registerTypeUrl(); } }; function createBaseOneofOptions(): OneofOptions { @@ -5202,6 +5447,15 @@ function createBaseOneofOptions(): OneofOptions { */ export const OneofOptions = { typeUrl: "/google.protobuf.OneofOptions", + is(o: any): o is OneofOptions { + return o && (o.$typeUrl === OneofOptions.typeUrl || Array.isArray(o.uninterpretedOption) && (!o.uninterpretedOption.length || UninterpretedOption.is(o.uninterpretedOption[0]))); + }, + isSDK(o: any): o is OneofOptionsSDKType { + return o && (o.$typeUrl === OneofOptions.typeUrl || Array.isArray(o.uninterpreted_option) && (!o.uninterpreted_option.length || UninterpretedOption.isSDK(o.uninterpreted_option[0]))); + }, + isAmino(o: any): o is OneofOptionsAmino { + return o && (o.$typeUrl === OneofOptions.typeUrl || Array.isArray(o.uninterpreted_option) && (!o.uninterpreted_option.length || UninterpretedOption.isAmino(o.uninterpreted_option[0]))); + }, encode(message: OneofOptions, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.uninterpretedOption) { UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); @@ -5274,6 +5528,12 @@ export const OneofOptions = { typeUrl: "/google.protobuf.OneofOptions", value: OneofOptions.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(OneofOptions.typeUrl)) { + return; + } + UninterpretedOption.registerTypeUrl(); } }; function createBaseEnumOptions(): EnumOptions { @@ -5290,6 +5550,15 @@ function createBaseEnumOptions(): EnumOptions { */ export const EnumOptions = { typeUrl: "/google.protobuf.EnumOptions", + is(o: any): o is EnumOptions { + return o && (o.$typeUrl === EnumOptions.typeUrl || typeof o.allowAlias === "boolean" && typeof o.deprecated === "boolean" && Array.isArray(o.uninterpretedOption) && (!o.uninterpretedOption.length || UninterpretedOption.is(o.uninterpretedOption[0]))); + }, + isSDK(o: any): o is EnumOptionsSDKType { + return o && (o.$typeUrl === EnumOptions.typeUrl || typeof o.allow_alias === "boolean" && typeof o.deprecated === "boolean" && Array.isArray(o.uninterpreted_option) && (!o.uninterpreted_option.length || UninterpretedOption.isSDK(o.uninterpreted_option[0]))); + }, + isAmino(o: any): o is EnumOptionsAmino { + return o && (o.$typeUrl === EnumOptions.typeUrl || typeof o.allow_alias === "boolean" && typeof o.deprecated === "boolean" && Array.isArray(o.uninterpreted_option) && (!o.uninterpreted_option.length || UninterpretedOption.isAmino(o.uninterpreted_option[0]))); + }, encode(message: EnumOptions, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.allowAlias === true) { writer.uint32(16).bool(message.allowAlias); @@ -5390,6 +5659,12 @@ export const EnumOptions = { typeUrl: "/google.protobuf.EnumOptions", value: EnumOptions.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(EnumOptions.typeUrl)) { + return; + } + UninterpretedOption.registerTypeUrl(); } }; function createBaseEnumValueOptions(): EnumValueOptions { @@ -5405,6 +5680,15 @@ function createBaseEnumValueOptions(): EnumValueOptions { */ export const EnumValueOptions = { typeUrl: "/google.protobuf.EnumValueOptions", + is(o: any): o is EnumValueOptions { + return o && (o.$typeUrl === EnumValueOptions.typeUrl || typeof o.deprecated === "boolean" && Array.isArray(o.uninterpretedOption) && (!o.uninterpretedOption.length || UninterpretedOption.is(o.uninterpretedOption[0]))); + }, + isSDK(o: any): o is EnumValueOptionsSDKType { + return o && (o.$typeUrl === EnumValueOptions.typeUrl || typeof o.deprecated === "boolean" && Array.isArray(o.uninterpreted_option) && (!o.uninterpreted_option.length || UninterpretedOption.isSDK(o.uninterpreted_option[0]))); + }, + isAmino(o: any): o is EnumValueOptionsAmino { + return o && (o.$typeUrl === EnumValueOptions.typeUrl || typeof o.deprecated === "boolean" && Array.isArray(o.uninterpreted_option) && (!o.uninterpreted_option.length || UninterpretedOption.isAmino(o.uninterpreted_option[0]))); + }, encode(message: EnumValueOptions, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.deprecated === true) { writer.uint32(8).bool(message.deprecated); @@ -5491,6 +5775,12 @@ export const EnumValueOptions = { typeUrl: "/google.protobuf.EnumValueOptions", value: EnumValueOptions.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(EnumValueOptions.typeUrl)) { + return; + } + UninterpretedOption.registerTypeUrl(); } }; function createBaseServiceOptions(): ServiceOptions { @@ -5506,6 +5796,15 @@ function createBaseServiceOptions(): ServiceOptions { */ export const ServiceOptions = { typeUrl: "/google.protobuf.ServiceOptions", + is(o: any): o is ServiceOptions { + return o && (o.$typeUrl === ServiceOptions.typeUrl || typeof o.deprecated === "boolean" && Array.isArray(o.uninterpretedOption) && (!o.uninterpretedOption.length || UninterpretedOption.is(o.uninterpretedOption[0]))); + }, + isSDK(o: any): o is ServiceOptionsSDKType { + return o && (o.$typeUrl === ServiceOptions.typeUrl || typeof o.deprecated === "boolean" && Array.isArray(o.uninterpreted_option) && (!o.uninterpreted_option.length || UninterpretedOption.isSDK(o.uninterpreted_option[0]))); + }, + isAmino(o: any): o is ServiceOptionsAmino { + return o && (o.$typeUrl === ServiceOptions.typeUrl || typeof o.deprecated === "boolean" && Array.isArray(o.uninterpreted_option) && (!o.uninterpreted_option.length || UninterpretedOption.isAmino(o.uninterpreted_option[0]))); + }, encode(message: ServiceOptions, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.deprecated === true) { writer.uint32(264).bool(message.deprecated); @@ -5592,6 +5891,12 @@ export const ServiceOptions = { typeUrl: "/google.protobuf.ServiceOptions", value: ServiceOptions.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ServiceOptions.typeUrl)) { + return; + } + UninterpretedOption.registerTypeUrl(); } }; function createBaseMethodOptions(): MethodOptions { @@ -5608,6 +5913,15 @@ function createBaseMethodOptions(): MethodOptions { */ export const MethodOptions = { typeUrl: "/google.protobuf.MethodOptions", + is(o: any): o is MethodOptions { + return o && (o.$typeUrl === MethodOptions.typeUrl || typeof o.deprecated === "boolean" && isSet(o.idempotencyLevel) && Array.isArray(o.uninterpretedOption) && (!o.uninterpretedOption.length || UninterpretedOption.is(o.uninterpretedOption[0]))); + }, + isSDK(o: any): o is MethodOptionsSDKType { + return o && (o.$typeUrl === MethodOptions.typeUrl || typeof o.deprecated === "boolean" && isSet(o.idempotency_level) && Array.isArray(o.uninterpreted_option) && (!o.uninterpreted_option.length || UninterpretedOption.isSDK(o.uninterpreted_option[0]))); + }, + isAmino(o: any): o is MethodOptionsAmino { + return o && (o.$typeUrl === MethodOptions.typeUrl || typeof o.deprecated === "boolean" && isSet(o.idempotency_level) && Array.isArray(o.uninterpreted_option) && (!o.uninterpreted_option.length || UninterpretedOption.isAmino(o.uninterpreted_option[0]))); + }, encode(message: MethodOptions, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.deprecated === true) { writer.uint32(264).bool(message.deprecated); @@ -5708,6 +6022,12 @@ export const MethodOptions = { typeUrl: "/google.protobuf.MethodOptions", value: MethodOptions.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MethodOptions.typeUrl)) { + return; + } + UninterpretedOption.registerTypeUrl(); } }; function createBaseUninterpretedOption(): UninterpretedOption { @@ -5734,6 +6054,15 @@ function createBaseUninterpretedOption(): UninterpretedOption { */ export const UninterpretedOption = { typeUrl: "/google.protobuf.UninterpretedOption", + is(o: any): o is UninterpretedOption { + return o && (o.$typeUrl === UninterpretedOption.typeUrl || Array.isArray(o.name) && (!o.name.length || UninterpretedOption_NamePart.is(o.name[0])) && typeof o.identifierValue === "string" && typeof o.positiveIntValue === "bigint" && typeof o.negativeIntValue === "bigint" && typeof o.doubleValue === "number" && (o.stringValue instanceof Uint8Array || typeof o.stringValue === "string") && typeof o.aggregateValue === "string"); + }, + isSDK(o: any): o is UninterpretedOptionSDKType { + return o && (o.$typeUrl === UninterpretedOption.typeUrl || Array.isArray(o.name) && (!o.name.length || UninterpretedOption_NamePart.isSDK(o.name[0])) && typeof o.identifier_value === "string" && typeof o.positive_int_value === "bigint" && typeof o.negative_int_value === "bigint" && typeof o.double_value === "number" && (o.string_value instanceof Uint8Array || typeof o.string_value === "string") && typeof o.aggregate_value === "string"); + }, + isAmino(o: any): o is UninterpretedOptionAmino { + return o && (o.$typeUrl === UninterpretedOption.typeUrl || Array.isArray(o.name) && (!o.name.length || UninterpretedOption_NamePart.isAmino(o.name[0])) && typeof o.identifier_value === "string" && typeof o.positive_int_value === "bigint" && typeof o.negative_int_value === "bigint" && typeof o.double_value === "number" && (o.string_value instanceof Uint8Array || typeof o.string_value === "string") && typeof o.aggregate_value === "string"); + }, encode(message: UninterpretedOption, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.name) { UninterpretedOption_NamePart.encode(v!, writer.uint32(18).fork()).ldelim(); @@ -5894,6 +6223,12 @@ export const UninterpretedOption = { typeUrl: "/google.protobuf.UninterpretedOption", value: UninterpretedOption.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(UninterpretedOption.typeUrl)) { + return; + } + UninterpretedOption_NamePart.registerTypeUrl(); } }; function createBaseUninterpretedOption_NamePart(): UninterpretedOption_NamePart { @@ -5914,6 +6249,15 @@ function createBaseUninterpretedOption_NamePart(): UninterpretedOption_NamePart */ export const UninterpretedOption_NamePart = { typeUrl: "/google.protobuf.NamePart", + is(o: any): o is UninterpretedOption_NamePart { + return o && (o.$typeUrl === UninterpretedOption_NamePart.typeUrl || typeof o.namePart === "string" && typeof o.isExtension === "boolean"); + }, + isSDK(o: any): o is UninterpretedOption_NamePartSDKType { + return o && (o.$typeUrl === UninterpretedOption_NamePart.typeUrl || typeof o.name_part === "string" && typeof o.is_extension === "boolean"); + }, + isAmino(o: any): o is UninterpretedOption_NamePartAmino { + return o && (o.$typeUrl === UninterpretedOption_NamePart.typeUrl || typeof o.name_part === "string" && typeof o.is_extension === "boolean"); + }, encode(message: UninterpretedOption_NamePart, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.namePart !== "") { writer.uint32(10).string(message.namePart); @@ -5994,7 +6338,8 @@ export const UninterpretedOption_NamePart = { typeUrl: "/google.protobuf.NamePart", value: UninterpretedOption_NamePart.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseSourceCodeInfo(): SourceCodeInfo { return { @@ -6010,6 +6355,15 @@ function createBaseSourceCodeInfo(): SourceCodeInfo { */ export const SourceCodeInfo = { typeUrl: "/google.protobuf.SourceCodeInfo", + is(o: any): o is SourceCodeInfo { + return o && (o.$typeUrl === SourceCodeInfo.typeUrl || Array.isArray(o.location) && (!o.location.length || SourceCodeInfo_Location.is(o.location[0]))); + }, + isSDK(o: any): o is SourceCodeInfoSDKType { + return o && (o.$typeUrl === SourceCodeInfo.typeUrl || Array.isArray(o.location) && (!o.location.length || SourceCodeInfo_Location.isSDK(o.location[0]))); + }, + isAmino(o: any): o is SourceCodeInfoAmino { + return o && (o.$typeUrl === SourceCodeInfo.typeUrl || Array.isArray(o.location) && (!o.location.length || SourceCodeInfo_Location.isAmino(o.location[0]))); + }, encode(message: SourceCodeInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.location) { SourceCodeInfo_Location.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -6082,6 +6436,12 @@ export const SourceCodeInfo = { typeUrl: "/google.protobuf.SourceCodeInfo", value: SourceCodeInfo.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(SourceCodeInfo.typeUrl)) { + return; + } + SourceCodeInfo_Location.registerTypeUrl(); } }; function createBaseSourceCodeInfo_Location(): SourceCodeInfo_Location { @@ -6100,6 +6460,15 @@ function createBaseSourceCodeInfo_Location(): SourceCodeInfo_Location { */ export const SourceCodeInfo_Location = { typeUrl: "/google.protobuf.Location", + is(o: any): o is SourceCodeInfo_Location { + return o && (o.$typeUrl === SourceCodeInfo_Location.typeUrl || Array.isArray(o.path) && (!o.path.length || typeof o.path[0] === "number") && Array.isArray(o.span) && (!o.span.length || typeof o.span[0] === "number") && typeof o.leadingComments === "string" && typeof o.trailingComments === "string" && Array.isArray(o.leadingDetachedComments) && (!o.leadingDetachedComments.length || typeof o.leadingDetachedComments[0] === "string")); + }, + isSDK(o: any): o is SourceCodeInfo_LocationSDKType { + return o && (o.$typeUrl === SourceCodeInfo_Location.typeUrl || Array.isArray(o.path) && (!o.path.length || typeof o.path[0] === "number") && Array.isArray(o.span) && (!o.span.length || typeof o.span[0] === "number") && typeof o.leading_comments === "string" && typeof o.trailing_comments === "string" && Array.isArray(o.leading_detached_comments) && (!o.leading_detached_comments.length || typeof o.leading_detached_comments[0] === "string")); + }, + isAmino(o: any): o is SourceCodeInfo_LocationAmino { + return o && (o.$typeUrl === SourceCodeInfo_Location.typeUrl || Array.isArray(o.path) && (!o.path.length || typeof o.path[0] === "number") && Array.isArray(o.span) && (!o.span.length || typeof o.span[0] === "number") && typeof o.leading_comments === "string" && typeof o.trailing_comments === "string" && Array.isArray(o.leading_detached_comments) && (!o.leading_detached_comments.length || typeof o.leading_detached_comments[0] === "string")); + }, encode(message: SourceCodeInfo_Location, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { writer.uint32(10).fork(); for (const v of message.path) { @@ -6258,7 +6627,8 @@ export const SourceCodeInfo_Location = { typeUrl: "/google.protobuf.Location", value: SourceCodeInfo_Location.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseGeneratedCodeInfo(): GeneratedCodeInfo { return { @@ -6275,6 +6645,15 @@ function createBaseGeneratedCodeInfo(): GeneratedCodeInfo { */ export const GeneratedCodeInfo = { typeUrl: "/google.protobuf.GeneratedCodeInfo", + is(o: any): o is GeneratedCodeInfo { + return o && (o.$typeUrl === GeneratedCodeInfo.typeUrl || Array.isArray(o.annotation) && (!o.annotation.length || GeneratedCodeInfo_Annotation.is(o.annotation[0]))); + }, + isSDK(o: any): o is GeneratedCodeInfoSDKType { + return o && (o.$typeUrl === GeneratedCodeInfo.typeUrl || Array.isArray(o.annotation) && (!o.annotation.length || GeneratedCodeInfo_Annotation.isSDK(o.annotation[0]))); + }, + isAmino(o: any): o is GeneratedCodeInfoAmino { + return o && (o.$typeUrl === GeneratedCodeInfo.typeUrl || Array.isArray(o.annotation) && (!o.annotation.length || GeneratedCodeInfo_Annotation.isAmino(o.annotation[0]))); + }, encode(message: GeneratedCodeInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.annotation) { GeneratedCodeInfo_Annotation.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -6347,6 +6726,12 @@ export const GeneratedCodeInfo = { typeUrl: "/google.protobuf.GeneratedCodeInfo", value: GeneratedCodeInfo.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GeneratedCodeInfo.typeUrl)) { + return; + } + GeneratedCodeInfo_Annotation.registerTypeUrl(); } }; function createBaseGeneratedCodeInfo_Annotation(): GeneratedCodeInfo_Annotation { @@ -6364,6 +6749,15 @@ function createBaseGeneratedCodeInfo_Annotation(): GeneratedCodeInfo_Annotation */ export const GeneratedCodeInfo_Annotation = { typeUrl: "/google.protobuf.Annotation", + is(o: any): o is GeneratedCodeInfo_Annotation { + return o && (o.$typeUrl === GeneratedCodeInfo_Annotation.typeUrl || Array.isArray(o.path) && (!o.path.length || typeof o.path[0] === "number") && typeof o.sourceFile === "string" && typeof o.begin === "number" && typeof o.end === "number"); + }, + isSDK(o: any): o is GeneratedCodeInfo_AnnotationSDKType { + return o && (o.$typeUrl === GeneratedCodeInfo_Annotation.typeUrl || Array.isArray(o.path) && (!o.path.length || typeof o.path[0] === "number") && typeof o.source_file === "string" && typeof o.begin === "number" && typeof o.end === "number"); + }, + isAmino(o: any): o is GeneratedCodeInfo_AnnotationAmino { + return o && (o.$typeUrl === GeneratedCodeInfo_Annotation.typeUrl || Array.isArray(o.path) && (!o.path.length || typeof o.path[0] === "number") && typeof o.source_file === "string" && typeof o.begin === "number" && typeof o.end === "number"); + }, encode(message: GeneratedCodeInfo_Annotation, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { writer.uint32(10).fork(); for (const v of message.path) { @@ -6487,5 +6881,6 @@ export const GeneratedCodeInfo_Annotation = { typeUrl: "/google.protobuf.Annotation", value: GeneratedCodeInfo_Annotation.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/google/protobuf/duration.ts b/__fixtures__/v-next/outputv3/google/protobuf/duration.ts index 56eba8fbd6..2674c25ebf 100644 --- a/__fixtures__/v-next/outputv3/google/protobuf/duration.ts +++ b/__fixtures__/v-next/outputv3/google/protobuf/duration.ts @@ -287,6 +287,15 @@ function createBaseDuration(): Duration { */ export const Duration = { typeUrl: "/google.protobuf.Duration", + is(o: any): o is Duration { + return o && (o.$typeUrl === Duration.typeUrl || typeof o.seconds === "bigint" && typeof o.nanos === "number"); + }, + isSDK(o: any): o is DurationSDKType { + return o && (o.$typeUrl === Duration.typeUrl || typeof o.seconds === "bigint" && typeof o.nanos === "number"); + }, + isAmino(o: any): o is DurationAmino { + return o && (o.$typeUrl === Duration.typeUrl || typeof o.seconds === "bigint" && typeof o.nanos === "number"); + }, encode(message: Duration, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.seconds !== BigInt(0)) { writer.uint32(8).int64(message.seconds); @@ -363,5 +372,6 @@ export const Duration = { typeUrl: "/google.protobuf.Duration", value: Duration.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/google/protobuf/empty.ts b/__fixtures__/v-next/outputv3/google/protobuf/empty.ts index 07026d183a..d3717f67b8 100644 --- a/__fixtures__/v-next/outputv3/google/protobuf/empty.ts +++ b/__fixtures__/v-next/outputv3/google/protobuf/empty.ts @@ -69,6 +69,15 @@ function createBaseEmpty(): Empty { */ export const Empty = { typeUrl: "/google.protobuf.Empty", + is(o: any): o is Empty { + return o && o.$typeUrl === Empty.typeUrl; + }, + isSDK(o: any): o is EmptySDKType { + return o && o.$typeUrl === Empty.typeUrl; + }, + isAmino(o: any): o is EmptyAmino { + return o && o.$typeUrl === Empty.typeUrl; + }, encode(_: Empty, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -120,5 +129,6 @@ export const Empty = { typeUrl: "/google.protobuf.Empty", value: Empty.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/google/protobuf/field_mask.ts b/__fixtures__/v-next/outputv3/google/protobuf/field_mask.ts index 46b1fe149a..9f73efef85 100644 --- a/__fixtures__/v-next/outputv3/google/protobuf/field_mask.ts +++ b/__fixtures__/v-next/outputv3/google/protobuf/field_mask.ts @@ -843,6 +843,15 @@ function createBaseFieldMask(): FieldMask { */ export const FieldMask = { typeUrl: "/google.protobuf.FieldMask", + is(o: any): o is FieldMask { + return o && (o.$typeUrl === FieldMask.typeUrl || Array.isArray(o.paths) && (!o.paths.length || typeof o.paths[0] === "string")); + }, + isSDK(o: any): o is FieldMaskSDKType { + return o && (o.$typeUrl === FieldMask.typeUrl || Array.isArray(o.paths) && (!o.paths.length || typeof o.paths[0] === "string")); + }, + isAmino(o: any): o is FieldMaskAmino { + return o && (o.$typeUrl === FieldMask.typeUrl || Array.isArray(o.paths) && (!o.paths.length || typeof o.paths[0] === "string")); + }, encode(message: FieldMask, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.paths) { writer.uint32(10).string(v!); @@ -915,5 +924,6 @@ export const FieldMask = { typeUrl: "/google.protobuf.FieldMask", value: FieldMask.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/google/protobuf/source_context.ts b/__fixtures__/v-next/outputv3/google/protobuf/source_context.ts index bf727f33d1..1f735088f4 100644 --- a/__fixtures__/v-next/outputv3/google/protobuf/source_context.ts +++ b/__fixtures__/v-next/outputv3/google/protobuf/source_context.ts @@ -57,6 +57,15 @@ function createBaseSourceContext(): SourceContext { */ export const SourceContext = { typeUrl: "/google.protobuf.SourceContext", + is(o: any): o is SourceContext { + return o && (o.$typeUrl === SourceContext.typeUrl || typeof o.fileName === "string"); + }, + isSDK(o: any): o is SourceContextSDKType { + return o && (o.$typeUrl === SourceContext.typeUrl || typeof o.file_name === "string"); + }, + isAmino(o: any): o is SourceContextAmino { + return o && (o.$typeUrl === SourceContext.typeUrl || typeof o.file_name === "string"); + }, encode(message: SourceContext, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.fileName !== "") { writer.uint32(10).string(message.fileName); @@ -123,5 +132,6 @@ export const SourceContext = { typeUrl: "/google.protobuf.SourceContext", value: SourceContext.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/google/protobuf/struct.ts b/__fixtures__/v-next/outputv3/google/protobuf/struct.ts index c33531440d..2b879db351 100644 --- a/__fixtures__/v-next/outputv3/google/protobuf/struct.ts +++ b/__fixtures__/v-next/outputv3/google/protobuf/struct.ts @@ -1,4 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; +import { GlobalDecoderRegistry } from "../../registry"; import { isSet, DeepPartial, isObject } from "../../helpers"; export const protobufPackage = "google.protobuf"; /** @@ -357,6 +358,9 @@ export const Struct_FieldsEntry = { }, toProto(message: Struct_FieldsEntry): Uint8Array { return Struct_FieldsEntry.encode(message).finish(); + }, + registerTypeUrl() { + Value.registerTypeUrl(); } }; function createBaseStruct(): Struct { @@ -379,6 +383,15 @@ function createBaseStruct(): Struct { */ export const Struct = { typeUrl: "/google.protobuf.Struct", + is(o: any): o is Struct { + return o && (o.$typeUrl === Struct.typeUrl || isSet(o.fields)); + }, + isSDK(o: any): o is StructSDKType { + return o && (o.$typeUrl === Struct.typeUrl || isSet(o.fields)); + }, + isAmino(o: any): o is StructAmino { + return o && (o.$typeUrl === Struct.typeUrl || isSet(o.fields)); + }, encode(message: Struct, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { Object.entries(message.fields).forEach(([key, value]) => { Struct_FieldsEntry.encode({ @@ -483,6 +496,12 @@ export const Struct = { typeUrl: "/google.protobuf.Struct", value: Struct.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Struct.typeUrl)) { + return; + } + Value.registerTypeUrl(); } }; function createBaseValue(): Value { @@ -508,6 +527,15 @@ function createBaseValue(): Value { */ export const Value = { typeUrl: "/google.protobuf.Value", + is(o: any): o is Value { + return o && o.$typeUrl === Value.typeUrl; + }, + isSDK(o: any): o is ValueSDKType { + return o && o.$typeUrl === Value.typeUrl; + }, + isAmino(o: any): o is ValueAmino { + return o && o.$typeUrl === Value.typeUrl; + }, encode(message: Value, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.nullValue !== undefined) { writer.uint32(8).int32(message.nullValue); @@ -648,6 +676,13 @@ export const Value = { typeUrl: "/google.protobuf.Value", value: Value.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Value.typeUrl)) { + return; + } + Struct.registerTypeUrl(); + ListValue.registerTypeUrl(); } }; function createBaseListValue(): ListValue { @@ -665,6 +700,15 @@ function createBaseListValue(): ListValue { */ export const ListValue = { typeUrl: "/google.protobuf.ListValue", + is(o: any): o is ListValue { + return o && (o.$typeUrl === ListValue.typeUrl || Array.isArray(o.values) && (!o.values.length || Value.is(o.values[0]))); + }, + isSDK(o: any): o is ListValueSDKType { + return o && (o.$typeUrl === ListValue.typeUrl || Array.isArray(o.values) && (!o.values.length || Value.isSDK(o.values[0]))); + }, + isAmino(o: any): o is ListValueAmino { + return o && (o.$typeUrl === ListValue.typeUrl || Array.isArray(o.values) && (!o.values.length || Value.isAmino(o.values[0]))); + }, encode(message: ListValue, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.values) { Value.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -737,5 +781,11 @@ export const ListValue = { typeUrl: "/google.protobuf.ListValue", value: ListValue.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ListValue.typeUrl)) { + return; + } + Value.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/google/protobuf/timestamp.ts b/__fixtures__/v-next/outputv3/google/protobuf/timestamp.ts index a520669137..5073c44f67 100644 --- a/__fixtures__/v-next/outputv3/google/protobuf/timestamp.ts +++ b/__fixtures__/v-next/outputv3/google/protobuf/timestamp.ts @@ -381,6 +381,15 @@ function createBaseTimestamp(): Timestamp { */ export const Timestamp = { typeUrl: "/google.protobuf.Timestamp", + is(o: any): o is Timestamp { + return o && (o.$typeUrl === Timestamp.typeUrl || typeof o.seconds === "bigint" && typeof o.nanos === "number"); + }, + isSDK(o: any): o is TimestampSDKType { + return o && (o.$typeUrl === Timestamp.typeUrl || typeof o.seconds === "bigint" && typeof o.nanos === "number"); + }, + isAmino(o: any): o is TimestampAmino { + return o && (o.$typeUrl === Timestamp.typeUrl || typeof o.seconds === "bigint" && typeof o.nanos === "number"); + }, encode(message: Timestamp, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.seconds !== BigInt(0)) { writer.uint32(8).int64(message.seconds); @@ -453,5 +462,6 @@ export const Timestamp = { typeUrl: "/google.protobuf.Timestamp", value: Timestamp.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/google/protobuf/type.ts b/__fixtures__/v-next/outputv3/google/protobuf/type.ts index 61a85940b8..3c96681e04 100644 --- a/__fixtures__/v-next/outputv3/google/protobuf/type.ts +++ b/__fixtures__/v-next/outputv3/google/protobuf/type.ts @@ -1,7 +1,8 @@ import { SourceContext, SourceContextAmino, SourceContextSDKType } from "./source_context"; import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "./any"; -import { BinaryReader, BinaryWriter } from "../../binary"; import { isSet, DeepPartial } from "../../helpers"; +import { BinaryReader, BinaryWriter } from "../../binary"; +import { GlobalDecoderRegistry } from "../../registry"; export const protobufPackage = "google.protobuf"; /** Basic field types. */ export enum Field_Kind { @@ -652,6 +653,15 @@ function createBaseType(): Type { */ export const Type = { typeUrl: "/google.protobuf.Type", + is(o: any): o is Type { + return o && (o.$typeUrl === Type.typeUrl || typeof o.name === "string" && Array.isArray(o.fields) && (!o.fields.length || Field.is(o.fields[0])) && Array.isArray(o.oneofs) && (!o.oneofs.length || typeof o.oneofs[0] === "string") && Array.isArray(o.options) && (!o.options.length || Option.is(o.options[0])) && isSet(o.syntax)); + }, + isSDK(o: any): o is TypeSDKType { + return o && (o.$typeUrl === Type.typeUrl || typeof o.name === "string" && Array.isArray(o.fields) && (!o.fields.length || Field.isSDK(o.fields[0])) && Array.isArray(o.oneofs) && (!o.oneofs.length || typeof o.oneofs[0] === "string") && Array.isArray(o.options) && (!o.options.length || Option.isSDK(o.options[0])) && isSet(o.syntax)); + }, + isAmino(o: any): o is TypeAmino { + return o && (o.$typeUrl === Type.typeUrl || typeof o.name === "string" && Array.isArray(o.fields) && (!o.fields.length || Field.isAmino(o.fields[0])) && Array.isArray(o.oneofs) && (!o.oneofs.length || typeof o.oneofs[0] === "string") && Array.isArray(o.options) && (!o.options.length || Option.isAmino(o.options[0])) && isSet(o.syntax)); + }, encode(message: Type, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -808,6 +818,14 @@ export const Type = { typeUrl: "/google.protobuf.Type", value: Type.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Type.typeUrl)) { + return; + } + Field.registerTypeUrl(); + Option.registerTypeUrl(); + SourceContext.registerTypeUrl(); } }; function createBaseField(): Field { @@ -832,6 +850,15 @@ function createBaseField(): Field { */ export const Field = { typeUrl: "/google.protobuf.Field", + is(o: any): o is Field { + return o && (o.$typeUrl === Field.typeUrl || isSet(o.kind) && isSet(o.cardinality) && typeof o.number === "number" && typeof o.name === "string" && typeof o.typeUrl === "string" && typeof o.oneofIndex === "number" && typeof o.packed === "boolean" && Array.isArray(o.options) && (!o.options.length || Option.is(o.options[0])) && typeof o.jsonName === "string" && typeof o.defaultValue === "string"); + }, + isSDK(o: any): o is FieldSDKType { + return o && (o.$typeUrl === Field.typeUrl || isSet(o.kind) && isSet(o.cardinality) && typeof o.number === "number" && typeof o.name === "string" && typeof o.type_url === "string" && typeof o.oneof_index === "number" && typeof o.packed === "boolean" && Array.isArray(o.options) && (!o.options.length || Option.isSDK(o.options[0])) && typeof o.json_name === "string" && typeof o.default_value === "string"); + }, + isAmino(o: any): o is FieldAmino { + return o && (o.$typeUrl === Field.typeUrl || isSet(o.kind) && isSet(o.cardinality) && typeof o.number === "number" && typeof o.name === "string" && typeof o.type_url === "string" && typeof o.oneof_index === "number" && typeof o.packed === "boolean" && Array.isArray(o.options) && (!o.options.length || Option.isAmino(o.options[0])) && typeof o.json_name === "string" && typeof o.default_value === "string"); + }, encode(message: Field, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.kind !== 0) { writer.uint32(8).int32(message.kind); @@ -1030,6 +1057,12 @@ export const Field = { typeUrl: "/google.protobuf.Field", value: Field.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Field.typeUrl)) { + return; + } + Option.registerTypeUrl(); } }; function createBaseEnum(): Enum { @@ -1049,6 +1082,15 @@ function createBaseEnum(): Enum { */ export const Enum = { typeUrl: "/google.protobuf.Enum", + is(o: any): o is Enum { + return o && (o.$typeUrl === Enum.typeUrl || typeof o.name === "string" && Array.isArray(o.enumvalue) && (!o.enumvalue.length || EnumValue.is(o.enumvalue[0])) && Array.isArray(o.options) && (!o.options.length || Option.is(o.options[0])) && isSet(o.syntax)); + }, + isSDK(o: any): o is EnumSDKType { + return o && (o.$typeUrl === Enum.typeUrl || typeof o.name === "string" && Array.isArray(o.enumvalue) && (!o.enumvalue.length || EnumValue.isSDK(o.enumvalue[0])) && Array.isArray(o.options) && (!o.options.length || Option.isSDK(o.options[0])) && isSet(o.syntax)); + }, + isAmino(o: any): o is EnumAmino { + return o && (o.$typeUrl === Enum.typeUrl || typeof o.name === "string" && Array.isArray(o.enumvalue) && (!o.enumvalue.length || EnumValue.isAmino(o.enumvalue[0])) && Array.isArray(o.options) && (!o.options.length || Option.isAmino(o.options[0])) && isSet(o.syntax)); + }, encode(message: Enum, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -1185,6 +1227,14 @@ export const Enum = { typeUrl: "/google.protobuf.Enum", value: Enum.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Enum.typeUrl)) { + return; + } + EnumValue.registerTypeUrl(); + Option.registerTypeUrl(); + SourceContext.registerTypeUrl(); } }; function createBaseEnumValue(): EnumValue { @@ -1202,6 +1252,15 @@ function createBaseEnumValue(): EnumValue { */ export const EnumValue = { typeUrl: "/google.protobuf.EnumValue", + is(o: any): o is EnumValue { + return o && (o.$typeUrl === EnumValue.typeUrl || typeof o.name === "string" && typeof o.number === "number" && Array.isArray(o.options) && (!o.options.length || Option.is(o.options[0]))); + }, + isSDK(o: any): o is EnumValueSDKType { + return o && (o.$typeUrl === EnumValue.typeUrl || typeof o.name === "string" && typeof o.number === "number" && Array.isArray(o.options) && (!o.options.length || Option.isSDK(o.options[0]))); + }, + isAmino(o: any): o is EnumValueAmino { + return o && (o.$typeUrl === EnumValue.typeUrl || typeof o.name === "string" && typeof o.number === "number" && Array.isArray(o.options) && (!o.options.length || Option.isAmino(o.options[0]))); + }, encode(message: EnumValue, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -1302,6 +1361,12 @@ export const EnumValue = { typeUrl: "/google.protobuf.EnumValue", value: EnumValue.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(EnumValue.typeUrl)) { + return; + } + Option.registerTypeUrl(); } }; function createBaseOption(): Option { @@ -1319,6 +1384,15 @@ function createBaseOption(): Option { */ export const Option = { typeUrl: "/google.protobuf.Option", + is(o: any): o is Option { + return o && (o.$typeUrl === Option.typeUrl || typeof o.name === "string"); + }, + isSDK(o: any): o is OptionSDKType { + return o && (o.$typeUrl === Option.typeUrl || typeof o.name === "string"); + }, + isAmino(o: any): o is OptionAmino { + return o && (o.$typeUrl === Option.typeUrl || typeof o.name === "string"); + }, encode(message: Option, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -1401,5 +1475,6 @@ export const Option = { typeUrl: "/google.protobuf.Option", value: Option.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/google/protobuf/wrappers.ts b/__fixtures__/v-next/outputv3/google/protobuf/wrappers.ts index f63f05de02..aea575e8d0 100644 --- a/__fixtures__/v-next/outputv3/google/protobuf/wrappers.ts +++ b/__fixtures__/v-next/outputv3/google/protobuf/wrappers.ts @@ -403,6 +403,15 @@ function createBaseDoubleValue(): DoubleValue { */ export const DoubleValue = { typeUrl: "/google.protobuf.DoubleValue", + is(o: any): o is DoubleValue { + return o && (o.$typeUrl === DoubleValue.typeUrl || typeof o.value === "number"); + }, + isSDK(o: any): o is DoubleValueSDKType { + return o && (o.$typeUrl === DoubleValue.typeUrl || typeof o.value === "number"); + }, + isAmino(o: any): o is DoubleValueAmino { + return o && (o.$typeUrl === DoubleValue.typeUrl || typeof o.value === "number"); + }, encode(message: DoubleValue, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.value !== 0) { writer.uint32(9).double(message.value); @@ -469,7 +478,8 @@ export const DoubleValue = { typeUrl: "/google.protobuf.DoubleValue", value: DoubleValue.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseFloatValue(): FloatValue { return { @@ -486,6 +496,15 @@ function createBaseFloatValue(): FloatValue { */ export const FloatValue = { typeUrl: "/google.protobuf.FloatValue", + is(o: any): o is FloatValue { + return o && (o.$typeUrl === FloatValue.typeUrl || typeof o.value === "number"); + }, + isSDK(o: any): o is FloatValueSDKType { + return o && (o.$typeUrl === FloatValue.typeUrl || typeof o.value === "number"); + }, + isAmino(o: any): o is FloatValueAmino { + return o && (o.$typeUrl === FloatValue.typeUrl || typeof o.value === "number"); + }, encode(message: FloatValue, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.value !== 0) { writer.uint32(13).float(message.value); @@ -552,7 +571,8 @@ export const FloatValue = { typeUrl: "/google.protobuf.FloatValue", value: FloatValue.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseInt64Value(): Int64Value { return { @@ -569,6 +589,15 @@ function createBaseInt64Value(): Int64Value { */ export const Int64Value = { typeUrl: "/google.protobuf.Int64Value", + is(o: any): o is Int64Value { + return o && (o.$typeUrl === Int64Value.typeUrl || typeof o.value === "bigint"); + }, + isSDK(o: any): o is Int64ValueSDKType { + return o && (o.$typeUrl === Int64Value.typeUrl || typeof o.value === "bigint"); + }, + isAmino(o: any): o is Int64ValueAmino { + return o && (o.$typeUrl === Int64Value.typeUrl || typeof o.value === "bigint"); + }, encode(message: Int64Value, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.value !== BigInt(0)) { writer.uint32(8).int64(message.value); @@ -637,7 +666,8 @@ export const Int64Value = { typeUrl: "/google.protobuf.Int64Value", value: Int64Value.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseUInt64Value(): UInt64Value { return { @@ -654,6 +684,15 @@ function createBaseUInt64Value(): UInt64Value { */ export const UInt64Value = { typeUrl: "/google.protobuf.UInt64Value", + is(o: any): o is UInt64Value { + return o && (o.$typeUrl === UInt64Value.typeUrl || typeof o.value === "bigint"); + }, + isSDK(o: any): o is UInt64ValueSDKType { + return o && (o.$typeUrl === UInt64Value.typeUrl || typeof o.value === "bigint"); + }, + isAmino(o: any): o is UInt64ValueAmino { + return o && (o.$typeUrl === UInt64Value.typeUrl || typeof o.value === "bigint"); + }, encode(message: UInt64Value, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.value !== BigInt(0)) { writer.uint32(8).uint64(message.value); @@ -722,7 +761,8 @@ export const UInt64Value = { typeUrl: "/google.protobuf.UInt64Value", value: UInt64Value.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseInt32Value(): Int32Value { return { @@ -739,6 +779,15 @@ function createBaseInt32Value(): Int32Value { */ export const Int32Value = { typeUrl: "/google.protobuf.Int32Value", + is(o: any): o is Int32Value { + return o && (o.$typeUrl === Int32Value.typeUrl || typeof o.value === "number"); + }, + isSDK(o: any): o is Int32ValueSDKType { + return o && (o.$typeUrl === Int32Value.typeUrl || typeof o.value === "number"); + }, + isAmino(o: any): o is Int32ValueAmino { + return o && (o.$typeUrl === Int32Value.typeUrl || typeof o.value === "number"); + }, encode(message: Int32Value, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.value !== 0) { writer.uint32(8).int32(message.value); @@ -805,7 +854,8 @@ export const Int32Value = { typeUrl: "/google.protobuf.Int32Value", value: Int32Value.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseUInt32Value(): UInt32Value { return { @@ -822,6 +872,15 @@ function createBaseUInt32Value(): UInt32Value { */ export const UInt32Value = { typeUrl: "/google.protobuf.UInt32Value", + is(o: any): o is UInt32Value { + return o && (o.$typeUrl === UInt32Value.typeUrl || typeof o.value === "number"); + }, + isSDK(o: any): o is UInt32ValueSDKType { + return o && (o.$typeUrl === UInt32Value.typeUrl || typeof o.value === "number"); + }, + isAmino(o: any): o is UInt32ValueAmino { + return o && (o.$typeUrl === UInt32Value.typeUrl || typeof o.value === "number"); + }, encode(message: UInt32Value, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.value !== 0) { writer.uint32(8).uint32(message.value); @@ -888,7 +947,8 @@ export const UInt32Value = { typeUrl: "/google.protobuf.UInt32Value", value: UInt32Value.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseBoolValue(): BoolValue { return { @@ -905,6 +965,15 @@ function createBaseBoolValue(): BoolValue { */ export const BoolValue = { typeUrl: "/google.protobuf.BoolValue", + is(o: any): o is BoolValue { + return o && (o.$typeUrl === BoolValue.typeUrl || typeof o.value === "boolean"); + }, + isSDK(o: any): o is BoolValueSDKType { + return o && (o.$typeUrl === BoolValue.typeUrl || typeof o.value === "boolean"); + }, + isAmino(o: any): o is BoolValueAmino { + return o && (o.$typeUrl === BoolValue.typeUrl || typeof o.value === "boolean"); + }, encode(message: BoolValue, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.value === true) { writer.uint32(8).bool(message.value); @@ -971,7 +1040,8 @@ export const BoolValue = { typeUrl: "/google.protobuf.BoolValue", value: BoolValue.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseStringValue(): StringValue { return { @@ -988,6 +1058,15 @@ function createBaseStringValue(): StringValue { */ export const StringValue = { typeUrl: "/google.protobuf.StringValue", + is(o: any): o is StringValue { + return o && (o.$typeUrl === StringValue.typeUrl || typeof o.value === "string"); + }, + isSDK(o: any): o is StringValueSDKType { + return o && (o.$typeUrl === StringValue.typeUrl || typeof o.value === "string"); + }, + isAmino(o: any): o is StringValueAmino { + return o && (o.$typeUrl === StringValue.typeUrl || typeof o.value === "string"); + }, encode(message: StringValue, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.value !== "") { writer.uint32(10).string(message.value); @@ -1054,7 +1133,8 @@ export const StringValue = { typeUrl: "/google.protobuf.StringValue", value: StringValue.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseBytesValue(): BytesValue { return { @@ -1071,6 +1151,15 @@ function createBaseBytesValue(): BytesValue { */ export const BytesValue = { typeUrl: "/google.protobuf.BytesValue", + is(o: any): o is BytesValue { + return o && (o.$typeUrl === BytesValue.typeUrl || o.value instanceof Uint8Array || typeof o.value === "string"); + }, + isSDK(o: any): o is BytesValueSDKType { + return o && (o.$typeUrl === BytesValue.typeUrl || o.value instanceof Uint8Array || typeof o.value === "string"); + }, + isAmino(o: any): o is BytesValueAmino { + return o && (o.$typeUrl === BytesValue.typeUrl || o.value instanceof Uint8Array || typeof o.value === "string"); + }, encode(message: BytesValue, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.value.length !== 0) { writer.uint32(10).bytes(message.value); @@ -1137,5 +1226,6 @@ export const BytesValue = { typeUrl: "/google.protobuf.BytesValue", value: BytesValue.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/google/rpc/context/attribute_context.ts b/__fixtures__/v-next/outputv3/google/rpc/context/attribute_context.ts index 027ac1323e..41a477c4ac 100644 --- a/__fixtures__/v-next/outputv3/google/rpc/context/attribute_context.ts +++ b/__fixtures__/v-next/outputv3/google/rpc/context/attribute_context.ts @@ -3,6 +3,7 @@ import { Timestamp, TimestampAmino, TimestampSDKType } from "../../protobuf/time import { Duration, DurationAmino, DurationSDKType } from "../../protobuf/duration"; import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../protobuf/any"; import { BinaryReader, BinaryWriter } from "../../../binary"; +import { GlobalDecoderRegistry } from "../../../registry"; import { isSet, DeepPartial, isObject, toTimestamp, fromTimestamp } from "../../../helpers"; export const protobufPackage = "google.rpc.context"; /** @@ -1191,6 +1192,15 @@ function createBaseAttributeContext(): AttributeContext { */ export const AttributeContext = { typeUrl: "/google.rpc.context.AttributeContext", + is(o: any): o is AttributeContext { + return o && (o.$typeUrl === AttributeContext.typeUrl || Array.isArray(o.extensions) && (!o.extensions.length || Any.is(o.extensions[0]))); + }, + isSDK(o: any): o is AttributeContextSDKType { + return o && (o.$typeUrl === AttributeContext.typeUrl || Array.isArray(o.extensions) && (!o.extensions.length || Any.isSDK(o.extensions[0]))); + }, + isAmino(o: any): o is AttributeContextAmino { + return o && (o.$typeUrl === AttributeContext.typeUrl || Array.isArray(o.extensions) && (!o.extensions.length || Any.isAmino(o.extensions[0]))); + }, encode(message: AttributeContext, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.origin !== undefined) { AttributeContext_Peer.encode(message.origin, writer.uint32(58).fork()).ldelim(); @@ -1375,7 +1385,8 @@ export const AttributeContext = { typeUrl: "/google.rpc.context.AttributeContext", value: AttributeContext.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseAttributeContext_Peer_LabelsEntry(): AttributeContext_Peer_LabelsEntry { return { @@ -1463,7 +1474,8 @@ export const AttributeContext_Peer_LabelsEntry = { }, toProto(message: AttributeContext_Peer_LabelsEntry): Uint8Array { return AttributeContext_Peer_LabelsEntry.encode(message).finish(); - } + }, + registerTypeUrl() {} }; function createBaseAttributeContext_Peer(): AttributeContext_Peer { return { @@ -1485,6 +1497,15 @@ function createBaseAttributeContext_Peer(): AttributeContext_Peer { */ export const AttributeContext_Peer = { typeUrl: "/google.rpc.context.Peer", + is(o: any): o is AttributeContext_Peer { + return o && (o.$typeUrl === AttributeContext_Peer.typeUrl || typeof o.ip === "string" && typeof o.port === "bigint" && isSet(o.labels) && typeof o.principal === "string" && typeof o.regionCode === "string"); + }, + isSDK(o: any): o is AttributeContext_PeerSDKType { + return o && (o.$typeUrl === AttributeContext_Peer.typeUrl || typeof o.ip === "string" && typeof o.port === "bigint" && isSet(o.labels) && typeof o.principal === "string" && typeof o.region_code === "string"); + }, + isAmino(o: any): o is AttributeContext_PeerAmino { + return o && (o.$typeUrl === AttributeContext_Peer.typeUrl || typeof o.ip === "string" && typeof o.port === "bigint" && isSet(o.labels) && typeof o.principal === "string" && typeof o.region_code === "string"); + }, encode(message: AttributeContext_Peer, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.ip !== "") { writer.uint32(10).string(message.ip); @@ -1647,7 +1668,8 @@ export const AttributeContext_Peer = { typeUrl: "/google.rpc.context.Peer", value: AttributeContext_Peer.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseAttributeContext_Api(): AttributeContext_Api { return { @@ -1667,6 +1689,15 @@ function createBaseAttributeContext_Api(): AttributeContext_Api { */ export const AttributeContext_Api = { typeUrl: "/google.rpc.context.Api", + is(o: any): o is AttributeContext_Api { + return o && (o.$typeUrl === AttributeContext_Api.typeUrl || typeof o.service === "string" && typeof o.operation === "string" && typeof o.protocol === "string" && typeof o.version === "string"); + }, + isSDK(o: any): o is AttributeContext_ApiSDKType { + return o && (o.$typeUrl === AttributeContext_Api.typeUrl || typeof o.service === "string" && typeof o.operation === "string" && typeof o.protocol === "string" && typeof o.version === "string"); + }, + isAmino(o: any): o is AttributeContext_ApiAmino { + return o && (o.$typeUrl === AttributeContext_Api.typeUrl || typeof o.service === "string" && typeof o.operation === "string" && typeof o.protocol === "string" && typeof o.version === "string"); + }, encode(message: AttributeContext_Api, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.service !== "") { writer.uint32(10).string(message.service); @@ -1775,7 +1806,8 @@ export const AttributeContext_Api = { typeUrl: "/google.rpc.context.Api", value: AttributeContext_Api.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseAttributeContext_Auth(): AttributeContext_Auth { return { @@ -1796,6 +1828,15 @@ function createBaseAttributeContext_Auth(): AttributeContext_Auth { */ export const AttributeContext_Auth = { typeUrl: "/google.rpc.context.Auth", + is(o: any): o is AttributeContext_Auth { + return o && (o.$typeUrl === AttributeContext_Auth.typeUrl || typeof o.principal === "string" && Array.isArray(o.audiences) && (!o.audiences.length || typeof o.audiences[0] === "string") && typeof o.presenter === "string" && Array.isArray(o.accessLevels) && (!o.accessLevels.length || typeof o.accessLevels[0] === "string")); + }, + isSDK(o: any): o is AttributeContext_AuthSDKType { + return o && (o.$typeUrl === AttributeContext_Auth.typeUrl || typeof o.principal === "string" && Array.isArray(o.audiences) && (!o.audiences.length || typeof o.audiences[0] === "string") && typeof o.presenter === "string" && Array.isArray(o.access_levels) && (!o.access_levels.length || typeof o.access_levels[0] === "string")); + }, + isAmino(o: any): o is AttributeContext_AuthAmino { + return o && (o.$typeUrl === AttributeContext_Auth.typeUrl || typeof o.principal === "string" && Array.isArray(o.audiences) && (!o.audiences.length || typeof o.audiences[0] === "string") && typeof o.presenter === "string" && Array.isArray(o.access_levels) && (!o.access_levels.length || typeof o.access_levels[0] === "string")); + }, encode(message: AttributeContext_Auth, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.principal !== "") { writer.uint32(10).string(message.principal); @@ -1932,6 +1973,12 @@ export const AttributeContext_Auth = { typeUrl: "/google.rpc.context.Auth", value: AttributeContext_Auth.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(AttributeContext_Auth.typeUrl)) { + return; + } + Struct.registerTypeUrl(); } }; function createBaseAttributeContext_Request_HeadersEntry(): AttributeContext_Request_HeadersEntry { @@ -2020,7 +2067,8 @@ export const AttributeContext_Request_HeadersEntry = { }, toProto(message: AttributeContext_Request_HeadersEntry): Uint8Array { return AttributeContext_Request_HeadersEntry.encode(message).finish(); - } + }, + registerTypeUrl() {} }; function createBaseAttributeContext_Request(): AttributeContext_Request { return { @@ -2048,6 +2096,15 @@ function createBaseAttributeContext_Request(): AttributeContext_Request { */ export const AttributeContext_Request = { typeUrl: "/google.rpc.context.Request", + is(o: any): o is AttributeContext_Request { + return o && (o.$typeUrl === AttributeContext_Request.typeUrl || typeof o.id === "string" && typeof o.method === "string" && isSet(o.headers) && typeof o.path === "string" && typeof o.host === "string" && typeof o.scheme === "string" && typeof o.query === "string" && typeof o.size === "bigint" && typeof o.protocol === "string" && typeof o.reason === "string"); + }, + isSDK(o: any): o is AttributeContext_RequestSDKType { + return o && (o.$typeUrl === AttributeContext_Request.typeUrl || typeof o.id === "string" && typeof o.method === "string" && isSet(o.headers) && typeof o.path === "string" && typeof o.host === "string" && typeof o.scheme === "string" && typeof o.query === "string" && typeof o.size === "bigint" && typeof o.protocol === "string" && typeof o.reason === "string"); + }, + isAmino(o: any): o is AttributeContext_RequestAmino { + return o && (o.$typeUrl === AttributeContext_Request.typeUrl || typeof o.id === "string" && typeof o.method === "string" && isSet(o.headers) && typeof o.path === "string" && typeof o.host === "string" && typeof o.scheme === "string" && typeof o.query === "string" && typeof o.size === "bigint" && typeof o.protocol === "string" && typeof o.reason === "string"); + }, encode(message: AttributeContext_Request, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.id !== "") { writer.uint32(10).string(message.id); @@ -2310,6 +2367,12 @@ export const AttributeContext_Request = { typeUrl: "/google.rpc.context.Request", value: AttributeContext_Request.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(AttributeContext_Request.typeUrl)) { + return; + } + AttributeContext_Auth.registerTypeUrl(); } }; function createBaseAttributeContext_Response_HeadersEntry(): AttributeContext_Response_HeadersEntry { @@ -2398,7 +2461,8 @@ export const AttributeContext_Response_HeadersEntry = { }, toProto(message: AttributeContext_Response_HeadersEntry): Uint8Array { return AttributeContext_Response_HeadersEntry.encode(message).finish(); - } + }, + registerTypeUrl() {} }; function createBaseAttributeContext_Response(): AttributeContext_Response { return { @@ -2418,6 +2482,15 @@ function createBaseAttributeContext_Response(): AttributeContext_Response { */ export const AttributeContext_Response = { typeUrl: "/google.rpc.context.Response", + is(o: any): o is AttributeContext_Response { + return o && (o.$typeUrl === AttributeContext_Response.typeUrl || typeof o.code === "bigint" && typeof o.size === "bigint" && isSet(o.headers)); + }, + isSDK(o: any): o is AttributeContext_ResponseSDKType { + return o && (o.$typeUrl === AttributeContext_Response.typeUrl || typeof o.code === "bigint" && typeof o.size === "bigint" && isSet(o.headers)); + }, + isAmino(o: any): o is AttributeContext_ResponseAmino { + return o && (o.$typeUrl === AttributeContext_Response.typeUrl || typeof o.code === "bigint" && typeof o.size === "bigint" && isSet(o.headers)); + }, encode(message: AttributeContext_Response, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.code !== BigInt(0)) { writer.uint32(8).int64(message.code); @@ -2584,7 +2657,8 @@ export const AttributeContext_Response = { typeUrl: "/google.rpc.context.Response", value: AttributeContext_Response.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseAttributeContext_Resource_LabelsEntry(): AttributeContext_Resource_LabelsEntry { return { @@ -2672,7 +2746,8 @@ export const AttributeContext_Resource_LabelsEntry = { }, toProto(message: AttributeContext_Resource_LabelsEntry): Uint8Array { return AttributeContext_Resource_LabelsEntry.encode(message).finish(); - } + }, + registerTypeUrl() {} }; function createBaseAttributeContext_Resource_AnnotationsEntry(): AttributeContext_Resource_AnnotationsEntry { return { @@ -2760,7 +2835,8 @@ export const AttributeContext_Resource_AnnotationsEntry = { }, toProto(message: AttributeContext_Resource_AnnotationsEntry): Uint8Array { return AttributeContext_Resource_AnnotationsEntry.encode(message).finish(); - } + }, + registerTypeUrl() {} }; function createBaseAttributeContext_Resource(): AttributeContext_Resource { return { @@ -2788,6 +2864,15 @@ function createBaseAttributeContext_Resource(): AttributeContext_Resource { */ export const AttributeContext_Resource = { typeUrl: "/google.rpc.context.Resource", + is(o: any): o is AttributeContext_Resource { + return o && (o.$typeUrl === AttributeContext_Resource.typeUrl || typeof o.service === "string" && typeof o.name === "string" && typeof o.type === "string" && isSet(o.labels) && typeof o.uid === "string" && isSet(o.annotations) && typeof o.displayName === "string" && typeof o.etag === "string" && typeof o.location === "string"); + }, + isSDK(o: any): o is AttributeContext_ResourceSDKType { + return o && (o.$typeUrl === AttributeContext_Resource.typeUrl || typeof o.service === "string" && typeof o.name === "string" && typeof o.type === "string" && isSet(o.labels) && typeof o.uid === "string" && isSet(o.annotations) && typeof o.display_name === "string" && typeof o.etag === "string" && typeof o.location === "string"); + }, + isAmino(o: any): o is AttributeContext_ResourceAmino { + return o && (o.$typeUrl === AttributeContext_Resource.typeUrl || typeof o.service === "string" && typeof o.name === "string" && typeof o.type === "string" && isSet(o.labels) && typeof o.uid === "string" && isSet(o.annotations) && typeof o.display_name === "string" && typeof o.etag === "string" && typeof o.location === "string"); + }, encode(message: AttributeContext_Resource, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.service !== "") { writer.uint32(10).string(message.service); @@ -3084,5 +3169,6 @@ export const AttributeContext_Resource = { typeUrl: "/google.rpc.context.Resource", value: AttributeContext_Resource.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/google/rpc/error_details.ts b/__fixtures__/v-next/outputv3/google/rpc/error_details.ts index 68acd460a3..74aa50562c 100644 --- a/__fixtures__/v-next/outputv3/google/rpc/error_details.ts +++ b/__fixtures__/v-next/outputv3/google/rpc/error_details.ts @@ -1,5 +1,6 @@ import { Duration, DurationAmino, DurationSDKType } from "../protobuf/duration"; import { BinaryReader, BinaryWriter } from "../../binary"; +import { GlobalDecoderRegistry } from "../../registry"; import { isSet, DeepPartial, isObject } from "../../helpers"; export const protobufPackage = "google.rpc"; /** @@ -958,6 +959,15 @@ function createBaseRetryInfo(): RetryInfo { */ export const RetryInfo = { typeUrl: "/google.rpc.RetryInfo", + is(o: any): o is RetryInfo { + return o && o.$typeUrl === RetryInfo.typeUrl; + }, + isSDK(o: any): o is RetryInfoSDKType { + return o && o.$typeUrl === RetryInfo.typeUrl; + }, + isAmino(o: any): o is RetryInfoAmino { + return o && o.$typeUrl === RetryInfo.typeUrl; + }, encode(message: RetryInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.retryDelay !== undefined) { Duration.encode(message.retryDelay, writer.uint32(10).fork()).ldelim(); @@ -1026,7 +1036,8 @@ export const RetryInfo = { typeUrl: "/google.rpc.RetryInfo", value: RetryInfo.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseDebugInfo(): DebugInfo { return { @@ -1042,6 +1053,15 @@ function createBaseDebugInfo(): DebugInfo { */ export const DebugInfo = { typeUrl: "/google.rpc.DebugInfo", + is(o: any): o is DebugInfo { + return o && (o.$typeUrl === DebugInfo.typeUrl || Array.isArray(o.stackEntries) && (!o.stackEntries.length || typeof o.stackEntries[0] === "string") && typeof o.detail === "string"); + }, + isSDK(o: any): o is DebugInfoSDKType { + return o && (o.$typeUrl === DebugInfo.typeUrl || Array.isArray(o.stack_entries) && (!o.stack_entries.length || typeof o.stack_entries[0] === "string") && typeof o.detail === "string"); + }, + isAmino(o: any): o is DebugInfoAmino { + return o && (o.$typeUrl === DebugInfo.typeUrl || Array.isArray(o.stack_entries) && (!o.stack_entries.length || typeof o.stack_entries[0] === "string") && typeof o.detail === "string"); + }, encode(message: DebugInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.stackEntries) { writer.uint32(10).string(v!); @@ -1128,7 +1148,8 @@ export const DebugInfo = { typeUrl: "/google.rpc.DebugInfo", value: DebugInfo.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQuotaFailure(): QuotaFailure { return { @@ -1153,6 +1174,15 @@ function createBaseQuotaFailure(): QuotaFailure { */ export const QuotaFailure = { typeUrl: "/google.rpc.QuotaFailure", + is(o: any): o is QuotaFailure { + return o && (o.$typeUrl === QuotaFailure.typeUrl || Array.isArray(o.violations) && (!o.violations.length || QuotaFailure_Violation.is(o.violations[0]))); + }, + isSDK(o: any): o is QuotaFailureSDKType { + return o && (o.$typeUrl === QuotaFailure.typeUrl || Array.isArray(o.violations) && (!o.violations.length || QuotaFailure_Violation.isSDK(o.violations[0]))); + }, + isAmino(o: any): o is QuotaFailureAmino { + return o && (o.$typeUrl === QuotaFailure.typeUrl || Array.isArray(o.violations) && (!o.violations.length || QuotaFailure_Violation.isAmino(o.violations[0]))); + }, encode(message: QuotaFailure, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.violations) { QuotaFailure_Violation.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -1225,6 +1255,12 @@ export const QuotaFailure = { typeUrl: "/google.rpc.QuotaFailure", value: QuotaFailure.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QuotaFailure.typeUrl)) { + return; + } + QuotaFailure_Violation.registerTypeUrl(); } }; function createBaseQuotaFailure_Violation(): QuotaFailure_Violation { @@ -1242,6 +1278,15 @@ function createBaseQuotaFailure_Violation(): QuotaFailure_Violation { */ export const QuotaFailure_Violation = { typeUrl: "/google.rpc.Violation", + is(o: any): o is QuotaFailure_Violation { + return o && (o.$typeUrl === QuotaFailure_Violation.typeUrl || typeof o.subject === "string" && typeof o.description === "string"); + }, + isSDK(o: any): o is QuotaFailure_ViolationSDKType { + return o && (o.$typeUrl === QuotaFailure_Violation.typeUrl || typeof o.subject === "string" && typeof o.description === "string"); + }, + isAmino(o: any): o is QuotaFailure_ViolationAmino { + return o && (o.$typeUrl === QuotaFailure_Violation.typeUrl || typeof o.subject === "string" && typeof o.description === "string"); + }, encode(message: QuotaFailure_Violation, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.subject !== "") { writer.uint32(10).string(message.subject); @@ -1322,7 +1367,8 @@ export const QuotaFailure_Violation = { typeUrl: "/google.rpc.Violation", value: QuotaFailure_Violation.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseErrorInfo_MetadataEntry(): ErrorInfo_MetadataEntry { return { @@ -1410,7 +1456,8 @@ export const ErrorInfo_MetadataEntry = { }, toProto(message: ErrorInfo_MetadataEntry): Uint8Array { return ErrorInfo_MetadataEntry.encode(message).finish(); - } + }, + registerTypeUrl() {} }; function createBaseErrorInfo(): ErrorInfo { return { @@ -1450,6 +1497,15 @@ function createBaseErrorInfo(): ErrorInfo { */ export const ErrorInfo = { typeUrl: "/google.rpc.ErrorInfo", + is(o: any): o is ErrorInfo { + return o && (o.$typeUrl === ErrorInfo.typeUrl || typeof o.reason === "string" && typeof o.domain === "string" && isSet(o.metadata)); + }, + isSDK(o: any): o is ErrorInfoSDKType { + return o && (o.$typeUrl === ErrorInfo.typeUrl || typeof o.reason === "string" && typeof o.domain === "string" && isSet(o.metadata)); + }, + isAmino(o: any): o is ErrorInfoAmino { + return o && (o.$typeUrl === ErrorInfo.typeUrl || typeof o.reason === "string" && typeof o.domain === "string" && isSet(o.metadata)); + }, encode(message: ErrorInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.reason !== "") { writer.uint32(10).string(message.reason); @@ -1582,7 +1638,8 @@ export const ErrorInfo = { typeUrl: "/google.rpc.ErrorInfo", value: ErrorInfo.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBasePreconditionFailure(): PreconditionFailure { return { @@ -1601,6 +1658,15 @@ function createBasePreconditionFailure(): PreconditionFailure { */ export const PreconditionFailure = { typeUrl: "/google.rpc.PreconditionFailure", + is(o: any): o is PreconditionFailure { + return o && (o.$typeUrl === PreconditionFailure.typeUrl || Array.isArray(o.violations) && (!o.violations.length || PreconditionFailure_Violation.is(o.violations[0]))); + }, + isSDK(o: any): o is PreconditionFailureSDKType { + return o && (o.$typeUrl === PreconditionFailure.typeUrl || Array.isArray(o.violations) && (!o.violations.length || PreconditionFailure_Violation.isSDK(o.violations[0]))); + }, + isAmino(o: any): o is PreconditionFailureAmino { + return o && (o.$typeUrl === PreconditionFailure.typeUrl || Array.isArray(o.violations) && (!o.violations.length || PreconditionFailure_Violation.isAmino(o.violations[0]))); + }, encode(message: PreconditionFailure, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.violations) { PreconditionFailure_Violation.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -1673,6 +1739,12 @@ export const PreconditionFailure = { typeUrl: "/google.rpc.PreconditionFailure", value: PreconditionFailure.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(PreconditionFailure.typeUrl)) { + return; + } + PreconditionFailure_Violation.registerTypeUrl(); } }; function createBasePreconditionFailure_Violation(): PreconditionFailure_Violation { @@ -1690,6 +1762,15 @@ function createBasePreconditionFailure_Violation(): PreconditionFailure_Violatio */ export const PreconditionFailure_Violation = { typeUrl: "/google.rpc.Violation", + is(o: any): o is PreconditionFailure_Violation { + return o && (o.$typeUrl === PreconditionFailure_Violation.typeUrl || typeof o.type === "string" && typeof o.subject === "string" && typeof o.description === "string"); + }, + isSDK(o: any): o is PreconditionFailure_ViolationSDKType { + return o && (o.$typeUrl === PreconditionFailure_Violation.typeUrl || typeof o.type === "string" && typeof o.subject === "string" && typeof o.description === "string"); + }, + isAmino(o: any): o is PreconditionFailure_ViolationAmino { + return o && (o.$typeUrl === PreconditionFailure_Violation.typeUrl || typeof o.type === "string" && typeof o.subject === "string" && typeof o.description === "string"); + }, encode(message: PreconditionFailure_Violation, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.type !== "") { writer.uint32(10).string(message.type); @@ -1784,7 +1865,8 @@ export const PreconditionFailure_Violation = { typeUrl: "/google.rpc.Violation", value: PreconditionFailure_Violation.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseBadRequest(): BadRequest { return { @@ -1800,6 +1882,15 @@ function createBaseBadRequest(): BadRequest { */ export const BadRequest = { typeUrl: "/google.rpc.BadRequest", + is(o: any): o is BadRequest { + return o && (o.$typeUrl === BadRequest.typeUrl || Array.isArray(o.fieldViolations) && (!o.fieldViolations.length || BadRequest_FieldViolation.is(o.fieldViolations[0]))); + }, + isSDK(o: any): o is BadRequestSDKType { + return o && (o.$typeUrl === BadRequest.typeUrl || Array.isArray(o.field_violations) && (!o.field_violations.length || BadRequest_FieldViolation.isSDK(o.field_violations[0]))); + }, + isAmino(o: any): o is BadRequestAmino { + return o && (o.$typeUrl === BadRequest.typeUrl || Array.isArray(o.field_violations) && (!o.field_violations.length || BadRequest_FieldViolation.isAmino(o.field_violations[0]))); + }, encode(message: BadRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.fieldViolations) { BadRequest_FieldViolation.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -1872,6 +1963,12 @@ export const BadRequest = { typeUrl: "/google.rpc.BadRequest", value: BadRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(BadRequest.typeUrl)) { + return; + } + BadRequest_FieldViolation.registerTypeUrl(); } }; function createBaseBadRequest_FieldViolation(): BadRequest_FieldViolation { @@ -1888,6 +1985,15 @@ function createBaseBadRequest_FieldViolation(): BadRequest_FieldViolation { */ export const BadRequest_FieldViolation = { typeUrl: "/google.rpc.FieldViolation", + is(o: any): o is BadRequest_FieldViolation { + return o && (o.$typeUrl === BadRequest_FieldViolation.typeUrl || typeof o.field === "string" && typeof o.description === "string"); + }, + isSDK(o: any): o is BadRequest_FieldViolationSDKType { + return o && (o.$typeUrl === BadRequest_FieldViolation.typeUrl || typeof o.field === "string" && typeof o.description === "string"); + }, + isAmino(o: any): o is BadRequest_FieldViolationAmino { + return o && (o.$typeUrl === BadRequest_FieldViolation.typeUrl || typeof o.field === "string" && typeof o.description === "string"); + }, encode(message: BadRequest_FieldViolation, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.field !== "") { writer.uint32(10).string(message.field); @@ -1968,7 +2074,8 @@ export const BadRequest_FieldViolation = { typeUrl: "/google.rpc.FieldViolation", value: BadRequest_FieldViolation.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseRequestInfo(): RequestInfo { return { @@ -1985,6 +2092,15 @@ function createBaseRequestInfo(): RequestInfo { */ export const RequestInfo = { typeUrl: "/google.rpc.RequestInfo", + is(o: any): o is RequestInfo { + return o && (o.$typeUrl === RequestInfo.typeUrl || typeof o.requestId === "string" && typeof o.servingData === "string"); + }, + isSDK(o: any): o is RequestInfoSDKType { + return o && (o.$typeUrl === RequestInfo.typeUrl || typeof o.request_id === "string" && typeof o.serving_data === "string"); + }, + isAmino(o: any): o is RequestInfoAmino { + return o && (o.$typeUrl === RequestInfo.typeUrl || typeof o.request_id === "string" && typeof o.serving_data === "string"); + }, encode(message: RequestInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.requestId !== "") { writer.uint32(10).string(message.requestId); @@ -2065,7 +2181,8 @@ export const RequestInfo = { typeUrl: "/google.rpc.RequestInfo", value: RequestInfo.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseResourceInfo(): ResourceInfo { return { @@ -2083,6 +2200,15 @@ function createBaseResourceInfo(): ResourceInfo { */ export const ResourceInfo = { typeUrl: "/google.rpc.ResourceInfo", + is(o: any): o is ResourceInfo { + return o && (o.$typeUrl === ResourceInfo.typeUrl || typeof o.resourceType === "string" && typeof o.resourceName === "string" && typeof o.owner === "string" && typeof o.description === "string"); + }, + isSDK(o: any): o is ResourceInfoSDKType { + return o && (o.$typeUrl === ResourceInfo.typeUrl || typeof o.resource_type === "string" && typeof o.resource_name === "string" && typeof o.owner === "string" && typeof o.description === "string"); + }, + isAmino(o: any): o is ResourceInfoAmino { + return o && (o.$typeUrl === ResourceInfo.typeUrl || typeof o.resource_type === "string" && typeof o.resource_name === "string" && typeof o.owner === "string" && typeof o.description === "string"); + }, encode(message: ResourceInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.resourceType !== "") { writer.uint32(10).string(message.resourceType); @@ -2191,7 +2317,8 @@ export const ResourceInfo = { typeUrl: "/google.rpc.ResourceInfo", value: ResourceInfo.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseHelp(): Help { return { @@ -2210,6 +2337,15 @@ function createBaseHelp(): Help { */ export const Help = { typeUrl: "/google.rpc.Help", + is(o: any): o is Help { + return o && (o.$typeUrl === Help.typeUrl || Array.isArray(o.links) && (!o.links.length || Help_Link.is(o.links[0]))); + }, + isSDK(o: any): o is HelpSDKType { + return o && (o.$typeUrl === Help.typeUrl || Array.isArray(o.links) && (!o.links.length || Help_Link.isSDK(o.links[0]))); + }, + isAmino(o: any): o is HelpAmino { + return o && (o.$typeUrl === Help.typeUrl || Array.isArray(o.links) && (!o.links.length || Help_Link.isAmino(o.links[0]))); + }, encode(message: Help, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.links) { Help_Link.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -2282,6 +2418,12 @@ export const Help = { typeUrl: "/google.rpc.Help", value: Help.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Help.typeUrl)) { + return; + } + Help_Link.registerTypeUrl(); } }; function createBaseHelp_Link(): Help_Link { @@ -2298,6 +2440,15 @@ function createBaseHelp_Link(): Help_Link { */ export const Help_Link = { typeUrl: "/google.rpc.Link", + is(o: any): o is Help_Link { + return o && (o.$typeUrl === Help_Link.typeUrl || typeof o.description === "string" && typeof o.url === "string"); + }, + isSDK(o: any): o is Help_LinkSDKType { + return o && (o.$typeUrl === Help_Link.typeUrl || typeof o.description === "string" && typeof o.url === "string"); + }, + isAmino(o: any): o is Help_LinkAmino { + return o && (o.$typeUrl === Help_Link.typeUrl || typeof o.description === "string" && typeof o.url === "string"); + }, encode(message: Help_Link, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.description !== "") { writer.uint32(10).string(message.description); @@ -2378,7 +2529,8 @@ export const Help_Link = { typeUrl: "/google.rpc.Link", value: Help_Link.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseLocalizedMessage(): LocalizedMessage { return { @@ -2395,6 +2547,15 @@ function createBaseLocalizedMessage(): LocalizedMessage { */ export const LocalizedMessage = { typeUrl: "/google.rpc.LocalizedMessage", + is(o: any): o is LocalizedMessage { + return o && (o.$typeUrl === LocalizedMessage.typeUrl || typeof o.locale === "string" && typeof o.message === "string"); + }, + isSDK(o: any): o is LocalizedMessageSDKType { + return o && (o.$typeUrl === LocalizedMessage.typeUrl || typeof o.locale === "string" && typeof o.message === "string"); + }, + isAmino(o: any): o is LocalizedMessageAmino { + return o && (o.$typeUrl === LocalizedMessage.typeUrl || typeof o.locale === "string" && typeof o.message === "string"); + }, encode(message: LocalizedMessage, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.locale !== "") { writer.uint32(10).string(message.locale); @@ -2475,5 +2636,6 @@ export const LocalizedMessage = { typeUrl: "/google.rpc.LocalizedMessage", value: LocalizedMessage.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/google/rpc/status.ts b/__fixtures__/v-next/outputv3/google/rpc/status.ts index 279accbd67..fa9a05514c 100644 --- a/__fixtures__/v-next/outputv3/google/rpc/status.ts +++ b/__fixtures__/v-next/outputv3/google/rpc/status.ts @@ -102,6 +102,15 @@ function createBaseStatus(): Status { */ export const Status = { typeUrl: "/google.rpc.Status", + is(o: any): o is Status { + return o && (o.$typeUrl === Status.typeUrl || typeof o.code === "number" && typeof o.message === "string" && Array.isArray(o.details) && (!o.details.length || Any.is(o.details[0]))); + }, + isSDK(o: any): o is StatusSDKType { + return o && (o.$typeUrl === Status.typeUrl || typeof o.code === "number" && typeof o.message === "string" && Array.isArray(o.details) && (!o.details.length || Any.isSDK(o.details[0]))); + }, + isAmino(o: any): o is StatusAmino { + return o && (o.$typeUrl === Status.typeUrl || typeof o.code === "number" && typeof o.message === "string" && Array.isArray(o.details) && (!o.details.length || Any.isAmino(o.details[0]))); + }, encode(message: Status, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.code !== 0) { writer.uint32(8).int32(message.code); @@ -202,5 +211,6 @@ export const Status = { typeUrl: "/google.rpc.Status", value: Status.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/helper-func-types.ts b/__fixtures__/v-next/outputv3/helper-func-types.ts new file mode 100644 index 0000000000..3102611da1 --- /dev/null +++ b/__fixtures__/v-next/outputv3/helper-func-types.ts @@ -0,0 +1,105 @@ +/** +* This file and any referenced files were automatically generated by @hyperweb/telescope@latest +* DO NOT MODIFY BY HAND. Instead, download the latest proto files for your chain +* and run the transpile command or npm scripts command that is used to regenerate this bundle. +*/ + + +import { HttpEndpoint } from "@interchainjs/types"; +import { BinaryReader, BinaryWriter } from "./binary"; +import { getRpcClient } from "./extern"; +import { isRpc, Rpc } from "./helpers"; +import { TelescopeGeneratedCodec, DeliverTxResponse, Message, StdFee } from "./types"; +import { toConverters, toEncoders } from "@interchainjs/cosmos/utils"; +import { ISigningClient } from "@interchainjs/cosmos/types/signing-client"; + +export interface QueryBuilderOptions { + encode: (request: TReq, writer?: BinaryWriter) => BinaryWriter + decode: (input: BinaryReader | Uint8Array, length?: number) => TRes + service: string, + method: string, + deps?: TelescopeGeneratedCodec[], +} + +export function buildQuery(opts: QueryBuilderOptions) { + registerDependencies(opts.deps ?? []); + + return async (client: EndpointOrRpc, request: TReq) => { + let rpc: Rpc | undefined; + + if(isRpc(client)) { + rpc = client; + } else { + rpc = client ? await getRpcClient(client) : undefined; + } + + if (!rpc) throw new Error("Query Rpc is not initialized"); + + const data = opts.encode(request).finish(); + const response = await rpc.request(opts.service, opts.method, data); + return opts.decode(response); + }; +} + +export interface ITxArgs { + signerAddress: string; + message: TMsg | TMsg[]; + fee: StdFee | 'auto'; + memo: string; +} + +export interface TxBuilderOptions { + msg: TelescopeGeneratedCodec +} + +export function buildTx(opts: TxBuilderOptions) { + if(opts.msg){ + registerDependencies([opts.msg]); + } + + return async ( + client: ISigningClient, + signerAddress: string, + message: TMsg | TMsg[], + fee: StdFee | 'auto', + memo: string + ): Promise => { + if (!client) throw new Error("SigningClient is not initialized"); + + //register all related encoders and converters + client.addEncoders?.(toEncoders(opts.msg)); + client.addConverters?.(toConverters(opts.msg)); + + const data = Array.isArray(message) + ? message.map(msg => ({ + typeUrl: opts.msg.typeUrl, + value: msg, + })) + : [{ + typeUrl: opts.msg.typeUrl, + value: message, + }]; + return client.signAndBroadcast!(signerAddress, data, fee, memo); + }; +} + +export interface Encoder { + typeUrl: string; + fromPartial: (data: any) => any; + encode: (data: any) => Uint8Array; +} + +export interface AminoConverter { + typeUrl: string; + aminoType: string; + fromAmino: (data: any) => any; + toAmino: (data: any) => any; +} + +export type EndpointOrRpc = string | HttpEndpoint | Rpc ; + +function registerDependencies(deps: TelescopeGeneratedCodec[]) { + for (const dep of deps) { + dep.registerTypeUrl?.(); + } +} diff --git a/__fixtures__/v-next/outputv3/ibc/applications/transfer/v1/genesis.ts b/__fixtures__/v-next/outputv3/ibc/applications/transfer/v1/genesis.ts index 4745a71466..fef1dabfc7 100644 --- a/__fixtures__/v-next/outputv3/ibc/applications/transfer/v1/genesis.ts +++ b/__fixtures__/v-next/outputv3/ibc/applications/transfer/v1/genesis.ts @@ -1,5 +1,6 @@ import { DenomTrace, DenomTraceAmino, DenomTraceSDKType, Params, ParamsAmino, ParamsSDKType } from "./transfer"; import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { GlobalDecoderRegistry } from "../../../../registry"; import { isSet, DeepPartial } from "../../../../helpers"; export const protobufPackage = "ibc.applications.transfer.v1"; /** @@ -55,6 +56,15 @@ function createBaseGenesisState(): GenesisState { export const GenesisState = { typeUrl: "/ibc.applications.transfer.v1.GenesisState", aminoType: "cosmos-sdk/GenesisState", + is(o: any): o is GenesisState { + return o && (o.$typeUrl === GenesisState.typeUrl || typeof o.portId === "string" && Array.isArray(o.denomTraces) && (!o.denomTraces.length || DenomTrace.is(o.denomTraces[0])) && Params.is(o.params)); + }, + isSDK(o: any): o is GenesisStateSDKType { + return o && (o.$typeUrl === GenesisState.typeUrl || typeof o.port_id === "string" && Array.isArray(o.denom_traces) && (!o.denom_traces.length || DenomTrace.isSDK(o.denom_traces[0])) && Params.isSDK(o.params)); + }, + isAmino(o: any): o is GenesisStateAmino { + return o && (o.$typeUrl === GenesisState.typeUrl || typeof o.port_id === "string" && Array.isArray(o.denom_traces) && (!o.denom_traces.length || DenomTrace.isAmino(o.denom_traces[0])) && Params.isAmino(o.params)); + }, encode(message: GenesisState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.portId !== "") { writer.uint32(10).string(message.portId); @@ -157,5 +167,12 @@ export const GenesisState = { typeUrl: "/ibc.applications.transfer.v1.GenesisState", value: GenesisState.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GenesisState.typeUrl)) { + return; + } + DenomTrace.registerTypeUrl(); + Params.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/ibc/applications/transfer/v1/query.rpc.func.ts b/__fixtures__/v-next/outputv3/ibc/applications/transfer/v1/query.rpc.func.ts new file mode 100644 index 0000000000..b0a35c7ac8 --- /dev/null +++ b/__fixtures__/v-next/outputv3/ibc/applications/transfer/v1/query.rpc.func.ts @@ -0,0 +1,43 @@ +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../../cosmos/base/query/v1beta1/pagination"; +import { DenomTrace, DenomTraceSDKType, Params, ParamsSDKType } from "./transfer"; +import { EndpointOrRpc, buildQuery } from "../../../../helper-func-types"; +import { QueryDenomTraceRequest, QueryDenomTraceRequestSDKType, QueryDenomTraceResponse, QueryDenomTraceResponseSDKType, QueryDenomTracesRequest, QueryDenomTracesRequestSDKType, QueryDenomTracesResponse, QueryDenomTracesResponseSDKType, QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType } from "./query"; +/** + * DenomTrace queries a denomination trace information. + * @name getDenomTrace + * @package ibc.applications.transfer.v1 + * @see proto service: ibc.applications.transfer.v1.DenomTrace + */ +export const getDenomTrace = buildQuery({ + encode: QueryDenomTraceRequest.encode, + decode: QueryDenomTraceResponse.decode, + service: "ibc.applications.transfer.v1.Query", + method: "DenomTrace", + deps: [QueryDenomTraceRequest, QueryDenomTraceResponse] +}); +/** + * DenomTraces queries all denomination traces. + * @name getDenomTraces + * @package ibc.applications.transfer.v1 + * @see proto service: ibc.applications.transfer.v1.DenomTraces + */ +export const getDenomTraces = buildQuery({ + encode: QueryDenomTracesRequest.encode, + decode: QueryDenomTracesResponse.decode, + service: "ibc.applications.transfer.v1.Query", + method: "DenomTraces", + deps: [QueryDenomTracesRequest, QueryDenomTracesResponse] +}); +/** + * Params queries all parameters of the ibc-transfer module. + * @name getParams + * @package ibc.applications.transfer.v1 + * @see proto service: ibc.applications.transfer.v1.Params + */ +export const getParams = buildQuery({ + encode: QueryParamsRequest.encode, + decode: QueryParamsResponse.decode, + service: "ibc.applications.transfer.v1.Query", + method: "Params", + deps: [QueryParamsRequest, QueryParamsResponse] +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/ibc/applications/transfer/v1/query.ts b/__fixtures__/v-next/outputv3/ibc/applications/transfer/v1/query.ts index ccb412d2ae..dbb398e0a9 100644 --- a/__fixtures__/v-next/outputv3/ibc/applications/transfer/v1/query.ts +++ b/__fixtures__/v-next/outputv3/ibc/applications/transfer/v1/query.ts @@ -2,6 +2,7 @@ import { PageRequest, PageRequestAmino, PageRequestSDKType, PageResponse, PageRe import { DenomTrace, DenomTraceAmino, DenomTraceSDKType, Params, ParamsAmino, ParamsSDKType } from "./transfer"; import { BinaryReader, BinaryWriter } from "../../../../binary"; import { isSet, DeepPartial } from "../../../../helpers"; +import { GlobalDecoderRegistry } from "../../../../registry"; export const protobufPackage = "ibc.applications.transfer.v1"; /** * QueryDenomTraceRequest is the request type for the Query/DenomTrace RPC @@ -249,6 +250,15 @@ function createBaseQueryDenomTraceRequest(): QueryDenomTraceRequest { export const QueryDenomTraceRequest = { typeUrl: "/ibc.applications.transfer.v1.QueryDenomTraceRequest", aminoType: "cosmos-sdk/QueryDenomTraceRequest", + is(o: any): o is QueryDenomTraceRequest { + return o && (o.$typeUrl === QueryDenomTraceRequest.typeUrl || typeof o.hash === "string"); + }, + isSDK(o: any): o is QueryDenomTraceRequestSDKType { + return o && (o.$typeUrl === QueryDenomTraceRequest.typeUrl || typeof o.hash === "string"); + }, + isAmino(o: any): o is QueryDenomTraceRequestAmino { + return o && (o.$typeUrl === QueryDenomTraceRequest.typeUrl || typeof o.hash === "string"); + }, encode(message: QueryDenomTraceRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.hash !== "") { writer.uint32(10).string(message.hash); @@ -315,7 +325,8 @@ export const QueryDenomTraceRequest = { typeUrl: "/ibc.applications.transfer.v1.QueryDenomTraceRequest", value: QueryDenomTraceRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryDenomTraceResponse(): QueryDenomTraceResponse { return { @@ -332,6 +343,15 @@ function createBaseQueryDenomTraceResponse(): QueryDenomTraceResponse { export const QueryDenomTraceResponse = { typeUrl: "/ibc.applications.transfer.v1.QueryDenomTraceResponse", aminoType: "cosmos-sdk/QueryDenomTraceResponse", + is(o: any): o is QueryDenomTraceResponse { + return o && o.$typeUrl === QueryDenomTraceResponse.typeUrl; + }, + isSDK(o: any): o is QueryDenomTraceResponseSDKType { + return o && o.$typeUrl === QueryDenomTraceResponse.typeUrl; + }, + isAmino(o: any): o is QueryDenomTraceResponseAmino { + return o && o.$typeUrl === QueryDenomTraceResponse.typeUrl; + }, encode(message: QueryDenomTraceResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.denomTrace !== undefined) { DenomTrace.encode(message.denomTrace, writer.uint32(10).fork()).ldelim(); @@ -400,6 +420,12 @@ export const QueryDenomTraceResponse = { typeUrl: "/ibc.applications.transfer.v1.QueryDenomTraceResponse", value: QueryDenomTraceResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryDenomTraceResponse.typeUrl)) { + return; + } + DenomTrace.registerTypeUrl(); } }; function createBaseQueryDenomTracesRequest(): QueryDenomTracesRequest { @@ -417,6 +443,15 @@ function createBaseQueryDenomTracesRequest(): QueryDenomTracesRequest { export const QueryDenomTracesRequest = { typeUrl: "/ibc.applications.transfer.v1.QueryDenomTracesRequest", aminoType: "cosmos-sdk/QueryDenomTracesRequest", + is(o: any): o is QueryDenomTracesRequest { + return o && o.$typeUrl === QueryDenomTracesRequest.typeUrl; + }, + isSDK(o: any): o is QueryDenomTracesRequestSDKType { + return o && o.$typeUrl === QueryDenomTracesRequest.typeUrl; + }, + isAmino(o: any): o is QueryDenomTracesRequestAmino { + return o && o.$typeUrl === QueryDenomTracesRequest.typeUrl; + }, encode(message: QueryDenomTracesRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.pagination !== undefined) { PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); @@ -485,6 +520,12 @@ export const QueryDenomTracesRequest = { typeUrl: "/ibc.applications.transfer.v1.QueryDenomTracesRequest", value: QueryDenomTracesRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryDenomTracesRequest.typeUrl)) { + return; + } + PageRequest.registerTypeUrl(); } }; function createBaseQueryDenomTracesResponse(): QueryDenomTracesResponse { @@ -503,6 +544,15 @@ function createBaseQueryDenomTracesResponse(): QueryDenomTracesResponse { export const QueryDenomTracesResponse = { typeUrl: "/ibc.applications.transfer.v1.QueryDenomTracesResponse", aminoType: "cosmos-sdk/QueryDenomTracesResponse", + is(o: any): o is QueryDenomTracesResponse { + return o && (o.$typeUrl === QueryDenomTracesResponse.typeUrl || Array.isArray(o.denomTraces) && (!o.denomTraces.length || DenomTrace.is(o.denomTraces[0]))); + }, + isSDK(o: any): o is QueryDenomTracesResponseSDKType { + return o && (o.$typeUrl === QueryDenomTracesResponse.typeUrl || Array.isArray(o.denom_traces) && (!o.denom_traces.length || DenomTrace.isSDK(o.denom_traces[0]))); + }, + isAmino(o: any): o is QueryDenomTracesResponseAmino { + return o && (o.$typeUrl === QueryDenomTracesResponse.typeUrl || Array.isArray(o.denom_traces) && (!o.denom_traces.length || DenomTrace.isAmino(o.denom_traces[0]))); + }, encode(message: QueryDenomTracesResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.denomTraces) { DenomTrace.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -591,6 +641,13 @@ export const QueryDenomTracesResponse = { typeUrl: "/ibc.applications.transfer.v1.QueryDenomTracesResponse", value: QueryDenomTracesResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryDenomTracesResponse.typeUrl)) { + return; + } + DenomTrace.registerTypeUrl(); + PageResponse.registerTypeUrl(); } }; function createBaseQueryParamsRequest(): QueryParamsRequest { @@ -605,6 +662,15 @@ function createBaseQueryParamsRequest(): QueryParamsRequest { export const QueryParamsRequest = { typeUrl: "/ibc.applications.transfer.v1.QueryParamsRequest", aminoType: "cosmos-sdk/QueryParamsRequest", + is(o: any): o is QueryParamsRequest { + return o && o.$typeUrl === QueryParamsRequest.typeUrl; + }, + isSDK(o: any): o is QueryParamsRequestSDKType { + return o && o.$typeUrl === QueryParamsRequest.typeUrl; + }, + isAmino(o: any): o is QueryParamsRequestAmino { + return o && o.$typeUrl === QueryParamsRequest.typeUrl; + }, encode(_: QueryParamsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -656,7 +722,8 @@ export const QueryParamsRequest = { typeUrl: "/ibc.applications.transfer.v1.QueryParamsRequest", value: QueryParamsRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryParamsResponse(): QueryParamsResponse { return { @@ -672,6 +739,15 @@ function createBaseQueryParamsResponse(): QueryParamsResponse { export const QueryParamsResponse = { typeUrl: "/ibc.applications.transfer.v1.QueryParamsResponse", aminoType: "cosmos-sdk/QueryParamsResponse", + is(o: any): o is QueryParamsResponse { + return o && o.$typeUrl === QueryParamsResponse.typeUrl; + }, + isSDK(o: any): o is QueryParamsResponseSDKType { + return o && o.$typeUrl === QueryParamsResponse.typeUrl; + }, + isAmino(o: any): o is QueryParamsResponseAmino { + return o && o.$typeUrl === QueryParamsResponse.typeUrl; + }, encode(message: QueryParamsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.params !== undefined) { Params.encode(message.params, writer.uint32(10).fork()).ldelim(); @@ -740,5 +816,11 @@ export const QueryParamsResponse = { typeUrl: "/ibc.applications.transfer.v1.QueryParamsResponse", value: QueryParamsResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryParamsResponse.typeUrl)) { + return; + } + Params.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/ibc/applications/transfer/v1/transfer.ts b/__fixtures__/v-next/outputv3/ibc/applications/transfer/v1/transfer.ts index ea6f97c256..1cd81ddd00 100644 --- a/__fixtures__/v-next/outputv3/ibc/applications/transfer/v1/transfer.ts +++ b/__fixtures__/v-next/outputv3/ibc/applications/transfer/v1/transfer.ts @@ -127,6 +127,15 @@ function createBaseDenomTrace(): DenomTrace { export const DenomTrace = { typeUrl: "/ibc.applications.transfer.v1.DenomTrace", aminoType: "cosmos-sdk/DenomTrace", + is(o: any): o is DenomTrace { + return o && (o.$typeUrl === DenomTrace.typeUrl || typeof o.path === "string" && typeof o.baseDenom === "string"); + }, + isSDK(o: any): o is DenomTraceSDKType { + return o && (o.$typeUrl === DenomTrace.typeUrl || typeof o.path === "string" && typeof o.base_denom === "string"); + }, + isAmino(o: any): o is DenomTraceAmino { + return o && (o.$typeUrl === DenomTrace.typeUrl || typeof o.path === "string" && typeof o.base_denom === "string"); + }, encode(message: DenomTrace, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.path !== "") { writer.uint32(10).string(message.path); @@ -207,7 +216,8 @@ export const DenomTrace = { typeUrl: "/ibc.applications.transfer.v1.DenomTrace", value: DenomTrace.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseParams(): Params { return { @@ -227,6 +237,15 @@ function createBaseParams(): Params { export const Params = { typeUrl: "/ibc.applications.transfer.v1.Params", aminoType: "cosmos-sdk/Params", + is(o: any): o is Params { + return o && (o.$typeUrl === Params.typeUrl || typeof o.sendEnabled === "boolean" && typeof o.receiveEnabled === "boolean"); + }, + isSDK(o: any): o is ParamsSDKType { + return o && (o.$typeUrl === Params.typeUrl || typeof o.send_enabled === "boolean" && typeof o.receive_enabled === "boolean"); + }, + isAmino(o: any): o is ParamsAmino { + return o && (o.$typeUrl === Params.typeUrl || typeof o.send_enabled === "boolean" && typeof o.receive_enabled === "boolean"); + }, encode(message: Params, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.sendEnabled === true) { writer.uint32(8).bool(message.sendEnabled); @@ -307,5 +326,6 @@ export const Params = { typeUrl: "/ibc.applications.transfer.v1.Params", value: Params.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/ibc/applications/transfer/v1/tx.registry.ts b/__fixtures__/v-next/outputv3/ibc/applications/transfer/v1/tx.registry.ts index f9681849ef..4c8e70982d 100644 --- a/__fixtures__/v-next/outputv3/ibc/applications/transfer/v1/tx.registry.ts +++ b/__fixtures__/v-next/outputv3/ibc/applications/transfer/v1/tx.registry.ts @@ -1,13 +1,8 @@ import { Coin, CoinSDKType } from "../../../../cosmos/base/v1beta1/coin"; import { Height, HeightSDKType } from "../../../core/client/v1/client"; -import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { TelescopeGeneratedType } from "../../../../types"; import { MsgTransfer, MsgTransferSDKType } from "./tx"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/ibc.applications.transfer.v1.MsgTransfer", MsgTransfer]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/ibc.applications.transfer.v1.MsgTransfer", MsgTransfer]]; export const MessageComposer = { encoded: { transfer(value: MsgTransfer) { diff --git a/__fixtures__/v-next/outputv3/ibc/applications/transfer/v1/tx.rpc.func.ts b/__fixtures__/v-next/outputv3/ibc/applications/transfer/v1/tx.rpc.func.ts new file mode 100644 index 0000000000..9f352ae025 --- /dev/null +++ b/__fixtures__/v-next/outputv3/ibc/applications/transfer/v1/tx.rpc.func.ts @@ -0,0 +1,13 @@ +import { Coin, CoinSDKType } from "../../../../cosmos/base/v1beta1/coin"; +import { Height, HeightSDKType } from "../../../core/client/v1/client"; +import { buildTx } from "../../../../helper-func-types"; +import { MsgTransfer, MsgTransferSDKType, MsgTransferResponse, MsgTransferResponseSDKType } from "./tx"; +/** + * Transfer defines a rpc handler method for MsgTransfer. + * @name transfer + * @package ibc.applications.transfer.v1 + * @see proto service: ibc.applications.transfer.v1.Transfer + */ +export const transfer = buildTx({ + msg: MsgTransfer +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/ibc/applications/transfer/v1/tx.ts b/__fixtures__/v-next/outputv3/ibc/applications/transfer/v1/tx.ts index ff0b246b04..ef792fd1b7 100644 --- a/__fixtures__/v-next/outputv3/ibc/applications/transfer/v1/tx.ts +++ b/__fixtures__/v-next/outputv3/ibc/applications/transfer/v1/tx.ts @@ -1,6 +1,7 @@ import { Coin, CoinAmino, CoinSDKType } from "../../../../cosmos/base/v1beta1/coin"; import { Height, HeightAmino, HeightSDKType } from "../../../core/client/v1/client"; import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { GlobalDecoderRegistry } from "../../../../registry"; import { isSet, DeepPartial } from "../../../../helpers"; export const protobufPackage = "ibc.applications.transfer.v1"; /** @@ -151,6 +152,15 @@ function createBaseMsgTransfer(): MsgTransfer { export const MsgTransfer = { typeUrl: "/ibc.applications.transfer.v1.MsgTransfer", aminoType: "cosmos-sdk/MsgTransfer", + is(o: any): o is MsgTransfer { + return o && (o.$typeUrl === MsgTransfer.typeUrl || typeof o.sourcePort === "string" && typeof o.sourceChannel === "string" && Coin.is(o.token) && typeof o.sender === "string" && typeof o.receiver === "string" && Height.is(o.timeoutHeight) && typeof o.timeoutTimestamp === "bigint"); + }, + isSDK(o: any): o is MsgTransferSDKType { + return o && (o.$typeUrl === MsgTransfer.typeUrl || typeof o.source_port === "string" && typeof o.source_channel === "string" && Coin.isSDK(o.token) && typeof o.sender === "string" && typeof o.receiver === "string" && Height.isSDK(o.timeout_height) && typeof o.timeout_timestamp === "bigint"); + }, + isAmino(o: any): o is MsgTransferAmino { + return o && (o.$typeUrl === MsgTransfer.typeUrl || typeof o.source_port === "string" && typeof o.source_channel === "string" && Coin.isAmino(o.token) && typeof o.sender === "string" && typeof o.receiver === "string" && Height.isAmino(o.timeout_height) && typeof o.timeout_timestamp === "bigint"); + }, encode(message: MsgTransfer, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.sourcePort !== "") { writer.uint32(10).string(message.sourcePort); @@ -307,6 +317,13 @@ export const MsgTransfer = { typeUrl: "/ibc.applications.transfer.v1.MsgTransfer", value: MsgTransfer.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgTransfer.typeUrl)) { + return; + } + Coin.registerTypeUrl(); + Height.registerTypeUrl(); } }; function createBaseMsgTransferResponse(): MsgTransferResponse { @@ -321,6 +338,15 @@ function createBaseMsgTransferResponse(): MsgTransferResponse { export const MsgTransferResponse = { typeUrl: "/ibc.applications.transfer.v1.MsgTransferResponse", aminoType: "cosmos-sdk/MsgTransferResponse", + is(o: any): o is MsgTransferResponse { + return o && o.$typeUrl === MsgTransferResponse.typeUrl; + }, + isSDK(o: any): o is MsgTransferResponseSDKType { + return o && o.$typeUrl === MsgTransferResponse.typeUrl; + }, + isAmino(o: any): o is MsgTransferResponseAmino { + return o && o.$typeUrl === MsgTransferResponse.typeUrl; + }, encode(_: MsgTransferResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -372,5 +398,6 @@ export const MsgTransferResponse = { typeUrl: "/ibc.applications.transfer.v1.MsgTransferResponse", value: MsgTransferResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/ibc/applications/transfer/v2/packet.ts b/__fixtures__/v-next/outputv3/ibc/applications/transfer/v2/packet.ts index 31803d2870..0572e1aa8d 100644 --- a/__fixtures__/v-next/outputv3/ibc/applications/transfer/v2/packet.ts +++ b/__fixtures__/v-next/outputv3/ibc/applications/transfer/v2/packet.ts @@ -90,6 +90,15 @@ function createBaseFungibleTokenPacketData(): FungibleTokenPacketData { export const FungibleTokenPacketData = { typeUrl: "/ibc.applications.transfer.v2.FungibleTokenPacketData", aminoType: "cosmos-sdk/FungibleTokenPacketData", + is(o: any): o is FungibleTokenPacketData { + return o && (o.$typeUrl === FungibleTokenPacketData.typeUrl || typeof o.denom === "string" && typeof o.amount === "string" && typeof o.sender === "string" && typeof o.receiver === "string"); + }, + isSDK(o: any): o is FungibleTokenPacketDataSDKType { + return o && (o.$typeUrl === FungibleTokenPacketData.typeUrl || typeof o.denom === "string" && typeof o.amount === "string" && typeof o.sender === "string" && typeof o.receiver === "string"); + }, + isAmino(o: any): o is FungibleTokenPacketDataAmino { + return o && (o.$typeUrl === FungibleTokenPacketData.typeUrl || typeof o.denom === "string" && typeof o.amount === "string" && typeof o.sender === "string" && typeof o.receiver === "string"); + }, encode(message: FungibleTokenPacketData, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.denom !== "") { writer.uint32(10).string(message.denom); @@ -198,5 +207,6 @@ export const FungibleTokenPacketData = { typeUrl: "/ibc.applications.transfer.v2.FungibleTokenPacketData", value: FungibleTokenPacketData.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/ibc/bundle.ts b/__fixtures__/v-next/outputv3/ibc/bundle.ts index 644dddf18b..9e6ce4fefd 100644 --- a/__fixtures__/v-next/outputv3/ibc/bundle.ts +++ b/__fixtures__/v-next/outputv3/ibc/bundle.ts @@ -22,30 +22,34 @@ import * as _250 from "./lightclients/localhost/v1/localhost"; import * as _251 from "./lightclients/solomachine/v1/solomachine"; import * as _252 from "./lightclients/solomachine/v2/solomachine"; import * as _253 from "./lightclients/tendermint/v1/tendermint"; -import * as _463 from "./applications/transfer/v1/tx.amino"; -import * as _464 from "./core/channel/v1/tx.amino"; -import * as _465 from "./core/client/v1/tx.amino"; -import * as _466 from "./core/connection/v1/tx.amino"; -import * as _467 from "./applications/transfer/v1/tx.registry"; -import * as _468 from "./core/channel/v1/tx.registry"; -import * as _469 from "./core/client/v1/tx.registry"; -import * as _470 from "./core/connection/v1/tx.registry"; -import * as _471 from "./applications/transfer/v1/query.lcd"; -import * as _472 from "./core/channel/v1/query.lcd"; -import * as _473 from "./core/client/v1/query.lcd"; -import * as _474 from "./core/connection/v1/query.lcd"; -import * as _475 from "./applications/transfer/v1/query.rpc.Query"; -import * as _476 from "./core/channel/v1/query.rpc.Query"; -import * as _477 from "./core/client/v1/query.rpc.Query"; -import * as _478 from "./core/connection/v1/query.rpc.Query"; -import * as _479 from "./core/port/v1/query.rpc.Query"; -import * as _480 from "./applications/transfer/v1/tx.rpc.msg"; -import * as _481 from "./core/channel/v1/tx.rpc.msg"; -import * as _482 from "./core/client/v1/tx.rpc.msg"; -import * as _483 from "./core/connection/v1/tx.rpc.msg"; -import * as _543 from "./lcd"; -import * as _544 from "./rpc.query"; -import * as _545 from "./rpc.tx"; +import * as _492 from "./applications/transfer/v1/tx.amino"; +import * as _493 from "./core/channel/v1/tx.amino"; +import * as _494 from "./core/client/v1/tx.amino"; +import * as _495 from "./core/connection/v1/tx.amino"; +import * as _496 from "./applications/transfer/v1/tx.registry"; +import * as _497 from "./core/channel/v1/tx.registry"; +import * as _498 from "./core/client/v1/tx.registry"; +import * as _499 from "./core/connection/v1/tx.registry"; +import * as _500 from "./applications/transfer/v1/query.rpc.func"; +import * as _501 from "./core/channel/v1/query.rpc.func"; +import * as _502 from "./core/client/v1/query.rpc.func"; +import * as _503 from "./core/connection/v1/query.rpc.func"; +import * as _504 from "./core/port/v1/query.rpc.func"; +import * as _505 from "./applications/transfer/v1/query.rpc.Query"; +import * as _506 from "./core/channel/v1/query.rpc.Query"; +import * as _507 from "./core/client/v1/query.rpc.Query"; +import * as _508 from "./core/connection/v1/query.rpc.Query"; +import * as _509 from "./core/port/v1/query.rpc.Query"; +import * as _510 from "./applications/transfer/v1/tx.rpc.func"; +import * as _511 from "./core/channel/v1/tx.rpc.func"; +import * as _512 from "./core/client/v1/tx.rpc.func"; +import * as _513 from "./core/connection/v1/tx.rpc.func"; +import * as _514 from "./applications/transfer/v1/tx.rpc.msg"; +import * as _515 from "./core/channel/v1/tx.rpc.msg"; +import * as _516 from "./core/client/v1/tx.rpc.msg"; +import * as _517 from "./core/connection/v1/tx.rpc.msg"; +import * as _581 from "./rpc.query"; +import * as _582 from "./rpc.tx"; export namespace ibc { export namespace applications { export namespace transfer { @@ -54,11 +58,12 @@ export namespace ibc { ..._231, ..._232, ..._233, - ..._463, - ..._467, - ..._471, - ..._475, - ..._480 + ..._492, + ..._496, + ..._500, + ..._505, + ..._510, + ..._514 }; export const v2 = { ..._234 @@ -72,11 +77,12 @@ export namespace ibc { ..._236, ..._237, ..._238, - ..._464, - ..._468, - ..._472, - ..._476, - ..._481 + ..._493, + ..._497, + ..._501, + ..._506, + ..._511, + ..._515 }; } export namespace client { @@ -85,11 +91,12 @@ export namespace ibc { ..._240, ..._241, ..._242, - ..._465, - ..._469, - ..._473, - ..._477, - ..._482 + ..._494, + ..._498, + ..._502, + ..._507, + ..._512, + ..._516 }; } export namespace commitment { @@ -103,17 +110,19 @@ export namespace ibc { ..._245, ..._246, ..._247, - ..._466, - ..._470, - ..._474, - ..._478, - ..._483 + ..._495, + ..._499, + ..._503, + ..._508, + ..._513, + ..._517 }; } export namespace port { export const v1 = { ..._248, - ..._479 + ..._504, + ..._509 }; } export namespace types { @@ -143,8 +152,7 @@ export namespace ibc { } } export const ClientFactory = { - ..._543, - ..._544, - ..._545 + ..._581, + ..._582 }; } \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/ibc/core/channel/v1/channel.ts b/__fixtures__/v-next/outputv3/ibc/core/channel/v1/channel.ts index 983d1092c0..2275b45c35 100644 --- a/__fixtures__/v-next/outputv3/ibc/core/channel/v1/channel.ts +++ b/__fixtures__/v-next/outputv3/ibc/core/channel/v1/channel.ts @@ -1,6 +1,7 @@ import { Height, HeightAmino, HeightSDKType } from "../../client/v1/client"; -import { BinaryReader, BinaryWriter } from "../../../../binary"; import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../../helpers"; +import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { GlobalDecoderRegistry } from "../../../../registry"; export const protobufPackage = "ibc.core.channel.v1"; /** * State defines if a channel is in one of the following states: @@ -584,6 +585,15 @@ function createBaseChannel(): Channel { export const Channel = { typeUrl: "/ibc.core.channel.v1.Channel", aminoType: "cosmos-sdk/Channel", + is(o: any): o is Channel { + return o && (o.$typeUrl === Channel.typeUrl || isSet(o.state) && isSet(o.ordering) && Counterparty.is(o.counterparty) && Array.isArray(o.connectionHops) && (!o.connectionHops.length || typeof o.connectionHops[0] === "string") && typeof o.version === "string"); + }, + isSDK(o: any): o is ChannelSDKType { + return o && (o.$typeUrl === Channel.typeUrl || isSet(o.state) && isSet(o.ordering) && Counterparty.isSDK(o.counterparty) && Array.isArray(o.connection_hops) && (!o.connection_hops.length || typeof o.connection_hops[0] === "string") && typeof o.version === "string"); + }, + isAmino(o: any): o is ChannelAmino { + return o && (o.$typeUrl === Channel.typeUrl || isSet(o.state) && isSet(o.ordering) && Counterparty.isAmino(o.counterparty) && Array.isArray(o.connection_hops) && (!o.connection_hops.length || typeof o.connection_hops[0] === "string") && typeof o.version === "string"); + }, encode(message: Channel, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.state !== 0) { writer.uint32(8).int32(message.state); @@ -714,6 +724,12 @@ export const Channel = { typeUrl: "/ibc.core.channel.v1.Channel", value: Channel.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Channel.typeUrl)) { + return; + } + Counterparty.registerTypeUrl(); } }; function createBaseIdentifiedChannel(): IdentifiedChannel { @@ -737,6 +753,15 @@ function createBaseIdentifiedChannel(): IdentifiedChannel { export const IdentifiedChannel = { typeUrl: "/ibc.core.channel.v1.IdentifiedChannel", aminoType: "cosmos-sdk/IdentifiedChannel", + is(o: any): o is IdentifiedChannel { + return o && (o.$typeUrl === IdentifiedChannel.typeUrl || isSet(o.state) && isSet(o.ordering) && Counterparty.is(o.counterparty) && Array.isArray(o.connectionHops) && (!o.connectionHops.length || typeof o.connectionHops[0] === "string") && typeof o.version === "string" && typeof o.portId === "string" && typeof o.channelId === "string"); + }, + isSDK(o: any): o is IdentifiedChannelSDKType { + return o && (o.$typeUrl === IdentifiedChannel.typeUrl || isSet(o.state) && isSet(o.ordering) && Counterparty.isSDK(o.counterparty) && Array.isArray(o.connection_hops) && (!o.connection_hops.length || typeof o.connection_hops[0] === "string") && typeof o.version === "string" && typeof o.port_id === "string" && typeof o.channel_id === "string"); + }, + isAmino(o: any): o is IdentifiedChannelAmino { + return o && (o.$typeUrl === IdentifiedChannel.typeUrl || isSet(o.state) && isSet(o.ordering) && Counterparty.isAmino(o.counterparty) && Array.isArray(o.connection_hops) && (!o.connection_hops.length || typeof o.connection_hops[0] === "string") && typeof o.version === "string" && typeof o.port_id === "string" && typeof o.channel_id === "string"); + }, encode(message: IdentifiedChannel, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.state !== 0) { writer.uint32(8).int32(message.state); @@ -895,6 +920,12 @@ export const IdentifiedChannel = { typeUrl: "/ibc.core.channel.v1.IdentifiedChannel", value: IdentifiedChannel.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(IdentifiedChannel.typeUrl)) { + return; + } + Counterparty.registerTypeUrl(); } }; function createBaseCounterparty(): Counterparty { @@ -912,6 +943,15 @@ function createBaseCounterparty(): Counterparty { export const Counterparty = { typeUrl: "/ibc.core.channel.v1.Counterparty", aminoType: "cosmos-sdk/Counterparty", + is(o: any): o is Counterparty { + return o && (o.$typeUrl === Counterparty.typeUrl || typeof o.portId === "string" && typeof o.channelId === "string"); + }, + isSDK(o: any): o is CounterpartySDKType { + return o && (o.$typeUrl === Counterparty.typeUrl || typeof o.port_id === "string" && typeof o.channel_id === "string"); + }, + isAmino(o: any): o is CounterpartyAmino { + return o && (o.$typeUrl === Counterparty.typeUrl || typeof o.port_id === "string" && typeof o.channel_id === "string"); + }, encode(message: Counterparty, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.portId !== "") { writer.uint32(10).string(message.portId); @@ -992,7 +1032,8 @@ export const Counterparty = { typeUrl: "/ibc.core.channel.v1.Counterparty", value: Counterparty.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBasePacket(): Packet { return { @@ -1015,6 +1056,15 @@ function createBasePacket(): Packet { export const Packet = { typeUrl: "/ibc.core.channel.v1.Packet", aminoType: "cosmos-sdk/Packet", + is(o: any): o is Packet { + return o && (o.$typeUrl === Packet.typeUrl || typeof o.sequence === "bigint" && typeof o.sourcePort === "string" && typeof o.sourceChannel === "string" && typeof o.destinationPort === "string" && typeof o.destinationChannel === "string" && (o.data instanceof Uint8Array || typeof o.data === "string") && Height.is(o.timeoutHeight) && typeof o.timeoutTimestamp === "bigint"); + }, + isSDK(o: any): o is PacketSDKType { + return o && (o.$typeUrl === Packet.typeUrl || typeof o.sequence === "bigint" && typeof o.source_port === "string" && typeof o.source_channel === "string" && typeof o.destination_port === "string" && typeof o.destination_channel === "string" && (o.data instanceof Uint8Array || typeof o.data === "string") && Height.isSDK(o.timeout_height) && typeof o.timeout_timestamp === "bigint"); + }, + isAmino(o: any): o is PacketAmino { + return o && (o.$typeUrl === Packet.typeUrl || typeof o.sequence === "bigint" && typeof o.source_port === "string" && typeof o.source_channel === "string" && typeof o.destination_port === "string" && typeof o.destination_channel === "string" && (o.data instanceof Uint8Array || typeof o.data === "string") && Height.isAmino(o.timeout_height) && typeof o.timeout_timestamp === "bigint"); + }, encode(message: Packet, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.sequence !== BigInt(0)) { writer.uint32(8).uint64(message.sequence); @@ -1185,6 +1235,12 @@ export const Packet = { typeUrl: "/ibc.core.channel.v1.Packet", value: Packet.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Packet.typeUrl)) { + return; + } + Height.registerTypeUrl(); } }; function createBasePacketState(): PacketState { @@ -1207,6 +1263,15 @@ function createBasePacketState(): PacketState { export const PacketState = { typeUrl: "/ibc.core.channel.v1.PacketState", aminoType: "cosmos-sdk/PacketState", + is(o: any): o is PacketState { + return o && (o.$typeUrl === PacketState.typeUrl || typeof o.portId === "string" && typeof o.channelId === "string" && typeof o.sequence === "bigint" && (o.data instanceof Uint8Array || typeof o.data === "string")); + }, + isSDK(o: any): o is PacketStateSDKType { + return o && (o.$typeUrl === PacketState.typeUrl || typeof o.port_id === "string" && typeof o.channel_id === "string" && typeof o.sequence === "bigint" && (o.data instanceof Uint8Array || typeof o.data === "string")); + }, + isAmino(o: any): o is PacketStateAmino { + return o && (o.$typeUrl === PacketState.typeUrl || typeof o.port_id === "string" && typeof o.channel_id === "string" && typeof o.sequence === "bigint" && (o.data instanceof Uint8Array || typeof o.data === "string")); + }, encode(message: PacketState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.portId !== "") { writer.uint32(10).string(message.portId); @@ -1317,7 +1382,8 @@ export const PacketState = { typeUrl: "/ibc.core.channel.v1.PacketState", value: PacketState.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseAcknowledgement(): Acknowledgement { return { @@ -1340,6 +1406,15 @@ function createBaseAcknowledgement(): Acknowledgement { export const Acknowledgement = { typeUrl: "/ibc.core.channel.v1.Acknowledgement", aminoType: "cosmos-sdk/Acknowledgement", + is(o: any): o is Acknowledgement { + return o && o.$typeUrl === Acknowledgement.typeUrl; + }, + isSDK(o: any): o is AcknowledgementSDKType { + return o && o.$typeUrl === Acknowledgement.typeUrl; + }, + isAmino(o: any): o is AcknowledgementAmino { + return o && o.$typeUrl === Acknowledgement.typeUrl; + }, encode(message: Acknowledgement, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.result !== undefined) { writer.uint32(170).bytes(message.result); @@ -1420,5 +1495,6 @@ export const Acknowledgement = { typeUrl: "/ibc.core.channel.v1.Acknowledgement", value: Acknowledgement.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/ibc/core/channel/v1/genesis.ts b/__fixtures__/v-next/outputv3/ibc/core/channel/v1/genesis.ts index a23dfa5650..53788ec873 100644 --- a/__fixtures__/v-next/outputv3/ibc/core/channel/v1/genesis.ts +++ b/__fixtures__/v-next/outputv3/ibc/core/channel/v1/genesis.ts @@ -1,6 +1,7 @@ import { IdentifiedChannel, IdentifiedChannelAmino, IdentifiedChannelSDKType, PacketState, PacketStateAmino, PacketStateSDKType } from "./channel"; import { BinaryReader, BinaryWriter } from "../../../../binary"; import { isSet, DeepPartial } from "../../../../helpers"; +import { GlobalDecoderRegistry } from "../../../../registry"; export const protobufPackage = "ibc.core.channel.v1"; /** * GenesisState defines the ibc channel submodule's genesis state. @@ -121,6 +122,15 @@ function createBaseGenesisState(): GenesisState { export const GenesisState = { typeUrl: "/ibc.core.channel.v1.GenesisState", aminoType: "cosmos-sdk/GenesisState", + is(o: any): o is GenesisState { + return o && (o.$typeUrl === GenesisState.typeUrl || Array.isArray(o.channels) && (!o.channels.length || IdentifiedChannel.is(o.channels[0])) && Array.isArray(o.acknowledgements) && (!o.acknowledgements.length || PacketState.is(o.acknowledgements[0])) && Array.isArray(o.commitments) && (!o.commitments.length || PacketState.is(o.commitments[0])) && Array.isArray(o.receipts) && (!o.receipts.length || PacketState.is(o.receipts[0])) && Array.isArray(o.sendSequences) && (!o.sendSequences.length || PacketSequence.is(o.sendSequences[0])) && Array.isArray(o.recvSequences) && (!o.recvSequences.length || PacketSequence.is(o.recvSequences[0])) && Array.isArray(o.ackSequences) && (!o.ackSequences.length || PacketSequence.is(o.ackSequences[0])) && typeof o.nextChannelSequence === "bigint"); + }, + isSDK(o: any): o is GenesisStateSDKType { + return o && (o.$typeUrl === GenesisState.typeUrl || Array.isArray(o.channels) && (!o.channels.length || IdentifiedChannel.isSDK(o.channels[0])) && Array.isArray(o.acknowledgements) && (!o.acknowledgements.length || PacketState.isSDK(o.acknowledgements[0])) && Array.isArray(o.commitments) && (!o.commitments.length || PacketState.isSDK(o.commitments[0])) && Array.isArray(o.receipts) && (!o.receipts.length || PacketState.isSDK(o.receipts[0])) && Array.isArray(o.send_sequences) && (!o.send_sequences.length || PacketSequence.isSDK(o.send_sequences[0])) && Array.isArray(o.recv_sequences) && (!o.recv_sequences.length || PacketSequence.isSDK(o.recv_sequences[0])) && Array.isArray(o.ack_sequences) && (!o.ack_sequences.length || PacketSequence.isSDK(o.ack_sequences[0])) && typeof o.next_channel_sequence === "bigint"); + }, + isAmino(o: any): o is GenesisStateAmino { + return o && (o.$typeUrl === GenesisState.typeUrl || Array.isArray(o.channels) && (!o.channels.length || IdentifiedChannel.isAmino(o.channels[0])) && Array.isArray(o.acknowledgements) && (!o.acknowledgements.length || PacketState.isAmino(o.acknowledgements[0])) && Array.isArray(o.commitments) && (!o.commitments.length || PacketState.isAmino(o.commitments[0])) && Array.isArray(o.receipts) && (!o.receipts.length || PacketState.isAmino(o.receipts[0])) && Array.isArray(o.send_sequences) && (!o.send_sequences.length || PacketSequence.isAmino(o.send_sequences[0])) && Array.isArray(o.recv_sequences) && (!o.recv_sequences.length || PacketSequence.isAmino(o.recv_sequences[0])) && Array.isArray(o.ack_sequences) && (!o.ack_sequences.length || PacketSequence.isAmino(o.ack_sequences[0])) && typeof o.next_channel_sequence === "bigint"); + }, encode(message: GenesisState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.channels) { IdentifiedChannel.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -329,6 +339,14 @@ export const GenesisState = { typeUrl: "/ibc.core.channel.v1.GenesisState", value: GenesisState.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GenesisState.typeUrl)) { + return; + } + IdentifiedChannel.registerTypeUrl(); + PacketState.registerTypeUrl(); + PacketSequence.registerTypeUrl(); } }; function createBasePacketSequence(): PacketSequence { @@ -348,6 +366,15 @@ function createBasePacketSequence(): PacketSequence { export const PacketSequence = { typeUrl: "/ibc.core.channel.v1.PacketSequence", aminoType: "cosmos-sdk/PacketSequence", + is(o: any): o is PacketSequence { + return o && (o.$typeUrl === PacketSequence.typeUrl || typeof o.portId === "string" && typeof o.channelId === "string" && typeof o.sequence === "bigint"); + }, + isSDK(o: any): o is PacketSequenceSDKType { + return o && (o.$typeUrl === PacketSequence.typeUrl || typeof o.port_id === "string" && typeof o.channel_id === "string" && typeof o.sequence === "bigint"); + }, + isAmino(o: any): o is PacketSequenceAmino { + return o && (o.$typeUrl === PacketSequence.typeUrl || typeof o.port_id === "string" && typeof o.channel_id === "string" && typeof o.sequence === "bigint"); + }, encode(message: PacketSequence, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.portId !== "") { writer.uint32(10).string(message.portId); @@ -444,5 +471,6 @@ export const PacketSequence = { typeUrl: "/ibc.core.channel.v1.PacketSequence", value: PacketSequence.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/ibc/core/channel/v1/query.rpc.func.ts b/__fixtures__/v-next/outputv3/ibc/core/channel/v1/query.rpc.func.ts new file mode 100644 index 0000000000..5172d53e33 --- /dev/null +++ b/__fixtures__/v-next/outputv3/ibc/core/channel/v1/query.rpc.func.ts @@ -0,0 +1,183 @@ +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../../cosmos/base/query/v1beta1/pagination"; +import { Channel, ChannelSDKType, IdentifiedChannel, IdentifiedChannelSDKType, PacketState, PacketStateSDKType } from "./channel"; +import { Height, HeightSDKType, IdentifiedClientState, IdentifiedClientStateSDKType } from "../../client/v1/client"; +import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../../google/protobuf/any"; +import { EndpointOrRpc, buildQuery } from "../../../../helper-func-types"; +import { QueryChannelRequest, QueryChannelRequestSDKType, QueryChannelResponse, QueryChannelResponseSDKType, QueryChannelsRequest, QueryChannelsRequestSDKType, QueryChannelsResponse, QueryChannelsResponseSDKType, QueryConnectionChannelsRequest, QueryConnectionChannelsRequestSDKType, QueryConnectionChannelsResponse, QueryConnectionChannelsResponseSDKType, QueryChannelClientStateRequest, QueryChannelClientStateRequestSDKType, QueryChannelClientStateResponse, QueryChannelClientStateResponseSDKType, QueryChannelConsensusStateRequest, QueryChannelConsensusStateRequestSDKType, QueryChannelConsensusStateResponse, QueryChannelConsensusStateResponseSDKType, QueryPacketCommitmentRequest, QueryPacketCommitmentRequestSDKType, QueryPacketCommitmentResponse, QueryPacketCommitmentResponseSDKType, QueryPacketCommitmentsRequest, QueryPacketCommitmentsRequestSDKType, QueryPacketCommitmentsResponse, QueryPacketCommitmentsResponseSDKType, QueryPacketReceiptRequest, QueryPacketReceiptRequestSDKType, QueryPacketReceiptResponse, QueryPacketReceiptResponseSDKType, QueryPacketAcknowledgementRequest, QueryPacketAcknowledgementRequestSDKType, QueryPacketAcknowledgementResponse, QueryPacketAcknowledgementResponseSDKType, QueryPacketAcknowledgementsRequest, QueryPacketAcknowledgementsRequestSDKType, QueryPacketAcknowledgementsResponse, QueryPacketAcknowledgementsResponseSDKType, QueryUnreceivedPacketsRequest, QueryUnreceivedPacketsRequestSDKType, QueryUnreceivedPacketsResponse, QueryUnreceivedPacketsResponseSDKType, QueryUnreceivedAcksRequest, QueryUnreceivedAcksRequestSDKType, QueryUnreceivedAcksResponse, QueryUnreceivedAcksResponseSDKType, QueryNextSequenceReceiveRequest, QueryNextSequenceReceiveRequestSDKType, QueryNextSequenceReceiveResponse, QueryNextSequenceReceiveResponseSDKType } from "./query"; +/** + * Channel queries an IBC Channel. + * @name getChannel + * @package ibc.core.channel.v1 + * @see proto service: ibc.core.channel.v1.Channel + */ +export const getChannel = buildQuery({ + encode: QueryChannelRequest.encode, + decode: QueryChannelResponse.decode, + service: "ibc.core.channel.v1.Query", + method: "Channel", + deps: [QueryChannelRequest, QueryChannelResponse] +}); +/** + * Channels queries all the IBC channels of a chain. + * @name getChannels + * @package ibc.core.channel.v1 + * @see proto service: ibc.core.channel.v1.Channels + */ +export const getChannels = buildQuery({ + encode: QueryChannelsRequest.encode, + decode: QueryChannelsResponse.decode, + service: "ibc.core.channel.v1.Query", + method: "Channels", + deps: [QueryChannelsRequest, QueryChannelsResponse] +}); +/** + * ConnectionChannels queries all the channels associated with a connection + * end. + * @name getConnectionChannels + * @package ibc.core.channel.v1 + * @see proto service: ibc.core.channel.v1.ConnectionChannels + */ +export const getConnectionChannels = buildQuery({ + encode: QueryConnectionChannelsRequest.encode, + decode: QueryConnectionChannelsResponse.decode, + service: "ibc.core.channel.v1.Query", + method: "ConnectionChannels", + deps: [QueryConnectionChannelsRequest, QueryConnectionChannelsResponse] +}); +/** + * ChannelClientState queries for the client state for the channel associated + * with the provided channel identifiers. + * @name getChannelClientState + * @package ibc.core.channel.v1 + * @see proto service: ibc.core.channel.v1.ChannelClientState + */ +export const getChannelClientState = buildQuery({ + encode: QueryChannelClientStateRequest.encode, + decode: QueryChannelClientStateResponse.decode, + service: "ibc.core.channel.v1.Query", + method: "ChannelClientState", + deps: [QueryChannelClientStateRequest, QueryChannelClientStateResponse] +}); +/** + * ChannelConsensusState queries for the consensus state for the channel + * associated with the provided channel identifiers. + * @name getChannelConsensusState + * @package ibc.core.channel.v1 + * @see proto service: ibc.core.channel.v1.ChannelConsensusState + */ +export const getChannelConsensusState = buildQuery({ + encode: QueryChannelConsensusStateRequest.encode, + decode: QueryChannelConsensusStateResponse.decode, + service: "ibc.core.channel.v1.Query", + method: "ChannelConsensusState", + deps: [QueryChannelConsensusStateRequest, QueryChannelConsensusStateResponse] +}); +/** + * PacketCommitment queries a stored packet commitment hash. + * @name getPacketCommitment + * @package ibc.core.channel.v1 + * @see proto service: ibc.core.channel.v1.PacketCommitment + */ +export const getPacketCommitment = buildQuery({ + encode: QueryPacketCommitmentRequest.encode, + decode: QueryPacketCommitmentResponse.decode, + service: "ibc.core.channel.v1.Query", + method: "PacketCommitment", + deps: [QueryPacketCommitmentRequest, QueryPacketCommitmentResponse] +}); +/** + * PacketCommitments returns all the packet commitments hashes associated + * with a channel. + * @name getPacketCommitments + * @package ibc.core.channel.v1 + * @see proto service: ibc.core.channel.v1.PacketCommitments + */ +export const getPacketCommitments = buildQuery({ + encode: QueryPacketCommitmentsRequest.encode, + decode: QueryPacketCommitmentsResponse.decode, + service: "ibc.core.channel.v1.Query", + method: "PacketCommitments", + deps: [QueryPacketCommitmentsRequest, QueryPacketCommitmentsResponse] +}); +/** + * PacketReceipt queries if a given packet sequence has been received on the + * queried chain + * @name getPacketReceipt + * @package ibc.core.channel.v1 + * @see proto service: ibc.core.channel.v1.PacketReceipt + */ +export const getPacketReceipt = buildQuery({ + encode: QueryPacketReceiptRequest.encode, + decode: QueryPacketReceiptResponse.decode, + service: "ibc.core.channel.v1.Query", + method: "PacketReceipt", + deps: [QueryPacketReceiptRequest, QueryPacketReceiptResponse] +}); +/** + * PacketAcknowledgement queries a stored packet acknowledgement hash. + * @name getPacketAcknowledgement + * @package ibc.core.channel.v1 + * @see proto service: ibc.core.channel.v1.PacketAcknowledgement + */ +export const getPacketAcknowledgement = buildQuery({ + encode: QueryPacketAcknowledgementRequest.encode, + decode: QueryPacketAcknowledgementResponse.decode, + service: "ibc.core.channel.v1.Query", + method: "PacketAcknowledgement", + deps: [QueryPacketAcknowledgementRequest, QueryPacketAcknowledgementResponse] +}); +/** + * PacketAcknowledgements returns all the packet acknowledgements associated + * with a channel. + * @name getPacketAcknowledgements + * @package ibc.core.channel.v1 + * @see proto service: ibc.core.channel.v1.PacketAcknowledgements + */ +export const getPacketAcknowledgements = buildQuery({ + encode: QueryPacketAcknowledgementsRequest.encode, + decode: QueryPacketAcknowledgementsResponse.decode, + service: "ibc.core.channel.v1.Query", + method: "PacketAcknowledgements", + deps: [QueryPacketAcknowledgementsRequest, QueryPacketAcknowledgementsResponse] +}); +/** + * UnreceivedPackets returns all the unreceived IBC packets associated with a + * channel and sequences. + * @name getUnreceivedPackets + * @package ibc.core.channel.v1 + * @see proto service: ibc.core.channel.v1.UnreceivedPackets + */ +export const getUnreceivedPackets = buildQuery({ + encode: QueryUnreceivedPacketsRequest.encode, + decode: QueryUnreceivedPacketsResponse.decode, + service: "ibc.core.channel.v1.Query", + method: "UnreceivedPackets", + deps: [QueryUnreceivedPacketsRequest, QueryUnreceivedPacketsResponse] +}); +/** + * UnreceivedAcks returns all the unreceived IBC acknowledgements associated + * with a channel and sequences. + * @name getUnreceivedAcks + * @package ibc.core.channel.v1 + * @see proto service: ibc.core.channel.v1.UnreceivedAcks + */ +export const getUnreceivedAcks = buildQuery({ + encode: QueryUnreceivedAcksRequest.encode, + decode: QueryUnreceivedAcksResponse.decode, + service: "ibc.core.channel.v1.Query", + method: "UnreceivedAcks", + deps: [QueryUnreceivedAcksRequest, QueryUnreceivedAcksResponse] +}); +/** + * NextSequenceReceive returns the next receive sequence for a given channel. + * @name getNextSequenceReceive + * @package ibc.core.channel.v1 + * @see proto service: ibc.core.channel.v1.NextSequenceReceive + */ +export const getNextSequenceReceive = buildQuery({ + encode: QueryNextSequenceReceiveRequest.encode, + decode: QueryNextSequenceReceiveResponse.decode, + service: "ibc.core.channel.v1.Query", + method: "NextSequenceReceive", + deps: [QueryNextSequenceReceiveRequest, QueryNextSequenceReceiveResponse] +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/ibc/core/channel/v1/query.ts b/__fixtures__/v-next/outputv3/ibc/core/channel/v1/query.ts index dcf16f8495..81f1103ed6 100644 --- a/__fixtures__/v-next/outputv3/ibc/core/channel/v1/query.ts +++ b/__fixtures__/v-next/outputv3/ibc/core/channel/v1/query.ts @@ -4,6 +4,7 @@ import { Height, HeightAmino, HeightSDKType, IdentifiedClientState, IdentifiedCl import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../../google/protobuf/any"; import { BinaryReader, BinaryWriter } from "../../../../binary"; import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../../helpers"; +import { GlobalDecoderRegistry } from "../../../../registry"; export const protobufPackage = "ibc.core.channel.v1"; /** * QueryChannelRequest is the request type for the Query/Channel RPC method @@ -1474,6 +1475,15 @@ function createBaseQueryChannelRequest(): QueryChannelRequest { export const QueryChannelRequest = { typeUrl: "/ibc.core.channel.v1.QueryChannelRequest", aminoType: "cosmos-sdk/QueryChannelRequest", + is(o: any): o is QueryChannelRequest { + return o && (o.$typeUrl === QueryChannelRequest.typeUrl || typeof o.portId === "string" && typeof o.channelId === "string"); + }, + isSDK(o: any): o is QueryChannelRequestSDKType { + return o && (o.$typeUrl === QueryChannelRequest.typeUrl || typeof o.port_id === "string" && typeof o.channel_id === "string"); + }, + isAmino(o: any): o is QueryChannelRequestAmino { + return o && (o.$typeUrl === QueryChannelRequest.typeUrl || typeof o.port_id === "string" && typeof o.channel_id === "string"); + }, encode(message: QueryChannelRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.portId !== "") { writer.uint32(10).string(message.portId); @@ -1554,7 +1564,8 @@ export const QueryChannelRequest = { typeUrl: "/ibc.core.channel.v1.QueryChannelRequest", value: QueryChannelRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryChannelResponse(): QueryChannelResponse { return { @@ -1574,6 +1585,15 @@ function createBaseQueryChannelResponse(): QueryChannelResponse { export const QueryChannelResponse = { typeUrl: "/ibc.core.channel.v1.QueryChannelResponse", aminoType: "cosmos-sdk/QueryChannelResponse", + is(o: any): o is QueryChannelResponse { + return o && (o.$typeUrl === QueryChannelResponse.typeUrl || (o.proof instanceof Uint8Array || typeof o.proof === "string") && Height.is(o.proofHeight)); + }, + isSDK(o: any): o is QueryChannelResponseSDKType { + return o && (o.$typeUrl === QueryChannelResponse.typeUrl || (o.proof instanceof Uint8Array || typeof o.proof === "string") && Height.isSDK(o.proof_height)); + }, + isAmino(o: any): o is QueryChannelResponseAmino { + return o && (o.$typeUrl === QueryChannelResponse.typeUrl || (o.proof instanceof Uint8Array || typeof o.proof === "string") && Height.isAmino(o.proof_height)); + }, encode(message: QueryChannelResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.channel !== undefined) { Channel.encode(message.channel, writer.uint32(10).fork()).ldelim(); @@ -1672,6 +1692,13 @@ export const QueryChannelResponse = { typeUrl: "/ibc.core.channel.v1.QueryChannelResponse", value: QueryChannelResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryChannelResponse.typeUrl)) { + return; + } + Channel.registerTypeUrl(); + Height.registerTypeUrl(); } }; function createBaseQueryChannelsRequest(): QueryChannelsRequest { @@ -1688,6 +1715,15 @@ function createBaseQueryChannelsRequest(): QueryChannelsRequest { export const QueryChannelsRequest = { typeUrl: "/ibc.core.channel.v1.QueryChannelsRequest", aminoType: "cosmos-sdk/QueryChannelsRequest", + is(o: any): o is QueryChannelsRequest { + return o && o.$typeUrl === QueryChannelsRequest.typeUrl; + }, + isSDK(o: any): o is QueryChannelsRequestSDKType { + return o && o.$typeUrl === QueryChannelsRequest.typeUrl; + }, + isAmino(o: any): o is QueryChannelsRequestAmino { + return o && o.$typeUrl === QueryChannelsRequest.typeUrl; + }, encode(message: QueryChannelsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.pagination !== undefined) { PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); @@ -1756,6 +1792,12 @@ export const QueryChannelsRequest = { typeUrl: "/ibc.core.channel.v1.QueryChannelsRequest", value: QueryChannelsRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryChannelsRequest.typeUrl)) { + return; + } + PageRequest.registerTypeUrl(); } }; function createBaseQueryChannelsResponse(): QueryChannelsResponse { @@ -1774,6 +1816,15 @@ function createBaseQueryChannelsResponse(): QueryChannelsResponse { export const QueryChannelsResponse = { typeUrl: "/ibc.core.channel.v1.QueryChannelsResponse", aminoType: "cosmos-sdk/QueryChannelsResponse", + is(o: any): o is QueryChannelsResponse { + return o && (o.$typeUrl === QueryChannelsResponse.typeUrl || Array.isArray(o.channels) && (!o.channels.length || IdentifiedChannel.is(o.channels[0])) && Height.is(o.height)); + }, + isSDK(o: any): o is QueryChannelsResponseSDKType { + return o && (o.$typeUrl === QueryChannelsResponse.typeUrl || Array.isArray(o.channels) && (!o.channels.length || IdentifiedChannel.isSDK(o.channels[0])) && Height.isSDK(o.height)); + }, + isAmino(o: any): o is QueryChannelsResponseAmino { + return o && (o.$typeUrl === QueryChannelsResponse.typeUrl || Array.isArray(o.channels) && (!o.channels.length || IdentifiedChannel.isAmino(o.channels[0])) && Height.isAmino(o.height)); + }, encode(message: QueryChannelsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.channels) { IdentifiedChannel.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -1878,6 +1929,14 @@ export const QueryChannelsResponse = { typeUrl: "/ibc.core.channel.v1.QueryChannelsResponse", value: QueryChannelsResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryChannelsResponse.typeUrl)) { + return; + } + IdentifiedChannel.registerTypeUrl(); + PageResponse.registerTypeUrl(); + Height.registerTypeUrl(); } }; function createBaseQueryConnectionChannelsRequest(): QueryConnectionChannelsRequest { @@ -1896,6 +1955,15 @@ function createBaseQueryConnectionChannelsRequest(): QueryConnectionChannelsRequ export const QueryConnectionChannelsRequest = { typeUrl: "/ibc.core.channel.v1.QueryConnectionChannelsRequest", aminoType: "cosmos-sdk/QueryConnectionChannelsRequest", + is(o: any): o is QueryConnectionChannelsRequest { + return o && (o.$typeUrl === QueryConnectionChannelsRequest.typeUrl || typeof o.connection === "string"); + }, + isSDK(o: any): o is QueryConnectionChannelsRequestSDKType { + return o && (o.$typeUrl === QueryConnectionChannelsRequest.typeUrl || typeof o.connection === "string"); + }, + isAmino(o: any): o is QueryConnectionChannelsRequestAmino { + return o && (o.$typeUrl === QueryConnectionChannelsRequest.typeUrl || typeof o.connection === "string"); + }, encode(message: QueryConnectionChannelsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.connection !== "") { writer.uint32(10).string(message.connection); @@ -1978,6 +2046,12 @@ export const QueryConnectionChannelsRequest = { typeUrl: "/ibc.core.channel.v1.QueryConnectionChannelsRequest", value: QueryConnectionChannelsRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryConnectionChannelsRequest.typeUrl)) { + return; + } + PageRequest.registerTypeUrl(); } }; function createBaseQueryConnectionChannelsResponse(): QueryConnectionChannelsResponse { @@ -1997,6 +2071,15 @@ function createBaseQueryConnectionChannelsResponse(): QueryConnectionChannelsRes export const QueryConnectionChannelsResponse = { typeUrl: "/ibc.core.channel.v1.QueryConnectionChannelsResponse", aminoType: "cosmos-sdk/QueryConnectionChannelsResponse", + is(o: any): o is QueryConnectionChannelsResponse { + return o && (o.$typeUrl === QueryConnectionChannelsResponse.typeUrl || Array.isArray(o.channels) && (!o.channels.length || IdentifiedChannel.is(o.channels[0])) && Height.is(o.height)); + }, + isSDK(o: any): o is QueryConnectionChannelsResponseSDKType { + return o && (o.$typeUrl === QueryConnectionChannelsResponse.typeUrl || Array.isArray(o.channels) && (!o.channels.length || IdentifiedChannel.isSDK(o.channels[0])) && Height.isSDK(o.height)); + }, + isAmino(o: any): o is QueryConnectionChannelsResponseAmino { + return o && (o.$typeUrl === QueryConnectionChannelsResponse.typeUrl || Array.isArray(o.channels) && (!o.channels.length || IdentifiedChannel.isAmino(o.channels[0])) && Height.isAmino(o.height)); + }, encode(message: QueryConnectionChannelsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.channels) { IdentifiedChannel.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -2101,6 +2184,14 @@ export const QueryConnectionChannelsResponse = { typeUrl: "/ibc.core.channel.v1.QueryConnectionChannelsResponse", value: QueryConnectionChannelsResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryConnectionChannelsResponse.typeUrl)) { + return; + } + IdentifiedChannel.registerTypeUrl(); + PageResponse.registerTypeUrl(); + Height.registerTypeUrl(); } }; function createBaseQueryChannelClientStateRequest(): QueryChannelClientStateRequest { @@ -2119,6 +2210,15 @@ function createBaseQueryChannelClientStateRequest(): QueryChannelClientStateRequ export const QueryChannelClientStateRequest = { typeUrl: "/ibc.core.channel.v1.QueryChannelClientStateRequest", aminoType: "cosmos-sdk/QueryChannelClientStateRequest", + is(o: any): o is QueryChannelClientStateRequest { + return o && (o.$typeUrl === QueryChannelClientStateRequest.typeUrl || typeof o.portId === "string" && typeof o.channelId === "string"); + }, + isSDK(o: any): o is QueryChannelClientStateRequestSDKType { + return o && (o.$typeUrl === QueryChannelClientStateRequest.typeUrl || typeof o.port_id === "string" && typeof o.channel_id === "string"); + }, + isAmino(o: any): o is QueryChannelClientStateRequestAmino { + return o && (o.$typeUrl === QueryChannelClientStateRequest.typeUrl || typeof o.port_id === "string" && typeof o.channel_id === "string"); + }, encode(message: QueryChannelClientStateRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.portId !== "") { writer.uint32(10).string(message.portId); @@ -2199,7 +2299,8 @@ export const QueryChannelClientStateRequest = { typeUrl: "/ibc.core.channel.v1.QueryChannelClientStateRequest", value: QueryChannelClientStateRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryChannelClientStateResponse(): QueryChannelClientStateResponse { return { @@ -2218,6 +2319,15 @@ function createBaseQueryChannelClientStateResponse(): QueryChannelClientStateRes export const QueryChannelClientStateResponse = { typeUrl: "/ibc.core.channel.v1.QueryChannelClientStateResponse", aminoType: "cosmos-sdk/QueryChannelClientStateResponse", + is(o: any): o is QueryChannelClientStateResponse { + return o && (o.$typeUrl === QueryChannelClientStateResponse.typeUrl || (o.proof instanceof Uint8Array || typeof o.proof === "string") && Height.is(o.proofHeight)); + }, + isSDK(o: any): o is QueryChannelClientStateResponseSDKType { + return o && (o.$typeUrl === QueryChannelClientStateResponse.typeUrl || (o.proof instanceof Uint8Array || typeof o.proof === "string") && Height.isSDK(o.proof_height)); + }, + isAmino(o: any): o is QueryChannelClientStateResponseAmino { + return o && (o.$typeUrl === QueryChannelClientStateResponse.typeUrl || (o.proof instanceof Uint8Array || typeof o.proof === "string") && Height.isAmino(o.proof_height)); + }, encode(message: QueryChannelClientStateResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.identifiedClientState !== undefined) { IdentifiedClientState.encode(message.identifiedClientState, writer.uint32(10).fork()).ldelim(); @@ -2316,6 +2426,13 @@ export const QueryChannelClientStateResponse = { typeUrl: "/ibc.core.channel.v1.QueryChannelClientStateResponse", value: QueryChannelClientStateResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryChannelClientStateResponse.typeUrl)) { + return; + } + IdentifiedClientState.registerTypeUrl(); + Height.registerTypeUrl(); } }; function createBaseQueryChannelConsensusStateRequest(): QueryChannelConsensusStateRequest { @@ -2336,6 +2453,15 @@ function createBaseQueryChannelConsensusStateRequest(): QueryChannelConsensusSta export const QueryChannelConsensusStateRequest = { typeUrl: "/ibc.core.channel.v1.QueryChannelConsensusStateRequest", aminoType: "cosmos-sdk/QueryChannelConsensusStateRequest", + is(o: any): o is QueryChannelConsensusStateRequest { + return o && (o.$typeUrl === QueryChannelConsensusStateRequest.typeUrl || typeof o.portId === "string" && typeof o.channelId === "string" && typeof o.revisionNumber === "bigint" && typeof o.revisionHeight === "bigint"); + }, + isSDK(o: any): o is QueryChannelConsensusStateRequestSDKType { + return o && (o.$typeUrl === QueryChannelConsensusStateRequest.typeUrl || typeof o.port_id === "string" && typeof o.channel_id === "string" && typeof o.revision_number === "bigint" && typeof o.revision_height === "bigint"); + }, + isAmino(o: any): o is QueryChannelConsensusStateRequestAmino { + return o && (o.$typeUrl === QueryChannelConsensusStateRequest.typeUrl || typeof o.port_id === "string" && typeof o.channel_id === "string" && typeof o.revision_number === "bigint" && typeof o.revision_height === "bigint"); + }, encode(message: QueryChannelConsensusStateRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.portId !== "") { writer.uint32(10).string(message.portId); @@ -2448,7 +2574,8 @@ export const QueryChannelConsensusStateRequest = { typeUrl: "/ibc.core.channel.v1.QueryChannelConsensusStateRequest", value: QueryChannelConsensusStateRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryChannelConsensusStateResponse(): QueryChannelConsensusStateResponse { return { @@ -2468,6 +2595,15 @@ function createBaseQueryChannelConsensusStateResponse(): QueryChannelConsensusSt export const QueryChannelConsensusStateResponse = { typeUrl: "/ibc.core.channel.v1.QueryChannelConsensusStateResponse", aminoType: "cosmos-sdk/QueryChannelConsensusStateResponse", + is(o: any): o is QueryChannelConsensusStateResponse { + return o && (o.$typeUrl === QueryChannelConsensusStateResponse.typeUrl || typeof o.clientId === "string" && (o.proof instanceof Uint8Array || typeof o.proof === "string") && Height.is(o.proofHeight)); + }, + isSDK(o: any): o is QueryChannelConsensusStateResponseSDKType { + return o && (o.$typeUrl === QueryChannelConsensusStateResponse.typeUrl || typeof o.client_id === "string" && (o.proof instanceof Uint8Array || typeof o.proof === "string") && Height.isSDK(o.proof_height)); + }, + isAmino(o: any): o is QueryChannelConsensusStateResponseAmino { + return o && (o.$typeUrl === QueryChannelConsensusStateResponse.typeUrl || typeof o.client_id === "string" && (o.proof instanceof Uint8Array || typeof o.proof === "string") && Height.isAmino(o.proof_height)); + }, encode(message: QueryChannelConsensusStateResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.consensusState !== undefined) { Any.encode(message.consensusState, writer.uint32(10).fork()).ldelim(); @@ -2580,6 +2716,12 @@ export const QueryChannelConsensusStateResponse = { typeUrl: "/ibc.core.channel.v1.QueryChannelConsensusStateResponse", value: QueryChannelConsensusStateResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryChannelConsensusStateResponse.typeUrl)) { + return; + } + Height.registerTypeUrl(); } }; function createBaseQueryPacketCommitmentRequest(): QueryPacketCommitmentRequest { @@ -2599,6 +2741,15 @@ function createBaseQueryPacketCommitmentRequest(): QueryPacketCommitmentRequest export const QueryPacketCommitmentRequest = { typeUrl: "/ibc.core.channel.v1.QueryPacketCommitmentRequest", aminoType: "cosmos-sdk/QueryPacketCommitmentRequest", + is(o: any): o is QueryPacketCommitmentRequest { + return o && (o.$typeUrl === QueryPacketCommitmentRequest.typeUrl || typeof o.portId === "string" && typeof o.channelId === "string" && typeof o.sequence === "bigint"); + }, + isSDK(o: any): o is QueryPacketCommitmentRequestSDKType { + return o && (o.$typeUrl === QueryPacketCommitmentRequest.typeUrl || typeof o.port_id === "string" && typeof o.channel_id === "string" && typeof o.sequence === "bigint"); + }, + isAmino(o: any): o is QueryPacketCommitmentRequestAmino { + return o && (o.$typeUrl === QueryPacketCommitmentRequest.typeUrl || typeof o.port_id === "string" && typeof o.channel_id === "string" && typeof o.sequence === "bigint"); + }, encode(message: QueryPacketCommitmentRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.portId !== "") { writer.uint32(10).string(message.portId); @@ -2695,7 +2846,8 @@ export const QueryPacketCommitmentRequest = { typeUrl: "/ibc.core.channel.v1.QueryPacketCommitmentRequest", value: QueryPacketCommitmentRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryPacketCommitmentResponse(): QueryPacketCommitmentResponse { return { @@ -2715,6 +2867,15 @@ function createBaseQueryPacketCommitmentResponse(): QueryPacketCommitmentRespons export const QueryPacketCommitmentResponse = { typeUrl: "/ibc.core.channel.v1.QueryPacketCommitmentResponse", aminoType: "cosmos-sdk/QueryPacketCommitmentResponse", + is(o: any): o is QueryPacketCommitmentResponse { + return o && (o.$typeUrl === QueryPacketCommitmentResponse.typeUrl || (o.commitment instanceof Uint8Array || typeof o.commitment === "string") && (o.proof instanceof Uint8Array || typeof o.proof === "string") && Height.is(o.proofHeight)); + }, + isSDK(o: any): o is QueryPacketCommitmentResponseSDKType { + return o && (o.$typeUrl === QueryPacketCommitmentResponse.typeUrl || (o.commitment instanceof Uint8Array || typeof o.commitment === "string") && (o.proof instanceof Uint8Array || typeof o.proof === "string") && Height.isSDK(o.proof_height)); + }, + isAmino(o: any): o is QueryPacketCommitmentResponseAmino { + return o && (o.$typeUrl === QueryPacketCommitmentResponse.typeUrl || (o.commitment instanceof Uint8Array || typeof o.commitment === "string") && (o.proof instanceof Uint8Array || typeof o.proof === "string") && Height.isAmino(o.proof_height)); + }, encode(message: QueryPacketCommitmentResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.commitment.length !== 0) { writer.uint32(10).bytes(message.commitment); @@ -2811,6 +2972,12 @@ export const QueryPacketCommitmentResponse = { typeUrl: "/ibc.core.channel.v1.QueryPacketCommitmentResponse", value: QueryPacketCommitmentResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryPacketCommitmentResponse.typeUrl)) { + return; + } + Height.registerTypeUrl(); } }; function createBaseQueryPacketCommitmentsRequest(): QueryPacketCommitmentsRequest { @@ -2830,6 +2997,15 @@ function createBaseQueryPacketCommitmentsRequest(): QueryPacketCommitmentsReques export const QueryPacketCommitmentsRequest = { typeUrl: "/ibc.core.channel.v1.QueryPacketCommitmentsRequest", aminoType: "cosmos-sdk/QueryPacketCommitmentsRequest", + is(o: any): o is QueryPacketCommitmentsRequest { + return o && (o.$typeUrl === QueryPacketCommitmentsRequest.typeUrl || typeof o.portId === "string" && typeof o.channelId === "string"); + }, + isSDK(o: any): o is QueryPacketCommitmentsRequestSDKType { + return o && (o.$typeUrl === QueryPacketCommitmentsRequest.typeUrl || typeof o.port_id === "string" && typeof o.channel_id === "string"); + }, + isAmino(o: any): o is QueryPacketCommitmentsRequestAmino { + return o && (o.$typeUrl === QueryPacketCommitmentsRequest.typeUrl || typeof o.port_id === "string" && typeof o.channel_id === "string"); + }, encode(message: QueryPacketCommitmentsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.portId !== "") { writer.uint32(10).string(message.portId); @@ -2926,6 +3102,12 @@ export const QueryPacketCommitmentsRequest = { typeUrl: "/ibc.core.channel.v1.QueryPacketCommitmentsRequest", value: QueryPacketCommitmentsRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryPacketCommitmentsRequest.typeUrl)) { + return; + } + PageRequest.registerTypeUrl(); } }; function createBaseQueryPacketCommitmentsResponse(): QueryPacketCommitmentsResponse { @@ -2945,6 +3127,15 @@ function createBaseQueryPacketCommitmentsResponse(): QueryPacketCommitmentsRespo export const QueryPacketCommitmentsResponse = { typeUrl: "/ibc.core.channel.v1.QueryPacketCommitmentsResponse", aminoType: "cosmos-sdk/QueryPacketCommitmentsResponse", + is(o: any): o is QueryPacketCommitmentsResponse { + return o && (o.$typeUrl === QueryPacketCommitmentsResponse.typeUrl || Array.isArray(o.commitments) && (!o.commitments.length || PacketState.is(o.commitments[0])) && Height.is(o.height)); + }, + isSDK(o: any): o is QueryPacketCommitmentsResponseSDKType { + return o && (o.$typeUrl === QueryPacketCommitmentsResponse.typeUrl || Array.isArray(o.commitments) && (!o.commitments.length || PacketState.isSDK(o.commitments[0])) && Height.isSDK(o.height)); + }, + isAmino(o: any): o is QueryPacketCommitmentsResponseAmino { + return o && (o.$typeUrl === QueryPacketCommitmentsResponse.typeUrl || Array.isArray(o.commitments) && (!o.commitments.length || PacketState.isAmino(o.commitments[0])) && Height.isAmino(o.height)); + }, encode(message: QueryPacketCommitmentsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.commitments) { PacketState.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -3049,6 +3240,14 @@ export const QueryPacketCommitmentsResponse = { typeUrl: "/ibc.core.channel.v1.QueryPacketCommitmentsResponse", value: QueryPacketCommitmentsResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryPacketCommitmentsResponse.typeUrl)) { + return; + } + PacketState.registerTypeUrl(); + PageResponse.registerTypeUrl(); + Height.registerTypeUrl(); } }; function createBaseQueryPacketReceiptRequest(): QueryPacketReceiptRequest { @@ -3068,6 +3267,15 @@ function createBaseQueryPacketReceiptRequest(): QueryPacketReceiptRequest { export const QueryPacketReceiptRequest = { typeUrl: "/ibc.core.channel.v1.QueryPacketReceiptRequest", aminoType: "cosmos-sdk/QueryPacketReceiptRequest", + is(o: any): o is QueryPacketReceiptRequest { + return o && (o.$typeUrl === QueryPacketReceiptRequest.typeUrl || typeof o.portId === "string" && typeof o.channelId === "string" && typeof o.sequence === "bigint"); + }, + isSDK(o: any): o is QueryPacketReceiptRequestSDKType { + return o && (o.$typeUrl === QueryPacketReceiptRequest.typeUrl || typeof o.port_id === "string" && typeof o.channel_id === "string" && typeof o.sequence === "bigint"); + }, + isAmino(o: any): o is QueryPacketReceiptRequestAmino { + return o && (o.$typeUrl === QueryPacketReceiptRequest.typeUrl || typeof o.port_id === "string" && typeof o.channel_id === "string" && typeof o.sequence === "bigint"); + }, encode(message: QueryPacketReceiptRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.portId !== "") { writer.uint32(10).string(message.portId); @@ -3164,7 +3372,8 @@ export const QueryPacketReceiptRequest = { typeUrl: "/ibc.core.channel.v1.QueryPacketReceiptRequest", value: QueryPacketReceiptRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryPacketReceiptResponse(): QueryPacketReceiptResponse { return { @@ -3184,6 +3393,15 @@ function createBaseQueryPacketReceiptResponse(): QueryPacketReceiptResponse { export const QueryPacketReceiptResponse = { typeUrl: "/ibc.core.channel.v1.QueryPacketReceiptResponse", aminoType: "cosmos-sdk/QueryPacketReceiptResponse", + is(o: any): o is QueryPacketReceiptResponse { + return o && (o.$typeUrl === QueryPacketReceiptResponse.typeUrl || typeof o.received === "boolean" && (o.proof instanceof Uint8Array || typeof o.proof === "string") && Height.is(o.proofHeight)); + }, + isSDK(o: any): o is QueryPacketReceiptResponseSDKType { + return o && (o.$typeUrl === QueryPacketReceiptResponse.typeUrl || typeof o.received === "boolean" && (o.proof instanceof Uint8Array || typeof o.proof === "string") && Height.isSDK(o.proof_height)); + }, + isAmino(o: any): o is QueryPacketReceiptResponseAmino { + return o && (o.$typeUrl === QueryPacketReceiptResponse.typeUrl || typeof o.received === "boolean" && (o.proof instanceof Uint8Array || typeof o.proof === "string") && Height.isAmino(o.proof_height)); + }, encode(message: QueryPacketReceiptResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.received === true) { writer.uint32(16).bool(message.received); @@ -3280,6 +3498,12 @@ export const QueryPacketReceiptResponse = { typeUrl: "/ibc.core.channel.v1.QueryPacketReceiptResponse", value: QueryPacketReceiptResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryPacketReceiptResponse.typeUrl)) { + return; + } + Height.registerTypeUrl(); } }; function createBaseQueryPacketAcknowledgementRequest(): QueryPacketAcknowledgementRequest { @@ -3299,6 +3523,15 @@ function createBaseQueryPacketAcknowledgementRequest(): QueryPacketAcknowledgeme export const QueryPacketAcknowledgementRequest = { typeUrl: "/ibc.core.channel.v1.QueryPacketAcknowledgementRequest", aminoType: "cosmos-sdk/QueryPacketAcknowledgementRequest", + is(o: any): o is QueryPacketAcknowledgementRequest { + return o && (o.$typeUrl === QueryPacketAcknowledgementRequest.typeUrl || typeof o.portId === "string" && typeof o.channelId === "string" && typeof o.sequence === "bigint"); + }, + isSDK(o: any): o is QueryPacketAcknowledgementRequestSDKType { + return o && (o.$typeUrl === QueryPacketAcknowledgementRequest.typeUrl || typeof o.port_id === "string" && typeof o.channel_id === "string" && typeof o.sequence === "bigint"); + }, + isAmino(o: any): o is QueryPacketAcknowledgementRequestAmino { + return o && (o.$typeUrl === QueryPacketAcknowledgementRequest.typeUrl || typeof o.port_id === "string" && typeof o.channel_id === "string" && typeof o.sequence === "bigint"); + }, encode(message: QueryPacketAcknowledgementRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.portId !== "") { writer.uint32(10).string(message.portId); @@ -3395,7 +3628,8 @@ export const QueryPacketAcknowledgementRequest = { typeUrl: "/ibc.core.channel.v1.QueryPacketAcknowledgementRequest", value: QueryPacketAcknowledgementRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryPacketAcknowledgementResponse(): QueryPacketAcknowledgementResponse { return { @@ -3415,6 +3649,15 @@ function createBaseQueryPacketAcknowledgementResponse(): QueryPacketAcknowledgem export const QueryPacketAcknowledgementResponse = { typeUrl: "/ibc.core.channel.v1.QueryPacketAcknowledgementResponse", aminoType: "cosmos-sdk/QueryPacketAcknowledgementResponse", + is(o: any): o is QueryPacketAcknowledgementResponse { + return o && (o.$typeUrl === QueryPacketAcknowledgementResponse.typeUrl || (o.acknowledgement instanceof Uint8Array || typeof o.acknowledgement === "string") && (o.proof instanceof Uint8Array || typeof o.proof === "string") && Height.is(o.proofHeight)); + }, + isSDK(o: any): o is QueryPacketAcknowledgementResponseSDKType { + return o && (o.$typeUrl === QueryPacketAcknowledgementResponse.typeUrl || (o.acknowledgement instanceof Uint8Array || typeof o.acknowledgement === "string") && (o.proof instanceof Uint8Array || typeof o.proof === "string") && Height.isSDK(o.proof_height)); + }, + isAmino(o: any): o is QueryPacketAcknowledgementResponseAmino { + return o && (o.$typeUrl === QueryPacketAcknowledgementResponse.typeUrl || (o.acknowledgement instanceof Uint8Array || typeof o.acknowledgement === "string") && (o.proof instanceof Uint8Array || typeof o.proof === "string") && Height.isAmino(o.proof_height)); + }, encode(message: QueryPacketAcknowledgementResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.acknowledgement.length !== 0) { writer.uint32(10).bytes(message.acknowledgement); @@ -3511,6 +3754,12 @@ export const QueryPacketAcknowledgementResponse = { typeUrl: "/ibc.core.channel.v1.QueryPacketAcknowledgementResponse", value: QueryPacketAcknowledgementResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryPacketAcknowledgementResponse.typeUrl)) { + return; + } + Height.registerTypeUrl(); } }; function createBaseQueryPacketAcknowledgementsRequest(): QueryPacketAcknowledgementsRequest { @@ -3531,6 +3780,15 @@ function createBaseQueryPacketAcknowledgementsRequest(): QueryPacketAcknowledgem export const QueryPacketAcknowledgementsRequest = { typeUrl: "/ibc.core.channel.v1.QueryPacketAcknowledgementsRequest", aminoType: "cosmos-sdk/QueryPacketAcknowledgementsRequest", + is(o: any): o is QueryPacketAcknowledgementsRequest { + return o && (o.$typeUrl === QueryPacketAcknowledgementsRequest.typeUrl || typeof o.portId === "string" && typeof o.channelId === "string" && Array.isArray(o.packetCommitmentSequences) && (!o.packetCommitmentSequences.length || typeof o.packetCommitmentSequences[0] === "bigint")); + }, + isSDK(o: any): o is QueryPacketAcknowledgementsRequestSDKType { + return o && (o.$typeUrl === QueryPacketAcknowledgementsRequest.typeUrl || typeof o.port_id === "string" && typeof o.channel_id === "string" && Array.isArray(o.packet_commitment_sequences) && (!o.packet_commitment_sequences.length || typeof o.packet_commitment_sequences[0] === "bigint")); + }, + isAmino(o: any): o is QueryPacketAcknowledgementsRequestAmino { + return o && (o.$typeUrl === QueryPacketAcknowledgementsRequest.typeUrl || typeof o.port_id === "string" && typeof o.channel_id === "string" && Array.isArray(o.packet_commitment_sequences) && (!o.packet_commitment_sequences.length || typeof o.packet_commitment_sequences[0] === "bigint")); + }, encode(message: QueryPacketAcknowledgementsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.portId !== "") { writer.uint32(10).string(message.portId); @@ -3656,6 +3914,12 @@ export const QueryPacketAcknowledgementsRequest = { typeUrl: "/ibc.core.channel.v1.QueryPacketAcknowledgementsRequest", value: QueryPacketAcknowledgementsRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryPacketAcknowledgementsRequest.typeUrl)) { + return; + } + PageRequest.registerTypeUrl(); } }; function createBaseQueryPacketAcknowledgementsResponse(): QueryPacketAcknowledgementsResponse { @@ -3675,6 +3939,15 @@ function createBaseQueryPacketAcknowledgementsResponse(): QueryPacketAcknowledge export const QueryPacketAcknowledgementsResponse = { typeUrl: "/ibc.core.channel.v1.QueryPacketAcknowledgementsResponse", aminoType: "cosmos-sdk/QueryPacketAcknowledgementsResponse", + is(o: any): o is QueryPacketAcknowledgementsResponse { + return o && (o.$typeUrl === QueryPacketAcknowledgementsResponse.typeUrl || Array.isArray(o.acknowledgements) && (!o.acknowledgements.length || PacketState.is(o.acknowledgements[0])) && Height.is(o.height)); + }, + isSDK(o: any): o is QueryPacketAcknowledgementsResponseSDKType { + return o && (o.$typeUrl === QueryPacketAcknowledgementsResponse.typeUrl || Array.isArray(o.acknowledgements) && (!o.acknowledgements.length || PacketState.isSDK(o.acknowledgements[0])) && Height.isSDK(o.height)); + }, + isAmino(o: any): o is QueryPacketAcknowledgementsResponseAmino { + return o && (o.$typeUrl === QueryPacketAcknowledgementsResponse.typeUrl || Array.isArray(o.acknowledgements) && (!o.acknowledgements.length || PacketState.isAmino(o.acknowledgements[0])) && Height.isAmino(o.height)); + }, encode(message: QueryPacketAcknowledgementsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.acknowledgements) { PacketState.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -3779,6 +4052,14 @@ export const QueryPacketAcknowledgementsResponse = { typeUrl: "/ibc.core.channel.v1.QueryPacketAcknowledgementsResponse", value: QueryPacketAcknowledgementsResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryPacketAcknowledgementsResponse.typeUrl)) { + return; + } + PacketState.registerTypeUrl(); + PageResponse.registerTypeUrl(); + Height.registerTypeUrl(); } }; function createBaseQueryUnreceivedPacketsRequest(): QueryUnreceivedPacketsRequest { @@ -3798,6 +4079,15 @@ function createBaseQueryUnreceivedPacketsRequest(): QueryUnreceivedPacketsReques export const QueryUnreceivedPacketsRequest = { typeUrl: "/ibc.core.channel.v1.QueryUnreceivedPacketsRequest", aminoType: "cosmos-sdk/QueryUnreceivedPacketsRequest", + is(o: any): o is QueryUnreceivedPacketsRequest { + return o && (o.$typeUrl === QueryUnreceivedPacketsRequest.typeUrl || typeof o.portId === "string" && typeof o.channelId === "string" && Array.isArray(o.packetCommitmentSequences) && (!o.packetCommitmentSequences.length || typeof o.packetCommitmentSequences[0] === "bigint")); + }, + isSDK(o: any): o is QueryUnreceivedPacketsRequestSDKType { + return o && (o.$typeUrl === QueryUnreceivedPacketsRequest.typeUrl || typeof o.port_id === "string" && typeof o.channel_id === "string" && Array.isArray(o.packet_commitment_sequences) && (!o.packet_commitment_sequences.length || typeof o.packet_commitment_sequences[0] === "bigint")); + }, + isAmino(o: any): o is QueryUnreceivedPacketsRequestAmino { + return o && (o.$typeUrl === QueryUnreceivedPacketsRequest.typeUrl || typeof o.port_id === "string" && typeof o.channel_id === "string" && Array.isArray(o.packet_commitment_sequences) && (!o.packet_commitment_sequences.length || typeof o.packet_commitment_sequences[0] === "bigint")); + }, encode(message: QueryUnreceivedPacketsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.portId !== "") { writer.uint32(10).string(message.portId); @@ -3907,7 +4197,8 @@ export const QueryUnreceivedPacketsRequest = { typeUrl: "/ibc.core.channel.v1.QueryUnreceivedPacketsRequest", value: QueryUnreceivedPacketsRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryUnreceivedPacketsResponse(): QueryUnreceivedPacketsResponse { return { @@ -3925,6 +4216,15 @@ function createBaseQueryUnreceivedPacketsResponse(): QueryUnreceivedPacketsRespo export const QueryUnreceivedPacketsResponse = { typeUrl: "/ibc.core.channel.v1.QueryUnreceivedPacketsResponse", aminoType: "cosmos-sdk/QueryUnreceivedPacketsResponse", + is(o: any): o is QueryUnreceivedPacketsResponse { + return o && (o.$typeUrl === QueryUnreceivedPacketsResponse.typeUrl || Array.isArray(o.sequences) && (!o.sequences.length || typeof o.sequences[0] === "bigint") && Height.is(o.height)); + }, + isSDK(o: any): o is QueryUnreceivedPacketsResponseSDKType { + return o && (o.$typeUrl === QueryUnreceivedPacketsResponse.typeUrl || Array.isArray(o.sequences) && (!o.sequences.length || typeof o.sequences[0] === "bigint") && Height.isSDK(o.height)); + }, + isAmino(o: any): o is QueryUnreceivedPacketsResponseAmino { + return o && (o.$typeUrl === QueryUnreceivedPacketsResponse.typeUrl || Array.isArray(o.sequences) && (!o.sequences.length || typeof o.sequences[0] === "bigint") && Height.isAmino(o.height)); + }, encode(message: QueryUnreceivedPacketsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { writer.uint32(10).fork(); for (const v of message.sequences) { @@ -4022,6 +4322,12 @@ export const QueryUnreceivedPacketsResponse = { typeUrl: "/ibc.core.channel.v1.QueryUnreceivedPacketsResponse", value: QueryUnreceivedPacketsResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryUnreceivedPacketsResponse.typeUrl)) { + return; + } + Height.registerTypeUrl(); } }; function createBaseQueryUnreceivedAcksRequest(): QueryUnreceivedAcksRequest { @@ -4041,6 +4347,15 @@ function createBaseQueryUnreceivedAcksRequest(): QueryUnreceivedAcksRequest { export const QueryUnreceivedAcksRequest = { typeUrl: "/ibc.core.channel.v1.QueryUnreceivedAcksRequest", aminoType: "cosmos-sdk/QueryUnreceivedAcksRequest", + is(o: any): o is QueryUnreceivedAcksRequest { + return o && (o.$typeUrl === QueryUnreceivedAcksRequest.typeUrl || typeof o.portId === "string" && typeof o.channelId === "string" && Array.isArray(o.packetAckSequences) && (!o.packetAckSequences.length || typeof o.packetAckSequences[0] === "bigint")); + }, + isSDK(o: any): o is QueryUnreceivedAcksRequestSDKType { + return o && (o.$typeUrl === QueryUnreceivedAcksRequest.typeUrl || typeof o.port_id === "string" && typeof o.channel_id === "string" && Array.isArray(o.packet_ack_sequences) && (!o.packet_ack_sequences.length || typeof o.packet_ack_sequences[0] === "bigint")); + }, + isAmino(o: any): o is QueryUnreceivedAcksRequestAmino { + return o && (o.$typeUrl === QueryUnreceivedAcksRequest.typeUrl || typeof o.port_id === "string" && typeof o.channel_id === "string" && Array.isArray(o.packet_ack_sequences) && (!o.packet_ack_sequences.length || typeof o.packet_ack_sequences[0] === "bigint")); + }, encode(message: QueryUnreceivedAcksRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.portId !== "") { writer.uint32(10).string(message.portId); @@ -4150,7 +4465,8 @@ export const QueryUnreceivedAcksRequest = { typeUrl: "/ibc.core.channel.v1.QueryUnreceivedAcksRequest", value: QueryUnreceivedAcksRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryUnreceivedAcksResponse(): QueryUnreceivedAcksResponse { return { @@ -4168,6 +4484,15 @@ function createBaseQueryUnreceivedAcksResponse(): QueryUnreceivedAcksResponse { export const QueryUnreceivedAcksResponse = { typeUrl: "/ibc.core.channel.v1.QueryUnreceivedAcksResponse", aminoType: "cosmos-sdk/QueryUnreceivedAcksResponse", + is(o: any): o is QueryUnreceivedAcksResponse { + return o && (o.$typeUrl === QueryUnreceivedAcksResponse.typeUrl || Array.isArray(o.sequences) && (!o.sequences.length || typeof o.sequences[0] === "bigint") && Height.is(o.height)); + }, + isSDK(o: any): o is QueryUnreceivedAcksResponseSDKType { + return o && (o.$typeUrl === QueryUnreceivedAcksResponse.typeUrl || Array.isArray(o.sequences) && (!o.sequences.length || typeof o.sequences[0] === "bigint") && Height.isSDK(o.height)); + }, + isAmino(o: any): o is QueryUnreceivedAcksResponseAmino { + return o && (o.$typeUrl === QueryUnreceivedAcksResponse.typeUrl || Array.isArray(o.sequences) && (!o.sequences.length || typeof o.sequences[0] === "bigint") && Height.isAmino(o.height)); + }, encode(message: QueryUnreceivedAcksResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { writer.uint32(10).fork(); for (const v of message.sequences) { @@ -4265,6 +4590,12 @@ export const QueryUnreceivedAcksResponse = { typeUrl: "/ibc.core.channel.v1.QueryUnreceivedAcksResponse", value: QueryUnreceivedAcksResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryUnreceivedAcksResponse.typeUrl)) { + return; + } + Height.registerTypeUrl(); } }; function createBaseQueryNextSequenceReceiveRequest(): QueryNextSequenceReceiveRequest { @@ -4283,6 +4614,15 @@ function createBaseQueryNextSequenceReceiveRequest(): QueryNextSequenceReceiveRe export const QueryNextSequenceReceiveRequest = { typeUrl: "/ibc.core.channel.v1.QueryNextSequenceReceiveRequest", aminoType: "cosmos-sdk/QueryNextSequenceReceiveRequest", + is(o: any): o is QueryNextSequenceReceiveRequest { + return o && (o.$typeUrl === QueryNextSequenceReceiveRequest.typeUrl || typeof o.portId === "string" && typeof o.channelId === "string"); + }, + isSDK(o: any): o is QueryNextSequenceReceiveRequestSDKType { + return o && (o.$typeUrl === QueryNextSequenceReceiveRequest.typeUrl || typeof o.port_id === "string" && typeof o.channel_id === "string"); + }, + isAmino(o: any): o is QueryNextSequenceReceiveRequestAmino { + return o && (o.$typeUrl === QueryNextSequenceReceiveRequest.typeUrl || typeof o.port_id === "string" && typeof o.channel_id === "string"); + }, encode(message: QueryNextSequenceReceiveRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.portId !== "") { writer.uint32(10).string(message.portId); @@ -4363,7 +4703,8 @@ export const QueryNextSequenceReceiveRequest = { typeUrl: "/ibc.core.channel.v1.QueryNextSequenceReceiveRequest", value: QueryNextSequenceReceiveRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryNextSequenceReceiveResponse(): QueryNextSequenceReceiveResponse { return { @@ -4382,6 +4723,15 @@ function createBaseQueryNextSequenceReceiveResponse(): QueryNextSequenceReceiveR export const QueryNextSequenceReceiveResponse = { typeUrl: "/ibc.core.channel.v1.QueryNextSequenceReceiveResponse", aminoType: "cosmos-sdk/QueryNextSequenceReceiveResponse", + is(o: any): o is QueryNextSequenceReceiveResponse { + return o && (o.$typeUrl === QueryNextSequenceReceiveResponse.typeUrl || typeof o.nextSequenceReceive === "bigint" && (o.proof instanceof Uint8Array || typeof o.proof === "string") && Height.is(o.proofHeight)); + }, + isSDK(o: any): o is QueryNextSequenceReceiveResponseSDKType { + return o && (o.$typeUrl === QueryNextSequenceReceiveResponse.typeUrl || typeof o.next_sequence_receive === "bigint" && (o.proof instanceof Uint8Array || typeof o.proof === "string") && Height.isSDK(o.proof_height)); + }, + isAmino(o: any): o is QueryNextSequenceReceiveResponseAmino { + return o && (o.$typeUrl === QueryNextSequenceReceiveResponse.typeUrl || typeof o.next_sequence_receive === "bigint" && (o.proof instanceof Uint8Array || typeof o.proof === "string") && Height.isAmino(o.proof_height)); + }, encode(message: QueryNextSequenceReceiveResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.nextSequenceReceive !== BigInt(0)) { writer.uint32(8).uint64(message.nextSequenceReceive); @@ -4480,5 +4830,11 @@ export const QueryNextSequenceReceiveResponse = { typeUrl: "/ibc.core.channel.v1.QueryNextSequenceReceiveResponse", value: QueryNextSequenceReceiveResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryNextSequenceReceiveResponse.typeUrl)) { + return; + } + Height.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/ibc/core/channel/v1/tx.registry.ts b/__fixtures__/v-next/outputv3/ibc/core/channel/v1/tx.registry.ts index d88478fd29..c6a20ca277 100644 --- a/__fixtures__/v-next/outputv3/ibc/core/channel/v1/tx.registry.ts +++ b/__fixtures__/v-next/outputv3/ibc/core/channel/v1/tx.registry.ts @@ -1,13 +1,8 @@ import { Channel, ChannelSDKType, Packet, PacketSDKType } from "./channel"; import { Height, HeightSDKType } from "../../client/v1/client"; -import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { TelescopeGeneratedType } from "../../../../types"; import { MsgChannelOpenInit, MsgChannelOpenInitSDKType, MsgChannelOpenTry, MsgChannelOpenTrySDKType, MsgChannelOpenAck, MsgChannelOpenAckSDKType, MsgChannelOpenConfirm, MsgChannelOpenConfirmSDKType, MsgChannelCloseInit, MsgChannelCloseInitSDKType, MsgChannelCloseConfirm, MsgChannelCloseConfirmSDKType, MsgRecvPacket, MsgRecvPacketSDKType, MsgTimeout, MsgTimeoutSDKType, MsgTimeoutOnClose, MsgTimeoutOnCloseSDKType, MsgAcknowledgement, MsgAcknowledgementSDKType } from "./tx"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/ibc.core.channel.v1.MsgChannelOpenInit", MsgChannelOpenInit], ["/ibc.core.channel.v1.MsgChannelOpenTry", MsgChannelOpenTry], ["/ibc.core.channel.v1.MsgChannelOpenAck", MsgChannelOpenAck], ["/ibc.core.channel.v1.MsgChannelOpenConfirm", MsgChannelOpenConfirm], ["/ibc.core.channel.v1.MsgChannelCloseInit", MsgChannelCloseInit], ["/ibc.core.channel.v1.MsgChannelCloseConfirm", MsgChannelCloseConfirm], ["/ibc.core.channel.v1.MsgRecvPacket", MsgRecvPacket], ["/ibc.core.channel.v1.MsgTimeout", MsgTimeout], ["/ibc.core.channel.v1.MsgTimeoutOnClose", MsgTimeoutOnClose], ["/ibc.core.channel.v1.MsgAcknowledgement", MsgAcknowledgement]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/ibc.core.channel.v1.MsgChannelOpenInit", MsgChannelOpenInit], ["/ibc.core.channel.v1.MsgChannelOpenTry", MsgChannelOpenTry], ["/ibc.core.channel.v1.MsgChannelOpenAck", MsgChannelOpenAck], ["/ibc.core.channel.v1.MsgChannelOpenConfirm", MsgChannelOpenConfirm], ["/ibc.core.channel.v1.MsgChannelCloseInit", MsgChannelCloseInit], ["/ibc.core.channel.v1.MsgChannelCloseConfirm", MsgChannelCloseConfirm], ["/ibc.core.channel.v1.MsgRecvPacket", MsgRecvPacket], ["/ibc.core.channel.v1.MsgTimeout", MsgTimeout], ["/ibc.core.channel.v1.MsgTimeoutOnClose", MsgTimeoutOnClose], ["/ibc.core.channel.v1.MsgAcknowledgement", MsgAcknowledgement]]; export const MessageComposer = { encoded: { channelOpenInit(value: MsgChannelOpenInit) { diff --git a/__fixtures__/v-next/outputv3/ibc/core/channel/v1/tx.rpc.func.ts b/__fixtures__/v-next/outputv3/ibc/core/channel/v1/tx.rpc.func.ts new file mode 100644 index 0000000000..98c04fd664 --- /dev/null +++ b/__fixtures__/v-next/outputv3/ibc/core/channel/v1/tx.rpc.func.ts @@ -0,0 +1,95 @@ +import { Channel, ChannelSDKType, Packet, PacketSDKType } from "./channel"; +import { Height, HeightSDKType } from "../../client/v1/client"; +import { buildTx } from "../../../../helper-func-types"; +import { MsgChannelOpenInit, MsgChannelOpenInitSDKType, MsgChannelOpenInitResponse, MsgChannelOpenInitResponseSDKType, MsgChannelOpenTry, MsgChannelOpenTrySDKType, MsgChannelOpenTryResponse, MsgChannelOpenTryResponseSDKType, MsgChannelOpenAck, MsgChannelOpenAckSDKType, MsgChannelOpenAckResponse, MsgChannelOpenAckResponseSDKType, MsgChannelOpenConfirm, MsgChannelOpenConfirmSDKType, MsgChannelOpenConfirmResponse, MsgChannelOpenConfirmResponseSDKType, MsgChannelCloseInit, MsgChannelCloseInitSDKType, MsgChannelCloseInitResponse, MsgChannelCloseInitResponseSDKType, MsgChannelCloseConfirm, MsgChannelCloseConfirmSDKType, MsgChannelCloseConfirmResponse, MsgChannelCloseConfirmResponseSDKType, MsgRecvPacket, MsgRecvPacketSDKType, MsgRecvPacketResponse, MsgRecvPacketResponseSDKType, MsgTimeout, MsgTimeoutSDKType, MsgTimeoutResponse, MsgTimeoutResponseSDKType, MsgTimeoutOnClose, MsgTimeoutOnCloseSDKType, MsgTimeoutOnCloseResponse, MsgTimeoutOnCloseResponseSDKType, MsgAcknowledgement, MsgAcknowledgementSDKType, MsgAcknowledgementResponse, MsgAcknowledgementResponseSDKType } from "./tx"; +/** + * ChannelOpenInit defines a rpc handler method for MsgChannelOpenInit. + * @name channelOpenInit + * @package ibc.core.channel.v1 + * @see proto service: ibc.core.channel.v1.ChannelOpenInit + */ +export const channelOpenInit = buildTx({ + msg: MsgChannelOpenInit +}); +/** + * ChannelOpenTry defines a rpc handler method for MsgChannelOpenTry. + * @name channelOpenTry + * @package ibc.core.channel.v1 + * @see proto service: ibc.core.channel.v1.ChannelOpenTry + */ +export const channelOpenTry = buildTx({ + msg: MsgChannelOpenTry +}); +/** + * ChannelOpenAck defines a rpc handler method for MsgChannelOpenAck. + * @name channelOpenAck + * @package ibc.core.channel.v1 + * @see proto service: ibc.core.channel.v1.ChannelOpenAck + */ +export const channelOpenAck = buildTx({ + msg: MsgChannelOpenAck +}); +/** + * ChannelOpenConfirm defines a rpc handler method for MsgChannelOpenConfirm. + * @name channelOpenConfirm + * @package ibc.core.channel.v1 + * @see proto service: ibc.core.channel.v1.ChannelOpenConfirm + */ +export const channelOpenConfirm = buildTx({ + msg: MsgChannelOpenConfirm +}); +/** + * ChannelCloseInit defines a rpc handler method for MsgChannelCloseInit. + * @name channelCloseInit + * @package ibc.core.channel.v1 + * @see proto service: ibc.core.channel.v1.ChannelCloseInit + */ +export const channelCloseInit = buildTx({ + msg: MsgChannelCloseInit +}); +/** + * ChannelCloseConfirm defines a rpc handler method for + * MsgChannelCloseConfirm. + * @name channelCloseConfirm + * @package ibc.core.channel.v1 + * @see proto service: ibc.core.channel.v1.ChannelCloseConfirm + */ +export const channelCloseConfirm = buildTx({ + msg: MsgChannelCloseConfirm +}); +/** + * RecvPacket defines a rpc handler method for MsgRecvPacket. + * @name recvPacket + * @package ibc.core.channel.v1 + * @see proto service: ibc.core.channel.v1.RecvPacket + */ +export const recvPacket = buildTx({ + msg: MsgRecvPacket +}); +/** + * Timeout defines a rpc handler method for MsgTimeout. + * @name timeout + * @package ibc.core.channel.v1 + * @see proto service: ibc.core.channel.v1.Timeout + */ +export const timeout = buildTx({ + msg: MsgTimeout +}); +/** + * TimeoutOnClose defines a rpc handler method for MsgTimeoutOnClose. + * @name timeoutOnClose + * @package ibc.core.channel.v1 + * @see proto service: ibc.core.channel.v1.TimeoutOnClose + */ +export const timeoutOnClose = buildTx({ + msg: MsgTimeoutOnClose +}); +/** + * Acknowledgement defines a rpc handler method for MsgAcknowledgement. + * @name acknowledgement + * @package ibc.core.channel.v1 + * @see proto service: ibc.core.channel.v1.Acknowledgement + */ +export const acknowledgement = buildTx({ + msg: MsgAcknowledgement +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/ibc/core/channel/v1/tx.ts b/__fixtures__/v-next/outputv3/ibc/core/channel/v1/tx.ts index 761b19cf45..7b4d6c3f1e 100644 --- a/__fixtures__/v-next/outputv3/ibc/core/channel/v1/tx.ts +++ b/__fixtures__/v-next/outputv3/ibc/core/channel/v1/tx.ts @@ -1,6 +1,7 @@ import { Channel, ChannelAmino, ChannelSDKType, Packet, PacketAmino, PacketSDKType } from "./channel"; import { Height, HeightAmino, HeightSDKType } from "../../client/v1/client"; import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { GlobalDecoderRegistry } from "../../../../registry"; import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../../helpers"; export const protobufPackage = "ibc.core.channel.v1"; /** @@ -732,6 +733,15 @@ function createBaseMsgChannelOpenInit(): MsgChannelOpenInit { export const MsgChannelOpenInit = { typeUrl: "/ibc.core.channel.v1.MsgChannelOpenInit", aminoType: "cosmos-sdk/MsgChannelOpenInit", + is(o: any): o is MsgChannelOpenInit { + return o && (o.$typeUrl === MsgChannelOpenInit.typeUrl || typeof o.portId === "string" && Channel.is(o.channel) && typeof o.signer === "string"); + }, + isSDK(o: any): o is MsgChannelOpenInitSDKType { + return o && (o.$typeUrl === MsgChannelOpenInit.typeUrl || typeof o.port_id === "string" && Channel.isSDK(o.channel) && typeof o.signer === "string"); + }, + isAmino(o: any): o is MsgChannelOpenInitAmino { + return o && (o.$typeUrl === MsgChannelOpenInit.typeUrl || typeof o.port_id === "string" && Channel.isAmino(o.channel) && typeof o.signer === "string"); + }, encode(message: MsgChannelOpenInit, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.portId !== "") { writer.uint32(10).string(message.portId); @@ -828,6 +838,12 @@ export const MsgChannelOpenInit = { typeUrl: "/ibc.core.channel.v1.MsgChannelOpenInit", value: MsgChannelOpenInit.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgChannelOpenInit.typeUrl)) { + return; + } + Channel.registerTypeUrl(); } }; function createBaseMsgChannelOpenInitResponse(): MsgChannelOpenInitResponse { @@ -842,6 +858,15 @@ function createBaseMsgChannelOpenInitResponse(): MsgChannelOpenInitResponse { export const MsgChannelOpenInitResponse = { typeUrl: "/ibc.core.channel.v1.MsgChannelOpenInitResponse", aminoType: "cosmos-sdk/MsgChannelOpenInitResponse", + is(o: any): o is MsgChannelOpenInitResponse { + return o && o.$typeUrl === MsgChannelOpenInitResponse.typeUrl; + }, + isSDK(o: any): o is MsgChannelOpenInitResponseSDKType { + return o && o.$typeUrl === MsgChannelOpenInitResponse.typeUrl; + }, + isAmino(o: any): o is MsgChannelOpenInitResponseAmino { + return o && o.$typeUrl === MsgChannelOpenInitResponse.typeUrl; + }, encode(_: MsgChannelOpenInitResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -893,7 +918,8 @@ export const MsgChannelOpenInitResponse = { typeUrl: "/ibc.core.channel.v1.MsgChannelOpenInitResponse", value: MsgChannelOpenInitResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgChannelOpenTry(): MsgChannelOpenTry { return { @@ -916,6 +942,15 @@ function createBaseMsgChannelOpenTry(): MsgChannelOpenTry { export const MsgChannelOpenTry = { typeUrl: "/ibc.core.channel.v1.MsgChannelOpenTry", aminoType: "cosmos-sdk/MsgChannelOpenTry", + is(o: any): o is MsgChannelOpenTry { + return o && (o.$typeUrl === MsgChannelOpenTry.typeUrl || typeof o.portId === "string" && typeof o.previousChannelId === "string" && Channel.is(o.channel) && typeof o.counterpartyVersion === "string" && (o.proofInit instanceof Uint8Array || typeof o.proofInit === "string") && Height.is(o.proofHeight) && typeof o.signer === "string"); + }, + isSDK(o: any): o is MsgChannelOpenTrySDKType { + return o && (o.$typeUrl === MsgChannelOpenTry.typeUrl || typeof o.port_id === "string" && typeof o.previous_channel_id === "string" && Channel.isSDK(o.channel) && typeof o.counterparty_version === "string" && (o.proof_init instanceof Uint8Array || typeof o.proof_init === "string") && Height.isSDK(o.proof_height) && typeof o.signer === "string"); + }, + isAmino(o: any): o is MsgChannelOpenTryAmino { + return o && (o.$typeUrl === MsgChannelOpenTry.typeUrl || typeof o.port_id === "string" && typeof o.previous_channel_id === "string" && Channel.isAmino(o.channel) && typeof o.counterparty_version === "string" && (o.proof_init instanceof Uint8Array || typeof o.proof_init === "string") && Height.isAmino(o.proof_height) && typeof o.signer === "string"); + }, encode(message: MsgChannelOpenTry, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.portId !== "") { writer.uint32(10).string(message.portId); @@ -1070,6 +1105,13 @@ export const MsgChannelOpenTry = { typeUrl: "/ibc.core.channel.v1.MsgChannelOpenTry", value: MsgChannelOpenTry.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgChannelOpenTry.typeUrl)) { + return; + } + Channel.registerTypeUrl(); + Height.registerTypeUrl(); } }; function createBaseMsgChannelOpenTryResponse(): MsgChannelOpenTryResponse { @@ -1084,6 +1126,15 @@ function createBaseMsgChannelOpenTryResponse(): MsgChannelOpenTryResponse { export const MsgChannelOpenTryResponse = { typeUrl: "/ibc.core.channel.v1.MsgChannelOpenTryResponse", aminoType: "cosmos-sdk/MsgChannelOpenTryResponse", + is(o: any): o is MsgChannelOpenTryResponse { + return o && o.$typeUrl === MsgChannelOpenTryResponse.typeUrl; + }, + isSDK(o: any): o is MsgChannelOpenTryResponseSDKType { + return o && o.$typeUrl === MsgChannelOpenTryResponse.typeUrl; + }, + isAmino(o: any): o is MsgChannelOpenTryResponseAmino { + return o && o.$typeUrl === MsgChannelOpenTryResponse.typeUrl; + }, encode(_: MsgChannelOpenTryResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -1135,7 +1186,8 @@ export const MsgChannelOpenTryResponse = { typeUrl: "/ibc.core.channel.v1.MsgChannelOpenTryResponse", value: MsgChannelOpenTryResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgChannelOpenAck(): MsgChannelOpenAck { return { @@ -1158,6 +1210,15 @@ function createBaseMsgChannelOpenAck(): MsgChannelOpenAck { export const MsgChannelOpenAck = { typeUrl: "/ibc.core.channel.v1.MsgChannelOpenAck", aminoType: "cosmos-sdk/MsgChannelOpenAck", + is(o: any): o is MsgChannelOpenAck { + return o && (o.$typeUrl === MsgChannelOpenAck.typeUrl || typeof o.portId === "string" && typeof o.channelId === "string" && typeof o.counterpartyChannelId === "string" && typeof o.counterpartyVersion === "string" && (o.proofTry instanceof Uint8Array || typeof o.proofTry === "string") && Height.is(o.proofHeight) && typeof o.signer === "string"); + }, + isSDK(o: any): o is MsgChannelOpenAckSDKType { + return o && (o.$typeUrl === MsgChannelOpenAck.typeUrl || typeof o.port_id === "string" && typeof o.channel_id === "string" && typeof o.counterparty_channel_id === "string" && typeof o.counterparty_version === "string" && (o.proof_try instanceof Uint8Array || typeof o.proof_try === "string") && Height.isSDK(o.proof_height) && typeof o.signer === "string"); + }, + isAmino(o: any): o is MsgChannelOpenAckAmino { + return o && (o.$typeUrl === MsgChannelOpenAck.typeUrl || typeof o.port_id === "string" && typeof o.channel_id === "string" && typeof o.counterparty_channel_id === "string" && typeof o.counterparty_version === "string" && (o.proof_try instanceof Uint8Array || typeof o.proof_try === "string") && Height.isAmino(o.proof_height) && typeof o.signer === "string"); + }, encode(message: MsgChannelOpenAck, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.portId !== "") { writer.uint32(10).string(message.portId); @@ -1310,6 +1371,12 @@ export const MsgChannelOpenAck = { typeUrl: "/ibc.core.channel.v1.MsgChannelOpenAck", value: MsgChannelOpenAck.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgChannelOpenAck.typeUrl)) { + return; + } + Height.registerTypeUrl(); } }; function createBaseMsgChannelOpenAckResponse(): MsgChannelOpenAckResponse { @@ -1324,6 +1391,15 @@ function createBaseMsgChannelOpenAckResponse(): MsgChannelOpenAckResponse { export const MsgChannelOpenAckResponse = { typeUrl: "/ibc.core.channel.v1.MsgChannelOpenAckResponse", aminoType: "cosmos-sdk/MsgChannelOpenAckResponse", + is(o: any): o is MsgChannelOpenAckResponse { + return o && o.$typeUrl === MsgChannelOpenAckResponse.typeUrl; + }, + isSDK(o: any): o is MsgChannelOpenAckResponseSDKType { + return o && o.$typeUrl === MsgChannelOpenAckResponse.typeUrl; + }, + isAmino(o: any): o is MsgChannelOpenAckResponseAmino { + return o && o.$typeUrl === MsgChannelOpenAckResponse.typeUrl; + }, encode(_: MsgChannelOpenAckResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -1375,7 +1451,8 @@ export const MsgChannelOpenAckResponse = { typeUrl: "/ibc.core.channel.v1.MsgChannelOpenAckResponse", value: MsgChannelOpenAckResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgChannelOpenConfirm(): MsgChannelOpenConfirm { return { @@ -1396,6 +1473,15 @@ function createBaseMsgChannelOpenConfirm(): MsgChannelOpenConfirm { export const MsgChannelOpenConfirm = { typeUrl: "/ibc.core.channel.v1.MsgChannelOpenConfirm", aminoType: "cosmos-sdk/MsgChannelOpenConfirm", + is(o: any): o is MsgChannelOpenConfirm { + return o && (o.$typeUrl === MsgChannelOpenConfirm.typeUrl || typeof o.portId === "string" && typeof o.channelId === "string" && (o.proofAck instanceof Uint8Array || typeof o.proofAck === "string") && Height.is(o.proofHeight) && typeof o.signer === "string"); + }, + isSDK(o: any): o is MsgChannelOpenConfirmSDKType { + return o && (o.$typeUrl === MsgChannelOpenConfirm.typeUrl || typeof o.port_id === "string" && typeof o.channel_id === "string" && (o.proof_ack instanceof Uint8Array || typeof o.proof_ack === "string") && Height.isSDK(o.proof_height) && typeof o.signer === "string"); + }, + isAmino(o: any): o is MsgChannelOpenConfirmAmino { + return o && (o.$typeUrl === MsgChannelOpenConfirm.typeUrl || typeof o.port_id === "string" && typeof o.channel_id === "string" && (o.proof_ack instanceof Uint8Array || typeof o.proof_ack === "string") && Height.isAmino(o.proof_height) && typeof o.signer === "string"); + }, encode(message: MsgChannelOpenConfirm, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.portId !== "") { writer.uint32(10).string(message.portId); @@ -1520,6 +1606,12 @@ export const MsgChannelOpenConfirm = { typeUrl: "/ibc.core.channel.v1.MsgChannelOpenConfirm", value: MsgChannelOpenConfirm.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgChannelOpenConfirm.typeUrl)) { + return; + } + Height.registerTypeUrl(); } }; function createBaseMsgChannelOpenConfirmResponse(): MsgChannelOpenConfirmResponse { @@ -1535,6 +1627,15 @@ function createBaseMsgChannelOpenConfirmResponse(): MsgChannelOpenConfirmRespons export const MsgChannelOpenConfirmResponse = { typeUrl: "/ibc.core.channel.v1.MsgChannelOpenConfirmResponse", aminoType: "cosmos-sdk/MsgChannelOpenConfirmResponse", + is(o: any): o is MsgChannelOpenConfirmResponse { + return o && o.$typeUrl === MsgChannelOpenConfirmResponse.typeUrl; + }, + isSDK(o: any): o is MsgChannelOpenConfirmResponseSDKType { + return o && o.$typeUrl === MsgChannelOpenConfirmResponse.typeUrl; + }, + isAmino(o: any): o is MsgChannelOpenConfirmResponseAmino { + return o && o.$typeUrl === MsgChannelOpenConfirmResponse.typeUrl; + }, encode(_: MsgChannelOpenConfirmResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -1586,7 +1687,8 @@ export const MsgChannelOpenConfirmResponse = { typeUrl: "/ibc.core.channel.v1.MsgChannelOpenConfirmResponse", value: MsgChannelOpenConfirmResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgChannelCloseInit(): MsgChannelCloseInit { return { @@ -1605,6 +1707,15 @@ function createBaseMsgChannelCloseInit(): MsgChannelCloseInit { export const MsgChannelCloseInit = { typeUrl: "/ibc.core.channel.v1.MsgChannelCloseInit", aminoType: "cosmos-sdk/MsgChannelCloseInit", + is(o: any): o is MsgChannelCloseInit { + return o && (o.$typeUrl === MsgChannelCloseInit.typeUrl || typeof o.portId === "string" && typeof o.channelId === "string" && typeof o.signer === "string"); + }, + isSDK(o: any): o is MsgChannelCloseInitSDKType { + return o && (o.$typeUrl === MsgChannelCloseInit.typeUrl || typeof o.port_id === "string" && typeof o.channel_id === "string" && typeof o.signer === "string"); + }, + isAmino(o: any): o is MsgChannelCloseInitAmino { + return o && (o.$typeUrl === MsgChannelCloseInit.typeUrl || typeof o.port_id === "string" && typeof o.channel_id === "string" && typeof o.signer === "string"); + }, encode(message: MsgChannelCloseInit, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.portId !== "") { writer.uint32(10).string(message.portId); @@ -1699,7 +1810,8 @@ export const MsgChannelCloseInit = { typeUrl: "/ibc.core.channel.v1.MsgChannelCloseInit", value: MsgChannelCloseInit.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgChannelCloseInitResponse(): MsgChannelCloseInitResponse { return {}; @@ -1713,6 +1825,15 @@ function createBaseMsgChannelCloseInitResponse(): MsgChannelCloseInitResponse { export const MsgChannelCloseInitResponse = { typeUrl: "/ibc.core.channel.v1.MsgChannelCloseInitResponse", aminoType: "cosmos-sdk/MsgChannelCloseInitResponse", + is(o: any): o is MsgChannelCloseInitResponse { + return o && o.$typeUrl === MsgChannelCloseInitResponse.typeUrl; + }, + isSDK(o: any): o is MsgChannelCloseInitResponseSDKType { + return o && o.$typeUrl === MsgChannelCloseInitResponse.typeUrl; + }, + isAmino(o: any): o is MsgChannelCloseInitResponseAmino { + return o && o.$typeUrl === MsgChannelCloseInitResponse.typeUrl; + }, encode(_: MsgChannelCloseInitResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -1764,7 +1885,8 @@ export const MsgChannelCloseInitResponse = { typeUrl: "/ibc.core.channel.v1.MsgChannelCloseInitResponse", value: MsgChannelCloseInitResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgChannelCloseConfirm(): MsgChannelCloseConfirm { return { @@ -1785,6 +1907,15 @@ function createBaseMsgChannelCloseConfirm(): MsgChannelCloseConfirm { export const MsgChannelCloseConfirm = { typeUrl: "/ibc.core.channel.v1.MsgChannelCloseConfirm", aminoType: "cosmos-sdk/MsgChannelCloseConfirm", + is(o: any): o is MsgChannelCloseConfirm { + return o && (o.$typeUrl === MsgChannelCloseConfirm.typeUrl || typeof o.portId === "string" && typeof o.channelId === "string" && (o.proofInit instanceof Uint8Array || typeof o.proofInit === "string") && Height.is(o.proofHeight) && typeof o.signer === "string"); + }, + isSDK(o: any): o is MsgChannelCloseConfirmSDKType { + return o && (o.$typeUrl === MsgChannelCloseConfirm.typeUrl || typeof o.port_id === "string" && typeof o.channel_id === "string" && (o.proof_init instanceof Uint8Array || typeof o.proof_init === "string") && Height.isSDK(o.proof_height) && typeof o.signer === "string"); + }, + isAmino(o: any): o is MsgChannelCloseConfirmAmino { + return o && (o.$typeUrl === MsgChannelCloseConfirm.typeUrl || typeof o.port_id === "string" && typeof o.channel_id === "string" && (o.proof_init instanceof Uint8Array || typeof o.proof_init === "string") && Height.isAmino(o.proof_height) && typeof o.signer === "string"); + }, encode(message: MsgChannelCloseConfirm, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.portId !== "") { writer.uint32(10).string(message.portId); @@ -1909,6 +2040,12 @@ export const MsgChannelCloseConfirm = { typeUrl: "/ibc.core.channel.v1.MsgChannelCloseConfirm", value: MsgChannelCloseConfirm.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgChannelCloseConfirm.typeUrl)) { + return; + } + Height.registerTypeUrl(); } }; function createBaseMsgChannelCloseConfirmResponse(): MsgChannelCloseConfirmResponse { @@ -1924,6 +2061,15 @@ function createBaseMsgChannelCloseConfirmResponse(): MsgChannelCloseConfirmRespo export const MsgChannelCloseConfirmResponse = { typeUrl: "/ibc.core.channel.v1.MsgChannelCloseConfirmResponse", aminoType: "cosmos-sdk/MsgChannelCloseConfirmResponse", + is(o: any): o is MsgChannelCloseConfirmResponse { + return o && o.$typeUrl === MsgChannelCloseConfirmResponse.typeUrl; + }, + isSDK(o: any): o is MsgChannelCloseConfirmResponseSDKType { + return o && o.$typeUrl === MsgChannelCloseConfirmResponse.typeUrl; + }, + isAmino(o: any): o is MsgChannelCloseConfirmResponseAmino { + return o && o.$typeUrl === MsgChannelCloseConfirmResponse.typeUrl; + }, encode(_: MsgChannelCloseConfirmResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -1975,7 +2121,8 @@ export const MsgChannelCloseConfirmResponse = { typeUrl: "/ibc.core.channel.v1.MsgChannelCloseConfirmResponse", value: MsgChannelCloseConfirmResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgRecvPacket(): MsgRecvPacket { return { @@ -1994,6 +2141,15 @@ function createBaseMsgRecvPacket(): MsgRecvPacket { export const MsgRecvPacket = { typeUrl: "/ibc.core.channel.v1.MsgRecvPacket", aminoType: "cosmos-sdk/MsgRecvPacket", + is(o: any): o is MsgRecvPacket { + return o && (o.$typeUrl === MsgRecvPacket.typeUrl || Packet.is(o.packet) && (o.proofCommitment instanceof Uint8Array || typeof o.proofCommitment === "string") && Height.is(o.proofHeight) && typeof o.signer === "string"); + }, + isSDK(o: any): o is MsgRecvPacketSDKType { + return o && (o.$typeUrl === MsgRecvPacket.typeUrl || Packet.isSDK(o.packet) && (o.proof_commitment instanceof Uint8Array || typeof o.proof_commitment === "string") && Height.isSDK(o.proof_height) && typeof o.signer === "string"); + }, + isAmino(o: any): o is MsgRecvPacketAmino { + return o && (o.$typeUrl === MsgRecvPacket.typeUrl || Packet.isAmino(o.packet) && (o.proof_commitment instanceof Uint8Array || typeof o.proof_commitment === "string") && Height.isAmino(o.proof_height) && typeof o.signer === "string"); + }, encode(message: MsgRecvPacket, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.packet !== undefined) { Packet.encode(message.packet, writer.uint32(10).fork()).ldelim(); @@ -2106,6 +2262,13 @@ export const MsgRecvPacket = { typeUrl: "/ibc.core.channel.v1.MsgRecvPacket", value: MsgRecvPacket.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgRecvPacket.typeUrl)) { + return; + } + Packet.registerTypeUrl(); + Height.registerTypeUrl(); } }; function createBaseMsgRecvPacketResponse(): MsgRecvPacketResponse { @@ -2120,6 +2283,15 @@ function createBaseMsgRecvPacketResponse(): MsgRecvPacketResponse { export const MsgRecvPacketResponse = { typeUrl: "/ibc.core.channel.v1.MsgRecvPacketResponse", aminoType: "cosmos-sdk/MsgRecvPacketResponse", + is(o: any): o is MsgRecvPacketResponse { + return o && o.$typeUrl === MsgRecvPacketResponse.typeUrl; + }, + isSDK(o: any): o is MsgRecvPacketResponseSDKType { + return o && o.$typeUrl === MsgRecvPacketResponse.typeUrl; + }, + isAmino(o: any): o is MsgRecvPacketResponseAmino { + return o && o.$typeUrl === MsgRecvPacketResponse.typeUrl; + }, encode(_: MsgRecvPacketResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -2171,7 +2343,8 @@ export const MsgRecvPacketResponse = { typeUrl: "/ibc.core.channel.v1.MsgRecvPacketResponse", value: MsgRecvPacketResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgTimeout(): MsgTimeout { return { @@ -2191,6 +2364,15 @@ function createBaseMsgTimeout(): MsgTimeout { export const MsgTimeout = { typeUrl: "/ibc.core.channel.v1.MsgTimeout", aminoType: "cosmos-sdk/MsgTimeout", + is(o: any): o is MsgTimeout { + return o && (o.$typeUrl === MsgTimeout.typeUrl || Packet.is(o.packet) && (o.proofUnreceived instanceof Uint8Array || typeof o.proofUnreceived === "string") && Height.is(o.proofHeight) && typeof o.nextSequenceRecv === "bigint" && typeof o.signer === "string"); + }, + isSDK(o: any): o is MsgTimeoutSDKType { + return o && (o.$typeUrl === MsgTimeout.typeUrl || Packet.isSDK(o.packet) && (o.proof_unreceived instanceof Uint8Array || typeof o.proof_unreceived === "string") && Height.isSDK(o.proof_height) && typeof o.next_sequence_recv === "bigint" && typeof o.signer === "string"); + }, + isAmino(o: any): o is MsgTimeoutAmino { + return o && (o.$typeUrl === MsgTimeout.typeUrl || Packet.isAmino(o.packet) && (o.proof_unreceived instanceof Uint8Array || typeof o.proof_unreceived === "string") && Height.isAmino(o.proof_height) && typeof o.next_sequence_recv === "bigint" && typeof o.signer === "string"); + }, encode(message: MsgTimeout, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.packet !== undefined) { Packet.encode(message.packet, writer.uint32(10).fork()).ldelim(); @@ -2319,6 +2501,13 @@ export const MsgTimeout = { typeUrl: "/ibc.core.channel.v1.MsgTimeout", value: MsgTimeout.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgTimeout.typeUrl)) { + return; + } + Packet.registerTypeUrl(); + Height.registerTypeUrl(); } }; function createBaseMsgTimeoutResponse(): MsgTimeoutResponse { @@ -2333,6 +2522,15 @@ function createBaseMsgTimeoutResponse(): MsgTimeoutResponse { export const MsgTimeoutResponse = { typeUrl: "/ibc.core.channel.v1.MsgTimeoutResponse", aminoType: "cosmos-sdk/MsgTimeoutResponse", + is(o: any): o is MsgTimeoutResponse { + return o && o.$typeUrl === MsgTimeoutResponse.typeUrl; + }, + isSDK(o: any): o is MsgTimeoutResponseSDKType { + return o && o.$typeUrl === MsgTimeoutResponse.typeUrl; + }, + isAmino(o: any): o is MsgTimeoutResponseAmino { + return o && o.$typeUrl === MsgTimeoutResponse.typeUrl; + }, encode(_: MsgTimeoutResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -2384,7 +2582,8 @@ export const MsgTimeoutResponse = { typeUrl: "/ibc.core.channel.v1.MsgTimeoutResponse", value: MsgTimeoutResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgTimeoutOnClose(): MsgTimeoutOnClose { return { @@ -2405,6 +2604,15 @@ function createBaseMsgTimeoutOnClose(): MsgTimeoutOnClose { export const MsgTimeoutOnClose = { typeUrl: "/ibc.core.channel.v1.MsgTimeoutOnClose", aminoType: "cosmos-sdk/MsgTimeoutOnClose", + is(o: any): o is MsgTimeoutOnClose { + return o && (o.$typeUrl === MsgTimeoutOnClose.typeUrl || Packet.is(o.packet) && (o.proofUnreceived instanceof Uint8Array || typeof o.proofUnreceived === "string") && (o.proofClose instanceof Uint8Array || typeof o.proofClose === "string") && Height.is(o.proofHeight) && typeof o.nextSequenceRecv === "bigint" && typeof o.signer === "string"); + }, + isSDK(o: any): o is MsgTimeoutOnCloseSDKType { + return o && (o.$typeUrl === MsgTimeoutOnClose.typeUrl || Packet.isSDK(o.packet) && (o.proof_unreceived instanceof Uint8Array || typeof o.proof_unreceived === "string") && (o.proof_close instanceof Uint8Array || typeof o.proof_close === "string") && Height.isSDK(o.proof_height) && typeof o.next_sequence_recv === "bigint" && typeof o.signer === "string"); + }, + isAmino(o: any): o is MsgTimeoutOnCloseAmino { + return o && (o.$typeUrl === MsgTimeoutOnClose.typeUrl || Packet.isAmino(o.packet) && (o.proof_unreceived instanceof Uint8Array || typeof o.proof_unreceived === "string") && (o.proof_close instanceof Uint8Array || typeof o.proof_close === "string") && Height.isAmino(o.proof_height) && typeof o.next_sequence_recv === "bigint" && typeof o.signer === "string"); + }, encode(message: MsgTimeoutOnClose, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.packet !== undefined) { Packet.encode(message.packet, writer.uint32(10).fork()).ldelim(); @@ -2547,6 +2755,13 @@ export const MsgTimeoutOnClose = { typeUrl: "/ibc.core.channel.v1.MsgTimeoutOnClose", value: MsgTimeoutOnClose.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgTimeoutOnClose.typeUrl)) { + return; + } + Packet.registerTypeUrl(); + Height.registerTypeUrl(); } }; function createBaseMsgTimeoutOnCloseResponse(): MsgTimeoutOnCloseResponse { @@ -2561,6 +2776,15 @@ function createBaseMsgTimeoutOnCloseResponse(): MsgTimeoutOnCloseResponse { export const MsgTimeoutOnCloseResponse = { typeUrl: "/ibc.core.channel.v1.MsgTimeoutOnCloseResponse", aminoType: "cosmos-sdk/MsgTimeoutOnCloseResponse", + is(o: any): o is MsgTimeoutOnCloseResponse { + return o && o.$typeUrl === MsgTimeoutOnCloseResponse.typeUrl; + }, + isSDK(o: any): o is MsgTimeoutOnCloseResponseSDKType { + return o && o.$typeUrl === MsgTimeoutOnCloseResponse.typeUrl; + }, + isAmino(o: any): o is MsgTimeoutOnCloseResponseAmino { + return o && o.$typeUrl === MsgTimeoutOnCloseResponse.typeUrl; + }, encode(_: MsgTimeoutOnCloseResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -2612,7 +2836,8 @@ export const MsgTimeoutOnCloseResponse = { typeUrl: "/ibc.core.channel.v1.MsgTimeoutOnCloseResponse", value: MsgTimeoutOnCloseResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgAcknowledgement(): MsgAcknowledgement { return { @@ -2632,6 +2857,15 @@ function createBaseMsgAcknowledgement(): MsgAcknowledgement { export const MsgAcknowledgement = { typeUrl: "/ibc.core.channel.v1.MsgAcknowledgement", aminoType: "cosmos-sdk/MsgAcknowledgement", + is(o: any): o is MsgAcknowledgement { + return o && (o.$typeUrl === MsgAcknowledgement.typeUrl || Packet.is(o.packet) && (o.acknowledgement instanceof Uint8Array || typeof o.acknowledgement === "string") && (o.proofAcked instanceof Uint8Array || typeof o.proofAcked === "string") && Height.is(o.proofHeight) && typeof o.signer === "string"); + }, + isSDK(o: any): o is MsgAcknowledgementSDKType { + return o && (o.$typeUrl === MsgAcknowledgement.typeUrl || Packet.isSDK(o.packet) && (o.acknowledgement instanceof Uint8Array || typeof o.acknowledgement === "string") && (o.proof_acked instanceof Uint8Array || typeof o.proof_acked === "string") && Height.isSDK(o.proof_height) && typeof o.signer === "string"); + }, + isAmino(o: any): o is MsgAcknowledgementAmino { + return o && (o.$typeUrl === MsgAcknowledgement.typeUrl || Packet.isAmino(o.packet) && (o.acknowledgement instanceof Uint8Array || typeof o.acknowledgement === "string") && (o.proof_acked instanceof Uint8Array || typeof o.proof_acked === "string") && Height.isAmino(o.proof_height) && typeof o.signer === "string"); + }, encode(message: MsgAcknowledgement, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.packet !== undefined) { Packet.encode(message.packet, writer.uint32(10).fork()).ldelim(); @@ -2758,6 +2992,13 @@ export const MsgAcknowledgement = { typeUrl: "/ibc.core.channel.v1.MsgAcknowledgement", value: MsgAcknowledgement.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgAcknowledgement.typeUrl)) { + return; + } + Packet.registerTypeUrl(); + Height.registerTypeUrl(); } }; function createBaseMsgAcknowledgementResponse(): MsgAcknowledgementResponse { @@ -2772,6 +3013,15 @@ function createBaseMsgAcknowledgementResponse(): MsgAcknowledgementResponse { export const MsgAcknowledgementResponse = { typeUrl: "/ibc.core.channel.v1.MsgAcknowledgementResponse", aminoType: "cosmos-sdk/MsgAcknowledgementResponse", + is(o: any): o is MsgAcknowledgementResponse { + return o && o.$typeUrl === MsgAcknowledgementResponse.typeUrl; + }, + isSDK(o: any): o is MsgAcknowledgementResponseSDKType { + return o && o.$typeUrl === MsgAcknowledgementResponse.typeUrl; + }, + isAmino(o: any): o is MsgAcknowledgementResponseAmino { + return o && o.$typeUrl === MsgAcknowledgementResponse.typeUrl; + }, encode(_: MsgAcknowledgementResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -2823,5 +3073,6 @@ export const MsgAcknowledgementResponse = { typeUrl: "/ibc.core.channel.v1.MsgAcknowledgementResponse", value: MsgAcknowledgementResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/ibc/core/client/v1/client.ts b/__fixtures__/v-next/outputv3/ibc/core/client/v1/client.ts index d8f4c230e8..404c2f9e6a 100644 --- a/__fixtures__/v-next/outputv3/ibc/core/client/v1/client.ts +++ b/__fixtures__/v-next/outputv3/ibc/core/client/v1/client.ts @@ -1,6 +1,7 @@ import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../../google/protobuf/any"; import { Plan, PlanAmino, PlanSDKType } from "../../../../cosmos/upgrade/v1beta1/upgrade"; import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { GlobalDecoderRegistry } from "../../../../registry"; import { isSet, DeepPartial } from "../../../../helpers"; export const protobufPackage = "ibc.core.client.v1"; /** @@ -414,6 +415,15 @@ function createBaseIdentifiedClientState(): IdentifiedClientState { export const IdentifiedClientState = { typeUrl: "/ibc.core.client.v1.IdentifiedClientState", aminoType: "cosmos-sdk/IdentifiedClientState", + is(o: any): o is IdentifiedClientState { + return o && (o.$typeUrl === IdentifiedClientState.typeUrl || typeof o.clientId === "string"); + }, + isSDK(o: any): o is IdentifiedClientStateSDKType { + return o && (o.$typeUrl === IdentifiedClientState.typeUrl || typeof o.client_id === "string"); + }, + isAmino(o: any): o is IdentifiedClientStateAmino { + return o && (o.$typeUrl === IdentifiedClientState.typeUrl || typeof o.client_id === "string"); + }, encode(message: IdentifiedClientState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.clientId !== "") { writer.uint32(10).string(message.clientId); @@ -496,7 +506,8 @@ export const IdentifiedClientState = { typeUrl: "/ibc.core.client.v1.IdentifiedClientState", value: IdentifiedClientState.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseConsensusStateWithHeight(): ConsensusStateWithHeight { return { @@ -514,6 +525,15 @@ function createBaseConsensusStateWithHeight(): ConsensusStateWithHeight { export const ConsensusStateWithHeight = { typeUrl: "/ibc.core.client.v1.ConsensusStateWithHeight", aminoType: "cosmos-sdk/ConsensusStateWithHeight", + is(o: any): o is ConsensusStateWithHeight { + return o && (o.$typeUrl === ConsensusStateWithHeight.typeUrl || Height.is(o.height)); + }, + isSDK(o: any): o is ConsensusStateWithHeightSDKType { + return o && (o.$typeUrl === ConsensusStateWithHeight.typeUrl || Height.isSDK(o.height)); + }, + isAmino(o: any): o is ConsensusStateWithHeightAmino { + return o && (o.$typeUrl === ConsensusStateWithHeight.typeUrl || Height.isAmino(o.height)); + }, encode(message: ConsensusStateWithHeight, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.height !== undefined) { Height.encode(message.height, writer.uint32(10).fork()).ldelim(); @@ -598,7 +618,8 @@ export const ConsensusStateWithHeight = { typeUrl: "/ibc.core.client.v1.ConsensusStateWithHeight", value: ConsensusStateWithHeight.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseClientConsensusStates(): ClientConsensusStates { return { @@ -616,6 +637,15 @@ function createBaseClientConsensusStates(): ClientConsensusStates { export const ClientConsensusStates = { typeUrl: "/ibc.core.client.v1.ClientConsensusStates", aminoType: "cosmos-sdk/ClientConsensusStates", + is(o: any): o is ClientConsensusStates { + return o && (o.$typeUrl === ClientConsensusStates.typeUrl || typeof o.clientId === "string" && Array.isArray(o.consensusStates) && (!o.consensusStates.length || ConsensusStateWithHeight.is(o.consensusStates[0]))); + }, + isSDK(o: any): o is ClientConsensusStatesSDKType { + return o && (o.$typeUrl === ClientConsensusStates.typeUrl || typeof o.client_id === "string" && Array.isArray(o.consensus_states) && (!o.consensus_states.length || ConsensusStateWithHeight.isSDK(o.consensus_states[0]))); + }, + isAmino(o: any): o is ClientConsensusStatesAmino { + return o && (o.$typeUrl === ClientConsensusStates.typeUrl || typeof o.client_id === "string" && Array.isArray(o.consensus_states) && (!o.consensus_states.length || ConsensusStateWithHeight.isAmino(o.consensus_states[0]))); + }, encode(message: ClientConsensusStates, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.clientId !== "") { writer.uint32(10).string(message.clientId); @@ -702,6 +732,12 @@ export const ClientConsensusStates = { typeUrl: "/ibc.core.client.v1.ClientConsensusStates", value: ClientConsensusStates.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ClientConsensusStates.typeUrl)) { + return; + } + ConsensusStateWithHeight.registerTypeUrl(); } }; function createBaseClientUpdateProposal(): ClientUpdateProposal { @@ -725,6 +761,15 @@ function createBaseClientUpdateProposal(): ClientUpdateProposal { export const ClientUpdateProposal = { typeUrl: "/ibc.core.client.v1.ClientUpdateProposal", aminoType: "cosmos-sdk/ClientUpdateProposal", + is(o: any): o is ClientUpdateProposal { + return o && (o.$typeUrl === ClientUpdateProposal.typeUrl || typeof o.title === "string" && typeof o.description === "string" && typeof o.subjectClientId === "string" && typeof o.substituteClientId === "string"); + }, + isSDK(o: any): o is ClientUpdateProposalSDKType { + return o && (o.$typeUrl === ClientUpdateProposal.typeUrl || typeof o.title === "string" && typeof o.description === "string" && typeof o.subject_client_id === "string" && typeof o.substitute_client_id === "string"); + }, + isAmino(o: any): o is ClientUpdateProposalAmino { + return o && (o.$typeUrl === ClientUpdateProposal.typeUrl || typeof o.title === "string" && typeof o.description === "string" && typeof o.subject_client_id === "string" && typeof o.substitute_client_id === "string"); + }, encode(message: ClientUpdateProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.title !== "") { writer.uint32(10).string(message.title); @@ -833,6 +878,13 @@ export const ClientUpdateProposal = { typeUrl: "/ibc.core.client.v1.ClientUpdateProposal", value: ClientUpdateProposal.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ClientUpdateProposal.typeUrl)) { + return; + } + GlobalDecoderRegistry.register(ClientUpdateProposal.typeUrl, ClientUpdateProposal); + GlobalDecoderRegistry.registerAminoProtoMapping(ClientUpdateProposal.aminoType, ClientUpdateProposal.typeUrl); } }; function createBaseUpgradeProposal(): UpgradeProposal { @@ -854,6 +906,15 @@ function createBaseUpgradeProposal(): UpgradeProposal { export const UpgradeProposal = { typeUrl: "/ibc.core.client.v1.UpgradeProposal", aminoType: "cosmos-sdk/UpgradeProposal", + is(o: any): o is UpgradeProposal { + return o && (o.$typeUrl === UpgradeProposal.typeUrl || typeof o.title === "string" && typeof o.description === "string" && Plan.is(o.plan)); + }, + isSDK(o: any): o is UpgradeProposalSDKType { + return o && (o.$typeUrl === UpgradeProposal.typeUrl || typeof o.title === "string" && typeof o.description === "string" && Plan.isSDK(o.plan)); + }, + isAmino(o: any): o is UpgradeProposalAmino { + return o && (o.$typeUrl === UpgradeProposal.typeUrl || typeof o.title === "string" && typeof o.description === "string" && Plan.isAmino(o.plan)); + }, encode(message: UpgradeProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.title !== "") { writer.uint32(10).string(message.title); @@ -966,6 +1027,13 @@ export const UpgradeProposal = { typeUrl: "/ibc.core.client.v1.UpgradeProposal", value: UpgradeProposal.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(UpgradeProposal.typeUrl)) { + return; + } + GlobalDecoderRegistry.register(UpgradeProposal.typeUrl, UpgradeProposal); + GlobalDecoderRegistry.registerAminoProtoMapping(UpgradeProposal.aminoType, UpgradeProposal.typeUrl); } }; function createBaseHeight(): Height { @@ -992,6 +1060,15 @@ function createBaseHeight(): Height { export const Height = { typeUrl: "/ibc.core.client.v1.Height", aminoType: "cosmos-sdk/Height", + is(o: any): o is Height { + return o && (o.$typeUrl === Height.typeUrl || typeof o.revisionNumber === "bigint" && typeof o.revisionHeight === "bigint"); + }, + isSDK(o: any): o is HeightSDKType { + return o && (o.$typeUrl === Height.typeUrl || typeof o.revision_number === "bigint" && typeof o.revision_height === "bigint"); + }, + isAmino(o: any): o is HeightAmino { + return o && (o.$typeUrl === Height.typeUrl || typeof o.revision_number === "bigint" && typeof o.revision_height === "bigint"); + }, encode(message: Height, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.revisionNumber !== BigInt(0)) { writer.uint32(8).uint64(message.revisionNumber); @@ -1072,7 +1149,8 @@ export const Height = { typeUrl: "/ibc.core.client.v1.Height", value: Height.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseParams(): Params { return { @@ -1088,6 +1166,15 @@ function createBaseParams(): Params { export const Params = { typeUrl: "/ibc.core.client.v1.Params", aminoType: "cosmos-sdk/Params", + is(o: any): o is Params { + return o && (o.$typeUrl === Params.typeUrl || Array.isArray(o.allowedClients) && (!o.allowedClients.length || typeof o.allowedClients[0] === "string")); + }, + isSDK(o: any): o is ParamsSDKType { + return o && (o.$typeUrl === Params.typeUrl || Array.isArray(o.allowed_clients) && (!o.allowed_clients.length || typeof o.allowed_clients[0] === "string")); + }, + isAmino(o: any): o is ParamsAmino { + return o && (o.$typeUrl === Params.typeUrl || Array.isArray(o.allowed_clients) && (!o.allowed_clients.length || typeof o.allowed_clients[0] === "string")); + }, encode(message: Params, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.allowedClients) { writer.uint32(10).string(v!); @@ -1160,5 +1247,6 @@ export const Params = { typeUrl: "/ibc.core.client.v1.Params", value: Params.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/ibc/core/client/v1/genesis.ts b/__fixtures__/v-next/outputv3/ibc/core/client/v1/genesis.ts index c40ce9f216..4e037c242b 100644 --- a/__fixtures__/v-next/outputv3/ibc/core/client/v1/genesis.ts +++ b/__fixtures__/v-next/outputv3/ibc/core/client/v1/genesis.ts @@ -1,5 +1,6 @@ import { IdentifiedClientState, IdentifiedClientStateAmino, IdentifiedClientStateSDKType, ClientConsensusStates, ClientConsensusStatesAmino, ClientConsensusStatesSDKType, Params, ParamsAmino, ParamsSDKType } from "./client"; import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { GlobalDecoderRegistry } from "../../../../registry"; import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../../helpers"; export const protobufPackage = "ibc.core.client.v1"; /** @@ -183,6 +184,15 @@ function createBaseGenesisState(): GenesisState { export const GenesisState = { typeUrl: "/ibc.core.client.v1.GenesisState", aminoType: "cosmos-sdk/GenesisState", + is(o: any): o is GenesisState { + return o && (o.$typeUrl === GenesisState.typeUrl || Array.isArray(o.clients) && (!o.clients.length || IdentifiedClientState.is(o.clients[0])) && Array.isArray(o.clientsConsensus) && (!o.clientsConsensus.length || ClientConsensusStates.is(o.clientsConsensus[0])) && Array.isArray(o.clientsMetadata) && (!o.clientsMetadata.length || IdentifiedGenesisMetadata.is(o.clientsMetadata[0])) && Params.is(o.params) && typeof o.createLocalhost === "boolean" && typeof o.nextClientSequence === "bigint"); + }, + isSDK(o: any): o is GenesisStateSDKType { + return o && (o.$typeUrl === GenesisState.typeUrl || Array.isArray(o.clients) && (!o.clients.length || IdentifiedClientState.isSDK(o.clients[0])) && Array.isArray(o.clients_consensus) && (!o.clients_consensus.length || ClientConsensusStates.isSDK(o.clients_consensus[0])) && Array.isArray(o.clients_metadata) && (!o.clients_metadata.length || IdentifiedGenesisMetadata.isSDK(o.clients_metadata[0])) && Params.isSDK(o.params) && typeof o.create_localhost === "boolean" && typeof o.next_client_sequence === "bigint"); + }, + isAmino(o: any): o is GenesisStateAmino { + return o && (o.$typeUrl === GenesisState.typeUrl || Array.isArray(o.clients) && (!o.clients.length || IdentifiedClientState.isAmino(o.clients[0])) && Array.isArray(o.clients_consensus) && (!o.clients_consensus.length || ClientConsensusStates.isAmino(o.clients_consensus[0])) && Array.isArray(o.clients_metadata) && (!o.clients_metadata.length || IdentifiedGenesisMetadata.isAmino(o.clients_metadata[0])) && Params.isAmino(o.params) && typeof o.create_localhost === "boolean" && typeof o.next_client_sequence === "bigint"); + }, encode(message: GenesisState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.clients) { IdentifiedClientState.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -341,6 +351,15 @@ export const GenesisState = { typeUrl: "/ibc.core.client.v1.GenesisState", value: GenesisState.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GenesisState.typeUrl)) { + return; + } + IdentifiedClientState.registerTypeUrl(); + ClientConsensusStates.registerTypeUrl(); + IdentifiedGenesisMetadata.registerTypeUrl(); + Params.registerTypeUrl(); } }; function createBaseGenesisMetadata(): GenesisMetadata { @@ -359,6 +378,15 @@ function createBaseGenesisMetadata(): GenesisMetadata { export const GenesisMetadata = { typeUrl: "/ibc.core.client.v1.GenesisMetadata", aminoType: "cosmos-sdk/GenesisMetadata", + is(o: any): o is GenesisMetadata { + return o && (o.$typeUrl === GenesisMetadata.typeUrl || (o.key instanceof Uint8Array || typeof o.key === "string") && (o.value instanceof Uint8Array || typeof o.value === "string")); + }, + isSDK(o: any): o is GenesisMetadataSDKType { + return o && (o.$typeUrl === GenesisMetadata.typeUrl || (o.key instanceof Uint8Array || typeof o.key === "string") && (o.value instanceof Uint8Array || typeof o.value === "string")); + }, + isAmino(o: any): o is GenesisMetadataAmino { + return o && (o.$typeUrl === GenesisMetadata.typeUrl || (o.key instanceof Uint8Array || typeof o.key === "string") && (o.value instanceof Uint8Array || typeof o.value === "string")); + }, encode(message: GenesisMetadata, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.key.length !== 0) { writer.uint32(10).bytes(message.key); @@ -439,7 +467,8 @@ export const GenesisMetadata = { typeUrl: "/ibc.core.client.v1.GenesisMetadata", value: GenesisMetadata.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseIdentifiedGenesisMetadata(): IdentifiedGenesisMetadata { return { @@ -457,6 +486,15 @@ function createBaseIdentifiedGenesisMetadata(): IdentifiedGenesisMetadata { export const IdentifiedGenesisMetadata = { typeUrl: "/ibc.core.client.v1.IdentifiedGenesisMetadata", aminoType: "cosmos-sdk/IdentifiedGenesisMetadata", + is(o: any): o is IdentifiedGenesisMetadata { + return o && (o.$typeUrl === IdentifiedGenesisMetadata.typeUrl || typeof o.clientId === "string" && Array.isArray(o.clientMetadata) && (!o.clientMetadata.length || GenesisMetadata.is(o.clientMetadata[0]))); + }, + isSDK(o: any): o is IdentifiedGenesisMetadataSDKType { + return o && (o.$typeUrl === IdentifiedGenesisMetadata.typeUrl || typeof o.client_id === "string" && Array.isArray(o.client_metadata) && (!o.client_metadata.length || GenesisMetadata.isSDK(o.client_metadata[0]))); + }, + isAmino(o: any): o is IdentifiedGenesisMetadataAmino { + return o && (o.$typeUrl === IdentifiedGenesisMetadata.typeUrl || typeof o.client_id === "string" && Array.isArray(o.client_metadata) && (!o.client_metadata.length || GenesisMetadata.isAmino(o.client_metadata[0]))); + }, encode(message: IdentifiedGenesisMetadata, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.clientId !== "") { writer.uint32(10).string(message.clientId); @@ -543,5 +581,11 @@ export const IdentifiedGenesisMetadata = { typeUrl: "/ibc.core.client.v1.IdentifiedGenesisMetadata", value: IdentifiedGenesisMetadata.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(IdentifiedGenesisMetadata.typeUrl)) { + return; + } + GenesisMetadata.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/ibc/core/client/v1/query.rpc.func.ts b/__fixtures__/v-next/outputv3/ibc/core/client/v1/query.rpc.func.ts new file mode 100644 index 0000000000..484317b308 --- /dev/null +++ b/__fixtures__/v-next/outputv3/ibc/core/client/v1/query.rpc.func.ts @@ -0,0 +1,111 @@ +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../../cosmos/base/query/v1beta1/pagination"; +import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../../google/protobuf/any"; +import { Height, HeightSDKType, IdentifiedClientState, IdentifiedClientStateSDKType, ConsensusStateWithHeight, ConsensusStateWithHeightSDKType, Params, ParamsSDKType } from "./client"; +import { EndpointOrRpc, buildQuery } from "../../../../helper-func-types"; +import { QueryClientStateRequest, QueryClientStateRequestSDKType, QueryClientStateResponse, QueryClientStateResponseSDKType, QueryClientStatesRequest, QueryClientStatesRequestSDKType, QueryClientStatesResponse, QueryClientStatesResponseSDKType, QueryConsensusStateRequest, QueryConsensusStateRequestSDKType, QueryConsensusStateResponse, QueryConsensusStateResponseSDKType, QueryConsensusStatesRequest, QueryConsensusStatesRequestSDKType, QueryConsensusStatesResponse, QueryConsensusStatesResponseSDKType, QueryClientStatusRequest, QueryClientStatusRequestSDKType, QueryClientStatusResponse, QueryClientStatusResponseSDKType, QueryClientParamsRequest, QueryClientParamsRequestSDKType, QueryClientParamsResponse, QueryClientParamsResponseSDKType, QueryUpgradedClientStateRequest, QueryUpgradedClientStateRequestSDKType, QueryUpgradedClientStateResponse, QueryUpgradedClientStateResponseSDKType, QueryUpgradedConsensusStateRequest, QueryUpgradedConsensusStateRequestSDKType, QueryUpgradedConsensusStateResponse, QueryUpgradedConsensusStateResponseSDKType } from "./query"; +/** + * ClientState queries an IBC light client. + * @name getClientState + * @package ibc.core.client.v1 + * @see proto service: ibc.core.client.v1.ClientState + */ +export const getClientState = buildQuery({ + encode: QueryClientStateRequest.encode, + decode: QueryClientStateResponse.decode, + service: "ibc.core.client.v1.Query", + method: "ClientState", + deps: [QueryClientStateRequest, QueryClientStateResponse] +}); +/** + * ClientStates queries all the IBC light clients of a chain. + * @name getClientStates + * @package ibc.core.client.v1 + * @see proto service: ibc.core.client.v1.ClientStates + */ +export const getClientStates = buildQuery({ + encode: QueryClientStatesRequest.encode, + decode: QueryClientStatesResponse.decode, + service: "ibc.core.client.v1.Query", + method: "ClientStates", + deps: [QueryClientStatesRequest, QueryClientStatesResponse] +}); +/** + * ConsensusState queries a consensus state associated with a client state at + * a given height. + * @name getConsensusState + * @package ibc.core.client.v1 + * @see proto service: ibc.core.client.v1.ConsensusState + */ +export const getConsensusState = buildQuery({ + encode: QueryConsensusStateRequest.encode, + decode: QueryConsensusStateResponse.decode, + service: "ibc.core.client.v1.Query", + method: "ConsensusState", + deps: [QueryConsensusStateRequest, QueryConsensusStateResponse] +}); +/** + * ConsensusStates queries all the consensus state associated with a given + * client. + * @name getConsensusStates + * @package ibc.core.client.v1 + * @see proto service: ibc.core.client.v1.ConsensusStates + */ +export const getConsensusStates = buildQuery({ + encode: QueryConsensusStatesRequest.encode, + decode: QueryConsensusStatesResponse.decode, + service: "ibc.core.client.v1.Query", + method: "ConsensusStates", + deps: [QueryConsensusStatesRequest, QueryConsensusStatesResponse] +}); +/** + * Status queries the status of an IBC client. + * @name getClientStatus + * @package ibc.core.client.v1 + * @see proto service: ibc.core.client.v1.ClientStatus + */ +export const getClientStatus = buildQuery({ + encode: QueryClientStatusRequest.encode, + decode: QueryClientStatusResponse.decode, + service: "ibc.core.client.v1.Query", + method: "ClientStatus", + deps: [QueryClientStatusRequest, QueryClientStatusResponse] +}); +/** + * ClientParams queries all parameters of the ibc client. + * @name getClientParams + * @package ibc.core.client.v1 + * @see proto service: ibc.core.client.v1.ClientParams + */ +export const getClientParams = buildQuery({ + encode: QueryClientParamsRequest.encode, + decode: QueryClientParamsResponse.decode, + service: "ibc.core.client.v1.Query", + method: "ClientParams", + deps: [QueryClientParamsRequest, QueryClientParamsResponse] +}); +/** + * UpgradedClientState queries an Upgraded IBC light client. + * @name getUpgradedClientState + * @package ibc.core.client.v1 + * @see proto service: ibc.core.client.v1.UpgradedClientState + */ +export const getUpgradedClientState = buildQuery({ + encode: QueryUpgradedClientStateRequest.encode, + decode: QueryUpgradedClientStateResponse.decode, + service: "ibc.core.client.v1.Query", + method: "UpgradedClientState", + deps: [QueryUpgradedClientStateRequest, QueryUpgradedClientStateResponse] +}); +/** + * UpgradedConsensusState queries an Upgraded IBC consensus state. + * @name getUpgradedConsensusState + * @package ibc.core.client.v1 + * @see proto service: ibc.core.client.v1.UpgradedConsensusState + */ +export const getUpgradedConsensusState = buildQuery({ + encode: QueryUpgradedConsensusStateRequest.encode, + decode: QueryUpgradedConsensusStateResponse.decode, + service: "ibc.core.client.v1.Query", + method: "UpgradedConsensusState", + deps: [QueryUpgradedConsensusStateRequest, QueryUpgradedConsensusStateResponse] +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/ibc/core/client/v1/query.ts b/__fixtures__/v-next/outputv3/ibc/core/client/v1/query.ts index 680a3fd11d..bca4440df2 100644 --- a/__fixtures__/v-next/outputv3/ibc/core/client/v1/query.ts +++ b/__fixtures__/v-next/outputv3/ibc/core/client/v1/query.ts @@ -3,6 +3,7 @@ import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../../google/proto import { Height, HeightAmino, HeightSDKType, IdentifiedClientState, IdentifiedClientStateAmino, IdentifiedClientStateSDKType, ConsensusStateWithHeight, ConsensusStateWithHeightAmino, ConsensusStateWithHeightSDKType, Params, ParamsAmino, ParamsSDKType } from "./client"; import { BinaryReader, BinaryWriter } from "../../../../binary"; import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../../helpers"; +import { GlobalDecoderRegistry } from "../../../../registry"; export const protobufPackage = "ibc.core.client.v1"; /** * QueryClientStateRequest is the request type for the Query/ClientState RPC @@ -715,6 +716,15 @@ function createBaseQueryClientStateRequest(): QueryClientStateRequest { export const QueryClientStateRequest = { typeUrl: "/ibc.core.client.v1.QueryClientStateRequest", aminoType: "cosmos-sdk/QueryClientStateRequest", + is(o: any): o is QueryClientStateRequest { + return o && (o.$typeUrl === QueryClientStateRequest.typeUrl || typeof o.clientId === "string"); + }, + isSDK(o: any): o is QueryClientStateRequestSDKType { + return o && (o.$typeUrl === QueryClientStateRequest.typeUrl || typeof o.client_id === "string"); + }, + isAmino(o: any): o is QueryClientStateRequestAmino { + return o && (o.$typeUrl === QueryClientStateRequest.typeUrl || typeof o.client_id === "string"); + }, encode(message: QueryClientStateRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.clientId !== "") { writer.uint32(10).string(message.clientId); @@ -781,7 +791,8 @@ export const QueryClientStateRequest = { typeUrl: "/ibc.core.client.v1.QueryClientStateRequest", value: QueryClientStateRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryClientStateResponse(): QueryClientStateResponse { return { @@ -801,6 +812,15 @@ function createBaseQueryClientStateResponse(): QueryClientStateResponse { export const QueryClientStateResponse = { typeUrl: "/ibc.core.client.v1.QueryClientStateResponse", aminoType: "cosmos-sdk/QueryClientStateResponse", + is(o: any): o is QueryClientStateResponse { + return o && (o.$typeUrl === QueryClientStateResponse.typeUrl || (o.proof instanceof Uint8Array || typeof o.proof === "string") && Height.is(o.proofHeight)); + }, + isSDK(o: any): o is QueryClientStateResponseSDKType { + return o && (o.$typeUrl === QueryClientStateResponse.typeUrl || (o.proof instanceof Uint8Array || typeof o.proof === "string") && Height.isSDK(o.proof_height)); + }, + isAmino(o: any): o is QueryClientStateResponseAmino { + return o && (o.$typeUrl === QueryClientStateResponse.typeUrl || (o.proof instanceof Uint8Array || typeof o.proof === "string") && Height.isAmino(o.proof_height)); + }, encode(message: QueryClientStateResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.clientState !== undefined) { Any.encode(message.clientState, writer.uint32(10).fork()).ldelim(); @@ -899,6 +919,12 @@ export const QueryClientStateResponse = { typeUrl: "/ibc.core.client.v1.QueryClientStateResponse", value: QueryClientStateResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryClientStateResponse.typeUrl)) { + return; + } + Height.registerTypeUrl(); } }; function createBaseQueryClientStatesRequest(): QueryClientStatesRequest { @@ -916,6 +942,15 @@ function createBaseQueryClientStatesRequest(): QueryClientStatesRequest { export const QueryClientStatesRequest = { typeUrl: "/ibc.core.client.v1.QueryClientStatesRequest", aminoType: "cosmos-sdk/QueryClientStatesRequest", + is(o: any): o is QueryClientStatesRequest { + return o && o.$typeUrl === QueryClientStatesRequest.typeUrl; + }, + isSDK(o: any): o is QueryClientStatesRequestSDKType { + return o && o.$typeUrl === QueryClientStatesRequest.typeUrl; + }, + isAmino(o: any): o is QueryClientStatesRequestAmino { + return o && o.$typeUrl === QueryClientStatesRequest.typeUrl; + }, encode(message: QueryClientStatesRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.pagination !== undefined) { PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); @@ -984,6 +1019,12 @@ export const QueryClientStatesRequest = { typeUrl: "/ibc.core.client.v1.QueryClientStatesRequest", value: QueryClientStatesRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryClientStatesRequest.typeUrl)) { + return; + } + PageRequest.registerTypeUrl(); } }; function createBaseQueryClientStatesResponse(): QueryClientStatesResponse { @@ -1002,6 +1043,15 @@ function createBaseQueryClientStatesResponse(): QueryClientStatesResponse { export const QueryClientStatesResponse = { typeUrl: "/ibc.core.client.v1.QueryClientStatesResponse", aminoType: "cosmos-sdk/QueryClientStatesResponse", + is(o: any): o is QueryClientStatesResponse { + return o && (o.$typeUrl === QueryClientStatesResponse.typeUrl || Array.isArray(o.clientStates) && (!o.clientStates.length || IdentifiedClientState.is(o.clientStates[0]))); + }, + isSDK(o: any): o is QueryClientStatesResponseSDKType { + return o && (o.$typeUrl === QueryClientStatesResponse.typeUrl || Array.isArray(o.client_states) && (!o.client_states.length || IdentifiedClientState.isSDK(o.client_states[0]))); + }, + isAmino(o: any): o is QueryClientStatesResponseAmino { + return o && (o.$typeUrl === QueryClientStatesResponse.typeUrl || Array.isArray(o.client_states) && (!o.client_states.length || IdentifiedClientState.isAmino(o.client_states[0]))); + }, encode(message: QueryClientStatesResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.clientStates) { IdentifiedClientState.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -1090,6 +1140,13 @@ export const QueryClientStatesResponse = { typeUrl: "/ibc.core.client.v1.QueryClientStatesResponse", value: QueryClientStatesResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryClientStatesResponse.typeUrl)) { + return; + } + IdentifiedClientState.registerTypeUrl(); + PageResponse.registerTypeUrl(); } }; function createBaseQueryConsensusStateRequest(): QueryConsensusStateRequest { @@ -1111,6 +1168,15 @@ function createBaseQueryConsensusStateRequest(): QueryConsensusStateRequest { export const QueryConsensusStateRequest = { typeUrl: "/ibc.core.client.v1.QueryConsensusStateRequest", aminoType: "cosmos-sdk/QueryConsensusStateRequest", + is(o: any): o is QueryConsensusStateRequest { + return o && (o.$typeUrl === QueryConsensusStateRequest.typeUrl || typeof o.clientId === "string" && typeof o.revisionNumber === "bigint" && typeof o.revisionHeight === "bigint" && typeof o.latestHeight === "boolean"); + }, + isSDK(o: any): o is QueryConsensusStateRequestSDKType { + return o && (o.$typeUrl === QueryConsensusStateRequest.typeUrl || typeof o.client_id === "string" && typeof o.revision_number === "bigint" && typeof o.revision_height === "bigint" && typeof o.latest_height === "boolean"); + }, + isAmino(o: any): o is QueryConsensusStateRequestAmino { + return o && (o.$typeUrl === QueryConsensusStateRequest.typeUrl || typeof o.client_id === "string" && typeof o.revision_number === "bigint" && typeof o.revision_height === "bigint" && typeof o.latest_height === "boolean"); + }, encode(message: QueryConsensusStateRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.clientId !== "") { writer.uint32(10).string(message.clientId); @@ -1223,7 +1289,8 @@ export const QueryConsensusStateRequest = { typeUrl: "/ibc.core.client.v1.QueryConsensusStateRequest", value: QueryConsensusStateRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryConsensusStateResponse(): QueryConsensusStateResponse { return { @@ -1242,6 +1309,15 @@ function createBaseQueryConsensusStateResponse(): QueryConsensusStateResponse { export const QueryConsensusStateResponse = { typeUrl: "/ibc.core.client.v1.QueryConsensusStateResponse", aminoType: "cosmos-sdk/QueryConsensusStateResponse", + is(o: any): o is QueryConsensusStateResponse { + return o && (o.$typeUrl === QueryConsensusStateResponse.typeUrl || (o.proof instanceof Uint8Array || typeof o.proof === "string") && Height.is(o.proofHeight)); + }, + isSDK(o: any): o is QueryConsensusStateResponseSDKType { + return o && (o.$typeUrl === QueryConsensusStateResponse.typeUrl || (o.proof instanceof Uint8Array || typeof o.proof === "string") && Height.isSDK(o.proof_height)); + }, + isAmino(o: any): o is QueryConsensusStateResponseAmino { + return o && (o.$typeUrl === QueryConsensusStateResponse.typeUrl || (o.proof instanceof Uint8Array || typeof o.proof === "string") && Height.isAmino(o.proof_height)); + }, encode(message: QueryConsensusStateResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.consensusState !== undefined) { Any.encode(message.consensusState, writer.uint32(10).fork()).ldelim(); @@ -1340,6 +1416,12 @@ export const QueryConsensusStateResponse = { typeUrl: "/ibc.core.client.v1.QueryConsensusStateResponse", value: QueryConsensusStateResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryConsensusStateResponse.typeUrl)) { + return; + } + Height.registerTypeUrl(); } }; function createBaseQueryConsensusStatesRequest(): QueryConsensusStatesRequest { @@ -1358,6 +1440,15 @@ function createBaseQueryConsensusStatesRequest(): QueryConsensusStatesRequest { export const QueryConsensusStatesRequest = { typeUrl: "/ibc.core.client.v1.QueryConsensusStatesRequest", aminoType: "cosmos-sdk/QueryConsensusStatesRequest", + is(o: any): o is QueryConsensusStatesRequest { + return o && (o.$typeUrl === QueryConsensusStatesRequest.typeUrl || typeof o.clientId === "string"); + }, + isSDK(o: any): o is QueryConsensusStatesRequestSDKType { + return o && (o.$typeUrl === QueryConsensusStatesRequest.typeUrl || typeof o.client_id === "string"); + }, + isAmino(o: any): o is QueryConsensusStatesRequestAmino { + return o && (o.$typeUrl === QueryConsensusStatesRequest.typeUrl || typeof o.client_id === "string"); + }, encode(message: QueryConsensusStatesRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.clientId !== "") { writer.uint32(10).string(message.clientId); @@ -1440,6 +1531,12 @@ export const QueryConsensusStatesRequest = { typeUrl: "/ibc.core.client.v1.QueryConsensusStatesRequest", value: QueryConsensusStatesRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryConsensusStatesRequest.typeUrl)) { + return; + } + PageRequest.registerTypeUrl(); } }; function createBaseQueryConsensusStatesResponse(): QueryConsensusStatesResponse { @@ -1458,6 +1555,15 @@ function createBaseQueryConsensusStatesResponse(): QueryConsensusStatesResponse export const QueryConsensusStatesResponse = { typeUrl: "/ibc.core.client.v1.QueryConsensusStatesResponse", aminoType: "cosmos-sdk/QueryConsensusStatesResponse", + is(o: any): o is QueryConsensusStatesResponse { + return o && (o.$typeUrl === QueryConsensusStatesResponse.typeUrl || Array.isArray(o.consensusStates) && (!o.consensusStates.length || ConsensusStateWithHeight.is(o.consensusStates[0]))); + }, + isSDK(o: any): o is QueryConsensusStatesResponseSDKType { + return o && (o.$typeUrl === QueryConsensusStatesResponse.typeUrl || Array.isArray(o.consensus_states) && (!o.consensus_states.length || ConsensusStateWithHeight.isSDK(o.consensus_states[0]))); + }, + isAmino(o: any): o is QueryConsensusStatesResponseAmino { + return o && (o.$typeUrl === QueryConsensusStatesResponse.typeUrl || Array.isArray(o.consensus_states) && (!o.consensus_states.length || ConsensusStateWithHeight.isAmino(o.consensus_states[0]))); + }, encode(message: QueryConsensusStatesResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.consensusStates) { ConsensusStateWithHeight.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -1546,6 +1652,13 @@ export const QueryConsensusStatesResponse = { typeUrl: "/ibc.core.client.v1.QueryConsensusStatesResponse", value: QueryConsensusStatesResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryConsensusStatesResponse.typeUrl)) { + return; + } + ConsensusStateWithHeight.registerTypeUrl(); + PageResponse.registerTypeUrl(); } }; function createBaseQueryClientStatusRequest(): QueryClientStatusRequest { @@ -1563,6 +1676,15 @@ function createBaseQueryClientStatusRequest(): QueryClientStatusRequest { export const QueryClientStatusRequest = { typeUrl: "/ibc.core.client.v1.QueryClientStatusRequest", aminoType: "cosmos-sdk/QueryClientStatusRequest", + is(o: any): o is QueryClientStatusRequest { + return o && (o.$typeUrl === QueryClientStatusRequest.typeUrl || typeof o.clientId === "string"); + }, + isSDK(o: any): o is QueryClientStatusRequestSDKType { + return o && (o.$typeUrl === QueryClientStatusRequest.typeUrl || typeof o.client_id === "string"); + }, + isAmino(o: any): o is QueryClientStatusRequestAmino { + return o && (o.$typeUrl === QueryClientStatusRequest.typeUrl || typeof o.client_id === "string"); + }, encode(message: QueryClientStatusRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.clientId !== "") { writer.uint32(10).string(message.clientId); @@ -1629,7 +1751,8 @@ export const QueryClientStatusRequest = { typeUrl: "/ibc.core.client.v1.QueryClientStatusRequest", value: QueryClientStatusRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryClientStatusResponse(): QueryClientStatusResponse { return { @@ -1646,6 +1769,15 @@ function createBaseQueryClientStatusResponse(): QueryClientStatusResponse { export const QueryClientStatusResponse = { typeUrl: "/ibc.core.client.v1.QueryClientStatusResponse", aminoType: "cosmos-sdk/QueryClientStatusResponse", + is(o: any): o is QueryClientStatusResponse { + return o && (o.$typeUrl === QueryClientStatusResponse.typeUrl || typeof o.status === "string"); + }, + isSDK(o: any): o is QueryClientStatusResponseSDKType { + return o && (o.$typeUrl === QueryClientStatusResponse.typeUrl || typeof o.status === "string"); + }, + isAmino(o: any): o is QueryClientStatusResponseAmino { + return o && (o.$typeUrl === QueryClientStatusResponse.typeUrl || typeof o.status === "string"); + }, encode(message: QueryClientStatusResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.status !== "") { writer.uint32(10).string(message.status); @@ -1712,7 +1844,8 @@ export const QueryClientStatusResponse = { typeUrl: "/ibc.core.client.v1.QueryClientStatusResponse", value: QueryClientStatusResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryClientParamsRequest(): QueryClientParamsRequest { return {}; @@ -1727,6 +1860,15 @@ function createBaseQueryClientParamsRequest(): QueryClientParamsRequest { export const QueryClientParamsRequest = { typeUrl: "/ibc.core.client.v1.QueryClientParamsRequest", aminoType: "cosmos-sdk/QueryClientParamsRequest", + is(o: any): o is QueryClientParamsRequest { + return o && o.$typeUrl === QueryClientParamsRequest.typeUrl; + }, + isSDK(o: any): o is QueryClientParamsRequestSDKType { + return o && o.$typeUrl === QueryClientParamsRequest.typeUrl; + }, + isAmino(o: any): o is QueryClientParamsRequestAmino { + return o && o.$typeUrl === QueryClientParamsRequest.typeUrl; + }, encode(_: QueryClientParamsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -1778,7 +1920,8 @@ export const QueryClientParamsRequest = { typeUrl: "/ibc.core.client.v1.QueryClientParamsRequest", value: QueryClientParamsRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryClientParamsResponse(): QueryClientParamsResponse { return { @@ -1795,6 +1938,15 @@ function createBaseQueryClientParamsResponse(): QueryClientParamsResponse { export const QueryClientParamsResponse = { typeUrl: "/ibc.core.client.v1.QueryClientParamsResponse", aminoType: "cosmos-sdk/QueryClientParamsResponse", + is(o: any): o is QueryClientParamsResponse { + return o && o.$typeUrl === QueryClientParamsResponse.typeUrl; + }, + isSDK(o: any): o is QueryClientParamsResponseSDKType { + return o && o.$typeUrl === QueryClientParamsResponse.typeUrl; + }, + isAmino(o: any): o is QueryClientParamsResponseAmino { + return o && o.$typeUrl === QueryClientParamsResponse.typeUrl; + }, encode(message: QueryClientParamsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.params !== undefined) { Params.encode(message.params, writer.uint32(10).fork()).ldelim(); @@ -1863,6 +2015,12 @@ export const QueryClientParamsResponse = { typeUrl: "/ibc.core.client.v1.QueryClientParamsResponse", value: QueryClientParamsResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryClientParamsResponse.typeUrl)) { + return; + } + Params.registerTypeUrl(); } }; function createBaseQueryUpgradedClientStateRequest(): QueryUpgradedClientStateRequest { @@ -1878,6 +2036,15 @@ function createBaseQueryUpgradedClientStateRequest(): QueryUpgradedClientStateRe export const QueryUpgradedClientStateRequest = { typeUrl: "/ibc.core.client.v1.QueryUpgradedClientStateRequest", aminoType: "cosmos-sdk/QueryUpgradedClientStateRequest", + is(o: any): o is QueryUpgradedClientStateRequest { + return o && o.$typeUrl === QueryUpgradedClientStateRequest.typeUrl; + }, + isSDK(o: any): o is QueryUpgradedClientStateRequestSDKType { + return o && o.$typeUrl === QueryUpgradedClientStateRequest.typeUrl; + }, + isAmino(o: any): o is QueryUpgradedClientStateRequestAmino { + return o && o.$typeUrl === QueryUpgradedClientStateRequest.typeUrl; + }, encode(_: QueryUpgradedClientStateRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -1929,7 +2096,8 @@ export const QueryUpgradedClientStateRequest = { typeUrl: "/ibc.core.client.v1.QueryUpgradedClientStateRequest", value: QueryUpgradedClientStateRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryUpgradedClientStateResponse(): QueryUpgradedClientStateResponse { return { @@ -1946,6 +2114,15 @@ function createBaseQueryUpgradedClientStateResponse(): QueryUpgradedClientStateR export const QueryUpgradedClientStateResponse = { typeUrl: "/ibc.core.client.v1.QueryUpgradedClientStateResponse", aminoType: "cosmos-sdk/QueryUpgradedClientStateResponse", + is(o: any): o is QueryUpgradedClientStateResponse { + return o && o.$typeUrl === QueryUpgradedClientStateResponse.typeUrl; + }, + isSDK(o: any): o is QueryUpgradedClientStateResponseSDKType { + return o && o.$typeUrl === QueryUpgradedClientStateResponse.typeUrl; + }, + isAmino(o: any): o is QueryUpgradedClientStateResponseAmino { + return o && o.$typeUrl === QueryUpgradedClientStateResponse.typeUrl; + }, encode(message: QueryUpgradedClientStateResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.upgradedClientState !== undefined) { Any.encode(message.upgradedClientState, writer.uint32(10).fork()).ldelim(); @@ -2014,7 +2191,8 @@ export const QueryUpgradedClientStateResponse = { typeUrl: "/ibc.core.client.v1.QueryUpgradedClientStateResponse", value: QueryUpgradedClientStateResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryUpgradedConsensusStateRequest(): QueryUpgradedConsensusStateRequest { return {}; @@ -2029,6 +2207,15 @@ function createBaseQueryUpgradedConsensusStateRequest(): QueryUpgradedConsensusS export const QueryUpgradedConsensusStateRequest = { typeUrl: "/ibc.core.client.v1.QueryUpgradedConsensusStateRequest", aminoType: "cosmos-sdk/QueryUpgradedConsensusStateRequest", + is(o: any): o is QueryUpgradedConsensusStateRequest { + return o && o.$typeUrl === QueryUpgradedConsensusStateRequest.typeUrl; + }, + isSDK(o: any): o is QueryUpgradedConsensusStateRequestSDKType { + return o && o.$typeUrl === QueryUpgradedConsensusStateRequest.typeUrl; + }, + isAmino(o: any): o is QueryUpgradedConsensusStateRequestAmino { + return o && o.$typeUrl === QueryUpgradedConsensusStateRequest.typeUrl; + }, encode(_: QueryUpgradedConsensusStateRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -2080,7 +2267,8 @@ export const QueryUpgradedConsensusStateRequest = { typeUrl: "/ibc.core.client.v1.QueryUpgradedConsensusStateRequest", value: QueryUpgradedConsensusStateRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryUpgradedConsensusStateResponse(): QueryUpgradedConsensusStateResponse { return { @@ -2097,6 +2285,15 @@ function createBaseQueryUpgradedConsensusStateResponse(): QueryUpgradedConsensus export const QueryUpgradedConsensusStateResponse = { typeUrl: "/ibc.core.client.v1.QueryUpgradedConsensusStateResponse", aminoType: "cosmos-sdk/QueryUpgradedConsensusStateResponse", + is(o: any): o is QueryUpgradedConsensusStateResponse { + return o && o.$typeUrl === QueryUpgradedConsensusStateResponse.typeUrl; + }, + isSDK(o: any): o is QueryUpgradedConsensusStateResponseSDKType { + return o && o.$typeUrl === QueryUpgradedConsensusStateResponse.typeUrl; + }, + isAmino(o: any): o is QueryUpgradedConsensusStateResponseAmino { + return o && o.$typeUrl === QueryUpgradedConsensusStateResponse.typeUrl; + }, encode(message: QueryUpgradedConsensusStateResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.upgradedConsensusState !== undefined) { Any.encode(message.upgradedConsensusState, writer.uint32(10).fork()).ldelim(); @@ -2165,5 +2362,6 @@ export const QueryUpgradedConsensusStateResponse = { typeUrl: "/ibc.core.client.v1.QueryUpgradedConsensusStateResponse", value: QueryUpgradedConsensusStateResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/ibc/core/client/v1/tx.registry.ts b/__fixtures__/v-next/outputv3/ibc/core/client/v1/tx.registry.ts index 29053e665e..ae0fa4476f 100644 --- a/__fixtures__/v-next/outputv3/ibc/core/client/v1/tx.registry.ts +++ b/__fixtures__/v-next/outputv3/ibc/core/client/v1/tx.registry.ts @@ -1,12 +1,7 @@ import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../../google/protobuf/any"; -import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { TelescopeGeneratedType } from "../../../../types"; import { MsgCreateClient, MsgCreateClientSDKType, MsgUpdateClient, MsgUpdateClientSDKType, MsgUpgradeClient, MsgUpgradeClientSDKType, MsgSubmitMisbehaviour, MsgSubmitMisbehaviourSDKType } from "./tx"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/ibc.core.client.v1.MsgCreateClient", MsgCreateClient], ["/ibc.core.client.v1.MsgUpdateClient", MsgUpdateClient], ["/ibc.core.client.v1.MsgUpgradeClient", MsgUpgradeClient], ["/ibc.core.client.v1.MsgSubmitMisbehaviour", MsgSubmitMisbehaviour]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/ibc.core.client.v1.MsgCreateClient", MsgCreateClient], ["/ibc.core.client.v1.MsgUpdateClient", MsgUpdateClient], ["/ibc.core.client.v1.MsgUpgradeClient", MsgUpgradeClient], ["/ibc.core.client.v1.MsgSubmitMisbehaviour", MsgSubmitMisbehaviour]]; export const MessageComposer = { encoded: { createClient(value: MsgCreateClient) { diff --git a/__fixtures__/v-next/outputv3/ibc/core/client/v1/tx.rpc.func.ts b/__fixtures__/v-next/outputv3/ibc/core/client/v1/tx.rpc.func.ts new file mode 100644 index 0000000000..ec1f3b6322 --- /dev/null +++ b/__fixtures__/v-next/outputv3/ibc/core/client/v1/tx.rpc.func.ts @@ -0,0 +1,39 @@ +import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../../google/protobuf/any"; +import { buildTx } from "../../../../helper-func-types"; +import { MsgCreateClient, MsgCreateClientSDKType, MsgCreateClientResponse, MsgCreateClientResponseSDKType, MsgUpdateClient, MsgUpdateClientSDKType, MsgUpdateClientResponse, MsgUpdateClientResponseSDKType, MsgUpgradeClient, MsgUpgradeClientSDKType, MsgUpgradeClientResponse, MsgUpgradeClientResponseSDKType, MsgSubmitMisbehaviour, MsgSubmitMisbehaviourSDKType, MsgSubmitMisbehaviourResponse, MsgSubmitMisbehaviourResponseSDKType } from "./tx"; +/** + * CreateClient defines a rpc handler method for MsgCreateClient. + * @name createClient + * @package ibc.core.client.v1 + * @see proto service: ibc.core.client.v1.CreateClient + */ +export const createClient = buildTx({ + msg: MsgCreateClient +}); +/** + * UpdateClient defines a rpc handler method for MsgUpdateClient. + * @name updateClient + * @package ibc.core.client.v1 + * @see proto service: ibc.core.client.v1.UpdateClient + */ +export const updateClient = buildTx({ + msg: MsgUpdateClient +}); +/** + * UpgradeClient defines a rpc handler method for MsgUpgradeClient. + * @name upgradeClient + * @package ibc.core.client.v1 + * @see proto service: ibc.core.client.v1.UpgradeClient + */ +export const upgradeClient = buildTx({ + msg: MsgUpgradeClient +}); +/** + * SubmitMisbehaviour defines a rpc handler method for MsgSubmitMisbehaviour. + * @name submitMisbehaviour + * @package ibc.core.client.v1 + * @see proto service: ibc.core.client.v1.SubmitMisbehaviour + */ +export const submitMisbehaviour = buildTx({ + msg: MsgSubmitMisbehaviour +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/ibc/core/client/v1/tx.ts b/__fixtures__/v-next/outputv3/ibc/core/client/v1/tx.ts index 6e57c3d611..479f5ff518 100644 --- a/__fixtures__/v-next/outputv3/ibc/core/client/v1/tx.ts +++ b/__fixtures__/v-next/outputv3/ibc/core/client/v1/tx.ts @@ -1,5 +1,6 @@ import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../../google/protobuf/any"; import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { GlobalDecoderRegistry } from "../../../../registry"; import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../../helpers"; export const protobufPackage = "ibc.core.client.v1"; /** @@ -381,6 +382,15 @@ function createBaseMsgCreateClient(): MsgCreateClient { export const MsgCreateClient = { typeUrl: "/ibc.core.client.v1.MsgCreateClient", aminoType: "cosmos-sdk/MsgCreateClient", + is(o: any): o is MsgCreateClient { + return o && (o.$typeUrl === MsgCreateClient.typeUrl || typeof o.signer === "string"); + }, + isSDK(o: any): o is MsgCreateClientSDKType { + return o && (o.$typeUrl === MsgCreateClient.typeUrl || typeof o.signer === "string"); + }, + isAmino(o: any): o is MsgCreateClientAmino { + return o && (o.$typeUrl === MsgCreateClient.typeUrl || typeof o.signer === "string"); + }, encode(message: MsgCreateClient, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.clientState !== undefined) { Any.encode(message.clientState, writer.uint32(10).fork()).ldelim(); @@ -479,7 +489,8 @@ export const MsgCreateClient = { typeUrl: "/ibc.core.client.v1.MsgCreateClient", value: MsgCreateClient.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgCreateClientResponse(): MsgCreateClientResponse { return {}; @@ -493,6 +504,15 @@ function createBaseMsgCreateClientResponse(): MsgCreateClientResponse { export const MsgCreateClientResponse = { typeUrl: "/ibc.core.client.v1.MsgCreateClientResponse", aminoType: "cosmos-sdk/MsgCreateClientResponse", + is(o: any): o is MsgCreateClientResponse { + return o && o.$typeUrl === MsgCreateClientResponse.typeUrl; + }, + isSDK(o: any): o is MsgCreateClientResponseSDKType { + return o && o.$typeUrl === MsgCreateClientResponse.typeUrl; + }, + isAmino(o: any): o is MsgCreateClientResponseAmino { + return o && o.$typeUrl === MsgCreateClientResponse.typeUrl; + }, encode(_: MsgCreateClientResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -544,7 +564,8 @@ export const MsgCreateClientResponse = { typeUrl: "/ibc.core.client.v1.MsgCreateClientResponse", value: MsgCreateClientResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgUpdateClient(): MsgUpdateClient { return { @@ -563,6 +584,15 @@ function createBaseMsgUpdateClient(): MsgUpdateClient { export const MsgUpdateClient = { typeUrl: "/ibc.core.client.v1.MsgUpdateClient", aminoType: "cosmos-sdk/MsgUpdateClient", + is(o: any): o is MsgUpdateClient { + return o && (o.$typeUrl === MsgUpdateClient.typeUrl || typeof o.clientId === "string" && typeof o.signer === "string"); + }, + isSDK(o: any): o is MsgUpdateClientSDKType { + return o && (o.$typeUrl === MsgUpdateClient.typeUrl || typeof o.client_id === "string" && typeof o.signer === "string"); + }, + isAmino(o: any): o is MsgUpdateClientAmino { + return o && (o.$typeUrl === MsgUpdateClient.typeUrl || typeof o.client_id === "string" && typeof o.signer === "string"); + }, encode(message: MsgUpdateClient, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.clientId !== "") { writer.uint32(10).string(message.clientId); @@ -659,7 +689,8 @@ export const MsgUpdateClient = { typeUrl: "/ibc.core.client.v1.MsgUpdateClient", value: MsgUpdateClient.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgUpdateClientResponse(): MsgUpdateClientResponse { return {}; @@ -673,6 +704,15 @@ function createBaseMsgUpdateClientResponse(): MsgUpdateClientResponse { export const MsgUpdateClientResponse = { typeUrl: "/ibc.core.client.v1.MsgUpdateClientResponse", aminoType: "cosmos-sdk/MsgUpdateClientResponse", + is(o: any): o is MsgUpdateClientResponse { + return o && o.$typeUrl === MsgUpdateClientResponse.typeUrl; + }, + isSDK(o: any): o is MsgUpdateClientResponseSDKType { + return o && o.$typeUrl === MsgUpdateClientResponse.typeUrl; + }, + isAmino(o: any): o is MsgUpdateClientResponseAmino { + return o && o.$typeUrl === MsgUpdateClientResponse.typeUrl; + }, encode(_: MsgUpdateClientResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -724,7 +764,8 @@ export const MsgUpdateClientResponse = { typeUrl: "/ibc.core.client.v1.MsgUpdateClientResponse", value: MsgUpdateClientResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgUpgradeClient(): MsgUpgradeClient { return { @@ -746,6 +787,15 @@ function createBaseMsgUpgradeClient(): MsgUpgradeClient { export const MsgUpgradeClient = { typeUrl: "/ibc.core.client.v1.MsgUpgradeClient", aminoType: "cosmos-sdk/MsgUpgradeClient", + is(o: any): o is MsgUpgradeClient { + return o && (o.$typeUrl === MsgUpgradeClient.typeUrl || typeof o.clientId === "string" && (o.proofUpgradeClient instanceof Uint8Array || typeof o.proofUpgradeClient === "string") && (o.proofUpgradeConsensusState instanceof Uint8Array || typeof o.proofUpgradeConsensusState === "string") && typeof o.signer === "string"); + }, + isSDK(o: any): o is MsgUpgradeClientSDKType { + return o && (o.$typeUrl === MsgUpgradeClient.typeUrl || typeof o.client_id === "string" && (o.proof_upgrade_client instanceof Uint8Array || typeof o.proof_upgrade_client === "string") && (o.proof_upgrade_consensus_state instanceof Uint8Array || typeof o.proof_upgrade_consensus_state === "string") && typeof o.signer === "string"); + }, + isAmino(o: any): o is MsgUpgradeClientAmino { + return o && (o.$typeUrl === MsgUpgradeClient.typeUrl || typeof o.client_id === "string" && (o.proof_upgrade_client instanceof Uint8Array || typeof o.proof_upgrade_client === "string") && (o.proof_upgrade_consensus_state instanceof Uint8Array || typeof o.proof_upgrade_consensus_state === "string") && typeof o.signer === "string"); + }, encode(message: MsgUpgradeClient, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.clientId !== "") { writer.uint32(10).string(message.clientId); @@ -886,7 +936,8 @@ export const MsgUpgradeClient = { typeUrl: "/ibc.core.client.v1.MsgUpgradeClient", value: MsgUpgradeClient.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgUpgradeClientResponse(): MsgUpgradeClientResponse { return {}; @@ -900,6 +951,15 @@ function createBaseMsgUpgradeClientResponse(): MsgUpgradeClientResponse { export const MsgUpgradeClientResponse = { typeUrl: "/ibc.core.client.v1.MsgUpgradeClientResponse", aminoType: "cosmos-sdk/MsgUpgradeClientResponse", + is(o: any): o is MsgUpgradeClientResponse { + return o && o.$typeUrl === MsgUpgradeClientResponse.typeUrl; + }, + isSDK(o: any): o is MsgUpgradeClientResponseSDKType { + return o && o.$typeUrl === MsgUpgradeClientResponse.typeUrl; + }, + isAmino(o: any): o is MsgUpgradeClientResponseAmino { + return o && o.$typeUrl === MsgUpgradeClientResponse.typeUrl; + }, encode(_: MsgUpgradeClientResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -951,7 +1011,8 @@ export const MsgUpgradeClientResponse = { typeUrl: "/ibc.core.client.v1.MsgUpgradeClientResponse", value: MsgUpgradeClientResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgSubmitMisbehaviour(): MsgSubmitMisbehaviour { return { @@ -970,6 +1031,15 @@ function createBaseMsgSubmitMisbehaviour(): MsgSubmitMisbehaviour { export const MsgSubmitMisbehaviour = { typeUrl: "/ibc.core.client.v1.MsgSubmitMisbehaviour", aminoType: "cosmos-sdk/MsgSubmitMisbehaviour", + is(o: any): o is MsgSubmitMisbehaviour { + return o && (o.$typeUrl === MsgSubmitMisbehaviour.typeUrl || typeof o.clientId === "string" && typeof o.signer === "string"); + }, + isSDK(o: any): o is MsgSubmitMisbehaviourSDKType { + return o && (o.$typeUrl === MsgSubmitMisbehaviour.typeUrl || typeof o.client_id === "string" && typeof o.signer === "string"); + }, + isAmino(o: any): o is MsgSubmitMisbehaviourAmino { + return o && (o.$typeUrl === MsgSubmitMisbehaviour.typeUrl || typeof o.client_id === "string" && typeof o.signer === "string"); + }, encode(message: MsgSubmitMisbehaviour, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.clientId !== "") { writer.uint32(10).string(message.clientId); @@ -1066,7 +1136,8 @@ export const MsgSubmitMisbehaviour = { typeUrl: "/ibc.core.client.v1.MsgSubmitMisbehaviour", value: MsgSubmitMisbehaviour.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgSubmitMisbehaviourResponse(): MsgSubmitMisbehaviourResponse { return {}; @@ -1081,6 +1152,15 @@ function createBaseMsgSubmitMisbehaviourResponse(): MsgSubmitMisbehaviourRespons export const MsgSubmitMisbehaviourResponse = { typeUrl: "/ibc.core.client.v1.MsgSubmitMisbehaviourResponse", aminoType: "cosmos-sdk/MsgSubmitMisbehaviourResponse", + is(o: any): o is MsgSubmitMisbehaviourResponse { + return o && o.$typeUrl === MsgSubmitMisbehaviourResponse.typeUrl; + }, + isSDK(o: any): o is MsgSubmitMisbehaviourResponseSDKType { + return o && o.$typeUrl === MsgSubmitMisbehaviourResponse.typeUrl; + }, + isAmino(o: any): o is MsgSubmitMisbehaviourResponseAmino { + return o && o.$typeUrl === MsgSubmitMisbehaviourResponse.typeUrl; + }, encode(_: MsgSubmitMisbehaviourResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -1132,5 +1212,6 @@ export const MsgSubmitMisbehaviourResponse = { typeUrl: "/ibc.core.client.v1.MsgSubmitMisbehaviourResponse", value: MsgSubmitMisbehaviourResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/ibc/core/commitment/v1/commitment.ts b/__fixtures__/v-next/outputv3/ibc/core/commitment/v1/commitment.ts index 30c0938426..f94f67520b 100644 --- a/__fixtures__/v-next/outputv3/ibc/core/commitment/v1/commitment.ts +++ b/__fixtures__/v-next/outputv3/ibc/core/commitment/v1/commitment.ts @@ -1,6 +1,7 @@ import { CommitmentProof, CommitmentProofAmino, CommitmentProofSDKType } from "../../../../confio/proofs"; import { BinaryReader, BinaryWriter } from "../../../../binary"; import { isSet, bytesFromBase64, DeepPartial, base64FromBytes } from "../../../../helpers"; +import { GlobalDecoderRegistry } from "../../../../registry"; export const protobufPackage = "ibc.core.commitment.v1"; /** * MerkleRoot defines a merkle root hash. @@ -168,6 +169,15 @@ function createBaseMerkleRoot(): MerkleRoot { export const MerkleRoot = { typeUrl: "/ibc.core.commitment.v1.MerkleRoot", aminoType: "cosmos-sdk/MerkleRoot", + is(o: any): o is MerkleRoot { + return o && (o.$typeUrl === MerkleRoot.typeUrl || o.hash instanceof Uint8Array || typeof o.hash === "string"); + }, + isSDK(o: any): o is MerkleRootSDKType { + return o && (o.$typeUrl === MerkleRoot.typeUrl || o.hash instanceof Uint8Array || typeof o.hash === "string"); + }, + isAmino(o: any): o is MerkleRootAmino { + return o && (o.$typeUrl === MerkleRoot.typeUrl || o.hash instanceof Uint8Array || typeof o.hash === "string"); + }, encode(message: MerkleRoot, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.hash.length !== 0) { writer.uint32(10).bytes(message.hash); @@ -234,7 +244,8 @@ export const MerkleRoot = { typeUrl: "/ibc.core.commitment.v1.MerkleRoot", value: MerkleRoot.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMerklePrefix(): MerklePrefix { return { @@ -252,6 +263,15 @@ function createBaseMerklePrefix(): MerklePrefix { export const MerklePrefix = { typeUrl: "/ibc.core.commitment.v1.MerklePrefix", aminoType: "cosmos-sdk/MerklePrefix", + is(o: any): o is MerklePrefix { + return o && (o.$typeUrl === MerklePrefix.typeUrl || o.keyPrefix instanceof Uint8Array || typeof o.keyPrefix === "string"); + }, + isSDK(o: any): o is MerklePrefixSDKType { + return o && (o.$typeUrl === MerklePrefix.typeUrl || o.key_prefix instanceof Uint8Array || typeof o.key_prefix === "string"); + }, + isAmino(o: any): o is MerklePrefixAmino { + return o && (o.$typeUrl === MerklePrefix.typeUrl || o.key_prefix instanceof Uint8Array || typeof o.key_prefix === "string"); + }, encode(message: MerklePrefix, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.keyPrefix.length !== 0) { writer.uint32(10).bytes(message.keyPrefix); @@ -318,7 +338,8 @@ export const MerklePrefix = { typeUrl: "/ibc.core.commitment.v1.MerklePrefix", value: MerklePrefix.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMerklePath(): MerklePath { return { @@ -336,6 +357,15 @@ function createBaseMerklePath(): MerklePath { export const MerklePath = { typeUrl: "/ibc.core.commitment.v1.MerklePath", aminoType: "cosmos-sdk/MerklePath", + is(o: any): o is MerklePath { + return o && (o.$typeUrl === MerklePath.typeUrl || Array.isArray(o.keyPath) && (!o.keyPath.length || typeof o.keyPath[0] === "string")); + }, + isSDK(o: any): o is MerklePathSDKType { + return o && (o.$typeUrl === MerklePath.typeUrl || Array.isArray(o.key_path) && (!o.key_path.length || typeof o.key_path[0] === "string")); + }, + isAmino(o: any): o is MerklePathAmino { + return o && (o.$typeUrl === MerklePath.typeUrl || Array.isArray(o.key_path) && (!o.key_path.length || typeof o.key_path[0] === "string")); + }, encode(message: MerklePath, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.keyPath) { writer.uint32(10).string(v!); @@ -408,7 +438,8 @@ export const MerklePath = { typeUrl: "/ibc.core.commitment.v1.MerklePath", value: MerklePath.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMerkleProof(): MerkleProof { return { @@ -428,6 +459,15 @@ function createBaseMerkleProof(): MerkleProof { export const MerkleProof = { typeUrl: "/ibc.core.commitment.v1.MerkleProof", aminoType: "cosmos-sdk/MerkleProof", + is(o: any): o is MerkleProof { + return o && (o.$typeUrl === MerkleProof.typeUrl || Array.isArray(o.proofs) && (!o.proofs.length || CommitmentProof.is(o.proofs[0]))); + }, + isSDK(o: any): o is MerkleProofSDKType { + return o && (o.$typeUrl === MerkleProof.typeUrl || Array.isArray(o.proofs) && (!o.proofs.length || CommitmentProof.isSDK(o.proofs[0]))); + }, + isAmino(o: any): o is MerkleProofAmino { + return o && (o.$typeUrl === MerkleProof.typeUrl || Array.isArray(o.proofs) && (!o.proofs.length || CommitmentProof.isAmino(o.proofs[0]))); + }, encode(message: MerkleProof, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.proofs) { CommitmentProof.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -500,5 +540,11 @@ export const MerkleProof = { typeUrl: "/ibc.core.commitment.v1.MerkleProof", value: MerkleProof.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MerkleProof.typeUrl)) { + return; + } + CommitmentProof.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/ibc/core/connection/v1/connection.ts b/__fixtures__/v-next/outputv3/ibc/core/connection/v1/connection.ts index 26c7534968..1a51322df4 100644 --- a/__fixtures__/v-next/outputv3/ibc/core/connection/v1/connection.ts +++ b/__fixtures__/v-next/outputv3/ibc/core/connection/v1/connection.ts @@ -1,6 +1,7 @@ import { MerklePrefix, MerklePrefixAmino, MerklePrefixSDKType } from "../../commitment/v1/commitment"; -import { BinaryReader, BinaryWriter } from "../../../../binary"; import { isSet, DeepPartial } from "../../../../helpers"; +import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { GlobalDecoderRegistry } from "../../../../registry"; export const protobufPackage = "ibc.core.connection.v1"; /** * State defines if a connection is in one of the following states: @@ -485,6 +486,15 @@ function createBaseConnectionEnd(): ConnectionEnd { export const ConnectionEnd = { typeUrl: "/ibc.core.connection.v1.ConnectionEnd", aminoType: "cosmos-sdk/ConnectionEnd", + is(o: any): o is ConnectionEnd { + return o && (o.$typeUrl === ConnectionEnd.typeUrl || typeof o.clientId === "string" && Array.isArray(o.versions) && (!o.versions.length || Version.is(o.versions[0])) && isSet(o.state) && Counterparty.is(o.counterparty) && typeof o.delayPeriod === "bigint"); + }, + isSDK(o: any): o is ConnectionEndSDKType { + return o && (o.$typeUrl === ConnectionEnd.typeUrl || typeof o.client_id === "string" && Array.isArray(o.versions) && (!o.versions.length || Version.isSDK(o.versions[0])) && isSet(o.state) && Counterparty.isSDK(o.counterparty) && typeof o.delay_period === "bigint"); + }, + isAmino(o: any): o is ConnectionEndAmino { + return o && (o.$typeUrl === ConnectionEnd.typeUrl || typeof o.client_id === "string" && Array.isArray(o.versions) && (!o.versions.length || Version.isAmino(o.versions[0])) && isSet(o.state) && Counterparty.isAmino(o.counterparty) && typeof o.delay_period === "bigint"); + }, encode(message: ConnectionEnd, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.clientId !== "") { writer.uint32(10).string(message.clientId); @@ -617,6 +627,13 @@ export const ConnectionEnd = { typeUrl: "/ibc.core.connection.v1.ConnectionEnd", value: ConnectionEnd.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ConnectionEnd.typeUrl)) { + return; + } + Version.registerTypeUrl(); + Counterparty.registerTypeUrl(); } }; function createBaseIdentifiedConnection(): IdentifiedConnection { @@ -639,6 +656,15 @@ function createBaseIdentifiedConnection(): IdentifiedConnection { export const IdentifiedConnection = { typeUrl: "/ibc.core.connection.v1.IdentifiedConnection", aminoType: "cosmos-sdk/IdentifiedConnection", + is(o: any): o is IdentifiedConnection { + return o && (o.$typeUrl === IdentifiedConnection.typeUrl || typeof o.id === "string" && typeof o.clientId === "string" && Array.isArray(o.versions) && (!o.versions.length || Version.is(o.versions[0])) && isSet(o.state) && Counterparty.is(o.counterparty) && typeof o.delayPeriod === "bigint"); + }, + isSDK(o: any): o is IdentifiedConnectionSDKType { + return o && (o.$typeUrl === IdentifiedConnection.typeUrl || typeof o.id === "string" && typeof o.client_id === "string" && Array.isArray(o.versions) && (!o.versions.length || Version.isSDK(o.versions[0])) && isSet(o.state) && Counterparty.isSDK(o.counterparty) && typeof o.delay_period === "bigint"); + }, + isAmino(o: any): o is IdentifiedConnectionAmino { + return o && (o.$typeUrl === IdentifiedConnection.typeUrl || typeof o.id === "string" && typeof o.client_id === "string" && Array.isArray(o.versions) && (!o.versions.length || Version.isAmino(o.versions[0])) && isSet(o.state) && Counterparty.isAmino(o.counterparty) && typeof o.delay_period === "bigint"); + }, encode(message: IdentifiedConnection, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.id !== "") { writer.uint32(10).string(message.id); @@ -785,6 +811,13 @@ export const IdentifiedConnection = { typeUrl: "/ibc.core.connection.v1.IdentifiedConnection", value: IdentifiedConnection.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(IdentifiedConnection.typeUrl)) { + return; + } + Version.registerTypeUrl(); + Counterparty.registerTypeUrl(); } }; function createBaseCounterparty(): Counterparty { @@ -803,6 +836,15 @@ function createBaseCounterparty(): Counterparty { export const Counterparty = { typeUrl: "/ibc.core.connection.v1.Counterparty", aminoType: "cosmos-sdk/Counterparty", + is(o: any): o is Counterparty { + return o && (o.$typeUrl === Counterparty.typeUrl || typeof o.clientId === "string" && typeof o.connectionId === "string" && MerklePrefix.is(o.prefix)); + }, + isSDK(o: any): o is CounterpartySDKType { + return o && (o.$typeUrl === Counterparty.typeUrl || typeof o.client_id === "string" && typeof o.connection_id === "string" && MerklePrefix.isSDK(o.prefix)); + }, + isAmino(o: any): o is CounterpartyAmino { + return o && (o.$typeUrl === Counterparty.typeUrl || typeof o.client_id === "string" && typeof o.connection_id === "string" && MerklePrefix.isAmino(o.prefix)); + }, encode(message: Counterparty, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.clientId !== "") { writer.uint32(10).string(message.clientId); @@ -899,6 +941,12 @@ export const Counterparty = { typeUrl: "/ibc.core.connection.v1.Counterparty", value: Counterparty.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Counterparty.typeUrl)) { + return; + } + MerklePrefix.registerTypeUrl(); } }; function createBaseClientPaths(): ClientPaths { @@ -915,6 +963,15 @@ function createBaseClientPaths(): ClientPaths { export const ClientPaths = { typeUrl: "/ibc.core.connection.v1.ClientPaths", aminoType: "cosmos-sdk/ClientPaths", + is(o: any): o is ClientPaths { + return o && (o.$typeUrl === ClientPaths.typeUrl || Array.isArray(o.paths) && (!o.paths.length || typeof o.paths[0] === "string")); + }, + isSDK(o: any): o is ClientPathsSDKType { + return o && (o.$typeUrl === ClientPaths.typeUrl || Array.isArray(o.paths) && (!o.paths.length || typeof o.paths[0] === "string")); + }, + isAmino(o: any): o is ClientPathsAmino { + return o && (o.$typeUrl === ClientPaths.typeUrl || Array.isArray(o.paths) && (!o.paths.length || typeof o.paths[0] === "string")); + }, encode(message: ClientPaths, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.paths) { writer.uint32(10).string(v!); @@ -987,7 +1044,8 @@ export const ClientPaths = { typeUrl: "/ibc.core.connection.v1.ClientPaths", value: ClientPaths.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseConnectionPaths(): ConnectionPaths { return { @@ -1004,6 +1062,15 @@ function createBaseConnectionPaths(): ConnectionPaths { export const ConnectionPaths = { typeUrl: "/ibc.core.connection.v1.ConnectionPaths", aminoType: "cosmos-sdk/ConnectionPaths", + is(o: any): o is ConnectionPaths { + return o && (o.$typeUrl === ConnectionPaths.typeUrl || typeof o.clientId === "string" && Array.isArray(o.paths) && (!o.paths.length || typeof o.paths[0] === "string")); + }, + isSDK(o: any): o is ConnectionPathsSDKType { + return o && (o.$typeUrl === ConnectionPaths.typeUrl || typeof o.client_id === "string" && Array.isArray(o.paths) && (!o.paths.length || typeof o.paths[0] === "string")); + }, + isAmino(o: any): o is ConnectionPathsAmino { + return o && (o.$typeUrl === ConnectionPaths.typeUrl || typeof o.client_id === "string" && Array.isArray(o.paths) && (!o.paths.length || typeof o.paths[0] === "string")); + }, encode(message: ConnectionPaths, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.clientId !== "") { writer.uint32(10).string(message.clientId); @@ -1090,7 +1157,8 @@ export const ConnectionPaths = { typeUrl: "/ibc.core.connection.v1.ConnectionPaths", value: ConnectionPaths.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseVersion(): Version { return { @@ -1108,6 +1176,15 @@ function createBaseVersion(): Version { export const Version = { typeUrl: "/ibc.core.connection.v1.Version", aminoType: "cosmos-sdk/Version", + is(o: any): o is Version { + return o && (o.$typeUrl === Version.typeUrl || typeof o.identifier === "string" && Array.isArray(o.features) && (!o.features.length || typeof o.features[0] === "string")); + }, + isSDK(o: any): o is VersionSDKType { + return o && (o.$typeUrl === Version.typeUrl || typeof o.identifier === "string" && Array.isArray(o.features) && (!o.features.length || typeof o.features[0] === "string")); + }, + isAmino(o: any): o is VersionAmino { + return o && (o.$typeUrl === Version.typeUrl || typeof o.identifier === "string" && Array.isArray(o.features) && (!o.features.length || typeof o.features[0] === "string")); + }, encode(message: Version, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.identifier !== "") { writer.uint32(10).string(message.identifier); @@ -1194,7 +1271,8 @@ export const Version = { typeUrl: "/ibc.core.connection.v1.Version", value: Version.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseParams(): Params { return { @@ -1210,6 +1288,15 @@ function createBaseParams(): Params { export const Params = { typeUrl: "/ibc.core.connection.v1.Params", aminoType: "cosmos-sdk/Params", + is(o: any): o is Params { + return o && (o.$typeUrl === Params.typeUrl || typeof o.maxExpectedTimePerBlock === "bigint"); + }, + isSDK(o: any): o is ParamsSDKType { + return o && (o.$typeUrl === Params.typeUrl || typeof o.max_expected_time_per_block === "bigint"); + }, + isAmino(o: any): o is ParamsAmino { + return o && (o.$typeUrl === Params.typeUrl || typeof o.max_expected_time_per_block === "bigint"); + }, encode(message: Params, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.maxExpectedTimePerBlock !== BigInt(0)) { writer.uint32(8).uint64(message.maxExpectedTimePerBlock); @@ -1278,5 +1365,6 @@ export const Params = { typeUrl: "/ibc.core.connection.v1.Params", value: Params.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/ibc/core/connection/v1/genesis.ts b/__fixtures__/v-next/outputv3/ibc/core/connection/v1/genesis.ts index 9f8fae7a98..27406ab58b 100644 --- a/__fixtures__/v-next/outputv3/ibc/core/connection/v1/genesis.ts +++ b/__fixtures__/v-next/outputv3/ibc/core/connection/v1/genesis.ts @@ -1,5 +1,6 @@ import { IdentifiedConnection, IdentifiedConnectionAmino, IdentifiedConnectionSDKType, ConnectionPaths, ConnectionPathsAmino, ConnectionPathsSDKType, Params, ParamsAmino, ParamsSDKType } from "./connection"; import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { GlobalDecoderRegistry } from "../../../../registry"; import { isSet, DeepPartial } from "../../../../helpers"; export const protobufPackage = "ibc.core.connection.v1"; /** @@ -65,6 +66,15 @@ function createBaseGenesisState(): GenesisState { export const GenesisState = { typeUrl: "/ibc.core.connection.v1.GenesisState", aminoType: "cosmos-sdk/GenesisState", + is(o: any): o is GenesisState { + return o && (o.$typeUrl === GenesisState.typeUrl || Array.isArray(o.connections) && (!o.connections.length || IdentifiedConnection.is(o.connections[0])) && Array.isArray(o.clientConnectionPaths) && (!o.clientConnectionPaths.length || ConnectionPaths.is(o.clientConnectionPaths[0])) && typeof o.nextConnectionSequence === "bigint" && Params.is(o.params)); + }, + isSDK(o: any): o is GenesisStateSDKType { + return o && (o.$typeUrl === GenesisState.typeUrl || Array.isArray(o.connections) && (!o.connections.length || IdentifiedConnection.isSDK(o.connections[0])) && Array.isArray(o.client_connection_paths) && (!o.client_connection_paths.length || ConnectionPaths.isSDK(o.client_connection_paths[0])) && typeof o.next_connection_sequence === "bigint" && Params.isSDK(o.params)); + }, + isAmino(o: any): o is GenesisStateAmino { + return o && (o.$typeUrl === GenesisState.typeUrl || Array.isArray(o.connections) && (!o.connections.length || IdentifiedConnection.isAmino(o.connections[0])) && Array.isArray(o.client_connection_paths) && (!o.client_connection_paths.length || ConnectionPaths.isAmino(o.client_connection_paths[0])) && typeof o.next_connection_sequence === "bigint" && Params.isAmino(o.params)); + }, encode(message: GenesisState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.connections) { IdentifiedConnection.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -189,5 +199,13 @@ export const GenesisState = { typeUrl: "/ibc.core.connection.v1.GenesisState", value: GenesisState.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GenesisState.typeUrl)) { + return; + } + IdentifiedConnection.registerTypeUrl(); + ConnectionPaths.registerTypeUrl(); + Params.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/ibc/core/connection/v1/query.rpc.func.ts b/__fixtures__/v-next/outputv3/ibc/core/connection/v1/query.rpc.func.ts new file mode 100644 index 0000000000..3f2f09896e --- /dev/null +++ b/__fixtures__/v-next/outputv3/ibc/core/connection/v1/query.rpc.func.ts @@ -0,0 +1,74 @@ +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../../cosmos/base/query/v1beta1/pagination"; +import { ConnectionEnd, ConnectionEndSDKType, IdentifiedConnection, IdentifiedConnectionSDKType } from "./connection"; +import { Height, HeightSDKType, IdentifiedClientState, IdentifiedClientStateSDKType } from "../../client/v1/client"; +import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../../google/protobuf/any"; +import { EndpointOrRpc, buildQuery } from "../../../../helper-func-types"; +import { QueryConnectionRequest, QueryConnectionRequestSDKType, QueryConnectionResponse, QueryConnectionResponseSDKType, QueryConnectionsRequest, QueryConnectionsRequestSDKType, QueryConnectionsResponse, QueryConnectionsResponseSDKType, QueryClientConnectionsRequest, QueryClientConnectionsRequestSDKType, QueryClientConnectionsResponse, QueryClientConnectionsResponseSDKType, QueryConnectionClientStateRequest, QueryConnectionClientStateRequestSDKType, QueryConnectionClientStateResponse, QueryConnectionClientStateResponseSDKType, QueryConnectionConsensusStateRequest, QueryConnectionConsensusStateRequestSDKType, QueryConnectionConsensusStateResponse, QueryConnectionConsensusStateResponseSDKType } from "./query"; +/** + * Connection queries an IBC connection end. + * @name getConnection + * @package ibc.core.connection.v1 + * @see proto service: ibc.core.connection.v1.Connection + */ +export const getConnection = buildQuery({ + encode: QueryConnectionRequest.encode, + decode: QueryConnectionResponse.decode, + service: "ibc.core.connection.v1.Query", + method: "Connection", + deps: [QueryConnectionRequest, QueryConnectionResponse] +}); +/** + * Connections queries all the IBC connections of a chain. + * @name getConnections + * @package ibc.core.connection.v1 + * @see proto service: ibc.core.connection.v1.Connections + */ +export const getConnections = buildQuery({ + encode: QueryConnectionsRequest.encode, + decode: QueryConnectionsResponse.decode, + service: "ibc.core.connection.v1.Query", + method: "Connections", + deps: [QueryConnectionsRequest, QueryConnectionsResponse] +}); +/** + * ClientConnections queries the connection paths associated with a client + * state. + * @name getClientConnections + * @package ibc.core.connection.v1 + * @see proto service: ibc.core.connection.v1.ClientConnections + */ +export const getClientConnections = buildQuery({ + encode: QueryClientConnectionsRequest.encode, + decode: QueryClientConnectionsResponse.decode, + service: "ibc.core.connection.v1.Query", + method: "ClientConnections", + deps: [QueryClientConnectionsRequest, QueryClientConnectionsResponse] +}); +/** + * ConnectionClientState queries the client state associated with the + * connection. + * @name getConnectionClientState + * @package ibc.core.connection.v1 + * @see proto service: ibc.core.connection.v1.ConnectionClientState + */ +export const getConnectionClientState = buildQuery({ + encode: QueryConnectionClientStateRequest.encode, + decode: QueryConnectionClientStateResponse.decode, + service: "ibc.core.connection.v1.Query", + method: "ConnectionClientState", + deps: [QueryConnectionClientStateRequest, QueryConnectionClientStateResponse] +}); +/** + * ConnectionConsensusState queries the consensus state associated with the + * connection. + * @name getConnectionConsensusState + * @package ibc.core.connection.v1 + * @see proto service: ibc.core.connection.v1.ConnectionConsensusState + */ +export const getConnectionConsensusState = buildQuery({ + encode: QueryConnectionConsensusStateRequest.encode, + decode: QueryConnectionConsensusStateResponse.decode, + service: "ibc.core.connection.v1.Query", + method: "ConnectionConsensusState", + deps: [QueryConnectionConsensusStateRequest, QueryConnectionConsensusStateResponse] +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/ibc/core/connection/v1/query.ts b/__fixtures__/v-next/outputv3/ibc/core/connection/v1/query.ts index 2e958985cf..8a38a072c7 100644 --- a/__fixtures__/v-next/outputv3/ibc/core/connection/v1/query.ts +++ b/__fixtures__/v-next/outputv3/ibc/core/connection/v1/query.ts @@ -4,6 +4,7 @@ import { Height, HeightAmino, HeightSDKType, IdentifiedClientState, IdentifiedCl import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../../google/protobuf/any"; import { BinaryReader, BinaryWriter } from "../../../../binary"; import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../../helpers"; +import { GlobalDecoderRegistry } from "../../../../registry"; export const protobufPackage = "ibc.core.connection.v1"; /** * QueryConnectionRequest is the request type for the Query/Connection RPC @@ -522,6 +523,15 @@ function createBaseQueryConnectionRequest(): QueryConnectionRequest { export const QueryConnectionRequest = { typeUrl: "/ibc.core.connection.v1.QueryConnectionRequest", aminoType: "cosmos-sdk/QueryConnectionRequest", + is(o: any): o is QueryConnectionRequest { + return o && (o.$typeUrl === QueryConnectionRequest.typeUrl || typeof o.connectionId === "string"); + }, + isSDK(o: any): o is QueryConnectionRequestSDKType { + return o && (o.$typeUrl === QueryConnectionRequest.typeUrl || typeof o.connection_id === "string"); + }, + isAmino(o: any): o is QueryConnectionRequestAmino { + return o && (o.$typeUrl === QueryConnectionRequest.typeUrl || typeof o.connection_id === "string"); + }, encode(message: QueryConnectionRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.connectionId !== "") { writer.uint32(10).string(message.connectionId); @@ -588,7 +598,8 @@ export const QueryConnectionRequest = { typeUrl: "/ibc.core.connection.v1.QueryConnectionRequest", value: QueryConnectionRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryConnectionResponse(): QueryConnectionResponse { return { @@ -608,6 +619,15 @@ function createBaseQueryConnectionResponse(): QueryConnectionResponse { export const QueryConnectionResponse = { typeUrl: "/ibc.core.connection.v1.QueryConnectionResponse", aminoType: "cosmos-sdk/QueryConnectionResponse", + is(o: any): o is QueryConnectionResponse { + return o && (o.$typeUrl === QueryConnectionResponse.typeUrl || (o.proof instanceof Uint8Array || typeof o.proof === "string") && Height.is(o.proofHeight)); + }, + isSDK(o: any): o is QueryConnectionResponseSDKType { + return o && (o.$typeUrl === QueryConnectionResponse.typeUrl || (o.proof instanceof Uint8Array || typeof o.proof === "string") && Height.isSDK(o.proof_height)); + }, + isAmino(o: any): o is QueryConnectionResponseAmino { + return o && (o.$typeUrl === QueryConnectionResponse.typeUrl || (o.proof instanceof Uint8Array || typeof o.proof === "string") && Height.isAmino(o.proof_height)); + }, encode(message: QueryConnectionResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.connection !== undefined) { ConnectionEnd.encode(message.connection, writer.uint32(10).fork()).ldelim(); @@ -706,6 +726,13 @@ export const QueryConnectionResponse = { typeUrl: "/ibc.core.connection.v1.QueryConnectionResponse", value: QueryConnectionResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryConnectionResponse.typeUrl)) { + return; + } + ConnectionEnd.registerTypeUrl(); + Height.registerTypeUrl(); } }; function createBaseQueryConnectionsRequest(): QueryConnectionsRequest { @@ -723,6 +750,15 @@ function createBaseQueryConnectionsRequest(): QueryConnectionsRequest { export const QueryConnectionsRequest = { typeUrl: "/ibc.core.connection.v1.QueryConnectionsRequest", aminoType: "cosmos-sdk/QueryConnectionsRequest", + is(o: any): o is QueryConnectionsRequest { + return o && o.$typeUrl === QueryConnectionsRequest.typeUrl; + }, + isSDK(o: any): o is QueryConnectionsRequestSDKType { + return o && o.$typeUrl === QueryConnectionsRequest.typeUrl; + }, + isAmino(o: any): o is QueryConnectionsRequestAmino { + return o && o.$typeUrl === QueryConnectionsRequest.typeUrl; + }, encode(message: QueryConnectionsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.pagination !== undefined) { PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); @@ -791,6 +827,12 @@ export const QueryConnectionsRequest = { typeUrl: "/ibc.core.connection.v1.QueryConnectionsRequest", value: QueryConnectionsRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryConnectionsRequest.typeUrl)) { + return; + } + PageRequest.registerTypeUrl(); } }; function createBaseQueryConnectionsResponse(): QueryConnectionsResponse { @@ -810,6 +852,15 @@ function createBaseQueryConnectionsResponse(): QueryConnectionsResponse { export const QueryConnectionsResponse = { typeUrl: "/ibc.core.connection.v1.QueryConnectionsResponse", aminoType: "cosmos-sdk/QueryConnectionsResponse", + is(o: any): o is QueryConnectionsResponse { + return o && (o.$typeUrl === QueryConnectionsResponse.typeUrl || Array.isArray(o.connections) && (!o.connections.length || IdentifiedConnection.is(o.connections[0])) && Height.is(o.height)); + }, + isSDK(o: any): o is QueryConnectionsResponseSDKType { + return o && (o.$typeUrl === QueryConnectionsResponse.typeUrl || Array.isArray(o.connections) && (!o.connections.length || IdentifiedConnection.isSDK(o.connections[0])) && Height.isSDK(o.height)); + }, + isAmino(o: any): o is QueryConnectionsResponseAmino { + return o && (o.$typeUrl === QueryConnectionsResponse.typeUrl || Array.isArray(o.connections) && (!o.connections.length || IdentifiedConnection.isAmino(o.connections[0])) && Height.isAmino(o.height)); + }, encode(message: QueryConnectionsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.connections) { IdentifiedConnection.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -914,6 +965,14 @@ export const QueryConnectionsResponse = { typeUrl: "/ibc.core.connection.v1.QueryConnectionsResponse", value: QueryConnectionsResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryConnectionsResponse.typeUrl)) { + return; + } + IdentifiedConnection.registerTypeUrl(); + PageResponse.registerTypeUrl(); + Height.registerTypeUrl(); } }; function createBaseQueryClientConnectionsRequest(): QueryClientConnectionsRequest { @@ -931,6 +990,15 @@ function createBaseQueryClientConnectionsRequest(): QueryClientConnectionsReques export const QueryClientConnectionsRequest = { typeUrl: "/ibc.core.connection.v1.QueryClientConnectionsRequest", aminoType: "cosmos-sdk/QueryClientConnectionsRequest", + is(o: any): o is QueryClientConnectionsRequest { + return o && (o.$typeUrl === QueryClientConnectionsRequest.typeUrl || typeof o.clientId === "string"); + }, + isSDK(o: any): o is QueryClientConnectionsRequestSDKType { + return o && (o.$typeUrl === QueryClientConnectionsRequest.typeUrl || typeof o.client_id === "string"); + }, + isAmino(o: any): o is QueryClientConnectionsRequestAmino { + return o && (o.$typeUrl === QueryClientConnectionsRequest.typeUrl || typeof o.client_id === "string"); + }, encode(message: QueryClientConnectionsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.clientId !== "") { writer.uint32(10).string(message.clientId); @@ -997,7 +1065,8 @@ export const QueryClientConnectionsRequest = { typeUrl: "/ibc.core.connection.v1.QueryClientConnectionsRequest", value: QueryClientConnectionsRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryClientConnectionsResponse(): QueryClientConnectionsResponse { return { @@ -1016,6 +1085,15 @@ function createBaseQueryClientConnectionsResponse(): QueryClientConnectionsRespo export const QueryClientConnectionsResponse = { typeUrl: "/ibc.core.connection.v1.QueryClientConnectionsResponse", aminoType: "cosmos-sdk/QueryClientConnectionsResponse", + is(o: any): o is QueryClientConnectionsResponse { + return o && (o.$typeUrl === QueryClientConnectionsResponse.typeUrl || Array.isArray(o.connectionPaths) && (!o.connectionPaths.length || typeof o.connectionPaths[0] === "string") && (o.proof instanceof Uint8Array || typeof o.proof === "string") && Height.is(o.proofHeight)); + }, + isSDK(o: any): o is QueryClientConnectionsResponseSDKType { + return o && (o.$typeUrl === QueryClientConnectionsResponse.typeUrl || Array.isArray(o.connection_paths) && (!o.connection_paths.length || typeof o.connection_paths[0] === "string") && (o.proof instanceof Uint8Array || typeof o.proof === "string") && Height.isSDK(o.proof_height)); + }, + isAmino(o: any): o is QueryClientConnectionsResponseAmino { + return o && (o.$typeUrl === QueryClientConnectionsResponse.typeUrl || Array.isArray(o.connection_paths) && (!o.connection_paths.length || typeof o.connection_paths[0] === "string") && (o.proof instanceof Uint8Array || typeof o.proof === "string") && Height.isAmino(o.proof_height)); + }, encode(message: QueryClientConnectionsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.connectionPaths) { writer.uint32(10).string(v!); @@ -1118,6 +1196,12 @@ export const QueryClientConnectionsResponse = { typeUrl: "/ibc.core.connection.v1.QueryClientConnectionsResponse", value: QueryClientConnectionsResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryClientConnectionsResponse.typeUrl)) { + return; + } + Height.registerTypeUrl(); } }; function createBaseQueryConnectionClientStateRequest(): QueryConnectionClientStateRequest { @@ -1135,6 +1219,15 @@ function createBaseQueryConnectionClientStateRequest(): QueryConnectionClientSta export const QueryConnectionClientStateRequest = { typeUrl: "/ibc.core.connection.v1.QueryConnectionClientStateRequest", aminoType: "cosmos-sdk/QueryConnectionClientStateRequest", + is(o: any): o is QueryConnectionClientStateRequest { + return o && (o.$typeUrl === QueryConnectionClientStateRequest.typeUrl || typeof o.connectionId === "string"); + }, + isSDK(o: any): o is QueryConnectionClientStateRequestSDKType { + return o && (o.$typeUrl === QueryConnectionClientStateRequest.typeUrl || typeof o.connection_id === "string"); + }, + isAmino(o: any): o is QueryConnectionClientStateRequestAmino { + return o && (o.$typeUrl === QueryConnectionClientStateRequest.typeUrl || typeof o.connection_id === "string"); + }, encode(message: QueryConnectionClientStateRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.connectionId !== "") { writer.uint32(10).string(message.connectionId); @@ -1201,7 +1294,8 @@ export const QueryConnectionClientStateRequest = { typeUrl: "/ibc.core.connection.v1.QueryConnectionClientStateRequest", value: QueryConnectionClientStateRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryConnectionClientStateResponse(): QueryConnectionClientStateResponse { return { @@ -1220,6 +1314,15 @@ function createBaseQueryConnectionClientStateResponse(): QueryConnectionClientSt export const QueryConnectionClientStateResponse = { typeUrl: "/ibc.core.connection.v1.QueryConnectionClientStateResponse", aminoType: "cosmos-sdk/QueryConnectionClientStateResponse", + is(o: any): o is QueryConnectionClientStateResponse { + return o && (o.$typeUrl === QueryConnectionClientStateResponse.typeUrl || (o.proof instanceof Uint8Array || typeof o.proof === "string") && Height.is(o.proofHeight)); + }, + isSDK(o: any): o is QueryConnectionClientStateResponseSDKType { + return o && (o.$typeUrl === QueryConnectionClientStateResponse.typeUrl || (o.proof instanceof Uint8Array || typeof o.proof === "string") && Height.isSDK(o.proof_height)); + }, + isAmino(o: any): o is QueryConnectionClientStateResponseAmino { + return o && (o.$typeUrl === QueryConnectionClientStateResponse.typeUrl || (o.proof instanceof Uint8Array || typeof o.proof === "string") && Height.isAmino(o.proof_height)); + }, encode(message: QueryConnectionClientStateResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.identifiedClientState !== undefined) { IdentifiedClientState.encode(message.identifiedClientState, writer.uint32(10).fork()).ldelim(); @@ -1318,6 +1421,13 @@ export const QueryConnectionClientStateResponse = { typeUrl: "/ibc.core.connection.v1.QueryConnectionClientStateResponse", value: QueryConnectionClientStateResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryConnectionClientStateResponse.typeUrl)) { + return; + } + IdentifiedClientState.registerTypeUrl(); + Height.registerTypeUrl(); } }; function createBaseQueryConnectionConsensusStateRequest(): QueryConnectionConsensusStateRequest { @@ -1337,6 +1447,15 @@ function createBaseQueryConnectionConsensusStateRequest(): QueryConnectionConsen export const QueryConnectionConsensusStateRequest = { typeUrl: "/ibc.core.connection.v1.QueryConnectionConsensusStateRequest", aminoType: "cosmos-sdk/QueryConnectionConsensusStateRequest", + is(o: any): o is QueryConnectionConsensusStateRequest { + return o && (o.$typeUrl === QueryConnectionConsensusStateRequest.typeUrl || typeof o.connectionId === "string" && typeof o.revisionNumber === "bigint" && typeof o.revisionHeight === "bigint"); + }, + isSDK(o: any): o is QueryConnectionConsensusStateRequestSDKType { + return o && (o.$typeUrl === QueryConnectionConsensusStateRequest.typeUrl || typeof o.connection_id === "string" && typeof o.revision_number === "bigint" && typeof o.revision_height === "bigint"); + }, + isAmino(o: any): o is QueryConnectionConsensusStateRequestAmino { + return o && (o.$typeUrl === QueryConnectionConsensusStateRequest.typeUrl || typeof o.connection_id === "string" && typeof o.revision_number === "bigint" && typeof o.revision_height === "bigint"); + }, encode(message: QueryConnectionConsensusStateRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.connectionId !== "") { writer.uint32(10).string(message.connectionId); @@ -1435,7 +1554,8 @@ export const QueryConnectionConsensusStateRequest = { typeUrl: "/ibc.core.connection.v1.QueryConnectionConsensusStateRequest", value: QueryConnectionConsensusStateRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryConnectionConsensusStateResponse(): QueryConnectionConsensusStateResponse { return { @@ -1455,6 +1575,15 @@ function createBaseQueryConnectionConsensusStateResponse(): QueryConnectionConse export const QueryConnectionConsensusStateResponse = { typeUrl: "/ibc.core.connection.v1.QueryConnectionConsensusStateResponse", aminoType: "cosmos-sdk/QueryConnectionConsensusStateResponse", + is(o: any): o is QueryConnectionConsensusStateResponse { + return o && (o.$typeUrl === QueryConnectionConsensusStateResponse.typeUrl || typeof o.clientId === "string" && (o.proof instanceof Uint8Array || typeof o.proof === "string") && Height.is(o.proofHeight)); + }, + isSDK(o: any): o is QueryConnectionConsensusStateResponseSDKType { + return o && (o.$typeUrl === QueryConnectionConsensusStateResponse.typeUrl || typeof o.client_id === "string" && (o.proof instanceof Uint8Array || typeof o.proof === "string") && Height.isSDK(o.proof_height)); + }, + isAmino(o: any): o is QueryConnectionConsensusStateResponseAmino { + return o && (o.$typeUrl === QueryConnectionConsensusStateResponse.typeUrl || typeof o.client_id === "string" && (o.proof instanceof Uint8Array || typeof o.proof === "string") && Height.isAmino(o.proof_height)); + }, encode(message: QueryConnectionConsensusStateResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.consensusState !== undefined) { Any.encode(message.consensusState, writer.uint32(10).fork()).ldelim(); @@ -1567,5 +1696,11 @@ export const QueryConnectionConsensusStateResponse = { typeUrl: "/ibc.core.connection.v1.QueryConnectionConsensusStateResponse", value: QueryConnectionConsensusStateResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryConnectionConsensusStateResponse.typeUrl)) { + return; + } + Height.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/ibc/core/connection/v1/tx.registry.ts b/__fixtures__/v-next/outputv3/ibc/core/connection/v1/tx.registry.ts index 9c10763ee9..9f66bbaf9d 100644 --- a/__fixtures__/v-next/outputv3/ibc/core/connection/v1/tx.registry.ts +++ b/__fixtures__/v-next/outputv3/ibc/core/connection/v1/tx.registry.ts @@ -1,14 +1,9 @@ import { Counterparty, CounterpartySDKType, Version, VersionSDKType } from "./connection"; import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../../google/protobuf/any"; import { Height, HeightSDKType } from "../../client/v1/client"; -import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { TelescopeGeneratedType } from "../../../../types"; import { MsgConnectionOpenInit, MsgConnectionOpenInitSDKType, MsgConnectionOpenTry, MsgConnectionOpenTrySDKType, MsgConnectionOpenAck, MsgConnectionOpenAckSDKType, MsgConnectionOpenConfirm, MsgConnectionOpenConfirmSDKType } from "./tx"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/ibc.core.connection.v1.MsgConnectionOpenInit", MsgConnectionOpenInit], ["/ibc.core.connection.v1.MsgConnectionOpenTry", MsgConnectionOpenTry], ["/ibc.core.connection.v1.MsgConnectionOpenAck", MsgConnectionOpenAck], ["/ibc.core.connection.v1.MsgConnectionOpenConfirm", MsgConnectionOpenConfirm]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/ibc.core.connection.v1.MsgConnectionOpenInit", MsgConnectionOpenInit], ["/ibc.core.connection.v1.MsgConnectionOpenTry", MsgConnectionOpenTry], ["/ibc.core.connection.v1.MsgConnectionOpenAck", MsgConnectionOpenAck], ["/ibc.core.connection.v1.MsgConnectionOpenConfirm", MsgConnectionOpenConfirm]]; export const MessageComposer = { encoded: { connectionOpenInit(value: MsgConnectionOpenInit) { diff --git a/__fixtures__/v-next/outputv3/ibc/core/connection/v1/tx.rpc.func.ts b/__fixtures__/v-next/outputv3/ibc/core/connection/v1/tx.rpc.func.ts new file mode 100644 index 0000000000..19a25c9bd6 --- /dev/null +++ b/__fixtures__/v-next/outputv3/ibc/core/connection/v1/tx.rpc.func.ts @@ -0,0 +1,42 @@ +import { Counterparty, CounterpartySDKType, Version, VersionSDKType } from "./connection"; +import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../../google/protobuf/any"; +import { Height, HeightSDKType } from "../../client/v1/client"; +import { buildTx } from "../../../../helper-func-types"; +import { MsgConnectionOpenInit, MsgConnectionOpenInitSDKType, MsgConnectionOpenInitResponse, MsgConnectionOpenInitResponseSDKType, MsgConnectionOpenTry, MsgConnectionOpenTrySDKType, MsgConnectionOpenTryResponse, MsgConnectionOpenTryResponseSDKType, MsgConnectionOpenAck, MsgConnectionOpenAckSDKType, MsgConnectionOpenAckResponse, MsgConnectionOpenAckResponseSDKType, MsgConnectionOpenConfirm, MsgConnectionOpenConfirmSDKType, MsgConnectionOpenConfirmResponse, MsgConnectionOpenConfirmResponseSDKType } from "./tx"; +/** + * ConnectionOpenInit defines a rpc handler method for MsgConnectionOpenInit. + * @name connectionOpenInit + * @package ibc.core.connection.v1 + * @see proto service: ibc.core.connection.v1.ConnectionOpenInit + */ +export const connectionOpenInit = buildTx({ + msg: MsgConnectionOpenInit +}); +/** + * ConnectionOpenTry defines a rpc handler method for MsgConnectionOpenTry. + * @name connectionOpenTry + * @package ibc.core.connection.v1 + * @see proto service: ibc.core.connection.v1.ConnectionOpenTry + */ +export const connectionOpenTry = buildTx({ + msg: MsgConnectionOpenTry +}); +/** + * ConnectionOpenAck defines a rpc handler method for MsgConnectionOpenAck. + * @name connectionOpenAck + * @package ibc.core.connection.v1 + * @see proto service: ibc.core.connection.v1.ConnectionOpenAck + */ +export const connectionOpenAck = buildTx({ + msg: MsgConnectionOpenAck +}); +/** + * ConnectionOpenConfirm defines a rpc handler method for + * MsgConnectionOpenConfirm. + * @name connectionOpenConfirm + * @package ibc.core.connection.v1 + * @see proto service: ibc.core.connection.v1.ConnectionOpenConfirm + */ +export const connectionOpenConfirm = buildTx({ + msg: MsgConnectionOpenConfirm +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/ibc/core/connection/v1/tx.ts b/__fixtures__/v-next/outputv3/ibc/core/connection/v1/tx.ts index c4bf382278..3727eabaf9 100644 --- a/__fixtures__/v-next/outputv3/ibc/core/connection/v1/tx.ts +++ b/__fixtures__/v-next/outputv3/ibc/core/connection/v1/tx.ts @@ -2,6 +2,7 @@ import { Counterparty, CounterpartyAmino, CounterpartySDKType, Version, VersionA import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../../google/protobuf/any"; import { Height, HeightAmino, HeightSDKType } from "../../client/v1/client"; import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { GlobalDecoderRegistry } from "../../../../registry"; import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../../helpers"; export const protobufPackage = "ibc.core.connection.v1"; /** @@ -400,6 +401,15 @@ function createBaseMsgConnectionOpenInit(): MsgConnectionOpenInit { export const MsgConnectionOpenInit = { typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenInit", aminoType: "cosmos-sdk/MsgConnectionOpenInit", + is(o: any): o is MsgConnectionOpenInit { + return o && (o.$typeUrl === MsgConnectionOpenInit.typeUrl || typeof o.clientId === "string" && Counterparty.is(o.counterparty) && typeof o.delayPeriod === "bigint" && typeof o.signer === "string"); + }, + isSDK(o: any): o is MsgConnectionOpenInitSDKType { + return o && (o.$typeUrl === MsgConnectionOpenInit.typeUrl || typeof o.client_id === "string" && Counterparty.isSDK(o.counterparty) && typeof o.delay_period === "bigint" && typeof o.signer === "string"); + }, + isAmino(o: any): o is MsgConnectionOpenInitAmino { + return o && (o.$typeUrl === MsgConnectionOpenInit.typeUrl || typeof o.client_id === "string" && Counterparty.isAmino(o.counterparty) && typeof o.delay_period === "bigint" && typeof o.signer === "string"); + }, encode(message: MsgConnectionOpenInit, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.clientId !== "") { writer.uint32(10).string(message.clientId); @@ -528,6 +538,13 @@ export const MsgConnectionOpenInit = { typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenInit", value: MsgConnectionOpenInit.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgConnectionOpenInit.typeUrl)) { + return; + } + Counterparty.registerTypeUrl(); + Version.registerTypeUrl(); } }; function createBaseMsgConnectionOpenInitResponse(): MsgConnectionOpenInitResponse { @@ -543,6 +560,15 @@ function createBaseMsgConnectionOpenInitResponse(): MsgConnectionOpenInitRespons export const MsgConnectionOpenInitResponse = { typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenInitResponse", aminoType: "cosmos-sdk/MsgConnectionOpenInitResponse", + is(o: any): o is MsgConnectionOpenInitResponse { + return o && o.$typeUrl === MsgConnectionOpenInitResponse.typeUrl; + }, + isSDK(o: any): o is MsgConnectionOpenInitResponseSDKType { + return o && o.$typeUrl === MsgConnectionOpenInitResponse.typeUrl; + }, + isAmino(o: any): o is MsgConnectionOpenInitResponseAmino { + return o && o.$typeUrl === MsgConnectionOpenInitResponse.typeUrl; + }, encode(_: MsgConnectionOpenInitResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -594,7 +620,8 @@ export const MsgConnectionOpenInitResponse = { typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenInitResponse", value: MsgConnectionOpenInitResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgConnectionOpenTry(): MsgConnectionOpenTry { return { @@ -622,6 +649,15 @@ function createBaseMsgConnectionOpenTry(): MsgConnectionOpenTry { export const MsgConnectionOpenTry = { typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenTry", aminoType: "cosmos-sdk/MsgConnectionOpenTry", + is(o: any): o is MsgConnectionOpenTry { + return o && (o.$typeUrl === MsgConnectionOpenTry.typeUrl || typeof o.clientId === "string" && typeof o.previousConnectionId === "string" && Counterparty.is(o.counterparty) && typeof o.delayPeriod === "bigint" && Array.isArray(o.counterpartyVersions) && (!o.counterpartyVersions.length || Version.is(o.counterpartyVersions[0])) && Height.is(o.proofHeight) && (o.proofInit instanceof Uint8Array || typeof o.proofInit === "string") && (o.proofClient instanceof Uint8Array || typeof o.proofClient === "string") && (o.proofConsensus instanceof Uint8Array || typeof o.proofConsensus === "string") && Height.is(o.consensusHeight) && typeof o.signer === "string"); + }, + isSDK(o: any): o is MsgConnectionOpenTrySDKType { + return o && (o.$typeUrl === MsgConnectionOpenTry.typeUrl || typeof o.client_id === "string" && typeof o.previous_connection_id === "string" && Counterparty.isSDK(o.counterparty) && typeof o.delay_period === "bigint" && Array.isArray(o.counterparty_versions) && (!o.counterparty_versions.length || Version.isSDK(o.counterparty_versions[0])) && Height.isSDK(o.proof_height) && (o.proof_init instanceof Uint8Array || typeof o.proof_init === "string") && (o.proof_client instanceof Uint8Array || typeof o.proof_client === "string") && (o.proof_consensus instanceof Uint8Array || typeof o.proof_consensus === "string") && Height.isSDK(o.consensus_height) && typeof o.signer === "string"); + }, + isAmino(o: any): o is MsgConnectionOpenTryAmino { + return o && (o.$typeUrl === MsgConnectionOpenTry.typeUrl || typeof o.client_id === "string" && typeof o.previous_connection_id === "string" && Counterparty.isAmino(o.counterparty) && typeof o.delay_period === "bigint" && Array.isArray(o.counterparty_versions) && (!o.counterparty_versions.length || Version.isAmino(o.counterparty_versions[0])) && Height.isAmino(o.proof_height) && (o.proof_init instanceof Uint8Array || typeof o.proof_init === "string") && (o.proof_client instanceof Uint8Array || typeof o.proof_client === "string") && (o.proof_consensus instanceof Uint8Array || typeof o.proof_consensus === "string") && Height.isAmino(o.consensus_height) && typeof o.signer === "string"); + }, encode(message: MsgConnectionOpenTry, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.clientId !== "") { writer.uint32(10).string(message.clientId); @@ -858,6 +894,14 @@ export const MsgConnectionOpenTry = { typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenTry", value: MsgConnectionOpenTry.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgConnectionOpenTry.typeUrl)) { + return; + } + Counterparty.registerTypeUrl(); + Version.registerTypeUrl(); + Height.registerTypeUrl(); } }; function createBaseMsgConnectionOpenTryResponse(): MsgConnectionOpenTryResponse { @@ -872,6 +916,15 @@ function createBaseMsgConnectionOpenTryResponse(): MsgConnectionOpenTryResponse export const MsgConnectionOpenTryResponse = { typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenTryResponse", aminoType: "cosmos-sdk/MsgConnectionOpenTryResponse", + is(o: any): o is MsgConnectionOpenTryResponse { + return o && o.$typeUrl === MsgConnectionOpenTryResponse.typeUrl; + }, + isSDK(o: any): o is MsgConnectionOpenTryResponseSDKType { + return o && o.$typeUrl === MsgConnectionOpenTryResponse.typeUrl; + }, + isAmino(o: any): o is MsgConnectionOpenTryResponseAmino { + return o && o.$typeUrl === MsgConnectionOpenTryResponse.typeUrl; + }, encode(_: MsgConnectionOpenTryResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -923,7 +976,8 @@ export const MsgConnectionOpenTryResponse = { typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenTryResponse", value: MsgConnectionOpenTryResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgConnectionOpenAck(): MsgConnectionOpenAck { return { @@ -949,6 +1003,15 @@ function createBaseMsgConnectionOpenAck(): MsgConnectionOpenAck { export const MsgConnectionOpenAck = { typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenAck", aminoType: "cosmos-sdk/MsgConnectionOpenAck", + is(o: any): o is MsgConnectionOpenAck { + return o && (o.$typeUrl === MsgConnectionOpenAck.typeUrl || typeof o.connectionId === "string" && typeof o.counterpartyConnectionId === "string" && Height.is(o.proofHeight) && (o.proofTry instanceof Uint8Array || typeof o.proofTry === "string") && (o.proofClient instanceof Uint8Array || typeof o.proofClient === "string") && (o.proofConsensus instanceof Uint8Array || typeof o.proofConsensus === "string") && Height.is(o.consensusHeight) && typeof o.signer === "string"); + }, + isSDK(o: any): o is MsgConnectionOpenAckSDKType { + return o && (o.$typeUrl === MsgConnectionOpenAck.typeUrl || typeof o.connection_id === "string" && typeof o.counterparty_connection_id === "string" && Height.isSDK(o.proof_height) && (o.proof_try instanceof Uint8Array || typeof o.proof_try === "string") && (o.proof_client instanceof Uint8Array || typeof o.proof_client === "string") && (o.proof_consensus instanceof Uint8Array || typeof o.proof_consensus === "string") && Height.isSDK(o.consensus_height) && typeof o.signer === "string"); + }, + isAmino(o: any): o is MsgConnectionOpenAckAmino { + return o && (o.$typeUrl === MsgConnectionOpenAck.typeUrl || typeof o.connection_id === "string" && typeof o.counterparty_connection_id === "string" && Height.isAmino(o.proof_height) && (o.proof_try instanceof Uint8Array || typeof o.proof_try === "string") && (o.proof_client instanceof Uint8Array || typeof o.proof_client === "string") && (o.proof_consensus instanceof Uint8Array || typeof o.proof_consensus === "string") && Height.isAmino(o.consensus_height) && typeof o.signer === "string"); + }, encode(message: MsgConnectionOpenAck, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.connectionId !== "") { writer.uint32(10).string(message.connectionId); @@ -1149,6 +1212,12 @@ export const MsgConnectionOpenAck = { typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenAck", value: MsgConnectionOpenAck.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgConnectionOpenAck.typeUrl)) { + return; + } + Height.registerTypeUrl(); } }; function createBaseMsgConnectionOpenAckResponse(): MsgConnectionOpenAckResponse { @@ -1163,6 +1232,15 @@ function createBaseMsgConnectionOpenAckResponse(): MsgConnectionOpenAckResponse export const MsgConnectionOpenAckResponse = { typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenAckResponse", aminoType: "cosmos-sdk/MsgConnectionOpenAckResponse", + is(o: any): o is MsgConnectionOpenAckResponse { + return o && o.$typeUrl === MsgConnectionOpenAckResponse.typeUrl; + }, + isSDK(o: any): o is MsgConnectionOpenAckResponseSDKType { + return o && o.$typeUrl === MsgConnectionOpenAckResponse.typeUrl; + }, + isAmino(o: any): o is MsgConnectionOpenAckResponseAmino { + return o && o.$typeUrl === MsgConnectionOpenAckResponse.typeUrl; + }, encode(_: MsgConnectionOpenAckResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -1214,7 +1292,8 @@ export const MsgConnectionOpenAckResponse = { typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenAckResponse", value: MsgConnectionOpenAckResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgConnectionOpenConfirm(): MsgConnectionOpenConfirm { return { @@ -1234,6 +1313,15 @@ function createBaseMsgConnectionOpenConfirm(): MsgConnectionOpenConfirm { export const MsgConnectionOpenConfirm = { typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenConfirm", aminoType: "cosmos-sdk/MsgConnectionOpenConfirm", + is(o: any): o is MsgConnectionOpenConfirm { + return o && (o.$typeUrl === MsgConnectionOpenConfirm.typeUrl || typeof o.connectionId === "string" && (o.proofAck instanceof Uint8Array || typeof o.proofAck === "string") && Height.is(o.proofHeight) && typeof o.signer === "string"); + }, + isSDK(o: any): o is MsgConnectionOpenConfirmSDKType { + return o && (o.$typeUrl === MsgConnectionOpenConfirm.typeUrl || typeof o.connection_id === "string" && (o.proof_ack instanceof Uint8Array || typeof o.proof_ack === "string") && Height.isSDK(o.proof_height) && typeof o.signer === "string"); + }, + isAmino(o: any): o is MsgConnectionOpenConfirmAmino { + return o && (o.$typeUrl === MsgConnectionOpenConfirm.typeUrl || typeof o.connection_id === "string" && (o.proof_ack instanceof Uint8Array || typeof o.proof_ack === "string") && Height.isAmino(o.proof_height) && typeof o.signer === "string"); + }, encode(message: MsgConnectionOpenConfirm, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.connectionId !== "") { writer.uint32(10).string(message.connectionId); @@ -1344,6 +1432,12 @@ export const MsgConnectionOpenConfirm = { typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenConfirm", value: MsgConnectionOpenConfirm.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgConnectionOpenConfirm.typeUrl)) { + return; + } + Height.registerTypeUrl(); } }; function createBaseMsgConnectionOpenConfirmResponse(): MsgConnectionOpenConfirmResponse { @@ -1359,6 +1453,15 @@ function createBaseMsgConnectionOpenConfirmResponse(): MsgConnectionOpenConfirmR export const MsgConnectionOpenConfirmResponse = { typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenConfirmResponse", aminoType: "cosmos-sdk/MsgConnectionOpenConfirmResponse", + is(o: any): o is MsgConnectionOpenConfirmResponse { + return o && o.$typeUrl === MsgConnectionOpenConfirmResponse.typeUrl; + }, + isSDK(o: any): o is MsgConnectionOpenConfirmResponseSDKType { + return o && o.$typeUrl === MsgConnectionOpenConfirmResponse.typeUrl; + }, + isAmino(o: any): o is MsgConnectionOpenConfirmResponseAmino { + return o && o.$typeUrl === MsgConnectionOpenConfirmResponse.typeUrl; + }, encode(_: MsgConnectionOpenConfirmResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -1410,5 +1513,6 @@ export const MsgConnectionOpenConfirmResponse = { typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenConfirmResponse", value: MsgConnectionOpenConfirmResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/ibc/core/port/v1/query.rpc.func.ts b/__fixtures__/v-next/outputv3/ibc/core/port/v1/query.rpc.func.ts new file mode 100644 index 0000000000..51bd763bc4 --- /dev/null +++ b/__fixtures__/v-next/outputv3/ibc/core/port/v1/query.rpc.func.ts @@ -0,0 +1,16 @@ +import { Order, OrderSDKType, Counterparty, CounterpartySDKType } from "../../channel/v1/channel"; +import { EndpointOrRpc, buildQuery } from "../../../../helper-func-types"; +import { QueryAppVersionRequest, QueryAppVersionRequestSDKType, QueryAppVersionResponse, QueryAppVersionResponseSDKType } from "./query"; +/** + * AppVersion queries an IBC Port and determines the appropriate application version to be used + * @name getAppVersion + * @package ibc.core.port.v1 + * @see proto service: ibc.core.port.v1.AppVersion + */ +export const getAppVersion = buildQuery({ + encode: QueryAppVersionRequest.encode, + decode: QueryAppVersionResponse.decode, + service: "ibc.core.port.v1.Query", + method: "AppVersion", + deps: [QueryAppVersionRequest, QueryAppVersionResponse] +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/ibc/core/port/v1/query.ts b/__fixtures__/v-next/outputv3/ibc/core/port/v1/query.ts index 0a848a710b..90ab8d5a0b 100644 --- a/__fixtures__/v-next/outputv3/ibc/core/port/v1/query.ts +++ b/__fixtures__/v-next/outputv3/ibc/core/port/v1/query.ts @@ -1,6 +1,7 @@ import { Order, OrderSDKType, Counterparty, CounterpartyAmino, CounterpartySDKType, orderFromJSON, orderToJSON } from "../../channel/v1/channel"; -import { BinaryReader, BinaryWriter } from "../../../../binary"; import { isSet, DeepPartial } from "../../../../helpers"; +import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { GlobalDecoderRegistry } from "../../../../registry"; export const protobufPackage = "ibc.core.port.v1"; /** * QueryAppVersionRequest is the request type for the Query/AppVersion RPC method @@ -139,6 +140,15 @@ function createBaseQueryAppVersionRequest(): QueryAppVersionRequest { export const QueryAppVersionRequest = { typeUrl: "/ibc.core.port.v1.QueryAppVersionRequest", aminoType: "cosmos-sdk/QueryAppVersionRequest", + is(o: any): o is QueryAppVersionRequest { + return o && (o.$typeUrl === QueryAppVersionRequest.typeUrl || typeof o.portId === "string" && typeof o.connectionId === "string" && isSet(o.ordering) && typeof o.proposedVersion === "string"); + }, + isSDK(o: any): o is QueryAppVersionRequestSDKType { + return o && (o.$typeUrl === QueryAppVersionRequest.typeUrl || typeof o.port_id === "string" && typeof o.connection_id === "string" && isSet(o.ordering) && typeof o.proposed_version === "string"); + }, + isAmino(o: any): o is QueryAppVersionRequestAmino { + return o && (o.$typeUrl === QueryAppVersionRequest.typeUrl || typeof o.port_id === "string" && typeof o.connection_id === "string" && isSet(o.ordering) && typeof o.proposed_version === "string"); + }, encode(message: QueryAppVersionRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.portId !== "") { writer.uint32(10).string(message.portId); @@ -263,6 +273,12 @@ export const QueryAppVersionRequest = { typeUrl: "/ibc.core.port.v1.QueryAppVersionRequest", value: QueryAppVersionRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryAppVersionRequest.typeUrl)) { + return; + } + Counterparty.registerTypeUrl(); } }; function createBaseQueryAppVersionResponse(): QueryAppVersionResponse { @@ -280,6 +296,15 @@ function createBaseQueryAppVersionResponse(): QueryAppVersionResponse { export const QueryAppVersionResponse = { typeUrl: "/ibc.core.port.v1.QueryAppVersionResponse", aminoType: "cosmos-sdk/QueryAppVersionResponse", + is(o: any): o is QueryAppVersionResponse { + return o && (o.$typeUrl === QueryAppVersionResponse.typeUrl || typeof o.portId === "string" && typeof o.version === "string"); + }, + isSDK(o: any): o is QueryAppVersionResponseSDKType { + return o && (o.$typeUrl === QueryAppVersionResponse.typeUrl || typeof o.port_id === "string" && typeof o.version === "string"); + }, + isAmino(o: any): o is QueryAppVersionResponseAmino { + return o && (o.$typeUrl === QueryAppVersionResponse.typeUrl || typeof o.port_id === "string" && typeof o.version === "string"); + }, encode(message: QueryAppVersionResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.portId !== "") { writer.uint32(10).string(message.portId); @@ -360,5 +385,6 @@ export const QueryAppVersionResponse = { typeUrl: "/ibc.core.port.v1.QueryAppVersionResponse", value: QueryAppVersionResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/ibc/core/types/v1/genesis.ts b/__fixtures__/v-next/outputv3/ibc/core/types/v1/genesis.ts index 63d2b6ed8d..9cb0062315 100644 --- a/__fixtures__/v-next/outputv3/ibc/core/types/v1/genesis.ts +++ b/__fixtures__/v-next/outputv3/ibc/core/types/v1/genesis.ts @@ -8,6 +8,7 @@ import { GenesisState as GenesisState3 } from "../../channel/v1/genesis"; import { GenesisStateAmino as GenesisState3Amino } from "../../channel/v1/genesis"; import { GenesisStateSDKType as GenesisState3SDKType } from "../../channel/v1/genesis"; import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { GlobalDecoderRegistry } from "../../../../registry"; import { isSet, DeepPartial } from "../../../../helpers"; export const protobufPackage = "ibc.core.types.v1"; /** @@ -81,6 +82,15 @@ function createBaseGenesisState(): GenesisState { export const GenesisState = { typeUrl: "/ibc.core.types.v1.GenesisState", aminoType: "cosmos-sdk/GenesisState", + is(o: any): o is GenesisState { + return o && (o.$typeUrl === GenesisState.typeUrl || GenesisState1.is(o.clientGenesis) && GenesisState2.is(o.connectionGenesis) && GenesisState3.is(o.channelGenesis)); + }, + isSDK(o: any): o is GenesisStateSDKType { + return o && (o.$typeUrl === GenesisState.typeUrl || GenesisState1.isSDK(o.client_genesis) && GenesisState2.isSDK(o.connection_genesis) && GenesisState3.isSDK(o.channel_genesis)); + }, + isAmino(o: any): o is GenesisStateAmino { + return o && (o.$typeUrl === GenesisState.typeUrl || GenesisState1.isAmino(o.client_genesis) && GenesisState2.isAmino(o.connection_genesis) && GenesisState3.isAmino(o.channel_genesis)); + }, encode(message: GenesisState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.clientGenesis !== undefined) { GenesisState1.encode(message.clientGenesis, writer.uint32(10).fork()).ldelim(); @@ -181,5 +191,13 @@ export const GenesisState = { typeUrl: "/ibc.core.types.v1.GenesisState", value: GenesisState.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GenesisState.typeUrl)) { + return; + } + GenesisState1.registerTypeUrl(); + GenesisState2.registerTypeUrl(); + GenesisState3.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/ibc/lightclients/localhost/v1/localhost.ts b/__fixtures__/v-next/outputv3/ibc/lightclients/localhost/v1/localhost.ts index ffd49762e9..a43f5f2fea 100644 --- a/__fixtures__/v-next/outputv3/ibc/lightclients/localhost/v1/localhost.ts +++ b/__fixtures__/v-next/outputv3/ibc/lightclients/localhost/v1/localhost.ts @@ -1,5 +1,6 @@ import { Height, HeightAmino, HeightSDKType } from "../../../core/client/v1/client"; import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { GlobalDecoderRegistry } from "../../../../registry"; import { isSet, DeepPartial } from "../../../../helpers"; export const protobufPackage = "ibc.lightclients.localhost.v1"; /** @@ -67,6 +68,15 @@ function createBaseClientState(): ClientState { export const ClientState = { typeUrl: "/ibc.lightclients.localhost.v1.ClientState", aminoType: "cosmos-sdk/ClientState", + is(o: any): o is ClientState { + return o && (o.$typeUrl === ClientState.typeUrl || typeof o.chainId === "string" && Height.is(o.height)); + }, + isSDK(o: any): o is ClientStateSDKType { + return o && (o.$typeUrl === ClientState.typeUrl || typeof o.chain_id === "string" && Height.isSDK(o.height)); + }, + isAmino(o: any): o is ClientStateAmino { + return o && (o.$typeUrl === ClientState.typeUrl || typeof o.chain_id === "string" && Height.isAmino(o.height)); + }, encode(message: ClientState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.chainId !== "") { writer.uint32(10).string(message.chainId); @@ -149,5 +159,11 @@ export const ClientState = { typeUrl: "/ibc.lightclients.localhost.v1.ClientState", value: ClientState.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ClientState.typeUrl)) { + return; + } + Height.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/ibc/lightclients/solomachine/v1/solomachine.ts b/__fixtures__/v-next/outputv3/ibc/lightclients/solomachine/v1/solomachine.ts index 13f80c85c2..e6172b9b56 100644 --- a/__fixtures__/v-next/outputv3/ibc/lightclients/solomachine/v1/solomachine.ts +++ b/__fixtures__/v-next/outputv3/ibc/lightclients/solomachine/v1/solomachine.ts @@ -2,6 +2,7 @@ import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../../google/proto import { ConnectionEnd, ConnectionEndAmino, ConnectionEndSDKType } from "../../../core/connection/v1/connection"; import { Channel, ChannelAmino, ChannelSDKType } from "../../../core/channel/v1/channel"; import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { GlobalDecoderRegistry } from "../../../../registry"; import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../../helpers"; export const protobufPackage = "ibc.lightclients.solomachine.v1"; /** @@ -801,6 +802,15 @@ function createBaseClientState(): ClientState { export const ClientState = { typeUrl: "/ibc.lightclients.solomachine.v1.ClientState", aminoType: "cosmos-sdk/ClientState", + is(o: any): o is ClientState { + return o && (o.$typeUrl === ClientState.typeUrl || typeof o.sequence === "bigint" && typeof o.frozenSequence === "bigint" && typeof o.allowUpdateAfterProposal === "boolean"); + }, + isSDK(o: any): o is ClientStateSDKType { + return o && (o.$typeUrl === ClientState.typeUrl || typeof o.sequence === "bigint" && typeof o.frozen_sequence === "bigint" && typeof o.allow_update_after_proposal === "boolean"); + }, + isAmino(o: any): o is ClientStateAmino { + return o && (o.$typeUrl === ClientState.typeUrl || typeof o.sequence === "bigint" && typeof o.frozen_sequence === "bigint" && typeof o.allow_update_after_proposal === "boolean"); + }, encode(message: ClientState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.sequence !== BigInt(0)) { writer.uint32(8).uint64(message.sequence); @@ -915,6 +925,12 @@ export const ClientState = { typeUrl: "/ibc.lightclients.solomachine.v1.ClientState", value: ClientState.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ClientState.typeUrl)) { + return; + } + ConsensusState.registerTypeUrl(); } }; function createBaseConsensusState(): ConsensusState { @@ -935,6 +951,15 @@ function createBaseConsensusState(): ConsensusState { export const ConsensusState = { typeUrl: "/ibc.lightclients.solomachine.v1.ConsensusState", aminoType: "cosmos-sdk/ConsensusState", + is(o: any): o is ConsensusState { + return o && (o.$typeUrl === ConsensusState.typeUrl || typeof o.diversifier === "string" && typeof o.timestamp === "bigint"); + }, + isSDK(o: any): o is ConsensusStateSDKType { + return o && (o.$typeUrl === ConsensusState.typeUrl || typeof o.diversifier === "string" && typeof o.timestamp === "bigint"); + }, + isAmino(o: any): o is ConsensusStateAmino { + return o && (o.$typeUrl === ConsensusState.typeUrl || typeof o.diversifier === "string" && typeof o.timestamp === "bigint"); + }, encode(message: ConsensusState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.publicKey !== undefined) { Any.encode(message.publicKey, writer.uint32(10).fork()).ldelim(); @@ -1033,7 +1058,8 @@ export const ConsensusState = { typeUrl: "/ibc.lightclients.solomachine.v1.ConsensusState", value: ConsensusState.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseHeader(): Header { return { @@ -1053,6 +1079,15 @@ function createBaseHeader(): Header { export const Header = { typeUrl: "/ibc.lightclients.solomachine.v1.Header", aminoType: "cosmos-sdk/Header", + is(o: any): o is Header { + return o && (o.$typeUrl === Header.typeUrl || typeof o.sequence === "bigint" && typeof o.timestamp === "bigint" && (o.signature instanceof Uint8Array || typeof o.signature === "string") && typeof o.newDiversifier === "string"); + }, + isSDK(o: any): o is HeaderSDKType { + return o && (o.$typeUrl === Header.typeUrl || typeof o.sequence === "bigint" && typeof o.timestamp === "bigint" && (o.signature instanceof Uint8Array || typeof o.signature === "string") && typeof o.new_diversifier === "string"); + }, + isAmino(o: any): o is HeaderAmino { + return o && (o.$typeUrl === Header.typeUrl || typeof o.sequence === "bigint" && typeof o.timestamp === "bigint" && (o.signature instanceof Uint8Array || typeof o.signature === "string") && typeof o.new_diversifier === "string"); + }, encode(message: Header, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.sequence !== BigInt(0)) { writer.uint32(8).uint64(message.sequence); @@ -1181,7 +1216,8 @@ export const Header = { typeUrl: "/ibc.lightclients.solomachine.v1.Header", value: Header.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMisbehaviour(): Misbehaviour { return { @@ -1201,6 +1237,15 @@ function createBaseMisbehaviour(): Misbehaviour { export const Misbehaviour = { typeUrl: "/ibc.lightclients.solomachine.v1.Misbehaviour", aminoType: "cosmos-sdk/Misbehaviour", + is(o: any): o is Misbehaviour { + return o && (o.$typeUrl === Misbehaviour.typeUrl || typeof o.clientId === "string" && typeof o.sequence === "bigint"); + }, + isSDK(o: any): o is MisbehaviourSDKType { + return o && (o.$typeUrl === Misbehaviour.typeUrl || typeof o.client_id === "string" && typeof o.sequence === "bigint"); + }, + isAmino(o: any): o is MisbehaviourAmino { + return o && (o.$typeUrl === Misbehaviour.typeUrl || typeof o.client_id === "string" && typeof o.sequence === "bigint"); + }, encode(message: Misbehaviour, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.clientId !== "") { writer.uint32(10).string(message.clientId); @@ -1315,6 +1360,12 @@ export const Misbehaviour = { typeUrl: "/ibc.lightclients.solomachine.v1.Misbehaviour", value: Misbehaviour.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Misbehaviour.typeUrl)) { + return; + } + SignatureAndData.registerTypeUrl(); } }; function createBaseSignatureAndData(): SignatureAndData { @@ -1335,6 +1386,15 @@ function createBaseSignatureAndData(): SignatureAndData { export const SignatureAndData = { typeUrl: "/ibc.lightclients.solomachine.v1.SignatureAndData", aminoType: "cosmos-sdk/SignatureAndData", + is(o: any): o is SignatureAndData { + return o && (o.$typeUrl === SignatureAndData.typeUrl || (o.signature instanceof Uint8Array || typeof o.signature === "string") && isSet(o.dataType) && (o.data instanceof Uint8Array || typeof o.data === "string") && typeof o.timestamp === "bigint"); + }, + isSDK(o: any): o is SignatureAndDataSDKType { + return o && (o.$typeUrl === SignatureAndData.typeUrl || (o.signature instanceof Uint8Array || typeof o.signature === "string") && isSet(o.data_type) && (o.data instanceof Uint8Array || typeof o.data === "string") && typeof o.timestamp === "bigint"); + }, + isAmino(o: any): o is SignatureAndDataAmino { + return o && (o.$typeUrl === SignatureAndData.typeUrl || (o.signature instanceof Uint8Array || typeof o.signature === "string") && isSet(o.data_type) && (o.data instanceof Uint8Array || typeof o.data === "string") && typeof o.timestamp === "bigint"); + }, encode(message: SignatureAndData, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.signature.length !== 0) { writer.uint32(10).bytes(message.signature); @@ -1445,7 +1505,8 @@ export const SignatureAndData = { typeUrl: "/ibc.lightclients.solomachine.v1.SignatureAndData", value: SignatureAndData.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseTimestampedSignatureData(): TimestampedSignatureData { return { @@ -1463,6 +1524,15 @@ function createBaseTimestampedSignatureData(): TimestampedSignatureData { export const TimestampedSignatureData = { typeUrl: "/ibc.lightclients.solomachine.v1.TimestampedSignatureData", aminoType: "cosmos-sdk/TimestampedSignatureData", + is(o: any): o is TimestampedSignatureData { + return o && (o.$typeUrl === TimestampedSignatureData.typeUrl || (o.signatureData instanceof Uint8Array || typeof o.signatureData === "string") && typeof o.timestamp === "bigint"); + }, + isSDK(o: any): o is TimestampedSignatureDataSDKType { + return o && (o.$typeUrl === TimestampedSignatureData.typeUrl || (o.signature_data instanceof Uint8Array || typeof o.signature_data === "string") && typeof o.timestamp === "bigint"); + }, + isAmino(o: any): o is TimestampedSignatureDataAmino { + return o && (o.$typeUrl === TimestampedSignatureData.typeUrl || (o.signature_data instanceof Uint8Array || typeof o.signature_data === "string") && typeof o.timestamp === "bigint"); + }, encode(message: TimestampedSignatureData, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.signatureData.length !== 0) { writer.uint32(10).bytes(message.signatureData); @@ -1545,7 +1615,8 @@ export const TimestampedSignatureData = { typeUrl: "/ibc.lightclients.solomachine.v1.TimestampedSignatureData", value: TimestampedSignatureData.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseSignBytes(): SignBytes { return { @@ -1565,6 +1636,15 @@ function createBaseSignBytes(): SignBytes { export const SignBytes = { typeUrl: "/ibc.lightclients.solomachine.v1.SignBytes", aminoType: "cosmos-sdk/SignBytes", + is(o: any): o is SignBytes { + return o && (o.$typeUrl === SignBytes.typeUrl || typeof o.sequence === "bigint" && typeof o.timestamp === "bigint" && typeof o.diversifier === "string" && isSet(o.dataType) && (o.data instanceof Uint8Array || typeof o.data === "string")); + }, + isSDK(o: any): o is SignBytesSDKType { + return o && (o.$typeUrl === SignBytes.typeUrl || typeof o.sequence === "bigint" && typeof o.timestamp === "bigint" && typeof o.diversifier === "string" && isSet(o.data_type) && (o.data instanceof Uint8Array || typeof o.data === "string")); + }, + isAmino(o: any): o is SignBytesAmino { + return o && (o.$typeUrl === SignBytes.typeUrl || typeof o.sequence === "bigint" && typeof o.timestamp === "bigint" && typeof o.diversifier === "string" && isSet(o.data_type) && (o.data instanceof Uint8Array || typeof o.data === "string")); + }, encode(message: SignBytes, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.sequence !== BigInt(0)) { writer.uint32(8).uint64(message.sequence); @@ -1691,7 +1771,8 @@ export const SignBytes = { typeUrl: "/ibc.lightclients.solomachine.v1.SignBytes", value: SignBytes.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseHeaderData(): HeaderData { return { @@ -1708,6 +1789,15 @@ function createBaseHeaderData(): HeaderData { export const HeaderData = { typeUrl: "/ibc.lightclients.solomachine.v1.HeaderData", aminoType: "cosmos-sdk/HeaderData", + is(o: any): o is HeaderData { + return o && (o.$typeUrl === HeaderData.typeUrl || typeof o.newDiversifier === "string"); + }, + isSDK(o: any): o is HeaderDataSDKType { + return o && (o.$typeUrl === HeaderData.typeUrl || typeof o.new_diversifier === "string"); + }, + isAmino(o: any): o is HeaderDataAmino { + return o && (o.$typeUrl === HeaderData.typeUrl || typeof o.new_diversifier === "string"); + }, encode(message: HeaderData, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.newPubKey !== undefined) { Any.encode(message.newPubKey, writer.uint32(10).fork()).ldelim(); @@ -1790,7 +1880,8 @@ export const HeaderData = { typeUrl: "/ibc.lightclients.solomachine.v1.HeaderData", value: HeaderData.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseClientStateData(): ClientStateData { return { @@ -1807,6 +1898,15 @@ function createBaseClientStateData(): ClientStateData { export const ClientStateData = { typeUrl: "/ibc.lightclients.solomachine.v1.ClientStateData", aminoType: "cosmos-sdk/ClientStateData", + is(o: any): o is ClientStateData { + return o && (o.$typeUrl === ClientStateData.typeUrl || o.path instanceof Uint8Array || typeof o.path === "string"); + }, + isSDK(o: any): o is ClientStateDataSDKType { + return o && (o.$typeUrl === ClientStateData.typeUrl || o.path instanceof Uint8Array || typeof o.path === "string"); + }, + isAmino(o: any): o is ClientStateDataAmino { + return o && (o.$typeUrl === ClientStateData.typeUrl || o.path instanceof Uint8Array || typeof o.path === "string"); + }, encode(message: ClientStateData, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.path.length !== 0) { writer.uint32(10).bytes(message.path); @@ -1889,7 +1989,8 @@ export const ClientStateData = { typeUrl: "/ibc.lightclients.solomachine.v1.ClientStateData", value: ClientStateData.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseConsensusStateData(): ConsensusStateData { return { @@ -1907,6 +2008,15 @@ function createBaseConsensusStateData(): ConsensusStateData { export const ConsensusStateData = { typeUrl: "/ibc.lightclients.solomachine.v1.ConsensusStateData", aminoType: "cosmos-sdk/ConsensusStateData", + is(o: any): o is ConsensusStateData { + return o && (o.$typeUrl === ConsensusStateData.typeUrl || o.path instanceof Uint8Array || typeof o.path === "string"); + }, + isSDK(o: any): o is ConsensusStateDataSDKType { + return o && (o.$typeUrl === ConsensusStateData.typeUrl || o.path instanceof Uint8Array || typeof o.path === "string"); + }, + isAmino(o: any): o is ConsensusStateDataAmino { + return o && (o.$typeUrl === ConsensusStateData.typeUrl || o.path instanceof Uint8Array || typeof o.path === "string"); + }, encode(message: ConsensusStateData, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.path.length !== 0) { writer.uint32(10).bytes(message.path); @@ -1989,7 +2099,8 @@ export const ConsensusStateData = { typeUrl: "/ibc.lightclients.solomachine.v1.ConsensusStateData", value: ConsensusStateData.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseConnectionStateData(): ConnectionStateData { return { @@ -2007,6 +2118,15 @@ function createBaseConnectionStateData(): ConnectionStateData { export const ConnectionStateData = { typeUrl: "/ibc.lightclients.solomachine.v1.ConnectionStateData", aminoType: "cosmos-sdk/ConnectionStateData", + is(o: any): o is ConnectionStateData { + return o && (o.$typeUrl === ConnectionStateData.typeUrl || o.path instanceof Uint8Array || typeof o.path === "string"); + }, + isSDK(o: any): o is ConnectionStateDataSDKType { + return o && (o.$typeUrl === ConnectionStateData.typeUrl || o.path instanceof Uint8Array || typeof o.path === "string"); + }, + isAmino(o: any): o is ConnectionStateDataAmino { + return o && (o.$typeUrl === ConnectionStateData.typeUrl || o.path instanceof Uint8Array || typeof o.path === "string"); + }, encode(message: ConnectionStateData, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.path.length !== 0) { writer.uint32(10).bytes(message.path); @@ -2089,6 +2209,12 @@ export const ConnectionStateData = { typeUrl: "/ibc.lightclients.solomachine.v1.ConnectionStateData", value: ConnectionStateData.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ConnectionStateData.typeUrl)) { + return; + } + ConnectionEnd.registerTypeUrl(); } }; function createBaseChannelStateData(): ChannelStateData { @@ -2107,6 +2233,15 @@ function createBaseChannelStateData(): ChannelStateData { export const ChannelStateData = { typeUrl: "/ibc.lightclients.solomachine.v1.ChannelStateData", aminoType: "cosmos-sdk/ChannelStateData", + is(o: any): o is ChannelStateData { + return o && (o.$typeUrl === ChannelStateData.typeUrl || o.path instanceof Uint8Array || typeof o.path === "string"); + }, + isSDK(o: any): o is ChannelStateDataSDKType { + return o && (o.$typeUrl === ChannelStateData.typeUrl || o.path instanceof Uint8Array || typeof o.path === "string"); + }, + isAmino(o: any): o is ChannelStateDataAmino { + return o && (o.$typeUrl === ChannelStateData.typeUrl || o.path instanceof Uint8Array || typeof o.path === "string"); + }, encode(message: ChannelStateData, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.path.length !== 0) { writer.uint32(10).bytes(message.path); @@ -2189,6 +2324,12 @@ export const ChannelStateData = { typeUrl: "/ibc.lightclients.solomachine.v1.ChannelStateData", value: ChannelStateData.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ChannelStateData.typeUrl)) { + return; + } + Channel.registerTypeUrl(); } }; function createBasePacketCommitmentData(): PacketCommitmentData { @@ -2207,6 +2348,15 @@ function createBasePacketCommitmentData(): PacketCommitmentData { export const PacketCommitmentData = { typeUrl: "/ibc.lightclients.solomachine.v1.PacketCommitmentData", aminoType: "cosmos-sdk/PacketCommitmentData", + is(o: any): o is PacketCommitmentData { + return o && (o.$typeUrl === PacketCommitmentData.typeUrl || (o.path instanceof Uint8Array || typeof o.path === "string") && (o.commitment instanceof Uint8Array || typeof o.commitment === "string")); + }, + isSDK(o: any): o is PacketCommitmentDataSDKType { + return o && (o.$typeUrl === PacketCommitmentData.typeUrl || (o.path instanceof Uint8Array || typeof o.path === "string") && (o.commitment instanceof Uint8Array || typeof o.commitment === "string")); + }, + isAmino(o: any): o is PacketCommitmentDataAmino { + return o && (o.$typeUrl === PacketCommitmentData.typeUrl || (o.path instanceof Uint8Array || typeof o.path === "string") && (o.commitment instanceof Uint8Array || typeof o.commitment === "string")); + }, encode(message: PacketCommitmentData, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.path.length !== 0) { writer.uint32(10).bytes(message.path); @@ -2287,7 +2437,8 @@ export const PacketCommitmentData = { typeUrl: "/ibc.lightclients.solomachine.v1.PacketCommitmentData", value: PacketCommitmentData.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBasePacketAcknowledgementData(): PacketAcknowledgementData { return { @@ -2305,6 +2456,15 @@ function createBasePacketAcknowledgementData(): PacketAcknowledgementData { export const PacketAcknowledgementData = { typeUrl: "/ibc.lightclients.solomachine.v1.PacketAcknowledgementData", aminoType: "cosmos-sdk/PacketAcknowledgementData", + is(o: any): o is PacketAcknowledgementData { + return o && (o.$typeUrl === PacketAcknowledgementData.typeUrl || (o.path instanceof Uint8Array || typeof o.path === "string") && (o.acknowledgement instanceof Uint8Array || typeof o.acknowledgement === "string")); + }, + isSDK(o: any): o is PacketAcknowledgementDataSDKType { + return o && (o.$typeUrl === PacketAcknowledgementData.typeUrl || (o.path instanceof Uint8Array || typeof o.path === "string") && (o.acknowledgement instanceof Uint8Array || typeof o.acknowledgement === "string")); + }, + isAmino(o: any): o is PacketAcknowledgementDataAmino { + return o && (o.$typeUrl === PacketAcknowledgementData.typeUrl || (o.path instanceof Uint8Array || typeof o.path === "string") && (o.acknowledgement instanceof Uint8Array || typeof o.acknowledgement === "string")); + }, encode(message: PacketAcknowledgementData, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.path.length !== 0) { writer.uint32(10).bytes(message.path); @@ -2385,7 +2545,8 @@ export const PacketAcknowledgementData = { typeUrl: "/ibc.lightclients.solomachine.v1.PacketAcknowledgementData", value: PacketAcknowledgementData.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBasePacketReceiptAbsenceData(): PacketReceiptAbsenceData { return { @@ -2402,6 +2563,15 @@ function createBasePacketReceiptAbsenceData(): PacketReceiptAbsenceData { export const PacketReceiptAbsenceData = { typeUrl: "/ibc.lightclients.solomachine.v1.PacketReceiptAbsenceData", aminoType: "cosmos-sdk/PacketReceiptAbsenceData", + is(o: any): o is PacketReceiptAbsenceData { + return o && (o.$typeUrl === PacketReceiptAbsenceData.typeUrl || o.path instanceof Uint8Array || typeof o.path === "string"); + }, + isSDK(o: any): o is PacketReceiptAbsenceDataSDKType { + return o && (o.$typeUrl === PacketReceiptAbsenceData.typeUrl || o.path instanceof Uint8Array || typeof o.path === "string"); + }, + isAmino(o: any): o is PacketReceiptAbsenceDataAmino { + return o && (o.$typeUrl === PacketReceiptAbsenceData.typeUrl || o.path instanceof Uint8Array || typeof o.path === "string"); + }, encode(message: PacketReceiptAbsenceData, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.path.length !== 0) { writer.uint32(10).bytes(message.path); @@ -2468,7 +2638,8 @@ export const PacketReceiptAbsenceData = { typeUrl: "/ibc.lightclients.solomachine.v1.PacketReceiptAbsenceData", value: PacketReceiptAbsenceData.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseNextSequenceRecvData(): NextSequenceRecvData { return { @@ -2486,6 +2657,15 @@ function createBaseNextSequenceRecvData(): NextSequenceRecvData { export const NextSequenceRecvData = { typeUrl: "/ibc.lightclients.solomachine.v1.NextSequenceRecvData", aminoType: "cosmos-sdk/NextSequenceRecvData", + is(o: any): o is NextSequenceRecvData { + return o && (o.$typeUrl === NextSequenceRecvData.typeUrl || (o.path instanceof Uint8Array || typeof o.path === "string") && typeof o.nextSeqRecv === "bigint"); + }, + isSDK(o: any): o is NextSequenceRecvDataSDKType { + return o && (o.$typeUrl === NextSequenceRecvData.typeUrl || (o.path instanceof Uint8Array || typeof o.path === "string") && typeof o.next_seq_recv === "bigint"); + }, + isAmino(o: any): o is NextSequenceRecvDataAmino { + return o && (o.$typeUrl === NextSequenceRecvData.typeUrl || (o.path instanceof Uint8Array || typeof o.path === "string") && typeof o.next_seq_recv === "bigint"); + }, encode(message: NextSequenceRecvData, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.path.length !== 0) { writer.uint32(10).bytes(message.path); @@ -2568,5 +2748,6 @@ export const NextSequenceRecvData = { typeUrl: "/ibc.lightclients.solomachine.v1.NextSequenceRecvData", value: NextSequenceRecvData.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/ibc/lightclients/solomachine/v2/solomachine.ts b/__fixtures__/v-next/outputv3/ibc/lightclients/solomachine/v2/solomachine.ts index 098e607de4..314e5800e7 100644 --- a/__fixtures__/v-next/outputv3/ibc/lightclients/solomachine/v2/solomachine.ts +++ b/__fixtures__/v-next/outputv3/ibc/lightclients/solomachine/v2/solomachine.ts @@ -2,6 +2,7 @@ import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../../google/proto import { ConnectionEnd, ConnectionEndAmino, ConnectionEndSDKType } from "../../../core/connection/v1/connection"; import { Channel, ChannelAmino, ChannelSDKType } from "../../../core/channel/v1/channel"; import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { GlobalDecoderRegistry } from "../../../../registry"; import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../../helpers"; export const protobufPackage = "ibc.lightclients.solomachine.v2"; /** @@ -801,6 +802,15 @@ function createBaseClientState(): ClientState { export const ClientState = { typeUrl: "/ibc.lightclients.solomachine.v2.ClientState", aminoType: "cosmos-sdk/ClientState", + is(o: any): o is ClientState { + return o && (o.$typeUrl === ClientState.typeUrl || typeof o.sequence === "bigint" && typeof o.isFrozen === "boolean" && typeof o.allowUpdateAfterProposal === "boolean"); + }, + isSDK(o: any): o is ClientStateSDKType { + return o && (o.$typeUrl === ClientState.typeUrl || typeof o.sequence === "bigint" && typeof o.is_frozen === "boolean" && typeof o.allow_update_after_proposal === "boolean"); + }, + isAmino(o: any): o is ClientStateAmino { + return o && (o.$typeUrl === ClientState.typeUrl || typeof o.sequence === "bigint" && typeof o.is_frozen === "boolean" && typeof o.allow_update_after_proposal === "boolean"); + }, encode(message: ClientState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.sequence !== BigInt(0)) { writer.uint32(8).uint64(message.sequence); @@ -913,6 +923,12 @@ export const ClientState = { typeUrl: "/ibc.lightclients.solomachine.v2.ClientState", value: ClientState.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ClientState.typeUrl)) { + return; + } + ConsensusState.registerTypeUrl(); } }; function createBaseConsensusState(): ConsensusState { @@ -933,6 +949,15 @@ function createBaseConsensusState(): ConsensusState { export const ConsensusState = { typeUrl: "/ibc.lightclients.solomachine.v2.ConsensusState", aminoType: "cosmos-sdk/ConsensusState", + is(o: any): o is ConsensusState { + return o && (o.$typeUrl === ConsensusState.typeUrl || typeof o.diversifier === "string" && typeof o.timestamp === "bigint"); + }, + isSDK(o: any): o is ConsensusStateSDKType { + return o && (o.$typeUrl === ConsensusState.typeUrl || typeof o.diversifier === "string" && typeof o.timestamp === "bigint"); + }, + isAmino(o: any): o is ConsensusStateAmino { + return o && (o.$typeUrl === ConsensusState.typeUrl || typeof o.diversifier === "string" && typeof o.timestamp === "bigint"); + }, encode(message: ConsensusState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.publicKey !== undefined) { Any.encode(message.publicKey, writer.uint32(10).fork()).ldelim(); @@ -1031,7 +1056,8 @@ export const ConsensusState = { typeUrl: "/ibc.lightclients.solomachine.v2.ConsensusState", value: ConsensusState.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseHeader(): Header { return { @@ -1051,6 +1077,15 @@ function createBaseHeader(): Header { export const Header = { typeUrl: "/ibc.lightclients.solomachine.v2.Header", aminoType: "cosmos-sdk/Header", + is(o: any): o is Header { + return o && (o.$typeUrl === Header.typeUrl || typeof o.sequence === "bigint" && typeof o.timestamp === "bigint" && (o.signature instanceof Uint8Array || typeof o.signature === "string") && typeof o.newDiversifier === "string"); + }, + isSDK(o: any): o is HeaderSDKType { + return o && (o.$typeUrl === Header.typeUrl || typeof o.sequence === "bigint" && typeof o.timestamp === "bigint" && (o.signature instanceof Uint8Array || typeof o.signature === "string") && typeof o.new_diversifier === "string"); + }, + isAmino(o: any): o is HeaderAmino { + return o && (o.$typeUrl === Header.typeUrl || typeof o.sequence === "bigint" && typeof o.timestamp === "bigint" && (o.signature instanceof Uint8Array || typeof o.signature === "string") && typeof o.new_diversifier === "string"); + }, encode(message: Header, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.sequence !== BigInt(0)) { writer.uint32(8).uint64(message.sequence); @@ -1179,7 +1214,8 @@ export const Header = { typeUrl: "/ibc.lightclients.solomachine.v2.Header", value: Header.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMisbehaviour(): Misbehaviour { return { @@ -1199,6 +1235,15 @@ function createBaseMisbehaviour(): Misbehaviour { export const Misbehaviour = { typeUrl: "/ibc.lightclients.solomachine.v2.Misbehaviour", aminoType: "cosmos-sdk/Misbehaviour", + is(o: any): o is Misbehaviour { + return o && (o.$typeUrl === Misbehaviour.typeUrl || typeof o.clientId === "string" && typeof o.sequence === "bigint"); + }, + isSDK(o: any): o is MisbehaviourSDKType { + return o && (o.$typeUrl === Misbehaviour.typeUrl || typeof o.client_id === "string" && typeof o.sequence === "bigint"); + }, + isAmino(o: any): o is MisbehaviourAmino { + return o && (o.$typeUrl === Misbehaviour.typeUrl || typeof o.client_id === "string" && typeof o.sequence === "bigint"); + }, encode(message: Misbehaviour, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.clientId !== "") { writer.uint32(10).string(message.clientId); @@ -1313,6 +1358,12 @@ export const Misbehaviour = { typeUrl: "/ibc.lightclients.solomachine.v2.Misbehaviour", value: Misbehaviour.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Misbehaviour.typeUrl)) { + return; + } + SignatureAndData.registerTypeUrl(); } }; function createBaseSignatureAndData(): SignatureAndData { @@ -1333,6 +1384,15 @@ function createBaseSignatureAndData(): SignatureAndData { export const SignatureAndData = { typeUrl: "/ibc.lightclients.solomachine.v2.SignatureAndData", aminoType: "cosmos-sdk/SignatureAndData", + is(o: any): o is SignatureAndData { + return o && (o.$typeUrl === SignatureAndData.typeUrl || (o.signature instanceof Uint8Array || typeof o.signature === "string") && isSet(o.dataType) && (o.data instanceof Uint8Array || typeof o.data === "string") && typeof o.timestamp === "bigint"); + }, + isSDK(o: any): o is SignatureAndDataSDKType { + return o && (o.$typeUrl === SignatureAndData.typeUrl || (o.signature instanceof Uint8Array || typeof o.signature === "string") && isSet(o.data_type) && (o.data instanceof Uint8Array || typeof o.data === "string") && typeof o.timestamp === "bigint"); + }, + isAmino(o: any): o is SignatureAndDataAmino { + return o && (o.$typeUrl === SignatureAndData.typeUrl || (o.signature instanceof Uint8Array || typeof o.signature === "string") && isSet(o.data_type) && (o.data instanceof Uint8Array || typeof o.data === "string") && typeof o.timestamp === "bigint"); + }, encode(message: SignatureAndData, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.signature.length !== 0) { writer.uint32(10).bytes(message.signature); @@ -1443,7 +1503,8 @@ export const SignatureAndData = { typeUrl: "/ibc.lightclients.solomachine.v2.SignatureAndData", value: SignatureAndData.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseTimestampedSignatureData(): TimestampedSignatureData { return { @@ -1461,6 +1522,15 @@ function createBaseTimestampedSignatureData(): TimestampedSignatureData { export const TimestampedSignatureData = { typeUrl: "/ibc.lightclients.solomachine.v2.TimestampedSignatureData", aminoType: "cosmos-sdk/TimestampedSignatureData", + is(o: any): o is TimestampedSignatureData { + return o && (o.$typeUrl === TimestampedSignatureData.typeUrl || (o.signatureData instanceof Uint8Array || typeof o.signatureData === "string") && typeof o.timestamp === "bigint"); + }, + isSDK(o: any): o is TimestampedSignatureDataSDKType { + return o && (o.$typeUrl === TimestampedSignatureData.typeUrl || (o.signature_data instanceof Uint8Array || typeof o.signature_data === "string") && typeof o.timestamp === "bigint"); + }, + isAmino(o: any): o is TimestampedSignatureDataAmino { + return o && (o.$typeUrl === TimestampedSignatureData.typeUrl || (o.signature_data instanceof Uint8Array || typeof o.signature_data === "string") && typeof o.timestamp === "bigint"); + }, encode(message: TimestampedSignatureData, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.signatureData.length !== 0) { writer.uint32(10).bytes(message.signatureData); @@ -1543,7 +1613,8 @@ export const TimestampedSignatureData = { typeUrl: "/ibc.lightclients.solomachine.v2.TimestampedSignatureData", value: TimestampedSignatureData.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseSignBytes(): SignBytes { return { @@ -1563,6 +1634,15 @@ function createBaseSignBytes(): SignBytes { export const SignBytes = { typeUrl: "/ibc.lightclients.solomachine.v2.SignBytes", aminoType: "cosmos-sdk/SignBytes", + is(o: any): o is SignBytes { + return o && (o.$typeUrl === SignBytes.typeUrl || typeof o.sequence === "bigint" && typeof o.timestamp === "bigint" && typeof o.diversifier === "string" && isSet(o.dataType) && (o.data instanceof Uint8Array || typeof o.data === "string")); + }, + isSDK(o: any): o is SignBytesSDKType { + return o && (o.$typeUrl === SignBytes.typeUrl || typeof o.sequence === "bigint" && typeof o.timestamp === "bigint" && typeof o.diversifier === "string" && isSet(o.data_type) && (o.data instanceof Uint8Array || typeof o.data === "string")); + }, + isAmino(o: any): o is SignBytesAmino { + return o && (o.$typeUrl === SignBytes.typeUrl || typeof o.sequence === "bigint" && typeof o.timestamp === "bigint" && typeof o.diversifier === "string" && isSet(o.data_type) && (o.data instanceof Uint8Array || typeof o.data === "string")); + }, encode(message: SignBytes, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.sequence !== BigInt(0)) { writer.uint32(8).uint64(message.sequence); @@ -1689,7 +1769,8 @@ export const SignBytes = { typeUrl: "/ibc.lightclients.solomachine.v2.SignBytes", value: SignBytes.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseHeaderData(): HeaderData { return { @@ -1706,6 +1787,15 @@ function createBaseHeaderData(): HeaderData { export const HeaderData = { typeUrl: "/ibc.lightclients.solomachine.v2.HeaderData", aminoType: "cosmos-sdk/HeaderData", + is(o: any): o is HeaderData { + return o && (o.$typeUrl === HeaderData.typeUrl || typeof o.newDiversifier === "string"); + }, + isSDK(o: any): o is HeaderDataSDKType { + return o && (o.$typeUrl === HeaderData.typeUrl || typeof o.new_diversifier === "string"); + }, + isAmino(o: any): o is HeaderDataAmino { + return o && (o.$typeUrl === HeaderData.typeUrl || typeof o.new_diversifier === "string"); + }, encode(message: HeaderData, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.newPubKey !== undefined) { Any.encode(message.newPubKey, writer.uint32(10).fork()).ldelim(); @@ -1788,7 +1878,8 @@ export const HeaderData = { typeUrl: "/ibc.lightclients.solomachine.v2.HeaderData", value: HeaderData.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseClientStateData(): ClientStateData { return { @@ -1805,6 +1896,15 @@ function createBaseClientStateData(): ClientStateData { export const ClientStateData = { typeUrl: "/ibc.lightclients.solomachine.v2.ClientStateData", aminoType: "cosmos-sdk/ClientStateData", + is(o: any): o is ClientStateData { + return o && (o.$typeUrl === ClientStateData.typeUrl || o.path instanceof Uint8Array || typeof o.path === "string"); + }, + isSDK(o: any): o is ClientStateDataSDKType { + return o && (o.$typeUrl === ClientStateData.typeUrl || o.path instanceof Uint8Array || typeof o.path === "string"); + }, + isAmino(o: any): o is ClientStateDataAmino { + return o && (o.$typeUrl === ClientStateData.typeUrl || o.path instanceof Uint8Array || typeof o.path === "string"); + }, encode(message: ClientStateData, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.path.length !== 0) { writer.uint32(10).bytes(message.path); @@ -1887,7 +1987,8 @@ export const ClientStateData = { typeUrl: "/ibc.lightclients.solomachine.v2.ClientStateData", value: ClientStateData.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseConsensusStateData(): ConsensusStateData { return { @@ -1905,6 +2006,15 @@ function createBaseConsensusStateData(): ConsensusStateData { export const ConsensusStateData = { typeUrl: "/ibc.lightclients.solomachine.v2.ConsensusStateData", aminoType: "cosmos-sdk/ConsensusStateData", + is(o: any): o is ConsensusStateData { + return o && (o.$typeUrl === ConsensusStateData.typeUrl || o.path instanceof Uint8Array || typeof o.path === "string"); + }, + isSDK(o: any): o is ConsensusStateDataSDKType { + return o && (o.$typeUrl === ConsensusStateData.typeUrl || o.path instanceof Uint8Array || typeof o.path === "string"); + }, + isAmino(o: any): o is ConsensusStateDataAmino { + return o && (o.$typeUrl === ConsensusStateData.typeUrl || o.path instanceof Uint8Array || typeof o.path === "string"); + }, encode(message: ConsensusStateData, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.path.length !== 0) { writer.uint32(10).bytes(message.path); @@ -1987,7 +2097,8 @@ export const ConsensusStateData = { typeUrl: "/ibc.lightclients.solomachine.v2.ConsensusStateData", value: ConsensusStateData.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseConnectionStateData(): ConnectionStateData { return { @@ -2005,6 +2116,15 @@ function createBaseConnectionStateData(): ConnectionStateData { export const ConnectionStateData = { typeUrl: "/ibc.lightclients.solomachine.v2.ConnectionStateData", aminoType: "cosmos-sdk/ConnectionStateData", + is(o: any): o is ConnectionStateData { + return o && (o.$typeUrl === ConnectionStateData.typeUrl || o.path instanceof Uint8Array || typeof o.path === "string"); + }, + isSDK(o: any): o is ConnectionStateDataSDKType { + return o && (o.$typeUrl === ConnectionStateData.typeUrl || o.path instanceof Uint8Array || typeof o.path === "string"); + }, + isAmino(o: any): o is ConnectionStateDataAmino { + return o && (o.$typeUrl === ConnectionStateData.typeUrl || o.path instanceof Uint8Array || typeof o.path === "string"); + }, encode(message: ConnectionStateData, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.path.length !== 0) { writer.uint32(10).bytes(message.path); @@ -2087,6 +2207,12 @@ export const ConnectionStateData = { typeUrl: "/ibc.lightclients.solomachine.v2.ConnectionStateData", value: ConnectionStateData.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ConnectionStateData.typeUrl)) { + return; + } + ConnectionEnd.registerTypeUrl(); } }; function createBaseChannelStateData(): ChannelStateData { @@ -2105,6 +2231,15 @@ function createBaseChannelStateData(): ChannelStateData { export const ChannelStateData = { typeUrl: "/ibc.lightclients.solomachine.v2.ChannelStateData", aminoType: "cosmos-sdk/ChannelStateData", + is(o: any): o is ChannelStateData { + return o && (o.$typeUrl === ChannelStateData.typeUrl || o.path instanceof Uint8Array || typeof o.path === "string"); + }, + isSDK(o: any): o is ChannelStateDataSDKType { + return o && (o.$typeUrl === ChannelStateData.typeUrl || o.path instanceof Uint8Array || typeof o.path === "string"); + }, + isAmino(o: any): o is ChannelStateDataAmino { + return o && (o.$typeUrl === ChannelStateData.typeUrl || o.path instanceof Uint8Array || typeof o.path === "string"); + }, encode(message: ChannelStateData, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.path.length !== 0) { writer.uint32(10).bytes(message.path); @@ -2187,6 +2322,12 @@ export const ChannelStateData = { typeUrl: "/ibc.lightclients.solomachine.v2.ChannelStateData", value: ChannelStateData.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ChannelStateData.typeUrl)) { + return; + } + Channel.registerTypeUrl(); } }; function createBasePacketCommitmentData(): PacketCommitmentData { @@ -2205,6 +2346,15 @@ function createBasePacketCommitmentData(): PacketCommitmentData { export const PacketCommitmentData = { typeUrl: "/ibc.lightclients.solomachine.v2.PacketCommitmentData", aminoType: "cosmos-sdk/PacketCommitmentData", + is(o: any): o is PacketCommitmentData { + return o && (o.$typeUrl === PacketCommitmentData.typeUrl || (o.path instanceof Uint8Array || typeof o.path === "string") && (o.commitment instanceof Uint8Array || typeof o.commitment === "string")); + }, + isSDK(o: any): o is PacketCommitmentDataSDKType { + return o && (o.$typeUrl === PacketCommitmentData.typeUrl || (o.path instanceof Uint8Array || typeof o.path === "string") && (o.commitment instanceof Uint8Array || typeof o.commitment === "string")); + }, + isAmino(o: any): o is PacketCommitmentDataAmino { + return o && (o.$typeUrl === PacketCommitmentData.typeUrl || (o.path instanceof Uint8Array || typeof o.path === "string") && (o.commitment instanceof Uint8Array || typeof o.commitment === "string")); + }, encode(message: PacketCommitmentData, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.path.length !== 0) { writer.uint32(10).bytes(message.path); @@ -2285,7 +2435,8 @@ export const PacketCommitmentData = { typeUrl: "/ibc.lightclients.solomachine.v2.PacketCommitmentData", value: PacketCommitmentData.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBasePacketAcknowledgementData(): PacketAcknowledgementData { return { @@ -2303,6 +2454,15 @@ function createBasePacketAcknowledgementData(): PacketAcknowledgementData { export const PacketAcknowledgementData = { typeUrl: "/ibc.lightclients.solomachine.v2.PacketAcknowledgementData", aminoType: "cosmos-sdk/PacketAcknowledgementData", + is(o: any): o is PacketAcknowledgementData { + return o && (o.$typeUrl === PacketAcknowledgementData.typeUrl || (o.path instanceof Uint8Array || typeof o.path === "string") && (o.acknowledgement instanceof Uint8Array || typeof o.acknowledgement === "string")); + }, + isSDK(o: any): o is PacketAcknowledgementDataSDKType { + return o && (o.$typeUrl === PacketAcknowledgementData.typeUrl || (o.path instanceof Uint8Array || typeof o.path === "string") && (o.acknowledgement instanceof Uint8Array || typeof o.acknowledgement === "string")); + }, + isAmino(o: any): o is PacketAcknowledgementDataAmino { + return o && (o.$typeUrl === PacketAcknowledgementData.typeUrl || (o.path instanceof Uint8Array || typeof o.path === "string") && (o.acknowledgement instanceof Uint8Array || typeof o.acknowledgement === "string")); + }, encode(message: PacketAcknowledgementData, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.path.length !== 0) { writer.uint32(10).bytes(message.path); @@ -2383,7 +2543,8 @@ export const PacketAcknowledgementData = { typeUrl: "/ibc.lightclients.solomachine.v2.PacketAcknowledgementData", value: PacketAcknowledgementData.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBasePacketReceiptAbsenceData(): PacketReceiptAbsenceData { return { @@ -2400,6 +2561,15 @@ function createBasePacketReceiptAbsenceData(): PacketReceiptAbsenceData { export const PacketReceiptAbsenceData = { typeUrl: "/ibc.lightclients.solomachine.v2.PacketReceiptAbsenceData", aminoType: "cosmos-sdk/PacketReceiptAbsenceData", + is(o: any): o is PacketReceiptAbsenceData { + return o && (o.$typeUrl === PacketReceiptAbsenceData.typeUrl || o.path instanceof Uint8Array || typeof o.path === "string"); + }, + isSDK(o: any): o is PacketReceiptAbsenceDataSDKType { + return o && (o.$typeUrl === PacketReceiptAbsenceData.typeUrl || o.path instanceof Uint8Array || typeof o.path === "string"); + }, + isAmino(o: any): o is PacketReceiptAbsenceDataAmino { + return o && (o.$typeUrl === PacketReceiptAbsenceData.typeUrl || o.path instanceof Uint8Array || typeof o.path === "string"); + }, encode(message: PacketReceiptAbsenceData, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.path.length !== 0) { writer.uint32(10).bytes(message.path); @@ -2466,7 +2636,8 @@ export const PacketReceiptAbsenceData = { typeUrl: "/ibc.lightclients.solomachine.v2.PacketReceiptAbsenceData", value: PacketReceiptAbsenceData.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseNextSequenceRecvData(): NextSequenceRecvData { return { @@ -2484,6 +2655,15 @@ function createBaseNextSequenceRecvData(): NextSequenceRecvData { export const NextSequenceRecvData = { typeUrl: "/ibc.lightclients.solomachine.v2.NextSequenceRecvData", aminoType: "cosmos-sdk/NextSequenceRecvData", + is(o: any): o is NextSequenceRecvData { + return o && (o.$typeUrl === NextSequenceRecvData.typeUrl || (o.path instanceof Uint8Array || typeof o.path === "string") && typeof o.nextSeqRecv === "bigint"); + }, + isSDK(o: any): o is NextSequenceRecvDataSDKType { + return o && (o.$typeUrl === NextSequenceRecvData.typeUrl || (o.path instanceof Uint8Array || typeof o.path === "string") && typeof o.next_seq_recv === "bigint"); + }, + isAmino(o: any): o is NextSequenceRecvDataAmino { + return o && (o.$typeUrl === NextSequenceRecvData.typeUrl || (o.path instanceof Uint8Array || typeof o.path === "string") && typeof o.next_seq_recv === "bigint"); + }, encode(message: NextSequenceRecvData, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.path.length !== 0) { writer.uint32(10).bytes(message.path); @@ -2566,5 +2746,6 @@ export const NextSequenceRecvData = { typeUrl: "/ibc.lightclients.solomachine.v2.NextSequenceRecvData", value: NextSequenceRecvData.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/ibc/lightclients/tendermint/v1/tendermint.ts b/__fixtures__/v-next/outputv3/ibc/lightclients/tendermint/v1/tendermint.ts index b46d05288f..bba75af515 100644 --- a/__fixtures__/v-next/outputv3/ibc/lightclients/tendermint/v1/tendermint.ts +++ b/__fixtures__/v-next/outputv3/ibc/lightclients/tendermint/v1/tendermint.ts @@ -6,6 +6,7 @@ import { MerkleRoot, MerkleRootAmino, MerkleRootSDKType } from "../../../core/co import { SignedHeader, SignedHeaderAmino, SignedHeaderSDKType } from "../../../../tendermint/types/types"; import { ValidatorSet, ValidatorSetAmino, ValidatorSetSDKType } from "../../../../tendermint/types/validator"; import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { GlobalDecoderRegistry } from "../../../../registry"; import { isSet, DeepPartial, toTimestamp, fromTimestamp, bytesFromBase64, base64FromBytes } from "../../../../helpers"; export const protobufPackage = "ibc.lightclients.tendermint.v1"; /** @@ -370,6 +371,15 @@ function createBaseClientState(): ClientState { export const ClientState = { typeUrl: "/ibc.lightclients.tendermint.v1.ClientState", aminoType: "cosmos-sdk/ClientState", + is(o: any): o is ClientState { + return o && (o.$typeUrl === ClientState.typeUrl || typeof o.chainId === "string" && Fraction.is(o.trustLevel) && Duration.is(o.trustingPeriod) && Duration.is(o.unbondingPeriod) && Duration.is(o.maxClockDrift) && Height.is(o.frozenHeight) && Height.is(o.latestHeight) && Array.isArray(o.proofSpecs) && (!o.proofSpecs.length || ProofSpec.is(o.proofSpecs[0])) && Array.isArray(o.upgradePath) && (!o.upgradePath.length || typeof o.upgradePath[0] === "string") && typeof o.allowUpdateAfterExpiry === "boolean" && typeof o.allowUpdateAfterMisbehaviour === "boolean"); + }, + isSDK(o: any): o is ClientStateSDKType { + return o && (o.$typeUrl === ClientState.typeUrl || typeof o.chain_id === "string" && Fraction.isSDK(o.trust_level) && Duration.isSDK(o.trusting_period) && Duration.isSDK(o.unbonding_period) && Duration.isSDK(o.max_clock_drift) && Height.isSDK(o.frozen_height) && Height.isSDK(o.latest_height) && Array.isArray(o.proof_specs) && (!o.proof_specs.length || ProofSpec.isSDK(o.proof_specs[0])) && Array.isArray(o.upgrade_path) && (!o.upgrade_path.length || typeof o.upgrade_path[0] === "string") && typeof o.allow_update_after_expiry === "boolean" && typeof o.allow_update_after_misbehaviour === "boolean"); + }, + isAmino(o: any): o is ClientStateAmino { + return o && (o.$typeUrl === ClientState.typeUrl || typeof o.chain_id === "string" && Fraction.isAmino(o.trust_level) && Duration.isAmino(o.trusting_period) && Duration.isAmino(o.unbonding_period) && Duration.isAmino(o.max_clock_drift) && Height.isAmino(o.frozen_height) && Height.isAmino(o.latest_height) && Array.isArray(o.proof_specs) && (!o.proof_specs.length || ProofSpec.isAmino(o.proof_specs[0])) && Array.isArray(o.upgrade_path) && (!o.upgrade_path.length || typeof o.upgrade_path[0] === "string") && typeof o.allow_update_after_expiry === "boolean" && typeof o.allow_update_after_misbehaviour === "boolean"); + }, encode(message: ClientState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.chainId !== "") { writer.uint32(10).string(message.chainId); @@ -600,6 +610,14 @@ export const ClientState = { typeUrl: "/ibc.lightclients.tendermint.v1.ClientState", value: ClientState.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ClientState.typeUrl)) { + return; + } + Fraction.registerTypeUrl(); + Height.registerTypeUrl(); + ProofSpec.registerTypeUrl(); } }; function createBaseConsensusState(): ConsensusState { @@ -618,6 +636,15 @@ function createBaseConsensusState(): ConsensusState { export const ConsensusState = { typeUrl: "/ibc.lightclients.tendermint.v1.ConsensusState", aminoType: "cosmos-sdk/ConsensusState", + is(o: any): o is ConsensusState { + return o && (o.$typeUrl === ConsensusState.typeUrl || Timestamp.is(o.timestamp) && MerkleRoot.is(o.root) && (o.nextValidatorsHash instanceof Uint8Array || typeof o.nextValidatorsHash === "string")); + }, + isSDK(o: any): o is ConsensusStateSDKType { + return o && (o.$typeUrl === ConsensusState.typeUrl || Timestamp.isSDK(o.timestamp) && MerkleRoot.isSDK(o.root) && (o.next_validators_hash instanceof Uint8Array || typeof o.next_validators_hash === "string")); + }, + isAmino(o: any): o is ConsensusStateAmino { + return o && (o.$typeUrl === ConsensusState.typeUrl || Timestamp.isAmino(o.timestamp) && MerkleRoot.isAmino(o.root) && (o.next_validators_hash instanceof Uint8Array || typeof o.next_validators_hash === "string")); + }, encode(message: ConsensusState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.timestamp !== undefined) { Timestamp.encode(toTimestamp(message.timestamp), writer.uint32(10).fork()).ldelim(); @@ -714,6 +741,12 @@ export const ConsensusState = { typeUrl: "/ibc.lightclients.tendermint.v1.ConsensusState", value: ConsensusState.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ConsensusState.typeUrl)) { + return; + } + MerkleRoot.registerTypeUrl(); } }; function createBaseMisbehaviour(): Misbehaviour { @@ -733,6 +766,15 @@ function createBaseMisbehaviour(): Misbehaviour { export const Misbehaviour = { typeUrl: "/ibc.lightclients.tendermint.v1.Misbehaviour", aminoType: "cosmos-sdk/Misbehaviour", + is(o: any): o is Misbehaviour { + return o && (o.$typeUrl === Misbehaviour.typeUrl || typeof o.clientId === "string"); + }, + isSDK(o: any): o is MisbehaviourSDKType { + return o && (o.$typeUrl === Misbehaviour.typeUrl || typeof o.client_id === "string"); + }, + isAmino(o: any): o is MisbehaviourAmino { + return o && (o.$typeUrl === Misbehaviour.typeUrl || typeof o.client_id === "string"); + }, encode(message: Misbehaviour, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.clientId !== "") { writer.uint32(10).string(message.clientId); @@ -831,6 +873,12 @@ export const Misbehaviour = { typeUrl: "/ibc.lightclients.tendermint.v1.Misbehaviour", value: Misbehaviour.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Misbehaviour.typeUrl)) { + return; + } + Header.registerTypeUrl(); } }; function createBaseHeader(): Header { @@ -861,6 +909,15 @@ function createBaseHeader(): Header { export const Header = { typeUrl: "/ibc.lightclients.tendermint.v1.Header", aminoType: "cosmos-sdk/Header", + is(o: any): o is Header { + return o && (o.$typeUrl === Header.typeUrl || Height.is(o.trustedHeight)); + }, + isSDK(o: any): o is HeaderSDKType { + return o && (o.$typeUrl === Header.typeUrl || Height.isSDK(o.trusted_height)); + }, + isAmino(o: any): o is HeaderAmino { + return o && (o.$typeUrl === Header.typeUrl || Height.isAmino(o.trusted_height)); + }, encode(message: Header, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.signedHeader !== undefined) { SignedHeader.encode(message.signedHeader, writer.uint32(10).fork()).ldelim(); @@ -977,6 +1034,14 @@ export const Header = { typeUrl: "/ibc.lightclients.tendermint.v1.Header", value: Header.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Header.typeUrl)) { + return; + } + SignedHeader.registerTypeUrl(); + ValidatorSet.registerTypeUrl(); + Height.registerTypeUrl(); } }; function createBaseFraction(): Fraction { @@ -995,6 +1060,15 @@ function createBaseFraction(): Fraction { export const Fraction = { typeUrl: "/ibc.lightclients.tendermint.v1.Fraction", aminoType: "cosmos-sdk/Fraction", + is(o: any): o is Fraction { + return o && (o.$typeUrl === Fraction.typeUrl || typeof o.numerator === "bigint" && typeof o.denominator === "bigint"); + }, + isSDK(o: any): o is FractionSDKType { + return o && (o.$typeUrl === Fraction.typeUrl || typeof o.numerator === "bigint" && typeof o.denominator === "bigint"); + }, + isAmino(o: any): o is FractionAmino { + return o && (o.$typeUrl === Fraction.typeUrl || typeof o.numerator === "bigint" && typeof o.denominator === "bigint"); + }, encode(message: Fraction, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.numerator !== BigInt(0)) { writer.uint32(8).uint64(message.numerator); @@ -1079,5 +1153,6 @@ export const Fraction = { typeUrl: "/ibc.lightclients.tendermint.v1.Fraction", value: Fraction.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/index.ts b/__fixtures__/v-next/outputv3/index.ts index 927cad8a40..81a303d8e6 100644 --- a/__fixtures__/v-next/outputv3/index.ts +++ b/__fixtures__/v-next/outputv3/index.ts @@ -21,7 +21,11 @@ export * from "./ibc/client"; export * from "./osmosis/bundle"; export * from "./osmosis/client"; export * from "./tendermint/bundle"; +export * from "./extern"; +export * from "./helper-func-types"; export * from "./grpc-gateway"; export * from "./varint"; export * from "./utf8"; -export * from "./binary"; \ No newline at end of file +export * from "./binary"; +export * from "./types"; +export * from "./registry"; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/osmosis/bundle.ts b/__fixtures__/v-next/outputv3/osmosis/bundle.ts index 36785310ef..d796fc0df2 100644 --- a/__fixtures__/v-next/outputv3/osmosis/bundle.ts +++ b/__fixtures__/v-next/outputv3/osmosis/bundle.ts @@ -49,56 +49,62 @@ import * as _301 from "./txfees/v1beta1/feetoken"; import * as _302 from "./txfees/v1beta1/genesis"; import * as _303 from "./txfees/v1beta1/gov"; import * as _304 from "./txfees/v1beta1/query"; -import * as _484 from "./gamm/pool-models/balancer/tx/tx.amino"; -import * as _485 from "./gamm/pool-models/stableswap/tx.amino"; -import * as _486 from "./gamm/v1beta1/tx.amino"; -import * as _487 from "./incentives/tx.amino"; -import * as _488 from "./lockup/tx.amino"; -import * as _489 from "./superfluid/tx.amino"; -import * as _490 from "./tokenfactory/v1beta1/tx.amino"; -import * as _491 from "./gamm/pool-models/balancer/tx/tx.registry"; -import * as _492 from "./gamm/pool-models/stableswap/tx.registry"; -import * as _493 from "./gamm/v1beta1/tx.registry"; -import * as _494 from "./incentives/tx.registry"; -import * as _495 from "./lockup/tx.registry"; -import * as _496 from "./superfluid/tx.registry"; -import * as _497 from "./tokenfactory/v1beta1/tx.registry"; -import * as _498 from "./claim/v1beta1/query.lcd"; -import * as _499 from "./epochs/query.lcd"; -import * as _500 from "./gamm/v1beta1/query.lcd"; -import * as _501 from "./gamm/v2/query.lcd"; -import * as _502 from "./ibc-rate-limit/v1beta1/query.lcd"; -import * as _503 from "./incentives/query.lcd"; -import * as _504 from "./lockup/query.lcd"; -import * as _505 from "./mint/v1beta1/query.lcd"; -import * as _506 from "./pool-incentives/v1beta1/query.lcd"; -import * as _507 from "./superfluid/query.lcd"; -import * as _508 from "./tokenfactory/v1beta1/query.lcd"; -import * as _509 from "./twap/v1beta1/query.lcd"; -import * as _510 from "./txfees/v1beta1/query.lcd"; -import * as _511 from "./claim/v1beta1/query.rpc.Query"; -import * as _512 from "./epochs/query.rpc.Query"; -import * as _513 from "./gamm/v1beta1/query.rpc.Query"; -import * as _514 from "./gamm/v2/query.rpc.Query"; -import * as _515 from "./ibc-rate-limit/v1beta1/query.rpc.Query"; -import * as _516 from "./incentives/query.rpc.Query"; -import * as _517 from "./lockup/query.rpc.Query"; -import * as _518 from "./mint/v1beta1/query.rpc.Query"; -import * as _519 from "./pool-incentives/v1beta1/query.rpc.Query"; -import * as _520 from "./superfluid/query.rpc.Query"; -import * as _521 from "./tokenfactory/v1beta1/query.rpc.Query"; -import * as _522 from "./twap/v1beta1/query.rpc.Query"; -import * as _523 from "./txfees/v1beta1/query.rpc.Query"; -import * as _524 from "./gamm/pool-models/balancer/tx/tx.rpc.msg"; -import * as _525 from "./gamm/pool-models/stableswap/tx.rpc.msg"; -import * as _526 from "./gamm/v1beta1/tx.rpc.msg"; -import * as _527 from "./incentives/tx.rpc.msg"; -import * as _528 from "./lockup/tx.rpc.msg"; -import * as _529 from "./superfluid/tx.rpc.msg"; -import * as _530 from "./tokenfactory/v1beta1/tx.rpc.msg"; -import * as _546 from "./lcd"; -import * as _547 from "./rpc.query"; -import * as _548 from "./rpc.tx"; +import * as _518 from "./gamm/pool-models/balancer/tx/tx.amino"; +import * as _519 from "./gamm/pool-models/stableswap/tx.amino"; +import * as _520 from "./gamm/v1beta1/tx.amino"; +import * as _521 from "./incentives/tx.amino"; +import * as _522 from "./lockup/tx.amino"; +import * as _523 from "./superfluid/tx.amino"; +import * as _524 from "./tokenfactory/v1beta1/tx.amino"; +import * as _525 from "./gamm/pool-models/balancer/tx/tx.registry"; +import * as _526 from "./gamm/pool-models/stableswap/tx.registry"; +import * as _527 from "./gamm/v1beta1/tx.registry"; +import * as _528 from "./incentives/tx.registry"; +import * as _529 from "./lockup/tx.registry"; +import * as _530 from "./superfluid/tx.registry"; +import * as _531 from "./tokenfactory/v1beta1/tx.registry"; +import * as _532 from "./claim/v1beta1/query.rpc.func"; +import * as _533 from "./epochs/query.rpc.func"; +import * as _534 from "./gamm/v1beta1/query.rpc.func"; +import * as _535 from "./gamm/v2/query.rpc.func"; +import * as _536 from "./ibc-rate-limit/v1beta1/query.rpc.func"; +import * as _537 from "./incentives/query.rpc.func"; +import * as _538 from "./lockup/query.rpc.func"; +import * as _539 from "./mint/v1beta1/query.rpc.func"; +import * as _540 from "./pool-incentives/v1beta1/query.rpc.func"; +import * as _541 from "./superfluid/query.rpc.func"; +import * as _542 from "./tokenfactory/v1beta1/query.rpc.func"; +import * as _543 from "./twap/v1beta1/query.rpc.func"; +import * as _544 from "./txfees/v1beta1/query.rpc.func"; +import * as _545 from "./claim/v1beta1/query.rpc.Query"; +import * as _546 from "./epochs/query.rpc.Query"; +import * as _547 from "./gamm/v1beta1/query.rpc.Query"; +import * as _548 from "./gamm/v2/query.rpc.Query"; +import * as _549 from "./ibc-rate-limit/v1beta1/query.rpc.Query"; +import * as _550 from "./incentives/query.rpc.Query"; +import * as _551 from "./lockup/query.rpc.Query"; +import * as _552 from "./mint/v1beta1/query.rpc.Query"; +import * as _553 from "./pool-incentives/v1beta1/query.rpc.Query"; +import * as _554 from "./superfluid/query.rpc.Query"; +import * as _555 from "./tokenfactory/v1beta1/query.rpc.Query"; +import * as _556 from "./twap/v1beta1/query.rpc.Query"; +import * as _557 from "./txfees/v1beta1/query.rpc.Query"; +import * as _558 from "./gamm/pool-models/balancer/tx/tx.rpc.func"; +import * as _559 from "./gamm/pool-models/stableswap/tx.rpc.func"; +import * as _560 from "./gamm/v1beta1/tx.rpc.func"; +import * as _561 from "./incentives/tx.rpc.func"; +import * as _562 from "./lockup/tx.rpc.func"; +import * as _563 from "./superfluid/tx.rpc.func"; +import * as _564 from "./tokenfactory/v1beta1/tx.rpc.func"; +import * as _565 from "./gamm/pool-models/balancer/tx/tx.rpc.msg"; +import * as _566 from "./gamm/pool-models/stableswap/tx.rpc.msg"; +import * as _567 from "./gamm/v1beta1/tx.rpc.msg"; +import * as _568 from "./incentives/tx.rpc.msg"; +import * as _569 from "./lockup/tx.rpc.msg"; +import * as _570 from "./superfluid/tx.rpc.msg"; +import * as _571 from "./tokenfactory/v1beta1/tx.rpc.msg"; +import * as _583 from "./rpc.query"; +import * as _584 from "./rpc.tx"; export namespace osmosis { export namespace claim { export const v1beta1 = { @@ -106,16 +112,16 @@ export namespace osmosis { ..._255, ..._256, ..._257, - ..._498, - ..._511 + ..._532, + ..._545 }; } export namespace epochs { export const v1beta1 = { ..._258, ..._259, - ..._499, - ..._512 + ..._533, + ..._546 }; } export namespace gamm { @@ -124,43 +130,46 @@ export namespace osmosis { ..._261, ..._262, ..._263, - ..._486, - ..._493, - ..._500, - ..._513, - ..._526 + ..._520, + ..._527, + ..._534, + ..._547, + ..._560, + ..._567 }; export namespace poolmodels { export namespace balancer { export const v1beta1 = { ..._264, - ..._484, - ..._491, - ..._524 + ..._518, + ..._525, + ..._558, + ..._565 }; } export namespace stableswap { export const v1beta1 = { ..._265, ..._266, - ..._485, - ..._492, - ..._525 + ..._519, + ..._526, + ..._559, + ..._566 }; } } export const v2 = { ..._267, - ..._501, - ..._514 + ..._535, + ..._548 }; } export namespace ibcratelimit { export const v1beta1 = { ..._268, ..._269, - ..._502, - ..._515 + ..._536, + ..._549 }; } export const incentives = { @@ -169,11 +178,12 @@ export namespace osmosis { ..._272, ..._273, ..._274, - ..._487, - ..._494, - ..._503, - ..._516, - ..._527 + ..._521, + ..._528, + ..._537, + ..._550, + ..._561, + ..._568 }; export const lockup = { ..._275, @@ -181,19 +191,20 @@ export namespace osmosis { ..._277, ..._278, ..._279, - ..._488, - ..._495, - ..._504, - ..._517, - ..._528 + ..._522, + ..._529, + ..._538, + ..._551, + ..._562, + ..._569 }; export namespace mint { export const v1beta1 = { ..._280, ..._281, ..._282, - ..._505, - ..._518 + ..._539, + ..._552 }; } export namespace poolincentives { @@ -202,8 +213,8 @@ export namespace osmosis { ..._284, ..._285, ..._286, - ..._506, - ..._519 + ..._540, + ..._553 }; } export namespace store { @@ -217,11 +228,12 @@ export namespace osmosis { ..._290, ..._291, ..._292, - ..._489, - ..._496, - ..._507, - ..._520, - ..._529 + ..._523, + ..._530, + ..._541, + ..._554, + ..._563, + ..._570 }; export namespace tokenfactory { export const v1beta1 = { @@ -230,11 +242,12 @@ export namespace osmosis { ..._295, ..._296, ..._297, - ..._490, - ..._497, - ..._508, - ..._521, - ..._530 + ..._524, + ..._531, + ..._542, + ..._555, + ..._564, + ..._571 }; } export namespace twap { @@ -242,8 +255,8 @@ export namespace osmosis { ..._298, ..._299, ..._300, - ..._509, - ..._522 + ..._543, + ..._556 }; } export namespace txfees { @@ -252,13 +265,12 @@ export namespace osmosis { ..._302, ..._303, ..._304, - ..._510, - ..._523 + ..._544, + ..._557 }; } export const ClientFactory = { - ..._546, - ..._547, - ..._548 + ..._583, + ..._584 }; } \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/osmosis/claim/v1beta1/claim.ts b/__fixtures__/v-next/outputv3/osmosis/claim/v1beta1/claim.ts index a6536fc1ea..2f7f6d1059 100644 --- a/__fixtures__/v-next/outputv3/osmosis/claim/v1beta1/claim.ts +++ b/__fixtures__/v-next/outputv3/osmosis/claim/v1beta1/claim.ts @@ -1,6 +1,7 @@ import { Coin, CoinAmino, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { isSet, DeepPartial } from "../../../helpers"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "osmosis.claim.v1beta1"; export enum Action { ActionAddLiquidity = 0, @@ -119,6 +120,15 @@ function createBaseClaimRecord(): ClaimRecord { export const ClaimRecord = { typeUrl: "/osmosis.claim.v1beta1.ClaimRecord", aminoType: "osmosis/claim/claim-record", + is(o: any): o is ClaimRecord { + return o && (o.$typeUrl === ClaimRecord.typeUrl || typeof o.address === "string" && Array.isArray(o.initialClaimableAmount) && (!o.initialClaimableAmount.length || Coin.is(o.initialClaimableAmount[0])) && Array.isArray(o.actionCompleted) && (!o.actionCompleted.length || typeof o.actionCompleted[0] === "boolean")); + }, + isSDK(o: any): o is ClaimRecordSDKType { + return o && (o.$typeUrl === ClaimRecord.typeUrl || typeof o.address === "string" && Array.isArray(o.initial_claimable_amount) && (!o.initial_claimable_amount.length || Coin.isSDK(o.initial_claimable_amount[0])) && Array.isArray(o.action_completed) && (!o.action_completed.length || typeof o.action_completed[0] === "boolean")); + }, + isAmino(o: any): o is ClaimRecordAmino { + return o && (o.$typeUrl === ClaimRecord.typeUrl || typeof o.address === "string" && Array.isArray(o.initial_claimable_amount) && (!o.initial_claimable_amount.length || Coin.isAmino(o.initial_claimable_amount[0])) && Array.isArray(o.action_completed) && (!o.action_completed.length || typeof o.action_completed[0] === "boolean")); + }, encode(message: ClaimRecord, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.address !== "") { writer.uint32(10).string(message.address); @@ -234,5 +244,11 @@ export const ClaimRecord = { typeUrl: "/osmosis.claim.v1beta1.ClaimRecord", value: ClaimRecord.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ClaimRecord.typeUrl)) { + return; + } + Coin.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/osmosis/claim/v1beta1/genesis.ts b/__fixtures__/v-next/outputv3/osmosis/claim/v1beta1/genesis.ts index e301765d35..bfa72f58df 100644 --- a/__fixtures__/v-next/outputv3/osmosis/claim/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv3/osmosis/claim/v1beta1/genesis.ts @@ -2,6 +2,7 @@ import { Coin, CoinAmino, CoinSDKType } from "../../../cosmos/base/v1beta1/coin" import { Params, ParamsAmino, ParamsSDKType } from "./params"; import { ClaimRecord, ClaimRecordAmino, ClaimRecordSDKType } from "./claim"; import { BinaryReader, BinaryWriter } from "../../../binary"; +import { GlobalDecoderRegistry } from "../../../registry"; import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "osmosis.claim.v1beta1"; /** @@ -75,6 +76,15 @@ function createBaseGenesisState(): GenesisState { export const GenesisState = { typeUrl: "/osmosis.claim.v1beta1.GenesisState", aminoType: "osmosis/claim/genesis-state", + is(o: any): o is GenesisState { + return o && (o.$typeUrl === GenesisState.typeUrl || Coin.is(o.moduleAccountBalance) && Params.is(o.params) && Array.isArray(o.claimRecords) && (!o.claimRecords.length || ClaimRecord.is(o.claimRecords[0]))); + }, + isSDK(o: any): o is GenesisStateSDKType { + return o && (o.$typeUrl === GenesisState.typeUrl || Coin.isSDK(o.module_account_balance) && Params.isSDK(o.params) && Array.isArray(o.claim_records) && (!o.claim_records.length || ClaimRecord.isSDK(o.claim_records[0]))); + }, + isAmino(o: any): o is GenesisStateAmino { + return o && (o.$typeUrl === GenesisState.typeUrl || Coin.isAmino(o.module_account_balance) && Params.isAmino(o.params) && Array.isArray(o.claim_records) && (!o.claim_records.length || ClaimRecord.isAmino(o.claim_records[0]))); + }, encode(message: GenesisState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.moduleAccountBalance !== undefined) { Coin.encode(message.moduleAccountBalance, writer.uint32(10).fork()).ldelim(); @@ -179,5 +189,13 @@ export const GenesisState = { typeUrl: "/osmosis.claim.v1beta1.GenesisState", value: GenesisState.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GenesisState.typeUrl)) { + return; + } + Coin.registerTypeUrl(); + Params.registerTypeUrl(); + ClaimRecord.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/osmosis/claim/v1beta1/params.ts b/__fixtures__/v-next/outputv3/osmosis/claim/v1beta1/params.ts index ed6ec67471..538225be86 100644 --- a/__fixtures__/v-next/outputv3/osmosis/claim/v1beta1/params.ts +++ b/__fixtures__/v-next/outputv3/osmosis/claim/v1beta1/params.ts @@ -2,6 +2,7 @@ import { Timestamp, TimestampAmino, TimestampSDKType } from "../../../google/pro import { Duration, DurationAmino, DurationSDKType } from "../../../google/protobuf/duration"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { toTimestamp, fromTimestamp, isSet, DeepPartial } from "../../../helpers"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "osmosis.claim.v1beta1"; /** * Params defines the claim module's parameters. @@ -66,6 +67,15 @@ function createBaseParams(): Params { export const Params = { typeUrl: "/osmosis.claim.v1beta1.Params", aminoType: "osmosis/claim/params", + is(o: any): o is Params { + return o && (o.$typeUrl === Params.typeUrl || Timestamp.is(o.airdropStartTime) && Duration.is(o.durationUntilDecay) && Duration.is(o.durationOfDecay) && typeof o.claimDenom === "string"); + }, + isSDK(o: any): o is ParamsSDKType { + return o && (o.$typeUrl === Params.typeUrl || Timestamp.isSDK(o.airdrop_start_time) && Duration.isSDK(o.duration_until_decay) && Duration.isSDK(o.duration_of_decay) && typeof o.claim_denom === "string"); + }, + isAmino(o: any): o is ParamsAmino { + return o && (o.$typeUrl === Params.typeUrl || Timestamp.isAmino(o.airdrop_start_time) && Duration.isAmino(o.duration_until_decay) && Duration.isAmino(o.duration_of_decay) && typeof o.claim_denom === "string"); + }, encode(message: Params, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.airdropStartTime !== undefined) { Timestamp.encode(toTimestamp(message.airdropStartTime), writer.uint32(10).fork()).ldelim(); @@ -178,5 +188,6 @@ export const Params = { typeUrl: "/osmosis.claim.v1beta1.Params", value: Params.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/osmosis/claim/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputv3/osmosis/claim/v1beta1/query.rpc.func.ts new file mode 100644 index 0000000000..96e4312cbe --- /dev/null +++ b/__fixtures__/v-next/outputv3/osmosis/claim/v1beta1/query.rpc.func.ts @@ -0,0 +1,65 @@ +import { Action, ActionSDKType, ClaimRecord, ClaimRecordSDKType } from "./claim"; +import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; +import { Params, ParamsSDKType } from "./params"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { QueryModuleAccountBalanceRequest, QueryModuleAccountBalanceRequestSDKType, QueryModuleAccountBalanceResponse, QueryModuleAccountBalanceResponseSDKType, QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, QueryClaimRecordRequest, QueryClaimRecordRequestSDKType, QueryClaimRecordResponse, QueryClaimRecordResponseSDKType, QueryClaimableForActionRequest, QueryClaimableForActionRequestSDKType, QueryClaimableForActionResponse, QueryClaimableForActionResponseSDKType, QueryTotalClaimableRequest, QueryTotalClaimableRequestSDKType, QueryTotalClaimableResponse, QueryTotalClaimableResponseSDKType } from "./query"; +/** + * @name getModuleAccountBalance + * @package osmosis.claim.v1beta1 + * @see proto service: osmosis.claim.v1beta1.ModuleAccountBalance + */ +export const getModuleAccountBalance = buildQuery({ + encode: QueryModuleAccountBalanceRequest.encode, + decode: QueryModuleAccountBalanceResponse.decode, + service: "osmosis.claim.v1beta1.Query", + method: "ModuleAccountBalance", + deps: [QueryModuleAccountBalanceRequest, QueryModuleAccountBalanceResponse] +}); +/** + * @name getParams + * @package osmosis.claim.v1beta1 + * @see proto service: osmosis.claim.v1beta1.Params + */ +export const getParams = buildQuery({ + encode: QueryParamsRequest.encode, + decode: QueryParamsResponse.decode, + service: "osmosis.claim.v1beta1.Query", + method: "Params", + deps: [QueryParamsRequest, QueryParamsResponse] +}); +/** + * @name getClaimRecord + * @package osmosis.claim.v1beta1 + * @see proto service: osmosis.claim.v1beta1.ClaimRecord + */ +export const getClaimRecord = buildQuery({ + encode: QueryClaimRecordRequest.encode, + decode: QueryClaimRecordResponse.decode, + service: "osmosis.claim.v1beta1.Query", + method: "ClaimRecord", + deps: [QueryClaimRecordRequest, QueryClaimRecordResponse] +}); +/** + * @name getClaimableForAction + * @package osmosis.claim.v1beta1 + * @see proto service: osmosis.claim.v1beta1.ClaimableForAction + */ +export const getClaimableForAction = buildQuery({ + encode: QueryClaimableForActionRequest.encode, + decode: QueryClaimableForActionResponse.decode, + service: "osmosis.claim.v1beta1.Query", + method: "ClaimableForAction", + deps: [QueryClaimableForActionRequest, QueryClaimableForActionResponse] +}); +/** + * @name getTotalClaimable + * @package osmosis.claim.v1beta1 + * @see proto service: osmosis.claim.v1beta1.TotalClaimable + */ +export const getTotalClaimable = buildQuery({ + encode: QueryTotalClaimableRequest.encode, + decode: QueryTotalClaimableResponse.decode, + service: "osmosis.claim.v1beta1.Query", + method: "TotalClaimable", + deps: [QueryTotalClaimableRequest, QueryTotalClaimableResponse] +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/osmosis/claim/v1beta1/query.ts b/__fixtures__/v-next/outputv3/osmosis/claim/v1beta1/query.ts index ebdf571898..7df2a9c534 100644 --- a/__fixtures__/v-next/outputv3/osmosis/claim/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv3/osmosis/claim/v1beta1/query.ts @@ -3,6 +3,7 @@ import { Coin, CoinAmino, CoinSDKType } from "../../../cosmos/base/v1beta1/coin" import { Params, ParamsAmino, ParamsSDKType } from "./params"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { DeepPartial, isSet } from "../../../helpers"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "osmosis.claim.v1beta1"; /** * QueryParamsRequest is the request type for the Query/Params RPC method. @@ -311,6 +312,15 @@ function createBaseQueryModuleAccountBalanceRequest(): QueryModuleAccountBalance export const QueryModuleAccountBalanceRequest = { typeUrl: "/osmosis.claim.v1beta1.QueryModuleAccountBalanceRequest", aminoType: "osmosis/claim/query-module-account-balance-request", + is(o: any): o is QueryModuleAccountBalanceRequest { + return o && o.$typeUrl === QueryModuleAccountBalanceRequest.typeUrl; + }, + isSDK(o: any): o is QueryModuleAccountBalanceRequestSDKType { + return o && o.$typeUrl === QueryModuleAccountBalanceRequest.typeUrl; + }, + isAmino(o: any): o is QueryModuleAccountBalanceRequestAmino { + return o && o.$typeUrl === QueryModuleAccountBalanceRequest.typeUrl; + }, encode(_: QueryModuleAccountBalanceRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -362,7 +372,8 @@ export const QueryModuleAccountBalanceRequest = { typeUrl: "/osmosis.claim.v1beta1.QueryModuleAccountBalanceRequest", value: QueryModuleAccountBalanceRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryModuleAccountBalanceResponse(): QueryModuleAccountBalanceResponse { return { @@ -378,6 +389,15 @@ function createBaseQueryModuleAccountBalanceResponse(): QueryModuleAccountBalanc export const QueryModuleAccountBalanceResponse = { typeUrl: "/osmosis.claim.v1beta1.QueryModuleAccountBalanceResponse", aminoType: "osmosis/claim/query-module-account-balance-response", + is(o: any): o is QueryModuleAccountBalanceResponse { + return o && (o.$typeUrl === QueryModuleAccountBalanceResponse.typeUrl || Array.isArray(o.moduleAccountBalance) && (!o.moduleAccountBalance.length || Coin.is(o.moduleAccountBalance[0]))); + }, + isSDK(o: any): o is QueryModuleAccountBalanceResponseSDKType { + return o && (o.$typeUrl === QueryModuleAccountBalanceResponse.typeUrl || Array.isArray(o.moduleAccountBalance) && (!o.moduleAccountBalance.length || Coin.isSDK(o.moduleAccountBalance[0]))); + }, + isAmino(o: any): o is QueryModuleAccountBalanceResponseAmino { + return o && (o.$typeUrl === QueryModuleAccountBalanceResponse.typeUrl || Array.isArray(o.moduleAccountBalance) && (!o.moduleAccountBalance.length || Coin.isAmino(o.moduleAccountBalance[0]))); + }, encode(message: QueryModuleAccountBalanceResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.moduleAccountBalance) { Coin.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -450,6 +470,12 @@ export const QueryModuleAccountBalanceResponse = { typeUrl: "/osmosis.claim.v1beta1.QueryModuleAccountBalanceResponse", value: QueryModuleAccountBalanceResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryModuleAccountBalanceResponse.typeUrl)) { + return; + } + Coin.registerTypeUrl(); } }; function createBaseQueryParamsRequest(): QueryParamsRequest { @@ -464,6 +490,15 @@ function createBaseQueryParamsRequest(): QueryParamsRequest { export const QueryParamsRequest = { typeUrl: "/osmosis.claim.v1beta1.QueryParamsRequest", aminoType: "osmosis/claim/query-params-request", + is(o: any): o is QueryParamsRequest { + return o && o.$typeUrl === QueryParamsRequest.typeUrl; + }, + isSDK(o: any): o is QueryParamsRequestSDKType { + return o && o.$typeUrl === QueryParamsRequest.typeUrl; + }, + isAmino(o: any): o is QueryParamsRequestAmino { + return o && o.$typeUrl === QueryParamsRequest.typeUrl; + }, encode(_: QueryParamsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -515,7 +550,8 @@ export const QueryParamsRequest = { typeUrl: "/osmosis.claim.v1beta1.QueryParamsRequest", value: QueryParamsRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryParamsResponse(): QueryParamsResponse { return { @@ -531,6 +567,15 @@ function createBaseQueryParamsResponse(): QueryParamsResponse { export const QueryParamsResponse = { typeUrl: "/osmosis.claim.v1beta1.QueryParamsResponse", aminoType: "osmosis/claim/query-params-response", + is(o: any): o is QueryParamsResponse { + return o && (o.$typeUrl === QueryParamsResponse.typeUrl || Params.is(o.params)); + }, + isSDK(o: any): o is QueryParamsResponseSDKType { + return o && (o.$typeUrl === QueryParamsResponse.typeUrl || Params.isSDK(o.params)); + }, + isAmino(o: any): o is QueryParamsResponseAmino { + return o && (o.$typeUrl === QueryParamsResponse.typeUrl || Params.isAmino(o.params)); + }, encode(message: QueryParamsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.params !== undefined) { Params.encode(message.params, writer.uint32(10).fork()).ldelim(); @@ -599,6 +644,12 @@ export const QueryParamsResponse = { typeUrl: "/osmosis.claim.v1beta1.QueryParamsResponse", value: QueryParamsResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryParamsResponse.typeUrl)) { + return; + } + Params.registerTypeUrl(); } }; function createBaseQueryClaimRecordRequest(): QueryClaimRecordRequest { @@ -614,6 +665,15 @@ function createBaseQueryClaimRecordRequest(): QueryClaimRecordRequest { export const QueryClaimRecordRequest = { typeUrl: "/osmosis.claim.v1beta1.QueryClaimRecordRequest", aminoType: "osmosis/claim/query-claim-record-request", + is(o: any): o is QueryClaimRecordRequest { + return o && (o.$typeUrl === QueryClaimRecordRequest.typeUrl || typeof o.address === "string"); + }, + isSDK(o: any): o is QueryClaimRecordRequestSDKType { + return o && (o.$typeUrl === QueryClaimRecordRequest.typeUrl || typeof o.address === "string"); + }, + isAmino(o: any): o is QueryClaimRecordRequestAmino { + return o && (o.$typeUrl === QueryClaimRecordRequest.typeUrl || typeof o.address === "string"); + }, encode(message: QueryClaimRecordRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.address !== "") { writer.uint32(10).string(message.address); @@ -680,7 +740,8 @@ export const QueryClaimRecordRequest = { typeUrl: "/osmosis.claim.v1beta1.QueryClaimRecordRequest", value: QueryClaimRecordRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryClaimRecordResponse(): QueryClaimRecordResponse { return { @@ -695,6 +756,15 @@ function createBaseQueryClaimRecordResponse(): QueryClaimRecordResponse { export const QueryClaimRecordResponse = { typeUrl: "/osmosis.claim.v1beta1.QueryClaimRecordResponse", aminoType: "osmosis/claim/query-claim-record-response", + is(o: any): o is QueryClaimRecordResponse { + return o && (o.$typeUrl === QueryClaimRecordResponse.typeUrl || ClaimRecord.is(o.claimRecord)); + }, + isSDK(o: any): o is QueryClaimRecordResponseSDKType { + return o && (o.$typeUrl === QueryClaimRecordResponse.typeUrl || ClaimRecord.isSDK(o.claim_record)); + }, + isAmino(o: any): o is QueryClaimRecordResponseAmino { + return o && (o.$typeUrl === QueryClaimRecordResponse.typeUrl || ClaimRecord.isAmino(o.claim_record)); + }, encode(message: QueryClaimRecordResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.claimRecord !== undefined) { ClaimRecord.encode(message.claimRecord, writer.uint32(10).fork()).ldelim(); @@ -763,6 +833,12 @@ export const QueryClaimRecordResponse = { typeUrl: "/osmosis.claim.v1beta1.QueryClaimRecordResponse", value: QueryClaimRecordResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryClaimRecordResponse.typeUrl)) { + return; + } + ClaimRecord.registerTypeUrl(); } }; function createBaseQueryClaimableForActionRequest(): QueryClaimableForActionRequest { @@ -779,6 +855,15 @@ function createBaseQueryClaimableForActionRequest(): QueryClaimableForActionRequ export const QueryClaimableForActionRequest = { typeUrl: "/osmosis.claim.v1beta1.QueryClaimableForActionRequest", aminoType: "osmosis/claim/query-claimable-for-action-request", + is(o: any): o is QueryClaimableForActionRequest { + return o && (o.$typeUrl === QueryClaimableForActionRequest.typeUrl || typeof o.address === "string" && isSet(o.action)); + }, + isSDK(o: any): o is QueryClaimableForActionRequestSDKType { + return o && (o.$typeUrl === QueryClaimableForActionRequest.typeUrl || typeof o.address === "string" && isSet(o.action)); + }, + isAmino(o: any): o is QueryClaimableForActionRequestAmino { + return o && (o.$typeUrl === QueryClaimableForActionRequest.typeUrl || typeof o.address === "string" && isSet(o.action)); + }, encode(message: QueryClaimableForActionRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.address !== "") { writer.uint32(10).string(message.address); @@ -859,7 +944,8 @@ export const QueryClaimableForActionRequest = { typeUrl: "/osmosis.claim.v1beta1.QueryClaimableForActionRequest", value: QueryClaimableForActionRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryClaimableForActionResponse(): QueryClaimableForActionResponse { return { @@ -874,6 +960,15 @@ function createBaseQueryClaimableForActionResponse(): QueryClaimableForActionRes export const QueryClaimableForActionResponse = { typeUrl: "/osmosis.claim.v1beta1.QueryClaimableForActionResponse", aminoType: "osmosis/claim/query-claimable-for-action-response", + is(o: any): o is QueryClaimableForActionResponse { + return o && (o.$typeUrl === QueryClaimableForActionResponse.typeUrl || Array.isArray(o.coins) && (!o.coins.length || Coin.is(o.coins[0]))); + }, + isSDK(o: any): o is QueryClaimableForActionResponseSDKType { + return o && (o.$typeUrl === QueryClaimableForActionResponse.typeUrl || Array.isArray(o.coins) && (!o.coins.length || Coin.isSDK(o.coins[0]))); + }, + isAmino(o: any): o is QueryClaimableForActionResponseAmino { + return o && (o.$typeUrl === QueryClaimableForActionResponse.typeUrl || Array.isArray(o.coins) && (!o.coins.length || Coin.isAmino(o.coins[0]))); + }, encode(message: QueryClaimableForActionResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.coins) { Coin.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -946,6 +1041,12 @@ export const QueryClaimableForActionResponse = { typeUrl: "/osmosis.claim.v1beta1.QueryClaimableForActionResponse", value: QueryClaimableForActionResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryClaimableForActionResponse.typeUrl)) { + return; + } + Coin.registerTypeUrl(); } }; function createBaseQueryTotalClaimableRequest(): QueryTotalClaimableRequest { @@ -961,6 +1062,15 @@ function createBaseQueryTotalClaimableRequest(): QueryTotalClaimableRequest { export const QueryTotalClaimableRequest = { typeUrl: "/osmosis.claim.v1beta1.QueryTotalClaimableRequest", aminoType: "osmosis/claim/query-total-claimable-request", + is(o: any): o is QueryTotalClaimableRequest { + return o && (o.$typeUrl === QueryTotalClaimableRequest.typeUrl || typeof o.address === "string"); + }, + isSDK(o: any): o is QueryTotalClaimableRequestSDKType { + return o && (o.$typeUrl === QueryTotalClaimableRequest.typeUrl || typeof o.address === "string"); + }, + isAmino(o: any): o is QueryTotalClaimableRequestAmino { + return o && (o.$typeUrl === QueryTotalClaimableRequest.typeUrl || typeof o.address === "string"); + }, encode(message: QueryTotalClaimableRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.address !== "") { writer.uint32(10).string(message.address); @@ -1027,7 +1137,8 @@ export const QueryTotalClaimableRequest = { typeUrl: "/osmosis.claim.v1beta1.QueryTotalClaimableRequest", value: QueryTotalClaimableRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryTotalClaimableResponse(): QueryTotalClaimableResponse { return { @@ -1042,6 +1153,15 @@ function createBaseQueryTotalClaimableResponse(): QueryTotalClaimableResponse { export const QueryTotalClaimableResponse = { typeUrl: "/osmosis.claim.v1beta1.QueryTotalClaimableResponse", aminoType: "osmosis/claim/query-total-claimable-response", + is(o: any): o is QueryTotalClaimableResponse { + return o && (o.$typeUrl === QueryTotalClaimableResponse.typeUrl || Array.isArray(o.coins) && (!o.coins.length || Coin.is(o.coins[0]))); + }, + isSDK(o: any): o is QueryTotalClaimableResponseSDKType { + return o && (o.$typeUrl === QueryTotalClaimableResponse.typeUrl || Array.isArray(o.coins) && (!o.coins.length || Coin.isSDK(o.coins[0]))); + }, + isAmino(o: any): o is QueryTotalClaimableResponseAmino { + return o && (o.$typeUrl === QueryTotalClaimableResponse.typeUrl || Array.isArray(o.coins) && (!o.coins.length || Coin.isAmino(o.coins[0]))); + }, encode(message: QueryTotalClaimableResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.coins) { Coin.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -1114,5 +1234,11 @@ export const QueryTotalClaimableResponse = { typeUrl: "/osmosis.claim.v1beta1.QueryTotalClaimableResponse", value: QueryTotalClaimableResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryTotalClaimableResponse.typeUrl)) { + return; + } + Coin.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/osmosis/epochs/genesis.ts b/__fixtures__/v-next/outputv3/osmosis/epochs/genesis.ts index ff600f9c46..853d2cfd94 100644 --- a/__fixtures__/v-next/outputv3/osmosis/epochs/genesis.ts +++ b/__fixtures__/v-next/outputv3/osmosis/epochs/genesis.ts @@ -2,6 +2,7 @@ import { Timestamp, TimestampAmino, TimestampSDKType } from "../../google/protob import { Duration, DurationAmino, DurationSDKType } from "../../google/protobuf/duration"; import { BinaryReader, BinaryWriter } from "../../binary"; import { toTimestamp, fromTimestamp, isSet, DeepPartial } from "../../helpers"; +import { GlobalDecoderRegistry } from "../../registry"; export const protobufPackage = "osmosis.epochs.v1beta1"; /** * EpochInfo is a struct that describes the data going into @@ -201,6 +202,15 @@ function createBaseEpochInfo(): EpochInfo { export const EpochInfo = { typeUrl: "/osmosis.epochs.v1beta1.EpochInfo", aminoType: "osmosis/epochs/epoch-info", + is(o: any): o is EpochInfo { + return o && (o.$typeUrl === EpochInfo.typeUrl || typeof o.identifier === "string" && Timestamp.is(o.startTime) && Duration.is(o.duration) && typeof o.currentEpoch === "bigint" && Timestamp.is(o.currentEpochStartTime) && typeof o.epochCountingStarted === "boolean" && typeof o.currentEpochStartHeight === "bigint"); + }, + isSDK(o: any): o is EpochInfoSDKType { + return o && (o.$typeUrl === EpochInfo.typeUrl || typeof o.identifier === "string" && Timestamp.isSDK(o.start_time) && Duration.isSDK(o.duration) && typeof o.current_epoch === "bigint" && Timestamp.isSDK(o.current_epoch_start_time) && typeof o.epoch_counting_started === "boolean" && typeof o.current_epoch_start_height === "bigint"); + }, + isAmino(o: any): o is EpochInfoAmino { + return o && (o.$typeUrl === EpochInfo.typeUrl || typeof o.identifier === "string" && Timestamp.isAmino(o.start_time) && Duration.isAmino(o.duration) && typeof o.current_epoch === "bigint" && Timestamp.isAmino(o.current_epoch_start_time) && typeof o.epoch_counting_started === "boolean" && typeof o.current_epoch_start_height === "bigint"); + }, encode(message: EpochInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.identifier !== "") { writer.uint32(10).string(message.identifier); @@ -357,7 +367,8 @@ export const EpochInfo = { typeUrl: "/osmosis.epochs.v1beta1.EpochInfo", value: EpochInfo.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseGenesisState(): GenesisState { return { @@ -373,6 +384,15 @@ function createBaseGenesisState(): GenesisState { export const GenesisState = { typeUrl: "/osmosis.epochs.v1beta1.GenesisState", aminoType: "osmosis/epochs/genesis-state", + is(o: any): o is GenesisState { + return o && (o.$typeUrl === GenesisState.typeUrl || Array.isArray(o.epochs) && (!o.epochs.length || EpochInfo.is(o.epochs[0]))); + }, + isSDK(o: any): o is GenesisStateSDKType { + return o && (o.$typeUrl === GenesisState.typeUrl || Array.isArray(o.epochs) && (!o.epochs.length || EpochInfo.isSDK(o.epochs[0]))); + }, + isAmino(o: any): o is GenesisStateAmino { + return o && (o.$typeUrl === GenesisState.typeUrl || Array.isArray(o.epochs) && (!o.epochs.length || EpochInfo.isAmino(o.epochs[0]))); + }, encode(message: GenesisState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.epochs) { EpochInfo.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -445,5 +465,11 @@ export const GenesisState = { typeUrl: "/osmosis.epochs.v1beta1.GenesisState", value: GenesisState.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GenesisState.typeUrl)) { + return; + } + EpochInfo.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/osmosis/epochs/query.rpc.func.ts b/__fixtures__/v-next/outputv3/osmosis/epochs/query.rpc.func.ts new file mode 100644 index 0000000000..1b6736d692 --- /dev/null +++ b/__fixtures__/v-next/outputv3/osmosis/epochs/query.rpc.func.ts @@ -0,0 +1,29 @@ +import { EpochInfo, EpochInfoSDKType } from "./genesis"; +import { EndpointOrRpc, buildQuery } from "../../helper-func-types"; +import { QueryEpochsInfoRequest, QueryEpochsInfoRequestSDKType, QueryEpochsInfoResponse, QueryEpochsInfoResponseSDKType, QueryCurrentEpochRequest, QueryCurrentEpochRequestSDKType, QueryCurrentEpochResponse, QueryCurrentEpochResponseSDKType } from "./query"; +/** + * EpochInfos provide running epochInfos + * @name getEpochInfos + * @package osmosis.epochs.v1beta1 + * @see proto service: osmosis.epochs.v1beta1.EpochInfos + */ +export const getEpochInfos = buildQuery({ + encode: QueryEpochsInfoRequest.encode, + decode: QueryEpochsInfoResponse.decode, + service: "osmosis.epochs.v1beta1.Query", + method: "EpochInfos", + deps: [QueryEpochsInfoRequest, QueryEpochsInfoResponse] +}); +/** + * CurrentEpoch provide current epoch of specified identifier + * @name getCurrentEpoch + * @package osmosis.epochs.v1beta1 + * @see proto service: osmosis.epochs.v1beta1.CurrentEpoch + */ +export const getCurrentEpoch = buildQuery({ + encode: QueryCurrentEpochRequest.encode, + decode: QueryCurrentEpochResponse.decode, + service: "osmosis.epochs.v1beta1.Query", + method: "CurrentEpoch", + deps: [QueryCurrentEpochRequest, QueryCurrentEpochResponse] +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/osmosis/epochs/query.ts b/__fixtures__/v-next/outputv3/osmosis/epochs/query.ts index 0d778dda68..362dc13521 100644 --- a/__fixtures__/v-next/outputv3/osmosis/epochs/query.ts +++ b/__fixtures__/v-next/outputv3/osmosis/epochs/query.ts @@ -1,6 +1,7 @@ import { EpochInfo, EpochInfoAmino, EpochInfoSDKType } from "./genesis"; import { BinaryReader, BinaryWriter } from "../../binary"; import { DeepPartial, isSet } from "../../helpers"; +import { GlobalDecoderRegistry } from "../../registry"; export const protobufPackage = "osmosis.epochs.v1beta1"; /** * @name QueryEpochsInfoRequest @@ -119,6 +120,15 @@ function createBaseQueryEpochsInfoRequest(): QueryEpochsInfoRequest { export const QueryEpochsInfoRequest = { typeUrl: "/osmosis.epochs.v1beta1.QueryEpochsInfoRequest", aminoType: "osmosis/epochs/query-epochs-info-request", + is(o: any): o is QueryEpochsInfoRequest { + return o && o.$typeUrl === QueryEpochsInfoRequest.typeUrl; + }, + isSDK(o: any): o is QueryEpochsInfoRequestSDKType { + return o && o.$typeUrl === QueryEpochsInfoRequest.typeUrl; + }, + isAmino(o: any): o is QueryEpochsInfoRequestAmino { + return o && o.$typeUrl === QueryEpochsInfoRequest.typeUrl; + }, encode(_: QueryEpochsInfoRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -170,7 +180,8 @@ export const QueryEpochsInfoRequest = { typeUrl: "/osmosis.epochs.v1beta1.QueryEpochsInfoRequest", value: QueryEpochsInfoRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryEpochsInfoResponse(): QueryEpochsInfoResponse { return { @@ -185,6 +196,15 @@ function createBaseQueryEpochsInfoResponse(): QueryEpochsInfoResponse { export const QueryEpochsInfoResponse = { typeUrl: "/osmosis.epochs.v1beta1.QueryEpochsInfoResponse", aminoType: "osmosis/epochs/query-epochs-info-response", + is(o: any): o is QueryEpochsInfoResponse { + return o && (o.$typeUrl === QueryEpochsInfoResponse.typeUrl || Array.isArray(o.epochs) && (!o.epochs.length || EpochInfo.is(o.epochs[0]))); + }, + isSDK(o: any): o is QueryEpochsInfoResponseSDKType { + return o && (o.$typeUrl === QueryEpochsInfoResponse.typeUrl || Array.isArray(o.epochs) && (!o.epochs.length || EpochInfo.isSDK(o.epochs[0]))); + }, + isAmino(o: any): o is QueryEpochsInfoResponseAmino { + return o && (o.$typeUrl === QueryEpochsInfoResponse.typeUrl || Array.isArray(o.epochs) && (!o.epochs.length || EpochInfo.isAmino(o.epochs[0]))); + }, encode(message: QueryEpochsInfoResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.epochs) { EpochInfo.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -257,6 +277,12 @@ export const QueryEpochsInfoResponse = { typeUrl: "/osmosis.epochs.v1beta1.QueryEpochsInfoResponse", value: QueryEpochsInfoResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryEpochsInfoResponse.typeUrl)) { + return; + } + EpochInfo.registerTypeUrl(); } }; function createBaseQueryCurrentEpochRequest(): QueryCurrentEpochRequest { @@ -272,6 +298,15 @@ function createBaseQueryCurrentEpochRequest(): QueryCurrentEpochRequest { export const QueryCurrentEpochRequest = { typeUrl: "/osmosis.epochs.v1beta1.QueryCurrentEpochRequest", aminoType: "osmosis/epochs/query-current-epoch-request", + is(o: any): o is QueryCurrentEpochRequest { + return o && (o.$typeUrl === QueryCurrentEpochRequest.typeUrl || typeof o.identifier === "string"); + }, + isSDK(o: any): o is QueryCurrentEpochRequestSDKType { + return o && (o.$typeUrl === QueryCurrentEpochRequest.typeUrl || typeof o.identifier === "string"); + }, + isAmino(o: any): o is QueryCurrentEpochRequestAmino { + return o && (o.$typeUrl === QueryCurrentEpochRequest.typeUrl || typeof o.identifier === "string"); + }, encode(message: QueryCurrentEpochRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.identifier !== "") { writer.uint32(10).string(message.identifier); @@ -338,7 +373,8 @@ export const QueryCurrentEpochRequest = { typeUrl: "/osmosis.epochs.v1beta1.QueryCurrentEpochRequest", value: QueryCurrentEpochRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryCurrentEpochResponse(): QueryCurrentEpochResponse { return { @@ -353,6 +389,15 @@ function createBaseQueryCurrentEpochResponse(): QueryCurrentEpochResponse { export const QueryCurrentEpochResponse = { typeUrl: "/osmosis.epochs.v1beta1.QueryCurrentEpochResponse", aminoType: "osmosis/epochs/query-current-epoch-response", + is(o: any): o is QueryCurrentEpochResponse { + return o && (o.$typeUrl === QueryCurrentEpochResponse.typeUrl || typeof o.currentEpoch === "bigint"); + }, + isSDK(o: any): o is QueryCurrentEpochResponseSDKType { + return o && (o.$typeUrl === QueryCurrentEpochResponse.typeUrl || typeof o.current_epoch === "bigint"); + }, + isAmino(o: any): o is QueryCurrentEpochResponseAmino { + return o && (o.$typeUrl === QueryCurrentEpochResponse.typeUrl || typeof o.current_epoch === "bigint"); + }, encode(message: QueryCurrentEpochResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.currentEpoch !== BigInt(0)) { writer.uint32(8).int64(message.currentEpoch); @@ -421,5 +466,6 @@ export const QueryCurrentEpochResponse = { typeUrl: "/osmosis.epochs.v1beta1.QueryCurrentEpochResponse", value: QueryCurrentEpochResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/osmosis/gamm/pool-models/balancer/balancerPool.ts b/__fixtures__/v-next/outputv3/osmosis/gamm/pool-models/balancer/balancerPool.ts index cb16c9604b..280de65b15 100644 --- a/__fixtures__/v-next/outputv3/osmosis/gamm/pool-models/balancer/balancerPool.ts +++ b/__fixtures__/v-next/outputv3/osmosis/gamm/pool-models/balancer/balancerPool.ts @@ -3,7 +3,8 @@ import { Duration, DurationAmino, DurationSDKType } from "../../../../google/pro import { Coin, CoinAmino, CoinSDKType } from "../../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../../binary"; import { toTimestamp, fromTimestamp, isSet, DeepPartial } from "../../../../helpers"; -import { Decimal } from "@cosmjs/math"; +import { GlobalDecoderRegistry } from "../../../../registry"; +import { Decimal } from "@interchainjs/math"; export const protobufPackage = "osmosis.gamm.v1beta1"; /** * Parameters for changing the weights in a balancer pool smoothly from @@ -337,6 +338,15 @@ function createBaseSmoothWeightChangeParams(): SmoothWeightChangeParams { export const SmoothWeightChangeParams = { typeUrl: "/osmosis.gamm.v1beta1.SmoothWeightChangeParams", aminoType: "osmosis/gamm/smooth-weight-change-params", + is(o: any): o is SmoothWeightChangeParams { + return o && (o.$typeUrl === SmoothWeightChangeParams.typeUrl || Timestamp.is(o.startTime) && Duration.is(o.duration) && Array.isArray(o.initialPoolWeights) && (!o.initialPoolWeights.length || PoolAsset.is(o.initialPoolWeights[0])) && Array.isArray(o.targetPoolWeights) && (!o.targetPoolWeights.length || PoolAsset.is(o.targetPoolWeights[0]))); + }, + isSDK(o: any): o is SmoothWeightChangeParamsSDKType { + return o && (o.$typeUrl === SmoothWeightChangeParams.typeUrl || Timestamp.isSDK(o.start_time) && Duration.isSDK(o.duration) && Array.isArray(o.initial_pool_weights) && (!o.initial_pool_weights.length || PoolAsset.isSDK(o.initial_pool_weights[0])) && Array.isArray(o.target_pool_weights) && (!o.target_pool_weights.length || PoolAsset.isSDK(o.target_pool_weights[0]))); + }, + isAmino(o: any): o is SmoothWeightChangeParamsAmino { + return o && (o.$typeUrl === SmoothWeightChangeParams.typeUrl || Timestamp.isAmino(o.start_time) && Duration.isAmino(o.duration) && Array.isArray(o.initial_pool_weights) && (!o.initial_pool_weights.length || PoolAsset.isAmino(o.initial_pool_weights[0])) && Array.isArray(o.target_pool_weights) && (!o.target_pool_weights.length || PoolAsset.isAmino(o.target_pool_weights[0]))); + }, encode(message: SmoothWeightChangeParams, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.startTime !== undefined) { Timestamp.encode(toTimestamp(message.startTime), writer.uint32(10).fork()).ldelim(); @@ -459,6 +469,12 @@ export const SmoothWeightChangeParams = { typeUrl: "/osmosis.gamm.v1beta1.SmoothWeightChangeParams", value: SmoothWeightChangeParams.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(SmoothWeightChangeParams.typeUrl)) { + return; + } + PoolAsset.registerTypeUrl(); } }; function createBasePoolParams(): PoolParams { @@ -480,6 +496,15 @@ function createBasePoolParams(): PoolParams { export const PoolParams = { typeUrl: "/osmosis.gamm.v1beta1.PoolParams", aminoType: "osmosis/gamm/pool-params", + is(o: any): o is PoolParams { + return o && (o.$typeUrl === PoolParams.typeUrl || typeof o.swapFee === "string" && typeof o.exitFee === "string"); + }, + isSDK(o: any): o is PoolParamsSDKType { + return o && (o.$typeUrl === PoolParams.typeUrl || typeof o.swap_fee === "string" && typeof o.exit_fee === "string"); + }, + isAmino(o: any): o is PoolParamsAmino { + return o && (o.$typeUrl === PoolParams.typeUrl || typeof o.swap_fee === "string" && typeof o.exit_fee === "string"); + }, encode(message: PoolParams, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.swapFee !== "") { writer.uint32(10).string(Decimal.fromUserInput(message.swapFee, 18).atomics); @@ -560,8 +585,8 @@ export const PoolParams = { }, toAmino(message: PoolParams, useInterfaces: boolean = true): PoolParamsAmino { const obj: any = {}; - obj.swap_fee = message.swapFee === "" ? undefined : message.swapFee; - obj.exit_fee = message.exitFee === "" ? undefined : message.exitFee; + obj.swap_fee = message.swapFee === "" ? undefined : Decimal.fromUserInput(message.swapFee, 18).atomics; + obj.exit_fee = message.exitFee === "" ? undefined : Decimal.fromUserInput(message.exitFee, 18).atomics; obj.smooth_weight_change_params = message.smoothWeightChangeParams ? SmoothWeightChangeParams.toAmino(message.smoothWeightChangeParams, useInterfaces) : undefined; return obj; }, @@ -576,6 +601,12 @@ export const PoolParams = { typeUrl: "/osmosis.gamm.v1beta1.PoolParams", value: PoolParams.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(PoolParams.typeUrl)) { + return; + } + SmoothWeightChangeParams.registerTypeUrl(); } }; function createBasePoolAsset(): PoolAsset { @@ -596,6 +627,15 @@ function createBasePoolAsset(): PoolAsset { export const PoolAsset = { typeUrl: "/osmosis.gamm.v1beta1.PoolAsset", aminoType: "osmosis/gamm/pool-asset", + is(o: any): o is PoolAsset { + return o && (o.$typeUrl === PoolAsset.typeUrl || Coin.is(o.token) && typeof o.weight === "string"); + }, + isSDK(o: any): o is PoolAssetSDKType { + return o && (o.$typeUrl === PoolAsset.typeUrl || Coin.isSDK(o.token) && typeof o.weight === "string"); + }, + isAmino(o: any): o is PoolAssetAmino { + return o && (o.$typeUrl === PoolAsset.typeUrl || Coin.isAmino(o.token) && typeof o.weight === "string"); + }, encode(message: PoolAsset, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.token !== undefined) { Coin.encode(message.token, writer.uint32(10).fork()).ldelim(); @@ -678,6 +718,12 @@ export const PoolAsset = { typeUrl: "/osmosis.gamm.v1beta1.PoolAsset", value: PoolAsset.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(PoolAsset.typeUrl)) { + return; + } + Coin.registerTypeUrl(); } }; function createBasePool(): Pool { @@ -700,6 +746,15 @@ function createBasePool(): Pool { export const Pool = { typeUrl: "/osmosis.gamm.v1beta1.Pool", aminoType: "osmosis/gamm/pool", + is(o: any): o is Pool { + return o && (o.$typeUrl === Pool.typeUrl || typeof o.address === "string" && typeof o.id === "bigint" && PoolParams.is(o.poolParams) && typeof o.futurePoolGovernor === "string" && Coin.is(o.totalShares) && Array.isArray(o.poolAssets) && (!o.poolAssets.length || PoolAsset.is(o.poolAssets[0])) && typeof o.totalWeight === "string"); + }, + isSDK(o: any): o is PoolSDKType { + return o && (o.$typeUrl === Pool.typeUrl || typeof o.address === "string" && typeof o.id === "bigint" && PoolParams.isSDK(o.pool_params) && typeof o.future_pool_governor === "string" && Coin.isSDK(o.total_shares) && Array.isArray(o.pool_assets) && (!o.pool_assets.length || PoolAsset.isSDK(o.pool_assets[0])) && typeof o.total_weight === "string"); + }, + isAmino(o: any): o is PoolAmino { + return o && (o.$typeUrl === Pool.typeUrl || typeof o.address === "string" && typeof o.id === "bigint" && PoolParams.isAmino(o.pool_params) && typeof o.future_pool_governor === "string" && Coin.isAmino(o.total_shares) && Array.isArray(o.pool_assets) && (!o.pool_assets.length || PoolAsset.isAmino(o.pool_assets[0])) && typeof o.total_weight === "string"); + }, encode(message: Pool, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.address !== "") { writer.uint32(10).string(message.address); @@ -862,5 +917,15 @@ export const Pool = { typeUrl: "/osmosis.gamm.v1beta1.Pool", value: Pool.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Pool.typeUrl)) { + return; + } + GlobalDecoderRegistry.register(Pool.typeUrl, Pool); + GlobalDecoderRegistry.registerAminoProtoMapping(Pool.aminoType, Pool.typeUrl); + PoolParams.registerTypeUrl(); + Coin.registerTypeUrl(); + PoolAsset.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/osmosis/gamm/pool-models/balancer/tx/tx.registry.ts b/__fixtures__/v-next/outputv3/osmosis/gamm/pool-models/balancer/tx/tx.registry.ts index 3f5a3e730d..9bcbb4282c 100644 --- a/__fixtures__/v-next/outputv3/osmosis/gamm/pool-models/balancer/tx/tx.registry.ts +++ b/__fixtures__/v-next/outputv3/osmosis/gamm/pool-models/balancer/tx/tx.registry.ts @@ -1,12 +1,7 @@ import { PoolParams, PoolParamsSDKType, PoolAsset, PoolAssetSDKType } from "../balancerPool"; -import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { TelescopeGeneratedType } from "../../../../../types"; import { MsgCreateBalancerPool, MsgCreateBalancerPoolSDKType } from "./tx"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/osmosis.gamm.poolmodels.balancer.v1beta1.MsgCreateBalancerPool", MsgCreateBalancerPool]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/osmosis.gamm.poolmodels.balancer.v1beta1.MsgCreateBalancerPool", MsgCreateBalancerPool]]; export const MessageComposer = { encoded: { createBalancerPool(value: MsgCreateBalancerPool) { diff --git a/__fixtures__/v-next/outputv3/osmosis/gamm/pool-models/balancer/tx/tx.rpc.func.ts b/__fixtures__/v-next/outputv3/osmosis/gamm/pool-models/balancer/tx/tx.rpc.func.ts new file mode 100644 index 0000000000..d5b603efb5 --- /dev/null +++ b/__fixtures__/v-next/outputv3/osmosis/gamm/pool-models/balancer/tx/tx.rpc.func.ts @@ -0,0 +1,11 @@ +import { PoolParams, PoolParamsSDKType, PoolAsset, PoolAssetSDKType } from "../balancerPool"; +import { buildTx } from "../../../../../helper-func-types"; +import { MsgCreateBalancerPool, MsgCreateBalancerPoolSDKType, MsgCreateBalancerPoolResponse, MsgCreateBalancerPoolResponseSDKType } from "./tx"; +/** + * @name createBalancerPool + * @package osmosis.gamm.poolmodels.balancer.v1beta1 + * @see proto service: osmosis.gamm.poolmodels.balancer.v1beta1.CreateBalancerPool + */ +export const createBalancerPool = buildTx({ + msg: MsgCreateBalancerPool +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/osmosis/gamm/pool-models/balancer/tx/tx.ts b/__fixtures__/v-next/outputv3/osmosis/gamm/pool-models/balancer/tx/tx.ts index 2fbeb6af57..a7b9a8a40c 100644 --- a/__fixtures__/v-next/outputv3/osmosis/gamm/pool-models/balancer/tx/tx.ts +++ b/__fixtures__/v-next/outputv3/osmosis/gamm/pool-models/balancer/tx/tx.ts @@ -1,5 +1,6 @@ import { PoolParams, PoolParamsAmino, PoolParamsSDKType, PoolAsset, PoolAssetAmino, PoolAssetSDKType } from "../balancerPool"; import { BinaryReader, BinaryWriter } from "../../../../../binary"; +import { GlobalDecoderRegistry } from "../../../../../registry"; import { isSet, DeepPartial } from "../../../../../helpers"; export const protobufPackage = "osmosis.gamm.poolmodels.balancer.v1beta1"; /** @@ -90,6 +91,15 @@ function createBaseMsgCreateBalancerPool(): MsgCreateBalancerPool { export const MsgCreateBalancerPool = { typeUrl: "/osmosis.gamm.poolmodels.balancer.v1beta1.MsgCreateBalancerPool", aminoType: "osmosis/gamm/poolmodels/balancer/create-balancer-pool", + is(o: any): o is MsgCreateBalancerPool { + return o && (o.$typeUrl === MsgCreateBalancerPool.typeUrl || typeof o.sender === "string" && Array.isArray(o.poolAssets) && (!o.poolAssets.length || PoolAsset.is(o.poolAssets[0])) && typeof o.futurePoolGovernor === "string"); + }, + isSDK(o: any): o is MsgCreateBalancerPoolSDKType { + return o && (o.$typeUrl === MsgCreateBalancerPool.typeUrl || typeof o.sender === "string" && Array.isArray(o.pool_assets) && (!o.pool_assets.length || PoolAsset.isSDK(o.pool_assets[0])) && typeof o.future_pool_governor === "string"); + }, + isAmino(o: any): o is MsgCreateBalancerPoolAmino { + return o && (o.$typeUrl === MsgCreateBalancerPool.typeUrl || typeof o.sender === "string" && Array.isArray(o.pool_assets) && (!o.pool_assets.length || PoolAsset.isAmino(o.pool_assets[0])) && typeof o.future_pool_governor === "string"); + }, encode(message: MsgCreateBalancerPool, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.sender !== "") { writer.uint32(10).string(message.sender); @@ -206,6 +216,13 @@ export const MsgCreateBalancerPool = { typeUrl: "/osmosis.gamm.poolmodels.balancer.v1beta1.MsgCreateBalancerPool", value: MsgCreateBalancerPool.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgCreateBalancerPool.typeUrl)) { + return; + } + PoolParams.registerTypeUrl(); + PoolAsset.registerTypeUrl(); } }; function createBaseMsgCreateBalancerPoolResponse(): MsgCreateBalancerPoolResponse { @@ -222,6 +239,15 @@ function createBaseMsgCreateBalancerPoolResponse(): MsgCreateBalancerPoolRespons export const MsgCreateBalancerPoolResponse = { typeUrl: "/osmosis.gamm.poolmodels.balancer.v1beta1.MsgCreateBalancerPoolResponse", aminoType: "osmosis/gamm/poolmodels/balancer/create-balancer-pool-response", + is(o: any): o is MsgCreateBalancerPoolResponse { + return o && (o.$typeUrl === MsgCreateBalancerPoolResponse.typeUrl || typeof o.poolId === "bigint"); + }, + isSDK(o: any): o is MsgCreateBalancerPoolResponseSDKType { + return o && (o.$typeUrl === MsgCreateBalancerPoolResponse.typeUrl || typeof o.pool_id === "bigint"); + }, + isAmino(o: any): o is MsgCreateBalancerPoolResponseAmino { + return o && (o.$typeUrl === MsgCreateBalancerPoolResponse.typeUrl || typeof o.pool_id === "bigint"); + }, encode(message: MsgCreateBalancerPoolResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.poolId !== BigInt(0)) { writer.uint32(8).uint64(message.poolId); @@ -290,5 +316,6 @@ export const MsgCreateBalancerPoolResponse = { typeUrl: "/osmosis.gamm.poolmodels.balancer.v1beta1.MsgCreateBalancerPoolResponse", value: MsgCreateBalancerPoolResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/osmosis/gamm/pool-models/stableswap/stableswap_pool.ts b/__fixtures__/v-next/outputv3/osmosis/gamm/pool-models/stableswap/stableswap_pool.ts index 1fa2b07830..873cff9784 100644 --- a/__fixtures__/v-next/outputv3/osmosis/gamm/pool-models/stableswap/stableswap_pool.ts +++ b/__fixtures__/v-next/outputv3/osmosis/gamm/pool-models/stableswap/stableswap_pool.ts @@ -1,7 +1,8 @@ import { Coin, CoinAmino, CoinSDKType } from "../../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { Decimal } from "@cosmjs/math"; +import { Decimal } from "@interchainjs/math"; import { isSet, DeepPartial } from "../../../../helpers"; +import { GlobalDecoderRegistry } from "../../../../registry"; export const protobufPackage = "osmosis.gamm.poolmodels.stableswap.v1beta1"; /** * PoolParams defined the parameters that will be managed by the pool @@ -162,6 +163,15 @@ function createBasePoolParams(): PoolParams { export const PoolParams = { typeUrl: "/osmosis.gamm.poolmodels.stableswap.v1beta1.PoolParams", aminoType: "osmosis/gamm/pool-params", + is(o: any): o is PoolParams { + return o && (o.$typeUrl === PoolParams.typeUrl || typeof o.swapFee === "string" && typeof o.exitFee === "string"); + }, + isSDK(o: any): o is PoolParamsSDKType { + return o && (o.$typeUrl === PoolParams.typeUrl || typeof o.swap_fee === "string" && typeof o.exit_fee === "string"); + }, + isAmino(o: any): o is PoolParamsAmino { + return o && (o.$typeUrl === PoolParams.typeUrl || typeof o.swap_fee === "string" && typeof o.exit_fee === "string"); + }, encode(message: PoolParams, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.swapFee !== "") { writer.uint32(10).string(Decimal.fromUserInput(message.swapFee, 18).atomics); @@ -227,8 +237,8 @@ export const PoolParams = { }, toAmino(message: PoolParams, useInterfaces: boolean = true): PoolParamsAmino { const obj: any = {}; - obj.swap_fee = message.swapFee === "" ? undefined : message.swapFee; - obj.exit_fee = message.exitFee === "" ? undefined : message.exitFee; + obj.swap_fee = message.swapFee === "" ? undefined : Decimal.fromUserInput(message.swapFee, 18).atomics; + obj.exit_fee = message.exitFee === "" ? undefined : Decimal.fromUserInput(message.exitFee, 18).atomics; return obj; }, fromProtoMsg(message: PoolParamsProtoMsg, useInterfaces: boolean = true): PoolParams { @@ -242,7 +252,8 @@ export const PoolParams = { typeUrl: "/osmosis.gamm.poolmodels.stableswap.v1beta1.PoolParams", value: PoolParams.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBasePool(): Pool { return { @@ -266,6 +277,15 @@ function createBasePool(): Pool { export const Pool = { typeUrl: "/osmosis.gamm.poolmodels.stableswap.v1beta1.Pool", aminoType: "osmosis/gamm/pool", + is(o: any): o is Pool { + return o && (o.$typeUrl === Pool.typeUrl || typeof o.address === "string" && typeof o.id === "bigint" && PoolParams.is(o.poolParams) && typeof o.futurePoolGovernor === "string" && Coin.is(o.totalShares) && Array.isArray(o.poolLiquidity) && (!o.poolLiquidity.length || Coin.is(o.poolLiquidity[0])) && Array.isArray(o.scalingFactors) && (!o.scalingFactors.length || typeof o.scalingFactors[0] === "bigint") && typeof o.scalingFactorController === "string"); + }, + isSDK(o: any): o is PoolSDKType { + return o && (o.$typeUrl === Pool.typeUrl || typeof o.address === "string" && typeof o.id === "bigint" && PoolParams.isSDK(o.pool_params) && typeof o.future_pool_governor === "string" && Coin.isSDK(o.total_shares) && Array.isArray(o.pool_liquidity) && (!o.pool_liquidity.length || Coin.isSDK(o.pool_liquidity[0])) && Array.isArray(o.scaling_factors) && (!o.scaling_factors.length || typeof o.scaling_factors[0] === "bigint") && typeof o.scaling_factor_controller === "string"); + }, + isAmino(o: any): o is PoolAmino { + return o && (o.$typeUrl === Pool.typeUrl || typeof o.address === "string" && typeof o.id === "bigint" && PoolParams.isAmino(o.pool_params) && typeof o.future_pool_governor === "string" && Coin.isAmino(o.total_shares) && Array.isArray(o.pool_liquidity) && (!o.pool_liquidity.length || Coin.isAmino(o.pool_liquidity[0])) && Array.isArray(o.scaling_factors) && (!o.scaling_factors.length || typeof o.scaling_factors[0] === "bigint") && typeof o.scaling_factor_controller === "string"); + }, encode(message: Pool, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.address !== "") { writer.uint32(10).string(message.address); @@ -457,5 +477,14 @@ export const Pool = { typeUrl: "/osmosis.gamm.poolmodels.stableswap.v1beta1.Pool", value: Pool.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Pool.typeUrl)) { + return; + } + GlobalDecoderRegistry.register(Pool.typeUrl, Pool); + GlobalDecoderRegistry.registerAminoProtoMapping(Pool.aminoType, Pool.typeUrl); + PoolParams.registerTypeUrl(); + Coin.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/osmosis/gamm/pool-models/stableswap/tx.registry.ts b/__fixtures__/v-next/outputv3/osmosis/gamm/pool-models/stableswap/tx.registry.ts index f596b5c979..20d5c48787 100644 --- a/__fixtures__/v-next/outputv3/osmosis/gamm/pool-models/stableswap/tx.registry.ts +++ b/__fixtures__/v-next/outputv3/osmosis/gamm/pool-models/stableswap/tx.registry.ts @@ -1,13 +1,8 @@ import { PoolParams, PoolParamsSDKType } from "./stableswap_pool"; import { Coin, CoinSDKType } from "../../../../cosmos/base/v1beta1/coin"; -import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { TelescopeGeneratedType } from "../../../../types"; import { MsgCreateStableswapPool, MsgCreateStableswapPoolSDKType, MsgStableSwapAdjustScalingFactors, MsgStableSwapAdjustScalingFactorsSDKType } from "./tx"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/osmosis.gamm.poolmodels.stableswap.v1beta1.MsgCreateStableswapPool", MsgCreateStableswapPool], ["/osmosis.gamm.poolmodels.stableswap.v1beta1.MsgStableSwapAdjustScalingFactors", MsgStableSwapAdjustScalingFactors]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/osmosis.gamm.poolmodels.stableswap.v1beta1.MsgCreateStableswapPool", MsgCreateStableswapPool], ["/osmosis.gamm.poolmodels.stableswap.v1beta1.MsgStableSwapAdjustScalingFactors", MsgStableSwapAdjustScalingFactors]]; export const MessageComposer = { encoded: { createStableswapPool(value: MsgCreateStableswapPool) { diff --git a/__fixtures__/v-next/outputv3/osmosis/gamm/pool-models/stableswap/tx.rpc.func.ts b/__fixtures__/v-next/outputv3/osmosis/gamm/pool-models/stableswap/tx.rpc.func.ts new file mode 100644 index 0000000000..6e46af505b --- /dev/null +++ b/__fixtures__/v-next/outputv3/osmosis/gamm/pool-models/stableswap/tx.rpc.func.ts @@ -0,0 +1,20 @@ +import { PoolParams, PoolParamsSDKType } from "./stableswap_pool"; +import { Coin, CoinSDKType } from "../../../../cosmos/base/v1beta1/coin"; +import { buildTx } from "../../../../helper-func-types"; +import { MsgCreateStableswapPool, MsgCreateStableswapPoolSDKType, MsgCreateStableswapPoolResponse, MsgCreateStableswapPoolResponseSDKType, MsgStableSwapAdjustScalingFactors, MsgStableSwapAdjustScalingFactorsSDKType, MsgStableSwapAdjustScalingFactorsResponse, MsgStableSwapAdjustScalingFactorsResponseSDKType } from "./tx"; +/** + * @name createStableswapPool + * @package osmosis.gamm.poolmodels.stableswap.v1beta1 + * @see proto service: osmosis.gamm.poolmodels.stableswap.v1beta1.CreateStableswapPool + */ +export const createStableswapPool = buildTx({ + msg: MsgCreateStableswapPool +}); +/** + * @name stableSwapAdjustScalingFactors + * @package osmosis.gamm.poolmodels.stableswap.v1beta1 + * @see proto service: osmosis.gamm.poolmodels.stableswap.v1beta1.StableSwapAdjustScalingFactors + */ +export const stableSwapAdjustScalingFactors = buildTx({ + msg: MsgStableSwapAdjustScalingFactors +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/osmosis/gamm/pool-models/stableswap/tx.ts b/__fixtures__/v-next/outputv3/osmosis/gamm/pool-models/stableswap/tx.ts index cde857642a..313b8dbff2 100644 --- a/__fixtures__/v-next/outputv3/osmosis/gamm/pool-models/stableswap/tx.ts +++ b/__fixtures__/v-next/outputv3/osmosis/gamm/pool-models/stableswap/tx.ts @@ -1,6 +1,7 @@ import { PoolParams, PoolParamsAmino, PoolParamsSDKType } from "./stableswap_pool"; import { Coin, CoinAmino, CoinSDKType } from "../../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { GlobalDecoderRegistry } from "../../../../registry"; import { isSet, DeepPartial } from "../../../../helpers"; export const protobufPackage = "osmosis.gamm.poolmodels.stableswap.v1beta1"; /** @@ -161,6 +162,15 @@ function createBaseMsgCreateStableswapPool(): MsgCreateStableswapPool { export const MsgCreateStableswapPool = { typeUrl: "/osmosis.gamm.poolmodels.stableswap.v1beta1.MsgCreateStableswapPool", aminoType: "osmosis/gamm/create-stableswap-pool", + is(o: any): o is MsgCreateStableswapPool { + return o && (o.$typeUrl === MsgCreateStableswapPool.typeUrl || typeof o.sender === "string" && Array.isArray(o.initialPoolLiquidity) && (!o.initialPoolLiquidity.length || Coin.is(o.initialPoolLiquidity[0])) && Array.isArray(o.scalingFactors) && (!o.scalingFactors.length || typeof o.scalingFactors[0] === "bigint") && typeof o.futurePoolGovernor === "string" && typeof o.scalingFactorController === "string"); + }, + isSDK(o: any): o is MsgCreateStableswapPoolSDKType { + return o && (o.$typeUrl === MsgCreateStableswapPool.typeUrl || typeof o.sender === "string" && Array.isArray(o.initial_pool_liquidity) && (!o.initial_pool_liquidity.length || Coin.isSDK(o.initial_pool_liquidity[0])) && Array.isArray(o.scaling_factors) && (!o.scaling_factors.length || typeof o.scaling_factors[0] === "bigint") && typeof o.future_pool_governor === "string" && typeof o.scaling_factor_controller === "string"); + }, + isAmino(o: any): o is MsgCreateStableswapPoolAmino { + return o && (o.$typeUrl === MsgCreateStableswapPool.typeUrl || typeof o.sender === "string" && Array.isArray(o.initial_pool_liquidity) && (!o.initial_pool_liquidity.length || Coin.isAmino(o.initial_pool_liquidity[0])) && Array.isArray(o.scaling_factors) && (!o.scaling_factors.length || typeof o.scaling_factors[0] === "bigint") && typeof o.future_pool_governor === "string" && typeof o.scaling_factor_controller === "string"); + }, encode(message: MsgCreateStableswapPool, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.sender !== "") { writer.uint32(10).string(message.sender); @@ -320,6 +330,13 @@ export const MsgCreateStableswapPool = { typeUrl: "/osmosis.gamm.poolmodels.stableswap.v1beta1.MsgCreateStableswapPool", value: MsgCreateStableswapPool.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgCreateStableswapPool.typeUrl)) { + return; + } + PoolParams.registerTypeUrl(); + Coin.registerTypeUrl(); } }; function createBaseMsgCreateStableswapPoolResponse(): MsgCreateStableswapPoolResponse { @@ -336,6 +353,15 @@ function createBaseMsgCreateStableswapPoolResponse(): MsgCreateStableswapPoolRes export const MsgCreateStableswapPoolResponse = { typeUrl: "/osmosis.gamm.poolmodels.stableswap.v1beta1.MsgCreateStableswapPoolResponse", aminoType: "osmosis/gamm/create-stableswap-pool-response", + is(o: any): o is MsgCreateStableswapPoolResponse { + return o && (o.$typeUrl === MsgCreateStableswapPoolResponse.typeUrl || typeof o.poolId === "bigint"); + }, + isSDK(o: any): o is MsgCreateStableswapPoolResponseSDKType { + return o && (o.$typeUrl === MsgCreateStableswapPoolResponse.typeUrl || typeof o.pool_id === "bigint"); + }, + isAmino(o: any): o is MsgCreateStableswapPoolResponseAmino { + return o && (o.$typeUrl === MsgCreateStableswapPoolResponse.typeUrl || typeof o.pool_id === "bigint"); + }, encode(message: MsgCreateStableswapPoolResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.poolId !== BigInt(0)) { writer.uint32(8).uint64(message.poolId); @@ -404,7 +430,8 @@ export const MsgCreateStableswapPoolResponse = { typeUrl: "/osmosis.gamm.poolmodels.stableswap.v1beta1.MsgCreateStableswapPoolResponse", value: MsgCreateStableswapPoolResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgStableSwapAdjustScalingFactors(): MsgStableSwapAdjustScalingFactors { return { @@ -423,6 +450,15 @@ function createBaseMsgStableSwapAdjustScalingFactors(): MsgStableSwapAdjustScali export const MsgStableSwapAdjustScalingFactors = { typeUrl: "/osmosis.gamm.poolmodels.stableswap.v1beta1.MsgStableSwapAdjustScalingFactors", aminoType: "osmosis/gamm/stable-swap-adjust-scaling-factors", + is(o: any): o is MsgStableSwapAdjustScalingFactors { + return o && (o.$typeUrl === MsgStableSwapAdjustScalingFactors.typeUrl || typeof o.sender === "string" && typeof o.poolId === "bigint" && Array.isArray(o.scalingFactors) && (!o.scalingFactors.length || typeof o.scalingFactors[0] === "bigint")); + }, + isSDK(o: any): o is MsgStableSwapAdjustScalingFactorsSDKType { + return o && (o.$typeUrl === MsgStableSwapAdjustScalingFactors.typeUrl || typeof o.sender === "string" && typeof o.pool_id === "bigint" && Array.isArray(o.scaling_factors) && (!o.scaling_factors.length || typeof o.scaling_factors[0] === "bigint")); + }, + isAmino(o: any): o is MsgStableSwapAdjustScalingFactorsAmino { + return o && (o.$typeUrl === MsgStableSwapAdjustScalingFactors.typeUrl || typeof o.sender === "string" && typeof o.pool_id === "bigint" && Array.isArray(o.scaling_factors) && (!o.scaling_factors.length || typeof o.scaling_factors[0] === "bigint")); + }, encode(message: MsgStableSwapAdjustScalingFactors, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.sender !== "") { writer.uint32(10).string(message.sender); @@ -534,7 +570,8 @@ export const MsgStableSwapAdjustScalingFactors = { typeUrl: "/osmosis.gamm.poolmodels.stableswap.v1beta1.MsgStableSwapAdjustScalingFactors", value: MsgStableSwapAdjustScalingFactors.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgStableSwapAdjustScalingFactorsResponse(): MsgStableSwapAdjustScalingFactorsResponse { return {}; @@ -547,6 +584,15 @@ function createBaseMsgStableSwapAdjustScalingFactorsResponse(): MsgStableSwapAdj export const MsgStableSwapAdjustScalingFactorsResponse = { typeUrl: "/osmosis.gamm.poolmodels.stableswap.v1beta1.MsgStableSwapAdjustScalingFactorsResponse", aminoType: "osmosis/gamm/stable-swap-adjust-scaling-factors-response", + is(o: any): o is MsgStableSwapAdjustScalingFactorsResponse { + return o && o.$typeUrl === MsgStableSwapAdjustScalingFactorsResponse.typeUrl; + }, + isSDK(o: any): o is MsgStableSwapAdjustScalingFactorsResponseSDKType { + return o && o.$typeUrl === MsgStableSwapAdjustScalingFactorsResponse.typeUrl; + }, + isAmino(o: any): o is MsgStableSwapAdjustScalingFactorsResponseAmino { + return o && o.$typeUrl === MsgStableSwapAdjustScalingFactorsResponse.typeUrl; + }, encode(_: MsgStableSwapAdjustScalingFactorsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -598,5 +644,6 @@ export const MsgStableSwapAdjustScalingFactorsResponse = { typeUrl: "/osmosis.gamm.poolmodels.stableswap.v1beta1.MsgStableSwapAdjustScalingFactorsResponse", value: MsgStableSwapAdjustScalingFactorsResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/osmosis/gamm/v1beta1/genesis.ts b/__fixtures__/v-next/outputv3/osmosis/gamm/v1beta1/genesis.ts index 6715271ba6..767e32dc32 100644 --- a/__fixtures__/v-next/outputv3/osmosis/gamm/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv3/osmosis/gamm/v1beta1/genesis.ts @@ -8,6 +8,7 @@ import { PoolProtoMsg as Pool2ProtoMsg } from "../pool-models/stableswap/stables import { PoolSDKType as Pool2SDKType } from "../pool-models/stableswap/stableswap_pool"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { DeepPartial, isSet } from "../../../helpers"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "osmosis.gamm.v1beta1"; /** * Params holds parameters for the incentives module @@ -100,6 +101,15 @@ function createBaseParams(): Params { export const Params = { typeUrl: "/osmosis.gamm.v1beta1.Params", aminoType: "osmosis/gamm/params", + is(o: any): o is Params { + return o && (o.$typeUrl === Params.typeUrl || Array.isArray(o.poolCreationFee) && (!o.poolCreationFee.length || Coin.is(o.poolCreationFee[0]))); + }, + isSDK(o: any): o is ParamsSDKType { + return o && (o.$typeUrl === Params.typeUrl || Array.isArray(o.pool_creation_fee) && (!o.pool_creation_fee.length || Coin.isSDK(o.pool_creation_fee[0]))); + }, + isAmino(o: any): o is ParamsAmino { + return o && (o.$typeUrl === Params.typeUrl || Array.isArray(o.pool_creation_fee) && (!o.pool_creation_fee.length || Coin.isAmino(o.pool_creation_fee[0]))); + }, encode(message: Params, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.poolCreationFee) { Coin.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -172,6 +182,12 @@ export const Params = { typeUrl: "/osmosis.gamm.v1beta1.Params", value: Params.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Params.typeUrl)) { + return; + } + Coin.registerTypeUrl(); } }; function createBaseGenesisState(): GenesisState { @@ -190,9 +206,18 @@ function createBaseGenesisState(): GenesisState { export const GenesisState = { typeUrl: "/osmosis.gamm.v1beta1.GenesisState", aminoType: "osmosis/gamm/genesis-state", + is(o: any): o is GenesisState { + return o && (o.$typeUrl === GenesisState.typeUrl || Array.isArray(o.pools) && (!o.pools.length || Pool1.is(o.pools[0]) || Pool2.is(o.pools[0]) || Any.is(o.pools[0])) && typeof o.nextPoolNumber === "bigint" && Params.is(o.params)); + }, + isSDK(o: any): o is GenesisStateSDKType { + return o && (o.$typeUrl === GenesisState.typeUrl || Array.isArray(o.pools) && (!o.pools.length || Pool1.isSDK(o.pools[0]) || Pool2.isSDK(o.pools[0]) || Any.isSDK(o.pools[0])) && typeof o.next_pool_number === "bigint" && Params.isSDK(o.params)); + }, + isAmino(o: any): o is GenesisStateAmino { + return o && (o.$typeUrl === GenesisState.typeUrl || Array.isArray(o.pools) && (!o.pools.length || Pool1.isAmino(o.pools[0]) || Pool2.isAmino(o.pools[0]) || Any.isAmino(o.pools[0])) && typeof o.next_pool_number === "bigint" && Params.isAmino(o.params)); + }, encode(message: GenesisState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.pools) { - Any.encode((v! as Any), writer.uint32(10).fork()).ldelim(); + Any.encode(GlobalDecoderRegistry.wrapAny(v!), writer.uint32(10).fork()).ldelim(); } if (message.nextPoolNumber !== BigInt(0)) { writer.uint32(16).uint64(message.nextPoolNumber); @@ -210,7 +235,7 @@ export const GenesisState = { const tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.pools.push(useInterfaces ? (PoolI_InterfaceDecoder(reader) as Any) : Any.decode(reader, reader.uint32(), useInterfaces)); + message.pools.push(GlobalDecoderRegistry.unwrapAny(reader)); break; case 2: message.nextPoolNumber = reader.uint64(); @@ -227,14 +252,14 @@ export const GenesisState = { }, fromJSON(object: any): GenesisState { const obj = createBaseGenesisState(); - if (Array.isArray(object?.pools)) obj.pools = object.pools.map((e: any) => Any.fromJSON(e)); + if (Array.isArray(object?.pools)) obj.pools = object.pools.map((e: any) => GlobalDecoderRegistry.fromJSON(e)); if (isSet(object.nextPoolNumber)) obj.nextPoolNumber = BigInt(object.nextPoolNumber.toString()); if (isSet(object.params)) obj.params = Params.fromJSON(object.params); return obj; }, fromPartial(object: DeepPartial): GenesisState { const message = createBaseGenesisState(); - message.pools = object.pools?.map(e => Any.fromPartial(e)) || []; + message.pools = object.pools?.map(e => (GlobalDecoderRegistry.fromPartial(e) as any)) || []; if (object.nextPoolNumber !== undefined && object.nextPoolNumber !== null) { message.nextPoolNumber = BigInt(object.nextPoolNumber.toString()); } @@ -245,7 +270,7 @@ export const GenesisState = { }, fromSDK(object: GenesisStateSDKType): GenesisState { return { - pools: Array.isArray(object?.pools) ? object.pools.map((e: any) => Any.fromSDK(e)) : [], + pools: Array.isArray(object?.pools) ? object.pools.map((e: any) => GlobalDecoderRegistry.fromSDK(e)) : [], nextPoolNumber: object?.next_pool_number, params: object.params ? Params.fromSDK(object.params) : undefined }; @@ -253,7 +278,7 @@ export const GenesisState = { toSDK(message: GenesisState): GenesisStateSDKType { const obj: any = {}; if (message.pools) { - obj.pools = message.pools.map(e => e ? Any.toSDK(e) : undefined); + obj.pools = message.pools.map(e => e ? GlobalDecoderRegistry.toSDK(e) : undefined); } else { obj.pools = []; } @@ -263,7 +288,7 @@ export const GenesisState = { }, fromAmino(object: GenesisStateAmino): GenesisState { const message = createBaseGenesisState(); - message.pools = object.pools?.map(e => PoolI_FromAmino(e)) || []; + message.pools = object.pools?.map(e => GlobalDecoderRegistry.fromAminoMsg(e)) || []; if (object.next_pool_number !== undefined && object.next_pool_number !== null) { message.nextPoolNumber = BigInt(object.next_pool_number); } @@ -275,7 +300,7 @@ export const GenesisState = { toAmino(message: GenesisState, useInterfaces: boolean = true): GenesisStateAmino { const obj: any = {}; if (message.pools) { - obj.pools = message.pools.map(e => e ? PoolI_ToAmino((e as Any), useInterfaces) : undefined); + obj.pools = message.pools.map(e => e ? GlobalDecoderRegistry.toAminoMsg(e) : undefined); } else { obj.pools = message.pools; } @@ -294,49 +319,13 @@ export const GenesisState = { typeUrl: "/osmosis.gamm.v1beta1.GenesisState", value: GenesisState.encode(message).finish() }; - } -}; -export const PoolI_InterfaceDecoder = (input: BinaryReader | Uint8Array): Pool1 | Pool2 | Any => { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - const data = Any.decode(reader, reader.uint32(), true); - switch (data.typeUrl) { - case "/osmosis.gamm.v1beta1.Pool": - return Pool1.decode(data.value, undefined, true); - case "/osmosis.gamm.poolmodels.stableswap.v1beta1.Pool": - return Pool2.decode(data.value, undefined, true); - default: - return data; - } -}; -export const PoolI_FromAmino = (content: AnyAmino): Any => { - switch (content.type) { - case "osmosis/gamm/pool": - return Any.fromPartial({ - typeUrl: "/osmosis.gamm.v1beta1.Pool", - value: Pool1.encode(Pool1.fromPartial(Pool1.fromAmino(content.value))).finish() - }); - case "osmosis/gamm/pool": - return Any.fromPartial({ - typeUrl: "/osmosis.gamm.poolmodels.stableswap.v1beta1.Pool", - value: Pool2.encode(Pool2.fromPartial(Pool2.fromAmino(content.value))).finish() - }); - default: - return Any.fromAmino(content); - } -}; -export const PoolI_ToAmino = (content: Any, useInterfaces: boolean = true) => { - switch (content.typeUrl) { - case "/osmosis.gamm.v1beta1.Pool": - return { - type: "osmosis/gamm/pool", - value: Pool1.toAmino(Pool1.decode(content.value, undefined, useInterfaces), useInterfaces) - }; - case "/osmosis.gamm.poolmodels.stableswap.v1beta1.Pool": - return { - type: "osmosis/gamm/pool", - value: Pool2.toAmino(Pool2.decode(content.value, undefined, useInterfaces), useInterfaces) - }; - default: - return Any.toAmino(content, useInterfaces); + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GenesisState.typeUrl)) { + return; + } + Pool1.registerTypeUrl(); + Pool2.registerTypeUrl(); + Params.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/osmosis/gamm/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputv3/osmosis/gamm/v1beta1/query.rpc.func.ts new file mode 100644 index 0000000000..ebabb4aa94 --- /dev/null +++ b/__fixtures__/v-next/outputv3/osmosis/gamm/v1beta1/query.rpc.func.ts @@ -0,0 +1,202 @@ +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination"; +import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; +import { SwapAmountInRoute, SwapAmountInRouteSDKType, SwapAmountOutRoute, SwapAmountOutRouteSDKType } from "./tx"; +import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../google/protobuf/any"; +import { Pool as Pool1 } from "../pool-models/balancer/balancerPool"; +import { PoolSDKType as Pool1SDKType } from "../pool-models/balancer/balancerPool"; +import { Pool as Pool2 } from "../pool-models/stableswap/stableswap_pool"; +import { PoolSDKType as Pool2SDKType } from "../pool-models/stableswap/stableswap_pool"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { QueryPoolsRequest, QueryPoolsRequestSDKType, QueryPoolsResponse, QueryPoolsResponseSDKType, QueryNumPoolsRequest, QueryNumPoolsRequestSDKType, QueryNumPoolsResponse, QueryNumPoolsResponseSDKType, QueryTotalLiquidityRequest, QueryTotalLiquidityRequestSDKType, QueryTotalLiquidityResponse, QueryTotalLiquidityResponseSDKType, QueryPoolsWithFilterRequest, QueryPoolsWithFilterRequestSDKType, QueryPoolsWithFilterResponse, QueryPoolsWithFilterResponseSDKType, QueryPoolRequest, QueryPoolRequestSDKType, QueryPoolResponse, QueryPoolResponseSDKType, QueryPoolTypeRequest, QueryPoolTypeRequestSDKType, QueryPoolTypeResponse, QueryPoolTypeResponseSDKType, QueryCalcJoinPoolNoSwapSharesRequest, QueryCalcJoinPoolNoSwapSharesRequestSDKType, QueryCalcJoinPoolNoSwapSharesResponse, QueryCalcJoinPoolNoSwapSharesResponseSDKType, QueryCalcJoinPoolSharesRequest, QueryCalcJoinPoolSharesRequestSDKType, QueryCalcJoinPoolSharesResponse, QueryCalcJoinPoolSharesResponseSDKType, QueryCalcExitPoolCoinsFromSharesRequest, QueryCalcExitPoolCoinsFromSharesRequestSDKType, QueryCalcExitPoolCoinsFromSharesResponse, QueryCalcExitPoolCoinsFromSharesResponseSDKType, QueryPoolParamsRequest, QueryPoolParamsRequestSDKType, QueryPoolParamsResponse, QueryPoolParamsResponseSDKType, QueryTotalPoolLiquidityRequest, QueryTotalPoolLiquidityRequestSDKType, QueryTotalPoolLiquidityResponse, QueryTotalPoolLiquidityResponseSDKType, QueryTotalSharesRequest, QueryTotalSharesRequestSDKType, QueryTotalSharesResponse, QueryTotalSharesResponseSDKType, QuerySpotPriceRequest, QuerySpotPriceRequestSDKType, QuerySpotPriceResponse, QuerySpotPriceResponseSDKType, QuerySwapExactAmountInRequest, QuerySwapExactAmountInRequestSDKType, QuerySwapExactAmountInResponse, QuerySwapExactAmountInResponseSDKType, QuerySwapExactAmountOutRequest, QuerySwapExactAmountOutRequestSDKType, QuerySwapExactAmountOutResponse, QuerySwapExactAmountOutResponseSDKType } from "./query"; +/** + * @name getPools + * @package osmosis.gamm.v1beta1 + * @see proto service: osmosis.gamm.v1beta1.Pools + */ +export const getPools = buildQuery({ + encode: QueryPoolsRequest.encode, + decode: QueryPoolsResponse.decode, + service: "osmosis.gamm.v1beta1.Query", + method: "Pools", + deps: [QueryPoolsRequest, QueryPoolsResponse] +}); +/** + * @name getNumPools + * @package osmosis.gamm.v1beta1 + * @see proto service: osmosis.gamm.v1beta1.NumPools + */ +export const getNumPools = buildQuery({ + encode: QueryNumPoolsRequest.encode, + decode: QueryNumPoolsResponse.decode, + service: "osmosis.gamm.v1beta1.Query", + method: "NumPools", + deps: [QueryNumPoolsRequest, QueryNumPoolsResponse] +}); +/** + * @name getTotalLiquidity + * @package osmosis.gamm.v1beta1 + * @see proto service: osmosis.gamm.v1beta1.TotalLiquidity + */ +export const getTotalLiquidity = buildQuery({ + encode: QueryTotalLiquidityRequest.encode, + decode: QueryTotalLiquidityResponse.decode, + service: "osmosis.gamm.v1beta1.Query", + method: "TotalLiquidity", + deps: [QueryTotalLiquidityRequest, QueryTotalLiquidityResponse] +}); +/** + * PoolsWithFilter allows you to query specific pools with requested + * parameters + * @name getPoolsWithFilter + * @package osmosis.gamm.v1beta1 + * @see proto service: osmosis.gamm.v1beta1.PoolsWithFilter + */ +export const getPoolsWithFilter = buildQuery({ + encode: QueryPoolsWithFilterRequest.encode, + decode: QueryPoolsWithFilterResponse.decode, + service: "osmosis.gamm.v1beta1.Query", + method: "PoolsWithFilter", + deps: [QueryPoolsWithFilterRequest, QueryPoolsWithFilterResponse] +}); +/** + * Per Pool gRPC Endpoints + * @name getPool + * @package osmosis.gamm.v1beta1 + * @see proto service: osmosis.gamm.v1beta1.Pool + */ +export const getPool = buildQuery({ + encode: QueryPoolRequest.encode, + decode: QueryPoolResponse.decode, + service: "osmosis.gamm.v1beta1.Query", + method: "Pool", + deps: [QueryPoolRequest, QueryPoolResponse] +}); +/** + * PoolType returns the type of the pool. + * Returns "Balancer" as a string literal when the pool is a balancer pool. + * Errors if the pool is failed to be type caseted. + * @name getPoolType + * @package osmosis.gamm.v1beta1 + * @see proto service: osmosis.gamm.v1beta1.PoolType + */ +export const getPoolType = buildQuery({ + encode: QueryPoolTypeRequest.encode, + decode: QueryPoolTypeResponse.decode, + service: "osmosis.gamm.v1beta1.Query", + method: "PoolType", + deps: [QueryPoolTypeRequest, QueryPoolTypeResponse] +}); +/** + * Simulates joining pool without a swap. Returns the amount of shares you'd + * get and tokens needed to provide + * @name getCalcJoinPoolNoSwapShares + * @package osmosis.gamm.v1beta1 + * @see proto service: osmosis.gamm.v1beta1.CalcJoinPoolNoSwapShares + */ +export const getCalcJoinPoolNoSwapShares = buildQuery({ + encode: QueryCalcJoinPoolNoSwapSharesRequest.encode, + decode: QueryCalcJoinPoolNoSwapSharesResponse.decode, + service: "osmosis.gamm.v1beta1.Query", + method: "CalcJoinPoolNoSwapShares", + deps: [QueryCalcJoinPoolNoSwapSharesRequest, QueryCalcJoinPoolNoSwapSharesResponse] +}); +/** + * @name getCalcJoinPoolShares + * @package osmosis.gamm.v1beta1 + * @see proto service: osmosis.gamm.v1beta1.CalcJoinPoolShares + */ +export const getCalcJoinPoolShares = buildQuery({ + encode: QueryCalcJoinPoolSharesRequest.encode, + decode: QueryCalcJoinPoolSharesResponse.decode, + service: "osmosis.gamm.v1beta1.Query", + method: "CalcJoinPoolShares", + deps: [QueryCalcJoinPoolSharesRequest, QueryCalcJoinPoolSharesResponse] +}); +/** + * @name getCalcExitPoolCoinsFromShares + * @package osmosis.gamm.v1beta1 + * @see proto service: osmosis.gamm.v1beta1.CalcExitPoolCoinsFromShares + */ +export const getCalcExitPoolCoinsFromShares = buildQuery({ + encode: QueryCalcExitPoolCoinsFromSharesRequest.encode, + decode: QueryCalcExitPoolCoinsFromSharesResponse.decode, + service: "osmosis.gamm.v1beta1.Query", + method: "CalcExitPoolCoinsFromShares", + deps: [QueryCalcExitPoolCoinsFromSharesRequest, QueryCalcExitPoolCoinsFromSharesResponse] +}); +/** + * @name getPoolParams + * @package osmosis.gamm.v1beta1 + * @see proto service: osmosis.gamm.v1beta1.PoolParams + */ +export const getPoolParams = buildQuery({ + encode: QueryPoolParamsRequest.encode, + decode: QueryPoolParamsResponse.decode, + service: "osmosis.gamm.v1beta1.Query", + method: "PoolParams", + deps: [QueryPoolParamsRequest, QueryPoolParamsResponse] +}); +/** + * @name getTotalPoolLiquidity + * @package osmosis.gamm.v1beta1 + * @see proto service: osmosis.gamm.v1beta1.TotalPoolLiquidity + */ +export const getTotalPoolLiquidity = buildQuery({ + encode: QueryTotalPoolLiquidityRequest.encode, + decode: QueryTotalPoolLiquidityResponse.decode, + service: "osmosis.gamm.v1beta1.Query", + method: "TotalPoolLiquidity", + deps: [QueryTotalPoolLiquidityRequest, QueryTotalPoolLiquidityResponse] +}); +/** + * @name getTotalShares + * @package osmosis.gamm.v1beta1 + * @see proto service: osmosis.gamm.v1beta1.TotalShares + */ +export const getTotalShares = buildQuery({ + encode: QueryTotalSharesRequest.encode, + decode: QueryTotalSharesResponse.decode, + service: "osmosis.gamm.v1beta1.Query", + method: "TotalShares", + deps: [QueryTotalSharesRequest, QueryTotalSharesResponse] +}); +/** + * SpotPrice defines a gRPC query handler that returns the spot price given + * a base denomination and a quote denomination. + * @name getSpotPrice + * @package osmosis.gamm.v1beta1 + * @see proto service: osmosis.gamm.v1beta1.SpotPrice + * @deprecated + */ +export const getSpotPrice = buildQuery({ + encode: QuerySpotPriceRequest.encode, + decode: QuerySpotPriceResponse.decode, + service: "osmosis.gamm.v1beta1.Query", + method: "SpotPrice", + deps: [QuerySpotPriceRequest, QuerySpotPriceResponse] +}); +/** + * Estimate the swap. + * @name getEstimateSwapExactAmountIn + * @package osmosis.gamm.v1beta1 + * @see proto service: osmosis.gamm.v1beta1.EstimateSwapExactAmountIn + */ +export const getEstimateSwapExactAmountIn = buildQuery({ + encode: QuerySwapExactAmountInRequest.encode, + decode: QuerySwapExactAmountInResponse.decode, + service: "osmosis.gamm.v1beta1.Query", + method: "EstimateSwapExactAmountIn", + deps: [QuerySwapExactAmountInRequest, QuerySwapExactAmountInResponse] +}); +/** + * @name getEstimateSwapExactAmountOut + * @package osmosis.gamm.v1beta1 + * @see proto service: osmosis.gamm.v1beta1.EstimateSwapExactAmountOut + */ +export const getEstimateSwapExactAmountOut = buildQuery({ + encode: QuerySwapExactAmountOutRequest.encode, + decode: QuerySwapExactAmountOutResponse.decode, + service: "osmosis.gamm.v1beta1.Query", + method: "EstimateSwapExactAmountOut", + deps: [QuerySwapExactAmountOutRequest, QuerySwapExactAmountOutResponse] +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/osmosis/gamm/v1beta1/query.ts b/__fixtures__/v-next/outputv3/osmosis/gamm/v1beta1/query.ts index 3ae23b0cfa..f018ffb636 100644 --- a/__fixtures__/v-next/outputv3/osmosis/gamm/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv3/osmosis/gamm/v1beta1/query.ts @@ -10,6 +10,7 @@ import { PoolProtoMsg as Pool2ProtoMsg } from "../pool-models/stableswap/stables import { PoolSDKType as Pool2SDKType } from "../pool-models/stableswap/stableswap_pool"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { isSet, DeepPartial } from "../../../helpers"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "osmosis.gamm.v1beta1"; /** * =============================== Pool @@ -1003,6 +1004,15 @@ function createBaseQueryPoolRequest(): QueryPoolRequest { export const QueryPoolRequest = { typeUrl: "/osmosis.gamm.v1beta1.QueryPoolRequest", aminoType: "osmosis/gamm/query-pool-request", + is(o: any): o is QueryPoolRequest { + return o && (o.$typeUrl === QueryPoolRequest.typeUrl || typeof o.poolId === "bigint"); + }, + isSDK(o: any): o is QueryPoolRequestSDKType { + return o && (o.$typeUrl === QueryPoolRequest.typeUrl || typeof o.pool_id === "bigint"); + }, + isAmino(o: any): o is QueryPoolRequestAmino { + return o && (o.$typeUrl === QueryPoolRequest.typeUrl || typeof o.pool_id === "bigint"); + }, encode(message: QueryPoolRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.poolId !== BigInt(0)) { writer.uint32(8).uint64(message.poolId); @@ -1071,7 +1081,8 @@ export const QueryPoolRequest = { typeUrl: "/osmosis.gamm.v1beta1.QueryPoolRequest", value: QueryPoolRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryPoolResponse(): QueryPoolResponse { return { @@ -1086,9 +1097,18 @@ function createBaseQueryPoolResponse(): QueryPoolResponse { export const QueryPoolResponse = { typeUrl: "/osmosis.gamm.v1beta1.QueryPoolResponse", aminoType: "osmosis/gamm/query-pool-response", + is(o: any): o is QueryPoolResponse { + return o && o.$typeUrl === QueryPoolResponse.typeUrl; + }, + isSDK(o: any): o is QueryPoolResponseSDKType { + return o && o.$typeUrl === QueryPoolResponse.typeUrl; + }, + isAmino(o: any): o is QueryPoolResponseAmino { + return o && o.$typeUrl === QueryPoolResponse.typeUrl; + }, encode(message: QueryPoolResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.pool !== undefined) { - Any.encode((message.pool as Any), writer.uint32(10).fork()).ldelim(); + Any.encode(GlobalDecoderRegistry.wrapAny(message.pool), writer.uint32(10).fork()).ldelim(); } return writer; }, @@ -1100,7 +1120,7 @@ export const QueryPoolResponse = { const tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.pool = useInterfaces ? (PoolI_InterfaceDecoder(reader) as Any) : Any.decode(reader, reader.uint32(), useInterfaces); + message.pool = GlobalDecoderRegistry.unwrapAny(reader); break; default: reader.skipType(tag & 7); @@ -1111,36 +1131,36 @@ export const QueryPoolResponse = { }, fromJSON(object: any): QueryPoolResponse { const obj = createBaseQueryPoolResponse(); - if (isSet(object.pool)) obj.pool = Any.fromJSON(object.pool); + if (isSet(object.pool)) obj.pool = GlobalDecoderRegistry.fromJSON(object.pool); return obj; }, fromPartial(object: DeepPartial): QueryPoolResponse { const message = createBaseQueryPoolResponse(); if (object.pool !== undefined && object.pool !== null) { - message.pool = Any.fromPartial(object.pool); + message.pool = GlobalDecoderRegistry.fromPartial(object.pool); } return message; }, fromSDK(object: QueryPoolResponseSDKType): QueryPoolResponse { return { - pool: object.pool ? Any.fromSDK(object.pool) : undefined + pool: object.pool ? GlobalDecoderRegistry.fromSDK(object.pool) : undefined }; }, toSDK(message: QueryPoolResponse): QueryPoolResponseSDKType { const obj: any = {}; - message.pool !== undefined && (obj.pool = message.pool ? Any.toSDK(message.pool) : undefined); + message.pool !== undefined && (obj.pool = message.pool ? GlobalDecoderRegistry.toSDK(message.pool) : undefined); return obj; }, fromAmino(object: QueryPoolResponseAmino): QueryPoolResponse { const message = createBaseQueryPoolResponse(); if (object.pool !== undefined && object.pool !== null) { - message.pool = PoolI_FromAmino(object.pool); + message.pool = GlobalDecoderRegistry.fromAminoMsg(object.pool); } return message; }, toAmino(message: QueryPoolResponse, useInterfaces: boolean = true): QueryPoolResponseAmino { const obj: any = {}; - obj.pool = message.pool ? PoolI_ToAmino((message.pool as Any), useInterfaces) : undefined; + obj.pool = message.pool ? GlobalDecoderRegistry.toAminoMsg(message.pool) : undefined; return obj; }, fromProtoMsg(message: QueryPoolResponseProtoMsg, useInterfaces: boolean = true): QueryPoolResponse { @@ -1154,6 +1174,13 @@ export const QueryPoolResponse = { typeUrl: "/osmosis.gamm.v1beta1.QueryPoolResponse", value: QueryPoolResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryPoolResponse.typeUrl)) { + return; + } + Pool1.registerTypeUrl(); + Pool2.registerTypeUrl(); } }; function createBaseQueryPoolsRequest(): QueryPoolsRequest { @@ -1170,6 +1197,15 @@ function createBaseQueryPoolsRequest(): QueryPoolsRequest { export const QueryPoolsRequest = { typeUrl: "/osmosis.gamm.v1beta1.QueryPoolsRequest", aminoType: "osmosis/gamm/query-pools-request", + is(o: any): o is QueryPoolsRequest { + return o && o.$typeUrl === QueryPoolsRequest.typeUrl; + }, + isSDK(o: any): o is QueryPoolsRequestSDKType { + return o && o.$typeUrl === QueryPoolsRequest.typeUrl; + }, + isAmino(o: any): o is QueryPoolsRequestAmino { + return o && o.$typeUrl === QueryPoolsRequest.typeUrl; + }, encode(message: QueryPoolsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.pagination !== undefined) { PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); @@ -1238,6 +1274,12 @@ export const QueryPoolsRequest = { typeUrl: "/osmosis.gamm.v1beta1.QueryPoolsRequest", value: QueryPoolsRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryPoolsRequest.typeUrl)) { + return; + } + PageRequest.registerTypeUrl(); } }; function createBaseQueryPoolsResponse(): QueryPoolsResponse { @@ -1254,9 +1296,18 @@ function createBaseQueryPoolsResponse(): QueryPoolsResponse { export const QueryPoolsResponse = { typeUrl: "/osmosis.gamm.v1beta1.QueryPoolsResponse", aminoType: "osmosis/gamm/query-pools-response", + is(o: any): o is QueryPoolsResponse { + return o && (o.$typeUrl === QueryPoolsResponse.typeUrl || Array.isArray(o.pools) && (!o.pools.length || Pool1.is(o.pools[0]) || Pool2.is(o.pools[0]) || Any.is(o.pools[0]))); + }, + isSDK(o: any): o is QueryPoolsResponseSDKType { + return o && (o.$typeUrl === QueryPoolsResponse.typeUrl || Array.isArray(o.pools) && (!o.pools.length || Pool1.isSDK(o.pools[0]) || Pool2.isSDK(o.pools[0]) || Any.isSDK(o.pools[0]))); + }, + isAmino(o: any): o is QueryPoolsResponseAmino { + return o && (o.$typeUrl === QueryPoolsResponse.typeUrl || Array.isArray(o.pools) && (!o.pools.length || Pool1.isAmino(o.pools[0]) || Pool2.isAmino(o.pools[0]) || Any.isAmino(o.pools[0]))); + }, encode(message: QueryPoolsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.pools) { - Any.encode((v! as Any), writer.uint32(10).fork()).ldelim(); + Any.encode(GlobalDecoderRegistry.wrapAny(v!), writer.uint32(10).fork()).ldelim(); } if (message.pagination !== undefined) { PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); @@ -1271,7 +1322,7 @@ export const QueryPoolsResponse = { const tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.pools.push(useInterfaces ? (PoolI_InterfaceDecoder(reader) as Any) : Any.decode(reader, reader.uint32(), useInterfaces)); + message.pools.push(GlobalDecoderRegistry.unwrapAny(reader)); break; case 2: message.pagination = PageResponse.decode(reader, reader.uint32(), useInterfaces); @@ -1285,13 +1336,13 @@ export const QueryPoolsResponse = { }, fromJSON(object: any): QueryPoolsResponse { const obj = createBaseQueryPoolsResponse(); - if (Array.isArray(object?.pools)) obj.pools = object.pools.map((e: any) => Any.fromJSON(e)); + if (Array.isArray(object?.pools)) obj.pools = object.pools.map((e: any) => GlobalDecoderRegistry.fromJSON(e)); if (isSet(object.pagination)) obj.pagination = PageResponse.fromJSON(object.pagination); return obj; }, fromPartial(object: DeepPartial): QueryPoolsResponse { const message = createBaseQueryPoolsResponse(); - message.pools = object.pools?.map(e => Any.fromPartial(e)) || []; + message.pools = object.pools?.map(e => (GlobalDecoderRegistry.fromPartial(e) as any)) || []; if (object.pagination !== undefined && object.pagination !== null) { message.pagination = PageResponse.fromPartial(object.pagination); } @@ -1299,14 +1350,14 @@ export const QueryPoolsResponse = { }, fromSDK(object: QueryPoolsResponseSDKType): QueryPoolsResponse { return { - pools: Array.isArray(object?.pools) ? object.pools.map((e: any) => Any.fromSDK(e)) : [], + pools: Array.isArray(object?.pools) ? object.pools.map((e: any) => GlobalDecoderRegistry.fromSDK(e)) : [], pagination: object.pagination ? PageResponse.fromSDK(object.pagination) : undefined }; }, toSDK(message: QueryPoolsResponse): QueryPoolsResponseSDKType { const obj: any = {}; if (message.pools) { - obj.pools = message.pools.map(e => e ? Any.toSDK(e) : undefined); + obj.pools = message.pools.map(e => e ? GlobalDecoderRegistry.toSDK(e) : undefined); } else { obj.pools = []; } @@ -1315,7 +1366,7 @@ export const QueryPoolsResponse = { }, fromAmino(object: QueryPoolsResponseAmino): QueryPoolsResponse { const message = createBaseQueryPoolsResponse(); - message.pools = object.pools?.map(e => PoolI_FromAmino(e)) || []; + message.pools = object.pools?.map(e => GlobalDecoderRegistry.fromAminoMsg(e)) || []; if (object.pagination !== undefined && object.pagination !== null) { message.pagination = PageResponse.fromAmino(object.pagination); } @@ -1324,7 +1375,7 @@ export const QueryPoolsResponse = { toAmino(message: QueryPoolsResponse, useInterfaces: boolean = true): QueryPoolsResponseAmino { const obj: any = {}; if (message.pools) { - obj.pools = message.pools.map(e => e ? PoolI_ToAmino((e as Any), useInterfaces) : undefined); + obj.pools = message.pools.map(e => e ? GlobalDecoderRegistry.toAminoMsg(e) : undefined); } else { obj.pools = message.pools; } @@ -1342,6 +1393,14 @@ export const QueryPoolsResponse = { typeUrl: "/osmosis.gamm.v1beta1.QueryPoolsResponse", value: QueryPoolsResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryPoolsResponse.typeUrl)) { + return; + } + Pool1.registerTypeUrl(); + Pool2.registerTypeUrl(); + PageResponse.registerTypeUrl(); } }; function createBaseQueryNumPoolsRequest(): QueryNumPoolsRequest { @@ -1356,6 +1415,15 @@ function createBaseQueryNumPoolsRequest(): QueryNumPoolsRequest { export const QueryNumPoolsRequest = { typeUrl: "/osmosis.gamm.v1beta1.QueryNumPoolsRequest", aminoType: "osmosis/gamm/query-num-pools-request", + is(o: any): o is QueryNumPoolsRequest { + return o && o.$typeUrl === QueryNumPoolsRequest.typeUrl; + }, + isSDK(o: any): o is QueryNumPoolsRequestSDKType { + return o && o.$typeUrl === QueryNumPoolsRequest.typeUrl; + }, + isAmino(o: any): o is QueryNumPoolsRequestAmino { + return o && o.$typeUrl === QueryNumPoolsRequest.typeUrl; + }, encode(_: QueryNumPoolsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -1407,7 +1475,8 @@ export const QueryNumPoolsRequest = { typeUrl: "/osmosis.gamm.v1beta1.QueryNumPoolsRequest", value: QueryNumPoolsRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryNumPoolsResponse(): QueryNumPoolsResponse { return { @@ -1422,6 +1491,15 @@ function createBaseQueryNumPoolsResponse(): QueryNumPoolsResponse { export const QueryNumPoolsResponse = { typeUrl: "/osmosis.gamm.v1beta1.QueryNumPoolsResponse", aminoType: "osmosis/gamm/query-num-pools-response", + is(o: any): o is QueryNumPoolsResponse { + return o && (o.$typeUrl === QueryNumPoolsResponse.typeUrl || typeof o.numPools === "bigint"); + }, + isSDK(o: any): o is QueryNumPoolsResponseSDKType { + return o && (o.$typeUrl === QueryNumPoolsResponse.typeUrl || typeof o.num_pools === "bigint"); + }, + isAmino(o: any): o is QueryNumPoolsResponseAmino { + return o && (o.$typeUrl === QueryNumPoolsResponse.typeUrl || typeof o.num_pools === "bigint"); + }, encode(message: QueryNumPoolsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.numPools !== BigInt(0)) { writer.uint32(8).uint64(message.numPools); @@ -1490,7 +1568,8 @@ export const QueryNumPoolsResponse = { typeUrl: "/osmosis.gamm.v1beta1.QueryNumPoolsResponse", value: QueryNumPoolsResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryPoolTypeRequest(): QueryPoolTypeRequest { return { @@ -1506,6 +1585,15 @@ function createBaseQueryPoolTypeRequest(): QueryPoolTypeRequest { export const QueryPoolTypeRequest = { typeUrl: "/osmosis.gamm.v1beta1.QueryPoolTypeRequest", aminoType: "osmosis/gamm/query-pool-type-request", + is(o: any): o is QueryPoolTypeRequest { + return o && (o.$typeUrl === QueryPoolTypeRequest.typeUrl || typeof o.poolId === "bigint"); + }, + isSDK(o: any): o is QueryPoolTypeRequestSDKType { + return o && (o.$typeUrl === QueryPoolTypeRequest.typeUrl || typeof o.pool_id === "bigint"); + }, + isAmino(o: any): o is QueryPoolTypeRequestAmino { + return o && (o.$typeUrl === QueryPoolTypeRequest.typeUrl || typeof o.pool_id === "bigint"); + }, encode(message: QueryPoolTypeRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.poolId !== BigInt(0)) { writer.uint32(8).uint64(message.poolId); @@ -1574,7 +1662,8 @@ export const QueryPoolTypeRequest = { typeUrl: "/osmosis.gamm.v1beta1.QueryPoolTypeRequest", value: QueryPoolTypeRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryPoolTypeResponse(): QueryPoolTypeResponse { return { @@ -1589,6 +1678,15 @@ function createBaseQueryPoolTypeResponse(): QueryPoolTypeResponse { export const QueryPoolTypeResponse = { typeUrl: "/osmosis.gamm.v1beta1.QueryPoolTypeResponse", aminoType: "osmosis/gamm/query-pool-type-response", + is(o: any): o is QueryPoolTypeResponse { + return o && (o.$typeUrl === QueryPoolTypeResponse.typeUrl || typeof o.poolType === "string"); + }, + isSDK(o: any): o is QueryPoolTypeResponseSDKType { + return o && (o.$typeUrl === QueryPoolTypeResponse.typeUrl || typeof o.pool_type === "string"); + }, + isAmino(o: any): o is QueryPoolTypeResponseAmino { + return o && (o.$typeUrl === QueryPoolTypeResponse.typeUrl || typeof o.pool_type === "string"); + }, encode(message: QueryPoolTypeResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.poolType !== "") { writer.uint32(10).string(message.poolType); @@ -1655,7 +1753,8 @@ export const QueryPoolTypeResponse = { typeUrl: "/osmosis.gamm.v1beta1.QueryPoolTypeResponse", value: QueryPoolTypeResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryCalcJoinPoolSharesRequest(): QueryCalcJoinPoolSharesRequest { return { @@ -1672,6 +1771,15 @@ function createBaseQueryCalcJoinPoolSharesRequest(): QueryCalcJoinPoolSharesRequ export const QueryCalcJoinPoolSharesRequest = { typeUrl: "/osmosis.gamm.v1beta1.QueryCalcJoinPoolSharesRequest", aminoType: "osmosis/gamm/query-calc-join-pool-shares-request", + is(o: any): o is QueryCalcJoinPoolSharesRequest { + return o && (o.$typeUrl === QueryCalcJoinPoolSharesRequest.typeUrl || typeof o.poolId === "bigint" && Array.isArray(o.tokensIn) && (!o.tokensIn.length || Coin.is(o.tokensIn[0]))); + }, + isSDK(o: any): o is QueryCalcJoinPoolSharesRequestSDKType { + return o && (o.$typeUrl === QueryCalcJoinPoolSharesRequest.typeUrl || typeof o.pool_id === "bigint" && Array.isArray(o.tokens_in) && (!o.tokens_in.length || Coin.isSDK(o.tokens_in[0]))); + }, + isAmino(o: any): o is QueryCalcJoinPoolSharesRequestAmino { + return o && (o.$typeUrl === QueryCalcJoinPoolSharesRequest.typeUrl || typeof o.pool_id === "bigint" && Array.isArray(o.tokens_in) && (!o.tokens_in.length || Coin.isAmino(o.tokens_in[0]))); + }, encode(message: QueryCalcJoinPoolSharesRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.poolId !== BigInt(0)) { writer.uint32(8).uint64(message.poolId); @@ -1760,6 +1868,12 @@ export const QueryCalcJoinPoolSharesRequest = { typeUrl: "/osmosis.gamm.v1beta1.QueryCalcJoinPoolSharesRequest", value: QueryCalcJoinPoolSharesRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryCalcJoinPoolSharesRequest.typeUrl)) { + return; + } + Coin.registerTypeUrl(); } }; function createBaseQueryCalcJoinPoolSharesResponse(): QueryCalcJoinPoolSharesResponse { @@ -1776,6 +1890,15 @@ function createBaseQueryCalcJoinPoolSharesResponse(): QueryCalcJoinPoolSharesRes export const QueryCalcJoinPoolSharesResponse = { typeUrl: "/osmosis.gamm.v1beta1.QueryCalcJoinPoolSharesResponse", aminoType: "osmosis/gamm/query-calc-join-pool-shares-response", + is(o: any): o is QueryCalcJoinPoolSharesResponse { + return o && (o.$typeUrl === QueryCalcJoinPoolSharesResponse.typeUrl || typeof o.shareOutAmount === "string" && Array.isArray(o.tokensOut) && (!o.tokensOut.length || Coin.is(o.tokensOut[0]))); + }, + isSDK(o: any): o is QueryCalcJoinPoolSharesResponseSDKType { + return o && (o.$typeUrl === QueryCalcJoinPoolSharesResponse.typeUrl || typeof o.share_out_amount === "string" && Array.isArray(o.tokens_out) && (!o.tokens_out.length || Coin.isSDK(o.tokens_out[0]))); + }, + isAmino(o: any): o is QueryCalcJoinPoolSharesResponseAmino { + return o && (o.$typeUrl === QueryCalcJoinPoolSharesResponse.typeUrl || typeof o.share_out_amount === "string" && Array.isArray(o.tokens_out) && (!o.tokens_out.length || Coin.isAmino(o.tokens_out[0]))); + }, encode(message: QueryCalcJoinPoolSharesResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.shareOutAmount !== "") { writer.uint32(10).string(message.shareOutAmount); @@ -1862,6 +1985,12 @@ export const QueryCalcJoinPoolSharesResponse = { typeUrl: "/osmosis.gamm.v1beta1.QueryCalcJoinPoolSharesResponse", value: QueryCalcJoinPoolSharesResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryCalcJoinPoolSharesResponse.typeUrl)) { + return; + } + Coin.registerTypeUrl(); } }; function createBaseQueryCalcExitPoolCoinsFromSharesRequest(): QueryCalcExitPoolCoinsFromSharesRequest { @@ -1879,6 +2008,15 @@ function createBaseQueryCalcExitPoolCoinsFromSharesRequest(): QueryCalcExitPoolC export const QueryCalcExitPoolCoinsFromSharesRequest = { typeUrl: "/osmosis.gamm.v1beta1.QueryCalcExitPoolCoinsFromSharesRequest", aminoType: "osmosis/gamm/query-calc-exit-pool-coins-from-shares-request", + is(o: any): o is QueryCalcExitPoolCoinsFromSharesRequest { + return o && (o.$typeUrl === QueryCalcExitPoolCoinsFromSharesRequest.typeUrl || typeof o.poolId === "bigint" && typeof o.shareInAmount === "string"); + }, + isSDK(o: any): o is QueryCalcExitPoolCoinsFromSharesRequestSDKType { + return o && (o.$typeUrl === QueryCalcExitPoolCoinsFromSharesRequest.typeUrl || typeof o.pool_id === "bigint" && typeof o.share_in_amount === "string"); + }, + isAmino(o: any): o is QueryCalcExitPoolCoinsFromSharesRequestAmino { + return o && (o.$typeUrl === QueryCalcExitPoolCoinsFromSharesRequest.typeUrl || typeof o.pool_id === "bigint" && typeof o.share_in_amount === "string"); + }, encode(message: QueryCalcExitPoolCoinsFromSharesRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.poolId !== BigInt(0)) { writer.uint32(8).uint64(message.poolId); @@ -1961,7 +2099,8 @@ export const QueryCalcExitPoolCoinsFromSharesRequest = { typeUrl: "/osmosis.gamm.v1beta1.QueryCalcExitPoolCoinsFromSharesRequest", value: QueryCalcExitPoolCoinsFromSharesRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryCalcExitPoolCoinsFromSharesResponse(): QueryCalcExitPoolCoinsFromSharesResponse { return { @@ -1976,6 +2115,15 @@ function createBaseQueryCalcExitPoolCoinsFromSharesResponse(): QueryCalcExitPool export const QueryCalcExitPoolCoinsFromSharesResponse = { typeUrl: "/osmosis.gamm.v1beta1.QueryCalcExitPoolCoinsFromSharesResponse", aminoType: "osmosis/gamm/query-calc-exit-pool-coins-from-shares-response", + is(o: any): o is QueryCalcExitPoolCoinsFromSharesResponse { + return o && (o.$typeUrl === QueryCalcExitPoolCoinsFromSharesResponse.typeUrl || Array.isArray(o.tokensOut) && (!o.tokensOut.length || Coin.is(o.tokensOut[0]))); + }, + isSDK(o: any): o is QueryCalcExitPoolCoinsFromSharesResponseSDKType { + return o && (o.$typeUrl === QueryCalcExitPoolCoinsFromSharesResponse.typeUrl || Array.isArray(o.tokens_out) && (!o.tokens_out.length || Coin.isSDK(o.tokens_out[0]))); + }, + isAmino(o: any): o is QueryCalcExitPoolCoinsFromSharesResponseAmino { + return o && (o.$typeUrl === QueryCalcExitPoolCoinsFromSharesResponse.typeUrl || Array.isArray(o.tokens_out) && (!o.tokens_out.length || Coin.isAmino(o.tokens_out[0]))); + }, encode(message: QueryCalcExitPoolCoinsFromSharesResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.tokensOut) { Coin.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -2048,6 +2196,12 @@ export const QueryCalcExitPoolCoinsFromSharesResponse = { typeUrl: "/osmosis.gamm.v1beta1.QueryCalcExitPoolCoinsFromSharesResponse", value: QueryCalcExitPoolCoinsFromSharesResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryCalcExitPoolCoinsFromSharesResponse.typeUrl)) { + return; + } + Coin.registerTypeUrl(); } }; function createBaseQueryPoolParamsRequest(): QueryPoolParamsRequest { @@ -2064,6 +2218,15 @@ function createBaseQueryPoolParamsRequest(): QueryPoolParamsRequest { export const QueryPoolParamsRequest = { typeUrl: "/osmosis.gamm.v1beta1.QueryPoolParamsRequest", aminoType: "osmosis/gamm/query-pool-params-request", + is(o: any): o is QueryPoolParamsRequest { + return o && (o.$typeUrl === QueryPoolParamsRequest.typeUrl || typeof o.poolId === "bigint"); + }, + isSDK(o: any): o is QueryPoolParamsRequestSDKType { + return o && (o.$typeUrl === QueryPoolParamsRequest.typeUrl || typeof o.pool_id === "bigint"); + }, + isAmino(o: any): o is QueryPoolParamsRequestAmino { + return o && (o.$typeUrl === QueryPoolParamsRequest.typeUrl || typeof o.pool_id === "bigint"); + }, encode(message: QueryPoolParamsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.poolId !== BigInt(0)) { writer.uint32(8).uint64(message.poolId); @@ -2132,7 +2295,8 @@ export const QueryPoolParamsRequest = { typeUrl: "/osmosis.gamm.v1beta1.QueryPoolParamsRequest", value: QueryPoolParamsRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryPoolParamsResponse(): QueryPoolParamsResponse { return { @@ -2147,6 +2311,15 @@ function createBaseQueryPoolParamsResponse(): QueryPoolParamsResponse { export const QueryPoolParamsResponse = { typeUrl: "/osmosis.gamm.v1beta1.QueryPoolParamsResponse", aminoType: "osmosis/gamm/query-pool-params-response", + is(o: any): o is QueryPoolParamsResponse { + return o && o.$typeUrl === QueryPoolParamsResponse.typeUrl; + }, + isSDK(o: any): o is QueryPoolParamsResponseSDKType { + return o && o.$typeUrl === QueryPoolParamsResponse.typeUrl; + }, + isAmino(o: any): o is QueryPoolParamsResponseAmino { + return o && o.$typeUrl === QueryPoolParamsResponse.typeUrl; + }, encode(message: QueryPoolParamsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.params !== undefined) { Any.encode(message.params, writer.uint32(10).fork()).ldelim(); @@ -2215,7 +2388,8 @@ export const QueryPoolParamsResponse = { typeUrl: "/osmosis.gamm.v1beta1.QueryPoolParamsResponse", value: QueryPoolParamsResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryTotalPoolLiquidityRequest(): QueryTotalPoolLiquidityRequest { return { @@ -2231,6 +2405,15 @@ function createBaseQueryTotalPoolLiquidityRequest(): QueryTotalPoolLiquidityRequ export const QueryTotalPoolLiquidityRequest = { typeUrl: "/osmosis.gamm.v1beta1.QueryTotalPoolLiquidityRequest", aminoType: "osmosis/gamm/query-total-pool-liquidity-request", + is(o: any): o is QueryTotalPoolLiquidityRequest { + return o && (o.$typeUrl === QueryTotalPoolLiquidityRequest.typeUrl || typeof o.poolId === "bigint"); + }, + isSDK(o: any): o is QueryTotalPoolLiquidityRequestSDKType { + return o && (o.$typeUrl === QueryTotalPoolLiquidityRequest.typeUrl || typeof o.pool_id === "bigint"); + }, + isAmino(o: any): o is QueryTotalPoolLiquidityRequestAmino { + return o && (o.$typeUrl === QueryTotalPoolLiquidityRequest.typeUrl || typeof o.pool_id === "bigint"); + }, encode(message: QueryTotalPoolLiquidityRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.poolId !== BigInt(0)) { writer.uint32(8).uint64(message.poolId); @@ -2299,7 +2482,8 @@ export const QueryTotalPoolLiquidityRequest = { typeUrl: "/osmosis.gamm.v1beta1.QueryTotalPoolLiquidityRequest", value: QueryTotalPoolLiquidityRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryTotalPoolLiquidityResponse(): QueryTotalPoolLiquidityResponse { return { @@ -2314,6 +2498,15 @@ function createBaseQueryTotalPoolLiquidityResponse(): QueryTotalPoolLiquidityRes export const QueryTotalPoolLiquidityResponse = { typeUrl: "/osmosis.gamm.v1beta1.QueryTotalPoolLiquidityResponse", aminoType: "osmosis/gamm/query-total-pool-liquidity-response", + is(o: any): o is QueryTotalPoolLiquidityResponse { + return o && (o.$typeUrl === QueryTotalPoolLiquidityResponse.typeUrl || Array.isArray(o.liquidity) && (!o.liquidity.length || Coin.is(o.liquidity[0]))); + }, + isSDK(o: any): o is QueryTotalPoolLiquidityResponseSDKType { + return o && (o.$typeUrl === QueryTotalPoolLiquidityResponse.typeUrl || Array.isArray(o.liquidity) && (!o.liquidity.length || Coin.isSDK(o.liquidity[0]))); + }, + isAmino(o: any): o is QueryTotalPoolLiquidityResponseAmino { + return o && (o.$typeUrl === QueryTotalPoolLiquidityResponse.typeUrl || Array.isArray(o.liquidity) && (!o.liquidity.length || Coin.isAmino(o.liquidity[0]))); + }, encode(message: QueryTotalPoolLiquidityResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.liquidity) { Coin.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -2386,6 +2579,12 @@ export const QueryTotalPoolLiquidityResponse = { typeUrl: "/osmosis.gamm.v1beta1.QueryTotalPoolLiquidityResponse", value: QueryTotalPoolLiquidityResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryTotalPoolLiquidityResponse.typeUrl)) { + return; + } + Coin.registerTypeUrl(); } }; function createBaseQueryTotalSharesRequest(): QueryTotalSharesRequest { @@ -2402,6 +2601,15 @@ function createBaseQueryTotalSharesRequest(): QueryTotalSharesRequest { export const QueryTotalSharesRequest = { typeUrl: "/osmosis.gamm.v1beta1.QueryTotalSharesRequest", aminoType: "osmosis/gamm/query-total-shares-request", + is(o: any): o is QueryTotalSharesRequest { + return o && (o.$typeUrl === QueryTotalSharesRequest.typeUrl || typeof o.poolId === "bigint"); + }, + isSDK(o: any): o is QueryTotalSharesRequestSDKType { + return o && (o.$typeUrl === QueryTotalSharesRequest.typeUrl || typeof o.pool_id === "bigint"); + }, + isAmino(o: any): o is QueryTotalSharesRequestAmino { + return o && (o.$typeUrl === QueryTotalSharesRequest.typeUrl || typeof o.pool_id === "bigint"); + }, encode(message: QueryTotalSharesRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.poolId !== BigInt(0)) { writer.uint32(8).uint64(message.poolId); @@ -2470,7 +2678,8 @@ export const QueryTotalSharesRequest = { typeUrl: "/osmosis.gamm.v1beta1.QueryTotalSharesRequest", value: QueryTotalSharesRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryTotalSharesResponse(): QueryTotalSharesResponse { return { @@ -2485,6 +2694,15 @@ function createBaseQueryTotalSharesResponse(): QueryTotalSharesResponse { export const QueryTotalSharesResponse = { typeUrl: "/osmosis.gamm.v1beta1.QueryTotalSharesResponse", aminoType: "osmosis/gamm/query-total-shares-response", + is(o: any): o is QueryTotalSharesResponse { + return o && (o.$typeUrl === QueryTotalSharesResponse.typeUrl || Coin.is(o.totalShares)); + }, + isSDK(o: any): o is QueryTotalSharesResponseSDKType { + return o && (o.$typeUrl === QueryTotalSharesResponse.typeUrl || Coin.isSDK(o.total_shares)); + }, + isAmino(o: any): o is QueryTotalSharesResponseAmino { + return o && (o.$typeUrl === QueryTotalSharesResponse.typeUrl || Coin.isAmino(o.total_shares)); + }, encode(message: QueryTotalSharesResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.totalShares !== undefined) { Coin.encode(message.totalShares, writer.uint32(10).fork()).ldelim(); @@ -2553,6 +2771,12 @@ export const QueryTotalSharesResponse = { typeUrl: "/osmosis.gamm.v1beta1.QueryTotalSharesResponse", value: QueryTotalSharesResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryTotalSharesResponse.typeUrl)) { + return; + } + Coin.registerTypeUrl(); } }; function createBaseQueryCalcJoinPoolNoSwapSharesRequest(): QueryCalcJoinPoolNoSwapSharesRequest { @@ -2570,6 +2794,15 @@ function createBaseQueryCalcJoinPoolNoSwapSharesRequest(): QueryCalcJoinPoolNoSw export const QueryCalcJoinPoolNoSwapSharesRequest = { typeUrl: "/osmosis.gamm.v1beta1.QueryCalcJoinPoolNoSwapSharesRequest", aminoType: "osmosis/gamm/query-calc-join-pool-no-swap-shares-request", + is(o: any): o is QueryCalcJoinPoolNoSwapSharesRequest { + return o && (o.$typeUrl === QueryCalcJoinPoolNoSwapSharesRequest.typeUrl || typeof o.poolId === "bigint" && Array.isArray(o.tokensIn) && (!o.tokensIn.length || Coin.is(o.tokensIn[0]))); + }, + isSDK(o: any): o is QueryCalcJoinPoolNoSwapSharesRequestSDKType { + return o && (o.$typeUrl === QueryCalcJoinPoolNoSwapSharesRequest.typeUrl || typeof o.pool_id === "bigint" && Array.isArray(o.tokens_in) && (!o.tokens_in.length || Coin.isSDK(o.tokens_in[0]))); + }, + isAmino(o: any): o is QueryCalcJoinPoolNoSwapSharesRequestAmino { + return o && (o.$typeUrl === QueryCalcJoinPoolNoSwapSharesRequest.typeUrl || typeof o.pool_id === "bigint" && Array.isArray(o.tokens_in) && (!o.tokens_in.length || Coin.isAmino(o.tokens_in[0]))); + }, encode(message: QueryCalcJoinPoolNoSwapSharesRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.poolId !== BigInt(0)) { writer.uint32(8).uint64(message.poolId); @@ -2658,6 +2891,12 @@ export const QueryCalcJoinPoolNoSwapSharesRequest = { typeUrl: "/osmosis.gamm.v1beta1.QueryCalcJoinPoolNoSwapSharesRequest", value: QueryCalcJoinPoolNoSwapSharesRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryCalcJoinPoolNoSwapSharesRequest.typeUrl)) { + return; + } + Coin.registerTypeUrl(); } }; function createBaseQueryCalcJoinPoolNoSwapSharesResponse(): QueryCalcJoinPoolNoSwapSharesResponse { @@ -2674,6 +2913,15 @@ function createBaseQueryCalcJoinPoolNoSwapSharesResponse(): QueryCalcJoinPoolNoS export const QueryCalcJoinPoolNoSwapSharesResponse = { typeUrl: "/osmosis.gamm.v1beta1.QueryCalcJoinPoolNoSwapSharesResponse", aminoType: "osmosis/gamm/query-calc-join-pool-no-swap-shares-response", + is(o: any): o is QueryCalcJoinPoolNoSwapSharesResponse { + return o && (o.$typeUrl === QueryCalcJoinPoolNoSwapSharesResponse.typeUrl || Array.isArray(o.tokensOut) && (!o.tokensOut.length || Coin.is(o.tokensOut[0])) && typeof o.sharesOut === "string"); + }, + isSDK(o: any): o is QueryCalcJoinPoolNoSwapSharesResponseSDKType { + return o && (o.$typeUrl === QueryCalcJoinPoolNoSwapSharesResponse.typeUrl || Array.isArray(o.tokens_out) && (!o.tokens_out.length || Coin.isSDK(o.tokens_out[0])) && typeof o.shares_out === "string"); + }, + isAmino(o: any): o is QueryCalcJoinPoolNoSwapSharesResponseAmino { + return o && (o.$typeUrl === QueryCalcJoinPoolNoSwapSharesResponse.typeUrl || Array.isArray(o.tokens_out) && (!o.tokens_out.length || Coin.isAmino(o.tokens_out[0])) && typeof o.shares_out === "string"); + }, encode(message: QueryCalcJoinPoolNoSwapSharesResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.tokensOut) { Coin.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -2760,6 +3008,12 @@ export const QueryCalcJoinPoolNoSwapSharesResponse = { typeUrl: "/osmosis.gamm.v1beta1.QueryCalcJoinPoolNoSwapSharesResponse", value: QueryCalcJoinPoolNoSwapSharesResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryCalcJoinPoolNoSwapSharesResponse.typeUrl)) { + return; + } + Coin.registerTypeUrl(); } }; function createBaseQuerySpotPriceRequest(): QuerySpotPriceRequest { @@ -2780,6 +3034,15 @@ function createBaseQuerySpotPriceRequest(): QuerySpotPriceRequest { export const QuerySpotPriceRequest = { typeUrl: "/osmosis.gamm.v1beta1.QuerySpotPriceRequest", aminoType: "osmosis/gamm/query-spot-price-request", + is(o: any): o is QuerySpotPriceRequest { + return o && (o.$typeUrl === QuerySpotPriceRequest.typeUrl || typeof o.poolId === "bigint" && typeof o.baseAssetDenom === "string" && typeof o.quoteAssetDenom === "string"); + }, + isSDK(o: any): o is QuerySpotPriceRequestSDKType { + return o && (o.$typeUrl === QuerySpotPriceRequest.typeUrl || typeof o.pool_id === "bigint" && typeof o.base_asset_denom === "string" && typeof o.quote_asset_denom === "string"); + }, + isAmino(o: any): o is QuerySpotPriceRequestAmino { + return o && (o.$typeUrl === QuerySpotPriceRequest.typeUrl || typeof o.pool_id === "bigint" && typeof o.base_asset_denom === "string" && typeof o.quote_asset_denom === "string"); + }, encode(message: QuerySpotPriceRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.poolId !== BigInt(0)) { writer.uint32(8).uint64(message.poolId); @@ -2876,7 +3139,8 @@ export const QuerySpotPriceRequest = { typeUrl: "/osmosis.gamm.v1beta1.QuerySpotPriceRequest", value: QuerySpotPriceRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryPoolsWithFilterRequest(): QueryPoolsWithFilterRequest { return { @@ -2893,6 +3157,15 @@ function createBaseQueryPoolsWithFilterRequest(): QueryPoolsWithFilterRequest { export const QueryPoolsWithFilterRequest = { typeUrl: "/osmosis.gamm.v1beta1.QueryPoolsWithFilterRequest", aminoType: "osmosis/gamm/query-pools-with-filter-request", + is(o: any): o is QueryPoolsWithFilterRequest { + return o && (o.$typeUrl === QueryPoolsWithFilterRequest.typeUrl || Array.isArray(o.minLiquidity) && (!o.minLiquidity.length || Coin.is(o.minLiquidity[0])) && typeof o.poolType === "string"); + }, + isSDK(o: any): o is QueryPoolsWithFilterRequestSDKType { + return o && (o.$typeUrl === QueryPoolsWithFilterRequest.typeUrl || Array.isArray(o.min_liquidity) && (!o.min_liquidity.length || Coin.isSDK(o.min_liquidity[0])) && typeof o.pool_type === "string"); + }, + isAmino(o: any): o is QueryPoolsWithFilterRequestAmino { + return o && (o.$typeUrl === QueryPoolsWithFilterRequest.typeUrl || Array.isArray(o.min_liquidity) && (!o.min_liquidity.length || Coin.isAmino(o.min_liquidity[0])) && typeof o.pool_type === "string"); + }, encode(message: QueryPoolsWithFilterRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.minLiquidity) { Coin.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -2995,6 +3268,13 @@ export const QueryPoolsWithFilterRequest = { typeUrl: "/osmosis.gamm.v1beta1.QueryPoolsWithFilterRequest", value: QueryPoolsWithFilterRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryPoolsWithFilterRequest.typeUrl)) { + return; + } + Coin.registerTypeUrl(); + PageRequest.registerTypeUrl(); } }; function createBaseQueryPoolsWithFilterResponse(): QueryPoolsWithFilterResponse { @@ -3011,9 +3291,18 @@ function createBaseQueryPoolsWithFilterResponse(): QueryPoolsWithFilterResponse export const QueryPoolsWithFilterResponse = { typeUrl: "/osmosis.gamm.v1beta1.QueryPoolsWithFilterResponse", aminoType: "osmosis/gamm/query-pools-with-filter-response", + is(o: any): o is QueryPoolsWithFilterResponse { + return o && (o.$typeUrl === QueryPoolsWithFilterResponse.typeUrl || Array.isArray(o.pools) && (!o.pools.length || Pool1.is(o.pools[0]) || Pool2.is(o.pools[0]) || Any.is(o.pools[0]))); + }, + isSDK(o: any): o is QueryPoolsWithFilterResponseSDKType { + return o && (o.$typeUrl === QueryPoolsWithFilterResponse.typeUrl || Array.isArray(o.pools) && (!o.pools.length || Pool1.isSDK(o.pools[0]) || Pool2.isSDK(o.pools[0]) || Any.isSDK(o.pools[0]))); + }, + isAmino(o: any): o is QueryPoolsWithFilterResponseAmino { + return o && (o.$typeUrl === QueryPoolsWithFilterResponse.typeUrl || Array.isArray(o.pools) && (!o.pools.length || Pool1.isAmino(o.pools[0]) || Pool2.isAmino(o.pools[0]) || Any.isAmino(o.pools[0]))); + }, encode(message: QueryPoolsWithFilterResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.pools) { - Any.encode((v! as Any), writer.uint32(10).fork()).ldelim(); + Any.encode(GlobalDecoderRegistry.wrapAny(v!), writer.uint32(10).fork()).ldelim(); } if (message.pagination !== undefined) { PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); @@ -3028,7 +3317,7 @@ export const QueryPoolsWithFilterResponse = { const tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.pools.push(useInterfaces ? (PoolI_InterfaceDecoder(reader) as Any) : Any.decode(reader, reader.uint32(), useInterfaces)); + message.pools.push(GlobalDecoderRegistry.unwrapAny(reader)); break; case 2: message.pagination = PageResponse.decode(reader, reader.uint32(), useInterfaces); @@ -3042,13 +3331,13 @@ export const QueryPoolsWithFilterResponse = { }, fromJSON(object: any): QueryPoolsWithFilterResponse { const obj = createBaseQueryPoolsWithFilterResponse(); - if (Array.isArray(object?.pools)) obj.pools = object.pools.map((e: any) => Any.fromJSON(e)); + if (Array.isArray(object?.pools)) obj.pools = object.pools.map((e: any) => GlobalDecoderRegistry.fromJSON(e)); if (isSet(object.pagination)) obj.pagination = PageResponse.fromJSON(object.pagination); return obj; }, fromPartial(object: DeepPartial): QueryPoolsWithFilterResponse { const message = createBaseQueryPoolsWithFilterResponse(); - message.pools = object.pools?.map(e => Any.fromPartial(e)) || []; + message.pools = object.pools?.map(e => (GlobalDecoderRegistry.fromPartial(e) as any)) || []; if (object.pagination !== undefined && object.pagination !== null) { message.pagination = PageResponse.fromPartial(object.pagination); } @@ -3056,14 +3345,14 @@ export const QueryPoolsWithFilterResponse = { }, fromSDK(object: QueryPoolsWithFilterResponseSDKType): QueryPoolsWithFilterResponse { return { - pools: Array.isArray(object?.pools) ? object.pools.map((e: any) => Any.fromSDK(e)) : [], + pools: Array.isArray(object?.pools) ? object.pools.map((e: any) => GlobalDecoderRegistry.fromSDK(e)) : [], pagination: object.pagination ? PageResponse.fromSDK(object.pagination) : undefined }; }, toSDK(message: QueryPoolsWithFilterResponse): QueryPoolsWithFilterResponseSDKType { const obj: any = {}; if (message.pools) { - obj.pools = message.pools.map(e => e ? Any.toSDK(e) : undefined); + obj.pools = message.pools.map(e => e ? GlobalDecoderRegistry.toSDK(e) : undefined); } else { obj.pools = []; } @@ -3072,7 +3361,7 @@ export const QueryPoolsWithFilterResponse = { }, fromAmino(object: QueryPoolsWithFilterResponseAmino): QueryPoolsWithFilterResponse { const message = createBaseQueryPoolsWithFilterResponse(); - message.pools = object.pools?.map(e => PoolI_FromAmino(e)) || []; + message.pools = object.pools?.map(e => GlobalDecoderRegistry.fromAminoMsg(e)) || []; if (object.pagination !== undefined && object.pagination !== null) { message.pagination = PageResponse.fromAmino(object.pagination); } @@ -3081,7 +3370,7 @@ export const QueryPoolsWithFilterResponse = { toAmino(message: QueryPoolsWithFilterResponse, useInterfaces: boolean = true): QueryPoolsWithFilterResponseAmino { const obj: any = {}; if (message.pools) { - obj.pools = message.pools.map(e => e ? PoolI_ToAmino((e as Any), useInterfaces) : undefined); + obj.pools = message.pools.map(e => e ? GlobalDecoderRegistry.toAminoMsg(e) : undefined); } else { obj.pools = message.pools; } @@ -3099,6 +3388,14 @@ export const QueryPoolsWithFilterResponse = { typeUrl: "/osmosis.gamm.v1beta1.QueryPoolsWithFilterResponse", value: QueryPoolsWithFilterResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryPoolsWithFilterResponse.typeUrl)) { + return; + } + Pool1.registerTypeUrl(); + Pool2.registerTypeUrl(); + PageResponse.registerTypeUrl(); } }; function createBaseQuerySpotPriceResponse(): QuerySpotPriceResponse { @@ -3117,6 +3414,15 @@ function createBaseQuerySpotPriceResponse(): QuerySpotPriceResponse { export const QuerySpotPriceResponse = { typeUrl: "/osmosis.gamm.v1beta1.QuerySpotPriceResponse", aminoType: "osmosis/gamm/query-spot-price-response", + is(o: any): o is QuerySpotPriceResponse { + return o && (o.$typeUrl === QuerySpotPriceResponse.typeUrl || typeof o.spotPrice === "string"); + }, + isSDK(o: any): o is QuerySpotPriceResponseSDKType { + return o && (o.$typeUrl === QuerySpotPriceResponse.typeUrl || typeof o.spot_price === "string"); + }, + isAmino(o: any): o is QuerySpotPriceResponseAmino { + return o && (o.$typeUrl === QuerySpotPriceResponse.typeUrl || typeof o.spot_price === "string"); + }, encode(message: QuerySpotPriceResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.spotPrice !== "") { writer.uint32(10).string(message.spotPrice); @@ -3183,7 +3489,8 @@ export const QuerySpotPriceResponse = { typeUrl: "/osmosis.gamm.v1beta1.QuerySpotPriceResponse", value: QuerySpotPriceResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQuerySwapExactAmountInRequest(): QuerySwapExactAmountInRequest { return { @@ -3202,6 +3509,15 @@ function createBaseQuerySwapExactAmountInRequest(): QuerySwapExactAmountInReques export const QuerySwapExactAmountInRequest = { typeUrl: "/osmosis.gamm.v1beta1.QuerySwapExactAmountInRequest", aminoType: "osmosis/gamm/query-swap-exact-amount-in-request", + is(o: any): o is QuerySwapExactAmountInRequest { + return o && (o.$typeUrl === QuerySwapExactAmountInRequest.typeUrl || typeof o.sender === "string" && typeof o.poolId === "bigint" && typeof o.tokenIn === "string" && Array.isArray(o.routes) && (!o.routes.length || SwapAmountInRoute.is(o.routes[0]))); + }, + isSDK(o: any): o is QuerySwapExactAmountInRequestSDKType { + return o && (o.$typeUrl === QuerySwapExactAmountInRequest.typeUrl || typeof o.sender === "string" && typeof o.pool_id === "bigint" && typeof o.token_in === "string" && Array.isArray(o.routes) && (!o.routes.length || SwapAmountInRoute.isSDK(o.routes[0]))); + }, + isAmino(o: any): o is QuerySwapExactAmountInRequestAmino { + return o && (o.$typeUrl === QuerySwapExactAmountInRequest.typeUrl || typeof o.sender === "string" && typeof o.pool_id === "bigint" && typeof o.token_in === "string" && Array.isArray(o.routes) && (!o.routes.length || SwapAmountInRoute.isAmino(o.routes[0]))); + }, encode(message: QuerySwapExactAmountInRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.sender !== "") { writer.uint32(10).string(message.sender); @@ -3318,6 +3634,12 @@ export const QuerySwapExactAmountInRequest = { typeUrl: "/osmosis.gamm.v1beta1.QuerySwapExactAmountInRequest", value: QuerySwapExactAmountInRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QuerySwapExactAmountInRequest.typeUrl)) { + return; + } + SwapAmountInRoute.registerTypeUrl(); } }; function createBaseQuerySwapExactAmountInResponse(): QuerySwapExactAmountInResponse { @@ -3333,6 +3655,15 @@ function createBaseQuerySwapExactAmountInResponse(): QuerySwapExactAmountInRespo export const QuerySwapExactAmountInResponse = { typeUrl: "/osmosis.gamm.v1beta1.QuerySwapExactAmountInResponse", aminoType: "osmosis/gamm/query-swap-exact-amount-in-response", + is(o: any): o is QuerySwapExactAmountInResponse { + return o && (o.$typeUrl === QuerySwapExactAmountInResponse.typeUrl || typeof o.tokenOutAmount === "string"); + }, + isSDK(o: any): o is QuerySwapExactAmountInResponseSDKType { + return o && (o.$typeUrl === QuerySwapExactAmountInResponse.typeUrl || typeof o.token_out_amount === "string"); + }, + isAmino(o: any): o is QuerySwapExactAmountInResponseAmino { + return o && (o.$typeUrl === QuerySwapExactAmountInResponse.typeUrl || typeof o.token_out_amount === "string"); + }, encode(message: QuerySwapExactAmountInResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.tokenOutAmount !== "") { writer.uint32(10).string(message.tokenOutAmount); @@ -3399,7 +3730,8 @@ export const QuerySwapExactAmountInResponse = { typeUrl: "/osmosis.gamm.v1beta1.QuerySwapExactAmountInResponse", value: QuerySwapExactAmountInResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQuerySwapExactAmountOutRequest(): QuerySwapExactAmountOutRequest { return { @@ -3418,6 +3750,15 @@ function createBaseQuerySwapExactAmountOutRequest(): QuerySwapExactAmountOutRequ export const QuerySwapExactAmountOutRequest = { typeUrl: "/osmosis.gamm.v1beta1.QuerySwapExactAmountOutRequest", aminoType: "osmosis/gamm/query-swap-exact-amount-out-request", + is(o: any): o is QuerySwapExactAmountOutRequest { + return o && (o.$typeUrl === QuerySwapExactAmountOutRequest.typeUrl || typeof o.sender === "string" && typeof o.poolId === "bigint" && Array.isArray(o.routes) && (!o.routes.length || SwapAmountOutRoute.is(o.routes[0])) && typeof o.tokenOut === "string"); + }, + isSDK(o: any): o is QuerySwapExactAmountOutRequestSDKType { + return o && (o.$typeUrl === QuerySwapExactAmountOutRequest.typeUrl || typeof o.sender === "string" && typeof o.pool_id === "bigint" && Array.isArray(o.routes) && (!o.routes.length || SwapAmountOutRoute.isSDK(o.routes[0])) && typeof o.token_out === "string"); + }, + isAmino(o: any): o is QuerySwapExactAmountOutRequestAmino { + return o && (o.$typeUrl === QuerySwapExactAmountOutRequest.typeUrl || typeof o.sender === "string" && typeof o.pool_id === "bigint" && Array.isArray(o.routes) && (!o.routes.length || SwapAmountOutRoute.isAmino(o.routes[0])) && typeof o.token_out === "string"); + }, encode(message: QuerySwapExactAmountOutRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.sender !== "") { writer.uint32(10).string(message.sender); @@ -3534,6 +3875,12 @@ export const QuerySwapExactAmountOutRequest = { typeUrl: "/osmosis.gamm.v1beta1.QuerySwapExactAmountOutRequest", value: QuerySwapExactAmountOutRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QuerySwapExactAmountOutRequest.typeUrl)) { + return; + } + SwapAmountOutRoute.registerTypeUrl(); } }; function createBaseQuerySwapExactAmountOutResponse(): QuerySwapExactAmountOutResponse { @@ -3549,6 +3896,15 @@ function createBaseQuerySwapExactAmountOutResponse(): QuerySwapExactAmountOutRes export const QuerySwapExactAmountOutResponse = { typeUrl: "/osmosis.gamm.v1beta1.QuerySwapExactAmountOutResponse", aminoType: "osmosis/gamm/query-swap-exact-amount-out-response", + is(o: any): o is QuerySwapExactAmountOutResponse { + return o && (o.$typeUrl === QuerySwapExactAmountOutResponse.typeUrl || typeof o.tokenInAmount === "string"); + }, + isSDK(o: any): o is QuerySwapExactAmountOutResponseSDKType { + return o && (o.$typeUrl === QuerySwapExactAmountOutResponse.typeUrl || typeof o.token_in_amount === "string"); + }, + isAmino(o: any): o is QuerySwapExactAmountOutResponseAmino { + return o && (o.$typeUrl === QuerySwapExactAmountOutResponse.typeUrl || typeof o.token_in_amount === "string"); + }, encode(message: QuerySwapExactAmountOutResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.tokenInAmount !== "") { writer.uint32(10).string(message.tokenInAmount); @@ -3615,7 +3971,8 @@ export const QuerySwapExactAmountOutResponse = { typeUrl: "/osmosis.gamm.v1beta1.QuerySwapExactAmountOutResponse", value: QuerySwapExactAmountOutResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryTotalLiquidityRequest(): QueryTotalLiquidityRequest { return {}; @@ -3628,6 +3985,15 @@ function createBaseQueryTotalLiquidityRequest(): QueryTotalLiquidityRequest { export const QueryTotalLiquidityRequest = { typeUrl: "/osmosis.gamm.v1beta1.QueryTotalLiquidityRequest", aminoType: "osmosis/gamm/query-total-liquidity-request", + is(o: any): o is QueryTotalLiquidityRequest { + return o && o.$typeUrl === QueryTotalLiquidityRequest.typeUrl; + }, + isSDK(o: any): o is QueryTotalLiquidityRequestSDKType { + return o && o.$typeUrl === QueryTotalLiquidityRequest.typeUrl; + }, + isAmino(o: any): o is QueryTotalLiquidityRequestAmino { + return o && o.$typeUrl === QueryTotalLiquidityRequest.typeUrl; + }, encode(_: QueryTotalLiquidityRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -3679,7 +4045,8 @@ export const QueryTotalLiquidityRequest = { typeUrl: "/osmosis.gamm.v1beta1.QueryTotalLiquidityRequest", value: QueryTotalLiquidityRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryTotalLiquidityResponse(): QueryTotalLiquidityResponse { return { @@ -3694,6 +4061,15 @@ function createBaseQueryTotalLiquidityResponse(): QueryTotalLiquidityResponse { export const QueryTotalLiquidityResponse = { typeUrl: "/osmosis.gamm.v1beta1.QueryTotalLiquidityResponse", aminoType: "osmosis/gamm/query-total-liquidity-response", + is(o: any): o is QueryTotalLiquidityResponse { + return o && (o.$typeUrl === QueryTotalLiquidityResponse.typeUrl || Array.isArray(o.liquidity) && (!o.liquidity.length || Coin.is(o.liquidity[0]))); + }, + isSDK(o: any): o is QueryTotalLiquidityResponseSDKType { + return o && (o.$typeUrl === QueryTotalLiquidityResponse.typeUrl || Array.isArray(o.liquidity) && (!o.liquidity.length || Coin.isSDK(o.liquidity[0]))); + }, + isAmino(o: any): o is QueryTotalLiquidityResponseAmino { + return o && (o.$typeUrl === QueryTotalLiquidityResponse.typeUrl || Array.isArray(o.liquidity) && (!o.liquidity.length || Coin.isAmino(o.liquidity[0]))); + }, encode(message: QueryTotalLiquidityResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.liquidity) { Coin.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -3766,49 +4142,11 @@ export const QueryTotalLiquidityResponse = { typeUrl: "/osmosis.gamm.v1beta1.QueryTotalLiquidityResponse", value: QueryTotalLiquidityResponse.encode(message).finish() }; - } -}; -export const PoolI_InterfaceDecoder = (input: BinaryReader | Uint8Array): Pool1 | Pool2 | Any => { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - const data = Any.decode(reader, reader.uint32(), true); - switch (data.typeUrl) { - case "/osmosis.gamm.v1beta1.Pool": - return Pool1.decode(data.value, undefined, true); - case "/osmosis.gamm.poolmodels.stableswap.v1beta1.Pool": - return Pool2.decode(data.value, undefined, true); - default: - return data; - } -}; -export const PoolI_FromAmino = (content: AnyAmino): Any => { - switch (content.type) { - case "osmosis/gamm/pool": - return Any.fromPartial({ - typeUrl: "/osmosis.gamm.v1beta1.Pool", - value: Pool1.encode(Pool1.fromPartial(Pool1.fromAmino(content.value))).finish() - }); - case "osmosis/gamm/pool": - return Any.fromPartial({ - typeUrl: "/osmosis.gamm.poolmodels.stableswap.v1beta1.Pool", - value: Pool2.encode(Pool2.fromPartial(Pool2.fromAmino(content.value))).finish() - }); - default: - return Any.fromAmino(content); - } -}; -export const PoolI_ToAmino = (content: Any, useInterfaces: boolean = true) => { - switch (content.typeUrl) { - case "/osmosis.gamm.v1beta1.Pool": - return { - type: "osmosis/gamm/pool", - value: Pool1.toAmino(Pool1.decode(content.value, undefined, useInterfaces), useInterfaces) - }; - case "/osmosis.gamm.poolmodels.stableswap.v1beta1.Pool": - return { - type: "osmosis/gamm/pool", - value: Pool2.toAmino(Pool2.decode(content.value, undefined, useInterfaces), useInterfaces) - }; - default: - return Any.toAmino(content, useInterfaces); + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryTotalLiquidityResponse.typeUrl)) { + return; + } + Coin.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/osmosis/gamm/v1beta1/tx.registry.ts b/__fixtures__/v-next/outputv3/osmosis/gamm/v1beta1/tx.registry.ts index 84e0314294..d1f56b839c 100644 --- a/__fixtures__/v-next/outputv3/osmosis/gamm/v1beta1/tx.registry.ts +++ b/__fixtures__/v-next/outputv3/osmosis/gamm/v1beta1/tx.registry.ts @@ -1,12 +1,7 @@ import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; -import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { TelescopeGeneratedType } from "../../../types"; import { MsgJoinPool, MsgJoinPoolSDKType, MsgExitPool, MsgExitPoolSDKType, MsgSwapExactAmountIn, MsgSwapExactAmountInSDKType, MsgSwapExactAmountOut, MsgSwapExactAmountOutSDKType, MsgJoinSwapExternAmountIn, MsgJoinSwapExternAmountInSDKType, MsgJoinSwapShareAmountOut, MsgJoinSwapShareAmountOutSDKType, MsgExitSwapExternAmountOut, MsgExitSwapExternAmountOutSDKType, MsgExitSwapShareAmountIn, MsgExitSwapShareAmountInSDKType } from "./tx"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/osmosis.gamm.v1beta1.MsgJoinPool", MsgJoinPool], ["/osmosis.gamm.v1beta1.MsgExitPool", MsgExitPool], ["/osmosis.gamm.v1beta1.MsgSwapExactAmountIn", MsgSwapExactAmountIn], ["/osmosis.gamm.v1beta1.MsgSwapExactAmountOut", MsgSwapExactAmountOut], ["/osmosis.gamm.v1beta1.MsgJoinSwapExternAmountIn", MsgJoinSwapExternAmountIn], ["/osmosis.gamm.v1beta1.MsgJoinSwapShareAmountOut", MsgJoinSwapShareAmountOut], ["/osmosis.gamm.v1beta1.MsgExitSwapExternAmountOut", MsgExitSwapExternAmountOut], ["/osmosis.gamm.v1beta1.MsgExitSwapShareAmountIn", MsgExitSwapShareAmountIn]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/osmosis.gamm.v1beta1.MsgJoinPool", MsgJoinPool], ["/osmosis.gamm.v1beta1.MsgExitPool", MsgExitPool], ["/osmosis.gamm.v1beta1.MsgSwapExactAmountIn", MsgSwapExactAmountIn], ["/osmosis.gamm.v1beta1.MsgSwapExactAmountOut", MsgSwapExactAmountOut], ["/osmosis.gamm.v1beta1.MsgJoinSwapExternAmountIn", MsgJoinSwapExternAmountIn], ["/osmosis.gamm.v1beta1.MsgJoinSwapShareAmountOut", MsgJoinSwapShareAmountOut], ["/osmosis.gamm.v1beta1.MsgExitSwapExternAmountOut", MsgExitSwapExternAmountOut], ["/osmosis.gamm.v1beta1.MsgExitSwapShareAmountIn", MsgExitSwapShareAmountIn]]; export const MessageComposer = { encoded: { joinPool(value: MsgJoinPool) { diff --git a/__fixtures__/v-next/outputv3/osmosis/gamm/v1beta1/tx.rpc.func.ts b/__fixtures__/v-next/outputv3/osmosis/gamm/v1beta1/tx.rpc.func.ts new file mode 100644 index 0000000000..005459cc78 --- /dev/null +++ b/__fixtures__/v-next/outputv3/osmosis/gamm/v1beta1/tx.rpc.func.ts @@ -0,0 +1,67 @@ +import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; +import { buildTx } from "../../../helper-func-types"; +import { MsgJoinPool, MsgJoinPoolSDKType, MsgJoinPoolResponse, MsgJoinPoolResponseSDKType, MsgExitPool, MsgExitPoolSDKType, MsgExitPoolResponse, MsgExitPoolResponseSDKType, MsgSwapExactAmountIn, MsgSwapExactAmountInSDKType, MsgSwapExactAmountInResponse, MsgSwapExactAmountInResponseSDKType, MsgSwapExactAmountOut, MsgSwapExactAmountOutSDKType, MsgSwapExactAmountOutResponse, MsgSwapExactAmountOutResponseSDKType, MsgJoinSwapExternAmountIn, MsgJoinSwapExternAmountInSDKType, MsgJoinSwapExternAmountInResponse, MsgJoinSwapExternAmountInResponseSDKType, MsgJoinSwapShareAmountOut, MsgJoinSwapShareAmountOutSDKType, MsgJoinSwapShareAmountOutResponse, MsgJoinSwapShareAmountOutResponseSDKType, MsgExitSwapExternAmountOut, MsgExitSwapExternAmountOutSDKType, MsgExitSwapExternAmountOutResponse, MsgExitSwapExternAmountOutResponseSDKType, MsgExitSwapShareAmountIn, MsgExitSwapShareAmountInSDKType, MsgExitSwapShareAmountInResponse, MsgExitSwapShareAmountInResponseSDKType } from "./tx"; +/** + * @name joinPool + * @package osmosis.gamm.v1beta1 + * @see proto service: osmosis.gamm.v1beta1.JoinPool + */ +export const joinPool = buildTx({ + msg: MsgJoinPool +}); +/** + * @name exitPool + * @package osmosis.gamm.v1beta1 + * @see proto service: osmosis.gamm.v1beta1.ExitPool + */ +export const exitPool = buildTx({ + msg: MsgExitPool +}); +/** + * @name swapExactAmountIn + * @package osmosis.gamm.v1beta1 + * @see proto service: osmosis.gamm.v1beta1.SwapExactAmountIn + */ +export const swapExactAmountIn = buildTx({ + msg: MsgSwapExactAmountIn +}); +/** + * @name swapExactAmountOut + * @package osmosis.gamm.v1beta1 + * @see proto service: osmosis.gamm.v1beta1.SwapExactAmountOut + */ +export const swapExactAmountOut = buildTx({ + msg: MsgSwapExactAmountOut +}); +/** + * @name joinSwapExternAmountIn + * @package osmosis.gamm.v1beta1 + * @see proto service: osmosis.gamm.v1beta1.JoinSwapExternAmountIn + */ +export const joinSwapExternAmountIn = buildTx({ + msg: MsgJoinSwapExternAmountIn +}); +/** + * @name joinSwapShareAmountOut + * @package osmosis.gamm.v1beta1 + * @see proto service: osmosis.gamm.v1beta1.JoinSwapShareAmountOut + */ +export const joinSwapShareAmountOut = buildTx({ + msg: MsgJoinSwapShareAmountOut +}); +/** + * @name exitSwapExternAmountOut + * @package osmosis.gamm.v1beta1 + * @see proto service: osmosis.gamm.v1beta1.ExitSwapExternAmountOut + */ +export const exitSwapExternAmountOut = buildTx({ + msg: MsgExitSwapExternAmountOut +}); +/** + * @name exitSwapShareAmountIn + * @package osmosis.gamm.v1beta1 + * @see proto service: osmosis.gamm.v1beta1.ExitSwapShareAmountIn + */ +export const exitSwapShareAmountIn = buildTx({ + msg: MsgExitSwapShareAmountIn +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/osmosis/gamm/v1beta1/tx.ts b/__fixtures__/v-next/outputv3/osmosis/gamm/v1beta1/tx.ts index 52ab1a2e38..f26a6e8dd2 100644 --- a/__fixtures__/v-next/outputv3/osmosis/gamm/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputv3/osmosis/gamm/v1beta1/tx.ts @@ -1,6 +1,7 @@ import { Coin, CoinAmino, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { isSet, DeepPartial } from "../../../helpers"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "osmosis.gamm.v1beta1"; /** * ===================== MsgJoinPool @@ -641,6 +642,15 @@ function createBaseMsgJoinPool(): MsgJoinPool { export const MsgJoinPool = { typeUrl: "/osmosis.gamm.v1beta1.MsgJoinPool", aminoType: "osmosis/gamm/join-pool", + is(o: any): o is MsgJoinPool { + return o && (o.$typeUrl === MsgJoinPool.typeUrl || typeof o.sender === "string" && typeof o.poolId === "bigint" && typeof o.shareOutAmount === "string" && Array.isArray(o.tokenInMaxs) && (!o.tokenInMaxs.length || Coin.is(o.tokenInMaxs[0]))); + }, + isSDK(o: any): o is MsgJoinPoolSDKType { + return o && (o.$typeUrl === MsgJoinPool.typeUrl || typeof o.sender === "string" && typeof o.pool_id === "bigint" && typeof o.share_out_amount === "string" && Array.isArray(o.token_in_maxs) && (!o.token_in_maxs.length || Coin.isSDK(o.token_in_maxs[0]))); + }, + isAmino(o: any): o is MsgJoinPoolAmino { + return o && (o.$typeUrl === MsgJoinPool.typeUrl || typeof o.sender === "string" && typeof o.pool_id === "bigint" && typeof o.share_out_amount === "string" && Array.isArray(o.token_in_maxs) && (!o.token_in_maxs.length || Coin.isAmino(o.token_in_maxs[0]))); + }, encode(message: MsgJoinPool, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.sender !== "") { writer.uint32(10).string(message.sender); @@ -757,6 +767,12 @@ export const MsgJoinPool = { typeUrl: "/osmosis.gamm.v1beta1.MsgJoinPool", value: MsgJoinPool.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgJoinPool.typeUrl)) { + return; + } + Coin.registerTypeUrl(); } }; function createBaseMsgJoinPoolResponse(): MsgJoinPoolResponse { @@ -773,6 +789,15 @@ function createBaseMsgJoinPoolResponse(): MsgJoinPoolResponse { export const MsgJoinPoolResponse = { typeUrl: "/osmosis.gamm.v1beta1.MsgJoinPoolResponse", aminoType: "osmosis/gamm/join-pool-response", + is(o: any): o is MsgJoinPoolResponse { + return o && (o.$typeUrl === MsgJoinPoolResponse.typeUrl || typeof o.shareOutAmount === "string" && Array.isArray(o.tokenIn) && (!o.tokenIn.length || Coin.is(o.tokenIn[0]))); + }, + isSDK(o: any): o is MsgJoinPoolResponseSDKType { + return o && (o.$typeUrl === MsgJoinPoolResponse.typeUrl || typeof o.share_out_amount === "string" && Array.isArray(o.token_in) && (!o.token_in.length || Coin.isSDK(o.token_in[0]))); + }, + isAmino(o: any): o is MsgJoinPoolResponseAmino { + return o && (o.$typeUrl === MsgJoinPoolResponse.typeUrl || typeof o.share_out_amount === "string" && Array.isArray(o.token_in) && (!o.token_in.length || Coin.isAmino(o.token_in[0]))); + }, encode(message: MsgJoinPoolResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.shareOutAmount !== "") { writer.uint32(10).string(message.shareOutAmount); @@ -859,6 +884,12 @@ export const MsgJoinPoolResponse = { typeUrl: "/osmosis.gamm.v1beta1.MsgJoinPoolResponse", value: MsgJoinPoolResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgJoinPoolResponse.typeUrl)) { + return; + } + Coin.registerTypeUrl(); } }; function createBaseMsgExitPool(): MsgExitPool { @@ -878,6 +909,15 @@ function createBaseMsgExitPool(): MsgExitPool { export const MsgExitPool = { typeUrl: "/osmosis.gamm.v1beta1.MsgExitPool", aminoType: "osmosis/gamm/exit-pool", + is(o: any): o is MsgExitPool { + return o && (o.$typeUrl === MsgExitPool.typeUrl || typeof o.sender === "string" && typeof o.poolId === "bigint" && typeof o.shareInAmount === "string" && Array.isArray(o.tokenOutMins) && (!o.tokenOutMins.length || Coin.is(o.tokenOutMins[0]))); + }, + isSDK(o: any): o is MsgExitPoolSDKType { + return o && (o.$typeUrl === MsgExitPool.typeUrl || typeof o.sender === "string" && typeof o.pool_id === "bigint" && typeof o.share_in_amount === "string" && Array.isArray(o.token_out_mins) && (!o.token_out_mins.length || Coin.isSDK(o.token_out_mins[0]))); + }, + isAmino(o: any): o is MsgExitPoolAmino { + return o && (o.$typeUrl === MsgExitPool.typeUrl || typeof o.sender === "string" && typeof o.pool_id === "bigint" && typeof o.share_in_amount === "string" && Array.isArray(o.token_out_mins) && (!o.token_out_mins.length || Coin.isAmino(o.token_out_mins[0]))); + }, encode(message: MsgExitPool, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.sender !== "") { writer.uint32(10).string(message.sender); @@ -994,6 +1034,12 @@ export const MsgExitPool = { typeUrl: "/osmosis.gamm.v1beta1.MsgExitPool", value: MsgExitPool.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgExitPool.typeUrl)) { + return; + } + Coin.registerTypeUrl(); } }; function createBaseMsgExitPoolResponse(): MsgExitPoolResponse { @@ -1009,6 +1055,15 @@ function createBaseMsgExitPoolResponse(): MsgExitPoolResponse { export const MsgExitPoolResponse = { typeUrl: "/osmosis.gamm.v1beta1.MsgExitPoolResponse", aminoType: "osmosis/gamm/exit-pool-response", + is(o: any): o is MsgExitPoolResponse { + return o && (o.$typeUrl === MsgExitPoolResponse.typeUrl || Array.isArray(o.tokenOut) && (!o.tokenOut.length || Coin.is(o.tokenOut[0]))); + }, + isSDK(o: any): o is MsgExitPoolResponseSDKType { + return o && (o.$typeUrl === MsgExitPoolResponse.typeUrl || Array.isArray(o.token_out) && (!o.token_out.length || Coin.isSDK(o.token_out[0]))); + }, + isAmino(o: any): o is MsgExitPoolResponseAmino { + return o && (o.$typeUrl === MsgExitPoolResponse.typeUrl || Array.isArray(o.token_out) && (!o.token_out.length || Coin.isAmino(o.token_out[0]))); + }, encode(message: MsgExitPoolResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.tokenOut) { Coin.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -1081,6 +1136,12 @@ export const MsgExitPoolResponse = { typeUrl: "/osmosis.gamm.v1beta1.MsgExitPoolResponse", value: MsgExitPoolResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgExitPoolResponse.typeUrl)) { + return; + } + Coin.registerTypeUrl(); } }; function createBaseSwapAmountInRoute(): SwapAmountInRoute { @@ -1098,6 +1159,15 @@ function createBaseSwapAmountInRoute(): SwapAmountInRoute { export const SwapAmountInRoute = { typeUrl: "/osmosis.gamm.v1beta1.SwapAmountInRoute", aminoType: "osmosis/gamm/swap-amount-in-route", + is(o: any): o is SwapAmountInRoute { + return o && (o.$typeUrl === SwapAmountInRoute.typeUrl || typeof o.poolId === "bigint" && typeof o.tokenOutDenom === "string"); + }, + isSDK(o: any): o is SwapAmountInRouteSDKType { + return o && (o.$typeUrl === SwapAmountInRoute.typeUrl || typeof o.pool_id === "bigint" && typeof o.token_out_denom === "string"); + }, + isAmino(o: any): o is SwapAmountInRouteAmino { + return o && (o.$typeUrl === SwapAmountInRoute.typeUrl || typeof o.pool_id === "bigint" && typeof o.token_out_denom === "string"); + }, encode(message: SwapAmountInRoute, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.poolId !== BigInt(0)) { writer.uint32(8).uint64(message.poolId); @@ -1180,7 +1250,8 @@ export const SwapAmountInRoute = { typeUrl: "/osmosis.gamm.v1beta1.SwapAmountInRoute", value: SwapAmountInRoute.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgSwapExactAmountIn(): MsgSwapExactAmountIn { return { @@ -1198,6 +1269,15 @@ function createBaseMsgSwapExactAmountIn(): MsgSwapExactAmountIn { export const MsgSwapExactAmountIn = { typeUrl: "/osmosis.gamm.v1beta1.MsgSwapExactAmountIn", aminoType: "osmosis/gamm/swap-exact-amount-in", + is(o: any): o is MsgSwapExactAmountIn { + return o && (o.$typeUrl === MsgSwapExactAmountIn.typeUrl || typeof o.sender === "string" && Array.isArray(o.routes) && (!o.routes.length || SwapAmountInRoute.is(o.routes[0])) && Coin.is(o.tokenIn) && typeof o.tokenOutMinAmount === "string"); + }, + isSDK(o: any): o is MsgSwapExactAmountInSDKType { + return o && (o.$typeUrl === MsgSwapExactAmountIn.typeUrl || typeof o.sender === "string" && Array.isArray(o.routes) && (!o.routes.length || SwapAmountInRoute.isSDK(o.routes[0])) && Coin.isSDK(o.token_in) && typeof o.token_out_min_amount === "string"); + }, + isAmino(o: any): o is MsgSwapExactAmountInAmino { + return o && (o.$typeUrl === MsgSwapExactAmountIn.typeUrl || typeof o.sender === "string" && Array.isArray(o.routes) && (!o.routes.length || SwapAmountInRoute.isAmino(o.routes[0])) && Coin.isAmino(o.token_in) && typeof o.token_out_min_amount === "string"); + }, encode(message: MsgSwapExactAmountIn, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.sender !== "") { writer.uint32(10).string(message.sender); @@ -1314,6 +1394,13 @@ export const MsgSwapExactAmountIn = { typeUrl: "/osmosis.gamm.v1beta1.MsgSwapExactAmountIn", value: MsgSwapExactAmountIn.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgSwapExactAmountIn.typeUrl)) { + return; + } + SwapAmountInRoute.registerTypeUrl(); + Coin.registerTypeUrl(); } }; function createBaseMsgSwapExactAmountInResponse(): MsgSwapExactAmountInResponse { @@ -1329,6 +1416,15 @@ function createBaseMsgSwapExactAmountInResponse(): MsgSwapExactAmountInResponse export const MsgSwapExactAmountInResponse = { typeUrl: "/osmosis.gamm.v1beta1.MsgSwapExactAmountInResponse", aminoType: "osmosis/gamm/swap-exact-amount-in-response", + is(o: any): o is MsgSwapExactAmountInResponse { + return o && (o.$typeUrl === MsgSwapExactAmountInResponse.typeUrl || typeof o.tokenOutAmount === "string"); + }, + isSDK(o: any): o is MsgSwapExactAmountInResponseSDKType { + return o && (o.$typeUrl === MsgSwapExactAmountInResponse.typeUrl || typeof o.token_out_amount === "string"); + }, + isAmino(o: any): o is MsgSwapExactAmountInResponseAmino { + return o && (o.$typeUrl === MsgSwapExactAmountInResponse.typeUrl || typeof o.token_out_amount === "string"); + }, encode(message: MsgSwapExactAmountInResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.tokenOutAmount !== "") { writer.uint32(10).string(message.tokenOutAmount); @@ -1395,7 +1491,8 @@ export const MsgSwapExactAmountInResponse = { typeUrl: "/osmosis.gamm.v1beta1.MsgSwapExactAmountInResponse", value: MsgSwapExactAmountInResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseSwapAmountOutRoute(): SwapAmountOutRoute { return { @@ -1412,6 +1509,15 @@ function createBaseSwapAmountOutRoute(): SwapAmountOutRoute { export const SwapAmountOutRoute = { typeUrl: "/osmosis.gamm.v1beta1.SwapAmountOutRoute", aminoType: "osmosis/gamm/swap-amount-out-route", + is(o: any): o is SwapAmountOutRoute { + return o && (o.$typeUrl === SwapAmountOutRoute.typeUrl || typeof o.poolId === "bigint" && typeof o.tokenInDenom === "string"); + }, + isSDK(o: any): o is SwapAmountOutRouteSDKType { + return o && (o.$typeUrl === SwapAmountOutRoute.typeUrl || typeof o.pool_id === "bigint" && typeof o.token_in_denom === "string"); + }, + isAmino(o: any): o is SwapAmountOutRouteAmino { + return o && (o.$typeUrl === SwapAmountOutRoute.typeUrl || typeof o.pool_id === "bigint" && typeof o.token_in_denom === "string"); + }, encode(message: SwapAmountOutRoute, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.poolId !== BigInt(0)) { writer.uint32(8).uint64(message.poolId); @@ -1494,7 +1600,8 @@ export const SwapAmountOutRoute = { typeUrl: "/osmosis.gamm.v1beta1.SwapAmountOutRoute", value: SwapAmountOutRoute.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgSwapExactAmountOut(): MsgSwapExactAmountOut { return { @@ -1512,6 +1619,15 @@ function createBaseMsgSwapExactAmountOut(): MsgSwapExactAmountOut { export const MsgSwapExactAmountOut = { typeUrl: "/osmosis.gamm.v1beta1.MsgSwapExactAmountOut", aminoType: "osmosis/gamm/swap-exact-amount-out", + is(o: any): o is MsgSwapExactAmountOut { + return o && (o.$typeUrl === MsgSwapExactAmountOut.typeUrl || typeof o.sender === "string" && Array.isArray(o.routes) && (!o.routes.length || SwapAmountOutRoute.is(o.routes[0])) && typeof o.tokenInMaxAmount === "string" && Coin.is(o.tokenOut)); + }, + isSDK(o: any): o is MsgSwapExactAmountOutSDKType { + return o && (o.$typeUrl === MsgSwapExactAmountOut.typeUrl || typeof o.sender === "string" && Array.isArray(o.routes) && (!o.routes.length || SwapAmountOutRoute.isSDK(o.routes[0])) && typeof o.token_in_max_amount === "string" && Coin.isSDK(o.token_out)); + }, + isAmino(o: any): o is MsgSwapExactAmountOutAmino { + return o && (o.$typeUrl === MsgSwapExactAmountOut.typeUrl || typeof o.sender === "string" && Array.isArray(o.routes) && (!o.routes.length || SwapAmountOutRoute.isAmino(o.routes[0])) && typeof o.token_in_max_amount === "string" && Coin.isAmino(o.token_out)); + }, encode(message: MsgSwapExactAmountOut, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.sender !== "") { writer.uint32(10).string(message.sender); @@ -1628,6 +1744,13 @@ export const MsgSwapExactAmountOut = { typeUrl: "/osmosis.gamm.v1beta1.MsgSwapExactAmountOut", value: MsgSwapExactAmountOut.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgSwapExactAmountOut.typeUrl)) { + return; + } + SwapAmountOutRoute.registerTypeUrl(); + Coin.registerTypeUrl(); } }; function createBaseMsgSwapExactAmountOutResponse(): MsgSwapExactAmountOutResponse { @@ -1643,6 +1766,15 @@ function createBaseMsgSwapExactAmountOutResponse(): MsgSwapExactAmountOutRespons export const MsgSwapExactAmountOutResponse = { typeUrl: "/osmosis.gamm.v1beta1.MsgSwapExactAmountOutResponse", aminoType: "osmosis/gamm/swap-exact-amount-out-response", + is(o: any): o is MsgSwapExactAmountOutResponse { + return o && (o.$typeUrl === MsgSwapExactAmountOutResponse.typeUrl || typeof o.tokenInAmount === "string"); + }, + isSDK(o: any): o is MsgSwapExactAmountOutResponseSDKType { + return o && (o.$typeUrl === MsgSwapExactAmountOutResponse.typeUrl || typeof o.token_in_amount === "string"); + }, + isAmino(o: any): o is MsgSwapExactAmountOutResponseAmino { + return o && (o.$typeUrl === MsgSwapExactAmountOutResponse.typeUrl || typeof o.token_in_amount === "string"); + }, encode(message: MsgSwapExactAmountOutResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.tokenInAmount !== "") { writer.uint32(10).string(message.tokenInAmount); @@ -1709,7 +1841,8 @@ export const MsgSwapExactAmountOutResponse = { typeUrl: "/osmosis.gamm.v1beta1.MsgSwapExactAmountOutResponse", value: MsgSwapExactAmountOutResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgJoinSwapExternAmountIn(): MsgJoinSwapExternAmountIn { return { @@ -1729,6 +1862,15 @@ function createBaseMsgJoinSwapExternAmountIn(): MsgJoinSwapExternAmountIn { export const MsgJoinSwapExternAmountIn = { typeUrl: "/osmosis.gamm.v1beta1.MsgJoinSwapExternAmountIn", aminoType: "osmosis/gamm/join-swap-extern-amount-in", + is(o: any): o is MsgJoinSwapExternAmountIn { + return o && (o.$typeUrl === MsgJoinSwapExternAmountIn.typeUrl || typeof o.sender === "string" && typeof o.poolId === "bigint" && Coin.is(o.tokenIn) && typeof o.shareOutMinAmount === "string"); + }, + isSDK(o: any): o is MsgJoinSwapExternAmountInSDKType { + return o && (o.$typeUrl === MsgJoinSwapExternAmountIn.typeUrl || typeof o.sender === "string" && typeof o.pool_id === "bigint" && Coin.isSDK(o.token_in) && typeof o.share_out_min_amount === "string"); + }, + isAmino(o: any): o is MsgJoinSwapExternAmountInAmino { + return o && (o.$typeUrl === MsgJoinSwapExternAmountIn.typeUrl || typeof o.sender === "string" && typeof o.pool_id === "bigint" && Coin.isAmino(o.token_in) && typeof o.share_out_min_amount === "string"); + }, encode(message: MsgJoinSwapExternAmountIn, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.sender !== "") { writer.uint32(10).string(message.sender); @@ -1841,6 +1983,12 @@ export const MsgJoinSwapExternAmountIn = { typeUrl: "/osmosis.gamm.v1beta1.MsgJoinSwapExternAmountIn", value: MsgJoinSwapExternAmountIn.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgJoinSwapExternAmountIn.typeUrl)) { + return; + } + Coin.registerTypeUrl(); } }; function createBaseMsgJoinSwapExternAmountInResponse(): MsgJoinSwapExternAmountInResponse { @@ -1856,6 +2004,15 @@ function createBaseMsgJoinSwapExternAmountInResponse(): MsgJoinSwapExternAmountI export const MsgJoinSwapExternAmountInResponse = { typeUrl: "/osmosis.gamm.v1beta1.MsgJoinSwapExternAmountInResponse", aminoType: "osmosis/gamm/join-swap-extern-amount-in-response", + is(o: any): o is MsgJoinSwapExternAmountInResponse { + return o && (o.$typeUrl === MsgJoinSwapExternAmountInResponse.typeUrl || typeof o.shareOutAmount === "string"); + }, + isSDK(o: any): o is MsgJoinSwapExternAmountInResponseSDKType { + return o && (o.$typeUrl === MsgJoinSwapExternAmountInResponse.typeUrl || typeof o.share_out_amount === "string"); + }, + isAmino(o: any): o is MsgJoinSwapExternAmountInResponseAmino { + return o && (o.$typeUrl === MsgJoinSwapExternAmountInResponse.typeUrl || typeof o.share_out_amount === "string"); + }, encode(message: MsgJoinSwapExternAmountInResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.shareOutAmount !== "") { writer.uint32(10).string(message.shareOutAmount); @@ -1922,7 +2079,8 @@ export const MsgJoinSwapExternAmountInResponse = { typeUrl: "/osmosis.gamm.v1beta1.MsgJoinSwapExternAmountInResponse", value: MsgJoinSwapExternAmountInResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgJoinSwapShareAmountOut(): MsgJoinSwapShareAmountOut { return { @@ -1942,6 +2100,15 @@ function createBaseMsgJoinSwapShareAmountOut(): MsgJoinSwapShareAmountOut { export const MsgJoinSwapShareAmountOut = { typeUrl: "/osmosis.gamm.v1beta1.MsgJoinSwapShareAmountOut", aminoType: "osmosis/gamm/join-swap-share-amount-out", + is(o: any): o is MsgJoinSwapShareAmountOut { + return o && (o.$typeUrl === MsgJoinSwapShareAmountOut.typeUrl || typeof o.sender === "string" && typeof o.poolId === "bigint" && typeof o.tokenInDenom === "string" && typeof o.shareOutAmount === "string" && typeof o.tokenInMaxAmount === "string"); + }, + isSDK(o: any): o is MsgJoinSwapShareAmountOutSDKType { + return o && (o.$typeUrl === MsgJoinSwapShareAmountOut.typeUrl || typeof o.sender === "string" && typeof o.pool_id === "bigint" && typeof o.token_in_denom === "string" && typeof o.share_out_amount === "string" && typeof o.token_in_max_amount === "string"); + }, + isAmino(o: any): o is MsgJoinSwapShareAmountOutAmino { + return o && (o.$typeUrl === MsgJoinSwapShareAmountOut.typeUrl || typeof o.sender === "string" && typeof o.pool_id === "bigint" && typeof o.token_in_denom === "string" && typeof o.share_out_amount === "string" && typeof o.token_in_max_amount === "string"); + }, encode(message: MsgJoinSwapShareAmountOut, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.sender !== "") { writer.uint32(10).string(message.sender); @@ -2066,7 +2233,8 @@ export const MsgJoinSwapShareAmountOut = { typeUrl: "/osmosis.gamm.v1beta1.MsgJoinSwapShareAmountOut", value: MsgJoinSwapShareAmountOut.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgJoinSwapShareAmountOutResponse(): MsgJoinSwapShareAmountOutResponse { return { @@ -2081,6 +2249,15 @@ function createBaseMsgJoinSwapShareAmountOutResponse(): MsgJoinSwapShareAmountOu export const MsgJoinSwapShareAmountOutResponse = { typeUrl: "/osmosis.gamm.v1beta1.MsgJoinSwapShareAmountOutResponse", aminoType: "osmosis/gamm/join-swap-share-amount-out-response", + is(o: any): o is MsgJoinSwapShareAmountOutResponse { + return o && (o.$typeUrl === MsgJoinSwapShareAmountOutResponse.typeUrl || typeof o.tokenInAmount === "string"); + }, + isSDK(o: any): o is MsgJoinSwapShareAmountOutResponseSDKType { + return o && (o.$typeUrl === MsgJoinSwapShareAmountOutResponse.typeUrl || typeof o.token_in_amount === "string"); + }, + isAmino(o: any): o is MsgJoinSwapShareAmountOutResponseAmino { + return o && (o.$typeUrl === MsgJoinSwapShareAmountOutResponse.typeUrl || typeof o.token_in_amount === "string"); + }, encode(message: MsgJoinSwapShareAmountOutResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.tokenInAmount !== "") { writer.uint32(10).string(message.tokenInAmount); @@ -2147,7 +2324,8 @@ export const MsgJoinSwapShareAmountOutResponse = { typeUrl: "/osmosis.gamm.v1beta1.MsgJoinSwapShareAmountOutResponse", value: MsgJoinSwapShareAmountOutResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgExitSwapShareAmountIn(): MsgExitSwapShareAmountIn { return { @@ -2167,6 +2345,15 @@ function createBaseMsgExitSwapShareAmountIn(): MsgExitSwapShareAmountIn { export const MsgExitSwapShareAmountIn = { typeUrl: "/osmosis.gamm.v1beta1.MsgExitSwapShareAmountIn", aminoType: "osmosis/gamm/exit-swap-share-amount-in", + is(o: any): o is MsgExitSwapShareAmountIn { + return o && (o.$typeUrl === MsgExitSwapShareAmountIn.typeUrl || typeof o.sender === "string" && typeof o.poolId === "bigint" && typeof o.tokenOutDenom === "string" && typeof o.shareInAmount === "string" && typeof o.tokenOutMinAmount === "string"); + }, + isSDK(o: any): o is MsgExitSwapShareAmountInSDKType { + return o && (o.$typeUrl === MsgExitSwapShareAmountIn.typeUrl || typeof o.sender === "string" && typeof o.pool_id === "bigint" && typeof o.token_out_denom === "string" && typeof o.share_in_amount === "string" && typeof o.token_out_min_amount === "string"); + }, + isAmino(o: any): o is MsgExitSwapShareAmountInAmino { + return o && (o.$typeUrl === MsgExitSwapShareAmountIn.typeUrl || typeof o.sender === "string" && typeof o.pool_id === "bigint" && typeof o.token_out_denom === "string" && typeof o.share_in_amount === "string" && typeof o.token_out_min_amount === "string"); + }, encode(message: MsgExitSwapShareAmountIn, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.sender !== "") { writer.uint32(10).string(message.sender); @@ -2291,7 +2478,8 @@ export const MsgExitSwapShareAmountIn = { typeUrl: "/osmosis.gamm.v1beta1.MsgExitSwapShareAmountIn", value: MsgExitSwapShareAmountIn.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgExitSwapShareAmountInResponse(): MsgExitSwapShareAmountInResponse { return { @@ -2306,6 +2494,15 @@ function createBaseMsgExitSwapShareAmountInResponse(): MsgExitSwapShareAmountInR export const MsgExitSwapShareAmountInResponse = { typeUrl: "/osmosis.gamm.v1beta1.MsgExitSwapShareAmountInResponse", aminoType: "osmosis/gamm/exit-swap-share-amount-in-response", + is(o: any): o is MsgExitSwapShareAmountInResponse { + return o && (o.$typeUrl === MsgExitSwapShareAmountInResponse.typeUrl || typeof o.tokenOutAmount === "string"); + }, + isSDK(o: any): o is MsgExitSwapShareAmountInResponseSDKType { + return o && (o.$typeUrl === MsgExitSwapShareAmountInResponse.typeUrl || typeof o.token_out_amount === "string"); + }, + isAmino(o: any): o is MsgExitSwapShareAmountInResponseAmino { + return o && (o.$typeUrl === MsgExitSwapShareAmountInResponse.typeUrl || typeof o.token_out_amount === "string"); + }, encode(message: MsgExitSwapShareAmountInResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.tokenOutAmount !== "") { writer.uint32(10).string(message.tokenOutAmount); @@ -2372,7 +2569,8 @@ export const MsgExitSwapShareAmountInResponse = { typeUrl: "/osmosis.gamm.v1beta1.MsgExitSwapShareAmountInResponse", value: MsgExitSwapShareAmountInResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgExitSwapExternAmountOut(): MsgExitSwapExternAmountOut { return { @@ -2391,6 +2589,15 @@ function createBaseMsgExitSwapExternAmountOut(): MsgExitSwapExternAmountOut { export const MsgExitSwapExternAmountOut = { typeUrl: "/osmosis.gamm.v1beta1.MsgExitSwapExternAmountOut", aminoType: "osmosis/gamm/exit-swap-extern-amount-out", + is(o: any): o is MsgExitSwapExternAmountOut { + return o && (o.$typeUrl === MsgExitSwapExternAmountOut.typeUrl || typeof o.sender === "string" && typeof o.poolId === "bigint" && Coin.is(o.tokenOut) && typeof o.shareInMaxAmount === "string"); + }, + isSDK(o: any): o is MsgExitSwapExternAmountOutSDKType { + return o && (o.$typeUrl === MsgExitSwapExternAmountOut.typeUrl || typeof o.sender === "string" && typeof o.pool_id === "bigint" && Coin.isSDK(o.token_out) && typeof o.share_in_max_amount === "string"); + }, + isAmino(o: any): o is MsgExitSwapExternAmountOutAmino { + return o && (o.$typeUrl === MsgExitSwapExternAmountOut.typeUrl || typeof o.sender === "string" && typeof o.pool_id === "bigint" && Coin.isAmino(o.token_out) && typeof o.share_in_max_amount === "string"); + }, encode(message: MsgExitSwapExternAmountOut, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.sender !== "") { writer.uint32(10).string(message.sender); @@ -2503,6 +2710,12 @@ export const MsgExitSwapExternAmountOut = { typeUrl: "/osmosis.gamm.v1beta1.MsgExitSwapExternAmountOut", value: MsgExitSwapExternAmountOut.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgExitSwapExternAmountOut.typeUrl)) { + return; + } + Coin.registerTypeUrl(); } }; function createBaseMsgExitSwapExternAmountOutResponse(): MsgExitSwapExternAmountOutResponse { @@ -2518,6 +2731,15 @@ function createBaseMsgExitSwapExternAmountOutResponse(): MsgExitSwapExternAmount export const MsgExitSwapExternAmountOutResponse = { typeUrl: "/osmosis.gamm.v1beta1.MsgExitSwapExternAmountOutResponse", aminoType: "osmosis/gamm/exit-swap-extern-amount-out-response", + is(o: any): o is MsgExitSwapExternAmountOutResponse { + return o && (o.$typeUrl === MsgExitSwapExternAmountOutResponse.typeUrl || typeof o.shareInAmount === "string"); + }, + isSDK(o: any): o is MsgExitSwapExternAmountOutResponseSDKType { + return o && (o.$typeUrl === MsgExitSwapExternAmountOutResponse.typeUrl || typeof o.share_in_amount === "string"); + }, + isAmino(o: any): o is MsgExitSwapExternAmountOutResponseAmino { + return o && (o.$typeUrl === MsgExitSwapExternAmountOutResponse.typeUrl || typeof o.share_in_amount === "string"); + }, encode(message: MsgExitSwapExternAmountOutResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.shareInAmount !== "") { writer.uint32(10).string(message.shareInAmount); @@ -2584,5 +2806,6 @@ export const MsgExitSwapExternAmountOutResponse = { typeUrl: "/osmosis.gamm.v1beta1.MsgExitSwapExternAmountOutResponse", value: MsgExitSwapExternAmountOutResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/osmosis/gamm/v2/query.rpc.func.ts b/__fixtures__/v-next/outputv3/osmosis/gamm/v2/query.rpc.func.ts new file mode 100644 index 0000000000..bbcdc0af54 --- /dev/null +++ b/__fixtures__/v-next/outputv3/osmosis/gamm/v2/query.rpc.func.ts @@ -0,0 +1,16 @@ +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { QuerySpotPriceRequest, QuerySpotPriceRequestSDKType, QuerySpotPriceResponse, QuerySpotPriceResponseSDKType } from "./query"; +/** + * SpotPrice defines a gRPC query handler that returns the spot price given + * a base denomination and a quote denomination. + * @name getSpotPrice + * @package osmosis.gamm.v2 + * @see proto service: osmosis.gamm.v2.SpotPrice + */ +export const getSpotPrice = buildQuery({ + encode: QuerySpotPriceRequest.encode, + decode: QuerySpotPriceResponse.decode, + service: "osmosis.gamm.v2.Query", + method: "SpotPrice", + deps: [QuerySpotPriceRequest, QuerySpotPriceResponse] +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/osmosis/gamm/v2/query.ts b/__fixtures__/v-next/outputv3/osmosis/gamm/v2/query.ts index 4bfd427cf0..0db1dca6c5 100644 --- a/__fixtures__/v-next/outputv3/osmosis/gamm/v2/query.ts +++ b/__fixtures__/v-next/outputv3/osmosis/gamm/v2/query.ts @@ -98,6 +98,15 @@ function createBaseQuerySpotPriceRequest(): QuerySpotPriceRequest { export const QuerySpotPriceRequest = { typeUrl: "/osmosis.gamm.v2.QuerySpotPriceRequest", aminoType: "osmosis/gamm/v2/query-spot-price-request", + is(o: any): o is QuerySpotPriceRequest { + return o && (o.$typeUrl === QuerySpotPriceRequest.typeUrl || typeof o.poolId === "bigint" && typeof o.baseAssetDenom === "string" && typeof o.quoteAssetDenom === "string"); + }, + isSDK(o: any): o is QuerySpotPriceRequestSDKType { + return o && (o.$typeUrl === QuerySpotPriceRequest.typeUrl || typeof o.pool_id === "bigint" && typeof o.base_asset_denom === "string" && typeof o.quote_asset_denom === "string"); + }, + isAmino(o: any): o is QuerySpotPriceRequestAmino { + return o && (o.$typeUrl === QuerySpotPriceRequest.typeUrl || typeof o.pool_id === "bigint" && typeof o.base_asset_denom === "string" && typeof o.quote_asset_denom === "string"); + }, encode(message: QuerySpotPriceRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.poolId !== BigInt(0)) { writer.uint32(8).uint64(message.poolId); @@ -194,7 +203,8 @@ export const QuerySpotPriceRequest = { typeUrl: "/osmosis.gamm.v2.QuerySpotPriceRequest", value: QuerySpotPriceRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQuerySpotPriceResponse(): QuerySpotPriceResponse { return { @@ -211,6 +221,15 @@ function createBaseQuerySpotPriceResponse(): QuerySpotPriceResponse { export const QuerySpotPriceResponse = { typeUrl: "/osmosis.gamm.v2.QuerySpotPriceResponse", aminoType: "osmosis/gamm/v2/query-spot-price-response", + is(o: any): o is QuerySpotPriceResponse { + return o && (o.$typeUrl === QuerySpotPriceResponse.typeUrl || typeof o.spotPrice === "string"); + }, + isSDK(o: any): o is QuerySpotPriceResponseSDKType { + return o && (o.$typeUrl === QuerySpotPriceResponse.typeUrl || typeof o.spot_price === "string"); + }, + isAmino(o: any): o is QuerySpotPriceResponseAmino { + return o && (o.$typeUrl === QuerySpotPriceResponse.typeUrl || typeof o.spot_price === "string"); + }, encode(message: QuerySpotPriceResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.spotPrice !== "") { writer.uint32(10).string(message.spotPrice); @@ -277,5 +296,6 @@ export const QuerySpotPriceResponse = { typeUrl: "/osmosis.gamm.v2.QuerySpotPriceResponse", value: QuerySpotPriceResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/osmosis/ibc-rate-limit/v1beta1/params.ts b/__fixtures__/v-next/outputv3/osmosis/ibc-rate-limit/v1beta1/params.ts index 983c511293..12477896c3 100644 --- a/__fixtures__/v-next/outputv3/osmosis/ibc-rate-limit/v1beta1/params.ts +++ b/__fixtures__/v-next/outputv3/osmosis/ibc-rate-limit/v1beta1/params.ts @@ -46,6 +46,15 @@ function createBaseParams(): Params { export const Params = { typeUrl: "/osmosis.ibcratelimit.v1beta1.Params", aminoType: "osmosis/ibcratelimit/params", + is(o: any): o is Params { + return o && (o.$typeUrl === Params.typeUrl || typeof o.contractAddress === "string"); + }, + isSDK(o: any): o is ParamsSDKType { + return o && (o.$typeUrl === Params.typeUrl || typeof o.contract_address === "string"); + }, + isAmino(o: any): o is ParamsAmino { + return o && (o.$typeUrl === Params.typeUrl || typeof o.contract_address === "string"); + }, encode(message: Params, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.contractAddress !== "") { writer.uint32(10).string(message.contractAddress); @@ -112,5 +121,6 @@ export const Params = { typeUrl: "/osmosis.ibcratelimit.v1beta1.Params", value: Params.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/osmosis/ibc-rate-limit/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputv3/osmosis/ibc-rate-limit/v1beta1/query.rpc.func.ts new file mode 100644 index 0000000000..349d4a66b6 --- /dev/null +++ b/__fixtures__/v-next/outputv3/osmosis/ibc-rate-limit/v1beta1/query.rpc.func.ts @@ -0,0 +1,17 @@ +import { Params, ParamsSDKType } from "./params"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType } from "./query"; +/** + * Params defines a gRPC query method that returns the ibc-rate-limit module's + * parameters. + * @name getParams + * @package osmosis.ibcratelimit.v1beta1 + * @see proto service: osmosis.ibcratelimit.v1beta1.Params + */ +export const getParams = buildQuery({ + encode: QueryParamsRequest.encode, + decode: QueryParamsResponse.decode, + service: "osmosis.ibcratelimit.v1beta1.Query", + method: "Params", + deps: [QueryParamsRequest, QueryParamsResponse] +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/osmosis/ibc-rate-limit/v1beta1/query.ts b/__fixtures__/v-next/outputv3/osmosis/ibc-rate-limit/v1beta1/query.ts index 60bcce1c69..de8b27666e 100644 --- a/__fixtures__/v-next/outputv3/osmosis/ibc-rate-limit/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv3/osmosis/ibc-rate-limit/v1beta1/query.ts @@ -1,6 +1,7 @@ import { Params, ParamsAmino, ParamsSDKType } from "./params"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { DeepPartial, isSet } from "../../../helpers"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "osmosis.ibcratelimit.v1beta1"; /** * QueryParamsRequest is the request type for the Query/Params RPC method. @@ -76,6 +77,15 @@ function createBaseQueryParamsRequest(): QueryParamsRequest { export const QueryParamsRequest = { typeUrl: "/osmosis.ibcratelimit.v1beta1.QueryParamsRequest", aminoType: "osmosis/ibcratelimit/query-params-request", + is(o: any): o is QueryParamsRequest { + return o && o.$typeUrl === QueryParamsRequest.typeUrl; + }, + isSDK(o: any): o is QueryParamsRequestSDKType { + return o && o.$typeUrl === QueryParamsRequest.typeUrl; + }, + isAmino(o: any): o is QueryParamsRequestAmino { + return o && o.$typeUrl === QueryParamsRequest.typeUrl; + }, encode(_: QueryParamsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -127,7 +137,8 @@ export const QueryParamsRequest = { typeUrl: "/osmosis.ibcratelimit.v1beta1.QueryParamsRequest", value: QueryParamsRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryParamsResponse(): QueryParamsResponse { return { @@ -143,6 +154,15 @@ function createBaseQueryParamsResponse(): QueryParamsResponse { export const QueryParamsResponse = { typeUrl: "/osmosis.ibcratelimit.v1beta1.QueryParamsResponse", aminoType: "osmosis/ibcratelimit/query-params-response", + is(o: any): o is QueryParamsResponse { + return o && (o.$typeUrl === QueryParamsResponse.typeUrl || Params.is(o.params)); + }, + isSDK(o: any): o is QueryParamsResponseSDKType { + return o && (o.$typeUrl === QueryParamsResponse.typeUrl || Params.isSDK(o.params)); + }, + isAmino(o: any): o is QueryParamsResponseAmino { + return o && (o.$typeUrl === QueryParamsResponse.typeUrl || Params.isAmino(o.params)); + }, encode(message: QueryParamsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.params !== undefined) { Params.encode(message.params, writer.uint32(10).fork()).ldelim(); @@ -211,5 +231,11 @@ export const QueryParamsResponse = { typeUrl: "/osmosis.ibcratelimit.v1beta1.QueryParamsResponse", value: QueryParamsResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryParamsResponse.typeUrl)) { + return; + } + Params.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/osmosis/incentives/gauge.ts b/__fixtures__/v-next/outputv3/osmosis/incentives/gauge.ts index 2c2f32b21b..552f099743 100644 --- a/__fixtures__/v-next/outputv3/osmosis/incentives/gauge.ts +++ b/__fixtures__/v-next/outputv3/osmosis/incentives/gauge.ts @@ -3,6 +3,7 @@ import { Coin, CoinAmino, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; import { Timestamp, TimestampAmino, TimestampSDKType } from "../../google/protobuf/timestamp"; import { Duration, DurationAmino, DurationSDKType } from "../../google/protobuf/duration"; import { BinaryReader, BinaryWriter } from "../../binary"; +import { GlobalDecoderRegistry } from "../../registry"; import { toTimestamp, fromTimestamp, isSet, DeepPartial } from "../../helpers"; export const protobufPackage = "osmosis.incentives"; /** @@ -184,6 +185,15 @@ function createBaseGauge(): Gauge { export const Gauge = { typeUrl: "/osmosis.incentives.Gauge", aminoType: "osmosis/incentives/gauge", + is(o: any): o is Gauge { + return o && (o.$typeUrl === Gauge.typeUrl || typeof o.id === "bigint" && typeof o.isPerpetual === "boolean" && QueryCondition.is(o.distributeTo) && Array.isArray(o.coins) && (!o.coins.length || Coin.is(o.coins[0])) && Timestamp.is(o.startTime) && typeof o.numEpochsPaidOver === "bigint" && typeof o.filledEpochs === "bigint" && Array.isArray(o.distributedCoins) && (!o.distributedCoins.length || Coin.is(o.distributedCoins[0]))); + }, + isSDK(o: any): o is GaugeSDKType { + return o && (o.$typeUrl === Gauge.typeUrl || typeof o.id === "bigint" && typeof o.is_perpetual === "boolean" && QueryCondition.isSDK(o.distribute_to) && Array.isArray(o.coins) && (!o.coins.length || Coin.isSDK(o.coins[0])) && Timestamp.isSDK(o.start_time) && typeof o.num_epochs_paid_over === "bigint" && typeof o.filled_epochs === "bigint" && Array.isArray(o.distributed_coins) && (!o.distributed_coins.length || Coin.isSDK(o.distributed_coins[0]))); + }, + isAmino(o: any): o is GaugeAmino { + return o && (o.$typeUrl === Gauge.typeUrl || typeof o.id === "bigint" && typeof o.is_perpetual === "boolean" && QueryCondition.isAmino(o.distribute_to) && Array.isArray(o.coins) && (!o.coins.length || Coin.isAmino(o.coins[0])) && Timestamp.isAmino(o.start_time) && typeof o.num_epochs_paid_over === "bigint" && typeof o.filled_epochs === "bigint" && Array.isArray(o.distributed_coins) && (!o.distributed_coins.length || Coin.isAmino(o.distributed_coins[0]))); + }, encode(message: Gauge, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.id !== BigInt(0)) { writer.uint32(8).uint64(message.id); @@ -368,6 +378,13 @@ export const Gauge = { typeUrl: "/osmosis.incentives.Gauge", value: Gauge.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Gauge.typeUrl)) { + return; + } + QueryCondition.registerTypeUrl(); + Coin.registerTypeUrl(); } }; function createBaseLockableDurationsInfo(): LockableDurationsInfo { @@ -383,6 +400,15 @@ function createBaseLockableDurationsInfo(): LockableDurationsInfo { export const LockableDurationsInfo = { typeUrl: "/osmosis.incentives.LockableDurationsInfo", aminoType: "osmosis/incentives/lockable-durations-info", + is(o: any): o is LockableDurationsInfo { + return o && (o.$typeUrl === LockableDurationsInfo.typeUrl || Array.isArray(o.lockableDurations) && (!o.lockableDurations.length || Duration.is(o.lockableDurations[0]))); + }, + isSDK(o: any): o is LockableDurationsInfoSDKType { + return o && (o.$typeUrl === LockableDurationsInfo.typeUrl || Array.isArray(o.lockable_durations) && (!o.lockable_durations.length || Duration.isSDK(o.lockable_durations[0]))); + }, + isAmino(o: any): o is LockableDurationsInfoAmino { + return o && (o.$typeUrl === LockableDurationsInfo.typeUrl || Array.isArray(o.lockable_durations) && (!o.lockable_durations.length || Duration.isAmino(o.lockable_durations[0]))); + }, encode(message: LockableDurationsInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.lockableDurations) { Duration.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -455,5 +481,6 @@ export const LockableDurationsInfo = { typeUrl: "/osmosis.incentives.LockableDurationsInfo", value: LockableDurationsInfo.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/osmosis/incentives/genesis.ts b/__fixtures__/v-next/outputv3/osmosis/incentives/genesis.ts index 6f4f8bbb50..db2193ce3b 100644 --- a/__fixtures__/v-next/outputv3/osmosis/incentives/genesis.ts +++ b/__fixtures__/v-next/outputv3/osmosis/incentives/genesis.ts @@ -2,6 +2,7 @@ import { Params, ParamsAmino, ParamsSDKType } from "./params"; import { Gauge, GaugeAmino, GaugeSDKType } from "./gauge"; import { Duration, DurationAmino, DurationSDKType } from "../../google/protobuf/duration"; import { BinaryReader, BinaryWriter } from "../../binary"; +import { GlobalDecoderRegistry } from "../../registry"; import { isSet, DeepPartial } from "../../helpers"; export const protobufPackage = "osmosis.incentives"; /** @@ -93,6 +94,15 @@ function createBaseGenesisState(): GenesisState { export const GenesisState = { typeUrl: "/osmosis.incentives.GenesisState", aminoType: "osmosis/incentives/genesis-state", + is(o: any): o is GenesisState { + return o && (o.$typeUrl === GenesisState.typeUrl || Params.is(o.params) && Array.isArray(o.gauges) && (!o.gauges.length || Gauge.is(o.gauges[0])) && Array.isArray(o.lockableDurations) && (!o.lockableDurations.length || Duration.is(o.lockableDurations[0])) && typeof o.lastGaugeId === "bigint"); + }, + isSDK(o: any): o is GenesisStateSDKType { + return o && (o.$typeUrl === GenesisState.typeUrl || Params.isSDK(o.params) && Array.isArray(o.gauges) && (!o.gauges.length || Gauge.isSDK(o.gauges[0])) && Array.isArray(o.lockable_durations) && (!o.lockable_durations.length || Duration.isSDK(o.lockable_durations[0])) && typeof o.last_gauge_id === "bigint"); + }, + isAmino(o: any): o is GenesisStateAmino { + return o && (o.$typeUrl === GenesisState.typeUrl || Params.isAmino(o.params) && Array.isArray(o.gauges) && (!o.gauges.length || Gauge.isAmino(o.gauges[0])) && Array.isArray(o.lockable_durations) && (!o.lockable_durations.length || Duration.isAmino(o.lockable_durations[0])) && typeof o.last_gauge_id === "bigint"); + }, encode(message: GenesisState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.params !== undefined) { Params.encode(message.params, writer.uint32(10).fork()).ldelim(); @@ -217,5 +227,12 @@ export const GenesisState = { typeUrl: "/osmosis.incentives.GenesisState", value: GenesisState.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GenesisState.typeUrl)) { + return; + } + Params.registerTypeUrl(); + Gauge.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/osmosis/incentives/params.ts b/__fixtures__/v-next/outputv3/osmosis/incentives/params.ts index 31d2516a42..977941eca2 100644 --- a/__fixtures__/v-next/outputv3/osmosis/incentives/params.ts +++ b/__fixtures__/v-next/outputv3/osmosis/incentives/params.ts @@ -54,6 +54,15 @@ function createBaseParams(): Params { export const Params = { typeUrl: "/osmosis.incentives.Params", aminoType: "osmosis/incentives/params", + is(o: any): o is Params { + return o && (o.$typeUrl === Params.typeUrl || typeof o.distrEpochIdentifier === "string"); + }, + isSDK(o: any): o is ParamsSDKType { + return o && (o.$typeUrl === Params.typeUrl || typeof o.distr_epoch_identifier === "string"); + }, + isAmino(o: any): o is ParamsAmino { + return o && (o.$typeUrl === Params.typeUrl || typeof o.distr_epoch_identifier === "string"); + }, encode(message: Params, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.distrEpochIdentifier !== "") { writer.uint32(10).string(message.distrEpochIdentifier); @@ -120,5 +129,6 @@ export const Params = { typeUrl: "/osmosis.incentives.Params", value: Params.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/osmosis/incentives/query.rpc.func.ts b/__fixtures__/v-next/outputv3/osmosis/incentives/query.rpc.func.ts new file mode 100644 index 0000000000..50807823f7 --- /dev/null +++ b/__fixtures__/v-next/outputv3/osmosis/incentives/query.rpc.func.ts @@ -0,0 +1,127 @@ +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../cosmos/base/query/v1beta1/pagination"; +import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; +import { Gauge, GaugeSDKType } from "./gauge"; +import { Duration, DurationSDKType } from "../../google/protobuf/duration"; +import { EndpointOrRpc, buildQuery } from "../../helper-func-types"; +import { ModuleToDistributeCoinsRequest, ModuleToDistributeCoinsRequestSDKType, ModuleToDistributeCoinsResponse, ModuleToDistributeCoinsResponseSDKType, GaugeByIDRequest, GaugeByIDRequestSDKType, GaugeByIDResponse, GaugeByIDResponseSDKType, GaugesRequest, GaugesRequestSDKType, GaugesResponse, GaugesResponseSDKType, ActiveGaugesRequest, ActiveGaugesRequestSDKType, ActiveGaugesResponse, ActiveGaugesResponseSDKType, ActiveGaugesPerDenomRequest, ActiveGaugesPerDenomRequestSDKType, ActiveGaugesPerDenomResponse, ActiveGaugesPerDenomResponseSDKType, UpcomingGaugesRequest, UpcomingGaugesRequestSDKType, UpcomingGaugesResponse, UpcomingGaugesResponseSDKType, UpcomingGaugesPerDenomRequest, UpcomingGaugesPerDenomRequestSDKType, UpcomingGaugesPerDenomResponse, UpcomingGaugesPerDenomResponseSDKType, RewardsEstRequest, RewardsEstRequestSDKType, RewardsEstResponse, RewardsEstResponseSDKType, QueryLockableDurationsRequest, QueryLockableDurationsRequestSDKType, QueryLockableDurationsResponse, QueryLockableDurationsResponseSDKType } from "./query"; +/** + * ModuleToDistributeCoins returns coins that are going to be distributed + * @name getModuleToDistributeCoins + * @package osmosis.incentives + * @see proto service: osmosis.incentives.ModuleToDistributeCoins + */ +export const getModuleToDistributeCoins = buildQuery({ + encode: ModuleToDistributeCoinsRequest.encode, + decode: ModuleToDistributeCoinsResponse.decode, + service: "osmosis.incentives.Query", + method: "ModuleToDistributeCoins", + deps: [ModuleToDistributeCoinsRequest, ModuleToDistributeCoinsResponse] +}); +/** + * GaugeByID returns gauges by their respective ID + * @name getGaugeByID + * @package osmosis.incentives + * @see proto service: osmosis.incentives.GaugeByID + */ +export const getGaugeByID = buildQuery({ + encode: GaugeByIDRequest.encode, + decode: GaugeByIDResponse.decode, + service: "osmosis.incentives.Query", + method: "GaugeByID", + deps: [GaugeByIDRequest, GaugeByIDResponse] +}); +/** + * Gauges returns both upcoming and active gauges + * @name getGauges + * @package osmosis.incentives + * @see proto service: osmosis.incentives.Gauges + */ +export const getGauges = buildQuery({ + encode: GaugesRequest.encode, + decode: GaugesResponse.decode, + service: "osmosis.incentives.Query", + method: "Gauges", + deps: [GaugesRequest, GaugesResponse] +}); +/** + * ActiveGauges returns active gauges + * @name getActiveGauges + * @package osmosis.incentives + * @see proto service: osmosis.incentives.ActiveGauges + */ +export const getActiveGauges = buildQuery({ + encode: ActiveGaugesRequest.encode, + decode: ActiveGaugesResponse.decode, + service: "osmosis.incentives.Query", + method: "ActiveGauges", + deps: [ActiveGaugesRequest, ActiveGaugesResponse] +}); +/** + * ActiveGaugesPerDenom returns active gauges by denom + * @name getActiveGaugesPerDenom + * @package osmosis.incentives + * @see proto service: osmosis.incentives.ActiveGaugesPerDenom + */ +export const getActiveGaugesPerDenom = buildQuery({ + encode: ActiveGaugesPerDenomRequest.encode, + decode: ActiveGaugesPerDenomResponse.decode, + service: "osmosis.incentives.Query", + method: "ActiveGaugesPerDenom", + deps: [ActiveGaugesPerDenomRequest, ActiveGaugesPerDenomResponse] +}); +/** + * Returns scheduled gauges that have not yet occured + * @name getUpcomingGauges + * @package osmosis.incentives + * @see proto service: osmosis.incentives.UpcomingGauges + */ +export const getUpcomingGauges = buildQuery({ + encode: UpcomingGaugesRequest.encode, + decode: UpcomingGaugesResponse.decode, + service: "osmosis.incentives.Query", + method: "UpcomingGauges", + deps: [UpcomingGaugesRequest, UpcomingGaugesResponse] +}); +/** + * UpcomingGaugesPerDenom returns scheduled gauges that have not yet occured + * by denom + * @name getUpcomingGaugesPerDenom + * @package osmosis.incentives + * @see proto service: osmosis.incentives.UpcomingGaugesPerDenom + */ +export const getUpcomingGaugesPerDenom = buildQuery({ + encode: UpcomingGaugesPerDenomRequest.encode, + decode: UpcomingGaugesPerDenomResponse.decode, + service: "osmosis.incentives.Query", + method: "UpcomingGaugesPerDenom", + deps: [UpcomingGaugesPerDenomRequest, UpcomingGaugesPerDenomResponse] +}); +/** + * RewardsEst returns an estimate of the rewards from now until a specified + * time in the future The querier either provides an address or a set of locks + * for which they want to find the associated rewards + * @name getRewardsEst + * @package osmosis.incentives + * @see proto service: osmosis.incentives.RewardsEst + */ +export const getRewardsEst = buildQuery({ + encode: RewardsEstRequest.encode, + decode: RewardsEstResponse.decode, + service: "osmosis.incentives.Query", + method: "RewardsEst", + deps: [RewardsEstRequest, RewardsEstResponse] +}); +/** + * LockableDurations returns lockable durations that are valid to distribute + * incentives for + * @name getLockableDurations + * @package osmosis.incentives + * @see proto service: osmosis.incentives.LockableDurations + */ +export const getLockableDurations = buildQuery({ + encode: QueryLockableDurationsRequest.encode, + decode: QueryLockableDurationsResponse.decode, + service: "osmosis.incentives.Query", + method: "LockableDurations", + deps: [QueryLockableDurationsRequest, QueryLockableDurationsResponse] +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/osmosis/incentives/query.ts b/__fixtures__/v-next/outputv3/osmosis/incentives/query.ts index 55136732c0..883911824b 100644 --- a/__fixtures__/v-next/outputv3/osmosis/incentives/query.ts +++ b/__fixtures__/v-next/outputv3/osmosis/incentives/query.ts @@ -4,6 +4,7 @@ import { Gauge, GaugeAmino, GaugeSDKType } from "./gauge"; import { Duration, DurationAmino, DurationSDKType } from "../../google/protobuf/duration"; import { BinaryReader, BinaryWriter } from "../../binary"; import { DeepPartial, isSet } from "../../helpers"; +import { GlobalDecoderRegistry } from "../../registry"; export const protobufPackage = "osmosis.incentives"; /** * @name ModuleToDistributeCoinsRequest @@ -689,6 +690,15 @@ function createBaseModuleToDistributeCoinsRequest(): ModuleToDistributeCoinsRequ export const ModuleToDistributeCoinsRequest = { typeUrl: "/osmosis.incentives.ModuleToDistributeCoinsRequest", aminoType: "osmosis/incentives/module-to-distribute-coins-request", + is(o: any): o is ModuleToDistributeCoinsRequest { + return o && o.$typeUrl === ModuleToDistributeCoinsRequest.typeUrl; + }, + isSDK(o: any): o is ModuleToDistributeCoinsRequestSDKType { + return o && o.$typeUrl === ModuleToDistributeCoinsRequest.typeUrl; + }, + isAmino(o: any): o is ModuleToDistributeCoinsRequestAmino { + return o && o.$typeUrl === ModuleToDistributeCoinsRequest.typeUrl; + }, encode(_: ModuleToDistributeCoinsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -740,7 +750,8 @@ export const ModuleToDistributeCoinsRequest = { typeUrl: "/osmosis.incentives.ModuleToDistributeCoinsRequest", value: ModuleToDistributeCoinsRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseModuleToDistributeCoinsResponse(): ModuleToDistributeCoinsResponse { return { @@ -755,6 +766,15 @@ function createBaseModuleToDistributeCoinsResponse(): ModuleToDistributeCoinsRes export const ModuleToDistributeCoinsResponse = { typeUrl: "/osmosis.incentives.ModuleToDistributeCoinsResponse", aminoType: "osmosis/incentives/module-to-distribute-coins-response", + is(o: any): o is ModuleToDistributeCoinsResponse { + return o && (o.$typeUrl === ModuleToDistributeCoinsResponse.typeUrl || Array.isArray(o.coins) && (!o.coins.length || Coin.is(o.coins[0]))); + }, + isSDK(o: any): o is ModuleToDistributeCoinsResponseSDKType { + return o && (o.$typeUrl === ModuleToDistributeCoinsResponse.typeUrl || Array.isArray(o.coins) && (!o.coins.length || Coin.isSDK(o.coins[0]))); + }, + isAmino(o: any): o is ModuleToDistributeCoinsResponseAmino { + return o && (o.$typeUrl === ModuleToDistributeCoinsResponse.typeUrl || Array.isArray(o.coins) && (!o.coins.length || Coin.isAmino(o.coins[0]))); + }, encode(message: ModuleToDistributeCoinsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.coins) { Coin.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -827,6 +847,12 @@ export const ModuleToDistributeCoinsResponse = { typeUrl: "/osmosis.incentives.ModuleToDistributeCoinsResponse", value: ModuleToDistributeCoinsResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ModuleToDistributeCoinsResponse.typeUrl)) { + return; + } + Coin.registerTypeUrl(); } }; function createBaseGaugeByIDRequest(): GaugeByIDRequest { @@ -842,6 +868,15 @@ function createBaseGaugeByIDRequest(): GaugeByIDRequest { export const GaugeByIDRequest = { typeUrl: "/osmosis.incentives.GaugeByIDRequest", aminoType: "osmosis/incentives/gauge-by-id-request", + is(o: any): o is GaugeByIDRequest { + return o && (o.$typeUrl === GaugeByIDRequest.typeUrl || typeof o.id === "bigint"); + }, + isSDK(o: any): o is GaugeByIDRequestSDKType { + return o && (o.$typeUrl === GaugeByIDRequest.typeUrl || typeof o.id === "bigint"); + }, + isAmino(o: any): o is GaugeByIDRequestAmino { + return o && (o.$typeUrl === GaugeByIDRequest.typeUrl || typeof o.id === "bigint"); + }, encode(message: GaugeByIDRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.id !== BigInt(0)) { writer.uint32(8).uint64(message.id); @@ -910,7 +945,8 @@ export const GaugeByIDRequest = { typeUrl: "/osmosis.incentives.GaugeByIDRequest", value: GaugeByIDRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseGaugeByIDResponse(): GaugeByIDResponse { return { @@ -925,6 +961,15 @@ function createBaseGaugeByIDResponse(): GaugeByIDResponse { export const GaugeByIDResponse = { typeUrl: "/osmosis.incentives.GaugeByIDResponse", aminoType: "osmosis/incentives/gauge-by-id-response", + is(o: any): o is GaugeByIDResponse { + return o && o.$typeUrl === GaugeByIDResponse.typeUrl; + }, + isSDK(o: any): o is GaugeByIDResponseSDKType { + return o && o.$typeUrl === GaugeByIDResponse.typeUrl; + }, + isAmino(o: any): o is GaugeByIDResponseAmino { + return o && o.$typeUrl === GaugeByIDResponse.typeUrl; + }, encode(message: GaugeByIDResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.gauge !== undefined) { Gauge.encode(message.gauge, writer.uint32(10).fork()).ldelim(); @@ -993,6 +1038,12 @@ export const GaugeByIDResponse = { typeUrl: "/osmosis.incentives.GaugeByIDResponse", value: GaugeByIDResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GaugeByIDResponse.typeUrl)) { + return; + } + Gauge.registerTypeUrl(); } }; function createBaseGaugesRequest(): GaugesRequest { @@ -1008,6 +1059,15 @@ function createBaseGaugesRequest(): GaugesRequest { export const GaugesRequest = { typeUrl: "/osmosis.incentives.GaugesRequest", aminoType: "osmosis/incentives/gauges-request", + is(o: any): o is GaugesRequest { + return o && o.$typeUrl === GaugesRequest.typeUrl; + }, + isSDK(o: any): o is GaugesRequestSDKType { + return o && o.$typeUrl === GaugesRequest.typeUrl; + }, + isAmino(o: any): o is GaugesRequestAmino { + return o && o.$typeUrl === GaugesRequest.typeUrl; + }, encode(message: GaugesRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.pagination !== undefined) { PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); @@ -1076,6 +1136,12 @@ export const GaugesRequest = { typeUrl: "/osmosis.incentives.GaugesRequest", value: GaugesRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GaugesRequest.typeUrl)) { + return; + } + PageRequest.registerTypeUrl(); } }; function createBaseGaugesResponse(): GaugesResponse { @@ -1092,6 +1158,15 @@ function createBaseGaugesResponse(): GaugesResponse { export const GaugesResponse = { typeUrl: "/osmosis.incentives.GaugesResponse", aminoType: "osmosis/incentives/gauges-response", + is(o: any): o is GaugesResponse { + return o && (o.$typeUrl === GaugesResponse.typeUrl || Array.isArray(o.data) && (!o.data.length || Gauge.is(o.data[0]))); + }, + isSDK(o: any): o is GaugesResponseSDKType { + return o && (o.$typeUrl === GaugesResponse.typeUrl || Array.isArray(o.data) && (!o.data.length || Gauge.isSDK(o.data[0]))); + }, + isAmino(o: any): o is GaugesResponseAmino { + return o && (o.$typeUrl === GaugesResponse.typeUrl || Array.isArray(o.data) && (!o.data.length || Gauge.isAmino(o.data[0]))); + }, encode(message: GaugesResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.data) { Gauge.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -1180,6 +1255,13 @@ export const GaugesResponse = { typeUrl: "/osmosis.incentives.GaugesResponse", value: GaugesResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GaugesResponse.typeUrl)) { + return; + } + Gauge.registerTypeUrl(); + PageResponse.registerTypeUrl(); } }; function createBaseActiveGaugesRequest(): ActiveGaugesRequest { @@ -1195,6 +1277,15 @@ function createBaseActiveGaugesRequest(): ActiveGaugesRequest { export const ActiveGaugesRequest = { typeUrl: "/osmosis.incentives.ActiveGaugesRequest", aminoType: "osmosis/incentives/active-gauges-request", + is(o: any): o is ActiveGaugesRequest { + return o && o.$typeUrl === ActiveGaugesRequest.typeUrl; + }, + isSDK(o: any): o is ActiveGaugesRequestSDKType { + return o && o.$typeUrl === ActiveGaugesRequest.typeUrl; + }, + isAmino(o: any): o is ActiveGaugesRequestAmino { + return o && o.$typeUrl === ActiveGaugesRequest.typeUrl; + }, encode(message: ActiveGaugesRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.pagination !== undefined) { PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); @@ -1263,6 +1354,12 @@ export const ActiveGaugesRequest = { typeUrl: "/osmosis.incentives.ActiveGaugesRequest", value: ActiveGaugesRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ActiveGaugesRequest.typeUrl)) { + return; + } + PageRequest.registerTypeUrl(); } }; function createBaseActiveGaugesResponse(): ActiveGaugesResponse { @@ -1279,6 +1376,15 @@ function createBaseActiveGaugesResponse(): ActiveGaugesResponse { export const ActiveGaugesResponse = { typeUrl: "/osmosis.incentives.ActiveGaugesResponse", aminoType: "osmosis/incentives/active-gauges-response", + is(o: any): o is ActiveGaugesResponse { + return o && (o.$typeUrl === ActiveGaugesResponse.typeUrl || Array.isArray(o.data) && (!o.data.length || Gauge.is(o.data[0]))); + }, + isSDK(o: any): o is ActiveGaugesResponseSDKType { + return o && (o.$typeUrl === ActiveGaugesResponse.typeUrl || Array.isArray(o.data) && (!o.data.length || Gauge.isSDK(o.data[0]))); + }, + isAmino(o: any): o is ActiveGaugesResponseAmino { + return o && (o.$typeUrl === ActiveGaugesResponse.typeUrl || Array.isArray(o.data) && (!o.data.length || Gauge.isAmino(o.data[0]))); + }, encode(message: ActiveGaugesResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.data) { Gauge.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -1367,6 +1473,13 @@ export const ActiveGaugesResponse = { typeUrl: "/osmosis.incentives.ActiveGaugesResponse", value: ActiveGaugesResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ActiveGaugesResponse.typeUrl)) { + return; + } + Gauge.registerTypeUrl(); + PageResponse.registerTypeUrl(); } }; function createBaseActiveGaugesPerDenomRequest(): ActiveGaugesPerDenomRequest { @@ -1383,6 +1496,15 @@ function createBaseActiveGaugesPerDenomRequest(): ActiveGaugesPerDenomRequest { export const ActiveGaugesPerDenomRequest = { typeUrl: "/osmosis.incentives.ActiveGaugesPerDenomRequest", aminoType: "osmosis/incentives/active-gauges-per-denom-request", + is(o: any): o is ActiveGaugesPerDenomRequest { + return o && (o.$typeUrl === ActiveGaugesPerDenomRequest.typeUrl || typeof o.denom === "string"); + }, + isSDK(o: any): o is ActiveGaugesPerDenomRequestSDKType { + return o && (o.$typeUrl === ActiveGaugesPerDenomRequest.typeUrl || typeof o.denom === "string"); + }, + isAmino(o: any): o is ActiveGaugesPerDenomRequestAmino { + return o && (o.$typeUrl === ActiveGaugesPerDenomRequest.typeUrl || typeof o.denom === "string"); + }, encode(message: ActiveGaugesPerDenomRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.denom !== "") { writer.uint32(10).string(message.denom); @@ -1465,6 +1587,12 @@ export const ActiveGaugesPerDenomRequest = { typeUrl: "/osmosis.incentives.ActiveGaugesPerDenomRequest", value: ActiveGaugesPerDenomRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ActiveGaugesPerDenomRequest.typeUrl)) { + return; + } + PageRequest.registerTypeUrl(); } }; function createBaseActiveGaugesPerDenomResponse(): ActiveGaugesPerDenomResponse { @@ -1481,6 +1609,15 @@ function createBaseActiveGaugesPerDenomResponse(): ActiveGaugesPerDenomResponse export const ActiveGaugesPerDenomResponse = { typeUrl: "/osmosis.incentives.ActiveGaugesPerDenomResponse", aminoType: "osmosis/incentives/active-gauges-per-denom-response", + is(o: any): o is ActiveGaugesPerDenomResponse { + return o && (o.$typeUrl === ActiveGaugesPerDenomResponse.typeUrl || Array.isArray(o.data) && (!o.data.length || Gauge.is(o.data[0]))); + }, + isSDK(o: any): o is ActiveGaugesPerDenomResponseSDKType { + return o && (o.$typeUrl === ActiveGaugesPerDenomResponse.typeUrl || Array.isArray(o.data) && (!o.data.length || Gauge.isSDK(o.data[0]))); + }, + isAmino(o: any): o is ActiveGaugesPerDenomResponseAmino { + return o && (o.$typeUrl === ActiveGaugesPerDenomResponse.typeUrl || Array.isArray(o.data) && (!o.data.length || Gauge.isAmino(o.data[0]))); + }, encode(message: ActiveGaugesPerDenomResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.data) { Gauge.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -1569,6 +1706,13 @@ export const ActiveGaugesPerDenomResponse = { typeUrl: "/osmosis.incentives.ActiveGaugesPerDenomResponse", value: ActiveGaugesPerDenomResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ActiveGaugesPerDenomResponse.typeUrl)) { + return; + } + Gauge.registerTypeUrl(); + PageResponse.registerTypeUrl(); } }; function createBaseUpcomingGaugesRequest(): UpcomingGaugesRequest { @@ -1584,6 +1728,15 @@ function createBaseUpcomingGaugesRequest(): UpcomingGaugesRequest { export const UpcomingGaugesRequest = { typeUrl: "/osmosis.incentives.UpcomingGaugesRequest", aminoType: "osmosis/incentives/upcoming-gauges-request", + is(o: any): o is UpcomingGaugesRequest { + return o && o.$typeUrl === UpcomingGaugesRequest.typeUrl; + }, + isSDK(o: any): o is UpcomingGaugesRequestSDKType { + return o && o.$typeUrl === UpcomingGaugesRequest.typeUrl; + }, + isAmino(o: any): o is UpcomingGaugesRequestAmino { + return o && o.$typeUrl === UpcomingGaugesRequest.typeUrl; + }, encode(message: UpcomingGaugesRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.pagination !== undefined) { PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); @@ -1652,6 +1805,12 @@ export const UpcomingGaugesRequest = { typeUrl: "/osmosis.incentives.UpcomingGaugesRequest", value: UpcomingGaugesRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(UpcomingGaugesRequest.typeUrl)) { + return; + } + PageRequest.registerTypeUrl(); } }; function createBaseUpcomingGaugesResponse(): UpcomingGaugesResponse { @@ -1668,6 +1827,15 @@ function createBaseUpcomingGaugesResponse(): UpcomingGaugesResponse { export const UpcomingGaugesResponse = { typeUrl: "/osmosis.incentives.UpcomingGaugesResponse", aminoType: "osmosis/incentives/upcoming-gauges-response", + is(o: any): o is UpcomingGaugesResponse { + return o && (o.$typeUrl === UpcomingGaugesResponse.typeUrl || Array.isArray(o.data) && (!o.data.length || Gauge.is(o.data[0]))); + }, + isSDK(o: any): o is UpcomingGaugesResponseSDKType { + return o && (o.$typeUrl === UpcomingGaugesResponse.typeUrl || Array.isArray(o.data) && (!o.data.length || Gauge.isSDK(o.data[0]))); + }, + isAmino(o: any): o is UpcomingGaugesResponseAmino { + return o && (o.$typeUrl === UpcomingGaugesResponse.typeUrl || Array.isArray(o.data) && (!o.data.length || Gauge.isAmino(o.data[0]))); + }, encode(message: UpcomingGaugesResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.data) { Gauge.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -1756,6 +1924,13 @@ export const UpcomingGaugesResponse = { typeUrl: "/osmosis.incentives.UpcomingGaugesResponse", value: UpcomingGaugesResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(UpcomingGaugesResponse.typeUrl)) { + return; + } + Gauge.registerTypeUrl(); + PageResponse.registerTypeUrl(); } }; function createBaseUpcomingGaugesPerDenomRequest(): UpcomingGaugesPerDenomRequest { @@ -1772,6 +1947,15 @@ function createBaseUpcomingGaugesPerDenomRequest(): UpcomingGaugesPerDenomReques export const UpcomingGaugesPerDenomRequest = { typeUrl: "/osmosis.incentives.UpcomingGaugesPerDenomRequest", aminoType: "osmosis/incentives/upcoming-gauges-per-denom-request", + is(o: any): o is UpcomingGaugesPerDenomRequest { + return o && (o.$typeUrl === UpcomingGaugesPerDenomRequest.typeUrl || typeof o.denom === "string"); + }, + isSDK(o: any): o is UpcomingGaugesPerDenomRequestSDKType { + return o && (o.$typeUrl === UpcomingGaugesPerDenomRequest.typeUrl || typeof o.denom === "string"); + }, + isAmino(o: any): o is UpcomingGaugesPerDenomRequestAmino { + return o && (o.$typeUrl === UpcomingGaugesPerDenomRequest.typeUrl || typeof o.denom === "string"); + }, encode(message: UpcomingGaugesPerDenomRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.denom !== "") { writer.uint32(10).string(message.denom); @@ -1854,6 +2038,12 @@ export const UpcomingGaugesPerDenomRequest = { typeUrl: "/osmosis.incentives.UpcomingGaugesPerDenomRequest", value: UpcomingGaugesPerDenomRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(UpcomingGaugesPerDenomRequest.typeUrl)) { + return; + } + PageRequest.registerTypeUrl(); } }; function createBaseUpcomingGaugesPerDenomResponse(): UpcomingGaugesPerDenomResponse { @@ -1870,6 +2060,15 @@ function createBaseUpcomingGaugesPerDenomResponse(): UpcomingGaugesPerDenomRespo export const UpcomingGaugesPerDenomResponse = { typeUrl: "/osmosis.incentives.UpcomingGaugesPerDenomResponse", aminoType: "osmosis/incentives/upcoming-gauges-per-denom-response", + is(o: any): o is UpcomingGaugesPerDenomResponse { + return o && (o.$typeUrl === UpcomingGaugesPerDenomResponse.typeUrl || Array.isArray(o.upcomingGauges) && (!o.upcomingGauges.length || Gauge.is(o.upcomingGauges[0]))); + }, + isSDK(o: any): o is UpcomingGaugesPerDenomResponseSDKType { + return o && (o.$typeUrl === UpcomingGaugesPerDenomResponse.typeUrl || Array.isArray(o.upcoming_gauges) && (!o.upcoming_gauges.length || Gauge.isSDK(o.upcoming_gauges[0]))); + }, + isAmino(o: any): o is UpcomingGaugesPerDenomResponseAmino { + return o && (o.$typeUrl === UpcomingGaugesPerDenomResponse.typeUrl || Array.isArray(o.upcoming_gauges) && (!o.upcoming_gauges.length || Gauge.isAmino(o.upcoming_gauges[0]))); + }, encode(message: UpcomingGaugesPerDenomResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.upcomingGauges) { Gauge.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -1958,6 +2157,13 @@ export const UpcomingGaugesPerDenomResponse = { typeUrl: "/osmosis.incentives.UpcomingGaugesPerDenomResponse", value: UpcomingGaugesPerDenomResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(UpcomingGaugesPerDenomResponse.typeUrl)) { + return; + } + Gauge.registerTypeUrl(); + PageResponse.registerTypeUrl(); } }; function createBaseRewardsEstRequest(): RewardsEstRequest { @@ -1975,6 +2181,15 @@ function createBaseRewardsEstRequest(): RewardsEstRequest { export const RewardsEstRequest = { typeUrl: "/osmosis.incentives.RewardsEstRequest", aminoType: "osmosis/incentives/rewards-est-request", + is(o: any): o is RewardsEstRequest { + return o && (o.$typeUrl === RewardsEstRequest.typeUrl || typeof o.owner === "string" && Array.isArray(o.lockIds) && (!o.lockIds.length || typeof o.lockIds[0] === "bigint") && typeof o.endEpoch === "bigint"); + }, + isSDK(o: any): o is RewardsEstRequestSDKType { + return o && (o.$typeUrl === RewardsEstRequest.typeUrl || typeof o.owner === "string" && Array.isArray(o.lock_ids) && (!o.lock_ids.length || typeof o.lock_ids[0] === "bigint") && typeof o.end_epoch === "bigint"); + }, + isAmino(o: any): o is RewardsEstRequestAmino { + return o && (o.$typeUrl === RewardsEstRequest.typeUrl || typeof o.owner === "string" && Array.isArray(o.lock_ids) && (!o.lock_ids.length || typeof o.lock_ids[0] === "bigint") && typeof o.end_epoch === "bigint"); + }, encode(message: RewardsEstRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.owner !== "") { writer.uint32(10).string(message.owner); @@ -2086,7 +2301,8 @@ export const RewardsEstRequest = { typeUrl: "/osmosis.incentives.RewardsEstRequest", value: RewardsEstRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseRewardsEstResponse(): RewardsEstResponse { return { @@ -2101,6 +2317,15 @@ function createBaseRewardsEstResponse(): RewardsEstResponse { export const RewardsEstResponse = { typeUrl: "/osmosis.incentives.RewardsEstResponse", aminoType: "osmosis/incentives/rewards-est-response", + is(o: any): o is RewardsEstResponse { + return o && (o.$typeUrl === RewardsEstResponse.typeUrl || Array.isArray(o.coins) && (!o.coins.length || Coin.is(o.coins[0]))); + }, + isSDK(o: any): o is RewardsEstResponseSDKType { + return o && (o.$typeUrl === RewardsEstResponse.typeUrl || Array.isArray(o.coins) && (!o.coins.length || Coin.isSDK(o.coins[0]))); + }, + isAmino(o: any): o is RewardsEstResponseAmino { + return o && (o.$typeUrl === RewardsEstResponse.typeUrl || Array.isArray(o.coins) && (!o.coins.length || Coin.isAmino(o.coins[0]))); + }, encode(message: RewardsEstResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.coins) { Coin.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -2173,6 +2398,12 @@ export const RewardsEstResponse = { typeUrl: "/osmosis.incentives.RewardsEstResponse", value: RewardsEstResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(RewardsEstResponse.typeUrl)) { + return; + } + Coin.registerTypeUrl(); } }; function createBaseQueryLockableDurationsRequest(): QueryLockableDurationsRequest { @@ -2186,6 +2417,15 @@ function createBaseQueryLockableDurationsRequest(): QueryLockableDurationsReques export const QueryLockableDurationsRequest = { typeUrl: "/osmosis.incentives.QueryLockableDurationsRequest", aminoType: "osmosis/incentives/query-lockable-durations-request", + is(o: any): o is QueryLockableDurationsRequest { + return o && o.$typeUrl === QueryLockableDurationsRequest.typeUrl; + }, + isSDK(o: any): o is QueryLockableDurationsRequestSDKType { + return o && o.$typeUrl === QueryLockableDurationsRequest.typeUrl; + }, + isAmino(o: any): o is QueryLockableDurationsRequestAmino { + return o && o.$typeUrl === QueryLockableDurationsRequest.typeUrl; + }, encode(_: QueryLockableDurationsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -2237,7 +2477,8 @@ export const QueryLockableDurationsRequest = { typeUrl: "/osmosis.incentives.QueryLockableDurationsRequest", value: QueryLockableDurationsRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryLockableDurationsResponse(): QueryLockableDurationsResponse { return { @@ -2252,6 +2493,15 @@ function createBaseQueryLockableDurationsResponse(): QueryLockableDurationsRespo export const QueryLockableDurationsResponse = { typeUrl: "/osmosis.incentives.QueryLockableDurationsResponse", aminoType: "osmosis/incentives/query-lockable-durations-response", + is(o: any): o is QueryLockableDurationsResponse { + return o && (o.$typeUrl === QueryLockableDurationsResponse.typeUrl || Array.isArray(o.lockableDurations) && (!o.lockableDurations.length || Duration.is(o.lockableDurations[0]))); + }, + isSDK(o: any): o is QueryLockableDurationsResponseSDKType { + return o && (o.$typeUrl === QueryLockableDurationsResponse.typeUrl || Array.isArray(o.lockable_durations) && (!o.lockable_durations.length || Duration.isSDK(o.lockable_durations[0]))); + }, + isAmino(o: any): o is QueryLockableDurationsResponseAmino { + return o && (o.$typeUrl === QueryLockableDurationsResponse.typeUrl || Array.isArray(o.lockable_durations) && (!o.lockable_durations.length || Duration.isAmino(o.lockable_durations[0]))); + }, encode(message: QueryLockableDurationsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.lockableDurations) { Duration.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -2324,5 +2574,6 @@ export const QueryLockableDurationsResponse = { typeUrl: "/osmosis.incentives.QueryLockableDurationsResponse", value: QueryLockableDurationsResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/osmosis/incentives/tx.registry.ts b/__fixtures__/v-next/outputv3/osmosis/incentives/tx.registry.ts index a66e732720..ea2fa074a4 100644 --- a/__fixtures__/v-next/outputv3/osmosis/incentives/tx.registry.ts +++ b/__fixtures__/v-next/outputv3/osmosis/incentives/tx.registry.ts @@ -1,14 +1,9 @@ import { QueryCondition, QueryConditionSDKType } from "../lockup/lock"; import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; import { Timestamp, TimestampSDKType } from "../../google/protobuf/timestamp"; -import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { TelescopeGeneratedType } from "../../types"; import { MsgCreateGauge, MsgCreateGaugeSDKType, MsgAddToGauge, MsgAddToGaugeSDKType } from "./tx"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/osmosis.incentives.MsgCreateGauge", MsgCreateGauge], ["/osmosis.incentives.MsgAddToGauge", MsgAddToGauge]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/osmosis.incentives.MsgCreateGauge", MsgCreateGauge], ["/osmosis.incentives.MsgAddToGauge", MsgAddToGauge]]; export const MessageComposer = { encoded: { createGauge(value: MsgCreateGauge) { diff --git a/__fixtures__/v-next/outputv3/osmosis/incentives/tx.rpc.func.ts b/__fixtures__/v-next/outputv3/osmosis/incentives/tx.rpc.func.ts new file mode 100644 index 0000000000..6c5516e08b --- /dev/null +++ b/__fixtures__/v-next/outputv3/osmosis/incentives/tx.rpc.func.ts @@ -0,0 +1,21 @@ +import { QueryCondition, QueryConditionSDKType } from "../lockup/lock"; +import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; +import { Timestamp, TimestampSDKType } from "../../google/protobuf/timestamp"; +import { buildTx } from "../../helper-func-types"; +import { MsgCreateGauge, MsgCreateGaugeSDKType, MsgCreateGaugeResponse, MsgCreateGaugeResponseSDKType, MsgAddToGauge, MsgAddToGaugeSDKType, MsgAddToGaugeResponse, MsgAddToGaugeResponseSDKType } from "./tx"; +/** + * @name createGauge + * @package osmosis.incentives + * @see proto service: osmosis.incentives.CreateGauge + */ +export const createGauge = buildTx({ + msg: MsgCreateGauge +}); +/** + * @name addToGauge + * @package osmosis.incentives + * @see proto service: osmosis.incentives.AddToGauge + */ +export const addToGauge = buildTx({ + msg: MsgAddToGauge +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/osmosis/incentives/tx.ts b/__fixtures__/v-next/outputv3/osmosis/incentives/tx.ts index 06834ddec1..2ff045e393 100644 --- a/__fixtures__/v-next/outputv3/osmosis/incentives/tx.ts +++ b/__fixtures__/v-next/outputv3/osmosis/incentives/tx.ts @@ -2,6 +2,7 @@ import { QueryCondition, QueryConditionAmino, QueryConditionSDKType } from "../l import { Coin, CoinAmino, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; import { Timestamp, TimestampAmino, TimestampSDKType } from "../../google/protobuf/timestamp"; import { BinaryReader, BinaryWriter } from "../../binary"; +import { GlobalDecoderRegistry } from "../../registry"; import { toTimestamp, fromTimestamp, isSet, DeepPartial } from "../../helpers"; export const protobufPackage = "osmosis.incentives"; /** @@ -216,6 +217,15 @@ function createBaseMsgCreateGauge(): MsgCreateGauge { export const MsgCreateGauge = { typeUrl: "/osmosis.incentives.MsgCreateGauge", aminoType: "osmosis/incentives/create-gauge", + is(o: any): o is MsgCreateGauge { + return o && (o.$typeUrl === MsgCreateGauge.typeUrl || typeof o.isPerpetual === "boolean" && typeof o.owner === "string" && QueryCondition.is(o.distributeTo) && Array.isArray(o.coins) && (!o.coins.length || Coin.is(o.coins[0])) && Timestamp.is(o.startTime) && typeof o.numEpochsPaidOver === "bigint"); + }, + isSDK(o: any): o is MsgCreateGaugeSDKType { + return o && (o.$typeUrl === MsgCreateGauge.typeUrl || typeof o.is_perpetual === "boolean" && typeof o.owner === "string" && QueryCondition.isSDK(o.distribute_to) && Array.isArray(o.coins) && (!o.coins.length || Coin.isSDK(o.coins[0])) && Timestamp.isSDK(o.start_time) && typeof o.num_epochs_paid_over === "bigint"); + }, + isAmino(o: any): o is MsgCreateGaugeAmino { + return o && (o.$typeUrl === MsgCreateGauge.typeUrl || typeof o.is_perpetual === "boolean" && typeof o.owner === "string" && QueryCondition.isAmino(o.distribute_to) && Array.isArray(o.coins) && (!o.coins.length || Coin.isAmino(o.coins[0])) && Timestamp.isAmino(o.start_time) && typeof o.num_epochs_paid_over === "bigint"); + }, encode(message: MsgCreateGauge, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.isPerpetual === true) { writer.uint32(8).bool(message.isPerpetual); @@ -362,6 +372,13 @@ export const MsgCreateGauge = { typeUrl: "/osmosis.incentives.MsgCreateGauge", value: MsgCreateGauge.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgCreateGauge.typeUrl)) { + return; + } + QueryCondition.registerTypeUrl(); + Coin.registerTypeUrl(); } }; function createBaseMsgCreateGaugeResponse(): MsgCreateGaugeResponse { @@ -375,6 +392,15 @@ function createBaseMsgCreateGaugeResponse(): MsgCreateGaugeResponse { export const MsgCreateGaugeResponse = { typeUrl: "/osmosis.incentives.MsgCreateGaugeResponse", aminoType: "osmosis/incentives/create-gauge-response", + is(o: any): o is MsgCreateGaugeResponse { + return o && o.$typeUrl === MsgCreateGaugeResponse.typeUrl; + }, + isSDK(o: any): o is MsgCreateGaugeResponseSDKType { + return o && o.$typeUrl === MsgCreateGaugeResponse.typeUrl; + }, + isAmino(o: any): o is MsgCreateGaugeResponseAmino { + return o && o.$typeUrl === MsgCreateGaugeResponse.typeUrl; + }, encode(_: MsgCreateGaugeResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -426,7 +452,8 @@ export const MsgCreateGaugeResponse = { typeUrl: "/osmosis.incentives.MsgCreateGaugeResponse", value: MsgCreateGaugeResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgAddToGauge(): MsgAddToGauge { return { @@ -444,6 +471,15 @@ function createBaseMsgAddToGauge(): MsgAddToGauge { export const MsgAddToGauge = { typeUrl: "/osmosis.incentives.MsgAddToGauge", aminoType: "osmosis/incentives/add-to-gauge", + is(o: any): o is MsgAddToGauge { + return o && (o.$typeUrl === MsgAddToGauge.typeUrl || typeof o.owner === "string" && typeof o.gaugeId === "bigint" && Array.isArray(o.rewards) && (!o.rewards.length || Coin.is(o.rewards[0]))); + }, + isSDK(o: any): o is MsgAddToGaugeSDKType { + return o && (o.$typeUrl === MsgAddToGauge.typeUrl || typeof o.owner === "string" && typeof o.gauge_id === "bigint" && Array.isArray(o.rewards) && (!o.rewards.length || Coin.isSDK(o.rewards[0]))); + }, + isAmino(o: any): o is MsgAddToGaugeAmino { + return o && (o.$typeUrl === MsgAddToGauge.typeUrl || typeof o.owner === "string" && typeof o.gauge_id === "bigint" && Array.isArray(o.rewards) && (!o.rewards.length || Coin.isAmino(o.rewards[0]))); + }, encode(message: MsgAddToGauge, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.owner !== "") { writer.uint32(10).string(message.owner); @@ -546,6 +582,12 @@ export const MsgAddToGauge = { typeUrl: "/osmosis.incentives.MsgAddToGauge", value: MsgAddToGauge.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgAddToGauge.typeUrl)) { + return; + } + Coin.registerTypeUrl(); } }; function createBaseMsgAddToGaugeResponse(): MsgAddToGaugeResponse { @@ -559,6 +601,15 @@ function createBaseMsgAddToGaugeResponse(): MsgAddToGaugeResponse { export const MsgAddToGaugeResponse = { typeUrl: "/osmosis.incentives.MsgAddToGaugeResponse", aminoType: "osmosis/incentives/add-to-gauge-response", + is(o: any): o is MsgAddToGaugeResponse { + return o && o.$typeUrl === MsgAddToGaugeResponse.typeUrl; + }, + isSDK(o: any): o is MsgAddToGaugeResponseSDKType { + return o && o.$typeUrl === MsgAddToGaugeResponse.typeUrl; + }, + isAmino(o: any): o is MsgAddToGaugeResponseAmino { + return o && o.$typeUrl === MsgAddToGaugeResponse.typeUrl; + }, encode(_: MsgAddToGaugeResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -610,5 +661,6 @@ export const MsgAddToGaugeResponse = { typeUrl: "/osmosis.incentives.MsgAddToGaugeResponse", value: MsgAddToGaugeResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/osmosis/lockup/genesis.ts b/__fixtures__/v-next/outputv3/osmosis/lockup/genesis.ts index f7f236dcc9..f9bd073f56 100644 --- a/__fixtures__/v-next/outputv3/osmosis/lockup/genesis.ts +++ b/__fixtures__/v-next/outputv3/osmosis/lockup/genesis.ts @@ -1,6 +1,7 @@ import { PeriodLock, PeriodLockAmino, PeriodLockSDKType, SyntheticLock, SyntheticLockAmino, SyntheticLockSDKType } from "./lock"; import { BinaryReader, BinaryWriter } from "../../binary"; import { isSet, DeepPartial } from "../../helpers"; +import { GlobalDecoderRegistry } from "../../registry"; export const protobufPackage = "osmosis.lockup"; /** * GenesisState defines the lockup module's genesis state. @@ -55,6 +56,15 @@ function createBaseGenesisState(): GenesisState { export const GenesisState = { typeUrl: "/osmosis.lockup.GenesisState", aminoType: "osmosis/lockup/genesis-state", + is(o: any): o is GenesisState { + return o && (o.$typeUrl === GenesisState.typeUrl || typeof o.lastLockId === "bigint" && Array.isArray(o.locks) && (!o.locks.length || PeriodLock.is(o.locks[0])) && Array.isArray(o.syntheticLocks) && (!o.syntheticLocks.length || SyntheticLock.is(o.syntheticLocks[0]))); + }, + isSDK(o: any): o is GenesisStateSDKType { + return o && (o.$typeUrl === GenesisState.typeUrl || typeof o.last_lock_id === "bigint" && Array.isArray(o.locks) && (!o.locks.length || PeriodLock.isSDK(o.locks[0])) && Array.isArray(o.synthetic_locks) && (!o.synthetic_locks.length || SyntheticLock.isSDK(o.synthetic_locks[0]))); + }, + isAmino(o: any): o is GenesisStateAmino { + return o && (o.$typeUrl === GenesisState.typeUrl || typeof o.last_lock_id === "bigint" && Array.isArray(o.locks) && (!o.locks.length || PeriodLock.isAmino(o.locks[0])) && Array.isArray(o.synthetic_locks) && (!o.synthetic_locks.length || SyntheticLock.isAmino(o.synthetic_locks[0]))); + }, encode(message: GenesisState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.lastLockId !== BigInt(0)) { writer.uint32(8).uint64(message.lastLockId); @@ -163,5 +173,12 @@ export const GenesisState = { typeUrl: "/osmosis.lockup.GenesisState", value: GenesisState.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GenesisState.typeUrl)) { + return; + } + PeriodLock.registerTypeUrl(); + SyntheticLock.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/osmosis/lockup/lock.ts b/__fixtures__/v-next/outputv3/osmosis/lockup/lock.ts index 1c4b643cd4..100af3a112 100644 --- a/__fixtures__/v-next/outputv3/osmosis/lockup/lock.ts +++ b/__fixtures__/v-next/outputv3/osmosis/lockup/lock.ts @@ -2,6 +2,7 @@ import { Duration, DurationAmino, DurationSDKType } from "../../google/protobuf/ import { Timestamp, TimestampAmino, TimestampSDKType } from "../../google/protobuf/timestamp"; import { Coin, CoinAmino, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../binary"; +import { GlobalDecoderRegistry } from "../../registry"; import { toTimestamp, fromTimestamp, isSet, DeepPartial } from "../../helpers"; export const protobufPackage = "osmosis.lockup"; /** @@ -318,6 +319,15 @@ function createBasePeriodLock(): PeriodLock { export const PeriodLock = { typeUrl: "/osmosis.lockup.PeriodLock", aminoType: "osmosis/lockup/period-lock", + is(o: any): o is PeriodLock { + return o && (o.$typeUrl === PeriodLock.typeUrl || typeof o.iD === "bigint" && typeof o.owner === "string" && Duration.is(o.duration) && Timestamp.is(o.endTime) && Array.isArray(o.coins) && (!o.coins.length || Coin.is(o.coins[0]))); + }, + isSDK(o: any): o is PeriodLockSDKType { + return o && (o.$typeUrl === PeriodLock.typeUrl || typeof o.ID === "bigint" && typeof o.owner === "string" && Duration.isSDK(o.duration) && Timestamp.isSDK(o.end_time) && Array.isArray(o.coins) && (!o.coins.length || Coin.isSDK(o.coins[0]))); + }, + isAmino(o: any): o is PeriodLockAmino { + return o && (o.$typeUrl === PeriodLock.typeUrl || typeof o.ID === "bigint" && typeof o.owner === "string" && Duration.isAmino(o.duration) && Timestamp.isAmino(o.end_time) && Array.isArray(o.coins) && (!o.coins.length || Coin.isAmino(o.coins[0]))); + }, encode(message: PeriodLock, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.iD !== BigInt(0)) { writer.uint32(8).uint64(message.iD); @@ -450,6 +460,12 @@ export const PeriodLock = { typeUrl: "/osmosis.lockup.PeriodLock", value: PeriodLock.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(PeriodLock.typeUrl)) { + return; + } + Coin.registerTypeUrl(); } }; function createBaseQueryCondition(): QueryCondition { @@ -471,6 +487,15 @@ function createBaseQueryCondition(): QueryCondition { export const QueryCondition = { typeUrl: "/osmosis.lockup.QueryCondition", aminoType: "osmosis/lockup/query-condition", + is(o: any): o is QueryCondition { + return o && (o.$typeUrl === QueryCondition.typeUrl || isSet(o.lockQueryType) && typeof o.denom === "string" && Duration.is(o.duration) && Timestamp.is(o.timestamp)); + }, + isSDK(o: any): o is QueryConditionSDKType { + return o && (o.$typeUrl === QueryCondition.typeUrl || isSet(o.lock_query_type) && typeof o.denom === "string" && Duration.isSDK(o.duration) && Timestamp.isSDK(o.timestamp)); + }, + isAmino(o: any): o is QueryConditionAmino { + return o && (o.$typeUrl === QueryCondition.typeUrl || isSet(o.lock_query_type) && typeof o.denom === "string" && Duration.isAmino(o.duration) && Timestamp.isAmino(o.timestamp)); + }, encode(message: QueryCondition, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.lockQueryType !== 0) { writer.uint32(8).int32(message.lockQueryType); @@ -581,7 +606,8 @@ export const QueryCondition = { typeUrl: "/osmosis.lockup.QueryCondition", value: QueryCondition.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseSyntheticLock(): SyntheticLock { return { @@ -603,6 +629,15 @@ function createBaseSyntheticLock(): SyntheticLock { export const SyntheticLock = { typeUrl: "/osmosis.lockup.SyntheticLock", aminoType: "osmosis/lockup/synthetic-lock", + is(o: any): o is SyntheticLock { + return o && (o.$typeUrl === SyntheticLock.typeUrl || typeof o.underlyingLockId === "bigint" && typeof o.synthDenom === "string" && Timestamp.is(o.endTime) && Duration.is(o.duration)); + }, + isSDK(o: any): o is SyntheticLockSDKType { + return o && (o.$typeUrl === SyntheticLock.typeUrl || typeof o.underlying_lock_id === "bigint" && typeof o.synth_denom === "string" && Timestamp.isSDK(o.end_time) && Duration.isSDK(o.duration)); + }, + isAmino(o: any): o is SyntheticLockAmino { + return o && (o.$typeUrl === SyntheticLock.typeUrl || typeof o.underlying_lock_id === "bigint" && typeof o.synth_denom === "string" && Timestamp.isAmino(o.end_time) && Duration.isAmino(o.duration)); + }, encode(message: SyntheticLock, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.underlyingLockId !== BigInt(0)) { writer.uint32(8).uint64(message.underlyingLockId); @@ -715,5 +750,6 @@ export const SyntheticLock = { typeUrl: "/osmosis.lockup.SyntheticLock", value: SyntheticLock.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/osmosis/lockup/params.ts b/__fixtures__/v-next/outputv3/osmosis/lockup/params.ts index d2f4f3c82a..e2a1aa9b04 100644 --- a/__fixtures__/v-next/outputv3/osmosis/lockup/params.ts +++ b/__fixtures__/v-next/outputv3/osmosis/lockup/params.ts @@ -42,6 +42,15 @@ function createBaseParams(): Params { export const Params = { typeUrl: "/osmosis.lockup.Params", aminoType: "osmosis/lockup/params", + is(o: any): o is Params { + return o && (o.$typeUrl === Params.typeUrl || Array.isArray(o.forceUnlockAllowedAddresses) && (!o.forceUnlockAllowedAddresses.length || typeof o.forceUnlockAllowedAddresses[0] === "string")); + }, + isSDK(o: any): o is ParamsSDKType { + return o && (o.$typeUrl === Params.typeUrl || Array.isArray(o.force_unlock_allowed_addresses) && (!o.force_unlock_allowed_addresses.length || typeof o.force_unlock_allowed_addresses[0] === "string")); + }, + isAmino(o: any): o is ParamsAmino { + return o && (o.$typeUrl === Params.typeUrl || Array.isArray(o.force_unlock_allowed_addresses) && (!o.force_unlock_allowed_addresses.length || typeof o.force_unlock_allowed_addresses[0] === "string")); + }, encode(message: Params, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.forceUnlockAllowedAddresses) { writer.uint32(10).string(v!); @@ -114,5 +123,6 @@ export const Params = { typeUrl: "/osmosis.lockup.Params", value: Params.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/osmosis/lockup/query.rpc.func.ts b/__fixtures__/v-next/outputv3/osmosis/lockup/query.rpc.func.ts new file mode 100644 index 0000000000..8fcded17af --- /dev/null +++ b/__fixtures__/v-next/outputv3/osmosis/lockup/query.rpc.func.ts @@ -0,0 +1,230 @@ +import { Timestamp, TimestampSDKType } from "../../google/protobuf/timestamp"; +import { Duration, DurationSDKType } from "../../google/protobuf/duration"; +import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; +import { PeriodLock, PeriodLockSDKType, SyntheticLock, SyntheticLockSDKType } from "./lock"; +import { Params, ParamsSDKType } from "./params"; +import { EndpointOrRpc, buildQuery } from "../../helper-func-types"; +import { ModuleBalanceRequest, ModuleBalanceRequestSDKType, ModuleBalanceResponse, ModuleBalanceResponseSDKType, ModuleLockedAmountRequest, ModuleLockedAmountRequestSDKType, ModuleLockedAmountResponse, ModuleLockedAmountResponseSDKType, AccountUnlockableCoinsRequest, AccountUnlockableCoinsRequestSDKType, AccountUnlockableCoinsResponse, AccountUnlockableCoinsResponseSDKType, AccountUnlockingCoinsRequest, AccountUnlockingCoinsRequestSDKType, AccountUnlockingCoinsResponse, AccountUnlockingCoinsResponseSDKType, AccountLockedCoinsRequest, AccountLockedCoinsRequestSDKType, AccountLockedCoinsResponse, AccountLockedCoinsResponseSDKType, AccountLockedPastTimeRequest, AccountLockedPastTimeRequestSDKType, AccountLockedPastTimeResponse, AccountLockedPastTimeResponseSDKType, AccountLockedPastTimeNotUnlockingOnlyRequest, AccountLockedPastTimeNotUnlockingOnlyRequestSDKType, AccountLockedPastTimeNotUnlockingOnlyResponse, AccountLockedPastTimeNotUnlockingOnlyResponseSDKType, AccountUnlockedBeforeTimeRequest, AccountUnlockedBeforeTimeRequestSDKType, AccountUnlockedBeforeTimeResponse, AccountUnlockedBeforeTimeResponseSDKType, AccountLockedPastTimeDenomRequest, AccountLockedPastTimeDenomRequestSDKType, AccountLockedPastTimeDenomResponse, AccountLockedPastTimeDenomResponseSDKType, LockedDenomRequest, LockedDenomRequestSDKType, LockedDenomResponse, LockedDenomResponseSDKType, LockedRequest, LockedRequestSDKType, LockedResponse, LockedResponseSDKType, SyntheticLockupsByLockupIDRequest, SyntheticLockupsByLockupIDRequestSDKType, SyntheticLockupsByLockupIDResponse, SyntheticLockupsByLockupIDResponseSDKType, AccountLockedLongerDurationRequest, AccountLockedLongerDurationRequestSDKType, AccountLockedLongerDurationResponse, AccountLockedLongerDurationResponseSDKType, AccountLockedDurationRequest, AccountLockedDurationRequestSDKType, AccountLockedDurationResponse, AccountLockedDurationResponseSDKType, AccountLockedLongerDurationNotUnlockingOnlyRequest, AccountLockedLongerDurationNotUnlockingOnlyRequestSDKType, AccountLockedLongerDurationNotUnlockingOnlyResponse, AccountLockedLongerDurationNotUnlockingOnlyResponseSDKType, AccountLockedLongerDurationDenomRequest, AccountLockedLongerDurationDenomRequestSDKType, AccountLockedLongerDurationDenomResponse, AccountLockedLongerDurationDenomResponseSDKType, QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType } from "./query"; +/** + * Return full balance of the module + * @name getModuleBalance + * @package osmosis.lockup + * @see proto service: osmosis.lockup.ModuleBalance + */ +export const getModuleBalance = buildQuery({ + encode: ModuleBalanceRequest.encode, + decode: ModuleBalanceResponse.decode, + service: "osmosis.lockup.Query", + method: "ModuleBalance", + deps: [ModuleBalanceRequest, ModuleBalanceResponse] +}); +/** + * Return locked balance of the module + * @name getModuleLockedAmount + * @package osmosis.lockup + * @see proto service: osmosis.lockup.ModuleLockedAmount + */ +export const getModuleLockedAmount = buildQuery({ + encode: ModuleLockedAmountRequest.encode, + decode: ModuleLockedAmountResponse.decode, + service: "osmosis.lockup.Query", + method: "ModuleLockedAmount", + deps: [ModuleLockedAmountRequest, ModuleLockedAmountResponse] +}); +/** + * Returns unlockable coins which are not withdrawn yet + * @name getAccountUnlockableCoins + * @package osmosis.lockup + * @see proto service: osmosis.lockup.AccountUnlockableCoins + */ +export const getAccountUnlockableCoins = buildQuery({ + encode: AccountUnlockableCoinsRequest.encode, + decode: AccountUnlockableCoinsResponse.decode, + service: "osmosis.lockup.Query", + method: "AccountUnlockableCoins", + deps: [AccountUnlockableCoinsRequest, AccountUnlockableCoinsResponse] +}); +/** + * Returns unlocking coins + * @name getAccountUnlockingCoins + * @package osmosis.lockup + * @see proto service: osmosis.lockup.AccountUnlockingCoins + */ +export const getAccountUnlockingCoins = buildQuery({ + encode: AccountUnlockingCoinsRequest.encode, + decode: AccountUnlockingCoinsResponse.decode, + service: "osmosis.lockup.Query", + method: "AccountUnlockingCoins", + deps: [AccountUnlockingCoinsRequest, AccountUnlockingCoinsResponse] +}); +/** + * Return a locked coins that can't be withdrawn + * @name getAccountLockedCoins + * @package osmosis.lockup + * @see proto service: osmosis.lockup.AccountLockedCoins + */ +export const getAccountLockedCoins = buildQuery({ + encode: AccountLockedCoinsRequest.encode, + decode: AccountLockedCoinsResponse.decode, + service: "osmosis.lockup.Query", + method: "AccountLockedCoins", + deps: [AccountLockedCoinsRequest, AccountLockedCoinsResponse] +}); +/** + * Returns locked records of an account with unlock time beyond timestamp + * @name getAccountLockedPastTime + * @package osmosis.lockup + * @see proto service: osmosis.lockup.AccountLockedPastTime + */ +export const getAccountLockedPastTime = buildQuery({ + encode: AccountLockedPastTimeRequest.encode, + decode: AccountLockedPastTimeResponse.decode, + service: "osmosis.lockup.Query", + method: "AccountLockedPastTime", + deps: [AccountLockedPastTimeRequest, AccountLockedPastTimeResponse] +}); +/** + * Returns locked records of an account with unlock time beyond timestamp + * excluding tokens started unlocking + * @name getAccountLockedPastTimeNotUnlockingOnly + * @package osmosis.lockup + * @see proto service: osmosis.lockup.AccountLockedPastTimeNotUnlockingOnly + */ +export const getAccountLockedPastTimeNotUnlockingOnly = buildQuery({ + encode: AccountLockedPastTimeNotUnlockingOnlyRequest.encode, + decode: AccountLockedPastTimeNotUnlockingOnlyResponse.decode, + service: "osmosis.lockup.Query", + method: "AccountLockedPastTimeNotUnlockingOnly", + deps: [AccountLockedPastTimeNotUnlockingOnlyRequest, AccountLockedPastTimeNotUnlockingOnlyResponse] +}); +/** + * Returns unlocked records with unlock time before timestamp + * @name getAccountUnlockedBeforeTime + * @package osmosis.lockup + * @see proto service: osmosis.lockup.AccountUnlockedBeforeTime + */ +export const getAccountUnlockedBeforeTime = buildQuery({ + encode: AccountUnlockedBeforeTimeRequest.encode, + decode: AccountUnlockedBeforeTimeResponse.decode, + service: "osmosis.lockup.Query", + method: "AccountUnlockedBeforeTime", + deps: [AccountUnlockedBeforeTimeRequest, AccountUnlockedBeforeTimeResponse] +}); +/** + * Returns lock records by address, timestamp, denom + * @name getAccountLockedPastTimeDenom + * @package osmosis.lockup + * @see proto service: osmosis.lockup.AccountLockedPastTimeDenom + */ +export const getAccountLockedPastTimeDenom = buildQuery({ + encode: AccountLockedPastTimeDenomRequest.encode, + decode: AccountLockedPastTimeDenomResponse.decode, + service: "osmosis.lockup.Query", + method: "AccountLockedPastTimeDenom", + deps: [AccountLockedPastTimeDenomRequest, AccountLockedPastTimeDenomResponse] +}); +/** + * Returns total locked per denom with longer past given time + * @name getLockedDenom + * @package osmosis.lockup + * @see proto service: osmosis.lockup.LockedDenom + */ +export const getLockedDenom = buildQuery({ + encode: LockedDenomRequest.encode, + decode: LockedDenomResponse.decode, + service: "osmosis.lockup.Query", + method: "LockedDenom", + deps: [LockedDenomRequest, LockedDenomResponse] +}); +/** + * Returns lock record by id + * @name getLockedByID + * @package osmosis.lockup + * @see proto service: osmosis.lockup.LockedByID + */ +export const getLockedByID = buildQuery({ + encode: LockedRequest.encode, + decode: LockedResponse.decode, + service: "osmosis.lockup.Query", + method: "LockedByID", + deps: [LockedRequest, LockedResponse] +}); +/** + * Returns synthetic lockups by native lockup id + * @name getSyntheticLockupsByLockupID + * @package osmosis.lockup + * @see proto service: osmosis.lockup.SyntheticLockupsByLockupID + */ +export const getSyntheticLockupsByLockupID = buildQuery({ + encode: SyntheticLockupsByLockupIDRequest.encode, + decode: SyntheticLockupsByLockupIDResponse.decode, + service: "osmosis.lockup.Query", + method: "SyntheticLockupsByLockupID", + deps: [SyntheticLockupsByLockupIDRequest, SyntheticLockupsByLockupIDResponse] +}); +/** + * Returns account locked records with longer duration + * @name getAccountLockedLongerDuration + * @package osmosis.lockup + * @see proto service: osmosis.lockup.AccountLockedLongerDuration + */ +export const getAccountLockedLongerDuration = buildQuery({ + encode: AccountLockedLongerDurationRequest.encode, + decode: AccountLockedLongerDurationResponse.decode, + service: "osmosis.lockup.Query", + method: "AccountLockedLongerDuration", + deps: [AccountLockedLongerDurationRequest, AccountLockedLongerDurationResponse] +}); +/** + * Returns account locked records with a specific duration + * @name getAccountLockedDuration + * @package osmosis.lockup + * @see proto service: osmosis.lockup.AccountLockedDuration + */ +export const getAccountLockedDuration = buildQuery({ + encode: AccountLockedDurationRequest.encode, + decode: AccountLockedDurationResponse.decode, + service: "osmosis.lockup.Query", + method: "AccountLockedDuration", + deps: [AccountLockedDurationRequest, AccountLockedDurationResponse] +}); +/** + * Returns account locked records with longer duration excluding tokens + * started unlocking + * @name getAccountLockedLongerDurationNotUnlockingOnly + * @package osmosis.lockup + * @see proto service: osmosis.lockup.AccountLockedLongerDurationNotUnlockingOnly + */ +export const getAccountLockedLongerDurationNotUnlockingOnly = buildQuery({ + encode: AccountLockedLongerDurationNotUnlockingOnlyRequest.encode, + decode: AccountLockedLongerDurationNotUnlockingOnlyResponse.decode, + service: "osmosis.lockup.Query", + method: "AccountLockedLongerDurationNotUnlockingOnly", + deps: [AccountLockedLongerDurationNotUnlockingOnlyRequest, AccountLockedLongerDurationNotUnlockingOnlyResponse] +}); +/** + * Returns account's locked records for a denom with longer duration + * @name getAccountLockedLongerDurationDenom + * @package osmosis.lockup + * @see proto service: osmosis.lockup.AccountLockedLongerDurationDenom + */ +export const getAccountLockedLongerDurationDenom = buildQuery({ + encode: AccountLockedLongerDurationDenomRequest.encode, + decode: AccountLockedLongerDurationDenomResponse.decode, + service: "osmosis.lockup.Query", + method: "AccountLockedLongerDurationDenom", + deps: [AccountLockedLongerDurationDenomRequest, AccountLockedLongerDurationDenomResponse] +}); +/** + * Params returns lockup params. + * @name getParams + * @package osmosis.lockup + * @see proto service: osmosis.lockup.Params + */ +export const getParams = buildQuery({ + encode: QueryParamsRequest.encode, + decode: QueryParamsResponse.decode, + service: "osmosis.lockup.Query", + method: "Params", + deps: [QueryParamsRequest, QueryParamsResponse] +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/osmosis/lockup/query.ts b/__fixtures__/v-next/outputv3/osmosis/lockup/query.ts index c8a54e86c9..c414ee8db7 100644 --- a/__fixtures__/v-next/outputv3/osmosis/lockup/query.ts +++ b/__fixtures__/v-next/outputv3/osmosis/lockup/query.ts @@ -5,6 +5,7 @@ import { PeriodLock, PeriodLockAmino, PeriodLockSDKType, SyntheticLock, Syntheti import { Params, ParamsAmino, ParamsSDKType } from "./params"; import { BinaryReader, BinaryWriter } from "../../binary"; import { DeepPartial, isSet, toTimestamp, fromTimestamp } from "../../helpers"; +import { GlobalDecoderRegistry } from "../../registry"; export const protobufPackage = "osmosis.lockup"; /** * @name ModuleBalanceRequest @@ -984,6 +985,15 @@ function createBaseModuleBalanceRequest(): ModuleBalanceRequest { export const ModuleBalanceRequest = { typeUrl: "/osmosis.lockup.ModuleBalanceRequest", aminoType: "osmosis/lockup/module-balance-request", + is(o: any): o is ModuleBalanceRequest { + return o && o.$typeUrl === ModuleBalanceRequest.typeUrl; + }, + isSDK(o: any): o is ModuleBalanceRequestSDKType { + return o && o.$typeUrl === ModuleBalanceRequest.typeUrl; + }, + isAmino(o: any): o is ModuleBalanceRequestAmino { + return o && o.$typeUrl === ModuleBalanceRequest.typeUrl; + }, encode(_: ModuleBalanceRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -1035,7 +1045,8 @@ export const ModuleBalanceRequest = { typeUrl: "/osmosis.lockup.ModuleBalanceRequest", value: ModuleBalanceRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseModuleBalanceResponse(): ModuleBalanceResponse { return { @@ -1050,6 +1061,15 @@ function createBaseModuleBalanceResponse(): ModuleBalanceResponse { export const ModuleBalanceResponse = { typeUrl: "/osmosis.lockup.ModuleBalanceResponse", aminoType: "osmosis/lockup/module-balance-response", + is(o: any): o is ModuleBalanceResponse { + return o && (o.$typeUrl === ModuleBalanceResponse.typeUrl || Array.isArray(o.coins) && (!o.coins.length || Coin.is(o.coins[0]))); + }, + isSDK(o: any): o is ModuleBalanceResponseSDKType { + return o && (o.$typeUrl === ModuleBalanceResponse.typeUrl || Array.isArray(o.coins) && (!o.coins.length || Coin.isSDK(o.coins[0]))); + }, + isAmino(o: any): o is ModuleBalanceResponseAmino { + return o && (o.$typeUrl === ModuleBalanceResponse.typeUrl || Array.isArray(o.coins) && (!o.coins.length || Coin.isAmino(o.coins[0]))); + }, encode(message: ModuleBalanceResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.coins) { Coin.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -1122,6 +1142,12 @@ export const ModuleBalanceResponse = { typeUrl: "/osmosis.lockup.ModuleBalanceResponse", value: ModuleBalanceResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ModuleBalanceResponse.typeUrl)) { + return; + } + Coin.registerTypeUrl(); } }; function createBaseModuleLockedAmountRequest(): ModuleLockedAmountRequest { @@ -1135,6 +1161,15 @@ function createBaseModuleLockedAmountRequest(): ModuleLockedAmountRequest { export const ModuleLockedAmountRequest = { typeUrl: "/osmosis.lockup.ModuleLockedAmountRequest", aminoType: "osmosis/lockup/module-locked-amount-request", + is(o: any): o is ModuleLockedAmountRequest { + return o && o.$typeUrl === ModuleLockedAmountRequest.typeUrl; + }, + isSDK(o: any): o is ModuleLockedAmountRequestSDKType { + return o && o.$typeUrl === ModuleLockedAmountRequest.typeUrl; + }, + isAmino(o: any): o is ModuleLockedAmountRequestAmino { + return o && o.$typeUrl === ModuleLockedAmountRequest.typeUrl; + }, encode(_: ModuleLockedAmountRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -1186,7 +1221,8 @@ export const ModuleLockedAmountRequest = { typeUrl: "/osmosis.lockup.ModuleLockedAmountRequest", value: ModuleLockedAmountRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseModuleLockedAmountResponse(): ModuleLockedAmountResponse { return { @@ -1201,6 +1237,15 @@ function createBaseModuleLockedAmountResponse(): ModuleLockedAmountResponse { export const ModuleLockedAmountResponse = { typeUrl: "/osmosis.lockup.ModuleLockedAmountResponse", aminoType: "osmosis/lockup/module-locked-amount-response", + is(o: any): o is ModuleLockedAmountResponse { + return o && (o.$typeUrl === ModuleLockedAmountResponse.typeUrl || Array.isArray(o.coins) && (!o.coins.length || Coin.is(o.coins[0]))); + }, + isSDK(o: any): o is ModuleLockedAmountResponseSDKType { + return o && (o.$typeUrl === ModuleLockedAmountResponse.typeUrl || Array.isArray(o.coins) && (!o.coins.length || Coin.isSDK(o.coins[0]))); + }, + isAmino(o: any): o is ModuleLockedAmountResponseAmino { + return o && (o.$typeUrl === ModuleLockedAmountResponse.typeUrl || Array.isArray(o.coins) && (!o.coins.length || Coin.isAmino(o.coins[0]))); + }, encode(message: ModuleLockedAmountResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.coins) { Coin.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -1273,6 +1318,12 @@ export const ModuleLockedAmountResponse = { typeUrl: "/osmosis.lockup.ModuleLockedAmountResponse", value: ModuleLockedAmountResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ModuleLockedAmountResponse.typeUrl)) { + return; + } + Coin.registerTypeUrl(); } }; function createBaseAccountUnlockableCoinsRequest(): AccountUnlockableCoinsRequest { @@ -1288,6 +1339,15 @@ function createBaseAccountUnlockableCoinsRequest(): AccountUnlockableCoinsReques export const AccountUnlockableCoinsRequest = { typeUrl: "/osmosis.lockup.AccountUnlockableCoinsRequest", aminoType: "osmosis/lockup/account-unlockable-coins-request", + is(o: any): o is AccountUnlockableCoinsRequest { + return o && (o.$typeUrl === AccountUnlockableCoinsRequest.typeUrl || typeof o.owner === "string"); + }, + isSDK(o: any): o is AccountUnlockableCoinsRequestSDKType { + return o && (o.$typeUrl === AccountUnlockableCoinsRequest.typeUrl || typeof o.owner === "string"); + }, + isAmino(o: any): o is AccountUnlockableCoinsRequestAmino { + return o && (o.$typeUrl === AccountUnlockableCoinsRequest.typeUrl || typeof o.owner === "string"); + }, encode(message: AccountUnlockableCoinsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.owner !== "") { writer.uint32(10).string(message.owner); @@ -1354,7 +1414,8 @@ export const AccountUnlockableCoinsRequest = { typeUrl: "/osmosis.lockup.AccountUnlockableCoinsRequest", value: AccountUnlockableCoinsRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseAccountUnlockableCoinsResponse(): AccountUnlockableCoinsResponse { return { @@ -1369,6 +1430,15 @@ function createBaseAccountUnlockableCoinsResponse(): AccountUnlockableCoinsRespo export const AccountUnlockableCoinsResponse = { typeUrl: "/osmosis.lockup.AccountUnlockableCoinsResponse", aminoType: "osmosis/lockup/account-unlockable-coins-response", + is(o: any): o is AccountUnlockableCoinsResponse { + return o && (o.$typeUrl === AccountUnlockableCoinsResponse.typeUrl || Array.isArray(o.coins) && (!o.coins.length || Coin.is(o.coins[0]))); + }, + isSDK(o: any): o is AccountUnlockableCoinsResponseSDKType { + return o && (o.$typeUrl === AccountUnlockableCoinsResponse.typeUrl || Array.isArray(o.coins) && (!o.coins.length || Coin.isSDK(o.coins[0]))); + }, + isAmino(o: any): o is AccountUnlockableCoinsResponseAmino { + return o && (o.$typeUrl === AccountUnlockableCoinsResponse.typeUrl || Array.isArray(o.coins) && (!o.coins.length || Coin.isAmino(o.coins[0]))); + }, encode(message: AccountUnlockableCoinsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.coins) { Coin.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -1441,6 +1511,12 @@ export const AccountUnlockableCoinsResponse = { typeUrl: "/osmosis.lockup.AccountUnlockableCoinsResponse", value: AccountUnlockableCoinsResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(AccountUnlockableCoinsResponse.typeUrl)) { + return; + } + Coin.registerTypeUrl(); } }; function createBaseAccountUnlockingCoinsRequest(): AccountUnlockingCoinsRequest { @@ -1456,6 +1532,15 @@ function createBaseAccountUnlockingCoinsRequest(): AccountUnlockingCoinsRequest export const AccountUnlockingCoinsRequest = { typeUrl: "/osmosis.lockup.AccountUnlockingCoinsRequest", aminoType: "osmosis/lockup/account-unlocking-coins-request", + is(o: any): o is AccountUnlockingCoinsRequest { + return o && (o.$typeUrl === AccountUnlockingCoinsRequest.typeUrl || typeof o.owner === "string"); + }, + isSDK(o: any): o is AccountUnlockingCoinsRequestSDKType { + return o && (o.$typeUrl === AccountUnlockingCoinsRequest.typeUrl || typeof o.owner === "string"); + }, + isAmino(o: any): o is AccountUnlockingCoinsRequestAmino { + return o && (o.$typeUrl === AccountUnlockingCoinsRequest.typeUrl || typeof o.owner === "string"); + }, encode(message: AccountUnlockingCoinsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.owner !== "") { writer.uint32(10).string(message.owner); @@ -1522,7 +1607,8 @@ export const AccountUnlockingCoinsRequest = { typeUrl: "/osmosis.lockup.AccountUnlockingCoinsRequest", value: AccountUnlockingCoinsRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseAccountUnlockingCoinsResponse(): AccountUnlockingCoinsResponse { return { @@ -1537,6 +1623,15 @@ function createBaseAccountUnlockingCoinsResponse(): AccountUnlockingCoinsRespons export const AccountUnlockingCoinsResponse = { typeUrl: "/osmosis.lockup.AccountUnlockingCoinsResponse", aminoType: "osmosis/lockup/account-unlocking-coins-response", + is(o: any): o is AccountUnlockingCoinsResponse { + return o && (o.$typeUrl === AccountUnlockingCoinsResponse.typeUrl || Array.isArray(o.coins) && (!o.coins.length || Coin.is(o.coins[0]))); + }, + isSDK(o: any): o is AccountUnlockingCoinsResponseSDKType { + return o && (o.$typeUrl === AccountUnlockingCoinsResponse.typeUrl || Array.isArray(o.coins) && (!o.coins.length || Coin.isSDK(o.coins[0]))); + }, + isAmino(o: any): o is AccountUnlockingCoinsResponseAmino { + return o && (o.$typeUrl === AccountUnlockingCoinsResponse.typeUrl || Array.isArray(o.coins) && (!o.coins.length || Coin.isAmino(o.coins[0]))); + }, encode(message: AccountUnlockingCoinsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.coins) { Coin.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -1609,6 +1704,12 @@ export const AccountUnlockingCoinsResponse = { typeUrl: "/osmosis.lockup.AccountUnlockingCoinsResponse", value: AccountUnlockingCoinsResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(AccountUnlockingCoinsResponse.typeUrl)) { + return; + } + Coin.registerTypeUrl(); } }; function createBaseAccountLockedCoinsRequest(): AccountLockedCoinsRequest { @@ -1624,6 +1725,15 @@ function createBaseAccountLockedCoinsRequest(): AccountLockedCoinsRequest { export const AccountLockedCoinsRequest = { typeUrl: "/osmosis.lockup.AccountLockedCoinsRequest", aminoType: "osmosis/lockup/account-locked-coins-request", + is(o: any): o is AccountLockedCoinsRequest { + return o && (o.$typeUrl === AccountLockedCoinsRequest.typeUrl || typeof o.owner === "string"); + }, + isSDK(o: any): o is AccountLockedCoinsRequestSDKType { + return o && (o.$typeUrl === AccountLockedCoinsRequest.typeUrl || typeof o.owner === "string"); + }, + isAmino(o: any): o is AccountLockedCoinsRequestAmino { + return o && (o.$typeUrl === AccountLockedCoinsRequest.typeUrl || typeof o.owner === "string"); + }, encode(message: AccountLockedCoinsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.owner !== "") { writer.uint32(10).string(message.owner); @@ -1690,7 +1800,8 @@ export const AccountLockedCoinsRequest = { typeUrl: "/osmosis.lockup.AccountLockedCoinsRequest", value: AccountLockedCoinsRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseAccountLockedCoinsResponse(): AccountLockedCoinsResponse { return { @@ -1705,6 +1816,15 @@ function createBaseAccountLockedCoinsResponse(): AccountLockedCoinsResponse { export const AccountLockedCoinsResponse = { typeUrl: "/osmosis.lockup.AccountLockedCoinsResponse", aminoType: "osmosis/lockup/account-locked-coins-response", + is(o: any): o is AccountLockedCoinsResponse { + return o && (o.$typeUrl === AccountLockedCoinsResponse.typeUrl || Array.isArray(o.coins) && (!o.coins.length || Coin.is(o.coins[0]))); + }, + isSDK(o: any): o is AccountLockedCoinsResponseSDKType { + return o && (o.$typeUrl === AccountLockedCoinsResponse.typeUrl || Array.isArray(o.coins) && (!o.coins.length || Coin.isSDK(o.coins[0]))); + }, + isAmino(o: any): o is AccountLockedCoinsResponseAmino { + return o && (o.$typeUrl === AccountLockedCoinsResponse.typeUrl || Array.isArray(o.coins) && (!o.coins.length || Coin.isAmino(o.coins[0]))); + }, encode(message: AccountLockedCoinsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.coins) { Coin.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -1777,6 +1897,12 @@ export const AccountLockedCoinsResponse = { typeUrl: "/osmosis.lockup.AccountLockedCoinsResponse", value: AccountLockedCoinsResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(AccountLockedCoinsResponse.typeUrl)) { + return; + } + Coin.registerTypeUrl(); } }; function createBaseAccountLockedPastTimeRequest(): AccountLockedPastTimeRequest { @@ -1793,6 +1919,15 @@ function createBaseAccountLockedPastTimeRequest(): AccountLockedPastTimeRequest export const AccountLockedPastTimeRequest = { typeUrl: "/osmosis.lockup.AccountLockedPastTimeRequest", aminoType: "osmosis/lockup/account-locked-past-time-request", + is(o: any): o is AccountLockedPastTimeRequest { + return o && (o.$typeUrl === AccountLockedPastTimeRequest.typeUrl || typeof o.owner === "string" && Timestamp.is(o.timestamp)); + }, + isSDK(o: any): o is AccountLockedPastTimeRequestSDKType { + return o && (o.$typeUrl === AccountLockedPastTimeRequest.typeUrl || typeof o.owner === "string" && Timestamp.isSDK(o.timestamp)); + }, + isAmino(o: any): o is AccountLockedPastTimeRequestAmino { + return o && (o.$typeUrl === AccountLockedPastTimeRequest.typeUrl || typeof o.owner === "string" && Timestamp.isAmino(o.timestamp)); + }, encode(message: AccountLockedPastTimeRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.owner !== "") { writer.uint32(10).string(message.owner); @@ -1873,7 +2008,8 @@ export const AccountLockedPastTimeRequest = { typeUrl: "/osmosis.lockup.AccountLockedPastTimeRequest", value: AccountLockedPastTimeRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseAccountLockedPastTimeResponse(): AccountLockedPastTimeResponse { return { @@ -1888,6 +2024,15 @@ function createBaseAccountLockedPastTimeResponse(): AccountLockedPastTimeRespons export const AccountLockedPastTimeResponse = { typeUrl: "/osmosis.lockup.AccountLockedPastTimeResponse", aminoType: "osmosis/lockup/account-locked-past-time-response", + is(o: any): o is AccountLockedPastTimeResponse { + return o && (o.$typeUrl === AccountLockedPastTimeResponse.typeUrl || Array.isArray(o.locks) && (!o.locks.length || PeriodLock.is(o.locks[0]))); + }, + isSDK(o: any): o is AccountLockedPastTimeResponseSDKType { + return o && (o.$typeUrl === AccountLockedPastTimeResponse.typeUrl || Array.isArray(o.locks) && (!o.locks.length || PeriodLock.isSDK(o.locks[0]))); + }, + isAmino(o: any): o is AccountLockedPastTimeResponseAmino { + return o && (o.$typeUrl === AccountLockedPastTimeResponse.typeUrl || Array.isArray(o.locks) && (!o.locks.length || PeriodLock.isAmino(o.locks[0]))); + }, encode(message: AccountLockedPastTimeResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.locks) { PeriodLock.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -1960,6 +2105,12 @@ export const AccountLockedPastTimeResponse = { typeUrl: "/osmosis.lockup.AccountLockedPastTimeResponse", value: AccountLockedPastTimeResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(AccountLockedPastTimeResponse.typeUrl)) { + return; + } + PeriodLock.registerTypeUrl(); } }; function createBaseAccountLockedPastTimeNotUnlockingOnlyRequest(): AccountLockedPastTimeNotUnlockingOnlyRequest { @@ -1976,6 +2127,15 @@ function createBaseAccountLockedPastTimeNotUnlockingOnlyRequest(): AccountLocked export const AccountLockedPastTimeNotUnlockingOnlyRequest = { typeUrl: "/osmosis.lockup.AccountLockedPastTimeNotUnlockingOnlyRequest", aminoType: "osmosis/lockup/account-locked-past-time-not-unlocking-only-request", + is(o: any): o is AccountLockedPastTimeNotUnlockingOnlyRequest { + return o && (o.$typeUrl === AccountLockedPastTimeNotUnlockingOnlyRequest.typeUrl || typeof o.owner === "string" && Timestamp.is(o.timestamp)); + }, + isSDK(o: any): o is AccountLockedPastTimeNotUnlockingOnlyRequestSDKType { + return o && (o.$typeUrl === AccountLockedPastTimeNotUnlockingOnlyRequest.typeUrl || typeof o.owner === "string" && Timestamp.isSDK(o.timestamp)); + }, + isAmino(o: any): o is AccountLockedPastTimeNotUnlockingOnlyRequestAmino { + return o && (o.$typeUrl === AccountLockedPastTimeNotUnlockingOnlyRequest.typeUrl || typeof o.owner === "string" && Timestamp.isAmino(o.timestamp)); + }, encode(message: AccountLockedPastTimeNotUnlockingOnlyRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.owner !== "") { writer.uint32(10).string(message.owner); @@ -2056,7 +2216,8 @@ export const AccountLockedPastTimeNotUnlockingOnlyRequest = { typeUrl: "/osmosis.lockup.AccountLockedPastTimeNotUnlockingOnlyRequest", value: AccountLockedPastTimeNotUnlockingOnlyRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseAccountLockedPastTimeNotUnlockingOnlyResponse(): AccountLockedPastTimeNotUnlockingOnlyResponse { return { @@ -2071,6 +2232,15 @@ function createBaseAccountLockedPastTimeNotUnlockingOnlyResponse(): AccountLocke export const AccountLockedPastTimeNotUnlockingOnlyResponse = { typeUrl: "/osmosis.lockup.AccountLockedPastTimeNotUnlockingOnlyResponse", aminoType: "osmosis/lockup/account-locked-past-time-not-unlocking-only-response", + is(o: any): o is AccountLockedPastTimeNotUnlockingOnlyResponse { + return o && (o.$typeUrl === AccountLockedPastTimeNotUnlockingOnlyResponse.typeUrl || Array.isArray(o.locks) && (!o.locks.length || PeriodLock.is(o.locks[0]))); + }, + isSDK(o: any): o is AccountLockedPastTimeNotUnlockingOnlyResponseSDKType { + return o && (o.$typeUrl === AccountLockedPastTimeNotUnlockingOnlyResponse.typeUrl || Array.isArray(o.locks) && (!o.locks.length || PeriodLock.isSDK(o.locks[0]))); + }, + isAmino(o: any): o is AccountLockedPastTimeNotUnlockingOnlyResponseAmino { + return o && (o.$typeUrl === AccountLockedPastTimeNotUnlockingOnlyResponse.typeUrl || Array.isArray(o.locks) && (!o.locks.length || PeriodLock.isAmino(o.locks[0]))); + }, encode(message: AccountLockedPastTimeNotUnlockingOnlyResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.locks) { PeriodLock.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -2143,6 +2313,12 @@ export const AccountLockedPastTimeNotUnlockingOnlyResponse = { typeUrl: "/osmosis.lockup.AccountLockedPastTimeNotUnlockingOnlyResponse", value: AccountLockedPastTimeNotUnlockingOnlyResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(AccountLockedPastTimeNotUnlockingOnlyResponse.typeUrl)) { + return; + } + PeriodLock.registerTypeUrl(); } }; function createBaseAccountUnlockedBeforeTimeRequest(): AccountUnlockedBeforeTimeRequest { @@ -2159,6 +2335,15 @@ function createBaseAccountUnlockedBeforeTimeRequest(): AccountUnlockedBeforeTime export const AccountUnlockedBeforeTimeRequest = { typeUrl: "/osmosis.lockup.AccountUnlockedBeforeTimeRequest", aminoType: "osmosis/lockup/account-unlocked-before-time-request", + is(o: any): o is AccountUnlockedBeforeTimeRequest { + return o && (o.$typeUrl === AccountUnlockedBeforeTimeRequest.typeUrl || typeof o.owner === "string" && Timestamp.is(o.timestamp)); + }, + isSDK(o: any): o is AccountUnlockedBeforeTimeRequestSDKType { + return o && (o.$typeUrl === AccountUnlockedBeforeTimeRequest.typeUrl || typeof o.owner === "string" && Timestamp.isSDK(o.timestamp)); + }, + isAmino(o: any): o is AccountUnlockedBeforeTimeRequestAmino { + return o && (o.$typeUrl === AccountUnlockedBeforeTimeRequest.typeUrl || typeof o.owner === "string" && Timestamp.isAmino(o.timestamp)); + }, encode(message: AccountUnlockedBeforeTimeRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.owner !== "") { writer.uint32(10).string(message.owner); @@ -2239,7 +2424,8 @@ export const AccountUnlockedBeforeTimeRequest = { typeUrl: "/osmosis.lockup.AccountUnlockedBeforeTimeRequest", value: AccountUnlockedBeforeTimeRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseAccountUnlockedBeforeTimeResponse(): AccountUnlockedBeforeTimeResponse { return { @@ -2254,6 +2440,15 @@ function createBaseAccountUnlockedBeforeTimeResponse(): AccountUnlockedBeforeTim export const AccountUnlockedBeforeTimeResponse = { typeUrl: "/osmosis.lockup.AccountUnlockedBeforeTimeResponse", aminoType: "osmosis/lockup/account-unlocked-before-time-response", + is(o: any): o is AccountUnlockedBeforeTimeResponse { + return o && (o.$typeUrl === AccountUnlockedBeforeTimeResponse.typeUrl || Array.isArray(o.locks) && (!o.locks.length || PeriodLock.is(o.locks[0]))); + }, + isSDK(o: any): o is AccountUnlockedBeforeTimeResponseSDKType { + return o && (o.$typeUrl === AccountUnlockedBeforeTimeResponse.typeUrl || Array.isArray(o.locks) && (!o.locks.length || PeriodLock.isSDK(o.locks[0]))); + }, + isAmino(o: any): o is AccountUnlockedBeforeTimeResponseAmino { + return o && (o.$typeUrl === AccountUnlockedBeforeTimeResponse.typeUrl || Array.isArray(o.locks) && (!o.locks.length || PeriodLock.isAmino(o.locks[0]))); + }, encode(message: AccountUnlockedBeforeTimeResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.locks) { PeriodLock.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -2326,6 +2521,12 @@ export const AccountUnlockedBeforeTimeResponse = { typeUrl: "/osmosis.lockup.AccountUnlockedBeforeTimeResponse", value: AccountUnlockedBeforeTimeResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(AccountUnlockedBeforeTimeResponse.typeUrl)) { + return; + } + PeriodLock.registerTypeUrl(); } }; function createBaseAccountLockedPastTimeDenomRequest(): AccountLockedPastTimeDenomRequest { @@ -2343,6 +2544,15 @@ function createBaseAccountLockedPastTimeDenomRequest(): AccountLockedPastTimeDen export const AccountLockedPastTimeDenomRequest = { typeUrl: "/osmosis.lockup.AccountLockedPastTimeDenomRequest", aminoType: "osmosis/lockup/account-locked-past-time-denom-request", + is(o: any): o is AccountLockedPastTimeDenomRequest { + return o && (o.$typeUrl === AccountLockedPastTimeDenomRequest.typeUrl || typeof o.owner === "string" && Timestamp.is(o.timestamp) && typeof o.denom === "string"); + }, + isSDK(o: any): o is AccountLockedPastTimeDenomRequestSDKType { + return o && (o.$typeUrl === AccountLockedPastTimeDenomRequest.typeUrl || typeof o.owner === "string" && Timestamp.isSDK(o.timestamp) && typeof o.denom === "string"); + }, + isAmino(o: any): o is AccountLockedPastTimeDenomRequestAmino { + return o && (o.$typeUrl === AccountLockedPastTimeDenomRequest.typeUrl || typeof o.owner === "string" && Timestamp.isAmino(o.timestamp) && typeof o.denom === "string"); + }, encode(message: AccountLockedPastTimeDenomRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.owner !== "") { writer.uint32(10).string(message.owner); @@ -2437,7 +2647,8 @@ export const AccountLockedPastTimeDenomRequest = { typeUrl: "/osmosis.lockup.AccountLockedPastTimeDenomRequest", value: AccountLockedPastTimeDenomRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseAccountLockedPastTimeDenomResponse(): AccountLockedPastTimeDenomResponse { return { @@ -2452,6 +2663,15 @@ function createBaseAccountLockedPastTimeDenomResponse(): AccountLockedPastTimeDe export const AccountLockedPastTimeDenomResponse = { typeUrl: "/osmosis.lockup.AccountLockedPastTimeDenomResponse", aminoType: "osmosis/lockup/account-locked-past-time-denom-response", + is(o: any): o is AccountLockedPastTimeDenomResponse { + return o && (o.$typeUrl === AccountLockedPastTimeDenomResponse.typeUrl || Array.isArray(o.locks) && (!o.locks.length || PeriodLock.is(o.locks[0]))); + }, + isSDK(o: any): o is AccountLockedPastTimeDenomResponseSDKType { + return o && (o.$typeUrl === AccountLockedPastTimeDenomResponse.typeUrl || Array.isArray(o.locks) && (!o.locks.length || PeriodLock.isSDK(o.locks[0]))); + }, + isAmino(o: any): o is AccountLockedPastTimeDenomResponseAmino { + return o && (o.$typeUrl === AccountLockedPastTimeDenomResponse.typeUrl || Array.isArray(o.locks) && (!o.locks.length || PeriodLock.isAmino(o.locks[0]))); + }, encode(message: AccountLockedPastTimeDenomResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.locks) { PeriodLock.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -2524,6 +2744,12 @@ export const AccountLockedPastTimeDenomResponse = { typeUrl: "/osmosis.lockup.AccountLockedPastTimeDenomResponse", value: AccountLockedPastTimeDenomResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(AccountLockedPastTimeDenomResponse.typeUrl)) { + return; + } + PeriodLock.registerTypeUrl(); } }; function createBaseLockedDenomRequest(): LockedDenomRequest { @@ -2540,6 +2766,15 @@ function createBaseLockedDenomRequest(): LockedDenomRequest { export const LockedDenomRequest = { typeUrl: "/osmosis.lockup.LockedDenomRequest", aminoType: "osmosis/lockup/locked-denom-request", + is(o: any): o is LockedDenomRequest { + return o && (o.$typeUrl === LockedDenomRequest.typeUrl || typeof o.denom === "string" && Duration.is(o.duration)); + }, + isSDK(o: any): o is LockedDenomRequestSDKType { + return o && (o.$typeUrl === LockedDenomRequest.typeUrl || typeof o.denom === "string" && Duration.isSDK(o.duration)); + }, + isAmino(o: any): o is LockedDenomRequestAmino { + return o && (o.$typeUrl === LockedDenomRequest.typeUrl || typeof o.denom === "string" && Duration.isAmino(o.duration)); + }, encode(message: LockedDenomRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.denom !== "") { writer.uint32(10).string(message.denom); @@ -2622,7 +2857,8 @@ export const LockedDenomRequest = { typeUrl: "/osmosis.lockup.LockedDenomRequest", value: LockedDenomRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseLockedDenomResponse(): LockedDenomResponse { return { @@ -2637,6 +2873,15 @@ function createBaseLockedDenomResponse(): LockedDenomResponse { export const LockedDenomResponse = { typeUrl: "/osmosis.lockup.LockedDenomResponse", aminoType: "osmosis/lockup/locked-denom-response", + is(o: any): o is LockedDenomResponse { + return o && (o.$typeUrl === LockedDenomResponse.typeUrl || typeof o.amount === "string"); + }, + isSDK(o: any): o is LockedDenomResponseSDKType { + return o && (o.$typeUrl === LockedDenomResponse.typeUrl || typeof o.amount === "string"); + }, + isAmino(o: any): o is LockedDenomResponseAmino { + return o && (o.$typeUrl === LockedDenomResponse.typeUrl || typeof o.amount === "string"); + }, encode(message: LockedDenomResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.amount !== "") { writer.uint32(10).string(message.amount); @@ -2703,7 +2948,8 @@ export const LockedDenomResponse = { typeUrl: "/osmosis.lockup.LockedDenomResponse", value: LockedDenomResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseLockedRequest(): LockedRequest { return { @@ -2718,6 +2964,15 @@ function createBaseLockedRequest(): LockedRequest { export const LockedRequest = { typeUrl: "/osmosis.lockup.LockedRequest", aminoType: "osmosis/lockup/locked-request", + is(o: any): o is LockedRequest { + return o && (o.$typeUrl === LockedRequest.typeUrl || typeof o.lockId === "bigint"); + }, + isSDK(o: any): o is LockedRequestSDKType { + return o && (o.$typeUrl === LockedRequest.typeUrl || typeof o.lock_id === "bigint"); + }, + isAmino(o: any): o is LockedRequestAmino { + return o && (o.$typeUrl === LockedRequest.typeUrl || typeof o.lock_id === "bigint"); + }, encode(message: LockedRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.lockId !== BigInt(0)) { writer.uint32(8).uint64(message.lockId); @@ -2786,7 +3041,8 @@ export const LockedRequest = { typeUrl: "/osmosis.lockup.LockedRequest", value: LockedRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseLockedResponse(): LockedResponse { return { @@ -2801,6 +3057,15 @@ function createBaseLockedResponse(): LockedResponse { export const LockedResponse = { typeUrl: "/osmosis.lockup.LockedResponse", aminoType: "osmosis/lockup/locked-response", + is(o: any): o is LockedResponse { + return o && o.$typeUrl === LockedResponse.typeUrl; + }, + isSDK(o: any): o is LockedResponseSDKType { + return o && o.$typeUrl === LockedResponse.typeUrl; + }, + isAmino(o: any): o is LockedResponseAmino { + return o && o.$typeUrl === LockedResponse.typeUrl; + }, encode(message: LockedResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.lock !== undefined) { PeriodLock.encode(message.lock, writer.uint32(10).fork()).ldelim(); @@ -2869,6 +3134,12 @@ export const LockedResponse = { typeUrl: "/osmosis.lockup.LockedResponse", value: LockedResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(LockedResponse.typeUrl)) { + return; + } + PeriodLock.registerTypeUrl(); } }; function createBaseSyntheticLockupsByLockupIDRequest(): SyntheticLockupsByLockupIDRequest { @@ -2884,6 +3155,15 @@ function createBaseSyntheticLockupsByLockupIDRequest(): SyntheticLockupsByLockup export const SyntheticLockupsByLockupIDRequest = { typeUrl: "/osmosis.lockup.SyntheticLockupsByLockupIDRequest", aminoType: "osmosis/lockup/synthetic-lockups-by-lockup-id-request", + is(o: any): o is SyntheticLockupsByLockupIDRequest { + return o && (o.$typeUrl === SyntheticLockupsByLockupIDRequest.typeUrl || typeof o.lockId === "bigint"); + }, + isSDK(o: any): o is SyntheticLockupsByLockupIDRequestSDKType { + return o && (o.$typeUrl === SyntheticLockupsByLockupIDRequest.typeUrl || typeof o.lock_id === "bigint"); + }, + isAmino(o: any): o is SyntheticLockupsByLockupIDRequestAmino { + return o && (o.$typeUrl === SyntheticLockupsByLockupIDRequest.typeUrl || typeof o.lock_id === "bigint"); + }, encode(message: SyntheticLockupsByLockupIDRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.lockId !== BigInt(0)) { writer.uint32(8).uint64(message.lockId); @@ -2952,7 +3232,8 @@ export const SyntheticLockupsByLockupIDRequest = { typeUrl: "/osmosis.lockup.SyntheticLockupsByLockupIDRequest", value: SyntheticLockupsByLockupIDRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseSyntheticLockupsByLockupIDResponse(): SyntheticLockupsByLockupIDResponse { return { @@ -2967,6 +3248,15 @@ function createBaseSyntheticLockupsByLockupIDResponse(): SyntheticLockupsByLocku export const SyntheticLockupsByLockupIDResponse = { typeUrl: "/osmosis.lockup.SyntheticLockupsByLockupIDResponse", aminoType: "osmosis/lockup/synthetic-lockups-by-lockup-id-response", + is(o: any): o is SyntheticLockupsByLockupIDResponse { + return o && (o.$typeUrl === SyntheticLockupsByLockupIDResponse.typeUrl || Array.isArray(o.syntheticLocks) && (!o.syntheticLocks.length || SyntheticLock.is(o.syntheticLocks[0]))); + }, + isSDK(o: any): o is SyntheticLockupsByLockupIDResponseSDKType { + return o && (o.$typeUrl === SyntheticLockupsByLockupIDResponse.typeUrl || Array.isArray(o.synthetic_locks) && (!o.synthetic_locks.length || SyntheticLock.isSDK(o.synthetic_locks[0]))); + }, + isAmino(o: any): o is SyntheticLockupsByLockupIDResponseAmino { + return o && (o.$typeUrl === SyntheticLockupsByLockupIDResponse.typeUrl || Array.isArray(o.synthetic_locks) && (!o.synthetic_locks.length || SyntheticLock.isAmino(o.synthetic_locks[0]))); + }, encode(message: SyntheticLockupsByLockupIDResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.syntheticLocks) { SyntheticLock.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -3039,6 +3329,12 @@ export const SyntheticLockupsByLockupIDResponse = { typeUrl: "/osmosis.lockup.SyntheticLockupsByLockupIDResponse", value: SyntheticLockupsByLockupIDResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(SyntheticLockupsByLockupIDResponse.typeUrl)) { + return; + } + SyntheticLock.registerTypeUrl(); } }; function createBaseAccountLockedLongerDurationRequest(): AccountLockedLongerDurationRequest { @@ -3055,6 +3351,15 @@ function createBaseAccountLockedLongerDurationRequest(): AccountLockedLongerDura export const AccountLockedLongerDurationRequest = { typeUrl: "/osmosis.lockup.AccountLockedLongerDurationRequest", aminoType: "osmosis/lockup/account-locked-longer-duration-request", + is(o: any): o is AccountLockedLongerDurationRequest { + return o && (o.$typeUrl === AccountLockedLongerDurationRequest.typeUrl || typeof o.owner === "string" && Duration.is(o.duration)); + }, + isSDK(o: any): o is AccountLockedLongerDurationRequestSDKType { + return o && (o.$typeUrl === AccountLockedLongerDurationRequest.typeUrl || typeof o.owner === "string" && Duration.isSDK(o.duration)); + }, + isAmino(o: any): o is AccountLockedLongerDurationRequestAmino { + return o && (o.$typeUrl === AccountLockedLongerDurationRequest.typeUrl || typeof o.owner === "string" && Duration.isAmino(o.duration)); + }, encode(message: AccountLockedLongerDurationRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.owner !== "") { writer.uint32(10).string(message.owner); @@ -3137,7 +3442,8 @@ export const AccountLockedLongerDurationRequest = { typeUrl: "/osmosis.lockup.AccountLockedLongerDurationRequest", value: AccountLockedLongerDurationRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseAccountLockedLongerDurationResponse(): AccountLockedLongerDurationResponse { return { @@ -3152,6 +3458,15 @@ function createBaseAccountLockedLongerDurationResponse(): AccountLockedLongerDur export const AccountLockedLongerDurationResponse = { typeUrl: "/osmosis.lockup.AccountLockedLongerDurationResponse", aminoType: "osmosis/lockup/account-locked-longer-duration-response", + is(o: any): o is AccountLockedLongerDurationResponse { + return o && (o.$typeUrl === AccountLockedLongerDurationResponse.typeUrl || Array.isArray(o.locks) && (!o.locks.length || PeriodLock.is(o.locks[0]))); + }, + isSDK(o: any): o is AccountLockedLongerDurationResponseSDKType { + return o && (o.$typeUrl === AccountLockedLongerDurationResponse.typeUrl || Array.isArray(o.locks) && (!o.locks.length || PeriodLock.isSDK(o.locks[0]))); + }, + isAmino(o: any): o is AccountLockedLongerDurationResponseAmino { + return o && (o.$typeUrl === AccountLockedLongerDurationResponse.typeUrl || Array.isArray(o.locks) && (!o.locks.length || PeriodLock.isAmino(o.locks[0]))); + }, encode(message: AccountLockedLongerDurationResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.locks) { PeriodLock.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -3224,6 +3539,12 @@ export const AccountLockedLongerDurationResponse = { typeUrl: "/osmosis.lockup.AccountLockedLongerDurationResponse", value: AccountLockedLongerDurationResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(AccountLockedLongerDurationResponse.typeUrl)) { + return; + } + PeriodLock.registerTypeUrl(); } }; function createBaseAccountLockedDurationRequest(): AccountLockedDurationRequest { @@ -3240,6 +3561,15 @@ function createBaseAccountLockedDurationRequest(): AccountLockedDurationRequest export const AccountLockedDurationRequest = { typeUrl: "/osmosis.lockup.AccountLockedDurationRequest", aminoType: "osmosis/lockup/account-locked-duration-request", + is(o: any): o is AccountLockedDurationRequest { + return o && (o.$typeUrl === AccountLockedDurationRequest.typeUrl || typeof o.owner === "string" && Duration.is(o.duration)); + }, + isSDK(o: any): o is AccountLockedDurationRequestSDKType { + return o && (o.$typeUrl === AccountLockedDurationRequest.typeUrl || typeof o.owner === "string" && Duration.isSDK(o.duration)); + }, + isAmino(o: any): o is AccountLockedDurationRequestAmino { + return o && (o.$typeUrl === AccountLockedDurationRequest.typeUrl || typeof o.owner === "string" && Duration.isAmino(o.duration)); + }, encode(message: AccountLockedDurationRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.owner !== "") { writer.uint32(10).string(message.owner); @@ -3322,7 +3652,8 @@ export const AccountLockedDurationRequest = { typeUrl: "/osmosis.lockup.AccountLockedDurationRequest", value: AccountLockedDurationRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseAccountLockedDurationResponse(): AccountLockedDurationResponse { return { @@ -3337,6 +3668,15 @@ function createBaseAccountLockedDurationResponse(): AccountLockedDurationRespons export const AccountLockedDurationResponse = { typeUrl: "/osmosis.lockup.AccountLockedDurationResponse", aminoType: "osmosis/lockup/account-locked-duration-response", + is(o: any): o is AccountLockedDurationResponse { + return o && (o.$typeUrl === AccountLockedDurationResponse.typeUrl || Array.isArray(o.locks) && (!o.locks.length || PeriodLock.is(o.locks[0]))); + }, + isSDK(o: any): o is AccountLockedDurationResponseSDKType { + return o && (o.$typeUrl === AccountLockedDurationResponse.typeUrl || Array.isArray(o.locks) && (!o.locks.length || PeriodLock.isSDK(o.locks[0]))); + }, + isAmino(o: any): o is AccountLockedDurationResponseAmino { + return o && (o.$typeUrl === AccountLockedDurationResponse.typeUrl || Array.isArray(o.locks) && (!o.locks.length || PeriodLock.isAmino(o.locks[0]))); + }, encode(message: AccountLockedDurationResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.locks) { PeriodLock.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -3409,6 +3749,12 @@ export const AccountLockedDurationResponse = { typeUrl: "/osmosis.lockup.AccountLockedDurationResponse", value: AccountLockedDurationResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(AccountLockedDurationResponse.typeUrl)) { + return; + } + PeriodLock.registerTypeUrl(); } }; function createBaseAccountLockedLongerDurationNotUnlockingOnlyRequest(): AccountLockedLongerDurationNotUnlockingOnlyRequest { @@ -3425,6 +3771,15 @@ function createBaseAccountLockedLongerDurationNotUnlockingOnlyRequest(): Account export const AccountLockedLongerDurationNotUnlockingOnlyRequest = { typeUrl: "/osmosis.lockup.AccountLockedLongerDurationNotUnlockingOnlyRequest", aminoType: "osmosis/lockup/account-locked-longer-duration-not-unlocking-only-request", + is(o: any): o is AccountLockedLongerDurationNotUnlockingOnlyRequest { + return o && (o.$typeUrl === AccountLockedLongerDurationNotUnlockingOnlyRequest.typeUrl || typeof o.owner === "string" && Duration.is(o.duration)); + }, + isSDK(o: any): o is AccountLockedLongerDurationNotUnlockingOnlyRequestSDKType { + return o && (o.$typeUrl === AccountLockedLongerDurationNotUnlockingOnlyRequest.typeUrl || typeof o.owner === "string" && Duration.isSDK(o.duration)); + }, + isAmino(o: any): o is AccountLockedLongerDurationNotUnlockingOnlyRequestAmino { + return o && (o.$typeUrl === AccountLockedLongerDurationNotUnlockingOnlyRequest.typeUrl || typeof o.owner === "string" && Duration.isAmino(o.duration)); + }, encode(message: AccountLockedLongerDurationNotUnlockingOnlyRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.owner !== "") { writer.uint32(10).string(message.owner); @@ -3507,7 +3862,8 @@ export const AccountLockedLongerDurationNotUnlockingOnlyRequest = { typeUrl: "/osmosis.lockup.AccountLockedLongerDurationNotUnlockingOnlyRequest", value: AccountLockedLongerDurationNotUnlockingOnlyRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseAccountLockedLongerDurationNotUnlockingOnlyResponse(): AccountLockedLongerDurationNotUnlockingOnlyResponse { return { @@ -3522,6 +3878,15 @@ function createBaseAccountLockedLongerDurationNotUnlockingOnlyResponse(): Accoun export const AccountLockedLongerDurationNotUnlockingOnlyResponse = { typeUrl: "/osmosis.lockup.AccountLockedLongerDurationNotUnlockingOnlyResponse", aminoType: "osmosis/lockup/account-locked-longer-duration-not-unlocking-only-response", + is(o: any): o is AccountLockedLongerDurationNotUnlockingOnlyResponse { + return o && (o.$typeUrl === AccountLockedLongerDurationNotUnlockingOnlyResponse.typeUrl || Array.isArray(o.locks) && (!o.locks.length || PeriodLock.is(o.locks[0]))); + }, + isSDK(o: any): o is AccountLockedLongerDurationNotUnlockingOnlyResponseSDKType { + return o && (o.$typeUrl === AccountLockedLongerDurationNotUnlockingOnlyResponse.typeUrl || Array.isArray(o.locks) && (!o.locks.length || PeriodLock.isSDK(o.locks[0]))); + }, + isAmino(o: any): o is AccountLockedLongerDurationNotUnlockingOnlyResponseAmino { + return o && (o.$typeUrl === AccountLockedLongerDurationNotUnlockingOnlyResponse.typeUrl || Array.isArray(o.locks) && (!o.locks.length || PeriodLock.isAmino(o.locks[0]))); + }, encode(message: AccountLockedLongerDurationNotUnlockingOnlyResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.locks) { PeriodLock.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -3594,6 +3959,12 @@ export const AccountLockedLongerDurationNotUnlockingOnlyResponse = { typeUrl: "/osmosis.lockup.AccountLockedLongerDurationNotUnlockingOnlyResponse", value: AccountLockedLongerDurationNotUnlockingOnlyResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(AccountLockedLongerDurationNotUnlockingOnlyResponse.typeUrl)) { + return; + } + PeriodLock.registerTypeUrl(); } }; function createBaseAccountLockedLongerDurationDenomRequest(): AccountLockedLongerDurationDenomRequest { @@ -3611,6 +3982,15 @@ function createBaseAccountLockedLongerDurationDenomRequest(): AccountLockedLonge export const AccountLockedLongerDurationDenomRequest = { typeUrl: "/osmosis.lockup.AccountLockedLongerDurationDenomRequest", aminoType: "osmosis/lockup/account-locked-longer-duration-denom-request", + is(o: any): o is AccountLockedLongerDurationDenomRequest { + return o && (o.$typeUrl === AccountLockedLongerDurationDenomRequest.typeUrl || typeof o.owner === "string" && Duration.is(o.duration) && typeof o.denom === "string"); + }, + isSDK(o: any): o is AccountLockedLongerDurationDenomRequestSDKType { + return o && (o.$typeUrl === AccountLockedLongerDurationDenomRequest.typeUrl || typeof o.owner === "string" && Duration.isSDK(o.duration) && typeof o.denom === "string"); + }, + isAmino(o: any): o is AccountLockedLongerDurationDenomRequestAmino { + return o && (o.$typeUrl === AccountLockedLongerDurationDenomRequest.typeUrl || typeof o.owner === "string" && Duration.isAmino(o.duration) && typeof o.denom === "string"); + }, encode(message: AccountLockedLongerDurationDenomRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.owner !== "") { writer.uint32(10).string(message.owner); @@ -3707,7 +4087,8 @@ export const AccountLockedLongerDurationDenomRequest = { typeUrl: "/osmosis.lockup.AccountLockedLongerDurationDenomRequest", value: AccountLockedLongerDurationDenomRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseAccountLockedLongerDurationDenomResponse(): AccountLockedLongerDurationDenomResponse { return { @@ -3722,6 +4103,15 @@ function createBaseAccountLockedLongerDurationDenomResponse(): AccountLockedLong export const AccountLockedLongerDurationDenomResponse = { typeUrl: "/osmosis.lockup.AccountLockedLongerDurationDenomResponse", aminoType: "osmosis/lockup/account-locked-longer-duration-denom-response", + is(o: any): o is AccountLockedLongerDurationDenomResponse { + return o && (o.$typeUrl === AccountLockedLongerDurationDenomResponse.typeUrl || Array.isArray(o.locks) && (!o.locks.length || PeriodLock.is(o.locks[0]))); + }, + isSDK(o: any): o is AccountLockedLongerDurationDenomResponseSDKType { + return o && (o.$typeUrl === AccountLockedLongerDurationDenomResponse.typeUrl || Array.isArray(o.locks) && (!o.locks.length || PeriodLock.isSDK(o.locks[0]))); + }, + isAmino(o: any): o is AccountLockedLongerDurationDenomResponseAmino { + return o && (o.$typeUrl === AccountLockedLongerDurationDenomResponse.typeUrl || Array.isArray(o.locks) && (!o.locks.length || PeriodLock.isAmino(o.locks[0]))); + }, encode(message: AccountLockedLongerDurationDenomResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.locks) { PeriodLock.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -3794,6 +4184,12 @@ export const AccountLockedLongerDurationDenomResponse = { typeUrl: "/osmosis.lockup.AccountLockedLongerDurationDenomResponse", value: AccountLockedLongerDurationDenomResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(AccountLockedLongerDurationDenomResponse.typeUrl)) { + return; + } + PeriodLock.registerTypeUrl(); } }; function createBaseQueryParamsRequest(): QueryParamsRequest { @@ -3807,6 +4203,15 @@ function createBaseQueryParamsRequest(): QueryParamsRequest { export const QueryParamsRequest = { typeUrl: "/osmosis.lockup.QueryParamsRequest", aminoType: "osmosis/lockup/query-params-request", + is(o: any): o is QueryParamsRequest { + return o && o.$typeUrl === QueryParamsRequest.typeUrl; + }, + isSDK(o: any): o is QueryParamsRequestSDKType { + return o && o.$typeUrl === QueryParamsRequest.typeUrl; + }, + isAmino(o: any): o is QueryParamsRequestAmino { + return o && o.$typeUrl === QueryParamsRequest.typeUrl; + }, encode(_: QueryParamsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -3858,7 +4263,8 @@ export const QueryParamsRequest = { typeUrl: "/osmosis.lockup.QueryParamsRequest", value: QueryParamsRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryParamsResponse(): QueryParamsResponse { return { @@ -3873,6 +4279,15 @@ function createBaseQueryParamsResponse(): QueryParamsResponse { export const QueryParamsResponse = { typeUrl: "/osmosis.lockup.QueryParamsResponse", aminoType: "osmosis/lockup/query-params-response", + is(o: any): o is QueryParamsResponse { + return o && (o.$typeUrl === QueryParamsResponse.typeUrl || Params.is(o.params)); + }, + isSDK(o: any): o is QueryParamsResponseSDKType { + return o && (o.$typeUrl === QueryParamsResponse.typeUrl || Params.isSDK(o.params)); + }, + isAmino(o: any): o is QueryParamsResponseAmino { + return o && (o.$typeUrl === QueryParamsResponse.typeUrl || Params.isAmino(o.params)); + }, encode(message: QueryParamsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.params !== undefined) { Params.encode(message.params, writer.uint32(10).fork()).ldelim(); @@ -3941,5 +4356,11 @@ export const QueryParamsResponse = { typeUrl: "/osmosis.lockup.QueryParamsResponse", value: QueryParamsResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryParamsResponse.typeUrl)) { + return; + } + Params.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/osmosis/lockup/tx.registry.ts b/__fixtures__/v-next/outputv3/osmosis/lockup/tx.registry.ts index 426bbdbc94..6ee02488ca 100644 --- a/__fixtures__/v-next/outputv3/osmosis/lockup/tx.registry.ts +++ b/__fixtures__/v-next/outputv3/osmosis/lockup/tx.registry.ts @@ -1,14 +1,9 @@ import { Duration, DurationSDKType } from "../../google/protobuf/duration"; import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; import { PeriodLock, PeriodLockSDKType } from "./lock"; -import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { TelescopeGeneratedType } from "../../types"; import { MsgLockTokens, MsgLockTokensSDKType, MsgBeginUnlockingAll, MsgBeginUnlockingAllSDKType, MsgBeginUnlocking, MsgBeginUnlockingSDKType, MsgExtendLockup, MsgExtendLockupSDKType, MsgForceUnlock, MsgForceUnlockSDKType } from "./tx"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/osmosis.lockup.MsgLockTokens", MsgLockTokens], ["/osmosis.lockup.MsgBeginUnlockingAll", MsgBeginUnlockingAll], ["/osmosis.lockup.MsgBeginUnlocking", MsgBeginUnlocking], ["/osmosis.lockup.MsgExtendLockup", MsgExtendLockup], ["/osmosis.lockup.MsgForceUnlock", MsgForceUnlock]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/osmosis.lockup.MsgLockTokens", MsgLockTokens], ["/osmosis.lockup.MsgBeginUnlockingAll", MsgBeginUnlockingAll], ["/osmosis.lockup.MsgBeginUnlocking", MsgBeginUnlocking], ["/osmosis.lockup.MsgExtendLockup", MsgExtendLockup], ["/osmosis.lockup.MsgForceUnlock", MsgForceUnlock]]; export const MessageComposer = { encoded: { lockTokens(value: MsgLockTokens) { diff --git a/__fixtures__/v-next/outputv3/osmosis/lockup/tx.rpc.func.ts b/__fixtures__/v-next/outputv3/osmosis/lockup/tx.rpc.func.ts new file mode 100644 index 0000000000..f9b47db3d7 --- /dev/null +++ b/__fixtures__/v-next/outputv3/osmosis/lockup/tx.rpc.func.ts @@ -0,0 +1,49 @@ +import { Duration, DurationSDKType } from "../../google/protobuf/duration"; +import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; +import { PeriodLock, PeriodLockSDKType } from "./lock"; +import { buildTx } from "../../helper-func-types"; +import { MsgLockTokens, MsgLockTokensSDKType, MsgLockTokensResponse, MsgLockTokensResponseSDKType, MsgBeginUnlockingAll, MsgBeginUnlockingAllSDKType, MsgBeginUnlockingAllResponse, MsgBeginUnlockingAllResponseSDKType, MsgBeginUnlocking, MsgBeginUnlockingSDKType, MsgBeginUnlockingResponse, MsgBeginUnlockingResponseSDKType, MsgExtendLockup, MsgExtendLockupSDKType, MsgExtendLockupResponse, MsgExtendLockupResponseSDKType, MsgForceUnlock, MsgForceUnlockSDKType, MsgForceUnlockResponse, MsgForceUnlockResponseSDKType } from "./tx"; +/** + * LockTokens lock tokens + * @name lockTokens + * @package osmosis.lockup + * @see proto service: osmosis.lockup.LockTokens + */ +export const lockTokens = buildTx({ + msg: MsgLockTokens +}); +/** + * BeginUnlockingAll begin unlocking all tokens + * @name beginUnlockingAll + * @package osmosis.lockup + * @see proto service: osmosis.lockup.BeginUnlockingAll + */ +export const beginUnlockingAll = buildTx({ + msg: MsgBeginUnlockingAll +}); +/** + * MsgBeginUnlocking begins unlocking tokens by lock ID + * @name beginUnlocking + * @package osmosis.lockup + * @see proto service: osmosis.lockup.BeginUnlocking + */ +export const beginUnlocking = buildTx({ + msg: MsgBeginUnlocking +}); +/** + * MsgEditLockup edits the existing lockups by lock ID + * @name extendLockup + * @package osmosis.lockup + * @see proto service: osmosis.lockup.ExtendLockup + */ +export const extendLockup = buildTx({ + msg: MsgExtendLockup +}); +/** + * @name forceUnlock + * @package osmosis.lockup + * @see proto service: osmosis.lockup.ForceUnlock + */ +export const forceUnlock = buildTx({ + msg: MsgForceUnlock +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/osmosis/lockup/tx.ts b/__fixtures__/v-next/outputv3/osmosis/lockup/tx.ts index ba3e2814dc..9076af4fd3 100644 --- a/__fixtures__/v-next/outputv3/osmosis/lockup/tx.ts +++ b/__fixtures__/v-next/outputv3/osmosis/lockup/tx.ts @@ -2,6 +2,7 @@ import { Duration, DurationAmino, DurationSDKType } from "../../google/protobuf/ import { Coin, CoinAmino, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; import { PeriodLock, PeriodLockAmino, PeriodLockSDKType } from "./lock"; import { BinaryReader, BinaryWriter } from "../../binary"; +import { GlobalDecoderRegistry } from "../../registry"; import { isSet, DeepPartial } from "../../helpers"; export const protobufPackage = "osmosis.lockup"; /** @@ -355,6 +356,15 @@ function createBaseMsgLockTokens(): MsgLockTokens { export const MsgLockTokens = { typeUrl: "/osmosis.lockup.MsgLockTokens", aminoType: "osmosis/lockup/lock-tokens", + is(o: any): o is MsgLockTokens { + return o && (o.$typeUrl === MsgLockTokens.typeUrl || typeof o.owner === "string" && Duration.is(o.duration) && Array.isArray(o.coins) && (!o.coins.length || Coin.is(o.coins[0]))); + }, + isSDK(o: any): o is MsgLockTokensSDKType { + return o && (o.$typeUrl === MsgLockTokens.typeUrl || typeof o.owner === "string" && Duration.isSDK(o.duration) && Array.isArray(o.coins) && (!o.coins.length || Coin.isSDK(o.coins[0]))); + }, + isAmino(o: any): o is MsgLockTokensAmino { + return o && (o.$typeUrl === MsgLockTokens.typeUrl || typeof o.owner === "string" && Duration.isAmino(o.duration) && Array.isArray(o.coins) && (!o.coins.length || Coin.isAmino(o.coins[0]))); + }, encode(message: MsgLockTokens, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.owner !== "") { writer.uint32(10).string(message.owner); @@ -457,6 +467,12 @@ export const MsgLockTokens = { typeUrl: "/osmosis.lockup.MsgLockTokens", value: MsgLockTokens.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgLockTokens.typeUrl)) { + return; + } + Coin.registerTypeUrl(); } }; function createBaseMsgLockTokensResponse(): MsgLockTokensResponse { @@ -472,6 +488,15 @@ function createBaseMsgLockTokensResponse(): MsgLockTokensResponse { export const MsgLockTokensResponse = { typeUrl: "/osmosis.lockup.MsgLockTokensResponse", aminoType: "osmosis/lockup/lock-tokens-response", + is(o: any): o is MsgLockTokensResponse { + return o && (o.$typeUrl === MsgLockTokensResponse.typeUrl || typeof o.iD === "bigint"); + }, + isSDK(o: any): o is MsgLockTokensResponseSDKType { + return o && (o.$typeUrl === MsgLockTokensResponse.typeUrl || typeof o.ID === "bigint"); + }, + isAmino(o: any): o is MsgLockTokensResponseAmino { + return o && (o.$typeUrl === MsgLockTokensResponse.typeUrl || typeof o.ID === "bigint"); + }, encode(message: MsgLockTokensResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.iD !== BigInt(0)) { writer.uint32(8).uint64(message.iD); @@ -540,7 +565,8 @@ export const MsgLockTokensResponse = { typeUrl: "/osmosis.lockup.MsgLockTokensResponse", value: MsgLockTokensResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgBeginUnlockingAll(): MsgBeginUnlockingAll { return { @@ -555,6 +581,15 @@ function createBaseMsgBeginUnlockingAll(): MsgBeginUnlockingAll { export const MsgBeginUnlockingAll = { typeUrl: "/osmosis.lockup.MsgBeginUnlockingAll", aminoType: "osmosis/lockup/begin-unlock-tokens", + is(o: any): o is MsgBeginUnlockingAll { + return o && (o.$typeUrl === MsgBeginUnlockingAll.typeUrl || typeof o.owner === "string"); + }, + isSDK(o: any): o is MsgBeginUnlockingAllSDKType { + return o && (o.$typeUrl === MsgBeginUnlockingAll.typeUrl || typeof o.owner === "string"); + }, + isAmino(o: any): o is MsgBeginUnlockingAllAmino { + return o && (o.$typeUrl === MsgBeginUnlockingAll.typeUrl || typeof o.owner === "string"); + }, encode(message: MsgBeginUnlockingAll, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.owner !== "") { writer.uint32(10).string(message.owner); @@ -621,7 +656,8 @@ export const MsgBeginUnlockingAll = { typeUrl: "/osmosis.lockup.MsgBeginUnlockingAll", value: MsgBeginUnlockingAll.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgBeginUnlockingAllResponse(): MsgBeginUnlockingAllResponse { return { @@ -636,6 +672,15 @@ function createBaseMsgBeginUnlockingAllResponse(): MsgBeginUnlockingAllResponse export const MsgBeginUnlockingAllResponse = { typeUrl: "/osmosis.lockup.MsgBeginUnlockingAllResponse", aminoType: "osmosis/lockup/begin-unlocking-all-response", + is(o: any): o is MsgBeginUnlockingAllResponse { + return o && (o.$typeUrl === MsgBeginUnlockingAllResponse.typeUrl || Array.isArray(o.unlocks) && (!o.unlocks.length || PeriodLock.is(o.unlocks[0]))); + }, + isSDK(o: any): o is MsgBeginUnlockingAllResponseSDKType { + return o && (o.$typeUrl === MsgBeginUnlockingAllResponse.typeUrl || Array.isArray(o.unlocks) && (!o.unlocks.length || PeriodLock.isSDK(o.unlocks[0]))); + }, + isAmino(o: any): o is MsgBeginUnlockingAllResponseAmino { + return o && (o.$typeUrl === MsgBeginUnlockingAllResponse.typeUrl || Array.isArray(o.unlocks) && (!o.unlocks.length || PeriodLock.isAmino(o.unlocks[0]))); + }, encode(message: MsgBeginUnlockingAllResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.unlocks) { PeriodLock.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -708,6 +753,12 @@ export const MsgBeginUnlockingAllResponse = { typeUrl: "/osmosis.lockup.MsgBeginUnlockingAllResponse", value: MsgBeginUnlockingAllResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgBeginUnlockingAllResponse.typeUrl)) { + return; + } + PeriodLock.registerTypeUrl(); } }; function createBaseMsgBeginUnlocking(): MsgBeginUnlocking { @@ -725,6 +776,15 @@ function createBaseMsgBeginUnlocking(): MsgBeginUnlocking { export const MsgBeginUnlocking = { typeUrl: "/osmosis.lockup.MsgBeginUnlocking", aminoType: "osmosis/lockup/begin-unlock-period-lock", + is(o: any): o is MsgBeginUnlocking { + return o && (o.$typeUrl === MsgBeginUnlocking.typeUrl || typeof o.owner === "string" && typeof o.iD === "bigint" && Array.isArray(o.coins) && (!o.coins.length || Coin.is(o.coins[0]))); + }, + isSDK(o: any): o is MsgBeginUnlockingSDKType { + return o && (o.$typeUrl === MsgBeginUnlocking.typeUrl || typeof o.owner === "string" && typeof o.ID === "bigint" && Array.isArray(o.coins) && (!o.coins.length || Coin.isSDK(o.coins[0]))); + }, + isAmino(o: any): o is MsgBeginUnlockingAmino { + return o && (o.$typeUrl === MsgBeginUnlocking.typeUrl || typeof o.owner === "string" && typeof o.ID === "bigint" && Array.isArray(o.coins) && (!o.coins.length || Coin.isAmino(o.coins[0]))); + }, encode(message: MsgBeginUnlocking, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.owner !== "") { writer.uint32(10).string(message.owner); @@ -827,6 +887,12 @@ export const MsgBeginUnlocking = { typeUrl: "/osmosis.lockup.MsgBeginUnlocking", value: MsgBeginUnlocking.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgBeginUnlocking.typeUrl)) { + return; + } + Coin.registerTypeUrl(); } }; function createBaseMsgBeginUnlockingResponse(): MsgBeginUnlockingResponse { @@ -842,6 +908,15 @@ function createBaseMsgBeginUnlockingResponse(): MsgBeginUnlockingResponse { export const MsgBeginUnlockingResponse = { typeUrl: "/osmosis.lockup.MsgBeginUnlockingResponse", aminoType: "osmosis/lockup/begin-unlocking-response", + is(o: any): o is MsgBeginUnlockingResponse { + return o && (o.$typeUrl === MsgBeginUnlockingResponse.typeUrl || typeof o.success === "boolean"); + }, + isSDK(o: any): o is MsgBeginUnlockingResponseSDKType { + return o && (o.$typeUrl === MsgBeginUnlockingResponse.typeUrl || typeof o.success === "boolean"); + }, + isAmino(o: any): o is MsgBeginUnlockingResponseAmino { + return o && (o.$typeUrl === MsgBeginUnlockingResponse.typeUrl || typeof o.success === "boolean"); + }, encode(message: MsgBeginUnlockingResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.success === true) { writer.uint32(8).bool(message.success); @@ -908,7 +983,8 @@ export const MsgBeginUnlockingResponse = { typeUrl: "/osmosis.lockup.MsgBeginUnlockingResponse", value: MsgBeginUnlockingResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgExtendLockup(): MsgExtendLockup { return { @@ -927,6 +1003,15 @@ function createBaseMsgExtendLockup(): MsgExtendLockup { export const MsgExtendLockup = { typeUrl: "/osmosis.lockup.MsgExtendLockup", aminoType: "osmosis/lockup/extend-lockup", + is(o: any): o is MsgExtendLockup { + return o && (o.$typeUrl === MsgExtendLockup.typeUrl || typeof o.owner === "string" && typeof o.iD === "bigint" && Duration.is(o.duration)); + }, + isSDK(o: any): o is MsgExtendLockupSDKType { + return o && (o.$typeUrl === MsgExtendLockup.typeUrl || typeof o.owner === "string" && typeof o.ID === "bigint" && Duration.isSDK(o.duration)); + }, + isAmino(o: any): o is MsgExtendLockupAmino { + return o && (o.$typeUrl === MsgExtendLockup.typeUrl || typeof o.owner === "string" && typeof o.ID === "bigint" && Duration.isAmino(o.duration)); + }, encode(message: MsgExtendLockup, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.owner !== "") { writer.uint32(10).string(message.owner); @@ -1025,7 +1110,8 @@ export const MsgExtendLockup = { typeUrl: "/osmosis.lockup.MsgExtendLockup", value: MsgExtendLockup.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgExtendLockupResponse(): MsgExtendLockupResponse { return { @@ -1040,6 +1126,15 @@ function createBaseMsgExtendLockupResponse(): MsgExtendLockupResponse { export const MsgExtendLockupResponse = { typeUrl: "/osmosis.lockup.MsgExtendLockupResponse", aminoType: "osmosis/lockup/extend-lockup-response", + is(o: any): o is MsgExtendLockupResponse { + return o && (o.$typeUrl === MsgExtendLockupResponse.typeUrl || typeof o.success === "boolean"); + }, + isSDK(o: any): o is MsgExtendLockupResponseSDKType { + return o && (o.$typeUrl === MsgExtendLockupResponse.typeUrl || typeof o.success === "boolean"); + }, + isAmino(o: any): o is MsgExtendLockupResponseAmino { + return o && (o.$typeUrl === MsgExtendLockupResponse.typeUrl || typeof o.success === "boolean"); + }, encode(message: MsgExtendLockupResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.success === true) { writer.uint32(8).bool(message.success); @@ -1106,7 +1201,8 @@ export const MsgExtendLockupResponse = { typeUrl: "/osmosis.lockup.MsgExtendLockupResponse", value: MsgExtendLockupResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgForceUnlock(): MsgForceUnlock { return { @@ -1125,6 +1221,15 @@ function createBaseMsgForceUnlock(): MsgForceUnlock { export const MsgForceUnlock = { typeUrl: "/osmosis.lockup.MsgForceUnlock", aminoType: "osmosis/lockup/force-unlock", + is(o: any): o is MsgForceUnlock { + return o && (o.$typeUrl === MsgForceUnlock.typeUrl || typeof o.owner === "string" && typeof o.iD === "bigint" && Array.isArray(o.coins) && (!o.coins.length || Coin.is(o.coins[0]))); + }, + isSDK(o: any): o is MsgForceUnlockSDKType { + return o && (o.$typeUrl === MsgForceUnlock.typeUrl || typeof o.owner === "string" && typeof o.ID === "bigint" && Array.isArray(o.coins) && (!o.coins.length || Coin.isSDK(o.coins[0]))); + }, + isAmino(o: any): o is MsgForceUnlockAmino { + return o && (o.$typeUrl === MsgForceUnlock.typeUrl || typeof o.owner === "string" && typeof o.ID === "bigint" && Array.isArray(o.coins) && (!o.coins.length || Coin.isAmino(o.coins[0]))); + }, encode(message: MsgForceUnlock, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.owner !== "") { writer.uint32(10).string(message.owner); @@ -1227,6 +1332,12 @@ export const MsgForceUnlock = { typeUrl: "/osmosis.lockup.MsgForceUnlock", value: MsgForceUnlock.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgForceUnlock.typeUrl)) { + return; + } + Coin.registerTypeUrl(); } }; function createBaseMsgForceUnlockResponse(): MsgForceUnlockResponse { @@ -1242,6 +1353,15 @@ function createBaseMsgForceUnlockResponse(): MsgForceUnlockResponse { export const MsgForceUnlockResponse = { typeUrl: "/osmosis.lockup.MsgForceUnlockResponse", aminoType: "osmosis/lockup/force-unlock-response", + is(o: any): o is MsgForceUnlockResponse { + return o && (o.$typeUrl === MsgForceUnlockResponse.typeUrl || typeof o.success === "boolean"); + }, + isSDK(o: any): o is MsgForceUnlockResponseSDKType { + return o && (o.$typeUrl === MsgForceUnlockResponse.typeUrl || typeof o.success === "boolean"); + }, + isAmino(o: any): o is MsgForceUnlockResponseAmino { + return o && (o.$typeUrl === MsgForceUnlockResponse.typeUrl || typeof o.success === "boolean"); + }, encode(message: MsgForceUnlockResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.success === true) { writer.uint32(8).bool(message.success); @@ -1308,5 +1428,6 @@ export const MsgForceUnlockResponse = { typeUrl: "/osmosis.lockup.MsgForceUnlockResponse", value: MsgForceUnlockResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/osmosis/mint/v1beta1/genesis.ts b/__fixtures__/v-next/outputv3/osmosis/mint/v1beta1/genesis.ts index 8a18269b3d..212f7776f1 100644 --- a/__fixtures__/v-next/outputv3/osmosis/mint/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv3/osmosis/mint/v1beta1/genesis.ts @@ -1,5 +1,6 @@ import { Minter, MinterAmino, MinterSDKType, Params, ParamsAmino, ParamsSDKType } from "./mint"; import { BinaryReader, BinaryWriter } from "../../../binary"; +import { GlobalDecoderRegistry } from "../../../registry"; import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "osmosis.mint.v1beta1"; /** @@ -75,6 +76,15 @@ function createBaseGenesisState(): GenesisState { export const GenesisState = { typeUrl: "/osmosis.mint.v1beta1.GenesisState", aminoType: "osmosis/mint/genesis-state", + is(o: any): o is GenesisState { + return o && (o.$typeUrl === GenesisState.typeUrl || Minter.is(o.minter) && Params.is(o.params) && typeof o.reductionStartedEpoch === "bigint"); + }, + isSDK(o: any): o is GenesisStateSDKType { + return o && (o.$typeUrl === GenesisState.typeUrl || Minter.isSDK(o.minter) && Params.isSDK(o.params) && typeof o.reduction_started_epoch === "bigint"); + }, + isAmino(o: any): o is GenesisStateAmino { + return o && (o.$typeUrl === GenesisState.typeUrl || Minter.isAmino(o.minter) && Params.isAmino(o.params) && typeof o.reduction_started_epoch === "bigint"); + }, encode(message: GenesisState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.minter !== undefined) { Minter.encode(message.minter, writer.uint32(10).fork()).ldelim(); @@ -175,5 +185,12 @@ export const GenesisState = { typeUrl: "/osmosis.mint.v1beta1.GenesisState", value: GenesisState.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GenesisState.typeUrl)) { + return; + } + Minter.registerTypeUrl(); + Params.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/osmosis/mint/v1beta1/mint.ts b/__fixtures__/v-next/outputv3/osmosis/mint/v1beta1/mint.ts index 1da4e587c6..1d73a5696a 100644 --- a/__fixtures__/v-next/outputv3/osmosis/mint/v1beta1/mint.ts +++ b/__fixtures__/v-next/outputv3/osmosis/mint/v1beta1/mint.ts @@ -1,6 +1,7 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { Decimal } from "@cosmjs/math"; +import { Decimal } from "@interchainjs/math"; import { isSet, DeepPartial } from "../../../helpers"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "osmosis.mint.v1beta1"; /** * Minter represents the minting state. @@ -287,6 +288,15 @@ function createBaseMinter(): Minter { export const Minter = { typeUrl: "/osmosis.mint.v1beta1.Minter", aminoType: "osmosis/mint/minter", + is(o: any): o is Minter { + return o && (o.$typeUrl === Minter.typeUrl || typeof o.epochProvisions === "string"); + }, + isSDK(o: any): o is MinterSDKType { + return o && (o.$typeUrl === Minter.typeUrl || typeof o.epoch_provisions === "string"); + }, + isAmino(o: any): o is MinterAmino { + return o && (o.$typeUrl === Minter.typeUrl || typeof o.epoch_provisions === "string"); + }, encode(message: Minter, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.epochProvisions !== "") { writer.uint32(10).string(Decimal.fromUserInput(message.epochProvisions, 18).atomics); @@ -339,7 +349,7 @@ export const Minter = { }, toAmino(message: Minter, useInterfaces: boolean = true): MinterAmino { const obj: any = {}; - obj.epoch_provisions = message.epochProvisions === "" ? undefined : message.epochProvisions; + obj.epoch_provisions = message.epochProvisions === "" ? undefined : Decimal.fromUserInput(message.epochProvisions, 18).atomics; return obj; }, fromProtoMsg(message: MinterProtoMsg, useInterfaces: boolean = true): Minter { @@ -353,7 +363,8 @@ export const Minter = { typeUrl: "/osmosis.mint.v1beta1.Minter", value: Minter.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseWeightedAddress(): WeightedAddress { return { @@ -372,6 +383,15 @@ function createBaseWeightedAddress(): WeightedAddress { export const WeightedAddress = { typeUrl: "/osmosis.mint.v1beta1.WeightedAddress", aminoType: "osmosis/mint/weighted-address", + is(o: any): o is WeightedAddress { + return o && (o.$typeUrl === WeightedAddress.typeUrl || typeof o.address === "string" && typeof o.weight === "string"); + }, + isSDK(o: any): o is WeightedAddressSDKType { + return o && (o.$typeUrl === WeightedAddress.typeUrl || typeof o.address === "string" && typeof o.weight === "string"); + }, + isAmino(o: any): o is WeightedAddressAmino { + return o && (o.$typeUrl === WeightedAddress.typeUrl || typeof o.address === "string" && typeof o.weight === "string"); + }, encode(message: WeightedAddress, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.address !== "") { writer.uint32(10).string(message.address); @@ -438,7 +458,7 @@ export const WeightedAddress = { toAmino(message: WeightedAddress, useInterfaces: boolean = true): WeightedAddressAmino { const obj: any = {}; obj.address = message.address === "" ? undefined : message.address; - obj.weight = message.weight === "" ? undefined : message.weight; + obj.weight = message.weight === "" ? undefined : Decimal.fromUserInput(message.weight, 18).atomics; return obj; }, fromProtoMsg(message: WeightedAddressProtoMsg, useInterfaces: boolean = true): WeightedAddress { @@ -452,7 +472,8 @@ export const WeightedAddress = { typeUrl: "/osmosis.mint.v1beta1.WeightedAddress", value: WeightedAddress.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseDistributionProportions(): DistributionProportions { return { @@ -473,6 +494,15 @@ function createBaseDistributionProportions(): DistributionProportions { export const DistributionProportions = { typeUrl: "/osmosis.mint.v1beta1.DistributionProportions", aminoType: "osmosis/mint/distribution-proportions", + is(o: any): o is DistributionProportions { + return o && (o.$typeUrl === DistributionProportions.typeUrl || typeof o.staking === "string" && typeof o.poolIncentives === "string" && typeof o.developerRewards === "string" && typeof o.communityPool === "string"); + }, + isSDK(o: any): o is DistributionProportionsSDKType { + return o && (o.$typeUrl === DistributionProportions.typeUrl || typeof o.staking === "string" && typeof o.pool_incentives === "string" && typeof o.developer_rewards === "string" && typeof o.community_pool === "string"); + }, + isAmino(o: any): o is DistributionProportionsAmino { + return o && (o.$typeUrl === DistributionProportions.typeUrl || typeof o.staking === "string" && typeof o.pool_incentives === "string" && typeof o.developer_rewards === "string" && typeof o.community_pool === "string"); + }, encode(message: DistributionProportions, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.staking !== "") { writer.uint32(10).string(Decimal.fromUserInput(message.staking, 18).atomics); @@ -564,10 +594,10 @@ export const DistributionProportions = { }, toAmino(message: DistributionProportions, useInterfaces: boolean = true): DistributionProportionsAmino { const obj: any = {}; - obj.staking = message.staking === "" ? undefined : message.staking; - obj.pool_incentives = message.poolIncentives === "" ? undefined : message.poolIncentives; - obj.developer_rewards = message.developerRewards === "" ? undefined : message.developerRewards; - obj.community_pool = message.communityPool === "" ? undefined : message.communityPool; + obj.staking = message.staking === "" ? undefined : Decimal.fromUserInput(message.staking, 18).atomics; + obj.pool_incentives = message.poolIncentives === "" ? undefined : Decimal.fromUserInput(message.poolIncentives, 18).atomics; + obj.developer_rewards = message.developerRewards === "" ? undefined : Decimal.fromUserInput(message.developerRewards, 18).atomics; + obj.community_pool = message.communityPool === "" ? undefined : Decimal.fromUserInput(message.communityPool, 18).atomics; return obj; }, fromProtoMsg(message: DistributionProportionsProtoMsg, useInterfaces: boolean = true): DistributionProportions { @@ -581,7 +611,8 @@ export const DistributionProportions = { typeUrl: "/osmosis.mint.v1beta1.DistributionProportions", value: DistributionProportions.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseParams(): Params { return { @@ -604,6 +635,15 @@ function createBaseParams(): Params { export const Params = { typeUrl: "/osmosis.mint.v1beta1.Params", aminoType: "osmosis/mint/params", + is(o: any): o is Params { + return o && (o.$typeUrl === Params.typeUrl || typeof o.mintDenom === "string" && typeof o.genesisEpochProvisions === "string" && typeof o.epochIdentifier === "string" && typeof o.reductionPeriodInEpochs === "bigint" && typeof o.reductionFactor === "string" && DistributionProportions.is(o.distributionProportions) && Array.isArray(o.weightedDeveloperRewardsReceivers) && (!o.weightedDeveloperRewardsReceivers.length || WeightedAddress.is(o.weightedDeveloperRewardsReceivers[0])) && typeof o.mintingRewardsDistributionStartEpoch === "bigint"); + }, + isSDK(o: any): o is ParamsSDKType { + return o && (o.$typeUrl === Params.typeUrl || typeof o.mint_denom === "string" && typeof o.genesis_epoch_provisions === "string" && typeof o.epoch_identifier === "string" && typeof o.reduction_period_in_epochs === "bigint" && typeof o.reduction_factor === "string" && DistributionProportions.isSDK(o.distribution_proportions) && Array.isArray(o.weighted_developer_rewards_receivers) && (!o.weighted_developer_rewards_receivers.length || WeightedAddress.isSDK(o.weighted_developer_rewards_receivers[0])) && typeof o.minting_rewards_distribution_start_epoch === "bigint"); + }, + isAmino(o: any): o is ParamsAmino { + return o && (o.$typeUrl === Params.typeUrl || typeof o.mint_denom === "string" && typeof o.genesis_epoch_provisions === "string" && typeof o.epoch_identifier === "string" && typeof o.reduction_period_in_epochs === "bigint" && typeof o.reduction_factor === "string" && DistributionProportions.isAmino(o.distribution_proportions) && Array.isArray(o.weighted_developer_rewards_receivers) && (!o.weighted_developer_rewards_receivers.length || WeightedAddress.isAmino(o.weighted_developer_rewards_receivers[0])) && typeof o.minting_rewards_distribution_start_epoch === "bigint"); + }, encode(message: Params, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.mintDenom !== "") { writer.uint32(10).string(message.mintDenom); @@ -756,10 +796,10 @@ export const Params = { toAmino(message: Params, useInterfaces: boolean = true): ParamsAmino { const obj: any = {}; obj.mint_denom = message.mintDenom === "" ? undefined : message.mintDenom; - obj.genesis_epoch_provisions = message.genesisEpochProvisions === "" ? undefined : message.genesisEpochProvisions; + obj.genesis_epoch_provisions = message.genesisEpochProvisions === "" ? undefined : Decimal.fromUserInput(message.genesisEpochProvisions, 18).atomics; obj.epoch_identifier = message.epochIdentifier === "" ? undefined : message.epochIdentifier; obj.reduction_period_in_epochs = message.reductionPeriodInEpochs !== BigInt(0) ? message.reductionPeriodInEpochs?.toString() : undefined; - obj.reduction_factor = message.reductionFactor === "" ? undefined : message.reductionFactor; + obj.reduction_factor = message.reductionFactor === "" ? undefined : Decimal.fromUserInput(message.reductionFactor, 18).atomics; obj.distribution_proportions = message.distributionProportions ? DistributionProportions.toAmino(message.distributionProportions, useInterfaces) : undefined; if (message.weightedDeveloperRewardsReceivers) { obj.weighted_developer_rewards_receivers = message.weightedDeveloperRewardsReceivers.map(e => e ? WeightedAddress.toAmino(e, useInterfaces) : undefined); @@ -780,5 +820,12 @@ export const Params = { typeUrl: "/osmosis.mint.v1beta1.Params", value: Params.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Params.typeUrl)) { + return; + } + DistributionProportions.registerTypeUrl(); + WeightedAddress.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/osmosis/mint/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputv3/osmosis/mint/v1beta1/query.rpc.func.ts new file mode 100644 index 0000000000..18c7faa403 --- /dev/null +++ b/__fixtures__/v-next/outputv3/osmosis/mint/v1beta1/query.rpc.func.ts @@ -0,0 +1,29 @@ +import { Params, ParamsSDKType } from "./mint"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, QueryEpochProvisionsRequest, QueryEpochProvisionsRequestSDKType, QueryEpochProvisionsResponse, QueryEpochProvisionsResponseSDKType } from "./query"; +/** + * Params returns the total set of minting parameters. + * @name getParams + * @package osmosis.mint.v1beta1 + * @see proto service: osmosis.mint.v1beta1.Params + */ +export const getParams = buildQuery({ + encode: QueryParamsRequest.encode, + decode: QueryParamsResponse.decode, + service: "osmosis.mint.v1beta1.Query", + method: "Params", + deps: [QueryParamsRequest, QueryParamsResponse] +}); +/** + * EpochProvisions returns the current minting epoch provisions value. + * @name getEpochProvisions + * @package osmosis.mint.v1beta1 + * @see proto service: osmosis.mint.v1beta1.EpochProvisions + */ +export const getEpochProvisions = buildQuery({ + encode: QueryEpochProvisionsRequest.encode, + decode: QueryEpochProvisionsResponse.decode, + service: "osmosis.mint.v1beta1.Query", + method: "EpochProvisions", + deps: [QueryEpochProvisionsRequest, QueryEpochProvisionsResponse] +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/osmosis/mint/v1beta1/query.ts b/__fixtures__/v-next/outputv3/osmosis/mint/v1beta1/query.ts index c8d11ce76d..c412a3cd4b 100644 --- a/__fixtures__/v-next/outputv3/osmosis/mint/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv3/osmosis/mint/v1beta1/query.ts @@ -1,6 +1,7 @@ import { Params, ParamsAmino, ParamsSDKType } from "./mint"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { DeepPartial, isSet, bytesFromBase64, base64FromBytes } from "../../../helpers"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "osmosis.mint.v1beta1"; /** * QueryParamsRequest is the request type for the Query/Params RPC method. @@ -144,6 +145,15 @@ function createBaseQueryParamsRequest(): QueryParamsRequest { export const QueryParamsRequest = { typeUrl: "/osmosis.mint.v1beta1.QueryParamsRequest", aminoType: "osmosis/mint/query-params-request", + is(o: any): o is QueryParamsRequest { + return o && o.$typeUrl === QueryParamsRequest.typeUrl; + }, + isSDK(o: any): o is QueryParamsRequestSDKType { + return o && o.$typeUrl === QueryParamsRequest.typeUrl; + }, + isAmino(o: any): o is QueryParamsRequestAmino { + return o && o.$typeUrl === QueryParamsRequest.typeUrl; + }, encode(_: QueryParamsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -195,7 +205,8 @@ export const QueryParamsRequest = { typeUrl: "/osmosis.mint.v1beta1.QueryParamsRequest", value: QueryParamsRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryParamsResponse(): QueryParamsResponse { return { @@ -211,6 +222,15 @@ function createBaseQueryParamsResponse(): QueryParamsResponse { export const QueryParamsResponse = { typeUrl: "/osmosis.mint.v1beta1.QueryParamsResponse", aminoType: "osmosis/mint/query-params-response", + is(o: any): o is QueryParamsResponse { + return o && (o.$typeUrl === QueryParamsResponse.typeUrl || Params.is(o.params)); + }, + isSDK(o: any): o is QueryParamsResponseSDKType { + return o && (o.$typeUrl === QueryParamsResponse.typeUrl || Params.isSDK(o.params)); + }, + isAmino(o: any): o is QueryParamsResponseAmino { + return o && (o.$typeUrl === QueryParamsResponse.typeUrl || Params.isAmino(o.params)); + }, encode(message: QueryParamsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.params !== undefined) { Params.encode(message.params, writer.uint32(10).fork()).ldelim(); @@ -279,6 +299,12 @@ export const QueryParamsResponse = { typeUrl: "/osmosis.mint.v1beta1.QueryParamsResponse", value: QueryParamsResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryParamsResponse.typeUrl)) { + return; + } + Params.registerTypeUrl(); } }; function createBaseQueryEpochProvisionsRequest(): QueryEpochProvisionsRequest { @@ -294,6 +320,15 @@ function createBaseQueryEpochProvisionsRequest(): QueryEpochProvisionsRequest { export const QueryEpochProvisionsRequest = { typeUrl: "/osmosis.mint.v1beta1.QueryEpochProvisionsRequest", aminoType: "osmosis/mint/query-epoch-provisions-request", + is(o: any): o is QueryEpochProvisionsRequest { + return o && o.$typeUrl === QueryEpochProvisionsRequest.typeUrl; + }, + isSDK(o: any): o is QueryEpochProvisionsRequestSDKType { + return o && o.$typeUrl === QueryEpochProvisionsRequest.typeUrl; + }, + isAmino(o: any): o is QueryEpochProvisionsRequestAmino { + return o && o.$typeUrl === QueryEpochProvisionsRequest.typeUrl; + }, encode(_: QueryEpochProvisionsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -345,7 +380,8 @@ export const QueryEpochProvisionsRequest = { typeUrl: "/osmosis.mint.v1beta1.QueryEpochProvisionsRequest", value: QueryEpochProvisionsRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryEpochProvisionsResponse(): QueryEpochProvisionsResponse { return { @@ -362,6 +398,15 @@ function createBaseQueryEpochProvisionsResponse(): QueryEpochProvisionsResponse export const QueryEpochProvisionsResponse = { typeUrl: "/osmosis.mint.v1beta1.QueryEpochProvisionsResponse", aminoType: "osmosis/mint/query-epoch-provisions-response", + is(o: any): o is QueryEpochProvisionsResponse { + return o && (o.$typeUrl === QueryEpochProvisionsResponse.typeUrl || o.epochProvisions instanceof Uint8Array || typeof o.epochProvisions === "string"); + }, + isSDK(o: any): o is QueryEpochProvisionsResponseSDKType { + return o && (o.$typeUrl === QueryEpochProvisionsResponse.typeUrl || o.epoch_provisions instanceof Uint8Array || typeof o.epoch_provisions === "string"); + }, + isAmino(o: any): o is QueryEpochProvisionsResponseAmino { + return o && (o.$typeUrl === QueryEpochProvisionsResponse.typeUrl || o.epoch_provisions instanceof Uint8Array || typeof o.epoch_provisions === "string"); + }, encode(message: QueryEpochProvisionsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.epochProvisions.length !== 0) { writer.uint32(10).bytes(message.epochProvisions); @@ -428,5 +473,6 @@ export const QueryEpochProvisionsResponse = { typeUrl: "/osmosis.mint.v1beta1.QueryEpochProvisionsResponse", value: QueryEpochProvisionsResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/osmosis/pool-incentives/v1beta1/genesis.ts b/__fixtures__/v-next/outputv3/osmosis/pool-incentives/v1beta1/genesis.ts index 69cd90897e..a8cf9cdf6e 100644 --- a/__fixtures__/v-next/outputv3/osmosis/pool-incentives/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv3/osmosis/pool-incentives/v1beta1/genesis.ts @@ -1,6 +1,7 @@ import { Params, ParamsAmino, ParamsSDKType, DistrInfo, DistrInfoAmino, DistrInfoSDKType, PoolToGauges, PoolToGaugesAmino, PoolToGaugesSDKType } from "./incentives"; import { Duration, DurationAmino, DurationSDKType } from "../../../google/protobuf/duration"; import { BinaryReader, BinaryWriter } from "../../../binary"; +import { GlobalDecoderRegistry } from "../../../registry"; import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "osmosis.poolincentives.v1beta1"; /** @@ -66,6 +67,15 @@ function createBaseGenesisState(): GenesisState { export const GenesisState = { typeUrl: "/osmosis.poolincentives.v1beta1.GenesisState", aminoType: "osmosis/poolincentives/genesis-state", + is(o: any): o is GenesisState { + return o && (o.$typeUrl === GenesisState.typeUrl || Params.is(o.params) && Array.isArray(o.lockableDurations) && (!o.lockableDurations.length || Duration.is(o.lockableDurations[0]))); + }, + isSDK(o: any): o is GenesisStateSDKType { + return o && (o.$typeUrl === GenesisState.typeUrl || Params.isSDK(o.params) && Array.isArray(o.lockable_durations) && (!o.lockable_durations.length || Duration.isSDK(o.lockable_durations[0]))); + }, + isAmino(o: any): o is GenesisStateAmino { + return o && (o.$typeUrl === GenesisState.typeUrl || Params.isAmino(o.params) && Array.isArray(o.lockable_durations) && (!o.lockable_durations.length || Duration.isAmino(o.lockable_durations[0]))); + }, encode(message: GenesisState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.params !== undefined) { Params.encode(message.params, writer.uint32(10).fork()).ldelim(); @@ -186,5 +196,13 @@ export const GenesisState = { typeUrl: "/osmosis.poolincentives.v1beta1.GenesisState", value: GenesisState.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GenesisState.typeUrl)) { + return; + } + Params.registerTypeUrl(); + DistrInfo.registerTypeUrl(); + PoolToGauges.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/osmosis/pool-incentives/v1beta1/gov.ts b/__fixtures__/v-next/outputv3/osmosis/pool-incentives/v1beta1/gov.ts index 2d3ef1b9a2..c03c9e7e50 100644 --- a/__fixtures__/v-next/outputv3/osmosis/pool-incentives/v1beta1/gov.ts +++ b/__fixtures__/v-next/outputv3/osmosis/pool-incentives/v1beta1/gov.ts @@ -1,6 +1,7 @@ import { DistrRecord, DistrRecordAmino, DistrRecordSDKType } from "./incentives"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { isSet, DeepPartial } from "../../../helpers"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "osmosis.poolincentives.v1beta1"; /** * ReplacePoolIncentivesProposal is a gov Content type for updating the pool @@ -139,6 +140,15 @@ function createBaseReplacePoolIncentivesProposal(): ReplacePoolIncentivesProposa export const ReplacePoolIncentivesProposal = { typeUrl: "/osmosis.poolincentives.v1beta1.ReplacePoolIncentivesProposal", aminoType: "osmosis/poolincentives/replace-pool-incentives-proposal", + is(o: any): o is ReplacePoolIncentivesProposal { + return o && (o.$typeUrl === ReplacePoolIncentivesProposal.typeUrl || typeof o.title === "string" && typeof o.description === "string" && Array.isArray(o.records) && (!o.records.length || DistrRecord.is(o.records[0]))); + }, + isSDK(o: any): o is ReplacePoolIncentivesProposalSDKType { + return o && (o.$typeUrl === ReplacePoolIncentivesProposal.typeUrl || typeof o.title === "string" && typeof o.description === "string" && Array.isArray(o.records) && (!o.records.length || DistrRecord.isSDK(o.records[0]))); + }, + isAmino(o: any): o is ReplacePoolIncentivesProposalAmino { + return o && (o.$typeUrl === ReplacePoolIncentivesProposal.typeUrl || typeof o.title === "string" && typeof o.description === "string" && Array.isArray(o.records) && (!o.records.length || DistrRecord.isAmino(o.records[0]))); + }, encode(message: ReplacePoolIncentivesProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.title !== "") { writer.uint32(10).string(message.title); @@ -239,6 +249,14 @@ export const ReplacePoolIncentivesProposal = { typeUrl: "/osmosis.poolincentives.v1beta1.ReplacePoolIncentivesProposal", value: ReplacePoolIncentivesProposal.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ReplacePoolIncentivesProposal.typeUrl)) { + return; + } + GlobalDecoderRegistry.register(ReplacePoolIncentivesProposal.typeUrl, ReplacePoolIncentivesProposal); + GlobalDecoderRegistry.registerAminoProtoMapping(ReplacePoolIncentivesProposal.aminoType, ReplacePoolIncentivesProposal.typeUrl); + DistrRecord.registerTypeUrl(); } }; function createBaseUpdatePoolIncentivesProposal(): UpdatePoolIncentivesProposal { @@ -264,6 +282,15 @@ function createBaseUpdatePoolIncentivesProposal(): UpdatePoolIncentivesProposal export const UpdatePoolIncentivesProposal = { typeUrl: "/osmosis.poolincentives.v1beta1.UpdatePoolIncentivesProposal", aminoType: "osmosis/poolincentives/update-pool-incentives-proposal", + is(o: any): o is UpdatePoolIncentivesProposal { + return o && (o.$typeUrl === UpdatePoolIncentivesProposal.typeUrl || typeof o.title === "string" && typeof o.description === "string" && Array.isArray(o.records) && (!o.records.length || DistrRecord.is(o.records[0]))); + }, + isSDK(o: any): o is UpdatePoolIncentivesProposalSDKType { + return o && (o.$typeUrl === UpdatePoolIncentivesProposal.typeUrl || typeof o.title === "string" && typeof o.description === "string" && Array.isArray(o.records) && (!o.records.length || DistrRecord.isSDK(o.records[0]))); + }, + isAmino(o: any): o is UpdatePoolIncentivesProposalAmino { + return o && (o.$typeUrl === UpdatePoolIncentivesProposal.typeUrl || typeof o.title === "string" && typeof o.description === "string" && Array.isArray(o.records) && (!o.records.length || DistrRecord.isAmino(o.records[0]))); + }, encode(message: UpdatePoolIncentivesProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.title !== "") { writer.uint32(10).string(message.title); @@ -364,5 +391,13 @@ export const UpdatePoolIncentivesProposal = { typeUrl: "/osmosis.poolincentives.v1beta1.UpdatePoolIncentivesProposal", value: UpdatePoolIncentivesProposal.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(UpdatePoolIncentivesProposal.typeUrl)) { + return; + } + GlobalDecoderRegistry.register(UpdatePoolIncentivesProposal.typeUrl, UpdatePoolIncentivesProposal); + GlobalDecoderRegistry.registerAminoProtoMapping(UpdatePoolIncentivesProposal.aminoType, UpdatePoolIncentivesProposal.typeUrl); + DistrRecord.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/osmosis/pool-incentives/v1beta1/incentives.ts b/__fixtures__/v-next/outputv3/osmosis/pool-incentives/v1beta1/incentives.ts index 303335f29c..eccfa916c7 100644 --- a/__fixtures__/v-next/outputv3/osmosis/pool-incentives/v1beta1/incentives.ts +++ b/__fixtures__/v-next/outputv3/osmosis/pool-incentives/v1beta1/incentives.ts @@ -1,6 +1,7 @@ import { Duration, DurationAmino, DurationSDKType } from "../../../google/protobuf/duration"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { isSet, DeepPartial } from "../../../helpers"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "osmosis.poolincentives.v1beta1"; /** * @name Params @@ -207,6 +208,15 @@ function createBaseParams(): Params { export const Params = { typeUrl: "/osmosis.poolincentives.v1beta1.Params", aminoType: "osmosis/poolincentives/params", + is(o: any): o is Params { + return o && (o.$typeUrl === Params.typeUrl || typeof o.mintedDenom === "string"); + }, + isSDK(o: any): o is ParamsSDKType { + return o && (o.$typeUrl === Params.typeUrl || typeof o.minted_denom === "string"); + }, + isAmino(o: any): o is ParamsAmino { + return o && (o.$typeUrl === Params.typeUrl || typeof o.minted_denom === "string"); + }, encode(message: Params, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.mintedDenom !== "") { writer.uint32(10).string(message.mintedDenom); @@ -273,7 +283,8 @@ export const Params = { typeUrl: "/osmosis.poolincentives.v1beta1.Params", value: Params.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseLockableDurationsInfo(): LockableDurationsInfo { return { @@ -288,6 +299,15 @@ function createBaseLockableDurationsInfo(): LockableDurationsInfo { export const LockableDurationsInfo = { typeUrl: "/osmosis.poolincentives.v1beta1.LockableDurationsInfo", aminoType: "osmosis/poolincentives/lockable-durations-info", + is(o: any): o is LockableDurationsInfo { + return o && (o.$typeUrl === LockableDurationsInfo.typeUrl || Array.isArray(o.lockableDurations) && (!o.lockableDurations.length || Duration.is(o.lockableDurations[0]))); + }, + isSDK(o: any): o is LockableDurationsInfoSDKType { + return o && (o.$typeUrl === LockableDurationsInfo.typeUrl || Array.isArray(o.lockable_durations) && (!o.lockable_durations.length || Duration.isSDK(o.lockable_durations[0]))); + }, + isAmino(o: any): o is LockableDurationsInfoAmino { + return o && (o.$typeUrl === LockableDurationsInfo.typeUrl || Array.isArray(o.lockable_durations) && (!o.lockable_durations.length || Duration.isAmino(o.lockable_durations[0]))); + }, encode(message: LockableDurationsInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.lockableDurations) { Duration.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -360,7 +380,8 @@ export const LockableDurationsInfo = { typeUrl: "/osmosis.poolincentives.v1beta1.LockableDurationsInfo", value: LockableDurationsInfo.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseDistrInfo(): DistrInfo { return { @@ -376,6 +397,15 @@ function createBaseDistrInfo(): DistrInfo { export const DistrInfo = { typeUrl: "/osmosis.poolincentives.v1beta1.DistrInfo", aminoType: "osmosis/poolincentives/distr-info", + is(o: any): o is DistrInfo { + return o && (o.$typeUrl === DistrInfo.typeUrl || typeof o.totalWeight === "string" && Array.isArray(o.records) && (!o.records.length || DistrRecord.is(o.records[0]))); + }, + isSDK(o: any): o is DistrInfoSDKType { + return o && (o.$typeUrl === DistrInfo.typeUrl || typeof o.total_weight === "string" && Array.isArray(o.records) && (!o.records.length || DistrRecord.isSDK(o.records[0]))); + }, + isAmino(o: any): o is DistrInfoAmino { + return o && (o.$typeUrl === DistrInfo.typeUrl || typeof o.total_weight === "string" && Array.isArray(o.records) && (!o.records.length || DistrRecord.isAmino(o.records[0]))); + }, encode(message: DistrInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.totalWeight !== "") { writer.uint32(10).string(message.totalWeight); @@ -462,6 +492,12 @@ export const DistrInfo = { typeUrl: "/osmosis.poolincentives.v1beta1.DistrInfo", value: DistrInfo.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(DistrInfo.typeUrl)) { + return; + } + DistrRecord.registerTypeUrl(); } }; function createBaseDistrRecord(): DistrRecord { @@ -478,6 +514,15 @@ function createBaseDistrRecord(): DistrRecord { export const DistrRecord = { typeUrl: "/osmosis.poolincentives.v1beta1.DistrRecord", aminoType: "osmosis/poolincentives/distr-record", + is(o: any): o is DistrRecord { + return o && (o.$typeUrl === DistrRecord.typeUrl || typeof o.gaugeId === "bigint" && typeof o.weight === "string"); + }, + isSDK(o: any): o is DistrRecordSDKType { + return o && (o.$typeUrl === DistrRecord.typeUrl || typeof o.gauge_id === "bigint" && typeof o.weight === "string"); + }, + isAmino(o: any): o is DistrRecordAmino { + return o && (o.$typeUrl === DistrRecord.typeUrl || typeof o.gauge_id === "bigint" && typeof o.weight === "string"); + }, encode(message: DistrRecord, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.gaugeId !== BigInt(0)) { writer.uint32(8).uint64(message.gaugeId); @@ -560,7 +605,8 @@ export const DistrRecord = { typeUrl: "/osmosis.poolincentives.v1beta1.DistrRecord", value: DistrRecord.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBasePoolToGauge(): PoolToGauge { return { @@ -577,6 +623,15 @@ function createBasePoolToGauge(): PoolToGauge { export const PoolToGauge = { typeUrl: "/osmosis.poolincentives.v1beta1.PoolToGauge", aminoType: "osmosis/poolincentives/pool-to-gauge", + is(o: any): o is PoolToGauge { + return o && (o.$typeUrl === PoolToGauge.typeUrl || typeof o.poolId === "bigint" && typeof o.gaugeId === "bigint" && Duration.is(o.duration)); + }, + isSDK(o: any): o is PoolToGaugeSDKType { + return o && (o.$typeUrl === PoolToGauge.typeUrl || typeof o.pool_id === "bigint" && typeof o.gauge_id === "bigint" && Duration.isSDK(o.duration)); + }, + isAmino(o: any): o is PoolToGaugeAmino { + return o && (o.$typeUrl === PoolToGauge.typeUrl || typeof o.pool_id === "bigint" && typeof o.gauge_id === "bigint" && Duration.isAmino(o.duration)); + }, encode(message: PoolToGauge, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.poolId !== BigInt(0)) { writer.uint32(8).uint64(message.poolId); @@ -677,7 +732,8 @@ export const PoolToGauge = { typeUrl: "/osmosis.poolincentives.v1beta1.PoolToGauge", value: PoolToGauge.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBasePoolToGauges(): PoolToGauges { return { @@ -692,6 +748,15 @@ function createBasePoolToGauges(): PoolToGauges { export const PoolToGauges = { typeUrl: "/osmosis.poolincentives.v1beta1.PoolToGauges", aminoType: "osmosis/poolincentives/pool-to-gauges", + is(o: any): o is PoolToGauges { + return o && (o.$typeUrl === PoolToGauges.typeUrl || Array.isArray(o.poolToGauge) && (!o.poolToGauge.length || PoolToGauge.is(o.poolToGauge[0]))); + }, + isSDK(o: any): o is PoolToGaugesSDKType { + return o && (o.$typeUrl === PoolToGauges.typeUrl || Array.isArray(o.pool_to_gauge) && (!o.pool_to_gauge.length || PoolToGauge.isSDK(o.pool_to_gauge[0]))); + }, + isAmino(o: any): o is PoolToGaugesAmino { + return o && (o.$typeUrl === PoolToGauges.typeUrl || Array.isArray(o.pool_to_gauge) && (!o.pool_to_gauge.length || PoolToGauge.isAmino(o.pool_to_gauge[0]))); + }, encode(message: PoolToGauges, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.poolToGauge) { PoolToGauge.encode(v!, writer.uint32(18).fork()).ldelim(); @@ -764,5 +829,11 @@ export const PoolToGauges = { typeUrl: "/osmosis.poolincentives.v1beta1.PoolToGauges", value: PoolToGauges.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(PoolToGauges.typeUrl)) { + return; + } + PoolToGauge.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/osmosis/pool-incentives/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputv3/osmosis/pool-incentives/v1beta1/query.rpc.func.ts new file mode 100644 index 0000000000..9ce35d1701 --- /dev/null +++ b/__fixtures__/v-next/outputv3/osmosis/pool-incentives/v1beta1/query.rpc.func.ts @@ -0,0 +1,83 @@ +import { Duration, DurationSDKType } from "../../../google/protobuf/duration"; +import { DistrInfo, DistrInfoSDKType, Params, ParamsSDKType } from "./incentives"; +import { Gauge, GaugeSDKType } from "../../incentives/gauge"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { QueryGaugeIdsRequest, QueryGaugeIdsRequestSDKType, QueryGaugeIdsResponse, QueryGaugeIdsResponseSDKType, QueryDistrInfoRequest, QueryDistrInfoRequestSDKType, QueryDistrInfoResponse, QueryDistrInfoResponseSDKType, QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, QueryLockableDurationsRequest, QueryLockableDurationsRequestSDKType, QueryLockableDurationsResponse, QueryLockableDurationsResponseSDKType, QueryIncentivizedPoolsRequest, QueryIncentivizedPoolsRequestSDKType, QueryIncentivizedPoolsResponse, QueryIncentivizedPoolsResponseSDKType, QueryExternalIncentiveGaugesRequest, QueryExternalIncentiveGaugesRequestSDKType, QueryExternalIncentiveGaugesResponse, QueryExternalIncentiveGaugesResponseSDKType } from "./query"; +/** + * GaugeIds takes the pool id and returns the matching gauge ids and durations + * @name getGaugeIds + * @package osmosis.poolincentives.v1beta1 + * @see proto service: osmosis.poolincentives.v1beta1.GaugeIds + */ +export const getGaugeIds = buildQuery({ + encode: QueryGaugeIdsRequest.encode, + decode: QueryGaugeIdsResponse.decode, + service: "osmosis.poolincentives.v1beta1.Query", + method: "GaugeIds", + deps: [QueryGaugeIdsRequest, QueryGaugeIdsResponse] +}); +/** + * DistrInfo returns the pool's matching gauge ids and weights. + * @name getDistrInfo + * @package osmosis.poolincentives.v1beta1 + * @see proto service: osmosis.poolincentives.v1beta1.DistrInfo + */ +export const getDistrInfo = buildQuery({ + encode: QueryDistrInfoRequest.encode, + decode: QueryDistrInfoResponse.decode, + service: "osmosis.poolincentives.v1beta1.Query", + method: "DistrInfo", + deps: [QueryDistrInfoRequest, QueryDistrInfoResponse] +}); +/** + * Params returns pool incentives params. + * @name getParams + * @package osmosis.poolincentives.v1beta1 + * @see proto service: osmosis.poolincentives.v1beta1.Params + */ +export const getParams = buildQuery({ + encode: QueryParamsRequest.encode, + decode: QueryParamsResponse.decode, + service: "osmosis.poolincentives.v1beta1.Query", + method: "Params", + deps: [QueryParamsRequest, QueryParamsResponse] +}); +/** + * LockableDurations returns lock durations for pools. + * @name getLockableDurations + * @package osmosis.poolincentives.v1beta1 + * @see proto service: osmosis.poolincentives.v1beta1.LockableDurations + */ +export const getLockableDurations = buildQuery({ + encode: QueryLockableDurationsRequest.encode, + decode: QueryLockableDurationsResponse.decode, + service: "osmosis.poolincentives.v1beta1.Query", + method: "LockableDurations", + deps: [QueryLockableDurationsRequest, QueryLockableDurationsResponse] +}); +/** + * IncentivizedPools returns currently incentivized pools + * @name getIncentivizedPools + * @package osmosis.poolincentives.v1beta1 + * @see proto service: osmosis.poolincentives.v1beta1.IncentivizedPools + */ +export const getIncentivizedPools = buildQuery({ + encode: QueryIncentivizedPoolsRequest.encode, + decode: QueryIncentivizedPoolsResponse.decode, + service: "osmosis.poolincentives.v1beta1.Query", + method: "IncentivizedPools", + deps: [QueryIncentivizedPoolsRequest, QueryIncentivizedPoolsResponse] +}); +/** + * ExternalIncentiveGauges returns external incentive gauges. + * @name getExternalIncentiveGauges + * @package osmosis.poolincentives.v1beta1 + * @see proto service: osmosis.poolincentives.v1beta1.ExternalIncentiveGauges + */ +export const getExternalIncentiveGauges = buildQuery({ + encode: QueryExternalIncentiveGaugesRequest.encode, + decode: QueryExternalIncentiveGaugesResponse.decode, + service: "osmosis.poolincentives.v1beta1.Query", + method: "ExternalIncentiveGauges", + deps: [QueryExternalIncentiveGaugesRequest, QueryExternalIncentiveGaugesResponse] +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/osmosis/pool-incentives/v1beta1/query.ts b/__fixtures__/v-next/outputv3/osmosis/pool-incentives/v1beta1/query.ts index 383d241e46..ec98ab6d54 100644 --- a/__fixtures__/v-next/outputv3/osmosis/pool-incentives/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv3/osmosis/pool-incentives/v1beta1/query.ts @@ -3,6 +3,7 @@ import { DistrInfo, DistrInfoAmino, DistrInfoSDKType, Params, ParamsAmino, Param import { Gauge, GaugeAmino, GaugeSDKType } from "../../incentives/gauge"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { isSet, DeepPartial } from "../../../helpers"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "osmosis.poolincentives.v1beta1"; /** * @name QueryGaugeIdsRequest @@ -391,6 +392,15 @@ function createBaseQueryGaugeIdsRequest(): QueryGaugeIdsRequest { export const QueryGaugeIdsRequest = { typeUrl: "/osmosis.poolincentives.v1beta1.QueryGaugeIdsRequest", aminoType: "osmosis/poolincentives/query-gauge-ids-request", + is(o: any): o is QueryGaugeIdsRequest { + return o && (o.$typeUrl === QueryGaugeIdsRequest.typeUrl || typeof o.poolId === "bigint"); + }, + isSDK(o: any): o is QueryGaugeIdsRequestSDKType { + return o && (o.$typeUrl === QueryGaugeIdsRequest.typeUrl || typeof o.pool_id === "bigint"); + }, + isAmino(o: any): o is QueryGaugeIdsRequestAmino { + return o && (o.$typeUrl === QueryGaugeIdsRequest.typeUrl || typeof o.pool_id === "bigint"); + }, encode(message: QueryGaugeIdsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.poolId !== BigInt(0)) { writer.uint32(8).uint64(message.poolId); @@ -459,7 +469,8 @@ export const QueryGaugeIdsRequest = { typeUrl: "/osmosis.poolincentives.v1beta1.QueryGaugeIdsRequest", value: QueryGaugeIdsRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryGaugeIdsResponse(): QueryGaugeIdsResponse { return { @@ -474,6 +485,15 @@ function createBaseQueryGaugeIdsResponse(): QueryGaugeIdsResponse { export const QueryGaugeIdsResponse = { typeUrl: "/osmosis.poolincentives.v1beta1.QueryGaugeIdsResponse", aminoType: "osmosis/poolincentives/query-gauge-ids-response", + is(o: any): o is QueryGaugeIdsResponse { + return o && (o.$typeUrl === QueryGaugeIdsResponse.typeUrl || Array.isArray(o.gaugeIdsWithDuration) && (!o.gaugeIdsWithDuration.length || QueryGaugeIdsResponse_GaugeIdWithDuration.is(o.gaugeIdsWithDuration[0]))); + }, + isSDK(o: any): o is QueryGaugeIdsResponseSDKType { + return o && (o.$typeUrl === QueryGaugeIdsResponse.typeUrl || Array.isArray(o.gauge_ids_with_duration) && (!o.gauge_ids_with_duration.length || QueryGaugeIdsResponse_GaugeIdWithDuration.isSDK(o.gauge_ids_with_duration[0]))); + }, + isAmino(o: any): o is QueryGaugeIdsResponseAmino { + return o && (o.$typeUrl === QueryGaugeIdsResponse.typeUrl || Array.isArray(o.gauge_ids_with_duration) && (!o.gauge_ids_with_duration.length || QueryGaugeIdsResponse_GaugeIdWithDuration.isAmino(o.gauge_ids_with_duration[0]))); + }, encode(message: QueryGaugeIdsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.gaugeIdsWithDuration) { QueryGaugeIdsResponse_GaugeIdWithDuration.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -546,6 +566,12 @@ export const QueryGaugeIdsResponse = { typeUrl: "/osmosis.poolincentives.v1beta1.QueryGaugeIdsResponse", value: QueryGaugeIdsResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryGaugeIdsResponse.typeUrl)) { + return; + } + QueryGaugeIdsResponse_GaugeIdWithDuration.registerTypeUrl(); } }; function createBaseQueryGaugeIdsResponse_GaugeIdWithDuration(): QueryGaugeIdsResponse_GaugeIdWithDuration { @@ -563,6 +589,15 @@ function createBaseQueryGaugeIdsResponse_GaugeIdWithDuration(): QueryGaugeIdsRes export const QueryGaugeIdsResponse_GaugeIdWithDuration = { typeUrl: "/osmosis.poolincentives.v1beta1.GaugeIdWithDuration", aminoType: "osmosis/poolincentives/gauge-id-with-duration", + is(o: any): o is QueryGaugeIdsResponse_GaugeIdWithDuration { + return o && (o.$typeUrl === QueryGaugeIdsResponse_GaugeIdWithDuration.typeUrl || typeof o.gaugeId === "bigint" && Duration.is(o.duration) && typeof o.gaugeIncentivePercentage === "string"); + }, + isSDK(o: any): o is QueryGaugeIdsResponse_GaugeIdWithDurationSDKType { + return o && (o.$typeUrl === QueryGaugeIdsResponse_GaugeIdWithDuration.typeUrl || typeof o.gauge_id === "bigint" && Duration.isSDK(o.duration) && typeof o.gauge_incentive_percentage === "string"); + }, + isAmino(o: any): o is QueryGaugeIdsResponse_GaugeIdWithDurationAmino { + return o && (o.$typeUrl === QueryGaugeIdsResponse_GaugeIdWithDuration.typeUrl || typeof o.gauge_id === "bigint" && Duration.isAmino(o.duration) && typeof o.gauge_incentive_percentage === "string"); + }, encode(message: QueryGaugeIdsResponse_GaugeIdWithDuration, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.gaugeId !== BigInt(0)) { writer.uint32(8).uint64(message.gaugeId); @@ -661,7 +696,8 @@ export const QueryGaugeIdsResponse_GaugeIdWithDuration = { typeUrl: "/osmosis.poolincentives.v1beta1.GaugeIdWithDuration", value: QueryGaugeIdsResponse_GaugeIdWithDuration.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryDistrInfoRequest(): QueryDistrInfoRequest { return {}; @@ -674,6 +710,15 @@ function createBaseQueryDistrInfoRequest(): QueryDistrInfoRequest { export const QueryDistrInfoRequest = { typeUrl: "/osmosis.poolincentives.v1beta1.QueryDistrInfoRequest", aminoType: "osmosis/poolincentives/query-distr-info-request", + is(o: any): o is QueryDistrInfoRequest { + return o && o.$typeUrl === QueryDistrInfoRequest.typeUrl; + }, + isSDK(o: any): o is QueryDistrInfoRequestSDKType { + return o && o.$typeUrl === QueryDistrInfoRequest.typeUrl; + }, + isAmino(o: any): o is QueryDistrInfoRequestAmino { + return o && o.$typeUrl === QueryDistrInfoRequest.typeUrl; + }, encode(_: QueryDistrInfoRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -725,7 +770,8 @@ export const QueryDistrInfoRequest = { typeUrl: "/osmosis.poolincentives.v1beta1.QueryDistrInfoRequest", value: QueryDistrInfoRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryDistrInfoResponse(): QueryDistrInfoResponse { return { @@ -740,6 +786,15 @@ function createBaseQueryDistrInfoResponse(): QueryDistrInfoResponse { export const QueryDistrInfoResponse = { typeUrl: "/osmosis.poolincentives.v1beta1.QueryDistrInfoResponse", aminoType: "osmosis/poolincentives/query-distr-info-response", + is(o: any): o is QueryDistrInfoResponse { + return o && (o.$typeUrl === QueryDistrInfoResponse.typeUrl || DistrInfo.is(o.distrInfo)); + }, + isSDK(o: any): o is QueryDistrInfoResponseSDKType { + return o && (o.$typeUrl === QueryDistrInfoResponse.typeUrl || DistrInfo.isSDK(o.distr_info)); + }, + isAmino(o: any): o is QueryDistrInfoResponseAmino { + return o && (o.$typeUrl === QueryDistrInfoResponse.typeUrl || DistrInfo.isAmino(o.distr_info)); + }, encode(message: QueryDistrInfoResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.distrInfo !== undefined) { DistrInfo.encode(message.distrInfo, writer.uint32(10).fork()).ldelim(); @@ -808,6 +863,12 @@ export const QueryDistrInfoResponse = { typeUrl: "/osmosis.poolincentives.v1beta1.QueryDistrInfoResponse", value: QueryDistrInfoResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryDistrInfoResponse.typeUrl)) { + return; + } + DistrInfo.registerTypeUrl(); } }; function createBaseQueryParamsRequest(): QueryParamsRequest { @@ -821,6 +882,15 @@ function createBaseQueryParamsRequest(): QueryParamsRequest { export const QueryParamsRequest = { typeUrl: "/osmosis.poolincentives.v1beta1.QueryParamsRequest", aminoType: "osmosis/poolincentives/query-params-request", + is(o: any): o is QueryParamsRequest { + return o && o.$typeUrl === QueryParamsRequest.typeUrl; + }, + isSDK(o: any): o is QueryParamsRequestSDKType { + return o && o.$typeUrl === QueryParamsRequest.typeUrl; + }, + isAmino(o: any): o is QueryParamsRequestAmino { + return o && o.$typeUrl === QueryParamsRequest.typeUrl; + }, encode(_: QueryParamsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -872,7 +942,8 @@ export const QueryParamsRequest = { typeUrl: "/osmosis.poolincentives.v1beta1.QueryParamsRequest", value: QueryParamsRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryParamsResponse(): QueryParamsResponse { return { @@ -887,6 +958,15 @@ function createBaseQueryParamsResponse(): QueryParamsResponse { export const QueryParamsResponse = { typeUrl: "/osmosis.poolincentives.v1beta1.QueryParamsResponse", aminoType: "osmosis/poolincentives/query-params-response", + is(o: any): o is QueryParamsResponse { + return o && (o.$typeUrl === QueryParamsResponse.typeUrl || Params.is(o.params)); + }, + isSDK(o: any): o is QueryParamsResponseSDKType { + return o && (o.$typeUrl === QueryParamsResponse.typeUrl || Params.isSDK(o.params)); + }, + isAmino(o: any): o is QueryParamsResponseAmino { + return o && (o.$typeUrl === QueryParamsResponse.typeUrl || Params.isAmino(o.params)); + }, encode(message: QueryParamsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.params !== undefined) { Params.encode(message.params, writer.uint32(10).fork()).ldelim(); @@ -955,6 +1035,12 @@ export const QueryParamsResponse = { typeUrl: "/osmosis.poolincentives.v1beta1.QueryParamsResponse", value: QueryParamsResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryParamsResponse.typeUrl)) { + return; + } + Params.registerTypeUrl(); } }; function createBaseQueryLockableDurationsRequest(): QueryLockableDurationsRequest { @@ -968,6 +1054,15 @@ function createBaseQueryLockableDurationsRequest(): QueryLockableDurationsReques export const QueryLockableDurationsRequest = { typeUrl: "/osmosis.poolincentives.v1beta1.QueryLockableDurationsRequest", aminoType: "osmosis/poolincentives/query-lockable-durations-request", + is(o: any): o is QueryLockableDurationsRequest { + return o && o.$typeUrl === QueryLockableDurationsRequest.typeUrl; + }, + isSDK(o: any): o is QueryLockableDurationsRequestSDKType { + return o && o.$typeUrl === QueryLockableDurationsRequest.typeUrl; + }, + isAmino(o: any): o is QueryLockableDurationsRequestAmino { + return o && o.$typeUrl === QueryLockableDurationsRequest.typeUrl; + }, encode(_: QueryLockableDurationsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -1019,7 +1114,8 @@ export const QueryLockableDurationsRequest = { typeUrl: "/osmosis.poolincentives.v1beta1.QueryLockableDurationsRequest", value: QueryLockableDurationsRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryLockableDurationsResponse(): QueryLockableDurationsResponse { return { @@ -1034,6 +1130,15 @@ function createBaseQueryLockableDurationsResponse(): QueryLockableDurationsRespo export const QueryLockableDurationsResponse = { typeUrl: "/osmosis.poolincentives.v1beta1.QueryLockableDurationsResponse", aminoType: "osmosis/poolincentives/query-lockable-durations-response", + is(o: any): o is QueryLockableDurationsResponse { + return o && (o.$typeUrl === QueryLockableDurationsResponse.typeUrl || Array.isArray(o.lockableDurations) && (!o.lockableDurations.length || Duration.is(o.lockableDurations[0]))); + }, + isSDK(o: any): o is QueryLockableDurationsResponseSDKType { + return o && (o.$typeUrl === QueryLockableDurationsResponse.typeUrl || Array.isArray(o.lockable_durations) && (!o.lockable_durations.length || Duration.isSDK(o.lockable_durations[0]))); + }, + isAmino(o: any): o is QueryLockableDurationsResponseAmino { + return o && (o.$typeUrl === QueryLockableDurationsResponse.typeUrl || Array.isArray(o.lockable_durations) && (!o.lockable_durations.length || Duration.isAmino(o.lockable_durations[0]))); + }, encode(message: QueryLockableDurationsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.lockableDurations) { Duration.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -1106,7 +1211,8 @@ export const QueryLockableDurationsResponse = { typeUrl: "/osmosis.poolincentives.v1beta1.QueryLockableDurationsResponse", value: QueryLockableDurationsResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryIncentivizedPoolsRequest(): QueryIncentivizedPoolsRequest { return {}; @@ -1119,6 +1225,15 @@ function createBaseQueryIncentivizedPoolsRequest(): QueryIncentivizedPoolsReques export const QueryIncentivizedPoolsRequest = { typeUrl: "/osmosis.poolincentives.v1beta1.QueryIncentivizedPoolsRequest", aminoType: "osmosis/poolincentives/query-incentivized-pools-request", + is(o: any): o is QueryIncentivizedPoolsRequest { + return o && o.$typeUrl === QueryIncentivizedPoolsRequest.typeUrl; + }, + isSDK(o: any): o is QueryIncentivizedPoolsRequestSDKType { + return o && o.$typeUrl === QueryIncentivizedPoolsRequest.typeUrl; + }, + isAmino(o: any): o is QueryIncentivizedPoolsRequestAmino { + return o && o.$typeUrl === QueryIncentivizedPoolsRequest.typeUrl; + }, encode(_: QueryIncentivizedPoolsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -1170,7 +1285,8 @@ export const QueryIncentivizedPoolsRequest = { typeUrl: "/osmosis.poolincentives.v1beta1.QueryIncentivizedPoolsRequest", value: QueryIncentivizedPoolsRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseIncentivizedPool(): IncentivizedPool { return { @@ -1187,6 +1303,15 @@ function createBaseIncentivizedPool(): IncentivizedPool { export const IncentivizedPool = { typeUrl: "/osmosis.poolincentives.v1beta1.IncentivizedPool", aminoType: "osmosis/poolincentives/incentivized-pool", + is(o: any): o is IncentivizedPool { + return o && (o.$typeUrl === IncentivizedPool.typeUrl || typeof o.poolId === "bigint" && Duration.is(o.lockableDuration) && typeof o.gaugeId === "bigint"); + }, + isSDK(o: any): o is IncentivizedPoolSDKType { + return o && (o.$typeUrl === IncentivizedPool.typeUrl || typeof o.pool_id === "bigint" && Duration.isSDK(o.lockable_duration) && typeof o.gauge_id === "bigint"); + }, + isAmino(o: any): o is IncentivizedPoolAmino { + return o && (o.$typeUrl === IncentivizedPool.typeUrl || typeof o.pool_id === "bigint" && Duration.isAmino(o.lockable_duration) && typeof o.gauge_id === "bigint"); + }, encode(message: IncentivizedPool, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.poolId !== BigInt(0)) { writer.uint32(8).uint64(message.poolId); @@ -1287,7 +1412,8 @@ export const IncentivizedPool = { typeUrl: "/osmosis.poolincentives.v1beta1.IncentivizedPool", value: IncentivizedPool.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryIncentivizedPoolsResponse(): QueryIncentivizedPoolsResponse { return { @@ -1302,6 +1428,15 @@ function createBaseQueryIncentivizedPoolsResponse(): QueryIncentivizedPoolsRespo export const QueryIncentivizedPoolsResponse = { typeUrl: "/osmosis.poolincentives.v1beta1.QueryIncentivizedPoolsResponse", aminoType: "osmosis/poolincentives/query-incentivized-pools-response", + is(o: any): o is QueryIncentivizedPoolsResponse { + return o && (o.$typeUrl === QueryIncentivizedPoolsResponse.typeUrl || Array.isArray(o.incentivizedPools) && (!o.incentivizedPools.length || IncentivizedPool.is(o.incentivizedPools[0]))); + }, + isSDK(o: any): o is QueryIncentivizedPoolsResponseSDKType { + return o && (o.$typeUrl === QueryIncentivizedPoolsResponse.typeUrl || Array.isArray(o.incentivized_pools) && (!o.incentivized_pools.length || IncentivizedPool.isSDK(o.incentivized_pools[0]))); + }, + isAmino(o: any): o is QueryIncentivizedPoolsResponseAmino { + return o && (o.$typeUrl === QueryIncentivizedPoolsResponse.typeUrl || Array.isArray(o.incentivized_pools) && (!o.incentivized_pools.length || IncentivizedPool.isAmino(o.incentivized_pools[0]))); + }, encode(message: QueryIncentivizedPoolsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.incentivizedPools) { IncentivizedPool.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -1374,6 +1509,12 @@ export const QueryIncentivizedPoolsResponse = { typeUrl: "/osmosis.poolincentives.v1beta1.QueryIncentivizedPoolsResponse", value: QueryIncentivizedPoolsResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryIncentivizedPoolsResponse.typeUrl)) { + return; + } + IncentivizedPool.registerTypeUrl(); } }; function createBaseQueryExternalIncentiveGaugesRequest(): QueryExternalIncentiveGaugesRequest { @@ -1387,6 +1528,15 @@ function createBaseQueryExternalIncentiveGaugesRequest(): QueryExternalIncentive export const QueryExternalIncentiveGaugesRequest = { typeUrl: "/osmosis.poolincentives.v1beta1.QueryExternalIncentiveGaugesRequest", aminoType: "osmosis/poolincentives/query-external-incentive-gauges-request", + is(o: any): o is QueryExternalIncentiveGaugesRequest { + return o && o.$typeUrl === QueryExternalIncentiveGaugesRequest.typeUrl; + }, + isSDK(o: any): o is QueryExternalIncentiveGaugesRequestSDKType { + return o && o.$typeUrl === QueryExternalIncentiveGaugesRequest.typeUrl; + }, + isAmino(o: any): o is QueryExternalIncentiveGaugesRequestAmino { + return o && o.$typeUrl === QueryExternalIncentiveGaugesRequest.typeUrl; + }, encode(_: QueryExternalIncentiveGaugesRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -1438,7 +1588,8 @@ export const QueryExternalIncentiveGaugesRequest = { typeUrl: "/osmosis.poolincentives.v1beta1.QueryExternalIncentiveGaugesRequest", value: QueryExternalIncentiveGaugesRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryExternalIncentiveGaugesResponse(): QueryExternalIncentiveGaugesResponse { return { @@ -1453,6 +1604,15 @@ function createBaseQueryExternalIncentiveGaugesResponse(): QueryExternalIncentiv export const QueryExternalIncentiveGaugesResponse = { typeUrl: "/osmosis.poolincentives.v1beta1.QueryExternalIncentiveGaugesResponse", aminoType: "osmosis/poolincentives/query-external-incentive-gauges-response", + is(o: any): o is QueryExternalIncentiveGaugesResponse { + return o && (o.$typeUrl === QueryExternalIncentiveGaugesResponse.typeUrl || Array.isArray(o.data) && (!o.data.length || Gauge.is(o.data[0]))); + }, + isSDK(o: any): o is QueryExternalIncentiveGaugesResponseSDKType { + return o && (o.$typeUrl === QueryExternalIncentiveGaugesResponse.typeUrl || Array.isArray(o.data) && (!o.data.length || Gauge.isSDK(o.data[0]))); + }, + isAmino(o: any): o is QueryExternalIncentiveGaugesResponseAmino { + return o && (o.$typeUrl === QueryExternalIncentiveGaugesResponse.typeUrl || Array.isArray(o.data) && (!o.data.length || Gauge.isAmino(o.data[0]))); + }, encode(message: QueryExternalIncentiveGaugesResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.data) { Gauge.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -1525,5 +1685,11 @@ export const QueryExternalIncentiveGaugesResponse = { typeUrl: "/osmosis.poolincentives.v1beta1.QueryExternalIncentiveGaugesResponse", value: QueryExternalIncentiveGaugesResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryExternalIncentiveGaugesResponse.typeUrl)) { + return; + } + Gauge.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/osmosis/sumtree/v1beta1/tree.ts b/__fixtures__/v-next/outputv3/osmosis/sumtree/v1beta1/tree.ts index 7aafc83c46..79393b760d 100644 --- a/__fixtures__/v-next/outputv3/osmosis/sumtree/v1beta1/tree.ts +++ b/__fixtures__/v-next/outputv3/osmosis/sumtree/v1beta1/tree.ts @@ -1,5 +1,6 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; import { DeepPartial, isSet, bytesFromBase64, base64FromBytes } from "../../../helpers"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "osmosis.store.v1beta1"; /** * @name Node @@ -101,6 +102,15 @@ function createBaseNode(): Node { export const Node = { typeUrl: "/osmosis.store.v1beta1.Node", aminoType: "osmosis/store/node", + is(o: any): o is Node { + return o && (o.$typeUrl === Node.typeUrl || Array.isArray(o.children) && (!o.children.length || Child.is(o.children[0]))); + }, + isSDK(o: any): o is NodeSDKType { + return o && (o.$typeUrl === Node.typeUrl || Array.isArray(o.children) && (!o.children.length || Child.isSDK(o.children[0]))); + }, + isAmino(o: any): o is NodeAmino { + return o && (o.$typeUrl === Node.typeUrl || Array.isArray(o.children) && (!o.children.length || Child.isAmino(o.children[0]))); + }, encode(message: Node, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.children) { Child.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -173,6 +183,12 @@ export const Node = { typeUrl: "/osmosis.store.v1beta1.Node", value: Node.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Node.typeUrl)) { + return; + } + Child.registerTypeUrl(); } }; function createBaseChild(): Child { @@ -189,6 +205,15 @@ function createBaseChild(): Child { export const Child = { typeUrl: "/osmosis.store.v1beta1.Child", aminoType: "osmosis/store/child", + is(o: any): o is Child { + return o && (o.$typeUrl === Child.typeUrl || (o.index instanceof Uint8Array || typeof o.index === "string") && typeof o.accumulation === "string"); + }, + isSDK(o: any): o is ChildSDKType { + return o && (o.$typeUrl === Child.typeUrl || (o.index instanceof Uint8Array || typeof o.index === "string") && typeof o.accumulation === "string"); + }, + isAmino(o: any): o is ChildAmino { + return o && (o.$typeUrl === Child.typeUrl || (o.index instanceof Uint8Array || typeof o.index === "string") && typeof o.accumulation === "string"); + }, encode(message: Child, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.index.length !== 0) { writer.uint32(10).bytes(message.index); @@ -269,7 +294,8 @@ export const Child = { typeUrl: "/osmosis.store.v1beta1.Child", value: Child.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseLeaf(): Leaf { return { @@ -284,6 +310,15 @@ function createBaseLeaf(): Leaf { export const Leaf = { typeUrl: "/osmosis.store.v1beta1.Leaf", aminoType: "osmosis/store/leaf", + is(o: any): o is Leaf { + return o && o.$typeUrl === Leaf.typeUrl; + }, + isSDK(o: any): o is LeafSDKType { + return o && o.$typeUrl === Leaf.typeUrl; + }, + isAmino(o: any): o is LeafAmino { + return o && o.$typeUrl === Leaf.typeUrl; + }, encode(message: Leaf, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.leaf !== undefined) { Child.encode(message.leaf, writer.uint32(10).fork()).ldelim(); @@ -352,5 +387,11 @@ export const Leaf = { typeUrl: "/osmosis.store.v1beta1.Leaf", value: Leaf.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Leaf.typeUrl)) { + return; + } + Child.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/osmosis/superfluid/genesis.ts b/__fixtures__/v-next/outputv3/osmosis/superfluid/genesis.ts index 70a843914c..198e0d83e0 100644 --- a/__fixtures__/v-next/outputv3/osmosis/superfluid/genesis.ts +++ b/__fixtures__/v-next/outputv3/osmosis/superfluid/genesis.ts @@ -1,6 +1,7 @@ import { Params, ParamsAmino, ParamsSDKType } from "./params"; import { SuperfluidAsset, SuperfluidAssetAmino, SuperfluidAssetSDKType, OsmoEquivalentMultiplierRecord, OsmoEquivalentMultiplierRecordAmino, OsmoEquivalentMultiplierRecordSDKType, SuperfluidIntermediaryAccount, SuperfluidIntermediaryAccountAmino, SuperfluidIntermediaryAccountSDKType, LockIdIntermediaryAccountConnection, LockIdIntermediaryAccountConnectionAmino, LockIdIntermediaryAccountConnectionSDKType } from "./superfluid"; import { BinaryReader, BinaryWriter } from "../../binary"; +import { GlobalDecoderRegistry } from "../../registry"; import { isSet, DeepPartial } from "../../helpers"; export const protobufPackage = "osmosis.superfluid"; /** @@ -88,6 +89,15 @@ function createBaseGenesisState(): GenesisState { export const GenesisState = { typeUrl: "/osmosis.superfluid.GenesisState", aminoType: "osmosis/genesis-state", + is(o: any): o is GenesisState { + return o && (o.$typeUrl === GenesisState.typeUrl || Params.is(o.params) && Array.isArray(o.superfluidAssets) && (!o.superfluidAssets.length || SuperfluidAsset.is(o.superfluidAssets[0])) && Array.isArray(o.osmoEquivalentMultipliers) && (!o.osmoEquivalentMultipliers.length || OsmoEquivalentMultiplierRecord.is(o.osmoEquivalentMultipliers[0])) && Array.isArray(o.intermediaryAccounts) && (!o.intermediaryAccounts.length || SuperfluidIntermediaryAccount.is(o.intermediaryAccounts[0])) && Array.isArray(o.intemediaryAccountConnections) && (!o.intemediaryAccountConnections.length || LockIdIntermediaryAccountConnection.is(o.intemediaryAccountConnections[0]))); + }, + isSDK(o: any): o is GenesisStateSDKType { + return o && (o.$typeUrl === GenesisState.typeUrl || Params.isSDK(o.params) && Array.isArray(o.superfluid_assets) && (!o.superfluid_assets.length || SuperfluidAsset.isSDK(o.superfluid_assets[0])) && Array.isArray(o.osmo_equivalent_multipliers) && (!o.osmo_equivalent_multipliers.length || OsmoEquivalentMultiplierRecord.isSDK(o.osmo_equivalent_multipliers[0])) && Array.isArray(o.intermediary_accounts) && (!o.intermediary_accounts.length || SuperfluidIntermediaryAccount.isSDK(o.intermediary_accounts[0])) && Array.isArray(o.intemediary_account_connections) && (!o.intemediary_account_connections.length || LockIdIntermediaryAccountConnection.isSDK(o.intemediary_account_connections[0]))); + }, + isAmino(o: any): o is GenesisStateAmino { + return o && (o.$typeUrl === GenesisState.typeUrl || Params.isAmino(o.params) && Array.isArray(o.superfluid_assets) && (!o.superfluid_assets.length || SuperfluidAsset.isAmino(o.superfluid_assets[0])) && Array.isArray(o.osmo_equivalent_multipliers) && (!o.osmo_equivalent_multipliers.length || OsmoEquivalentMultiplierRecord.isAmino(o.osmo_equivalent_multipliers[0])) && Array.isArray(o.intermediary_accounts) && (!o.intermediary_accounts.length || SuperfluidIntermediaryAccount.isAmino(o.intermediary_accounts[0])) && Array.isArray(o.intemediary_account_connections) && (!o.intemediary_account_connections.length || LockIdIntermediaryAccountConnection.isAmino(o.intemediary_account_connections[0]))); + }, encode(message: GenesisState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.params !== undefined) { Params.encode(message.params, writer.uint32(10).fork()).ldelim(); @@ -236,5 +246,15 @@ export const GenesisState = { typeUrl: "/osmosis.superfluid.GenesisState", value: GenesisState.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GenesisState.typeUrl)) { + return; + } + Params.registerTypeUrl(); + SuperfluidAsset.registerTypeUrl(); + OsmoEquivalentMultiplierRecord.registerTypeUrl(); + SuperfluidIntermediaryAccount.registerTypeUrl(); + LockIdIntermediaryAccountConnection.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/osmosis/superfluid/params.ts b/__fixtures__/v-next/outputv3/osmosis/superfluid/params.ts index 9704336152..d4e8f0dd9d 100644 --- a/__fixtures__/v-next/outputv3/osmosis/superfluid/params.ts +++ b/__fixtures__/v-next/outputv3/osmosis/superfluid/params.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { Decimal } from "@cosmjs/math"; +import { Decimal } from "@interchainjs/math"; import { isSet, DeepPartial } from "../../helpers"; export const protobufPackage = "osmosis.superfluid"; /** @@ -59,6 +59,15 @@ function createBaseParams(): Params { export const Params = { typeUrl: "/osmosis.superfluid.Params", aminoType: "osmosis/params", + is(o: any): o is Params { + return o && (o.$typeUrl === Params.typeUrl || typeof o.minimumRiskFactor === "string"); + }, + isSDK(o: any): o is ParamsSDKType { + return o && (o.$typeUrl === Params.typeUrl || typeof o.minimum_risk_factor === "string"); + }, + isAmino(o: any): o is ParamsAmino { + return o && (o.$typeUrl === Params.typeUrl || typeof o.minimum_risk_factor === "string"); + }, encode(message: Params, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.minimumRiskFactor !== "") { writer.uint32(10).string(Decimal.fromUserInput(message.minimumRiskFactor, 18).atomics); @@ -111,7 +120,7 @@ export const Params = { }, toAmino(message: Params, useInterfaces: boolean = true): ParamsAmino { const obj: any = {}; - obj.minimum_risk_factor = message.minimumRiskFactor === "" ? undefined : message.minimumRiskFactor; + obj.minimum_risk_factor = message.minimumRiskFactor === "" ? undefined : Decimal.fromUserInput(message.minimumRiskFactor, 18).atomics; return obj; }, fromProtoMsg(message: ParamsProtoMsg, useInterfaces: boolean = true): Params { @@ -125,5 +134,6 @@ export const Params = { typeUrl: "/osmosis.superfluid.Params", value: Params.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/osmosis/superfluid/query.rpc.func.ts b/__fixtures__/v-next/outputv3/osmosis/superfluid/query.rpc.func.ts new file mode 100644 index 0000000000..e11a56b342 --- /dev/null +++ b/__fixtures__/v-next/outputv3/osmosis/superfluid/query.rpc.func.ts @@ -0,0 +1,209 @@ +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../cosmos/base/query/v1beta1/pagination"; +import { Params, ParamsSDKType } from "./params"; +import { SuperfluidAssetType, SuperfluidAssetTypeSDKType, SuperfluidAsset, SuperfluidAssetSDKType, OsmoEquivalentMultiplierRecord, OsmoEquivalentMultiplierRecordSDKType, SuperfluidDelegationRecord, SuperfluidDelegationRecordSDKType } from "./superfluid"; +import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; +import { SyntheticLock, SyntheticLockSDKType } from "../lockup/lock"; +import { DelegationResponse, DelegationResponseSDKType } from "../../cosmos/staking/v1beta1/staking"; +import { EndpointOrRpc, buildQuery } from "../../helper-func-types"; +import { QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, AssetTypeRequest, AssetTypeRequestSDKType, AssetTypeResponse, AssetTypeResponseSDKType, AllAssetsRequest, AllAssetsRequestSDKType, AllAssetsResponse, AllAssetsResponseSDKType, AssetMultiplierRequest, AssetMultiplierRequestSDKType, AssetMultiplierResponse, AssetMultiplierResponseSDKType, AllIntermediaryAccountsRequest, AllIntermediaryAccountsRequestSDKType, AllIntermediaryAccountsResponse, AllIntermediaryAccountsResponseSDKType, ConnectedIntermediaryAccountRequest, ConnectedIntermediaryAccountRequestSDKType, ConnectedIntermediaryAccountResponse, ConnectedIntermediaryAccountResponseSDKType, QueryTotalDelegationByValidatorForDenomRequest, QueryTotalDelegationByValidatorForDenomRequestSDKType, QueryTotalDelegationByValidatorForDenomResponse, QueryTotalDelegationByValidatorForDenomResponseSDKType, TotalSuperfluidDelegationsRequest, TotalSuperfluidDelegationsRequestSDKType, TotalSuperfluidDelegationsResponse, TotalSuperfluidDelegationsResponseSDKType, SuperfluidDelegationAmountRequest, SuperfluidDelegationAmountRequestSDKType, SuperfluidDelegationAmountResponse, SuperfluidDelegationAmountResponseSDKType, SuperfluidDelegationsByDelegatorRequest, SuperfluidDelegationsByDelegatorRequestSDKType, SuperfluidDelegationsByDelegatorResponse, SuperfluidDelegationsByDelegatorResponseSDKType, SuperfluidUndelegationsByDelegatorRequest, SuperfluidUndelegationsByDelegatorRequestSDKType, SuperfluidUndelegationsByDelegatorResponse, SuperfluidUndelegationsByDelegatorResponseSDKType, SuperfluidDelegationsByValidatorDenomRequest, SuperfluidDelegationsByValidatorDenomRequestSDKType, SuperfluidDelegationsByValidatorDenomResponse, SuperfluidDelegationsByValidatorDenomResponseSDKType, EstimateSuperfluidDelegatedAmountByValidatorDenomRequest, EstimateSuperfluidDelegatedAmountByValidatorDenomRequestSDKType, EstimateSuperfluidDelegatedAmountByValidatorDenomResponse, EstimateSuperfluidDelegatedAmountByValidatorDenomResponseSDKType, QueryTotalDelegationByDelegatorRequest, QueryTotalDelegationByDelegatorRequestSDKType, QueryTotalDelegationByDelegatorResponse, QueryTotalDelegationByDelegatorResponseSDKType, QueryUnpoolWhitelistRequest, QueryUnpoolWhitelistRequestSDKType, QueryUnpoolWhitelistResponse, QueryUnpoolWhitelistResponseSDKType } from "./query"; +/** + * Params returns the total set of superfluid parameters. + * @name getParams + * @package osmosis.superfluid + * @see proto service: osmosis.superfluid.Params + */ +export const getParams = buildQuery({ + encode: QueryParamsRequest.encode, + decode: QueryParamsResponse.decode, + service: "osmosis.superfluid.Query", + method: "Params", + deps: [QueryParamsRequest, QueryParamsResponse] +}); +/** + * Returns superfluid asset type, whether if it's a native asset or an lp + * share. + * @name getAssetType + * @package osmosis.superfluid + * @see proto service: osmosis.superfluid.AssetType + */ +export const getAssetType = buildQuery({ + encode: AssetTypeRequest.encode, + decode: AssetTypeResponse.decode, + service: "osmosis.superfluid.Query", + method: "AssetType", + deps: [AssetTypeRequest, AssetTypeResponse] +}); +/** + * Returns all registered superfluid assets. + * @name getAllAssets + * @package osmosis.superfluid + * @see proto service: osmosis.superfluid.AllAssets + */ +export const getAllAssets = buildQuery({ + encode: AllAssetsRequest.encode, + decode: AllAssetsResponse.decode, + service: "osmosis.superfluid.Query", + method: "AllAssets", + deps: [AllAssetsRequest, AllAssetsResponse] +}); +/** + * Returns the osmo equivalent multiplier used in the most recent epoch. + * @name getAssetMultiplier + * @package osmosis.superfluid + * @see proto service: osmosis.superfluid.AssetMultiplier + */ +export const getAssetMultiplier = buildQuery({ + encode: AssetMultiplierRequest.encode, + decode: AssetMultiplierResponse.decode, + service: "osmosis.superfluid.Query", + method: "AssetMultiplier", + deps: [AssetMultiplierRequest, AssetMultiplierResponse] +}); +/** + * Returns all superfluid intermediary accounts. + * @name getAllIntermediaryAccounts + * @package osmosis.superfluid + * @see proto service: osmosis.superfluid.AllIntermediaryAccounts + */ +export const getAllIntermediaryAccounts = buildQuery({ + encode: AllIntermediaryAccountsRequest.encode, + decode: AllIntermediaryAccountsResponse.decode, + service: "osmosis.superfluid.Query", + method: "AllIntermediaryAccounts", + deps: [AllIntermediaryAccountsRequest, AllIntermediaryAccountsResponse] +}); +/** + * Returns intermediary account connected to a superfluid staked lock by id + * @name getConnectedIntermediaryAccount + * @package osmosis.superfluid + * @see proto service: osmosis.superfluid.ConnectedIntermediaryAccount + */ +export const getConnectedIntermediaryAccount = buildQuery({ + encode: ConnectedIntermediaryAccountRequest.encode, + decode: ConnectedIntermediaryAccountResponse.decode, + service: "osmosis.superfluid.Query", + method: "ConnectedIntermediaryAccount", + deps: [ConnectedIntermediaryAccountRequest, ConnectedIntermediaryAccountResponse] +}); +/** + * Returns the amount of delegations of specific denom for all validators + * @name getTotalDelegationByValidatorForDenom + * @package osmosis.superfluid + * @see proto service: osmosis.superfluid.TotalDelegationByValidatorForDenom + */ +export const getTotalDelegationByValidatorForDenom = buildQuery({ + encode: QueryTotalDelegationByValidatorForDenomRequest.encode, + decode: QueryTotalDelegationByValidatorForDenomResponse.decode, + service: "osmosis.superfluid.Query", + method: "TotalDelegationByValidatorForDenom", + deps: [QueryTotalDelegationByValidatorForDenomRequest, QueryTotalDelegationByValidatorForDenomResponse] +}); +/** + * Returns the total amount of osmo superfluidly staked. + * Response is denominated in uosmo. + * @name getTotalSuperfluidDelegations + * @package osmosis.superfluid + * @see proto service: osmosis.superfluid.TotalSuperfluidDelegations + */ +export const getTotalSuperfluidDelegations = buildQuery({ + encode: TotalSuperfluidDelegationsRequest.encode, + decode: TotalSuperfluidDelegationsResponse.decode, + service: "osmosis.superfluid.Query", + method: "TotalSuperfluidDelegations", + deps: [TotalSuperfluidDelegationsRequest, TotalSuperfluidDelegationsResponse] +}); +/** + * Returns the coins superfluid delegated for the delegator, validator, denom + * triplet + * @name getSuperfluidDelegationAmount + * @package osmosis.superfluid + * @see proto service: osmosis.superfluid.SuperfluidDelegationAmount + */ +export const getSuperfluidDelegationAmount = buildQuery({ + encode: SuperfluidDelegationAmountRequest.encode, + decode: SuperfluidDelegationAmountResponse.decode, + service: "osmosis.superfluid.Query", + method: "SuperfluidDelegationAmount", + deps: [SuperfluidDelegationAmountRequest, SuperfluidDelegationAmountResponse] +}); +/** + * Returns all the delegated superfluid poistions for a specific delegator. + * @name getSuperfluidDelegationsByDelegator + * @package osmosis.superfluid + * @see proto service: osmosis.superfluid.SuperfluidDelegationsByDelegator + */ +export const getSuperfluidDelegationsByDelegator = buildQuery({ + encode: SuperfluidDelegationsByDelegatorRequest.encode, + decode: SuperfluidDelegationsByDelegatorResponse.decode, + service: "osmosis.superfluid.Query", + method: "SuperfluidDelegationsByDelegator", + deps: [SuperfluidDelegationsByDelegatorRequest, SuperfluidDelegationsByDelegatorResponse] +}); +/** + * Returns all the undelegating superfluid poistions for a specific delegator. + * @name getSuperfluidUndelegationsByDelegator + * @package osmosis.superfluid + * @see proto service: osmosis.superfluid.SuperfluidUndelegationsByDelegator + */ +export const getSuperfluidUndelegationsByDelegator = buildQuery({ + encode: SuperfluidUndelegationsByDelegatorRequest.encode, + decode: SuperfluidUndelegationsByDelegatorResponse.decode, + service: "osmosis.superfluid.Query", + method: "SuperfluidUndelegationsByDelegator", + deps: [SuperfluidUndelegationsByDelegatorRequest, SuperfluidUndelegationsByDelegatorResponse] +}); +/** + * Returns all the superfluid positions of a specific denom delegated to one + * validator + * @name getSuperfluidDelegationsByValidatorDenom + * @package osmosis.superfluid + * @see proto service: osmosis.superfluid.SuperfluidDelegationsByValidatorDenom + */ +export const getSuperfluidDelegationsByValidatorDenom = buildQuery({ + encode: SuperfluidDelegationsByValidatorDenomRequest.encode, + decode: SuperfluidDelegationsByValidatorDenomResponse.decode, + service: "osmosis.superfluid.Query", + method: "SuperfluidDelegationsByValidatorDenom", + deps: [SuperfluidDelegationsByValidatorDenomRequest, SuperfluidDelegationsByValidatorDenomResponse] +}); +/** + * Returns the amount of a specific denom delegated to a specific validator + * This is labeled an estimate, because the way it calculates the amount can + * lead rounding errors from the true delegated amount + * @name getEstimateSuperfluidDelegatedAmountByValidatorDenom + * @package osmosis.superfluid + * @see proto service: osmosis.superfluid.EstimateSuperfluidDelegatedAmountByValidatorDenom + */ +export const getEstimateSuperfluidDelegatedAmountByValidatorDenom = buildQuery({ + encode: EstimateSuperfluidDelegatedAmountByValidatorDenomRequest.encode, + decode: EstimateSuperfluidDelegatedAmountByValidatorDenomResponse.decode, + service: "osmosis.superfluid.Query", + method: "EstimateSuperfluidDelegatedAmountByValidatorDenom", + deps: [EstimateSuperfluidDelegatedAmountByValidatorDenomRequest, EstimateSuperfluidDelegatedAmountByValidatorDenomResponse] +}); +/** + * Returns the specified delegations for a specific delegator + * @name getTotalDelegationByDelegator + * @package osmosis.superfluid + * @see proto service: osmosis.superfluid.TotalDelegationByDelegator + */ +export const getTotalDelegationByDelegator = buildQuery({ + encode: QueryTotalDelegationByDelegatorRequest.encode, + decode: QueryTotalDelegationByDelegatorResponse.decode, + service: "osmosis.superfluid.Query", + method: "TotalDelegationByDelegator", + deps: [QueryTotalDelegationByDelegatorRequest, QueryTotalDelegationByDelegatorResponse] +}); +/** + * Returns a list of whitelisted pool ids to unpool. + * @name getUnpoolWhitelist + * @package osmosis.superfluid + * @see proto service: osmosis.superfluid.UnpoolWhitelist + */ +export const getUnpoolWhitelist = buildQuery({ + encode: QueryUnpoolWhitelistRequest.encode, + decode: QueryUnpoolWhitelistResponse.decode, + service: "osmosis.superfluid.Query", + method: "UnpoolWhitelist", + deps: [QueryUnpoolWhitelistRequest, QueryUnpoolWhitelistResponse] +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/osmosis/superfluid/query.ts b/__fixtures__/v-next/outputv3/osmosis/superfluid/query.ts index 7bf6425c1b..c2f2437eb2 100644 --- a/__fixtures__/v-next/outputv3/osmosis/superfluid/query.ts +++ b/__fixtures__/v-next/outputv3/osmosis/superfluid/query.ts @@ -6,6 +6,7 @@ import { SyntheticLock, SyntheticLockAmino, SyntheticLockSDKType } from "../lock import { DelegationResponse, DelegationResponseAmino, DelegationResponseSDKType } from "../../cosmos/staking/v1beta1/staking"; import { BinaryReader, BinaryWriter } from "../../binary"; import { DeepPartial, isSet } from "../../helpers"; +import { GlobalDecoderRegistry } from "../../registry"; export const protobufPackage = "osmosis.superfluid"; /** * @name QueryParamsRequest @@ -950,6 +951,15 @@ function createBaseQueryParamsRequest(): QueryParamsRequest { export const QueryParamsRequest = { typeUrl: "/osmosis.superfluid.QueryParamsRequest", aminoType: "osmosis/query-params-request", + is(o: any): o is QueryParamsRequest { + return o && o.$typeUrl === QueryParamsRequest.typeUrl; + }, + isSDK(o: any): o is QueryParamsRequestSDKType { + return o && o.$typeUrl === QueryParamsRequest.typeUrl; + }, + isAmino(o: any): o is QueryParamsRequestAmino { + return o && o.$typeUrl === QueryParamsRequest.typeUrl; + }, encode(_: QueryParamsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -1001,7 +1011,8 @@ export const QueryParamsRequest = { typeUrl: "/osmosis.superfluid.QueryParamsRequest", value: QueryParamsRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryParamsResponse(): QueryParamsResponse { return { @@ -1016,6 +1027,15 @@ function createBaseQueryParamsResponse(): QueryParamsResponse { export const QueryParamsResponse = { typeUrl: "/osmosis.superfluid.QueryParamsResponse", aminoType: "osmosis/query-params-response", + is(o: any): o is QueryParamsResponse { + return o && (o.$typeUrl === QueryParamsResponse.typeUrl || Params.is(o.params)); + }, + isSDK(o: any): o is QueryParamsResponseSDKType { + return o && (o.$typeUrl === QueryParamsResponse.typeUrl || Params.isSDK(o.params)); + }, + isAmino(o: any): o is QueryParamsResponseAmino { + return o && (o.$typeUrl === QueryParamsResponse.typeUrl || Params.isAmino(o.params)); + }, encode(message: QueryParamsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.params !== undefined) { Params.encode(message.params, writer.uint32(10).fork()).ldelim(); @@ -1084,6 +1104,12 @@ export const QueryParamsResponse = { typeUrl: "/osmosis.superfluid.QueryParamsResponse", value: QueryParamsResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryParamsResponse.typeUrl)) { + return; + } + Params.registerTypeUrl(); } }; function createBaseAssetTypeRequest(): AssetTypeRequest { @@ -1099,6 +1125,15 @@ function createBaseAssetTypeRequest(): AssetTypeRequest { export const AssetTypeRequest = { typeUrl: "/osmosis.superfluid.AssetTypeRequest", aminoType: "osmosis/asset-type-request", + is(o: any): o is AssetTypeRequest { + return o && (o.$typeUrl === AssetTypeRequest.typeUrl || typeof o.denom === "string"); + }, + isSDK(o: any): o is AssetTypeRequestSDKType { + return o && (o.$typeUrl === AssetTypeRequest.typeUrl || typeof o.denom === "string"); + }, + isAmino(o: any): o is AssetTypeRequestAmino { + return o && (o.$typeUrl === AssetTypeRequest.typeUrl || typeof o.denom === "string"); + }, encode(message: AssetTypeRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.denom !== "") { writer.uint32(10).string(message.denom); @@ -1165,7 +1200,8 @@ export const AssetTypeRequest = { typeUrl: "/osmosis.superfluid.AssetTypeRequest", value: AssetTypeRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseAssetTypeResponse(): AssetTypeResponse { return { @@ -1180,6 +1216,15 @@ function createBaseAssetTypeResponse(): AssetTypeResponse { export const AssetTypeResponse = { typeUrl: "/osmosis.superfluid.AssetTypeResponse", aminoType: "osmosis/asset-type-response", + is(o: any): o is AssetTypeResponse { + return o && (o.$typeUrl === AssetTypeResponse.typeUrl || isSet(o.assetType)); + }, + isSDK(o: any): o is AssetTypeResponseSDKType { + return o && (o.$typeUrl === AssetTypeResponse.typeUrl || isSet(o.asset_type)); + }, + isAmino(o: any): o is AssetTypeResponseAmino { + return o && (o.$typeUrl === AssetTypeResponse.typeUrl || isSet(o.asset_type)); + }, encode(message: AssetTypeResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.assetType !== 0) { writer.uint32(8).int32(message.assetType); @@ -1246,7 +1291,8 @@ export const AssetTypeResponse = { typeUrl: "/osmosis.superfluid.AssetTypeResponse", value: AssetTypeResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseAllAssetsRequest(): AllAssetsRequest { return {}; @@ -1259,6 +1305,15 @@ function createBaseAllAssetsRequest(): AllAssetsRequest { export const AllAssetsRequest = { typeUrl: "/osmosis.superfluid.AllAssetsRequest", aminoType: "osmosis/all-assets-request", + is(o: any): o is AllAssetsRequest { + return o && o.$typeUrl === AllAssetsRequest.typeUrl; + }, + isSDK(o: any): o is AllAssetsRequestSDKType { + return o && o.$typeUrl === AllAssetsRequest.typeUrl; + }, + isAmino(o: any): o is AllAssetsRequestAmino { + return o && o.$typeUrl === AllAssetsRequest.typeUrl; + }, encode(_: AllAssetsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -1310,7 +1365,8 @@ export const AllAssetsRequest = { typeUrl: "/osmosis.superfluid.AllAssetsRequest", value: AllAssetsRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseAllAssetsResponse(): AllAssetsResponse { return { @@ -1325,6 +1381,15 @@ function createBaseAllAssetsResponse(): AllAssetsResponse { export const AllAssetsResponse = { typeUrl: "/osmosis.superfluid.AllAssetsResponse", aminoType: "osmosis/all-assets-response", + is(o: any): o is AllAssetsResponse { + return o && (o.$typeUrl === AllAssetsResponse.typeUrl || Array.isArray(o.assets) && (!o.assets.length || SuperfluidAsset.is(o.assets[0]))); + }, + isSDK(o: any): o is AllAssetsResponseSDKType { + return o && (o.$typeUrl === AllAssetsResponse.typeUrl || Array.isArray(o.assets) && (!o.assets.length || SuperfluidAsset.isSDK(o.assets[0]))); + }, + isAmino(o: any): o is AllAssetsResponseAmino { + return o && (o.$typeUrl === AllAssetsResponse.typeUrl || Array.isArray(o.assets) && (!o.assets.length || SuperfluidAsset.isAmino(o.assets[0]))); + }, encode(message: AllAssetsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.assets) { SuperfluidAsset.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -1397,6 +1462,12 @@ export const AllAssetsResponse = { typeUrl: "/osmosis.superfluid.AllAssetsResponse", value: AllAssetsResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(AllAssetsResponse.typeUrl)) { + return; + } + SuperfluidAsset.registerTypeUrl(); } }; function createBaseAssetMultiplierRequest(): AssetMultiplierRequest { @@ -1412,6 +1483,15 @@ function createBaseAssetMultiplierRequest(): AssetMultiplierRequest { export const AssetMultiplierRequest = { typeUrl: "/osmosis.superfluid.AssetMultiplierRequest", aminoType: "osmosis/asset-multiplier-request", + is(o: any): o is AssetMultiplierRequest { + return o && (o.$typeUrl === AssetMultiplierRequest.typeUrl || typeof o.denom === "string"); + }, + isSDK(o: any): o is AssetMultiplierRequestSDKType { + return o && (o.$typeUrl === AssetMultiplierRequest.typeUrl || typeof o.denom === "string"); + }, + isAmino(o: any): o is AssetMultiplierRequestAmino { + return o && (o.$typeUrl === AssetMultiplierRequest.typeUrl || typeof o.denom === "string"); + }, encode(message: AssetMultiplierRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.denom !== "") { writer.uint32(10).string(message.denom); @@ -1478,7 +1558,8 @@ export const AssetMultiplierRequest = { typeUrl: "/osmosis.superfluid.AssetMultiplierRequest", value: AssetMultiplierRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseAssetMultiplierResponse(): AssetMultiplierResponse { return { @@ -1493,6 +1574,15 @@ function createBaseAssetMultiplierResponse(): AssetMultiplierResponse { export const AssetMultiplierResponse = { typeUrl: "/osmosis.superfluid.AssetMultiplierResponse", aminoType: "osmosis/asset-multiplier-response", + is(o: any): o is AssetMultiplierResponse { + return o && o.$typeUrl === AssetMultiplierResponse.typeUrl; + }, + isSDK(o: any): o is AssetMultiplierResponseSDKType { + return o && o.$typeUrl === AssetMultiplierResponse.typeUrl; + }, + isAmino(o: any): o is AssetMultiplierResponseAmino { + return o && o.$typeUrl === AssetMultiplierResponse.typeUrl; + }, encode(message: AssetMultiplierResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.osmoEquivalentMultiplier !== undefined) { OsmoEquivalentMultiplierRecord.encode(message.osmoEquivalentMultiplier, writer.uint32(10).fork()).ldelim(); @@ -1561,6 +1651,12 @@ export const AssetMultiplierResponse = { typeUrl: "/osmosis.superfluid.AssetMultiplierResponse", value: AssetMultiplierResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(AssetMultiplierResponse.typeUrl)) { + return; + } + OsmoEquivalentMultiplierRecord.registerTypeUrl(); } }; function createBaseSuperfluidIntermediaryAccountInfo(): SuperfluidIntermediaryAccountInfo { @@ -1579,6 +1675,15 @@ function createBaseSuperfluidIntermediaryAccountInfo(): SuperfluidIntermediaryAc export const SuperfluidIntermediaryAccountInfo = { typeUrl: "/osmosis.superfluid.SuperfluidIntermediaryAccountInfo", aminoType: "osmosis/superfluid-intermediary-account-info", + is(o: any): o is SuperfluidIntermediaryAccountInfo { + return o && (o.$typeUrl === SuperfluidIntermediaryAccountInfo.typeUrl || typeof o.denom === "string" && typeof o.valAddr === "string" && typeof o.gaugeId === "bigint" && typeof o.address === "string"); + }, + isSDK(o: any): o is SuperfluidIntermediaryAccountInfoSDKType { + return o && (o.$typeUrl === SuperfluidIntermediaryAccountInfo.typeUrl || typeof o.denom === "string" && typeof o.val_addr === "string" && typeof o.gauge_id === "bigint" && typeof o.address === "string"); + }, + isAmino(o: any): o is SuperfluidIntermediaryAccountInfoAmino { + return o && (o.$typeUrl === SuperfluidIntermediaryAccountInfo.typeUrl || typeof o.denom === "string" && typeof o.val_addr === "string" && typeof o.gauge_id === "bigint" && typeof o.address === "string"); + }, encode(message: SuperfluidIntermediaryAccountInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.denom !== "") { writer.uint32(10).string(message.denom); @@ -1689,7 +1794,8 @@ export const SuperfluidIntermediaryAccountInfo = { typeUrl: "/osmosis.superfluid.SuperfluidIntermediaryAccountInfo", value: SuperfluidIntermediaryAccountInfo.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseAllIntermediaryAccountsRequest(): AllIntermediaryAccountsRequest { return { @@ -1704,6 +1810,15 @@ function createBaseAllIntermediaryAccountsRequest(): AllIntermediaryAccountsRequ export const AllIntermediaryAccountsRequest = { typeUrl: "/osmosis.superfluid.AllIntermediaryAccountsRequest", aminoType: "osmosis/all-intermediary-accounts-request", + is(o: any): o is AllIntermediaryAccountsRequest { + return o && o.$typeUrl === AllIntermediaryAccountsRequest.typeUrl; + }, + isSDK(o: any): o is AllIntermediaryAccountsRequestSDKType { + return o && o.$typeUrl === AllIntermediaryAccountsRequest.typeUrl; + }, + isAmino(o: any): o is AllIntermediaryAccountsRequestAmino { + return o && o.$typeUrl === AllIntermediaryAccountsRequest.typeUrl; + }, encode(message: AllIntermediaryAccountsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.pagination !== undefined) { PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); @@ -1772,6 +1887,12 @@ export const AllIntermediaryAccountsRequest = { typeUrl: "/osmosis.superfluid.AllIntermediaryAccountsRequest", value: AllIntermediaryAccountsRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(AllIntermediaryAccountsRequest.typeUrl)) { + return; + } + PageRequest.registerTypeUrl(); } }; function createBaseAllIntermediaryAccountsResponse(): AllIntermediaryAccountsResponse { @@ -1788,6 +1909,15 @@ function createBaseAllIntermediaryAccountsResponse(): AllIntermediaryAccountsRes export const AllIntermediaryAccountsResponse = { typeUrl: "/osmosis.superfluid.AllIntermediaryAccountsResponse", aminoType: "osmosis/all-intermediary-accounts-response", + is(o: any): o is AllIntermediaryAccountsResponse { + return o && (o.$typeUrl === AllIntermediaryAccountsResponse.typeUrl || Array.isArray(o.accounts) && (!o.accounts.length || SuperfluidIntermediaryAccountInfo.is(o.accounts[0]))); + }, + isSDK(o: any): o is AllIntermediaryAccountsResponseSDKType { + return o && (o.$typeUrl === AllIntermediaryAccountsResponse.typeUrl || Array.isArray(o.accounts) && (!o.accounts.length || SuperfluidIntermediaryAccountInfo.isSDK(o.accounts[0]))); + }, + isAmino(o: any): o is AllIntermediaryAccountsResponseAmino { + return o && (o.$typeUrl === AllIntermediaryAccountsResponse.typeUrl || Array.isArray(o.accounts) && (!o.accounts.length || SuperfluidIntermediaryAccountInfo.isAmino(o.accounts[0]))); + }, encode(message: AllIntermediaryAccountsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.accounts) { SuperfluidIntermediaryAccountInfo.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -1876,6 +2006,13 @@ export const AllIntermediaryAccountsResponse = { typeUrl: "/osmosis.superfluid.AllIntermediaryAccountsResponse", value: AllIntermediaryAccountsResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(AllIntermediaryAccountsResponse.typeUrl)) { + return; + } + SuperfluidIntermediaryAccountInfo.registerTypeUrl(); + PageResponse.registerTypeUrl(); } }; function createBaseConnectedIntermediaryAccountRequest(): ConnectedIntermediaryAccountRequest { @@ -1891,6 +2028,15 @@ function createBaseConnectedIntermediaryAccountRequest(): ConnectedIntermediaryA export const ConnectedIntermediaryAccountRequest = { typeUrl: "/osmosis.superfluid.ConnectedIntermediaryAccountRequest", aminoType: "osmosis/connected-intermediary-account-request", + is(o: any): o is ConnectedIntermediaryAccountRequest { + return o && (o.$typeUrl === ConnectedIntermediaryAccountRequest.typeUrl || typeof o.lockId === "bigint"); + }, + isSDK(o: any): o is ConnectedIntermediaryAccountRequestSDKType { + return o && (o.$typeUrl === ConnectedIntermediaryAccountRequest.typeUrl || typeof o.lock_id === "bigint"); + }, + isAmino(o: any): o is ConnectedIntermediaryAccountRequestAmino { + return o && (o.$typeUrl === ConnectedIntermediaryAccountRequest.typeUrl || typeof o.lock_id === "bigint"); + }, encode(message: ConnectedIntermediaryAccountRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.lockId !== BigInt(0)) { writer.uint32(8).uint64(message.lockId); @@ -1959,7 +2105,8 @@ export const ConnectedIntermediaryAccountRequest = { typeUrl: "/osmosis.superfluid.ConnectedIntermediaryAccountRequest", value: ConnectedIntermediaryAccountRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseConnectedIntermediaryAccountResponse(): ConnectedIntermediaryAccountResponse { return { @@ -1974,6 +2121,15 @@ function createBaseConnectedIntermediaryAccountResponse(): ConnectedIntermediary export const ConnectedIntermediaryAccountResponse = { typeUrl: "/osmosis.superfluid.ConnectedIntermediaryAccountResponse", aminoType: "osmosis/connected-intermediary-account-response", + is(o: any): o is ConnectedIntermediaryAccountResponse { + return o && o.$typeUrl === ConnectedIntermediaryAccountResponse.typeUrl; + }, + isSDK(o: any): o is ConnectedIntermediaryAccountResponseSDKType { + return o && o.$typeUrl === ConnectedIntermediaryAccountResponse.typeUrl; + }, + isAmino(o: any): o is ConnectedIntermediaryAccountResponseAmino { + return o && o.$typeUrl === ConnectedIntermediaryAccountResponse.typeUrl; + }, encode(message: ConnectedIntermediaryAccountResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.account !== undefined) { SuperfluidIntermediaryAccountInfo.encode(message.account, writer.uint32(10).fork()).ldelim(); @@ -2042,6 +2198,12 @@ export const ConnectedIntermediaryAccountResponse = { typeUrl: "/osmosis.superfluid.ConnectedIntermediaryAccountResponse", value: ConnectedIntermediaryAccountResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ConnectedIntermediaryAccountResponse.typeUrl)) { + return; + } + SuperfluidIntermediaryAccountInfo.registerTypeUrl(); } }; function createBaseQueryTotalDelegationByValidatorForDenomRequest(): QueryTotalDelegationByValidatorForDenomRequest { @@ -2057,6 +2219,15 @@ function createBaseQueryTotalDelegationByValidatorForDenomRequest(): QueryTotalD export const QueryTotalDelegationByValidatorForDenomRequest = { typeUrl: "/osmosis.superfluid.QueryTotalDelegationByValidatorForDenomRequest", aminoType: "osmosis/query-total-delegation-by-validator-for-denom-request", + is(o: any): o is QueryTotalDelegationByValidatorForDenomRequest { + return o && (o.$typeUrl === QueryTotalDelegationByValidatorForDenomRequest.typeUrl || typeof o.denom === "string"); + }, + isSDK(o: any): o is QueryTotalDelegationByValidatorForDenomRequestSDKType { + return o && (o.$typeUrl === QueryTotalDelegationByValidatorForDenomRequest.typeUrl || typeof o.denom === "string"); + }, + isAmino(o: any): o is QueryTotalDelegationByValidatorForDenomRequestAmino { + return o && (o.$typeUrl === QueryTotalDelegationByValidatorForDenomRequest.typeUrl || typeof o.denom === "string"); + }, encode(message: QueryTotalDelegationByValidatorForDenomRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.denom !== "") { writer.uint32(10).string(message.denom); @@ -2123,7 +2294,8 @@ export const QueryTotalDelegationByValidatorForDenomRequest = { typeUrl: "/osmosis.superfluid.QueryTotalDelegationByValidatorForDenomRequest", value: QueryTotalDelegationByValidatorForDenomRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryTotalDelegationByValidatorForDenomResponse(): QueryTotalDelegationByValidatorForDenomResponse { return { @@ -2138,6 +2310,15 @@ function createBaseQueryTotalDelegationByValidatorForDenomResponse(): QueryTotal export const QueryTotalDelegationByValidatorForDenomResponse = { typeUrl: "/osmosis.superfluid.QueryTotalDelegationByValidatorForDenomResponse", aminoType: "osmosis/query-total-delegation-by-validator-for-denom-response", + is(o: any): o is QueryTotalDelegationByValidatorForDenomResponse { + return o && (o.$typeUrl === QueryTotalDelegationByValidatorForDenomResponse.typeUrl || Array.isArray(o.assets) && (!o.assets.length || Delegations.is(o.assets[0]))); + }, + isSDK(o: any): o is QueryTotalDelegationByValidatorForDenomResponseSDKType { + return o && (o.$typeUrl === QueryTotalDelegationByValidatorForDenomResponse.typeUrl || Array.isArray(o.assets) && (!o.assets.length || Delegations.isSDK(o.assets[0]))); + }, + isAmino(o: any): o is QueryTotalDelegationByValidatorForDenomResponseAmino { + return o && (o.$typeUrl === QueryTotalDelegationByValidatorForDenomResponse.typeUrl || Array.isArray(o.assets) && (!o.assets.length || Delegations.isAmino(o.assets[0]))); + }, encode(message: QueryTotalDelegationByValidatorForDenomResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.assets) { Delegations.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -2210,6 +2391,12 @@ export const QueryTotalDelegationByValidatorForDenomResponse = { typeUrl: "/osmosis.superfluid.QueryTotalDelegationByValidatorForDenomResponse", value: QueryTotalDelegationByValidatorForDenomResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryTotalDelegationByValidatorForDenomResponse.typeUrl)) { + return; + } + Delegations.registerTypeUrl(); } }; function createBaseDelegations(): Delegations { @@ -2227,6 +2414,15 @@ function createBaseDelegations(): Delegations { export const Delegations = { typeUrl: "/osmosis.superfluid.Delegations", aminoType: "osmosis/delegations", + is(o: any): o is Delegations { + return o && (o.$typeUrl === Delegations.typeUrl || typeof o.valAddr === "string" && typeof o.amountSfsd === "string" && typeof o.osmoEquivalent === "string"); + }, + isSDK(o: any): o is DelegationsSDKType { + return o && (o.$typeUrl === Delegations.typeUrl || typeof o.val_addr === "string" && typeof o.amount_sfsd === "string" && typeof o.osmo_equivalent === "string"); + }, + isAmino(o: any): o is DelegationsAmino { + return o && (o.$typeUrl === Delegations.typeUrl || typeof o.val_addr === "string" && typeof o.amount_sfsd === "string" && typeof o.osmo_equivalent === "string"); + }, encode(message: Delegations, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.valAddr !== "") { writer.uint32(10).string(message.valAddr); @@ -2321,7 +2517,8 @@ export const Delegations = { typeUrl: "/osmosis.superfluid.Delegations", value: Delegations.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseTotalSuperfluidDelegationsRequest(): TotalSuperfluidDelegationsRequest { return {}; @@ -2334,6 +2531,15 @@ function createBaseTotalSuperfluidDelegationsRequest(): TotalSuperfluidDelegatio export const TotalSuperfluidDelegationsRequest = { typeUrl: "/osmosis.superfluid.TotalSuperfluidDelegationsRequest", aminoType: "osmosis/total-superfluid-delegations-request", + is(o: any): o is TotalSuperfluidDelegationsRequest { + return o && o.$typeUrl === TotalSuperfluidDelegationsRequest.typeUrl; + }, + isSDK(o: any): o is TotalSuperfluidDelegationsRequestSDKType { + return o && o.$typeUrl === TotalSuperfluidDelegationsRequest.typeUrl; + }, + isAmino(o: any): o is TotalSuperfluidDelegationsRequestAmino { + return o && o.$typeUrl === TotalSuperfluidDelegationsRequest.typeUrl; + }, encode(_: TotalSuperfluidDelegationsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -2385,7 +2591,8 @@ export const TotalSuperfluidDelegationsRequest = { typeUrl: "/osmosis.superfluid.TotalSuperfluidDelegationsRequest", value: TotalSuperfluidDelegationsRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseTotalSuperfluidDelegationsResponse(): TotalSuperfluidDelegationsResponse { return { @@ -2400,6 +2607,15 @@ function createBaseTotalSuperfluidDelegationsResponse(): TotalSuperfluidDelegati export const TotalSuperfluidDelegationsResponse = { typeUrl: "/osmosis.superfluid.TotalSuperfluidDelegationsResponse", aminoType: "osmosis/total-superfluid-delegations-response", + is(o: any): o is TotalSuperfluidDelegationsResponse { + return o && (o.$typeUrl === TotalSuperfluidDelegationsResponse.typeUrl || typeof o.totalDelegations === "string"); + }, + isSDK(o: any): o is TotalSuperfluidDelegationsResponseSDKType { + return o && (o.$typeUrl === TotalSuperfluidDelegationsResponse.typeUrl || typeof o.total_delegations === "string"); + }, + isAmino(o: any): o is TotalSuperfluidDelegationsResponseAmino { + return o && (o.$typeUrl === TotalSuperfluidDelegationsResponse.typeUrl || typeof o.total_delegations === "string"); + }, encode(message: TotalSuperfluidDelegationsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.totalDelegations !== "") { writer.uint32(10).string(message.totalDelegations); @@ -2466,7 +2682,8 @@ export const TotalSuperfluidDelegationsResponse = { typeUrl: "/osmosis.superfluid.TotalSuperfluidDelegationsResponse", value: TotalSuperfluidDelegationsResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseSuperfluidDelegationAmountRequest(): SuperfluidDelegationAmountRequest { return { @@ -2483,6 +2700,15 @@ function createBaseSuperfluidDelegationAmountRequest(): SuperfluidDelegationAmou export const SuperfluidDelegationAmountRequest = { typeUrl: "/osmosis.superfluid.SuperfluidDelegationAmountRequest", aminoType: "osmosis/superfluid-delegation-amount-request", + is(o: any): o is SuperfluidDelegationAmountRequest { + return o && (o.$typeUrl === SuperfluidDelegationAmountRequest.typeUrl || typeof o.delegatorAddress === "string" && typeof o.validatorAddress === "string" && typeof o.denom === "string"); + }, + isSDK(o: any): o is SuperfluidDelegationAmountRequestSDKType { + return o && (o.$typeUrl === SuperfluidDelegationAmountRequest.typeUrl || typeof o.delegator_address === "string" && typeof o.validator_address === "string" && typeof o.denom === "string"); + }, + isAmino(o: any): o is SuperfluidDelegationAmountRequestAmino { + return o && (o.$typeUrl === SuperfluidDelegationAmountRequest.typeUrl || typeof o.delegator_address === "string" && typeof o.validator_address === "string" && typeof o.denom === "string"); + }, encode(message: SuperfluidDelegationAmountRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.delegatorAddress !== "") { writer.uint32(10).string(message.delegatorAddress); @@ -2577,7 +2803,8 @@ export const SuperfluidDelegationAmountRequest = { typeUrl: "/osmosis.superfluid.SuperfluidDelegationAmountRequest", value: SuperfluidDelegationAmountRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseSuperfluidDelegationAmountResponse(): SuperfluidDelegationAmountResponse { return { @@ -2592,6 +2819,15 @@ function createBaseSuperfluidDelegationAmountResponse(): SuperfluidDelegationAmo export const SuperfluidDelegationAmountResponse = { typeUrl: "/osmosis.superfluid.SuperfluidDelegationAmountResponse", aminoType: "osmosis/superfluid-delegation-amount-response", + is(o: any): o is SuperfluidDelegationAmountResponse { + return o && (o.$typeUrl === SuperfluidDelegationAmountResponse.typeUrl || Array.isArray(o.amount) && (!o.amount.length || Coin.is(o.amount[0]))); + }, + isSDK(o: any): o is SuperfluidDelegationAmountResponseSDKType { + return o && (o.$typeUrl === SuperfluidDelegationAmountResponse.typeUrl || Array.isArray(o.amount) && (!o.amount.length || Coin.isSDK(o.amount[0]))); + }, + isAmino(o: any): o is SuperfluidDelegationAmountResponseAmino { + return o && (o.$typeUrl === SuperfluidDelegationAmountResponse.typeUrl || Array.isArray(o.amount) && (!o.amount.length || Coin.isAmino(o.amount[0]))); + }, encode(message: SuperfluidDelegationAmountResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.amount) { Coin.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -2664,6 +2900,12 @@ export const SuperfluidDelegationAmountResponse = { typeUrl: "/osmosis.superfluid.SuperfluidDelegationAmountResponse", value: SuperfluidDelegationAmountResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(SuperfluidDelegationAmountResponse.typeUrl)) { + return; + } + Coin.registerTypeUrl(); } }; function createBaseSuperfluidDelegationsByDelegatorRequest(): SuperfluidDelegationsByDelegatorRequest { @@ -2679,6 +2921,15 @@ function createBaseSuperfluidDelegationsByDelegatorRequest(): SuperfluidDelegati export const SuperfluidDelegationsByDelegatorRequest = { typeUrl: "/osmosis.superfluid.SuperfluidDelegationsByDelegatorRequest", aminoType: "osmosis/superfluid-delegations-by-delegator-request", + is(o: any): o is SuperfluidDelegationsByDelegatorRequest { + return o && (o.$typeUrl === SuperfluidDelegationsByDelegatorRequest.typeUrl || typeof o.delegatorAddress === "string"); + }, + isSDK(o: any): o is SuperfluidDelegationsByDelegatorRequestSDKType { + return o && (o.$typeUrl === SuperfluidDelegationsByDelegatorRequest.typeUrl || typeof o.delegator_address === "string"); + }, + isAmino(o: any): o is SuperfluidDelegationsByDelegatorRequestAmino { + return o && (o.$typeUrl === SuperfluidDelegationsByDelegatorRequest.typeUrl || typeof o.delegator_address === "string"); + }, encode(message: SuperfluidDelegationsByDelegatorRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.delegatorAddress !== "") { writer.uint32(10).string(message.delegatorAddress); @@ -2745,7 +2996,8 @@ export const SuperfluidDelegationsByDelegatorRequest = { typeUrl: "/osmosis.superfluid.SuperfluidDelegationsByDelegatorRequest", value: SuperfluidDelegationsByDelegatorRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseSuperfluidDelegationsByDelegatorResponse(): SuperfluidDelegationsByDelegatorResponse { return { @@ -2762,6 +3014,15 @@ function createBaseSuperfluidDelegationsByDelegatorResponse(): SuperfluidDelegat export const SuperfluidDelegationsByDelegatorResponse = { typeUrl: "/osmosis.superfluid.SuperfluidDelegationsByDelegatorResponse", aminoType: "osmosis/superfluid-delegations-by-delegator-response", + is(o: any): o is SuperfluidDelegationsByDelegatorResponse { + return o && (o.$typeUrl === SuperfluidDelegationsByDelegatorResponse.typeUrl || Array.isArray(o.superfluidDelegationRecords) && (!o.superfluidDelegationRecords.length || SuperfluidDelegationRecord.is(o.superfluidDelegationRecords[0])) && Array.isArray(o.totalDelegatedCoins) && (!o.totalDelegatedCoins.length || Coin.is(o.totalDelegatedCoins[0])) && Coin.is(o.totalEquivalentStakedAmount)); + }, + isSDK(o: any): o is SuperfluidDelegationsByDelegatorResponseSDKType { + return o && (o.$typeUrl === SuperfluidDelegationsByDelegatorResponse.typeUrl || Array.isArray(o.superfluid_delegation_records) && (!o.superfluid_delegation_records.length || SuperfluidDelegationRecord.isSDK(o.superfluid_delegation_records[0])) && Array.isArray(o.total_delegated_coins) && (!o.total_delegated_coins.length || Coin.isSDK(o.total_delegated_coins[0])) && Coin.isSDK(o.total_equivalent_staked_amount)); + }, + isAmino(o: any): o is SuperfluidDelegationsByDelegatorResponseAmino { + return o && (o.$typeUrl === SuperfluidDelegationsByDelegatorResponse.typeUrl || Array.isArray(o.superfluid_delegation_records) && (!o.superfluid_delegation_records.length || SuperfluidDelegationRecord.isAmino(o.superfluid_delegation_records[0])) && Array.isArray(o.total_delegated_coins) && (!o.total_delegated_coins.length || Coin.isAmino(o.total_delegated_coins[0])) && Coin.isAmino(o.total_equivalent_staked_amount)); + }, encode(message: SuperfluidDelegationsByDelegatorResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.superfluidDelegationRecords) { SuperfluidDelegationRecord.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -2870,6 +3131,13 @@ export const SuperfluidDelegationsByDelegatorResponse = { typeUrl: "/osmosis.superfluid.SuperfluidDelegationsByDelegatorResponse", value: SuperfluidDelegationsByDelegatorResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(SuperfluidDelegationsByDelegatorResponse.typeUrl)) { + return; + } + SuperfluidDelegationRecord.registerTypeUrl(); + Coin.registerTypeUrl(); } }; function createBaseSuperfluidUndelegationsByDelegatorRequest(): SuperfluidUndelegationsByDelegatorRequest { @@ -2886,6 +3154,15 @@ function createBaseSuperfluidUndelegationsByDelegatorRequest(): SuperfluidUndele export const SuperfluidUndelegationsByDelegatorRequest = { typeUrl: "/osmosis.superfluid.SuperfluidUndelegationsByDelegatorRequest", aminoType: "osmosis/superfluid-undelegations-by-delegator-request", + is(o: any): o is SuperfluidUndelegationsByDelegatorRequest { + return o && (o.$typeUrl === SuperfluidUndelegationsByDelegatorRequest.typeUrl || typeof o.delegatorAddress === "string" && typeof o.denom === "string"); + }, + isSDK(o: any): o is SuperfluidUndelegationsByDelegatorRequestSDKType { + return o && (o.$typeUrl === SuperfluidUndelegationsByDelegatorRequest.typeUrl || typeof o.delegator_address === "string" && typeof o.denom === "string"); + }, + isAmino(o: any): o is SuperfluidUndelegationsByDelegatorRequestAmino { + return o && (o.$typeUrl === SuperfluidUndelegationsByDelegatorRequest.typeUrl || typeof o.delegator_address === "string" && typeof o.denom === "string"); + }, encode(message: SuperfluidUndelegationsByDelegatorRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.delegatorAddress !== "") { writer.uint32(10).string(message.delegatorAddress); @@ -2966,7 +3243,8 @@ export const SuperfluidUndelegationsByDelegatorRequest = { typeUrl: "/osmosis.superfluid.SuperfluidUndelegationsByDelegatorRequest", value: SuperfluidUndelegationsByDelegatorRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseSuperfluidUndelegationsByDelegatorResponse(): SuperfluidUndelegationsByDelegatorResponse { return { @@ -2983,6 +3261,15 @@ function createBaseSuperfluidUndelegationsByDelegatorResponse(): SuperfluidUndel export const SuperfluidUndelegationsByDelegatorResponse = { typeUrl: "/osmosis.superfluid.SuperfluidUndelegationsByDelegatorResponse", aminoType: "osmosis/superfluid-undelegations-by-delegator-response", + is(o: any): o is SuperfluidUndelegationsByDelegatorResponse { + return o && (o.$typeUrl === SuperfluidUndelegationsByDelegatorResponse.typeUrl || Array.isArray(o.superfluidDelegationRecords) && (!o.superfluidDelegationRecords.length || SuperfluidDelegationRecord.is(o.superfluidDelegationRecords[0])) && Array.isArray(o.totalUndelegatedCoins) && (!o.totalUndelegatedCoins.length || Coin.is(o.totalUndelegatedCoins[0])) && Array.isArray(o.syntheticLocks) && (!o.syntheticLocks.length || SyntheticLock.is(o.syntheticLocks[0]))); + }, + isSDK(o: any): o is SuperfluidUndelegationsByDelegatorResponseSDKType { + return o && (o.$typeUrl === SuperfluidUndelegationsByDelegatorResponse.typeUrl || Array.isArray(o.superfluid_delegation_records) && (!o.superfluid_delegation_records.length || SuperfluidDelegationRecord.isSDK(o.superfluid_delegation_records[0])) && Array.isArray(o.total_undelegated_coins) && (!o.total_undelegated_coins.length || Coin.isSDK(o.total_undelegated_coins[0])) && Array.isArray(o.synthetic_locks) && (!o.synthetic_locks.length || SyntheticLock.isSDK(o.synthetic_locks[0]))); + }, + isAmino(o: any): o is SuperfluidUndelegationsByDelegatorResponseAmino { + return o && (o.$typeUrl === SuperfluidUndelegationsByDelegatorResponse.typeUrl || Array.isArray(o.superfluid_delegation_records) && (!o.superfluid_delegation_records.length || SuperfluidDelegationRecord.isAmino(o.superfluid_delegation_records[0])) && Array.isArray(o.total_undelegated_coins) && (!o.total_undelegated_coins.length || Coin.isAmino(o.total_undelegated_coins[0])) && Array.isArray(o.synthetic_locks) && (!o.synthetic_locks.length || SyntheticLock.isAmino(o.synthetic_locks[0]))); + }, encode(message: SuperfluidUndelegationsByDelegatorResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.superfluidDelegationRecords) { SuperfluidDelegationRecord.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -3095,6 +3382,14 @@ export const SuperfluidUndelegationsByDelegatorResponse = { typeUrl: "/osmosis.superfluid.SuperfluidUndelegationsByDelegatorResponse", value: SuperfluidUndelegationsByDelegatorResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(SuperfluidUndelegationsByDelegatorResponse.typeUrl)) { + return; + } + SuperfluidDelegationRecord.registerTypeUrl(); + Coin.registerTypeUrl(); + SyntheticLock.registerTypeUrl(); } }; function createBaseSuperfluidDelegationsByValidatorDenomRequest(): SuperfluidDelegationsByValidatorDenomRequest { @@ -3111,6 +3406,15 @@ function createBaseSuperfluidDelegationsByValidatorDenomRequest(): SuperfluidDel export const SuperfluidDelegationsByValidatorDenomRequest = { typeUrl: "/osmosis.superfluid.SuperfluidDelegationsByValidatorDenomRequest", aminoType: "osmosis/superfluid-delegations-by-validator-denom-request", + is(o: any): o is SuperfluidDelegationsByValidatorDenomRequest { + return o && (o.$typeUrl === SuperfluidDelegationsByValidatorDenomRequest.typeUrl || typeof o.validatorAddress === "string" && typeof o.denom === "string"); + }, + isSDK(o: any): o is SuperfluidDelegationsByValidatorDenomRequestSDKType { + return o && (o.$typeUrl === SuperfluidDelegationsByValidatorDenomRequest.typeUrl || typeof o.validator_address === "string" && typeof o.denom === "string"); + }, + isAmino(o: any): o is SuperfluidDelegationsByValidatorDenomRequestAmino { + return o && (o.$typeUrl === SuperfluidDelegationsByValidatorDenomRequest.typeUrl || typeof o.validator_address === "string" && typeof o.denom === "string"); + }, encode(message: SuperfluidDelegationsByValidatorDenomRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.validatorAddress !== "") { writer.uint32(10).string(message.validatorAddress); @@ -3191,7 +3495,8 @@ export const SuperfluidDelegationsByValidatorDenomRequest = { typeUrl: "/osmosis.superfluid.SuperfluidDelegationsByValidatorDenomRequest", value: SuperfluidDelegationsByValidatorDenomRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseSuperfluidDelegationsByValidatorDenomResponse(): SuperfluidDelegationsByValidatorDenomResponse { return { @@ -3206,6 +3511,15 @@ function createBaseSuperfluidDelegationsByValidatorDenomResponse(): SuperfluidDe export const SuperfluidDelegationsByValidatorDenomResponse = { typeUrl: "/osmosis.superfluid.SuperfluidDelegationsByValidatorDenomResponse", aminoType: "osmosis/superfluid-delegations-by-validator-denom-response", + is(o: any): o is SuperfluidDelegationsByValidatorDenomResponse { + return o && (o.$typeUrl === SuperfluidDelegationsByValidatorDenomResponse.typeUrl || Array.isArray(o.superfluidDelegationRecords) && (!o.superfluidDelegationRecords.length || SuperfluidDelegationRecord.is(o.superfluidDelegationRecords[0]))); + }, + isSDK(o: any): o is SuperfluidDelegationsByValidatorDenomResponseSDKType { + return o && (o.$typeUrl === SuperfluidDelegationsByValidatorDenomResponse.typeUrl || Array.isArray(o.superfluid_delegation_records) && (!o.superfluid_delegation_records.length || SuperfluidDelegationRecord.isSDK(o.superfluid_delegation_records[0]))); + }, + isAmino(o: any): o is SuperfluidDelegationsByValidatorDenomResponseAmino { + return o && (o.$typeUrl === SuperfluidDelegationsByValidatorDenomResponse.typeUrl || Array.isArray(o.superfluid_delegation_records) && (!o.superfluid_delegation_records.length || SuperfluidDelegationRecord.isAmino(o.superfluid_delegation_records[0]))); + }, encode(message: SuperfluidDelegationsByValidatorDenomResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.superfluidDelegationRecords) { SuperfluidDelegationRecord.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -3278,6 +3592,12 @@ export const SuperfluidDelegationsByValidatorDenomResponse = { typeUrl: "/osmosis.superfluid.SuperfluidDelegationsByValidatorDenomResponse", value: SuperfluidDelegationsByValidatorDenomResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(SuperfluidDelegationsByValidatorDenomResponse.typeUrl)) { + return; + } + SuperfluidDelegationRecord.registerTypeUrl(); } }; function createBaseEstimateSuperfluidDelegatedAmountByValidatorDenomRequest(): EstimateSuperfluidDelegatedAmountByValidatorDenomRequest { @@ -3294,6 +3614,15 @@ function createBaseEstimateSuperfluidDelegatedAmountByValidatorDenomRequest(): E export const EstimateSuperfluidDelegatedAmountByValidatorDenomRequest = { typeUrl: "/osmosis.superfluid.EstimateSuperfluidDelegatedAmountByValidatorDenomRequest", aminoType: "osmosis/estimate-superfluid-delegated-amount-by-validator-denom-request", + is(o: any): o is EstimateSuperfluidDelegatedAmountByValidatorDenomRequest { + return o && (o.$typeUrl === EstimateSuperfluidDelegatedAmountByValidatorDenomRequest.typeUrl || typeof o.validatorAddress === "string" && typeof o.denom === "string"); + }, + isSDK(o: any): o is EstimateSuperfluidDelegatedAmountByValidatorDenomRequestSDKType { + return o && (o.$typeUrl === EstimateSuperfluidDelegatedAmountByValidatorDenomRequest.typeUrl || typeof o.validator_address === "string" && typeof o.denom === "string"); + }, + isAmino(o: any): o is EstimateSuperfluidDelegatedAmountByValidatorDenomRequestAmino { + return o && (o.$typeUrl === EstimateSuperfluidDelegatedAmountByValidatorDenomRequest.typeUrl || typeof o.validator_address === "string" && typeof o.denom === "string"); + }, encode(message: EstimateSuperfluidDelegatedAmountByValidatorDenomRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.validatorAddress !== "") { writer.uint32(10).string(message.validatorAddress); @@ -3374,7 +3703,8 @@ export const EstimateSuperfluidDelegatedAmountByValidatorDenomRequest = { typeUrl: "/osmosis.superfluid.EstimateSuperfluidDelegatedAmountByValidatorDenomRequest", value: EstimateSuperfluidDelegatedAmountByValidatorDenomRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseEstimateSuperfluidDelegatedAmountByValidatorDenomResponse(): EstimateSuperfluidDelegatedAmountByValidatorDenomResponse { return { @@ -3389,6 +3719,15 @@ function createBaseEstimateSuperfluidDelegatedAmountByValidatorDenomResponse(): export const EstimateSuperfluidDelegatedAmountByValidatorDenomResponse = { typeUrl: "/osmosis.superfluid.EstimateSuperfluidDelegatedAmountByValidatorDenomResponse", aminoType: "osmosis/estimate-superfluid-delegated-amount-by-validator-denom-response", + is(o: any): o is EstimateSuperfluidDelegatedAmountByValidatorDenomResponse { + return o && (o.$typeUrl === EstimateSuperfluidDelegatedAmountByValidatorDenomResponse.typeUrl || Array.isArray(o.totalDelegatedCoins) && (!o.totalDelegatedCoins.length || Coin.is(o.totalDelegatedCoins[0]))); + }, + isSDK(o: any): o is EstimateSuperfluidDelegatedAmountByValidatorDenomResponseSDKType { + return o && (o.$typeUrl === EstimateSuperfluidDelegatedAmountByValidatorDenomResponse.typeUrl || Array.isArray(o.total_delegated_coins) && (!o.total_delegated_coins.length || Coin.isSDK(o.total_delegated_coins[0]))); + }, + isAmino(o: any): o is EstimateSuperfluidDelegatedAmountByValidatorDenomResponseAmino { + return o && (o.$typeUrl === EstimateSuperfluidDelegatedAmountByValidatorDenomResponse.typeUrl || Array.isArray(o.total_delegated_coins) && (!o.total_delegated_coins.length || Coin.isAmino(o.total_delegated_coins[0]))); + }, encode(message: EstimateSuperfluidDelegatedAmountByValidatorDenomResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.totalDelegatedCoins) { Coin.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -3461,6 +3800,12 @@ export const EstimateSuperfluidDelegatedAmountByValidatorDenomResponse = { typeUrl: "/osmosis.superfluid.EstimateSuperfluidDelegatedAmountByValidatorDenomResponse", value: EstimateSuperfluidDelegatedAmountByValidatorDenomResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(EstimateSuperfluidDelegatedAmountByValidatorDenomResponse.typeUrl)) { + return; + } + Coin.registerTypeUrl(); } }; function createBaseQueryTotalDelegationByDelegatorRequest(): QueryTotalDelegationByDelegatorRequest { @@ -3476,6 +3821,15 @@ function createBaseQueryTotalDelegationByDelegatorRequest(): QueryTotalDelegatio export const QueryTotalDelegationByDelegatorRequest = { typeUrl: "/osmosis.superfluid.QueryTotalDelegationByDelegatorRequest", aminoType: "osmosis/query-total-delegation-by-delegator-request", + is(o: any): o is QueryTotalDelegationByDelegatorRequest { + return o && (o.$typeUrl === QueryTotalDelegationByDelegatorRequest.typeUrl || typeof o.delegatorAddress === "string"); + }, + isSDK(o: any): o is QueryTotalDelegationByDelegatorRequestSDKType { + return o && (o.$typeUrl === QueryTotalDelegationByDelegatorRequest.typeUrl || typeof o.delegator_address === "string"); + }, + isAmino(o: any): o is QueryTotalDelegationByDelegatorRequestAmino { + return o && (o.$typeUrl === QueryTotalDelegationByDelegatorRequest.typeUrl || typeof o.delegator_address === "string"); + }, encode(message: QueryTotalDelegationByDelegatorRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.delegatorAddress !== "") { writer.uint32(10).string(message.delegatorAddress); @@ -3542,7 +3896,8 @@ export const QueryTotalDelegationByDelegatorRequest = { typeUrl: "/osmosis.superfluid.QueryTotalDelegationByDelegatorRequest", value: QueryTotalDelegationByDelegatorRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryTotalDelegationByDelegatorResponse(): QueryTotalDelegationByDelegatorResponse { return { @@ -3560,6 +3915,15 @@ function createBaseQueryTotalDelegationByDelegatorResponse(): QueryTotalDelegati export const QueryTotalDelegationByDelegatorResponse = { typeUrl: "/osmosis.superfluid.QueryTotalDelegationByDelegatorResponse", aminoType: "osmosis/query-total-delegation-by-delegator-response", + is(o: any): o is QueryTotalDelegationByDelegatorResponse { + return o && (o.$typeUrl === QueryTotalDelegationByDelegatorResponse.typeUrl || Array.isArray(o.superfluidDelegationRecords) && (!o.superfluidDelegationRecords.length || SuperfluidDelegationRecord.is(o.superfluidDelegationRecords[0])) && Array.isArray(o.delegationResponse) && (!o.delegationResponse.length || DelegationResponse.is(o.delegationResponse[0])) && Array.isArray(o.totalDelegatedCoins) && (!o.totalDelegatedCoins.length || Coin.is(o.totalDelegatedCoins[0])) && Coin.is(o.totalEquivalentStakedAmount)); + }, + isSDK(o: any): o is QueryTotalDelegationByDelegatorResponseSDKType { + return o && (o.$typeUrl === QueryTotalDelegationByDelegatorResponse.typeUrl || Array.isArray(o.superfluid_delegation_records) && (!o.superfluid_delegation_records.length || SuperfluidDelegationRecord.isSDK(o.superfluid_delegation_records[0])) && Array.isArray(o.delegation_response) && (!o.delegation_response.length || DelegationResponse.isSDK(o.delegation_response[0])) && Array.isArray(o.total_delegated_coins) && (!o.total_delegated_coins.length || Coin.isSDK(o.total_delegated_coins[0])) && Coin.isSDK(o.total_equivalent_staked_amount)); + }, + isAmino(o: any): o is QueryTotalDelegationByDelegatorResponseAmino { + return o && (o.$typeUrl === QueryTotalDelegationByDelegatorResponse.typeUrl || Array.isArray(o.superfluid_delegation_records) && (!o.superfluid_delegation_records.length || SuperfluidDelegationRecord.isAmino(o.superfluid_delegation_records[0])) && Array.isArray(o.delegation_response) && (!o.delegation_response.length || DelegationResponse.isAmino(o.delegation_response[0])) && Array.isArray(o.total_delegated_coins) && (!o.total_delegated_coins.length || Coin.isAmino(o.total_delegated_coins[0])) && Coin.isAmino(o.total_equivalent_staked_amount)); + }, encode(message: QueryTotalDelegationByDelegatorResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.superfluidDelegationRecords) { SuperfluidDelegationRecord.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -3688,6 +4052,14 @@ export const QueryTotalDelegationByDelegatorResponse = { typeUrl: "/osmosis.superfluid.QueryTotalDelegationByDelegatorResponse", value: QueryTotalDelegationByDelegatorResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryTotalDelegationByDelegatorResponse.typeUrl)) { + return; + } + SuperfluidDelegationRecord.registerTypeUrl(); + DelegationResponse.registerTypeUrl(); + Coin.registerTypeUrl(); } }; function createBaseQueryUnpoolWhitelistRequest(): QueryUnpoolWhitelistRequest { @@ -3701,6 +4073,15 @@ function createBaseQueryUnpoolWhitelistRequest(): QueryUnpoolWhitelistRequest { export const QueryUnpoolWhitelistRequest = { typeUrl: "/osmosis.superfluid.QueryUnpoolWhitelistRequest", aminoType: "osmosis/query-unpool-whitelist-request", + is(o: any): o is QueryUnpoolWhitelistRequest { + return o && o.$typeUrl === QueryUnpoolWhitelistRequest.typeUrl; + }, + isSDK(o: any): o is QueryUnpoolWhitelistRequestSDKType { + return o && o.$typeUrl === QueryUnpoolWhitelistRequest.typeUrl; + }, + isAmino(o: any): o is QueryUnpoolWhitelistRequestAmino { + return o && o.$typeUrl === QueryUnpoolWhitelistRequest.typeUrl; + }, encode(_: QueryUnpoolWhitelistRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -3752,7 +4133,8 @@ export const QueryUnpoolWhitelistRequest = { typeUrl: "/osmosis.superfluid.QueryUnpoolWhitelistRequest", value: QueryUnpoolWhitelistRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryUnpoolWhitelistResponse(): QueryUnpoolWhitelistResponse { return { @@ -3767,6 +4149,15 @@ function createBaseQueryUnpoolWhitelistResponse(): QueryUnpoolWhitelistResponse export const QueryUnpoolWhitelistResponse = { typeUrl: "/osmosis.superfluid.QueryUnpoolWhitelistResponse", aminoType: "osmosis/query-unpool-whitelist-response", + is(o: any): o is QueryUnpoolWhitelistResponse { + return o && (o.$typeUrl === QueryUnpoolWhitelistResponse.typeUrl || Array.isArray(o.poolIds) && (!o.poolIds.length || typeof o.poolIds[0] === "bigint")); + }, + isSDK(o: any): o is QueryUnpoolWhitelistResponseSDKType { + return o && (o.$typeUrl === QueryUnpoolWhitelistResponse.typeUrl || Array.isArray(o.pool_ids) && (!o.pool_ids.length || typeof o.pool_ids[0] === "bigint")); + }, + isAmino(o: any): o is QueryUnpoolWhitelistResponseAmino { + return o && (o.$typeUrl === QueryUnpoolWhitelistResponse.typeUrl || Array.isArray(o.pool_ids) && (!o.pool_ids.length || typeof o.pool_ids[0] === "bigint")); + }, encode(message: QueryUnpoolWhitelistResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { writer.uint32(10).fork(); for (const v of message.poolIds) { @@ -3848,5 +4239,6 @@ export const QueryUnpoolWhitelistResponse = { typeUrl: "/osmosis.superfluid.QueryUnpoolWhitelistResponse", value: QueryUnpoolWhitelistResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/osmosis/superfluid/superfluid.ts b/__fixtures__/v-next/outputv3/osmosis/superfluid/superfluid.ts index 7c4c922dbf..8424773b8d 100644 --- a/__fixtures__/v-next/outputv3/osmosis/superfluid/superfluid.ts +++ b/__fixtures__/v-next/outputv3/osmosis/superfluid/superfluid.ts @@ -1,7 +1,8 @@ import { Coin, CoinAmino, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; -import { BinaryReader, BinaryWriter } from "../../binary"; import { isSet, DeepPartial } from "../../helpers"; -import { Decimal } from "@cosmjs/math"; +import { BinaryReader, BinaryWriter } from "../../binary"; +import { Decimal } from "@interchainjs/math"; +import { GlobalDecoderRegistry } from "../../registry"; export const protobufPackage = "osmosis.superfluid"; /** * SuperfluidAssetType indicates whether the superfluid asset is @@ -323,6 +324,15 @@ function createBaseSuperfluidAsset(): SuperfluidAsset { export const SuperfluidAsset = { typeUrl: "/osmosis.superfluid.SuperfluidAsset", aminoType: "osmosis/superfluid-asset", + is(o: any): o is SuperfluidAsset { + return o && (o.$typeUrl === SuperfluidAsset.typeUrl || typeof o.denom === "string" && isSet(o.assetType)); + }, + isSDK(o: any): o is SuperfluidAssetSDKType { + return o && (o.$typeUrl === SuperfluidAsset.typeUrl || typeof o.denom === "string" && isSet(o.asset_type)); + }, + isAmino(o: any): o is SuperfluidAssetAmino { + return o && (o.$typeUrl === SuperfluidAsset.typeUrl || typeof o.denom === "string" && isSet(o.asset_type)); + }, encode(message: SuperfluidAsset, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.denom !== "") { writer.uint32(10).string(message.denom); @@ -403,7 +413,8 @@ export const SuperfluidAsset = { typeUrl: "/osmosis.superfluid.SuperfluidAsset", value: SuperfluidAsset.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseSuperfluidIntermediaryAccount(): SuperfluidIntermediaryAccount { return { @@ -423,6 +434,15 @@ function createBaseSuperfluidIntermediaryAccount(): SuperfluidIntermediaryAccoun export const SuperfluidIntermediaryAccount = { typeUrl: "/osmosis.superfluid.SuperfluidIntermediaryAccount", aminoType: "osmosis/superfluid-intermediary-account", + is(o: any): o is SuperfluidIntermediaryAccount { + return o && (o.$typeUrl === SuperfluidIntermediaryAccount.typeUrl || typeof o.denom === "string" && typeof o.valAddr === "string" && typeof o.gaugeId === "bigint"); + }, + isSDK(o: any): o is SuperfluidIntermediaryAccountSDKType { + return o && (o.$typeUrl === SuperfluidIntermediaryAccount.typeUrl || typeof o.denom === "string" && typeof o.val_addr === "string" && typeof o.gauge_id === "bigint"); + }, + isAmino(o: any): o is SuperfluidIntermediaryAccountAmino { + return o && (o.$typeUrl === SuperfluidIntermediaryAccount.typeUrl || typeof o.denom === "string" && typeof o.val_addr === "string" && typeof o.gauge_id === "bigint"); + }, encode(message: SuperfluidIntermediaryAccount, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.denom !== "") { writer.uint32(10).string(message.denom); @@ -519,7 +539,8 @@ export const SuperfluidIntermediaryAccount = { typeUrl: "/osmosis.superfluid.SuperfluidIntermediaryAccount", value: SuperfluidIntermediaryAccount.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseOsmoEquivalentMultiplierRecord(): OsmoEquivalentMultiplierRecord { return { @@ -543,6 +564,15 @@ function createBaseOsmoEquivalentMultiplierRecord(): OsmoEquivalentMultiplierRec export const OsmoEquivalentMultiplierRecord = { typeUrl: "/osmosis.superfluid.OsmoEquivalentMultiplierRecord", aminoType: "osmosis/osmo-equivalent-multiplier-record", + is(o: any): o is OsmoEquivalentMultiplierRecord { + return o && (o.$typeUrl === OsmoEquivalentMultiplierRecord.typeUrl || typeof o.epochNumber === "bigint" && typeof o.denom === "string" && typeof o.multiplier === "string"); + }, + isSDK(o: any): o is OsmoEquivalentMultiplierRecordSDKType { + return o && (o.$typeUrl === OsmoEquivalentMultiplierRecord.typeUrl || typeof o.epoch_number === "bigint" && typeof o.denom === "string" && typeof o.multiplier === "string"); + }, + isAmino(o: any): o is OsmoEquivalentMultiplierRecordAmino { + return o && (o.$typeUrl === OsmoEquivalentMultiplierRecord.typeUrl || typeof o.epoch_number === "bigint" && typeof o.denom === "string" && typeof o.multiplier === "string"); + }, encode(message: OsmoEquivalentMultiplierRecord, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.epochNumber !== BigInt(0)) { writer.uint32(8).int64(message.epochNumber); @@ -625,7 +655,7 @@ export const OsmoEquivalentMultiplierRecord = { const obj: any = {}; obj.epoch_number = message.epochNumber !== BigInt(0) ? message.epochNumber?.toString() : undefined; obj.denom = message.denom === "" ? undefined : message.denom; - obj.multiplier = message.multiplier === "" ? undefined : message.multiplier; + obj.multiplier = message.multiplier === "" ? undefined : Decimal.fromUserInput(message.multiplier, 18).atomics; return obj; }, fromProtoMsg(message: OsmoEquivalentMultiplierRecordProtoMsg, useInterfaces: boolean = true): OsmoEquivalentMultiplierRecord { @@ -639,7 +669,8 @@ export const OsmoEquivalentMultiplierRecord = { typeUrl: "/osmosis.superfluid.OsmoEquivalentMultiplierRecord", value: OsmoEquivalentMultiplierRecord.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseSuperfluidDelegationRecord(): SuperfluidDelegationRecord { return { @@ -659,6 +690,15 @@ function createBaseSuperfluidDelegationRecord(): SuperfluidDelegationRecord { export const SuperfluidDelegationRecord = { typeUrl: "/osmosis.superfluid.SuperfluidDelegationRecord", aminoType: "osmosis/superfluid-delegation-record", + is(o: any): o is SuperfluidDelegationRecord { + return o && (o.$typeUrl === SuperfluidDelegationRecord.typeUrl || typeof o.delegatorAddress === "string" && typeof o.validatorAddress === "string" && Coin.is(o.delegationAmount)); + }, + isSDK(o: any): o is SuperfluidDelegationRecordSDKType { + return o && (o.$typeUrl === SuperfluidDelegationRecord.typeUrl || typeof o.delegator_address === "string" && typeof o.validator_address === "string" && Coin.isSDK(o.delegation_amount)); + }, + isAmino(o: any): o is SuperfluidDelegationRecordAmino { + return o && (o.$typeUrl === SuperfluidDelegationRecord.typeUrl || typeof o.delegator_address === "string" && typeof o.validator_address === "string" && Coin.isAmino(o.delegation_amount)); + }, encode(message: SuperfluidDelegationRecord, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.delegatorAddress !== "") { writer.uint32(10).string(message.delegatorAddress); @@ -771,6 +811,12 @@ export const SuperfluidDelegationRecord = { typeUrl: "/osmosis.superfluid.SuperfluidDelegationRecord", value: SuperfluidDelegationRecord.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(SuperfluidDelegationRecord.typeUrl)) { + return; + } + Coin.registerTypeUrl(); } }; function createBaseLockIdIntermediaryAccountConnection(): LockIdIntermediaryAccountConnection { @@ -790,6 +836,15 @@ function createBaseLockIdIntermediaryAccountConnection(): LockIdIntermediaryAcco export const LockIdIntermediaryAccountConnection = { typeUrl: "/osmosis.superfluid.LockIdIntermediaryAccountConnection", aminoType: "osmosis/lock-id-intermediary-account-connection", + is(o: any): o is LockIdIntermediaryAccountConnection { + return o && (o.$typeUrl === LockIdIntermediaryAccountConnection.typeUrl || typeof o.lockId === "bigint" && typeof o.intermediaryAccount === "string"); + }, + isSDK(o: any): o is LockIdIntermediaryAccountConnectionSDKType { + return o && (o.$typeUrl === LockIdIntermediaryAccountConnection.typeUrl || typeof o.lock_id === "bigint" && typeof o.intermediary_account === "string"); + }, + isAmino(o: any): o is LockIdIntermediaryAccountConnectionAmino { + return o && (o.$typeUrl === LockIdIntermediaryAccountConnection.typeUrl || typeof o.lock_id === "bigint" && typeof o.intermediary_account === "string"); + }, encode(message: LockIdIntermediaryAccountConnection, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.lockId !== BigInt(0)) { writer.uint32(8).uint64(message.lockId); @@ -872,7 +927,8 @@ export const LockIdIntermediaryAccountConnection = { typeUrl: "/osmosis.superfluid.LockIdIntermediaryAccountConnection", value: LockIdIntermediaryAccountConnection.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseUnpoolWhitelistedPools(): UnpoolWhitelistedPools { return { @@ -887,6 +943,15 @@ function createBaseUnpoolWhitelistedPools(): UnpoolWhitelistedPools { export const UnpoolWhitelistedPools = { typeUrl: "/osmosis.superfluid.UnpoolWhitelistedPools", aminoType: "osmosis/unpool-whitelisted-pools", + is(o: any): o is UnpoolWhitelistedPools { + return o && (o.$typeUrl === UnpoolWhitelistedPools.typeUrl || Array.isArray(o.ids) && (!o.ids.length || typeof o.ids[0] === "bigint")); + }, + isSDK(o: any): o is UnpoolWhitelistedPoolsSDKType { + return o && (o.$typeUrl === UnpoolWhitelistedPools.typeUrl || Array.isArray(o.ids) && (!o.ids.length || typeof o.ids[0] === "bigint")); + }, + isAmino(o: any): o is UnpoolWhitelistedPoolsAmino { + return o && (o.$typeUrl === UnpoolWhitelistedPools.typeUrl || Array.isArray(o.ids) && (!o.ids.length || typeof o.ids[0] === "bigint")); + }, encode(message: UnpoolWhitelistedPools, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { writer.uint32(10).fork(); for (const v of message.ids) { @@ -968,5 +1033,6 @@ export const UnpoolWhitelistedPools = { typeUrl: "/osmosis.superfluid.UnpoolWhitelistedPools", value: UnpoolWhitelistedPools.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/osmosis/superfluid/tx.registry.ts b/__fixtures__/v-next/outputv3/osmosis/superfluid/tx.registry.ts index d1ddcb1ff3..a752a7e28a 100644 --- a/__fixtures__/v-next/outputv3/osmosis/superfluid/tx.registry.ts +++ b/__fixtures__/v-next/outputv3/osmosis/superfluid/tx.registry.ts @@ -1,12 +1,7 @@ import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; -import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { TelescopeGeneratedType } from "../../types"; import { MsgSuperfluidDelegate, MsgSuperfluidDelegateSDKType, MsgSuperfluidUndelegate, MsgSuperfluidUndelegateSDKType, MsgSuperfluidUnbondLock, MsgSuperfluidUnbondLockSDKType, MsgLockAndSuperfluidDelegate, MsgLockAndSuperfluidDelegateSDKType, MsgUnPoolWhitelistedPool, MsgUnPoolWhitelistedPoolSDKType } from "./tx"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/osmosis.superfluid.MsgSuperfluidDelegate", MsgSuperfluidDelegate], ["/osmosis.superfluid.MsgSuperfluidUndelegate", MsgSuperfluidUndelegate], ["/osmosis.superfluid.MsgSuperfluidUnbondLock", MsgSuperfluidUnbondLock], ["/osmosis.superfluid.MsgLockAndSuperfluidDelegate", MsgLockAndSuperfluidDelegate], ["/osmosis.superfluid.MsgUnPoolWhitelistedPool", MsgUnPoolWhitelistedPool]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/osmosis.superfluid.MsgSuperfluidDelegate", MsgSuperfluidDelegate], ["/osmosis.superfluid.MsgSuperfluidUndelegate", MsgSuperfluidUndelegate], ["/osmosis.superfluid.MsgSuperfluidUnbondLock", MsgSuperfluidUnbondLock], ["/osmosis.superfluid.MsgLockAndSuperfluidDelegate", MsgLockAndSuperfluidDelegate], ["/osmosis.superfluid.MsgUnPoolWhitelistedPool", MsgUnPoolWhitelistedPool]]; export const MessageComposer = { encoded: { superfluidDelegate(value: MsgSuperfluidDelegate) { diff --git a/__fixtures__/v-next/outputv3/osmosis/superfluid/tx.rpc.func.ts b/__fixtures__/v-next/outputv3/osmosis/superfluid/tx.rpc.func.ts new file mode 100644 index 0000000000..85a48aab1b --- /dev/null +++ b/__fixtures__/v-next/outputv3/osmosis/superfluid/tx.rpc.func.ts @@ -0,0 +1,48 @@ +import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; +import { buildTx } from "../../helper-func-types"; +import { MsgSuperfluidDelegate, MsgSuperfluidDelegateSDKType, MsgSuperfluidDelegateResponse, MsgSuperfluidDelegateResponseSDKType, MsgSuperfluidUndelegate, MsgSuperfluidUndelegateSDKType, MsgSuperfluidUndelegateResponse, MsgSuperfluidUndelegateResponseSDKType, MsgSuperfluidUnbondLock, MsgSuperfluidUnbondLockSDKType, MsgSuperfluidUnbondLockResponse, MsgSuperfluidUnbondLockResponseSDKType, MsgLockAndSuperfluidDelegate, MsgLockAndSuperfluidDelegateSDKType, MsgLockAndSuperfluidDelegateResponse, MsgLockAndSuperfluidDelegateResponseSDKType, MsgUnPoolWhitelistedPool, MsgUnPoolWhitelistedPoolSDKType, MsgUnPoolWhitelistedPoolResponse, MsgUnPoolWhitelistedPoolResponseSDKType } from "./tx"; +/** + * Execute superfluid delegation for a lockup + * @name superfluidDelegate + * @package osmosis.superfluid + * @see proto service: osmosis.superfluid.SuperfluidDelegate + */ +export const superfluidDelegate = buildTx({ + msg: MsgSuperfluidDelegate +}); +/** + * Execute superfluid undelegation for a lockup + * @name superfluidUndelegate + * @package osmosis.superfluid + * @see proto service: osmosis.superfluid.SuperfluidUndelegate + */ +export const superfluidUndelegate = buildTx({ + msg: MsgSuperfluidUndelegate +}); +/** + * For a given lock that is being superfluidly undelegated, + * also unbond the underlying lock. + * @name superfluidUnbondLock + * @package osmosis.superfluid + * @see proto service: osmosis.superfluid.SuperfluidUnbondLock + */ +export const superfluidUnbondLock = buildTx({ + msg: MsgSuperfluidUnbondLock +}); +/** + * Execute lockup lock and superfluid delegation in a single msg + * @name lockAndSuperfluidDelegate + * @package osmosis.superfluid + * @see proto service: osmosis.superfluid.LockAndSuperfluidDelegate + */ +export const lockAndSuperfluidDelegate = buildTx({ + msg: MsgLockAndSuperfluidDelegate +}); +/** + * @name unPoolWhitelistedPool + * @package osmosis.superfluid + * @see proto service: osmosis.superfluid.UnPoolWhitelistedPool + */ +export const unPoolWhitelistedPool = buildTx({ + msg: MsgUnPoolWhitelistedPool +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/osmosis/superfluid/tx.ts b/__fixtures__/v-next/outputv3/osmosis/superfluid/tx.ts index e8e049decb..c24d9301d2 100644 --- a/__fixtures__/v-next/outputv3/osmosis/superfluid/tx.ts +++ b/__fixtures__/v-next/outputv3/osmosis/superfluid/tx.ts @@ -1,6 +1,7 @@ import { Coin, CoinAmino, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../binary"; import { isSet, DeepPartial } from "../../helpers"; +import { GlobalDecoderRegistry } from "../../registry"; export const protobufPackage = "osmosis.superfluid"; /** * @name MsgSuperfluidDelegate @@ -333,6 +334,15 @@ function createBaseMsgSuperfluidDelegate(): MsgSuperfluidDelegate { export const MsgSuperfluidDelegate = { typeUrl: "/osmosis.superfluid.MsgSuperfluidDelegate", aminoType: "osmosis/superfluid-delegate", + is(o: any): o is MsgSuperfluidDelegate { + return o && (o.$typeUrl === MsgSuperfluidDelegate.typeUrl || typeof o.sender === "string" && typeof o.lockId === "bigint" && typeof o.valAddr === "string"); + }, + isSDK(o: any): o is MsgSuperfluidDelegateSDKType { + return o && (o.$typeUrl === MsgSuperfluidDelegate.typeUrl || typeof o.sender === "string" && typeof o.lock_id === "bigint" && typeof o.val_addr === "string"); + }, + isAmino(o: any): o is MsgSuperfluidDelegateAmino { + return o && (o.$typeUrl === MsgSuperfluidDelegate.typeUrl || typeof o.sender === "string" && typeof o.lock_id === "bigint" && typeof o.val_addr === "string"); + }, encode(message: MsgSuperfluidDelegate, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.sender !== "") { writer.uint32(10).string(message.sender); @@ -429,7 +439,8 @@ export const MsgSuperfluidDelegate = { typeUrl: "/osmosis.superfluid.MsgSuperfluidDelegate", value: MsgSuperfluidDelegate.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgSuperfluidDelegateResponse(): MsgSuperfluidDelegateResponse { return {}; @@ -442,6 +453,15 @@ function createBaseMsgSuperfluidDelegateResponse(): MsgSuperfluidDelegateRespons export const MsgSuperfluidDelegateResponse = { typeUrl: "/osmosis.superfluid.MsgSuperfluidDelegateResponse", aminoType: "osmosis/superfluid-delegate-response", + is(o: any): o is MsgSuperfluidDelegateResponse { + return o && o.$typeUrl === MsgSuperfluidDelegateResponse.typeUrl; + }, + isSDK(o: any): o is MsgSuperfluidDelegateResponseSDKType { + return o && o.$typeUrl === MsgSuperfluidDelegateResponse.typeUrl; + }, + isAmino(o: any): o is MsgSuperfluidDelegateResponseAmino { + return o && o.$typeUrl === MsgSuperfluidDelegateResponse.typeUrl; + }, encode(_: MsgSuperfluidDelegateResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -493,7 +513,8 @@ export const MsgSuperfluidDelegateResponse = { typeUrl: "/osmosis.superfluid.MsgSuperfluidDelegateResponse", value: MsgSuperfluidDelegateResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgSuperfluidUndelegate(): MsgSuperfluidUndelegate { return { @@ -509,6 +530,15 @@ function createBaseMsgSuperfluidUndelegate(): MsgSuperfluidUndelegate { export const MsgSuperfluidUndelegate = { typeUrl: "/osmosis.superfluid.MsgSuperfluidUndelegate", aminoType: "osmosis/superfluid-undelegate", + is(o: any): o is MsgSuperfluidUndelegate { + return o && (o.$typeUrl === MsgSuperfluidUndelegate.typeUrl || typeof o.sender === "string" && typeof o.lockId === "bigint"); + }, + isSDK(o: any): o is MsgSuperfluidUndelegateSDKType { + return o && (o.$typeUrl === MsgSuperfluidUndelegate.typeUrl || typeof o.sender === "string" && typeof o.lock_id === "bigint"); + }, + isAmino(o: any): o is MsgSuperfluidUndelegateAmino { + return o && (o.$typeUrl === MsgSuperfluidUndelegate.typeUrl || typeof o.sender === "string" && typeof o.lock_id === "bigint"); + }, encode(message: MsgSuperfluidUndelegate, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.sender !== "") { writer.uint32(10).string(message.sender); @@ -591,7 +621,8 @@ export const MsgSuperfluidUndelegate = { typeUrl: "/osmosis.superfluid.MsgSuperfluidUndelegate", value: MsgSuperfluidUndelegate.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgSuperfluidUndelegateResponse(): MsgSuperfluidUndelegateResponse { return {}; @@ -604,6 +635,15 @@ function createBaseMsgSuperfluidUndelegateResponse(): MsgSuperfluidUndelegateRes export const MsgSuperfluidUndelegateResponse = { typeUrl: "/osmosis.superfluid.MsgSuperfluidUndelegateResponse", aminoType: "osmosis/superfluid-undelegate-response", + is(o: any): o is MsgSuperfluidUndelegateResponse { + return o && o.$typeUrl === MsgSuperfluidUndelegateResponse.typeUrl; + }, + isSDK(o: any): o is MsgSuperfluidUndelegateResponseSDKType { + return o && o.$typeUrl === MsgSuperfluidUndelegateResponse.typeUrl; + }, + isAmino(o: any): o is MsgSuperfluidUndelegateResponseAmino { + return o && o.$typeUrl === MsgSuperfluidUndelegateResponse.typeUrl; + }, encode(_: MsgSuperfluidUndelegateResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -655,7 +695,8 @@ export const MsgSuperfluidUndelegateResponse = { typeUrl: "/osmosis.superfluid.MsgSuperfluidUndelegateResponse", value: MsgSuperfluidUndelegateResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgSuperfluidUnbondLock(): MsgSuperfluidUnbondLock { return { @@ -671,6 +712,15 @@ function createBaseMsgSuperfluidUnbondLock(): MsgSuperfluidUnbondLock { export const MsgSuperfluidUnbondLock = { typeUrl: "/osmosis.superfluid.MsgSuperfluidUnbondLock", aminoType: "osmosis/superfluid-unbond-lock", + is(o: any): o is MsgSuperfluidUnbondLock { + return o && (o.$typeUrl === MsgSuperfluidUnbondLock.typeUrl || typeof o.sender === "string" && typeof o.lockId === "bigint"); + }, + isSDK(o: any): o is MsgSuperfluidUnbondLockSDKType { + return o && (o.$typeUrl === MsgSuperfluidUnbondLock.typeUrl || typeof o.sender === "string" && typeof o.lock_id === "bigint"); + }, + isAmino(o: any): o is MsgSuperfluidUnbondLockAmino { + return o && (o.$typeUrl === MsgSuperfluidUnbondLock.typeUrl || typeof o.sender === "string" && typeof o.lock_id === "bigint"); + }, encode(message: MsgSuperfluidUnbondLock, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.sender !== "") { writer.uint32(10).string(message.sender); @@ -753,7 +803,8 @@ export const MsgSuperfluidUnbondLock = { typeUrl: "/osmosis.superfluid.MsgSuperfluidUnbondLock", value: MsgSuperfluidUnbondLock.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgSuperfluidUnbondLockResponse(): MsgSuperfluidUnbondLockResponse { return {}; @@ -766,6 +817,15 @@ function createBaseMsgSuperfluidUnbondLockResponse(): MsgSuperfluidUnbondLockRes export const MsgSuperfluidUnbondLockResponse = { typeUrl: "/osmosis.superfluid.MsgSuperfluidUnbondLockResponse", aminoType: "osmosis/superfluid-unbond-lock-response", + is(o: any): o is MsgSuperfluidUnbondLockResponse { + return o && o.$typeUrl === MsgSuperfluidUnbondLockResponse.typeUrl; + }, + isSDK(o: any): o is MsgSuperfluidUnbondLockResponseSDKType { + return o && o.$typeUrl === MsgSuperfluidUnbondLockResponse.typeUrl; + }, + isAmino(o: any): o is MsgSuperfluidUnbondLockResponseAmino { + return o && o.$typeUrl === MsgSuperfluidUnbondLockResponse.typeUrl; + }, encode(_: MsgSuperfluidUnbondLockResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -817,7 +877,8 @@ export const MsgSuperfluidUnbondLockResponse = { typeUrl: "/osmosis.superfluid.MsgSuperfluidUnbondLockResponse", value: MsgSuperfluidUnbondLockResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgLockAndSuperfluidDelegate(): MsgLockAndSuperfluidDelegate { return { @@ -837,6 +898,15 @@ function createBaseMsgLockAndSuperfluidDelegate(): MsgLockAndSuperfluidDelegate export const MsgLockAndSuperfluidDelegate = { typeUrl: "/osmosis.superfluid.MsgLockAndSuperfluidDelegate", aminoType: "osmosis/lock-and-superfluid-delegate", + is(o: any): o is MsgLockAndSuperfluidDelegate { + return o && (o.$typeUrl === MsgLockAndSuperfluidDelegate.typeUrl || typeof o.sender === "string" && Array.isArray(o.coins) && (!o.coins.length || Coin.is(o.coins[0])) && typeof o.valAddr === "string"); + }, + isSDK(o: any): o is MsgLockAndSuperfluidDelegateSDKType { + return o && (o.$typeUrl === MsgLockAndSuperfluidDelegate.typeUrl || typeof o.sender === "string" && Array.isArray(o.coins) && (!o.coins.length || Coin.isSDK(o.coins[0])) && typeof o.val_addr === "string"); + }, + isAmino(o: any): o is MsgLockAndSuperfluidDelegateAmino { + return o && (o.$typeUrl === MsgLockAndSuperfluidDelegate.typeUrl || typeof o.sender === "string" && Array.isArray(o.coins) && (!o.coins.length || Coin.isAmino(o.coins[0])) && typeof o.val_addr === "string"); + }, encode(message: MsgLockAndSuperfluidDelegate, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.sender !== "") { writer.uint32(10).string(message.sender); @@ -937,6 +1007,12 @@ export const MsgLockAndSuperfluidDelegate = { typeUrl: "/osmosis.superfluid.MsgLockAndSuperfluidDelegate", value: MsgLockAndSuperfluidDelegate.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgLockAndSuperfluidDelegate.typeUrl)) { + return; + } + Coin.registerTypeUrl(); } }; function createBaseMsgLockAndSuperfluidDelegateResponse(): MsgLockAndSuperfluidDelegateResponse { @@ -952,6 +1028,15 @@ function createBaseMsgLockAndSuperfluidDelegateResponse(): MsgLockAndSuperfluidD export const MsgLockAndSuperfluidDelegateResponse = { typeUrl: "/osmosis.superfluid.MsgLockAndSuperfluidDelegateResponse", aminoType: "osmosis/lock-and-superfluid-delegate-response", + is(o: any): o is MsgLockAndSuperfluidDelegateResponse { + return o && (o.$typeUrl === MsgLockAndSuperfluidDelegateResponse.typeUrl || typeof o.iD === "bigint"); + }, + isSDK(o: any): o is MsgLockAndSuperfluidDelegateResponseSDKType { + return o && (o.$typeUrl === MsgLockAndSuperfluidDelegateResponse.typeUrl || typeof o.ID === "bigint"); + }, + isAmino(o: any): o is MsgLockAndSuperfluidDelegateResponseAmino { + return o && (o.$typeUrl === MsgLockAndSuperfluidDelegateResponse.typeUrl || typeof o.ID === "bigint"); + }, encode(message: MsgLockAndSuperfluidDelegateResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.iD !== BigInt(0)) { writer.uint32(8).uint64(message.iD); @@ -1020,7 +1105,8 @@ export const MsgLockAndSuperfluidDelegateResponse = { typeUrl: "/osmosis.superfluid.MsgLockAndSuperfluidDelegateResponse", value: MsgLockAndSuperfluidDelegateResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgUnPoolWhitelistedPool(): MsgUnPoolWhitelistedPool { return { @@ -1044,6 +1130,15 @@ function createBaseMsgUnPoolWhitelistedPool(): MsgUnPoolWhitelistedPool { export const MsgUnPoolWhitelistedPool = { typeUrl: "/osmosis.superfluid.MsgUnPoolWhitelistedPool", aminoType: "osmosis/unpool-whitelisted-pool", + is(o: any): o is MsgUnPoolWhitelistedPool { + return o && (o.$typeUrl === MsgUnPoolWhitelistedPool.typeUrl || typeof o.sender === "string" && typeof o.poolId === "bigint"); + }, + isSDK(o: any): o is MsgUnPoolWhitelistedPoolSDKType { + return o && (o.$typeUrl === MsgUnPoolWhitelistedPool.typeUrl || typeof o.sender === "string" && typeof o.pool_id === "bigint"); + }, + isAmino(o: any): o is MsgUnPoolWhitelistedPoolAmino { + return o && (o.$typeUrl === MsgUnPoolWhitelistedPool.typeUrl || typeof o.sender === "string" && typeof o.pool_id === "bigint"); + }, encode(message: MsgUnPoolWhitelistedPool, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.sender !== "") { writer.uint32(10).string(message.sender); @@ -1126,7 +1221,8 @@ export const MsgUnPoolWhitelistedPool = { typeUrl: "/osmosis.superfluid.MsgUnPoolWhitelistedPool", value: MsgUnPoolWhitelistedPool.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgUnPoolWhitelistedPoolResponse(): MsgUnPoolWhitelistedPoolResponse { return { @@ -1141,6 +1237,15 @@ function createBaseMsgUnPoolWhitelistedPoolResponse(): MsgUnPoolWhitelistedPoolR export const MsgUnPoolWhitelistedPoolResponse = { typeUrl: "/osmosis.superfluid.MsgUnPoolWhitelistedPoolResponse", aminoType: "osmosis/un-pool-whitelisted-pool-response", + is(o: any): o is MsgUnPoolWhitelistedPoolResponse { + return o && (o.$typeUrl === MsgUnPoolWhitelistedPoolResponse.typeUrl || Array.isArray(o.exitedLockIds) && (!o.exitedLockIds.length || typeof o.exitedLockIds[0] === "bigint")); + }, + isSDK(o: any): o is MsgUnPoolWhitelistedPoolResponseSDKType { + return o && (o.$typeUrl === MsgUnPoolWhitelistedPoolResponse.typeUrl || Array.isArray(o.exited_lock_ids) && (!o.exited_lock_ids.length || typeof o.exited_lock_ids[0] === "bigint")); + }, + isAmino(o: any): o is MsgUnPoolWhitelistedPoolResponseAmino { + return o && (o.$typeUrl === MsgUnPoolWhitelistedPoolResponse.typeUrl || Array.isArray(o.exited_lock_ids) && (!o.exited_lock_ids.length || typeof o.exited_lock_ids[0] === "bigint")); + }, encode(message: MsgUnPoolWhitelistedPoolResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { writer.uint32(10).fork(); for (const v of message.exitedLockIds) { @@ -1222,5 +1327,6 @@ export const MsgUnPoolWhitelistedPoolResponse = { typeUrl: "/osmosis.superfluid.MsgUnPoolWhitelistedPoolResponse", value: MsgUnPoolWhitelistedPoolResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/osmosis/superfluid/v1beta1/gov.ts b/__fixtures__/v-next/outputv3/osmosis/superfluid/v1beta1/gov.ts index 3c2511c0fc..99d8364d14 100644 --- a/__fixtures__/v-next/outputv3/osmosis/superfluid/v1beta1/gov.ts +++ b/__fixtures__/v-next/outputv3/osmosis/superfluid/v1beta1/gov.ts @@ -1,6 +1,7 @@ import { SuperfluidAsset, SuperfluidAssetAmino, SuperfluidAssetSDKType } from "../superfluid"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { isSet, DeepPartial } from "../../../helpers"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "osmosis.superfluid.v1beta1"; /** * SetSuperfluidAssetsProposal is a gov Content type to update the superfluid @@ -149,6 +150,15 @@ function createBaseSetSuperfluidAssetsProposal(): SetSuperfluidAssetsProposal { export const SetSuperfluidAssetsProposal = { typeUrl: "/osmosis.superfluid.v1beta1.SetSuperfluidAssetsProposal", aminoType: "osmosis/v1beta1/set-superfluid-assets-proposal", + is(o: any): o is SetSuperfluidAssetsProposal { + return o && (o.$typeUrl === SetSuperfluidAssetsProposal.typeUrl || typeof o.title === "string" && typeof o.description === "string" && Array.isArray(o.assets) && (!o.assets.length || SuperfluidAsset.is(o.assets[0]))); + }, + isSDK(o: any): o is SetSuperfluidAssetsProposalSDKType { + return o && (o.$typeUrl === SetSuperfluidAssetsProposal.typeUrl || typeof o.title === "string" && typeof o.description === "string" && Array.isArray(o.assets) && (!o.assets.length || SuperfluidAsset.isSDK(o.assets[0]))); + }, + isAmino(o: any): o is SetSuperfluidAssetsProposalAmino { + return o && (o.$typeUrl === SetSuperfluidAssetsProposal.typeUrl || typeof o.title === "string" && typeof o.description === "string" && Array.isArray(o.assets) && (!o.assets.length || SuperfluidAsset.isAmino(o.assets[0]))); + }, encode(message: SetSuperfluidAssetsProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.title !== "") { writer.uint32(10).string(message.title); @@ -249,6 +259,14 @@ export const SetSuperfluidAssetsProposal = { typeUrl: "/osmosis.superfluid.v1beta1.SetSuperfluidAssetsProposal", value: SetSuperfluidAssetsProposal.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(SetSuperfluidAssetsProposal.typeUrl)) { + return; + } + GlobalDecoderRegistry.register(SetSuperfluidAssetsProposal.typeUrl, SetSuperfluidAssetsProposal); + GlobalDecoderRegistry.registerAminoProtoMapping(SetSuperfluidAssetsProposal.aminoType, SetSuperfluidAssetsProposal.typeUrl); + SuperfluidAsset.registerTypeUrl(); } }; function createBaseRemoveSuperfluidAssetsProposal(): RemoveSuperfluidAssetsProposal { @@ -269,6 +287,15 @@ function createBaseRemoveSuperfluidAssetsProposal(): RemoveSuperfluidAssetsPropo export const RemoveSuperfluidAssetsProposal = { typeUrl: "/osmosis.superfluid.v1beta1.RemoveSuperfluidAssetsProposal", aminoType: "osmosis/v1beta1/remove-superfluid-assets-proposal", + is(o: any): o is RemoveSuperfluidAssetsProposal { + return o && (o.$typeUrl === RemoveSuperfluidAssetsProposal.typeUrl || typeof o.title === "string" && typeof o.description === "string" && Array.isArray(o.superfluidAssetDenoms) && (!o.superfluidAssetDenoms.length || typeof o.superfluidAssetDenoms[0] === "string")); + }, + isSDK(o: any): o is RemoveSuperfluidAssetsProposalSDKType { + return o && (o.$typeUrl === RemoveSuperfluidAssetsProposal.typeUrl || typeof o.title === "string" && typeof o.description === "string" && Array.isArray(o.superfluid_asset_denoms) && (!o.superfluid_asset_denoms.length || typeof o.superfluid_asset_denoms[0] === "string")); + }, + isAmino(o: any): o is RemoveSuperfluidAssetsProposalAmino { + return o && (o.$typeUrl === RemoveSuperfluidAssetsProposal.typeUrl || typeof o.title === "string" && typeof o.description === "string" && Array.isArray(o.superfluid_asset_denoms) && (!o.superfluid_asset_denoms.length || typeof o.superfluid_asset_denoms[0] === "string")); + }, encode(message: RemoveSuperfluidAssetsProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.title !== "") { writer.uint32(10).string(message.title); @@ -369,6 +396,13 @@ export const RemoveSuperfluidAssetsProposal = { typeUrl: "/osmosis.superfluid.v1beta1.RemoveSuperfluidAssetsProposal", value: RemoveSuperfluidAssetsProposal.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(RemoveSuperfluidAssetsProposal.typeUrl)) { + return; + } + GlobalDecoderRegistry.register(RemoveSuperfluidAssetsProposal.typeUrl, RemoveSuperfluidAssetsProposal); + GlobalDecoderRegistry.registerAminoProtoMapping(RemoveSuperfluidAssetsProposal.aminoType, RemoveSuperfluidAssetsProposal.typeUrl); } }; function createBaseUpdateUnpoolWhiteListProposal(): UpdateUnpoolWhiteListProposal { @@ -390,6 +424,15 @@ function createBaseUpdateUnpoolWhiteListProposal(): UpdateUnpoolWhiteListProposa export const UpdateUnpoolWhiteListProposal = { typeUrl: "/osmosis.superfluid.v1beta1.UpdateUnpoolWhiteListProposal", aminoType: "osmosis/v1beta1/update-unpool-white-list-proposal", + is(o: any): o is UpdateUnpoolWhiteListProposal { + return o && (o.$typeUrl === UpdateUnpoolWhiteListProposal.typeUrl || typeof o.title === "string" && typeof o.description === "string" && Array.isArray(o.ids) && (!o.ids.length || typeof o.ids[0] === "bigint") && typeof o.isOverwrite === "boolean"); + }, + isSDK(o: any): o is UpdateUnpoolWhiteListProposalSDKType { + return o && (o.$typeUrl === UpdateUnpoolWhiteListProposal.typeUrl || typeof o.title === "string" && typeof o.description === "string" && Array.isArray(o.ids) && (!o.ids.length || typeof o.ids[0] === "bigint") && typeof o.is_overwrite === "boolean"); + }, + isAmino(o: any): o is UpdateUnpoolWhiteListProposalAmino { + return o && (o.$typeUrl === UpdateUnpoolWhiteListProposal.typeUrl || typeof o.title === "string" && typeof o.description === "string" && Array.isArray(o.ids) && (!o.ids.length || typeof o.ids[0] === "bigint") && typeof o.is_overwrite === "boolean"); + }, encode(message: UpdateUnpoolWhiteListProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.title !== "") { writer.uint32(10).string(message.title); @@ -513,5 +556,12 @@ export const UpdateUnpoolWhiteListProposal = { typeUrl: "/osmosis.superfluid.v1beta1.UpdateUnpoolWhiteListProposal", value: UpdateUnpoolWhiteListProposal.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(UpdateUnpoolWhiteListProposal.typeUrl)) { + return; + } + GlobalDecoderRegistry.register(UpdateUnpoolWhiteListProposal.typeUrl, UpdateUnpoolWhiteListProposal); + GlobalDecoderRegistry.registerAminoProtoMapping(UpdateUnpoolWhiteListProposal.aminoType, UpdateUnpoolWhiteListProposal.typeUrl); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/osmosis/tokenfactory/v1beta1/authorityMetadata.ts b/__fixtures__/v-next/outputv3/osmosis/tokenfactory/v1beta1/authorityMetadata.ts index ea523c01ee..449cbeb1aa 100644 --- a/__fixtures__/v-next/outputv3/osmosis/tokenfactory/v1beta1/authorityMetadata.ts +++ b/__fixtures__/v-next/outputv3/osmosis/tokenfactory/v1beta1/authorityMetadata.ts @@ -60,6 +60,15 @@ function createBaseDenomAuthorityMetadata(): DenomAuthorityMetadata { export const DenomAuthorityMetadata = { typeUrl: "/osmosis.tokenfactory.v1beta1.DenomAuthorityMetadata", aminoType: "osmosis/tokenfactory/denom-authority-metadata", + is(o: any): o is DenomAuthorityMetadata { + return o && (o.$typeUrl === DenomAuthorityMetadata.typeUrl || typeof o.admin === "string"); + }, + isSDK(o: any): o is DenomAuthorityMetadataSDKType { + return o && (o.$typeUrl === DenomAuthorityMetadata.typeUrl || typeof o.admin === "string"); + }, + isAmino(o: any): o is DenomAuthorityMetadataAmino { + return o && (o.$typeUrl === DenomAuthorityMetadata.typeUrl || typeof o.admin === "string"); + }, encode(message: DenomAuthorityMetadata, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.admin !== "") { writer.uint32(10).string(message.admin); @@ -126,5 +135,6 @@ export const DenomAuthorityMetadata = { typeUrl: "/osmosis.tokenfactory.v1beta1.DenomAuthorityMetadata", value: DenomAuthorityMetadata.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/osmosis/tokenfactory/v1beta1/genesis.ts b/__fixtures__/v-next/outputv3/osmosis/tokenfactory/v1beta1/genesis.ts index 643aa0f649..7ed3c1a63f 100644 --- a/__fixtures__/v-next/outputv3/osmosis/tokenfactory/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv3/osmosis/tokenfactory/v1beta1/genesis.ts @@ -1,6 +1,7 @@ import { Params, ParamsAmino, ParamsSDKType } from "./params"; import { DenomAuthorityMetadata, DenomAuthorityMetadataAmino, DenomAuthorityMetadataSDKType } from "./authorityMetadata"; import { BinaryReader, BinaryWriter } from "../../../binary"; +import { GlobalDecoderRegistry } from "../../../registry"; import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "osmosis.tokenfactory.v1beta1"; /** @@ -98,6 +99,15 @@ function createBaseGenesisState(): GenesisState { export const GenesisState = { typeUrl: "/osmosis.tokenfactory.v1beta1.GenesisState", aminoType: "osmosis/tokenfactory/genesis-state", + is(o: any): o is GenesisState { + return o && (o.$typeUrl === GenesisState.typeUrl || Params.is(o.params) && Array.isArray(o.factoryDenoms) && (!o.factoryDenoms.length || GenesisDenom.is(o.factoryDenoms[0]))); + }, + isSDK(o: any): o is GenesisStateSDKType { + return o && (o.$typeUrl === GenesisState.typeUrl || Params.isSDK(o.params) && Array.isArray(o.factory_denoms) && (!o.factory_denoms.length || GenesisDenom.isSDK(o.factory_denoms[0]))); + }, + isAmino(o: any): o is GenesisStateAmino { + return o && (o.$typeUrl === GenesisState.typeUrl || Params.isAmino(o.params) && Array.isArray(o.factory_denoms) && (!o.factory_denoms.length || GenesisDenom.isAmino(o.factory_denoms[0]))); + }, encode(message: GenesisState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.params !== undefined) { Params.encode(message.params, writer.uint32(10).fork()).ldelim(); @@ -186,6 +196,13 @@ export const GenesisState = { typeUrl: "/osmosis.tokenfactory.v1beta1.GenesisState", value: GenesisState.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GenesisState.typeUrl)) { + return; + } + Params.registerTypeUrl(); + GenesisDenom.registerTypeUrl(); } }; function createBaseGenesisDenom(): GenesisDenom { @@ -205,6 +222,15 @@ function createBaseGenesisDenom(): GenesisDenom { export const GenesisDenom = { typeUrl: "/osmosis.tokenfactory.v1beta1.GenesisDenom", aminoType: "osmosis/tokenfactory/genesis-denom", + is(o: any): o is GenesisDenom { + return o && (o.$typeUrl === GenesisDenom.typeUrl || typeof o.denom === "string" && DenomAuthorityMetadata.is(o.authorityMetadata)); + }, + isSDK(o: any): o is GenesisDenomSDKType { + return o && (o.$typeUrl === GenesisDenom.typeUrl || typeof o.denom === "string" && DenomAuthorityMetadata.isSDK(o.authority_metadata)); + }, + isAmino(o: any): o is GenesisDenomAmino { + return o && (o.$typeUrl === GenesisDenom.typeUrl || typeof o.denom === "string" && DenomAuthorityMetadata.isAmino(o.authority_metadata)); + }, encode(message: GenesisDenom, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.denom !== "") { writer.uint32(10).string(message.denom); @@ -287,5 +313,11 @@ export const GenesisDenom = { typeUrl: "/osmosis.tokenfactory.v1beta1.GenesisDenom", value: GenesisDenom.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GenesisDenom.typeUrl)) { + return; + } + DenomAuthorityMetadata.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/osmosis/tokenfactory/v1beta1/params.ts b/__fixtures__/v-next/outputv3/osmosis/tokenfactory/v1beta1/params.ts index b5a6d729e2..d0201b3ee7 100644 --- a/__fixtures__/v-next/outputv3/osmosis/tokenfactory/v1beta1/params.ts +++ b/__fixtures__/v-next/outputv3/osmosis/tokenfactory/v1beta1/params.ts @@ -1,6 +1,7 @@ import { Coin, CoinAmino, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { DeepPartial } from "../../../helpers"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "osmosis.tokenfactory.v1beta1"; /** * Params defines the parameters for the tokenfactory module. @@ -47,6 +48,15 @@ function createBaseParams(): Params { export const Params = { typeUrl: "/osmosis.tokenfactory.v1beta1.Params", aminoType: "osmosis/tokenfactory/params", + is(o: any): o is Params { + return o && (o.$typeUrl === Params.typeUrl || Array.isArray(o.denomCreationFee) && (!o.denomCreationFee.length || Coin.is(o.denomCreationFee[0]))); + }, + isSDK(o: any): o is ParamsSDKType { + return o && (o.$typeUrl === Params.typeUrl || Array.isArray(o.denom_creation_fee) && (!o.denom_creation_fee.length || Coin.isSDK(o.denom_creation_fee[0]))); + }, + isAmino(o: any): o is ParamsAmino { + return o && (o.$typeUrl === Params.typeUrl || Array.isArray(o.denom_creation_fee) && (!o.denom_creation_fee.length || Coin.isAmino(o.denom_creation_fee[0]))); + }, encode(message: Params, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.denomCreationFee) { Coin.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -119,5 +129,11 @@ export const Params = { typeUrl: "/osmosis.tokenfactory.v1beta1.Params", value: Params.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Params.typeUrl)) { + return; + } + Coin.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/osmosis/tokenfactory/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputv3/osmosis/tokenfactory/v1beta1/query.rpc.func.ts new file mode 100644 index 0000000000..727f0a318e --- /dev/null +++ b/__fixtures__/v-next/outputv3/osmosis/tokenfactory/v1beta1/query.rpc.func.ts @@ -0,0 +1,46 @@ +import { Params, ParamsSDKType } from "./params"; +import { DenomAuthorityMetadata, DenomAuthorityMetadataSDKType } from "./authorityMetadata"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, QueryDenomAuthorityMetadataRequest, QueryDenomAuthorityMetadataRequestSDKType, QueryDenomAuthorityMetadataResponse, QueryDenomAuthorityMetadataResponseSDKType, QueryDenomsFromCreatorRequest, QueryDenomsFromCreatorRequestSDKType, QueryDenomsFromCreatorResponse, QueryDenomsFromCreatorResponseSDKType } from "./query"; +/** + * Params defines a gRPC query method that returns the tokenfactory module's + * parameters. + * @name getParams + * @package osmosis.tokenfactory.v1beta1 + * @see proto service: osmosis.tokenfactory.v1beta1.Params + */ +export const getParams = buildQuery({ + encode: QueryParamsRequest.encode, + decode: QueryParamsResponse.decode, + service: "osmosis.tokenfactory.v1beta1.Query", + method: "Params", + deps: [QueryParamsRequest, QueryParamsResponse] +}); +/** + * DenomAuthorityMetadata defines a gRPC query method for fetching + * DenomAuthorityMetadata for a particular denom. + * @name getDenomAuthorityMetadata + * @package osmosis.tokenfactory.v1beta1 + * @see proto service: osmosis.tokenfactory.v1beta1.DenomAuthorityMetadata + */ +export const getDenomAuthorityMetadata = buildQuery({ + encode: QueryDenomAuthorityMetadataRequest.encode, + decode: QueryDenomAuthorityMetadataResponse.decode, + service: "osmosis.tokenfactory.v1beta1.Query", + method: "DenomAuthorityMetadata", + deps: [QueryDenomAuthorityMetadataRequest, QueryDenomAuthorityMetadataResponse] +}); +/** + * DenomsFromCreator defines a gRPC query method for fetching all + * denominations created by a specific admin/creator. + * @name getDenomsFromCreator + * @package osmosis.tokenfactory.v1beta1 + * @see proto service: osmosis.tokenfactory.v1beta1.DenomsFromCreator + */ +export const getDenomsFromCreator = buildQuery({ + encode: QueryDenomsFromCreatorRequest.encode, + decode: QueryDenomsFromCreatorResponse.decode, + service: "osmosis.tokenfactory.v1beta1.Query", + method: "DenomsFromCreator", + deps: [QueryDenomsFromCreatorRequest, QueryDenomsFromCreatorResponse] +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/osmosis/tokenfactory/v1beta1/query.ts b/__fixtures__/v-next/outputv3/osmosis/tokenfactory/v1beta1/query.ts index cabbe61f99..46c1070357 100644 --- a/__fixtures__/v-next/outputv3/osmosis/tokenfactory/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv3/osmosis/tokenfactory/v1beta1/query.ts @@ -2,6 +2,7 @@ import { Params, ParamsAmino, ParamsSDKType } from "./params"; import { DenomAuthorityMetadata, DenomAuthorityMetadataAmino, DenomAuthorityMetadataSDKType } from "./authorityMetadata"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { DeepPartial, isSet } from "../../../helpers"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "osmosis.tokenfactory.v1beta1"; /** * QueryParamsRequest is the request type for the Query/Params RPC method. @@ -213,6 +214,15 @@ function createBaseQueryParamsRequest(): QueryParamsRequest { export const QueryParamsRequest = { typeUrl: "/osmosis.tokenfactory.v1beta1.QueryParamsRequest", aminoType: "osmosis/tokenfactory/query-params-request", + is(o: any): o is QueryParamsRequest { + return o && o.$typeUrl === QueryParamsRequest.typeUrl; + }, + isSDK(o: any): o is QueryParamsRequestSDKType { + return o && o.$typeUrl === QueryParamsRequest.typeUrl; + }, + isAmino(o: any): o is QueryParamsRequestAmino { + return o && o.$typeUrl === QueryParamsRequest.typeUrl; + }, encode(_: QueryParamsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -264,7 +274,8 @@ export const QueryParamsRequest = { typeUrl: "/osmosis.tokenfactory.v1beta1.QueryParamsRequest", value: QueryParamsRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryParamsResponse(): QueryParamsResponse { return { @@ -280,6 +291,15 @@ function createBaseQueryParamsResponse(): QueryParamsResponse { export const QueryParamsResponse = { typeUrl: "/osmosis.tokenfactory.v1beta1.QueryParamsResponse", aminoType: "osmosis/tokenfactory/query-params-response", + is(o: any): o is QueryParamsResponse { + return o && (o.$typeUrl === QueryParamsResponse.typeUrl || Params.is(o.params)); + }, + isSDK(o: any): o is QueryParamsResponseSDKType { + return o && (o.$typeUrl === QueryParamsResponse.typeUrl || Params.isSDK(o.params)); + }, + isAmino(o: any): o is QueryParamsResponseAmino { + return o && (o.$typeUrl === QueryParamsResponse.typeUrl || Params.isAmino(o.params)); + }, encode(message: QueryParamsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.params !== undefined) { Params.encode(message.params, writer.uint32(10).fork()).ldelim(); @@ -348,6 +368,12 @@ export const QueryParamsResponse = { typeUrl: "/osmosis.tokenfactory.v1beta1.QueryParamsResponse", value: QueryParamsResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryParamsResponse.typeUrl)) { + return; + } + Params.registerTypeUrl(); } }; function createBaseQueryDenomAuthorityMetadataRequest(): QueryDenomAuthorityMetadataRequest { @@ -365,6 +391,15 @@ function createBaseQueryDenomAuthorityMetadataRequest(): QueryDenomAuthorityMeta export const QueryDenomAuthorityMetadataRequest = { typeUrl: "/osmosis.tokenfactory.v1beta1.QueryDenomAuthorityMetadataRequest", aminoType: "osmosis/tokenfactory/query-denom-authority-metadata-request", + is(o: any): o is QueryDenomAuthorityMetadataRequest { + return o && (o.$typeUrl === QueryDenomAuthorityMetadataRequest.typeUrl || typeof o.denom === "string"); + }, + isSDK(o: any): o is QueryDenomAuthorityMetadataRequestSDKType { + return o && (o.$typeUrl === QueryDenomAuthorityMetadataRequest.typeUrl || typeof o.denom === "string"); + }, + isAmino(o: any): o is QueryDenomAuthorityMetadataRequestAmino { + return o && (o.$typeUrl === QueryDenomAuthorityMetadataRequest.typeUrl || typeof o.denom === "string"); + }, encode(message: QueryDenomAuthorityMetadataRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.denom !== "") { writer.uint32(10).string(message.denom); @@ -431,7 +466,8 @@ export const QueryDenomAuthorityMetadataRequest = { typeUrl: "/osmosis.tokenfactory.v1beta1.QueryDenomAuthorityMetadataRequest", value: QueryDenomAuthorityMetadataRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryDenomAuthorityMetadataResponse(): QueryDenomAuthorityMetadataResponse { return { @@ -448,6 +484,15 @@ function createBaseQueryDenomAuthorityMetadataResponse(): QueryDenomAuthorityMet export const QueryDenomAuthorityMetadataResponse = { typeUrl: "/osmosis.tokenfactory.v1beta1.QueryDenomAuthorityMetadataResponse", aminoType: "osmosis/tokenfactory/query-denom-authority-metadata-response", + is(o: any): o is QueryDenomAuthorityMetadataResponse { + return o && (o.$typeUrl === QueryDenomAuthorityMetadataResponse.typeUrl || DenomAuthorityMetadata.is(o.authorityMetadata)); + }, + isSDK(o: any): o is QueryDenomAuthorityMetadataResponseSDKType { + return o && (o.$typeUrl === QueryDenomAuthorityMetadataResponse.typeUrl || DenomAuthorityMetadata.isSDK(o.authority_metadata)); + }, + isAmino(o: any): o is QueryDenomAuthorityMetadataResponseAmino { + return o && (o.$typeUrl === QueryDenomAuthorityMetadataResponse.typeUrl || DenomAuthorityMetadata.isAmino(o.authority_metadata)); + }, encode(message: QueryDenomAuthorityMetadataResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.authorityMetadata !== undefined) { DenomAuthorityMetadata.encode(message.authorityMetadata, writer.uint32(10).fork()).ldelim(); @@ -516,6 +561,12 @@ export const QueryDenomAuthorityMetadataResponse = { typeUrl: "/osmosis.tokenfactory.v1beta1.QueryDenomAuthorityMetadataResponse", value: QueryDenomAuthorityMetadataResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryDenomAuthorityMetadataResponse.typeUrl)) { + return; + } + DenomAuthorityMetadata.registerTypeUrl(); } }; function createBaseQueryDenomsFromCreatorRequest(): QueryDenomsFromCreatorRequest { @@ -533,6 +584,15 @@ function createBaseQueryDenomsFromCreatorRequest(): QueryDenomsFromCreatorReques export const QueryDenomsFromCreatorRequest = { typeUrl: "/osmosis.tokenfactory.v1beta1.QueryDenomsFromCreatorRequest", aminoType: "osmosis/tokenfactory/query-denoms-from-creator-request", + is(o: any): o is QueryDenomsFromCreatorRequest { + return o && (o.$typeUrl === QueryDenomsFromCreatorRequest.typeUrl || typeof o.creator === "string"); + }, + isSDK(o: any): o is QueryDenomsFromCreatorRequestSDKType { + return o && (o.$typeUrl === QueryDenomsFromCreatorRequest.typeUrl || typeof o.creator === "string"); + }, + isAmino(o: any): o is QueryDenomsFromCreatorRequestAmino { + return o && (o.$typeUrl === QueryDenomsFromCreatorRequest.typeUrl || typeof o.creator === "string"); + }, encode(message: QueryDenomsFromCreatorRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.creator !== "") { writer.uint32(10).string(message.creator); @@ -599,7 +659,8 @@ export const QueryDenomsFromCreatorRequest = { typeUrl: "/osmosis.tokenfactory.v1beta1.QueryDenomsFromCreatorRequest", value: QueryDenomsFromCreatorRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryDenomsFromCreatorResponse(): QueryDenomsFromCreatorResponse { return { @@ -616,6 +677,15 @@ function createBaseQueryDenomsFromCreatorResponse(): QueryDenomsFromCreatorRespo export const QueryDenomsFromCreatorResponse = { typeUrl: "/osmosis.tokenfactory.v1beta1.QueryDenomsFromCreatorResponse", aminoType: "osmosis/tokenfactory/query-denoms-from-creator-response", + is(o: any): o is QueryDenomsFromCreatorResponse { + return o && (o.$typeUrl === QueryDenomsFromCreatorResponse.typeUrl || Array.isArray(o.denoms) && (!o.denoms.length || typeof o.denoms[0] === "string")); + }, + isSDK(o: any): o is QueryDenomsFromCreatorResponseSDKType { + return o && (o.$typeUrl === QueryDenomsFromCreatorResponse.typeUrl || Array.isArray(o.denoms) && (!o.denoms.length || typeof o.denoms[0] === "string")); + }, + isAmino(o: any): o is QueryDenomsFromCreatorResponseAmino { + return o && (o.$typeUrl === QueryDenomsFromCreatorResponse.typeUrl || Array.isArray(o.denoms) && (!o.denoms.length || typeof o.denoms[0] === "string")); + }, encode(message: QueryDenomsFromCreatorResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.denoms) { writer.uint32(10).string(v!); @@ -688,5 +758,6 @@ export const QueryDenomsFromCreatorResponse = { typeUrl: "/osmosis.tokenfactory.v1beta1.QueryDenomsFromCreatorResponse", value: QueryDenomsFromCreatorResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/osmosis/tokenfactory/v1beta1/tx.registry.ts b/__fixtures__/v-next/outputv3/osmosis/tokenfactory/v1beta1/tx.registry.ts index 46e1dc91fc..9003e92389 100644 --- a/__fixtures__/v-next/outputv3/osmosis/tokenfactory/v1beta1/tx.registry.ts +++ b/__fixtures__/v-next/outputv3/osmosis/tokenfactory/v1beta1/tx.registry.ts @@ -1,13 +1,8 @@ import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { Metadata, MetadataSDKType } from "../../../cosmos/bank/v1beta1/bank"; -import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { TelescopeGeneratedType } from "../../../types"; import { MsgCreateDenom, MsgCreateDenomSDKType, MsgMint, MsgMintSDKType, MsgBurn, MsgBurnSDKType, MsgChangeAdmin, MsgChangeAdminSDKType, MsgSetDenomMetadata, MsgSetDenomMetadataSDKType } from "./tx"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/osmosis.tokenfactory.v1beta1.MsgCreateDenom", MsgCreateDenom], ["/osmosis.tokenfactory.v1beta1.MsgMint", MsgMint], ["/osmosis.tokenfactory.v1beta1.MsgBurn", MsgBurn], ["/osmosis.tokenfactory.v1beta1.MsgChangeAdmin", MsgChangeAdmin], ["/osmosis.tokenfactory.v1beta1.MsgSetDenomMetadata", MsgSetDenomMetadata]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/osmosis.tokenfactory.v1beta1.MsgCreateDenom", MsgCreateDenom], ["/osmosis.tokenfactory.v1beta1.MsgMint", MsgMint], ["/osmosis.tokenfactory.v1beta1.MsgBurn", MsgBurn], ["/osmosis.tokenfactory.v1beta1.MsgChangeAdmin", MsgChangeAdmin], ["/osmosis.tokenfactory.v1beta1.MsgSetDenomMetadata", MsgSetDenomMetadata]]; export const MessageComposer = { encoded: { createDenom(value: MsgCreateDenom) { diff --git a/__fixtures__/v-next/outputv3/osmosis/tokenfactory/v1beta1/tx.rpc.func.ts b/__fixtures__/v-next/outputv3/osmosis/tokenfactory/v1beta1/tx.rpc.func.ts new file mode 100644 index 0000000000..4f68bf3691 --- /dev/null +++ b/__fixtures__/v-next/outputv3/osmosis/tokenfactory/v1beta1/tx.rpc.func.ts @@ -0,0 +1,44 @@ +import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; +import { Metadata, MetadataSDKType } from "../../../cosmos/bank/v1beta1/bank"; +import { buildTx } from "../../../helper-func-types"; +import { MsgCreateDenom, MsgCreateDenomSDKType, MsgCreateDenomResponse, MsgCreateDenomResponseSDKType, MsgMint, MsgMintSDKType, MsgMintResponse, MsgMintResponseSDKType, MsgBurn, MsgBurnSDKType, MsgBurnResponse, MsgBurnResponseSDKType, MsgChangeAdmin, MsgChangeAdminSDKType, MsgChangeAdminResponse, MsgChangeAdminResponseSDKType, MsgSetDenomMetadata, MsgSetDenomMetadataSDKType, MsgSetDenomMetadataResponse, MsgSetDenomMetadataResponseSDKType } from "./tx"; +/** + * @name createDenom + * @package osmosis.tokenfactory.v1beta1 + * @see proto service: osmosis.tokenfactory.v1beta1.CreateDenom + */ +export const createDenom = buildTx({ + msg: MsgCreateDenom +}); +/** + * @name mint + * @package osmosis.tokenfactory.v1beta1 + * @see proto service: osmosis.tokenfactory.v1beta1.Mint + */ +export const mint = buildTx({ + msg: MsgMint +}); +/** + * @name burn + * @package osmosis.tokenfactory.v1beta1 + * @see proto service: osmosis.tokenfactory.v1beta1.Burn + */ +export const burn = buildTx({ + msg: MsgBurn +}); +/** + * @name changeAdmin + * @package osmosis.tokenfactory.v1beta1 + * @see proto service: osmosis.tokenfactory.v1beta1.ChangeAdmin + */ +export const changeAdmin = buildTx({ + msg: MsgChangeAdmin +}); +/** + * @name setDenomMetadata + * @package osmosis.tokenfactory.v1beta1 + * @see proto service: osmosis.tokenfactory.v1beta1.SetDenomMetadata + */ +export const setDenomMetadata = buildTx({ + msg: MsgSetDenomMetadata +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/osmosis/tokenfactory/v1beta1/tx.ts b/__fixtures__/v-next/outputv3/osmosis/tokenfactory/v1beta1/tx.ts index 8aefb59969..42025551c1 100644 --- a/__fixtures__/v-next/outputv3/osmosis/tokenfactory/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputv3/osmosis/tokenfactory/v1beta1/tx.ts @@ -2,6 +2,7 @@ import { Coin, CoinAmino, CoinSDKType } from "../../../cosmos/base/v1beta1/coin" import { Metadata, MetadataAmino, MetadataSDKType } from "../../../cosmos/bank/v1beta1/bank"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { isSet, DeepPartial } from "../../../helpers"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "osmosis.tokenfactory.v1beta1"; /** * MsgCreateDenom defines the message structure for the CreateDenom gRPC service @@ -375,6 +376,15 @@ function createBaseMsgCreateDenom(): MsgCreateDenom { export const MsgCreateDenom = { typeUrl: "/osmosis.tokenfactory.v1beta1.MsgCreateDenom", aminoType: "osmosis/tokenfactory/create-denom", + is(o: any): o is MsgCreateDenom { + return o && (o.$typeUrl === MsgCreateDenom.typeUrl || typeof o.sender === "string" && typeof o.subdenom === "string"); + }, + isSDK(o: any): o is MsgCreateDenomSDKType { + return o && (o.$typeUrl === MsgCreateDenom.typeUrl || typeof o.sender === "string" && typeof o.subdenom === "string"); + }, + isAmino(o: any): o is MsgCreateDenomAmino { + return o && (o.$typeUrl === MsgCreateDenom.typeUrl || typeof o.sender === "string" && typeof o.subdenom === "string"); + }, encode(message: MsgCreateDenom, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.sender !== "") { writer.uint32(10).string(message.sender); @@ -455,7 +465,8 @@ export const MsgCreateDenom = { typeUrl: "/osmosis.tokenfactory.v1beta1.MsgCreateDenom", value: MsgCreateDenom.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgCreateDenomResponse(): MsgCreateDenomResponse { return { @@ -472,6 +483,15 @@ function createBaseMsgCreateDenomResponse(): MsgCreateDenomResponse { export const MsgCreateDenomResponse = { typeUrl: "/osmosis.tokenfactory.v1beta1.MsgCreateDenomResponse", aminoType: "osmosis/tokenfactory/create-denom-response", + is(o: any): o is MsgCreateDenomResponse { + return o && (o.$typeUrl === MsgCreateDenomResponse.typeUrl || typeof o.newTokenDenom === "string"); + }, + isSDK(o: any): o is MsgCreateDenomResponseSDKType { + return o && (o.$typeUrl === MsgCreateDenomResponse.typeUrl || typeof o.new_token_denom === "string"); + }, + isAmino(o: any): o is MsgCreateDenomResponseAmino { + return o && (o.$typeUrl === MsgCreateDenomResponse.typeUrl || typeof o.new_token_denom === "string"); + }, encode(message: MsgCreateDenomResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.newTokenDenom !== "") { writer.uint32(10).string(message.newTokenDenom); @@ -538,7 +558,8 @@ export const MsgCreateDenomResponse = { typeUrl: "/osmosis.tokenfactory.v1beta1.MsgCreateDenomResponse", value: MsgCreateDenomResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgMint(): MsgMint { return { @@ -556,6 +577,15 @@ function createBaseMsgMint(): MsgMint { export const MsgMint = { typeUrl: "/osmosis.tokenfactory.v1beta1.MsgMint", aminoType: "osmosis/tokenfactory/mint", + is(o: any): o is MsgMint { + return o && (o.$typeUrl === MsgMint.typeUrl || typeof o.sender === "string" && Coin.is(o.amount)); + }, + isSDK(o: any): o is MsgMintSDKType { + return o && (o.$typeUrl === MsgMint.typeUrl || typeof o.sender === "string" && Coin.isSDK(o.amount)); + }, + isAmino(o: any): o is MsgMintAmino { + return o && (o.$typeUrl === MsgMint.typeUrl || typeof o.sender === "string" && Coin.isAmino(o.amount)); + }, encode(message: MsgMint, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.sender !== "") { writer.uint32(10).string(message.sender); @@ -638,6 +668,12 @@ export const MsgMint = { typeUrl: "/osmosis.tokenfactory.v1beta1.MsgMint", value: MsgMint.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgMint.typeUrl)) { + return; + } + Coin.registerTypeUrl(); } }; function createBaseMsgMintResponse(): MsgMintResponse { @@ -651,6 +687,15 @@ function createBaseMsgMintResponse(): MsgMintResponse { export const MsgMintResponse = { typeUrl: "/osmosis.tokenfactory.v1beta1.MsgMintResponse", aminoType: "osmosis/tokenfactory/mint-response", + is(o: any): o is MsgMintResponse { + return o && o.$typeUrl === MsgMintResponse.typeUrl; + }, + isSDK(o: any): o is MsgMintResponseSDKType { + return o && o.$typeUrl === MsgMintResponse.typeUrl; + }, + isAmino(o: any): o is MsgMintResponseAmino { + return o && o.$typeUrl === MsgMintResponse.typeUrl; + }, encode(_: MsgMintResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -702,7 +747,8 @@ export const MsgMintResponse = { typeUrl: "/osmosis.tokenfactory.v1beta1.MsgMintResponse", value: MsgMintResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgBurn(): MsgBurn { return { @@ -720,6 +766,15 @@ function createBaseMsgBurn(): MsgBurn { export const MsgBurn = { typeUrl: "/osmosis.tokenfactory.v1beta1.MsgBurn", aminoType: "osmosis/tokenfactory/burn", + is(o: any): o is MsgBurn { + return o && (o.$typeUrl === MsgBurn.typeUrl || typeof o.sender === "string" && Coin.is(o.amount)); + }, + isSDK(o: any): o is MsgBurnSDKType { + return o && (o.$typeUrl === MsgBurn.typeUrl || typeof o.sender === "string" && Coin.isSDK(o.amount)); + }, + isAmino(o: any): o is MsgBurnAmino { + return o && (o.$typeUrl === MsgBurn.typeUrl || typeof o.sender === "string" && Coin.isAmino(o.amount)); + }, encode(message: MsgBurn, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.sender !== "") { writer.uint32(10).string(message.sender); @@ -802,6 +857,12 @@ export const MsgBurn = { typeUrl: "/osmosis.tokenfactory.v1beta1.MsgBurn", value: MsgBurn.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgBurn.typeUrl)) { + return; + } + Coin.registerTypeUrl(); } }; function createBaseMsgBurnResponse(): MsgBurnResponse { @@ -815,6 +876,15 @@ function createBaseMsgBurnResponse(): MsgBurnResponse { export const MsgBurnResponse = { typeUrl: "/osmosis.tokenfactory.v1beta1.MsgBurnResponse", aminoType: "osmosis/tokenfactory/burn-response", + is(o: any): o is MsgBurnResponse { + return o && o.$typeUrl === MsgBurnResponse.typeUrl; + }, + isSDK(o: any): o is MsgBurnResponseSDKType { + return o && o.$typeUrl === MsgBurnResponse.typeUrl; + }, + isAmino(o: any): o is MsgBurnResponseAmino { + return o && o.$typeUrl === MsgBurnResponse.typeUrl; + }, encode(_: MsgBurnResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -866,7 +936,8 @@ export const MsgBurnResponse = { typeUrl: "/osmosis.tokenfactory.v1beta1.MsgBurnResponse", value: MsgBurnResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgChangeAdmin(): MsgChangeAdmin { return { @@ -885,6 +956,15 @@ function createBaseMsgChangeAdmin(): MsgChangeAdmin { export const MsgChangeAdmin = { typeUrl: "/osmosis.tokenfactory.v1beta1.MsgChangeAdmin", aminoType: "osmosis/tokenfactory/change-admin", + is(o: any): o is MsgChangeAdmin { + return o && (o.$typeUrl === MsgChangeAdmin.typeUrl || typeof o.sender === "string" && typeof o.denom === "string" && typeof o.newAdmin === "string"); + }, + isSDK(o: any): o is MsgChangeAdminSDKType { + return o && (o.$typeUrl === MsgChangeAdmin.typeUrl || typeof o.sender === "string" && typeof o.denom === "string" && typeof o.new_admin === "string"); + }, + isAmino(o: any): o is MsgChangeAdminAmino { + return o && (o.$typeUrl === MsgChangeAdmin.typeUrl || typeof o.sender === "string" && typeof o.denom === "string" && typeof o.new_admin === "string"); + }, encode(message: MsgChangeAdmin, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.sender !== "") { writer.uint32(10).string(message.sender); @@ -979,7 +1059,8 @@ export const MsgChangeAdmin = { typeUrl: "/osmosis.tokenfactory.v1beta1.MsgChangeAdmin", value: MsgChangeAdmin.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgChangeAdminResponse(): MsgChangeAdminResponse { return {}; @@ -994,6 +1075,15 @@ function createBaseMsgChangeAdminResponse(): MsgChangeAdminResponse { export const MsgChangeAdminResponse = { typeUrl: "/osmosis.tokenfactory.v1beta1.MsgChangeAdminResponse", aminoType: "osmosis/tokenfactory/change-admin-response", + is(o: any): o is MsgChangeAdminResponse { + return o && o.$typeUrl === MsgChangeAdminResponse.typeUrl; + }, + isSDK(o: any): o is MsgChangeAdminResponseSDKType { + return o && o.$typeUrl === MsgChangeAdminResponse.typeUrl; + }, + isAmino(o: any): o is MsgChangeAdminResponseAmino { + return o && o.$typeUrl === MsgChangeAdminResponse.typeUrl; + }, encode(_: MsgChangeAdminResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -1045,7 +1135,8 @@ export const MsgChangeAdminResponse = { typeUrl: "/osmosis.tokenfactory.v1beta1.MsgChangeAdminResponse", value: MsgChangeAdminResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseMsgSetDenomMetadata(): MsgSetDenomMetadata { return { @@ -1063,6 +1154,15 @@ function createBaseMsgSetDenomMetadata(): MsgSetDenomMetadata { export const MsgSetDenomMetadata = { typeUrl: "/osmosis.tokenfactory.v1beta1.MsgSetDenomMetadata", aminoType: "osmosis/tokenfactory/set-denom-metadata", + is(o: any): o is MsgSetDenomMetadata { + return o && (o.$typeUrl === MsgSetDenomMetadata.typeUrl || typeof o.sender === "string" && Metadata.is(o.metadata)); + }, + isSDK(o: any): o is MsgSetDenomMetadataSDKType { + return o && (o.$typeUrl === MsgSetDenomMetadata.typeUrl || typeof o.sender === "string" && Metadata.isSDK(o.metadata)); + }, + isAmino(o: any): o is MsgSetDenomMetadataAmino { + return o && (o.$typeUrl === MsgSetDenomMetadata.typeUrl || typeof o.sender === "string" && Metadata.isAmino(o.metadata)); + }, encode(message: MsgSetDenomMetadata, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.sender !== "") { writer.uint32(10).string(message.sender); @@ -1145,6 +1245,12 @@ export const MsgSetDenomMetadata = { typeUrl: "/osmosis.tokenfactory.v1beta1.MsgSetDenomMetadata", value: MsgSetDenomMetadata.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgSetDenomMetadata.typeUrl)) { + return; + } + Metadata.registerTypeUrl(); } }; function createBaseMsgSetDenomMetadataResponse(): MsgSetDenomMetadataResponse { @@ -1160,6 +1266,15 @@ function createBaseMsgSetDenomMetadataResponse(): MsgSetDenomMetadataResponse { export const MsgSetDenomMetadataResponse = { typeUrl: "/osmosis.tokenfactory.v1beta1.MsgSetDenomMetadataResponse", aminoType: "osmosis/tokenfactory/set-denom-metadata-response", + is(o: any): o is MsgSetDenomMetadataResponse { + return o && o.$typeUrl === MsgSetDenomMetadataResponse.typeUrl; + }, + isSDK(o: any): o is MsgSetDenomMetadataResponseSDKType { + return o && o.$typeUrl === MsgSetDenomMetadataResponse.typeUrl; + }, + isAmino(o: any): o is MsgSetDenomMetadataResponseAmino { + return o && o.$typeUrl === MsgSetDenomMetadataResponse.typeUrl; + }, encode(_: MsgSetDenomMetadataResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -1211,5 +1326,6 @@ export const MsgSetDenomMetadataResponse = { typeUrl: "/osmosis.tokenfactory.v1beta1.MsgSetDenomMetadataResponse", value: MsgSetDenomMetadataResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/osmosis/twap/v1beta1/genesis.ts b/__fixtures__/v-next/outputv3/osmosis/twap/v1beta1/genesis.ts index 9bc959fb8a..845cd0df20 100644 --- a/__fixtures__/v-next/outputv3/osmosis/twap/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv3/osmosis/twap/v1beta1/genesis.ts @@ -1,6 +1,7 @@ import { Duration, DurationAmino, DurationSDKType } from "../../../google/protobuf/duration"; import { TwapRecord, TwapRecordAmino, TwapRecordSDKType } from "./twap_record"; import { BinaryReader, BinaryWriter } from "../../../binary"; +import { GlobalDecoderRegistry } from "../../../registry"; import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "osmosis.twap.v1beta1"; /** @@ -98,6 +99,15 @@ function createBaseParams(): Params { export const Params = { typeUrl: "/osmosis.twap.v1beta1.Params", aminoType: "osmosis/twap/params", + is(o: any): o is Params { + return o && (o.$typeUrl === Params.typeUrl || typeof o.pruneEpochIdentifier === "string" && Duration.is(o.recordHistoryKeepPeriod)); + }, + isSDK(o: any): o is ParamsSDKType { + return o && (o.$typeUrl === Params.typeUrl || typeof o.prune_epoch_identifier === "string" && Duration.isSDK(o.record_history_keep_period)); + }, + isAmino(o: any): o is ParamsAmino { + return o && (o.$typeUrl === Params.typeUrl || typeof o.prune_epoch_identifier === "string" && Duration.isAmino(o.record_history_keep_period)); + }, encode(message: Params, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.pruneEpochIdentifier !== "") { writer.uint32(10).string(message.pruneEpochIdentifier); @@ -180,7 +190,8 @@ export const Params = { typeUrl: "/osmosis.twap.v1beta1.Params", value: Params.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseGenesisState(): GenesisState { return { @@ -197,6 +208,15 @@ function createBaseGenesisState(): GenesisState { export const GenesisState = { typeUrl: "/osmosis.twap.v1beta1.GenesisState", aminoType: "osmosis/twap/genesis-state", + is(o: any): o is GenesisState { + return o && (o.$typeUrl === GenesisState.typeUrl || Array.isArray(o.twaps) && (!o.twaps.length || TwapRecord.is(o.twaps[0])) && Params.is(o.params)); + }, + isSDK(o: any): o is GenesisStateSDKType { + return o && (o.$typeUrl === GenesisState.typeUrl || Array.isArray(o.twaps) && (!o.twaps.length || TwapRecord.isSDK(o.twaps[0])) && Params.isSDK(o.params)); + }, + isAmino(o: any): o is GenesisStateAmino { + return o && (o.$typeUrl === GenesisState.typeUrl || Array.isArray(o.twaps) && (!o.twaps.length || TwapRecord.isAmino(o.twaps[0])) && Params.isAmino(o.params)); + }, encode(message: GenesisState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.twaps) { TwapRecord.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -285,5 +305,12 @@ export const GenesisState = { typeUrl: "/osmosis.twap.v1beta1.GenesisState", value: GenesisState.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GenesisState.typeUrl)) { + return; + } + TwapRecord.registerTypeUrl(); + Params.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/osmosis/twap/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputv3/osmosis/twap/v1beta1/query.rpc.func.ts new file mode 100644 index 0000000000..73ef1efe57 --- /dev/null +++ b/__fixtures__/v-next/outputv3/osmosis/twap/v1beta1/query.rpc.func.ts @@ -0,0 +1,41 @@ +import { Timestamp, TimestampSDKType } from "../../../google/protobuf/timestamp"; +import { Params, ParamsSDKType } from "./genesis"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { ParamsRequest, ParamsRequestSDKType, ParamsResponse, ParamsResponseSDKType, ArithmeticTwapRequest, ArithmeticTwapRequestSDKType, ArithmeticTwapResponse, ArithmeticTwapResponseSDKType, ArithmeticTwapToNowRequest, ArithmeticTwapToNowRequestSDKType, ArithmeticTwapToNowResponse, ArithmeticTwapToNowResponseSDKType } from "./query"; +/** + * @name getParams + * @package osmosis.twap.v1beta1 + * @see proto service: osmosis.twap.v1beta1.Params + */ +export const getParams = buildQuery({ + encode: ParamsRequest.encode, + decode: ParamsResponse.decode, + service: "osmosis.twap.v1beta1.Query", + method: "Params", + deps: [ParamsRequest, ParamsResponse] +}); +/** + * @name getArithmeticTwap + * @package osmosis.twap.v1beta1 + * @see proto service: osmosis.twap.v1beta1.ArithmeticTwap + */ +export const getArithmeticTwap = buildQuery({ + encode: ArithmeticTwapRequest.encode, + decode: ArithmeticTwapResponse.decode, + service: "osmosis.twap.v1beta1.Query", + method: "ArithmeticTwap", + deps: [ArithmeticTwapRequest, ArithmeticTwapResponse] +}); +/** + * @name getArithmeticTwapToNow + * @package osmosis.twap.v1beta1 + * @see proto service: osmosis.twap.v1beta1.ArithmeticTwapToNow + * @deprecated + */ +export const getArithmeticTwapToNow = buildQuery({ + encode: ArithmeticTwapToNowRequest.encode, + decode: ArithmeticTwapToNowResponse.decode, + service: "osmosis.twap.v1beta1.Query", + method: "ArithmeticTwapToNow", + deps: [ArithmeticTwapToNowRequest, ArithmeticTwapToNowResponse] +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/osmosis/twap/v1beta1/query.ts b/__fixtures__/v-next/outputv3/osmosis/twap/v1beta1/query.ts index f1f86822eb..dbf4e44257 100644 --- a/__fixtures__/v-next/outputv3/osmosis/twap/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv3/osmosis/twap/v1beta1/query.ts @@ -2,7 +2,8 @@ import { Timestamp, TimestampAmino, TimestampSDKType } from "../../../google/pro import { Params, ParamsAmino, ParamsSDKType } from "./genesis"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { toTimestamp, fromTimestamp, isSet, DeepPartial } from "../../../helpers"; -import { Decimal } from "@cosmjs/math"; +import { Decimal } from "@interchainjs/math"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "osmosis.twap.v1beta1"; /** * @name ArithmeticTwapRequest @@ -204,6 +205,15 @@ function createBaseArithmeticTwapRequest(): ArithmeticTwapRequest { export const ArithmeticTwapRequest = { typeUrl: "/osmosis.twap.v1beta1.ArithmeticTwapRequest", aminoType: "osmosis/twap/arithmetic-twap-request", + is(o: any): o is ArithmeticTwapRequest { + return o && (o.$typeUrl === ArithmeticTwapRequest.typeUrl || typeof o.poolId === "bigint" && typeof o.baseAsset === "string" && typeof o.quoteAsset === "string" && Timestamp.is(o.startTime)); + }, + isSDK(o: any): o is ArithmeticTwapRequestSDKType { + return o && (o.$typeUrl === ArithmeticTwapRequest.typeUrl || typeof o.pool_id === "bigint" && typeof o.base_asset === "string" && typeof o.quote_asset === "string" && Timestamp.isSDK(o.start_time)); + }, + isAmino(o: any): o is ArithmeticTwapRequestAmino { + return o && (o.$typeUrl === ArithmeticTwapRequest.typeUrl || typeof o.pool_id === "bigint" && typeof o.base_asset === "string" && typeof o.quote_asset === "string" && Timestamp.isAmino(o.start_time)); + }, encode(message: ArithmeticTwapRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.poolId !== BigInt(0)) { writer.uint32(8).uint64(message.poolId); @@ -328,7 +338,8 @@ export const ArithmeticTwapRequest = { typeUrl: "/osmosis.twap.v1beta1.ArithmeticTwapRequest", value: ArithmeticTwapRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseArithmeticTwapResponse(): ArithmeticTwapResponse { return { @@ -343,6 +354,15 @@ function createBaseArithmeticTwapResponse(): ArithmeticTwapResponse { export const ArithmeticTwapResponse = { typeUrl: "/osmosis.twap.v1beta1.ArithmeticTwapResponse", aminoType: "osmosis/twap/arithmetic-twap-response", + is(o: any): o is ArithmeticTwapResponse { + return o && (o.$typeUrl === ArithmeticTwapResponse.typeUrl || typeof o.arithmeticTwap === "string"); + }, + isSDK(o: any): o is ArithmeticTwapResponseSDKType { + return o && (o.$typeUrl === ArithmeticTwapResponse.typeUrl || typeof o.arithmetic_twap === "string"); + }, + isAmino(o: any): o is ArithmeticTwapResponseAmino { + return o && (o.$typeUrl === ArithmeticTwapResponse.typeUrl || typeof o.arithmetic_twap === "string"); + }, encode(message: ArithmeticTwapResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.arithmeticTwap !== "") { writer.uint32(10).string(Decimal.fromUserInput(message.arithmeticTwap, 18).atomics); @@ -395,7 +415,7 @@ export const ArithmeticTwapResponse = { }, toAmino(message: ArithmeticTwapResponse, useInterfaces: boolean = true): ArithmeticTwapResponseAmino { const obj: any = {}; - obj.arithmetic_twap = message.arithmeticTwap === "" ? undefined : message.arithmeticTwap; + obj.arithmetic_twap = message.arithmeticTwap === "" ? undefined : Decimal.fromUserInput(message.arithmeticTwap, 18).atomics; return obj; }, fromProtoMsg(message: ArithmeticTwapResponseProtoMsg, useInterfaces: boolean = true): ArithmeticTwapResponse { @@ -409,7 +429,8 @@ export const ArithmeticTwapResponse = { typeUrl: "/osmosis.twap.v1beta1.ArithmeticTwapResponse", value: ArithmeticTwapResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseArithmeticTwapToNowRequest(): ArithmeticTwapToNowRequest { return { @@ -427,6 +448,15 @@ function createBaseArithmeticTwapToNowRequest(): ArithmeticTwapToNowRequest { export const ArithmeticTwapToNowRequest = { typeUrl: "/osmosis.twap.v1beta1.ArithmeticTwapToNowRequest", aminoType: "osmosis/twap/arithmetic-twap-to-now-request", + is(o: any): o is ArithmeticTwapToNowRequest { + return o && (o.$typeUrl === ArithmeticTwapToNowRequest.typeUrl || typeof o.poolId === "bigint" && typeof o.baseAsset === "string" && typeof o.quoteAsset === "string" && Timestamp.is(o.startTime)); + }, + isSDK(o: any): o is ArithmeticTwapToNowRequestSDKType { + return o && (o.$typeUrl === ArithmeticTwapToNowRequest.typeUrl || typeof o.pool_id === "bigint" && typeof o.base_asset === "string" && typeof o.quote_asset === "string" && Timestamp.isSDK(o.start_time)); + }, + isAmino(o: any): o is ArithmeticTwapToNowRequestAmino { + return o && (o.$typeUrl === ArithmeticTwapToNowRequest.typeUrl || typeof o.pool_id === "bigint" && typeof o.base_asset === "string" && typeof o.quote_asset === "string" && Timestamp.isAmino(o.start_time)); + }, encode(message: ArithmeticTwapToNowRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.poolId !== BigInt(0)) { writer.uint32(8).uint64(message.poolId); @@ -537,7 +567,8 @@ export const ArithmeticTwapToNowRequest = { typeUrl: "/osmosis.twap.v1beta1.ArithmeticTwapToNowRequest", value: ArithmeticTwapToNowRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseArithmeticTwapToNowResponse(): ArithmeticTwapToNowResponse { return { @@ -552,6 +583,15 @@ function createBaseArithmeticTwapToNowResponse(): ArithmeticTwapToNowResponse { export const ArithmeticTwapToNowResponse = { typeUrl: "/osmosis.twap.v1beta1.ArithmeticTwapToNowResponse", aminoType: "osmosis/twap/arithmetic-twap-to-now-response", + is(o: any): o is ArithmeticTwapToNowResponse { + return o && (o.$typeUrl === ArithmeticTwapToNowResponse.typeUrl || typeof o.arithmeticTwap === "string"); + }, + isSDK(o: any): o is ArithmeticTwapToNowResponseSDKType { + return o && (o.$typeUrl === ArithmeticTwapToNowResponse.typeUrl || typeof o.arithmetic_twap === "string"); + }, + isAmino(o: any): o is ArithmeticTwapToNowResponseAmino { + return o && (o.$typeUrl === ArithmeticTwapToNowResponse.typeUrl || typeof o.arithmetic_twap === "string"); + }, encode(message: ArithmeticTwapToNowResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.arithmeticTwap !== "") { writer.uint32(10).string(Decimal.fromUserInput(message.arithmeticTwap, 18).atomics); @@ -604,7 +644,7 @@ export const ArithmeticTwapToNowResponse = { }, toAmino(message: ArithmeticTwapToNowResponse, useInterfaces: boolean = true): ArithmeticTwapToNowResponseAmino { const obj: any = {}; - obj.arithmetic_twap = message.arithmeticTwap === "" ? undefined : message.arithmeticTwap; + obj.arithmetic_twap = message.arithmeticTwap === "" ? undefined : Decimal.fromUserInput(message.arithmeticTwap, 18).atomics; return obj; }, fromProtoMsg(message: ArithmeticTwapToNowResponseProtoMsg, useInterfaces: boolean = true): ArithmeticTwapToNowResponse { @@ -618,7 +658,8 @@ export const ArithmeticTwapToNowResponse = { typeUrl: "/osmosis.twap.v1beta1.ArithmeticTwapToNowResponse", value: ArithmeticTwapToNowResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseParamsRequest(): ParamsRequest { return {}; @@ -631,6 +672,15 @@ function createBaseParamsRequest(): ParamsRequest { export const ParamsRequest = { typeUrl: "/osmosis.twap.v1beta1.ParamsRequest", aminoType: "osmosis/twap/params-request", + is(o: any): o is ParamsRequest { + return o && o.$typeUrl === ParamsRequest.typeUrl; + }, + isSDK(o: any): o is ParamsRequestSDKType { + return o && o.$typeUrl === ParamsRequest.typeUrl; + }, + isAmino(o: any): o is ParamsRequestAmino { + return o && o.$typeUrl === ParamsRequest.typeUrl; + }, encode(_: ParamsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -682,7 +732,8 @@ export const ParamsRequest = { typeUrl: "/osmosis.twap.v1beta1.ParamsRequest", value: ParamsRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseParamsResponse(): ParamsResponse { return { @@ -697,6 +748,15 @@ function createBaseParamsResponse(): ParamsResponse { export const ParamsResponse = { typeUrl: "/osmosis.twap.v1beta1.ParamsResponse", aminoType: "osmosis/twap/params-response", + is(o: any): o is ParamsResponse { + return o && (o.$typeUrl === ParamsResponse.typeUrl || Params.is(o.params)); + }, + isSDK(o: any): o is ParamsResponseSDKType { + return o && (o.$typeUrl === ParamsResponse.typeUrl || Params.isSDK(o.params)); + }, + isAmino(o: any): o is ParamsResponseAmino { + return o && (o.$typeUrl === ParamsResponse.typeUrl || Params.isAmino(o.params)); + }, encode(message: ParamsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.params !== undefined) { Params.encode(message.params, writer.uint32(10).fork()).ldelim(); @@ -765,5 +825,11 @@ export const ParamsResponse = { typeUrl: "/osmosis.twap.v1beta1.ParamsResponse", value: ParamsResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ParamsResponse.typeUrl)) { + return; + } + Params.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/osmosis/twap/v1beta1/twap_record.ts b/__fixtures__/v-next/outputv3/osmosis/twap/v1beta1/twap_record.ts index 891e9c46e8..e009fd9954 100644 --- a/__fixtures__/v-next/outputv3/osmosis/twap/v1beta1/twap_record.ts +++ b/__fixtures__/v-next/outputv3/osmosis/twap/v1beta1/twap_record.ts @@ -1,7 +1,7 @@ import { Timestamp, TimestampAmino, TimestampSDKType } from "../../../google/protobuf/timestamp"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { toTimestamp, fromTimestamp, isSet, DeepPartial } from "../../../helpers"; -import { Decimal } from "@cosmjs/math"; +import { Decimal } from "@interchainjs/math"; export const protobufPackage = "osmosis.twap.v1beta1"; /** * A TWAP record should be indexed in state by pool_id, (asset pair), timestamp @@ -152,6 +152,15 @@ function createBaseTwapRecord(): TwapRecord { export const TwapRecord = { typeUrl: "/osmosis.twap.v1beta1.TwapRecord", aminoType: "osmosis/twap/twap-record", + is(o: any): o is TwapRecord { + return o && (o.$typeUrl === TwapRecord.typeUrl || typeof o.poolId === "bigint" && typeof o.asset0Denom === "string" && typeof o.asset1Denom === "string" && typeof o.height === "bigint" && Timestamp.is(o.time) && typeof o.p0LastSpotPrice === "string" && typeof o.p1LastSpotPrice === "string" && typeof o.p0ArithmeticTwapAccumulator === "string" && typeof o.p1ArithmeticTwapAccumulator === "string" && Timestamp.is(o.lastErrorTime)); + }, + isSDK(o: any): o is TwapRecordSDKType { + return o && (o.$typeUrl === TwapRecord.typeUrl || typeof o.pool_id === "bigint" && typeof o.asset0_denom === "string" && typeof o.asset1_denom === "string" && typeof o.height === "bigint" && Timestamp.isSDK(o.time) && typeof o.p0_last_spot_price === "string" && typeof o.p1_last_spot_price === "string" && typeof o.p0_arithmetic_twap_accumulator === "string" && typeof o.p1_arithmetic_twap_accumulator === "string" && Timestamp.isSDK(o.last_error_time)); + }, + isAmino(o: any): o is TwapRecordAmino { + return o && (o.$typeUrl === TwapRecord.typeUrl || typeof o.pool_id === "bigint" && typeof o.asset0_denom === "string" && typeof o.asset1_denom === "string" && typeof o.height === "bigint" && Timestamp.isAmino(o.time) && typeof o.p0_last_spot_price === "string" && typeof o.p1_last_spot_price === "string" && typeof o.p0_arithmetic_twap_accumulator === "string" && typeof o.p1_arithmetic_twap_accumulator === "string" && Timestamp.isAmino(o.last_error_time)); + }, encode(message: TwapRecord, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.poolId !== BigInt(0)) { writer.uint32(8).uint64(message.poolId); @@ -330,10 +339,10 @@ export const TwapRecord = { obj.asset1_denom = message.asset1Denom === "" ? undefined : message.asset1Denom; obj.height = message.height ? message.height?.toString() : "0"; obj.time = message.time ? Timestamp.toAmino(toTimestamp(message.time)) : undefined; - obj.p0_last_spot_price = message.p0LastSpotPrice === "" ? undefined : message.p0LastSpotPrice; - obj.p1_last_spot_price = message.p1LastSpotPrice === "" ? undefined : message.p1LastSpotPrice; - obj.p0_arithmetic_twap_accumulator = message.p0ArithmeticTwapAccumulator === "" ? undefined : message.p0ArithmeticTwapAccumulator; - obj.p1_arithmetic_twap_accumulator = message.p1ArithmeticTwapAccumulator === "" ? undefined : message.p1ArithmeticTwapAccumulator; + obj.p0_last_spot_price = message.p0LastSpotPrice === "" ? undefined : Decimal.fromUserInput(message.p0LastSpotPrice, 18).atomics; + obj.p1_last_spot_price = message.p1LastSpotPrice === "" ? undefined : Decimal.fromUserInput(message.p1LastSpotPrice, 18).atomics; + obj.p0_arithmetic_twap_accumulator = message.p0ArithmeticTwapAccumulator === "" ? undefined : Decimal.fromUserInput(message.p0ArithmeticTwapAccumulator, 18).atomics; + obj.p1_arithmetic_twap_accumulator = message.p1ArithmeticTwapAccumulator === "" ? undefined : Decimal.fromUserInput(message.p1ArithmeticTwapAccumulator, 18).atomics; obj.last_error_time = message.lastErrorTime ? Timestamp.toAmino(toTimestamp(message.lastErrorTime)) : undefined; return obj; }, @@ -348,5 +357,6 @@ export const TwapRecord = { typeUrl: "/osmosis.twap.v1beta1.TwapRecord", value: TwapRecord.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/osmosis/txfees/v1beta1/feetoken.ts b/__fixtures__/v-next/outputv3/osmosis/txfees/v1beta1/feetoken.ts index 476a8b7ff4..ca5dd507e5 100644 --- a/__fixtures__/v-next/outputv3/osmosis/txfees/v1beta1/feetoken.ts +++ b/__fixtures__/v-next/outputv3/osmosis/txfees/v1beta1/feetoken.ts @@ -62,6 +62,15 @@ function createBaseFeeToken(): FeeToken { export const FeeToken = { typeUrl: "/osmosis.txfees.v1beta1.FeeToken", aminoType: "osmosis/txfees/fee-token", + is(o: any): o is FeeToken { + return o && (o.$typeUrl === FeeToken.typeUrl || typeof o.denom === "string" && typeof o.poolID === "bigint"); + }, + isSDK(o: any): o is FeeTokenSDKType { + return o && (o.$typeUrl === FeeToken.typeUrl || typeof o.denom === "string" && typeof o.poolID === "bigint"); + }, + isAmino(o: any): o is FeeTokenAmino { + return o && (o.$typeUrl === FeeToken.typeUrl || typeof o.denom === "string" && typeof o.poolID === "bigint"); + }, encode(message: FeeToken, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.denom !== "") { writer.uint32(10).string(message.denom); @@ -144,5 +153,6 @@ export const FeeToken = { typeUrl: "/osmosis.txfees.v1beta1.FeeToken", value: FeeToken.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/osmosis/txfees/v1beta1/genesis.ts b/__fixtures__/v-next/outputv3/osmosis/txfees/v1beta1/genesis.ts index 30acd7597b..e460ad5366 100644 --- a/__fixtures__/v-next/outputv3/osmosis/txfees/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv3/osmosis/txfees/v1beta1/genesis.ts @@ -1,6 +1,7 @@ import { FeeToken, FeeTokenAmino, FeeTokenSDKType } from "./feetoken"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { isSet, DeepPartial } from "../../../helpers"; +import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "osmosis.txfees.v1beta1"; /** * GenesisState defines the txfees module's genesis state. @@ -51,6 +52,15 @@ function createBaseGenesisState(): GenesisState { export const GenesisState = { typeUrl: "/osmosis.txfees.v1beta1.GenesisState", aminoType: "osmosis/txfees/genesis-state", + is(o: any): o is GenesisState { + return o && (o.$typeUrl === GenesisState.typeUrl || typeof o.basedenom === "string" && Array.isArray(o.feetokens) && (!o.feetokens.length || FeeToken.is(o.feetokens[0]))); + }, + isSDK(o: any): o is GenesisStateSDKType { + return o && (o.$typeUrl === GenesisState.typeUrl || typeof o.basedenom === "string" && Array.isArray(o.feetokens) && (!o.feetokens.length || FeeToken.isSDK(o.feetokens[0]))); + }, + isAmino(o: any): o is GenesisStateAmino { + return o && (o.$typeUrl === GenesisState.typeUrl || typeof o.basedenom === "string" && Array.isArray(o.feetokens) && (!o.feetokens.length || FeeToken.isAmino(o.feetokens[0]))); + }, encode(message: GenesisState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.basedenom !== "") { writer.uint32(10).string(message.basedenom); @@ -137,5 +147,11 @@ export const GenesisState = { typeUrl: "/osmosis.txfees.v1beta1.GenesisState", value: GenesisState.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GenesisState.typeUrl)) { + return; + } + FeeToken.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/osmosis/txfees/v1beta1/gov.ts b/__fixtures__/v-next/outputv3/osmosis/txfees/v1beta1/gov.ts index bd7a05fa58..58fb946eb9 100644 --- a/__fixtures__/v-next/outputv3/osmosis/txfees/v1beta1/gov.ts +++ b/__fixtures__/v-next/outputv3/osmosis/txfees/v1beta1/gov.ts @@ -1,5 +1,6 @@ import { FeeToken, FeeTokenAmino, FeeTokenSDKType } from "./feetoken"; import { BinaryReader, BinaryWriter } from "../../../binary"; +import { GlobalDecoderRegistry } from "../../../registry"; import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "osmosis.txfees.v1beta1"; /** @@ -74,6 +75,15 @@ function createBaseUpdateFeeTokenProposal(): UpdateFeeTokenProposal { export const UpdateFeeTokenProposal = { typeUrl: "/osmosis.txfees.v1beta1.UpdateFeeTokenProposal", aminoType: "osmosis/txfees/update-fee-token-proposal", + is(o: any): o is UpdateFeeTokenProposal { + return o && (o.$typeUrl === UpdateFeeTokenProposal.typeUrl || typeof o.title === "string" && typeof o.description === "string" && FeeToken.is(o.feetoken)); + }, + isSDK(o: any): o is UpdateFeeTokenProposalSDKType { + return o && (o.$typeUrl === UpdateFeeTokenProposal.typeUrl || typeof o.title === "string" && typeof o.description === "string" && FeeToken.isSDK(o.feetoken)); + }, + isAmino(o: any): o is UpdateFeeTokenProposalAmino { + return o && (o.$typeUrl === UpdateFeeTokenProposal.typeUrl || typeof o.title === "string" && typeof o.description === "string" && FeeToken.isAmino(o.feetoken)); + }, encode(message: UpdateFeeTokenProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.title !== "") { writer.uint32(10).string(message.title); @@ -170,5 +180,13 @@ export const UpdateFeeTokenProposal = { typeUrl: "/osmosis.txfees.v1beta1.UpdateFeeTokenProposal", value: UpdateFeeTokenProposal.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(UpdateFeeTokenProposal.typeUrl)) { + return; + } + GlobalDecoderRegistry.register(UpdateFeeTokenProposal.typeUrl, UpdateFeeTokenProposal); + GlobalDecoderRegistry.registerAminoProtoMapping(UpdateFeeTokenProposal.aminoType, UpdateFeeTokenProposal.typeUrl); + FeeToken.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/osmosis/txfees/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputv3/osmosis/txfees/v1beta1/query.rpc.func.ts new file mode 100644 index 0000000000..3378b866ff --- /dev/null +++ b/__fixtures__/v-next/outputv3/osmosis/txfees/v1beta1/query.rpc.func.ts @@ -0,0 +1,57 @@ +import { FeeToken, FeeTokenSDKType } from "./feetoken"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types"; +import { QueryFeeTokensRequest, QueryFeeTokensRequestSDKType, QueryFeeTokensResponse, QueryFeeTokensResponseSDKType, QueryDenomSpotPriceRequest, QueryDenomSpotPriceRequestSDKType, QueryDenomSpotPriceResponse, QueryDenomSpotPriceResponseSDKType, QueryDenomPoolIdRequest, QueryDenomPoolIdRequestSDKType, QueryDenomPoolIdResponse, QueryDenomPoolIdResponseSDKType, QueryBaseDenomRequest, QueryBaseDenomRequestSDKType, QueryBaseDenomResponse, QueryBaseDenomResponseSDKType } from "./query"; +/** + * FeeTokens returns a list of all the whitelisted fee tokens and their + * corresponding pools. It does not include the BaseDenom, which has its own + * query endpoint + * @name getFeeTokens + * @package osmosis.txfees.v1beta1 + * @see proto service: osmosis.txfees.v1beta1.FeeTokens + */ +export const getFeeTokens = buildQuery({ + encode: QueryFeeTokensRequest.encode, + decode: QueryFeeTokensResponse.decode, + service: "osmosis.txfees.v1beta1.Query", + method: "FeeTokens", + deps: [QueryFeeTokensRequest, QueryFeeTokensResponse] +}); +/** + * DenomSpotPrice returns all spot prices by each registered token denom. + * @name getDenomSpotPrice + * @package osmosis.txfees.v1beta1 + * @see proto service: osmosis.txfees.v1beta1.DenomSpotPrice + */ +export const getDenomSpotPrice = buildQuery({ + encode: QueryDenomSpotPriceRequest.encode, + decode: QueryDenomSpotPriceResponse.decode, + service: "osmosis.txfees.v1beta1.Query", + method: "DenomSpotPrice", + deps: [QueryDenomSpotPriceRequest, QueryDenomSpotPriceResponse] +}); +/** + * Returns the poolID for a specified denom input. + * @name getDenomPoolId + * @package osmosis.txfees.v1beta1 + * @see proto service: osmosis.txfees.v1beta1.DenomPoolId + */ +export const getDenomPoolId = buildQuery({ + encode: QueryDenomPoolIdRequest.encode, + decode: QueryDenomPoolIdResponse.decode, + service: "osmosis.txfees.v1beta1.Query", + method: "DenomPoolId", + deps: [QueryDenomPoolIdRequest, QueryDenomPoolIdResponse] +}); +/** + * Returns a list of all base denom tokens and their corresponding pools. + * @name getBaseDenom + * @package osmosis.txfees.v1beta1 + * @see proto service: osmosis.txfees.v1beta1.BaseDenom + */ +export const getBaseDenom = buildQuery({ + encode: QueryBaseDenomRequest.encode, + decode: QueryBaseDenomResponse.decode, + service: "osmosis.txfees.v1beta1.Query", + method: "BaseDenom", + deps: [QueryBaseDenomRequest, QueryBaseDenomResponse] +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/osmosis/txfees/v1beta1/query.ts b/__fixtures__/v-next/outputv3/osmosis/txfees/v1beta1/query.ts index f6782bf703..de3f61efd0 100644 --- a/__fixtures__/v-next/outputv3/osmosis/txfees/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv3/osmosis/txfees/v1beta1/query.ts @@ -1,7 +1,8 @@ import { FeeToken, FeeTokenAmino, FeeTokenSDKType } from "./feetoken"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { DeepPartial, isSet } from "../../../helpers"; -import { Decimal } from "@cosmjs/math"; +import { GlobalDecoderRegistry } from "../../../registry"; +import { Decimal } from "@interchainjs/math"; export const protobufPackage = "osmosis.txfees.v1beta1"; /** * @name QueryFeeTokensRequest @@ -241,6 +242,15 @@ function createBaseQueryFeeTokensRequest(): QueryFeeTokensRequest { export const QueryFeeTokensRequest = { typeUrl: "/osmosis.txfees.v1beta1.QueryFeeTokensRequest", aminoType: "osmosis/txfees/query-fee-tokens-request", + is(o: any): o is QueryFeeTokensRequest { + return o && o.$typeUrl === QueryFeeTokensRequest.typeUrl; + }, + isSDK(o: any): o is QueryFeeTokensRequestSDKType { + return o && o.$typeUrl === QueryFeeTokensRequest.typeUrl; + }, + isAmino(o: any): o is QueryFeeTokensRequestAmino { + return o && o.$typeUrl === QueryFeeTokensRequest.typeUrl; + }, encode(_: QueryFeeTokensRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -292,7 +302,8 @@ export const QueryFeeTokensRequest = { typeUrl: "/osmosis.txfees.v1beta1.QueryFeeTokensRequest", value: QueryFeeTokensRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryFeeTokensResponse(): QueryFeeTokensResponse { return { @@ -307,6 +318,15 @@ function createBaseQueryFeeTokensResponse(): QueryFeeTokensResponse { export const QueryFeeTokensResponse = { typeUrl: "/osmosis.txfees.v1beta1.QueryFeeTokensResponse", aminoType: "osmosis/txfees/query-fee-tokens-response", + is(o: any): o is QueryFeeTokensResponse { + return o && (o.$typeUrl === QueryFeeTokensResponse.typeUrl || Array.isArray(o.feeTokens) && (!o.feeTokens.length || FeeToken.is(o.feeTokens[0]))); + }, + isSDK(o: any): o is QueryFeeTokensResponseSDKType { + return o && (o.$typeUrl === QueryFeeTokensResponse.typeUrl || Array.isArray(o.fee_tokens) && (!o.fee_tokens.length || FeeToken.isSDK(o.fee_tokens[0]))); + }, + isAmino(o: any): o is QueryFeeTokensResponseAmino { + return o && (o.$typeUrl === QueryFeeTokensResponse.typeUrl || Array.isArray(o.fee_tokens) && (!o.fee_tokens.length || FeeToken.isAmino(o.fee_tokens[0]))); + }, encode(message: QueryFeeTokensResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.feeTokens) { FeeToken.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -379,6 +399,12 @@ export const QueryFeeTokensResponse = { typeUrl: "/osmosis.txfees.v1beta1.QueryFeeTokensResponse", value: QueryFeeTokensResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryFeeTokensResponse.typeUrl)) { + return; + } + FeeToken.registerTypeUrl(); } }; function createBaseQueryDenomSpotPriceRequest(): QueryDenomSpotPriceRequest { @@ -396,6 +422,15 @@ function createBaseQueryDenomSpotPriceRequest(): QueryDenomSpotPriceRequest { export const QueryDenomSpotPriceRequest = { typeUrl: "/osmosis.txfees.v1beta1.QueryDenomSpotPriceRequest", aminoType: "osmosis/txfees/query-denom-spot-price-request", + is(o: any): o is QueryDenomSpotPriceRequest { + return o && (o.$typeUrl === QueryDenomSpotPriceRequest.typeUrl || typeof o.denom === "string"); + }, + isSDK(o: any): o is QueryDenomSpotPriceRequestSDKType { + return o && (o.$typeUrl === QueryDenomSpotPriceRequest.typeUrl || typeof o.denom === "string"); + }, + isAmino(o: any): o is QueryDenomSpotPriceRequestAmino { + return o && (o.$typeUrl === QueryDenomSpotPriceRequest.typeUrl || typeof o.denom === "string"); + }, encode(message: QueryDenomSpotPriceRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.denom !== "") { writer.uint32(10).string(message.denom); @@ -462,7 +497,8 @@ export const QueryDenomSpotPriceRequest = { typeUrl: "/osmosis.txfees.v1beta1.QueryDenomSpotPriceRequest", value: QueryDenomSpotPriceRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryDenomSpotPriceResponse(): QueryDenomSpotPriceResponse { return { @@ -480,6 +516,15 @@ function createBaseQueryDenomSpotPriceResponse(): QueryDenomSpotPriceResponse { export const QueryDenomSpotPriceResponse = { typeUrl: "/osmosis.txfees.v1beta1.QueryDenomSpotPriceResponse", aminoType: "osmosis/txfees/query-denom-spot-price-response", + is(o: any): o is QueryDenomSpotPriceResponse { + return o && (o.$typeUrl === QueryDenomSpotPriceResponse.typeUrl || typeof o.poolID === "bigint" && typeof o.spotPrice === "string"); + }, + isSDK(o: any): o is QueryDenomSpotPriceResponseSDKType { + return o && (o.$typeUrl === QueryDenomSpotPriceResponse.typeUrl || typeof o.poolID === "bigint" && typeof o.spot_price === "string"); + }, + isAmino(o: any): o is QueryDenomSpotPriceResponseAmino { + return o && (o.$typeUrl === QueryDenomSpotPriceResponse.typeUrl || typeof o.poolID === "bigint" && typeof o.spot_price === "string"); + }, encode(message: QueryDenomSpotPriceResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.poolID !== BigInt(0)) { writer.uint32(8).uint64(message.poolID); @@ -548,7 +593,7 @@ export const QueryDenomSpotPriceResponse = { toAmino(message: QueryDenomSpotPriceResponse, useInterfaces: boolean = true): QueryDenomSpotPriceResponseAmino { const obj: any = {}; obj.poolID = message.poolID !== BigInt(0) ? message.poolID?.toString() : undefined; - obj.spot_price = message.spotPrice === "" ? undefined : message.spotPrice; + obj.spot_price = message.spotPrice === "" ? undefined : Decimal.fromUserInput(message.spotPrice, 18).atomics; return obj; }, fromProtoMsg(message: QueryDenomSpotPriceResponseProtoMsg, useInterfaces: boolean = true): QueryDenomSpotPriceResponse { @@ -562,7 +607,8 @@ export const QueryDenomSpotPriceResponse = { typeUrl: "/osmosis.txfees.v1beta1.QueryDenomSpotPriceResponse", value: QueryDenomSpotPriceResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryDenomPoolIdRequest(): QueryDenomPoolIdRequest { return { @@ -577,6 +623,15 @@ function createBaseQueryDenomPoolIdRequest(): QueryDenomPoolIdRequest { export const QueryDenomPoolIdRequest = { typeUrl: "/osmosis.txfees.v1beta1.QueryDenomPoolIdRequest", aminoType: "osmosis/txfees/query-denom-pool-id-request", + is(o: any): o is QueryDenomPoolIdRequest { + return o && (o.$typeUrl === QueryDenomPoolIdRequest.typeUrl || typeof o.denom === "string"); + }, + isSDK(o: any): o is QueryDenomPoolIdRequestSDKType { + return o && (o.$typeUrl === QueryDenomPoolIdRequest.typeUrl || typeof o.denom === "string"); + }, + isAmino(o: any): o is QueryDenomPoolIdRequestAmino { + return o && (o.$typeUrl === QueryDenomPoolIdRequest.typeUrl || typeof o.denom === "string"); + }, encode(message: QueryDenomPoolIdRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.denom !== "") { writer.uint32(10).string(message.denom); @@ -643,7 +698,8 @@ export const QueryDenomPoolIdRequest = { typeUrl: "/osmosis.txfees.v1beta1.QueryDenomPoolIdRequest", value: QueryDenomPoolIdRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryDenomPoolIdResponse(): QueryDenomPoolIdResponse { return { @@ -658,6 +714,15 @@ function createBaseQueryDenomPoolIdResponse(): QueryDenomPoolIdResponse { export const QueryDenomPoolIdResponse = { typeUrl: "/osmosis.txfees.v1beta1.QueryDenomPoolIdResponse", aminoType: "osmosis/txfees/query-denom-pool-id-response", + is(o: any): o is QueryDenomPoolIdResponse { + return o && (o.$typeUrl === QueryDenomPoolIdResponse.typeUrl || typeof o.poolID === "bigint"); + }, + isSDK(o: any): o is QueryDenomPoolIdResponseSDKType { + return o && (o.$typeUrl === QueryDenomPoolIdResponse.typeUrl || typeof o.poolID === "bigint"); + }, + isAmino(o: any): o is QueryDenomPoolIdResponseAmino { + return o && (o.$typeUrl === QueryDenomPoolIdResponse.typeUrl || typeof o.poolID === "bigint"); + }, encode(message: QueryDenomPoolIdResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.poolID !== BigInt(0)) { writer.uint32(8).uint64(message.poolID); @@ -726,7 +791,8 @@ export const QueryDenomPoolIdResponse = { typeUrl: "/osmosis.txfees.v1beta1.QueryDenomPoolIdResponse", value: QueryDenomPoolIdResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryBaseDenomRequest(): QueryBaseDenomRequest { return {}; @@ -739,6 +805,15 @@ function createBaseQueryBaseDenomRequest(): QueryBaseDenomRequest { export const QueryBaseDenomRequest = { typeUrl: "/osmosis.txfees.v1beta1.QueryBaseDenomRequest", aminoType: "osmosis/txfees/query-base-denom-request", + is(o: any): o is QueryBaseDenomRequest { + return o && o.$typeUrl === QueryBaseDenomRequest.typeUrl; + }, + isSDK(o: any): o is QueryBaseDenomRequestSDKType { + return o && o.$typeUrl === QueryBaseDenomRequest.typeUrl; + }, + isAmino(o: any): o is QueryBaseDenomRequestAmino { + return o && o.$typeUrl === QueryBaseDenomRequest.typeUrl; + }, encode(_: QueryBaseDenomRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -790,7 +865,8 @@ export const QueryBaseDenomRequest = { typeUrl: "/osmosis.txfees.v1beta1.QueryBaseDenomRequest", value: QueryBaseDenomRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseQueryBaseDenomResponse(): QueryBaseDenomResponse { return { @@ -805,6 +881,15 @@ function createBaseQueryBaseDenomResponse(): QueryBaseDenomResponse { export const QueryBaseDenomResponse = { typeUrl: "/osmosis.txfees.v1beta1.QueryBaseDenomResponse", aminoType: "osmosis/txfees/query-base-denom-response", + is(o: any): o is QueryBaseDenomResponse { + return o && (o.$typeUrl === QueryBaseDenomResponse.typeUrl || typeof o.baseDenom === "string"); + }, + isSDK(o: any): o is QueryBaseDenomResponseSDKType { + return o && (o.$typeUrl === QueryBaseDenomResponse.typeUrl || typeof o.base_denom === "string"); + }, + isAmino(o: any): o is QueryBaseDenomResponseAmino { + return o && (o.$typeUrl === QueryBaseDenomResponse.typeUrl || typeof o.base_denom === "string"); + }, encode(message: QueryBaseDenomResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.baseDenom !== "") { writer.uint32(10).string(message.baseDenom); @@ -871,5 +956,6 @@ export const QueryBaseDenomResponse = { typeUrl: "/osmosis.txfees.v1beta1.QueryBaseDenomResponse", value: QueryBaseDenomResponse.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/registry.ts b/__fixtures__/v-next/outputv3/registry.ts new file mode 100644 index 0000000000..181b82b40e --- /dev/null +++ b/__fixtures__/v-next/outputv3/registry.ts @@ -0,0 +1,228 @@ +/** +* This file and any referenced files were automatically generated by @hyperweb/telescope@latest +* DO NOT MODIFY BY HAND. Instead, download the latest proto files for your chain +* and run the transpile command or npm scripts command that is used to regenerate this bundle. +*/ + +import { BinaryReader } from "./binary"; +import { Any, AnyAmino } from "./google/protobuf/any"; +import { IProtoType, TelescopeGeneratedCodec } from "./types"; + +export class GlobalDecoderRegistry { + static registry: { + [key: string]: TelescopeGeneratedCodec; + } = {}; + + static aminoProtoMapping: { + [key: string]: string; + } = {}; + + static existingTypeUrls: string[] = []; + + static registerExistingTypeUrl(typeUrl: string): boolean { + if (GlobalDecoderRegistry.existingTypeUrls.includes(typeUrl)) { + return false; + } + GlobalDecoderRegistry.existingTypeUrls.push(typeUrl); + return true; + } + + static registerAminoProtoMapping(aminoType: string, typeUrl: string) { + GlobalDecoderRegistry.aminoProtoMapping[aminoType] = typeUrl; + } + + static register( + key: string, + decoder: TelescopeGeneratedCodec + ) { + GlobalDecoderRegistry.registry[key] = decoder; + } + static getDecoder( + key: string + ): TelescopeGeneratedCodec { + return GlobalDecoderRegistry.registry[key]; + } + static getDecoderByInstance( + obj: unknown + ): TelescopeGeneratedCodec | null { + if (obj === undefined || obj === null) { + return null; + } + const protoType = obj as IProtoType; + + if (protoType.$typeUrl) { + return GlobalDecoderRegistry.getDecoder( + protoType.$typeUrl + ); + } + + for (const key in GlobalDecoderRegistry.registry) { + if ( + Object.prototype.hasOwnProperty.call( + GlobalDecoderRegistry.registry, + key + ) + ) { + const element = GlobalDecoderRegistry.registry[key]; + + if (element.is!(obj)) { + return element; + } + + if (element.isSDK && element.isSDK(obj)) { + return element; + } + + if (element.isAmino && element.isAmino(obj)) { + return element; + } + } + } + + return null; + } + static getDecoderByAminoType( + type: string + ): TelescopeGeneratedCodec | null { + if (type === undefined || type === null) { + return null; + } + + const typeUrl = GlobalDecoderRegistry.aminoProtoMapping[type]; + + if (!typeUrl) { + return null; + } + + return GlobalDecoderRegistry.getDecoder(typeUrl); + } + static wrapAny(obj: unknown): Any { + if(Any.is(obj)){ + return obj; + } + + const decoder = getDecoderByInstance(obj); + + return { + typeUrl: decoder.typeUrl, + value: decoder.encode(obj).finish(), + }; + } + static unwrapAny(input: BinaryReader | Uint8Array | Any) { + let data; + + if (Any.is(input)) { + data = input; + } else { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + + data = Any.decode(reader, reader.uint32()); + } + + const decoder = GlobalDecoderRegistry.getDecoder( + data.typeUrl + ); + + if (!decoder) { + return data; + } + + return decoder.decode(data.value); + } + static fromJSON(object: any): T { + const decoder = getDecoderByInstance(object); + return decoder.fromJSON!(object); + } + static toJSON(message: T): any { + const decoder = getDecoderByInstance(message); + return decoder.toJSON!(message); + } + static fromPartial(object: unknown): T { + const decoder = getDecoderByInstance(object); + return decoder ? decoder.fromPartial(object) : (object as T); + } + static fromSDK(object: SDK): T { + const decoder = getDecoderByInstance(object); + return decoder.fromSDK!(object); + } + static fromSDKJSON(object: any): SDK { + const decoder = getDecoderByInstance(object); + return decoder.fromSDKJSON!(object); + } + static toSDK(object: T): SDK { + const decoder = getDecoderByInstance(object); + return decoder.toSDK!(object); + } + static fromAmino(object: Amino): T { + const decoder = getDecoderByInstance(object); + return decoder.fromAmino!(object); + } + static fromAminoMsg(object: AnyAmino): T { + const decoder = GlobalDecoderRegistry.getDecoderByAminoType< + T, + unknown, + Amino + >(object.type); + + if (!decoder) { + throw new Error(`There's no decoder for the amino type ${object.type}`); + } + + return decoder.fromAminoMsg!(object); + } + static toAmino(object: T): Amino { + let data: any; + let decoder: TelescopeGeneratedCodec; + if (Any.is(object)) { + data = GlobalDecoderRegistry.unwrapAny(object); + + decoder = GlobalDecoderRegistry.getDecoder(object.typeUrl); + + if (!decoder) { + decoder = Any; + } + } else { + data = object; + decoder = getDecoderByInstance(object); + } + + return decoder.toAmino!(data); + } + static toAminoMsg(object: T): AnyAmino { + let data: any; + let decoder: TelescopeGeneratedCodec; + if (Any.is(object)) { + data = GlobalDecoderRegistry.unwrapAny(object); + + decoder = GlobalDecoderRegistry.getDecoder(object.typeUrl); + + if (!decoder) { + decoder = Any; + } + } else { + data = object; + decoder = getDecoderByInstance(object); + } + + return decoder.toAminoMsg!(data); + } +} + +function getDecoderByInstance( + obj: unknown +): TelescopeGeneratedCodec { + const decoder = GlobalDecoderRegistry.getDecoderByInstance( + obj + ); + + if (!decoder) { + throw new Error( + `There's no decoder for the instance ${JSON.stringify(obj)}` + ); + } + + return decoder; +} + +GlobalDecoderRegistry.register(Any.typeUrl, Any); diff --git a/__fixtures__/v-next/outputv3/tendermint/abci/types.rpc.func.ts b/__fixtures__/v-next/outputv3/tendermint/abci/types.rpc.func.ts new file mode 100644 index 0000000000..6d2369d622 --- /dev/null +++ b/__fixtures__/v-next/outputv3/tendermint/abci/types.rpc.func.ts @@ -0,0 +1,187 @@ +import { Timestamp, TimestampSDKType } from "../../google/protobuf/timestamp"; +import { Header, HeaderSDKType } from "../types/types"; +import { ProofOps, ProofOpsSDKType } from "../crypto/proof"; +import { EvidenceParams, EvidenceParamsSDKType, ValidatorParams, ValidatorParamsSDKType, VersionParams, VersionParamsSDKType } from "../types/params"; +import { PublicKey, PublicKeySDKType } from "../crypto/keys"; +import { EndpointOrRpc, buildQuery } from "../../helper-func-types"; +import { RequestEcho, RequestEchoSDKType, ResponseEcho, ResponseEchoSDKType, RequestFlush, RequestFlushSDKType, ResponseFlush, ResponseFlushSDKType, RequestInfo, RequestInfoSDKType, ResponseInfo, ResponseInfoSDKType, RequestSetOption, RequestSetOptionSDKType, ResponseSetOption, ResponseSetOptionSDKType, RequestDeliverTx, RequestDeliverTxSDKType, ResponseDeliverTx, ResponseDeliverTxSDKType, RequestCheckTx, RequestCheckTxSDKType, ResponseCheckTx, ResponseCheckTxSDKType, RequestQuery, RequestQuerySDKType, ResponseQuery, ResponseQuerySDKType, RequestCommit, RequestCommitSDKType, ResponseCommit, ResponseCommitSDKType, RequestInitChain, RequestInitChainSDKType, ResponseInitChain, ResponseInitChainSDKType, RequestBeginBlock, RequestBeginBlockSDKType, ResponseBeginBlock, ResponseBeginBlockSDKType, RequestEndBlock, RequestEndBlockSDKType, ResponseEndBlock, ResponseEndBlockSDKType, RequestListSnapshots, RequestListSnapshotsSDKType, ResponseListSnapshots, ResponseListSnapshotsSDKType, RequestOfferSnapshot, RequestOfferSnapshotSDKType, ResponseOfferSnapshot, ResponseOfferSnapshotSDKType, RequestLoadSnapshotChunk, RequestLoadSnapshotChunkSDKType, ResponseLoadSnapshotChunk, ResponseLoadSnapshotChunkSDKType, RequestApplySnapshotChunk, RequestApplySnapshotChunkSDKType, ResponseApplySnapshotChunk, ResponseApplySnapshotChunkSDKType } from "./types"; +/** + * @name getEcho + * @package tendermint.abci + * @see proto service: tendermint.abci.Echo + */ +export const getEcho = buildQuery({ + encode: RequestEcho.encode, + decode: ResponseEcho.decode, + service: "tendermint.abci.ABCIApplication", + method: "Echo", + deps: [RequestEcho, ResponseEcho] +}); +/** + * @name getFlush + * @package tendermint.abci + * @see proto service: tendermint.abci.Flush + */ +export const getFlush = buildQuery({ + encode: RequestFlush.encode, + decode: ResponseFlush.decode, + service: "tendermint.abci.ABCIApplication", + method: "Flush", + deps: [RequestFlush, ResponseFlush] +}); +/** + * @name getInfo + * @package tendermint.abci + * @see proto service: tendermint.abci.Info + */ +export const getInfo = buildQuery({ + encode: RequestInfo.encode, + decode: ResponseInfo.decode, + service: "tendermint.abci.ABCIApplication", + method: "Info", + deps: [RequestInfo, ResponseInfo] +}); +/** + * @name getSetOption + * @package tendermint.abci + * @see proto service: tendermint.abci.SetOption + */ +export const getSetOption = buildQuery({ + encode: RequestSetOption.encode, + decode: ResponseSetOption.decode, + service: "tendermint.abci.ABCIApplication", + method: "SetOption", + deps: [RequestSetOption, ResponseSetOption] +}); +/** + * @name getDeliverTx + * @package tendermint.abci + * @see proto service: tendermint.abci.DeliverTx + */ +export const getDeliverTx = buildQuery({ + encode: RequestDeliverTx.encode, + decode: ResponseDeliverTx.decode, + service: "tendermint.abci.ABCIApplication", + method: "DeliverTx", + deps: [RequestDeliverTx, ResponseDeliverTx] +}); +/** + * @name getCheckTx + * @package tendermint.abci + * @see proto service: tendermint.abci.CheckTx + */ +export const getCheckTx = buildQuery({ + encode: RequestCheckTx.encode, + decode: ResponseCheckTx.decode, + service: "tendermint.abci.ABCIApplication", + method: "CheckTx", + deps: [RequestCheckTx, ResponseCheckTx] +}); +/** + * @name getQuery + * @package tendermint.abci + * @see proto service: tendermint.abci.Query + */ +export const getQuery = buildQuery({ + encode: RequestQuery.encode, + decode: ResponseQuery.decode, + service: "tendermint.abci.ABCIApplication", + method: "Query", + deps: [RequestQuery, ResponseQuery] +}); +/** + * @name getCommit + * @package tendermint.abci + * @see proto service: tendermint.abci.Commit + */ +export const getCommit = buildQuery({ + encode: RequestCommit.encode, + decode: ResponseCommit.decode, + service: "tendermint.abci.ABCIApplication", + method: "Commit", + deps: [RequestCommit, ResponseCommit] +}); +/** + * @name getInitChain + * @package tendermint.abci + * @see proto service: tendermint.abci.InitChain + */ +export const getInitChain = buildQuery({ + encode: RequestInitChain.encode, + decode: ResponseInitChain.decode, + service: "tendermint.abci.ABCIApplication", + method: "InitChain", + deps: [RequestInitChain, ResponseInitChain] +}); +/** + * @name getBeginBlock + * @package tendermint.abci + * @see proto service: tendermint.abci.BeginBlock + */ +export const getBeginBlock = buildQuery({ + encode: RequestBeginBlock.encode, + decode: ResponseBeginBlock.decode, + service: "tendermint.abci.ABCIApplication", + method: "BeginBlock", + deps: [RequestBeginBlock, ResponseBeginBlock] +}); +/** + * @name getEndBlock + * @package tendermint.abci + * @see proto service: tendermint.abci.EndBlock + */ +export const getEndBlock = buildQuery({ + encode: RequestEndBlock.encode, + decode: ResponseEndBlock.decode, + service: "tendermint.abci.ABCIApplication", + method: "EndBlock", + deps: [RequestEndBlock, ResponseEndBlock] +}); +/** + * @name getListSnapshots + * @package tendermint.abci + * @see proto service: tendermint.abci.ListSnapshots + */ +export const getListSnapshots = buildQuery({ + encode: RequestListSnapshots.encode, + decode: ResponseListSnapshots.decode, + service: "tendermint.abci.ABCIApplication", + method: "ListSnapshots", + deps: [RequestListSnapshots, ResponseListSnapshots] +}); +/** + * @name getOfferSnapshot + * @package tendermint.abci + * @see proto service: tendermint.abci.OfferSnapshot + */ +export const getOfferSnapshot = buildQuery({ + encode: RequestOfferSnapshot.encode, + decode: ResponseOfferSnapshot.decode, + service: "tendermint.abci.ABCIApplication", + method: "OfferSnapshot", + deps: [RequestOfferSnapshot, ResponseOfferSnapshot] +}); +/** + * @name getLoadSnapshotChunk + * @package tendermint.abci + * @see proto service: tendermint.abci.LoadSnapshotChunk + */ +export const getLoadSnapshotChunk = buildQuery({ + encode: RequestLoadSnapshotChunk.encode, + decode: ResponseLoadSnapshotChunk.decode, + service: "tendermint.abci.ABCIApplication", + method: "LoadSnapshotChunk", + deps: [RequestLoadSnapshotChunk, ResponseLoadSnapshotChunk] +}); +/** + * @name getApplySnapshotChunk + * @package tendermint.abci + * @see proto service: tendermint.abci.ApplySnapshotChunk + */ +export const getApplySnapshotChunk = buildQuery({ + encode: RequestApplySnapshotChunk.encode, + decode: ResponseApplySnapshotChunk.decode, + service: "tendermint.abci.ABCIApplication", + method: "ApplySnapshotChunk", + deps: [RequestApplySnapshotChunk, ResponseApplySnapshotChunk] +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/tendermint/abci/types.ts b/__fixtures__/v-next/outputv3/tendermint/abci/types.ts index 2bdc59b94a..2e4e25382c 100644 --- a/__fixtures__/v-next/outputv3/tendermint/abci/types.ts +++ b/__fixtures__/v-next/outputv3/tendermint/abci/types.ts @@ -4,6 +4,7 @@ import { ProofOps, ProofOpsAmino, ProofOpsSDKType } from "../crypto/proof"; import { EvidenceParams, EvidenceParamsAmino, EvidenceParamsSDKType, ValidatorParams, ValidatorParamsAmino, ValidatorParamsSDKType, VersionParams, VersionParamsAmino, VersionParamsSDKType } from "../types/params"; import { PublicKey, PublicKeyAmino, PublicKeySDKType } from "../crypto/keys"; import { BinaryReader, BinaryWriter } from "../../binary"; +import { GlobalDecoderRegistry } from "../../registry"; import { isSet, DeepPartial, toTimestamp, fromTimestamp, bytesFromBase64, base64FromBytes } from "../../helpers"; export const protobufPackage = "tendermint.abci"; export enum CheckTxType { @@ -1972,6 +1973,15 @@ function createBaseRequest(): Request { */ export const Request = { typeUrl: "/tendermint.abci.Request", + is(o: any): o is Request { + return o && o.$typeUrl === Request.typeUrl; + }, + isSDK(o: any): o is RequestSDKType { + return o && o.$typeUrl === Request.typeUrl; + }, + isAmino(o: any): o is RequestAmino { + return o && o.$typeUrl === Request.typeUrl; + }, encode(message: Request, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.echo !== undefined) { RequestEcho.encode(message.echo, writer.uint32(10).fork()).ldelim(); @@ -2264,6 +2274,26 @@ export const Request = { typeUrl: "/tendermint.abci.Request", value: Request.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Request.typeUrl)) { + return; + } + RequestEcho.registerTypeUrl(); + RequestFlush.registerTypeUrl(); + RequestInfo.registerTypeUrl(); + RequestSetOption.registerTypeUrl(); + RequestInitChain.registerTypeUrl(); + RequestQuery.registerTypeUrl(); + RequestBeginBlock.registerTypeUrl(); + RequestCheckTx.registerTypeUrl(); + RequestDeliverTx.registerTypeUrl(); + RequestEndBlock.registerTypeUrl(); + RequestCommit.registerTypeUrl(); + RequestListSnapshots.registerTypeUrl(); + RequestOfferSnapshot.registerTypeUrl(); + RequestLoadSnapshotChunk.registerTypeUrl(); + RequestApplySnapshotChunk.registerTypeUrl(); } }; function createBaseRequestEcho(): RequestEcho { @@ -2278,6 +2308,15 @@ function createBaseRequestEcho(): RequestEcho { */ export const RequestEcho = { typeUrl: "/tendermint.abci.RequestEcho", + is(o: any): o is RequestEcho { + return o && (o.$typeUrl === RequestEcho.typeUrl || typeof o.message === "string"); + }, + isSDK(o: any): o is RequestEchoSDKType { + return o && (o.$typeUrl === RequestEcho.typeUrl || typeof o.message === "string"); + }, + isAmino(o: any): o is RequestEchoAmino { + return o && (o.$typeUrl === RequestEcho.typeUrl || typeof o.message === "string"); + }, encode(message: RequestEcho, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.message !== "") { writer.uint32(10).string(message.message); @@ -2344,7 +2383,8 @@ export const RequestEcho = { typeUrl: "/tendermint.abci.RequestEcho", value: RequestEcho.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseRequestFlush(): RequestFlush { return {}; @@ -2356,6 +2396,15 @@ function createBaseRequestFlush(): RequestFlush { */ export const RequestFlush = { typeUrl: "/tendermint.abci.RequestFlush", + is(o: any): o is RequestFlush { + return o && o.$typeUrl === RequestFlush.typeUrl; + }, + isSDK(o: any): o is RequestFlushSDKType { + return o && o.$typeUrl === RequestFlush.typeUrl; + }, + isAmino(o: any): o is RequestFlushAmino { + return o && o.$typeUrl === RequestFlush.typeUrl; + }, encode(_: RequestFlush, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -2407,7 +2456,8 @@ export const RequestFlush = { typeUrl: "/tendermint.abci.RequestFlush", value: RequestFlush.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseRequestInfo(): RequestInfo { return { @@ -2423,6 +2473,15 @@ function createBaseRequestInfo(): RequestInfo { */ export const RequestInfo = { typeUrl: "/tendermint.abci.RequestInfo", + is(o: any): o is RequestInfo { + return o && (o.$typeUrl === RequestInfo.typeUrl || typeof o.version === "string" && typeof o.blockVersion === "bigint" && typeof o.p2pVersion === "bigint"); + }, + isSDK(o: any): o is RequestInfoSDKType { + return o && (o.$typeUrl === RequestInfo.typeUrl || typeof o.version === "string" && typeof o.block_version === "bigint" && typeof o.p2p_version === "bigint"); + }, + isAmino(o: any): o is RequestInfoAmino { + return o && (o.$typeUrl === RequestInfo.typeUrl || typeof o.version === "string" && typeof o.block_version === "bigint" && typeof o.p2p_version === "bigint"); + }, encode(message: RequestInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.version !== "") { writer.uint32(10).string(message.version); @@ -2521,7 +2580,8 @@ export const RequestInfo = { typeUrl: "/tendermint.abci.RequestInfo", value: RequestInfo.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseRequestSetOption(): RequestSetOption { return { @@ -2537,6 +2597,15 @@ function createBaseRequestSetOption(): RequestSetOption { */ export const RequestSetOption = { typeUrl: "/tendermint.abci.RequestSetOption", + is(o: any): o is RequestSetOption { + return o && (o.$typeUrl === RequestSetOption.typeUrl || typeof o.key === "string" && typeof o.value === "string"); + }, + isSDK(o: any): o is RequestSetOptionSDKType { + return o && (o.$typeUrl === RequestSetOption.typeUrl || typeof o.key === "string" && typeof o.value === "string"); + }, + isAmino(o: any): o is RequestSetOptionAmino { + return o && (o.$typeUrl === RequestSetOption.typeUrl || typeof o.key === "string" && typeof o.value === "string"); + }, encode(message: RequestSetOption, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.key !== "") { writer.uint32(10).string(message.key); @@ -2617,7 +2686,8 @@ export const RequestSetOption = { typeUrl: "/tendermint.abci.RequestSetOption", value: RequestSetOption.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseRequestInitChain(): RequestInitChain { return { @@ -2636,6 +2706,15 @@ function createBaseRequestInitChain(): RequestInitChain { */ export const RequestInitChain = { typeUrl: "/tendermint.abci.RequestInitChain", + is(o: any): o is RequestInitChain { + return o && (o.$typeUrl === RequestInitChain.typeUrl || Timestamp.is(o.time) && typeof o.chainId === "string" && Array.isArray(o.validators) && (!o.validators.length || ValidatorUpdate.is(o.validators[0])) && (o.appStateBytes instanceof Uint8Array || typeof o.appStateBytes === "string") && typeof o.initialHeight === "bigint"); + }, + isSDK(o: any): o is RequestInitChainSDKType { + return o && (o.$typeUrl === RequestInitChain.typeUrl || Timestamp.isSDK(o.time) && typeof o.chain_id === "string" && Array.isArray(o.validators) && (!o.validators.length || ValidatorUpdate.isSDK(o.validators[0])) && (o.app_state_bytes instanceof Uint8Array || typeof o.app_state_bytes === "string") && typeof o.initial_height === "bigint"); + }, + isAmino(o: any): o is RequestInitChainAmino { + return o && (o.$typeUrl === RequestInitChain.typeUrl || Timestamp.isAmino(o.time) && typeof o.chain_id === "string" && Array.isArray(o.validators) && (!o.validators.length || ValidatorUpdate.isAmino(o.validators[0])) && (o.app_state_bytes instanceof Uint8Array || typeof o.app_state_bytes === "string") && typeof o.initial_height === "bigint"); + }, encode(message: RequestInitChain, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.time !== undefined) { Timestamp.encode(toTimestamp(message.time), writer.uint32(10).fork()).ldelim(); @@ -2782,6 +2861,13 @@ export const RequestInitChain = { typeUrl: "/tendermint.abci.RequestInitChain", value: RequestInitChain.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(RequestInitChain.typeUrl)) { + return; + } + ConsensusParams.registerTypeUrl(); + ValidatorUpdate.registerTypeUrl(); } }; function createBaseRequestQuery(): RequestQuery { @@ -2799,6 +2885,15 @@ function createBaseRequestQuery(): RequestQuery { */ export const RequestQuery = { typeUrl: "/tendermint.abci.RequestQuery", + is(o: any): o is RequestQuery { + return o && (o.$typeUrl === RequestQuery.typeUrl || (o.data instanceof Uint8Array || typeof o.data === "string") && typeof o.path === "string" && typeof o.height === "bigint" && typeof o.prove === "boolean"); + }, + isSDK(o: any): o is RequestQuerySDKType { + return o && (o.$typeUrl === RequestQuery.typeUrl || (o.data instanceof Uint8Array || typeof o.data === "string") && typeof o.path === "string" && typeof o.height === "bigint" && typeof o.prove === "boolean"); + }, + isAmino(o: any): o is RequestQueryAmino { + return o && (o.$typeUrl === RequestQuery.typeUrl || (o.data instanceof Uint8Array || typeof o.data === "string") && typeof o.path === "string" && typeof o.height === "bigint" && typeof o.prove === "boolean"); + }, encode(message: RequestQuery, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.data.length !== 0) { writer.uint32(10).bytes(message.data); @@ -2909,7 +3004,8 @@ export const RequestQuery = { typeUrl: "/tendermint.abci.RequestQuery", value: RequestQuery.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseRequestBeginBlock(): RequestBeginBlock { return { @@ -2926,6 +3022,15 @@ function createBaseRequestBeginBlock(): RequestBeginBlock { */ export const RequestBeginBlock = { typeUrl: "/tendermint.abci.RequestBeginBlock", + is(o: any): o is RequestBeginBlock { + return o && (o.$typeUrl === RequestBeginBlock.typeUrl || (o.hash instanceof Uint8Array || typeof o.hash === "string") && Header.is(o.header) && LastCommitInfo.is(o.lastCommitInfo) && Array.isArray(o.byzantineValidators) && (!o.byzantineValidators.length || Evidence.is(o.byzantineValidators[0]))); + }, + isSDK(o: any): o is RequestBeginBlockSDKType { + return o && (o.$typeUrl === RequestBeginBlock.typeUrl || (o.hash instanceof Uint8Array || typeof o.hash === "string") && Header.isSDK(o.header) && LastCommitInfo.isSDK(o.last_commit_info) && Array.isArray(o.byzantine_validators) && (!o.byzantine_validators.length || Evidence.isSDK(o.byzantine_validators[0]))); + }, + isAmino(o: any): o is RequestBeginBlockAmino { + return o && (o.$typeUrl === RequestBeginBlock.typeUrl || (o.hash instanceof Uint8Array || typeof o.hash === "string") && Header.isAmino(o.header) && LastCommitInfo.isAmino(o.last_commit_info) && Array.isArray(o.byzantine_validators) && (!o.byzantine_validators.length || Evidence.isAmino(o.byzantine_validators[0]))); + }, encode(message: RequestBeginBlock, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.hash.length !== 0) { writer.uint32(10).bytes(message.hash); @@ -3044,6 +3149,14 @@ export const RequestBeginBlock = { typeUrl: "/tendermint.abci.RequestBeginBlock", value: RequestBeginBlock.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(RequestBeginBlock.typeUrl)) { + return; + } + Header.registerTypeUrl(); + LastCommitInfo.registerTypeUrl(); + Evidence.registerTypeUrl(); } }; function createBaseRequestCheckTx(): RequestCheckTx { @@ -3059,6 +3172,15 @@ function createBaseRequestCheckTx(): RequestCheckTx { */ export const RequestCheckTx = { typeUrl: "/tendermint.abci.RequestCheckTx", + is(o: any): o is RequestCheckTx { + return o && (o.$typeUrl === RequestCheckTx.typeUrl || (o.tx instanceof Uint8Array || typeof o.tx === "string") && isSet(o.type)); + }, + isSDK(o: any): o is RequestCheckTxSDKType { + return o && (o.$typeUrl === RequestCheckTx.typeUrl || (o.tx instanceof Uint8Array || typeof o.tx === "string") && isSet(o.type)); + }, + isAmino(o: any): o is RequestCheckTxAmino { + return o && (o.$typeUrl === RequestCheckTx.typeUrl || (o.tx instanceof Uint8Array || typeof o.tx === "string") && isSet(o.type)); + }, encode(message: RequestCheckTx, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.tx.length !== 0) { writer.uint32(10).bytes(message.tx); @@ -3139,7 +3261,8 @@ export const RequestCheckTx = { typeUrl: "/tendermint.abci.RequestCheckTx", value: RequestCheckTx.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseRequestDeliverTx(): RequestDeliverTx { return { @@ -3153,6 +3276,15 @@ function createBaseRequestDeliverTx(): RequestDeliverTx { */ export const RequestDeliverTx = { typeUrl: "/tendermint.abci.RequestDeliverTx", + is(o: any): o is RequestDeliverTx { + return o && (o.$typeUrl === RequestDeliverTx.typeUrl || o.tx instanceof Uint8Array || typeof o.tx === "string"); + }, + isSDK(o: any): o is RequestDeliverTxSDKType { + return o && (o.$typeUrl === RequestDeliverTx.typeUrl || o.tx instanceof Uint8Array || typeof o.tx === "string"); + }, + isAmino(o: any): o is RequestDeliverTxAmino { + return o && (o.$typeUrl === RequestDeliverTx.typeUrl || o.tx instanceof Uint8Array || typeof o.tx === "string"); + }, encode(message: RequestDeliverTx, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.tx.length !== 0) { writer.uint32(10).bytes(message.tx); @@ -3219,7 +3351,8 @@ export const RequestDeliverTx = { typeUrl: "/tendermint.abci.RequestDeliverTx", value: RequestDeliverTx.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseRequestEndBlock(): RequestEndBlock { return { @@ -3233,6 +3366,15 @@ function createBaseRequestEndBlock(): RequestEndBlock { */ export const RequestEndBlock = { typeUrl: "/tendermint.abci.RequestEndBlock", + is(o: any): o is RequestEndBlock { + return o && (o.$typeUrl === RequestEndBlock.typeUrl || typeof o.height === "bigint"); + }, + isSDK(o: any): o is RequestEndBlockSDKType { + return o && (o.$typeUrl === RequestEndBlock.typeUrl || typeof o.height === "bigint"); + }, + isAmino(o: any): o is RequestEndBlockAmino { + return o && (o.$typeUrl === RequestEndBlock.typeUrl || typeof o.height === "bigint"); + }, encode(message: RequestEndBlock, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.height !== BigInt(0)) { writer.uint32(8).int64(message.height); @@ -3301,7 +3443,8 @@ export const RequestEndBlock = { typeUrl: "/tendermint.abci.RequestEndBlock", value: RequestEndBlock.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseRequestCommit(): RequestCommit { return {}; @@ -3313,6 +3456,15 @@ function createBaseRequestCommit(): RequestCommit { */ export const RequestCommit = { typeUrl: "/tendermint.abci.RequestCommit", + is(o: any): o is RequestCommit { + return o && o.$typeUrl === RequestCommit.typeUrl; + }, + isSDK(o: any): o is RequestCommitSDKType { + return o && o.$typeUrl === RequestCommit.typeUrl; + }, + isAmino(o: any): o is RequestCommitAmino { + return o && o.$typeUrl === RequestCommit.typeUrl; + }, encode(_: RequestCommit, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -3364,7 +3516,8 @@ export const RequestCommit = { typeUrl: "/tendermint.abci.RequestCommit", value: RequestCommit.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseRequestListSnapshots(): RequestListSnapshots { return {}; @@ -3377,6 +3530,15 @@ function createBaseRequestListSnapshots(): RequestListSnapshots { */ export const RequestListSnapshots = { typeUrl: "/tendermint.abci.RequestListSnapshots", + is(o: any): o is RequestListSnapshots { + return o && o.$typeUrl === RequestListSnapshots.typeUrl; + }, + isSDK(o: any): o is RequestListSnapshotsSDKType { + return o && o.$typeUrl === RequestListSnapshots.typeUrl; + }, + isAmino(o: any): o is RequestListSnapshotsAmino { + return o && o.$typeUrl === RequestListSnapshots.typeUrl; + }, encode(_: RequestListSnapshots, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -3428,7 +3590,8 @@ export const RequestListSnapshots = { typeUrl: "/tendermint.abci.RequestListSnapshots", value: RequestListSnapshots.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseRequestOfferSnapshot(): RequestOfferSnapshot { return { @@ -3444,6 +3607,15 @@ function createBaseRequestOfferSnapshot(): RequestOfferSnapshot { */ export const RequestOfferSnapshot = { typeUrl: "/tendermint.abci.RequestOfferSnapshot", + is(o: any): o is RequestOfferSnapshot { + return o && (o.$typeUrl === RequestOfferSnapshot.typeUrl || o.appHash instanceof Uint8Array || typeof o.appHash === "string"); + }, + isSDK(o: any): o is RequestOfferSnapshotSDKType { + return o && (o.$typeUrl === RequestOfferSnapshot.typeUrl || o.app_hash instanceof Uint8Array || typeof o.app_hash === "string"); + }, + isAmino(o: any): o is RequestOfferSnapshotAmino { + return o && (o.$typeUrl === RequestOfferSnapshot.typeUrl || o.app_hash instanceof Uint8Array || typeof o.app_hash === "string"); + }, encode(message: RequestOfferSnapshot, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.snapshot !== undefined) { Snapshot.encode(message.snapshot, writer.uint32(10).fork()).ldelim(); @@ -3526,6 +3698,12 @@ export const RequestOfferSnapshot = { typeUrl: "/tendermint.abci.RequestOfferSnapshot", value: RequestOfferSnapshot.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(RequestOfferSnapshot.typeUrl)) { + return; + } + Snapshot.registerTypeUrl(); } }; function createBaseRequestLoadSnapshotChunk(): RequestLoadSnapshotChunk { @@ -3543,6 +3721,15 @@ function createBaseRequestLoadSnapshotChunk(): RequestLoadSnapshotChunk { */ export const RequestLoadSnapshotChunk = { typeUrl: "/tendermint.abci.RequestLoadSnapshotChunk", + is(o: any): o is RequestLoadSnapshotChunk { + return o && (o.$typeUrl === RequestLoadSnapshotChunk.typeUrl || typeof o.height === "bigint" && typeof o.format === "number" && typeof o.chunk === "number"); + }, + isSDK(o: any): o is RequestLoadSnapshotChunkSDKType { + return o && (o.$typeUrl === RequestLoadSnapshotChunk.typeUrl || typeof o.height === "bigint" && typeof o.format === "number" && typeof o.chunk === "number"); + }, + isAmino(o: any): o is RequestLoadSnapshotChunkAmino { + return o && (o.$typeUrl === RequestLoadSnapshotChunk.typeUrl || typeof o.height === "bigint" && typeof o.format === "number" && typeof o.chunk === "number"); + }, encode(message: RequestLoadSnapshotChunk, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.height !== BigInt(0)) { writer.uint32(8).uint64(message.height); @@ -3639,7 +3826,8 @@ export const RequestLoadSnapshotChunk = { typeUrl: "/tendermint.abci.RequestLoadSnapshotChunk", value: RequestLoadSnapshotChunk.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseRequestApplySnapshotChunk(): RequestApplySnapshotChunk { return { @@ -3656,6 +3844,15 @@ function createBaseRequestApplySnapshotChunk(): RequestApplySnapshotChunk { */ export const RequestApplySnapshotChunk = { typeUrl: "/tendermint.abci.RequestApplySnapshotChunk", + is(o: any): o is RequestApplySnapshotChunk { + return o && (o.$typeUrl === RequestApplySnapshotChunk.typeUrl || typeof o.index === "number" && (o.chunk instanceof Uint8Array || typeof o.chunk === "string") && typeof o.sender === "string"); + }, + isSDK(o: any): o is RequestApplySnapshotChunkSDKType { + return o && (o.$typeUrl === RequestApplySnapshotChunk.typeUrl || typeof o.index === "number" && (o.chunk instanceof Uint8Array || typeof o.chunk === "string") && typeof o.sender === "string"); + }, + isAmino(o: any): o is RequestApplySnapshotChunkAmino { + return o && (o.$typeUrl === RequestApplySnapshotChunk.typeUrl || typeof o.index === "number" && (o.chunk instanceof Uint8Array || typeof o.chunk === "string") && typeof o.sender === "string"); + }, encode(message: RequestApplySnapshotChunk, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.index !== 0) { writer.uint32(8).uint32(message.index); @@ -3750,7 +3947,8 @@ export const RequestApplySnapshotChunk = { typeUrl: "/tendermint.abci.RequestApplySnapshotChunk", value: RequestApplySnapshotChunk.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseResponse(): Response { return { @@ -3779,6 +3977,15 @@ function createBaseResponse(): Response { */ export const Response = { typeUrl: "/tendermint.abci.Response", + is(o: any): o is Response { + return o && o.$typeUrl === Response.typeUrl; + }, + isSDK(o: any): o is ResponseSDKType { + return o && o.$typeUrl === Response.typeUrl; + }, + isAmino(o: any): o is ResponseAmino { + return o && o.$typeUrl === Response.typeUrl; + }, encode(message: Response, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.exception !== undefined) { ResponseException.encode(message.exception, writer.uint32(10).fork()).ldelim(); @@ -4087,6 +4294,27 @@ export const Response = { typeUrl: "/tendermint.abci.Response", value: Response.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Response.typeUrl)) { + return; + } + ResponseException.registerTypeUrl(); + ResponseEcho.registerTypeUrl(); + ResponseFlush.registerTypeUrl(); + ResponseInfo.registerTypeUrl(); + ResponseSetOption.registerTypeUrl(); + ResponseInitChain.registerTypeUrl(); + ResponseQuery.registerTypeUrl(); + ResponseBeginBlock.registerTypeUrl(); + ResponseCheckTx.registerTypeUrl(); + ResponseDeliverTx.registerTypeUrl(); + ResponseEndBlock.registerTypeUrl(); + ResponseCommit.registerTypeUrl(); + ResponseListSnapshots.registerTypeUrl(); + ResponseOfferSnapshot.registerTypeUrl(); + ResponseLoadSnapshotChunk.registerTypeUrl(); + ResponseApplySnapshotChunk.registerTypeUrl(); } }; function createBaseResponseException(): ResponseException { @@ -4102,6 +4330,15 @@ function createBaseResponseException(): ResponseException { */ export const ResponseException = { typeUrl: "/tendermint.abci.ResponseException", + is(o: any): o is ResponseException { + return o && (o.$typeUrl === ResponseException.typeUrl || typeof o.error === "string"); + }, + isSDK(o: any): o is ResponseExceptionSDKType { + return o && (o.$typeUrl === ResponseException.typeUrl || typeof o.error === "string"); + }, + isAmino(o: any): o is ResponseExceptionAmino { + return o && (o.$typeUrl === ResponseException.typeUrl || typeof o.error === "string"); + }, encode(message: ResponseException, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.error !== "") { writer.uint32(10).string(message.error); @@ -4168,7 +4405,8 @@ export const ResponseException = { typeUrl: "/tendermint.abci.ResponseException", value: ResponseException.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseResponseEcho(): ResponseEcho { return { @@ -4182,6 +4420,15 @@ function createBaseResponseEcho(): ResponseEcho { */ export const ResponseEcho = { typeUrl: "/tendermint.abci.ResponseEcho", + is(o: any): o is ResponseEcho { + return o && (o.$typeUrl === ResponseEcho.typeUrl || typeof o.message === "string"); + }, + isSDK(o: any): o is ResponseEchoSDKType { + return o && (o.$typeUrl === ResponseEcho.typeUrl || typeof o.message === "string"); + }, + isAmino(o: any): o is ResponseEchoAmino { + return o && (o.$typeUrl === ResponseEcho.typeUrl || typeof o.message === "string"); + }, encode(message: ResponseEcho, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.message !== "") { writer.uint32(10).string(message.message); @@ -4248,7 +4495,8 @@ export const ResponseEcho = { typeUrl: "/tendermint.abci.ResponseEcho", value: ResponseEcho.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseResponseFlush(): ResponseFlush { return {}; @@ -4260,6 +4508,15 @@ function createBaseResponseFlush(): ResponseFlush { */ export const ResponseFlush = { typeUrl: "/tendermint.abci.ResponseFlush", + is(o: any): o is ResponseFlush { + return o && o.$typeUrl === ResponseFlush.typeUrl; + }, + isSDK(o: any): o is ResponseFlushSDKType { + return o && o.$typeUrl === ResponseFlush.typeUrl; + }, + isAmino(o: any): o is ResponseFlushAmino { + return o && o.$typeUrl === ResponseFlush.typeUrl; + }, encode(_: ResponseFlush, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -4311,7 +4568,8 @@ export const ResponseFlush = { typeUrl: "/tendermint.abci.ResponseFlush", value: ResponseFlush.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseResponseInfo(): ResponseInfo { return { @@ -4329,6 +4587,15 @@ function createBaseResponseInfo(): ResponseInfo { */ export const ResponseInfo = { typeUrl: "/tendermint.abci.ResponseInfo", + is(o: any): o is ResponseInfo { + return o && (o.$typeUrl === ResponseInfo.typeUrl || typeof o.data === "string" && typeof o.version === "string" && typeof o.appVersion === "bigint" && typeof o.lastBlockHeight === "bigint" && (o.lastBlockAppHash instanceof Uint8Array || typeof o.lastBlockAppHash === "string")); + }, + isSDK(o: any): o is ResponseInfoSDKType { + return o && (o.$typeUrl === ResponseInfo.typeUrl || typeof o.data === "string" && typeof o.version === "string" && typeof o.app_version === "bigint" && typeof o.last_block_height === "bigint" && (o.last_block_app_hash instanceof Uint8Array || typeof o.last_block_app_hash === "string")); + }, + isAmino(o: any): o is ResponseInfoAmino { + return o && (o.$typeUrl === ResponseInfo.typeUrl || typeof o.data === "string" && typeof o.version === "string" && typeof o.app_version === "bigint" && typeof o.last_block_height === "bigint" && (o.last_block_app_hash instanceof Uint8Array || typeof o.last_block_app_hash === "string")); + }, encode(message: ResponseInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.data !== "") { writer.uint32(10).string(message.data); @@ -4455,7 +4722,8 @@ export const ResponseInfo = { typeUrl: "/tendermint.abci.ResponseInfo", value: ResponseInfo.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseResponseSetOption(): ResponseSetOption { return { @@ -4472,6 +4740,15 @@ function createBaseResponseSetOption(): ResponseSetOption { */ export const ResponseSetOption = { typeUrl: "/tendermint.abci.ResponseSetOption", + is(o: any): o is ResponseSetOption { + return o && (o.$typeUrl === ResponseSetOption.typeUrl || typeof o.code === "number" && typeof o.log === "string" && typeof o.info === "string"); + }, + isSDK(o: any): o is ResponseSetOptionSDKType { + return o && (o.$typeUrl === ResponseSetOption.typeUrl || typeof o.code === "number" && typeof o.log === "string" && typeof o.info === "string"); + }, + isAmino(o: any): o is ResponseSetOptionAmino { + return o && (o.$typeUrl === ResponseSetOption.typeUrl || typeof o.code === "number" && typeof o.log === "string" && typeof o.info === "string"); + }, encode(message: ResponseSetOption, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.code !== 0) { writer.uint32(8).uint32(message.code); @@ -4566,7 +4843,8 @@ export const ResponseSetOption = { typeUrl: "/tendermint.abci.ResponseSetOption", value: ResponseSetOption.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseResponseInitChain(): ResponseInitChain { return { @@ -4582,6 +4860,15 @@ function createBaseResponseInitChain(): ResponseInitChain { */ export const ResponseInitChain = { typeUrl: "/tendermint.abci.ResponseInitChain", + is(o: any): o is ResponseInitChain { + return o && (o.$typeUrl === ResponseInitChain.typeUrl || Array.isArray(o.validators) && (!o.validators.length || ValidatorUpdate.is(o.validators[0])) && (o.appHash instanceof Uint8Array || typeof o.appHash === "string")); + }, + isSDK(o: any): o is ResponseInitChainSDKType { + return o && (o.$typeUrl === ResponseInitChain.typeUrl || Array.isArray(o.validators) && (!o.validators.length || ValidatorUpdate.isSDK(o.validators[0])) && (o.app_hash instanceof Uint8Array || typeof o.app_hash === "string")); + }, + isAmino(o: any): o is ResponseInitChainAmino { + return o && (o.$typeUrl === ResponseInitChain.typeUrl || Array.isArray(o.validators) && (!o.validators.length || ValidatorUpdate.isAmino(o.validators[0])) && (o.app_hash instanceof Uint8Array || typeof o.app_hash === "string")); + }, encode(message: ResponseInitChain, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.consensusParams !== undefined) { ConsensusParams.encode(message.consensusParams, writer.uint32(10).fork()).ldelim(); @@ -4684,6 +4971,13 @@ export const ResponseInitChain = { typeUrl: "/tendermint.abci.ResponseInitChain", value: ResponseInitChain.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ResponseInitChain.typeUrl)) { + return; + } + ConsensusParams.registerTypeUrl(); + ValidatorUpdate.registerTypeUrl(); } }; function createBaseResponseQuery(): ResponseQuery { @@ -4706,6 +5000,15 @@ function createBaseResponseQuery(): ResponseQuery { */ export const ResponseQuery = { typeUrl: "/tendermint.abci.ResponseQuery", + is(o: any): o is ResponseQuery { + return o && (o.$typeUrl === ResponseQuery.typeUrl || typeof o.code === "number" && typeof o.log === "string" && typeof o.info === "string" && typeof o.index === "bigint" && (o.key instanceof Uint8Array || typeof o.key === "string") && (o.value instanceof Uint8Array || typeof o.value === "string") && typeof o.height === "bigint" && typeof o.codespace === "string"); + }, + isSDK(o: any): o is ResponseQuerySDKType { + return o && (o.$typeUrl === ResponseQuery.typeUrl || typeof o.code === "number" && typeof o.log === "string" && typeof o.info === "string" && typeof o.index === "bigint" && (o.key instanceof Uint8Array || typeof o.key === "string") && (o.value instanceof Uint8Array || typeof o.value === "string") && typeof o.height === "bigint" && typeof o.codespace === "string"); + }, + isAmino(o: any): o is ResponseQueryAmino { + return o && (o.$typeUrl === ResponseQuery.typeUrl || typeof o.code === "number" && typeof o.log === "string" && typeof o.info === "string" && typeof o.index === "bigint" && (o.key instanceof Uint8Array || typeof o.key === "string") && (o.value instanceof Uint8Array || typeof o.value === "string") && typeof o.height === "bigint" && typeof o.codespace === "string"); + }, encode(message: ResponseQuery, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.code !== 0) { writer.uint32(8).uint32(message.code); @@ -4890,6 +5193,12 @@ export const ResponseQuery = { typeUrl: "/tendermint.abci.ResponseQuery", value: ResponseQuery.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ResponseQuery.typeUrl)) { + return; + } + ProofOps.registerTypeUrl(); } }; function createBaseResponseBeginBlock(): ResponseBeginBlock { @@ -4904,6 +5213,15 @@ function createBaseResponseBeginBlock(): ResponseBeginBlock { */ export const ResponseBeginBlock = { typeUrl: "/tendermint.abci.ResponseBeginBlock", + is(o: any): o is ResponseBeginBlock { + return o && (o.$typeUrl === ResponseBeginBlock.typeUrl || Array.isArray(o.events) && (!o.events.length || Event.is(o.events[0]))); + }, + isSDK(o: any): o is ResponseBeginBlockSDKType { + return o && (o.$typeUrl === ResponseBeginBlock.typeUrl || Array.isArray(o.events) && (!o.events.length || Event.isSDK(o.events[0]))); + }, + isAmino(o: any): o is ResponseBeginBlockAmino { + return o && (o.$typeUrl === ResponseBeginBlock.typeUrl || Array.isArray(o.events) && (!o.events.length || Event.isAmino(o.events[0]))); + }, encode(message: ResponseBeginBlock, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.events) { Event.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -4976,6 +5294,12 @@ export const ResponseBeginBlock = { typeUrl: "/tendermint.abci.ResponseBeginBlock", value: ResponseBeginBlock.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ResponseBeginBlock.typeUrl)) { + return; + } + Event.registerTypeUrl(); } }; function createBaseResponseCheckTx(): ResponseCheckTx { @@ -4997,6 +5321,15 @@ function createBaseResponseCheckTx(): ResponseCheckTx { */ export const ResponseCheckTx = { typeUrl: "/tendermint.abci.ResponseCheckTx", + is(o: any): o is ResponseCheckTx { + return o && (o.$typeUrl === ResponseCheckTx.typeUrl || typeof o.code === "number" && (o.data instanceof Uint8Array || typeof o.data === "string") && typeof o.log === "string" && typeof o.info === "string" && typeof o.gasWanted === "bigint" && typeof o.gasUsed === "bigint" && Array.isArray(o.events) && (!o.events.length || Event.is(o.events[0])) && typeof o.codespace === "string"); + }, + isSDK(o: any): o is ResponseCheckTxSDKType { + return o && (o.$typeUrl === ResponseCheckTx.typeUrl || typeof o.code === "number" && (o.data instanceof Uint8Array || typeof o.data === "string") && typeof o.log === "string" && typeof o.info === "string" && typeof o.gas_wanted === "bigint" && typeof o.gas_used === "bigint" && Array.isArray(o.events) && (!o.events.length || Event.isSDK(o.events[0])) && typeof o.codespace === "string"); + }, + isAmino(o: any): o is ResponseCheckTxAmino { + return o && (o.$typeUrl === ResponseCheckTx.typeUrl || typeof o.code === "number" && (o.data instanceof Uint8Array || typeof o.data === "string") && typeof o.log === "string" && typeof o.info === "string" && typeof o.gas_wanted === "bigint" && typeof o.gas_used === "bigint" && Array.isArray(o.events) && (!o.events.length || Event.isAmino(o.events[0])) && typeof o.codespace === "string"); + }, encode(message: ResponseCheckTx, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.code !== 0) { writer.uint32(8).uint32(message.code); @@ -5171,6 +5504,12 @@ export const ResponseCheckTx = { typeUrl: "/tendermint.abci.ResponseCheckTx", value: ResponseCheckTx.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ResponseCheckTx.typeUrl)) { + return; + } + Event.registerTypeUrl(); } }; function createBaseResponseDeliverTx(): ResponseDeliverTx { @@ -5192,6 +5531,15 @@ function createBaseResponseDeliverTx(): ResponseDeliverTx { */ export const ResponseDeliverTx = { typeUrl: "/tendermint.abci.ResponseDeliverTx", + is(o: any): o is ResponseDeliverTx { + return o && (o.$typeUrl === ResponseDeliverTx.typeUrl || typeof o.code === "number" && (o.data instanceof Uint8Array || typeof o.data === "string") && typeof o.log === "string" && typeof o.info === "string" && typeof o.gasWanted === "bigint" && typeof o.gasUsed === "bigint" && Array.isArray(o.events) && (!o.events.length || Event.is(o.events[0])) && typeof o.codespace === "string"); + }, + isSDK(o: any): o is ResponseDeliverTxSDKType { + return o && (o.$typeUrl === ResponseDeliverTx.typeUrl || typeof o.code === "number" && (o.data instanceof Uint8Array || typeof o.data === "string") && typeof o.log === "string" && typeof o.info === "string" && typeof o.gas_wanted === "bigint" && typeof o.gas_used === "bigint" && Array.isArray(o.events) && (!o.events.length || Event.isSDK(o.events[0])) && typeof o.codespace === "string"); + }, + isAmino(o: any): o is ResponseDeliverTxAmino { + return o && (o.$typeUrl === ResponseDeliverTx.typeUrl || typeof o.code === "number" && (o.data instanceof Uint8Array || typeof o.data === "string") && typeof o.log === "string" && typeof o.info === "string" && typeof o.gas_wanted === "bigint" && typeof o.gas_used === "bigint" && Array.isArray(o.events) && (!o.events.length || Event.isAmino(o.events[0])) && typeof o.codespace === "string"); + }, encode(message: ResponseDeliverTx, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.code !== 0) { writer.uint32(8).uint32(message.code); @@ -5366,6 +5714,12 @@ export const ResponseDeliverTx = { typeUrl: "/tendermint.abci.ResponseDeliverTx", value: ResponseDeliverTx.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ResponseDeliverTx.typeUrl)) { + return; + } + Event.registerTypeUrl(); } }; function createBaseResponseEndBlock(): ResponseEndBlock { @@ -5382,6 +5736,15 @@ function createBaseResponseEndBlock(): ResponseEndBlock { */ export const ResponseEndBlock = { typeUrl: "/tendermint.abci.ResponseEndBlock", + is(o: any): o is ResponseEndBlock { + return o && (o.$typeUrl === ResponseEndBlock.typeUrl || Array.isArray(o.validatorUpdates) && (!o.validatorUpdates.length || ValidatorUpdate.is(o.validatorUpdates[0])) && Array.isArray(o.events) && (!o.events.length || Event.is(o.events[0]))); + }, + isSDK(o: any): o is ResponseEndBlockSDKType { + return o && (o.$typeUrl === ResponseEndBlock.typeUrl || Array.isArray(o.validator_updates) && (!o.validator_updates.length || ValidatorUpdate.isSDK(o.validator_updates[0])) && Array.isArray(o.events) && (!o.events.length || Event.isSDK(o.events[0]))); + }, + isAmino(o: any): o is ResponseEndBlockAmino { + return o && (o.$typeUrl === ResponseEndBlock.typeUrl || Array.isArray(o.validator_updates) && (!o.validator_updates.length || ValidatorUpdate.isAmino(o.validator_updates[0])) && Array.isArray(o.events) && (!o.events.length || Event.isAmino(o.events[0]))); + }, encode(message: ResponseEndBlock, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.validatorUpdates) { ValidatorUpdate.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -5490,6 +5853,14 @@ export const ResponseEndBlock = { typeUrl: "/tendermint.abci.ResponseEndBlock", value: ResponseEndBlock.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ResponseEndBlock.typeUrl)) { + return; + } + ValidatorUpdate.registerTypeUrl(); + ConsensusParams.registerTypeUrl(); + Event.registerTypeUrl(); } }; function createBaseResponseCommit(): ResponseCommit { @@ -5505,6 +5876,15 @@ function createBaseResponseCommit(): ResponseCommit { */ export const ResponseCommit = { typeUrl: "/tendermint.abci.ResponseCommit", + is(o: any): o is ResponseCommit { + return o && (o.$typeUrl === ResponseCommit.typeUrl || (o.data instanceof Uint8Array || typeof o.data === "string") && typeof o.retainHeight === "bigint"); + }, + isSDK(o: any): o is ResponseCommitSDKType { + return o && (o.$typeUrl === ResponseCommit.typeUrl || (o.data instanceof Uint8Array || typeof o.data === "string") && typeof o.retain_height === "bigint"); + }, + isAmino(o: any): o is ResponseCommitAmino { + return o && (o.$typeUrl === ResponseCommit.typeUrl || (o.data instanceof Uint8Array || typeof o.data === "string") && typeof o.retain_height === "bigint"); + }, encode(message: ResponseCommit, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.data.length !== 0) { writer.uint32(18).bytes(message.data); @@ -5587,7 +5967,8 @@ export const ResponseCommit = { typeUrl: "/tendermint.abci.ResponseCommit", value: ResponseCommit.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseResponseListSnapshots(): ResponseListSnapshots { return { @@ -5601,6 +5982,15 @@ function createBaseResponseListSnapshots(): ResponseListSnapshots { */ export const ResponseListSnapshots = { typeUrl: "/tendermint.abci.ResponseListSnapshots", + is(o: any): o is ResponseListSnapshots { + return o && (o.$typeUrl === ResponseListSnapshots.typeUrl || Array.isArray(o.snapshots) && (!o.snapshots.length || Snapshot.is(o.snapshots[0]))); + }, + isSDK(o: any): o is ResponseListSnapshotsSDKType { + return o && (o.$typeUrl === ResponseListSnapshots.typeUrl || Array.isArray(o.snapshots) && (!o.snapshots.length || Snapshot.isSDK(o.snapshots[0]))); + }, + isAmino(o: any): o is ResponseListSnapshotsAmino { + return o && (o.$typeUrl === ResponseListSnapshots.typeUrl || Array.isArray(o.snapshots) && (!o.snapshots.length || Snapshot.isAmino(o.snapshots[0]))); + }, encode(message: ResponseListSnapshots, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.snapshots) { Snapshot.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -5673,6 +6063,12 @@ export const ResponseListSnapshots = { typeUrl: "/tendermint.abci.ResponseListSnapshots", value: ResponseListSnapshots.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ResponseListSnapshots.typeUrl)) { + return; + } + Snapshot.registerTypeUrl(); } }; function createBaseResponseOfferSnapshot(): ResponseOfferSnapshot { @@ -5687,6 +6083,15 @@ function createBaseResponseOfferSnapshot(): ResponseOfferSnapshot { */ export const ResponseOfferSnapshot = { typeUrl: "/tendermint.abci.ResponseOfferSnapshot", + is(o: any): o is ResponseOfferSnapshot { + return o && (o.$typeUrl === ResponseOfferSnapshot.typeUrl || isSet(o.result)); + }, + isSDK(o: any): o is ResponseOfferSnapshotSDKType { + return o && (o.$typeUrl === ResponseOfferSnapshot.typeUrl || isSet(o.result)); + }, + isAmino(o: any): o is ResponseOfferSnapshotAmino { + return o && (o.$typeUrl === ResponseOfferSnapshot.typeUrl || isSet(o.result)); + }, encode(message: ResponseOfferSnapshot, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.result !== 0) { writer.uint32(8).int32(message.result); @@ -5753,7 +6158,8 @@ export const ResponseOfferSnapshot = { typeUrl: "/tendermint.abci.ResponseOfferSnapshot", value: ResponseOfferSnapshot.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseResponseLoadSnapshotChunk(): ResponseLoadSnapshotChunk { return { @@ -5767,6 +6173,15 @@ function createBaseResponseLoadSnapshotChunk(): ResponseLoadSnapshotChunk { */ export const ResponseLoadSnapshotChunk = { typeUrl: "/tendermint.abci.ResponseLoadSnapshotChunk", + is(o: any): o is ResponseLoadSnapshotChunk { + return o && (o.$typeUrl === ResponseLoadSnapshotChunk.typeUrl || o.chunk instanceof Uint8Array || typeof o.chunk === "string"); + }, + isSDK(o: any): o is ResponseLoadSnapshotChunkSDKType { + return o && (o.$typeUrl === ResponseLoadSnapshotChunk.typeUrl || o.chunk instanceof Uint8Array || typeof o.chunk === "string"); + }, + isAmino(o: any): o is ResponseLoadSnapshotChunkAmino { + return o && (o.$typeUrl === ResponseLoadSnapshotChunk.typeUrl || o.chunk instanceof Uint8Array || typeof o.chunk === "string"); + }, encode(message: ResponseLoadSnapshotChunk, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.chunk.length !== 0) { writer.uint32(10).bytes(message.chunk); @@ -5833,7 +6248,8 @@ export const ResponseLoadSnapshotChunk = { typeUrl: "/tendermint.abci.ResponseLoadSnapshotChunk", value: ResponseLoadSnapshotChunk.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseResponseApplySnapshotChunk(): ResponseApplySnapshotChunk { return { @@ -5849,6 +6265,15 @@ function createBaseResponseApplySnapshotChunk(): ResponseApplySnapshotChunk { */ export const ResponseApplySnapshotChunk = { typeUrl: "/tendermint.abci.ResponseApplySnapshotChunk", + is(o: any): o is ResponseApplySnapshotChunk { + return o && (o.$typeUrl === ResponseApplySnapshotChunk.typeUrl || isSet(o.result) && Array.isArray(o.refetchChunks) && (!o.refetchChunks.length || typeof o.refetchChunks[0] === "number") && Array.isArray(o.rejectSenders) && (!o.rejectSenders.length || typeof o.rejectSenders[0] === "string")); + }, + isSDK(o: any): o is ResponseApplySnapshotChunkSDKType { + return o && (o.$typeUrl === ResponseApplySnapshotChunk.typeUrl || isSet(o.result) && Array.isArray(o.refetch_chunks) && (!o.refetch_chunks.length || typeof o.refetch_chunks[0] === "number") && Array.isArray(o.reject_senders) && (!o.reject_senders.length || typeof o.reject_senders[0] === "string")); + }, + isAmino(o: any): o is ResponseApplySnapshotChunkAmino { + return o && (o.$typeUrl === ResponseApplySnapshotChunk.typeUrl || isSet(o.result) && Array.isArray(o.refetch_chunks) && (!o.refetch_chunks.length || typeof o.refetch_chunks[0] === "number") && Array.isArray(o.reject_senders) && (!o.reject_senders.length || typeof o.reject_senders[0] === "string")); + }, encode(message: ResponseApplySnapshotChunk, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.result !== 0) { writer.uint32(8).int32(message.result); @@ -5964,7 +6389,8 @@ export const ResponseApplySnapshotChunk = { typeUrl: "/tendermint.abci.ResponseApplySnapshotChunk", value: ResponseApplySnapshotChunk.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseConsensusParams(): ConsensusParams { return { @@ -5983,6 +6409,15 @@ function createBaseConsensusParams(): ConsensusParams { */ export const ConsensusParams = { typeUrl: "/tendermint.abci.ConsensusParams", + is(o: any): o is ConsensusParams { + return o && o.$typeUrl === ConsensusParams.typeUrl; + }, + isSDK(o: any): o is ConsensusParamsSDKType { + return o && o.$typeUrl === ConsensusParams.typeUrl; + }, + isAmino(o: any): o is ConsensusParamsAmino { + return o && o.$typeUrl === ConsensusParams.typeUrl; + }, encode(message: ConsensusParams, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.block !== undefined) { BlockParams.encode(message.block, writer.uint32(10).fork()).ldelim(); @@ -6099,6 +6534,15 @@ export const ConsensusParams = { typeUrl: "/tendermint.abci.ConsensusParams", value: ConsensusParams.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ConsensusParams.typeUrl)) { + return; + } + BlockParams.registerTypeUrl(); + EvidenceParams.registerTypeUrl(); + ValidatorParams.registerTypeUrl(); + VersionParams.registerTypeUrl(); } }; function createBaseBlockParams(): BlockParams { @@ -6115,6 +6559,15 @@ function createBaseBlockParams(): BlockParams { */ export const BlockParams = { typeUrl: "/tendermint.abci.BlockParams", + is(o: any): o is BlockParams { + return o && (o.$typeUrl === BlockParams.typeUrl || typeof o.maxBytes === "bigint" && typeof o.maxGas === "bigint"); + }, + isSDK(o: any): o is BlockParamsSDKType { + return o && (o.$typeUrl === BlockParams.typeUrl || typeof o.max_bytes === "bigint" && typeof o.max_gas === "bigint"); + }, + isAmino(o: any): o is BlockParamsAmino { + return o && (o.$typeUrl === BlockParams.typeUrl || typeof o.max_bytes === "bigint" && typeof o.max_gas === "bigint"); + }, encode(message: BlockParams, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.maxBytes !== BigInt(0)) { writer.uint32(8).int64(message.maxBytes); @@ -6199,7 +6652,8 @@ export const BlockParams = { typeUrl: "/tendermint.abci.BlockParams", value: BlockParams.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseLastCommitInfo(): LastCommitInfo { return { @@ -6214,6 +6668,15 @@ function createBaseLastCommitInfo(): LastCommitInfo { */ export const LastCommitInfo = { typeUrl: "/tendermint.abci.LastCommitInfo", + is(o: any): o is LastCommitInfo { + return o && (o.$typeUrl === LastCommitInfo.typeUrl || typeof o.round === "number" && Array.isArray(o.votes) && (!o.votes.length || VoteInfo.is(o.votes[0]))); + }, + isSDK(o: any): o is LastCommitInfoSDKType { + return o && (o.$typeUrl === LastCommitInfo.typeUrl || typeof o.round === "number" && Array.isArray(o.votes) && (!o.votes.length || VoteInfo.isSDK(o.votes[0]))); + }, + isAmino(o: any): o is LastCommitInfoAmino { + return o && (o.$typeUrl === LastCommitInfo.typeUrl || typeof o.round === "number" && Array.isArray(o.votes) && (!o.votes.length || VoteInfo.isAmino(o.votes[0]))); + }, encode(message: LastCommitInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.round !== 0) { writer.uint32(8).int32(message.round); @@ -6300,6 +6763,12 @@ export const LastCommitInfo = { typeUrl: "/tendermint.abci.LastCommitInfo", value: LastCommitInfo.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(LastCommitInfo.typeUrl)) { + return; + } + VoteInfo.registerTypeUrl(); } }; function createBaseEvent(): Event { @@ -6318,6 +6787,15 @@ function createBaseEvent(): Event { */ export const Event = { typeUrl: "/tendermint.abci.Event", + is(o: any): o is Event { + return o && (o.$typeUrl === Event.typeUrl || typeof o.type === "string" && Array.isArray(o.attributes) && (!o.attributes.length || EventAttribute.is(o.attributes[0]))); + }, + isSDK(o: any): o is EventSDKType { + return o && (o.$typeUrl === Event.typeUrl || typeof o.type === "string" && Array.isArray(o.attributes) && (!o.attributes.length || EventAttribute.isSDK(o.attributes[0]))); + }, + isAmino(o: any): o is EventAmino { + return o && (o.$typeUrl === Event.typeUrl || typeof o.type === "string" && Array.isArray(o.attributes) && (!o.attributes.length || EventAttribute.isAmino(o.attributes[0]))); + }, encode(message: Event, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.type !== "") { writer.uint32(10).string(message.type); @@ -6404,6 +6882,12 @@ export const Event = { typeUrl: "/tendermint.abci.Event", value: Event.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Event.typeUrl)) { + return; + } + EventAttribute.registerTypeUrl(); } }; function createBaseEventAttribute(): EventAttribute { @@ -6421,6 +6905,15 @@ function createBaseEventAttribute(): EventAttribute { */ export const EventAttribute = { typeUrl: "/tendermint.abci.EventAttribute", + is(o: any): o is EventAttribute { + return o && (o.$typeUrl === EventAttribute.typeUrl || (o.key instanceof Uint8Array || typeof o.key === "string") && (o.value instanceof Uint8Array || typeof o.value === "string") && typeof o.index === "boolean"); + }, + isSDK(o: any): o is EventAttributeSDKType { + return o && (o.$typeUrl === EventAttribute.typeUrl || (o.key instanceof Uint8Array || typeof o.key === "string") && (o.value instanceof Uint8Array || typeof o.value === "string") && typeof o.index === "boolean"); + }, + isAmino(o: any): o is EventAttributeAmino { + return o && (o.$typeUrl === EventAttribute.typeUrl || (o.key instanceof Uint8Array || typeof o.key === "string") && (o.value instanceof Uint8Array || typeof o.value === "string") && typeof o.index === "boolean"); + }, encode(message: EventAttribute, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.key.length !== 0) { writer.uint32(10).bytes(message.key); @@ -6515,7 +7008,8 @@ export const EventAttribute = { typeUrl: "/tendermint.abci.EventAttribute", value: EventAttribute.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseTxResult(): TxResult { return { @@ -6535,6 +7029,15 @@ function createBaseTxResult(): TxResult { */ export const TxResult = { typeUrl: "/tendermint.abci.TxResult", + is(o: any): o is TxResult { + return o && (o.$typeUrl === TxResult.typeUrl || typeof o.height === "bigint" && typeof o.index === "number" && (o.tx instanceof Uint8Array || typeof o.tx === "string") && ResponseDeliverTx.is(o.result)); + }, + isSDK(o: any): o is TxResultSDKType { + return o && (o.$typeUrl === TxResult.typeUrl || typeof o.height === "bigint" && typeof o.index === "number" && (o.tx instanceof Uint8Array || typeof o.tx === "string") && ResponseDeliverTx.isSDK(o.result)); + }, + isAmino(o: any): o is TxResultAmino { + return o && (o.$typeUrl === TxResult.typeUrl || typeof o.height === "bigint" && typeof o.index === "number" && (o.tx instanceof Uint8Array || typeof o.tx === "string") && ResponseDeliverTx.isAmino(o.result)); + }, encode(message: TxResult, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.height !== BigInt(0)) { writer.uint32(8).int64(message.height); @@ -6647,6 +7150,12 @@ export const TxResult = { typeUrl: "/tendermint.abci.TxResult", value: TxResult.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(TxResult.typeUrl)) { + return; + } + ResponseDeliverTx.registerTypeUrl(); } }; function createBaseValidator(): Validator { @@ -6663,6 +7172,15 @@ function createBaseValidator(): Validator { */ export const Validator = { typeUrl: "/tendermint.abci.Validator", + is(o: any): o is Validator { + return o && (o.$typeUrl === Validator.typeUrl || (o.address instanceof Uint8Array || typeof o.address === "string") && typeof o.power === "bigint"); + }, + isSDK(o: any): o is ValidatorSDKType { + return o && (o.$typeUrl === Validator.typeUrl || (o.address instanceof Uint8Array || typeof o.address === "string") && typeof o.power === "bigint"); + }, + isAmino(o: any): o is ValidatorAmino { + return o && (o.$typeUrl === Validator.typeUrl || (o.address instanceof Uint8Array || typeof o.address === "string") && typeof o.power === "bigint"); + }, encode(message: Validator, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.address.length !== 0) { writer.uint32(10).bytes(message.address); @@ -6745,7 +7263,8 @@ export const Validator = { typeUrl: "/tendermint.abci.Validator", value: Validator.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseValidatorUpdate(): ValidatorUpdate { return { @@ -6761,6 +7280,15 @@ function createBaseValidatorUpdate(): ValidatorUpdate { */ export const ValidatorUpdate = { typeUrl: "/tendermint.abci.ValidatorUpdate", + is(o: any): o is ValidatorUpdate { + return o && (o.$typeUrl === ValidatorUpdate.typeUrl || PublicKey.is(o.pubKey) && typeof o.power === "bigint"); + }, + isSDK(o: any): o is ValidatorUpdateSDKType { + return o && (o.$typeUrl === ValidatorUpdate.typeUrl || PublicKey.isSDK(o.pub_key) && typeof o.power === "bigint"); + }, + isAmino(o: any): o is ValidatorUpdateAmino { + return o && (o.$typeUrl === ValidatorUpdate.typeUrl || PublicKey.isAmino(o.pub_key) && typeof o.power === "bigint"); + }, encode(message: ValidatorUpdate, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.pubKey !== undefined) { PublicKey.encode(message.pubKey, writer.uint32(10).fork()).ldelim(); @@ -6845,6 +7373,12 @@ export const ValidatorUpdate = { typeUrl: "/tendermint.abci.ValidatorUpdate", value: ValidatorUpdate.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ValidatorUpdate.typeUrl)) { + return; + } + PublicKey.registerTypeUrl(); } }; function createBaseVoteInfo(): VoteInfo { @@ -6861,6 +7395,15 @@ function createBaseVoteInfo(): VoteInfo { */ export const VoteInfo = { typeUrl: "/tendermint.abci.VoteInfo", + is(o: any): o is VoteInfo { + return o && (o.$typeUrl === VoteInfo.typeUrl || Validator.is(o.validator) && typeof o.signedLastBlock === "boolean"); + }, + isSDK(o: any): o is VoteInfoSDKType { + return o && (o.$typeUrl === VoteInfo.typeUrl || Validator.isSDK(o.validator) && typeof o.signed_last_block === "boolean"); + }, + isAmino(o: any): o is VoteInfoAmino { + return o && (o.$typeUrl === VoteInfo.typeUrl || Validator.isAmino(o.validator) && typeof o.signed_last_block === "boolean"); + }, encode(message: VoteInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.validator !== undefined) { Validator.encode(message.validator, writer.uint32(10).fork()).ldelim(); @@ -6943,6 +7486,12 @@ export const VoteInfo = { typeUrl: "/tendermint.abci.VoteInfo", value: VoteInfo.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(VoteInfo.typeUrl)) { + return; + } + Validator.registerTypeUrl(); } }; function createBaseEvidence(): Evidence { @@ -6961,6 +7510,15 @@ function createBaseEvidence(): Evidence { */ export const Evidence = { typeUrl: "/tendermint.abci.Evidence", + is(o: any): o is Evidence { + return o && (o.$typeUrl === Evidence.typeUrl || isSet(o.type) && Validator.is(o.validator) && typeof o.height === "bigint" && Timestamp.is(o.time) && typeof o.totalVotingPower === "bigint"); + }, + isSDK(o: any): o is EvidenceSDKType { + return o && (o.$typeUrl === Evidence.typeUrl || isSet(o.type) && Validator.isSDK(o.validator) && typeof o.height === "bigint" && Timestamp.isSDK(o.time) && typeof o.total_voting_power === "bigint"); + }, + isAmino(o: any): o is EvidenceAmino { + return o && (o.$typeUrl === Evidence.typeUrl || isSet(o.type) && Validator.isAmino(o.validator) && typeof o.height === "bigint" && Timestamp.isAmino(o.time) && typeof o.total_voting_power === "bigint"); + }, encode(message: Evidence, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.type !== 0) { writer.uint32(8).int32(message.type); @@ -7089,6 +7647,12 @@ export const Evidence = { typeUrl: "/tendermint.abci.Evidence", value: Evidence.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Evidence.typeUrl)) { + return; + } + Validator.registerTypeUrl(); } }; function createBaseSnapshot(): Snapshot { @@ -7107,6 +7671,15 @@ function createBaseSnapshot(): Snapshot { */ export const Snapshot = { typeUrl: "/tendermint.abci.Snapshot", + is(o: any): o is Snapshot { + return o && (o.$typeUrl === Snapshot.typeUrl || typeof o.height === "bigint" && typeof o.format === "number" && typeof o.chunks === "number" && (o.hash instanceof Uint8Array || typeof o.hash === "string") && (o.metadata instanceof Uint8Array || typeof o.metadata === "string")); + }, + isSDK(o: any): o is SnapshotSDKType { + return o && (o.$typeUrl === Snapshot.typeUrl || typeof o.height === "bigint" && typeof o.format === "number" && typeof o.chunks === "number" && (o.hash instanceof Uint8Array || typeof o.hash === "string") && (o.metadata instanceof Uint8Array || typeof o.metadata === "string")); + }, + isAmino(o: any): o is SnapshotAmino { + return o && (o.$typeUrl === Snapshot.typeUrl || typeof o.height === "bigint" && typeof o.format === "number" && typeof o.chunks === "number" && (o.hash instanceof Uint8Array || typeof o.hash === "string") && (o.metadata instanceof Uint8Array || typeof o.metadata === "string")); + }, encode(message: Snapshot, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.height !== BigInt(0)) { writer.uint32(8).uint64(message.height); @@ -7231,5 +7804,6 @@ export const Snapshot = { typeUrl: "/tendermint.abci.Snapshot", value: Snapshot.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/tendermint/bundle.ts b/__fixtures__/v-next/outputv3/tendermint/bundle.ts index 0c2edaadd1..0af45545e1 100644 --- a/__fixtures__/v-next/outputv3/tendermint/bundle.ts +++ b/__fixtures__/v-next/outputv3/tendermint/bundle.ts @@ -9,9 +9,11 @@ import * as _312 from "./types/params"; import * as _313 from "./types/types"; import * as _314 from "./types/validator"; import * as _315 from "./version/types"; +import * as _572 from "./abci/types.rpc.func"; export namespace tendermint { export const abci = { - ..._305 + ..._305, + ..._572 }; export const crypto = { ..._306, diff --git a/__fixtures__/v-next/outputv3/tendermint/crypto/keys.ts b/__fixtures__/v-next/outputv3/tendermint/crypto/keys.ts index 291d6a633e..104b020ed0 100644 --- a/__fixtures__/v-next/outputv3/tendermint/crypto/keys.ts +++ b/__fixtures__/v-next/outputv3/tendermint/crypto/keys.ts @@ -49,6 +49,15 @@ function createBasePublicKey(): PublicKey { */ export const PublicKey = { typeUrl: "/tendermint.crypto.PublicKey", + is(o: any): o is PublicKey { + return o && o.$typeUrl === PublicKey.typeUrl; + }, + isSDK(o: any): o is PublicKeySDKType { + return o && o.$typeUrl === PublicKey.typeUrl; + }, + isAmino(o: any): o is PublicKeyAmino { + return o && o.$typeUrl === PublicKey.typeUrl; + }, encode(message: PublicKey, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.ed25519 !== undefined) { writer.uint32(10).bytes(message.ed25519); @@ -129,5 +138,6 @@ export const PublicKey = { typeUrl: "/tendermint.crypto.PublicKey", value: PublicKey.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/tendermint/crypto/proof.ts b/__fixtures__/v-next/outputv3/tendermint/crypto/proof.ts index f8774484fb..7cae277acf 100644 --- a/__fixtures__/v-next/outputv3/tendermint/crypto/proof.ts +++ b/__fixtures__/v-next/outputv3/tendermint/crypto/proof.ts @@ -1,5 +1,6 @@ import { BinaryReader, BinaryWriter } from "../../binary"; import { isSet, bytesFromBase64, DeepPartial, base64FromBytes } from "../../helpers"; +import { GlobalDecoderRegistry } from "../../registry"; export const protobufPackage = "tendermint.crypto"; /** * @name Proof @@ -204,6 +205,15 @@ function createBaseProof(): Proof { */ export const Proof = { typeUrl: "/tendermint.crypto.Proof", + is(o: any): o is Proof { + return o && (o.$typeUrl === Proof.typeUrl || typeof o.total === "bigint" && typeof o.index === "bigint" && (o.leafHash instanceof Uint8Array || typeof o.leafHash === "string") && Array.isArray(o.aunts) && (!o.aunts.length || o.aunts[0] instanceof Uint8Array || typeof o.aunts[0] === "string")); + }, + isSDK(o: any): o is ProofSDKType { + return o && (o.$typeUrl === Proof.typeUrl || typeof o.total === "bigint" && typeof o.index === "bigint" && (o.leaf_hash instanceof Uint8Array || typeof o.leaf_hash === "string") && Array.isArray(o.aunts) && (!o.aunts.length || o.aunts[0] instanceof Uint8Array || typeof o.aunts[0] === "string")); + }, + isAmino(o: any): o is ProofAmino { + return o && (o.$typeUrl === Proof.typeUrl || typeof o.total === "bigint" && typeof o.index === "bigint" && (o.leaf_hash instanceof Uint8Array || typeof o.leaf_hash === "string") && Array.isArray(o.aunts) && (!o.aunts.length || o.aunts[0] instanceof Uint8Array || typeof o.aunts[0] === "string")); + }, encode(message: Proof, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.total !== BigInt(0)) { writer.uint32(8).int64(message.total); @@ -322,7 +332,8 @@ export const Proof = { typeUrl: "/tendermint.crypto.Proof", value: Proof.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseValueOp(): ValueOp { return { @@ -337,6 +348,15 @@ function createBaseValueOp(): ValueOp { */ export const ValueOp = { typeUrl: "/tendermint.crypto.ValueOp", + is(o: any): o is ValueOp { + return o && (o.$typeUrl === ValueOp.typeUrl || o.key instanceof Uint8Array || typeof o.key === "string"); + }, + isSDK(o: any): o is ValueOpSDKType { + return o && (o.$typeUrl === ValueOp.typeUrl || o.key instanceof Uint8Array || typeof o.key === "string"); + }, + isAmino(o: any): o is ValueOpAmino { + return o && (o.$typeUrl === ValueOp.typeUrl || o.key instanceof Uint8Array || typeof o.key === "string"); + }, encode(message: ValueOp, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.key.length !== 0) { writer.uint32(10).bytes(message.key); @@ -419,6 +439,12 @@ export const ValueOp = { typeUrl: "/tendermint.crypto.ValueOp", value: ValueOp.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ValueOp.typeUrl)) { + return; + } + Proof.registerTypeUrl(); } }; function createBaseDominoOp(): DominoOp { @@ -435,6 +461,15 @@ function createBaseDominoOp(): DominoOp { */ export const DominoOp = { typeUrl: "/tendermint.crypto.DominoOp", + is(o: any): o is DominoOp { + return o && (o.$typeUrl === DominoOp.typeUrl || typeof o.key === "string" && typeof o.input === "string" && typeof o.output === "string"); + }, + isSDK(o: any): o is DominoOpSDKType { + return o && (o.$typeUrl === DominoOp.typeUrl || typeof o.key === "string" && typeof o.input === "string" && typeof o.output === "string"); + }, + isAmino(o: any): o is DominoOpAmino { + return o && (o.$typeUrl === DominoOp.typeUrl || typeof o.key === "string" && typeof o.input === "string" && typeof o.output === "string"); + }, encode(message: DominoOp, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.key !== "") { writer.uint32(10).string(message.key); @@ -529,7 +564,8 @@ export const DominoOp = { typeUrl: "/tendermint.crypto.DominoOp", value: DominoOp.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseProofOp(): ProofOp { return { @@ -548,6 +584,15 @@ function createBaseProofOp(): ProofOp { */ export const ProofOp = { typeUrl: "/tendermint.crypto.ProofOp", + is(o: any): o is ProofOp { + return o && (o.$typeUrl === ProofOp.typeUrl || typeof o.type === "string" && (o.key instanceof Uint8Array || typeof o.key === "string") && (o.data instanceof Uint8Array || typeof o.data === "string")); + }, + isSDK(o: any): o is ProofOpSDKType { + return o && (o.$typeUrl === ProofOp.typeUrl || typeof o.type === "string" && (o.key instanceof Uint8Array || typeof o.key === "string") && (o.data instanceof Uint8Array || typeof o.data === "string")); + }, + isAmino(o: any): o is ProofOpAmino { + return o && (o.$typeUrl === ProofOp.typeUrl || typeof o.type === "string" && (o.key instanceof Uint8Array || typeof o.key === "string") && (o.data instanceof Uint8Array || typeof o.data === "string")); + }, encode(message: ProofOp, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.type !== "") { writer.uint32(10).string(message.type); @@ -642,7 +687,8 @@ export const ProofOp = { typeUrl: "/tendermint.crypto.ProofOp", value: ProofOp.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseProofOps(): ProofOps { return { @@ -657,6 +703,15 @@ function createBaseProofOps(): ProofOps { */ export const ProofOps = { typeUrl: "/tendermint.crypto.ProofOps", + is(o: any): o is ProofOps { + return o && (o.$typeUrl === ProofOps.typeUrl || Array.isArray(o.ops) && (!o.ops.length || ProofOp.is(o.ops[0]))); + }, + isSDK(o: any): o is ProofOpsSDKType { + return o && (o.$typeUrl === ProofOps.typeUrl || Array.isArray(o.ops) && (!o.ops.length || ProofOp.isSDK(o.ops[0]))); + }, + isAmino(o: any): o is ProofOpsAmino { + return o && (o.$typeUrl === ProofOps.typeUrl || Array.isArray(o.ops) && (!o.ops.length || ProofOp.isAmino(o.ops[0]))); + }, encode(message: ProofOps, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.ops) { ProofOp.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -729,5 +784,11 @@ export const ProofOps = { typeUrl: "/tendermint.crypto.ProofOps", value: ProofOps.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ProofOps.typeUrl)) { + return; + } + ProofOp.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/tendermint/libs/bits/types.ts b/__fixtures__/v-next/outputv3/tendermint/libs/bits/types.ts index ddafdd9020..4fdbecbf52 100644 --- a/__fixtures__/v-next/outputv3/tendermint/libs/bits/types.ts +++ b/__fixtures__/v-next/outputv3/tendermint/libs/bits/types.ts @@ -45,6 +45,15 @@ function createBaseBitArray(): BitArray { */ export const BitArray = { typeUrl: "/tendermint.libs.bits.BitArray", + is(o: any): o is BitArray { + return o && (o.$typeUrl === BitArray.typeUrl || typeof o.bits === "bigint" && Array.isArray(o.elems) && (!o.elems.length || typeof o.elems[0] === "bigint")); + }, + isSDK(o: any): o is BitArraySDKType { + return o && (o.$typeUrl === BitArray.typeUrl || typeof o.bits === "bigint" && Array.isArray(o.elems) && (!o.elems.length || typeof o.elems[0] === "bigint")); + }, + isAmino(o: any): o is BitArrayAmino { + return o && (o.$typeUrl === BitArray.typeUrl || typeof o.bits === "bigint" && Array.isArray(o.elems) && (!o.elems.length || typeof o.elems[0] === "bigint")); + }, encode(message: BitArray, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.bits !== BigInt(0)) { writer.uint32(8).int64(message.bits); @@ -142,5 +151,6 @@ export const BitArray = { typeUrl: "/tendermint.libs.bits.BitArray", value: BitArray.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/tendermint/p2p/types.ts b/__fixtures__/v-next/outputv3/tendermint/p2p/types.ts index 8246afec10..63b584f3ce 100644 --- a/__fixtures__/v-next/outputv3/tendermint/p2p/types.ts +++ b/__fixtures__/v-next/outputv3/tendermint/p2p/types.ts @@ -1,6 +1,7 @@ import { Timestamp, TimestampAmino, TimestampSDKType } from "../../google/protobuf/timestamp"; import { BinaryReader, BinaryWriter } from "../../binary"; import { isSet, DeepPartial, bytesFromBase64, base64FromBytes, toTimestamp, fromTimestamp } from "../../helpers"; +import { GlobalDecoderRegistry } from "../../registry"; export const protobufPackage = "tendermint.p2p"; /** * @name ProtocolVersion @@ -201,6 +202,15 @@ function createBaseProtocolVersion(): ProtocolVersion { */ export const ProtocolVersion = { typeUrl: "/tendermint.p2p.ProtocolVersion", + is(o: any): o is ProtocolVersion { + return o && (o.$typeUrl === ProtocolVersion.typeUrl || typeof o.p2p === "bigint" && typeof o.block === "bigint" && typeof o.app === "bigint"); + }, + isSDK(o: any): o is ProtocolVersionSDKType { + return o && (o.$typeUrl === ProtocolVersion.typeUrl || typeof o.p2p === "bigint" && typeof o.block === "bigint" && typeof o.app === "bigint"); + }, + isAmino(o: any): o is ProtocolVersionAmino { + return o && (o.$typeUrl === ProtocolVersion.typeUrl || typeof o.p2p === "bigint" && typeof o.block === "bigint" && typeof o.app === "bigint"); + }, encode(message: ProtocolVersion, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.p2p !== BigInt(0)) { writer.uint32(8).uint64(message.p2p); @@ -301,7 +311,8 @@ export const ProtocolVersion = { typeUrl: "/tendermint.p2p.ProtocolVersion", value: ProtocolVersion.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseNodeInfo(): NodeInfo { return { @@ -322,6 +333,15 @@ function createBaseNodeInfo(): NodeInfo { */ export const NodeInfo = { typeUrl: "/tendermint.p2p.NodeInfo", + is(o: any): o is NodeInfo { + return o && (o.$typeUrl === NodeInfo.typeUrl || ProtocolVersion.is(o.protocolVersion) && typeof o.nodeId === "string" && typeof o.listenAddr === "string" && typeof o.network === "string" && typeof o.version === "string" && (o.channels instanceof Uint8Array || typeof o.channels === "string") && typeof o.moniker === "string" && NodeInfoOther.is(o.other)); + }, + isSDK(o: any): o is NodeInfoSDKType { + return o && (o.$typeUrl === NodeInfo.typeUrl || ProtocolVersion.isSDK(o.protocol_version) && typeof o.node_id === "string" && typeof o.listen_addr === "string" && typeof o.network === "string" && typeof o.version === "string" && (o.channels instanceof Uint8Array || typeof o.channels === "string") && typeof o.moniker === "string" && NodeInfoOther.isSDK(o.other)); + }, + isAmino(o: any): o is NodeInfoAmino { + return o && (o.$typeUrl === NodeInfo.typeUrl || ProtocolVersion.isAmino(o.protocol_version) && typeof o.node_id === "string" && typeof o.listen_addr === "string" && typeof o.network === "string" && typeof o.version === "string" && (o.channels instanceof Uint8Array || typeof o.channels === "string") && typeof o.moniker === "string" && NodeInfoOther.isAmino(o.other)); + }, encode(message: NodeInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.protocolVersion !== undefined) { ProtocolVersion.encode(message.protocolVersion, writer.uint32(10).fork()).ldelim(); @@ -490,6 +510,13 @@ export const NodeInfo = { typeUrl: "/tendermint.p2p.NodeInfo", value: NodeInfo.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(NodeInfo.typeUrl)) { + return; + } + ProtocolVersion.registerTypeUrl(); + NodeInfoOther.registerTypeUrl(); } }; function createBaseNodeInfoOther(): NodeInfoOther { @@ -505,6 +532,15 @@ function createBaseNodeInfoOther(): NodeInfoOther { */ export const NodeInfoOther = { typeUrl: "/tendermint.p2p.NodeInfoOther", + is(o: any): o is NodeInfoOther { + return o && (o.$typeUrl === NodeInfoOther.typeUrl || typeof o.txIndex === "string" && typeof o.rpcAddress === "string"); + }, + isSDK(o: any): o is NodeInfoOtherSDKType { + return o && (o.$typeUrl === NodeInfoOther.typeUrl || typeof o.tx_index === "string" && typeof o.rpc_address === "string"); + }, + isAmino(o: any): o is NodeInfoOtherAmino { + return o && (o.$typeUrl === NodeInfoOther.typeUrl || typeof o.tx_index === "string" && typeof o.rpc_address === "string"); + }, encode(message: NodeInfoOther, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.txIndex !== "") { writer.uint32(10).string(message.txIndex); @@ -585,7 +621,8 @@ export const NodeInfoOther = { typeUrl: "/tendermint.p2p.NodeInfoOther", value: NodeInfoOther.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBasePeerInfo(): PeerInfo { return { @@ -601,6 +638,15 @@ function createBasePeerInfo(): PeerInfo { */ export const PeerInfo = { typeUrl: "/tendermint.p2p.PeerInfo", + is(o: any): o is PeerInfo { + return o && (o.$typeUrl === PeerInfo.typeUrl || typeof o.id === "string" && Array.isArray(o.addressInfo) && (!o.addressInfo.length || PeerAddressInfo.is(o.addressInfo[0]))); + }, + isSDK(o: any): o is PeerInfoSDKType { + return o && (o.$typeUrl === PeerInfo.typeUrl || typeof o.id === "string" && Array.isArray(o.address_info) && (!o.address_info.length || PeerAddressInfo.isSDK(o.address_info[0]))); + }, + isAmino(o: any): o is PeerInfoAmino { + return o && (o.$typeUrl === PeerInfo.typeUrl || typeof o.id === "string" && Array.isArray(o.address_info) && (!o.address_info.length || PeerAddressInfo.isAmino(o.address_info[0]))); + }, encode(message: PeerInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.id !== "") { writer.uint32(10).string(message.id); @@ -701,6 +747,12 @@ export const PeerInfo = { typeUrl: "/tendermint.p2p.PeerInfo", value: PeerInfo.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(PeerInfo.typeUrl)) { + return; + } + PeerAddressInfo.registerTypeUrl(); } }; function createBasePeerAddressInfo(): PeerAddressInfo { @@ -718,6 +770,15 @@ function createBasePeerAddressInfo(): PeerAddressInfo { */ export const PeerAddressInfo = { typeUrl: "/tendermint.p2p.PeerAddressInfo", + is(o: any): o is PeerAddressInfo { + return o && (o.$typeUrl === PeerAddressInfo.typeUrl || typeof o.address === "string" && typeof o.dialFailures === "number"); + }, + isSDK(o: any): o is PeerAddressInfoSDKType { + return o && (o.$typeUrl === PeerAddressInfo.typeUrl || typeof o.address === "string" && typeof o.dial_failures === "number"); + }, + isAmino(o: any): o is PeerAddressInfoAmino { + return o && (o.$typeUrl === PeerAddressInfo.typeUrl || typeof o.address === "string" && typeof o.dial_failures === "number"); + }, encode(message: PeerAddressInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.address !== "") { writer.uint32(10).string(message.address); @@ -826,5 +887,6 @@ export const PeerAddressInfo = { typeUrl: "/tendermint.p2p.PeerAddressInfo", value: PeerAddressInfo.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/tendermint/types/block.ts b/__fixtures__/v-next/outputv3/tendermint/types/block.ts index cb0dbe9d2c..ab587a264c 100644 --- a/__fixtures__/v-next/outputv3/tendermint/types/block.ts +++ b/__fixtures__/v-next/outputv3/tendermint/types/block.ts @@ -1,6 +1,7 @@ import { Header, HeaderAmino, HeaderSDKType, Data, DataAmino, DataSDKType, Commit, CommitAmino, CommitSDKType } from "./types"; import { EvidenceList, EvidenceListAmino, EvidenceListSDKType } from "./evidence"; import { BinaryReader, BinaryWriter } from "../../binary"; +import { GlobalDecoderRegistry } from "../../registry"; import { isSet, DeepPartial } from "../../helpers"; export const protobufPackage = "tendermint.types"; /** @@ -55,6 +56,15 @@ function createBaseBlock(): Block { */ export const Block = { typeUrl: "/tendermint.types.Block", + is(o: any): o is Block { + return o && (o.$typeUrl === Block.typeUrl || Header.is(o.header) && Data.is(o.data) && EvidenceList.is(o.evidence)); + }, + isSDK(o: any): o is BlockSDKType { + return o && (o.$typeUrl === Block.typeUrl || Header.isSDK(o.header) && Data.isSDK(o.data) && EvidenceList.isSDK(o.evidence)); + }, + isAmino(o: any): o is BlockAmino { + return o && (o.$typeUrl === Block.typeUrl || Header.isAmino(o.header) && Data.isAmino(o.data) && EvidenceList.isAmino(o.evidence)); + }, encode(message: Block, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.header !== undefined) { Header.encode(message.header, writer.uint32(10).fork()).ldelim(); @@ -171,5 +181,14 @@ export const Block = { typeUrl: "/tendermint.types.Block", value: Block.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Block.typeUrl)) { + return; + } + Header.registerTypeUrl(); + Data.registerTypeUrl(); + EvidenceList.registerTypeUrl(); + Commit.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/tendermint/types/evidence.ts b/__fixtures__/v-next/outputv3/tendermint/types/evidence.ts index 85eb9d9eb5..0ab9e9b58e 100644 --- a/__fixtures__/v-next/outputv3/tendermint/types/evidence.ts +++ b/__fixtures__/v-next/outputv3/tendermint/types/evidence.ts @@ -2,6 +2,7 @@ import { Vote, VoteAmino, VoteSDKType, LightBlock, LightBlockAmino, LightBlockSD import { Timestamp, TimestampAmino, TimestampSDKType } from "../../google/protobuf/timestamp"; import { Validator, ValidatorAmino, ValidatorSDKType } from "./validator"; import { BinaryReader, BinaryWriter } from "../../binary"; +import { GlobalDecoderRegistry } from "../../registry"; import { isSet, DeepPartial, toTimestamp, fromTimestamp } from "../../helpers"; export const protobufPackage = "tendermint.types"; /** @@ -162,6 +163,15 @@ function createBaseEvidence(): Evidence { */ export const Evidence = { typeUrl: "/tendermint.types.Evidence", + is(o: any): o is Evidence { + return o && o.$typeUrl === Evidence.typeUrl; + }, + isSDK(o: any): o is EvidenceSDKType { + return o && o.$typeUrl === Evidence.typeUrl; + }, + isAmino(o: any): o is EvidenceAmino { + return o && o.$typeUrl === Evidence.typeUrl; + }, encode(message: Evidence, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.duplicateVoteEvidence !== undefined) { DuplicateVoteEvidence.encode(message.duplicateVoteEvidence, writer.uint32(10).fork()).ldelim(); @@ -246,6 +256,13 @@ export const Evidence = { typeUrl: "/tendermint.types.Evidence", value: Evidence.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Evidence.typeUrl)) { + return; + } + DuplicateVoteEvidence.registerTypeUrl(); + LightClientAttackEvidence.registerTypeUrl(); } }; function createBaseDuplicateVoteEvidence(): DuplicateVoteEvidence { @@ -265,6 +282,15 @@ function createBaseDuplicateVoteEvidence(): DuplicateVoteEvidence { */ export const DuplicateVoteEvidence = { typeUrl: "/tendermint.types.DuplicateVoteEvidence", + is(o: any): o is DuplicateVoteEvidence { + return o && (o.$typeUrl === DuplicateVoteEvidence.typeUrl || typeof o.totalVotingPower === "bigint" && typeof o.validatorPower === "bigint" && Timestamp.is(o.timestamp)); + }, + isSDK(o: any): o is DuplicateVoteEvidenceSDKType { + return o && (o.$typeUrl === DuplicateVoteEvidence.typeUrl || typeof o.total_voting_power === "bigint" && typeof o.validator_power === "bigint" && Timestamp.isSDK(o.timestamp)); + }, + isAmino(o: any): o is DuplicateVoteEvidenceAmino { + return o && (o.$typeUrl === DuplicateVoteEvidence.typeUrl || typeof o.total_voting_power === "bigint" && typeof o.validator_power === "bigint" && Timestamp.isAmino(o.timestamp)); + }, encode(message: DuplicateVoteEvidence, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.voteA !== undefined) { Vote.encode(message.voteA, writer.uint32(10).fork()).ldelim(); @@ -395,6 +421,12 @@ export const DuplicateVoteEvidence = { typeUrl: "/tendermint.types.DuplicateVoteEvidence", value: DuplicateVoteEvidence.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(DuplicateVoteEvidence.typeUrl)) { + return; + } + Vote.registerTypeUrl(); } }; function createBaseLightClientAttackEvidence(): LightClientAttackEvidence { @@ -414,6 +446,15 @@ function createBaseLightClientAttackEvidence(): LightClientAttackEvidence { */ export const LightClientAttackEvidence = { typeUrl: "/tendermint.types.LightClientAttackEvidence", + is(o: any): o is LightClientAttackEvidence { + return o && (o.$typeUrl === LightClientAttackEvidence.typeUrl || typeof o.commonHeight === "bigint" && Array.isArray(o.byzantineValidators) && (!o.byzantineValidators.length || Validator.is(o.byzantineValidators[0])) && typeof o.totalVotingPower === "bigint" && Timestamp.is(o.timestamp)); + }, + isSDK(o: any): o is LightClientAttackEvidenceSDKType { + return o && (o.$typeUrl === LightClientAttackEvidence.typeUrl || typeof o.common_height === "bigint" && Array.isArray(o.byzantine_validators) && (!o.byzantine_validators.length || Validator.isSDK(o.byzantine_validators[0])) && typeof o.total_voting_power === "bigint" && Timestamp.isSDK(o.timestamp)); + }, + isAmino(o: any): o is LightClientAttackEvidenceAmino { + return o && (o.$typeUrl === LightClientAttackEvidence.typeUrl || typeof o.common_height === "bigint" && Array.isArray(o.byzantine_validators) && (!o.byzantine_validators.length || Validator.isAmino(o.byzantine_validators[0])) && typeof o.total_voting_power === "bigint" && Timestamp.isAmino(o.timestamp)); + }, encode(message: LightClientAttackEvidence, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.conflictingBlock !== undefined) { LightBlock.encode(message.conflictingBlock, writer.uint32(10).fork()).ldelim(); @@ -548,6 +589,13 @@ export const LightClientAttackEvidence = { typeUrl: "/tendermint.types.LightClientAttackEvidence", value: LightClientAttackEvidence.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(LightClientAttackEvidence.typeUrl)) { + return; + } + LightBlock.registerTypeUrl(); + Validator.registerTypeUrl(); } }; function createBaseEvidenceList(): EvidenceList { @@ -562,6 +610,15 @@ function createBaseEvidenceList(): EvidenceList { */ export const EvidenceList = { typeUrl: "/tendermint.types.EvidenceList", + is(o: any): o is EvidenceList { + return o && (o.$typeUrl === EvidenceList.typeUrl || Array.isArray(o.evidence) && (!o.evidence.length || Evidence.is(o.evidence[0]))); + }, + isSDK(o: any): o is EvidenceListSDKType { + return o && (o.$typeUrl === EvidenceList.typeUrl || Array.isArray(o.evidence) && (!o.evidence.length || Evidence.isSDK(o.evidence[0]))); + }, + isAmino(o: any): o is EvidenceListAmino { + return o && (o.$typeUrl === EvidenceList.typeUrl || Array.isArray(o.evidence) && (!o.evidence.length || Evidence.isAmino(o.evidence[0]))); + }, encode(message: EvidenceList, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.evidence) { Evidence.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -634,5 +691,11 @@ export const EvidenceList = { typeUrl: "/tendermint.types.EvidenceList", value: EvidenceList.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(EvidenceList.typeUrl)) { + return; + } + Evidence.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/tendermint/types/params.ts b/__fixtures__/v-next/outputv3/tendermint/types/params.ts index d90344d373..2e02646ccd 100644 --- a/__fixtures__/v-next/outputv3/tendermint/types/params.ts +++ b/__fixtures__/v-next/outputv3/tendermint/types/params.ts @@ -1,5 +1,6 @@ import { Duration, DurationAmino, DurationSDKType } from "../../google/protobuf/duration"; import { BinaryReader, BinaryWriter } from "../../binary"; +import { GlobalDecoderRegistry } from "../../registry"; import { isSet, DeepPartial } from "../../helpers"; export const protobufPackage = "tendermint.types"; /** @@ -305,6 +306,15 @@ function createBaseConsensusParams(): ConsensusParams { */ export const ConsensusParams = { typeUrl: "/tendermint.types.ConsensusParams", + is(o: any): o is ConsensusParams { + return o && (o.$typeUrl === ConsensusParams.typeUrl || BlockParams.is(o.block) && EvidenceParams.is(o.evidence) && ValidatorParams.is(o.validator) && VersionParams.is(o.version)); + }, + isSDK(o: any): o is ConsensusParamsSDKType { + return o && (o.$typeUrl === ConsensusParams.typeUrl || BlockParams.isSDK(o.block) && EvidenceParams.isSDK(o.evidence) && ValidatorParams.isSDK(o.validator) && VersionParams.isSDK(o.version)); + }, + isAmino(o: any): o is ConsensusParamsAmino { + return o && (o.$typeUrl === ConsensusParams.typeUrl || BlockParams.isAmino(o.block) && EvidenceParams.isAmino(o.evidence) && ValidatorParams.isAmino(o.validator) && VersionParams.isAmino(o.version)); + }, encode(message: ConsensusParams, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.block !== undefined) { BlockParams.encode(message.block, writer.uint32(10).fork()).ldelim(); @@ -421,6 +431,15 @@ export const ConsensusParams = { typeUrl: "/tendermint.types.ConsensusParams", value: ConsensusParams.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ConsensusParams.typeUrl)) { + return; + } + BlockParams.registerTypeUrl(); + EvidenceParams.registerTypeUrl(); + ValidatorParams.registerTypeUrl(); + VersionParams.registerTypeUrl(); } }; function createBaseBlockParams(): BlockParams { @@ -438,6 +457,15 @@ function createBaseBlockParams(): BlockParams { */ export const BlockParams = { typeUrl: "/tendermint.types.BlockParams", + is(o: any): o is BlockParams { + return o && (o.$typeUrl === BlockParams.typeUrl || typeof o.maxBytes === "bigint" && typeof o.maxGas === "bigint" && typeof o.timeIotaMs === "bigint"); + }, + isSDK(o: any): o is BlockParamsSDKType { + return o && (o.$typeUrl === BlockParams.typeUrl || typeof o.max_bytes === "bigint" && typeof o.max_gas === "bigint" && typeof o.time_iota_ms === "bigint"); + }, + isAmino(o: any): o is BlockParamsAmino { + return o && (o.$typeUrl === BlockParams.typeUrl || typeof o.max_bytes === "bigint" && typeof o.max_gas === "bigint" && typeof o.time_iota_ms === "bigint"); + }, encode(message: BlockParams, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.maxBytes !== BigInt(0)) { writer.uint32(8).int64(message.maxBytes); @@ -538,7 +566,8 @@ export const BlockParams = { typeUrl: "/tendermint.types.BlockParams", value: BlockParams.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseEvidenceParams(): EvidenceParams { return { @@ -555,6 +584,15 @@ function createBaseEvidenceParams(): EvidenceParams { */ export const EvidenceParams = { typeUrl: "/tendermint.types.EvidenceParams", + is(o: any): o is EvidenceParams { + return o && (o.$typeUrl === EvidenceParams.typeUrl || typeof o.maxAgeNumBlocks === "bigint" && Duration.is(o.maxAgeDuration) && typeof o.maxBytes === "bigint"); + }, + isSDK(o: any): o is EvidenceParamsSDKType { + return o && (o.$typeUrl === EvidenceParams.typeUrl || typeof o.max_age_num_blocks === "bigint" && Duration.isSDK(o.max_age_duration) && typeof o.max_bytes === "bigint"); + }, + isAmino(o: any): o is EvidenceParamsAmino { + return o && (o.$typeUrl === EvidenceParams.typeUrl || typeof o.max_age_num_blocks === "bigint" && Duration.isAmino(o.max_age_duration) && typeof o.max_bytes === "bigint"); + }, encode(message: EvidenceParams, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.maxAgeNumBlocks !== BigInt(0)) { writer.uint32(8).int64(message.maxAgeNumBlocks); @@ -655,7 +693,8 @@ export const EvidenceParams = { typeUrl: "/tendermint.types.EvidenceParams", value: EvidenceParams.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseValidatorParams(): ValidatorParams { return { @@ -671,6 +710,15 @@ function createBaseValidatorParams(): ValidatorParams { */ export const ValidatorParams = { typeUrl: "/tendermint.types.ValidatorParams", + is(o: any): o is ValidatorParams { + return o && (o.$typeUrl === ValidatorParams.typeUrl || Array.isArray(o.pubKeyTypes) && (!o.pubKeyTypes.length || typeof o.pubKeyTypes[0] === "string")); + }, + isSDK(o: any): o is ValidatorParamsSDKType { + return o && (o.$typeUrl === ValidatorParams.typeUrl || Array.isArray(o.pub_key_types) && (!o.pub_key_types.length || typeof o.pub_key_types[0] === "string")); + }, + isAmino(o: any): o is ValidatorParamsAmino { + return o && (o.$typeUrl === ValidatorParams.typeUrl || Array.isArray(o.pub_key_types) && (!o.pub_key_types.length || typeof o.pub_key_types[0] === "string")); + }, encode(message: ValidatorParams, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.pubKeyTypes) { writer.uint32(10).string(v!); @@ -743,7 +791,8 @@ export const ValidatorParams = { typeUrl: "/tendermint.types.ValidatorParams", value: ValidatorParams.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseVersionParams(): VersionParams { return { @@ -758,6 +807,15 @@ function createBaseVersionParams(): VersionParams { */ export const VersionParams = { typeUrl: "/tendermint.types.VersionParams", + is(o: any): o is VersionParams { + return o && (o.$typeUrl === VersionParams.typeUrl || typeof o.appVersion === "bigint"); + }, + isSDK(o: any): o is VersionParamsSDKType { + return o && (o.$typeUrl === VersionParams.typeUrl || typeof o.app_version === "bigint"); + }, + isAmino(o: any): o is VersionParamsAmino { + return o && (o.$typeUrl === VersionParams.typeUrl || typeof o.app_version === "bigint"); + }, encode(message: VersionParams, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.appVersion !== BigInt(0)) { writer.uint32(8).uint64(message.appVersion); @@ -826,7 +884,8 @@ export const VersionParams = { typeUrl: "/tendermint.types.VersionParams", value: VersionParams.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseHashedParams(): HashedParams { return { @@ -844,6 +903,15 @@ function createBaseHashedParams(): HashedParams { */ export const HashedParams = { typeUrl: "/tendermint.types.HashedParams", + is(o: any): o is HashedParams { + return o && (o.$typeUrl === HashedParams.typeUrl || typeof o.blockMaxBytes === "bigint" && typeof o.blockMaxGas === "bigint"); + }, + isSDK(o: any): o is HashedParamsSDKType { + return o && (o.$typeUrl === HashedParams.typeUrl || typeof o.block_max_bytes === "bigint" && typeof o.block_max_gas === "bigint"); + }, + isAmino(o: any): o is HashedParamsAmino { + return o && (o.$typeUrl === HashedParams.typeUrl || typeof o.block_max_bytes === "bigint" && typeof o.block_max_gas === "bigint"); + }, encode(message: HashedParams, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.blockMaxBytes !== BigInt(0)) { writer.uint32(8).int64(message.blockMaxBytes); @@ -928,5 +996,6 @@ export const HashedParams = { typeUrl: "/tendermint.types.HashedParams", value: HashedParams.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/tendermint/types/types.ts b/__fixtures__/v-next/outputv3/tendermint/types/types.ts index 5ec6eacbc9..fd4175d129 100644 --- a/__fixtures__/v-next/outputv3/tendermint/types/types.ts +++ b/__fixtures__/v-next/outputv3/tendermint/types/types.ts @@ -4,6 +4,7 @@ import { Timestamp, TimestampAmino, TimestampSDKType } from "../../google/protob import { ValidatorSet, ValidatorSetAmino, ValidatorSetSDKType } from "./validator"; import { BinaryReader, BinaryWriter } from "../../binary"; import { isSet, bytesFromBase64, DeepPartial, base64FromBytes, toTimestamp, fromTimestamp } from "../../helpers"; +import { GlobalDecoderRegistry } from "../../registry"; export const protobufPackage = "tendermint.types"; /** BlockIdFlag indicates which BlcokID the signature is for */ export enum BlockIDFlag { @@ -713,6 +714,15 @@ function createBasePartSetHeader(): PartSetHeader { */ export const PartSetHeader = { typeUrl: "/tendermint.types.PartSetHeader", + is(o: any): o is PartSetHeader { + return o && (o.$typeUrl === PartSetHeader.typeUrl || typeof o.total === "number" && (o.hash instanceof Uint8Array || typeof o.hash === "string")); + }, + isSDK(o: any): o is PartSetHeaderSDKType { + return o && (o.$typeUrl === PartSetHeader.typeUrl || typeof o.total === "number" && (o.hash instanceof Uint8Array || typeof o.hash === "string")); + }, + isAmino(o: any): o is PartSetHeaderAmino { + return o && (o.$typeUrl === PartSetHeader.typeUrl || typeof o.total === "number" && (o.hash instanceof Uint8Array || typeof o.hash === "string")); + }, encode(message: PartSetHeader, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.total !== 0) { writer.uint32(8).uint32(message.total); @@ -793,7 +803,8 @@ export const PartSetHeader = { typeUrl: "/tendermint.types.PartSetHeader", value: PartSetHeader.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBasePart(): Part { return { @@ -809,6 +820,15 @@ function createBasePart(): Part { */ export const Part = { typeUrl: "/tendermint.types.Part", + is(o: any): o is Part { + return o && (o.$typeUrl === Part.typeUrl || typeof o.index === "number" && (o.bytes instanceof Uint8Array || typeof o.bytes === "string") && Proof.is(o.proof)); + }, + isSDK(o: any): o is PartSDKType { + return o && (o.$typeUrl === Part.typeUrl || typeof o.index === "number" && (o.bytes instanceof Uint8Array || typeof o.bytes === "string") && Proof.isSDK(o.proof)); + }, + isAmino(o: any): o is PartAmino { + return o && (o.$typeUrl === Part.typeUrl || typeof o.index === "number" && (o.bytes instanceof Uint8Array || typeof o.bytes === "string") && Proof.isAmino(o.proof)); + }, encode(message: Part, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.index !== 0) { writer.uint32(8).uint32(message.index); @@ -905,6 +925,12 @@ export const Part = { typeUrl: "/tendermint.types.Part", value: Part.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Part.typeUrl)) { + return; + } + Proof.registerTypeUrl(); } }; function createBaseBlockID(): BlockID { @@ -921,6 +947,15 @@ function createBaseBlockID(): BlockID { */ export const BlockID = { typeUrl: "/tendermint.types.BlockID", + is(o: any): o is BlockID { + return o && (o.$typeUrl === BlockID.typeUrl || (o.hash instanceof Uint8Array || typeof o.hash === "string") && PartSetHeader.is(o.partSetHeader)); + }, + isSDK(o: any): o is BlockIDSDKType { + return o && (o.$typeUrl === BlockID.typeUrl || (o.hash instanceof Uint8Array || typeof o.hash === "string") && PartSetHeader.isSDK(o.part_set_header)); + }, + isAmino(o: any): o is BlockIDAmino { + return o && (o.$typeUrl === BlockID.typeUrl || (o.hash instanceof Uint8Array || typeof o.hash === "string") && PartSetHeader.isAmino(o.part_set_header)); + }, encode(message: BlockID, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.hash.length !== 0) { writer.uint32(10).bytes(message.hash); @@ -1003,6 +1038,12 @@ export const BlockID = { typeUrl: "/tendermint.types.BlockID", value: BlockID.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(BlockID.typeUrl)) { + return; + } + PartSetHeader.registerTypeUrl(); } }; function createBaseHeader(): Header { @@ -1031,6 +1072,15 @@ function createBaseHeader(): Header { */ export const Header = { typeUrl: "/tendermint.types.Header", + is(o: any): o is Header { + return o && (o.$typeUrl === Header.typeUrl || Consensus.is(o.version) && typeof o.chainId === "string" && typeof o.height === "bigint" && Timestamp.is(o.time) && BlockID.is(o.lastBlockId) && (o.lastCommitHash instanceof Uint8Array || typeof o.lastCommitHash === "string") && (o.dataHash instanceof Uint8Array || typeof o.dataHash === "string") && (o.validatorsHash instanceof Uint8Array || typeof o.validatorsHash === "string") && (o.nextValidatorsHash instanceof Uint8Array || typeof o.nextValidatorsHash === "string") && (o.consensusHash instanceof Uint8Array || typeof o.consensusHash === "string") && (o.appHash instanceof Uint8Array || typeof o.appHash === "string") && (o.lastResultsHash instanceof Uint8Array || typeof o.lastResultsHash === "string") && (o.evidenceHash instanceof Uint8Array || typeof o.evidenceHash === "string") && (o.proposerAddress instanceof Uint8Array || typeof o.proposerAddress === "string")); + }, + isSDK(o: any): o is HeaderSDKType { + return o && (o.$typeUrl === Header.typeUrl || Consensus.isSDK(o.version) && typeof o.chain_id === "string" && typeof o.height === "bigint" && Timestamp.isSDK(o.time) && BlockID.isSDK(o.last_block_id) && (o.last_commit_hash instanceof Uint8Array || typeof o.last_commit_hash === "string") && (o.data_hash instanceof Uint8Array || typeof o.data_hash === "string") && (o.validators_hash instanceof Uint8Array || typeof o.validators_hash === "string") && (o.next_validators_hash instanceof Uint8Array || typeof o.next_validators_hash === "string") && (o.consensus_hash instanceof Uint8Array || typeof o.consensus_hash === "string") && (o.app_hash instanceof Uint8Array || typeof o.app_hash === "string") && (o.last_results_hash instanceof Uint8Array || typeof o.last_results_hash === "string") && (o.evidence_hash instanceof Uint8Array || typeof o.evidence_hash === "string") && (o.proposer_address instanceof Uint8Array || typeof o.proposer_address === "string")); + }, + isAmino(o: any): o is HeaderAmino { + return o && (o.$typeUrl === Header.typeUrl || Consensus.isAmino(o.version) && typeof o.chain_id === "string" && typeof o.height === "bigint" && Timestamp.isAmino(o.time) && BlockID.isAmino(o.last_block_id) && (o.last_commit_hash instanceof Uint8Array || typeof o.last_commit_hash === "string") && (o.data_hash instanceof Uint8Array || typeof o.data_hash === "string") && (o.validators_hash instanceof Uint8Array || typeof o.validators_hash === "string") && (o.next_validators_hash instanceof Uint8Array || typeof o.next_validators_hash === "string") && (o.consensus_hash instanceof Uint8Array || typeof o.consensus_hash === "string") && (o.app_hash instanceof Uint8Array || typeof o.app_hash === "string") && (o.last_results_hash instanceof Uint8Array || typeof o.last_results_hash === "string") && (o.evidence_hash instanceof Uint8Array || typeof o.evidence_hash === "string") && (o.proposer_address instanceof Uint8Array || typeof o.proposer_address === "string")); + }, encode(message: Header, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.version !== undefined) { Consensus.encode(message.version, writer.uint32(10).fork()).ldelim(); @@ -1285,6 +1335,13 @@ export const Header = { typeUrl: "/tendermint.types.Header", value: Header.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Header.typeUrl)) { + return; + } + Consensus.registerTypeUrl(); + BlockID.registerTypeUrl(); } }; function createBaseData(): Data { @@ -1300,6 +1357,15 @@ function createBaseData(): Data { */ export const Data = { typeUrl: "/tendermint.types.Data", + is(o: any): o is Data { + return o && (o.$typeUrl === Data.typeUrl || Array.isArray(o.txs) && (!o.txs.length || o.txs[0] instanceof Uint8Array || typeof o.txs[0] === "string")); + }, + isSDK(o: any): o is DataSDKType { + return o && (o.$typeUrl === Data.typeUrl || Array.isArray(o.txs) && (!o.txs.length || o.txs[0] instanceof Uint8Array || typeof o.txs[0] === "string")); + }, + isAmino(o: any): o is DataAmino { + return o && (o.$typeUrl === Data.typeUrl || Array.isArray(o.txs) && (!o.txs.length || o.txs[0] instanceof Uint8Array || typeof o.txs[0] === "string")); + }, encode(message: Data, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.txs) { writer.uint32(10).bytes(v!); @@ -1372,7 +1438,8 @@ export const Data = { typeUrl: "/tendermint.types.Data", value: Data.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseVote(): Vote { return { @@ -1395,6 +1462,15 @@ function createBaseVote(): Vote { */ export const Vote = { typeUrl: "/tendermint.types.Vote", + is(o: any): o is Vote { + return o && (o.$typeUrl === Vote.typeUrl || isSet(o.type) && typeof o.height === "bigint" && typeof o.round === "number" && BlockID.is(o.blockId) && Timestamp.is(o.timestamp) && (o.validatorAddress instanceof Uint8Array || typeof o.validatorAddress === "string") && typeof o.validatorIndex === "number" && (o.signature instanceof Uint8Array || typeof o.signature === "string")); + }, + isSDK(o: any): o is VoteSDKType { + return o && (o.$typeUrl === Vote.typeUrl || isSet(o.type) && typeof o.height === "bigint" && typeof o.round === "number" && BlockID.isSDK(o.block_id) && Timestamp.isSDK(o.timestamp) && (o.validator_address instanceof Uint8Array || typeof o.validator_address === "string") && typeof o.validator_index === "number" && (o.signature instanceof Uint8Array || typeof o.signature === "string")); + }, + isAmino(o: any): o is VoteAmino { + return o && (o.$typeUrl === Vote.typeUrl || isSet(o.type) && typeof o.height === "bigint" && typeof o.round === "number" && BlockID.isAmino(o.block_id) && Timestamp.isAmino(o.timestamp) && (o.validator_address instanceof Uint8Array || typeof o.validator_address === "string") && typeof o.validator_index === "number" && (o.signature instanceof Uint8Array || typeof o.signature === "string")); + }, encode(message: Vote, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.type !== 0) { writer.uint32(8).int32(message.type); @@ -1563,6 +1639,12 @@ export const Vote = { typeUrl: "/tendermint.types.Vote", value: Vote.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Vote.typeUrl)) { + return; + } + BlockID.registerTypeUrl(); } }; function createBaseCommit(): Commit { @@ -1581,6 +1663,15 @@ function createBaseCommit(): Commit { */ export const Commit = { typeUrl: "/tendermint.types.Commit", + is(o: any): o is Commit { + return o && (o.$typeUrl === Commit.typeUrl || typeof o.height === "bigint" && typeof o.round === "number" && BlockID.is(o.blockId) && Array.isArray(o.signatures) && (!o.signatures.length || CommitSig.is(o.signatures[0]))); + }, + isSDK(o: any): o is CommitSDKType { + return o && (o.$typeUrl === Commit.typeUrl || typeof o.height === "bigint" && typeof o.round === "number" && BlockID.isSDK(o.block_id) && Array.isArray(o.signatures) && (!o.signatures.length || CommitSig.isSDK(o.signatures[0]))); + }, + isAmino(o: any): o is CommitAmino { + return o && (o.$typeUrl === Commit.typeUrl || typeof o.height === "bigint" && typeof o.round === "number" && BlockID.isAmino(o.block_id) && Array.isArray(o.signatures) && (!o.signatures.length || CommitSig.isAmino(o.signatures[0]))); + }, encode(message: Commit, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.height !== BigInt(0)) { writer.uint32(8).int64(message.height); @@ -1699,6 +1790,13 @@ export const Commit = { typeUrl: "/tendermint.types.Commit", value: Commit.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Commit.typeUrl)) { + return; + } + BlockID.registerTypeUrl(); + CommitSig.registerTypeUrl(); } }; function createBaseCommitSig(): CommitSig { @@ -1717,6 +1815,15 @@ function createBaseCommitSig(): CommitSig { */ export const CommitSig = { typeUrl: "/tendermint.types.CommitSig", + is(o: any): o is CommitSig { + return o && (o.$typeUrl === CommitSig.typeUrl || isSet(o.blockIdFlag) && (o.validatorAddress instanceof Uint8Array || typeof o.validatorAddress === "string") && Timestamp.is(o.timestamp) && (o.signature instanceof Uint8Array || typeof o.signature === "string")); + }, + isSDK(o: any): o is CommitSigSDKType { + return o && (o.$typeUrl === CommitSig.typeUrl || isSet(o.block_id_flag) && (o.validator_address instanceof Uint8Array || typeof o.validator_address === "string") && Timestamp.isSDK(o.timestamp) && (o.signature instanceof Uint8Array || typeof o.signature === "string")); + }, + isAmino(o: any): o is CommitSigAmino { + return o && (o.$typeUrl === CommitSig.typeUrl || isSet(o.block_id_flag) && (o.validator_address instanceof Uint8Array || typeof o.validator_address === "string") && Timestamp.isAmino(o.timestamp) && (o.signature instanceof Uint8Array || typeof o.signature === "string")); + }, encode(message: CommitSig, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.blockIdFlag !== 0) { writer.uint32(8).int32(message.blockIdFlag); @@ -1825,7 +1932,8 @@ export const CommitSig = { typeUrl: "/tendermint.types.CommitSig", value: CommitSig.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseProposal(): Proposal { return { @@ -1845,6 +1953,15 @@ function createBaseProposal(): Proposal { */ export const Proposal = { typeUrl: "/tendermint.types.Proposal", + is(o: any): o is Proposal { + return o && (o.$typeUrl === Proposal.typeUrl || isSet(o.type) && typeof o.height === "bigint" && typeof o.round === "number" && typeof o.polRound === "number" && BlockID.is(o.blockId) && Timestamp.is(o.timestamp) && (o.signature instanceof Uint8Array || typeof o.signature === "string")); + }, + isSDK(o: any): o is ProposalSDKType { + return o && (o.$typeUrl === Proposal.typeUrl || isSet(o.type) && typeof o.height === "bigint" && typeof o.round === "number" && typeof o.pol_round === "number" && BlockID.isSDK(o.block_id) && Timestamp.isSDK(o.timestamp) && (o.signature instanceof Uint8Array || typeof o.signature === "string")); + }, + isAmino(o: any): o is ProposalAmino { + return o && (o.$typeUrl === Proposal.typeUrl || isSet(o.type) && typeof o.height === "bigint" && typeof o.round === "number" && typeof o.pol_round === "number" && BlockID.isAmino(o.block_id) && Timestamp.isAmino(o.timestamp) && (o.signature instanceof Uint8Array || typeof o.signature === "string")); + }, encode(message: Proposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.type !== 0) { writer.uint32(8).int32(message.type); @@ -1999,6 +2116,12 @@ export const Proposal = { typeUrl: "/tendermint.types.Proposal", value: Proposal.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Proposal.typeUrl)) { + return; + } + BlockID.registerTypeUrl(); } }; function createBaseSignedHeader(): SignedHeader { @@ -2014,6 +2137,15 @@ function createBaseSignedHeader(): SignedHeader { */ export const SignedHeader = { typeUrl: "/tendermint.types.SignedHeader", + is(o: any): o is SignedHeader { + return o && o.$typeUrl === SignedHeader.typeUrl; + }, + isSDK(o: any): o is SignedHeaderSDKType { + return o && o.$typeUrl === SignedHeader.typeUrl; + }, + isAmino(o: any): o is SignedHeaderAmino { + return o && o.$typeUrl === SignedHeader.typeUrl; + }, encode(message: SignedHeader, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.header !== undefined) { Header.encode(message.header, writer.uint32(10).fork()).ldelim(); @@ -2098,6 +2230,13 @@ export const SignedHeader = { typeUrl: "/tendermint.types.SignedHeader", value: SignedHeader.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(SignedHeader.typeUrl)) { + return; + } + Header.registerTypeUrl(); + Commit.registerTypeUrl(); } }; function createBaseLightBlock(): LightBlock { @@ -2113,6 +2252,15 @@ function createBaseLightBlock(): LightBlock { */ export const LightBlock = { typeUrl: "/tendermint.types.LightBlock", + is(o: any): o is LightBlock { + return o && o.$typeUrl === LightBlock.typeUrl; + }, + isSDK(o: any): o is LightBlockSDKType { + return o && o.$typeUrl === LightBlock.typeUrl; + }, + isAmino(o: any): o is LightBlockAmino { + return o && o.$typeUrl === LightBlock.typeUrl; + }, encode(message: LightBlock, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.signedHeader !== undefined) { SignedHeader.encode(message.signedHeader, writer.uint32(10).fork()).ldelim(); @@ -2197,6 +2345,13 @@ export const LightBlock = { typeUrl: "/tendermint.types.LightBlock", value: LightBlock.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(LightBlock.typeUrl)) { + return; + } + SignedHeader.registerTypeUrl(); + ValidatorSet.registerTypeUrl(); } }; function createBaseBlockMeta(): BlockMeta { @@ -2214,6 +2369,15 @@ function createBaseBlockMeta(): BlockMeta { */ export const BlockMeta = { typeUrl: "/tendermint.types.BlockMeta", + is(o: any): o is BlockMeta { + return o && (o.$typeUrl === BlockMeta.typeUrl || BlockID.is(o.blockId) && typeof o.blockSize === "bigint" && Header.is(o.header) && typeof o.numTxs === "bigint"); + }, + isSDK(o: any): o is BlockMetaSDKType { + return o && (o.$typeUrl === BlockMeta.typeUrl || BlockID.isSDK(o.block_id) && typeof o.block_size === "bigint" && Header.isSDK(o.header) && typeof o.num_txs === "bigint"); + }, + isAmino(o: any): o is BlockMetaAmino { + return o && (o.$typeUrl === BlockMeta.typeUrl || BlockID.isAmino(o.block_id) && typeof o.block_size === "bigint" && Header.isAmino(o.header) && typeof o.num_txs === "bigint"); + }, encode(message: BlockMeta, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.blockId !== undefined) { BlockID.encode(message.blockId, writer.uint32(10).fork()).ldelim(); @@ -2330,6 +2494,13 @@ export const BlockMeta = { typeUrl: "/tendermint.types.BlockMeta", value: BlockMeta.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(BlockMeta.typeUrl)) { + return; + } + BlockID.registerTypeUrl(); + Header.registerTypeUrl(); } }; function createBaseTxProof(): TxProof { @@ -2347,6 +2518,15 @@ function createBaseTxProof(): TxProof { */ export const TxProof = { typeUrl: "/tendermint.types.TxProof", + is(o: any): o is TxProof { + return o && (o.$typeUrl === TxProof.typeUrl || (o.rootHash instanceof Uint8Array || typeof o.rootHash === "string") && (o.data instanceof Uint8Array || typeof o.data === "string")); + }, + isSDK(o: any): o is TxProofSDKType { + return o && (o.$typeUrl === TxProof.typeUrl || (o.root_hash instanceof Uint8Array || typeof o.root_hash === "string") && (o.data instanceof Uint8Array || typeof o.data === "string")); + }, + isAmino(o: any): o is TxProofAmino { + return o && (o.$typeUrl === TxProof.typeUrl || (o.root_hash instanceof Uint8Array || typeof o.root_hash === "string") && (o.data instanceof Uint8Array || typeof o.data === "string")); + }, encode(message: TxProof, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.rootHash.length !== 0) { writer.uint32(10).bytes(message.rootHash); @@ -2443,5 +2623,11 @@ export const TxProof = { typeUrl: "/tendermint.types.TxProof", value: TxProof.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(TxProof.typeUrl)) { + return; + } + Proof.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/tendermint/types/validator.ts b/__fixtures__/v-next/outputv3/tendermint/types/validator.ts index 6f1066e46d..b234694ce3 100644 --- a/__fixtures__/v-next/outputv3/tendermint/types/validator.ts +++ b/__fixtures__/v-next/outputv3/tendermint/types/validator.ts @@ -1,5 +1,6 @@ import { PublicKey, PublicKeyAmino, PublicKeySDKType } from "../crypto/keys"; import { BinaryReader, BinaryWriter } from "../../binary"; +import { GlobalDecoderRegistry } from "../../registry"; import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../helpers"; export const protobufPackage = "tendermint.types"; /** @@ -118,6 +119,15 @@ function createBaseValidatorSet(): ValidatorSet { */ export const ValidatorSet = { typeUrl: "/tendermint.types.ValidatorSet", + is(o: any): o is ValidatorSet { + return o && (o.$typeUrl === ValidatorSet.typeUrl || Array.isArray(o.validators) && (!o.validators.length || Validator.is(o.validators[0])) && typeof o.totalVotingPower === "bigint"); + }, + isSDK(o: any): o is ValidatorSetSDKType { + return o && (o.$typeUrl === ValidatorSet.typeUrl || Array.isArray(o.validators) && (!o.validators.length || Validator.isSDK(o.validators[0])) && typeof o.total_voting_power === "bigint"); + }, + isAmino(o: any): o is ValidatorSetAmino { + return o && (o.$typeUrl === ValidatorSet.typeUrl || Array.isArray(o.validators) && (!o.validators.length || Validator.isAmino(o.validators[0])) && typeof o.total_voting_power === "bigint"); + }, encode(message: ValidatorSet, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.validators) { Validator.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -222,6 +232,12 @@ export const ValidatorSet = { typeUrl: "/tendermint.types.ValidatorSet", value: ValidatorSet.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ValidatorSet.typeUrl)) { + return; + } + Validator.registerTypeUrl(); } }; function createBaseValidator(): Validator { @@ -239,6 +255,15 @@ function createBaseValidator(): Validator { */ export const Validator = { typeUrl: "/tendermint.types.Validator", + is(o: any): o is Validator { + return o && (o.$typeUrl === Validator.typeUrl || (o.address instanceof Uint8Array || typeof o.address === "string") && PublicKey.is(o.pubKey) && typeof o.votingPower === "bigint" && typeof o.proposerPriority === "bigint"); + }, + isSDK(o: any): o is ValidatorSDKType { + return o && (o.$typeUrl === Validator.typeUrl || (o.address instanceof Uint8Array || typeof o.address === "string") && PublicKey.isSDK(o.pub_key) && typeof o.voting_power === "bigint" && typeof o.proposer_priority === "bigint"); + }, + isAmino(o: any): o is ValidatorAmino { + return o && (o.$typeUrl === Validator.typeUrl || (o.address instanceof Uint8Array || typeof o.address === "string") && PublicKey.isAmino(o.pub_key) && typeof o.voting_power === "bigint" && typeof o.proposer_priority === "bigint"); + }, encode(message: Validator, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.address.length !== 0) { writer.uint32(10).bytes(message.address); @@ -353,6 +378,12 @@ export const Validator = { typeUrl: "/tendermint.types.Validator", value: Validator.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Validator.typeUrl)) { + return; + } + PublicKey.registerTypeUrl(); } }; function createBaseSimpleValidator(): SimpleValidator { @@ -368,6 +399,15 @@ function createBaseSimpleValidator(): SimpleValidator { */ export const SimpleValidator = { typeUrl: "/tendermint.types.SimpleValidator", + is(o: any): o is SimpleValidator { + return o && (o.$typeUrl === SimpleValidator.typeUrl || typeof o.votingPower === "bigint"); + }, + isSDK(o: any): o is SimpleValidatorSDKType { + return o && (o.$typeUrl === SimpleValidator.typeUrl || typeof o.voting_power === "bigint"); + }, + isAmino(o: any): o is SimpleValidatorAmino { + return o && (o.$typeUrl === SimpleValidator.typeUrl || typeof o.voting_power === "bigint"); + }, encode(message: SimpleValidator, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.pubKey !== undefined) { PublicKey.encode(message.pubKey, writer.uint32(10).fork()).ldelim(); @@ -452,5 +492,11 @@ export const SimpleValidator = { typeUrl: "/tendermint.types.SimpleValidator", value: SimpleValidator.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(SimpleValidator.typeUrl)) { + return; + } + PublicKey.registerTypeUrl(); } }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/tendermint/version/types.ts b/__fixtures__/v-next/outputv3/tendermint/version/types.ts index b6bd1ff4a6..4cf7277b83 100644 --- a/__fixtures__/v-next/outputv3/tendermint/version/types.ts +++ b/__fixtures__/v-next/outputv3/tendermint/version/types.ts @@ -97,6 +97,15 @@ function createBaseApp(): App { */ export const App = { typeUrl: "/tendermint.version.App", + is(o: any): o is App { + return o && (o.$typeUrl === App.typeUrl || typeof o.protocol === "bigint" && typeof o.software === "string"); + }, + isSDK(o: any): o is AppSDKType { + return o && (o.$typeUrl === App.typeUrl || typeof o.protocol === "bigint" && typeof o.software === "string"); + }, + isAmino(o: any): o is AppAmino { + return o && (o.$typeUrl === App.typeUrl || typeof o.protocol === "bigint" && typeof o.software === "string"); + }, encode(message: App, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.protocol !== BigInt(0)) { writer.uint32(8).uint64(message.protocol); @@ -179,7 +188,8 @@ export const App = { typeUrl: "/tendermint.version.App", value: App.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; function createBaseConsensus(): Consensus { return { @@ -197,6 +207,15 @@ function createBaseConsensus(): Consensus { */ export const Consensus = { typeUrl: "/tendermint.version.Consensus", + is(o: any): o is Consensus { + return o && (o.$typeUrl === Consensus.typeUrl || typeof o.block === "bigint" && typeof o.app === "bigint"); + }, + isSDK(o: any): o is ConsensusSDKType { + return o && (o.$typeUrl === Consensus.typeUrl || typeof o.block === "bigint" && typeof o.app === "bigint"); + }, + isAmino(o: any): o is ConsensusAmino { + return o && (o.$typeUrl === Consensus.typeUrl || typeof o.block === "bigint" && typeof o.app === "bigint"); + }, encode(message: Consensus, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.block !== BigInt(0)) { writer.uint32(8).uint64(message.block); @@ -281,5 +300,6 @@ export const Consensus = { typeUrl: "/tendermint.version.Consensus", value: Consensus.encode(message).finish() }; - } + }, + registerTypeUrl() {} }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv3/types.ts b/__fixtures__/v-next/outputv3/types.ts new file mode 100644 index 0000000000..1acee677e2 --- /dev/null +++ b/__fixtures__/v-next/outputv3/types.ts @@ -0,0 +1,109 @@ +/** +* This file and any referenced files were automatically generated by @hyperweb/telescope@latest +* DO NOT MODIFY BY HAND. Instead, download the latest proto files for your chain +* and run the transpile command or npm scripts command that is used to regenerate this bundle. +*/ + +import { IBinaryReader, IBinaryWriter } from "./binary"; +import { Any } from "./google/protobuf/any"; + +import { HttpEndpoint } from "@interchainjs/types"; + + +import { DeliverTxResponse, Event, Attribute } from "@interchainjs/types"; + +export { DeliverTxResponse } + + +export type ProtoMsg = Omit & { typeUrl: any }; + +export interface IAminoMsg { + type: any; + value: Amino; +} + +export interface IProtoType { + $typeUrl?: any; +} + +/** + * A type generated by Telescope 1.0. + */ +export interface TelescopeGeneratedCodec< + T = unknown, + SDK = unknown, + Amino = unknown +> { + readonly typeUrl: string; + readonly aminoType?: string; + is?(o: unknown): o is T; + isSDK?(o: unknown): o is SDK; + isAmino?(o: unknown): o is Amino; + encode: (message: T, writer?: IBinaryWriter | any) => IBinaryWriter | any; + decode: (input: IBinaryReader | Uint8Array | any, length?: number) => T; + fromPartial: (object: any) => T | any; + fromJSON?: (object: any) => T | any; + toJSON?: (message: T | any) => any; + fromSDK?: (sdk: SDK) => T; + fromSDKJSON?: (object: any) => SDK; + toSDK?: (message: T) => SDK; + fromAmino?: (amino: Amino) => T; + toAmino?: (message: T) => Amino; + fromAminoMsg?: (aminoMsg: IAminoMsg) => T; + toAminoMsg?: (message: T) => IAminoMsg; + toProto?: (message: T) => Uint8Array; + fromProtoMsg?: (message: ProtoMsg) => T; + toProtoMsg?: (message: T) => Any; + registerTypeUrl?: () => void; +} + +export type TelescopeGeneratedType< + T = unknown, + SDK = unknown, + Amino = unknown +> = TelescopeGeneratedCodec; + +export type GeneratedType = TelescopeGeneratedCodec; + +/** + * Coin defines a token with a denomination and an amount. + * + * NOTE: The amount field is an Int which implements the custom method + * signatures required by gogoproto. + */ +interface Coin { + denom: string; + amount: string; +} + +export type EncodeObject = Message; + +export interface Message { + typeUrl: string; + value: T; +} + +export interface StdFee { + amount: Coin[]; + gas: string; + /** The granter address that is used for paying with feegrants */ + granter?: string; + /** The fee payer address. The payer must have signed the transaction. */ + payer?: string; +} + + +export interface TxRpc { + request( + service: string, + method: string, + data: Uint8Array + ): Promise; + signAndBroadcast?( + signerAddress: string, + messages: EncodeObject[], + fee: StdFee | "auto" | number, + memo: string + ): Promise; +} + diff --git a/__fixtures__/v-next/outputv4/akash/audit/v1beta1/audit.registry.ts b/__fixtures__/v-next/outputv4/akash/audit/v1beta1/audit.registry.ts index 1a0849c6f1..50a5259e27 100644 --- a/__fixtures__/v-next/outputv4/akash/audit/v1beta1/audit.registry.ts +++ b/__fixtures__/v-next/outputv4/akash/audit/v1beta1/audit.registry.ts @@ -1,12 +1,7 @@ import { Attribute, AttributeSDKType } from "../../base/v1beta1/attribute.js"; -import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { TelescopeGeneratedType } from "../../../types.js"; import { MsgSignProviderAttributes, MsgSignProviderAttributesSDKType, MsgDeleteProviderAttributes, MsgDeleteProviderAttributesSDKType } from "./audit.js"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/akash.audit.v1beta1.MsgSignProviderAttributes", MsgSignProviderAttributes], ["/akash.audit.v1beta1.MsgDeleteProviderAttributes", MsgDeleteProviderAttributes]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/akash.audit.v1beta1.MsgSignProviderAttributes", MsgSignProviderAttributes], ["/akash.audit.v1beta1.MsgDeleteProviderAttributes", MsgDeleteProviderAttributes]]; export const MessageComposer = { encoded: { signProviderAttributes(value: MsgSignProviderAttributes) { diff --git a/__fixtures__/v-next/outputv4/akash/audit/v1beta1/audit.rpc.func.ts b/__fixtures__/v-next/outputv4/akash/audit/v1beta1/audit.rpc.func.ts new file mode 100644 index 0000000000..11c9d644ce --- /dev/null +++ b/__fixtures__/v-next/outputv4/akash/audit/v1beta1/audit.rpc.func.ts @@ -0,0 +1,21 @@ +import { Attribute, AttributeSDKType } from "../../base/v1beta1/attribute.js"; +import { buildTx } from "../../../helper-func-types.js"; +import { MsgSignProviderAttributes, MsgSignProviderAttributesSDKType, MsgSignProviderAttributesResponse, MsgSignProviderAttributesResponseSDKType, MsgDeleteProviderAttributes, MsgDeleteProviderAttributesSDKType, MsgDeleteProviderAttributesResponse, MsgDeleteProviderAttributesResponseSDKType } from "./audit.js"; +/** + * SignProviderAttributes defines a method that signs provider attributes + * @name signProviderAttributes + * @package akash.audit.v1beta1 + * @see proto service: akash.audit.v1beta1.SignProviderAttributes + */ +export const signProviderAttributes = buildTx({ + msg: MsgSignProviderAttributes +}); +/** + * DeleteProviderAttributes defines a method that deletes provider attributes + * @name deleteProviderAttributes + * @package akash.audit.v1beta1 + * @see proto service: akash.audit.v1beta1.DeleteProviderAttributes + */ +export const deleteProviderAttributes = buildTx({ + msg: MsgDeleteProviderAttributes +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/akash/audit/v1beta1/audit.rpc.msg.ts b/__fixtures__/v-next/outputv4/akash/audit/v1beta1/audit.rpc.msg.ts index b48344533a..2a1fbb7dd5 100644 --- a/__fixtures__/v-next/outputv4/akash/audit/v1beta1/audit.rpc.msg.ts +++ b/__fixtures__/v-next/outputv4/akash/audit/v1beta1/audit.rpc.msg.ts @@ -1,5 +1,5 @@ import { Attribute, AttributeSDKType } from "../../base/v1beta1/attribute.js"; -import { Rpc } from "../../../helpers.js"; +import { TxRpc } from "../../../types.js"; import { BinaryReader } from "../../../binary.js"; import { MsgSignProviderAttributes, MsgSignProviderAttributesSDKType, MsgSignProviderAttributesResponse, MsgSignProviderAttributesResponseSDKType, MsgDeleteProviderAttributes, MsgDeleteProviderAttributesSDKType, MsgDeleteProviderAttributesResponse, MsgDeleteProviderAttributesResponseSDKType } from "./audit.js"; /** Msg defines the provider Msg service */ @@ -10,8 +10,8 @@ export interface Msg { deleteProviderAttributes(request: MsgDeleteProviderAttributes): Promise; } export class MsgClientImpl implements Msg { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; } /* SignProviderAttributes defines a method that signs provider attributes */ @@ -27,6 +27,6 @@ export class MsgClientImpl implements Msg { return promise.then(data => MsgDeleteProviderAttributesResponse.decode(new BinaryReader(data))); }; } -export const createClientImpl = (rpc: Rpc) => { +export const createClientImpl = (rpc: TxRpc) => { return new MsgClientImpl(rpc); }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/akash/audit/v1beta2/audit.registry.ts b/__fixtures__/v-next/outputv4/akash/audit/v1beta2/audit.registry.ts index c0c62a8f7d..b24e1c232c 100644 --- a/__fixtures__/v-next/outputv4/akash/audit/v1beta2/audit.registry.ts +++ b/__fixtures__/v-next/outputv4/akash/audit/v1beta2/audit.registry.ts @@ -1,12 +1,7 @@ import { Attribute, AttributeSDKType } from "../../base/v1beta2/attribute.js"; -import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { TelescopeGeneratedType } from "../../../types.js"; import { MsgSignProviderAttributes, MsgSignProviderAttributesSDKType, MsgDeleteProviderAttributes, MsgDeleteProviderAttributesSDKType } from "./audit.js"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/akash.audit.v1beta2.MsgSignProviderAttributes", MsgSignProviderAttributes], ["/akash.audit.v1beta2.MsgDeleteProviderAttributes", MsgDeleteProviderAttributes]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/akash.audit.v1beta2.MsgSignProviderAttributes", MsgSignProviderAttributes], ["/akash.audit.v1beta2.MsgDeleteProviderAttributes", MsgDeleteProviderAttributes]]; export const MessageComposer = { encoded: { signProviderAttributes(value: MsgSignProviderAttributes) { diff --git a/__fixtures__/v-next/outputv4/akash/audit/v1beta2/audit.rpc.func.ts b/__fixtures__/v-next/outputv4/akash/audit/v1beta2/audit.rpc.func.ts new file mode 100644 index 0000000000..a1e6fdf2ef --- /dev/null +++ b/__fixtures__/v-next/outputv4/akash/audit/v1beta2/audit.rpc.func.ts @@ -0,0 +1,21 @@ +import { Attribute, AttributeSDKType } from "../../base/v1beta2/attribute.js"; +import { buildTx } from "../../../helper-func-types.js"; +import { MsgSignProviderAttributes, MsgSignProviderAttributesSDKType, MsgSignProviderAttributesResponse, MsgSignProviderAttributesResponseSDKType, MsgDeleteProviderAttributes, MsgDeleteProviderAttributesSDKType, MsgDeleteProviderAttributesResponse, MsgDeleteProviderAttributesResponseSDKType } from "./audit.js"; +/** + * SignProviderAttributes defines a method that signs provider attributes + * @name signProviderAttributes + * @package akash.audit.v1beta2 + * @see proto service: akash.audit.v1beta2.SignProviderAttributes + */ +export const signProviderAttributes = buildTx({ + msg: MsgSignProviderAttributes +}); +/** + * DeleteProviderAttributes defines a method that deletes provider attributes + * @name deleteProviderAttributes + * @package akash.audit.v1beta2 + * @see proto service: akash.audit.v1beta2.DeleteProviderAttributes + */ +export const deleteProviderAttributes = buildTx({ + msg: MsgDeleteProviderAttributes +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/akash/audit/v1beta2/audit.rpc.msg.ts b/__fixtures__/v-next/outputv4/akash/audit/v1beta2/audit.rpc.msg.ts index d7ebc0a0ab..76f16fd8a0 100644 --- a/__fixtures__/v-next/outputv4/akash/audit/v1beta2/audit.rpc.msg.ts +++ b/__fixtures__/v-next/outputv4/akash/audit/v1beta2/audit.rpc.msg.ts @@ -1,5 +1,5 @@ import { Attribute, AttributeSDKType } from "../../base/v1beta2/attribute.js"; -import { Rpc } from "../../../helpers.js"; +import { TxRpc } from "../../../types.js"; import { BinaryReader } from "../../../binary.js"; import { MsgSignProviderAttributes, MsgSignProviderAttributesSDKType, MsgSignProviderAttributesResponse, MsgSignProviderAttributesResponseSDKType, MsgDeleteProviderAttributes, MsgDeleteProviderAttributesSDKType, MsgDeleteProviderAttributesResponse, MsgDeleteProviderAttributesResponseSDKType } from "./audit.js"; /** Msg defines the provider Msg service */ @@ -10,8 +10,8 @@ export interface Msg { deleteProviderAttributes(request: MsgDeleteProviderAttributes): Promise; } export class MsgClientImpl implements Msg { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; } /* SignProviderAttributes defines a method that signs provider attributes */ @@ -27,6 +27,6 @@ export class MsgClientImpl implements Msg { return promise.then(data => MsgDeleteProviderAttributesResponse.decode(new BinaryReader(data))); }; } -export const createClientImpl = (rpc: Rpc) => { +export const createClientImpl = (rpc: TxRpc) => { return new MsgClientImpl(rpc); }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/akash/audit/v1beta2/query.rpc.Query.ts b/__fixtures__/v-next/outputv4/akash/audit/v1beta2/query.rpc.Query.ts index 2b2e2c3db5..04658a3304 100644 --- a/__fixtures__/v-next/outputv4/akash/audit/v1beta2/query.rpc.Query.ts +++ b/__fixtures__/v-next/outputv4/akash/audit/v1beta2/query.rpc.Query.ts @@ -1,6 +1,6 @@ import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination.js"; import { Provider, ProviderSDKType } from "./audit.js"; -import { Rpc } from "../../../helpers.js"; +import { TxRpc } from "../../../types.js"; import { BinaryReader } from "../../../binary.js"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; import { QueryAllProvidersAttributesRequest, QueryAllProvidersAttributesRequestSDKType, QueryProvidersResponse, QueryProvidersResponseSDKType, QueryProviderAttributesRequest, QueryProviderAttributesRequestSDKType, QueryProviderAuditorRequest, QueryProviderAuditorRequestSDKType, QueryAuditorAttributesRequest, QueryAuditorAttributesRequestSDKType } from "./query.js"; @@ -32,8 +32,8 @@ export interface Query { auditorAttributes(request: QueryAuditorAttributesRequest): Promise; } export class QueryClientImpl implements Query { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; } /* AllProvidersAttributes queries all providers diff --git a/__fixtures__/v-next/outputv4/akash/audit/v1beta2/query.rpc.func.ts b/__fixtures__/v-next/outputv4/akash/audit/v1beta2/query.rpc.func.ts new file mode 100644 index 0000000000..0e1c564ebe --- /dev/null +++ b/__fixtures__/v-next/outputv4/akash/audit/v1beta2/query.rpc.func.ts @@ -0,0 +1,60 @@ +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination.js"; +import { Provider, ProviderSDKType } from "./audit.js"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types.js"; +import { QueryAllProvidersAttributesRequest, QueryAllProvidersAttributesRequestSDKType, QueryProvidersResponse, QueryProvidersResponseSDKType, QueryProviderAttributesRequest, QueryProviderAttributesRequestSDKType, QueryProviderAuditorRequest, QueryProviderAuditorRequestSDKType, QueryAuditorAttributesRequest, QueryAuditorAttributesRequestSDKType } from "./query.js"; +/** + * AllProvidersAttributes queries all providers + * buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE + * buf:lint:ignore RPC_RESPONSE_STANDARD_NAME + * @name getAllProvidersAttributes + * @package akash.audit.v1beta2 + * @see proto service: akash.audit.v1beta2.AllProvidersAttributes + */ +export const getAllProvidersAttributes = buildQuery({ + encode: QueryAllProvidersAttributesRequest.encode, + decode: QueryProvidersResponse.decode, + service: "akash.audit.v1beta2.Query", + method: "AllProvidersAttributes" +}); +/** + * ProviderAttributes queries all provider signed attributes + * buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE + * buf:lint:ignore RPC_RESPONSE_STANDARD_NAME + * @name getProviderAttributes + * @package akash.audit.v1beta2 + * @see proto service: akash.audit.v1beta2.ProviderAttributes + */ +export const getProviderAttributes = buildQuery({ + encode: QueryProviderAttributesRequest.encode, + decode: QueryProvidersResponse.decode, + service: "akash.audit.v1beta2.Query", + method: "ProviderAttributes" +}); +/** + * ProviderAuditorAttributes queries provider signed attributes by specific auditor + * buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE + * buf:lint:ignore RPC_RESPONSE_STANDARD_NAME + * @name getProviderAuditorAttributes + * @package akash.audit.v1beta2 + * @see proto service: akash.audit.v1beta2.ProviderAuditorAttributes + */ +export const getProviderAuditorAttributes = buildQuery({ + encode: QueryProviderAuditorRequest.encode, + decode: QueryProvidersResponse.decode, + service: "akash.audit.v1beta2.Query", + method: "ProviderAuditorAttributes" +}); +/** + * AuditorAttributes queries all providers signed by this auditor + * buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE + * buf:lint:ignore RPC_RESPONSE_STANDARD_NAME + * @name getAuditorAttributes + * @package akash.audit.v1beta2 + * @see proto service: akash.audit.v1beta2.AuditorAttributes + */ +export const getAuditorAttributes = buildQuery({ + encode: QueryAuditorAttributesRequest.encode, + decode: QueryProvidersResponse.decode, + service: "akash.audit.v1beta2.Query", + method: "AuditorAttributes" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/akash/bundle.ts b/__fixtures__/v-next/outputv4/akash/bundle.ts index e5eece9d00..edc93afeeb 100644 --- a/__fixtures__/v-next/outputv4/akash/bundle.ts +++ b/__fixtures__/v-next/outputv4/akash/bundle.ts @@ -73,31 +73,48 @@ import * as _334 from "./escrow/v1beta1/query.lcd.js"; import * as _335 from "./escrow/v1beta2/query.lcd.js"; import * as _336 from "./market/v1beta2/query.lcd.js"; import * as _337 from "./provider/v1beta2/query.lcd.js"; -import * as _338 from "./audit/v1beta2/query.rpc.Query.js"; -import * as _339 from "./cert/v1beta2/query.rpc.Query.js"; -import * as _340 from "./deployment/v1beta2/query.rpc.Query.js"; -import * as _341 from "./escrow/v1beta1/query.rpc.Query.js"; -import * as _342 from "./escrow/v1beta2/query.rpc.Query.js"; -import * as _343 from "./market/v1beta2/query.rpc.Query.js"; -import * as _344 from "./provider/v1beta2/query.rpc.Query.js"; -import * as _345 from "./audit/v1beta1/audit.rpc.msg.js"; -import * as _346 from "./audit/v1beta2/audit.rpc.msg.js"; -import * as _347 from "./cert/v1beta2/cert.rpc.msg.js"; -import * as _348 from "./deployment/v1beta2/service.rpc.msg.js"; -import * as _349 from "./market/v1beta2/service.rpc.msg.js"; -import * as _350 from "./provider/v1beta1/provider.rpc.msg.js"; -import * as _351 from "./provider/v1beta2/provider.rpc.msg.js"; -import * as _352 from "./cert/v1beta2/query.pinia.store.js"; -import * as _536 from "./lcd.js"; -import * as _537 from "./rpc.query.js"; -import * as _538 from "./rpc.tx.js"; +import * as _338 from "./audit/v1beta2/query.rpc.func.js"; +import * as _339 from "./cert/v1beta2/query.rpc.func.js"; +import * as _340 from "./deployment/v1beta1/query.rpc.func.js"; +import * as _341 from "./deployment/v1beta2/query.rpc.func.js"; +import * as _342 from "./escrow/v1beta1/query.rpc.func.js"; +import * as _343 from "./escrow/v1beta2/query.rpc.func.js"; +import * as _344 from "./market/v1beta2/query.rpc.func.js"; +import * as _345 from "./provider/v1beta2/query.rpc.func.js"; +import * as _346 from "./audit/v1beta2/query.rpc.Query.js"; +import * as _347 from "./cert/v1beta2/query.rpc.Query.js"; +import * as _348 from "./deployment/v1beta2/query.rpc.Query.js"; +import * as _349 from "./escrow/v1beta1/query.rpc.Query.js"; +import * as _350 from "./escrow/v1beta2/query.rpc.Query.js"; +import * as _351 from "./market/v1beta2/query.rpc.Query.js"; +import * as _352 from "./provider/v1beta2/query.rpc.Query.js"; +import * as _353 from "./audit/v1beta1/audit.rpc.func.js"; +import * as _354 from "./audit/v1beta2/audit.rpc.func.js"; +import * as _355 from "./cert/v1beta2/cert.rpc.func.js"; +import * as _356 from "./deployment/v1beta1/deployment.rpc.func.js"; +import * as _357 from "./deployment/v1beta2/service.rpc.func.js"; +import * as _358 from "./market/v1beta2/service.rpc.func.js"; +import * as _359 from "./provider/v1beta1/provider.rpc.func.js"; +import * as _360 from "./provider/v1beta2/provider.rpc.func.js"; +import * as _361 from "./audit/v1beta1/audit.rpc.msg.js"; +import * as _362 from "./audit/v1beta2/audit.rpc.msg.js"; +import * as _363 from "./cert/v1beta2/cert.rpc.msg.js"; +import * as _364 from "./deployment/v1beta2/service.rpc.msg.js"; +import * as _365 from "./market/v1beta2/service.rpc.msg.js"; +import * as _366 from "./provider/v1beta1/provider.rpc.msg.js"; +import * as _367 from "./provider/v1beta2/provider.rpc.msg.js"; +import * as _368 from "./cert/v1beta2/query.pinia.store.js"; +import * as _629 from "./lcd.js"; +import * as _630 from "./rpc.query.js"; +import * as _631 from "./rpc.tx.js"; export namespace akash { export namespace audit { export const v1beta1 = { ..._0, ..._316, ..._323, - ..._345 + ..._353, + ..._361 }; export const v1beta2 = { ..._1, @@ -107,7 +124,9 @@ export namespace akash { ..._324, ..._330, ..._338, - ..._346 + ..._346, + ..._354, + ..._362 }; } export namespace base { @@ -135,7 +154,9 @@ export namespace akash { ..._331, ..._339, ..._347, - ..._352 + ..._355, + ..._363, + ..._368 }; } export namespace deployment { @@ -146,7 +167,9 @@ export namespace akash { ..._19, ..._20, ..._21, - ..._332 + ..._332, + ..._340, + ..._356 }; export const v1beta2 = { ..._22, @@ -164,8 +187,10 @@ export namespace akash { ..._319, ..._326, ..._333, - ..._340, - ..._348 + ..._341, + ..._348, + ..._357, + ..._364 }; } export namespace escrow { @@ -174,14 +199,16 @@ export namespace akash { ..._35, ..._36, ..._334, - ..._341 + ..._342, + ..._349 }; export const v1beta2 = { ..._37, ..._38, ..._39, ..._335, - ..._342 + ..._343, + ..._350 }; } export namespace inflation { @@ -202,8 +229,10 @@ export namespace akash { ..._320, ..._327, ..._336, - ..._343, - ..._349 + ..._344, + ..._351, + ..._358, + ..._365 }; } export namespace provider { @@ -211,7 +240,8 @@ export namespace akash { ..._49, ..._321, ..._328, - ..._350 + ..._359, + ..._366 }; export const v1beta2 = { ..._50, @@ -220,13 +250,15 @@ export namespace akash { ..._322, ..._329, ..._337, - ..._344, - ..._351 + ..._345, + ..._352, + ..._360, + ..._367 }; } export const ClientFactory = { - ..._536, - ..._537, - ..._538 + ..._629, + ..._630, + ..._631 }; } \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/akash/cert/v1beta2/cert.registry.ts b/__fixtures__/v-next/outputv4/akash/cert/v1beta2/cert.registry.ts index 08519e3655..77db39320b 100644 --- a/__fixtures__/v-next/outputv4/akash/cert/v1beta2/cert.registry.ts +++ b/__fixtures__/v-next/outputv4/akash/cert/v1beta2/cert.registry.ts @@ -1,11 +1,6 @@ -import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { TelescopeGeneratedType } from "../../../types.js"; import { MsgCreateCertificate, MsgCreateCertificateSDKType, MsgRevokeCertificate, MsgRevokeCertificateSDKType } from "./cert.js"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/akash.cert.v1beta2.MsgCreateCertificate", MsgCreateCertificate], ["/akash.cert.v1beta2.MsgRevokeCertificate", MsgRevokeCertificate]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/akash.cert.v1beta2.MsgCreateCertificate", MsgCreateCertificate], ["/akash.cert.v1beta2.MsgRevokeCertificate", MsgRevokeCertificate]]; export const MessageComposer = { encoded: { createCertificate(value: MsgCreateCertificate) { diff --git a/__fixtures__/v-next/outputv4/akash/cert/v1beta2/cert.rpc.func.ts b/__fixtures__/v-next/outputv4/akash/cert/v1beta2/cert.rpc.func.ts new file mode 100644 index 0000000000..f0268fbf59 --- /dev/null +++ b/__fixtures__/v-next/outputv4/akash/cert/v1beta2/cert.rpc.func.ts @@ -0,0 +1,20 @@ +import { buildTx } from "../../../helper-func-types.js"; +import { MsgCreateCertificate, MsgCreateCertificateSDKType, MsgCreateCertificateResponse, MsgCreateCertificateResponseSDKType, MsgRevokeCertificate, MsgRevokeCertificateSDKType, MsgRevokeCertificateResponse, MsgRevokeCertificateResponseSDKType } from "./cert.js"; +/** + * CreateCertificate defines a method to create new certificate given proper inputs. + * @name createCertificate + * @package akash.cert.v1beta2 + * @see proto service: akash.cert.v1beta2.CreateCertificate + */ +export const createCertificate = buildTx({ + msg: MsgCreateCertificate +}); +/** + * RevokeCertificate defines a method to revoke the certificate + * @name revokeCertificate + * @package akash.cert.v1beta2 + * @see proto service: akash.cert.v1beta2.RevokeCertificate + */ +export const revokeCertificate = buildTx({ + msg: MsgRevokeCertificate +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/akash/cert/v1beta2/cert.rpc.msg.ts b/__fixtures__/v-next/outputv4/akash/cert/v1beta2/cert.rpc.msg.ts index 2ac8d153a7..c142b92c00 100644 --- a/__fixtures__/v-next/outputv4/akash/cert/v1beta2/cert.rpc.msg.ts +++ b/__fixtures__/v-next/outputv4/akash/cert/v1beta2/cert.rpc.msg.ts @@ -1,4 +1,4 @@ -import { Rpc } from "../../../helpers.js"; +import { TxRpc } from "../../../types.js"; import { BinaryReader } from "../../../binary.js"; import { MsgCreateCertificate, MsgCreateCertificateSDKType, MsgCreateCertificateResponse, MsgCreateCertificateResponseSDKType, MsgRevokeCertificate, MsgRevokeCertificateSDKType, MsgRevokeCertificateResponse, MsgRevokeCertificateResponseSDKType } from "./cert.js"; /** Msg defines the provider Msg service */ @@ -9,8 +9,8 @@ export interface Msg { revokeCertificate(request: MsgRevokeCertificate): Promise; } export class MsgClientImpl implements Msg { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; } /* CreateCertificate defines a method to create new certificate given proper inputs. */ @@ -26,6 +26,6 @@ export class MsgClientImpl implements Msg { return promise.then(data => MsgRevokeCertificateResponse.decode(new BinaryReader(data))); }; } -export const createClientImpl = (rpc: Rpc) => { +export const createClientImpl = (rpc: TxRpc) => { return new MsgClientImpl(rpc); }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/akash/cert/v1beta2/query.rpc.Query.ts b/__fixtures__/v-next/outputv4/akash/cert/v1beta2/query.rpc.Query.ts index e161d47fa8..f92738686d 100644 --- a/__fixtures__/v-next/outputv4/akash/cert/v1beta2/query.rpc.Query.ts +++ b/__fixtures__/v-next/outputv4/akash/cert/v1beta2/query.rpc.Query.ts @@ -1,6 +1,6 @@ import { CertificateFilter, CertificateFilterSDKType, Certificate, CertificateSDKType } from "./cert.js"; import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination.js"; -import { Rpc } from "../../../helpers.js"; +import { TxRpc } from "../../../types.js"; import { BinaryReader } from "../../../binary.js"; import { QueryClient, createProtobufRpcClient, ProtobufRpcClient } from "@cosmjs/stargate"; import { ReactQueryParams } from "../../../react-query.js"; @@ -14,8 +14,8 @@ export interface Query { certificates(request: QueryCertificatesRequest): Promise; } export class QueryClientImpl implements Query { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; } /* Certificates queries certificates */ diff --git a/__fixtures__/v-next/outputv4/akash/cert/v1beta2/query.rpc.func.ts b/__fixtures__/v-next/outputv4/akash/cert/v1beta2/query.rpc.func.ts new file mode 100644 index 0000000000..3413dfea7c --- /dev/null +++ b/__fixtures__/v-next/outputv4/akash/cert/v1beta2/query.rpc.func.ts @@ -0,0 +1,16 @@ +import { CertificateFilter, CertificateFilterSDKType, Certificate, CertificateSDKType } from "./cert.js"; +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination.js"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types.js"; +import { QueryCertificatesRequest, QueryCertificatesRequestSDKType, QueryCertificatesResponse, QueryCertificatesResponseSDKType } from "./query.js"; +/** + * Certificates queries certificates + * @name getCertificates + * @package akash.cert.v1beta2 + * @see proto service: akash.cert.v1beta2.Certificates + */ +export const getCertificates = buildQuery({ + encode: QueryCertificatesRequest.encode, + decode: QueryCertificatesResponse.decode, + service: "akash.cert.v1beta2.Query", + method: "Certificates" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/akash/deployment/v1beta1/deployment.rpc.func.ts b/__fixtures__/v-next/outputv4/akash/deployment/v1beta1/deployment.rpc.func.ts new file mode 100644 index 0000000000..cf1eaacd0d --- /dev/null +++ b/__fixtures__/v-next/outputv4/akash/deployment/v1beta1/deployment.rpc.func.ts @@ -0,0 +1,67 @@ +import { GroupSpec, GroupSpecSDKType, GroupID, GroupIDSDKType, MsgCloseGroup, MsgCloseGroupSDKType, MsgCloseGroupResponse, MsgCloseGroupResponseSDKType, MsgPauseGroup, MsgPauseGroupSDKType, MsgPauseGroupResponse, MsgPauseGroupResponseSDKType, MsgStartGroup, MsgStartGroupSDKType, MsgStartGroupResponse, MsgStartGroupResponseSDKType } from "./group.js"; +import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin.js"; +import { buildTx } from "../../../helper-func-types.js"; +import { MsgCreateDeployment, MsgCreateDeploymentSDKType, MsgCreateDeploymentResponse, MsgCreateDeploymentResponseSDKType, MsgDepositDeployment, MsgDepositDeploymentSDKType, MsgDepositDeploymentResponse, MsgDepositDeploymentResponseSDKType, MsgUpdateDeployment, MsgUpdateDeploymentSDKType, MsgUpdateDeploymentResponse, MsgUpdateDeploymentResponseSDKType, MsgCloseDeployment, MsgCloseDeploymentSDKType, MsgCloseDeploymentResponse, MsgCloseDeploymentResponseSDKType } from "./deployment.js"; +/** + * CreateDeployment defines a method to create new deployment given proper inputs. + * @name createDeployment + * @package akash.deployment.v1beta1 + * @see proto service: akash.deployment.v1beta1.CreateDeployment + */ +export const createDeployment = buildTx({ + msg: MsgCreateDeployment +}); +/** + * DepositDeployment deposits more funds into the deployment account + * @name depositDeployment + * @package akash.deployment.v1beta1 + * @see proto service: akash.deployment.v1beta1.DepositDeployment + */ +export const depositDeployment = buildTx({ + msg: MsgDepositDeployment +}); +/** + * UpdateDeployment defines a method to update a deployment given proper inputs. + * @name updateDeployment + * @package akash.deployment.v1beta1 + * @see proto service: akash.deployment.v1beta1.UpdateDeployment + */ +export const updateDeployment = buildTx({ + msg: MsgUpdateDeployment +}); +/** + * CloseDeployment defines a method to close a deployment given proper inputs. + * @name closeDeployment + * @package akash.deployment.v1beta1 + * @see proto service: akash.deployment.v1beta1.CloseDeployment + */ +export const closeDeployment = buildTx({ + msg: MsgCloseDeployment +}); +/** + * CloseGroup defines a method to close a group of a deployment given proper inputs. + * @name closeGroup + * @package akash.deployment.v1beta1 + * @see proto service: akash.deployment.v1beta1.CloseGroup + */ +export const closeGroup = buildTx({ + msg: MsgCloseGroup +}); +/** + * PauseGroup defines a method to close a group of a deployment given proper inputs. + * @name pauseGroup + * @package akash.deployment.v1beta1 + * @see proto service: akash.deployment.v1beta1.PauseGroup + */ +export const pauseGroup = buildTx({ + msg: MsgPauseGroup +}); +/** + * StartGroup defines a method to close a group of a deployment given proper inputs. + * @name startGroup + * @package akash.deployment.v1beta1 + * @see proto service: akash.deployment.v1beta1.StartGroup + */ +export const startGroup = buildTx({ + msg: MsgStartGroup +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/akash/deployment/v1beta1/deployment.ts b/__fixtures__/v-next/outputv4/akash/deployment/v1beta1/deployment.ts index e0dcd2c689..ab0acc551f 100644 --- a/__fixtures__/v-next/outputv4/akash/deployment/v1beta1/deployment.ts +++ b/__fixtures__/v-next/outputv4/akash/deployment/v1beta1/deployment.ts @@ -3,8 +3,9 @@ import { GroupSpec, GroupSpecSDKType, GroupID, GroupIDSDKType } from "./group.js"; import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin.js"; import { BinaryReader, BinaryWriter } from "../../../binary.js"; -import { isSet, bytesFromBase64, base64FromBytes, Exact, Rpc } from "../../../helpers.js"; +import { isSet, bytesFromBase64, base64FromBytes, Exact } from "../../../helpers.js"; import { JsonSafe } from "../../../json-safe.js"; +import { TxRpc } from "../../../types.js"; export const protobufPackage = "akash.deployment.v1beta1"; /** State is an enum which refers to state of deployment */ export enum Deployment_State { @@ -1579,8 +1580,8 @@ export interface Msg { startGroup(request: MsgStartGroup): Promise; } export class MsgClientImpl implements Msg { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; } /* CreateDeployment defines a method to create new deployment given proper inputs. */ @@ -1626,6 +1627,6 @@ export class MsgClientImpl implements Msg { return promise.then(data => MsgStartGroupResponse.decode(new BinaryReader(data))); }; } -export const createClientImpl = (rpc: Rpc) => { +export const createClientImpl = (rpc: TxRpc) => { return new MsgClientImpl(rpc); }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/akash/deployment/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputv4/akash/deployment/v1beta1/query.rpc.func.ts new file mode 100644 index 0000000000..3cb028c671 --- /dev/null +++ b/__fixtures__/v-next/outputv4/akash/deployment/v1beta1/query.rpc.func.ts @@ -0,0 +1,42 @@ +import { DeploymentFilters, DeploymentFiltersSDKType, DeploymentID, DeploymentIDSDKType, Deployment, DeploymentSDKType } from "./deployment.js"; +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination.js"; +import { GroupID, GroupIDSDKType, Group, GroupSDKType } from "./group.js"; +import { Account, AccountSDKType } from "../../escrow/v1beta1/types.js"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types.js"; +import { QueryDeploymentsRequest, QueryDeploymentsRequestSDKType, QueryDeploymentsResponse, QueryDeploymentsResponseSDKType, QueryDeploymentRequest, QueryDeploymentRequestSDKType, QueryDeploymentResponse, QueryDeploymentResponseSDKType, QueryGroupRequest, QueryGroupRequestSDKType, QueryGroupResponse, QueryGroupResponseSDKType } from "./query.js"; +/** + * Deployments queries deployments + * @name getDeployments + * @package akash.deployment.v1beta1 + * @see proto service: akash.deployment.v1beta1.Deployments + */ +export const getDeployments = buildQuery({ + encode: QueryDeploymentsRequest.encode, + decode: QueryDeploymentsResponse.decode, + service: "akash.deployment.v1beta1.Query", + method: "Deployments" +}); +/** + * Deployment queries deployment details + * @name getDeployment + * @package akash.deployment.v1beta1 + * @see proto service: akash.deployment.v1beta1.Deployment + */ +export const getDeployment = buildQuery({ + encode: QueryDeploymentRequest.encode, + decode: QueryDeploymentResponse.decode, + service: "akash.deployment.v1beta1.Query", + method: "Deployment" +}); +/** + * Group queries group details + * @name getGroup + * @package akash.deployment.v1beta1 + * @see proto service: akash.deployment.v1beta1.Group + */ +export const getGroup = buildQuery({ + encode: QueryGroupRequest.encode, + decode: QueryGroupResponse.decode, + service: "akash.deployment.v1beta1.Query", + method: "Group" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/akash/deployment/v1beta1/query.ts b/__fixtures__/v-next/outputv4/akash/deployment/v1beta1/query.ts index 03456a2125..ebe68ff48b 100644 --- a/__fixtures__/v-next/outputv4/akash/deployment/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv4/akash/deployment/v1beta1/query.ts @@ -3,8 +3,9 @@ import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } fr import { GroupID, GroupIDSDKType, Group, GroupSDKType } from "./group.js"; import { Account, AccountSDKType } from "../../escrow/v1beta1/types.js"; import { BinaryReader, BinaryWriter } from "../../../binary.js"; -import { isSet, Exact, Rpc } from "../../../helpers.js"; +import { isSet, Exact } from "../../../helpers.js"; import { JsonSafe } from "../../../json-safe.js"; +import { TxRpc } from "../../../types.js"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; export const protobufPackage = "akash.deployment.v1beta1"; /** @@ -861,8 +862,8 @@ export interface Query { group(request: QueryGroupRequest): Promise; } export class QueryClientImpl implements Query { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; } /* Deployments queries deployments */ diff --git a/__fixtures__/v-next/outputv4/akash/deployment/v1beta2/query.rpc.Query.ts b/__fixtures__/v-next/outputv4/akash/deployment/v1beta2/query.rpc.Query.ts index 8f46132593..517ea3bef1 100644 --- a/__fixtures__/v-next/outputv4/akash/deployment/v1beta2/query.rpc.Query.ts +++ b/__fixtures__/v-next/outputv4/akash/deployment/v1beta2/query.rpc.Query.ts @@ -3,7 +3,7 @@ import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } fr import { GroupID, GroupIDSDKType } from "./groupid.js"; import { Group, GroupSDKType } from "./group.js"; import { Account, AccountSDKType } from "../../escrow/v1beta2/types.js"; -import { Rpc } from "../../../helpers.js"; +import { TxRpc } from "../../../types.js"; import { BinaryReader } from "../../../binary.js"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; import { QueryDeploymentsRequest, QueryDeploymentsRequestSDKType, QueryDeploymentsResponse, QueryDeploymentsResponseSDKType, QueryDeploymentRequest, QueryDeploymentRequestSDKType, QueryDeploymentResponse, QueryDeploymentResponseSDKType, QueryGroupRequest, QueryGroupRequestSDKType, QueryGroupResponse, QueryGroupResponseSDKType } from "./query.js"; @@ -17,8 +17,8 @@ export interface Query { group(request: QueryGroupRequest): Promise; } export class QueryClientImpl implements Query { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; } /* Deployments queries deployments */ diff --git a/__fixtures__/v-next/outputv4/akash/deployment/v1beta2/query.rpc.func.ts b/__fixtures__/v-next/outputv4/akash/deployment/v1beta2/query.rpc.func.ts new file mode 100644 index 0000000000..6e4aeebf65 --- /dev/null +++ b/__fixtures__/v-next/outputv4/akash/deployment/v1beta2/query.rpc.func.ts @@ -0,0 +1,43 @@ +import { DeploymentFilters, DeploymentFiltersSDKType, DeploymentID, DeploymentIDSDKType, Deployment, DeploymentSDKType } from "./deployment.js"; +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination.js"; +import { GroupID, GroupIDSDKType } from "./groupid.js"; +import { Group, GroupSDKType } from "./group.js"; +import { Account, AccountSDKType } from "../../escrow/v1beta2/types.js"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types.js"; +import { QueryDeploymentsRequest, QueryDeploymentsRequestSDKType, QueryDeploymentsResponse, QueryDeploymentsResponseSDKType, QueryDeploymentRequest, QueryDeploymentRequestSDKType, QueryDeploymentResponse, QueryDeploymentResponseSDKType, QueryGroupRequest, QueryGroupRequestSDKType, QueryGroupResponse, QueryGroupResponseSDKType } from "./query.js"; +/** + * Deployments queries deployments + * @name getDeployments + * @package akash.deployment.v1beta2 + * @see proto service: akash.deployment.v1beta2.Deployments + */ +export const getDeployments = buildQuery({ + encode: QueryDeploymentsRequest.encode, + decode: QueryDeploymentsResponse.decode, + service: "akash.deployment.v1beta2.Query", + method: "Deployments" +}); +/** + * Deployment queries deployment details + * @name getDeployment + * @package akash.deployment.v1beta2 + * @see proto service: akash.deployment.v1beta2.Deployment + */ +export const getDeployment = buildQuery({ + encode: QueryDeploymentRequest.encode, + decode: QueryDeploymentResponse.decode, + service: "akash.deployment.v1beta2.Query", + method: "Deployment" +}); +/** + * Group queries group details + * @name getGroup + * @package akash.deployment.v1beta2 + * @see proto service: akash.deployment.v1beta2.Group + */ +export const getGroup = buildQuery({ + encode: QueryGroupRequest.encode, + decode: QueryGroupResponse.decode, + service: "akash.deployment.v1beta2.Query", + method: "Group" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/akash/deployment/v1beta2/service.registry.ts b/__fixtures__/v-next/outputv4/akash/deployment/v1beta2/service.registry.ts index ded19e9bff..38c73e7dd1 100644 --- a/__fixtures__/v-next/outputv4/akash/deployment/v1beta2/service.registry.ts +++ b/__fixtures__/v-next/outputv4/akash/deployment/v1beta2/service.registry.ts @@ -2,15 +2,10 @@ import { DeploymentID, DeploymentIDSDKType } from "./deployment.js"; import { GroupSpec, GroupSpecSDKType } from "./groupspec.js"; import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin.js"; import { GroupID, GroupIDSDKType } from "./groupid.js"; -import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { TelescopeGeneratedType } from "../../../types.js"; import { MsgCreateDeployment, MsgCreateDeploymentSDKType, MsgDepositDeployment, MsgDepositDeploymentSDKType, MsgUpdateDeployment, MsgUpdateDeploymentSDKType, MsgCloseDeployment, MsgCloseDeploymentSDKType } from "./deploymentmsg.js"; import { MsgCloseGroup, MsgCloseGroupSDKType, MsgPauseGroup, MsgPauseGroupSDKType, MsgStartGroup, MsgStartGroupSDKType } from "./groupmsg.js"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/akash.deployment.v1beta2.MsgCreateDeployment", MsgCreateDeployment], ["/akash.deployment.v1beta2.MsgDepositDeployment", MsgDepositDeployment], ["/akash.deployment.v1beta2.MsgUpdateDeployment", MsgUpdateDeployment], ["/akash.deployment.v1beta2.MsgCloseDeployment", MsgCloseDeployment], ["/akash.deployment.v1beta2.MsgCloseGroup", MsgCloseGroup], ["/akash.deployment.v1beta2.MsgPauseGroup", MsgPauseGroup], ["/akash.deployment.v1beta2.MsgStartGroup", MsgStartGroup]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/akash.deployment.v1beta2.MsgCreateDeployment", MsgCreateDeployment], ["/akash.deployment.v1beta2.MsgDepositDeployment", MsgDepositDeployment], ["/akash.deployment.v1beta2.MsgUpdateDeployment", MsgUpdateDeployment], ["/akash.deployment.v1beta2.MsgCloseDeployment", MsgCloseDeployment], ["/akash.deployment.v1beta2.MsgCloseGroup", MsgCloseGroup], ["/akash.deployment.v1beta2.MsgPauseGroup", MsgPauseGroup], ["/akash.deployment.v1beta2.MsgStartGroup", MsgStartGroup]]; export const MessageComposer = { encoded: { createDeployment(value: MsgCreateDeployment) { diff --git a/__fixtures__/v-next/outputv4/akash/deployment/v1beta2/service.rpc.func.ts b/__fixtures__/v-next/outputv4/akash/deployment/v1beta2/service.rpc.func.ts new file mode 100644 index 0000000000..51cfd9ae4b --- /dev/null +++ b/__fixtures__/v-next/outputv4/akash/deployment/v1beta2/service.rpc.func.ts @@ -0,0 +1,70 @@ +import { DeploymentID, DeploymentIDSDKType } from "./deployment.js"; +import { GroupSpec, GroupSpecSDKType } from "./groupspec.js"; +import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin.js"; +import { GroupID, GroupIDSDKType } from "./groupid.js"; +import { buildTx } from "../../../helper-func-types.js"; +import { MsgCreateDeployment, MsgCreateDeploymentSDKType, MsgCreateDeploymentResponse, MsgCreateDeploymentResponseSDKType, MsgDepositDeployment, MsgDepositDeploymentSDKType, MsgDepositDeploymentResponse, MsgDepositDeploymentResponseSDKType, MsgUpdateDeployment, MsgUpdateDeploymentSDKType, MsgUpdateDeploymentResponse, MsgUpdateDeploymentResponseSDKType, MsgCloseDeployment, MsgCloseDeploymentSDKType, MsgCloseDeploymentResponse, MsgCloseDeploymentResponseSDKType } from "./deploymentmsg.js"; +import { MsgCloseGroup, MsgCloseGroupSDKType, MsgCloseGroupResponse, MsgCloseGroupResponseSDKType, MsgPauseGroup, MsgPauseGroupSDKType, MsgPauseGroupResponse, MsgPauseGroupResponseSDKType, MsgStartGroup, MsgStartGroupSDKType, MsgStartGroupResponse, MsgStartGroupResponseSDKType } from "./groupmsg.js"; +/** + * CreateDeployment defines a method to create new deployment given proper inputs. + * @name createDeployment + * @package akash.deployment.v1beta2 + * @see proto service: akash.deployment.v1beta2.CreateDeployment + */ +export const createDeployment = buildTx({ + msg: MsgCreateDeployment +}); +/** + * DepositDeployment deposits more funds into the deployment account + * @name depositDeployment + * @package akash.deployment.v1beta2 + * @see proto service: akash.deployment.v1beta2.DepositDeployment + */ +export const depositDeployment = buildTx({ + msg: MsgDepositDeployment +}); +/** + * UpdateDeployment defines a method to update a deployment given proper inputs. + * @name updateDeployment + * @package akash.deployment.v1beta2 + * @see proto service: akash.deployment.v1beta2.UpdateDeployment + */ +export const updateDeployment = buildTx({ + msg: MsgUpdateDeployment +}); +/** + * CloseDeployment defines a method to close a deployment given proper inputs. + * @name closeDeployment + * @package akash.deployment.v1beta2 + * @see proto service: akash.deployment.v1beta2.CloseDeployment + */ +export const closeDeployment = buildTx({ + msg: MsgCloseDeployment +}); +/** + * CloseGroup defines a method to close a group of a deployment given proper inputs. + * @name closeGroup + * @package akash.deployment.v1beta2 + * @see proto service: akash.deployment.v1beta2.CloseGroup + */ +export const closeGroup = buildTx({ + msg: MsgCloseGroup +}); +/** + * PauseGroup defines a method to close a group of a deployment given proper inputs. + * @name pauseGroup + * @package akash.deployment.v1beta2 + * @see proto service: akash.deployment.v1beta2.PauseGroup + */ +export const pauseGroup = buildTx({ + msg: MsgPauseGroup +}); +/** + * StartGroup defines a method to close a group of a deployment given proper inputs. + * @name startGroup + * @package akash.deployment.v1beta2 + * @see proto service: akash.deployment.v1beta2.StartGroup + */ +export const startGroup = buildTx({ + msg: MsgStartGroup +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/akash/deployment/v1beta2/service.rpc.msg.ts b/__fixtures__/v-next/outputv4/akash/deployment/v1beta2/service.rpc.msg.ts index b9636cf3dd..5254ef62e1 100644 --- a/__fixtures__/v-next/outputv4/akash/deployment/v1beta2/service.rpc.msg.ts +++ b/__fixtures__/v-next/outputv4/akash/deployment/v1beta2/service.rpc.msg.ts @@ -2,7 +2,7 @@ import { DeploymentID, DeploymentIDSDKType } from "./deployment.js"; import { GroupSpec, GroupSpecSDKType } from "./groupspec.js"; import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin.js"; import { GroupID, GroupIDSDKType } from "./groupid.js"; -import { Rpc } from "../../../helpers.js"; +import { TxRpc } from "../../../types.js"; import { BinaryReader } from "../../../binary.js"; import { MsgCreateDeployment, MsgCreateDeploymentSDKType, MsgCreateDeploymentResponse, MsgCreateDeploymentResponseSDKType, MsgDepositDeployment, MsgDepositDeploymentSDKType, MsgDepositDeploymentResponse, MsgDepositDeploymentResponseSDKType, MsgUpdateDeployment, MsgUpdateDeploymentSDKType, MsgUpdateDeploymentResponse, MsgUpdateDeploymentResponseSDKType, MsgCloseDeployment, MsgCloseDeploymentSDKType, MsgCloseDeploymentResponse, MsgCloseDeploymentResponseSDKType } from "./deploymentmsg.js"; import { MsgCloseGroup, MsgCloseGroupSDKType, MsgCloseGroupResponse, MsgCloseGroupResponseSDKType, MsgPauseGroup, MsgPauseGroupSDKType, MsgPauseGroupResponse, MsgPauseGroupResponseSDKType, MsgStartGroup, MsgStartGroupSDKType, MsgStartGroupResponse, MsgStartGroupResponseSDKType } from "./groupmsg.js"; @@ -24,8 +24,8 @@ export interface Msg { startGroup(request: MsgStartGroup): Promise; } export class MsgClientImpl implements Msg { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; } /* CreateDeployment defines a method to create new deployment given proper inputs. */ @@ -71,6 +71,6 @@ export class MsgClientImpl implements Msg { return promise.then(data => MsgStartGroupResponse.decode(new BinaryReader(data))); }; } -export const createClientImpl = (rpc: Rpc) => { +export const createClientImpl = (rpc: TxRpc) => { return new MsgClientImpl(rpc); }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/akash/escrow/v1beta1/query.rpc.Query.ts b/__fixtures__/v-next/outputv4/akash/escrow/v1beta1/query.rpc.Query.ts index 5b8a13eb57..b19e17baa7 100644 --- a/__fixtures__/v-next/outputv4/akash/escrow/v1beta1/query.rpc.Query.ts +++ b/__fixtures__/v-next/outputv4/akash/escrow/v1beta1/query.rpc.Query.ts @@ -1,6 +1,6 @@ import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination.js"; import { Account, AccountSDKType, Payment, PaymentSDKType } from "./types.js"; -import { Rpc } from "../../../helpers.js"; +import { TxRpc } from "../../../types.js"; import { BinaryReader } from "../../../binary.js"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; import { QueryAccountsRequest, QueryAccountsRequestSDKType, QueryAccountsResponse, QueryAccountsResponseSDKType, QueryPaymentsRequest, QueryPaymentsRequestSDKType, QueryPaymentsResponse, QueryPaymentsResponseSDKType } from "./query.js"; @@ -20,8 +20,8 @@ export interface Query { payments(request: QueryPaymentsRequest): Promise; } export class QueryClientImpl implements Query { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; } /* buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE diff --git a/__fixtures__/v-next/outputv4/akash/escrow/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputv4/akash/escrow/v1beta1/query.rpc.func.ts new file mode 100644 index 0000000000..505fc6b148 --- /dev/null +++ b/__fixtures__/v-next/outputv4/akash/escrow/v1beta1/query.rpc.func.ts @@ -0,0 +1,32 @@ +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination.js"; +import { Account, AccountSDKType, Payment, PaymentSDKType } from "./types.js"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types.js"; +import { QueryAccountsRequest, QueryAccountsRequestSDKType, QueryAccountsResponse, QueryAccountsResponseSDKType, QueryPaymentsRequest, QueryPaymentsRequestSDKType, QueryPaymentsResponse, QueryPaymentsResponseSDKType } from "./query.js"; +/** + * buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE + * buf:lint:ignore RPC_RESPONSE_STANDARD_NAME + * Accounts queries all accounts + * @name getAccounts + * @package akash.escrow.v1beta1 + * @see proto service: akash.escrow.v1beta1.Accounts + */ +export const getAccounts = buildQuery({ + encode: QueryAccountsRequest.encode, + decode: QueryAccountsResponse.decode, + service: "akash.escrow.v1beta1.Query", + method: "Accounts" +}); +/** + * buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE + * buf:lint:ignore RPC_RESPONSE_STANDARD_NAME + * Payments queries all payments + * @name getPayments + * @package akash.escrow.v1beta1 + * @see proto service: akash.escrow.v1beta1.Payments + */ +export const getPayments = buildQuery({ + encode: QueryPaymentsRequest.encode, + decode: QueryPaymentsResponse.decode, + service: "akash.escrow.v1beta1.Query", + method: "Payments" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/akash/escrow/v1beta2/query.rpc.Query.ts b/__fixtures__/v-next/outputv4/akash/escrow/v1beta2/query.rpc.Query.ts index e6c0ec9480..10a6109347 100644 --- a/__fixtures__/v-next/outputv4/akash/escrow/v1beta2/query.rpc.Query.ts +++ b/__fixtures__/v-next/outputv4/akash/escrow/v1beta2/query.rpc.Query.ts @@ -1,6 +1,6 @@ import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination.js"; import { Account, AccountSDKType, FractionalPayment, FractionalPaymentSDKType } from "./types.js"; -import { Rpc } from "../../../helpers.js"; +import { TxRpc } from "../../../types.js"; import { BinaryReader } from "../../../binary.js"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; import { QueryAccountsRequest, QueryAccountsRequestSDKType, QueryAccountsResponse, QueryAccountsResponseSDKType, QueryPaymentsRequest, QueryPaymentsRequestSDKType, QueryPaymentsResponse, QueryPaymentsResponseSDKType } from "./query.js"; @@ -20,8 +20,8 @@ export interface Query { payments(request: QueryPaymentsRequest): Promise; } export class QueryClientImpl implements Query { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; } /* buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE diff --git a/__fixtures__/v-next/outputv4/akash/escrow/v1beta2/query.rpc.func.ts b/__fixtures__/v-next/outputv4/akash/escrow/v1beta2/query.rpc.func.ts new file mode 100644 index 0000000000..6daae4ff2f --- /dev/null +++ b/__fixtures__/v-next/outputv4/akash/escrow/v1beta2/query.rpc.func.ts @@ -0,0 +1,32 @@ +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination.js"; +import { Account, AccountSDKType, FractionalPayment, FractionalPaymentSDKType } from "./types.js"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types.js"; +import { QueryAccountsRequest, QueryAccountsRequestSDKType, QueryAccountsResponse, QueryAccountsResponseSDKType, QueryPaymentsRequest, QueryPaymentsRequestSDKType, QueryPaymentsResponse, QueryPaymentsResponseSDKType } from "./query.js"; +/** + * buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE + * buf:lint:ignore RPC_RESPONSE_STANDARD_NAME + * Accounts queries all accounts + * @name getAccounts + * @package akash.escrow.v1beta2 + * @see proto service: akash.escrow.v1beta2.Accounts + */ +export const getAccounts = buildQuery({ + encode: QueryAccountsRequest.encode, + decode: QueryAccountsResponse.decode, + service: "akash.escrow.v1beta2.Query", + method: "Accounts" +}); +/** + * buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE + * buf:lint:ignore RPC_RESPONSE_STANDARD_NAME + * Payments queries all payments + * @name getPayments + * @package akash.escrow.v1beta2 + * @see proto service: akash.escrow.v1beta2.Payments + */ +export const getPayments = buildQuery({ + encode: QueryPaymentsRequest.encode, + decode: QueryPaymentsResponse.decode, + service: "akash.escrow.v1beta2.Query", + method: "Payments" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/akash/inflation/v1beta2/params.ts b/__fixtures__/v-next/outputv4/akash/inflation/v1beta2/params.ts index 7dec5164b7..622f8c803f 100644 --- a/__fixtures__/v-next/outputv4/akash/inflation/v1beta2/params.ts +++ b/__fixtures__/v-next/outputv4/akash/inflation/v1beta2/params.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary.js"; -import { Decimal } from "@cosmjs/math"; +import { Decimal } from "@interchainjs/math"; import { isSet, DeepPartial, Exact } from "../../../helpers.js"; import { JsonSafe } from "../../../json-safe.js"; export const protobufPackage = "akash.inflation.v1beta2"; @@ -147,9 +147,9 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.inflation_decay_factor = message.inflationDecayFactor ?? ""; - obj.initial_inflation = message.initialInflation ?? ""; - obj.variance = message.variance ?? ""; + obj.inflation_decay_factor = Decimal.fromUserInput(message.inflationDecayFactor, 18).atomics ?? ""; + obj.initial_inflation = Decimal.fromUserInput(message.initialInflation, 18).atomics ?? ""; + obj.variance = Decimal.fromUserInput(message.variance, 18).atomics ?? ""; return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputv4/akash/market/v1beta2/query.rpc.Query.ts b/__fixtures__/v-next/outputv4/akash/market/v1beta2/query.rpc.Query.ts index 652548c361..fe1919a520 100644 --- a/__fixtures__/v-next/outputv4/akash/market/v1beta2/query.rpc.Query.ts +++ b/__fixtures__/v-next/outputv4/akash/market/v1beta2/query.rpc.Query.ts @@ -3,7 +3,7 @@ import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } fr import { BidFilters, BidFiltersSDKType, BidID, BidIDSDKType, Bid, BidSDKType } from "./bid.js"; import { LeaseFilters, LeaseFiltersSDKType, LeaseID, LeaseIDSDKType, Lease, LeaseSDKType } from "./lease.js"; import { Account, AccountSDKType, FractionalPayment, FractionalPaymentSDKType } from "../../escrow/v1beta2/types.js"; -import { Rpc } from "../../../helpers.js"; +import { TxRpc } from "../../../types.js"; import { BinaryReader } from "../../../binary.js"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; import { QueryOrdersRequest, QueryOrdersRequestSDKType, QueryOrdersResponse, QueryOrdersResponseSDKType, QueryOrderRequest, QueryOrderRequestSDKType, QueryOrderResponse, QueryOrderResponseSDKType, QueryBidsRequest, QueryBidsRequestSDKType, QueryBidsResponse, QueryBidsResponseSDKType, QueryBidRequest, QueryBidRequestSDKType, QueryBidResponse, QueryBidResponseSDKType, QueryLeasesRequest, QueryLeasesRequestSDKType, QueryLeasesResponse, QueryLeasesResponseSDKType, QueryLeaseRequest, QueryLeaseRequestSDKType, QueryLeaseResponse, QueryLeaseResponseSDKType } from "./query.js"; @@ -23,8 +23,8 @@ export interface Query { lease(request: QueryLeaseRequest): Promise; } export class QueryClientImpl implements Query { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; } /* Orders queries orders with filters */ diff --git a/__fixtures__/v-next/outputv4/akash/market/v1beta2/query.rpc.func.ts b/__fixtures__/v-next/outputv4/akash/market/v1beta2/query.rpc.func.ts new file mode 100644 index 0000000000..553091045c --- /dev/null +++ b/__fixtures__/v-next/outputv4/akash/market/v1beta2/query.rpc.func.ts @@ -0,0 +1,79 @@ +import { OrderFilters, OrderFiltersSDKType, OrderID, OrderIDSDKType, Order, OrderSDKType } from "./order.js"; +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination.js"; +import { BidFilters, BidFiltersSDKType, BidID, BidIDSDKType, Bid, BidSDKType } from "./bid.js"; +import { LeaseFilters, LeaseFiltersSDKType, LeaseID, LeaseIDSDKType, Lease, LeaseSDKType } from "./lease.js"; +import { Account, AccountSDKType, FractionalPayment, FractionalPaymentSDKType } from "../../escrow/v1beta2/types.js"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types.js"; +import { QueryOrdersRequest, QueryOrdersRequestSDKType, QueryOrdersResponse, QueryOrdersResponseSDKType, QueryOrderRequest, QueryOrderRequestSDKType, QueryOrderResponse, QueryOrderResponseSDKType, QueryBidsRequest, QueryBidsRequestSDKType, QueryBidsResponse, QueryBidsResponseSDKType, QueryBidRequest, QueryBidRequestSDKType, QueryBidResponse, QueryBidResponseSDKType, QueryLeasesRequest, QueryLeasesRequestSDKType, QueryLeasesResponse, QueryLeasesResponseSDKType, QueryLeaseRequest, QueryLeaseRequestSDKType, QueryLeaseResponse, QueryLeaseResponseSDKType } from "./query.js"; +/** + * Orders queries orders with filters + * @name getOrders + * @package akash.market.v1beta2 + * @see proto service: akash.market.v1beta2.Orders + */ +export const getOrders = buildQuery({ + encode: QueryOrdersRequest.encode, + decode: QueryOrdersResponse.decode, + service: "akash.market.v1beta2.Query", + method: "Orders" +}); +/** + * Order queries order details + * @name getOrder + * @package akash.market.v1beta2 + * @see proto service: akash.market.v1beta2.Order + */ +export const getOrder = buildQuery({ + encode: QueryOrderRequest.encode, + decode: QueryOrderResponse.decode, + service: "akash.market.v1beta2.Query", + method: "Order" +}); +/** + * Bids queries bids with filters + * @name getBids + * @package akash.market.v1beta2 + * @see proto service: akash.market.v1beta2.Bids + */ +export const getBids = buildQuery({ + encode: QueryBidsRequest.encode, + decode: QueryBidsResponse.decode, + service: "akash.market.v1beta2.Query", + method: "Bids" +}); +/** + * Bid queries bid details + * @name getBid + * @package akash.market.v1beta2 + * @see proto service: akash.market.v1beta2.Bid + */ +export const getBid = buildQuery({ + encode: QueryBidRequest.encode, + decode: QueryBidResponse.decode, + service: "akash.market.v1beta2.Query", + method: "Bid" +}); +/** + * Leases queries leases with filters + * @name getLeases + * @package akash.market.v1beta2 + * @see proto service: akash.market.v1beta2.Leases + */ +export const getLeases = buildQuery({ + encode: QueryLeasesRequest.encode, + decode: QueryLeasesResponse.decode, + service: "akash.market.v1beta2.Query", + method: "Leases" +}); +/** + * Lease queries lease details + * @name getLease + * @package akash.market.v1beta2 + * @see proto service: akash.market.v1beta2.Lease + */ +export const getLease = buildQuery({ + encode: QueryLeaseRequest.encode, + decode: QueryLeaseResponse.decode, + service: "akash.market.v1beta2.Query", + method: "Lease" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/akash/market/v1beta2/service.registry.ts b/__fixtures__/v-next/outputv4/akash/market/v1beta2/service.registry.ts index d53ce49797..f7c3bfe560 100644 --- a/__fixtures__/v-next/outputv4/akash/market/v1beta2/service.registry.ts +++ b/__fixtures__/v-next/outputv4/akash/market/v1beta2/service.registry.ts @@ -2,13 +2,8 @@ import { OrderID, OrderIDSDKType } from "./order.js"; import { DecCoin, DecCoinSDKType, Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin.js"; import { BidID, BidIDSDKType, MsgCreateBid, MsgCreateBidSDKType, MsgCloseBid, MsgCloseBidSDKType } from "./bid.js"; import { LeaseID, LeaseIDSDKType, MsgWithdrawLease, MsgWithdrawLeaseSDKType, MsgCreateLease, MsgCreateLeaseSDKType, MsgCloseLease, MsgCloseLeaseSDKType } from "./lease.js"; -import { GeneratedType, Registry } from "@cosmjs/proto-signing"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/akash.market.v1beta2.MsgCreateBid", MsgCreateBid], ["/akash.market.v1beta2.MsgCloseBid", MsgCloseBid], ["/akash.market.v1beta2.MsgWithdrawLease", MsgWithdrawLease], ["/akash.market.v1beta2.MsgCreateLease", MsgCreateLease], ["/akash.market.v1beta2.MsgCloseLease", MsgCloseLease]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; +import { TelescopeGeneratedType } from "../../../types.js"; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/akash.market.v1beta2.MsgCreateBid", MsgCreateBid], ["/akash.market.v1beta2.MsgCloseBid", MsgCloseBid], ["/akash.market.v1beta2.MsgWithdrawLease", MsgWithdrawLease], ["/akash.market.v1beta2.MsgCreateLease", MsgCreateLease], ["/akash.market.v1beta2.MsgCloseLease", MsgCloseLease]]; export const MessageComposer = { encoded: { createBid(value: MsgCreateBid) { diff --git a/__fixtures__/v-next/outputv4/akash/market/v1beta2/service.rpc.func.ts b/__fixtures__/v-next/outputv4/akash/market/v1beta2/service.rpc.func.ts new file mode 100644 index 0000000000..b63038dfb3 --- /dev/null +++ b/__fixtures__/v-next/outputv4/akash/market/v1beta2/service.rpc.func.ts @@ -0,0 +1,50 @@ +import { OrderID, OrderIDSDKType } from "./order.js"; +import { DecCoin, DecCoinSDKType, Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin.js"; +import { BidID, BidIDSDKType, MsgCreateBid, MsgCreateBidSDKType, MsgCreateBidResponse, MsgCreateBidResponseSDKType, MsgCloseBid, MsgCloseBidSDKType, MsgCloseBidResponse, MsgCloseBidResponseSDKType } from "./bid.js"; +import { LeaseID, LeaseIDSDKType, MsgWithdrawLease, MsgWithdrawLeaseSDKType, MsgWithdrawLeaseResponse, MsgWithdrawLeaseResponseSDKType, MsgCreateLease, MsgCreateLeaseSDKType, MsgCreateLeaseResponse, MsgCreateLeaseResponseSDKType, MsgCloseLease, MsgCloseLeaseSDKType, MsgCloseLeaseResponse, MsgCloseLeaseResponseSDKType } from "./lease.js"; +import { buildTx } from "../../../helper-func-types.js"; +/** + * CreateBid defines a method to create a bid given proper inputs. + * @name createBid + * @package akash.market.v1beta2 + * @see proto service: akash.market.v1beta2.CreateBid + */ +export const createBid = buildTx({ + msg: MsgCreateBid +}); +/** + * CloseBid defines a method to close a bid given proper inputs. + * @name closeBid + * @package akash.market.v1beta2 + * @see proto service: akash.market.v1beta2.CloseBid + */ +export const closeBid = buildTx({ + msg: MsgCloseBid +}); +/** + * WithdrawLease withdraws accrued funds from the lease payment + * @name withdrawLease + * @package akash.market.v1beta2 + * @see proto service: akash.market.v1beta2.WithdrawLease + */ +export const withdrawLease = buildTx({ + msg: MsgWithdrawLease +}); +/** + * CreateLease creates a new lease + * @name createLease + * @package akash.market.v1beta2 + * @see proto service: akash.market.v1beta2.CreateLease + */ +export const createLease = buildTx({ + msg: MsgCreateLease +}); +/** + * CloseLease defines a method to close an order given proper inputs. + * @name closeLease + * @package akash.market.v1beta2 + * @see proto service: akash.market.v1beta2.CloseLease + */ +export const closeLease = buildTx({ + msg: MsgCloseLease +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/akash/market/v1beta2/service.rpc.msg.ts b/__fixtures__/v-next/outputv4/akash/market/v1beta2/service.rpc.msg.ts index d260ba1c81..6009dca3f8 100644 --- a/__fixtures__/v-next/outputv4/akash/market/v1beta2/service.rpc.msg.ts +++ b/__fixtures__/v-next/outputv4/akash/market/v1beta2/service.rpc.msg.ts @@ -2,7 +2,7 @@ import { OrderID, OrderIDSDKType } from "./order.js"; import { DecCoin, DecCoinSDKType, Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin.js"; import { BidID, BidIDSDKType, MsgCreateBid, MsgCreateBidSDKType, MsgCreateBidResponse, MsgCreateBidResponseSDKType, MsgCloseBid, MsgCloseBidSDKType, MsgCloseBidResponse, MsgCloseBidResponseSDKType } from "./bid.js"; import { LeaseID, LeaseIDSDKType, MsgWithdrawLease, MsgWithdrawLeaseSDKType, MsgWithdrawLeaseResponse, MsgWithdrawLeaseResponseSDKType, MsgCreateLease, MsgCreateLeaseSDKType, MsgCreateLeaseResponse, MsgCreateLeaseResponseSDKType, MsgCloseLease, MsgCloseLeaseSDKType, MsgCloseLeaseResponse, MsgCloseLeaseResponseSDKType } from "./lease.js"; -import { Rpc } from "../../../helpers.js"; +import { TxRpc } from "../../../types.js"; import { BinaryReader } from "../../../binary.js"; /** Msg defines the market Msg service */ export interface Msg { @@ -18,8 +18,8 @@ export interface Msg { closeLease(request: MsgCloseLease): Promise; } export class MsgClientImpl implements Msg { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; } /* CreateBid defines a method to create a bid given proper inputs. */ @@ -53,6 +53,6 @@ export class MsgClientImpl implements Msg { return promise.then(data => MsgCloseLeaseResponse.decode(new BinaryReader(data))); }; } -export const createClientImpl = (rpc: Rpc) => { +export const createClientImpl = (rpc: TxRpc) => { return new MsgClientImpl(rpc); }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/akash/provider/v1beta1/provider.registry.ts b/__fixtures__/v-next/outputv4/akash/provider/v1beta1/provider.registry.ts index db9a938abf..b77f123e25 100644 --- a/__fixtures__/v-next/outputv4/akash/provider/v1beta1/provider.registry.ts +++ b/__fixtures__/v-next/outputv4/akash/provider/v1beta1/provider.registry.ts @@ -1,12 +1,7 @@ import { Attribute, AttributeSDKType } from "../../base/v1beta1/attribute.js"; -import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { TelescopeGeneratedType } from "../../../types.js"; import { MsgCreateProvider, MsgCreateProviderSDKType, MsgUpdateProvider, MsgUpdateProviderSDKType, MsgDeleteProvider, MsgDeleteProviderSDKType } from "./provider.js"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/akash.provider.v1beta1.MsgCreateProvider", MsgCreateProvider], ["/akash.provider.v1beta1.MsgUpdateProvider", MsgUpdateProvider], ["/akash.provider.v1beta1.MsgDeleteProvider", MsgDeleteProvider]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/akash.provider.v1beta1.MsgCreateProvider", MsgCreateProvider], ["/akash.provider.v1beta1.MsgUpdateProvider", MsgUpdateProvider], ["/akash.provider.v1beta1.MsgDeleteProvider", MsgDeleteProvider]]; export const MessageComposer = { encoded: { createProvider(value: MsgCreateProvider) { diff --git a/__fixtures__/v-next/outputv4/akash/provider/v1beta1/provider.rpc.func.ts b/__fixtures__/v-next/outputv4/akash/provider/v1beta1/provider.rpc.func.ts new file mode 100644 index 0000000000..2a32fda5da --- /dev/null +++ b/__fixtures__/v-next/outputv4/akash/provider/v1beta1/provider.rpc.func.ts @@ -0,0 +1,30 @@ +import { Attribute, AttributeSDKType } from "../../base/v1beta1/attribute.js"; +import { buildTx } from "../../../helper-func-types.js"; +import { MsgCreateProvider, MsgCreateProviderSDKType, MsgCreateProviderResponse, MsgCreateProviderResponseSDKType, MsgUpdateProvider, MsgUpdateProviderSDKType, MsgUpdateProviderResponse, MsgUpdateProviderResponseSDKType, MsgDeleteProvider, MsgDeleteProviderSDKType, MsgDeleteProviderResponse, MsgDeleteProviderResponseSDKType } from "./provider.js"; +/** + * CreateProvider defines a method that creates a provider given the proper inputs + * @name createProvider + * @package akash.provider.v1beta1 + * @see proto service: akash.provider.v1beta1.CreateProvider + */ +export const createProvider = buildTx({ + msg: MsgCreateProvider +}); +/** + * UpdateProvider defines a method that updates a provider given the proper inputs + * @name updateProvider + * @package akash.provider.v1beta1 + * @see proto service: akash.provider.v1beta1.UpdateProvider + */ +export const updateProvider = buildTx({ + msg: MsgUpdateProvider +}); +/** + * DeleteProvider defines a method that deletes a provider given the proper inputs + * @name deleteProvider + * @package akash.provider.v1beta1 + * @see proto service: akash.provider.v1beta1.DeleteProvider + */ +export const deleteProvider = buildTx({ + msg: MsgDeleteProvider +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/akash/provider/v1beta1/provider.rpc.msg.ts b/__fixtures__/v-next/outputv4/akash/provider/v1beta1/provider.rpc.msg.ts index 5673771a18..f224614e50 100644 --- a/__fixtures__/v-next/outputv4/akash/provider/v1beta1/provider.rpc.msg.ts +++ b/__fixtures__/v-next/outputv4/akash/provider/v1beta1/provider.rpc.msg.ts @@ -1,5 +1,5 @@ import { Attribute, AttributeSDKType } from "../../base/v1beta1/attribute.js"; -import { Rpc } from "../../../helpers.js"; +import { TxRpc } from "../../../types.js"; import { BinaryReader } from "../../../binary.js"; import { MsgCreateProvider, MsgCreateProviderSDKType, MsgCreateProviderResponse, MsgCreateProviderResponseSDKType, MsgUpdateProvider, MsgUpdateProviderSDKType, MsgUpdateProviderResponse, MsgUpdateProviderResponseSDKType, MsgDeleteProvider, MsgDeleteProviderSDKType, MsgDeleteProviderResponse, MsgDeleteProviderResponseSDKType } from "./provider.js"; /** Msg defines the provider Msg service */ @@ -12,8 +12,8 @@ export interface Msg { deleteProvider(request: MsgDeleteProvider): Promise; } export class MsgClientImpl implements Msg { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; } /* CreateProvider defines a method that creates a provider given the proper inputs */ @@ -35,6 +35,6 @@ export class MsgClientImpl implements Msg { return promise.then(data => MsgDeleteProviderResponse.decode(new BinaryReader(data))); }; } -export const createClientImpl = (rpc: Rpc) => { +export const createClientImpl = (rpc: TxRpc) => { return new MsgClientImpl(rpc); }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/akash/provider/v1beta2/provider.registry.ts b/__fixtures__/v-next/outputv4/akash/provider/v1beta2/provider.registry.ts index 4f82ef2ec0..97dd2a13e5 100644 --- a/__fixtures__/v-next/outputv4/akash/provider/v1beta2/provider.registry.ts +++ b/__fixtures__/v-next/outputv4/akash/provider/v1beta2/provider.registry.ts @@ -1,12 +1,7 @@ import { Attribute, AttributeSDKType } from "../../base/v1beta2/attribute.js"; -import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { TelescopeGeneratedType } from "../../../types.js"; import { MsgCreateProvider, MsgCreateProviderSDKType, MsgUpdateProvider, MsgUpdateProviderSDKType, MsgDeleteProvider, MsgDeleteProviderSDKType } from "./provider.js"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/akash.provider.v1beta2.MsgCreateProvider", MsgCreateProvider], ["/akash.provider.v1beta2.MsgUpdateProvider", MsgUpdateProvider], ["/akash.provider.v1beta2.MsgDeleteProvider", MsgDeleteProvider]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/akash.provider.v1beta2.MsgCreateProvider", MsgCreateProvider], ["/akash.provider.v1beta2.MsgUpdateProvider", MsgUpdateProvider], ["/akash.provider.v1beta2.MsgDeleteProvider", MsgDeleteProvider]]; export const MessageComposer = { encoded: { createProvider(value: MsgCreateProvider) { diff --git a/__fixtures__/v-next/outputv4/akash/provider/v1beta2/provider.rpc.func.ts b/__fixtures__/v-next/outputv4/akash/provider/v1beta2/provider.rpc.func.ts new file mode 100644 index 0000000000..ed9a59dad6 --- /dev/null +++ b/__fixtures__/v-next/outputv4/akash/provider/v1beta2/provider.rpc.func.ts @@ -0,0 +1,30 @@ +import { Attribute, AttributeSDKType } from "../../base/v1beta2/attribute.js"; +import { buildTx } from "../../../helper-func-types.js"; +import { MsgCreateProvider, MsgCreateProviderSDKType, MsgCreateProviderResponse, MsgCreateProviderResponseSDKType, MsgUpdateProvider, MsgUpdateProviderSDKType, MsgUpdateProviderResponse, MsgUpdateProviderResponseSDKType, MsgDeleteProvider, MsgDeleteProviderSDKType, MsgDeleteProviderResponse, MsgDeleteProviderResponseSDKType } from "./provider.js"; +/** + * CreateProvider defines a method that creates a provider given the proper inputs + * @name createProvider + * @package akash.provider.v1beta2 + * @see proto service: akash.provider.v1beta2.CreateProvider + */ +export const createProvider = buildTx({ + msg: MsgCreateProvider +}); +/** + * UpdateProvider defines a method that updates a provider given the proper inputs + * @name updateProvider + * @package akash.provider.v1beta2 + * @see proto service: akash.provider.v1beta2.UpdateProvider + */ +export const updateProvider = buildTx({ + msg: MsgUpdateProvider +}); +/** + * DeleteProvider defines a method that deletes a provider given the proper inputs + * @name deleteProvider + * @package akash.provider.v1beta2 + * @see proto service: akash.provider.v1beta2.DeleteProvider + */ +export const deleteProvider = buildTx({ + msg: MsgDeleteProvider +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/akash/provider/v1beta2/provider.rpc.msg.ts b/__fixtures__/v-next/outputv4/akash/provider/v1beta2/provider.rpc.msg.ts index d0d8c37103..7a10efde8c 100644 --- a/__fixtures__/v-next/outputv4/akash/provider/v1beta2/provider.rpc.msg.ts +++ b/__fixtures__/v-next/outputv4/akash/provider/v1beta2/provider.rpc.msg.ts @@ -1,5 +1,5 @@ import { Attribute, AttributeSDKType } from "../../base/v1beta2/attribute.js"; -import { Rpc } from "../../../helpers.js"; +import { TxRpc } from "../../../types.js"; import { BinaryReader } from "../../../binary.js"; import { MsgCreateProvider, MsgCreateProviderSDKType, MsgCreateProviderResponse, MsgCreateProviderResponseSDKType, MsgUpdateProvider, MsgUpdateProviderSDKType, MsgUpdateProviderResponse, MsgUpdateProviderResponseSDKType, MsgDeleteProvider, MsgDeleteProviderSDKType, MsgDeleteProviderResponse, MsgDeleteProviderResponseSDKType } from "./provider.js"; /** Msg defines the provider Msg service */ @@ -12,8 +12,8 @@ export interface Msg { deleteProvider(request: MsgDeleteProvider): Promise; } export class MsgClientImpl implements Msg { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; } /* CreateProvider defines a method that creates a provider given the proper inputs */ @@ -35,6 +35,6 @@ export class MsgClientImpl implements Msg { return promise.then(data => MsgDeleteProviderResponse.decode(new BinaryReader(data))); }; } -export const createClientImpl = (rpc: Rpc) => { +export const createClientImpl = (rpc: TxRpc) => { return new MsgClientImpl(rpc); }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/akash/provider/v1beta2/query.rpc.Query.ts b/__fixtures__/v-next/outputv4/akash/provider/v1beta2/query.rpc.Query.ts index ca9b6e7fa6..f284d1c8e7 100644 --- a/__fixtures__/v-next/outputv4/akash/provider/v1beta2/query.rpc.Query.ts +++ b/__fixtures__/v-next/outputv4/akash/provider/v1beta2/query.rpc.Query.ts @@ -1,6 +1,6 @@ import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination.js"; import { Provider, ProviderSDKType } from "./provider.js"; -import { Rpc } from "../../../helpers.js"; +import { TxRpc } from "../../../types.js"; import { BinaryReader } from "../../../binary.js"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; import { QueryProvidersRequest, QueryProvidersRequestSDKType, QueryProvidersResponse, QueryProvidersResponseSDKType, QueryProviderRequest, QueryProviderRequestSDKType, QueryProviderResponse, QueryProviderResponseSDKType } from "./query.js"; @@ -12,8 +12,8 @@ export interface Query { provider(request: QueryProviderRequest): Promise; } export class QueryClientImpl implements Query { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; } /* Providers queries providers */ diff --git a/__fixtures__/v-next/outputv4/akash/provider/v1beta2/query.rpc.func.ts b/__fixtures__/v-next/outputv4/akash/provider/v1beta2/query.rpc.func.ts new file mode 100644 index 0000000000..0e0363c4a3 --- /dev/null +++ b/__fixtures__/v-next/outputv4/akash/provider/v1beta2/query.rpc.func.ts @@ -0,0 +1,28 @@ +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination.js"; +import { Provider, ProviderSDKType } from "./provider.js"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types.js"; +import { QueryProvidersRequest, QueryProvidersRequestSDKType, QueryProvidersResponse, QueryProvidersResponseSDKType, QueryProviderRequest, QueryProviderRequestSDKType, QueryProviderResponse, QueryProviderResponseSDKType } from "./query.js"; +/** + * Providers queries providers + * @name getProviders + * @package akash.provider.v1beta2 + * @see proto service: akash.provider.v1beta2.Providers + */ +export const getProviders = buildQuery({ + encode: QueryProvidersRequest.encode, + decode: QueryProvidersResponse.decode, + service: "akash.provider.v1beta2.Query", + method: "Providers" +}); +/** + * Provider queries provider details + * @name getProvider + * @package akash.provider.v1beta2 + * @see proto service: akash.provider.v1beta2.Provider + */ +export const getProvider = buildQuery({ + encode: QueryProviderRequest.encode, + decode: QueryProviderResponse.decode, + service: "akash.provider.v1beta2.Query", + method: "Provider" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/cosmos/app/v1alpha1/query.rpc.Query.ts b/__fixtures__/v-next/outputv4/cosmos/app/v1alpha1/query.rpc.Query.ts index ac71cea766..dda5a9188c 100644 --- a/__fixtures__/v-next/outputv4/cosmos/app/v1alpha1/query.rpc.Query.ts +++ b/__fixtures__/v-next/outputv4/cosmos/app/v1alpha1/query.rpc.Query.ts @@ -1,5 +1,5 @@ import { Config, ConfigSDKType } from "./config.js"; -import { Rpc } from "../../../helpers.js"; +import { TxRpc } from "../../../types.js"; import { BinaryReader } from "../../../binary.js"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; import { QueryConfigRequest, QueryConfigRequestSDKType, QueryConfigResponse, QueryConfigResponseSDKType } from "./query.js"; @@ -9,8 +9,8 @@ export interface Query { config(request?: QueryConfigRequest): Promise; } export class QueryClientImpl implements Query { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.config = this.config.bind(this); } diff --git a/__fixtures__/v-next/outputv4/cosmos/app/v1alpha1/query.rpc.func.ts b/__fixtures__/v-next/outputv4/cosmos/app/v1alpha1/query.rpc.func.ts new file mode 100644 index 0000000000..6a0adb5190 --- /dev/null +++ b/__fixtures__/v-next/outputv4/cosmos/app/v1alpha1/query.rpc.func.ts @@ -0,0 +1,15 @@ +import { Config, ConfigSDKType } from "./config.js"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types.js"; +import { QueryConfigRequest, QueryConfigRequestSDKType, QueryConfigResponse, QueryConfigResponseSDKType } from "./query.js"; +/** + * Config returns the current app config. + * @name getConfig + * @package cosmos.app.v1alpha1 + * @see proto service: cosmos.app.v1alpha1.Config + */ +export const getConfig = buildQuery({ + encode: QueryConfigRequest.encode, + decode: QueryConfigResponse.decode, + service: "cosmos.app.v1alpha1.Query", + method: "Config" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/cosmos/auth/v1beta1/query.rpc.Query.ts b/__fixtures__/v-next/outputv4/cosmos/auth/v1beta1/query.rpc.Query.ts index 828662a3b0..7f3c90706a 100644 --- a/__fixtures__/v-next/outputv4/cosmos/auth/v1beta1/query.rpc.Query.ts +++ b/__fixtures__/v-next/outputv4/cosmos/auth/v1beta1/query.rpc.Query.ts @@ -1,7 +1,7 @@ import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination.js"; import { Any, AnySDKType } from "../../../google/protobuf/any.js"; import { Params, ParamsSDKType } from "./auth.js"; -import { Rpc } from "../../../helpers.js"; +import { TxRpc } from "../../../types.js"; import { BinaryReader } from "../../../binary.js"; import { QueryClient, createProtobufRpcClient, ProtobufRpcClient } from "@cosmjs/stargate"; import { ReactQueryParams } from "../../../react-query.js"; @@ -29,8 +29,8 @@ export interface Query { addressStringToBytes(request: AddressStringToBytesRequest): Promise; } export class QueryClientImpl implements Query { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.accounts = this.accounts.bind(this); this.account = this.account.bind(this); diff --git a/__fixtures__/v-next/outputv4/cosmos/auth/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputv4/cosmos/auth/v1beta1/query.rpc.func.ts new file mode 100644 index 0000000000..93a2db2b12 --- /dev/null +++ b/__fixtures__/v-next/outputv4/cosmos/auth/v1beta1/query.rpc.func.ts @@ -0,0 +1,91 @@ +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination.js"; +import { Any, AnySDKType } from "../../../google/protobuf/any.js"; +import { Params, ParamsSDKType } from "./auth.js"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types.js"; +import { QueryAccountsRequest, QueryAccountsRequestSDKType, QueryAccountsResponse, QueryAccountsResponseSDKType, QueryAccountRequest, QueryAccountRequestSDKType, QueryAccountResponse, QueryAccountResponseSDKType, QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, QueryModuleAccountsRequest, QueryModuleAccountsRequestSDKType, QueryModuleAccountsResponse, QueryModuleAccountsResponseSDKType, Bech32PrefixRequest, Bech32PrefixRequestSDKType, Bech32PrefixResponse, Bech32PrefixResponseSDKType, AddressBytesToStringRequest, AddressBytesToStringRequestSDKType, AddressBytesToStringResponse, AddressBytesToStringResponseSDKType, AddressStringToBytesRequest, AddressStringToBytesRequestSDKType, AddressStringToBytesResponse, AddressStringToBytesResponseSDKType } from "./query.js"; +/** + * Accounts returns all the existing accounts + * + * Since: cosmos-sdk 0.43 + * @name getAccounts + * @package cosmos.auth.v1beta1 + * @see proto service: cosmos.auth.v1beta1.Accounts + */ +export const getAccounts = buildQuery({ + encode: QueryAccountsRequest.encode, + decode: QueryAccountsResponse.decode, + service: "cosmos.auth.v1beta1.Query", + method: "Accounts" +}); +/** + * Account returns account details based on address. + * @name getAccount + * @package cosmos.auth.v1beta1 + * @see proto service: cosmos.auth.v1beta1.Account + */ +export const getAccount = buildQuery({ + encode: QueryAccountRequest.encode, + decode: QueryAccountResponse.decode, + service: "cosmos.auth.v1beta1.Query", + method: "Account" +}); +/** + * Params queries all parameters. + * @name getParams + * @package cosmos.auth.v1beta1 + * @see proto service: cosmos.auth.v1beta1.Params + */ +export const getParams = buildQuery({ + encode: QueryParamsRequest.encode, + decode: QueryParamsResponse.decode, + service: "cosmos.auth.v1beta1.Query", + method: "Params" +}); +/** + * ModuleAccounts returns all the existing module accounts. + * @name getModuleAccounts + * @package cosmos.auth.v1beta1 + * @see proto service: cosmos.auth.v1beta1.ModuleAccounts + */ +export const getModuleAccounts = buildQuery({ + encode: QueryModuleAccountsRequest.encode, + decode: QueryModuleAccountsResponse.decode, + service: "cosmos.auth.v1beta1.Query", + method: "ModuleAccounts" +}); +/** + * Bech32 queries bech32Prefix + * @name getBech32Prefix + * @package cosmos.auth.v1beta1 + * @see proto service: cosmos.auth.v1beta1.Bech32Prefix + */ +export const getBech32Prefix = buildQuery({ + encode: Bech32PrefixRequest.encode, + decode: Bech32PrefixResponse.decode, + service: "cosmos.auth.v1beta1.Query", + method: "Bech32Prefix" +}); +/** + * AddressBytesToString converts Account Address bytes to string + * @name getAddressBytesToString + * @package cosmos.auth.v1beta1 + * @see proto service: cosmos.auth.v1beta1.AddressBytesToString + */ +export const getAddressBytesToString = buildQuery({ + encode: AddressBytesToStringRequest.encode, + decode: AddressBytesToStringResponse.decode, + service: "cosmos.auth.v1beta1.Query", + method: "AddressBytesToString" +}); +/** + * AddressStringToBytes converts Address string to bytes + * @name getAddressStringToBytes + * @package cosmos.auth.v1beta1 + * @see proto service: cosmos.auth.v1beta1.AddressStringToBytes + */ +export const getAddressStringToBytes = buildQuery({ + encode: AddressStringToBytesRequest.encode, + decode: AddressStringToBytesResponse.decode, + service: "cosmos.auth.v1beta1.Query", + method: "AddressStringToBytes" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/cosmos/authz/v1beta1/query.rpc.Query.ts b/__fixtures__/v-next/outputv4/cosmos/authz/v1beta1/query.rpc.Query.ts index e22e435eb1..2274d55051 100644 --- a/__fixtures__/v-next/outputv4/cosmos/authz/v1beta1/query.rpc.Query.ts +++ b/__fixtures__/v-next/outputv4/cosmos/authz/v1beta1/query.rpc.Query.ts @@ -1,6 +1,6 @@ import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination.js"; import { Grant, GrantSDKType, GrantAuthorization, GrantAuthorizationSDKType } from "./authz.js"; -import { Rpc } from "../../../helpers.js"; +import { TxRpc } from "../../../types.js"; import { BinaryReader } from "../../../binary.js"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; import { QueryGrantsRequest, QueryGrantsRequestSDKType, QueryGrantsResponse, QueryGrantsResponseSDKType, QueryGranterGrantsRequest, QueryGranterGrantsRequestSDKType, QueryGranterGrantsResponse, QueryGranterGrantsResponseSDKType, QueryGranteeGrantsRequest, QueryGranteeGrantsRequestSDKType, QueryGranteeGrantsResponse, QueryGranteeGrantsResponseSDKType } from "./query.js"; @@ -22,8 +22,8 @@ export interface Query { granteeGrants(request: QueryGranteeGrantsRequest): Promise; } export class QueryClientImpl implements Query { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.grants = this.grants.bind(this); this.granterGrants = this.granterGrants.bind(this); diff --git a/__fixtures__/v-next/outputv4/cosmos/authz/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputv4/cosmos/authz/v1beta1/query.rpc.func.ts new file mode 100644 index 0000000000..434f15a9d8 --- /dev/null +++ b/__fixtures__/v-next/outputv4/cosmos/authz/v1beta1/query.rpc.func.ts @@ -0,0 +1,44 @@ +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination.js"; +import { Grant, GrantSDKType, GrantAuthorization, GrantAuthorizationSDKType } from "./authz.js"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types.js"; +import { QueryGrantsRequest, QueryGrantsRequestSDKType, QueryGrantsResponse, QueryGrantsResponseSDKType, QueryGranterGrantsRequest, QueryGranterGrantsRequestSDKType, QueryGranterGrantsResponse, QueryGranterGrantsResponseSDKType, QueryGranteeGrantsRequest, QueryGranteeGrantsRequestSDKType, QueryGranteeGrantsResponse, QueryGranteeGrantsResponseSDKType } from "./query.js"; +/** + * Returns list of `Authorization`, granted to the grantee by the granter. + * @name getGrants + * @package cosmos.authz.v1beta1 + * @see proto service: cosmos.authz.v1beta1.Grants + */ +export const getGrants = buildQuery({ + encode: QueryGrantsRequest.encode, + decode: QueryGrantsResponse.decode, + service: "cosmos.authz.v1beta1.Query", + method: "Grants" +}); +/** + * GranterGrants returns list of `GrantAuthorization`, granted by granter. + * + * Since: cosmos-sdk 0.46 + * @name getGranterGrants + * @package cosmos.authz.v1beta1 + * @see proto service: cosmos.authz.v1beta1.GranterGrants + */ +export const getGranterGrants = buildQuery({ + encode: QueryGranterGrantsRequest.encode, + decode: QueryGranterGrantsResponse.decode, + service: "cosmos.authz.v1beta1.Query", + method: "GranterGrants" +}); +/** + * GranteeGrants returns a list of `GrantAuthorization` by grantee. + * + * Since: cosmos-sdk 0.46 + * @name getGranteeGrants + * @package cosmos.authz.v1beta1 + * @see proto service: cosmos.authz.v1beta1.GranteeGrants + */ +export const getGranteeGrants = buildQuery({ + encode: QueryGranteeGrantsRequest.encode, + decode: QueryGranteeGrantsResponse.decode, + service: "cosmos.authz.v1beta1.Query", + method: "GranteeGrants" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/cosmos/authz/v1beta1/tx.registry.ts b/__fixtures__/v-next/outputv4/cosmos/authz/v1beta1/tx.registry.ts index 2aaa8a5465..2bf53b1459 100644 --- a/__fixtures__/v-next/outputv4/cosmos/authz/v1beta1/tx.registry.ts +++ b/__fixtures__/v-next/outputv4/cosmos/authz/v1beta1/tx.registry.ts @@ -1,13 +1,8 @@ import { Grant, GrantSDKType } from "./authz.js"; import { Any, AnySDKType } from "../../../google/protobuf/any.js"; -import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { TelescopeGeneratedType } from "../../../types.js"; import { MsgGrant, MsgGrantSDKType, MsgExec, MsgExecSDKType, MsgRevoke, MsgRevokeSDKType } from "./tx.js"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/cosmos.authz.v1beta1.MsgGrant", MsgGrant], ["/cosmos.authz.v1beta1.MsgExec", MsgExec], ["/cosmos.authz.v1beta1.MsgRevoke", MsgRevoke]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/cosmos.authz.v1beta1.MsgGrant", MsgGrant], ["/cosmos.authz.v1beta1.MsgExec", MsgExec], ["/cosmos.authz.v1beta1.MsgRevoke", MsgRevoke]]; export const MessageComposer = { encoded: { grant(value: MsgGrant) { diff --git a/__fixtures__/v-next/outputv4/cosmos/authz/v1beta1/tx.rpc.func.ts b/__fixtures__/v-next/outputv4/cosmos/authz/v1beta1/tx.rpc.func.ts new file mode 100644 index 0000000000..520dc6e39d --- /dev/null +++ b/__fixtures__/v-next/outputv4/cosmos/authz/v1beta1/tx.rpc.func.ts @@ -0,0 +1,37 @@ +import { Grant, GrantSDKType } from "./authz.js"; +import { Any, AnySDKType } from "../../../google/protobuf/any.js"; +import { buildTx } from "../../../helper-func-types.js"; +import { MsgGrant, MsgGrantSDKType, MsgGrantResponse, MsgGrantResponseSDKType, MsgExec, MsgExecSDKType, MsgExecResponse, MsgExecResponseSDKType, MsgRevoke, MsgRevokeSDKType, MsgRevokeResponse, MsgRevokeResponseSDKType } from "./tx.js"; +/** + * Grant grants the provided authorization to the grantee on the granter's + * account with the provided expiration time. If there is already a grant + * for the given (granter, grantee, Authorization) triple, then the grant + * will be overwritten. + * @name grant + * @package cosmos.authz.v1beta1 + * @see proto service: cosmos.authz.v1beta1.Grant + */ +export const grant = buildTx({ + msg: MsgGrant +}); +/** + * Exec attempts to execute the provided messages using + * authorizations granted to the grantee. Each message should have only + * one signer corresponding to the granter of the authorization. + * @name exec + * @package cosmos.authz.v1beta1 + * @see proto service: cosmos.authz.v1beta1.Exec + */ +export const exec = buildTx({ + msg: MsgExec +}); +/** + * Revoke revokes any authorization corresponding to the provided method name on the + * granter's account that has been granted to the grantee. + * @name revoke + * @package cosmos.authz.v1beta1 + * @see proto service: cosmos.authz.v1beta1.Revoke + */ +export const revoke = buildTx({ + msg: MsgRevoke +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/cosmos/authz/v1beta1/tx.rpc.msg.ts b/__fixtures__/v-next/outputv4/cosmos/authz/v1beta1/tx.rpc.msg.ts index 3dc11bc1c9..f81828ebb9 100644 --- a/__fixtures__/v-next/outputv4/cosmos/authz/v1beta1/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputv4/cosmos/authz/v1beta1/tx.rpc.msg.ts @@ -1,6 +1,6 @@ import { Grant, GrantSDKType } from "./authz.js"; import { Any, AnySDKType } from "../../../google/protobuf/any.js"; -import { Rpc } from "../../../helpers.js"; +import { TxRpc } from "../../../types.js"; import { BinaryReader } from "../../../binary.js"; import { MsgGrant, MsgGrantSDKType, MsgGrantResponse, MsgGrantResponseSDKType, MsgExec, MsgExecSDKType, MsgExecResponse, MsgExecResponseSDKType, MsgRevoke, MsgRevokeSDKType, MsgRevokeResponse, MsgRevokeResponseSDKType } from "./tx.js"; /** Msg defines the authz Msg service. */ @@ -25,8 +25,8 @@ export interface Msg { revoke(request: MsgRevoke): Promise; } export class MsgClientImpl implements Msg { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.grant = this.grant.bind(this); this.exec = this.exec.bind(this); @@ -48,6 +48,6 @@ export class MsgClientImpl implements Msg { return promise.then(data => MsgRevokeResponse.decode(new BinaryReader(data))); } } -export const createClientImpl = (rpc: Rpc) => { +export const createClientImpl = (rpc: TxRpc) => { return new MsgClientImpl(rpc); }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/cosmos/bank/v1beta1/query.rpc.Query.ts b/__fixtures__/v-next/outputv4/cosmos/bank/v1beta1/query.rpc.Query.ts index a89321c1bb..6c358a2e70 100644 --- a/__fixtures__/v-next/outputv4/cosmos/bank/v1beta1/query.rpc.Query.ts +++ b/__fixtures__/v-next/outputv4/cosmos/bank/v1beta1/query.rpc.Query.ts @@ -1,7 +1,7 @@ import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination.js"; import { Coin, CoinSDKType } from "../../base/v1beta1/coin.js"; import { Params, ParamsSDKType, Metadata, MetadataSDKType } from "./bank.js"; -import { Rpc } from "../../../helpers.js"; +import { TxRpc } from "../../../types.js"; import { BinaryReader } from "../../../binary.js"; import { QueryClient, createProtobufRpcClient, ProtobufRpcClient } from "@cosmjs/stargate"; import { ReactQueryParams } from "../../../react-query.js"; @@ -38,8 +38,8 @@ export interface Query { denomOwners(request: QueryDenomOwnersRequest): Promise; } export class QueryClientImpl implements Query { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.balance = this.balance.bind(this); this.allBalances = this.allBalances.bind(this); diff --git a/__fixtures__/v-next/outputv4/cosmos/bank/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputv4/cosmos/bank/v1beta1/query.rpc.func.ts new file mode 100644 index 0000000000..f77707d72c --- /dev/null +++ b/__fixtures__/v-next/outputv4/cosmos/bank/v1beta1/query.rpc.func.ts @@ -0,0 +1,116 @@ +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination.js"; +import { Coin, CoinSDKType } from "../../base/v1beta1/coin.js"; +import { Params, ParamsSDKType, Metadata, MetadataSDKType } from "./bank.js"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types.js"; +import { QueryBalanceRequest, QueryBalanceRequestSDKType, QueryBalanceResponse, QueryBalanceResponseSDKType, QueryAllBalancesRequest, QueryAllBalancesRequestSDKType, QueryAllBalancesResponse, QueryAllBalancesResponseSDKType, QuerySpendableBalancesRequest, QuerySpendableBalancesRequestSDKType, QuerySpendableBalancesResponse, QuerySpendableBalancesResponseSDKType, QueryTotalSupplyRequest, QueryTotalSupplyRequestSDKType, QueryTotalSupplyResponse, QueryTotalSupplyResponseSDKType, QuerySupplyOfRequest, QuerySupplyOfRequestSDKType, QuerySupplyOfResponse, QuerySupplyOfResponseSDKType, QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, QueryDenomMetadataRequest, QueryDenomMetadataRequestSDKType, QueryDenomMetadataResponse, QueryDenomMetadataResponseSDKType, QueryDenomsMetadataRequest, QueryDenomsMetadataRequestSDKType, QueryDenomsMetadataResponse, QueryDenomsMetadataResponseSDKType, QueryDenomOwnersRequest, QueryDenomOwnersRequestSDKType, QueryDenomOwnersResponse, QueryDenomOwnersResponseSDKType } from "./query.js"; +/** + * Balance queries the balance of a single coin for a single account. + * @name getBalance + * @package cosmos.bank.v1beta1 + * @see proto service: cosmos.bank.v1beta1.Balance + */ +export const getBalance = buildQuery({ + encode: QueryBalanceRequest.encode, + decode: QueryBalanceResponse.decode, + service: "cosmos.bank.v1beta1.Query", + method: "Balance" +}); +/** + * AllBalances queries the balance of all coins for a single account. + * @name getAllBalances + * @package cosmos.bank.v1beta1 + * @see proto service: cosmos.bank.v1beta1.AllBalances + */ +export const getAllBalances = buildQuery({ + encode: QueryAllBalancesRequest.encode, + decode: QueryAllBalancesResponse.decode, + service: "cosmos.bank.v1beta1.Query", + method: "AllBalances" +}); +/** + * SpendableBalances queries the spenable balance of all coins for a single + * account. + * @name getSpendableBalances + * @package cosmos.bank.v1beta1 + * @see proto service: cosmos.bank.v1beta1.SpendableBalances + */ +export const getSpendableBalances = buildQuery({ + encode: QuerySpendableBalancesRequest.encode, + decode: QuerySpendableBalancesResponse.decode, + service: "cosmos.bank.v1beta1.Query", + method: "SpendableBalances" +}); +/** + * TotalSupply queries the total supply of all coins. + * @name getTotalSupply + * @package cosmos.bank.v1beta1 + * @see proto service: cosmos.bank.v1beta1.TotalSupply + */ +export const getTotalSupply = buildQuery({ + encode: QueryTotalSupplyRequest.encode, + decode: QueryTotalSupplyResponse.decode, + service: "cosmos.bank.v1beta1.Query", + method: "TotalSupply" +}); +/** + * SupplyOf queries the supply of a single coin. + * @name getSupplyOf + * @package cosmos.bank.v1beta1 + * @see proto service: cosmos.bank.v1beta1.SupplyOf + */ +export const getSupplyOf = buildQuery({ + encode: QuerySupplyOfRequest.encode, + decode: QuerySupplyOfResponse.decode, + service: "cosmos.bank.v1beta1.Query", + method: "SupplyOf" +}); +/** + * Params queries the parameters of x/bank module. + * @name getParams + * @package cosmos.bank.v1beta1 + * @see proto service: cosmos.bank.v1beta1.Params + */ +export const getParams = buildQuery({ + encode: QueryParamsRequest.encode, + decode: QueryParamsResponse.decode, + service: "cosmos.bank.v1beta1.Query", + method: "Params" +}); +/** + * DenomsMetadata queries the client metadata of a given coin denomination. + * @name getDenomMetadata + * @package cosmos.bank.v1beta1 + * @see proto service: cosmos.bank.v1beta1.DenomMetadata + */ +export const getDenomMetadata = buildQuery({ + encode: QueryDenomMetadataRequest.encode, + decode: QueryDenomMetadataResponse.decode, + service: "cosmos.bank.v1beta1.Query", + method: "DenomMetadata" +}); +/** + * DenomsMetadata queries the client metadata for all registered coin + * denominations. + * @name getDenomsMetadata + * @package cosmos.bank.v1beta1 + * @see proto service: cosmos.bank.v1beta1.DenomsMetadata + */ +export const getDenomsMetadata = buildQuery({ + encode: QueryDenomsMetadataRequest.encode, + decode: QueryDenomsMetadataResponse.decode, + service: "cosmos.bank.v1beta1.Query", + method: "DenomsMetadata" +}); +/** + * DenomOwners queries for all account addresses that own a particular token + * denomination. + * @name getDenomOwners + * @package cosmos.bank.v1beta1 + * @see proto service: cosmos.bank.v1beta1.DenomOwners + */ +export const getDenomOwners = buildQuery({ + encode: QueryDenomOwnersRequest.encode, + decode: QueryDenomOwnersResponse.decode, + service: "cosmos.bank.v1beta1.Query", + method: "DenomOwners" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/cosmos/bank/v1beta1/tx.registry.ts b/__fixtures__/v-next/outputv4/cosmos/bank/v1beta1/tx.registry.ts index 6ac4d5f72b..88dc13f106 100644 --- a/__fixtures__/v-next/outputv4/cosmos/bank/v1beta1/tx.registry.ts +++ b/__fixtures__/v-next/outputv4/cosmos/bank/v1beta1/tx.registry.ts @@ -1,13 +1,8 @@ import { Coin, CoinSDKType } from "../../base/v1beta1/coin.js"; import { Input, InputSDKType, Output, OutputSDKType } from "./bank.js"; -import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { TelescopeGeneratedType } from "../../../types.js"; import { MsgSend, MsgSendSDKType, MsgMultiSend, MsgMultiSendSDKType } from "./tx.js"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/cosmos.bank.v1beta1.MsgSend", MsgSend], ["/cosmos.bank.v1beta1.MsgMultiSend", MsgMultiSend]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/cosmos.bank.v1beta1.MsgSend", MsgSend], ["/cosmos.bank.v1beta1.MsgMultiSend", MsgMultiSend]]; export const MessageComposer = { encoded: { send(value: MsgSend) { diff --git a/__fixtures__/v-next/outputv4/cosmos/bank/v1beta1/tx.rpc.func.ts b/__fixtures__/v-next/outputv4/cosmos/bank/v1beta1/tx.rpc.func.ts new file mode 100644 index 0000000000..cc932cfa1f --- /dev/null +++ b/__fixtures__/v-next/outputv4/cosmos/bank/v1beta1/tx.rpc.func.ts @@ -0,0 +1,22 @@ +import { Coin, CoinSDKType } from "../../base/v1beta1/coin.js"; +import { Input, InputSDKType, Output, OutputSDKType } from "./bank.js"; +import { buildTx } from "../../../helper-func-types.js"; +import { MsgSend, MsgSendSDKType, MsgSendResponse, MsgSendResponseSDKType, MsgMultiSend, MsgMultiSendSDKType, MsgMultiSendResponse, MsgMultiSendResponseSDKType } from "./tx.js"; +/** + * Send defines a method for sending coins from one account to another account. + * @name send + * @package cosmos.bank.v1beta1 + * @see proto service: cosmos.bank.v1beta1.Send + */ +export const send = buildTx({ + msg: MsgSend +}); +/** + * MultiSend defines a method for sending coins from some accounts to other accounts. + * @name multiSend + * @package cosmos.bank.v1beta1 + * @see proto service: cosmos.bank.v1beta1.MultiSend + */ +export const multiSend = buildTx({ + msg: MsgMultiSend +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/cosmos/bank/v1beta1/tx.rpc.msg.ts b/__fixtures__/v-next/outputv4/cosmos/bank/v1beta1/tx.rpc.msg.ts index 50076e3fcb..c5deaf9e0c 100644 --- a/__fixtures__/v-next/outputv4/cosmos/bank/v1beta1/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputv4/cosmos/bank/v1beta1/tx.rpc.msg.ts @@ -1,6 +1,6 @@ import { Coin, CoinSDKType } from "../../base/v1beta1/coin.js"; import { Input, InputSDKType, Output, OutputSDKType } from "./bank.js"; -import { Rpc } from "../../../helpers.js"; +import { TxRpc } from "../../../types.js"; import { BinaryReader } from "../../../binary.js"; import { MsgSend, MsgSendSDKType, MsgSendResponse, MsgSendResponseSDKType, MsgMultiSend, MsgMultiSendSDKType, MsgMultiSendResponse, MsgMultiSendResponseSDKType } from "./tx.js"; /** Msg defines the bank Msg service. */ @@ -11,8 +11,8 @@ export interface Msg { multiSend(request: MsgMultiSend): Promise; } export class MsgClientImpl implements Msg { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.send = this.send.bind(this); this.multiSend = this.multiSend.bind(this); @@ -28,6 +28,6 @@ export class MsgClientImpl implements Msg { return promise.then(data => MsgMultiSendResponse.decode(new BinaryReader(data))); } } -export const createClientImpl = (rpc: Rpc) => { +export const createClientImpl = (rpc: TxRpc) => { return new MsgClientImpl(rpc); }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/cosmos/base/reflection/v1beta1/reflection.rpc.ReflectionService.ts b/__fixtures__/v-next/outputv4/cosmos/base/reflection/v1beta1/reflection.rpc.ReflectionService.ts index 6bdcf494ff..f7e8efe75b 100644 --- a/__fixtures__/v-next/outputv4/cosmos/base/reflection/v1beta1/reflection.rpc.ReflectionService.ts +++ b/__fixtures__/v-next/outputv4/cosmos/base/reflection/v1beta1/reflection.rpc.ReflectionService.ts @@ -1,4 +1,4 @@ -import { Rpc } from "../../../../helpers.js"; +import { TxRpc } from "../../../../types.js"; import { BinaryReader } from "../../../../binary.js"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; import { ListAllInterfacesRequest, ListAllInterfacesRequestSDKType, ListAllInterfacesResponse, ListAllInterfacesResponseSDKType, ListImplementationsRequest, ListImplementationsRequestSDKType, ListImplementationsResponse, ListImplementationsResponseSDKType } from "./reflection.js"; @@ -16,8 +16,8 @@ export interface ReflectionService { listImplementations(request: ListImplementationsRequest): Promise; } export class ReflectionServiceClientImpl implements ReflectionService { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.listAllInterfaces = this.listAllInterfaces.bind(this); this.listImplementations = this.listImplementations.bind(this); diff --git a/__fixtures__/v-next/outputv4/cosmos/base/reflection/v1beta1/reflection.rpc.func.ts b/__fixtures__/v-next/outputv4/cosmos/base/reflection/v1beta1/reflection.rpc.func.ts new file mode 100644 index 0000000000..09d7ff47b2 --- /dev/null +++ b/__fixtures__/v-next/outputv4/cosmos/base/reflection/v1beta1/reflection.rpc.func.ts @@ -0,0 +1,28 @@ +import { EndpointOrRpc, buildQuery } from "../../../../helper-func-types.js"; +import { ListAllInterfacesRequest, ListAllInterfacesRequestSDKType, ListAllInterfacesResponse, ListAllInterfacesResponseSDKType, ListImplementationsRequest, ListImplementationsRequestSDKType, ListImplementationsResponse, ListImplementationsResponseSDKType } from "./reflection.js"; +/** + * ListAllInterfaces lists all the interfaces registered in the interface + * registry. + * @name getListAllInterfaces + * @package cosmos.base.reflection.v1beta1 + * @see proto service: cosmos.base.reflection.v1beta1.ListAllInterfaces + */ +export const getListAllInterfaces = buildQuery({ + encode: ListAllInterfacesRequest.encode, + decode: ListAllInterfacesResponse.decode, + service: "cosmos.base.reflection.v1beta1.ReflectionService", + method: "ListAllInterfaces" +}); +/** + * ListImplementations list all the concrete types that implement a given + * interface. + * @name getListImplementations + * @package cosmos.base.reflection.v1beta1 + * @see proto service: cosmos.base.reflection.v1beta1.ListImplementations + */ +export const getListImplementations = buildQuery({ + encode: ListImplementationsRequest.encode, + decode: ListImplementationsResponse.decode, + service: "cosmos.base.reflection.v1beta1.ReflectionService", + method: "ListImplementations" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/cosmos/base/reflection/v2alpha1/reflection.rpc.ReflectionService.ts b/__fixtures__/v-next/outputv4/cosmos/base/reflection/v2alpha1/reflection.rpc.ReflectionService.ts index 84542cc6ea..ad529d7cec 100644 --- a/__fixtures__/v-next/outputv4/cosmos/base/reflection/v2alpha1/reflection.rpc.ReflectionService.ts +++ b/__fixtures__/v-next/outputv4/cosmos/base/reflection/v2alpha1/reflection.rpc.ReflectionService.ts @@ -1,4 +1,4 @@ -import { Rpc } from "../../../../helpers.js"; +import { TxRpc } from "../../../../types.js"; import { BinaryReader } from "../../../../binary.js"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; import { GetAuthnDescriptorRequest, GetAuthnDescriptorRequestSDKType, GetAuthnDescriptorResponse, GetAuthnDescriptorResponseSDKType, GetChainDescriptorRequest, GetChainDescriptorRequestSDKType, GetChainDescriptorResponse, GetChainDescriptorResponseSDKType, GetCodecDescriptorRequest, GetCodecDescriptorRequestSDKType, GetCodecDescriptorResponse, GetCodecDescriptorResponseSDKType, GetConfigurationDescriptorRequest, GetConfigurationDescriptorRequestSDKType, GetConfigurationDescriptorResponse, GetConfigurationDescriptorResponseSDKType, GetQueryServicesDescriptorRequest, GetQueryServicesDescriptorRequestSDKType, GetQueryServicesDescriptorResponse, GetQueryServicesDescriptorResponseSDKType, GetTxDescriptorRequest, GetTxDescriptorRequestSDKType, GetTxDescriptorResponse, GetTxDescriptorResponseSDKType } from "./reflection.js"; @@ -22,8 +22,8 @@ export interface ReflectionService { getTxDescriptor(request?: GetTxDescriptorRequest): Promise; } export class ReflectionServiceClientImpl implements ReflectionService { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.getAuthnDescriptor = this.getAuthnDescriptor.bind(this); this.getChainDescriptor = this.getChainDescriptor.bind(this); diff --git a/__fixtures__/v-next/outputv4/cosmos/base/reflection/v2alpha1/reflection.rpc.func.ts b/__fixtures__/v-next/outputv4/cosmos/base/reflection/v2alpha1/reflection.rpc.func.ts new file mode 100644 index 0000000000..9c3a4ea331 --- /dev/null +++ b/__fixtures__/v-next/outputv4/cosmos/base/reflection/v2alpha1/reflection.rpc.func.ts @@ -0,0 +1,76 @@ +import { EndpointOrRpc, buildQuery } from "../../../../helper-func-types.js"; +import { GetAuthnDescriptorRequest, GetAuthnDescriptorRequestSDKType, GetAuthnDescriptorResponse, GetAuthnDescriptorResponseSDKType, GetChainDescriptorRequest, GetChainDescriptorRequestSDKType, GetChainDescriptorResponse, GetChainDescriptorResponseSDKType, GetCodecDescriptorRequest, GetCodecDescriptorRequestSDKType, GetCodecDescriptorResponse, GetCodecDescriptorResponseSDKType, GetConfigurationDescriptorRequest, GetConfigurationDescriptorRequestSDKType, GetConfigurationDescriptorResponse, GetConfigurationDescriptorResponseSDKType, GetQueryServicesDescriptorRequest, GetQueryServicesDescriptorRequestSDKType, GetQueryServicesDescriptorResponse, GetQueryServicesDescriptorResponseSDKType, GetTxDescriptorRequest, GetTxDescriptorRequestSDKType, GetTxDescriptorResponse, GetTxDescriptorResponseSDKType } from "./reflection.js"; +/** + * GetAuthnDescriptor returns information on how to authenticate transactions in the application + * NOTE: this RPC is still experimental and might be subject to breaking changes or removal in + * future releases of the cosmos-sdk. + * @name getGetAuthnDescriptor + * @package cosmos.base.reflection.v2alpha1 + * @see proto service: cosmos.base.reflection.v2alpha1.GetAuthnDescriptor + */ +export const getGetAuthnDescriptor = buildQuery({ + encode: GetAuthnDescriptorRequest.encode, + decode: GetAuthnDescriptorResponse.decode, + service: "cosmos.base.reflection.v2alpha1.ReflectionService", + method: "GetAuthnDescriptor" +}); +/** + * GetChainDescriptor returns the description of the chain + * @name getGetChainDescriptor + * @package cosmos.base.reflection.v2alpha1 + * @see proto service: cosmos.base.reflection.v2alpha1.GetChainDescriptor + */ +export const getGetChainDescriptor = buildQuery({ + encode: GetChainDescriptorRequest.encode, + decode: GetChainDescriptorResponse.decode, + service: "cosmos.base.reflection.v2alpha1.ReflectionService", + method: "GetChainDescriptor" +}); +/** + * GetCodecDescriptor returns the descriptor of the codec of the application + * @name getGetCodecDescriptor + * @package cosmos.base.reflection.v2alpha1 + * @see proto service: cosmos.base.reflection.v2alpha1.GetCodecDescriptor + */ +export const getGetCodecDescriptor = buildQuery({ + encode: GetCodecDescriptorRequest.encode, + decode: GetCodecDescriptorResponse.decode, + service: "cosmos.base.reflection.v2alpha1.ReflectionService", + method: "GetCodecDescriptor" +}); +/** + * GetConfigurationDescriptor returns the descriptor for the sdk.Config of the application + * @name getGetConfigurationDescriptor + * @package cosmos.base.reflection.v2alpha1 + * @see proto service: cosmos.base.reflection.v2alpha1.GetConfigurationDescriptor + */ +export const getGetConfigurationDescriptor = buildQuery({ + encode: GetConfigurationDescriptorRequest.encode, + decode: GetConfigurationDescriptorResponse.decode, + service: "cosmos.base.reflection.v2alpha1.ReflectionService", + method: "GetConfigurationDescriptor" +}); +/** + * GetQueryServicesDescriptor returns the available gRPC queryable services of the application + * @name getGetQueryServicesDescriptor + * @package cosmos.base.reflection.v2alpha1 + * @see proto service: cosmos.base.reflection.v2alpha1.GetQueryServicesDescriptor + */ +export const getGetQueryServicesDescriptor = buildQuery({ + encode: GetQueryServicesDescriptorRequest.encode, + decode: GetQueryServicesDescriptorResponse.decode, + service: "cosmos.base.reflection.v2alpha1.ReflectionService", + method: "GetQueryServicesDescriptor" +}); +/** + * GetTxDescriptor returns information on the used transaction object and available msgs that can be used + * @name getGetTxDescriptor + * @package cosmos.base.reflection.v2alpha1 + * @see proto service: cosmos.base.reflection.v2alpha1.GetTxDescriptor + */ +export const getGetTxDescriptor = buildQuery({ + encode: GetTxDescriptorRequest.encode, + decode: GetTxDescriptorResponse.decode, + service: "cosmos.base.reflection.v2alpha1.ReflectionService", + method: "GetTxDescriptor" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/cosmos/base/tendermint/v1beta1/query.rpc.Service.ts b/__fixtures__/v-next/outputv4/cosmos/base/tendermint/v1beta1/query.rpc.Service.ts index cdfeebe4e2..1d8b53d332 100644 --- a/__fixtures__/v-next/outputv4/cosmos/base/tendermint/v1beta1/query.rpc.Service.ts +++ b/__fixtures__/v-next/outputv4/cosmos/base/tendermint/v1beta1/query.rpc.Service.ts @@ -3,7 +3,7 @@ import { Any, AnySDKType } from "../../../../google/protobuf/any.js"; import { BlockID, BlockIDSDKType } from "../../../../tendermint/types/types.js"; import { Block, BlockSDKType } from "../../../../tendermint/types/block.js"; import { NodeInfo, NodeInfoSDKType } from "../../../../tendermint/p2p/types.js"; -import { Rpc } from "../../../../helpers.js"; +import { TxRpc } from "../../../../types.js"; import { BinaryReader } from "../../../../binary.js"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; import { GetNodeInfoRequest, GetNodeInfoRequestSDKType, GetNodeInfoResponse, GetNodeInfoResponseSDKType, GetSyncingRequest, GetSyncingRequestSDKType, GetSyncingResponse, GetSyncingResponseSDKType, GetLatestBlockRequest, GetLatestBlockRequestSDKType, GetLatestBlockResponse, GetLatestBlockResponseSDKType, GetBlockByHeightRequest, GetBlockByHeightRequestSDKType, GetBlockByHeightResponse, GetBlockByHeightResponseSDKType, GetLatestValidatorSetRequest, GetLatestValidatorSetRequestSDKType, GetLatestValidatorSetResponse, GetLatestValidatorSetResponseSDKType, GetValidatorSetByHeightRequest, GetValidatorSetByHeightRequestSDKType, GetValidatorSetByHeightResponse, GetValidatorSetByHeightResponseSDKType } from "./query.js"; @@ -23,8 +23,8 @@ export interface Service { getValidatorSetByHeight(request: GetValidatorSetByHeightRequest): Promise; } export class ServiceClientImpl implements Service { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.getNodeInfo = this.getNodeInfo.bind(this); this.getSyncing = this.getSyncing.bind(this); diff --git a/__fixtures__/v-next/outputv4/cosmos/base/tendermint/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputv4/cosmos/base/tendermint/v1beta1/query.rpc.func.ts new file mode 100644 index 0000000000..91bf0c7c57 --- /dev/null +++ b/__fixtures__/v-next/outputv4/cosmos/base/tendermint/v1beta1/query.rpc.func.ts @@ -0,0 +1,79 @@ +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../query/v1beta1/pagination.js"; +import { Any, AnySDKType } from "../../../../google/protobuf/any.js"; +import { BlockID, BlockIDSDKType } from "../../../../tendermint/types/types.js"; +import { Block, BlockSDKType } from "../../../../tendermint/types/block.js"; +import { NodeInfo, NodeInfoSDKType } from "../../../../tendermint/p2p/types.js"; +import { EndpointOrRpc, buildQuery } from "../../../../helper-func-types.js"; +import { GetNodeInfoRequest, GetNodeInfoRequestSDKType, GetNodeInfoResponse, GetNodeInfoResponseSDKType, GetSyncingRequest, GetSyncingRequestSDKType, GetSyncingResponse, GetSyncingResponseSDKType, GetLatestBlockRequest, GetLatestBlockRequestSDKType, GetLatestBlockResponse, GetLatestBlockResponseSDKType, GetBlockByHeightRequest, GetBlockByHeightRequestSDKType, GetBlockByHeightResponse, GetBlockByHeightResponseSDKType, GetLatestValidatorSetRequest, GetLatestValidatorSetRequestSDKType, GetLatestValidatorSetResponse, GetLatestValidatorSetResponseSDKType, GetValidatorSetByHeightRequest, GetValidatorSetByHeightRequestSDKType, GetValidatorSetByHeightResponse, GetValidatorSetByHeightResponseSDKType } from "./query.js"; +/** + * GetNodeInfo queries the current node info. + * @name getGetNodeInfo + * @package cosmos.base.tendermint.v1beta1 + * @see proto service: cosmos.base.tendermint.v1beta1.GetNodeInfo + */ +export const getGetNodeInfo = buildQuery({ + encode: GetNodeInfoRequest.encode, + decode: GetNodeInfoResponse.decode, + service: "cosmos.base.tendermint.v1beta1.Service", + method: "GetNodeInfo" +}); +/** + * GetSyncing queries node syncing. + * @name getGetSyncing + * @package cosmos.base.tendermint.v1beta1 + * @see proto service: cosmos.base.tendermint.v1beta1.GetSyncing + */ +export const getGetSyncing = buildQuery({ + encode: GetSyncingRequest.encode, + decode: GetSyncingResponse.decode, + service: "cosmos.base.tendermint.v1beta1.Service", + method: "GetSyncing" +}); +/** + * GetLatestBlock returns the latest block. + * @name getGetLatestBlock + * @package cosmos.base.tendermint.v1beta1 + * @see proto service: cosmos.base.tendermint.v1beta1.GetLatestBlock + */ +export const getGetLatestBlock = buildQuery({ + encode: GetLatestBlockRequest.encode, + decode: GetLatestBlockResponse.decode, + service: "cosmos.base.tendermint.v1beta1.Service", + method: "GetLatestBlock" +}); +/** + * GetBlockByHeight queries block for given height. + * @name getGetBlockByHeight + * @package cosmos.base.tendermint.v1beta1 + * @see proto service: cosmos.base.tendermint.v1beta1.GetBlockByHeight + */ +export const getGetBlockByHeight = buildQuery({ + encode: GetBlockByHeightRequest.encode, + decode: GetBlockByHeightResponse.decode, + service: "cosmos.base.tendermint.v1beta1.Service", + method: "GetBlockByHeight" +}); +/** + * GetLatestValidatorSet queries latest validator-set. + * @name getGetLatestValidatorSet + * @package cosmos.base.tendermint.v1beta1 + * @see proto service: cosmos.base.tendermint.v1beta1.GetLatestValidatorSet + */ +export const getGetLatestValidatorSet = buildQuery({ + encode: GetLatestValidatorSetRequest.encode, + decode: GetLatestValidatorSetResponse.decode, + service: "cosmos.base.tendermint.v1beta1.Service", + method: "GetLatestValidatorSet" +}); +/** + * GetValidatorSetByHeight queries validator-set at a given height. + * @name getGetValidatorSetByHeight + * @package cosmos.base.tendermint.v1beta1 + * @see proto service: cosmos.base.tendermint.v1beta1.GetValidatorSetByHeight + */ +export const getGetValidatorSetByHeight = buildQuery({ + encode: GetValidatorSetByHeightRequest.encode, + decode: GetValidatorSetByHeightResponse.decode, + service: "cosmos.base.tendermint.v1beta1.Service", + method: "GetValidatorSetByHeight" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/cosmos/base/v1beta1/coin.ts b/__fixtures__/v-next/outputv4/cosmos/base/v1beta1/coin.ts index 12a65e99e1..73db092a01 100644 --- a/__fixtures__/v-next/outputv4/cosmos/base/v1beta1/coin.ts +++ b/__fixtures__/v-next/outputv4/cosmos/base/v1beta1/coin.ts @@ -1,7 +1,7 @@ import { BinaryReader, BinaryWriter } from "../../../binary.js"; import { isSet, DeepPartial } from "../../../helpers.js"; import { JsonSafe } from "../../../json-safe.js"; -import { Decimal } from "@cosmjs/math"; +import { Decimal } from "@interchainjs/math"; export const protobufPackage = "cosmos.base.v1beta1"; /** * Coin defines a token with a denomination and an amount. @@ -322,7 +322,7 @@ export const DecCoin = { toAmino(message: DecCoin): DecCoinAmino { const obj: any = {}; obj.denom = message.denom === "" ? undefined : message.denom; - obj.amount = message.amount === "" ? undefined : message.amount; + obj.amount = message.amount === "" ? undefined : Decimal.fromUserInput(message.amount, 18).atomics; return obj; }, fromAminoMsg(object: DecCoinAminoMsg): DecCoin { @@ -522,7 +522,7 @@ export const DecProto = { }, toAmino(message: DecProto): DecProtoAmino { const obj: any = {}; - obj.dec = message.dec === "" ? undefined : message.dec; + obj.dec = message.dec === "" ? undefined : Decimal.fromUserInput(message.dec, 18).atomics; return obj; }, fromAminoMsg(object: DecProtoAminoMsg): DecProto { diff --git a/__fixtures__/v-next/outputv4/cosmos/bundle.ts b/__fixtures__/v-next/outputv4/cosmos/bundle.ts index 99a745f8a0..26a29e3302 100644 --- a/__fixtures__/v-next/outputv4/cosmos/bundle.ts +++ b/__fixtures__/v-next/outputv4/cosmos/bundle.ts @@ -90,99 +90,134 @@ import * as _143 from "./upgrade/v1beta1/tx.js"; import * as _144 from "./upgrade/v1beta1/upgrade.js"; import * as _145 from "./vesting/v1beta1/tx.js"; import * as _146 from "./vesting/v1beta1/vesting.js"; -import * as _353 from "./authz/v1beta1/tx.amino.js"; -import * as _354 from "./bank/v1beta1/tx.amino.js"; -import * as _355 from "./crisis/v1beta1/tx.amino.js"; -import * as _356 from "./distribution/v1beta1/tx.amino.js"; -import * as _357 from "./evidence/v1beta1/tx.amino.js"; -import * as _358 from "./feegrant/v1beta1/tx.amino.js"; -import * as _359 from "./gov/v1/tx.amino.js"; -import * as _360 from "./gov/v1beta1/tx.amino.js"; -import * as _361 from "./group/v1/tx.amino.js"; -import * as _362 from "./nft/v1beta1/tx.amino.js"; -import * as _363 from "./slashing/v1beta1/tx.amino.js"; -import * as _364 from "./staking/v1beta1/tx.amino.js"; -import * as _365 from "./upgrade/v1beta1/tx.amino.js"; -import * as _366 from "./vesting/v1beta1/tx.amino.js"; -import * as _367 from "./authz/v1beta1/tx.registry.js"; -import * as _368 from "./bank/v1beta1/tx.registry.js"; -import * as _369 from "./crisis/v1beta1/tx.registry.js"; -import * as _370 from "./distribution/v1beta1/tx.registry.js"; -import * as _371 from "./evidence/v1beta1/tx.registry.js"; -import * as _372 from "./feegrant/v1beta1/tx.registry.js"; -import * as _373 from "./gov/v1/tx.registry.js"; -import * as _374 from "./gov/v1beta1/tx.registry.js"; -import * as _375 from "./group/v1/tx.registry.js"; -import * as _376 from "./nft/v1beta1/tx.registry.js"; -import * as _377 from "./slashing/v1beta1/tx.registry.js"; -import * as _378 from "./staking/v1beta1/tx.registry.js"; -import * as _379 from "./upgrade/v1beta1/tx.registry.js"; -import * as _380 from "./vesting/v1beta1/tx.registry.js"; -import * as _381 from "./auth/v1beta1/query.lcd.js"; -import * as _382 from "./authz/v1beta1/query.lcd.js"; -import * as _383 from "./bank/v1beta1/query.lcd.js"; -import * as _384 from "./base/reflection/v1beta1/reflection.lcd.js"; -import * as _385 from "./base/reflection/v2alpha1/reflection.lcd.js"; -import * as _386 from "./base/tendermint/v1beta1/query.lcd.js"; -import * as _387 from "./distribution/v1beta1/query.lcd.js"; -import * as _388 from "./evidence/v1beta1/query.lcd.js"; -import * as _389 from "./feegrant/v1beta1/query.lcd.js"; -import * as _390 from "./gov/v1/query.lcd.js"; -import * as _391 from "./gov/v1beta1/query.lcd.js"; -import * as _392 from "./group/v1/query.lcd.js"; -import * as _393 from "./mint/v1beta1/query.lcd.js"; -import * as _394 from "./nft/v1beta1/query.lcd.js"; -import * as _395 from "./params/v1beta1/query.lcd.js"; -import * as _396 from "./slashing/v1beta1/query.lcd.js"; -import * as _397 from "./staking/v1beta1/query.lcd.js"; -import * as _398 from "./tx/v1beta1/service.lcd.js"; -import * as _399 from "./upgrade/v1beta1/query.lcd.js"; -import * as _400 from "./app/v1alpha1/query.rpc.Query.js"; -import * as _401 from "./auth/v1beta1/query.rpc.Query.js"; -import * as _402 from "./authz/v1beta1/query.rpc.Query.js"; -import * as _403 from "./bank/v1beta1/query.rpc.Query.js"; -import * as _404 from "./base/reflection/v1beta1/reflection.rpc.ReflectionService.js"; -import * as _405 from "./base/reflection/v2alpha1/reflection.rpc.ReflectionService.js"; -import * as _406 from "./base/tendermint/v1beta1/query.rpc.Service.js"; -import * as _407 from "./distribution/v1beta1/query.rpc.Query.js"; -import * as _408 from "./evidence/v1beta1/query.rpc.Query.js"; -import * as _409 from "./feegrant/v1beta1/query.rpc.Query.js"; -import * as _410 from "./gov/v1/query.rpc.Query.js"; -import * as _411 from "./gov/v1beta1/query.rpc.Query.js"; -import * as _412 from "./group/v1/query.rpc.Query.js"; -import * as _413 from "./mint/v1beta1/query.rpc.Query.js"; -import * as _414 from "./nft/v1beta1/query.rpc.Query.js"; -import * as _415 from "./params/v1beta1/query.rpc.Query.js"; -import * as _416 from "./slashing/v1beta1/query.rpc.Query.js"; -import * as _417 from "./staking/v1beta1/query.rpc.Query.js"; -import * as _418 from "./tx/v1beta1/service.rpc.Service.js"; -import * as _419 from "./upgrade/v1beta1/query.rpc.Query.js"; -import * as _420 from "./authz/v1beta1/tx.rpc.msg.js"; -import * as _421 from "./bank/v1beta1/tx.rpc.msg.js"; -import * as _422 from "./crisis/v1beta1/tx.rpc.msg.js"; -import * as _423 from "./distribution/v1beta1/tx.rpc.msg.js"; -import * as _424 from "./evidence/v1beta1/tx.rpc.msg.js"; -import * as _425 from "./feegrant/v1beta1/tx.rpc.msg.js"; -import * as _426 from "./gov/v1/tx.rpc.msg.js"; -import * as _427 from "./gov/v1beta1/tx.rpc.msg.js"; -import * as _428 from "./group/v1/tx.rpc.msg.js"; -import * as _429 from "./nft/v1beta1/tx.rpc.msg.js"; -import * as _430 from "./slashing/v1beta1/tx.rpc.msg.js"; -import * as _431 from "./staking/v1beta1/tx.rpc.msg.js"; -import * as _432 from "./upgrade/v1beta1/tx.rpc.msg.js"; -import * as _433 from "./vesting/v1beta1/tx.rpc.msg.js"; -import * as _539 from "./lcd.js"; -import * as _540 from "./rpc.query.js"; -import * as _541 from "./cosmos-rpc-client.query.js"; -import * as _542 from "./rpc.tx.js"; -import * as _543 from "./cosmos-rpc-client.tx.js"; +import * as _369 from "./authz/v1beta1/tx.amino.js"; +import * as _370 from "./bank/v1beta1/tx.amino.js"; +import * as _371 from "./crisis/v1beta1/tx.amino.js"; +import * as _372 from "./distribution/v1beta1/tx.amino.js"; +import * as _373 from "./evidence/v1beta1/tx.amino.js"; +import * as _374 from "./feegrant/v1beta1/tx.amino.js"; +import * as _375 from "./gov/v1/tx.amino.js"; +import * as _376 from "./gov/v1beta1/tx.amino.js"; +import * as _377 from "./group/v1/tx.amino.js"; +import * as _378 from "./nft/v1beta1/tx.amino.js"; +import * as _379 from "./slashing/v1beta1/tx.amino.js"; +import * as _380 from "./staking/v1beta1/tx.amino.js"; +import * as _381 from "./upgrade/v1beta1/tx.amino.js"; +import * as _382 from "./vesting/v1beta1/tx.amino.js"; +import * as _383 from "./authz/v1beta1/tx.registry.js"; +import * as _384 from "./bank/v1beta1/tx.registry.js"; +import * as _385 from "./crisis/v1beta1/tx.registry.js"; +import * as _386 from "./distribution/v1beta1/tx.registry.js"; +import * as _387 from "./evidence/v1beta1/tx.registry.js"; +import * as _388 from "./feegrant/v1beta1/tx.registry.js"; +import * as _389 from "./gov/v1/tx.registry.js"; +import * as _390 from "./gov/v1beta1/tx.registry.js"; +import * as _391 from "./group/v1/tx.registry.js"; +import * as _392 from "./nft/v1beta1/tx.registry.js"; +import * as _393 from "./slashing/v1beta1/tx.registry.js"; +import * as _394 from "./staking/v1beta1/tx.registry.js"; +import * as _395 from "./upgrade/v1beta1/tx.registry.js"; +import * as _396 from "./vesting/v1beta1/tx.registry.js"; +import * as _397 from "./auth/v1beta1/query.lcd.js"; +import * as _398 from "./authz/v1beta1/query.lcd.js"; +import * as _399 from "./bank/v1beta1/query.lcd.js"; +import * as _400 from "./base/reflection/v1beta1/reflection.lcd.js"; +import * as _401 from "./base/reflection/v2alpha1/reflection.lcd.js"; +import * as _402 from "./base/tendermint/v1beta1/query.lcd.js"; +import * as _403 from "./distribution/v1beta1/query.lcd.js"; +import * as _404 from "./evidence/v1beta1/query.lcd.js"; +import * as _405 from "./feegrant/v1beta1/query.lcd.js"; +import * as _406 from "./gov/v1/query.lcd.js"; +import * as _407 from "./gov/v1beta1/query.lcd.js"; +import * as _408 from "./group/v1/query.lcd.js"; +import * as _409 from "./mint/v1beta1/query.lcd.js"; +import * as _410 from "./nft/v1beta1/query.lcd.js"; +import * as _411 from "./params/v1beta1/query.lcd.js"; +import * as _412 from "./slashing/v1beta1/query.lcd.js"; +import * as _413 from "./staking/v1beta1/query.lcd.js"; +import * as _414 from "./tx/v1beta1/service.lcd.js"; +import * as _415 from "./upgrade/v1beta1/query.lcd.js"; +import * as _416 from "./app/v1alpha1/query.rpc.func.js"; +import * as _417 from "./auth/v1beta1/query.rpc.func.js"; +import * as _418 from "./authz/v1beta1/query.rpc.func.js"; +import * as _419 from "./bank/v1beta1/query.rpc.func.js"; +import * as _420 from "./base/reflection/v1beta1/reflection.rpc.func.js"; +import * as _421 from "./base/reflection/v2alpha1/reflection.rpc.func.js"; +import * as _422 from "./base/tendermint/v1beta1/query.rpc.func.js"; +import * as _423 from "./distribution/v1beta1/query.rpc.func.js"; +import * as _424 from "./evidence/v1beta1/query.rpc.func.js"; +import * as _425 from "./feegrant/v1beta1/query.rpc.func.js"; +import * as _426 from "./gov/v1/query.rpc.func.js"; +import * as _427 from "./gov/v1beta1/query.rpc.func.js"; +import * as _428 from "./group/v1/query.rpc.func.js"; +import * as _429 from "./mint/v1beta1/query.rpc.func.js"; +import * as _430 from "./nft/v1beta1/query.rpc.func.js"; +import * as _431 from "./params/v1beta1/query.rpc.func.js"; +import * as _432 from "./slashing/v1beta1/query.rpc.func.js"; +import * as _433 from "./staking/v1beta1/query.rpc.func.js"; +import * as _434 from "./tx/v1beta1/service.rpc.func.js"; +import * as _435 from "./upgrade/v1beta1/query.rpc.func.js"; +import * as _436 from "./app/v1alpha1/query.rpc.Query.js"; +import * as _437 from "./auth/v1beta1/query.rpc.Query.js"; +import * as _438 from "./authz/v1beta1/query.rpc.Query.js"; +import * as _439 from "./bank/v1beta1/query.rpc.Query.js"; +import * as _440 from "./base/reflection/v1beta1/reflection.rpc.ReflectionService.js"; +import * as _441 from "./base/reflection/v2alpha1/reflection.rpc.ReflectionService.js"; +import * as _442 from "./base/tendermint/v1beta1/query.rpc.Service.js"; +import * as _443 from "./distribution/v1beta1/query.rpc.Query.js"; +import * as _444 from "./evidence/v1beta1/query.rpc.Query.js"; +import * as _445 from "./feegrant/v1beta1/query.rpc.Query.js"; +import * as _446 from "./gov/v1/query.rpc.Query.js"; +import * as _447 from "./gov/v1beta1/query.rpc.Query.js"; +import * as _448 from "./group/v1/query.rpc.Query.js"; +import * as _449 from "./mint/v1beta1/query.rpc.Query.js"; +import * as _450 from "./nft/v1beta1/query.rpc.Query.js"; +import * as _451 from "./params/v1beta1/query.rpc.Query.js"; +import * as _452 from "./slashing/v1beta1/query.rpc.Query.js"; +import * as _453 from "./staking/v1beta1/query.rpc.Query.js"; +import * as _454 from "./tx/v1beta1/service.rpc.Service.js"; +import * as _455 from "./upgrade/v1beta1/query.rpc.Query.js"; +import * as _456 from "./authz/v1beta1/tx.rpc.func.js"; +import * as _457 from "./bank/v1beta1/tx.rpc.func.js"; +import * as _458 from "./crisis/v1beta1/tx.rpc.func.js"; +import * as _459 from "./distribution/v1beta1/tx.rpc.func.js"; +import * as _460 from "./evidence/v1beta1/tx.rpc.func.js"; +import * as _461 from "./feegrant/v1beta1/tx.rpc.func.js"; +import * as _462 from "./gov/v1/tx.rpc.func.js"; +import * as _463 from "./gov/v1beta1/tx.rpc.func.js"; +import * as _464 from "./group/v1/tx.rpc.func.js"; +import * as _465 from "./nft/v1beta1/tx.rpc.func.js"; +import * as _466 from "./slashing/v1beta1/tx.rpc.func.js"; +import * as _467 from "./staking/v1beta1/tx.rpc.func.js"; +import * as _468 from "./upgrade/v1beta1/tx.rpc.func.js"; +import * as _469 from "./vesting/v1beta1/tx.rpc.func.js"; +import * as _470 from "./authz/v1beta1/tx.rpc.msg.js"; +import * as _471 from "./bank/v1beta1/tx.rpc.msg.js"; +import * as _472 from "./crisis/v1beta1/tx.rpc.msg.js"; +import * as _473 from "./distribution/v1beta1/tx.rpc.msg.js"; +import * as _474 from "./evidence/v1beta1/tx.rpc.msg.js"; +import * as _475 from "./feegrant/v1beta1/tx.rpc.msg.js"; +import * as _476 from "./gov/v1/tx.rpc.msg.js"; +import * as _477 from "./gov/v1beta1/tx.rpc.msg.js"; +import * as _478 from "./group/v1/tx.rpc.msg.js"; +import * as _479 from "./nft/v1beta1/tx.rpc.msg.js"; +import * as _480 from "./slashing/v1beta1/tx.rpc.msg.js"; +import * as _481 from "./staking/v1beta1/tx.rpc.msg.js"; +import * as _482 from "./upgrade/v1beta1/tx.rpc.msg.js"; +import * as _483 from "./vesting/v1beta1/tx.rpc.msg.js"; +import * as _632 from "./lcd.js"; +import * as _633 from "./rpc.query.js"; +import * as _634 from "./cosmos-rpc-client.query.js"; +import * as _635 from "./rpc.tx.js"; +import * as _636 from "./cosmos-rpc-client.tx.js"; export namespace cosmos { export namespace app { export const v1alpha1 = { ..._55, ..._56, ..._57, - ..._400 + ..._416, + ..._436 }; } export namespace auth { @@ -190,8 +225,9 @@ export namespace cosmos { ..._58, ..._59, ..._60, - ..._381, - ..._401 + ..._397, + ..._417, + ..._437 }; } export namespace authz { @@ -200,11 +236,13 @@ export namespace cosmos { ..._62, ..._63, ..._64, - ..._353, - ..._367, - ..._382, - ..._402, - ..._420 + ..._369, + ..._383, + ..._398, + ..._418, + ..._438, + ..._456, + ..._470 }; } export namespace bank { @@ -214,11 +252,13 @@ export namespace cosmos { ..._67, ..._68, ..._69, - ..._354, - ..._368, - ..._383, - ..._403, - ..._421 + ..._370, + ..._384, + ..._399, + ..._419, + ..._439, + ..._457, + ..._471 }; } export namespace base { @@ -240,13 +280,15 @@ export namespace cosmos { export namespace reflection { export const v1beta1 = { ..._73, - ..._384, - ..._404 + ..._400, + ..._420, + ..._440 }; export const v2alpha1 = { ..._74, - ..._385, - ..._405 + ..._401, + ..._421, + ..._441 }; } export namespace snapshots { @@ -263,8 +305,9 @@ export namespace cosmos { export namespace tendermint { export const v1beta1 = { ..._78, - ..._386, - ..._406 + ..._402, + ..._422, + ..._442 }; } export const v1beta1 = { @@ -281,9 +324,10 @@ export namespace cosmos { export const v1beta1 = { ..._82, ..._83, - ..._355, - ..._369, - ..._422 + ..._371, + ..._385, + ..._458, + ..._472 }; } export namespace crypto { @@ -316,11 +360,13 @@ export namespace cosmos { ..._91, ..._92, ..._93, - ..._356, - ..._370, - ..._387, - ..._407, - ..._423 + ..._372, + ..._386, + ..._403, + ..._423, + ..._443, + ..._459, + ..._473 }; } export namespace evidence { @@ -329,11 +375,13 @@ export namespace cosmos { ..._95, ..._96, ..._97, - ..._357, - ..._371, - ..._388, - ..._408, - ..._424 + ..._373, + ..._387, + ..._404, + ..._424, + ..._444, + ..._460, + ..._474 }; } export namespace feegrant { @@ -342,11 +390,13 @@ export namespace cosmos { ..._99, ..._100, ..._101, - ..._358, - ..._372, - ..._389, - ..._409, - ..._425 + ..._374, + ..._388, + ..._405, + ..._425, + ..._445, + ..._461, + ..._475 }; } export namespace genutil { @@ -360,22 +410,26 @@ export namespace cosmos { ..._104, ..._105, ..._106, - ..._359, - ..._373, - ..._390, - ..._410, - ..._426 + ..._375, + ..._389, + ..._406, + ..._426, + ..._446, + ..._462, + ..._476 }; export const v1beta1 = { ..._107, ..._108, ..._109, ..._110, - ..._360, - ..._374, - ..._391, - ..._411, - ..._427 + ..._376, + ..._390, + ..._407, + ..._427, + ..._447, + ..._463, + ..._477 }; } export namespace group { @@ -385,11 +439,13 @@ export namespace cosmos { ..._113, ..._114, ..._115, - ..._361, - ..._375, - ..._392, - ..._412, - ..._428 + ..._377, + ..._391, + ..._408, + ..._428, + ..._448, + ..._464, + ..._478 }; } export namespace mint { @@ -397,8 +453,9 @@ export namespace cosmos { ..._116, ..._117, ..._118, - ..._393, - ..._413 + ..._409, + ..._429, + ..._449 }; } export namespace msg { @@ -413,11 +470,13 @@ export namespace cosmos { ..._122, ..._123, ..._124, - ..._362, - ..._376, - ..._394, - ..._414, - ..._429 + ..._378, + ..._392, + ..._410, + ..._430, + ..._450, + ..._465, + ..._479 }; } export namespace orm { @@ -437,8 +496,9 @@ export namespace cosmos { export const v1beta1 = { ..._128, ..._129, - ..._395, - ..._415 + ..._411, + ..._431, + ..._451 }; } export namespace slashing { @@ -447,11 +507,13 @@ export namespace cosmos { ..._131, ..._132, ..._133, - ..._363, - ..._377, - ..._396, - ..._416, - ..._430 + ..._379, + ..._393, + ..._412, + ..._432, + ..._452, + ..._466, + ..._480 }; } export namespace staking { @@ -461,11 +523,13 @@ export namespace cosmos { ..._136, ..._137, ..._138, - ..._364, - ..._378, - ..._397, - ..._417, - ..._431 + ..._380, + ..._394, + ..._413, + ..._433, + ..._453, + ..._467, + ..._481 }; } export namespace tx { @@ -477,8 +541,9 @@ export namespace cosmos { export const v1beta1 = { ..._140, ..._141, - ..._398, - ..._418 + ..._414, + ..._434, + ..._454 }; } export namespace upgrade { @@ -486,27 +551,30 @@ export namespace cosmos { ..._142, ..._143, ..._144, - ..._365, - ..._379, - ..._399, - ..._419, - ..._432 + ..._381, + ..._395, + ..._415, + ..._435, + ..._455, + ..._468, + ..._482 }; } export namespace vesting { export const v1beta1 = { ..._145, ..._146, - ..._366, - ..._380, - ..._433 + ..._382, + ..._396, + ..._469, + ..._483 }; } export const ClientFactory = { - ..._539, - ..._540, - ..._541, - ..._542, - ..._543 + ..._632, + ..._633, + ..._634, + ..._635, + ..._636 }; } \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/cosmos/crisis/v1beta1/tx.registry.ts b/__fixtures__/v-next/outputv4/cosmos/crisis/v1beta1/tx.registry.ts index 19c8d0c9d5..7675be02c7 100644 --- a/__fixtures__/v-next/outputv4/cosmos/crisis/v1beta1/tx.registry.ts +++ b/__fixtures__/v-next/outputv4/cosmos/crisis/v1beta1/tx.registry.ts @@ -1,11 +1,6 @@ -import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { TelescopeGeneratedType } from "../../../types.js"; import { MsgVerifyInvariant, MsgVerifyInvariantSDKType } from "./tx.js"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/cosmos.crisis.v1beta1.MsgVerifyInvariant", MsgVerifyInvariant]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/cosmos.crisis.v1beta1.MsgVerifyInvariant", MsgVerifyInvariant]]; export const MessageComposer = { encoded: { verifyInvariant(value: MsgVerifyInvariant) { diff --git a/__fixtures__/v-next/outputv4/cosmos/crisis/v1beta1/tx.rpc.func.ts b/__fixtures__/v-next/outputv4/cosmos/crisis/v1beta1/tx.rpc.func.ts new file mode 100644 index 0000000000..f270c2d424 --- /dev/null +++ b/__fixtures__/v-next/outputv4/cosmos/crisis/v1beta1/tx.rpc.func.ts @@ -0,0 +1,11 @@ +import { buildTx } from "../../../helper-func-types.js"; +import { MsgVerifyInvariant, MsgVerifyInvariantSDKType, MsgVerifyInvariantResponse, MsgVerifyInvariantResponseSDKType } from "./tx.js"; +/** + * VerifyInvariant defines a method to verify a particular invariance. + * @name verifyInvariant + * @package cosmos.crisis.v1beta1 + * @see proto service: cosmos.crisis.v1beta1.VerifyInvariant + */ +export const verifyInvariant = buildTx({ + msg: MsgVerifyInvariant +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/cosmos/crisis/v1beta1/tx.rpc.msg.ts b/__fixtures__/v-next/outputv4/cosmos/crisis/v1beta1/tx.rpc.msg.ts index a0d77e7f67..86b2977496 100644 --- a/__fixtures__/v-next/outputv4/cosmos/crisis/v1beta1/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputv4/cosmos/crisis/v1beta1/tx.rpc.msg.ts @@ -1,4 +1,4 @@ -import { Rpc } from "../../../helpers.js"; +import { TxRpc } from "../../../types.js"; import { BinaryReader } from "../../../binary.js"; import { MsgVerifyInvariant, MsgVerifyInvariantSDKType, MsgVerifyInvariantResponse, MsgVerifyInvariantResponseSDKType } from "./tx.js"; /** Msg defines the bank Msg service. */ @@ -7,8 +7,8 @@ export interface Msg { verifyInvariant(request: MsgVerifyInvariant): Promise; } export class MsgClientImpl implements Msg { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.verifyInvariant = this.verifyInvariant.bind(this); } @@ -18,6 +18,6 @@ export class MsgClientImpl implements Msg { return promise.then(data => MsgVerifyInvariantResponse.decode(new BinaryReader(data))); } } -export const createClientImpl = (rpc: Rpc) => { +export const createClientImpl = (rpc: TxRpc) => { return new MsgClientImpl(rpc); }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/cosmos/distribution/v1beta1/distribution.ts b/__fixtures__/v-next/outputv4/cosmos/distribution/v1beta1/distribution.ts index fe313c96d6..880ee988aa 100644 --- a/__fixtures__/v-next/outputv4/cosmos/distribution/v1beta1/distribution.ts +++ b/__fixtures__/v-next/outputv4/cosmos/distribution/v1beta1/distribution.ts @@ -1,6 +1,6 @@ import { DecCoin, DecCoinSDKType, Coin, CoinSDKType } from "../../base/v1beta1/coin.js"; import { BinaryReader, BinaryWriter } from "../../../binary.js"; -import { Decimal } from "@cosmjs/math"; +import { Decimal } from "@interchainjs/math"; import { isSet, DeepPartial } from "../../../helpers.js"; import { JsonSafe } from "../../../json-safe.js"; export const protobufPackage = "cosmos.distribution.v1beta1"; @@ -477,9 +477,9 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.community_tax = message.communityTax === "" ? undefined : message.communityTax; - obj.base_proposer_reward = message.baseProposerReward === "" ? undefined : message.baseProposerReward; - obj.bonus_proposer_reward = message.bonusProposerReward === "" ? undefined : message.bonusProposerReward; + obj.community_tax = message.communityTax === "" ? undefined : Decimal.fromUserInput(message.communityTax, 18).atomics; + obj.base_proposer_reward = message.baseProposerReward === "" ? undefined : Decimal.fromUserInput(message.baseProposerReward, 18).atomics; + obj.bonus_proposer_reward = message.bonusProposerReward === "" ? undefined : Decimal.fromUserInput(message.bonusProposerReward, 18).atomics; obj.withdraw_addr_enabled = message.withdrawAddrEnabled === false ? undefined : message.withdrawAddrEnabled; return obj; }, @@ -1093,7 +1093,7 @@ export const ValidatorSlashEvent = { toAmino(message: ValidatorSlashEvent): ValidatorSlashEventAmino { const obj: any = {}; obj.validator_period = message.validatorPeriod !== BigInt(0) ? message.validatorPeriod?.toString() : undefined; - obj.fraction = message.fraction === "" ? undefined : message.fraction; + obj.fraction = message.fraction === "" ? undefined : Decimal.fromUserInput(message.fraction, 18).atomics; return obj; }, fromAminoMsg(object: ValidatorSlashEventAminoMsg): ValidatorSlashEvent { @@ -1618,7 +1618,7 @@ export const DelegatorStartingInfo = { toAmino(message: DelegatorStartingInfo): DelegatorStartingInfoAmino { const obj: any = {}; obj.previous_period = message.previousPeriod !== BigInt(0) ? message.previousPeriod?.toString() : undefined; - obj.stake = message.stake === "" ? undefined : message.stake; + obj.stake = message.stake === "" ? undefined : Decimal.fromUserInput(message.stake, 18).atomics; obj.height = message.height ? message.height?.toString() : "0"; return obj; }, diff --git a/__fixtures__/v-next/outputv4/cosmos/distribution/v1beta1/query.rpc.Query.ts b/__fixtures__/v-next/outputv4/cosmos/distribution/v1beta1/query.rpc.Query.ts index 5226a4c28c..dc7ebacb25 100644 --- a/__fixtures__/v-next/outputv4/cosmos/distribution/v1beta1/query.rpc.Query.ts +++ b/__fixtures__/v-next/outputv4/cosmos/distribution/v1beta1/query.rpc.Query.ts @@ -1,7 +1,7 @@ import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination.js"; import { Params, ParamsSDKType, ValidatorOutstandingRewards, ValidatorOutstandingRewardsSDKType, ValidatorAccumulatedCommission, ValidatorAccumulatedCommissionSDKType, ValidatorSlashEvent, ValidatorSlashEventSDKType, DelegationDelegatorReward, DelegationDelegatorRewardSDKType } from "./distribution.js"; import { DecCoin, DecCoinSDKType } from "../../base/v1beta1/coin.js"; -import { Rpc } from "../../../helpers.js"; +import { TxRpc } from "../../../types.js"; import { BinaryReader } from "../../../binary.js"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; import { QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, QueryValidatorOutstandingRewardsRequest, QueryValidatorOutstandingRewardsRequestSDKType, QueryValidatorOutstandingRewardsResponse, QueryValidatorOutstandingRewardsResponseSDKType, QueryValidatorCommissionRequest, QueryValidatorCommissionRequestSDKType, QueryValidatorCommissionResponse, QueryValidatorCommissionResponseSDKType, QueryValidatorSlashesRequest, QueryValidatorSlashesRequestSDKType, QueryValidatorSlashesResponse, QueryValidatorSlashesResponseSDKType, QueryDelegationRewardsRequest, QueryDelegationRewardsRequestSDKType, QueryDelegationRewardsResponse, QueryDelegationRewardsResponseSDKType, QueryDelegationTotalRewardsRequest, QueryDelegationTotalRewardsRequestSDKType, QueryDelegationTotalRewardsResponse, QueryDelegationTotalRewardsResponseSDKType, QueryDelegatorValidatorsRequest, QueryDelegatorValidatorsRequestSDKType, QueryDelegatorValidatorsResponse, QueryDelegatorValidatorsResponseSDKType, QueryDelegatorWithdrawAddressRequest, QueryDelegatorWithdrawAddressRequestSDKType, QueryDelegatorWithdrawAddressResponse, QueryDelegatorWithdrawAddressResponseSDKType, QueryCommunityPoolRequest, QueryCommunityPoolRequestSDKType, QueryCommunityPoolResponse, QueryCommunityPoolResponseSDKType } from "./query.js"; @@ -30,8 +30,8 @@ export interface Query { communityPool(request?: QueryCommunityPoolRequest): Promise; } export class QueryClientImpl implements Query { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.params = this.params.bind(this); this.validatorOutstandingRewards = this.validatorOutstandingRewards.bind(this); diff --git a/__fixtures__/v-next/outputv4/cosmos/distribution/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputv4/cosmos/distribution/v1beta1/query.rpc.func.ts new file mode 100644 index 0000000000..493ad47414 --- /dev/null +++ b/__fixtures__/v-next/outputv4/cosmos/distribution/v1beta1/query.rpc.func.ts @@ -0,0 +1,114 @@ +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination.js"; +import { Params, ParamsSDKType, ValidatorOutstandingRewards, ValidatorOutstandingRewardsSDKType, ValidatorAccumulatedCommission, ValidatorAccumulatedCommissionSDKType, ValidatorSlashEvent, ValidatorSlashEventSDKType, DelegationDelegatorReward, DelegationDelegatorRewardSDKType } from "./distribution.js"; +import { DecCoin, DecCoinSDKType } from "../../base/v1beta1/coin.js"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types.js"; +import { QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, QueryValidatorOutstandingRewardsRequest, QueryValidatorOutstandingRewardsRequestSDKType, QueryValidatorOutstandingRewardsResponse, QueryValidatorOutstandingRewardsResponseSDKType, QueryValidatorCommissionRequest, QueryValidatorCommissionRequestSDKType, QueryValidatorCommissionResponse, QueryValidatorCommissionResponseSDKType, QueryValidatorSlashesRequest, QueryValidatorSlashesRequestSDKType, QueryValidatorSlashesResponse, QueryValidatorSlashesResponseSDKType, QueryDelegationRewardsRequest, QueryDelegationRewardsRequestSDKType, QueryDelegationRewardsResponse, QueryDelegationRewardsResponseSDKType, QueryDelegationTotalRewardsRequest, QueryDelegationTotalRewardsRequestSDKType, QueryDelegationTotalRewardsResponse, QueryDelegationTotalRewardsResponseSDKType, QueryDelegatorValidatorsRequest, QueryDelegatorValidatorsRequestSDKType, QueryDelegatorValidatorsResponse, QueryDelegatorValidatorsResponseSDKType, QueryDelegatorWithdrawAddressRequest, QueryDelegatorWithdrawAddressRequestSDKType, QueryDelegatorWithdrawAddressResponse, QueryDelegatorWithdrawAddressResponseSDKType, QueryCommunityPoolRequest, QueryCommunityPoolRequestSDKType, QueryCommunityPoolResponse, QueryCommunityPoolResponseSDKType } from "./query.js"; +/** + * Params queries params of the distribution module. + * @name getParams + * @package cosmos.distribution.v1beta1 + * @see proto service: cosmos.distribution.v1beta1.Params + */ +export const getParams = buildQuery({ + encode: QueryParamsRequest.encode, + decode: QueryParamsResponse.decode, + service: "cosmos.distribution.v1beta1.Query", + method: "Params" +}); +/** + * ValidatorOutstandingRewards queries rewards of a validator address. + * @name getValidatorOutstandingRewards + * @package cosmos.distribution.v1beta1 + * @see proto service: cosmos.distribution.v1beta1.ValidatorOutstandingRewards + */ +export const getValidatorOutstandingRewards = buildQuery({ + encode: QueryValidatorOutstandingRewardsRequest.encode, + decode: QueryValidatorOutstandingRewardsResponse.decode, + service: "cosmos.distribution.v1beta1.Query", + method: "ValidatorOutstandingRewards" +}); +/** + * ValidatorCommission queries accumulated commission for a validator. + * @name getValidatorCommission + * @package cosmos.distribution.v1beta1 + * @see proto service: cosmos.distribution.v1beta1.ValidatorCommission + */ +export const getValidatorCommission = buildQuery({ + encode: QueryValidatorCommissionRequest.encode, + decode: QueryValidatorCommissionResponse.decode, + service: "cosmos.distribution.v1beta1.Query", + method: "ValidatorCommission" +}); +/** + * ValidatorSlashes queries slash events of a validator. + * @name getValidatorSlashes + * @package cosmos.distribution.v1beta1 + * @see proto service: cosmos.distribution.v1beta1.ValidatorSlashes + */ +export const getValidatorSlashes = buildQuery({ + encode: QueryValidatorSlashesRequest.encode, + decode: QueryValidatorSlashesResponse.decode, + service: "cosmos.distribution.v1beta1.Query", + method: "ValidatorSlashes" +}); +/** + * DelegationRewards queries the total rewards accrued by a delegation. + * @name getDelegationRewards + * @package cosmos.distribution.v1beta1 + * @see proto service: cosmos.distribution.v1beta1.DelegationRewards + */ +export const getDelegationRewards = buildQuery({ + encode: QueryDelegationRewardsRequest.encode, + decode: QueryDelegationRewardsResponse.decode, + service: "cosmos.distribution.v1beta1.Query", + method: "DelegationRewards" +}); +/** + * DelegationTotalRewards queries the total rewards accrued by a each + * validator. + * @name getDelegationTotalRewards + * @package cosmos.distribution.v1beta1 + * @see proto service: cosmos.distribution.v1beta1.DelegationTotalRewards + */ +export const getDelegationTotalRewards = buildQuery({ + encode: QueryDelegationTotalRewardsRequest.encode, + decode: QueryDelegationTotalRewardsResponse.decode, + service: "cosmos.distribution.v1beta1.Query", + method: "DelegationTotalRewards" +}); +/** + * DelegatorValidators queries the validators of a delegator. + * @name getDelegatorValidators + * @package cosmos.distribution.v1beta1 + * @see proto service: cosmos.distribution.v1beta1.DelegatorValidators + */ +export const getDelegatorValidators = buildQuery({ + encode: QueryDelegatorValidatorsRequest.encode, + decode: QueryDelegatorValidatorsResponse.decode, + service: "cosmos.distribution.v1beta1.Query", + method: "DelegatorValidators" +}); +/** + * DelegatorWithdrawAddress queries withdraw address of a delegator. + * @name getDelegatorWithdrawAddress + * @package cosmos.distribution.v1beta1 + * @see proto service: cosmos.distribution.v1beta1.DelegatorWithdrawAddress + */ +export const getDelegatorWithdrawAddress = buildQuery({ + encode: QueryDelegatorWithdrawAddressRequest.encode, + decode: QueryDelegatorWithdrawAddressResponse.decode, + service: "cosmos.distribution.v1beta1.Query", + method: "DelegatorWithdrawAddress" +}); +/** + * CommunityPool queries the community pool coins. + * @name getCommunityPool + * @package cosmos.distribution.v1beta1 + * @see proto service: cosmos.distribution.v1beta1.CommunityPool + */ +export const getCommunityPool = buildQuery({ + encode: QueryCommunityPoolRequest.encode, + decode: QueryCommunityPoolResponse.decode, + service: "cosmos.distribution.v1beta1.Query", + method: "CommunityPool" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/cosmos/distribution/v1beta1/tx.registry.ts b/__fixtures__/v-next/outputv4/cosmos/distribution/v1beta1/tx.registry.ts index bba6fce4eb..c5121695f4 100644 --- a/__fixtures__/v-next/outputv4/cosmos/distribution/v1beta1/tx.registry.ts +++ b/__fixtures__/v-next/outputv4/cosmos/distribution/v1beta1/tx.registry.ts @@ -1,12 +1,7 @@ import { Coin, CoinSDKType } from "../../base/v1beta1/coin.js"; -import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { TelescopeGeneratedType } from "../../../types.js"; import { MsgSetWithdrawAddress, MsgSetWithdrawAddressSDKType, MsgWithdrawDelegatorReward, MsgWithdrawDelegatorRewardSDKType, MsgWithdrawValidatorCommission, MsgWithdrawValidatorCommissionSDKType, MsgFundCommunityPool, MsgFundCommunityPoolSDKType } from "./tx.js"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/cosmos.distribution.v1beta1.MsgSetWithdrawAddress", MsgSetWithdrawAddress], ["/cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward", MsgWithdrawDelegatorReward], ["/cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission", MsgWithdrawValidatorCommission], ["/cosmos.distribution.v1beta1.MsgFundCommunityPool", MsgFundCommunityPool]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/cosmos.distribution.v1beta1.MsgSetWithdrawAddress", MsgSetWithdrawAddress], ["/cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward", MsgWithdrawDelegatorReward], ["/cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission", MsgWithdrawValidatorCommission], ["/cosmos.distribution.v1beta1.MsgFundCommunityPool", MsgFundCommunityPool]]; export const MessageComposer = { encoded: { setWithdrawAddress(value: MsgSetWithdrawAddress) { diff --git a/__fixtures__/v-next/outputv4/cosmos/distribution/v1beta1/tx.rpc.func.ts b/__fixtures__/v-next/outputv4/cosmos/distribution/v1beta1/tx.rpc.func.ts new file mode 100644 index 0000000000..6ecc43d5bb --- /dev/null +++ b/__fixtures__/v-next/outputv4/cosmos/distribution/v1beta1/tx.rpc.func.ts @@ -0,0 +1,43 @@ +import { Coin, CoinSDKType } from "../../base/v1beta1/coin.js"; +import { buildTx } from "../../../helper-func-types.js"; +import { MsgSetWithdrawAddress, MsgSetWithdrawAddressSDKType, MsgSetWithdrawAddressResponse, MsgSetWithdrawAddressResponseSDKType, MsgWithdrawDelegatorReward, MsgWithdrawDelegatorRewardSDKType, MsgWithdrawDelegatorRewardResponse, MsgWithdrawDelegatorRewardResponseSDKType, MsgWithdrawValidatorCommission, MsgWithdrawValidatorCommissionSDKType, MsgWithdrawValidatorCommissionResponse, MsgWithdrawValidatorCommissionResponseSDKType, MsgFundCommunityPool, MsgFundCommunityPoolSDKType, MsgFundCommunityPoolResponse, MsgFundCommunityPoolResponseSDKType } from "./tx.js"; +/** + * SetWithdrawAddress defines a method to change the withdraw address + * for a delegator (or validator self-delegation). + * @name setWithdrawAddress + * @package cosmos.distribution.v1beta1 + * @see proto service: cosmos.distribution.v1beta1.SetWithdrawAddress + */ +export const setWithdrawAddress = buildTx({ + msg: MsgSetWithdrawAddress +}); +/** + * WithdrawDelegatorReward defines a method to withdraw rewards of delegator + * from a single validator. + * @name withdrawDelegatorReward + * @package cosmos.distribution.v1beta1 + * @see proto service: cosmos.distribution.v1beta1.WithdrawDelegatorReward + */ +export const withdrawDelegatorReward = buildTx({ + msg: MsgWithdrawDelegatorReward +}); +/** + * WithdrawValidatorCommission defines a method to withdraw the + * full commission to the validator address. + * @name withdrawValidatorCommission + * @package cosmos.distribution.v1beta1 + * @see proto service: cosmos.distribution.v1beta1.WithdrawValidatorCommission + */ +export const withdrawValidatorCommission = buildTx({ + msg: MsgWithdrawValidatorCommission +}); +/** + * FundCommunityPool defines a method to allow an account to directly + * fund the community pool. + * @name fundCommunityPool + * @package cosmos.distribution.v1beta1 + * @see proto service: cosmos.distribution.v1beta1.FundCommunityPool + */ +export const fundCommunityPool = buildTx({ + msg: MsgFundCommunityPool +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/cosmos/distribution/v1beta1/tx.rpc.msg.ts b/__fixtures__/v-next/outputv4/cosmos/distribution/v1beta1/tx.rpc.msg.ts index 0701f88ef2..9e768a1a8a 100644 --- a/__fixtures__/v-next/outputv4/cosmos/distribution/v1beta1/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputv4/cosmos/distribution/v1beta1/tx.rpc.msg.ts @@ -1,5 +1,5 @@ import { Coin, CoinSDKType } from "../../base/v1beta1/coin.js"; -import { Rpc } from "../../../helpers.js"; +import { TxRpc } from "../../../types.js"; import { BinaryReader } from "../../../binary.js"; import { MsgSetWithdrawAddress, MsgSetWithdrawAddressSDKType, MsgSetWithdrawAddressResponse, MsgSetWithdrawAddressResponseSDKType, MsgWithdrawDelegatorReward, MsgWithdrawDelegatorRewardSDKType, MsgWithdrawDelegatorRewardResponse, MsgWithdrawDelegatorRewardResponseSDKType, MsgWithdrawValidatorCommission, MsgWithdrawValidatorCommissionSDKType, MsgWithdrawValidatorCommissionResponse, MsgWithdrawValidatorCommissionResponseSDKType, MsgFundCommunityPool, MsgFundCommunityPoolSDKType, MsgFundCommunityPoolResponse, MsgFundCommunityPoolResponseSDKType } from "./tx.js"; /** Msg defines the distribution Msg service. */ @@ -26,8 +26,8 @@ export interface Msg { fundCommunityPool(request: MsgFundCommunityPool): Promise; } export class MsgClientImpl implements Msg { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.setWithdrawAddress = this.setWithdrawAddress.bind(this); this.withdrawDelegatorReward = this.withdrawDelegatorReward.bind(this); @@ -55,6 +55,6 @@ export class MsgClientImpl implements Msg { return promise.then(data => MsgFundCommunityPoolResponse.decode(new BinaryReader(data))); } } -export const createClientImpl = (rpc: Rpc) => { +export const createClientImpl = (rpc: TxRpc) => { return new MsgClientImpl(rpc); }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/cosmos/evidence/v1beta1/query.rpc.Query.ts b/__fixtures__/v-next/outputv4/cosmos/evidence/v1beta1/query.rpc.Query.ts index 92090f9b74..3f6b5284c9 100644 --- a/__fixtures__/v-next/outputv4/cosmos/evidence/v1beta1/query.rpc.Query.ts +++ b/__fixtures__/v-next/outputv4/cosmos/evidence/v1beta1/query.rpc.Query.ts @@ -1,6 +1,6 @@ import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination.js"; import { Any, AnySDKType } from "../../../google/protobuf/any.js"; -import { Rpc } from "../../../helpers.js"; +import { TxRpc } from "../../../types.js"; import { BinaryReader } from "../../../binary.js"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; import { QueryEvidenceRequest, QueryEvidenceRequestSDKType, QueryEvidenceResponse, QueryEvidenceResponseSDKType, QueryAllEvidenceRequest, QueryAllEvidenceRequestSDKType, QueryAllEvidenceResponse, QueryAllEvidenceResponseSDKType } from "./query.js"; @@ -12,8 +12,8 @@ export interface Query { allEvidence(request?: QueryAllEvidenceRequest): Promise; } export class QueryClientImpl implements Query { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.evidence = this.evidence.bind(this); this.allEvidence = this.allEvidence.bind(this); diff --git a/__fixtures__/v-next/outputv4/cosmos/evidence/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputv4/cosmos/evidence/v1beta1/query.rpc.func.ts new file mode 100644 index 0000000000..7a85409ae8 --- /dev/null +++ b/__fixtures__/v-next/outputv4/cosmos/evidence/v1beta1/query.rpc.func.ts @@ -0,0 +1,28 @@ +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination.js"; +import { Any, AnySDKType } from "../../../google/protobuf/any.js"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types.js"; +import { QueryEvidenceRequest, QueryEvidenceRequestSDKType, QueryEvidenceResponse, QueryEvidenceResponseSDKType, QueryAllEvidenceRequest, QueryAllEvidenceRequestSDKType, QueryAllEvidenceResponse, QueryAllEvidenceResponseSDKType } from "./query.js"; +/** + * Evidence queries evidence based on evidence hash. + * @name getEvidence + * @package cosmos.evidence.v1beta1 + * @see proto service: cosmos.evidence.v1beta1.Evidence + */ +export const getEvidence = buildQuery({ + encode: QueryEvidenceRequest.encode, + decode: QueryEvidenceResponse.decode, + service: "cosmos.evidence.v1beta1.Query", + method: "Evidence" +}); +/** + * AllEvidence queries all evidence. + * @name getAllEvidence + * @package cosmos.evidence.v1beta1 + * @see proto service: cosmos.evidence.v1beta1.AllEvidence + */ +export const getAllEvidence = buildQuery({ + encode: QueryAllEvidenceRequest.encode, + decode: QueryAllEvidenceResponse.decode, + service: "cosmos.evidence.v1beta1.Query", + method: "AllEvidence" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/cosmos/evidence/v1beta1/tx.registry.ts b/__fixtures__/v-next/outputv4/cosmos/evidence/v1beta1/tx.registry.ts index 6085b1e689..428bfc9b6f 100644 --- a/__fixtures__/v-next/outputv4/cosmos/evidence/v1beta1/tx.registry.ts +++ b/__fixtures__/v-next/outputv4/cosmos/evidence/v1beta1/tx.registry.ts @@ -1,12 +1,7 @@ import { Any, AnySDKType } from "../../../google/protobuf/any.js"; -import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { TelescopeGeneratedType } from "../../../types.js"; import { MsgSubmitEvidence, MsgSubmitEvidenceSDKType } from "./tx.js"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/cosmos.evidence.v1beta1.MsgSubmitEvidence", MsgSubmitEvidence]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/cosmos.evidence.v1beta1.MsgSubmitEvidence", MsgSubmitEvidence]]; export const MessageComposer = { encoded: { submitEvidence(value: MsgSubmitEvidence) { diff --git a/__fixtures__/v-next/outputv4/cosmos/evidence/v1beta1/tx.rpc.func.ts b/__fixtures__/v-next/outputv4/cosmos/evidence/v1beta1/tx.rpc.func.ts new file mode 100644 index 0000000000..c4b059a257 --- /dev/null +++ b/__fixtures__/v-next/outputv4/cosmos/evidence/v1beta1/tx.rpc.func.ts @@ -0,0 +1,13 @@ +import { Any, AnySDKType } from "../../../google/protobuf/any.js"; +import { buildTx } from "../../../helper-func-types.js"; +import { MsgSubmitEvidence, MsgSubmitEvidenceSDKType, MsgSubmitEvidenceResponse, MsgSubmitEvidenceResponseSDKType } from "./tx.js"; +/** + * SubmitEvidence submits an arbitrary Evidence of misbehavior such as equivocation or + * counterfactual signing. + * @name submitEvidence + * @package cosmos.evidence.v1beta1 + * @see proto service: cosmos.evidence.v1beta1.SubmitEvidence + */ +export const submitEvidence = buildTx({ + msg: MsgSubmitEvidence +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/cosmos/evidence/v1beta1/tx.rpc.msg.ts b/__fixtures__/v-next/outputv4/cosmos/evidence/v1beta1/tx.rpc.msg.ts index b4f8d1e215..615102905f 100644 --- a/__fixtures__/v-next/outputv4/cosmos/evidence/v1beta1/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputv4/cosmos/evidence/v1beta1/tx.rpc.msg.ts @@ -1,5 +1,5 @@ import { Any, AnySDKType } from "../../../google/protobuf/any.js"; -import { Rpc } from "../../../helpers.js"; +import { TxRpc } from "../../../types.js"; import { BinaryReader } from "../../../binary.js"; import { MsgSubmitEvidence, MsgSubmitEvidenceSDKType, MsgSubmitEvidenceResponse, MsgSubmitEvidenceResponseSDKType } from "./tx.js"; /** Msg defines the evidence Msg service. */ @@ -11,8 +11,8 @@ export interface Msg { submitEvidence(request: MsgSubmitEvidence): Promise; } export class MsgClientImpl implements Msg { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.submitEvidence = this.submitEvidence.bind(this); } @@ -22,6 +22,6 @@ export class MsgClientImpl implements Msg { return promise.then(data => MsgSubmitEvidenceResponse.decode(new BinaryReader(data))); } } -export const createClientImpl = (rpc: Rpc) => { +export const createClientImpl = (rpc: TxRpc) => { return new MsgClientImpl(rpc); }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/cosmos/feegrant/v1beta1/query.rpc.Query.ts b/__fixtures__/v-next/outputv4/cosmos/feegrant/v1beta1/query.rpc.Query.ts index ce3428cbd6..f2ca084bb1 100644 --- a/__fixtures__/v-next/outputv4/cosmos/feegrant/v1beta1/query.rpc.Query.ts +++ b/__fixtures__/v-next/outputv4/cosmos/feegrant/v1beta1/query.rpc.Query.ts @@ -1,6 +1,6 @@ import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination.js"; import { Grant, GrantSDKType } from "./feegrant.js"; -import { Rpc } from "../../../helpers.js"; +import { TxRpc } from "../../../types.js"; import { BinaryReader } from "../../../binary.js"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; import { QueryAllowanceRequest, QueryAllowanceRequestSDKType, QueryAllowanceResponse, QueryAllowanceResponseSDKType, QueryAllowancesRequest, QueryAllowancesRequestSDKType, QueryAllowancesResponse, QueryAllowancesResponseSDKType, QueryAllowancesByGranterRequest, QueryAllowancesByGranterRequestSDKType, QueryAllowancesByGranterResponse, QueryAllowancesByGranterResponseSDKType } from "./query.js"; @@ -17,8 +17,8 @@ export interface Query { allowancesByGranter(request: QueryAllowancesByGranterRequest): Promise; } export class QueryClientImpl implements Query { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.allowance = this.allowance.bind(this); this.allowances = this.allowances.bind(this); diff --git a/__fixtures__/v-next/outputv4/cosmos/feegrant/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputv4/cosmos/feegrant/v1beta1/query.rpc.func.ts new file mode 100644 index 0000000000..3b4fc3b8a8 --- /dev/null +++ b/__fixtures__/v-next/outputv4/cosmos/feegrant/v1beta1/query.rpc.func.ts @@ -0,0 +1,41 @@ +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination.js"; +import { Grant, GrantSDKType } from "./feegrant.js"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types.js"; +import { QueryAllowanceRequest, QueryAllowanceRequestSDKType, QueryAllowanceResponse, QueryAllowanceResponseSDKType, QueryAllowancesRequest, QueryAllowancesRequestSDKType, QueryAllowancesResponse, QueryAllowancesResponseSDKType, QueryAllowancesByGranterRequest, QueryAllowancesByGranterRequestSDKType, QueryAllowancesByGranterResponse, QueryAllowancesByGranterResponseSDKType } from "./query.js"; +/** + * Allowance returns fee granted to the grantee by the granter. + * @name getAllowance + * @package cosmos.feegrant.v1beta1 + * @see proto service: cosmos.feegrant.v1beta1.Allowance + */ +export const getAllowance = buildQuery({ + encode: QueryAllowanceRequest.encode, + decode: QueryAllowanceResponse.decode, + service: "cosmos.feegrant.v1beta1.Query", + method: "Allowance" +}); +/** + * Allowances returns all the grants for address. + * @name getAllowances + * @package cosmos.feegrant.v1beta1 + * @see proto service: cosmos.feegrant.v1beta1.Allowances + */ +export const getAllowances = buildQuery({ + encode: QueryAllowancesRequest.encode, + decode: QueryAllowancesResponse.decode, + service: "cosmos.feegrant.v1beta1.Query", + method: "Allowances" +}); +/** + * AllowancesByGranter returns all the grants given by an address + * Since v0.46 + * @name getAllowancesByGranter + * @package cosmos.feegrant.v1beta1 + * @see proto service: cosmos.feegrant.v1beta1.AllowancesByGranter + */ +export const getAllowancesByGranter = buildQuery({ + encode: QueryAllowancesByGranterRequest.encode, + decode: QueryAllowancesByGranterResponse.decode, + service: "cosmos.feegrant.v1beta1.Query", + method: "AllowancesByGranter" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/cosmos/feegrant/v1beta1/tx.registry.ts b/__fixtures__/v-next/outputv4/cosmos/feegrant/v1beta1/tx.registry.ts index 0dc7e2d320..75e311a507 100644 --- a/__fixtures__/v-next/outputv4/cosmos/feegrant/v1beta1/tx.registry.ts +++ b/__fixtures__/v-next/outputv4/cosmos/feegrant/v1beta1/tx.registry.ts @@ -1,12 +1,7 @@ import { Any, AnySDKType } from "../../../google/protobuf/any.js"; -import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { TelescopeGeneratedType } from "../../../types.js"; import { MsgGrantAllowance, MsgGrantAllowanceSDKType, MsgRevokeAllowance, MsgRevokeAllowanceSDKType } from "./tx.js"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/cosmos.feegrant.v1beta1.MsgGrantAllowance", MsgGrantAllowance], ["/cosmos.feegrant.v1beta1.MsgRevokeAllowance", MsgRevokeAllowance]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/cosmos.feegrant.v1beta1.MsgGrantAllowance", MsgGrantAllowance], ["/cosmos.feegrant.v1beta1.MsgRevokeAllowance", MsgRevokeAllowance]]; export const MessageComposer = { encoded: { grantAllowance(value: MsgGrantAllowance) { diff --git a/__fixtures__/v-next/outputv4/cosmos/feegrant/v1beta1/tx.rpc.func.ts b/__fixtures__/v-next/outputv4/cosmos/feegrant/v1beta1/tx.rpc.func.ts new file mode 100644 index 0000000000..c7631a07f0 --- /dev/null +++ b/__fixtures__/v-next/outputv4/cosmos/feegrant/v1beta1/tx.rpc.func.ts @@ -0,0 +1,23 @@ +import { Any, AnySDKType } from "../../../google/protobuf/any.js"; +import { buildTx } from "../../../helper-func-types.js"; +import { MsgGrantAllowance, MsgGrantAllowanceSDKType, MsgGrantAllowanceResponse, MsgGrantAllowanceResponseSDKType, MsgRevokeAllowance, MsgRevokeAllowanceSDKType, MsgRevokeAllowanceResponse, MsgRevokeAllowanceResponseSDKType } from "./tx.js"; +/** + * GrantAllowance grants fee allowance to the grantee on the granter's + * account with the provided expiration time. + * @name grantAllowance + * @package cosmos.feegrant.v1beta1 + * @see proto service: cosmos.feegrant.v1beta1.GrantAllowance + */ +export const grantAllowance = buildTx({ + msg: MsgGrantAllowance +}); +/** + * RevokeAllowance revokes any fee allowance of granter's account that + * has been granted to the grantee. + * @name revokeAllowance + * @package cosmos.feegrant.v1beta1 + * @see proto service: cosmos.feegrant.v1beta1.RevokeAllowance + */ +export const revokeAllowance = buildTx({ + msg: MsgRevokeAllowance +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/cosmos/feegrant/v1beta1/tx.rpc.msg.ts b/__fixtures__/v-next/outputv4/cosmos/feegrant/v1beta1/tx.rpc.msg.ts index 44ebe5cae3..d431787572 100644 --- a/__fixtures__/v-next/outputv4/cosmos/feegrant/v1beta1/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputv4/cosmos/feegrant/v1beta1/tx.rpc.msg.ts @@ -1,5 +1,5 @@ import { Any, AnySDKType } from "../../../google/protobuf/any.js"; -import { Rpc } from "../../../helpers.js"; +import { TxRpc } from "../../../types.js"; import { BinaryReader } from "../../../binary.js"; import { MsgGrantAllowance, MsgGrantAllowanceSDKType, MsgGrantAllowanceResponse, MsgGrantAllowanceResponseSDKType, MsgRevokeAllowance, MsgRevokeAllowanceSDKType, MsgRevokeAllowanceResponse, MsgRevokeAllowanceResponseSDKType } from "./tx.js"; /** Msg defines the feegrant msg service. */ @@ -16,8 +16,8 @@ export interface Msg { revokeAllowance(request: MsgRevokeAllowance): Promise; } export class MsgClientImpl implements Msg { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.grantAllowance = this.grantAllowance.bind(this); this.revokeAllowance = this.revokeAllowance.bind(this); @@ -33,6 +33,6 @@ export class MsgClientImpl implements Msg { return promise.then(data => MsgRevokeAllowanceResponse.decode(new BinaryReader(data))); } } -export const createClientImpl = (rpc: Rpc) => { +export const createClientImpl = (rpc: TxRpc) => { return new MsgClientImpl(rpc); }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/cosmos/gov/v1/query.rpc.Query.ts b/__fixtures__/v-next/outputv4/cosmos/gov/v1/query.rpc.Query.ts index a2c2f959ff..913ccbc9a2 100644 --- a/__fixtures__/v-next/outputv4/cosmos/gov/v1/query.rpc.Query.ts +++ b/__fixtures__/v-next/outputv4/cosmos/gov/v1/query.rpc.Query.ts @@ -1,6 +1,6 @@ import { ProposalStatus, ProposalStatusSDKType, Proposal, ProposalSDKType, Vote, VoteSDKType, VotingParams, VotingParamsSDKType, DepositParams, DepositParamsSDKType, TallyParams, TallyParamsSDKType, Deposit, DepositSDKType, TallyResult, TallyResultSDKType } from "./gov.js"; import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination.js"; -import { Rpc } from "../../../helpers.js"; +import { TxRpc } from "../../../types.js"; import { BinaryReader } from "../../../binary.js"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; 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.js"; @@ -24,8 +24,8 @@ export interface Query { tallyResult(request: QueryTallyResultRequest): Promise; } export class QueryClientImpl implements Query { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.proposal = this.proposal.bind(this); this.proposals = this.proposals.bind(this); diff --git a/__fixtures__/v-next/outputv4/cosmos/gov/v1/query.rpc.func.ts b/__fixtures__/v-next/outputv4/cosmos/gov/v1/query.rpc.func.ts new file mode 100644 index 0000000000..8196ca4ecc --- /dev/null +++ b/__fixtures__/v-next/outputv4/cosmos/gov/v1/query.rpc.func.ts @@ -0,0 +1,100 @@ +import { ProposalStatus, ProposalStatusSDKType, Proposal, ProposalSDKType, Vote, VoteSDKType, VotingParams, VotingParamsSDKType, DepositParams, DepositParamsSDKType, TallyParams, TallyParamsSDKType, Deposit, DepositSDKType, TallyResult, TallyResultSDKType } from "./gov.js"; +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination.js"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types.js"; +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.js"; +/** + * Proposal queries proposal details based on ProposalID. + * @name getProposal + * @package cosmos.gov.v1 + * @see proto service: cosmos.gov.v1.Proposal + */ +export const getProposal = buildQuery({ + encode: QueryProposalRequest.encode, + decode: QueryProposalResponse.decode, + service: "cosmos.gov.v1.Query", + method: "Proposal" +}); +/** + * Proposals queries all proposals based on given status. + * @name getProposals + * @package cosmos.gov.v1 + * @see proto service: cosmos.gov.v1.Proposals + */ +export const getProposals = buildQuery({ + encode: QueryProposalsRequest.encode, + decode: QueryProposalsResponse.decode, + service: "cosmos.gov.v1.Query", + method: "Proposals" +}); +/** + * Vote queries voted information based on proposalID, voterAddr. + * @name getVote + * @package cosmos.gov.v1 + * @see proto service: cosmos.gov.v1.Vote + */ +export const getVote = buildQuery({ + encode: QueryVoteRequest.encode, + decode: QueryVoteResponse.decode, + service: "cosmos.gov.v1.Query", + method: "Vote" +}); +/** + * Votes queries votes of a given proposal. + * @name getVotes + * @package cosmos.gov.v1 + * @see proto service: cosmos.gov.v1.Votes + */ +export const getVotes = buildQuery({ + encode: QueryVotesRequest.encode, + decode: QueryVotesResponse.decode, + service: "cosmos.gov.v1.Query", + method: "Votes" +}); +/** + * Params queries all parameters of the gov module. + * @name getParams + * @package cosmos.gov.v1 + * @see proto service: cosmos.gov.v1.Params + */ +export const getParams = buildQuery({ + encode: QueryParamsRequest.encode, + decode: QueryParamsResponse.decode, + service: "cosmos.gov.v1.Query", + method: "Params" +}); +/** + * Deposit queries single deposit information based proposalID, depositAddr. + * @name getDeposit + * @package cosmos.gov.v1 + * @see proto service: cosmos.gov.v1.Deposit + */ +export const getDeposit = buildQuery({ + encode: QueryDepositRequest.encode, + decode: QueryDepositResponse.decode, + service: "cosmos.gov.v1.Query", + method: "Deposit" +}); +/** + * Deposits queries all deposits of a single proposal. + * @name getDeposits + * @package cosmos.gov.v1 + * @see proto service: cosmos.gov.v1.Deposits + */ +export const getDeposits = buildQuery({ + encode: QueryDepositsRequest.encode, + decode: QueryDepositsResponse.decode, + service: "cosmos.gov.v1.Query", + method: "Deposits" +}); +/** + * TallyResult queries the tally of a proposal vote. + * @name getTallyResult + * @package cosmos.gov.v1 + * @see proto service: cosmos.gov.v1.TallyResult + */ +export const getTallyResult = buildQuery({ + encode: QueryTallyResultRequest.encode, + decode: QueryTallyResultResponse.decode, + service: "cosmos.gov.v1.Query", + method: "TallyResult" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/cosmos/gov/v1/tx.registry.ts b/__fixtures__/v-next/outputv4/cosmos/gov/v1/tx.registry.ts index 95857b5b68..fb71a18be9 100644 --- a/__fixtures__/v-next/outputv4/cosmos/gov/v1/tx.registry.ts +++ b/__fixtures__/v-next/outputv4/cosmos/gov/v1/tx.registry.ts @@ -1,14 +1,9 @@ import { Any, AnySDKType } from "../../../google/protobuf/any.js"; import { Coin, CoinSDKType } from "../../base/v1beta1/coin.js"; import { VoteOption, VoteOptionSDKType, WeightedVoteOption, WeightedVoteOptionSDKType } from "./gov.js"; -import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { TelescopeGeneratedType } from "../../../types.js"; import { MsgSubmitProposal, MsgSubmitProposalSDKType, MsgExecLegacyContent, MsgExecLegacyContentSDKType, MsgVote, MsgVoteSDKType, MsgVoteWeighted, MsgVoteWeightedSDKType, MsgDeposit, MsgDepositSDKType } from "./tx.js"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/cosmos.gov.v1.MsgSubmitProposal", MsgSubmitProposal], ["/cosmos.gov.v1.MsgExecLegacyContent", MsgExecLegacyContent], ["/cosmos.gov.v1.MsgVote", MsgVote], ["/cosmos.gov.v1.MsgVoteWeighted", MsgVoteWeighted], ["/cosmos.gov.v1.MsgDeposit", MsgDeposit]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/cosmos.gov.v1.MsgSubmitProposal", MsgSubmitProposal], ["/cosmos.gov.v1.MsgExecLegacyContent", MsgExecLegacyContent], ["/cosmos.gov.v1.MsgVote", MsgVote], ["/cosmos.gov.v1.MsgVoteWeighted", MsgVoteWeighted], ["/cosmos.gov.v1.MsgDeposit", MsgDeposit]]; export const MessageComposer = { encoded: { submitProposal(value: MsgSubmitProposal) { diff --git a/__fixtures__/v-next/outputv4/cosmos/gov/v1/tx.rpc.func.ts b/__fixtures__/v-next/outputv4/cosmos/gov/v1/tx.rpc.func.ts new file mode 100644 index 0000000000..276d8f0975 --- /dev/null +++ b/__fixtures__/v-next/outputv4/cosmos/gov/v1/tx.rpc.func.ts @@ -0,0 +1,51 @@ +import { Any, AnySDKType } from "../../../google/protobuf/any.js"; +import { Coin, CoinSDKType } from "../../base/v1beta1/coin.js"; +import { VoteOption, VoteOptionSDKType, WeightedVoteOption, WeightedVoteOptionSDKType } from "./gov.js"; +import { buildTx } from "../../../helper-func-types.js"; +import { MsgSubmitProposal, MsgSubmitProposalSDKType, MsgSubmitProposalResponse, MsgSubmitProposalResponseSDKType, MsgExecLegacyContent, MsgExecLegacyContentSDKType, MsgExecLegacyContentResponse, MsgExecLegacyContentResponseSDKType, MsgVote, MsgVoteSDKType, MsgVoteResponse, MsgVoteResponseSDKType, MsgVoteWeighted, MsgVoteWeightedSDKType, MsgVoteWeightedResponse, MsgVoteWeightedResponseSDKType, MsgDeposit, MsgDepositSDKType, MsgDepositResponse, MsgDepositResponseSDKType } from "./tx.js"; +/** + * SubmitProposal defines a method to create new proposal given a content. + * @name submitProposal + * @package cosmos.gov.v1 + * @see proto service: cosmos.gov.v1.SubmitProposal + */ +export const submitProposal = buildTx({ + msg: MsgSubmitProposal +}); +/** + * ExecLegacyContent defines a Msg to be in included in a MsgSubmitProposal + * to execute a legacy content-based proposal. + * @name execLegacyContent + * @package cosmos.gov.v1 + * @see proto service: cosmos.gov.v1.ExecLegacyContent + */ +export const execLegacyContent = buildTx({ + msg: MsgExecLegacyContent +}); +/** + * Vote defines a method to add a vote on a specific proposal. + * @name vote + * @package cosmos.gov.v1 + * @see proto service: cosmos.gov.v1.Vote + */ +export const vote = buildTx({ + msg: MsgVote +}); +/** + * VoteWeighted defines a method to add a weighted vote on a specific proposal. + * @name voteWeighted + * @package cosmos.gov.v1 + * @see proto service: cosmos.gov.v1.VoteWeighted + */ +export const voteWeighted = buildTx({ + msg: MsgVoteWeighted +}); +/** + * Deposit defines a method to add deposit on a specific proposal. + * @name deposit + * @package cosmos.gov.v1 + * @see proto service: cosmos.gov.v1.Deposit + */ +export const deposit = buildTx({ + msg: MsgDeposit +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/cosmos/gov/v1/tx.rpc.msg.ts b/__fixtures__/v-next/outputv4/cosmos/gov/v1/tx.rpc.msg.ts index e12346b1ea..db8ff779e3 100644 --- a/__fixtures__/v-next/outputv4/cosmos/gov/v1/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputv4/cosmos/gov/v1/tx.rpc.msg.ts @@ -1,7 +1,7 @@ import { Any, AnySDKType } from "../../../google/protobuf/any.js"; import { Coin, CoinSDKType } from "../../base/v1beta1/coin.js"; import { VoteOption, VoteOptionSDKType, WeightedVoteOption, WeightedVoteOptionSDKType } from "./gov.js"; -import { Rpc } from "../../../helpers.js"; +import { TxRpc } from "../../../types.js"; import { BinaryReader } from "../../../binary.js"; import { MsgSubmitProposal, MsgSubmitProposalSDKType, MsgSubmitProposalResponse, MsgSubmitProposalResponseSDKType, MsgExecLegacyContent, MsgExecLegacyContentSDKType, MsgExecLegacyContentResponse, MsgExecLegacyContentResponseSDKType, MsgVote, MsgVoteSDKType, MsgVoteResponse, MsgVoteResponseSDKType, MsgVoteWeighted, MsgVoteWeightedSDKType, MsgVoteWeightedResponse, MsgVoteWeightedResponseSDKType, MsgDeposit, MsgDepositSDKType, MsgDepositResponse, MsgDepositResponseSDKType } from "./tx.js"; /** Msg defines the gov Msg service. */ @@ -21,8 +21,8 @@ export interface Msg { deposit(request: MsgDeposit): Promise; } export class MsgClientImpl implements Msg { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.submitProposal = this.submitProposal.bind(this); this.execLegacyContent = this.execLegacyContent.bind(this); @@ -56,6 +56,6 @@ export class MsgClientImpl implements Msg { return promise.then(data => MsgDepositResponse.decode(new BinaryReader(data))); } } -export const createClientImpl = (rpc: Rpc) => { +export const createClientImpl = (rpc: TxRpc) => { return new MsgClientImpl(rpc); }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/cosmos/gov/v1beta1/gov.ts b/__fixtures__/v-next/outputv4/cosmos/gov/v1beta1/gov.ts index fb84b1c9ca..d321291dcf 100644 --- a/__fixtures__/v-next/outputv4/cosmos/gov/v1beta1/gov.ts +++ b/__fixtures__/v-next/outputv4/cosmos/gov/v1beta1/gov.ts @@ -3,7 +3,7 @@ import { Any, AnySDKType } from "../../../google/protobuf/any.js"; import { Timestamp, TimestampSDKType } from "../../../google/protobuf/timestamp.js"; import { Duration, DurationSDKType } from "../../../google/protobuf/duration.js"; import { BinaryReader, BinaryWriter } from "../../../binary.js"; -import { Decimal } from "@cosmjs/math"; +import { Decimal } from "@interchainjs/math"; import { isSet, DeepPartial, toTimestamp, fromTimestamp, bytesFromBase64, base64FromBytes } from "../../../helpers.js"; import { JsonSafe } from "../../../json-safe.js"; export const protobufPackage = "cosmos.gov.v1beta1"; @@ -521,7 +521,7 @@ export const WeightedVoteOption = { toAmino(message: WeightedVoteOption): WeightedVoteOptionAmino { const obj: any = {}; obj.option = message.option === 0 ? undefined : message.option; - obj.weight = message.weight === "" ? undefined : message.weight; + obj.weight = message.weight === "" ? undefined : Decimal.fromUserInput(message.weight, 18).atomics; return obj; }, fromAminoMsg(object: WeightedVoteOptionAminoMsg): WeightedVoteOption { diff --git a/__fixtures__/v-next/outputv4/cosmos/gov/v1beta1/query.rpc.Query.ts b/__fixtures__/v-next/outputv4/cosmos/gov/v1beta1/query.rpc.Query.ts index 636bddd19b..9999f5b97b 100644 --- a/__fixtures__/v-next/outputv4/cosmos/gov/v1beta1/query.rpc.Query.ts +++ b/__fixtures__/v-next/outputv4/cosmos/gov/v1beta1/query.rpc.Query.ts @@ -1,6 +1,6 @@ import { ProposalStatus, ProposalStatusSDKType, Proposal, ProposalSDKType, Vote, VoteSDKType, VotingParams, VotingParamsSDKType, DepositParams, DepositParamsSDKType, TallyParams, TallyParamsSDKType, Deposit, DepositSDKType, TallyResult, TallyResultSDKType } from "./gov.js"; import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination.js"; -import { Rpc } from "../../../helpers.js"; +import { TxRpc } from "../../../types.js"; import { BinaryReader } from "../../../binary.js"; import { QueryClient, createProtobufRpcClient, ProtobufRpcClient } from "@cosmjs/stargate"; import { QueryStore, MobxResponse } from "../../../mobx.js"; @@ -26,8 +26,8 @@ export interface Query { tallyResult(request: QueryTallyResultRequest): Promise; } export class QueryClientImpl implements Query { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.proposal = this.proposal.bind(this); this.proposals = this.proposals.bind(this); diff --git a/__fixtures__/v-next/outputv4/cosmos/gov/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputv4/cosmos/gov/v1beta1/query.rpc.func.ts new file mode 100644 index 0000000000..500cf13051 --- /dev/null +++ b/__fixtures__/v-next/outputv4/cosmos/gov/v1beta1/query.rpc.func.ts @@ -0,0 +1,100 @@ +import { ProposalStatus, ProposalStatusSDKType, Proposal, ProposalSDKType, Vote, VoteSDKType, VotingParams, VotingParamsSDKType, DepositParams, DepositParamsSDKType, TallyParams, TallyParamsSDKType, Deposit, DepositSDKType, TallyResult, TallyResultSDKType } from "./gov.js"; +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination.js"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types.js"; +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.js"; +/** + * Proposal queries proposal details based on ProposalID. + * @name getProposal + * @package cosmos.gov.v1beta1 + * @see proto service: cosmos.gov.v1beta1.Proposal + */ +export const getProposal = buildQuery({ + encode: QueryProposalRequest.encode, + decode: QueryProposalResponse.decode, + service: "cosmos.gov.v1beta1.Query", + method: "Proposal" +}); +/** + * Proposals queries all proposals based on given status. + * @name getProposals + * @package cosmos.gov.v1beta1 + * @see proto service: cosmos.gov.v1beta1.Proposals + */ +export const getProposals = buildQuery({ + encode: QueryProposalsRequest.encode, + decode: QueryProposalsResponse.decode, + service: "cosmos.gov.v1beta1.Query", + method: "Proposals" +}); +/** + * Vote queries voted information based on proposalID, voterAddr. + * @name getVote + * @package cosmos.gov.v1beta1 + * @see proto service: cosmos.gov.v1beta1.Vote + */ +export const getVote = buildQuery({ + encode: QueryVoteRequest.encode, + decode: QueryVoteResponse.decode, + service: "cosmos.gov.v1beta1.Query", + method: "Vote" +}); +/** + * Votes queries votes of a given proposal. + * @name getVotes + * @package cosmos.gov.v1beta1 + * @see proto service: cosmos.gov.v1beta1.Votes + */ +export const getVotes = buildQuery({ + encode: QueryVotesRequest.encode, + decode: QueryVotesResponse.decode, + service: "cosmos.gov.v1beta1.Query", + method: "Votes" +}); +/** + * Params queries all parameters of the gov module. + * @name getParams + * @package cosmos.gov.v1beta1 + * @see proto service: cosmos.gov.v1beta1.Params + */ +export const getParams = buildQuery({ + encode: QueryParamsRequest.encode, + decode: QueryParamsResponse.decode, + service: "cosmos.gov.v1beta1.Query", + method: "Params" +}); +/** + * Deposit queries single deposit information based proposalID, depositAddr. + * @name getDeposit + * @package cosmos.gov.v1beta1 + * @see proto service: cosmos.gov.v1beta1.Deposit + */ +export const getDeposit = buildQuery({ + encode: QueryDepositRequest.encode, + decode: QueryDepositResponse.decode, + service: "cosmos.gov.v1beta1.Query", + method: "Deposit" +}); +/** + * Deposits queries all deposits of a single proposal. + * @name getDeposits + * @package cosmos.gov.v1beta1 + * @see proto service: cosmos.gov.v1beta1.Deposits + */ +export const getDeposits = buildQuery({ + encode: QueryDepositsRequest.encode, + decode: QueryDepositsResponse.decode, + service: "cosmos.gov.v1beta1.Query", + method: "Deposits" +}); +/** + * TallyResult queries the tally of a proposal vote. + * @name getTallyResult + * @package cosmos.gov.v1beta1 + * @see proto service: cosmos.gov.v1beta1.TallyResult + */ +export const getTallyResult = buildQuery({ + encode: QueryTallyResultRequest.encode, + decode: QueryTallyResultResponse.decode, + service: "cosmos.gov.v1beta1.Query", + method: "TallyResult" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/cosmos/gov/v1beta1/tx.amino.ts b/__fixtures__/v-next/outputv4/cosmos/gov/v1beta1/tx.amino.ts index 000404777d..7e3d4d9b7f 100644 --- a/__fixtures__/v-next/outputv4/cosmos/gov/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/cosmos/gov/v1beta1/tx.amino.ts @@ -2,6 +2,7 @@ import { Any, AnySDKType } from "../../../google/protobuf/any.js"; import { Coin, CoinSDKType } from "../../base/v1beta1/coin.js"; import { VoteOption, VoteOptionSDKType, WeightedVoteOption, WeightedVoteOptionSDKType, voteOptionFromJSON } from "./gov.js"; import { AminoMsg } from "@cosmjs/amino"; +import { Decimal } from "@interchainjs/math"; import { MsgSubmitProposal, MsgSubmitProposalSDKType, MsgVote, MsgVoteSDKType, MsgVoteWeighted, MsgVoteWeightedSDKType, MsgDeposit, MsgDepositSDKType } from "./tx.js"; export interface MsgSubmitProposalAminoType extends AminoMsg { type: "cosmos-sdk/MsgSubmitProposal"; @@ -122,7 +123,7 @@ export const AminoConverter = { voter, options: options.map(el0 => ({ option: el0.option, - weight: el0.weight + weight: Decimal.fromUserInput(el0.weight, 18).atomics })) }; }, diff --git a/__fixtures__/v-next/outputv4/cosmos/gov/v1beta1/tx.registry.ts b/__fixtures__/v-next/outputv4/cosmos/gov/v1beta1/tx.registry.ts index ed11331d36..6664894146 100644 --- a/__fixtures__/v-next/outputv4/cosmos/gov/v1beta1/tx.registry.ts +++ b/__fixtures__/v-next/outputv4/cosmos/gov/v1beta1/tx.registry.ts @@ -1,14 +1,9 @@ import { Any, AnySDKType } from "../../../google/protobuf/any.js"; import { Coin, CoinSDKType } from "../../base/v1beta1/coin.js"; import { VoteOption, VoteOptionSDKType, WeightedVoteOption, WeightedVoteOptionSDKType } from "./gov.js"; -import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { TelescopeGeneratedType } from "../../../types.js"; import { MsgSubmitProposal, MsgSubmitProposalSDKType, MsgVote, MsgVoteSDKType, MsgVoteWeighted, MsgVoteWeightedSDKType, MsgDeposit, MsgDepositSDKType } from "./tx.js"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/cosmos.gov.v1beta1.MsgSubmitProposal", MsgSubmitProposal], ["/cosmos.gov.v1beta1.MsgVote", MsgVote], ["/cosmos.gov.v1beta1.MsgVoteWeighted", MsgVoteWeighted], ["/cosmos.gov.v1beta1.MsgDeposit", MsgDeposit]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/cosmos.gov.v1beta1.MsgSubmitProposal", MsgSubmitProposal], ["/cosmos.gov.v1beta1.MsgVote", MsgVote], ["/cosmos.gov.v1beta1.MsgVoteWeighted", MsgVoteWeighted], ["/cosmos.gov.v1beta1.MsgDeposit", MsgDeposit]]; export const MessageComposer = { encoded: { submitProposal(value: MsgSubmitProposal) { diff --git a/__fixtures__/v-next/outputv4/cosmos/gov/v1beta1/tx.rpc.func.ts b/__fixtures__/v-next/outputv4/cosmos/gov/v1beta1/tx.rpc.func.ts new file mode 100644 index 0000000000..f2839d9743 --- /dev/null +++ b/__fixtures__/v-next/outputv4/cosmos/gov/v1beta1/tx.rpc.func.ts @@ -0,0 +1,43 @@ +import { Any, AnySDKType } from "../../../google/protobuf/any.js"; +import { Coin, CoinSDKType } from "../../base/v1beta1/coin.js"; +import { VoteOption, VoteOptionSDKType, WeightedVoteOption, WeightedVoteOptionSDKType } from "./gov.js"; +import { buildTx } from "../../../helper-func-types.js"; +import { MsgSubmitProposal, MsgSubmitProposalSDKType, MsgSubmitProposalResponse, MsgSubmitProposalResponseSDKType, MsgVote, MsgVoteSDKType, MsgVoteResponse, MsgVoteResponseSDKType, MsgVoteWeighted, MsgVoteWeightedSDKType, MsgVoteWeightedResponse, MsgVoteWeightedResponseSDKType, MsgDeposit, MsgDepositSDKType, MsgDepositResponse, MsgDepositResponseSDKType } from "./tx.js"; +/** + * SubmitProposal defines a method to create new proposal given a content. + * @name submitProposal + * @package cosmos.gov.v1beta1 + * @see proto service: cosmos.gov.v1beta1.SubmitProposal + */ +export const submitProposal = buildTx({ + msg: MsgSubmitProposal +}); +/** + * Vote defines a method to add a vote on a specific proposal. + * @name vote + * @package cosmos.gov.v1beta1 + * @see proto service: cosmos.gov.v1beta1.Vote + */ +export const vote = buildTx({ + msg: MsgVote +}); +/** + * VoteWeighted defines a method to add a weighted vote on a specific proposal. + * + * Since: cosmos-sdk 0.43 + * @name voteWeighted + * @package cosmos.gov.v1beta1 + * @see proto service: cosmos.gov.v1beta1.VoteWeighted + */ +export const voteWeighted = buildTx({ + msg: MsgVoteWeighted +}); +/** + * Deposit defines a method to add deposit on a specific proposal. + * @name deposit + * @package cosmos.gov.v1beta1 + * @see proto service: cosmos.gov.v1beta1.Deposit + */ +export const deposit = buildTx({ + msg: MsgDeposit +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/cosmos/gov/v1beta1/tx.rpc.msg.ts b/__fixtures__/v-next/outputv4/cosmos/gov/v1beta1/tx.rpc.msg.ts index 604dbe4e16..c782b6b744 100644 --- a/__fixtures__/v-next/outputv4/cosmos/gov/v1beta1/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputv4/cosmos/gov/v1beta1/tx.rpc.msg.ts @@ -1,7 +1,7 @@ import { Any, AnySDKType } from "../../../google/protobuf/any.js"; import { Coin, CoinSDKType } from "../../base/v1beta1/coin.js"; import { VoteOption, VoteOptionSDKType, WeightedVoteOption, WeightedVoteOptionSDKType } from "./gov.js"; -import { Rpc } from "../../../helpers.js"; +import { TxRpc } from "../../../types.js"; import { BinaryReader } from "../../../binary.js"; import { MsgSubmitProposal, MsgSubmitProposalSDKType, MsgSubmitProposalResponse, MsgSubmitProposalResponseSDKType, MsgVote, MsgVoteSDKType, MsgVoteResponse, MsgVoteResponseSDKType, MsgVoteWeighted, MsgVoteWeightedSDKType, MsgVoteWeightedResponse, MsgVoteWeightedResponseSDKType, MsgDeposit, MsgDepositSDKType, MsgDepositResponse, MsgDepositResponseSDKType } from "./tx.js"; /** Msg defines the bank Msg service. */ @@ -20,8 +20,8 @@ export interface Msg { deposit(request: MsgDeposit): Promise; } export class MsgClientImpl implements Msg { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.submitProposal = this.submitProposal.bind(this); this.vote = this.vote.bind(this); @@ -49,6 +49,6 @@ export class MsgClientImpl implements Msg { return promise.then(data => MsgDepositResponse.decode(new BinaryReader(data))); } } -export const createClientImpl = (rpc: Rpc) => { +export const createClientImpl = (rpc: TxRpc) => { return new MsgClientImpl(rpc); }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/cosmos/group/v1/query.rpc.Query.ts b/__fixtures__/v-next/outputv4/cosmos/group/v1/query.rpc.Query.ts index 9c11b2042f..959f9b1268 100644 --- a/__fixtures__/v-next/outputv4/cosmos/group/v1/query.rpc.Query.ts +++ b/__fixtures__/v-next/outputv4/cosmos/group/v1/query.rpc.Query.ts @@ -1,6 +1,6 @@ import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination.js"; import { GroupInfo, GroupInfoSDKType, GroupPolicyInfo, GroupPolicyInfoSDKType, GroupMember, GroupMemberSDKType, Proposal, ProposalSDKType, Vote, VoteSDKType, TallyResult, TallyResultSDKType } from "./types.js"; -import { Rpc } from "../../../helpers.js"; +import { TxRpc } from "../../../types.js"; import { BinaryReader } from "../../../binary.js"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; import { QueryGroupInfoRequest, QueryGroupInfoRequestSDKType, QueryGroupInfoResponse, QueryGroupInfoResponseSDKType, QueryGroupPolicyInfoRequest, QueryGroupPolicyInfoRequestSDKType, QueryGroupPolicyInfoResponse, QueryGroupPolicyInfoResponseSDKType, QueryGroupMembersRequest, QueryGroupMembersRequestSDKType, QueryGroupMembersResponse, QueryGroupMembersResponseSDKType, QueryGroupsByAdminRequest, QueryGroupsByAdminRequestSDKType, QueryGroupsByAdminResponse, QueryGroupsByAdminResponseSDKType, QueryGroupPoliciesByGroupRequest, QueryGroupPoliciesByGroupRequestSDKType, QueryGroupPoliciesByGroupResponse, QueryGroupPoliciesByGroupResponseSDKType, QueryGroupPoliciesByAdminRequest, QueryGroupPoliciesByAdminRequestSDKType, QueryGroupPoliciesByAdminResponse, QueryGroupPoliciesByAdminResponseSDKType, QueryProposalRequest, QueryProposalRequestSDKType, QueryProposalResponse, QueryProposalResponseSDKType, QueryProposalsByGroupPolicyRequest, QueryProposalsByGroupPolicyRequestSDKType, QueryProposalsByGroupPolicyResponse, QueryProposalsByGroupPolicyResponseSDKType, QueryVoteByProposalVoterRequest, QueryVoteByProposalVoterRequestSDKType, QueryVoteByProposalVoterResponse, QueryVoteByProposalVoterResponseSDKType, QueryVotesByProposalRequest, QueryVotesByProposalRequestSDKType, QueryVotesByProposalResponse, QueryVotesByProposalResponseSDKType, QueryVotesByVoterRequest, QueryVotesByVoterRequestSDKType, QueryVotesByVoterResponse, QueryVotesByVoterResponseSDKType, QueryGroupsByMemberRequest, QueryGroupsByMemberRequestSDKType, QueryGroupsByMemberResponse, QueryGroupsByMemberResponseSDKType, QueryTallyResultRequest, QueryTallyResultRequestSDKType, QueryTallyResultResponse, QueryTallyResultResponseSDKType } from "./query.js"; @@ -34,8 +34,8 @@ export interface Query { tallyResult(request: QueryTallyResultRequest): Promise; } export class QueryClientImpl implements Query { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.groupInfo = this.groupInfo.bind(this); this.groupPolicyInfo = this.groupPolicyInfo.bind(this); diff --git a/__fixtures__/v-next/outputv4/cosmos/group/v1/query.rpc.func.ts b/__fixtures__/v-next/outputv4/cosmos/group/v1/query.rpc.func.ts new file mode 100644 index 0000000000..377f06b9f0 --- /dev/null +++ b/__fixtures__/v-next/outputv4/cosmos/group/v1/query.rpc.func.ts @@ -0,0 +1,160 @@ +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination.js"; +import { GroupInfo, GroupInfoSDKType, GroupPolicyInfo, GroupPolicyInfoSDKType, GroupMember, GroupMemberSDKType, Proposal, ProposalSDKType, Vote, VoteSDKType, TallyResult, TallyResultSDKType } from "./types.js"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types.js"; +import { QueryGroupInfoRequest, QueryGroupInfoRequestSDKType, QueryGroupInfoResponse, QueryGroupInfoResponseSDKType, QueryGroupPolicyInfoRequest, QueryGroupPolicyInfoRequestSDKType, QueryGroupPolicyInfoResponse, QueryGroupPolicyInfoResponseSDKType, QueryGroupMembersRequest, QueryGroupMembersRequestSDKType, QueryGroupMembersResponse, QueryGroupMembersResponseSDKType, QueryGroupsByAdminRequest, QueryGroupsByAdminRequestSDKType, QueryGroupsByAdminResponse, QueryGroupsByAdminResponseSDKType, QueryGroupPoliciesByGroupRequest, QueryGroupPoliciesByGroupRequestSDKType, QueryGroupPoliciesByGroupResponse, QueryGroupPoliciesByGroupResponseSDKType, QueryGroupPoliciesByAdminRequest, QueryGroupPoliciesByAdminRequestSDKType, QueryGroupPoliciesByAdminResponse, QueryGroupPoliciesByAdminResponseSDKType, QueryProposalRequest, QueryProposalRequestSDKType, QueryProposalResponse, QueryProposalResponseSDKType, QueryProposalsByGroupPolicyRequest, QueryProposalsByGroupPolicyRequestSDKType, QueryProposalsByGroupPolicyResponse, QueryProposalsByGroupPolicyResponseSDKType, QueryVoteByProposalVoterRequest, QueryVoteByProposalVoterRequestSDKType, QueryVoteByProposalVoterResponse, QueryVoteByProposalVoterResponseSDKType, QueryVotesByProposalRequest, QueryVotesByProposalRequestSDKType, QueryVotesByProposalResponse, QueryVotesByProposalResponseSDKType, QueryVotesByVoterRequest, QueryVotesByVoterRequestSDKType, QueryVotesByVoterResponse, QueryVotesByVoterResponseSDKType, QueryGroupsByMemberRequest, QueryGroupsByMemberRequestSDKType, QueryGroupsByMemberResponse, QueryGroupsByMemberResponseSDKType, QueryTallyResultRequest, QueryTallyResultRequestSDKType, QueryTallyResultResponse, QueryTallyResultResponseSDKType } from "./query.js"; +/** + * GroupInfo queries group info based on group id. + * @name getGroupInfo + * @package cosmos.group.v1 + * @see proto service: cosmos.group.v1.GroupInfo + */ +export const getGroupInfo = buildQuery({ + encode: QueryGroupInfoRequest.encode, + decode: QueryGroupInfoResponse.decode, + service: "cosmos.group.v1.Query", + method: "GroupInfo" +}); +/** + * GroupPolicyInfo queries group policy info based on account address of group policy. + * @name getGroupPolicyInfo + * @package cosmos.group.v1 + * @see proto service: cosmos.group.v1.GroupPolicyInfo + */ +export const getGroupPolicyInfo = buildQuery({ + encode: QueryGroupPolicyInfoRequest.encode, + decode: QueryGroupPolicyInfoResponse.decode, + service: "cosmos.group.v1.Query", + method: "GroupPolicyInfo" +}); +/** + * GroupMembers queries members of a group + * @name getGroupMembers + * @package cosmos.group.v1 + * @see proto service: cosmos.group.v1.GroupMembers + */ +export const getGroupMembers = buildQuery({ + encode: QueryGroupMembersRequest.encode, + decode: QueryGroupMembersResponse.decode, + service: "cosmos.group.v1.Query", + method: "GroupMembers" +}); +/** + * GroupsByAdmin queries groups by admin address. + * @name getGroupsByAdmin + * @package cosmos.group.v1 + * @see proto service: cosmos.group.v1.GroupsByAdmin + */ +export const getGroupsByAdmin = buildQuery({ + encode: QueryGroupsByAdminRequest.encode, + decode: QueryGroupsByAdminResponse.decode, + service: "cosmos.group.v1.Query", + method: "GroupsByAdmin" +}); +/** + * GroupPoliciesByGroup queries group policies by group id. + * @name getGroupPoliciesByGroup + * @package cosmos.group.v1 + * @see proto service: cosmos.group.v1.GroupPoliciesByGroup + */ +export const getGroupPoliciesByGroup = buildQuery({ + encode: QueryGroupPoliciesByGroupRequest.encode, + decode: QueryGroupPoliciesByGroupResponse.decode, + service: "cosmos.group.v1.Query", + method: "GroupPoliciesByGroup" +}); +/** + * GroupsByAdmin queries group policies by admin address. + * @name getGroupPoliciesByAdmin + * @package cosmos.group.v1 + * @see proto service: cosmos.group.v1.GroupPoliciesByAdmin + */ +export const getGroupPoliciesByAdmin = buildQuery({ + encode: QueryGroupPoliciesByAdminRequest.encode, + decode: QueryGroupPoliciesByAdminResponse.decode, + service: "cosmos.group.v1.Query", + method: "GroupPoliciesByAdmin" +}); +/** + * Proposal queries a proposal based on proposal id. + * @name getProposal + * @package cosmos.group.v1 + * @see proto service: cosmos.group.v1.Proposal + */ +export const getProposal = buildQuery({ + encode: QueryProposalRequest.encode, + decode: QueryProposalResponse.decode, + service: "cosmos.group.v1.Query", + method: "Proposal" +}); +/** + * ProposalsByGroupPolicy queries proposals based on account address of group policy. + * @name getProposalsByGroupPolicy + * @package cosmos.group.v1 + * @see proto service: cosmos.group.v1.ProposalsByGroupPolicy + */ +export const getProposalsByGroupPolicy = buildQuery({ + encode: QueryProposalsByGroupPolicyRequest.encode, + decode: QueryProposalsByGroupPolicyResponse.decode, + service: "cosmos.group.v1.Query", + method: "ProposalsByGroupPolicy" +}); +/** + * VoteByProposalVoter queries a vote by proposal id and voter. + * @name getVoteByProposalVoter + * @package cosmos.group.v1 + * @see proto service: cosmos.group.v1.VoteByProposalVoter + */ +export const getVoteByProposalVoter = buildQuery({ + encode: QueryVoteByProposalVoterRequest.encode, + decode: QueryVoteByProposalVoterResponse.decode, + service: "cosmos.group.v1.Query", + method: "VoteByProposalVoter" +}); +/** + * VotesByProposal queries a vote by proposal. + * @name getVotesByProposal + * @package cosmos.group.v1 + * @see proto service: cosmos.group.v1.VotesByProposal + */ +export const getVotesByProposal = buildQuery({ + encode: QueryVotesByProposalRequest.encode, + decode: QueryVotesByProposalResponse.decode, + service: "cosmos.group.v1.Query", + method: "VotesByProposal" +}); +/** + * VotesByVoter queries a vote by voter. + * @name getVotesByVoter + * @package cosmos.group.v1 + * @see proto service: cosmos.group.v1.VotesByVoter + */ +export const getVotesByVoter = buildQuery({ + encode: QueryVotesByVoterRequest.encode, + decode: QueryVotesByVoterResponse.decode, + service: "cosmos.group.v1.Query", + method: "VotesByVoter" +}); +/** + * GroupsByMember queries groups by member address. + * @name getGroupsByMember + * @package cosmos.group.v1 + * @see proto service: cosmos.group.v1.GroupsByMember + */ +export const getGroupsByMember = buildQuery({ + encode: QueryGroupsByMemberRequest.encode, + decode: QueryGroupsByMemberResponse.decode, + service: "cosmos.group.v1.Query", + method: "GroupsByMember" +}); +/** + * TallyResult queries the tally of a proposal votes. + * @name getTallyResult + * @package cosmos.group.v1 + * @see proto service: cosmos.group.v1.TallyResult + */ +export const getTallyResult = buildQuery({ + encode: QueryTallyResultRequest.encode, + decode: QueryTallyResultResponse.decode, + service: "cosmos.group.v1.Query", + method: "TallyResult" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/cosmos/group/v1/tx.registry.ts b/__fixtures__/v-next/outputv4/cosmos/group/v1/tx.registry.ts index b821652035..48ded03f49 100644 --- a/__fixtures__/v-next/outputv4/cosmos/group/v1/tx.registry.ts +++ b/__fixtures__/v-next/outputv4/cosmos/group/v1/tx.registry.ts @@ -1,13 +1,8 @@ import { Member, MemberSDKType, VoteOption, VoteOptionSDKType } from "./types.js"; import { Any, AnySDKType } from "../../../google/protobuf/any.js"; -import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { TelescopeGeneratedType } from "../../../types.js"; import { MsgCreateGroup, MsgCreateGroupSDKType, MsgUpdateGroupMembers, MsgUpdateGroupMembersSDKType, MsgUpdateGroupAdmin, MsgUpdateGroupAdminSDKType, MsgUpdateGroupMetadata, MsgUpdateGroupMetadataSDKType, MsgCreateGroupPolicy, MsgCreateGroupPolicySDKType, MsgCreateGroupWithPolicy, MsgCreateGroupWithPolicySDKType, MsgUpdateGroupPolicyAdmin, MsgUpdateGroupPolicyAdminSDKType, MsgUpdateGroupPolicyDecisionPolicy, MsgUpdateGroupPolicyDecisionPolicySDKType, MsgUpdateGroupPolicyMetadata, MsgUpdateGroupPolicyMetadataSDKType, MsgSubmitProposal, MsgSubmitProposalSDKType, MsgWithdrawProposal, MsgWithdrawProposalSDKType, MsgVote, MsgVoteSDKType, MsgExec, MsgExecSDKType, MsgLeaveGroup, MsgLeaveGroupSDKType } from "./tx.js"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/cosmos.group.v1.MsgCreateGroup", MsgCreateGroup], ["/cosmos.group.v1.MsgUpdateGroupMembers", MsgUpdateGroupMembers], ["/cosmos.group.v1.MsgUpdateGroupAdmin", MsgUpdateGroupAdmin], ["/cosmos.group.v1.MsgUpdateGroupMetadata", MsgUpdateGroupMetadata], ["/cosmos.group.v1.MsgCreateGroupPolicy", MsgCreateGroupPolicy], ["/cosmos.group.v1.MsgCreateGroupWithPolicy", MsgCreateGroupWithPolicy], ["/cosmos.group.v1.MsgUpdateGroupPolicyAdmin", MsgUpdateGroupPolicyAdmin], ["/cosmos.group.v1.MsgUpdateGroupPolicyDecisionPolicy", MsgUpdateGroupPolicyDecisionPolicy], ["/cosmos.group.v1.MsgUpdateGroupPolicyMetadata", MsgUpdateGroupPolicyMetadata], ["/cosmos.group.v1.MsgSubmitProposal", MsgSubmitProposal], ["/cosmos.group.v1.MsgWithdrawProposal", MsgWithdrawProposal], ["/cosmos.group.v1.MsgVote", MsgVote], ["/cosmos.group.v1.MsgExec", MsgExec], ["/cosmos.group.v1.MsgLeaveGroup", MsgLeaveGroup]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/cosmos.group.v1.MsgCreateGroup", MsgCreateGroup], ["/cosmos.group.v1.MsgUpdateGroupMembers", MsgUpdateGroupMembers], ["/cosmos.group.v1.MsgUpdateGroupAdmin", MsgUpdateGroupAdmin], ["/cosmos.group.v1.MsgUpdateGroupMetadata", MsgUpdateGroupMetadata], ["/cosmos.group.v1.MsgCreateGroupPolicy", MsgCreateGroupPolicy], ["/cosmos.group.v1.MsgCreateGroupWithPolicy", MsgCreateGroupWithPolicy], ["/cosmos.group.v1.MsgUpdateGroupPolicyAdmin", MsgUpdateGroupPolicyAdmin], ["/cosmos.group.v1.MsgUpdateGroupPolicyDecisionPolicy", MsgUpdateGroupPolicyDecisionPolicy], ["/cosmos.group.v1.MsgUpdateGroupPolicyMetadata", MsgUpdateGroupPolicyMetadata], ["/cosmos.group.v1.MsgSubmitProposal", MsgSubmitProposal], ["/cosmos.group.v1.MsgWithdrawProposal", MsgWithdrawProposal], ["/cosmos.group.v1.MsgVote", MsgVote], ["/cosmos.group.v1.MsgExec", MsgExec], ["/cosmos.group.v1.MsgLeaveGroup", MsgLeaveGroup]]; export const MessageComposer = { encoded: { createGroup(value: MsgCreateGroup) { diff --git a/__fixtures__/v-next/outputv4/cosmos/group/v1/tx.rpc.func.ts b/__fixtures__/v-next/outputv4/cosmos/group/v1/tx.rpc.func.ts new file mode 100644 index 0000000000..2bac5f3524 --- /dev/null +++ b/__fixtures__/v-next/outputv4/cosmos/group/v1/tx.rpc.func.ts @@ -0,0 +1,130 @@ +import { Member, MemberSDKType, VoteOption, VoteOptionSDKType } from "./types.js"; +import { Any, AnySDKType } from "../../../google/protobuf/any.js"; +import { buildTx } from "../../../helper-func-types.js"; +import { MsgCreateGroup, MsgCreateGroupSDKType, MsgCreateGroupResponse, MsgCreateGroupResponseSDKType, MsgUpdateGroupMembers, MsgUpdateGroupMembersSDKType, MsgUpdateGroupMembersResponse, MsgUpdateGroupMembersResponseSDKType, MsgUpdateGroupAdmin, MsgUpdateGroupAdminSDKType, MsgUpdateGroupAdminResponse, MsgUpdateGroupAdminResponseSDKType, MsgUpdateGroupMetadata, MsgUpdateGroupMetadataSDKType, MsgUpdateGroupMetadataResponse, MsgUpdateGroupMetadataResponseSDKType, MsgCreateGroupPolicy, MsgCreateGroupPolicySDKType, MsgCreateGroupPolicyResponse, MsgCreateGroupPolicyResponseSDKType, MsgCreateGroupWithPolicy, MsgCreateGroupWithPolicySDKType, MsgCreateGroupWithPolicyResponse, MsgCreateGroupWithPolicyResponseSDKType, MsgUpdateGroupPolicyAdmin, MsgUpdateGroupPolicyAdminSDKType, MsgUpdateGroupPolicyAdminResponse, MsgUpdateGroupPolicyAdminResponseSDKType, MsgUpdateGroupPolicyDecisionPolicy, MsgUpdateGroupPolicyDecisionPolicySDKType, MsgUpdateGroupPolicyDecisionPolicyResponse, MsgUpdateGroupPolicyDecisionPolicyResponseSDKType, MsgUpdateGroupPolicyMetadata, MsgUpdateGroupPolicyMetadataSDKType, MsgUpdateGroupPolicyMetadataResponse, MsgUpdateGroupPolicyMetadataResponseSDKType, MsgSubmitProposal, MsgSubmitProposalSDKType, MsgSubmitProposalResponse, MsgSubmitProposalResponseSDKType, MsgWithdrawProposal, MsgWithdrawProposalSDKType, MsgWithdrawProposalResponse, MsgWithdrawProposalResponseSDKType, MsgVote, MsgVoteSDKType, MsgVoteResponse, MsgVoteResponseSDKType, MsgExec, MsgExecSDKType, MsgExecResponse, MsgExecResponseSDKType, MsgLeaveGroup, MsgLeaveGroupSDKType, MsgLeaveGroupResponse, MsgLeaveGroupResponseSDKType } from "./tx.js"; +/** + * CreateGroup creates a new group with an admin account address, a list of members and some optional metadata. + * @name createGroup + * @package cosmos.group.v1 + * @see proto service: cosmos.group.v1.CreateGroup + */ +export const createGroup = buildTx({ + msg: MsgCreateGroup +}); +/** + * UpdateGroupMembers updates the group members with given group id and admin address. + * @name updateGroupMembers + * @package cosmos.group.v1 + * @see proto service: cosmos.group.v1.UpdateGroupMembers + */ +export const updateGroupMembers = buildTx({ + msg: MsgUpdateGroupMembers +}); +/** + * UpdateGroupAdmin updates the group admin with given group id and previous admin address. + * @name updateGroupAdmin + * @package cosmos.group.v1 + * @see proto service: cosmos.group.v1.UpdateGroupAdmin + */ +export const updateGroupAdmin = buildTx({ + msg: MsgUpdateGroupAdmin +}); +/** + * UpdateGroupMetadata updates the group metadata with given group id and admin address. + * @name updateGroupMetadata + * @package cosmos.group.v1 + * @see proto service: cosmos.group.v1.UpdateGroupMetadata + */ +export const updateGroupMetadata = buildTx({ + msg: MsgUpdateGroupMetadata +}); +/** + * CreateGroupPolicy creates a new group policy using given DecisionPolicy. + * @name createGroupPolicy + * @package cosmos.group.v1 + * @see proto service: cosmos.group.v1.CreateGroupPolicy + */ +export const createGroupPolicy = buildTx({ + msg: MsgCreateGroupPolicy +}); +/** + * CreateGroupWithPolicy creates a new group with policy. + * @name createGroupWithPolicy + * @package cosmos.group.v1 + * @see proto service: cosmos.group.v1.CreateGroupWithPolicy + */ +export const createGroupWithPolicy = buildTx({ + msg: MsgCreateGroupWithPolicy +}); +/** + * UpdateGroupPolicyAdmin updates a group policy admin. + * @name updateGroupPolicyAdmin + * @package cosmos.group.v1 + * @see proto service: cosmos.group.v1.UpdateGroupPolicyAdmin + */ +export const updateGroupPolicyAdmin = buildTx({ + msg: MsgUpdateGroupPolicyAdmin +}); +/** + * UpdateGroupPolicyDecisionPolicy allows a group policy's decision policy to be updated. + * @name updateGroupPolicyDecisionPolicy + * @package cosmos.group.v1 + * @see proto service: cosmos.group.v1.UpdateGroupPolicyDecisionPolicy + */ +export const updateGroupPolicyDecisionPolicy = buildTx({ + msg: MsgUpdateGroupPolicyDecisionPolicy +}); +/** + * UpdateGroupPolicyMetadata updates a group policy metadata. + * @name updateGroupPolicyMetadata + * @package cosmos.group.v1 + * @see proto service: cosmos.group.v1.UpdateGroupPolicyMetadata + */ +export const updateGroupPolicyMetadata = buildTx({ + msg: MsgUpdateGroupPolicyMetadata +}); +/** + * SubmitProposal submits a new proposal. + * @name submitProposal + * @package cosmos.group.v1 + * @see proto service: cosmos.group.v1.SubmitProposal + */ +export const submitProposal = buildTx({ + msg: MsgSubmitProposal +}); +/** + * WithdrawProposal aborts a proposal. + * @name withdrawProposal + * @package cosmos.group.v1 + * @see proto service: cosmos.group.v1.WithdrawProposal + */ +export const withdrawProposal = buildTx({ + msg: MsgWithdrawProposal +}); +/** + * Vote allows a voter to vote on a proposal. + * @name vote + * @package cosmos.group.v1 + * @see proto service: cosmos.group.v1.Vote + */ +export const vote = buildTx({ + msg: MsgVote +}); +/** + * Exec executes a proposal. + * @name exec + * @package cosmos.group.v1 + * @see proto service: cosmos.group.v1.Exec + */ +export const exec = buildTx({ + msg: MsgExec +}); +/** + * LeaveGroup allows a group member to leave the group. + * @name leaveGroup + * @package cosmos.group.v1 + * @see proto service: cosmos.group.v1.LeaveGroup + */ +export const leaveGroup = buildTx({ + msg: MsgLeaveGroup +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/cosmos/group/v1/tx.rpc.msg.ts b/__fixtures__/v-next/outputv4/cosmos/group/v1/tx.rpc.msg.ts index fb494e3543..7159595d8c 100644 --- a/__fixtures__/v-next/outputv4/cosmos/group/v1/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputv4/cosmos/group/v1/tx.rpc.msg.ts @@ -1,6 +1,6 @@ import { Member, MemberSDKType, VoteOption, VoteOptionSDKType } from "./types.js"; import { Any, AnySDKType } from "../../../google/protobuf/any.js"; -import { Rpc } from "../../../helpers.js"; +import { TxRpc } from "../../../types.js"; import { BinaryReader } from "../../../binary.js"; import { MsgCreateGroup, MsgCreateGroupSDKType, MsgCreateGroupResponse, MsgCreateGroupResponseSDKType, MsgUpdateGroupMembers, MsgUpdateGroupMembersSDKType, MsgUpdateGroupMembersResponse, MsgUpdateGroupMembersResponseSDKType, MsgUpdateGroupAdmin, MsgUpdateGroupAdminSDKType, MsgUpdateGroupAdminResponse, MsgUpdateGroupAdminResponseSDKType, MsgUpdateGroupMetadata, MsgUpdateGroupMetadataSDKType, MsgUpdateGroupMetadataResponse, MsgUpdateGroupMetadataResponseSDKType, MsgCreateGroupPolicy, MsgCreateGroupPolicySDKType, MsgCreateGroupPolicyResponse, MsgCreateGroupPolicyResponseSDKType, MsgCreateGroupWithPolicy, MsgCreateGroupWithPolicySDKType, MsgCreateGroupWithPolicyResponse, MsgCreateGroupWithPolicyResponseSDKType, MsgUpdateGroupPolicyAdmin, MsgUpdateGroupPolicyAdminSDKType, MsgUpdateGroupPolicyAdminResponse, MsgUpdateGroupPolicyAdminResponseSDKType, MsgUpdateGroupPolicyDecisionPolicy, MsgUpdateGroupPolicyDecisionPolicySDKType, MsgUpdateGroupPolicyDecisionPolicyResponse, MsgUpdateGroupPolicyDecisionPolicyResponseSDKType, MsgUpdateGroupPolicyMetadata, MsgUpdateGroupPolicyMetadataSDKType, MsgUpdateGroupPolicyMetadataResponse, MsgUpdateGroupPolicyMetadataResponseSDKType, MsgSubmitProposal, MsgSubmitProposalSDKType, MsgSubmitProposalResponse, MsgSubmitProposalResponseSDKType, MsgWithdrawProposal, MsgWithdrawProposalSDKType, MsgWithdrawProposalResponse, MsgWithdrawProposalResponseSDKType, MsgVote, MsgVoteSDKType, MsgVoteResponse, MsgVoteResponseSDKType, MsgExec, MsgExecSDKType, MsgExecResponse, MsgExecResponseSDKType, MsgLeaveGroup, MsgLeaveGroupSDKType, MsgLeaveGroupResponse, MsgLeaveGroupResponseSDKType } from "./tx.js"; /** Msg is the cosmos.group.v1 Msg service. */ @@ -35,8 +35,8 @@ export interface Msg { leaveGroup(request: MsgLeaveGroup): Promise; } export class MsgClientImpl implements Msg { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.createGroup = this.createGroup.bind(this); this.updateGroupMembers = this.updateGroupMembers.bind(this); @@ -124,6 +124,6 @@ export class MsgClientImpl implements Msg { return promise.then(data => MsgLeaveGroupResponse.decode(new BinaryReader(data))); } } -export const createClientImpl = (rpc: Rpc) => { +export const createClientImpl = (rpc: TxRpc) => { return new MsgClientImpl(rpc); }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/cosmos/mint/v1beta1/mint.ts b/__fixtures__/v-next/outputv4/cosmos/mint/v1beta1/mint.ts index fd0b430ea8..3b6b5e6de6 100644 --- a/__fixtures__/v-next/outputv4/cosmos/mint/v1beta1/mint.ts +++ b/__fixtures__/v-next/outputv4/cosmos/mint/v1beta1/mint.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary.js"; -import { Decimal } from "@cosmjs/math"; +import { Decimal } from "@interchainjs/math"; import { isSet, DeepPartial } from "../../../helpers.js"; import { JsonSafe } from "../../../json-safe.js"; export const protobufPackage = "cosmos.mint.v1beta1"; @@ -174,8 +174,8 @@ export const Minter = { }, toAmino(message: Minter): MinterAmino { const obj: any = {}; - obj.inflation = message.inflation === "" ? undefined : message.inflation; - obj.annual_provisions = message.annualProvisions === "" ? undefined : message.annualProvisions; + obj.inflation = message.inflation === "" ? undefined : Decimal.fromUserInput(message.inflation, 18).atomics; + obj.annual_provisions = message.annualProvisions === "" ? undefined : Decimal.fromUserInput(message.annualProvisions, 18).atomics; return obj; }, fromAminoMsg(object: MinterAminoMsg): Minter { @@ -358,10 +358,10 @@ export const Params = { toAmino(message: Params): ParamsAmino { const obj: any = {}; obj.mint_denom = message.mintDenom === "" ? undefined : message.mintDenom; - obj.inflation_rate_change = message.inflationRateChange === "" ? undefined : message.inflationRateChange; - obj.inflation_max = message.inflationMax === "" ? undefined : message.inflationMax; - obj.inflation_min = message.inflationMin === "" ? undefined : message.inflationMin; - obj.goal_bonded = message.goalBonded === "" ? undefined : message.goalBonded; + obj.inflation_rate_change = message.inflationRateChange === "" ? undefined : Decimal.fromUserInput(message.inflationRateChange, 18).atomics; + obj.inflation_max = message.inflationMax === "" ? undefined : Decimal.fromUserInput(message.inflationMax, 18).atomics; + obj.inflation_min = message.inflationMin === "" ? undefined : Decimal.fromUserInput(message.inflationMin, 18).atomics; + obj.goal_bonded = message.goalBonded === "" ? undefined : Decimal.fromUserInput(message.goalBonded, 18).atomics; obj.blocks_per_year = message.blocksPerYear !== BigInt(0) ? message.blocksPerYear?.toString() : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv4/cosmos/mint/v1beta1/query.rpc.Query.ts b/__fixtures__/v-next/outputv4/cosmos/mint/v1beta1/query.rpc.Query.ts index 60a24be7ad..68c81424bc 100644 --- a/__fixtures__/v-next/outputv4/cosmos/mint/v1beta1/query.rpc.Query.ts +++ b/__fixtures__/v-next/outputv4/cosmos/mint/v1beta1/query.rpc.Query.ts @@ -1,5 +1,5 @@ import { Params, ParamsSDKType } from "./mint.js"; -import { Rpc } from "../../../helpers.js"; +import { TxRpc } from "../../../types.js"; import { BinaryReader } from "../../../binary.js"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; import { QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, QueryInflationRequest, QueryInflationRequestSDKType, QueryInflationResponse, QueryInflationResponseSDKType, QueryAnnualProvisionsRequest, QueryAnnualProvisionsRequestSDKType, QueryAnnualProvisionsResponse, QueryAnnualProvisionsResponseSDKType } from "./query.js"; @@ -13,8 +13,8 @@ export interface Query { annualProvisions(request?: QueryAnnualProvisionsRequest): Promise; } export class QueryClientImpl implements Query { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.params = this.params.bind(this); this.inflation = this.inflation.bind(this); diff --git a/__fixtures__/v-next/outputv4/cosmos/mint/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputv4/cosmos/mint/v1beta1/query.rpc.func.ts new file mode 100644 index 0000000000..fc31c8e69a --- /dev/null +++ b/__fixtures__/v-next/outputv4/cosmos/mint/v1beta1/query.rpc.func.ts @@ -0,0 +1,39 @@ +import { Params, ParamsSDKType } from "./mint.js"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types.js"; +import { QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, QueryInflationRequest, QueryInflationRequestSDKType, QueryInflationResponse, QueryInflationResponseSDKType, QueryAnnualProvisionsRequest, QueryAnnualProvisionsRequestSDKType, QueryAnnualProvisionsResponse, QueryAnnualProvisionsResponseSDKType } from "./query.js"; +/** + * Params returns the total set of minting parameters. + * @name getParams + * @package cosmos.mint.v1beta1 + * @see proto service: cosmos.mint.v1beta1.Params + */ +export const getParams = buildQuery({ + encode: QueryParamsRequest.encode, + decode: QueryParamsResponse.decode, + service: "cosmos.mint.v1beta1.Query", + method: "Params" +}); +/** + * Inflation returns the current minting inflation value. + * @name getInflation + * @package cosmos.mint.v1beta1 + * @see proto service: cosmos.mint.v1beta1.Inflation + */ +export const getInflation = buildQuery({ + encode: QueryInflationRequest.encode, + decode: QueryInflationResponse.decode, + service: "cosmos.mint.v1beta1.Query", + method: "Inflation" +}); +/** + * AnnualProvisions current minting annual provisions value. + * @name getAnnualProvisions + * @package cosmos.mint.v1beta1 + * @see proto service: cosmos.mint.v1beta1.AnnualProvisions + */ +export const getAnnualProvisions = buildQuery({ + encode: QueryAnnualProvisionsRequest.encode, + decode: QueryAnnualProvisionsResponse.decode, + service: "cosmos.mint.v1beta1.Query", + method: "AnnualProvisions" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/cosmos/nft/v1beta1/query.rpc.Query.ts b/__fixtures__/v-next/outputv4/cosmos/nft/v1beta1/query.rpc.Query.ts index abe44f5797..40cf384d08 100644 --- a/__fixtures__/v-next/outputv4/cosmos/nft/v1beta1/query.rpc.Query.ts +++ b/__fixtures__/v-next/outputv4/cosmos/nft/v1beta1/query.rpc.Query.ts @@ -1,6 +1,6 @@ import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination.js"; import { NFT, NFTSDKType, Class, ClassSDKType } from "./nft.js"; -import { Rpc } from "../../../helpers.js"; +import { TxRpc } from "../../../types.js"; import { BinaryReader } from "../../../binary.js"; import { QueryClient, createProtobufRpcClient, ProtobufRpcClient } from "@cosmjs/stargate"; import { ReactQueryParams } from "../../../react-query.js"; @@ -27,8 +27,8 @@ export interface Query { classes(request?: QueryClassesRequest): Promise; } export class QueryClientImpl implements Query { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.balance = this.balance.bind(this); this.owner = this.owner.bind(this); diff --git a/__fixtures__/v-next/outputv4/cosmos/nft/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputv4/cosmos/nft/v1beta1/query.rpc.func.ts new file mode 100644 index 0000000000..b4fea34e42 --- /dev/null +++ b/__fixtures__/v-next/outputv4/cosmos/nft/v1beta1/query.rpc.func.ts @@ -0,0 +1,89 @@ +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination.js"; +import { NFT, NFTSDKType, Class, ClassSDKType } from "./nft.js"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types.js"; +import { QueryBalanceRequest, QueryBalanceRequestSDKType, QueryBalanceResponse, QueryBalanceResponseSDKType, QueryOwnerRequest, QueryOwnerRequestSDKType, QueryOwnerResponse, QueryOwnerResponseSDKType, QuerySupplyRequest, QuerySupplyRequestSDKType, QuerySupplyResponse, QuerySupplyResponseSDKType, QueryNFTsRequest, QueryNFTsRequestSDKType, QueryNFTsResponse, QueryNFTsResponseSDKType, QueryNFTRequest, QueryNFTRequestSDKType, QueryNFTResponse, QueryNFTResponseSDKType, QueryClassRequest, QueryClassRequestSDKType, QueryClassResponse, QueryClassResponseSDKType, QueryClassesRequest, QueryClassesRequestSDKType, QueryClassesResponse, QueryClassesResponseSDKType } from "./query.js"; +/** + * Balance queries the number of NFTs of a given class owned by the owner, same as balanceOf in ERC721 + * @name getBalance + * @package cosmos.nft.v1beta1 + * @see proto service: cosmos.nft.v1beta1.Balance + */ +export const getBalance = buildQuery({ + encode: QueryBalanceRequest.encode, + decode: QueryBalanceResponse.decode, + service: "cosmos.nft.v1beta1.Query", + method: "Balance" +}); +/** + * Owner queries the owner of the NFT based on its class and id, same as ownerOf in ERC721 + * @name getOwner + * @package cosmos.nft.v1beta1 + * @see proto service: cosmos.nft.v1beta1.Owner + */ +export const getOwner = buildQuery({ + encode: QueryOwnerRequest.encode, + decode: QueryOwnerResponse.decode, + service: "cosmos.nft.v1beta1.Query", + method: "Owner" +}); +/** + * Supply queries the number of NFTs from the given class, same as totalSupply of ERC721. + * @name getSupply + * @package cosmos.nft.v1beta1 + * @see proto service: cosmos.nft.v1beta1.Supply + */ +export const getSupply = buildQuery({ + encode: QuerySupplyRequest.encode, + decode: QuerySupplyResponse.decode, + service: "cosmos.nft.v1beta1.Query", + method: "Supply" +}); +/** + * NFTs queries all NFTs of a given class or owner,choose at least one of the two, similar to tokenByIndex in + * ERC721Enumerable + * @name getNFTs + * @package cosmos.nft.v1beta1 + * @see proto service: cosmos.nft.v1beta1.NFTs + */ +export const getNFTs = buildQuery({ + encode: QueryNFTsRequest.encode, + decode: QueryNFTsResponse.decode, + service: "cosmos.nft.v1beta1.Query", + method: "NFTs" +}); +/** + * NFT queries an NFT based on its class and id. + * @name getNFT + * @package cosmos.nft.v1beta1 + * @see proto service: cosmos.nft.v1beta1.NFT + */ +export const getNFT = buildQuery({ + encode: QueryNFTRequest.encode, + decode: QueryNFTResponse.decode, + service: "cosmos.nft.v1beta1.Query", + method: "NFT" +}); +/** + * Class queries an NFT class based on its id + * @name getClass + * @package cosmos.nft.v1beta1 + * @see proto service: cosmos.nft.v1beta1.Class + */ +export const getClass = buildQuery({ + encode: QueryClassRequest.encode, + decode: QueryClassResponse.decode, + service: "cosmos.nft.v1beta1.Query", + method: "Class" +}); +/** + * Classes queries all NFT classes + * @name getClasses + * @package cosmos.nft.v1beta1 + * @see proto service: cosmos.nft.v1beta1.Classes + */ +export const getClasses = buildQuery({ + encode: QueryClassesRequest.encode, + decode: QueryClassesResponse.decode, + service: "cosmos.nft.v1beta1.Query", + method: "Classes" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/cosmos/nft/v1beta1/tx.registry.ts b/__fixtures__/v-next/outputv4/cosmos/nft/v1beta1/tx.registry.ts index e56ae140f0..3bd7b72775 100644 --- a/__fixtures__/v-next/outputv4/cosmos/nft/v1beta1/tx.registry.ts +++ b/__fixtures__/v-next/outputv4/cosmos/nft/v1beta1/tx.registry.ts @@ -1,11 +1,6 @@ -import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { TelescopeGeneratedType } from "../../../types.js"; import { MsgSend, MsgSendSDKType } from "./tx.js"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/cosmos.nft.v1beta1.MsgSend", MsgSend]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/cosmos.nft.v1beta1.MsgSend", MsgSend]]; export const MessageComposer = { encoded: { send(value: MsgSend) { diff --git a/__fixtures__/v-next/outputv4/cosmos/nft/v1beta1/tx.rpc.func.ts b/__fixtures__/v-next/outputv4/cosmos/nft/v1beta1/tx.rpc.func.ts new file mode 100644 index 0000000000..7224d1264d --- /dev/null +++ b/__fixtures__/v-next/outputv4/cosmos/nft/v1beta1/tx.rpc.func.ts @@ -0,0 +1,11 @@ +import { buildTx } from "../../../helper-func-types.js"; +import { MsgSend, MsgSendSDKType, MsgSendResponse, MsgSendResponseSDKType } from "./tx.js"; +/** + * Send defines a method to send a nft from one account to another account. + * @name send + * @package cosmos.nft.v1beta1 + * @see proto service: cosmos.nft.v1beta1.Send + */ +export const send = buildTx({ + msg: MsgSend +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/cosmos/nft/v1beta1/tx.rpc.msg.ts b/__fixtures__/v-next/outputv4/cosmos/nft/v1beta1/tx.rpc.msg.ts index 4b5be7dfb5..b094d0a513 100644 --- a/__fixtures__/v-next/outputv4/cosmos/nft/v1beta1/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputv4/cosmos/nft/v1beta1/tx.rpc.msg.ts @@ -1,4 +1,4 @@ -import { Rpc } from "../../../helpers.js"; +import { TxRpc } from "../../../types.js"; import { BinaryReader } from "../../../binary.js"; import { MsgSend, MsgSendSDKType, MsgSendResponse, MsgSendResponseSDKType } from "./tx.js"; /** Msg defines the nft Msg service. */ @@ -7,8 +7,8 @@ export interface Msg { send(request: MsgSend): Promise; } export class MsgClientImpl implements Msg { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.send = this.send.bind(this); } @@ -18,6 +18,6 @@ export class MsgClientImpl implements Msg { return promise.then(data => MsgSendResponse.decode(new BinaryReader(data))); } } -export const createClientImpl = (rpc: Rpc) => { +export const createClientImpl = (rpc: TxRpc) => { return new MsgClientImpl(rpc); }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/cosmos/params/v1beta1/query.rpc.Query.ts b/__fixtures__/v-next/outputv4/cosmos/params/v1beta1/query.rpc.Query.ts index 79b76656f2..6fda0d11f6 100644 --- a/__fixtures__/v-next/outputv4/cosmos/params/v1beta1/query.rpc.Query.ts +++ b/__fixtures__/v-next/outputv4/cosmos/params/v1beta1/query.rpc.Query.ts @@ -1,5 +1,5 @@ import { ParamChange, ParamChangeSDKType } from "./params.js"; -import { Rpc } from "../../../helpers.js"; +import { TxRpc } from "../../../types.js"; import { BinaryReader } from "../../../binary.js"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; import { QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, QuerySubspacesRequest, QuerySubspacesRequestSDKType, QuerySubspacesResponse, QuerySubspacesResponseSDKType } from "./query.js"; @@ -14,8 +14,8 @@ export interface Query { subspaces(request?: QuerySubspacesRequest): Promise; } export class QueryClientImpl implements Query { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.params = this.params.bind(this); this.subspaces = this.subspaces.bind(this); diff --git a/__fixtures__/v-next/outputv4/cosmos/params/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputv4/cosmos/params/v1beta1/query.rpc.func.ts new file mode 100644 index 0000000000..4d1c662098 --- /dev/null +++ b/__fixtures__/v-next/outputv4/cosmos/params/v1beta1/query.rpc.func.ts @@ -0,0 +1,28 @@ +import { ParamChange, ParamChangeSDKType } from "./params.js"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types.js"; +import { QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, QuerySubspacesRequest, QuerySubspacesRequestSDKType, QuerySubspacesResponse, QuerySubspacesResponseSDKType } from "./query.js"; +/** + * Params queries a specific parameter of a module, given its subspace and + * key. + * @name getParams + * @package cosmos.params.v1beta1 + * @see proto service: cosmos.params.v1beta1.Params + */ +export const getParams = buildQuery({ + encode: QueryParamsRequest.encode, + decode: QueryParamsResponse.decode, + service: "cosmos.params.v1beta1.Query", + method: "Params" +}); +/** + * Subspaces queries for all registered subspaces and all keys for a subspace. + * @name getSubspaces + * @package cosmos.params.v1beta1 + * @see proto service: cosmos.params.v1beta1.Subspaces + */ +export const getSubspaces = buildQuery({ + encode: QuerySubspacesRequest.encode, + decode: QuerySubspacesResponse.decode, + service: "cosmos.params.v1beta1.Query", + method: "Subspaces" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/cosmos/slashing/v1beta1/query.rpc.Query.ts b/__fixtures__/v-next/outputv4/cosmos/slashing/v1beta1/query.rpc.Query.ts index 0808cf79b5..ba6ad3eb02 100644 --- a/__fixtures__/v-next/outputv4/cosmos/slashing/v1beta1/query.rpc.Query.ts +++ b/__fixtures__/v-next/outputv4/cosmos/slashing/v1beta1/query.rpc.Query.ts @@ -1,6 +1,6 @@ import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination.js"; import { Params, ParamsSDKType, ValidatorSigningInfo, ValidatorSigningInfoSDKType } from "./slashing.js"; -import { Rpc } from "../../../helpers.js"; +import { TxRpc } from "../../../types.js"; import { BinaryReader } from "../../../binary.js"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; import { QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, QuerySigningInfoRequest, QuerySigningInfoRequestSDKType, QuerySigningInfoResponse, QuerySigningInfoResponseSDKType, QuerySigningInfosRequest, QuerySigningInfosRequestSDKType, QuerySigningInfosResponse, QuerySigningInfosResponseSDKType } from "./query.js"; @@ -14,8 +14,8 @@ export interface Query { signingInfos(request?: QuerySigningInfosRequest): Promise; } export class QueryClientImpl implements Query { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.params = this.params.bind(this); this.signingInfo = this.signingInfo.bind(this); diff --git a/__fixtures__/v-next/outputv4/cosmos/slashing/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputv4/cosmos/slashing/v1beta1/query.rpc.func.ts new file mode 100644 index 0000000000..e1dcd7f67e --- /dev/null +++ b/__fixtures__/v-next/outputv4/cosmos/slashing/v1beta1/query.rpc.func.ts @@ -0,0 +1,40 @@ +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination.js"; +import { Params, ParamsSDKType, ValidatorSigningInfo, ValidatorSigningInfoSDKType } from "./slashing.js"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types.js"; +import { QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, QuerySigningInfoRequest, QuerySigningInfoRequestSDKType, QuerySigningInfoResponse, QuerySigningInfoResponseSDKType, QuerySigningInfosRequest, QuerySigningInfosRequestSDKType, QuerySigningInfosResponse, QuerySigningInfosResponseSDKType } from "./query.js"; +/** + * Params queries the parameters of slashing module + * @name getParams + * @package cosmos.slashing.v1beta1 + * @see proto service: cosmos.slashing.v1beta1.Params + */ +export const getParams = buildQuery({ + encode: QueryParamsRequest.encode, + decode: QueryParamsResponse.decode, + service: "cosmos.slashing.v1beta1.Query", + method: "Params" +}); +/** + * SigningInfo queries the signing info of given cons address + * @name getSigningInfo + * @package cosmos.slashing.v1beta1 + * @see proto service: cosmos.slashing.v1beta1.SigningInfo + */ +export const getSigningInfo = buildQuery({ + encode: QuerySigningInfoRequest.encode, + decode: QuerySigningInfoResponse.decode, + service: "cosmos.slashing.v1beta1.Query", + method: "SigningInfo" +}); +/** + * SigningInfos queries signing info of all validators + * @name getSigningInfos + * @package cosmos.slashing.v1beta1 + * @see proto service: cosmos.slashing.v1beta1.SigningInfos + */ +export const getSigningInfos = buildQuery({ + encode: QuerySigningInfosRequest.encode, + decode: QuerySigningInfosResponse.decode, + service: "cosmos.slashing.v1beta1.Query", + method: "SigningInfos" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/cosmos/slashing/v1beta1/tx.registry.ts b/__fixtures__/v-next/outputv4/cosmos/slashing/v1beta1/tx.registry.ts index c7c212537b..a65a9841ca 100644 --- a/__fixtures__/v-next/outputv4/cosmos/slashing/v1beta1/tx.registry.ts +++ b/__fixtures__/v-next/outputv4/cosmos/slashing/v1beta1/tx.registry.ts @@ -1,11 +1,6 @@ -import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { TelescopeGeneratedType } from "../../../types.js"; import { MsgUnjail, MsgUnjailSDKType } from "./tx.js"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/cosmos.slashing.v1beta1.MsgUnjail", MsgUnjail]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/cosmos.slashing.v1beta1.MsgUnjail", MsgUnjail]]; export const MessageComposer = { encoded: { unjail(value: MsgUnjail) { diff --git a/__fixtures__/v-next/outputv4/cosmos/slashing/v1beta1/tx.rpc.func.ts b/__fixtures__/v-next/outputv4/cosmos/slashing/v1beta1/tx.rpc.func.ts new file mode 100644 index 0000000000..e53c250621 --- /dev/null +++ b/__fixtures__/v-next/outputv4/cosmos/slashing/v1beta1/tx.rpc.func.ts @@ -0,0 +1,13 @@ +import { buildTx } from "../../../helper-func-types.js"; +import { MsgUnjail, MsgUnjailSDKType, MsgUnjailResponse, MsgUnjailResponseSDKType } from "./tx.js"; +/** + * Unjail defines a method for unjailing a jailed validator, thus returning + * them into the bonded validator set, so they can begin receiving provisions + * and rewards again. + * @name unjail + * @package cosmos.slashing.v1beta1 + * @see proto service: cosmos.slashing.v1beta1.Unjail + */ +export const unjail = buildTx({ + msg: MsgUnjail +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/cosmos/slashing/v1beta1/tx.rpc.msg.ts b/__fixtures__/v-next/outputv4/cosmos/slashing/v1beta1/tx.rpc.msg.ts index 81e397e161..c559ba7275 100644 --- a/__fixtures__/v-next/outputv4/cosmos/slashing/v1beta1/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputv4/cosmos/slashing/v1beta1/tx.rpc.msg.ts @@ -1,4 +1,4 @@ -import { Rpc } from "../../../helpers.js"; +import { TxRpc } from "../../../types.js"; import { BinaryReader } from "../../../binary.js"; import { MsgUnjail, MsgUnjailSDKType, MsgUnjailResponse, MsgUnjailResponseSDKType } from "./tx.js"; /** Msg defines the slashing Msg service. */ @@ -11,8 +11,8 @@ export interface Msg { unjail(request: MsgUnjail): Promise; } export class MsgClientImpl implements Msg { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.unjail = this.unjail.bind(this); } @@ -22,6 +22,6 @@ export class MsgClientImpl implements Msg { return promise.then(data => MsgUnjailResponse.decode(new BinaryReader(data))); } } -export const createClientImpl = (rpc: Rpc) => { +export const createClientImpl = (rpc: TxRpc) => { return new MsgClientImpl(rpc); }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/cosmos/staking/v1beta1/query.rpc.Query.ts b/__fixtures__/v-next/outputv4/cosmos/staking/v1beta1/query.rpc.Query.ts index 6cb4037052..29d32e4665 100644 --- a/__fixtures__/v-next/outputv4/cosmos/staking/v1beta1/query.rpc.Query.ts +++ b/__fixtures__/v-next/outputv4/cosmos/staking/v1beta1/query.rpc.Query.ts @@ -1,6 +1,6 @@ import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination.js"; import { Validator, ValidatorSDKType, DelegationResponse, DelegationResponseSDKType, UnbondingDelegation, UnbondingDelegationSDKType, RedelegationResponse, RedelegationResponseSDKType, HistoricalInfo, HistoricalInfoSDKType, Pool, PoolSDKType, Params, ParamsSDKType } from "./staking.js"; -import { Rpc } from "../../../helpers.js"; +import { TxRpc } from "../../../types.js"; import { BinaryReader } from "../../../binary.js"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; import { QueryValidatorsRequest, QueryValidatorsRequestSDKType, QueryValidatorsResponse, QueryValidatorsResponseSDKType, QueryValidatorRequest, QueryValidatorRequestSDKType, QueryValidatorResponse, QueryValidatorResponseSDKType, QueryValidatorDelegationsRequest, QueryValidatorDelegationsRequestSDKType, QueryValidatorDelegationsResponse, QueryValidatorDelegationsResponseSDKType, QueryValidatorUnbondingDelegationsRequest, QueryValidatorUnbondingDelegationsRequestSDKType, QueryValidatorUnbondingDelegationsResponse, QueryValidatorUnbondingDelegationsResponseSDKType, QueryDelegationRequest, QueryDelegationRequestSDKType, QueryDelegationResponse, QueryDelegationResponseSDKType, QueryUnbondingDelegationRequest, QueryUnbondingDelegationRequestSDKType, QueryUnbondingDelegationResponse, QueryUnbondingDelegationResponseSDKType, QueryDelegatorDelegationsRequest, QueryDelegatorDelegationsRequestSDKType, QueryDelegatorDelegationsResponse, QueryDelegatorDelegationsResponseSDKType, QueryDelegatorUnbondingDelegationsRequest, QueryDelegatorUnbondingDelegationsRequestSDKType, QueryDelegatorUnbondingDelegationsResponse, QueryDelegatorUnbondingDelegationsResponseSDKType, QueryRedelegationsRequest, QueryRedelegationsRequestSDKType, QueryRedelegationsResponse, QueryRedelegationsResponseSDKType, QueryDelegatorValidatorsRequest, QueryDelegatorValidatorsRequestSDKType, QueryDelegatorValidatorsResponse, QueryDelegatorValidatorsResponseSDKType, QueryDelegatorValidatorRequest, QueryDelegatorValidatorRequestSDKType, QueryDelegatorValidatorResponse, QueryDelegatorValidatorResponseSDKType, QueryHistoricalInfoRequest, QueryHistoricalInfoRequestSDKType, QueryHistoricalInfoResponse, QueryHistoricalInfoResponseSDKType, QueryPoolRequest, QueryPoolRequestSDKType, QueryPoolResponse, QueryPoolResponseSDKType, QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType } from "./query.js"; @@ -48,8 +48,8 @@ export interface Query { params(request?: QueryParamsRequest): Promise; } export class QueryClientImpl implements Query { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.validators = this.validators.bind(this); this.validator = this.validator.bind(this); diff --git a/__fixtures__/v-next/outputv4/cosmos/staking/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputv4/cosmos/staking/v1beta1/query.rpc.func.ts new file mode 100644 index 0000000000..24053138a1 --- /dev/null +++ b/__fixtures__/v-next/outputv4/cosmos/staking/v1beta1/query.rpc.func.ts @@ -0,0 +1,176 @@ +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination.js"; +import { Validator, ValidatorSDKType, DelegationResponse, DelegationResponseSDKType, UnbondingDelegation, UnbondingDelegationSDKType, RedelegationResponse, RedelegationResponseSDKType, HistoricalInfo, HistoricalInfoSDKType, Pool, PoolSDKType, Params, ParamsSDKType } from "./staking.js"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types.js"; +import { QueryValidatorsRequest, QueryValidatorsRequestSDKType, QueryValidatorsResponse, QueryValidatorsResponseSDKType, QueryValidatorRequest, QueryValidatorRequestSDKType, QueryValidatorResponse, QueryValidatorResponseSDKType, QueryValidatorDelegationsRequest, QueryValidatorDelegationsRequestSDKType, QueryValidatorDelegationsResponse, QueryValidatorDelegationsResponseSDKType, QueryValidatorUnbondingDelegationsRequest, QueryValidatorUnbondingDelegationsRequestSDKType, QueryValidatorUnbondingDelegationsResponse, QueryValidatorUnbondingDelegationsResponseSDKType, QueryDelegationRequest, QueryDelegationRequestSDKType, QueryDelegationResponse, QueryDelegationResponseSDKType, QueryUnbondingDelegationRequest, QueryUnbondingDelegationRequestSDKType, QueryUnbondingDelegationResponse, QueryUnbondingDelegationResponseSDKType, QueryDelegatorDelegationsRequest, QueryDelegatorDelegationsRequestSDKType, QueryDelegatorDelegationsResponse, QueryDelegatorDelegationsResponseSDKType, QueryDelegatorUnbondingDelegationsRequest, QueryDelegatorUnbondingDelegationsRequestSDKType, QueryDelegatorUnbondingDelegationsResponse, QueryDelegatorUnbondingDelegationsResponseSDKType, QueryRedelegationsRequest, QueryRedelegationsRequestSDKType, QueryRedelegationsResponse, QueryRedelegationsResponseSDKType, QueryDelegatorValidatorsRequest, QueryDelegatorValidatorsRequestSDKType, QueryDelegatorValidatorsResponse, QueryDelegatorValidatorsResponseSDKType, QueryDelegatorValidatorRequest, QueryDelegatorValidatorRequestSDKType, QueryDelegatorValidatorResponse, QueryDelegatorValidatorResponseSDKType, QueryHistoricalInfoRequest, QueryHistoricalInfoRequestSDKType, QueryHistoricalInfoResponse, QueryHistoricalInfoResponseSDKType, QueryPoolRequest, QueryPoolRequestSDKType, QueryPoolResponse, QueryPoolResponseSDKType, QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType } from "./query.js"; +/** + * Validators queries all validators that match the given status. + * @name getValidators + * @package cosmos.staking.v1beta1 + * @see proto service: cosmos.staking.v1beta1.Validators + */ +export const getValidators = buildQuery({ + encode: QueryValidatorsRequest.encode, + decode: QueryValidatorsResponse.decode, + service: "cosmos.staking.v1beta1.Query", + method: "Validators" +}); +/** + * Validator queries validator info for given validator address. + * @name getValidator + * @package cosmos.staking.v1beta1 + * @see proto service: cosmos.staking.v1beta1.Validator + */ +export const getValidator = buildQuery({ + encode: QueryValidatorRequest.encode, + decode: QueryValidatorResponse.decode, + service: "cosmos.staking.v1beta1.Query", + method: "Validator" +}); +/** + * ValidatorDelegations queries delegate info for given validator. + * @name getValidatorDelegations + * @package cosmos.staking.v1beta1 + * @see proto service: cosmos.staking.v1beta1.ValidatorDelegations + */ +export const getValidatorDelegations = buildQuery({ + encode: QueryValidatorDelegationsRequest.encode, + decode: QueryValidatorDelegationsResponse.decode, + service: "cosmos.staking.v1beta1.Query", + method: "ValidatorDelegations" +}); +/** + * ValidatorUnbondingDelegations queries unbonding delegations of a validator. + * @name getValidatorUnbondingDelegations + * @package cosmos.staking.v1beta1 + * @see proto service: cosmos.staking.v1beta1.ValidatorUnbondingDelegations + */ +export const getValidatorUnbondingDelegations = buildQuery({ + encode: QueryValidatorUnbondingDelegationsRequest.encode, + decode: QueryValidatorUnbondingDelegationsResponse.decode, + service: "cosmos.staking.v1beta1.Query", + method: "ValidatorUnbondingDelegations" +}); +/** + * Delegation queries delegate info for given validator delegator pair. + * @name getDelegation + * @package cosmos.staking.v1beta1 + * @see proto service: cosmos.staking.v1beta1.Delegation + */ +export const getDelegation = buildQuery({ + encode: QueryDelegationRequest.encode, + decode: QueryDelegationResponse.decode, + service: "cosmos.staking.v1beta1.Query", + method: "Delegation" +}); +/** + * UnbondingDelegation queries unbonding info for given validator delegator + * pair. + * @name getUnbondingDelegation + * @package cosmos.staking.v1beta1 + * @see proto service: cosmos.staking.v1beta1.UnbondingDelegation + */ +export const getUnbondingDelegation = buildQuery({ + encode: QueryUnbondingDelegationRequest.encode, + decode: QueryUnbondingDelegationResponse.decode, + service: "cosmos.staking.v1beta1.Query", + method: "UnbondingDelegation" +}); +/** + * DelegatorDelegations queries all delegations of a given delegator address. + * @name getDelegatorDelegations + * @package cosmos.staking.v1beta1 + * @see proto service: cosmos.staking.v1beta1.DelegatorDelegations + */ +export const getDelegatorDelegations = buildQuery({ + encode: QueryDelegatorDelegationsRequest.encode, + decode: QueryDelegatorDelegationsResponse.decode, + service: "cosmos.staking.v1beta1.Query", + method: "DelegatorDelegations" +}); +/** + * DelegatorUnbondingDelegations queries all unbonding delegations of a given + * delegator address. + * @name getDelegatorUnbondingDelegations + * @package cosmos.staking.v1beta1 + * @see proto service: cosmos.staking.v1beta1.DelegatorUnbondingDelegations + */ +export const getDelegatorUnbondingDelegations = buildQuery({ + encode: QueryDelegatorUnbondingDelegationsRequest.encode, + decode: QueryDelegatorUnbondingDelegationsResponse.decode, + service: "cosmos.staking.v1beta1.Query", + method: "DelegatorUnbondingDelegations" +}); +/** + * Redelegations queries redelegations of given address. + * @name getRedelegations + * @package cosmos.staking.v1beta1 + * @see proto service: cosmos.staking.v1beta1.Redelegations + */ +export const getRedelegations = buildQuery({ + encode: QueryRedelegationsRequest.encode, + decode: QueryRedelegationsResponse.decode, + service: "cosmos.staking.v1beta1.Query", + method: "Redelegations" +}); +/** + * DelegatorValidators queries all validators info for given delegator + * address. + * @name getDelegatorValidators + * @package cosmos.staking.v1beta1 + * @see proto service: cosmos.staking.v1beta1.DelegatorValidators + */ +export const getDelegatorValidators = buildQuery({ + encode: QueryDelegatorValidatorsRequest.encode, + decode: QueryDelegatorValidatorsResponse.decode, + service: "cosmos.staking.v1beta1.Query", + method: "DelegatorValidators" +}); +/** + * DelegatorValidator queries validator info for given delegator validator + * pair. + * @name getDelegatorValidator + * @package cosmos.staking.v1beta1 + * @see proto service: cosmos.staking.v1beta1.DelegatorValidator + */ +export const getDelegatorValidator = buildQuery({ + encode: QueryDelegatorValidatorRequest.encode, + decode: QueryDelegatorValidatorResponse.decode, + service: "cosmos.staking.v1beta1.Query", + method: "DelegatorValidator" +}); +/** + * HistoricalInfo queries the historical info for given height. + * @name getHistoricalInfo + * @package cosmos.staking.v1beta1 + * @see proto service: cosmos.staking.v1beta1.HistoricalInfo + */ +export const getHistoricalInfo = buildQuery({ + encode: QueryHistoricalInfoRequest.encode, + decode: QueryHistoricalInfoResponse.decode, + service: "cosmos.staking.v1beta1.Query", + method: "HistoricalInfo" +}); +/** + * Pool queries the pool info. + * @name getPool + * @package cosmos.staking.v1beta1 + * @see proto service: cosmos.staking.v1beta1.Pool + */ +export const getPool = buildQuery({ + encode: QueryPoolRequest.encode, + decode: QueryPoolResponse.decode, + service: "cosmos.staking.v1beta1.Query", + method: "Pool" +}); +/** + * Parameters queries the staking parameters. + * @name getParams + * @package cosmos.staking.v1beta1 + * @see proto service: cosmos.staking.v1beta1.Params + */ +export const getParams = buildQuery({ + encode: QueryParamsRequest.encode, + decode: QueryParamsResponse.decode, + service: "cosmos.staking.v1beta1.Query", + method: "Params" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/cosmos/staking/v1beta1/staking.ts b/__fixtures__/v-next/outputv4/cosmos/staking/v1beta1/staking.ts index a5e46c7cb9..3d88553fd0 100644 --- a/__fixtures__/v-next/outputv4/cosmos/staking/v1beta1/staking.ts +++ b/__fixtures__/v-next/outputv4/cosmos/staking/v1beta1/staking.ts @@ -6,8 +6,8 @@ import { Coin, CoinSDKType } from "../../base/v1beta1/coin.js"; import { BinaryReader, BinaryWriter } from "../../../binary.js"; import { isSet, DeepPartial, toTimestamp, fromTimestamp } from "../../../helpers.js"; import { JsonSafe } from "../../../json-safe.js"; -import { Decimal } from "@cosmjs/math"; -import { encodePubkey, decodePubkey } from "@cosmjs/proto-signing"; +import { Decimal } from "@interchainjs/math"; +import { encodePubkey, decodePubkey } from "@interchainjs/pubkey"; export const protobufPackage = "cosmos.staking.v1beta1"; /** BondStatus is the status of a validator. */ export enum BondStatus { @@ -1010,9 +1010,9 @@ export const CommissionRates = { }, toAmino(message: CommissionRates): CommissionRatesAmino { const obj: any = {}; - obj.rate = message.rate === "" ? undefined : message.rate; - obj.max_rate = message.maxRate === "" ? undefined : message.maxRate; - obj.max_change_rate = message.maxChangeRate === "" ? undefined : message.maxChangeRate; + obj.rate = message.rate === "" ? undefined : Decimal.fromUserInput(message.rate, 18).atomics; + obj.max_rate = message.maxRate === "" ? undefined : Decimal.fromUserInput(message.maxRate, 18).atomics; + obj.max_change_rate = message.maxChangeRate === "" ? undefined : Decimal.fromUserInput(message.maxChangeRate, 18).atomics; return obj; }, fromAminoMsg(object: CommissionRatesAminoMsg): CommissionRates { @@ -1579,7 +1579,7 @@ export const Validator = { obj.jailed = message.jailed === false ? undefined : message.jailed; obj.status = message.status === 0 ? undefined : message.status; obj.tokens = message.tokens === "" ? undefined : message.tokens; - obj.delegator_shares = message.delegatorShares === "" ? undefined : message.delegatorShares; + obj.delegator_shares = message.delegatorShares === "" ? undefined : Decimal.fromUserInput(message.delegatorShares, 18).atomics; obj.description = message.description ? Description.toAmino(message.description) : undefined; obj.unbonding_height = message.unbondingHeight !== BigInt(0) ? message.unbondingHeight?.toString() : undefined; obj.unbonding_time = message.unbondingTime ? Timestamp.toAmino(toTimestamp(message.unbondingTime)) : undefined; @@ -2306,7 +2306,7 @@ export const Delegation = { const obj: any = {}; obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; - obj.shares = message.shares === "" ? undefined : message.shares; + obj.shares = message.shares === "" ? undefined : Decimal.fromUserInput(message.shares, 18).atomics; return obj; }, fromAminoMsg(object: DelegationAminoMsg): Delegation { @@ -2757,7 +2757,7 @@ export const RedelegationEntry = { obj.creation_height = message.creationHeight !== BigInt(0) ? message.creationHeight?.toString() : undefined; obj.completion_time = message.completionTime ? Timestamp.toAmino(toTimestamp(message.completionTime)) : undefined; obj.initial_balance = message.initialBalance === "" ? undefined : message.initialBalance; - obj.shares_dst = message.sharesDst === "" ? undefined : message.sharesDst; + obj.shares_dst = message.sharesDst === "" ? undefined : Decimal.fromUserInput(message.sharesDst, 18).atomics; return obj; }, fromAminoMsg(object: RedelegationEntryAminoMsg): RedelegationEntry { @@ -3106,7 +3106,7 @@ export const Params = { obj.max_entries = message.maxEntries === 0 ? undefined : message.maxEntries; obj.historical_entries = message.historicalEntries === 0 ? undefined : message.historicalEntries; obj.bond_denom = message.bondDenom === "" ? undefined : message.bondDenom; - obj.min_commission_rate = message.minCommissionRate === "" ? undefined : message.minCommissionRate; + obj.min_commission_rate = message.minCommissionRate === "" ? undefined : Decimal.fromUserInput(message.minCommissionRate, 18).atomics; return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputv4/cosmos/staking/v1beta1/tx.amino.ts b/__fixtures__/v-next/outputv4/cosmos/staking/v1beta1/tx.amino.ts index 7007045acd..82c0248e7c 100644 --- a/__fixtures__/v-next/outputv4/cosmos/staking/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/cosmos/staking/v1beta1/tx.amino.ts @@ -3,7 +3,8 @@ import { Any, AnySDKType } from "../../../google/protobuf/any.js"; import { Coin, CoinSDKType } from "../../base/v1beta1/coin.js"; import { Timestamp, TimestampSDKType } from "../../../google/protobuf/timestamp.js"; import { AminoMsg, Pubkey } from "@cosmjs/amino"; -import { decodePubkey, encodePubkey } from "@cosmjs/proto-signing"; +import { Decimal } from "@interchainjs/math"; +import { decodePubkey, encodePubkey } from "@interchainjs/pubkey"; import { MsgCreateValidator, MsgCreateValidatorSDKType, MsgEditValidator, MsgEditValidatorSDKType, MsgDelegate, MsgDelegateSDKType, MsgBeginRedelegate, MsgBeginRedelegateSDKType, MsgUndelegate, MsgUndelegateSDKType } from "./tx.js"; export interface MsgCreateValidatorAminoType extends AminoMsg { type: "cosmos-sdk/MsgCreateValidator"; @@ -100,9 +101,9 @@ export const AminoConverter = { details: description.details }, commission: { - rate: commission.rate, - max_rate: commission.maxRate, - max_change_rate: commission.maxChangeRate + rate: Decimal.fromUserInput(commission.rate, 18).atomics, + max_rate: Decimal.fromUserInput(commission.maxRate, 18).atomics, + max_change_rate: Decimal.fromUserInput(commission.maxChangeRate, 18).atomics }, min_self_delegation: minSelfDelegation, delegator_address: delegatorAddress, @@ -164,7 +165,7 @@ export const AminoConverter = { details: description.details }, validator_address: validatorAddress, - commission_rate: commissionRate, + commission_rate: Decimal.fromUserInput(commissionRate, 18).atomics, min_self_delegation: minSelfDelegation }; }, diff --git a/__fixtures__/v-next/outputv4/cosmos/staking/v1beta1/tx.registry.ts b/__fixtures__/v-next/outputv4/cosmos/staking/v1beta1/tx.registry.ts index bf55cd2deb..a2e0f5a107 100644 --- a/__fixtures__/v-next/outputv4/cosmos/staking/v1beta1/tx.registry.ts +++ b/__fixtures__/v-next/outputv4/cosmos/staking/v1beta1/tx.registry.ts @@ -2,14 +2,9 @@ import { Description, DescriptionSDKType, CommissionRates, CommissionRatesSDKTyp import { Any, AnySDKType } from "../../../google/protobuf/any.js"; import { Coin, CoinSDKType } from "../../base/v1beta1/coin.js"; import { Timestamp, TimestampSDKType } from "../../../google/protobuf/timestamp.js"; -import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { TelescopeGeneratedType } from "../../../types.js"; import { MsgCreateValidator, MsgCreateValidatorSDKType, MsgEditValidator, MsgEditValidatorSDKType, MsgDelegate, MsgDelegateSDKType, MsgBeginRedelegate, MsgBeginRedelegateSDKType, MsgUndelegate, MsgUndelegateSDKType } from "./tx.js"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/cosmos.staking.v1beta1.MsgCreateValidator", MsgCreateValidator], ["/cosmos.staking.v1beta1.MsgEditValidator", MsgEditValidator], ["/cosmos.staking.v1beta1.MsgDelegate", MsgDelegate], ["/cosmos.staking.v1beta1.MsgBeginRedelegate", MsgBeginRedelegate], ["/cosmos.staking.v1beta1.MsgUndelegate", MsgUndelegate]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/cosmos.staking.v1beta1.MsgCreateValidator", MsgCreateValidator], ["/cosmos.staking.v1beta1.MsgEditValidator", MsgEditValidator], ["/cosmos.staking.v1beta1.MsgDelegate", MsgDelegate], ["/cosmos.staking.v1beta1.MsgBeginRedelegate", MsgBeginRedelegate], ["/cosmos.staking.v1beta1.MsgUndelegate", MsgUndelegate]]; export const MessageComposer = { encoded: { createValidator(value: MsgCreateValidator) { diff --git a/__fixtures__/v-next/outputv4/cosmos/staking/v1beta1/tx.rpc.func.ts b/__fixtures__/v-next/outputv4/cosmos/staking/v1beta1/tx.rpc.func.ts new file mode 100644 index 0000000000..45d66897a4 --- /dev/null +++ b/__fixtures__/v-next/outputv4/cosmos/staking/v1beta1/tx.rpc.func.ts @@ -0,0 +1,54 @@ +import { Description, DescriptionSDKType, CommissionRates, CommissionRatesSDKType } from "./staking.js"; +import { Any, AnySDKType } from "../../../google/protobuf/any.js"; +import { Coin, CoinSDKType } from "../../base/v1beta1/coin.js"; +import { Timestamp, TimestampSDKType } from "../../../google/protobuf/timestamp.js"; +import { buildTx } from "../../../helper-func-types.js"; +import { MsgCreateValidator, MsgCreateValidatorSDKType, MsgCreateValidatorResponse, MsgCreateValidatorResponseSDKType, MsgEditValidator, MsgEditValidatorSDKType, MsgEditValidatorResponse, MsgEditValidatorResponseSDKType, MsgDelegate, MsgDelegateSDKType, MsgDelegateResponse, MsgDelegateResponseSDKType, MsgBeginRedelegate, MsgBeginRedelegateSDKType, MsgBeginRedelegateResponse, MsgBeginRedelegateResponseSDKType, MsgUndelegate, MsgUndelegateSDKType, MsgUndelegateResponse, MsgUndelegateResponseSDKType } from "./tx.js"; +/** + * CreateValidator defines a method for creating a new validator. + * @name createValidator + * @package cosmos.staking.v1beta1 + * @see proto service: cosmos.staking.v1beta1.CreateValidator + */ +export const createValidator = buildTx({ + msg: MsgCreateValidator +}); +/** + * EditValidator defines a method for editing an existing validator. + * @name editValidator + * @package cosmos.staking.v1beta1 + * @see proto service: cosmos.staking.v1beta1.EditValidator + */ +export const editValidator = buildTx({ + msg: MsgEditValidator +}); +/** + * Delegate defines a method for performing a delegation of coins + * from a delegator to a validator. + * @name delegate + * @package cosmos.staking.v1beta1 + * @see proto service: cosmos.staking.v1beta1.Delegate + */ +export const delegate = buildTx({ + msg: MsgDelegate +}); +/** + * BeginRedelegate defines a method for performing a redelegation + * of coins from a delegator and source validator to a destination validator. + * @name beginRedelegate + * @package cosmos.staking.v1beta1 + * @see proto service: cosmos.staking.v1beta1.BeginRedelegate + */ +export const beginRedelegate = buildTx({ + msg: MsgBeginRedelegate +}); +/** + * Undelegate defines a method for performing an undelegation from a + * delegate and a validator. + * @name undelegate + * @package cosmos.staking.v1beta1 + * @see proto service: cosmos.staking.v1beta1.Undelegate + */ +export const undelegate = buildTx({ + msg: MsgUndelegate +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/cosmos/staking/v1beta1/tx.rpc.msg.ts b/__fixtures__/v-next/outputv4/cosmos/staking/v1beta1/tx.rpc.msg.ts index f807da072f..e8a31dd712 100644 --- a/__fixtures__/v-next/outputv4/cosmos/staking/v1beta1/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputv4/cosmos/staking/v1beta1/tx.rpc.msg.ts @@ -2,7 +2,7 @@ import { Description, DescriptionSDKType, CommissionRates, CommissionRatesSDKTyp import { Any, AnySDKType } from "../../../google/protobuf/any.js"; import { Coin, CoinSDKType } from "../../base/v1beta1/coin.js"; import { Timestamp, TimestampSDKType } from "../../../google/protobuf/timestamp.js"; -import { Rpc } from "../../../helpers.js"; +import { TxRpc } from "../../../types.js"; import { BinaryReader } from "../../../binary.js"; import { MsgCreateValidator, MsgCreateValidatorSDKType, MsgCreateValidatorResponse, MsgCreateValidatorResponseSDKType, MsgEditValidator, MsgEditValidatorSDKType, MsgEditValidatorResponse, MsgEditValidatorResponseSDKType, MsgDelegate, MsgDelegateSDKType, MsgDelegateResponse, MsgDelegateResponseSDKType, MsgBeginRedelegate, MsgBeginRedelegateSDKType, MsgBeginRedelegateResponse, MsgBeginRedelegateResponseSDKType, MsgUndelegate, MsgUndelegateSDKType, MsgUndelegateResponse, MsgUndelegateResponseSDKType } from "./tx.js"; /** Msg defines the staking Msg service. */ @@ -28,8 +28,8 @@ export interface Msg { undelegate(request: MsgUndelegate): Promise; } export class MsgClientImpl implements Msg { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.createValidator = this.createValidator.bind(this); this.editValidator = this.editValidator.bind(this); @@ -63,6 +63,6 @@ export class MsgClientImpl implements Msg { return promise.then(data => MsgUndelegateResponse.decode(new BinaryReader(data))); } } -export const createClientImpl = (rpc: Rpc) => { +export const createClientImpl = (rpc: TxRpc) => { return new MsgClientImpl(rpc); }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/cosmos/staking/v1beta1/tx.ts b/__fixtures__/v-next/outputv4/cosmos/staking/v1beta1/tx.ts index 70aa1853f4..23f452afc9 100644 --- a/__fixtures__/v-next/outputv4/cosmos/staking/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputv4/cosmos/staking/v1beta1/tx.ts @@ -5,8 +5,8 @@ import { Timestamp, TimestampSDKType } from "../../../google/protobuf/timestamp. import { BinaryReader, BinaryWriter } from "../../../binary.js"; import { isSet, DeepPartial, toTimestamp, fromTimestamp } from "../../../helpers.js"; import { JsonSafe } from "../../../json-safe.js"; -import { encodePubkey, decodePubkey } from "@cosmjs/proto-signing"; -import { Decimal } from "@cosmjs/math"; +import { encodePubkey, decodePubkey } from "@interchainjs/pubkey"; +import { Decimal } from "@interchainjs/math"; export const protobufPackage = "cosmos.staking.v1beta1"; /** * MsgCreateValidator defines a SDK message for creating a new validator. @@ -677,7 +677,7 @@ export const MsgEditValidator = { const obj: any = {}; obj.description = message.description ? Description.toAmino(message.description) : undefined; obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; - obj.commission_rate = message.commissionRate === "" ? undefined : message.commissionRate; + obj.commission_rate = message.commissionRate === "" ? undefined : Decimal.fromUserInput(message.commissionRate, 18).atomics; obj.min_self_delegation = message.minSelfDelegation === "" ? undefined : message.minSelfDelegation; return obj; }, diff --git a/__fixtures__/v-next/outputv4/cosmos/tx/v1beta1/service.rpc.Service.ts b/__fixtures__/v-next/outputv4/cosmos/tx/v1beta1/service.rpc.Service.ts index 4dd76261b6..cda5fbf6d9 100644 --- a/__fixtures__/v-next/outputv4/cosmos/tx/v1beta1/service.rpc.Service.ts +++ b/__fixtures__/v-next/outputv4/cosmos/tx/v1beta1/service.rpc.Service.ts @@ -3,7 +3,7 @@ import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } fr import { TxResponse, TxResponseSDKType, GasInfo, GasInfoSDKType, Result, ResultSDKType } from "../../base/abci/v1beta1/abci.js"; import { BlockID, BlockIDSDKType } from "../../../tendermint/types/types.js"; import { Block, BlockSDKType } from "../../../tendermint/types/block.js"; -import { Rpc } from "../../../helpers.js"; +import { TxRpc } from "../../../types.js"; import { BinaryReader } from "../../../binary.js"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; import { SimulateRequest, SimulateRequestSDKType, SimulateResponse, SimulateResponseSDKType, GetTxRequest, GetTxRequestSDKType, GetTxResponse, GetTxResponseSDKType, BroadcastTxRequest, BroadcastTxRequestSDKType, BroadcastTxResponse, BroadcastTxResponseSDKType, GetTxsEventRequest, GetTxsEventRequestSDKType, GetTxsEventResponse, GetTxsEventResponseSDKType, GetBlockWithTxsRequest, GetBlockWithTxsRequestSDKType, GetBlockWithTxsResponse, GetBlockWithTxsResponseSDKType } from "./service.js"; @@ -25,8 +25,8 @@ export interface Service { getBlockWithTxs(request: GetBlockWithTxsRequest): Promise; } export class ServiceClientImpl implements Service { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.simulate = this.simulate.bind(this); this.getTx = this.getTx.bind(this); diff --git a/__fixtures__/v-next/outputv4/cosmos/tx/v1beta1/service.rpc.func.ts b/__fixtures__/v-next/outputv4/cosmos/tx/v1beta1/service.rpc.func.ts new file mode 100644 index 0000000000..01157c3295 --- /dev/null +++ b/__fixtures__/v-next/outputv4/cosmos/tx/v1beta1/service.rpc.func.ts @@ -0,0 +1,69 @@ +import { Tx, TxSDKType } from "./tx.js"; +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination.js"; +import { TxResponse, TxResponseSDKType, GasInfo, GasInfoSDKType, Result, ResultSDKType } from "../../base/abci/v1beta1/abci.js"; +import { BlockID, BlockIDSDKType } from "../../../tendermint/types/types.js"; +import { Block, BlockSDKType } from "../../../tendermint/types/block.js"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types.js"; +import { SimulateRequest, SimulateRequestSDKType, SimulateResponse, SimulateResponseSDKType, GetTxRequest, GetTxRequestSDKType, GetTxResponse, GetTxResponseSDKType, BroadcastTxRequest, BroadcastTxRequestSDKType, BroadcastTxResponse, BroadcastTxResponseSDKType, GetTxsEventRequest, GetTxsEventRequestSDKType, GetTxsEventResponse, GetTxsEventResponseSDKType, GetBlockWithTxsRequest, GetBlockWithTxsRequestSDKType, GetBlockWithTxsResponse, GetBlockWithTxsResponseSDKType } from "./service.js"; +/** + * Simulate simulates executing a transaction for estimating gas usage. + * @name getSimulate + * @package cosmos.tx.v1beta1 + * @see proto service: cosmos.tx.v1beta1.Simulate + */ +export const getSimulate = buildQuery({ + encode: SimulateRequest.encode, + decode: SimulateResponse.decode, + service: "cosmos.tx.v1beta1.Service", + method: "Simulate" +}); +/** + * GetTx fetches a tx by hash. + * @name getGetTx + * @package cosmos.tx.v1beta1 + * @see proto service: cosmos.tx.v1beta1.GetTx + */ +export const getGetTx = buildQuery({ + encode: GetTxRequest.encode, + decode: GetTxResponse.decode, + service: "cosmos.tx.v1beta1.Service", + method: "GetTx" +}); +/** + * BroadcastTx broadcast transaction. + * @name getBroadcastTx + * @package cosmos.tx.v1beta1 + * @see proto service: cosmos.tx.v1beta1.BroadcastTx + */ +export const getBroadcastTx = buildQuery({ + encode: BroadcastTxRequest.encode, + decode: BroadcastTxResponse.decode, + service: "cosmos.tx.v1beta1.Service", + method: "BroadcastTx" +}); +/** + * GetTxsEvent fetches txs by event. + * @name getGetTxsEvent + * @package cosmos.tx.v1beta1 + * @see proto service: cosmos.tx.v1beta1.GetTxsEvent + */ +export const getGetTxsEvent = buildQuery({ + encode: GetTxsEventRequest.encode, + decode: GetTxsEventResponse.decode, + service: "cosmos.tx.v1beta1.Service", + method: "GetTxsEvent" +}); +/** + * GetBlockWithTxs fetches a block with decoded txs. + * + * Since: cosmos-sdk 0.45.2 + * @name getGetBlockWithTxs + * @package cosmos.tx.v1beta1 + * @see proto service: cosmos.tx.v1beta1.GetBlockWithTxs + */ +export const getGetBlockWithTxs = buildQuery({ + encode: GetBlockWithTxsRequest.encode, + decode: GetBlockWithTxsResponse.decode, + service: "cosmos.tx.v1beta1.Service", + method: "GetBlockWithTxs" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/cosmos/upgrade/v1beta1/query.rpc.Query.ts b/__fixtures__/v-next/outputv4/cosmos/upgrade/v1beta1/query.rpc.Query.ts index 80d127d58d..0818e0501f 100644 --- a/__fixtures__/v-next/outputv4/cosmos/upgrade/v1beta1/query.rpc.Query.ts +++ b/__fixtures__/v-next/outputv4/cosmos/upgrade/v1beta1/query.rpc.Query.ts @@ -1,5 +1,5 @@ import { Plan, PlanSDKType, ModuleVersion, ModuleVersionSDKType } from "./upgrade.js"; -import { Rpc } from "../../../helpers.js"; +import { TxRpc } from "../../../types.js"; import { BinaryReader } from "../../../binary.js"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; import { QueryCurrentPlanRequest, QueryCurrentPlanRequestSDKType, QueryCurrentPlanResponse, QueryCurrentPlanResponseSDKType, QueryAppliedPlanRequest, QueryAppliedPlanRequestSDKType, QueryAppliedPlanResponse, QueryAppliedPlanResponseSDKType, QueryUpgradedConsensusStateRequest, QueryUpgradedConsensusStateRequestSDKType, QueryUpgradedConsensusStateResponse, QueryUpgradedConsensusStateResponseSDKType, QueryModuleVersionsRequest, QueryModuleVersionsRequestSDKType, QueryModuleVersionsResponse, QueryModuleVersionsResponseSDKType, QueryAuthorityRequest, QueryAuthorityRequestSDKType, QueryAuthorityResponse, QueryAuthorityResponseSDKType } from "./query.js"; @@ -28,8 +28,8 @@ export interface Query { authority(request?: QueryAuthorityRequest): Promise; } export class QueryClientImpl implements Query { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.currentPlan = this.currentPlan.bind(this); this.appliedPlan = this.appliedPlan.bind(this); diff --git a/__fixtures__/v-next/outputv4/cosmos/upgrade/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputv4/cosmos/upgrade/v1beta1/query.rpc.func.ts new file mode 100644 index 0000000000..2719036ef3 --- /dev/null +++ b/__fixtures__/v-next/outputv4/cosmos/upgrade/v1beta1/query.rpc.func.ts @@ -0,0 +1,71 @@ +import { Plan, PlanSDKType, ModuleVersion, ModuleVersionSDKType } from "./upgrade.js"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types.js"; +import { QueryCurrentPlanRequest, QueryCurrentPlanRequestSDKType, QueryCurrentPlanResponse, QueryCurrentPlanResponseSDKType, QueryAppliedPlanRequest, QueryAppliedPlanRequestSDKType, QueryAppliedPlanResponse, QueryAppliedPlanResponseSDKType, QueryUpgradedConsensusStateRequest, QueryUpgradedConsensusStateRequestSDKType, QueryUpgradedConsensusStateResponse, QueryUpgradedConsensusStateResponseSDKType, QueryModuleVersionsRequest, QueryModuleVersionsRequestSDKType, QueryModuleVersionsResponse, QueryModuleVersionsResponseSDKType, QueryAuthorityRequest, QueryAuthorityRequestSDKType, QueryAuthorityResponse, QueryAuthorityResponseSDKType } from "./query.js"; +/** + * CurrentPlan queries the current upgrade plan. + * @name getCurrentPlan + * @package cosmos.upgrade.v1beta1 + * @see proto service: cosmos.upgrade.v1beta1.CurrentPlan + */ +export const getCurrentPlan = buildQuery({ + encode: QueryCurrentPlanRequest.encode, + decode: QueryCurrentPlanResponse.decode, + service: "cosmos.upgrade.v1beta1.Query", + method: "CurrentPlan" +}); +/** + * AppliedPlan queries a previously applied upgrade plan by its name. + * @name getAppliedPlan + * @package cosmos.upgrade.v1beta1 + * @see proto service: cosmos.upgrade.v1beta1.AppliedPlan + */ +export const getAppliedPlan = buildQuery({ + encode: QueryAppliedPlanRequest.encode, + decode: QueryAppliedPlanResponse.decode, + service: "cosmos.upgrade.v1beta1.Query", + method: "AppliedPlan" +}); +/** + * UpgradedConsensusState queries the consensus state that will serve + * as a trusted kernel for the next version of this chain. It will only be + * stored at the last height of this chain. + * UpgradedConsensusState RPC not supported with legacy querier + * This rpc is deprecated now that IBC has its own replacement + * (https://github.com/cosmos/ibc-go/blob/2c880a22e9f9cc75f62b527ca94aa75ce1106001/proto/ibc/core/client/v1/query.proto#L54) + * @name getUpgradedConsensusState + * @package cosmos.upgrade.v1beta1 + * @see proto service: cosmos.upgrade.v1beta1.UpgradedConsensusState + * @deprecated + */ +export const getUpgradedConsensusState = buildQuery({ + encode: QueryUpgradedConsensusStateRequest.encode, + decode: QueryUpgradedConsensusStateResponse.decode, + service: "cosmos.upgrade.v1beta1.Query", + method: "UpgradedConsensusState" +}); +/** + * ModuleVersions queries the list of module versions from state. + * + * Since: cosmos-sdk 0.43 + * @name getModuleVersions + * @package cosmos.upgrade.v1beta1 + * @see proto service: cosmos.upgrade.v1beta1.ModuleVersions + */ +export const getModuleVersions = buildQuery({ + encode: QueryModuleVersionsRequest.encode, + decode: QueryModuleVersionsResponse.decode, + service: "cosmos.upgrade.v1beta1.Query", + method: "ModuleVersions" +}); +/** + * Returns the account with authority to conduct upgrades + * @name getAuthority + * @package cosmos.upgrade.v1beta1 + * @see proto service: cosmos.upgrade.v1beta1.Authority + */ +export const getAuthority = buildQuery({ + encode: QueryAuthorityRequest.encode, + decode: QueryAuthorityResponse.decode, + service: "cosmos.upgrade.v1beta1.Query", + method: "Authority" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/cosmos/upgrade/v1beta1/tx.registry.ts b/__fixtures__/v-next/outputv4/cosmos/upgrade/v1beta1/tx.registry.ts index e3fae09441..71abf2bca4 100644 --- a/__fixtures__/v-next/outputv4/cosmos/upgrade/v1beta1/tx.registry.ts +++ b/__fixtures__/v-next/outputv4/cosmos/upgrade/v1beta1/tx.registry.ts @@ -1,12 +1,7 @@ import { Plan, PlanSDKType } from "./upgrade.js"; -import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { TelescopeGeneratedType } from "../../../types.js"; import { MsgSoftwareUpgrade, MsgSoftwareUpgradeSDKType, MsgCancelUpgrade, MsgCancelUpgradeSDKType } from "./tx.js"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/cosmos.upgrade.v1beta1.MsgSoftwareUpgrade", MsgSoftwareUpgrade], ["/cosmos.upgrade.v1beta1.MsgCancelUpgrade", MsgCancelUpgrade]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/cosmos.upgrade.v1beta1.MsgSoftwareUpgrade", MsgSoftwareUpgrade], ["/cosmos.upgrade.v1beta1.MsgCancelUpgrade", MsgCancelUpgrade]]; export const MessageComposer = { encoded: { softwareUpgrade(value: MsgSoftwareUpgrade) { diff --git a/__fixtures__/v-next/outputv4/cosmos/upgrade/v1beta1/tx.rpc.func.ts b/__fixtures__/v-next/outputv4/cosmos/upgrade/v1beta1/tx.rpc.func.ts new file mode 100644 index 0000000000..8ca2ee0fca --- /dev/null +++ b/__fixtures__/v-next/outputv4/cosmos/upgrade/v1beta1/tx.rpc.func.ts @@ -0,0 +1,26 @@ +import { Plan, PlanSDKType } from "./upgrade.js"; +import { buildTx } from "../../../helper-func-types.js"; +import { MsgSoftwareUpgrade, MsgSoftwareUpgradeSDKType, MsgSoftwareUpgradeResponse, MsgSoftwareUpgradeResponseSDKType, MsgCancelUpgrade, MsgCancelUpgradeSDKType, MsgCancelUpgradeResponse, MsgCancelUpgradeResponseSDKType } from "./tx.js"; +/** + * SoftwareUpgrade is a governance operation for initiating a software upgrade. + * + * Since: cosmos-sdk 0.46 + * @name softwareUpgrade + * @package cosmos.upgrade.v1beta1 + * @see proto service: cosmos.upgrade.v1beta1.SoftwareUpgrade + */ +export const softwareUpgrade = buildTx({ + msg: MsgSoftwareUpgrade +}); +/** + * CancelUpgrade is a governance operation for cancelling a previously + * approvid software upgrade. + * + * Since: cosmos-sdk 0.46 + * @name cancelUpgrade + * @package cosmos.upgrade.v1beta1 + * @see proto service: cosmos.upgrade.v1beta1.CancelUpgrade + */ +export const cancelUpgrade = buildTx({ + msg: MsgCancelUpgrade +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/cosmos/upgrade/v1beta1/tx.rpc.msg.ts b/__fixtures__/v-next/outputv4/cosmos/upgrade/v1beta1/tx.rpc.msg.ts index adeae6342a..7b0269b804 100644 --- a/__fixtures__/v-next/outputv4/cosmos/upgrade/v1beta1/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputv4/cosmos/upgrade/v1beta1/tx.rpc.msg.ts @@ -1,5 +1,5 @@ import { Plan, PlanSDKType } from "./upgrade.js"; -import { Rpc } from "../../../helpers.js"; +import { TxRpc } from "../../../types.js"; import { BinaryReader } from "../../../binary.js"; import { MsgSoftwareUpgrade, MsgSoftwareUpgradeSDKType, MsgSoftwareUpgradeResponse, MsgSoftwareUpgradeResponseSDKType, MsgCancelUpgrade, MsgCancelUpgradeSDKType, MsgCancelUpgradeResponse, MsgCancelUpgradeResponseSDKType } from "./tx.js"; /** Msg defines the upgrade Msg service. */ @@ -19,8 +19,8 @@ export interface Msg { cancelUpgrade(request: MsgCancelUpgrade): Promise; } export class MsgClientImpl implements Msg { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.softwareUpgrade = this.softwareUpgrade.bind(this); this.cancelUpgrade = this.cancelUpgrade.bind(this); @@ -36,6 +36,6 @@ export class MsgClientImpl implements Msg { return promise.then(data => MsgCancelUpgradeResponse.decode(new BinaryReader(data))); } } -export const createClientImpl = (rpc: Rpc) => { +export const createClientImpl = (rpc: TxRpc) => { return new MsgClientImpl(rpc); }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/cosmos/vesting/v1beta1/tx.registry.ts b/__fixtures__/v-next/outputv4/cosmos/vesting/v1beta1/tx.registry.ts index 6351c655d7..3bdfed129b 100644 --- a/__fixtures__/v-next/outputv4/cosmos/vesting/v1beta1/tx.registry.ts +++ b/__fixtures__/v-next/outputv4/cosmos/vesting/v1beta1/tx.registry.ts @@ -1,13 +1,8 @@ import { Coin, CoinSDKType } from "../../base/v1beta1/coin.js"; import { Period, PeriodSDKType } from "./vesting.js"; -import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { TelescopeGeneratedType } from "../../../types.js"; import { MsgCreateVestingAccount, MsgCreateVestingAccountSDKType, MsgCreatePermanentLockedAccount, MsgCreatePermanentLockedAccountSDKType, MsgCreatePeriodicVestingAccount, MsgCreatePeriodicVestingAccountSDKType } from "./tx.js"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/cosmos.vesting.v1beta1.MsgCreateVestingAccount", MsgCreateVestingAccount], ["/cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccount", MsgCreatePermanentLockedAccount], ["/cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccount", MsgCreatePeriodicVestingAccount]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/cosmos.vesting.v1beta1.MsgCreateVestingAccount", MsgCreateVestingAccount], ["/cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccount", MsgCreatePermanentLockedAccount], ["/cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccount", MsgCreatePeriodicVestingAccount]]; export const MessageComposer = { encoded: { createVestingAccount(value: MsgCreateVestingAccount) { diff --git a/__fixtures__/v-next/outputv4/cosmos/vesting/v1beta1/tx.rpc.func.ts b/__fixtures__/v-next/outputv4/cosmos/vesting/v1beta1/tx.rpc.func.ts new file mode 100644 index 0000000000..1b5c3a7438 --- /dev/null +++ b/__fixtures__/v-next/outputv4/cosmos/vesting/v1beta1/tx.rpc.func.ts @@ -0,0 +1,34 @@ +import { Coin, CoinSDKType } from "../../base/v1beta1/coin.js"; +import { Period, PeriodSDKType } from "./vesting.js"; +import { buildTx } from "../../../helper-func-types.js"; +import { MsgCreateVestingAccount, MsgCreateVestingAccountSDKType, MsgCreateVestingAccountResponse, MsgCreateVestingAccountResponseSDKType, MsgCreatePermanentLockedAccount, MsgCreatePermanentLockedAccountSDKType, MsgCreatePermanentLockedAccountResponse, MsgCreatePermanentLockedAccountResponseSDKType, MsgCreatePeriodicVestingAccount, MsgCreatePeriodicVestingAccountSDKType, MsgCreatePeriodicVestingAccountResponse, MsgCreatePeriodicVestingAccountResponseSDKType } from "./tx.js"; +/** + * CreateVestingAccount defines a method that enables creating a vesting + * account. + * @name createVestingAccount + * @package cosmos.vesting.v1beta1 + * @see proto service: cosmos.vesting.v1beta1.CreateVestingAccount + */ +export const createVestingAccount = buildTx({ + msg: MsgCreateVestingAccount +}); +/** + * CreatePermanentLockedAccount defines a method that enables creating a permanent + * locked account. + * @name createPermanentLockedAccount + * @package cosmos.vesting.v1beta1 + * @see proto service: cosmos.vesting.v1beta1.CreatePermanentLockedAccount + */ +export const createPermanentLockedAccount = buildTx({ + msg: MsgCreatePermanentLockedAccount +}); +/** + * CreatePeriodicVestingAccount defines a method that enables creating a + * periodic vesting account. + * @name createPeriodicVestingAccount + * @package cosmos.vesting.v1beta1 + * @see proto service: cosmos.vesting.v1beta1.CreatePeriodicVestingAccount + */ +export const createPeriodicVestingAccount = buildTx({ + msg: MsgCreatePeriodicVestingAccount +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/cosmos/vesting/v1beta1/tx.rpc.msg.ts b/__fixtures__/v-next/outputv4/cosmos/vesting/v1beta1/tx.rpc.msg.ts index 50da665cce..260ebfaf34 100644 --- a/__fixtures__/v-next/outputv4/cosmos/vesting/v1beta1/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputv4/cosmos/vesting/v1beta1/tx.rpc.msg.ts @@ -1,6 +1,6 @@ import { Coin, CoinSDKType } from "../../base/v1beta1/coin.js"; import { Period, PeriodSDKType } from "./vesting.js"; -import { Rpc } from "../../../helpers.js"; +import { TxRpc } from "../../../types.js"; import { BinaryReader } from "../../../binary.js"; import { MsgCreateVestingAccount, MsgCreateVestingAccountSDKType, MsgCreateVestingAccountResponse, MsgCreateVestingAccountResponseSDKType, MsgCreatePermanentLockedAccount, MsgCreatePermanentLockedAccountSDKType, MsgCreatePermanentLockedAccountResponse, MsgCreatePermanentLockedAccountResponseSDKType, MsgCreatePeriodicVestingAccount, MsgCreatePeriodicVestingAccountSDKType, MsgCreatePeriodicVestingAccountResponse, MsgCreatePeriodicVestingAccountResponseSDKType } from "./tx.js"; /** Msg defines the bank Msg service. */ @@ -22,8 +22,8 @@ export interface Msg { createPeriodicVestingAccount(request: MsgCreatePeriodicVestingAccount): Promise; } export class MsgClientImpl implements Msg { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.createVestingAccount = this.createVestingAccount.bind(this); this.createPermanentLockedAccount = this.createPermanentLockedAccount.bind(this); @@ -45,6 +45,6 @@ export class MsgClientImpl implements Msg { return promise.then(data => MsgCreatePeriodicVestingAccountResponse.decode(new BinaryReader(data))); } } -export const createClientImpl = (rpc: Rpc) => { +export const createClientImpl = (rpc: TxRpc) => { return new MsgClientImpl(rpc); }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/cosmwasm/bundle.ts b/__fixtures__/v-next/outputv4/cosmwasm/bundle.ts index 7509d6daa8..bec47334b3 100644 --- a/__fixtures__/v-next/outputv4/cosmwasm/bundle.ts +++ b/__fixtures__/v-next/outputv4/cosmwasm/bundle.ts @@ -4,14 +4,16 @@ import * as _149 from "./wasm/v1/proposal.js"; import * as _150 from "./wasm/v1/query.js"; import * as _151 from "./wasm/v1/tx.js"; import * as _152 from "./wasm/v1/types.js"; -import * as _434 from "./wasm/v1/tx.amino.js"; -import * as _435 from "./wasm/v1/tx.registry.js"; -import * as _436 from "./wasm/v1/query.lcd.js"; -import * as _437 from "./wasm/v1/query.rpc.Query.js"; -import * as _438 from "./wasm/v1/tx.rpc.msg.js"; -import * as _544 from "./lcd.js"; -import * as _545 from "./rpc.query.js"; -import * as _546 from "./rpc.tx.js"; +import * as _484 from "./wasm/v1/tx.amino.js"; +import * as _485 from "./wasm/v1/tx.registry.js"; +import * as _486 from "./wasm/v1/query.lcd.js"; +import * as _487 from "./wasm/v1/query.rpc.func.js"; +import * as _488 from "./wasm/v1/query.rpc.Query.js"; +import * as _489 from "./wasm/v1/tx.rpc.func.js"; +import * as _490 from "./wasm/v1/tx.rpc.msg.js"; +import * as _637 from "./lcd.js"; +import * as _638 from "./rpc.query.js"; +import * as _639 from "./rpc.tx.js"; export namespace cosmwasm { export namespace wasm { export const v1 = { @@ -21,16 +23,18 @@ export namespace cosmwasm { ..._150, ..._151, ..._152, - ..._434, - ..._435, - ..._436, - ..._437, - ..._438 + ..._484, + ..._485, + ..._486, + ..._487, + ..._488, + ..._489, + ..._490 }; } export const ClientFactory = { - ..._544, - ..._545, - ..._546 + ..._637, + ..._638, + ..._639 }; } \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/proposal.ts b/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/proposal.ts index 36efb3c7fe..fd63202d25 100644 --- a/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/proposal.ts +++ b/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/proposal.ts @@ -3,7 +3,7 @@ import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin.js"; import { BinaryReader, BinaryWriter } from "../../../binary.js"; import { isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../../../helpers.js"; import { JsonSafe } from "../../../json-safe.js"; -import { fromBase64, toBase64, toUtf8, fromUtf8 } from "@cosmjs/encoding"; +import { fromBase64, toBase64, toUtf8, fromUtf8 } from "@interchainjs/encoding"; export const protobufPackage = "cosmwasm.wasm.v1"; /** * StoreCodeProposal gov proposal content type to submit WASM code to the system diff --git a/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/query.rpc.Query.ts b/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/query.rpc.Query.ts index 69dbaff5bd..2814e42e1f 100644 --- a/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/query.rpc.Query.ts +++ b/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/query.rpc.Query.ts @@ -1,6 +1,6 @@ import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination.js"; import { ContractInfo, ContractInfoSDKType, ContractCodeHistoryEntry, ContractCodeHistoryEntrySDKType, Model, ModelSDKType } from "./types.js"; -import { Rpc } from "../../../helpers.js"; +import { TxRpc } from "../../../types.js"; import { BinaryReader } from "../../../binary.js"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; import { QueryContractInfoRequest, QueryContractInfoRequestSDKType, QueryContractInfoResponse, QueryContractInfoResponseSDKType, QueryContractHistoryRequest, QueryContractHistoryRequestSDKType, QueryContractHistoryResponse, QueryContractHistoryResponseSDKType, QueryContractsByCodeRequest, QueryContractsByCodeRequestSDKType, QueryContractsByCodeResponse, QueryContractsByCodeResponseSDKType, QueryAllContractStateRequest, QueryAllContractStateRequestSDKType, QueryAllContractStateResponse, QueryAllContractStateResponseSDKType, QueryRawContractStateRequest, QueryRawContractStateRequestSDKType, QueryRawContractStateResponse, QueryRawContractStateResponseSDKType, QuerySmartContractStateRequest, QuerySmartContractStateRequestSDKType, QuerySmartContractStateResponse, QuerySmartContractStateResponseSDKType, QueryCodeRequest, QueryCodeRequestSDKType, QueryCodeResponse, QueryCodeResponseSDKType, QueryCodesRequest, QueryCodesRequestSDKType, QueryCodesResponse, QueryCodesResponseSDKType, QueryPinnedCodesRequest, QueryPinnedCodesRequestSDKType, QueryPinnedCodesResponse, QueryPinnedCodesResponseSDKType } from "./query.js"; @@ -26,8 +26,8 @@ export interface Query { pinnedCodes(request?: QueryPinnedCodesRequest): Promise; } export class QueryClientImpl implements Query { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.contractInfo = this.contractInfo.bind(this); this.contractHistory = this.contractHistory.bind(this); diff --git a/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/query.rpc.func.ts b/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/query.rpc.func.ts new file mode 100644 index 0000000000..c5994a21bb --- /dev/null +++ b/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/query.rpc.func.ts @@ -0,0 +1,112 @@ +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination.js"; +import { ContractInfo, ContractInfoSDKType, ContractCodeHistoryEntry, ContractCodeHistoryEntrySDKType, Model, ModelSDKType } from "./types.js"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types.js"; +import { QueryContractInfoRequest, QueryContractInfoRequestSDKType, QueryContractInfoResponse, QueryContractInfoResponseSDKType, QueryContractHistoryRequest, QueryContractHistoryRequestSDKType, QueryContractHistoryResponse, QueryContractHistoryResponseSDKType, QueryContractsByCodeRequest, QueryContractsByCodeRequestSDKType, QueryContractsByCodeResponse, QueryContractsByCodeResponseSDKType, QueryAllContractStateRequest, QueryAllContractStateRequestSDKType, QueryAllContractStateResponse, QueryAllContractStateResponseSDKType, QueryRawContractStateRequest, QueryRawContractStateRequestSDKType, QueryRawContractStateResponse, QueryRawContractStateResponseSDKType, QuerySmartContractStateRequest, QuerySmartContractStateRequestSDKType, QuerySmartContractStateResponse, QuerySmartContractStateResponseSDKType, QueryCodeRequest, QueryCodeRequestSDKType, QueryCodeResponse, QueryCodeResponseSDKType, QueryCodesRequest, QueryCodesRequestSDKType, QueryCodesResponse, QueryCodesResponseSDKType, QueryPinnedCodesRequest, QueryPinnedCodesRequestSDKType, QueryPinnedCodesResponse, QueryPinnedCodesResponseSDKType } from "./query.js"; +/** + * ContractInfo gets the contract meta data + * @name getContractInfo + * @package cosmwasm.wasm.v1 + * @see proto service: cosmwasm.wasm.v1.ContractInfo + */ +export const getContractInfo = buildQuery({ + encode: QueryContractInfoRequest.encode, + decode: QueryContractInfoResponse.decode, + service: "cosmwasm.wasm.v1.Query", + method: "ContractInfo" +}); +/** + * ContractHistory gets the contract code history + * @name getContractHistory + * @package cosmwasm.wasm.v1 + * @see proto service: cosmwasm.wasm.v1.ContractHistory + */ +export const getContractHistory = buildQuery({ + encode: QueryContractHistoryRequest.encode, + decode: QueryContractHistoryResponse.decode, + service: "cosmwasm.wasm.v1.Query", + method: "ContractHistory" +}); +/** + * ContractsByCode lists all smart contracts for a code id + * @name getContractsByCode + * @package cosmwasm.wasm.v1 + * @see proto service: cosmwasm.wasm.v1.ContractsByCode + */ +export const getContractsByCode = buildQuery({ + encode: QueryContractsByCodeRequest.encode, + decode: QueryContractsByCodeResponse.decode, + service: "cosmwasm.wasm.v1.Query", + method: "ContractsByCode" +}); +/** + * AllContractState gets all raw store data for a single contract + * @name getAllContractState + * @package cosmwasm.wasm.v1 + * @see proto service: cosmwasm.wasm.v1.AllContractState + */ +export const getAllContractState = buildQuery({ + encode: QueryAllContractStateRequest.encode, + decode: QueryAllContractStateResponse.decode, + service: "cosmwasm.wasm.v1.Query", + method: "AllContractState" +}); +/** + * RawContractState gets single key from the raw store data of a contract + * @name getRawContractState + * @package cosmwasm.wasm.v1 + * @see proto service: cosmwasm.wasm.v1.RawContractState + */ +export const getRawContractState = buildQuery({ + encode: QueryRawContractStateRequest.encode, + decode: QueryRawContractStateResponse.decode, + service: "cosmwasm.wasm.v1.Query", + method: "RawContractState" +}); +/** + * SmartContractState get smart query result from the contract + * @name getSmartContractState + * @package cosmwasm.wasm.v1 + * @see proto service: cosmwasm.wasm.v1.SmartContractState + */ +export const getSmartContractState = buildQuery({ + encode: QuerySmartContractStateRequest.encode, + decode: QuerySmartContractStateResponse.decode, + service: "cosmwasm.wasm.v1.Query", + method: "SmartContractState" +}); +/** + * Code gets the binary code and metadata for a singe wasm code + * @name getCode + * @package cosmwasm.wasm.v1 + * @see proto service: cosmwasm.wasm.v1.Code + */ +export const getCode = buildQuery({ + encode: QueryCodeRequest.encode, + decode: QueryCodeResponse.decode, + service: "cosmwasm.wasm.v1.Query", + method: "Code" +}); +/** + * Codes gets the metadata for all stored wasm codes + * @name getCodes + * @package cosmwasm.wasm.v1 + * @see proto service: cosmwasm.wasm.v1.Codes + */ +export const getCodes = buildQuery({ + encode: QueryCodesRequest.encode, + decode: QueryCodesResponse.decode, + service: "cosmwasm.wasm.v1.Query", + method: "Codes" +}); +/** + * PinnedCodes gets the pinned code ids + * @name getPinnedCodes + * @package cosmwasm.wasm.v1 + * @see proto service: cosmwasm.wasm.v1.PinnedCodes + */ +export const getPinnedCodes = buildQuery({ + encode: QueryPinnedCodesRequest.encode, + decode: QueryPinnedCodesResponse.decode, + service: "cosmwasm.wasm.v1.Query", + method: "PinnedCodes" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/query.ts b/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/query.ts index 055750300d..2210a4dcd9 100644 --- a/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/query.ts +++ b/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/query.ts @@ -3,7 +3,7 @@ import { ContractInfo, ContractInfoSDKType, ContractCodeHistoryEntry, ContractCo import { BinaryReader, BinaryWriter } from "../../../binary.js"; import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../helpers.js"; import { JsonSafe } from "../../../json-safe.js"; -import { toUtf8, fromUtf8 } from "@cosmjs/encoding"; +import { toUtf8, fromUtf8 } from "@interchainjs/encoding"; export const protobufPackage = "cosmwasm.wasm.v1"; /** * QueryContractInfoRequest is the request type for the Query/ContractInfo RPC diff --git a/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/tx.amino.ts b/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/tx.amino.ts index 0cde59f330..7d0b35e951 100644 --- a/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/tx.amino.ts @@ -1,7 +1,7 @@ import { AccessConfig, AccessConfigSDKType, accessTypeFromJSON } from "./types.js"; import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin.js"; import { AminoMsg } from "@cosmjs/amino"; -import { toBase64, fromBase64, fromUtf8, toUtf8 } from "@cosmjs/encoding"; +import { toBase64, fromBase64, fromUtf8, toUtf8 } from "@interchainjs/encoding"; import { MsgStoreCode, MsgStoreCodeSDKType, MsgInstantiateContract, MsgInstantiateContractSDKType, MsgExecuteContract, MsgExecuteContractSDKType, MsgMigrateContract, MsgMigrateContractSDKType, MsgUpdateAdmin, MsgUpdateAdminSDKType, MsgClearAdmin, MsgClearAdminSDKType } from "./tx.js"; export interface MsgStoreCodeAminoType extends AminoMsg { type: "wasm/MsgStoreCode"; diff --git a/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/tx.registry.ts b/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/tx.registry.ts index 894e6816c5..40268dc7fe 100644 --- a/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/tx.registry.ts +++ b/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/tx.registry.ts @@ -1,13 +1,8 @@ import { AccessConfig, AccessConfigSDKType } from "./types.js"; import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin.js"; -import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { TelescopeGeneratedType } from "../../../types.js"; import { MsgStoreCode, MsgStoreCodeSDKType, MsgInstantiateContract, MsgInstantiateContractSDKType, MsgExecuteContract, MsgExecuteContractSDKType, MsgMigrateContract, MsgMigrateContractSDKType, MsgUpdateAdmin, MsgUpdateAdminSDKType, MsgClearAdmin, MsgClearAdminSDKType } from "./tx.js"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/cosmwasm.wasm.v1.MsgStoreCode", MsgStoreCode], ["/cosmwasm.wasm.v1.MsgInstantiateContract", MsgInstantiateContract], ["/cosmwasm.wasm.v1.MsgExecuteContract", MsgExecuteContract], ["/cosmwasm.wasm.v1.MsgMigrateContract", MsgMigrateContract], ["/cosmwasm.wasm.v1.MsgUpdateAdmin", MsgUpdateAdmin], ["/cosmwasm.wasm.v1.MsgClearAdmin", MsgClearAdmin]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/cosmwasm.wasm.v1.MsgStoreCode", MsgStoreCode], ["/cosmwasm.wasm.v1.MsgInstantiateContract", MsgInstantiateContract], ["/cosmwasm.wasm.v1.MsgExecuteContract", MsgExecuteContract], ["/cosmwasm.wasm.v1.MsgMigrateContract", MsgMigrateContract], ["/cosmwasm.wasm.v1.MsgUpdateAdmin", MsgUpdateAdmin], ["/cosmwasm.wasm.v1.MsgClearAdmin", MsgClearAdmin]]; export const MessageComposer = { encoded: { storeCode(value: MsgStoreCode) { diff --git a/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/tx.rpc.func.ts b/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/tx.rpc.func.ts new file mode 100644 index 0000000000..2932fe73c4 --- /dev/null +++ b/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/tx.rpc.func.ts @@ -0,0 +1,58 @@ +import { AccessConfig, AccessConfigSDKType } from "./types.js"; +import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin.js"; +import { buildTx } from "../../../helper-func-types.js"; +import { MsgStoreCode, MsgStoreCodeSDKType, MsgStoreCodeResponse, MsgStoreCodeResponseSDKType, MsgInstantiateContract, MsgInstantiateContractSDKType, MsgInstantiateContractResponse, MsgInstantiateContractResponseSDKType, MsgExecuteContract, MsgExecuteContractSDKType, MsgExecuteContractResponse, MsgExecuteContractResponseSDKType, MsgMigrateContract, MsgMigrateContractSDKType, MsgMigrateContractResponse, MsgMigrateContractResponseSDKType, MsgUpdateAdmin, MsgUpdateAdminSDKType, MsgUpdateAdminResponse, MsgUpdateAdminResponseSDKType, MsgClearAdmin, MsgClearAdminSDKType, MsgClearAdminResponse, MsgClearAdminResponseSDKType } from "./tx.js"; +/** + * StoreCode to submit Wasm code to the system + * @name storeCode + * @package cosmwasm.wasm.v1 + * @see proto service: cosmwasm.wasm.v1.StoreCode + */ +export const storeCode = buildTx({ + msg: MsgStoreCode +}); +/** + * Instantiate creates a new smart contract instance for the given code id. + * @name instantiateContract + * @package cosmwasm.wasm.v1 + * @see proto service: cosmwasm.wasm.v1.InstantiateContract + */ +export const instantiateContract = buildTx({ + msg: MsgInstantiateContract +}); +/** + * Execute submits the given message data to a smart contract + * @name executeContract + * @package cosmwasm.wasm.v1 + * @see proto service: cosmwasm.wasm.v1.ExecuteContract + */ +export const executeContract = buildTx({ + msg: MsgExecuteContract +}); +/** + * Migrate runs a code upgrade/ downgrade for a smart contract + * @name migrateContract + * @package cosmwasm.wasm.v1 + * @see proto service: cosmwasm.wasm.v1.MigrateContract + */ +export const migrateContract = buildTx({ + msg: MsgMigrateContract +}); +/** + * UpdateAdmin sets a new admin for a smart contract + * @name updateAdmin + * @package cosmwasm.wasm.v1 + * @see proto service: cosmwasm.wasm.v1.UpdateAdmin + */ +export const updateAdmin = buildTx({ + msg: MsgUpdateAdmin +}); +/** + * ClearAdmin removes any admin stored for a smart contract + * @name clearAdmin + * @package cosmwasm.wasm.v1 + * @see proto service: cosmwasm.wasm.v1.ClearAdmin + */ +export const clearAdmin = buildTx({ + msg: MsgClearAdmin +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/tx.rpc.msg.ts b/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/tx.rpc.msg.ts index e38afee945..927159f4f3 100644 --- a/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/tx.rpc.msg.ts @@ -1,6 +1,6 @@ import { AccessConfig, AccessConfigSDKType } from "./types.js"; import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin.js"; -import { Rpc } from "../../../helpers.js"; +import { TxRpc } from "../../../types.js"; import { BinaryReader } from "../../../binary.js"; import { MsgStoreCode, MsgStoreCodeSDKType, MsgStoreCodeResponse, MsgStoreCodeResponseSDKType, MsgInstantiateContract, MsgInstantiateContractSDKType, MsgInstantiateContractResponse, MsgInstantiateContractResponseSDKType, MsgExecuteContract, MsgExecuteContractSDKType, MsgExecuteContractResponse, MsgExecuteContractResponseSDKType, MsgMigrateContract, MsgMigrateContractSDKType, MsgMigrateContractResponse, MsgMigrateContractResponseSDKType, MsgUpdateAdmin, MsgUpdateAdminSDKType, MsgUpdateAdminResponse, MsgUpdateAdminResponseSDKType, MsgClearAdmin, MsgClearAdminSDKType, MsgClearAdminResponse, MsgClearAdminResponseSDKType } from "./tx.js"; /** Msg defines the wasm Msg service. */ @@ -19,8 +19,8 @@ export interface Msg { clearAdmin(request: MsgClearAdmin): Promise; } export class MsgClientImpl implements Msg { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.storeCode = this.storeCode.bind(this); this.instantiateContract = this.instantiateContract.bind(this); @@ -60,6 +60,6 @@ export class MsgClientImpl implements Msg { return promise.then(data => MsgClearAdminResponse.decode(new BinaryReader(data))); } } -export const createClientImpl = (rpc: Rpc) => { +export const createClientImpl = (rpc: TxRpc) => { return new MsgClientImpl(rpc); }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/tx.ts b/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/tx.ts index 2e77a08ca9..2c8cdb80d0 100644 --- a/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/tx.ts +++ b/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/tx.ts @@ -3,7 +3,7 @@ import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin.js"; import { BinaryReader, BinaryWriter } from "../../../binary.js"; import { isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../../../helpers.js"; import { JsonSafe } from "../../../json-safe.js"; -import { fromBase64, toBase64, toUtf8, fromUtf8 } from "@cosmjs/encoding"; +import { fromBase64, toBase64, toUtf8, fromUtf8 } from "@interchainjs/encoding"; export const protobufPackage = "cosmwasm.wasm.v1"; /** * MsgStoreCode submit Wasm code to the system diff --git a/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/types.ts b/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/types.ts index f122b9e2cd..78ff0316f9 100644 --- a/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/types.ts +++ b/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/types.ts @@ -2,7 +2,7 @@ import { Any, AnySDKType } from "../../../google/protobuf/any.js"; import { BinaryReader, BinaryWriter } from "../../../binary.js"; import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../helpers.js"; import { JsonSafe } from "../../../json-safe.js"; -import { toUtf8, fromUtf8 } from "@cosmjs/encoding"; +import { toUtf8, fromUtf8 } from "@interchainjs/encoding"; export const protobufPackage = "cosmwasm.wasm.v1"; /** AccessType permission types */ export enum AccessType { diff --git a/__fixtures__/v-next/outputv4/evmos/bundle.ts b/__fixtures__/v-next/outputv4/evmos/bundle.ts index a56ca08f5e..914abfcab2 100644 --- a/__fixtures__/v-next/outputv4/evmos/bundle.ts +++ b/__fixtures__/v-next/outputv4/evmos/bundle.ts @@ -22,54 +22,67 @@ import * as _173 from "./recovery/v1/query.js"; import * as _174 from "./vesting/v1/query.js"; import * as _175 from "./vesting/v1/tx.js"; import * as _176 from "./vesting/v1/vesting.js"; -import * as _439 from "./erc20/v1/tx.amino.js"; -import * as _440 from "./fees/v1/tx.amino.js"; -import * as _441 from "./vesting/v1/tx.amino.js"; -import * as _442 from "./erc20/v1/tx.registry.js"; -import * as _443 from "./fees/v1/tx.registry.js"; -import * as _444 from "./vesting/v1/tx.registry.js"; -import * as _445 from "./claims/v1/query.lcd.js"; -import * as _446 from "./epochs/v1/query.lcd.js"; -import * as _447 from "./erc20/v1/query.lcd.js"; -import * as _448 from "./fees/v1/query.lcd.js"; -import * as _449 from "./incentives/v1/query.lcd.js"; -import * as _450 from "./inflation/v1/query.lcd.js"; -import * as _451 from "./recovery/v1/query.lcd.js"; -import * as _452 from "./vesting/v1/query.lcd.js"; -import * as _453 from "./claims/v1/query.rpc.Query.js"; -import * as _454 from "./epochs/v1/query.rpc.Query.js"; -import * as _455 from "./erc20/v1/query.rpc.Query.js"; -import * as _456 from "./fees/v1/query.rpc.Query.js"; -import * as _457 from "./incentives/v1/query.rpc.Query.js"; -import * as _458 from "./inflation/v1/query.rpc.Query.js"; -import * as _459 from "./recovery/v1/query.rpc.Query.js"; -import * as _460 from "./vesting/v1/query.rpc.Query.js"; -import * as _461 from "./erc20/v1/tx.rpc.msg.js"; -import * as _462 from "./fees/v1/tx.rpc.msg.js"; -import * as _463 from "./vesting/v1/tx.rpc.msg.js"; -import * as _464 from "./erc20/v1/query.pinia.store.js"; -import * as _547 from "./lcd.js"; -import * as _548 from "./custom-lcd-client.js"; -import * as _549 from "./rpc.query.js"; -import * as _550 from "./evmos-rpc-client.query.js"; -import * as _551 from "./rpc.tx.js"; -import * as _552 from "./evmos-rpc-client.tx.js"; +import * as _491 from "./erc20/v1/tx.amino.js"; +import * as _492 from "./fees/v1/tx.amino.js"; +import * as _493 from "./vesting/v1/tx.amino.js"; +import * as _494 from "./erc20/v1/tx.registry.js"; +import * as _495 from "./fees/v1/tx.registry.js"; +import * as _496 from "./vesting/v1/tx.registry.js"; +import * as _497 from "./claims/v1/query.lcd.js"; +import * as _498 from "./epochs/v1/query.lcd.js"; +import * as _499 from "./erc20/v1/query.lcd.js"; +import * as _500 from "./fees/v1/query.lcd.js"; +import * as _501 from "./incentives/v1/query.lcd.js"; +import * as _502 from "./inflation/v1/query.lcd.js"; +import * as _503 from "./recovery/v1/query.lcd.js"; +import * as _504 from "./vesting/v1/query.lcd.js"; +import * as _505 from "./claims/v1/query.rpc.func.js"; +import * as _506 from "./epochs/v1/query.rpc.func.js"; +import * as _507 from "./erc20/v1/query.rpc.func.js"; +import * as _508 from "./fees/v1/query.rpc.func.js"; +import * as _509 from "./incentives/v1/query.rpc.func.js"; +import * as _510 from "./inflation/v1/query.rpc.func.js"; +import * as _511 from "./recovery/v1/query.rpc.func.js"; +import * as _512 from "./vesting/v1/query.rpc.func.js"; +import * as _513 from "./claims/v1/query.rpc.Query.js"; +import * as _514 from "./epochs/v1/query.rpc.Query.js"; +import * as _515 from "./erc20/v1/query.rpc.Query.js"; +import * as _516 from "./fees/v1/query.rpc.Query.js"; +import * as _517 from "./incentives/v1/query.rpc.Query.js"; +import * as _518 from "./inflation/v1/query.rpc.Query.js"; +import * as _519 from "./recovery/v1/query.rpc.Query.js"; +import * as _520 from "./vesting/v1/query.rpc.Query.js"; +import * as _521 from "./erc20/v1/tx.rpc.func.js"; +import * as _522 from "./fees/v1/tx.rpc.func.js"; +import * as _523 from "./vesting/v1/tx.rpc.func.js"; +import * as _524 from "./erc20/v1/tx.rpc.msg.js"; +import * as _525 from "./fees/v1/tx.rpc.msg.js"; +import * as _526 from "./vesting/v1/tx.rpc.msg.js"; +import * as _527 from "./erc20/v1/query.pinia.store.js"; +import * as _640 from "./lcd.js"; +import * as _641 from "./custom-lcd-client.js"; +import * as _642 from "./rpc.query.js"; +import * as _643 from "./evmos-rpc-client.query.js"; +import * as _644 from "./rpc.tx.js"; +import * as _645 from "./evmos-rpc-client.tx.js"; export namespace evmos { export namespace claims { export const v1 = { ..._153, ..._154, ..._155, - ..._445, - ..._453 + ..._497, + ..._505, + ..._513 }; } export namespace epochs { export const v1 = { ..._156, ..._157, - ..._446, - ..._454 + ..._498, + ..._506, + ..._514 }; } export namespace erc20 { @@ -78,12 +91,14 @@ export namespace evmos { ..._159, ..._160, ..._161, - ..._439, - ..._442, - ..._447, - ..._455, - ..._461, - ..._464 + ..._491, + ..._494, + ..._499, + ..._507, + ..._515, + ..._521, + ..._524, + ..._527 }; } export namespace fees { @@ -92,11 +107,13 @@ export namespace evmos { ..._163, ..._164, ..._165, - ..._440, - ..._443, - ..._448, - ..._456, - ..._462 + ..._492, + ..._495, + ..._500, + ..._508, + ..._516, + ..._522, + ..._525 }; } export namespace incentives { @@ -104,8 +121,9 @@ export namespace evmos { ..._166, ..._167, ..._168, - ..._449, - ..._457 + ..._501, + ..._509, + ..._517 }; } export namespace inflation { @@ -113,16 +131,18 @@ export namespace evmos { ..._169, ..._170, ..._171, - ..._450, - ..._458 + ..._502, + ..._510, + ..._518 }; } export namespace recovery { export const v1 = { ..._172, ..._173, - ..._451, - ..._459 + ..._503, + ..._511, + ..._519 }; } export namespace vesting { @@ -130,19 +150,21 @@ export namespace evmos { ..._174, ..._175, ..._176, - ..._441, - ..._444, - ..._452, - ..._460, - ..._463 + ..._493, + ..._496, + ..._504, + ..._512, + ..._520, + ..._523, + ..._526 }; } export const ClientFactory = { - ..._547, - ..._548, - ..._549, - ..._550, - ..._551, - ..._552 + ..._640, + ..._641, + ..._642, + ..._643, + ..._644, + ..._645 }; } \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/evmos/claims/v1/query.rpc.Query.ts b/__fixtures__/v-next/outputv4/evmos/claims/v1/query.rpc.Query.ts index d477a713d7..9abbe1c47d 100644 --- a/__fixtures__/v-next/outputv4/evmos/claims/v1/query.rpc.Query.ts +++ b/__fixtures__/v-next/outputv4/evmos/claims/v1/query.rpc.Query.ts @@ -2,7 +2,7 @@ import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } fr import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin.js"; import { Params, ParamsSDKType } from "./genesis.js"; import { ClaimsRecordAddress, ClaimsRecordAddressSDKType, Claim, ClaimSDKType } from "./claims.js"; -import { Rpc } from "../../../helpers.js"; +import { TxRpc } from "../../../types.js"; import { BinaryReader } from "../../../binary.js"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; import { QueryTotalUnclaimedRequest, QueryTotalUnclaimedRequestSDKType, QueryTotalUnclaimedResponse, QueryTotalUnclaimedResponseSDKType, QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, QueryClaimsRecordsRequest, QueryClaimsRecordsRequestSDKType, QueryClaimsRecordsResponse, QueryClaimsRecordsResponseSDKType, QueryClaimsRecordRequest, QueryClaimsRecordRequestSDKType, QueryClaimsRecordResponse, QueryClaimsRecordResponseSDKType } from "./query.js"; @@ -18,8 +18,8 @@ export interface Query { claimsRecord(request: QueryClaimsRecordRequest): Promise; } export class QueryClientImpl implements Query { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.totalUnclaimed = this.totalUnclaimed.bind(this); this.params = this.params.bind(this); diff --git a/__fixtures__/v-next/outputv4/evmos/claims/v1/query.rpc.func.ts b/__fixtures__/v-next/outputv4/evmos/claims/v1/query.rpc.func.ts new file mode 100644 index 0000000000..2e9e19a633 --- /dev/null +++ b/__fixtures__/v-next/outputv4/evmos/claims/v1/query.rpc.func.ts @@ -0,0 +1,54 @@ +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination.js"; +import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin.js"; +import { Params, ParamsSDKType } from "./genesis.js"; +import { ClaimsRecordAddress, ClaimsRecordAddressSDKType, Claim, ClaimSDKType } from "./claims.js"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types.js"; +import { QueryTotalUnclaimedRequest, QueryTotalUnclaimedRequestSDKType, QueryTotalUnclaimedResponse, QueryTotalUnclaimedResponseSDKType, QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, QueryClaimsRecordsRequest, QueryClaimsRecordsRequestSDKType, QueryClaimsRecordsResponse, QueryClaimsRecordsResponseSDKType, QueryClaimsRecordRequest, QueryClaimsRecordRequestSDKType, QueryClaimsRecordResponse, QueryClaimsRecordResponseSDKType } from "./query.js"; +/** + * TotalUnclaimed queries the total unclaimed tokens from the airdrop + * @name getTotalUnclaimed + * @package evmos.claims.v1 + * @see proto service: evmos.claims.v1.TotalUnclaimed + */ +export const getTotalUnclaimed = buildQuery({ + encode: QueryTotalUnclaimedRequest.encode, + decode: QueryTotalUnclaimedResponse.decode, + service: "evmos.claims.v1.Query", + method: "TotalUnclaimed" +}); +/** + * Params returns the claims module parameters + * @name getParams + * @package evmos.claims.v1 + * @see proto service: evmos.claims.v1.Params + */ +export const getParams = buildQuery({ + encode: QueryParamsRequest.encode, + decode: QueryParamsResponse.decode, + service: "evmos.claims.v1.Query", + method: "Params" +}); +/** + * ClaimsRecords returns all claims records + * @name getClaimsRecords + * @package evmos.claims.v1 + * @see proto service: evmos.claims.v1.ClaimsRecords + */ +export const getClaimsRecords = buildQuery({ + encode: QueryClaimsRecordsRequest.encode, + decode: QueryClaimsRecordsResponse.decode, + service: "evmos.claims.v1.Query", + method: "ClaimsRecords" +}); +/** + * ClaimsRecord returns the claims record for a given address + * @name getClaimsRecord + * @package evmos.claims.v1 + * @see proto service: evmos.claims.v1.ClaimsRecord + */ +export const getClaimsRecord = buildQuery({ + encode: QueryClaimsRecordRequest.encode, + decode: QueryClaimsRecordResponse.decode, + service: "evmos.claims.v1.Query", + method: "ClaimsRecord" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/evmos/epochs/v1/query.rpc.Query.ts b/__fixtures__/v-next/outputv4/evmos/epochs/v1/query.rpc.Query.ts index fce4616b32..b30b80355c 100644 --- a/__fixtures__/v-next/outputv4/evmos/epochs/v1/query.rpc.Query.ts +++ b/__fixtures__/v-next/outputv4/evmos/epochs/v1/query.rpc.Query.ts @@ -1,6 +1,6 @@ import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination.js"; import { EpochInfo, EpochInfoSDKType } from "./genesis.js"; -import { Rpc } from "../../../helpers.js"; +import { TxRpc } from "../../../types.js"; import { BinaryReader } from "../../../binary.js"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; import { QueryEpochsInfoRequest, QueryEpochsInfoRequestSDKType, QueryEpochsInfoResponse, QueryEpochsInfoResponseSDKType, QueryCurrentEpochRequest, QueryCurrentEpochRequestSDKType, QueryCurrentEpochResponse, QueryCurrentEpochResponseSDKType } from "./query.js"; @@ -12,8 +12,8 @@ export interface Query { currentEpoch(request: QueryCurrentEpochRequest): Promise; } export class QueryClientImpl implements Query { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.epochInfos = this.epochInfos.bind(this); this.currentEpoch = this.currentEpoch.bind(this); diff --git a/__fixtures__/v-next/outputv4/evmos/epochs/v1/query.rpc.func.ts b/__fixtures__/v-next/outputv4/evmos/epochs/v1/query.rpc.func.ts new file mode 100644 index 0000000000..98c702745e --- /dev/null +++ b/__fixtures__/v-next/outputv4/evmos/epochs/v1/query.rpc.func.ts @@ -0,0 +1,28 @@ +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination.js"; +import { EpochInfo, EpochInfoSDKType } from "./genesis.js"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types.js"; +import { QueryEpochsInfoRequest, QueryEpochsInfoRequestSDKType, QueryEpochsInfoResponse, QueryEpochsInfoResponseSDKType, QueryCurrentEpochRequest, QueryCurrentEpochRequestSDKType, QueryCurrentEpochResponse, QueryCurrentEpochResponseSDKType } from "./query.js"; +/** + * EpochInfos provide running epochInfos + * @name getEpochInfos + * @package evmos.epochs.v1 + * @see proto service: evmos.epochs.v1.EpochInfos + */ +export const getEpochInfos = buildQuery({ + encode: QueryEpochsInfoRequest.encode, + decode: QueryEpochsInfoResponse.decode, + service: "evmos.epochs.v1.Query", + method: "EpochInfos" +}); +/** + * CurrentEpoch provide current epoch of specified identifier + * @name getCurrentEpoch + * @package evmos.epochs.v1 + * @see proto service: evmos.epochs.v1.CurrentEpoch + */ +export const getCurrentEpoch = buildQuery({ + encode: QueryCurrentEpochRequest.encode, + decode: QueryCurrentEpochResponse.decode, + service: "evmos.epochs.v1.Query", + method: "CurrentEpoch" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/evmos/erc20/v1/query.rpc.Query.ts b/__fixtures__/v-next/outputv4/evmos/erc20/v1/query.rpc.Query.ts index 39cb552d59..abea65f50f 100644 --- a/__fixtures__/v-next/outputv4/evmos/erc20/v1/query.rpc.Query.ts +++ b/__fixtures__/v-next/outputv4/evmos/erc20/v1/query.rpc.Query.ts @@ -1,7 +1,7 @@ import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination.js"; import { TokenPair, TokenPairSDKType } from "./erc20.js"; import { Params, ParamsSDKType } from "./genesis.js"; -import { Rpc } from "../../../helpers.js"; +import { TxRpc } from "../../../types.js"; import { BinaryReader } from "../../../binary.js"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; import { QueryTokenPairsRequest, QueryTokenPairsRequestSDKType, QueryTokenPairsResponse, QueryTokenPairsResponseSDKType, QueryTokenPairRequest, QueryTokenPairRequestSDKType, QueryTokenPairResponse, QueryTokenPairResponseSDKType, QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType } from "./query.js"; @@ -15,8 +15,8 @@ export interface Query { params(request?: QueryParamsRequest): Promise; } export class QueryClientImpl implements Query { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.tokenPairs = this.tokenPairs.bind(this); this.tokenPair = this.tokenPair.bind(this); diff --git a/__fixtures__/v-next/outputv4/evmos/erc20/v1/query.rpc.func.ts b/__fixtures__/v-next/outputv4/evmos/erc20/v1/query.rpc.func.ts new file mode 100644 index 0000000000..48f84ddcc7 --- /dev/null +++ b/__fixtures__/v-next/outputv4/evmos/erc20/v1/query.rpc.func.ts @@ -0,0 +1,41 @@ +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination.js"; +import { TokenPair, TokenPairSDKType } from "./erc20.js"; +import { Params, ParamsSDKType } from "./genesis.js"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types.js"; +import { QueryTokenPairsRequest, QueryTokenPairsRequestSDKType, QueryTokenPairsResponse, QueryTokenPairsResponseSDKType, QueryTokenPairRequest, QueryTokenPairRequestSDKType, QueryTokenPairResponse, QueryTokenPairResponseSDKType, QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType } from "./query.js"; +/** + * TokenPairs retrieves registered token pairs + * @name getTokenPairs + * @package evmos.erc20.v1 + * @see proto service: evmos.erc20.v1.TokenPairs + */ +export const getTokenPairs = buildQuery({ + encode: QueryTokenPairsRequest.encode, + decode: QueryTokenPairsResponse.decode, + service: "evmos.erc20.v1.Query", + method: "TokenPairs" +}); +/** + * TokenPair retrieves a registered token pair + * @name getTokenPair + * @package evmos.erc20.v1 + * @see proto service: evmos.erc20.v1.TokenPair + */ +export const getTokenPair = buildQuery({ + encode: QueryTokenPairRequest.encode, + decode: QueryTokenPairResponse.decode, + service: "evmos.erc20.v1.Query", + method: "TokenPair" +}); +/** + * Params retrieves the erc20 module params + * @name getParams + * @package evmos.erc20.v1 + * @see proto service: evmos.erc20.v1.Params + */ +export const getParams = buildQuery({ + encode: QueryParamsRequest.encode, + decode: QueryParamsResponse.decode, + service: "evmos.erc20.v1.Query", + method: "Params" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/evmos/erc20/v1/tx.registry.ts b/__fixtures__/v-next/outputv4/evmos/erc20/v1/tx.registry.ts index a7fa2b4a32..8a879bf2ea 100644 --- a/__fixtures__/v-next/outputv4/evmos/erc20/v1/tx.registry.ts +++ b/__fixtures__/v-next/outputv4/evmos/erc20/v1/tx.registry.ts @@ -1,12 +1,7 @@ import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin.js"; -import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { TelescopeGeneratedType } from "../../../types.js"; import { MsgConvertCoin, MsgConvertCoinSDKType, MsgConvertERC20, MsgConvertERC20SDKType } from "./tx.js"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/evmos.erc20.v1.MsgConvertCoin", MsgConvertCoin], ["/evmos.erc20.v1.MsgConvertERC20", MsgConvertERC20]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/evmos.erc20.v1.MsgConvertCoin", MsgConvertCoin], ["/evmos.erc20.v1.MsgConvertERC20", MsgConvertERC20]]; export const MessageComposer = { encoded: { convertCoin(value: MsgConvertCoin) { diff --git a/__fixtures__/v-next/outputv4/evmos/erc20/v1/tx.rpc.func.ts b/__fixtures__/v-next/outputv4/evmos/erc20/v1/tx.rpc.func.ts new file mode 100644 index 0000000000..762545e538 --- /dev/null +++ b/__fixtures__/v-next/outputv4/evmos/erc20/v1/tx.rpc.func.ts @@ -0,0 +1,23 @@ +import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin.js"; +import { buildTx } from "../../../helper-func-types.js"; +import { MsgConvertCoin, MsgConvertCoinSDKType, MsgConvertCoinResponse, MsgConvertCoinResponseSDKType, MsgConvertERC20, MsgConvertERC20SDKType, MsgConvertERC20Response, MsgConvertERC20ResponseSDKType } from "./tx.js"; +/** + * ConvertCoin mints a ERC20 representation of the native Cosmos coin denom + * that is registered on the token mapping. + * @name convertCoin + * @package evmos.erc20.v1 + * @see proto service: evmos.erc20.v1.ConvertCoin + */ +export const convertCoin = buildTx({ + msg: MsgConvertCoin +}); +/** + * ConvertERC20 mints a native Cosmos coin representation of the ERC20 token + * contract that is registered on the token mapping. + * @name convertERC20 + * @package evmos.erc20.v1 + * @see proto service: evmos.erc20.v1.ConvertERC20 + */ +export const convertERC20 = buildTx({ + msg: MsgConvertERC20 +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/evmos/erc20/v1/tx.rpc.msg.ts b/__fixtures__/v-next/outputv4/evmos/erc20/v1/tx.rpc.msg.ts index 34d5454eff..348c711bfc 100644 --- a/__fixtures__/v-next/outputv4/evmos/erc20/v1/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputv4/evmos/erc20/v1/tx.rpc.msg.ts @@ -1,5 +1,5 @@ import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin.js"; -import { Rpc } from "../../../helpers.js"; +import { TxRpc } from "../../../types.js"; import { BinaryReader } from "../../../binary.js"; import { MsgConvertCoin, MsgConvertCoinSDKType, MsgConvertCoinResponse, MsgConvertCoinResponseSDKType, MsgConvertERC20, MsgConvertERC20SDKType, MsgConvertERC20Response, MsgConvertERC20ResponseSDKType } from "./tx.js"; /** Msg defines the erc20 Msg service. */ @@ -16,8 +16,8 @@ export interface Msg { convertERC20(request: MsgConvertERC20): Promise; } export class MsgClientImpl implements Msg { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.convertCoin = this.convertCoin.bind(this); this.convertERC20 = this.convertERC20.bind(this); @@ -33,6 +33,6 @@ export class MsgClientImpl implements Msg { return promise.then(data => MsgConvertERC20Response.decode(new BinaryReader(data))); } } -export const createClientImpl = (rpc: Rpc) => { +export const createClientImpl = (rpc: TxRpc) => { return new MsgClientImpl(rpc); }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/evmos/fees/v1/genesis.ts b/__fixtures__/v-next/outputv4/evmos/fees/v1/genesis.ts index 7b353b386d..65556bfe37 100644 --- a/__fixtures__/v-next/outputv4/evmos/fees/v1/genesis.ts +++ b/__fixtures__/v-next/outputv4/evmos/fees/v1/genesis.ts @@ -2,7 +2,7 @@ import { DevFeeInfo, DevFeeInfoSDKType } from "./fees.js"; import { BinaryReader, BinaryWriter } from "../../../binary.js"; import { isSet, DeepPartial } from "../../../helpers.js"; import { JsonSafe } from "../../../json-safe.js"; -import { Decimal } from "@cosmjs/math"; +import { Decimal } from "@interchainjs/math"; export const protobufPackage = "evmos.fees.v1"; /** * GenesisState defines the module's genesis state. @@ -347,10 +347,10 @@ export const Params = { toAmino(message: Params): ParamsAmino { const obj: any = {}; obj.enable_fees = message.enableFees === false ? undefined : message.enableFees; - obj.developer_shares = message.developerShares === "" ? undefined : message.developerShares; - obj.validator_shares = message.validatorShares === "" ? undefined : message.validatorShares; + obj.developer_shares = message.developerShares === "" ? undefined : Decimal.fromUserInput(message.developerShares, 18).atomics; + obj.validator_shares = message.validatorShares === "" ? undefined : Decimal.fromUserInput(message.validatorShares, 18).atomics; obj.addr_derivation_cost_create = message.addrDerivationCostCreate !== BigInt(0) ? message.addrDerivationCostCreate?.toString() : undefined; - obj.min_gas_price = message.minGasPrice === "" ? undefined : message.minGasPrice; + obj.min_gas_price = message.minGasPrice === "" ? undefined : Decimal.fromUserInput(message.minGasPrice, 18).atomics; return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputv4/evmos/fees/v1/query.rpc.Query.ts b/__fixtures__/v-next/outputv4/evmos/fees/v1/query.rpc.Query.ts index a7297b6f74..a52a31fcad 100644 --- a/__fixtures__/v-next/outputv4/evmos/fees/v1/query.rpc.Query.ts +++ b/__fixtures__/v-next/outputv4/evmos/fees/v1/query.rpc.Query.ts @@ -1,7 +1,7 @@ import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination.js"; import { DevFeeInfo, DevFeeInfoSDKType } from "./fees.js"; import { Params, ParamsSDKType } from "./genesis.js"; -import { Rpc } from "../../../helpers.js"; +import { TxRpc } from "../../../types.js"; import { BinaryReader } from "../../../binary.js"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; import { QueryDevFeeInfosRequest, QueryDevFeeInfosRequestSDKType, QueryDevFeeInfosResponse, QueryDevFeeInfosResponseSDKType, QueryDevFeeInfoRequest, QueryDevFeeInfoRequestSDKType, QueryDevFeeInfoResponse, QueryDevFeeInfoResponseSDKType, QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, QueryDevFeeInfosPerDeployerRequest, QueryDevFeeInfosPerDeployerRequestSDKType, QueryDevFeeInfosPerDeployerResponse, QueryDevFeeInfosPerDeployerResponseSDKType } from "./query.js"; @@ -20,8 +20,8 @@ export interface Query { devFeeInfosPerDeployer(request: QueryDevFeeInfosPerDeployerRequest): Promise; } export class QueryClientImpl implements Query { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.devFeeInfos = this.devFeeInfos.bind(this); this.devFeeInfo = this.devFeeInfo.bind(this); diff --git a/__fixtures__/v-next/outputv4/evmos/fees/v1/query.rpc.func.ts b/__fixtures__/v-next/outputv4/evmos/fees/v1/query.rpc.func.ts new file mode 100644 index 0000000000..a1a082552f --- /dev/null +++ b/__fixtures__/v-next/outputv4/evmos/fees/v1/query.rpc.func.ts @@ -0,0 +1,54 @@ +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination.js"; +import { DevFeeInfo, DevFeeInfoSDKType } from "./fees.js"; +import { Params, ParamsSDKType } from "./genesis.js"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types.js"; +import { QueryDevFeeInfosRequest, QueryDevFeeInfosRequestSDKType, QueryDevFeeInfosResponse, QueryDevFeeInfosResponseSDKType, QueryDevFeeInfoRequest, QueryDevFeeInfoRequestSDKType, QueryDevFeeInfoResponse, QueryDevFeeInfoResponseSDKType, QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, QueryDevFeeInfosPerDeployerRequest, QueryDevFeeInfosPerDeployerRequestSDKType, QueryDevFeeInfosPerDeployerResponse, QueryDevFeeInfosPerDeployerResponseSDKType } from "./query.js"; +/** + * DevFeeInfos retrieves all registered contracts for fee distribution + * @name getDevFeeInfos + * @package evmos.fees.v1 + * @see proto service: evmos.fees.v1.DevFeeInfos + */ +export const getDevFeeInfos = buildQuery({ + encode: QueryDevFeeInfosRequest.encode, + decode: QueryDevFeeInfosResponse.decode, + service: "evmos.fees.v1.Query", + method: "DevFeeInfos" +}); +/** + * DevFeeInfo retrieves a registered contract for fee distribution + * @name getDevFeeInfo + * @package evmos.fees.v1 + * @see proto service: evmos.fees.v1.DevFeeInfo + */ +export const getDevFeeInfo = buildQuery({ + encode: QueryDevFeeInfoRequest.encode, + decode: QueryDevFeeInfoResponse.decode, + service: "evmos.fees.v1.Query", + method: "DevFeeInfo" +}); +/** + * Params retrieves the fees module params + * @name getParams + * @package evmos.fees.v1 + * @see proto service: evmos.fees.v1.Params + */ +export const getParams = buildQuery({ + encode: QueryParamsRequest.encode, + decode: QueryParamsResponse.decode, + service: "evmos.fees.v1.Query", + method: "Params" +}); +/** + * DevFeeInfosPerDeployer retrieves all contracts that a deployer has + * registered for fee distribution + * @name getDevFeeInfosPerDeployer + * @package evmos.fees.v1 + * @see proto service: evmos.fees.v1.DevFeeInfosPerDeployer + */ +export const getDevFeeInfosPerDeployer = buildQuery({ + encode: QueryDevFeeInfosPerDeployerRequest.encode, + decode: QueryDevFeeInfosPerDeployerResponse.decode, + service: "evmos.fees.v1.Query", + method: "DevFeeInfosPerDeployer" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/evmos/fees/v1/tx.registry.ts b/__fixtures__/v-next/outputv4/evmos/fees/v1/tx.registry.ts index 9b58158d72..1728702e47 100644 --- a/__fixtures__/v-next/outputv4/evmos/fees/v1/tx.registry.ts +++ b/__fixtures__/v-next/outputv4/evmos/fees/v1/tx.registry.ts @@ -1,11 +1,6 @@ -import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { TelescopeGeneratedType } from "../../../types.js"; import { MsgRegisterDevFeeInfo, MsgRegisterDevFeeInfoSDKType, MsgCancelDevFeeInfo, MsgCancelDevFeeInfoSDKType, MsgUpdateDevFeeInfo, MsgUpdateDevFeeInfoSDKType } from "./tx.js"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/evmos.fees.v1.MsgRegisterDevFeeInfo", MsgRegisterDevFeeInfo], ["/evmos.fees.v1.MsgCancelDevFeeInfo", MsgCancelDevFeeInfo], ["/evmos.fees.v1.MsgUpdateDevFeeInfo", MsgUpdateDevFeeInfo]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/evmos.fees.v1.MsgRegisterDevFeeInfo", MsgRegisterDevFeeInfo], ["/evmos.fees.v1.MsgCancelDevFeeInfo", MsgCancelDevFeeInfo], ["/evmos.fees.v1.MsgUpdateDevFeeInfo", MsgUpdateDevFeeInfo]]; export const MessageComposer = { encoded: { registerDevFeeInfo(value: MsgRegisterDevFeeInfo) { diff --git a/__fixtures__/v-next/outputv4/evmos/fees/v1/tx.rpc.func.ts b/__fixtures__/v-next/outputv4/evmos/fees/v1/tx.rpc.func.ts new file mode 100644 index 0000000000..a9518d6d20 --- /dev/null +++ b/__fixtures__/v-next/outputv4/evmos/fees/v1/tx.rpc.func.ts @@ -0,0 +1,31 @@ +import { buildTx } from "../../../helper-func-types.js"; +import { MsgRegisterDevFeeInfo, MsgRegisterDevFeeInfoSDKType, MsgRegisterDevFeeInfoResponse, MsgRegisterDevFeeInfoResponseSDKType, MsgCancelDevFeeInfo, MsgCancelDevFeeInfoSDKType, MsgCancelDevFeeInfoResponse, MsgCancelDevFeeInfoResponseSDKType, MsgUpdateDevFeeInfo, MsgUpdateDevFeeInfoSDKType, MsgUpdateDevFeeInfoResponse, MsgUpdateDevFeeInfoResponseSDKType } from "./tx.js"; +/** + * RegisterDevFeeInfo is used by a deployer to register a new contract for + * receiving transaction fees + * @name registerDevFeeInfo + * @package evmos.fees.v1 + * @see proto service: evmos.fees.v1.RegisterDevFeeInfo + */ +export const registerDevFeeInfo = buildTx({ + msg: MsgRegisterDevFeeInfo +}); +/** + * CancelDevFeeInfo is used by a deployer to cancel a registered contract + * and stop receiving transaction fees + * @name cancelDevFeeInfo + * @package evmos.fees.v1 + * @see proto service: evmos.fees.v1.CancelDevFeeInfo + */ +export const cancelDevFeeInfo = buildTx({ + msg: MsgCancelDevFeeInfo +}); +/** + * UpdateDevFeeInfo is used by a deployer to update the withdraw address + * @name updateDevFeeInfo + * @package evmos.fees.v1 + * @see proto service: evmos.fees.v1.UpdateDevFeeInfo + */ +export const updateDevFeeInfo = buildTx({ + msg: MsgUpdateDevFeeInfo +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/evmos/fees/v1/tx.rpc.msg.ts b/__fixtures__/v-next/outputv4/evmos/fees/v1/tx.rpc.msg.ts index 54e96de557..915c665f62 100644 --- a/__fixtures__/v-next/outputv4/evmos/fees/v1/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputv4/evmos/fees/v1/tx.rpc.msg.ts @@ -1,4 +1,4 @@ -import { Rpc } from "../../../helpers.js"; +import { TxRpc } from "../../../types.js"; import { BinaryReader } from "../../../binary.js"; import { MsgRegisterDevFeeInfo, MsgRegisterDevFeeInfoSDKType, MsgRegisterDevFeeInfoResponse, MsgRegisterDevFeeInfoResponseSDKType, MsgCancelDevFeeInfo, MsgCancelDevFeeInfoSDKType, MsgCancelDevFeeInfoResponse, MsgCancelDevFeeInfoResponseSDKType, MsgUpdateDevFeeInfo, MsgUpdateDevFeeInfoSDKType, MsgUpdateDevFeeInfoResponse, MsgUpdateDevFeeInfoResponseSDKType } from "./tx.js"; /** Msg defines the fees Msg service. */ @@ -17,8 +17,8 @@ export interface Msg { updateDevFeeInfo(request: MsgUpdateDevFeeInfo): Promise; } export class MsgClientImpl implements Msg { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.registerDevFeeInfo = this.registerDevFeeInfo.bind(this); this.cancelDevFeeInfo = this.cancelDevFeeInfo.bind(this); @@ -40,6 +40,6 @@ export class MsgClientImpl implements Msg { return promise.then(data => MsgUpdateDevFeeInfoResponse.decode(new BinaryReader(data))); } } -export const createClientImpl = (rpc: Rpc) => { +export const createClientImpl = (rpc: TxRpc) => { return new MsgClientImpl(rpc); }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/evmos/incentives/v1/genesis.ts b/__fixtures__/v-next/outputv4/evmos/incentives/v1/genesis.ts index 6808268fae..2c772157dc 100644 --- a/__fixtures__/v-next/outputv4/evmos/incentives/v1/genesis.ts +++ b/__fixtures__/v-next/outputv4/evmos/incentives/v1/genesis.ts @@ -2,7 +2,7 @@ import { Incentive, IncentiveSDKType, GasMeter, GasMeterSDKType } from "./incent import { BinaryReader, BinaryWriter } from "../../../binary.js"; import { isSet, DeepPartial } from "../../../helpers.js"; import { JsonSafe } from "../../../json-safe.js"; -import { Decimal } from "@cosmjs/math"; +import { Decimal } from "@interchainjs/math"; export const protobufPackage = "evmos.incentives.v1"; /** * GenesisState defines the module's genesis state. @@ -353,9 +353,9 @@ export const Params = { toAmino(message: Params): ParamsAmino { const obj: any = {}; obj.enable_incentives = message.enableIncentives === false ? undefined : message.enableIncentives; - obj.allocation_limit = message.allocationLimit === "" ? undefined : message.allocationLimit; + obj.allocation_limit = message.allocationLimit === "" ? undefined : Decimal.fromUserInput(message.allocationLimit, 18).atomics; obj.incentives_epoch_identifier = message.incentivesEpochIdentifier === "" ? undefined : message.incentivesEpochIdentifier; - obj.reward_scaler = message.rewardScaler === "" ? undefined : message.rewardScaler; + obj.reward_scaler = message.rewardScaler === "" ? undefined : Decimal.fromUserInput(message.rewardScaler, 18).atomics; return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputv4/evmos/incentives/v1/query.rpc.Query.ts b/__fixtures__/v-next/outputv4/evmos/incentives/v1/query.rpc.Query.ts index fbb2185e21..b891ff3663 100644 --- a/__fixtures__/v-next/outputv4/evmos/incentives/v1/query.rpc.Query.ts +++ b/__fixtures__/v-next/outputv4/evmos/incentives/v1/query.rpc.Query.ts @@ -2,7 +2,7 @@ import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } fr import { Incentive, IncentiveSDKType, GasMeter, GasMeterSDKType } from "./incentives.js"; import { DecCoin, DecCoinSDKType } from "../../../cosmos/base/v1beta1/coin.js"; import { Params, ParamsSDKType } from "./genesis.js"; -import { Rpc } from "../../../helpers.js"; +import { TxRpc } from "../../../types.js"; import { BinaryReader } from "../../../binary.js"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; import { QueryIncentivesRequest, QueryIncentivesRequestSDKType, QueryIncentivesResponse, QueryIncentivesResponseSDKType, QueryIncentiveRequest, QueryIncentiveRequestSDKType, QueryIncentiveResponse, QueryIncentiveResponseSDKType, QueryGasMetersRequest, QueryGasMetersRequestSDKType, QueryGasMetersResponse, QueryGasMetersResponseSDKType, QueryGasMeterRequest, QueryGasMeterRequestSDKType, QueryGasMeterResponse, QueryGasMeterResponseSDKType, QueryAllocationMetersRequest, QueryAllocationMetersRequestSDKType, QueryAllocationMetersResponse, QueryAllocationMetersResponseSDKType, QueryAllocationMeterRequest, QueryAllocationMeterRequestSDKType, QueryAllocationMeterResponse, QueryAllocationMeterResponseSDKType, QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType } from "./query.js"; @@ -27,8 +27,8 @@ export interface Query { params(request?: QueryParamsRequest): Promise; } export class QueryClientImpl implements Query { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.incentives = this.incentives.bind(this); this.incentive = this.incentive.bind(this); diff --git a/__fixtures__/v-next/outputv4/evmos/incentives/v1/query.rpc.func.ts b/__fixtures__/v-next/outputv4/evmos/incentives/v1/query.rpc.func.ts new file mode 100644 index 0000000000..1b900300cf --- /dev/null +++ b/__fixtures__/v-next/outputv4/evmos/incentives/v1/query.rpc.func.ts @@ -0,0 +1,91 @@ +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination.js"; +import { Incentive, IncentiveSDKType, GasMeter, GasMeterSDKType } from "./incentives.js"; +import { DecCoin, DecCoinSDKType } from "../../../cosmos/base/v1beta1/coin.js"; +import { Params, ParamsSDKType } from "./genesis.js"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types.js"; +import { QueryIncentivesRequest, QueryIncentivesRequestSDKType, QueryIncentivesResponse, QueryIncentivesResponseSDKType, QueryIncentiveRequest, QueryIncentiveRequestSDKType, QueryIncentiveResponse, QueryIncentiveResponseSDKType, QueryGasMetersRequest, QueryGasMetersRequestSDKType, QueryGasMetersResponse, QueryGasMetersResponseSDKType, QueryGasMeterRequest, QueryGasMeterRequestSDKType, QueryGasMeterResponse, QueryGasMeterResponseSDKType, QueryAllocationMetersRequest, QueryAllocationMetersRequestSDKType, QueryAllocationMetersResponse, QueryAllocationMetersResponseSDKType, QueryAllocationMeterRequest, QueryAllocationMeterRequestSDKType, QueryAllocationMeterResponse, QueryAllocationMeterResponseSDKType, QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType } from "./query.js"; +/** + * Incentives retrieves registered incentives + * @name getIncentives + * @package evmos.incentives.v1 + * @see proto service: evmos.incentives.v1.Incentives + */ +export const getIncentives = buildQuery({ + encode: QueryIncentivesRequest.encode, + decode: QueryIncentivesResponse.decode, + service: "evmos.incentives.v1.Query", + method: "Incentives" +}); +/** + * Incentive retrieves a registered incentive + * @name getIncentive + * @package evmos.incentives.v1 + * @see proto service: evmos.incentives.v1.Incentive + */ +export const getIncentive = buildQuery({ + encode: QueryIncentiveRequest.encode, + decode: QueryIncentiveResponse.decode, + service: "evmos.incentives.v1.Query", + method: "Incentive" +}); +/** + * GasMeters retrieves active gas meters for a given contract + * @name getGasMeters + * @package evmos.incentives.v1 + * @see proto service: evmos.incentives.v1.GasMeters + */ +export const getGasMeters = buildQuery({ + encode: QueryGasMetersRequest.encode, + decode: QueryGasMetersResponse.decode, + service: "evmos.incentives.v1.Query", + method: "GasMeters" +}); +/** + * GasMeter Retrieves a active gas meter + * @name getGasMeter + * @package evmos.incentives.v1 + * @see proto service: evmos.incentives.v1.GasMeter + */ +export const getGasMeter = buildQuery({ + encode: QueryGasMeterRequest.encode, + decode: QueryGasMeterResponse.decode, + service: "evmos.incentives.v1.Query", + method: "GasMeter" +}); +/** + * AllocationMeters retrieves active allocation meters for a given + * denomination + * @name getAllocationMeters + * @package evmos.incentives.v1 + * @see proto service: evmos.incentives.v1.AllocationMeters + */ +export const getAllocationMeters = buildQuery({ + encode: QueryAllocationMetersRequest.encode, + decode: QueryAllocationMetersResponse.decode, + service: "evmos.incentives.v1.Query", + method: "AllocationMeters" +}); +/** + * AllocationMeter Retrieves a active gas meter + * @name getAllocationMeter + * @package evmos.incentives.v1 + * @see proto service: evmos.incentives.v1.AllocationMeter + */ +export const getAllocationMeter = buildQuery({ + encode: QueryAllocationMeterRequest.encode, + decode: QueryAllocationMeterResponse.decode, + service: "evmos.incentives.v1.Query", + method: "AllocationMeter" +}); +/** + * Params retrieves the incentives module params + * @name getParams + * @package evmos.incentives.v1 + * @see proto service: evmos.incentives.v1.Params + */ +export const getParams = buildQuery({ + encode: QueryParamsRequest.encode, + decode: QueryParamsResponse.decode, + service: "evmos.incentives.v1.Query", + method: "Params" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/evmos/inflation/v1/inflation.ts b/__fixtures__/v-next/outputv4/evmos/inflation/v1/inflation.ts index 8dab6a2f57..c8d544ff34 100644 --- a/__fixtures__/v-next/outputv4/evmos/inflation/v1/inflation.ts +++ b/__fixtures__/v-next/outputv4/evmos/inflation/v1/inflation.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary.js"; -import { Decimal } from "@cosmjs/math"; +import { Decimal } from "@interchainjs/math"; import { isSet, DeepPartial } from "../../../helpers.js"; import { JsonSafe } from "../../../json-safe.js"; export const protobufPackage = "evmos.inflation.v1"; @@ -219,9 +219,9 @@ export const InflationDistribution = { }, toAmino(message: InflationDistribution): InflationDistributionAmino { const obj: any = {}; - obj.staking_rewards = message.stakingRewards === "" ? undefined : message.stakingRewards; - obj.usage_incentives = message.usageIncentives === "" ? undefined : message.usageIncentives; - obj.community_pool = message.communityPool === "" ? undefined : message.communityPool; + obj.staking_rewards = message.stakingRewards === "" ? undefined : Decimal.fromUserInput(message.stakingRewards, 18).atomics; + obj.usage_incentives = message.usageIncentives === "" ? undefined : Decimal.fromUserInput(message.usageIncentives, 18).atomics; + obj.community_pool = message.communityPool === "" ? undefined : Decimal.fromUserInput(message.communityPool, 18).atomics; return obj; }, fromAminoMsg(object: InflationDistributionAminoMsg): InflationDistribution { @@ -383,11 +383,11 @@ export const ExponentialCalculation = { }, toAmino(message: ExponentialCalculation): ExponentialCalculationAmino { const obj: any = {}; - obj.a = message.a === "" ? undefined : message.a; - obj.r = message.r === "" ? undefined : message.r; - obj.c = message.c === "" ? undefined : message.c; - obj.bonding_target = message.bondingTarget === "" ? undefined : message.bondingTarget; - obj.max_variance = message.maxVariance === "" ? undefined : message.maxVariance; + obj.a = message.a === "" ? undefined : Decimal.fromUserInput(message.a, 18).atomics; + obj.r = message.r === "" ? undefined : Decimal.fromUserInput(message.r, 18).atomics; + obj.c = message.c === "" ? undefined : Decimal.fromUserInput(message.c, 18).atomics; + obj.bonding_target = message.bondingTarget === "" ? undefined : Decimal.fromUserInput(message.bondingTarget, 18).atomics; + obj.max_variance = message.maxVariance === "" ? undefined : Decimal.fromUserInput(message.maxVariance, 18).atomics; return obj; }, fromAminoMsg(object: ExponentialCalculationAminoMsg): ExponentialCalculation { diff --git a/__fixtures__/v-next/outputv4/evmos/inflation/v1/query.rpc.Query.ts b/__fixtures__/v-next/outputv4/evmos/inflation/v1/query.rpc.Query.ts index 8fd4bb0327..06e621d522 100644 --- a/__fixtures__/v-next/outputv4/evmos/inflation/v1/query.rpc.Query.ts +++ b/__fixtures__/v-next/outputv4/evmos/inflation/v1/query.rpc.Query.ts @@ -1,6 +1,6 @@ import { DecCoin, DecCoinSDKType } from "../../../cosmos/base/v1beta1/coin.js"; import { Params, ParamsSDKType } from "./genesis.js"; -import { Rpc } from "../../../helpers.js"; +import { TxRpc } from "../../../types.js"; import { BinaryReader } from "../../../binary.js"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; import { QueryPeriodRequest, QueryPeriodRequestSDKType, QueryPeriodResponse, QueryPeriodResponseSDKType, QueryEpochMintProvisionRequest, QueryEpochMintProvisionRequestSDKType, QueryEpochMintProvisionResponse, QueryEpochMintProvisionResponseSDKType, QuerySkippedEpochsRequest, QuerySkippedEpochsRequestSDKType, QuerySkippedEpochsResponse, QuerySkippedEpochsResponseSDKType, QueryCirculatingSupplyRequest, QueryCirculatingSupplyRequestSDKType, QueryCirculatingSupplyResponse, QueryCirculatingSupplyResponseSDKType, QueryInflationRateRequest, QueryInflationRateRequestSDKType, QueryInflationRateResponse, QueryInflationRateResponseSDKType, QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType } from "./query.js"; @@ -23,8 +23,8 @@ export interface Query { params(request?: QueryParamsRequest): Promise; } export class QueryClientImpl implements Query { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.period = this.period.bind(this); this.epochMintProvision = this.epochMintProvision.bind(this); diff --git a/__fixtures__/v-next/outputv4/evmos/inflation/v1/query.rpc.func.ts b/__fixtures__/v-next/outputv4/evmos/inflation/v1/query.rpc.func.ts new file mode 100644 index 0000000000..1d4001c484 --- /dev/null +++ b/__fixtures__/v-next/outputv4/evmos/inflation/v1/query.rpc.func.ts @@ -0,0 +1,77 @@ +import { DecCoin, DecCoinSDKType } from "../../../cosmos/base/v1beta1/coin.js"; +import { Params, ParamsSDKType } from "./genesis.js"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types.js"; +import { QueryPeriodRequest, QueryPeriodRequestSDKType, QueryPeriodResponse, QueryPeriodResponseSDKType, QueryEpochMintProvisionRequest, QueryEpochMintProvisionRequestSDKType, QueryEpochMintProvisionResponse, QueryEpochMintProvisionResponseSDKType, QuerySkippedEpochsRequest, QuerySkippedEpochsRequestSDKType, QuerySkippedEpochsResponse, QuerySkippedEpochsResponseSDKType, QueryCirculatingSupplyRequest, QueryCirculatingSupplyRequestSDKType, QueryCirculatingSupplyResponse, QueryCirculatingSupplyResponseSDKType, QueryInflationRateRequest, QueryInflationRateRequestSDKType, QueryInflationRateResponse, QueryInflationRateResponseSDKType, QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType } from "./query.js"; +/** + * Period retrieves current period. + * @name getPeriod + * @package evmos.inflation.v1 + * @see proto service: evmos.inflation.v1.Period + */ +export const getPeriod = buildQuery({ + encode: QueryPeriodRequest.encode, + decode: QueryPeriodResponse.decode, + service: "evmos.inflation.v1.Query", + method: "Period" +}); +/** + * EpochMintProvision retrieves current minting epoch provision value. + * @name getEpochMintProvision + * @package evmos.inflation.v1 + * @see proto service: evmos.inflation.v1.EpochMintProvision + */ +export const getEpochMintProvision = buildQuery({ + encode: QueryEpochMintProvisionRequest.encode, + decode: QueryEpochMintProvisionResponse.decode, + service: "evmos.inflation.v1.Query", + method: "EpochMintProvision" +}); +/** + * SkippedEpochs retrieves the total number of skipped epochs. + * @name getSkippedEpochs + * @package evmos.inflation.v1 + * @see proto service: evmos.inflation.v1.SkippedEpochs + */ +export const getSkippedEpochs = buildQuery({ + encode: QuerySkippedEpochsRequest.encode, + decode: QuerySkippedEpochsResponse.decode, + service: "evmos.inflation.v1.Query", + method: "SkippedEpochs" +}); +/** + * CirculatingSupply retrieves the total number of tokens that are in + * circulation (i.e. excluding unvested tokens). + * @name getCirculatingSupply + * @package evmos.inflation.v1 + * @see proto service: evmos.inflation.v1.CirculatingSupply + */ +export const getCirculatingSupply = buildQuery({ + encode: QueryCirculatingSupplyRequest.encode, + decode: QueryCirculatingSupplyResponse.decode, + service: "evmos.inflation.v1.Query", + method: "CirculatingSupply" +}); +/** + * InflationRate retrieves the inflation rate of the current period. + * @name getInflationRate + * @package evmos.inflation.v1 + * @see proto service: evmos.inflation.v1.InflationRate + */ +export const getInflationRate = buildQuery({ + encode: QueryInflationRateRequest.encode, + decode: QueryInflationRateResponse.decode, + service: "evmos.inflation.v1.Query", + method: "InflationRate" +}); +/** + * Params retrieves the total set of minting parameters. + * @name getParams + * @package evmos.inflation.v1 + * @see proto service: evmos.inflation.v1.Params + */ +export const getParams = buildQuery({ + encode: QueryParamsRequest.encode, + decode: QueryParamsResponse.decode, + service: "evmos.inflation.v1.Query", + method: "Params" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/evmos/inflation/v1/query.ts b/__fixtures__/v-next/outputv4/evmos/inflation/v1/query.ts index 2fad53811e..5823a3ac4c 100644 --- a/__fixtures__/v-next/outputv4/evmos/inflation/v1/query.ts +++ b/__fixtures__/v-next/outputv4/evmos/inflation/v1/query.ts @@ -3,7 +3,7 @@ import { Params, ParamsSDKType } from "./genesis.js"; import { BinaryReader, BinaryWriter } from "../../../binary.js"; import { JsonSafe } from "../../../json-safe.js"; import { DeepPartial, isSet } from "../../../helpers.js"; -import { Decimal } from "@cosmjs/math"; +import { Decimal } from "@interchainjs/math"; export const protobufPackage = "evmos.inflation.v1"; /** * QueryPeriodRequest is the request type for the Query/Period RPC method. @@ -1116,7 +1116,7 @@ export const QueryInflationRateResponse = { }, toAmino(message: QueryInflationRateResponse): QueryInflationRateResponseAmino { const obj: any = {}; - obj.inflation_rate = message.inflationRate === "" ? undefined : message.inflationRate; + obj.inflation_rate = message.inflationRate === "" ? undefined : Decimal.fromUserInput(message.inflationRate, 18).atomics; return obj; }, fromAminoMsg(object: QueryInflationRateResponseAminoMsg): QueryInflationRateResponse { diff --git a/__fixtures__/v-next/outputv4/evmos/recovery/v1/query.rpc.Query.ts b/__fixtures__/v-next/outputv4/evmos/recovery/v1/query.rpc.Query.ts index c04b6e4e94..355861558e 100644 --- a/__fixtures__/v-next/outputv4/evmos/recovery/v1/query.rpc.Query.ts +++ b/__fixtures__/v-next/outputv4/evmos/recovery/v1/query.rpc.Query.ts @@ -1,5 +1,5 @@ import { Params, ParamsSDKType } from "./genesis.js"; -import { Rpc } from "../../../helpers.js"; +import { TxRpc } from "../../../types.js"; import { BinaryReader } from "../../../binary.js"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; import { QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType } from "./query.js"; @@ -9,8 +9,8 @@ export interface Query { params(request?: QueryParamsRequest): Promise; } export class QueryClientImpl implements Query { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.params = this.params.bind(this); } diff --git a/__fixtures__/v-next/outputv4/evmos/recovery/v1/query.rpc.func.ts b/__fixtures__/v-next/outputv4/evmos/recovery/v1/query.rpc.func.ts new file mode 100644 index 0000000000..c25e49ea03 --- /dev/null +++ b/__fixtures__/v-next/outputv4/evmos/recovery/v1/query.rpc.func.ts @@ -0,0 +1,15 @@ +import { Params, ParamsSDKType } from "./genesis.js"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types.js"; +import { QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType } from "./query.js"; +/** + * Params retrieves the total set of recovery parameters. + * @name getParams + * @package evmos.recovery.v1 + * @see proto service: evmos.recovery.v1.Params + */ +export const getParams = buildQuery({ + encode: QueryParamsRequest.encode, + decode: QueryParamsResponse.decode, + service: "evmos.recovery.v1.Query", + method: "Params" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/evmos/vesting/v1/query.rpc.Query.ts b/__fixtures__/v-next/outputv4/evmos/vesting/v1/query.rpc.Query.ts index f74296c6ac..903dc69456 100644 --- a/__fixtures__/v-next/outputv4/evmos/vesting/v1/query.rpc.Query.ts +++ b/__fixtures__/v-next/outputv4/evmos/vesting/v1/query.rpc.Query.ts @@ -1,5 +1,5 @@ import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin.js"; -import { Rpc } from "../../../helpers.js"; +import { TxRpc } from "../../../types.js"; import { BinaryReader } from "../../../binary.js"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; import { QueryBalancesRequest, QueryBalancesRequestSDKType, QueryBalancesResponse, QueryBalancesResponseSDKType } from "./query.js"; @@ -9,8 +9,8 @@ export interface Query { balances(request: QueryBalancesRequest): Promise; } export class QueryClientImpl implements Query { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.balances = this.balances.bind(this); } diff --git a/__fixtures__/v-next/outputv4/evmos/vesting/v1/query.rpc.func.ts b/__fixtures__/v-next/outputv4/evmos/vesting/v1/query.rpc.func.ts new file mode 100644 index 0000000000..223a846489 --- /dev/null +++ b/__fixtures__/v-next/outputv4/evmos/vesting/v1/query.rpc.func.ts @@ -0,0 +1,15 @@ +import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin.js"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types.js"; +import { QueryBalancesRequest, QueryBalancesRequestSDKType, QueryBalancesResponse, QueryBalancesResponseSDKType } from "./query.js"; +/** + * Retrieves the unvested, vested and locked tokens for a vesting account + * @name getBalances + * @package evmos.vesting.v1 + * @see proto service: evmos.vesting.v1.Balances + */ +export const getBalances = buildQuery({ + encode: QueryBalancesRequest.encode, + decode: QueryBalancesResponse.decode, + service: "evmos.vesting.v1.Query", + method: "Balances" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/evmos/vesting/v1/tx.registry.ts b/__fixtures__/v-next/outputv4/evmos/vesting/v1/tx.registry.ts index cc6a7ed7e2..3e480c121e 100644 --- a/__fixtures__/v-next/outputv4/evmos/vesting/v1/tx.registry.ts +++ b/__fixtures__/v-next/outputv4/evmos/vesting/v1/tx.registry.ts @@ -1,13 +1,8 @@ import { Timestamp, TimestampSDKType } from "../../../google/protobuf/timestamp.js"; import { Period, PeriodSDKType } from "../../../cosmos/vesting/v1beta1/vesting.js"; -import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { TelescopeGeneratedType } from "../../../types.js"; import { MsgCreateClawbackVestingAccount, MsgCreateClawbackVestingAccountSDKType, MsgClawback, MsgClawbackSDKType } from "./tx.js"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/evmos.vesting.v1.MsgCreateClawbackVestingAccount", MsgCreateClawbackVestingAccount], ["/evmos.vesting.v1.MsgClawback", MsgClawback]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/evmos.vesting.v1.MsgCreateClawbackVestingAccount", MsgCreateClawbackVestingAccount], ["/evmos.vesting.v1.MsgClawback", MsgClawback]]; export const MessageComposer = { encoded: { createClawbackVestingAccount(value: MsgCreateClawbackVestingAccount) { diff --git a/__fixtures__/v-next/outputv4/evmos/vesting/v1/tx.rpc.func.ts b/__fixtures__/v-next/outputv4/evmos/vesting/v1/tx.rpc.func.ts new file mode 100644 index 0000000000..a489cf66d3 --- /dev/null +++ b/__fixtures__/v-next/outputv4/evmos/vesting/v1/tx.rpc.func.ts @@ -0,0 +1,23 @@ +import { Timestamp, TimestampSDKType } from "../../../google/protobuf/timestamp.js"; +import { Period, PeriodSDKType } from "../../../cosmos/vesting/v1beta1/vesting.js"; +import { buildTx } from "../../../helper-func-types.js"; +import { MsgCreateClawbackVestingAccount, MsgCreateClawbackVestingAccountSDKType, MsgCreateClawbackVestingAccountResponse, MsgCreateClawbackVestingAccountResponseSDKType, MsgClawback, MsgClawbackSDKType, MsgClawbackResponse, MsgClawbackResponseSDKType } from "./tx.js"; +/** + * CreateClawbackVestingAccount creats a vesting account that is subject to + * clawback and the configuration of vesting and lockup schedules. + * @name createClawbackVestingAccount + * @package evmos.vesting.v1 + * @see proto service: evmos.vesting.v1.CreateClawbackVestingAccount + */ +export const createClawbackVestingAccount = buildTx({ + msg: MsgCreateClawbackVestingAccount +}); +/** + * Clawback removes the unvested tokens from a ClawbackVestingAccount. + * @name clawback + * @package evmos.vesting.v1 + * @see proto service: evmos.vesting.v1.Clawback + */ +export const clawback = buildTx({ + msg: MsgClawback +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/evmos/vesting/v1/tx.rpc.msg.ts b/__fixtures__/v-next/outputv4/evmos/vesting/v1/tx.rpc.msg.ts index 23323e5074..7fdacece26 100644 --- a/__fixtures__/v-next/outputv4/evmos/vesting/v1/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputv4/evmos/vesting/v1/tx.rpc.msg.ts @@ -1,6 +1,6 @@ import { Timestamp, TimestampSDKType } from "../../../google/protobuf/timestamp.js"; import { Period, PeriodSDKType } from "../../../cosmos/vesting/v1beta1/vesting.js"; -import { Rpc } from "../../../helpers.js"; +import { TxRpc } from "../../../types.js"; import { BinaryReader } from "../../../binary.js"; import { MsgCreateClawbackVestingAccount, MsgCreateClawbackVestingAccountSDKType, MsgCreateClawbackVestingAccountResponse, MsgCreateClawbackVestingAccountResponseSDKType, MsgClawback, MsgClawbackSDKType, MsgClawbackResponse, MsgClawbackResponseSDKType } from "./tx.js"; /** Msg defines the vesting Msg service. */ @@ -14,8 +14,8 @@ export interface Msg { clawback(request: MsgClawback): Promise; } export class MsgClientImpl implements Msg { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.createClawbackVestingAccount = this.createClawbackVestingAccount.bind(this); this.clawback = this.clawback.bind(this); @@ -31,6 +31,6 @@ export class MsgClientImpl implements Msg { return promise.then(data => MsgClawbackResponse.decode(new BinaryReader(data))); } } -export const createClientImpl = (rpc: Rpc) => { +export const createClientImpl = (rpc: TxRpc) => { return new MsgClientImpl(rpc); }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/extern.ts b/__fixtures__/v-next/outputv4/extern.ts index 55c458deb4..83d6864ae2 100644 --- a/__fixtures__/v-next/outputv4/extern.ts +++ b/__fixtures__/v-next/outputv4/extern.ts @@ -4,51 +4,45 @@ * and run the transpile command or npm scripts command that is used to regenerate this bundle. */ -import { QueryClient, createProtobufRpcClient, ProtobufRpcClient } from '@cosmjs/stargate' -import { connectComet, Tendermint34Client, HttpEndpoint } from "@cosmjs/tendermint-rpc"; -const _rpcClients: Record = {}; +import { HttpEndpoint } from "@interchainjs/types"; +import { Rpc } from "./helpers"; +import { ClientOptions, createCosmosQueryClient } from "@interchainjs/cosmos"; -export const getRpcEndpointKey = (rpcEndpoint: string | HttpEndpoint) => { - if (typeof rpcEndpoint === 'string') { - return rpcEndpoint; - } else if (!!rpcEndpoint) { - //@ts-ignore - return rpcEndpoint.url; - } -} +const _rpcClients: Record = {}; -export const getRpcClient = async (rpcEndpoint: string | HttpEndpoint) => { - const key = getRpcEndpointKey(rpcEndpoint); - if (!key) return; - if (_rpcClients.hasOwnProperty(key)) { - return _rpcClients[key]; - } - const cometClient = await connectComet(rpcEndpoint); +export const getRpcEndpointKey = (rpcEndpoint: string | HttpEndpoint) => { + if (typeof rpcEndpoint === 'string') { + return rpcEndpoint; + } else if (!!rpcEndpoint) { //@ts-ignore - const client = new QueryClient(cometClient); - const rpc = createProtobufRpcClient(client); - _rpcClients[key] = rpc; - return rpc; + return rpcEndpoint.url; + } } -export const createRpcClient = async (rpcEndpoint: string | HttpEndpoint) => { - const cometClient = await connectComet(rpcEndpoint); - //@ts-ignore - const client = new QueryClient(cometClient); - const rpc = createProtobufRpcClient(client); - +export const getRpcClient = async (rpcEndpoint: string | HttpEndpoint) => { + const key = getRpcEndpointKey(rpcEndpoint); + if (!key) return; + if (_rpcClients.hasOwnProperty(key)) { + return _rpcClients[key]; + } + const rpc = await createRpcClient(rpcEndpoint); + _rpcClients[key] = rpc; return rpc; } -export const createTm34QueryClient = async (rpcEndpoint: string | HttpEndpoint) => { - const tmClient = await Tendermint34Client.connect(rpcEndpoint); - //@ts-ignore - return new QueryClient(tmClient); -} - -export const createConnectCometQueryClient = async (rpcEndpoint: string | HttpEndpoint) => { - const cometClient = await connectComet(rpcEndpoint); - //@ts-ignore - return new QueryClient(cometClient); +export const createRpcClient = async (rpcEndpoint: string | HttpEndpoint, + options?: ClientOptions +) => { + if (typeof rpcEndpoint === 'string') { + return createCosmosQueryClient(rpcEndpoint, options); + } else { + const endpointStr = rpcEndpoint.url; + const clientOptions = { + ...options, + headers: rpcEndpoint.headers + }; + + return createCosmosQueryClient(endpointStr, clientOptions); + } } diff --git a/__fixtures__/v-next/outputv4/helper-func-types.ts b/__fixtures__/v-next/outputv4/helper-func-types.ts new file mode 100644 index 0000000000..1c4dda311c --- /dev/null +++ b/__fixtures__/v-next/outputv4/helper-func-types.ts @@ -0,0 +1,92 @@ +/** +* This file and any referenced files were automatically generated by @hyperweb/telescope@latest +* DO NOT MODIFY BY HAND. Instead, download the latest proto files for your chain +* and run the transpile command or npm scripts command that is used to regenerate this bundle. +*/ + + +import { HttpEndpoint } from "@interchainjs/types"; +import { BinaryReader, BinaryWriter } from "./binary.js"; +import { getRpcClient } from "./extern.js"; +import { isRpc, Rpc } from "./helpers.js"; +import { TelescopeGeneratedCodec, DeliverTxResponse, Message, StdFee } from "./types.js"; +import { toConverters, toEncoders } from "@interchainjs/cosmos/utils"; +import { ISigningClient } from "@interchainjs/cosmos/types/signing-client.js"; + +export interface QueryBuilderOptions { + encode: (request: TReq, writer?: BinaryWriter) => BinaryWriter + decode: (input: BinaryReader | Uint8Array, length?: number) => TRes + service: string, + method: string, +} + +export function buildQuery(opts: QueryBuilderOptions) { + return async (client: EndpointOrRpc, request: TReq) => { + let rpc: Rpc | undefined; + + if(isRpc(client)) { + rpc = client; + } else { + rpc = client ? await getRpcClient(client) : undefined; + } + + if (!rpc) throw new Error("Query Rpc is not initialized"); + + const data = opts.encode(request).finish(); + const response = await rpc.request(opts.service, opts.method, data); + return opts.decode(response); + }; +} + +export interface ITxArgs { + signerAddress: string; + message: TMsg | TMsg[]; + fee: StdFee | 'auto'; + memo: string; +} + +export interface TxBuilderOptions { + msg: TelescopeGeneratedCodec +} + +export function buildTx(opts: TxBuilderOptions) { + return async ( + client: ISigningClient, + signerAddress: string, + message: TMsg | TMsg[], + fee: StdFee | 'auto', + memo: string + ): Promise => { + if (!client) throw new Error("SigningClient is not initialized"); + + //register all related encoders and converters + client.addEncoders?.(toEncoders(opts.msg)); + client.addConverters?.(toConverters(opts.msg)); + + const data = Array.isArray(message) + ? message.map(msg => ({ + typeUrl: opts.msg.typeUrl, + value: msg, + })) + : [{ + typeUrl: opts.msg.typeUrl, + value: message, + }]; + return client.signAndBroadcast!(signerAddress, data, fee, memo); + }; +} + +export interface Encoder { + typeUrl: string; + fromPartial: (data: any) => any; + encode: (data: any) => Uint8Array; +} + +export interface AminoConverter { + typeUrl: string; + aminoType: string; + fromAmino: (data: any) => any; + toAmino: (data: any) => any; +} + +export type EndpointOrRpc = string | HttpEndpoint | Rpc ; diff --git a/__fixtures__/v-next/outputv4/ibc/applications/transfer/v1/query.rpc.Query.ts b/__fixtures__/v-next/outputv4/ibc/applications/transfer/v1/query.rpc.Query.ts index dc3b247181..e30c01587a 100644 --- a/__fixtures__/v-next/outputv4/ibc/applications/transfer/v1/query.rpc.Query.ts +++ b/__fixtures__/v-next/outputv4/ibc/applications/transfer/v1/query.rpc.Query.ts @@ -1,6 +1,6 @@ import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../../cosmos/base/query/v1beta1/pagination.js"; import { DenomTrace, DenomTraceSDKType, Params, ParamsSDKType } from "./transfer.js"; -import { Rpc } from "../../../../helpers.js"; +import { TxRpc } from "../../../../types.js"; import { BinaryReader } from "../../../../binary.js"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; import { QueryDenomTraceRequest, QueryDenomTraceRequestSDKType, QueryDenomTraceResponse, QueryDenomTraceResponseSDKType, QueryDenomTracesRequest, QueryDenomTracesRequestSDKType, QueryDenomTracesResponse, QueryDenomTracesResponseSDKType, QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType } from "./query.js"; @@ -14,8 +14,8 @@ export interface Query { params(request?: QueryParamsRequest): Promise; } export class QueryClientImpl implements Query { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.denomTrace = this.denomTrace.bind(this); this.denomTraces = this.denomTraces.bind(this); diff --git a/__fixtures__/v-next/outputv4/ibc/applications/transfer/v1/query.rpc.func.ts b/__fixtures__/v-next/outputv4/ibc/applications/transfer/v1/query.rpc.func.ts new file mode 100644 index 0000000000..42b9d791d3 --- /dev/null +++ b/__fixtures__/v-next/outputv4/ibc/applications/transfer/v1/query.rpc.func.ts @@ -0,0 +1,40 @@ +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../../cosmos/base/query/v1beta1/pagination.js"; +import { DenomTrace, DenomTraceSDKType, Params, ParamsSDKType } from "./transfer.js"; +import { EndpointOrRpc, buildQuery } from "../../../../helper-func-types.js"; +import { QueryDenomTraceRequest, QueryDenomTraceRequestSDKType, QueryDenomTraceResponse, QueryDenomTraceResponseSDKType, QueryDenomTracesRequest, QueryDenomTracesRequestSDKType, QueryDenomTracesResponse, QueryDenomTracesResponseSDKType, QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType } from "./query.js"; +/** + * DenomTrace queries a denomination trace information. + * @name getDenomTrace + * @package ibc.applications.transfer.v1 + * @see proto service: ibc.applications.transfer.v1.DenomTrace + */ +export const getDenomTrace = buildQuery({ + encode: QueryDenomTraceRequest.encode, + decode: QueryDenomTraceResponse.decode, + service: "ibc.applications.transfer.v1.Query", + method: "DenomTrace" +}); +/** + * DenomTraces queries all denomination traces. + * @name getDenomTraces + * @package ibc.applications.transfer.v1 + * @see proto service: ibc.applications.transfer.v1.DenomTraces + */ +export const getDenomTraces = buildQuery({ + encode: QueryDenomTracesRequest.encode, + decode: QueryDenomTracesResponse.decode, + service: "ibc.applications.transfer.v1.Query", + method: "DenomTraces" +}); +/** + * Params queries all parameters of the ibc-transfer module. + * @name getParams + * @package ibc.applications.transfer.v1 + * @see proto service: ibc.applications.transfer.v1.Params + */ +export const getParams = buildQuery({ + encode: QueryParamsRequest.encode, + decode: QueryParamsResponse.decode, + service: "ibc.applications.transfer.v1.Query", + method: "Params" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/ibc/applications/transfer/v1/tx.registry.ts b/__fixtures__/v-next/outputv4/ibc/applications/transfer/v1/tx.registry.ts index f4b300e8d7..a09909b6f7 100644 --- a/__fixtures__/v-next/outputv4/ibc/applications/transfer/v1/tx.registry.ts +++ b/__fixtures__/v-next/outputv4/ibc/applications/transfer/v1/tx.registry.ts @@ -1,13 +1,8 @@ import { Coin, CoinSDKType } from "../../../../cosmos/base/v1beta1/coin.js"; import { Height, HeightSDKType } from "../../../core/client/v1/client.js"; -import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { TelescopeGeneratedType } from "../../../../types.js"; import { MsgTransfer, MsgTransferSDKType } from "./tx.js"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/ibc.applications.transfer.v1.MsgTransfer", MsgTransfer]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/ibc.applications.transfer.v1.MsgTransfer", MsgTransfer]]; export const MessageComposer = { encoded: { transfer(value: MsgTransfer) { diff --git a/__fixtures__/v-next/outputv4/ibc/applications/transfer/v1/tx.rpc.func.ts b/__fixtures__/v-next/outputv4/ibc/applications/transfer/v1/tx.rpc.func.ts new file mode 100644 index 0000000000..e0143ab0a1 --- /dev/null +++ b/__fixtures__/v-next/outputv4/ibc/applications/transfer/v1/tx.rpc.func.ts @@ -0,0 +1,13 @@ +import { Coin, CoinSDKType } from "../../../../cosmos/base/v1beta1/coin.js"; +import { Height, HeightSDKType } from "../../../core/client/v1/client.js"; +import { buildTx } from "../../../../helper-func-types.js"; +import { MsgTransfer, MsgTransferSDKType, MsgTransferResponse, MsgTransferResponseSDKType } from "./tx.js"; +/** + * Transfer defines a rpc handler method for MsgTransfer. + * @name transfer + * @package ibc.applications.transfer.v1 + * @see proto service: ibc.applications.transfer.v1.Transfer + */ +export const transfer = buildTx({ + msg: MsgTransfer +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/ibc/applications/transfer/v1/tx.rpc.msg.ts b/__fixtures__/v-next/outputv4/ibc/applications/transfer/v1/tx.rpc.msg.ts index 2e9a9506bf..88b731c9ef 100644 --- a/__fixtures__/v-next/outputv4/ibc/applications/transfer/v1/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputv4/ibc/applications/transfer/v1/tx.rpc.msg.ts @@ -1,6 +1,6 @@ import { Coin, CoinSDKType } from "../../../../cosmos/base/v1beta1/coin.js"; import { Height, HeightSDKType } from "../../../core/client/v1/client.js"; -import { Rpc } from "../../../../helpers.js"; +import { TxRpc } from "../../../../types.js"; import { BinaryReader } from "../../../../binary.js"; import { MsgTransfer, MsgTransferSDKType, MsgTransferResponse, MsgTransferResponseSDKType } from "./tx.js"; /** Msg defines the ibc/transfer Msg service. */ @@ -9,8 +9,8 @@ export interface Msg { transfer(request: MsgTransfer): Promise; } export class MsgClientImpl implements Msg { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.transfer = this.transfer.bind(this); } @@ -20,6 +20,6 @@ export class MsgClientImpl implements Msg { return promise.then(data => MsgTransferResponse.decode(new BinaryReader(data))); } } -export const createClientImpl = (rpc: Rpc) => { +export const createClientImpl = (rpc: TxRpc) => { return new MsgClientImpl(rpc); }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/ibc/bundle.ts b/__fixtures__/v-next/outputv4/ibc/bundle.ts index 30a5f69a55..3d4fc306b5 100644 --- a/__fixtures__/v-next/outputv4/ibc/bundle.ts +++ b/__fixtures__/v-next/outputv4/ibc/bundle.ts @@ -22,30 +22,39 @@ import * as _250 from "./lightclients/localhost/v1/localhost.js"; import * as _251 from "./lightclients/solomachine/v1/solomachine.js"; import * as _252 from "./lightclients/solomachine/v2/solomachine.js"; import * as _253 from "./lightclients/tendermint/v1/tendermint.js"; -import * as _465 from "./applications/transfer/v1/tx.amino.js"; -import * as _466 from "./core/channel/v1/tx.amino.js"; -import * as _467 from "./core/client/v1/tx.amino.js"; -import * as _468 from "./core/connection/v1/tx.amino.js"; -import * as _469 from "./applications/transfer/v1/tx.registry.js"; -import * as _470 from "./core/channel/v1/tx.registry.js"; -import * as _471 from "./core/client/v1/tx.registry.js"; -import * as _472 from "./core/connection/v1/tx.registry.js"; -import * as _473 from "./applications/transfer/v1/query.lcd.js"; -import * as _474 from "./core/channel/v1/query.lcd.js"; -import * as _475 from "./core/client/v1/query.lcd.js"; -import * as _476 from "./core/connection/v1/query.lcd.js"; -import * as _477 from "./applications/transfer/v1/query.rpc.Query.js"; -import * as _478 from "./core/channel/v1/query.rpc.Query.js"; -import * as _479 from "./core/client/v1/query.rpc.Query.js"; -import * as _480 from "./core/connection/v1/query.rpc.Query.js"; -import * as _481 from "./core/port/v1/query.rpc.Query.js"; -import * as _482 from "./applications/transfer/v1/tx.rpc.msg.js"; -import * as _483 from "./core/channel/v1/tx.rpc.msg.js"; -import * as _484 from "./core/client/v1/tx.rpc.msg.js"; -import * as _485 from "./core/connection/v1/tx.rpc.msg.js"; -import * as _553 from "./lcd.js"; -import * as _554 from "./rpc.query.js"; -import * as _555 from "./rpc.tx.js"; +import * as _528 from "./applications/transfer/v1/tx.amino.js"; +import * as _529 from "./core/channel/v1/tx.amino.js"; +import * as _530 from "./core/client/v1/tx.amino.js"; +import * as _531 from "./core/connection/v1/tx.amino.js"; +import * as _532 from "./applications/transfer/v1/tx.registry.js"; +import * as _533 from "./core/channel/v1/tx.registry.js"; +import * as _534 from "./core/client/v1/tx.registry.js"; +import * as _535 from "./core/connection/v1/tx.registry.js"; +import * as _536 from "./applications/transfer/v1/query.lcd.js"; +import * as _537 from "./core/channel/v1/query.lcd.js"; +import * as _538 from "./core/client/v1/query.lcd.js"; +import * as _539 from "./core/connection/v1/query.lcd.js"; +import * as _540 from "./applications/transfer/v1/query.rpc.func.js"; +import * as _541 from "./core/channel/v1/query.rpc.func.js"; +import * as _542 from "./core/client/v1/query.rpc.func.js"; +import * as _543 from "./core/connection/v1/query.rpc.func.js"; +import * as _544 from "./core/port/v1/query.rpc.func.js"; +import * as _545 from "./applications/transfer/v1/query.rpc.Query.js"; +import * as _546 from "./core/channel/v1/query.rpc.Query.js"; +import * as _547 from "./core/client/v1/query.rpc.Query.js"; +import * as _548 from "./core/connection/v1/query.rpc.Query.js"; +import * as _549 from "./core/port/v1/query.rpc.Query.js"; +import * as _550 from "./applications/transfer/v1/tx.rpc.func.js"; +import * as _551 from "./core/channel/v1/tx.rpc.func.js"; +import * as _552 from "./core/client/v1/tx.rpc.func.js"; +import * as _553 from "./core/connection/v1/tx.rpc.func.js"; +import * as _554 from "./applications/transfer/v1/tx.rpc.msg.js"; +import * as _555 from "./core/channel/v1/tx.rpc.msg.js"; +import * as _556 from "./core/client/v1/tx.rpc.msg.js"; +import * as _557 from "./core/connection/v1/tx.rpc.msg.js"; +import * as _646 from "./lcd.js"; +import * as _647 from "./rpc.query.js"; +import * as _648 from "./rpc.tx.js"; export namespace ibc { export namespace applications { export namespace transfer { @@ -54,11 +63,13 @@ export namespace ibc { ..._231, ..._232, ..._233, - ..._465, - ..._469, - ..._473, - ..._477, - ..._482 + ..._528, + ..._532, + ..._536, + ..._540, + ..._545, + ..._550, + ..._554 }; export const v2 = { ..._234 @@ -72,11 +83,13 @@ export namespace ibc { ..._236, ..._237, ..._238, - ..._466, - ..._470, - ..._474, - ..._478, - ..._483 + ..._529, + ..._533, + ..._537, + ..._541, + ..._546, + ..._551, + ..._555 }; } export namespace client { @@ -85,11 +98,13 @@ export namespace ibc { ..._240, ..._241, ..._242, - ..._467, - ..._471, - ..._475, - ..._479, - ..._484 + ..._530, + ..._534, + ..._538, + ..._542, + ..._547, + ..._552, + ..._556 }; } export namespace commitment { @@ -103,17 +118,20 @@ export namespace ibc { ..._245, ..._246, ..._247, - ..._468, - ..._472, - ..._476, - ..._480, - ..._485 + ..._531, + ..._535, + ..._539, + ..._543, + ..._548, + ..._553, + ..._557 }; } export namespace port { export const v1 = { ..._248, - ..._481 + ..._544, + ..._549 }; } export namespace types { @@ -143,8 +161,8 @@ export namespace ibc { } } export const ClientFactory = { - ..._553, - ..._554, - ..._555 + ..._646, + ..._647, + ..._648 }; } \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/ibc/core/channel/v1/query.rpc.Query.ts b/__fixtures__/v-next/outputv4/ibc/core/channel/v1/query.rpc.Query.ts index 2b1d8d73fd..7f1a206b9c 100644 --- a/__fixtures__/v-next/outputv4/ibc/core/channel/v1/query.rpc.Query.ts +++ b/__fixtures__/v-next/outputv4/ibc/core/channel/v1/query.rpc.Query.ts @@ -2,7 +2,7 @@ import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } fr import { Channel, ChannelSDKType, IdentifiedChannel, IdentifiedChannelSDKType, PacketState, PacketStateSDKType } from "./channel.js"; import { Height, HeightSDKType, IdentifiedClientState, IdentifiedClientStateSDKType } from "../../client/v1/client.js"; import { Any, AnySDKType } from "../../../../google/protobuf/any.js"; -import { Rpc } from "../../../../helpers.js"; +import { TxRpc } from "../../../../types.js"; import { BinaryReader } from "../../../../binary.js"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; import { QueryChannelRequest, QueryChannelRequestSDKType, QueryChannelResponse, QueryChannelResponseSDKType, QueryChannelsRequest, QueryChannelsRequestSDKType, QueryChannelsResponse, QueryChannelsResponseSDKType, QueryConnectionChannelsRequest, QueryConnectionChannelsRequestSDKType, QueryConnectionChannelsResponse, QueryConnectionChannelsResponseSDKType, QueryChannelClientStateRequest, QueryChannelClientStateRequestSDKType, QueryChannelClientStateResponse, QueryChannelClientStateResponseSDKType, QueryChannelConsensusStateRequest, QueryChannelConsensusStateRequestSDKType, QueryChannelConsensusStateResponse, QueryChannelConsensusStateResponseSDKType, QueryPacketCommitmentRequest, QueryPacketCommitmentRequestSDKType, QueryPacketCommitmentResponse, QueryPacketCommitmentResponseSDKType, QueryPacketCommitmentsRequest, QueryPacketCommitmentsRequestSDKType, QueryPacketCommitmentsResponse, QueryPacketCommitmentsResponseSDKType, QueryPacketReceiptRequest, QueryPacketReceiptRequestSDKType, QueryPacketReceiptResponse, QueryPacketReceiptResponseSDKType, QueryPacketAcknowledgementRequest, QueryPacketAcknowledgementRequestSDKType, QueryPacketAcknowledgementResponse, QueryPacketAcknowledgementResponseSDKType, QueryPacketAcknowledgementsRequest, QueryPacketAcknowledgementsRequestSDKType, QueryPacketAcknowledgementsResponse, QueryPacketAcknowledgementsResponseSDKType, QueryUnreceivedPacketsRequest, QueryUnreceivedPacketsRequestSDKType, QueryUnreceivedPacketsResponse, QueryUnreceivedPacketsResponseSDKType, QueryUnreceivedAcksRequest, QueryUnreceivedAcksRequestSDKType, QueryUnreceivedAcksResponse, QueryUnreceivedAcksResponseSDKType, QueryNextSequenceReceiveRequest, QueryNextSequenceReceiveRequestSDKType, QueryNextSequenceReceiveResponse, QueryNextSequenceReceiveResponseSDKType } from "./query.js"; @@ -60,8 +60,8 @@ export interface Query { nextSequenceReceive(request: QueryNextSequenceReceiveRequest): Promise; } export class QueryClientImpl implements Query { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.channel = this.channel.bind(this); this.channels = this.channels.bind(this); diff --git a/__fixtures__/v-next/outputv4/ibc/core/channel/v1/query.rpc.func.ts b/__fixtures__/v-next/outputv4/ibc/core/channel/v1/query.rpc.func.ts new file mode 100644 index 0000000000..9b1f1ee891 --- /dev/null +++ b/__fixtures__/v-next/outputv4/ibc/core/channel/v1/query.rpc.func.ts @@ -0,0 +1,170 @@ +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../../cosmos/base/query/v1beta1/pagination.js"; +import { Channel, ChannelSDKType, IdentifiedChannel, IdentifiedChannelSDKType, PacketState, PacketStateSDKType } from "./channel.js"; +import { Height, HeightSDKType, IdentifiedClientState, IdentifiedClientStateSDKType } from "../../client/v1/client.js"; +import { Any, AnySDKType } from "../../../../google/protobuf/any.js"; +import { EndpointOrRpc, buildQuery } from "../../../../helper-func-types.js"; +import { QueryChannelRequest, QueryChannelRequestSDKType, QueryChannelResponse, QueryChannelResponseSDKType, QueryChannelsRequest, QueryChannelsRequestSDKType, QueryChannelsResponse, QueryChannelsResponseSDKType, QueryConnectionChannelsRequest, QueryConnectionChannelsRequestSDKType, QueryConnectionChannelsResponse, QueryConnectionChannelsResponseSDKType, QueryChannelClientStateRequest, QueryChannelClientStateRequestSDKType, QueryChannelClientStateResponse, QueryChannelClientStateResponseSDKType, QueryChannelConsensusStateRequest, QueryChannelConsensusStateRequestSDKType, QueryChannelConsensusStateResponse, QueryChannelConsensusStateResponseSDKType, QueryPacketCommitmentRequest, QueryPacketCommitmentRequestSDKType, QueryPacketCommitmentResponse, QueryPacketCommitmentResponseSDKType, QueryPacketCommitmentsRequest, QueryPacketCommitmentsRequestSDKType, QueryPacketCommitmentsResponse, QueryPacketCommitmentsResponseSDKType, QueryPacketReceiptRequest, QueryPacketReceiptRequestSDKType, QueryPacketReceiptResponse, QueryPacketReceiptResponseSDKType, QueryPacketAcknowledgementRequest, QueryPacketAcknowledgementRequestSDKType, QueryPacketAcknowledgementResponse, QueryPacketAcknowledgementResponseSDKType, QueryPacketAcknowledgementsRequest, QueryPacketAcknowledgementsRequestSDKType, QueryPacketAcknowledgementsResponse, QueryPacketAcknowledgementsResponseSDKType, QueryUnreceivedPacketsRequest, QueryUnreceivedPacketsRequestSDKType, QueryUnreceivedPacketsResponse, QueryUnreceivedPacketsResponseSDKType, QueryUnreceivedAcksRequest, QueryUnreceivedAcksRequestSDKType, QueryUnreceivedAcksResponse, QueryUnreceivedAcksResponseSDKType, QueryNextSequenceReceiveRequest, QueryNextSequenceReceiveRequestSDKType, QueryNextSequenceReceiveResponse, QueryNextSequenceReceiveResponseSDKType } from "./query.js"; +/** + * Channel queries an IBC Channel. + * @name getChannel + * @package ibc.core.channel.v1 + * @see proto service: ibc.core.channel.v1.Channel + */ +export const getChannel = buildQuery({ + encode: QueryChannelRequest.encode, + decode: QueryChannelResponse.decode, + service: "ibc.core.channel.v1.Query", + method: "Channel" +}); +/** + * Channels queries all the IBC channels of a chain. + * @name getChannels + * @package ibc.core.channel.v1 + * @see proto service: ibc.core.channel.v1.Channels + */ +export const getChannels = buildQuery({ + encode: QueryChannelsRequest.encode, + decode: QueryChannelsResponse.decode, + service: "ibc.core.channel.v1.Query", + method: "Channels" +}); +/** + * ConnectionChannels queries all the channels associated with a connection + * end. + * @name getConnectionChannels + * @package ibc.core.channel.v1 + * @see proto service: ibc.core.channel.v1.ConnectionChannels + */ +export const getConnectionChannels = buildQuery({ + encode: QueryConnectionChannelsRequest.encode, + decode: QueryConnectionChannelsResponse.decode, + service: "ibc.core.channel.v1.Query", + method: "ConnectionChannels" +}); +/** + * ChannelClientState queries for the client state for the channel associated + * with the provided channel identifiers. + * @name getChannelClientState + * @package ibc.core.channel.v1 + * @see proto service: ibc.core.channel.v1.ChannelClientState + */ +export const getChannelClientState = buildQuery({ + encode: QueryChannelClientStateRequest.encode, + decode: QueryChannelClientStateResponse.decode, + service: "ibc.core.channel.v1.Query", + method: "ChannelClientState" +}); +/** + * ChannelConsensusState queries for the consensus state for the channel + * associated with the provided channel identifiers. + * @name getChannelConsensusState + * @package ibc.core.channel.v1 + * @see proto service: ibc.core.channel.v1.ChannelConsensusState + */ +export const getChannelConsensusState = buildQuery({ + encode: QueryChannelConsensusStateRequest.encode, + decode: QueryChannelConsensusStateResponse.decode, + service: "ibc.core.channel.v1.Query", + method: "ChannelConsensusState" +}); +/** + * PacketCommitment queries a stored packet commitment hash. + * @name getPacketCommitment + * @package ibc.core.channel.v1 + * @see proto service: ibc.core.channel.v1.PacketCommitment + */ +export const getPacketCommitment = buildQuery({ + encode: QueryPacketCommitmentRequest.encode, + decode: QueryPacketCommitmentResponse.decode, + service: "ibc.core.channel.v1.Query", + method: "PacketCommitment" +}); +/** + * PacketCommitments returns all the packet commitments hashes associated + * with a channel. + * @name getPacketCommitments + * @package ibc.core.channel.v1 + * @see proto service: ibc.core.channel.v1.PacketCommitments + */ +export const getPacketCommitments = buildQuery({ + encode: QueryPacketCommitmentsRequest.encode, + decode: QueryPacketCommitmentsResponse.decode, + service: "ibc.core.channel.v1.Query", + method: "PacketCommitments" +}); +/** + * PacketReceipt queries if a given packet sequence has been received on the + * queried chain + * @name getPacketReceipt + * @package ibc.core.channel.v1 + * @see proto service: ibc.core.channel.v1.PacketReceipt + */ +export const getPacketReceipt = buildQuery({ + encode: QueryPacketReceiptRequest.encode, + decode: QueryPacketReceiptResponse.decode, + service: "ibc.core.channel.v1.Query", + method: "PacketReceipt" +}); +/** + * PacketAcknowledgement queries a stored packet acknowledgement hash. + * @name getPacketAcknowledgement + * @package ibc.core.channel.v1 + * @see proto service: ibc.core.channel.v1.PacketAcknowledgement + */ +export const getPacketAcknowledgement = buildQuery({ + encode: QueryPacketAcknowledgementRequest.encode, + decode: QueryPacketAcknowledgementResponse.decode, + service: "ibc.core.channel.v1.Query", + method: "PacketAcknowledgement" +}); +/** + * PacketAcknowledgements returns all the packet acknowledgements associated + * with a channel. + * @name getPacketAcknowledgements + * @package ibc.core.channel.v1 + * @see proto service: ibc.core.channel.v1.PacketAcknowledgements + */ +export const getPacketAcknowledgements = buildQuery({ + encode: QueryPacketAcknowledgementsRequest.encode, + decode: QueryPacketAcknowledgementsResponse.decode, + service: "ibc.core.channel.v1.Query", + method: "PacketAcknowledgements" +}); +/** + * UnreceivedPackets returns all the unreceived IBC packets associated with a + * channel and sequences. + * @name getUnreceivedPackets + * @package ibc.core.channel.v1 + * @see proto service: ibc.core.channel.v1.UnreceivedPackets + */ +export const getUnreceivedPackets = buildQuery({ + encode: QueryUnreceivedPacketsRequest.encode, + decode: QueryUnreceivedPacketsResponse.decode, + service: "ibc.core.channel.v1.Query", + method: "UnreceivedPackets" +}); +/** + * UnreceivedAcks returns all the unreceived IBC acknowledgements associated + * with a channel and sequences. + * @name getUnreceivedAcks + * @package ibc.core.channel.v1 + * @see proto service: ibc.core.channel.v1.UnreceivedAcks + */ +export const getUnreceivedAcks = buildQuery({ + encode: QueryUnreceivedAcksRequest.encode, + decode: QueryUnreceivedAcksResponse.decode, + service: "ibc.core.channel.v1.Query", + method: "UnreceivedAcks" +}); +/** + * NextSequenceReceive returns the next receive sequence for a given channel. + * @name getNextSequenceReceive + * @package ibc.core.channel.v1 + * @see proto service: ibc.core.channel.v1.NextSequenceReceive + */ +export const getNextSequenceReceive = buildQuery({ + encode: QueryNextSequenceReceiveRequest.encode, + decode: QueryNextSequenceReceiveResponse.decode, + service: "ibc.core.channel.v1.Query", + method: "NextSequenceReceive" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/ibc/core/channel/v1/tx.registry.ts b/__fixtures__/v-next/outputv4/ibc/core/channel/v1/tx.registry.ts index cab31fe462..d9a1e4b719 100644 --- a/__fixtures__/v-next/outputv4/ibc/core/channel/v1/tx.registry.ts +++ b/__fixtures__/v-next/outputv4/ibc/core/channel/v1/tx.registry.ts @@ -1,13 +1,8 @@ import { Channel, ChannelSDKType, Packet, PacketSDKType } from "./channel.js"; import { Height, HeightSDKType } from "../../client/v1/client.js"; -import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { TelescopeGeneratedType } from "../../../../types.js"; import { MsgChannelOpenInit, MsgChannelOpenInitSDKType, MsgChannelOpenTry, MsgChannelOpenTrySDKType, MsgChannelOpenAck, MsgChannelOpenAckSDKType, MsgChannelOpenConfirm, MsgChannelOpenConfirmSDKType, MsgChannelCloseInit, MsgChannelCloseInitSDKType, MsgChannelCloseConfirm, MsgChannelCloseConfirmSDKType, MsgRecvPacket, MsgRecvPacketSDKType, MsgTimeout, MsgTimeoutSDKType, MsgTimeoutOnClose, MsgTimeoutOnCloseSDKType, MsgAcknowledgement, MsgAcknowledgementSDKType } from "./tx.js"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/ibc.core.channel.v1.MsgChannelOpenInit", MsgChannelOpenInit], ["/ibc.core.channel.v1.MsgChannelOpenTry", MsgChannelOpenTry], ["/ibc.core.channel.v1.MsgChannelOpenAck", MsgChannelOpenAck], ["/ibc.core.channel.v1.MsgChannelOpenConfirm", MsgChannelOpenConfirm], ["/ibc.core.channel.v1.MsgChannelCloseInit", MsgChannelCloseInit], ["/ibc.core.channel.v1.MsgChannelCloseConfirm", MsgChannelCloseConfirm], ["/ibc.core.channel.v1.MsgRecvPacket", MsgRecvPacket], ["/ibc.core.channel.v1.MsgTimeout", MsgTimeout], ["/ibc.core.channel.v1.MsgTimeoutOnClose", MsgTimeoutOnClose], ["/ibc.core.channel.v1.MsgAcknowledgement", MsgAcknowledgement]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/ibc.core.channel.v1.MsgChannelOpenInit", MsgChannelOpenInit], ["/ibc.core.channel.v1.MsgChannelOpenTry", MsgChannelOpenTry], ["/ibc.core.channel.v1.MsgChannelOpenAck", MsgChannelOpenAck], ["/ibc.core.channel.v1.MsgChannelOpenConfirm", MsgChannelOpenConfirm], ["/ibc.core.channel.v1.MsgChannelCloseInit", MsgChannelCloseInit], ["/ibc.core.channel.v1.MsgChannelCloseConfirm", MsgChannelCloseConfirm], ["/ibc.core.channel.v1.MsgRecvPacket", MsgRecvPacket], ["/ibc.core.channel.v1.MsgTimeout", MsgTimeout], ["/ibc.core.channel.v1.MsgTimeoutOnClose", MsgTimeoutOnClose], ["/ibc.core.channel.v1.MsgAcknowledgement", MsgAcknowledgement]]; export const MessageComposer = { encoded: { channelOpenInit(value: MsgChannelOpenInit) { diff --git a/__fixtures__/v-next/outputv4/ibc/core/channel/v1/tx.rpc.func.ts b/__fixtures__/v-next/outputv4/ibc/core/channel/v1/tx.rpc.func.ts new file mode 100644 index 0000000000..c6c152942f --- /dev/null +++ b/__fixtures__/v-next/outputv4/ibc/core/channel/v1/tx.rpc.func.ts @@ -0,0 +1,95 @@ +import { Channel, ChannelSDKType, Packet, PacketSDKType } from "./channel.js"; +import { Height, HeightSDKType } from "../../client/v1/client.js"; +import { buildTx } from "../../../../helper-func-types.js"; +import { MsgChannelOpenInit, MsgChannelOpenInitSDKType, MsgChannelOpenInitResponse, MsgChannelOpenInitResponseSDKType, MsgChannelOpenTry, MsgChannelOpenTrySDKType, MsgChannelOpenTryResponse, MsgChannelOpenTryResponseSDKType, MsgChannelOpenAck, MsgChannelOpenAckSDKType, MsgChannelOpenAckResponse, MsgChannelOpenAckResponseSDKType, MsgChannelOpenConfirm, MsgChannelOpenConfirmSDKType, MsgChannelOpenConfirmResponse, MsgChannelOpenConfirmResponseSDKType, MsgChannelCloseInit, MsgChannelCloseInitSDKType, MsgChannelCloseInitResponse, MsgChannelCloseInitResponseSDKType, MsgChannelCloseConfirm, MsgChannelCloseConfirmSDKType, MsgChannelCloseConfirmResponse, MsgChannelCloseConfirmResponseSDKType, MsgRecvPacket, MsgRecvPacketSDKType, MsgRecvPacketResponse, MsgRecvPacketResponseSDKType, MsgTimeout, MsgTimeoutSDKType, MsgTimeoutResponse, MsgTimeoutResponseSDKType, MsgTimeoutOnClose, MsgTimeoutOnCloseSDKType, MsgTimeoutOnCloseResponse, MsgTimeoutOnCloseResponseSDKType, MsgAcknowledgement, MsgAcknowledgementSDKType, MsgAcknowledgementResponse, MsgAcknowledgementResponseSDKType } from "./tx.js"; +/** + * ChannelOpenInit defines a rpc handler method for MsgChannelOpenInit. + * @name channelOpenInit + * @package ibc.core.channel.v1 + * @see proto service: ibc.core.channel.v1.ChannelOpenInit + */ +export const channelOpenInit = buildTx({ + msg: MsgChannelOpenInit +}); +/** + * ChannelOpenTry defines a rpc handler method for MsgChannelOpenTry. + * @name channelOpenTry + * @package ibc.core.channel.v1 + * @see proto service: ibc.core.channel.v1.ChannelOpenTry + */ +export const channelOpenTry = buildTx({ + msg: MsgChannelOpenTry +}); +/** + * ChannelOpenAck defines a rpc handler method for MsgChannelOpenAck. + * @name channelOpenAck + * @package ibc.core.channel.v1 + * @see proto service: ibc.core.channel.v1.ChannelOpenAck + */ +export const channelOpenAck = buildTx({ + msg: MsgChannelOpenAck +}); +/** + * ChannelOpenConfirm defines a rpc handler method for MsgChannelOpenConfirm. + * @name channelOpenConfirm + * @package ibc.core.channel.v1 + * @see proto service: ibc.core.channel.v1.ChannelOpenConfirm + */ +export const channelOpenConfirm = buildTx({ + msg: MsgChannelOpenConfirm +}); +/** + * ChannelCloseInit defines a rpc handler method for MsgChannelCloseInit. + * @name channelCloseInit + * @package ibc.core.channel.v1 + * @see proto service: ibc.core.channel.v1.ChannelCloseInit + */ +export const channelCloseInit = buildTx({ + msg: MsgChannelCloseInit +}); +/** + * ChannelCloseConfirm defines a rpc handler method for + * MsgChannelCloseConfirm. + * @name channelCloseConfirm + * @package ibc.core.channel.v1 + * @see proto service: ibc.core.channel.v1.ChannelCloseConfirm + */ +export const channelCloseConfirm = buildTx({ + msg: MsgChannelCloseConfirm +}); +/** + * RecvPacket defines a rpc handler method for MsgRecvPacket. + * @name recvPacket + * @package ibc.core.channel.v1 + * @see proto service: ibc.core.channel.v1.RecvPacket + */ +export const recvPacket = buildTx({ + msg: MsgRecvPacket +}); +/** + * Timeout defines a rpc handler method for MsgTimeout. + * @name timeout + * @package ibc.core.channel.v1 + * @see proto service: ibc.core.channel.v1.Timeout + */ +export const timeout = buildTx({ + msg: MsgTimeout +}); +/** + * TimeoutOnClose defines a rpc handler method for MsgTimeoutOnClose. + * @name timeoutOnClose + * @package ibc.core.channel.v1 + * @see proto service: ibc.core.channel.v1.TimeoutOnClose + */ +export const timeoutOnClose = buildTx({ + msg: MsgTimeoutOnClose +}); +/** + * Acknowledgement defines a rpc handler method for MsgAcknowledgement. + * @name acknowledgement + * @package ibc.core.channel.v1 + * @see proto service: ibc.core.channel.v1.Acknowledgement + */ +export const acknowledgement = buildTx({ + msg: MsgAcknowledgement +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/ibc/core/channel/v1/tx.rpc.msg.ts b/__fixtures__/v-next/outputv4/ibc/core/channel/v1/tx.rpc.msg.ts index 34a59be53f..27d2d37bf4 100644 --- a/__fixtures__/v-next/outputv4/ibc/core/channel/v1/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputv4/ibc/core/channel/v1/tx.rpc.msg.ts @@ -1,6 +1,6 @@ import { Channel, ChannelSDKType, Packet, PacketSDKType } from "./channel.js"; import { Height, HeightSDKType } from "../../client/v1/client.js"; -import { Rpc } from "../../../../helpers.js"; +import { TxRpc } from "../../../../types.js"; import { BinaryReader } from "../../../../binary.js"; import { MsgChannelOpenInit, MsgChannelOpenInitSDKType, MsgChannelOpenInitResponse, MsgChannelOpenInitResponseSDKType, MsgChannelOpenTry, MsgChannelOpenTrySDKType, MsgChannelOpenTryResponse, MsgChannelOpenTryResponseSDKType, MsgChannelOpenAck, MsgChannelOpenAckSDKType, MsgChannelOpenAckResponse, MsgChannelOpenAckResponseSDKType, MsgChannelOpenConfirm, MsgChannelOpenConfirmSDKType, MsgChannelOpenConfirmResponse, MsgChannelOpenConfirmResponseSDKType, MsgChannelCloseInit, MsgChannelCloseInitSDKType, MsgChannelCloseInitResponse, MsgChannelCloseInitResponseSDKType, MsgChannelCloseConfirm, MsgChannelCloseConfirmSDKType, MsgChannelCloseConfirmResponse, MsgChannelCloseConfirmResponseSDKType, MsgRecvPacket, MsgRecvPacketSDKType, MsgRecvPacketResponse, MsgRecvPacketResponseSDKType, MsgTimeout, MsgTimeoutSDKType, MsgTimeoutResponse, MsgTimeoutResponseSDKType, MsgTimeoutOnClose, MsgTimeoutOnCloseSDKType, MsgTimeoutOnCloseResponse, MsgTimeoutOnCloseResponseSDKType, MsgAcknowledgement, MsgAcknowledgementSDKType, MsgAcknowledgementResponse, MsgAcknowledgementResponseSDKType } from "./tx.js"; /** Msg defines the ibc/channel Msg service. */ @@ -30,8 +30,8 @@ export interface Msg { acknowledgement(request: MsgAcknowledgement): Promise; } export class MsgClientImpl implements Msg { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.channelOpenInit = this.channelOpenInit.bind(this); this.channelOpenTry = this.channelOpenTry.bind(this); @@ -95,6 +95,6 @@ export class MsgClientImpl implements Msg { return promise.then(data => MsgAcknowledgementResponse.decode(new BinaryReader(data))); } } -export const createClientImpl = (rpc: Rpc) => { +export const createClientImpl = (rpc: TxRpc) => { return new MsgClientImpl(rpc); }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/ibc/core/client/v1/query.rpc.Query.ts b/__fixtures__/v-next/outputv4/ibc/core/client/v1/query.rpc.Query.ts index 56430ae5a5..f149699318 100644 --- a/__fixtures__/v-next/outputv4/ibc/core/client/v1/query.rpc.Query.ts +++ b/__fixtures__/v-next/outputv4/ibc/core/client/v1/query.rpc.Query.ts @@ -1,7 +1,7 @@ import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../../cosmos/base/query/v1beta1/pagination.js"; import { Any, AnySDKType } from "../../../../google/protobuf/any.js"; import { Height, HeightSDKType, IdentifiedClientState, IdentifiedClientStateSDKType, ConsensusStateWithHeight, ConsensusStateWithHeightSDKType, Params, ParamsSDKType } from "./client.js"; -import { Rpc } from "../../../../helpers.js"; +import { TxRpc } from "../../../../types.js"; import { BinaryReader } from "../../../../binary.js"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; import { QueryClientStateRequest, QueryClientStateRequestSDKType, QueryClientStateResponse, QueryClientStateResponseSDKType, QueryClientStatesRequest, QueryClientStatesRequestSDKType, QueryClientStatesResponse, QueryClientStatesResponseSDKType, QueryConsensusStateRequest, QueryConsensusStateRequestSDKType, QueryConsensusStateResponse, QueryConsensusStateResponseSDKType, QueryConsensusStatesRequest, QueryConsensusStatesRequestSDKType, QueryConsensusStatesResponse, QueryConsensusStatesResponseSDKType, QueryClientStatusRequest, QueryClientStatusRequestSDKType, QueryClientStatusResponse, QueryClientStatusResponseSDKType, QueryClientParamsRequest, QueryClientParamsRequestSDKType, QueryClientParamsResponse, QueryClientParamsResponseSDKType, QueryUpgradedClientStateRequest, QueryUpgradedClientStateRequestSDKType, QueryUpgradedClientStateResponse, QueryUpgradedClientStateResponseSDKType, QueryUpgradedConsensusStateRequest, QueryUpgradedConsensusStateRequestSDKType, QueryUpgradedConsensusStateResponse, QueryUpgradedConsensusStateResponseSDKType } from "./query.js"; @@ -31,8 +31,8 @@ export interface Query { upgradedConsensusState(request?: QueryUpgradedConsensusStateRequest): Promise; } export class QueryClientImpl implements Query { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.clientState = this.clientState.bind(this); this.clientStates = this.clientStates.bind(this); diff --git a/__fixtures__/v-next/outputv4/ibc/core/client/v1/query.rpc.func.ts b/__fixtures__/v-next/outputv4/ibc/core/client/v1/query.rpc.func.ts new file mode 100644 index 0000000000..8e3087f6ff --- /dev/null +++ b/__fixtures__/v-next/outputv4/ibc/core/client/v1/query.rpc.func.ts @@ -0,0 +1,103 @@ +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../../cosmos/base/query/v1beta1/pagination.js"; +import { Any, AnySDKType } from "../../../../google/protobuf/any.js"; +import { Height, HeightSDKType, IdentifiedClientState, IdentifiedClientStateSDKType, ConsensusStateWithHeight, ConsensusStateWithHeightSDKType, Params, ParamsSDKType } from "./client.js"; +import { EndpointOrRpc, buildQuery } from "../../../../helper-func-types.js"; +import { QueryClientStateRequest, QueryClientStateRequestSDKType, QueryClientStateResponse, QueryClientStateResponseSDKType, QueryClientStatesRequest, QueryClientStatesRequestSDKType, QueryClientStatesResponse, QueryClientStatesResponseSDKType, QueryConsensusStateRequest, QueryConsensusStateRequestSDKType, QueryConsensusStateResponse, QueryConsensusStateResponseSDKType, QueryConsensusStatesRequest, QueryConsensusStatesRequestSDKType, QueryConsensusStatesResponse, QueryConsensusStatesResponseSDKType, QueryClientStatusRequest, QueryClientStatusRequestSDKType, QueryClientStatusResponse, QueryClientStatusResponseSDKType, QueryClientParamsRequest, QueryClientParamsRequestSDKType, QueryClientParamsResponse, QueryClientParamsResponseSDKType, QueryUpgradedClientStateRequest, QueryUpgradedClientStateRequestSDKType, QueryUpgradedClientStateResponse, QueryUpgradedClientStateResponseSDKType, QueryUpgradedConsensusStateRequest, QueryUpgradedConsensusStateRequestSDKType, QueryUpgradedConsensusStateResponse, QueryUpgradedConsensusStateResponseSDKType } from "./query.js"; +/** + * ClientState queries an IBC light client. + * @name getClientState + * @package ibc.core.client.v1 + * @see proto service: ibc.core.client.v1.ClientState + */ +export const getClientState = buildQuery({ + encode: QueryClientStateRequest.encode, + decode: QueryClientStateResponse.decode, + service: "ibc.core.client.v1.Query", + method: "ClientState" +}); +/** + * ClientStates queries all the IBC light clients of a chain. + * @name getClientStates + * @package ibc.core.client.v1 + * @see proto service: ibc.core.client.v1.ClientStates + */ +export const getClientStates = buildQuery({ + encode: QueryClientStatesRequest.encode, + decode: QueryClientStatesResponse.decode, + service: "ibc.core.client.v1.Query", + method: "ClientStates" +}); +/** + * ConsensusState queries a consensus state associated with a client state at + * a given height. + * @name getConsensusState + * @package ibc.core.client.v1 + * @see proto service: ibc.core.client.v1.ConsensusState + */ +export const getConsensusState = buildQuery({ + encode: QueryConsensusStateRequest.encode, + decode: QueryConsensusStateResponse.decode, + service: "ibc.core.client.v1.Query", + method: "ConsensusState" +}); +/** + * ConsensusStates queries all the consensus state associated with a given + * client. + * @name getConsensusStates + * @package ibc.core.client.v1 + * @see proto service: ibc.core.client.v1.ConsensusStates + */ +export const getConsensusStates = buildQuery({ + encode: QueryConsensusStatesRequest.encode, + decode: QueryConsensusStatesResponse.decode, + service: "ibc.core.client.v1.Query", + method: "ConsensusStates" +}); +/** + * Status queries the status of an IBC client. + * @name getClientStatus + * @package ibc.core.client.v1 + * @see proto service: ibc.core.client.v1.ClientStatus + */ +export const getClientStatus = buildQuery({ + encode: QueryClientStatusRequest.encode, + decode: QueryClientStatusResponse.decode, + service: "ibc.core.client.v1.Query", + method: "ClientStatus" +}); +/** + * ClientParams queries all parameters of the ibc client. + * @name getClientParams + * @package ibc.core.client.v1 + * @see proto service: ibc.core.client.v1.ClientParams + */ +export const getClientParams = buildQuery({ + encode: QueryClientParamsRequest.encode, + decode: QueryClientParamsResponse.decode, + service: "ibc.core.client.v1.Query", + method: "ClientParams" +}); +/** + * UpgradedClientState queries an Upgraded IBC light client. + * @name getUpgradedClientState + * @package ibc.core.client.v1 + * @see proto service: ibc.core.client.v1.UpgradedClientState + */ +export const getUpgradedClientState = buildQuery({ + encode: QueryUpgradedClientStateRequest.encode, + decode: QueryUpgradedClientStateResponse.decode, + service: "ibc.core.client.v1.Query", + method: "UpgradedClientState" +}); +/** + * UpgradedConsensusState queries an Upgraded IBC consensus state. + * @name getUpgradedConsensusState + * @package ibc.core.client.v1 + * @see proto service: ibc.core.client.v1.UpgradedConsensusState + */ +export const getUpgradedConsensusState = buildQuery({ + encode: QueryUpgradedConsensusStateRequest.encode, + decode: QueryUpgradedConsensusStateResponse.decode, + service: "ibc.core.client.v1.Query", + method: "UpgradedConsensusState" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/ibc/core/client/v1/tx.registry.ts b/__fixtures__/v-next/outputv4/ibc/core/client/v1/tx.registry.ts index c459f0a06c..8a6d6ffc96 100644 --- a/__fixtures__/v-next/outputv4/ibc/core/client/v1/tx.registry.ts +++ b/__fixtures__/v-next/outputv4/ibc/core/client/v1/tx.registry.ts @@ -1,12 +1,7 @@ import { Any, AnySDKType } from "../../../../google/protobuf/any.js"; -import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { TelescopeGeneratedType } from "../../../../types.js"; import { MsgCreateClient, MsgCreateClientSDKType, MsgUpdateClient, MsgUpdateClientSDKType, MsgUpgradeClient, MsgUpgradeClientSDKType, MsgSubmitMisbehaviour, MsgSubmitMisbehaviourSDKType } from "./tx.js"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/ibc.core.client.v1.MsgCreateClient", MsgCreateClient], ["/ibc.core.client.v1.MsgUpdateClient", MsgUpdateClient], ["/ibc.core.client.v1.MsgUpgradeClient", MsgUpgradeClient], ["/ibc.core.client.v1.MsgSubmitMisbehaviour", MsgSubmitMisbehaviour]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/ibc.core.client.v1.MsgCreateClient", MsgCreateClient], ["/ibc.core.client.v1.MsgUpdateClient", MsgUpdateClient], ["/ibc.core.client.v1.MsgUpgradeClient", MsgUpgradeClient], ["/ibc.core.client.v1.MsgSubmitMisbehaviour", MsgSubmitMisbehaviour]]; export const MessageComposer = { encoded: { createClient(value: MsgCreateClient) { diff --git a/__fixtures__/v-next/outputv4/ibc/core/client/v1/tx.rpc.func.ts b/__fixtures__/v-next/outputv4/ibc/core/client/v1/tx.rpc.func.ts new file mode 100644 index 0000000000..f4aa0fb91b --- /dev/null +++ b/__fixtures__/v-next/outputv4/ibc/core/client/v1/tx.rpc.func.ts @@ -0,0 +1,39 @@ +import { Any, AnySDKType } from "../../../../google/protobuf/any.js"; +import { buildTx } from "../../../../helper-func-types.js"; +import { MsgCreateClient, MsgCreateClientSDKType, MsgCreateClientResponse, MsgCreateClientResponseSDKType, MsgUpdateClient, MsgUpdateClientSDKType, MsgUpdateClientResponse, MsgUpdateClientResponseSDKType, MsgUpgradeClient, MsgUpgradeClientSDKType, MsgUpgradeClientResponse, MsgUpgradeClientResponseSDKType, MsgSubmitMisbehaviour, MsgSubmitMisbehaviourSDKType, MsgSubmitMisbehaviourResponse, MsgSubmitMisbehaviourResponseSDKType } from "./tx.js"; +/** + * CreateClient defines a rpc handler method for MsgCreateClient. + * @name createClient + * @package ibc.core.client.v1 + * @see proto service: ibc.core.client.v1.CreateClient + */ +export const createClient = buildTx({ + msg: MsgCreateClient +}); +/** + * UpdateClient defines a rpc handler method for MsgUpdateClient. + * @name updateClient + * @package ibc.core.client.v1 + * @see proto service: ibc.core.client.v1.UpdateClient + */ +export const updateClient = buildTx({ + msg: MsgUpdateClient +}); +/** + * UpgradeClient defines a rpc handler method for MsgUpgradeClient. + * @name upgradeClient + * @package ibc.core.client.v1 + * @see proto service: ibc.core.client.v1.UpgradeClient + */ +export const upgradeClient = buildTx({ + msg: MsgUpgradeClient +}); +/** + * SubmitMisbehaviour defines a rpc handler method for MsgSubmitMisbehaviour. + * @name submitMisbehaviour + * @package ibc.core.client.v1 + * @see proto service: ibc.core.client.v1.SubmitMisbehaviour + */ +export const submitMisbehaviour = buildTx({ + msg: MsgSubmitMisbehaviour +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/ibc/core/client/v1/tx.rpc.msg.ts b/__fixtures__/v-next/outputv4/ibc/core/client/v1/tx.rpc.msg.ts index ba3bc78b09..482638ee89 100644 --- a/__fixtures__/v-next/outputv4/ibc/core/client/v1/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputv4/ibc/core/client/v1/tx.rpc.msg.ts @@ -1,5 +1,5 @@ import { Any, AnySDKType } from "../../../../google/protobuf/any.js"; -import { Rpc } from "../../../../helpers.js"; +import { TxRpc } from "../../../../types.js"; import { BinaryReader } from "../../../../binary.js"; import { MsgCreateClient, MsgCreateClientSDKType, MsgCreateClientResponse, MsgCreateClientResponseSDKType, MsgUpdateClient, MsgUpdateClientSDKType, MsgUpdateClientResponse, MsgUpdateClientResponseSDKType, MsgUpgradeClient, MsgUpgradeClientSDKType, MsgUpgradeClientResponse, MsgUpgradeClientResponseSDKType, MsgSubmitMisbehaviour, MsgSubmitMisbehaviourSDKType, MsgSubmitMisbehaviourResponse, MsgSubmitMisbehaviourResponseSDKType } from "./tx.js"; /** Msg defines the ibc/client Msg service. */ @@ -14,8 +14,8 @@ export interface Msg { submitMisbehaviour(request: MsgSubmitMisbehaviour): Promise; } export class MsgClientImpl implements Msg { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.createClient = this.createClient.bind(this); this.updateClient = this.updateClient.bind(this); @@ -43,6 +43,6 @@ export class MsgClientImpl implements Msg { return promise.then(data => MsgSubmitMisbehaviourResponse.decode(new BinaryReader(data))); } } -export const createClientImpl = (rpc: Rpc) => { +export const createClientImpl = (rpc: TxRpc) => { return new MsgClientImpl(rpc); }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/ibc/core/connection/v1/query.rpc.Query.ts b/__fixtures__/v-next/outputv4/ibc/core/connection/v1/query.rpc.Query.ts index 7a925539b4..78741c0bbd 100644 --- a/__fixtures__/v-next/outputv4/ibc/core/connection/v1/query.rpc.Query.ts +++ b/__fixtures__/v-next/outputv4/ibc/core/connection/v1/query.rpc.Query.ts @@ -2,7 +2,7 @@ import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } fr import { ConnectionEnd, ConnectionEndSDKType, IdentifiedConnection, IdentifiedConnectionSDKType } from "./connection.js"; import { Height, HeightSDKType, IdentifiedClientState, IdentifiedClientStateSDKType } from "../../client/v1/client.js"; import { Any, AnySDKType } from "../../../../google/protobuf/any.js"; -import { Rpc } from "../../../../helpers.js"; +import { TxRpc } from "../../../../types.js"; import { BinaryReader } from "../../../../binary.js"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; import { QueryConnectionRequest, QueryConnectionRequestSDKType, QueryConnectionResponse, QueryConnectionResponseSDKType, QueryConnectionsRequest, QueryConnectionsRequestSDKType, QueryConnectionsResponse, QueryConnectionsResponseSDKType, QueryClientConnectionsRequest, QueryClientConnectionsRequestSDKType, QueryClientConnectionsResponse, QueryClientConnectionsResponseSDKType, QueryConnectionClientStateRequest, QueryConnectionClientStateRequestSDKType, QueryConnectionClientStateResponse, QueryConnectionClientStateResponseSDKType, QueryConnectionConsensusStateRequest, QueryConnectionConsensusStateRequestSDKType, QueryConnectionConsensusStateResponse, QueryConnectionConsensusStateResponseSDKType } from "./query.js"; @@ -29,8 +29,8 @@ export interface Query { connectionConsensusState(request: QueryConnectionConsensusStateRequest): Promise; } export class QueryClientImpl implements Query { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.connection = this.connection.bind(this); this.connections = this.connections.bind(this); diff --git a/__fixtures__/v-next/outputv4/ibc/core/connection/v1/query.rpc.func.ts b/__fixtures__/v-next/outputv4/ibc/core/connection/v1/query.rpc.func.ts new file mode 100644 index 0000000000..ccf84ce9a6 --- /dev/null +++ b/__fixtures__/v-next/outputv4/ibc/core/connection/v1/query.rpc.func.ts @@ -0,0 +1,69 @@ +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../../cosmos/base/query/v1beta1/pagination.js"; +import { ConnectionEnd, ConnectionEndSDKType, IdentifiedConnection, IdentifiedConnectionSDKType } from "./connection.js"; +import { Height, HeightSDKType, IdentifiedClientState, IdentifiedClientStateSDKType } from "../../client/v1/client.js"; +import { Any, AnySDKType } from "../../../../google/protobuf/any.js"; +import { EndpointOrRpc, buildQuery } from "../../../../helper-func-types.js"; +import { QueryConnectionRequest, QueryConnectionRequestSDKType, QueryConnectionResponse, QueryConnectionResponseSDKType, QueryConnectionsRequest, QueryConnectionsRequestSDKType, QueryConnectionsResponse, QueryConnectionsResponseSDKType, QueryClientConnectionsRequest, QueryClientConnectionsRequestSDKType, QueryClientConnectionsResponse, QueryClientConnectionsResponseSDKType, QueryConnectionClientStateRequest, QueryConnectionClientStateRequestSDKType, QueryConnectionClientStateResponse, QueryConnectionClientStateResponseSDKType, QueryConnectionConsensusStateRequest, QueryConnectionConsensusStateRequestSDKType, QueryConnectionConsensusStateResponse, QueryConnectionConsensusStateResponseSDKType } from "./query.js"; +/** + * Connection queries an IBC connection end. + * @name getConnection + * @package ibc.core.connection.v1 + * @see proto service: ibc.core.connection.v1.Connection + */ +export const getConnection = buildQuery({ + encode: QueryConnectionRequest.encode, + decode: QueryConnectionResponse.decode, + service: "ibc.core.connection.v1.Query", + method: "Connection" +}); +/** + * Connections queries all the IBC connections of a chain. + * @name getConnections + * @package ibc.core.connection.v1 + * @see proto service: ibc.core.connection.v1.Connections + */ +export const getConnections = buildQuery({ + encode: QueryConnectionsRequest.encode, + decode: QueryConnectionsResponse.decode, + service: "ibc.core.connection.v1.Query", + method: "Connections" +}); +/** + * ClientConnections queries the connection paths associated with a client + * state. + * @name getClientConnections + * @package ibc.core.connection.v1 + * @see proto service: ibc.core.connection.v1.ClientConnections + */ +export const getClientConnections = buildQuery({ + encode: QueryClientConnectionsRequest.encode, + decode: QueryClientConnectionsResponse.decode, + service: "ibc.core.connection.v1.Query", + method: "ClientConnections" +}); +/** + * ConnectionClientState queries the client state associated with the + * connection. + * @name getConnectionClientState + * @package ibc.core.connection.v1 + * @see proto service: ibc.core.connection.v1.ConnectionClientState + */ +export const getConnectionClientState = buildQuery({ + encode: QueryConnectionClientStateRequest.encode, + decode: QueryConnectionClientStateResponse.decode, + service: "ibc.core.connection.v1.Query", + method: "ConnectionClientState" +}); +/** + * ConnectionConsensusState queries the consensus state associated with the + * connection. + * @name getConnectionConsensusState + * @package ibc.core.connection.v1 + * @see proto service: ibc.core.connection.v1.ConnectionConsensusState + */ +export const getConnectionConsensusState = buildQuery({ + encode: QueryConnectionConsensusStateRequest.encode, + decode: QueryConnectionConsensusStateResponse.decode, + service: "ibc.core.connection.v1.Query", + method: "ConnectionConsensusState" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/ibc/core/connection/v1/tx.registry.ts b/__fixtures__/v-next/outputv4/ibc/core/connection/v1/tx.registry.ts index 1f71c96e40..70d061e36a 100644 --- a/__fixtures__/v-next/outputv4/ibc/core/connection/v1/tx.registry.ts +++ b/__fixtures__/v-next/outputv4/ibc/core/connection/v1/tx.registry.ts @@ -1,14 +1,9 @@ import { Counterparty, CounterpartySDKType, Version, VersionSDKType } from "./connection.js"; import { Any, AnySDKType } from "../../../../google/protobuf/any.js"; import { Height, HeightSDKType } from "../../client/v1/client.js"; -import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { TelescopeGeneratedType } from "../../../../types.js"; import { MsgConnectionOpenInit, MsgConnectionOpenInitSDKType, MsgConnectionOpenTry, MsgConnectionOpenTrySDKType, MsgConnectionOpenAck, MsgConnectionOpenAckSDKType, MsgConnectionOpenConfirm, MsgConnectionOpenConfirmSDKType } from "./tx.js"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/ibc.core.connection.v1.MsgConnectionOpenInit", MsgConnectionOpenInit], ["/ibc.core.connection.v1.MsgConnectionOpenTry", MsgConnectionOpenTry], ["/ibc.core.connection.v1.MsgConnectionOpenAck", MsgConnectionOpenAck], ["/ibc.core.connection.v1.MsgConnectionOpenConfirm", MsgConnectionOpenConfirm]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/ibc.core.connection.v1.MsgConnectionOpenInit", MsgConnectionOpenInit], ["/ibc.core.connection.v1.MsgConnectionOpenTry", MsgConnectionOpenTry], ["/ibc.core.connection.v1.MsgConnectionOpenAck", MsgConnectionOpenAck], ["/ibc.core.connection.v1.MsgConnectionOpenConfirm", MsgConnectionOpenConfirm]]; export const MessageComposer = { encoded: { connectionOpenInit(value: MsgConnectionOpenInit) { diff --git a/__fixtures__/v-next/outputv4/ibc/core/connection/v1/tx.rpc.func.ts b/__fixtures__/v-next/outputv4/ibc/core/connection/v1/tx.rpc.func.ts new file mode 100644 index 0000000000..06b49f5d9e --- /dev/null +++ b/__fixtures__/v-next/outputv4/ibc/core/connection/v1/tx.rpc.func.ts @@ -0,0 +1,42 @@ +import { Counterparty, CounterpartySDKType, Version, VersionSDKType } from "./connection.js"; +import { Any, AnySDKType } from "../../../../google/protobuf/any.js"; +import { Height, HeightSDKType } from "../../client/v1/client.js"; +import { buildTx } from "../../../../helper-func-types.js"; +import { MsgConnectionOpenInit, MsgConnectionOpenInitSDKType, MsgConnectionOpenInitResponse, MsgConnectionOpenInitResponseSDKType, MsgConnectionOpenTry, MsgConnectionOpenTrySDKType, MsgConnectionOpenTryResponse, MsgConnectionOpenTryResponseSDKType, MsgConnectionOpenAck, MsgConnectionOpenAckSDKType, MsgConnectionOpenAckResponse, MsgConnectionOpenAckResponseSDKType, MsgConnectionOpenConfirm, MsgConnectionOpenConfirmSDKType, MsgConnectionOpenConfirmResponse, MsgConnectionOpenConfirmResponseSDKType } from "./tx.js"; +/** + * ConnectionOpenInit defines a rpc handler method for MsgConnectionOpenInit. + * @name connectionOpenInit + * @package ibc.core.connection.v1 + * @see proto service: ibc.core.connection.v1.ConnectionOpenInit + */ +export const connectionOpenInit = buildTx({ + msg: MsgConnectionOpenInit +}); +/** + * ConnectionOpenTry defines a rpc handler method for MsgConnectionOpenTry. + * @name connectionOpenTry + * @package ibc.core.connection.v1 + * @see proto service: ibc.core.connection.v1.ConnectionOpenTry + */ +export const connectionOpenTry = buildTx({ + msg: MsgConnectionOpenTry +}); +/** + * ConnectionOpenAck defines a rpc handler method for MsgConnectionOpenAck. + * @name connectionOpenAck + * @package ibc.core.connection.v1 + * @see proto service: ibc.core.connection.v1.ConnectionOpenAck + */ +export const connectionOpenAck = buildTx({ + msg: MsgConnectionOpenAck +}); +/** + * ConnectionOpenConfirm defines a rpc handler method for + * MsgConnectionOpenConfirm. + * @name connectionOpenConfirm + * @package ibc.core.connection.v1 + * @see proto service: ibc.core.connection.v1.ConnectionOpenConfirm + */ +export const connectionOpenConfirm = buildTx({ + msg: MsgConnectionOpenConfirm +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/ibc/core/connection/v1/tx.rpc.msg.ts b/__fixtures__/v-next/outputv4/ibc/core/connection/v1/tx.rpc.msg.ts index 68bdc882ff..18f039ed96 100644 --- a/__fixtures__/v-next/outputv4/ibc/core/connection/v1/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputv4/ibc/core/connection/v1/tx.rpc.msg.ts @@ -1,7 +1,7 @@ import { Counterparty, CounterpartySDKType, Version, VersionSDKType } from "./connection.js"; import { Any, AnySDKType } from "../../../../google/protobuf/any.js"; import { Height, HeightSDKType } from "../../client/v1/client.js"; -import { Rpc } from "../../../../helpers.js"; +import { TxRpc } from "../../../../types.js"; import { BinaryReader } from "../../../../binary.js"; import { MsgConnectionOpenInit, MsgConnectionOpenInitSDKType, MsgConnectionOpenInitResponse, MsgConnectionOpenInitResponseSDKType, MsgConnectionOpenTry, MsgConnectionOpenTrySDKType, MsgConnectionOpenTryResponse, MsgConnectionOpenTryResponseSDKType, MsgConnectionOpenAck, MsgConnectionOpenAckSDKType, MsgConnectionOpenAckResponse, MsgConnectionOpenAckResponseSDKType, MsgConnectionOpenConfirm, MsgConnectionOpenConfirmSDKType, MsgConnectionOpenConfirmResponse, MsgConnectionOpenConfirmResponseSDKType } from "./tx.js"; /** Msg defines the ibc/connection Msg service. */ @@ -19,8 +19,8 @@ export interface Msg { connectionOpenConfirm(request: MsgConnectionOpenConfirm): Promise; } export class MsgClientImpl implements Msg { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.connectionOpenInit = this.connectionOpenInit.bind(this); this.connectionOpenTry = this.connectionOpenTry.bind(this); @@ -48,6 +48,6 @@ export class MsgClientImpl implements Msg { return promise.then(data => MsgConnectionOpenConfirmResponse.decode(new BinaryReader(data))); } } -export const createClientImpl = (rpc: Rpc) => { +export const createClientImpl = (rpc: TxRpc) => { return new MsgClientImpl(rpc); }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/ibc/core/port/v1/query.rpc.Query.ts b/__fixtures__/v-next/outputv4/ibc/core/port/v1/query.rpc.Query.ts index 31f4b61e2b..010d5df407 100644 --- a/__fixtures__/v-next/outputv4/ibc/core/port/v1/query.rpc.Query.ts +++ b/__fixtures__/v-next/outputv4/ibc/core/port/v1/query.rpc.Query.ts @@ -1,5 +1,5 @@ import { Order, OrderSDKType, Counterparty, CounterpartySDKType } from "../../channel/v1/channel.js"; -import { Rpc } from "../../../../helpers.js"; +import { TxRpc } from "../../../../types.js"; import { BinaryReader } from "../../../../binary.js"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; import { QueryAppVersionRequest, QueryAppVersionRequestSDKType, QueryAppVersionResponse, QueryAppVersionResponseSDKType } from "./query.js"; @@ -9,8 +9,8 @@ export interface Query { appVersion(request: QueryAppVersionRequest): Promise; } export class QueryClientImpl implements Query { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.appVersion = this.appVersion.bind(this); } diff --git a/__fixtures__/v-next/outputv4/ibc/core/port/v1/query.rpc.func.ts b/__fixtures__/v-next/outputv4/ibc/core/port/v1/query.rpc.func.ts new file mode 100644 index 0000000000..42fb1d4cea --- /dev/null +++ b/__fixtures__/v-next/outputv4/ibc/core/port/v1/query.rpc.func.ts @@ -0,0 +1,15 @@ +import { Order, OrderSDKType, Counterparty, CounterpartySDKType } from "../../channel/v1/channel.js"; +import { EndpointOrRpc, buildQuery } from "../../../../helper-func-types.js"; +import { QueryAppVersionRequest, QueryAppVersionRequestSDKType, QueryAppVersionResponse, QueryAppVersionResponseSDKType } from "./query.js"; +/** + * AppVersion queries an IBC Port and determines the appropriate application version to be used + * @name getAppVersion + * @package ibc.core.port.v1 + * @see proto service: ibc.core.port.v1.AppVersion + */ +export const getAppVersion = buildQuery({ + encode: QueryAppVersionRequest.encode, + decode: QueryAppVersionResponse.decode, + service: "ibc.core.port.v1.Query", + method: "AppVersion" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/index.ts b/__fixtures__/v-next/outputv4/index.ts index 47bb843aca..334d5973be 100644 --- a/__fixtures__/v-next/outputv4/index.ts +++ b/__fixtures__/v-next/outputv4/index.ts @@ -24,6 +24,7 @@ export * from "./tendermint/bundle.js"; export * from "./hooks.js"; export * from "./mobx.stores.js"; export * from "./extern.js"; +export * from "./helper-func-types.js"; export * from "./react-query.js"; export * from "./mobx.js"; export * from "./pinia-endpoint.js"; @@ -31,4 +32,5 @@ export * from "./json-safe.js"; export * from "./varint.js"; export * from "./utf8.js"; export * from "./binary.js"; +export * from "./types.js"; export * from "./pinia.store.js"; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/osmosis/bundle.ts b/__fixtures__/v-next/outputv4/osmosis/bundle.ts index 730e500d00..6dcdde3506 100644 --- a/__fixtures__/v-next/outputv4/osmosis/bundle.ts +++ b/__fixtures__/v-next/outputv4/osmosis/bundle.ts @@ -49,59 +49,79 @@ import * as _301 from "./txfees/v1beta1/feetoken.js"; import * as _302 from "./txfees/v1beta1/genesis.js"; import * as _303 from "./txfees/v1beta1/gov.js"; import * as _304 from "./txfees/v1beta1/query.js"; -import * as _486 from "./gamm/pool-models/balancer/tx/tx.amino.js"; -import * as _487 from "./gamm/pool-models/stableswap/tx.amino.js"; -import * as _488 from "./gamm/v1beta1/tx.amino.js"; -import * as _489 from "./incentives/tx.amino.js"; -import * as _490 from "./lockup/tx.amino.js"; -import * as _491 from "./superfluid/tx.amino.js"; -import * as _492 from "./tokenfactory/v1beta1/tx.amino.js"; -import * as _493 from "./gamm/pool-models/balancer/tx/tx.registry.js"; -import * as _494 from "./gamm/pool-models/stableswap/tx.registry.js"; -import * as _495 from "./gamm/v1beta1/tx.registry.js"; -import * as _496 from "./incentives/tx.registry.js"; -import * as _497 from "./lockup/tx.registry.js"; -import * as _498 from "./superfluid/tx.registry.js"; -import * as _499 from "./tokenfactory/v1beta1/tx.registry.js"; -import * as _500 from "./claim/v1beta1/query.lcd.js"; -import * as _501 from "./epochs/query.lcd.js"; -import * as _502 from "./gamm/v1beta1/query.lcd.js"; -import * as _503 from "./gamm/v2/query.lcd.js"; -import * as _504 from "./ibc-rate-limit/v1beta1/query.lcd.js"; -import * as _505 from "./incentives/query.lcd.js"; -import * as _506 from "./lockup/query.lcd.js"; -import * as _507 from "./mint/v1beta1/query.lcd.js"; -import * as _508 from "./pool-incentives/v1beta1/query.lcd.js"; -import * as _509 from "./superfluid/query.lcd.js"; -import * as _510 from "./tokenfactory/v1beta1/query.lcd.js"; -import * as _511 from "./twap/v1beta1/query.lcd.js"; -import * as _512 from "./txfees/v1beta1/query.lcd.js"; -import * as _513 from "./claim/v1beta1/query.rpc.Query.js"; -import * as _514 from "./epochs/query.rpc.Query.js"; -import * as _515 from "./gamm/v1beta1/query.rpc.Query.js"; -import * as _516 from "./gamm/v2/query.rpc.Query.js"; -import * as _517 from "./ibc-rate-limit/v1beta1/query.rpc.Query.js"; -import * as _518 from "./incentives/query.rpc.Query.js"; -import * as _519 from "./lockup/query.rpc.Query.js"; -import * as _520 from "./mint/v1beta1/query.rpc.Query.js"; -import * as _521 from "./pool-incentives/v1beta1/query.rpc.Query.js"; -import * as _522 from "./superfluid/query.rpc.Query.js"; -import * as _523 from "./tokenfactory/v1beta1/query.rpc.Query.js"; -import * as _524 from "./twap/v1beta1/query.rpc.Query.js"; -import * as _525 from "./txfees/v1beta1/query.rpc.Query.js"; -import * as _526 from "./gamm/pool-models/balancer/tx/tx.rpc.msg.js"; -import * as _527 from "./gamm/pool-models/stableswap/tx.rpc.msg.js"; -import * as _528 from "./gamm/v1beta1/tx.rpc.msg.js"; -import * as _529 from "./incentives/tx.rpc.msg.js"; -import * as _530 from "./lockup/tx.rpc.msg.js"; -import * as _531 from "./superfluid/tx.rpc.msg.js"; -import * as _532 from "./tokenfactory/v1beta1/tx.rpc.msg.js"; -import * as _533 from "./gamm/v1beta1/query.pinia.store.js"; -import * as _534 from "./gamm/v2/query.pinia.store.js"; -import * as _556 from "./lcd.js"; -import * as _557 from "./custom-lcd-client.js"; -import * as _558 from "./rpc.query.js"; -import * as _559 from "./rpc.tx.js"; +import * as _558 from "./gamm/pool-models/balancer/tx/tx.amino.js"; +import * as _559 from "./gamm/pool-models/stableswap/tx.amino.js"; +import * as _560 from "./gamm/v1beta1/tx.amino.js"; +import * as _561 from "./incentives/tx.amino.js"; +import * as _562 from "./lockup/tx.amino.js"; +import * as _563 from "./superfluid/tx.amino.js"; +import * as _564 from "./tokenfactory/v1beta1/tx.amino.js"; +import * as _565 from "./gamm/pool-models/balancer/tx/tx.registry.js"; +import * as _566 from "./gamm/pool-models/stableswap/tx.registry.js"; +import * as _567 from "./gamm/v1beta1/tx.registry.js"; +import * as _568 from "./incentives/tx.registry.js"; +import * as _569 from "./lockup/tx.registry.js"; +import * as _570 from "./superfluid/tx.registry.js"; +import * as _571 from "./tokenfactory/v1beta1/tx.registry.js"; +import * as _572 from "./claim/v1beta1/query.lcd.js"; +import * as _573 from "./epochs/query.lcd.js"; +import * as _574 from "./gamm/v1beta1/query.lcd.js"; +import * as _575 from "./gamm/v2/query.lcd.js"; +import * as _576 from "./ibc-rate-limit/v1beta1/query.lcd.js"; +import * as _577 from "./incentives/query.lcd.js"; +import * as _578 from "./lockup/query.lcd.js"; +import * as _579 from "./mint/v1beta1/query.lcd.js"; +import * as _580 from "./pool-incentives/v1beta1/query.lcd.js"; +import * as _581 from "./superfluid/query.lcd.js"; +import * as _582 from "./tokenfactory/v1beta1/query.lcd.js"; +import * as _583 from "./twap/v1beta1/query.lcd.js"; +import * as _584 from "./txfees/v1beta1/query.lcd.js"; +import * as _585 from "./claim/v1beta1/query.rpc.func.js"; +import * as _586 from "./epochs/query.rpc.func.js"; +import * as _587 from "./gamm/v1beta1/query.rpc.func.js"; +import * as _588 from "./gamm/v2/query.rpc.func.js"; +import * as _589 from "./ibc-rate-limit/v1beta1/query.rpc.func.js"; +import * as _590 from "./incentives/query.rpc.func.js"; +import * as _591 from "./lockup/query.rpc.func.js"; +import * as _592 from "./mint/v1beta1/query.rpc.func.js"; +import * as _593 from "./pool-incentives/v1beta1/query.rpc.func.js"; +import * as _594 from "./superfluid/query.rpc.func.js"; +import * as _595 from "./tokenfactory/v1beta1/query.rpc.func.js"; +import * as _596 from "./twap/v1beta1/query.rpc.func.js"; +import * as _597 from "./txfees/v1beta1/query.rpc.func.js"; +import * as _598 from "./claim/v1beta1/query.rpc.Query.js"; +import * as _599 from "./epochs/query.rpc.Query.js"; +import * as _600 from "./gamm/v1beta1/query.rpc.Query.js"; +import * as _601 from "./gamm/v2/query.rpc.Query.js"; +import * as _602 from "./ibc-rate-limit/v1beta1/query.rpc.Query.js"; +import * as _603 from "./incentives/query.rpc.Query.js"; +import * as _604 from "./lockup/query.rpc.Query.js"; +import * as _605 from "./mint/v1beta1/query.rpc.Query.js"; +import * as _606 from "./pool-incentives/v1beta1/query.rpc.Query.js"; +import * as _607 from "./superfluid/query.rpc.Query.js"; +import * as _608 from "./tokenfactory/v1beta1/query.rpc.Query.js"; +import * as _609 from "./twap/v1beta1/query.rpc.Query.js"; +import * as _610 from "./txfees/v1beta1/query.rpc.Query.js"; +import * as _611 from "./gamm/pool-models/balancer/tx/tx.rpc.func.js"; +import * as _612 from "./gamm/pool-models/stableswap/tx.rpc.func.js"; +import * as _613 from "./gamm/v1beta1/tx.rpc.func.js"; +import * as _614 from "./incentives/tx.rpc.func.js"; +import * as _615 from "./lockup/tx.rpc.func.js"; +import * as _616 from "./superfluid/tx.rpc.func.js"; +import * as _617 from "./tokenfactory/v1beta1/tx.rpc.func.js"; +import * as _618 from "./gamm/pool-models/balancer/tx/tx.rpc.msg.js"; +import * as _619 from "./gamm/pool-models/stableswap/tx.rpc.msg.js"; +import * as _620 from "./gamm/v1beta1/tx.rpc.msg.js"; +import * as _621 from "./incentives/tx.rpc.msg.js"; +import * as _622 from "./lockup/tx.rpc.msg.js"; +import * as _623 from "./superfluid/tx.rpc.msg.js"; +import * as _624 from "./tokenfactory/v1beta1/tx.rpc.msg.js"; +import * as _625 from "./gamm/v1beta1/query.pinia.store.js"; +import * as _626 from "./gamm/v2/query.pinia.store.js"; +import * as _649 from "./lcd.js"; +import * as _650 from "./custom-lcd-client.js"; +import * as _651 from "./rpc.query.js"; +import * as _652 from "./rpc.tx.js"; export namespace osmosis { export namespace claim { export const v1beta1 = { @@ -109,16 +129,18 @@ export namespace osmosis { ..._255, ..._256, ..._257, - ..._500, - ..._513 + ..._572, + ..._585, + ..._598 }; } export namespace epochs { export const v1beta1 = { ..._258, ..._259, - ..._501, - ..._514 + ..._573, + ..._586, + ..._599 }; } export namespace gamm { @@ -127,45 +149,51 @@ export namespace osmosis { ..._261, ..._262, ..._263, - ..._488, - ..._495, - ..._502, - ..._515, - ..._528, - ..._533 + ..._560, + ..._567, + ..._574, + ..._587, + ..._600, + ..._613, + ..._620, + ..._625 }; export namespace poolmodels { export namespace balancer { export const v1beta1 = { ..._264, - ..._486, - ..._493, - ..._526 + ..._558, + ..._565, + ..._611, + ..._618 }; } export namespace stableswap { export const v1beta1 = { ..._265, ..._266, - ..._487, - ..._494, - ..._527 + ..._559, + ..._566, + ..._612, + ..._619 }; } } export const v2 = { ..._267, - ..._503, - ..._516, - ..._534 + ..._575, + ..._588, + ..._601, + ..._626 }; } export namespace ibcratelimit { export const v1beta1 = { ..._268, ..._269, - ..._504, - ..._517 + ..._576, + ..._589, + ..._602 }; } export const incentives = { @@ -174,11 +202,13 @@ export namespace osmosis { ..._272, ..._273, ..._274, - ..._489, - ..._496, - ..._505, - ..._518, - ..._529 + ..._561, + ..._568, + ..._577, + ..._590, + ..._603, + ..._614, + ..._621 }; export const lockup = { ..._275, @@ -186,19 +216,22 @@ export namespace osmosis { ..._277, ..._278, ..._279, - ..._490, - ..._497, - ..._506, - ..._519, - ..._530 + ..._562, + ..._569, + ..._578, + ..._591, + ..._604, + ..._615, + ..._622 }; export namespace mint { export const v1beta1 = { ..._280, ..._281, ..._282, - ..._507, - ..._520 + ..._579, + ..._592, + ..._605 }; } export namespace poolincentives { @@ -207,8 +240,9 @@ export namespace osmosis { ..._284, ..._285, ..._286, - ..._508, - ..._521 + ..._580, + ..._593, + ..._606 }; } export namespace store { @@ -222,11 +256,13 @@ export namespace osmosis { ..._290, ..._291, ..._292, - ..._491, - ..._498, - ..._509, - ..._522, - ..._531 + ..._563, + ..._570, + ..._581, + ..._594, + ..._607, + ..._616, + ..._623 }; export namespace tokenfactory { export const v1beta1 = { @@ -235,11 +271,13 @@ export namespace osmosis { ..._295, ..._296, ..._297, - ..._492, - ..._499, - ..._510, - ..._523, - ..._532 + ..._564, + ..._571, + ..._582, + ..._595, + ..._608, + ..._617, + ..._624 }; } export namespace twap { @@ -247,8 +285,9 @@ export namespace osmosis { ..._298, ..._299, ..._300, - ..._511, - ..._524 + ..._583, + ..._596, + ..._609 }; } export namespace txfees { @@ -257,14 +296,15 @@ export namespace osmosis { ..._302, ..._303, ..._304, - ..._512, - ..._525 + ..._584, + ..._597, + ..._610 }; } export const ClientFactory = { - ..._556, - ..._557, - ..._558, - ..._559 + ..._649, + ..._650, + ..._651, + ..._652 }; } \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/osmosis/claim/v1beta1/query.rpc.Query.ts b/__fixtures__/v-next/outputv4/osmosis/claim/v1beta1/query.rpc.Query.ts index 9e17414b36..1860b88a1b 100644 --- a/__fixtures__/v-next/outputv4/osmosis/claim/v1beta1/query.rpc.Query.ts +++ b/__fixtures__/v-next/outputv4/osmosis/claim/v1beta1/query.rpc.Query.ts @@ -1,7 +1,7 @@ import { Action, ActionSDKType, ClaimRecord, ClaimRecordSDKType } from "./claim.js"; import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin.js"; import { Params, ParamsSDKType } from "./params.js"; -import { Rpc } from "../../../helpers.js"; +import { TxRpc } from "../../../types.js"; import { BinaryReader } from "../../../binary.js"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; import { QueryModuleAccountBalanceRequest, QueryModuleAccountBalanceRequestSDKType, QueryModuleAccountBalanceResponse, QueryModuleAccountBalanceResponseSDKType, QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, QueryClaimRecordRequest, QueryClaimRecordRequestSDKType, QueryClaimRecordResponse, QueryClaimRecordResponseSDKType, QueryClaimableForActionRequest, QueryClaimableForActionRequestSDKType, QueryClaimableForActionResponse, QueryClaimableForActionResponseSDKType, QueryTotalClaimableRequest, QueryTotalClaimableRequestSDKType, QueryTotalClaimableResponse, QueryTotalClaimableResponseSDKType } from "./query.js"; @@ -14,8 +14,8 @@ export interface Query { totalClaimable(request: QueryTotalClaimableRequest): Promise; } export class QueryClientImpl implements Query { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.moduleAccountBalance = this.moduleAccountBalance.bind(this); this.params = this.params.bind(this); diff --git a/__fixtures__/v-next/outputv4/osmosis/claim/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputv4/osmosis/claim/v1beta1/query.rpc.func.ts new file mode 100644 index 0000000000..cfee98c8a5 --- /dev/null +++ b/__fixtures__/v-next/outputv4/osmosis/claim/v1beta1/query.rpc.func.ts @@ -0,0 +1,60 @@ +import { Action, ActionSDKType, ClaimRecord, ClaimRecordSDKType } from "./claim.js"; +import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin.js"; +import { Params, ParamsSDKType } from "./params.js"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types.js"; +import { QueryModuleAccountBalanceRequest, QueryModuleAccountBalanceRequestSDKType, QueryModuleAccountBalanceResponse, QueryModuleAccountBalanceResponseSDKType, QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, QueryClaimRecordRequest, QueryClaimRecordRequestSDKType, QueryClaimRecordResponse, QueryClaimRecordResponseSDKType, QueryClaimableForActionRequest, QueryClaimableForActionRequestSDKType, QueryClaimableForActionResponse, QueryClaimableForActionResponseSDKType, QueryTotalClaimableRequest, QueryTotalClaimableRequestSDKType, QueryTotalClaimableResponse, QueryTotalClaimableResponseSDKType } from "./query.js"; +/** + * @name getModuleAccountBalance + * @package osmosis.claim.v1beta1 + * @see proto service: osmosis.claim.v1beta1.ModuleAccountBalance + */ +export const getModuleAccountBalance = buildQuery({ + encode: QueryModuleAccountBalanceRequest.encode, + decode: QueryModuleAccountBalanceResponse.decode, + service: "osmosis.claim.v1beta1.Query", + method: "ModuleAccountBalance" +}); +/** + * @name getParams + * @package osmosis.claim.v1beta1 + * @see proto service: osmosis.claim.v1beta1.Params + */ +export const getParams = buildQuery({ + encode: QueryParamsRequest.encode, + decode: QueryParamsResponse.decode, + service: "osmosis.claim.v1beta1.Query", + method: "Params" +}); +/** + * @name getClaimRecord + * @package osmosis.claim.v1beta1 + * @see proto service: osmosis.claim.v1beta1.ClaimRecord + */ +export const getClaimRecord = buildQuery({ + encode: QueryClaimRecordRequest.encode, + decode: QueryClaimRecordResponse.decode, + service: "osmosis.claim.v1beta1.Query", + method: "ClaimRecord" +}); +/** + * @name getClaimableForAction + * @package osmosis.claim.v1beta1 + * @see proto service: osmosis.claim.v1beta1.ClaimableForAction + */ +export const getClaimableForAction = buildQuery({ + encode: QueryClaimableForActionRequest.encode, + decode: QueryClaimableForActionResponse.decode, + service: "osmosis.claim.v1beta1.Query", + method: "ClaimableForAction" +}); +/** + * @name getTotalClaimable + * @package osmosis.claim.v1beta1 + * @see proto service: osmosis.claim.v1beta1.TotalClaimable + */ +export const getTotalClaimable = buildQuery({ + encode: QueryTotalClaimableRequest.encode, + decode: QueryTotalClaimableResponse.decode, + service: "osmosis.claim.v1beta1.Query", + method: "TotalClaimable" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/osmosis/epochs/query.rpc.Query.ts b/__fixtures__/v-next/outputv4/osmosis/epochs/query.rpc.Query.ts index b74ffde1d0..482d545631 100644 --- a/__fixtures__/v-next/outputv4/osmosis/epochs/query.rpc.Query.ts +++ b/__fixtures__/v-next/outputv4/osmosis/epochs/query.rpc.Query.ts @@ -1,5 +1,5 @@ import { EpochInfo, EpochInfoSDKType } from "./genesis.js"; -import { Rpc } from "../../helpers.js"; +import { TxRpc } from "../../types.js"; import { BinaryReader } from "../../binary.js"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; import { QueryEpochsInfoRequest, QueryEpochsInfoRequestSDKType, QueryEpochsInfoResponse, QueryEpochsInfoResponseSDKType, QueryCurrentEpochRequest, QueryCurrentEpochRequestSDKType, QueryCurrentEpochResponse, QueryCurrentEpochResponseSDKType } from "./query.js"; @@ -11,8 +11,8 @@ export interface Query { currentEpoch(request: QueryCurrentEpochRequest): Promise; } export class QueryClientImpl implements Query { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.epochInfos = this.epochInfos.bind(this); this.currentEpoch = this.currentEpoch.bind(this); diff --git a/__fixtures__/v-next/outputv4/osmosis/epochs/query.rpc.func.ts b/__fixtures__/v-next/outputv4/osmosis/epochs/query.rpc.func.ts new file mode 100644 index 0000000000..d69e627c3b --- /dev/null +++ b/__fixtures__/v-next/outputv4/osmosis/epochs/query.rpc.func.ts @@ -0,0 +1,27 @@ +import { EpochInfo, EpochInfoSDKType } from "./genesis.js"; +import { EndpointOrRpc, buildQuery } from "../../helper-func-types.js"; +import { QueryEpochsInfoRequest, QueryEpochsInfoRequestSDKType, QueryEpochsInfoResponse, QueryEpochsInfoResponseSDKType, QueryCurrentEpochRequest, QueryCurrentEpochRequestSDKType, QueryCurrentEpochResponse, QueryCurrentEpochResponseSDKType } from "./query.js"; +/** + * EpochInfos provide running epochInfos + * @name getEpochInfos + * @package osmosis.epochs.v1beta1 + * @see proto service: osmosis.epochs.v1beta1.EpochInfos + */ +export const getEpochInfos = buildQuery({ + encode: QueryEpochsInfoRequest.encode, + decode: QueryEpochsInfoResponse.decode, + service: "osmosis.epochs.v1beta1.Query", + method: "EpochInfos" +}); +/** + * CurrentEpoch provide current epoch of specified identifier + * @name getCurrentEpoch + * @package osmosis.epochs.v1beta1 + * @see proto service: osmosis.epochs.v1beta1.CurrentEpoch + */ +export const getCurrentEpoch = buildQuery({ + encode: QueryCurrentEpochRequest.encode, + decode: QueryCurrentEpochResponse.decode, + service: "osmosis.epochs.v1beta1.Query", + method: "CurrentEpoch" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/balancer/balancerPool.ts b/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/balancer/balancerPool.ts index 71c1561359..47d3004fac 100644 --- a/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/balancer/balancerPool.ts +++ b/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/balancer/balancerPool.ts @@ -4,7 +4,7 @@ import { Coin, CoinSDKType } from "../../../../cosmos/base/v1beta1/coin.js"; import { BinaryReader, BinaryWriter } from "../../../../binary.js"; import { toTimestamp, fromTimestamp, isSet, DeepPartial } from "../../../../helpers.js"; import { JsonSafe } from "../../../../json-safe.js"; -import { Decimal } from "@cosmjs/math"; +import { Decimal } from "@interchainjs/math"; export const protobufPackage = "osmosis.gamm.v1beta1"; /** * Parameters for changing the weights in a balancer pool smoothly from @@ -492,8 +492,8 @@ export const PoolParams = { }, toAmino(message: PoolParams): PoolParamsAmino { const obj: any = {}; - obj.swap_fee = message.swapFee === "" ? undefined : message.swapFee; - obj.exit_fee = message.exitFee === "" ? undefined : message.exitFee; + obj.swap_fee = message.swapFee === "" ? undefined : Decimal.fromUserInput(message.swapFee, 18).atomics; + obj.exit_fee = message.exitFee === "" ? undefined : Decimal.fromUserInput(message.exitFee, 18).atomics; obj.smooth_weight_change_params = message.smoothWeightChangeParams ? SmoothWeightChangeParams.toAmino(message.smoothWeightChangeParams) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/balancer/tx/tx.amino.ts b/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/balancer/tx/tx.amino.ts index 21be6aafdb..20b67a2e22 100644 --- a/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/balancer/tx/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/balancer/tx/tx.amino.ts @@ -1,6 +1,7 @@ //@ts-nocheck import { PoolParams, PoolParamsSDKType, PoolAsset, PoolAssetSDKType, SmoothWeightChangeParams, SmoothWeightChangeParamsSDKType } from "../balancerPool.js"; import { AminoMsg } from "@cosmjs/amino"; +import { Decimal } from "@interchainjs/math"; import { Duration, DurationSDKType } from "../../../../../google/protobuf/duration.js"; import { Coin, CoinSDKType } from "../../../../../cosmos/base/v1beta1/coin.js"; import { MsgCreateBalancerPool, MsgCreateBalancerPoolSDKType } from "./tx.js"; @@ -55,8 +56,8 @@ export const AminoConverter = { return { sender, pool_params: { - swap_fee: poolParams.swapFee, - exit_fee: poolParams.exitFee, + swap_fee: Decimal.fromUserInput(poolParams.swapFee, 18).atomics, + exit_fee: Decimal.fromUserInput(poolParams.exitFee, 18).atomics, smooth_weight_change_params: { start_time: poolParams.smoothWeightChangeParams.startTime, duration: (poolParams.smoothWeightChangeParams.duration * 1_000_000_000).toString(), diff --git a/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/balancer/tx/tx.registry.ts b/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/balancer/tx/tx.registry.ts index b8074d4f53..45f777ec90 100644 --- a/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/balancer/tx/tx.registry.ts +++ b/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/balancer/tx/tx.registry.ts @@ -1,12 +1,7 @@ import { PoolParams, PoolParamsSDKType, PoolAsset, PoolAssetSDKType } from "../balancerPool.js"; -import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { TelescopeGeneratedType } from "../../../../../types.js"; import { MsgCreateBalancerPool, MsgCreateBalancerPoolSDKType } from "./tx.js"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/osmosis.gamm.poolmodels.balancer.v1beta1.MsgCreateBalancerPool", MsgCreateBalancerPool]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/osmosis.gamm.poolmodels.balancer.v1beta1.MsgCreateBalancerPool", MsgCreateBalancerPool]]; export const MessageComposer = { encoded: { createBalancerPool(value: MsgCreateBalancerPool) { diff --git a/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/balancer/tx/tx.rpc.func.ts b/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/balancer/tx/tx.rpc.func.ts new file mode 100644 index 0000000000..d2b61b3cf8 --- /dev/null +++ b/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/balancer/tx/tx.rpc.func.ts @@ -0,0 +1,11 @@ +import { PoolParams, PoolParamsSDKType, PoolAsset, PoolAssetSDKType } from "../balancerPool.js"; +import { buildTx } from "../../../../../helper-func-types.js"; +import { MsgCreateBalancerPool, MsgCreateBalancerPoolSDKType, MsgCreateBalancerPoolResponse, MsgCreateBalancerPoolResponseSDKType } from "./tx.js"; +/** + * @name createBalancerPool + * @package osmosis.gamm.poolmodels.balancer.v1beta1 + * @see proto service: osmosis.gamm.poolmodels.balancer.v1beta1.CreateBalancerPool + */ +export const createBalancerPool = buildTx({ + msg: MsgCreateBalancerPool +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/balancer/tx/tx.rpc.msg.ts b/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/balancer/tx/tx.rpc.msg.ts index 3333871754..0ac8c9e532 100644 --- a/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/balancer/tx/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/balancer/tx/tx.rpc.msg.ts @@ -1,13 +1,13 @@ import { PoolParams, PoolParamsSDKType, PoolAsset, PoolAssetSDKType } from "../balancerPool.js"; -import { Rpc } from "../../../../../helpers.js"; +import { TxRpc } from "../../../../../types.js"; import { BinaryReader } from "../../../../../binary.js"; import { MsgCreateBalancerPool, MsgCreateBalancerPoolSDKType, MsgCreateBalancerPoolResponse, MsgCreateBalancerPoolResponseSDKType } from "./tx.js"; export interface Msg { createBalancerPool(request: MsgCreateBalancerPool): Promise; } export class MsgClientImpl implements Msg { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.createBalancerPool = this.createBalancerPool.bind(this); } @@ -17,6 +17,6 @@ export class MsgClientImpl implements Msg { return promise.then(data => MsgCreateBalancerPoolResponse.decode(new BinaryReader(data))); } } -export const createClientImpl = (rpc: Rpc) => { +export const createClientImpl = (rpc: TxRpc) => { return new MsgClientImpl(rpc); }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/stableswap/stableswap_pool.ts b/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/stableswap/stableswap_pool.ts index ed8dcbcc30..a227d8062a 100644 --- a/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/stableswap/stableswap_pool.ts +++ b/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/stableswap/stableswap_pool.ts @@ -1,6 +1,6 @@ import { Coin, CoinSDKType } from "../../../../cosmos/base/v1beta1/coin.js"; import { BinaryReader, BinaryWriter } from "../../../../binary.js"; -import { Decimal } from "@cosmjs/math"; +import { Decimal } from "@interchainjs/math"; import { isSet, DeepPartial } from "../../../../helpers.js"; import { JsonSafe } from "../../../../json-safe.js"; export const protobufPackage = "osmosis.gamm.poolmodels.stableswap.v1beta1"; @@ -186,8 +186,8 @@ export const PoolParams = { }, toAmino(message: PoolParams): PoolParamsAmino { const obj: any = {}; - obj.swap_fee = message.swapFee === "" ? undefined : message.swapFee; - obj.exit_fee = message.exitFee === "" ? undefined : message.exitFee; + obj.swap_fee = message.swapFee === "" ? undefined : Decimal.fromUserInput(message.swapFee, 18).atomics; + obj.exit_fee = message.exitFee === "" ? undefined : Decimal.fromUserInput(message.exitFee, 18).atomics; return obj; }, fromAminoMsg(object: PoolParamsAminoMsg): PoolParams { diff --git a/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/stableswap/tx.amino.ts b/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/stableswap/tx.amino.ts index e0434c0e71..f6a9e79d41 100644 --- a/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/stableswap/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/stableswap/tx.amino.ts @@ -2,6 +2,7 @@ import { PoolParams, PoolParamsSDKType } from "./stableswap_pool.js"; import { Coin, CoinSDKType } from "../../../../cosmos/base/v1beta1/coin.js"; import { AminoMsg } from "@cosmjs/amino"; +import { Decimal } from "@interchainjs/math"; import { MsgCreateStableswapPool, MsgCreateStableswapPoolSDKType, MsgStableSwapAdjustScalingFactors, MsgStableSwapAdjustScalingFactorsSDKType } from "./tx.js"; export interface MsgCreateStableswapPoolAminoType extends AminoMsg { type: "osmosis/gamm/create-stableswap-pool"; @@ -42,8 +43,8 @@ export const AminoConverter = { return { sender, pool_params: { - swap_fee: poolParams.swapFee, - exit_fee: poolParams.exitFee + swap_fee: Decimal.fromUserInput(poolParams.swapFee, 18).atomics, + exit_fee: Decimal.fromUserInput(poolParams.exitFee, 18).atomics }, initial_pool_liquidity: initialPoolLiquidity.map(el0 => ({ denom: el0.denom, diff --git a/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/stableswap/tx.registry.ts b/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/stableswap/tx.registry.ts index 3c5ae672b8..251daa40ef 100644 --- a/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/stableswap/tx.registry.ts +++ b/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/stableswap/tx.registry.ts @@ -1,13 +1,8 @@ import { PoolParams, PoolParamsSDKType } from "./stableswap_pool.js"; import { Coin, CoinSDKType } from "../../../../cosmos/base/v1beta1/coin.js"; -import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { TelescopeGeneratedType } from "../../../../types.js"; import { MsgCreateStableswapPool, MsgCreateStableswapPoolSDKType, MsgStableSwapAdjustScalingFactors, MsgStableSwapAdjustScalingFactorsSDKType } from "./tx.js"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/osmosis.gamm.poolmodels.stableswap.v1beta1.MsgCreateStableswapPool", MsgCreateStableswapPool], ["/osmosis.gamm.poolmodels.stableswap.v1beta1.MsgStableSwapAdjustScalingFactors", MsgStableSwapAdjustScalingFactors]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/osmosis.gamm.poolmodels.stableswap.v1beta1.MsgCreateStableswapPool", MsgCreateStableswapPool], ["/osmosis.gamm.poolmodels.stableswap.v1beta1.MsgStableSwapAdjustScalingFactors", MsgStableSwapAdjustScalingFactors]]; export const MessageComposer = { encoded: { createStableswapPool(value: MsgCreateStableswapPool) { diff --git a/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/stableswap/tx.rpc.func.ts b/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/stableswap/tx.rpc.func.ts new file mode 100644 index 0000000000..c0a7b50b5d --- /dev/null +++ b/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/stableswap/tx.rpc.func.ts @@ -0,0 +1,20 @@ +import { PoolParams, PoolParamsSDKType } from "./stableswap_pool.js"; +import { Coin, CoinSDKType } from "../../../../cosmos/base/v1beta1/coin.js"; +import { buildTx } from "../../../../helper-func-types.js"; +import { MsgCreateStableswapPool, MsgCreateStableswapPoolSDKType, MsgCreateStableswapPoolResponse, MsgCreateStableswapPoolResponseSDKType, MsgStableSwapAdjustScalingFactors, MsgStableSwapAdjustScalingFactorsSDKType, MsgStableSwapAdjustScalingFactorsResponse, MsgStableSwapAdjustScalingFactorsResponseSDKType } from "./tx.js"; +/** + * @name createStableswapPool + * @package osmosis.gamm.poolmodels.stableswap.v1beta1 + * @see proto service: osmosis.gamm.poolmodels.stableswap.v1beta1.CreateStableswapPool + */ +export const createStableswapPool = buildTx({ + msg: MsgCreateStableswapPool +}); +/** + * @name stableSwapAdjustScalingFactors + * @package osmosis.gamm.poolmodels.stableswap.v1beta1 + * @see proto service: osmosis.gamm.poolmodels.stableswap.v1beta1.StableSwapAdjustScalingFactors + */ +export const stableSwapAdjustScalingFactors = buildTx({ + msg: MsgStableSwapAdjustScalingFactors +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/stableswap/tx.rpc.msg.ts b/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/stableswap/tx.rpc.msg.ts index 542d6a0002..583e6c725c 100644 --- a/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/stableswap/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/stableswap/tx.rpc.msg.ts @@ -1,6 +1,6 @@ import { PoolParams, PoolParamsSDKType } from "./stableswap_pool.js"; import { Coin, CoinSDKType } from "../../../../cosmos/base/v1beta1/coin.js"; -import { Rpc } from "../../../../helpers.js"; +import { TxRpc } from "../../../../types.js"; import { BinaryReader } from "../../../../binary.js"; import { MsgCreateStableswapPool, MsgCreateStableswapPoolSDKType, MsgCreateStableswapPoolResponse, MsgCreateStableswapPoolResponseSDKType, MsgStableSwapAdjustScalingFactors, MsgStableSwapAdjustScalingFactorsSDKType, MsgStableSwapAdjustScalingFactorsResponse, MsgStableSwapAdjustScalingFactorsResponseSDKType } from "./tx.js"; export interface Msg { @@ -8,8 +8,8 @@ export interface Msg { stableSwapAdjustScalingFactors(request: MsgStableSwapAdjustScalingFactors): Promise; } export class MsgClientImpl implements Msg { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.createStableswapPool = this.createStableswapPool.bind(this); this.stableSwapAdjustScalingFactors = this.stableSwapAdjustScalingFactors.bind(this); @@ -25,6 +25,6 @@ export class MsgClientImpl implements Msg { return promise.then(data => MsgStableSwapAdjustScalingFactorsResponse.decode(new BinaryReader(data))); } } -export const createClientImpl = (rpc: Rpc) => { +export const createClientImpl = (rpc: TxRpc) => { return new MsgClientImpl(rpc); }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/osmosis/gamm/v1beta1/query.rpc.Query.ts b/__fixtures__/v-next/outputv4/osmosis/gamm/v1beta1/query.rpc.Query.ts index e76b904e28..d0c4274a78 100644 --- a/__fixtures__/v-next/outputv4/osmosis/gamm/v1beta1/query.rpc.Query.ts +++ b/__fixtures__/v-next/outputv4/osmosis/gamm/v1beta1/query.rpc.Query.ts @@ -2,7 +2,7 @@ import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } fr import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin.js"; import { SwapAmountInRoute, SwapAmountInRouteSDKType, SwapAmountOutRoute, SwapAmountOutRouteSDKType } from "./tx.js"; import { Any, AnySDKType } from "../../../google/protobuf/any.js"; -import { Rpc } from "../../../helpers.js"; +import { TxRpc } from "../../../types.js"; import { BinaryReader } from "../../../binary.js"; import { QueryClient, createProtobufRpcClient, ProtobufRpcClient } from "@cosmjs/stargate"; import { ReactQueryParams } from "../../../react-query.js"; @@ -47,8 +47,8 @@ export interface Query { estimateSwapExactAmountOut(request: QuerySwapExactAmountOutRequest): Promise; } export class QueryClientImpl implements Query { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.pools = this.pools.bind(this); this.numPools = this.numPools.bind(this); diff --git a/__fixtures__/v-next/outputv4/osmosis/gamm/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputv4/osmosis/gamm/v1beta1/query.rpc.func.ts new file mode 100644 index 0000000000..bc36a5647c --- /dev/null +++ b/__fixtures__/v-next/outputv4/osmosis/gamm/v1beta1/query.rpc.func.ts @@ -0,0 +1,183 @@ +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination.js"; +import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin.js"; +import { SwapAmountInRoute, SwapAmountInRouteSDKType, SwapAmountOutRoute, SwapAmountOutRouteSDKType } from "./tx.js"; +import { Any, AnySDKType } from "../../../google/protobuf/any.js"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types.js"; +import { QueryPoolsRequest, QueryPoolsRequestSDKType, QueryPoolsResponse, QueryPoolsResponseSDKType, QueryNumPoolsRequest, QueryNumPoolsRequestSDKType, QueryNumPoolsResponse, QueryNumPoolsResponseSDKType, QueryTotalLiquidityRequest, QueryTotalLiquidityRequestSDKType, QueryTotalLiquidityResponse, QueryTotalLiquidityResponseSDKType, QueryPoolsWithFilterRequest, QueryPoolsWithFilterRequestSDKType, QueryPoolsWithFilterResponse, QueryPoolsWithFilterResponseSDKType, QueryPoolRequest, QueryPoolRequestSDKType, QueryPoolResponse, QueryPoolResponseSDKType, QueryPoolTypeRequest, QueryPoolTypeRequestSDKType, QueryPoolTypeResponse, QueryPoolTypeResponseSDKType, QueryCalcJoinPoolNoSwapSharesRequest, QueryCalcJoinPoolNoSwapSharesRequestSDKType, QueryCalcJoinPoolNoSwapSharesResponse, QueryCalcJoinPoolNoSwapSharesResponseSDKType, QueryCalcJoinPoolSharesRequest, QueryCalcJoinPoolSharesRequestSDKType, QueryCalcJoinPoolSharesResponse, QueryCalcJoinPoolSharesResponseSDKType, QueryCalcExitPoolCoinsFromSharesRequest, QueryCalcExitPoolCoinsFromSharesRequestSDKType, QueryCalcExitPoolCoinsFromSharesResponse, QueryCalcExitPoolCoinsFromSharesResponseSDKType, QueryPoolParamsRequest, QueryPoolParamsRequestSDKType, QueryPoolParamsResponse, QueryPoolParamsResponseSDKType, QueryTotalPoolLiquidityRequest, QueryTotalPoolLiquidityRequestSDKType, QueryTotalPoolLiquidityResponse, QueryTotalPoolLiquidityResponseSDKType, QueryTotalSharesRequest, QueryTotalSharesRequestSDKType, QueryTotalSharesResponse, QueryTotalSharesResponseSDKType, QuerySpotPriceRequest, QuerySpotPriceRequestSDKType, QuerySpotPriceResponse, QuerySpotPriceResponseSDKType, QuerySwapExactAmountInRequest, QuerySwapExactAmountInRequestSDKType, QuerySwapExactAmountInResponse, QuerySwapExactAmountInResponseSDKType, QuerySwapExactAmountOutRequest, QuerySwapExactAmountOutRequestSDKType, QuerySwapExactAmountOutResponse, QuerySwapExactAmountOutResponseSDKType } from "./query.js"; +/** + * @name getPools + * @package osmosis.gamm.v1beta1 + * @see proto service: osmosis.gamm.v1beta1.Pools + */ +export const getPools = buildQuery({ + encode: QueryPoolsRequest.encode, + decode: QueryPoolsResponse.decode, + service: "osmosis.gamm.v1beta1.Query", + method: "Pools" +}); +/** + * @name getNumPools + * @package osmosis.gamm.v1beta1 + * @see proto service: osmosis.gamm.v1beta1.NumPools + */ +export const getNumPools = buildQuery({ + encode: QueryNumPoolsRequest.encode, + decode: QueryNumPoolsResponse.decode, + service: "osmosis.gamm.v1beta1.Query", + method: "NumPools" +}); +/** + * @name getTotalLiquidity + * @package osmosis.gamm.v1beta1 + * @see proto service: osmosis.gamm.v1beta1.TotalLiquidity + */ +export const getTotalLiquidity = buildQuery({ + encode: QueryTotalLiquidityRequest.encode, + decode: QueryTotalLiquidityResponse.decode, + service: "osmosis.gamm.v1beta1.Query", + method: "TotalLiquidity" +}); +/** + * PoolsWithFilter allows you to query specific pools with requested + * parameters + * @name getPoolsWithFilter + * @package osmosis.gamm.v1beta1 + * @see proto service: osmosis.gamm.v1beta1.PoolsWithFilter + */ +export const getPoolsWithFilter = buildQuery({ + encode: QueryPoolsWithFilterRequest.encode, + decode: QueryPoolsWithFilterResponse.decode, + service: "osmosis.gamm.v1beta1.Query", + method: "PoolsWithFilter" +}); +/** + * Per Pool gRPC Endpoints + * @name getPool + * @package osmosis.gamm.v1beta1 + * @see proto service: osmosis.gamm.v1beta1.Pool + */ +export const getPool = buildQuery({ + encode: QueryPoolRequest.encode, + decode: QueryPoolResponse.decode, + service: "osmosis.gamm.v1beta1.Query", + method: "Pool" +}); +/** + * PoolType returns the type of the pool. + * Returns "Balancer" as a string literal when the pool is a balancer pool. + * Errors if the pool is failed to be type caseted. + * @name getPoolType + * @package osmosis.gamm.v1beta1 + * @see proto service: osmosis.gamm.v1beta1.PoolType + */ +export const getPoolType = buildQuery({ + encode: QueryPoolTypeRequest.encode, + decode: QueryPoolTypeResponse.decode, + service: "osmosis.gamm.v1beta1.Query", + method: "PoolType" +}); +/** + * Simulates joining pool without a swap. Returns the amount of shares you'd + * get and tokens needed to provide + * @name getCalcJoinPoolNoSwapShares + * @package osmosis.gamm.v1beta1 + * @see proto service: osmosis.gamm.v1beta1.CalcJoinPoolNoSwapShares + */ +export const getCalcJoinPoolNoSwapShares = buildQuery({ + encode: QueryCalcJoinPoolNoSwapSharesRequest.encode, + decode: QueryCalcJoinPoolNoSwapSharesResponse.decode, + service: "osmosis.gamm.v1beta1.Query", + method: "CalcJoinPoolNoSwapShares" +}); +/** + * @name getCalcJoinPoolShares + * @package osmosis.gamm.v1beta1 + * @see proto service: osmosis.gamm.v1beta1.CalcJoinPoolShares + */ +export const getCalcJoinPoolShares = buildQuery({ + encode: QueryCalcJoinPoolSharesRequest.encode, + decode: QueryCalcJoinPoolSharesResponse.decode, + service: "osmosis.gamm.v1beta1.Query", + method: "CalcJoinPoolShares" +}); +/** + * @name getCalcExitPoolCoinsFromShares + * @package osmosis.gamm.v1beta1 + * @see proto service: osmosis.gamm.v1beta1.CalcExitPoolCoinsFromShares + */ +export const getCalcExitPoolCoinsFromShares = buildQuery({ + encode: QueryCalcExitPoolCoinsFromSharesRequest.encode, + decode: QueryCalcExitPoolCoinsFromSharesResponse.decode, + service: "osmosis.gamm.v1beta1.Query", + method: "CalcExitPoolCoinsFromShares" +}); +/** + * @name getPoolParams + * @package osmosis.gamm.v1beta1 + * @see proto service: osmosis.gamm.v1beta1.PoolParams + */ +export const getPoolParams = buildQuery({ + encode: QueryPoolParamsRequest.encode, + decode: QueryPoolParamsResponse.decode, + service: "osmosis.gamm.v1beta1.Query", + method: "PoolParams" +}); +/** + * @name getTotalPoolLiquidity + * @package osmosis.gamm.v1beta1 + * @see proto service: osmosis.gamm.v1beta1.TotalPoolLiquidity + */ +export const getTotalPoolLiquidity = buildQuery({ + encode: QueryTotalPoolLiquidityRequest.encode, + decode: QueryTotalPoolLiquidityResponse.decode, + service: "osmosis.gamm.v1beta1.Query", + method: "TotalPoolLiquidity" +}); +/** + * @name getTotalShares + * @package osmosis.gamm.v1beta1 + * @see proto service: osmosis.gamm.v1beta1.TotalShares + */ +export const getTotalShares = buildQuery({ + encode: QueryTotalSharesRequest.encode, + decode: QueryTotalSharesResponse.decode, + service: "osmosis.gamm.v1beta1.Query", + method: "TotalShares" +}); +/** + * SpotPrice defines a gRPC query handler that returns the spot price given + * a base denomination and a quote denomination. + * @name getSpotPrice + * @package osmosis.gamm.v1beta1 + * @see proto service: osmosis.gamm.v1beta1.SpotPrice + * @deprecated + */ +export const getSpotPrice = buildQuery({ + encode: QuerySpotPriceRequest.encode, + decode: QuerySpotPriceResponse.decode, + service: "osmosis.gamm.v1beta1.Query", + method: "SpotPrice" +}); +/** + * Estimate the swap. + * @name getEstimateSwapExactAmountIn + * @package osmosis.gamm.v1beta1 + * @see proto service: osmosis.gamm.v1beta1.EstimateSwapExactAmountIn + */ +export const getEstimateSwapExactAmountIn = buildQuery({ + encode: QuerySwapExactAmountInRequest.encode, + decode: QuerySwapExactAmountInResponse.decode, + service: "osmosis.gamm.v1beta1.Query", + method: "EstimateSwapExactAmountIn" +}); +/** + * @name getEstimateSwapExactAmountOut + * @package osmosis.gamm.v1beta1 + * @see proto service: osmosis.gamm.v1beta1.EstimateSwapExactAmountOut + */ +export const getEstimateSwapExactAmountOut = buildQuery({ + encode: QuerySwapExactAmountOutRequest.encode, + decode: QuerySwapExactAmountOutResponse.decode, + service: "osmosis.gamm.v1beta1.Query", + method: "EstimateSwapExactAmountOut" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/osmosis/gamm/v1beta1/tx.registry.ts b/__fixtures__/v-next/outputv4/osmosis/gamm/v1beta1/tx.registry.ts index 98ccbd8976..5ef56ca0f7 100644 --- a/__fixtures__/v-next/outputv4/osmosis/gamm/v1beta1/tx.registry.ts +++ b/__fixtures__/v-next/outputv4/osmosis/gamm/v1beta1/tx.registry.ts @@ -1,12 +1,7 @@ import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin.js"; -import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { TelescopeGeneratedType } from "../../../types.js"; import { MsgJoinPool, MsgJoinPoolSDKType, MsgExitPool, MsgExitPoolSDKType, MsgSwapExactAmountIn, MsgSwapExactAmountInSDKType, MsgSwapExactAmountOut, MsgSwapExactAmountOutSDKType, MsgJoinSwapExternAmountIn, MsgJoinSwapExternAmountInSDKType, MsgJoinSwapShareAmountOut, MsgJoinSwapShareAmountOutSDKType, MsgExitSwapExternAmountOut, MsgExitSwapExternAmountOutSDKType, MsgExitSwapShareAmountIn, MsgExitSwapShareAmountInSDKType } from "./tx.js"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/osmosis.gamm.v1beta1.MsgJoinPool", MsgJoinPool], ["/osmosis.gamm.v1beta1.MsgExitPool", MsgExitPool], ["/osmosis.gamm.v1beta1.MsgSwapExactAmountIn", MsgSwapExactAmountIn], ["/osmosis.gamm.v1beta1.MsgSwapExactAmountOut", MsgSwapExactAmountOut], ["/osmosis.gamm.v1beta1.MsgJoinSwapExternAmountIn", MsgJoinSwapExternAmountIn], ["/osmosis.gamm.v1beta1.MsgJoinSwapShareAmountOut", MsgJoinSwapShareAmountOut], ["/osmosis.gamm.v1beta1.MsgExitSwapExternAmountOut", MsgExitSwapExternAmountOut], ["/osmosis.gamm.v1beta1.MsgExitSwapShareAmountIn", MsgExitSwapShareAmountIn]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/osmosis.gamm.v1beta1.MsgJoinPool", MsgJoinPool], ["/osmosis.gamm.v1beta1.MsgExitPool", MsgExitPool], ["/osmosis.gamm.v1beta1.MsgSwapExactAmountIn", MsgSwapExactAmountIn], ["/osmosis.gamm.v1beta1.MsgSwapExactAmountOut", MsgSwapExactAmountOut], ["/osmosis.gamm.v1beta1.MsgJoinSwapExternAmountIn", MsgJoinSwapExternAmountIn], ["/osmosis.gamm.v1beta1.MsgJoinSwapShareAmountOut", MsgJoinSwapShareAmountOut], ["/osmosis.gamm.v1beta1.MsgExitSwapExternAmountOut", MsgExitSwapExternAmountOut], ["/osmosis.gamm.v1beta1.MsgExitSwapShareAmountIn", MsgExitSwapShareAmountIn]]; export const MessageComposer = { encoded: { joinPool(value: MsgJoinPool) { diff --git a/__fixtures__/v-next/outputv4/osmosis/gamm/v1beta1/tx.rpc.func.ts b/__fixtures__/v-next/outputv4/osmosis/gamm/v1beta1/tx.rpc.func.ts new file mode 100644 index 0000000000..9e7656a59a --- /dev/null +++ b/__fixtures__/v-next/outputv4/osmosis/gamm/v1beta1/tx.rpc.func.ts @@ -0,0 +1,67 @@ +import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin.js"; +import { buildTx } from "../../../helper-func-types.js"; +import { MsgJoinPool, MsgJoinPoolSDKType, MsgJoinPoolResponse, MsgJoinPoolResponseSDKType, MsgExitPool, MsgExitPoolSDKType, MsgExitPoolResponse, MsgExitPoolResponseSDKType, MsgSwapExactAmountIn, MsgSwapExactAmountInSDKType, MsgSwapExactAmountInResponse, MsgSwapExactAmountInResponseSDKType, MsgSwapExactAmountOut, MsgSwapExactAmountOutSDKType, MsgSwapExactAmountOutResponse, MsgSwapExactAmountOutResponseSDKType, MsgJoinSwapExternAmountIn, MsgJoinSwapExternAmountInSDKType, MsgJoinSwapExternAmountInResponse, MsgJoinSwapExternAmountInResponseSDKType, MsgJoinSwapShareAmountOut, MsgJoinSwapShareAmountOutSDKType, MsgJoinSwapShareAmountOutResponse, MsgJoinSwapShareAmountOutResponseSDKType, MsgExitSwapExternAmountOut, MsgExitSwapExternAmountOutSDKType, MsgExitSwapExternAmountOutResponse, MsgExitSwapExternAmountOutResponseSDKType, MsgExitSwapShareAmountIn, MsgExitSwapShareAmountInSDKType, MsgExitSwapShareAmountInResponse, MsgExitSwapShareAmountInResponseSDKType } from "./tx.js"; +/** + * @name joinPool + * @package osmosis.gamm.v1beta1 + * @see proto service: osmosis.gamm.v1beta1.JoinPool + */ +export const joinPool = buildTx({ + msg: MsgJoinPool +}); +/** + * @name exitPool + * @package osmosis.gamm.v1beta1 + * @see proto service: osmosis.gamm.v1beta1.ExitPool + */ +export const exitPool = buildTx({ + msg: MsgExitPool +}); +/** + * @name swapExactAmountIn + * @package osmosis.gamm.v1beta1 + * @see proto service: osmosis.gamm.v1beta1.SwapExactAmountIn + */ +export const swapExactAmountIn = buildTx({ + msg: MsgSwapExactAmountIn +}); +/** + * @name swapExactAmountOut + * @package osmosis.gamm.v1beta1 + * @see proto service: osmosis.gamm.v1beta1.SwapExactAmountOut + */ +export const swapExactAmountOut = buildTx({ + msg: MsgSwapExactAmountOut +}); +/** + * @name joinSwapExternAmountIn + * @package osmosis.gamm.v1beta1 + * @see proto service: osmosis.gamm.v1beta1.JoinSwapExternAmountIn + */ +export const joinSwapExternAmountIn = buildTx({ + msg: MsgJoinSwapExternAmountIn +}); +/** + * @name joinSwapShareAmountOut + * @package osmosis.gamm.v1beta1 + * @see proto service: osmosis.gamm.v1beta1.JoinSwapShareAmountOut + */ +export const joinSwapShareAmountOut = buildTx({ + msg: MsgJoinSwapShareAmountOut +}); +/** + * @name exitSwapExternAmountOut + * @package osmosis.gamm.v1beta1 + * @see proto service: osmosis.gamm.v1beta1.ExitSwapExternAmountOut + */ +export const exitSwapExternAmountOut = buildTx({ + msg: MsgExitSwapExternAmountOut +}); +/** + * @name exitSwapShareAmountIn + * @package osmosis.gamm.v1beta1 + * @see proto service: osmosis.gamm.v1beta1.ExitSwapShareAmountIn + */ +export const exitSwapShareAmountIn = buildTx({ + msg: MsgExitSwapShareAmountIn +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/osmosis/gamm/v1beta1/tx.rpc.msg.ts b/__fixtures__/v-next/outputv4/osmosis/gamm/v1beta1/tx.rpc.msg.ts index 708dfeaa1a..a9141c6f32 100644 --- a/__fixtures__/v-next/outputv4/osmosis/gamm/v1beta1/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputv4/osmosis/gamm/v1beta1/tx.rpc.msg.ts @@ -1,5 +1,5 @@ import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin.js"; -import { Rpc } from "../../../helpers.js"; +import { TxRpc } from "../../../types.js"; import { BinaryReader } from "../../../binary.js"; import { MsgJoinPool, MsgJoinPoolSDKType, MsgJoinPoolResponse, MsgJoinPoolResponseSDKType, MsgExitPool, MsgExitPoolSDKType, MsgExitPoolResponse, MsgExitPoolResponseSDKType, MsgSwapExactAmountIn, MsgSwapExactAmountInSDKType, MsgSwapExactAmountInResponse, MsgSwapExactAmountInResponseSDKType, MsgSwapExactAmountOut, MsgSwapExactAmountOutSDKType, MsgSwapExactAmountOutResponse, MsgSwapExactAmountOutResponseSDKType, MsgJoinSwapExternAmountIn, MsgJoinSwapExternAmountInSDKType, MsgJoinSwapExternAmountInResponse, MsgJoinSwapExternAmountInResponseSDKType, MsgJoinSwapShareAmountOut, MsgJoinSwapShareAmountOutSDKType, MsgJoinSwapShareAmountOutResponse, MsgJoinSwapShareAmountOutResponseSDKType, MsgExitSwapExternAmountOut, MsgExitSwapExternAmountOutSDKType, MsgExitSwapExternAmountOutResponse, MsgExitSwapExternAmountOutResponseSDKType, MsgExitSwapShareAmountIn, MsgExitSwapShareAmountInSDKType, MsgExitSwapShareAmountInResponse, MsgExitSwapShareAmountInResponseSDKType } from "./tx.js"; export interface Msg { @@ -13,8 +13,8 @@ export interface Msg { exitSwapShareAmountIn(request: MsgExitSwapShareAmountIn): Promise; } export class MsgClientImpl implements Msg { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.joinPool = this.joinPool.bind(this); this.exitPool = this.exitPool.bind(this); @@ -66,6 +66,6 @@ export class MsgClientImpl implements Msg { return promise.then(data => MsgExitSwapShareAmountInResponse.decode(new BinaryReader(data))); } } -export const createClientImpl = (rpc: Rpc) => { +export const createClientImpl = (rpc: TxRpc) => { return new MsgClientImpl(rpc); }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/osmosis/gamm/v2/query.rpc.Query.ts b/__fixtures__/v-next/outputv4/osmosis/gamm/v2/query.rpc.Query.ts index 1ee524a750..c5c54f3e8a 100644 --- a/__fixtures__/v-next/outputv4/osmosis/gamm/v2/query.rpc.Query.ts +++ b/__fixtures__/v-next/outputv4/osmosis/gamm/v2/query.rpc.Query.ts @@ -1,4 +1,4 @@ -import { Rpc } from "../../../helpers.js"; +import { TxRpc } from "../../../types.js"; import { BinaryReader } from "../../../binary.js"; import { QueryClient, createProtobufRpcClient, ProtobufRpcClient } from "@cosmjs/stargate"; import { ReactQueryParams } from "../../../react-query.js"; @@ -14,8 +14,8 @@ export interface Query { spotPrice(request: QuerySpotPriceRequest): Promise; } export class QueryClientImpl implements Query { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.spotPrice = this.spotPrice.bind(this); } diff --git a/__fixtures__/v-next/outputv4/osmosis/gamm/v2/query.rpc.func.ts b/__fixtures__/v-next/outputv4/osmosis/gamm/v2/query.rpc.func.ts new file mode 100644 index 0000000000..f4061ea80a --- /dev/null +++ b/__fixtures__/v-next/outputv4/osmosis/gamm/v2/query.rpc.func.ts @@ -0,0 +1,15 @@ +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types.js"; +import { QuerySpotPriceRequest, QuerySpotPriceRequestSDKType, QuerySpotPriceResponse, QuerySpotPriceResponseSDKType } from "./query.js"; +/** + * SpotPrice defines a gRPC query handler that returns the spot price given + * a base denomination and a quote denomination. + * @name getSpotPrice + * @package osmosis.gamm.v2 + * @see proto service: osmosis.gamm.v2.SpotPrice + */ +export const getSpotPrice = buildQuery({ + encode: QuerySpotPriceRequest.encode, + decode: QuerySpotPriceResponse.decode, + service: "osmosis.gamm.v2.Query", + method: "SpotPrice" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/osmosis/ibc-rate-limit/v1beta1/query.rpc.Query.ts b/__fixtures__/v-next/outputv4/osmosis/ibc-rate-limit/v1beta1/query.rpc.Query.ts index 9603682384..a73ba056c2 100644 --- a/__fixtures__/v-next/outputv4/osmosis/ibc-rate-limit/v1beta1/query.rpc.Query.ts +++ b/__fixtures__/v-next/outputv4/osmosis/ibc-rate-limit/v1beta1/query.rpc.Query.ts @@ -1,5 +1,5 @@ import { Params, ParamsSDKType } from "./params.js"; -import { Rpc } from "../../../helpers.js"; +import { TxRpc } from "../../../types.js"; import { BinaryReader } from "../../../binary.js"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; import { QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType } from "./query.js"; @@ -12,8 +12,8 @@ export interface Query { params(request?: QueryParamsRequest): Promise; } export class QueryClientImpl implements Query { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.params = this.params.bind(this); } diff --git a/__fixtures__/v-next/outputv4/osmosis/ibc-rate-limit/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputv4/osmosis/ibc-rate-limit/v1beta1/query.rpc.func.ts new file mode 100644 index 0000000000..0d15a58e1c --- /dev/null +++ b/__fixtures__/v-next/outputv4/osmosis/ibc-rate-limit/v1beta1/query.rpc.func.ts @@ -0,0 +1,16 @@ +import { Params, ParamsSDKType } from "./params.js"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types.js"; +import { QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType } from "./query.js"; +/** + * Params defines a gRPC query method that returns the ibc-rate-limit module's + * parameters. + * @name getParams + * @package osmosis.ibcratelimit.v1beta1 + * @see proto service: osmosis.ibcratelimit.v1beta1.Params + */ +export const getParams = buildQuery({ + encode: QueryParamsRequest.encode, + decode: QueryParamsResponse.decode, + service: "osmosis.ibcratelimit.v1beta1.Query", + method: "Params" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/osmosis/incentives/query.rpc.Query.ts b/__fixtures__/v-next/outputv4/osmosis/incentives/query.rpc.Query.ts index a022665455..916c1e87f8 100644 --- a/__fixtures__/v-next/outputv4/osmosis/incentives/query.rpc.Query.ts +++ b/__fixtures__/v-next/outputv4/osmosis/incentives/query.rpc.Query.ts @@ -2,7 +2,7 @@ import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } fr import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin.js"; import { Gauge, GaugeSDKType } from "./gauge.js"; import { Duration, DurationSDKType } from "../../google/protobuf/duration.js"; -import { Rpc } from "../../helpers.js"; +import { TxRpc } from "../../types.js"; import { BinaryReader } from "../../binary.js"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; import { ModuleToDistributeCoinsRequest, ModuleToDistributeCoinsRequestSDKType, ModuleToDistributeCoinsResponse, ModuleToDistributeCoinsResponseSDKType, GaugeByIDRequest, GaugeByIDRequestSDKType, GaugeByIDResponse, GaugeByIDResponseSDKType, GaugesRequest, GaugesRequestSDKType, GaugesResponse, GaugesResponseSDKType, ActiveGaugesRequest, ActiveGaugesRequestSDKType, ActiveGaugesResponse, ActiveGaugesResponseSDKType, ActiveGaugesPerDenomRequest, ActiveGaugesPerDenomRequestSDKType, ActiveGaugesPerDenomResponse, ActiveGaugesPerDenomResponseSDKType, UpcomingGaugesRequest, UpcomingGaugesRequestSDKType, UpcomingGaugesResponse, UpcomingGaugesResponseSDKType, UpcomingGaugesPerDenomRequest, UpcomingGaugesPerDenomRequestSDKType, UpcomingGaugesPerDenomResponse, UpcomingGaugesPerDenomResponseSDKType, RewardsEstRequest, RewardsEstRequestSDKType, RewardsEstResponse, RewardsEstResponseSDKType, QueryLockableDurationsRequest, QueryLockableDurationsRequestSDKType, QueryLockableDurationsResponse, QueryLockableDurationsResponseSDKType } from "./query.js"; @@ -38,8 +38,8 @@ export interface Query { lockableDurations(request?: QueryLockableDurationsRequest): Promise; } export class QueryClientImpl implements Query { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.moduleToDistributeCoins = this.moduleToDistributeCoins.bind(this); this.gaugeByID = this.gaugeByID.bind(this); diff --git a/__fixtures__/v-next/outputv4/osmosis/incentives/query.rpc.func.ts b/__fixtures__/v-next/outputv4/osmosis/incentives/query.rpc.func.ts new file mode 100644 index 0000000000..f7e4c17772 --- /dev/null +++ b/__fixtures__/v-next/outputv4/osmosis/incentives/query.rpc.func.ts @@ -0,0 +1,118 @@ +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../cosmos/base/query/v1beta1/pagination.js"; +import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin.js"; +import { Gauge, GaugeSDKType } from "./gauge.js"; +import { Duration, DurationSDKType } from "../../google/protobuf/duration.js"; +import { EndpointOrRpc, buildQuery } from "../../helper-func-types.js"; +import { ModuleToDistributeCoinsRequest, ModuleToDistributeCoinsRequestSDKType, ModuleToDistributeCoinsResponse, ModuleToDistributeCoinsResponseSDKType, GaugeByIDRequest, GaugeByIDRequestSDKType, GaugeByIDResponse, GaugeByIDResponseSDKType, GaugesRequest, GaugesRequestSDKType, GaugesResponse, GaugesResponseSDKType, ActiveGaugesRequest, ActiveGaugesRequestSDKType, ActiveGaugesResponse, ActiveGaugesResponseSDKType, ActiveGaugesPerDenomRequest, ActiveGaugesPerDenomRequestSDKType, ActiveGaugesPerDenomResponse, ActiveGaugesPerDenomResponseSDKType, UpcomingGaugesRequest, UpcomingGaugesRequestSDKType, UpcomingGaugesResponse, UpcomingGaugesResponseSDKType, UpcomingGaugesPerDenomRequest, UpcomingGaugesPerDenomRequestSDKType, UpcomingGaugesPerDenomResponse, UpcomingGaugesPerDenomResponseSDKType, RewardsEstRequest, RewardsEstRequestSDKType, RewardsEstResponse, RewardsEstResponseSDKType, QueryLockableDurationsRequest, QueryLockableDurationsRequestSDKType, QueryLockableDurationsResponse, QueryLockableDurationsResponseSDKType } from "./query.js"; +/** + * ModuleToDistributeCoins returns coins that are going to be distributed + * @name getModuleToDistributeCoins + * @package osmosis.incentives + * @see proto service: osmosis.incentives.ModuleToDistributeCoins + */ +export const getModuleToDistributeCoins = buildQuery({ + encode: ModuleToDistributeCoinsRequest.encode, + decode: ModuleToDistributeCoinsResponse.decode, + service: "osmosis.incentives.Query", + method: "ModuleToDistributeCoins" +}); +/** + * GaugeByID returns gauges by their respective ID + * @name getGaugeByID + * @package osmosis.incentives + * @see proto service: osmosis.incentives.GaugeByID + */ +export const getGaugeByID = buildQuery({ + encode: GaugeByIDRequest.encode, + decode: GaugeByIDResponse.decode, + service: "osmosis.incentives.Query", + method: "GaugeByID" +}); +/** + * Gauges returns both upcoming and active gauges + * @name getGauges + * @package osmosis.incentives + * @see proto service: osmosis.incentives.Gauges + */ +export const getGauges = buildQuery({ + encode: GaugesRequest.encode, + decode: GaugesResponse.decode, + service: "osmosis.incentives.Query", + method: "Gauges" +}); +/** + * ActiveGauges returns active gauges + * @name getActiveGauges + * @package osmosis.incentives + * @see proto service: osmosis.incentives.ActiveGauges + */ +export const getActiveGauges = buildQuery({ + encode: ActiveGaugesRequest.encode, + decode: ActiveGaugesResponse.decode, + service: "osmosis.incentives.Query", + method: "ActiveGauges" +}); +/** + * ActiveGaugesPerDenom returns active gauges by denom + * @name getActiveGaugesPerDenom + * @package osmosis.incentives + * @see proto service: osmosis.incentives.ActiveGaugesPerDenom + */ +export const getActiveGaugesPerDenom = buildQuery({ + encode: ActiveGaugesPerDenomRequest.encode, + decode: ActiveGaugesPerDenomResponse.decode, + service: "osmosis.incentives.Query", + method: "ActiveGaugesPerDenom" +}); +/** + * Returns scheduled gauges that have not yet occured + * @name getUpcomingGauges + * @package osmosis.incentives + * @see proto service: osmosis.incentives.UpcomingGauges + */ +export const getUpcomingGauges = buildQuery({ + encode: UpcomingGaugesRequest.encode, + decode: UpcomingGaugesResponse.decode, + service: "osmosis.incentives.Query", + method: "UpcomingGauges" +}); +/** + * UpcomingGaugesPerDenom returns scheduled gauges that have not yet occured + * by denom + * @name getUpcomingGaugesPerDenom + * @package osmosis.incentives + * @see proto service: osmosis.incentives.UpcomingGaugesPerDenom + */ +export const getUpcomingGaugesPerDenom = buildQuery({ + encode: UpcomingGaugesPerDenomRequest.encode, + decode: UpcomingGaugesPerDenomResponse.decode, + service: "osmosis.incentives.Query", + method: "UpcomingGaugesPerDenom" +}); +/** + * RewardsEst returns an estimate of the rewards from now until a specified + * time in the future The querier either provides an address or a set of locks + * for which they want to find the associated rewards + * @name getRewardsEst + * @package osmosis.incentives + * @see proto service: osmosis.incentives.RewardsEst + */ +export const getRewardsEst = buildQuery({ + encode: RewardsEstRequest.encode, + decode: RewardsEstResponse.decode, + service: "osmosis.incentives.Query", + method: "RewardsEst" +}); +/** + * LockableDurations returns lockable durations that are valid to distribute + * incentives for + * @name getLockableDurations + * @package osmosis.incentives + * @see proto service: osmosis.incentives.LockableDurations + */ +export const getLockableDurations = buildQuery({ + encode: QueryLockableDurationsRequest.encode, + decode: QueryLockableDurationsResponse.decode, + service: "osmosis.incentives.Query", + method: "LockableDurations" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/osmosis/incentives/tx.registry.ts b/__fixtures__/v-next/outputv4/osmosis/incentives/tx.registry.ts index a8b1e500fe..da860be811 100644 --- a/__fixtures__/v-next/outputv4/osmosis/incentives/tx.registry.ts +++ b/__fixtures__/v-next/outputv4/osmosis/incentives/tx.registry.ts @@ -1,14 +1,9 @@ import { QueryCondition, QueryConditionSDKType } from "../lockup/lock.js"; import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin.js"; import { Timestamp, TimestampSDKType } from "../../google/protobuf/timestamp.js"; -import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { TelescopeGeneratedType } from "../../types.js"; import { MsgCreateGauge, MsgCreateGaugeSDKType, MsgAddToGauge, MsgAddToGaugeSDKType } from "./tx.js"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/osmosis.incentives.MsgCreateGauge", MsgCreateGauge], ["/osmosis.incentives.MsgAddToGauge", MsgAddToGauge]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/osmosis.incentives.MsgCreateGauge", MsgCreateGauge], ["/osmosis.incentives.MsgAddToGauge", MsgAddToGauge]]; export const MessageComposer = { encoded: { createGauge(value: MsgCreateGauge) { diff --git a/__fixtures__/v-next/outputv4/osmosis/incentives/tx.rpc.func.ts b/__fixtures__/v-next/outputv4/osmosis/incentives/tx.rpc.func.ts new file mode 100644 index 0000000000..1bd109350d --- /dev/null +++ b/__fixtures__/v-next/outputv4/osmosis/incentives/tx.rpc.func.ts @@ -0,0 +1,21 @@ +import { QueryCondition, QueryConditionSDKType } from "../lockup/lock.js"; +import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin.js"; +import { Timestamp, TimestampSDKType } from "../../google/protobuf/timestamp.js"; +import { buildTx } from "../../helper-func-types.js"; +import { MsgCreateGauge, MsgCreateGaugeSDKType, MsgCreateGaugeResponse, MsgCreateGaugeResponseSDKType, MsgAddToGauge, MsgAddToGaugeSDKType, MsgAddToGaugeResponse, MsgAddToGaugeResponseSDKType } from "./tx.js"; +/** + * @name createGauge + * @package osmosis.incentives + * @see proto service: osmosis.incentives.CreateGauge + */ +export const createGauge = buildTx({ + msg: MsgCreateGauge +}); +/** + * @name addToGauge + * @package osmosis.incentives + * @see proto service: osmosis.incentives.AddToGauge + */ +export const addToGauge = buildTx({ + msg: MsgAddToGauge +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/osmosis/incentives/tx.rpc.msg.ts b/__fixtures__/v-next/outputv4/osmosis/incentives/tx.rpc.msg.ts index cfe8c47986..62c9e421f9 100644 --- a/__fixtures__/v-next/outputv4/osmosis/incentives/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputv4/osmosis/incentives/tx.rpc.msg.ts @@ -1,7 +1,7 @@ import { QueryCondition, QueryConditionSDKType } from "../lockup/lock.js"; import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin.js"; import { Timestamp, TimestampSDKType } from "../../google/protobuf/timestamp.js"; -import { Rpc } from "../../helpers.js"; +import { TxRpc } from "../../types.js"; import { BinaryReader } from "../../binary.js"; import { MsgCreateGauge, MsgCreateGaugeSDKType, MsgCreateGaugeResponse, MsgCreateGaugeResponseSDKType, MsgAddToGauge, MsgAddToGaugeSDKType, MsgAddToGaugeResponse, MsgAddToGaugeResponseSDKType } from "./tx.js"; export interface Msg { @@ -9,8 +9,8 @@ export interface Msg { addToGauge(request: MsgAddToGauge): Promise; } export class MsgClientImpl implements Msg { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.createGauge = this.createGauge.bind(this); this.addToGauge = this.addToGauge.bind(this); @@ -26,6 +26,6 @@ export class MsgClientImpl implements Msg { return promise.then(data => MsgAddToGaugeResponse.decode(new BinaryReader(data))); } } -export const createClientImpl = (rpc: Rpc) => { +export const createClientImpl = (rpc: TxRpc) => { return new MsgClientImpl(rpc); }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/osmosis/lockup/query.rpc.Query.ts b/__fixtures__/v-next/outputv4/osmosis/lockup/query.rpc.Query.ts index 5834f9b405..5158a27e70 100644 --- a/__fixtures__/v-next/outputv4/osmosis/lockup/query.rpc.Query.ts +++ b/__fixtures__/v-next/outputv4/osmosis/lockup/query.rpc.Query.ts @@ -3,7 +3,7 @@ import { Duration, DurationSDKType } from "../../google/protobuf/duration.js"; import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin.js"; import { PeriodLock, PeriodLockSDKType, SyntheticLock, SyntheticLockSDKType } from "./lock.js"; import { Params, ParamsSDKType } from "./params.js"; -import { Rpc } from "../../helpers.js"; +import { TxRpc } from "../../types.js"; import { BinaryReader } from "../../binary.js"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; import { ModuleBalanceRequest, ModuleBalanceRequestSDKType, ModuleBalanceResponse, ModuleBalanceResponseSDKType, ModuleLockedAmountRequest, ModuleLockedAmountRequestSDKType, ModuleLockedAmountResponse, ModuleLockedAmountResponseSDKType, AccountUnlockableCoinsRequest, AccountUnlockableCoinsRequestSDKType, AccountUnlockableCoinsResponse, AccountUnlockableCoinsResponseSDKType, AccountUnlockingCoinsRequest, AccountUnlockingCoinsRequestSDKType, AccountUnlockingCoinsResponse, AccountUnlockingCoinsResponseSDKType, AccountLockedCoinsRequest, AccountLockedCoinsRequestSDKType, AccountLockedCoinsResponse, AccountLockedCoinsResponseSDKType, AccountLockedPastTimeRequest, AccountLockedPastTimeRequestSDKType, AccountLockedPastTimeResponse, AccountLockedPastTimeResponseSDKType, AccountLockedPastTimeNotUnlockingOnlyRequest, AccountLockedPastTimeNotUnlockingOnlyRequestSDKType, AccountLockedPastTimeNotUnlockingOnlyResponse, AccountLockedPastTimeNotUnlockingOnlyResponseSDKType, AccountUnlockedBeforeTimeRequest, AccountUnlockedBeforeTimeRequestSDKType, AccountUnlockedBeforeTimeResponse, AccountUnlockedBeforeTimeResponseSDKType, AccountLockedPastTimeDenomRequest, AccountLockedPastTimeDenomRequestSDKType, AccountLockedPastTimeDenomResponse, AccountLockedPastTimeDenomResponseSDKType, LockedDenomRequest, LockedDenomRequestSDKType, LockedDenomResponse, LockedDenomResponseSDKType, LockedRequest, LockedRequestSDKType, LockedResponse, LockedResponseSDKType, SyntheticLockupsByLockupIDRequest, SyntheticLockupsByLockupIDRequestSDKType, SyntheticLockupsByLockupIDResponse, SyntheticLockupsByLockupIDResponseSDKType, AccountLockedLongerDurationRequest, AccountLockedLongerDurationRequestSDKType, AccountLockedLongerDurationResponse, AccountLockedLongerDurationResponseSDKType, AccountLockedDurationRequest, AccountLockedDurationRequestSDKType, AccountLockedDurationResponse, AccountLockedDurationResponseSDKType, AccountLockedLongerDurationNotUnlockingOnlyRequest, AccountLockedLongerDurationNotUnlockingOnlyRequestSDKType, AccountLockedLongerDurationNotUnlockingOnlyResponse, AccountLockedLongerDurationNotUnlockingOnlyResponseSDKType, AccountLockedLongerDurationDenomRequest, AccountLockedLongerDurationDenomRequestSDKType, AccountLockedLongerDurationDenomResponse, AccountLockedLongerDurationDenomResponseSDKType, QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType } from "./query.js"; @@ -51,8 +51,8 @@ export interface Query { params(request?: QueryParamsRequest): Promise; } export class QueryClientImpl implements Query { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.moduleBalance = this.moduleBalance.bind(this); this.moduleLockedAmount = this.moduleLockedAmount.bind(this); diff --git a/__fixtures__/v-next/outputv4/osmosis/lockup/query.rpc.func.ts b/__fixtures__/v-next/outputv4/osmosis/lockup/query.rpc.func.ts new file mode 100644 index 0000000000..1339035718 --- /dev/null +++ b/__fixtures__/v-next/outputv4/osmosis/lockup/query.rpc.func.ts @@ -0,0 +1,213 @@ +import { Timestamp, TimestampSDKType } from "../../google/protobuf/timestamp.js"; +import { Duration, DurationSDKType } from "../../google/protobuf/duration.js"; +import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin.js"; +import { PeriodLock, PeriodLockSDKType, SyntheticLock, SyntheticLockSDKType } from "./lock.js"; +import { Params, ParamsSDKType } from "./params.js"; +import { EndpointOrRpc, buildQuery } from "../../helper-func-types.js"; +import { ModuleBalanceRequest, ModuleBalanceRequestSDKType, ModuleBalanceResponse, ModuleBalanceResponseSDKType, ModuleLockedAmountRequest, ModuleLockedAmountRequestSDKType, ModuleLockedAmountResponse, ModuleLockedAmountResponseSDKType, AccountUnlockableCoinsRequest, AccountUnlockableCoinsRequestSDKType, AccountUnlockableCoinsResponse, AccountUnlockableCoinsResponseSDKType, AccountUnlockingCoinsRequest, AccountUnlockingCoinsRequestSDKType, AccountUnlockingCoinsResponse, AccountUnlockingCoinsResponseSDKType, AccountLockedCoinsRequest, AccountLockedCoinsRequestSDKType, AccountLockedCoinsResponse, AccountLockedCoinsResponseSDKType, AccountLockedPastTimeRequest, AccountLockedPastTimeRequestSDKType, AccountLockedPastTimeResponse, AccountLockedPastTimeResponseSDKType, AccountLockedPastTimeNotUnlockingOnlyRequest, AccountLockedPastTimeNotUnlockingOnlyRequestSDKType, AccountLockedPastTimeNotUnlockingOnlyResponse, AccountLockedPastTimeNotUnlockingOnlyResponseSDKType, AccountUnlockedBeforeTimeRequest, AccountUnlockedBeforeTimeRequestSDKType, AccountUnlockedBeforeTimeResponse, AccountUnlockedBeforeTimeResponseSDKType, AccountLockedPastTimeDenomRequest, AccountLockedPastTimeDenomRequestSDKType, AccountLockedPastTimeDenomResponse, AccountLockedPastTimeDenomResponseSDKType, LockedDenomRequest, LockedDenomRequestSDKType, LockedDenomResponse, LockedDenomResponseSDKType, LockedRequest, LockedRequestSDKType, LockedResponse, LockedResponseSDKType, SyntheticLockupsByLockupIDRequest, SyntheticLockupsByLockupIDRequestSDKType, SyntheticLockupsByLockupIDResponse, SyntheticLockupsByLockupIDResponseSDKType, AccountLockedLongerDurationRequest, AccountLockedLongerDurationRequestSDKType, AccountLockedLongerDurationResponse, AccountLockedLongerDurationResponseSDKType, AccountLockedDurationRequest, AccountLockedDurationRequestSDKType, AccountLockedDurationResponse, AccountLockedDurationResponseSDKType, AccountLockedLongerDurationNotUnlockingOnlyRequest, AccountLockedLongerDurationNotUnlockingOnlyRequestSDKType, AccountLockedLongerDurationNotUnlockingOnlyResponse, AccountLockedLongerDurationNotUnlockingOnlyResponseSDKType, AccountLockedLongerDurationDenomRequest, AccountLockedLongerDurationDenomRequestSDKType, AccountLockedLongerDurationDenomResponse, AccountLockedLongerDurationDenomResponseSDKType, QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType } from "./query.js"; +/** + * Return full balance of the module + * @name getModuleBalance + * @package osmosis.lockup + * @see proto service: osmosis.lockup.ModuleBalance + */ +export const getModuleBalance = buildQuery({ + encode: ModuleBalanceRequest.encode, + decode: ModuleBalanceResponse.decode, + service: "osmosis.lockup.Query", + method: "ModuleBalance" +}); +/** + * Return locked balance of the module + * @name getModuleLockedAmount + * @package osmosis.lockup + * @see proto service: osmosis.lockup.ModuleLockedAmount + */ +export const getModuleLockedAmount = buildQuery({ + encode: ModuleLockedAmountRequest.encode, + decode: ModuleLockedAmountResponse.decode, + service: "osmosis.lockup.Query", + method: "ModuleLockedAmount" +}); +/** + * Returns unlockable coins which are not withdrawn yet + * @name getAccountUnlockableCoins + * @package osmosis.lockup + * @see proto service: osmosis.lockup.AccountUnlockableCoins + */ +export const getAccountUnlockableCoins = buildQuery({ + encode: AccountUnlockableCoinsRequest.encode, + decode: AccountUnlockableCoinsResponse.decode, + service: "osmosis.lockup.Query", + method: "AccountUnlockableCoins" +}); +/** + * Returns unlocking coins + * @name getAccountUnlockingCoins + * @package osmosis.lockup + * @see proto service: osmosis.lockup.AccountUnlockingCoins + */ +export const getAccountUnlockingCoins = buildQuery({ + encode: AccountUnlockingCoinsRequest.encode, + decode: AccountUnlockingCoinsResponse.decode, + service: "osmosis.lockup.Query", + method: "AccountUnlockingCoins" +}); +/** + * Return a locked coins that can't be withdrawn + * @name getAccountLockedCoins + * @package osmosis.lockup + * @see proto service: osmosis.lockup.AccountLockedCoins + */ +export const getAccountLockedCoins = buildQuery({ + encode: AccountLockedCoinsRequest.encode, + decode: AccountLockedCoinsResponse.decode, + service: "osmosis.lockup.Query", + method: "AccountLockedCoins" +}); +/** + * Returns locked records of an account with unlock time beyond timestamp + * @name getAccountLockedPastTime + * @package osmosis.lockup + * @see proto service: osmosis.lockup.AccountLockedPastTime + */ +export const getAccountLockedPastTime = buildQuery({ + encode: AccountLockedPastTimeRequest.encode, + decode: AccountLockedPastTimeResponse.decode, + service: "osmosis.lockup.Query", + method: "AccountLockedPastTime" +}); +/** + * Returns locked records of an account with unlock time beyond timestamp + * excluding tokens started unlocking + * @name getAccountLockedPastTimeNotUnlockingOnly + * @package osmosis.lockup + * @see proto service: osmosis.lockup.AccountLockedPastTimeNotUnlockingOnly + */ +export const getAccountLockedPastTimeNotUnlockingOnly = buildQuery({ + encode: AccountLockedPastTimeNotUnlockingOnlyRequest.encode, + decode: AccountLockedPastTimeNotUnlockingOnlyResponse.decode, + service: "osmosis.lockup.Query", + method: "AccountLockedPastTimeNotUnlockingOnly" +}); +/** + * Returns unlocked records with unlock time before timestamp + * @name getAccountUnlockedBeforeTime + * @package osmosis.lockup + * @see proto service: osmosis.lockup.AccountUnlockedBeforeTime + */ +export const getAccountUnlockedBeforeTime = buildQuery({ + encode: AccountUnlockedBeforeTimeRequest.encode, + decode: AccountUnlockedBeforeTimeResponse.decode, + service: "osmosis.lockup.Query", + method: "AccountUnlockedBeforeTime" +}); +/** + * Returns lock records by address, timestamp, denom + * @name getAccountLockedPastTimeDenom + * @package osmosis.lockup + * @see proto service: osmosis.lockup.AccountLockedPastTimeDenom + */ +export const getAccountLockedPastTimeDenom = buildQuery({ + encode: AccountLockedPastTimeDenomRequest.encode, + decode: AccountLockedPastTimeDenomResponse.decode, + service: "osmosis.lockup.Query", + method: "AccountLockedPastTimeDenom" +}); +/** + * Returns total locked per denom with longer past given time + * @name getLockedDenom + * @package osmosis.lockup + * @see proto service: osmosis.lockup.LockedDenom + */ +export const getLockedDenom = buildQuery({ + encode: LockedDenomRequest.encode, + decode: LockedDenomResponse.decode, + service: "osmosis.lockup.Query", + method: "LockedDenom" +}); +/** + * Returns lock record by id + * @name getLockedByID + * @package osmosis.lockup + * @see proto service: osmosis.lockup.LockedByID + */ +export const getLockedByID = buildQuery({ + encode: LockedRequest.encode, + decode: LockedResponse.decode, + service: "osmosis.lockup.Query", + method: "LockedByID" +}); +/** + * Returns synthetic lockups by native lockup id + * @name getSyntheticLockupsByLockupID + * @package osmosis.lockup + * @see proto service: osmosis.lockup.SyntheticLockupsByLockupID + */ +export const getSyntheticLockupsByLockupID = buildQuery({ + encode: SyntheticLockupsByLockupIDRequest.encode, + decode: SyntheticLockupsByLockupIDResponse.decode, + service: "osmosis.lockup.Query", + method: "SyntheticLockupsByLockupID" +}); +/** + * Returns account locked records with longer duration + * @name getAccountLockedLongerDuration + * @package osmosis.lockup + * @see proto service: osmosis.lockup.AccountLockedLongerDuration + */ +export const getAccountLockedLongerDuration = buildQuery({ + encode: AccountLockedLongerDurationRequest.encode, + decode: AccountLockedLongerDurationResponse.decode, + service: "osmosis.lockup.Query", + method: "AccountLockedLongerDuration" +}); +/** + * Returns account locked records with a specific duration + * @name getAccountLockedDuration + * @package osmosis.lockup + * @see proto service: osmosis.lockup.AccountLockedDuration + */ +export const getAccountLockedDuration = buildQuery({ + encode: AccountLockedDurationRequest.encode, + decode: AccountLockedDurationResponse.decode, + service: "osmosis.lockup.Query", + method: "AccountLockedDuration" +}); +/** + * Returns account locked records with longer duration excluding tokens + * started unlocking + * @name getAccountLockedLongerDurationNotUnlockingOnly + * @package osmosis.lockup + * @see proto service: osmosis.lockup.AccountLockedLongerDurationNotUnlockingOnly + */ +export const getAccountLockedLongerDurationNotUnlockingOnly = buildQuery({ + encode: AccountLockedLongerDurationNotUnlockingOnlyRequest.encode, + decode: AccountLockedLongerDurationNotUnlockingOnlyResponse.decode, + service: "osmosis.lockup.Query", + method: "AccountLockedLongerDurationNotUnlockingOnly" +}); +/** + * Returns account's locked records for a denom with longer duration + * @name getAccountLockedLongerDurationDenom + * @package osmosis.lockup + * @see proto service: osmosis.lockup.AccountLockedLongerDurationDenom + */ +export const getAccountLockedLongerDurationDenom = buildQuery({ + encode: AccountLockedLongerDurationDenomRequest.encode, + decode: AccountLockedLongerDurationDenomResponse.decode, + service: "osmosis.lockup.Query", + method: "AccountLockedLongerDurationDenom" +}); +/** + * Params returns lockup params. + * @name getParams + * @package osmosis.lockup + * @see proto service: osmosis.lockup.Params + */ +export const getParams = buildQuery({ + encode: QueryParamsRequest.encode, + decode: QueryParamsResponse.decode, + service: "osmosis.lockup.Query", + method: "Params" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/osmosis/lockup/tx.registry.ts b/__fixtures__/v-next/outputv4/osmosis/lockup/tx.registry.ts index 6c9c0035d2..ddb6a7b340 100644 --- a/__fixtures__/v-next/outputv4/osmosis/lockup/tx.registry.ts +++ b/__fixtures__/v-next/outputv4/osmosis/lockup/tx.registry.ts @@ -1,14 +1,9 @@ import { Duration, DurationSDKType } from "../../google/protobuf/duration.js"; import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin.js"; import { PeriodLock, PeriodLockSDKType } from "./lock.js"; -import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { TelescopeGeneratedType } from "../../types.js"; import { MsgLockTokens, MsgLockTokensSDKType, MsgBeginUnlockingAll, MsgBeginUnlockingAllSDKType, MsgBeginUnlocking, MsgBeginUnlockingSDKType, MsgExtendLockup, MsgExtendLockupSDKType, MsgForceUnlock, MsgForceUnlockSDKType } from "./tx.js"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/osmosis.lockup.MsgLockTokens", MsgLockTokens], ["/osmosis.lockup.MsgBeginUnlockingAll", MsgBeginUnlockingAll], ["/osmosis.lockup.MsgBeginUnlocking", MsgBeginUnlocking], ["/osmosis.lockup.MsgExtendLockup", MsgExtendLockup], ["/osmosis.lockup.MsgForceUnlock", MsgForceUnlock]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/osmosis.lockup.MsgLockTokens", MsgLockTokens], ["/osmosis.lockup.MsgBeginUnlockingAll", MsgBeginUnlockingAll], ["/osmosis.lockup.MsgBeginUnlocking", MsgBeginUnlocking], ["/osmosis.lockup.MsgExtendLockup", MsgExtendLockup], ["/osmosis.lockup.MsgForceUnlock", MsgForceUnlock]]; export const MessageComposer = { encoded: { lockTokens(value: MsgLockTokens) { diff --git a/__fixtures__/v-next/outputv4/osmosis/lockup/tx.rpc.func.ts b/__fixtures__/v-next/outputv4/osmosis/lockup/tx.rpc.func.ts new file mode 100644 index 0000000000..6adf4628f0 --- /dev/null +++ b/__fixtures__/v-next/outputv4/osmosis/lockup/tx.rpc.func.ts @@ -0,0 +1,49 @@ +import { Duration, DurationSDKType } from "../../google/protobuf/duration.js"; +import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin.js"; +import { PeriodLock, PeriodLockSDKType } from "./lock.js"; +import { buildTx } from "../../helper-func-types.js"; +import { MsgLockTokens, MsgLockTokensSDKType, MsgLockTokensResponse, MsgLockTokensResponseSDKType, MsgBeginUnlockingAll, MsgBeginUnlockingAllSDKType, MsgBeginUnlockingAllResponse, MsgBeginUnlockingAllResponseSDKType, MsgBeginUnlocking, MsgBeginUnlockingSDKType, MsgBeginUnlockingResponse, MsgBeginUnlockingResponseSDKType, MsgExtendLockup, MsgExtendLockupSDKType, MsgExtendLockupResponse, MsgExtendLockupResponseSDKType, MsgForceUnlock, MsgForceUnlockSDKType, MsgForceUnlockResponse, MsgForceUnlockResponseSDKType } from "./tx.js"; +/** + * LockTokens lock tokens + * @name lockTokens + * @package osmosis.lockup + * @see proto service: osmosis.lockup.LockTokens + */ +export const lockTokens = buildTx({ + msg: MsgLockTokens +}); +/** + * BeginUnlockingAll begin unlocking all tokens + * @name beginUnlockingAll + * @package osmosis.lockup + * @see proto service: osmosis.lockup.BeginUnlockingAll + */ +export const beginUnlockingAll = buildTx({ + msg: MsgBeginUnlockingAll +}); +/** + * MsgBeginUnlocking begins unlocking tokens by lock ID + * @name beginUnlocking + * @package osmosis.lockup + * @see proto service: osmosis.lockup.BeginUnlocking + */ +export const beginUnlocking = buildTx({ + msg: MsgBeginUnlocking +}); +/** + * MsgEditLockup edits the existing lockups by lock ID + * @name extendLockup + * @package osmosis.lockup + * @see proto service: osmosis.lockup.ExtendLockup + */ +export const extendLockup = buildTx({ + msg: MsgExtendLockup +}); +/** + * @name forceUnlock + * @package osmosis.lockup + * @see proto service: osmosis.lockup.ForceUnlock + */ +export const forceUnlock = buildTx({ + msg: MsgForceUnlock +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/osmosis/lockup/tx.rpc.msg.ts b/__fixtures__/v-next/outputv4/osmosis/lockup/tx.rpc.msg.ts index 4f4ea38f2d..74fb61667f 100644 --- a/__fixtures__/v-next/outputv4/osmosis/lockup/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputv4/osmosis/lockup/tx.rpc.msg.ts @@ -1,7 +1,7 @@ import { Duration, DurationSDKType } from "../../google/protobuf/duration.js"; import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin.js"; import { PeriodLock, PeriodLockSDKType } from "./lock.js"; -import { Rpc } from "../../helpers.js"; +import { TxRpc } from "../../types.js"; import { BinaryReader } from "../../binary.js"; import { MsgLockTokens, MsgLockTokensSDKType, MsgLockTokensResponse, MsgLockTokensResponseSDKType, MsgBeginUnlockingAll, MsgBeginUnlockingAllSDKType, MsgBeginUnlockingAllResponse, MsgBeginUnlockingAllResponseSDKType, MsgBeginUnlocking, MsgBeginUnlockingSDKType, MsgBeginUnlockingResponse, MsgBeginUnlockingResponseSDKType, MsgExtendLockup, MsgExtendLockupSDKType, MsgExtendLockupResponse, MsgExtendLockupResponseSDKType, MsgForceUnlock, MsgForceUnlockSDKType, MsgForceUnlockResponse, MsgForceUnlockResponseSDKType } from "./tx.js"; /** Msg defines the Msg service. */ @@ -17,8 +17,8 @@ export interface Msg { forceUnlock(request: MsgForceUnlock): Promise; } export class MsgClientImpl implements Msg { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.lockTokens = this.lockTokens.bind(this); this.beginUnlockingAll = this.beginUnlockingAll.bind(this); @@ -52,6 +52,6 @@ export class MsgClientImpl implements Msg { return promise.then(data => MsgForceUnlockResponse.decode(new BinaryReader(data))); } } -export const createClientImpl = (rpc: Rpc) => { +export const createClientImpl = (rpc: TxRpc) => { return new MsgClientImpl(rpc); }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/osmosis/mint/v1beta1/mint.ts b/__fixtures__/v-next/outputv4/osmosis/mint/v1beta1/mint.ts index e706e1bc6a..897d17938f 100644 --- a/__fixtures__/v-next/outputv4/osmosis/mint/v1beta1/mint.ts +++ b/__fixtures__/v-next/outputv4/osmosis/mint/v1beta1/mint.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary.js"; -import { Decimal } from "@cosmjs/math"; +import { Decimal } from "@interchainjs/math"; import { isSet, DeepPartial } from "../../../helpers.js"; import { JsonSafe } from "../../../json-safe.js"; export const protobufPackage = "osmosis.mint.v1beta1"; @@ -247,7 +247,7 @@ export const Minter = { }, toAmino(message: Minter): MinterAmino { const obj: any = {}; - obj.epoch_provisions = message.epochProvisions === "" ? undefined : message.epochProvisions; + obj.epoch_provisions = message.epochProvisions === "" ? undefined : Decimal.fromUserInput(message.epochProvisions, 18).atomics; return obj; }, fromAminoMsg(object: MinterAminoMsg): Minter { @@ -366,7 +366,7 @@ export const WeightedAddress = { toAmino(message: WeightedAddress): WeightedAddressAmino { const obj: any = {}; obj.address = message.address === "" ? undefined : message.address; - obj.weight = message.weight === "" ? undefined : message.weight; + obj.weight = message.weight === "" ? undefined : Decimal.fromUserInput(message.weight, 18).atomics; return obj; }, fromAminoMsg(object: WeightedAddressAminoMsg): WeightedAddress { @@ -516,10 +516,10 @@ export const DistributionProportions = { }, toAmino(message: DistributionProportions): DistributionProportionsAmino { const obj: any = {}; - obj.staking = message.staking === "" ? undefined : message.staking; - obj.pool_incentives = message.poolIncentives === "" ? undefined : message.poolIncentives; - obj.developer_rewards = message.developerRewards === "" ? undefined : message.developerRewards; - obj.community_pool = message.communityPool === "" ? undefined : message.communityPool; + obj.staking = message.staking === "" ? undefined : Decimal.fromUserInput(message.staking, 18).atomics; + obj.pool_incentives = message.poolIncentives === "" ? undefined : Decimal.fromUserInput(message.poolIncentives, 18).atomics; + obj.developer_rewards = message.developerRewards === "" ? undefined : Decimal.fromUserInput(message.developerRewards, 18).atomics; + obj.community_pool = message.communityPool === "" ? undefined : Decimal.fromUserInput(message.communityPool, 18).atomics; return obj; }, fromAminoMsg(object: DistributionProportionsAminoMsg): DistributionProportions { @@ -744,10 +744,10 @@ export const Params = { toAmino(message: Params): ParamsAmino { const obj: any = {}; obj.mint_denom = message.mintDenom === "" ? undefined : message.mintDenom; - obj.genesis_epoch_provisions = message.genesisEpochProvisions === "" ? undefined : message.genesisEpochProvisions; + obj.genesis_epoch_provisions = message.genesisEpochProvisions === "" ? undefined : Decimal.fromUserInput(message.genesisEpochProvisions, 18).atomics; obj.epoch_identifier = message.epochIdentifier === "" ? undefined : message.epochIdentifier; obj.reduction_period_in_epochs = message.reductionPeriodInEpochs !== BigInt(0) ? message.reductionPeriodInEpochs?.toString() : undefined; - obj.reduction_factor = message.reductionFactor === "" ? undefined : message.reductionFactor; + obj.reduction_factor = message.reductionFactor === "" ? undefined : Decimal.fromUserInput(message.reductionFactor, 18).atomics; obj.distribution_proportions = message.distributionProportions ? DistributionProportions.toAmino(message.distributionProportions) : undefined; if (message.weightedDeveloperRewardsReceivers) { obj.weighted_developer_rewards_receivers = message.weightedDeveloperRewardsReceivers.map(e => e ? WeightedAddress.toAmino(e) : undefined); diff --git a/__fixtures__/v-next/outputv4/osmosis/mint/v1beta1/query.rpc.Query.ts b/__fixtures__/v-next/outputv4/osmosis/mint/v1beta1/query.rpc.Query.ts index 9b797c4f59..867874a977 100644 --- a/__fixtures__/v-next/outputv4/osmosis/mint/v1beta1/query.rpc.Query.ts +++ b/__fixtures__/v-next/outputv4/osmosis/mint/v1beta1/query.rpc.Query.ts @@ -1,5 +1,5 @@ import { Params, ParamsSDKType } from "./mint.js"; -import { Rpc } from "../../../helpers.js"; +import { TxRpc } from "../../../types.js"; import { BinaryReader } from "../../../binary.js"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; import { QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, QueryEpochProvisionsRequest, QueryEpochProvisionsRequestSDKType, QueryEpochProvisionsResponse, QueryEpochProvisionsResponseSDKType } from "./query.js"; @@ -11,8 +11,8 @@ export interface Query { epochProvisions(request?: QueryEpochProvisionsRequest): Promise; } export class QueryClientImpl implements Query { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.params = this.params.bind(this); this.epochProvisions = this.epochProvisions.bind(this); diff --git a/__fixtures__/v-next/outputv4/osmosis/mint/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputv4/osmosis/mint/v1beta1/query.rpc.func.ts new file mode 100644 index 0000000000..dad62832b4 --- /dev/null +++ b/__fixtures__/v-next/outputv4/osmosis/mint/v1beta1/query.rpc.func.ts @@ -0,0 +1,27 @@ +import { Params, ParamsSDKType } from "./mint.js"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types.js"; +import { QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, QueryEpochProvisionsRequest, QueryEpochProvisionsRequestSDKType, QueryEpochProvisionsResponse, QueryEpochProvisionsResponseSDKType } from "./query.js"; +/** + * Params returns the total set of minting parameters. + * @name getParams + * @package osmosis.mint.v1beta1 + * @see proto service: osmosis.mint.v1beta1.Params + */ +export const getParams = buildQuery({ + encode: QueryParamsRequest.encode, + decode: QueryParamsResponse.decode, + service: "osmosis.mint.v1beta1.Query", + method: "Params" +}); +/** + * EpochProvisions returns the current minting epoch provisions value. + * @name getEpochProvisions + * @package osmosis.mint.v1beta1 + * @see proto service: osmosis.mint.v1beta1.EpochProvisions + */ +export const getEpochProvisions = buildQuery({ + encode: QueryEpochProvisionsRequest.encode, + decode: QueryEpochProvisionsResponse.decode, + service: "osmosis.mint.v1beta1.Query", + method: "EpochProvisions" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/osmosis/pool-incentives/v1beta1/query.rpc.Query.ts b/__fixtures__/v-next/outputv4/osmosis/pool-incentives/v1beta1/query.rpc.Query.ts index 6e0c2c74dd..7b295c6b91 100644 --- a/__fixtures__/v-next/outputv4/osmosis/pool-incentives/v1beta1/query.rpc.Query.ts +++ b/__fixtures__/v-next/outputv4/osmosis/pool-incentives/v1beta1/query.rpc.Query.ts @@ -1,7 +1,7 @@ import { Duration, DurationSDKType } from "../../../google/protobuf/duration.js"; import { DistrInfo, DistrInfoSDKType, Params, ParamsSDKType } from "./incentives.js"; import { Gauge, GaugeSDKType } from "../../incentives/gauge.js"; -import { Rpc } from "../../../helpers.js"; +import { TxRpc } from "../../../types.js"; import { BinaryReader } from "../../../binary.js"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; import { QueryGaugeIdsRequest, QueryGaugeIdsRequestSDKType, QueryGaugeIdsResponse, QueryGaugeIdsResponseSDKType, QueryDistrInfoRequest, QueryDistrInfoRequestSDKType, QueryDistrInfoResponse, QueryDistrInfoResponseSDKType, QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, QueryLockableDurationsRequest, QueryLockableDurationsRequestSDKType, QueryLockableDurationsResponse, QueryLockableDurationsResponseSDKType, QueryIncentivizedPoolsRequest, QueryIncentivizedPoolsRequestSDKType, QueryIncentivizedPoolsResponse, QueryIncentivizedPoolsResponseSDKType, QueryExternalIncentiveGaugesRequest, QueryExternalIncentiveGaugesRequestSDKType, QueryExternalIncentiveGaugesResponse, QueryExternalIncentiveGaugesResponseSDKType } from "./query.js"; @@ -20,8 +20,8 @@ export interface Query { externalIncentiveGauges(request?: QueryExternalIncentiveGaugesRequest): Promise; } export class QueryClientImpl implements Query { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.gaugeIds = this.gaugeIds.bind(this); this.distrInfo = this.distrInfo.bind(this); diff --git a/__fixtures__/v-next/outputv4/osmosis/pool-incentives/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputv4/osmosis/pool-incentives/v1beta1/query.rpc.func.ts new file mode 100644 index 0000000000..8c96aec66d --- /dev/null +++ b/__fixtures__/v-next/outputv4/osmosis/pool-incentives/v1beta1/query.rpc.func.ts @@ -0,0 +1,77 @@ +import { Duration, DurationSDKType } from "../../../google/protobuf/duration.js"; +import { DistrInfo, DistrInfoSDKType, Params, ParamsSDKType } from "./incentives.js"; +import { Gauge, GaugeSDKType } from "../../incentives/gauge.js"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types.js"; +import { QueryGaugeIdsRequest, QueryGaugeIdsRequestSDKType, QueryGaugeIdsResponse, QueryGaugeIdsResponseSDKType, QueryDistrInfoRequest, QueryDistrInfoRequestSDKType, QueryDistrInfoResponse, QueryDistrInfoResponseSDKType, QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, QueryLockableDurationsRequest, QueryLockableDurationsRequestSDKType, QueryLockableDurationsResponse, QueryLockableDurationsResponseSDKType, QueryIncentivizedPoolsRequest, QueryIncentivizedPoolsRequestSDKType, QueryIncentivizedPoolsResponse, QueryIncentivizedPoolsResponseSDKType, QueryExternalIncentiveGaugesRequest, QueryExternalIncentiveGaugesRequestSDKType, QueryExternalIncentiveGaugesResponse, QueryExternalIncentiveGaugesResponseSDKType } from "./query.js"; +/** + * GaugeIds takes the pool id and returns the matching gauge ids and durations + * @name getGaugeIds + * @package osmosis.poolincentives.v1beta1 + * @see proto service: osmosis.poolincentives.v1beta1.GaugeIds + */ +export const getGaugeIds = buildQuery({ + encode: QueryGaugeIdsRequest.encode, + decode: QueryGaugeIdsResponse.decode, + service: "osmosis.poolincentives.v1beta1.Query", + method: "GaugeIds" +}); +/** + * DistrInfo returns the pool's matching gauge ids and weights. + * @name getDistrInfo + * @package osmosis.poolincentives.v1beta1 + * @see proto service: osmosis.poolincentives.v1beta1.DistrInfo + */ +export const getDistrInfo = buildQuery({ + encode: QueryDistrInfoRequest.encode, + decode: QueryDistrInfoResponse.decode, + service: "osmosis.poolincentives.v1beta1.Query", + method: "DistrInfo" +}); +/** + * Params returns pool incentives params. + * @name getParams + * @package osmosis.poolincentives.v1beta1 + * @see proto service: osmosis.poolincentives.v1beta1.Params + */ +export const getParams = buildQuery({ + encode: QueryParamsRequest.encode, + decode: QueryParamsResponse.decode, + service: "osmosis.poolincentives.v1beta1.Query", + method: "Params" +}); +/** + * LockableDurations returns lock durations for pools. + * @name getLockableDurations + * @package osmosis.poolincentives.v1beta1 + * @see proto service: osmosis.poolincentives.v1beta1.LockableDurations + */ +export const getLockableDurations = buildQuery({ + encode: QueryLockableDurationsRequest.encode, + decode: QueryLockableDurationsResponse.decode, + service: "osmosis.poolincentives.v1beta1.Query", + method: "LockableDurations" +}); +/** + * IncentivizedPools returns currently incentivized pools + * @name getIncentivizedPools + * @package osmosis.poolincentives.v1beta1 + * @see proto service: osmosis.poolincentives.v1beta1.IncentivizedPools + */ +export const getIncentivizedPools = buildQuery({ + encode: QueryIncentivizedPoolsRequest.encode, + decode: QueryIncentivizedPoolsResponse.decode, + service: "osmosis.poolincentives.v1beta1.Query", + method: "IncentivizedPools" +}); +/** + * ExternalIncentiveGauges returns external incentive gauges. + * @name getExternalIncentiveGauges + * @package osmosis.poolincentives.v1beta1 + * @see proto service: osmosis.poolincentives.v1beta1.ExternalIncentiveGauges + */ +export const getExternalIncentiveGauges = buildQuery({ + encode: QueryExternalIncentiveGaugesRequest.encode, + decode: QueryExternalIncentiveGaugesResponse.decode, + service: "osmosis.poolincentives.v1beta1.Query", + method: "ExternalIncentiveGauges" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/osmosis/superfluid/params.ts b/__fixtures__/v-next/outputv4/osmosis/superfluid/params.ts index 2739502266..37c4e2dcd4 100644 --- a/__fixtures__/v-next/outputv4/osmosis/superfluid/params.ts +++ b/__fixtures__/v-next/outputv4/osmosis/superfluid/params.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary.js"; -import { Decimal } from "@cosmjs/math"; +import { Decimal } from "@interchainjs/math"; import { isSet, DeepPartial } from "../../helpers.js"; import { JsonSafe } from "../../json-safe.js"; export const protobufPackage = "osmosis.superfluid"; @@ -106,7 +106,7 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.minimum_risk_factor = message.minimumRiskFactor === "" ? undefined : message.minimumRiskFactor; + obj.minimum_risk_factor = message.minimumRiskFactor === "" ? undefined : Decimal.fromUserInput(message.minimumRiskFactor, 18).atomics; return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputv4/osmosis/superfluid/query.rpc.Query.ts b/__fixtures__/v-next/outputv4/osmosis/superfluid/query.rpc.Query.ts index ff4204896d..6ebfc5166a 100644 --- a/__fixtures__/v-next/outputv4/osmosis/superfluid/query.rpc.Query.ts +++ b/__fixtures__/v-next/outputv4/osmosis/superfluid/query.rpc.Query.ts @@ -4,7 +4,7 @@ import { SuperfluidAssetType, SuperfluidAssetTypeSDKType, SuperfluidAsset, Super import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin.js"; import { SyntheticLock, SyntheticLockSDKType } from "../lockup/lock.js"; import { DelegationResponse, DelegationResponseSDKType } from "../../cosmos/staking/v1beta1/staking.js"; -import { Rpc } from "../../helpers.js"; +import { TxRpc } from "../../types.js"; import { BinaryReader } from "../../binary.js"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; import { QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, AssetTypeRequest, AssetTypeRequestSDKType, AssetTypeResponse, AssetTypeResponseSDKType, AllAssetsRequest, AllAssetsRequestSDKType, AllAssetsResponse, AllAssetsResponseSDKType, AssetMultiplierRequest, AssetMultiplierRequestSDKType, AssetMultiplierResponse, AssetMultiplierResponseSDKType, AllIntermediaryAccountsRequest, AllIntermediaryAccountsRequestSDKType, AllIntermediaryAccountsResponse, AllIntermediaryAccountsResponseSDKType, ConnectedIntermediaryAccountRequest, ConnectedIntermediaryAccountRequestSDKType, ConnectedIntermediaryAccountResponse, ConnectedIntermediaryAccountResponseSDKType, QueryTotalDelegationByValidatorForDenomRequest, QueryTotalDelegationByValidatorForDenomRequestSDKType, QueryTotalDelegationByValidatorForDenomResponse, QueryTotalDelegationByValidatorForDenomResponseSDKType, TotalSuperfluidDelegationsRequest, TotalSuperfluidDelegationsRequestSDKType, TotalSuperfluidDelegationsResponse, TotalSuperfluidDelegationsResponseSDKType, SuperfluidDelegationAmountRequest, SuperfluidDelegationAmountRequestSDKType, SuperfluidDelegationAmountResponse, SuperfluidDelegationAmountResponseSDKType, SuperfluidDelegationsByDelegatorRequest, SuperfluidDelegationsByDelegatorRequestSDKType, SuperfluidDelegationsByDelegatorResponse, SuperfluidDelegationsByDelegatorResponseSDKType, SuperfluidUndelegationsByDelegatorRequest, SuperfluidUndelegationsByDelegatorRequestSDKType, SuperfluidUndelegationsByDelegatorResponse, SuperfluidUndelegationsByDelegatorResponseSDKType, SuperfluidDelegationsByValidatorDenomRequest, SuperfluidDelegationsByValidatorDenomRequestSDKType, SuperfluidDelegationsByValidatorDenomResponse, SuperfluidDelegationsByValidatorDenomResponseSDKType, EstimateSuperfluidDelegatedAmountByValidatorDenomRequest, EstimateSuperfluidDelegatedAmountByValidatorDenomRequestSDKType, EstimateSuperfluidDelegatedAmountByValidatorDenomResponse, EstimateSuperfluidDelegatedAmountByValidatorDenomResponseSDKType, QueryTotalDelegationByDelegatorRequest, QueryTotalDelegationByDelegatorRequestSDKType, QueryTotalDelegationByDelegatorResponse, QueryTotalDelegationByDelegatorResponseSDKType, QueryUnpoolWhitelistRequest, QueryUnpoolWhitelistRequestSDKType, QueryUnpoolWhitelistResponse, QueryUnpoolWhitelistResponseSDKType } from "./query.js"; @@ -58,8 +58,8 @@ export interface Query { unpoolWhitelist(request?: QueryUnpoolWhitelistRequest): Promise; } export class QueryClientImpl implements Query { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.params = this.params.bind(this); this.assetType = this.assetType.bind(this); diff --git a/__fixtures__/v-next/outputv4/osmosis/superfluid/query.rpc.func.ts b/__fixtures__/v-next/outputv4/osmosis/superfluid/query.rpc.func.ts new file mode 100644 index 0000000000..2fd83dec55 --- /dev/null +++ b/__fixtures__/v-next/outputv4/osmosis/superfluid/query.rpc.func.ts @@ -0,0 +1,194 @@ +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../cosmos/base/query/v1beta1/pagination.js"; +import { Params, ParamsSDKType } from "./params.js"; +import { SuperfluidAssetType, SuperfluidAssetTypeSDKType, SuperfluidAsset, SuperfluidAssetSDKType, OsmoEquivalentMultiplierRecord, OsmoEquivalentMultiplierRecordSDKType, SuperfluidDelegationRecord, SuperfluidDelegationRecordSDKType } from "./superfluid.js"; +import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin.js"; +import { SyntheticLock, SyntheticLockSDKType } from "../lockup/lock.js"; +import { DelegationResponse, DelegationResponseSDKType } from "../../cosmos/staking/v1beta1/staking.js"; +import { EndpointOrRpc, buildQuery } from "../../helper-func-types.js"; +import { QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, AssetTypeRequest, AssetTypeRequestSDKType, AssetTypeResponse, AssetTypeResponseSDKType, AllAssetsRequest, AllAssetsRequestSDKType, AllAssetsResponse, AllAssetsResponseSDKType, AssetMultiplierRequest, AssetMultiplierRequestSDKType, AssetMultiplierResponse, AssetMultiplierResponseSDKType, AllIntermediaryAccountsRequest, AllIntermediaryAccountsRequestSDKType, AllIntermediaryAccountsResponse, AllIntermediaryAccountsResponseSDKType, ConnectedIntermediaryAccountRequest, ConnectedIntermediaryAccountRequestSDKType, ConnectedIntermediaryAccountResponse, ConnectedIntermediaryAccountResponseSDKType, QueryTotalDelegationByValidatorForDenomRequest, QueryTotalDelegationByValidatorForDenomRequestSDKType, QueryTotalDelegationByValidatorForDenomResponse, QueryTotalDelegationByValidatorForDenomResponseSDKType, TotalSuperfluidDelegationsRequest, TotalSuperfluidDelegationsRequestSDKType, TotalSuperfluidDelegationsResponse, TotalSuperfluidDelegationsResponseSDKType, SuperfluidDelegationAmountRequest, SuperfluidDelegationAmountRequestSDKType, SuperfluidDelegationAmountResponse, SuperfluidDelegationAmountResponseSDKType, SuperfluidDelegationsByDelegatorRequest, SuperfluidDelegationsByDelegatorRequestSDKType, SuperfluidDelegationsByDelegatorResponse, SuperfluidDelegationsByDelegatorResponseSDKType, SuperfluidUndelegationsByDelegatorRequest, SuperfluidUndelegationsByDelegatorRequestSDKType, SuperfluidUndelegationsByDelegatorResponse, SuperfluidUndelegationsByDelegatorResponseSDKType, SuperfluidDelegationsByValidatorDenomRequest, SuperfluidDelegationsByValidatorDenomRequestSDKType, SuperfluidDelegationsByValidatorDenomResponse, SuperfluidDelegationsByValidatorDenomResponseSDKType, EstimateSuperfluidDelegatedAmountByValidatorDenomRequest, EstimateSuperfluidDelegatedAmountByValidatorDenomRequestSDKType, EstimateSuperfluidDelegatedAmountByValidatorDenomResponse, EstimateSuperfluidDelegatedAmountByValidatorDenomResponseSDKType, QueryTotalDelegationByDelegatorRequest, QueryTotalDelegationByDelegatorRequestSDKType, QueryTotalDelegationByDelegatorResponse, QueryTotalDelegationByDelegatorResponseSDKType, QueryUnpoolWhitelistRequest, QueryUnpoolWhitelistRequestSDKType, QueryUnpoolWhitelistResponse, QueryUnpoolWhitelistResponseSDKType } from "./query.js"; +/** + * Params returns the total set of superfluid parameters. + * @name getParams + * @package osmosis.superfluid + * @see proto service: osmosis.superfluid.Params + */ +export const getParams = buildQuery({ + encode: QueryParamsRequest.encode, + decode: QueryParamsResponse.decode, + service: "osmosis.superfluid.Query", + method: "Params" +}); +/** + * Returns superfluid asset type, whether if it's a native asset or an lp + * share. + * @name getAssetType + * @package osmosis.superfluid + * @see proto service: osmosis.superfluid.AssetType + */ +export const getAssetType = buildQuery({ + encode: AssetTypeRequest.encode, + decode: AssetTypeResponse.decode, + service: "osmosis.superfluid.Query", + method: "AssetType" +}); +/** + * Returns all registered superfluid assets. + * @name getAllAssets + * @package osmosis.superfluid + * @see proto service: osmosis.superfluid.AllAssets + */ +export const getAllAssets = buildQuery({ + encode: AllAssetsRequest.encode, + decode: AllAssetsResponse.decode, + service: "osmosis.superfluid.Query", + method: "AllAssets" +}); +/** + * Returns the osmo equivalent multiplier used in the most recent epoch. + * @name getAssetMultiplier + * @package osmosis.superfluid + * @see proto service: osmosis.superfluid.AssetMultiplier + */ +export const getAssetMultiplier = buildQuery({ + encode: AssetMultiplierRequest.encode, + decode: AssetMultiplierResponse.decode, + service: "osmosis.superfluid.Query", + method: "AssetMultiplier" +}); +/** + * Returns all superfluid intermediary accounts. + * @name getAllIntermediaryAccounts + * @package osmosis.superfluid + * @see proto service: osmosis.superfluid.AllIntermediaryAccounts + */ +export const getAllIntermediaryAccounts = buildQuery({ + encode: AllIntermediaryAccountsRequest.encode, + decode: AllIntermediaryAccountsResponse.decode, + service: "osmosis.superfluid.Query", + method: "AllIntermediaryAccounts" +}); +/** + * Returns intermediary account connected to a superfluid staked lock by id + * @name getConnectedIntermediaryAccount + * @package osmosis.superfluid + * @see proto service: osmosis.superfluid.ConnectedIntermediaryAccount + */ +export const getConnectedIntermediaryAccount = buildQuery({ + encode: ConnectedIntermediaryAccountRequest.encode, + decode: ConnectedIntermediaryAccountResponse.decode, + service: "osmosis.superfluid.Query", + method: "ConnectedIntermediaryAccount" +}); +/** + * Returns the amount of delegations of specific denom for all validators + * @name getTotalDelegationByValidatorForDenom + * @package osmosis.superfluid + * @see proto service: osmosis.superfluid.TotalDelegationByValidatorForDenom + */ +export const getTotalDelegationByValidatorForDenom = buildQuery({ + encode: QueryTotalDelegationByValidatorForDenomRequest.encode, + decode: QueryTotalDelegationByValidatorForDenomResponse.decode, + service: "osmosis.superfluid.Query", + method: "TotalDelegationByValidatorForDenom" +}); +/** + * Returns the total amount of osmo superfluidly staked. + * Response is denominated in uosmo. + * @name getTotalSuperfluidDelegations + * @package osmosis.superfluid + * @see proto service: osmosis.superfluid.TotalSuperfluidDelegations + */ +export const getTotalSuperfluidDelegations = buildQuery({ + encode: TotalSuperfluidDelegationsRequest.encode, + decode: TotalSuperfluidDelegationsResponse.decode, + service: "osmosis.superfluid.Query", + method: "TotalSuperfluidDelegations" +}); +/** + * Returns the coins superfluid delegated for the delegator, validator, denom + * triplet + * @name getSuperfluidDelegationAmount + * @package osmosis.superfluid + * @see proto service: osmosis.superfluid.SuperfluidDelegationAmount + */ +export const getSuperfluidDelegationAmount = buildQuery({ + encode: SuperfluidDelegationAmountRequest.encode, + decode: SuperfluidDelegationAmountResponse.decode, + service: "osmosis.superfluid.Query", + method: "SuperfluidDelegationAmount" +}); +/** + * Returns all the delegated superfluid poistions for a specific delegator. + * @name getSuperfluidDelegationsByDelegator + * @package osmosis.superfluid + * @see proto service: osmosis.superfluid.SuperfluidDelegationsByDelegator + */ +export const getSuperfluidDelegationsByDelegator = buildQuery({ + encode: SuperfluidDelegationsByDelegatorRequest.encode, + decode: SuperfluidDelegationsByDelegatorResponse.decode, + service: "osmosis.superfluid.Query", + method: "SuperfluidDelegationsByDelegator" +}); +/** + * Returns all the undelegating superfluid poistions for a specific delegator. + * @name getSuperfluidUndelegationsByDelegator + * @package osmosis.superfluid + * @see proto service: osmosis.superfluid.SuperfluidUndelegationsByDelegator + */ +export const getSuperfluidUndelegationsByDelegator = buildQuery({ + encode: SuperfluidUndelegationsByDelegatorRequest.encode, + decode: SuperfluidUndelegationsByDelegatorResponse.decode, + service: "osmosis.superfluid.Query", + method: "SuperfluidUndelegationsByDelegator" +}); +/** + * Returns all the superfluid positions of a specific denom delegated to one + * validator + * @name getSuperfluidDelegationsByValidatorDenom + * @package osmosis.superfluid + * @see proto service: osmosis.superfluid.SuperfluidDelegationsByValidatorDenom + */ +export const getSuperfluidDelegationsByValidatorDenom = buildQuery({ + encode: SuperfluidDelegationsByValidatorDenomRequest.encode, + decode: SuperfluidDelegationsByValidatorDenomResponse.decode, + service: "osmosis.superfluid.Query", + method: "SuperfluidDelegationsByValidatorDenom" +}); +/** + * Returns the amount of a specific denom delegated to a specific validator + * This is labeled an estimate, because the way it calculates the amount can + * lead rounding errors from the true delegated amount + * @name getEstimateSuperfluidDelegatedAmountByValidatorDenom + * @package osmosis.superfluid + * @see proto service: osmosis.superfluid.EstimateSuperfluidDelegatedAmountByValidatorDenom + */ +export const getEstimateSuperfluidDelegatedAmountByValidatorDenom = buildQuery({ + encode: EstimateSuperfluidDelegatedAmountByValidatorDenomRequest.encode, + decode: EstimateSuperfluidDelegatedAmountByValidatorDenomResponse.decode, + service: "osmosis.superfluid.Query", + method: "EstimateSuperfluidDelegatedAmountByValidatorDenom" +}); +/** + * Returns the specified delegations for a specific delegator + * @name getTotalDelegationByDelegator + * @package osmosis.superfluid + * @see proto service: osmosis.superfluid.TotalDelegationByDelegator + */ +export const getTotalDelegationByDelegator = buildQuery({ + encode: QueryTotalDelegationByDelegatorRequest.encode, + decode: QueryTotalDelegationByDelegatorResponse.decode, + service: "osmosis.superfluid.Query", + method: "TotalDelegationByDelegator" +}); +/** + * Returns a list of whitelisted pool ids to unpool. + * @name getUnpoolWhitelist + * @package osmosis.superfluid + * @see proto service: osmosis.superfluid.UnpoolWhitelist + */ +export const getUnpoolWhitelist = buildQuery({ + encode: QueryUnpoolWhitelistRequest.encode, + decode: QueryUnpoolWhitelistResponse.decode, + service: "osmosis.superfluid.Query", + method: "UnpoolWhitelist" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/osmosis/superfluid/superfluid.ts b/__fixtures__/v-next/outputv4/osmosis/superfluid/superfluid.ts index 2def677387..98d5ce1fac 100644 --- a/__fixtures__/v-next/outputv4/osmosis/superfluid/superfluid.ts +++ b/__fixtures__/v-next/outputv4/osmosis/superfluid/superfluid.ts @@ -2,7 +2,7 @@ import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin.js"; import { BinaryReader, BinaryWriter } from "../../binary.js"; import { isSet, DeepPartial } from "../../helpers.js"; import { JsonSafe } from "../../json-safe.js"; -import { Decimal } from "@cosmjs/math"; +import { Decimal } from "@interchainjs/math"; export const protobufPackage = "osmosis.superfluid"; /** * SuperfluidAssetType indicates whether the superfluid asset is @@ -594,7 +594,7 @@ export const OsmoEquivalentMultiplierRecord = { const obj: any = {}; obj.epoch_number = message.epochNumber !== BigInt(0) ? message.epochNumber?.toString() : undefined; obj.denom = message.denom === "" ? undefined : message.denom; - obj.multiplier = message.multiplier === "" ? undefined : message.multiplier; + obj.multiplier = message.multiplier === "" ? undefined : Decimal.fromUserInput(message.multiplier, 18).atomics; return obj; }, fromAminoMsg(object: OsmoEquivalentMultiplierRecordAminoMsg): OsmoEquivalentMultiplierRecord { diff --git a/__fixtures__/v-next/outputv4/osmosis/superfluid/tx.registry.ts b/__fixtures__/v-next/outputv4/osmosis/superfluid/tx.registry.ts index 739cd238c8..0ab24a0177 100644 --- a/__fixtures__/v-next/outputv4/osmosis/superfluid/tx.registry.ts +++ b/__fixtures__/v-next/outputv4/osmosis/superfluid/tx.registry.ts @@ -1,12 +1,7 @@ import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin.js"; -import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { TelescopeGeneratedType } from "../../types.js"; import { MsgSuperfluidDelegate, MsgSuperfluidDelegateSDKType, MsgSuperfluidUndelegate, MsgSuperfluidUndelegateSDKType, MsgSuperfluidUnbondLock, MsgSuperfluidUnbondLockSDKType, MsgLockAndSuperfluidDelegate, MsgLockAndSuperfluidDelegateSDKType, MsgUnPoolWhitelistedPool, MsgUnPoolWhitelistedPoolSDKType } from "./tx.js"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/osmosis.superfluid.MsgSuperfluidDelegate", MsgSuperfluidDelegate], ["/osmosis.superfluid.MsgSuperfluidUndelegate", MsgSuperfluidUndelegate], ["/osmosis.superfluid.MsgSuperfluidUnbondLock", MsgSuperfluidUnbondLock], ["/osmosis.superfluid.MsgLockAndSuperfluidDelegate", MsgLockAndSuperfluidDelegate], ["/osmosis.superfluid.MsgUnPoolWhitelistedPool", MsgUnPoolWhitelistedPool]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/osmosis.superfluid.MsgSuperfluidDelegate", MsgSuperfluidDelegate], ["/osmosis.superfluid.MsgSuperfluidUndelegate", MsgSuperfluidUndelegate], ["/osmosis.superfluid.MsgSuperfluidUnbondLock", MsgSuperfluidUnbondLock], ["/osmosis.superfluid.MsgLockAndSuperfluidDelegate", MsgLockAndSuperfluidDelegate], ["/osmosis.superfluid.MsgUnPoolWhitelistedPool", MsgUnPoolWhitelistedPool]]; export const MessageComposer = { encoded: { superfluidDelegate(value: MsgSuperfluidDelegate) { diff --git a/__fixtures__/v-next/outputv4/osmosis/superfluid/tx.rpc.func.ts b/__fixtures__/v-next/outputv4/osmosis/superfluid/tx.rpc.func.ts new file mode 100644 index 0000000000..7bf3b00ca6 --- /dev/null +++ b/__fixtures__/v-next/outputv4/osmosis/superfluid/tx.rpc.func.ts @@ -0,0 +1,48 @@ +import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin.js"; +import { buildTx } from "../../helper-func-types.js"; +import { MsgSuperfluidDelegate, MsgSuperfluidDelegateSDKType, MsgSuperfluidDelegateResponse, MsgSuperfluidDelegateResponseSDKType, MsgSuperfluidUndelegate, MsgSuperfluidUndelegateSDKType, MsgSuperfluidUndelegateResponse, MsgSuperfluidUndelegateResponseSDKType, MsgSuperfluidUnbondLock, MsgSuperfluidUnbondLockSDKType, MsgSuperfluidUnbondLockResponse, MsgSuperfluidUnbondLockResponseSDKType, MsgLockAndSuperfluidDelegate, MsgLockAndSuperfluidDelegateSDKType, MsgLockAndSuperfluidDelegateResponse, MsgLockAndSuperfluidDelegateResponseSDKType, MsgUnPoolWhitelistedPool, MsgUnPoolWhitelistedPoolSDKType, MsgUnPoolWhitelistedPoolResponse, MsgUnPoolWhitelistedPoolResponseSDKType } from "./tx.js"; +/** + * Execute superfluid delegation for a lockup + * @name superfluidDelegate + * @package osmosis.superfluid + * @see proto service: osmosis.superfluid.SuperfluidDelegate + */ +export const superfluidDelegate = buildTx({ + msg: MsgSuperfluidDelegate +}); +/** + * Execute superfluid undelegation for a lockup + * @name superfluidUndelegate + * @package osmosis.superfluid + * @see proto service: osmosis.superfluid.SuperfluidUndelegate + */ +export const superfluidUndelegate = buildTx({ + msg: MsgSuperfluidUndelegate +}); +/** + * For a given lock that is being superfluidly undelegated, + * also unbond the underlying lock. + * @name superfluidUnbondLock + * @package osmosis.superfluid + * @see proto service: osmosis.superfluid.SuperfluidUnbondLock + */ +export const superfluidUnbondLock = buildTx({ + msg: MsgSuperfluidUnbondLock +}); +/** + * Execute lockup lock and superfluid delegation in a single msg + * @name lockAndSuperfluidDelegate + * @package osmosis.superfluid + * @see proto service: osmosis.superfluid.LockAndSuperfluidDelegate + */ +export const lockAndSuperfluidDelegate = buildTx({ + msg: MsgLockAndSuperfluidDelegate +}); +/** + * @name unPoolWhitelistedPool + * @package osmosis.superfluid + * @see proto service: osmosis.superfluid.UnPoolWhitelistedPool + */ +export const unPoolWhitelistedPool = buildTx({ + msg: MsgUnPoolWhitelistedPool +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/osmosis/superfluid/tx.rpc.msg.ts b/__fixtures__/v-next/outputv4/osmosis/superfluid/tx.rpc.msg.ts index 02a468af53..b0a695f43e 100644 --- a/__fixtures__/v-next/outputv4/osmosis/superfluid/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputv4/osmosis/superfluid/tx.rpc.msg.ts @@ -1,5 +1,5 @@ import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin.js"; -import { Rpc } from "../../helpers.js"; +import { TxRpc } from "../../types.js"; import { BinaryReader } from "../../binary.js"; import { MsgSuperfluidDelegate, MsgSuperfluidDelegateSDKType, MsgSuperfluidDelegateResponse, MsgSuperfluidDelegateResponseSDKType, MsgSuperfluidUndelegate, MsgSuperfluidUndelegateSDKType, MsgSuperfluidUndelegateResponse, MsgSuperfluidUndelegateResponseSDKType, MsgSuperfluidUnbondLock, MsgSuperfluidUnbondLockSDKType, MsgSuperfluidUnbondLockResponse, MsgSuperfluidUnbondLockResponseSDKType, MsgLockAndSuperfluidDelegate, MsgLockAndSuperfluidDelegateSDKType, MsgLockAndSuperfluidDelegateResponse, MsgLockAndSuperfluidDelegateResponseSDKType, MsgUnPoolWhitelistedPool, MsgUnPoolWhitelistedPoolSDKType, MsgUnPoolWhitelistedPoolResponse, MsgUnPoolWhitelistedPoolResponseSDKType } from "./tx.js"; /** Msg defines the Msg service. */ @@ -18,8 +18,8 @@ export interface Msg { unPoolWhitelistedPool(request: MsgUnPoolWhitelistedPool): Promise; } export class MsgClientImpl implements Msg { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.superfluidDelegate = this.superfluidDelegate.bind(this); this.superfluidUndelegate = this.superfluidUndelegate.bind(this); @@ -53,6 +53,6 @@ export class MsgClientImpl implements Msg { return promise.then(data => MsgUnPoolWhitelistedPoolResponse.decode(new BinaryReader(data))); } } -export const createClientImpl = (rpc: Rpc) => { +export const createClientImpl = (rpc: TxRpc) => { return new MsgClientImpl(rpc); }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/osmosis/tokenfactory/v1beta1/query.rpc.Query.ts b/__fixtures__/v-next/outputv4/osmosis/tokenfactory/v1beta1/query.rpc.Query.ts index c55d99b45b..b80eaa3fe8 100644 --- a/__fixtures__/v-next/outputv4/osmosis/tokenfactory/v1beta1/query.rpc.Query.ts +++ b/__fixtures__/v-next/outputv4/osmosis/tokenfactory/v1beta1/query.rpc.Query.ts @@ -1,6 +1,6 @@ import { Params, ParamsSDKType } from "./params.js"; import { DenomAuthorityMetadata, DenomAuthorityMetadataSDKType } from "./authorityMetadata.js"; -import { Rpc } from "../../../helpers.js"; +import { TxRpc } from "../../../types.js"; import { BinaryReader } from "../../../binary.js"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; import { QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, QueryDenomAuthorityMetadataRequest, QueryDenomAuthorityMetadataRequestSDKType, QueryDenomAuthorityMetadataResponse, QueryDenomAuthorityMetadataResponseSDKType, QueryDenomsFromCreatorRequest, QueryDenomsFromCreatorRequestSDKType, QueryDenomsFromCreatorResponse, QueryDenomsFromCreatorResponseSDKType } from "./query.js"; @@ -23,8 +23,8 @@ export interface Query { denomsFromCreator(request: QueryDenomsFromCreatorRequest): Promise; } export class QueryClientImpl implements Query { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.params = this.params.bind(this); this.denomAuthorityMetadata = this.denomAuthorityMetadata.bind(this); diff --git a/__fixtures__/v-next/outputv4/osmosis/tokenfactory/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputv4/osmosis/tokenfactory/v1beta1/query.rpc.func.ts new file mode 100644 index 0000000000..82017ea0ef --- /dev/null +++ b/__fixtures__/v-next/outputv4/osmosis/tokenfactory/v1beta1/query.rpc.func.ts @@ -0,0 +1,43 @@ +import { Params, ParamsSDKType } from "./params.js"; +import { DenomAuthorityMetadata, DenomAuthorityMetadataSDKType } from "./authorityMetadata.js"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types.js"; +import { QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, QueryDenomAuthorityMetadataRequest, QueryDenomAuthorityMetadataRequestSDKType, QueryDenomAuthorityMetadataResponse, QueryDenomAuthorityMetadataResponseSDKType, QueryDenomsFromCreatorRequest, QueryDenomsFromCreatorRequestSDKType, QueryDenomsFromCreatorResponse, QueryDenomsFromCreatorResponseSDKType } from "./query.js"; +/** + * Params defines a gRPC query method that returns the tokenfactory module's + * parameters. + * @name getParams + * @package osmosis.tokenfactory.v1beta1 + * @see proto service: osmosis.tokenfactory.v1beta1.Params + */ +export const getParams = buildQuery({ + encode: QueryParamsRequest.encode, + decode: QueryParamsResponse.decode, + service: "osmosis.tokenfactory.v1beta1.Query", + method: "Params" +}); +/** + * DenomAuthorityMetadata defines a gRPC query method for fetching + * DenomAuthorityMetadata for a particular denom. + * @name getDenomAuthorityMetadata + * @package osmosis.tokenfactory.v1beta1 + * @see proto service: osmosis.tokenfactory.v1beta1.DenomAuthorityMetadata + */ +export const getDenomAuthorityMetadata = buildQuery({ + encode: QueryDenomAuthorityMetadataRequest.encode, + decode: QueryDenomAuthorityMetadataResponse.decode, + service: "osmosis.tokenfactory.v1beta1.Query", + method: "DenomAuthorityMetadata" +}); +/** + * DenomsFromCreator defines a gRPC query method for fetching all + * denominations created by a specific admin/creator. + * @name getDenomsFromCreator + * @package osmosis.tokenfactory.v1beta1 + * @see proto service: osmosis.tokenfactory.v1beta1.DenomsFromCreator + */ +export const getDenomsFromCreator = buildQuery({ + encode: QueryDenomsFromCreatorRequest.encode, + decode: QueryDenomsFromCreatorResponse.decode, + service: "osmosis.tokenfactory.v1beta1.Query", + method: "DenomsFromCreator" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/osmosis/tokenfactory/v1beta1/tx.registry.ts b/__fixtures__/v-next/outputv4/osmosis/tokenfactory/v1beta1/tx.registry.ts index 5f554c68e0..856a35b10e 100644 --- a/__fixtures__/v-next/outputv4/osmosis/tokenfactory/v1beta1/tx.registry.ts +++ b/__fixtures__/v-next/outputv4/osmosis/tokenfactory/v1beta1/tx.registry.ts @@ -1,13 +1,8 @@ import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin.js"; import { Metadata, MetadataSDKType } from "../../../cosmos/bank/v1beta1/bank.js"; -import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { TelescopeGeneratedType } from "../../../types.js"; import { MsgCreateDenom, MsgCreateDenomSDKType, MsgMint, MsgMintSDKType, MsgBurn, MsgBurnSDKType, MsgChangeAdmin, MsgChangeAdminSDKType, MsgSetDenomMetadata, MsgSetDenomMetadataSDKType } from "./tx.js"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/osmosis.tokenfactory.v1beta1.MsgCreateDenom", MsgCreateDenom], ["/osmosis.tokenfactory.v1beta1.MsgMint", MsgMint], ["/osmosis.tokenfactory.v1beta1.MsgBurn", MsgBurn], ["/osmosis.tokenfactory.v1beta1.MsgChangeAdmin", MsgChangeAdmin], ["/osmosis.tokenfactory.v1beta1.MsgSetDenomMetadata", MsgSetDenomMetadata]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType]> = [["/osmosis.tokenfactory.v1beta1.MsgCreateDenom", MsgCreateDenom], ["/osmosis.tokenfactory.v1beta1.MsgMint", MsgMint], ["/osmosis.tokenfactory.v1beta1.MsgBurn", MsgBurn], ["/osmosis.tokenfactory.v1beta1.MsgChangeAdmin", MsgChangeAdmin], ["/osmosis.tokenfactory.v1beta1.MsgSetDenomMetadata", MsgSetDenomMetadata]]; export const MessageComposer = { encoded: { createDenom(value: MsgCreateDenom) { diff --git a/__fixtures__/v-next/outputv4/osmosis/tokenfactory/v1beta1/tx.rpc.func.ts b/__fixtures__/v-next/outputv4/osmosis/tokenfactory/v1beta1/tx.rpc.func.ts new file mode 100644 index 0000000000..f911463330 --- /dev/null +++ b/__fixtures__/v-next/outputv4/osmosis/tokenfactory/v1beta1/tx.rpc.func.ts @@ -0,0 +1,44 @@ +import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin.js"; +import { Metadata, MetadataSDKType } from "../../../cosmos/bank/v1beta1/bank.js"; +import { buildTx } from "../../../helper-func-types.js"; +import { MsgCreateDenom, MsgCreateDenomSDKType, MsgCreateDenomResponse, MsgCreateDenomResponseSDKType, MsgMint, MsgMintSDKType, MsgMintResponse, MsgMintResponseSDKType, MsgBurn, MsgBurnSDKType, MsgBurnResponse, MsgBurnResponseSDKType, MsgChangeAdmin, MsgChangeAdminSDKType, MsgChangeAdminResponse, MsgChangeAdminResponseSDKType, MsgSetDenomMetadata, MsgSetDenomMetadataSDKType, MsgSetDenomMetadataResponse, MsgSetDenomMetadataResponseSDKType } from "./tx.js"; +/** + * @name createDenom + * @package osmosis.tokenfactory.v1beta1 + * @see proto service: osmosis.tokenfactory.v1beta1.CreateDenom + */ +export const createDenom = buildTx({ + msg: MsgCreateDenom +}); +/** + * @name mint + * @package osmosis.tokenfactory.v1beta1 + * @see proto service: osmosis.tokenfactory.v1beta1.Mint + */ +export const mint = buildTx({ + msg: MsgMint +}); +/** + * @name burn + * @package osmosis.tokenfactory.v1beta1 + * @see proto service: osmosis.tokenfactory.v1beta1.Burn + */ +export const burn = buildTx({ + msg: MsgBurn +}); +/** + * @name changeAdmin + * @package osmosis.tokenfactory.v1beta1 + * @see proto service: osmosis.tokenfactory.v1beta1.ChangeAdmin + */ +export const changeAdmin = buildTx({ + msg: MsgChangeAdmin +}); +/** + * @name setDenomMetadata + * @package osmosis.tokenfactory.v1beta1 + * @see proto service: osmosis.tokenfactory.v1beta1.SetDenomMetadata + */ +export const setDenomMetadata = buildTx({ + msg: MsgSetDenomMetadata +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/osmosis/tokenfactory/v1beta1/tx.rpc.msg.ts b/__fixtures__/v-next/outputv4/osmosis/tokenfactory/v1beta1/tx.rpc.msg.ts index ccce1ad6a4..fa5eb42cb8 100644 --- a/__fixtures__/v-next/outputv4/osmosis/tokenfactory/v1beta1/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputv4/osmosis/tokenfactory/v1beta1/tx.rpc.msg.ts @@ -1,6 +1,6 @@ import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin.js"; import { Metadata, MetadataSDKType } from "../../../cosmos/bank/v1beta1/bank.js"; -import { Rpc } from "../../../helpers.js"; +import { TxRpc } from "../../../types.js"; import { BinaryReader } from "../../../binary.js"; import { MsgCreateDenom, MsgCreateDenomSDKType, MsgCreateDenomResponse, MsgCreateDenomResponseSDKType, MsgMint, MsgMintSDKType, MsgMintResponse, MsgMintResponseSDKType, MsgBurn, MsgBurnSDKType, MsgBurnResponse, MsgBurnResponseSDKType, MsgChangeAdmin, MsgChangeAdminSDKType, MsgChangeAdminResponse, MsgChangeAdminResponseSDKType, MsgSetDenomMetadata, MsgSetDenomMetadataSDKType, MsgSetDenomMetadataResponse, MsgSetDenomMetadataResponseSDKType } from "./tx.js"; /** Msg defines the tokefactory module's gRPC message service. */ @@ -12,8 +12,8 @@ export interface Msg { setDenomMetadata(request: MsgSetDenomMetadata): Promise; } export class MsgClientImpl implements Msg { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.createDenom = this.createDenom.bind(this); this.mint = this.mint.bind(this); @@ -47,6 +47,6 @@ export class MsgClientImpl implements Msg { return promise.then(data => MsgSetDenomMetadataResponse.decode(new BinaryReader(data))); } } -export const createClientImpl = (rpc: Rpc) => { +export const createClientImpl = (rpc: TxRpc) => { return new MsgClientImpl(rpc); }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/osmosis/twap/v1beta1/query.rpc.Query.ts b/__fixtures__/v-next/outputv4/osmosis/twap/v1beta1/query.rpc.Query.ts index 3c231597a7..9567033376 100644 --- a/__fixtures__/v-next/outputv4/osmosis/twap/v1beta1/query.rpc.Query.ts +++ b/__fixtures__/v-next/outputv4/osmosis/twap/v1beta1/query.rpc.Query.ts @@ -1,6 +1,6 @@ import { Timestamp, TimestampSDKType } from "../../../google/protobuf/timestamp.js"; import { Params, ParamsSDKType } from "./genesis.js"; -import { Rpc } from "../../../helpers.js"; +import { TxRpc } from "../../../types.js"; import { BinaryReader } from "../../../binary.js"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; import { ParamsRequest, ParamsRequestSDKType, ParamsResponse, ParamsResponseSDKType, ArithmeticTwapRequest, ArithmeticTwapRequestSDKType, ArithmeticTwapResponse, ArithmeticTwapResponseSDKType, ArithmeticTwapToNowRequest, ArithmeticTwapToNowRequestSDKType, ArithmeticTwapToNowResponse, ArithmeticTwapToNowResponseSDKType } from "./query.js"; @@ -10,8 +10,8 @@ export interface Query { arithmeticTwapToNow(request: ArithmeticTwapToNowRequest): Promise; } export class QueryClientImpl implements Query { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.params = this.params.bind(this); this.arithmeticTwap = this.arithmeticTwap.bind(this); diff --git a/__fixtures__/v-next/outputv4/osmosis/twap/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputv4/osmosis/twap/v1beta1/query.rpc.func.ts new file mode 100644 index 0000000000..dbbc90ca0f --- /dev/null +++ b/__fixtures__/v-next/outputv4/osmosis/twap/v1beta1/query.rpc.func.ts @@ -0,0 +1,38 @@ +import { Timestamp, TimestampSDKType } from "../../../google/protobuf/timestamp.js"; +import { Params, ParamsSDKType } from "./genesis.js"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types.js"; +import { ParamsRequest, ParamsRequestSDKType, ParamsResponse, ParamsResponseSDKType, ArithmeticTwapRequest, ArithmeticTwapRequestSDKType, ArithmeticTwapResponse, ArithmeticTwapResponseSDKType, ArithmeticTwapToNowRequest, ArithmeticTwapToNowRequestSDKType, ArithmeticTwapToNowResponse, ArithmeticTwapToNowResponseSDKType } from "./query.js"; +/** + * @name getParams + * @package osmosis.twap.v1beta1 + * @see proto service: osmosis.twap.v1beta1.Params + */ +export const getParams = buildQuery({ + encode: ParamsRequest.encode, + decode: ParamsResponse.decode, + service: "osmosis.twap.v1beta1.Query", + method: "Params" +}); +/** + * @name getArithmeticTwap + * @package osmosis.twap.v1beta1 + * @see proto service: osmosis.twap.v1beta1.ArithmeticTwap + */ +export const getArithmeticTwap = buildQuery({ + encode: ArithmeticTwapRequest.encode, + decode: ArithmeticTwapResponse.decode, + service: "osmosis.twap.v1beta1.Query", + method: "ArithmeticTwap" +}); +/** + * @name getArithmeticTwapToNow + * @package osmosis.twap.v1beta1 + * @see proto service: osmosis.twap.v1beta1.ArithmeticTwapToNow + * @deprecated + */ +export const getArithmeticTwapToNow = buildQuery({ + encode: ArithmeticTwapToNowRequest.encode, + decode: ArithmeticTwapToNowResponse.decode, + service: "osmosis.twap.v1beta1.Query", + method: "ArithmeticTwapToNow" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/osmosis/twap/v1beta1/query.ts b/__fixtures__/v-next/outputv4/osmosis/twap/v1beta1/query.ts index b0e3b94d4c..1bef988d34 100644 --- a/__fixtures__/v-next/outputv4/osmosis/twap/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv4/osmosis/twap/v1beta1/query.ts @@ -3,7 +3,7 @@ import { Params, ParamsSDKType } from "./genesis.js"; import { BinaryReader, BinaryWriter } from "../../../binary.js"; import { toTimestamp, fromTimestamp, isSet, DeepPartial } from "../../../helpers.js"; import { JsonSafe } from "../../../json-safe.js"; -import { Decimal } from "@cosmjs/math"; +import { Decimal } from "@interchainjs/math"; export const protobufPackage = "osmosis.twap.v1beta1"; /** * @name ArithmeticTwapRequest @@ -378,7 +378,7 @@ export const ArithmeticTwapResponse = { }, toAmino(message: ArithmeticTwapResponse): ArithmeticTwapResponseAmino { const obj: any = {}; - obj.arithmetic_twap = message.arithmeticTwap === "" ? undefined : message.arithmeticTwap; + obj.arithmetic_twap = message.arithmeticTwap === "" ? undefined : Decimal.fromUserInput(message.arithmeticTwap, 18).atomics; return obj; }, fromAminoMsg(object: ArithmeticTwapResponseAminoMsg): ArithmeticTwapResponse { @@ -629,7 +629,7 @@ export const ArithmeticTwapToNowResponse = { }, toAmino(message: ArithmeticTwapToNowResponse): ArithmeticTwapToNowResponseAmino { const obj: any = {}; - obj.arithmetic_twap = message.arithmeticTwap === "" ? undefined : message.arithmeticTwap; + obj.arithmetic_twap = message.arithmeticTwap === "" ? undefined : Decimal.fromUserInput(message.arithmeticTwap, 18).atomics; return obj; }, fromAminoMsg(object: ArithmeticTwapToNowResponseAminoMsg): ArithmeticTwapToNowResponse { diff --git a/__fixtures__/v-next/outputv4/osmosis/twap/v1beta1/twap_record.ts b/__fixtures__/v-next/outputv4/osmosis/twap/v1beta1/twap_record.ts index 5bc7c1a6cf..7372107e1f 100644 --- a/__fixtures__/v-next/outputv4/osmosis/twap/v1beta1/twap_record.ts +++ b/__fixtures__/v-next/outputv4/osmosis/twap/v1beta1/twap_record.ts @@ -1,7 +1,7 @@ import { Timestamp, TimestampSDKType } from "../../../google/protobuf/timestamp.js"; import { BinaryReader, BinaryWriter } from "../../../binary.js"; import { toTimestamp, fromTimestamp, isSet, DeepPartial } from "../../../helpers.js"; -import { Decimal } from "@cosmjs/math"; +import { Decimal } from "@interchainjs/math"; import { JsonSafe } from "../../../json-safe.js"; export const protobufPackage = "osmosis.twap.v1beta1"; /** @@ -312,10 +312,10 @@ export const TwapRecord = { obj.asset1_denom = message.asset1Denom === "" ? undefined : message.asset1Denom; obj.height = message.height ? message.height?.toString() : "0"; obj.time = message.time ? Timestamp.toAmino(toTimestamp(message.time)) : undefined; - obj.p0_last_spot_price = message.p0LastSpotPrice === "" ? undefined : message.p0LastSpotPrice; - obj.p1_last_spot_price = message.p1LastSpotPrice === "" ? undefined : message.p1LastSpotPrice; - obj.p0_arithmetic_twap_accumulator = message.p0ArithmeticTwapAccumulator === "" ? undefined : message.p0ArithmeticTwapAccumulator; - obj.p1_arithmetic_twap_accumulator = message.p1ArithmeticTwapAccumulator === "" ? undefined : message.p1ArithmeticTwapAccumulator; + obj.p0_last_spot_price = message.p0LastSpotPrice === "" ? undefined : Decimal.fromUserInput(message.p0LastSpotPrice, 18).atomics; + obj.p1_last_spot_price = message.p1LastSpotPrice === "" ? undefined : Decimal.fromUserInput(message.p1LastSpotPrice, 18).atomics; + obj.p0_arithmetic_twap_accumulator = message.p0ArithmeticTwapAccumulator === "" ? undefined : Decimal.fromUserInput(message.p0ArithmeticTwapAccumulator, 18).atomics; + obj.p1_arithmetic_twap_accumulator = message.p1ArithmeticTwapAccumulator === "" ? undefined : Decimal.fromUserInput(message.p1ArithmeticTwapAccumulator, 18).atomics; obj.last_error_time = message.lastErrorTime ? Timestamp.toAmino(toTimestamp(message.lastErrorTime)) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv4/osmosis/txfees/v1beta1/query.rpc.Query.ts b/__fixtures__/v-next/outputv4/osmosis/txfees/v1beta1/query.rpc.Query.ts index 09178cb240..7f6dfb9a7c 100644 --- a/__fixtures__/v-next/outputv4/osmosis/txfees/v1beta1/query.rpc.Query.ts +++ b/__fixtures__/v-next/outputv4/osmosis/txfees/v1beta1/query.rpc.Query.ts @@ -1,5 +1,5 @@ import { FeeToken, FeeTokenSDKType } from "./feetoken.js"; -import { Rpc } from "../../../helpers.js"; +import { TxRpc } from "../../../types.js"; import { BinaryReader } from "../../../binary.js"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; import { QueryFeeTokensRequest, QueryFeeTokensRequestSDKType, QueryFeeTokensResponse, QueryFeeTokensResponseSDKType, QueryDenomSpotPriceRequest, QueryDenomSpotPriceRequestSDKType, QueryDenomSpotPriceResponse, QueryDenomSpotPriceResponseSDKType, QueryDenomPoolIdRequest, QueryDenomPoolIdRequestSDKType, QueryDenomPoolIdResponse, QueryDenomPoolIdResponseSDKType, QueryBaseDenomRequest, QueryBaseDenomRequestSDKType, QueryBaseDenomResponse, QueryBaseDenomResponseSDKType } from "./query.js"; @@ -18,8 +18,8 @@ export interface Query { baseDenom(request?: QueryBaseDenomRequest): Promise; } export class QueryClientImpl implements Query { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.feeTokens = this.feeTokens.bind(this); this.denomSpotPrice = this.denomSpotPrice.bind(this); diff --git a/__fixtures__/v-next/outputv4/osmosis/txfees/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputv4/osmosis/txfees/v1beta1/query.rpc.func.ts new file mode 100644 index 0000000000..671942ded3 --- /dev/null +++ b/__fixtures__/v-next/outputv4/osmosis/txfees/v1beta1/query.rpc.func.ts @@ -0,0 +1,53 @@ +import { FeeToken, FeeTokenSDKType } from "./feetoken.js"; +import { EndpointOrRpc, buildQuery } from "../../../helper-func-types.js"; +import { QueryFeeTokensRequest, QueryFeeTokensRequestSDKType, QueryFeeTokensResponse, QueryFeeTokensResponseSDKType, QueryDenomSpotPriceRequest, QueryDenomSpotPriceRequestSDKType, QueryDenomSpotPriceResponse, QueryDenomSpotPriceResponseSDKType, QueryDenomPoolIdRequest, QueryDenomPoolIdRequestSDKType, QueryDenomPoolIdResponse, QueryDenomPoolIdResponseSDKType, QueryBaseDenomRequest, QueryBaseDenomRequestSDKType, QueryBaseDenomResponse, QueryBaseDenomResponseSDKType } from "./query.js"; +/** + * FeeTokens returns a list of all the whitelisted fee tokens and their + * corresponding pools. It does not include the BaseDenom, which has its own + * query endpoint + * @name getFeeTokens + * @package osmosis.txfees.v1beta1 + * @see proto service: osmosis.txfees.v1beta1.FeeTokens + */ +export const getFeeTokens = buildQuery({ + encode: QueryFeeTokensRequest.encode, + decode: QueryFeeTokensResponse.decode, + service: "osmosis.txfees.v1beta1.Query", + method: "FeeTokens" +}); +/** + * DenomSpotPrice returns all spot prices by each registered token denom. + * @name getDenomSpotPrice + * @package osmosis.txfees.v1beta1 + * @see proto service: osmosis.txfees.v1beta1.DenomSpotPrice + */ +export const getDenomSpotPrice = buildQuery({ + encode: QueryDenomSpotPriceRequest.encode, + decode: QueryDenomSpotPriceResponse.decode, + service: "osmosis.txfees.v1beta1.Query", + method: "DenomSpotPrice" +}); +/** + * Returns the poolID for a specified denom input. + * @name getDenomPoolId + * @package osmosis.txfees.v1beta1 + * @see proto service: osmosis.txfees.v1beta1.DenomPoolId + */ +export const getDenomPoolId = buildQuery({ + encode: QueryDenomPoolIdRequest.encode, + decode: QueryDenomPoolIdResponse.decode, + service: "osmosis.txfees.v1beta1.Query", + method: "DenomPoolId" +}); +/** + * Returns a list of all base denom tokens and their corresponding pools. + * @name getBaseDenom + * @package osmosis.txfees.v1beta1 + * @see proto service: osmosis.txfees.v1beta1.BaseDenom + */ +export const getBaseDenom = buildQuery({ + encode: QueryBaseDenomRequest.encode, + decode: QueryBaseDenomResponse.decode, + service: "osmosis.txfees.v1beta1.Query", + method: "BaseDenom" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/osmosis/txfees/v1beta1/query.ts b/__fixtures__/v-next/outputv4/osmosis/txfees/v1beta1/query.ts index fca3a1c9bc..222654db56 100644 --- a/__fixtures__/v-next/outputv4/osmosis/txfees/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv4/osmosis/txfees/v1beta1/query.ts @@ -2,7 +2,7 @@ import { FeeToken, FeeTokenSDKType } from "./feetoken.js"; import { BinaryReader, BinaryWriter } from "../../../binary.js"; import { JsonSafe } from "../../../json-safe.js"; import { DeepPartial, isSet } from "../../../helpers.js"; -import { Decimal } from "@cosmjs/math"; +import { Decimal } from "@interchainjs/math"; export const protobufPackage = "osmosis.txfees.v1beta1"; /** * @name QueryFeeTokensRequest @@ -550,7 +550,7 @@ export const QueryDenomSpotPriceResponse = { toAmino(message: QueryDenomSpotPriceResponse): QueryDenomSpotPriceResponseAmino { const obj: any = {}; obj.poolID = message.poolID !== BigInt(0) ? message.poolID?.toString() : undefined; - obj.spot_price = message.spotPrice === "" ? undefined : message.spotPrice; + obj.spot_price = message.spotPrice === "" ? undefined : Decimal.fromUserInput(message.spotPrice, 18).atomics; return obj; }, fromAminoMsg(object: QueryDenomSpotPriceResponseAminoMsg): QueryDenomSpotPriceResponse { diff --git a/__fixtures__/v-next/outputv4/tendermint/abci/types.rpc.ABCIApplication.ts b/__fixtures__/v-next/outputv4/tendermint/abci/types.rpc.ABCIApplication.ts index 2b7a017033..9267470495 100644 --- a/__fixtures__/v-next/outputv4/tendermint/abci/types.rpc.ABCIApplication.ts +++ b/__fixtures__/v-next/outputv4/tendermint/abci/types.rpc.ABCIApplication.ts @@ -3,7 +3,7 @@ import { Header, HeaderSDKType } from "../types/types.js"; import { ProofOps, ProofOpsSDKType } from "../crypto/proof.js"; import { EvidenceParams, EvidenceParamsSDKType, ValidatorParams, ValidatorParamsSDKType, VersionParams, VersionParamsSDKType } from "../types/params.js"; import { PublicKey, PublicKeySDKType } from "../crypto/keys.js"; -import { Rpc } from "../../helpers.js"; +import { TxRpc } from "../../types.js"; import { BinaryReader } from "../../binary.js"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; import { RequestEcho, RequestEchoSDKType, ResponseEcho, ResponseEchoSDKType, RequestFlush, RequestFlushSDKType, ResponseFlush, ResponseFlushSDKType, RequestInfo, RequestInfoSDKType, ResponseInfo, ResponseInfoSDKType, RequestSetOption, RequestSetOptionSDKType, ResponseSetOption, ResponseSetOptionSDKType, RequestDeliverTx, RequestDeliverTxSDKType, ResponseDeliverTx, ResponseDeliverTxSDKType, RequestCheckTx, RequestCheckTxSDKType, ResponseCheckTx, ResponseCheckTxSDKType, RequestQuery, RequestQuerySDKType, ResponseQuery, ResponseQuerySDKType, RequestCommit, RequestCommitSDKType, ResponseCommit, ResponseCommitSDKType, RequestInitChain, RequestInitChainSDKType, ResponseInitChain, ResponseInitChainSDKType, RequestBeginBlock, RequestBeginBlockSDKType, ResponseBeginBlock, ResponseBeginBlockSDKType, RequestEndBlock, RequestEndBlockSDKType, ResponseEndBlock, ResponseEndBlockSDKType, RequestListSnapshots, RequestListSnapshotsSDKType, ResponseListSnapshots, ResponseListSnapshotsSDKType, RequestOfferSnapshot, RequestOfferSnapshotSDKType, ResponseOfferSnapshot, ResponseOfferSnapshotSDKType, RequestLoadSnapshotChunk, RequestLoadSnapshotChunkSDKType, ResponseLoadSnapshotChunk, ResponseLoadSnapshotChunkSDKType, RequestApplySnapshotChunk, RequestApplySnapshotChunkSDKType, ResponseApplySnapshotChunk, ResponseApplySnapshotChunkSDKType } from "./types.js"; @@ -25,8 +25,8 @@ export interface ABCIApplication { applySnapshotChunk(request: RequestApplySnapshotChunk): Promise; } export class ABCIApplicationClientImpl implements ABCIApplication { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.echo = this.echo.bind(this); this.flush = this.flush.bind(this); diff --git a/__fixtures__/v-next/outputv4/tendermint/abci/types.rpc.func.ts b/__fixtures__/v-next/outputv4/tendermint/abci/types.rpc.func.ts new file mode 100644 index 0000000000..c7d57499f9 --- /dev/null +++ b/__fixtures__/v-next/outputv4/tendermint/abci/types.rpc.func.ts @@ -0,0 +1,172 @@ +import { Timestamp, TimestampSDKType } from "../../google/protobuf/timestamp.js"; +import { Header, HeaderSDKType } from "../types/types.js"; +import { ProofOps, ProofOpsSDKType } from "../crypto/proof.js"; +import { EvidenceParams, EvidenceParamsSDKType, ValidatorParams, ValidatorParamsSDKType, VersionParams, VersionParamsSDKType } from "../types/params.js"; +import { PublicKey, PublicKeySDKType } from "../crypto/keys.js"; +import { EndpointOrRpc, buildQuery } from "../../helper-func-types.js"; +import { RequestEcho, RequestEchoSDKType, ResponseEcho, ResponseEchoSDKType, RequestFlush, RequestFlushSDKType, ResponseFlush, ResponseFlushSDKType, RequestInfo, RequestInfoSDKType, ResponseInfo, ResponseInfoSDKType, RequestSetOption, RequestSetOptionSDKType, ResponseSetOption, ResponseSetOptionSDKType, RequestDeliverTx, RequestDeliverTxSDKType, ResponseDeliverTx, ResponseDeliverTxSDKType, RequestCheckTx, RequestCheckTxSDKType, ResponseCheckTx, ResponseCheckTxSDKType, RequestQuery, RequestQuerySDKType, ResponseQuery, ResponseQuerySDKType, RequestCommit, RequestCommitSDKType, ResponseCommit, ResponseCommitSDKType, RequestInitChain, RequestInitChainSDKType, ResponseInitChain, ResponseInitChainSDKType, RequestBeginBlock, RequestBeginBlockSDKType, ResponseBeginBlock, ResponseBeginBlockSDKType, RequestEndBlock, RequestEndBlockSDKType, ResponseEndBlock, ResponseEndBlockSDKType, RequestListSnapshots, RequestListSnapshotsSDKType, ResponseListSnapshots, ResponseListSnapshotsSDKType, RequestOfferSnapshot, RequestOfferSnapshotSDKType, ResponseOfferSnapshot, ResponseOfferSnapshotSDKType, RequestLoadSnapshotChunk, RequestLoadSnapshotChunkSDKType, ResponseLoadSnapshotChunk, ResponseLoadSnapshotChunkSDKType, RequestApplySnapshotChunk, RequestApplySnapshotChunkSDKType, ResponseApplySnapshotChunk, ResponseApplySnapshotChunkSDKType } from "./types.js"; +/** + * @name getEcho + * @package tendermint.abci + * @see proto service: tendermint.abci.Echo + */ +export const getEcho = buildQuery({ + encode: RequestEcho.encode, + decode: ResponseEcho.decode, + service: "tendermint.abci.ABCIApplication", + method: "Echo" +}); +/** + * @name getFlush + * @package tendermint.abci + * @see proto service: tendermint.abci.Flush + */ +export const getFlush = buildQuery({ + encode: RequestFlush.encode, + decode: ResponseFlush.decode, + service: "tendermint.abci.ABCIApplication", + method: "Flush" +}); +/** + * @name getInfo + * @package tendermint.abci + * @see proto service: tendermint.abci.Info + */ +export const getInfo = buildQuery({ + encode: RequestInfo.encode, + decode: ResponseInfo.decode, + service: "tendermint.abci.ABCIApplication", + method: "Info" +}); +/** + * @name getSetOption + * @package tendermint.abci + * @see proto service: tendermint.abci.SetOption + */ +export const getSetOption = buildQuery({ + encode: RequestSetOption.encode, + decode: ResponseSetOption.decode, + service: "tendermint.abci.ABCIApplication", + method: "SetOption" +}); +/** + * @name getDeliverTx + * @package tendermint.abci + * @see proto service: tendermint.abci.DeliverTx + */ +export const getDeliverTx = buildQuery({ + encode: RequestDeliverTx.encode, + decode: ResponseDeliverTx.decode, + service: "tendermint.abci.ABCIApplication", + method: "DeliverTx" +}); +/** + * @name getCheckTx + * @package tendermint.abci + * @see proto service: tendermint.abci.CheckTx + */ +export const getCheckTx = buildQuery({ + encode: RequestCheckTx.encode, + decode: ResponseCheckTx.decode, + service: "tendermint.abci.ABCIApplication", + method: "CheckTx" +}); +/** + * @name getQuery + * @package tendermint.abci + * @see proto service: tendermint.abci.Query + */ +export const getQuery = buildQuery({ + encode: RequestQuery.encode, + decode: ResponseQuery.decode, + service: "tendermint.abci.ABCIApplication", + method: "Query" +}); +/** + * @name getCommit + * @package tendermint.abci + * @see proto service: tendermint.abci.Commit + */ +export const getCommit = buildQuery({ + encode: RequestCommit.encode, + decode: ResponseCommit.decode, + service: "tendermint.abci.ABCIApplication", + method: "Commit" +}); +/** + * @name getInitChain + * @package tendermint.abci + * @see proto service: tendermint.abci.InitChain + */ +export const getInitChain = buildQuery({ + encode: RequestInitChain.encode, + decode: ResponseInitChain.decode, + service: "tendermint.abci.ABCIApplication", + method: "InitChain" +}); +/** + * @name getBeginBlock + * @package tendermint.abci + * @see proto service: tendermint.abci.BeginBlock + */ +export const getBeginBlock = buildQuery({ + encode: RequestBeginBlock.encode, + decode: ResponseBeginBlock.decode, + service: "tendermint.abci.ABCIApplication", + method: "BeginBlock" +}); +/** + * @name getEndBlock + * @package tendermint.abci + * @see proto service: tendermint.abci.EndBlock + */ +export const getEndBlock = buildQuery({ + encode: RequestEndBlock.encode, + decode: ResponseEndBlock.decode, + service: "tendermint.abci.ABCIApplication", + method: "EndBlock" +}); +/** + * @name getListSnapshots + * @package tendermint.abci + * @see proto service: tendermint.abci.ListSnapshots + */ +export const getListSnapshots = buildQuery({ + encode: RequestListSnapshots.encode, + decode: ResponseListSnapshots.decode, + service: "tendermint.abci.ABCIApplication", + method: "ListSnapshots" +}); +/** + * @name getOfferSnapshot + * @package tendermint.abci + * @see proto service: tendermint.abci.OfferSnapshot + */ +export const getOfferSnapshot = buildQuery({ + encode: RequestOfferSnapshot.encode, + decode: ResponseOfferSnapshot.decode, + service: "tendermint.abci.ABCIApplication", + method: "OfferSnapshot" +}); +/** + * @name getLoadSnapshotChunk + * @package tendermint.abci + * @see proto service: tendermint.abci.LoadSnapshotChunk + */ +export const getLoadSnapshotChunk = buildQuery({ + encode: RequestLoadSnapshotChunk.encode, + decode: ResponseLoadSnapshotChunk.decode, + service: "tendermint.abci.ABCIApplication", + method: "LoadSnapshotChunk" +}); +/** + * @name getApplySnapshotChunk + * @package tendermint.abci + * @see proto service: tendermint.abci.ApplySnapshotChunk + */ +export const getApplySnapshotChunk = buildQuery({ + encode: RequestApplySnapshotChunk.encode, + decode: ResponseApplySnapshotChunk.decode, + service: "tendermint.abci.ABCIApplication", + method: "ApplySnapshotChunk" +}); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/tendermint/bundle.ts b/__fixtures__/v-next/outputv4/tendermint/bundle.ts index 168b2d6d4d..bb08923e50 100644 --- a/__fixtures__/v-next/outputv4/tendermint/bundle.ts +++ b/__fixtures__/v-next/outputv4/tendermint/bundle.ts @@ -9,13 +9,15 @@ import * as _312 from "./types/params.js"; import * as _313 from "./types/types.js"; import * as _314 from "./types/validator.js"; import * as _315 from "./version/types.js"; -import * as _535 from "./abci/types.rpc.ABCIApplication.js"; -import * as _560 from "./lcd.js"; -import * as _561 from "./rpc.query.js"; +import * as _627 from "./abci/types.rpc.func.js"; +import * as _628 from "./abci/types.rpc.ABCIApplication.js"; +import * as _653 from "./lcd.js"; +import * as _654 from "./rpc.query.js"; export namespace tendermint { export const abci = { ..._305, - ..._535 + ..._627, + ..._628 }; export const crypto = { ..._306, @@ -40,7 +42,7 @@ export namespace tendermint { ..._315 }; export const ClientFactory = { - ..._560, - ..._561 + ..._653, + ..._654 }; } \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/types.ts b/__fixtures__/v-next/outputv4/types.ts new file mode 100644 index 0000000000..5675862640 --- /dev/null +++ b/__fixtures__/v-next/outputv4/types.ts @@ -0,0 +1,109 @@ +/** +* This file and any referenced files were automatically generated by @hyperweb/telescope@latest +* DO NOT MODIFY BY HAND. Instead, download the latest proto files for your chain +* and run the transpile command or npm scripts command that is used to regenerate this bundle. +*/ + +import { IBinaryReader, IBinaryWriter } from "./binary.js"; +import { Any } from "./google/protobuf/any.js"; + +import { HttpEndpoint } from "@interchainjs/types"; + + +import { DeliverTxResponse, Event, Attribute } from "@interchainjs/types"; + +export { DeliverTxResponse } + + +export type ProtoMsg = Omit & { typeUrl: any }; + +export interface IAminoMsg { + type: any; + value: Amino; +} + +export interface IProtoType { + $typeUrl?: any; +} + +/** + * A type generated by Telescope 1.0. + */ +export interface TelescopeGeneratedCodec< + T = unknown, + SDK = unknown, + Amino = unknown +> { + readonly typeUrl: string; + readonly aminoType?: string; + is?(o: unknown): o is T; + isSDK?(o: unknown): o is SDK; + isAmino?(o: unknown): o is Amino; + encode: (message: T, writer?: IBinaryWriter | any) => IBinaryWriter | any; + decode: (input: IBinaryReader | Uint8Array | any, length?: number) => T; + fromPartial: (object: any) => T | any; + fromJSON?: (object: any) => T | any; + toJSON?: (message: T | any) => any; + fromSDK?: (sdk: SDK) => T; + fromSDKJSON?: (object: any) => SDK; + toSDK?: (message: T) => SDK; + fromAmino?: (amino: Amino) => T; + toAmino?: (message: T) => Amino; + fromAminoMsg?: (aminoMsg: IAminoMsg) => T; + toAminoMsg?: (message: T) => IAminoMsg; + toProto?: (message: T) => Uint8Array; + fromProtoMsg?: (message: ProtoMsg) => T; + toProtoMsg?: (message: T) => Any; + registerTypeUrl?: () => void; +} + +export type TelescopeGeneratedType< + T = unknown, + SDK = unknown, + Amino = unknown +> = TelescopeGeneratedCodec; + +export type GeneratedType = TelescopeGeneratedCodec; + +/** + * Coin defines a token with a denomination and an amount. + * + * NOTE: The amount field is an Int which implements the custom method + * signatures required by gogoproto. + */ +interface Coin { + denom: string; + amount: string; +} + +export type EncodeObject = Message; + +export interface Message { + typeUrl: string; + value: T; +} + +export interface StdFee { + amount: Coin[]; + gas: string; + /** The granter address that is used for paying with feegrants */ + granter?: string; + /** The fee payer address. The payer must have signed the transaction. */ + payer?: string; +} + + +export interface TxRpc { + request( + service: string, + method: string, + data: Uint8Array + ): Promise; + signAndBroadcast?( + signerAddress: string, + messages: EncodeObject[], + fee: StdFee | "auto" | number, + memo: string + ): Promise; +} + diff --git a/package.json b/package.json index c30fc7bd96..a5054e65d8 100644 --- a/package.json +++ b/package.json @@ -30,12 +30,12 @@ "@cosmjs/proto-signing": "^0.32.0", "@cosmjs/stargate": "^0.32.0", "@cosmjs/tendermint-rpc": "^0.32.0", - "@interchainjs/cosmos": "1.12.1", - "@interchainjs/types": "1.12.1", - "@interchainjs/math": "1.12.1", - "@interchainjs/pubkey": "1.12.1", - "@interchainjs/encoding": "1.12.1", - "@interchainjs/utils": "1.12.1", + "@interchainjs/cosmos": "1.13.0", + "@interchainjs/types": "1.13.0", + "@interchainjs/math": "1.13.0", + "@interchainjs/pubkey": "1.13.0", + "@interchainjs/encoding": "1.13.0", + "@interchainjs/utils": "1.13.0", "@keplr-wallet/unit": "^0.12.53", "eslint": "8.38.0", "eslint-config-prettier": "^8.8.0", 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 d37d932140..bcf0fee1c2 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 @@ -35,7 +35,8 @@ export const getBalance = buildQuery( encode: QueryBalanceRequest.encode, decode: QueryBalanceResponse.decode, service: "cosmos.bank.v1beta1.Query", - method: "Balance" + method: "Balance", + deps: [QueryBalanceRequest, QueryBalanceResponse] });" `; diff --git a/packages/ast/src/clients/rpc/class/tendermint/__snapshots__/rpc.arrowFunc.test.ts.snap b/packages/ast/src/clients/rpc/class/tendermint/__snapshots__/rpc.arrowFunc.test.ts.snap index e132352c06..9218811165 100644 --- a/packages/ast/src/clients/rpc/class/tendermint/__snapshots__/rpc.arrowFunc.test.ts.snap +++ b/packages/ast/src/clients/rpc/class/tendermint/__snapshots__/rpc.arrowFunc.test.ts.snap @@ -26,8 +26,8 @@ export interface Query { exports[`RPC Query Client 2`] = ` "export class QueryClientImpl implements Query { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; } /* Accounts returns all the existing accounts diff --git a/packages/ast/src/clients/rpc/class/tendermint/__snapshots__/rpc.msg.test.ts.snap b/packages/ast/src/clients/rpc/class/tendermint/__snapshots__/rpc.msg.test.ts.snap index c7588c5bba..e4d39d3016 100644 --- a/packages/ast/src/clients/rpc/class/tendermint/__snapshots__/rpc.msg.test.ts.snap +++ b/packages/ast/src/clients/rpc/class/tendermint/__snapshots__/rpc.msg.test.ts.snap @@ -12,8 +12,8 @@ export interface Msg { exports[`RPC Msg Client but Query implement 2`] = ` "export class MsgClientImpl implements Msg { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.send = this.send.bind(this); this.multiSend = this.multiSend.bind(this); @@ -49,8 +49,8 @@ export interface Msg { exports[`RPC Msg Query mixed implement Client 2`] = ` "export class MsgClientImpl implements Msg { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.send = this.send.bind(this); this.multiSend = this.multiSend.bind(this); @@ -82,8 +82,8 @@ export interface Msg { exports[`RPC Msg implement Client 2`] = ` "export class MsgClientImpl implements Msg { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.send = this.send.bind(this); this.multiSend = this.multiSend.bind(this); diff --git a/packages/ast/src/clients/rpc/class/tendermint/__snapshots__/rpc.query.test.ts.snap b/packages/ast/src/clients/rpc/class/tendermint/__snapshots__/rpc.query.test.ts.snap index abdab29448..46dab5ec2b 100644 --- a/packages/ast/src/clients/rpc/class/tendermint/__snapshots__/rpc.query.test.ts.snap +++ b/packages/ast/src/clients/rpc/class/tendermint/__snapshots__/rpc.query.test.ts.snap @@ -26,8 +26,8 @@ export interface Query { exports[`RPC Query Client 2`] = ` "export class QueryClientImpl implements Query { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.accounts = this.accounts.bind(this); this.account = this.account.bind(this); diff --git a/packages/ast/src/clients/rpc/class/tendermint/__snapshots__/rpc.service.test.ts.snap b/packages/ast/src/clients/rpc/class/tendermint/__snapshots__/rpc.service.test.ts.snap index 6f7c4057cf..c593ff50b8 100644 --- a/packages/ast/src/clients/rpc/class/tendermint/__snapshots__/rpc.service.test.ts.snap +++ b/packages/ast/src/clients/rpc/class/tendermint/__snapshots__/rpc.service.test.ts.snap @@ -20,8 +20,8 @@ export interface Service { exports[`RPC Service Client 2`] = ` "export class ServiceClientImpl implements Service { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { + private readonly rpc: TxRpc; + constructor(rpc: TxRpc) { this.rpc = rpc; this.getNodeInfo = this.getNodeInfo.bind(this); this.getSyncing = this.getSyncing.bind(this); diff --git a/packages/ast/src/clients/rpc/extension/__snapshots__/rpc.extension.test.ts.snap b/packages/ast/src/clients/rpc/extension/__snapshots__/rpc.extension.test.ts.snap index 782bb3dfd0..7d14c47a5a 100644 --- a/packages/ast/src/clients/rpc/extension/__snapshots__/rpc.extension.test.ts.snap +++ b/packages/ast/src/clients/rpc/extension/__snapshots__/rpc.extension.test.ts.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`createRpcClientImpl 1`] = ` -"export const createClientImpl = (rpc: Rpc) => { +"export const createClientImpl = (rpc: TxRpc) => { return new QueryClientImpl(rpc); };" `; diff --git a/packages/ast/src/clients/rpc/instant/__snapshots__/instant.rpc.test.ts.snap b/packages/ast/src/clients/rpc/instant/__snapshots__/instant.rpc.test.ts.snap index ac089fcc77..272cceb06a 100644 --- a/packages/ast/src/clients/rpc/instant/__snapshots__/instant.rpc.test.ts.snap +++ b/packages/ast/src/clients/rpc/instant/__snapshots__/instant.rpc.test.ts.snap @@ -2,8 +2,8 @@ exports[`createInstantRpcClass 1`] = ` "export class CosmosAuth { - rpc: Rpc; - init(rpc: Rpc) { + rpc: TxRpc; + init(rpc: TxRpc) { this.rpc = rpc; this.authAccount = _CosmosAuthV1beta1Queryrpc.createClientImpl(rpc).account; this.bankAccount = _CosmosBankV1beta1Queryrpc.createClientImpl(rpc).account; @@ -13,8 +13,8 @@ exports[`createInstantRpcClass 1`] = ` exports[`createInstantRpcClass 2`] = ` "export class CosmosAuth { - rpc: Rpc; - init(rpc: Rpc) { + rpc: TxRpc; + init(rpc: TxRpc) { this.rpc = rpc; this.authAccount = _CosmosAuthV1beta1Queryrpc.createClientImpl(rpc).account; this.bankAccount = _CosmosBankV1beta1Msgrpc.createClientImpl(rpc).account; diff --git a/packages/ast/src/encoding/__snapshots__/object.spec.ts.snap b/packages/ast/src/encoding/__snapshots__/object.spec.ts.snap index d4462d0b26..a24d0ad04a 100644 --- a/packages/ast/src/encoding/__snapshots__/object.spec.ts.snap +++ b/packages/ast/src/encoding/__snapshots__/object.spec.ts.snap @@ -1,8 +1,23 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`cosmos/staking/v1beta1 Delegation 1`] = ` -"export const Delegation = { +"/** + * Delegation represents the bond with tokens held by an account. It is + * owned by one delegator, and is associated with the voting power of one + * validator. + * @name Delegation + * @package cosmos.staking.v1beta1 + * @see proto type: cosmos.staking.v1beta1.Delegation + */ +export const Delegation = { typeUrl: "/cosmos.staking.v1beta1.Delegation", + aminoType: "cosmos-sdk/Delegation", + is(o: any): o is Delegation { + return o && (o.$typeUrl === Delegation.typeUrl || typeof o.delegatorAddress === "string" && typeof o.validatorAddress === "string" && typeof o.shares === "string"); + }, + isSDK(o: any): o is DelegationSDKType { + return o && (o.$typeUrl === Delegation.typeUrl || typeof o.delegator_address === "string" && typeof o.validator_address === "string" && typeof o.shares === "string"); + }, encode(message: Delegation, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.delegatorAddress !== "") { writer.uint32(10).string(message.delegatorAddress); @@ -90,7 +105,7 @@ exports[`cosmos/staking/v1beta1 Delegation 1`] = ` const obj: any = {}; obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; - obj.shares = message.shares === "" ? undefined : message.shares; + obj.shares = message.shares === "" ? undefined : Decimal.fromUserInput(message.shares, 18).atomics; return obj; }, fromAminoMsg(object: DelegationAminoMsg): Delegation { @@ -113,13 +128,29 @@ exports[`cosmos/staking/v1beta1 Delegation 1`] = ` typeUrl: "/cosmos.staking.v1beta1.Delegation", value: Delegation.encode(message).finish() }; - } + }, + registerTypeUrl() {} };" `; exports[`cosmos/staking/v1beta1 Delegation useCosmosSDKDec 1`] = ` -"export const Delegation = { +"/** + * Delegation represents the bond with tokens held by an account. It is + * owned by one delegator, and is associated with the voting power of one + * validator. + * @name Delegation + * @package cosmos.staking.v1beta1 + * @see proto type: cosmos.staking.v1beta1.Delegation + */ +export const Delegation = { typeUrl: "/cosmos.staking.v1beta1.Delegation", + aminoType: "cosmos-sdk/Delegation", + is(o: any): o is Delegation { + return o && (o.$typeUrl === Delegation.typeUrl || typeof o.delegatorAddress === "string" && typeof o.validatorAddress === "string" && typeof o.shares === "string"); + }, + isSDK(o: any): o is DelegationSDKType { + return o && (o.$typeUrl === Delegation.typeUrl || typeof o.delegator_address === "string" && typeof o.validator_address === "string" && typeof o.shares === "string"); + }, encode(message: Delegation, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.delegatorAddress !== "") { writer.uint32(10).string(message.delegatorAddress); @@ -230,13 +261,30 @@ exports[`cosmos/staking/v1beta1 Delegation useCosmosSDKDec 1`] = ` typeUrl: "/cosmos.staking.v1beta1.Delegation", value: Delegation.encode(message).finish() }; - } + }, + registerTypeUrl() {} };" `; exports[`cosmos/tx/signing/v1beta1/signing SignatureDescriptor 1`] = ` -"export const SignatureDescriptor = { +"/** + * SignatureDescriptor is a convenience type which represents the full data for + * a signature including the public key of the signer, signing modes and the + * signature itself. It is primarily used for coordinating signatures between + * clients. + * @name SignatureDescriptor + * @package cosmos.tx.signing.v1beta1 + * @see proto type: cosmos.tx.signing.v1beta1.SignatureDescriptor + */ +export const SignatureDescriptor = { typeUrl: "/cosmos.tx.signing.v1beta1.SignatureDescriptor", + aminoType: "cosmos-sdk/SignatureDescriptor", + is(o: any): o is SignatureDescriptor { + return o && (o.$typeUrl === SignatureDescriptor.typeUrl || typeof o.sequence === "bigint"); + }, + isSDK(o: any): o is SignatureDescriptorSDKType { + return o && (o.$typeUrl === SignatureDescriptor.typeUrl || typeof o.sequence === "bigint"); + }, encode(message: SignatureDescriptor, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.publicKey !== undefined) { Any.encode(message.publicKey, writer.uint32(10).fork()).ldelim(); @@ -347,13 +395,32 @@ exports[`cosmos/tx/signing/v1beta1/signing SignatureDescriptor 1`] = ` typeUrl: "/cosmos.tx.signing.v1beta1.SignatureDescriptor", value: SignatureDescriptor.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(SignatureDescriptor.typeUrl)) { + return; + } + SignatureDescriptor_Data.registerTypeUrl(); } };" `; exports[`cosmos/tx/signing/v1beta1/signing SignatureDescriptors 1`] = ` -"export const SignatureDescriptors = { +"/** + * SignatureDescriptors wraps multiple SignatureDescriptor's. + * @name SignatureDescriptors + * @package cosmos.tx.signing.v1beta1 + * @see proto type: cosmos.tx.signing.v1beta1.SignatureDescriptors + */ +export const SignatureDescriptors = { typeUrl: "/cosmos.tx.signing.v1beta1.SignatureDescriptors", + aminoType: "cosmos-sdk/SignatureDescriptors", + is(o: any): o is SignatureDescriptors { + return o && (o.$typeUrl === SignatureDescriptors.typeUrl || Array.isArray(o.signatures) && (!o.signatures.length || SignatureDescriptor.is(o.signatures[0]))); + }, + isSDK(o: any): o is SignatureDescriptorsSDKType { + return o && (o.$typeUrl === SignatureDescriptors.typeUrl || Array.isArray(o.signatures) && (!o.signatures.length || SignatureDescriptor.isSDK(o.signatures[0]))); + }, encode(message: SignatureDescriptors, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.signatures) { SignatureDescriptor.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -444,13 +511,37 @@ exports[`cosmos/tx/signing/v1beta1/signing SignatureDescriptors 1`] = ` typeUrl: "/cosmos.tx.signing.v1beta1.SignatureDescriptors", value: SignatureDescriptors.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(SignatureDescriptors.typeUrl)) { + return; + } + SignatureDescriptor.registerTypeUrl(); } };" `; exports[`cosmos/tx/v1beta1/tx AuxSignerData 1`] = ` -"export const AuxSignerData = { +"/** + * AuxSignerData is the intermediary format that an auxiliary signer (e.g. a + * tipper) builds and sends to the fee payer (who will build and broadcast the + * actual tx). AuxSignerData is not a valid tx in itself, and will be rejected + * by the node if sent directly as-is. + * + * Since: cosmos-sdk 0.46 + * @name AuxSignerData + * @package cosmos.tx.v1beta1 + * @see proto type: cosmos.tx.v1beta1.AuxSignerData + */ +export const AuxSignerData = { typeUrl: "/cosmos.tx.v1beta1.AuxSignerData", + aminoType: "cosmos-sdk/AuxSignerData", + is(o: any): o is AuxSignerData { + return o && (o.$typeUrl === AuxSignerData.typeUrl || typeof o.address === "string" && isSet(o.mode) && (o.sig instanceof Uint8Array || typeof o.sig === "string")); + }, + isSDK(o: any): o is AuxSignerDataSDKType { + return o && (o.$typeUrl === AuxSignerData.typeUrl || typeof o.address === "string" && isSet(o.mode) && (o.sig instanceof Uint8Array || typeof o.sig === "string")); + }, encode(message: AuxSignerData, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.address !== "") { writer.uint32(10).string(message.address); @@ -576,13 +667,32 @@ exports[`cosmos/tx/v1beta1/tx AuxSignerData 1`] = ` typeUrl: "/cosmos.tx.v1beta1.AuxSignerData", value: AuxSignerData.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(AuxSignerData.typeUrl)) { + return; + } + SignDocDirectAux.registerTypeUrl(); } };" `; exports[`cosmos/tx/v1beta1/tx ModeInfo_Multi 1`] = ` -"export const ModeInfo_Multi = { +"/** + * ModeInfo describes the signing mode of a single or nested multisig signer. + * @name ModeInfo_Multi + * @package cosmos.tx.v1beta1 + * @see proto type: cosmos.tx.v1beta1.ModeInfo + */ +export const ModeInfo_Multi = { typeUrl: "/cosmos.tx.v1beta1.ModeInfo", + aminoType: "cosmos-sdk/ModeInfo", + is(o: any): o is ModeInfo_Multi { + return o && o.$typeUrl === ModeInfo_Multi.typeUrl; + }, + isSDK(o: any): o is ModeInfo_MultiSDKType { + return o && o.$typeUrl === ModeInfo_Multi.typeUrl; + }, encode(message: ModeInfo_Multi, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.single !== undefined) { ModeInfo_Single.encode(message.single, writer.uint32(10).fork()).ldelim(); @@ -678,13 +788,34 @@ exports[`cosmos/tx/v1beta1/tx ModeInfo_Multi 1`] = ` typeUrl: "/cosmos.tx.v1beta1.ModeInfo", value: ModeInfo_Multi.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ModeInfo_Multi.typeUrl)) { + return; + } + ModeInfo_Single.registerTypeUrl(); + ModeInfo_Multi.registerTypeUrl(); } };" `; exports[`cosmwasm/wasm/v1/proposal 1`] = ` -"export const PinCodesProposal = { +"/** + * PinCodesProposal gov proposal content type to pin a set of code ids in the + * wasmvm cache. + * @name PinCodesProposal + * @package cosmwasm.wasm.v1 + * @see proto type: cosmwasm.wasm.v1.PinCodesProposal + */ +export const PinCodesProposal = { typeUrl: "/cosmwasm.wasm.v1.PinCodesProposal", + aminoType: "wasm/PinCodesProposal", + is(o: any): o is PinCodesProposal { + return o && (o.$typeUrl === PinCodesProposal.typeUrl || typeof o.title === "string" && typeof o.description === "string" && Array.isArray(o.codeIds) && (!o.codeIds.length || typeof o.codeIds[0] === "bigint")); + }, + isSDK(o: any): o is PinCodesProposalSDKType { + return o && (o.$typeUrl === PinCodesProposal.typeUrl || typeof o.title === "string" && typeof o.description === "string" && Array.isArray(o.code_ids) && (!o.code_ids.length || typeof o.code_ids[0] === "bigint")); + }, encode(message: PinCodesProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.title !== "") { writer.uint32(10).string(message.title); @@ -814,13 +945,28 @@ exports[`cosmwasm/wasm/v1/proposal 1`] = ` typeUrl: "/cosmwasm.wasm.v1.PinCodesProposal", value: PinCodesProposal.encode(message).finish() }; - } + }, + registerTypeUrl() {} };" `; exports[`cosmwasm/wasm/v1/proposal 2`] = ` -"export const UnpinCodesProposal = { +"/** + * UnpinCodesProposal gov proposal content type to unpin a set of code ids in + * the wasmvm cache. + * @name UnpinCodesProposal + * @package cosmwasm.wasm.v1 + * @see proto type: cosmwasm.wasm.v1.UnpinCodesProposal + */ +export const UnpinCodesProposal = { typeUrl: "/cosmwasm.wasm.v1.UnpinCodesProposal", + aminoType: "wasm/UnpinCodesProposal", + is(o: any): o is UnpinCodesProposal { + return o && (o.$typeUrl === UnpinCodesProposal.typeUrl || typeof o.title === "string" && typeof o.description === "string" && Array.isArray(o.codeIds) && (!o.codeIds.length || typeof o.codeIds[0] === "bigint")); + }, + isSDK(o: any): o is UnpinCodesProposalSDKType { + return o && (o.$typeUrl === UnpinCodesProposal.typeUrl || typeof o.title === "string" && typeof o.description === "string" && Array.isArray(o.code_ids) && (!o.code_ids.length || typeof o.code_ids[0] === "bigint")); + }, encode(message: UnpinCodesProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.title !== "") { writer.uint32(10).string(message.title); @@ -950,13 +1096,28 @@ exports[`cosmwasm/wasm/v1/proposal 2`] = ` typeUrl: "/cosmwasm.wasm.v1.UnpinCodesProposal", value: UnpinCodesProposal.encode(message).finish() }; - } + }, + registerTypeUrl() {} };" `; exports[`cosmwasm/wasm/v1/query 1`] = ` -"export const QueryRawContractStateRequest = { +"/** + * QueryRawContractStateRequest is the request type for the + * Query/RawContractState RPC method + * @name QueryRawContractStateRequest + * @package cosmwasm.wasm.v1 + * @see proto type: cosmwasm.wasm.v1.QueryRawContractStateRequest + */ +export const QueryRawContractStateRequest = { typeUrl: "/cosmwasm.wasm.v1.QueryRawContractStateRequest", + aminoType: "wasm/QueryRawContractStateRequest", + is(o: any): o is QueryRawContractStateRequest { + return o && (o.$typeUrl === QueryRawContractStateRequest.typeUrl || typeof o.address === "string" && (o.queryData instanceof Uint8Array || typeof o.queryData === "string")); + }, + isSDK(o: any): o is QueryRawContractStateRequestSDKType { + return o && (o.$typeUrl === QueryRawContractStateRequest.typeUrl || typeof o.address === "string" && (o.query_data instanceof Uint8Array || typeof o.query_data === "string")); + }, encode(message: QueryRawContractStateRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.address !== "") { writer.uint32(10).string(message.address); @@ -1052,13 +1213,26 @@ exports[`cosmwasm/wasm/v1/query 1`] = ` typeUrl: "/cosmwasm.wasm.v1.QueryRawContractStateRequest", value: QueryRawContractStateRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} };" `; exports[`evmos/fees/v1/tx 1`] = ` -"export const MsgRegisterDevFeeInfo = { +"/** + * MsgRegisterFeesContract defines a message that registers a DevFeeInfo + * @name MsgRegisterDevFeeInfo + * @package evmos.fees.v1 + * @see proto type: evmos.fees.v1.MsgRegisterDevFeeInfo + */ +export const MsgRegisterDevFeeInfo = { typeUrl: "/evmos.fees.v1.MsgRegisterDevFeeInfo", + is(o: any): o is MsgRegisterDevFeeInfo { + return o && (o.$typeUrl === MsgRegisterDevFeeInfo.typeUrl || typeof o.contractAddress === "string" && typeof o.deployerAddress === "string" && typeof o.withdrawAddress === "string" && Array.isArray(o.nonces) && (!o.nonces.length || typeof o.nonces[0] === "bigint")); + }, + isSDK(o: any): o is MsgRegisterDevFeeInfoSDKType { + return o && (o.$typeUrl === MsgRegisterDevFeeInfo.typeUrl || typeof o.contract_address === "string" && typeof o.deployer_address === "string" && typeof o.withdraw_address === "string" && Array.isArray(o.nonces) && (!o.nonces.length || typeof o.nonces[0] === "bigint")); + }, encode(message: MsgRegisterDevFeeInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.contractAddress !== "") { writer.uint32(10).string(message.contractAddress); @@ -1197,13 +1371,26 @@ exports[`evmos/fees/v1/tx 1`] = ` typeUrl: "/evmos.fees.v1.MsgRegisterDevFeeInfo", value: MsgRegisterDevFeeInfo.encode(message).finish() }; - } + }, + registerTypeUrl() {} };" `; exports[`google/api/expr/conformance/v1alpha1/conformance_service ParseRequest 1`] = ` -"export const ParseRequest = { +"/** + * Request message for the Parse method. + * @name ParseRequest + * @package google.api.expr.conformance.v1alpha1 + * @see proto type: google.api.expr.conformance.v1alpha1.ParseRequest + */ +export const ParseRequest = { typeUrl: "/google.api.expr.conformance.v1alpha1.ParseRequest", + is(o: any): o is ParseRequest { + return o && (o.$typeUrl === ParseRequest.typeUrl || typeof o.celSource === "string" && typeof o.syntaxVersion === "string" && typeof o.sourceLocation === "string" && typeof o.disableMacros === "boolean"); + }, + isSDK(o: any): o is ParseRequestSDKType { + return o && (o.$typeUrl === ParseRequest.typeUrl || typeof o.cel_source === "string" && typeof o.syntax_version === "string" && typeof o.source_location === "string" && typeof o.disable_macros === "boolean"); + }, encode(message: ParseRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.celSource !== "") { writer.uint32(10).string(message.celSource); @@ -1323,13 +1510,35 @@ exports[`google/api/expr/conformance/v1alpha1/conformance_service ParseRequest 1 typeUrl: "/google.api.expr.conformance.v1alpha1.ParseRequest", value: ParseRequest.encode(message).finish() }; - } + }, + registerTypeUrl() {} };" `; exports[`google/api/expr/v1alpha1/checked Decl_FunctionDecl_Overload MapType 1`] = ` -"export const Decl_FunctionDecl_Overload = { +"/** + * An overload indicates a function's parameter types and return type, and + * may optionally include a function body described in terms of [Expr][google.api.expr.v1alpha1.Expr] + * values. + * + * Functions overloads are declared in either a function or method + * call-style. For methods, the \`params[0]\` is the expected type of the + * target receiver. + * + * Overloads must have non-overlapping argument types after erasure of all + * parameterized type variables (similar as type erasure in Java). + * @name Decl_FunctionDecl_Overload + * @package google.api.expr.v1alpha1 + * @see proto type: google.api.expr.v1alpha1.Overload + */ +export const Decl_FunctionDecl_Overload = { typeUrl: "/google.api.expr.v1alpha1.Overload", + is(o: any): o is Decl_FunctionDecl_Overload { + return o && (o.$typeUrl === Decl_FunctionDecl_Overload.typeUrl || typeof o.overloadId === "string" && Array.isArray(o.params) && (!o.params.length || Type.is(o.params[0])) && Array.isArray(o.typeParams) && (!o.typeParams.length || typeof o.typeParams[0] === "string") && typeof o.isInstanceFunction === "boolean" && typeof o.doc === "string"); + }, + isSDK(o: any): o is Decl_FunctionDecl_OverloadSDKType { + return o && (o.$typeUrl === Decl_FunctionDecl_Overload.typeUrl || typeof o.overload_id === "string" && Array.isArray(o.params) && (!o.params.length || Type.isSDK(o.params[0])) && Array.isArray(o.type_params) && (!o.type_params.length || typeof o.type_params[0] === "string") && typeof o.is_instance_function === "boolean" && typeof o.doc === "string"); + }, encode(message: Decl_FunctionDecl_Overload, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.overloadId !== "") { writer.uint32(10).string(message.overloadId); @@ -1499,13 +1708,31 @@ exports[`google/api/expr/v1alpha1/checked Decl_FunctionDecl_Overload MapType 1`] typeUrl: "/google.api.expr.v1alpha1.Overload", value: Decl_FunctionDecl_Overload.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Decl_FunctionDecl_Overload.typeUrl)) { + return; + } + Type.registerTypeUrl(); } };" `; exports[`google/api/expr/v1alpha1/checked Type 1`] = ` -"export const Type = { +"/** + * Represents a CEL type. + * @name Type + * @package google.api.expr.v1alpha1 + * @see proto type: google.api.expr.v1alpha1.Type + */ +export const Type = { typeUrl: "/google.api.expr.v1alpha1.Type", + is(o: any): o is Type { + return o && o.$typeUrl === Type.typeUrl; + }, + isSDK(o: any): o is TypeSDKType { + return o && o.$typeUrl === Type.typeUrl; + }, encode(message: Type, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.dyn !== undefined) { Empty.encode(message.dyn, writer.uint32(10).fork()).ldelim(); @@ -1760,13 +1987,36 @@ exports[`google/api/expr/v1alpha1/checked Type 1`] = ` typeUrl: "/google.api.expr.v1alpha1.Type", value: Type.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Type.typeUrl)) { + return; + } + Empty.registerTypeUrl(); + Type_ListType.registerTypeUrl(); + Type_MapType.registerTypeUrl(); + Type_FunctionType.registerTypeUrl(); + Type.registerTypeUrl(); + Type_AbstractType.registerTypeUrl(); } };" `; exports[`google/api/expr/v1alpha1/checked nested MapType 1`] = ` -"export const Type_MapType = { +"/** + * Map type with parameterized key and value types, e.g. \`map\`. + * @name Type_MapType + * @package google.api.expr.v1alpha1 + * @see proto type: google.api.expr.v1alpha1.MapType + */ +export const Type_MapType = { typeUrl: "/google.api.expr.v1alpha1.MapType", + is(o: any): o is Type_MapType { + return o && o.$typeUrl === Type_MapType.typeUrl; + }, + isSDK(o: any): o is Type_MapTypeSDKType { + return o && o.$typeUrl === Type_MapType.typeUrl; + }, encode(message: Type_MapType, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.keyType !== undefined) { Type.encode(message.keyType, writer.uint32(10).fork()).ldelim(); @@ -1856,13 +2106,31 @@ exports[`google/api/expr/v1alpha1/checked nested MapType 1`] = ` typeUrl: "/google.api.expr.v1alpha1.MapType", value: Type_MapType.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Type_MapType.typeUrl)) { + return; + } + Type.registerTypeUrl(); } };" `; exports[`google/api/expr/v1alpha1/checked typeHash (Long) CheckedExpr 1`] = ` -"export const CheckedExpr = { +"/** + * A CEL expression which has been successfully type checked. + * @name CheckedExpr + * @package google.api.expr.v1alpha1 + * @see proto type: google.api.expr.v1alpha1.CheckedExpr + */ +export const CheckedExpr = { typeUrl: "/google.api.expr.v1alpha1.CheckedExpr", + is(o: any): o is CheckedExpr { + return o && (o.$typeUrl === CheckedExpr.typeUrl || isSet(o.referenceMap) && isSet(o.typeMap) && typeof o.exprVersion === "string"); + }, + isSDK(o: any): o is CheckedExprSDKType { + return o && (o.$typeUrl === CheckedExpr.typeUrl || isSet(o.reference_map) && isSet(o.type_map) && typeof o.expr_version === "string"); + }, encode(message: CheckedExpr, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { Object.entries(message.referenceMap).forEach(([key, value]) => { CheckedExpr_ReferenceMapEntry.encode({ @@ -2083,13 +2351,46 @@ exports[`google/api/expr/v1alpha1/checked typeHash (Long) CheckedExpr 1`] = ` typeUrl: "/google.api.expr.v1alpha1.CheckedExpr", value: CheckedExpr.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(CheckedExpr.typeUrl)) { + return; + } + Reference.registerTypeUrl(); + Type.registerTypeUrl(); + SourceInfo.registerTypeUrl(); + Expr.registerTypeUrl(); } };" `; exports[`google/api/expr/v1alpha1/syntax Constant 1`] = ` -"export const Constant = { +"/** + * Represents a primitive literal. + * + * Named 'Constant' here for backwards compatibility. + * + * This is similar as the primitives supported in the well-known type + * \`google.protobuf.Value\`, but richer so it can represent CEL's full range of + * primitives. + * + * Lists and structs are not included as constants as these aggregate types may + * contain [Expr][google.api.expr.v1alpha1.Expr] elements which require evaluation and are thus not constant. + * + * Examples of literals include: \`"hello"\`, \`b'bytes'\`, \`1u\`, \`4.2\`, \`-2\`, + * \`true\`, \`null\`. + * @name Constant + * @package google.api.expr.v1alpha1 + * @see proto type: google.api.expr.v1alpha1.Constant + */ +export const Constant = { typeUrl: "/google.api.expr.v1alpha1.Constant", + is(o: any): o is Constant { + return o && o.$typeUrl === Constant.typeUrl; + }, + isSDK(o: any): o is ConstantSDKType { + return o && o.$typeUrl === Constant.typeUrl; + }, encode(message: Constant, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.nullValue !== undefined) { writer.uint32(8).int32(message.nullValue); @@ -2171,7 +2472,7 @@ exports[`google/api/expr/v1alpha1/syntax Constant 1`] = ` stringValue: isSet(object.stringValue) ? String(object.stringValue) : undefined, bytesValue: isSet(object.bytesValue) ? bytesFromBase64(object.bytesValue) : undefined, durationValue: isSet(object.durationValue) ? Duration.fromJSON(object.durationValue) : undefined, - timestampValue: isSet(object.timestampValue) ? fromJsonTimestamp(object.timestampValue) : undefined + timestampValue: isSet(object.timestampValue) ? new Date(object.timestampValue) : undefined }; }, toJSON(message: Constant): JsonSafe { @@ -2214,7 +2515,7 @@ exports[`google/api/expr/v1alpha1/syntax Constant 1`] = ` stringValue: object?.string_value, bytesValue: object?.bytes_value, durationValue: object.duration_value ? Duration.fromSDK(object.duration_value) : undefined, - timestampValue: object.timestamp_value ? Timestamp.fromSDK(object.timestamp_value) : undefined + timestampValue: object.timestamp_value ?? undefined }; }, toSDK(message: Constant): ConstantSDKType { @@ -2227,7 +2528,7 @@ exports[`google/api/expr/v1alpha1/syntax Constant 1`] = ` obj.string_value = message.stringValue; obj.bytes_value = message.bytesValue; message.durationValue !== undefined && (obj.duration_value = message.durationValue ? Duration.toSDK(message.durationValue) : undefined); - message.timestampValue !== undefined && (obj.timestamp_value = message.timestampValue ? Timestamp.toSDK(message.timestampValue) : undefined); + message.timestampValue !== undefined && (obj.timestamp_value = message.timestampValue ?? undefined); return obj; }, fromAmino(object: ConstantAmino): Constant { @@ -2288,13 +2589,26 @@ exports[`google/api/expr/v1alpha1/syntax Constant 1`] = ` typeUrl: "/google.api.expr.v1alpha1.Constant", value: Constant.encode(message).finish() }; - } + }, + registerTypeUrl() {} };" `; exports[`google/api/expr/v1alpha1/value Entry 1`] = ` -"export const Entry = { +"/** + * An entry in the map. + * @name Entry + * @package google.api.expr.v1alpha1 + * @see proto type: google.api.expr.v1alpha1.Entry + */ +export const Entry = { typeUrl: "/google.api.expr.v1alpha1.Entry", + is(o: any): o is Entry { + return o && o.$typeUrl === Entry.typeUrl; + }, + isSDK(o: any): o is EntrySDKType { + return o && o.$typeUrl === Entry.typeUrl; + }, encode(message: Entry, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.key !== undefined) { Value.encode(message.key, writer.uint32(10).fork()).ldelim(); @@ -2384,6 +2698,12 @@ exports[`google/api/expr/v1alpha1/value Entry 1`] = ` typeUrl: "/google.api.expr.v1alpha1.Entry", value: Entry.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Entry.typeUrl)) { + return; + } + Value.registerTypeUrl(); } };" `; @@ -2391,8 +2711,23 @@ exports[`google/api/expr/v1alpha1/value Entry 1`] = ` exports[`google/api/expr/v1alpha1/value Entry 2`] = `[]`; exports[`google/api/expr/v1alpha1/value MapValue 1`] = ` -"export const MapValue = { +"/** + * A map. + * + * Wrapped in a message so 'not set' and empty can be differentiated, which is + * required for use in a 'oneof'. + * @name MapValue + * @package google.api.expr.v1alpha1 + * @see proto type: google.api.expr.v1alpha1.MapValue + */ +export const MapValue = { typeUrl: "/google.api.expr.v1alpha1.MapValue", + is(o: any): o is MapValue { + return o && (o.$typeUrl === MapValue.typeUrl || Array.isArray(o.entries) && (!o.entries.length || MapValue_Entry.is(o.entries[0]))); + }, + isSDK(o: any): o is MapValueSDKType { + return o && (o.$typeUrl === MapValue.typeUrl || Array.isArray(o.entries) && (!o.entries.length || MapValue_Entry.isSDK(o.entries[0]))); + }, encode(message: MapValue, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.entries) { MapValue_Entry.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -2477,6 +2812,12 @@ exports[`google/api/expr/v1alpha1/value MapValue 1`] = ` typeUrl: "/google.api.expr.v1alpha1.MapValue", value: MapValue.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MapValue.typeUrl)) { + return; + } + MapValue_Entry.registerTypeUrl(); } };" `; @@ -2484,8 +2825,20 @@ exports[`google/api/expr/v1alpha1/value MapValue 1`] = ` exports[`google/api/expr/v1alpha1/value MapValue 2`] = `[]`; exports[`google/api/expr/v1beta1/source 1`] = ` -"export const SourceInfo = { +"/** + * Source information collected at parse time. + * @name SourceInfo + * @package google.api.expr.v1beta1 + * @see proto type: google.api.expr.v1beta1.SourceInfo + */ +export const SourceInfo = { typeUrl: "/google.api.expr.v1beta1.SourceInfo", + is(o: any): o is SourceInfo { + return o && (o.$typeUrl === SourceInfo.typeUrl || typeof o.location === "string" && Array.isArray(o.lineOffsets) && (!o.lineOffsets.length || typeof o.lineOffsets[0] === "number") && isSet(o.positions)); + }, + isSDK(o: any): o is SourceInfoSDKType { + return o && (o.$typeUrl === SourceInfo.typeUrl || typeof o.location === "string" && Array.isArray(o.line_offsets) && (!o.line_offsets.length || typeof o.line_offsets[0] === "number") && isSet(o.positions)); + }, encode(message: SourceInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.location !== "") { writer.uint32(18).string(message.location); @@ -2652,13 +3005,27 @@ exports[`google/api/expr/v1beta1/source 1`] = ` typeUrl: "/google.api.expr.v1beta1.SourceInfo", value: SourceInfo.encode(message).finish() }; - } + }, + registerTypeUrl() {} };" `; exports[`google/api/quota keyType 1`] = ` -"export const MetricRule = { +"/** + * Bind API methods to metrics. Binding a method to a metric causes that + * metric's configured quota behaviors to apply to the method call. + * @name MetricRule + * @package google.api + * @see proto type: google.api.MetricRule + */ +export const MetricRule = { typeUrl: "/google.api.MetricRule", + is(o: any): o is MetricRule { + return o && (o.$typeUrl === MetricRule.typeUrl || typeof o.selector === "string" && isSet(o.metricCosts)); + }, + isSDK(o: any): o is MetricRuleSDKType { + return o && (o.$typeUrl === MetricRule.typeUrl || typeof o.selector === "string" && isSet(o.metric_costs)); + }, encode(message: MetricRule, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.selector !== "") { writer.uint32(10).string(message.selector); @@ -2791,15 +3158,28 @@ exports[`google/api/quota keyType 1`] = ` typeUrl: "/google.api.MetricRule", value: MetricRule.encode(message).finish() }; - } + }, + registerTypeUrl() {} };" `; exports[`google/api/quota keyType 2`] = `[]`; exports[`google/api/servicecontrol/v1/log_entry LogEntry 1`] = ` -"export const LogEntry = { +"/** + * An individual log entry. + * @name LogEntry + * @package google.api.servicecontrol.v1 + * @see proto type: google.api.servicecontrol.v1.LogEntry + */ +export const LogEntry = { typeUrl: "/google.api.servicecontrol.v1.LogEntry", + is(o: any): o is LogEntry { + return o && (o.$typeUrl === LogEntry.typeUrl || typeof o.name === "string" && isSet(o.severity) && typeof o.trace === "string" && typeof o.insertId === "string" && isSet(o.labels)); + }, + isSDK(o: any): o is LogEntrySDKType { + return o && (o.$typeUrl === LogEntry.typeUrl || typeof o.name === "string" && isSet(o.severity) && typeof o.trace === "string" && typeof o.insert_id === "string" && isSet(o.labels)); + }, encode(message: LogEntry, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(82).string(message.name); @@ -2898,7 +3278,7 @@ exports[`google/api/servicecontrol/v1/log_entry LogEntry 1`] = ` fromJSON(object: any): LogEntry { return { name: isSet(object.name) ? String(object.name) : "", - timestamp: isSet(object.timestamp) ? fromJsonTimestamp(object.timestamp) : undefined, + timestamp: isSet(object.timestamp) ? new Date(object.timestamp) : undefined, severity: isSet(object.severity) ? logSeverityFromJSON(object.severity) : -1, httpRequest: isSet(object.httpRequest) ? HttpRequest.fromJSON(object.httpRequest) : undefined, trace: isSet(object.trace) ? String(object.trace) : "", @@ -2963,7 +3343,7 @@ exports[`google/api/servicecontrol/v1/log_entry LogEntry 1`] = ` fromSDK(object: LogEntrySDKType): LogEntry { return { name: object?.name, - timestamp: object.timestamp ? Timestamp.fromSDK(object.timestamp) : undefined, + timestamp: object.timestamp ?? undefined, severity: isSet(object.severity) ? logSeverityFromJSON(object.severity) : -1, httpRequest: object.http_request ? HttpRequest.fromSDK(object.http_request) : undefined, trace: object?.trace, @@ -2984,7 +3364,7 @@ exports[`google/api/servicecontrol/v1/log_entry LogEntry 1`] = ` toSDK(message: LogEntry): LogEntrySDKType { const obj: any = {}; obj.name = message.name; - message.timestamp !== undefined && (obj.timestamp = message.timestamp ? Timestamp.toSDK(message.timestamp) : undefined); + message.timestamp !== undefined && (obj.timestamp = message.timestamp ?? undefined); message.severity !== undefined && (obj.severity = logSeverityToJSON(message.severity)); message.httpRequest !== undefined && (obj.http_request = message.httpRequest ? HttpRequest.toSDK(message.httpRequest) : undefined); obj.trace = message.trace; @@ -3082,6 +3462,14 @@ exports[`google/api/servicecontrol/v1/log_entry LogEntry 1`] = ` typeUrl: "/google.api.servicecontrol.v1.LogEntry", value: LogEntry.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(LogEntry.typeUrl)) { + return; + } + Struct.registerTypeUrl(); + LogEntryOperation.registerTypeUrl(); + LogEntrySourceLocation.registerTypeUrl(); } };" `; @@ -3093,16 +3481,37 @@ exports[`google/rpc/error_details name collisions 1`] = ` * For example, if an RPC failed because it required the Terms of Service to be * acknowledged, it could list the terms of service violation in the * PreconditionFailure message. + * @name PreconditionFailure + * @package google.rpc + * @see proto type: google.rpc.PreconditionFailure */ export interface PreconditionFailure { - /** Describes all precondition violations. */ + /** + * Describes all precondition violations. + */ violations: PreconditionFailure_Violation[]; }" `; exports[`google/rpc/error_details name collisions 2`] = ` -"export const PreconditionFailure = { +"/** + * Describes what preconditions have failed. + * + * For example, if an RPC failed because it required the Terms of Service to be + * acknowledged, it could list the terms of service violation in the + * PreconditionFailure message. + * @name PreconditionFailure + * @package google.rpc + * @see proto type: google.rpc.PreconditionFailure + */ +export const PreconditionFailure = { typeUrl: "/google.rpc.PreconditionFailure", + is(o: any): o is PreconditionFailure { + return o && (o.$typeUrl === PreconditionFailure.typeUrl || Array.isArray(o.violations) && (!o.violations.length || PreconditionFailure_Violation.is(o.violations[0]))); + }, + isSDK(o: any): o is PreconditionFailureSDKType { + return o && (o.$typeUrl === PreconditionFailure.typeUrl || Array.isArray(o.violations) && (!o.violations.length || PreconditionFailure_Violation.isSDK(o.violations[0]))); + }, encode(message: PreconditionFailure, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.violations) { PreconditionFailure_Violation.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -3187,13 +3596,32 @@ exports[`google/rpc/error_details name collisions 2`] = ` typeUrl: "/google.rpc.PreconditionFailure", value: PreconditionFailure.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(PreconditionFailure.typeUrl)) { + return; + } + PreconditionFailure_Violation.registerTypeUrl(); } };" `; exports[`ibc/core/port/v1/query 1`] = ` -"export const QueryAppVersionRequest = { +"/** + * QueryAppVersionRequest is the request type for the Query/AppVersion RPC method + * @name QueryAppVersionRequest + * @package ibc.core.port.v1 + * @see proto type: ibc.core.port.v1.QueryAppVersionRequest + */ +export const QueryAppVersionRequest = { typeUrl: "/ibc.core.port.v1.QueryAppVersionRequest", + aminoType: "cosmos-sdk/QueryAppVersionRequest", + is(o: any): o is QueryAppVersionRequest { + return o && (o.$typeUrl === QueryAppVersionRequest.typeUrl || typeof o.portId === "string" && typeof o.connectionId === "string" && isSet(o.ordering) && typeof o.proposedVersion === "string"); + }, + isSDK(o: any): o is QueryAppVersionRequestSDKType { + return o && (o.$typeUrl === QueryAppVersionRequest.typeUrl || typeof o.port_id === "string" && typeof o.connection_id === "string" && isSet(o.ordering) && typeof o.proposed_version === "string"); + }, encode(message: QueryAppVersionRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.portId !== "") { writer.uint32(10).string(message.portId); @@ -3334,6 +3762,12 @@ exports[`ibc/core/port/v1/query 1`] = ` typeUrl: "/ibc.core.port.v1.QueryAppVersionRequest", value: QueryAppVersionRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryAppVersionRequest.typeUrl)) { + return; + } + Counterparty.registerTypeUrl(); } };" `; @@ -3414,24 +3848,54 @@ exports[`ibc/core/port/v1/query 2`] = ` "name": "Counterparty", "type": "typeImport", }, + { + "import": "ibc/core/channel/v1/channel.proto", + "importedAs": "Counterparty", + "name": "Counterparty", + "type": "typeImport", + }, ] `; exports[`ibc/core/types/v1/genesis name collisions 1`] = ` -"/** GenesisState defines the ibc module's genesis state. */ +"/** + * GenesisState defines the ibc module's genesis state. + * @name GenesisState + * @package ibc.core.types.v1 + * @see proto type: ibc.core.types.v1.GenesisState + */ export interface GenesisState { - /** ICS002 - Clients genesis state */ + /** + * ICS002 - Clients genesis state + */ clientGenesis: GenesisState1; - /** ICS003 - Connections genesis state */ + /** + * ICS003 - Connections genesis state + */ connectionGenesis: GenesisState2; - /** ICS004 - Channel genesis state */ + /** + * ICS004 - Channel genesis state + */ channelGenesis: GenesisState3; }" `; exports[`ibc/core/types/v1/genesis name collisions 2`] = ` -"export const GenesisState = { +"/** + * GenesisState defines the ibc module's genesis state. + * @name GenesisState + * @package ibc.core.types.v1 + * @see proto type: ibc.core.types.v1.GenesisState + */ +export const GenesisState = { typeUrl: "/ibc.core.types.v1.GenesisState", + aminoType: "cosmos-sdk/GenesisState", + is(o: any): o is GenesisState { + return o && (o.$typeUrl === GenesisState.typeUrl || GenesisState1.is(o.clientGenesis) && GenesisState2.is(o.connectionGenesis) && GenesisState3.is(o.channelGenesis)); + }, + isSDK(o: any): o is GenesisStateSDKType { + return o && (o.$typeUrl === GenesisState.typeUrl || GenesisState1.isSDK(o.client_genesis) && GenesisState2.isSDK(o.connection_genesis) && GenesisState3.isSDK(o.channel_genesis)); + }, encode(message: GenesisState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.clientGenesis !== undefined) { GenesisState1.encode(message.clientGenesis, writer.uint32(10).fork()).ldelim(); @@ -3542,6 +4006,14 @@ exports[`ibc/core/types/v1/genesis name collisions 2`] = ` typeUrl: "/ibc.core.types.v1.GenesisState", value: GenesisState.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(GenesisState.typeUrl)) { + return; + } + GenesisState1.registerTypeUrl(); + GenesisState2.registerTypeUrl(); + GenesisState3.registerTypeUrl(); } };" `; @@ -3728,12 +4200,78 @@ exports[`ibc/core/types/v1/genesis name collisions 3`] = ` "name": "GenesisState", "type": "typeImport", }, + { + "import": "ibc/core/client/v1/genesis.proto", + "importedAs": "GenesisState1", + "name": "GenesisState", + "type": "typeImport", + }, + { + "import": "ibc/core/connection/v1/genesis.proto", + "importedAs": "GenesisState2", + "name": "GenesisState", + "type": "typeImport", + }, + { + "import": "ibc/core/channel/v1/genesis.proto", + "importedAs": "GenesisState3", + "name": "GenesisState", + "type": "typeImport", + }, + { + "import": "ibc/core/client/v1/genesis.proto", + "importedAs": "GenesisState1", + "name": "GenesisState", + "type": "typeImport", + }, + { + "import": "ibc/core/connection/v1/genesis.proto", + "importedAs": "GenesisState2", + "name": "GenesisState", + "type": "typeImport", + }, + { + "import": "ibc/core/channel/v1/genesis.proto", + "importedAs": "GenesisState3", + "name": "GenesisState", + "type": "typeImport", + }, + { + "import": "ibc/core/client/v1/genesis.proto", + "importedAs": "GenesisState1", + "name": "GenesisState", + "type": "typeImport", + }, + { + "import": "ibc/core/connection/v1/genesis.proto", + "importedAs": "GenesisState2", + "name": "GenesisState", + "type": "typeImport", + }, + { + "import": "ibc/core/channel/v1/genesis.proto", + "importedAs": "GenesisState3", + "name": "GenesisState", + "type": "typeImport", + }, ] `; exports[`osmosis/gamm/v1beta1/query 1`] = ` -"export const QueryPoolsResponse = { +"/** + * @name QueryPoolsResponse + * @package osmosis.gamm.v1beta1 + * @see proto type: osmosis.gamm.v1beta1.QueryPoolsResponse + */ +export const QueryPoolsResponse = { typeUrl: "/osmosis.gamm.v1beta1.QueryPoolsResponse", + aminoType: "osmosis/gamm/query-pools-response", + is(o: any): o is QueryPoolsResponse { + return o && (o.$typeUrl === QueryPoolsResponse.typeUrl || Array.isArray(o.pools) && (!o.pools.length || Pool1.is(o.pools[0]) || Pool2.is(o.pools[0]) || Any.is(o.pools[0]))); + }, + isSDK(o: any): o is QueryPoolsResponseSDKType { + return o && (o.$typeUrl === QueryPoolsResponse.typeUrl || Array.isArray(o.pools) && (!o.pools.length || Pool1.isSDK(o.pools[0]) || Pool2.isSDK(o.pools[0]) || Any.isSDK(o.pools[0]))); + }, encode(message: QueryPoolsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.pools) { Any.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -3839,13 +4377,35 @@ exports[`osmosis/gamm/v1beta1/query 1`] = ` typeUrl: "/osmosis.gamm.v1beta1.QueryPoolsResponse", value: QueryPoolsResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryPoolsResponse.typeUrl)) { + return; + } + Pool1.registerTypeUrl(); + Pool2.registerTypeUrl(); + PageResponse.registerTypeUrl(); } };" `; exports[`osmosis/gamm/v1beta1/tx MsgJoinPool 1`] = ` -"export const MsgJoinPool = { +"/** + * ===================== MsgJoinPool + * This is really MsgJoinPoolNoSwap + * @name MsgJoinPool + * @package osmosis.gamm.v1beta1 + * @see proto type: osmosis.gamm.v1beta1.MsgJoinPool + */ +export const MsgJoinPool = { typeUrl: "/osmosis.gamm.v1beta1.MsgJoinPool", + aminoType: "osmosis/gamm/join-pool", + is(o: any): o is MsgJoinPool { + return o && (o.$typeUrl === MsgJoinPool.typeUrl || typeof o.sender === "string" && typeof o.poolId === "bigint" && typeof o.shareOutAmount === "string" && Array.isArray(o.tokenInMaxs) && (!o.tokenInMaxs.length || Coin.is(o.tokenInMaxs[0]))); + }, + isSDK(o: any): o is MsgJoinPoolSDKType { + return o && (o.$typeUrl === MsgJoinPool.typeUrl || typeof o.sender === "string" && typeof o.pool_id === "bigint" && typeof o.share_out_amount === "string" && Array.isArray(o.token_in_maxs) && (!o.token_in_maxs.length || Coin.isSDK(o.token_in_maxs[0]))); + }, encode(message: MsgJoinPool, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.sender !== "") { writer.uint32(10).string(message.sender); @@ -3981,13 +4541,31 @@ exports[`osmosis/gamm/v1beta1/tx MsgJoinPool 1`] = ` typeUrl: "/osmosis.gamm.v1beta1.MsgJoinPool", value: MsgJoinPool.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgJoinPool.typeUrl)) { + return; + } + Coin.registerTypeUrl(); } };" `; exports[`osmosis/gamm/v1beta1/tx MsgSwapExactAmountIn 1`] = ` -"export const MsgSwapExactAmountIn = { +"/** + * @name MsgSwapExactAmountIn + * @package osmosis.gamm.v1beta1 + * @see proto type: osmosis.gamm.v1beta1.MsgSwapExactAmountIn + */ +export const MsgSwapExactAmountIn = { typeUrl: "/osmosis.gamm.v1beta1.MsgSwapExactAmountIn", + aminoType: "osmosis/gamm/swap-exact-amount-in", + is(o: any): o is MsgSwapExactAmountIn { + return o && (o.$typeUrl === MsgSwapExactAmountIn.typeUrl || typeof o.sender === "string" && Array.isArray(o.routes) && (!o.routes.length || SwapAmountInRoute.is(o.routes[0])) && Coin.is(o.tokenIn) && typeof o.tokenOutMinAmount === "string"); + }, + isSDK(o: any): o is MsgSwapExactAmountInSDKType { + return o && (o.$typeUrl === MsgSwapExactAmountIn.typeUrl || typeof o.sender === "string" && Array.isArray(o.routes) && (!o.routes.length || SwapAmountInRoute.isSDK(o.routes[0])) && Coin.isSDK(o.token_in) && typeof o.token_out_min_amount === "string"); + }, encode(message: MsgSwapExactAmountIn, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.sender !== "") { writer.uint32(10).string(message.sender); @@ -4123,13 +4701,32 @@ exports[`osmosis/gamm/v1beta1/tx MsgSwapExactAmountIn 1`] = ` typeUrl: "/osmosis.gamm.v1beta1.MsgSwapExactAmountIn", value: MsgSwapExactAmountIn.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgSwapExactAmountIn.typeUrl)) { + return; + } + SwapAmountInRoute.registerTypeUrl(); + Coin.registerTypeUrl(); } };" `; exports[`osmosis/gamm/v1beta1/tx MsgSwapExactAmountOut 1`] = ` -"export const MsgSwapExactAmountOut = { +"/** + * @name MsgSwapExactAmountOut + * @package osmosis.gamm.v1beta1 + * @see proto type: osmosis.gamm.v1beta1.MsgSwapExactAmountOut + */ +export const MsgSwapExactAmountOut = { typeUrl: "/osmosis.gamm.v1beta1.MsgSwapExactAmountOut", + aminoType: "osmosis/gamm/swap-exact-amount-out", + is(o: any): o is MsgSwapExactAmountOut { + return o && (o.$typeUrl === MsgSwapExactAmountOut.typeUrl || typeof o.sender === "string" && Array.isArray(o.routes) && (!o.routes.length || SwapAmountOutRoute.is(o.routes[0])) && typeof o.tokenInMaxAmount === "string" && Coin.is(o.tokenOut)); + }, + isSDK(o: any): o is MsgSwapExactAmountOutSDKType { + return o && (o.$typeUrl === MsgSwapExactAmountOut.typeUrl || typeof o.sender === "string" && Array.isArray(o.routes) && (!o.routes.length || SwapAmountOutRoute.isSDK(o.routes[0])) && typeof o.token_in_max_amount === "string" && Coin.isSDK(o.token_out)); + }, encode(message: MsgSwapExactAmountOut, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.sender !== "") { writer.uint32(10).string(message.sender); @@ -4265,6 +4862,13 @@ exports[`osmosis/gamm/v1beta1/tx MsgSwapExactAmountOut 1`] = ` typeUrl: "/osmosis.gamm.v1beta1.MsgSwapExactAmountOut", value: MsgSwapExactAmountOut.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgSwapExactAmountOut.typeUrl)) { + return; + } + SwapAmountOutRoute.registerTypeUrl(); + Coin.registerTypeUrl(); } };" `; diff --git a/packages/ast/src/encoding/__tests__/__snapshots__/authz.timestamp.test.ts.snap b/packages/ast/src/encoding/__tests__/__snapshots__/authz.timestamp.test.ts.snap index 692f3847b3..5f09ad6b70 100644 --- a/packages/ast/src/encoding/__tests__/__snapshots__/authz.timestamp.test.ts.snap +++ b/packages/ast/src/encoding/__tests__/__snapshots__/authz.timestamp.test.ts.snap @@ -9,7 +9,7 @@ exports[`cosmos/authz/v1beta1/authz date 1`] = ` * @see proto type: cosmos.authz.v1beta1.Grant */ export interface Grant { - authorization?: (GenericAuthorization & DepositDeploymentAuthorization1 & DepositDeploymentAuthorization2 & SendAuthorization & StakeAuthorization & Any) | undefined; + authorization?: GenericAuthorization | DepositDeploymentAuthorization1 | DepositDeploymentAuthorization2 | 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\` @@ -29,6 +29,13 @@ exports[`cosmos/authz/v1beta1/authz date 2`] = ` */ export const Grant = { typeUrl: "/cosmos.authz.v1beta1.Grant", + aminoType: "cosmos-sdk/Grant", + is(o: any): o is Grant { + return o && o.$typeUrl === Grant.typeUrl; + }, + isSDK(o: any): o is GrantSDKType { + return o && o.$typeUrl === Grant.typeUrl; + }, encode(message: Grant, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.authorization !== undefined) { Any.encode(message.authorization, writer.uint32(10).fork()).ldelim(); @@ -124,6 +131,16 @@ export const Grant = { typeUrl: "/cosmos.authz.v1beta1.Grant", value: Grant.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Grant.typeUrl)) { + return; + } + GenericAuthorization.registerTypeUrl(); + DepositDeploymentAuthorization1.registerTypeUrl(); + DepositDeploymentAuthorization2.registerTypeUrl(); + SendAuthorization.registerTypeUrl(); + StakeAuthorization.registerTypeUrl(); } };" `; @@ -182,7 +199,7 @@ exports[`cosmos/authz/v1beta1/authz timestamp 1`] = ` * @see proto type: cosmos.authz.v1beta1.Grant */ export interface Grant { - authorization?: (GenericAuthorization & DepositDeploymentAuthorization1 & DepositDeploymentAuthorization2 & SendAuthorization & StakeAuthorization & Any) | undefined; + authorization?: GenericAuthorization | DepositDeploymentAuthorization1 | DepositDeploymentAuthorization2 | 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\` @@ -202,6 +219,13 @@ exports[`cosmos/authz/v1beta1/authz timestamp 2`] = ` */ export const Grant = { typeUrl: "/cosmos.authz.v1beta1.Grant", + aminoType: "cosmos-sdk/Grant", + is(o: any): o is Grant { + return o && o.$typeUrl === Grant.typeUrl; + }, + isSDK(o: any): o is GrantSDKType { + return o && o.$typeUrl === Grant.typeUrl; + }, encode(message: Grant, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.authorization !== undefined) { Any.encode(message.authorization, writer.uint32(10).fork()).ldelim(); @@ -297,6 +321,16 @@ export const Grant = { typeUrl: "/cosmos.authz.v1beta1.Grant", value: Grant.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(Grant.typeUrl)) { + return; + } + GenericAuthorization.registerTypeUrl(); + DepositDeploymentAuthorization1.registerTypeUrl(); + DepositDeploymentAuthorization2.registerTypeUrl(); + SendAuthorization.registerTypeUrl(); + StakeAuthorization.registerTypeUrl(); } };" `; diff --git a/packages/ast/src/encoding/__tests__/__snapshots__/duration.gov.test.ts.snap b/packages/ast/src/encoding/__tests__/__snapshots__/duration.gov.test.ts.snap index 4c22a4a96e..3b014e2602 100644 --- a/packages/ast/src/encoding/__tests__/__snapshots__/duration.gov.test.ts.snap +++ b/packages/ast/src/encoding/__tests__/__snapshots__/duration.gov.test.ts.snap @@ -1,8 +1,21 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`Duraation: duration DepositParams 1`] = ` -"export const DepositParams = { +"/** + * DepositParams defines the params for deposits on governance proposals. + * @name DepositParams + * @package cosmos.gov.v1beta1 + * @see proto type: cosmos.gov.v1beta1.DepositParams + */ +export const DepositParams = { typeUrl: "/cosmos.gov.v1beta1.DepositParams", + aminoType: "cosmos-sdk/DepositParams", + is(o: any): o is DepositParams { + return o && (o.$typeUrl === DepositParams.typeUrl || Array.isArray(o.minDeposit) && (!o.minDeposit.length || Coin.is(o.minDeposit[0])) && typeof o.maxDepositPeriod === "string"); + }, + isSDK(o: any): o is DepositParamsSDKType { + return o && (o.$typeUrl === DepositParams.typeUrl || Array.isArray(o.min_deposit) && (!o.min_deposit.length || Coin.isSDK(o.min_deposit[0])) && typeof o.max_deposit_period === "string"); + }, encode(message: DepositParams, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.minDeposit) { Coin.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -76,13 +89,32 @@ exports[`Duraation: duration DepositParams 1`] = ` typeUrl: "/cosmos.gov.v1beta1.DepositParams", value: DepositParams.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(DepositParams.typeUrl)) { + return; + } + Coin.registerTypeUrl(); } };" `; exports[`Duration: string DepositParams 1`] = ` -"export const DepositParams = { +"/** + * DepositParams defines the params for deposits on governance proposals. + * @name DepositParams + * @package cosmos.gov.v1beta1 + * @see proto type: cosmos.gov.v1beta1.DepositParams + */ +export const DepositParams = { typeUrl: "/cosmos.gov.v1beta1.DepositParams", + aminoType: "cosmos-sdk/DepositParams", + is(o: any): o is DepositParams { + return o && (o.$typeUrl === DepositParams.typeUrl || Array.isArray(o.minDeposit) && (!o.minDeposit.length || Coin.is(o.minDeposit[0])) && typeof o.maxDepositPeriod === "string"); + }, + isSDK(o: any): o is DepositParamsSDKType { + return o && (o.$typeUrl === DepositParams.typeUrl || Array.isArray(o.min_deposit) && (!o.min_deposit.length || Coin.isSDK(o.min_deposit[0])) && typeof o.max_deposit_period === "string"); + }, encode(message: DepositParams, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.minDeposit) { Coin.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -156,6 +188,12 @@ exports[`Duration: string DepositParams 1`] = ` typeUrl: "/cosmos.gov.v1beta1.DepositParams", value: DepositParams.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(DepositParams.typeUrl)) { + return; + } + Coin.registerTypeUrl(); } };" `; diff --git a/packages/ast/src/encoding/__tests__/__snapshots__/lockup.test.ts.snap b/packages/ast/src/encoding/__tests__/__snapshots__/lockup.test.ts.snap index a37872ed06..159581d9d3 100644 --- a/packages/ast/src/encoding/__tests__/__snapshots__/lockup.test.ts.snap +++ b/packages/ast/src/encoding/__tests__/__snapshots__/lockup.test.ts.snap @@ -1,7 +1,12 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`osmosis/lockup/tx duration 1`] = ` -"export interface MsgLockTokens { +"/** + * @name MsgLockTokens + * @package osmosis.lockup + * @see proto type: osmosis.lockup.MsgLockTokens + */ +export interface MsgLockTokens { owner: string; duration: Duration; coins: Coin[]; @@ -9,8 +14,20 @@ exports[`osmosis/lockup/tx duration 1`] = ` `; exports[`osmosis/lockup/tx duration 2`] = ` -"export const MsgLockTokens = { +"/** + * @name MsgLockTokens + * @package osmosis.lockup + * @see proto type: osmosis.lockup.MsgLockTokens + */ +export const MsgLockTokens = { typeUrl: "/osmosis.lockup.MsgLockTokens", + aminoType: "osmosis/lockup/lock-tokens", + is(o: any): o is MsgLockTokens { + return o && (o.$typeUrl === MsgLockTokens.typeUrl || typeof o.owner === "string" && Duration.is(o.duration) && Array.isArray(o.coins) && (!o.coins.length || Coin.is(o.coins[0]))); + }, + isSDK(o: any): o is MsgLockTokensSDKType { + return o && (o.$typeUrl === MsgLockTokens.typeUrl || typeof o.owner === "string" && Duration.isSDK(o.duration) && Array.isArray(o.coins) && (!o.coins.length || Coin.isSDK(o.coins[0]))); + }, encode(message: MsgLockTokens, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.owner !== "") { writer.uint32(10).string(message.owner); @@ -131,6 +148,12 @@ exports[`osmosis/lockup/tx duration 2`] = ` typeUrl: "/osmosis.lockup.MsgLockTokens", value: MsgLockTokens.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgLockTokens.typeUrl)) { + return; + } + Coin.registerTypeUrl(); } };" `; @@ -192,7 +215,12 @@ exports[`osmosis/lockup/tx duration 4`] = ` `; exports[`osmosis/lockup/tx string 1`] = ` -"export interface MsgLockTokens { +"/** + * @name MsgLockTokens + * @package osmosis.lockup + * @see proto type: osmosis.lockup.MsgLockTokens + */ +export interface MsgLockTokens { owner: string; duration: string; coins: Coin[]; @@ -200,8 +228,20 @@ exports[`osmosis/lockup/tx string 1`] = ` `; exports[`osmosis/lockup/tx string 2`] = ` -"export const MsgLockTokens = { +"/** + * @name MsgLockTokens + * @package osmosis.lockup + * @see proto type: osmosis.lockup.MsgLockTokens + */ +export const MsgLockTokens = { typeUrl: "/osmosis.lockup.MsgLockTokens", + aminoType: "osmosis/lockup/lock-tokens", + is(o: any): o is MsgLockTokens { + return o && (o.$typeUrl === MsgLockTokens.typeUrl || typeof o.owner === "string" && typeof o.duration === "string" && Array.isArray(o.coins) && (!o.coins.length || Coin.is(o.coins[0]))); + }, + isSDK(o: any): o is MsgLockTokensSDKType { + return o && (o.$typeUrl === MsgLockTokens.typeUrl || typeof o.owner === "string" && typeof o.duration === "string" && Array.isArray(o.coins) && (!o.coins.length || Coin.isSDK(o.coins[0]))); + }, encode(message: MsgLockTokens, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.owner !== "") { writer.uint32(10).string(message.owner); @@ -322,6 +362,12 @@ exports[`osmosis/lockup/tx string 2`] = ` typeUrl: "/osmosis.lockup.MsgLockTokens", value: MsgLockTokens.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgLockTokens.typeUrl)) { + return; + } + Coin.registerTypeUrl(); } };" `; diff --git a/packages/ast/src/encoding/__tests__/__snapshots__/misc.overall.test.ts.snap b/packages/ast/src/encoding/__tests__/__snapshots__/misc.overall.test.ts.snap index dd614d99fb..604d7d5d38 100644 --- a/packages/ast/src/encoding/__tests__/__snapshots__/misc.overall.test.ts.snap +++ b/packages/ast/src/encoding/__tests__/__snapshots__/misc.overall.test.ts.snap @@ -367,6 +367,15 @@ export const EvalRequest = { typeUrl: "/misc.EvalRequest", value: EvalRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(EvalRequest.typeUrl)) { + return; + } + ExprValue.registerTypeUrl(); + IdRef.registerTypeUrl(); + AccessConfig.registerTypeUrl(); + TestNest_Graph.registerTypeUrl(); } };" `; @@ -738,6 +747,15 @@ export const EvalRequest = { typeUrl: "/misc.EvalRequest", value: EvalRequest.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(EvalRequest.typeUrl)) { + return; + } + ExprValue.registerTypeUrl(); + IdRef.registerTypeUrl(); + AccessConfig.registerTypeUrl(); + TestNest_Graph.registerTypeUrl(); } };" `; diff --git a/packages/ast/src/encoding/__tests__/__snapshots__/tendermint.test.ts.snap b/packages/ast/src/encoding/__tests__/__snapshots__/tendermint.test.ts.snap index 6f4caa8a3f..7613eff755 100644 --- a/packages/ast/src/encoding/__tests__/__snapshots__/tendermint.test.ts.snap +++ b/packages/ast/src/encoding/__tests__/__snapshots__/tendermint.test.ts.snap @@ -4,6 +4,9 @@ exports[`ibc/lightclients/tendermint/v1/tendermint duration 1`] = ` "/** * ClientState from Tendermint tracks the current validator set, latest height, * and a possible frozen height. + * @name ClientState + * @package ibc.lightclients.tendermint.v1 + * @see proto type: ibc.lightclients.tendermint.v1.ClientState */ export interface ClientState { chainId: string; @@ -13,15 +16,25 @@ export interface ClientState { * submitted headers are valid for upgrade */ trustingPeriod: Duration; - /** duration of the staking unbonding period */ + /** + * duration of the staking unbonding period + */ unbondingPeriod: Duration; - /** defines how much new (untrusted) header's Time can drift into the future. */ + /** + * defines how much new (untrusted) header's Time can drift into the future. + */ maxClockDrift: Duration; - /** Block height when the client was frozen due to a misbehaviour */ + /** + * Block height when the client was frozen due to a misbehaviour + */ frozenHeight: Height; - /** Latest height the client was updated to */ + /** + * Latest height the client was updated to + */ latestHeight: Height; - /** Proof specifications used in verifying counterparty state */ + /** + * Proof specifications used in verifying counterparty state + */ proofSpecs: ProofSpec[]; /** * Path at which next upgraded client will be committed. @@ -47,8 +60,22 @@ export interface ClientState { `; exports[`ibc/lightclients/tendermint/v1/tendermint duration 2`] = ` -"export const ClientState = { +"/** + * ClientState from Tendermint tracks the current validator set, latest height, + * and a possible frozen height. + * @name ClientState + * @package ibc.lightclients.tendermint.v1 + * @see proto type: ibc.lightclients.tendermint.v1.ClientState + */ +export const ClientState = { typeUrl: "/ibc.lightclients.tendermint.v1.ClientState", + aminoType: "cosmos-sdk/ClientState", + is(o: any): o is ClientState { + return o && (o.$typeUrl === ClientState.typeUrl || typeof o.chainId === "string" && Fraction.is(o.trustLevel) && Duration.is(o.trustingPeriod) && Duration.is(o.unbondingPeriod) && Duration.is(o.maxClockDrift) && Height.is(o.frozenHeight) && Height.is(o.latestHeight) && Array.isArray(o.proofSpecs) && (!o.proofSpecs.length || ProofSpec.is(o.proofSpecs[0])) && Array.isArray(o.upgradePath) && (!o.upgradePath.length || typeof o.upgradePath[0] === "string") && typeof o.allowUpdateAfterExpiry === "boolean" && typeof o.allowUpdateAfterMisbehaviour === "boolean"); + }, + isSDK(o: any): o is ClientStateSDKType { + return o && (o.$typeUrl === ClientState.typeUrl || typeof o.chain_id === "string" && Fraction.isSDK(o.trust_level) && Duration.isSDK(o.trusting_period) && Duration.isSDK(o.unbonding_period) && Duration.isSDK(o.max_clock_drift) && Height.isSDK(o.frozen_height) && Height.isSDK(o.latest_height) && Array.isArray(o.proof_specs) && (!o.proof_specs.length || ProofSpec.isSDK(o.proof_specs[0])) && Array.isArray(o.upgrade_path) && (!o.upgrade_path.length || typeof o.upgrade_path[0] === "string") && typeof o.allow_update_after_expiry === "boolean" && typeof o.allow_update_after_misbehaviour === "boolean"); + }, encode(message: ClientState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.chainId !== "") { writer.uint32(10).string(message.chainId); @@ -299,6 +326,14 @@ exports[`ibc/lightclients/tendermint/v1/tendermint duration 2`] = ` typeUrl: "/ibc.lightclients.tendermint.v1.ClientState", value: ClientState.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ClientState.typeUrl)) { + return; + } + Fraction.registerTypeUrl(); + Height.registerTypeUrl(); + ProofSpec.registerTypeUrl(); } };" `; @@ -481,6 +516,9 @@ exports[`ibc/lightclients/tendermint/v1/tendermint string 1`] = ` "/** * ClientState from Tendermint tracks the current validator set, latest height, * and a possible frozen height. + * @name ClientState + * @package ibc.lightclients.tendermint.v1 + * @see proto type: ibc.lightclients.tendermint.v1.ClientState */ export interface ClientState { chainId: string; @@ -490,15 +528,25 @@ export interface ClientState { * submitted headers are valid for upgrade */ trustingPeriod: string; - /** duration of the staking unbonding period */ + /** + * duration of the staking unbonding period + */ unbondingPeriod: string; - /** defines how much new (untrusted) header's Time can drift into the future. */ + /** + * defines how much new (untrusted) header's Time can drift into the future. + */ maxClockDrift: string; - /** Block height when the client was frozen due to a misbehaviour */ + /** + * Block height when the client was frozen due to a misbehaviour + */ frozenHeight: Height; - /** Latest height the client was updated to */ + /** + * Latest height the client was updated to + */ latestHeight: Height; - /** Proof specifications used in verifying counterparty state */ + /** + * Proof specifications used in verifying counterparty state + */ proofSpecs: ProofSpec[]; /** * Path at which next upgraded client will be committed. @@ -524,8 +572,22 @@ export interface ClientState { `; exports[`ibc/lightclients/tendermint/v1/tendermint string 2`] = ` -"export const ClientState = { +"/** + * ClientState from Tendermint tracks the current validator set, latest height, + * and a possible frozen height. + * @name ClientState + * @package ibc.lightclients.tendermint.v1 + * @see proto type: ibc.lightclients.tendermint.v1.ClientState + */ +export const ClientState = { typeUrl: "/ibc.lightclients.tendermint.v1.ClientState", + aminoType: "cosmos-sdk/ClientState", + is(o: any): o is ClientState { + return o && (o.$typeUrl === ClientState.typeUrl || typeof o.chainId === "string" && Fraction.is(o.trustLevel) && typeof o.trustingPeriod === "string" && typeof o.unbondingPeriod === "string" && typeof o.maxClockDrift === "string" && Height.is(o.frozenHeight) && Height.is(o.latestHeight) && Array.isArray(o.proofSpecs) && (!o.proofSpecs.length || ProofSpec.is(o.proofSpecs[0])) && Array.isArray(o.upgradePath) && (!o.upgradePath.length || typeof o.upgradePath[0] === "string") && typeof o.allowUpdateAfterExpiry === "boolean" && typeof o.allowUpdateAfterMisbehaviour === "boolean"); + }, + isSDK(o: any): o is ClientStateSDKType { + return o && (o.$typeUrl === ClientState.typeUrl || typeof o.chain_id === "string" && Fraction.isSDK(o.trust_level) && typeof o.trusting_period === "string" && typeof o.unbonding_period === "string" && typeof o.max_clock_drift === "string" && Height.isSDK(o.frozen_height) && Height.isSDK(o.latest_height) && Array.isArray(o.proof_specs) && (!o.proof_specs.length || ProofSpec.isSDK(o.proof_specs[0])) && Array.isArray(o.upgrade_path) && (!o.upgrade_path.length || typeof o.upgrade_path[0] === "string") && typeof o.allow_update_after_expiry === "boolean" && typeof o.allow_update_after_misbehaviour === "boolean"); + }, encode(message: ClientState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.chainId !== "") { writer.uint32(10).string(message.chainId); @@ -776,6 +838,14 @@ exports[`ibc/lightclients/tendermint/v1/tendermint string 2`] = ` typeUrl: "/ibc.lightclients.tendermint.v1.ClientState", value: ClientState.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(ClientState.typeUrl)) { + return; + } + Fraction.registerTypeUrl(); + Height.registerTypeUrl(); + ProofSpec.registerTypeUrl(); } };" `; diff --git a/packages/ast/src/encoding/amino/converter/__snapshots__/amino-converter.spec.ts.snap b/packages/ast/src/encoding/amino/converter/__snapshots__/amino-converter.spec.ts.snap index 2d93eb33c4..4c3f05312c 100644 --- a/packages/ast/src/encoding/amino/converter/__snapshots__/amino-converter.spec.ts.snap +++ b/packages/ast/src/encoding/amino/converter/__snapshots__/amino-converter.spec.ts.snap @@ -22,9 +22,9 @@ exports[`cosmos/staking/v1beta1/tx AminoConverter 1`] = ` details: description.details }, commission: { - rate: commission.rate, - max_rate: commission.maxRate, - max_change_rate: commission.maxChangeRate + rate: Decimal.fromUserInput(commission.rate, 18).atomics, + max_rate: Decimal.fromUserInput(commission.maxRate, 18).atomics, + max_change_rate: Decimal.fromUserInput(commission.maxChangeRate, 18).atomics }, min_self_delegation: minSelfDelegation, delegator_address: delegatorAddress, @@ -86,7 +86,7 @@ exports[`cosmos/staking/v1beta1/tx AminoConverter 1`] = ` details: description.details }, validator_address: validatorAddress, - commission_rate: commissionRate, + commission_rate: Decimal.fromUserInput(commissionRate, 18).atomics, min_self_delegation: minSelfDelegation }; }, diff --git a/packages/ast/src/encoding/amino/converter/__tests__/__snapshots__/vote.test.ts.snap b/packages/ast/src/encoding/amino/converter/__tests__/__snapshots__/vote.test.ts.snap index 6f7e5ae6b7..e33e74b735 100644 --- a/packages/ast/src/encoding/amino/converter/__tests__/__snapshots__/vote.test.ts.snap +++ b/packages/ast/src/encoding/amino/converter/__tests__/__snapshots__/vote.test.ts.snap @@ -76,7 +76,7 @@ exports[`cosmos/gov/v1beta1/tx AminoConverter 1`] = ` voter, options: options.map(el0 => ({ option: el0.option, - weight: el0.weight + weight: Decimal.fromUserInput(el0.weight, 18).atomics })) }; }, diff --git a/packages/ast/src/encoding/proto/__snapshots__/interfaces-amino.test.ts.snap b/packages/ast/src/encoding/proto/__snapshots__/interfaces-amino.test.ts.snap index 329bb1172a..3aca90bf87 100644 --- a/packages/ast/src/encoding/proto/__snapshots__/interfaces-amino.test.ts.snap +++ b/packages/ast/src/encoding/proto/__snapshots__/interfaces-amino.test.ts.snap @@ -1,8 +1,80 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`Duration 1`] = ` -"export const Duration = { +"/** + * A Duration represents a signed, fixed-length span of time represented + * as a count of seconds and fractions of seconds at nanosecond + * resolution. It is independent of any calendar and concepts like "day" + * or "month". It is related to Timestamp in that the difference between + * two Timestamp values is a Duration and it can be added or subtracted + * from a Timestamp. Range is approximately +-10,000 years. + * + * # Examples + * + * Example 1: Compute Duration from two Timestamps in pseudo code. + * + * Timestamp start = ...; + * Timestamp end = ...; + * Duration duration = ...; + * + * duration.seconds = end.seconds - start.seconds; + * duration.nanos = end.nanos - start.nanos; + * + * if (duration.seconds < 0 && duration.nanos > 0) { + * duration.seconds += 1; + * duration.nanos -= 1000000000; + * } else if (durations.seconds > 0 && duration.nanos < 0) { + * duration.seconds -= 1; + * duration.nanos += 1000000000; + * } + * + * Example 2: Compute Timestamp from Timestamp + Duration in pseudo code. + * + * Timestamp start = ...; + * Duration duration = ...; + * Timestamp end = ...; + * + * end.seconds = start.seconds + duration.seconds; + * end.nanos = start.nanos + duration.nanos; + * + * if (end.nanos < 0) { + * end.seconds -= 1; + * end.nanos += 1000000000; + * } else if (end.nanos >= 1000000000) { + * end.seconds += 1; + * end.nanos -= 1000000000; + * } + * + * Example 3: Compute Duration from datetime.timedelta in Python. + * + * td = datetime.timedelta(days=3, minutes=10) + * duration = Duration() + * duration.FromTimedelta(td) + * + * # JSON Mapping + * + * In JSON format, the Duration type is encoded as a string rather than an + * object, where the string ends in the suffix "s" (indicating seconds) and + * is preceded by the number of seconds, with nanoseconds expressed as + * fractional seconds. For example, 3 seconds with 0 nanoseconds should be + * encoded in JSON format as "3s", while 3 seconds and 1 nanosecond should + * be expressed in JSON format as "3.000000001s", and 3 seconds and 1 + * microsecond should be expressed in JSON format as "3.000001s". + * @name Duration + * @package google.protobuf + * @see proto type: google.protobuf.Duration + */ +export const Duration = { typeUrl: "/google.protobuf.Duration", + is(o: any): o is Duration { + return o && (o.$typeUrl === Duration.typeUrl || typeof o.seconds === "bigint" && typeof o.nanos === "number"); + }, + isSDK(o: any): o is DurationSDKType { + return o && (o.$typeUrl === Duration.typeUrl || typeof o.seconds === "bigint" && typeof o.nanos === "number"); + }, + isAmino(o: any): o is DurationAmino { + return o && (o.$typeUrl === Duration.typeUrl || typeof o.seconds === "bigint" && typeof o.nanos === "number"); + }, encode(message: Duration, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.seconds !== BigInt(0)) { writer.uint32(8).int64(message.seconds); @@ -86,13 +158,39 @@ exports[`Duration 1`] = ` typeUrl: "/google.protobuf.Duration", value: Duration.encode(message).finish() }; - } + }, + registerTypeUrl() {} };" `; exports[`Height 1`] = ` -"export const Height = { +"/** + * Height is a monotonically increasing data type + * that can be compared against another Height for the purposes of updating and + * freezing clients + * + * Normally the RevisionHeight is incremented at each height while keeping + * RevisionNumber the same. However some consensus algorithms may choose to + * reset the height in certain conditions e.g. hard forks, state-machine + * breaking changes In these cases, the RevisionNumber is incremented so that + * height continues to be monitonically increasing even as the RevisionHeight + * gets reset + * @name Height + * @package ibc.core.client.v1 + * @see proto type: ibc.core.client.v1.Height + */ +export const Height = { typeUrl: "/ibc.core.client.v1.Height", + aminoType: "cosmos-sdk/Height", + is(o: any): o is Height { + return o && (o.$typeUrl === Height.typeUrl || typeof o.revisionNumber === "bigint" && typeof o.revisionHeight === "bigint"); + }, + isSDK(o: any): o is HeightSDKType { + return o && (o.$typeUrl === Height.typeUrl || typeof o.revision_number === "bigint" && typeof o.revision_height === "bigint"); + }, + isAmino(o: any): o is HeightAmino { + return o && (o.$typeUrl === Height.typeUrl || typeof o.revision_number === "bigint" && typeof o.revision_height === "bigint"); + }, encode(message: Height, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.revisionNumber !== BigInt(0)) { writer.uint32(8).uint64(message.revisionNumber); @@ -184,13 +282,30 @@ exports[`Height 1`] = ` typeUrl: "/ibc.core.client.v1.Height", value: Height.encode(message).finish() }; - } + }, + registerTypeUrl() {} };" `; exports[`MsgCreateValidator 1`] = ` -"export const MsgCreateValidator = { +"/** + * MsgCreateValidator defines a SDK message for creating a new validator. + * @name MsgCreateValidator + * @package cosmos.staking.v1beta1 + * @see proto type: cosmos.staking.v1beta1.MsgCreateValidator + */ +export const MsgCreateValidator = { typeUrl: "/cosmos.staking.v1beta1.MsgCreateValidator", + aminoType: "cosmos-sdk/MsgCreateValidator", + is(o: any): o is MsgCreateValidator { + return o && (o.$typeUrl === MsgCreateValidator.typeUrl || Description.is(o.description) && CommissionRates.is(o.commission) && typeof o.minSelfDelegation === "string" && typeof o.delegatorAddress === "string" && typeof o.validatorAddress === "string" && Coin.is(o.value)); + }, + isSDK(o: any): o is MsgCreateValidatorSDKType { + return o && (o.$typeUrl === MsgCreateValidator.typeUrl || Description.isSDK(o.description) && CommissionRates.isSDK(o.commission) && typeof o.min_self_delegation === "string" && typeof o.delegator_address === "string" && typeof o.validator_address === "string" && Coin.isSDK(o.value)); + }, + isAmino(o: any): o is MsgCreateValidatorAmino { + return o && (o.$typeUrl === MsgCreateValidator.typeUrl || Description.isAmino(o.description) && CommissionRates.isAmino(o.commission) && typeof o.min_self_delegation === "string" && typeof o.delegator_address === "string" && typeof o.validator_address === "string" && Coin.isAmino(o.value)); + }, encode(message: MsgCreateValidator, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.description !== undefined) { Description.encode(message.description, writer.uint32(10).fork()).ldelim(); @@ -208,7 +323,7 @@ exports[`MsgCreateValidator 1`] = ` writer.uint32(42).string(message.validatorAddress); } if (message.pubkey !== undefined) { - Any.encode((message.pubkey as Any), writer.uint32(50).fork()).ldelim(); + Any.encode(GlobalDecoderRegistry.wrapAny(message.pubkey), writer.uint32(50).fork()).ldelim(); } if (message.value !== undefined) { Coin.encode(message.value, writer.uint32(58).fork()).ldelim(); @@ -238,7 +353,7 @@ exports[`MsgCreateValidator 1`] = ` message.validatorAddress = reader.string(); break; case 6: - message.pubkey = (Cosmos_cryptoPubKey_InterfaceDecoder(reader) as Any); + message.pubkey = GlobalDecoderRegistry.unwrapAny(reader); break; case 7: message.value = Coin.decode(reader, reader.uint32()); @@ -257,7 +372,7 @@ exports[`MsgCreateValidator 1`] = ` minSelfDelegation: isSet(object.minSelfDelegation) ? String(object.minSelfDelegation) : "", delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "", validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", - pubkey: isSet(object.pubkey) ? Any.fromJSON(object.pubkey) : undefined, + pubkey: isSet(object.pubkey) ? GlobalDecoderRegistry.fromJSON(object.pubkey) : undefined, value: isSet(object.value) ? Coin.fromJSON(object.value) : undefined }; }, @@ -268,7 +383,7 @@ exports[`MsgCreateValidator 1`] = ` message.minSelfDelegation !== undefined && (obj.minSelfDelegation = message.minSelfDelegation); message.delegatorAddress !== undefined && (obj.delegatorAddress = message.delegatorAddress); message.validatorAddress !== undefined && (obj.validatorAddress = message.validatorAddress); - message.pubkey !== undefined && (obj.pubkey = message.pubkey ? Any.toJSON(message.pubkey) : undefined); + message.pubkey !== undefined && (obj.pubkey = message.pubkey ? GlobalDecoderRegistry.toJSON(message.pubkey) : undefined); message.value !== undefined && (obj.value = message.value ? Coin.toJSON(message.value) : undefined); return obj; }, @@ -279,7 +394,7 @@ exports[`MsgCreateValidator 1`] = ` message.minSelfDelegation = object.minSelfDelegation ?? ""; message.delegatorAddress = object.delegatorAddress ?? ""; message.validatorAddress = object.validatorAddress ?? ""; - message.pubkey = object.pubkey !== undefined && object.pubkey !== null ? Any.fromPartial(object.pubkey) : undefined; + message.pubkey = object.pubkey !== undefined && object.pubkey !== null ? GlobalDecoderRegistry.fromPartial(object.pubkey) : undefined; message.value = object.value !== undefined && object.value !== null ? Coin.fromPartial(object.value) : undefined; return message; }, @@ -290,7 +405,7 @@ exports[`MsgCreateValidator 1`] = ` minSelfDelegation: object?.min_self_delegation, delegatorAddress: object?.delegator_address, validatorAddress: object?.validator_address, - pubkey: object.pubkey ? Any.fromSDK(object.pubkey) : undefined, + pubkey: object.pubkey ? GlobalDecoderRegistry.fromSDK(object.pubkey) : undefined, value: object.value ? Coin.fromSDK(object.value) : undefined }; }, @@ -301,7 +416,7 @@ exports[`MsgCreateValidator 1`] = ` obj.min_self_delegation = message.minSelfDelegation; obj.delegator_address = message.delegatorAddress; obj.validator_address = message.validatorAddress; - message.pubkey !== undefined && (obj.pubkey = message.pubkey ? Any.toSDK(message.pubkey) : undefined); + message.pubkey !== undefined && (obj.pubkey = message.pubkey ? GlobalDecoderRegistry.toSDK(message.pubkey) : undefined); message.value !== undefined && (obj.value = message.value ? Coin.toSDK(message.value) : undefined); return obj; }, @@ -361,13 +476,35 @@ exports[`MsgCreateValidator 1`] = ` typeUrl: "/cosmos.staking.v1beta1.MsgCreateValidator", value: MsgCreateValidator.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgCreateValidator.typeUrl)) { + return; + } + Coin.registerTypeUrl(); } };" `; exports[`MsgStoreCode 1`] = ` -"export const MsgStoreCode = { +"/** + * MsgStoreCode submit Wasm code to the system + * @name MsgStoreCode + * @package cosmwasm.wasm.v1 + * @see proto type: cosmwasm.wasm.v1.MsgStoreCode + */ +export const MsgStoreCode = { typeUrl: "/cosmwasm.wasm.v1.MsgStoreCode", + aminoType: "wasm/MsgStoreCode", + is(o: any): o is MsgStoreCode { + return o && (o.$typeUrl === MsgStoreCode.typeUrl || typeof o.sender === "string" && (o.wasmByteCode instanceof Uint8Array || typeof o.wasmByteCode === "string")); + }, + isSDK(o: any): o is MsgStoreCodeSDKType { + return o && (o.$typeUrl === MsgStoreCode.typeUrl || typeof o.sender === "string" && (o.wasm_byte_code instanceof Uint8Array || typeof o.wasm_byte_code === "string")); + }, + isAmino(o: any): o is MsgStoreCodeAmino { + return o && (o.$typeUrl === MsgStoreCode.typeUrl || typeof o.sender === "string" && (o.wasm_byte_code instanceof Uint8Array || typeof o.wasm_byte_code === "string")); + }, encode(message: MsgStoreCode, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.sender !== "") { writer.uint32(10).string(message.sender); @@ -478,16 +615,39 @@ exports[`MsgStoreCode 1`] = ` typeUrl: "/cosmwasm.wasm.v1.MsgStoreCode", value: MsgStoreCode.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgStoreCode.typeUrl)) { + return; + } + AccessConfig.registerTypeUrl(); } };" `; exports[`MsgSubmitProposal 1`] = ` -"export const MsgSubmitProposal = { +"/** + * MsgSubmitProposal defines an sdk.Msg type that supports submitting arbitrary + * proposal Content. + * @name MsgSubmitProposal + * @package cosmos.gov.v1beta1 + * @see proto type: cosmos.gov.v1beta1.MsgSubmitProposal + */ +export const MsgSubmitProposal = { typeUrl: "/cosmos.gov.v1beta1.MsgSubmitProposal", + aminoType: "cosmos-sdk/MsgSubmitProposal", + is(o: any): o is MsgSubmitProposal { + return o && (o.$typeUrl === MsgSubmitProposal.typeUrl || Array.isArray(o.initialDeposit) && (!o.initialDeposit.length || Coin.is(o.initialDeposit[0])) && typeof o.proposer === "string"); + }, + isSDK(o: any): o is MsgSubmitProposalSDKType { + return o && (o.$typeUrl === MsgSubmitProposal.typeUrl || Array.isArray(o.initial_deposit) && (!o.initial_deposit.length || Coin.isSDK(o.initial_deposit[0])) && typeof o.proposer === "string"); + }, + isAmino(o: any): o is MsgSubmitProposalAmino { + return o && (o.$typeUrl === MsgSubmitProposal.typeUrl || Array.isArray(o.initial_deposit) && (!o.initial_deposit.length || Coin.isAmino(o.initial_deposit[0])) && typeof o.proposer === "string"); + }, encode(message: MsgSubmitProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.content !== undefined) { - Any.encode((message.content as Any), writer.uint32(10).fork()).ldelim(); + Any.encode(GlobalDecoderRegistry.wrapAny(message.content), writer.uint32(10).fork()).ldelim(); } for (const v of message.initialDeposit) { Coin.encode(v!, writer.uint32(18).fork()).ldelim(); @@ -505,7 +665,7 @@ exports[`MsgSubmitProposal 1`] = ` const tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.content = (ProposalContentI_InterfaceDecoder(reader) as Any); + message.content = GlobalDecoderRegistry.unwrapAny(reader); break; case 2: message.initialDeposit.push(Coin.decode(reader, reader.uint32())); @@ -522,14 +682,14 @@ exports[`MsgSubmitProposal 1`] = ` }, fromJSON(object: any): MsgSubmitProposal { return { - content: isSet(object.content) ? Any.fromJSON(object.content) : undefined, + content: isSet(object.content) ? GlobalDecoderRegistry.fromJSON(object.content) : undefined, initialDeposit: Array.isArray(object?.initialDeposit) ? object.initialDeposit.map((e: any) => Coin.fromJSON(e)) : [], proposer: isSet(object.proposer) ? String(object.proposer) : "" }; }, toJSON(message: MsgSubmitProposal): JsonSafe { const obj: any = {}; - message.content !== undefined && (obj.content = message.content ? Any.toJSON(message.content) : undefined); + message.content !== undefined && (obj.content = message.content ? GlobalDecoderRegistry.toJSON(message.content) : undefined); if (message.initialDeposit) { obj.initialDeposit = message.initialDeposit.map(e => e ? Coin.toJSON(e) : undefined); } else { @@ -540,21 +700,21 @@ exports[`MsgSubmitProposal 1`] = ` }, fromPartial(object: Partial): MsgSubmitProposal { const message = createBaseMsgSubmitProposal(); - message.content = object.content !== undefined && object.content !== null ? Any.fromPartial(object.content) : undefined; + message.content = object.content !== undefined && object.content !== null ? GlobalDecoderRegistry.fromPartial(object.content) : undefined; message.initialDeposit = object.initialDeposit?.map(e => Coin.fromPartial(e)) || []; message.proposer = object.proposer ?? ""; return message; }, fromSDK(object: MsgSubmitProposalSDKType): MsgSubmitProposal { return { - content: object.content ? Any.fromSDK(object.content) : undefined, + content: object.content ? GlobalDecoderRegistry.fromSDK(object.content) : undefined, initialDeposit: Array.isArray(object?.initial_deposit) ? object.initial_deposit.map((e: any) => Coin.fromSDK(e)) : [], proposer: object?.proposer }; }, toSDK(message: MsgSubmitProposal): MsgSubmitProposalSDKType { const obj: any = {}; - message.content !== undefined && (obj.content = message.content ? Any.toSDK(message.content) : undefined); + message.content !== undefined && (obj.content = message.content ? GlobalDecoderRegistry.toSDK(message.content) : undefined); if (message.initialDeposit) { obj.initial_deposit = message.initialDeposit.map(e => e ? Coin.toSDK(e) : undefined); } else { @@ -566,7 +726,7 @@ exports[`MsgSubmitProposal 1`] = ` fromAmino(object: MsgSubmitProposalAmino): MsgSubmitProposal { const message = createBaseMsgSubmitProposal(); if (object.content !== undefined && object.content !== null) { - message.content = ProposalContentI_FromAmino(object.content); + message.content = GlobalDecoderRegistry.fromAminoMsg(object.content); } message.initialDeposit = object.initial_deposit?.map(e => Coin.fromAmino(e)) || []; if (object.proposer !== undefined && object.proposer !== null) { @@ -576,7 +736,7 @@ exports[`MsgSubmitProposal 1`] = ` }, toAmino(message: MsgSubmitProposal): MsgSubmitProposalAmino { const obj: any = {}; - obj.content = message.content ? ProposalContentI_ToAmino((message.content as Any)) : undefined; + obj.content = message.content ? GlobalDecoderRegistry.toAminoMsg(message.content) : undefined; if (message.initialDeposit) { obj.initial_deposit = message.initialDeposit.map(e => e ? Coin.toAmino(e) : undefined); } else { @@ -605,13 +765,47 @@ exports[`MsgSubmitProposal 1`] = ` typeUrl: "/cosmos.gov.v1beta1.MsgSubmitProposal", value: MsgSubmitProposal.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgSubmitProposal.typeUrl)) { + return; + } + TextProposal.registerTypeUrl(); + RegisterIncentiveProposal.registerTypeUrl(); + ClientUpdateProposal.registerTypeUrl(); + UpgradeProposal.registerTypeUrl(); + ReplacePoolIncentivesProposal.registerTypeUrl(); + UpdatePoolIncentivesProposal.registerTypeUrl(); + SetSuperfluidAssetsProposal.registerTypeUrl(); + RemoveSuperfluidAssetsProposal.registerTypeUrl(); + UpdateUnpoolWhiteListProposal.registerTypeUrl(); + UpdateFeeTokenProposal.registerTypeUrl(); + Coin.registerTypeUrl(); } };" `; exports[`MsgTransfer 1`] = ` -"export const MsgTransfer = { +"/** + * MsgTransfer defines a msg to transfer fungible tokens (i.e Coins) between + * ICS20 enabled chains. See ICS Spec here: + * https://github.com/cosmos/ibc/tree/master/spec/app/ics-020-fungible-token-transfer#data-structures + * @name MsgTransfer + * @package ibc.applications.transfer.v1 + * @see proto type: ibc.applications.transfer.v1.MsgTransfer + */ +export const MsgTransfer = { typeUrl: "/ibc.applications.transfer.v1.MsgTransfer", + aminoType: "cosmos-sdk/MsgTransfer", + is(o: any): o is MsgTransfer { + return o && (o.$typeUrl === MsgTransfer.typeUrl || typeof o.sourcePort === "string" && typeof o.sourceChannel === "string" && Coin.is(o.token) && typeof o.sender === "string" && typeof o.receiver === "string" && Height.is(o.timeoutHeight) && typeof o.timeoutTimestamp === "bigint"); + }, + isSDK(o: any): o is MsgTransferSDKType { + return o && (o.$typeUrl === MsgTransfer.typeUrl || typeof o.source_port === "string" && typeof o.source_channel === "string" && Coin.isSDK(o.token) && typeof o.sender === "string" && typeof o.receiver === "string" && Height.isSDK(o.timeout_height) && typeof o.timeout_timestamp === "bigint"); + }, + isAmino(o: any): o is MsgTransferAmino { + return o && (o.$typeUrl === MsgTransfer.typeUrl || typeof o.source_port === "string" && typeof o.source_channel === "string" && Coin.isAmino(o.token) && typeof o.sender === "string" && typeof o.receiver === "string" && Height.isAmino(o.timeout_height) && typeof o.timeout_timestamp === "bigint"); + }, encode(message: MsgTransfer, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.sourcePort !== "") { writer.uint32(10).string(message.sourcePort); @@ -782,6 +976,13 @@ exports[`MsgTransfer 1`] = ` typeUrl: "/ibc.applications.transfer.v1.MsgTransfer", value: MsgTransfer.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgTransfer.typeUrl)) { + return; + } + Coin.registerTypeUrl(); + Height.registerTypeUrl(); } };" `; diff --git a/packages/ast/src/encoding/proto/__snapshots__/proto.type.implements.spec.ts.snap b/packages/ast/src/encoding/proto/__snapshots__/proto.type.implements.spec.ts.snap index ec050ef612..575d26f48c 100644 --- a/packages/ast/src/encoding/proto/__snapshots__/proto.type.implements.spec.ts.snap +++ b/packages/ast/src/encoding/proto/__snapshots__/proto.type.implements.spec.ts.snap @@ -1,29 +1,53 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`Any repeated 1`] = ` -"export interface QueryPoolsResponse { +"/** + * @name QueryPoolsResponse + * @package osmosis.gamm.v1beta1 + * @see proto type: osmosis.gamm.v1beta1.QueryPoolsResponse + */ +export interface QueryPoolsResponse { pools: Any[]; - /** pagination defines the pagination in the response. */ + /** + * pagination defines the pagination in the response. + */ pagination?: PageResponse; }" `; exports[`Any standard 1`] = ` -"export interface QueryPoolResponse { +"/** + * @name QueryPoolResponse + * @package osmosis.gamm.v1beta1 + * @see proto type: osmosis.gamm.v1beta1.QueryPoolResponse + */ +export interface QueryPoolResponse { pool?: Any; }" `; exports[`Cast repeated 1`] = ` -"export interface QueryPoolsResponse { - pools: (Pool1 & Pool2 & Any)[] | Any[]; - /** pagination defines the pagination in the response. */ +"/** + * @name QueryPoolsResponse + * @package osmosis.gamm.v1beta1 + * @see proto type: osmosis.gamm.v1beta1.QueryPoolsResponse + */ +export interface QueryPoolsResponse { + pools: (Pool1 | Pool2 | Any)[] | Any[]; + /** + * pagination defines the pagination in the response. + */ pagination?: PageResponse; }" `; exports[`Cast standard 1`] = ` -"export interface QueryPoolResponse { - pool?: (Pool1 & Pool2 & Any) | undefined; +"/** + * @name QueryPoolResponse + * @package osmosis.gamm.v1beta1 + * @see proto type: osmosis.gamm.v1beta1.QueryPoolResponse + */ +export interface QueryPoolResponse { + pool?: Pool1 | Pool2 | Any | undefined; }" `; diff --git a/packages/ast/src/encoding/proto/__snapshots__/proto.type.spec.ts.snap b/packages/ast/src/encoding/proto/__snapshots__/proto.type.spec.ts.snap index 32a2c5ccf5..935463f51c 100644 --- a/packages/ast/src/encoding/proto/__snapshots__/proto.type.spec.ts.snap +++ b/packages/ast/src/encoding/proto/__snapshots__/proto.type.spec.ts.snap @@ -5,9 +5,14 @@ exports[`ListValue 1`] = ` * \`ListValue\` is a wrapper around a repeated field of values. * * The JSON representation for \`ListValue\` is JSON array. + * @name ListValue + * @package google.protobuf + * @see proto type: google.protobuf.ListValue */ export interface ListValue { - /** Repeated field of dynamically typed values. */ + /** + * Repeated field of dynamically typed values. + */ values: Value[]; }" `; @@ -22,9 +27,14 @@ exports[`Struct 1`] = ` * with the proto support for the language. * * The JSON representation for \`Struct\` is JSON object. + * @name Struct + * @package google.protobuf + * @see proto type: google.protobuf.Struct */ export interface Struct { - /** Unordered map of dynamically typed values. */ + /** + * Unordered map of dynamically typed values. + */ fields: { [key: string]: Value; }; @@ -35,6 +45,9 @@ exports[`authz 1`] = ` "/** * Grant gives permissions to execute * the provide method with expiration time. + * @name authz + * @package cosmos.authz.v1beta1 + * @see proto type: cosmos.authz.v1beta1.undefined */ export interface authz { authorization?: Any; @@ -126,19 +139,34 @@ exports[`oneofs Value 1`] = ` * variants, absence of any variant indicates an error. * * The JSON representation for \`Value\` is JSON value. + * @name Value + * @package google.protobuf + * @see proto type: google.protobuf.Value */ export interface Value { - /** Represents a null value. */ + /** + * Represents a null value. + */ nullValue?: NullValue; - /** Represents a double value. */ + /** + * Represents a double value. + */ numberValue?: number; - /** Represents a string value. */ + /** + * Represents a string value. + */ stringValue?: string; - /** Represents a boolean value. */ + /** + * Represents a boolean value. + */ boolValue?: boolean; - /** Represents a structured value. */ + /** + * Represents a structured value. + */ structValue?: Struct; - /** Represents a repeated \`Value\`. */ + /** + * Represents a repeated \`Value\`. + */ listValue?: ListValue; }" `; @@ -152,15 +180,25 @@ exports[`traversed cosmos/app/v1alpha1/config 1`] = ` * allow a mixture of declarative and imperative app wiring, however, apps * that strive for the maximum ease of maintainability should be able to describe * their state machine with a config object alone. + * @name Config + * @package cosmos.app.v1alpha1 + * @see proto type: cosmos.app.v1alpha1.Config */ export interface Config { - /** modules are the module configurations for the app. */ + /** + * modules are the module configurations for the app. + */ modules: ModuleConfig[]; }" `; exports[`traversed cosmos/app/v1alpha1/config 2`] = ` -"/** ModuleConfig is a module configuration for an app. */ +"/** + * ModuleConfig is a module configuration for an app. + * @name ModuleConfig + * @package cosmos.app.v1alpha1 + * @see proto type: cosmos.app.v1alpha1.ModuleConfig + */ export interface ModuleConfig { /** * name is the unique name of the module within the app. It should be a name @@ -184,7 +222,12 @@ export interface ModuleConfig { `; exports[`traversed google/api/expr/v1alpha1/checked 1`] = ` -"/** A CEL expression which has been successfully type checked. */ +"/** + * A CEL expression which has been successfully type checked. + * @name CheckedExpr + * @package google.api.expr.v1alpha1 + * @see proto type: google.api.expr.v1alpha1.CheckedExpr + */ export interface CheckedExpr { /** * A map from expression ids to resolved references. @@ -240,9 +283,16 @@ export interface CheckedExpr { `; exports[`traversed google/api/expr/v1alpha1/checked 2`] = ` -"/** Describes a resolved reference to a declaration. */ +"/** + * Describes a resolved reference to a declaration. + * @name Reference + * @package google.api.expr.v1alpha1 + * @see proto type: google.api.expr.v1alpha1.Reference + */ export interface Reference { - /** The fully qualified name of the declaration. */ + /** + * The fully qualified name of the declaration. + */ name: string; /** * For references to functions, this is a list of \`Overload.overload_id\` @@ -264,7 +314,12 @@ export interface Reference { `; exports[`traversed misc/eval_request SDKType 1`] = ` -"export interface EvalRequestSDKType { +"/** + * @name EvalRequestSDKType + * @package misc + * @see proto type: misc.EvalRequest + */ +export interface EvalRequestSDKType { bindings: { [key: string]: ExprValueSDKType; }; @@ -286,12 +341,19 @@ exports[`traversed misc/eval_request SDKType 1`] = ` `; exports[`traversed osmosis/claim/v1beta1/params 1`] = ` -"/** Params defines the claim module's parameters. */ +"/** + * Params defines the claim module's parameters. + * @name Params + * @package osmosis.claim.v1beta1 + * @see proto type: osmosis.claim.v1beta1.Params + */ export interface Params { airdropStartTime: Date; durationUntilDecay: Duration; durationOfDecay: Duration; - /** denom of claimable asset */ + /** + * denom of claimable asset + */ claimDenom: string; }" `; diff --git a/packages/ast/src/encoding/proto/__tests__/__snapshots__/contracts.test.ts.snap b/packages/ast/src/encoding/proto/__tests__/__snapshots__/contracts.test.ts.snap index 5349924854..ee33cb6a97 100644 --- a/packages/ast/src/encoding/proto/__tests__/__snapshots__/contracts.test.ts.snap +++ b/packages/ast/src/encoding/proto/__tests__/__snapshots__/contracts.test.ts.snap @@ -1,22 +1,48 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`MsgExecuteContract interface 1`] = ` -"/** MsgExecuteContract submits the given message data to a smart contract */ +"/** + * MsgExecuteContract submits the given message data to a smart contract + * @name MsgExecuteContract + * @package cosmwasm.wasm.v1 + * @see proto type: cosmwasm.wasm.v1.MsgExecuteContract + */ export interface MsgExecuteContract { - /** Sender is the that actor that signed the messages */ + /** + * Sender is the that actor that signed the messages + */ sender: string; - /** Contract is the address of the smart contract */ + /** + * Contract is the address of the smart contract + */ contract: string; - /** Msg json encoded message to be passed to the contract */ + /** + * Msg json encoded message to be passed to the contract + */ msg: Uint8Array; - /** Funds coins that are transferred to the contract on execution */ + /** + * Funds coins that are transferred to the contract on execution + */ funds: Coin[]; }" `; exports[`MsgExecuteContract interface 2`] = ` -"export const MsgExecuteContract = { +"/** + * MsgExecuteContract submits the given message data to a smart contract + * @name MsgExecuteContract + * @package cosmwasm.wasm.v1 + * @see proto type: cosmwasm.wasm.v1.MsgExecuteContract + */ +export const MsgExecuteContract = { typeUrl: "/cosmwasm.wasm.v1.MsgExecuteContract", + aminoType: "wasm/MsgExecuteContract", + is(o: any): o is MsgExecuteContract { + return o && (o.$typeUrl === MsgExecuteContract.typeUrl || typeof o.sender === "string" && typeof o.contract === "string" && (o.msg instanceof Uint8Array || typeof o.msg === "string") && Array.isArray(o.funds) && (!o.funds.length || Coin.is(o.funds[0]))); + }, + isSDK(o: any): o is MsgExecuteContractSDKType { + return o && (o.$typeUrl === MsgExecuteContract.typeUrl || typeof o.sender === "string" && typeof o.contract === "string" && (o.msg instanceof Uint8Array || typeof o.msg === "string") && Array.isArray(o.funds) && (!o.funds.length || Coin.isSDK(o.funds[0]))); + }, encode(message: MsgExecuteContract, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.sender !== "") { writer.uint32(10).string(message.sender); @@ -152,6 +178,12 @@ exports[`MsgExecuteContract interface 2`] = ` typeUrl: "/cosmwasm.wasm.v1.MsgExecuteContract", value: MsgExecuteContract.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgExecuteContract.typeUrl)) { + return; + } + Coin.registerTypeUrl(); } };" `; diff --git a/packages/ast/src/encoding/proto/implements/__tests__/__snapshots__/interface-decoder.test.ts.snap b/packages/ast/src/encoding/proto/implements/__tests__/__snapshots__/interface-decoder.test.ts.snap index ca2580c7d8..920a515c74 100644 --- a/packages/ast/src/encoding/proto/implements/__tests__/__snapshots__/interface-decoder.test.ts.snap +++ b/packages/ast/src/encoding/proto/implements/__tests__/__snapshots__/interface-decoder.test.ts.snap @@ -31,11 +31,26 @@ exports[`PoolI getMapFromTypeUrlMap 1`] = ` `; exports[`PoolI objects 1`] = ` -"export const QueryPoolsResponse = { +"/** + * @name QueryPoolsResponse + * @package osmosis.gamm.v1beta1 + * @see proto type: osmosis.gamm.v1beta1.QueryPoolsResponse + */ +export const QueryPoolsResponse = { typeUrl: "/osmosis.gamm.v1beta1.QueryPoolsResponse", + aminoType: "osmosis/gamm/query-pools-response", + is(o: any): o is QueryPoolsResponse { + return o && (o.$typeUrl === QueryPoolsResponse.typeUrl || Array.isArray(o.pools) && (!o.pools.length || Pool1.is(o.pools[0]) || Pool2.is(o.pools[0]) || Any.is(o.pools[0]))); + }, + isSDK(o: any): o is QueryPoolsResponseSDKType { + return o && (o.$typeUrl === QueryPoolsResponse.typeUrl || Array.isArray(o.pools) && (!o.pools.length || Pool1.isSDK(o.pools[0]) || Pool2.isSDK(o.pools[0]) || Any.isSDK(o.pools[0]))); + }, + isAmino(o: any): o is QueryPoolsResponseAmino { + return o && (o.$typeUrl === QueryPoolsResponse.typeUrl || Array.isArray(o.pools) && (!o.pools.length || Pool1.isAmino(o.pools[0]) || Pool2.isAmino(o.pools[0]) || Any.isAmino(o.pools[0]))); + }, encode(message: QueryPoolsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.pools) { - Any.encode((v! as Any), writer.uint32(10).fork()).ldelim(); + Any.encode(GlobalDecoderRegistry.wrapAny(v!), writer.uint32(10).fork()).ldelim(); } if (message.pagination !== undefined) { PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); @@ -50,7 +65,7 @@ exports[`PoolI objects 1`] = ` const tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.pools.push((Any.decode(reader, reader.uint32()) as Any)); + message.pools.push(GlobalDecoderRegistry.unwrapAny(reader)); break; case 2: message.pagination = PageResponse.decode(reader, reader.uint32()); @@ -64,14 +79,14 @@ exports[`PoolI objects 1`] = ` }, fromJSON(object: any): QueryPoolsResponse { return { - pools: Array.isArray(object?.pools) ? object.pools.map((e: any) => Any.fromJSON(e)) : [], + pools: Array.isArray(object?.pools) ? object.pools.map((e: any) => GlobalDecoderRegistry.fromJSON(e)) : [], pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined }; }, toJSON(message: QueryPoolsResponse): JsonSafe { const obj: any = {}; if (message.pools) { - obj.pools = message.pools.map(e => e ? Any.toJSON(e) : undefined); + obj.pools = message.pools.map(e => e ? GlobalDecoderRegistry.toJSON(e) : undefined); } else { obj.pools = []; } @@ -80,20 +95,20 @@ exports[`PoolI objects 1`] = ` }, fromPartial(object: Partial): QueryPoolsResponse { const message = createBaseQueryPoolsResponse(); - message.pools = object.pools?.map(e => Any.fromPartial(e)) || []; + message.pools = object.pools?.map(e => (GlobalDecoderRegistry.fromPartial(e) as any)) || []; message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; return message; }, fromSDK(object: QueryPoolsResponseSDKType): QueryPoolsResponse { return { - pools: Array.isArray(object?.pools) ? object.pools.map((e: any) => Any.fromSDK(e)) : [], + pools: Array.isArray(object?.pools) ? object.pools.map((e: any) => GlobalDecoderRegistry.fromSDK(e)) : [], pagination: object.pagination ? PageResponse.fromSDK(object.pagination) : undefined }; }, toSDK(message: QueryPoolsResponse): QueryPoolsResponseSDKType { const obj: any = {}; if (message.pools) { - obj.pools = message.pools.map(e => e ? Any.toSDK(e) : undefined); + obj.pools = message.pools.map(e => e ? GlobalDecoderRegistry.toSDK(e) : undefined); } else { obj.pools = []; } @@ -102,7 +117,7 @@ exports[`PoolI objects 1`] = ` }, fromAmino(object: QueryPoolsResponseAmino): QueryPoolsResponse { const message = createBaseQueryPoolsResponse(); - message.pools = object.pools?.map(e => PoolI_FromAmino(e)) || []; + message.pools = object.pools?.map(e => GlobalDecoderRegistry.fromAminoMsg(e)) || []; if (object.pagination !== undefined && object.pagination !== null) { message.pagination = PageResponse.fromAmino(object.pagination); } @@ -111,7 +126,7 @@ exports[`PoolI objects 1`] = ` toAmino(message: QueryPoolsResponse): QueryPoolsResponseAmino { const obj: any = {}; if (message.pools) { - obj.pools = message.pools.map(e => e ? PoolI_ToAmino((e as Any)) : undefined); + obj.pools = message.pools.map(e => e ? GlobalDecoderRegistry.toAminoMsg(e) : undefined); } else { obj.pools = message.pools; } @@ -138,6 +153,14 @@ exports[`PoolI objects 1`] = ` typeUrl: "/osmosis.gamm.v1beta1.QueryPoolsResponse", value: QueryPoolsResponse.encode(message).finish() }; + }, + registerTypeUrl() { + if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryPoolsResponse.typeUrl)) { + return; + } + Pool1.registerTypeUrl(); + Pool2.registerTypeUrl(); + PageResponse.registerTypeUrl(); } };" `; diff --git a/packages/ast/src/encoding/proto/interface/__tests__/__snapshots__/google.proto.any.test.ts.snap b/packages/ast/src/encoding/proto/interface/__tests__/__snapshots__/google.proto.any.test.ts.snap index c0fac5b98e..d698e04097 100644 --- a/packages/ast/src/encoding/proto/interface/__tests__/__snapshots__/google.proto.any.test.ts.snap +++ b/packages/ast/src/encoding/proto/interface/__tests__/__snapshots__/google.proto.any.test.ts.snap @@ -204,6 +204,9 @@ exports[`Any api interface 1`] = ` * "@type": "type.googleapis.com/google.protobuf.Duration", * "value": "1.212s" * } + * @name AnySDKType + * @package google.protobuf + * @see proto type: google.protobuf.Any */ export interface AnySDKType { $typeUrl?: "/google.protobuf.Any" | string; @@ -293,6 +296,9 @@ exports[`Any interface 1`] = ` * "@type": "type.googleapis.com/google.protobuf.Duration", * "value": "1.212s" * } + * @name Any + * @package google.protobuf + * @see proto type: google.protobuf.Any */ export interface Any { $typeUrl?: "/google.protobuf.Any" | string; @@ -326,14 +332,106 @@ export interface Any { * used with implementation specific semantics. */ typeUrl: string; - /** Must be a valid serialized protocol buffer of the above specified type. */ + /** + * Must be a valid serialized protocol buffer of the above specified type. + */ value: Uint8Array; }" `; exports[`Any interface 2`] = ` -"export const Any = { +"/** + * \`Any\` contains an arbitrary serialized protocol buffer message along with a + * URL that describes the type of the serialized message. + * + * Protobuf library provides support to pack/unpack Any values in the form + * of utility functions or additional generated methods of the Any type. + * + * Example 1: Pack and unpack a message in C++. + * + * Foo foo = ...; + * Any any; + * any.PackFrom(foo); + * ... + * if (any.UnpackTo(&foo)) { + * ... + * } + * + * Example 2: Pack and unpack a message in Java. + * + * Foo foo = ...; + * Any any = Any.pack(foo); + * ... + * if (any.is(Foo.class)) { + * foo = any.unpack(Foo.class); + * } + * + * Example 3: Pack and unpack a message in Python. + * + * foo = Foo(...) + * any = Any() + * any.Pack(foo) + * ... + * if any.Is(Foo.DESCRIPTOR): + * any.Unpack(foo) + * ... + * + * Example 4: Pack and unpack a message in Go + * + * foo := &pb.Foo{...} + * any, err := ptypes.MarshalAny(foo) + * ... + * foo := &pb.Foo{} + * if err := ptypes.UnmarshalAny(any, foo); err != nil { + * ... + * } + * + * The pack methods provided by protobuf library will by default use + * 'type.googleapis.com/full.type.name' as the type URL and the unpack + * methods only use the fully qualified type name after the last '/' + * in the type URL, for example "foo.bar.com/x/y.z" will yield type + * name "y.z". + * + * + * JSON + * ==== + * The JSON representation of an \`Any\` value uses the regular + * representation of the deserialized, embedded message, with an + * additional field \`@type\` which contains the type URL. Example: + * + * package google.profile; + * message Person { + * string first_name = 1; + * string last_name = 2; + * } + * + * { + * "@type": "type.googleapis.com/google.profile.Person", + * "firstName": , + * "lastName": + * } + * + * If the embedded message type is well-known and has a custom JSON + * representation, that representation will be embedded adding a field + * \`value\` which holds the custom JSON in addition to the \`@type\` + * field. Example (for message [google.protobuf.Duration][]): + * + * { + * "@type": "type.googleapis.com/google.protobuf.Duration", + * "value": "1.212s" + * } + * @name Any + * @package google.protobuf + * @see proto type: google.protobuf.Any + */ +export const Any = { typeUrl: "/google.protobuf.Any", + is(o: any): o is Any { + return o && (o.$typeUrl === Any.typeUrl || typeof o.typeUrl === "string" && (o.value instanceof Uint8Array || typeof o.value === "string")); + }, + isSDK(o: any): o is AnySDKType { + return o && (o.$typeUrl === Any.typeUrl || typeof o.type_url === "string" && (o.value instanceof Uint8Array || typeof o.value === "string")); + }, encode(message: Any, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.typeUrl !== "") { writer.uint32(10).string(message.typeUrl); @@ -395,6 +493,7 @@ exports[`Any interface 2`] = ` typeUrl: "/google.protobuf.Any", value: Any.encode(message).finish() }; - } + }, + registerTypeUrl() {} };" `; diff --git a/packages/ast/src/encoding/proto/interface/__tests__/__snapshots__/interface.test.ts.snap b/packages/ast/src/encoding/proto/interface/__tests__/__snapshots__/interface.test.ts.snap index dc7f7792c1..1cede19872 100644 --- a/packages/ast/src/encoding/proto/interface/__tests__/__snapshots__/interface.test.ts.snap +++ b/packages/ast/src/encoding/proto/interface/__tests__/__snapshots__/interface.test.ts.snap @@ -1,11 +1,20 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`GenesisState interface 1`] = ` -"/** GenesisState defines the auth module's genesis state. */ +"/** + * GenesisState defines the auth module's genesis state. + * @name GenesisState + * @package cosmos.auth.v1beta1 + * @see proto type: cosmos.auth.v1beta1.GenesisState + */ export interface GenesisState { - /** params defines all the paramaters of the module. */ + /** + * params defines all the paramaters of the module. + */ params: Params; - /** accounts are the accounts present at genesis. */ + /** + * accounts are the accounts present at genesis. + */ accounts: Any[]; }" `; @@ -14,6 +23,9 @@ exports[`MsgDelegate interface 1`] = ` "/** * MsgDelegate defines a SDK message for performing a delegation of coins * from a delegator to a validator. + * @name MsgDelegate + * @package cosmos.staking.v1beta1 + * @see proto type: cosmos.staking.v1beta1.MsgDelegate */ export interface MsgDelegate { delegatorAddress: string; @@ -37,7 +49,12 @@ export interface MsgSendAmino { `; exports[`MsgSend api interface 1`] = ` -"/** MsgSend represents a message to send coins from one account to another. */ +"/** + * MsgSend represents a message to send coins from one account to another. + * @name MsgSendSDKType + * @package cosmos.bank.v1beta1 + * @see proto type: cosmos.bank.v1beta1.MsgSend + */ export interface MsgSendSDKType { from_address: string; to_address: string; @@ -46,7 +63,12 @@ export interface MsgSendSDKType { `; exports[`MsgSend interface 1`] = ` -"/** MsgSend represents a message to send coins from one account to another. */ +"/** + * MsgSend represents a message to send coins from one account to another. + * @name MsgSend + * @package cosmos.bank.v1beta1 + * @see proto type: cosmos.bank.v1beta1.MsgSend + */ export interface MsgSend { fromAddress: string; toAddress: string; @@ -70,6 +92,9 @@ exports[`PageRequest api interface 1`] = ` * Foo some_parameter = 1; * PageRequest pagination = 2; * } + * @name PageRequestSDKType + * @package cosmos.base.query.v1beta1 + * @see proto type: cosmos.base.query.v1beta1.PageRequest */ export interface PageRequestSDKType { key: Uint8Array; @@ -89,6 +114,9 @@ exports[`PageRequest interface 1`] = ` * Foo some_parameter = 1; * PageRequest pagination = 2; * } + * @name PageRequest + * @package cosmos.base.query.v1beta1 + * @see proto type: cosmos.base.query.v1beta1.PageRequest */ export interface PageRequest { /** @@ -133,6 +161,9 @@ exports[`PageResponse api interface 1`] = ` * repeated Bar results = 1; * PageResponse page = 2; * } + * @name PageResponseSDKType + * @package cosmos.base.query.v1beta1 + * @see proto type: cosmos.base.query.v1beta1.PageResponse */ export interface PageResponseSDKType { next_key: Uint8Array; @@ -149,6 +180,9 @@ exports[`PageResponse interface 1`] = ` * repeated Bar results = 1; * PageResponse page = 2; * } + * @name PageResponse + * @package cosmos.base.query.v1beta1 + * @see proto type: cosmos.base.query.v1beta1.PageResponse */ export interface PageResponse { /** @@ -186,6 +220,9 @@ exports[`confio/proofs.proto ExistenceProof 1`] = ` * With LengthOp this is tricker but not impossible. Which is why the "leafPrefixEqual" field * in the ProofSpec is valuable to prevent this mutability. And why all trees should * length-prefix the data before hashing it. + * @name ExistenceProof + * @package ics23 + * @see proto type: ics23.ExistenceProof */ export interface ExistenceProof { key: Uint8Array; @@ -200,6 +237,9 @@ exports[`cosmos/auth/v1beta1/auth.proto BaseAccount 1`] = ` * BaseAccount defines a base account type. It contains all the necessary fields * for basic account functionality. Any custom account type should extend this * type for additional functionality (e.g. vesting). + * @name BaseAccount + * @package cosmos.auth.v1beta1 + * @see proto type: cosmos.auth.v1beta1.BaseAccount */ export interface BaseAccount { $typeUrl?: "/cosmos.auth.v1beta1.BaseAccount"; @@ -211,7 +251,12 @@ export interface BaseAccount { `; exports[`cosmos/auth/v1beta1/auth.proto ModuleAccount 1`] = ` -"/** ModuleAccount defines an account for modules that holds coins on a pool. */ +"/** + * ModuleAccount defines an account for modules that holds coins on a pool. + * @name ModuleAccount + * @package cosmos.auth.v1beta1 + * @see proto type: cosmos.auth.v1beta1.ModuleAccount + */ export interface ModuleAccount { $typeUrl?: "/cosmos.auth.v1beta1.ModuleAccount"; baseAccount?: BaseAccount; @@ -224,9 +269,12 @@ exports[`cosmos/authz/v1beta1/authz.proto Grant 1`] = ` "/** * Grant gives permissions to execute * the provide method with expiration time. + * @name Grant + * @package cosmos.authz.v1beta1 + * @see proto type: cosmos.authz.v1beta1.Grant */ export interface Grant { - authorization?: (GenericAuthorization & DepositDeploymentAuthorization1 & DepositDeploymentAuthorization2 & SendAuthorization & StakeAuthorization & Any) | undefined; + authorization?: GenericAuthorization | DepositDeploymentAuthorization1 | DepositDeploymentAuthorization2 | 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\` @@ -247,11 +295,14 @@ exports[`cosmos/authz/v1beta1/authz.proto GrantAuthorization 1`] = ` "/** * GrantAuthorization extends a grant with both the addresses of the grantee and granter. * It is used in genesis.proto and query.proto + * @name GrantAuthorization + * @package cosmos.authz.v1beta1 + * @see proto type: cosmos.authz.v1beta1.GrantAuthorization */ export interface GrantAuthorization { granter: string; grantee: string; - authorization?: (GenericAuthorization & DepositDeploymentAuthorization1 & DepositDeploymentAuthorization2 & SendAuthorization & StakeAuthorization & Any) | undefined; + authorization?: GenericAuthorization | DepositDeploymentAuthorization1 | DepositDeploymentAuthorization2 | SendAuthorization | StakeAuthorization | Any | undefined; expiration?: Date; }" `; @@ -264,13 +315,22 @@ exports[`cosmos/authz/v1beta1/authz.proto GrantAuthorization Type 1`] = ` `; exports[`cosmos/authz/v1beta1/query.proto QueryGrantsRequest 1`] = ` -"/** QueryGrantsRequest is the request type for the Query/Grants RPC method. */ +"/** + * QueryGrantsRequest is the request type for the Query/Grants RPC method. + * @name QueryGrantsRequest + * @package cosmos.authz.v1beta1 + * @see proto type: cosmos.authz.v1beta1.QueryGrantsRequest + */ export interface QueryGrantsRequest { granter: string; grantee: string; - /** Optional, msg_type_url, when set, will query only grants matching given msg type. */ + /** + * Optional, msg_type_url, when set, will query only grants matching given msg type. + */ msgTypeUrl: string; - /** pagination defines an pagination for the request. */ + /** + * pagination defines an pagination for the request. + */ pagination?: PageRequest; }" `; diff --git a/packages/ast/src/encoding/proto/interface/__tests__/__snapshots__/interface.type-encoded.test.ts.snap b/packages/ast/src/encoding/proto/interface/__tests__/__snapshots__/interface.type-encoded.test.ts.snap index c18894ea22..9ed5bccfad 100644 --- a/packages/ast/src/encoding/proto/interface/__tests__/__snapshots__/interface.type-encoded.test.ts.snap +++ b/packages/ast/src/encoding/proto/interface/__tests__/__snapshots__/interface.type-encoded.test.ts.snap @@ -10,9 +10,12 @@ exports[`cosmos/gov/v1beta1/tx.proto createProtoType 1`] = ` "/** * MsgSubmitProposal defines an sdk.Msg type that supports submitting arbitrary * proposal Content. + * @name MsgSubmitProposal + * @package cosmos.gov.v1beta1 + * @see proto type: cosmos.gov.v1beta1.MsgSubmitProposal */ export interface MsgSubmitProposal { - content?: (TextProposal & RegisterIncentiveProposal & ClientUpdateProposal & UpgradeProposal & ReplacePoolIncentivesProposal & UpdatePoolIncentivesProposal & SetSuperfluidAssetsProposal & RemoveSuperfluidAssetsProposal & UpdateUnpoolWhiteListProposal & UpdateFeeTokenProposal & Any) | undefined; + content?: TextProposal | RegisterIncentiveProposal | ClientUpdateProposal | UpgradeProposal | ReplacePoolIncentivesProposal | UpdatePoolIncentivesProposal | SetSuperfluidAssetsProposal | RemoveSuperfluidAssetsProposal | UpdateUnpoolWhiteListProposal | UpdateFeeTokenProposal | Any | undefined; initialDeposit: Coin[]; proposer: string; }" diff --git a/packages/telescope/README.md b/packages/telescope/README.md index 790bd9b682..9f32bad4bb 100644 --- a/packages/telescope/README.md +++ b/packages/telescope/README.md @@ -532,12 +532,12 @@ telescope({ | option | description | defaults | | ----------------------------------------- | -------------------------------------------------------------- | ---------- | | `interfaces.enabled` | Enable converters between Any type and specific implemented interfaces | `true` | -| `interfaces.useGlobalDecoderRegistry` | Enable GlobalDecoderRegistry and related functions. Highly recommended when dealing with fields with 'accepted_interface' option. See 'packages/telescope/__tests__/impl-interfaces.test.ts' for usage. | `false` | +| `interfaces.useGlobalDecoderRegistry` | Enable GlobalDecoderRegistry and related functions. Highly recommended when dealing with fields with 'accepted_interface' option. See 'packages/telescope/__tests__/impl-interfaces.test.ts' for usage. | `true` | | `interfaces.registerAllDecodersToGlobal` | Automatically register all decoders to the global registry | `true` | | `interfaces.useUseInterfacesParams` | Add `useInterfaces` argument to `decode` and `toAmino` functions | `false` | | `interfaces.useByDefault` | Use interface decoders by default (default for `useInterfaces` argument to `decode` and `toAmino` functions) | `true` | | `interfaces.useByDefaultRpc` | Use interface decoders by default in RPC clients | `true` | -| `interfaces.useUnionTypes` | Generate Any type as union types (TextProposal \| RegisterIncentiveProposal) instead of intersection types (TextProposal & RegisterIncentiveProposal) | `false` | +| `interfaces.useUnionTypes` | Generate Any type as union types (TextProposal \| RegisterIncentiveProposal) instead of intersection types (TextProposal & RegisterIncentiveProposal) | `true` | ### Prototypes Options @@ -563,7 +563,7 @@ telescope({ | `prototypes.addTypeUrlToObjects` | Add typeUrl field to generated Decoders | `true` | | `prototypes.strictNullCheckForPrototypeMethods` | Enable strict null checks for prototype methods | `false` | | `prototypes.paginationDefaultFromPartial` | Set default values for pagination in fromPartial methods | `false` | -| `prototypes.enableRegistryLoader` | Generate Registry loader in *.registry.ts files | `true` | +| `prototypes.enableRegistryLoader` | Generate Registry loader in *.registry.ts files | `false` | | `prototypes.enableMessageComposer` | Generate MessageComposer in *.registry.ts files | `true` | | `prototypes.patch` | Object mapping filenames to an array of `Operation` to be applied as patches to proto files during generation. See [JSON Patch Protos](#json-patch-protos) | `undefined` | @@ -573,12 +573,16 @@ telescope({ | ---------------------------------- | ----------------------------------------------------------------- | ------- | | `prototypes.methods.encode` | Enable `encode` method on proto objects | `true` | | `prototypes.methods.decode` | Enable `decode` method on proto objects | `true` | -| `prototypes.methods.fromJSON` | Enable `fromJSON` method on proto objects | `true` | -| `prototypes.methods.toJSON` | Enable `toJSON` method on proto objects | `true` | +| `prototypes.methods.fromJSON` | Enable `fromJSON` method on proto objects | `false` | +| `prototypes.methods.toJSON` | Enable `toJSON` method on proto objects | `false` | | `prototypes.methods.fromPartial` | Enable `fromPartial` method on proto objects | `true` | | `prototypes.methods.fromSDK` | Enable `fromSDK` method on proto objects | `false` | | `prototypes.methods.toSDK` | Enable `toSDK` method on proto objects | `false` | - +| `prototypes.methods.fromSDKJSON` | boolean to enable `fromSDKJSON` method on proto objects | `false` | +| `prototypes.methods.toAmino` | boolean to enable `toAmino` method on proto objects | `true` | +| `prototypes.methods.fromAmino` | boolean to enable `fromAmino` method on proto objects | `true` | +| `prototypes.methods.toProto` | boolean to enable `toProto` method on proto objects | `true` | +| `prototypes.methods.fromProto` | boolean to enable `fromProto` method on proto objects | `true` | ### Enums Options | option | description | defaults | @@ -590,7 +594,7 @@ telescope({ | option | description | defaults | | ------------------------------ | -------------------------------------------------------------- | ---------- | -| `lcdClients.enabled` | Generate LCD clients that can query proto `Query` messages | `true` | +| `lcdClients.enabled` | Generate LCD clients that can query proto `Query` messages | `false` | | `lcdClients.bundle` | Generate factory bundle aggregate of all LCD Clients | `true` | | `lcdClients.scoped` | Generate factory of scoped LCD Clients | `undefined`| | `lcdClients.scopedIsExclusive` | Allow both scoped bundles and all RPC Clients | `true` | @@ -612,7 +616,7 @@ See [LCD Clients](#lcd-clients) for more info. | option | description | defaults | | ------------------------------ | ---------------------------------------------------------------------- | ----------------------------- | | `rpcClients.type` | Generate this type of RPC client (`tendermint`, `gRPC-web`, `gRPC`)| `tendermint` | -| `rpcClients.enabled` | Generate RPC clients that can interact with proto messages | `true` | +| `rpcClients.enabled` | Generate RPC clients that can interact with proto messages | `false` | | `rpcClients.bundle` | Generate factory bundle aggregate of all RPC Clients | `true` | | `rpcClients.inline` | Inline all RPC client methods into a single file | `false` | | `rpcClients.extensions` | Enable extensions for RPC clients | `true` | @@ -637,8 +641,8 @@ See [RPC Clients](#rpc-clients) for more info. | Option | Description | Defaults | | --------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------- | -| `helperFunctions.enabled` | Enable the generation of helper function files `.func.ts` | `false` | -| `helperFunctions.useGlobalDecoderRegistry` | Use global decoder registry in helper functions | `false` | +| `helperFunctions.enabled` | Enable the generation of helper function files `.func.ts` | `true` | +| `helperFunctions.useGlobalDecoderRegistry` | Use global decoder registry in helper functions | `true` | | `helperFunctions.hooks` | Generates hooks selected alongside helper functions | `{ react: false, vue: false }` | | `helperFunctions.include.serviceTypes`| Specifies which types of services to include (`Query`, `Msg`). `undefined` includes all types. | `undefined` | | `helperFunctions.include.patterns` | Array of glob patterns patterns (e.g., `"**"`, `"cosmos.bank.v1beta1.bala*"`, etc.) to match specific proto services. | `undefined` | @@ -656,8 +660,9 @@ See [Helper Functions Configuration](#helper-functions-configuration) for more i | option | description | defaults | | -------------------------------------------- | -------------------------------------------------------------- | ---------| -| `stargateClients.includeCosmosDefaultTypes` | Include the CosmJS defaults with stargate clients | `true` (except cosmos package) | -| `stargateClients.addGetTxRpc` | Add getSigningTxRpc to clients in namespaces | `false` | +| `stargateClients.enabled` | if true, will include the cosmjs defaults with stargate clients | `false` | +| `stargateClients.includeCosmosDefaultTypes` | if true, will include the cosmjs defaults with stargate clients | `true` (except cosmos package) | +| `stargateClients.addGetTxRpc` | if true, will add getSigningTxRpc to clients in namespaces | `false` | ### State Management @@ -706,10 +711,10 @@ See [Helper Functions Configuration](#helper-functions-configuration) for more i | `prototypes.typingsFormat.customTypes.useEnhancedDecimal` | Use patched decimal instead of decimal from @cosmjs/math | `false` | | `prototypes.typingsFormat.customTypes.base64Lib` | Use endo/base64 methods | `undefined` | | `prototypes.typingsFormat.num64` | 'long' or 'bigint', the way of generating int64 proto types. Set to 'bigint' to use more stable built-in type | `bigint` | -| `prototypes.typingsFormat.useTelescopeGeneratedType` | Discard GeneratedType from CosmJS, use TelescopeGeneratedType instead inside *.registry.ts files | `false` | +| `prototypes.typingsFormat.useTelescopeGeneratedType` | Discard GeneratedType from CosmJS, use TelescopeGeneratedType instead inside *.registry.ts files | `true` | | `prototypes.typingsFormat.useDeepPartial` | Use `DeepPartial` type instead of `Partial` TS type | `false` | | `prototypes.typingsFormat.useExact` | Use the `Exact` TS type | `false` | -| `prototypes.typingsFormat.toJsonUnknown` | Use `any` for `toJSON` methods instead of `JsonSafe` | `true` | +| `prototypes.typingsFormat.toJsonUnknown` | Use `any` for `toJSON` methods instead of `JsonSafe` | `false` | | `prototypes.typingsFormat.timestamp` | Use either `date` or `timestamp` for `Timestamp` proto type | "date" | | `prototypes.typingsFormat.duration` | Use either `duration` or `string` for `Duration` proto type | "duration"| | `prototypes.typingsFormat.updatedDuration` | temporary field to avoid breaking changes | `false` | @@ -721,6 +726,9 @@ See [Helper Functions Configuration](#helper-functions-configuration) for more i | option | description | defaults | | ----------------------------------------- | -------------------------------------------------------------- | --------- | +| `prototypes.parser.keepCase` | passes `keepCase` to protobuf `parse()` to keep original casing | `false` | +| `prototypes.parser.alternateCommentMode` | passes `alternateCommentMode` to protobuf `parse()` method | `true` | +| `prototypes.parser.preferTrailingComment` | passes `preferTrailingComment` to protobuf `parse()` method | `false` | | `prototypes.parser.keepCase` | Pass `keepCase` to protobuf `parse()` to keep original casing | `true` | | `prototypes.parser.alternateCommentMode` | Pass `alternateCommentMode` to protobuf `parse()` method | `true` | | `prototypes.parser.preferTrailingComment` | Pass `preferTrailingComment` to protobuf `parse()` method | `false` | @@ -766,6 +774,13 @@ See [MCP Integration](https://docs.hyperweb.io/telescope/developing/mcp-integrat | option | description | defaults | | ------------------------------ | ----------------------------------------------------------------- | ---------- | +| `env` | 'default' or 'v-next', set to 'v-next' to enable yet to release features | `v-next` | +| `useInterchainJs` | use interchain.js features | `true` | +| `removeUnusedImports` | removes unused imports | `true` | +| `classesUseArrowFunctions` | classes use arrow functions instead of `bind()`ing in constructors | `false` | +| `useSDKTypes` | use SDK types | `true` | +| `includeExternalHelpers` | exports a few helpers functions in `extern.ts` | `false` | +| `restoreImportExtension` | restore extensions of imported paths. e.g: '.js'. null means no ext | `null` | | `env` | 'default' or 'v-next', set to 'v-next' to enable yet-to-be-released features | `default` | | `removeUnusedImports` | Remove unused imports | `true` | | `classesUseArrowFunctions` | Classes use arrow functions instead of `bind()`ing in constructors | `false` | @@ -1587,4 +1602,3 @@ Thanks to these engineers, teams and projects for inspiring Telescope: AS DESCRIBED IN THE LICENSES, THE SOFTWARE IS PROVIDED "AS IS", AT YOUR OWN RISK, AND WITHOUT WARRANTIES OF ANY KIND. No developer or entity involved in creating this software will be liable for any claims or damages whatsoever associated with your use, inability to use, or your interaction with other users of the code, including any direct, indirect, incidental, special, exemplary, punitive or consequential damages, or loss of profits, cryptocurrencies, tokens, or anything else of value. - diff --git a/packages/telescope/__tests__/cosmjs-types.test.ts b/packages/telescope/__tests__/cosmjs-types.test.ts index e128663b4a..109e1fc6a8 100644 --- a/packages/telescope/__tests__/cosmjs-types.test.ts +++ b/packages/telescope/__tests__/cosmjs-types.test.ts @@ -10,6 +10,8 @@ const store = getTestProtoStore2(); store.traverseAll(); const options: TelescopeOptions = { + env: "default", + useInterchainJs: false, useSDKTypes: false, removeUnusedImports: false, tsDisable: { @@ -29,6 +31,7 @@ const options: TelescopeOptions = { includePackageVar: true, addTypeUrlToDecoders: false, addTypeUrlToObjects: false, + enableRegistryLoader: true, excluded: { protos: [ 'cosmos/authz/v1beta1/event.proto', @@ -63,12 +66,13 @@ const options: TelescopeOptions = { }, typingsFormat: { customTypes: { - useCosmosSDKDec: false + useCosmosSDKDec: false }, useDeepPartial: true, num64: 'long', timestamp: 'timestamp', - duration: 'duration' + duration: 'duration', + useTelescopeGeneratedType: false, } }, lcdClients: { @@ -87,10 +91,19 @@ const options: TelescopeOptions = { 'ABCIApplication' ] }, + stargateClients: { + enabled: true, + }, aminoEncoding: { enabled: false, - useLegacyInlineEncoding: true - } + useLegacyInlineEncoding: true, + customTypes: { + useCosmosSDKDec: false, + }, + }, + helperFunctions: { + enabled: false, + }, }; const input: TelescopeInput = { diff --git a/packages/telescope/__tests__/impl-interfaces.test.ts b/packages/telescope/__tests__/impl-interfaces.test.ts index e46a1a6f96..61f3c3a7a8 100644 --- a/packages/telescope/__tests__/impl-interfaces.test.ts +++ b/packages/telescope/__tests__/impl-interfaces.test.ts @@ -7,6 +7,11 @@ import { import { Any } from "../../../__fixtures__/misc/output-impl-interfaces-gen/google/protobuf/any"; import { SendAuthorization } from "../../../__fixtures__/misc/output-impl-interfaces-gen/cosmos/bank/v1beta1/authz"; +beforeAll(() => { + GenericAuthorization.registerTypeUrl(); + SendAuthorization.registerTypeUrl(); +}); + describe("implements interface works", () => { it("encodes and decodes", () => { const data = Grant.encode({ diff --git a/packages/telescope/__tests__/telescope.test.ts b/packages/telescope/__tests__/telescope.test.ts index ba8d51ae99..82f766b220 100644 --- a/packages/telescope/__tests__/telescope.test.ts +++ b/packages/telescope/__tests__/telescope.test.ts @@ -14,7 +14,8 @@ const contractsDir = __dirname + '/../../../__fixtures__/wasm/'; store.traverseAll(); const options: TelescopeOptions = { - + env: "default", + useInterchainJs: false, removeUnusedImports: false, classesUseArrowFunctions: false, @@ -67,6 +68,7 @@ const options: TelescopeOptions = { fieldDefaultIsOptional: false, useOptionalNullable: true, allowUndefinedTypes: false, + enableRegistryLoader: true, excluded: { packages: [ // 'cosmos.gov.v1', @@ -84,7 +86,8 @@ const options: TelescopeOptions = { useDeepPartial: true, useExact: false, timestamp: 'date', - duration: 'duration' + duration: 'duration', + useTelescopeGeneratedType: false, } }, @@ -236,6 +239,9 @@ const options: TelescopeOptions = { aminoType: 'mymessage-testonly' } }, + customTypes: { + useCosmosSDKDec: false, + }, typeUrlToAmino: (typeUrl: string) => { const name = typeUrl.replace(/^\//, ''); const elements = name.split('.'); @@ -253,6 +259,11 @@ const options: TelescopeOptions = { }, useLegacyInlineEncoding: true }, + + helperFunctions: { + enabled: false, + }, + packages: { akash: { classesUseArrowFunctions: true, diff --git a/packages/telescope/src/commands/transpile.ts b/packages/telescope/src/commands/transpile.ts index 7545d5fa8b..a19775cbec 100644 --- a/packages/telescope/src/commands/transpile.ts +++ b/packages/telescope/src/commands/transpile.ts @@ -27,10 +27,11 @@ export default async (argv: { } else { options = { // global options (can be overridden through plugins) + useInterchainJs: true, interfaces: { - enabled: false, - useByDefault: false, - useUnionTypes: false, + enabled: true, + useByDefault: true, + useUnionTypes: true, }, prototypes: { @@ -53,37 +54,43 @@ export default async (argv: { addTypeUrlToDecoders: true, typingsFormat: { - duration: 'duration', - timestamp: 'date', - useExact: false, - useDeepPartial: false, - num64: 'bigint', customTypes: { - useCosmosSDKDec: true - } + useCosmosSDKDec: true, + }, + num64: "bigint", + useDeepPartial: false, + useExact: false, + toJsonUnknown: false, + timestamp: "date", + duration: "duration", + updatedDuration: false, + useTelescopeGeneratedType: true, + setDefaultEnumToUnrecognized: true, + autoFixUndefinedEnumDefault: false, }, }, bundle: { - enabled: true + enabled: true, + type: "namespace", }, stargateClients: { - enabled: true, + enabled: false, includeCosmosDefaultTypes: true }, aminoEncoding: { enabled: true, + useLegacyInlineEncoding: false, }, lcdClients: { - enabled: true + enabled: false }, rpcClients: { - enabled: true, - camelCase: true + enabled: false, } } @@ -95,7 +102,7 @@ export default async (argv: { type: 'path', name: 'protoDirs', message: 'where is the proto directory?', - default: './proto' + default: './protos' }, { _: true, diff --git a/packages/types/src/telescope.ts b/packages/types/src/telescope.ts index 4cd1bac585..ada4401342 100644 --- a/packages/types/src/telescope.ts +++ b/packages/types/src/telescope.ts @@ -971,7 +971,8 @@ export type TelescopeOption = keyof TelescopeOpts; export const defaultTelescopeOptions: TelescopeOptions = { // global options (can be overridden through plugins) - env: "default", + env: "v-next", + useInterchainJs: true, removeUnusedImports: true, classesUseArrowFunctions: false, useSDKTypes: true, @@ -981,10 +982,11 @@ export const defaultTelescopeOptions: TelescopeOptions = { interfaces: { enabled: true, - registerAllDecodersToGlobal: true, + useGlobalDecoderRegistry: true, + registerAllDecodersToGlobal: false, useByDefault: true, useByDefaultRpc: true, - useUnionTypes: false, + useUnionTypes: true, }, prototypes: { @@ -1018,7 +1020,7 @@ export const defaultTelescopeOptions: TelescopeOptions = { addAminoTypeToObjects: false, addTypeUrlToDecoders: true, - enableRegistryLoader: true, + enableRegistryLoader: false, enableMessageComposer: true, optionalQueryParams: false, @@ -1035,7 +1037,7 @@ export const defaultTelescopeOptions: TelescopeOptions = { timestamp: "date", duration: "duration", updatedDuration: false, - + useTelescopeGeneratedType: true, setDefaultEnumToUnrecognized: true, autoFixUndefinedEnumDefault: false, }, @@ -1063,14 +1065,15 @@ export const defaultTelescopeOptions: TelescopeOptions = { }, stargateClients: { - enabled: true, + enabled: false, includeCosmosDefaultTypes: true, }, aminoEncoding: { enabled: true, + useLegacyInlineEncoding: false, customTypes: { - useCosmosSDKDec: false, + useCosmosSDKDec: true, }, omitEmptyTags: ["omitempty", "dont_omitempty"], casingFn: snake, @@ -1080,7 +1083,7 @@ export const defaultTelescopeOptions: TelescopeOptions = { }, lcdClients: { bundle: true, - enabled: true, + enabled: false, scopedIsExclusive: true, }, rpcClients: { @@ -1088,7 +1091,7 @@ export const defaultTelescopeOptions: TelescopeOptions = { clientStyle: { useUpdatedClientStyle: false, }, - enabled: true, + enabled: false, extensions: true, inline: false, bundle: true, @@ -1124,6 +1127,15 @@ export const defaultTelescopeOptions: TelescopeOptions = { }, }, + helperFunctions: { + enabled: true, + useGlobalDecoderRegistry: true, + hooks: { + react: false, + vue: false + } + }, + mcpServer: { enabled: false, }, diff --git a/yarn.lock b/yarn.lock index c692d5beb9..416fa34f3d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1825,94 +1825,94 @@ resolved "https://registry.npmjs.org/@hutson/parse-repository-url/-/parse-repository-url-3.0.2.tgz" integrity sha512-H9XAx3hc0BQHY6l+IFSWHDySypcXsvsuLhgYLUGywmJ5pswRVQJUHpOsobnLYp2ZUaUlKiKDrgWWhosOwAEM8Q== -"@interchainjs/amino@1.12.1": - version "1.12.1" - resolved "https://registry.npmjs.org/@interchainjs/amino/-/amino-1.12.1.tgz#5f34629e43677876af55dd0d67598c6a4ca229e2" - integrity sha512-byMxeEvk69x1RgD3khx+tqbEAOTl8fxd1PpkUovIbyRprv4fzJpXKF2e1ib/QzAjjydqOdeFXZ3qlVHQPWYZ7g== - dependencies: - "@interchainjs/crypto" "1.12.1" - "@interchainjs/encoding" "1.12.1" - "@interchainjs/math" "1.12.1" - "@interchainjs/utils" "1.12.1" - -"@interchainjs/cosmos-types@1.12.1": - version "1.12.1" - resolved "https://registry.npmjs.org/@interchainjs/cosmos-types/-/cosmos-types-1.12.1.tgz#5fd60d61189e229dccc5b20c128ec5bbc9b55f9b" - integrity sha512-f0XEuROy4nRaF5l15uX7/xMKn8R7iprijzAayL+ukVvZ7qe6QpIZUUHZf3ZaYROwL+UqEf4abXaOdeTdVYDfRw== - dependencies: - "@interchainjs/math" "1.12.1" - "@interchainjs/types" "1.12.1" - "@interchainjs/utils" "1.12.1" - -"@interchainjs/cosmos@1.12.1": - version "1.12.1" - resolved "https://registry.npmjs.org/@interchainjs/cosmos/-/cosmos-1.12.1.tgz#bbd22552d9efb0e75d8e87c3cbe118bf89204dee" - integrity sha512-GvtoQgltqnBVF/67iG5lhEsL6p/tWJNzBQORTpr3FEGs1fOfdeHhohdM76ebfH1IsjX7Y2n1e73pVcLp6Y2XxQ== - dependencies: - "@interchainjs/cosmos-types" "1.12.1" - "@interchainjs/encoding" "1.12.1" - "@interchainjs/types" "1.12.1" - "@interchainjs/utils" "1.12.1" +"@interchainjs/amino@1.13.0": + version "1.13.0" + resolved "https://registry.npmjs.org/@interchainjs/amino/-/amino-1.13.0.tgz#c6958295c7b756ec88932d8b4c85aae582306f2b" + integrity sha512-0k9nV8gy7TXmNzHyPnHRwixyxYs3FanpsOUVo51urzl9KmdOFrZIbt4m8vJJWY3yjUz+UZdG8iqf0X55uIaYLQ== + dependencies: + "@interchainjs/crypto" "1.13.0" + "@interchainjs/encoding" "1.13.0" + "@interchainjs/math" "1.13.0" + "@interchainjs/utils" "1.13.0" + +"@interchainjs/cosmos-types@1.13.0": + version "1.13.0" + resolved "https://registry.npmjs.org/@interchainjs/cosmos-types/-/cosmos-types-1.13.0.tgz#d1d320d0fe5e58344372a2e87f6d5cd2985afc88" + integrity sha512-JnPVdiB9Bz2AOl7uW9/2hKV2bOq13IfL9+jEmBQCSSlQ29w0RqCmXUwXs3aNZACJzEPiv6Q4ZnQjwqSOmRxJjQ== + dependencies: + "@interchainjs/math" "1.13.0" + "@interchainjs/types" "1.13.0" + "@interchainjs/utils" "1.13.0" + +"@interchainjs/cosmos@1.13.0": + version "1.13.0" + resolved "https://registry.npmjs.org/@interchainjs/cosmos/-/cosmos-1.13.0.tgz#1b47b896dffb811ea3dbeae9a451f79c7f11ec2f" + integrity sha512-LpBsM0vvtssWgPNyq280+vvX7PVRa+ML1MGjeRf74ohHTihgj3SYBjy0FCKV5cq5XdWIs/Y5QL1mzUWopETeDw== + dependencies: + "@interchainjs/cosmos-types" "1.13.0" + "@interchainjs/encoding" "1.13.0" + "@interchainjs/types" "1.13.0" + "@interchainjs/utils" "1.13.0" "@noble/curves" "^1.1.0" "@noble/hashes" "^1.3.1" bech32 "^1.1.4" decimal.js "^10.4.3" deepmerge "4.2.2" -"@interchainjs/crypto@1.12.1": - version "1.12.1" - resolved "https://registry.npmjs.org/@interchainjs/crypto/-/crypto-1.12.1.tgz#8b4f43a79fe00de1313df1def7d7d0082acc56f2" - integrity sha512-tLd/jFujfwQt7+WGJZfkBy97U/Ffh4eMbxB1oJ1S1/tIdFxxhKzYVfP+UGlpDWGK6D2heNxcmQ5UHNc7pplKdA== +"@interchainjs/crypto@1.13.0": + version "1.13.0" + resolved "https://registry.npmjs.org/@interchainjs/crypto/-/crypto-1.13.0.tgz#7b91769b79cc5f5fa8f1c4fb3e4435ca873eb31c" + integrity sha512-e8B7AC/t+Or13sxFJA225ts2gvcFX4xhuPb0mqcmgm+MULQXRahdBEdd/RLslFCEr5KA0PcnY59CtXQKbedLmA== dependencies: - "@interchainjs/encoding" "1.12.1" - "@interchainjs/math" "1.12.1" - "@interchainjs/utils" "1.12.1" + "@interchainjs/encoding" "1.13.0" + "@interchainjs/math" "1.13.0" + "@interchainjs/utils" "1.13.0" "@noble/hashes" "^1" bn.js "^5.2.0" elliptic "^6.5.4" libsodium-wrappers-sumo "^0.7.11" -"@interchainjs/encoding@1.12.1": - version "1.12.1" - resolved "https://registry.npmjs.org/@interchainjs/encoding/-/encoding-1.12.1.tgz#9cfe523feac114cd0e0487bca170819acb6a8af6" - integrity sha512-vgn5AZN2Gvw5aUIxbZUfLX9yKOF4WC1geZcVwD9oRYWnPp646UrSOD0qgsM6y7hjKqc2m5s+Ldc25ko4T1aHXA== +"@interchainjs/encoding@1.13.0": + version "1.13.0" + resolved "https://registry.npmjs.org/@interchainjs/encoding/-/encoding-1.13.0.tgz#05eeaa832765e9790b13b1dbdb7d8875c840b72a" + integrity sha512-K/f/8sZQSieTwEjDnpHsu2EG2PNa7hPI2KeGyrPAunpr0HjyOTYf7hUdMhdptoXGPiRaUtF2T1OPdnhvqbWdUg== dependencies: - "@interchainjs/math" "1.12.1" + "@interchainjs/math" "1.13.0" base64-js "^1.3.0" bech32 "^1.1.4" readonly-date "^1.0.0" -"@interchainjs/math@1.12.1": - version "1.12.1" - resolved "https://registry.npmjs.org/@interchainjs/math/-/math-1.12.1.tgz#e8c81cc4842bd6a57f9dea9f49f0b5f4219abf84" - integrity sha512-YIyTfw0Dv3UNEWaHv2DcZbow4VyISPZFYqIouaHu2TF7vqj541/aUsQYhRr+7HStxYayC+JcpEqw5cbpboP0pA== +"@interchainjs/math@1.13.0": + version "1.13.0" + resolved "https://registry.npmjs.org/@interchainjs/math/-/math-1.13.0.tgz#8b88b15779ecef77781036cd04a568ed379b1c3a" + integrity sha512-Lg6XU4dKZWNRRkOUI+JovaT7hKDq+UoBXy/79O/OyKnCfX5M0qOD79WYqnKVEk4CGlfTgmUKRXFVED9PNTNTXw== dependencies: bn.js "^5.2.0" -"@interchainjs/pubkey@1.12.1": - version "1.12.1" - resolved "https://registry.npmjs.org/@interchainjs/pubkey/-/pubkey-1.12.1.tgz#bd9084330a95fc060b6dbac50044394df7852928" - integrity sha512-glPQadta0U7QM7QcPPK3EfCUV0m5NXRhbSMSfo2VfR0is5+pfIgCKyuAywvsBXokWdyBN6Jz4QcgiY0AuRiC4A== +"@interchainjs/pubkey@1.13.0": + version "1.13.0" + resolved "https://registry.npmjs.org/@interchainjs/pubkey/-/pubkey-1.13.0.tgz#2ea5bac88c0f2846b18598c9c0611cc497faa879" + integrity sha512-QPphTwjqsrXMVLzyY1ItDwuwKtDGAwJsteWMmMq8xoiMyMyQX8RhfbeRXYAMxTVbuj2bSUu64iqcLvj5OaUy/g== dependencies: - "@interchainjs/amino" "1.12.1" - "@interchainjs/cosmos-types" "1.12.1" - "@interchainjs/encoding" "1.12.1" - "@interchainjs/math" "1.12.1" - "@interchainjs/types" "1.12.1" + "@interchainjs/amino" "1.13.0" + "@interchainjs/cosmos-types" "1.13.0" + "@interchainjs/encoding" "1.13.0" + "@interchainjs/math" "1.13.0" + "@interchainjs/types" "1.13.0" -"@interchainjs/types@1.12.1": - version "1.12.1" - resolved "https://registry.npmjs.org/@interchainjs/types/-/types-1.12.1.tgz#994d9d646ef6ce157aa59b25f69bc57a480c7f27" - integrity sha512-gbc6yO0f7r8Dm4iYQfJdzKoFhlHjsfTiI4fEz+MDmpLH74Y/slIQ4MO29mRb4OwqLwsW+sx12Gz/1VVuMtN2Sg== +"@interchainjs/types@1.13.0": + version "1.13.0" + resolved "https://registry.npmjs.org/@interchainjs/types/-/types-1.13.0.tgz#2d9b000cecbf37bd8f4ccdc98f4250ab0c0e19d2" + integrity sha512-U5j2R8c87Y7Bpt6TuTacyJlfFg0vGlY7eQGxlT9g5IEN/kpVwNOQMQQaemFPtghWKAMQbS0EazOL8fNA83zbxA== dependencies: decimal.js "^10.4.3" -"@interchainjs/utils@1.12.1": - version "1.12.1" - resolved "https://registry.npmjs.org/@interchainjs/utils/-/utils-1.12.1.tgz#51b83c63ee53c50b2715b61c9f9e695c1c328ede" - integrity sha512-/f5/1h2rC4eDImuBsWIJZ/yqnYqwtA/ltYpjvhkNFitumZaL9VvcT8ymBmqFLhiWfED0FJ3eT0d9jZpraie0YQ== +"@interchainjs/utils@1.13.0": + version "1.13.0" + resolved "https://registry.npmjs.org/@interchainjs/utils/-/utils-1.13.0.tgz#6b00b582679be9f22f8b217d71e0fadbff0b7472" + integrity sha512-BiFNUMYl89XBmvhyGYeiieCGA4VvU1P/LXXGDCfmsuQ4DYcE5nhWp2RiUvcu26pd4JI8LKou/hmEps1pTD/dCQ== dependencies: - "@interchainjs/types" "1.12.1" + "@interchainjs/types" "1.13.0" bech32 "^2.0.0" decimal.js "^10.4.3"